@prohetamine/redstone 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/dist/PhArrowCircleDown-BR-zH4LC.js +14 -0
  2. package/dist/PhArrowCircleDown-Sb38khBy.mjs +73 -0
  3. package/dist/PhArrowClockwise-BE5j9P0Z.mjs +73 -0
  4. package/dist/PhArrowClockwise-BRaehQGe.js +14 -0
  5. package/dist/PhArrowDown-B_WmmmY9.js +14 -0
  6. package/dist/PhArrowDown-CFEyR2dR.mjs +73 -0
  7. package/dist/PhArrowLeft-CYfU7NZj.mjs +73 -0
  8. package/dist/PhArrowLeft-CkEd70hm.js +14 -0
  9. package/dist/PhArrowRight-C07Qkx86.js +14 -0
  10. package/dist/PhArrowRight-EermNu0V.mjs +73 -0
  11. package/dist/PhArrowSquareOut-BjTBfzOP.js +14 -0
  12. package/dist/PhArrowSquareOut-DZwTtw54.mjs +73 -0
  13. package/dist/PhArrowUp-DB4CCSss.js +14 -0
  14. package/dist/PhArrowUp-xTpLFQkg.mjs +73 -0
  15. package/dist/PhArrowUpRight-CQbvn6NO.mjs +73 -0
  16. package/dist/PhArrowUpRight-GpCIMsAh.js +14 -0
  17. package/dist/PhArrowsClockwise-BgcIUg-Z.js +14 -0
  18. package/dist/PhArrowsClockwise-DnUYZTVx.mjs +73 -0
  19. package/dist/PhArrowsDownUp-C8KXUqtu.js +14 -0
  20. package/dist/PhArrowsDownUp-DgoprEe2.mjs +73 -0
  21. package/dist/PhArrowsLeftRight-CahChzCj.js +14 -0
  22. package/dist/PhArrowsLeftRight-FD4AZiLh.mjs +73 -0
  23. package/dist/PhBank-DIqIL4x_.js +14 -0
  24. package/dist/PhBank-DbQOQ9zJ.mjs +73 -0
  25. package/dist/PhBrowser-BCBXK2IM.mjs +73 -0
  26. package/dist/PhBrowser-laCKtn7T.js +14 -0
  27. package/dist/PhCaretDown-CnjP-QjZ.mjs +73 -0
  28. package/dist/PhCaretDown-DDe42xDU.js +14 -0
  29. package/dist/PhCaretLeft-Cskc5OY9.js +14 -0
  30. package/dist/PhCaretLeft-DkuXxjf_.mjs +73 -0
  31. package/dist/PhCaretRight-CBWpghxt.mjs +73 -0
  32. package/dist/PhCaretRight-DNgI5w_B.js +14 -0
  33. package/dist/PhCaretUp-CQ-OztBV.mjs +73 -0
  34. package/dist/PhCaretUp-CUZ4g_Me.js +14 -0
  35. package/dist/PhCheck-BVV_Dwfo.js +14 -0
  36. package/dist/PhCheck-t515emYS.mjs +73 -0
  37. package/dist/PhCircleHalf-BuQTmrKW.mjs +73 -0
  38. package/dist/PhCircleHalf-DDC7rige.js +14 -0
  39. package/dist/PhClock-BqynEKWl.js +14 -0
  40. package/dist/PhClock-D6XkTmM_.mjs +73 -0
  41. package/dist/PhCompass-2QeeX5Ad.mjs +73 -0
  42. package/dist/PhCompass-BsuJwXAE.js +14 -0
  43. package/dist/PhCopy-CO34-_xD.mjs +73 -0
  44. package/dist/PhCopy-MVqtRS6X.js +14 -0
  45. package/dist/PhCreditCard-Dq4kdjCw.js +14 -0
  46. package/dist/PhCreditCard-bfnqYflD.mjs +73 -0
  47. package/dist/PhCurrencyDollar-6k8UWxal.js +14 -0
  48. package/dist/PhCurrencyDollar-BekVYPtC.mjs +73 -0
  49. package/dist/PhDesktop-BkNzf3rT.mjs +73 -0
  50. package/dist/PhDesktop-CfsXQ0vC.js +14 -0
  51. package/dist/PhDeviceMobile-BT3Mg_b0.mjs +73 -0
  52. package/dist/PhDeviceMobile-BnrrDrwf.js +14 -0
  53. package/dist/PhDotsThree-6LRvhAcL.js +14 -0
  54. package/dist/PhDotsThree-kpf2OKxJ.mjs +73 -0
  55. package/dist/PhEnvelope-CHsfC2e0.js +14 -0
  56. package/dist/PhEnvelope-UFKpKtwf.mjs +73 -0
  57. package/dist/PhFunnelSimple-CdAqSIhK.mjs +73 -0
  58. package/dist/PhFunnelSimple-JAk7X9Wo.js +14 -0
  59. package/dist/PhGlobe-B3RYXl8h.mjs +73 -0
  60. package/dist/PhGlobe-Tfs4MfpG.js +14 -0
  61. package/dist/PhIdentificationCard-Dqmd6eY1.js +14 -0
  62. package/dist/PhIdentificationCard-rSq59Czm.mjs +73 -0
  63. package/dist/PhImage-aEryzfCi.js +14 -0
  64. package/dist/PhImage-ynsEnFd_.mjs +73 -0
  65. package/dist/PhInfo-B7lsWl6m.mjs +73 -0
  66. package/dist/PhInfo-D6oUrWpA.js +14 -0
  67. package/dist/PhLightbulb-FQDaMMqu.mjs +73 -0
  68. package/dist/PhLightbulb-qbEduhPa.js +14 -0
  69. package/dist/PhMagnifyingGlass-COdRH2k5.js +14 -0
  70. package/dist/PhMagnifyingGlass-_NXk13-0.mjs +73 -0
  71. package/dist/PhPaperPlaneRight-BYi7SorW.mjs +73 -0
  72. package/dist/PhPaperPlaneRight-DrpVAQOZ.js +14 -0
  73. package/dist/PhPlus-25KQTPHG.mjs +73 -0
  74. package/dist/PhPlus-BhUXef08.js +14 -0
  75. package/dist/PhPower-BKl7gzsB.mjs +73 -0
  76. package/dist/PhPower-BNJf1AGQ.js +14 -0
  77. package/dist/PhPuzzlePiece-BkZeF8CX.js +14 -0
  78. package/dist/PhPuzzlePiece-BqUI4GRs.mjs +73 -0
  79. package/dist/PhQrCode-C-tqZKPP.mjs +73 -0
  80. package/dist/PhQrCode-C0v0iXQN.js +14 -0
  81. package/dist/PhQuestion-BBAiRWgt.js +14 -0
  82. package/dist/PhQuestion-CtYvffyD.mjs +73 -0
  83. package/dist/PhQuestionMark-BNbtL2yx.mjs +73 -0
  84. package/dist/PhQuestionMark-BvGUBZ1h.js +14 -0
  85. package/dist/PhSealCheck-B0TEqWpq.mjs +73 -0
  86. package/dist/PhSealCheck-BwNkuF7G.js +14 -0
  87. package/dist/PhSignOut-C1rMSNaS.js +14 -0
  88. package/dist/PhSignOut-HX2_BVsD.mjs +73 -0
  89. package/dist/PhSpinner-CoDYLYOX.mjs +73 -0
  90. package/dist/PhSpinner-nmsGWDQl.js +14 -0
  91. package/dist/PhTrash-CALlKx3e.js +14 -0
  92. package/dist/PhTrash-DeQHS8ZP.mjs +73 -0
  93. package/dist/PhUser-CA0e5OPI.js +14 -0
  94. package/dist/PhUser-Cy5EY3vX.mjs +73 -0
  95. package/dist/PhVault-DdXjVOO9.mjs +73 -0
  96. package/dist/PhVault-DqxV75cz.js +14 -0
  97. package/dist/PhWallet-CeQrfGYc.mjs +73 -0
  98. package/dist/PhWallet-CyCuEs2U.js +14 -0
  99. package/dist/PhWarning-BKaHv_wT.mjs +73 -0
  100. package/dist/PhWarning-C7oj86bY.js +14 -0
  101. package/dist/PhWarningCircle-8MWw-QgE.mjs +73 -0
  102. package/dist/PhWarningCircle-CrNPXGj4.js +14 -0
  103. package/dist/PhX-9lsrXjyl.js +14 -0
  104. package/dist/PhX-DgXr_Fb0.mjs +73 -0
  105. package/dist/ReownAuthentication-Bfv31LzI.mjs +274 -0
  106. package/dist/ReownAuthentication-d8aYgGOq.js +5 -0
  107. package/dist/SwapController-4lzoYsYr.js +1 -0
  108. package/dist/SwapController-DjzUWRyQ.mjs +462 -0
  109. package/dist/ccip-CvwbEhki.js +1 -0
  110. package/dist/ccip-TuO68NeE.mjs +150 -0
  111. package/dist/data-capture-BwdjH2vc.mjs +489 -0
  112. package/dist/data-capture-xVUNZJ2T.js +242 -0
  113. package/dist/email-BCZObJCY.js +90 -0
  114. package/dist/email-m-wo60fN.mjs +338 -0
  115. package/dist/embedded-wallet-CGSri-4g.js +410 -0
  116. package/dist/embedded-wallet-DdZmv5qP.mjs +808 -0
  117. package/dist/features-BJ8kNaE8.js +1 -0
  118. package/dist/features-CJ34oImB.mjs +6 -0
  119. package/dist/index-4lfXeo30.js +132 -0
  120. package/dist/index-B6Mg114Z.mjs +69182 -0
  121. package/dist/index-BX7gAgT3.mjs +35 -0
  122. package/dist/index-BYQqNbCe.js +1 -0
  123. package/dist/index-BmdHwtJo.js +1 -0
  124. package/dist/index-BvUx3ULC.js +78 -0
  125. package/dist/index-CD-QGO70.mjs +196 -0
  126. package/dist/index-CJtXfdoM.mjs +29621 -0
  127. package/dist/index-CMzdgE-y.mjs +215 -0
  128. package/dist/index-CjZQCcwG.js +7203 -0
  129. package/dist/index-D7VuOaCI.js +19 -0
  130. package/dist/index-DV7SQwgn.mjs +2688 -0
  131. package/dist/index-DVf4BnNh.mjs +352 -0
  132. package/dist/index-DhN9vL4k.js +138 -0
  133. package/dist/index-DvllakY0.mjs +274 -0
  134. package/dist/index-Ho06VKh2.mjs +151 -0
  135. package/dist/index-a8mS2Eh1.js +1062 -0
  136. package/dist/index-aamBi9Tu.js +1 -0
  137. package/dist/index.cjs.js +1 -0
  138. package/dist/index.es.js +14 -0
  139. package/dist/onramp-DLlhSPQg.js +422 -0
  140. package/dist/onramp-k-EAEepC.mjs +842 -0
  141. package/dist/parseSignature-D1tZHglo.js +16 -0
  142. package/dist/parseSignature-DM0lwcDr.mjs +8883 -0
  143. package/dist/pay-with-exchange---G2M1Ag.js +280 -0
  144. package/dist/pay-with-exchange-CFIcUXUe.mjs +512 -0
  145. package/dist/property-Bd8U3_QP.mjs +618 -0
  146. package/dist/property-DissjCbZ.js +27 -0
  147. package/dist/receive-B9LCljO6.mjs +228 -0
  148. package/dist/receive-E8H6GDOX.js +131 -0
  149. package/dist/send-B-AooLph.js +554 -0
  150. package/dist/send-DZd_xhsd.mjs +1155 -0
  151. package/dist/socials-ChWFLEFe.mjs +611 -0
  152. package/dist/socials-YSUYSh8o.js +250 -0
  153. package/dist/swaps-DpR9W9Ld.js +1050 -0
  154. package/dist/swaps-Du7-Ui_V.mjs +1752 -0
  155. package/dist/transactions-DhsK5-QJ.mjs +35 -0
  156. package/dist/transactions-VPsz2OLe.js +16 -0
  157. package/dist/w3m-modal-DhomfjKU.js +891 -0
  158. package/dist/w3m-modal-KuYD-zqQ.mjs +1759 -0
  159. package/package.json +51 -0
  160. package/readme.md +1 -0
