@imtbl/sdk 1.30.0-alpha.1 → 1.30.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/blockchain_data.js +2 -2
  2. package/dist/browser/checkout/{BridgeWidget-b488c49c.js → BridgeWidget-2a670c8a.js} +1 -1
  3. package/dist/browser/checkout/{HorizontalMenu-94558d7e.js → HorizontalMenu-b27619a9.js} +1 -1
  4. package/dist/browser/checkout/{OnRampWidget-cf3dad47.js → OnRampWidget-4a764ba3.js} +1 -1
  5. package/dist/browser/checkout/{SaleWidget-e68a74b5.js → SaleWidget-bd87c96c.js} +1 -1
  6. package/dist/browser/checkout/{SpendingCapHero-277a2aed.js → SpendingCapHero-fbde4158.js} +1 -1
  7. package/dist/browser/checkout/{SwapWidget-f1c4e02c.js → SwapWidget-73986871.js} +1 -1
  8. package/dist/browser/checkout/{TopUpView-0bcbc762.js → TopUpView-49db4e0c.js} +1 -1
  9. package/dist/browser/checkout/{WalletWidget-d302dc44.js → WalletWidget-9af01453.js} +1 -1
  10. package/dist/browser/checkout/{auto-track-f9611a2a.js → auto-track-fe6fb084.js} +1 -1
  11. package/dist/browser/checkout/{balance-3d411bbd.js → balance-11636d12.js} +1 -1
  12. package/dist/browser/checkout/{index-adcf7b3e.js → index-376396ce.js} +1 -1
  13. package/dist/browser/checkout/{index-0662954f.js → index-72581709.js} +1 -1
  14. package/dist/browser/checkout/{index-4da0c2bb.js → index-9493d2b3.js} +2 -2
  15. package/dist/browser/checkout/{index-3db0886f.js → index-be1e7f3b.js} +1 -1
  16. package/dist/browser/checkout/{index-266a0a59.js → index-dc45bf6b.js} +1 -1
  17. package/dist/browser/checkout/{index-d9350375.js → index-e2a7040c.js} +1 -1
  18. package/dist/browser/checkout/{index-939bb675.js → index-ea3db59e.js} +1 -1
  19. package/dist/browser/checkout/index-f4000748.js +1 -0
  20. package/dist/browser/checkout/{index.umd-4ad5ee36.js → index.umd-44a60fe6.js} +1 -1
  21. package/dist/browser/checkout/{retry-cd8de993.js → retry-427ffe34.js} +1 -1
  22. package/dist/browser/checkout/sdk.js +4 -4
  23. package/dist/browser/checkout/widgets-esm.js +1 -1
  24. package/dist/browser/checkout/widgets.js +1 -1
  25. package/dist/checkout.d.ts +4 -2
  26. package/dist/checkout.js +28 -19
  27. package/dist/config.js +1 -1
  28. package/dist/index.browser.js +4 -4
  29. package/dist/index.browser.js.map +1 -1
  30. package/dist/index.cjs +31 -22
  31. package/dist/index.d.ts +4 -2
  32. package/dist/index.js +31 -22
  33. package/dist/orderbook.js +1 -1
  34. package/dist/passport.js +4 -4
  35. package/dist/x.js +3 -3
  36. package/package.json +1 -1
  37. package/dist/browser/checkout/index-57dbdf1d.js +0 -1
