@dodoex/wallet-web3 0.6.3 → 0.6.5

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 (217) hide show
  1. package/dist/PhArrowCircleDown-4a08ae8e.js +14 -0
  2. package/dist/PhArrowClockwise-401ea1c0.js +14 -0
  3. package/dist/PhArrowDown-789ae7d2.js +14 -0
  4. package/dist/PhArrowLeft-2e6d4940.js +14 -0
  5. package/dist/PhArrowRight-2928b0dc.js +14 -0
  6. package/dist/PhArrowSquareOut-17d61d08.js +14 -0
  7. package/dist/PhArrowUp-1cfcf9df.js +14 -0
  8. package/dist/PhArrowUpRight-552c41cb.js +14 -0
  9. package/dist/PhArrowsClockwise-92a70162.js +14 -0
  10. package/dist/PhArrowsDownUp-ce27c8a7.js +14 -0
  11. package/dist/PhArrowsLeftRight-ed549dc7.js +14 -0
  12. package/dist/PhBank-92a1a1df.js +14 -0
  13. package/dist/PhBrowser-495dc3ce.js +14 -0
  14. package/dist/PhCaretDown-610f20fc.js +14 -0
  15. package/dist/PhCaretLeft-2a86ee53.js +14 -0
  16. package/dist/PhCaretRight-f3057f58.js +14 -0
  17. package/dist/PhCaretUp-7b74b8cb.js +14 -0
  18. package/dist/PhCheck-c514f32c.js +14 -0
  19. package/dist/PhCircleHalf-3bfd24c9.js +14 -0
  20. package/dist/PhClock-29284ead.js +14 -0
  21. package/dist/PhCompass-101d3241.js +14 -0
  22. package/dist/PhCopy-d92dcd27.js +14 -0
  23. package/dist/PhCreditCard-d8d77fc2.js +14 -0
  24. package/dist/PhCurrencyDollar-6553df79.js +14 -0
  25. package/dist/PhDesktop-91653c8e.js +14 -0
  26. package/dist/PhDeviceMobile-0f3d8fa2.js +14 -0
  27. package/dist/PhDotsThree-67debca2.js +14 -0
  28. package/dist/PhEnvelope-f83faab2.js +14 -0
  29. package/dist/PhFunnelSimple-5058af43.js +14 -0
  30. package/dist/PhGlobe-c4653621.js +14 -0
  31. package/dist/PhIdentificationCard-848bf9a1.js +14 -0
  32. package/dist/PhImage-de71fc6b.js +14 -0
  33. package/dist/PhInfo-9614a766.js +14 -0
  34. package/dist/PhLightbulb-7d582ae7.js +14 -0
  35. package/dist/PhMagnifyingGlass-c926bd63.js +14 -0
  36. package/dist/PhPaperPlaneRight-76b25832.js +14 -0
  37. package/dist/PhPlus-767ddc55.js +14 -0
  38. package/dist/PhPower-95f188dd.js +14 -0
  39. package/dist/PhPuzzlePiece-f016afe5.js +14 -0
  40. package/dist/PhQrCode-e9b7ab93.js +14 -0
  41. package/dist/PhQuestion-ea0e639d.js +14 -0
  42. package/dist/PhQuestionMark-13d6338e.js +14 -0
  43. package/dist/PhSealCheck-45bb7b9c.js +14 -0
  44. package/dist/PhSignOut-6b91c59c.js +14 -0
  45. package/dist/PhSpinner-eb9b7ac1.js +14 -0
  46. package/dist/PhTrash-758cc3b3.js +14 -0
  47. package/dist/PhUser-0834861d.js +14 -0
  48. package/dist/PhVault-e4d6f9af.js +14 -0
  49. package/dist/PhWallet-5e257abe.js +14 -0
  50. package/dist/PhWarning-6af3740e.js +14 -0
  51. package/dist/PhWarningCircle-a78fd8e8.js +14 -0
  52. package/dist/PhX-60c46532.js +14 -0
  53. package/dist/{__tslib-2b1b6d17.js → __tslib-6d6a586c.js} +1 -1
  54. package/dist/{alchemy-provider-5870b6fa-b23243a1.js → alchemy-provider-5870b6fa-a9fe5aa5.js} +1 -1
  55. package/dist/{alchemy-websocket-provider-213da986-559da73b.js → alchemy-websocket-provider-213da986-16164c2e.js} +1 -1
  56. package/dist/basic-77fe1b96.js +1320 -0
  57. package/dist/{blocto-8e69bccf.js → blocto-ab8ba330.js} +1 -1
  58. package/dist/{ccip-99b4ad16.js → ccip-e246f9cf.js} +1 -1
  59. package/dist/cjs/PhArrowCircleDown-df23d036.cjs +14 -0
  60. package/dist/cjs/PhArrowClockwise-440d23dc.cjs +14 -0
  61. package/dist/cjs/PhArrowDown-252590ed.cjs +14 -0
  62. package/dist/cjs/PhArrowLeft-d480faa4.cjs +14 -0
  63. package/dist/cjs/PhArrowRight-969dbdd8.cjs +14 -0
  64. package/dist/cjs/PhArrowSquareOut-eabfdecb.cjs +14 -0
  65. package/dist/cjs/PhArrowUp-66bd5f15.cjs +14 -0
  66. package/dist/cjs/PhArrowUpRight-6df3b31b.cjs +14 -0
  67. package/dist/cjs/PhArrowsClockwise-3a9d2dc6.cjs +14 -0
  68. package/dist/cjs/PhArrowsDownUp-47a7788f.cjs +14 -0
  69. package/dist/cjs/PhArrowsLeftRight-f90368dd.cjs +14 -0
  70. package/dist/cjs/PhBank-670a2708.cjs +14 -0
  71. package/dist/cjs/PhBrowser-b9c35fd1.cjs +14 -0
  72. package/dist/cjs/PhCaretDown-11a46455.cjs +14 -0
  73. package/dist/cjs/PhCaretLeft-04f11ca7.cjs +14 -0
  74. package/dist/cjs/PhCaretRight-391111c1.cjs +14 -0
  75. package/dist/cjs/PhCaretUp-b17dccf6.cjs +14 -0
  76. package/dist/cjs/PhCheck-08bf36b0.cjs +14 -0
  77. package/dist/cjs/PhCircleHalf-0a9eac35.cjs +14 -0
  78. package/dist/cjs/PhClock-cf1cc2cb.cjs +14 -0
  79. package/dist/cjs/PhCompass-e9671b30.cjs +14 -0
  80. package/dist/cjs/PhCopy-9132cbc5.cjs +14 -0
  81. package/dist/cjs/PhCreditCard-853e1556.cjs +14 -0
  82. package/dist/cjs/PhCurrencyDollar-34eea829.cjs +14 -0
  83. package/dist/cjs/PhDesktop-c02b883b.cjs +14 -0
  84. package/dist/cjs/PhDeviceMobile-93c2088c.cjs +14 -0
  85. package/dist/cjs/PhDotsThree-69beaba7.cjs +14 -0
  86. package/dist/cjs/PhEnvelope-86ee730e.cjs +14 -0
  87. package/dist/cjs/PhFunnelSimple-056c2f76.cjs +14 -0
  88. package/dist/cjs/PhGlobe-64c4ee8e.cjs +14 -0
  89. package/dist/cjs/PhIdentificationCard-ec7a98e0.cjs +14 -0
  90. package/dist/cjs/PhImage-07904cbb.cjs +14 -0
  91. package/dist/cjs/PhInfo-34eeeace.cjs +14 -0
  92. package/dist/cjs/PhLightbulb-39ebe854.cjs +14 -0
  93. package/dist/cjs/PhMagnifyingGlass-2fbe4400.cjs +14 -0
  94. package/dist/cjs/PhPaperPlaneRight-e06c210f.cjs +14 -0
  95. package/dist/cjs/PhPlus-03a04ed3.cjs +14 -0
  96. package/dist/cjs/PhPower-4cc2ecb8.cjs +14 -0
  97. package/dist/cjs/PhPuzzlePiece-035d561e.cjs +14 -0
  98. package/dist/cjs/PhQrCode-37e23b36.cjs +14 -0
  99. package/dist/cjs/PhQuestion-bfba435e.cjs +14 -0
  100. package/dist/cjs/PhQuestionMark-8ef38ecf.cjs +14 -0
  101. package/dist/cjs/PhSealCheck-5458de15.cjs +14 -0
  102. package/dist/cjs/PhSignOut-2d177ea1.cjs +14 -0
  103. package/dist/cjs/PhSpinner-e7c590df.cjs +14 -0
  104. package/dist/cjs/PhTrash-1920f5dc.cjs +14 -0
  105. package/dist/cjs/PhUser-84a1a685.cjs +14 -0
  106. package/dist/cjs/PhVault-1493c03f.cjs +14 -0
  107. package/dist/cjs/PhWallet-f0502f03.cjs +14 -0
  108. package/dist/cjs/PhWarning-1bf637ba.cjs +14 -0
  109. package/dist/cjs/PhWarningCircle-b1747661.cjs +14 -0
  110. package/dist/cjs/PhX-f864d86c.cjs +14 -0
  111. package/dist/cjs/{__tslib-91c50e46.cjs → __tslib-a9f27ba6.cjs} +1 -1
  112. package/dist/cjs/{alchemy-provider-5870b6fa-a824dbf0.cjs → alchemy-provider-5870b6fa-bb1c607e.cjs} +1 -1
  113. package/dist/cjs/{alchemy-websocket-provider-213da986-f96378c8.cjs → alchemy-websocket-provider-213da986-521569b5.cjs} +1 -1
  114. package/dist/cjs/basic-b777d2b1.cjs +1320 -0
  115. package/dist/cjs/{blocto-255deb25.cjs → blocto-09e0d574.cjs} +1 -1
  116. package/dist/cjs/{ccip-58f4c3ce.cjs → ccip-6ebee1cf.cjs} +1 -1
  117. package/dist/cjs/core-78a709db.cjs +210 -0
  118. package/dist/cjs/{draggabilly-b00ba129.cjs → draggabilly-76af6217.cjs} +1 -1
  119. package/dist/cjs/features-fa5c5622.cjs +1 -0
  120. package/dist/cjs/id-c0538166.cjs +1 -0
  121. package/dist/cjs/{index-4cb4044e.cjs → index-07e81389.cjs} +1 -1
  122. package/dist/cjs/{index-28fe8dc2.cjs → index-093cef5a.cjs} +2 -2
  123. package/dist/cjs/{index-0f3e4a4a.cjs → index-208df3f3.cjs} +1 -1
  124. package/dist/cjs/{index-9cbeb66d.cjs → index-253e7cce.cjs} +1 -1
  125. package/dist/cjs/index-2e8e7a50.cjs +4 -0
  126. package/dist/cjs/index-395b933d.cjs +2 -0
  127. package/dist/cjs/{index-b0eb86b6.cjs → index-54d7fc75.cjs} +1 -1
  128. package/dist/cjs/{index-5d1879f6.cjs → index-5d28acf4.cjs} +3 -3
  129. package/dist/cjs/{index-02043814.cjs → index-5dac528b.cjs} +4 -4
  130. package/dist/cjs/index-702e8f89.cjs +15 -0
  131. package/dist/cjs/{index-7d213984.cjs → index-823e17e6.cjs} +1 -1
  132. package/dist/cjs/{index-2c339ec0.cjs → index-916994aa.cjs} +1 -1
  133. package/dist/cjs/{index-96c22872.cjs → index-a2b665f4.cjs} +1 -1
  134. package/dist/cjs/{index-110f55af.cjs → index-b099293c.cjs} +1 -1
  135. package/dist/cjs/index-d72ddbc1.cjs +17 -0
  136. package/dist/cjs/index-ef4ef0cc.cjs +1449 -0
  137. package/dist/cjs/index.cjs +1 -1
  138. package/dist/cjs/{interface-a67cd05c.cjs → interface-4947cfa6.cjs} +1 -1
  139. package/dist/cjs/lib-typedarrays-a9baf142.cjs +1 -0
  140. package/dist/cjs/native-55bb141d.cjs +1 -0
  141. package/dist/cjs/{portis-ec737dc5.cjs → portis-08d9d731.cjs} +1 -1
  142. package/dist/cjs/property-29e6f732.cjs +29 -0
  143. package/dist/cjs/providers/connector/safeGnosis/query.d.ts +2 -1
  144. package/dist/cjs/providers/connector/types.d.ts +1 -1
  145. package/dist/cjs/providers/wallets/index.d.ts +1 -0
  146. package/dist/cjs/rainbow-6e84bcfa.cjs +1 -0
  147. package/dist/cjs/sha224-b46bc3e6.cjs +1 -0
  148. package/dist/cjs/sha256-ccd47519.cjs +1 -0
  149. package/dist/cjs/{typed-data-65a82f1e.cjs → typed-data-5176b792.cjs} +1 -1
  150. package/dist/cjs/uAuth-b29d2670.cjs +1 -0
  151. package/dist/cjs/w3m-modal-70bcf6d8.cjs +2380 -0
  152. package/dist/cjs/walletConnect-20d477a9.cjs +1 -0
  153. package/dist/cjs/{walletLink-095edc5f.cjs → walletLink-08b8da20.cjs} +2 -2
  154. package/dist/core-4d7ad6f2.js +210 -0
  155. package/dist/{draggabilly-919fe798.js → draggabilly-daf3b444.js} +1 -1
  156. package/dist/features-d8d1c9ce.js +1 -0
  157. package/dist/id-d4d22b29.js +1 -0
  158. package/dist/{index-de7476e4.js → index-09298bd0.js} +7 -7
  159. package/dist/{index-085a063c.js → index-244a8189.js} +1 -1
  160. package/dist/{index-23ae718c.js → index-2ad0fb2a.js} +1 -1
  161. package/dist/index-35d87b79.js +17 -0
  162. package/dist/{index-bbaf7a43.js → index-587ff998.js} +1 -1
  163. package/dist/{index-601a6250.js → index-750a7dfe.js} +1 -1
  164. package/dist/{index-cc764016.js → index-8bd12de1.js} +1 -1
  165. package/dist/{index-6382b40b.js → index-938686fb.js} +1 -1
  166. package/dist/{index-3cf73206.js → index-9d7fee1e.js} +2 -2
  167. package/dist/{index-fd3058aa.js → index-aa744ca0.js} +1 -1
  168. package/dist/{index-7fabb817.js → index-b7d25e8a.js} +3 -3
  169. package/dist/index-bb1a0019.js +15 -0
  170. package/dist/index-c5ca8a4e.js +4 -0
  171. package/dist/{index-f5d95949.js → index-cddbc8e8.js} +1 -1
  172. package/dist/index-f095c09e.js +2 -0
  173. package/dist/index-ffdf981b.js +1449 -0
  174. package/dist/index.js +1 -1
  175. package/dist/{interface-82bdcddb.js → interface-0c535796.js} +1 -1
  176. package/dist/lib-typedarrays-979d2723.js +1 -0
  177. package/dist/native-029c50f7.js +1 -0
  178. package/dist/{portis-0a2bd95e.js → portis-9602ac9f.js} +1 -1
  179. package/dist/property-8eb37909.js +35 -0
  180. package/dist/providers/connector/safeGnosis/query.d.ts +2 -1
  181. package/dist/providers/connector/types.d.ts +1 -1
  182. package/dist/providers/wallets/index.d.ts +1 -0
  183. package/dist/rainbow-ccab7a95.js +1 -0
  184. package/dist/sha224-fe98e1bf.js +1 -0
  185. package/dist/sha256-5a24dfd5.js +1 -0
  186. package/dist/{typed-data-83d7ae9a.js → typed-data-3a3d44dc.js} +1 -1
  187. package/dist/uAuth-27f5728d.js +1 -0
  188. package/dist/w3m-modal-49add722.js +2380 -0
  189. package/dist/walletConnect-a541881e.js +1 -0
  190. package/dist/{walletLink-1b3cb067.js → walletLink-67264328.js} +2 -2
  191. package/package.json +5 -5
  192. package/dist/_commonjs-dynamic-modules-7cfc9805.js +0 -1
  193. package/dist/cjs/_commonjs-dynamic-modules-f09a98c7.cjs +0 -1
  194. package/dist/cjs/id-0c26cee0.cjs +0 -1
  195. package/dist/cjs/index-21f86827.cjs +0 -17
  196. package/dist/cjs/index-35edc6a0.cjs +0 -60
  197. package/dist/cjs/index-568647cf.cjs +0 -15
  198. package/dist/cjs/index-9f2a69d5.cjs +0 -1
  199. package/dist/cjs/index.es-2a36620f.cjs +0 -9
  200. package/dist/cjs/lib-typedarrays-f921c603.cjs +0 -1
  201. package/dist/cjs/rainbow-322fb6a9.cjs +0 -1
  202. package/dist/cjs/sha224-f0657d8a.cjs +0 -1
  203. package/dist/cjs/sha256-a0c6063a.cjs +0 -1
  204. package/dist/cjs/uAuth-d389b45d.cjs +0 -1
  205. package/dist/cjs/walletConnect-3c32ceb8.cjs +0 -1
  206. package/dist/id-bc1ef47c.js +0 -1
  207. package/dist/index-24d19ee3.js +0 -15
  208. package/dist/index-65d96278.js +0 -60
  209. package/dist/index-e4c02dc7.js +0 -17
  210. package/dist/index-f08d6a6b.js +0 -1
  211. package/dist/index.es-474ba2f2.js +0 -9
  212. package/dist/lib-typedarrays-becaa8ad.js +0 -1
  213. package/dist/rainbow-aa24fa3b.js +0 -1
  214. package/dist/sha224-e9d5a920.js +0 -1
  215. package/dist/sha256-65d6895c.js +0 -1
  216. package/dist/uAuth-8aef513a.js +0 -1
  217. package/dist/walletConnect-f12ca9e1.js +0 -1