@@ -0,0 +1,1062 @@
1
+ "use strict";const n=require("./index-CjZQCcwG.js"),ee=n.css`
2
+ :host {
3
+ position: relative;
4
+ }
5
+
6
+ button {
7
+ display: flex;
8
+ justify-content: center;
9
+ align-items: center;
10
+ background-color: transparent;
11
+ padding: ${({spacing:t})=>t[1]};
12
+ }
13
+
14
+ /* -- Colors --------------------------------------------------- */
15
+ button[data-type='accent'] wui-icon {
16
+ color: ${({tokens:t})=>t.core.iconAccentPrimary};
17
+ }
18
+
19
+ button[data-type='neutral'][data-variant='primary'] wui-icon {
20
+ color: ${({tokens:t})=>t.theme.iconInverse};
21
+ }
22
+
23
+ button[data-type='neutral'][data-variant='secondary'] wui-icon {
24
+ color: ${({tokens:t})=>t.theme.iconDefault};
25
+ }
26
+
27
+ button[data-type='success'] wui-icon {
28
+ color: ${({tokens:t})=>t.core.iconSuccess};
29
+ }
30
+
31
+ button[data-type='error'] wui-icon {
32
+ color: ${({tokens:t})=>t.core.iconError};
33
+ }
34
+
35
+ /* -- Sizes --------------------------------------------------- */
36
+ button[data-size='xs'] {
37
+ width: 16px;
38
+ height: 16px;
39
+
40
+ border-radius: ${({borderRadius:t})=>t[1]};
41
+ }
42
+
43
+ button[data-size='sm'] {
44
+ width: 20px;
45
+ height: 20px;
46
+ border-radius: ${({borderRadius:t})=>t[1]};
47
+ }
48
+
49
+ button[data-size='md'] {
50
+ width: 24px;
51
+ height: 24px;
52
+ border-radius: ${({borderRadius:t})=>t[2]};
53
+ }
54
+
55
+ button[data-size='lg'] {
56
+ width: 28px;
57
+ height: 28px;
58
+ border-radius: ${({borderRadius:t})=>t[2]};
59
+ }
60
+
61
+ button[data-size='xs'] wui-icon {
62
+ width: 8px;
63
+ height: 8px;
64
+ }
65
+
66
+ button[data-size='sm'] wui-icon {
67
+ width: 12px;
68
+ height: 12px;
69
+ }
70
+
71
+ button[data-size='md'] wui-icon {
72
+ width: 16px;
73
+ height: 16px;
74
+ }
75
+
76
+ button[data-size='lg'] wui-icon {
77
+ width: 20px;
78
+ height: 20px;
79
+ }
80
+
81
+ /* -- Hover --------------------------------------------------- */
82
+ @media (hover: hover) {
83
+ button[data-type='accent']:hover:enabled {
84
+ background-color: ${({tokens:t})=>t.core.foregroundAccent010};
85
+ }
86
+
87
+ button[data-variant='primary'][data-type='neutral']:hover:enabled {
88
+ background-color: ${({tokens:t})=>t.theme.foregroundSecondary};
89
+ }
90
+
91
+ button[data-variant='secondary'][data-type='neutral']:hover:enabled {
92
+ background-color: ${({tokens:t})=>t.theme.foregroundSecondary};
93
+ }
94
+
95
+ button[data-type='success']:hover:enabled {
96
+ background-color: ${({tokens:t})=>t.core.backgroundSuccess};
97
+ }
98
+
99
+ button[data-type='error']:hover:enabled {
100
+ background-color: ${({tokens:t})=>t.core.backgroundError};
101
+ }
102
+ }
103
+
104
+ /* -- Focus --------------------------------------------------- */
105
+ button:focus-visible {
106
+ box-shadow: 0 0 0 4px ${({tokens:t})=>t.core.foregroundAccent020};
107
+ }
108
+
109
+ /* -- Properties --------------------------------------------------- */
110
+ button[data-full-width='true'] {
111
+ width: 100%;
112
+ }
113
+
114
+ :host([fullWidth]) {
115
+ width: 100%;
116
+ }
117
+
118
+ button[disabled] {
119
+ opacity: 0.5;
120
+ cursor: not-allowed;
121
+ }
122
+ `;var x=function(t,e,i,s){var r=arguments.length,o=r<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,i):s,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(o=(r<3?c(o):r>3?c(e,i,o):c(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o};let g=class extends n.i{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 n.b`<button
123
+ data-variant=${this.variant}
124
+ data-type=${this.type}
125
+ data-size=${this.size}
126
+ data-full-width=${this.fullWidth}
127
+ ?disabled=${this.disabled}
128
+ >
129
+ <wui-icon color="inherit" name=${this.icon} size=${n.o(this.iconSize)}></wui-icon>
130
+ </button>`}};g.styles=[n.resetStyles,n.elementStyles,ee];x([n.n()],g.prototype,"icon",void 0);x([n.n()],g.prototype,"variant",void 0);x([n.n()],g.prototype,"type",void 0);x([n.n()],g.prototype,"size",void 0);x([n.n()],g.prototype,"iconSize",void 0);x([n.n({type:Boolean})],g.prototype,"fullWidth",void 0);x([n.n({type:Boolean})],g.prototype,"disabled",void 0);g=x([n.customElement("wui-icon-button")],g);const d={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"},y={[d.INVALID_PAYMENT_CONFIG]:"Invalid payment configuration",[d.INVALID_RECIPIENT]:"Invalid recipient address",[d.INVALID_ASSET]:"Invalid asset specified",[d.INVALID_AMOUNT]:"Invalid payment amount",[d.INVALID_RECIPIENT_ADDRESS_FOR_ASSET]:"Invalid recipient address for the asset selected",[d.UNKNOWN_ERROR]:"Unknown payment error occurred",[d.UNABLE_TO_INITIATE_PAYMENT]:"Unable to initiate payment",[d.INVALID_CHAIN_NAMESPACE]:"Invalid chain namespace",[d.GENERIC_PAYMENT_ERROR]:"Unable to process payment",[d.UNABLE_TO_GET_EXCHANGES]:"Unable to get exchanges",[d.ASSET_NOT_SUPPORTED]:"Asset not supported by the selected exchange",[d.UNABLE_TO_GET_PAY_URL]:"Unable to get payment URL",[d.UNABLE_TO_GET_BUY_STATUS]:"Unable to get buy status",[d.UNABLE_TO_GET_TOKEN_BALANCES]:"Unable to get token balances",[d.UNABLE_TO_GET_QUOTE]:"Unable to get quote. Please choose a different token",[d.UNABLE_TO_GET_QUOTE_STATUS]:"Unable to get quote status"};class p extends Error{get message(){return y[this.code]}constructor(e,i){super(y[e]),this.name="AppKitPayError",this.code=e,this.details=i,Error.captureStackTrace&&Error.captureStackTrace(this,p)}}const te="https://rpc.walletconnect.org/v1/json-rpc",j="reown_test";function ne(){const{chainNamespace:t}=n.ParseUtil.parseCaipNetworkId(u.state.paymentAsset.network);if(!n.CoreHelperUtil.isAddress(u.state.recipient,t))throw new p(d.INVALID_RECIPIENT_ADDRESS_FOR_ASSET,`Provide valid recipient address for namespace "${t}"`)}async function ie(t,e,i){var l;if(e!==n.ConstantsUtil.CHAIN.EVM)throw new p(d.INVALID_CHAIN_NAMESPACE);if(!i.fromAddress)throw new p(d.INVALID_PAYMENT_CONFIG,"fromAddress is required for native EVM payments.");const s=typeof i.amount=="string"?parseFloat(i.amount):i.amount;if(isNaN(s))throw new p(d.INVALID_PAYMENT_CONFIG);const r=((l=t.metadata)==null?void 0:l.decimals)??18,o=n.ConnectionController.parseUnits(s.toString(),r);if(typeof o!="bigint")throw new p(d.GENERIC_PAYMENT_ERROR);return await n.ConnectionController.sendTransaction({chainNamespace:e,to:i.recipient,address:i.fromAddress,value:o,data:"0x"})??void 0}async function se(t,e){if(!e.fromAddress)throw new p(d.INVALID_PAYMENT_CONFIG,"fromAddress is required for ERC20 EVM payments.");const i=t.asset,s=e.recipient,r=Number(t.metadata.decimals),o=n.ConnectionController.parseUnits(e.amount.toString(),r);if(o===void 0)throw new p(d.GENERIC_PAYMENT_ERROR);return await n.ConnectionController.writeContract({fromAddress:e.fromAddress,tokenAddress:i,args:[s,o],method:"transfer",abi:n.ContractUtil.getERC20Abi(i),chainNamespace:n.ConstantsUtil.CHAIN.EVM})??void 0}async function re(t,e){if(t!==n.ConstantsUtil.CHAIN.SOLANA)throw new p(d.INVALID_CHAIN_NAMESPACE);if(!e.fromAddress)throw new p(d.INVALID_PAYMENT_CONFIG,"fromAddress is required for Solana payments.");const i=typeof e.amount=="string"?parseFloat(e.amount):e.amount;if(isNaN(i)||i<=0)throw new p(d.INVALID_PAYMENT_CONFIG,"Invalid payment amount.");try{if(!n.ProviderController.getProvider(t))throw new p(d.GENERIC_PAYMENT_ERROR,"No Solana provider available.");const r=await n.ConnectionController.sendTransaction({chainNamespace:n.ConstantsUtil.CHAIN.SOLANA,to:e.recipient,value:i,tokenMint:e.tokenMint});if(!r)throw new p(d.GENERIC_PAYMENT_ERROR,"Transaction failed.");return r}catch(s){throw s instanceof p?s:new p(d.GENERIC_PAYMENT_ERROR,`Solana payment failed: ${s}`)}}async function oe({sourceToken:t,toToken:e,amount:i,recipient:s}){const r=n.ConnectionController.parseUnits(i,t.metadata.decimals),o=n.ConnectionController.parseUnits(i,e.metadata.decimals);return Promise.resolve({type:q,origin:{amount:(r==null?void 0:r.toString())??"0",currency:t},destination:{amount:(o==null?void 0:o.toString())??"0",currency:e},fees:[{id:"service",label:"Service Fee",amount:"0",currency:e}],steps:[{requestId:q,type:"deposit",deposit:{amount:(r==null?void 0:r.toString())??"0",currency:t.asset,receiver:s}}],timeInSeconds:6})}function L(t){if(!t)return null;const e=t.steps[0];return!e||e.type!==xe?null:e}function U(t,e=0){if(!t)return[];const i=t.steps.filter(r=>r.type===Ae),s=i.filter((r,o)=>o+1>e);return i.length>0&&i.length<3?s:[]}const F=new n.FetchUtil({baseUrl:n.CoreHelperUtil.getApiUrl(),clientId:null});class ae extends Error{}function ce(){const t=n.OptionsController.getSnapshot().projectId;return`${te}?projectId=${t}`}function V(){const{projectId:t,sdkType:e,sdkVersion:i}=n.OptionsController.state;return{projectId:t,st:e||"appkit",sv:i||"html-wagmi-4.2.2"}}async function B(t,e){const i=ce(),{sdkType:s,sdkVersion:r,projectId:o}=n.OptionsController.getSnapshot(),c={jsonrpc:"2.0",id:1,method:t,params:{...e||{},st:s,sv:r,projectId:o}},h=await(await fetch(i,{method:"POST",body:JSON.stringify(c),headers:{"Content-Type":"application/json"}})).json();if(h.error)throw new ae(h.error.message);return h}async function z(t){return(await B("reown_getExchanges",t)).result}async function G(t){return(await B("reown_getExchangePayUrl",t)).result}async function le(t){return(await B("reown_getExchangeBuyStatus",t)).result}async function ue(t){const e=n.NumberUtil.bigNumber(t.amount).times(10**t.toToken.metadata.decimals).toString(),{chainId:i,chainNamespace:s}=n.ParseUtil.parseCaipNetworkId(t.sourceToken.network),{chainId:r,chainNamespace:o}=n.ParseUtil.parseCaipNetworkId(t.toToken.network),c=t.sourceToken.asset==="native"?n.getNativeTokenAddress(s):t.sourceToken.asset,l=t.toToken.asset==="native"?n.getNativeTokenAddress(o):t.toToken.asset;return await F.post({path:"/appkit/v1/transfers/quote",body:{user:t.address,originChainId:i.toString(),originCurrency:c,destinationChainId:r.toString(),destinationCurrency:l,recipient:t.recipient,amount:e},params:V()})}async function de(t){const e=n.HelpersUtil$1.isLowerCaseMatch(t.sourceToken.network,t.toToken.network),i=n.HelpersUtil$1.isLowerCaseMatch(t.sourceToken.asset,t.toToken.asset);return e&&i?oe(t):ue(t)}async function pe(t){return await F.get({path:"/appkit/v1/transfers/status",params:{requestId:t.requestId,...V()}})}async function he(t){return await F.get({path:`/appkit/v1/transfers/assets/exchanges/${t}`,params:V()})}const me=["eip155","solana"],ge={eip155:{native:{assetNamespace:"slip44",assetReference:"60"},defaultTokenNamespace:"erc20"},solana:{native:{assetNamespace:"slip44",assetReference:"501"},defaultTokenNamespace:"token"}},H={56:"714",204:"714"};function R(t,e){const{chainNamespace:i,chainId:s}=n.ParseUtil.parseCaipNetworkId(t),r=ge[i];if(!r)throw new Error(`Unsupported chain namespace for CAIP-19 formatting: ${i}`);let o=r.native.assetNamespace,c=r.native.assetReference;return e!=="native"?(o=r.defaultTokenNamespace,c=e):i==="eip155"&&H[s]&&(c=H[s]),`${`${i}:${s}`}/${o}:${c}`}function we(t){const{chainNamespace:e}=n.ParseUtil.parseCaipNetworkId(t);return me.includes(e)}function fe(t){const i=n.ChainController.getAllRequestedCaipNetworks().find(r=>r.caipNetworkId===t.chainId);let s=t.address;if(!i)throw new Error(`Target network not found for balance chainId "${t.chainId}"`);if(n.HelpersUtil$1.isLowerCaseMatch(t.symbol,i.nativeCurrency.symbol))s="native";else if(n.CoreHelperUtil.isCaipAddress(s)){const{address:r}=n.ParseUtil.parseCaipAddress(s);s=r}else if(!s)throw new Error(`Balance address not found for balance symbol "${t.symbol}"`);return{network:i.caipNetworkId,asset:s,metadata:{name:t.name,symbol:t.symbol,decimals:Number(t.quantity.decimals),logoURI:t.iconUrl},amount:t.quantity.numeric}}function ye(t){return{chainId:t.network,address:`${t.network}:${t.asset}`,symbol:t.metadata.symbol,name:t.metadata.name,iconUrl:t.metadata.logoURI||"",price:0,quantity:{numeric:"0",decimals:t.metadata.decimals.toString()}}}function S(t){const e=n.NumberUtil.bigNumber(t,{safe:!0});return e.lt(.001)?"<0.001":e.round(4).toString()}function be(t){const i=n.ChainController.getAllRequestedCaipNetworks().find(s=>s.caipNetworkId===t.network);return i?!!i.testnet:!1}const Y=0,O="unknown",q="direct-transfer",xe="deposit",Ae="transaction",a=n.proxy({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:{[n.ConstantsUtil.CHAIN.EVM]:[],[n.ConstantsUtil.CHAIN.SOLANA]:[]},isFetchingTokenBalances:!1,selectedPaymentAsset:null,quote:void 0,quoteStatus:"waiting",quoteError:null,isFetchingQuote:!1,selectedExchange:void 0,exchangeUrlForQuote:void 0,requestId:void 0}),u={state:a,subscribe(t){return n.subscribe(a,()=>t(a))},subscribeKey(t,e){return n.subscribeKey(a,t,e)},async handleOpenPay(t){this.resetState(),this.setPaymentConfig(t),this.initializeAnalytics(),ne(),await this.prepareTokenLogo(),a.isConfigured=!0,n.EventsController.sendEvent({type:"track",event:"PAY_MODAL_OPEN",properties:{exchanges:a.exchanges,configuration:{network:a.paymentAsset.network,asset:a.paymentAsset.asset,recipient:a.recipient,amount:a.amount}}}),await n.ModalController.open({view:"Pay"})},resetState(){a.paymentAsset={network:"eip155:1",asset:"0x0",metadata:{name:"0x0",symbol:"0x0",decimals:0}},a.recipient="0x0",a.amount=0,a.isConfigured=!1,a.error=null,a.isPaymentInProgress=!1,a.isLoading=!1,a.currentPayment=void 0,a.selectedExchange=void 0,a.exchangeUrlForQuote=void 0,a.requestId=void 0},resetQuoteState(){a.quote=void 0,a.quoteStatus="waiting",a.quoteError=null,a.isFetchingQuote=!1,a.requestId=void 0},setPaymentConfig(t){if(!t.paymentAsset)throw new p(d.INVALID_PAYMENT_CONFIG);try{a.choice=t.choice??"pay",a.paymentAsset=t.paymentAsset,a.recipient=t.recipient,a.amount=t.amount,a.openInNewTab=t.openInNewTab??!0,a.redirectUrl=t.redirectUrl,a.payWithExchange=t.payWithExchange,a.error=null}catch(e){throw new p(d.INVALID_PAYMENT_CONFIG,e.message)}},setSelectedPaymentAsset(t){a.selectedPaymentAsset=t},setSelectedExchange(t){a.selectedExchange=t},setRequestId(t){a.requestId=t},setPaymentInProgress(t){a.isPaymentInProgress=t},getPaymentAsset(){return a.paymentAsset},getExchanges(){return a.exchanges},async fetchExchanges(){try{a.isLoading=!0;const t=await z({page:Y});a.exchanges=t.exchanges.slice(0,2)}catch{throw n.SnackController.showError(y.UNABLE_TO_GET_EXCHANGES),new p(d.UNABLE_TO_GET_EXCHANGES)}finally{a.isLoading=!1}},async getAvailableExchanges(t){var e;try{const i=t!=null&&t.asset&&(t!=null&&t.network)?R(t.network,t.asset):void 0;return await z({page:(t==null?void 0:t.page)??Y,asset:i,amount:(e=t==null?void 0:t.amount)==null?void 0:e.toString()})}catch{throw new p(d.UNABLE_TO_GET_EXCHANGES)}},async getPayUrl(t,e,i=!1){try{const s=Number(e.amount),r=await G({exchangeId:t,asset:R(e.network,e.asset),amount:s.toString(),recipient:`${e.network}:${e.recipient}`});return n.EventsController.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{source:"pay",exchange:{id:t},configuration:{network:e.network,asset:e.asset,recipient:e.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},headless:i}}),i&&(this.initiatePayment(),n.EventsController.sendEvent({type:"track",event:"PAY_INITIATED",properties:{source:"pay",paymentId:a.paymentId||O,configuration:{network:e.network,asset:e.asset,recipient:e.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t}}})),r}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new p(d.ASSET_NOT_SUPPORTED):new Error(s.message)}},async generateExchangeUrlForQuote({exchangeId:t,paymentAsset:e,amount:i,recipient:s}){const r=await G({exchangeId:t,asset:R(e.network,e.asset),amount:i.toString(),recipient:s});a.exchangeSessionId=r.sessionId,a.exchangeUrlForQuote=r.url},async openPayUrl(t,e,i=!1){try{const s=await this.getPayUrl(t.exchangeId,e,i);if(!s)throw new p(d.UNABLE_TO_GET_PAY_URL);const o=t.openInNewTab??!0?"_blank":"_self";return n.CoreHelperUtil.openHref(s.url,o),s}catch(s){throw s instanceof p?a.error=s.message:a.error=y.GENERIC_PAYMENT_ERROR,new p(d.UNABLE_TO_GET_PAY_URL)}},async onTransfer({chainNamespace:t,fromAddress:e,toAddress:i,amount:s,paymentAsset:r}){if(a.currentPayment={type:"wallet",status:"IN_PROGRESS"},!a.isPaymentInProgress)try{this.initiatePayment();const c=n.ChainController.getAllRequestedCaipNetworks().find(h=>h.caipNetworkId===r.network);if(!c)throw new Error("Target network not found");const l=n.ChainController.state.activeCaipNetwork;switch(n.HelpersUtil$1.isLowerCaseMatch(l==null?void 0:l.caipNetworkId,c.caipNetworkId)||await n.ChainController.switchActiveNetwork(c),t){case n.ConstantsUtil.CHAIN.EVM:r.asset==="native"&&(a.currentPayment.result=await ie(r,t,{recipient:i,amount:s,fromAddress:e})),r.asset.startsWith("0x")&&(a.currentPayment.result=await se(r,{recipient:i,amount:s,fromAddress:e})),a.currentPayment.status="SUCCESS";break;case n.ConstantsUtil.CHAIN.SOLANA:a.currentPayment.result=await re(t,{recipient:i,amount:s,fromAddress:e,tokenMint:r.asset==="native"?void 0:r.asset}),a.currentPayment.status="SUCCESS";break;default:throw new p(d.INVALID_CHAIN_NAMESPACE)}}catch(o){throw o instanceof p?a.error=o.message:a.error=y.GENERIC_PAYMENT_ERROR,a.currentPayment.status="FAILED",n.SnackController.showError(a.error),o}finally{a.isPaymentInProgress=!1}},async onSendTransaction(t){try{const{namespace:e,transactionStep:i}=t;u.initiatePayment();const r=n.ChainController.getAllRequestedCaipNetworks().find(c=>{var l;return c.caipNetworkId===((l=a.paymentAsset)==null?void 0:l.network)});if(!r)throw new Error("Target network not found");const o=n.ChainController.state.activeCaipNetwork;if(n.HelpersUtil$1.isLowerCaseMatch(o==null?void 0:o.caipNetworkId,r.caipNetworkId)||await n.ChainController.switchActiveNetwork(r),e===n.ConstantsUtil.CHAIN.EVM){const{from:c,to:l,data:h,value:f}=i.transaction;await n.ConnectionController.sendTransaction({address:c,to:l,data:h,value:BigInt(f),chainNamespace:e})}else if(e===n.ConstantsUtil.CHAIN.SOLANA){const{instructions:c}=i.transaction;await n.ConnectionController.writeSolanaTransaction({instructions:c})}}catch(e){throw e instanceof p?a.error=e.message:a.error=y.GENERIC_PAYMENT_ERROR,n.SnackController.showError(a.error),e}finally{a.isPaymentInProgress=!1}},getExchangeById(t){return a.exchanges.find(e=>e.id===t)},validatePayConfig(t){const{paymentAsset:e,recipient:i,amount:s}=t;if(!e)throw new p(d.INVALID_PAYMENT_CONFIG);if(!i)throw new p(d.INVALID_RECIPIENT);if(!e.asset)throw new p(d.INVALID_ASSET);if(s==null||s<=0)throw new p(d.INVALID_AMOUNT)},async handlePayWithExchange(t){try{a.currentPayment={type:"exchange",exchangeId:t};const{network:e,asset:i}=a.paymentAsset,s={network:e,asset:i,amount:a.amount,recipient:a.recipient},r=await this.getPayUrl(t,s);if(!r)throw new p(d.UNABLE_TO_INITIATE_PAYMENT);return a.currentPayment.sessionId=r.sessionId,a.currentPayment.status="IN_PROGRESS",a.currentPayment.exchangeId=t,this.initiatePayment(),{url:r.url,openInNewTab:a.openInNewTab}}catch(e){return e instanceof p?a.error=e.message:a.error=y.GENERIC_PAYMENT_ERROR,a.isPaymentInProgress=!1,n.SnackController.showError(a.error),null}},async getBuyStatus(t,e){var i,s;try{const r=await le({sessionId:e,exchangeId:t});return(r.status==="SUCCESS"||r.status==="FAILED")&&n.EventsController.sendEvent({type:"track",event:r.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:r.status==="FAILED"?n.CoreHelperUtil.parseError(a.error):void 0,source:"pay",paymentId:a.paymentId||O,configuration:{network:a.paymentAsset.network,asset:a.paymentAsset.asset,recipient:a.recipient,amount:a.amount},currentPayment:{type:"exchange",exchangeId:(i=a.currentPayment)==null?void 0:i.exchangeId,sessionId:(s=a.currentPayment)==null?void 0:s.sessionId,result:r.txHash}}}),r}catch{throw new p(d.UNABLE_TO_GET_BUY_STATUS)}},async fetchTokensFromEOA({caipAddress:t,caipNetwork:e,namespace:i}){if(!t)return[];const{address:s}=n.ParseUtil.parseCaipAddress(t);let r=e;return i===n.ConstantsUtil.CHAIN.EVM&&(r=void 0),await n.BalanceUtil.getMyTokensWithBalance({address:s,caipNetwork:r})},async fetchTokensFromExchange(){if(!a.selectedExchange)return[];const t=await he(a.selectedExchange.id),e=Object.values(t.assets).flat();return await Promise.all(e.map(async s=>{const r=ye(s),{chainNamespace:o}=n.ParseUtil.parseCaipNetworkId(r.chainId);let c=r.address;if(n.CoreHelperUtil.isCaipAddress(c)){const{address:h}=n.ParseUtil.parseCaipAddress(c);c=h}const l=await n.AssetUtil.getImageByToken(c??"",o).catch(()=>{});return r.iconUrl=l??"",r}))},async fetchTokens({caipAddress:t,caipNetwork:e,namespace:i}){try{a.isFetchingTokenBalances=!0;const o=await(!!a.selectedExchange?this.fetchTokensFromExchange():this.fetchTokensFromEOA({caipAddress:t,caipNetwork:e,namespace:i}));a.tokenBalances={...a.tokenBalances,[i]:o}}catch(s){const r=s instanceof Error?s.message:"Unable to get token balances";n.SnackController.showError(r)}finally{a.isFetchingTokenBalances=!1}},async fetchQuote({amount:t,address:e,sourceToken:i,toToken:s,recipient:r}){try{u.resetQuoteState(),a.isFetchingQuote=!0;const o=await de({amount:t,address:a.selectedExchange?void 0:e,sourceToken:i,toToken:s,recipient:r});if(a.selectedExchange){const c=L(o);if(c){const l=`${i.network}:${c.deposit.receiver}`,h=n.NumberUtil.formatNumber(c.deposit.amount,{decimals:i.metadata.decimals??0,round:8});await u.generateExchangeUrlForQuote({exchangeId:a.selectedExchange.id,paymentAsset:i,amount:h.toString(),recipient:l})}}a.quote=o}catch(o){let c=y.UNABLE_TO_GET_QUOTE;if(o instanceof Error&&o.cause&&o.cause instanceof Response)try{const l=await o.cause.json();l.error&&typeof l.error=="string"&&(c=l.error)}catch{}throw a.quoteError=c,n.SnackController.showError(c),new p(d.UNABLE_TO_GET_QUOTE)}finally{a.isFetchingQuote=!1}},async fetchQuoteStatus({requestId:t}){try{if(t===q){const i=a.selectedExchange,s=a.exchangeSessionId;if(i&&s){switch((await this.getBuyStatus(i.id,s)).status){case"IN_PROGRESS":a.quoteStatus="waiting";break;case"SUCCESS":a.quoteStatus="success",a.isPaymentInProgress=!1;break;case"FAILED":a.quoteStatus="failure",a.isPaymentInProgress=!1;break;case"UNKNOWN":a.quoteStatus="waiting";break;default:a.quoteStatus="waiting";break}return}a.quoteStatus="success";return}const{status:e}=await pe({requestId:t});a.quoteStatus=e}catch{throw a.quoteStatus="failure",new p(d.UNABLE_TO_GET_QUOTE_STATUS)}},initiatePayment(){a.isPaymentInProgress=!0,a.paymentId=crypto.randomUUID()},initializeAnalytics(){a.analyticsSet||(a.analyticsSet=!0,this.subscribeKey("isPaymentInProgress",t=>{var e;if((e=a.currentPayment)!=null&&e.status&&a.currentPayment.status!=="UNKNOWN"){const i={IN_PROGRESS:"PAY_INITIATED",SUCCESS:"PAY_SUCCESS",FAILED:"PAY_ERROR"}[a.currentPayment.status];n.EventsController.sendEvent({type:"track",event:i,properties:{message:a.currentPayment.status==="FAILED"?n.CoreHelperUtil.parseError(a.error):void 0,source:"pay",paymentId:a.paymentId||O,configuration:{network:a.paymentAsset.network,asset:a.paymentAsset.asset,recipient:a.recipient,amount:a.amount},currentPayment:{type:a.currentPayment.type,exchangeId:a.currentPayment.exchangeId,sessionId:a.currentPayment.sessionId,result:a.currentPayment.result}}})}}))},async prepareTokenLogo(){if(!a.paymentAsset.metadata.logoURI)try{const{chainNamespace:t}=n.ParseUtil.parseCaipNetworkId(a.paymentAsset.network),e=await n.AssetUtil.getImageByToken(a.paymentAsset.asset,t);a.paymentAsset.metadata.logoURI=e}catch{}}},Ee=n.css`
131
+ wui-separator {
132
+ margin: var(--apkt-spacing-3) calc(var(--apkt-spacing-3) * -1) var(--apkt-spacing-2)
133
+ calc(var(--apkt-spacing-3) * -1);
134
+ width: calc(100% + var(--apkt-spacing-3) * 2);
135
+ }
136
+
137
+ .token-display {
138
+ padding: var(--apkt-spacing-3) var(--apkt-spacing-3);
139
+ border-radius: var(--apkt-borderRadius-5);
140
+ background-color: var(--apkt-tokens-theme-backgroundPrimary);
141
+ margin-top: var(--apkt-spacing-3);
142
+ margin-bottom: var(--apkt-spacing-3);
143
+ }
144
+
145
+ .token-display wui-text {
146
+ text-transform: none;
147
+ }
148
+
149
+ wui-loading-spinner {
150
+ padding: var(--apkt-spacing-2);
151
+ }
152
+
153
+ .left-image-container {
154
+ position: relative;
155
+ justify-content: center;
156
+ align-items: center;
157
+ }
158
+
159
+ .token-image {
160
+ border-radius: ${({borderRadius:t})=>t.round};
161
+ width: 40px;
162
+ height: 40px;
163
+ }
164
+
165
+ .chain-image {
166
+ position: absolute;
167
+ width: 20px;
168
+ height: 20px;
169
+ bottom: -3px;
170
+ right: -5px;
171
+ border-radius: ${({borderRadius:t})=>t.round};
172
+ border: 2px solid ${({tokens:t})=>t.theme.backgroundPrimary};
173
+ }
174
+
175
+ .payment-methods-container {
176
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
177
+ border-top-right-radius: ${({borderRadius:t})=>t[8]};
178
+ border-top-left-radius: ${({borderRadius:t})=>t[8]};
179
+ }
180
+ `;var A=function(t,e,i,s){var r=arguments.length,o=r<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,i):s,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(o=(r<3?c(o):r>3?c(e,i,o):c(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o};exports.W3mPayView=class extends n.i{constructor(){super(),this.unsubscribe=[],this.amount=u.state.amount,this.namespace=void 0,this.paymentAsset=u.state.paymentAsset,this.activeConnectorIds=n.ConnectorController.state.activeConnectorIds,this.caipAddress=void 0,this.exchanges=u.state.exchanges,this.isLoading=u.state.isLoading,this.initializeNamespace(),this.unsubscribe.push(u.subscribeKey("amount",e=>this.amount=e)),this.unsubscribe.push(n.ConnectorController.subscribeKey("activeConnectorIds",e=>this.activeConnectorIds=e)),this.unsubscribe.push(u.subscribeKey("exchanges",e=>this.exchanges=e)),this.unsubscribe.push(u.subscribeKey("isLoading",e=>this.isLoading=e)),u.fetchExchanges(),u.setSelectedExchange(void 0)}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return n.b`
181
+ <wui-flex flexDirection="column">
182
+ ${this.paymentDetailsTemplate()} ${this.paymentMethodsTemplate()}
183
+ </wui-flex>
184
+ `}paymentMethodsTemplate(){return n.b`
185
+ <wui-flex flexDirection="column" padding="3" gap="2" class="payment-methods-container">
186
+ ${this.payWithWalletTemplate()} ${this.templateSeparator()}
187
+ ${this.templateExchangeOptions()}
188
+ </wui-flex>
189
+ `}initializeNamespace(){var i;const e=n.ChainController.state.activeChain;this.namespace=e,this.caipAddress=(i=n.ChainController.getAccountData(e))==null?void 0:i.caipAddress,this.unsubscribe.push(n.ChainController.subscribeChainProp("accountState",s=>{this.caipAddress=s==null?void 0:s.caipAddress},e))}paymentDetailsTemplate(){const i=n.ChainController.getAllRequestedCaipNetworks().find(s=>s.caipNetworkId===this.paymentAsset.network);return n.b`
190
+ <wui-flex
191
+ alignItems="center"
192
+ justifyContent="space-between"
193
+ .padding=${["6","8","6","8"]}
194
+ gap="2"
195
+ >
196
+ <wui-flex alignItems="center" gap="1">
197
+ <wui-text variant="h1-regular" color="primary">
198
+ ${S(this.amount||"0")}
199
+ </wui-text>
200
+
201
+ <wui-flex flexDirection="column">
202
+ <wui-text variant="h6-regular" color="secondary">
203
+ ${this.paymentAsset.metadata.symbol||"Unknown"}
204
+ </wui-text>
205
+ <wui-text variant="md-medium" color="secondary"
206
+ >on ${(i==null?void 0:i.name)||"Unknown"}</wui-text
207
+ >
208
+ </wui-flex>
209
+ </wui-flex>
210
+
211
+ <wui-flex class="left-image-container">
212
+ <wui-image
213
+ src=${n.o(this.paymentAsset.metadata.logoURI)}
214
+ class="token-image"
215
+ ></wui-image>
216
+ <wui-image
217
+ src=${n.o(n.AssetUtil.getNetworkImage(i))}
218
+ class="chain-image"
219
+ ></wui-image>
220
+ </wui-flex>
221
+ </wui-flex>
222
+ `}payWithWalletTemplate(){return we(this.paymentAsset.network)?this.caipAddress?this.connectedWalletTemplate():this.disconnectedWalletTemplate():n.b``}connectedWalletTemplate(){const{name:e,image:i}=this.getWalletProperties({namespace:this.namespace});return n.b`
223
+ <wui-flex flexDirection="column" gap="3">
224
+ <wui-list-item
225
+ type="secondary"
226
+ boxColor="foregroundSecondary"
227
+ @click=${this.onWalletPayment}
228
+ .boxed=${!1}
229
+ ?chevron=${!0}
230
+ ?fullSize=${!1}
231
+ ?rounded=${!0}
232
+ data-testid="wallet-payment-option"
233
+ imageSrc=${n.o(i)}
234
+ imageSize="3xl"
235
+ >
236
+ <wui-text variant="lg-regular" color="primary">Pay with ${e}</wui-text>
237
+ </wui-list-item>
238
+
239
+ <wui-list-item
240
+ type="secondary"
241
+ icon="power"
242
+ iconColor="error"
243
+ @click=${this.onDisconnect}
244
+ data-testid="disconnect-button"
245
+ ?chevron=${!1}
246
+ boxColor="foregroundSecondary"
247
+ >
248
+ <wui-text variant="lg-regular" color="secondary">Disconnect</wui-text>
249
+ </wui-list-item>
250
+ </wui-flex>
251
+ `}disconnectedWalletTemplate(){return n.b`<wui-list-item
252
+ type="secondary"
253
+ boxColor="foregroundSecondary"
254
+ variant="icon"
255
+ iconColor="default"
256
+ iconVariant="overlay"
257
+ icon="wallet"
258
+ @click=${this.onWalletPayment}
259
+ ?chevron=${!0}
260
+ data-testid="wallet-payment-option"
261
+ >
262
+ <wui-text variant="lg-regular" color="primary">Pay with wallet</wui-text>
263
+ </wui-list-item>`}templateExchangeOptions(){if(this.isLoading)return n.b`<wui-flex justifyContent="center" alignItems="center">
264
+ <wui-loading-spinner size="md"></wui-loading-spinner>
265
+ </wui-flex>`;const e=this.exchanges.filter(i=>be(this.paymentAsset)?i.id===j:i.id!==j);return e.length===0?n.b`<wui-flex justifyContent="center" alignItems="center">
266
+ <wui-text variant="md-medium" color="primary">No exchanges available</wui-text>
267
+ </wui-flex>`:e.map(i=>n.b`
268
+ <wui-list-item
269
+ type="secondary"
270
+ boxColor="foregroundSecondary"
271
+ @click=${()=>this.onExchangePayment(i)}
272
+ data-testid="exchange-option-${i.id}"
273
+ ?chevron=${!0}
274
+ imageSrc=${n.o(i.imageUrl)}
275
+ >
276
+ <wui-text flexGrow="1" variant="lg-regular" color="primary">
277
+ Pay with ${i.name}
278
+ </wui-text>
279
+ </wui-list-item>
280
+ `)}templateSeparator(){return n.b`<wui-separator text="or" bgColor="secondary"></wui-separator>`}async onWalletPayment(){if(!this.namespace)throw new Error("Namespace not found");this.caipAddress?n.RouterController.push("PayQuote"):(await n.ConnectorController.connect(),await n.ModalController.open({view:"PayQuote"}))}onExchangePayment(e){u.setSelectedExchange(e),n.RouterController.push("PayQuote")}async onDisconnect(){try{await n.ConnectionController.disconnect(),await n.ModalController.open({view:"Pay"})}catch{console.error("Failed to disconnect"),n.SnackController.showError("Failed to disconnect")}}getWalletProperties({namespace:e}){if(!e)return{name:void 0,image:void 0};const i=this.activeConnectorIds[e];if(!i)return{name:void 0,image:void 0};const s=n.ConnectorController.getConnector({id:i,namespace:e});if(!s)return{name:void 0,image:void 0};const r=n.AssetUtil.getConnectorImage(s);return{name:s.name,image:r}}};exports.W3mPayView.styles=Ee;A([n.r()],exports.W3mPayView.prototype,"amount",void 0);A([n.r()],exports.W3mPayView.prototype,"namespace",void 0);A([n.r()],exports.W3mPayView.prototype,"paymentAsset",void 0);A([n.r()],exports.W3mPayView.prototype,"activeConnectorIds",void 0);A([n.r()],exports.W3mPayView.prototype,"caipAddress",void 0);A([n.r()],exports.W3mPayView.prototype,"exchanges",void 0);A([n.r()],exports.W3mPayView.prototype,"isLoading",void 0);exports.W3mPayView=A([n.customElement("w3m-pay-view")],exports.W3mPayView);const Ce=n.css`
281
+ :host {
282
+ display: inline-flex;
283
+ align-items: center;
284
+ justify-content: center;
285
+ }
286
+
287
+ .pulse-container {
288
+ position: relative;
289
+ width: var(--pulse-size);
290
+ height: var(--pulse-size);
291
+ display: flex;
292
+ align-items: center;
293
+ justify-content: center;
294
+ }
295
+
296
+ .pulse-rings {
297
+ position: absolute;
298
+ inset: 0;
299
+ pointer-events: none;
300
+ }
301
+
302
+ .pulse-ring {
303
+ position: absolute;
304
+ inset: 0;
305
+ border-radius: 50%;
306
+ border: 2px solid var(--pulse-color);
307
+ opacity: 0;
308
+ animation: pulse var(--pulse-duration, 2s) ease-out infinite;
309
+ }
310
+
311
+ .pulse-content {
312
+ position: relative;
313
+ z-index: 1;
314
+ display: flex;
315
+ align-items: center;
316
+ justify-content: center;
317
+ }
318
+
319
+ @keyframes pulse {
320
+ 0% {
321
+ transform: scale(0.5);
322
+ opacity: var(--pulse-opacity, 0.3);
323
+ }
324
+ 50% {
325
+ opacity: calc(var(--pulse-opacity, 0.3) * 0.5);
326
+ }
327
+ 100% {
328
+ transform: scale(1.2);
329
+ opacity: 0;
330
+ }
331
+ }
332
+ `;var C=function(t,e,i,s){var r=arguments.length,o=r<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,i):s,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(o=(r<3?c(o):r>3?c(e,i,o):c(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o};const Ie=3,Pe=2,Ne=.3,ve="200px",Te={"accent-primary":n.vars.tokens.core.backgroundAccentPrimary};let b=class extends n.i{constructor(){super(...arguments),this.rings=Ie,this.duration=Pe,this.opacity=Ne,this.size=ve,this.variant="accent-primary"}render(){const e=Te[this.variant];this.style.cssText=`
333
+ --pulse-size: ${this.size};
334
+ --pulse-duration: ${this.duration}s;
335
+ --pulse-color: ${e};
336
+ --pulse-opacity: ${this.opacity};
337
+ `;const i=Array.from({length:this.rings},(s,r)=>this.renderRing(r,this.rings));return n.b`
338
+ <div class="pulse-container">
339
+ <div class="pulse-rings">${i}</div>
340
+ <div class="pulse-content">
341
+ <slot></slot>
342
+ </div>
343
+ </div>
344
+ `}renderRing(e,i){const r=`animation-delay: ${e/i*this.duration}s;`;return n.b`<div class="pulse-ring" style=${r}></div>`}};b.styles=[n.resetStyles,Ce];C([n.n({type:Number})],b.prototype,"rings",void 0);C([n.n({type:Number})],b.prototype,"duration",void 0);C([n.n({type:Number})],b.prototype,"opacity",void 0);C([n.n()],b.prototype,"size",void 0);C([n.n()],b.prototype,"variant",void 0);b=C([n.customElement("wui-pulse")],b);const K=[{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"}],X=["success","submitted","failure","timeout","refund"],Se=n.css`
345
+ :host {
346
+ display: block;
347
+ height: 100%;
348
+ width: 100%;
349
+ }
350
+
351
+ wui-image {
352
+ border-radius: ${({borderRadius:t})=>t.round};
353
+ }
354
+
355
+ .token-badge-container {
356
+ position: absolute;
357
+ bottom: 6px;
358
+ left: 50%;
359
+ transform: translateX(-50%);
360
+ border-radius: ${({borderRadius:t})=>t[4]};
361
+ z-index: 3;
362
+ min-width: 105px;
363
+ }
364
+
365
+ .token-badge-container.loading {
366
+ background-color: ${({tokens:t})=>t.theme.backgroundPrimary};
367
+ border: 3px solid ${({tokens:t})=>t.theme.backgroundPrimary};
368
+ }
369
+
370
+ .token-badge-container.success {
371
+ background-color: ${({tokens:t})=>t.theme.backgroundPrimary};
372
+ border: 3px solid ${({tokens:t})=>t.theme.backgroundPrimary};
373
+ }
374
+
375
+ .token-image-container {
376
+ position: relative;
377
+ }
378
+
379
+ .token-image {
380
+ border-radius: ${({borderRadius:t})=>t.round};
381
+ width: 64px;
382
+ height: 64px;
383
+ }
384
+
385
+ .token-image.success {
386
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
387
+ }
388
+
389
+ .token-image.error {
390
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
391
+ }
392
+
393
+ .token-image.loading {
394
+ background: ${({colors:t})=>t.accent010};
395
+ }
396
+
397
+ .token-image wui-icon {
398
+ width: 32px;
399
+ height: 32px;
400
+ }
401
+
402
+ .token-badge {
403
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
404
+ border: 1px solid ${({tokens:t})=>t.theme.foregroundSecondary};
405
+ border-radius: ${({borderRadius:t})=>t[4]};
406
+ }
407
+
408
+ .token-badge wui-text {
409
+ white-space: nowrap;
410
+ }
411
+
412
+ .payment-lifecycle-container {
413
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
414
+ border-top-right-radius: ${({borderRadius:t})=>t[6]};
415
+ border-top-left-radius: ${({borderRadius:t})=>t[6]};
416
+ }
417
+
418
+ .payment-step-badge {
419
+ padding: ${({spacing:t})=>t[1]} ${({spacing:t})=>t[2]};
420
+ border-radius: ${({borderRadius:t})=>t[1]};
421
+ }
422
+
423
+ .payment-step-badge.loading {
424
+ background-color: ${({tokens:t})=>t.theme.foregroundSecondary};
425
+ }
426
+
427
+ .payment-step-badge.error {
428
+ background-color: ${({tokens:t})=>t.core.backgroundError};
429
+ }
430
+
431
+ .payment-step-badge.success {
432
+ background-color: ${({tokens:t})=>t.core.backgroundSuccess};
433
+ }
434
+
435
+ .step-icon-container {
436
+ position: relative;
437
+ height: 40px;
438
+ width: 40px;
439
+ border-radius: ${({borderRadius:t})=>t.round};
440
+ background-color: ${({tokens:t})=>t.theme.foregroundSecondary};
441
+ }
442
+
443
+ .step-icon-box {
444
+ position: absolute;
445
+ right: -4px;
446
+ bottom: -1px;
447
+ padding: 2px;
448
+ border-radius: ${({borderRadius:t})=>t.round};
449
+ border: 2px solid ${({tokens:t})=>t.theme.backgroundPrimary};
450
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
451
+ }
452
+
453
+ .step-icon-box.success {
454
+ background-color: ${({tokens:t})=>t.core.backgroundSuccess};
455
+ }
456
+ `;var w=function(t,e,i,s){var r=arguments.length,o=r<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,i):s,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(o=(r<3?c(o):r>3?c(e,i,o):c(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o};const ke={received:["pending","success","submitted"],processing:["success","submitted"],sending:["success","submitted"]},_e=3e3;exports.W3mPayLoadingView=class extends n.i{constructor(){super(),this.unsubscribe=[],this.pollingInterval=null,this.paymentAsset=u.state.paymentAsset,this.quoteStatus=u.state.quoteStatus,this.quote=u.state.quote,this.amount=u.state.amount,this.namespace=void 0,this.caipAddress=void 0,this.profileName=null,this.activeConnectorIds=n.ConnectorController.state.activeConnectorIds,this.selectedExchange=u.state.selectedExchange,this.initializeNamespace(),this.unsubscribe.push(u.subscribeKey("quoteStatus",e=>this.quoteStatus=e),u.subscribeKey("quote",e=>this.quote=e),n.ConnectorController.subscribeKey("activeConnectorIds",e=>this.activeConnectorIds=e),u.subscribeKey("selectedExchange",e=>this.selectedExchange=e))}connectedCallback(){super.connectedCallback(),this.startPolling()}disconnectedCallback(){super.disconnectedCallback(),this.stopPolling(),this.unsubscribe.forEach(e=>e())}render(){return n.b`
457
+ <wui-flex flexDirection="column" .padding=${["3","0","0","0"]} gap="2">
458
+ ${this.tokenTemplate()} ${this.paymentTemplate()} ${this.paymentLifecycleTemplate()}
459
+ </wui-flex>
460
+ `}tokenTemplate(){const e=S(this.amount||"0"),i=this.paymentAsset.metadata.symbol??"Unknown",r=n.ChainController.getAllRequestedCaipNetworks().find(l=>l.caipNetworkId===this.paymentAsset.network),o=this.quoteStatus==="failure"||this.quoteStatus==="timeout"||this.quoteStatus==="refund";return this.quoteStatus==="success"||this.quoteStatus==="submitted"?n.b`<wui-flex alignItems="center" justifyContent="center">
461
+ <wui-flex justifyContent="center" alignItems="center" class="token-image success">
462
+ <wui-icon name="checkmark" color="success" size="inherit"></wui-icon>
463
+ </wui-flex>
464
+ </wui-flex>`:o?n.b`<wui-flex alignItems="center" justifyContent="center">
465
+ <wui-flex justifyContent="center" alignItems="center" class="token-image error">
466
+ <wui-icon name="close" color="error" size="inherit"></wui-icon>
467
+ </wui-flex>
468
+ </wui-flex>`:n.b`
469
+ <wui-flex alignItems="center" justifyContent="center">
470
+ <wui-flex class="token-image-container">
471
+ <wui-pulse size="125px" rings="3" duration="4" opacity="0.5" variant="accent-primary">
472
+ <wui-flex justifyContent="center" alignItems="center" class="token-image loading">
473
+ <wui-icon name="paperPlaneTitle" color="accent-primary" size="inherit"></wui-icon>
474
+ </wui-flex>
475
+ </wui-pulse>
476
+
477
+ <wui-flex
478
+ justifyContent="center"
479
+ alignItems="center"
480
+ class="token-badge-container loading"
481
+ >
482
+ <wui-flex
483
+ alignItems="center"
484
+ justifyContent="center"
485
+ gap="01"
486
+ padding="1"
487
+ class="token-badge"
488
+ >
489
+ <wui-image
490
+ src=${n.o(n.AssetUtil.getNetworkImage(r))}
491
+ class="chain-image"
492
+ size="mdl"
493
+ ></wui-image>
494
+
495
+ <wui-text variant="lg-regular" color="primary">${e} ${i}</wui-text>
496
+ </wui-flex>
497
+ </wui-flex>
498
+ </wui-flex>
499
+ </wui-flex>
500
+ `}paymentTemplate(){return n.b`
501
+ <wui-flex flexDirection="column" gap="2" .padding=${["0","6","0","6"]}>
502
+ ${this.renderPayment()}
503
+ <wui-separator></wui-separator>
504
+ ${this.renderWallet()}
505
+ </wui-flex>
506
+ `}paymentLifecycleTemplate(){const e=this.getStepsWithStatus();return n.b`
507
+ <wui-flex flexDirection="column" padding="4" gap="2" class="payment-lifecycle-container">
508
+ <wui-flex alignItems="center" justifyContent="space-between">
509
+ <wui-text variant="md-regular" color="secondary">PAYMENT CYCLE</wui-text>
510
+
511
+ ${this.renderPaymentCycleBadge()}
512
+ </wui-flex>
513
+
514
+ <wui-flex flexDirection="column" gap="5" .padding=${["2","0","2","0"]}>
515
+ ${e.map(i=>this.renderStep(i))}
516
+ </wui-flex>
517
+ </wui-flex>
518
+ `}renderPaymentCycleBadge(){var r;const e=this.quoteStatus==="failure"||this.quoteStatus==="timeout"||this.quoteStatus==="refund",i=this.quoteStatus==="success"||this.quoteStatus==="submitted";if(e)return n.b`
519
+ <wui-flex
520
+ justifyContent="center"
521
+ alignItems="center"
522
+ class="payment-step-badge error"
523
+ gap="1"
524
+ >
525
+ <wui-icon name="close" color="error" size="xs"></wui-icon>
526
+ <wui-text variant="sm-regular" color="error">Failed</wui-text>
527
+ </wui-flex>
528
+ `;if(i)return n.b`
529
+ <wui-flex
530
+ justifyContent="center"
531
+ alignItems="center"
532
+ class="payment-step-badge success"
533
+ gap="1"
534
+ >
535
+ <wui-icon name="checkmark" color="success" size="xs"></wui-icon>
536
+ <wui-text variant="sm-regular" color="success">Completed</wui-text>
537
+ </wui-flex>
538
+ `;const s=((r=this.quote)==null?void 0:r.timeInSeconds)??0;return n.b`
539
+ <wui-flex alignItems="center" justifyContent="space-between" gap="3">
540
+ <wui-flex
541
+ justifyContent="center"
542
+ alignItems="center"
543
+ class="payment-step-badge loading"
544
+ gap="1"
545
+ >
546
+ <wui-icon name="clock" color="default" size="xs"></wui-icon>
547
+ <wui-text variant="sm-regular" color="primary">Est. ${s} sec</wui-text>
548
+ </wui-flex>
549
+
550
+ <wui-icon name="chevronBottom" color="default" size="xxs"></wui-icon>
551
+ </wui-flex>
552
+ `}renderPayment(){var c,l,h;const i=n.ChainController.getAllRequestedCaipNetworks().find(f=>{var N;const I=(N=this.quote)==null?void 0:N.origin.currency.network;if(!I)return!1;const{chainId:P}=n.ParseUtil.parseCaipNetworkId(I);return n.HelpersUtil$1.isLowerCaseMatch(f.id.toString(),P.toString())}),s=n.NumberUtil.formatNumber(((c=this.quote)==null?void 0:c.origin.amount)||"0",{decimals:((l=this.quote)==null?void 0:l.origin.currency.metadata.decimals)??0}).toString(),r=S(s),o=((h=this.quote)==null?void 0:h.origin.currency.metadata.symbol)??"Unknown";return n.b`
553
+ <wui-flex
554
+ alignItems="flex-start"
555
+ justifyContent="space-between"
556
+ .padding=${["3","0","3","0"]}
557
+ >
558
+ <wui-text variant="lg-regular" color="secondary">Payment Method</wui-text>
559
+
560
+ <wui-flex flexDirection="column" alignItems="flex-end" gap="1">
561
+ <wui-flex alignItems="center" gap="01">
562
+ <wui-text variant="lg-regular" color="primary">${r}</wui-text>
563
+ <wui-text variant="lg-regular" color="secondary">${o}</wui-text>
564
+ </wui-flex>
565
+
566
+ <wui-flex alignItems="center" gap="1">
567
+ <wui-text variant="md-regular" color="secondary">on</wui-text>
568
+ <wui-image
569
+ src=${n.o(n.AssetUtil.getNetworkImage(i))}
570
+ size="xs"
571
+ ></wui-image>
572
+ <wui-text variant="md-regular" color="secondary">${i==null?void 0:i.name}</wui-text>
573
+ </wui-flex>
574
+ </wui-flex>
575
+ </wui-flex>
576
+ `}renderWallet(){return n.b`
577
+ <wui-flex
578
+ alignItems="flex-start"
579
+ justifyContent="space-between"
580
+ .padding=${["3","0","3","0"]}
581
+ >
582
+ <wui-text variant="lg-regular" color="secondary">Wallet</wui-text>
583
+
584
+ ${this.renderWalletText()}
585
+ </wui-flex>
586
+ `}renderWalletText(){var r;const{image:e}=this.getWalletProperties({namespace:this.namespace}),{address:i}=this.caipAddress?n.ParseUtil.parseCaipAddress(this.caipAddress):{},s=(r=this.selectedExchange)==null?void 0:r.name;return this.selectedExchange?n.b`
587
+ <wui-flex alignItems="center" justifyContent="flex-end" gap="1">
588
+ <wui-text variant="lg-regular" color="primary">${s}</wui-text>
589
+ <wui-image src=${n.o(this.selectedExchange.imageUrl)} size="mdl"></wui-image>
590
+ </wui-flex>
591
+ `:n.b`
592
+ <wui-flex alignItems="center" justifyContent="flex-end" gap="1">
593
+ <wui-text variant="lg-regular" color="primary">
594
+ ${n.UiHelperUtil.getTruncateString({string:this.profileName||i||s||"",charsStart:this.profileName?16:4,charsEnd:this.profileName?0:6,truncate:this.profileName?"end":"middle"})}
595
+ </wui-text>
596
+
597
+ <wui-image src=${n.o(e)} size="mdl"></wui-image>
598
+ </wui-flex>
599
+ `}getStepsWithStatus(){return this.quoteStatus==="failure"||this.quoteStatus==="timeout"||this.quoteStatus==="refund"?K.map(i=>({...i,status:"failed"})):K.map(i=>{const r=(ke[i.id]??[]).includes(this.quoteStatus)?"completed":"pending";return{...i,status:r}})}renderStep({title:e,icon:i,status:s}){const r={"step-icon-box":!0,success:s==="completed"};return n.b`
600
+ <wui-flex alignItems="center" gap="3">
601
+ <wui-flex justifyContent="center" alignItems="center" class="step-icon-container">
602
+ <wui-icon name=${i} color="default" size="mdl"></wui-icon>
603
+
604
+ <wui-flex alignItems="center" justifyContent="center" class=${n.e$1(r)}>
605
+ ${this.renderStatusIndicator(s)}
606
+ </wui-flex>
607
+ </wui-flex>
608
+
609
+ <wui-text variant="md-regular" color="primary">${e}</wui-text>
610
+ </wui-flex>
611
+ `}renderStatusIndicator(e){return e==="completed"?n.b`<wui-icon size="sm" color="success" name="checkmark"></wui-icon>`:e==="failed"?n.b`<wui-icon size="sm" color="error" name="close"></wui-icon>`:e==="pending"?n.b`<wui-loading-spinner color="accent-primary" size="sm"></wui-loading-spinner>`:null}startPolling(){this.pollingInterval||(this.fetchQuoteStatus(),this.pollingInterval=setInterval(()=>{this.fetchQuoteStatus()},_e))}stopPolling(){this.pollingInterval&&(clearInterval(this.pollingInterval),this.pollingInterval=null)}async fetchQuoteStatus(){const e=u.state.requestId;if(!e||X.includes(this.quoteStatus))this.stopPolling();else try{await u.fetchQuoteStatus({requestId:e}),X.includes(this.quoteStatus)&&this.stopPolling()}catch{this.stopPolling()}}initializeNamespace(){var i,s;const e=n.ChainController.state.activeChain;this.namespace=e,this.caipAddress=(i=n.ChainController.getAccountData(e))==null?void 0:i.caipAddress,this.profileName=((s=n.ChainController.getAccountData(e))==null?void 0:s.profileName)??null,this.unsubscribe.push(n.ChainController.subscribeChainProp("accountState",r=>{this.caipAddress=r==null?void 0:r.caipAddress,this.profileName=(r==null?void 0:r.profileName)??null},e))}getWalletProperties({namespace:e}){if(!e)return{name:void 0,image:void 0};const i=this.activeConnectorIds[e];if(!i)return{name:void 0,image:void 0};const s=n.ConnectorController.getConnector({id:i,namespace:e});if(!s)return{name:void 0,image:void 0};const r=n.AssetUtil.getConnectorImage(s);return{name:s.name,image:r}}};exports.W3mPayLoadingView.styles=Se;w([n.r()],exports.W3mPayLoadingView.prototype,"paymentAsset",void 0);w([n.r()],exports.W3mPayLoadingView.prototype,"quoteStatus",void 0);w([n.r()],exports.W3mPayLoadingView.prototype,"quote",void 0);w([n.r()],exports.W3mPayLoadingView.prototype,"amount",void 0);w([n.r()],exports.W3mPayLoadingView.prototype,"namespace",void 0);w([n.r()],exports.W3mPayLoadingView.prototype,"caipAddress",void 0);w([n.r()],exports.W3mPayLoadingView.prototype,"profileName",void 0);w([n.r()],exports.W3mPayLoadingView.prototype,"activeConnectorIds",void 0);w([n.r()],exports.W3mPayLoadingView.prototype,"selectedExchange",void 0);exports.W3mPayLoadingView=w([n.customElement("w3m-pay-loading-view")],exports.W3mPayLoadingView);const $e=n.i$1`
612
+ :host {
613
+ display: block;
614
+ }
615
+ `;var Ue=function(t,e,i,s){var r=arguments.length,o=r<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,i):s,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(o=(r<3?c(o):r>3?c(e,i,o):c(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o};let W=class extends n.i{render(){return n.b`
616
+ <wui-flex flexDirection="column" gap="4">
617
+ <wui-flex alignItems="center" justifyContent="space-between">
618
+ <wui-text variant="md-regular" color="secondary">Pay</wui-text>
619
+ <wui-shimmer width="60px" height="16px" borderRadius="4xs" variant="light"></wui-shimmer>
620
+ </wui-flex>
621
+
622
+ <wui-flex alignItems="center" justifyContent="space-between">
623
+ <wui-text variant="md-regular" color="secondary">Network Fee</wui-text>
624
+
625
+ <wui-flex flexDirection="column" alignItems="flex-end" gap="2">
626
+ <wui-shimmer
627
+ width="75px"
628
+ height="16px"
629
+ borderRadius="4xs"
630
+ variant="light"
631
+ ></wui-shimmer>
632
+
633
+ <wui-flex alignItems="center" gap="01">
634
+ <wui-shimmer width="14px" height="14px" rounded variant="light"></wui-shimmer>
635
+ <wui-shimmer
636
+ width="49px"
637
+ height="14px"
638
+ borderRadius="4xs"
639
+ variant="light"
640
+ ></wui-shimmer>
641
+ </wui-flex>
642
+ </wui-flex>
643
+ </wui-flex>
644
+
645
+ <wui-flex alignItems="center" justifyContent="space-between">
646
+ <wui-text variant="md-regular" color="secondary">Service Fee</wui-text>
647
+ <wui-shimmer width="75px" height="16px" borderRadius="4xs" variant="light"></wui-shimmer>
648
+ </wui-flex>
649
+ </wui-flex>
650
+ `}};W.styles=[$e];W=Ue([n.customElement("w3m-pay-fees-skeleton")],W);const Re=n.css`
651
+ :host {
652
+ display: block;
653
+ }
654
+
655
+ wui-image {
656
+ border-radius: ${({borderRadius:t})=>t.round};
657
+ }
658
+ `;var J=function(t,e,i,s){var r=arguments.length,o=r<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,i):s,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(o=(r<3?c(o):r>3?c(e,i,o):c(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o};let k=class extends n.i{constructor(){super(),this.unsubscribe=[],this.quote=u.state.quote,this.unsubscribe.push(u.subscribeKey("quote",e=>this.quote=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){var i,s,r;const e=n.NumberUtil.formatNumber(((i=this.quote)==null?void 0:i.origin.amount)||"0",{decimals:((s=this.quote)==null?void 0:s.origin.currency.metadata.decimals)??0,round:6}).toString();return n.b`
659
+ <wui-flex flexDirection="column" gap="4">
660
+ <wui-flex alignItems="center" justifyContent="space-between">
661
+ <wui-text variant="md-regular" color="secondary">Pay</wui-text>
662
+ <wui-text variant="md-regular" color="primary">
663
+ ${e} ${((r=this.quote)==null?void 0:r.origin.currency.metadata.symbol)||"Unknown"}
664
+ </wui-text>
665
+ </wui-flex>
666
+
667
+ ${this.quote&&this.quote.fees.length>0?this.quote.fees.map(o=>this.renderFee(o)):null}
668
+ </wui-flex>
669
+ `}renderFee(e){const i=e.id==="network",s=n.NumberUtil.formatNumber(e.amount||"0",{decimals:e.currency.metadata.decimals??0,round:6}).toString();if(i){const o=n.ChainController.getAllRequestedCaipNetworks().find(c=>n.HelpersUtil$1.isLowerCaseMatch(c.caipNetworkId,e.currency.network));return n.b`
670
+ <wui-flex alignItems="center" justifyContent="space-between">
671
+ <wui-text variant="md-regular" color="secondary">${e.label}</wui-text>
672
+
673
+ <wui-flex flexDirection="column" alignItems="flex-end" gap="2">
674
+ <wui-text variant="md-regular" color="primary">
675
+ ${s} ${e.currency.metadata.symbol||"Unknown"}
676
+ </wui-text>
677
+
678
+ <wui-flex alignItems="center" gap="01">
679
+ <wui-image
680
+ src=${n.o(n.AssetUtil.getNetworkImage(o))}
681
+ size="xs"
682
+ ></wui-image>
683
+ <wui-text variant="sm-regular" color="secondary">
684
+ ${(o==null?void 0:o.name)||"Unknown"}
685
+ </wui-text>
686
+ </wui-flex>
687
+ </wui-flex>
688
+ </wui-flex>
689
+ `}return n.b`
690
+ <wui-flex alignItems="center" justifyContent="space-between">
691
+ <wui-text variant="md-regular" color="secondary">${e.label}</wui-text>
692
+ <wui-text variant="md-regular" color="primary">
693
+ ${s} ${e.currency.metadata.symbol||"Unknown"}
694
+ </wui-text>
695
+ </wui-flex>
696
+ `}};k.styles=[Re];J([n.r()],k.prototype,"quote",void 0);k=J([n.customElement("w3m-pay-fees")],k);const Oe=n.css`
697
+ :host {
698
+ display: block;
699
+ width: 100%;
700
+ }
701
+
702
+ .disabled-container {
703
+ padding: ${({spacing:t})=>t[2]};
704
+ min-height: 168px;
705
+ }
706
+
707
+ wui-icon {
708
+ width: ${({spacing:t})=>t[8]};
709
+ height: ${({spacing:t})=>t[8]};
710
+ }
711
+
712
+ wui-flex > wui-text {
713
+ max-width: 273px;
714
+ }
715
+ `;var Z=function(t,e,i,s){var r=arguments.length,o=r<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,i):s,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(o=(r<3?c(o):r>3?c(e,i,o):c(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o};let _=class extends n.i{constructor(){super(),this.unsubscribe=[],this.selectedExchange=u.state.selectedExchange,this.unsubscribe.push(u.subscribeKey("selectedExchange",e=>this.selectedExchange=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const e=!!this.selectedExchange;return n.b`
716
+ <wui-flex
717
+ flexDirection="column"
718
+ alignItems="center"
719
+ justifyContent="center"
720
+ gap="3"
721
+ class="disabled-container"
722
+ >
723
+ <wui-icon name="coins" color="default" size="inherit"></wui-icon>
724
+
725
+ <wui-text variant="md-regular" color="primary" align="center">
726
+ You don't have enough funds to complete this transaction
727
+ </wui-text>
728
+
729
+ ${e?null:n.b`<wui-button
730
+ size="md"
731
+ variant="neutral-secondary"
732
+ @click=${this.dispatchConnectOtherWalletEvent.bind(this)}
733
+ >Connect other wallet</wui-button
734
+ >`}
735
+ </wui-flex>
736
+ `}dispatchConnectOtherWalletEvent(){this.dispatchEvent(new CustomEvent("connectOtherWallet",{detail:!0,bubbles:!0,composed:!0}))}};_.styles=[Oe];Z([n.n({type:Array})],_.prototype,"selectedExchange",void 0);_=Z([n.customElement("w3m-pay-options-empty")],_);const Le=n.css`
737
+ :host {
738
+ display: block;
739
+ width: 100%;
740
+ }
741
+
742
+ .pay-options-container {
743
+ max-height: 196px;
744
+ overflow-y: auto;
745
+ overflow-x: hidden;
746
+ scrollbar-width: none;
747
+ }
748
+
749
+ .pay-options-container::-webkit-scrollbar {
750
+ display: none;
751
+ }
752
+
753
+ .pay-option-container {
754
+ border-radius: ${({borderRadius:t})=>t[4]};
755
+ padding: ${({spacing:t})=>t[3]};
756
+ min-height: 60px;
757
+ }
758
+
759
+ .token-images-container {
760
+ position: relative;
761
+ justify-content: center;
762
+ align-items: center;
763
+ }
764
+
765
+ .chain-image {
766
+ position: absolute;
767
+ bottom: -3px;
768
+ right: -5px;
769
+ border: 2px solid ${({tokens:t})=>t.theme.foregroundSecondary};
770
+ }
771
+ `;var qe=function(t,e,i,s){var r=arguments.length,o=r<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,i):s,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(o=(r<3?c(o):r>3?c(e,i,o):c(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o};let D=class extends n.i{render(){return n.b`
772
+ <wui-flex flexDirection="column" gap="2" class="pay-options-container">
773
+ ${this.renderOptionEntry()} ${this.renderOptionEntry()} ${this.renderOptionEntry()}
774
+ </wui-flex>
775
+ `}renderOptionEntry(){return n.b`
776
+ <wui-flex
777
+ alignItems="center"
778
+ justifyContent="space-between"
779
+ gap="2"
780
+ class="pay-option-container"
781
+ >
782
+ <wui-flex alignItems="center" gap="2">
783
+ <wui-flex class="token-images-container">
784
+ <wui-shimmer
785
+ width="32px"
786
+ height="32px"
787
+ rounded
788
+ variant="light"
789
+ class="token-image"
790
+ ></wui-shimmer>
791
+ <wui-shimmer
792
+ width="16px"
793
+ height="16px"
794
+ rounded
795
+ variant="light"
796
+ class="chain-image"
797
+ ></wui-shimmer>
798
+ </wui-flex>
799
+
800
+ <wui-flex flexDirection="column" gap="1">
801
+ <wui-shimmer
802
+ width="74px"
803
+ height="16px"
804
+ borderRadius="4xs"
805
+ variant="light"
806
+ ></wui-shimmer>
807
+ <wui-shimmer
808
+ width="46px"
809
+ height="14px"
810
+ borderRadius="4xs"
811
+ variant="light"
812
+ ></wui-shimmer>
813
+ </wui-flex>
814
+ </wui-flex>
815
+ </wui-flex>
816
+ `}};D.styles=[Le];D=qe([n.customElement("w3m-pay-options-skeleton")],D);const We=n.css`
817
+ :host {
818
+ display: block;
819
+ width: 100%;
820
+ }
821
+
822
+ .pay-options-container {
823
+ max-height: 196px;
824
+ overflow-y: auto;
825
+ overflow-x: hidden;
826
+ scrollbar-width: none;
827
+ mask-image: var(--options-mask-image);
828
+ -webkit-mask-image: var(--options-mask-image);
829
+ }
830
+
831
+ .pay-options-container::-webkit-scrollbar {
832
+ display: none;
833
+ }
834
+
835
+ .pay-option-container {
836
+ cursor: pointer;
837
+ border-radius: ${({borderRadius:t})=>t[4]};
838
+ padding: ${({spacing:t})=>t[3]};
839
+ transition: background-color ${({durations:t})=>t.lg}
840
+ ${({easings:t})=>t["ease-out-power-1"]};
841
+ will-change: background-color;
842
+ }
843
+
844
+ .token-images-container {
845
+ position: relative;
846
+ justify-content: center;
847
+ align-items: center;
848
+ }
849
+
850
+ .token-image {
851
+ border-radius: ${({borderRadius:t})=>t.round};
852
+ width: 32px;
853
+ height: 32px;
854
+ }
855
+
856
+ .chain-image {
857
+ position: absolute;
858
+ width: 16px;
859
+ height: 16px;
860
+ bottom: -3px;
861
+ right: -5px;
862
+ border-radius: ${({borderRadius:t})=>t.round};
863
+ border: 2px solid ${({tokens:t})=>t.theme.backgroundPrimary};
864
+ }
865
+
866
+ @media (hover: hover) and (pointer: fine) {
867
+ .pay-option-container:hover {
868
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
869
+ }
870
+ }
871
+ `;var $=function(t,e,i,s){var r=arguments.length,o=r<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,i):s,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(o=(r<3?c(o):r>3?c(e,i,o):c(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o};const De=300;let E=class extends n.i{constructor(){super(),this.unsubscribe=[],this.options=[],this.selectedPaymentAsset=null}disconnectedCallback(){var i,s;this.unsubscribe.forEach(r=>r()),(i=this.resizeObserver)==null||i.disconnect();const e=(s=this.shadowRoot)==null?void 0:s.querySelector(".pay-options-container");e==null||e.removeEventListener("scroll",this.handleOptionsListScroll.bind(this))}firstUpdated(){var i,s;const e=(i=this.shadowRoot)==null?void 0:i.querySelector(".pay-options-container");e&&(requestAnimationFrame(this.handleOptionsListScroll.bind(this)),e==null||e.addEventListener("scroll",this.handleOptionsListScroll.bind(this)),this.resizeObserver=new ResizeObserver(()=>{this.handleOptionsListScroll()}),(s=this.resizeObserver)==null||s.observe(e),this.handleOptionsListScroll())}render(){return n.b`
872
+ <wui-flex flexDirection="column" gap="2" class="pay-options-container">
873
+ ${this.options.map(e=>this.payOptionTemplate(e))}
874
+ </wui-flex>
875
+ `}payOptionTemplate(e){var M,Q;const{network:i,metadata:s,asset:r,amount:o="0"}=e,l=n.ChainController.getAllRequestedCaipNetworks().find(v=>v.caipNetworkId===i),h=`${i}:${r}`,f=`${(M=this.selectedPaymentAsset)==null?void 0:M.network}:${(Q=this.selectedPaymentAsset)==null?void 0:Q.asset}`,I=h===f,P=n.NumberUtil.bigNumber(o,{safe:!0}),N=P.gt(0);return n.b`
876
+ <wui-flex
877
+ alignItems="center"
878
+ justifyContent="space-between"
879
+ gap="2"
880
+ @click=${()=>{var v;return(v=this.onSelect)==null?void 0:v.call(this,e)}}
881
+ class="pay-option-container"
882
+ >
883
+ <wui-flex alignItems="center" gap="2">
884
+ <wui-flex class="token-images-container">
885
+ <wui-image
886
+ src=${n.o(s.logoURI)}
887
+ class="token-image"
888
+ size="3xl"
889
+ ></wui-image>
890
+ <wui-image
891
+ src=${n.o(n.AssetUtil.getNetworkImage(l))}
892
+ class="chain-image"
893
+ size="md"
894
+ ></wui-image>
895
+ </wui-flex>
896
+
897
+ <wui-flex flexDirection="column" gap="1">
898
+ <wui-text variant="lg-regular" color="primary">${s.symbol}</wui-text>
899
+ ${N?n.b`<wui-text variant="sm-regular" color="secondary">
900
+ ${P.round(6).toString()} ${s.symbol}
901
+ </wui-text>`:null}
902
+ </wui-flex>
903
+ </wui-flex>
904
+
905
+ ${I?n.b`<wui-icon name="checkmark" size="md" color="success"></wui-icon>`:null}
906
+ </wui-flex>
907
+ `}handleOptionsListScroll(){var s;const e=(s=this.shadowRoot)==null?void 0:s.querySelector(".pay-options-container");if(!e)return;e.scrollHeight>De?(e.style.setProperty("--options-mask-image",`linear-gradient(
908
+ to bottom,
909
+ rgba(0, 0, 0, calc(1 - var(--options-scroll--top-opacity))) 0px,
910
+ rgba(200, 200, 200, calc(1 - var(--options-scroll--top-opacity))) 1px,
911
+ black 50px,
912
+ black calc(100% - 50px),
913
+ rgba(155, 155, 155, calc(1 - var(--options-scroll--bottom-opacity))) calc(100% - 1px),
914
+ rgba(0, 0, 0, calc(1 - var(--options-scroll--bottom-opacity))) 100%
915
+ )`),e.style.setProperty("--options-scroll--top-opacity",n.MathUtil.interpolate([0,50],[0,1],e.scrollTop).toString()),e.style.setProperty("--options-scroll--bottom-opacity",n.MathUtil.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"))}};E.styles=[We];$([n.n({type:Array})],E.prototype,"options",void 0);$([n.n()],E.prototype,"selectedPaymentAsset",void 0);$([n.n()],E.prototype,"onSelect",void 0);E=$([n.customElement("w3m-pay-options")],E);const Fe=n.css`
916
+ .payment-methods-container {
917
+ background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
918
+ border-top-right-radius: ${({borderRadius:t})=>t[5]};
919
+ border-top-left-radius: ${({borderRadius:t})=>t[5]};
920
+ }
921
+
922
+ .pay-options-container {
923
+ background-color: ${({tokens:t})=>t.theme.foregroundSecondary};
924
+ border-radius: ${({borderRadius:t})=>t[5]};
925
+ padding: ${({spacing:t})=>t[1]};
926
+ }
927
+
928
+ w3m-tooltip-trigger {
929
+ display: flex;
930
+ align-items: center;
931
+ justify-content: center;
932
+ max-width: fit-content;
933
+ }
934
+
935
+ wui-image {
936
+ border-radius: ${({borderRadius:t})=>t.round};
937
+ }
938
+
939
+ w3m-pay-options.disabled {
940
+ opacity: 0.5;
941
+ pointer-events: none;
942
+ }
943
+ `;var m=function(t,e,i,s){var r=arguments.length,o=r<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,i):s,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(o=(r<3?c(o):r>3?c(e,i,o):c(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o};const T={eip155:"ethereum",solana:"solana",bip122:"bitcoin",ton:"ton"},Ve={eip155:{icon:T.eip155,label:"EVM"},solana:{icon:T.solana,label:"Solana"},bip122:{icon:T.bip122,label:"Bitcoin"},ton:{icon:T.ton,label:"Ton"}};exports.W3mPayQuoteView=class extends n.i{constructor(){super(),this.unsubscribe=[],this.profileName=null,this.paymentAsset=u.state.paymentAsset,this.namespace=void 0,this.caipAddress=void 0,this.amount=u.state.amount,this.recipient=u.state.recipient,this.activeConnectorIds=n.ConnectorController.state.activeConnectorIds,this.selectedPaymentAsset=u.state.selectedPaymentAsset,this.selectedExchange=u.state.selectedExchange,this.isFetchingQuote=u.state.isFetchingQuote,this.quoteError=u.state.quoteError,this.quote=u.state.quote,this.isFetchingTokenBalances=u.state.isFetchingTokenBalances,this.tokenBalances=u.state.tokenBalances,this.isPaymentInProgress=u.state.isPaymentInProgress,this.exchangeUrlForQuote=u.state.exchangeUrlForQuote,this.completedTransactionsCount=0,this.unsubscribe.push(u.subscribeKey("paymentAsset",e=>this.paymentAsset=e)),this.unsubscribe.push(u.subscribeKey("tokenBalances",e=>this.onTokenBalancesChanged(e))),this.unsubscribe.push(u.subscribeKey("isFetchingTokenBalances",e=>this.isFetchingTokenBalances=e)),this.unsubscribe.push(n.ConnectorController.subscribeKey("activeConnectorIds",e=>this.activeConnectorIds=e)),this.unsubscribe.push(u.subscribeKey("selectedPaymentAsset",e=>this.selectedPaymentAsset=e)),this.unsubscribe.push(u.subscribeKey("isFetchingQuote",e=>this.isFetchingQuote=e)),this.unsubscribe.push(u.subscribeKey("quoteError",e=>this.quoteError=e)),this.unsubscribe.push(u.subscribeKey("quote",e=>this.quote=e)),this.unsubscribe.push(u.subscribeKey("amount",e=>this.amount=e)),this.unsubscribe.push(u.subscribeKey("recipient",e=>this.recipient=e)),this.unsubscribe.push(u.subscribeKey("isPaymentInProgress",e=>this.isPaymentInProgress=e)),this.unsubscribe.push(u.subscribeKey("selectedExchange",e=>this.selectedExchange=e)),this.unsubscribe.push(u.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 n.b`
944
+ <wui-flex flexDirection="column">
945
+ ${this.profileTemplate()}
946
+
947
+ <wui-flex
948
+ flexDirection="column"
949
+ gap="4"
950
+ class="payment-methods-container"
951
+ .padding=${["4","4","5","4"]}
952
+ >
953
+ ${this.paymentOptionsViewTemplate()} ${this.amountWithFeeTemplate()}
954
+
955
+ <wui-flex
956
+ alignItems="center"
957
+ justifyContent="space-between"
958
+ .padding=${["1","0","1","0"]}
959
+ >
960
+ <wui-separator></wui-separator>
961
+ </wui-flex>
962
+
963
+ ${this.paymentActionsTemplate()}
964
+ </wui-flex>
965
+ </wui-flex>
966
+ `}profileTemplate(){var c,l;if(this.selectedExchange){const h=n.NumberUtil.formatNumber((c=this.quote)==null?void 0:c.origin.amount,{decimals:((l=this.quote)==null?void 0:l.origin.currency.metadata.decimals)??0}).toString();return n.b`
967
+ <wui-flex
968
+ .padding=${["4","3","4","3"]}
969
+ alignItems="center"
970
+ justifyContent="space-between"
971
+ gap="2"
972
+ >
973
+ <wui-text variant="lg-regular" color="secondary">Paying with</wui-text>
974
+
975
+ ${this.quote?n.b`<wui-text variant="lg-regular" color="primary">
976
+ ${n.NumberUtil.bigNumber(h,{safe:!0}).round(6).toString()}
977
+ ${this.quote.origin.currency.metadata.symbol}
978
+ </wui-text>`:n.b`<wui-shimmer width="80px" height="18px" variant="light"></wui-shimmer>`}
979
+ </wui-flex>
980
+ `}const e=n.CoreHelperUtil.getPlainAddress(this.caipAddress)??"",{name:i,image:s}=this.getWalletProperties({namespace:this.namespace}),{icon:r,label:o}=Ve[this.namespace]??{};return n.b`
981
+ <wui-flex
982
+ .padding=${["4","3","4","3"]}
983
+ alignItems="center"
984
+ justifyContent="space-between"
985
+ gap="2"
986
+ >
987
+ <wui-wallet-switch
988
+ profileName=${n.o(this.profileName)}
989
+ address=${n.o(e)}
990
+ imageSrc=${n.o(s)}
991
+ alt=${n.o(i)}
992
+ @click=${this.onConnectOtherWallet.bind(this)}
993
+ data-testid="wui-wallet-switch"
994
+ ></wui-wallet-switch>
995
+
996
+ <wui-wallet-switch
997
+ profileName=${n.o(o)}
998
+ address=${n.o(e)}
999
+ icon=${n.o(r)}
1000
+ iconSize="xs"
1001
+ .enableGreenCircle=${!1}
1002
+ alt=${n.o(o)}
1003
+ @click=${this.onConnectOtherWallet.bind(this)}
1004
+ data-testid="wui-wallet-switch"
1005
+ ></wui-wallet-switch>
1006
+ </wui-flex>
1007
+ `}initializeNamespace(){var i,s;const e=n.ChainController.state.activeChain;this.namespace=e,this.caipAddress=(i=n.ChainController.getAccountData(e))==null?void 0:i.caipAddress,this.profileName=((s=n.ChainController.getAccountData(e))==null?void 0:s.profileName)??null,this.unsubscribe.push(n.ChainController.subscribeChainProp("accountState",r=>this.onAccountStateChanged(r),e))}async fetchTokens(){if(this.namespace){let e;if(this.caipAddress){const{chainId:i,chainNamespace:s}=n.ParseUtil.parseCaipAddress(this.caipAddress),r=`${s}:${i}`;e=n.ChainController.getAllRequestedCaipNetworks().find(c=>c.caipNetworkId===r)}await u.fetchTokens({caipAddress:this.caipAddress,caipNetwork:e,namespace:this.namespace})}}fetchQuote(){if(this.amount&&this.recipient&&this.selectedPaymentAsset&&this.paymentAsset){const{address:e}=this.caipAddress?n.ParseUtil.parseCaipAddress(this.caipAddress):{};u.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 i=this.activeConnectorIds[e];if(!i)return{name:void 0,image:void 0};const s=n.ConnectorController.getConnector({id:i,namespace:e});if(!s)return{name:void 0,image:void 0};const r=n.AssetUtil.getConnectorImage(s);return{name:s.name,image:r}}paymentOptionsViewTemplate(){return n.b`
1008
+ <wui-flex flexDirection="column" gap="2">
1009
+ <wui-text variant="sm-regular" color="secondary">CHOOSE PAYMENT OPTION</wui-text>
1010
+ <wui-flex class="pay-options-container">${this.paymentOptionsTemplate()}</wui-flex>
1011
+ </wui-flex>
1012
+ `}paymentOptionsTemplate(){const e=this.getPaymentAssetFromTokenBalances();if(this.isFetchingTokenBalances)return n.b`<w3m-pay-options-skeleton></w3m-pay-options-skeleton>`;if(e.length===0)return n.b`<w3m-pay-options-empty
1013
+ @connectOtherWallet=${this.onConnectOtherWallet.bind(this)}
1014
+ ></w3m-pay-options-empty>`;const i={disabled:this.isFetchingQuote};return n.b`<w3m-pay-options
1015
+ class=${n.e$1(i)}
1016
+ .options=${e}
1017
+ .selectedPaymentAsset=${n.o(this.selectedPaymentAsset)}
1018
+ .onSelect=${this.onSelectedPaymentAssetChanged.bind(this)}
1019
+ ></w3m-pay-options>`}amountWithFeeTemplate(){return this.isFetchingQuote||!this.selectedPaymentAsset||this.quoteError?n.b`<w3m-pay-fees-skeleton></w3m-pay-fees-skeleton>`:n.b`<w3m-pay-fees></w3m-pay-fees>`}paymentActionsTemplate(){var r,o,c;const e=this.isFetchingQuote||this.isFetchingTokenBalances,i=this.isFetchingQuote||this.isFetchingTokenBalances||!this.selectedPaymentAsset||!!this.quoteError,s=n.NumberUtil.formatNumber(((r=this.quote)==null?void 0:r.origin.amount)??0,{decimals:((o=this.quote)==null?void 0:o.origin.currency.metadata.decimals)??0}).toString();return this.selectedExchange?e||i?n.b`
1020
+ <wui-shimmer width="100%" height="48px" variant="light" ?rounded=${!0}></wui-shimmer>
1021
+ `:n.b`<wui-button
1022
+ size="lg"
1023
+ fullWidth
1024
+ variant="accent-secondary"
1025
+ @click=${this.onPayWithExchange.bind(this)}
1026
+ >
1027
+ ${`Continue in ${this.selectedExchange.name}`}
1028
+
1029
+ <wui-icon name="arrowRight" color="inherit" size="sm" slot="iconRight"></wui-icon>
1030
+ </wui-button>`:n.b`
1031
+ <wui-flex alignItems="center" justifyContent="space-between">
1032
+ <wui-flex flexDirection="column" gap="1">
1033
+ <wui-text variant="md-regular" color="secondary">Order Total</wui-text>
1034
+
1035
+ ${e||i?n.b`<wui-shimmer width="58px" height="32px" variant="light"></wui-shimmer>`:n.b`<wui-flex alignItems="center" gap="01">
1036
+ <wui-text variant="h4-regular" color="primary">${S(s)}</wui-text>
1037
+
1038
+ <wui-text variant="lg-regular" color="secondary">
1039
+ ${((c=this.quote)==null?void 0:c.origin.currency.metadata.symbol)||"Unknown"}
1040
+ </wui-text>
1041
+ </wui-flex>`}
1042
+ </wui-flex>
1043
+
1044
+ ${this.actionButtonTemplate({isLoading:e,isDisabled:i})}
1045
+ </wui-flex>
1046
+ `}actionButtonTemplate(e){const i=U(this.quote),{isLoading:s,isDisabled:r}=e;let o="Pay";return i.length>1&&this.completedTransactionsCount===0&&(o="Approve"),n.b`
1047
+ <wui-button
1048
+ size="lg"
1049
+ variant="accent-primary"
1050
+ ?loading=${s||this.isPaymentInProgress}
1051
+ ?disabled=${r||this.isPaymentInProgress}
1052
+ @click=${()=>{i.length>0?this.onSendTransactions():this.onTransfer()}}
1053
+ >
1054
+ ${o}
1055
+ ${s?null:n.b`<wui-icon
1056
+ name="arrowRight"
1057
+ color="inherit"
1058
+ size="sm"
1059
+ slot="iconRight"
1060
+ ></wui-icon>`}
1061
+ </wui-button>
1062
+ `}getPaymentAssetFromTokenBalances(){return this.namespace?(this.tokenBalances[this.namespace]??[]).map(r=>{try{return fe(r)}catch{return null}}).filter(r=>!!r).filter(r=>{const{chainId:o}=n.ParseUtil.parseCaipNetworkId(r.network),{chainId:c}=n.ParseUtil.parseCaipNetworkId(this.paymentAsset.network);return n.HelpersUtil$1.isLowerCaseMatch(r.asset,this.paymentAsset.asset)?!0:this.selectedExchange?!n.HelpersUtil$1.isLowerCaseMatch(o.toString(),c.toString()):!0}):[]}onTokenBalancesChanged(e){this.tokenBalances=e;const[i]=this.getPaymentAssetFromTokenBalances();i&&u.setSelectedPaymentAsset(i)}async onConnectOtherWallet(){await n.ConnectorController.connect(),await n.ModalController.open({view:"PayQuote"})}onAccountStateChanged(e){const{address:i}=this.caipAddress?n.ParseUtil.parseCaipAddress(this.caipAddress):{};if(this.caipAddress=e==null?void 0:e.caipAddress,this.profileName=(e==null?void 0:e.profileName)??null,i){const{address:s}=this.caipAddress?n.ParseUtil.parseCaipAddress(this.caipAddress):{};s?n.HelpersUtil$1.isLowerCaseMatch(s,i)||(this.resetAssetsState(),this.resetQuoteState(),this.fetchTokens()):n.ModalController.close()}}onSelectedPaymentAssetChanged(e){this.isFetchingQuote||u.setSelectedPaymentAsset(e)}async onTransfer(){var i,s,r;const e=L(this.quote);if(e){if(!n.HelpersUtil$1.isLowerCaseMatch((i=this.selectedPaymentAsset)==null?void 0:i.asset,e.deposit.currency))throw new Error("Quote asset is not the same as the selected payment asset");const c=((s=this.selectedPaymentAsset)==null?void 0:s.amount)??"0",l=n.NumberUtil.formatNumber(e.deposit.amount,{decimals:((r=this.selectedPaymentAsset)==null?void 0:r.metadata.decimals)??0}).toString();if(!n.NumberUtil.bigNumber(c).gte(l)){n.SnackController.showError("Insufficient funds");return}if(this.quote&&this.selectedPaymentAsset&&this.caipAddress&&this.namespace){const{address:f}=n.ParseUtil.parseCaipAddress(this.caipAddress);await u.onTransfer({chainNamespace:this.namespace,fromAddress:f,toAddress:e.deposit.receiver,amount:l,paymentAsset:this.selectedPaymentAsset}),u.setRequestId(e.requestId),n.RouterController.push("PayLoading")}}}async onSendTransactions(){var c,l,h;const e=((c=this.selectedPaymentAsset)==null?void 0:c.amount)??"0",i=n.NumberUtil.formatNumber(((l=this.quote)==null?void 0:l.origin.amount)??0,{decimals:((h=this.selectedPaymentAsset)==null?void 0:h.metadata.decimals)??0}).toString();if(!n.NumberUtil.bigNumber(e).gte(i)){n.SnackController.showError("Insufficient funds");return}const r=U(this.quote),[o]=U(this.quote,this.completedTransactionsCount);o&&this.namespace&&(await u.onSendTransaction({namespace:this.namespace,transactionStep:o}),this.completedTransactionsCount+=1,this.completedTransactionsCount===r.length&&(u.setRequestId(o.requestId),n.RouterController.push("PayLoading")))}onPayWithExchange(){if(this.exchangeUrlForQuote){const e=n.CoreHelperUtil.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!e)throw new Error("Could not create popup window");e.location.href=this.exchangeUrlForQuote;const i=L(this.quote);i&&u.setRequestId(i.requestId),u.initiatePayment(),n.RouterController.push("PayLoading")}}resetAssetsState(){u.setSelectedPaymentAsset(null)}resetQuoteState(){u.resetQuoteState()}};exports.W3mPayQuoteView.styles=Fe;m([n.r()],exports.W3mPayQuoteView.prototype,"profileName",void 0);m([n.r()],exports.W3mPayQuoteView.prototype,"paymentAsset",void 0);m([n.r()],exports.W3mPayQuoteView.prototype,"namespace",void 0);m([n.r()],exports.W3mPayQuoteView.prototype,"caipAddress",void 0);m([n.r()],exports.W3mPayQuoteView.prototype,"amount",void 0);m([n.r()],exports.W3mPayQuoteView.prototype,"recipient",void 0);m([n.r()],exports.W3mPayQuoteView.prototype,"activeConnectorIds",void 0);m([n.r()],exports.W3mPayQuoteView.prototype,"selectedPaymentAsset",void 0);m([n.r()],exports.W3mPayQuoteView.prototype,"selectedExchange",void 0);m([n.r()],exports.W3mPayQuoteView.prototype,"isFetchingQuote",void 0);m([n.r()],exports.W3mPayQuoteView.prototype,"quoteError",void 0);m([n.r()],exports.W3mPayQuoteView.prototype,"quote",void 0);m([n.r()],exports.W3mPayQuoteView.prototype,"isFetchingTokenBalances",void 0);m([n.r()],exports.W3mPayQuoteView.prototype,"tokenBalances",void 0);m([n.r()],exports.W3mPayQuoteView.prototype,"isPaymentInProgress",void 0);m([n.r()],exports.W3mPayQuoteView.prototype,"exchangeUrlForQuote",void 0);m([n.r()],exports.W3mPayQuoteView.prototype,"completedTransactionsCount",void 0);exports.W3mPayQuoteView=m([n.customElement("w3m-pay-quote-view")],exports.W3mPayQuoteView);exports.AppKitPayError=p;exports.AppKitPayErrorCodes=d;exports.PayController=u;