1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2972],{2972:(e,t,i)=>{i.r(t),i.d(t,{AppKitModal:()=>is,W3mListWallet:()=>ih,W3mModal:()=>io,W3mModalBase:()=>ir,W3mRouterContainer:()=>ig,W3mUsageExceededView:()=>il});var a=i(11698),r=i(74672),o=i(17782),n=i(48624),s=i(19784),c=i(41175),l=i(50669),u=i(41246),d=i(49083),p=i(1584),h=i(97901);let m={isUnsupportedChainView:()=>"UnsupportedChain"===d.I.state.view||"SwitchNetwork"===d.I.state.view&&d.I.state.history.includes("UnsupportedChain"),async safeClose(){if(this.isUnsupportedChainView()||await h.U.isSIWXCloseDisabled())return void s.W.shake();("DataCapture"===d.I.state.view||"DataCaptureOtpConfirm"===d.I.state.view)&&p.x.disconnect(),s.W.close()}};var w=i(85187),g=i(12324),y=i(76639),f=i(91776),b=i(91831),v=i(84935),k=i(64571),x=i(13103),T=i(25727),A=i(66510),S=i(11041),I=i(65691);let E={getGasPriceInEther:(e,t)=>Number(t*e)/1e18,getGasPriceInUSD(e,t,i){let a=E.getGasPriceInEther(t,i);return b.S.bigNumber(e).times(a).toNumber()},getPriceImpact({sourceTokenAmount:e,sourceTokenPriceInUSD:t,toTokenPriceInUSD:i,toTokenAmount:a}){let r=b.S.bigNumber(e).times(t),o=b.S.bigNumber(a).times(i);return r.minus(o).div(r).times(100).toNumber()},getMaxSlippage(e,t){let i=b.S.bigNumber(e).div(100);return b.S.multiply(t,i).toNumber()},getProviderFee:(e,t=.0085)=>b.S.bigNumber(e).times(t).toString(),isInsufficientNetworkTokenForGas:(e,t)=>!!b.S.bigNumber(e).eq(0)||b.S.bigNumber(b.S.bigNumber(t||"0")).gt(e),isInsufficientSourceTokenForSwap(e,t,i){let a=i?.find(e=>e.address===t)?.quantity?.numeric;return b.S.bigNumber(a||"0").lt(e)}};var P=i(8408),C=i(8352),$=i(74296),N=i(93935);let R={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:A.oU.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},O=(0,y.BX)({...R}),q={state:O,subscribe:e=>(0,y.B1)(O,()=>e(O)),subscribeKey:(e,t)=>(0,f.u$)(O,e,t),getParams(){let e=c.W.state.activeChain,t=c.W.getAccountData(e)?.caipAddress??c.W.state.activeCaipAddress,i=S.w.getPlainAddress(t),a=(0,T.K1)(),r=l.a.getConnectorId(c.W.state.activeChain);if(!i)throw Error("No address found to swap the tokens from.");let o=!O.toToken?.address||!O.toToken?.decimals,n=!O.sourceToken?.address||!O.sourceToken?.decimals||!b.S.bigNumber(O.sourceTokenAmount).gt(0),s=!O.sourceTokenAmount;return{networkAddress:a,fromAddress:i,fromCaipAddress:t,sourceTokenAddress:O.sourceToken?.address,toTokenAddress:O.toToken?.address,toTokenAmount:O.toTokenAmount,toTokenDecimals:O.toToken?.decimals,sourceTokenAmount:O.sourceTokenAmount,sourceTokenDecimals:O.sourceToken?.decimals,invalidToToken:o,invalidSourceToken:n,invalidSourceTokenAmount:s,availableToSwap:t&&!o&&!n&&!s,isAuthConnector:r===v.o.CONNECTOR_ID.AUTH}},async setSourceToken(e){if(!e){O.sourceToken=e,O.sourceTokenAmount="",O.sourceTokenPriceInUSD=0;return}O.sourceToken=e,await W.setTokenPrice(e.address,"sourceToken")},setSourceTokenAmount(e){O.sourceTokenAmount=e},async setToToken(e){if(!e){O.toToken=e,O.toTokenAmount="",O.toTokenPriceInUSD=0;return}O.toToken=e,await W.setTokenPrice(e.address,"toToken")},setToTokenAmount(e){O.toTokenAmount=e?b.S.toFixed(e,6):""},async setTokenPrice(e,t){let i=O.tokensPriceMap[e]||0;i||(O.loadingPrices=!0,i=await W.getAddressPrice(e)),"sourceToken"===t?O.sourceTokenPriceInUSD=i:"toToken"===t&&(O.toTokenPriceInUSD=i),O.loadingPrices&&(O.loadingPrices=!1),W.getParams().availableToSwap&&!O.switchingTokens&&W.swapTokens()},async switchTokens(){if(!O.initializing&&O.initialized&&!O.switchingTokens){O.switchingTokens=!0;try{let e=O.toToken?{...O.toToken}:void 0,t=O.sourceToken?{...O.sourceToken}:void 0,i=e&&""===O.toTokenAmount?"1":O.toTokenAmount;W.setSourceTokenAmount(i),W.setToTokenAmount(""),await W.setSourceToken(e),await W.setToToken(t),O.switchingTokens=!1,W.swapTokens()}catch(e){throw O.switchingTokens=!1,e}}},resetState(){O.myTokensWithBalance=R.myTokensWithBalance,O.tokensPriceMap=R.tokensPriceMap,O.initialized=R.initialized,O.initializing=R.initializing,O.switchingTokens=R.switchingTokens,O.sourceToken=R.sourceToken,O.sourceTokenAmount=R.sourceTokenAmount,O.sourceTokenPriceInUSD=R.sourceTokenPriceInUSD,O.toToken=R.toToken,O.toTokenAmount=R.toTokenAmount,O.toTokenPriceInUSD=R.toTokenPriceInUSD,O.networkPrice=R.networkPrice,O.networkTokenSymbol=R.networkTokenSymbol,O.networkBalanceInUSD=R.networkBalanceInUSD,O.inputError=R.inputError},resetValues(){let{networkAddress:e}=W.getParams(),t=O.tokens?.find(t=>t.address===e);W.setSourceToken(t),W.setToToken(void 0)},getApprovalLoadingState:()=>O.loadingApprovalTransaction,clearError(){O.transactionError=void 0},async initializeState(){if(!O.initializing){if(O.initializing=!0,!O.initialized)try{await W.fetchTokens(),O.initialized=!0}catch(e){O.initialized=!1,g.P.showError("Failed to initialize swap"),d.I.goBack()}O.initializing=!1}},async fetchTokens(){let{networkAddress:e}=W.getParams();await W.getNetworkTokenPrice(),await W.getMyTokensWithBalance();let t=O.myTokensWithBalance?.find(t=>t.address===e);t&&(O.networkTokenSymbol=t.symbol,W.setSourceToken(t),W.setSourceTokenAmount("0"))},async getTokenList(){let e=c.W.state.activeCaipNetwork?.caipNetworkId;if(O.caipNetworkId!==e||!O.tokens)try{O.tokensLoading=!0;let t=await I.s.getTokenList(e);O.tokens=t,O.caipNetworkId=e,O.popularTokens=t.sort((e,t)=>
1e.symbol<t.symbol?-1:+(e.symbol>t.symbol));let i=(e&&A.oU.SUGGESTED_TOKENS_BY_CHAIN?.[e]||[]).map(e=>t.find(t=>t.symbol===e)).filter(e=>!!e),a=(A.oU.SWAP_SUGGESTED_TOKENS||[]).map(e=>t.find(t=>t.symbol===e)).filter(e=>!!e).filter(e=>!i.some(t=>t.address===e.address));O.suggestedTokens=[...i,...a]}catch(e){O.tokens=[],O.popularTokens=[],O.suggestedTokens=[]}finally{O.tokensLoading=!1}},async getAddressPrice(e){let t=O.tokensPriceMap[e];if(t)return t;let i=await $.T.fetchTokenPrice({addresses:[e]}),a=i?.fungibles||[],r=[...O.tokens||[],...O.myTokensWithBalance||[]],o=r?.find(t=>t.address===e)?.symbol,n=parseFloat((a.find(e=>e.symbol.toLowerCase()===o?.toLowerCase())?.price||0).toString());return O.tokensPriceMap[e]=n,n},async getNetworkTokenPrice(){let{networkAddress:e}=W.getParams(),t=await $.T.fetchTokenPrice({addresses:[e]}).catch(()=>(g.P.showError("Failed to fetch network token price"),{fungibles:[]})),i=t.fungibles?.[0],a=i?.price.toString()||"0";O.tokensPriceMap[e]=parseFloat(a),O.networkTokenSymbol=i?.symbol||"",O.networkPrice=a},async getMyTokensWithBalance(e){let t=await x.Z.getMyTokensWithBalance({forceUpdate:e,caipNetwork:c.W.state.activeCaipNetwork,address:c.W.getAccountData()?.address}),i=I.s.mapBalancesToSwapTokens(t);i&&(await W.getInitialGasPrice(),W.setBalances(i))},setBalances(e){let{networkAddress:t}=W.getParams(),i=c.W.state.activeCaipNetwork;if(!i)return;let a=e.find(e=>e.address===t);e.forEach(e=>{O.tokensPriceMap[e.address]=e.price||0}),O.myTokensWithBalance=e.filter(e=>e.address.startsWith(i.caipNetworkId)),O.networkBalanceInUSD=a?b.S.multiply(a.quantity.numeric,a.price).toString():"0"},async getInitialGasPrice(){let e=await I.s.fetchGasPrice();if(!e)return{gasPrice:null,gasPriceInUSD:null};switch(c.W.state?.activeCaipNetwork?.chainNamespace){case v.o.CHAIN.SOLANA:return O.gasFee=e.standard??"0",O.gasPriceInUSD=b.S.multiply(e.standard,O.networkPrice).div(1e9).toNumber(),{gasPrice:BigInt(O.gasFee),gasPriceInUSD:Number(O.gasPriceInUSD)};case v.o.CHAIN.EVM:default:let t=e.standard??"0",i=BigInt(t),a=BigInt(15e4),r=E.getGasPriceInUSD(O.networkPrice,a,i);return O.gasFee=t,O.gasPriceInUSD=r,{gasPrice:i,gasPriceInUSD:r}}},async swapTokens(){let e=c.W.getAccountData()?.address,t=O.sourceToken,i=O.toToken,a=b.S.bigNumber(O.sourceTokenAmount).gt(0);if(a||W.setToTokenAmount(""),!i||!t||O.loadingPrices||!a||!e)return;O.loadingQuote=!0;let r=b.S.bigNumber(O.sourceTokenAmount).times(10**t.decimals).round(0).toFixed(0);try{let a=await $.T.fetchSwapQuote({userAddress:e,from:t.address,to:i.address,gasPrice:O.gasFee,amount:r.toString()});O.loadingQuote=!1;let o=a?.quotes?.[0]?.toAmount;if(!o)return void C.h.open({displayMessage:"Incorrect amount",debugMessage:"Please enter a valid amount"},"error");let n=b.S.bigNumber(o).div(10**i.decimals).toString();W.setToTokenAmount(n),W.hasInsufficientToken(O.sourceTokenAmount,t.address)?O.inputError="Insufficient balance":(O.inputError=void 0,W.setTransactionDetails())}catch(t){let e=await I.s.handleSwapError(t);O.loadingQuote=!1,O.inputError=e||"Insufficient balance"}},async getTransaction(){let{fromCaipAddress:e,availableToSwap:t}=W.getParams(),i=O.sourceToken,a=O.toToken;if(e&&t&&i&&a&&!O.loadingQuote)try{let t;return O.loadingBuildTransaction=!0,t=await I.s.fetchSwapAllowance({userAddress:e,tokenAddress:i.address,sourceTokenAmount:O.sourceTokenAmount,sourceTokenDecimals:i.decimals})?await W.createSwapTransaction():await W.createAllowanceTransaction(),O.loadingBuildTransaction=!1,O.fetchError=!1,t}catch(e){d.I.goBack(),g.P.showError("Failed to check allowance"),O.loadingBuildTransaction=!1,O.approvalTransaction=void 0,O.swapTransaction=void 0,O.fetchError=!0;return}},async createAllowanceTransaction(){let{fromCaipAddress:e,sourceTokenAddress:t,toTokenAddress:i}=W.getParams();if(e&&i){if(!t)throw Error("createAllowanceTransaction - No source token address found.");try{let a=await $.T.generateApproveCalldata({from:t,to:i,userAddress:e}),r=S.w.getPlainAddress(a.tx.from);if(!r)throw Error("SwapController:createAllowanceTransaction - address is required");
1let o={data:a.tx.data,to:r,gasPrice:BigInt(a.tx.eip155.gasPrice),value:BigInt(a.tx.value),toAmount:O.toTokenAmount};return O.swapTransaction=void 0,O.approvalTransaction={data:o.data,to:o.to,gasPrice:o.gasPrice,value:o.value,toAmount:o.toAmount},{data:o.data,to:o.to,gasPrice:o.gasPrice,value:o.value,toAmount:o.toAmount}}catch(e){d.I.goBack(),g.P.showError("Failed to create approval transaction"),O.approvalTransaction=void 0,O.swapTransaction=void 0,O.fetchError=!0;return}}},async createSwapTransaction(){let{networkAddress:e,fromCaipAddress:t,sourceTokenAmount:i}=W.getParams(),a=O.sourceToken,r=O.toToken;if(!t||!i||!a||!r)return;let o=p.x.parseUnits(i,a.decimals)?.toString();try{let i=await $.T.generateSwapCalldata({userAddress:t,from:a.address,to:r.address,amount:o,disableEstimate:!0}),n=a.address===e,s=BigInt(i.tx.eip155.gas),c=BigInt(i.tx.eip155.gasPrice),l=S.w.getPlainAddress(i.tx.to);if(!l)throw Error("SwapController:createSwapTransaction - address is required");let u={data:i.tx.data,to:l,gas:s,gasPrice:c,value:n?BigInt(o??"0"):BigInt("0"),toAmount:O.toTokenAmount};return O.gasPriceInUSD=E.getGasPriceInUSD(O.networkPrice,s,c),O.approvalTransaction=void 0,O.swapTransaction=u,u}catch(e){d.I.goBack(),g.P.showError("Failed to create transaction"),O.approvalTransaction=void 0,O.swapTransaction=void 0,O.fetchError=!0;return}},onEmbeddedWalletApprovalSuccess(){g.P.showLoading("Approve limit increase in your wallet"),d.I.replace("SwapPreview")},async sendTransactionForApproval(e){let{fromAddress:t,isAuthConnector:i}=W.getParams();O.loadingApprovalTransaction=!0,i?d.I.pushTransactionStack({onSuccess:W.onEmbeddedWalletApprovalSuccess}):g.P.showLoading("Approve limit increase in your wallet");try{await p.x.sendTransaction({address:t,to:e.to,data:e.data,value:e.value,chainNamespace:v.o.CHAIN.EVM}),await W.swapTokens(),await W.getTransaction(),O.approvalTransaction=void 0,O.loadingApprovalTransaction=!1}catch(e){O.transactionError=e?.displayMessage,O.loadingApprovalTransaction=!1,g.P.showError(e?.displayMessage||"Transaction error"),N.E.sendEvent({type:"track",event:"SWAP_APPROVAL_ERROR",properties:{message:e?.displayMessage||e?.message||"Unknown",network:c.W.state.activeCaipNetwork?.caipNetworkId||"",swapFromToken:W.state.sourceToken?.symbol||"",swapToToken:W.state.toToken?.symbol||"",swapFromAmount:W.state.sourceTokenAmount||"",swapToAmount:W.state.toTokenAmount||"",isSmartAccount:(0,T.lj)(v.o.CHAIN.EVM)===k.Vl.ACCOUNT_TYPES.SMART_ACCOUNT}})}},async sendTransactionForSwap(e){if(!e)return;let{fromAddress:t,toTokenAmount:i,isAuthConnector:a}=W.getParams();O.loadingTransaction=!0;let r=`Swapping ${O.sourceToken?.symbol} to ${b.S.formatNumberToLocalString(i,3)} ${O.toToken?.symbol}`,o=`Swapped ${O.sourceToken?.symbol} to ${b.S.formatNumberToLocalString(i,3)} ${O.toToken?.symbol}`;a?d.I.pushTransactionStack({onSuccess(){d.I.replace("Account"),g.P.showLoading(r),q.resetState()}}):g.P.showLoading("Confirm transaction in your wallet");try{let i=[O.sourceToken?.address,O.toToken?.address].join(","),r=await p.x.sendTransaction({address:t,to:e.to,data:e.data,value:e.value,chainNamespace:v.o.CHAIN.EVM});return O.loadingTransaction=!1,g.P.showSuccess(o),N.E.sendEvent({type:"track",event:"SWAP_SUCCESS",properties:{network:c.W.state.activeCaipNetwork?.caipNetworkId||"",swapFromToken:W.state.sourceToken?.symbol||"",swapToToken:W.state.toToken?.symbol||"",swapFromAmount:W.state.sourceTokenAmount||"",swapToAmount:W.state.toTokenAmount||"",isSmartAccount:(0,T.lj)(v.o.CHAIN.EVM)===k.Vl.ACCOUNT_TYPES.SMART_ACCOUNT}}),q.resetState(),a||d.I.replace("Account"),q.getMyTokensWithBalance(i),r}catch(e){O.transactionError=e?.displayMessage,O.loadingTransaction=!1,g.P.showError(e?.displayMessage||"Transaction error"),N.E.sendEvent({type:"track",event:"SWAP_ERROR",properties:{message:e?.displayMessage||e?.message||"Unknown",network:c.W.state.activeCaipNetwork?.caipNetworkId||"",swapFromToken:W.state.sourceToken?.symbol||"",swapToToken:W.state.toToken?.symbol||"",swapFromAmount:W.state.sourceTokenAmount||"",swapToAmount:W.state.toTokenAmount||"",isSmartAccount:(0,T.lj)(v.o.CHAIN.EVM)===k.
1Vl.ACCOUNT_TYPES.SMART_ACCOUNT}});return}},hasInsufficientToken:(e,t)=>E.isInsufficientSourceTokenForSwap(e,t,O.myTokensWithBalance),setTransactionDetails(){let{toTokenAddress:e,toTokenDecimals:t}=W.getParams();e&&t&&(O.gasPriceInUSD=E.getGasPriceInUSD(O.networkPrice,BigInt(O.gasFee),BigInt(15e4)),O.priceImpact=E.getPriceImpact({sourceTokenAmount:O.sourceTokenAmount,sourceTokenPriceInUSD:O.sourceTokenPriceInUSD,toTokenPriceInUSD:O.toTokenPriceInUSD,toTokenAmount:O.toTokenAmount}),O.maxSlippage=E.getMaxSlippage(O.slippage,O.toTokenAmount),O.providerFee=E.getProviderFee(O.sourceTokenAmount))}},W=(0,P.X)(q);var _=i(76175),U=i(44474),D=i(82421),M=i(67626);let L=(0,M.AH)` 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`,F=class extends a.WF{render(){return(0,a.qy)`<slot></slot>`}};F.styles=[U.W5,L],F=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n}([(0,D.E)("wui-card")],F),i(609),i(20187),i(58642),i(78424);let z=(0,M.AH)` 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`;var B=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let j={info:"info",success:"checkmark",warning:"warningCircle",error:"warning"},H=class extends a.WF{constructor(){super(...arguments),this.message="",this.type="info"}render(){return(0,a.qy)` 86 <wui-flex 87 data-type=${(0,o.J)(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=${j[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(){C.h.close()}};H.styles=[U.W5,z],B([(0,r.MZ)()],H.prototype,"message",void 0),B([(0,r.MZ)()],H.prototype,"type",void 0),H=B([(0,D.E)("wui-alertbar")],H);let V=(0,_.AH)` 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`;var G=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let Z={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"}},Y=class extends a.WF{constructor(){super(),this.unsubscribe=[],this.open=C.h.state.open,this.onOpen(!0),this.unsubscribe.push(C.h.subscribeKey("open",e=>{this.open=e,this.onOpen(!1)}))}
124disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let{message:e,variant:t}=C.h.state,i=Z[t];return(0,a.qy)` 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")}};Y.styles=V,G([(0,r.wk)()],Y.prototype,"open",void 0),Y=G([(0,_.EM)("w3m-alertbar")],Y);var K=i(2502),Q=i(6542);let J=(0,M.AH)` 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`;var X=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let ee=class extends a.WF{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(0,a.qy)`<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=${(0,o.J)(this.iconSize)}></wui-icon> 261 </button>`}}
261;ee.styles=[U.W5,U.fD,J],X([(0,r.MZ)()],ee.prototype,"icon",void 0),X([(0,r.MZ)()],ee.prototype,"variant",void 0),X([(0,r.MZ)()],ee.prototype,"type",void 0),X([(0,r.MZ)()],ee.prototype,"size",void 0),X([(0,r.MZ)()],ee.prototype,"iconSize",void 0),X([(0,r.MZ)({type:Boolean})],ee.prototype,"fullWidth",void 0),X([(0,r.MZ)({type:Boolean})],ee.prototype,"disabled",void 0),ee=X([(0,D.E)("wui-icon-button")],ee),i(16568);let et=(0,M.AH)` 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`;var ei=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let ea={lg:"lg-regular",md:"md-regular",sm:"sm-regular"},er={lg:"lg",md:"md",sm:"sm"},eo=class extends a.WF{constructor(){super(...arguments),this.imageSrc="",this.text="",this.size="lg",this.type="text-dropdown",this.disabled=!1}render(){return(0,a.qy)`<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(){let e=ea[this.size];return this.text?(0,a.qy)`<wui-text color="primary" variant=${e}>${this.text}</wui-text>`:null}imageTemplate(){if(this.imageSrc)return(0,a.qy)`<wui-image src=${this.imageSrc} alt="select visual"></wui-image>`;let e=er[this.size];return(0,a.qy)` <wui-flex class="left-icon-container"> 370 <wui-icon size=${e} name="networkPlaceholder"></wui-icon> 371 </wui-flex>`}};eo.styles=[U.W5,U.fD,et],ei([(0,r.MZ)()],eo.prototype,"imageSrc",void 0),ei([(0,r.MZ)()],eo.prototype,"text",void 0),ei([(0,r.MZ)()],eo.prototype,"size",void 0),ei([(0,r.MZ)()],eo.prototype,"type",void 0),ei([(0,r.MZ)({type:Boolean})],eo.prototype,"disabled",void 0),eo=ei([(0,D.E)("wui-select")],eo),i(37219),i(99481);var en=i(87358);let es={ACCOUNT_TABS:[{label:"Tokens"},{label:"Activity"}],SECURE_SITE_ORIGIN:(void 0!==en&&void 0!==en.env?en.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"]};i(51134),i(47703);let ec=(0,M.AH)` 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`;var el=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let eu=class extends a.WF{constructor(){super(...arguments),this.size="md",this.disabled=!1,this.icon="copy",this.iconColor="default",this.variant="accent"}render(){return(0,a.qy)` 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 `}};eu.styles=[U.W5,U.fD,ec],el([(0,r.MZ)()],eu.prototype,"size",void 0),el([(0,r.MZ)({type:Boolean})],eu.prototype,"disabled",void 0),el([(0,r.MZ)()],eu.prototype,"icon",void 0),el([(0,r.MZ)()],eu.prototype,"iconColor",void 0),el([(0,r.MZ)()],eu.prototype,"variant",void 0),eu=el([(0,D.E)("wui-icon-link")],eu),i(60790),i(91738);let ed=(0,a.JW)`<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>`;var ep=i(69359);let eh=(0,a.JW)` 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`,em=(0,M.AH)` 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`;var ew=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let eg=class extends a.WF{constructor(){super(...arguments),this.size="md",this.name="uknown",this.networkImagesBySize={sm:eh,md:ep.a,lg:ed},this.selected=!1,this.round=!1}render(){return this.round?(this.dataset.round="true",this.style.cssText=` 501 --local-width: var(--apkt-spacing-10); 502 --local-height: var(--apkt-spacing-10); 503 --local-icon-size: var(--apkt-spacing-4); 504 `):this.style.cssText=` 505 506 --local-path: var(--apkt-path-network-${this.size}); 507 --local-width: var(--apkt-width-network-${this.size}); 508 --local-height: var(--apkt-height-network-${this.size}); 509 --local-icon-size: var(--apkt-spacing-${({sm:"4",md:"6",lg:"10"})[this.size]}); 510 `,(0,a.qy)`${this.templateVisual()} ${this.svgTemplate()} `}svgTemplate(){return this.round?null:this.networkImagesBySize[this.size]}templateVisual(){return this.imageSrc?(0,a.qy)`<wui-image src=${this.imageSrc} alt=${this.name}></wui-image>`:(0,a.qy)`<wui-icon size="inherit" color="default" name="networkPlaceholder"></wui-icon>`}};eg.styles=[U.W5,em],ew([(0,r.MZ)()],eg.prototype,"size",void 0),ew([(0,r.MZ)()],eg.prototype,"name",void 0),ew([(0,r.MZ)({type:Object})],eg.prototype,"networkImagesBySize",void 0),ew([(0,r.MZ)()],eg.prototype,"imageSrc",void 0),ew([(0,r.MZ)({type:Boolean})],eg.prototype,"selected",void 0),ew([(0,r.MZ)({type:Boolean})],eg.prototype,"round",void 0),eg=ew([(0,D.E)("wui-network-image")],eg);let ey=(0,M.AH)` 511 :host { 512 position: relative; 513 display: flex; 514 width: 100%; 515 height: 1px; 516 background-color: ${({tokens:e})=>e.theme.borderPrimary}; 517 justify-content: center;
518 align-items: center; 519 } 520 521 :host > wui-text { 522 position: absolute; 523 padding: 0px 8px; 524 transition: background-color ${({durations:e})=>e.lg} 525 ${({easings:e})=>e["ease-out-power-2"]}; 526 will-change: background-color; 527 } 528 529 :host([data-bg-color='primary']) > wui-text { 530 background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; 531 } 532 533 :host([data-bg-color='secondary']) > wui-text { 534 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 535 } 536`;var ef=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let eb=class extends a.WF{constructor(){super(...arguments),this.text="",this.bgColor="primary"}render(){return this.dataset.bgColor=this.bgColor,(0,a.qy)`${this.template()}`}template(){return this.text?(0,a.qy)`<wui-text variant="md-regular" color="secondary">${this.text}</wui-text>`:null}};eb.styles=[U.W5,ey],ef([(0,r.MZ)()],eb.prototype,"text",void 0),ef([(0,r.MZ)()],eb.prototype,"bgColor",void 0),eb=ef([(0,D.E)("wui-separator")],eb),i(1339);var ev=i(24661),ek=i(40609);let ex={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"},eT={[ex.INVALID_PAYMENT_CONFIG]:"Invalid payment configuration",[ex.INVALID_RECIPIENT]:"Invalid recipient address",[ex.INVALID_ASSET]:"Invalid asset specified",[ex.INVALID_AMOUNT]:"Invalid payment amount",[ex.INVALID_RECIPIENT_ADDRESS_FOR_ASSET]:"Invalid recipient address for the asset selected",[ex.UNKNOWN_ERROR]:"Unknown payment error occurred",[ex.UNABLE_TO_INITIATE_PAYMENT]:"Unable to initiate payment",[ex.INVALID_CHAIN_NAMESPACE]:"Invalid chain namespace",[ex.GENERIC_PAYMENT_ERROR]:"Unable to process payment",[ex.UNABLE_TO_GET_EXCHANGES]:"Unable to get exchanges",[ex.ASSET_NOT_SUPPORTED]:"Asset not supported by the selected exchange",[ex.UNABLE_TO_GET_PAY_URL]:"Unable to get payment URL",[ex.UNABLE_TO_GET_BUY_STATUS]:"Unable to get buy status",[ex.UNABLE_TO_GET_TOKEN_BALANCES]:"Unable to get token balances",[ex.UNABLE_TO_GET_QUOTE]:"Unable to get quote. Please choose a different token",[ex.UNABLE_TO_GET_QUOTE_STATUS]:"Unable to get quote status"};class eA extends Error{get message(){return eT[this.code]}constructor(e,t){super(eT[e]),this.name="AppKitPayError",this.code=e,this.details=t,Error.captureStackTrace&&Error.captureStackTrace(this,eA)}}var eS=i(62950);let eI="reown_test";var eE=i(62473),eP=i(97051);async function eC(e,t,i){if(t!==v.o.CHAIN.EVM)throw new eA(ex.INVALID_CHAIN_NAMESPACE);if(!i.fromAddress)throw new eA(ex.INVALID_PAYMENT_CONFIG,"fromAddress is required for native EVM payments.");let a="string"==typeof i.amount?parseFloat(i.amount):i.amount;if(isNaN(a))throw new eA(ex.INVALID_PAYMENT_CONFIG);let r=e.metadata?.decimals??18,o=p.x.parseUnits(a.toString(),r);if("bigint"!=typeof o)throw new eA(ex.GENERIC_PAYMENT_ERROR);return await p.x.sendTransaction({chainNamespace:t,to:i.recipient,address:i.fromAddress,value:o,data:"0x"})??void 0}async function e$(e,t){if(!t.fromAddress)throw new eA(ex.INVALID_PAYMENT_CONFIG,"fromAddress is required for ERC20 EVM payments.");let i=e.asset,a=t.recipient,r=Number(e.metadata.decimals),o=p.x.parseUnits(t.amount.toString(),r);if(void 0===o)throw new eA(ex.GENERIC_PAYMENT_ERROR);return await p.x.writeContract({fromAddress:t.fromAddress,tokenAddress:i,args:[a,o],method:"transfer",abi:eE.v.getERC20Abi(i),chainNamespace:v.o.CHAIN.EVM})??void 0}async function eN(e,t){if(e!==v.o.CHAIN.SOLANA)throw new eA(ex.INVALID_CHAIN_NAMESPACE);if(!t.fromAddress)throw new eA(ex.INVALID_PAYMENT_CONFIG,"fromAddress is required for Solana payments.");let i="string"==typeof t.amount?parseFloat(t.amount):t.amount;if(isNaN(i)||i<=0)throw new eA(ex.INVALID_PAYMENT_CONFIG,"Invalid payment amount.");try{if(!eP.G.getProvider(e))throw new eA(ex.GENERIC_PAYMENT_ERROR,"No Solana provider available.");let a=await p.x.sendTransaction({chainNamespace:v.o.CHAIN.SOLANA,to:t.recipient,value:i,tokenMint:t.tokenMint});if(!a)throw new eA(ex.GENERIC_PAYMENT_ERROR,"Transaction failed.");return a}catch(e){if(e instanceof eA)throw e;throw new eA(ex.GENERIC_PAYMENT_ERROR,`Solana payment failed: ${e}`)}}async function eR({sourceToken:e,toToken:t,amount:i,recipient:a}){let r=p.x.parseUnits(i,e.metadata.decimals),o=p.x.parseUnits(i,t.metadata.decimals);return Promise.resolve({type:eJ,origin:{amount:r?.toString()??"0",currency:e},destination:{amount:o?.toString()??"0",currency:t},fees:[{id:"service",label:"Service Fee",amount:"0",currency:t}],steps:[{requestId:eJ,type:"deposit",deposit:{amount:r?.toString()??"0",currency:e.asset,receiver:a}}],timeInSeconds:6})}function eO(e){if(!e)return null;let t=e.steps[0];
536return t&&t.type===eX?t:null}function eq(e,t=0){if(!e)return[];let i=e.steps.filter(e=>e.type===e0),a=i.filter((e,i)=>i+1>t);return i.length>0&&i.length<3?a:[]}let eW=new eS.Z({baseUrl:S.w.getApiUrl(),clientId:null});class e_ extends Error{}function eU(){let{projectId:e,sdkType:t,sdkVersion:i}=n.H.state;return{projectId:e,st:t||"appkit",sv:i||"html-wagmi-4.2.2"}}async function eD(e,t){let i=function(){let e=n.H.getSnapshot().projectId;return`https://rpc.walletconnect.org/v1/json-rpc?projectId=${e}`}(),{sdkType:a,sdkVersion:r,projectId:o}=n.H.getSnapshot(),s={jsonrpc:"2.0",id:1,method:e,params:{...t||{},st:a,sv:r,projectId:o}},c=await fetch(i,{method:"POST",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}}),l=await c.json();if(l.error)throw new e_(l.error.message);return l}async function eM(e){return(await eD("reown_getExchanges",e)).result}async function eL(e){return(await eD("reown_getExchangePayUrl",e)).result}async function eF(e){return(await eD("reown_getExchangeBuyStatus",e)).result}async function ez(e){let t=b.S.bigNumber(e.amount).times(10**e.toToken.metadata.decimals).toString(),{chainId:i,chainNamespace:a}=ev.C.parseCaipNetworkId(e.sourceToken.network),{chainId:r,chainNamespace:o}=ev.C.parseCaipNetworkId(e.toToken.network),n="native"===e.sourceToken.asset?(0,T.NH)(a):e.sourceToken.asset,s="native"===e.toToken.asset?(0,T.NH)(o):e.toToken.asset;return await eW.post({path:"/appkit/v1/transfers/quote",body:{user:e.address,originChainId:i.toString(),originCurrency:n,destinationChainId:r.toString(),destinationCurrency:s,recipient:e.recipient,amount:t},params:eU()})}async function eB(e){let t=ek.y.isLowerCaseMatch(e.sourceToken.network,e.toToken.network),i=ek.y.isLowerCaseMatch(e.sourceToken.asset,e.toToken.asset);return t&&i?eR(e):ez(e)}async function ej(e){return await eW.get({path:"/appkit/v1/transfers/status",params:{requestId:e.requestId,...eU()}})}async function eH(e){return await eW.get({path:`/appkit/v1/transfers/assets/exchanges/${e}`,params:eU()})}let eV=["eip155","solana"],eG={eip155:{native:{assetNamespace:"slip44",assetReference:"60"},defaultTokenNamespace:"erc20"},solana:{native:{assetNamespace:"slip44",assetReference:"501"},defaultTokenNamespace:"token"}},eZ={56:"714",204:"714"};function eY(e,t){let{chainNamespace:i,chainId:a}=ev.C.parseCaipNetworkId(e),r=eG[i];if(!r)throw Error(`Unsupported chain namespace for CAIP-19 formatting: ${i}`);let o=r.native.assetNamespace,n=r.native.assetReference;"native"!==t?(o=r.defaultTokenNamespace,n=t):"eip155"===i&&eZ[a]&&(n=eZ[a]);let s=`${i}:${a}`;return`${s}/${o}:${n}`}function eK(e){let t=b.S.bigNumber(e,{safe:!0});return t.lt(.001)?"<0.001":t.round(4).toString()}let eQ="unknown",eJ="direct-transfer",eX="deposit",e0="transaction",e1=(0,y.BX)({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:{[v.o.CHAIN.EVM]:[],[v.o.CHAIN.SOLANA]:[]},isFetchingTokenBalances:!1,selectedPaymentAsset:null,quote:void 0,quoteStatus:"waiting",quoteError:null,isFetchingQuote:!1,selectedExchange:void 0,exchangeUrlForQuote:void 0,requestId:void 0}),e3={state:e1,subscribe:e=>(0,y.B1)(e1,()=>e(e1)),subscribeKey:(e,t)=>(0,f.u$)(e1,e,t),async handleOpenPay(e){this.resetState(),this.setPaymentConfig(e),this.initializeAnalytics();let{chainNamespace:t}=ev.C.parseCaipNetworkId(e3.state.paymentAsset.network);if(!S.w.isAddress(e3.state.recipient,t))throw new eA(ex.INVALID_RECIPIENT_ADDRESS_FOR_ASSET,`Provide valid recipient address for namespace "${t}"`);await this.prepareTokenLogo(),e1.isConfigured=!0,N.E.sendEvent({type:"track",event:"PAY_MODAL_OPEN",properties:{exchanges:e1.exchanges,configuration:{network:e1.paymentAsset.network,asset:e1.paymentAsset.asset,recipient:e1.recipient,amount:e1.amount}}}),await s.W.open({view:"Pay"})},resetState(){e1.paymentAsset={network:"eip155:1",asset:"0x0",metadata:{name:"0x0",symbol:"0x0",decimals:0}},e1.recipient="0x0",e1.amount=0,e1.isConfigured=!1,e1.error=null,e1.isPaymentInProgress=!1,e1.isLoading=!1,e1.currentPayment=void 0,e1.selectedExchange=void 0,e1.exchangeUrlForQuote=void 0,e1.requestId=void 0},resetQuoteState(){e1.quote=void 0,e1.quoteStatus="waiting",e1.quoteError=null,e1.isFetchingQuote=!1,e1.requestId=void 0},setPaymentConfig(e){if(!e.paymentAsset)throw new eA(ex.INVALID_PAYMENT_CONFIG);try{e1.choice=e.choice??"pay",e1.paymentAsset=e.paymentAsset,e1.recipient=e.recipient,e1.amount=e.amount,e1.openInNewTab=e.openInNewTab??!0,e1.redirectUrl=e.redirectUrl,e1.payWithExchange=e.payWithExchange,e1.error=null}catch(e){throw new eA(ex.INVALID_PAYMENT_CONFIG,e.message)}},setSelectedPaymentAsset(e){e1.selectedPaymentAsset=e},setSelectedExchange(e){e1.selectedExchange=e},setRequestId(e){e1.requestId=e},setPaymentInProgress(e){e1.isPaymentInProgress=e},getPaymentAsset:()=>
536e1.paymentAsset,getExchanges:()=>e1.exchanges,async fetchExchanges(){try{e1.isLoading=!0,e1.exchanges=(await eM({page:0})).exchanges.slice(0,2)}catch(e){throw g.P.showError(eT.UNABLE_TO_GET_EXCHANGES),new eA(ex.UNABLE_TO_GET_EXCHANGES)}finally{e1.isLoading=!1}},async getAvailableExchanges(e){try{let t=e?.asset&&e?.network?eY(e.network,e.asset):void 0;return await eM({page:e?.page??0,asset:t,amount:e?.amount?.toString()})}catch(e){throw new eA(ex.UNABLE_TO_GET_EXCHANGES)}},async getPayUrl(e,t,i=!1){try{let a=Number(t.amount),r=await eL({exchangeId:e,asset:eY(t.network,t.asset),amount:a.toString(),recipient:`${t.network}:${t.recipient}`});return N.E.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{source:"pay",exchange:{id:e},configuration:{network:t.network,asset:t.asset,recipient:t.recipient,amount:a},currentPayment:{type:"exchange",exchangeId:e},headless:i}}),i&&(this.initiatePayment(),N.E.sendEvent({type:"track",event:"PAY_INITIATED",properties:{source:"pay",paymentId:e1.paymentId||eQ,configuration:{network:t.network,asset:t.asset,recipient:t.recipient,amount:a},currentPayment:{type:"exchange",exchangeId:e}}})),r}catch(e){if(e instanceof Error&&e.message.includes("is not supported"))throw new eA(ex.ASSET_NOT_SUPPORTED);throw Error(e.message)}},async generateExchangeUrlForQuote({exchangeId:e,paymentAsset:t,amount:i,recipient:a}){let r=await eL({exchangeId:e,asset:eY(t.network,t.asset),amount:i.toString(),recipient:a});e1.exchangeSessionId=r.sessionId,e1.exchangeUrlForQuote=r.url},async openPayUrl(e,t,i=!1){try{let a=await this.getPayUrl(e.exchangeId,t,i);if(!a)throw new eA(ex.UNABLE_TO_GET_PAY_URL);let r=e.openInNewTab??!0;return S.w.openHref(a.url,r?"_blank":"_self"),a}catch(e){throw e instanceof eA?e1.error=e.message:e1.error=eT.GENERIC_PAYMENT_ERROR,new eA(ex.UNABLE_TO_GET_PAY_URL)}},async onTransfer({chainNamespace:e,fromAddress:t,toAddress:i,amount:a,paymentAsset:r}){if(e1.currentPayment={type:"wallet",status:"IN_PROGRESS"},!e1.isPaymentInProgress)try{this.initiatePayment();let o=c.W.getAllRequestedCaipNetworks().find(e=>e.caipNetworkId===r.network);if(!o)throw Error("Target network not found");let n=c.W.state.activeCaipNetwork;switch(!ek.y.isLowerCaseMatch(n?.caipNetworkId,o.caipNetworkId)&&await c.W.switchActiveNetwork(o),e){case v.o.CHAIN.EVM:"native"===r.asset&&(e1.currentPayment.result=await eC(r,e,{recipient:i,amount:a,fromAddress:t})),r.asset.startsWith("0x")&&(e1.currentPayment.result=await e$(r,{recipient:i,amount:a,fromAddress:t})),e1.currentPayment.status="SUCCESS";break;case v.o.CHAIN.SOLANA:e1.currentPayment.result=await eN(e,{recipient:i,amount:a,fromAddress:t,tokenMint:"native"===r.asset?void 0:r.asset}),e1.currentPayment.status="SUCCESS";break;default:throw new eA(ex.INVALID_CHAIN_NAMESPACE)}}catch(e){throw e instanceof eA?e1.error=e.message:e1.error=eT.GENERIC_PAYMENT_ERROR,e1.currentPayment.status="FAILED",g.P.showError(e1.error),e}finally{e1.isPaymentInProgress=!1}},async onSendTransaction(e){try{let{namespace:t,transactionStep:i}=e;e3.initiatePayment();let a=c.W.getAllRequestedCaipNetworks().find(e=>e.caipNetworkId===e1.paymentAsset?.network);if(!a)throw Error("Target network not found");let r=c.W.state.activeCaipNetwork;if(ek.y.isLowerCaseMatch(r?.caipNetworkId,a.caipNetworkId)||await c.W.switchActiveNetwork(a),t===v.o.CHAIN.EVM){let{from:e,to:a,data:r,value:o}=i.transaction;await p.x.sendTransaction({address:e,to:a,data:r,value:BigInt(o),chainNamespace:t})}else if(t===v.o.CHAIN.SOLANA){let{instructions:e}=i.transaction;await p.x.writeSolanaTransaction({instructions:e})}}catch(e){throw e instanceof eA?e1.error=e.message:e1.error=eT.GENERIC_PAYMENT_ERROR,g.P.showError(e1.error),e}finally{e1.isPaymentInProgress=!1}},getExchangeById:e=>e1.exchanges.find(t=>t.id===e),validatePayConfig(e){let{paymentAsset:t,recipient:i,amount:a}=e;if(!t)throw new eA(ex.INVALID_PAYMENT_CONFIG);if(!i)throw new eA(ex.INVALID_RECIPIENT);if(!t.asset)throw new eA(ex.INVALID_ASSET);if(null==a||a<=0)throw new eA(ex.INVALID_AMOUNT)},async handlePayWithExchange(e){try{e1.currentPayment={type:"exchange",exchangeId:e};let{network:t,asset:i}=e1.paymentAsset,a={network:t,asset:i,amount:e1.amount,recipient:e1.recipient},r=await this.getPayUrl(e,a);if(!r)throw new eA(ex.UNABLE_TO_INITIATE_PAYMENT);return e1.currentPayment.sessionId=r.sessionId,e1.currentPayment.status="IN_PROGRESS",e1.currentPayment.exchangeId=e,this.initiatePayment(),{url:r.url,openInNewTab:e1.openInNewTab}}catch(e){return e instanceof eA?e1.error=e.message:e1.error=eT.GENERIC_PAYMENT_ERROR,e1.isPaymentInProgress=!1,g.P.showError(e1.error),null}},async getBuyStatus(e,t){try{let i=await eF({sessionId:t,exchangeId:e});return("SUCCESS"===i.status||"FAILED"===i.status)&&N.E.sendEvent({type:"track",event:"SUCCESS"===i.status?"PAY_SUCCESS":"PAY_ERROR",properties:{message:"FAILED"===i.status?S.w.parseError(e1.error):void 0,source:"pay",paymentId:e1.paymentId||eQ,configuration:{network:e1.paymentAsset.network,asset:e1.paymentAsset.asset,recipient:e1.recipient,amount:e1.amount},currentPayment:{type:"exchange",exchangeId:e1.currentPayment?.exchangeId,sessionId:e1.currentPayment?.sessionId,result:i.txHash}}}),i}catch(e){throw new eA(ex.UNABLE_TO_GET_BUY_STATUS)}},async fetchTokensFromEOA({caipAddress:e,caipNetwork:t,namespace:i}){if(!e)return[];let{address:a}=ev.C.parseCaipAddress(e),r=t;return i===v.o.CHAIN.EVM&&(r=void 0),await x.Z.getMyTokensWithBalance({address:a,caipNetwork:r})},async fetchTokensFromExchange(){if(!e1.selectedExchange)return[];let e=Object.values((await eH(e1.selectedExchange.id)).assets).flat();return await Promise.all(e.map(async e=>{let t={chainId:e.network,address:`${e.network}:${e.asset}
536`,symbol:e.metadata.symbol,name:e.metadata.name,iconUrl:e.metadata.logoURI||"",price:0,quantity:{numeric:"0",decimals:e.metadata.decimals.toString()}},{chainNamespace:i}=ev.C.parseCaipNetworkId(t.chainId),a=t.address;if(S.w.isCaipAddress(a)){let{address:e}=ev.C.parseCaipAddress(a);a=e}return t.iconUrl=await K.$.getImageByToken(a??"",i).catch(()=>void 0)??"",t}))},async fetchTokens({caipAddress:e,caipNetwork:t,namespace:i}){try{e1.isFetchingTokenBalances=!0;let a=e1.selectedExchange?this.fetchTokensFromExchange():this.fetchTokensFromEOA({caipAddress:e,caipNetwork:t,namespace:i}),r=await a;e1.tokenBalances={...e1.tokenBalances,[i]:r}}catch(t){let e=t instanceof Error?t.message:"Unable to get token balances";g.P.showError(e)}finally{e1.isFetchingTokenBalances=!1}},async fetchQuote({amount:e,address:t,sourceToken:i,toToken:a,recipient:r}){try{e3.resetQuoteState(),e1.isFetchingQuote=!0;let o=await eB({amount:e,address:e1.selectedExchange?void 0:t,sourceToken:i,toToken:a,recipient:r});if(e1.selectedExchange){let e=eO(o);if(e){let t=`${i.network}:${e.deposit.receiver}`,a=b.S.formatNumber(e.deposit.amount,{decimals:i.metadata.decimals??0,round:8});await e3.generateExchangeUrlForQuote({exchangeId:e1.selectedExchange.id,paymentAsset:i,amount:a.toString(),recipient:t})}}e1.quote=o}catch(t){let e=eT.UNABLE_TO_GET_QUOTE;if(t instanceof Error&&t.cause&&t.cause instanceof Response)try{let i=await t.cause.json();i.error&&"string"==typeof i.error&&(e=i.error)}catch{}throw e1.quoteError=e,g.P.showError(e),new eA(ex.UNABLE_TO_GET_QUOTE)}finally{e1.isFetchingQuote=!1}},async fetchQuoteStatus({requestId:e}){try{if(e===eJ){let e=e1.selectedExchange,t=e1.exchangeSessionId;if(e&&t){switch((await this.getBuyStatus(e.id,t)).status){case"IN_PROGRESS":case"UNKNOWN":default:e1.quoteStatus="waiting";break;case"SUCCESS":e1.quoteStatus="success",e1.isPaymentInProgress=!1;break;case"FAILED":e1.quoteStatus="failure",e1.isPaymentInProgress=!1}return}e1.quoteStatus="success";return}let{status:t}=await ej({requestId:e});e1.quoteStatus=t}catch{throw e1.quoteStatus="failure",new eA(ex.UNABLE_TO_GET_QUOTE_STATUS)}},initiatePayment(){e1.isPaymentInProgress=!0,e1.paymentId=crypto.randomUUID()},initializeAnalytics(){e1.analyticsSet||(e1.analyticsSet=!0,this.subscribeKey("isPaymentInProgress",e=>{if(e1.currentPayment?.status&&"UNKNOWN"!==e1.currentPayment.status){let e={IN_PROGRESS:"PAY_INITIATED",SUCCESS:"PAY_SUCCESS",FAILED:"PAY_ERROR"}[e1.currentPayment.status];N.E.sendEvent({type:"track",event:e,properties:{message:"FAILED"===e1.currentPayment.status?S.w.parseError(e1.error):void 0,source:"pay",paymentId:e1.paymentId||eQ,configuration:{network:e1.paymentAsset.network,asset:e1.paymentAsset.asset,recipient:e1.recipient,amount:e1.amount},currentPayment:{type:e1.currentPayment.type,exchangeId:e1.currentPayment.exchangeId,sessionId:e1.currentPayment.sessionId,result:e1.currentPayment.result}}})}}))},async prepareTokenLogo(){if(!e1.paymentAsset.metadata.logoURI)try{let{chainNamespace:e}=ev.C.parseCaipNetworkId(e1.paymentAsset.network),t=await K.$.getImageByToken(e1.paymentAsset.asset,e);e1.paymentAsset.metadata.logoURI=t}catch{}}},e2=(0,_.AH)` 537 wui-separator { 538 margin: var(--apkt-spacing-3) calc(var(--apkt-spacing-3) * -1) var(--apkt-spacing-2) 539 calc(var(--apkt-spacing-3) * -1); 540 width: calc(100% + var(--apkt-spacing-3) * 2); 541 } 542 543 .token-display { 544 padding: var(--apkt-spacing-3) var(--apkt-spacing-3); 545 border-radius: var(--apkt-borderRadius-5); 546 background-color: var(--apkt-tokens-theme-backgroundPrimary); 547 margin-top: var(--apkt-spacing-3); 548 margin-bottom: var(--apkt-spacing-3); 549 } 550 551 .token-display wui-text { 552 text-transform: none; 553 } 554 555 wui-loading-spinner { 556 padding: var(--apkt-spacing-2); 557 } 558 559 .left-image-container { 560 position: relative; 561 justify-content: center; 562 align-items: center; 563 } 564 565 .token-image { 566 border-radius: ${({borderRadius:e})=>e.round}; 567 width: 40px; 568 height: 40px; 569 } 570 571 .chain-image { 572 position: absolute; 573 width: 20px; 574 height: 20px; 575 bottom: -3px; 576 right: -5px; 577 border-radius: ${({borderRadius:e})=>e.round}; 578 border: 2px solid ${({tokens:e})=>e.theme.backgroundPrimary}; 579 } 580 581 .payment-methods-container { 582 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 583 border-top-right-radius: ${({borderRadius:e})=>e[8]}; 584 border-top-left-radius: ${({borderRadius:e})=>e[8]}; 585 } 586`;var e5=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let e4=class extends a.WF{constructor(){super(),this.unsubscribe=[],this.amount=e3.state.amount,this.namespace=void 0,this.paymentAsset=e3.state.paymentAsset,this.activeConnectorIds=l.a.state.activeConnectorIds,this.caipAddress=void 0,this.exchanges=e3.state.exchanges,this.isLoading=e3.state.isLoading,this.initializeNamespace(),this.unsubscribe.push(e3.subscribeKey("amount",e=>this.amount=e)),this.unsubscribe.push(l.a.subscribeKey("activeConnectorIds",e=>this.activeConnectorIds=e)),this.unsubscribe.push(e3.subscribeKey("exchanges",e=>this.exchanges=e)),this.unsubscribe.push(e3.subscribeKey("isLoading",e=>this.isLoading=e)),e3.fetchExchanges(),e3.setSelectedExchange(void 0)}
586disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return(0,a.qy)` 587 <wui-flex flexDirection="column"> 588 ${this.paymentDetailsTemplate()} ${this.paymentMethodsTemplate()} 589 </wui-flex> 590 `}paymentMethodsTemplate(){return(0,a.qy)` 591 <wui-flex flexDirection="column" padding="3" gap="2" class="payment-methods-container"> 592 ${this.payWithWalletTemplate()} ${this.templateSeparator()} 593 ${this.templateExchangeOptions()} 594 </wui-flex> 595 `}initializeNamespace(){let e=c.W.state.activeChain;this.namespace=e,this.caipAddress=c.W.getAccountData(e)?.caipAddress,this.unsubscribe.push(c.W.subscribeChainProp("accountState",e=>{this.caipAddress=e?.caipAddress},e))}paymentDetailsTemplate(){let e=c.W.getAllRequestedCaipNetworks().find(e=>e.caipNetworkId===this.paymentAsset.network);return(0,a.qy)` 596 <wui-flex 597 alignItems="center" 598 justifyContent="space-between" 599 .padding=${["6","8","6","8"]} 600 gap="2" 601 > 602 <wui-flex alignItems="center" gap="1"> 603 <wui-text variant="h1-regular" color="primary"> 604 ${eK(this.amount||"0")} 605 </wui-text> 606 607 <wui-flex flexDirection="column"> 608 <wui-text variant="h6-regular" color="secondary"> 609 ${this.paymentAsset.metadata.symbol||"Unknown"} 610 </wui-text> 611 <wui-text variant="md-medium" color="secondary" 612 >on ${e?.name||"Unknown"}</wui-text 613 > 614 </wui-flex> 615 </wui-flex> 616 617 <wui-flex class="left-image-container"> 618 <wui-image 619 src=${(0,o.J)(this.paymentAsset.metadata.logoURI)} 620 class="token-image" 621 ></wui-image> 622 <wui-image 623 src=${(0,o.J)(K.$.getNetworkImage(e))} 624 class="chain-image" 625 ></wui-image> 626 </wui-flex> 627 </wui-flex> 628 `}payWithWalletTemplate(){return!function(e){let{chainNamespace:t}=ev.C.parseCaipNetworkId(e);return eV.includes(t)}(this.paymentAsset.network)?(0,a.qy)``:this.caipAddress?this.connectedWalletTemplate():this.disconnectedWalletTemplate()}connectedWalletTemplate(){let{name:e,image:t}=this.getWalletProperties({namespace:this.namespace});return(0,a.qy)` 629 <wui-flex flexDirection="column" gap="3"> 630 <wui-list-item 631 type="secondary" 632 boxColor="foregroundSecondary" 633 @click=${this.onWalletPayment} 634 .boxed=${!1} 635 ?chevron=${!0} 636 ?fullSize=${!1} 637 ?rounded=${!0} 638 data-testid="wallet-payment-option" 639 imageSrc=${(0,o.J)(t)} 640 imageSize="3xl" 641 > 642 <wui-text variant="lg-regular" color="primary">Pay with ${e}</wui-text> 643 </wui-list-item> 644 645 <wui-list-item 646 type="secondary" 647 icon="power" 648 iconColor="error" 649 @click=${this.onDisconnect} 650 data-testid="disconnect-button" 651 ?chevron=${!1} 652 boxColor="foregroundSecondary" 653 > 654 <wui-text variant="lg-regular" color="secondary">Disconnect</wui-text> 655 </wui-list-item> 656 </wui-flex> 657 `}disconnectedWalletTemplate(){return(0,a.qy)`<wui-list-item 658 type="secondary" 659 boxColor="foregroundSecondary" 660 variant="icon" 661 iconColor="default" 662 iconVariant="overlay" 663 icon="wallet" 664 @click=${this.onWalletPayment} 665 ?chevron=${!0} 666 data-testid="wallet-payment-option" 667 > 668 <wui-text variant="lg-regular" color="primary">Pay with wallet</wui-text> 669 </wui-list-item>`}templateExchangeOptions(){if(this.isLoading)return(0,a.qy)`<wui-flex justifyContent="center" alignItems="center"> 670 <wui-loading-spinner size="md"></wui-loading-spinner> 671 </wui-flex>`;let e=this.exchanges.filter(e=>!function(e){let t=c.W.getAllRequestedCaipNetworks().find(t=>t.caipNetworkId===e.network);return!!t&&!!t.testnet}(this.paymentAsset)?e.id!==eI:e.id===eI);return 0===e.length?(0,a.qy)`<wui-flex justifyContent="center" alignItems="center"> 672 <wui-text variant="md-medium" color="primary">No exchanges available</wui-text> 673 </wui-flex>`:e.map(e=>(0,a.qy)` 674 <wui-list-item 675 type="secondary" 676 boxColor="foregroundSecondary" 677 @click=${()=>this.onExchangePayment(e)}
678 data-testid="exchange-option-${e.id}" 679 ?chevron=${!0} 680 imageSrc=${(0,o.J)(e.imageUrl)} 681 > 682 <wui-text flexGrow="1" variant="lg-regular" color="primary"> 683 Pay with ${e.name} 684 </wui-text> 685 </wui-list-item> 686 `)}templateSeparator(){return(0,a.qy)`<wui-separator text="or" bgColor="secondary"></wui-separator>`}async onWalletPayment(){if(!this.namespace)throw Error("Namespace not found");this.caipAddress?d.I.push("PayQuote"):(await l.a.connect(),await s.W.open({view:"PayQuote"}))}onExchangePayment(e){e3.setSelectedExchange(e),d.I.push("PayQuote")}async onDisconnect(){try{await p.x.disconnect(),await s.W.open({view:"Pay"})}catch{console.error("Failed to disconnect"),g.P.showError("Failed to disconnect")}}getWalletProperties({namespace:e}){if(!e)return{name:void 0,image:void 0};let t=this.activeConnectorIds[e];if(!t)return{name:void 0,image:void 0};let i=l.a.getConnector({id:t,namespace:e});if(!i)return{name:void 0,image:void 0};let a=K.$.getConnectorImage(i);return{name:i.name,image:a}}};e4.styles=e2,e5([(0,r.wk)()],e4.prototype,"amount",void 0),e5([(0,r.wk)()],e4.prototype,"namespace",void 0),e5([(0,r.wk)()],e4.prototype,"paymentAsset",void 0),e5([(0,r.wk)()],e4.prototype,"activeConnectorIds",void 0),e5([(0,r.wk)()],e4.prototype,"caipAddress",void 0),e5([(0,r.wk)()],e4.prototype,"exchanges",void 0),e5([(0,r.wk)()],e4.prototype,"isLoading",void 0),e4=e5([(0,_.EM)("w3m-pay-view")],e4);var e6=i(26798);let e8=(0,M.AH)` 687 :host { 688 display: inline-flex; 689 align-items: center; 690 justify-content: center; 691 } 692 693 .pulse-container { 694 position: relative; 695 width: var(--pulse-size); 696 height: var(--pulse-size); 697 display: flex; 698 align-items: center; 699 justify-content: center; 700 } 701 702 .pulse-rings { 703 position: absolute; 704 inset: 0; 705 pointer-events: none; 706 } 707 708 .pulse-ring { 709 position: absolute; 710 inset: 0; 711 border-radius: 50%; 712 border: 2px solid var(--pulse-color); 713 opacity: 0; 714 animation: pulse var(--pulse-duration, 2s) ease-out infinite; 715 } 716 717 .pulse-content { 718 position: relative; 719 z-index: 1; 720 display: flex; 721 align-items: center; 722 justify-content: center; 723 } 724 725 @keyframes pulse { 726 0% { 727 transform: scale(0.5); 728 opacity: var(--pulse-opacity, 0.3); 729 } 730 50% { 731 opacity: calc(var(--pulse-opacity, 0.3) * 0.5); 732 } 733 100% { 734 transform: scale(1.2); 735 opacity: 0; 736 } 737 } 738`;var e9=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let e7={"accent-primary":M.f.tokens.core.backgroundAccentPrimary},te=class extends a.WF{constructor(){super(...arguments),this.rings=3,this.duration=2,this.opacity=.3,this.size="200px",this.variant="accent-primary"}render(){let e=e7[this.variant];this.style.cssText=` 739 --pulse-size: ${this.size}; 740 --pulse-duration: ${this.duration}s; 741 --pulse-color: ${e}; 742 --pulse-opacity: ${this.opacity}; 743 `;let t=Array.from({length:this.rings},(e,t)=>this.renderRing(t,this.rings));return(0,a.qy)` 744 <div class="pulse-container"> 745 <div class="pulse-rings">${t}</div> 746 <div class="pulse-content"> 747 <slot></slot> 748 </div> 749 </div> 750 `}renderRing(e,t){let i=e/t*this.duration,r=`animation-delay: ${i}s;`;return(0,a.qy)`<div class="pulse-ring" style=${r}></div>`}};te.styles=[U.W5,e8],e9([(0,r.MZ)({type:Number})],te.prototype,"rings",void 0),e9([(0,r.MZ)({type:Number})],te.prototype,"duration",void 0),e9([(0,r.MZ)({type:Number})],te.prototype,"opacity",void 0),e9([(0,r.MZ)()],te.prototype,"size",void 0),e9([(0,r.MZ)()],te.prototype,"variant",void 0),te=e9([(0,D.E)("wui-pulse")],te);let tt=[{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"}],ti=["success","submitted","failure","timeout","refund"],ta=(0,_.AH)` 751 :host { 752 display: block; 753 height: 100%; 754 width: 100%; 755 } 756 757 wui-image { 758 border-radius: ${({borderRadius:e})=>e.round}; 759 } 760 761 .token-badge-container { 762 position: absolute; 763 bottom: 6px; 764 left: 50%; 765 transform: translateX(-50%); 766 border-radius: ${({borderRadius:e})=>e[4]}; 767 z-index: 3; 768 min-width: 105px; 769 } 770 771 .token-badge-container.loading { 772 background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; 773 border: 3px solid ${({tokens:e})=>e.theme.backgroundPrimary}; 774 } 775 776 .token-badge-container.success { 777 background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; 778 border: 3px solid ${({tokens:e})=>e.theme.backgroundPrimary}; 779 } 780 781 .token-image-container { 782 position: relative; 783 } 784 785 .token-image { 786 border-radius: ${({borderRadius:e})=>e.round}; 787 width: 64px; 788 height: 64px; 789 } 790 791 .token-image.success { 792 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 793 } 794 795 .token-image.error { 796 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 797 } 798 799 .token-image.loading { 800 background: ${({colors:e})=>e.accent010}; 801 } 802 803 .token-image wui-icon { 804 width: 32px; 805 height: 32px; 806 } 807 808 .token-badge { 809 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 810 border: 1px solid ${({tokens:e})=>e.theme.foregroundSecondary}; 811 border-radius: ${({borderRadius:e})=>e[4]}; 812 } 813 814 .token-badge wui-text { 815 white-space: nowrap; 816 } 817 818 .payment-lifecycle-container { 819 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 820 border-top-right-radius: ${({borderRadius:e})=>e[6]}; 821 border-top-left-radius: ${({borderRadius:e})=>e[6]}; 822 } 823 824 .payment-step-badge { 825 padding: ${({spacing:e})=>e[1]} ${({spacing:e})=>e[2]}; 826 border-radius: ${({borderRadius:e})=>e[1]}; 827 } 828 829 .payment-step-badge.loading { 830 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 831 } 832 833 .payment-step-badge.error { 834 background-color: ${({tokens:e})=>e.core.backgroundError}; 835 } 836 837 .payment-step-badge.success { 838 background-color: ${({tokens:e})=>e.core.backgroundSuccess}; 839 } 840 841 .step-icon-container { 842 position: relative; 843 height: 40px; 844 width: 40px; 845 border-radius: ${({borderRadius:e})=>e.round}; 846 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 847 } 848 849 .step-icon-box { 850 position: absolute; 851 right: -4px; 852 bottom: -1px; 853 padding: 2px; 854 border-radius: ${({borderRadius:e})=>e.round}; 855 border: 2px solid ${({tokens:e})=>e.theme.backgroundPrimary}; 856 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 857 } 858 859 .step-icon-box.success { 860 background-color: ${({tokens:e})=>e.core.backgroundSuccess}; 861 } 862`;var tr=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let to={received:["pending","success","submitted"],processing:["success","submitted"],sending:["success","submitted"]},tn=class extends a.WF{constructor(){super(),this.unsubscribe=[],this.pollingInterval=null,this.paymentAsset=e3.state.paymentAsset,this.quoteStatus=e3.state.quoteStatus,this.quote=e3.state.quote,this.amount=e3.state.amount,this.namespace=void 0,this.caipAddress=void 0,this.profileName=null,this.activeConnectorIds=l.a.state.activeConnectorIds,this.selectedExchange=e3.state.selectedExchange,this.initializeNamespace(),this.unsubscribe.push(e3.subscribeKey("quoteStatus",e=>this.quoteStatus=e),e3.subscribeKey("quote",e=>this.quote=e),l.a.subscribeKey("activeConnectorIds",e=>this.activeConnectorIds=e),e3.subscribeKey("selectedExchange",e=>this.selectedExchange=e))}connectedCallback(){super.connectedCallback(),this.startPolling()}disconnectedCallback(){super.disconnectedCallback(),this.stopPolling(),this.unsubscribe.forEach(e
862=>e())}render(){return(0,a.qy)` 863 <wui-flex flexDirection="column" .padding=${["3","0","0","0"]} gap="2"> 864 ${this.tokenTemplate()} ${this.paymentTemplate()} ${this.paymentLifecycleTemplate()} 865 </wui-flex> 866 `}tokenTemplate(){let e=eK(this.amount||"0"),t=this.paymentAsset.metadata.symbol??"Unknown",i=c.W.getAllRequestedCaipNetworks().find(e=>e.caipNetworkId===this.paymentAsset.network),r="failure"===this.quoteStatus||"timeout"===this.quoteStatus||"refund"===this.quoteStatus;return"success"===this.quoteStatus||"submitted"===this.quoteStatus?(0,a.qy)`<wui-flex alignItems="center" justifyContent="center"> 867 <wui-flex justifyContent="center" alignItems="center" class="token-image success"> 868 <wui-icon name="checkmark" color="success" size="inherit"></wui-icon> 869 </wui-flex> 870 </wui-flex>`:r?(0,a.qy)`<wui-flex alignItems="center" justifyContent="center"> 871 <wui-flex justifyContent="center" alignItems="center" class="token-image error"> 872 <wui-icon name="close" color="error" size="inherit"></wui-icon> 873 </wui-flex> 874 </wui-flex>`:(0,a.qy)` 875 <wui-flex alignItems="center" justifyContent="center"> 876 <wui-flex class="token-image-container"> 877 <wui-pulse size="125px" rings="3" duration="4" opacity="0.5" variant="accent-primary"> 878 <wui-flex justifyContent="center" alignItems="center" class="token-image loading"> 879 <wui-icon name="paperPlaneTitle" color="accent-primary" size="inherit"></wui-icon> 880 </wui-flex> 881 </wui-pulse> 882 883 <wui-flex 884 justifyContent="center" 885 alignItems="center" 886 class="token-badge-container loading" 887 > 888 <wui-flex 889 alignItems="center" 890 justifyContent="center" 891 gap="01" 892 padding="1" 893 class="token-badge" 894 > 895 <wui-image 896 src=${(0,o.J)(K.$.getNetworkImage(i))} 897 class="chain-image" 898 size="mdl" 899 ></wui-image> 900 901 <wui-text variant="lg-regular" color="primary">${e} ${t}</wui-text> 902 </wui-flex> 903 </wui-flex> 904 </wui-flex> 905 </wui-flex> 906 `}paymentTemplate(){return(0,a.qy)` 907 <wui-flex flexDirection="column" gap="2" .padding=${["0","6","0","6"]}> 908 ${this.renderPayment()} 909 <wui-separator></wui-separator> 910 ${this.renderWallet()} 911 </wui-flex> 912 `}paymentLifecycleTemplate(){let e=this.getStepsWithStatus();return(0,a.qy)` 913 <wui-flex flexDirection="column" padding="4" gap="2" class="payment-lifecycle-container"> 914 <wui-flex alignItems="center" justifyContent="space-between"> 915 <wui-text variant="md-regular" color="secondary">PAYMENT CYCLE</wui-text> 916 917 ${this.renderPaymentCycleBadge()} 918 </wui-flex> 919 920 <wui-flex flexDirection="column" gap="5" .padding=${["2","0","2","0"]}> 921 ${e.map(e=>this.renderStep(e))} 922 </wui-flex> 923 </wui-flex> 924 `}renderPaymentCycleBadge(){let e="failure"===this.quoteStatus||"timeout"===this.quoteStatus||"refund"===this.quoteStatus,t="success"===this.quoteStatus||"submitted"===this.quoteStatus;if(e)return(0,a.qy)` 925 <wui-flex 926 justifyContent="center" 927 alignItems="center" 928 class="payment-step-badge error" 929 gap="1" 930 > 931 <wui-icon name="close" color="error" size="xs"></wui-icon> 932 <wui-text variant="sm-regular" color="error">Failed</wui-text> 933 </wui-flex> 934 `;if(t)return(0,a.qy)` 935 <wui-flex 936 justifyContent="center" 937 alignItems="center" 938 class="payment-step-badge success" 939 gap="1" 940 > 941 <wui-icon name="checkmark" color="success" size="xs"></wui-icon> 942 <wui-text variant="sm-regular" color="success">Completed</wui-text> 943 </wui-flex> 944 `;let i=this.quote?.timeInSeconds??0;return(0,a.qy)` 945 <wui-flex alignItems="center" justifyContent="space-between" gap="3"> 946 <wui-flex 947 justifyContent="center" 948 alignItems="center" 949 class="payment-step-badge loading" 950 gap="1" 951 > 952 <wui-icon name="clock" color="default" size="xs"></wui-icon> 953 <wui-text variant="sm-regular" color="primary">Est. ${i} sec</wui-text> 954 </wui-flex> 955 956 <wui-icon name="chevronBottom" color="default" size="xxs"></wui-icon> 957 </wui-flex> 958 `}renderPayment(){let e=c.W.getAllRequestedCaipNetworks().find(e=>{let t=this.quote?.origin.currency.network;if(!t)return!1;let{chainId:i}=ev.C.parseCaipNetworkId(t);return ek.y.isLowerCaseMatch(e.id.toString(),i.toString())}),t=eK(b.S.formatNumber(this.quote?.origin.amount||"0",{decimals:this.quote?.origin.currency.metadata.decimals??0}).toString()),i=this.quote?.origin.currency.metadata.symbol??"Unknown";return(0,a.qy)` 959 <wui-flex 960 alignItems="flex-start" 961 justifyContent="space-between" 962 .padding=${["3","0","3","0"]} 963 > 964 <wui-text variant="lg-regular" color="secondary">Payment Method</wui-text> 965 966 <wui-flex flexDirection="column" alignItems="flex-end" gap="1"> 967 <wui-flex alignItems="center" gap="01"> 968 <wui-text variant="lg-regular" color="primary">${t}</wui-text> 969 <wui-text variant="lg-regular" color="secondary">${i}</wui-text> 970 </wui-flex> 971 972 <wui-flex alignItems="center" gap="1"> 973 <wui-text variant="md-regular" color="secondary">on</wui-text> 974 <wui-image 975 src=${(0,o.J)(K.$.getNetworkImage(e))} 976 size="xs" 977 ></wui-image> 978 <wui-text variant="md-regular" color="secondary">${e?.name}</wui-text> 979 </wui-flex> 980 </wui-flex> 981 </wui-flex> 982 `}renderWallet(){return(0,a.qy)` 983 <wui-flex 984 alignItems="flex-start" 985 justifyContent="space-between" 986 .padding=${["3","0","3","0"]} 987 > 988 <wui-text variant="lg-regular" color="secondary" 989 >${this.selectedExchange?"Exchange":"Wallet"}</wui-text 990 > 991 992 ${this.renderWalletText()} 993 </wui-flex> 994 `}renderWalletText(){let{image:e}=this.getWalletProperties({namespace:this.namespace}),{address:t}=this.caipAddress?ev.C.parseCaipAddress(this.caipAddress):{},i=this.selectedExchange?.name;return this.selectedExchange?(0,a.qy)` 995 <wui-flex alignItems="center" justifyContent="flex-end" gap="1"> 996 <wui-text variant="lg-regular" color="primary">${i}</wui-text> 997 <wui-image src=${(0,o.J)(this.selectedExchange.imageUrl)} size="mdl"></wui-image> 998 </wui-flex> 999 `:(0,a.qy)` 1000 <wui-flex alignItems="center" justifyContent="flex-end" gap="1"> 1001 <wui-text variant="lg-regular" color="primary"> 1002 ${_.Zv.getTruncateString({string:this.profileName||t||i||"",charsStart:this.profileName?16:4,charsEnd:6*!this.profileName,truncate:this.profileName?"end":"middle"})} 1003 </wui-text> 1004 1005 <wui-image src=${(0,o.J)(e)} size="mdl"></wui-image> 1006 </wui-flex> 1007 `}getStepsWithStatus(){return"failure"===this.quoteStatus||"timeout"===this.quoteStatus||"refund"===this.quoteStatus?tt.map(e=>({...e,status:"failed"})):tt.map(e=>{let t=(to[e.id]??[]).includes(this.quoteStatus)?"completed":"pending";return{...e,status:t}})}renderStep({title:e,icon:t,status:i}){return(0,a.qy)` 1008 <wui-flex alignItems="center" gap="3"> 1009 <wui-flex justifyContent="center" alignItems="center" class="step-icon-container"> 1010 <wui-icon name=${t} color="default" size="mdl"></wui-icon> 1011 1012 <wui-flex alignItems="center" justifyContent="center" class=${(0,e6.H)({"step-icon-box":!0,success:"completed"===i})}> 1013 ${this.renderStatusIndicator(i)} 1014 </wui-flex> 1015 </wui-flex> 1016 1017 <wui-text variant="md-regular" color="primary">${e}</wui-text> 1018 </wui-flex> 1019 `}renderStatusIndicator(e){return"completed"===e?(0,a.qy)`<wui-icon size="sm" color="success" name="checkmark"></wui-icon>`:"failed"===e?(0,a.qy)`<wui-icon size="sm" color="error" name="close"></wui-icon>`:"pending"===e?(0,a.qy)`<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(){let e=e3.state.requestId;if(!e||ti.includes(this.quoteStatus))this.stopPolling();else try{await e3.fetchQuoteStatus({requestId:e}),ti.includes(this.quoteStatus)&&this.stopPolling()}catch{this.stopPolling()}}initializeNamespace(){let e=c.W.state.activeChain;this.namespace=e,this.caipAddress=c.W.getAccountData(e)?.caipAddress,this.profileName=c.W.getAccountData(e)?.profileName??null,this.unsubscribe.push(c.W.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};let t=this.activeConnectorIds[e];if(!t)return{name:void 0,image:void 0};let i=l.a.getConnector({id:t,namespace:e});if(!i)return{name:void 0,image:void 0};let a=K.$.getConnectorImage(i);return{name:i.name,image:a}}};tn.styles=ta,tr([(0,r.wk)()],tn.prototype,"paymentAsset",void 0),tr([(0,r.wk)()],tn.prototype,"quoteStatus",void 0),tr([(0,r.wk)()],tn.prototype,"quote",void 0),tr([(0,r.wk)()],tn.prototype,"amount",void 0),tr([(0,r.wk)()],tn.prototype,"namespace",void 0),tr([(0,r.wk)()],tn.prototype,"caipAddress",void 0),tr([(0,r.wk)()],tn.prototype,"profileName",void 0),tr([(0,r.wk)()],tn.prototype,"activeConnectorIds",void 0),tr([(0,r.wk)()],tn.prototype,"selectedExchange",void 0),tn=tr([(0,_.EM)("w3m-pay-loading-view")],tn
1019);var ts=i(21299);let tc=(0,M.AH)` 1020 button { 1021 display: flex; 1022 align-items: center; 1023 height: 40px; 1024 padding: ${({spacing:e})=>e[2]}; 1025 border-radius: ${({borderRadius:e})=>e[4]}; 1026 column-gap: ${({spacing:e})=>e[1]}; 1027 background-color: transparent; 1028 transition: background-color ${({durations:e})=>e.lg} 1029 ${({easings:e})=>e["ease-out-power-2"]}; 1030 will-change: background-color; 1031 } 1032 1033 wui-image, 1034 .icon-box { 1035 width: ${({spacing:e})=>e[6]}; 1036 height: ${({spacing:e})=>e[6]}; 1037 border-radius: ${({borderRadius:e})=>e[4]}; 1038 } 1039 1040 wui-text { 1041 flex: 1; 1042 } 1043 1044 .icon-box { 1045 position: relative; 1046 } 1047 1048 .icon-box[data-active='true'] { 1049 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 1050 } 1051 1052 .circle { 1053 position: absolute; 1054 left: 16px; 1055 top: 15px; 1056 width: 8px; 1057 height: 8px; 1058 background-color: ${({tokens:e})=>e.core.textSuccess}; 1059 box-shadow: 0 0 0 2px ${({tokens:e})=>e.theme.foregroundPrimary}; 1060 border-radius: 50%; 1061 } 1062 1063 /* -- Hover & Active states ----------------------------------------------------------- */ 1064 @media (hover: hover) { 1065 button:hover:enabled, 1066 button:active:enabled { 1067 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 1068 } 1069 } 1070`;var tl=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let tu=class extends a.WF{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(0,a.qy)` 1071 <button> 1072 ${this.leftImageTemplate()} ${this.textTemplate()} ${this.rightImageTemplate()} 1073 </button> 1074 `}leftImageTemplate(){let e=this.icon?(0,a.qy)`<wui-icon 1075 size=${(0,o.J)(this.iconSize)} 1076 color="default" 1077 name=${this.icon} 1078 class="icon" 1079 ></wui-icon>`:(0,a.qy)`<wui-image src=${this.imageSrc} alt=${this.alt}></wui-image>`;return(0,a.qy)` 1080 <wui-flex 1081 alignItems="center" 1082 justifyContent="center" 1083 class="icon-box" 1084 data-active=${!!this.icon} 1085 > 1086 ${e} 1087 ${this.enableGreenCircle?(0,a.qy)`<wui-flex class="circle"></wui-flex>`:null} 1088 </wui-flex> 1089 `}textTemplate(){return(0,a.qy)` 1090 <wui-text variant="lg-regular" color="primary"> 1091 ${ts.Z.getTruncateString({string:this.profileName||this.address,charsStart:this.profileName?16:this.charsStart,charsEnd:this.profileName?0:this.charsEnd,truncate:this.profileName?"end":"middle"})} 1092 </wui-text> 1093 `}rightImageTemplate(){return(0,a.qy)`<wui-icon name="chevronBottom" size="sm" color="default"></wui-icon>`}};tu.styles=[U.W5,U.fD,tc],tl([(0,r.MZ)()],tu.prototype,"address",void 0),tl([(0,r.MZ)()],tu.prototype,"profileName",void 0),tl([(0,r.MZ)()],tu.prototype,"alt",void 0),tl([(0,r.MZ)()],tu.prototype,"imageSrc",void 0),tl([(0,r.MZ)()],tu.prototype,"icon",void 0),tl([(0,r.MZ)()],tu.prototype,"iconSize",void 0),tl([(0,r.MZ)({type:Boolean})],tu.prototype,"enableGreenCircle",void 0),tl([(0,r.MZ)({type:Boolean})],tu.prototype,"loading",void 0),tl([(0,r.MZ)({type:Number})],tu.prototype,"charsStart",void 0),tl([(0,r.MZ)({type:Number})],tu.prototype,"charsEnd",void 0),tu=tl([(0,D.E)("wui-wallet-switch")],tu),i(71709);let td=(0,a.AH)` 1094 :host { 1095 display: block; 1096 } 1097`,tp=class extends a.WF{render(){return(0,a.qy)` 1098 <wui-flex flexDirection="column" gap="4"> 1099 <wui-flex alignItems="center" justifyContent="space-between"> 1100 <wui-text variant="md-regular" color="secondary">Pay</wui-text> 1101 <wui-shimmer width="60px" height="16px" borderRadius="4xs" variant="light"></wui-shimmer> 1102 </wui-flex> 1103 1104 <wui-flex alignItems="center" justifyContent="space-between"> 1105 <wui-text variant="md-regular" color="secondary">Network Fee</wui-text> 1106 1107 <wui-flex flexDirection="column" alignItems="flex-end" gap="2"> 1108 <wui-shimmer 1109 width="75px" 1110 height="16px" 1111 borderRadius="4xs" 1112 variant="light" 1113 ></wui-shimmer> 1114 1115 <wui-flex alignItems="center" gap="01"> 1116 <wui-shimmer width="14px" height="14px" rounded variant="light"></wui-shimmer> 1117 <wui-shimmer 1118 width="49px" 1119 height="14px" 1120 borderRadius="4xs" 1121 variant="light" 1122 ></wui-shimmer> 1123 </wui-flex> 1124 </wui-flex> 1125 </wui-flex> 1126 1127 <wui-flex alignItems="center" justifyContent="space-between"> 1128 <wui-text variant="md-regular" color="secondary">Service Fee</wui-text> 1129 <wui-shimmer width="75px" height="16px" borderRadius="4xs" variant="light"></wui-shimmer> 1130 </wui-flex> 1131 </wui-flex> 1132 `}};tp.styles=[td],tp=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n}([(0,_.EM)("w3m-pay-fees-skeleton")],tp);let th=(0,_.AH)` 1133 :host { 1134 display: block; 1135 } 1136 1137 wui-image { 1138 border-radius: ${({borderRadius:e})=>e.round}; 1139 } 1140`;var tm=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let tw=class extends a.WF{constructor(){super(),this.unsubscribe=[],this.quote=e3.state.quote,this.unsubscribe.push(e3.subscribeKey("quote",e=>this.quote=e))}
1140disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let e=b.S.formatNumber(this.quote?.origin.amount||"0",{decimals:this.quote?.origin.currency.metadata.decimals??0,round:6}).toString();return(0,a.qy)` 1141 <wui-flex flexDirection="column" gap="4"> 1142 <wui-flex alignItems="center" justifyContent="space-between"> 1143 <wui-text variant="md-regular" color="secondary">Pay</wui-text> 1144 <wui-text variant="md-regular" color="primary"> 1145 ${e} ${this.quote?.origin.currency.metadata.symbol||"Unknown"} 1146 </wui-text> 1147 </wui-flex> 1148 1149 ${this.quote&&this.quote.fees.length>0?this.quote.fees.map(e=>this.renderFee(e)):null} 1150 </wui-flex> 1151 `}renderFee(e){let t="network"===e.id,i=b.S.formatNumber(e.amount||"0",{decimals:e.currency.metadata.decimals??0,round:6}).toString();if(t){let t=c.W.getAllRequestedCaipNetworks().find(t=>ek.y.isLowerCaseMatch(t.caipNetworkId,e.currency.network));return(0,a.qy)` 1152 <wui-flex alignItems="center" justifyContent="space-between"> 1153 <wui-text variant="md-regular" color="secondary">${e.label}</wui-text> 1154 1155 <wui-flex flexDirection="column" alignItems="flex-end" gap="2"> 1156 <wui-text variant="md-regular" color="primary"> 1157 ${i} ${e.currency.metadata.symbol||"Unknown"} 1158 </wui-text> 1159 1160 <wui-flex alignItems="center" gap="01"> 1161 <wui-image 1162 src=${(0,o.J)(K.$.getNetworkImage(t))} 1163 size="xs" 1164 ></wui-image> 1165 <wui-text variant="sm-regular" color="secondary"> 1166 ${t?.name||"Unknown"} 1167 </wui-text> 1168 </wui-flex> 1169 </wui-flex> 1170 </wui-flex> 1171 `}return(0,a.qy)` 1172 <wui-flex alignItems="center" justifyContent="space-between"> 1173 <wui-text variant="md-regular" color="secondary">${e.label}</wui-text> 1174 <wui-text variant="md-regular" color="primary"> 1175 ${i} ${e.currency.metadata.symbol||"Unknown"} 1176 </wui-text> 1177 </wui-flex> 1178 `}};tw.styles=[th],tm([(0,r.wk)()],tw.prototype,"quote",void 0),tw=tm([(0,_.EM)("w3m-pay-fees")],tw);let tg=(0,_.AH)` 1179 :host { 1180 display: block; 1181 width: 100%; 1182 } 1183 1184 .disabled-container { 1185 padding: ${({spacing:e})=>e[2]}; 1186 min-height: 168px; 1187 } 1188 1189 wui-icon { 1190 width: ${({spacing:e})=>e[8]}; 1191 height: ${({spacing:e})=>e[8]}; 1192 } 1193 1194 wui-flex > wui-text { 1195 max-width: 273px; 1196 } 1197`;var ty=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let tf=class extends a.WF{constructor(){super(),this.unsubscribe=[],this.selectedExchange=e3.state.selectedExchange,this.unsubscribe.push(e3.subscribeKey("selectedExchange",e=>this.selectedExchange=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let e=!!this.selectedExchange;return(0,a.qy)` 1198 <wui-flex 1199 flexDirection="column" 1200 alignItems="center" 1201 justifyContent="center" 1202 gap="3" 1203 class="disabled-container" 1204 > 1205 <wui-icon name="coins" color="default" size="inherit"></wui-icon> 1206 1207 <wui-text variant="md-regular" color="primary" align="center"> 1208 You don't have enough funds to complete this transaction 1209 </wui-text> 1210 1211 ${e?null:(0,a.qy)`<wui-button 1212 size="md" 1213 variant="neutral-secondary" 1214 @click=${this.dispatchConnectOtherWalletEvent.bind(this)} 1215 >Connect other wallet</wui-button 1216 >`} 1217 </wui-flex> 1218 `}dispatchConnectOtherWalletEvent(){this.dispatchEvent(new CustomEvent("connectOtherWallet",{detail:!0,bubbles:!0,composed:!0}))}};tf.styles=[tg],ty([(0,r.MZ)({type:Array})],tf.prototype,"selectedExchange",void 0),tf=ty([(0,_.EM)("w3m-pay-options-empty")],tf);let tb=(0,_.AH)` 1219 :host { 1220 display: block; 1221 width: 100%; 1222 } 1223 1224 .pay-options-container { 1225 max-height: 196px; 1226 overflow-y: auto; 1227 overflow-x: hidden; 1228 scrollbar-width: none; 1229 } 1230 1231 .pay-options-container::-webkit-scrollbar {
1232 display: none; 1233 } 1234 1235 .pay-option-container { 1236 border-radius: ${({borderRadius:e})=>e[4]}; 1237 padding: ${({spacing:e})=>e[3]}; 1238 min-height: 60px; 1239 } 1240 1241 .token-images-container { 1242 position: relative; 1243 justify-content: center; 1244 align-items: center; 1245 } 1246 1247 .chain-image { 1248 position: absolute; 1249 bottom: -3px; 1250 right: -5px; 1251 border: 2px solid ${({tokens:e})=>e.theme.foregroundSecondary}; 1252 } 1253`,tv=class extends a.WF{render(){return(0,a.qy)` 1254 <wui-flex flexDirection="column" gap="2" class="pay-options-container"> 1255 ${this.renderOptionEntry()} ${this.renderOptionEntry()} ${this.renderOptionEntry()} 1256 </wui-flex> 1257 `}renderOptionEntry(){return(0,a.qy)` 1258 <wui-flex 1259 alignItems="center" 1260 justifyContent="space-between" 1261 gap="2" 1262 class="pay-option-container" 1263 > 1264 <wui-flex alignItems="center" gap="2"> 1265 <wui-flex class="token-images-container"> 1266 <wui-shimmer 1267 width="32px" 1268 height="32px" 1269 rounded 1270 variant="light" 1271 class="token-image" 1272 ></wui-shimmer> 1273 <wui-shimmer 1274 width="16px" 1275 height="16px" 1276 rounded 1277 variant="light" 1278 class="chain-image" 1279 ></wui-shimmer> 1280 </wui-flex> 1281 1282 <wui-flex flexDirection="column" gap="1"> 1283 <wui-shimmer 1284 width="74px" 1285 height="16px" 1286 borderRadius="4xs" 1287 variant="light" 1288 ></wui-shimmer> 1289 <wui-shimmer 1290 width="46px" 1291 height="14px" 1292 borderRadius="4xs" 1293 variant="light" 1294 ></wui-shimmer> 1295 </wui-flex> 1296 </wui-flex> 1297 </wui-flex> 1298 `}};tv.styles=[tb],tv=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n}([(0,_.EM)("w3m-pay-options-skeleton")],tv);let tk=(0,_.AH)` 1299 :host { 1300 display: block; 1301 width: 100%; 1302 } 1303 1304 .pay-options-container { 1305 max-height: 196px; 1306 overflow-y: auto; 1307 overflow-x: hidden; 1308 scrollbar-width: none; 1309 mask-image: var(--options-mask-image); 1310 -webkit-mask-image: var(--options-mask-image); 1311 } 1312 1313 .pay-options-container::-webkit-scrollbar {
1314 display: none; 1315 } 1316 1317 .pay-option-container { 1318 cursor: pointer; 1319 border-radius: ${({borderRadius:e})=>e[4]}; 1320 padding: ${({spacing:e})=>e[3]}; 1321 transition: background-color ${({durations:e})=>e.lg} 1322 ${({easings:e})=>e["ease-out-power-1"]}; 1323 will-change: background-color; 1324 } 1325 1326 .token-images-container { 1327 position: relative; 1328 justify-content: center; 1329 align-items: center; 1330 } 1331 1332 .token-image { 1333 border-radius: ${({borderRadius:e})=>e.round}; 1334 width: 32px; 1335 height: 32px; 1336 } 1337 1338 .chain-image { 1339 position: absolute; 1340 width: 16px; 1341 height: 16px; 1342 bottom: -3px; 1343 right: -5px; 1344 border-radius: ${({borderRadius:e})=>e.round}; 1345 border: 2px solid ${({tokens:e})=>e.theme.backgroundPrimary}; 1346 } 1347 1348 @media (hover: hover) and (pointer: fine) { 1349 .pay-option-container:hover { 1350 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 1351 } 1352 } 1353`;var tx=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let tT=class extends a.WF{constructor(){super(),this.unsubscribe=[],this.options=[],this.selectedPaymentAsset=null}disconnectedCallback(){this.unsubscribe.forEach(e=>e()),this.resizeObserver?.disconnect();let e=this.shadowRoot?.querySelector(".pay-options-container");e?.removeEventListener("scroll",this.handleOptionsListScroll.bind(this))}firstUpdated(){let 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(0,a.qy)` 1354 <wui-flex flexDirection="column" gap="2" class="pay-options-container"> 1355 ${this.options.map(e=>this.payOptionTemplate(e))} 1356 </wui-flex> 1357 `}payOptionTemplate(e){let{network:t,metadata:i,asset:r,amount:n="0"}=e,s=c.W.getAllRequestedCaipNetworks().find(e=>e.caipNetworkId===t),l=`${t}:${r}`,u=`${this.selectedPaymentAsset?.network}:${this.selectedPaymentAsset?.asset}`,d=b.S.bigNumber(n,{safe:!0}),p=d.gt(0);return(0,a.qy)` 1358 <wui-flex 1359 alignItems="center" 1360 justifyContent="space-between" 1361 gap="2" 1362 @click=${()=>this.onSelect?.(e)} 1363 class="pay-option-container" 1364 > 1365 <wui-flex alignItems="center" gap="2"> 1366 <wui-flex class="token-images-container"> 1367 <wui-image 1368 src=${(0,o.J)(i.logoURI)} 1369 class="token-image" 1370 size="3xl" 1371 ></wui-image> 1372 <wui-image 1373 src=${(0,o.J)(K.$.getNetworkImage(s))} 1374 class="chain-image" 1375 size="md" 1376 ></wui-image> 1377 </wui-flex> 1378 1379 <wui-flex flexDirection="column" gap="1"> 1380 <wui-text variant="lg-regular" color="primary">${i.symbol}</wui-text> 1381 ${p?(0,a.qy)`<wui-text variant="sm-regular" color="secondary"> 1382 ${d.round(6).toString()} ${i.symbol} 1383 </wui-text>`:null} 1384 </wui-flex> 1385 </wui-flex> 1386 1387 ${l===u?(0,a.qy)`<wui-icon name="checkmark" size="md" color="success"></wui-icon>`:null} 1388 </wui-flex> 1389 `}handleOptionsListScroll(){let e=this.shadowRoot?.querySelector(".pay-options-container");e&&(e.scrollHeight>300?(e.style.setProperty("--options-mask-image",`linear-gradient( 1390 to bottom, 1391 rgba(0, 0, 0, calc(1 - var(--options-scroll--top-opacity))) 0px, 1392 rgba(200, 200, 200, calc(1 - var(--options-scroll--top-opacity))) 1px, 1393 black 50px, 1394 black calc(100% - 50px), 1395 rgba(155, 155, 155, calc(1 - var(--options-scroll--bottom-opacity))) calc(100% - 1px), 1396 rgba(0, 0, 0, calc(1 - var(--options-scroll--bottom-opacity))) 100% 1397 )`),e.style.setProperty("--options-scroll--top-opacity",_.z8.interpolate([0,50],[0,1],e.scrollTop).toString()),e.style.setProperty("--options-scroll--bottom-opacity",_.z8.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")))}};tT.styles=[tk],tx([(0,r.MZ)({type:Array})],tT.prototype,"options",void 0),tx([(0,r.MZ)()],tT.prototype,"selectedPaymentAsset",void 0),tx([(0,r.MZ)()],tT.prototype,"onSelect",void 0),tT=tx([(0,_.EM)("w3m-pay-options")],tT);let tA=(0,_.AH)` 1398 .payment-methods-container { 1399 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 1400 border-top-right-radius: ${({borderRadius:e})=>e[5]}; 1401 border-top-left-radius: ${({borderRadius:e})=>e[5]}; 1402 } 1403 1404 .pay-options-container { 1405 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 1406 border-radius: ${({borderRadius:e})=>e[5]}; 1407 padding: ${({spacing:e})=>e[1]}; 1408 } 1409 1410 w3m-tooltip-trigger { 1411 display: flex; 1412 align-items: center; 1413 justify-content: center; 1414 max-width: fit-content; 1415 } 1416 1417 wui-image { 1418 border-radius: ${({borderRadius:e})=>e.round}; 1419 } 1420 1421 w3m-pay-options.disabled { 1422 opacity: 0.5; 1423 pointer-events: none; 1424 } 1425`;var tS=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let tI={eip155:"ethereum",solana:"solana",bip122:"bitcoin",ton:"ton"},tE={eip155:{icon:tI.eip155,label:"EVM"},solana:{icon:tI.solana,label:"Solana"},bip122:{icon:tI.bip122,label:"Bitcoin"},ton:{icon:tI.ton,label:"Ton"}},tP=class extends a.WF{constructor(){super(),this.unsubscribe=[],this.profileName=null,this.paymentAsset=e3.state.paymentAsset,this.namespace=void 0,this.caipAddress=void 0,this.amount=e3.state.amount,this.recipient=e3.state.recipient,this.activeConnectorIds=l.a.state.activeConnectorIds,this.selectedPaymentAsset=e3.state.selectedPaymentAsset,this.selectedExchange=e3.state.selectedExchange,this.isFetchingQuote=e3.state.isFetchingQuote,this.quoteError=e3.state.quoteError,this.quote=e3.state.quote,this.isFetchingTokenBalances=e3.state.isFetchingTokenBalances,this.tokenBalances=e3.state.tokenBalances,this.isPaymentInProgress=e3.state.isPaymentInProgress,this.exchangeUrlForQuote=e3.state.exchangeUrlForQuote,this.completedTransactionsCount=0,this.unsubscribe.push(e3.subscribeKey("paymentAsset",e=>this.paymentAsset=e)),this.unsubscribe.push(e3.subscribeKey("tokenBalances",e=>this.onTokenBalancesChanged(e))),this.unsubscribe.push(e3.subscribeKey("isFetchingTokenBalances",e=>this.isFetchingTokenBalances=e)),this.unsubscribe.push(l.a.subscribeKey("activeConnectorIds",e=>this.activeConnectorIds=e)),this.unsubscribe.push(e3.subscribeKey("selectedPaymentAsset",e=>this.selectedPaymentAsset=e)),this.unsubscribe.push(e3.subscribeKey("isFetchingQuote",e=>this.isFetchingQuote=e)),this.unsubscribe.push(e3.subscribeKey("quoteError",e=>this.quoteError=e)),this.unsubscribe.push(e3.subscribeKey("quote",e=>this.quote=e)),this.unsubscribe.push(e3.subscribeKey("amount",e=>this.amount=e)),this.unsubscribe.push(e3.subscribeKey("recipient",e=>this.recipient=e)),this.unsubscribe.push(e3.subscribeKey("isPaymentInProgress",e=>this.isPaymentInProgress=e)),this.unsubscribe.push(e3.subscribeKey("selectedExchange",e=>this.selectedExchange=e)),this.unsubscribe.push(e3.subscribeKey("exchangeUrlForQuote",e=>this.exchangeUrlForQuote=e)),this.resetQuoteState(),this.initializeNamespace(),this.fetchTokens()}disconnectedCallback(){super.disconnectedCallback(),this.resetAssetsState(),this.unsubscribe.forEach(e
1425=>e())}updated(e){super.updated(e),e.has("selectedPaymentAsset")&&this.fetchQuote()}render(){return(0,a.qy)` 1426 <wui-flex flexDirection="column"> 1427 ${this.profileTemplate()} 1428 1429 <wui-flex 1430 flexDirection="column" 1431 gap="4" 1432 class="payment-methods-container" 1433 .padding=${["4","4","5","4"]} 1434 > 1435 ${this.paymentOptionsViewTemplate()} ${this.amountWithFeeTemplate()} 1436 1437 <wui-flex 1438 alignItems="center" 1439 justifyContent="space-between" 1440 .padding=${["1","0","1","0"]} 1441 > 1442 <wui-separator></wui-separator> 1443 </wui-flex> 1444 1445 ${this.paymentActionsTemplate()} 1446 </wui-flex> 1447 </wui-flex> 1448 `}profileTemplate(){if(this.selectedExchange){let e=b.S.formatNumber(this.quote?.origin.amount,{decimals:this.quote?.origin.currency.metadata.decimals??0}).toString();return(0,a.qy)` 1449 <wui-flex 1450 .padding=${["4","3","4","3"]} 1451 alignItems="center" 1452 justifyContent="space-between" 1453 gap="2" 1454 > 1455 <wui-text variant="lg-regular" color="secondary">Paying with</wui-text> 1456 1457 ${this.quote?(0,a.qy)`<wui-text variant="lg-regular" color="primary"> 1458 ${b.S.bigNumber(e,{safe:!0}).round(6).toString()} 1459 ${this.quote.origin.currency.metadata.symbol} 1460 </wui-text>`:(0,a.qy)`<wui-shimmer width="80px" height="18px" variant="light"></wui-shimmer>`} 1461 </wui-flex> 1462 `}let e=S.w.getPlainAddress(this.caipAddress)??"",{name:t,image:i}=this.getWalletProperties({namespace:this.namespace}),{icon:r,label:n}=tE[this.namespace]??{};return(0,a.qy)` 1463 <wui-flex 1464 .padding=${["4","3","4","3"]} 1465 alignItems="center" 1466 justifyContent="space-between" 1467 gap="2" 1468 > 1469 <wui-wallet-switch 1470 profileName=${(0,o.J)(this.profileName)} 1471 address=${(0,o.J)(e)} 1472 imageSrc=${(0,o.J)(i)} 1473 alt=${(0,o.J)(t)} 1474 @click=${this.onConnectOtherWallet.bind(this)} 1475 data-testid="wui-wallet-switch" 1476 ></wui-wallet-switch> 1477 1478 <wui-wallet-switch 1479 profileName=${(0,o.J)(n)} 1480 address=${(0,o.J)(e)} 1481 icon=${(0,o.J)(r)} 1482 iconSize="xs" 1483 .enableGreenCircle=${!1} 1484 alt=${(0,o.J)(n)} 1485 @click=${this.onConnectOtherWallet.bind(this)} 1486 data-testid="wui-wallet-switch" 1487 ></wui-wallet-switch> 1488 </wui-flex> 1489 `}initializeNamespace(){let e=c.W.state.activeChain;this.namespace=e,this.caipAddress=c.W.getAccountData(e)?.caipAddress,this.profileName=c.W.getAccountData(e)?.profileName??null,this.unsubscribe.push(c.W.subscribeChainProp("accountState",e=>this.onAccountStateChanged(e),e))}async fetchTokens(){if(this.namespace){let e;if(this.caipAddress){let{chainId:t,chainNamespace:i}=ev.C.parseCaipAddress(this.caipAddress),a=`${i}:${t}`;e=c.W.getAllRequestedCaipNetworks().find(e=>e.caipNetworkId===a)}await e3.fetchTokens({caipAddress:this.caipAddress,caipNetwork:e,namespace:this.namespace})}}fetchQuote(){if(this.amount&&this.recipient&&this.selectedPaymentAsset&&this.paymentAsset){let{address:e}=this.caipAddress?ev.C.parseCaipAddress(this.caipAddress):{};e3.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};let t=this.activeConnectorIds[e];if(!t)return{name:void 0,image:void 0};let i=l.a.getConnector({id:t,namespace:e});if(!i)return{name:void 0,image:void 0};let a=K.$.getConnectorImage(i);return{name:i.name,image:a}}paymentOptionsViewTemplate(){return(0,a.qy)` 1490 <wui-flex flexDirection="column" gap="2"> 1491 <wui-text variant="sm-regular" color="secondary">CHOOSE PAYMENT OPTION</wui-text> 1492 <wui-flex class="pay-options-container">${this.paymentOptionsTemplate()}</wui-flex> 1493 </wui-flex> 1494 `}paymentOptionsTemplate(){let e=this.getPaymentAssetFromTokenBalances();if(this.isFetchingTokenBalances)return(0,a.qy)`<w3m-pay-options-skeleton></w3m-pay-options-skeleton>`;if(0===e.length)return(0,a.qy)`<w3m-pay-options-empty 1495 @connectOtherWallet=${this.onConnectOtherWallet.bind(this)} 1496 ></w3m-pay-options-empty>`;let t={disabled:this.isFetchingQuote};return(0,a.qy)`<w3m-pay-options 1497 class=${(0,e6.H)(t)} 1498 .options=${e} 1499 .selectedPaymentAsset=${(0,o.J)(this.selectedPaymentAsset)} 1500 .onSelect=${this.onSelectedPaymentAssetChanged.bind(this)} 1501 ></w3m-pay-options>`}amountWithFeeTemplate(){return this.isFetchingQuote||!this.selectedPaymentAsset||this.quoteError?(0,a.qy)`<w3m-pay-fees-skeleton></w3m-pay-fees-skeleton>`:(0,a.qy)`<w3m-pay-fees></w3m-pay-fees>`}paymentActionsTemplate(){let e=this.isFetchingQuote||this.isFetchingTokenBalances,t=this.isFetchingQuote||this.isFetchingTokenBalances||!this.selectedPaymentAsset||!!this.quoteError,i=b.S.formatNumber(this.quote?.origin.amount??0,{decimals:this.quote?.origin.currency.metadata.decimals??0}).toString();return this.selectedExchange?e||t?(0,a.qy)` 1502 <wui-shimmer width="100%" height="48px" variant="light" ?rounded=${!0}></wui-shimmer> 1503 `:(0,a.qy)`<wui-button 1504 size="lg" 1505 fullWidth 1506 variant="accent-secondary" 1507 @click=${this.onPayWithExchange.bind(this)} 1508 > 1509 ${`Continue in ${this.selectedExchange.name}`} 1510 1511 <wui-icon name="arrowRight" color="inherit" size="sm" slot="iconRight"></wui-icon> 1512 </wui-button>
1512`:(0,a.qy)` 1513 <wui-flex alignItems="center" justifyContent="space-between"> 1514 <wui-flex flexDirection="column" gap="1"> 1515 <wui-text variant="md-regular" color="secondary">Order Total</wui-text> 1516 1517 ${e||t?(0,a.qy)`<wui-shimmer width="58px" height="32px" variant="light"></wui-shimmer>`:(0,a.qy)`<wui-flex alignItems="center" gap="01"> 1518 <wui-text variant="h4-regular" color="primary">${eK(i)}</wui-text> 1519 1520 <wui-text variant="lg-regular" color="secondary"> 1521 ${this.quote?.origin.currency.metadata.symbol||"Unknown"} 1522 </wui-text> 1523 </wui-flex>`} 1524 </wui-flex> 1525 1526 ${this.actionButtonTemplate({isLoading:e,isDisabled:t})} 1527 </wui-flex> 1528 `}actionButtonTemplate(e){let t=eq(this.quote),{isLoading:i,isDisabled:r}=e,o="Pay";return t.length>1&&0===this.completedTransactionsCount&&(o="Approve"),(0,a.qy)` 1529 <wui-button 1530 size="lg" 1531 variant="accent-primary" 1532 ?loading=${i||this.isPaymentInProgress} 1533 ?disabled=${r||this.isPaymentInProgress} 1534 @click=${()=>{t.length>0?this.onSendTransactions():this.onTransfer()}} 1535 > 1536 ${o} 1537 ${i?null:(0,a.qy)`<wui-icon 1538 name="arrowRight" 1539 color="inherit" 1540 size="sm" 1541 slot="iconRight" 1542 ></wui-icon>`} 1543 </wui-button> 1544 `}getPaymentAssetFromTokenBalances(){return this.namespace?(this.tokenBalances[this.namespace]??[]).map(e=>{try{let t=c.W.getAllRequestedCaipNetworks().find(t=>t.caipNetworkId===e.chainId),i=e.address;if(!t)throw Error(`Target network not found for balance chainId "${e.chainId}"`);if(ek.y.isLowerCaseMatch(e.symbol,t.nativeCurrency.symbol))i="native";else if(S.w.isCaipAddress(i)){let{address:e}=ev.C.parseCaipAddress(i);i=e}else if(!i)throw 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}}catch(e){return null}}).filter(e=>!!e).filter(e=>{let{chainId:t}=ev.C.parseCaipNetworkId(e.network),{chainId:i}=ev.C.parseCaipNetworkId(this.paymentAsset.network);return!!ek.y.isLowerCaseMatch(e.asset,this.paymentAsset.asset)||!this.selectedExchange||!ek.y.isLowerCaseMatch(t.toString(),i.toString())}):[]}onTokenBalancesChanged(e){this.tokenBalances=e;let[t]=this.getPaymentAssetFromTokenBalances();t&&e3.setSelectedPaymentAsset(t)}async onConnectOtherWallet(){await l.a.connect(),await s.W.open({view:"PayQuote"})}onAccountStateChanged(e){let{address:t}=this.caipAddress?ev.C.parseCaipAddress(this.caipAddress):{};if(this.caipAddress=e?.caipAddress,this.profileName=e?.profileName??null,t){let{address:e}=this.caipAddress?ev.C.parseCaipAddress(this.caipAddress):{};e?ek.y.isLowerCaseMatch(e,t)||(this.resetAssetsState(),this.resetQuoteState(),this.fetchTokens()):s.W.close()}}onSelectedPaymentAssetChanged(e){this.isFetchingQuote||e3.setSelectedPaymentAsset(e)}async onTransfer(){let e=eO(this.quote);if(e){if(!ek.y.isLowerCaseMatch(this.selectedPaymentAsset?.asset,e.deposit.currency))throw Error("Quote asset is not the same as the selected payment asset");let t=this.selectedPaymentAsset?.amount??"0",i=b.S.formatNumber(e.deposit.amount,{decimals:this.selectedPaymentAsset?.metadata.decimals??0}).toString();if(!b.S.bigNumber(t).gte(i))return void g.P.showError("Insufficient funds");if(this.quote&&this.selectedPaymentAsset&&this.caipAddress&&this.namespace){let{address:t}=ev.C.parseCaipAddress(this.caipAddress);await e3.onTransfer({chainNamespace:this.namespace,fromAddress:t,toAddress:e.deposit.receiver,amount:i,paymentAsset:this.selectedPaymentAsset}),e3.setRequestId(e.requestId),d.I.push("PayLoading")}}}async onSendTransactions(){let e=this.selectedPaymentAsset?.amount??"0",t=b.S.formatNumber(this.quote?.origin.amount??0,{decimals:this.selectedPaymentAsset?.metadata.decimals??0}).toString();if(!b.S.bigNumber(e).gte(t))return void g.P.showError("Insufficient funds");let i=eq(this.quote),[a]=eq(this.quote,this.completedTransactionsCount);a&&this.namespace&&(await e3.onSendTransaction({namespace:this.namespace,transactionStep:a}),this.completedTransactionsCount+=1,this.completedTransactionsCount===i.length&&(e3.setRequestId(a.requestId),d.I.push("PayLoading")))}onPayWithExchange(){if(this.exchangeUrlForQuote){let e=S.w.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!e)throw Error("Could not create popup window");e.location.href=this.exchangeUrlForQuote;let t=eO(this.quote);t&&e3.setRequestId(t.requestId),e3.initiatePayment(),d.I.push("PayLoading")}}resetAssetsState(){e3.setSelectedPaymentAsset(null)}resetQuoteState(){e3.resetQuoteState()}};tP.styles=tA,tS([(0,r.wk)()],tP.prototype,"profileName",void 0),tS([(0,r.wk)()],tP.prototype,"paymentAsset",void 0),tS([(0,r.wk)()],tP.prototype,"namespace",void 0),tS([(0,r.wk)()],tP.prototype,"caipAddress",void 0),tS([(0,r.wk)()],tP.prototype,"amount",void 0),tS([(0,r.wk)()],tP.prototype,"recipient",void 0),tS([(0,r.wk)()],tP.prototype,"activeConnectorIds",void 0),tS([(0,r.wk)()],tP.prototype,"selectedPaymentAsset",void 0),tS([(0,r.wk)()],tP.prototype,"selectedExchange",void 0),tS([(0,r.wk)()],tP.prototype,"isFetchingQuote",void 0),tS([(0,r.wk)()],tP.prototype,"quoteError",void 0),tS([(0,r.wk)()],tP.prototype,"quote",void 0),tS([(0,r.wk)()],tP.prototype,"isFetchingTokenBalances",void 0),tS([(0,r.wk)()],tP.prototype,"tokenBalances",void 0),tS([(0,r.wk)()],tP.prototype,"isPaymentInProgress",void 0),tS([(0,r.wk)()],tP.prototype,"exchangeUrlForQuote",void 0),tS([(0,r.wk)()],tP.prototype,"completedTransactionsCount",void 0),tP=tS([(0,_.EM)("w3m-pay-quote-view")],tP);let tC=(0,_.AH)` 1545 wui-image { 1546 border-radius: ${({borderRadius:e})=>e.round}; 1547 } 1548 1549 .transfers-badge { 1550 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 1551 border: 1px solid ${({tokens:e})=>e.theme.foregroundSecondary}; 1552 border-radius: ${({borderRadius:e})=>e[4]}; 1553 } 1554`;var t$=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let tN=class extends a.WF{constructor(){super(),this.unsubscribe=[],this.paymentAsset=e3.state.paymentAsset,this.amount=e3.state.amount,this.unsubscribe.push(e3.subscribeKey("paymentAsset",e=>{this.paymentAsset=e}),e3.subscribeKey("amount",e=>{this.amount=e}))}
1554disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let e=c.W.getAllRequestedCaipNetworks().find(e=>e.caipNetworkId===this.paymentAsset.network);return(0,a.qy)`<wui-flex 1555 alignItems="center" 1556 gap="1" 1557 .padding=${["1","2","1","1"]} 1558 class="transfers-badge" 1559 > 1560 <wui-image src=${(0,o.J)(this.paymentAsset.metadata.logoURI)} size="xl"></wui-image> 1561 <wui-text variant="lg-regular" color="primary"> 1562 ${this.amount} ${this.paymentAsset.metadata.symbol} 1563 </wui-text> 1564 <wui-text variant="sm-regular" color="secondary"> 1565 on ${e?.name??"Unknown"} 1566 </wui-text> 1567 </wui-flex>`}};tN.styles=[tC],t$([(0,r.MZ)()],tN.prototype,"paymentAsset",void 0),t$([(0,r.MZ)()],tN.prototype,"amount",void 0),tN=t$([(0,_.EM)("w3m-pay-header")],tN);let tR=(0,_.AH)` 1568 :host { 1569 height: 60px; 1570 } 1571 1572 :host > wui-flex { 1573 box-sizing: border-box; 1574 background-color: var(--local-header-background-color); 1575 } 1576 1577 wui-text { 1578 background-color: var(--local-header-background-color); 1579 } 1580 1581 wui-flex.w3m-header-title { 1582 transform: translateY(0); 1583 opacity: 1; 1584 } 1585 1586 wui-flex.w3m-header-title[view-direction='prev'] { 1587 animation: 1588 slide-down-out 120ms forwards ${({easings:e})=>e["ease-out-power-2"]}, 1589 slide-down-in 120ms forwards ${({easings:e})=>e["ease-out-power-2"]}; 1590 animation-delay: 0ms, 200ms; 1591 } 1592 1593 wui-flex.w3m-header-title[view-direction='next'] { 1594 animation: 1595 slide-up-out 120ms forwards ${({easings:e})=>e["ease-out-power-2"]}, 1596 slide-up-in 120ms forwards ${({easings:e})=>e["ease-out-power-2"]}; 1597 animation-delay: 0ms, 200ms; 1598 } 1599 1600 wui-icon-button[data-hidden='true'] { 1601 opacity: 0 !important; 1602 pointer-events: none; 1603 } 1604 1605 @keyframes slide-up-out { 1606 from { 1607 transform: translateY(0px); 1608 opacity: 1; 1609 } 1610 to { 1611 transform: translateY(3px); 1612 opacity: 0; 1613 } 1614 } 1615 1616 @keyframes slide-up-in { 1617 from { 1618 transform: translateY(-3px); 1619 opacity: 0; 1620 } 1621 to { 1622 transform: translateY(0); 1623 opacity: 1; 1624 } 1625 } 1626 1627 @keyframes slide-down-out { 1628 from { 1629 transform: translateY(0px); 1630 opacity: 1; 1631 } 1632 to { 1633 transform: translateY(-3px); 1634 opacity: 0; 1635 } 1636 } 1637 1638 @keyframes slide-down-in { 1639 from { 1640 transform: translateY(3px); 1641 opacity: 0; 1642 } 1643 to { 1644 transform: translateY(0); 1645 opacity: 1; 1646 } 1647 } 1648`;var tO=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let tq=["SmartSessionList"],tW={PayWithExchange:_.f.tokens.theme.foregroundPrimary};function t_(){let e=d.I.state.data?.connector?.name,t=d.I.state.data?.wallet?.name,i=d.I.state.data?.network?.name,a=t??e,r=l.a.getConnectors(),o=1===r.length&&r[0]?.id==="w3m-email",n=c.W.getAccountData()?.socialProvider;return{Connect:`Connect ${o?"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:a??"Connect Wallet",ConnectingWalletConnect:a??"WalletConnect",ConnectingWalletConnectBasic:"WalletConnect",ConnectingSiwe:"Sign In",Convert:"Convert",ConvertSelectToken:"Select token",ConvertPreview:"Preview Convert",Downloads:a?`Get ${a}`:"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:n?n.charAt(0).toUpperCase()+n.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 tU=class extends a.WF{constructor(){super(),this.unsubscribe=[],this.heading=t_()[d.I.state.view],this.network=c.W.state.activeCaipNetwork,this.networkImage=K.$.getNetworkImage(this.network),this.showBack=!1,this.prevHistoryLength=1,this.view=d.I.state.view,this.viewDirection="",this.unsubscribe.push(Q.j.subscribeNetworkImages(()=>{this.networkImage=K.$.getNetworkImage(this.network)}),d.I.subscribeKey("view",e=>{setTimeout(()=>{this.view=e,this.heading=t_()[e]},es.ANIMATION_DURATIONS.HeaderText),this.onViewChange(),this.onHistoryChange()}),c.W.subscribeKey("activeCaipNetwork",e=>{this.network=e,this.networkImage=K.$.getNetworkImage(this.network)}))}
1648disconnectCallback(){this.unsubscribe.forEach(e=>e())}render(){let e=tW[d.I.state.view]??_.f.tokens.theme.backgroundPrimary;return this.style.setProperty("--local-header-background-color",e),(0,a.qy)` 1649 <wui-flex 1650 .padding=${["0","4","0","4"]} 1651 justifyContent="space-between" 1652 alignItems="center" 1653 > 1654 ${this.leftHeaderTemplate()} ${this.titleTemplate()} ${this.rightHeaderTemplate()} 1655 </wui-flex> 1656 `}onWalletHelp(){N.E.sendEvent({type:"track",event:"CLICK_WALLET_HELP"}),d.I.push("WhatIsAWallet")}async onClose(){await m.safeClose()}rightHeaderTemplate(){let e=n.H?.state?.features?.smartSessions;return"Account"===d.I.state.view&&e?(0,a.qy)`<wui-flex> 1657 <wui-icon-button 1658 icon="clock" 1659 size="lg" 1660 iconSize="lg" 1661 type="neutral" 1662 variant="primary" 1663 @click=${()=>d.I.push("SmartSessionList")} 1664 data-testid="w3m-header-smart-sessions" 1665 ></wui-icon-button> 1666 ${this.closeButtonTemplate()} 1667 </wui-flex> `:this.closeButtonTemplate()}closeButtonTemplate(){return(0,a.qy)` 1668 <wui-icon-button 1669 icon="close" 1670 size="lg" 1671 type="neutral" 1672 variant="primary" 1673 iconSize="lg" 1674 @click=${this.onClose.bind(this)} 1675 data-testid="w3m-header-close" 1676 ></wui-icon-button> 1677 `}titleTemplate(){if("PayQuote"===this.view)return(0,a.qy)`<w3m-pay-header></w3m-pay-header>`;let e=tq.includes(this.view);return(0,a.qy)` 1678 <wui-flex 1679 view-direction="${this.viewDirection}" 1680 class="w3m-header-title" 1681 alignItems="center" 1682 gap="2" 1683 > 1684 <wui-text 1685 display="inline" 1686 variant="lg-regular" 1687 color="primary" 1688 data-testid="w3m-header-text" 1689 > 1690 ${this.heading} 1691 </wui-text> 1692 ${e?(0,a.qy)`<wui-tag variant="accent" size="md">Beta</wui-tag>`:null} 1693 </wui-flex> 1694 `}leftHeaderTemplate(){let{view:e}=d.I.state,t="Connect"===e,i=n.H.state.enableEmbedded,r=n.H.state.enableNetworkSwitch;return"Account"===e&&r?(0,a.qy)`<wui-select 1695 id="dynamic" 1696 data-testid="w3m-account-select-network" 1697 active-network=${(0,o.J)(this.network?.name)} 1698 @click=${this.onNetworks.bind(this)} 1699 imageSrc=${(0,o.J)(this.networkImage)} 1700 ></wui-select>`:this.showBack&&!("ApproveTransaction"===e||"ConnectingSiwe"===e||t&&i)?(0,a.qy)`<wui-icon-button 1701 data-testid="header-back" 1702 id="dynamic" 1703 icon="chevronLeft" 1704 size="lg" 1705 iconSize="lg" 1706 type="neutral" 1707 variant="primary" 1708 @click=${this.onGoBack.bind(this)} 1709 ></wui-icon-button>`:(0,a.qy)`<wui-icon-button 1710 data-hidden=${!t} 1711 id="dynamic" 1712 icon="helpCircle" 1713 size="lg" 1714 iconSize="lg" 1715 type="neutral" 1716 variant="primary" 1717 @click=${this.onWalletHelp.bind(this)} 1718 ></wui-icon-button>`}onNetworks(){this.isAllowedNetworkSwitch()&&(N.E.sendEvent({type:"track",event:"CLICK_NETWORKS"}),d.I.push("Networks"))}isAllowedNetworkSwitch(){let e=c.W.getAllRequestedCaipNetworks(),t=!!e&&e.length>1,i=e?.find(({id:e})=>e===this.network?.id);return t||!i}onViewChange(){let{history:e}=d.I.state,t=es.VIEW_DIRECTION.Next;e.length<this.prevHistoryLength&&(t=es.VIEW_DIRECTION.Prev),this.prevHistoryLength=e.length,this.viewDirection=t}async onHistoryChange(){let{history:e}=d.I.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(){d.I.goBack()}};tU.styles=tR,tO([(0,r.wk)()],tU.prototype,"heading",void 0),tO([(0,r.wk)()],tU.prototype,"network",void 0),tO([(0,r.wk)()],tU.prototype,"networkImage",void 0),tO([(0,r.wk)()],tU.prototype,"showBack",void 0),tO([(0,r.wk)()],tU.prototype,"prevHistoryLength",void 0),tO([(0,r.wk)()],tU.prototype,"view",void 0),tO([(0,r.wk)()],tU.prototype,"viewDirection",void 0),tU=tO([(0,_.EM)("w3m-header")],tU),i(98991),i(37980);let tD=(0,M.AH)` 1719 :host { 1720 display: flex; 1721 align-items: center; 1722 gap: ${({spacing:e})=>e[1]}; 1723 padding: ${({spacing:e})=>e[2]} ${({spacing:e})=>e[3]} 1724 ${({spacing:e})=>e[2]} ${({spacing:e})=>e[2]}; 1725 border-radius: ${({borderRadius:e})=>e[20]}; 1726 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 1727 box-shadow: 1728 0px 0px 8px 0px rgba(0, 0, 0, 0.1), 1729 inset 0 0 0 1px ${({tokens:e})=>e.theme.borderPrimary}; 1730 max-width: 320px; 1731 } 1732 1733 wui-icon-box { 1734 border-radius: ${({borderRadius:e})=>e.round} !important; 1735 overflow: hidden; 1736 } 1737 1738 wui-loading-spinner { 1739 padding: ${({spacing:e})=>e[1]}; 1740 background-color: ${({tokens:e})=>e.core.foregroundAccent010}; 1741 border-radius: ${({borderRadius:e})=>e.round} !important; 1742 } 1743`;var tM=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let tL=class extends a.WF{constructor(){super(...arguments),this.message="",this.variant="success"}render(){return(0,a.qy)` 1744 ${this.templateIcon()} 1745 <wui-text variant="lg-regular" color="primary" data-testid="wui-snackbar-message" 1746 >${this.message}</wui-text 1747 > 1748 `}templateIcon(){return"loading"===this.variant?(0,a.qy)`<wui-loading-spinner size="md" color="accent-primary"></wui-loading-spinner>`:(0,a.qy)`<wui-icon-box 1749 size="md" 1750 color=${({success:"success",error:"error",warning:"warning",info:"default"})[this.variant]}
1751 icon=${({success:"checkmark",error:"warning",warning:"warningCircle",info:"info"})[this.variant]} 1752 ></wui-icon-box>`}};tL.styles=[U.W5,tD],tM([(0,r.MZ)()],tL.prototype,"message",void 0),tM([(0,r.MZ)()],tL.prototype,"variant",void 0),tL=tM([(0,D.E)("wui-snackbar")],tL);let tF=(0,a.AH)` 1753 :host { 1754 display: block; 1755 position: absolute; 1756 opacity: 0; 1757 pointer-events: none; 1758 top: 11px; 1759 left: 50%; 1760 width: max-content; 1761 } 1762`;var tz=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let tB=class extends a.WF{constructor(){super(),this.unsubscribe=[],this.timeout=void 0,this.open=g.P.state.open,this.unsubscribe.push(g.P.subscribeKey("open",e=>{this.open=e,this.onOpen()}))}disconnectedCallback(){clearTimeout(this.timeout),this.unsubscribe.forEach(e=>e())}render(){let{message:e,variant:t}=g.P.state;return(0,a.qy)` <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),g.P.state.autoClose&&(this.timeout=setTimeout(()=>g.P.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"})}};tB.styles=tF,tz([(0,r.wk)()],tB.prototype,"open",void 0),tB=tz([(0,_.EM)("w3m-snackbar")],tB);let tj=(0,y.BX)({message:"",open:!1,triggerRect:{width:0,height:0,top:0,left:0},variant:"shade"}),tH=(0,P.X)({state:tj,subscribe:e=>(0,y.B1)(tj,()=>e(tj)),subscribeKey:(e,t)=>(0,f.u$)(tj,e,t),showTooltip({message:e,triggerRect:t,variant:i}){tj.open=!0,tj.message=e,tj.triggerRect=t,tj.variant=i},hide(){tj.open=!1,tj.message="",tj.triggerRect={width:0,height:0,top:0,left:0}}}),tV=(0,a.AH)` 1763 :host { 1764 width: 100%; 1765 display: block; 1766 } 1767`;var tG=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let tZ=class extends a.WF{constructor(){super(),this.unsubscribe=[],this.text="",this.open=tH.state.open,this.unsubscribe.push(d.I.subscribeKey("view",()=>{tH.hide()}),s.W.subscribeKey("open",e=>{e||tH.hide()}),tH.subscribeKey("open",e=>{this.open=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e()),tH.hide()}render(){return(0,a.qy)` 1768 <div 1769 @pointermove=${this.onMouseEnter.bind(this)} 1770 @pointerleave=${this.onMouseLeave.bind(this)} 1771 > 1772 ${this.renderChildren()} 1773 </div> 1774 `}renderChildren(){return(0,a.qy)`<slot></slot> `}onMouseEnter(){let e=this.getBoundingClientRect();if(!this.open){let t=document.querySelector("w3m-modal"),i={width:e.width,height:e.height,left:e.left,top:e.top};if(t){let a=t.getBoundingClientRect();i.left=e.left-(window.innerWidth-a.width)/2,i.top=e.top-(window.innerHeight-a.height)/2}tH.showTooltip({message:this.text,triggerRect:i,variant:"shade"})}}onMouseLeave(e){this.contains(e.relatedTarget)||tH.hide()}};tZ.styles=[tV],tG([(0,r.MZ)()],tZ.prototype,"text",void 0),tG([(0,r.wk)()],tZ.prototype,"open",void 0),tZ=tG([(0,_.EM)("w3m-tooltip-trigger")],tZ);let tY=(0,_.AH)` 1775 :host { 1776 pointer-events: none; 1777 } 1778 1779 :host > wui-flex { 1780 display: var(--w3m-tooltip-display); 1781 opacity: var(--w3m-tooltip-opacity); 1782 padding: 9px ${({spacing:e})=>e["3"]} 10px ${({spacing:e})=>e["3"]}; 1783 border-radius: ${({borderRadius:e})=>e["3"]}; 1784 color: ${({tokens:e})=>e.theme.backgroundPrimary}; 1785 position: absolute; 1786 top: var(--w3m-tooltip-top); 1787 left: var(--w3m-tooltip-left); 1788 transform: translate(calc(-50% + var(--w3m-tooltip-parent-width)), calc(-100% - 8px)); 1789 max-width: calc(var(--apkt-modal-width) - ${({spacing:e})=>e["5"]}); 1790 transition: opacity ${({durations:e})=>e.lg} 1791 ${({easings:e})=>e["ease-out-power-2"]}; 1792 will-change: opacity; 1793 opacity: 0; 1794 animation-duration: ${({durations:e})=>e.xl}; 1795 animation-timing-function: ${({easings:e})=>e["ease-out-power-2"]}; 1796 animation-name: fade-in; 1797 animation-fill-mode: forwards; 1798 } 1799 1800 :host([data-variant='shade']) > wui-flex { 1801 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 1802 } 1803 1804 :host([data-variant='shade']) > wui-flex > wui-text { 1805 color: ${({tokens:e})=>e.theme.textSecondary}; 1806 } 1807 1808 :host([data-variant='fill']) > wui-flex { 1809 background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; 1810 border: 1px solid ${({tokens:e})=>e.theme.borderPrimary}; 1811 } 1812 1813 wui-icon { 1814 position: absolute; 1815 width: 12px !important; 1816 height: 4px !important; 1817 color: ${({tokens:e})=>e.theme.foregroundPrimary}; 1818 } 1819 1820 wui-icon[data-placement='top'] { 1821 bottom: 0px; 1822 left: 50%; 1823 transform: translate(-50%, 95%); 1824 } 1825 1826 wui-icon[data-placement='bottom'] { 1827 top: 0; 1828 left: 50%; 1829 transform: translate(-50%, -95%) rotate(180deg); 1830 } 1831 1832 wui-icon[data-placement='right'] { 1833 top: 50%; 1834 left: 0; 1835 transform: translate(-65%, -50%) rotate(90deg); 1836 } 1837 1838 wui-icon[data-placement='left'] { 1839 top: 50%; 1840 right: 0%; 1841 transform: translate(65%, -50%) rotate(270deg); 1842 } 1843 1844 @keyframes fade-in { 1845 from { 1846 opacity: 0; 1847 } 1848 to { 1849 opacity: 1; 1850 } 1851 } 1852`;
1852var tK=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let tQ=class extends a.WF{constructor(){super(),this.unsubscribe=[],this.open=tH.state.open,this.message=tH.state.message,this.triggerRect=tH.state.triggerRect,this.variant=tH.state.variant,this.unsubscribe.push(tH.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;let e=this.triggerRect.top,t=this.triggerRect.left;return this.style.cssText=` 1853 --w3m-tooltip-top: ${e}px; 1854 --w3m-tooltip-left: ${t}px; 1855 --w3m-tooltip-parent-width: ${this.triggerRect.width/2}px; 1856 --w3m-tooltip-display: ${this.open?"flex":"none"}; 1857 --w3m-tooltip-opacity: ${+!!this.open}; 1858 `,(0,a.qy)`<wui-flex> 1859 <wui-icon data-placement="top" size="inherit" name="cursor"></wui-icon> 1860 <wui-text color="primary" variant="sm-regular">${this.message}</wui-text> 1861 </wui-flex>`}};tQ.styles=[tY],tK([(0,r.wk)()],tQ.prototype,"open",void 0),tK([(0,r.wk)()],tQ.prototype,"message",void 0),tK([(0,r.wk)()],tQ.prototype,"triggerRect",void 0),tK([(0,r.wk)()],tQ.prototype,"variant",void 0),tQ=tK([(0,_.EM)("w3m-tooltip")],tQ);let tJ={getTabsByNamespace:e=>e&&e===v.o.CHAIN.EVM?n.H.state.remoteFeatures?.activity===!1?es.ACCOUNT_TABS.filter(e=>"Activity"!==e.label):es.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(){let e=d.I.state.view;if(es.VIEWS_WITH_LEGAL_FOOTER.includes(e)){let{termsConditionsUrl:e,privacyPolicyUrl:t}=n.H.state,i=n.H.state.features?.legalCheckbox;return(!!e||!!t)&&!i}return es.VIEWS_WITH_DEFAULT_FOOTER.includes(e)}};i(50928);let tX=(0,_.AH)` 1862 :host wui-ux-by-reown { 1863 padding-top: 0; 1864 } 1865 1866 :host wui-ux-by-reown.branding-only { 1867 padding-top: ${({spacing:e})=>e["3"]}; 1868 } 1869 1870 a { 1871 text-decoration: none; 1872 color: ${({tokens:e})=>e.core.textAccentPrimary}; 1873 font-weight: 500; 1874 } 1875`;var t0=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let t1=class extends a.WF{constructor(){super(),this.unsubscribe=[],this.remoteFeatures=n.H.state.remoteFeatures,this.unsubscribe.push(n.H.subscribeKey("remoteFeatures",e=>this.remoteFeatures=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let{termsConditionsUrl:e,privacyPolicyUrl:t}=n.H.state,i=n.H.state.features?.legalCheckbox;return(e||t)&&!i?(0,a.qy)` 1876 <wui-flex flexDirection="column"> 1877 <wui-flex .padding=${["4","3","3","3"]} justifyContent="center"> 1878 <wui-text color="secondary" variant="md-regular" align="center"> 1879 By connecting your wallet, you agree to our <br /> 1880 ${this.termsTemplate()} ${this.andTemplate()} ${this.privacyTemplate()} 1881 </wui-text> 1882 </wui-flex> 1883 ${this.reownBrandingTemplate()} 1884 </wui-flex> 1885 `:(0,a.qy)` 1886 <wui-flex flexDirection="column"> ${this.reownBrandingTemplate(!0)} </wui-flex> 1887 `}andTemplate(){let{termsConditionsUrl:e,privacyPolicyUrl:t}=n.H.state;return e&&t?"and":""}termsTemplate(){let{termsConditionsUrl:e}=n.H.state;return e?(0,a.qy)`<a href=${e} target="_blank" rel="noopener noreferrer" 1888 >Terms of Service</a 1889 >`:null}privacyTemplate(){let{privacyPolicyUrl:e}=n.H.state;return e?(0,a.qy)`<a href=${e} target="_blank" rel="noopener noreferrer" 1890 >Privacy Policy</a 1891 >`:null}reownBrandingTemplate(e=!1){return this.remoteFeatures?.reownBranding?e?(0,a.qy)`<wui-ux-by-reown class="branding-only"></wui-ux-by-reown>`:(0,a.qy)`<wui-ux-by-reown></wui-ux-by-reown>`:null}};t1.styles=[tX],t0([(0,r.wk)()],t1.prototype,"remoteFeatures",void 0),t1=t0([(0,_.EM)("w3m-legal-footer")],t1),i(56839);let t3=(0,a.AH)``,t2=class extends a.WF{render(){let{termsConditionsUrl:e,privacyPolicyUrl:t}=n.H.state;return e||t?(0,a.qy)` 1892 <wui-flex 1893 .padding=${["4","3","3","3"]} 1894 flexDirection="column" 1895 alignItems="center" 1896 justifyContent="center" 1897 gap="3" 1898 > 1899 <wui-text color="secondary" variant="md-regular" align="center"> 1900 We work with the best providers to give you the lowest fees and best support. More options 1901 coming soon! 1902 </wui-text> 1903 1904 ${this.howDoesItWorkTemplate()} 1905 </wui-flex> 1906 `:null}howDoesItWorkTemplate(){return(0,a.qy)` <wui-link @click=${this.onWhatIsBuy.bind(this)}> 1907 <wui-icon size="xs" color="accent-primary" slot="iconLeft" name="helpCircle"></wui-icon> 1908 How does it work? 1909 </wui-link>`}onWhatIsBuy(){N.E.sendEvent({type:"track",event:"SELECT_WHAT_IS_A_BUY",properties:{isSmartAccount:(0,T.lj)(c.W.state.activeChain)===k.Vl.ACCOUNT_TYPES.SMART_ACCOUNT}}),d.I.push("WhatIsABuy")}};t2.styles=[t3],t2=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n}([(0,_.EM)("w3m-onramp-providers-footer")],t2);let t5=(0,_.AH)` 1910 :host { 1911 display: block; 1912 } 1913 1914 div.container { 1915 position: absolute; 1916 bottom: 0; 1917 left: 0; 1918 right: 0; 1919 overflow: hidden; 1920 height: auto; 1921 display: block; 1922 } 1923 1924 div.container[status='hide'] { 1925 animation: fade-out; 1926 animation-duration: var(--apkt-duration-dynamic); 1927 animation-timing-function: ${({easings:e})=>e["ease-out-power-2"]}; 1928 animation-fill-mode: both; 1929 animation-delay: 0s; 1930 } 1931 1932 div.container[status='show'] { 1933 animation: fade-in; 1934 animation-duration: var(--apkt-duration-dynamic); 1935 animation-timing-function: ${({easings:e})=>e["ease-out-power-2"]}; 1936 animation-fill-mode: both; 1937 animation-delay: var(--apkt-duration-dynamic); 1938 } 1939 1940 @keyframes fade-in { 1941 from { 1942 opacity: 0; 1943 filter: blur(6px); 1944 } 1945 to { 1946 opacity: 1; 1947 filter: blur(0px); 1948 } 1949 } 1950 1951 @keyframes fade-out { 1952 from { 1953 opacity: 1; 1954 filter: blur(0px); 1955 } 1956 to { 1957 opacity: 0; 1958 filter: blur(6px); 1959 } 1960 } 1961`;var t4=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let t6=class extends a.WF{constructor(){super(...arguments),this.resizeObserver=void 0,this.unsubscribe=[],this.status="hide",this.view=d.I.state.view}firstUpdated(){this.status=tJ.hasFooter()?"show":"hide",this.unsubscribe.push(d.I.subscribeKey("view",e=>{this.view=e,this.status=tJ.hasFooter()?"show":"hide","hide"===this.status&&document.documentElement.style.setProperty("--apkt-footer-height","0px")})),this.resizeObserver=new ResizeObserver(e=>{for(let t of e)if(t.target===this.getWrapper()){let e=`${t.contentRect.height}px`;document.documentElement.style.setProperty("--apkt-footer-height",e)}}),this.resizeObserver.observe(this.getWrapper())}render(){return(0,a.qy)` 1962 <div class="container" status=${this.status}>${this.templatePageContainer()}</div> 1963 `}templatePageContainer(){return tJ.hasFooter()?(0,a.qy)` ${this.templateFooter()}`:null}templateFooter(){switch(this.view){case"Networks":return this.templateNetworksFooter();case"Connect":case"ConnectWallets":case"OnRampFiatSelect":case"OnRampTokenSelect":return(0,a.qy)`<w3m-legal-footer></w3m-legal-footer>`;case"OnRampProviders":return(0,a.qy)`<w3m-onramp-providers-footer></w3m-onramp-providers-footer>`;default:return null}}templateNetworksFooter(){return(0,a.qy)` <wui-flex 1964 class="footer-in" 1965 padding="3" 1966 flexDirection="column" 1967 gap="3" 1968 alignItems="center" 1969 > 1970 <wui-text variant="md-regular" color="secondary" align="center"> 1971 Your connected wallet may not support some of the networks available for this dApp 1972 </wui-text> 1973 <wui-link @click=${this.onNetworkHelp.bind(this)}> 1974 <wui-icon size="sm" color="accent-primary" slot="iconLeft" name="helpCircle"></wui-icon> 1975 What is a network 1976 </wui-link> 1977 </wui-flex>`}onNetworkHelp(){N.E.sendEvent({type:"track",event:"CLICK_NETWORK_HELP"}),d.I.push("WhatIsANetwork")}getWrapper(){return this.shadowRoot?.querySelector("div.container")}};t6.styles=[t5],t4([(0,r.wk)()],t6.prototype,"status",void 0),t4([(0,r.wk)()],t6.prototype,"view",void 0),t6=t4([(0,_.EM)("w3m-footer")],t6);let t8=(0,_.AH)` 1978 :host { 1979 display: block; 1980 width: inherit; 1981 } 1982`;var t9=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let t7=class extends a.WF{constructor(){super(),this.unsubscribe=[],this.viewState=d.I.state.view,this.history=d.I.state.history.join(","),this.unsubscribe.push(d.I.subscribeKey("view",()=>{this.history=d.I.state.history.join(","),document.documentElement.style.setProperty("--apkt-duration-dynamic","var(--apkt-durations-lg)")}))}
1982disconnectedCallback(){this.unsubscribe.forEach(e=>e()),document.documentElement.style.setProperty("--apkt-duration-dynamic","0s")}render(){return(0,a.qy)`${this.templatePageContainer()}`}templatePageContainer(){return(0,a.qy)`<w3m-router-container 1983 history=${this.history} 1984 .setView=${()=>{this.viewState=d.I.state.view}} 1985 > 1986 ${this.viewTemplate(this.viewState)} 1987 </w3m-router-container>`}viewTemplate(e){switch(e){case"AccountSettings":return(0,a.qy)`<w3m-account-settings-view></w3m-account-settings-view>`;case"Account":return(0,a.qy)`<w3m-account-view></w3m-account-view>`;case"AllWallets":return(0,a.qy)`<w3m-all-wallets-view></w3m-all-wallets-view>`;case"ApproveTransaction":return(0,a.qy)`<w3m-approve-transaction-view></w3m-approve-transaction-view>`;case"BuyInProgress":return(0,a.qy)`<w3m-buy-in-progress-view></w3m-buy-in-progress-view>`;case"ChooseAccountName":return(0,a.qy)`<w3m-choose-account-name-view></w3m-choose-account-name-view>`;case"Connect":default:return(0,a.qy)`<w3m-connect-view></w3m-connect-view>`;case"Create":return(0,a.qy)`<w3m-connect-view walletGuide="explore"></w3m-connect-view>`;case"ConnectingWalletConnect":return(0,a.qy)`<w3m-connecting-wc-view></w3m-connecting-wc-view>`;case"ConnectingWalletConnectBasic":return(0,a.qy)`<w3m-connecting-wc-basic-view></w3m-connecting-wc-basic-view>`;case"ConnectingExternal":return(0,a.qy)`<w3m-connecting-external-view></w3m-connecting-external-view>`;case"ConnectingSiwe":return(0,a.qy)`<w3m-connecting-siwe-view></w3m-connecting-siwe-view>`;case"ConnectWallets":return(0,a.qy)`<w3m-connect-wallets-view></w3m-connect-wallets-view>`;case"ConnectSocials":return(0,a.qy)`<w3m-connect-socials-view></w3m-connect-socials-view>`;case"ConnectingSocial":return(0,a.qy)`<w3m-connecting-social-view></w3m-connecting-social-view>`;case"DataCapture":return(0,a.qy)`<w3m-data-capture-view></w3m-data-capture-view>`;case"DataCaptureOtpConfirm":return(0,a.qy)`<w3m-data-capture-otp-confirm-view></w3m-data-capture-otp-confirm-view>`;case"Downloads":return(0,a.qy)`<w3m-downloads-view></w3m-downloads-view>`;case"EmailLogin":return(0,a.qy)`<w3m-email-login-view></w3m-email-login-view>`;case"EmailVerifyOtp":return(0,a.qy)`<w3m-email-verify-otp-view></w3m-email-verify-otp-view>`;case"EmailVerifyDevice":return(0,a.qy)`<w3m-email-verify-device-view></w3m-email-verify-device-view>`;case"GetWallet":return(0,a.qy)`<w3m-get-wallet-view></w3m-get-wallet-view>`;case"Networks":return(0,a.qy)`<w3m-networks-view></w3m-networks-view>`;case"SwitchNetwork":return(0,a.qy)`<w3m-network-switch-view></w3m-network-switch-view>`;case"ProfileWallets":return(0,a.qy)`<w3m-profile-wallets-view></w3m-profile-wallets-view>`;case"Transactions":return(0,a.qy)`<w3m-transactions-view></w3m-transactions-view>`;case"OnRampProviders":return(0,a.qy)`<w3m-onramp-providers-view></w3m-onramp-providers-view>`;case"OnRampTokenSelect":return(0,a.qy)`<w3m-onramp-token-select-view></w3m-onramp-token-select-view>`;case"OnRampFiatSelect":return(0,a.qy)`<w3m-onramp-fiat-select-view></w3m-onramp-fiat-select-view>`;case"UpgradeEmailWallet":return(0,a.qy)`<w3m-upgrade-wallet-view></w3m-upgrade-wallet-view>`;case"UpdateEmailWallet":return(0,a.qy)`<w3m-update-email-wallet-view></w3m-update-email-wallet-view>`;case"UpdateEmailPrimaryOtp":return(0,a.qy)`<w3m-update-email-primary-otp-view></w3m-update-email-primary-otp-view>`;case"UpdateEmailSecondaryOtp":return(0,a.qy)`<w3m-update-email-secondary-otp-view></w3m-update-email-secondary-otp-view>`;case"UnsupportedChain":return(0,a.qy)`<w3m-unsupported-chain-view></w3m-unsupported-chain-view>`;case"Swap":return(0,a.qy)`<w3m-swap-view></w3m-swap-view>`;case"SwapSelectToken":return(0,a.qy)`<w3m-swap-select-token-view></w3m-swap-select-token-view>`;case"SwapPreview":return(0,a.qy)`<w3m-swap-preview-view></w3m-swap-preview-view>`;case"WalletSend":return(0,a.qy)`<w3m-wallet-send-view></w3m-wallet-send-view>`;case"WalletSendSelectToken":return(0,a.qy)`<w3m-wallet-send-select-token-view></w3m-wallet-send-select-token-view>`;case"WalletSendPreview":return(0,a.qy)`<w3m-wallet-send-preview-view></w3m-wallet-send-preview-view>`;case"WalletSendConfirmed":return(0,a.qy)`<w3m-send-confirmed-view></w3m-send-confirmed-view>`;case"WhatIsABuy":return(0,a.qy)`<w3m-what-is-a-buy-view></w3m-what-is-a-buy-view>`;case"WalletReceive":return(0,a.qy)`<w3m-wallet-receive-view></w3m-wallet-receive-view>`;case"WalletCompatibleNetworks":return(0,a.qy)`<w3m-wallet-compatible-networks-view></w3m-wallet-compatible-networks-view>`;case"WhatIsAWallet":return(0,a.qy)`<w3m-what-is-a-wallet-view></w3m-what-is-a-wallet-view>`;case"ConnectingMultiChain":return(0,a.qy)`<w3m-connecting-multi-chain-view></w3m-connecting-multi-chain-view>`;case"WhatIsANetwork":return(0,a.qy)`<w3m-what-is-a-network-view></w3m-what-is-a-network-view>`;case"ConnectingFarcaster":return(0,a.qy)`<w3m-connecting-farcaster-view></w3m-connecting-farcaster-view>`;case"SwitchActiveChain":return(0,a.qy)`<w3m-switch-active-chain-view></w3m-switch-active-chain-view>`;case"RegisterAccountName":return(0,a.qy)`<w3m-register-account-name-view></w3m-register-account-name-view>`;case"RegisterAccountNameSuccess":return(0,a.qy)`<w3m-register-account-name-success-view></w3m-register-account-name-success-view>`;case"SmartSessionCreated":return(0,a.qy)`<w3m-smart-session-created-view></w3m-smart-session-created-view>`;case"SmartSessionList":return(0,a.qy)`<w3m-smart-session-list-view></w3m-smart-session-list-view>`;case"SIWXSignMessage":return(0,a.qy)`<w3m-siwx-sign-message-view></w3m-siwx-sign-message-view>`;case"Pay":return(0,a.qy)`<w3m-pay-view></w3m-pay-view>`;case"PayLoading":return(0,a.qy)`<w3m-pay-loading-view></w3m-pay-loading-view>`;case"PayQuote":return(0,a.qy)`<w3m-pay-quote-view></w3m-pay-quote-view>`;case"FundWallet":return(0,a.qy)`<w3m-fund-wallet-view></w3m-fund-wallet-view>`;case"PayWithExchange":return(0,a.qy)`<w3m-deposit-from-exchange-view></w3m-deposit-from-exchange-view>`;case"PayWithExchangeSelectAsset":return(0,a.qy)`<w3m-deposit-from-exchange-select-asset-view></w3m-deposit-from-exchange-select-asset-view>`;case"UsageExceeded":return(0,a.qy)`<w3m-usage-exceeded-view></w3m-usage-exceeded-view>`;case"SmartAccountSettings":return(0,a.qy)`<w3m-smart-account-settings-view></w3m-smart-account-settings-view>`}}};t7.styles=[t8],t9([(0,r.wk)()],t7.prototype,"viewState",void 0),t9([(0,r.wk)()],t7.prototype,"history",void 0),t7=t9([(0,_.EM)("w3m-router")],t7);let ie=(0,_.AH)` 1988 :host { 1989 z-index: ${({tokens:e})=>e.core.zIndex}; 1990 display: block; 1991 backface-visibility: hidden; 1992 will-change: opacity; 1993 position: fixed; 1994 top: 0; 1995 left: 0; 1996 right: 0; 1997 bottom: 0; 1998 pointer-events: none; 1999 opacity: 0; 2000 background-color: ${({tokens:e})=>e.theme.overlay}; 2001 backdrop-filter: blur(0px); 2002 transition: 2003 opacity ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, 2004 backdrop-filter ${({durations:e})=>e.lg} 2005 ${({easings:e})=>e["ease-out-power-2"]}; 2006 will-change: opacity; 2007 } 2008 2009 :host(.open) { 2010 opacity: 1; 2011 backdrop-filter: blur(8px); 2012 } 2013 2014 :host(.appkit-modal) { 2015 position: relative; 2016 pointer-events: unset; 2017 background: none; 2018 width: 100%; 2019 opacity: 1; 2020 } 2021 2022 wui-card { 2023 max-width: var(--apkt-modal-width); 2024 width: 100%; 2025 position: relative; 2026 outline: none; 2027 transform: translateY(4px); 2028 box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.05); 2029 transition: 2030 transform ${({durations:e})=>e.lg} 2031 ${({easings:e})=>e["ease-out-power-2"]}, 2032 border-radius ${({durations:e})=>e.lg} 2033 ${({easings:e})=>e["ease-out-power-1"]}, 2034 background-color ${({durations:e})=>e.lg} 2035 ${({easings:e})=>e["ease-out-power-1"]}, 2036 box-shadow ${({durations:e})=>e.lg} 2037 ${({easings:e})=>e["ease-out-power-1"]}; 2038 will-change: border-radius, background-color, transform, box-shadow; 2039 background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; 2040 padding: var(--local-modal-padding); 2041 box-sizing: border-box; 2042 } 2043 2044 :host(.open) wui-card { 2045 transform: translateY(0px); 2046 } 2047 2048 wui-card::before { 2049 z-index: 1; 2050 pointer-events: none; 2051 content: ''; 2052 position: absolute; 2053 inset: 0; 2054 border-radius: clamp(0px, var(--apkt-borderRadius-8), 44px); 2055 transition: box-shadow ${({durations:e})=>e.lg} 2056 ${({easings:e})=>e["ease-out-power-2"]}; 2057 transition-delay: ${({durations:e})=>e.md}; 2058 will-change: box-shadow; 2059 } 2060 2061 :host([data-mobile-fullscreen='true']) wui-card::before { 2062 border-radius: 0px; 2063 } 2064 2065 :host([data-border='true']) wui-card::before { 2066 box-shadow: inset 0px 0px 0px 4px ${({tokens:e})=>e.theme.foregroundSecondary}; 2067 } 2068 2069 :host([data-border='false']) wui-card::before { 2070 box-shadow: inset 0px 0px 0px 1px ${({tokens:e})=>e.theme.borderPrimaryDark}; 2071 } 2072 2073 :host([data-border='true']) wui-card { 2074 animation: 2075 fade-in ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, 2076 card-background-border var(--apkt-duration-dynamic) 2077 ${({easings:e})=>e["ease-out-power-2"]}; 2078 animation-fill-mode: backwards, both; 2079 animation-delay: var(--apkt-duration-dynamic); 2080 } 2081 2082 :host([data-border='false']) wui-card { 2083 animation: 2084 fade-in ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, 2085 card-background-default var(--apkt-duration-dynamic) 2086 ${({easings:e})=>e["ease-out-power-2"]}; 2087 animation-fill-mode: backwards, both; 2088 animation-delay: 0s; 2089 } 2090 2091 :host(.appkit-modal) wui-card { 2092 max-width: var(--apkt-modal-width); 2093 } 2094 2095 wui-card[shake='true'] { 2096 animation: 2097 fade-in ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, 2098 w3m-shake ${({durations:e})=>e.xl} 2099 ${({easings:e})=>e["ease-out-power-2"]}; 2100 } 2101 2102 wui-flex { 2103 overflow-x: hidden; 2104 overflow-y: auto; 2105 display: flex; 2106 align-items: center; 2107 justify-content: center; 2108 width: 100%; 2109 height: 100%; 2110 } 2111 2112 @media (max-height: 700px) and (min-width: 431px) { 2113 wui-flex { 2114 align-items: flex-start; 2115 } 2116 2117 wui-card { 2118 margin: var(--apkt-spacing-6) 0px; 2119 } 2120 } 2121 2122 @media (max-width: 430px) { 2123 :host([data-mobile-fullscreen='true']) { 2124 height: 100dvh; 2125 } 2126 :host([data-mobile-fullscreen='true']) wui-flex { 2127 align-items: stretch; 2128 } 2129 :host([data-mobile-fullscreen='true']) wui-card { 2130 max-width: 100%; 2131 height: 100%; 2132 border-radius: 0; 2133 border: none; 2134 } 2135 :host(:not([data-mobile-fullscreen='true'])) wui-flex { 2136 align-items: flex-end; 2137 } 2138 2139 :host(:not([data-mobile-fullscreen='true'])) wui-card { 2140 max-width: 100%; 2141 border-bottom: none; 2142 } 2143 2144 :host(:not([data-mobile-fullscreen='true'])) wui-card[data-embedded='true'] { 2145 border-bottom-left-radius: clamp(0px, var(--apkt-borderRadius-8), 44px); 2146 border-bottom-right-radius: clamp(0px, var(--apkt-borderRadius-8), 44px); 2147 } 2148 2149 :host(:not([data-mobile-fullscreen='true'])) wui-card:not([data-embedded='true']) { 2150 border-bottom-left-radius: 0px; 2151 border-bottom-right-radius: 0px; 2152 } 2153 2154 wui-card[shake='true'] { 2155 animation: w3m-shake 0.5s ${({easings:e})=>e["ease-out-power-2"]}; 2156 } 2157 } 2158 2159 @keyframes fade-in { 2160 0% { 2161 transform: scale(0.99) translateY(4px); 2162 } 2163 100% { 2164 transform: scale(1) translateY(0); 2165 } 2166 } 2167 2168 @keyframes w3m-shake { 2169 0% { 2170 transform: scale(1) rotate(0deg); 2171 } 2172 20% { 2173 transform: scale(1) rotate(-1deg); 2174 } 2175 40% { 2176 transform: scale(1) rotate(1.5deg); 2177 } 2178 60% { 2179 transform: scale(1) rotate(-1.5deg); 2180 } 2181 80% { 2182 transform: scale(1) rotate(1deg); 2183 } 2184 100% { 2185 transform: scale(1) rotate(0deg); 2186 } 2187 } 2188 2189 @keyframes card-background-border { 2190 from { 2191 background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; 2192 } 2193 to { 2194 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 2195 } 2196 } 2197 2198 @keyframes card-background-default { 2199 from { 2200 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 2201 } 2202 to { 2203 background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; 2204 } 2205 } 2206`;var it=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let ii="scroll-lock",ia={PayWithExchange:"0",PayWithExchangeSelectAsset:"0",Pay:"0",PayQuote:"0",PayLoading:"0"};class ir extends a.WF{constructor(){super(),this.unsubscribe=[],this.abortController=void 0,this.hasPrefetched=!1,this.enableEmbedded=n.H.state.enableEmbedded,this.open=s.W.state.open,this.caipAddress=c.W.state.activeCaipAddress,this.caipNetwork=c.W.state.activeCaipNetwork,this.shake=s.W.state.shake,this.filterByNamespace=l.a.state.filterByNamespace,this.padding=_.f.spacing[1],this.mobileFullScreen=n.H.state.enableMobileFullScreen,this.initializeTheming(),u.N.prefetchAnalyticsConfig(),this.unsubscribe.push(s.W.subscribeKey("open",e=>e?this.onOpen():this.onClose()),s.W.subscribeKey("shake",e=>this.shake=e),c.W.subscribeKey("activeCaipNetwork",e=>this.onNewNetwork(e)),c.W.subscribeKey("activeCaipAddress",e=>this.onNewAddress(e)),n.H.subscribeKey("enableEmbedded",e=>this.enableEmbedded=e),l.a.subscribeKey("filterByNamespace",e=>{this.filterByNamespace===e||c.W.getAccountData(e)?.caipAddress||(u.N.fetchRecommendedWallets(),this.filterByNamespace=e)}),d.I.subscribeKey("view",()=>{this.dataset.border=tJ.hasFooter()?"true":"false",this.padding=ia[d.I.state.view]??_.f.spacing[1]}))}firstUpdated(){if(this.dataset.border=tJ.hasFooter()?"true":"false",this.mobileFullScreen&&this.setAttribute("data-mobile-fullscreen","true"),this.caipAddress){if(this.enableEmbedded){s.W.close(),this.prefetch();return}this.onNewAddress(this.caipAddress)}this.open&&this.onOpen(),this.enableEmbedded&&this.prefetch()}
2206disconnectedCallback(){this.unsubscribe.forEach(e=>e()),this.onRemoveKeyboardListener()}render(){return(this.style.setProperty("--local-modal-padding",this.padding),this.enableEmbedded)?(0,a.qy)`${this.contentTemplate()} 2207 <w3m-tooltip></w3m-tooltip> `:this.open?(0,a.qy)` 2208 <wui-flex @click=${this.onOverlayClick.bind(this)} data-testid="w3m-modal-overlay"> 2209 ${this.contentTemplate()} 2210 </wui-flex> 2211 <w3m-tooltip></w3m-tooltip> 2212 `:null}contentTemplate(){return(0,a.qy)` <wui-card 2213 shake="${this.shake}" 2214 data-embedded="${(0,o.J)(this.enableEmbedded)}" 2215 role="alertdialog" 2216 aria-modal="true" 2217 tabindex="0" 2218 data-testid="w3m-modal-card" 2219 > 2220 <w3m-header></w3m-header> 2221 <w3m-router></w3m-router> 2222 <w3m-footer></w3m-footer> 2223 <w3m-snackbar></w3m-snackbar> 2224 <w3m-alertbar></w3m-alertbar> 2225 </wui-card>`}async onOverlayClick(e){e.target===e.currentTarget&&(this.mobileFullScreen||await this.handleClose())}async handleClose(){await m.safeClose()}initializeTheming(){let{themeVariables:e,themeMode:t}=w.W.state,i=_.Zv.getColorTheme(t);(0,_.RF)(e,i)}onClose(){this.open=!1,this.classList.remove("open"),this.onScrollUnlock(),g.P.hide(),this.onRemoveKeyboardListener()}onOpen(){this.open=!0,this.classList.add("open"),this.onScrollLock(),this.onAddKeyboardListener()}onScrollLock(){let e=document.createElement("style");e.dataset.w3m=ii,e.textContent=` 2226 body { 2227 touch-action: none; 2228 overflow: hidden; 2229 overscroll-behavior: contain; 2230 } 2231 w3m-modal { 2232 pointer-events: auto; 2233 } 2234 `,document.head.appendChild(e)}onScrollUnlock(){let e=document.head.querySelector(`style[data-w3m="${ii}"]`);e&&e.remove()}onAddKeyboardListener(){this.abortController=new AbortController;let e=this.shadowRoot?.querySelector("wui-card");e?.focus(),window.addEventListener("keydown",t=>{if("Escape"===t.key)this.handleClose();else if("Tab"===t.key){let{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){let t=c.W.state.isSwitchingNamespace,i="ProfileWallets"===d.I.state.view;e||t||i||s.W.close(),await h.U.initializeIfEnabled(e),this.caipAddress=e,c.W.setIsSwitchingNamespace(!1)}onNewNetwork(e){let t=this.caipNetwork,i=t?.caipNetworkId?.toString(),a=e?.caipNetworkId?.toString(),r="UnsupportedChain"===d.I.state.view,o=s.W.state.open,n=!1;this.enableEmbedded&&"SwitchNetwork"===d.I.state.view&&(n=!0),i!==a&&W.resetState(),o&&r&&(n=!0),n&&"SIWXSignMessage"!==d.I.state.view&&d.I.goBack(),this.caipNetwork=e}prefetch(){this.hasPrefetched||(u.N.prefetch(),u.N.fetchWalletsByPage({page:1}),this.hasPrefetched=!0)}}ir.styles=ie,it([(0,r.MZ)({type:Boolean})],ir.prototype,"enableEmbedded",void 0),it([(0,r.wk)()],ir.prototype,"open",void 0),it([(0,r.wk)()],ir.prototype,"caipAddress",void 0),it([(0,r.wk)()],ir.prototype,"caipNetwork",void 0),it([(0,r.wk)()],ir.prototype,"shake",void 0),it([(0,r.wk)()],ir.prototype,"filterByNamespace",void 0),it([(0,r.wk)()],ir.prototype,"padding",void 0),it([(0,r.wk)()],ir.prototype,"mobileFullScreen",void 0);let io=class extends ir{};io=it([(0,_.EM)("w3m-modal")],io);let is=class extends ir{};is=it([(0,_.EM)("appkit-modal")],is);let ic=(0,_.AH)` 2235 .icon-box { 2236 width: 64px; 2237 height: 64px; 2238 border-radius: ${({borderRadius:e})=>e[5]}; 2239 background-color: ${({colors:e})=>e.semanticError010}; 2240 } 2241`,il=class extends a.WF{constructor(){super()}render(){return(0,a.qy)` 2242 <wui-flex 2243 flexDirection="column" 2244 alignItems="center" 2245 gap="4" 2246 .padding="${["1","3","4","3"]}" 2247 > 2248 <wui-flex justifyContent="center" alignItems="center" class="icon-box"> 2249 <wui-icon size="xxl" color="error" name="warningCircle"></wui-icon> 2250 </wui-flex> 2251 2252 <wui-text variant="lg-medium" color="primary" align="center"> 2253 The app isn't responding as expected 2254 </wui-text> 2255 <wui-text variant="md-regular" color="secondary" align="center"> 2256 Try again or reach out to the app team for help.
2257 </wui-text> 2258 2259 <wui-button 2260 variant="neutral-secondary" 2261 size="md" 2262 @click=${this.onTryAgainClick.bind(this)} 2263 data-testid="w3m-usage-exceeded-button" 2264 > 2265 <wui-icon color="inherit" slot="iconLeft" name="refresh"></wui-icon> 2266 Try Again 2267 </wui-button> 2268 </wui-flex> 2269 `}onTryAgainClick(){d.I.goBack()}};il.styles=ic,il=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n}([(0,_.EM)("w3m-usage-exceeded-view")],il);var iu=i(30606);i(6921);let id=(0,_.AH)` 2270 :host { 2271 width: 100%; 2272 } 2273`;var ip=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let ih=class extends a.WF{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)&&N.E.sendWalletImpressionEvent({name:this.name,walletRank:this.walletRank,rdnsId:this.rdnsId,view:d.I.state.view,displayIndex:this.displayIndex}))}handleGetWalletNamespaces(){return Object.keys(iu.q.state.adapters).length>1?this.namespaces:[]}render(){return(0,a.qy)` 2274 <wui-list-wallet 2275 .walletImages=${this.walletImages} 2276 imageSrc=${(0,o.J)(this.imageSrc)} 2277 name=${this.name} 2278 size=${(0,o.J)(this.size)} 2279 tagLabel=${(0,o.J)(this.tagLabel)} 2280 .tagVariant=${this.tagVariant} 2281 .walletIcon=${this.walletIcon} 2282 .tabIdx=${this.tabIdx} 2283 .disabled=${this.disabled} 2284 .showAllWallets=${this.showAllWallets} 2285 .loading=${this.loading} 2286 loadingSpinnerColor=${this.loadingSpinnerColor} 2287 .namespaces=${this.handleGetWalletNamespaces()} 2288 ></wui-list-wallet> 2289 `}};ih.styles=id,ip([(0,r.MZ)({type:Array})],ih.prototype,"walletImages",void 0),ip([(0,r.MZ)()],ih.prototype,"imageSrc",void 0),ip([(0,r.MZ)()],ih.prototype,"name",void 0),ip([(0,r.MZ)()],ih.prototype,"size",void 0),ip([(0,r.MZ)()],ih.prototype,"tagLabel",void 0),ip([(0,r.MZ)()],ih.prototype,"tagVariant",void 0),ip([(0,r.MZ)()],ih.prototype,"walletIcon",void 0),ip([(0,r.MZ)()],ih.prototype,"tabIdx",void 0),ip([(0,r.MZ)({type:Boolean})],ih.prototype,"disabled",void 0),ip([(0,r.MZ)({type:Boolean})],ih.prototype,"showAllWallets",void 0),ip([(0,r.MZ)({type:Boolean})],ih.prototype,"loading",void 0),ip([(0,r.MZ)({type:String})],ih.prototype,"loadingSpinnerColor",void 0),ip([(0,r.MZ)()],ih.prototype,"rdnsId",void 0),ip([(0,r.MZ)()],ih.prototype,"displayIndex",void 0),ip([(0,r.MZ)()],ih.prototype,"walletRank",void 0),ip([(0,r.MZ)({type:Array})],ih.prototype,"namespaces",void 0),ih=ip([(0,_.EM)("w3m-list-wallet")],ih);let im=(0,_.AH)` 2290 :host { 2291 --local-duration-height: 0s; 2292 --local-duration: ${({durations:e})=>e.lg}; 2293 --local-transition: ${({easings:e})=>e["ease-out-power-2"]}; 2294 } 2295 2296 .container { 2297 display: block; 2298 overflow: hidden; 2299 overflow: hidden; 2300 position: relative; 2301 height: var(--local-container-height); 2302 transition: height var(--local-duration-height) var(--local-transition); 2303 will-change: height, padding-bottom; 2304 } 2305 2306 .container[data-mobile-fullscreen='true'] { 2307 overflow: scroll; 2308 } 2309 2310 .page { 2311 position: absolute; 2312 top: 0; 2313 left: 0; 2314 right: 0; 2315 width: 100%; 2316 height: auto; 2317 width: inherit; 2318 box-sizing: border-box; 2319 display: flex; 2320 flex-direction: column; 2321 background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; 2322 border-bottom-left-radius: var(--local-border-bottom-radius); 2323 border-bottom-right-radius: var(--local-border-bottom-radius); 2324 transition: border-bottom-left-radius var(--local-duration) var(--local-transition); 2325 } 2326 2327 .page[data-mobile-fullscreen='true'] { 2328 height: 100%; 2329 } 2330 2331 .page-content { 2332 display: flex; 2333 flex-direction: column; 2334 min-height: 100%; 2335 } 2336 2337 .footer { 2338 height: var(--apkt-footer-height); 2339 } 2340 2341 div.page[view-direction^='prev-'] .page-content { 2342 animation: 2343 slide-left-out var(--local-duration) forwards var(--local-transition), 2344 slide-left-in var(--local-duration) forwards var(--local-transition); 2345 animation-delay: 0ms, var(--local-duration, ${({durations:e})=>e.lg}); 2346 } 2347 2348 div.page[view-direction^='next-'] .page-content { 2349 animation: 2350 slide-right-out var(--local-duration) forwards var(--local-transition), 2351 slide-right-in var(--local-duration) forwards var(--local-transition); 2352 animation-delay: 0ms, var(--local-duration, ${({durations:e})=>e.lg}); 2353 } 2354 2355 @keyframes slide-left-out { 2356 from { 2357 transform: translateX(0px) scale(1); 2358 opacity: 1; 2359 filter: blur(0px); 2360 } 2361 to { 2362 transform: translateX(8px) scale(0.99); 2363 opacity: 0; 2364 filter: blur(4px); 2365 } 2366 } 2367 2368 @keyframes slide-left-in { 2369 from { 2370 transform: translateX(-8px) scale(0.99); 2371 opacity: 0; 2372 filter: blur(4px); 2373 } 2374 to { 2375 transform: translateX(0) translateY(0) scale(1); 2376 opacity: 1; 2377 filter: blur(0px); 2378 } 2379 } 2380 2381 @keyframes slide-right-out { 2382 from { 2383 transform: translateX(0px) scale(1); 2384 opacity: 1; 2385 filter: blur(0px); 2386 } 2387 to { 2388 transform: translateX(-8px) scale(0.99); 2389 opacity: 0; 2390 filter: blur(4px); 2391 } 2392 } 2393 2394 @keyframes slide-right-in { 2395 from { 2396 transform: translateX(8px) scale(0.99); 2397 opacity: 0; 2398 filter: blur(4px); 2399 } 2400 to { 2401 transform: translateX(0) translateY(0) scale(1); 2402 opacity: 1; 2403 filter: blur(0px); 2404 } 2405 } 2406`;var iw=function(e,t,i,a){var r,o=arguments.length,n=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let ig=class extends a.WF{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=n.H.state.enableMobileFullScreen,this.onViewportResize=()=>{this.updateContainerHeight()}}updated(e){if(e.has("history")){let 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(let t of e)if(t.target===this.getWrapper()){let e=t.contentRect.height,i=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--apkt-footer-height")||"0");
2406this.mobileFullScreen?(e=(window.visualViewport?.height||window.innerHeight)-this.getHeaderHeight()-i,this.style.setProperty("--local-border-bottom-radius","0px")):(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(){let e=this.getWrapper();e&&this.resizeObserver&&this.resizeObserver.unobserve(e),window.removeEventListener("resize",this.onViewportResize),window.visualViewport?.removeEventListener("resize",this.onViewportResize)}render(){return(0,a.qy)` 2407 <div class="container" data-mobile-fullscreen="${(0,o.J)(this.mobileFullScreen)}"> 2408 <div 2409 class="page" 2410 data-mobile-fullscreen="${(0,o.J)(this.mobileFullScreen)}" 2411 view-direction="${this.viewDirection}" 2412 > 2413 <div class="page-content"> 2414 <slot></slot> 2415 </div> 2416 </div> 2417 </div> 2418 `}onViewChange(e){let t=e.split(",").filter(Boolean),i=this.historyState.split(",").filter(Boolean),a=i.length,r=t.length,o=t[t.length-1]||"",n=_.Zv.cssDurationToNumber(this.transitionDuration),s="";r>a?s="next":r<a?s="prev":r===a&&t[r-1]!==i[a-1]&&(s="next"),this.viewDirection=`${s}-${o}`,setTimeout(()=>{this.historyState=e,this.setView?.(o)},n),setTimeout(()=>{this.viewDirection=""},2*n)}getWrapper(){return this.shadowRoot?.querySelector("div.page")}updateContainerHeight(){let e=this.getWrapper();if(!e)return;let t=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--apkt-footer-height")||"0"),i=0;this.mobileFullScreen?(i=(window.visualViewport?.height||window.innerHeight)-this.getHeaderHeight()-t,this.style.setProperty("--local-border-bottom-radius","0px")):(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}};ig.styles=[im],iw([(0,r.MZ)({type:String})],ig.prototype,"transitionDuration",void 0),iw([(0,r.MZ)({type:String})],ig.prototype,"transitionFunction",void 0),iw([(0,r.MZ)({type:String})],ig.prototype,"history",void 0),iw([(0,r.MZ)({type:String})],ig.prototype,"view",void 0),iw([(0,r.MZ)({attribute:!1})],ig.prototype,"setView",void 0),iw([(0,r.wk)()],ig.prototype,"viewDirection",void 0),iw([(0,r.wk)()],ig.prototype,"historyState",void 0),iw([(0,r.wk)()],ig.prototype,"previousHeight",void 0),iw([(0,r.wk)()],ig.prototype,"mobileFullScreen",void 0),ig=iw([(0,_.EM)("w3m-router-container")],ig)}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.