@@ -0,0 +1,2380 @@
1
+ import{N as e,B as t,D as i,o,F as a,G as n,j as r,a as s,I as c,C as l,c as d,S as u,R as p,J as h,K as m,L as w,P as g,b as y,E as f,Q as b,U as v,M as k,V as x,e as T,r as A,i as S,d as I,k as E,w as P,X as C,Y as $,Z as N,_ as R,H as O,O as _,$ as U,h as D,y as L,u as B,f as z,A as W,T as j,a0 as F,a1 as q}from"./core-4d7ad6f2.js";import{c as M,n as V,o as G,r as H,a as Y,U as K,b as Q}from"./index-ffdf981b.js";import"events";import"./index-c5ca8a4e.js";import"./__tslib-6d6a586c.js";import"./index-09298bd0.js";import"@ethersproject/providers";import"zustand";import"@ethersproject/bytes";import"@ethersproject/properties";import"@ethersproject/address";import"@ethersproject/abstract-signer";import"buffer";import"@ethersproject/abstract-provider";import"@ethersproject/contracts";import"@ethersproject/constants";import"@ethersproject/transactions";const X={getGasPriceInEther:(e,t)=>Number(t*e)/1e18,getGasPriceInUSD(t,i,o){const a=X.getGasPriceInEther(i,o);return e.bigNumber(t).times(a).toNumber()},getPriceImpact({sourceTokenAmount:t,sourceTokenPriceInUSD:i,toTokenPriceInUSD:o,toTokenAmount:a}){const n=e.bigNumber(t).times(i),r=e.bigNumber(a).times(o);return n.minus(r).div(n).times(100).toNumber()},getMaxSlippage(t,i){const o=e.bigNumber(t).div(100);return e.multiply(i,o).toNumber()},getProviderFee:(t,i=.0085)=>e.bigNumber(t).times(i).toString(),isInsufficientNetworkTokenForGas(t,i){const o=i||"0";return!!e.bigNumber(t).eq(0)||e.bigNumber(e.bigNumber(o)).gt(t)},isInsufficientSourceTokenForSwap(t,i,o){const a=o?.find((e=>e.address===i))?.quantity?.numeric;return e.bigNumber(a||"0").lt(t)}},Z=15e4,J={initializing:!1,initialized:!1,loadingPrices:!1,loadingQuote:!1,loadingApprovalTransaction:!1,loadingBuildTransaction:!1,loadingTransaction:!1,switchingTokens:!1,fetchError:!1,approvalTransaction:void 0,swapTransaction:void 0,transactionError:void 0,sourceToken:void 0,sourceTokenAmount:"",sourceTokenPriceInUSD:0,toToken:void 0,toTokenAmount:"",toTokenPriceInUSD:0,networkPrice:"0",networkBalanceInUSD:"0",networkTokenSymbol:"",inputError:void 0,slippage:o.CONVERT_SLIPPAGE_TOLERANCE,tokens:void 0,popularTokens:void 0,suggestedTokens:void 0,foundTokens:void 0,myTokensWithBalance:void 0,tokensPriceMap:{},gasFee:"0",gasPriceInUSD:0,priceImpact:void 0,maxSlippage:void 0,providerFee:void 0},ee=t({...J}),te={state:ee,subscribe:e=>a(ee,(()=>e(ee))),subscribeKey:(e,t)=>n(ee,e,t),getParams(){const t=r.state.activeChain,i=r.getAccountData(t)?.caipAddress??r.state.activeCaipAddress,o=s.getPlainAddress(i),a=c(),n=l.getConnectorId(r.state.activeChain);if(!o)throw new Error("No address found to swap the tokens from.");const u=!ee.toToken?.address||!ee.toToken?.decimals,p=!ee.sourceToken?.address||!ee.sourceToken?.decimals||!e.bigNumber(ee.sourceTokenAmount).gt(0),h=!ee.sourceTokenAmount;return{networkAddress:a,fromAddress:o,fromCaipAddress:i,sourceTokenAddress:ee.sourceToken?.address,toTokenAddress:ee.toToken?.address,toTokenAmount:ee.toTokenAmount,toTokenDecimals:ee.toToken?.decimals,sourceTokenAmount:ee.sourceTokenAmount,sourceTokenDecimals:ee.sourceToken?.decimals,invalidToToken:u,invalidSourceToken:p,invalidSourceTokenAmount:h,availableToSwap:i&&!u&&!p&&!h,isAuthConnector:n===d.CONNECTOR_ID.AUTH}},async setSourceToken(e){if(!e)return ee.sourceToken=e,ee.sourceTokenAmount="",void(ee.sourceTokenPriceInUSD=0);ee.sourceToken=e,await ie.setTokenPrice(e.address,"sourceToken")},setSourceTokenAmount(e){ee.sourceTokenAmount=e},async setToToken(e){if(!e)return ee.toToken=e,ee.toTokenAmount="",void(ee.toTokenPriceInUSD=0);ee.toToken=e,await ie.setTokenPrice(e.address,"toToken")},setToTokenAmount(t){ee.toTokenAmount=t?e.toFixed(t,6):""},async setTokenPrice(e,t){let i=ee.tokensPriceMap[e]||0;i||(ee.loadingPrices=!0,i=await ie.getAddressPrice(e)),"sourceToken"===t?ee.sourceTokenPriceInUSD=i:"toToken"===t&&(ee.toTokenPriceInUSD=i),ee.loadingPrices&&(ee.loadingPrices=!1),ie.getParams().availableToSwap&&!ee.switchingTokens&&ie.swapTokens()},async switchTokens(){if(!ee.initializing&&ee.initialized&&!ee.switchingTokens){ee.switchingTokens=!0;try{const e=ee.toToken?{...ee.toToken}:void 0,t=ee.sourceToken?{...ee.sourceToken}:void 0,i=e&&""===ee.toTokenAmount?"1":ee.toTokenAmount;ie.setSourceTokenAmount(i),ie.setToTokenAmount(""),await ie.setSourceToken(e),await ie.setToToken(t),ee.switchingTokens=!1,ie.swapTokens()}catch(e){throw ee.switchingTokens=!1,e}}},resetState(){ee.myTokensWithBalance=J.myTokensWithBalance,ee.tokensPriceMap=J.tokensPriceMap,ee.initialized=J.initialized,ee.initializing=J.initializing,ee.switchingTokens=J.switchingTokens,ee.sourceToken=J.sourceToken,ee.sourceTokenAmount=J.sourceTokenAmount,ee.sourceTokenPriceInUSD=J.sourceTokenPriceInUSD,ee.toToken=J.toToken,ee.toTokenAmount=J.toTokenAmount,ee.toTokenPriceInUSD=J.toTokenPriceInUSD,ee.networkPrice=J.networkPrice,ee.networkTokenSymbol=J.networkTokenSymbol,ee.networkBalanceInUSD=J.networkBalanceInUSD,ee.inputError=J.inputError},resetValues(){const{networkAddress:e}=ie.getParams(),t=ee.tokens?.find((t=>t.address===e));ie.setSourceToken(t),ie.setToToken(void 0)},getApprovalLoadingState:()=>ee.loadingApprovalTransaction,clearError(){ee.transactionError=void 0},async initializeState(){if(!ee.initializing){if(ee.initializing=!0,!ee.initialized)try{await ie.fetchTokens(),ee.initialized=!0}catch(e){ee.initialized=!1,u.showError("Failed to initialize swap"),p.goBack()}ee.initializing=!1}},async fetchTokens(){const{networkAddress:e}=ie.getParams();await ie.getNetworkTokenPrice(),await ie.getMyTokensWithBalance();const t=ee.myTokensWithBalance?.find((t=>t.address===e));t&&(ee.networkTokenSymbol=t.symbol,ie.setSourceToken(t),ie.setSourceTokenAmount("0"))},async getTokenList(){const e=r.state.activeCaipNetwork?.caipNetworkId;if(ee.caipNetworkId!==e||!ee.tokens)try{ee.tokensLoading=!0;const t=await h.getTokenList(e);ee.tokens=t,ee.caipNetworkId=e,ee.popularTokens=t.sort(((e,t)=>e.symbol<t.symbol?-1:e.symbol>t.symbol?1:0));const i=(e&&o.SUGGESTED_TOKENS_BY_CHAIN?.[e]||[]).map((e=>t.find((t=>t.symbol===e)))).filter((e=>Boolean(e))),a=(o.SWAP_SUGGESTED_TOKENS||[]).map((e=>t.find((t=>t.symbol===e)))).filter((e=>Boolean(e))).filter((e=>!i.some((t=>t.address===e.address))));ee.suggestedTokens=[...i,...a]}catch(e){ee.tokens=[],ee.popularTokens=[],ee.suggestedTokens=[]}finally{ee.tokensLoading=!1}},async getAddressPrice(e){const t=ee.tokensPriceMap[e];if(t)return t;const i=await m.fetchTokenPrice({addresses:[e]}),o=i?.fungibles||[],a=[...ee.tokens||[],...ee.myTokensWithBalance||[]],n=a?.find((t=>t.address===e))?.symbol,r=o.find((e=>e.symbol.toLowerCase()===n?.toLowerCase()))?.price||0,s=parseFloat(r.toString());return ee.tokensPriceMap[e]=s,s},async getNetworkTokenPrice(){const{networkAddress:e}=ie.getParams(),t=await m.fetchTokenPrice({addresses:[e]}).catch((()=>(u.showError("Failed to fetch network token price"),{fungibles:[]}))),i=t.fungibles?.[0],o=i?.price.toString()||"0";ee.tokensPriceMap[e]=parseFloat(o),ee.networkTokenSymbol=i?.symbol||"",ee.networkPrice=o},async getMyTokensWithBalance(e){const t=await w.getMyTokensWithBalance({forceUpdate:e,caipNetwork:r.state.activeCaipNetwork,address:r.getAccountData()?.address}),i=h.mapBalancesToSwapTokens(t);i&&(await ie.getInitialGasPrice(),ie.setBalances(i))},setBalances(t){const{networkAddress:i}=ie.getParams(),o=r.state.activeCaipNetwork;if(!o)return;const a=t.find((e=>e.address===i));t.forEach((e=>{ee.tokensPriceMap[e.address]=e.price||0})),ee.myTokensWithBalance=t.filter((e=>e.address.startsWith(o.caipNetworkId))),ee.networkBalanceInUSD=a?e.multiply(a.quantity.numeric,a.price).toString():"0"},async getInitialGasPrice(){const t=await h.fetchGasPrice();if(!t)return{gasPrice:null,gasPriceInUSD:null};switch(r.state?.activeCaipNetwork?.chainNamespace){case d.CHAIN.SOLANA:return ee.gasFee=t.standard??"0",ee.gasPriceInUSD=e.multiply(t.standard,ee.networkPrice).div(1e9).toNumber(),{gasPrice:BigInt(ee.gasFee),gasPriceInUSD:Number(ee.gasPriceInUSD)};case d.CHAIN.EVM:default:const i=t.standard??"0",o=BigInt(i),a=BigInt(Z),n=X.getGasPriceInUSD(ee.networkPrice,a,o);return ee.gasFee=i,ee.gasPriceInUSD=n,{gasPrice:o,gasPriceInUSD:n}}},async swapTokens(){const t=r.getAccountData()?.address,i=ee.sourceToken,o=ee.toToken,a=e.bigNumber(ee.sourceTokenAmount).gt(0);if(a||ie.setToTokenAmount(""),!o||!i||ee.loadingPrices||!a||!t)return;ee.loadingQuote=!0;const n=e.bigNumber(ee.sourceTokenAmount).times(10**i.decimals).round(0).toFixed(0);try{const a=await m.fetchSwapQuote({userAddress:t,from:i.address,to:o.address,gasPrice:ee.gasFee,amount:n.toString()});ee.loadingQuote=!1;const r=a?.quotes?.[0]?.toAmount;if(!r)return void g.open({displayMessage:"Incorrect amount",debugMessage:"Please enter a valid amount"},"error");const s=e.bigNumber(r).div(10**o.decimals).toString();ie.setToTokenAmount(s);ie.hasInsufficientToken(ee.sourceTokenAmount,i.address)?ee.inputError="Insufficient balance":(ee.inputError=void 0,ie.setTransactionDetails())}catch(e){const t=await h.handleSwapError(e);ee.loadingQuote=!1,ee.inputError=t||"Insufficient balance"}},async getTransaction(){const{fromCaipAddress:e,availableToSwap:t}=ie.getParams(),i=ee.sourceToken,o=ee.toToken;if(e&&t&&i&&o&&!ee.loadingQuote)try{ee.loadingBuildTransaction=!0;let t;return t=await h.fetchSwapAllowance({userAddress:e,tokenAddress:i.address,sourceTokenAmount:ee.sourceTokenAmount,sourceTokenDecimals:i.decimals})?await ie.createSwapTransaction():await ie.createAllowanceTransaction(),ee.loadingBuildTransaction=!1,ee.fetchError=!1,t}catch(e){return p.goBack(),u.showError("Failed to check allowance"),ee.loadingBuildTransaction=!1,ee.approvalTransaction=void 0,ee.swapTransaction=void 0,void(ee.fetchError=!0)}},async createAllowanceTransaction(){const{fromCaipAddress:e,sourceTokenAddress:t,toTokenAddress:i}=ie.getParams();if(e&&i){if(!t)throw new Error("createAllowanceTransaction - No source token address found.");try{const o=await m.generateApproveCalldata({from:t,to:i,userAddress:e}),a=s.getPlainAddress(o.tx.from);if(!a)throw new Error("SwapController:createAllowanceTransaction - address is required");const n={data:o.tx.data,to:a,gasPrice:BigInt(o.tx.eip155.gasPrice),value:BigInt(o.tx.value),toAmount:ee.toTokenAmount};return ee.swapTransaction=void 0,ee.approvalTransaction={data:n.data,to:n.to,gasPrice:n.gasPrice,value:n.value,toAmount:n.toAmount},{data:n.data,to:n.to,gasPrice:n.gasPrice,value:n.value,toAmount:n.toAmount}}catch(e){return p.goBack(),u.showError("Failed to create approval transaction"),ee.approvalTransaction=void 0,ee.swapTransaction=void 0,void(ee.fetchError=!0)}}},async createSwapTransaction(){const{networkAddress:e,fromCaipAddress:t,sourceTokenAmount:i}=ie.getParams(),o=ee.sourceToken,a=ee.toToken;if(!(t&&i&&o&&a))return;const n=y.parseUnits(i,o.decimals)?.toString();try{const i=await m.generateSwapCalldata({userAddress:t,from:o.address,to:a.address,amount:n,disableEstimate:!0}),r=o.address===e,c=BigInt(i.tx.eip155.gas),l=BigInt(i.tx.eip155.gasPrice),d=s.getPlainAddress(i.tx.to);if(!d)throw new Error("SwapController:createSwapTransaction - address is required");const u={data:i.tx.data,to:d,gas:c,gasPrice:l,value:r?BigInt(n??"0"):BigInt("0"),toAmount:ee.toTokenAmount};return ee.gasPriceInUSD=X.getGasPriceInUSD(ee.networkPrice,c,l),ee.approvalTransaction=void 0,ee.swapTransaction=u,u}catch(e){return p.goBack(),u.showError("Failed to create transaction"),ee.approvalTransaction=void 0,ee.swapTransaction=void 0,void(ee.fetchError=!0)}},onEmbeddedWalletApprovalSuccess(){u.showLoading("Approve limit increase in your wallet"),p.replace("SwapPreview")},async sendTransactionForApproval(e){const{fromAddress:t,isAuthConnector:i}=ie.getParams();ee.loadingApprovalTransaction=!0;i?p.pushTransactionStack({onSuccess:ie.onEmbeddedWalletApprovalSuccess}):u.showLoading("Approve limit increase in your wallet");try{await y.sendTransaction({address:t,to:e.to,data:e.data,value:e.value,chainNamespace:d.CHAIN.EVM}),await ie.swapTokens(),await ie.getTransaction(),ee.approvalTransaction=void 0,ee.loadingApprovalTransaction=!1}catch(e){const t=e;ee.transactionError=t?.displayMessage,ee.loadingApprovalTransaction=!1,u.showError(t?.displayMessage||"Transaction error"),f.sendEvent({type:"track",event:"SWAP_APPROVAL_ERROR",properties:{message:t?.displayMessage||t?.message||"Unknown",network:r.state.activeCaipNetwork?.caipNetworkId||"",swapFromToken:ie.state.sourceToken?.symbol||"",swapToToken:ie.state.toToken?.symbol||"",swapFromAmount:ie.state.sourceTokenAmount||"",swapToAmount:ie.state.toTokenAmount||"",isSmartAccount:b(d.CHAIN.EVM)===v.ACCOUNT_TYPES.SMART_ACCOUNT}})}},async sendTransactionForSwap(t){if(!t)return;const{fromAddress:i,toTokenAmount:o,isAuthConnector:a}=ie.getParams();ee.loadingTransaction=!0;const n=`Swapping ${ee.sourceToken?.symbol} to ${e.formatNumberToLocalString(o,3)} ${ee.toToken?.symbol}`,s=`Swapped ${ee.sourceToken?.symbol} to ${e.formatNumberToLocalString(o,3)} ${ee.toToken?.symbol}`;a?p.pushTransactionStack({onSuccess(){p.replace("Account"),u.showLoading(n),te.resetState()}}):u.showLoading("Confirm transaction in your wallet");try{const e=[ee.sourceToken?.address,ee.toToken?.address].join(","),o=await y.sendTransaction({address:i,to:t.to,data:t.data,value:t.value,chainNamespace:d.CHAIN.EVM});return ee.loadingTransaction=!1,u.showSuccess(s),f.sendEvent({type:"track",event:"SWAP_SUCCESS",properties:{network:r.state.activeCaipNetwork?.caipNetworkId||"",swapFromToken:ie.state.sourceToken?.symbol||"",swapToToken:ie.state.toToken?.symbol||"",swapFromAmount:ie.state.sourceTokenAmount||"",swapToAmount:ie.state.toTokenAmount||"",isSmartAccount:b(d.CHAIN.EVM)===v.ACCOUNT_TYPES.SMART_ACCOUNT}}),te.resetState(),a||p.replace("Account"),te.getMyTokensWithBalance(e),o}catch(e){const t=e;return ee.transactionError=t?.displayMessage,ee.loadingTransaction=!1,u.showError(t?.displayMessage||"Transaction error"),void f.sendEvent({type:"track",event:"SWAP_ERROR",properties:{message:t?.displayMessage||t?.message||"Unknown",network:r.state.activeCaipNetwork?.caipNetworkId||"",swapFromToken:ie.state.sourceToken?.symbol||"",swapToToken:ie.state.toToken?.symbol||"",swapFromAmount:ie.state.sourceTokenAmount||"",swapToAmount:ie.state.toTokenAmount||"",isSmartAccount:b(d.CHAIN.EVM)===v.ACCOUNT_TYPES.SMART_ACCOUNT}})}},hasInsufficientToken:(e,t)=>X.isInsufficientSourceTokenForSwap(e,t,ee.myTokensWithBalance),setTransactionDetails(){const{toTokenAddress:e,toTokenDecimals:t}=ie.getParams();e&&t&&(ee.gasPriceInUSD=X.getGasPriceInUSD(ee.networkPrice,BigInt(ee.gasFee),BigInt(Z)),ee.priceImpact=X.getPriceImpact({sourceTokenAmount:ee.sourceTokenAmount,sourceTokenPriceInUSD:ee.sourceTokenPriceInUSD,toTokenPriceInUSD:ee.toTokenPriceInUSD,toTokenAmount:ee.toTokenAmount}),ee.maxSlippage=X.getMaxSlippage(ee.slippage,ee.toTokenAmount),ee.providerFee=X.getProviderFee(ee.sourceTokenAmount))}},ie=i(te),oe=t({message:"",open:!1,triggerRect:{width:0,height:0,top:0,left:0},variant:"shade"}),ae=i({state:oe,subscribe:e=>a(oe,(()=>e(oe))),subscribeKey:(e,t)=>n(oe,e,t),showTooltip({message:e,triggerRect:t,variant:i}){oe.open=!0,oe.message=e,oe.triggerRect=t,oe.variant=i},hide(){oe.open=!1,oe.message="",oe.triggerRect={width:0,height:0,top:0,left:0}}}),ne={isUnsupportedChainView:()=>"UnsupportedChain"===p.state.view||"SwitchNetwork"===p.state.view&&p.state.history.includes("UnsupportedChain"),async safeClose(){if(this.isUnsupportedChainView())return void k.shake();await x.isSIWXCloseDisabled()?k.shake():("DataCapture"!==p.state.view&&"DataCaptureOtpConfirm"!==p.state.view||y.disconnect(),k.close())}},re={interpolate(e,t,i){if(2!==e.length||2!==t.length)throw new Error("inputRange and outputRange must be an array of length 2");const o=e[0]||0,a=e[1]||0,n=t[0]||0,r=t[1]||0;return i<o?n:i>a?r:(r-n)/(a-o)*(i-o)+n}};var se=T`
2
+ :host {
3
+ display: block;
4
+ border-radius: clamp(0px, ${({borderRadius:e})=>e[8]}, 44px);
5
+ box-shadow: 0 0 0 1px ${({tokens:e})=>e.theme.foregroundPrimary};
6
+ overflow: hidden;
7
+ }
8
+ `,ce=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let le=class extends S{render(){return I`<slot></slot>`}};le.styles=[A,se],le=ce([M("wui-card")],le);var de=T`
9
+ :host {
10
+ width: 100%;
11
+ }
12
+
13
+ :host > wui-flex {
14
+ width: 100%;
15
+ display: flex;
16
+ align-items: center;
17
+ justify-content: center;
18
+ gap: ${({spacing:e})=>e[2]};
19
+ padding: ${({spacing:e})=>e[3]};
20
+ border-radius: ${({borderRadius:e})=>e[6]};
21
+ border: 1px solid ${({tokens:e})=>e.theme.borderPrimary};
22
+ box-sizing: border-box;
23
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
24
+ box-shadow: 0px 0px 16px 0px rgba(0, 0, 0, 0.25);
25
+ color: ${({tokens:e})=>e.theme.textPrimary};
26
+ }
27
+
28
+ :host > wui-flex[data-type='info'] {
29
+ .icon-box {
30
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
31
+
32
+ wui-icon {
33
+ color: ${({tokens:e})=>e.theme.iconDefault};
34
+ }
35
+ }
36
+ }
37
+ :host > wui-flex[data-type='success'] {
38
+ .icon-box {
39
+ background-color: ${({tokens:e})=>e.core.backgroundSuccess};
40
+
41
+ wui-icon {
42
+ color: ${({tokens:e})=>e.core.borderSuccess};
43
+ }
44
+ }
45
+ }
46
+ :host > wui-flex[data-type='warning'] {
47
+ .icon-box {
48
+ background-color: ${({tokens:e})=>e.core.backgroundWarning};
49
+
50
+ wui-icon {
51
+ color: ${({tokens:e})=>e.core.borderWarning};
52
+ }
53
+ }
54
+ }
55
+ :host > wui-flex[data-type='error'] {
56
+ .icon-box {
57
+ background-color: ${({tokens:e})=>e.core.backgroundError};
58
+
59
+ wui-icon {
60
+ color: ${({tokens:e})=>e.core.borderError};
61
+ }
62
+ }
63
+ }
64
+
65
+ wui-flex {
66
+ width: 100%;
67
+ }
68
+
69
+ wui-text {
70
+ word-break: break-word;
71
+ flex: 1;
72
+ }
73
+
74
+ .close {
75
+ cursor: pointer;
76
+ color: ${({tokens:e})=>e.theme.iconDefault};
77
+ }
78
+
79
+ .icon-box {
80
+ height: 40px;
81
+ width: 40px;
82
+ border-radius: ${({borderRadius:e})=>e[2]};
83
+ background-color: var(--local-icon-bg-value);
84
+ }
85
+ `,ue=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const pe={info:"info",success:"checkmark",warning:"warningCircle",error:"warning"};let he=class extends S{constructor(){super(...arguments),this.message="",this.type="info"}render(){return I`
86
+ <wui-flex
87
+ data-type=${G(this.type)}
88
+ flexDirection="row"
89
+ justifyContent="space-between"
90
+ alignItems="center"
91
+ gap="2"
92
+ >
93
+ <wui-flex columnGap="2" flexDirection="row" alignItems="center">
94
+ <wui-flex
95
+ flexDirection="row"
96
+ alignItems="center"
97
+ justifyContent="center"
98
+ class="icon-box"
99
+ >
100
+ <wui-icon color="inherit" size="md" name=${pe[this.type]}></wui-icon>
101
+ </wui-flex>
102
+ <wui-text variant="md-medium" color="inherit" data-testid="wui-alertbar-text"
103
+ >${this.message}</wui-text
104
+ >
105
+ </wui-flex>
106
+ <wui-icon
107
+ class="close"
108
+ color="inherit"
109
+ size="sm"
110
+ name="close"
111
+ @click=${this.onClose}
112
+ ></wui-icon>
113
+ </wui-flex>
114
+ `}onClose(){g.close()}};he.styles=[A,de],ue([V()],he.prototype,"message",void 0),ue([V()],he.prototype,"type",void 0),he=ue([M("wui-alertbar")],he);var me=T`
115
+ :host {
116
+ display: block;
117
+ position: absolute;
118
+ top: ${({spacing:e})=>e[3]};
119
+ left: ${({spacing:e})=>e[4]};
120
+ right: ${({spacing:e})=>e[4]};
121
+ opacity: 0;
122
+ pointer-events: none;
123
+ }
124
+ `,we=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const ge={info:{backgroundColor:"fg-350",iconColor:"fg-325",icon:"info"},success:{backgroundColor:"success-glass-reown-020",iconColor:"success-125",icon:"checkmark"},warning:{backgroundColor:"warning-glass-reown-020",iconColor:"warning-100",icon:"warningCircle"},error:{backgroundColor:"error-glass-reown-020",iconColor:"error-125",icon:"warning"}};let ye=class extends S{constructor(){super(),this.unsubscribe=[],this.open=g.state.open,this.onOpen(!0),this.unsubscribe.push(g.subscribeKey("open",(e=>{this.open=e,this.onOpen(!1)})))}disconnectedCallback(){this.unsubscribe.forEach((e=>e()))}render(){const{message:e,variant:t}=g.state,i=ge[t];return I`
125
+ <wui-alertbar
126
+ message=${e}
127
+ backgroundColor=${i?.backgroundColor}
128
+ iconColor=${i?.iconColor}
129
+ icon=${i?.icon}
130
+ type=${t}
131
+ ></wui-alertbar>
132
+ `}onOpen(e){this.open?(this.animate([{opacity:0,transform:"scale(0.85)"},{opacity:1,transform:"scale(1)"}],{duration:150,fill:"forwards",easing:"ease"}),this.style.cssText="pointer-events: auto"):e||(this.animate([{opacity:1,transform:"scale(1)"},{opacity:0,transform:"scale(0.85)"}],{duration:150,fill:"forwards",easing:"ease"}),this.style.cssText="pointer-events: none")}};ye.styles=me,we([H()],ye.prototype,"open",void 0),ye=we([M("w3m-alertbar")],ye);var fe=T`
133
+ :host {
134
+ position: relative;
135
+ }
136
+
137
+ button {
138
+ display: flex;
139
+ justify-content: center;
140
+ align-items: center;
141
+ background-color: transparent;
142
+ padding: ${({spacing:e})=>e[1]};
143
+ }
144
+
145
+ /* -- Colors --------------------------------------------------- */
146
+ button[data-type='accent'] wui-icon {
147
+ color: ${({tokens:e})=>e.core.iconAccentPrimary};
148
+ }
149
+
150
+ button[data-type='neutral'][data-variant='primary'] wui-icon {
151
+ color: ${({tokens:e})=>e.theme.iconInverse};
152
+ }
153
+
154
+ button[data-type='neutral'][data-variant='secondary'] wui-icon {
155
+ color: ${({tokens:e})=>e.theme.iconDefault};
156
+ }
157
+
158
+ button[data-type='success'] wui-icon {
159
+ color: ${({tokens:e})=>e.core.iconSuccess};
160
+ }
161
+
162
+ button[data-type='error'] wui-icon {
163
+ color: ${({tokens:e})=>e.core.iconError};
164
+ }
165
+
166
+ /* -- Sizes --------------------------------------------------- */
167
+ button[data-size='xs'] {
168
+ width: 16px;
169
+ height: 16px;
170
+
171
+ border-radius: ${({borderRadius:e})=>e[1]};
172
+ }
173
+
174
+ button[data-size='sm'] {
175
+ width: 20px;
176
+ height: 20px;
177
+ border-radius: ${({borderRadius:e})=>e[1]};
178
+ }
179
+
180
+ button[data-size='md'] {
181
+ width: 24px;
182
+ height: 24px;
183
+ border-radius: ${({borderRadius:e})=>e[2]};
184
+ }
185
+
186
+ button[data-size='lg'] {
187
+ width: 28px;
188
+ height: 28px;
189
+ border-radius: ${({borderRadius:e})=>e[2]};
190
+ }
191
+
192
+ button[data-size='xs'] wui-icon {
193
+ width: 8px;
194
+ height: 8px;
195
+ }
196
+
197
+ button[data-size='sm'] wui-icon {
198
+ width: 12px;
199
+ height: 12px;
200
+ }
201
+
202
+ button[data-size='md'] wui-icon {
203
+ width: 16px;
204
+ height: 16px;
205
+ }
206
+
207
+ button[data-size='lg'] wui-icon {
208
+ width: 20px;
209
+ height: 20px;
210
+ }
211
+
212
+ /* -- Hover --------------------------------------------------- */
213
+ @media (hover: hover) {
214
+ button[data-type='accent']:hover:enabled {
215
+ background-color: ${({tokens:e})=>e.core.foregroundAccent010};
216
+ }
217
+
218
+ button[data-variant='primary'][data-type='neutral']:hover:enabled {
219
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
220
+ }
221
+
222
+ button[data-variant='secondary'][data-type='neutral']:hover:enabled {
223
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
224
+ }
225
+
226
+ button[data-type='success']:hover:enabled {
227
+ background-color: ${({tokens:e})=>e.core.backgroundSuccess};
228
+ }
229
+
230
+ button[data-type='error']:hover:enabled {
231
+ background-color: ${({tokens:e})=>e.core.backgroundError};
232
+ }
233
+ }
234
+
235
+ /* -- Focus --------------------------------------------------- */
236
+ button:focus-visible {
237
+ box-shadow: 0 0 0 4px ${({tokens:e})=>e.core.foregroundAccent020};
238
+ }
239
+
240
+ /* -- Properties --------------------------------------------------- */
241
+ button[data-full-width='true'] {
242
+ width: 100%;
243
+ }
244
+
245
+ :host([fullWidth]) {
246
+ width: 100%;
247
+ }
248
+
249
+ button[disabled] {
250
+ opacity: 0.5;
251
+ cursor: not-allowed;
252
+ }
253
+ `,be=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let ve=class extends S{constructor(){super(...arguments),this.icon="card",this.variant="primary",this.type="accent",this.size="md",this.iconSize=void 0,this.fullWidth=!1,this.disabled=!1}render(){return I`<button
254
+ data-variant=${this.variant}
255
+ data-type=${this.type}
256
+ data-size=${this.size}
257
+ data-full-width=${this.fullWidth}
258
+ ?disabled=${this.disabled}
259
+ >
260
+ <wui-icon color="inherit" name=${this.icon} size=${G(this.iconSize)}></wui-icon>
261
+ </button>`}};ve.styles=[A,E,fe],be([V()],ve.prototype,"icon",void 0),be([V()],ve.prototype,"variant",void 0),be([V()],ve.prototype,"type",void 0),be([V()],ve.prototype,"size",void 0),be([V()],ve.prototype,"iconSize",void 0),be([V({type:Boolean})],ve.prototype,"fullWidth",void 0),be([V({type:Boolean})],ve.prototype,"disabled",void 0),ve=be([M("wui-icon-button")],ve);var ke=T`
262
+ button {
263
+ display: block;
264
+ display: flex;
265
+ align-items: center;
266
+ padding: ${({spacing:e})=>e[1]};
267
+ transition: background-color ${({durations:e})=>e.lg}
268
+ ${({easings:e})=>e["ease-out-power-2"]};
269
+ will-change: background-color;
270
+ border-radius: ${({borderRadius:e})=>e[32]};
271
+ }
272
+
273
+ wui-image {
274
+ border-radius: 100%;
275
+ }
276
+
277
+ wui-text {
278
+ padding-left: ${({spacing:e})=>e[1]};
279
+ }
280
+
281
+ .left-icon-container,
282
+ .right-icon-container {
283
+ width: 24px;
284
+ height: 24px;
285
+ justify-content: center;
286
+ align-items: center;
287
+ }
288
+
289
+ wui-icon {
290
+ color: ${({tokens:e})=>e.theme.iconDefault};
291
+ }
292
+
293
+ /* -- Sizes --------------------------------------------------- */
294
+ button[data-size='lg'] {
295
+ height: 32px;
296
+ }
297
+
298
+ button[data-size='md'] {
299
+ height: 28px;
300
+ }
301
+
302
+ button[data-size='sm'] {
303
+ height: 24px;
304
+ }
305
+
306
+ button[data-size='lg'] wui-image {
307
+ width: 24px;
308
+ height: 24px;
309
+ }
310
+
311
+ button[data-size='md'] wui-image {
312
+ width: 20px;
313
+ height: 20px;
314
+ }
315
+
316
+ button[data-size='sm'] wui-image {
317
+ width: 16px;
318
+ height: 16px;
319
+ }
320
+
321
+ button[data-size='lg'] .left-icon-container {
322
+ width: 24px;
323
+ height: 24px;
324
+ }
325
+
326
+ button[data-size='md'] .left-icon-container {
327
+ width: 20px;
328
+ height: 20px;
329
+ }
330
+
331
+ button[data-size='sm'] .left-icon-container {
332
+ width: 16px;
333
+ height: 16px;
334
+ }
335
+
336
+ /* -- Variants --------------------------------------------------------- */
337
+ button[data-type='filled-dropdown'] {
338
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
339
+ }
340
+
341
+ button[data-type='text-dropdown'] {
342
+ background-color: transparent;
343
+ }
344
+
345
+ /* -- Focus states --------------------------------------------------- */
346
+ button:focus-visible:enabled {
347
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
348
+ box-shadow: 0 0 0 4px ${({tokens:e})=>e.core.foregroundAccent040};
349
+ }
350
+
351
+ /* -- Hover & Active states ----------------------------------------------------------- */
352
+ @media (hover: hover) and (pointer: fine) {
353
+ button:hover:enabled,
354
+ button:active:enabled {
355
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
356
+ }
357
+ }
358
+
359
+ /* -- Disabled states --------------------------------------------------- */
360
+ button:disabled {
361
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
362
+ opacity: 0.5;
363
+ }
364
+ `,xe=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const Te={lg:"lg-regular",md:"md-regular",sm:"sm-regular"},Ae={lg:"lg",md:"md",sm:"sm"};let Se=class extends S{constructor(){super(...arguments),this.imageSrc="",this.text="",this.size="lg",this.type="text-dropdown",this.disabled=!1}render(){return I`<button ?disabled=${this.disabled} data-size=${this.size} data-type=${this.type}>
365
+ ${this.imageTemplate()} ${this.textTemplate()}
366
+ <wui-flex class="right-icon-container">
367
+ <wui-icon name="chevronBottom"></wui-icon>
368
+ </wui-flex>
369
+ </button>`}textTemplate(){const e=Te[this.size];return this.text?I`<wui-text color="primary" variant=${e}>${this.text}</wui-text>`:null}imageTemplate(){if(this.imageSrc)return I`<wui-image src=${this.imageSrc} alt="select visual"></wui-image>`;const e=Ae[this.size];return I` <wui-flex class="left-icon-container">
370
+ <wui-icon size=${e} name="networkPlaceholder"></wui-icon>
371
+ </wui-flex>`}};Se.styles=[A,E,ke],xe([V()],Se.prototype,"imageSrc",void 0),xe([V()],Se.prototype,"text",void 0),xe([V()],Se.prototype,"size",void 0),xe([V()],Se.prototype,"type",void 0),xe([V({type:Boolean})],Se.prototype,"disabled",void 0),Se=xe([M("wui-select")],Se);const Ie={ACCOUNT_TABS:[{label:"Tokens"},{label:"Activity"}],SECURE_SITE_ORIGIN:("undefined"!=typeof process&&void 0!==process.env?process.env.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",VIEW_DIRECTION:{Next:"next",Prev:"prev"},ANIMATION_DURATIONS:{HeaderText:120,ModalHeight:150,ViewTransition:150},VIEWS_WITH_LEGAL_FOOTER:["Connect","ConnectWallets","OnRampTokenSelect","OnRampFiatSelect","OnRampProviders"],VIEWS_WITH_DEFAULT_FOOTER:["Networks"]};var Ee=T`
372
+ button {
373
+ background-color: transparent;
374
+ padding: ${({spacing:e})=>e[1]};
375
+ }
376
+
377
+ button:focus-visible {
378
+ box-shadow: 0 0 0 4px ${({tokens:e})=>e.core.foregroundAccent020};
379
+ }
380
+
381
+ button[data-variant='accent']:hover:enabled,
382
+ button[data-variant='accent']:focus-visible {
383
+ background-color: ${({tokens:e})=>e.core.foregroundAccent010};
384
+ }
385
+
386
+ button[data-variant='primary']:hover:enabled,
387
+ button[data-variant='primary']:focus-visible,
388
+ button[data-variant='secondary']:hover:enabled,
389
+ button[data-variant='secondary']:focus-visible {
390
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
391
+ }
392
+
393
+ button[data-size='xs'] > wui-icon {
394
+ width: 8px;
395
+ height: 8px;
396
+ }
397
+
398
+ button[data-size='sm'] > wui-icon {
399
+ width: 12px;
400
+ height: 12px;
401
+ }
402
+
403
+ button[data-size='xs'],
404
+ button[data-size='sm'] {
405
+ border-radius: ${({borderRadius:e})=>e[1]};
406
+ }
407
+
408
+ button[data-size='md'],
409
+ button[data-size='lg'] {
410
+ border-radius: ${({borderRadius:e})=>e[2]};
411
+ }
412
+
413
+ button[data-size='md'] > wui-icon {
414
+ width: 16px;
415
+ height: 16px;
416
+ }
417
+
418
+ button[data-size='lg'] > wui-icon {
419
+ width: 20px;
420
+ height: 20px;
421
+ }
422
+
423
+ button:disabled {
424
+ background-color: transparent;
425
+ cursor: not-allowed;
426
+ opacity: 0.5;
427
+ }
428
+
429
+ button:hover:not(:disabled) {
430
+ background-color: var(--wui-color-accent-glass-015);
431
+ }
432
+
433
+ button:focus-visible:not(:disabled) {
434
+ background-color: var(--wui-color-accent-glass-015);
435
+ box-shadow:
436
+ inset 0 0 0 1px var(--wui-color-accent-100),
437
+ 0 0 0 4px var(--wui-color-accent-glass-020);
438
+ }
439
+ `,Pe=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let Ce=class extends S{constructor(){super(...arguments),this.size="md",this.disabled=!1,this.icon="copy",this.iconColor="default",this.variant="accent"}render(){return I`
440
+ <button data-variant=${this.variant} ?disabled=${this.disabled} data-size=${this.size}>
441
+ <wui-icon
442
+ color=${{accent:"accent-primary",primary:"inverse",secondary:"default"}[this.variant]||this.iconColor}
443
+ size=${this.size}
444
+ name=${this.icon}
445
+ ></wui-icon>
446
+ </button>
447
+ `}};Ce.styles=[A,E,Ee],Pe([V()],Ce.prototype,"size",void 0),Pe([V({type:Boolean})],Ce.prototype,"disabled",void 0),Pe([V()],Ce.prototype,"icon",void 0),Pe([V()],Ce.prototype,"iconColor",void 0),Pe([V()],Ce.prototype,"variant",void 0),Ce=Pe([M("wui-icon-link")],Ce);const $e=P`<svg width="86" height="96" fill="none">
448
+ <path
449
+ d="M78.3244 18.926L50.1808 2.45078C45.7376 -0.150261 40.2624 -0.150262 35.8192 2.45078L7.6756 18.926C3.23322 21.5266 0.5 26.3301 0.5 31.5248V64.4752C0.5 69.6699 3.23322 74.4734 7.6756 77.074L35.8192 93.5492C40.2624 96.1503 45.7376 96.1503 50.1808 93.5492L78.3244 77.074C82.7668 74.4734 85.5 69.6699 85.5 64.4752V31.5248C85.5 26.3301 82.7668 21.5266 78.3244 18.926Z"
450
+ />
451
+ </svg>`,Ne=P`
452
+ <svg fill="none" viewBox="0 0 36 40">
453
+ <path
454
+ d="M15.4 2.1a5.21 5.21 0 0 1 5.2 0l11.61 6.7a5.21 5.21 0 0 1 2.61 4.52v13.4c0 1.87-1 3.59-2.6 4.52l-11.61 6.7c-1.62.93-3.6.93-5.22 0l-11.6-6.7a5.21 5.21 0 0 1-2.61-4.51v-13.4c0-1.87 1-3.6 2.6-4.52L15.4 2.1Z"
455
+ />
456
+ </svg>
457
+ `;var Re=T`
458
+ :host {
459
+ position: relative;
460
+ border-radius: inherit;
461
+ display: flex;
462
+ justify-content: center;
463
+ align-items: center;
464
+ width: var(--local-width);
465
+ height: var(--local-height);
466
+ }
467
+
468
+ :host([data-round='true']) {
469
+ background: ${({tokens:e})=>e.theme.foregroundPrimary};
470
+ border-radius: 100%;
471
+ outline: 1px solid ${({tokens:e})=>e.core.glass010};
472
+ }
473
+
474
+ svg {
475
+ position: absolute;
476
+ top: 0;
477
+ left: 0;
478
+ width: 100%;
479
+ height: 100%;
480
+ z-index: 1;
481
+ }
482
+
483
+ svg > path {
484
+ stroke: var(--local-stroke);
485
+ }
486
+
487
+ wui-image {
488
+ width: 100%;
489
+ height: 100%;
490
+ -webkit-clip-path: var(--local-path);
491
+ clip-path: var(--local-path);
492
+ background: ${({tokens:e})=>e.theme.foregroundPrimary};
493
+ }
494
+
495
+ wui-icon {
496
+ transform: translateY(-5%);
497
+ width: var(--local-icon-size);
498
+ height: var(--local-icon-size);
499
+ }
500
+ `,Oe=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let _e=class extends S{constructor(){super(...arguments),this.size="md",this.name="uknown",this.networkImagesBySize={sm:Ne,md:Y,lg:$e},this.selected=!1,this.round=!1}render(){const e={sm:"4",md:"6",lg:"10"};return this.round?(this.dataset.round="true",this.style.cssText="\n --local-width: var(--apkt-spacing-10);\n --local-height: var(--apkt-spacing-10);\n --local-icon-size: var(--apkt-spacing-4);\n "):this.style.cssText=`\n\n --local-path: var(--apkt-path-network-${this.size});\n --local-width: var(--apkt-width-network-${this.size});\n --local-height: var(--apkt-height-network-${this.size});\n --local-icon-size: var(--apkt-spacing-${e[this.size]});\n `,I`${this.templateVisual()} ${this.svgTemplate()} `}svgTemplate(){return this.round?null:this.networkImagesBySize[this.size]}templateVisual(){return this.imageSrc?I`<wui-image src=${this.imageSrc} alt=${this.name}></wui-image>`:I`<wui-icon size="inherit" color="default" name="networkPlaceholder"></wui-icon>`}};_e.styles=[A,Re],Oe([V()],_e.prototype,"size",void 0),Oe([V()],_e.prototype,"name",void 0),Oe([V({type:Object})],_e.prototype,"networkImagesBySize",void 0),Oe([V()],_e.prototype,"imageSrc",void 0),Oe([V({type:Boolean})],_e.prototype,"selected",void 0),Oe([V({type:Boolean})],_e.prototype,"round",void 0),_e=Oe([M("wui-network-image")],_e);var Ue=T`
501
+ :host {
502
+ position: relative;
503
+ display: flex;
504
+ width: 100%;
505
+ height: 1px;
506
+ background-color: ${({tokens:e})=>e.theme.borderPrimary};
507
+ justify-content: center;
508
+ align-items: center;
509
+ }
510
+
511
+ :host > wui-text {
512
+ position: absolute;
513
+ padding: 0px 8px;
514
+ transition: background-color ${({durations:e})=>e.lg}
515
+ ${({easings:e})=>e["ease-out-power-2"]};
516
+ will-change: background-color;
517
+ }
518
+
519
+ :host([data-bg-color='primary']) > wui-text {
520
+ background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
521
+ }
522
+
523
+ :host([data-bg-color='secondary']) > wui-text {
524
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
525
+ }
526
+ `,De=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let Le=class extends S{constructor(){super(...arguments),this.text="",this.bgColor="primary"}render(){return this.dataset.bgColor=this.bgColor,I`${this.template()}`}template(){return this.text?I`<wui-text variant="md-regular" color="secondary">${this.text}</wui-text>`:null}};Le.styles=[A,Ue],De([V()],Le.prototype,"text",void 0),De([V()],Le.prototype,"bgColor",void 0),Le=De([M("wui-separator")],Le);const Be={INVALID_PAYMENT_CONFIG:"INVALID_PAYMENT_CONFIG",INVALID_RECIPIENT:"INVALID_RECIPIENT",INVALID_ASSET:"INVALID_ASSET",INVALID_AMOUNT:"INVALID_AMOUNT",UNKNOWN_ERROR:"UNKNOWN_ERROR",UNABLE_TO_INITIATE_PAYMENT:"UNABLE_TO_INITIATE_PAYMENT",INVALID_CHAIN_NAMESPACE:"INVALID_CHAIN_NAMESPACE",GENERIC_PAYMENT_ERROR:"GENERIC_PAYMENT_ERROR",UNABLE_TO_GET_EXCHANGES:"UNABLE_TO_GET_EXCHANGES",ASSET_NOT_SUPPORTED:"ASSET_NOT_SUPPORTED",UNABLE_TO_GET_PAY_URL:"UNABLE_TO_GET_PAY_URL",UNABLE_TO_GET_BUY_STATUS:"UNABLE_TO_GET_BUY_STATUS",UNABLE_TO_GET_TOKEN_BALANCES:"UNABLE_TO_GET_TOKEN_BALANCES",UNABLE_TO_GET_QUOTE:"UNABLE_TO_GET_QUOTE",UNABLE_TO_GET_QUOTE_STATUS:"UNABLE_TO_GET_QUOTE_STATUS",INVALID_RECIPIENT_ADDRESS_FOR_ASSET:"INVALID_RECIPIENT_ADDRESS_FOR_ASSET"},ze={[Be.INVALID_PAYMENT_CONFIG]:"Invalid payment configuration",[Be.INVALID_RECIPIENT]:"Invalid recipient address",[Be.INVALID_ASSET]:"Invalid asset specified",[Be.INVALID_AMOUNT]:"Invalid payment amount",[Be.INVALID_RECIPIENT_ADDRESS_FOR_ASSET]:"Invalid recipient address for the asset selected",[Be.UNKNOWN_ERROR]:"Unknown payment error occurred",[Be.UNABLE_TO_INITIATE_PAYMENT]:"Unable to initiate payment",[Be.INVALID_CHAIN_NAMESPACE]:"Invalid chain namespace",[Be.GENERIC_PAYMENT_ERROR]:"Unable to process payment",[Be.UNABLE_TO_GET_EXCHANGES]:"Unable to get exchanges",[Be.ASSET_NOT_SUPPORTED]:"Asset not supported by the selected exchange",[Be.UNABLE_TO_GET_PAY_URL]:"Unable to get payment URL",[Be.UNABLE_TO_GET_BUY_STATUS]:"Unable to get buy status",[Be.UNABLE_TO_GET_TOKEN_BALANCES]:"Unable to get token balances",[Be.UNABLE_TO_GET_QUOTE]:"Unable to get quote. Please choose a different token",[Be.UNABLE_TO_GET_QUOTE_STATUS]:"Unable to get quote status"};class We extends Error{get message(){return ze[this.code]}constructor(e,t){super(ze[e]),this.name="AppKitPayError",this.code=e,this.details=t,Error.captureStackTrace&&Error.captureStackTrace(this,We)}}const je="https://rpc.walletconnect.org/v1/json-rpc",Fe="reown_test";function qe(e){if(!e)return null;const t=e.steps[0];return t&&t.type===nt?t:null}function Me(e,t=0){if(!e)return[];const i=e.steps.filter((e=>e.type===rt)),o=i.filter(((e,i)=>i+1>t));return i.length>0&&i.length<3?o:[]}const Ve=new R({baseUrl:s.getApiUrl(),clientId:null});class Ge extends Error{}function He(){const{projectId:e,sdkType:t,sdkVersion:i}=_.state;return{projectId:e,st:t||"appkit",sv:i||"html-wagmi-4.2.2"}}async function Ye(e,t){const i=function(){const e=_.getSnapshot().projectId;return`${je}?projectId=${e}`}(),{sdkType:o,sdkVersion:a,projectId:n}=_.getSnapshot(),r={jsonrpc:"2.0",id:1,method:e,params:{...t||{},st:o,sv:a,projectId:n}},s=await fetch(i,{method:"POST",body:JSON.stringify(r),headers:{"Content-Type":"application/json"}}),c=await s.json();if(c.error)throw new Ge(c.error.message);return c}async function Ke(e){return(await Ye("reown_getExchanges",e)).result}async function Qe(e){return(await Ye("reown_getExchangePayUrl",e)).result}async function Xe(t){const i=O.isLowerCaseMatch(t.sourceToken.network,t.toToken.network),o=O.isLowerCaseMatch(t.sourceToken.asset,t.toToken.asset);return i&&o?async function({sourceToken:e,toToken:t,amount:i,recipient:o}){const a=y.parseUnits(i,e.metadata.decimals),n=y.parseUnits(i,t.metadata.decimals);return Promise.resolve({type:at,origin:{amount:a?.toString()??"0",currency:e},destination:{amount:n?.toString()??"0",currency:t},fees:[{id:"service",label:"Service Fee",amount:"0",currency:t}],steps:[{requestId:at,type:"deposit",deposit:{amount:a?.toString()??"0",currency:e.asset,receiver:o}}],timeInSeconds:6})}(t):async function(t){const i=e.bigNumber(t.amount).times(10**t.toToken.metadata.decimals).toString(),{chainId:o,chainNamespace:a}=C.parseCaipNetworkId(t.sourceToken.network),{chainId:n,chainNamespace:r}=C.parseCaipNetworkId(t.toToken.network),s="native"===t.sourceToken.asset?U(a):t.sourceToken.asset,c="native"===t.toToken.asset?U(r):t.toToken.asset;return await Ve.post({path:"/appkit/v1/transfers/quote",body:{user:t.address,originChainId:o.toString(),originCurrency:s,destinationChainId:n.toString(),destinationCurrency:c,recipient:t.recipient,amount:i},params:He()})}(t)}const Ze=["eip155","solana"],Je={eip155:{native:{assetNamespace:"slip44",assetReference:"60"},defaultTokenNamespace:"erc20"},solana:{native:{assetNamespace:"slip44",assetReference:"501"},defaultTokenNamespace:"token"}},et={56:"714",204:"714"};function tt(e,t){const{chainNamespace:i,chainId:o}=C.parseCaipNetworkId(e),a=Je[i];if(!a)throw new Error(`Unsupported chain namespace for CAIP-19 formatting: ${i}`);let n=a.native.assetNamespace,r=a.native.assetReference;"native"!==t?(n=a.defaultTokenNamespace,r=t):"eip155"===i&&et[o]&&(r=et[o]);return`${`${i}:${o}`}/${n}:${r}`}function it(t){const i=e.bigNumber(t,{safe:!0});return i.lt(.001)?"<0.001":i.round(4).toString()}const ot="unknown",at="direct-transfer",nt="deposit",rt="transaction",st=t({paymentAsset:{network:"eip155:1",asset:"0x0",metadata:{name:"0x0",symbol:"0x0",decimals:0}},recipient:"0x0",amount:0,isConfigured:!1,error:null,isPaymentInProgress:!1,exchanges:[],isLoading:!1,openInNewTab:!0,redirectUrl:void 0,payWithExchange:void 0,currentPayment:void 0,analyticsSet:!1,paymentId:void 0,choice:"pay",tokenBalances:{[d.CHAIN.EVM]:[],[d.CHAIN.SOLANA]:[]},isFetchingTokenBalances:!1,selectedPaymentAsset:null,quote:void 0,quoteStatus:"waiting",quoteError:null,isFetchingQuote:!1,selectedExchange:void 0,exchangeUrlForQuote:void 0,requestId:void 0}),ct={state:st,subscribe:e=>a(st,(()=>e(st))),subscribeKey:(e,t)=>n(st,e,t),async handleOpenPay(e){this.resetState(),this.setPaymentConfig(e),this.initializeAnalytics(),function(){const{chainNamespace:e}=C.parseCaipNetworkId(ct.state.paymentAsset.network);if(!s.isAddress(ct.state.recipient,e))throw new We(Be.INVALID_RECIPIENT_ADDRESS_FOR_ASSET,`Provide valid recipient address for namespace "${e}"`)}(),await this.prepareTokenLogo(),st.isConfigured=!0,f.sendEvent({type:"track",event:"PAY_MODAL_OPEN",properties:{exchanges:st.exchanges,configuration:{network:st.paymentAsset.network,asset:st.paymentAsset.asset,recipient:st.recipient,amount:st.amount}}}),await k.open({view:"Pay"})},resetState(){st.paymentAsset={network:"eip155:1",asset:"0x0",metadata:{name:"0x0",symbol:"0x0",decimals:0}},st.recipient="0x0",st.amount=0,st.isConfigured=!1,st.error=null,st.isPaymentInProgress=!1,st.isLoading=!1,st.currentPayment=void 0,st.selectedExchange=void 0,st.exchangeUrlForQuote=void 0,st.requestId=void 0},resetQuoteState(){st.quote=void 0,st.quoteStatus="waiting",st.quoteError=null,st.isFetchingQuote=!1,st.requestId=void 0},setPaymentConfig(e){if(!e.paymentAsset)throw new We(Be.INVALID_PAYMENT_CONFIG);try{st.choice=e.choice??"pay",st.paymentAsset=e.paymentAsset,st.recipient=e.recipient,st.amount=e.amount,st.openInNewTab=e.openInNewTab??!0,st.redirectUrl=e.redirectUrl,st.payWithExchange=e.payWithExchange,st.error=null}catch(e){throw new We(Be.INVALID_PAYMENT_CONFIG,e.message)}},setSelectedPaymentAsset(e){st.selectedPaymentAsset=e},setSelectedExchange(e){st.selectedExchange=e},setRequestId(e){st.requestId=e},setPaymentInProgress(e){st.isPaymentInProgress=e},getPaymentAsset:()=>st.paymentAsset,getExchanges:()=>st.exchanges,async fetchExchanges(){try{st.isLoading=!0;const e=await Ke({page:0});st.exchanges=e.exchanges.slice(0,2)}catch(e){throw u.showError(ze.UNABLE_TO_GET_EXCHANGES),new We(Be.UNABLE_TO_GET_EXCHANGES)}finally{st.isLoading=!1}},async getAvailableExchanges(e){try{const t=e?.asset&&e?.network?tt(e.network,e.asset):void 0;return await Ke({page:e?.page??0,asset:t,amount:e?.amount?.toString()})}catch(e){throw new We(Be.UNABLE_TO_GET_EXCHANGES)}},async getPayUrl(e,t,i=!1){try{const o=Number(t.amount),a=await Qe({exchangeId:e,asset:tt(t.network,t.asset),amount:o.toString(),recipient:`${t.network}:${t.recipient}`});return f.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{source:"pay",exchange:{id:e},configuration:{network:t.network,asset:t.asset,recipient:t.recipient,amount:o},currentPayment:{type:"exchange",exchangeId:e},headless:i}}),i&&(this.initiatePayment(),f.sendEvent({type:"track",event:"PAY_INITIATED",properties:{source:"pay",paymentId:st.paymentId||ot,configuration:{network:t.network,asset:t.asset,recipient:t.recipient,amount:o},currentPayment:{type:"exchange",exchangeId:e}}})),a}catch(e){if(e instanceof Error&&e.message.includes("is not supported"))throw new We(Be.ASSET_NOT_SUPPORTED);throw new Error(e.message)}},async generateExchangeUrlForQuote({exchangeId:e,paymentAsset:t,amount:i,recipient:o}){const a=await Qe({exchangeId:e,asset:tt(t.network,t.asset),amount:i.toString(),recipient:o});st.exchangeSessionId=a.sessionId,st.exchangeUrlForQuote=a.url},async openPayUrl(e,t,i=!1){try{const o=await this.getPayUrl(e.exchangeId,t,i);if(!o)throw new We(Be.UNABLE_TO_GET_PAY_URL);const a=e.openInNewTab??!0?"_blank":"_self";return s.openHref(o.url,a),o}catch(e){throw st.error=e instanceof We?e.message:ze.GENERIC_PAYMENT_ERROR,new We(Be.UNABLE_TO_GET_PAY_URL)}},async onTransfer({chainNamespace:e,fromAddress:t,toAddress:i,amount:o,paymentAsset:a}){if(st.currentPayment={type:"wallet",status:"IN_PROGRESS"},!st.isPaymentInProgress)try{this.initiatePayment();const n=r.getAllRequestedCaipNetworks().find((e=>e.caipNetworkId===a.network));if(!n)throw new Error("Target network not found");const s=r.state.activeCaipNetwork;switch(O.isLowerCaseMatch(s?.caipNetworkId,n.caipNetworkId)||await r.switchActiveNetwork(n),e){case d.CHAIN.EVM:"native"===a.asset&&(st.currentPayment.result=await async function(e,t,i){if(t!==d.CHAIN.EVM)throw new We(Be.INVALID_CHAIN_NAMESPACE);if(!i.fromAddress)throw new We(Be.INVALID_PAYMENT_CONFIG,"fromAddress is required for native EVM payments.");const o="string"==typeof i.amount?parseFloat(i.amount):i.amount;if(isNaN(o))throw new We(Be.INVALID_PAYMENT_CONFIG);const a=e.metadata?.decimals??18,n=y.parseUnits(o.toString(),a);if("bigint"!=typeof n)throw new We(Be.GENERIC_PAYMENT_ERROR);return await y.sendTransaction({chainNamespace:t,to:i.recipient,address:i.fromAddress,value:n,data:"0x"})??void 0}(a,e,{recipient:i,amount:o,fromAddress:t})),a.asset.startsWith("0x")&&(st.currentPayment.result=await async function(e,t){if(!t.fromAddress)throw new We(Be.INVALID_PAYMENT_CONFIG,"fromAddress is required for ERC20 EVM payments.");const i=e.asset,o=t.recipient,a=Number(e.metadata.decimals),n=y.parseUnits(t.amount.toString(),a);if(void 0===n)throw new We(Be.GENERIC_PAYMENT_ERROR);return await y.writeContract({fromAddress:t.fromAddress,tokenAddress:i,args:[o,n],method:"transfer",abi:$.getERC20Abi(i),chainNamespace:d.CHAIN.EVM})??void 0}(a,{recipient:i,amount:o,fromAddress:t})),st.currentPayment.status="SUCCESS";break;case d.CHAIN.SOLANA:st.currentPayment.result=await async function(e,t){if(e!==d.CHAIN.SOLANA)throw new We(Be.INVALID_CHAIN_NAMESPACE);if(!t.fromAddress)throw new We(Be.INVALID_PAYMENT_CONFIG,"fromAddress is required for Solana payments.");const i="string"==typeof t.amount?parseFloat(t.amount):t.amount;if(isNaN(i)||i<=0)throw new We(Be.INVALID_PAYMENT_CONFIG,"Invalid payment amount.");try{if(!N.getProvider(e))throw new We(Be.GENERIC_PAYMENT_ERROR,"No Solana provider available.");const o=await y.sendTransaction({chainNamespace:d.CHAIN.SOLANA,to:t.recipient,value:i,tokenMint:t.tokenMint});if(!o)throw new We(Be.GENERIC_PAYMENT_ERROR,"Transaction failed.");return o}catch(e){if(e instanceof We)throw e;throw new We(Be.GENERIC_PAYMENT_ERROR,`Solana payment failed: ${e}`)}}(e,{recipient:i,amount:o,fromAddress:t,tokenMint:"native"===a.asset?void 0:a.asset}),st.currentPayment.status="SUCCESS";break;default:throw new We(Be.INVALID_CHAIN_NAMESPACE)}}catch(e){throw st.error=e instanceof We?e.message:ze.GENERIC_PAYMENT_ERROR,st.currentPayment.status="FAILED",u.showError(st.error),e}finally{st.isPaymentInProgress=!1}},async onSendTransaction(e){try{const{namespace:t,transactionStep:i}=e;ct.initiatePayment();const o=r.getAllRequestedCaipNetworks().find((e=>e.caipNetworkId===st.paymentAsset?.network));if(!o)throw new Error("Target network not found");const a=r.state.activeCaipNetwork;if(O.isLowerCaseMatch(a?.caipNetworkId,o.caipNetworkId)||await r.switchActiveNetwork(o),t===d.CHAIN.EVM){const{from:e,to:o,data:a,value:n}=i.transaction;await y.sendTransaction({address:e,to:o,data:a,value:BigInt(n),chainNamespace:t})}else if(t===d.CHAIN.SOLANA){const{instructions:e}=i.transaction;await y.writeSolanaTransaction({instructions:e})}}catch(e){throw st.error=e instanceof We?e.message:ze.GENERIC_PAYMENT_ERROR,u.showError(st.error),e}finally{st.isPaymentInProgress=!1}},getExchangeById:e=>st.exchanges.find((t=>t.id===e)),validatePayConfig(e){const{paymentAsset:t,recipient:i,amount:o}=e;if(!t)throw new We(Be.INVALID_PAYMENT_CONFIG);if(!i)throw new We(Be.INVALID_RECIPIENT);if(!t.asset)throw new We(Be.INVALID_ASSET);if(null==o||o<=0)throw new We(Be.INVALID_AMOUNT)},async handlePayWithExchange(e){try{st.currentPayment={type:"exchange",exchangeId:e};const{network:t,asset:i}=st.paymentAsset,o={network:t,asset:i,amount:st.amount,recipient:st.recipient},a=await this.getPayUrl(e,o);if(!a)throw new We(Be.UNABLE_TO_INITIATE_PAYMENT);return st.currentPayment.sessionId=a.sessionId,st.currentPayment.status="IN_PROGRESS",st.currentPayment.exchangeId=e,this.initiatePayment(),{url:a.url,openInNewTab:st.openInNewTab}}catch(e){return st.error=e instanceof We?e.message:ze.GENERIC_PAYMENT_ERROR,st.isPaymentInProgress=!1,u.showError(st.error),null}},async getBuyStatus(e,t){try{const i=await async function(e){return(await Ye("reown_getExchangeBuyStatus",e)).result}({sessionId:t,exchangeId:e});return"SUCCESS"!==i.status&&"FAILED"!==i.status||f.sendEvent({type:"track",event:"SUCCESS"===i.status?"PAY_SUCCESS":"PAY_ERROR",properties:{message:"FAILED"===i.status?s.parseError(st.error):void 0,source:"pay",paymentId:st.paymentId||ot,configuration:{network:st.paymentAsset.network,asset:st.paymentAsset.asset,recipient:st.recipient,amount:st.amount},currentPayment:{type:"exchange",exchangeId:st.currentPayment?.exchangeId,sessionId:st.currentPayment?.sessionId,result:i.txHash}}}),i}catch(e){throw new We(Be.UNABLE_TO_GET_BUY_STATUS)}},async fetchTokensFromEOA({caipAddress:e,caipNetwork:t,namespace:i}){if(!e)return[];const{address:o}=C.parseCaipAddress(e);let a=t;i===d.CHAIN.EVM&&(a=void 0);return await w.getMyTokensWithBalance({address:o,caipNetwork:a})},async fetchTokensFromExchange(){if(!st.selectedExchange)return[];const e=await async function(e){return await Ve.get({path:`/appkit/v1/transfers/assets/exchanges/${e}`,params:He()})}(st.selectedExchange.id),t=Object.values(e.assets).flat();return await Promise.all(t.map((async e=>{const t={chainId:(i=e).network,address:`${i.network}:${i.asset}`,symbol:i.metadata.symbol,name:i.metadata.name,iconUrl:i.metadata.logoURI||"",price:0,quantity:{numeric:"0",decimals:i.metadata.decimals.toString()}};var i;const{chainNamespace:o}=C.parseCaipNetworkId(t.chainId);let a=t.address;if(s.isCaipAddress(a)){const{address:e}=C.parseCaipAddress(a);a=e}const n=await D.getImageByToken(a??"",o).catch((()=>{}));return t.iconUrl=n??"",t})))},async fetchTokens({caipAddress:e,caipNetwork:t,namespace:i}){try{st.isFetchingTokenBalances=!0;const o=Boolean(st.selectedExchange)?this.fetchTokensFromExchange():this.fetchTokensFromEOA({caipAddress:e,caipNetwork:t,namespace:i}),a=await o;st.tokenBalances={...st.tokenBalances,[i]:a}}catch(e){const t=e instanceof Error?e.message:"Unable to get token balances";u.showError(t)}finally{st.isFetchingTokenBalances=!1}},async fetchQuote({amount:t,address:i,sourceToken:o,toToken:a,recipient:n}){try{ct.resetQuoteState(),st.isFetchingQuote=!0;const r=await Xe({amount:t,address:st.selectedExchange?void 0:i,sourceToken:o,toToken:a,recipient:n});if(st.selectedExchange){const t=qe(r);if(t){const i=`${o.network}:${t.deposit.receiver}`,a=e.formatNumber(t.deposit.amount,{decimals:o.metadata.decimals??0,round:8});await ct.generateExchangeUrlForQuote({exchangeId:st.selectedExchange.id,paymentAsset:o,amount:a.toString(),recipient:i})}}st.quote=r}catch(e){let t=ze.UNABLE_TO_GET_QUOTE;if(e instanceof Error&&e.cause&&e.cause instanceof Response)try{const i=await e.cause.json();i.error&&"string"==typeof i.error&&(t=i.error)}catch{}throw st.quoteError=t,u.showError(t),new We(Be.UNABLE_TO_GET_QUOTE)}finally{st.isFetchingQuote=!1}},async fetchQuoteStatus({requestId:e}){try{if(e===at){const e=st.selectedExchange,t=st.exchangeSessionId;if(e&&t){switch((await this.getBuyStatus(e.id,t)).status){case"IN_PROGRESS":case"UNKNOWN":default:st.quoteStatus="waiting";break;case"SUCCESS":st.quoteStatus="success",st.isPaymentInProgress=!1;break;case"FAILED":st.quoteStatus="failure",st.isPaymentInProgress=!1}return}return void(st.quoteStatus="success")}const{status:t}=await async function(e){return await Ve.get({path:"/appkit/v1/transfers/status",params:{requestId:e.requestId,...He()}})}({requestId:e});st.quoteStatus=t}catch{throw st.quoteStatus="failure",new We(Be.UNABLE_TO_GET_QUOTE_STATUS)}},initiatePayment(){st.isPaymentInProgress=!0,st.paymentId=crypto.randomUUID()},initializeAnalytics(){st.analyticsSet||(st.analyticsSet=!0,this.subscribeKey("isPaymentInProgress",(e=>{if(st.currentPayment?.status&&"UNKNOWN"!==st.currentPayment.status){const e={IN_PROGRESS:"PAY_INITIATED",SUCCESS:"PAY_SUCCESS",FAILED:"PAY_ERROR"}[st.currentPayment.status];f.sendEvent({type:"track",event:e,properties:{message:"FAILED"===st.currentPayment.status?s.parseError(st.error):void 0,source:"pay",paymentId:st.paymentId||ot,configuration:{network:st.paymentAsset.network,asset:st.paymentAsset.asset,recipient:st.recipient,amount:st.amount},currentPayment:{type:st.currentPayment.type,exchangeId:st.currentPayment.exchangeId,sessionId:st.currentPayment.sessionId,result:st.currentPayment.result}}})}})))},async prepareTokenLogo(){if(!st.paymentAsset.metadata.logoURI)try{const{chainNamespace:e}=C.parseCaipNetworkId(st.paymentAsset.network),t=await D.getImageByToken(st.paymentAsset.asset,e);st.paymentAsset.metadata.logoURI=t}catch{}}};var lt=T`
527
+ wui-separator {
528
+ margin: var(--apkt-spacing-3) calc(var(--apkt-spacing-3) * -1) var(--apkt-spacing-2)
529
+ calc(var(--apkt-spacing-3) * -1);
530
+ width: calc(100% + var(--apkt-spacing-3) * 2);
531
+ }
532
+
533
+ .token-display {
534
+ padding: var(--apkt-spacing-3) var(--apkt-spacing-3);
535
+ border-radius: var(--apkt-borderRadius-5);
536
+ background-color: var(--apkt-tokens-theme-backgroundPrimary);
537
+ margin-top: var(--apkt-spacing-3);
538
+ margin-bottom: var(--apkt-spacing-3);
539
+ }
540
+
541
+ .token-display wui-text {
542
+ text-transform: none;
543
+ }
544
+
545
+ wui-loading-spinner {
546
+ padding: var(--apkt-spacing-2);
547
+ }
548
+
549
+ .left-image-container {
550
+ position: relative;
551
+ justify-content: center;
552
+ align-items: center;
553
+ }
554
+
555
+ .token-image {
556
+ border-radius: ${({borderRadius:e})=>e.round};
557
+ width: 40px;
558
+ height: 40px;
559
+ }
560
+
561
+ .chain-image {
562
+ position: absolute;
563
+ width: 20px;
564
+ height: 20px;
565
+ bottom: -3px;
566
+ right: -5px;
567
+ border-radius: ${({borderRadius:e})=>e.round};
568
+ border: 2px solid ${({tokens:e})=>e.theme.backgroundPrimary};
569
+ }
570
+
571
+ .payment-methods-container {
572
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
573
+ border-top-right-radius: ${({borderRadius:e})=>e[8]};
574
+ border-top-left-radius: ${({borderRadius:e})=>e[8]};
575
+ }
576
+ `,dt=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let ut=class extends S{constructor(){super(),this.unsubscribe=[],this.amount=ct.state.amount,this.namespace=void 0,this.paymentAsset=ct.state.paymentAsset,this.activeConnectorIds=l.state.activeConnectorIds,this.caipAddress=void 0,this.exchanges=ct.state.exchanges,this.isLoading=ct.state.isLoading,this.initializeNamespace(),this.unsubscribe.push(ct.subscribeKey("amount",(e=>this.amount=e))),this.unsubscribe.push(l.subscribeKey("activeConnectorIds",(e=>this.activeConnectorIds=e))),this.unsubscribe.push(ct.subscribeKey("exchanges",(e=>this.exchanges=e))),this.unsubscribe.push(ct.subscribeKey("isLoading",(e=>this.isLoading=e))),ct.fetchExchanges(),ct.setSelectedExchange(void 0)}disconnectedCallback(){this.unsubscribe.forEach((e=>e()))}render(){return I`
577
+ <wui-flex flexDirection="column">
578
+ ${this.paymentDetailsTemplate()} ${this.paymentMethodsTemplate()}
579
+ </wui-flex>
580
+ `}paymentMethodsTemplate(){return I`
581
+ <wui-flex flexDirection="column" padding="3" gap="2" class="payment-methods-container">
582
+ ${this.payWithWalletTemplate()} ${this.templateSeparator()}
583
+ ${this.templateExchangeOptions()}
584
+ </wui-flex>
585
+ `}initializeNamespace(){const e=r.state.activeChain;this.namespace=e,this.caipAddress=r.getAccountData(e)?.caipAddress,this.unsubscribe.push(r.subscribeChainProp("accountState",(e=>{this.caipAddress=e?.caipAddress}),e))}paymentDetailsTemplate(){const e=r.getAllRequestedCaipNetworks().find((e=>e.caipNetworkId===this.paymentAsset.network));return I`
586
+ <wui-flex
587
+ alignItems="center"
588
+ justifyContent="space-between"
589
+ .padding=${["6","8","6","8"]}
590
+ gap="2"
591
+ >
592
+ <wui-flex alignItems="center" gap="1">
593
+ <wui-text variant="h1-regular" color="primary">
594
+ ${it(this.amount||"0")}
595
+ </wui-text>
596
+
597
+ <wui-flex flexDirection="column">
598
+ <wui-text variant="h6-regular" color="secondary">
599
+ ${this.paymentAsset.metadata.symbol||"Unknown"}
600
+ </wui-text>
601
+ <wui-text variant="md-medium" color="secondary"
602
+ >on ${e?.name||"Unknown"}</wui-text
603
+ >
604
+ </wui-flex>
605
+ </wui-flex>
606
+
607
+ <wui-flex class="left-image-container">
608
+ <wui-image
609
+ src=${G(this.paymentAsset.metadata.logoURI)}
610
+ class="token-image"
611
+ ></wui-image>
612
+ <wui-image
613
+ src=${G(D.getNetworkImage(e))}
614
+ class="chain-image"
615
+ ></wui-image>
616
+ </wui-flex>
617
+ </wui-flex>
618
+ `}payWithWalletTemplate(){return function(e){const{chainNamespace:t}=C.parseCaipNetworkId(e);return Ze.includes(t)}(this.paymentAsset.network)?this.caipAddress?this.connectedWalletTemplate():this.disconnectedWalletTemplate():I``}connectedWalletTemplate(){const{name:e,image:t}=this.getWalletProperties({namespace:this.namespace});return I`
619
+ <wui-flex flexDirection="column" gap="3">
620
+ <wui-list-item
621
+ type="secondary"
622
+ boxColor="foregroundSecondary"
623
+ @click=${this.onWalletPayment}
624
+ .boxed=${!1}
625
+ ?chevron=${!0}
626
+ ?fullSize=${!1}
627
+ ?rounded=${!0}
628
+ data-testid="wallet-payment-option"
629
+ imageSrc=${G(t)}
630
+ imageSize="3xl"
631
+ >
632
+ <wui-text variant="lg-regular" color="primary">Pay with ${e}</wui-text>
633
+ </wui-list-item>
634
+
635
+ <wui-list-item
636
+ type="secondary"
637
+ icon="power"
638
+ iconColor="error"
639
+ @click=${this.onDisconnect}
640
+ data-testid="disconnect-button"
641
+ ?chevron=${!1}
642
+ boxColor="foregroundSecondary"
643
+ >
644
+ <wui-text variant="lg-regular" color="secondary">Disconnect</wui-text>
645
+ </wui-list-item>
646
+ </wui-flex>
647
+ `}disconnectedWalletTemplate(){return I`<wui-list-item
648
+ type="secondary"
649
+ boxColor="foregroundSecondary"
650
+ variant="icon"
651
+ iconColor="default"
652
+ iconVariant="overlay"
653
+ icon="wallet"
654
+ @click=${this.onWalletPayment}
655
+ ?chevron=${!0}
656
+ data-testid="wallet-payment-option"
657
+ >
658
+ <wui-text variant="lg-regular" color="primary">Pay with wallet</wui-text>
659
+ </wui-list-item>`}templateExchangeOptions(){if(this.isLoading)return I`<wui-flex justifyContent="center" alignItems="center">
660
+ <wui-loading-spinner size="md"></wui-loading-spinner>
661
+ </wui-flex>`;const e=this.exchanges.filter((e=>function(e){const t=r.getAllRequestedCaipNetworks().find((t=>t.caipNetworkId===e.network));return!!t&&Boolean(t.testnet)}(this.paymentAsset)?e.id===Fe:e.id!==Fe));return 0===e.length?I`<wui-flex justifyContent="center" alignItems="center">
662
+ <wui-text variant="md-medium" color="primary">No exchanges available</wui-text>
663
+ </wui-flex>`:e.map((e=>I`
664
+ <wui-list-item
665
+ type="secondary"
666
+ boxColor="foregroundSecondary"
667
+ @click=${()=>this.onExchangePayment(e)}
668
+ data-testid="exchange-option-${e.id}"
669
+ ?chevron=${!0}
670
+ imageSrc=${G(e.imageUrl)}
671
+ >
672
+ <wui-text flexGrow="1" variant="lg-regular" color="primary">
673
+ Pay with ${e.name}
674
+ </wui-text>
675
+ </wui-list-item>
676
+ `))}templateSeparator(){return I`<wui-separator text="or" bgColor="secondary"></wui-separator>`}async onWalletPayment(){if(!this.namespace)throw new Error("Namespace not found");this.caipAddress?p.push("PayQuote"):(await l.connect(),await k.open({view:"PayQuote"}))}onExchangePayment(e){ct.setSelectedExchange(e),p.push("PayQuote")}async onDisconnect(){try{await y.disconnect(),await k.open({view:"Pay"})}catch{console.error("Failed to disconnect"),u.showError("Failed to disconnect")}}getWalletProperties({namespace:e}){if(!e)return{name:void 0,image:void 0};const t=this.activeConnectorIds[e];if(!t)return{name:void 0,image:void 0};const i=l.getConnector({id:t,namespace:e});if(!i)return{name:void 0,image:void 0};const o=D.getConnectorImage(i);return{name:i.name,image:o}}};ut.styles=lt,dt([H()],ut.prototype,"amount",void 0),dt([H()],ut.prototype,"namespace",void 0),dt([H()],ut.prototype,"paymentAsset",void 0),dt([H()],ut.prototype,"activeConnectorIds",void 0),dt([H()],ut.prototype,"caipAddress",void 0),dt([H()],ut.prototype,"exchanges",void 0),dt([H()],ut.prototype,"isLoading",void 0),ut=dt([M("w3m-pay-view")],ut);var pt=T`
677
+ :host {
678
+ display: inline-flex;
679
+ align-items: center;
680
+ justify-content: center;
681
+ }
682
+
683
+ .pulse-container {
684
+ position: relative;
685
+ width: var(--pulse-size);
686
+ height: var(--pulse-size);
687
+ display: flex;
688
+ align-items: center;
689
+ justify-content: center;
690
+ }
691
+
692
+ .pulse-rings {
693
+ position: absolute;
694
+ inset: 0;
695
+ pointer-events: none;
696
+ }
697
+
698
+ .pulse-ring {
699
+ position: absolute;
700
+ inset: 0;
701
+ border-radius: 50%;
702
+ border: 2px solid var(--pulse-color);
703
+ opacity: 0;
704
+ animation: pulse var(--pulse-duration, 2s) ease-out infinite;
705
+ }
706
+
707
+ .pulse-content {
708
+ position: relative;
709
+ z-index: 1;
710
+ display: flex;
711
+ align-items: center;
712
+ justify-content: center;
713
+ }
714
+
715
+ @keyframes pulse {
716
+ 0% {
717
+ transform: scale(0.5);
718
+ opacity: var(--pulse-opacity, 0.3);
719
+ }
720
+ 50% {
721
+ opacity: calc(var(--pulse-opacity, 0.3) * 0.5);
722
+ }
723
+ 100% {
724
+ transform: scale(1.2);
725
+ opacity: 0;
726
+ }
727
+ }
728
+ `,ht=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const mt={"accent-primary":L.tokens.core.backgroundAccentPrimary};let wt=class extends S{constructor(){super(...arguments),this.rings=3,this.duration=2,this.opacity=.3,this.size="200px",this.variant="accent-primary"}render(){const e=mt[this.variant];this.style.cssText=`\n --pulse-size: ${this.size};\n --pulse-duration: ${this.duration}s;\n --pulse-color: ${e};\n --pulse-opacity: ${this.opacity};\n `;const t=Array.from({length:this.rings},((e,t)=>this.renderRing(t,this.rings)));return I`
729
+ <div class="pulse-container">
730
+ <div class="pulse-rings">${t}</div>
731
+ <div class="pulse-content">
732
+ <slot></slot>
733
+ </div>
734
+ </div>
735
+ `}renderRing(e,t){const i=e/t*this.duration;return I`<div class="pulse-ring" style=${`animation-delay: ${i}s;`}></div>`}};wt.styles=[A,pt],ht([V({type:Number})],wt.prototype,"rings",void 0),ht([V({type:Number})],wt.prototype,"duration",void 0),ht([V({type:Number})],wt.prototype,"opacity",void 0),ht([V()],wt.prototype,"size",void 0),ht([V()],wt.prototype,"variant",void 0),wt=ht([M("wui-pulse")],wt);const gt=[{id:"received",title:"Receiving funds",icon:"dollar"},{id:"processing",title:"Swapping asset",icon:"recycleHorizontal"},{id:"sending",title:"Sending asset to the recipient address",icon:"send"}],yt=["success","submitted","failure","timeout","refund"];var ft=T`
736
+ :host {
737
+ display: block;
738
+ height: 100%;
739
+ width: 100%;
740
+ }
741
+
742
+ wui-image {
743
+ border-radius: ${({borderRadius:e})=>e.round};
744
+ }
745
+
746
+ .token-badge-container {
747
+ position: absolute;
748
+ bottom: 6px;
749
+ left: 50%;
750
+ transform: translateX(-50%);
751
+ border-radius: ${({borderRadius:e})=>e[4]};
752
+ z-index: 3;
753
+ min-width: 105px;
754
+ }
755
+
756
+ .token-badge-container.loading {
757
+ background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
758
+ border: 3px solid ${({tokens:e})=>e.theme.backgroundPrimary};
759
+ }
760
+
761
+ .token-badge-container.success {
762
+ background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
763
+ border: 3px solid ${({tokens:e})=>e.theme.backgroundPrimary};
764
+ }
765
+
766
+ .token-image-container {
767
+ position: relative;
768
+ }
769
+
770
+ .token-image {
771
+ border-radius: ${({borderRadius:e})=>e.round};
772
+ width: 64px;
773
+ height: 64px;
774
+ }
775
+
776
+ .token-image.success {
777
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
778
+ }
779
+
780
+ .token-image.error {
781
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
782
+ }
783
+
784
+ .token-image.loading {
785
+ background: ${({colors:e})=>e.accent010};
786
+ }
787
+
788
+ .token-image wui-icon {
789
+ width: 32px;
790
+ height: 32px;
791
+ }
792
+
793
+ .token-badge {
794
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
795
+ border: 1px solid ${({tokens:e})=>e.theme.foregroundSecondary};
796
+ border-radius: ${({borderRadius:e})=>e[4]};
797
+ }
798
+
799
+ .token-badge wui-text {
800
+ white-space: nowrap;
801
+ }
802
+
803
+ .payment-lifecycle-container {
804
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
805
+ border-top-right-radius: ${({borderRadius:e})=>e[6]};
806
+ border-top-left-radius: ${({borderRadius:e})=>e[6]};
807
+ }
808
+
809
+ .payment-step-badge {
810
+ padding: ${({spacing:e})=>e[1]} ${({spacing:e})=>e[2]};
811
+ border-radius: ${({borderRadius:e})=>e[1]};
812
+ }
813
+
814
+ .payment-step-badge.loading {
815
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
816
+ }
817
+
818
+ .payment-step-badge.error {
819
+ background-color: ${({tokens:e})=>e.core.backgroundError};
820
+ }
821
+
822
+ .payment-step-badge.success {
823
+ background-color: ${({tokens:e})=>e.core.backgroundSuccess};
824
+ }
825
+
826
+ .step-icon-container {
827
+ position: relative;
828
+ height: 40px;
829
+ width: 40px;
830
+ border-radius: ${({borderRadius:e})=>e.round};
831
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
832
+ }
833
+
834
+ .step-icon-box {
835
+ position: absolute;
836
+ right: -4px;
837
+ bottom: -1px;
838
+ padding: 2px;
839
+ border-radius: ${({borderRadius:e})=>e.round};
840
+ border: 2px solid ${({tokens:e})=>e.theme.backgroundPrimary};
841
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
842
+ }
843
+
844
+ .step-icon-box.success {
845
+ background-color: ${({tokens:e})=>e.core.backgroundSuccess};
846
+ }
847
+ `,bt=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const vt={received:["pending","success","submitted"],processing:["success","submitted"],sending:["success","submitted"]};let kt=class extends S{constructor(){super(),this.unsubscribe=[],this.pollingInterval=null,this.paymentAsset=ct.state.paymentAsset,this.quoteStatus=ct.state.quoteStatus,this.quote=ct.state.quote,this.amount=ct.state.amount,this.namespace=void 0,this.caipAddress=void 0,this.profileName=null,this.activeConnectorIds=l.state.activeConnectorIds,this.selectedExchange=ct.state.selectedExchange,this.initializeNamespace(),this.unsubscribe.push(ct.subscribeKey("quoteStatus",(e=>this.quoteStatus=e)),ct.subscribeKey("quote",(e=>this.quote=e)),l.subscribeKey("activeConnectorIds",(e=>this.activeConnectorIds=e)),ct.subscribeKey("selectedExchange",(e=>this.selectedExchange=e)))}connectedCallback(){super.connectedCallback(),this.startPolling()}disconnectedCallback(){super.disconnectedCallback(),this.stopPolling(),this.unsubscribe.forEach((e=>e()))}render(){return I`
848
+ <wui-flex flexDirection="column" .padding=${["3","0","0","0"]} gap="2">
849
+ ${this.tokenTemplate()} ${this.paymentTemplate()} ${this.paymentLifecycleTemplate()}
850
+ </wui-flex>
851
+ `}tokenTemplate(){const e=it(this.amount||"0"),t=this.paymentAsset.metadata.symbol??"Unknown",i=r.getAllRequestedCaipNetworks().find((e=>e.caipNetworkId===this.paymentAsset.network)),o="failure"===this.quoteStatus||"timeout"===this.quoteStatus||"refund"===this.quoteStatus;return"success"===this.quoteStatus||"submitted"===this.quoteStatus?I`<wui-flex alignItems="center" justifyContent="center">
852
+ <wui-flex justifyContent="center" alignItems="center" class="token-image success">
853
+ <wui-icon name="checkmark" color="success" size="inherit"></wui-icon>
854
+ </wui-flex>
855
+ </wui-flex>`:o?I`<wui-flex alignItems="center" justifyContent="center">
856
+ <wui-flex justifyContent="center" alignItems="center" class="token-image error">
857
+ <wui-icon name="close" color="error" size="inherit"></wui-icon>
858
+ </wui-flex>
859
+ </wui-flex>`:I`
860
+ <wui-flex alignItems="center" justifyContent="center">
861
+ <wui-flex class="token-image-container">
862
+ <wui-pulse size="125px" rings="3" duration="4" opacity="0.5" variant="accent-primary">
863
+ <wui-flex justifyContent="center" alignItems="center" class="token-image loading">
864
+ <wui-icon name="paperPlaneTitle" color="accent-primary" size="inherit"></wui-icon>
865
+ </wui-flex>
866
+ </wui-pulse>
867
+
868
+ <wui-flex
869
+ justifyContent="center"
870
+ alignItems="center"
871
+ class="token-badge-container loading"
872
+ >
873
+ <wui-flex
874
+ alignItems="center"
875
+ justifyContent="center"
876
+ gap="01"
877
+ padding="1"
878
+ class="token-badge"
879
+ >
880
+ <wui-image
881
+ src=${G(D.getNetworkImage(i))}
882
+ class="chain-image"
883
+ size="mdl"
884
+ ></wui-image>
885
+
886
+ <wui-text variant="lg-regular" color="primary">${e} ${t}</wui-text>
887
+ </wui-flex>
888
+ </wui-flex>
889
+ </wui-flex>
890
+ </wui-flex>
891
+ `}paymentTemplate(){return I`
892
+ <wui-flex flexDirection="column" gap="2" .padding=${["0","6","0","6"]}>
893
+ ${this.renderPayment()}
894
+ <wui-separator></wui-separator>
895
+ ${this.renderWallet()}
896
+ </wui-flex>
897
+ `}paymentLifecycleTemplate(){const e=this.getStepsWithStatus();return I`
898
+ <wui-flex flexDirection="column" padding="4" gap="2" class="payment-lifecycle-container">
899
+ <wui-flex alignItems="center" justifyContent="space-between">
900
+ <wui-text variant="md-regular" color="secondary">PAYMENT CYCLE</wui-text>
901
+
902
+ ${this.renderPaymentCycleBadge()}
903
+ </wui-flex>
904
+
905
+ <wui-flex flexDirection="column" gap="5" .padding=${["2","0","2","0"]}>
906
+ ${e.map((e=>this.renderStep(e)))}
907
+ </wui-flex>
908
+ </wui-flex>
909
+ `}renderPaymentCycleBadge(){const e="failure"===this.quoteStatus||"timeout"===this.quoteStatus||"refund"===this.quoteStatus,t="success"===this.quoteStatus||"submitted"===this.quoteStatus;if(e)return I`
910
+ <wui-flex
911
+ justifyContent="center"
912
+ alignItems="center"
913
+ class="payment-step-badge error"
914
+ gap="1"
915
+ >
916
+ <wui-icon name="close" color="error" size="xs"></wui-icon>
917
+ <wui-text variant="sm-regular" color="error">Failed</wui-text>
918
+ </wui-flex>
919
+ `;if(t)return I`
920
+ <wui-flex
921
+ justifyContent="center"
922
+ alignItems="center"
923
+ class="payment-step-badge success"
924
+ gap="1"
925
+ >
926
+ <wui-icon name="checkmark" color="success" size="xs"></wui-icon>
927
+ <wui-text variant="sm-regular" color="success">Completed</wui-text>
928
+ </wui-flex>
929
+ `;const i=this.quote?.timeInSeconds??0;return I`
930
+ <wui-flex alignItems="center" justifyContent="space-between" gap="3">
931
+ <wui-flex
932
+ justifyContent="center"
933
+ alignItems="center"
934
+ class="payment-step-badge loading"
935
+ gap="1"
936
+ >
937
+ <wui-icon name="clock" color="default" size="xs"></wui-icon>
938
+ <wui-text variant="sm-regular" color="primary">Est. ${i} sec</wui-text>
939
+ </wui-flex>
940
+
941
+ <wui-icon name="chevronBottom" color="default" size="xxs"></wui-icon>
942
+ </wui-flex>
943
+ `}renderPayment(){const t=r.getAllRequestedCaipNetworks().find((e=>{const t=this.quote?.origin.currency.network;if(!t)return!1;const{chainId:i}=C.parseCaipNetworkId(t);return O.isLowerCaseMatch(e.id.toString(),i.toString())})),i=it(e.formatNumber(this.quote?.origin.amount||"0",{decimals:this.quote?.origin.currency.metadata.decimals??0}).toString()),o=this.quote?.origin.currency.metadata.symbol??"Unknown";return I`
944
+ <wui-flex
945
+ alignItems="flex-start"
946
+ justifyContent="space-between"
947
+ .padding=${["3","0","3","0"]}
948
+ >
949
+ <wui-text variant="lg-regular" color="secondary">Payment Method</wui-text>
950
+
951
+ <wui-flex flexDirection="column" alignItems="flex-end" gap="1">
952
+ <wui-flex alignItems="center" gap="01">
953
+ <wui-text variant="lg-regular" color="primary">${i}</wui-text>
954
+ <wui-text variant="lg-regular" color="secondary">${o}</wui-text>
955
+ </wui-flex>
956
+
957
+ <wui-flex alignItems="center" gap="1">
958
+ <wui-text variant="md-regular" color="secondary">on</wui-text>
959
+ <wui-image
960
+ src=${G(D.getNetworkImage(t))}
961
+ size="xs"
962
+ ></wui-image>
963
+ <wui-text variant="md-regular" color="secondary">${t?.name}</wui-text>
964
+ </wui-flex>
965
+ </wui-flex>
966
+ </wui-flex>
967
+ `}renderWallet(){return I`
968
+ <wui-flex
969
+ alignItems="flex-start"
970
+ justifyContent="space-between"
971
+ .padding=${["3","0","3","0"]}
972
+ >
973
+ <wui-text variant="lg-regular" color="secondary"
974
+ >${this.selectedExchange?"Exchange":"Wallet"}</wui-text
975
+ >
976
+
977
+ ${this.renderWalletText()}
978
+ </wui-flex>
979
+ `}renderWalletText(){const{image:e}=this.getWalletProperties({namespace:this.namespace}),{address:t}=this.caipAddress?C.parseCaipAddress(this.caipAddress):{},i=this.selectedExchange?.name;return this.selectedExchange?I`
980
+ <wui-flex alignItems="center" justifyContent="flex-end" gap="1">
981
+ <wui-text variant="lg-regular" color="primary">${i}</wui-text>
982
+ <wui-image src=${G(this.selectedExchange.imageUrl)} size="mdl"></wui-image>
983
+ </wui-flex>
984
+ `:I`
985
+ <wui-flex alignItems="center" justifyContent="flex-end" gap="1">
986
+ <wui-text variant="lg-regular" color="primary">
987
+ ${K.getTruncateString({string:this.profileName||t||i||"",charsStart:this.profileName?16:4,charsEnd:this.profileName?0:6,truncate:this.profileName?"end":"middle"})}
988
+ </wui-text>
989
+
990
+ <wui-image src=${G(e)} size="mdl"></wui-image>
991
+ </wui-flex>
992
+ `}getStepsWithStatus(){return"failure"===this.quoteStatus||"timeout"===this.quoteStatus||"refund"===this.quoteStatus?gt.map((e=>({...e,status:"failed"}))):gt.map((e=>{const t=(vt[e.id]??[]).includes(this.quoteStatus)?"completed":"pending";return{...e,status:t}}))}renderStep({title:e,icon:t,status:i}){return I`
993
+ <wui-flex alignItems="center" gap="3">
994
+ <wui-flex justifyContent="center" alignItems="center" class="step-icon-container">
995
+ <wui-icon name=${t} color="default" size="mdl"></wui-icon>
996
+
997
+ <wui-flex alignItems="center" justifyContent="center" class=${Q({"step-icon-box":!0,success:"completed"===i})}>
998
+ ${this.renderStatusIndicator(i)}
999
+ </wui-flex>
1000
+ </wui-flex>
1001
+
1002
+ <wui-text variant="md-regular" color="primary">${e}</wui-text>
1003
+ </wui-flex>
1004
+ `}renderStatusIndicator(e){return"completed"===e?I`<wui-icon size="sm" color="success" name="checkmark"></wui-icon>`:"failed"===e?I`<wui-icon size="sm" color="error" name="close"></wui-icon>`:"pending"===e?I`<wui-loading-spinner color="accent-primary" size="sm"></wui-loading-spinner>`:null}startPolling(){this.pollingInterval||(this.fetchQuoteStatus(),this.pollingInterval=setInterval((()=>{this.fetchQuoteStatus()}),3e3))}stopPolling(){this.pollingInterval&&(clearInterval(this.pollingInterval),this.pollingInterval=null)}async fetchQuoteStatus(){const e=ct.state.requestId;if(!e||yt.includes(this.quoteStatus))this.stopPolling();else try{await ct.fetchQuoteStatus({requestId:e}),yt.includes(this.quoteStatus)&&this.stopPolling()}catch{this.stopPolling()}}initializeNamespace(){const e=r.state.activeChain;this.namespace=e,this.caipAddress=r.getAccountData(e)?.caipAddress,this.profileName=r.getAccountData(e)?.profileName??null,this.unsubscribe.push(r.subscribeChainProp("accountState",(e=>{this.caipAddress=e?.caipAddress,this.profileName=e?.profileName??null}),e))}getWalletProperties({namespace:e}){if(!e)return{name:void 0,image:void 0};const t=this.activeConnectorIds[e];if(!t)return{name:void 0,image:void 0};const i=l.getConnector({id:t,namespace:e});if(!i)return{name:void 0,image:void 0};const o=D.getConnectorImage(i);return{name:i.name,image:o}}};kt.styles=ft,bt([H()],kt.prototype,"paymentAsset",void 0),bt([H()],kt.prototype,"quoteStatus",void 0),bt([H()],kt.prototype,"quote",void 0),bt([H()],kt.prototype,"amount",void 0),bt([H()],kt.prototype,"namespace",void 0),bt([H()],kt.prototype,"caipAddress",void 0),bt([H()],kt.prototype,"profileName",void 0),bt([H()],kt.prototype,"activeConnectorIds",void 0),bt([H()],kt.prototype,"selectedExchange",void 0),kt=bt([M("w3m-pay-loading-view")],kt);var xt=T`
1005
+ button {
1006
+ display: flex;
1007
+ align-items: center;
1008
+ height: 40px;
1009
+ padding: ${({spacing:e})=>e[2]};
1010
+ border-radius: ${({borderRadius:e})=>e[4]};
1011
+ column-gap: ${({spacing:e})=>e[1]};
1012
+ background-color: transparent;
1013
+ transition: background-color ${({durations:e})=>e.lg}
1014
+ ${({easings:e})=>e["ease-out-power-2"]};
1015
+ will-change: background-color;
1016
+ }
1017
+
1018
+ wui-image,
1019
+ .icon-box {
1020
+ width: ${({spacing:e})=>e[6]};
1021
+ height: ${({spacing:e})=>e[6]};
1022
+ border-radius: ${({borderRadius:e})=>e[4]};
1023
+ }
1024
+
1025
+ wui-text {
1026
+ flex: 1;
1027
+ }
1028
+
1029
+ .icon-box {
1030
+ position: relative;
1031
+ }
1032
+
1033
+ .icon-box[data-active='true'] {
1034
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
1035
+ }
1036
+
1037
+ .circle {
1038
+ position: absolute;
1039
+ left: 16px;
1040
+ top: 15px;
1041
+ width: 8px;
1042
+ height: 8px;
1043
+ background-color: ${({tokens:e})=>e.core.textSuccess};
1044
+ box-shadow: 0 0 0 2px ${({tokens:e})=>e.theme.foregroundPrimary};
1045
+ border-radius: 50%;
1046
+ }
1047
+
1048
+ /* -- Hover & Active states ----------------------------------------------------------- */
1049
+ @media (hover: hover) {
1050
+ button:hover:enabled,
1051
+ button:active:enabled {
1052
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
1053
+ }
1054
+ }
1055
+ `,Tt=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let At=class extends S{constructor(){super(...arguments),this.address="",this.profileName="",this.alt="",this.imageSrc="",this.icon=void 0,this.iconSize="md",this.enableGreenCircle=!0,this.loading=!1,this.charsStart=4,this.charsEnd=6}render(){return I`
1056
+ <button>
1057
+ ${this.leftImageTemplate()} ${this.textTemplate()} ${this.rightImageTemplate()}
1058
+ </button>
1059
+ `}leftImageTemplate(){const e=this.icon?I`<wui-icon
1060
+ size=${G(this.iconSize)}
1061
+ color="default"
1062
+ name=${this.icon}
1063
+ class="icon"
1064
+ ></wui-icon>`:I`<wui-image src=${this.imageSrc} alt=${this.alt}></wui-image>`;return I`
1065
+ <wui-flex
1066
+ alignItems="center"
1067
+ justifyContent="center"
1068
+ class="icon-box"
1069
+ data-active=${Boolean(this.icon)}
1070
+ >
1071
+ ${e}
1072
+ ${this.enableGreenCircle?I`<wui-flex class="circle"></wui-flex>`:null}
1073
+ </wui-flex>
1074
+ `}textTemplate(){return I`
1075
+ <wui-text variant="lg-regular" color="primary">
1076
+ ${K.getTruncateString({string:this.profileName||this.address,charsStart:this.profileName?16:this.charsStart,charsEnd:this.profileName?0:this.charsEnd,truncate:this.profileName?"end":"middle"})}
1077
+ </wui-text>
1078
+ `}rightImageTemplate(){return I`<wui-icon name="chevronBottom" size="sm" color="default"></wui-icon>`}};At.styles=[A,E,xt],Tt([V()],At.prototype,"address",void 0),Tt([V()],At.prototype,"profileName",void 0),Tt([V()],At.prototype,"alt",void 0),Tt([V()],At.prototype,"imageSrc",void 0),Tt([V()],At.prototype,"icon",void 0),Tt([V()],At.prototype,"iconSize",void 0),Tt([V({type:Boolean})],At.prototype,"enableGreenCircle",void 0),Tt([V({type:Boolean})],At.prototype,"loading",void 0),Tt([V({type:Number})],At.prototype,"charsStart",void 0),Tt([V({type:Number})],At.prototype,"charsEnd",void 0),At=Tt([M("wui-wallet-switch")],At);var St=B`
1079
+ :host {
1080
+ display: block;
1081
+ }
1082
+ `,It=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let Et=class extends S{render(){return I`
1083
+ <wui-flex flexDirection="column" gap="4">
1084
+ <wui-flex alignItems="center" justifyContent="space-between">
1085
+ <wui-text variant="md-regular" color="secondary">Pay</wui-text>
1086
+ <wui-shimmer width="60px" height="16px" borderRadius="4xs" variant="light"></wui-shimmer>
1087
+ </wui-flex>
1088
+
1089
+ <wui-flex alignItems="center" justifyContent="space-between">
1090
+ <wui-text variant="md-regular" color="secondary">Network Fee</wui-text>
1091
+
1092
+ <wui-flex flexDirection="column" alignItems="flex-end" gap="2">
1093
+ <wui-shimmer
1094
+ width="75px"
1095
+ height="16px"
1096
+ borderRadius="4xs"
1097
+ variant="light"
1098
+ ></wui-shimmer>
1099
+
1100
+ <wui-flex alignItems="center" gap="01">
1101
+ <wui-shimmer width="14px" height="14px" rounded variant="light"></wui-shimmer>
1102
+ <wui-shimmer
1103
+ width="49px"
1104
+ height="14px"
1105
+ borderRadius="4xs"
1106
+ variant="light"
1107
+ ></wui-shimmer>
1108
+ </wui-flex>
1109
+ </wui-flex>
1110
+ </wui-flex>
1111
+
1112
+ <wui-flex alignItems="center" justifyContent="space-between">
1113
+ <wui-text variant="md-regular" color="secondary">Service Fee</wui-text>
1114
+ <wui-shimmer width="75px" height="16px" borderRadius="4xs" variant="light"></wui-shimmer>
1115
+ </wui-flex>
1116
+ </wui-flex>
1117
+ `}};Et.styles=[St],Et=It([M("w3m-pay-fees-skeleton")],Et);var Pt=T`
1118
+ :host {
1119
+ display: block;
1120
+ }
1121
+
1122
+ wui-image {
1123
+ border-radius: ${({borderRadius:e})=>e.round};
1124
+ }
1125
+ `,Ct=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let $t=class extends S{constructor(){super(),this.unsubscribe=[],this.quote=ct.state.quote,this.unsubscribe.push(ct.subscribeKey("quote",(e=>this.quote=e)))}disconnectedCallback(){this.unsubscribe.forEach((e=>e()))}render(){const t=e.formatNumber(this.quote?.origin.amount||"0",{decimals:this.quote?.origin.currency.metadata.decimals??0,round:6}).toString();return I`
1126
+ <wui-flex flexDirection="column" gap="4">
1127
+ <wui-flex alignItems="center" justifyContent="space-between">
1128
+ <wui-text variant="md-regular" color="secondary">Pay</wui-text>
1129
+ <wui-text variant="md-regular" color="primary">
1130
+ ${t} ${this.quote?.origin.currency.metadata.symbol||"Unknown"}
1131
+ </wui-text>
1132
+ </wui-flex>
1133
+
1134
+ ${this.quote&&this.quote.fees.length>0?this.quote.fees.map((e=>this.renderFee(e))):null}
1135
+ </wui-flex>
1136
+ `}renderFee(t){const i="network"===t.id,o=e.formatNumber(t.amount||"0",{decimals:t.currency.metadata.decimals??0,round:6}).toString();if(i){const e=r.getAllRequestedCaipNetworks().find((e=>O.isLowerCaseMatch(e.caipNetworkId,t.currency.network)));return I`
1137
+ <wui-flex alignItems="center" justifyContent="space-between">
1138
+ <wui-text variant="md-regular" color="secondary">${t.label}</wui-text>
1139
+
1140
+ <wui-flex flexDirection="column" alignItems="flex-end" gap="2">
1141
+ <wui-text variant="md-regular" color="primary">
1142
+ ${o} ${t.currency.metadata.symbol||"Unknown"}
1143
+ </wui-text>
1144
+
1145
+ <wui-flex alignItems="center" gap="01">
1146
+ <wui-image
1147
+ src=${G(D.getNetworkImage(e))}
1148
+ size="xs"
1149
+ ></wui-image>
1150
+ <wui-text variant="sm-regular" color="secondary">
1151
+ ${e?.name||"Unknown"}
1152
+ </wui-text>
1153
+ </wui-flex>
1154
+ </wui-flex>
1155
+ </wui-flex>
1156
+ `}return I`
1157
+ <wui-flex alignItems="center" justifyContent="space-between">
1158
+ <wui-text variant="md-regular" color="secondary">${t.label}</wui-text>
1159
+ <wui-text variant="md-regular" color="primary">
1160
+ ${o} ${t.currency.metadata.symbol||"Unknown"}
1161
+ </wui-text>
1162
+ </wui-flex>
1163
+ `}};$t.styles=[Pt],Ct([H()],$t.prototype,"quote",void 0),$t=Ct([M("w3m-pay-fees")],$t);var Nt=T`
1164
+ :host {
1165
+ display: block;
1166
+ width: 100%;
1167
+ }
1168
+
1169
+ .disabled-container {
1170
+ padding: ${({spacing:e})=>e[2]};
1171
+ min-height: 168px;
1172
+ }
1173
+
1174
+ wui-icon {
1175
+ width: ${({spacing:e})=>e[8]};
1176
+ height: ${({spacing:e})=>e[8]};
1177
+ }
1178
+
1179
+ wui-flex > wui-text {
1180
+ max-width: 273px;
1181
+ }
1182
+ `,Rt=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let Ot=class extends S{constructor(){super(),this.unsubscribe=[],this.selectedExchange=ct.state.selectedExchange,this.unsubscribe.push(ct.subscribeKey("selectedExchange",(e=>this.selectedExchange=e)))}disconnectedCallback(){this.unsubscribe.forEach((e=>e()))}render(){const e=Boolean(this.selectedExchange);return I`
1183
+ <wui-flex
1184
+ flexDirection="column"
1185
+ alignItems="center"
1186
+ justifyContent="center"
1187
+ gap="3"
1188
+ class="disabled-container"
1189
+ >
1190
+ <wui-icon name="coins" color="default" size="inherit"></wui-icon>
1191
+
1192
+ <wui-text variant="md-regular" color="primary" align="center">
1193
+ You don't have enough funds to complete this transaction
1194
+ </wui-text>
1195
+
1196
+ ${e?null:I`<wui-button
1197
+ size="md"
1198
+ variant="neutral-secondary"
1199
+ @click=${this.dispatchConnectOtherWalletEvent.bind(this)}
1200
+ >Connect other wallet</wui-button
1201
+ >`}
1202
+ </wui-flex>
1203
+ `}dispatchConnectOtherWalletEvent(){this.dispatchEvent(new CustomEvent("connectOtherWallet",{detail:!0,bubbles:!0,composed:!0}))}};Ot.styles=[Nt],Rt([V({type:Array})],Ot.prototype,"selectedExchange",void 0),Ot=Rt([M("w3m-pay-options-empty")],Ot);var _t=T`
1204
+ :host {
1205
+ display: block;
1206
+ width: 100%;
1207
+ }
1208
+
1209
+ .pay-options-container {
1210
+ max-height: 196px;
1211
+ overflow-y: auto;
1212
+ overflow-x: hidden;
1213
+ scrollbar-width: none;
1214
+ }
1215
+
1216
+ .pay-options-container::-webkit-scrollbar {
1217
+ display: none;
1218
+ }
1219
+
1220
+ .pay-option-container {
1221
+ border-radius: ${({borderRadius:e})=>e[4]};
1222
+ padding: ${({spacing:e})=>e[3]};
1223
+ min-height: 60px;
1224
+ }
1225
+
1226
+ .token-images-container {
1227
+ position: relative;
1228
+ justify-content: center;
1229
+ align-items: center;
1230
+ }
1231
+
1232
+ .chain-image {
1233
+ position: absolute;
1234
+ bottom: -3px;
1235
+ right: -5px;
1236
+ border: 2px solid ${({tokens:e})=>e.theme.foregroundSecondary};
1237
+ }
1238
+ `,Ut=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let Dt=class extends S{render(){return I`
1239
+ <wui-flex flexDirection="column" gap="2" class="pay-options-container">
1240
+ ${this.renderOptionEntry()} ${this.renderOptionEntry()} ${this.renderOptionEntry()}
1241
+ </wui-flex>
1242
+ `}renderOptionEntry(){return I`
1243
+ <wui-flex
1244
+ alignItems="center"
1245
+ justifyContent="space-between"
1246
+ gap="2"
1247
+ class="pay-option-container"
1248
+ >
1249
+ <wui-flex alignItems="center" gap="2">
1250
+ <wui-flex class="token-images-container">
1251
+ <wui-shimmer
1252
+ width="32px"
1253
+ height="32px"
1254
+ rounded
1255
+ variant="light"
1256
+ class="token-image"
1257
+ ></wui-shimmer>
1258
+ <wui-shimmer
1259
+ width="16px"
1260
+ height="16px"
1261
+ rounded
1262
+ variant="light"
1263
+ class="chain-image"
1264
+ ></wui-shimmer>
1265
+ </wui-flex>
1266
+
1267
+ <wui-flex flexDirection="column" gap="1">
1268
+ <wui-shimmer
1269
+ width="74px"
1270
+ height="16px"
1271
+ borderRadius="4xs"
1272
+ variant="light"
1273
+ ></wui-shimmer>
1274
+ <wui-shimmer
1275
+ width="46px"
1276
+ height="14px"
1277
+ borderRadius="4xs"
1278
+ variant="light"
1279
+ ></wui-shimmer>
1280
+ </wui-flex>
1281
+ </wui-flex>
1282
+ </wui-flex>
1283
+ `}};Dt.styles=[_t],Dt=Ut([M("w3m-pay-options-skeleton")],Dt);var Lt=T`
1284
+ :host {
1285
+ display: block;
1286
+ width: 100%;
1287
+ }
1288
+
1289
+ .pay-options-container {
1290
+ max-height: 196px;
1291
+ overflow-y: auto;
1292
+ overflow-x: hidden;
1293
+ scrollbar-width: none;
1294
+ mask-image: var(--options-mask-image);
1295
+ -webkit-mask-image: var(--options-mask-image);
1296
+ }
1297
+
1298
+ .pay-options-container::-webkit-scrollbar {
1299
+ display: none;
1300
+ }
1301
+
1302
+ .pay-option-container {
1303
+ cursor: pointer;
1304
+ border-radius: ${({borderRadius:e})=>e[4]};
1305
+ padding: ${({spacing:e})=>e[3]};
1306
+ transition: background-color ${({durations:e})=>e.lg}
1307
+ ${({easings:e})=>e["ease-out-power-1"]};
1308
+ will-change: background-color;
1309
+ }
1310
+
1311
+ .token-images-container {
1312
+ position: relative;
1313
+ justify-content: center;
1314
+ align-items: center;
1315
+ }
1316
+
1317
+ .token-image {
1318
+ border-radius: ${({borderRadius:e})=>e.round};
1319
+ width: 32px;
1320
+ height: 32px;
1321
+ }
1322
+
1323
+ .chain-image {
1324
+ position: absolute;
1325
+ width: 16px;
1326
+ height: 16px;
1327
+ bottom: -3px;
1328
+ right: -5px;
1329
+ border-radius: ${({borderRadius:e})=>e.round};
1330
+ border: 2px solid ${({tokens:e})=>e.theme.backgroundPrimary};
1331
+ }
1332
+
1333
+ @media (hover: hover) and (pointer: fine) {
1334
+ .pay-option-container:hover {
1335
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
1336
+ }
1337
+ }
1338
+ `,Bt=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let zt=class extends S{constructor(){super(),this.unsubscribe=[],this.options=[],this.selectedPaymentAsset=null}disconnectedCallback(){this.unsubscribe.forEach((e=>e())),this.resizeObserver?.disconnect();const e=this.shadowRoot?.querySelector(".pay-options-container");e?.removeEventListener("scroll",this.handleOptionsListScroll.bind(this))}firstUpdated(){const e=this.shadowRoot?.querySelector(".pay-options-container");e&&(requestAnimationFrame(this.handleOptionsListScroll.bind(this)),e?.addEventListener("scroll",this.handleOptionsListScroll.bind(this)),this.resizeObserver=new ResizeObserver((()=>{this.handleOptionsListScroll()})),this.resizeObserver?.observe(e),this.handleOptionsListScroll())}render(){return I`
1339
+ <wui-flex flexDirection="column" gap="2" class="pay-options-container">
1340
+ ${this.options.map((e=>this.payOptionTemplate(e)))}
1341
+ </wui-flex>
1342
+ `}payOptionTemplate(t){const{network:i,metadata:o,asset:a,amount:n="0"}=t,s=r.getAllRequestedCaipNetworks().find((e=>e.caipNetworkId===i)),c=`${i}:${a}`===`${this.selectedPaymentAsset?.network}:${this.selectedPaymentAsset?.asset}`,l=e.bigNumber(n,{safe:!0}),d=l.gt(0);return I`
1343
+ <wui-flex
1344
+ alignItems="center"
1345
+ justifyContent="space-between"
1346
+ gap="2"
1347
+ @click=${()=>this.onSelect?.(t)}
1348
+ class="pay-option-container"
1349
+ >
1350
+ <wui-flex alignItems="center" gap="2">
1351
+ <wui-flex class="token-images-container">
1352
+ <wui-image
1353
+ src=${G(o.logoURI)}
1354
+ class="token-image"
1355
+ size="3xl"
1356
+ ></wui-image>
1357
+ <wui-image
1358
+ src=${G(D.getNetworkImage(s))}
1359
+ class="chain-image"
1360
+ size="md"
1361
+ ></wui-image>
1362
+ </wui-flex>
1363
+
1364
+ <wui-flex flexDirection="column" gap="1">
1365
+ <wui-text variant="lg-regular" color="primary">${o.symbol}</wui-text>
1366
+ ${d?I`<wui-text variant="sm-regular" color="secondary">
1367
+ ${l.round(6).toString()} ${o.symbol}
1368
+ </wui-text>`:null}
1369
+ </wui-flex>
1370
+ </wui-flex>
1371
+
1372
+ ${c?I`<wui-icon name="checkmark" size="md" color="success"></wui-icon>`:null}
1373
+ </wui-flex>
1374
+ `}handleOptionsListScroll(){const e=this.shadowRoot?.querySelector(".pay-options-container");if(!e)return;e.scrollHeight>300?(e.style.setProperty("--options-mask-image","linear-gradient(\n to bottom,\n rgba(0, 0, 0, calc(1 - var(--options-scroll--top-opacity))) 0px,\n rgba(200, 200, 200, calc(1 - var(--options-scroll--top-opacity))) 1px,\n black 50px,\n black calc(100% - 50px),\n rgba(155, 155, 155, calc(1 - var(--options-scroll--bottom-opacity))) calc(100% - 1px),\n rgba(0, 0, 0, calc(1 - var(--options-scroll--bottom-opacity))) 100%\n )"),e.style.setProperty("--options-scroll--top-opacity",re.interpolate([0,50],[0,1],e.scrollTop).toString()),e.style.setProperty("--options-scroll--bottom-opacity",re.interpolate([0,50],[0,1],e.scrollHeight-e.scrollTop-e.offsetHeight).toString())):(e.style.setProperty("--options-mask-image","none"),e.style.setProperty("--options-scroll--top-opacity","0"),e.style.setProperty("--options-scroll--bottom-opacity","0"))}};zt.styles=[Lt],Bt([V({type:Array})],zt.prototype,"options",void 0),Bt([V()],zt.prototype,"selectedPaymentAsset",void 0),Bt([V()],zt.prototype,"onSelect",void 0),zt=Bt([M("w3m-pay-options")],zt);var Wt=T`
1375
+ .payment-methods-container {
1376
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
1377
+ border-top-right-radius: ${({borderRadius:e})=>e[5]};
1378
+ border-top-left-radius: ${({borderRadius:e})=>e[5]};
1379
+ }
1380
+
1381
+ .pay-options-container {
1382
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
1383
+ border-radius: ${({borderRadius:e})=>e[5]};
1384
+ padding: ${({spacing:e})=>e[1]};
1385
+ }
1386
+
1387
+ w3m-tooltip-trigger {
1388
+ display: flex;
1389
+ align-items: center;
1390
+ justify-content: center;
1391
+ max-width: fit-content;
1392
+ }
1393
+
1394
+ wui-image {
1395
+ border-radius: ${({borderRadius:e})=>e.round};
1396
+ }
1397
+
1398
+ w3m-pay-options.disabled {
1399
+ opacity: 0.5;
1400
+ pointer-events: none;
1401
+ }
1402
+ `,jt=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const Ft={eip155:{icon:"ethereum",label:"EVM"},solana:{icon:"solana",label:"Solana"},bip122:{icon:"bitcoin",label:"Bitcoin"},ton:{icon:"ton",label:"Ton"}};let qt=class extends S{constructor(){super(),this.unsubscribe=[],this.profileName=null,this.paymentAsset=ct.state.paymentAsset,this.namespace=void 0,this.caipAddress=void 0,this.amount=ct.state.amount,this.recipient=ct.state.recipient,this.activeConnectorIds=l.state.activeConnectorIds,this.selectedPaymentAsset=ct.state.selectedPaymentAsset,this.selectedExchange=ct.state.selectedExchange,this.isFetchingQuote=ct.state.isFetchingQuote,this.quoteError=ct.state.quoteError,this.quote=ct.state.quote,this.isFetchingTokenBalances=ct.state.isFetchingTokenBalances,this.tokenBalances=ct.state.tokenBalances,this.isPaymentInProgress=ct.state.isPaymentInProgress,this.exchangeUrlForQuote=ct.state.exchangeUrlForQuote,this.completedTransactionsCount=0,this.unsubscribe.push(ct.subscribeKey("paymentAsset",(e=>this.paymentAsset=e))),this.unsubscribe.push(ct.subscribeKey("tokenBalances",(e=>this.onTokenBalancesChanged(e)))),this.unsubscribe.push(ct.subscribeKey("isFetchingTokenBalances",(e=>this.isFetchingTokenBalances=e))),this.unsubscribe.push(l.subscribeKey("activeConnectorIds",(e=>this.activeConnectorIds=e))),this.unsubscribe.push(ct.subscribeKey("selectedPaymentAsset",(e=>this.selectedPaymentAsset=e))),this.unsubscribe.push(ct.subscribeKey("isFetchingQuote",(e=>this.isFetchingQuote=e))),this.unsubscribe.push(ct.subscribeKey("quoteError",(e=>this.quoteError=e))),this.unsubscribe.push(ct.subscribeKey("quote",(e=>this.quote=e))),this.unsubscribe.push(ct.subscribeKey("amount",(e=>this.amount=e))),this.unsubscribe.push(ct.subscribeKey("recipient",(e=>this.recipient=e))),this.unsubscribe.push(ct.subscribeKey("isPaymentInProgress",(e=>this.isPaymentInProgress=e))),this.unsubscribe.push(ct.subscribeKey("selectedExchange",(e=>this.selectedExchange=e))),this.unsubscribe.push(ct.subscribeKey("exchangeUrlForQuote",(e=>this.exchangeUrlForQuote=e))),this.resetQuoteState(),this.initializeNamespace(),this.fetchTokens()}disconnectedCallback(){super.disconnectedCallback(),this.resetAssetsState(),this.unsubscribe.forEach((e=>e()))}updated(e){super.updated(e);e.has("selectedPaymentAsset")&&this.fetchQuote()}render(){return I`
1403
+ <wui-flex flexDirection="column">
1404
+ ${this.profileTemplate()}
1405
+
1406
+ <wui-flex
1407
+ flexDirection="column"
1408
+ gap="4"
1409
+ class="payment-methods-container"
1410
+ .padding=${["4","4","5","4"]}
1411
+ >
1412
+ ${this.paymentOptionsViewTemplate()} ${this.amountWithFeeTemplate()}
1413
+
1414
+ <wui-flex
1415
+ alignItems="center"
1416
+ justifyContent="space-between"
1417
+ .padding=${["1","0","1","0"]}
1418
+ >
1419
+ <wui-separator></wui-separator>
1420
+ </wui-flex>
1421
+
1422
+ ${this.paymentActionsTemplate()}
1423
+ </wui-flex>
1424
+ </wui-flex>
1425
+ `}profileTemplate(){if(this.selectedExchange){const t=e.formatNumber(this.quote?.origin.amount,{decimals:this.quote?.origin.currency.metadata.decimals??0}).toString();return I`
1426
+ <wui-flex
1427
+ .padding=${["4","3","4","3"]}
1428
+ alignItems="center"
1429
+ justifyContent="space-between"
1430
+ gap="2"
1431
+ >
1432
+ <wui-text variant="lg-regular" color="secondary">Paying with</wui-text>
1433
+
1434
+ ${this.quote?I`<wui-text variant="lg-regular" color="primary">
1435
+ ${e.bigNumber(t,{safe:!0}).round(6).toString()}
1436
+ ${this.quote.origin.currency.metadata.symbol}
1437
+ </wui-text>`:I`<wui-shimmer width="80px" height="18px" variant="light"></wui-shimmer>`}
1438
+ </wui-flex>
1439
+ `}const t=s.getPlainAddress(this.caipAddress)??"",{name:i,image:o}=this.getWalletProperties({namespace:this.namespace}),{icon:a,label:n}=Ft[this.namespace]??{};return I`
1440
+ <wui-flex
1441
+ .padding=${["4","3","4","3"]}
1442
+ alignItems="center"
1443
+ justifyContent="space-between"
1444
+ gap="2"
1445
+ >
1446
+ <wui-wallet-switch
1447
+ profileName=${G(this.profileName)}
1448
+ address=${G(t)}
1449
+ imageSrc=${G(o)}
1450
+ alt=${G(i)}
1451
+ @click=${this.onConnectOtherWallet.bind(this)}
1452
+ data-testid="wui-wallet-switch"
1453
+ ></wui-wallet-switch>
1454
+
1455
+ <wui-wallet-switch
1456
+ profileName=${G(n)}
1457
+ address=${G(t)}
1458
+ icon=${G(a)}
1459
+ iconSize="xs"
1460
+ .enableGreenCircle=${!1}
1461
+ alt=${G(n)}
1462
+ @click=${this.onConnectOtherWallet.bind(this)}
1463
+ data-testid="wui-wallet-switch"
1464
+ ></wui-wallet-switch>
1465
+ </wui-flex>
1466
+ `}initializeNamespace(){const e=r.state.activeChain;this.namespace=e,this.caipAddress=r.getAccountData(e)?.caipAddress,this.profileName=r.getAccountData(e)?.profileName??null,this.unsubscribe.push(r.subscribeChainProp("accountState",(e=>this.onAccountStateChanged(e)),e))}async fetchTokens(){if(this.namespace){let e;if(this.caipAddress){const{chainId:t,chainNamespace:i}=C.parseCaipAddress(this.caipAddress),o=`${i}:${t}`;e=r.getAllRequestedCaipNetworks().find((e=>e.caipNetworkId===o))}await ct.fetchTokens({caipAddress:this.caipAddress,caipNetwork:e,namespace:this.namespace})}}fetchQuote(){if(this.amount&&this.recipient&&this.selectedPaymentAsset&&this.paymentAsset){const{address:e}=this.caipAddress?C.parseCaipAddress(this.caipAddress):{};ct.fetchQuote({amount:this.amount.toString(),address:e,sourceToken:this.selectedPaymentAsset,toToken:this.paymentAsset,recipient:this.recipient})}}getWalletProperties({namespace:e}){if(!e)return{name:void 0,image:void 0};const t=this.activeConnectorIds[e];if(!t)return{name:void 0,image:void 0};const i=l.getConnector({id:t,namespace:e});if(!i)return{name:void 0,image:void 0};const o=D.getConnectorImage(i);return{name:i.name,image:o}}paymentOptionsViewTemplate(){return I`
1467
+ <wui-flex flexDirection="column" gap="2">
1468
+ <wui-text variant="sm-regular" color="secondary">CHOOSE PAYMENT OPTION</wui-text>
1469
+ <wui-flex class="pay-options-container">${this.paymentOptionsTemplate()}</wui-flex>
1470
+ </wui-flex>
1471
+ `}paymentOptionsTemplate(){const e=this.getPaymentAssetFromTokenBalances();if(this.isFetchingTokenBalances)return I`<w3m-pay-options-skeleton></w3m-pay-options-skeleton>`;if(0===e.length)return I`<w3m-pay-options-empty
1472
+ @connectOtherWallet=${this.onConnectOtherWallet.bind(this)}
1473
+ ></w3m-pay-options-empty>`;const t={disabled:this.isFetchingQuote};return I`<w3m-pay-options
1474
+ class=${Q(t)}
1475
+ .options=${e}
1476
+ .selectedPaymentAsset=${G(this.selectedPaymentAsset)}
1477
+ .onSelect=${this.onSelectedPaymentAssetChanged.bind(this)}
1478
+ ></w3m-pay-options>`}amountWithFeeTemplate(){return this.isFetchingQuote||!this.selectedPaymentAsset||this.quoteError?I`<w3m-pay-fees-skeleton></w3m-pay-fees-skeleton>`:I`<w3m-pay-fees></w3m-pay-fees>`}paymentActionsTemplate(){const t=this.isFetchingQuote||this.isFetchingTokenBalances,i=this.isFetchingQuote||this.isFetchingTokenBalances||!this.selectedPaymentAsset||Boolean(this.quoteError),o=e.formatNumber(this.quote?.origin.amount??0,{decimals:this.quote?.origin.currency.metadata.decimals??0}).toString();return this.selectedExchange?t||i?I`
1479
+ <wui-shimmer width="100%" height="48px" variant="light" ?rounded=${!0}></wui-shimmer>
1480
+ `:I`<wui-button
1481
+ size="lg"
1482
+ fullWidth
1483
+ variant="accent-secondary"
1484
+ @click=${this.onPayWithExchange.bind(this)}
1485
+ >
1486
+ ${`Continue in ${this.selectedExchange.name}`}
1487
+
1488
+ <wui-icon name="arrowRight" color="inherit" size="sm" slot="iconRight"></wui-icon>
1489
+ </wui-button>`:I`
1490
+ <wui-flex alignItems="center" justifyContent="space-between">
1491
+ <wui-flex flexDirection="column" gap="1">
1492
+ <wui-text variant="md-regular" color="secondary">Order Total</wui-text>
1493
+
1494
+ ${t||i?I`<wui-shimmer width="58px" height="32px" variant="light"></wui-shimmer>`:I`<wui-flex alignItems="center" gap="01">
1495
+ <wui-text variant="h4-regular" color="primary">${it(o)}</wui-text>
1496
+
1497
+ <wui-text variant="lg-regular" color="secondary">
1498
+ ${this.quote?.origin.currency.metadata.symbol||"Unknown"}
1499
+ </wui-text>
1500
+ </wui-flex>`}
1501
+ </wui-flex>
1502
+
1503
+ ${this.actionButtonTemplate({isLoading:t,isDisabled:i})}
1504
+ </wui-flex>
1505
+ `}actionButtonTemplate(e){const t=Me(this.quote),{isLoading:i,isDisabled:o}=e;let a="Pay";return t.length>1&&0===this.completedTransactionsCount&&(a="Approve"),I`
1506
+ <wui-button
1507
+ size="lg"
1508
+ variant="accent-primary"
1509
+ ?loading=${i||this.isPaymentInProgress}
1510
+ ?disabled=${o||this.isPaymentInProgress}
1511
+ @click=${()=>{t.length>0?this.onSendTransactions():this.onTransfer()}}
1512
+ >
1513
+ ${a}
1514
+ ${i?null:I`<wui-icon
1515
+ name="arrowRight"
1516
+ color="inherit"
1517
+ size="sm"
1518
+ slot="iconRight"
1519
+ ></wui-icon>`}
1520
+ </wui-button>
1521
+ `}getPaymentAssetFromTokenBalances(){if(!this.namespace)return[];return(this.tokenBalances[this.namespace]??[]).map((e=>{try{return function(e){const t=r.getAllRequestedCaipNetworks().find((t=>t.caipNetworkId===e.chainId));let i=e.address;if(!t)throw new Error(`Target network not found for balance chainId "${e.chainId}"`);if(O.isLowerCaseMatch(e.symbol,t.nativeCurrency.symbol))i="native";else if(s.isCaipAddress(i)){const{address:e}=C.parseCaipAddress(i);i=e}else if(!i)throw new Error(`Balance address not found for balance symbol "${e.symbol}"`);return{network:t.caipNetworkId,asset:i,metadata:{name:e.name,symbol:e.symbol,decimals:Number(e.quantity.decimals),logoURI:e.iconUrl},amount:e.quantity.numeric}}(e)}catch(e){return null}})).filter((e=>Boolean(e))).filter((e=>{const{chainId:t}=C.parseCaipNetworkId(e.network),{chainId:i}=C.parseCaipNetworkId(this.paymentAsset.network);return!!O.isLowerCaseMatch(e.asset,this.paymentAsset.asset)||(!this.selectedExchange||!O.isLowerCaseMatch(t.toString(),i.toString()))}))}onTokenBalancesChanged(e){this.tokenBalances=e;const[t]=this.getPaymentAssetFromTokenBalances();t&&ct.setSelectedPaymentAsset(t)}async onConnectOtherWallet(){await l.connect(),await k.open({view:"PayQuote"})}onAccountStateChanged(e){const{address:t}=this.caipAddress?C.parseCaipAddress(this.caipAddress):{};if(this.caipAddress=e?.caipAddress,this.profileName=e?.profileName??null,t){const{address:e}=this.caipAddress?C.parseCaipAddress(this.caipAddress):{};e?O.isLowerCaseMatch(e,t)||(this.resetAssetsState(),this.resetQuoteState(),this.fetchTokens()):k.close()}}onSelectedPaymentAssetChanged(e){this.isFetchingQuote||ct.setSelectedPaymentAsset(e)}async onTransfer(){const t=qe(this.quote);if(t){if(!O.isLowerCaseMatch(this.selectedPaymentAsset?.asset,t.deposit.currency))throw new Error("Quote asset is not the same as the selected payment asset");const i=this.selectedPaymentAsset?.amount??"0",o=e.formatNumber(t.deposit.amount,{decimals:this.selectedPaymentAsset?.metadata.decimals??0}).toString();if(!e.bigNumber(i).gte(o))return void u.showError("Insufficient funds");if(this.quote&&this.selectedPaymentAsset&&this.caipAddress&&this.namespace){const{address:e}=C.parseCaipAddress(this.caipAddress);await ct.onTransfer({chainNamespace:this.namespace,fromAddress:e,toAddress:t.deposit.receiver,amount:o,paymentAsset:this.selectedPaymentAsset}),ct.setRequestId(t.requestId),p.push("PayLoading")}}}async onSendTransactions(){const t=this.selectedPaymentAsset?.amount??"0",i=e.formatNumber(this.quote?.origin.amount??0,{decimals:this.selectedPaymentAsset?.metadata.decimals??0}).toString();if(!e.bigNumber(t).gte(i))return void u.showError("Insufficient funds");const o=Me(this.quote),[a]=Me(this.quote,this.completedTransactionsCount);if(a&&this.namespace){await ct.onSendTransaction({namespace:this.namespace,transactionStep:a}),this.completedTransactionsCount+=1;this.completedTransactionsCount===o.length&&(ct.setRequestId(a.requestId),p.push("PayLoading"))}}onPayWithExchange(){if(this.exchangeUrlForQuote){const e=s.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!e)throw new Error("Could not create popup window");e.location.href=this.exchangeUrlForQuote;const t=qe(this.quote);t&&ct.setRequestId(t.requestId),ct.initiatePayment(),p.push("PayLoading")}}resetAssetsState(){ct.setSelectedPaymentAsset(null)}resetQuoteState(){ct.resetQuoteState()}};qt.styles=Wt,jt([H()],qt.prototype,"profileName",void 0),jt([H()],qt.prototype,"paymentAsset",void 0),jt([H()],qt.prototype,"namespace",void 0),jt([H()],qt.prototype,"caipAddress",void 0),jt([H()],qt.prototype,"amount",void 0),jt([H()],qt.prototype,"recipient",void 0),jt([H()],qt.prototype,"activeConnectorIds",void 0),jt([H()],qt.prototype,"selectedPaymentAsset",void 0),jt([H()],qt.prototype,"selectedExchange",void 0),jt([H()],qt.prototype,"isFetchingQuote",void 0),jt([H()],qt.prototype,"quoteError",void 0),jt([H()],qt.prototype,"quote",void 0),jt([H()],qt.prototype,"isFetchingTokenBalances",void 0),jt([H()],qt.prototype,"tokenBalances",void 0),jt([H()],qt.prototype,"isPaymentInProgress",void 0),jt([H()],qt.prototype,"exchangeUrlForQuote",void 0),jt([H()],qt.prototype,"completedTransactionsCount",void 0),qt=jt([M("w3m-pay-quote-view")],qt);var Mt=T`
1522
+ wui-image {
1523
+ border-radius: ${({borderRadius:e})=>e.round};
1524
+ }
1525
+
1526
+ .transfers-badge {
1527
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
1528
+ border: 1px solid ${({tokens:e})=>e.theme.foregroundSecondary};
1529
+ border-radius: ${({borderRadius:e})=>e[4]};
1530
+ }
1531
+ `,Vt=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let Gt=class extends S{constructor(){super(),this.unsubscribe=[],this.paymentAsset=ct.state.paymentAsset,this.amount=ct.state.amount,this.unsubscribe.push(ct.subscribeKey("paymentAsset",(e=>{this.paymentAsset=e})),ct.subscribeKey("amount",(e=>{this.amount=e})))}disconnectedCallback(){this.unsubscribe.forEach((e=>e()))}render(){const e=r.getAllRequestedCaipNetworks().find((e=>e.caipNetworkId===this.paymentAsset.network));return I`<wui-flex
1532
+ alignItems="center"
1533
+ gap="1"
1534
+ .padding=${["1","2","1","1"]}
1535
+ class="transfers-badge"
1536
+ >
1537
+ <wui-image src=${G(this.paymentAsset.metadata.logoURI)} size="xl"></wui-image>
1538
+ <wui-text variant="lg-regular" color="primary">
1539
+ ${this.amount} ${this.paymentAsset.metadata.symbol}
1540
+ </wui-text>
1541
+ <wui-text variant="sm-regular" color="secondary">
1542
+ on ${e?.name??"Unknown"}
1543
+ </wui-text>
1544
+ </wui-flex>`}};Gt.styles=[Mt],Vt([V()],Gt.prototype,"paymentAsset",void 0),Vt([V()],Gt.prototype,"amount",void 0),Gt=Vt([M("w3m-pay-header")],Gt);var Ht=T`
1545
+ :host {
1546
+ height: 60px;
1547
+ }
1548
+
1549
+ :host > wui-flex {
1550
+ box-sizing: border-box;
1551
+ background-color: var(--local-header-background-color);
1552
+ }
1553
+
1554
+ wui-text {
1555
+ background-color: var(--local-header-background-color);
1556
+ }
1557
+
1558
+ wui-flex.w3m-header-title {
1559
+ transform: translateY(0);
1560
+ opacity: 1;
1561
+ }
1562
+
1563
+ wui-flex.w3m-header-title[view-direction='prev'] {
1564
+ animation:
1565
+ slide-down-out 120ms forwards ${({easings:e})=>e["ease-out-power-2"]},
1566
+ slide-down-in 120ms forwards ${({easings:e})=>e["ease-out-power-2"]};
1567
+ animation-delay: 0ms, 200ms;
1568
+ }
1569
+
1570
+ wui-flex.w3m-header-title[view-direction='next'] {
1571
+ animation:
1572
+ slide-up-out 120ms forwards ${({easings:e})=>e["ease-out-power-2"]},
1573
+ slide-up-in 120ms forwards ${({easings:e})=>e["ease-out-power-2"]};
1574
+ animation-delay: 0ms, 200ms;
1575
+ }
1576
+
1577
+ wui-icon-button[data-hidden='true'] {
1578
+ opacity: 0 !important;
1579
+ pointer-events: none;
1580
+ }
1581
+
1582
+ @keyframes slide-up-out {
1583
+ from {
1584
+ transform: translateY(0px);
1585
+ opacity: 1;
1586
+ }
1587
+ to {
1588
+ transform: translateY(3px);
1589
+ opacity: 0;
1590
+ }
1591
+ }
1592
+
1593
+ @keyframes slide-up-in {
1594
+ from {
1595
+ transform: translateY(-3px);
1596
+ opacity: 0;
1597
+ }
1598
+ to {
1599
+ transform: translateY(0);
1600
+ opacity: 1;
1601
+ }
1602
+ }
1603
+
1604
+ @keyframes slide-down-out {
1605
+ from {
1606
+ transform: translateY(0px);
1607
+ opacity: 1;
1608
+ }
1609
+ to {
1610
+ transform: translateY(-3px);
1611
+ opacity: 0;
1612
+ }
1613
+ }
1614
+
1615
+ @keyframes slide-down-in {
1616
+ from {
1617
+ transform: translateY(3px);
1618
+ opacity: 0;
1619
+ }
1620
+ to {
1621
+ transform: translateY(0);
1622
+ opacity: 1;
1623
+ }
1624
+ }
1625
+ `,Yt=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const Kt=["SmartSessionList"],Qt={PayWithExchange:L.tokens.theme.foregroundPrimary};function Xt(){const e=p.state.data?.connector?.name,t=p.state.data?.wallet?.name,i=p.state.data?.network?.name,o=t??e,a=l.getConnectors(),n=1===a.length&&"w3m-email"===a[0]?.id,s=r.getAccountData()?.socialProvider;return{Connect:`Connect ${n?"Email":""} Wallet`,Create:"Create Wallet",ChooseAccountName:void 0,Account:void 0,AccountSettings:void 0,AllWallets:"All Wallets",ApproveTransaction:"Approve Transaction",BuyInProgress:"Buy",UsageExceeded:"Usage Exceeded",ConnectingExternal:o??"Connect Wallet",ConnectingWalletConnect:o??"WalletConnect",ConnectingWalletConnectBasic:"WalletConnect",ConnectingSiwe:"Sign In",Convert:"Convert",ConvertSelectToken:"Select token",ConvertPreview:"Preview Convert",Downloads:o?`Get ${o}`:"Downloads",EmailLogin:"Email Login",EmailVerifyOtp:"Confirm Email",EmailVerifyDevice:"Register Device",GetWallet:"Get a Wallet",Networks:"Choose Network",OnRampProviders:"Choose Provider",OnRampActivity:"Activity",OnRampTokenSelect:"Select Token",OnRampFiatSelect:"Select Currency",Pay:"How you pay",ProfileWallets:"Wallets",SwitchNetwork:i??"Switch Network",Transactions:"Activity",UnsupportedChain:"Switch Network",UpgradeEmailWallet:"Upgrade Your Wallet",UpdateEmailWallet:"Edit Email",UpdateEmailPrimaryOtp:"Confirm Current Email",UpdateEmailSecondaryOtp:"Confirm New Email",WhatIsABuy:"What is Buy?",RegisterAccountName:"Choose Name",RegisterAccountNameSuccess:"",WalletReceive:"Receive",WalletCompatibleNetworks:"Compatible Networks",Swap:"Swap",SwapSelectToken:"Select Token",SwapPreview:"Preview Swap",WalletSend:"Send",WalletSendPreview:"Review Send",WalletSendSelectToken:"Select Token",WalletSendConfirmed:"Confirmed",WhatIsANetwork:"What is a network?",WhatIsAWallet:"What is a Wallet?",ConnectWallets:"Connect Wallet",ConnectSocials:"All Socials",ConnectingSocial:s?s.charAt(0).toUpperCase()+s.slice(1):"Connect Social",ConnectingMultiChain:"Select Chain",ConnectingFarcaster:"Farcaster",SwitchActiveChain:"Switch Chain",SmartSessionCreated:void 0,SmartSessionList:"Smart Sessions",SIWXSignMessage:"Sign In",PayLoading:"Processing payment...",PayQuote:"Payment Quote",DataCapture:"Profile",DataCaptureOtpConfirm:"Confirm Email",FundWallet:"Fund Wallet",PayWithExchange:"Deposit from Exchange",PayWithExchangeSelectAsset:"Select Asset",SmartAccountSettings:"Smart Account Settings"}}let Zt=class extends S{constructor(){super(),this.unsubscribe=[],this.heading=Xt()[p.state.view],this.network=r.state.activeCaipNetwork,this.networkImage=D.getNetworkImage(this.network),this.showBack=!1,this.prevHistoryLength=1,this.view=p.state.view,this.viewDirection="",this.unsubscribe.push(z.subscribeNetworkImages((()=>{this.networkImage=D.getNetworkImage(this.network)})),p.subscribeKey("view",(e=>{setTimeout((()=>{this.view=e,this.heading=Xt()[e]}),Ie.ANIMATION_DURATIONS.HeaderText),this.onViewChange(),this.onHistoryChange()})),r.subscribeKey("activeCaipNetwork",(e=>{this.network=e,this.networkImage=D.getNetworkImage(this.network)})))}disconnectCallback(){this.unsubscribe.forEach((e=>e()))}render(){const e=Qt[p.state.view]??L.tokens.theme.backgroundPrimary;return this.style.setProperty("--local-header-background-color",e),I`
1626
+ <wui-flex
1627
+ .padding=${["0","4","0","4"]}
1628
+ justifyContent="space-between"
1629
+ alignItems="center"
1630
+ >
1631
+ ${this.leftHeaderTemplate()} ${this.titleTemplate()} ${this.rightHeaderTemplate()}
1632
+ </wui-flex>
1633
+ `}onWalletHelp(){f.sendEvent({type:"track",event:"CLICK_WALLET_HELP"}),p.push("WhatIsAWallet")}async onClose(){await ne.safeClose()}rightHeaderTemplate(){const e=_?.state?.features?.smartSessions;return"Account"===p.state.view&&e?I`<wui-flex>
1634
+ <wui-icon-button
1635
+ icon="clock"
1636
+ size="lg"
1637
+ iconSize="lg"
1638
+ type="neutral"
1639
+ variant="primary"
1640
+ @click=${()=>p.push("SmartSessionList")}
1641
+ data-testid="w3m-header-smart-sessions"
1642
+ ></wui-icon-button>
1643
+ ${this.closeButtonTemplate()}
1644
+ </wui-flex> `:this.closeButtonTemplate()}closeButtonTemplate(){return I`
1645
+ <wui-icon-button
1646
+ icon="close"
1647
+ size="lg"
1648
+ type="neutral"
1649
+ variant="primary"
1650
+ iconSize="lg"
1651
+ @click=${this.onClose.bind(this)}
1652
+ data-testid="w3m-header-close"
1653
+ ></wui-icon-button>
1654
+ `}titleTemplate(){if("PayQuote"===this.view)return I`<w3m-pay-header></w3m-pay-header>`;const e=Kt.includes(this.view);return I`
1655
+ <wui-flex
1656
+ view-direction="${this.viewDirection}"
1657
+ class="w3m-header-title"
1658
+ alignItems="center"
1659
+ gap="2"
1660
+ >
1661
+ <wui-text
1662
+ display="inline"
1663
+ variant="lg-regular"
1664
+ color="primary"
1665
+ data-testid="w3m-header-text"
1666
+ >
1667
+ ${this.heading}
1668
+ </wui-text>
1669
+ ${e?I`<wui-tag variant="accent" size="md">Beta</wui-tag>`:null}
1670
+ </wui-flex>
1671
+ `}leftHeaderTemplate(){const{view:e}=p.state,t="Connect"===e,i=_.state.enableEmbedded,o="ApproveTransaction"===e,a="ConnectingSiwe"===e,n="Account"===e,r=_.state.enableNetworkSwitch,s=o||a||t&&i;return n&&r?I`<wui-select
1672
+ id="dynamic"
1673
+ data-testid="w3m-account-select-network"
1674
+ active-network=${G(this.network?.name)}
1675
+ @click=${this.onNetworks.bind(this)}
1676
+ imageSrc=${G(this.networkImage)}
1677
+ ></wui-select>`:this.showBack&&!s?I`<wui-icon-button
1678
+ data-testid="header-back"
1679
+ id="dynamic"
1680
+ icon="chevronLeft"
1681
+ size="lg"
1682
+ iconSize="lg"
1683
+ type="neutral"
1684
+ variant="primary"
1685
+ @click=${this.onGoBack.bind(this)}
1686
+ ></wui-icon-button>`:I`<wui-icon-button
1687
+ data-hidden=${!t}
1688
+ id="dynamic"
1689
+ icon="helpCircle"
1690
+ size="lg"
1691
+ iconSize="lg"
1692
+ type="neutral"
1693
+ variant="primary"
1694
+ @click=${this.onWalletHelp.bind(this)}
1695
+ ></wui-icon-button>`}onNetworks(){this.isAllowedNetworkSwitch()&&(f.sendEvent({type:"track",event:"CLICK_NETWORKS"}),p.push("Networks"))}isAllowedNetworkSwitch(){const e=r.getAllRequestedCaipNetworks(),t=!!e&&e.length>1,i=e?.find((({id:e})=>e===this.network?.id));return t||!i}onViewChange(){const{history:e}=p.state;let t=Ie.VIEW_DIRECTION.Next;e.length<this.prevHistoryLength&&(t=Ie.VIEW_DIRECTION.Prev),this.prevHistoryLength=e.length,this.viewDirection=t}async onHistoryChange(){const{history:e}=p.state,t=this.shadowRoot?.querySelector("#dynamic");e.length>1&&!this.showBack&&t?(await t.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.showBack=!0,t.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"})):e.length<=1&&this.showBack&&t&&(await t.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.showBack=!1,t.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"}))}onGoBack(){p.goBack()}};Zt.styles=Ht,Yt([H()],Zt.prototype,"heading",void 0),Yt([H()],Zt.prototype,"network",void 0),Yt([H()],Zt.prototype,"networkImage",void 0),Yt([H()],Zt.prototype,"showBack",void 0),Yt([H()],Zt.prototype,"prevHistoryLength",void 0),Yt([H()],Zt.prototype,"view",void 0),Yt([H()],Zt.prototype,"viewDirection",void 0),Zt=Yt([M("w3m-header")],Zt);var Jt=T`
1696
+ :host {
1697
+ display: flex;
1698
+ align-items: center;
1699
+ gap: ${({spacing:e})=>e[1]};
1700
+ padding: ${({spacing:e})=>e[2]} ${({spacing:e})=>e[3]}
1701
+ ${({spacing:e})=>e[2]} ${({spacing:e})=>e[2]};
1702
+ border-radius: ${({borderRadius:e})=>e[20]};
1703
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
1704
+ box-shadow:
1705
+ 0px 0px 8px 0px rgba(0, 0, 0, 0.1),
1706
+ inset 0 0 0 1px ${({tokens:e})=>e.theme.borderPrimary};
1707
+ max-width: 320px;
1708
+ }
1709
+
1710
+ wui-icon-box {
1711
+ border-radius: ${({borderRadius:e})=>e.round} !important;
1712
+ overflow: hidden;
1713
+ }
1714
+
1715
+ wui-loading-spinner {
1716
+ padding: ${({spacing:e})=>e[1]};
1717
+ background-color: ${({tokens:e})=>e.core.foregroundAccent010};
1718
+ border-radius: ${({borderRadius:e})=>e.round} !important;
1719
+ }
1720
+ `,ei=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let ti=class extends S{constructor(){super(...arguments),this.message="",this.variant="success"}render(){return I`
1721
+ ${this.templateIcon()}
1722
+ <wui-text variant="lg-regular" color="primary" data-testid="wui-snackbar-message"
1723
+ >${this.message}</wui-text
1724
+ >
1725
+ `}templateIcon(){return"loading"===this.variant?I`<wui-loading-spinner size="md" color="accent-primary"></wui-loading-spinner>`:I`<wui-icon-box
1726
+ size="md"
1727
+ color=${{success:"success",error:"error",warning:"warning",info:"default"}[this.variant]}
1728
+ icon=${{success:"checkmark",error:"warning",warning:"warningCircle",info:"info"}[this.variant]}
1729
+ ></wui-icon-box>`}};ti.styles=[A,Jt],ei([V()],ti.prototype,"message",void 0),ei([V()],ti.prototype,"variant",void 0),ti=ei([M("wui-snackbar")],ti);var ii=B`
1730
+ :host {
1731
+ display: block;
1732
+ position: absolute;
1733
+ opacity: 0;
1734
+ pointer-events: none;
1735
+ top: 11px;
1736
+ left: 50%;
1737
+ width: max-content;
1738
+ }
1739
+ `,oi=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let ai=class extends S{constructor(){super(),this.unsubscribe=[],this.timeout=void 0,this.open=u.state.open,this.unsubscribe.push(u.subscribeKey("open",(e=>{this.open=e,this.onOpen()})))}disconnectedCallback(){clearTimeout(this.timeout),this.unsubscribe.forEach((e=>e()))}render(){const{message:e,variant:t}=u.state;return I` <wui-snackbar message=${e} variant=${t}></wui-snackbar> `}onOpen(){clearTimeout(this.timeout),this.open?(this.animate([{opacity:0,transform:"translateX(-50%) scale(0.85)"},{opacity:1,transform:"translateX(-50%) scale(1)"}],{duration:150,fill:"forwards",easing:"ease"}),this.timeout&&clearTimeout(this.timeout),u.state.autoClose&&(this.timeout=setTimeout((()=>u.hide()),2500))):this.animate([{opacity:1,transform:"translateX(-50%) scale(1)"},{opacity:0,transform:"translateX(-50%) scale(0.85)"}],{duration:150,fill:"forwards",easing:"ease"})}};ai.styles=ii,oi([H()],ai.prototype,"open",void 0),ai=oi([M("w3m-snackbar")],ai);var ni=B`
1740
+ :host {
1741
+ width: 100%;
1742
+ display: block;
1743
+ }
1744
+ `,ri=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let si=class extends S{constructor(){super(),this.unsubscribe=[],this.text="",this.open=ae.state.open,this.unsubscribe.push(p.subscribeKey("view",(()=>{ae.hide()})),k.subscribeKey("open",(e=>{e||ae.hide()})),ae.subscribeKey("open",(e=>{this.open=e})))}disconnectedCallback(){this.unsubscribe.forEach((e=>e())),ae.hide()}render(){return I`
1745
+ <div
1746
+ @pointermove=${this.onMouseEnter.bind(this)}
1747
+ @pointerleave=${this.onMouseLeave.bind(this)}
1748
+ >
1749
+ ${this.renderChildren()}
1750
+ </div>
1751
+ `}renderChildren(){return I`<slot></slot> `}onMouseEnter(){const e=this.getBoundingClientRect();if(!this.open){const t=document.querySelector("w3m-modal"),i={width:e.width,height:e.height,left:e.left,top:e.top};if(t){const o=t.getBoundingClientRect();i.left=e.left-(window.innerWidth-o.width)/2,i.top=e.top-(window.innerHeight-o.height)/2}ae.showTooltip({message:this.text,triggerRect:i,variant:"shade"})}}onMouseLeave(e){this.contains(e.relatedTarget)||ae.hide()}};si.styles=[ni],ri([V()],si.prototype,"text",void 0),ri([H()],si.prototype,"open",void 0),si=ri([M("w3m-tooltip-trigger")],si);var ci=T`
1752
+ :host {
1753
+ pointer-events: none;
1754
+ }
1755
+
1756
+ :host > wui-flex {
1757
+ display: var(--w3m-tooltip-display);
1758
+ opacity: var(--w3m-tooltip-opacity);
1759
+ padding: 9px ${({spacing:e})=>e[3]} 10px ${({spacing:e})=>e[3]};
1760
+ border-radius: ${({borderRadius:e})=>e[3]};
1761
+ color: ${({tokens:e})=>e.theme.backgroundPrimary};
1762
+ position: absolute;
1763
+ top: var(--w3m-tooltip-top);
1764
+ left: var(--w3m-tooltip-left);
1765
+ transform: translate(calc(-50% + var(--w3m-tooltip-parent-width)), calc(-100% - 8px));
1766
+ max-width: calc(var(--apkt-modal-width) - ${({spacing:e})=>e[5]});
1767
+ transition: opacity ${({durations:e})=>e.lg}
1768
+ ${({easings:e})=>e["ease-out-power-2"]};
1769
+ will-change: opacity;
1770
+ opacity: 0;
1771
+ animation-duration: ${({durations:e})=>e.xl};
1772
+ animation-timing-function: ${({easings:e})=>e["ease-out-power-2"]};
1773
+ animation-name: fade-in;
1774
+ animation-fill-mode: forwards;
1775
+ }
1776
+
1777
+ :host([data-variant='shade']) > wui-flex {
1778
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
1779
+ }
1780
+
1781
+ :host([data-variant='shade']) > wui-flex > wui-text {
1782
+ color: ${({tokens:e})=>e.theme.textSecondary};
1783
+ }
1784
+
1785
+ :host([data-variant='fill']) > wui-flex {
1786
+ background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
1787
+ border: 1px solid ${({tokens:e})=>e.theme.borderPrimary};
1788
+ }
1789
+
1790
+ wui-icon {
1791
+ position: absolute;
1792
+ width: 12px !important;
1793
+ height: 4px !important;
1794
+ color: ${({tokens:e})=>e.theme.foregroundPrimary};
1795
+ }
1796
+
1797
+ wui-icon[data-placement='top'] {
1798
+ bottom: 0px;
1799
+ left: 50%;
1800
+ transform: translate(-50%, 95%);
1801
+ }
1802
+
1803
+ wui-icon[data-placement='bottom'] {
1804
+ top: 0;
1805
+ left: 50%;
1806
+ transform: translate(-50%, -95%) rotate(180deg);
1807
+ }
1808
+
1809
+ wui-icon[data-placement='right'] {
1810
+ top: 50%;
1811
+ left: 0;
1812
+ transform: translate(-65%, -50%) rotate(90deg);
1813
+ }
1814
+
1815
+ wui-icon[data-placement='left'] {
1816
+ top: 50%;
1817
+ right: 0%;
1818
+ transform: translate(65%, -50%) rotate(270deg);
1819
+ }
1820
+
1821
+ @keyframes fade-in {
1822
+ from {
1823
+ opacity: 0;
1824
+ }
1825
+ to {
1826
+ opacity: 1;
1827
+ }
1828
+ }
1829
+ `,li=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let di=class extends S{constructor(){super(),this.unsubscribe=[],this.open=ae.state.open,this.message=ae.state.message,this.triggerRect=ae.state.triggerRect,this.variant=ae.state.variant,this.unsubscribe.push(ae.subscribe((e=>{this.open=e.open,this.message=e.message,this.triggerRect=e.triggerRect,this.variant=e.variant})))}disconnectedCallback(){this.unsubscribe.forEach((e=>e()))}render(){this.dataset.variant=this.variant;const e=this.triggerRect.top,t=this.triggerRect.left;return this.style.cssText=`\n --w3m-tooltip-top: ${e}px;\n --w3m-tooltip-left: ${t}px;\n --w3m-tooltip-parent-width: ${this.triggerRect.width/2}px;\n --w3m-tooltip-display: ${this.open?"flex":"none"};\n --w3m-tooltip-opacity: ${this.open?1:0};\n `,I`<wui-flex>
1830
+ <wui-icon data-placement="top" size="inherit" name="cursor"></wui-icon>
1831
+ <wui-text color="primary" variant="sm-regular">${this.message}</wui-text>
1832
+ </wui-flex>`}};di.styles=[ci],li([H()],di.prototype,"open",void 0),li([H()],di.prototype,"message",void 0),li([H()],di.prototype,"triggerRect",void 0),li([H()],di.prototype,"variant",void 0),di=li([M("w3m-tooltip")],di);const ui={getTabsByNamespace:e=>Boolean(e)&&e===d.CHAIN.EVM?!1===_.state.remoteFeatures?.activity?Ie.ACCOUNT_TABS.filter((e=>"Activity"!==e.label)):Ie.ACCOUNT_TABS:[],isValidReownName:e=>/^[a-zA-Z0-9]+$/gu.test(e),isValidEmail:e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/gu.test(e),validateReownName:e=>e.replace(/\^/gu,"").toLowerCase().replace(/[^a-zA-Z0-9]/gu,""),hasFooter(){const e=p.state.view;if(Ie.VIEWS_WITH_LEGAL_FOOTER.includes(e)){const{termsConditionsUrl:e,privacyPolicyUrl:t}=_.state,i=_.state.features?.legalCheckbox;return!(!e&&!t||i)}return Ie.VIEWS_WITH_DEFAULT_FOOTER.includes(e)}};var pi=T`
1833
+ :host wui-ux-by-reown {
1834
+ padding-top: 0;
1835
+ }
1836
+
1837
+ :host wui-ux-by-reown.branding-only {
1838
+ padding-top: ${({spacing:e})=>e[3]};
1839
+ }
1840
+
1841
+ a {
1842
+ text-decoration: none;
1843
+ color: ${({tokens:e})=>e.core.textAccentPrimary};
1844
+ font-weight: 500;
1845
+ }
1846
+ `,hi=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let mi=class extends S{constructor(){super(),this.unsubscribe=[],this.remoteFeatures=_.state.remoteFeatures,this.unsubscribe.push(_.subscribeKey("remoteFeatures",(e=>this.remoteFeatures=e)))}disconnectedCallback(){this.unsubscribe.forEach((e=>e()))}render(){const{termsConditionsUrl:e,privacyPolicyUrl:t}=_.state,i=_.state.features?.legalCheckbox;return!e&&!t||i?I`
1847
+ <wui-flex flexDirection="column"> ${this.reownBrandingTemplate(!0)} </wui-flex>
1848
+ `:I`
1849
+ <wui-flex flexDirection="column">
1850
+ <wui-flex .padding=${["4","3","3","3"]} justifyContent="center">
1851
+ <wui-text color="secondary" variant="md-regular" align="center">
1852
+ By connecting your wallet, you agree to our <br />
1853
+ ${this.termsTemplate()} ${this.andTemplate()} ${this.privacyTemplate()}
1854
+ </wui-text>
1855
+ </wui-flex>
1856
+ ${this.reownBrandingTemplate()}
1857
+ </wui-flex>
1858
+ `}andTemplate(){const{termsConditionsUrl:e,privacyPolicyUrl:t}=_.state;return e&&t?"and":""}termsTemplate(){const{termsConditionsUrl:e}=_.state;return e?I`<a href=${e} target="_blank" rel="noopener noreferrer"
1859
+ >Terms of Service</a
1860
+ >`:null}privacyTemplate(){const{privacyPolicyUrl:e}=_.state;return e?I`<a href=${e} target="_blank" rel="noopener noreferrer"
1861
+ >Privacy Policy</a
1862
+ >`:null}reownBrandingTemplate(e=!1){return this.remoteFeatures?.reownBranding?e?I`<wui-ux-by-reown class="branding-only"></wui-ux-by-reown>`:I`<wui-ux-by-reown></wui-ux-by-reown>`:null}};mi.styles=[pi],hi([H()],mi.prototype,"remoteFeatures",void 0),mi=hi([M("w3m-legal-footer")],mi);var wi=B``,gi=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let yi=class extends S{render(){const{termsConditionsUrl:e,privacyPolicyUrl:t}=_.state;return e||t?I`
1863
+ <wui-flex
1864
+ .padding=${["4","3","3","3"]}
1865
+ flexDirection="column"
1866
+ alignItems="center"
1867
+ justifyContent="center"
1868
+ gap="3"
1869
+ >
1870
+ <wui-text color="secondary" variant="md-regular" align="center">
1871
+ We work with the best providers to give you the lowest fees and best support. More options
1872
+ coming soon!
1873
+ </wui-text>
1874
+
1875
+ ${this.howDoesItWorkTemplate()}
1876
+ </wui-flex>
1877
+ `:null}howDoesItWorkTemplate(){return I` <wui-link @click=${this.onWhatIsBuy.bind(this)}>
1878
+ <wui-icon size="xs" color="accent-primary" slot="iconLeft" name="helpCircle"></wui-icon>
1879
+ How does it work?
1880
+ </wui-link>`}onWhatIsBuy(){f.sendEvent({type:"track",event:"SELECT_WHAT_IS_A_BUY",properties:{isSmartAccount:b(r.state.activeChain)===v.ACCOUNT_TYPES.SMART_ACCOUNT}}),p.push("WhatIsABuy")}};yi.styles=[wi],yi=gi([M("w3m-onramp-providers-footer")],yi);var fi=T`
1881
+ :host {
1882
+ display: block;
1883
+ }
1884
+
1885
+ div.container {
1886
+ position: absolute;
1887
+ bottom: 0;
1888
+ left: 0;
1889
+ right: 0;
1890
+ overflow: hidden;
1891
+ height: auto;
1892
+ display: block;
1893
+ }
1894
+
1895
+ div.container[status='hide'] {
1896
+ animation: fade-out;
1897
+ animation-duration: var(--apkt-duration-dynamic);
1898
+ animation-timing-function: ${({easings:e})=>e["ease-out-power-2"]};
1899
+ animation-fill-mode: both;
1900
+ animation-delay: 0s;
1901
+ }
1902
+
1903
+ div.container[status='show'] {
1904
+ animation: fade-in;
1905
+ animation-duration: var(--apkt-duration-dynamic);
1906
+ animation-timing-function: ${({easings:e})=>e["ease-out-power-2"]};
1907
+ animation-fill-mode: both;
1908
+ animation-delay: var(--apkt-duration-dynamic);
1909
+ }
1910
+
1911
+ @keyframes fade-in {
1912
+ from {
1913
+ opacity: 0;
1914
+ filter: blur(6px);
1915
+ }
1916
+ to {
1917
+ opacity: 1;
1918
+ filter: blur(0px);
1919
+ }
1920
+ }
1921
+
1922
+ @keyframes fade-out {
1923
+ from {
1924
+ opacity: 1;
1925
+ filter: blur(0px);
1926
+ }
1927
+ to {
1928
+ opacity: 0;
1929
+ filter: blur(6px);
1930
+ }
1931
+ }
1932
+ `,bi=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let vi=class extends S{constructor(){super(...arguments),this.resizeObserver=void 0,this.unsubscribe=[],this.status="hide",this.view=p.state.view}firstUpdated(){this.status=ui.hasFooter()?"show":"hide",this.unsubscribe.push(p.subscribeKey("view",(e=>{if(this.view=e,this.status=ui.hasFooter()?"show":"hide","hide"===this.status){document.documentElement.style.setProperty("--apkt-footer-height","0px")}}))),this.resizeObserver=new ResizeObserver((e=>{for(const t of e)if(t.target===this.getWrapper()){const e=`${t.contentRect.height}px`;document.documentElement.style.setProperty("--apkt-footer-height",e)}})),this.resizeObserver.observe(this.getWrapper())}render(){return I`
1933
+ <div class="container" status=${this.status}>${this.templatePageContainer()}</div>
1934
+ `}templatePageContainer(){return ui.hasFooter()?I` ${this.templateFooter()}`:null}templateFooter(){switch(this.view){case"Networks":return this.templateNetworksFooter();case"Connect":case"ConnectWallets":case"OnRampFiatSelect":case"OnRampTokenSelect":return I`<w3m-legal-footer></w3m-legal-footer>`;case"OnRampProviders":return I`<w3m-onramp-providers-footer></w3m-onramp-providers-footer>`;default:return null}}templateNetworksFooter(){return I` <wui-flex
1935
+ class="footer-in"
1936
+ padding="3"
1937
+ flexDirection="column"
1938
+ gap="3"
1939
+ alignItems="center"
1940
+ >
1941
+ <wui-text variant="md-regular" color="secondary" align="center">
1942
+ Your connected wallet may not support some of the networks available for this dApp
1943
+ </wui-text>
1944
+ <wui-link @click=${this.onNetworkHelp.bind(this)}>
1945
+ <wui-icon size="sm" color="accent-primary" slot="iconLeft" name="helpCircle"></wui-icon>
1946
+ What is a network
1947
+ </wui-link>
1948
+ </wui-flex>`}onNetworkHelp(){f.sendEvent({type:"track",event:"CLICK_NETWORK_HELP"}),p.push("WhatIsANetwork")}getWrapper(){return this.shadowRoot?.querySelector("div.container")}};vi.styles=[fi],bi([H()],vi.prototype,"status",void 0),bi([H()],vi.prototype,"view",void 0),vi=bi([M("w3m-footer")],vi);var ki=T`
1949
+ :host {
1950
+ display: block;
1951
+ width: inherit;
1952
+ }
1953
+ `,xi=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let Ti=class extends S{constructor(){super(),this.unsubscribe=[],this.viewState=p.state.view,this.history=p.state.history.join(","),this.unsubscribe.push(p.subscribeKey("view",(()=>{this.history=p.state.history.join(","),document.documentElement.style.setProperty("--apkt-duration-dynamic","var(--apkt-durations-lg)")})))}disconnectedCallback(){this.unsubscribe.forEach((e=>e())),document.documentElement.style.setProperty("--apkt-duration-dynamic","0s")}render(){return I`${this.templatePageContainer()}`}templatePageContainer(){return I`<w3m-router-container
1954
+ history=${this.history}
1955
+ .setView=${()=>{this.viewState=p.state.view}}
1956
+ >
1957
+ ${this.viewTemplate(this.viewState)}
1958
+ </w3m-router-container>`}viewTemplate(e){switch(e){case"AccountSettings":return I`<w3m-account-settings-view></w3m-account-settings-view>`;case"Account":return I`<w3m-account-view></w3m-account-view>`;case"AllWallets":return I`<w3m-all-wallets-view></w3m-all-wallets-view>`;case"ApproveTransaction":return I`<w3m-approve-transaction-view></w3m-approve-transaction-view>`;case"BuyInProgress":return I`<w3m-buy-in-progress-view></w3m-buy-in-progress-view>`;case"ChooseAccountName":return I`<w3m-choose-account-name-view></w3m-choose-account-name-view>`;case"Connect":default:return I`<w3m-connect-view></w3m-connect-view>`;case"Create":return I`<w3m-connect-view walletGuide="explore"></w3m-connect-view>`;case"ConnectingWalletConnect":return I`<w3m-connecting-wc-view></w3m-connecting-wc-view>`;case"ConnectingWalletConnectBasic":return I`<w3m-connecting-wc-basic-view></w3m-connecting-wc-basic-view>`;case"ConnectingExternal":return I`<w3m-connecting-external-view></w3m-connecting-external-view>`;case"ConnectingSiwe":return I`<w3m-connecting-siwe-view></w3m-connecting-siwe-view>`;case"ConnectWallets":return I`<w3m-connect-wallets-view></w3m-connect-wallets-view>`;case"ConnectSocials":return I`<w3m-connect-socials-view></w3m-connect-socials-view>`;case"ConnectingSocial":return I`<w3m-connecting-social-view></w3m-connecting-social-view>`;case"DataCapture":return I`<w3m-data-capture-view></w3m-data-capture-view>`;case"DataCaptureOtpConfirm":return I`<w3m-data-capture-otp-confirm-view></w3m-data-capture-otp-confirm-view>`;case"Downloads":return I`<w3m-downloads-view></w3m-downloads-view>`;case"EmailLogin":return I`<w3m-email-login-view></w3m-email-login-view>`;case"EmailVerifyOtp":return I`<w3m-email-verify-otp-view></w3m-email-verify-otp-view>`;case"EmailVerifyDevice":return I`<w3m-email-verify-device-view></w3m-email-verify-device-view>`;case"GetWallet":return I`<w3m-get-wallet-view></w3m-get-wallet-view>`;case"Networks":return I`<w3m-networks-view></w3m-networks-view>`;case"SwitchNetwork":return I`<w3m-network-switch-view></w3m-network-switch-view>`;case"ProfileWallets":return I`<w3m-profile-wallets-view></w3m-profile-wallets-view>`;case"Transactions":return I`<w3m-transactions-view></w3m-transactions-view>`;case"OnRampProviders":return I`<w3m-onramp-providers-view></w3m-onramp-providers-view>`;case"OnRampTokenSelect":return I`<w3m-onramp-token-select-view></w3m-onramp-token-select-view>`;case"OnRampFiatSelect":return I`<w3m-onramp-fiat-select-view></w3m-onramp-fiat-select-view>`;case"UpgradeEmailWallet":return I`<w3m-upgrade-wallet-view></w3m-upgrade-wallet-view>`;case"UpdateEmailWallet":return I`<w3m-update-email-wallet-view></w3m-update-email-wallet-view>`;case"UpdateEmailPrimaryOtp":return I`<w3m-update-email-primary-otp-view></w3m-update-email-primary-otp-view>`;case"UpdateEmailSecondaryOtp":return I`<w3m-update-email-secondary-otp-view></w3m-update-email-secondary-otp-view>`;case"UnsupportedChain":return I`<w3m-unsupported-chain-view></w3m-unsupported-chain-view>`;case"Swap":return I`<w3m-swap-view></w3m-swap-view>`;case"SwapSelectToken":return I`<w3m-swap-select-token-view></w3m-swap-select-token-view>`;case"SwapPreview":return I`<w3m-swap-preview-view></w3m-swap-preview-view>`;case"WalletSend":return I`<w3m-wallet-send-view></w3m-wallet-send-view>`;case"WalletSendSelectToken":return I`<w3m-wallet-send-select-token-view></w3m-wallet-send-select-token-view>`;case"WalletSendPreview":return I`<w3m-wallet-send-preview-view></w3m-wallet-send-preview-view>`;case"WalletSendConfirmed":return I`<w3m-send-confirmed-view></w3m-send-confirmed-view>`;case"WhatIsABuy":return I`<w3m-what-is-a-buy-view></w3m-what-is-a-buy-view>`;case"WalletReceive":return I`<w3m-wallet-receive-view></w3m-wallet-receive-view>`;case"WalletCompatibleNetworks":return I`<w3m-wallet-compatible-networks-view></w3m-wallet-compatible-networks-view>`;case"WhatIsAWallet":return I`<w3m-what-is-a-wallet-view></w3m-what-is-a-wallet-view>`;case"ConnectingMultiChain":return I`<w3m-connecting-multi-chain-view></w3m-connecting-multi-chain-view>`;case"WhatIsANetwork":return I`<w3m-what-is-a-network-view></w3m-what-is-a-network-view>`;case"ConnectingFarcaster":return I`<w3m-connecting-farcaster-view></w3m-connecting-farcaster-view>`;case"SwitchActiveChain":return I`<w3m-switch-active-chain-view></w3m-switch-active-chain-view>`;case"RegisterAccountName":return I`<w3m-register-account-name-view></w3m-register-account-name-view>`;case"RegisterAccountNameSuccess":return I`<w3m-register-account-name-success-view></w3m-register-account-name-success-view>`;case"SmartSessionCreated":return I`<w3m-smart-session-created-view></w3m-smart-session-created-view>`;case"SmartSessionList":return I`<w3m-smart-session-list-view></w3m-smart-session-list-view>`;case"SIWXSignMessage":return I`<w3m-siwx-sign-message-view></w3m-siwx-sign-message-view>`;case"Pay":return I`<w3m-pay-view></w3m-pay-view>`;case"PayLoading":return I`<w3m-pay-loading-view></w3m-pay-loading-view>`;case"PayQuote":return I`<w3m-pay-quote-view></w3m-pay-quote-view>`;case"FundWallet":return I`<w3m-fund-wallet-view></w3m-fund-wallet-view>`;case"PayWithExchange":return I`<w3m-deposit-from-exchange-view></w3m-deposit-from-exchange-view>`;case"PayWithExchangeSelectAsset":return I`<w3m-deposit-from-exchange-select-asset-view></w3m-deposit-from-exchange-select-asset-view>`;case"UsageExceeded":return I`<w3m-usage-exceeded-view></w3m-usage-exceeded-view>`;case"SmartAccountSettings":return I`<w3m-smart-account-settings-view></w3m-smart-account-settings-view>`}}};Ti.styles=[ki],xi([H()],Ti.prototype,"viewState",void 0),xi([H()],Ti.prototype,"history",void 0),Ti=xi([M("w3m-router")],Ti);var Ai=T`
1959
+ :host {
1960
+ z-index: ${({tokens:e})=>e.core.zIndex};
1961
+ display: block;
1962
+ backface-visibility: hidden;
1963
+ will-change: opacity;
1964
+ position: fixed;
1965
+ top: 0;
1966
+ left: 0;
1967
+ right: 0;
1968
+ bottom: 0;
1969
+ pointer-events: none;
1970
+ opacity: 0;
1971
+ background-color: ${({tokens:e})=>e.theme.overlay};
1972
+ backdrop-filter: blur(0px);
1973
+ transition:
1974
+ opacity ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]},
1975
+ backdrop-filter ${({durations:e})=>e.lg}
1976
+ ${({easings:e})=>e["ease-out-power-2"]};
1977
+ will-change: opacity;
1978
+ }
1979
+
1980
+ :host(.open) {
1981
+ opacity: 1;
1982
+ backdrop-filter: blur(8px);
1983
+ }
1984
+
1985
+ :host(.appkit-modal) {
1986
+ position: relative;
1987
+ pointer-events: unset;
1988
+ background: none;
1989
+ width: 100%;
1990
+ opacity: 1;
1991
+ }
1992
+
1993
+ wui-card {
1994
+ max-width: var(--apkt-modal-width);
1995
+ width: 100%;
1996
+ position: relative;
1997
+ outline: none;
1998
+ transform: translateY(4px);
1999
+ box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.05);
2000
+ transition:
2001
+ transform ${({durations:e})=>e.lg}
2002
+ ${({easings:e})=>e["ease-out-power-2"]},
2003
+ border-radius ${({durations:e})=>e.lg}
2004
+ ${({easings:e})=>e["ease-out-power-1"]},
2005
+ background-color ${({durations:e})=>e.lg}
2006
+ ${({easings:e})=>e["ease-out-power-1"]},
2007
+ box-shadow ${({durations:e})=>e.lg}
2008
+ ${({easings:e})=>e["ease-out-power-1"]};
2009
+ will-change: border-radius, background-color, transform, box-shadow;
2010
+ background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
2011
+ padding: var(--local-modal-padding);
2012
+ box-sizing: border-box;
2013
+ }
2014
+
2015
+ :host(.open) wui-card {
2016
+ transform: translateY(0px);
2017
+ }
2018
+
2019
+ wui-card::before {
2020
+ z-index: 1;
2021
+ pointer-events: none;
2022
+ content: '';
2023
+ position: absolute;
2024
+ inset: 0;
2025
+ border-radius: clamp(0px, var(--apkt-borderRadius-8), 44px);
2026
+ transition: box-shadow ${({durations:e})=>e.lg}
2027
+ ${({easings:e})=>e["ease-out-power-2"]};
2028
+ transition-delay: ${({durations:e})=>e.md};
2029
+ will-change: box-shadow;
2030
+ }
2031
+
2032
+ :host([data-mobile-fullscreen='true']) wui-card::before {
2033
+ border-radius: 0px;
2034
+ }
2035
+
2036
+ :host([data-border='true']) wui-card::before {
2037
+ box-shadow: inset 0px 0px 0px 4px ${({tokens:e})=>e.theme.foregroundSecondary};
2038
+ }
2039
+
2040
+ :host([data-border='false']) wui-card::before {
2041
+ box-shadow: inset 0px 0px 0px 1px ${({tokens:e})=>e.theme.borderPrimaryDark};
2042
+ }
2043
+
2044
+ :host([data-border='true']) wui-card {
2045
+ animation:
2046
+ fade-in ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]},
2047
+ card-background-border var(--apkt-duration-dynamic)
2048
+ ${({easings:e})=>e["ease-out-power-2"]};
2049
+ animation-fill-mode: backwards, both;
2050
+ animation-delay: var(--apkt-duration-dynamic);
2051
+ }
2052
+
2053
+ :host([data-border='false']) wui-card {
2054
+ animation:
2055
+ fade-in ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]},
2056
+ card-background-default var(--apkt-duration-dynamic)
2057
+ ${({easings:e})=>e["ease-out-power-2"]};
2058
+ animation-fill-mode: backwards, both;
2059
+ animation-delay: 0s;
2060
+ }
2061
+
2062
+ :host(.appkit-modal) wui-card {
2063
+ max-width: var(--apkt-modal-width);
2064
+ }
2065
+
2066
+ wui-card[shake='true'] {
2067
+ animation:
2068
+ fade-in ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]},
2069
+ w3m-shake ${({durations:e})=>e.xl}
2070
+ ${({easings:e})=>e["ease-out-power-2"]};
2071
+ }
2072
+
2073
+ wui-flex {
2074
+ overflow-x: hidden;
2075
+ overflow-y: auto;
2076
+ display: flex;
2077
+ align-items: center;
2078
+ justify-content: center;
2079
+ width: 100%;
2080
+ height: 100%;
2081
+ }
2082
+
2083
+ @media (max-height: 700px) and (min-width: 431px) {
2084
+ wui-flex {
2085
+ align-items: flex-start;
2086
+ }
2087
+
2088
+ wui-card {
2089
+ margin: var(--apkt-spacing-6) 0px;
2090
+ }
2091
+ }
2092
+
2093
+ @media (max-width: 430px) {
2094
+ :host([data-mobile-fullscreen='true']) {
2095
+ height: 100dvh;
2096
+ }
2097
+ :host([data-mobile-fullscreen='true']) wui-flex {
2098
+ align-items: stretch;
2099
+ }
2100
+ :host([data-mobile-fullscreen='true']) wui-card {
2101
+ max-width: 100%;
2102
+ height: 100%;
2103
+ border-radius: 0;
2104
+ border: none;
2105
+ }
2106
+ :host(:not([data-mobile-fullscreen='true'])) wui-flex {
2107
+ align-items: flex-end;
2108
+ }
2109
+
2110
+ :host(:not([data-mobile-fullscreen='true'])) wui-card {
2111
+ max-width: 100%;
2112
+ border-bottom: none;
2113
+ }
2114
+
2115
+ :host(:not([data-mobile-fullscreen='true'])) wui-card[data-embedded='true'] {
2116
+ border-bottom-left-radius: clamp(0px, var(--apkt-borderRadius-8), 44px);
2117
+ border-bottom-right-radius: clamp(0px, var(--apkt-borderRadius-8), 44px);
2118
+ }
2119
+
2120
+ :host(:not([data-mobile-fullscreen='true'])) wui-card:not([data-embedded='true']) {
2121
+ border-bottom-left-radius: 0px;
2122
+ border-bottom-right-radius: 0px;
2123
+ }
2124
+
2125
+ wui-card[shake='true'] {
2126
+ animation: w3m-shake 0.5s ${({easings:e})=>e["ease-out-power-2"]};
2127
+ }
2128
+ }
2129
+
2130
+ @keyframes fade-in {
2131
+ 0% {
2132
+ transform: scale(0.99) translateY(4px);
2133
+ }
2134
+ 100% {
2135
+ transform: scale(1) translateY(0);
2136
+ }
2137
+ }
2138
+
2139
+ @keyframes w3m-shake {
2140
+ 0% {
2141
+ transform: scale(1) rotate(0deg);
2142
+ }
2143
+ 20% {
2144
+ transform: scale(1) rotate(-1deg);
2145
+ }
2146
+ 40% {
2147
+ transform: scale(1) rotate(1.5deg);
2148
+ }
2149
+ 60% {
2150
+ transform: scale(1) rotate(-1.5deg);
2151
+ }
2152
+ 80% {
2153
+ transform: scale(1) rotate(1deg);
2154
+ }
2155
+ 100% {
2156
+ transform: scale(1) rotate(0deg);
2157
+ }
2158
+ }
2159
+
2160
+ @keyframes card-background-border {
2161
+ from {
2162
+ background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
2163
+ }
2164
+ to {
2165
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
2166
+ }
2167
+ }
2168
+
2169
+ @keyframes card-background-default {
2170
+ from {
2171
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
2172
+ }
2173
+ to {
2174
+ background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
2175
+ }
2176
+ }
2177
+ `,Si=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const Ii="scroll-lock",Ei={PayWithExchange:"0",PayWithExchangeSelectAsset:"0",Pay:"0",PayQuote:"0",PayLoading:"0"};class Pi extends S{constructor(){super(),this.unsubscribe=[],this.abortController=void 0,this.hasPrefetched=!1,this.enableEmbedded=_.state.enableEmbedded,this.open=k.state.open,this.caipAddress=r.state.activeCaipAddress,this.caipNetwork=r.state.activeCaipNetwork,this.shake=k.state.shake,this.filterByNamespace=l.state.filterByNamespace,this.padding=L.spacing[1],this.mobileFullScreen=_.state.enableMobileFullScreen,this.initializeTheming(),W.prefetchAnalyticsConfig(),this.unsubscribe.push(k.subscribeKey("open",(e=>e?this.onOpen():this.onClose())),k.subscribeKey("shake",(e=>this.shake=e)),r.subscribeKey("activeCaipNetwork",(e=>this.onNewNetwork(e))),r.subscribeKey("activeCaipAddress",(e=>this.onNewAddress(e))),_.subscribeKey("enableEmbedded",(e=>this.enableEmbedded=e)),l.subscribeKey("filterByNamespace",(e=>{this.filterByNamespace===e||r.getAccountData(e)?.caipAddress||(W.fetchRecommendedWallets(),this.filterByNamespace=e)})),p.subscribeKey("view",(()=>{this.dataset.border=ui.hasFooter()?"true":"false",this.padding=Ei[p.state.view]??L.spacing[1]})))}firstUpdated(){if(this.dataset.border=ui.hasFooter()?"true":"false",this.mobileFullScreen&&this.setAttribute("data-mobile-fullscreen","true"),this.caipAddress){if(this.enableEmbedded)return k.close(),void this.prefetch();this.onNewAddress(this.caipAddress)}this.open&&this.onOpen(),this.enableEmbedded&&this.prefetch()}disconnectedCallback(){this.unsubscribe.forEach((e=>e())),this.onRemoveKeyboardListener()}render(){return this.style.setProperty("--local-modal-padding",this.padding),this.enableEmbedded?I`${this.contentTemplate()}
2178
+ <w3m-tooltip></w3m-tooltip> `:this.open?I`
2179
+ <wui-flex @click=${this.onOverlayClick.bind(this)} data-testid="w3m-modal-overlay">
2180
+ ${this.contentTemplate()}
2181
+ </wui-flex>
2182
+ <w3m-tooltip></w3m-tooltip>
2183
+ `:null}contentTemplate(){return I` <wui-card
2184
+ shake="${this.shake}"
2185
+ data-embedded="${G(this.enableEmbedded)}"
2186
+ role="alertdialog"
2187
+ aria-modal="true"
2188
+ tabindex="0"
2189
+ data-testid="w3m-modal-card"
2190
+ >
2191
+ <w3m-header></w3m-header>
2192
+ <w3m-router></w3m-router>
2193
+ <w3m-footer></w3m-footer>
2194
+ <w3m-snackbar></w3m-snackbar>
2195
+ <w3m-alertbar></w3m-alertbar>
2196
+ </wui-card>`}async onOverlayClick(e){if(e.target===e.currentTarget){if(this.mobileFullScreen)return;await this.handleClose()}}async handleClose(){await ne.safeClose()}initializeTheming(){const{themeVariables:e,themeMode:t}=j.state,i=K.getColorTheme(t);F(e,i)}onClose(){this.open=!1,this.classList.remove("open"),this.onScrollUnlock(),u.hide(),this.onRemoveKeyboardListener()}onOpen(){this.open=!0,this.classList.add("open"),this.onScrollLock(),this.onAddKeyboardListener()}onScrollLock(){const e=document.createElement("style");e.dataset.w3m=Ii,e.textContent="\n body {\n touch-action: none;\n overflow: hidden;\n overscroll-behavior: contain;\n }\n w3m-modal {\n pointer-events: auto;\n }\n ",document.head.appendChild(e)}onScrollUnlock(){const e=document.head.querySelector(`style[data-w3m="${Ii}"]`);e&&e.remove()}onAddKeyboardListener(){this.abortController=new AbortController;const e=this.shadowRoot?.querySelector("wui-card");e?.focus(),window.addEventListener("keydown",(t=>{if("Escape"===t.key)this.handleClose();else if("Tab"===t.key){const{tagName:i}=t.target;!i||i.includes("W3M-")||i.includes("WUI-")||e?.focus()}}),this.abortController)}onRemoveKeyboardListener(){this.abortController?.abort(),this.abortController=void 0}async onNewAddress(e){const t=r.state.isSwitchingNamespace,i="ProfileWallets"===p.state.view;!e&&!t&&!i&&k.close(),await x.initializeIfEnabled(e),this.caipAddress=e,r.setIsSwitchingNamespace(!1)}onNewNetwork(e){const t=this.caipNetwork,i=t?.caipNetworkId?.toString(),o=e?.caipNetworkId?.toString(),a=i!==o,n="UnsupportedChain"===p.state.view,r=k.state.open;let s=!1;this.enableEmbedded&&"SwitchNetwork"===p.state.view&&(s=!0),a&&ie.resetState(),r&&n&&(s=!0),s&&"SIWXSignMessage"!==p.state.view&&p.goBack(),this.caipNetwork=e}prefetch(){this.hasPrefetched||(W.prefetch(),W.fetchWalletsByPage({page:1}),this.hasPrefetched=!0)}}Pi.styles=Ai,Si([V({type:Boolean})],Pi.prototype,"enableEmbedded",void 0),Si([H()],Pi.prototype,"open",void 0),Si([H()],Pi.prototype,"caipAddress",void 0),Si([H()],Pi.prototype,"caipNetwork",void 0),Si([H()],Pi.prototype,"shake",void 0),Si([H()],Pi.prototype,"filterByNamespace",void 0),Si([H()],Pi.prototype,"padding",void 0),Si([H()],Pi.prototype,"mobileFullScreen",void 0);let Ci=class extends Pi{};Ci=Si([M("w3m-modal")],Ci);let $i=class extends Pi{};$i=Si([M("appkit-modal")],$i);var Ni=T`
2197
+ .icon-box {
2198
+ width: 64px;
2199
+ height: 64px;
2200
+ border-radius: ${({borderRadius:e})=>e[5]};
2201
+ background-color: ${({colors:e})=>e.semanticError010};
2202
+ }
2203
+ `,Ri=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let Oi=class extends S{constructor(){super()}render(){return I`
2204
+ <wui-flex
2205
+ flexDirection="column"
2206
+ alignItems="center"
2207
+ gap="4"
2208
+ .padding="${["1","3","4","3"]}"
2209
+ >
2210
+ <wui-flex justifyContent="center" alignItems="center" class="icon-box">
2211
+ <wui-icon size="xxl" color="error" name="warningCircle"></wui-icon>
2212
+ </wui-flex>
2213
+
2214
+ <wui-text variant="lg-medium" color="primary" align="center">
2215
+ The app isn't responding as expected
2216
+ </wui-text>
2217
+ <wui-text variant="md-regular" color="secondary" align="center">
2218
+ Try again or reach out to the app team for help.
2219
+ </wui-text>
2220
+
2221
+ <wui-button
2222
+ variant="neutral-secondary"
2223
+ size="md"
2224
+ @click=${this.onTryAgainClick.bind(this)}
2225
+ data-testid="w3m-usage-exceeded-button"
2226
+ >
2227
+ <wui-icon color="inherit" slot="iconLeft" name="refresh"></wui-icon>
2228
+ Try Again
2229
+ </wui-button>
2230
+ </wui-flex>
2231
+ `}onTryAgainClick(){p.goBack()}};Oi.styles=Ni,Oi=Ri([M("w3m-usage-exceeded-view")],Oi);var _i=T`
2232
+ :host {
2233
+ width: 100%;
2234
+ }
2235
+ `,Ui=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let Di=class extends S{constructor(){super(...arguments),this.hasImpressionSent=!1,this.walletImages=[],this.imageSrc="",this.name="",this.size="md",this.tabIdx=void 0,this.disabled=!1,this.showAllWallets=!1,this.loading=!1,this.loadingSpinnerColor="accent-100",this.rdnsId="",this.displayIndex=void 0,this.walletRank=void 0,this.namespaces=[]}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this.cleanupIntersectionObserver()}updated(e){super.updated(e),(e.has("name")||e.has("imageSrc")||e.has("walletRank"))&&(this.hasImpressionSent=!1);e.has("walletRank")&&this.walletRank&&!this.intersectionObserver&&this.setupIntersectionObserver()}setupIntersectionObserver(){this.intersectionObserver=new IntersectionObserver((e=>{e.forEach((e=>{!e.isIntersecting||this.loading||this.hasImpressionSent||this.sendImpressionEvent()}))}),{threshold:.1}),this.intersectionObserver.observe(this)}cleanupIntersectionObserver(){this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=void 0)}sendImpressionEvent(){this.name&&!this.hasImpressionSent&&this.walletRank&&(this.hasImpressionSent=!0,(this.rdnsId||this.name)&&f.sendWalletImpressionEvent({name:this.name,walletRank:this.walletRank,rdnsId:this.rdnsId,view:p.state.view,displayIndex:this.displayIndex}))}handleGetWalletNamespaces(){return Object.keys(q.state.adapters).length>1?this.namespaces:[]}render(){return I`
2236
+ <wui-list-wallet
2237
+ .walletImages=${this.walletImages}
2238
+ imageSrc=${G(this.imageSrc)}
2239
+ name=${this.name}
2240
+ size=${G(this.size)}
2241
+ tagLabel=${G(this.tagLabel)}
2242
+ .tagVariant=${this.tagVariant}
2243
+ .walletIcon=${this.walletIcon}
2244
+ .tabIdx=${this.tabIdx}
2245
+ .disabled=${this.disabled}
2246
+ .showAllWallets=${this.showAllWallets}
2247
+ .loading=${this.loading}
2248
+ loadingSpinnerColor=${this.loadingSpinnerColor}
2249
+ .namespaces=${this.handleGetWalletNamespaces()}
2250
+ ></wui-list-wallet>
2251
+ `}};Di.styles=_i,Ui([V({type:Array})],Di.prototype,"walletImages",void 0),Ui([V()],Di.prototype,"imageSrc",void 0),Ui([V()],Di.prototype,"name",void 0),Ui([V()],Di.prototype,"size",void 0),Ui([V()],Di.prototype,"tagLabel",void 0),Ui([V()],Di.prototype,"tagVariant",void 0),Ui([V()],Di.prototype,"walletIcon",void 0),Ui([V()],Di.prototype,"tabIdx",void 0),Ui([V({type:Boolean})],Di.prototype,"disabled",void 0),Ui([V({type:Boolean})],Di.prototype,"showAllWallets",void 0),Ui([V({type:Boolean})],Di.prototype,"loading",void 0),Ui([V({type:String})],Di.prototype,"loadingSpinnerColor",void 0),Ui([V()],Di.prototype,"rdnsId",void 0),Ui([V()],Di.prototype,"displayIndex",void 0),Ui([V()],Di.prototype,"walletRank",void 0),Ui([V({type:Array})],Di.prototype,"namespaces",void 0),Di=Ui([M("w3m-list-wallet")],Di);var Li=T`
2252
+ :host {
2253
+ --local-duration-height: 0s;
2254
+ --local-duration: ${({durations:e})=>e.lg};
2255
+ --local-transition: ${({easings:e})=>e["ease-out-power-2"]};
2256
+ }
2257
+
2258
+ .container {
2259
+ display: block;
2260
+ overflow: hidden;
2261
+ overflow: hidden;
2262
+ position: relative;
2263
+ height: var(--local-container-height);
2264
+ transition: height var(--local-duration-height) var(--local-transition);
2265
+ will-change: height, padding-bottom;
2266
+ }
2267
+
2268
+ .container[data-mobile-fullscreen='true'] {
2269
+ overflow: scroll;
2270
+ }
2271
+
2272
+ .page {
2273
+ position: absolute;
2274
+ top: 0;
2275
+ left: 0;
2276
+ right: 0;
2277
+ width: 100%;
2278
+ height: auto;
2279
+ width: inherit;
2280
+ box-sizing: border-box;
2281
+ display: flex;
2282
+ flex-direction: column;
2283
+ background-color: ${({tokens:e})=>e.theme.backgroundPrimary};
2284
+ border-bottom-left-radius: var(--local-border-bottom-radius);
2285
+ border-bottom-right-radius: var(--local-border-bottom-radius);
2286
+ transition: border-bottom-left-radius var(--local-duration) var(--local-transition);
2287
+ }
2288
+
2289
+ .page[data-mobile-fullscreen='true'] {
2290
+ height: 100%;
2291
+ }
2292
+
2293
+ .page-content {
2294
+ display: flex;
2295
+ flex-direction: column;
2296
+ min-height: 100%;
2297
+ }
2298
+
2299
+ .footer {
2300
+ height: var(--apkt-footer-height);
2301
+ }
2302
+
2303
+ div.page[view-direction^='prev-'] .page-content {
2304
+ animation:
2305
+ slide-left-out var(--local-duration) forwards var(--local-transition),
2306
+ slide-left-in var(--local-duration) forwards var(--local-transition);
2307
+ animation-delay: 0ms, var(--local-duration, ${({durations:e})=>e.lg});
2308
+ }
2309
+
2310
+ div.page[view-direction^='next-'] .page-content {
2311
+ animation:
2312
+ slide-right-out var(--local-duration) forwards var(--local-transition),
2313
+ slide-right-in var(--local-duration) forwards var(--local-transition);
2314
+ animation-delay: 0ms, var(--local-duration, ${({durations:e})=>e.lg});
2315
+ }
2316
+
2317
+ @keyframes slide-left-out {
2318
+ from {
2319
+ transform: translateX(0px) scale(1);
2320
+ opacity: 1;
2321
+ filter: blur(0px);
2322
+ }
2323
+ to {
2324
+ transform: translateX(8px) scale(0.99);
2325
+ opacity: 0;
2326
+ filter: blur(4px);
2327
+ }
2328
+ }
2329
+
2330
+ @keyframes slide-left-in {
2331
+ from {
2332
+ transform: translateX(-8px) scale(0.99);
2333
+ opacity: 0;
2334
+ filter: blur(4px);
2335
+ }
2336
+ to {
2337
+ transform: translateX(0) translateY(0) scale(1);
2338
+ opacity: 1;
2339
+ filter: blur(0px);
2340
+ }
2341
+ }
2342
+
2343
+ @keyframes slide-right-out {
2344
+ from {
2345
+ transform: translateX(0px) scale(1);
2346
+ opacity: 1;
2347
+ filter: blur(0px);
2348
+ }
2349
+ to {
2350
+ transform: translateX(-8px) scale(0.99);
2351
+ opacity: 0;
2352
+ filter: blur(4px);
2353
+ }
2354
+ }
2355
+
2356
+ @keyframes slide-right-in {
2357
+ from {
2358
+ transform: translateX(8px) scale(0.99);
2359
+ opacity: 0;
2360
+ filter: blur(4px);
2361
+ }
2362
+ to {
2363
+ transform: translateX(0) translateY(0) scale(1);
2364
+ opacity: 1;
2365
+ filter: blur(0px);
2366
+ }
2367
+ }
2368
+ `,Bi=function(e,t,i,o){var a,n=arguments.length,r=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let zi=class extends S{constructor(){super(...arguments),this.resizeObserver=void 0,this.transitionDuration="0.15s",this.transitionFunction="",this.history="",this.view="",this.setView=void 0,this.viewDirection="",this.historyState="",this.previousHeight="0px",this.mobileFullScreen=_.state.enableMobileFullScreen,this.onViewportResize=()=>{this.updateContainerHeight()}}updated(e){if(e.has("history")){const e=this.history;""!==this.historyState&&this.historyState!==e&&this.onViewChange(e)}e.has("transitionDuration")&&this.style.setProperty("--local-duration",this.transitionDuration),e.has("transitionFunction")&&this.style.setProperty("--local-transition",this.transitionFunction)}firstUpdated(){this.transitionFunction&&this.style.setProperty("--local-transition",this.transitionFunction),this.style.setProperty("--local-duration",this.transitionDuration),this.historyState=this.history,this.resizeObserver=new ResizeObserver((e=>{for(const t of e)if(t.target===this.getWrapper()){let e=t.contentRect.height;const i=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--apkt-footer-height")||"0");if(this.mobileFullScreen){e=(window.visualViewport?.height||window.innerHeight)-this.getHeaderHeight()-i,this.style.setProperty("--local-border-bottom-radius","0px")}else{e=e+i,this.style.setProperty("--local-border-bottom-radius",i?"var(--apkt-borderRadius-5)":"0px")}this.style.setProperty("--local-container-height",`${e}px`),"0px"!==this.previousHeight&&this.style.setProperty("--local-duration-height",this.transitionDuration),this.previousHeight=`${e}px`}})),this.resizeObserver.observe(this.getWrapper()),this.updateContainerHeight(),window.addEventListener("resize",this.onViewportResize),window.visualViewport?.addEventListener("resize",this.onViewportResize)}disconnectedCallback(){const e=this.getWrapper();e&&this.resizeObserver&&this.resizeObserver.unobserve(e),window.removeEventListener("resize",this.onViewportResize),window.visualViewport?.removeEventListener("resize",this.onViewportResize)}render(){return I`
2369
+ <div class="container" data-mobile-fullscreen="${G(this.mobileFullScreen)}">
2370
+ <div
2371
+ class="page"
2372
+ data-mobile-fullscreen="${G(this.mobileFullScreen)}"
2373
+ view-direction="${this.viewDirection}"
2374
+ >
2375
+ <div class="page-content">
2376
+ <slot></slot>
2377
+ </div>
2378
+ </div>
2379
+ </div>
2380
+ `}onViewChange(e){const t=e.split(",").filter(Boolean),i=this.historyState.split(",").filter(Boolean),o=i.length,a=t.length,n=t[t.length-1]||"",r=K.cssDurationToNumber(this.transitionDuration);let s="";a>o?s="next":a<o?s="prev":a===o&&t[a-1]!==i[o-1]&&(s="next"),this.viewDirection=`${s}-${n}`,setTimeout((()=>{this.historyState=e,this.setView?.(n)}),r),setTimeout((()=>{this.viewDirection=""}),2*r)}getWrapper(){return this.shadowRoot?.querySelector("div.page")}updateContainerHeight(){const e=this.getWrapper();if(!e)return;const t=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--apkt-footer-height")||"0");let i=0;if(this.mobileFullScreen){i=(window.visualViewport?.height||window.innerHeight)-this.getHeaderHeight()-t,this.style.setProperty("--local-border-bottom-radius","0px")}else i=e.getBoundingClientRect().height+t,this.style.setProperty("--local-border-bottom-radius",t?"var(--apkt-borderRadius-5)":"0px");this.style.setProperty("--local-container-height",`${i}px`),"0px"!==this.previousHeight&&this.style.setProperty("--local-duration-height",this.transitionDuration),this.previousHeight=`${i}px`}getHeaderHeight(){return 60}};zi.styles=[Li],Bi([V({type:String})],zi.prototype,"transitionDuration",void 0),Bi([V({type:String})],zi.prototype,"transitionFunction",void 0),Bi([V({type:String})],zi.prototype,"history",void 0),Bi([V({type:String})],zi.prototype,"view",void 0),Bi([V({attribute:!1})],zi.prototype,"setView",void 0),Bi([H()],zi.prototype,"viewDirection",void 0),Bi([H()],zi.prototype,"historyState",void 0),Bi([H()],zi.prototype,"previousHeight",void 0),Bi([H()],zi.prototype,"mobileFullScreen",void 0),zi=Bi([M("w3m-router-container")],zi);export{$i as AppKitModal,Di as W3mListWallet,Ci as W3mModal,Pi as W3mModalBase,zi as W3mRouterContainer,Oi as W3mUsageExceededView};