@@ -1 +1 @@
1
- import{ad as t,bU as e,d6 as n,bY as o,d7 as r,bx as i,d8 as s,r as a,ab as c,bs as l,a as u,j as d,M as f,B as m,u as h,V as p,E,e as g,cH as S,z as v,G as _,H as w,b,J as A,I,d as T,o as C}from"./index-4da0c2bb.js";const O=new e(n),y={},R=t.from(0),x=t.from(-1);function N(t,n,o,r){const i={fault:n,operation:o};return void 0!==r&&(i.value=r),O.throwError(t,e.errors.NUMERIC_FAULT,i)}let P="0";for(;P.length<256;)P+=P;function F(e){if("number"!=typeof e)try{e=t.from(e).toNumber()}catch(t){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+P.substring(0,e):O.throwArgumentError("invalid decimal size","decimals",e)}function L(e,n){null==n&&(n=0);const o=F(n),r=(e=t.from(e)).lt(R);r&&(e=e.mul(x));let i=e.mod(o).toString();for(;i.length<o.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=e.div(o).toString();return e=1===o.length?s:s+"."+i,r&&(e="-"+e),e}function U(e,n){null==n&&(n=0);const o=F(n);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||O.throwArgumentError("invalid decimal value","value",e);const r="-"===e.substring(0,1);r&&(e=e.substring(1)),"."===e&&O.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&O.throwArgumentError("too many decimal points","value",e);let s=i[0],a=i[1];for(s||(s="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>o.length-1&&N("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.length<o.length-1;)a+="0";const c=t.from(s),l=t.from(a);let u=c.mul(o).add(l);return r&&(u=u.mul(x)),u}class k{constructor(t,n,o,r){t!==y&&O.throwError("cannot use FixedFormat constructor; use FixedFormat.from",e.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=n,this.width=o,this.decimals=r,this.name=(n?"":"u")+"fixed"+String(o)+"x"+String(r),this._multiplier=F(r),Object.freeze(this)}static from(t){if(t instanceof k)return t;"number"==typeof t&&(t=`fixed128x${t}`);let e=!0,n=128,o=18;if("string"==typeof t)if("fixed"===t);else if("ufixed"===t)e=!1;else{const r=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);r||O.throwArgumentError("invalid fixed format","format",t),e="u"!==r[1],n=parseInt(r[2]),o=parseInt(r[3])}else if(t){const r=(e,n,o)=>null==t[e]?o:(typeof t[e]!==n&&O.throwArgumentError("invalid fixed format ("+e+" not "+n+")","format."+e,t[e]),t[e]);e=r("signed","boolean",e),n=r("width","number",n),o=r("decimals","number",o)}return n%8&&O.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),o>80&&O.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",o),new k(y,e,n,o)}}class W{constructor(t,n,o,r){t!==y&&O.throwError("cannot use FixedNumber constructor; use FixedNumber.from",e.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=r,this._hex=n,this._value=o,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&O.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=U(this._value,this.format.decimals),n=U(t._value,t.format.decimals);return W.fromValue(e.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=U(this._value,this.format.decimals),n=U(t._value,t.format.decimals);return W.fromValue(e.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=U(this._value,this.format.decimals),n=U(t._value,t.format.decimals);return W.fromValue(e.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=U(this._value,this.format.decimals),n=U(t._value,t.format.decimals);return W.fromValue(e.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=W.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(e=e.subUnsafe(D.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=W.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(e=e.addUnsafe(D.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&O.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const n=W.from("1"+P.substring(0,t),this.format),o=B.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(o).floor().divUnsafe(n)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&O.throwArgumentError("invalid byte width","width",e);const n=t.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return o(n,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return W.fromString(this._value,t)}static fromValue(t,e,n){return null!=n||null==e||r(e)||(n=e,e=null),null==e&&(e=0),null==n&&(n="fixed"),W.fromString(L(t,e),k.from(n))}static fromString(t,e){null==e&&(e="fixed");const n=k.from(e),r=U(t,n.decimals);!n.signed&&r.lt(R)&&N("unsigned value cannot be negative","overflow","value",t);let i=null;n.signed?i=r.toTwos(n.width).toHexString():(i=r.toHexString(),i=o(i,n.width/8));const s=L(r,n.decimals);return new W(y,i,s,n)}static fromBytes(e,n){null==n&&(n="fixed");const o=k.from(n);if(i(e).length>o.width/8)throw new Error("overflow");let r=t.from(e);o.signed&&(r=r.fromTwos(o.width));const s=r.toTwos((o.signed?0:1)+o.width).toHexString(),a=L(r,o.decimals);return new W(y,s,a,o)}static from(t,n){if("string"==typeof t)return W.fromString(t,n);if(s(t))return W.fromBytes(t,n);try{return W.fromValue(t,0,n)}catch(t){if(t.code!==e.errors.INVALID_ARGUMENT)throw t}return O.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const D=W.from(1),B=W.from("0.5"),M=new e("units/5.7.0"),$=["wei","kwei","mwei","gwei","szabo","finney","ether"];function V(t,e){if("string"==typeof e){const t=$.indexOf(e);-1!==t&&(e=3*t)}return L(t,null!=e?e:18)}function G(t,e){if("string"!=typeof t&&M.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=$.indexOf(e);-1!==t&&(e=3*t)}return U(t,null!=e?e:18)}function H(t){return G(t,18)}var K,Y=Object.freeze({__proto__:null,commify:function(t){const e=String(t).split(".");(e.length>2||!e[0].match(/^-?[0-9]*$/)||e[1]&&!e[1].match(/^[0-9]*$/)||"."===t||"-."===t)&&M.throwArgumentError("invalid value","value",t);let n=e[0],o="";for("-"===n.substring(0,1)&&(o="-",n=n.substring(1));"0"===n.substring(0,1);)n=n.substring(1);""===n&&(n="0");let r="";for(2===e.length&&(r="."+(e[1]||"0"));r.length>2&&"0"===r[r.length-1];)r=r.substring(0,r.length-1);const i=[];for(;n.length;){if(n.length<=3){i.unshift(n);break}{const t=n.length-3;i.unshift(n.substring(t)),n=n.substring(0,t)}}return o+i.join(",")+r},formatEther:function(t){return V(t,18)},formatUnits:V,parseEther:H,parseUnits:G});!function(t){t.USD="usd"}(K||(K={}));const z={cryptoFiat:null,fiatSymbol:K.USD,tokenSymbols:[],conversions:new Map};var j;!function(t){t.SET_CRYPTO_FIAT="SET_CRYPTO_FIAT",t.SET_FIAT_SYMBOL="SET_FIAT_SYMBOL",t.SET_TOKEN_SYMBOLS="SET_TOKEN_SYMBOLS",t.SET_CONVERSIONS="SET_CONVERSIONS"}(j||(j={}));const J=a.createContext({cryptoFiatState:z,cryptoFiatDispatch:()=>{}}),X=(t,e)=>{switch(e.payload.type){case j.SET_CRYPTO_FIAT:return{...t,cryptoFiat:e.payload.cryptoFiat};case j.SET_FIAT_SYMBOL:return{...t,fiatSymbol:e.payload.fiatSymbol};case j.SET_TOKEN_SYMBOLS:return{...t,tokenSymbols:e.payload.tokenSymbols};case j.SET_CONVERSIONS:return{...t,conversions:e.payload.conversions};default:return t}};var q;!function(t){t.SWAP="SWAP",t.IN_PROGRESS="IN_PROGRESS",t.SUCCESS="SUCCESS",t.FAIL="FAIL",t.PRICE_SURGE="PRICE_SURGE",t.APPROVE_ERC20="APPROVE_ERC20_SWAP"}(q||(q={}));class Z{baseConfig;constructor({baseConfig:t}){this.baseConfig=t}}const Q={[c.SANDBOX]:"https://checkout-api.sandbox.immutable.com",[c.PRODUCTION]:"https://checkout-api.immutable.com"};class tt{coinsCache;overridesCache;config;constructor(t){this.coinsCache=null,this.overridesCache=null,this.config=t.baseConfig}urlWithPath(t){return Q[this.config.environment]+t}async fetchOverrides(){if(null!==this.overridesCache)return;const t=this.urlWithPath("/v1/fiat/coins/overrides"),e=await l.get(t);if(200!==e.status)throw new Error(`Error fetching coins overrides: ${e.status} ${e.statusText}`);this.overridesCache=new Map(Object.entries(e.data))}async fetchCoins(){if(null!==this.coinsCache)return;await this.fetchOverrides();const t=this.urlWithPath("/v1/fiat/coins/all"),e=await l.get(t);if(200!==e.status)throw new Error(`Error fetching coins list: ${e.status} ${e.statusText}`);const{data:n}=e;this.coinsCache=new Map;for(const t of n){const e=this.overridesCache.get(t.symbol.toLowerCase());this.coinsCache.set(t.symbol.toLowerCase(),e||t.id.toLowerCase())}}async convert({tokenSymbols:t,fiatSymbols:e=[]}){if(!t||0===t.length)throw new Error("Error missing token symbols to convert");const n=e.filter((t=>""!==t));0===n.length&&n.push("usd"),await this.fetchCoins();const o=t.map((t=>this.coinsCache.get(t.toLowerCase()))).filter((t=>""!==t&&void 0!==t)).join(","),r=n.join(",").toLowerCase(),i=this.urlWithPath(`/v1/fiat/conversion?ids=${o}&currencies=${r}`),s=await l.get(i);if(200!==s.status)throw new Error(`Error fetching prices: ${s.status} ${s.statusText}`);const{data:a}=s,c={};for(const e of t){const t=e.toLowerCase(),n=this.coinsCache.get(t);c[t]={},n&&(c[t]=a[n]||{})}return c}}const et=async(t,e,n)=>{try{if(0===n.length)return new Map;return((t,e)=>{const n=new Map;for(const o in t){const r=t[o][e];void 0!==r&&n.set(o,r)}return n})(await t.convert({tokenSymbols:n,fiatSymbol:e}),e)}catch(t){return new Map}},nt=["ETH","IMX"];function ot({environment:t,children:e}){const[n,o]=a.useReducer(X,z),{cryptoFiat:r,fiatSymbol:i,tokenSymbols:s}=n;return a.useEffect((()=>{o({payload:{type:j.SET_CRYPTO_FIAT,cryptoFiat:new tt(new Z({baseConfig:{environment:t}}))}})}),[]),a.useEffect((()=>{r&&i&&(async()=>{const t=await et(r,i,[...new Set([...s,...nt])]);o({payload:{type:j.SET_CONVERSIONS,conversions:t}})})()}),[r,s,i]),u(J.Provider,{value:{cryptoFiatState:n,cryptoFiatDispatch:o},children:e})}var rt;!function(t){t.WALLET_NETWORK_SELECTION="WALLET_NETWORK_SELECTION",t.BRIDGE_FORM="BRIDGE_FORM",t.BRIDGE_REVIEW="BRIDGE_REVIEW",t.IN_PROGRESS="IN_PROGRESS",t.BRIDGE_FAILURE="BRIDGE_FAILURE",t.APPROVE_TRANSACTION="APPROVE_TRANSACTION",t.TRANSACTIONS="TRANSACTIONS",t.CLAIM_WITHDRAWAL="CLAIM_WITHDRAWAL",t.CLAIM_WITHDRAWAL_IN_PROGRESS="CLAIM_WITHDRAWAL_IN_PROGRESS",t.CLAIM_WITHDRAWAL_SUCCESS="CLAIM_WITHDRAWAL_SUCCESS",t.CLAIM_WITHDRAWAL_FAILURE="CLAIM_WITHDRAWAL_FAILURE"}(rt||(rt={}));const it=(t,e)=>{const{fees:n,token:o}=t;if(void 0===n.totalFees)return"-.--";if(void 0===o)return"-.--";const r=((t,e,n)=>{let o=-1;if(t&&e){const r=V(t,e.decimals),i=n.get(e.symbol.toLocaleLowerCase());if(i){const t=parseFloat(r);if(Number.isNaN(t))return o;o=t*i}}return o})(n.totalFees,o,e);return r<0?"-.--":function(t){if(t<0)return"-.--";const e=t.toString();if(e.includes("e")||0===t)return"0.00";if(t<.01)for(let n=0;n<e.length;n++)if("0"!==e[n]&&"."!==e[n])return t.toFixed(n-1);return t.toFixed(2)}(r)};var st;function at({testId:t,icon:e,heading:n,caption:o,onClick:r,renderFeeFunction:i,isDisabled:s}){return u(m,{testId:"top-up-view",sx:{paddingY:"1px"},children:d(f,{testId:`menu-item-${t}`,size:"medium",emphasized:!0,onClick:s?void 0:r,sx:s?{opacity:"0.5",cursor:"not-allowed"}:{},children:[u(f.Icon,{icon:e}),u(f.Label,{size:"medium",children:n}),u(f.IntentIcon,{}),d(f.Caption,{testId:`menu-item-caption-${t}`,children:[o,u("br",{}),s?"":i("-.--",!1)]})]})})}!function(t){t.ONRAMP="ONRAMP",t.IN_PROGRESS_LOADING="IN_PROGRESS_LOADING",t.IN_PROGRESS="IN_PROGRESS",t.SUCCESS="SUCCESS",t.FAIL="FAIL"}(st||(st={}));const ct={[c.SANDBOX]:"https://checkout-playground.sandbox.immutable.com",[c.PRODUCTION]:"https://toolkit.immutable.com"};function lt({widgetEvent:t,checkout:e,provider:n,showOnrampOption:o,showSwapOption:r,showBridgeOption:i,tokenAddress:s,amount:l,analytics:f,onCloseButtonClick:O,onBackButtonClick:y,heading:R,subheading:x}){const{t:N}=h(),{userJourney:P}=f,{viewDispatch:F}=a.useContext(p),{cryptoFiatState:L,cryptoFiatDispatch:U}=a.useContext(J),{conversions:k,fiatSymbol:W}=L,D=e?.config.environment??c.SANDBOX,{eventTargetState:{eventTarget:B}}=a.useContext(E),[M,$]=a.useState("-.--"),[V,G]=a.useState("-.--"),[H,K]=a.useState(!0),Y=R?N(...R):N("views.TOP_UP_VIEW.header.title"),z=x?N(...x):null,{page:X,track:Z}=g();a.useEffect((()=>{X({userJourney:P,screen:"TopUp"})}),[]),a.useEffect((()=>{U&&U({payload:{type:j.SET_TOKEN_SYMBOLS,tokenSymbols:nt}})}),[U]),a.useEffect((()=>{e&&(async()=>{const t=await e.gasEstimate({gasEstimateType:S.BRIDGE_TO_L2}),n=await it(t,k);G(n)})()}),[void 0!==e]),a.useEffect((()=>{e&&(async()=>{const t=(t=>{const{minPercentage:e,maxPercentage:n}=t;return void 0===e||void 0===n?"-.--":`${e}% to ${n}`})(await e.getExchangeFeeEstimate());$(t)})()}),[void 0!==e]),a.useEffect((()=>{e&&(async()=>{K(await e.isSwapAvailable())})()}),[void 0!==e]);const Q=(t,e,n="Button")=>{Z({userJourney:P,screen:"TopUp",control:t,controlType:n,extras:e})},tt=t=>u(m,{sx:{fontSize:"base.text.caption.small.regular.fontSize",c:"base.color.translucent.standard.600"},children:t}),et=[{testId:"onramp",icon:"BankCard",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.onramp",onClickEvent:()=>{if(t===I.IMTBL_ONRAMP_WIDGET_EVENT){const e={tokenAddress:"",amount:""};return F({payload:{type:T.UPDATE_VIEW,view:{type:st.ONRAMP,data:e}}}),void Q("OnRamp",{...e,widgetEvent:t})}const e={tokenAddress:s??"",amount:l??""};C.sendRequestOnrampEvent(B,t,e),Q("OnRamp",{...e,widgetEvent:t})},fee:()=>tt(`${N("views.TOP_UP_VIEW.topUpOptions.onramp.subcaption")} ≈ ${M}%`),isAvailable:!0,isEnabled:o},{testId:"swap",icon:"Swap",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.swap",onClickEvent:()=>{if(t===I.IMTBL_SWAP_WIDGET_EVENT){const e={toTokenAddress:"",fromAmount:"",fromTokenAddress:""};return F({payload:{type:T.UPDATE_VIEW,view:{type:q.SWAP,data:e}}}),void Q("Swap",{...e,widgetEvent:t})}const e={fromTokenAddress:"",toTokenAddress:s??"",amount:""};C.sendRequestSwapEvent(B,t,e),Q("Swap",{...e,widgetEvent:t})},fee:()=>tt(`${N("views.TOP_UP_VIEW.topUpOptions.swap.subcaption")} ≈ $0.05 ${W.toUpperCase()}`),isAvailable:H,isEnabled:r},{testId:"bridge",icon:"Minting",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.bridge",onClickEvent:()=>{if(t===I.IMTBL_BRIDGE_WIDGET_EVENT){const e={fromTokenAddress:"",fromAmount:""};return F({payload:{type:T.UPDATE_VIEW,view:{type:rt.WALLET_NETWORK_SELECTION,data:e}}}),void Q("Bridge",{...e,widgetEvent:t})}const e={tokenAddress:"",amount:""};C.sendRequestBridgeEvent(B,t,e),Q("Bridge",{...e,widgetEvent:t})},fee:()=>tt(`${N("views.TOP_UP_VIEW.topUpOptions.bridge.subcaption")} ≈ $${V} ${W.toUpperCase()}`),isAvailable:!0,isEnabled:i},{testId:"advanced",icon:"JumpTo",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.advanced",onClickEvent:()=>{const e=ct[D];Q("AdvancedOptions",{...{tokenAddress:s??"",amount:l??""},widgetEvent:t}),window.open(`${e}/faster-bridge/`,"_blank")},fee:()=>tt(""),isAvailable:!0,isEnabled:!0}];return u(A,{header:u(v,{onBackButtonClick:y,onCloseButtonClick:O,showBack:!0}),footer:u(_,{}),children:d(m,{sx:{paddingX:"base.spacing.x4",paddingY:"base.spacing.x4"},children:[u(w,{size:"small",children:Y}),z&&u(b,{size:"small",sx:{color:"base.color.text.body.secondary"},children:z}),u(m,{sx:{paddingY:"base.spacing.x4"},children:et.sort(((t,e)=>Number(e.isAvailable)-Number(t.isAvailable))).map((t=>t.isEnabled&&u(at,{testId:t.testId,icon:t.icon,heading:N(`${t.textConfigKey}.heading`),caption:t.isAvailable?N(`${t.textConfigKey}.caption`):N(`${t.textConfigKey}.disabledCaption`),onClick:t.onClickEvent,renderFeeFunction:t.fee,isDisabled:!t.isAvailable},N(`${t.textConfigKey}.heading`).toLowerCase())))})]})})}export{rt as B,J as C,st as O,q as S,lt as T,j as a,ot as b,H as c,V as f,Y as l,G as p};
1
+ import{ad as t,bU as e,d6 as n,bY as o,d7 as r,bx as i,d8 as s,r as a,ab as c,bs as l,a as u,j as d,M as f,B as m,u as h,V as p,E,e as g,cH as S,z as v,G as _,H as w,b,J as A,I,d as T,o as C}from"./index-9493d2b3.js";const O=new e(n),y={},R=t.from(0),x=t.from(-1);function N(t,n,o,r){const i={fault:n,operation:o};return void 0!==r&&(i.value=r),O.throwError(t,e.errors.NUMERIC_FAULT,i)}let P="0";for(;P.length<256;)P+=P;function F(e){if("number"!=typeof e)try{e=t.from(e).toNumber()}catch(t){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+P.substring(0,e):O.throwArgumentError("invalid decimal size","decimals",e)}function L(e,n){null==n&&(n=0);const o=F(n),r=(e=t.from(e)).lt(R);r&&(e=e.mul(x));let i=e.mod(o).toString();for(;i.length<o.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=e.div(o).toString();return e=1===o.length?s:s+"."+i,r&&(e="-"+e),e}function U(e,n){null==n&&(n=0);const o=F(n);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||O.throwArgumentError("invalid decimal value","value",e);const r="-"===e.substring(0,1);r&&(e=e.substring(1)),"."===e&&O.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&O.throwArgumentError("too many decimal points","value",e);let s=i[0],a=i[1];for(s||(s="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>o.length-1&&N("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.length<o.length-1;)a+="0";const c=t.from(s),l=t.from(a);let u=c.mul(o).add(l);return r&&(u=u.mul(x)),u}class k{constructor(t,n,o,r){t!==y&&O.throwError("cannot use FixedFormat constructor; use FixedFormat.from",e.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=n,this.width=o,this.decimals=r,this.name=(n?"":"u")+"fixed"+String(o)+"x"+String(r),this._multiplier=F(r),Object.freeze(this)}static from(t){if(t instanceof k)return t;"number"==typeof t&&(t=`fixed128x${t}`);let e=!0,n=128,o=18;if("string"==typeof t)if("fixed"===t);else if("ufixed"===t)e=!1;else{const r=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);r||O.throwArgumentError("invalid fixed format","format",t),e="u"!==r[1],n=parseInt(r[2]),o=parseInt(r[3])}else if(t){const r=(e,n,o)=>null==t[e]?o:(typeof t[e]!==n&&O.throwArgumentError("invalid fixed format ("+e+" not "+n+")","format."+e,t[e]),t[e]);e=r("signed","boolean",e),n=r("width","number",n),o=r("decimals","number",o)}return n%8&&O.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),o>80&&O.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",o),new k(y,e,n,o)}}class W{constructor(t,n,o,r){t!==y&&O.throwError("cannot use FixedNumber constructor; use FixedNumber.from",e.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=r,this._hex=n,this._value=o,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&O.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=U(this._value,this.format.decimals),n=U(t._value,t.format.decimals);return W.fromValue(e.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=U(this._value,this.format.decimals),n=U(t._value,t.format.decimals);return W.fromValue(e.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=U(this._value,this.format.decimals),n=U(t._value,t.format.decimals);return W.fromValue(e.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=U(this._value,this.format.decimals),n=U(t._value,t.format.decimals);return W.fromValue(e.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=W.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(e=e.subUnsafe(D.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=W.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(e=e.addUnsafe(D.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&O.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const n=W.from("1"+P.substring(0,t),this.format),o=B.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(o).floor().divUnsafe(n)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&O.throwArgumentError("invalid byte width","width",e);const n=t.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return o(n,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return W.fromString(this._value,t)}static fromValue(t,e,n){return null!=n||null==e||r(e)||(n=e,e=null),null==e&&(e=0),null==n&&(n="fixed"),W.fromString(L(t,e),k.from(n))}static fromString(t,e){null==e&&(e="fixed");const n=k.from(e),r=U(t,n.decimals);!n.signed&&r.lt(R)&&N("unsigned value cannot be negative","overflow","value",t);let i=null;n.signed?i=r.toTwos(n.width).toHexString():(i=r.toHexString(),i=o(i,n.width/8));const s=L(r,n.decimals);return new W(y,i,s,n)}static fromBytes(e,n){null==n&&(n="fixed");const o=k.from(n);if(i(e).length>o.width/8)throw new Error("overflow");let r=t.from(e);o.signed&&(r=r.fromTwos(o.width));const s=r.toTwos((o.signed?0:1)+o.width).toHexString(),a=L(r,o.decimals);return new W(y,s,a,o)}static from(t,n){if("string"==typeof t)return W.fromString(t,n);if(s(t))return W.fromBytes(t,n);try{return W.fromValue(t,0,n)}catch(t){if(t.code!==e.errors.INVALID_ARGUMENT)throw t}return O.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const D=W.from(1),B=W.from("0.5"),M=new e("units/5.7.0"),$=["wei","kwei","mwei","gwei","szabo","finney","ether"];function V(t,e){if("string"==typeof e){const t=$.indexOf(e);-1!==t&&(e=3*t)}return L(t,null!=e?e:18)}function G(t,e){if("string"!=typeof t&&M.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=$.indexOf(e);-1!==t&&(e=3*t)}return U(t,null!=e?e:18)}function H(t){return G(t,18)}var K,Y=Object.freeze({__proto__:null,commify:function(t){const e=String(t).split(".");(e.length>2||!e[0].match(/^-?[0-9]*$/)||e[1]&&!e[1].match(/^[0-9]*$/)||"."===t||"-."===t)&&M.throwArgumentError("invalid value","value",t);let n=e[0],o="";for("-"===n.substring(0,1)&&(o="-",n=n.substring(1));"0"===n.substring(0,1);)n=n.substring(1);""===n&&(n="0");let r="";for(2===e.length&&(r="."+(e[1]||"0"));r.length>2&&"0"===r[r.length-1];)r=r.substring(0,r.length-1);const i=[];for(;n.length;){if(n.length<=3){i.unshift(n);break}{const t=n.length-3;i.unshift(n.substring(t)),n=n.substring(0,t)}}return o+i.join(",")+r},formatEther:function(t){return V(t,18)},formatUnits:V,parseEther:H,parseUnits:G});!function(t){t.USD="usd"}(K||(K={}));const z={cryptoFiat:null,fiatSymbol:K.USD,tokenSymbols:[],conversions:new Map};var j;!function(t){t.SET_CRYPTO_FIAT="SET_CRYPTO_FIAT",t.SET_FIAT_SYMBOL="SET_FIAT_SYMBOL",t.SET_TOKEN_SYMBOLS="SET_TOKEN_SYMBOLS",t.SET_CONVERSIONS="SET_CONVERSIONS"}(j||(j={}));const J=a.createContext({cryptoFiatState:z,cryptoFiatDispatch:()=>{}}),X=(t,e)=>{switch(e.payload.type){case j.SET_CRYPTO_FIAT:return{...t,cryptoFiat:e.payload.cryptoFiat};case j.SET_FIAT_SYMBOL:return{...t,fiatSymbol:e.payload.fiatSymbol};case j.SET_TOKEN_SYMBOLS:return{...t,tokenSymbols:e.payload.tokenSymbols};case j.SET_CONVERSIONS:return{...t,conversions:e.payload.conversions};default:return t}};var q;!function(t){t.SWAP="SWAP",t.IN_PROGRESS="IN_PROGRESS",t.SUCCESS="SUCCESS",t.FAIL="FAIL",t.PRICE_SURGE="PRICE_SURGE",t.APPROVE_ERC20="APPROVE_ERC20_SWAP"}(q||(q={}));class Z{baseConfig;constructor({baseConfig:t}){this.baseConfig=t}}const Q={[c.SANDBOX]:"https://checkout-api.sandbox.immutable.com",[c.PRODUCTION]:"https://checkout-api.immutable.com"};class tt{coinsCache;overridesCache;config;constructor(t){this.coinsCache=null,this.overridesCache=null,this.config=t.baseConfig}urlWithPath(t){return Q[this.config.environment]+t}async fetchOverrides(){if(null!==this.overridesCache)return;const t=this.urlWithPath("/v1/fiat/coins/overrides"),e=await l.get(t);if(200!==e.status)throw new Error(`Error fetching coins overrides: ${e.status} ${e.statusText}`);this.overridesCache=new Map(Object.entries(e.data))}async fetchCoins(){if(null!==this.coinsCache)return;await this.fetchOverrides();const t=this.urlWithPath("/v1/fiat/coins/all"),e=await l.get(t);if(200!==e.status)throw new Error(`Error fetching coins list: ${e.status} ${e.statusText}`);const{data:n}=e;this.coinsCache=new Map;for(const t of n){const e=this.overridesCache.get(t.symbol.toLowerCase());this.coinsCache.set(t.symbol.toLowerCase(),e||t.id.toLowerCase())}}async convert({tokenSymbols:t,fiatSymbols:e=[]}){if(!t||0===t.length)throw new Error("Error missing token symbols to convert");const n=e.filter((t=>""!==t));0===n.length&&n.push("usd"),await this.fetchCoins();const o=t.map((t=>this.coinsCache.get(t.toLowerCase()))).filter((t=>""!==t&&void 0!==t)).join(","),r=n.join(",").toLowerCase(),i=this.urlWithPath(`/v1/fiat/conversion?ids=${o}&currencies=${r}`),s=await l.get(i);if(200!==s.status)throw new Error(`Error fetching prices: ${s.status} ${s.statusText}`);const{data:a}=s,c={};for(const e of t){const t=e.toLowerCase(),n=this.coinsCache.get(t);c[t]={},n&&(c[t]=a[n]||{})}return c}}const et=async(t,e,n)=>{try{if(0===n.length)return new Map;return((t,e)=>{const n=new Map;for(const o in t){const r=t[o][e];void 0!==r&&n.set(o,r)}return n})(await t.convert({tokenSymbols:n,fiatSymbol:e}),e)}catch(t){return new Map}},nt=["ETH","IMX"];function ot({environment:t,children:e}){const[n,o]=a.useReducer(X,z),{cryptoFiat:r,fiatSymbol:i,tokenSymbols:s}=n;return a.useEffect((()=>{o({payload:{type:j.SET_CRYPTO_FIAT,cryptoFiat:new tt(new Z({baseConfig:{environment:t}}))}})}),[]),a.useEffect((()=>{r&&i&&(async()=>{const t=await et(r,i,[...new Set([...s,...nt])]);o({payload:{type:j.SET_CONVERSIONS,conversions:t}})})()}),[r,s,i]),u(J.Provider,{value:{cryptoFiatState:n,cryptoFiatDispatch:o},children:e})}var rt;!function(t){t.WALLET_NETWORK_SELECTION="WALLET_NETWORK_SELECTION",t.BRIDGE_FORM="BRIDGE_FORM",t.BRIDGE_REVIEW="BRIDGE_REVIEW",t.IN_PROGRESS="IN_PROGRESS",t.BRIDGE_FAILURE="BRIDGE_FAILURE",t.APPROVE_TRANSACTION="APPROVE_TRANSACTION",t.TRANSACTIONS="TRANSACTIONS",t.CLAIM_WITHDRAWAL="CLAIM_WITHDRAWAL",t.CLAIM_WITHDRAWAL_IN_PROGRESS="CLAIM_WITHDRAWAL_IN_PROGRESS",t.CLAIM_WITHDRAWAL_SUCCESS="CLAIM_WITHDRAWAL_SUCCESS",t.CLAIM_WITHDRAWAL_FAILURE="CLAIM_WITHDRAWAL_FAILURE"}(rt||(rt={}));const it=(t,e)=>{const{fees:n,token:o}=t;if(void 0===n.totalFees)return"-.--";if(void 0===o)return"-.--";const r=((t,e,n)=>{let o=-1;if(t&&e){const r=V(t,e.decimals),i=n.get(e.symbol.toLocaleLowerCase());if(i){const t=parseFloat(r);if(Number.isNaN(t))return o;o=t*i}}return o})(n.totalFees,o,e);return r<0?"-.--":function(t){if(t<0)return"-.--";const e=t.toString();if(e.includes("e")||0===t)return"0.00";if(t<.01)for(let n=0;n<e.length;n++)if("0"!==e[n]&&"."!==e[n])return t.toFixed(n-1);return t.toFixed(2)}(r)};var st;function at({testId:t,icon:e,heading:n,caption:o,onClick:r,renderFeeFunction:i,isDisabled:s}){return u(m,{testId:"top-up-view",sx:{paddingY:"1px"},children:d(f,{testId:`menu-item-${t}`,size:"medium",emphasized:!0,onClick:s?void 0:r,sx:s?{opacity:"0.5",cursor:"not-allowed"}:{},children:[u(f.Icon,{icon:e}),u(f.Label,{size:"medium",children:n}),u(f.IntentIcon,{}),d(f.Caption,{testId:`menu-item-caption-${t}`,children:[o,u("br",{}),s?"":i("-.--",!1)]})]})})}!function(t){t.ONRAMP="ONRAMP",t.IN_PROGRESS_LOADING="IN_PROGRESS_LOADING",t.IN_PROGRESS="IN_PROGRESS",t.SUCCESS="SUCCESS",t.FAIL="FAIL"}(st||(st={}));const ct={[c.SANDBOX]:"https://checkout-playground.sandbox.immutable.com",[c.PRODUCTION]:"https://toolkit.immutable.com"};function lt({widgetEvent:t,checkout:e,provider:n,showOnrampOption:o,showSwapOption:r,showBridgeOption:i,tokenAddress:s,amount:l,analytics:f,onCloseButtonClick:O,onBackButtonClick:y,heading:R,subheading:x}){const{t:N}=h(),{userJourney:P}=f,{viewDispatch:F}=a.useContext(p),{cryptoFiatState:L,cryptoFiatDispatch:U}=a.useContext(J),{conversions:k,fiatSymbol:W}=L,D=e?.config.environment??c.SANDBOX,{eventTargetState:{eventTarget:B}}=a.useContext(E),[M,$]=a.useState("-.--"),[V,G]=a.useState("-.--"),[H,K]=a.useState(!0),Y=R?N(...R):N("views.TOP_UP_VIEW.header.title"),z=x?N(...x):null,{page:X,track:Z}=g();a.useEffect((()=>{X({userJourney:P,screen:"TopUp"})}),[]),a.useEffect((()=>{U&&U({payload:{type:j.SET_TOKEN_SYMBOLS,tokenSymbols:nt}})}),[U]),a.useEffect((()=>{e&&(async()=>{const t=await e.gasEstimate({gasEstimateType:S.BRIDGE_TO_L2}),n=await it(t,k);G(n)})()}),[void 0!==e]),a.useEffect((()=>{e&&(async()=>{const t=(t=>{const{minPercentage:e,maxPercentage:n}=t;return void 0===e||void 0===n?"-.--":`${e}% to ${n}`})(await e.getExchangeFeeEstimate());$(t)})()}),[void 0!==e]),a.useEffect((()=>{e&&(async()=>{K(await e.isSwapAvailable())})()}),[void 0!==e]);const Q=(t,e,n="Button")=>{Z({userJourney:P,screen:"TopUp",control:t,controlType:n,extras:e})},tt=t=>u(m,{sx:{fontSize:"base.text.caption.small.regular.fontSize",c:"base.color.translucent.standard.600"},children:t}),et=[{testId:"onramp",icon:"BankCard",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.onramp",onClickEvent:()=>{if(t===I.IMTBL_ONRAMP_WIDGET_EVENT){const e={tokenAddress:"",amount:""};return F({payload:{type:T.UPDATE_VIEW,view:{type:st.ONRAMP,data:e}}}),void Q("OnRamp",{...e,widgetEvent:t})}const e={tokenAddress:s??"",amount:l??""};C.sendRequestOnrampEvent(B,t,e),Q("OnRamp",{...e,widgetEvent:t})},fee:()=>tt(`${N("views.TOP_UP_VIEW.topUpOptions.onramp.subcaption")} ≈ ${M}%`),isAvailable:!0,isEnabled:o},{testId:"swap",icon:"Swap",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.swap",onClickEvent:()=>{if(t===I.IMTBL_SWAP_WIDGET_EVENT){const e={toTokenAddress:"",fromAmount:"",fromTokenAddress:""};return F({payload:{type:T.UPDATE_VIEW,view:{type:q.SWAP,data:e}}}),void Q("Swap",{...e,widgetEvent:t})}const e={fromTokenAddress:"",toTokenAddress:s??"",amount:""};C.sendRequestSwapEvent(B,t,e),Q("Swap",{...e,widgetEvent:t})},fee:()=>tt(`${N("views.TOP_UP_VIEW.topUpOptions.swap.subcaption")} ≈ $0.05 ${W.toUpperCase()}`),isAvailable:H,isEnabled:r},{testId:"bridge",icon:"Minting",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.bridge",onClickEvent:()=>{if(t===I.IMTBL_BRIDGE_WIDGET_EVENT){const e={fromTokenAddress:"",fromAmount:""};return F({payload:{type:T.UPDATE_VIEW,view:{type:rt.WALLET_NETWORK_SELECTION,data:e}}}),void Q("Bridge",{...e,widgetEvent:t})}const e={tokenAddress:"",amount:""};C.sendRequestBridgeEvent(B,t,e),Q("Bridge",{...e,widgetEvent:t})},fee:()=>tt(`${N("views.TOP_UP_VIEW.topUpOptions.bridge.subcaption")} ≈ $${V} ${W.toUpperCase()}`),isAvailable:!0,isEnabled:i},{testId:"advanced",icon:"JumpTo",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.advanced",onClickEvent:()=>{const e=ct[D];Q("AdvancedOptions",{...{tokenAddress:s??"",amount:l??""},widgetEvent:t}),window.open(`${e}/faster-bridge/`,"_blank")},fee:()=>tt(""),isAvailable:!0,isEnabled:!0}];return u(A,{header:u(v,{onBackButtonClick:y,onCloseButtonClick:O,showBack:!0}),footer:u(_,{}),children:d(m,{sx:{paddingX:"base.spacing.x4",paddingY:"base.spacing.x4"},children:[u(w,{size:"small",children:Y}),z&&u(b,{size:"small",sx:{color:"base.color.text.body.secondary"},children:z}),u(m,{sx:{paddingY:"base.spacing.x4"},children:et.sort(((t,e)=>Number(e.isAvailable)-Number(t.isAvailable))).map((t=>t.isEnabled&&u(at,{testId:t.testId,icon:t.icon,heading:N(`${t.textConfigKey}.heading`),caption:t.isAvailable?N(`${t.textConfigKey}.caption`):N(`${t.textConfigKey}.disabledCaption`),onClick:t.onClickEvent,renderFeeFunction:t.fee,isDisabled:!t.isAvailable},N(`${t.textConfigKey}.heading`).toLowerCase())))})]})})}export{rt as B,J as C,st as O,q as S,lt as T,j as a,ot as b,H as c,V as f,Y as l,G as p};
@@ -1 +1 @@
1
- import{r as e,T as t,u as n,V as a,j as o,B as s,a as i,b as r,c as l,d as c,C as d,e as p,f as u,E as h,i as L,g as C,h as k,k as f,M as w,H as b,t as E,U as m,o as T,I as g,Z as y,l as S,s as x,m as I,S as A,N as v,n as _,p as N,q as B,v as O,D as W,w as M,x as D,y as F,z as R,A as P,F as Z,G as U,J as V,K as j,L as z,O as G,P as $,Q as J,R as K,W as H,X,Y,_ as q,$ as Q,a0 as ee,a1 as te}from"./index-4da0c2bb.js";import{C as ne,a as ae,b as oe,T as se}from"./TopUpView-0bcbc762.js";import{H as ie}from"./HorizontalMenu-94558d7e.js";import{r as re,u as le}from"./retry-cd8de993.js";const ce={walletProviderName:null,network:null,tokenBalances:[],supportedTopUps:null,walletConfig:{showDisconnectButton:!0,showNetworkMenu:!0}};var de;!function(e){e.SET_WALLET_PROVIDER_NAME="SET_WALLET_PROVIDER_NAME",e.SET_NETWORK="SET_NETWORK",e.SET_TOKEN_BALANCES="SET_TOKEN_BALANCES",e.SET_SUPPORTED_TOP_UPS="SUPPORTED_TOP_UPS"}(de||(de={}));const pe=e.createContext({walletState:ce,walletDispatch:()=>{}});pe.displayName="WalletContext";const ue=(e,t)=>{switch(t.payload.type){case de.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case de.SET_NETWORK:return{...e,network:t.payload.network};case de.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case de.SET_SUPPORTED_TOP_UPS:return{...e,supportedTopUps:{isSwapEnabled:t.payload.supportedTopUps.isSwapEnabled??!0,isOnRampEnabled:t.payload.supportedTopUps.isOnRampEnabled??!0,isBridgeEnabled:t.payload.supportedTopUps.isBridgeEnabled??!0,isSwapAvailable:t.payload.supportedTopUps.isSwapAvailable??!0}};default:return e}},he=async(e,n)=>{const a=await e.getTokenAllowList({type:t.ALL,chainId:n}),o=new Set;return a.tokens.forEach((e=>{o.add(e.symbol)})),Array.from(o)},Le={display:"flex",flexDirection:"row",justifyContent:"space-between",paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"},Ce={display:"flex",direction:"row",columnGap:"base.spacing.x1",alignItems:"center"},ke={height:"base.icon.size.250",width:"base.icon.size.250",minWidth:"base.icon.size.250",fill:"base.color.accent.4",cursor:"pointer"};var fe;function we(t){const{t:d}=n(),{viewDispatch:p}=e.useContext(a),{totalBalance:u,loading:h}=t;return o(s,{sx:Le,children:[o(s,{sx:Ce,children:[i(r,{size:"medium",children:d("views.WALLET_BALANCES.totalTokenBalance.heading")}),i(s,{sx:{pl:"base.spacing.x1"},children:i(l,{testId:"coin-info-icon",variant:"tertiary",icon:"Information",sx:ke,onClick:()=>p({payload:{type:c.UPDATE_VIEW,view:{type:fe.COIN_INFO}}})})})]}),o(s,{sx:Ce,children:[i(r,{testId:"total-token-balance-value",weight:"bold",shimmer:h?1:0,shimmerSx:{minw:"100px"},children:d("views.WALLET_BALANCES.totalTokenBalance.totalHeading")}),!h&&o(r,{testId:"total-token-balance",weight:"bold",children:["≈ USD $",u.toFixed(2)]})]})]})}!function(e){e.WALLET_BALANCES="WALLET_BALANCES",e.SETTINGS="SETTINGS",e.COIN_INFO="COIN_INFO",e.SUCCESS="SUCCESS",e.FAIL="FAIL"}(fe||(fe={}));const be=e=>({display:e?"":"none"});function Ee({balanceInfo:n,theme:a,bridgeToL2OnClick:s}){const{connectLoaderState:r}=e.useContext(d),{track:l}=p(),{checkout:c,provider:y}=r,S=`≈ USD $${u(n.fiatAmount)}`,{walletState:x}=e.useContext(pe),{supportedTopUps:I,network:A}=x,[v,_]=e.useState(),[N,B]=e.useState(),[O,W]=e.useState(),{eventTargetState:{eventTarget:M}}=e.useContext(h),[D,F]=e.useState([]),R=L(y);e.useEffect((()=>{(async()=>{if(!c)return;const e=await c.getTokenAllowList({type:t.ONRAMP,chainId:C(c.config)});F(e.tokens)})()}),[c]),e.useEffect((()=>{if(!A||!I||!c)return;const e=A.chainId===C(c.config)&&(I?.isOnRampEnabled??!0);_(e);const t=(A.chainId===k(c.config)||A.chainId===C(c.config))&&(I?.isBridgeEnabled??!0);B(t);const n=A.chainId===C(c.config)&&(I?.isSwapEnabled??!0)&&(I?.isSwapAvailable??!0);W(n)}),[A,I,c,R]);const P=e.useMemo((()=>Boolean(v&&D.length>0&&D.find((e=>e.address?.toLowerCase()===n.address?.toLowerCase())))),[v,D]);return o(w,{testId:`balance-item-${n.symbol}`,emphasized:!0,children:[i(w.FramedImage,{imageUrl:n.icon,defaultImageUrl:f(c?.config.environment,a),circularFrame:!0}),i(w.Label,{children:n.symbol}),i(w.Caption,{children:n.description}),i(w.PriceDisplay,{testId:`balance-item-${n.symbol}`,use:i(b,{size:"xSmall"}),price:E(n.balance),fiatAmount:S}),(v||O||N)&&o(w.OverflowPopoverMenu,{size:"small",testId:"token-menu",onClick:()=>{l({userJourney:m.WALLET,screen:"WalletBalances",control:"BalanceItem",controlType:"Button",extras:{tokenSymbol:n.symbol,tokenAddress:n.address}})},children:[o(w,{testId:"balance-item-add-option",sx:be(P),onClick:()=>{l({userJourney:m.WALLET,screen:"WalletBalances",control:"AddTokens",controlType:"Button",extras:{tokenSymbol:n.symbol,tokenAddress:n.address}}),T.sendRequestOnrampEvent(M,g.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:n.address??"",amount:""})},children:[i(w.Icon,{icon:"Add"}),i(w.Label,{children:`Add ${n.symbol}`})]}),o(w,{testId:"balance-item-swap-option",sx:be(O),onClick:()=>{l({userJourney:m.WALLET,screen:"WalletBalances",control:"SwapTokens",controlType:"Button",extras:{tokenSymbol:n.symbol,tokenAddress:n.address}}),T.sendRequestSwapEvent(M,g.IMTBL_WALLET_WIDGET_EVENT,{fromTokenAddress:n.address??"",toTokenAddress:"",amount:""})},children:[i(w.Icon,{icon:"Exchange"}),i(w.Label,{children:`Swap ${n.symbol}`})]}),o(w,{testId:"balance-item-move-option",sx:be(N),onClick:()=>{l({userJourney:m.WALLET,screen:"WalletBalances",control:"MoveTokens",controlType:"Button",extras:{tokenSymbol:n.symbol,tokenAddress:n.address}}),s(n.address)},children:[i(w.Icon,{icon:"Minting"}),i(w.Label,{children:`Move ${n.symbol}`})]})]})]})}const me={width:"100%",height:"100%",display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},Te={width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},ge=e=>e.filter((e=>e.balance!==y||S(e.address)));function ye({balanceInfoItems:e,theme:t,bridgeToL2OnClick:a}){const{t:l}=n(),c=ge(e);return o(s,{sx:me,children:[0===c.length&&i(s,{sx:Te,children:i(r,{testId:"no-tokens-found",children:l("views.WALLET_BALANCES.tokenBalancesList.noTokensFound")})}),c.map((e=>i(Ee,{balanceInfo:e,bridgeToL2OnClick:a,theme:t},e.id)))]})}const Se={display:"flex",flexDirection:"column",alignItems:"flex-start",paddingTop:"base.spacing.x4"},xe={fontWeight:"base.text.caption.small.bold.fontWeight",borderColor:"base.color.translucent.emphasis.1000",borderStyle:"solid",borderWidth:"base.border.size.200"},Ie={fontWeight:"base.text.caption.small.bold.fontWeight"},Ae=(e,t)=>({paddingRight:"base.spacing.x1",width:"22px",fill:t?e:"base.color.brand.4"}),ve={paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"};function _e(){const{t:t}=n(),{connectLoaderState:l}=e.useContext(d),{eventTargetState:{eventTarget:u}}=e.useContext(h),{checkout:L,provider:C}=l,{viewDispatch:k}=e.useContext(a),{walletState:f,walletDispatch:w}=e.useContext(pe),{network:b}=f,[E,T]=e.useState([]),{track:g}=p(),y=e.useCallback((async e=>{if(L&&C&&b&&b.chainId!==e){g({userJourney:m.WALLET,screen:"WalletBalances",control:"SwitchNetwork",controlType:"Button",extras:{chainId:e}});try{const t=await L.switchNetwork({provider:C,chainId:e});x(u,t.provider,t.network)}catch(e){e.type===I.USER_REJECTED_REQUEST_ERROR||k({payload:{type:c.UPDATE_VIEW,view:{type:A.ERROR_VIEW,error:e}}})}}}),[L,C,b,w,k]);return e.useEffect((()=>{(async()=>{if(L){const e=await L.getNetworkAllowList({type:v.ALL});T(e?.networks??[])}else T([])})()}),[L]),o(s,{testId:"network-menu",sx:Se,children:[i(r,{testId:"network-heading",size:"medium",sx:ve,children:t("views.WALLET_BALANCES.networkStatus.heading")}),i(ie,{children:L&&E?.sort(((e,t)=>_(e,t,L.config))).map((e=>o(ie.Button,{testId:`${e.name}-network-button`,sx:e.chainId===b?.chainId?xe:Ie,size:"small",onClick:()=>y(e.chainId),children:[i(N.Icon,{icon:B[e.chainId],iconVariant:"bold",sx:Ae(O[e.chainId],e.chainId===b?.chainId)}),e.name]},e.chainId)))})]})}const Ne={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x2",flex:1},Be={backgroundColor:"base.color.neutral.800",paddingX:"base.spacing.x1",borderRadius:"base.borderRadius.x6",flex:1},Oe={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},We=(e,t)=>{let n=460;e&&(n-=104),t&&(n-=98);return{height:`${n}px`,overflowY:"auto",borderRadius:"base.borderRadius.x6"}},Me=(e,t,n)=>n?`${e.toString()}-${t.toLowerCase()}-${n.toLowerCase()}`:`${e.toString()}-${t.toLowerCase()}`,De=(e,t,n)=>t.map((t=>({id:Me(e,t.token.symbol,t.token.address),balance:t.formattedBalance,fiatAmount:F(t.formattedBalance,t.token.symbol,n),symbol:t.token.symbol,address:t.token.address,description:t.token.name,icon:t.token.icon})));function Fe({balancesLoading:t,theme:r,showNetworkMenu:u}){const{t:k}=n(),{connectLoaderState:f}=e.useContext(d),{checkout:b,provider:E}=f,{cryptoFiatState:y,cryptoFiatDispatch:S}=e.useContext(ne),{walletState:x}=e.useContext(pe),{eventTargetState:{eventTarget:I}}=e.useContext(h),{viewDispatch:v}=e.useContext(a),[_,N]=e.useState(0),{network:B,supportedTopUps:O,tokenBalances:W}=x,{conversions:M}=y,D=!L(E)&&u,{track:F,page:j}=p(),z=e.useMemo((()=>De(B?.chainId,W,M)),[W,M,B?.chainId]);e.useEffect((()=>{j({userJourney:m.WALLET,screen:"WalletBalances"})}),[]),e.useEffect((()=>{(async()=>{if(!b)return;if(!S)return;if(!B)return;const e=await he(b,B.chainId);S({payload:{type:ae.SET_TOKEN_SYMBOLS,tokenSymbols:e}})})()}),[b,S,B?.chainId]),e.useEffect((()=>{let e=0;z.forEach((t=>{const n=parseFloat(t.fiatAmount);Number.isNaN(n)||(e+=n)})),N(e)}),[z]);const G=e.useMemo((()=>!(!b||!B)&&(B.chainId===C(b.config)&&Boolean(O?.isBridgeEnabled||O?.isSwapEnabled||O?.isOnRampEnabled))),[b,B,O]);return i(V,{testId:"wallet-balances",header:i(R,{title:k("views.WALLET_BALANCES.header.title"),rightActions:i(l,{icon:"SettingsCog",sx:P(),iconVariant:"bold",onClick:()=>{F({userJourney:m.WALLET,screen:"WalletBalances",control:"Settings",controlType:"Button"}),v({payload:{type:c.UPDATE_VIEW,view:{type:fe.SETTINGS}}})},testId:"settings-button"}),onCloseButtonClick:()=>Z(I)}),footer:i(U,{}),children:o(s,{sx:Ne,children:[o(s,{sx:Be,children:[D&&i(_e,{}),i(we,{totalBalance:_,loading:t}),o(s,{sx:We(D,G),children:[t&&o(s,{sx:Oe,children:[i(w,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),i(w,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"}),i(w,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--3"})]}),!t&&i(ye,{balanceInfoItems:z,bridgeToL2OnClick:e=>{T.sendRequestBridgeEvent(I,g.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:e??"",amount:""})},theme:r})]})]}),G&&o(w,{testId:"add-coins",emphasized:!0,onClick:()=>{F({userJourney:m.WALLET,screen:"WalletBalances",control:"AddCoins",controlType:"Button"}),v({payload:{type:c.UPDATE_VIEW,view:{type:A.TOP_UP_VIEW}}})},children:[i(w.FramedIcon,{icon:"Add"}),i(w.Label,{children:k("views.WALLET_BALANCES.addCoins")})]})]})})}const Re={width:"100%",height:"88px",display:"flex",flexDirection:"row",justifyContent:"space-between",padding:"24px 11px 24px 32px",backgroundColor:"base.color.translucent.emphasis.400",borderRadius:"base.borderRadius.x6"},Pe={width:"100%",display:"flex"},Ze={width:"318px",display:"flex",flexDirection:"column"},Ue={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},Ve={background:"base.color.status.success.bright",fill:"base.color.status.success.bright"};function je({textToCopy:t}){const[n,a]=e.useState(!1),{track:o}=p();return i(s,{children:t&&i(s,{sx:{cursor:"pointer"},children:i(l,{sx:n?Ve:{},onClick:()=>{null!=t&&(o({userJourney:m.WALLET,screen:"Settings",control:"CopyWalletAddress",controlType:"Button"}),navigator.clipboard.writeText(t)),a(!0),setTimeout((()=>{a(!1)}),3e3)},size:"small",icon:n?"Tick":"CopyText"})})})}function ze({provider:t}){const[n,a]=e.useState("");return e.useEffect((()=>{t&&(async()=>{const e=await t.getSigner().getAddress();a(e)})()}),[t]),i(s,{sx:Re,children:o(s,{sx:Pe,children:[o(s,{sx:Ze,children:[i(b,{size:"xSmall",children:"Wallet address"}),i(r,{testId:"wallet-address",size:"xSmall",sx:Ue,children:n})]}),i(je,{textToCopy:n})]})})}const Ge={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x4"},$e={marginTop:"32px"};function Je({showDisconnectButton:t}){const{t:a}=n(),{connectLoaderState:r}=e.useContext(d),{provider:l}=r,{eventTargetState:{eventTarget:c}}=e.useContext(h),{ethereumProvider:u}=j(),{page:L}=p();e.useEffect((()=>{L({userJourney:m.WALLET,screen:"Settings"})}),[]);return i(V,{testId:"wallet-balances",header:i(R,{showBack:!0,title:a("views.SETTINGS.header.title"),onCloseButtonClick:()=>Z(c)}),footer:i(U,{}),children:o(s,{sx:Ge,children:[i(ze,{provider:l}),t&&i(N,{testId:"disconnect-button",variant:"secondary",sx:$e,onClick:()=>{(async()=>{if(G(l))try{if(l.provider?.session){const e=l.provider?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>u?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}return void await l.provider.disconnect()}if(u){const e=u?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>u?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}await u.disconnect()}}catch(e){console.error(e)}})().then((()=>{z(c)}))},children:a("views.SETTINGS.disconnectButton.label")})]})})}function Ke(){return i(s,{sx:{...$,background:"base.color.translucent.emphasis.100"},children:i(s,{sx:{...J,...K},children:o("svg",{width:"430",height:"211",viewBox:"0 0 430 211",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i("path",{d:"M213 120C132.857 120 65.7181 139.009 1 175.641V211H431V178.515C365.165 140.107 295.216 120 213 120Z",fill:"url(#paint0_linear_4525_125520)"}),i("path",{d:"M428.5 210.5H383C383 123 114 113.5 236 120.5C333.6 126.1 405 163.833 428.5 182V210.5Z",fill:"#2D0034",fillOpacity:"0.2"}),i("path",{d:"M131.005 34.0566L130.576 32.4244L128.944 32.8537L129.373 34.4858L131.005 34.0566Z",fill:"white"}),i("path",{d:"M77.1152 45.7678L76.5627 43.6667L74.4617 44.2193L75.0142 46.3203L77.1152 45.7678Z",fill:"white"}),i("path",{d:"M264.238 30.1945L262.093 29.8494L261.748 31.9942L263.893 32.3394L264.238 30.1945Z",fill:"white"}),i("path",{d:"M348.157 2.3323L348.776 1.04626L347.49 0.427149L346.871 1.71319L348.157 2.3323Z",fill:"white"}),i("path",{d:"M342.606 56.5062L342.054 54.4052L339.953 54.9577L340.505 57.0587L342.606 56.5062Z",fill:"white"}),i("path",{d:"M348.381 55.0847L349 53.7986L347.714 53.1795L347.095 54.4656L348.381 55.0847Z",fill:"white"}),i("path",{d:"M107.606 18.8096L106.681 17.7229L105.594 18.6483L106.52 19.735L107.606 18.8096Z",fill:"white"}),i("path",{d:"M233.14 2.3323L233.759 1.04626L232.473 0.427149L231.854 1.71319L233.14 2.3323Z",fill:"white"}),i("path",{d:"M2.97844e-07 176.149C62.5366 139.802 135.143 119 212.584 119C292.029 119 366.384 140.892 430 179",stroke:"black"}),i("path",{d:"M70.97 142.773C76.3142 146.15 87.6289 137.839 96.242 124.208C104.855 110.578 107.505 96.7911 102.161 93.414C96.8167 90.037 85.5021 98.3487 76.889 111.979C68.2758 125.609 65.6258 139.396 70.97 142.773Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M76.8602 112.001C79.353 108.055 82.0686 104.564 84.8088 101.664L94.3989 126.977C86.0698 138.949 75.925 145.933 70.9515 142.793C65.6033 139.413 68.2536 125.631 76.8692 111.994L76.8602 112.001Z",fill:"black"}),i("path",{d:"M96.2211 124.237C104.836 110.608 107.486 96.8249 102.138 93.4455L109.009 97.785C114.357 101.164 111.707 114.947 103.092 128.576C94.4778 142.205 83.1639 150.512 77.8146 147.141L70.9434 142.801C76.2916 146.181 87.6066 137.866 96.2211 124.237Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M98.2141 120.884C99.3274 118.901 100.309 116.925 101.153 115.003L108.025 119.342C107.181 121.264 106.2 123.233 105.085 125.224L98.2141 120.884Z",fill:"#F191FA"}),i("path",{d:"M102.311 112.191C104.156 107.325 105.052 102.898 104.877 99.4899L111.748 103.829C111.923 107.238 111.035 111.665 109.182 116.531L102.311 112.191Z",fill:"black"}),i("path",{d:"M96.2211 124.237C104.836 110.608 107.486 96.8249 102.138 93.4455L109.009 97.785C114.357 101.164 111.707 114.947 103.092 128.576C94.4778 142.205 83.1639 150.512 77.8146 147.141L70.9434 142.801C76.2916 146.181 87.6066 137.866 96.2211 124.237Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M341.833 142.899C353.278 131.542 356.039 115.768 348 107.668C339.962 99.5669 324.167 102.207 312.723 113.564C301.278 124.921 298.517 140.695 306.555 148.795C314.594 156.896 330.388 154.256 341.833 142.899Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M341.813 142.853C353.26 131.495 356.014 115.719 347.977 107.616L352.129 111.801C360.166 119.903 357.412 135.68 345.965 147.037C334.519 158.395 318.726 161.037 310.688 152.934L306.536 148.75C314.574 156.852 330.375 154.211 341.813 142.853Z",fill:"#96DAF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M344.451 139.969C345.913 138.216 347.189 136.39 348.264 134.524L352.416 138.709C351.341 140.575 350.065 142.4 348.603 144.153L344.451 139.969Z",fill:"#D8EFF4"}),i("path",{d:"M349.72 131.746C352.022 126.818 352.967 121.785 352.442 117.302L356.594 121.486C357.119 125.97 356.174 131.002 353.872 135.93L349.72 131.746Z",fill:"black"}),i("path",{d:"M341.813 142.853C353.26 131.495 356.014 115.719 347.977 107.616L352.129 111.801C360.166 119.903 357.412 135.68 345.965 147.037C334.519 158.395 318.726 161.037 310.688 152.934L306.536 148.75C314.574 156.852 330.375 154.211 341.813 142.853Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M155.769 157.057C169.703 165.169 185.654 163.751 191.396 153.888C197.138 144.026 190.497 129.454 176.563 121.342C162.629 113.229 146.679 114.648 140.937 124.51C135.195 134.373 141.836 148.944 155.769 157.057Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M155.809 157.026C169.744 165.14 185.695 163.714 191.439 153.852L188.473 158.946C182.729 168.808 166.778 170.234 152.843 162.12C138.908 154.006 132.266 139.436 138.01 129.574L140.976 124.48C135.232 134.342 141.876 148.919 155.809 157.026Z",fill:"#96DAF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M159.278 158.826C161.349 159.785 163.443 160.544 165.524 161.099L162.558 166.193C160.477 165.639 158.383 164.879 156.311 163.921L159.278 158.826Z",fill:"#D8EFF4"}),i("path",{d:"M168.585 161.786C173.941 162.733 179.047 162.342 183.241 160.674L180.275 165.768C176.08 167.436 170.975 167.827 165.619 166.88L168.585 161.786Z",fill:"black"}),i("path",{d:"M155.809 157.026C169.744 165.14 185.695 163.714 191.439 153.852L188.473 158.946C182.729 168.808 166.778 170.234 152.843 162.12C138.908 154.006 132.266 139.436 138.01 129.574L140.976 124.48C135.232 134.342 141.876 148.919 155.809 157.026Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M234.03 133.525C249.631 129.452 260.983 121.192 259.386 115.075C257.79 108.959 243.848 107.301 228.248 111.374C212.647 115.446 201.294 123.706 202.891 129.823C204.488 135.94 218.429 137.597 234.03 133.525Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M234.031 133.533C249.63 129.462 260.98 121.198 259.388 115.083L261.44 122.943C263.04 129.058 251.682 137.322 236.083 141.393C220.484 145.464 206.542 143.808 204.942 137.685L202.89 129.825C204.49 135.94 218.433 137.604 234.031 133.533Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M237.663 132.44C239.836 131.754 241.896 130.986 243.826 130.154L245.878 138.014C243.948 138.838 241.888 139.606 239.715 140.3L237.663 132.44Z",fill:"#F191FA"}),i("path",{d:"M246.588 128.896C251.257 126.601 254.941 123.976 257.13 121.367L259.182 129.227C256.985 131.836 253.309 134.461 248.64 136.756L246.588 128.896Z",fill:"black"}),i("path",{d:"M234.031 133.533C249.63 129.462 260.98 121.198 259.388 115.083L261.44 122.943C263.04 129.058 251.682 137.322 236.083 141.393C220.484 145.464 206.542 143.808 204.942 137.685L202.89 129.825C204.49 135.94 218.433 137.604 234.031 133.533Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M189.995 60.1335C175.063 54.0502 161.025 53.8648 158.64 59.7194C156.255 65.5739 166.426 75.2515 181.358 81.3348C196.29 87.418 210.328 87.6034 212.713 81.7488C215.098 75.8943 204.927 66.2167 189.995 60.1335Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M181.375 81.3031C196.307 87.3891 210.345 87.5729 212.731 81.7174L209.667 89.2437C207.281 95.0992 193.243 94.9154 178.311 88.8293C163.379 82.7433 153.208 73.0653 155.594 67.2098L158.658 59.6835C156.272 65.5391 166.443 75.217 181.375 81.3031Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M185.032 82.6694C187.186 83.4191 189.294 84.0389 191.339 84.5366L188.275 92.0629C186.23 91.5652 184.122 90.9454 181.968 90.1957L185.032 82.6694Z",fill:"#96DAF4"}),i("path",{d:"M194.301 85.1776C199.418 86.1391 203.932 86.2438 207.256 85.4671L204.192 92.9934C200.868 93.762 196.353 93.6654 191.237 92.7038L194.301 85.1776Z",fill:"black"}),i("path",{d:"M181.375 81.3031C196.307 87.3891 210.345 87.5729 212.731 81.7174L209.667 89.2437C207.281 95.0992 193.243 94.9154 178.311 88.8293C163.379 82.7433 153.208 73.0653 155.594 67.2098L158.658 59.6835C156.272 65.5391 166.443 75.217 181.375 81.3031Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M331.022 121.427C326.722 126.062 313.654 120.93 301.833 109.965C290.012 99 283.915 86.3538 288.214 81.719C292.513 77.0841 305.581 82.2158 317.402 93.1808C329.223 104.146 335.321 116.792 331.022 121.427Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M317.436 93.1948C314.014 90.0206 310.494 87.3431 307.102 85.2426L304.325 112.168C315.446 121.604 327.043 125.752 331.044 121.441C335.347 116.803 329.25 104.162 317.425 93.1905L317.436 93.1948Z",fill:"black"}),i("path",{d:"M301.861 109.987C290.039 99.0235 283.942 86.3817 288.244 81.7437L282.716 87.7004C278.413 92.3385 284.51 104.98 296.332 115.944C308.154 126.907 321.22 132.035 325.526 127.404L331.054 121.447C326.752 126.085 313.683 120.951 301.861 109.987Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M299.075 107.258C297.49 105.627 296.034 103.969 294.725 102.327L289.197 108.284C290.506 109.926 291.959 111.577 293.546 113.215L299.075 107.258Z",fill:"#F191FA"}),i("path",{d:"M292.885 99.9066C289.854 95.6761 287.853 91.6272 287.147 88.2883L281.619 94.2451C282.324 97.584 284.318 101.636 287.357 105.863L292.885 99.9066Z",fill:"black"}),i("path",{d:"M301.861 109.987C290.039 99.0235 283.942 86.3817 288.244 81.7437L282.716 87.7004C278.413 92.3385 284.51 104.98 296.332 115.944C308.154 126.907 321.22 132.035 325.526 127.404L331.054 121.447C326.752 126.085 313.683 120.951 301.861 109.987Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("defs",{children:o("linearGradient",{id:"paint0_linear_4525_125520",x1:"191",y1:"124.403",x2:"247.716",y2:"304.676",gradientUnits:"userSpaceOnUse",children:[i("stop",{stopColor:"#AD48BA"}),i("stop",{offset:"0.65625",stopColor:"#D178FF",stopOpacity:"0.24"})]})})]})})})}function He(){const{t:t}=n(),{connectLoaderState:{provider:a}}=e.useContext(d),s=L(a),{page:r}=p();return e.useEffect((()=>{r({userJourney:m.WALLET,screen:"CoinInfo"})}),[]),o(V,{testId:"coin-info",header:i(R,{showBack:!0,transparent:!0}),footer:i(U,{}),heroContent:i(Ke,{}),floatHeader:!0,children:[!s&&i(H,{heading:t("views.COIN_INFO.metamask.heading"),children:t("views.COIN_INFO.metamask.body")}),s&&o(H,{heading:t("views.COIN_INFO.passport.heading"),children:[t("views.COIN_INFO.passport.body1"),i(Y,{onClick:()=>window.open(X),children:t("views.COIN_INFO.passport.linkText")}),t("views.COIN_INFO.passport.body2")]})]})}const Xe=({checkout:t,provider:n,refreshCallback:a,errorCallback:o})=>{const[s,i]=e.useState(!0),r=e.useCallback((async(e=!1)=>{if(t&&n)try{const o=await t.getNetworkInfo({provider:n});if(!o.isSupported)return;e||i(!0);const s=await(async(e,t,n)=>{if(!e||!t||!n)return[];const a=await t.getSigner().getAddress(),o=await re((()=>e.getAllBalances({provider:t,walletAddress:a,chainId:n})),W);return o?M(e.config,o.balances,n).map((t=>({...t,token:{...t.token,icon:D(e.config.environment,S(t.token.address)?t.token.symbol:t.token.address??"")}}))):[]})(t,n,o.chainId);e||i(!1),a(s)}catch(t){W.nonRetryable(t)&&o(t),e||i(!1)}}),[t,n]);return le((()=>r(!0)),3e4),{balancesLoading:s,refreshBalances:r}};function Ye(t){const{t:s}=n(),r=s("views.ERROR_VIEW.actionText"),l=s("views.LOADING_VIEW.text"),{eventTargetState:{eventTarget:p}}=e.useContext(h),{config:{environment:u,isOnRampEnabled:L,isSwapEnabled:C,isBridgeEnabled:k,theme:f},walletConfig:{showDisconnectButton:w,showNetworkMenu:b}}=t,{connectLoaderState:{checkout:E,provider:T}}=e.useContext(d),[y,S]=e.useReducer(q,{...Q,history:[]}),[x,I]=e.useReducer(ue,{...ce,walletConfig:{showDisconnectButton:w,showNetworkMenu:b}}),v=e.useMemo((()=>({walletState:x,walletDispatch:I})),[x,I]),_=e.useMemo((()=>({viewState:y,viewDispatch:S})),[y,S]),{balancesLoading:N,refreshBalances:B}=Xe({checkout:E,provider:T,refreshCallback:e=>{I({payload:{type:de.SET_TOKEN_BALANCES,tokenBalances:e}})},errorCallback:e=>{console.error(e),S({payload:{type:c.UPDATE_VIEW,view:{type:A.ERROR_VIEW,error:new Error("Unable to fetch balances")}}})}});e.useEffect((()=>{(async()=>{if(!E)return;let e;try{e=await E.isSwapAvailable()}catch(t){e=!1}I({payload:{type:de.SET_SUPPORTED_TOP_UPS,supportedTopUps:{isBridgeEnabled:k,isSwapEnabled:C,isOnRampEnabled:L,isSwapAvailable:e}}})})()}),[k,C,L,u]);const O=async()=>{if(E&&T)try{const e=await E.getNetworkInfo({provider:T});if(!e.isSupported)return;B(),S({payload:{type:c.UPDATE_VIEW,view:{type:fe.WALLET_BALANCES}}}),I({payload:{type:de.SET_NETWORK,network:e}})}catch(e){console.error(e),S({payload:{type:c.UPDATE_VIEW,view:{type:A.ERROR_VIEW,error:e}}})}};e.useEffect((()=>{E&&T&&O()}),[E,T]);return i(a.Provider,{value:_,children:i(oe,{environment:u,children:o(pe.Provider,{value:v,children:[y.view.type===A.LOADING_VIEW&&i(ee,{loadingText:l}),y.view.type===fe.WALLET_BALANCES&&i(Fe,{balancesLoading:N,theme:f,showNetworkMenu:b}),y.view.type===fe.SETTINGS&&i(Je,{showDisconnectButton:w}),y.view.type===fe.COIN_INFO&&i(He,{}),y.view.type===A.ERROR_VIEW&&i(te,{actionText:r,onActionClick:async()=>{S({payload:{type:c.UPDATE_VIEW,view:{type:fe.WALLET_BALANCES}}}),await O()},onCloseClick:()=>Z(p)}),y.view.type===A.TOP_UP_VIEW&&i(se,{analytics:{userJourney:m.WALLET},widgetEvent:g.IMTBL_WALLET_WIDGET_EVENT,checkout:E,provider:T,showOnrampOption:L,showSwapOption:C,showBridgeOption:k,onCloseButtonClick:()=>Z(p)})]})})})}export{Ye as default};
1
+ import{r as e,T as t,u as n,V as a,j as o,B as s,a as i,b as r,c as l,d as c,C as d,e as p,f as u,E as h,i as L,g as C,h as k,k as f,M as w,H as b,t as E,U as m,o as T,I as g,Z as y,l as S,s as x,m as I,S as A,N as v,n as _,p as N,q as B,v as O,D as W,w as M,x as D,y as F,z as R,A as P,F as Z,G as U,J as V,K as j,L as z,O as G,P as $,Q as J,R as K,W as H,X,Y,_ as q,$ as Q,a0 as ee,a1 as te}from"./index-9493d2b3.js";import{C as ne,a as ae,b as oe,T as se}from"./TopUpView-49db4e0c.js";import{H as ie}from"./HorizontalMenu-b27619a9.js";import{r as re,u as le}from"./retry-427ffe34.js";const ce={walletProviderName:null,network:null,tokenBalances:[],supportedTopUps:null,walletConfig:{showDisconnectButton:!0,showNetworkMenu:!0}};var de;!function(e){e.SET_WALLET_PROVIDER_NAME="SET_WALLET_PROVIDER_NAME",e.SET_NETWORK="SET_NETWORK",e.SET_TOKEN_BALANCES="SET_TOKEN_BALANCES",e.SET_SUPPORTED_TOP_UPS="SUPPORTED_TOP_UPS"}(de||(de={}));const pe=e.createContext({walletState:ce,walletDispatch:()=>{}});pe.displayName="WalletContext";const ue=(e,t)=>{switch(t.payload.type){case de.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case de.SET_NETWORK:return{...e,network:t.payload.network};case de.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case de.SET_SUPPORTED_TOP_UPS:return{...e,supportedTopUps:{isSwapEnabled:t.payload.supportedTopUps.isSwapEnabled??!0,isOnRampEnabled:t.payload.supportedTopUps.isOnRampEnabled??!0,isBridgeEnabled:t.payload.supportedTopUps.isBridgeEnabled??!0,isSwapAvailable:t.payload.supportedTopUps.isSwapAvailable??!0}};default:return e}},he=async(e,n)=>{const a=await e.getTokenAllowList({type:t.ALL,chainId:n}),o=new Set;return a.tokens.forEach((e=>{o.add(e.symbol)})),Array.from(o)},Le={display:"flex",flexDirection:"row",justifyContent:"space-between",paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"},Ce={display:"flex",direction:"row",columnGap:"base.spacing.x1",alignItems:"center"},ke={height:"base.icon.size.250",width:"base.icon.size.250",minWidth:"base.icon.size.250",fill:"base.color.accent.4",cursor:"pointer"};var fe;function we(t){const{t:d}=n(),{viewDispatch:p}=e.useContext(a),{totalBalance:u,loading:h}=t;return o(s,{sx:Le,children:[o(s,{sx:Ce,children:[i(r,{size:"medium",children:d("views.WALLET_BALANCES.totalTokenBalance.heading")}),i(s,{sx:{pl:"base.spacing.x1"},children:i(l,{testId:"coin-info-icon",variant:"tertiary",icon:"Information",sx:ke,onClick:()=>p({payload:{type:c.UPDATE_VIEW,view:{type:fe.COIN_INFO}}})})})]}),o(s,{sx:Ce,children:[i(r,{testId:"total-token-balance-value",weight:"bold",shimmer:h?1:0,shimmerSx:{minw:"100px"},children:d("views.WALLET_BALANCES.totalTokenBalance.totalHeading")}),!h&&o(r,{testId:"total-token-balance",weight:"bold",children:["≈ USD $",u.toFixed(2)]})]})]})}!function(e){e.WALLET_BALANCES="WALLET_BALANCES",e.SETTINGS="SETTINGS",e.COIN_INFO="COIN_INFO",e.SUCCESS="SUCCESS",e.FAIL="FAIL"}(fe||(fe={}));const be=e=>({display:e?"":"none"});function Ee({balanceInfo:n,theme:a,bridgeToL2OnClick:s}){const{connectLoaderState:r}=e.useContext(d),{track:l}=p(),{checkout:c,provider:y}=r,S=`≈ USD $${u(n.fiatAmount)}`,{walletState:x}=e.useContext(pe),{supportedTopUps:I,network:A}=x,[v,_]=e.useState(),[N,B]=e.useState(),[O,W]=e.useState(),{eventTargetState:{eventTarget:M}}=e.useContext(h),[D,F]=e.useState([]),R=L(y);e.useEffect((()=>{(async()=>{if(!c)return;const e=await c.getTokenAllowList({type:t.ONRAMP,chainId:C(c.config)});F(e.tokens)})()}),[c]),e.useEffect((()=>{if(!A||!I||!c)return;const e=A.chainId===C(c.config)&&(I?.isOnRampEnabled??!0);_(e);const t=(A.chainId===k(c.config)||A.chainId===C(c.config))&&(I?.isBridgeEnabled??!0);B(t);const n=A.chainId===C(c.config)&&(I?.isSwapEnabled??!0)&&(I?.isSwapAvailable??!0);W(n)}),[A,I,c,R]);const P=e.useMemo((()=>Boolean(v&&D.length>0&&D.find((e=>e.address?.toLowerCase()===n.address?.toLowerCase())))),[v,D]);return o(w,{testId:`balance-item-${n.symbol}`,emphasized:!0,children:[i(w.FramedImage,{imageUrl:n.icon,defaultImageUrl:f(c?.config.environment,a),circularFrame:!0}),i(w.Label,{children:n.symbol}),i(w.Caption,{children:n.description}),i(w.PriceDisplay,{testId:`balance-item-${n.symbol}`,use:i(b,{size:"xSmall"}),price:E(n.balance),fiatAmount:S}),(v||O||N)&&o(w.OverflowPopoverMenu,{size:"small",testId:"token-menu",onClick:()=>{l({userJourney:m.WALLET,screen:"WalletBalances",control:"BalanceItem",controlType:"Button",extras:{tokenSymbol:n.symbol,tokenAddress:n.address}})},children:[o(w,{testId:"balance-item-add-option",sx:be(P),onClick:()=>{l({userJourney:m.WALLET,screen:"WalletBalances",control:"AddTokens",controlType:"Button",extras:{tokenSymbol:n.symbol,tokenAddress:n.address}}),T.sendRequestOnrampEvent(M,g.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:n.address??"",amount:""})},children:[i(w.Icon,{icon:"Add"}),i(w.Label,{children:`Add ${n.symbol}`})]}),o(w,{testId:"balance-item-swap-option",sx:be(O),onClick:()=>{l({userJourney:m.WALLET,screen:"WalletBalances",control:"SwapTokens",controlType:"Button",extras:{tokenSymbol:n.symbol,tokenAddress:n.address}}),T.sendRequestSwapEvent(M,g.IMTBL_WALLET_WIDGET_EVENT,{fromTokenAddress:n.address??"",toTokenAddress:"",amount:""})},children:[i(w.Icon,{icon:"Exchange"}),i(w.Label,{children:`Swap ${n.symbol}`})]}),o(w,{testId:"balance-item-move-option",sx:be(N),onClick:()=>{l({userJourney:m.WALLET,screen:"WalletBalances",control:"MoveTokens",controlType:"Button",extras:{tokenSymbol:n.symbol,tokenAddress:n.address}}),s(n.address)},children:[i(w.Icon,{icon:"Minting"}),i(w.Label,{children:`Move ${n.symbol}`})]})]})]})}const me={width:"100%",height:"100%",display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},Te={width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},ge=e=>e.filter((e=>e.balance!==y||S(e.address)));function ye({balanceInfoItems:e,theme:t,bridgeToL2OnClick:a}){const{t:l}=n(),c=ge(e);return o(s,{sx:me,children:[0===c.length&&i(s,{sx:Te,children:i(r,{testId:"no-tokens-found",children:l("views.WALLET_BALANCES.tokenBalancesList.noTokensFound")})}),c.map((e=>i(Ee,{balanceInfo:e,bridgeToL2OnClick:a,theme:t},e.id)))]})}const Se={display:"flex",flexDirection:"column",alignItems:"flex-start",paddingTop:"base.spacing.x4"},xe={fontWeight:"base.text.caption.small.bold.fontWeight",borderColor:"base.color.translucent.emphasis.1000",borderStyle:"solid",borderWidth:"base.border.size.200"},Ie={fontWeight:"base.text.caption.small.bold.fontWeight"},Ae=(e,t)=>({paddingRight:"base.spacing.x1",width:"22px",fill:t?e:"base.color.brand.4"}),ve={paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"};function _e(){const{t:t}=n(),{connectLoaderState:l}=e.useContext(d),{eventTargetState:{eventTarget:u}}=e.useContext(h),{checkout:L,provider:C}=l,{viewDispatch:k}=e.useContext(a),{walletState:f,walletDispatch:w}=e.useContext(pe),{network:b}=f,[E,T]=e.useState([]),{track:g}=p(),y=e.useCallback((async e=>{if(L&&C&&b&&b.chainId!==e){g({userJourney:m.WALLET,screen:"WalletBalances",control:"SwitchNetwork",controlType:"Button",extras:{chainId:e}});try{const t=await L.switchNetwork({provider:C,chainId:e});x(u,t.provider,t.network)}catch(e){e.type===I.USER_REJECTED_REQUEST_ERROR||k({payload:{type:c.UPDATE_VIEW,view:{type:A.ERROR_VIEW,error:e}}})}}}),[L,C,b,w,k]);return e.useEffect((()=>{(async()=>{if(L){const e=await L.getNetworkAllowList({type:v.ALL});T(e?.networks??[])}else T([])})()}),[L]),o(s,{testId:"network-menu",sx:Se,children:[i(r,{testId:"network-heading",size:"medium",sx:ve,children:t("views.WALLET_BALANCES.networkStatus.heading")}),i(ie,{children:L&&E?.sort(((e,t)=>_(e,t,L.config))).map((e=>o(ie.Button,{testId:`${e.name}-network-button`,sx:e.chainId===b?.chainId?xe:Ie,size:"small",onClick:()=>y(e.chainId),children:[i(N.Icon,{icon:B[e.chainId],iconVariant:"bold",sx:Ae(O[e.chainId],e.chainId===b?.chainId)}),e.name]},e.chainId)))})]})}const Ne={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x2",flex:1},Be={backgroundColor:"base.color.neutral.800",paddingX:"base.spacing.x1",borderRadius:"base.borderRadius.x6",flex:1},Oe={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},We=(e,t)=>{let n=460;e&&(n-=104),t&&(n-=98);return{height:`${n}px`,overflowY:"auto",borderRadius:"base.borderRadius.x6"}},Me=(e,t,n)=>n?`${e.toString()}-${t.toLowerCase()}-${n.toLowerCase()}`:`${e.toString()}-${t.toLowerCase()}`,De=(e,t,n)=>t.map((t=>({id:Me(e,t.token.symbol,t.token.address),balance:t.formattedBalance,fiatAmount:F(t.formattedBalance,t.token.symbol,n),symbol:t.token.symbol,address:t.token.address,description:t.token.name,icon:t.token.icon})));function Fe({balancesLoading:t,theme:r,showNetworkMenu:u}){const{t:k}=n(),{connectLoaderState:f}=e.useContext(d),{checkout:b,provider:E}=f,{cryptoFiatState:y,cryptoFiatDispatch:S}=e.useContext(ne),{walletState:x}=e.useContext(pe),{eventTargetState:{eventTarget:I}}=e.useContext(h),{viewDispatch:v}=e.useContext(a),[_,N]=e.useState(0),{network:B,supportedTopUps:O,tokenBalances:W}=x,{conversions:M}=y,D=!L(E)&&u,{track:F,page:j}=p(),z=e.useMemo((()=>De(B?.chainId,W,M)),[W,M,B?.chainId]);e.useEffect((()=>{j({userJourney:m.WALLET,screen:"WalletBalances"})}),[]),e.useEffect((()=>{(async()=>{if(!b)return;if(!S)return;if(!B)return;const e=await he(b,B.chainId);S({payload:{type:ae.SET_TOKEN_SYMBOLS,tokenSymbols:e}})})()}),[b,S,B?.chainId]),e.useEffect((()=>{let e=0;z.forEach((t=>{const n=parseFloat(t.fiatAmount);Number.isNaN(n)||(e+=n)})),N(e)}),[z]);const G=e.useMemo((()=>!(!b||!B)&&(B.chainId===C(b.config)&&Boolean(O?.isBridgeEnabled||O?.isSwapEnabled||O?.isOnRampEnabled))),[b,B,O]);return i(V,{testId:"wallet-balances",header:i(R,{title:k("views.WALLET_BALANCES.header.title"),rightActions:i(l,{icon:"SettingsCog",sx:P(),iconVariant:"bold",onClick:()=>{F({userJourney:m.WALLET,screen:"WalletBalances",control:"Settings",controlType:"Button"}),v({payload:{type:c.UPDATE_VIEW,view:{type:fe.SETTINGS}}})},testId:"settings-button"}),onCloseButtonClick:()=>Z(I)}),footer:i(U,{}),children:o(s,{sx:Ne,children:[o(s,{sx:Be,children:[D&&i(_e,{}),i(we,{totalBalance:_,loading:t}),o(s,{sx:We(D,G),children:[t&&o(s,{sx:Oe,children:[i(w,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),i(w,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"}),i(w,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--3"})]}),!t&&i(ye,{balanceInfoItems:z,bridgeToL2OnClick:e=>{T.sendRequestBridgeEvent(I,g.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:e??"",amount:""})},theme:r})]})]}),G&&o(w,{testId:"add-coins",emphasized:!0,onClick:()=>{F({userJourney:m.WALLET,screen:"WalletBalances",control:"AddCoins",controlType:"Button"}),v({payload:{type:c.UPDATE_VIEW,view:{type:A.TOP_UP_VIEW}}})},children:[i(w.FramedIcon,{icon:"Add"}),i(w.Label,{children:k("views.WALLET_BALANCES.addCoins")})]})]})})}const Re={width:"100%",height:"88px",display:"flex",flexDirection:"row",justifyContent:"space-between",padding:"24px 11px 24px 32px",backgroundColor:"base.color.translucent.emphasis.400",borderRadius:"base.borderRadius.x6"},Pe={width:"100%",display:"flex"},Ze={width:"318px",display:"flex",flexDirection:"column"},Ue={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},Ve={background:"base.color.status.success.bright",fill:"base.color.status.success.bright"};function je({textToCopy:t}){const[n,a]=e.useState(!1),{track:o}=p();return i(s,{children:t&&i(s,{sx:{cursor:"pointer"},children:i(l,{sx:n?Ve:{},onClick:()=>{null!=t&&(o({userJourney:m.WALLET,screen:"Settings",control:"CopyWalletAddress",controlType:"Button"}),navigator.clipboard.writeText(t)),a(!0),setTimeout((()=>{a(!1)}),3e3)},size:"small",icon:n?"Tick":"CopyText"})})})}function ze({provider:t}){const[n,a]=e.useState("");return e.useEffect((()=>{t&&(async()=>{const e=await t.getSigner().getAddress();a(e)})()}),[t]),i(s,{sx:Re,children:o(s,{sx:Pe,children:[o(s,{sx:Ze,children:[i(b,{size:"xSmall",children:"Wallet address"}),i(r,{testId:"wallet-address",size:"xSmall",sx:Ue,children:n})]}),i(je,{textToCopy:n})]})})}const Ge={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x4"},$e={marginTop:"32px"};function Je({showDisconnectButton:t}){const{t:a}=n(),{connectLoaderState:r}=e.useContext(d),{provider:l}=r,{eventTargetState:{eventTarget:c}}=e.useContext(h),{ethereumProvider:u}=j(),{page:L}=p();e.useEffect((()=>{L({userJourney:m.WALLET,screen:"Settings"})}),[]);return i(V,{testId:"wallet-balances",header:i(R,{showBack:!0,title:a("views.SETTINGS.header.title"),onCloseButtonClick:()=>Z(c)}),footer:i(U,{}),children:o(s,{sx:Ge,children:[i(ze,{provider:l}),t&&i(N,{testId:"disconnect-button",variant:"secondary",sx:$e,onClick:()=>{(async()=>{if(G(l))try{if(l.provider?.session){const e=l.provider?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>u?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}return void await l.provider.disconnect()}if(u){const e=u?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>u?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}await u.disconnect()}}catch(e){console.error(e)}})().then((()=>{z(c)}))},children:a("views.SETTINGS.disconnectButton.label")})]})})}function Ke(){return i(s,{sx:{...$,background:"base.color.translucent.emphasis.100"},children:i(s,{sx:{...J,...K},children:o("svg",{width:"430",height:"211",viewBox:"0 0 430 211",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i("path",{d:"M213 120C132.857 120 65.7181 139.009 1 175.641V211H431V178.515C365.165 140.107 295.216 120 213 120Z",fill:"url(#paint0_linear_4525_125520)"}),i("path",{d:"M428.5 210.5H383C383 123 114 113.5 236 120.5C333.6 126.1 405 163.833 428.5 182V210.5Z",fill:"#2D0034",fillOpacity:"0.2"}),i("path",{d:"M131.005 34.0566L130.576 32.4244L128.944 32.8537L129.373 34.4858L131.005 34.0566Z",fill:"white"}),i("path",{d:"M77.1152 45.7678L76.5627 43.6667L74.4617 44.2193L75.0142 46.3203L77.1152 45.7678Z",fill:"white"}),i("path",{d:"M264.238 30.1945L262.093 29.8494L261.748 31.9942L263.893 32.3394L264.238 30.1945Z",fill:"white"}),i("path",{d:"M348.157 2.3323L348.776 1.04626L347.49 0.427149L346.871 1.71319L348.157 2.3323Z",fill:"white"}),i("path",{d:"M342.606 56.5062L342.054 54.4052L339.953 54.9577L340.505 57.0587L342.606 56.5062Z",fill:"white"}),i("path",{d:"M348.381 55.0847L349 53.7986L347.714 53.1795L347.095 54.4656L348.381 55.0847Z",fill:"white"}),i("path",{d:"M107.606 18.8096L106.681 17.7229L105.594 18.6483L106.52 19.735L107.606 18.8096Z",fill:"white"}),i("path",{d:"M233.14 2.3323L233.759 1.04626L232.473 0.427149L231.854 1.71319L233.14 2.3323Z",fill:"white"}),i("path",{d:"M2.97844e-07 176.149C62.5366 139.802 135.143 119 212.584 119C292.029 119 366.384 140.892 430 179",stroke:"black"}),i("path",{d:"M70.97 142.773C76.3142 146.15 87.6289 137.839 96.242 124.208C104.855 110.578 107.505 96.7911 102.161 93.414C96.8167 90.037 85.5021 98.3487 76.889 111.979C68.2758 125.609 65.6258 139.396 70.97 142.773Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M76.8602 112.001C79.353 108.055 82.0686 104.564 84.8088 101.664L94.3989 126.977C86.0698 138.949 75.925 145.933 70.9515 142.793C65.6033 139.413 68.2536 125.631 76.8692 111.994L76.8602 112.001Z",fill:"black"}),i("path",{d:"M96.2211 124.237C104.836 110.608 107.486 96.8249 102.138 93.4455L109.009 97.785C114.357 101.164 111.707 114.947 103.092 128.576C94.4778 142.205 83.1639 150.512 77.8146 147.141L70.9434 142.801C76.2916 146.181 87.6066 137.866 96.2211 124.237Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M98.2141 120.884C99.3274 118.901 100.309 116.925 101.153 115.003L108.025 119.342C107.181 121.264 106.2 123.233 105.085 125.224L98.2141 120.884Z",fill:"#F191FA"}),i("path",{d:"M102.311 112.191C104.156 107.325 105.052 102.898 104.877 99.4899L111.748 103.829C111.923 107.238 111.035 111.665 109.182 116.531L102.311 112.191Z",fill:"black"}),i("path",{d:"M96.2211 124.237C104.836 110.608 107.486 96.8249 102.138 93.4455L109.009 97.785C114.357 101.164 111.707 114.947 103.092 128.576C94.4778 142.205 83.1639 150.512 77.8146 147.141L70.9434 142.801C76.2916 146.181 87.6066 137.866 96.2211 124.237Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M341.833 142.899C353.278 131.542 356.039 115.768 348 107.668C339.962 99.5669 324.167 102.207 312.723 113.564C301.278 124.921 298.517 140.695 306.555 148.795C314.594 156.896 330.388 154.256 341.833 142.899Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M341.813 142.853C353.26 131.495 356.014 115.719 347.977 107.616L352.129 111.801C360.166 119.903 357.412 135.68 345.965 147.037C334.519 158.395 318.726 161.037 310.688 152.934L306.536 148.75C314.574 156.852 330.375 154.211 341.813 142.853Z",fill:"#96DAF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M344.451 139.969C345.913 138.216 347.189 136.39 348.264 134.524L352.416 138.709C351.341 140.575 350.065 142.4 348.603 144.153L344.451 139.969Z",fill:"#D8EFF4"}),i("path",{d:"M349.72 131.746C352.022 126.818 352.967 121.785 352.442 117.302L356.594 121.486C357.119 125.97 356.174 131.002 353.872 135.93L349.72 131.746Z",fill:"black"}),i("path",{d:"M341.813 142.853C353.26 131.495 356.014 115.719 347.977 107.616L352.129 111.801C360.166 119.903 357.412 135.68 345.965 147.037C334.519 158.395 318.726 161.037 310.688 152.934L306.536 148.75C314.574 156.852 330.375 154.211 341.813 142.853Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M155.769 157.057C169.703 165.169 185.654 163.751 191.396 153.888C197.138 144.026 190.497 129.454 176.563 121.342C162.629 113.229 146.679 114.648 140.937 124.51C135.195 134.373 141.836 148.944 155.769 157.057Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M155.809 157.026C169.744 165.14 185.695 163.714 191.439 153.852L188.473 158.946C182.729 168.808 166.778 170.234 152.843 162.12C138.908 154.006 132.266 139.436 138.01 129.574L140.976 124.48C135.232 134.342 141.876 148.919 155.809 157.026Z",fill:"#96DAF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M159.278 158.826C161.349 159.785 163.443 160.544 165.524 161.099L162.558 166.193C160.477 165.639 158.383 164.879 156.311 163.921L159.278 158.826Z",fill:"#D8EFF4"}),i("path",{d:"M168.585 161.786C173.941 162.733 179.047 162.342 183.241 160.674L180.275 165.768C176.08 167.436 170.975 167.827 165.619 166.88L168.585 161.786Z",fill:"black"}),i("path",{d:"M155.809 157.026C169.744 165.14 185.695 163.714 191.439 153.852L188.473 158.946C182.729 168.808 166.778 170.234 152.843 162.12C138.908 154.006 132.266 139.436 138.01 129.574L140.976 124.48C135.232 134.342 141.876 148.919 155.809 157.026Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M234.03 133.525C249.631 129.452 260.983 121.192 259.386 115.075C257.79 108.959 243.848 107.301 228.248 111.374C212.647 115.446 201.294 123.706 202.891 129.823C204.488 135.94 218.429 137.597 234.03 133.525Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M234.031 133.533C249.63 129.462 260.98 121.198 259.388 115.083L261.44 122.943C263.04 129.058 251.682 137.322 236.083 141.393C220.484 145.464 206.542 143.808 204.942 137.685L202.89 129.825C204.49 135.94 218.433 137.604 234.031 133.533Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M237.663 132.44C239.836 131.754 241.896 130.986 243.826 130.154L245.878 138.014C243.948 138.838 241.888 139.606 239.715 140.3L237.663 132.44Z",fill:"#F191FA"}),i("path",{d:"M246.588 128.896C251.257 126.601 254.941 123.976 257.13 121.367L259.182 129.227C256.985 131.836 253.309 134.461 248.64 136.756L246.588 128.896Z",fill:"black"}),i("path",{d:"M234.031 133.533C249.63 129.462 260.98 121.198 259.388 115.083L261.44 122.943C263.04 129.058 251.682 137.322 236.083 141.393C220.484 145.464 206.542 143.808 204.942 137.685L202.89 129.825C204.49 135.94 218.433 137.604 234.031 133.533Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M189.995 60.1335C175.063 54.0502 161.025 53.8648 158.64 59.7194C156.255 65.5739 166.426 75.2515 181.358 81.3348C196.29 87.418 210.328 87.6034 212.713 81.7488C215.098 75.8943 204.927 66.2167 189.995 60.1335Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M181.375 81.3031C196.307 87.3891 210.345 87.5729 212.731 81.7174L209.667 89.2437C207.281 95.0992 193.243 94.9154 178.311 88.8293C163.379 82.7433 153.208 73.0653 155.594 67.2098L158.658 59.6835C156.272 65.5391 166.443 75.217 181.375 81.3031Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M185.032 82.6694C187.186 83.4191 189.294 84.0389 191.339 84.5366L188.275 92.0629C186.23 91.5652 184.122 90.9454 181.968 90.1957L185.032 82.6694Z",fill:"#96DAF4"}),i("path",{d:"M194.301 85.1776C199.418 86.1391 203.932 86.2438 207.256 85.4671L204.192 92.9934C200.868 93.762 196.353 93.6654 191.237 92.7038L194.301 85.1776Z",fill:"black"}),i("path",{d:"M181.375 81.3031C196.307 87.3891 210.345 87.5729 212.731 81.7174L209.667 89.2437C207.281 95.0992 193.243 94.9154 178.311 88.8293C163.379 82.7433 153.208 73.0653 155.594 67.2098L158.658 59.6835C156.272 65.5391 166.443 75.217 181.375 81.3031Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M331.022 121.427C326.722 126.062 313.654 120.93 301.833 109.965C290.012 99 283.915 86.3538 288.214 81.719C292.513 77.0841 305.581 82.2158 317.402 93.1808C329.223 104.146 335.321 116.792 331.022 121.427Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M317.436 93.1948C314.014 90.0206 310.494 87.3431 307.102 85.2426L304.325 112.168C315.446 121.604 327.043 125.752 331.044 121.441C335.347 116.803 329.25 104.162 317.425 93.1905L317.436 93.1948Z",fill:"black"}),i("path",{d:"M301.861 109.987C290.039 99.0235 283.942 86.3817 288.244 81.7437L282.716 87.7004C278.413 92.3385 284.51 104.98 296.332 115.944C308.154 126.907 321.22 132.035 325.526 127.404L331.054 121.447C326.752 126.085 313.683 120.951 301.861 109.987Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M299.075 107.258C297.49 105.627 296.034 103.969 294.725 102.327L289.197 108.284C290.506 109.926 291.959 111.577 293.546 113.215L299.075 107.258Z",fill:"#F191FA"}),i("path",{d:"M292.885 99.9066C289.854 95.6761 287.853 91.6272 287.147 88.2883L281.619 94.2451C282.324 97.584 284.318 101.636 287.357 105.863L292.885 99.9066Z",fill:"black"}),i("path",{d:"M301.861 109.987C290.039 99.0235 283.942 86.3817 288.244 81.7437L282.716 87.7004C278.413 92.3385 284.51 104.98 296.332 115.944C308.154 126.907 321.22 132.035 325.526 127.404L331.054 121.447C326.752 126.085 313.683 120.951 301.861 109.987Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("defs",{children:o("linearGradient",{id:"paint0_linear_4525_125520",x1:"191",y1:"124.403",x2:"247.716",y2:"304.676",gradientUnits:"userSpaceOnUse",children:[i("stop",{stopColor:"#AD48BA"}),i("stop",{offset:"0.65625",stopColor:"#D178FF",stopOpacity:"0.24"})]})})]})})})}function He(){const{t:t}=n(),{connectLoaderState:{provider:a}}=e.useContext(d),s=L(a),{page:r}=p();return e.useEffect((()=>{r({userJourney:m.WALLET,screen:"CoinInfo"})}),[]),o(V,{testId:"coin-info",header:i(R,{showBack:!0,transparent:!0}),footer:i(U,{}),heroContent:i(Ke,{}),floatHeader:!0,children:[!s&&i(H,{heading:t("views.COIN_INFO.metamask.heading"),children:t("views.COIN_INFO.metamask.body")}),s&&o(H,{heading:t("views.COIN_INFO.passport.heading"),children:[t("views.COIN_INFO.passport.body1"),i(Y,{onClick:()=>window.open(X),children:t("views.COIN_INFO.passport.linkText")}),t("views.COIN_INFO.passport.body2")]})]})}const Xe=({checkout:t,provider:n,refreshCallback:a,errorCallback:o})=>{const[s,i]=e.useState(!0),r=e.useCallback((async(e=!1)=>{if(t&&n)try{const o=await t.getNetworkInfo({provider:n});if(!o.isSupported)return;e||i(!0);const s=await(async(e,t,n)=>{if(!e||!t||!n)return[];const a=await t.getSigner().getAddress(),o=await re((()=>e.getAllBalances({provider:t,walletAddress:a,chainId:n})),W);return o?M(e.config,o.balances,n).map((t=>({...t,token:{...t.token,icon:D(e.config.environment,S(t.token.address)?t.token.symbol:t.token.address??"")}}))):[]})(t,n,o.chainId);e||i(!1),a(s)}catch(t){W.nonRetryable(t)&&o(t),e||i(!1)}}),[t,n]);return le((()=>r(!0)),3e4),{balancesLoading:s,refreshBalances:r}};function Ye(t){const{t:s}=n(),r=s("views.ERROR_VIEW.actionText"),l=s("views.LOADING_VIEW.text"),{eventTargetState:{eventTarget:p}}=e.useContext(h),{config:{environment:u,isOnRampEnabled:L,isSwapEnabled:C,isBridgeEnabled:k,theme:f},walletConfig:{showDisconnectButton:w,showNetworkMenu:b}}=t,{connectLoaderState:{checkout:E,provider:T}}=e.useContext(d),[y,S]=e.useReducer(q,{...Q,history:[]}),[x,I]=e.useReducer(ue,{...ce,walletConfig:{showDisconnectButton:w,showNetworkMenu:b}}),v=e.useMemo((()=>({walletState:x,walletDispatch:I})),[x,I]),_=e.useMemo((()=>({viewState:y,viewDispatch:S})),[y,S]),{balancesLoading:N,refreshBalances:B}=Xe({checkout:E,provider:T,refreshCallback:e=>{I({payload:{type:de.SET_TOKEN_BALANCES,tokenBalances:e}})},errorCallback:e=>{console.error(e),S({payload:{type:c.UPDATE_VIEW,view:{type:A.ERROR_VIEW,error:new Error("Unable to fetch balances")}}})}});e.useEffect((()=>{(async()=>{if(!E)return;let e;try{e=await E.isSwapAvailable()}catch(t){e=!1}I({payload:{type:de.SET_SUPPORTED_TOP_UPS,supportedTopUps:{isBridgeEnabled:k,isSwapEnabled:C,isOnRampEnabled:L,isSwapAvailable:e}}})})()}),[k,C,L,u]);const O=async()=>{if(E&&T)try{const e=await E.getNetworkInfo({provider:T});if(!e.isSupported)return;B(),S({payload:{type:c.UPDATE_VIEW,view:{type:fe.WALLET_BALANCES}}}),I({payload:{type:de.SET_NETWORK,network:e}})}catch(e){console.error(e),S({payload:{type:c.UPDATE_VIEW,view:{type:A.ERROR_VIEW,error:e}}})}};e.useEffect((()=>{E&&T&&O()}),[E,T]);return i(a.Provider,{value:_,children:i(oe,{environment:u,children:o(pe.Provider,{value:v,children:[y.view.type===A.LOADING_VIEW&&i(ee,{loadingText:l}),y.view.type===fe.WALLET_BALANCES&&i(Fe,{balancesLoading:N,theme:f,showNetworkMenu:b}),y.view.type===fe.SETTINGS&&i(Je,{showDisconnectButton:w}),y.view.type===fe.COIN_INFO&&i(He,{}),y.view.type===A.ERROR_VIEW&&i(te,{actionText:r,onActionClick:async()=>{S({payload:{type:c.UPDATE_VIEW,view:{type:fe.WALLET_BALANCES}}}),await O()},onCloseClick:()=>Z(p)}),y.view.type===A.TOP_UP_VIEW&&i(se,{analytics:{userJourney:m.WALLET},widgetEvent:g.IMTBL_WALLET_WIDGET_EVENT,checkout:E,provider:T,showOnrampOption:L,showSwapOption:C,showBridgeOption:k,onCloseButtonClick:()=>Z(p)})]})})})}export{Ye as default};
@@ -1 +1 @@
1
- import{dD as t}from"./index-4da0c2bb.js";function n(n,e,r,o){var i=this;return n?((n instanceof Element?[n]:"toArray"in n?n.toArray():n).forEach((function(n){n.addEventListener("click",(function(u){var a,c,s=e instanceof Function?e(n):e,f=r instanceof Function?r(n):r,l=n.getAttribute("href")||n.getAttributeNS("http://www.w3.org/1999/xlink","href")||n.getAttribute("xlink:href")||(null===(a=n.getElementsByTagName("a")[0])||void 0===a?void 0:a.getAttribute("href")),h=t(i.track(s,f,null!=o?o:{}),null!==(c=i.settings.timeout)&&void 0!==c?c:500);(function(t,n){return!("_blank"!==t.target||!n)})(n,l)||function(t){var n=t;return!!(n.ctrlKey||n.shiftKey||n.metaKey||n.button&&1==n.button)}(u)||l&&(u.preventDefault?u.preventDefault():u.returnValue=!1,h.catch(console.error).then((function(){window.location.href=l})).catch(console.error))}),!1)})),this):this}function e(n,e,r,o){var i=this;return n?(n instanceof HTMLFormElement&&(n=[n]),n.forEach((function(n){if(!(n instanceof Element))throw new TypeError("Must pass HTMLElement to trackForm/trackSubmit.");var u=function(u){var a;u.preventDefault?u.preventDefault():u.returnValue=!1;var c=e instanceof Function?e(n):e,s=r instanceof Function?r(n):r;t(i.track(c,s,null!=o?o:{}),null!==(a=i.settings.timeout)&&void 0!==a?a:500).catch(console.error).then((function(){n.submit()})).catch(console.error)},a=window.jQuery||window.Zepto;a?a(n).submit(u):n.addEventListener("submit",u,!1)})),this):this}export{e as form,n as link};
1
+ import{dD as t}from"./index-9493d2b3.js";function n(n,e,r,o){var i=this;return n?((n instanceof Element?[n]:"toArray"in n?n.toArray():n).forEach((function(n){n.addEventListener("click",(function(u){var a,c,s=e instanceof Function?e(n):e,f=r instanceof Function?r(n):r,l=n.getAttribute("href")||n.getAttributeNS("http://www.w3.org/1999/xlink","href")||n.getAttribute("xlink:href")||(null===(a=n.getElementsByTagName("a")[0])||void 0===a?void 0:a.getAttribute("href")),h=t(i.track(s,f,null!=o?o:{}),null!==(c=i.settings.timeout)&&void 0!==c?c:500);(function(t,n){return!("_blank"!==t.target||!n)})(n,l)||function(t){var n=t;return!!(n.ctrlKey||n.shiftKey||n.metaKey||n.button&&1==n.button)}(u)||l&&(u.preventDefault?u.preventDefault():u.returnValue=!1,h.catch(console.error).then((function(){window.location.href=l})).catch(console.error))}),!1)})),this):this}function e(n,e,r,o){var i=this;return n?(n instanceof HTMLFormElement&&(n=[n]),n.forEach((function(n){if(!(n instanceof Element))throw new TypeError("Must pass HTMLElement to trackForm/trackSubmit.");var u=function(u){var a;u.preventDefault?u.preventDefault():u.returnValue=!1;var c=e instanceof Function?e(n):e,s=r instanceof Function?r(n):r;t(i.track(c,s,null!=o?o:{}),null!==(a=i.settings.timeout)&&void 0!==a?a:500).catch(console.error).then((function(){n.submit()})).catch(console.error)},a=window.jQuery||window.Zepto;a?a(n).submit(u):n.addEventListener("submit",u,!1)})),this):this}export{e as form,n as link};
@@ -1 +1 @@
1
- import{cV as e,a as t,aF as n,a2 as r,a3 as a,r as i,cW as o,cX as s,a4 as l,j as c,cY as d,c as p,bl as h,cZ as u,B as b,ca as g,bp as m,aa as f,c_ as L,bj as k,bk as x,cs as C,u as w,aN as v,ab as y,aw as O,h as j,O as I,cF as E,c$ as M,H,b as S,p as A,G as D,ax as P,M as B,d0 as F,d1 as Z,d2 as z,d3 as T,aE as W,t as N,f as _,c9 as $,d4 as R,P as V,Q,R as q,aW as X,x as U,l as G,D as K}from"./index-4da0c2bb.js";import{r as Y}from"./retry-cd8de993.js";function J(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ee(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?J(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var te=function(e){return{brad:"base.borderRadius.x4",overflow:"hidden",transitionProperty:"background-color",transitionDuration:"base.motion.normal.fast.cssDuration",transitionTimingFunction:"base.motion.normal.fast.cssEase","&.emphasized":{bgc:"base.color.translucent.emphasis.100"},"&.expanded":{bgc:"base.color.translucent.emphasis.100"},"&.emphasized.expanded":{bgc:"base.color.translucent.emphasis.200"},"&:hover":{bgc:"base.color.translucent.emphasis.200"},"&.emphasized:hover":{bgc:"base.color.translucent.emphasis.300"},"&:hover .ButtCon":ee({},L("small",e,!1)["&:hover:not([disabled])"])}},ne=ee(ee({},e),{},{alignItems:"flex-start",justifyContent:"space-between",gap:"base.spacing.x4",position:"relative",px:"base.spacing.x3",py:"base.spacing.x4",minh:"base.spacing.x16"}),re={position:"absolute",top:"base.spacing.x4"},ae={overflow:"visible",bg:"transparent",maxh:"unset",boxShadow:"unset",brad:"unset",p:"0"},ie={mb:"base.spacing.x10",px:"base.spacing.x3","& .Divider:first-of-type":{mb:"base.spacing.x4"}},oe=["children","className","sx","chevronSide"];function se(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function le(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?se(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):se(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ce(e){var n=e.children,a=e.className,o=e.sx,s=void 0===o?{}:o,c=e.chevronSide,d=void 0===c?"left":c,p=r(e,oe),u=i.useMemo((function(){return k(n)}),[n]);return t(g,le(le({},p),{},{className:"".concat(null!=a?a:""," AccordionExpandedContent"),sx:l(ie,le({},"left"===d?{pl:"base.spacing.x15"}:{pr:"base.spacing.x15"}),s),children:i.Children.map(u,(function(e){return i.isValidElement(e)&&x(e,C)?t(h,{size:"xSmall",children:e}):e}))}))}ce.displayName="Accordion.ExpandedContent";var de=["children","direction","gap","rc"],pe=["sx","alignItems","className"],he=["alignItems","className","sx"];function ue(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function be(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ue(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ue(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ge(e){var n=e.children,a=e.direction,i=void 0===a?"column":a,o=e.gap,s=void 0===o?"0px":o,l=e.rc,c=void 0===l?t("span",{}):l,d=r(e,de);return t(g,be(be({},d),{},{direction:i,gap:s,rc:c,children:n}))}function me(e){var n=e.sx,a=void 0===n?{}:n,i=e.alignItems,o=void 0===i?"flex-start":i,s=e.className,c=r(e,pe);return t(ge,be(be({},c),{},{alignItems:o,sx:l({flex:1,textAlign:"left"},a),className:"".concat(null!=s?s:""," AccordionTargetLeftSlot")}))}function fe(e){var n=e.alignItems,a=void 0===n?"flex-end":n,i=e.className,o=e.sx,s=void 0===o?{}:o,c=r(e,he);return t(ge,be(be({},c),{},{alignItems:a,sx:l({textAlign:"right"},s),className:"".concat(null!=i?i:""," AccordionTargetRightSlot")}))}me.displayName="Accordion.TargetLeftSlot",fe.displayName="Accordion.TargetRightSlot";var Le=["emphasized","expanded","defaultExpanded","children","gap","alignItems","className","onExpandChange","chevronSide","sx","rc","targetClickOveride","testId"];function ke(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function xe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ke(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ke(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ce(e){var f=xe(xe({},e),{},"expanded"in e?{defaultExpanded:void 0}:{expanded:void 0}),L=f.emphasized,k=f.expanded,x=f.defaultExpanded,C=f.children,w=f.gap,v=void 0===w?"0":w,y=f.alignItems,O=void 0===y?"stretch":y,j=f.className,I=f.onExpandChange,E=f.chevronSide,M=void 0===E?"left":E,H=f.sx,S=void 0===H?{}:H,A=f.rc,D=void 0===A?t(n.div,{}):A,P=f.targetClickOveride,B=f.testId,F=void 0===B?"Accordion":B,Z=r(f,Le),z=a(),T=z.base,W=i.useState(x),N=o(W,2),_=N[0],$=N[1],R=null!=k?k:_,V=s(C,me),Q=s(C,fe),q=s(C,ce),X=i.useCallback((function(){void 0===k?$((function(e){return null==I||I(!e),!e})):null==I||I(!k)}),[k,I]),U=i.useMemo((function(){var e,t;return l(te(z),null!==(e=null===(t=z.components)||void 0===t||null===(t=t.Accordion)||void 0===t?void 0:t.sxOverride)&&void 0!==e?e:{},S)}),[S,z]);return t(m,{children:function(e){var r=e.cx;return c(g,xe(xe({},Z),{},{className:"".concat(null!=j?j:""," Accordion ").concat(r({emphasized:L,expanded:R})),gap:v,alignItems:O,rc:D,sx:U,testId:F,children:[c(d,{sx:l(ne,xe({},"left"===M?{pl:"base.spacing.x15"}:{pr:"base.spacing.x15"})),onClick:P||X,testId:"".concat(F,"__clickableArea"),children:[t(p,{rc:t("span",{}),icon:R?"ChevronCollapse":"ChevronExpand",variant:"tertiary",size:"small",testId:"".concat(F,"__clickableArea__chevron"),sx:l(re,xe({},"left"===M?{left:"base.spacing.x3"}:{right:"base.spacing.x3"})),className:"Accordion__ButtCon"}),t(h,{testId:"".concat(F,"__clickableArea__targetLeft"),children:V}),Q&&t(h,{testId:"".concat(F,"__clickableArea__targetRight"),children:Q})]}),t(u,{children:Boolean(q)&&R?t(b,{sx:ae,rc:t(n.div,{initial:{opacity:0,height:0,overflow:"hidden",y:-16},animate:{height:"auto",opacity:1,y:0,transitionEnd:{overflow:"visible"}},exit:{height:0,opacity:0,overflow:"hidden",y:-16},transition:{duration:T.motion.normal.fast.jsDuration,ease:T.motion.normal.fast.jsEase}}),children:t(h,{chevronSide:M,testId:"".concat(F,"__expandedContent"),children:q})}):null})]}))}})}function we({visible:e,targetChainId:n,provider:r,checkout:a,onCloseDrawer:o,onNetworkSwitch:s}){const{t:l}=w(),d=v(a.config.environment??y.PRODUCTION,"/switchnetworkethereum.png"),h=v(a.config.environment??y.PRODUCTION,"/switchnetworkzkevm.png"),u=O(n),g=n===j(a.config),m=i.useCallback((async()=>{if(!a)return;const e=await a.switchNetwork({provider:r,chainId:n});s&&s(e.provider)}),[a,r,s,n]),f=I(r),L=i.useMemo((()=>f?r.provider?.session?.peer?.metadata?.name:""),[r,f]),k=i.useMemo((()=>L?.toLowerCase().includes("metamask")),[L]),x=i.useMemo((()=>E(r)?"MetaMask wallet":f&&L?L:"wallet"),[r,f,L]),C=f&&k;return i.useEffect((()=>{(new Image).src=d;(new Image).src=h}),[]),t(P,{size:"threeQuarter",visible:e,onCloseDrawer:o,showHeaderBar:!1,children:c(P.Content,{sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center"},children:[t(M,{aspectRatio:"21:9",responsiveSizes:[450,512,640,720,860,1024,1280,1440],imageUrl:g?d:h}),t(p,{icon:"Close",variant:"tertiary",sx:{pos:"absolute",top:"base.spacing.x5",left:"base.spacing.x5",backdropFilter:"blur(30px)"},onClick:o}),c(b,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:"base.spacing.x4",paddingX:"base.spacing.x6"},children:[t(H,{size:"small",weight:"bold",sx:{textAlign:"center",paddingX:"base.spacing.x6"},children:l("drawers.networkSwitch.heading",{wallet:x})}),C&&t(S,{size:"medium",weight:"regular",sx:{color:"base.color.text.body.secondary",textAlign:"center",paddingX:"base.spacing.x6"},children:l("drawers.networkSwitch.manualSwitch.body",{chain:u})}),!C&&t(S,{size:"medium",weight:"regular",sx:{color:"base.color.text.body.secondary",textAlign:"center",paddingX:"base.spacing.x6"},children:l("drawers.networkSwitch.controlledSwitch.body",{chain:u})})]}),c(b,{sx:{display:"flex",flexDirection:"column",paddingX:"base.spacing.x4",width:"100%"},children:[!C&&t(A,{size:"large",variant:"primary",sx:{width:"100%",marginBottom:"base.spacing.x2"},onClick:m,children:l("drawers.networkSwitch.switchButton",{chain:u})}),t(D,{})]})]})})}function ve({onClick:e,icon:n,name:r,symbol:a,balance:i,defaultTokenImage:o,testId:s,id:l}){const{t:d}=w();return c(B,{testId:`${s}-coin-selector__option-${l}`,emphasized:!0,size:"small",onClick:e,children:[!n&&t(B.Icon,{icon:"Coins",variant:"bold"}),n&&t(B.FramedImage,{imageUrl:n,circularFrame:!0,defaultImageUrl:o}),t(B.Label,{children:r}),t(B.Caption,{children:a}),i&&t(B.PriceDisplay,{fiatAmount:`${d("drawers.coinSelector.option.fiatPricePrefix")}${i.formattedFiatAmount}`,price:i.formattedAmount})]})}Ce.displayName="Accordion",Ce.TargetLeftSlot=me,Ce.TargetRightSlot=fe,Ce.ExpandedContent=ce;const ye={display:"flex",flexDirection:"column",gap:"2px",paddingX:"base.spacing.x4",paddingBottom:"base.spacing.x4"},Oe={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"};function je({heading:e,options:n,defaultTokenImage:r,optionsLoading:a,children:i,onCloseDrawer:o,visible:s}){const{t:l}=w();return c(P,{headerBarTitle:e,size:"full",onCloseDrawer:o,visible:s,children:[t(P.Target,{children:i}),t(P.Content,{children:c(b,{sx:ye,children:[a&&0===n.length&&c(b,{sx:Oe,children:[t(B,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),t(B,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"}),t(B,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--3"})]}),!a&&0===n.length&&t(S,{sx:{padding:"base.spacing.x4"},children:l("drawers.coinSelector.noCoins")}),!a&&n.map((({onClick:e,icon:n,name:a,symbol:i,balance:o,id:s,testId:l})=>t(ve,{id:s,testId:l,onClick:e,icon:n,name:a,symbol:i,balance:o,defaultTokenImage:r},`${i}-${a}`)))]})})]})}function Ie({testId:e,options:n,optionsLoading:r,subtext:a,onSelectChange:o,textAlign:s,errorMessage:l,disabled:d,selectedOption:p,coinSelectorHeading:h,defaultTokenImage:u}){const[g,m]=i.useState(!1),f=i.useMemo((()=>n.map((t=>({...t,testId:e,onClick:()=>{o(t.id),m(!1)}})))),[n,o,m]);return c(b,{children:[t(je,{heading:h,options:f,defaultTokenImage:u,optionsLoading:r??!1,visible:g,onCloseDrawer:()=>m(!1)}),t(Z,{testId:`${e}-select-control`,textAlign:s??"left",subtext:l?void 0:a,isErrored:!!l,errorMessage:l,children:t(F,{testId:`${e}-select`,size:"large",defaultLabel:"Select coin",targetClickOveride:()=>m(!0),selectedOption:(()=>{if(p&&0!==n.length&&n.find((e=>e.id===p)))return p})(),sx:{minw:"170px"},children:n.filter((e=>e.id===p))?.map((e=>c(F.Option,{optionKey:e.id,testId:e.testId,disabled:d,children:[!e.icon&&t(F.Option.Icon,{icon:"Coins",variant:"bold"}),e.icon&&t(F.Option.FramedImage,{imageUrl:e.icon,circularFrame:!0,defaultImageUrl:u,sx:{background:"base.color.translucent.standard.100"}}),t(F.Option.Label,{children:e.symbol})]},e.id)))})})]})}function Ee({testId:e,value:n,placeholder:r,errorMessage:a,validator:i,onTextInputChange:o,onTextInputBlur:s,onTextInputFocus:l,onTextInputEnter:c,textAlign:d,type:p,subtext:h,maxButtonClick:u,disabled:b}){return t(Z,{testId:`${e}-text-control`,textAlign:d??"left",subtext:a?void 0:h,isErrored:!!a,errorMessage:a,sx:{width:"100%"},children:t(z,{testId:`${e}-text`,onChange:e=>((e,t)=>{let n=e.target.value;"number"===p&&"."===n&&(n="0."),i(n)?o(n):o(t??"")})(e,n),sizeVariant:"large",value:n,validationStatus:a?"error":"success",placeholder:r,onBlur:e=>{if(!s)return;const t=e.target.value;i(t)&&s(t)},onFocus:e=>{if(!l)return;const t=e.target.value;i(t)&&l(t)},onKeyDown:e=>{c&&"Enter"===e.key&&c()},disabled:b,hideClearValueButton:!0,sx:{minWidth:"100%"},children:u&&t(z.Button,{testId:`${e}-max-button`,onClick:u,disabled:b,children:"max"})})})}const Me={display:"flex",flexDirection:"column",height:"100%",padding:"16px 16px 0 16px"},He={display:"flex",flexDirection:"column",gap:"10px",height:"100%"},Se={display:"flex",width:"100%"},Ae=e=>({width:"50%",color:e?"base.color.text.body.primary":"base.color.text.body.secondary"}),De={width:"50%"},Pe={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"};function Be({boldLabel:e,label:n,amount:r,fiatAmount:a,tokenSymbol:i,prefix:o=""}){const s=n.toLowerCase().replace(" ","-");return c(b,{sx:Se,testId:`fee-item-${s}`,children:[t(S,{sx:Ae(e),children:n}),t(T,{testId:s,sx:De,price:`${o}${i} ${r}`,fiatAmount:a})]})}function Fe({fees:e,children:n,visible:r,onCloseDrawer:a,totalFiatAmount:i,totalAmount:o,tokenSymbol:s,loading:l=!1}){const{t:d}=w();return c(P,{headerBarTitle:d("drawers.feesBreakdown.heading"),size:"threeQuarter",onCloseDrawer:a,visible:r,children:[t(P.Target,{children:n}),c(P.Content,{testId:"fees-breakdown-content",sx:Me,children:[c(b,{sx:He,children:[l&&c(b,{sx:Pe,children:[t(B,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),t(B,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"})]}),!l&&e.map((({label:e,amount:n,fiatAmount:r,prefix:a})=>t(Be,{label:e,amount:n,fiatAmount:r,tokenSymbol:s,prefix:a},e))),o&&c(W,{children:[t(C,{size:"xSmall"}),t(Be,{label:d("drawers.feesBreakdown.total"),amount:N(o),fiatAmount:i?`~ ${d("drawers.feesBreakdown.fees.fiatPricePrefix")}${i}`:_("0"),tokenSymbol:s,boldLabel:!0},d("drawers.feesBreakdown.total"))]})]}),t(D,{})]})]})}const Ze={backgroundColor:"base.color.translucent.emphasis.100"},ze={marginBottom:"base.spacing.x4",color:"base.color.text.body.secondary"};function Te({gasFeeValue:e,gasFeeToken:n,gasFeeFiatValue:r,fees:a,onFeesClick:o,loading:s,sx:l}){const[d,p]=i.useState(!1),{t:h}=w();if(!e&&!s)return t(b,{});const u=_(N(e)),g=n?.symbol;return c(W,{children:[c(Ce,{targetClickOveride:()=>{p(!0),o?.()},sx:{...Ze,paddingBottom:"base.spacing.x2",...l},children:[t(Ce.TargetLeftSlot,{children:t(S,{size:"medium",sx:ze,children:h("drawers.feesBreakdown.heading")})}),c(Ce.TargetRightSlot,{children:[s&&t(b,{sx:{width:"218px",position:"relative"},children:t(b,{sx:{display:"block",position:"absolute",top:"-15px",width:"100%",height:"68px",WebkitMaskPosition:"right center",WebkitMaskRepeat:"no-repeat",WebkitMaskSize:"contain",WebkitMaskImage:'url(\'data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="196" height="96"><path d="M182.85 55.2Q181.65 54 180 54h-56q-1.7 0-2.85 1.2Q120 56.35 120 58v4q0 1.7 1.15 2.85Q122.3 66 124 66h56q1.65 0 2.85-1.15Q184 63.7 184 62v-4q0-1.65-1.15-2.8m0-22Q181.65 32 180 32H68q-1.7 0-2.85 1.2Q64 34.35 64 36v8q0 1.7 1.15 2.85Q66.3 48 68 48h112q1.65 0 2.85-1.15Q184 45.7 184 44v-8q0-1.65-1.15-2.8Z" id="a"/></svg>\')'},rc:t("span",{}),children:t($,{rc:t("span",{})})})}),!s&&t(T,{testId:"fees-gas-fee__priceDisplay",fiatAmount:`~ ${h("drawers.feesBreakdown.fees.fiatPricePrefix")}${r}`,price:`~ ${g} ${_(N(u))}`})]})]}),t(Fe,{tokenSymbol:g??"",fees:a,visible:d,loading:s,onCloseDrawer:()=>p(!1)})]})}const We={display:"flex",flexDirection:"column",alignItems:"center",paddingY:"50px",paddingX:"base.spacing.x4",height:"100%"},Ne={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"15px"},_e={display:"flex",flexDirection:"column",justifyContent:"flex-end",gap:"8px",height:"100%",width:"100%"},$e={width:"100%",height:"64px"};function Re({onCloseDrawer:e,visible:n,showHeaderBar:r,onRetry:a}){const{t:i}=w();return t(P,{headerBarTitle:void 0,size:"full",onCloseDrawer:e,visible:n,showHeaderBar:r,children:t(P.Content,{children:c(b,{sx:We,children:[t(R,{icon:"Information",colorVariant:"guidance",iconVariant:"bold"}),c(H,{size:"small",sx:Ne,testId:"transaction-rejected-heading",children:[i("drawers.transactionFailed.content.heading1"),t("br",{}),i("drawers.transactionFailed.content.heading2")]}),c(S,{sx:Ne,children:[i("drawers.transactionFailed.content.body1"),t("br",{}),i("drawers.transactionFailed.content.body2")]}),c(b,{sx:_e,children:[t(A,{sx:$e,variant:"tertiary",onClick:a,children:i("drawers.transactionFailed.buttons.retry")}),t(A,{sx:$e,variant:"tertiary",onClick:e,testId:"transaction-rejected-cancel-button",children:i("drawers.transactionFailed.buttons.cancel")})]})]})})})}function Ve(){return t(b,{testId:"wallet-approve-hero",sx:{...V,background:"base.color.translucent.emphasis.100"},children:t(b,{sx:{...Q,...q},children:c("svg",{width:"430",height:"305",viewBox:"0 0 430 305",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t("path",{d:"M227.517 171.325L182.178 85.6034C181.033 83.4446 179.583 82.3652 178.156 82.3652C175.711 82.3652 174.322 84.1157 172.863 86.6218L137.285 164.056L183.689 253.776L227.522 171.32L227.517 171.325Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M226.841 137.597C228.497 133.997 228.338 128.188 226.484 124.682L197.866 70.5767C196.012 67.0757 193.14 67.1508 191.484 70.7503L164.936 128.427L168.399 134.936L165.396 141.464L168.85 147.992L171.853 141.464L175.307 147.992L172.304 154.52L168.85 147.992L165.846 154.52L169.3 161.048L166.287 167.562L187.922 208.465C189.776 211.966 192.648 211.891 194.304 208.292L226.845 137.597H226.841Z",fill:"#F191FA"}),t("path",{d:"M168.85 147.992L165.396 141.464L168.399 134.936L164.936 128.427L191.484 70.7503C193.14 67.1508 196.012 67.0757 197.866 70.5767L226.484 124.682C228.338 128.188 228.497 133.997 226.841 137.597H226.845L194.304 208.292C192.648 211.891 189.776 211.966 187.922 208.465L166.287 167.562L169.3 161.048L165.846 154.52L168.85 147.992ZM168.85 147.992L171.853 141.464L175.307 147.992L172.304 154.52L168.85 147.992Z",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M159.384 154.519L155.93 147.991L158.939 141.463L162.388 147.991L159.384 154.519Z",fill:"#F191FA"}),t("path",{d:"M203.136 132.773C202.484 134.19 201.353 134.223 200.621 132.843L196.101 124.297C195.369 122.917 195.308 120.627 195.961 119.21L200.621 109.082C201.273 107.665 202.404 107.632 203.136 109.012L207.656 117.558C208.388 118.938 208.449 121.228 207.796 122.645L203.136 132.773Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M206.22 114.837L204.68 118.183C204.174 119.286 203.291 119.309 202.724 118.234L199.345 111.852",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M197.542 127.015L199.058 123.716C199.565 122.613 200.447 122.589 201.015 123.664L204.394 130.046",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M293.369 250.453L252.263 172.733C249.936 168.331 243.957 164.731 238.982 164.731H173.769C171.516 164.731 169.306 164.14 167.358 163.014L162.876 160.423C160.929 159.297 158.718 158.706 156.466 158.706H147.896L141.237 164.534L189.659 256C190.612 257.493 192.452 258.417 194.939 258.417L287.456 258.445L291.473 260.904L293.904 255.733H293.895C294.556 254.315 294.449 252.471 293.379 250.448L293.369 250.453Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M232.923 169.903L235.354 164.731",stroke:"black",strokeWidth:"0.469297",strokeMiterlimit:"10"}),t("path",{d:"M249.832 177.908C247.505 173.506 241.526 169.907 236.551 169.907L142.025 169.878C139.355 169.878 137.436 168.813 136.549 167.128L186.313 261.185C187.266 262.677 189.105 263.602 191.592 263.602L286.118 263.63C291.098 263.63 293.266 260.03 290.938 255.633L249.832 177.913V177.908Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M255.328 198.77L245.041 179.313C243.581 176.548 240.235 174.042 237.161 174.042L143.555 173.93",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M188.64 259.548L282.448 259.558C285.569 259.558 286.418 257.577 285.198 255.264L276.103 238.064",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M150.238 159.776C150.965 161.151 149.539 163.338 147.051 164.652C144.564 165.966 141.96 165.919 141.227 164.539C140.495 163.159 141.927 160.977 144.414 159.663C145.62 159.025 146.854 158.71 147.891 158.71C148.99 158.71 149.863 159.067 150.238 159.776Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M147.826 161.052C148.164 161.69 147.502 162.704 146.348 163.314C145.193 163.924 143.983 163.9 143.645 163.262C143.307 162.624 143.969 161.61 145.123 161C145.681 160.705 146.254 160.559 146.737 160.559C147.249 160.559 147.652 160.723 147.826 161.057V161.052Z",fill:"black"}),t("path",{d:"M171.652 85.828L136.755 161.652C135.788 163.75 135.784 165.669 136.549 167.124C136.549 167.124 137.717 169.874 142.025 169.874C146.333 169.874 151.754 169.907 151.754 169.907L153.115 167.5L143.419 167.467C139.669 167.467 137.637 165.186 139.205 161.779L174.163 85.8233C175.223 83.5238 176.678 82.3646 178.156 82.3646C178.156 82.3646 173.431 81.961 171.652 85.8233V85.828Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M273.579 230.377L277.263 229.767L287.024 238.458L278.347 222.051L270.373 223.609L273.579 230.377Z",fill:"black"}),t("path",{d:"M274.968 235.918C272.495 231.239 272.777 228.33 278.296 226.565C281.262 225.617 283.951 224.073 286.255 221.98L291.328 217.371C295.725 213.378 297.049 205.813 294.275 200.561C291.497 195.31 285.626 194.282 281.233 198.276L275.071 203.874C272.983 205.775 270.327 206.939 267.516 207.206C261.79 207.746 259.392 206.456 256.769 201.495L255.399 206.127L271.073 235.923H274.973L274.968 235.918Z",fill:"#EBE9E9"}),t("path",{d:"M274.968 235.918C272.495 231.239 272.776 228.33 278.295 226.565C281.261 225.617 283.95 224.073 286.255 221.98L291.328 217.371C295.725 213.378 297.048 205.813 294.275 200.561C291.497 195.31 285.626 194.282 281.233 198.276L275.071 203.874C272.983 205.775 270.327 206.939 267.516 207.206C261.79 207.746 259.392 206.456 256.769 201.495",stroke:"black",strokeWidth:"0.469297",strokeMiterlimit:"10"}),t("path",{d:"M289.926 200.125C287.265 199.276 284.074 201.829 282.793 205.832C281.512 209.835 282.629 213.768 285.29 214.617L286.533 215.016L291.17 200.524L289.926 200.125Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M293.683 209.321C294.963 205.319 293.846 201.386 291.187 200.535C288.528 199.685 285.335 202.239 284.055 206.241C282.775 210.242 283.892 214.176 286.551 215.026C289.21 215.877 292.403 213.322 293.683 209.321Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M213.26 224.182C211.237 224.182 208.816 222.722 207.868 220.934L189.021 185.301C188.077 183.513 188.955 182.053 190.978 182.053L231.3 182.039C233.322 182.039 235.744 183.499 236.692 185.287L255.539 220.92C256.482 222.708 255.604 224.168 253.582 224.168L213.26 224.182Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M214.334 222.319C212.312 222.319 209.89 220.859 208.942 219.071L190.095 183.438C189.884 183.034 189.767 182.649 189.729 182.292C188.64 182.776 188.302 183.944 189.02 185.301L207.867 220.934C208.811 222.722 211.237 224.182 213.26 224.182L253.582 224.168C255.144 224.168 256.022 223.29 255.9 222.065C255.557 222.22 255.14 222.305 254.652 222.305L214.33 222.319H214.334Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M231.586 203.083L233.646 206.978H228.756H223.871H218.981H215.513C214.733 206.978 214.363 207.489 214.691 208.109L215.555 209.737C215.883 210.361 216.794 210.873 217.577 210.873H221.046H225.936L227.395 213.632C227.724 214.256 228.634 214.763 229.418 214.763H231.464C232.243 214.763 232.614 214.252 232.285 213.628L230.826 210.868H235.716H239.184C239.963 210.868 240.334 210.352 240.005 209.732L238.546 206.973L237.086 204.214C236.758 203.589 235.847 203.083 235.063 203.083H231.595H231.586Z",fill:"#F191FA"}),t("path",{d:"M214.855 199.191L216.315 201.951C216.648 202.575 217.554 203.086 218.342 203.086H221.81H226.696H231.586L230.126 200.322C229.793 199.698 228.887 199.187 228.099 199.187H224.631H219.746H214.855V199.191Z",fill:"#F191FA"}),t("path",{d:"M214.986 187.501C214.207 187.501 213.837 188.013 214.165 188.632L215.625 191.392H210.735H207.266C206.487 191.392 206.117 191.903 206.445 192.527L207.905 195.287L209.364 198.046C209.693 198.671 210.603 199.177 211.387 199.177H214.855L212.795 195.282H217.685H222.57H227.46H230.928C231.707 195.282 232.078 194.771 231.75 194.147L230.891 192.523C230.558 191.899 229.652 191.387 228.868 191.387H225.4H220.51L219.051 188.628C218.722 188.003 217.812 187.497 217.028 187.497H214.982L214.986 187.501Z",fill:"#F191FA"}),t("path",{d:"M214.098 243.795L212.428 240.641C211.78 239.412 210.109 238.412 208.725 238.412H202.849L200.428 233.832C199.78 232.602 198.114 231.603 196.725 231.603H191.751C191 231.603 190.483 231.898 190.263 232.363L189.066 234.906L191.464 235.826L192.835 238.417H186.959C186.208 238.417 185.692 238.712 185.471 239.177L184.275 241.721L186.612 242.528L187.288 243.804C187.935 245.034 189.606 246.033 190.99 246.033H196.866L199.287 250.614C199.935 251.843 201.601 252.843 202.99 252.843H205.032L208.256 254.631L209.452 252.087C209.635 251.693 209.607 251.177 209.307 250.614L206.885 246.033H210.194L213.057 247.817L214.253 245.273C214.441 244.879 214.408 244.363 214.108 243.8L214.098 243.795Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M212.902 246.339L211.231 243.185C210.584 241.956 208.913 240.956 207.529 240.956H201.653L199.231 236.376C198.584 235.151 196.918 234.146 195.529 234.146H190.554C189.165 234.146 188.564 235.151 189.212 236.38L191.634 240.961H185.758C184.369 240.961 183.763 241.97 184.416 243.195L186.086 246.348C186.734 247.578 188.405 248.577 189.789 248.577H195.665L198.086 253.158C198.734 254.387 200.4 255.387 201.789 255.387H206.764C208.153 255.387 208.753 254.383 208.106 253.153L205.684 248.573H211.56C212.949 248.573 213.554 247.564 212.902 246.339Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M208.107 253.158L205.685 248.573",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M191.634 240.96H185.758",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M212.902 246.339L211.231 243.185C210.584 241.956 208.913 240.956 207.528 240.956H201.653L199.231 236.376C198.584 235.151 196.918 234.146 195.528 234.146H190.554",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M356.061 232.632L355.632 231L354 231.429L354.429 233.061L356.061 232.632Z",fill:"white"}),t("path",{d:"M57.6531 168.341L57.1006 166.24L54.9996 166.793L55.5521 168.894L57.6531 168.341Z",fill:"white"}),t("path",{d:"M103.489 244.345L101.345 244L101 246.145L103.144 246.49L103.489 244.345Z",fill:"white"}),t("path",{d:"M341.286 111.905L341.905 110.619L340.619 110L340 111.286L341.286 111.905Z",fill:"white"}),t("path",{d:"M323.144 179.08L322.592 176.979L320.491 177.531L321.043 179.632L323.144 179.08Z",fill:"white"}),t("path",{d:"M328.919 177.658L329.538 176.372L328.252 175.753L327.633 177.039L328.919 177.658Z",fill:"white"}),t("path",{d:"M88.1441 141.383L87.2188 140.296L86.1321 141.221L87.0574 142.308L88.1441 141.383Z",fill:"white"}),t("path",{d:"M258.286 89.9052L258.905 88.6191L257.619 88L257 89.2861L258.286 89.9052Z",fill:"white"})]})})})}const Qe=async({checkout:e,provider:t,allowTokenListType:n,chainId:r,allowZero:a=!1,retryPolicy:i=K})=>{const o=r||(await e.getNetworkInfo({provider:t})).chainId,s=await t.getSigner().getAddress(),l=await Y((()=>e.getAllBalances({provider:t,walletAddress:s,chainId:o})),{...i});if(void 0===l)return;const c=await e.getTokenAllowList({chainId:o,type:n}),d=new Map;c.tokens.forEach((e=>d.set(e.address?.toLowerCase()||X,!0)));const p=l.balances.filter((e=>!(e.balance.lte(0)&&!a)&&d.get(e.token.address?.toLowerCase()||X))).map((t=>({...t,token:{...t.token,icon:U(e.config.environment,G(t.token.address)?t.token.symbol:t.token.address??"")}})))??[];return c.tokens=c.tokens.map((t=>({...t,icon:U(e.config.environment,G(t.address)?t.symbol:t.address??"")}))),{allowList:c,allowedBalances:p}};export{Ce as A,Te as F,we as N,Ie as S,Ee as T,Ve as W,Re as a,Qe as g};
1
+ import{cV as e,a as t,aF as n,a2 as r,a3 as a,r as i,cW as o,cX as s,a4 as l,j as c,cY as d,c as p,bl as h,cZ as u,B as b,ca as g,bp as m,aa as f,c_ as L,bj as k,bk as x,cs as C,u as w,aN as v,ab as y,aw as O,h as j,O as I,cF as E,c$ as M,H,b as S,p as A,G as D,ax as P,M as B,d0 as F,d1 as Z,d2 as z,d3 as T,aE as W,t as N,f as _,c9 as $,d4 as R,P as V,Q,R as q,aW as X,x as U,l as G,D as K}from"./index-9493d2b3.js";import{r as Y}from"./retry-427ffe34.js";function J(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ee(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?J(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var te=function(e){return{brad:"base.borderRadius.x4",overflow:"hidden",transitionProperty:"background-color",transitionDuration:"base.motion.normal.fast.cssDuration",transitionTimingFunction:"base.motion.normal.fast.cssEase","&.emphasized":{bgc:"base.color.translucent.emphasis.100"},"&.expanded":{bgc:"base.color.translucent.emphasis.100"},"&.emphasized.expanded":{bgc:"base.color.translucent.emphasis.200"},"&:hover":{bgc:"base.color.translucent.emphasis.200"},"&.emphasized:hover":{bgc:"base.color.translucent.emphasis.300"},"&:hover .ButtCon":ee({},L("small",e,!1)["&:hover:not([disabled])"])}},ne=ee(ee({},e),{},{alignItems:"flex-start",justifyContent:"space-between",gap:"base.spacing.x4",position:"relative",px:"base.spacing.x3",py:"base.spacing.x4",minh:"base.spacing.x16"}),re={position:"absolute",top:"base.spacing.x4"},ae={overflow:"visible",bg:"transparent",maxh:"unset",boxShadow:"unset",brad:"unset",p:"0"},ie={mb:"base.spacing.x10",px:"base.spacing.x3","& .Divider:first-of-type":{mb:"base.spacing.x4"}},oe=["children","className","sx","chevronSide"];function se(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function le(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?se(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):se(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ce(e){var n=e.children,a=e.className,o=e.sx,s=void 0===o?{}:o,c=e.chevronSide,d=void 0===c?"left":c,p=r(e,oe),u=i.useMemo((function(){return k(n)}),[n]);return t(g,le(le({},p),{},{className:"".concat(null!=a?a:""," AccordionExpandedContent"),sx:l(ie,le({},"left"===d?{pl:"base.spacing.x15"}:{pr:"base.spacing.x15"}),s),children:i.Children.map(u,(function(e){return i.isValidElement(e)&&x(e,C)?t(h,{size:"xSmall",children:e}):e}))}))}ce.displayName="Accordion.ExpandedContent";var de=["children","direction","gap","rc"],pe=["sx","alignItems","className"],he=["alignItems","className","sx"];function ue(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function be(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ue(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ue(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ge(e){var n=e.children,a=e.direction,i=void 0===a?"column":a,o=e.gap,s=void 0===o?"0px":o,l=e.rc,c=void 0===l?t("span",{}):l,d=r(e,de);return t(g,be(be({},d),{},{direction:i,gap:s,rc:c,children:n}))}function me(e){var n=e.sx,a=void 0===n?{}:n,i=e.alignItems,o=void 0===i?"flex-start":i,s=e.className,c=r(e,pe);return t(ge,be(be({},c),{},{alignItems:o,sx:l({flex:1,textAlign:"left"},a),className:"".concat(null!=s?s:""," AccordionTargetLeftSlot")}))}function fe(e){var n=e.alignItems,a=void 0===n?"flex-end":n,i=e.className,o=e.sx,s=void 0===o?{}:o,c=r(e,he);return t(ge,be(be({},c),{},{alignItems:a,sx:l({textAlign:"right"},s),className:"".concat(null!=i?i:""," AccordionTargetRightSlot")}))}me.displayName="Accordion.TargetLeftSlot",fe.displayName="Accordion.TargetRightSlot";var Le=["emphasized","expanded","defaultExpanded","children","gap","alignItems","className","onExpandChange","chevronSide","sx","rc","targetClickOveride","testId"];function ke(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function xe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ke(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ke(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ce(e){var f=xe(xe({},e),{},"expanded"in e?{defaultExpanded:void 0}:{expanded:void 0}),L=f.emphasized,k=f.expanded,x=f.defaultExpanded,C=f.children,w=f.gap,v=void 0===w?"0":w,y=f.alignItems,O=void 0===y?"stretch":y,j=f.className,I=f.onExpandChange,E=f.chevronSide,M=void 0===E?"left":E,H=f.sx,S=void 0===H?{}:H,A=f.rc,D=void 0===A?t(n.div,{}):A,P=f.targetClickOveride,B=f.testId,F=void 0===B?"Accordion":B,Z=r(f,Le),z=a(),T=z.base,W=i.useState(x),N=o(W,2),_=N[0],$=N[1],R=null!=k?k:_,V=s(C,me),Q=s(C,fe),q=s(C,ce),X=i.useCallback((function(){void 0===k?$((function(e){return null==I||I(!e),!e})):null==I||I(!k)}),[k,I]),U=i.useMemo((function(){var e,t;return l(te(z),null!==(e=null===(t=z.components)||void 0===t||null===(t=t.Accordion)||void 0===t?void 0:t.sxOverride)&&void 0!==e?e:{},S)}),[S,z]);return t(m,{children:function(e){var r=e.cx;return c(g,xe(xe({},Z),{},{className:"".concat(null!=j?j:""," Accordion ").concat(r({emphasized:L,expanded:R})),gap:v,alignItems:O,rc:D,sx:U,testId:F,children:[c(d,{sx:l(ne,xe({},"left"===M?{pl:"base.spacing.x15"}:{pr:"base.spacing.x15"})),onClick:P||X,testId:"".concat(F,"__clickableArea"),children:[t(p,{rc:t("span",{}),icon:R?"ChevronCollapse":"ChevronExpand",variant:"tertiary",size:"small",testId:"".concat(F,"__clickableArea__chevron"),sx:l(re,xe({},"left"===M?{left:"base.spacing.x3"}:{right:"base.spacing.x3"})),className:"Accordion__ButtCon"}),t(h,{testId:"".concat(F,"__clickableArea__targetLeft"),children:V}),Q&&t(h,{testId:"".concat(F,"__clickableArea__targetRight"),children:Q})]}),t(u,{children:Boolean(q)&&R?t(b,{sx:ae,rc:t(n.div,{initial:{opacity:0,height:0,overflow:"hidden",y:-16},animate:{height:"auto",opacity:1,y:0,transitionEnd:{overflow:"visible"}},exit:{height:0,opacity:0,overflow:"hidden",y:-16},transition:{duration:T.motion.normal.fast.jsDuration,ease:T.motion.normal.fast.jsEase}}),children:t(h,{chevronSide:M,testId:"".concat(F,"__expandedContent"),children:q})}):null})]}))}})}function we({visible:e,targetChainId:n,provider:r,checkout:a,onCloseDrawer:o,onNetworkSwitch:s}){const{t:l}=w(),d=v(a.config.environment??y.PRODUCTION,"/switchnetworkethereum.png"),h=v(a.config.environment??y.PRODUCTION,"/switchnetworkzkevm.png"),u=O(n),g=n===j(a.config),m=i.useCallback((async()=>{if(!a)return;const e=await a.switchNetwork({provider:r,chainId:n});s&&s(e.provider)}),[a,r,s,n]),f=I(r),L=i.useMemo((()=>f?r.provider?.session?.peer?.metadata?.name:""),[r,f]),k=i.useMemo((()=>L?.toLowerCase().includes("metamask")),[L]),x=i.useMemo((()=>E(r)?"MetaMask wallet":f&&L?L:"wallet"),[r,f,L]),C=f&&k;return i.useEffect((()=>{(new Image).src=d;(new Image).src=h}),[]),t(P,{size:"threeQuarter",visible:e,onCloseDrawer:o,showHeaderBar:!1,children:c(P.Content,{sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center"},children:[t(M,{aspectRatio:"21:9",responsiveSizes:[450,512,640,720,860,1024,1280,1440],imageUrl:g?d:h}),t(p,{icon:"Close",variant:"tertiary",sx:{pos:"absolute",top:"base.spacing.x5",left:"base.spacing.x5",backdropFilter:"blur(30px)"},onClick:o}),c(b,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:"base.spacing.x4",paddingX:"base.spacing.x6"},children:[t(H,{size:"small",weight:"bold",sx:{textAlign:"center",paddingX:"base.spacing.x6"},children:l("drawers.networkSwitch.heading",{wallet:x})}),C&&t(S,{size:"medium",weight:"regular",sx:{color:"base.color.text.body.secondary",textAlign:"center",paddingX:"base.spacing.x6"},children:l("drawers.networkSwitch.manualSwitch.body",{chain:u})}),!C&&t(S,{size:"medium",weight:"regular",sx:{color:"base.color.text.body.secondary",textAlign:"center",paddingX:"base.spacing.x6"},children:l("drawers.networkSwitch.controlledSwitch.body",{chain:u})})]}),c(b,{sx:{display:"flex",flexDirection:"column",paddingX:"base.spacing.x4",width:"100%"},children:[!C&&t(A,{size:"large",variant:"primary",sx:{width:"100%",marginBottom:"base.spacing.x2"},onClick:m,children:l("drawers.networkSwitch.switchButton",{chain:u})}),t(D,{})]})]})})}function ve({onClick:e,icon:n,name:r,symbol:a,balance:i,defaultTokenImage:o,testId:s,id:l}){const{t:d}=w();return c(B,{testId:`${s}-coin-selector__option-${l}`,emphasized:!0,size:"small",onClick:e,children:[!n&&t(B.Icon,{icon:"Coins",variant:"bold"}),n&&t(B.FramedImage,{imageUrl:n,circularFrame:!0,defaultImageUrl:o}),t(B.Label,{children:r}),t(B.Caption,{children:a}),i&&t(B.PriceDisplay,{fiatAmount:`${d("drawers.coinSelector.option.fiatPricePrefix")}${i.formattedFiatAmount}`,price:i.formattedAmount})]})}Ce.displayName="Accordion",Ce.TargetLeftSlot=me,Ce.TargetRightSlot=fe,Ce.ExpandedContent=ce;const ye={display:"flex",flexDirection:"column",gap:"2px",paddingX:"base.spacing.x4",paddingBottom:"base.spacing.x4"},Oe={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"};function je({heading:e,options:n,defaultTokenImage:r,optionsLoading:a,children:i,onCloseDrawer:o,visible:s}){const{t:l}=w();return c(P,{headerBarTitle:e,size:"full",onCloseDrawer:o,visible:s,children:[t(P.Target,{children:i}),t(P.Content,{children:c(b,{sx:ye,children:[a&&0===n.length&&c(b,{sx:Oe,children:[t(B,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),t(B,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"}),t(B,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--3"})]}),!a&&0===n.length&&t(S,{sx:{padding:"base.spacing.x4"},children:l("drawers.coinSelector.noCoins")}),!a&&n.map((({onClick:e,icon:n,name:a,symbol:i,balance:o,id:s,testId:l})=>t(ve,{id:s,testId:l,onClick:e,icon:n,name:a,symbol:i,balance:o,defaultTokenImage:r},`${i}-${a}`)))]})})]})}function Ie({testId:e,options:n,optionsLoading:r,subtext:a,onSelectChange:o,textAlign:s,errorMessage:l,disabled:d,selectedOption:p,coinSelectorHeading:h,defaultTokenImage:u}){const[g,m]=i.useState(!1),f=i.useMemo((()=>n.map((t=>({...t,testId:e,onClick:()=>{o(t.id),m(!1)}})))),[n,o,m]);return c(b,{children:[t(je,{heading:h,options:f,defaultTokenImage:u,optionsLoading:r??!1,visible:g,onCloseDrawer:()=>m(!1)}),t(Z,{testId:`${e}-select-control`,textAlign:s??"left",subtext:l?void 0:a,isErrored:!!l,errorMessage:l,children:t(F,{testId:`${e}-select`,size:"large",defaultLabel:"Select coin",targetClickOveride:()=>m(!0),selectedOption:(()=>{if(p&&0!==n.length&&n.find((e=>e.id===p)))return p})(),sx:{minw:"170px"},children:n.filter((e=>e.id===p))?.map((e=>c(F.Option,{optionKey:e.id,testId:e.testId,disabled:d,children:[!e.icon&&t(F.Option.Icon,{icon:"Coins",variant:"bold"}),e.icon&&t(F.Option.FramedImage,{imageUrl:e.icon,circularFrame:!0,defaultImageUrl:u,sx:{background:"base.color.translucent.standard.100"}}),t(F.Option.Label,{children:e.symbol})]},e.id)))})})]})}function Ee({testId:e,value:n,placeholder:r,errorMessage:a,validator:i,onTextInputChange:o,onTextInputBlur:s,onTextInputFocus:l,onTextInputEnter:c,textAlign:d,type:p,subtext:h,maxButtonClick:u,disabled:b}){return t(Z,{testId:`${e}-text-control`,textAlign:d??"left",subtext:a?void 0:h,isErrored:!!a,errorMessage:a,sx:{width:"100%"},children:t(z,{testId:`${e}-text`,onChange:e=>((e,t)=>{let n=e.target.value;"number"===p&&"."===n&&(n="0."),i(n)?o(n):o(t??"")})(e,n),sizeVariant:"large",value:n,validationStatus:a?"error":"success",placeholder:r,onBlur:e=>{if(!s)return;const t=e.target.value;i(t)&&s(t)},onFocus:e=>{if(!l)return;const t=e.target.value;i(t)&&l(t)},onKeyDown:e=>{c&&"Enter"===e.key&&c()},disabled:b,hideClearValueButton:!0,sx:{minWidth:"100%"},children:u&&t(z.Button,{testId:`${e}-max-button`,onClick:u,disabled:b,children:"max"})})})}const Me={display:"flex",flexDirection:"column",height:"100%",padding:"16px 16px 0 16px"},He={display:"flex",flexDirection:"column",gap:"10px",height:"100%"},Se={display:"flex",width:"100%"},Ae=e=>({width:"50%",color:e?"base.color.text.body.primary":"base.color.text.body.secondary"}),De={width:"50%"},Pe={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"};function Be({boldLabel:e,label:n,amount:r,fiatAmount:a,tokenSymbol:i,prefix:o=""}){const s=n.toLowerCase().replace(" ","-");return c(b,{sx:Se,testId:`fee-item-${s}`,children:[t(S,{sx:Ae(e),children:n}),t(T,{testId:s,sx:De,price:`${o}${i} ${r}`,fiatAmount:a})]})}function Fe({fees:e,children:n,visible:r,onCloseDrawer:a,totalFiatAmount:i,totalAmount:o,tokenSymbol:s,loading:l=!1}){const{t:d}=w();return c(P,{headerBarTitle:d("drawers.feesBreakdown.heading"),size:"threeQuarter",onCloseDrawer:a,visible:r,children:[t(P.Target,{children:n}),c(P.Content,{testId:"fees-breakdown-content",sx:Me,children:[c(b,{sx:He,children:[l&&c(b,{sx:Pe,children:[t(B,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),t(B,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"})]}),!l&&e.map((({label:e,amount:n,fiatAmount:r,prefix:a})=>t(Be,{label:e,amount:n,fiatAmount:r,tokenSymbol:s,prefix:a},e))),o&&c(W,{children:[t(C,{size:"xSmall"}),t(Be,{label:d("drawers.feesBreakdown.total"),amount:N(o),fiatAmount:i?`~ ${d("drawers.feesBreakdown.fees.fiatPricePrefix")}${i}`:_("0"),tokenSymbol:s,boldLabel:!0},d("drawers.feesBreakdown.total"))]})]}),t(D,{})]})]})}const Ze={backgroundColor:"base.color.translucent.emphasis.100"},ze={marginBottom:"base.spacing.x4",color:"base.color.text.body.secondary"};function Te({gasFeeValue:e,gasFeeToken:n,gasFeeFiatValue:r,fees:a,onFeesClick:o,loading:s,sx:l}){const[d,p]=i.useState(!1),{t:h}=w();if(!e&&!s)return t(b,{});const u=_(N(e)),g=n?.symbol;return c(W,{children:[c(Ce,{targetClickOveride:()=>{p(!0),o?.()},sx:{...Ze,paddingBottom:"base.spacing.x2",...l},children:[t(Ce.TargetLeftSlot,{children:t(S,{size:"medium",sx:ze,children:h("drawers.feesBreakdown.heading")})}),c(Ce.TargetRightSlot,{children:[s&&t(b,{sx:{width:"218px",position:"relative"},children:t(b,{sx:{display:"block",position:"absolute",top:"-15px",width:"100%",height:"68px",WebkitMaskPosition:"right center",WebkitMaskRepeat:"no-repeat",WebkitMaskSize:"contain",WebkitMaskImage:'url(\'data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="196" height="96"><path d="M182.85 55.2Q181.65 54 180 54h-56q-1.7 0-2.85 1.2Q120 56.35 120 58v4q0 1.7 1.15 2.85Q122.3 66 124 66h56q1.65 0 2.85-1.15Q184 63.7 184 62v-4q0-1.65-1.15-2.8m0-22Q181.65 32 180 32H68q-1.7 0-2.85 1.2Q64 34.35 64 36v8q0 1.7 1.15 2.85Q66.3 48 68 48h112q1.65 0 2.85-1.15Q184 45.7 184 44v-8q0-1.65-1.15-2.8Z" id="a"/></svg>\')'},rc:t("span",{}),children:t($,{rc:t("span",{})})})}),!s&&t(T,{testId:"fees-gas-fee__priceDisplay",fiatAmount:`~ ${h("drawers.feesBreakdown.fees.fiatPricePrefix")}${r}`,price:`~ ${g} ${_(N(u))}`})]})]}),t(Fe,{tokenSymbol:g??"",fees:a,visible:d,loading:s,onCloseDrawer:()=>p(!1)})]})}const We={display:"flex",flexDirection:"column",alignItems:"center",paddingY:"50px",paddingX:"base.spacing.x4",height:"100%"},Ne={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"15px"},_e={display:"flex",flexDirection:"column",justifyContent:"flex-end",gap:"8px",height:"100%",width:"100%"},$e={width:"100%",height:"64px"};function Re({onCloseDrawer:e,visible:n,showHeaderBar:r,onRetry:a}){const{t:i}=w();return t(P,{headerBarTitle:void 0,size:"full",onCloseDrawer:e,visible:n,showHeaderBar:r,children:t(P.Content,{children:c(b,{sx:We,children:[t(R,{icon:"Information",colorVariant:"guidance",iconVariant:"bold"}),c(H,{size:"small",sx:Ne,testId:"transaction-rejected-heading",children:[i("drawers.transactionFailed.content.heading1"),t("br",{}),i("drawers.transactionFailed.content.heading2")]}),c(S,{sx:Ne,children:[i("drawers.transactionFailed.content.body1"),t("br",{}),i("drawers.transactionFailed.content.body2")]}),c(b,{sx:_e,children:[t(A,{sx:$e,variant:"tertiary",onClick:a,children:i("drawers.transactionFailed.buttons.retry")}),t(A,{sx:$e,variant:"tertiary",onClick:e,testId:"transaction-rejected-cancel-button",children:i("drawers.transactionFailed.buttons.cancel")})]})]})})})}function Ve(){return t(b,{testId:"wallet-approve-hero",sx:{...V,background:"base.color.translucent.emphasis.100"},children:t(b,{sx:{...Q,...q},children:c("svg",{width:"430",height:"305",viewBox:"0 0 430 305",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t("path",{d:"M227.517 171.325L182.178 85.6034C181.033 83.4446 179.583 82.3652 178.156 82.3652C175.711 82.3652 174.322 84.1157 172.863 86.6218L137.285 164.056L183.689 253.776L227.522 171.32L227.517 171.325Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M226.841 137.597C228.497 133.997 228.338 128.188 226.484 124.682L197.866 70.5767C196.012 67.0757 193.14 67.1508 191.484 70.7503L164.936 128.427L168.399 134.936L165.396 141.464L168.85 147.992L171.853 141.464L175.307 147.992L172.304 154.52L168.85 147.992L165.846 154.52L169.3 161.048L166.287 167.562L187.922 208.465C189.776 211.966 192.648 211.891 194.304 208.292L226.845 137.597H226.841Z",fill:"#F191FA"}),t("path",{d:"M168.85 147.992L165.396 141.464L168.399 134.936L164.936 128.427L191.484 70.7503C193.14 67.1508 196.012 67.0757 197.866 70.5767L226.484 124.682C228.338 128.188 228.497 133.997 226.841 137.597H226.845L194.304 208.292C192.648 211.891 189.776 211.966 187.922 208.465L166.287 167.562L169.3 161.048L165.846 154.52L168.85 147.992ZM168.85 147.992L171.853 141.464L175.307 147.992L172.304 154.52L168.85 147.992Z",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M159.384 154.519L155.93 147.991L158.939 141.463L162.388 147.991L159.384 154.519Z",fill:"#F191FA"}),t("path",{d:"M203.136 132.773C202.484 134.19 201.353 134.223 200.621 132.843L196.101 124.297C195.369 122.917 195.308 120.627 195.961 119.21L200.621 109.082C201.273 107.665 202.404 107.632 203.136 109.012L207.656 117.558C208.388 118.938 208.449 121.228 207.796 122.645L203.136 132.773Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M206.22 114.837L204.68 118.183C204.174 119.286 203.291 119.309 202.724 118.234L199.345 111.852",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M197.542 127.015L199.058 123.716C199.565 122.613 200.447 122.589 201.015 123.664L204.394 130.046",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M293.369 250.453L252.263 172.733C249.936 168.331 243.957 164.731 238.982 164.731H173.769C171.516 164.731 169.306 164.14 167.358 163.014L162.876 160.423C160.929 159.297 158.718 158.706 156.466 158.706H147.896L141.237 164.534L189.659 256C190.612 257.493 192.452 258.417 194.939 258.417L287.456 258.445L291.473 260.904L293.904 255.733H293.895C294.556 254.315 294.449 252.471 293.379 250.448L293.369 250.453Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M232.923 169.903L235.354 164.731",stroke:"black",strokeWidth:"0.469297",strokeMiterlimit:"10"}),t("path",{d:"M249.832 177.908C247.505 173.506 241.526 169.907 236.551 169.907L142.025 169.878C139.355 169.878 137.436 168.813 136.549 167.128L186.313 261.185C187.266 262.677 189.105 263.602 191.592 263.602L286.118 263.63C291.098 263.63 293.266 260.03 290.938 255.633L249.832 177.913V177.908Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M255.328 198.77L245.041 179.313C243.581 176.548 240.235 174.042 237.161 174.042L143.555 173.93",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M188.64 259.548L282.448 259.558C285.569 259.558 286.418 257.577 285.198 255.264L276.103 238.064",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M150.238 159.776C150.965 161.151 149.539 163.338 147.051 164.652C144.564 165.966 141.96 165.919 141.227 164.539C140.495 163.159 141.927 160.977 144.414 159.663C145.62 159.025 146.854 158.71 147.891 158.71C148.99 158.71 149.863 159.067 150.238 159.776Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M147.826 161.052C148.164 161.69 147.502 162.704 146.348 163.314C145.193 163.924 143.983 163.9 143.645 163.262C143.307 162.624 143.969 161.61 145.123 161C145.681 160.705 146.254 160.559 146.737 160.559C147.249 160.559 147.652 160.723 147.826 161.057V161.052Z",fill:"black"}),t("path",{d:"M171.652 85.828L136.755 161.652C135.788 163.75 135.784 165.669 136.549 167.124C136.549 167.124 137.717 169.874 142.025 169.874C146.333 169.874 151.754 169.907 151.754 169.907L153.115 167.5L143.419 167.467C139.669 167.467 137.637 165.186 139.205 161.779L174.163 85.8233C175.223 83.5238 176.678 82.3646 178.156 82.3646C178.156 82.3646 173.431 81.961 171.652 85.8233V85.828Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M273.579 230.377L277.263 229.767L287.024 238.458L278.347 222.051L270.373 223.609L273.579 230.377Z",fill:"black"}),t("path",{d:"M274.968 235.918C272.495 231.239 272.777 228.33 278.296 226.565C281.262 225.617 283.951 224.073 286.255 221.98L291.328 217.371C295.725 213.378 297.049 205.813 294.275 200.561C291.497 195.31 285.626 194.282 281.233 198.276L275.071 203.874C272.983 205.775 270.327 206.939 267.516 207.206C261.79 207.746 259.392 206.456 256.769 201.495L255.399 206.127L271.073 235.923H274.973L274.968 235.918Z",fill:"#EBE9E9"}),t("path",{d:"M274.968 235.918C272.495 231.239 272.776 228.33 278.295 226.565C281.261 225.617 283.95 224.073 286.255 221.98L291.328 217.371C295.725 213.378 297.048 205.813 294.275 200.561C291.497 195.31 285.626 194.282 281.233 198.276L275.071 203.874C272.983 205.775 270.327 206.939 267.516 207.206C261.79 207.746 259.392 206.456 256.769 201.495",stroke:"black",strokeWidth:"0.469297",strokeMiterlimit:"10"}),t("path",{d:"M289.926 200.125C287.265 199.276 284.074 201.829 282.793 205.832C281.512 209.835 282.629 213.768 285.29 214.617L286.533 215.016L291.17 200.524L289.926 200.125Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M293.683 209.321C294.963 205.319 293.846 201.386 291.187 200.535C288.528 199.685 285.335 202.239 284.055 206.241C282.775 210.242 283.892 214.176 286.551 215.026C289.21 215.877 292.403 213.322 293.683 209.321Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M213.26 224.182C211.237 224.182 208.816 222.722 207.868 220.934L189.021 185.301C188.077 183.513 188.955 182.053 190.978 182.053L231.3 182.039C233.322 182.039 235.744 183.499 236.692 185.287L255.539 220.92C256.482 222.708 255.604 224.168 253.582 224.168L213.26 224.182Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M214.334 222.319C212.312 222.319 209.89 220.859 208.942 219.071L190.095 183.438C189.884 183.034 189.767 182.649 189.729 182.292C188.64 182.776 188.302 183.944 189.02 185.301L207.867 220.934C208.811 222.722 211.237 224.182 213.26 224.182L253.582 224.168C255.144 224.168 256.022 223.29 255.9 222.065C255.557 222.22 255.14 222.305 254.652 222.305L214.33 222.319H214.334Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M231.586 203.083L233.646 206.978H228.756H223.871H218.981H215.513C214.733 206.978 214.363 207.489 214.691 208.109L215.555 209.737C215.883 210.361 216.794 210.873 217.577 210.873H221.046H225.936L227.395 213.632C227.724 214.256 228.634 214.763 229.418 214.763H231.464C232.243 214.763 232.614 214.252 232.285 213.628L230.826 210.868H235.716H239.184C239.963 210.868 240.334 210.352 240.005 209.732L238.546 206.973L237.086 204.214C236.758 203.589 235.847 203.083 235.063 203.083H231.595H231.586Z",fill:"#F191FA"}),t("path",{d:"M214.855 199.191L216.315 201.951C216.648 202.575 217.554 203.086 218.342 203.086H221.81H226.696H231.586L230.126 200.322C229.793 199.698 228.887 199.187 228.099 199.187H224.631H219.746H214.855V199.191Z",fill:"#F191FA"}),t("path",{d:"M214.986 187.501C214.207 187.501 213.837 188.013 214.165 188.632L215.625 191.392H210.735H207.266C206.487 191.392 206.117 191.903 206.445 192.527L207.905 195.287L209.364 198.046C209.693 198.671 210.603 199.177 211.387 199.177H214.855L212.795 195.282H217.685H222.57H227.46H230.928C231.707 195.282 232.078 194.771 231.75 194.147L230.891 192.523C230.558 191.899 229.652 191.387 228.868 191.387H225.4H220.51L219.051 188.628C218.722 188.003 217.812 187.497 217.028 187.497H214.982L214.986 187.501Z",fill:"#F191FA"}),t("path",{d:"M214.098 243.795L212.428 240.641C211.78 239.412 210.109 238.412 208.725 238.412H202.849L200.428 233.832C199.78 232.602 198.114 231.603 196.725 231.603H191.751C191 231.603 190.483 231.898 190.263 232.363L189.066 234.906L191.464 235.826L192.835 238.417H186.959C186.208 238.417 185.692 238.712 185.471 239.177L184.275 241.721L186.612 242.528L187.288 243.804C187.935 245.034 189.606 246.033 190.99 246.033H196.866L199.287 250.614C199.935 251.843 201.601 252.843 202.99 252.843H205.032L208.256 254.631L209.452 252.087C209.635 251.693 209.607 251.177 209.307 250.614L206.885 246.033H210.194L213.057 247.817L214.253 245.273C214.441 244.879 214.408 244.363 214.108 243.8L214.098 243.795Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M212.902 246.339L211.231 243.185C210.584 241.956 208.913 240.956 207.529 240.956H201.653L199.231 236.376C198.584 235.151 196.918 234.146 195.529 234.146H190.554C189.165 234.146 188.564 235.151 189.212 236.38L191.634 240.961H185.758C184.369 240.961 183.763 241.97 184.416 243.195L186.086 246.348C186.734 247.578 188.405 248.577 189.789 248.577H195.665L198.086 253.158C198.734 254.387 200.4 255.387 201.789 255.387H206.764C208.153 255.387 208.753 254.383 208.106 253.153L205.684 248.573H211.56C212.949 248.573 213.554 247.564 212.902 246.339Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M208.107 253.158L205.685 248.573",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M191.634 240.96H185.758",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M212.902 246.339L211.231 243.185C210.584 241.956 208.913 240.956 207.528 240.956H201.653L199.231 236.376C198.584 235.151 196.918 234.146 195.528 234.146H190.554",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M356.061 232.632L355.632 231L354 231.429L354.429 233.061L356.061 232.632Z",fill:"white"}),t("path",{d:"M57.6531 168.341L57.1006 166.24L54.9996 166.793L55.5521 168.894L57.6531 168.341Z",fill:"white"}),t("path",{d:"M103.489 244.345L101.345 244L101 246.145L103.144 246.49L103.489 244.345Z",fill:"white"}),t("path",{d:"M341.286 111.905L341.905 110.619L340.619 110L340 111.286L341.286 111.905Z",fill:"white"}),t("path",{d:"M323.144 179.08L322.592 176.979L320.491 177.531L321.043 179.632L323.144 179.08Z",fill:"white"}),t("path",{d:"M328.919 177.658L329.538 176.372L328.252 175.753L327.633 177.039L328.919 177.658Z",fill:"white"}),t("path",{d:"M88.1441 141.383L87.2188 140.296L86.1321 141.221L87.0574 142.308L88.1441 141.383Z",fill:"white"}),t("path",{d:"M258.286 89.9052L258.905 88.6191L257.619 88L257 89.2861L258.286 89.9052Z",fill:"white"})]})})})}const Qe=async({checkout:e,provider:t,allowTokenListType:n,chainId:r,allowZero:a=!1,retryPolicy:i=K})=>{const o=r||(await e.getNetworkInfo({provider:t})).chainId,s=await t.getSigner().getAddress(),l=await Y((()=>e.getAllBalances({provider:t,walletAddress:s,chainId:o})),{...i});if(void 0===l)return;const c=await e.getTokenAllowList({chainId:o,type:n}),d=new Map;c.tokens.forEach((e=>d.set(e.address?.toLowerCase()||X,!0)));const p=l.balances.filter((e=>!(e.balance.lte(0)&&!a)&&d.get(e.token.address?.toLowerCase()||X))).map((t=>({...t,token:{...t.token,icon:U(e.config.environment,G(t.token.address)?t.token.symbol:t.token.address??"")}})))??[];return c.tokens=c.tokens.map((t=>({...t,icon:U(e.config.environment,G(t.address)?t.symbol:t.address??"")}))),{allowList:c,allowedBalances:p}};export{Ce as A,Te as F,we as N,Ie as S,Ee as T,Ve as W,Re as a,Qe as g};
@@ -1 +1 @@
1
- import{di as e,dj as t,du as r,dl as n,dk as a}from"./index-4da0c2bb.js";function i(i,s,c){var o;return e(this,void 0,void 0,(function(){var l,u,d,f,m=this;return t(this,(function(v){switch(v.label){case 0:return r()?[2,[]]:(l=n(),u=null!==(o=s.enabledMiddleware)&&void 0!==o?o:{},d=Object.entries(u).filter((function(e){return e[0],e[1]})).map((function(e){return e[0]})),f=d.map((function(r){return e(m,void 0,void 0,(function(){var e,n,s,o;return t(this,(function(t){switch(t.label){case 0:e=r.replace("@segment/",""),n=e,c&&(n=btoa(e).replace(/=/g,"")),s="".concat(l,"/middleware/").concat(n,"/latest/").concat(n,".js.gz"),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,a(s)];case 2:return t.sent(),[2,window["".concat(e,"Middleware")]];case 3:return o=t.sent(),i.log("error",o),i.stats.increment("failed_remote_middleware"),[3,4];case 4:return[2]}}))}))})),[4,Promise.all(f)]);case 1:return[2,v.sent().filter(Boolean)]}}))}))}export{i as remoteMiddlewares};
1
+ import{di as e,dj as t,du as r,dl as n,dk as a}from"./index-9493d2b3.js";function i(i,s,c){var o;return e(this,void 0,void 0,(function(){var l,u,d,f,m=this;return t(this,(function(v){switch(v.label){case 0:return r()?[2,[]]:(l=n(),u=null!==(o=s.enabledMiddleware)&&void 0!==o?o:{},d=Object.entries(u).filter((function(e){return e[0],e[1]})).map((function(e){return e[0]})),f=d.map((function(r){return e(m,void 0,void 0,(function(){var e,n,s,o;return t(this,(function(t){switch(t.label){case 0:e=r.replace("@segment/",""),n=e,c&&(n=btoa(e).replace(/=/g,"")),s="".concat(l,"/middleware/").concat(n,"/latest/").concat(n,".js.gz"),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,a(s)];case 2:return t.sent(),[2,window["".concat(e,"Middleware")]];case 3:return o=t.sent(),i.log("error",o),i.stats.increment("failed_remote_middleware"),[3,4];case 4:return[2]}}))}))})),[4,Promise.all(f)]);case 1:return[2,v.sent().filter(Boolean)]}}))}))}export{i as remoteMiddlewares};
@@ -1 +1 @@
1
- import{di as t,dj as n,dk as i,dl as e,dm as r,dn as o,dp as s,dq as a,dr as u,ds as c,dt as d,du as l,dv as h,dw as v,dx as f,dy as p,dz as g,dA as y,dB as m,dC as w}from"./index-4da0c2bb.js";import{i as b}from"./is-plan-event-enabled-80f76ce6.js";function _(t){return t.toLowerCase().replace(".","").replace(/\s+/g,"-")}function k(t,n){return void 0===n&&(n=!1),n?btoa(t).replace(/=/g,""):void 0}function z(r,s,a,u){return t(this,void 0,void 0,(function(){var t,c,d,l,h,v;return n(this,(function(n){switch(n.label){case 0:t=_(s),c=k(t,u),d=e(),l="".concat(d,"/integrations/").concat(null!=c?c:t,"/").concat(a,"/").concat(null!=c?c:t,".dynamic.js.gz"),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,i(l)];case 2:return n.sent(),function(t,n,i){var e,r;try{var s=(null!==(r=null===(e=null===window||void 0===window?void 0:window.performance)||void 0===e?void 0:e.getEntriesByName(t,"resource"))&&void 0!==r?r:[])[0];s&&n.stats.gauge("legacy_destination_time",Math.round(s.duration),o([i],s.duration<100?["cached"]:[],!0))}catch(t){}}(l,r,s),[3,4];case 3:throw h=n.sent(),r.stats.gauge("legacy_destination_time",-1,["plugin:".concat(s),"failed"]),h;case 4:return v=window["".concat(t,"Deps")],[4,Promise.all(v.map((function(t){return i(d+t+".gz")})))];case 5:return n.sent(),window["".concat(t,"Loader")](),[2,window["".concat(t,"Integration")]]}}))}))}function S(i,e){return t(this,void 0,void 0,(function(){var r,o=this;return n(this,(function(a){switch(a.label){case 0:return r=[],s()?[2,e]:[4,f((function(){return e.length>0&&m()}),(function(){return t(o,void 0,void 0,(function(){var t,o;return n(this,(function(n){switch(n.label){case 0:return(t=e.pop())?[4,y(t,i)]:[2];case 1:return o=n.sent(),o instanceof w||r.push(t),[2]}}))}))}))];case 1:return a.sent(),r.map((function(t){return e.pushWithBackoff(t)})),[2,e]}}))}))}var I=function(){function i(t,n,i,e,r,o){void 0===e&&(e={}),this.options={},this.type="destination",this.middleware=[],this._ready=!1,this._initialized=!1,this.flushing=!1,this.name=t,this.version=n,this.settings=a({},e),this.disableAutoISOConversion=r.disableAutoISOConversion||!1,this.integrationSource=o,this.settings.type&&"browser"===this.settings.type&&delete this.settings.type,this.options=r,this.buffer=r.disableClientPersistence?new p(4,[]):new g(4,"".concat(i,":dest-").concat(t)),this.scheduleFlush()}return i.prototype.isLoaded=function(){return this._ready},i.prototype.ready=function(){var t;return null!==(t=this.onReady)&&void 0!==t?t:Promise.resolve()},i.prototype.load=function(i,e){var r;return t(this,void 0,void 0,(function(){var t,o,s=this;return n(this,(function(n){switch(n.label){case 0:return this._ready||void 0!==this.onReady?[2]:null===(r=this.integrationSource)||void 0===r?[3,1]:(o=r,[3,3]);case 1:return[4,z(i,this.name,this.version,this.options.obfuscate)];case 2:o=n.sent(),n.label=3;case 3:t=o,this.integration=function(t,n,i){var e;"Integration"in t?(t({user:function(){return i.user()},addIntegration:function(){}}),e=t.Integration):e=t;var r=new e(n);return r.analytics=i,r}(t,this.settings,e),this.onReady=new Promise((function(t){s.integration.once("ready",(function(){s._ready=!0,t(!0)}))})),this.onInitialize=new Promise((function(t){s.integration.on("initialize",(function(){s._initialized=!0,t(!0)}))}));try{i.stats.increment("analytics_js.integration.invoke",1,["method:initialize","integration_name:".concat(this.name)]),this.integration.initialize()}catch(t){throw i.stats.increment("analytics_js.integration.invoke.error",1,["method:initialize","integration_name:".concat(this.name)]),t}return[2]}}))}))},i.prototype.unload=function(i,o){return function(i,o,s){return t(this,void 0,void 0,(function(){var t,a,u,c;return n(this,(function(n){return t=e(),a=_(i),u=k(i,s),c="".concat(t,"/integrations/").concat(null!=u?u:a,"/").concat(o,"/").concat(null!=u?u:a,".dynamic.js.gz"),[2,r(c)]}))}))}(this.name,this.version,this.options.obfuscate)},i.prototype.addMiddleware=function(){for(var t,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];this.middleware=(t=this.middleware).concat.apply(t,n)},i.prototype.shouldBuffer=function(t){return"page"!==t.event.type&&(s()||!1===this._ready||!1===this._initialized)},i.prototype.send=function(i,e,r){var o,s;return t(this,void 0,void 0,(function(){var t,d,l,h,v,f;return n(this,(function(n){switch(n.label){case 0:if(this.shouldBuffer(i))return this.buffer.push(i),this.scheduleFlush(),[2,i];if(t=null===(s=null===(o=this.options)||void 0===o?void 0:o.plan)||void 0===s?void 0:s.track,d=i.event.event,t&&d&&"Segment.io"!==this.name){if(l=t[d],!b(t,l))return i.updateEvent("integrations",a(a({},i.event.integrations),{All:!1,"Segment.io":!0})),i.cancel(new u({retry:!1,reason:"Event ".concat(d," disabled for integration ").concat(this.name," in tracking plan"),type:"Dropped by plan"})),[2,i];if(i.updateEvent("integrations",a(a({},i.event.integrations),null==l?void 0:l.integrations)),(null==l?void 0:l.enabled)&&!1===(null==l?void 0:l.integrations[this.name]))return i.cancel(new u({retry:!1,reason:"Event ".concat(d," disabled for integration ").concat(this.name," in tracking plan"),type:"Dropped by plan"})),[2,i]}return[4,c(this.name,i.event,this.middleware)];case 1:if(null===(h=n.sent()))return[2,i];v=new e(h,{traverse:!this.disableAutoISOConversion}),i.stats.increment("analytics_js.integration.invoke",1,["method:".concat(r),"integration_name:".concat(this.name)]),n.label=2;case 2:return n.trys.push([2,5,,6]),this.integration?[4,this.integration.invoke.call(this.integration,r,v)]:[3,4];case 3:n.sent(),n.label=4;case 4:return[3,6];case 5:throw f=n.sent(),i.stats.increment("analytics_js.integration.invoke.error",1,["method:".concat(r),"integration_name:".concat(this.name)]),f;case 6:return[2,i]}}))}))},i.prototype.track=function(i){return t(this,void 0,void 0,(function(){return n(this,(function(t){return[2,this.send(i,d.Track,"track")]}))}))},i.prototype.page=function(i){var e;return t(this,void 0,void 0,(function(){var t=this;return n(this,(function(n){return(null===(e=this.integration)||void 0===e?void 0:e._assumesPageview)&&!this._initialized&&this.integration.initialize(),[2,this.onInitialize.then((function(){return t.send(i,d.Page,"page")}))]}))}))},i.prototype.identify=function(i){return t(this,void 0,void 0,(function(){return n(this,(function(t){return[2,this.send(i,d.Identify,"identify")]}))}))},i.prototype.alias=function(i){return t(this,void 0,void 0,(function(){return n(this,(function(t){return[2,this.send(i,d.Alias,"alias")]}))}))},i.prototype.group=function(i){return t(this,void 0,void 0,(function(){return n(this,(function(t){return[2,this.send(i,d.Group,"group")]}))}))},i.prototype.scheduleFlush=function(){var i=this;this.flushing||setTimeout((function(){return t(i,void 0,void 0,(function(){var t;return n(this,(function(n){switch(n.label){case 0:return this.flushing=!0,t=this,[4,S(this,this.buffer)];case 1:return t.buffer=n.sent(),this.flushing=!1,this.buffer.todo>0&&this.scheduleFlush(),[2]}}))}))}),5e3*Math.random())},i}();function j(t,n,i,e,r,s){var u,c;if(void 0===i&&(i={}),void 0===e&&(e={}),l())return[];n.plan&&((e=null!=e?e:{}).plan=n.plan);var d=null!==(c=null===(u=n.middlewareSettings)||void 0===u?void 0:u.routingRules)&&void 0!==c?c:[],f=n.integrations,p=e.integrations,g=h(n,null!=e?e:{}),y=null==s?void 0:s.reduce((function(t,n){var i;return a(a({},t),((i={})[function(t){return("Integration"in t?t.Integration:t).prototype.name}(n)]=n,i))}),{}),m=new Set(o(o([],Object.keys(f).filter((function(t){return function(t,n){var i,e=n.type,r=n.bundlingStatus,o=n.versionSettings,s="unbundled"!==r&&("browser"===e||(null===(i=null==o?void 0:o.componentTypes)||void 0===i?void 0:i.includes("browser")));return!t.startsWith("Segment")&&"Iterable"!==t&&s}(t,f[t])})),!0),Object.keys(y||{}).filter((function(t){return v(f[t])||v(null==p?void 0:p[t])})),!0));return Array.from(m).filter((function(t){return!function(t,n){var i=!1===n.All&&void 0===n[t];return!1===n[t]||i}(t,i)})).map((function(n){var i=function(t){var n,i,e,r;return null!==(r=null!==(i=null===(n=null==t?void 0:t.versionSettings)||void 0===n?void 0:n.override)&&void 0!==i?i:null===(e=null==t?void 0:t.versionSettings)||void 0===e?void 0:e.version)&&void 0!==r?r:"latest"}(f[n]),o=new I(n,i,t,g[n],e,null==y?void 0:y[n]);return d.filter((function(t){return t.destinationName===n})).length>0&&r&&o.addMiddleware(r),o}))}export{I as LegacyDestination,j as ajsDestinations};
1
+ import{di as t,dj as n,dk as i,dl as e,dm as r,dn as o,dp as s,dq as a,dr as u,ds as c,dt as d,du as l,dv as h,dw as v,dx as f,dy as p,dz as g,dA as y,dB as m,dC as w}from"./index-9493d2b3.js";import{i as b}from"./is-plan-event-enabled-80f76ce6.js";function _(t){return t.toLowerCase().replace(".","").replace(/\s+/g,"-")}function k(t,n){return void 0===n&&(n=!1),n?btoa(t).replace(/=/g,""):void 0}function z(r,s,a,u){return t(this,void 0,void 0,(function(){var t,c,d,l,h,v;return n(this,(function(n){switch(n.label){case 0:t=_(s),c=k(t,u),d=e(),l="".concat(d,"/integrations/").concat(null!=c?c:t,"/").concat(a,"/").concat(null!=c?c:t,".dynamic.js.gz"),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,i(l)];case 2:return n.sent(),function(t,n,i){var e,r;try{var s=(null!==(r=null===(e=null===window||void 0===window?void 0:window.performance)||void 0===e?void 0:e.getEntriesByName(t,"resource"))&&void 0!==r?r:[])[0];s&&n.stats.gauge("legacy_destination_time",Math.round(s.duration),o([i],s.duration<100?["cached"]:[],!0))}catch(t){}}(l,r,s),[3,4];case 3:throw h=n.sent(),r.stats.gauge("legacy_destination_time",-1,["plugin:".concat(s),"failed"]),h;case 4:return v=window["".concat(t,"Deps")],[4,Promise.all(v.map((function(t){return i(d+t+".gz")})))];case 5:return n.sent(),window["".concat(t,"Loader")](),[2,window["".concat(t,"Integration")]]}}))}))}function S(i,e){return t(this,void 0,void 0,(function(){var r,o=this;return n(this,(function(a){switch(a.label){case 0:return r=[],s()?[2,e]:[4,f((function(){return e.length>0&&m()}),(function(){return t(o,void 0,void 0,(function(){var t,o;return n(this,(function(n){switch(n.label){case 0:return(t=e.pop())?[4,y(t,i)]:[2];case 1:return o=n.sent(),o instanceof w||r.push(t),[2]}}))}))}))];case 1:return a.sent(),r.map((function(t){return e.pushWithBackoff(t)})),[2,e]}}))}))}var I=function(){function i(t,n,i,e,r,o){void 0===e&&(e={}),this.options={},this.type="destination",this.middleware=[],this._ready=!1,this._initialized=!1,this.flushing=!1,this.name=t,this.version=n,this.settings=a({},e),this.disableAutoISOConversion=r.disableAutoISOConversion||!1,this.integrationSource=o,this.settings.type&&"browser"===this.settings.type&&delete this.settings.type,this.options=r,this.buffer=r.disableClientPersistence?new p(4,[]):new g(4,"".concat(i,":dest-").concat(t)),this.scheduleFlush()}return i.prototype.isLoaded=function(){return this._ready},i.prototype.ready=function(){var t;return null!==(t=this.onReady)&&void 0!==t?t:Promise.resolve()},i.prototype.load=function(i,e){var r;return t(this,void 0,void 0,(function(){var t,o,s=this;return n(this,(function(n){switch(n.label){case 0:return this._ready||void 0!==this.onReady?[2]:null===(r=this.integrationSource)||void 0===r?[3,1]:(o=r,[3,3]);case 1:return[4,z(i,this.name,this.version,this.options.obfuscate)];case 2:o=n.sent(),n.label=3;case 3:t=o,this.integration=function(t,n,i){var e;"Integration"in t?(t({user:function(){return i.user()},addIntegration:function(){}}),e=t.Integration):e=t;var r=new e(n);return r.analytics=i,r}(t,this.settings,e),this.onReady=new Promise((function(t){s.integration.once("ready",(function(){s._ready=!0,t(!0)}))})),this.onInitialize=new Promise((function(t){s.integration.on("initialize",(function(){s._initialized=!0,t(!0)}))}));try{i.stats.increment("analytics_js.integration.invoke",1,["method:initialize","integration_name:".concat(this.name)]),this.integration.initialize()}catch(t){throw i.stats.increment("analytics_js.integration.invoke.error",1,["method:initialize","integration_name:".concat(this.name)]),t}return[2]}}))}))},i.prototype.unload=function(i,o){return function(i,o,s){return t(this,void 0,void 0,(function(){var t,a,u,c;return n(this,(function(n){return t=e(),a=_(i),u=k(i,s),c="".concat(t,"/integrations/").concat(null!=u?u:a,"/").concat(o,"/").concat(null!=u?u:a,".dynamic.js.gz"),[2,r(c)]}))}))}(this.name,this.version,this.options.obfuscate)},i.prototype.addMiddleware=function(){for(var t,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];this.middleware=(t=this.middleware).concat.apply(t,n)},i.prototype.shouldBuffer=function(t){return"page"!==t.event.type&&(s()||!1===this._ready||!1===this._initialized)},i.prototype.send=function(i,e,r){var o,s;return t(this,void 0,void 0,(function(){var t,d,l,h,v,f;return n(this,(function(n){switch(n.label){case 0:if(this.shouldBuffer(i))return this.buffer.push(i),this.scheduleFlush(),[2,i];if(t=null===(s=null===(o=this.options)||void 0===o?void 0:o.plan)||void 0===s?void 0:s.track,d=i.event.event,t&&d&&"Segment.io"!==this.name){if(l=t[d],!b(t,l))return i.updateEvent("integrations",a(a({},i.event.integrations),{All:!1,"Segment.io":!0})),i.cancel(new u({retry:!1,reason:"Event ".concat(d," disabled for integration ").concat(this.name," in tracking plan"),type:"Dropped by plan"})),[2,i];if(i.updateEvent("integrations",a(a({},i.event.integrations),null==l?void 0:l.integrations)),(null==l?void 0:l.enabled)&&!1===(null==l?void 0:l.integrations[this.name]))return i.cancel(new u({retry:!1,reason:"Event ".concat(d," disabled for integration ").concat(this.name," in tracking plan"),type:"Dropped by plan"})),[2,i]}return[4,c(this.name,i.event,this.middleware)];case 1:if(null===(h=n.sent()))return[2,i];v=new e(h,{traverse:!this.disableAutoISOConversion}),i.stats.increment("analytics_js.integration.invoke",1,["method:".concat(r),"integration_name:".concat(this.name)]),n.label=2;case 2:return n.trys.push([2,5,,6]),this.integration?[4,this.integration.invoke.call(this.integration,r,v)]:[3,4];case 3:n.sent(),n.label=4;case 4:return[3,6];case 5:throw f=n.sent(),i.stats.increment("analytics_js.integration.invoke.error",1,["method:".concat(r),"integration_name:".concat(this.name)]),f;case 6:return[2,i]}}))}))},i.prototype.track=function(i){return t(this,void 0,void 0,(function(){return n(this,(function(t){return[2,this.send(i,d.Track,"track")]}))}))},i.prototype.page=function(i){var e;return t(this,void 0,void 0,(function(){var t=this;return n(this,(function(n){return(null===(e=this.integration)||void 0===e?void 0:e._assumesPageview)&&!this._initialized&&this.integration.initialize(),[2,this.onInitialize.then((function(){return t.send(i,d.Page,"page")}))]}))}))},i.prototype.identify=function(i){return t(this,void 0,void 0,(function(){return n(this,(function(t){return[2,this.send(i,d.Identify,"identify")]}))}))},i.prototype.alias=function(i){return t(this,void 0,void 0,(function(){return n(this,(function(t){return[2,this.send(i,d.Alias,"alias")]}))}))},i.prototype.group=function(i){return t(this,void 0,void 0,(function(){return n(this,(function(t){return[2,this.send(i,d.Group,"group")]}))}))},i.prototype.scheduleFlush=function(){var i=this;this.flushing||setTimeout((function(){return t(i,void 0,void 0,(function(){var t;return n(this,(function(n){switch(n.label){case 0:return this.flushing=!0,t=this,[4,S(this,this.buffer)];case 1:return t.buffer=n.sent(),this.flushing=!1,this.buffer.todo>0&&this.scheduleFlush(),[2]}}))}))}),5e3*Math.random())},i}();function j(t,n,i,e,r,s){var u,c;if(void 0===i&&(i={}),void 0===e&&(e={}),l())return[];n.plan&&((e=null!=e?e:{}).plan=n.plan);var d=null!==(c=null===(u=n.middlewareSettings)||void 0===u?void 0:u.routingRules)&&void 0!==c?c:[],f=n.integrations,p=e.integrations,g=h(n,null!=e?e:{}),y=null==s?void 0:s.reduce((function(t,n){var i;return a(a({},t),((i={})[function(t){return("Integration"in t?t.Integration:t).prototype.name}(n)]=n,i))}),{}),m=new Set(o(o([],Object.keys(f).filter((function(t){return function(t,n){var i,e=n.type,r=n.bundlingStatus,o=n.versionSettings,s="unbundled"!==r&&("browser"===e||(null===(i=null==o?void 0:o.componentTypes)||void 0===i?void 0:i.includes("browser")));return!t.startsWith("Segment")&&"Iterable"!==t&&s}(t,f[t])})),!0),Object.keys(y||{}).filter((function(t){return v(f[t])||v(null==p?void 0:p[t])})),!0));return Array.from(m).filter((function(t){return!function(t,n){var i=!1===n.All&&void 0===n[t];return!1===n[t]||i}(t,i)})).map((function(n){var i=function(t){var n,i,e,r;return null!==(r=null!==(i=null===(n=null==t?void 0:t.versionSettings)||void 0===n?void 0:n.override)&&void 0!==i?i:null===(e=null==t?void 0:t.versionSettings)||void 0===e?void 0:e.version)&&void 0!==r?r:"latest"}(f[n]),o=new I(n,i,t,g[n],e,null==y?void 0:y[n]);return d.filter((function(t){return t.destinationName===n})).length>0&&r&&o.addMiddleware(r),o}))}export{I as LegacyDestination,j as ajsDestinations};