1"use strict";(()=>{var pn=Object.defineProperty;var c=(we,se)=>pn(we,"name",{value:se,configurable:!0});(self.webpackChunk=self.webpackChunk||[]).push([[9402],{49402(we,se,p){var Y,Q,V,K,J,Z,X,ee,te;p.r(se),p.d(se,{PayController:c(()=>l,"PayController"),W3mPayLoadingView:c(()=>P,"W3mPayLoadingView"),W3mPayQuoteView:c(()=>b,"W3mPayQuoteView"),W3mPayView:c(()=>U,"W3mPayView"),arbitrumUSDC:c(()=>nn,"arbitrumUSDC"),arbitrumUSDT:c(()=>cn,"arbitrumUSDT"),baseETH:c(()=>Jt,"baseETH"),baseSepoliaETH:c(()=>Xt,"baseSepoliaETH"),baseUSDC:c(()=>Zt,"baseUSDC"),ethereumUSDC:c(()=>en,"ethereumUSDC"),ethereumUSDT:c(()=>on,"ethereumUSDT"),getExchanges:c(()=>Ht,"getExchanges"),getIsPaymentInProgress:c(()=>Vt,"getIsPaymentInProgress"),getPayError:c(()=>Qt,"getPayError"),getPayResult:c(()=>Yt,"getPayResult"),openPay:c(()=>Ve,"openPay"),optimismUSDC:c(()=>tn,"optimismUSDC"),optimismUSDT:c(()=>rn,"optimismUSDT"),pay:c(()=>zt,"pay"),polygonUSDC:c(()=>sn,"polygonUSDC"),polygonUSDT:c(()=>ln,"polygonUSDT"),solanaSOL:c(()=>dn,"solanaSOL"),solanaUSDC:c(()=>an,"solanaUSDC"),solanaUSDT:c(()=>un,"solanaUSDT")});var u=p(75826),m=p(59262),x=p(72430),T=p(3469),g=p(65811),C=p(93982),W=p(98229),M=p(25967),A=p(1056),E=p(4020),f=p(17885),w=p(81679),B=p(34592),G=p(10174),ie=p(76325),ae=p(16735),O=p(48834),oe=p(39227),le=p(3411),mn=p(59445),hn=p(9016),yn=p(19832),wn=p(4570),De=p(72544),Ke=p(76382),k=p(93236),v=p(5346),S=p(65504),re=p(82741),D=p(86695),Je=p(68473),$=p(72188);const h={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"},q={[h.INVALID_PAYMENT_CONFIG]:"Invalid payment configuration",[h.INVALID_RECIPIENT]:"Invalid recipient address",[h.INVALID_ASSET]:"Invalid asset specified",[h.INVALID_AMOUNT]:"Invalid payment amount",[h.INVALID_RECIPIENT_ADDRESS_FOR_ASSET]:"Invalid recipient address for the asset selected",[h.UNKNOWN_ERROR]:"Unknown payment error occurred",[h.UNABLE_TO_INITIATE_PAYMENT]:"Unable to initiate payment",[h.INVALID_CHAIN_NAMESPACE]:"Invalid chain namespace",[h.GENERIC_PAYMENT_ERROR]:"Unable to process payment",[h.UNABLE_TO_GET_EXCHANGES]:"Unable to get exchanges",[h.ASSET_NOT_SUPPORTED]:"Asset not supported by the selected exchange",[h.UNABLE_TO_GET_PAY_URL]:"Unable to get payment URL",[h.UNABLE_TO_GET_BUY_STATUS]:"Unable to get buy status",[h.UNABLE_TO_GET_TOKEN_BALANCES]:"Unable to get token balances",[h.UNABLE_TO_GET_QUOTE]:"Unable to get quote. Please choose a different token",[h.UNABLE_TO_GET_QUOTE_STATUS]:"Unable to get quote status"},ye=class ye extends Error{get message(){return q[this.code]}constructor(e,n){super(q[e]),this.name="AppKitPayError",this.code=e,this.details=n,Error.captureStackTrace&&Error.captureStackTrace(this,ye)}};c(ye,"AppKitPayError");let y=ye;function gn(t,e){const n=t||h.UNKNOWN_ERROR;return new y(n,e)}c(gn,"createAppKitPayError");var Ze=p(79414),ge=p(4436),Le=p(50735);const Xe="https://rpc.walletconnect.org/v1/json-rpc",qe="reown_test";var et=p(40877),tt=p(43921),_e,nt,fe,xe;async function fn(t){const{paymentAssetNetwork:e,activeCaipNetwork:n,approvedCaipNetworkIds:s,requestedCaipNetworks:i}=t,r=nt.sortRequestedNetworks(s,i).find(L=>L.caipNetworkId===e);if(!r)throw new fe(xe.INVALID_PAYMENT_CONFIG);if(r.caipNetworkId===n.caipNetworkId)return;const d=_e.getNetworkProp("supportsAllNetworks",r.chainNamespace);if(!(s?.includes(r.caipNetworkId)||d))throw new fe(xe.INVALID_PAYMENT_CONFIG);try{await _e.switchActiveNetwork(r)}catch(L){throw new fe(xe.GENERIC_PAYMENT_ERROR,L)}}c(fn,"ensureCorrectNetwork");function st(){const{chainNamespace:t}=v.C.parseCaipNetworkId(l.state.paymentAsset.network);
1if(!D.w.isAddress(l.state.recipient,t))throw new y(h.INVALID_RECIPIENT_ADDRESS_FOR_ASSET,`Provide valid recipient address for namespace "${t}"`)}c(st,"ensureCorrectAddress");async function it(t,e,n){if(e!==k.o.CHAIN.EVM)throw new y(h.INVALID_CHAIN_NAMESPACE);if(!n.fromAddress)throw new y(h.INVALID_PAYMENT_CONFIG,"fromAddress is required for native EVM payments.");const s=typeof n.amount=="string"?parseFloat(n.amount):n.amount;if(isNaN(s))throw new y(h.INVALID_PAYMENT_CONFIG);const i=t.metadata?.decimals??18,a=A.x.parseUnits(s.toString(),i);if(typeof a!="bigint")throw new y(h.GENERIC_PAYMENT_ERROR);return await A.x.sendTransaction({chainNamespace:e,to:n.recipient,address:n.fromAddress,value:a,data:"0x"})??void 0}c(it,"processEvmNativePayment");async function at(t,e){if(!e.fromAddress)throw new y(h.INVALID_PAYMENT_CONFIG,"fromAddress is required for ERC20 EVM payments.");const n=t.asset,s=e.recipient,i=Number(t.metadata.decimals),a=A.x.parseUnits(e.amount.toString(),i);if(a===void 0)throw new y(h.GENERIC_PAYMENT_ERROR);return await A.x.writeContract({fromAddress:e.fromAddress,tokenAddress:n,args:[s,a],method:"transfer",abi:et.v.getERC20Abi(n),chainNamespace:k.o.CHAIN.EVM})??void 0}c(at,"processEvmErc20Payment");
1async function ot(t,e){if(t!==k.o.CHAIN.SOLANA)throw new y(h.INVALID_CHAIN_NAMESPACE);if(!e.fromAddress)throw new y(h.INVALID_PAYMENT_CONFIG,"fromAddress is required for Solana payments.");const n=typeof e.amount=="string"?parseFloat(e.amount):e.amount;if(isNaN(n)||n<=0)throw new y(h.INVALID_PAYMENT_CONFIG,"Invalid payment amount.");try{if(!tt.G.getProvider(t))throw new y(h.GENERIC_PAYMENT_ERROR,"No Solana provider available.");const i=await A.x.sendTransaction({chainNamespace:k.o.CHAIN.SOLANA,to:e.recipient,value:n,tokenMint:e.tokenMint});if(!i)throw new y(h.GENERIC_PAYMENT_ERROR,"Transaction failed.");return i}catch(s){throw s instanceof y?s:new y(h.GENERIC_PAYMENT_ERROR,`Solana payment failed: ${s}`)}}c(ot,"processSolanaPayment");async function rt({sourceToken:t,toToken:e,amount:n,recipient:s}){const i=A.x.parseUnits(n,t.metadata.decimals),a=A.x.parseUnits(n,e.metadata.decimals);return Promise.resolve({type:Te,origin:{amount:i?.toString()??"0",currency:t},destination:{amount:a?.toString()??"0",currency:e},fees:[{id:"service",label:"Service Fee",amount:"0",currency:e}],steps:[{requestId:Te,type:"deposit",deposit:{amount:i?.toString()??"0",currency:t.asset,receiver:s}}],timeInSeconds:6})}c(rt,"getDirectTransferQuote");function be(t){if(!t)return null;const e=t.steps[0];return!e||e.type!==bt?null:e}c(be,"getTransferStep");function Ee(t,e=0){if(!t)return[];const n=t.steps.filter(i=>i.type===Et),s=n.filter((i,a)=>a+1>e);return n.length>0&&n.length<3?s:[]}c(Ee,"getTransactionsSteps");const Ae=new Ze.Z({baseUrl:D.w.getApiUrl(),clientId:null}),Re=class Re extends Error{};c(Re,"JsonRpcError");let ve=Re;function ct(){const t=ge.H.getSnapshot().projectId;return`${Xe}?projectId=${t}`}c(ct,"getApiUrl");function Ie(){const{projectId:t,sdkType:e,sdkVersion:n}=ge.H.state;return{projectId:t,st:e||"appkit",sv:n||"html-wagmi-4.2.2"}}c(Ie,"getSdkProperties");async function Ne(t,e){const n=ct(),{sdkType:s,sdkVersion:i,projectId:a}=ge.H.getSnapshot(),r={jsonrpc:"2.0",id:1,method:t,params:{...e||{},st:s,sv:i,projectId:a}},I=await(await fetch(n,{method:"POST",body:JSON.stringify(r),headers:{"Content-Type":"application/json"}})).json();if(I.error)throw new ve(I.error.message);return I}c(Ne,"sendRequest");async function Fe(t){return(await Ne("reown_getExchanges",t)).result}c(Fe,"getExchanges");async function We(t){return(await Ne("reown_getExchangePayUrl",t)).result}c(We,"getPayUrl");async function lt(t){return(await Ne("reown_getExchangeBuyStatus",t)).result}c(lt,"getBuyStatus");async function ut(t){const e=S.S.bigNumber(t.amount).times(10**t.toToken.metadata.decimals).toString(),{chainId:n,chainNamespace:s}=v.C.parseCaipNetworkId(t.sourceToken.network),{chainId:i,chainNamespace:a}=v.C.parseCaipNetworkId(t.toToken.network),r=t.sourceToken.asset==="native"?(0,Le.NH)(s):t.sourceToken.asset,d=t.toToken.asset==="native"?(0,Le.NH)(a):t.toToken.asset;return await Ae.post({path:"/appkit/v1/transfers/quote",body:{user:t.address,originChainId:n.toString(),originCurrency:r,destinationChainId:i.toString(),destinationCurrency:d,recipient:t.recipient,amount:e},params:Ie()})}c(ut,"getTransfersQuote");async function dt(t){const e=$.y.isLowerCaseMatch(t.sourceToken.network,t.toToken.network),n=$.y.isLowerCaseMatch(t.sourceToken.asset,t.toToken.asset);return e&&n?rt(t):ut(t)}c(dt,"getQuote");async function pt(t){return await Ae.get({path:"/appkit/v1/transfers/status",params:{requestId:t.requestId,...Ie()}})}c(pt,"getQuoteStatus");async function mt(t){return await Ae.get({path:`/appkit/v1/transfers/assets/exchanges/${t}`,params:Ie()})}c(mt,"getAssetsForExchange");const ht=["eip155","solana"],yt={eip155:{native:{assetNamespace:"slip44",assetReference:"60"},defaultTokenNamespace:"erc20"},solana:{native:{assetNamespace:"slip44",assetReference:"501"},defaultTokenNamespace:"token"}},Me={56:"714",204:"714"};function Se(t,e){const{chainNamespace:n,chainId:s}=v.C.parseCaipNetworkId(t),i=yt[n];if(!i)throw new Error(`Unsupported chain namespace for CAIP-19 formatting: ${n}`);let a=i.native.assetNamespace,r=i.native.assetReference;return e!=="native"?(a=i.defaultTokenNamespace,r=e):n==="eip155"&&Me[s]&&(r=Me[s]),`${`${n}:${s}`}/${a}:${r}`}c(Se,"formatCaip19Asset");function wt(t){const{chainNamespace:e}=v.C.parseCaipNetworkId(t);return ht.includes(e)}c(wt,"isPayWithWalletSupported");function gt(t){const n=g.W.getAllRequestedCaipNetworks().find(i=>i.caipNetworkId===t.chainId);let s=t.address;if(!n)throw new Error(`Target network not found for balance chainId "${t.chainId}"`);if($.y.isLowerCaseMatch(t.symbol,n.nativeCurrency.symbol))s="native";else if(D.w.isCaipAddress(s)){const{address:i}=v.C.parseCaipAddress(s);s=i}else if(!s)throw new Error(`Balance address not found for balance symbol "${t.symbol}"`);return{network:n.caipNetworkId,asset:s,metadata:{name:t.name,symbol:t.symbol,decimals:Number(t.quantity.decimals),logoURI:t.
1iconUrl},amount:t.quantity.numeric}}c(gt,"formatBalanceToPaymentAsset");function ft(t){return{chainId:t.network,address:`${t.network}:${t.asset}`,symbol:t.metadata.symbol,name:t.metadata.name,iconUrl:t.metadata.logoURI||"",price:0,quantity:{numeric:"0",decimals:t.metadata.decimals.toString()}}}c(ft,"formatPaymentAssetToBalance");function ue(t){const e=S.S.bigNumber(t,{safe:!0});return e.lt(.001)?"<0.001":e.round(4).toString()}c(ue,"formatAmount");function xt(t){const n=g.W.getAllRequestedCaipNetworks().find(s=>s.caipNetworkId===t.network);return n?!!n.testnet:!1}c(xt,"isTestnetAsset");const Be=0,Pe="unknown",Te="direct-transfer",bt="deposit",Et="transaction",o=(0,De.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:{[k.o.CHAIN.EVM]:[],[k.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}),l={state:o,subscribe(t){return(0,De.B1)(o,()=>t(o))},subscribeKey(t,e){return(0,Ke.u$)(o,t,e)},async handleOpenPay(t){this.resetState(),this.setPaymentConfig(t),this.initializeAnalytics(),st(),await this.prepareTokenLogo(),o.isConfigured=!0,re.E.sendEvent({type:"track",event:"PAY_MODAL_OPEN",properties:{exchanges:o.exchanges,configuration:{network:o.paymentAsset.network,asset:o.paymentAsset.asset,recipient:o.recipient,amount:o.amount}}}),await M.W.open({view:"Pay"})},resetState(){o.paymentAsset={network:"eip155:1",asset:"0x0",metadata:{name:"0x0",symbol:"0x0",decimals:0}},o.recipient="0x0",o.amount=0,o.isConfigured=!1,o.error=null,o.isPaymentInProgress=!1,o.isLoading=!1,o.currentPayment=void 0,o.selectedExchange=void 0,o.exchangeUrlForQuote=void 0,o.requestId=void 0},resetQuoteState(){o.quote=void 0,o.quoteStatus="waiting",o.quoteError=null,o.isFetchingQuote=!1,o.requestId=void 0}
vendor: 2,152 bytes, line 1
1,setPaymentConfig(t){if(!t.paymentAsset)throw new y(h.INVALID_PAYMENT_CONFIG);try{o.choice=t.choice??"pay",o.paymentAsset=t.paymentAsset,o.recipient=t.recipient,o.amount=t.amount,o.openInNewTab=t.openInNewTab??!0,o.redirectUrl=t.redirectUrl,o.payWithExchange=t.payWithExchange,o.error=null}catch(e){throw new y(h.INVALID_PAYMENT_CONFIG,e.message)}},setSelectedPaymentAsset(t){o.selectedPaymentAsset=t},setSelectedExchange(t){o.selectedExchange=t},setRequestId(t){o.requestId=t},setPaymentInProgress(t){o.isPaymentInProgress=t},getPaymentAsset(){return o.paymentAsset},getExchanges(){return o.exchanges},async fetchExchanges(){try{o.isLoading=!0;const t=await Fe({page:Be});o.exchanges=t.exchanges.slice(0,2)}catch{throw E.P.showError(q.UNABLE_TO_GET_EXCHANGES),new y(h.UNABLE_TO_GET_EXCHANGES)}finally{o.isLoading=!1}},async getAvailableExchanges(t){try{const e=t?.asset&&t?.network?Se(t.network,t.asset):void 0;return await Fe({page:t?.page??Be,asset:e,amount:t?.amount?.toString()})}catch{throw new y(h.UNABLE_TO_GET_EXCHANGES)}},async getPayUrl(t,e,n=!1){try{const s=Number(e.amount),i=await We({exchangeId:t,asset:Se(e.network,e.asset),amount:s.toString(),recipient:`${e.network}:${e.recipient}`});return re.E.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{source:"pay",exchange:{id:t},configuration:{network:e.network,asset:e.asset,recipient:e.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},headless:n}}),n&&(this.initiatePayment(),re.E.sendEvent({type:"track",event:"PAY_INITIATED",properties:{source:"pay",paymentId:o.paymentId||Pe,configuration:{network:e.network,asset:e.asset,recipient:e.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t}}})),i}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new y(h.ASSET_NOT_SUPPORTED):new Error(s.message)}},async generateExchangeUrlForQuote({exchangeId:t,paymentAsset:e,amount:n,recipient:s}){const i=await We({exchangeId:t,asset:Se(e.network,e.asset),amount:n.toString(),recipient:s});o.exchangeSessionId=i.sessionId,o.exchangeUrlForQuote=i.url},async openPayUrl(t,e,n=!1){try{const s=await this.getPayUrl(t.exchangeId,e,n);
1if(!s)throw new y(h.UNABLE_TO_GET_PAY_URL);const a=t.openInNewTab??!0?"_blank":"_self";return D.w.openHref(s.url,a),s}catch(s){throw s instanceof y?o.error=s.message:o.error=q.GENERIC_PAYMENT_ERROR,new y(h.UNABLE_TO_GET_PAY_URL)}},async onTransfer({chainNamespace:t,fromAddress:e,toAddress:n,amount:s,paymentAsset:i}){if(o.currentPayment={type:"wallet",status:"IN_PROGRESS"},!o.isPaymentInProgress)try{this.initiatePayment();const r=g.W.getAllRequestedCaipNetworks().find(I=>I.caipNetworkId===i.network);if(!r)throw new Error("Target network not found");const d=g.W.state.activeCaipNetwork;switch($.y.isLowerCaseMatch(d?.caipNetworkId,r.caipNetworkId)||await g.W.switchActiveNetwork(r),t){case k.o.CHAIN.EVM:i.asset==="native"&&(o.currentPayment.result=await it(i,t,{recipient:n,amount:s,fromAddress:e})),i.asset.startsWith("0x")&&(o.currentPayment.result=await at(i,{recipient:n,amount:s,fromAddress:e})),o.currentPayment.status="SUCCESS";break;case k.o.CHAIN.SOLANA:o.currentPayment.result=await ot(t,{recipient:n,amount:s,fromAddress:e,tokenMint:i.asset==="native"?void 0:i.asset}),o.currentPayment.status="SUCCESS";break;
1default:throw new y(h.INVALID_CHAIN_NAMESPACE)}}catch(a){throw a instanceof y?o.error=a.message:o.error=q.GENERIC_PAYMENT_ERROR,o.currentPayment.status="FAILED",E.P.showError(o.error),a}finally{o.isPaymentInProgress=!1}},async onSendTransaction(t){try{const{namespace:e,transactionStep:n}=t;l.initiatePayment();const i=g.W.getAllRequestedCaipNetworks().find(r=>r.caipNetworkId===o.paymentAsset?.network);if(!i)throw new Error("Target network not found");const a=g.W.state.activeCaipNetwork;if($.y.isLowerCaseMatch(a?.caipNetworkId,i.caipNetworkId)||await g.W.switchActiveNetwork(i),e===k.o.CHAIN.EVM){const{from:r,to:d,data:I,value:L}=n.transaction;await A.x.sendTransaction({address:r,to:d,data:I,value:BigInt(L),chainNamespace:e})}else if(e===k.o.CHAIN.SOLANA){const{instructions:r}=n.transaction;await A.x.writeSolanaTransaction({instructions:r})}}catch(e){throw e instanceof y?o.error=e.message:o.error=q.GENERIC_PAYMENT_ERROR,E.P.showError(o.error),e}finally{o.isPaymentInProgress=!1}},getExchangeById(t){return o.exchanges.find(e=>e.id===t)},validatePayConfig(t){const{paymentAsset:e,recipient:n,amount:s}=t;
vendor: 5,506 bytes, lines 1-26
1if(!e)throw new y(h.INVALID_PAYMENT_CONFIG);if(!n)throw new y(h.INVALID_RECIPIENT);if(!e.asset)throw new y(h.INVALID_ASSET);if(s==null||s<=0)throw new y(h.INVALID_AMOUNT)},async handlePayWithExchange(t){try{o.currentPayment={type:"exchange",exchangeId:t};const{network:e,asset:n}=o.paymentAsset,s={network:e,asset:n,amount:o.amount,recipient:o.recipient},i=await this.getPayUrl(t,s);if(!i)throw new y(h.UNABLE_TO_INITIATE_PAYMENT);return o.currentPayment.sessionId=i.sessionId,o.currentPayment.status="IN_PROGRESS",o.currentPayment.exchangeId=t,this.initiatePayment(),{url:i.url,openInNewTab:o.openInNewTab}}catch(e){return e instanceof y?o.error=e.message:o.error=q.GENERIC_PAYMENT_ERROR,o.isPaymentInProgress=!1,E.P.showError(o.error),null}},async getBuyStatus(t,e){try{const n=await lt({sessionId:e,exchangeId:t});return(n.status==="SUCCESS"||n.status==="FAILED")&&re.E.sendEvent({type:"track",event:n.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:n.status==="FAILED"?D.w.parseError(o.error):void 0,source:"pay",paymentId:o.paymentId||Pe,configuration:{network:o.paymentAsset.network,asset:o.paymentAsset.asset,recipient:o.recipient,amount:o.amount},currentPayment:{type:"exchange",exchangeId:o.currentPayment?.exchangeId,sessionId:o.currentPayment?.sessionId,result:n.txHash}}}),n}catch{throw new y(h.UNABLE_TO_GET_BUY_STATUS)}},async fetchTokensFromEOA({caipAddress:t,caipNetwork:e,namespace:n}){if(!t)return[];const{address:s}=v.C.parseCaipAddress(t);let i=e;return n===k.o.CHAIN.EVM&&(i=void 0),await Je.Z.getMyTokensWithBalance({address:s,caipNetwork:i})},async fetchTokensFromExchange(){if(!o.selectedExchange)return[];const t=await mt(o.selectedExchange.id),e=Object.values(t.assets).flat();return await Promise.all(e.map(async s=>{const i=ft(s),{chainNamespace:a}=v.C.parseCaipNetworkId(i.chainId);let r=i.address;if(D.w.isCaipAddress(r)){const{address:I}=v.C.parseCaipAddress(r);r=I}const d=await C.$.getImageByToken(r??"",a).catch(()=>{});return i.iconUrl=d??"",i}))},async fetchTokens({caipAddress:t,caipNetwork:e,namespace:n}){try{o.isFetchingTokenBalances=!0;const a=await(!!o.selectedExchange?this.fetchTokensFromExchange():this.fetchTokensFromEOA({caipAddress:t,caipNetwork:e,namespace:n}));o.tokenBalances={...o.tokenBalances,[n]:a}}catch(s){const i=s instanceof Error?s.message:"Unable to get token balances";E.P.showError(i)}finally{o.isFetchingTokenBalances=!1}},async fetchQuote({amount:t,address:e,sourceToken:n,toToken:s,recipient:i}){try{l.resetQuoteState(),o.isFetchingQuote=!0;const a=await dt({amount:t,address:o.selectedExchange?void 0:e,sourceToken:n,toToken:s,recipient:i});if(o.selectedExchange){const r=be(a);if(r){const d=`${n.network}:${r.deposit.receiver}`,I=S.S.formatNumber(r.deposit.amount,{decimals:n.metadata.decimals??0,round:8});await l.generateExchangeUrlForQuote({exchangeId:o.selectedExchange.id,paymentAsset:n,amount:I.toString(),recipient:d})}}o.quote=a}catch(a){let r=q.UNABLE_TO_GET_QUOTE;if(a instanceof Error&&a.cause&&a.cause instanceof Response)try{const d=await a.cause.json();d.error&&typeof d.error=="string"&&(r=d.error)}catch{}throw o.quoteError=r,E.P.showError(r),new y(h.UNABLE_TO_GET_QUOTE)}finally{o.isFetchingQuote=!1}},async fetchQuoteStatus({requestId:t}){try{if(t===Te){const n=o.selectedExchange,s=o.exchangeSessionId;if(n&&s){switch((await this.getBuyStatus(n.id,s)).status){case"IN_PROGRESS":o.quoteStatus="waiting";break;case"SUCCESS":o.quoteStatus="success",o.isPaymentInProgress=!1;break;case"FAILED":o.quoteStatus="failure",o.isPaymentInProgress=!1;break;case"UNKNOWN":o.quoteStatus="waiting";break;default:o.quoteStatus="waiting";break}return}o.quoteStatus="success";return}const{status:e}=await pt({requestId:t});o.quoteStatus=e}catch{throw o.quoteStatus="failure",new y(h.UNABLE_TO_GET_QUOTE_STATUS)}},initiatePayment(){o.isPaymentInProgress=!0,o.paymentId=crypto.randomUUID()},initializeAnalytics(){o.analyticsSet||(o.analyticsSet=!0,this.subscribeKey("isPaymentInProgress",t=>{if(o.currentPayment?.status&&o.currentPayment.status!=="UNKNOWN"){const e={IN_PROGRESS:"PAY_INITIATED",SUCCESS:"PAY_SUCCESS",FAILED:"PAY_ERROR"}[o.currentPayment.status];re.E.sendEvent({type:"track",event:e,properties:{message:o.currentPayment.status==="FAILED"?D.w.parseError(o.error):void 0,source:"pay",paymentId:o.paymentId||Pe,configuration:{network:o.paymentAsset.network,asset:o.paymentAsset.asset,recipient:o.recipient,amount:o.amount},currentPayment:{type:o.currentPayment.type,exchangeId:o.currentPayment.exchangeId,sessionId:o.currentPayment.sessionId,result:o.currentPayment.result}}})}}))},async prepareTokenLogo(){if(!o.paymentAsset.metadata.logoURI)try{const{chainNamespace:t}=v.C.parseCaipNetworkId(o.paymentAsset.network),e=await C.$.getImageByToken(o.paymentAsset.asset,t);o.paymentAsset.metadata.logoURI=e}catch{}}},At=(0,f.AH)` 2 wui-separator { 3 margin: var(--apkt-spacing-3) calc(var(--apkt-spacing-3) * -1) var(--apkt-spacing-2) 4 calc(var(--apkt-spacing-3) * -1); 5 width: calc(100% + var(--apkt-spacing-3) * 2); 6 } 7 8 .token-display { 9 padding: var(--apkt-spacing-3) var(--apkt-spacing-3); 10 border-radius: var(--apkt-borderRadius-5); 11 background-color: var(--apkt-tokens-theme-backgroundPrimary); 12 margin-top: var(--apkt-spacing-3); 13 margin-bottom: var(--apkt-spacing-3); 14 } 15 16 .token-display wui-text { 17 text-transform: none; 18 } 19 20 wui-loading-spinner { 21 padding: var(--apkt-spacing-2); 22 } 23 24 .left-image-container { 25 position: relative; 26 justify-content: center;
27 align-items: center; 28 } 29 30 .token-image { 31 border-radius: ${({borderRadius:t})=>t.round}; 32 width: 40px; 33 height: 40px; 34 } 35 36 .chain-image { 37 position: absolute; 38 width: 20px; 39 height: 20px; 40 bottom: -3px; 41 right: -5px; 42 border-radius: ${({borderRadius:t})=>t.round}; 43 border: 2px solid ${({tokens:t})=>t.theme.backgroundPrimary}; 44 } 45 46 .payment-methods-container { 47 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 48 border-top-right-radius: ${({borderRadius:t})=>t[8]}; 49 border-top-left-radius: ${({borderRadius:t})=>t[8]}; 50 } 51`;var _=c(function(t,e,n,s){var i=arguments.length,a=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,n,s);else for(var d=t.length-1;d>=0;d--)(r=t[d])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},"__decorate");let U=(Y=class extends u.WF{constructor(){super(),this.unsubscribe=[],this.amount=l.state.amount,this.namespace=void 0,this.paymentAsset=l.state.paymentAsset,this.activeConnectorIds=T.a.state.activeConnectorIds,this.caipAddress=void 0,this.exchanges=l.state.exchanges,this.isLoading=l.state.isLoading,this.initializeNamespace(),this.unsubscribe.push(l.subscribeKey("amount",e=>this.amount=e)),this.unsubscribe.push(T.a.subscribeKey("activeConnectorIds",e=>this.activeConnectorIds=e)),this.unsubscribe.push(l.subscribeKey("exchanges",e=>this.exchanges=e)),this.unsubscribe.push(l.subscribeKey("isLoading",e=>this.isLoading=e)),l.fetchExchanges(),l.setSelectedExchange(void 0)}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return(0,u.qy)` 52 <wui-flex flexDirection="column"> 53 ${this.paymentDetailsTemplate()} ${this.paymentMethodsTemplate()} 54 </wui-flex> 55 `}paymentMethodsTemplate(){return(0,u.qy)` 56 <wui-flex flexDirection="column" padding="3" gap="2" class="payment-methods-container"> 57 ${this.payWithWalletTemplate()} ${this.templateSeparator()} 58 ${this.templateExchangeOptions()} 59 </wui-flex> 60 `}initializeNamespace(){const e=g.W.state.activeChain;this.namespace=e,this.caipAddress=g.W.getAccountData(e)?.caipAddress,this.unsubscribe.push(g.W.subscribeChainProp("accountState",n=>{this.caipAddress=n?.caipAddress},e))}paymentDetailsTemplate(){const n=g.W.getAllRequestedCaipNetworks().find(s=>s.caipNetworkId===this.paymentAsset.network);return(0,u.qy)` 61 <wui-flex 62 alignItems="center" 63 justifyContent="space-between" 64 .padding=${["6","8","6","8"]} 65 gap="2" 66 > 67 <wui-flex alignItems="center" gap="1"> 68 <wui-text variant="h1-regular" color="primary"> 69 ${ue(this.amount||"0")} 70 </wui-text> 71 72 <wui-flex flexDirection="column"> 73 <wui-text variant="h6-regular" color="secondary"> 74 ${this.paymentAsset.metadata.symbol||"Unknown"} 75 </wui-text> 76 <wui-text variant="md-medium" color="secondary" 77 >on ${n?.name||"Unknown"}</wui-text 78 > 79 </wui-flex> 80 </wui-flex> 81 82 <wui-flex class="left-image-container"> 83 <wui-image 84 src=${(0,x.J)(this.paymentAsset.metadata.logoURI)} 85 class="token-image" 86 ></wui-image> 87 <wui-image 88 src=${(0,x.J)(C.$.getNetworkImage(n))} 89 class="chain-image" 90 ></wui-image> 91 </wui-flex> 92 </wui-flex> 93 `}payWithWalletTemplate(){return wt(this.paymentAsset.network)?this.caipAddress?this.connectedWalletTemplate():this.disconnectedWalletTemplate():(0,u.qy)``}connectedWalletTemplate(){const{name:e,image:n}=this.getWalletProperties({namespace:this.namespace});return(0,u.qy)` 94 <wui-flex flexDirection="column" gap="3"> 95 <wui-list-item 96 type="secondary" 97 boxColor="foregroundSecondary" 98 @click=${this.onWalletPayment} 99 .boxed=${!1} 100 ?chevron=${!0} 101 ?fullSize=${!1} 102 ?rounded=${!0} 103 data-testid="wallet-payment-option" 104 imageSrc=${(0,x.J)(n)} 105 imageSize="3xl" 106 > 107 <wui-text variant="lg-regular" color="primary">Pay with ${e}</wui-text> 108 </wui-list-item> 109 110 <wui-list-item 111 type="secondary" 112 icon="power" 113 iconColor="error" 114 @click=${this.onDisconnect} 115 data-testid="disconnect-button" 116 ?chevron=${!1} 117 boxColor="foregroundSecondary" 118 > 119 <wui-text variant="lg-regular" color="secondary">Disconnect</wui-text> 120 </wui-list-item> 121 </wui-flex> 122 `}disconnectedWalletTemplate(){return(0,u.qy)`<wui-list-item 123 type="secondary" 124 boxColor="foregroundSecondary" 125 variant="icon" 126 iconColor="default" 127 iconVariant="overlay" 128 icon="wallet" 129 @click=${this.onWalletPayment} 130 ?chevron=${!0} 131 data-testid="wallet-payment-option" 132 > 133 <wui-text variant="lg-regular" color="primary">Pay with wallet</wui-text> 134 </wui-list-item>`}templateExchangeOptions(){if(this.isLoading)return(0,u.qy)`<wui-flex justifyContent="center" alignItems="center"> 135 <wui-loading-spinner size="md"></wui-loading-spinner> 136 </wui-flex>`;const e=this.exchanges.filter(n=>xt(this.paymentAsset)?n.id===qe:n.id!==qe);return e.length===0?(0,u.qy)`<wui-flex justifyContent="center" alignItems="center"> 137 <wui-text variant="md-medium" color="primary">No exchanges available</wui-text> 138 </wui-flex>`:e.map(n=>(0,u.qy)` 139 <wui-list-item 140 type="secondary" 141 boxColor="foregroundSecondary" 142 @click=${()=>this.onExchangePayment(n)}
143 data-testid="exchange-option-${n.id}" 144 ?chevron=${!0} 145 imageSrc=${(0,x.J)(n.imageUrl)} 146 > 147 <wui-text flexGrow="1" variant="lg-regular" color="primary"> 148 Pay with ${n.name} 149 </wui-text> 150 </wui-list-item> 151 `)}templateSeparator(){return(0,u.qy)`<wui-separator text="or" bgColor="secondary"></wui-separator>`}async onWalletPayment(){if(!this.namespace)throw new Error("Namespace not found");this.caipAddress?W.I.push("PayQuote"):(await T.a.connect(),await M.W.open({view:"PayQuote"}))}onExchangePayment(e){l.setSelectedExchange(e),W.I.push("PayQuote")}async onDisconnect(){try{await A.x.disconnect(),await M.W.open({view:"Pay"})}catch{console.error("Failed to disconnect"),E.P.showError("Failed to disconnect")}}getWalletProperties({namespace:e}){if(!e)return{name:void 0,image:void 0};const n=this.activeConnectorIds[e];if(!n)return{name:void 0,image:void 0};const s=T.a.getConnector({id:n,namespace:e});if(!s)return{name:void 0,image:void 0};const i=C.$.getConnectorImage(s);return{name:s.name,image:i}}},c(Y,"W3mPayView2"),Y);U.styles=At,_([(0,m.wk)()],U.prototype,"amount",void 0),_([(0,m.wk)()],U.prototype,"namespace",void 0),_([(0,m.wk)()],U.prototype,"paymentAsset",void 0),_([(0,m.wk)()],U.prototype,"activeConnectorIds",void 0),_([(0,m.wk)()],U.prototype,"caipAddress",void 0),_([(0,m.wk)()],U.prototype,"exchanges",void 0),_([(0,m.wk)()],U.prototype,"isLoading",void 0),U=_([(0,f.EM)("w3m-pay-view")],U);var je=p(12282),Ge=p(76315),vt=p(16515),It=p(19540);const Nt=(0,Ge.AH)` 152 :host { 153 display: inline-flex; 154 align-items: center; 155 justify-content: center; 156 } 157 158 .pulse-container { 159 position: relative; 160 width: var(--pulse-size); 161 height: var(--pulse-size); 162 display: flex; 163 align-items: center; 164 justify-content: center; 165 } 166 167 .pulse-rings { 168 position: absolute; 169 inset: 0; 170 pointer-events: none; 171 } 172 173 .pulse-ring { 174 position: absolute; 175 inset: 0; 176 border-radius: 50%; 177 border: 2px solid var(--pulse-color); 178 opacity: 0; 179 animation: pulse var(--pulse-duration, 2s) ease-out infinite; 180 } 181 182 .pulse-content { 183 position: relative; 184 z-index: 1; 185 display: flex; 186 align-items: center; 187 justify-content: center; 188 } 189 190 @keyframes pulse { 191 0% { 192 transform: scale(0.5); 193 opacity: var(--pulse-opacity, 0.3); 194 } 195 50% { 196 opacity: calc(var(--pulse-opacity, 0.3) * 0.5); 197 } 198 100% { 199 transform: scale(1.2); 200 opacity: 0; 201 } 202 } 203`;var z=c(function(t,e,n,s){var i=arguments.length,a=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,n,s);else for(var d=t.length-1;d>=0;d--)(r=t[d])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},"wui_pulse_decorate");const St=3,Pt=2,Tt=.3,Ct="200px",kt={"accent-primary":Ge.f.tokens.core.backgroundAccentPrimary};let F=(Q=class extends u.WF{constructor(){super(...arguments),this.rings=St,this.duration=Pt,this.opacity=Tt,this.size=Ct,this.variant="accent-primary"}render(){const e=kt[this.variant];this.style.cssText=` 204 --pulse-size: ${this.size}; 205 --pulse-duration: ${this.duration}s; 206 --pulse-color: ${e}; 207 --pulse-opacity: ${this.opacity}; 208 `;const n=Array.from({length:this.rings},(s,i)=>this.renderRing(i,this.rings));return(0,u.qy)` 209 <div class="pulse-container"> 210 <div class="pulse-rings">${n}</div> 211 <div class="pulse-content"> 212 <slot></slot> 213 </div> 214 </div> 215 `}renderRing(e,n){const i=`animation-delay: ${e/n*this.duration}s;`;return(0,u.qy)`<div class="pulse-ring" style=${i}></div>`}},c(Q,"WuiPulse2"),Q);F.styles=[vt.W5,Nt],z([(0,m.MZ)({type:Number})],F.prototype,"rings",void 0),z([(0,m.MZ)({type:Number})],F.prototype,"duration",void 0),z([(0,m.MZ)({type:Number})],F.prototype,"opacity",void 0),z([(0,m.MZ)()],F.prototype,"size",void 0),z([(0,m.MZ)()],F.prototype,"variant",void 0),F=z([(0,It.E)("wui-pulse")],F);const ze=[{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"}],He=["success","submitted","failure","timeout","refund"],$t=(0,f.AH)` 216 :host { 217 display: block; 218 height: 100%; 219 width: 100%; 220 } 221 222 wui-image { 223 border-radius: ${({borderRadius:t})=>t.round}; 224 } 225 226 .token-badge-container { 227 position: absolute; 228 bottom: 6px; 229 left: 50%; 230 transform: translateX(-50%); 231 border-radius: ${({borderRadius:t})=>t[4]}; 232 z-index: 3; 233 min-width: 105px; 234 } 235 236 .token-badge-container.loading { 237 background-color: ${({tokens:t})=>t.theme.backgroundPrimary}; 238 border: 3px solid ${({tokens:t})=>t.theme.backgroundPrimary}; 239 } 240 241 .token-badge-container.success { 242 background-color: ${({tokens:t})=>t.theme.backgroundPrimary}; 243 border: 3px solid ${({tokens:t})=>t.theme.backgroundPrimary}; 244 } 245 246 .token-image-container { 247 position: relative; 248 } 249 250 .token-image { 251 border-radius: ${({borderRadius:t})=>t.round}; 252 width: 64px; 253 height: 64px; 254 } 255 256 .token-image.success { 257 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 258 } 259 260 .token-image.error { 261 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 262 } 263 264 .token-image.loading { 265 background: ${({colors:t})=>t.accent010}; 266 } 267 268 .token-image wui-icon { 269 width: 32px; 270 height: 32px; 271 } 272 273 .token-badge { 274 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 275 border: 1px solid ${({tokens:t})=>t.theme.foregroundSecondary}; 276 border-radius: ${({borderRadius:t})=>t[4]}; 277 } 278 279 .token-badge wui-text { 280 white-space: nowrap; 281 } 282 283 .payment-lifecycle-container { 284 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 285 border-top-right-radius: ${({borderRadius:t})=>t[6]}; 286 border-top-left-radius: ${({borderRadius:t})=>t[6]}; 287 } 288 289 .payment-step-badge { 290 padding: ${({spacing:t})=>t[1]} ${({spacing:t})=>t[2]}; 291 border-radius: ${({borderRadius:t})=>t[1]}; 292 } 293 294 .payment-step-badge.loading { 295 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 296 } 297 298 .payment-step-badge.error { 299 background-color: ${({tokens:t})=>t.core.backgroundError}; 300 } 301 302 .payment-step-badge.success { 303 background-color: ${({tokens:t})=>t.core.backgroundSuccess}; 304 } 305 306 .step-icon-container { 307 position: relative; 308 height: 40px; 309 width: 40px; 310 border-radius: ${({borderRadius:t})=>t.round}; 311 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 312 } 313 314 .step-icon-box { 315 position: absolute; 316 right: -4px; 317 bottom: -1px; 318 padding: 2px; 319 border-radius: ${({borderRadius:t})=>t.round}; 320 border: 2px solid ${({tokens:t})=>t.theme.backgroundPrimary}; 321 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 322 } 323 324 .step-icon-box.success { 325 background-color: ${({tokens:t})=>t.core.backgroundSuccess}; 326 } 327`;var R=c(function(t,e,n,s){var i=arguments.length,a=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,n,s);else for(var d=t.length-1;d>=0;
327d--)(r=t[d])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},"w3m_pay_loading_view_decorate");const Ut={received:["pending","success","submitted"],processing:["success","submitted"],sending:["success","submitted"]},Rt=3e3;let P=(V=class extends u.WF{constructor(){super(),this.unsubscribe=[],this.pollingInterval=null,this.paymentAsset=l.state.paymentAsset,this.quoteStatus=l.state.quoteStatus,this.quote=l.state.quote,this.amount=l.state.amount,this.namespace=void 0,this.caipAddress=void 0,this.profileName=null,this.activeConnectorIds=T.a.state.activeConnectorIds,this.selectedExchange=l.state.selectedExchange,this.initializeNamespace(),this.unsubscribe.push(l.subscribeKey("quoteStatus",e=>this.quoteStatus=e),l.subscribeKey("quote",e=>this.quote=e),T.a.subscribeKey("activeConnectorIds",e=>this.activeConnectorIds=e),l.subscribeKey("selectedExchange",e=>this.selectedExchange=e))}connectedCallback(){super.connectedCallback(),this.startPolling()}disconnectedCallback(){super.disconnectedCallback(),this.stopPolling(),this.unsubscribe.forEach(e=>e())}render(){return(0,u.qy)` 328 <wui-flex flexDirection="column" .padding=${["3","0","0","0"]} gap="2"> 329 ${this.tokenTemplate()} ${this.paymentTemplate()} ${this.paymentLifecycleTemplate()} 330 </wui-flex> 331 `}tokenTemplate(){const e=ue(this.amount||"0"),n=this.paymentAsset.metadata.symbol??"Unknown",i=g.W.getAllRequestedCaipNetworks().find(d=>d.caipNetworkId===this.paymentAsset.network),a=this.quoteStatus==="failure"||this.quoteStatus==="timeout"||this.quoteStatus==="refund";return this.quoteStatus==="success"||this.quoteStatus==="submitted"?(0,u.qy)`<wui-flex alignItems="center" justifyContent="center"> 332 <wui-flex justifyContent="center" alignItems="center" class="token-image success"> 333 <wui-icon name="checkmark" color="success" size="inherit"></wui-icon> 334 </wui-flex> 335 </wui-flex>`:a?(0,u.qy)`<wui-flex alignItems="center" justifyContent="center"> 336 <wui-flex justifyContent="center" alignItems="center" class="token-image error"> 337 <wui-icon name="close" color="error" size="inherit"></wui-icon> 338 </wui-flex> 339 </wui-flex>`:(0,u.qy)` 340 <wui-flex alignItems="center" justifyContent="center"> 341 <wui-flex class="token-image-container"> 342 <wui-pulse size="125px" rings="3" duration="4" opacity="0.5" variant="accent-primary"> 343 <wui-flex justifyContent="center" alignItems="center" class="token-image loading"> 344 <wui-icon name="paperPlaneTitle" color="accent-primary" size="inherit"></wui-icon> 345 </wui-flex> 346 </wui-pulse> 347 348 <wui-flex 349 justifyContent="center" 350 alignItems="center" 351 class="token-badge-container loading" 352 > 353 <wui-flex 354 alignItems="center" 355 justifyContent="center" 356 gap="01" 357 padding="1" 358 class="token-badge" 359 > 360 <wui-image 361 src=${(0,x.J)(C.$.getNetworkImage(i))} 362 class="chain-image" 363 size="mdl" 364 ></wui-image> 365 366 <wui-text variant="lg-regular" color="primary">${e} ${n}</wui-text> 367 </wui-flex> 368 </wui-flex> 369 </wui-flex> 370 </wui-flex> 371 `}paymentTemplate(){return(0,u.qy)` 372 <wui-flex flexDirection="column" gap="2" .padding=${["0","6","0","6"]}> 373 ${this.renderPayment()} 374 <wui-separator></wui-separator> 375 ${this.renderWallet()} 376 </wui-flex> 377 `}paymentLifecycleTemplate(){const e=this.getStepsWithStatus();return(0,u.qy)` 378 <wui-flex flexDirection="column" padding="4" gap="2" class="payment-lifecycle-container"> 379 <wui-flex alignItems="center" justifyContent="space-between"> 380 <wui-text variant="md-regular" color="secondary">PAYMENT CYCLE</wui-text> 381 382 ${this.renderPaymentCycleBadge()} 383 </wui-flex> 384 385 <wui-flex flexDirection="column" gap="5" .padding=${["2","0","2","0"]}> 386 ${e.map(n=>this.renderStep(n))} 387 </wui-flex> 388 </wui-flex> 389 `}renderPaymentCycleBadge(){const e=this.quoteStatus==="failure"||this.quoteStatus==="timeout"||this.quoteStatus==="refund",n=this.quoteStatus==="success"||this.quoteStatus==="submitted";if(e)return(0,u.qy)` 390 <wui-flex 391 justifyContent="center" 392 alignItems="center" 393 class="payment-step-badge error" 394 gap="1" 395 > 396 <wui-icon name="close" color="error" size="xs"></wui-icon> 397 <wui-text variant="sm-regular" color="error">Failed</wui-text> 398 </wui-flex> 399 `;if(n)return(0,u.qy)` 400 <wui-flex 401 justifyContent="center" 402 alignItems="center" 403 class="payment-step-badge success" 404 gap="1" 405 > 406 <wui-icon name="checkmark" color="success" size="xs"></wui-icon> 407 <wui-text variant="sm-regular" color="success">Completed</wui-text> 408 </wui-flex> 409 `;const s=this.quote?.timeInSeconds??0;return(0,u.qy)` 410 <wui-flex alignItems="center" justifyContent="space-between" gap="3"> 411 <wui-flex 412 justifyContent="center" 413 alignItems="center" 414 class="payment-step-badge loading" 415 gap="1" 416 > 417 <wui-icon name="clock" color="default" size="xs"></wui-icon> 418 <wui-text variant="sm-regular" color="primary">Est. ${s} sec</wui-text> 419 </wui-flex> 420 421 <wui-icon name="chevronBottom" color="default" size="xxs"></wui-icon> 422 </wui-flex> 423 `}renderPayment(){const n=g.W.getAllRequestedCaipNetworks().find(r=>{const d=this.quote?.origin.currency.network;if(!d)return!1;const{chainId:I}=v.C.parseCaipNetworkId(d);
423return $.y.isLowerCaseMatch(r.id.toString(),I.toString())}),s=S.S.formatNumber(this.quote?.origin.amount||"0",{decimals:this.quote?.origin.currency.metadata.decimals??0}).toString(),i=ue(s),a=this.quote?.origin.currency.metadata.symbol??"Unknown";return(0,u.qy)` 424 <wui-flex 425 alignItems="flex-start" 426 justifyContent="space-between" 427 .padding=${["3","0","3","0"]} 428 > 429 <wui-text variant="lg-regular" color="secondary">Payment Method</wui-text> 430 431 <wui-flex flexDirection="column" alignItems="flex-end" gap="1"> 432 <wui-flex alignItems="center" gap="01"> 433 <wui-text variant="lg-regular" color="primary">${i}</wui-text> 434 <wui-text variant="lg-regular" color="secondary">${a}</wui-text> 435 </wui-flex> 436 437 <wui-flex alignItems="center" gap="1"> 438 <wui-text variant="md-regular" color="secondary">on</wui-text> 439 <wui-image 440 src=${(0,x.J)(C.$.getNetworkImage(n))} 441 size="xs" 442 ></wui-image> 443 <wui-text variant="md-regular" color="secondary">${n?.name}</wui-text> 444 </wui-flex> 445 </wui-flex> 446 </wui-flex> 447 `}renderWallet(){return(0,u.qy)` 448 <wui-flex 449 alignItems="flex-start" 450 justifyContent="space-between" 451 .padding=${["3","0","3","0"]} 452 > 453 <wui-text variant="lg-regular" color="secondary" 454 >${this.selectedExchange?"Exchange":"Wallet"}</wui-text 455 > 456 457 ${this.renderWalletText()} 458 </wui-flex> 459 `}renderWalletText(){const{image:e}=this.getWalletProperties({namespace:this.namespace}),{address:n}=this.caipAddress?v.C.parseCaipAddress(this.caipAddress):{},s=this.selectedExchange?.name;return this.selectedExchange?(0,u.qy)` 460 <wui-flex alignItems="center" justifyContent="flex-end" gap="1"> 461 <wui-text variant="lg-regular" color="primary">${s}</wui-text> 462 <wui-image src=${(0,x.J)(this.selectedExchange.imageUrl)} size="mdl"></wui-image> 463 </wui-flex> 464 `:(0,u.qy)` 465 <wui-flex alignItems="center" justifyContent="flex-end" gap="1"> 466 <wui-text variant="lg-regular" color="primary"> 467 ${f.Zv.getTruncateString({string:this.profileName||n||s||"",charsStart:this.profileName?16:4,charsEnd:this.profileName?0:6,truncate:this.profileName?"end":"middle"})} 468 </wui-text> 469 470 <wui-image src=${(0,x.J)(e)} size="mdl"></wui-image> 471 </wui-flex> 472 `}getStepsWithStatus(){return this.quoteStatus==="failure"||this.quoteStatus==="timeout"||this.quoteStatus==="refund"?ze.map(n=>({...n,status:"failed"})):ze.map(n=>{const i=(Ut[n.id]??[]).includes(this.quoteStatus)?"completed":"pending";return{...n,status:i}})}renderStep({title:e,icon:n,status:s}){const i={"step-icon-box":!0,success:s==="completed"};return(0,u.qy)` 473 <wui-flex alignItems="center" gap="3"> 474 <wui-flex justifyContent="center" alignItems="center" class="step-icon-container"> 475 <wui-icon name=${n} color="default" size="mdl"></wui-icon> 476 477 <wui-flex alignItems="center" justifyContent="center" class=${(0,je.H)(i)}> 478 ${this.renderStatusIndicator(s)} 479 </wui-flex> 480 </wui-flex> 481 482 <wui-text variant="md-regular" color="primary">${e}</wui-text> 483 </wui-flex> 484 `}renderStatusIndicator(e){return e==="completed"?(0,u.qy)`<wui-icon size="sm" color="success" name="checkmark"></wui-icon>`:e==="failed"?(0,u.qy)`<wui-icon size="sm" color="error" name="close"></wui-icon>`:e==="pending"?(0,u.qy)`<wui-loading-spinner color="accent-primary" size="sm"></wui-loading-spinner>`:null}startPolling(){this.pollingInterval||(this.fetchQuoteStatus(),this.pollingInterval=setInterval(()=>{this.fetchQuoteStatus()},Rt))}stopPolling(){this.pollingInterval&&(clearInterval(this.pollingInterval),this.pollingInterval=null)}async fetchQuoteStatus(){const e=l.state.requestId;if(!e||He.includes(this.quoteStatus))this.stopPolling();else try{await l.fetchQuoteStatus({requestId:e}),He.includes(this.quoteStatus)&&this.stopPolling()}catch{this.stopPolling()}}initializeNamespace(){const e=g.W.state.activeChain;this.namespace=e,this.caipAddress=g.W.getAccountData(e)?.caipAddress,this.profileName=g.W.getAccountData(e)?.profileName??null,this.unsubscribe.push(g.W.subscribeChainProp("accountState",n=>{this.caipAddress=n?.caipAddress,this.profileName=n?.profileName??null},e))}getWalletProperties({namespace:e}){if(!e)return{name:void 0,image:void 0};const n=this.activeConnectorIds[e];if(!n)return{name:void 0,image:void 0};const s=T.a.getConnector({id:n,namespace:e});if(!s)return{name:void 0,image:void 0};const i=C.$.getConnectorImage(s);return{name:s.name,image:i}}}
484,c(V,"W3mPayLoadingView2"),V);P.styles=$t,R([(0,m.wk)()],P.prototype,"paymentAsset",void 0),R([(0,m.wk)()],P.prototype,"quoteStatus",void 0),R([(0,m.wk)()],P.prototype,"quote",void 0),R([(0,m.wk)()],P.prototype,"amount",void 0),R([(0,m.wk)()],P.prototype,"namespace",void 0),R([(0,m.wk)()],P.prototype,"caipAddress",void 0),R([(0,m.wk)()],P.prototype,"profileName",void 0),R([(0,m.wk)()],P.prototype,"activeConnectorIds",void 0),R([(0,m.wk)()],P.prototype,"selectedExchange",void 0),P=R([(0,f.EM)("w3m-pay-loading-view")],P);var xn=p(45551),bn=p(9220);const Ot=(0,u.AH)` 485 :host { 486 display: block; 487 } 488`;var Dt=c(function(t,e,n,s){var i=arguments.length,a=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,n,s);else for(var d=t.length-1;d>=0;d--)(r=t[d])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},"w3m_pay_fees_skeleton_decorate");let Ce=(K=class extends u.WF{render(){return(0,u.qy)` 489 <wui-flex flexDirection="column" gap="4"> 490 <wui-flex alignItems="center" justifyContent="space-between"> 491 <wui-text variant="md-regular" color="secondary">Pay</wui-text> 492 <wui-shimmer width="60px" height="16px" borderRadius="4xs" variant="light"></wui-shimmer> 493 </wui-flex> 494 495 <wui-flex alignItems="center" justifyContent="space-between"> 496 <wui-text variant="md-regular" color="secondary">Network Fee</wui-text> 497 498 <wui-flex flexDirection="column" alignItems="flex-end" gap="2"> 499 <wui-shimmer 500 width="75px" 501 height="16px" 502 borderRadius="4xs" 503 variant="light" 504 ></wui-shimmer> 505 506 <wui-flex alignItems="center" gap="01"> 507 <wui-shimmer width="14px" height="14px" rounded variant="light"></wui-shimmer> 508 <wui-shimmer 509 width="49px" 510 height="14px" 511 borderRadius="4xs" 512 variant="light" 513 ></wui-shimmer> 514 </wui-flex> 515 </wui-flex> 516 </wui-flex> 517 518 <wui-flex alignItems="center" justifyContent="space-between"> 519 <wui-text variant="md-regular" color="secondary">Service Fee</wui-text> 520 <wui-shimmer width="75px" height="16px" borderRadius="4xs" variant="light"></wui-shimmer> 521 </wui-flex> 522 </wui-flex> 523 `}},c(K,"W3mPayFeesSkeleton2"),K);Ce.styles=[Ot],Ce=Dt([(0,f.EM)("w3m-pay-fees-skeleton")],Ce);const Lt=(0,f.AH)` 524 :host { 525 display: block; 526 } 527 528 wui-image { 529 border-radius: ${({borderRadius:t})=>t.round}; 530 } 531`;var Ye=c(function(t,e,n,s){var i=arguments.length,a=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,n,s);else for(var d=t.length-1;d>=0;d--)(r=t[d])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},"w3m_pay_fees_decorate");let de=(J=class extends u.WF{constructor(){super(),this.unsubscribe=[],this.quote=l.state.quote,this.unsubscribe.push(l.subscribeKey("quote",e=>this.quote=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const e=S.S.formatNumber(this.quote?.origin.amount||"0",{decimals:this.quote?.origin.currency.metadata.decimals??0,round:6}).toString();return(0,u.qy)` 532 <wui-flex flexDirection="column" gap="4"> 533 <wui-flex alignItems="center" justifyContent="space-between"> 534 <wui-text variant="md-regular" color="secondary">Pay</wui-text> 535 <wui-text variant="md-regular" color="primary"> 536 ${e} ${this.quote?.origin.currency.metadata.symbol||"Unknown"} 537 </wui-text> 538 </wui-flex> 539 540 ${this.quote&&this.quote.fees.length>0?this.quote.fees.map(n=>this.renderFee(n)):null} 541 </wui-flex> 542 `}renderFee(e){const n=e.id==="network",s=S.S.formatNumber(e.amount||"0",{decimals:e.currency.metadata.decimals??0,round:6}).toString();if(n){const a=g.W.getAllRequestedCaipNetworks().find(r=>$.y.isLowerCaseMatch(r.caipNetworkId,e.currency.network));return(0,u.qy)` 543 <wui-flex alignItems="center" justifyContent="space-between"> 544 <wui-text variant="md-regular" color="secondary">${e.label}</wui-text> 545 546 <wui-flex flexDirection="column" alignItems="flex-end" gap="2"> 547 <wui-text variant="md-regular" color="primary"> 548 ${s} ${e.currency.metadata.symbol||"Unknown"} 549 </wui-text> 550 551 <wui-flex alignItems="center" gap="01"> 552 <wui-image 553 src=${(0,x.J)(C.$.getNetworkImage(a))} 554 size="xs" 555 ></wui-image> 556 <wui-text variant="sm-regular" color="secondary"> 557 ${a?.name||"Unknown"} 558 </wui-text> 559 </wui-flex> 560 </wui-flex> 561 </wui-flex> 562 `}return(0,u.qy)` 563 <wui-flex alignItems="center" justifyContent="space-between"> 564 <wui-text variant="md-regular" color="secondary">${e.label}</wui-text> 565 <wui-text variant="md-regular" color="primary"> 566 ${s} ${e.currency.metadata.symbol||"Unknown"} 567 </wui-text> 568 </wui-flex> 569 `}},c(J,"W3mPayFees2"),J);de.styles=[Lt],Ye([(0,m.wk)()],de.prototype,"quote",void 0),de=Ye([(0,f.EM)("w3m-pay-fees")],de);const qt=(0,f.AH)` 570 :host { 571 display: block; 572 width: 100%; 573 } 574 575 .disabled-container { 576 padding: ${({spacing:t})=>t[2]}; 577 min-height: 168px; 578 } 579 580 wui-icon { 581 width: ${({spacing:t})=>t[8]}; 582 height: ${({spacing:t})=>t[8]}; 583 } 584 585 wui-flex > wui-text { 586 max-width: 273px; 587 } 588`;var Qe=c(function(t,e,n,s){var i=arguments.length,a=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,n,s);else for(var d=t.length-1;d>=0;
588d--)(r=t[d])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},"w3m_pay_options_empty_decorate");let pe=(Z=class extends u.WF{constructor(){super(),this.unsubscribe=[],this.selectedExchange=l.state.selectedExchange,this.unsubscribe.push(l.subscribeKey("selectedExchange",e=>this.selectedExchange=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const e=!!this.selectedExchange;return(0,u.qy)` 589 <wui-flex 590 flexDirection="column" 591 alignItems="center" 592 justifyContent="center" 593 gap="3" 594 class="disabled-container" 595 > 596 <wui-icon name="coins" color="default" size="inherit"></wui-icon> 597 598 <wui-text variant="md-regular" color="primary" align="center"> 599 You don't have enough funds to complete this transaction 600 </wui-text> 601 602 ${e?null:(0,u.qy)`<wui-button 603 size="md" 604 variant="neutral-secondary" 605 @click=${this.dispatchConnectOtherWalletEvent.bind(this)} 606 >Connect other wallet</wui-button 607 >`} 608 </wui-flex> 609 `}dispatchConnectOtherWalletEvent(){this.dispatchEvent(new CustomEvent("connectOtherWallet",{detail:!0,bubbles:!0,composed:!0}))}},c(Z,"W3mPayOptionsEmpty2"),Z);pe.styles=[qt],Qe([(0,m.MZ)({type:Array})],pe.prototype,"selectedExchange",void 0),pe=Qe([(0,f.EM)("w3m-pay-options-empty")],pe);const _t=(0,f.AH)` 610 :host { 611 display: block; 612 width: 100%; 613 } 614 615 .pay-options-container { 616 max-height: 196px; 617 overflow-y: auto; 618 overflow-x: hidden; 619 scrollbar-width: none; 620 } 621 622 .pay-options-container::-webkit-scrollbar {
623 display: none; 624 } 625 626 .pay-option-container { 627 border-radius: ${({borderRadius:t})=>t[4]}; 628 padding: ${({spacing:t})=>t[3]}; 629 min-height: 60px; 630 } 631 632 .token-images-container { 633 position: relative; 634 justify-content: center; 635 align-items: center; 636 } 637 638 .chain-image { 639 position: absolute; 640 bottom: -3px; 641 right: -5px; 642 border: 2px solid ${({tokens:t})=>t.theme.foregroundSecondary}; 643 } 644`;var Ft=c(function(t,e,n,s){var i=arguments.length,a=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,n,s);else for(var d=t.length-1;d>=0;d--)(r=t[d])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},"w3m_pay_options_skeleton_decorate");let ke=(X=class extends u.WF{render(){return(0,u.qy)` 645 <wui-flex flexDirection="column" gap="2" class="pay-options-container"> 646 ${this.renderOptionEntry()} ${this.renderOptionEntry()} ${this.renderOptionEntry()} 647 </wui-flex> 648 `}renderOptionEntry(){return(0,u.qy)` 649 <wui-flex 650 alignItems="center" 651 justifyContent="space-between" 652 gap="2" 653 class="pay-option-container" 654 > 655 <wui-flex alignItems="center" gap="2"> 656 <wui-flex class="token-images-container"> 657 <wui-shimmer 658 width="32px" 659 height="32px" 660 rounded 661 variant="light" 662 class="token-image" 663 ></wui-shimmer> 664 <wui-shimmer 665 width="16px" 666 height="16px" 667 rounded 668 variant="light" 669 class="chain-image" 670 ></wui-shimmer> 671 </wui-flex> 672 673 <wui-flex flexDirection="column" gap="1"> 674 <wui-shimmer 675 width="74px" 676 height="16px" 677 borderRadius="4xs" 678 variant="light" 679 ></wui-shimmer> 680 <wui-shimmer 681 width="46px" 682 height="14px" 683 borderRadius="4xs" 684 variant="light" 685 ></wui-shimmer> 686 </wui-flex> 687 </wui-flex> 688 </wui-flex> 689 `}},c(X,"W3mPayOptionsSkeleton2"),X);ke.styles=[_t],ke=Ft([(0,f.EM)("w3m-pay-options-skeleton")],ke);const Wt=(0,f.AH)` 690 :host { 691 display: block; 692 width: 100%; 693 } 694 695 .pay-options-container { 696 max-height: 196px; 697 overflow-y: auto; 698 overflow-x: hidden; 699 scrollbar-width: none; 700 mask-image: var(--options-mask-image); 701 -webkit-mask-image: var(--options-mask-image); 702 } 703 704 .pay-options-container::-webkit-scrollbar {
705 display: none; 706 } 707 708 .pay-option-container { 709 cursor: pointer; 710 border-radius: ${({borderRadius:t})=>t[4]}; 711 padding: ${({spacing:t})=>t[3]}; 712 transition: background-color ${({durations:t})=>t.lg} 713 ${({easings:t})=>t["ease-out-power-1"]}; 714 will-change: background-color; 715 } 716 717 .token-images-container { 718 position: relative; 719 justify-content: center; 720 align-items: center; 721 } 722 723 .token-image { 724 border-radius: ${({borderRadius:t})=>t.round}; 725 width: 32px; 726 height: 32px; 727 } 728 729 .chain-image { 730 position: absolute; 731 width: 16px; 732 height: 16px; 733 bottom: -3px; 734 right: -5px; 735 border-radius: ${({borderRadius:t})=>t.round}; 736 border: 2px solid ${({tokens:t})=>t.theme.backgroundPrimary}; 737 } 738 739 @media (hover: hover) and (pointer: fine) { 740 .pay-option-container:hover { 741 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 742 } 743 } 744`;var me=c(function(t,e,n,s){var i=arguments.length,a=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,n,s);else for(var d=t.length-1;d>=0;d--)(r=t[d])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},"w3m_pay_options_decorate");const Mt=300;let H=(ee=class extends u.WF{constructor(){super(),this.unsubscribe=[],this.options=[],this.selectedPaymentAsset=null}disconnectedCallback(){this.unsubscribe.forEach(n=>n()),this.resizeObserver?.disconnect(),this.shadowRoot?.querySelector(".pay-options-container")?.removeEventListener("scroll",this.handleOptionsListScroll.bind(this))}firstUpdated(){const e=this.shadowRoot?.querySelector(".pay-options-container");e&&(requestAnimationFrame(this.handleOptionsListScroll.bind(this)),e?.addEventListener("scroll",this.handleOptionsListScroll.bind(this)),this.resizeObserver=new ResizeObserver(()=>{this.handleOptionsListScroll()}),this.resizeObserver?.observe(e),this.handleOptionsListScroll())}render(){return(0,u.qy)` 745 <wui-flex flexDirection="column" gap="2" class="pay-options-container"> 746 ${this.options.map(e=>this.payOptionTemplate(e))} 747 </wui-flex> 748 `}payOptionTemplate(e){const{network:n,metadata:s,asset:i,amount:a="0"}=e,d=g.W.getAllRequestedCaipNetworks().find(Oe=>Oe.caipNetworkId===n),I=`${n}:${i}`,L=`${this.selectedPaymentAsset?.network}:${this.selectedPaymentAsset?.asset}`,ne=I===L,j=S.S.bigNumber(a,{safe:!0}),ce=j.gt(0);return(0,u.qy)` 749 <wui-flex 750 alignItems="center" 751 justifyContent="space-between" 752 gap="2" 753 @click=${()=>this.onSelect?.(e)} 754 class="pay-option-container" 755 > 756 <wui-flex alignItems="center" gap="2"> 757 <wui-flex class="token-images-container"> 758 <wui-image 759 src=${(0,x.J)(s.logoURI)} 760 class="token-image" 761 size="3xl" 762 ></wui-image> 763 <wui-image 764 src=${(0,x.J)(C.$.getNetworkImage(d))} 765 class="chain-image" 766 size="md" 767 ></wui-image> 768 </wui-flex> 769 770 <wui-flex flexDirection="column" gap="1"> 771 <wui-text variant="lg-regular" color="primary">${s.symbol}</wui-text> 772 ${ce?(0,u.qy)`<wui-text variant="sm-regular" color="secondary"> 773 ${j.round(6).toString()} ${s.symbol} 774 </wui-text>`:null} 775 </wui-flex> 776 </wui-flex> 777 778 ${ne?(0,u.qy)`<wui-icon name="checkmark" size="md" color="success"></wui-icon>`:null} 779 </wui-flex> 780 `}handleOptionsListScroll(){const e=this.shadowRoot?.querySelector(".pay-options-container");if(!e)return;e.scrollHeight>Mt?(e.style.setProperty("--options-mask-image",`linear-gradient( 781 to bottom, 782 rgba(0, 0, 0, calc(1 - var(--options-scroll--top-opacity))) 0px, 783 rgba(200, 200, 200, calc(1 - var(--options-scroll--top-opacity))) 1px, 784 black 50px, 785 black calc(100% - 50px), 786 rgba(155, 155, 155, calc(1 - var(--options-scroll--bottom-opacity))) calc(100% - 1px), 787 rgba(0, 0, 0, calc(1 - var(--options-scroll--bottom-opacity))) 100% 788 )`),e.style.setProperty("--options-scroll--top-opacity",f.z8.interpolate([0,50],[0,1],e.scrollTop).toString()),e.style.setProperty("--options-scroll--bottom-opacity",f.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"))}},c(ee,"W3mPayOptions2"),ee);H.styles=[Wt],me([(0,m.MZ)({type:Array})],H.prototype,"options",void 0),me([(0,m.MZ)()],H.prototype,"selectedPaymentAsset",void 0),me([(0,m.MZ)()],H.prototype,"onSelect",void 0),H=me([(0,f.EM)("w3m-pay-options")],H);const Bt=(0,f.AH)` 789 .payment-methods-container { 790 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 791 border-top-right-radius: ${({borderRadius:t})=>t[5]}; 792 border-top-left-radius: ${({borderRadius:t})=>t[5]}; 793 } 794 795 .pay-options-container { 796 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 797 border-radius: ${({borderRadius:t})=>t[5]}; 798 padding: ${({spacing:t})=>t[1]}; 799 } 800 801 w3m-tooltip-trigger { 802 display: flex; 803 align-items: center; 804 justify-content: center; 805 max-width: fit-content; 806 } 807 808 wui-image { 809 border-radius: ${({borderRadius:t})=>t.round}; 810 } 811 812 w3m-pay-options.disabled { 813 opacity: 0.5; 814 pointer-events: none; 815 } 816`;var N=c(function(t,e,n,s){var i=arguments.length,a=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,n):s,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,n,s);else for(var d=t.length-1;d>=0;
816d--)(r=t[d])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},"w3m_pay_quote_view_decorate");const he={eip155:"ethereum",solana:"solana",bip122:"bitcoin",ton:"ton"},jt={eip155:{icon:he.eip155,label:"EVM"},solana:{icon:he.solana,label:"Solana"},bip122:{icon:he.bip122,label:"Bitcoin"},ton:{icon:he.ton,label:"Ton"}};let b=(te=class extends u.WF{constructor(){super(),this.unsubscribe=[],this.profileName=null,this.paymentAsset=l.state.paymentAsset,this.namespace=void 0,this.caipAddress=void 0,this.amount=l.state.amount,this.recipient=l.state.recipient,this.activeConnectorIds=T.a.state.activeConnectorIds,this.selectedPaymentAsset=l.state.selectedPaymentAsset,this.selectedExchange=l.state.selectedExchange,this.isFetchingQuote=l.state.isFetchingQuote,this.quoteError=l.state.quoteError,this.quote=l.state.quote,this.isFetchingTokenBalances=l.state.isFetchingTokenBalances,this.tokenBalances=l.state.tokenBalances,this.isPaymentInProgress=l.state.isPaymentInProgress,this.exchangeUrlForQuote=l.state.exchangeUrlForQuote,this.completedTransactionsCount=0,this.unsubscribe.push(l.subscribeKey("paymentAsset",e=>this.paymentAsset=e)),this.unsubscribe.push(l.subscribeKey("tokenBalances",e=>this.onTokenBalancesChanged(e))),this.unsubscribe.push(l.subscribeKey("isFetchingTokenBalances",e=>this.isFetchingTokenBalances=e)),this.unsubscribe.push(T.a.subscribeKey("activeConnectorIds",e=>this.activeConnectorIds=e)),this.unsubscribe.push(l.subscribeKey("selectedPaymentAsset",e=>this.selectedPaymentAsset=e)),this.unsubscribe.push(l.subscribeKey("isFetchingQuote",e=>this.isFetchingQuote=e)),this.unsubscribe.push(l.subscribeKey("quoteError",e=>this.quoteError=e)),this.unsubscribe.push(l.subscribeKey("quote",e=>this.quote=e)),this.unsubscribe.push(l.subscribeKey("amount",e=>this.amount=e)),this.unsubscribe.push(l.subscribeKey("recipient",e=>this.recipient=e)),this.unsubscribe.push(l.subscribeKey("isPaymentInProgress",e=>this.isPaymentInProgress=e)),this.unsubscribe.push(l.subscribeKey("selectedExchange",e=>this.selectedExchange=e)),this.unsubscribe.push(l.subscribeKey("exchangeUrlForQuote",e=>this.exchangeUrlForQuote=e)),this.resetQuoteState(),this.initializeNamespace(),this.fetchTokens()}disconnectedCallback(){super.disconnectedCallback(),this.resetAssetsState(),this.unsubscribe.forEach(e=>e())}updated(e){super.updated(e),e.has("selectedPaymentAsset")&&this.fetchQuote()}render(){return(0,u.qy)` 817 <wui-flex flexDirection="column"> 818 ${this.profileTemplate()} 819 820 <wui-flex 821 flexDirection="column" 822 gap="4" 823 class="payment-methods-container" 824 .padding=${["4","4","5","4"]} 825 > 826 ${this.paymentOptionsViewTemplate()} ${this.amountWithFeeTemplate()} 827 828 <wui-flex 829 alignItems="center" 830 justifyContent="space-between" 831 .padding=${["1","0","1","0"]} 832 > 833 <wui-separator></wui-separator> 834 </wui-flex> 835 836 ${this.paymentActionsTemplate()} 837 </wui-flex> 838 </wui-flex> 839 `}profileTemplate(){if(this.selectedExchange){const r=S.S.formatNumber(this.quote?.origin.amount,{decimals:this.quote?.origin.currency.metadata.decimals??0}).toString();return(0,u.qy)` 840 <wui-flex 841 .padding=${["4","3","4","3"]} 842 alignItems="center" 843 justifyContent="space-between" 844 gap="2" 845 > 846 <wui-text variant="lg-regular" color="secondary">Paying with</wui-text> 847 848 ${this.quote?(0,u.qy)`<wui-text variant="lg-regular" color="primary"> 849 ${S.S.bigNumber(r,{safe:!0}).round(6).toString()} 850 ${this.quote.origin.currency.metadata.symbol} 851 </wui-text>`:(0,u.qy)`<wui-shimmer width="80px" height="18px" variant="light"></wui-shimmer>`} 852 </wui-flex> 853 `}const e=D.w.getPlainAddress(this.caipAddress)??"",{name:n,image:s}=this.getWalletProperties({namespace:this.namespace}),{icon:i,label:a}=jt[this.namespace]??{};return(0,u.qy)` 854 <wui-flex 855 .padding=${["4","3","4","3"]} 856 alignItems="center" 857 justifyContent="space-between" 858 gap="2" 859 > 860 <wui-wallet-switch
861 profileName=${(0,x.J)(this.profileName)} 862 address=${(0,x.J)(e)} 863 imageSrc=${(0,x.J)(s)} 864 alt=${(0,x.J)(n)} 865 @click=${this.onConnectOtherWallet.bind(this)} 866 data-testid="wui-wallet-switch" 867 ></wui-wallet-switch> 868 869 <wui-wallet-switch 870 profileName=${(0,x.J)(a)} 871 address=${(0,x.J)(e)} 872 icon=${(0,x.J)(i)} 873 iconSize="xs" 874 .enableGreenCircle=${!1} 875 alt=${(0,x.J)(a)} 876 @click=${this.onConnectOtherWallet.bind(this)} 877 data-testid="wui-wallet-switch" 878 ></wui-wallet-switch> 879 </wui-flex> 880 `}initializeNamespace(){const e=g.W.state.activeChain;this.namespace=e,this.caipAddress=g.W.getAccountData(e)?.caipAddress,this.profileName=g.W.getAccountData(e)?.profileName??null,this.unsubscribe.push(g.W.subscribeChainProp("accountState",n=>this.onAccountStateChanged(n),e))}async fetchTokens(){if(this.namespace){let e;if(this.caipAddress){const{chainId:n,chainNamespace:s}=v.C.parseCaipAddress(this.caipAddress),i=`${s}:${n}`;e=g.W.getAllRequestedCaipNetworks().find(r=>r.caipNetworkId===i)}await l.fetchTokens({caipAddress:this.caipAddress,caipNetwork:e,namespace:this.namespace})}}fetchQuote(){if(this.amount&&this.recipient&&this.selectedPaymentAsset&&this.paymentAsset){const{address:e}=this.caipAddress?v.C.parseCaipAddress(this.caipAddress):{};l.fetchQuote({amount:this.amount.toString(),address:e,sourceToken:this.selectedPaymentAsset,toToken:this.paymentAsset,recipient:this.recipient})}}getWalletProperties({namespace:e}){if(!e)return{name:void 0,image:void 0};const n=this.activeConnectorIds[e];if(!n)return{name:void 0,image:void 0};const s=T.a.getConnector({id:n,namespace:e});if(!s)return{name:void 0,image:void 0};const i=C.$.getConnectorImage(s);return{name:s.name,image:i}}paymentOptionsViewTemplate(){return(0,u.qy)` 881 <wui-flex flexDirection="column" gap="2"> 882 <wui-text variant="sm-regular" color="secondary">CHOOSE PAYMENT OPTION</wui-text> 883 <wui-flex class="pay-options-container">${this.paymentOptionsTemplate()}</wui-flex> 884 </wui-flex> 885 `}paymentOptionsTemplate(){const e=this.getPaymentAssetFromTokenBalances();if(this.isFetchingTokenBalances)return(0,u.qy)`<w3m-pay-options-skeleton></w3m-pay-options-skeleton>`;if(e.length===0)return(0,u.qy)`<w3m-pay-options-empty 886 @connectOtherWallet=${this.onConnectOtherWallet.bind(this)} 887 ></w3m-pay-options-empty>`;const n={disabled:this.isFetchingQuote};return(0,u.qy)`<w3m-pay-options 888 class=${(0,je.H)(n)} 889 .options=${e} 890 .selectedPaymentAsset=${(0,x.J)(this.selectedPaymentAsset)} 891 .onSelect=${this.onSelectedPaymentAssetChanged.bind(this)} 892 ></w3m-pay-options>`}amountWithFeeTemplate(){return this.isFetchingQuote||!this.selectedPaymentAsset||this.quoteError?(0,u.qy)`<w3m-pay-fees-skeleton></w3m-pay-fees-skeleton>`:(0,u.qy)`<w3m-pay-fees></w3m-pay-fees>`}paymentActionsTemplate(){const e=this.isFetchingQuote||this.isFetchingTokenBalances,n=this.isFetchingQuote||this.isFetchingTokenBalances||!this.selectedPaymentAsset||!!this.quoteError,s=S.S.formatNumber(this.quote?.origin.amount??0,{decimals:this.quote?.origin.currency.metadata.decimals??0}).toString();return this.selectedExchange?e||n?(0,u.qy)` 893 <wui-shimmer width="100%" height="48px" variant="light" ?rounded=${!0}></wui-shimmer> 894 `:(0,u.qy)`<wui-button 895 size="lg" 896 fullWidth 897 variant="accent-secondary" 898 @click=${this.onPayWithExchange.bind(this)} 899 > 900 ${`Continue in ${this.selectedExchange.name}`} 901 902 <wui-icon name="arrowRight" color="inherit" size="sm" slot="iconRight"></wui-icon> 903 </wui-button>`:(0,u.qy)` 904 <wui-flex alignItems="center" justifyContent="space-between"> 905 <wui-flex flexDirection="column" gap="1"> 906 <wui-text variant="md-regular" color="secondary">Order Total</wui-text> 907 908 ${e||n?(0,u.qy)`<wui-shimmer width="58px" height="32px" variant="light"></wui-shimmer>`:(0,u.qy)`<wui-flex alignItems="center" gap="01"> 909 <wui-text variant="h4-regular" color="primary">${ue(s)}</wui-text> 910 911 <wui-text variant="lg-regular" color="secondary"> 912 ${this.quote?.origin.currency.metadata.symbol||"Unknown"} 913 </wui-text> 914 </wui-flex>`} 915 </wui-flex> 916 917 ${this.actionButtonTemplate({isLoading:e,isDisabled:n})} 918 </wui-flex> 919 `}actionButtonTemplate(e){const n=Ee(this.quote),{isLoading:s,isDisabled:i}=e;let a="Pay";return n.length>1&&this.completedTransactionsCount===0&&(a="Approve"),(0,u.qy)` 920 <wui-button 921 size="lg" 922 variant="accent-primary" 923 ?loading=${s||this.isPaymentInProgress} 924 ?disabled=${i||this.isPaymentInProgress} 925 @click=${()=>{n.length>0?this.onSendTransactions():this.onTransfer()}} 926 > 927 ${a} 928 ${s?null:(0,u.qy)`<wui-icon 929 name="arrowRight" 930 color="inherit" 931 size="sm" 932 slot="iconRight" 933 ></wui-icon>`} 934 </wui-button>
934 935 `}getPaymentAssetFromTokenBalances(){return this.namespace?(this.tokenBalances[this.namespace]??[]).map(i=>{try{return gt(i)}catch{return null}}).filter(i=>!!i).filter(i=>{const{chainId:a}=v.C.parseCaipNetworkId(i.network),{chainId:r}=v.C.parseCaipNetworkId(this.paymentAsset.network);return $.y.isLowerCaseMatch(i.asset,this.paymentAsset.asset)?!0:this.selectedExchange?!$.y.isLowerCaseMatch(a.toString(),r.toString()):!0}):[]}onTokenBalancesChanged(e){this.tokenBalances=e;const[n]=this.getPaymentAssetFromTokenBalances();n&&l.setSelectedPaymentAsset(n)}async onConnectOtherWallet(){await T.a.connect(),await M.W.open({view:"PayQuote"})}onAccountStateChanged(e){const{address:n}=this.caipAddress?v.C.parseCaipAddress(this.caipAddress):{};if(this.caipAddress=e?.caipAddress,this.profileName=e?.profileName??null,n){const{address:s}=this.caipAddress?v.C.parseCaipAddress(this.caipAddress):{};s?$.y.isLowerCaseMatch(s,n)||(this.resetAssetsState(),this.resetQuoteState(),this.fetchTokens()):M.W.close()}}onSelectedPaymentAssetChanged(e){this.isFetchingQuote||l.setSelectedPaymentAsset(e)}async onTransfer(){const e=be(this.quote);if(e){if(!$.y.isLowerCaseMatch(this.selectedPaymentAsset?.asset,e.deposit.currency))throw new Error("Quote asset is not the same as the selected payment asset");const s=this.selectedPaymentAsset?.amount??"0",i=S.S.formatNumber(e.deposit.amount,{decimals:this.selectedPaymentAsset?.metadata.decimals??0}).toString();if(!S.S.bigNumber(s).gte(i)){E.P.showError("Insufficient funds");return}if(this.quote&&this.selectedPaymentAsset&&this.caipAddress&&this.namespace){const{address:r}=v.C.parseCaipAddress(this.caipAddress);await l.onTransfer({chainNamespace:this.namespace,fromAddress:r,toAddress:e.deposit.receiver,amount:i,paymentAsset:this.selectedPaymentAsset}),l.setRequestId(e.requestId),W.I.push("PayLoading")}}}async onSendTransactions(){const e=this.selectedPaymentAsset?.amount??"0",n=S.S.formatNumber(this.quote?.origin.amount??0,{decimals:this.selectedPaymentAsset?.metadata.decimals??0}).toString();if(!S.S.bigNumber(e).gte(n)){E.P.showError("Insufficient funds");return}const i=Ee(this.quote),[a]=Ee(this.quote,this.completedTransactionsCount);a&&this.namespace&&(await l.onSendTransaction({namespace:this.namespace,transactionStep:a}),this.completedTransactionsCount+=1,this.completedTransactionsCount===i.length&&(l.setRequestId(a.requestId),W.I.push("PayLoading")))}onPayWithExchange(){if(this.exchangeUrlForQuote){const e=D.w.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!e)throw new Error("Could not create popup window");e.location.href=this.exchangeUrlForQuote;const n=be(this.quote);n&&l.setRequestId(n.requestId),l.initiatePayment(),W.I.push("PayLoading")}}resetAssetsState(){l.setSelectedPaymentAsset(null)}resetQuoteState(){l.resetQuoteState()}},c(te,"W3mPayQuoteView2"),te);b.styles=Bt,N([(0,m.wk)()],b.prototype,"profileName",void 0),N([(0,m.wk)()],b.prototype,"paymentAsset",void 0),N([(0,m.wk)()],b.prototype,"namespace",void 0),N([(0,m.wk)()],b.prototype,"caipAddress",void 0),N([(0,m.wk)()],b.prototype,"amount",void 0),N([(0,m.wk)()],b.prototype,"recipient",void 0),N([(0,m.wk)()],b.prototype,"activeConnectorIds",void 0),N([(0,m.wk)()],b.prototype,"selectedPaymentAsset",void 0),N([(0,m.wk)()],b.prototype,"selectedExchange",void 0),N([(0,m.wk)()],b.prototype,"isFetchingQuote",void 0),N([(0,m.wk)()],b.prototype,"quoteError",void 0),N([(0,m.wk)()],b.prototype,"quote",void 0),N([(0,m.wk)()],b.prototype,"isFetchingTokenBalances",void 0),N([(0,m.wk)()],b.prototype,"tokenBalances",void 0),N([(0,m.wk)()],b.prototype,"isPaymentInProgress",void 0),N([(0,m.wk)()],b.prototype,"exchangeUrlForQuote",void 0),N([(0,m.wk)()],b.prototype,"completedTransactionsCount",void 0),b=N([(0,f.EM)("w3m-pay-quote-view")],b);var $e;const Gt=3e5;async function Ve(t){return l.handleOpenPay(t)}c(Ve,"openPay");
935async function zt(t,e=Gt){if(e<=0)throw new y(h.INVALID_PAYMENT_CONFIG,"Timeout must be greater than 0");try{await Ve(t)}catch(n){throw n instanceof y?n:new y(h.UNABLE_TO_INITIATE_PAYMENT,n.message)}return new Promise((n,s)=>{let i=!1;const a=setTimeout(()=>{i||(i=!0,ne(),s(new y(h.GENERIC_PAYMENT_ERROR,"Payment timeout")))},e);function r(){if(i)return;const j=l.state.currentPayment,ce=l.state.error,Oe=l.state.isPaymentInProgress;if(j?.status==="SUCCESS"){i=!0,ne(),clearTimeout(a),n({success:!0,result:j.result});return}if(j?.status==="FAILED"){i=!0,ne(),clearTimeout(a),n({success:!1,error:ce||"Payment failed"});return}ce&&!Oe&&!j&&(i=!0,ne(),clearTimeout(a),n({success:!1,error:ce}))}c(r,"checkAndResolve");const d=Ue("currentPayment",r),I=Ue("error",r),L=Ue("isPaymentInProgress",r),ne=Kt([d,I,L]);r()})}c(zt,"pay");function En(t){return $e.getAvailableExchanges(t)}c(En,"getAvailableExchanges");function An(t,e){return $e.getPayUrl(t,e,!0)}c(An,"client_getPayUrl");function vn(t,e,n){return $e.openPayUrl({exchangeId:t,openInNewTab:n},e,!0)}c(vn,"openPayUrl");function Ht(){return l.getExchanges()}c(Ht,"client_getExchanges");function Yt(){return l.state.currentPayment?.result}c(Yt,"getPayResult");function Qt(){return l.state.error}c(Qt,"getPayError");function Vt(){return l.state.isPaymentInProgress}c(Vt,"getIsPaymentInProgress");function Ue(t,e){return l.subscribeKey(t,e)}c(Ue,"subscribeStateKey");function Kt(t){return()=>{t.forEach(e=>{try{e()}catch{}})}}c(Kt,"createCleanupHandler");const Jt={network:"eip155:8453",asset:"native",metadata:{name:"Ethereum",symbol:"ETH",decimals:18}},Zt={network:"eip155:8453",asset:"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},Xt={network:"eip155:84532",asset:"native",metadata:{name:"Ethereum",symbol:"ETH",decimals:18}},en={network:"eip155:1",asset:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},tn={network:"eip155:10",asset:"0x0b2c639c533813f4aa9d7837caf62653d097ff85",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},nn={network:"eip155:42161",asset:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},sn={network:"eip155:137",asset:"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},an={network:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",asset:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},on={network:"eip155:1",asset:"0xdAC17F958D2ee523a2206206994597C13D831ec7",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},rn={network:"eip155:10",asset:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},cn={network:"eip155:42161",asset:"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},ln={network:"eip155:137",asset:"0xc2132d05d31c914a87c6611c10748aeb04b58e8f",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},un={network:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",asset:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},dn={network:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",asset:"native",metadata:{name:"Solana",symbol:"SOL",decimals:9}}},76325(we,se,p){var f;var u=p(75826),m=p(59262),x=p(72430),T=p(50450),g=p(16515),C=p(19540),W=p(76315);const M=(0,W.AH)` 936 :host { 937 position: relative; 938 } 939 940 button { 941 display: flex; 942 justify-content: center; 943 align-items: center; 944 background-color: transparent; 945 padding: ${({spacing:w})=>w[1]}; 946 } 947 948 /* -- Colors --------------------------------------------------- */ 949 button[data-type='accent'] wui-icon { 950 color: ${({tokens:w})=>w.core.iconAccentPrimary}; 951 } 952 953 button[data-type='neutral'][data-variant='primary'] wui-icon { 954 color: ${({tokens:w})=>w.theme.iconInverse}; 955 } 956 957 button[data-type='neutral'][data-variant='secondary'] wui-icon { 958 color: ${({tokens:w})=>w.theme.iconDefault}; 959 } 960 961 button[data-type='success'] wui-icon { 962 color: ${({tokens:w})=>w.core.iconSuccess}; 963 } 964 965 button[data-type='error'] wui-icon { 966 color: ${({tokens:w})=>w.core.iconError}; 967 } 968 969 /* -- Sizes --------------------------------------------------- */ 970 button[data-size='xs'] { 971 width: 16px; 972 height: 16px; 973 974 border-radius: ${({borderRadius:w})=>w[1]}; 975 } 976 977 button[data-size='sm'] {
978 width: 20px; 979 height: 20px; 980 border-radius: ${({borderRadius:w})=>w[1]}; 981 } 982 983 button[data-size='md'] { 984 width: 24px; 985 height: 24px; 986 border-radius: ${({borderRadius:w})=>w[2]}; 987 } 988 989 button[data-size='lg'] { 990 width: 28px; 991 height: 28px; 992 border-radius: ${({borderRadius:w})=>w[2]}; 993 } 994 995 button[data-size='xs'] wui-icon { 996 width: 8px; 997 height: 8px; 998 } 999 1000 button[data-size='sm'] wui-icon { 1001 width: 12px; 1002 height: 12px; 1003 } 1004 1005 button[data-size='md'] wui-icon { 1006 width: 16px; 1007 height: 16px; 1008 } 1009 1010 button[data-size='lg'] wui-icon { 1011 width: 20px; 1012 height: 20px; 1013 } 1014 1015 /* -- Hover --------------------------------------------------- */ 1016 @media (hover: hover) { 1017 button[data-type='accent']:hover:enabled { 1018 background-color: ${({tokens:w})=>w.core.foregroundAccent010}; 1019 } 1020 1021 button[data-variant='primary'][data-type='neutral']:hover:enabled { 1022 background-color: ${({tokens:w})=>w.theme.foregroundSecondary}; 1023 } 1024 1025 button[data-variant='secondary'][data-type='neutral']:hover:enabled { 1026 background-color: ${({tokens:w})=>w.theme.foregroundSecondary}; 1027 } 1028 1029 button[data-type='success']:hover:enabled { 1030 background-color: ${({tokens:w})=>w.core.backgroundSuccess}; 1031 } 1032 1033 button[data-type='error']:hover:enabled { 1034 background-color: ${({tokens:w})=>w.core.backgroundError}; 1035 } 1036 } 1037 1038 /* -- Focus --------------------------------------------------- */ 1039 button:focus-visible { 1040 box-shadow: 0 0 0 4px ${({tokens:w})=>w.core.foregroundAccent020}; 1041 } 1042 1043 /* -- Properties --------------------------------------------------- */ 1044 button[data-full-width='true'] { 1045 width: 100%; 1046 } 1047 1048 :host([fullWidth]) { 1049 width: 100%; 1050 } 1051 1052 button[disabled] { 1053 opacity: 0.5; 1054 cursor: not-allowed; 1055 } 1056`;var A=c(function(w,B,G,ie){var ae=arguments.length,O=ae<3?B:ie===null?ie=Object.getOwnPropertyDescriptor(B,G):ie,oe;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(w,B,G,ie);else for(var le=w.length-1;le>=0;le--)(oe=w[le])&&(O=(ae<3?oe(O):ae>3?oe(B,G,O):oe(B,G))||O);return ae>3&&O&&Object.defineProperty(B,G,O),O},"__decorate");let E=(f=class extends u.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,u.qy)`<button 1057 data-variant=${this.variant} 1058 data-type=${this.type} 1059 data-size=${this.size} 1060 data-full-width=${this.fullWidth} 1061 ?disabled=${this.disabled} 1062 > 1063 <wui-icon color="inherit" name=${this.icon} size=${(0,x.J)(this.iconSize)}></wui-icon> 1064 </button>`}},c(f,"WuiIconButton2"),f);E.styles=[g.W5,g.fD,M],A([(0,m.MZ)()],E.prototype,"icon",void 0),A([(0,m.MZ)()],E.prototype,"variant",void 0),A([(0,m.MZ)()],E.prototype,"type",void 0),A([(0,m.MZ)()],E.prototype,"size",void 0),A([(0,m.MZ)()],E.prototype,"iconSize",void 0),A([(0,m.MZ)({type:Boolean})],E.prototype,"fullWidth",void 0),A([(0,m.MZ)({type:Boolean})],E.prototype,"disabled",void 0),E=A([(0,C.E)("wui-icon-button")],E)}}]);})();
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.