1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[645],{99071:function(e,t,r){r.d(t,{u:function(){return w}});var i=r(18680),o=r(87170),n=r(62250),s=r(23829),a=r(99321),c=r(3675),u=r(83944),l=r(69199),p=r(39674),d=r(46001),h=r(29607),m=r(65045);let y={paymentAsset:null,amount:0,tokenAmount:0,priceLoading:!1,error:null,exchanges:[],isLoading:!1,currentPayment:void 0,isPaymentInProgress:!1,paymentId:"",assets:[]},g=(0,i.sj)(y),w={state:g,subscribe:e=>(0,i.Ld)(g,()=>e(g)),subscribeKey:(e,t)=>(0,o.VW)(g,e,t),resetState(){Object.assign(g,{...y})},async getAssetsForNetwork(e){let t=(0,c.ec)(e),r=await w.getAssetsImageAndPrice(t),i=t.map(e=>{let t="native"===e.asset?(0,n.EO)():`${e.network}:${e.asset}`,i=r.find(e=>e.fungibles?.[0]?.address?.toLowerCase()===t.toLowerCase());return{...e,price:i?.fungibles?.[0]?.price||1,metadata:{...e.metadata,iconUrl:i?.fungibles?.[0]?.iconUrl}}});return g.assets=i,i},async getAssetsImageAndPrice(e){let t=e.map(e=>"native"===e.asset?(0,n.EO)():`${e.network}:${e.asset}`);return await Promise.all(t.map(e=>l.L.fetchTokenPrice({addresses:[e]})))},getTokenAmount(){if(!g?.paymentAsset?.price)throw Error("Cannot get token price");return Number(new Intl.NumberFormat("en-US",{minimumFractionDigits:0,maximumFractionDigits:8}).format(g.amount/g.paymentAsset.price))},setAmount(e){g.amount=e,g.paymentAsset?.price&&(g.tokenAmount=w.getTokenAmount())},setPaymentAsset(e){g.paymentAsset=e},isPayWithExchangeEnabled:()=>h.OptionsController.state.remoteFeatures?.payWithExchange||h.OptionsController.state.remoteFeatures?.payments||h.OptionsController.state.features?.pay,isPayWithExchangeSupported:()=>w.isPayWithExchangeEnabled()&&p.R.state.activeCaipNetwork&&s.bq.PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES.includes(p.R.state.activeCaipNetwork.chainNamespace),async fetchExchanges(){try{let e=w.isPayWithExchangeSupported();if(!g.paymentAsset||!e){g.exchanges=[],g.isLoading=!1;return}g.isLoading=!0;let t=await (0,c.YK)({page:0,asset:(0,c.Us)(g.paymentAsset.network,g.paymentAsset.asset),amount:g.amount.toString()});g.exchanges=t.exchanges.slice(0,2)}catch(e){throw m.SnackController.showError("Unable to get exchanges"),Error("Unable to get exchanges")}finally{g.isLoading=!1}},async getPayUrl(e,t){try{let r=Number(t.amount),i=await (0,c.kv)({exchangeId:e,asset:(0,c.Us)(t.network,t.asset),amount:r.toString(),recipient:`${t.network}:${t.recipient}`});return d.X.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:e},configuration:{network:t.network,asset:t.asset,recipient:t.recipient,amount:r},currentPayment:{type:"exchange",exchangeId:e},source:"fund-from-exchange",headless:!1}}),i}catch(e){if(e instanceof Error&&e.message.includes("is not supported"))throw Error("Asset not supported");throw Error(e.message)}},async handlePayWithExchange(e){try{if(!u.AccountController.state.address)throw Error("No account connected");if(!g.paymentAsset)throw Error("No payment asset selected");let t=a.j.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!t)throw Error("Could not create popup window");g.isPaymentInProgress=!0,g.paymentId=crypto.randomUUID(),g.currentPayment={type:"exchange",exchangeId:e};let{network:r,asset:i}=g.paymentAsset,o={network:r,asset:i,amount:g.tokenAmount,recipient:u.AccountController.state.address},n=await w.getPayUrl(e,o);if(!n){try{t.close()}catch(e){console.error("Unable to close popup window",e)}throw Error("Unable to initiate payment")}g.currentPayment.sessionId=n.sessionId,g.currentPayment.status="IN_PROGRESS",g.currentPayment.exchangeId=e,t.location.href=n.url}catch(e){g.error="Unable to initiate payment",m.SnackController.showError(g.error)}},async waitUntilComplete({exchangeId:e,sessionId:t,paymentId:r,retries:i=20}){let o=await w.getBuyStatus(e,t,r);if("SUCCESS"===o.status||"FAILED"===o.status)return o;if(0===i)throw Error("Unable to get deposit status");return await new Promise(e=>{setTimeout(e,5e3)}),w.waitUntilComplete({exchangeId:e,sessionId:t,paymentId:r,retries:i-1})},async getBuyStatus(e,t,r){try{if(!g.currentPayment)throw Error("No current payment");let i=await (0,c.Cx)({sessionId:t,exchangeId:e});return g.currentPayment.status=i.status,("SUCCESS"===i.status||"FAILED"===i.status)&&(g.currentPayment.result=i.txHash,g.isPaymentInProgress=!1,d.X.sendEvent({type:"track",event:"SUCCESS"===i.status?"PAY_SUCCESS":"PAY_ERROR",properties:{source:"fund-from-exchange",paymentId:r,configuration:{network:g.paymentAsset?.network||"",asset:g.paymentAsset?.asset||"",recipient:u.AccountController.state.address||"",amount:g.amount},currentPayment:{type:"exchange",exchangeId:g.currentPayment?.exchangeId,sessionId:g.currentPayment?.sessionId,result:i.txHash}}})),i}catch(e){return{status:"UNKNOWN",txHash:""}}},reset(){g.currentPayment=void 0,g.isPaymentInProgress=!1,g.paymentId="",g.paymentAsset=null,g.amount=0,g.tokenAmount=0,g.priceLoading=!1,g.error=null,g.exchanges=[],g.isLoading=!1}}},70645:function(e,t,r){r.r(t),r.d(t,{W3mBuyInProgressView:function(){return j},W3mFundWalletView:function(){return F},W3mOnRampProvidersView:function(){return R},W3mOnrampFiatSelectView:function(){return m},W3mOnrampTokensView:function(){return I},W3mOnrampWidget:function(){return X},W3mWhatIsABuyView:function(){return D}});var i=r(19045),o=r(94836),n=r(31756),s=r(61253),a=r(41593),c=r(13387),u=r(29607),l=r(30397),p=r(78632);r(29557),r(40135),r(22939),r(69943);var d=(0,p.iv)` 2 :host > wui-grid { 3 max-height: 360px; 4 overflow: auto; 5 } 6 7 wui-flex { 8 transition: opacity ${({easings:e})=>e["ease-out-power-1"]} 9 ${({durations:e})=>e.md}; 10 will-change: opacity; 11 } 12 13 wui-grid::-webkit-scrollbar {
14 display: none; 15 } 16 17 wui-flex.disabled { 18 opacity: 0.3; 19 pointer-events: none; 20 user-select: none; 21 } 22`,h=function(e,t,r,i){var o,n=arguments.length,s=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(n<3?o(s):n>3?o(t,r,s):o(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s};let m=class extends i.oi{constructor(){super(),this.unsubscribe=[],this.selectedCurrency=s.ph.state.paymentCurrency,this.currencies=s.ph.state.paymentCurrencies,this.currencyImages=a.W.state.currencyImages,this.checked=c.M.state.isLegalCheckboxChecked,this.unsubscribe.push(s.ph.subscribe(e=>{this.selectedCurrency=e.paymentCurrency,this.currencies=e.paymentCurrencies}),a.W.subscribeKey("currencyImages",e=>this.currencyImages=e),c.M.subscribeKey("isLegalCheckboxChecked",e=>{this.checked=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let{termsConditionsUrl:e,privacyPolicyUrl:t}=u.OptionsController.state,r=u.OptionsController.state.features?.legalCheckbox,o=!!(e||t)&&!!r&&!this.checked;return(0,i.dy)` 23 <w3m-legal-checkbox></w3m-legal-checkbox> 24 <wui-flex 25 flexDirection="column" 26 .padding=${["0","3","3","3"]} 27 gap="2" 28 class=${(0,n.o)(o?"disabled":void 0)} 29 > 30 ${this.currenciesTemplate(o)} 31 </wui-flex> 32 `}currenciesTemplate(e=!1){return this.currencies.map(t=>(0,i.dy)` 33 <wui-list-item 34 imageSrc=${(0,n.o)(this.currencyImages?.[t.id])} 35 @click=${()=>this.selectCurrency(t)} 36 variant="image" 37 tabIdx=${(0,n.o)(e?-1:void 0)} 38 > 39 <wui-text variant="md-medium" color="primary">${t.id}</wui-text> 40 </wui-list-item> 41 `)}selectCurrency(e){e&&(s.ph.setPaymentCurrency(e),l.I.close())}};m.styles=d,h([(0,o.SB)()],m.prototype,"selectedCurrency",void 0),h([(0,o.SB)()],m.prototype,"currencies",void 0),h([(0,o.SB)()],m.prototype,"currencyImages",void 0),h([(0,o.SB)()],m.prototype,"checked",void 0),m=h([(0,p.Mo)("w3m-onramp-fiat-select-view")],m);var y=r(39674),g=r(83764),w=r(99321),f=r(46001),b=r(62250),v=r(49854),x=r(35143);r(85302),r(15485),r(6551),r(59675);var C=(0,p.iv)` 42 button { 43 padding: ${({spacing:e})=>e["3"]}; 44 border-radius: ${({borderRadius:e})=>e["4"]}; 45 border: none; 46 outline: none; 47 background-color: ${({tokens:e})=>e.core.glass010}; 48 width: 100%; 49 display: flex; 50 align-items: center; 51 justify-content: flex-start; 52 gap: ${({spacing:e})=>e["3"]}; 53 transition: background-color ${({easings:e})=>e["ease-out-power-1"]} 54 ${({durations:e})=>e.md}; 55 will-change: background-color; 56 cursor: pointer; 57 } 58 59 button:hover { 60 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 61 } 62 63 .provider-image { 64 width: ${({spacing:e})=>e["10"]}; 65 min-width: ${({spacing:e})=>e["10"]}; 66 height: ${({spacing:e})=>e["10"]}; 67 border-radius: calc( 68 ${({borderRadius:e})=>e["4"]} - calc(${({spacing:e})=>e["3"]} / 2) 69 ); 70 position: relative; 71 overflow: hidden; 72 } 73 74 .network-icon { 75 width: ${({spacing:e})=>e["3"]}; 76 height: ${({spacing:e})=>e["3"]}; 77 border-radius: calc(${({spacing:e})=>e["3"]} / 2); 78 overflow: hidden; 79 box-shadow: 80 0 0 0 3px ${({tokens:e})=>e.theme.foregroundPrimary}, 81 0 0 0 3px ${({tokens:e})=>e.theme.backgroundPrimary}; 82 transition: box-shadow ${({easings:e})=>e["ease-out-power-1"]} 83 ${({durations:e})=>e.md}; 84 will-change: box-shadow; 85 } 86 87 button:hover .network-icon { 88 box-shadow: 89 0 0 0 3px ${({tokens:e})=>e.core.glass010}, 90 0 0 0 3px ${({tokens:e})=>e.theme.backgroundPrimary}; 91 } 92`,k=function(e,t,r,i){var o,n=arguments.length,s=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(n<3?o(s):n>3?o(t,r,s):o(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s};let $=class extends i.oi{constructor(){super(...arguments),this.disabled=!1,this.color="inherit",this.label="",this.feeRange="",this.loading=!1,this.onClick=null}render(){return(0,i.dy)` 93 <button ?disabled=${this.disabled} @click=${this.onClick} ontouchstart>
94 <wui-visual name=${(0,n.o)(this.name)} class="provider-image"></wui-visual> 95 <wui-flex flexDirection="column" gap="01"> 96 <wui-text variant="md-regular" color="primary">${this.label}</wui-text> 97 <wui-flex alignItems="center" justifyContent="flex-start" gap="4"> 98 <wui-text variant="sm-medium" color="primary"> 99 <wui-text variant="sm-regular" color="secondary">Fees</wui-text> 100 ${this.feeRange} 101 </wui-text> 102 <wui-flex gap="2"> 103 <wui-icon name="bank" size="sm" color="default"></wui-icon> 104 <wui-icon name="card" size="sm" color="default"></wui-icon> 105 </wui-flex> 106 ${this.networksTemplate()} 107 </wui-flex> 108 </wui-flex> 109 ${this.loading?(0,i.dy)`<wui-loading-spinner color="secondary" size="md"></wui-loading-spinner>`:(0,i.dy)`<wui-icon name="chevronRight" color="default" size="sm"></wui-icon>`} 110 </button> 111 `}networksTemplate(){let e=y.R.getAllRequestedCaipNetworks(),t=e?.filter(e=>e?.assets?.imageId)?.slice(0,5);return(0,i.dy)` 112 <wui-flex class="networks"> 113 ${t?.map(e=>i.dy` 114 <wui-flex class="network-icon"> 115 <wui-image src=${n.o(x.f.getNetworkImage(e))}></wui-image> 116 </wui-flex> 117 `)} 118 </wui-flex> 119 `}};$.styles=[C],k([(0,o.Cb)({type:Boolean})],$.prototype,"disabled",void 0),k([(0,o.Cb)()],$.prototype,"color",void 0),k([(0,o.Cb)()],$.prototype,"name",void 0),k([(0,o.Cb)()],$.prototype,"label",void 0),k([(0,o.Cb)()],$.prototype,"feeRange",void 0),k([(0,o.Cb)({type:Boolean})],$.prototype,"loading",void 0),k([(0,o.Cb)()],$.prototype,"onClick",void 0),$=k([(0,p.Mo)("w3m-onramp-provider-item")],$),r(71932);var P=function(e,t,r,i){var o,n=arguments.length,s=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(n<3?o(s):n>3?o(t,r,s):o(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s};let R=class extends i.oi{constructor(){super(),this.unsubscribe=[],this.providers=s.ph.state.providers,this.unsubscribe.push(s.ph.subscribeKey("providers",e=>{this.providers=e}))}render(){return(0,i.dy)` 120 <wui-flex flexDirection="column" .padding=${["0","3","3","3"]} gap="2"> 121 ${this.onRampProvidersTemplate()} 122 </wui-flex> 123 `}onRampProvidersTemplate(){return this.providers.filter(e=>e.supportedChains.includes(y.R.state.activeChain??"eip155")).map(e=>(0,i.dy)` 124 <w3m-onramp-provider-item 125 label=${e.label} 126 name=${e.name} 127 feeRange=${e.feeRange} 128 @click=${()=>{this.onClickProvider(e)}} 129 ?disabled=${!e.url} 130 data-testid=${`onramp-provider-${e.name}`} 131 ></w3m-onramp-provider-item> 132 `)}onClickProvider(e){s.ph.setSelectedProvider(e),g.RouterController.push("BuyInProgress"),w.j.openHref(s.ph.state.selectedProvider?.url||e.url,"popupWindow","width=600,height=800,scrollbars=yes"),f.X.sendEvent({type:"track",event:"SELECT_BUY_PROVIDER",properties:{provider:e.name,isSmartAccount:(0,b.r9)(y.R.state.activeChain)===v.y_.ACCOUNT_TYPES.SMART_ACCOUNT}})}};P([(0,o.SB)()],R.prototype,"providers",void 0),R=P([(0,p.Mo)("w3m-onramp-providers-view")],R),r(10231);var A=(0,p.iv)` 133 :host > wui-grid { 134 max-height: 360px; 135 overflow: auto; 136 } 137 138 wui-flex { 139 transition: opacity ${({easings:e})=>e["ease-out-power-1"]} 140 ${({durations:e})=>e.md}; 141 will-change: opacity; 142 } 143 144 wui-grid::-webkit-scrollbar {
145 display: none; 146 } 147 148 wui-flex.disabled { 149 opacity: 0.3; 150 pointer-events: none; 151 user-select: none; 152 } 153`,S=function(e,t,r,i){var o,n=arguments.length,s=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(n<3?o(s):n>3?o(t,r,s):o(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s};let I=class extends i.oi{constructor(){super(),this.unsubscribe=[],this.selectedCurrency=s.ph.state.purchaseCurrencies,this.tokens=s.ph.state.purchaseCurrencies,this.tokenImages=a.W.state.tokenImages,this.checked=c.M.state.isLegalCheckboxChecked,this.unsubscribe.push(s.ph.subscribe(e=>{this.selectedCurrency=e.purchaseCurrencies,this.tokens=e.purchaseCurrencies}),a.W.subscribeKey("tokenImages",e=>this.tokenImages=e),c.M.subscribeKey("isLegalCheckboxChecked",e=>{this.checked=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let{termsConditionsUrl:e,privacyPolicyUrl:t}=u.OptionsController.state,r=u.OptionsController.state.features?.legalCheckbox,o=!!(e||t)&&!!r&&!this.checked;return(0,i.dy)` 154 <w3m-legal-checkbox></w3m-legal-checkbox> 155 <wui-flex 156 flexDirection="column" 157 .padding=${["0","3","3","3"]} 158 gap="2" 159 class=${(0,n.o)(o?"disabled":void 0)} 160 > 161 ${this.currenciesTemplate(o)} 162 </wui-flex> 163 `}currenciesTemplate(e=!1){return this.tokens.map(t=>(0,i.dy)` 164 <wui-list-item 165 imageSrc=${(0,n.o)(this.tokenImages?.[t.symbol])} 166 @click=${()=>this.selectToken(t)} 167 variant="image" 168 tabIdx=${(0,n.o)(e?-1:void 0)} 169 > 170 <wui-flex gap="1" alignItems="center"> 171 <wui-text variant="md-medium" color="primary">${t.name}</wui-text> 172 <wui-text variant="sm-regular" color="secondary">${t.symbol}</wui-text> 173 </wui-flex> 174 </wui-list-item> 175 `)}selectToken(e){e&&(s.ph.setPurchaseCurrency(e),l.I.close())}};I.styles=A,S([(0,o.SB)()],I.prototype,"selectedCurrency",void 0),S([(0,o.SB)()],I.prototype,"tokens",void 0),S([(0,o.SB)()],I.prototype,"tokenImages",void 0),S([(0,o.SB)()],I.prototype,"checked",void 0),I=S([(0,p.Mo)("w3m-onramp-token-select-view")],I);var E=r(59449),O=r(35763),B=r(65045);r(86841),r(84081),r(24996),r(20960);var N=(0,p.iv)` 176 @keyframes shake { 177 0% { 178 transform: translateX(0); 179 } 180 25% { 181 transform: translateX(3px); 182 } 183 50% { 184 transform: translateX(-3px); 185 } 186 75% { 187 transform: translateX(3px); 188 } 189 100% { 190 transform: translateX(0); 191 } 192 } 193 194 wui-flex:first-child:not(:only-child) { 195 position: relative; 196 } 197 198 wui-loading-thumbnail { 199 position: absolute; 200 } 201 202 wui-visual { 203 border-radius: calc( 204 ${({borderRadius:e})=>e["1"]} * 9 - ${({borderRadius:e})=>e["3"]} 205 ); 206 position: relative; 207 overflow: hidden; 208 } 209 210 wui-icon-box { 211 position: absolute; 212 right: calc(${({spacing:e})=>e["1"]} * -1); 213 bottom: calc(${({spacing:e})=>e["1"]} * -1); 214 opacity: 0; 215 transform: scale(0.5); 216 transition: 217 opacity ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, 218 transform ${({durations:e})=>e.lg} 219 ${({easings:e})=>e["ease-out-power-2"]}; 220 will-change: opacity, transform; 221 } 222 223 wui-text[align='center'] { 224 width: 100%; 225 padding: 0px ${({spacing:e})=>e["4"]}; 226 } 227 228 [data-error='true'] wui-icon-box { 229 opacity: 1; 230 transform: scale(1); 231 } 232 233 [data-error='true'] > wui-flex:first-child { 234 animation: shake 250ms ${({easings:e})=>e["ease-out-power-2"]} both; 235 } 236 237 [data-retry='false'] wui-link { 238 display: none; 239 } 240 241 [data-retry='true'] wui-link { 242 display: block; 243 opacity: 1; 244 } 245 246 wui-link { 247 padding: ${({spacing:e})=>e["01"]} ${({spacing:e})=>e["2"]}; 248 } 249`,T=function(e,t,r,i){var o,n=arguments.length,s=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(n<3?o(s):n>3?o(t,r,s):o(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s};let j=class extends i.oi{constructor(){super(),this.unsubscribe=[],this.selectedOnRampProvider=s.ph.state.selectedProvider,this.uri=E.ConnectionController.state.wcUri,this.ready=!1,this.showRetry=!1,this.buffering=!1,this.error=!1,this.isMobile=!1,this.onRetry=void 0,this.unsubscribe.push(s.ph.subscribeKey("selectedProvider",e=>{this.selectedOnRampProvider=e}))}disconnectedCallback(){this.intervalId&&clearInterval(this.intervalId)}render(){let e="Continue in external window";this.error?e="Buy failed":this.selectedOnRampProvider&&(e=`Buy in ${this.selectedOnRampProvider?.label}`);let t=this.error?"Buy can be declined from your side or due to and error on the provider app":`Weâll notify you once your Buy is processed`;return(0,i.dy)` 250 <wui-flex 251 data-error=${(0,n.o)(this.error)} 252 data-retry=${this.showRetry} 253 flexDirection="column" 254 alignItems="center" 255 .padding=${["10","5","5","5"]} 256 gap="5" 257 > 258 <wui-flex justifyContent="center" alignItems="center"> 259 <wui-visual
260 name=${(0,n.o)(this.selectedOnRampProvider?.name)} 261 size="lg" 262 class="provider-image" 263 > 264 </wui-visual> 265 266 ${this.error?null:this.loaderTemplate()} 267 268 <wui-icon-box 269 color="error" 270 icon="close" 271 size="sm" 272 border 273 borderColor="wui-color-bg-125" 274 ></wui-icon-box> 275 </wui-flex> 276 277 <wui-flex 278 flexDirection="column" 279 alignItems="center" 280 gap="2" 281 .padding=${["4","0","0","0"]} 282 > 283 <wui-text variant="md-medium" color=${this.error?"error":"primary"}> 284 ${e} 285 </wui-text> 286 <wui-text align="center" variant="sm-medium" color="secondary">${t}</wui-text> 287 </wui-flex> 288 289 ${this.error?this.tryAgainTemplate():null} 290 </wui-flex> 291 292 <wui-flex .padding=${["0","5","5","5"]} justifyContent="center"> 293 <wui-link @click=${this.onCopyUri} color="secondary"> 294 <wui-icon size="sm" color="default" slot="iconLeft" name="copy"></wui-icon> 295 Copy link 296 </wui-link> 297 </wui-flex> 298 `}onTryAgain(){this.selectedOnRampProvider&&(this.error=!1,w.j.openHref(this.selectedOnRampProvider.url,"popupWindow","width=600,height=800,scrollbars=yes"))}tryAgainTemplate(){return this.selectedOnRampProvider?.url?(0,i.dy)`<wui-button size="md" variant="accent" @click=${this.onTryAgain.bind(this)}> 299 <wui-icon color="inherit" slot="iconLeft" name="refresh"></wui-icon> 300 Try again 301 </wui-button>`:null}loaderTemplate(){let e=O.ThemeController.state.themeVariables["--w3m-border-radius-master"],t=e?parseInt(e.replace("px",""),10):4;return(0,i.dy)`<wui-loading-thumbnail radius=${9*t}></wui-loading-thumbnail>`}onCopyUri(){if(!this.selectedOnRampProvider?.url){B.SnackController.showError("No link found"),g.RouterController.goBack();return}try{w.j.copyToClopboard(this.selectedOnRampProvider.url),B.SnackController.showSuccess("Link copied")}catch{B.SnackController.showError("Failed to copy")}}};j.styles=N,T([(0,o.SB)()],j.prototype,"intervalId",void 0),T([(0,o.SB)()],j.prototype,"selectedOnRampProvider",void 0),T([(0,o.SB)()],j.prototype,"uri",void 0),T([(0,o.SB)()],j.prototype,"ready",void 0),T([(0,o.SB)()],j.prototype,"showRetry",void 0),T([(0,o.SB)()],j.prototype,"buffering",void 0),T([(0,o.SB)()],j.prototype,"error",void 0),T([(0,o.Cb)({type:Boolean})],j.prototype,"isMobile",void 0),T([(0,o.Cb)()],j.prototype,"onRetry",void 0),j=T([(0,p.Mo)("w3m-buy-in-progress-view")],j);let D=class extends i.oi{render(){return(0,i.dy)` 302 <wui-flex 303 flexDirection="column" 304 .padding=${["6","10","5","10"]} 305 alignItems="center" 306 gap="5" 307 > 308 <wui-visual name="onrampCard"></wui-visual> 309 <wui-flex flexDirection="column" gap="2" alignItems="center"> 310 <wui-text align="center" variant="md-medium" color="primary"> 311 Quickly and easily buy digital assets! 312 </wui-text> 313 <wui-text align="center" variant="sm-regular" color="secondary"> 314 Simply select your preferred onramp provider and add digital assets to your account 315 using your credit card or bank transfer 316 </wui-text> 317 </wui-flex> 318 <wui-button @click=${g.RouterController.goBack}> 319 <wui-icon size="sm" color="inherit" name="add" slot="iconLeft"></wui-icon> 320 Buy 321 </wui-button> 322 </wui-flex> 323 `}};D=function(e,t,r,i){var o,n=arguments.length,s=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(n<3?o(s):n>3?o(t,r,s):o(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s}([(0,p.Mo)("w3m-what-is-a-buy-view")],D);var W=r(99071),L=r(23829),U=function(e,t,r,i){var o,n=arguments.length,s=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(n<3?o(s):n>3?o(t,r,s):o(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s};let F=class extends i.oi{constructor(){super(),this.unsubscribe=[],this.activeCaipNetwork=y.R.state.activeCaipNetwork,this.features=u.OptionsController.state.features,this.remoteFeatures=u.OptionsController.state.remoteFeatures,this.exchangesLoading=W.u.state.isLoading,this.exchanges=W.u.state.exchanges,this.unsubscribe.push(u.OptionsController.subscribeKey("features",e=>this.features=e),u.OptionsController.subscribeKey("remoteFeatures",e=>this.remoteFeatures=e),y.R.subscribeKey("activeCaipNetwork",e=>{this.activeCaipNetwork=e,this.setDefaultPaymentAsset()}),W.u.subscribeKey("isLoading",e=>this.exchangesLoading=e),W.u.subscribeKey("exchanges",e=>this.exchanges=e))}
323disconnectedCallback(){this.unsubscribe.forEach(e=>e())}async firstUpdated(){W.u.isPayWithExchangeSupported()&&(await this.setDefaultPaymentAsset(),await W.u.fetchExchanges())}render(){return(0,i.dy)` 324 <wui-flex flexDirection="column" .padding=${["1","3","3","3"]} gap="2"> 325 ${this.onrampTemplate()} ${this.receiveTemplate()} ${this.depositFromExchangeTemplate()} 326 </wui-flex> 327 `}async setDefaultPaymentAsset(){if(!this.activeCaipNetwork)return;let e=await W.u.getAssetsForNetwork(this.activeCaipNetwork.caipNetworkId),t=e.find(e=>"USDC"===e.metadata.symbol)||e[0];t&&W.u.setPaymentAsset(t)}onrampTemplate(){if(!this.activeCaipNetwork)return null;let e=this.remoteFeatures?.onramp,t=L.bq.ONRAMP_SUPPORTED_CHAIN_NAMESPACES.includes(this.activeCaipNetwork.chainNamespace);return e&&t?(0,i.dy)` 328 <wui-list-item 329 @click=${this.onBuyCrypto.bind(this)} 330 icon="card" 331 data-testid="wallet-features-onramp-button" 332 > 333 <wui-text variant="lg-regular" color="primary">Buy crypto</wui-text> 334 </wui-list-item> 335 `:null}depositFromExchangeTemplate(){return this.activeCaipNetwork&&W.u.isPayWithExchangeSupported()?(0,i.dy)` 336 <wui-list-item 337 @click=${this.onDepositFromExchange.bind(this)} 338 icon="download" 339 data-testid="wallet-features-deposit-from-exchange-button" 340 ?loading=${this.exchangesLoading} 341 ?disabled=${this.exchangesLoading||!this.exchanges.length} 342 > 343 <wui-text variant="lg-regular" color="primary">Deposit from exchange</wui-text> 344 </wui-list-item> 345 `:null}receiveTemplate(){return this.features?.receive?(0,i.dy)` 346 <wui-list-item 347 @click=${this.onReceive.bind(this)} 348 icon="qrCode" 349 data-testid="wallet-features-receive-button" 350 > 351 <wui-text variant="lg-regular" color="primary">Receive funds</wui-text> 352 </wui-list-item> 353 `:null}onBuyCrypto(){g.RouterController.push("OnRampProviders")}onReceive(){g.RouterController.push("WalletReceive")}onDepositFromExchange(){g.RouterController.push("PayWithExchange")}};U([(0,o.SB)()],F.prototype,"activeCaipNetwork",void 0),U([(0,o.SB)()],F.prototype,"features",void 0),U([(0,o.SB)()],F.prototype,"remoteFeatures",void 0),U([(0,o.SB)()],F.prototype,"exchangesLoading",void 0),U([(0,o.SB)()],F.prototype,"exchanges",void 0),F=U([(0,p.Mo)("w3m-fund-wallet-view")],F),r(75026);var _=(0,p.iv)` 354 :host { 355 width: 100%; 356 } 357 358 wui-loading-spinner { 359 position: absolute; 360 top: 50%; 361 right: 20px; 362 transform: translateY(-50%); 363 } 364 365 .currency-container { 366 position: absolute; 367 top: 50%; 368 transform: translateY(-50%); 369 right: ${({spacing:e})=>e["2"]}; 370 height: 40px; 371 padding: ${({spacing:e})=>e["2"]} ${({spacing:e})=>e["2"]} 372 ${({spacing:e})=>e["2"]} ${({spacing:e})=>e["2"]}; 373 min-width: 95px; 374 border-radius: ${({borderRadius:e})=>e.round}; 375 border: 1px solid ${({tokens:e})=>e.theme.foregroundPrimary}; 376 background: ${({tokens:e})=>e.theme.foregroundPrimary}; 377 cursor: pointer; 378 } 379 380 .currency-container > wui-image { 381 height: 24px; 382 width: 24px; 383 border-radius: 50%; 384 } 385`,M=function(e,t,r,i){var o,n=arguments.length,s=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(n<3?o(s):n>3?o(t,r,s):o(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s};let K=class extends i.oi{constructor(){super(),this.unsubscribe=[],this.type="Token",this.value=0,this.currencies=[],this.selectedCurrency=this.currencies?.[0],this.currencyImages=a.W.state.currencyImages,this.tokenImages=a.W.state.tokenImages,this.unsubscribe.push(s.ph.subscribeKey("purchaseCurrency",e=>{e&&"Fiat"!==this.type&&(this.selectedCurrency=this.formatPurchaseCurrency(e))}),s.ph.subscribeKey("paymentCurrency",e=>{e&&"Token"!==this.type&&(this.selectedCurrency=this.formatPaymentCurrency(e))}),s.ph.subscribe(e=>{"Fiat"===this.type?this.currencies=e.purchaseCurrencies.map(this.formatPurchaseCurrency):this.currencies=e.paymentCurrencies.map(this.formatPaymentCurrency)}),a.W.subscribe(e=>{this.currencyImages={...e.currencyImages},this.tokenImages={...e.tokenImages}}))}firstUpdated(){s.ph.getAvailableCurrencies()}
385disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let e=this.selectedCurrency?.symbol||"",t=this.currencyImages[e]||this.tokenImages[e];return(0,i.dy)`<wui-input-text type="number" size="lg" value=${this.value}> 386 ${this.selectedCurrency?(0,i.dy)` <wui-flex 387 class="currency-container" 388 justifyContent="space-between" 389 alignItems="center" 390 gap="1" 391 @click=${()=>l.I.open({view:`OnRamp${this.type}Select`})} 392 > 393 <wui-image src=${(0,n.o)(t)}></wui-image> 394 <wui-text color="primary">${this.selectedCurrency.symbol}</wui-text> 395 </wui-flex>`:(0,i.dy)`<wui-loading-spinner></wui-loading-spinner>`} 396 </wui-input-text>`}formatPaymentCurrency(e){return{name:e.id,symbol:e.id}}formatPurchaseCurrency(e){return{name:e.name,symbol:e.symbol}}};K.styles=_,M([(0,o.Cb)({type:String})],K.prototype,"type",void 0),M([(0,o.Cb)({type:Number})],K.prototype,"value",void 0),M([(0,o.SB)()],K.prototype,"currencies",void 0),M([(0,o.SB)()],K.prototype,"selectedCurrency",void 0),M([(0,o.SB)()],K.prototype,"currencyImages",void 0),M([(0,o.SB)()],K.prototype,"tokenImages",void 0),K=M([(0,p.Mo)("w3m-onramp-input")],K);var z=(0,p.iv)` 397 :host > wui-flex { 398 width: 100%; 399 max-width: 360px; 400 } 401 402 :host > wui-flex > wui-flex { 403 border-radius: ${({borderRadius:e})=>e["8"]}; 404 width: 100%; 405 } 406 407 .amounts-container { 408 width: 100%; 409 } 410`,q=function(e,t,r,i){var o,n=arguments.length,s=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(n<3?o(s):n>3?o(t,r,s):o(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s};let H={USD:"$",EUR:"â¬",GBP:"\xa3"},V=[100,250,500,1e3],X=class extends i.oi{constructor(){super(),this.unsubscribe=[],this.disabled=!1,this.caipAddress=y.R.state.activeCaipAddress,this.loading=l.I.state.loading,this.paymentCurrency=s.ph.state.paymentCurrency,this.paymentAmount=s.ph.state.paymentAmount,this.purchaseAmount=s.ph.state.purchaseAmount,this.quoteLoading=s.ph.state.quotesLoading,this.unsubscribe.push(y.R.subscribeKey("activeCaipAddress",e=>this.caipAddress=e),l.I.subscribeKey("loading",e=>{this.loading=e}),s.ph.subscribe(e=>{this.paymentCurrency=e.paymentCurrency,this.paymentAmount=e.paymentAmount,this.purchaseAmount=e.purchaseAmount,this.quoteLoading=e.quotesLoading}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return(0,i.dy)` 411 <wui-flex flexDirection="column" justifyContent="center" alignItems="center"> 412 <wui-flex flexDirection="column" alignItems="center" gap="2"> 413 <w3m-onramp-input 414 type="Fiat" 415 @inputChange=${this.onPaymentAmountChange.bind(this)} 416 .value=${this.paymentAmount||0} 417 ></w3m-onramp-input> 418 <w3m-onramp-input 419 type="Token" 420 .value=${this.purchaseAmount||0} 421 .loading=${this.quoteLoading} 422 ></w3m-onramp-input> 423 <wui-flex justifyContent="space-evenly" class="amounts-container" gap="2"> 424 ${V.map(e=>(0,i.dy)`<wui-button 425 variant=${this.paymentAmount===e?"accent-secondary":"neutral-secondary"} 426 size="md" 427 textVariant="md-medium" 428 fullWidth 429 @click=${()=>this.selectPresetAmount(e)} 430 >${`${H[this.paymentCurrency?.id||"USD"]} ${e}`}</wui-button 431 >`)} 432 </wui-flex> 433 ${this.templateButton()} 434 </wui-flex> 435 </wui-flex> 436 `}templateButton(){return this.caipAddress?(0,i.dy)`<wui-button 437 @click=${this.getQuotes.bind(this)} 438 variant="accent-primary" 439 fullWidth 440 size="lg" 441 borderRadius="xs" 442 > 443 Get quotes 444 </wui-button>`:(0,i.dy)`<wui-button 445 @click=${this.openModal.bind(this)} 446 variant="accent" 447 fullWidth 448 size="lg" 449 borderRadius="xs" 450 > 451 Connect wallet 452 </wui-button>
452`}getQuotes(){this.loading||l.I.open({view:"OnRampProviders"})}openModal(){l.I.open({view:"Connect"})}async onPaymentAmountChange(e){s.ph.setPaymentAmount(Number(e.detail)),await s.ph.getQuote()}async selectPresetAmount(e){s.ph.setPaymentAmount(e),await s.ph.getQuote()}};X.styles=z,q([(0,o.Cb)({type:Boolean})],X.prototype,"disabled",void 0),q([(0,o.SB)()],X.prototype,"caipAddress",void 0),q([(0,o.SB)()],X.prototype,"loading",void 0),q([(0,o.SB)()],X.prototype,"paymentCurrency",void 0),q([(0,o.SB)()],X.prototype,"paymentAmount",void 0),q([(0,o.SB)()],X.prototype,"purchaseAmount",void 0),q([(0,o.SB)()],X.prototype,"quoteLoading",void 0),X=q([(0,p.Mo)("w3m-onramp-widget")],X)},15485:function(e,t,r){r(79086)}}]);
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.