@imtbl/sdk 1.45.6 → 1.45.7
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.
- package/dist/blockchain_data.js +2 -2
- package/dist/browser/checkout/{BridgeWidget-5fa24b8e.js → BridgeWidget-64c347f2.js} +1 -1
- package/dist/browser/checkout/{OnRampWidget-39aafca1.js → OnRampWidget-422f0deb.js} +1 -1
- package/dist/browser/checkout/SaleWidget-db0a4da8.js +1 -0
- package/dist/browser/checkout/{SpendingCapHero-7e3d3f29.js → SpendingCapHero-e05cde66.js} +1 -1
- package/dist/browser/checkout/{SwapWidget-19cf44cf.js → SwapWidget-e433536e.js} +1 -1
- package/dist/browser/checkout/{TopUpView-7a1d6bc7.js → TopUpView-e2509396.js} +1 -1
- package/dist/browser/checkout/{WalletWidget-5ac8f34a.js → WalletWidget-e977ad55.js} +1 -1
- package/dist/browser/checkout/{auto-track-19321afd.js → auto-track-4d0daee8.js} +1 -1
- package/dist/browser/checkout/{balance-e52ee518.js → balance-697e25e1.js} +1 -1
- package/dist/browser/checkout/index-0b6090b7.js +1 -0
- package/dist/browser/checkout/{index-8ad826ea.js → index-24dea9a2.js} +1 -1
- package/dist/browser/checkout/{index-f32eb4fe.js → index-2b1e0855.js} +1 -1
- package/dist/browser/checkout/{index-80285e8e.js → index-33d10388.js} +2 -2
- package/dist/browser/checkout/{index-a515997f.js → index-5f876d53.js} +1 -1
- package/dist/browser/checkout/{index-c3da72bf.js → index-6cfa4a78.js} +1 -1
- package/dist/browser/checkout/{index-488c00f8.js → index-7be33d6b.js} +1 -1
- package/dist/browser/checkout/{index-3caa8db4.js → index-f28c8046.js} +1 -1
- package/dist/browser/checkout/{index.umd-22ebb7cf.js → index.umd-0d0184c5.js} +1 -1
- package/dist/browser/checkout/{retry-0079e4e7.js → retry-2ec883f6.js} +1 -1
- package/dist/browser/checkout/sdk.js +4 -4
- package/dist/browser/checkout/widgets-esm.js +1 -1
- package/dist/browser/checkout/widgets.js +2 -2
- package/dist/checkout.d.ts +1 -0
- package/dist/checkout.js +4 -4
- package/dist/config.js +1 -1
- package/dist/index.browser.js +4 -4
- package/dist/index.cjs +7 -7
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -7
- package/dist/minting_backend.js +2 -2
- package/dist/orderbook.js +1 -1
- package/dist/passport.js +4 -4
- package/dist/webhook.js +1 -1
- package/dist/x.js +3 -3
- package/package.json +1 -1
- package/dist/browser/checkout/SaleWidget-ad6bf465.js +0 -1
- package/dist/browser/checkout/index-bae887b7.js +0 -1
|
@@ -928,5 +928,5 @@ const $Je=1;class eQe{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,
|
|
|
928
928
|
* @license
|
|
929
929
|
* Copyright 2018 Google LLC
|
|
930
930
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
931
|
-
*/const d$e=e=>null!=e?e:IJe;var f$e={},p$e={},h$e={};let m$e;const y$e=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];h$e.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},h$e.getSymbolTotalCodewords=function(e){return y$e[e]},h$e.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},h$e.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');m$e=e},h$e.isKanjiModeEnabled=function(){return void 0!==m$e},h$e.toSJIS=function(e){return m$e(e)};var b$e={};function g$e(){this.buffer=[],this.length=0}!function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2},e.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},e.from=function(t,n){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+t)}}(t)}catch(e){return n}}}(b$e),g$e.prototype={get:function(e){const t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(let n=0;n<t;n++)this.putBit(1==(e>>>t-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var v$e=g$e;function w$e(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}w$e.prototype.set=function(e,t,n,r){const i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},w$e.prototype.get=function(e,t){return this.data[e*this.size+t]},w$e.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},w$e.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var T$e=w$e,E$e={};!function(e){const t=h$e.getSymbolSize;e.getRowColCoords=function(e){if(1===e)return[];const n=Math.floor(e/7)+2,r=t(e),i=145===r?26:2*Math.ceil((r-13)/(2*n-2)),a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){const n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)0===e&&0===t||0===e&&t===i-1||e===i-1&&0===t||n.push([r[e],r[t]]);return n}}(E$e);var A$e={};const x$e=h$e.getSymbolSize;A$e.getPositions=function(e){const t=x$e(e);return[[0,0],[t-7,0],[0,t-7]]};var O$e={};!function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t=3,n=3,r=40,i=10;function a(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}}e.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){const n=e.size;let r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let u=0;u<n;u++){let n=e.get(c,u);n===o?i++:(i>=5&&(r+=t+(i-5)),o=n,i=1),n=e.get(u,c),n===s?a++:(a>=5&&(r+=t+(a-5)),s=n,a=1)}i>=5&&(r+=t+(i-5)),a>=5&&(r+=t+(a-5))}return r},e.getPenaltyN2=function(e){const t=e.size;let r=0;for(let n=0;n<t-1;n++)for(let i=0;i<t-1;i++){const t=e.get(n,i)+e.get(n,i+1)+e.get(n+1,i)+e.get(n+1,i+1);4!==t&&0!==t||r++}return r*n},e.getPenaltyN3=function(e){const t=e.size;let n=0,i=0,a=0;for(let r=0;r<t;r++){i=a=0;for(let o=0;o<t;o++)i=i<<1&2047|e.get(r,o),o>=10&&(1488===i||93===i)&&n++,a=a<<1&2047|e.get(o,r),o>=10&&(1488===a||93===a)&&n++}return n*r},e.getPenaltyN4=function(e){let t=0;const n=e.data.length;for(let r=0;r<n;r++)t+=e.data[r];return Math.abs(Math.ceil(100*t/n/5)-10)*i},e.applyMask=function(e,t){const n=t.size;for(let r=0;r<n;r++)for(let i=0;i<n;i++)t.isReserved(i,r)||t.xor(i,r,a(e,i,r))},e.getBestMask=function(t,n){const r=Object.keys(e.Patterns).length;let i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);const r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}}(O$e);var C$e={};const I$e=b$e,_$e=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],P$e=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];C$e.getBlocksCount=function(e,t){switch(t){case I$e.L:return _$e[4*(e-1)+0];case I$e.M:return _$e[4*(e-1)+1];case I$e.Q:return _$e[4*(e-1)+2];case I$e.H:return _$e[4*(e-1)+3];default:return}},C$e.getTotalCodewordsCount=function(e,t){switch(t){case I$e.L:return P$e[4*(e-1)+0];case I$e.M:return P$e[4*(e-1)+1];case I$e.Q:return P$e[4*(e-1)+2];case I$e.H:return P$e[4*(e-1)+3];default:return}};var S$e={},k$e={};const R$e=new Uint8Array(512),N$e=new Uint8Array(256);!function(){let e=1;for(let t=0;t<255;t++)R$e[t]=e,N$e[e]=t,e<<=1,256&e&&(e^=285);for(let e=255;e<512;e++)R$e[e]=R$e[e-255]}(),k$e.log=function(e){if(e<1)throw new Error("log("+e+")");return N$e[e]},k$e.exp=function(e){return R$e[e]},k$e.mul=function(e,t){return 0===e||0===t?0:R$e[N$e[e]+N$e[t]]},function(e){const t=k$e;e.mul=function(e,n){const r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){const e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&0===r[i];)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}}(S$e);const M$e=S$e;function D$e(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}D$e.prototype.initialize=function(e){this.degree=e,this.genPoly=M$e.generateECPolynomial(this.degree)},D$e.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const n=M$e.mod(t,this.genPoly),r=this.degree-n.length;if(r>0){const e=new Uint8Array(this.degree);return e.set(n,r),e}return n};var L$e=D$e,j$e={},F$e={},B$e={isValid:function(e){return!isNaN(e)&&e>=1&&e<=40}},U$e={};const z$e="[0-9]+";let H$e="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";H$e=H$e.replace(/u/g,"\\u");const W$e="(?:(?![A-Z0-9 $%*+\\-./:]|"+H$e+")(?:.|[\r\n]))+";U$e.KANJI=new RegExp(H$e,"g"),U$e.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),U$e.BYTE=new RegExp(W$e,"g"),U$e.NUMERIC=new RegExp(z$e,"g"),U$e.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const V$e=new RegExp("^"+H$e+"$"),G$e=new RegExp("^"+z$e+"$"),q$e=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");U$e.testKanji=function(e){return V$e.test(e)},U$e.testNumeric=function(e){return G$e.test(e)},U$e.testAlphanumeric=function(e){return q$e.test(e)},function(e){const t=B$e,n=U$e;e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!t.isValid(n))throw new Error("Invalid version: "+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},e.isValid=function(e){return e&&e.bit&&e.ccBits},e.from=function(t,n){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(e){return n}}}(F$e),function(e){const t=h$e,n=C$e,r=b$e,i=F$e,a=B$e,o=t.getBCHDigit(7973);function s(e,t){return i.getCharCountIndicator(e,t)+4}function c(e,t){let n=0;return e.forEach((function(e){const r=s(e.mode,t);n+=r+e.getBitsLength()})),n}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw new Error("Invalid QR Code version");void 0===o&&(o=i.BYTE);const c=8*(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r));if(o===i.MIXED)return c;const u=c-s(o,e);switch(o){case i.NUMERIC:return Math.floor(u/10*3);case i.ALPHANUMERIC:return Math.floor(u/11*2);case i.KANJI:return Math.floor(u/13);case i.BYTE:default:return Math.floor(u/8)}},e.getBestVersionForData=function(t,n){let a;const o=r.from(n,r.M);if(Array.isArray(t)){if(t.length>1)return function(t,n){for(let r=1;r<=40;r++)if(c(t,r)<=e.getCapacity(r,n,i.MIXED))return r}(t,o);if(0===t.length)return 1;a=t[0]}else a=t;return function(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}(a.mode,a.getLength(),o)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw new Error("Invalid QR Code version");let n=e<<12;for(;t.getBCHDigit(n)-o>=0;)n^=7973<<t.getBCHDigit(n)-o;return e<<12|n}}(j$e);var K$e={};const X$e=h$e,Y$e=X$e.getBCHDigit(1335);K$e.getEncodedBits=function(e,t){const n=e.bit<<3|t;let r=n<<10;for(;X$e.getBCHDigit(r)-Y$e>=0;)r^=1335<<X$e.getBCHDigit(r)-Y$e;return 21522^(n<<10|r)};var Z$e={};const J$e=F$e;function Q$e(e){this.mode=J$e.NUMERIC,this.data=e.toString()}Q$e.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},Q$e.prototype.getLength=function(){return this.data.length},Q$e.prototype.getBitsLength=function(){return Q$e.getBitsLength(this.data.length)},Q$e.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);const i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,3*i+1))};var $$e=Q$e;const e0e=F$e,t0e=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function n0e(e){this.mode=e0e.ALPHANUMERIC,this.data=e}n0e.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},n0e.prototype.getLength=function(){return this.data.length},n0e.prototype.getBitsLength=function(){return n0e.getBitsLength(this.data.length)},n0e.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=45*t0e.indexOf(this.data[t]);n+=t0e.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(t0e.indexOf(this.data[t]),6)};var r0e=n0e;const i0e=function(e){for(var t=[],n=e.length,r=0;r<n;r++){var i=e.charCodeAt(r);if(i>=55296&&i<=56319&&n>r+1){var a=e.charCodeAt(r+1);a>=56320&&a<=57343&&(i=1024*(i-55296)+a-56320+65536,r+=1)}i<128?t.push(i):i<2048?(t.push(i>>6|192),t.push(63&i|128)):i<55296||i>=57344&&i<65536?(t.push(i>>12|224),t.push(i>>6&63|128),t.push(63&i|128)):i>=65536&&i<=1114111?(t.push(i>>18|240),t.push(i>>12&63|128),t.push(i>>6&63|128),t.push(63&i|128)):t.push(239,191,189)}return new Uint8Array(t).buffer},a0e=F$e;function o0e(e){this.mode=a0e.BYTE,"string"==typeof e&&(e=i0e(e)),this.data=new Uint8Array(e)}o0e.getBitsLength=function(e){return 8*e},o0e.prototype.getLength=function(){return this.data.length},o0e.prototype.getBitsLength=function(){return o0e.getBitsLength(this.data.length)},o0e.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)};var s0e=o0e;const c0e=F$e,u0e=h$e;function l0e(e){this.mode=c0e.KANJI,this.data=e}l0e.getBitsLength=function(e){return 13*e},l0e.prototype.getLength=function(){return this.data.length},l0e.prototype.getBitsLength=function(){return l0e.getBitsLength(this.data.length)},l0e.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=u0e.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");n-=49472}n=192*(n>>>8&255)+(255&n),e.put(n,13)}};var d0e=l0e,f0e={exports:{}};!function(e){var t={single_source_shortest_paths:function(e,n,r){var i={},a={};a[n]=0;var o,s,c,u,l,d,f,p=t.PriorityQueue.make();for(p.push(n,0);!p.empty();)for(c in s=(o=p.pop()).value,u=o.cost,l=e[s]||{})l.hasOwnProperty(c)&&(d=u+l[c],f=a[c],(void 0===a[c]||f>d)&&(a[c]=d,p.push(c,d),i[c]=s));if(void 0!==r&&void 0===a[r]){var h=["Could not find a path from ",n," to ",r,"."].join("");throw new Error(h)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,n,r){var i=t.single_source_shortest_paths(e,n,r);return t.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var n,r=t.PriorityQueue,i={};for(n in e=e||{},r)r.hasOwnProperty(n)&&(i[n]=r[n]);return i.queue=[],i.sorter=e.sorter||r.default_sorter,i},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t}(f0e);var p0e=f0e.exports;!function(e){const t=F$e,n=$$e,r=r0e,i=s0e,a=d0e,o=U$e,s=h$e,c=p0e;function u(e){return unescape(encodeURIComponent(e)).length}function l(e,t,n){const r=[];let i;for(;null!==(i=e.exec(n));)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){const n=l(o.NUMERIC,t.NUMERIC,e),r=l(o.ALPHANUMERIC,t.ALPHANUMERIC,e);let i,a;s.isKanjiModeEnabled()?(i=l(o.BYTE,t.BYTE,e),a=l(o.KANJI,t.KANJI,e)):(i=l(o.BYTE_KANJI,t.BYTE,e),a=[]);return n.concat(r,i,a).sort((function(e,t){return e.index-t.index})).map((function(e){return{data:e.data,mode:e.mode,length:e.length}}))}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e,o){let c;const u=t.getBestModeForData(e);if(c=t.from(o,u),c!==t.BYTE&&c.bit<u.bit)throw new Error('"'+e+'" cannot be encoded with mode '+t.toString(c)+".\n Suggested mode is: "+t.toString(u));switch(c!==t.KANJI||s.isKanjiModeEnabled()||(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce((function(e,t){return"string"==typeof t?e.push(p(t,null)):t.data&&e.push(p(t.data,t.mode)),e}),[])},e.fromString=function(n,r){const i=function(e){const n=[];for(let r=0;r<e.length;r++){const i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:u(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:u(i.data)}])}}return n}(d(n,s.isKanjiModeEnabled())),a=function(e,n){const r={},i={start:{}};let a=["start"];for(let o=0;o<e.length;o++){const s=e[o],c=[];for(let e=0;e<s.length;e++){const u=s[e],l=""+o+e;c.push(l),r[l]={node:u,lastCount:0},i[l]={};for(let e=0;e<a.length;e++){const o=a[e];r[o]&&r[o].node.mode===u.mode?(i[o][l]=f(r[o].lastCount+u.length,u.mode)-f(r[o].lastCount,u.mode),r[o].lastCount+=u.length):(r[o]&&(r[o].lastCount=u.length),i[o][l]=f(u.length,u.mode)+4+t.getCharCountIndicator(u.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}(i,r),o=c.find_path(a.map,"start","end"),l=[];for(let e=1;e<o.length-1;e++)l.push(a.table[o[e]].node);return e.fromArray(function(e){return e.reduce((function(e,t){const n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)}),[])}(l))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}}(Z$e);const h0e=h$e,m0e=b$e,y0e=v$e,b0e=T$e,g0e=E$e,v0e=A$e,w0e=O$e,T0e=C$e,E0e=L$e,A0e=j$e,x0e=K$e,O0e=F$e,C0e=Z$e;function I0e(e,t,n){const r=e.size,i=x0e.getEncodedBits(t,n);let a,o;for(a=0;a<15;a++)o=1==(i>>a&1),a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function _0e(e,t,n){const r=new y0e;n.forEach((function(t){r.put(t.mode.bit,4),r.put(t.getLength(),O0e.getCharCountIndicator(t.mode,e)),t.write(r)}));const i=8*(h0e.getSymbolTotalCodewords(e)-T0e.getTotalCodewordsCount(e,t));for(r.getLengthInBits()+4<=i&&r.put(0,4);r.getLengthInBits()%8!=0;)r.putBit(0);const a=(i-r.getLengthInBits())/8;for(let e=0;e<a;e++)r.put(e%2?17:236,8);return function(e,t,n){const r=h0e.getSymbolTotalCodewords(t),i=T0e.getTotalCodewordsCount(t,n),a=r-i,o=T0e.getBlocksCount(t,n),s=r%o,c=o-s,u=Math.floor(r/o),l=Math.floor(a/o),d=l+1,f=u-l,p=new E0e(f);let h=0;const m=new Array(o),y=new Array(o);let b=0;const g=new Uint8Array(e.buffer);for(let e=0;e<o;e++){const t=e<c?l:d;m[e]=g.slice(h,h+t),y[e]=p.encode(m[e]),h+=t,b=Math.max(b,t)}const v=new Uint8Array(r);let w,T,E=0;for(w=0;w<b;w++)for(T=0;T<o;T++)w<m[T].length&&(v[E++]=m[T][w]);for(w=0;w<f;w++)for(T=0;T<o;T++)v[E++]=y[T][w];return v}(r,e,t)}function P0e(e,t,n,r){let i;if(Array.isArray(e))i=C0e.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");{let r=t;if(!r){const t=C0e.rawSplit(e);r=A0e.getBestVersionForData(t,n)}i=C0e.fromString(e,r||40)}}const a=A0e.getBestVersionForData(i,n);if(!a)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<a)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+a+".\n")}else t=a;const o=_0e(t,n,i),s=h0e.getSymbolSize(t),c=new b0e(s);return function(e,t){const n=e.size,r=v0e.getPositions(t);for(let t=0;t<r.length;t++){const i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===t||6===t)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}(c,t),function(e){const t=e.size;for(let n=8;n<t-8;n++){const t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}(c),function(e,t){const n=g0e.getPositions(t);for(let t=0;t<n.length;t++){const r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)-2===t||2===t||-2===n||2===n||0===t&&0===n?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}(c,t),I0e(c,n,0),t>=7&&function(e,t){const n=e.size,r=A0e.getEncodedBits(t);let i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=1==(r>>t&1),e.set(i,a,o,!0),e.set(a,i,o,!0)}(c,t),function(e,t){const n=e.size;let r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(6===s&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=1==(t[o]>>>a&1)),e.set(i,s-n,r),a--,-1===a&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}(c,o),isNaN(r)&&(r=w0e.getBestMask(c,I0e.bind(null,c,n))),w0e.applyMask(r,c),I0e(c,n,r),{modules:c,version:t,errorCorrectionLevel:n,maskPattern:r,segments:i}}p$e.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");let n,r,i=m0e.M;return void 0!==t&&(i=m0e.from(t.errorCorrectionLevel,m0e.M),n=A0e.from(t.version),r=w0e.from(t.maskPattern),t.toSJISFunc&&h0e.setToSJISFunction(t.toSJISFunc)),P0e(e,n,i,r)};var S0e={},k0e={};!function(e){function t(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map((function(e){return[e,e]})))),6===t.length&&t.push("F","F");const n=parseInt(t.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:"#"+t.slice(0,6).join("")}}e.getOptions=function(e){e||(e={}),e.color||(e.color={});const n=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||"#000000ff"),light:t(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},e.getImageWidth=function(t,n){const r=e.getScale(t,n);return Math.floor((t+2*n.margin)*r)},e.qrToImageData=function(t,n,r){const i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+2*r.margin)*o),c=r.margin*o,u=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let l=4*(e*s+n),d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){d=u[a[Math.floor((e-c)/o)*i+Math.floor((n-c)/o)]?1:0]}t[l++]=d.r,t[l++]=d.g,t[l++]=d.b,t[l]=d.a}}}(k0e),function(e){const t=k0e;e.render=function(e,n,r){let i=r,a=n;void 0!==i||n&&n.getContext||(i=n,n=void 0),n||(a=function(){try{return document.createElement("canvas")}catch(e){throw new Error("You need to specify a canvas element")}}()),i=t.getOptions(i);const o=t.getImageWidth(e.modules.size,i),s=a.getContext("2d"),c=s.createImageData(o,o);return t.qrToImageData(c.data,e,i),function(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=n,t.width=n,t.style.height=n+"px",t.style.width=n+"px"}(s,a,o),s.putImageData(c,0,0),a},e.renderToDataURL=function(t,n,r){let i=r;void 0!==i||n&&n.getContext||(i=n,n=void 0),i||(i={});const a=e.render(t,n,i),o=i.type||"image/png",s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}}(S0e);var R0e={};const N0e=k0e;function M0e(e,t){const n=e.a/255,r=t+'="'+e.hex+'"';return n<1?r+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function D0e(e,t,n){let r=e+t;return void 0!==n&&(r+=" "+n),r}R0e.render=function(e,t,n){const r=N0e.getOptions(t),i=e.modules.size,a=e.modules.data,o=i+2*r.margin,s=r.color.light.a?"<path "+M0e(r.color.light,"fill")+' d="M0 0h'+o+"v"+o+'H0z"/>':"",c="<path "+M0e(r.color.dark,"stroke")+' d="'+function(e,t,n){let r="",i=0,a=!1,o=0;for(let s=0;s<e.length;s++){const c=Math.floor(s%t),u=Math.floor(s/t);c||a||(a=!0),e[s]?(o++,s>0&&c>0&&e[s-1]||(r+=a?D0e("M",c+n,.5+u+n):D0e("m",i,0),i=0,a=!1),c+1<t&&e[s+1]||(r+=D0e("h",o),o=0)):i++}return r}(a,i,r.margin)+'"/>',u='viewBox="0 0 '+o+" "+o+'"',l='<svg xmlns="http://www.w3.org/2000/svg" '+(r.width?'width="'+r.width+'" height="'+r.width+'" ':"")+u+' shape-rendering="crispEdges">'+s+c+"</svg>\n";return"function"==typeof n&&n(null,l),l};const L0e=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},j0e=p$e,F0e=S0e,B0e=R0e;function U0e(e,t,n,r,i){const a=[].slice.call(arguments,1),o=a.length,s="function"==typeof a[o-1];if(!s&&!L0e())throw new Error("Callback required as last argument");if(!s){if(o<1)throw new Error("Too few arguments provided");return 1===o?(n=t,t=r=void 0):2!==o||t.getContext||(r=n,n=t,t=void 0),new Promise((function(i,a){try{const a=j0e.create(n,r);i(e(a,t,r))}catch(e){a(e)}}))}if(o<2)throw new Error("Too few arguments provided");2===o?(i=n,n=t,t=r=void 0):3===o&&(t.getContext&&void 0===i?(i=r,r=void 0):(i=r,r=n,n=t,t=void 0));try{const a=j0e.create(n,r);i(null,e(a,t,r))}catch(e){i(e)}}f$e.create=j0e.create,f$e.toCanvas=U0e.bind(null,F0e.render),f$e.toDataURL=U0e.bind(null,F0e.renderToDataURL),f$e.toString=U0e.bind(null,(function(e,t,n){return B0e.render(e,n)}));var z0e=Object.defineProperty,H0e=Object.getOwnPropertySymbols,W0e=Object.prototype.hasOwnProperty,V0e=Object.prototype.propertyIsEnumerable,G0e=(e,t,n)=>t in e?z0e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,q0e=(e,t)=>{for(var n in t||(t={}))W0e.call(t,n)&&G0e(e,n,t[n]);if(H0e)for(var n of H0e(t))V0e.call(t,n)&&G0e(e,n,t[n]);return e};const K0e={getPreset:e=>({"--wcm-accent-color":"#3396FF","--wcm-accent-fill-color":"#FFFFFF","--wcm-z-index":"89","--wcm-background-color":"#3396FF","--wcm-background-border-radius":"8px","--wcm-container-border-radius":"30px","--wcm-wallet-icon-border-radius":"15px","--wcm-wallet-icon-large-border-radius":"30px","--wcm-wallet-icon-small-border-radius":"7px","--wcm-input-border-radius":"28px","--wcm-button-border-radius":"10px","--wcm-notification-border-radius":"36px","--wcm-secondary-button-border-radius":"28px","--wcm-icon-button-border-radius":"50%","--wcm-button-hover-highlight-border-radius":"10px","--wcm-text-big-bold-size":"20px","--wcm-text-big-bold-weight":"600","--wcm-text-big-bold-line-height":"24px","--wcm-text-big-bold-letter-spacing":"-0.03em","--wcm-text-big-bold-text-transform":"none","--wcm-text-xsmall-bold-size":"10px","--wcm-text-xsmall-bold-weight":"700","--wcm-text-xsmall-bold-line-height":"12px","--wcm-text-xsmall-bold-letter-spacing":"0.02em","--wcm-text-xsmall-bold-text-transform":"uppercase","--wcm-text-xsmall-regular-size":"12px","--wcm-text-xsmall-regular-weight":"600","--wcm-text-xsmall-regular-line-height":"14px","--wcm-text-xsmall-regular-letter-spacing":"-0.03em","--wcm-text-xsmall-regular-text-transform":"none","--wcm-text-small-thin-size":"14px","--wcm-text-small-thin-weight":"500","--wcm-text-small-thin-line-height":"16px","--wcm-text-small-thin-letter-spacing":"-0.03em","--wcm-text-small-thin-text-transform":"none","--wcm-text-small-regular-size":"14px","--wcm-text-small-regular-weight":"600","--wcm-text-small-regular-line-height":"16px","--wcm-text-small-regular-letter-spacing":"-0.03em","--wcm-text-small-regular-text-transform":"none","--wcm-text-medium-regular-size":"16px","--wcm-text-medium-regular-weight":"600","--wcm-text-medium-regular-line-height":"20px","--wcm-text-medium-regular-letter-spacing":"-0.03em","--wcm-text-medium-regular-text-transform":"none","--wcm-font-family":"-apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', sans-serif","--wcm-font-feature-settings":"'tnum' on, 'lnum' on, 'case' on","--wcm-success-color":"rgb(38,181,98)","--wcm-error-color":"rgb(242, 90, 103)","--wcm-overlay-background-color":"rgba(0, 0, 0, 0.3)","--wcm-overlay-backdrop-filter":"none"}[e]),setTheme(){const e=document.querySelector(":root"),{themeVariables:t}=fMe.state;if(e){const n=q0e(q0e(q0e({},function(){var e;const t={light:{foreground:{1:"rgb(20,20,20)",2:"rgb(121,134,134)",3:"rgb(158,169,169)"},background:{1:"rgb(255,255,255)",2:"rgb(241,243,243)",3:"rgb(228,231,231)"},overlay:"rgba(0,0,0,0.1)"},dark:{foreground:{1:"rgb(228,231,231)",2:"rgb(148,158,158)",3:"rgb(110,119,119)"},background:{1:"rgb(20,20,20)",2:"rgb(39,42,42)",3:"rgb(59,64,64)"},overlay:"rgba(255,255,255,0.1)"}}[null!=(e=fMe.state.themeMode)?e:"dark"];return{"--wcm-color-fg-1":t.foreground[1],"--wcm-color-fg-2":t.foreground[2],"--wcm-color-fg-3":t.foreground[3],"--wcm-color-bg-1":t.background[1],"--wcm-color-bg-2":t.background[2],"--wcm-color-bg-3":t.background[3],"--wcm-color-overlay":t.overlay}}()),{"--wcm-accent-color":"#3396FF","--wcm-accent-fill-color":"#FFFFFF","--wcm-z-index":"89","--wcm-background-color":"#3396FF","--wcm-background-border-radius":"8px","--wcm-container-border-radius":"30px","--wcm-wallet-icon-border-radius":"15px","--wcm-wallet-icon-large-border-radius":"30px","--wcm-wallet-icon-small-border-radius":"7px","--wcm-input-border-radius":"28px","--wcm-button-border-radius":"10px","--wcm-notification-border-radius":"36px","--wcm-secondary-button-border-radius":"28px","--wcm-icon-button-border-radius":"50%","--wcm-button-hover-highlight-border-radius":"10px","--wcm-text-big-bold-size":"20px","--wcm-text-big-bold-weight":"600","--wcm-text-big-bold-line-height":"24px","--wcm-text-big-bold-letter-spacing":"-0.03em","--wcm-text-big-bold-text-transform":"none","--wcm-text-xsmall-bold-size":"10px","--wcm-text-xsmall-bold-weight":"700","--wcm-text-xsmall-bold-line-height":"12px","--wcm-text-xsmall-bold-letter-spacing":"0.02em","--wcm-text-xsmall-bold-text-transform":"uppercase","--wcm-text-xsmall-regular-size":"12px","--wcm-text-xsmall-regular-weight":"600","--wcm-text-xsmall-regular-line-height":"14px","--wcm-text-xsmall-regular-letter-spacing":"-0.03em","--wcm-text-xsmall-regular-text-transform":"none","--wcm-text-small-thin-size":"14px","--wcm-text-small-thin-weight":"500","--wcm-text-small-thin-line-height":"16px","--wcm-text-small-thin-letter-spacing":"-0.03em","--wcm-text-small-thin-text-transform":"none","--wcm-text-small-regular-size":"14px","--wcm-text-small-regular-weight":"600","--wcm-text-small-regular-line-height":"16px","--wcm-text-small-regular-letter-spacing":"-0.03em","--wcm-text-small-regular-text-transform":"none","--wcm-text-medium-regular-size":"16px","--wcm-text-medium-regular-weight":"600","--wcm-text-medium-regular-line-height":"20px","--wcm-text-medium-regular-letter-spacing":"-0.03em","--wcm-text-medium-regular-text-transform":"none","--wcm-font-family":"-apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', sans-serif","--wcm-font-feature-settings":"'tnum' on, 'lnum' on, 'case' on","--wcm-success-color":"rgb(38,181,98)","--wcm-error-color":"rgb(242, 90, 103)","--wcm-overlay-background-color":"rgba(0, 0, 0, 0.3)","--wcm-overlay-backdrop-filter":"none"}),t);Object.entries(n).forEach((([t,n])=>e.style.setProperty(t,n)))}},globalCss:GZe`*,::after,::before{margin:0;padding:0;box-sizing:border-box;font-style:normal;text-rendering:optimizeSpeed;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-tap-highlight-color:transparent;backface-visibility:hidden}button{cursor:pointer;display:flex;justify-content:center;align-items:center;position:relative;border:none;background-color:transparent;transition:all .2s ease}@media (hover:hover) and (pointer:fine){button:active{transition:all .1s ease;transform:scale(.93)}}button::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;transition:background-color,.2s ease}button:disabled{cursor:not-allowed}button svg,button wcm-text{position:relative;z-index:1}input{border:none;outline:0;appearance:none}img{display:block}::selection{color:var(--wcm-accent-fill-color);background:var(--wcm-accent-color)}`},X0e=GZe`button{border-radius:var(--wcm-secondary-button-border-radius);height:28px;padding:0 10px;background-color:var(--wcm-accent-color)}button path{fill:var(--wcm-accent-fill-color)}button::after{border-radius:inherit;border:1px solid var(--wcm-color-overlay)}button:disabled::after{background-color:transparent}.wcm-icon-left svg{margin-right:5px}.wcm-icon-right svg{margin-left:5px}button:active::after{background-color:var(--wcm-color-overlay)}.wcm-ghost,.wcm-ghost:active::after,.wcm-outline{background-color:transparent}.wcm-ghost:active{opacity:.5}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}.wcm-ghost:hover::after{background-color:transparent}.wcm-ghost:hover{opacity:.5}}button:disabled{background-color:var(--wcm-color-bg-3);pointer-events:none}.wcm-ghost::after{border-color:transparent}.wcm-ghost path{fill:var(--wcm-color-fg-2)}.wcm-outline path{fill:var(--wcm-accent-color)}.wcm-outline:disabled{background-color:transparent;opacity:.5}`;var Y0e=Object.defineProperty,Z0e=Object.getOwnPropertyDescriptor,J0e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?Z0e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&Y0e(t,n,a),a};let Q0e=class extends GJe{constructor(){super(...arguments),this.disabled=!1,this.iconLeft=void 0,this.iconRight=void 0,this.onClick=()=>null,this.variant="default"}render(){const e={"wcm-icon-left":void 0!==this.iconLeft,"wcm-icon-right":void 0!==this.iconRight,"wcm-ghost":"ghost"===this.variant,"wcm-outline":"outline"===this.variant};let t="inverse";return"ghost"===this.variant&&(t="secondary"),"outline"===this.variant&&(t="accent"),xJe`<button class="${tQe(e)}" ?disabled="${this.disabled}" @click="${this.onClick}">${this.iconLeft}<wcm-text variant="small-regular" color="${t}"><slot></slot></wcm-text>${this.iconRight}</button>`}};Q0e.styles=[K0e.globalCss,X0e],J0e([ZJe({type:Boolean})],Q0e.prototype,"disabled",2),J0e([ZJe()],Q0e.prototype,"iconLeft",2),J0e([ZJe()],Q0e.prototype,"iconRight",2),J0e([ZJe()],Q0e.prototype,"onClick",2),J0e([ZJe()],Q0e.prototype,"variant",2),Q0e=J0e([KJe("wcm-button")],Q0e);const $0e=GZe`:host{display:inline-block}button{padding:0 15px 1px;height:40px;border-radius:var(--wcm-button-border-radius);color:var(--wcm-accent-fill-color);background-color:var(--wcm-accent-color)}button::after{content:'';top:0;bottom:0;left:0;right:0;position:absolute;background-color:transparent;border-radius:inherit;transition:background-color .2s ease;border:1px solid var(--wcm-color-overlay)}button:active::after{background-color:var(--wcm-color-overlay)}button:disabled{padding-bottom:0;background-color:var(--wcm-color-bg-3);color:var(--wcm-color-fg-3)}.wcm-secondary{color:var(--wcm-accent-color);background-color:transparent}.wcm-secondary::after{display:none}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}}`;var e1e=Object.defineProperty,t1e=Object.getOwnPropertyDescriptor,n1e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?t1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&e1e(t,n,a),a};let r1e=class extends GJe{constructor(){super(...arguments),this.disabled=!1,this.variant="primary"}render(){const e={"wcm-secondary":"secondary"===this.variant};return xJe`<button ?disabled="${this.disabled}" class="${tQe(e)}"><slot></slot></button>`}};r1e.styles=[K0e.globalCss,$0e],n1e([ZJe({type:Boolean})],r1e.prototype,"disabled",2),n1e([ZJe()],r1e.prototype,"variant",2),r1e=n1e([KJe("wcm-button-big")],r1e);const i1e=GZe`:host{background-color:var(--wcm-color-bg-2);border-top:1px solid var(--wcm-color-bg-3)}div{padding:10px 20px;display:inherit;flex-direction:inherit;align-items:inherit;width:inherit;justify-content:inherit}`;var a1e=Object.defineProperty,o1e=Object.getOwnPropertyDescriptor;let s1e=class extends GJe{render(){return xJe`<div><slot></slot></div>`}};s1e.styles=[K0e.globalCss,i1e],s1e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?o1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&a1e(t,n,a),a})([KJe("wcm-info-footer")],s1e);const c1e={CROSS_ICON:OJe`<svg width="12" height="12" viewBox="0 0 12 12"><path d="M9.94 11A.75.75 0 1 0 11 9.94L7.414 6.353a.5.5 0 0 1 0-.708L11 2.061A.75.75 0 1 0 9.94 1L6.353 4.586a.5.5 0 0 1-.708 0L2.061 1A.75.75 0 0 0 1 2.06l3.586 3.586a.5.5 0 0 1 0 .708L1 9.939A.75.75 0 1 0 2.06 11l3.586-3.586a.5.5 0 0 1 .708 0L9.939 11Z" fill="#fff"/></svg>`,WALLET_CONNECT_LOGO:OJe`<svg width="178" height="29" viewBox="0 0 178 29" id="wcm-wc-logo"><path d="M10.683 7.926c5.284-5.17 13.85-5.17 19.134 0l.636.623a.652.652 0 0 1 0 .936l-2.176 2.129a.343.343 0 0 1-.478 0l-.875-.857c-3.686-3.607-9.662-3.607-13.348 0l-.937.918a.343.343 0 0 1-.479 0l-2.175-2.13a.652.652 0 0 1 0-.936l.698-.683Zm23.633 4.403 1.935 1.895a.652.652 0 0 1 0 .936l-8.73 8.543a.687.687 0 0 1-.956 0L20.37 17.64a.172.172 0 0 0-.239 0l-6.195 6.063a.687.687 0 0 1-.957 0l-8.73-8.543a.652.652 0 0 1 0-.936l1.936-1.895a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .239 0l6.195-6.064a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .24 0l6.195-6.064a.687.687 0 0 1 .956 0ZM48.093 20.948l2.338-9.355c.139-.515.258-1.07.416-1.942.12.872.258 1.427.357 1.942l2.022 9.355h4.181l3.528-13.874h-3.21l-1.943 8.523a24.825 24.825 0 0 0-.456 2.457c-.158-.931-.317-1.625-.495-2.438l-1.883-8.542h-4.201l-2.042 8.542a41.204 41.204 0 0 0-.475 2.438 41.208 41.208 0 0 0-.476-2.438l-1.903-8.542h-3.349l3.508 13.874h4.083ZM63.33 21.304c1.585 0 2.596-.654 3.11-1.605-.059.297-.078.595-.078.892v.357h2.655V15.22c0-2.735-1.248-4.32-4.3-4.32-2.636 0-4.36 1.466-4.52 3.487h2.914c.1-.891.734-1.426 1.705-1.426.911 0 1.407.515 1.407 1.11 0 .435-.258.693-1.03.792l-1.388.159c-2.061.257-3.825 1.01-3.825 3.19 0 1.982 1.645 3.092 3.35 3.092Zm.891-2.041c-.773 0-1.348-.436-1.348-1.19 0-.733.655-1.09 1.645-1.268l.674-.119c.575-.118.892-.218 1.09-.396v.912c0 1.228-.892 2.06-2.06 2.06ZM70.398 7.074v13.874h2.874V7.074h-2.874ZM74.934 7.074v13.874h2.874V7.074h-2.874ZM84.08 21.304c2.735 0 4.5-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922H81.92ZM94.92 21.146c.633 0 1.248-.1 1.525-.179v-2.18c-.218.04-.475.06-.693.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.338v-2.24h-2.338V7.788H91.47v3.448H89.37v2.24h2.1v4.201c0 2.3 1.15 3.469 3.45 3.469ZM104.62 21.304c3.924 0 6.302-2.299 6.599-5.608h-3.111c-.238 1.803-1.506 3.032-3.369 3.032-2.2 0-3.746-1.784-3.746-4.796 0-2.953 1.605-4.638 3.805-4.638 1.883 0 2.953 1.15 3.171 2.834h3.191c-.317-3.448-2.854-5.41-6.342-5.41-3.984 0-7.036 2.695-7.036 7.214 0 4.677 2.676 7.372 6.838 7.372ZM117.449 21.304c2.993 0 5.114-1.882 5.114-5.172 0-3.23-2.121-5.233-5.114-5.233-2.972 0-5.093 2.002-5.093 5.233 0 3.29 2.101 5.172 5.093 5.172Zm0-2.22c-1.327 0-2.18-1.09-2.18-2.952 0-1.903.892-2.973 2.18-2.973 1.308 0 2.2 1.07 2.2 2.973 0 1.862-.872 2.953-2.2 2.953ZM126.569 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.229-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM137.464 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.228-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM149.949 21.304c2.735 0 4.499-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922h-3.984ZM160.876 21.304c3.013 0 4.658-1.645 4.975-4.201h-2.874c-.099 1.07-.713 1.982-2.001 1.982-1.309 0-2.2-1.21-2.2-2.993 0-1.942 1.03-2.933 2.259-2.933 1.209 0 1.803.872 1.883 1.882h2.873c-.218-2.358-1.823-4.142-4.776-4.142-2.874 0-5.153 1.903-5.153 5.193 0 3.25 1.923 5.212 5.014 5.212ZM172.067 21.146c.634 0 1.248-.1 1.526-.179v-2.18c-.218.04-.476.06-.694.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.339v-2.24h-2.339V7.788h-2.854v3.448h-2.1v2.24h2.1v4.201c0 2.3 1.15 3.469 3.449 3.469Z" fill="#fff"/></svg>`,WALLET_CONNECT_ICON:OJe`<svg width="28" height="20" viewBox="0 0 28 20"><g clip-path="url(#a)"><path d="M7.386 6.482c3.653-3.576 9.575-3.576 13.228 0l.44.43a.451.451 0 0 1 0 .648L19.55 9.033a.237.237 0 0 1-.33 0l-.606-.592c-2.548-2.496-6.68-2.496-9.228 0l-.648.634a.237.237 0 0 1-.33 0L6.902 7.602a.451.451 0 0 1 0-.647l.483-.473Zm16.338 3.046 1.339 1.31a.451.451 0 0 1 0 .648l-6.035 5.909a.475.475 0 0 1-.662 0L14.083 13.2a.119.119 0 0 0-.166 0l-4.283 4.194a.475.475 0 0 1-.662 0l-6.035-5.91a.451.451 0 0 1 0-.647l1.338-1.31a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0Z" fill="#000000"/></g><defs><clipPath id="a"><path fill="#ffffff" d="M0 0h28v20H0z"/></clipPath></defs></svg>`,WALLET_CONNECT_ICON_COLORED:OJe`<svg width="96" height="96" fill="none"><path fill="#fff" d="M25.322 33.597c12.525-12.263 32.83-12.263 45.355 0l1.507 1.476a1.547 1.547 0 0 1 0 2.22l-5.156 5.048a.814.814 0 0 1-1.134 0l-2.074-2.03c-8.737-8.555-22.903-8.555-31.64 0l-2.222 2.175a.814.814 0 0 1-1.134 0l-5.156-5.049a1.547 1.547 0 0 1 0-2.22l1.654-1.62Zm56.019 10.44 4.589 4.494a1.547 1.547 0 0 1 0 2.22l-20.693 20.26a1.628 1.628 0 0 1-2.267 0L48.283 56.632a.407.407 0 0 0-.567 0L33.03 71.012a1.628 1.628 0 0 1-2.268 0L10.07 50.75a1.547 1.547 0 0 1 0-2.22l4.59-4.494a1.628 1.628 0 0 1 2.267 0l14.687 14.38c.156.153.41.153.567 0l14.685-14.38a1.628 1.628 0 0 1 2.268 0l14.687 14.38c.156.153.41.153.567 0l14.686-14.38a1.628 1.628 0 0 1 2.268 0Z"/><path stroke="#000" d="M25.672 33.954c12.33-12.072 32.325-12.072 44.655 0l1.508 1.476a1.047 1.047 0 0 1 0 1.506l-5.157 5.048a.314.314 0 0 1-.434 0l-2.074-2.03c-8.932-8.746-23.409-8.746-32.34 0l-2.222 2.174a.314.314 0 0 1-.434 0l-5.157-5.048a1.047 1.047 0 0 1 0-1.506l1.655-1.62Zm55.319 10.44 4.59 4.494a1.047 1.047 0 0 1 0 1.506l-20.694 20.26a1.128 1.128 0 0 1-1.568 0l-14.686-14.38a.907.907 0 0 0-1.267 0L32.68 70.655a1.128 1.128 0 0 1-1.568 0L10.42 50.394a1.047 1.047 0 0 1 0-1.506l4.59-4.493a1.128 1.128 0 0 1 1.567 0l14.687 14.379a.907.907 0 0 0 1.266 0l-.35-.357.35.357 14.686-14.38a1.128 1.128 0 0 1 1.568 0l14.687 14.38a.907.907 0 0 0 1.267 0l14.686-14.38a1.128 1.128 0 0 1 1.568 0Z"/></svg>`,BACK_ICON:OJe`<svg width="10" height="18" viewBox="0 0 10 18"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.735.179a.75.75 0 0 1 .087 1.057L2.92 8.192a1.25 1.25 0 0 0 0 1.617l5.902 6.956a.75.75 0 1 1-1.144.97L1.776 10.78a2.75 2.75 0 0 1 0-3.559L7.678.265A.75.75 0 0 1 8.735.18Z" fill="#fff"/></svg>`,COPY_ICON:OJe`<svg width="24" height="24" fill="none"><path fill="#fff" fill-rule="evenodd" d="M7.01 7.01c.03-1.545.138-2.5.535-3.28A5 5 0 0 1 9.73 1.545C10.8 1 12.2 1 15 1c2.8 0 4.2 0 5.27.545a5 5 0 0 1 2.185 2.185C23 4.8 23 6.2 23 9c0 2.8 0 4.2-.545 5.27a5 5 0 0 1-2.185 2.185c-.78.397-1.735.505-3.28.534l-.001.01c-.03 1.54-.138 2.493-.534 3.27a5 5 0 0 1-2.185 2.186C13.2 23 11.8 23 9 23c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C1 19.2 1 17.8 1 15c0-2.8 0-4.2.545-5.27A5 5 0 0 1 3.73 7.545C4.508 7.149 5.46 7.04 7 7.01h.01ZM15 15.5c-1.425 0-2.403-.001-3.162-.063-.74-.06-1.139-.172-1.427-.319a3.5 3.5 0 0 1-1.53-1.529c-.146-.288-.257-.686-.318-1.427C8.501 11.403 8.5 10.425 8.5 9c0-1.425.001-2.403.063-3.162.06-.74.172-1.139.318-1.427a3.5 3.5 0 0 1 1.53-1.53c.288-.146.686-.257 1.427-.318.759-.062 1.737-.063 3.162-.063 1.425 0 2.403.001 3.162.063.74.06 1.139.172 1.427.318a3.5 3.5 0 0 1 1.53 1.53c.146.288.257.686.318 1.427.062.759.063 1.737.063 3.162 0 1.425-.001 2.403-.063 3.162-.06.74-.172 1.139-.319 1.427a3.5 3.5 0 0 1-1.529 1.53c-.288.146-.686.257-1.427.318-.759.062-1.737.063-3.162.063ZM7 8.511c-.444.009-.825.025-1.162.052-.74.06-1.139.172-1.427.318a3.5 3.5 0 0 0-1.53 1.53c-.146.288-.257.686-.318 1.427-.062.759-.063 1.737-.063 3.162 0 1.425.001 2.403.063 3.162.06.74.172 1.139.318 1.427a3.5 3.5 0 0 0 1.53 1.53c.288.146.686.257 1.427.318.759.062 1.737.063 3.162.063 1.425 0 2.403-.001 3.162-.063.74-.06 1.139-.172 1.427-.319a3.5 3.5 0 0 0 1.53-1.53c.146-.287.257-.685.318-1.426.027-.337.043-.718.052-1.162H15c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C7 13.2 7 11.8 7 9v-.489Z" clip-rule="evenodd"/></svg>`,RETRY_ICON:OJe`<svg width="15" height="16" viewBox="0 0 15 16"><path d="M6.464 2.03A.75.75 0 0 0 5.403.97L2.08 4.293a1 1 0 0 0 0 1.414L5.403 9.03a.75.75 0 0 0 1.06-1.06L4.672 6.177a.25.25 0 0 1 .177-.427h2.085a4 4 0 1 1-3.93 4.746c-.077-.407-.405-.746-.82-.746-.414 0-.755.338-.7.748a5.501 5.501 0 1 0 5.45-6.248H4.848a.25.25 0 0 1-.177-.427L6.464 2.03Z" fill="#fff"/></svg>`,DESKTOP_ICON:OJe`<svg width="16" height="16" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 5.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C2.204 1 3.13 1 4.98 1h6.04c1.85 0 2.775 0 3.466.394a3 3 0 0 1 1.12 1.12C16 3.204 16 4.13 16 5.98v1.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C13.796 12 12.87 12 11.02 12H4.98c-1.85 0-2.775 0-3.466-.394a3 3 0 0 1-1.12-1.12C0 9.796 0 8.87 0 7.02V5.98ZM4.98 2.5h6.04c.953 0 1.568.001 2.034.043.446.04.608.108.69.154a1.5 1.5 0 0 1 .559.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033v1.04c0 .952-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.046-.243.114-.69.154-.466.042-1.08.043-2.033.043H4.98c-.952 0-1.568-.001-2.034-.043-.446-.04-.608-.108-.69-.154a1.5 1.5 0 0 1-.559-.56c-.046-.08-.114-.243-.154-.69-.042-.465-.043-1.08-.043-2.033V5.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.046.243-.114.69-.154.465-.042 1.08-.043 2.033-.043Z" fill="#fff"/><path d="M4 14.25a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,MOBILE_ICON:OJe`<svg width="16" height="16" viewBox="0 0 16 16"><path d="M6.75 5a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M3 4.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C5.204 0 6.136 0 8 0s2.795 0 3.486.394a3 3 0 0 1 1.12 1.12C13 2.204 13 3.13 13 4.98v6.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C10.796 16 9.864 16 8 16s-2.795 0-3.486-.394a3 3 0 0 1-1.12-1.12C3 13.796 3 12.87 3 11.02V4.98Zm8.5 0v6.04c0 .953-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.045-.242.113-.693.154-.47.042-1.091.043-2.05.043-.959 0-1.58-.001-2.05-.043-.45-.04-.613-.109-.693-.154a1.5 1.5 0 0 1-.56-.56c-.046-.08-.114-.243-.154-.69-.042-.466-.043-1.08-.043-2.033V4.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.045.243-.113.693-.154C6.42 1.501 7.041 1.5 8 1.5c.959 0 1.58.001 2.05.043.45.04.613.109.693.154a1.5 1.5 0 0 1 .56.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033Z" fill="#fff"/></svg>`,ARROW_DOWN_ICON:OJe`<svg width="14" height="14" viewBox="0 0 14 14"><path d="M2.28 7.47a.75.75 0 0 0-1.06 1.06l5.25 5.25a.75.75 0 0 0 1.06 0l5.25-5.25a.75.75 0 0 0-1.06-1.06l-3.544 3.543a.25.25 0 0 1-.426-.177V.75a.75.75 0 0 0-1.5 0v10.086a.25.25 0 0 1-.427.176L2.28 7.47Z" fill="#fff"/></svg>`,ARROW_UP_RIGHT_ICON:OJe`<svg width="15" height="14" fill="none"><path d="M4.5 1.75A.75.75 0 0 1 5.25 1H12a1.5 1.5 0 0 1 1.5 1.5v6.75a.75.75 0 0 1-1.5 0V4.164a.25.25 0 0 0-.427-.176L4.061 11.5A.75.75 0 0 1 3 10.44l7.513-7.513a.25.25 0 0 0-.177-.427H5.25a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,ARROW_RIGHT_ICON:OJe`<svg width="6" height="14" viewBox="0 0 6 14"><path fill-rule="evenodd" clip-rule="evenodd" d="M2.181 1.099a.75.75 0 0 1 1.024.279l2.433 4.258a2.75 2.75 0 0 1 0 2.729l-2.433 4.257a.75.75 0 1 1-1.303-.744L4.335 7.62a1.25 1.25 0 0 0 0-1.24L1.902 2.122a.75.75 0 0 1 .28-1.023Z" fill="#fff"/></svg>`,QRCODE_ICON:OJe`<svg width="25" height="24" viewBox="0 0 25 24"><path d="M23.748 9a.748.748 0 0 0 .748-.752c-.018-2.596-.128-4.07-.784-5.22a6 6 0 0 0-2.24-2.24c-1.15-.656-2.624-.766-5.22-.784a.748.748 0 0 0-.752.748c0 .414.335.749.748.752 1.015.007 1.82.028 2.494.088.995.09 1.561.256 1.988.5.7.398 1.28.978 1.679 1.678.243.427.41.993.498 1.988.061.675.082 1.479.09 2.493a.753.753 0 0 0 .75.749ZM3.527.788C4.677.132 6.152.022 8.747.004A.748.748 0 0 1 9.5.752a.753.753 0 0 1-.749.752c-1.014.007-1.818.028-2.493.088-.995.09-1.561.256-1.988.5-.7.398-1.28.978-1.679 1.678-.243.427-.41.993-.499 1.988-.06.675-.081 1.479-.088 2.493A.753.753 0 0 1 1.252 9a.748.748 0 0 1-.748-.752c.018-2.596.128-4.07.784-5.22a6 6 0 0 1 2.24-2.24ZM1.252 15a.748.748 0 0 0-.748.752c.018 2.596.128 4.07.784 5.22a6 6 0 0 0 2.24 2.24c1.15.656 2.624.766 5.22.784a.748.748 0 0 0 .752-.748.753.753 0 0 0-.749-.752c-1.014-.007-1.818-.028-2.493-.089-.995-.089-1.561-.255-1.988-.498a4.5 4.5 0 0 1-1.679-1.68c-.243-.426-.41-.992-.499-1.987-.06-.675-.081-1.479-.088-2.493A.753.753 0 0 0 1.252 15ZM22.996 15.749a.753.753 0 0 1 .752-.749c.415 0 .751.338.748.752-.018 2.596-.128 4.07-.784 5.22a6 6 0 0 1-2.24 2.24c-1.15.656-2.624.766-5.22.784a.748.748 0 0 1-.752-.748c0-.414.335-.749.748-.752 1.015-.007 1.82-.028 2.494-.089.995-.089 1.561-.255 1.988-.498a4.5 4.5 0 0 0 1.679-1.68c.243-.426.41-.992.498-1.987.061-.675.082-1.479.09-2.493Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M7 4a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 11h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 4H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1ZM13.5 6.5A2.5 2.5 0 0 1 16 4h2a2.5 2.5 0 0 1 2.5 2.5v2A2.5 2.5 0 0 1 18 11h-2a2.5 2.5 0 0 1-2.5-2.5v-2Zm2.5-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1ZM7 13a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 20h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 13H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1Z" fill="#fff"/><path d="M13.5 15.5c0-.465 0-.697.038-.89a2 2 0 0 1 1.572-1.572C15.303 13 15.535 13 16 13v2.5h-2.5ZM18 13c.465 0 .697 0 .89.038a2 2 0 0 1 1.572 1.572c.038.193.038.425.038.89H18V13ZM18 17.5h2.5c0 .465 0 .697-.038.89a2 2 0 0 1-1.572 1.572C18.697 20 18.465 20 18 20v-2.5ZM13.5 17.5H16V20c-.465 0-.697 0-.89-.038a2 2 0 0 1-1.572-1.572c-.038-.193-.038-.425-.038-.89Z" fill="#fff"/></svg>`,SCAN_ICON:OJe`<svg width="16" height="16" fill="none"><path fill="#fff" d="M10 15.216c0 .422.347.763.768.74 1.202-.064 2.025-.222 2.71-.613a5.001 5.001 0 0 0 1.865-1.866c.39-.684.549-1.507.613-2.709a.735.735 0 0 0-.74-.768.768.768 0 0 0-.76.732c-.009.157-.02.306-.032.447-.073.812-.206 1.244-.384 1.555-.31.545-.761.996-1.306 1.306-.311.178-.743.311-1.555.384-.141.013-.29.023-.447.032a.768.768 0 0 0-.732.76ZM10 .784c0 .407.325.737.732.76.157.009.306.02.447.032.812.073 1.244.206 1.555.384a3.5 3.5 0 0 1 1.306 1.306c.178.311.311.743.384 1.555.013.142.023.29.032.447a.768.768 0 0 0 .76.732.734.734 0 0 0 .74-.768c-.064-1.202-.222-2.025-.613-2.71A5 5 0 0 0 13.477.658c-.684-.39-1.507-.549-2.709-.613a.735.735 0 0 0-.768.74ZM5.232.044A.735.735 0 0 1 6 .784a.768.768 0 0 1-.732.76c-.157.009-.305.02-.447.032-.812.073-1.244.206-1.555.384A3.5 3.5 0 0 0 1.96 3.266c-.178.311-.311.743-.384 1.555-.013.142-.023.29-.032.447A.768.768 0 0 1 .784 6a.735.735 0 0 1-.74-.768c.064-1.202.222-2.025.613-2.71A5 5 0 0 1 2.523.658C3.207.267 4.03.108 5.233.044ZM5.268 14.456a.768.768 0 0 1 .732.76.734.734 0 0 1-.768.74c-1.202-.064-2.025-.222-2.71-.613a5 5 0 0 1-1.865-1.866c-.39-.684-.549-1.507-.613-2.709A.735.735 0 0 1 .784 10c.407 0 .737.325.76.732.009.157.02.306.032.447.073.812.206 1.244.384 1.555a3.5 3.5 0 0 0 1.306 1.306c.311.178.743.311 1.555.384.142.013.29.023.447.032Z"/></svg>`,CHECKMARK_ICON:OJe`<svg width="13" height="12" viewBox="0 0 13 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.155.132a.75.75 0 0 1 .232 1.035L5.821 11.535a1 1 0 0 1-1.626.09L.665 7.21a.75.75 0 1 1 1.17-.937L4.71 9.867a.25.25 0 0 0 .406-.023L11.12.364a.75.75 0 0 1 1.035-.232Z" fill="#fff"/></svg>`,SEARCH_ICON:OJe`<svg width="20" height="21"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.432 13.992c-.354-.353-.91-.382-1.35-.146a5.5 5.5 0 1 1 2.265-2.265c-.237.441-.208.997.145 1.35l3.296 3.296a.75.75 0 1 1-1.06 1.061l-3.296-3.296Zm.06-5a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z" fill="#949E9E"/></svg>`,WALLET_PLACEHOLDER:OJe`<svg width="60" height="60" fill="none" viewBox="0 0 60 60"><g clip-path="url(#q)"><path id="wallet-placeholder-fill" fill="#fff" d="M0 24.9c0-9.251 0-13.877 1.97-17.332a15 15 0 0 1 5.598-5.597C11.023 0 15.648 0 24.9 0h10.2c9.252 0 13.877 0 17.332 1.97a15 15 0 0 1 5.597 5.598C60 11.023 60 15.648 60 24.9v10.2c0 9.252 0 13.877-1.97 17.332a15.001 15.001 0 0 1-5.598 5.597C48.977 60 44.352 60 35.1 60H24.9c-9.251 0-13.877 0-17.332-1.97a15 15 0 0 1-5.597-5.598C0 48.977 0 44.352 0 35.1V24.9Z"/><path id="wallet-placeholder-dash" stroke="#000" stroke-dasharray="4 4" stroke-width="1.5" d="M.04 41.708a231.598 231.598 0 0 1-.039-4.403l.75-.001L.75 35.1v-2.55H0v-5.1h.75V24.9l.001-2.204h-.75c.003-1.617.011-3.077.039-4.404l.75.016c.034-1.65.099-3.08.218-4.343l-.746-.07c.158-1.678.412-3.083.82-4.316l.713.236c.224-.679.497-1.296.827-1.875a14.25 14.25 0 0 1 1.05-1.585L3.076 5.9A15 15 0 0 1 5.9 3.076l.455.596a14.25 14.25 0 0 1 1.585-1.05c.579-.33 1.196-.603 1.875-.827l-.236-.712C10.812.674 12.217.42 13.895.262l.07.746C15.23.89 16.66.824 18.308.79l-.016-.75C19.62.012 21.08.004 22.695.001l.001.75L24.9.75h2.55V0h5.1v.75h2.55l2.204.001v-.75c1.617.003 3.077.011 4.404.039l-.016.75c1.65.034 3.08.099 4.343.218l.07-.746c1.678.158 3.083.412 4.316.82l-.236.713c.679.224 1.296.497 1.875.827a14.24 14.24 0 0 1 1.585 1.05l.455-.596A14.999 14.999 0 0 1 56.924 5.9l-.596.455c.384.502.735 1.032 1.05 1.585.33.579.602 1.196.827 1.875l.712-.236c.409 1.233.663 2.638.822 4.316l-.747.07c.119 1.264.184 2.694.218 4.343l.75-.016c.028 1.327.036 2.787.039 4.403l-.75.001.001 2.204v2.55H60v5.1h-.75v2.55l-.001 2.204h.75a231.431 231.431 0 0 1-.039 4.404l-.75-.016c-.034 1.65-.099 3.08-.218 4.343l.747.07c-.159 1.678-.413 3.083-.822 4.316l-.712-.236a10.255 10.255 0 0 1-.827 1.875 14.242 14.242 0 0 1-1.05 1.585l.596.455a14.997 14.997 0 0 1-2.824 2.824l-.455-.596c-.502.384-1.032.735-1.585 1.05-.579.33-1.196.602-1.875.827l.236.712c-1.233.409-2.638.663-4.316.822l-.07-.747c-1.264.119-2.694.184-4.343.218l.016.75c-1.327.028-2.787.036-4.403.039l-.001-.75-2.204.001h-2.55V60h-5.1v-.75H24.9l-2.204-.001v.75a231.431 231.431 0 0 1-4.404-.039l.016-.75c-1.65-.034-3.08-.099-4.343-.218l-.07.747c-1.678-.159-3.083-.413-4.316-.822l.236-.712a10.258 10.258 0 0 1-1.875-.827 14.252 14.252 0 0 1-1.585-1.05l-.455.596A14.999 14.999 0 0 1 3.076 54.1l.596-.455a14.24 14.24 0 0 1-1.05-1.585 10.259 10.259 0 0 1-.827-1.875l-.712.236C.674 49.188.42 47.783.262 46.105l.746-.07C.89 44.77.824 43.34.79 41.692l-.75.016Z"/><path fill="#fff" fill-rule="evenodd" d="M35.643 32.145c-.297-.743-.445-1.114-.401-1.275a.42.42 0 0 1 .182-.27c.134-.1.463-.1 1.123-.1.742 0 1.499.046 2.236-.05a6 6 0 0 0 5.166-5.166c.051-.39.051-.855.051-1.784 0-.928 0-1.393-.051-1.783a6 6 0 0 0-5.166-5.165c-.39-.052-.854-.052-1.783-.052h-7.72c-4.934 0-7.401 0-9.244 1.051a8 8 0 0 0-2.985 2.986C16.057 22.28 16.003 24.58 16 29 15.998 31.075 16 33.15 16 35.224A7.778 7.778 0 0 0 23.778 43H28.5c1.394 0 2.09 0 2.67-.116a6 6 0 0 0 4.715-4.714c.115-.58.115-1.301.115-2.744 0-1.31 0-1.964-.114-2.49a4.998 4.998 0 0 0-.243-.792Z" clip-rule="evenodd"/><path fill="#9EA9A9" fill-rule="evenodd" d="M37 18h-7.72c-2.494 0-4.266.002-5.647.126-1.361.122-2.197.354-2.854.728a6.5 6.5 0 0 0-2.425 2.426c-.375.657-.607 1.492-.729 2.853-.11 1.233-.123 2.777-.125 4.867 0 .7 0 1.05.097 1.181.096.13.182.181.343.2.163.02.518-.18 1.229-.581a6.195 6.195 0 0 1 3.053-.8H37c.977 0 1.32-.003 1.587-.038a4.5 4.5 0 0 0 3.874-3.874c.036-.268.039-.611.039-1.588 0-.976-.003-1.319-.038-1.587a4.5 4.5 0 0 0-3.875-3.874C38.32 18.004 37.977 18 37 18Zm-7.364 12.5h-7.414a4.722 4.722 0 0 0-4.722 4.723 6.278 6.278 0 0 0 6.278 6.278H28.5c1.466 0 1.98-.008 2.378-.087a4.5 4.5 0 0 0 3.535-3.536c.08-.397.087-.933.087-2.451 0-1.391-.009-1.843-.08-2.17a3.5 3.5 0 0 0-2.676-2.676c-.328-.072-.762-.08-2.108-.08Z" clip-rule="evenodd"/></g><defs><clipPath id="q"><path fill="#fff" d="M0 0h60v60H0z"/></clipPath></defs></svg>`,GLOBE_ICON:OJe`<svg width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="#fff" fill-rule="evenodd" d="M15.5 8a7.5 7.5 0 1 1-15 0 7.5 7.5 0 0 1 15 0Zm-2.113.75c.301 0 .535.264.47.558a6.01 6.01 0 0 1-2.867 3.896c-.203.116-.42-.103-.334-.32.409-1.018.691-2.274.797-3.657a.512.512 0 0 1 .507-.477h1.427Zm.47-2.058c.065.294-.169.558-.47.558H11.96a.512.512 0 0 1-.507-.477c-.106-1.383-.389-2.638-.797-3.656-.087-.217.13-.437.333-.32a6.01 6.01 0 0 1 2.868 3.895Zm-4.402.558c.286 0 .515-.24.49-.525-.121-1.361-.429-2.534-.83-3.393-.279-.6-.549-.93-.753-1.112a.535.535 0 0 0-.724 0c-.204.182-.474.513-.754 1.112-.4.859-.708 2.032-.828 3.393a.486.486 0 0 0 .49.525h2.909Zm-5.415 0c.267 0 .486-.21.507-.477.106-1.383.389-2.638.797-3.656.087-.217-.13-.437-.333-.32a6.01 6.01 0 0 0-2.868 3.895c-.065.294.169.558.47.558H4.04ZM2.143 9.308c-.065-.294.169-.558.47-.558H4.04c.267 0 .486.21.507.477.106 1.383.389 2.639.797 3.657.087.217-.13.436-.333.32a6.01 6.01 0 0 1-2.868-3.896Zm3.913-.033a.486.486 0 0 1 .49-.525h2.909c.286 0 .515.24.49.525-.121 1.361-.428 2.535-.83 3.394-.279.6-.549.93-.753 1.112a.535.535 0 0 1-.724 0c-.204-.182-.474-.513-.754-1.112-.4-.859-.708-2.033-.828-3.394Z" clip-rule="evenodd"/></svg>`},u1e=GZe`.wcm-toolbar-placeholder{top:0;bottom:0;left:0;right:0;width:100%;position:absolute;display:block;pointer-events:none;height:100px;border-radius:calc(var(--wcm-background-border-radius) * .9);background-color:var(--wcm-background-color);background-position:center;background-size:cover}.wcm-toolbar{height:38px;display:flex;position:relative;margin:5px 15px 5px 5px;justify-content:space-between;align-items:center}.wcm-toolbar img,.wcm-toolbar svg{height:28px;object-position:left center;object-fit:contain}#wcm-wc-logo path{fill:var(--wcm-accent-fill-color)}button{width:28px;height:28px;border-radius:var(--wcm-icon-button-border-radius);border:0;display:flex;justify-content:center;align-items:center;cursor:pointer;background-color:var(--wcm-color-bg-1);box-shadow:0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-bg-2)}button svg{display:block;object-position:center}button path{fill:var(--wcm-color-fg-1)}.wcm-toolbar div{display:flex}@media(hover:hover){button:hover{background-color:var(--wcm-color-bg-2)}}`;var l1e=Object.defineProperty,d1e=Object.getOwnPropertyDescriptor;let f1e=class extends GJe{render(){return xJe`<div class="wcm-toolbar-placeholder"></div><div class="wcm-toolbar">${c1e.WALLET_CONNECT_LOGO} <button @click="${aMe.close}">${c1e.CROSS_ICON}</button></div>`}};f1e.styles=[K0e.globalCss,u1e],f1e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?d1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&l1e(t,n,a),a})([KJe("wcm-modal-backcard")],f1e);const p1e=GZe`main{padding:20px;padding-top:0;width:100%}`;var h1e=Object.defineProperty,m1e=Object.getOwnPropertyDescriptor;let y1e=class extends GJe{render(){return xJe`<main><slot></slot></main>`}};y1e.styles=[K0e.globalCss,p1e],y1e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?m1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&h1e(t,n,a),a})([KJe("wcm-modal-content")],y1e);const b1e=GZe`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;var g1e=Object.defineProperty,v1e=Object.getOwnPropertyDescriptor;let w1e=class extends GJe{render(){return xJe`<footer><slot></slot></footer>`}};w1e.styles=[K0e.globalCss,b1e],w1e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?v1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&g1e(t,n,a),a})([KJe("wcm-modal-footer")],w1e);const T1e=GZe`header{display:flex;justify-content:center;align-items:center;padding:20px;position:relative}.wcm-border{border-bottom:1px solid var(--wcm-color-bg-2);margin-bottom:20px}header button{padding:15px 20px}header button:active{opacity:.5}@media(hover:hover){header button:hover{opacity:.5}}.wcm-back-btn{position:absolute;left:0}.wcm-action-btn{position:absolute;right:0}path{fill:var(--wcm-accent-color)}`;var E1e=Object.defineProperty,A1e=Object.getOwnPropertyDescriptor,x1e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?A1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&E1e(t,n,a),a};let O1e=class extends GJe{constructor(){super(...arguments),this.title="",this.onAction=void 0,this.actionIcon=void 0,this.border=!1}backBtnTemplate(){return xJe`<button class="wcm-back-btn" @click="${RNe.goBack}">${c1e.BACK_ICON}</button>`}actionBtnTemplate(){return xJe`<button class="wcm-action-btn" @click="${this.onAction}">${this.actionIcon}</button>`}render(){const e={"wcm-border":this.border},t=RNe.state.history.length>1,n=this.title?xJe`<wcm-text variant="big-bold">${this.title}</wcm-text>`:xJe`<slot></slot>`;return xJe`<header class="${tQe(e)}">${t?this.backBtnTemplate():null} ${n} ${this.onAction?this.actionBtnTemplate():null}</header>`}};O1e.styles=[K0e.globalCss,T1e],x1e([ZJe()],O1e.prototype,"title",2),x1e([ZJe()],O1e.prototype,"onAction",2),x1e([ZJe()],O1e.prototype,"actionIcon",2),x1e([ZJe({type:Boolean})],O1e.prototype,"border",2),O1e=x1e([KJe("wcm-modal-header")],O1e);const C1e={MOBILE_BREAKPOINT:600,WCM_RECENT_WALLET_DATA:"WCM_RECENT_WALLET_DATA",EXPLORER_WALLET_URL:"https://explorer.walletconnect.com/?type=wallet",getShadowRootElement(e,t){const n=e.renderRoot.querySelector(t);if(!n)throw new Error(`${t} not found`);return n},getWalletIcon({id:e,image_id:t}){const{walletImages:n}=BNe.state;return null!=n&&n[e]?n[e]:t?rMe.getWalletImageUrl(t):""},getWalletName:(e,t=!1)=>t&&e.length>8?`${e.substring(0,8)}..`:e,isMobileAnimation:()=>window.innerWidth<=C1e.MOBILE_BREAKPOINT,async preloadImage(e){const t=new Promise(((t,n)=>{const r=new Image;r.onload=t,r.onerror=n,r.crossOrigin="anonymous",r.src=e}));return Promise.race([t,NNe.wait(3e3)])},getErrorMessage:e=>e instanceof Error?e.message:"Unknown Error",debounce(e,t=500){let n;return(...r)=>{n&&clearTimeout(n),n=setTimeout((function(){e(...r)}),t)}},handleMobileLinking(e){const{walletConnectUri:t}=jNe.state,{mobile:n,name:r}=e,i=n?.native,a=n?.universal;C1e.setRecentWallet(e),t&&function(e){let t="";i?t=NNe.formatUniversalUrl(i,e,r):a&&(t=NNe.formatNativeUrl(a,e,r)),NNe.openHref(t,"_self")}(t)},handleAndroidLinking(){const{walletConnectUri:e}=jNe.state;e&&(NNe.setWalletConnectAndroidDeepLink(e),NNe.openHref(e,"_self"))},async handleUriCopy(){const{walletConnectUri:e}=jNe.state;if(e)try{await navigator.clipboard.writeText(e),hMe.openToast("Link copied","success")}catch{hMe.openToast("Failed to copy","error")}},getCustomImageUrls(){const{walletImages:e}=BNe.state,t=Object.values(e??{});return Object.values(t)},truncate:(e,t=8)=>e.length<=t?e:`${e.substring(0,4)}...${e.substring(e.length-4)}`,setRecentWallet(e){try{localStorage.setItem(C1e.WCM_RECENT_WALLET_DATA,JSON.stringify(e))}catch{console.info("Unable to set recent wallet")}},getRecentWallet(){try{const e=localStorage.getItem(C1e.WCM_RECENT_WALLET_DATA);return e?JSON.parse(e):void 0}catch{console.info("Unable to get recent wallet")}},caseSafeIncludes:(e,t)=>e.toUpperCase().includes(t.toUpperCase()),openWalletExplorerUrl(){NNe.openHref(C1e.EXPLORER_WALLET_URL,"_blank")},getCachedRouterWalletPlatforms(){const{desktop:e,mobile:t}=NNe.getWalletRouterData(),n=Boolean(e?.native),r=Boolean(e?.universal);return{isDesktop:n,isMobile:Boolean(t?.native)||Boolean(t?.universal),isWeb:r}},goToConnectingView(e){RNe.setData({Wallet:e});const t=NNe.isMobile(),{isDesktop:n,isWeb:r,isMobile:i}=C1e.getCachedRouterWalletPlatforms();t?i?RNe.push("MobileConnecting"):r?RNe.push("WebConnecting"):RNe.push("InstallWallet"):n?RNe.push("DesktopConnecting"):r?RNe.push("WebConnecting"):i?RNe.push("MobileQrcodeConnecting"):RNe.push("InstallWallet")}},I1e=GZe`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var _1e=Object.defineProperty,P1e=Object.getOwnPropertyDescriptor,S1e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?P1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&_1e(t,n,a),a};let k1e=class extends GJe{constructor(){super(),this.view=RNe.state.view,this.prevView=RNe.state.view,this.unsubscribe=void 0,this.oldHeight="0px",this.resizeObserver=void 0,this.unsubscribe=RNe.subscribe((e=>{this.view!==e.view&&this.onChangeRoute()}))}firstUpdated(){this.resizeObserver=new ResizeObserver((([e])=>{const t=`${e.contentRect.height}px`;"0px"!==this.oldHeight&&l$e(this.routerEl,{height:[this.oldHeight,t]},{duration:.2}),this.oldHeight=t})),this.resizeObserver.observe(this.contentEl)}disconnectedCallback(){var e,t;null==(e=this.unsubscribe)||e.call(this),null==(t=this.resizeObserver)||t.disconnect()}get routerEl(){return C1e.getShadowRootElement(this,".wcm-router")}get contentEl(){return C1e.getShadowRootElement(this,".wcm-content")}viewTemplate(){switch(this.view){case"ConnectWallet":return xJe`<wcm-connect-wallet-view></wcm-connect-wallet-view>`;case"DesktopConnecting":return xJe`<wcm-desktop-connecting-view></wcm-desktop-connecting-view>`;case"MobileConnecting":return xJe`<wcm-mobile-connecting-view></wcm-mobile-connecting-view>`;case"WebConnecting":return xJe`<wcm-web-connecting-view></wcm-web-connecting-view>`;case"MobileQrcodeConnecting":return xJe`<wcm-mobile-qr-connecting-view></wcm-mobile-qr-connecting-view>`;case"WalletExplorer":return xJe`<wcm-wallet-explorer-view></wcm-wallet-explorer-view>`;case"Qrcode":return xJe`<wcm-qrcode-view></wcm-qrcode-view>`;case"InstallWallet":return xJe`<wcm-install-wallet-view></wcm-install-wallet-view>`;default:return xJe`<div>Not Found</div>`}}async onChangeRoute(){await l$e(this.routerEl,{opacity:[1,0],scale:[1,1.02]},{duration:.15,delay:.1}).finished,this.view=RNe.state.view,l$e(this.routerEl,{opacity:[0,1],scale:[.99,1]},{duration:.37,delay:.05})}render(){return xJe`<div class="wcm-router"><div class="wcm-content">${this.viewTemplate()}</div></div>`}};k1e.styles=[K0e.globalCss,I1e],S1e([JJe()],k1e.prototype,"view",2),S1e([JJe()],k1e.prototype,"prevView",2),k1e=S1e([KJe("wcm-modal-router")],k1e);const R1e=GZe`div{height:36px;width:max-content;display:flex;justify-content:center;align-items:center;padding:9px 15px 11px;position:absolute;top:12px;box-shadow:0 6px 14px -6px rgba(10,16,31,.3),0 10px 32px -4px rgba(10,16,31,.15);z-index:2;left:50%;transform:translateX(-50%);pointer-events:none;backdrop-filter:blur(20px) saturate(1.8);-webkit-backdrop-filter:blur(20px) saturate(1.8);border-radius:var(--wcm-notification-border-radius);border:1px solid var(--wcm-color-overlay);background-color:var(--wcm-color-overlay)}svg{margin-right:5px}@-moz-document url-prefix(){div{background-color:var(--wcm-color-bg-3)}}.wcm-success path{fill:var(--wcm-accent-color)}.wcm-error path{fill:var(--wcm-error-color)}`;var N1e=Object.defineProperty,M1e=Object.getOwnPropertyDescriptor,D1e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?M1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&N1e(t,n,a),a};let L1e=class extends GJe{constructor(){super(),this.open=!1,this.unsubscribe=void 0,this.timeout=void 0,this.unsubscribe=hMe.subscribe((e=>{e.open?(this.open=!0,this.timeout=setTimeout((()=>hMe.closeToast()),2200)):(this.open=!1,clearTimeout(this.timeout))}))}disconnectedCallback(){var e;null==(e=this.unsubscribe)||e.call(this),clearTimeout(this.timeout),hMe.closeToast()}render(){const{message:e,variant:t}=hMe.state,n={"wcm-success":"success"===t,"wcm-error":"error"===t};return this.open?xJe`<div class="${tQe(n)}">${"success"===t?c1e.CHECKMARK_ICON:null} ${"error"===t?c1e.CROSS_ICON:null}<wcm-text variant="small-regular">${e}</wcm-text></div>`:null}};L1e.styles=[K0e.globalCss,R1e],D1e([JJe()],L1e.prototype,"open",2),L1e=D1e([KJe("wcm-modal-toast")],L1e);function j1e(e,t,n){return e!==t&&(e-t<0?t-e:e-t)<=n+.1}const F1e={generate(e,t,n){const r="#141414",i=[],a=function(e,t){const n=Array.prototype.slice.call(f$e.create(e,{errorCorrectionLevel:t}).modules.data,0),r=Math.sqrt(n.length);return n.reduce(((e,t,n)=>(n%r==0?e.push([t]):e[e.length-1].push(t))&&e),[])}(e,"Q"),o=t/a.length,s=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];s.forEach((({x:e,y:t})=>{const n=(a.length-7)*o*e,c=(a.length-7)*o*t;for(let e=0;e<s.length;e+=1){const t=o*(7-2*e);i.push(OJe`<rect fill="${e%2==0?r:"#ffffff"}" height="${t}" rx="${.45*t}" ry="${.45*t}" width="${t}" x="${n+o*e}" y="${c+o*e}">`)}}));const c=Math.floor((n+25)/o),u=a.length/2-c/2,l=a.length/2+c/2-1,d=[];a.forEach(((e,t)=>{e.forEach(((e,n)=>{if(a[t][n]&&!(t<7&&n<7||t>a.length-8&&n<7||t<7&&n>a.length-8)&&!(t>u&&t<l&&n>u&&n<l)){const e=t*o+o/2,r=n*o+o/2;d.push([e,r])}}))}));const f={};return d.forEach((([e,t])=>{f[e]?f[e].push(t):f[e]=[t]})),Object.entries(f).map((([e,t])=>{const n=t.filter((e=>t.every((t=>!j1e(e,t,o)))));return[Number(e),n]})).forEach((([e,t])=>{t.forEach((t=>{i.push(OJe`<circle cx="${e}" cy="${t}" fill="${r}" r="${o/2.5}">`)}))})),Object.entries(f).filter((([e,t])=>t.length>1)).map((([e,t])=>{const n=t.filter((e=>t.some((t=>j1e(e,t,o)))));return[Number(e),n]})).map((([e,t])=>{t.sort(((e,t)=>e<t?-1:1));const n=[];for(const e of t){const t=n.find((t=>t.some((t=>j1e(e,t,o)))));t?t.push(e):n.push([e])}return[e,n.map((e=>[e[0],e[e.length-1]]))]})).forEach((([e,t])=>{t.forEach((([t,n])=>{i.push(OJe`<line x1="${e}" x2="${e}" y1="${t}" y2="${n}" stroke="${r}" stroke-width="${o/1.25}" stroke-linecap="round">`)}))})),i}},B1e=GZe`@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}div{position:relative;user-select:none;display:block;overflow:hidden;aspect-ratio:1/1;animation:fadeIn ease .2s}.wcm-dark{background-color:#fff;border-radius:var(--wcm-container-border-radius);padding:18px;box-shadow:0 2px 5px #000}svg:first-child,wcm-wallet-image{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{width:25%;height:25%;border-radius:var(--wcm-wallet-icon-border-radius)}svg:first-child{transform:translateY(-50%) translateX(-50%) scale(.9)}svg:first-child path:first-child{fill:var(--wcm-accent-color)}svg:first-child path:last-child{stroke:var(--wcm-color-overlay)}`;var U1e=Object.defineProperty,z1e=Object.getOwnPropertyDescriptor,H1e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?z1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&U1e(t,n,a),a};let W1e=class extends GJe{constructor(){super(...arguments),this.uri="",this.size=0,this.imageId=void 0,this.walletId=void 0,this.imageUrl=void 0}svgTemplate(){const e="light"===fMe.state.themeMode?this.size:this.size-36;return OJe`<svg height="${e}" width="${e}">${F1e.generate(this.uri,e,e/4)}</svg>`}render(){const e={"wcm-dark":"dark"===fMe.state.themeMode};return xJe`<div style="${`width: ${this.size}px`}" class="${tQe(e)}">${this.walletId||this.imageUrl?xJe`<wcm-wallet-image walletId="${d$e(this.walletId)}" imageId="${d$e(this.imageId)}" imageUrl="${d$e(this.imageUrl)}"></wcm-wallet-image>`:c1e.WALLET_CONNECT_ICON_COLORED} ${this.svgTemplate()}</div>`}};W1e.styles=[K0e.globalCss,B1e],H1e([ZJe()],W1e.prototype,"uri",2),H1e([ZJe({type:Number})],W1e.prototype,"size",2),H1e([ZJe()],W1e.prototype,"imageId",2),H1e([ZJe()],W1e.prototype,"walletId",2),H1e([ZJe()],W1e.prototype,"imageUrl",2),W1e=H1e([KJe("wcm-qrcode")],W1e);const V1e=GZe`:host{position:relative;height:28px;width:80%}input{width:100%;height:100%;line-height:28px!important;border-radius:var(--wcm-input-border-radius);font-style:normal;font-family:-apple-system,system-ui,BlinkMacSystemFont,'Segoe UI',Roboto,Ubuntu,'Helvetica Neue',sans-serif;font-feature-settings:'case' on;font-weight:500;font-size:16px;letter-spacing:-.03em;padding:0 10px 0 34px;transition:.2s all ease;color:var(--wcm-color-fg-1);background-color:var(--wcm-color-bg-3);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay);caret-color:var(--wcm-accent-color)}input::placeholder{color:var(--wcm-color-fg-2)}svg{left:10px;top:4px;pointer-events:none;position:absolute;width:20px;height:20px}input:focus-within{box-shadow:inset 0 0 0 1px var(--wcm-accent-color)}path{fill:var(--wcm-color-fg-2)}`;var G1e=Object.defineProperty,q1e=Object.getOwnPropertyDescriptor,K1e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?q1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&G1e(t,n,a),a};let X1e=class extends GJe{constructor(){super(...arguments),this.onChange=()=>null}render(){return xJe`<input type="text" @input="${this.onChange}" placeholder="Search wallets"> ${c1e.SEARCH_ICON}`}};X1e.styles=[K0e.globalCss,V1e],K1e([ZJe()],X1e.prototype,"onChange",2),X1e=K1e([KJe("wcm-search-input")],X1e);const Y1e=GZe`@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}100%{stroke-dasharray:90,150;stroke-dashoffset:-124}}svg{animation:rotate 2s linear infinite;display:flex;justify-content:center;align-items:center}svg circle{stroke-linecap:round;animation:dash 1.5s ease infinite;stroke:var(--wcm-accent-color)}`;var Z1e=Object.defineProperty,J1e=Object.getOwnPropertyDescriptor;let Q1e=class extends GJe{render(){return xJe`<svg viewBox="0 0 50 50" width="24" height="24"><circle cx="25" cy="25" r="20" fill="none" stroke-width="4" stroke="#fff"/></svg>`}};Q1e.styles=[K0e.globalCss,Y1e],Q1e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?J1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&Z1e(t,n,a),a})([KJe("wcm-spinner")],Q1e);const $1e=GZe`span{font-style:normal;font-family:var(--wcm-font-family);font-feature-settings:var(--wcm-font-feature-settings)}.wcm-xsmall-bold{font-family:var(--wcm-text-xsmall-bold-font-family);font-weight:var(--wcm-text-xsmall-bold-weight);font-size:var(--wcm-text-xsmall-bold-size);line-height:var(--wcm-text-xsmall-bold-line-height);letter-spacing:var(--wcm-text-xsmall-bold-letter-spacing);text-transform:var(--wcm-text-xsmall-bold-text-transform)}.wcm-xsmall-regular{font-family:var(--wcm-text-xsmall-regular-font-family);font-weight:var(--wcm-text-xsmall-regular-weight);font-size:var(--wcm-text-xsmall-regular-size);line-height:var(--wcm-text-xsmall-regular-line-height);letter-spacing:var(--wcm-text-xsmall-regular-letter-spacing);text-transform:var(--wcm-text-xsmall-regular-text-transform)}.wcm-small-thin{font-family:var(--wcm-text-small-thin-font-family);font-weight:var(--wcm-text-small-thin-weight);font-size:var(--wcm-text-small-thin-size);line-height:var(--wcm-text-small-thin-line-height);letter-spacing:var(--wcm-text-small-thin-letter-spacing);text-transform:var(--wcm-text-small-thin-text-transform)}.wcm-small-regular{font-family:var(--wcm-text-small-regular-font-family);font-weight:var(--wcm-text-small-regular-weight);font-size:var(--wcm-text-small-regular-size);line-height:var(--wcm-text-small-regular-line-height);letter-spacing:var(--wcm-text-small-regular-letter-spacing);text-transform:var(--wcm-text-small-regular-text-transform)}.wcm-medium-regular{font-family:var(--wcm-text-medium-regular-font-family);font-weight:var(--wcm-text-medium-regular-weight);font-size:var(--wcm-text-medium-regular-size);line-height:var(--wcm-text-medium-regular-line-height);letter-spacing:var(--wcm-text-medium-regular-letter-spacing);text-transform:var(--wcm-text-medium-regular-text-transform)}.wcm-big-bold{font-family:var(--wcm-text-big-bold-font-family);font-weight:var(--wcm-text-big-bold-weight);font-size:var(--wcm-text-big-bold-size);line-height:var(--wcm-text-big-bold-line-height);letter-spacing:var(--wcm-text-big-bold-letter-spacing);text-transform:var(--wcm-text-big-bold-text-transform)}:host(*){color:var(--wcm-color-fg-1)}.wcm-color-primary{color:var(--wcm-color-fg-1)}.wcm-color-secondary{color:var(--wcm-color-fg-2)}.wcm-color-tertiary{color:var(--wcm-color-fg-3)}.wcm-color-inverse{color:var(--wcm-accent-fill-color)}.wcm-color-accnt{color:var(--wcm-accent-color)}.wcm-color-error{color:var(--wcm-error-color)}`;var e5e=Object.defineProperty,t5e=Object.getOwnPropertyDescriptor,n5e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?t5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&e5e(t,n,a),a};let r5e=class extends GJe{constructor(){super(...arguments),this.variant="medium-regular",this.color="primary"}render(){const e={"wcm-big-bold":"big-bold"===this.variant,"wcm-medium-regular":"medium-regular"===this.variant,"wcm-small-regular":"small-regular"===this.variant,"wcm-small-thin":"small-thin"===this.variant,"wcm-xsmall-regular":"xsmall-regular"===this.variant,"wcm-xsmall-bold":"xsmall-bold"===this.variant,"wcm-color-primary":"primary"===this.color,"wcm-color-secondary":"secondary"===this.color,"wcm-color-tertiary":"tertiary"===this.color,"wcm-color-inverse":"inverse"===this.color,"wcm-color-accnt":"accent"===this.color,"wcm-color-error":"error"===this.color};return xJe`<span><slot class="${tQe(e)}"></slot></span>`}};r5e.styles=[K0e.globalCss,$1e],n5e([ZJe()],r5e.prototype,"variant",2),n5e([ZJe()],r5e.prototype,"color",2),r5e=n5e([KJe("wcm-text")],r5e);const i5e=GZe`button{width:100%;height:100%;border-radius:var(--wcm-button-hover-highlight-border-radius);display:flex;align-items:flex-start}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}button>div{width:80px;padding:5px 0;display:flex;flex-direction:column;align-items:center}wcm-text{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:center}wcm-wallet-image{height:60px;width:60px;transition:all .2s ease;border-radius:var(--wcm-wallet-icon-border-radius);margin-bottom:5px}.wcm-sublabel{margin-top:2px}`;var a5e=Object.defineProperty,o5e=Object.getOwnPropertyDescriptor,s5e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?o5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&a5e(t,n,a),a};let c5e=class extends GJe{constructor(){super(...arguments),this.onClick=()=>null,this.name="",this.walletId="",this.label=void 0,this.imageId=void 0,this.installed=!1,this.recent=!1}sublabelTemplate(){return this.recent?xJe`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">RECENT</wcm-text>`:this.installed?xJe`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">INSTALLED</wcm-text>`:null}handleClick(){DNe.click({name:"WALLET_BUTTON",walletId:this.walletId}),this.onClick()}render(){var e;return xJe`<button @click="${this.handleClick.bind(this)}"><div><wcm-wallet-image walletId="${this.walletId}" imageId="${d$e(this.imageId)}"></wcm-wallet-image><wcm-text variant="xsmall-regular">${null!=(e=this.label)?e:C1e.getWalletName(this.name,!0)}</wcm-text>${this.sublabelTemplate()}</div></button>`}};c5e.styles=[K0e.globalCss,i5e],s5e([ZJe()],c5e.prototype,"onClick",2),s5e([ZJe()],c5e.prototype,"name",2),s5e([ZJe()],c5e.prototype,"walletId",2),s5e([ZJe()],c5e.prototype,"label",2),s5e([ZJe()],c5e.prototype,"imageId",2),s5e([ZJe({type:Boolean})],c5e.prototype,"installed",2),s5e([ZJe({type:Boolean})],c5e.prototype,"recent",2),c5e=s5e([KJe("wcm-wallet-button")],c5e);const u5e=GZe`:host{display:block}div{overflow:hidden;position:relative;border-radius:inherit;width:100%;height:100%;background-color:var(--wcm-color-overlay)}svg{position:relative;width:100%;height:100%}div::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;border-radius:inherit;border:1px solid var(--wcm-color-overlay)}div img{width:100%;height:100%;object-fit:cover;object-position:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var l5e=Object.defineProperty,d5e=Object.getOwnPropertyDescriptor,f5e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?d5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&l5e(t,n,a),a};let p5e=class extends GJe{constructor(){super(...arguments),this.walletId="",this.imageId=void 0,this.imageUrl=void 0}render(){var e;const t=null!=(e=this.imageUrl)&&e.length?this.imageUrl:C1e.getWalletIcon({id:this.walletId,image_id:this.imageId});return xJe`${t.length?xJe`<div><img crossorigin="anonymous" src="${t}" alt="${this.id}"></div>`:c1e.WALLET_PLACEHOLDER}`}};p5e.styles=[K0e.globalCss,u5e],f5e([ZJe()],p5e.prototype,"walletId",2),f5e([ZJe()],p5e.prototype,"imageId",2),f5e([ZJe()],p5e.prototype,"imageUrl",2),p5e=f5e([KJe("wcm-wallet-image")],p5e);var h5e=Object.defineProperty,m5e=Object.getOwnPropertyDescriptor,y5e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?m5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&h5e(t,n,a),a};let b5e=class extends GJe{constructor(){super(),this.preload=!0,this.preloadData()}async loadImages(e){try{null!=e&&e.length&&await Promise.all(e.map((async e=>C1e.preloadImage(e))))}catch{console.info("Unsuccessful attempt at preloading some images",e)}}async preloadListings(){if(BNe.state.enableExplorer){await rMe.getRecomendedWallets(),jNe.setIsDataLoaded(!0);const{recomendedWallets:e}=rMe.state,t=e.map((e=>C1e.getWalletIcon(e)));await this.loadImages(t)}else jNe.setIsDataLoaded(!0)}async preloadCustomImages(){const e=C1e.getCustomImageUrls();await this.loadImages(e)}async preloadData(){try{this.preload&&(this.preload=!1,await Promise.all([this.preloadListings(),this.preloadCustomImages()]))}catch(e){console.error(e),hMe.openToast("Failed preloading","error")}}};y5e([JJe()],b5e.prototype,"preload",2),b5e=y5e([KJe("wcm-explorer-context")],b5e);var g5e=Object.defineProperty,v5e=Object.getOwnPropertyDescriptor;let w5e=class extends GJe{constructor(){super(),this.unsubscribeTheme=void 0,K0e.setTheme(),this.unsubscribeTheme=fMe.subscribe(K0e.setTheme)}disconnectedCallback(){var e;null==(e=this.unsubscribeTheme)||e.call(this)}};w5e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?v5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&g5e(t,n,a),a})([KJe("wcm-theme-context")],w5e);const T5e=GZe`@keyframes scroll{0%{transform:translate3d(0,0,0)}100%{transform:translate3d(calc(-70px * 9),0,0)}}.wcm-slider{position:relative;overflow-x:hidden;padding:10px 0;margin:0 -20px;width:calc(100% + 40px)}.wcm-track{display:flex;width:calc(70px * 18);animation:scroll 20s linear infinite;opacity:.7}.wcm-track svg{margin:0 5px}wcm-wallet-image{width:60px;height:60px;margin:0 5px;border-radius:var(--wcm-wallet-icon-border-radius)}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-title{display:flex;align-items:center;margin-bottom:10px}.wcm-title svg{margin-right:6px}.wcm-title path{fill:var(--wcm-accent-color)}wcm-modal-footer .wcm-title{padding:0 10px}wcm-button-big{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);filter:drop-shadow(0 0 17px var(--wcm-color-bg-1))}wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-info-footer wcm-text{text-align:center;margin-bottom:15px}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var E5e=Object.defineProperty,A5e=Object.getOwnPropertyDescriptor;let x5e=class extends GJe{onGoToQrcode(){RNe.push("Qrcode")}render(){const{recomendedWallets:e}=rMe.state,t=[...e,...e],n=2*NNe.RECOMMENDED_WALLET_AMOUNT;return xJe`<wcm-modal-header title="Connect your wallet" .onAction="${this.onGoToQrcode}" .actionIcon="${c1e.QRCODE_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-title">${c1e.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">WalletConnect</wcm-text></div><div class="wcm-slider"><div class="wcm-track">${[...Array(n)].map(((e,n)=>{const r=t[n%t.length];return r?xJe`<wcm-wallet-image walletId="${r.id}" imageId="${r.image_id}"></wcm-wallet-image>`:c1e.WALLET_PLACEHOLDER}))}</div><wcm-button-big @click="${C1e.handleAndroidLinking}"><wcm-text variant="medium-regular" color="inverse">Select Wallet</wcm-text></wcm-button-big></div></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">Choose WalletConnect to see supported apps on your device</wcm-text></wcm-info-footer>`}};x5e.styles=[K0e.globalCss,T5e],x5e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?A5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&E5e(t,n,a),a})([KJe("wcm-android-wallet-selection")],x5e);const O5e=GZe`@keyframes loading{to{stroke-dashoffset:0}}@keyframes shake{10%,90%{transform:translate3d(-1px,0,0)}20%,80%{transform:translate3d(1px,0,0)}30%,50%,70%{transform:translate3d(-2px,0,0)}40%,60%{transform:translate3d(2px,0,0)}}:host{display:flex;flex-direction:column;align-items:center}div{position:relative;width:110px;height:110px;display:flex;justify-content:center;align-items:center;margin:40px 0 20px 0;transform:translate3d(0,0,0)}svg{position:absolute;width:110px;height:110px;fill:none;stroke:transparent;stroke-linecap:round;stroke-width:2px;top:0;left:0}use{stroke:var(--wcm-accent-color);animation:loading 1s linear infinite}wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:90px;height:90px}wcm-text{margin-bottom:40px}.wcm-error svg{stroke:var(--wcm-error-color)}.wcm-error use{display:none}.wcm-error{animation:shake .4s cubic-bezier(.36,.07,.19,.97) both}.wcm-stale svg,.wcm-stale use{display:none}`;var C5e=Object.defineProperty,I5e=Object.getOwnPropertyDescriptor,_5e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?I5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&C5e(t,n,a),a};let P5e=class extends GJe{constructor(){super(...arguments),this.walletId=void 0,this.imageId=void 0,this.isError=!1,this.isStale=!1,this.label=""}svgLoaderTemplate(){var e,t;const n=null!=(t=null==(e=fMe.state.themeVariables)?void 0:e["--wcm-wallet-icon-large-border-radius"])?t:K0e.getPreset("--wcm-wallet-icon-large-border-radius");let r=0;r=n.includes("%")?.88*parseInt(n,10):parseInt(n,10),r*=1.17;return xJe`<svg viewBox="0 0 110 110" width="110" height="110"><rect id="wcm-loader" x="2" y="2" width="106" height="106" rx="${r}"/><use xlink:href="#wcm-loader" stroke-dasharray="106 ${317-1.57*r}" stroke-dashoffset="${425-1.8*r}"></use></svg>`}render(){const e={"wcm-error":this.isError,"wcm-stale":this.isStale};return xJe`<div class="${tQe(e)}">${this.svgLoaderTemplate()}<wcm-wallet-image walletId="${d$e(this.walletId)}" imageId="${d$e(this.imageId)}"></wcm-wallet-image></div><wcm-text variant="medium-regular" color="${this.isError?"error":"primary"}">${this.isError?"Connection declined":this.label}</wcm-text>`}};P5e.styles=[K0e.globalCss,O5e],_5e([ZJe()],P5e.prototype,"walletId",2),_5e([ZJe()],P5e.prototype,"imageId",2),_5e([ZJe({type:Boolean})],P5e.prototype,"isError",2),_5e([ZJe({type:Boolean})],P5e.prototype,"isStale",2),_5e([ZJe()],P5e.prototype,"label",2),P5e=_5e([KJe("wcm-connector-waiting")],P5e);const S5e={manualWallets(){var e,t;const{mobileWallets:n,desktopWallets:r}=BNe.state,i=null==(e=S5e.recentWallet())?void 0:e.id,a=NNe.isMobile()?n:r,o=a?.filter((e=>i!==e.id));return null!=(t=NNe.isMobile()?o?.map((({id:e,name:t,links:n})=>({id:e,name:t,mobile:n,links:n}))):o?.map((({id:e,name:t,links:n})=>({id:e,name:t,desktop:n,links:n}))))?t:[]},recentWallet:()=>C1e.getRecentWallet(),recomendedWallets(e=!1){var t;const n=e||null==(t=S5e.recentWallet())?void 0:t.id,{recomendedWallets:r}=rMe.state;return r.filter((e=>n!==e.id))}},k5e={onConnecting(e){C1e.goToConnectingView(e)},manualWalletsTemplate(){return S5e.manualWallets().map((e=>xJe`<wcm-wallet-button walletId="${e.id}" name="${e.name}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`))},recomendedWalletsTemplate(e=!1){return S5e.recomendedWallets(e).map((e=>xJe`<wcm-wallet-button name="${e.name}" walletId="${e.id}" imageId="${e.image_id}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`))},recentWalletTemplate(){const e=S5e.recentWallet();if(e)return xJe`<wcm-wallet-button name="${e.name}" walletId="${e.id}" imageId="${d$e(e.image_id)}" .recent="${!0}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`}},R5e=GZe`.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-desktop-title,.wcm-mobile-title{display:flex;align-items:center}.wcm-mobile-title{justify-content:space-between;margin-bottom:20px;margin-top:-10px}.wcm-desktop-title{margin-bottom:10px;padding:0 10px}.wcm-subtitle{display:flex;align-items:center}.wcm-subtitle:last-child path{fill:var(--wcm-color-fg-3)}.wcm-desktop-title svg,.wcm-mobile-title svg{margin-right:6px}.wcm-desktop-title path,.wcm-mobile-title path{fill:var(--wcm-accent-color)}`;var N5e=Object.defineProperty,M5e=Object.getOwnPropertyDescriptor;let D5e=class extends GJe{render(){const{explorerExcludedWalletIds:e,enableExplorer:t}=BNe.state,n="ALL"!==e&&t,r=k5e.manualWalletsTemplate(),i=k5e.recomendedWalletsTemplate();let a=[k5e.recentWalletTemplate(),...r,...i];a=a.filter(Boolean);const o=a.length>4||n;let s=[];s=o?a.slice(0,3):a;const c=Boolean(s.length);return xJe`<wcm-modal-header .border="${!0}" title="Connect your wallet" .onAction="${C1e.handleUriCopy}" .actionIcon="${c1e.COPY_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-mobile-title"><div class="wcm-subtitle">${c1e.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">Mobile</wcm-text></div><div class="wcm-subtitle">${c1e.SCAN_ICON}<wcm-text variant="small-regular" color="secondary">Scan with your wallet</wcm-text></div></div><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>${c?xJe`<wcm-modal-footer><div class="wcm-desktop-title">${c1e.DESKTOP_ICON}<wcm-text variant="small-regular" color="accent">Desktop</wcm-text></div><div class="wcm-grid">${s} ${o?xJe`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-footer>`:null}`}};D5e.styles=[K0e.globalCss,R5e],D5e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?M5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&N5e(t,n,a),a})([KJe("wcm-desktop-wallet-selection")],D5e);const L5e=GZe`div{background-color:var(--wcm-color-bg-2);padding:10px 20px 15px 20px;border-top:1px solid var(--wcm-color-bg-3);text-align:center}a{color:var(--wcm-accent-color);text-decoration:none;transition:opacity .2s ease-in-out;display:inline}a:active{opacity:.8}@media(hover:hover){a:hover{opacity:.8}}`;var j5e=Object.defineProperty,F5e=Object.getOwnPropertyDescriptor;let B5e=class extends GJe{render(){const{termsOfServiceUrl:e,privacyPolicyUrl:t}=BNe.state;return e??t?xJe`<div><wcm-text variant="small-regular" color="secondary">By connecting your wallet to this app, you agree to the app's ${e?xJe`<a href="${e}" target="_blank" rel="noopener noreferrer">Terms of Service</a>`:null} ${e&&t?"and":null} ${t?xJe`<a href="${t}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`:null}</wcm-text></div>`:null}};B5e.styles=[K0e.globalCss,L5e],B5e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?F5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&j5e(t,n,a),a})([KJe("wcm-legal-notice")],B5e);const U5e=GZe`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var z5e=Object.defineProperty,H5e=Object.getOwnPropertyDescriptor;let W5e=class extends GJe{onQrcode(){RNe.push("Qrcode")}render(){const{explorerExcludedWalletIds:e,enableExplorer:t}=BNe.state,n="ALL"!==e&&t,r=k5e.manualWalletsTemplate(),i=k5e.recomendedWalletsTemplate();let a=[k5e.recentWalletTemplate(),...r,...i];a=a.filter(Boolean);const o=a.length>8||n;let s=[];s=o?a.slice(0,7):a;const c=Boolean(s.length);return xJe`<wcm-modal-header title="Connect your wallet" .onAction="${this.onQrcode}" .actionIcon="${c1e.QRCODE_ICON}"></wcm-modal-header>${c?xJe`<wcm-modal-content><div>${s} ${o?xJe`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-content>`:null}`}};W5e.styles=[K0e.globalCss,U5e],W5e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?H5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&z5e(t,n,a),a})([KJe("wcm-mobile-wallet-selection")],W5e);const V5e=GZe`:host{all:initial}.wcm-overlay{top:0;bottom:0;left:0;right:0;position:fixed;z-index:var(--wcm-z-index);overflow:hidden;display:flex;justify-content:center;align-items:center;opacity:0;pointer-events:none;background-color:var(--wcm-overlay-background-color);backdrop-filter:var(--wcm-overlay-backdrop-filter)}@media(max-height:720px) and (orientation:landscape){.wcm-overlay{overflow:scroll;align-items:flex-start;padding:20px 0}}.wcm-active{pointer-events:auto}.wcm-container{position:relative;max-width:360px;width:100%;outline:0;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) var(--wcm-container-border-radius) var(--wcm-container-border-radius);border:1px solid var(--wcm-color-overlay);overflow:hidden}.wcm-card{width:100%;position:relative;border-radius:var(--wcm-container-border-radius);overflow:hidden;box-shadow:0 6px 14px -6px rgba(10,16,31,.12),0 10px 32px -4px rgba(10,16,31,.1),0 0 0 1px var(--wcm-color-overlay);background-color:var(--wcm-color-bg-1);color:var(--wcm-color-fg-1)}@media(max-width:600px){.wcm-container{max-width:440px;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) 0 0}.wcm-card{border-radius:var(--wcm-container-border-radius) var(--wcm-container-border-radius) 0 0}.wcm-overlay{align-items:flex-end}}@media(max-width:440px){.wcm-container{border:0}}`;var G5e=Object.defineProperty,q5e=Object.getOwnPropertyDescriptor,K5e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?q5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&G5e(t,n,a),a};let X5e=class extends GJe{constructor(){super(),this.open=!1,this.active=!1,this.unsubscribeModal=void 0,this.abortController=void 0,this.unsubscribeModal=aMe.subscribe((e=>{e.open?this.onOpenModalEvent():this.onCloseModalEvent()}))}disconnectedCallback(){var e;null==(e=this.unsubscribeModal)||e.call(this)}get overlayEl(){return C1e.getShadowRootElement(this,".wcm-overlay")}get containerEl(){return C1e.getShadowRootElement(this,".wcm-container")}toggleBodyScroll(e){if(document.querySelector("body"))if(e){const e=document.getElementById("wcm-styles");e?.remove()}else document.head.insertAdjacentHTML("beforeend",'<style id="wcm-styles">html,body{touch-action:none;overflow:hidden;overscroll-behavior:contain;}</style>')}onCloseModal(e){e.target===e.currentTarget&&aMe.close()}onOpenModalEvent(){this.toggleBodyScroll(!1),this.addKeyboardEvents(),this.open=!0,setTimeout((async()=>{const e=C1e.isMobileAnimation()?{y:["50vh","0vh"]}:{scale:[.98,1]};await Promise.all([l$e(this.overlayEl,{opacity:[0,1]},{delay:.1,duration:.2}).finished,l$e(this.containerEl,e,{delay:.1,duration:.2}).finished]),this.active=!0}),0)}async onCloseModalEvent(){this.toggleBodyScroll(!0),this.removeKeyboardEvents();const e=C1e.isMobileAnimation()?{y:["0vh","50vh"]}:{scale:[1,.98]};await Promise.all([l$e(this.overlayEl,{opacity:[1,0]},{duration:.2}).finished,l$e(this.containerEl,e,{duration:.2}).finished]),this.containerEl.removeAttribute("style"),this.active=!1,this.open=!1}addKeyboardEvents(){this.abortController=new AbortController,window.addEventListener("keydown",(e=>{var t;"Escape"===e.key?aMe.close():"Tab"===e.key&&(null!=(t=e.target)&&t.tagName.includes("wcm-")||this.containerEl.focus())}),this.abortController),this.containerEl.focus()}removeKeyboardEvents(){var e;null==(e=this.abortController)||e.abort(),this.abortController=void 0}render(){const e={"wcm-overlay":!0,"wcm-active":this.active};return xJe`<wcm-explorer-context></wcm-explorer-context><wcm-theme-context></wcm-theme-context><div id="wcm-modal" class="${tQe(e)}" @click="${this.onCloseModal}" role="alertdialog" aria-modal="true"><div class="wcm-container" tabindex="0">${this.open?xJe`<wcm-modal-backcard></wcm-modal-backcard><div class="wcm-card"><wcm-modal-router></wcm-modal-router><wcm-modal-toast></wcm-modal-toast></div>`:null}</div></div>`}};X5e.styles=[K0e.globalCss,V5e],K5e([JJe()],X5e.prototype,"open",2),K5e([JJe()],X5e.prototype,"active",2),X5e=K5e([KJe("wcm-modal")],X5e);const Y5e=GZe`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var Z5e=Object.defineProperty,J5e=Object.getOwnPropertyDescriptor,Q5e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?J5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&Z5e(t,n,a),a};let $5e=class extends GJe{constructor(){super(...arguments),this.isMobile=!1,this.isDesktop=!1,this.isWeb=!1,this.isRetry=!1}onMobile(){NNe.isMobile()?RNe.replace("MobileConnecting"):RNe.replace("MobileQrcodeConnecting")}onDesktop(){RNe.replace("DesktopConnecting")}onWeb(){RNe.replace("WebConnecting")}render(){return xJe`<div>${this.isRetry?xJe`<slot></slot>`:null} ${this.isMobile?xJe`<wcm-button .onClick="${this.onMobile}" .iconLeft="${c1e.MOBILE_ICON}" variant="outline">Mobile</wcm-button>`:null} ${this.isDesktop?xJe`<wcm-button .onClick="${this.onDesktop}" .iconLeft="${c1e.DESKTOP_ICON}" variant="outline">Desktop</wcm-button>`:null} ${this.isWeb?xJe`<wcm-button .onClick="${this.onWeb}" .iconLeft="${c1e.GLOBE_ICON}" variant="outline">Web</wcm-button>`:null}</div>`}};$5e.styles=[K0e.globalCss,Y5e],Q5e([ZJe({type:Boolean})],$5e.prototype,"isMobile",2),Q5e([ZJe({type:Boolean})],$5e.prototype,"isDesktop",2),Q5e([ZJe({type:Boolean})],$5e.prototype,"isWeb",2),Q5e([ZJe({type:Boolean})],$5e.prototype,"isRetry",2),$5e=Q5e([KJe("wcm-platform-selection")],$5e);const e6e=GZe`button{display:flex;flex-direction:column;padding:5px 10px;border-radius:var(--wcm-button-hover-highlight-border-radius);height:100%;justify-content:flex-start}.wcm-icons{width:60px;height:60px;display:flex;flex-wrap:wrap;padding:7px;border-radius:var(--wcm-wallet-icon-border-radius);justify-content:space-between;align-items:center;margin-bottom:5px;background-color:var(--wcm-color-bg-2);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}.wcm-icons img{width:21px;height:21px;object-fit:cover;object-position:center;border-radius:calc(var(--wcm-wallet-icon-border-radius)/ 2);border:1px solid var(--wcm-color-overlay)}.wcm-icons svg{width:21px;height:21px}.wcm-icons img:nth-child(1),.wcm-icons img:nth-child(2),.wcm-icons svg:nth-child(1),.wcm-icons svg:nth-child(2){margin-bottom:4px}wcm-text{width:100%;text-align:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var t6e=Object.defineProperty,n6e=Object.getOwnPropertyDescriptor;let r6e=class extends GJe{onClick(){RNe.push("WalletExplorer")}render(){const{recomendedWallets:e}=rMe.state,t=[...e,...S5e.manualWallets()].reverse().slice(0,4);return xJe`<button @click="${this.onClick}"><div class="wcm-icons">${t.map((e=>{const t=C1e.getWalletIcon(e);if(t)return xJe`<img crossorigin="anonymous" src="${t}">`;const n=C1e.getWalletIcon({id:e.id});return n?xJe`<img crossorigin="anonymous" src="${n}">`:c1e.WALLET_PLACEHOLDER}))} ${[...Array(4-t.length)].map((()=>c1e.WALLET_PLACEHOLDER))}</div><wcm-text variant="xsmall-regular">View All</wcm-text></button>`}};r6e.styles=[K0e.globalCss,e6e],r6e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?n6e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&t6e(t,n,a),a})([KJe("wcm-view-all-wallets-button")],r6e);const i6e=GZe`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var a6e=Object.defineProperty,o6e=Object.getOwnPropertyDescriptor,s6e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?o6e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&a6e(t,n,a),a};let c6e=class extends GJe{constructor(){super(),this.walletId="",this.imageId="",this.uri="",setTimeout((()=>{const{walletConnectUri:e}=jNe.state;this.uri=e}),0)}get overlayEl(){return C1e.getShadowRootElement(this,".wcm-qr-container")}render(){return xJe`<div class="wcm-qr-container">${this.uri?xJe`<wcm-qrcode size="${this.overlayEl.offsetWidth}" uri="${this.uri}" walletId="${d$e(this.walletId)}" imageId="${d$e(this.imageId)}"></wcm-qrcode>`:xJe`<wcm-spinner></wcm-spinner>`}</div>`}};c6e.styles=[K0e.globalCss,i6e],s6e([ZJe()],c6e.prototype,"walletId",2),s6e([ZJe()],c6e.prototype,"imageId",2),s6e([JJe()],c6e.prototype,"uri",2),c6e=s6e([KJe("wcm-walletconnect-qr")],c6e);var u6e=Object.defineProperty,l6e=Object.getOwnPropertyDescriptor;let d6e=class extends GJe{viewTemplate(){return NNe.isAndroid()?xJe`<wcm-android-wallet-selection></wcm-android-wallet-selection>`:NNe.isMobile()?xJe`<wcm-mobile-wallet-selection></wcm-mobile-wallet-selection>`:xJe`<wcm-desktop-wallet-selection></wcm-desktop-wallet-selection>`}render(){return xJe`${this.viewTemplate()}<wcm-legal-notice></wcm-legal-notice>`}};d6e.styles=[K0e.globalCss],d6e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?l6e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&u6e(t,n,a),a})([KJe("wcm-connect-wallet-view")],d6e);const f6e=GZe`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var p6e=Object.defineProperty,h6e=Object.getOwnPropertyDescriptor,m6e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?h6e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&p6e(t,n,a),a};let y6e=class extends GJe{constructor(){super(),this.isError=!1,this.openDesktopApp()}onFormatAndRedirect(e){const{desktop:t,name:n}=NNe.getWalletRouterData(),r=t?.native;if(r){const t=NNe.formatNativeUrl(r,e,n);NNe.openHref(t,"_self")}}openDesktopApp(){const{walletConnectUri:e}=jNe.state,t=NNe.getWalletRouterData();C1e.setRecentWallet(t),e&&this.onFormatAndRedirect(e)}render(){const{name:e,id:t,image_id:n}=NNe.getWalletRouterData(),{isMobile:r,isWeb:i}=C1e.getCachedRouterWalletPlatforms();return xJe`<wcm-modal-header title="${e}" .onAction="${C1e.handleUriCopy}" .actionIcon="${c1e.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${d$e(n)}" label="${`Continue in ${e}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Connection can continue loading if ${e} is not installed on your device`}</wcm-text><wcm-platform-selection .isMobile="${r}" .isWeb="${i}" .isRetry="${!0}"><wcm-button .onClick="${this.openDesktopApp.bind(this)}" .iconRight="${c1e.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};y6e.styles=[K0e.globalCss,f6e],m6e([JJe()],y6e.prototype,"isError",2),y6e=m6e([KJe("wcm-desktop-connecting-view")],y6e);const b6e=GZe`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}wcm-button{margin-top:15px}`;var g6e=Object.defineProperty,v6e=Object.getOwnPropertyDescriptor;let w6e=class extends GJe{onInstall(e){e&&NNe.openHref(e,"_blank")}render(){const{name:e,id:t,image_id:n,homepage:r}=NNe.getWalletRouterData();return xJe`<wcm-modal-header title="${e}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${d$e(n)}" label="Not Detected" .isStale="${!0}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Download ${e} to continue. If multiple browser extensions are installed, disable non ${e} ones and try again`}</wcm-text><wcm-button .onClick="${()=>this.onInstall(r)}" .iconLeft="${c1e.ARROW_DOWN_ICON}">Download</wcm-button></wcm-info-footer>`}};w6e.styles=[K0e.globalCss,b6e],w6e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?v6e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&g6e(t,n,a),a})([KJe("wcm-install-wallet-view")],w6e);const T6e=GZe`wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:96px;height:96px;margin-bottom:20px}wcm-info-footer{display:flex;width:100%}.wcm-app-store{justify-content:space-between}.wcm-app-store wcm-wallet-image{margin-right:10px;margin-bottom:0;width:28px;height:28px;border-radius:var(--wcm-wallet-icon-small-border-radius)}.wcm-app-store div{display:flex;align-items:center}.wcm-app-store wcm-button{margin-right:-10px}.wcm-note{flex-direction:column;align-items:center;padding:5px 0}.wcm-note wcm-text{text-align:center}wcm-platform-selection{margin-top:-15px}.wcm-note wcm-text{margin-top:15px}.wcm-note wcm-text span{color:var(--wcm-accent-color)}`;var E6e=Object.defineProperty,A6e=Object.getOwnPropertyDescriptor,x6e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?A6e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&E6e(t,n,a),a};let O6e=class extends GJe{constructor(){super(),this.isError=!1,this.openMobileApp()}onFormatAndRedirect(e,t=!1){const{mobile:n,name:r}=NNe.getWalletRouterData(),i=n?.native,a=n?.universal;if(i&&!t){const t=NNe.formatNativeUrl(i,e,r);NNe.openHref(t,"_self")}else if(a){const t=NNe.formatUniversalUrl(a,e,r);NNe.openHref(t,"_self")}}openMobileApp(e=!1){const{walletConnectUri:t}=jNe.state,n=NNe.getWalletRouterData();C1e.setRecentWallet(n),t&&this.onFormatAndRedirect(t,e)}onGoToAppStore(e){e&&NNe.openHref(e,"_blank")}render(){const{name:e,id:t,image_id:n,app:r,mobile:i}=NNe.getWalletRouterData(),{isWeb:a}=C1e.getCachedRouterWalletPlatforms(),o=r?.ios,s=i?.universal;return xJe`<wcm-modal-header title="${e}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${d$e(n)}" label="Tap 'Open' to continue…" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer class="wcm-note"><wcm-platform-selection .isWeb="${a}" .isRetry="${!0}"><wcm-button .onClick="${()=>this.openMobileApp(!1)}" .iconRight="${c1e.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection>${s?xJe`<wcm-text color="secondary" variant="small-thin">Still doesn't work? <span tabindex="0" @click="${()=>this.openMobileApp(!0)}">Try this alternate link</span></wcm-text>`:null}</wcm-info-footer><wcm-info-footer class="wcm-app-store"><div><wcm-wallet-image walletId="${t}" imageId="${d$e(n)}"></wcm-wallet-image><wcm-text>${`Get ${e}`}</wcm-text></div><wcm-button .iconRight="${c1e.ARROW_RIGHT_ICON}" .onClick="${()=>this.onGoToAppStore(o)}" variant="ghost">App Store</wcm-button></wcm-info-footer>`}};O6e.styles=[K0e.globalCss,T6e],x6e([JJe()],O6e.prototype,"isError",2),O6e=x6e([KJe("wcm-mobile-connecting-view")],O6e);const C6e=GZe`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var I6e=Object.defineProperty,_6e=Object.getOwnPropertyDescriptor;let P6e=class extends GJe{render(){const{name:e,id:t,image_id:n}=NNe.getWalletRouterData(),{isDesktop:r,isWeb:i}=C1e.getCachedRouterWalletPlatforms();return xJe`<wcm-modal-header title="${e}" .onAction="${C1e.handleUriCopy}" .actionIcon="${c1e.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr walletId="${t}" imageId="${d$e(n)}"></wcm-walletconnect-qr></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Scan this QR Code with your phone's camera or inside ${e} app`}</wcm-text><wcm-platform-selection .isDesktop="${r}" .isWeb="${i}"></wcm-platform-selection></wcm-info-footer>`}};P6e.styles=[K0e.globalCss,C6e],P6e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?_6e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&I6e(t,n,a),a})([KJe("wcm-mobile-qr-connecting-view")],P6e);var S6e=Object.defineProperty,k6e=Object.getOwnPropertyDescriptor;let R6e=class extends GJe{render(){return xJe`<wcm-modal-header title="Scan the code" .onAction="${C1e.handleUriCopy}" .actionIcon="${c1e.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>`}};R6e.styles=[K0e.globalCss],R6e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?k6e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&S6e(t,n,a),a})([KJe("wcm-qrcode-view")],R6e);const N6e=GZe`wcm-modal-content{height:clamp(200px,60vh,600px);display:block;overflow:scroll;scrollbar-width:none;position:relative;margin-top:1px}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between;margin:-15px -10px;padding-top:20px}wcm-modal-content::after,wcm-modal-content::before{content:'';position:fixed;pointer-events:none;z-index:1;width:100%;height:20px;opacity:1}wcm-modal-content::before{box-shadow:0 -1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(var(--wcm-color-bg-1),rgba(255,255,255,0))}wcm-modal-content::after{box-shadow:0 1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(rgba(255,255,255,0),var(--wcm-color-bg-1));top:calc(100% - 20px)}wcm-modal-content::-webkit-scrollbar{display:none}.wcm-placeholder-block{display:flex;justify-content:center;align-items:center;height:100px;overflow:hidden}.wcm-empty,.wcm-loading{display:flex}.wcm-loading .wcm-placeholder-block{height:100%}.wcm-end-reached .wcm-placeholder-block{height:0;opacity:0}.wcm-empty .wcm-placeholder-block{opacity:1;height:100%}wcm-wallet-button{margin:calc((100% - 60px)/ 3) 0}`;var M6e=Object.defineProperty,D6e=Object.getOwnPropertyDescriptor,L6e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?D6e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&M6e(t,n,a),a};let j6e=class extends GJe{constructor(){super(...arguments),this.loading=!rMe.state.wallets.listings.length,this.firstFetch=!rMe.state.wallets.listings.length,this.search="",this.endReached=!1,this.intersectionObserver=void 0,this.searchDebounce=C1e.debounce((e=>{e.length>=1?(this.firstFetch=!0,this.endReached=!1,this.search=e,rMe.resetSearch(),this.fetchWallets()):this.search&&(this.search="",this.endReached=this.isLastPage(),rMe.resetSearch())}))}firstUpdated(){this.createPaginationObserver()}disconnectedCallback(){var e;null==(e=this.intersectionObserver)||e.disconnect()}get placeholderEl(){return C1e.getShadowRootElement(this,".wcm-placeholder-block")}createPaginationObserver(){this.intersectionObserver=new IntersectionObserver((([e])=>{e.isIntersecting&&(!this.search||!this.firstFetch)&&this.fetchWallets()})),this.intersectionObserver.observe(this.placeholderEl)}isLastPage(){const{wallets:e,search:t}=rMe.state,{listings:n,total:r}=this.search?t:e;return r<=40||n.length>=r}async fetchWallets(){var e;const{wallets:t,search:n}=rMe.state,{listings:r,total:i,page:a}=this.search?n:t;if(!this.endReached&&(this.firstFetch||i>40&&r.length<i))try{this.loading=!0;const t=null==(e=jNe.state.chains)?void 0:e.join(","),{listings:n}=await rMe.getWallets({page:this.firstFetch?1:a+1,entries:40,search:this.search,version:2,chains:t}),r=n.map((e=>C1e.getWalletIcon(e)));await Promise.all([...r.map((async e=>C1e.preloadImage(e))),NNe.wait(300)]),this.endReached=this.isLastPage()}catch(e){console.error(e),hMe.openToast(C1e.getErrorMessage(e),"error")}finally{this.loading=!1,this.firstFetch=!1}}onConnect(e){NNe.isAndroid()?C1e.handleMobileLinking(e):C1e.goToConnectingView(e)}onSearchChange(e){const{value:t}=e.target;this.searchDebounce(t)}render(){const{wallets:e,search:t}=rMe.state,{listings:n}=this.search?t:e,r=this.loading&&!n.length,i=this.search.length>=3;let a=k5e.manualWalletsTemplate(),o=k5e.recomendedWalletsTemplate(!0);i&&(a=a.filter((({values:e})=>C1e.caseSafeIncludes(e[0],this.search))),o=o.filter((({values:e})=>C1e.caseSafeIncludes(e[0],this.search))));const s=!this.loading&&!n.length&&!o.length,c={"wcm-loading":r,"wcm-end-reached":this.endReached||!this.loading,"wcm-empty":s};return xJe`<wcm-modal-header><wcm-search-input .onChange="${this.onSearchChange.bind(this)}"></wcm-search-input></wcm-modal-header><wcm-modal-content class="${tQe(c)}"><div class="wcm-grid">${r?null:a} ${r?null:o} ${r?null:n.map((e=>xJe`${e?xJe`<wcm-wallet-button imageId="${e.image_id}" name="${e.name}" walletId="${e.id}" .onClick="${()=>this.onConnect(e)}"></wcm-wallet-button>`:null}`))}</div><div class="wcm-placeholder-block">${s?xJe`<wcm-text variant="big-bold" color="secondary">No results found</wcm-text>`:null} ${!s&&this.loading?xJe`<wcm-spinner></wcm-spinner>`:null}</div></wcm-modal-content>`}};j6e.styles=[K0e.globalCss,N6e],L6e([JJe()],j6e.prototype,"loading",2),L6e([JJe()],j6e.prototype,"firstFetch",2),L6e([JJe()],j6e.prototype,"search",2),L6e([JJe()],j6e.prototype,"endReached",2),j6e=L6e([KJe("wcm-wallet-explorer-view")],j6e);const F6e=GZe`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var B6e=Object.defineProperty,U6e=Object.getOwnPropertyDescriptor,z6e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?U6e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&B6e(t,n,a),a};let H6e=class extends GJe{constructor(){super(),this.isError=!1,this.openWebWallet()}onFormatAndRedirect(e){const{desktop:t,name:n}=NNe.getWalletRouterData(),r=t?.universal;if(r){const t=NNe.formatUniversalUrl(r,e,n);NNe.openHref(t,"_blank")}}openWebWallet(){const{walletConnectUri:e}=jNe.state,t=NNe.getWalletRouterData();C1e.setRecentWallet(t),e&&this.onFormatAndRedirect(e)}render(){const{name:e,id:t,image_id:n}=NNe.getWalletRouterData(),{isMobile:r,isDesktop:i}=C1e.getCachedRouterWalletPlatforms(),a=NNe.isMobile();return xJe`<wcm-modal-header title="${e}" .onAction="${C1e.handleUriCopy}" .actionIcon="${c1e.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${d$e(n)}" label="${`Continue in ${e}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`${e} web app has opened in a new tab. Go there, accept the connection, and come back`}</wcm-text><wcm-platform-selection .isMobile="${r}" .isDesktop="${!a&&i}" .isRetry="${!0}"><wcm-button .onClick="${this.openWebWallet.bind(this)}" .iconRight="${c1e.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};H6e.styles=[K0e.globalCss,F6e],z6e([JJe()],H6e.prototype,"isError",2),H6e=z6e([KJe("wcm-web-connecting-view")],H6e);var W6e=Object.freeze({__proto__:null,get WcmModal(){return X5e},get WcmQrCode(){return W1e}});function V6e({theme:e,environment:t}){const{t:n}=_ke(),r=e===WH.DARK?XRe(t,"/quickswapdark.webp"):XRe(t,"/quickswaplight.webp");return Iq(N3,{testId:"quickswap-footer-container",sx:pRe,children:[Iq(N3,{testId:"quickswap-logo",sx:hRe,children:[Cq(tee,{size:"xSmall",sx:{paddingRight:"base.spacing.x1"},children:"By"}),Cq("img",{style:{height:"26px"},alt:"Quickswap logo",src:r})]}),Cq(tee,{testId:"quickswap-footer-disclaimer-text",size:"xSmall",sx:mRe,children:n("footers.quickswapFooter.disclaimerText")})]})}function G6e({visible:e,targetChainId:t,provider:n,checkout:r,onCloseDrawer:i,onNetworkSwitch:a}){const{t:o}=_ke(),s=XRe(r.config.environment??Xt.PRODUCTION,"/switchnetworkethereum.svg"),c=XRe(r.config.environment??Xt.PRODUCTION,"/switchnetworkzkevm.svg"),u=SPe(t),l=t===Jke(r.config),d=uV.useCallback((async()=>{if(!r)return;const e=await r.switchNetwork({provider:n,chainId:t});a&&a(e.provider)}),[r,n,a,t]),f=hNe(n),p=uV.useMemo((()=>f?n.provider?.session?.peer?.metadata?.name:""),[n,f]),h=uV.useMemo((()=>p?.toLowerCase().includes("metamask")),[p]),m=uV.useMemo((()=>pNe(n)?"MetaMask wallet":f&&p?p:"wallet"),[n,f,p]),y=f&&h;return uV.useEffect((()=>{(new Image).src=s;(new Image).src=c}),[]),Cq(wne,{size:"threeQuarter",visible:e,onCloseDrawer:i,showHeaderBar:!1,children:Iq(wne.Content,{sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center"},children:[Cq(K9,{use:Cq("img",{src:l?s:c,alt:o("drawers.networkSwitch.heading",{wallet:m})})}),Cq(d4,{icon:"Close",variant:"tertiary",sx:{pos:"absolute",top:"base.spacing.x5",left:"base.spacing.x5",backdropFilter:"blur(30px)"},onClick:i}),Iq(N3,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:"base.spacing.x4",paddingX:"base.spacing.x6"},children:[Cq(qee,{size:"small",weight:"bold",sx:{textAlign:"center",paddingX:"base.spacing.x6"},children:o("drawers.networkSwitch.heading",{wallet:m})}),y&&Cq(tee,{size:"medium",weight:"regular",sx:{color:"base.color.text.body.secondary",textAlign:"center",paddingX:"base.spacing.x6"},children:o("drawers.networkSwitch.manualSwitch.body",{chain:u})}),!y&&Cq(tee,{size:"medium",weight:"regular",sx:{color:"base.color.text.body.secondary",textAlign:"center",paddingX:"base.spacing.x6"},children:o("drawers.networkSwitch.controlledSwitch.body",{chain:u})})]}),Iq(N3,{sx:{display:"flex",flexDirection:"column",paddingX:"base.spacing.x4",width:"100%"},children:[!y&&Cq(O3,{size:"large",variant:"primary",sx:{width:"100%",marginBottom:"base.spacing.x2"},onClick:d,children:o("drawers.networkSwitch.switchButton",{chain:u})}),Cq(oNe,{})]})]})})}const q6e={exchange:null,walletProviderName:null,network:null,tokenBalances:[],supportedTopUps:null,allowedTokens:[]};var K6e;!function(e){e.SET_EXCHANGE="SET_EXCHANGE",e.SET_WALLET_PROVIDER_NAME="SET_WALLET_PROVIDER_NAME",e.SET_NETWORK="SET_NETWORK",e.SET_SUPPORTED_TOP_UPS="SET_SUPPORTED_TOP_UPS",e.SET_TOKEN_BALANCES="SET_TOKEN_BALANCES",e.SET_ALLOWED_TOKENS="SET_ALLOWED_TOKENS"}(K6e||(K6e={}));const X6e=uV.createContext({swapState:q6e,swapDispatch:()=>{}});X6e.displayName="SwapContext";const Y6e=(e,t)=>{switch(t.payload.type){case K6e.SET_EXCHANGE:return{...e,exchange:t.payload.exchange};case K6e.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case K6e.SET_NETWORK:return{...e,network:t.payload.network};case K6e.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}};case K6e.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case K6e.SET_ALLOWED_TOKENS:return{...e,allowedTokens:t.payload.allowedTokens};default:return e}};var Z6e;!function(e){e.USD="usd"}(Z6e||(Z6e={}));const J6e={cryptoFiat:null,fiatSymbol:Z6e.USD,tokenSymbols:[],conversions:new Map};var Q6e;!function(e){e.SET_CRYPTO_FIAT="SET_CRYPTO_FIAT",e.SET_FIAT_SYMBOL="SET_FIAT_SYMBOL",e.SET_TOKEN_SYMBOLS="SET_TOKEN_SYMBOLS",e.SET_CONVERSIONS="SET_CONVERSIONS"}(Q6e||(Q6e={}));const $6e=uV.createContext({cryptoFiatState:J6e,cryptoFiatDispatch:()=>{}}),e2e=(e,t)=>{switch(t.payload.type){case Q6e.SET_CRYPTO_FIAT:return{...e,cryptoFiat:t.payload.cryptoFiat};case Q6e.SET_FIAT_SYMBOL:return{...e,fiatSymbol:t.payload.fiatSymbol};case Q6e.SET_TOKEN_SYMBOLS:return{...e,tokenSymbols:t.payload.tokenSymbols};case Q6e.SET_CONVERSIONS:return{...e,conversions:t.payload.conversions};default:return e}},t2e={fromAmountIn:async(e,t,n,r,i)=>{const a=await t.getSigner().getAddress();return e.getUnsignedSwapTxFromAmountIn(a,n.address,i.address,jr.from(Yd(r,n.decimals)))},fromAmountOut:async(e,t,n,r,i)=>{const a=await t.getSigner().getAddress();return e.getUnsignedSwapTxFromAmountOut(a,i.address,n.address,jr.from(Yd(r,n.decimals)))}},n2e={display:"flex",flexDirection:"row",justifyContent:"space-between",columnGap:"base.spacing.x1"},r2e={flex:1},i2e={flex:2};function a2e({src:e,name:t,environment:n,theme:r,defaultImage:i,...a}){const[o,s]=uV.useState(!1);return Cq("img",{src:uV.useMemo((()=>!e||o?i||r&&QRe(n,r)||"":e),[e,o]),alt:t,onError:()=>s(!0),...a})}function o2e({onClick:e,icon:t,name:n,symbol:r,balance:i,defaultTokenImage:a,testId:o,id:s}){const{t:c}=_ke();return Iq(oae,{testId:`${o}-coin-selector__option-${s}`,emphasized:!0,size:"small",onClick:e,children:[Cq(oae.FramedImage,{circularFrame:!0,use:Cq(a2e,{src:t,name:n,defaultImage:a})}),Cq(oae.Label,{children:n}),Cq(oae.Caption,{children:r}),i&&Cq(oae.PriceDisplay,{fiatAmount:`${c("drawers.coinSelector.option.fiatPricePrefix")}${i.formattedFiatAmount}`,price:i.formattedAmount})]})}const s2e={display:"flex",flexDirection:"column",gap:"2px",paddingX:"base.spacing.x4",paddingBottom:"base.spacing.x4"},c2e={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"};function u2e({heading:e,options:t,defaultTokenImage:n,optionsLoading:r,children:i,onCloseDrawer:a,visible:o}){const{t:s}=_ke();return Iq(wne,{headerBarTitle:e,size:"full",onCloseDrawer:a,visible:o,children:[Cq(wne.Target,{children:i}),Cq(wne.Content,{children:Iq(N3,{sx:s2e,children:[r&&0===t.length&&Iq(N3,{sx:c2e,children:[Cq(oae,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),Cq(oae,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"}),Cq(oae,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--3"})]}),!r&&0===t.length&&Cq(tee,{sx:{padding:"base.spacing.x4"},children:s("drawers.coinSelector.noCoins")}),!r&&t.map((({onClick:e,icon:t,name:r,symbol:i,balance:a,id:o,testId:s})=>Cq(o2e,{id:o,testId:s,onClick:e,icon:t,name:r,symbol:i,balance:a,defaultTokenImage:n},`${i}-${r}`)))]})})]})}function l2e({testId:e,options:t,optionsLoading:n,subtext:r,onSelectChange:i,textAlign:a,errorMessage:o,disabled:s,selectedOption:c,coinSelectorHeading:u,defaultTokenImage:l,environment:d=Xt.PRODUCTION,theme:f=WH.DARK}){const[p,h]=uV.useState(!1),m=uV.useMemo((()=>t.map((t=>({...t,testId:e,onClick:()=>{i(t.id),h(!1)}})))),[t,i,h]),y=t?.find((e=>e.id===c))??c;return Iq(N3,{children:[Cq(u2e,{heading:u,options:m,defaultTokenImage:l,optionsLoading:n??!1,visible:p,onCloseDrawer:()=>h(!1)}),Cq(dqe,{testId:`${e}-select-control`,textAlign:a??"left",subtext:o?void 0:r,isErrored:!!o,errorMessage:o,children:Cq(bae,{testId:`${e}-select`,size:"large",defaultLabel:"Select token",targetClickOveride:()=>h(!0),selectedOption:(()=>{if(c&&0!==t.length&&t.find((e=>e.id===c)))return c})(),sx:{minw:"170px"},children:y&&Iq(bae.Option,{optionKey:y.id,testId:y.testId,disabled:s,children:[!y.icon&&Cq(bae.Option.Icon,{icon:"Coins",variant:"bold"}),y.icon&&Cq(bae.Option.FramedImage,{use:Cq(a2e,{environment:d,theme:f,src:y.icon,name:y.name}),circularFrame:!0,sx:{background:"base.color.translucent.standard.100"}}),Cq(bae.Option.Label,{children:y.symbol})]},y.id)})})]})}function d2e({testId:e,value:t,placeholder:n,errorMessage:r,validator:i,onTextInputChange:a,onTextInputBlur:o,onTextInputFocus:s,onTextInputEnter:c,textAlign:u,type:l,subtext:d,maxButtonClick:f,disabled:p,inputMode:h}){return Cq(dqe,{testId:`${e}-text-control`,textAlign:u??"left",subtext:r?void 0:d,isErrored:!!r,errorMessage:r,sx:{width:"100%"},children:Cq(Hoe,{testId:`${e}-text`,onChange:e=>((e,t)=>{let n=e.target.value;"number"===l&&"."===n&&(n="0."),i(n)?a(n):a(t??"")})(e,t),sizeVariant:"large",value:t,inputMode:h,validationStatus:r?"error":"success",placeholder:n,onBlur:e=>{if(!o)return;const t=e.target.value;i(t)&&o(t)},onFocus:e=>{if(!s)return;const t=e.target.value;i(t)&&s(t)},onKeyDown:e=>{c&&"Enter"===e.key&&c()},disabled:p,hideClearValueButton:!0,sx:{minWidth:"100%"},children:f&&Cq(Hoe.Button,{testId:`${e}-max-button`,onClick:f,disabled:p,children:"max"})})})}function f2e({testId:e,options:t,textInputValue:n,textInputPlaceholder:r,textInputValidator:i,textInputType:a,onTextInputChange:o,onTextInputBlur:s,onTextInputFocus:c,textInputTextAlign:u,textInputSubtext:l,textInputErrorMessage:d,testInputMode:f,selectTextAlign:p,selectSubtext:h,selectErrorMessage:m,textInputMaxButtonClick:y,onSelectChange:b,textInputDisabled:g,selectInputDisabled:v,selectedOption:w,coinSelectorHeading:T,defaultTokenImage:E,environment:A,theme:x}){return Iq(N3,{sx:n2e,children:[Cq(N3,{sx:r2e,children:Cq(l2e,{testId:`${e}-select-form`,options:t,subtext:h,textAlign:p,errorMessage:m,onSelectChange:b,disabled:v,selectedOption:w,coinSelectorHeading:T,defaultTokenImage:E,environment:A,theme:x})}),Cq(N3,{sx:i2e,children:Cq(d2e,{type:a,testId:`${e}-text-form`,value:n,placeholder:r,subtext:l,textAlign:u,errorMessage:d,validator:i,onTextInputChange:o,onTextInputBlur:s,onTextInputFocus:c,maxButtonClick:y,disabled:g,inputMode:f})})]})}const p2e={display:"flex",flexDirection:"column",height:"100%",padding:"16px 16px 0 16px"},h2e={display:"flex",flexDirection:"column",gap:"10px",height:"100%"},m2e={display:"flex",width:"100%"},y2e=e=>({width:"65%",color:e?"base.color.text.body.primary":"base.color.text.body.secondary"}),b2e={width:"35%"},g2e={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"};function v2e({boldLabel:e,label:t,amount:n,fiatAmount:r,tokenSymbol:i,prefix:a=""}){const o=t.toLowerCase().replace(" ","-");return Iq(N3,{sx:m2e,testId:`fee-item-${o}`,children:[Cq(tee,{sx:y2e(e),children:t}),Cq(Uee,{testId:o,sx:b2e,price:`${a}${i} ${n}`,fiatAmount:r})]})}function w2e({fees:e,children:t,visible:n,onCloseDrawer:r,totalFiatAmount:i,totalAmount:a,tokenSymbol:o,loading:s=!1}){const{t:c}=_ke();return Iq(wne,{headerBarTitle:c("drawers.feesBreakdown.heading"),size:"threeQuarter",onCloseDrawer:r,visible:n,children:[Cq(wne.Target,{children:t}),Iq(wne.Content,{testId:"fees-breakdown-content",sx:p2e,children:[Iq(N3,{sx:h2e,children:[s&&Iq(N3,{sx:g2e,children:[Cq(oae,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),Cq(oae,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"})]}),!s&&e.map((({label:e,amount:t,fiatAmount:n,prefix:r,token:i})=>Cq(v2e,{label:e,amount:t,fiatAmount:n,tokenSymbol:i.symbol??o,prefix:r},e))),a&&Iq(Oq,{children:[Cq(X3,{size:"xSmall"}),Cq(v2e,{label:c("drawers.feesBreakdown.total"),amount:VRe(a),fiatAmount:i?`≈ ${c("drawers.feesBreakdown.fees.fiatPricePrefix")}${i}`:HRe("0"),tokenSymbol:o,boldLabel:!0},c("drawers.feesBreakdown.total"))]})]}),Cq(oNe,{})]})]})}const T2e={backgroundColor:"base.color.translucent.emphasis.100"},E2e={marginBottom:"base.spacing.x4",color:"base.color.text.body.secondary"};function A2e({gasFeeValue:e,gasFeeToken:t,gasFeeFiatValue:n,fees:r,onFeesClick:i,loading:a,sx:o}){const[s,c]=uV.useState(!1),{t:u}=_ke();if(!e&&!a)return null;const l=HRe(VRe(e)),d=t?.symbol;return Iq(Oq,{children:[Iq(M4,{targetClickOveride:()=>{c(!0),i?.()},sx:{...T2e,paddingBottom:"base.spacing.x2",...o},children:[Cq(M4.TargetLeftSlot,{children:Cq(tee,{size:"medium",sx:E2e,children:u("drawers.feesBreakdown.heading")})}),Iq(M4.TargetRightSlot,{children:[a&&Cq(N3,{sx:{width:"218px",position:"relative"},children:Cq(N3,{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:Cq("span",{}),children:Cq(z7,{rc:Cq("span",{})})})}),!a&&Cq(Uee,{testId:"fees-gas-fee__priceDisplay",fiatAmount:`≈ ${u("drawers.feesBreakdown.fees.fiatPricePrefix")}${n}`,price:`~ ${d} ${HRe(VRe(l))}`})]})]}),Cq(w2e,{tokenSymbol:d??"",fees:r,visible:s,loading:a,onCloseDrawer:()=>c(!1)})]})}var x2e;!function(e){e.SWAP="SWAP",e.IN_PROGRESS="IN_PROGRESS",e.SUCCESS="SUCCESS",e.FAIL="FAIL",e.PRICE_SURGE="PRICE_SURGE",e.APPROVE_ERC20="APPROVE_ERC20_SWAP"}(x2e||(x2e={}));const O2e={display:"flex",flexDirection:"column",paddingY:"base.spacing.x6",paddingX:"base.spacing.x4"},C2e={width:"base.icon.size.400"},I2e={display:"flex",flexDirection:"column",alignItems:"center",paddingY:"50px",paddingX:"base.spacing.x4",height:"100%"},_2e={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"15px"},P2e={display:"flex",flexDirection:"column",justifyContent:"flex-end",gap:"8px",height:"100%",width:"100%"},S2e={width:"100%",height:"64px"};function k2e({onCloseDrawer:e,visible:t,showHeaderBar:n,onRetry:r}){const{t:i}=_ke();return Cq(wne,{headerBarTitle:void 0,size:"full",onCloseDrawer:e,visible:t,showHeaderBar:n,children:Cq(wne.Content,{children:Iq(N3,{sx:I2e,children:[Cq(ase,{icon:"Information",colorVariant:"guidance",iconVariant:"bold"}),Iq(qee,{size:"small",sx:_2e,testId:"transaction-rejected-heading",children:[i("drawers.transactionFailed.content.heading1"),Cq("br",{}),i("drawers.transactionFailed.content.heading2")]}),Iq(tee,{sx:_2e,children:[i("drawers.transactionFailed.content.body1"),Cq("br",{}),i("drawers.transactionFailed.content.body2")]}),Iq(N3,{sx:P2e,children:[Cq(O3,{sx:S2e,variant:"tertiary",onClick:r,children:i("drawers.transactionFailed.buttons.retry")}),Cq(O3,{sx:S2e,variant:"tertiary",onClick:e,testId:"transaction-rejected-cancel-button",children:i("drawers.transactionFailed.buttons.cancel")})]})]})})})}function R2e({loading:e,updateLoading:t,validator:n,transaction:r,data:i,insufficientFundsForGas:a,openNotEnoughImxDrawer:o,openNetworkSwitchDrawer:s}){const{t:c}=_ke(),[u,l]=uV.useState(!1),{viewDispatch:d}=uV.useContext(ERe),{connectLoaderState:f}=uV.useContext(jRe),{checkout:p,provider:h}=f,{track:m}=OPe(),y=async()=>{const e=n();if(m({userJourney:bPe.SWAP,screen:"SwapCoins",control:"Swap",controlType:"Button",extras:{swapFromAddress:i?.fromTokenAddress,swapFromAmount:i?.fromAmount,swapFromTokenSymbol:i?.fromTokenSymbol,swapToAddress:i?.toTokenAddress,swapToAmount:i?.toAmount,swapToTokenSymbol:i?.toTokenSymbol,isSwapFormValid:e,hasFundsForGas:!a}}),e&&p&&h&&r)if(a)o();else{try{const e=await h.provider.request({method:"eth_chainId",params:[]});if(parseInt(e.toString())!==Qke(p.config))return void s()}catch(e){console.error("Current network check failed",e)}if(r)try{t(!0);const e={fromAmount:i?.fromAmount||"",fromTokenAddress:i?.fromTokenAddress||"",toTokenAddress:i?.toTokenAddress||"",toAmount:i?.toAmount||""};if(r.approval)return void d({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.APPROVE_ERC20,data:{approveTransaction:r.approval.transaction,transaction:r.swap.transaction,info:r.quote,swapFormInfo:e}}}});const n=await p.sendTransaction({provider:h,transaction:{...r.swap.transaction,gasPrice:fNe(h)?jr.from(0):void 0}});d({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.IN_PROGRESS,data:{transactionResponse:n.transactionResponse,swapForm:e}}}})}catch(e){if(console.error(e),t(!1),e.type===uW.USER_REJECTED_REQUEST_ERROR)return void l(!0);if(e.type===uW.UNPREDICTABLE_GAS_LIMIT)return void d({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.PRICE_SURGE,data:i}}});if(e.type===uW.TRANSACTION_FAILED||e.type===uW.INSUFFICIENT_FUNDS||e.receipt&&0===e.receipt.status)return void d({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.FAIL,reason:"Transaction failed",data:i}}});d({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.ERROR_VIEW,error:e}}})}}};return Iq(N3,{sx:O2e,children:[Cq(O3,{testId:"swap-button",disabled:e,variant:"primary",onClick:y,size:"large",children:e?Cq(O3.Icon,{icon:"Loading",sx:C2e}):c("views.SWAP.swapForm.buttonText")}),Cq(k2e,{visible:u,showHeaderBar:!1,onCloseDrawer:()=>l(!1),onRetry:()=>{y(),l(!1)}})]})}function N2e(e,t){const n=uV.useRef(e),r=uV.useRef(0);return k9((()=>{n.current=e}),[e]),uV.useEffect((()=>{if(t||0===t)return r.current=setInterval((()=>n.current()),t),()=>{clearInterval(r.current)}}),[t]),()=>{r.current&&clearInterval(r.current)}}const M2e={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x1",height:"100%"},D2e={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"base.spacing.x4"},L2e={display:"flex",flexDirection:"column",justifyContent:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},j2e={width:"100%",height:"base.spacing.x16"},F2e={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"base.spacing.x6"};function B2e({environment:e,visible:t,showAdjustAmount:n,hasZeroImx:r,onCloseDrawer:i,onAddCoinsClick:a}){const{t:o}=_ke(),s=function(e){return XRe(e,"/tokens/imx.svg")}(e);return Cq(wne,{size:"full",onCloseDrawer:i,visible:t,showHeaderBar:!1,children:Cq(wne.Content,{children:Iq(N3,{testId:"not-enough-gas-bottom-sheet",sx:M2e,children:[Cq(K9,{sx:{w:"base.icon.size.600",h:"base.icon.size.600"},use:Cq("img",{src:s,alt:o(`drawers.notEnoughImx.content.${r?"noImx":"insufficientImx"}.heading`)})}),Cq(qee,{size:"small",sx:D2e,testId:"not-enough-gas-heading",children:o(`drawers.notEnoughImx.content.${r?"noImx":"insufficientImx"}.heading`)}),Cq(tee,{sx:D2e,children:o(`drawers.notEnoughImx.content.${r?"noImx":"insufficientImx"}.body`)}),Iq(N3,{sx:L2e,children:[n&&Cq(O3,{testId:"not-enough-gas-adjust-amount-button",sx:j2e,variant:"tertiary",onClick:i,children:o("drawers.notEnoughImx.buttons.adjustAmount")}),Cq(O3,{testId:"not-enough-gas-add-imx-button",sx:j2e,variant:"tertiary",onClick:a,children:o("drawers.notEnoughImx.buttons.addMoreImx")}),Cq(O3,{sx:j2e,variant:"tertiary",onClick:i,testId:"not-enough-gas-cancel-button",children:o("drawers.notEnoughImx.buttons.cancel")})]}),Cq(N3,{sx:F2e,children:Cq(O8,{testId:"footer-logo-image",logo:"ImmutableHorizontalLockup",sx:{width:"base.spacing.x25"}})})]})})})}const U2e={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x4",paddingX:"base.spacing.x4",height:"100%"},z2e={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"base.spacing.x4"},H2e={display:"flex",flexDirection:"column",justifyContent:"flex-end",alignItems:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},W2e={width:"100%",height:"base.spacing.x16",marginBottom:"base.spacing.x16"},V2e={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"base.spacing.x6"},G2e={width:"base.icon.size.600",fill:"base.color.status.fatal.bright"};function q2e({visible:e,onCloseDrawer:t}){const{t:n}=_ke();return Cq(wne,{size:"full",onCloseDrawer:t,visible:e,showHeaderBar:!1,children:Cq(wne.Content,{children:Iq(N3,{testId:"unable-to-swap-bottom-sheet",sx:U2e,children:[Cq(S6,{icon:"Alert",testId:"unable-to-swap-icon",variant:"bold",sx:G2e}),Cq(qee,{size:"small",sx:z2e,testId:"unable-to-swap-heading",children:n("drawers.unableToSwap.heading")}),Cq(tee,{sx:z2e,children:n("drawers.unableToSwap.body")}),Cq(N3,{sx:H2e,children:Cq(O3,{sx:W2e,variant:"tertiary",onClick:t,testId:"unable-to-swap-cancel-button",children:n("drawers.unableToSwap.buttons.cancel")})}),Cq(N3,{sx:V2e,children:Cq(O8,{testId:"footer-logo-image",logo:"ImmutableHorizontalLockup",sx:{width:"base.spacing.x25"}})})]})})})}const K2e=(e,t=500)=>{const[n,r]=uV.useState(e);return uV.useEffect((()=>{const n=setTimeout((()=>{r(e)}),t);return()=>{clearTimeout(n)}}),[e,t]),n};class X2e{static id=0;promiseId=0;promise;isCancelled=!1;onCancel=null;rejectPromise=()=>{};constructor(e){X2e.id+=1,this.promiseId=X2e.id,this.promise=new Promise(((t,n)=>{this.rejectPromise=n,e((e=>{this.isCancelled?n({cancelled:!0}):t(e)}),(e=>{this.isCancelled?n({cancelled:!0}):n(e)}))}))}static all(e){return new X2e(((t,n)=>{Promise.all(e.map((e=>e instanceof X2e?e.promise:e))).then(t,n)}))}then(e,t){return new X2e(((n,r)=>{this.promise.then((t=>n(e?e(t):t)),(e=>t?n(t(e)):r(e)))}))}catch(e){return this.then(void 0,e)}finally(e){return new X2e(((t,n)=>{this.promise.then(t,n).finally((()=>{e&&e()}))}))}cancel(){this.isCancelled||(this.isCancelled=!0,this.onCancel&&this.onCancel(),this.rejectPromise({cancelled:!0}))}onCancelled(e){this.onCancel=e}get cancelled(){return this.isCancelled}}const Y2e=(e,t,n)=>{const r=[];if(!e.swap)return r;const i=(e,i,a="≈ ")=>{const o=jr.from(e?.value??0);if(e&&o.gt(0)){const s=Xd(o,e.token.decimals);r.push({label:i,fiatAmount:`≈ ${n("drawers.feesBreakdown.fees.fiatPricePrefix")}${zRe(s,e.token.symbol||"",t.conversions)}`,amount:`${VRe(s)}`,prefix:a,token:e.token})}};return e.swap&&e.swap.gasFeeEstimate&&i(e.swap.gasFeeEstimate,n("drawers.feesBreakdown.fees.swapGasFee.label")),e.approval&&e.approval.gasFeeEstimate&&i(e.approval.gasFeeEstimate,n("drawers.feesBreakdown.fees.approvalFee.label")),e.quote?.fees?.forEach((e=>{i(e.amount,n("drawers.feesBreakdown.fees.swapSecondaryFee.label",{amount:e.basisPoints/100+"%"}),"")})),r},Z2e=(e,t)=>{if(!bNe(e))return t;const n={...t};return n.swap?.gasFeeEstimate&&(n.swap.gasFeeEstimate.value=jr.from(0)),n.approval?.gasFeeEstimate&&(n.approval.gasFeeEstimate.value=jr.from(0)),n},J2e=(e,t)=>{if(!t.quote.fees)return t;const n=t.quote.fees.map((t=>t.amount.token.symbol?t:{...t,amount:{...t.amount,token:{...t.amount.token,symbol:e.address===t.amount.token.address?e.symbol:t.amount.token.symbol}}}));return{...t,quote:{...t.quote,fees:n}}},Q2e=(e,t)=>{if(!t.quote.amount&&!t.quote.amountWithMaxSlippage)return t;const n={...t.quote.amount,token:{...t.quote.amount.token,symbol:e.address===t.quote.amount.token.address?e.symbol:t.quote.amount.token.symbol}},r={...t.quote.amountWithMaxSlippage,token:{...t.quote.amountWithMaxSlippage.token,symbol:e.address===t.quote.amountWithMaxSlippage.token.address?e.symbol:t.quote.amountWithMaxSlippage.token.symbol}};return{...t,quote:{...t.quote,amount:n,amountWithMaxSlippage:r}}},$2e=(e,t,n,r,i)=>{const a=n.quote.fees[0],o=t,s=n.quote.amount.token,c=Yd(parseFloat(e).toString(),o.decimals),u=jr.from(n.quote.amount.value),l=o.decimals,d=n.quote.amount.token.decimals,f=Math.max(l,d),p=jr.from("10").pow(f-l),h=jr.from("10").pow(f-d),m=c.mul(p),y=u.mul(h),b=y.div(m),g=y.mod(m),v=jr.from("10").pow(f),w=g.mul(v).div(m),T=b.mul(v).add(w),E=HRe(VRe(Xd(T,f)),!0);return i(r,{fromSymbol:o.symbol,toSymbol:s.symbol,rate:E,fee:(a?.basisPoints??0)/100})};var e8e;!function(e){e.FROM="FROM",e.TO="TO"}(e8e||(e8e={}));const t8e=(e,t)=>void 0!==e&&(""!==e&&t!==e);let n8e;function r8e({data:e,theme:t}){const{t:n}=_ke(),{swapState:{allowedTokens:r,exchange:i,tokenBalances:a,network:o}}=uV.useContext(X6e),{connectLoaderState:s}=uV.useContext(jRe),{checkout:c,provider:u}=s,l=QRe(c?.config.environment,t),d=uV.useCallback(((e,t)=>KRe(t)?Nke:`${e.toLowerCase()}-${t.toLowerCase()}`),[]),{cryptoFiatState:f,cryptoFiatDispatch:p}=uV.useContext($6e),{viewDispatch:h}=uV.useContext(ERe),[m,y]=uV.useState(e8e.FROM),[b,g]=uV.useState(!1),{track:v}=OPe(),[w,T]=uV.useState(e?.fromAmount||""),[E,A]=uV.useState(""),x=K2e(w,Lke),[O,C]=uV.useState(),[I,_]=uV.useState(""),[P,S]=uV.useState(""),[k,R]=uV.useState(0),[N,M]=uV.useState(e?.toAmount||""),[D,L]=uV.useState(""),j=K2e(N,Lke),[F,B]=uV.useState(),[U,z]=uV.useState(""),[H,W]=uV.useState(""),[V,G]=uV.useState(null),[q,K]=uV.useState(""),[X,Y]=uV.useState(void 0),[Z,J]=uV.useState(""),[Q,$]=uV.useState([]),ee=uV.useMemo((()=>V?Y2e(V,f,n):[]),[V,f,n]),[te,ne]=uV.useState(null),[re,ie]=uV.useState(""),ae=uV.useMemo((()=>V&&re&&te?$2e(re,te,V,"views.SWAP.swapForm.conversionRate",n):""),[re,te,V,n]),[oe,se]=uV.useState(!1),[ce,ue]=uV.useState(!1),[le,de]=uV.useState(!1);uV.useEffect((()=>{if(0===a.length)return;if(!o)return;const t=a.filter((e=>e.balance.gt(0))).map((e=>({id:d(e.token.symbol,e.token.address),name:e.token.name,symbol:e.token.symbol,icon:e.token.icon,balance:{formattedAmount:VRe(e.formattedBalance),formattedFiatAmount:0===f.conversions.size?HRe(""):zRe(e.formattedBalance,e.token.symbol||"",f.conversions)}})));$(t),e?.fromTokenAddress&&!O&&(C(r.find((t=>KRe(t.address)&&e?.fromTokenAddress?.toLowerCase()===Nke||t.address?.toLowerCase()===e?.fromTokenAddress?.toLowerCase()))),_(a.find((t=>KRe(t.token.address)&&e?.fromTokenAddress?.toLowerCase()===Nke||t.token.address?.toLowerCase()===e?.fromTokenAddress?.toLowerCase()))?.formattedBalance??"")),t8e(e?.toTokenAddress,e?.fromTokenAddress)&&!F&&B(r.find((t=>KRe(t.address)&&e?.toTokenAddress?.toLowerCase()===Nke||t.address?.toLowerCase()===e?.toTokenAddress?.toLowerCase())))}),[a,r,f.conversions,e?.fromTokenAddress,e?.toTokenAddress,C,_,B,$,d,HRe,o]);const fe=uV.useMemo((()=>r.map((e=>({id:d(e.symbol,e.address),name:e.name,symbol:e.symbol,icon:e.icon})))),[r,O]);uV.useEffect((()=>{p({payload:{type:Q6e.SET_TOKEN_SYMBOLS,tokenSymbols:r.map((e=>e.symbol))}})}),[p,r]);const pe=()=>{A(""),S(""),L(""),z("")},he=()=>{n8e&&n8e.cancel(),ie(""),ne(null),J(""),G(null)},me=(e,t)=>!Number.isNaN(parseFloat(e))&&(!(parseFloat(e)<=0)&&(!!O&&(!!F&&(!t||!b)))),ye=async(e=!1)=>{me(w,e)&&(n8e&&n8e.cancel(),e||g(!0),await(async(e=!1)=>{if(u&&i&&O&&F){try{const e=t2e.fromAmountIn(i,u,O,w,F),t=X2e.all([e]);n8e=t;const n=await t;let a=Z2e(u,n[0]);a=J2e(O,a),a=Q2e(F,a);const o=a.swap.gasFeeEstimate;let s=jr.from(o?.value||0);a.approval?.gasFeeEstimate&&(s=s.add(a.approval.gasFeeEstimate.value));const c=Xd(s,Mke),l=o?.token,d=r.find((e=>e.address?.toLocaleLowerCase()===l?.address?.toLocaleLowerCase()));ne(O),ie(w),G(a),K(c),Y({name:d?.name||"",symbol:d?.symbol||"",decimals:d?.decimals||0,address:d?.address,icon:d?.icon}),J(zRe(c,d?.symbol||"",f.conversions)),M(HRe(VRe(Xd(a.quote.amount.value,a.quote.amount.token.decimals),a.quote.amount.token.decimals))),pe()}catch(e){e.cancelled||(console.error("Error fetching quote.",e),he(),se(!1),ue(!0))}e||g(!1)}})(e))},be=(e,t)=>!Number.isNaN(parseFloat(e))&&(!(parseFloat(e)<=0)&&(!!O&&(!!F&&(!t||!b)))),ge=async(e=!1)=>{be(N,e)&&(n8e&&n8e.cancel(),e||g(!0),await(async(e=!1)=>{if(u&&i&&O&&F){try{const e=t2e.fromAmountOut(i,u,F,N,O),t=X2e.all([e]);n8e=t;const n=await t;let a=Z2e(u,n[0]);a=J2e(O,a);const o=a.swap.gasFeeEstimate;let s=jr.from(o?.value||0);a.approval?.gasFeeEstimate&&(s=s.add(a.approval.gasFeeEstimate.value));const c=Xd(s,Mke),l=o?.token,d=r.find((e=>e.symbol===l?.symbol));ne(F),ie(N),G(a),K(c),Y({name:d?.name||"",symbol:d?.symbol||"",decimals:d?.decimals||0,address:d?.address,icon:d?.icon}),J(zRe(c,d?.symbol||"",f.conversions)),T(HRe(VRe(Xd(a.quote.amount.value,a.quote.amount.token.decimals)))),pe()}catch(e){e.cancelled||(he(),se(!1),ue(!0))}e||g(!1)}})(e))},ve=async(e=!1)=>{m===e8e.FROM?await ye(e):await ge(e)};N2e((()=>ve(!0)),Vke),uV.useEffect((()=>{if(m===e8e.FROM){if(x<=0)return g(!1),void he();(async()=>{await ve()})()}}),[x,O,F,k]),uV.useEffect((()=>{if(m===e8e.TO){if(j<=0)return g(!1),void he();(async()=>{await ve()})()}}),[j,F,O]);const we=uV.useMemo((()=>{if(!u)return!0;if(fNe(u))return!1;const e=a.find((e=>e.token.address?.toLowerCase()===Nke));if(!e)return!0;const t=O?.address?.toLowerCase()===Nke,n=Yd(0!==q.length?q:"0",18);const r=t&&!Number.isNaN(parseFloat(w))?Yd(w,O?.decimals||18):jr.from("0");return n.add(r).gt(e.balance)}),[q,a,O,w,u]);uV.useEffect((()=>{w&&O&&W(zRe(w,O.symbol,f.conversions))}),[w,O,f.conversions]);const Te=uV.useCallback((e=>{const t=a.find((t=>e===d(t.token.symbol,t.token.address)));t&&(F&&e===d(F.symbol,F?.address)&&B(void 0),C(t.token),_(t.formattedBalance),S(""))}),[F]),Ee=uV.useCallback((e=>{const t=r.find((t=>e===d(t.symbol,t.address)));t&&(O&&e===d(O.symbol,O?.address)&&C(void 0),B(t),z(""))}),[O]);return Iq(Oq,{children:[Iq(N3,{sx:{paddingX:"base.spacing.x4",marginBottom:"base.spacing.x2"},children:[Cq(qee,{size:"small",weight:"regular",sx:{paddingBottom:"base.spacing.x4"},children:n("views.SWAP.content.title")}),Iq(N3,{sx:{display:"flex",flexDirection:"column",rowGap:"base.spacing.x6",paddingBottom:"base.spacing.x2"},children:[Iq(N3,{children:[Cq(qee,{size:"xSmall",sx:{display:"flex",justifyContent:"space-between",paddingBottom:"base.spacing.x1"},children:n("views.SWAP.swapForm.from.label")}),Cq(f2e,{testId:"fromTokenInputs",options:Q,selectSubtext:O?`${n("views.SWAP.content.availableBalancePrefix")} ${VRe(I)}`:"",selectTextAlign:"left",textInputType:"number",testInputMode:"decimal",textInputValue:w,textInputPlaceholder:n("views.SWAP.swapForm.from.inputPlaceholder"),textInputSubtext:`${n("views.SWAP.content.fiatPricePrefix")} \n $${HRe(H,!0)}`,textInputTextAlign:"right",textInputValidator:Yqe,onTextInputChange:e=>{var t;(t=e)!==w&&(pe(),he(),M(""),me(t,!1)&&g(!0),T(t))},onTextInputFocus:()=>{y(e8e.FROM)},textInputMaxButtonClick:()=>{if(!I)return;const e=I.slice(0,I.indexOf(".")+Dke+1);pe(),he(),y(e8e.FROM),M(""),me(e,!1)&&g(!0),w===e?R(k+1):T(e),v({userJourney:bPe.SWAP,screen:"SwapCoins",control:"MaxFrom",controlType:"Button",extras:{fromBalance:I,fromBalanceTruncated:e}})},onSelectChange:Te,textInputErrorMessage:n(E),selectErrorMessage:n(P),selectedOption:O?d(O.symbol,O.address):void 0,coinSelectorHeading:n("views.SWAP.swapForm.from.selectorTitle"),defaultTokenImage:l,environment:c?.config.environment,theme:t})]}),Iq(N3,{children:[Iq(N3,{sx:{display:"flex",justifyContent:"space-between",paddingBottom:"base.spacing.x1"},children:[Cq(qee,{size:"xSmall",children:n("views.SWAP.swapForm.to.label")}),ae?.length>0&&Iq(ace,{children:[Cq(ace.Target,{children:Cq(S6,{icon:"InformationCircle",sx:{w:"base.icon.size.300"}})}),Cq(ace.Content,{children:ae})]})]}),Cq(f2e,{testId:"toTokenInputs",options:fe,selectTextAlign:"left",textInputType:"number",testInputMode:"decimal",textInputValue:N,textInputPlaceholder:n("views.SWAP.swapForm.to.inputPlaceholder"),textInputTextAlign:"right",textInputValidator:Yqe,onTextInputChange:e=>{var t;(t=e)!==N&&(pe(),he(),W(""),T(""),be(t,!1)&&g(!0),M(t))},onTextInputFocus:()=>{y(e8e.TO)},onSelectChange:Ee,textInputErrorMessage:n(D),selectErrorMessage:n(U),selectedOption:F?d(F.symbol,F.address):void 0,coinSelectorHeading:n("views.SWAP.swapForm.to.selectorTitle"),defaultTokenImage:l,environment:c?.config.environment,theme:t})]})]}),!fNe(u)&&Cq(A2e,{gasFeeFiatValue:Z,gasFeeToken:X,gasFeeValue:q,fees:ee,onFeesClick:()=>{v({userJourney:bPe.SWAP,screen:"SwapCoins",control:"ViewFees",controlType:"Button"})},sx:{paddingBottom:"0"},loading:b})]}),Cq(R2e,{validator:()=>{const e=function(e){return e?"":"views.SWAP.validation.noFromTokenSelected"}(O),t=function(e,t){return e&&0!==parseFloat(e)?t&&Number(e)>Number(t)?"views.SWAP.validation.insufficientBalance":"":"views.SWAP.validation.noAmountInputted"}(w,I),n=function(e){return e?"":"views.SWAP.validation.noToTokenSelected"}(F),r=(i=N)&&0!==parseFloat(i)?"":"views.SWAP.validation.noAmountInputted";var i;m===e8e.FROM?(L(""),t&&A(t)):m===e8e.TO&&(A(""),r&&L(r)),e&&S(e),n&&z(n);let a=!0;return(e||n||t&&m===e8e.FROM||r&&m===e8e.TO)&&(a=!1),v({userJourney:bPe.SWAP,screen:"SwapCoins",control:"FormValid",controlType:"Button",extras:{isSwapFormValid:a,swapFromAddress:O?.address,swapFromAmount:w,swapFromTokenSymbol:O?.symbol,swapToAddress:F?.address,swapToAmount:N,swapToTokenSymbol:F?.symbol}}),a},updateLoading:e=>{g(e)},loading:b,transaction:V,data:{fromAmount:w,toAmount:N,fromTokenSymbol:O?.symbol,fromTokenAddress:O?.address,toTokenSymbol:F?.symbol,toTokenAddress:F?.address},insufficientFundsForGas:we,openNotEnoughImxDrawer:()=>{ue(!1),se(!0)},openNetworkSwitchDrawer:()=>de(!0)}),Cq(B2e,{environment:c?.config.environment??Xt.PRODUCTION,visible:oe,showAdjustAmount:O?.address===Nke,hasZeroImx:!1,onAddCoinsClick:()=>{h({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.TOP_UP_VIEW},currentViewData:{fromTokenAddress:O?.address??"",fromAmount:w,toTokenAddress:F?.address??""}}})},onCloseDrawer:()=>se(!1)}),Cq(q2e,{visible:ce,onCloseDrawer:()=>{ue(!1),C(void 0),T(""),B(void 0),M("")}}),Cq(G6e,{visible:le,targetChainId:Qke(c?.config),provider:u,checkout:c,onCloseDrawer:()=>de(!1)})]})}const i8e=(e,t)=>{if(0===e.length)return!0;let n=!1;return e.forEach((e=>{e.token.symbol===t&&e.balance.eq(0)&&(n=!0)})),n};function a8e({theme:e,fromAmount:t,toAmount:n,fromTokenAddress:r,toTokenAddress:i}){const{t:a}=_ke(),{viewDispatch:o}=uV.useContext(ERe),{eventTargetState:{eventTarget:s}}=uV.useContext(zqe),{swapState:{tokenBalances:c}}=uV.useContext(X6e),{connectLoaderState:{checkout:u,provider:l}}=uV.useContext(jRe),[d,f]=uV.useState(!1),{page:p}=OPe();return uV.useEffect((()=>{p({userJourney:bPe.SWAP,screen:"SwapCoins",extras:{fromAmount:t,toAmount:n,fromTokenAddress:r,toTokenAddress:i}})}),[]),uV.useEffect((()=>{i8e(c,jke)&&!fNe(l)&&f(!0)}),[c]),Cq(_Pe,{header:Cq(xRe,{title:a("views.SWAP.header.title"),onCloseButtonClick:()=>eKe(s)}),footer:Cq(V6e,{environment:u?.config.environment,theme:e}),children:Iq(N3,{sx:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[Cq(r8e,{data:{fromAmount:t,toAmount:n,fromTokenAddress:r,toTokenAddress:i},theme:e}),Cq(B2e,{environment:u?.config.environment??Xt.PRODUCTION,visible:d,showAdjustAmount:!1,hasZeroImx:!0,onAddCoinsClick:()=>{o({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.TOP_UP_VIEW}}})},onCloseDrawer:()=>{f(!1)}})]})})}class o8e{baseConfig;constructor({baseConfig:e}){this.baseConfig=e}}const s8e={[Xt.SANDBOX]:"https://checkout-api.sandbox.immutable.com",[Xt.PRODUCTION]:"https://checkout-api.immutable.com"};class c8e{coinsCache;overridesCache;config;constructor(e){this.coinsCache=null,this.overridesCache=null,this.config=e.baseConfig}urlWithPath(e){return s8e[this.config.environment]+e}async fetchOverrides(){if(null!==this.overridesCache)return;const e=this.urlWithPath("/v1/fiat/coins/overrides"),t=await ze.get(e);if(200!==t.status)throw new Error(`Error fetching coins overrides: ${t.status} ${t.statusText}`);this.overridesCache=new Map(Object.entries(t.data))}async fetchCoins(){if(null!==this.coinsCache)return;await this.fetchOverrides();const e=this.urlWithPath("/v1/fiat/coins/all"),t=await ze.get(e);if(200!==t.status)throw new Error(`Error fetching coins list: ${t.status} ${t.statusText}`);const{data:n}=t;this.coinsCache=new Map;for(const e of n){const t=this.overridesCache.get(e.symbol.toLowerCase());this.coinsCache.set(e.symbol.toLowerCase(),t||e.id.toLowerCase())}}async convert({tokenSymbols:e,fiatSymbols:t=[]}){if(!e||0===e.length)throw new Error("Error missing token symbols to convert");const n=t.filter((e=>""!==e));0===n.length&&n.push("usd"),await this.fetchCoins();const r=e.map((e=>this.coinsCache.get(e.toLowerCase()))).filter((e=>""!==e&&void 0!==e)).join(","),i=n.join(",").toLowerCase(),a=this.urlWithPath(`/v1/fiat/conversion?ids=${r}¤cies=${i}`),o=await ze.get(a);if(200!==o.status)throw new Error(`Error fetching prices: ${o.status} ${o.statusText}`);const{data:s}=o,c={};for(const t of e){const e=t.toLowerCase(),n=this.coinsCache.get(e);c[e]={},n&&(c[e]=s[n]||{})}return c}}const u8e=async(e,t,n)=>{try{if(0===n.length)return new Map;return((e,t)=>{const n=new Map;for(const r in e){const i=e[r][t];void 0!==i&&n.set(r,i)}return n})(await e.convert({tokenSymbols:n,fiatSymbols:[t]}),t)}catch(e){return new Map}},l8e=["ETH","IMX"];function d8e({environment:e,children:t}){const[n,r]=uV.useReducer(e2e,J6e),{cryptoFiat:i,fiatSymbol:a,tokenSymbols:o}=n;return uV.useEffect((()=>{r({payload:{type:Q6e.SET_CRYPTO_FIAT,cryptoFiat:new c8e(new o8e({baseConfig:{environment:e}}))}})}),[]),uV.useEffect((()=>{i&&a&&(async()=>{const e=await u8e(i,a,[...new Set([...o,...l8e])]);r({payload:{type:Q6e.SET_CONVERSIONS,conversions:e}})})()}),[i,o,a]),Cq($6e.Provider,{value:{cryptoFiatState:n,cryptoFiatDispatch:r},children:t})}function f8e({transactionResponse:e,swapForm:t}){const{t:n}=_ke(),{viewDispatch:r}=uV.useContext(ERe),{page:i}=OPe();return uV.useEffect((()=>{i({userJourney:bPe.SWAP,screen:"SwapInProgress",extras:{swapFormInfo:t}})}),[]),uV.useEffect((()=>{(async()=>{try{const n=await e.wait();if(1===n.status)return void r({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.SUCCESS,data:{fromTokenAddress:t.fromTokenAddress,fromAmount:t.fromAmount,toTokenAddress:t.toTokenAddress,toAmount:t.toAmount||"",transactionHash:n.transactionHash}}}});r({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.FAIL,data:t,reason:"Transaction failed"}}})}catch{r({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.FAIL,data:t,reason:"Transaction failed"}}})}})()}),[e]),Cq(PPe,{loadingText:n("views.SWAP.IN_PROGRESS.loading.text")})}function p8e(){return Cq(N3,{sx:{...IRe,background:"base.color.translucent.emphasis.100"},children:Cq(N3,{sx:{...ORe,...CRe},children:Iq("svg",{width:"430",height:"305",viewBox:"0 0 430 305",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Cq("path",{d:"M94.0614 105.632L93.6321 104L92 104.429L92.4292 106.061L94.0614 105.632Z",fill:"white"}),Cq("path",{d:"M63.6531 193.101L63.1006 191L60.9996 191.553L61.5521 193.654L63.6531 193.101Z",fill:"white"}),Cq("path",{d:"M344.489 224.345L342.345 224L342 226.145L344.144 226.49L344.489 224.345Z",fill:"white"}),Cq("path",{d:"M372.286 139.905L372.905 138.619L371.619 138L371 139.286L372.286 139.905Z",fill:"white"}),Cq("path",{d:"M341.653 78.101L341.101 76L339 76.5525L339.552 78.6535L341.653 78.101Z",fill:"white"}),Cq("path",{d:"M359.286 242.905L359.905 241.619L358.619 241L358 242.286L359.286 242.905Z",fill:"white"}),Cq("path",{d:"M87.0123 112.087L86.0869 111L85.0002 111.925L85.9256 113.012L87.0123 112.087Z",fill:"white"}),Cq("path",{d:"M84.2862 248.905L84.9053 247.619L83.6192 247L83.0001 248.286L84.2862 248.905Z",fill:"white"}),Cq("path",{d:"M215.496 262.992C268.237 262.992 310.993 220.237 310.993 167.496C310.993 114.755 268.237 72 215.496 72C162.755 72 120 114.755 120 167.496C120 220.237 162.755 262.992 215.496 262.992Z",fill:"white",fillOpacity:"0.24",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M159.82 95.1695C179.975 79.6536 204.651 73.1506 227.89 77.0665C261.089 82.6606 253.281 101.028 199.197 121.314C151.934 139.037 123.49 136.348 143.823 110.95C148.422 105.208 153.721 99.8623 159.82 95.1695Z",fill:"white",fillOpacity:"0.08"}),Cq("path",{d:"M215.497 227.183C171.451 227.183 135.159 219.871 130.194 210.462H130.187C145.912 241.626 178.21 263.001 215.497 263.001C252.705 263.001 284.942 241.719 300.706 210.664C295.33 219.98 259.232 227.183 215.505 227.183H215.497Z",fill:"#36E0F8",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M284.219 219.607L283.978 219.84C281.275 222.482 256.583 215.986 253.172 218.418C222.389 240.36 182.779 269.061 146.099 219.397C146.099 219.397 140.761 217.641 138.609 216.686C139.425 217.96 140.279 219.226 141.165 220.469C170.425 261.516 227.423 271.073 268.47 241.813C276.97 235.752 284.118 228.503 289.852 220.454L292.424 216.841L288.252 218.302C287.086 218.713 285.851 219.11 284.553 219.498L284.227 219.599L284.219 219.607Z",fill:"black"}),Cq("path",{d:"M215.496 241.4C262.183 241.4 300.03 226.557 300.03 208.248C300.03 189.938 262.183 175.095 215.496 175.095C168.81 175.095 130.963 189.938 130.963 208.248C130.963 226.557 168.81 241.4 215.496 241.4Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M300.705 210.659C300.705 210.659 300.705 210.65 300.705 210.641C300.705 210.641 300.705 210.65 300.705 210.659Z",fill:"#EBE9E9",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M193.624 204.511C208.952 204.511 221.377 199.638 221.377 193.626C221.377 187.614 208.952 182.741 193.624 182.741C178.297 182.741 165.871 187.614 165.871 193.626C165.871 199.638 178.297 204.511 193.624 204.511Z",fill:"#D0F500",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M193.624 204.511C208.954 204.511 221.377 199.64 221.377 193.626V201.349C221.377 207.363 208.954 212.234 193.624 212.234C178.295 212.234 165.871 207.363 165.871 201.349V193.626C165.871 199.64 178.295 204.511 193.624 204.511Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M197.33 204.41C199.49 204.294 201.573 204.084 203.546 203.789V211.512C201.573 211.807 199.49 212.017 197.33 212.133V204.41Z",fill:"#D0F500"}),Cq("path",{d:"M206.398 203.291C211.246 202.304 215.255 200.774 217.905 198.901V206.624C215.255 208.497 211.246 210.027 206.398 211.014V203.291Z",fill:"black"}),Cq("path",{d:"M193.624 204.511C208.954 204.511 221.377 199.64 221.377 193.626V201.349C221.377 207.363 208.954 212.234 193.624 212.234C178.295 212.234 165.871 207.363 165.871 201.349V193.626C165.871 199.64 178.295 204.511 193.624 204.511Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M206.398 211.015C211.246 210.028 215.255 208.497 217.905 206.625",stroke:"#A66CFF",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M193.624 196.788C208.952 196.788 221.377 191.914 221.377 185.903C221.377 179.891 208.952 175.017 193.624 175.017C178.297 175.017 165.871 179.891 165.871 185.903C165.871 191.914 178.297 196.788 193.624 196.788Z",fill:"#D0F500",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M193.624 196.788C208.954 196.788 221.377 191.917 221.377 185.903V193.626C221.377 199.639 208.954 204.511 193.624 204.511C178.295 204.511 165.871 199.639 165.871 193.626V185.903C165.871 191.917 178.295 196.788 193.624 196.788Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M197.33 196.687C199.49 196.57 201.573 196.361 203.546 196.065V203.788C201.573 204.084 199.49 204.293 197.33 204.41V196.687Z",fill:"#36E0F8"}),Cq("path",{d:"M206.398 195.568C211.246 194.581 215.255 193.051 217.905 191.178V198.901C215.255 200.774 211.246 202.304 206.398 203.291V195.568Z",fill:"black"}),Cq("path",{d:"M193.624 196.788C208.954 196.788 221.377 191.917 221.377 185.903V193.626C221.377 199.639 208.954 204.511 193.624 204.511C178.295 204.511 165.871 199.639 165.871 193.626V185.903C165.871 191.917 178.295 196.788 193.624 196.788Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M206.398 203.291C211.246 202.304 215.255 200.774 217.905 198.901",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M193.624 189.065C208.952 189.065 221.377 184.192 221.377 178.18C221.377 172.168 208.952 167.294 193.624 167.294C178.297 167.294 165.871 172.168 165.871 178.18C165.871 184.192 178.297 189.065 193.624 189.065Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M193.624 189.065C208.954 189.065 221.377 184.194 221.377 178.18V185.903C221.377 191.917 208.954 196.788 193.624 196.788C178.295 196.788 165.871 191.917 165.871 185.903V178.18C165.871 184.194 178.295 189.065 193.624 189.065Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M197.33 188.965C199.49 188.849 201.573 188.639 203.546 188.343V196.067C201.573 196.362 199.49 196.571 197.33 196.688V188.965Z",fill:"#F191FA"}),Cq("path",{d:"M206.398 187.845C211.246 186.858 215.255 185.327 217.905 183.455V191.178C215.255 193.05 211.246 194.581 206.398 195.568V187.845Z",fill:"black"}),Cq("path",{d:"M193.624 189.065C208.954 189.065 221.377 184.194 221.377 178.18V185.903C221.377 191.917 208.954 196.788 193.624 196.788C178.295 196.788 165.871 191.917 165.871 185.903V178.18C165.871 184.194 178.295 189.065 193.624 189.065Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M206.398 195.569C211.246 194.582 215.255 193.052 217.905 191.179",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M238.601 212.934C253.929 212.934 266.354 208.06 266.354 202.049C266.354 196.037 253.929 191.164 238.601 191.164C223.274 191.164 210.848 196.037 210.848 202.049C210.848 208.06 223.274 212.934 238.601 212.934Z",fill:"#D0F500",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M238.601 212.935C253.931 212.935 266.354 208.063 266.354 202.049V209.772C266.354 215.786 253.931 220.658 238.601 220.658C223.272 220.658 210.848 215.786 210.848 209.772V202.049C210.848 208.063 223.272 212.935 238.601 212.935Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M242.307 212.833C244.467 212.717 246.55 212.507 248.523 212.212V219.935C246.55 220.23 244.467 220.44 242.307 220.556V212.833Z",fill:"#F191FA"}),Cq("path",{d:"M251.375 211.713C256.223 210.727 260.232 209.196 262.882 207.324V215.047C260.232 216.919 256.223 218.45 251.375 219.436V211.713Z",fill:"black"}),Cq("path",{d:"M238.601 212.935C253.931 212.935 266.354 208.063 266.354 202.049V209.772C266.354 215.786 253.931 220.658 238.601 220.658C223.272 220.658 210.848 215.786 210.848 209.772V202.049C210.848 208.063 223.272 212.935 238.601 212.935Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M251.375 219.437C256.223 218.45 260.232 216.919 262.882 215.047",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M238.601 205.21C253.929 205.21 266.354 200.336 266.354 194.324C266.354 188.313 253.929 183.439 238.601 183.439C223.274 183.439 210.848 188.313 210.848 194.324C210.848 200.336 223.274 205.21 238.601 205.21Z",fill:"#D0F500",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M238.601 205.21C253.931 205.21 266.354 200.339 266.354 194.325V202.048C266.354 208.062 253.931 212.934 238.601 212.934C223.272 212.934 210.848 208.062 210.848 202.048V194.325C210.848 200.339 223.272 205.21 238.601 205.21Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M242.307 205.109C244.467 204.993 246.55 204.783 248.523 204.488V212.211C246.55 212.506 244.467 212.716 242.307 212.832V205.109Z",fill:"#36E0F8"}),Cq("path",{d:"M251.375 203.989C256.223 203.003 260.232 201.472 262.882 199.6V207.323C260.232 209.195 256.223 210.726 251.375 211.712V203.989Z",fill:"black"}),Cq("path",{d:"M238.601 205.21C253.931 205.21 266.354 200.339 266.354 194.325V202.048C266.354 208.062 253.931 212.934 238.601 212.934C223.272 212.934 210.848 208.062 210.848 202.048V194.325C210.848 200.339 223.272 205.21 238.601 205.21Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M251.375 211.713C256.223 210.726 260.232 209.195 262.882 207.323",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M238.601 197.487C253.929 197.487 266.354 192.613 266.354 186.602C266.354 180.59 253.929 175.716 238.601 175.716C223.274 175.716 210.848 180.59 210.848 186.602C210.848 192.613 223.274 197.487 238.601 197.487Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M238.601 197.487C253.931 197.487 266.354 192.616 266.354 186.602V194.325C266.354 200.339 253.931 205.21 238.601 205.21C223.272 205.21 210.848 200.339 210.848 194.325V186.602C210.848 192.616 223.272 197.487 238.601 197.487Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M242.307 197.386C244.467 197.27 246.55 197.06 248.523 196.765V204.488C246.55 204.783 244.467 204.992 242.307 205.109V197.386Z",fill:"#F191FA"}),Cq("path",{d:"M251.375 196.267C256.223 195.28 260.232 193.75 262.882 191.877V199.6C260.232 201.473 256.223 203.003 251.375 203.99V196.267Z",fill:"#9AEFFB"}),Cq("path",{d:"M238.601 197.487C253.931 197.487 266.354 192.616 266.354 186.602V194.325C266.354 200.339 253.931 205.21 238.601 205.21C223.272 205.21 210.848 200.339 210.848 194.325V186.602C210.848 192.616 223.272 197.487 238.601 197.487Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M251.375 203.99C256.223 203.004 260.232 201.473 262.882 199.601",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M232.652 189.678C247.979 189.678 260.405 184.804 260.405 178.793C260.405 172.781 247.979 167.908 232.652 167.908C217.324 167.908 204.899 172.781 204.899 178.793C204.899 184.804 217.324 189.678 232.652 189.678Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M232.652 189.678C247.981 189.678 260.405 184.807 260.405 178.793V186.516C260.405 192.53 247.981 197.401 232.652 197.401C217.323 197.401 204.899 192.53 204.899 186.516V178.793C204.899 184.807 217.323 189.678 232.652 189.678Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M236.358 189.578C238.518 189.461 240.6 189.251 242.574 188.956V196.679C240.6 196.974 238.518 197.184 236.358 197.301V189.578Z",fill:"#F191FA"}),Cq("path",{d:"M245.426 188.458C250.274 187.471 254.283 185.94 256.932 184.067V191.791C254.283 193.663 250.274 195.194 245.426 196.18V188.458Z",fill:"black"}),Cq("path",{d:"M232.652 189.678C247.981 189.678 260.405 184.807 260.405 178.793V186.516C260.405 192.53 247.981 197.401 232.652 197.401C217.323 197.401 204.899 192.53 204.899 186.516V178.793C204.899 184.807 217.323 189.678 232.652 189.678Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M245.426 196.182C250.274 195.195 254.283 193.664 256.932 191.792",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M240.99 180.021C256.317 180.021 268.743 175.148 268.743 169.136C268.743 163.124 256.317 158.25 240.99 158.25C225.662 158.25 213.237 163.124 213.237 169.136C213.237 175.148 225.662 180.021 240.99 180.021Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M240.99 180.021C256.319 180.021 268.743 175.15 268.743 169.136V176.859C268.743 182.873 256.319 187.744 240.99 187.744C225.66 187.744 213.237 182.873 213.237 176.859V169.136C213.237 175.15 225.66 180.021 240.99 180.021Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M244.696 179.92C246.856 179.804 248.938 179.594 250.911 179.299V187.022C248.938 187.317 246.856 187.527 244.696 187.643V179.92Z",fill:"#9AEFFB"}),Cq("path",{d:"M253.763 178.801C258.612 177.815 262.621 176.284 265.27 174.412V182.135C262.621 184.007 258.612 185.538 253.763 186.524V178.801Z",fill:"black"}),Cq("path",{d:"M240.99 180.021C256.319 180.021 268.743 175.15 268.743 169.136V176.859C268.743 182.873 256.319 187.744 240.99 187.744C225.66 187.744 213.237 182.873 213.237 176.859V169.136C213.237 175.15 225.66 180.021 240.99 180.021Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M253.763 186.525C258.612 185.538 262.621 184.007 265.27 182.135",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M189.911 223.803C205.238 223.803 217.664 218.929 217.664 212.918C217.664 206.906 205.238 202.032 189.911 202.032C174.583 202.032 162.158 206.906 162.158 212.918C162.158 218.929 174.583 223.803 189.911 223.803Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M189.911 223.803C205.24 223.803 217.664 218.932 217.664 212.918V220.641C217.664 226.655 205.24 231.526 189.911 231.526C174.581 231.526 162.158 226.655 162.158 220.641V212.918C162.158 218.932 174.581 223.803 189.911 223.803Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M193.625 223.71C195.785 223.593 197.867 223.384 199.84 223.088V230.811C197.867 231.107 195.785 231.316 193.625 231.433V223.71Z",fill:"#F191FA"}),Cq("path",{d:"M202.685 222.583C207.533 221.596 211.542 220.066 214.191 218.193V225.916C211.542 227.789 207.533 229.319 202.685 230.306V222.583Z",fill:"#9AEFFB"}),Cq("path",{d:"M189.911 223.803C205.24 223.803 217.664 218.932 217.664 212.918V220.641C217.664 226.655 205.24 231.526 189.911 231.526C174.581 231.526 162.158 226.655 162.158 220.641V212.918C162.158 218.932 174.581 223.803 189.911 223.803Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M202.685 230.306C207.533 229.32 211.542 227.789 214.191 225.917",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M300.705 210.658C300.705 210.658 300.705 210.649 300.705 210.641C300.705 210.641 300.705 210.649 300.705 210.658Z",fill:"#A66CFF",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})]})})})}function h8e(){return Cq(N3,{testId:"wallet-approve-hero",sx:{...IRe,background:"base.color.translucent.emphasis.100"},children:Cq(N3,{sx:{...ORe,...CRe},children:Iq("svg",{width:"430",height:"305",viewBox:"0 0 430 305",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Cq("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"}),Cq("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"}),Cq("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"}),Cq("path",{d:"M159.384 154.519L155.93 147.991L158.939 141.463L162.388 147.991L159.384 154.519Z",fill:"#F191FA"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("path",{d:"M232.923 169.903L235.354 164.731",stroke:"black",strokeWidth:"0.469297",strokeMiterlimit:"10"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("path",{d:"M273.579 230.377L277.263 229.767L287.024 238.458L278.347 222.051L270.373 223.609L273.579 230.377Z",fill:"black"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("path",{d:"M208.107 253.158L205.685 248.573",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M191.634 240.96H185.758",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("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"}),Cq("path",{d:"M356.061 232.632L355.632 231L354 231.429L354.429 233.061L356.061 232.632Z",fill:"white"}),Cq("path",{d:"M57.6531 168.341L57.1006 166.24L54.9996 166.793L55.5521 168.894L57.6531 168.341Z",fill:"white"}),Cq("path",{d:"M103.489 244.345L101.345 244L101 246.145L103.144 246.49L103.489 244.345Z",fill:"white"}),Cq("path",{d:"M341.286 111.905L341.905 110.619L340.619 110L340 111.286L341.286 111.905Z",fill:"white"}),Cq("path",{d:"M323.144 179.08L322.592 176.979L320.491 177.531L321.043 179.632L323.144 179.08Z",fill:"white"}),Cq("path",{d:"M328.919 177.658L329.538 176.372L328.252 175.753L327.633 177.039L328.919 177.658Z",fill:"white"}),Cq("path",{d:"M88.1441 141.383L87.2188 140.296L86.1321 141.221L87.0574 142.308L88.1441 141.383Z",fill:"white"}),Cq("path",{d:"M258.286 89.9052L258.905 88.6191L257.619 88L257 89.2861L258.286 89.9052Z",fill:"white"})]})})})}function m8e({data:e}){const{t:t}=_ke(),{swapState:{allowedTokens:n}}=uV.useContext(X6e),{connectLoaderState:r}=uV.useContext(jRe),{checkout:i,provider:a}=r,{viewDispatch:o}=uV.useContext(ERe),{eventTargetState:{eventTarget:s}}=uV.useContext(zqe),c=fNe(a),[u,l]=uV.useState(!1),[d,f]=uV.useState(!1),[p,h]=uV.useState(!1),[m,y]=uV.useState(!1),[b,g]=uV.useState(!1),[v,w]=uV.useState(!1),{page:T,track:E}=OPe();uV.useEffect((()=>{T({userJourney:bPe.SWAP,screen:"ApproveERC20",extras:{swapFormInfo:e.swapFormInfo}})}),[]);const A=uV.useMemo((()=>n.find((t=>t.address===e.swapFormInfo.fromTokenAddress))),[n,e.swapFormInfo.fromTokenAddress]),x=uV.useCallback((()=>{o({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.ERROR_VIEW,error:new Error("No checkout object or no provider object found")}}})}),[o]),O=uV.useCallback((()=>{o({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.SWAP,data:e.swapFormInfo}}})}),[o]),C=(e,t)=>{e.type!==uW.UNPREDICTABLE_GAS_LIMIT?e.type===uW.TRANSACTION_FAILED||e.type===uW.INSUFFICIENT_FUNDS||e.receipt&&0===e.receipt.status?o({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.FAIL,reason:"Transaction failed",data:t}}}):(console.error("Approve ERC20 failed",e),o({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.ERROR_VIEW,error:e}}})):o({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.PRICE_SURGE,data:t}}})},I=(e,t=!1)=>({...e,gasPrice:t?jr.from(0):void 0}),_=uV.useCallback((async()=>{if(!m)if(E({userJourney:bPe.SWAP,screen:"ApproveERC20",control:"ApproveSpending",controlType:"Button"}),y(!0),i&&a){if(!u){l(!0);try{const t=await i.sendTransaction({provider:a,transaction:I(e.approveTransaction,c)});f(!0);if(1!==(await t.transactionResponse.wait()).status)return void o({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.FAIL,data:e.swapFormInfo}}});f(!1),l(!1),h(!0)}catch(t){if(f(!1),l(!1),t.type===uW.USER_REJECTED_REQUEST_ERROR)return void g(!0);C(t,e.swapFormInfo)}finally{y(!1)}}}else x()}),[i,a,x,o,w,e.approveTransaction,e.swapFormInfo,u,l,f]),P=uV.useMemo((()=>Iq(RRe,{heading:t(`views.APPROVE_ERC20.approveSpending.content.${c?"passport":"metamask"}.heading`),children:[c&&Cq(N3,{children:t("views.APPROVE_ERC20.approveSpending.content.passport.body")}),!c&&Cq(N3,{children:t("views.APPROVE_ERC20.approveSpending.content.metamask.body",{amount:`${e.swapFormInfo.fromAmount} ${A?.symbol||""}`})})]})),[e.swapFormInfo,A,c]),S=uV.useMemo((()=>Cq(yRe,{loading:m,actionText:t(b?"views.APPROVE_ERC20.approveSpending.footer.retryText":"views.APPROVE_ERC20.approveSpending.footer.buttonText"),onActionClick:_})),[b,_,m]),k=uV.useCallback((async()=>{if(!m)if(E({userJourney:bPe.SWAP,screen:"ApproveERC20",control:"ApproveSwap",controlType:"Button"}),y(!0),i&&a){if(!u){l(!0);try{const t=await i.sendTransaction({provider:a,transaction:I(e.transaction,c)});l(!1),o({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.IN_PROGRESS,data:{transactionResponse:t.transactionResponse,swapForm:e.swapFormInfo}}}})}catch(t){if(l(!1),t.type===uW.USER_REJECTED_REQUEST_ERROR)return void w(!0);C(t,e.swapFormInfo)}finally{y(!1)}}}else x()}),[i,a,x,o,w,e.transaction,e.swapFormInfo,u,l]),R=Cq(RRe,{heading:t("views.APPROVE_ERC20.approveSwap.content.heading"),children:Cq(N3,{children:t("views.APPROVE_ERC20.approveSwap.content.body")})}),N=uV.useMemo((()=>Cq(yRe,{loading:m,actionText:t(v?"views.APPROVE_ERC20.approveSwap.footer.retryText":"views.APPROVE_ERC20.approveSwap.footer.buttonText"),onActionClick:k})),[v,k,m]);return Iq(Oq,{children:[d&&Cq(PPe,{loadingText:t("views.APPROVE_ERC20.approveSpending.loading.text")}),!d&&Cq(_Pe,{header:Cq(xRe,{transparent:!0,showBack:!0,onCloseButtonClick:()=>eKe(s),onBackButtonClick:O}),floatHeader:!0,heroContent:Cq(p?h8e:p8e,{}),footer:p?N:S,children:p?R:P})]})}var y8e;!function(e){e.WALLET_NETWORK_SELECTION="WALLET_NETWORK_SELECTION",e.BRIDGE_FORM="BRIDGE_FORM",e.BRIDGE_REVIEW="BRIDGE_REVIEW",e.IN_PROGRESS="IN_PROGRESS",e.BRIDGE_FAILURE="BRIDGE_FAILURE",e.APPROVE_TRANSACTION="APPROVE_TRANSACTION",e.TRANSACTIONS="TRANSACTIONS",e.CLAIM_WITHDRAWAL="CLAIM_WITHDRAWAL",e.CLAIM_WITHDRAWAL_IN_PROGRESS="CLAIM_WITHDRAWAL_IN_PROGRESS",e.CLAIM_WITHDRAWAL_SUCCESS="CLAIM_WITHDRAWAL_SUCCESS",e.CLAIM_WITHDRAWAL_FAILURE="CLAIM_WITHDRAWAL_FAILURE"}(y8e||(y8e={}));const b8e=(e,t,n)=>{const r=uV.useRef(!1);uV.useEffect((()=>{r.current||("function"!=typeof t||t())&&(e(),r.current=!0)}),n||[])};const g8e=e=>{const{minPercentage:t,maxPercentage:n}=e;return void 0===t||void 0===n?"-.--":`${t}% to ${n}`},v8e=(e,t)=>{const{fees:n,token:r}=e;if(void 0===n.totalFees)return"-.--";if(void 0===r)return"-.--";const i=((e,t,n)=>{let r=-1;if(e&&t){const i=Xd(e,t.decimals),a=n.get(t.symbol.toLocaleLowerCase());if(a){const e=parseFloat(i);if(Number.isNaN(e))return r;r=e*a}}return r})(n.totalFees,r,t);return i<0?"-.--":function(e){if(e<0)return"-.--";const t=e.toString();if(t.includes("e")||0===e)return"0.00";if(e<.01)for(let n=0;n<t.length;n++)if("0"!==t[n]&&"."!==t[n])return e.toFixed(n-1);return e.toFixed(2)}(i)};var w8e;function T8e({testId:e,icon:t,iconVariant:n,intentIcon:r,heading:i,caption:a,onClick:o,renderFeeFunction:s,isDisabled:c}){return Cq(N3,{testId:"top-up-view",sx:{paddingY:"1px"},children:Iq(oae,{testId:`menu-item-${e}`,size:"small",emphasized:!0,onClick:c?void 0:o,sx:c?{opacity:"0.5",cursor:"not-allowed"}:{},children:[Cq(oae.Icon,{icon:t,variant:n}),Cq(oae.Label,{size:"medium",children:i}),Cq(oae.IntentIcon,{icon:r}),Iq(oae.Caption,{testId:`menu-item-caption-${e}`,children:[a,Cq("br",{}),c?"":s("-.--",!1)]})]})})}!function(e){e.ONRAMP="ONRAMP",e.IN_PROGRESS_LOADING="IN_PROGRESS_LOADING",e.IN_PROGRESS="IN_PROGRESS",e.SUCCESS="SUCCESS",e.FAIL="FAIL"}(w8e||(w8e={}));const E8e={[Xt.SANDBOX]:"https://checkout-playground.sandbox.immutable.com",[Xt.PRODUCTION]:"https://toolkit.immutable.com"};function A8e({widgetEvent:e,checkout:t,provider:n,showOnrampOption:r,showSwapOption:i,showBridgeOption:a,tokenAddress:o,amount:s,analytics:c,onCloseButtonClick:u,onBackButtonClick:l,heading:d,subheading:f}){const{t:p}=_ke(),{userJourney:h}=c,{viewDispatch:m}=uV.useContext(ERe),{cryptoFiatState:y,cryptoFiatDispatch:b}=uV.useContext($6e),{conversions:g,fiatSymbol:v}=y,w=t?.config.environment??Xt.SANDBOX,{eventTargetState:{eventTarget:T}}=uV.useContext(zqe),[E,A]=uV.useState("-.--"),[,x]=uV.useState("-.--"),[O,C]=uV.useState(!0),I=d?p(...d):p("views.TOP_UP_VIEW.header.title"),_=f?p(...f):null,{page:P,track:S}=OPe();b8e((()=>{P({userJourney:h,screen:"TopUp"})})),uV.useEffect((()=>{b&&b({payload:{type:Q6e.SET_TOKEN_SYMBOLS,tokenSymbols:l8e}})}),[b]),uV.useEffect((()=>{t&&(async()=>{const e=await t.gasEstimate({gasEstimateType:XH.BRIDGE_TO_L2}),n=await v8e(e,g);x(n)})()}),[void 0!==t]),uV.useEffect((()=>{t&&(async()=>{const e=await t.getExchangeFeeEstimate(),n=g8e(e);A(n)})()}),[void 0!==t]),uV.useEffect((()=>{t&&(async()=>{C(await t.isSwapAvailable())})()}),[void 0!==t]);const k=(e,t,n="Button")=>{S({userJourney:h,screen:"TopUp",control:e,controlType:n,extras:t})},R=()=>{if(e===kH.IMTBL_ONRAMP_WIDGET_EVENT){const t={tokenAddress:"",amount:""};return m({payload:{type:TRe.UPDATE_VIEW,view:{type:w8e.ONRAMP,data:t}}}),void k("OnRamp",{...t,widgetEvent:e})}const t={tokenAddress:o??"",amount:s??""};$qe.sendRequestOnrampEvent(T,e,t),k("OnRamp",{...t,widgetEvent:e})},N=e=>Cq(N3,{sx:{fontSize:"base.text.caption.small.regular.fontSize",c:"base.color.translucent.standard.600"},children:e}),M=[{testId:"onramp",icon:"BankCard",iconVariant:"bold",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.debit",onClickEvent:R,fee:()=>N(`${p("views.TOP_UP_VIEW.topUpOptions.debit.subcaption")} ≈ ${E}%`),isAvailable:!0,isEnabled:r},{testId:"onramp",icon:"BankCard",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.credit",onClickEvent:R,fee:()=>N(`${p("views.TOP_UP_VIEW.topUpOptions.credit.subcaption")} ≈ ${E}%`),isAvailable:!0,isEnabled:r},{testId:"advanced",icon:"Minting",iconVariant:"bold",intentIcon:"JumpTo",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.advanced",onClickEvent:()=>{const t=E8e[w];k("AdvancedOptions",{...{tokenAddress:o??"",amount:s??""},widgetEvent:e}),window.open(`${t}/faster-bridge/`,"_blank")},fee:()=>N(""),isAvailable:!0,isEnabled:!0},{testId:"swap",icon:"Swap",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.swap",onClickEvent:()=>{if(e===kH.IMTBL_SWAP_WIDGET_EVENT){const t={toTokenAddress:"",fromAmount:"",fromTokenAddress:""};return m({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.SWAP,data:t}}}),void k("Swap",{...t,widgetEvent:e})}const t={fromTokenAddress:"",toTokenAddress:o??"",amount:""};$qe.sendRequestSwapEvent(T,e,t),k("Swap",{...t,widgetEvent:e})},fee:()=>N(`${p("views.TOP_UP_VIEW.topUpOptions.swap.subcaption")} ≈ $0.05 ${v.toUpperCase()}`),isAvailable:O,isEnabled:i},{testId:"bridge",icon:"ArrowForward",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.bridge",onClickEvent:()=>{if(e===kH.IMTBL_BRIDGE_WIDGET_EVENT){const t={fromTokenAddress:"",fromAmount:""};return m({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.WALLET_NETWORK_SELECTION,data:t}}}),void k("Bridge",{...t,widgetEvent:e})}const t={tokenAddress:"",amount:""};$qe.sendRequestBridgeEvent(T,e,t),k("Bridge",{...t,widgetEvent:e})},fee:()=>N(""),isAvailable:!0,isEnabled:a}];return Cq(_Pe,{header:Cq(xRe,{onBackButtonClick:l,onCloseButtonClick:u,showBack:!0}),children:Iq(N3,{sx:{paddingX:"base.spacing.x4",paddingY:"base.spacing.x4"},children:[Cq(qee,{size:"small",children:I}),_&&Cq(tee,{size:"small",sx:{color:"base.color.text.body.secondary"},children:_}),Cq(N3,{sx:{paddingY:"base.spacing.x4"},children:M.sort(((e,t)=>Number(t.isAvailable)-Number(e.isAvailable))).map((e=>e.isEnabled&&Cq(T8e,{testId:e.testId,icon:e.icon,iconVariant:e.iconVariant,intentIcon:e.intentIcon,heading:p(`${e.textConfigKey}.heading`),caption:e.isAvailable?p(`${e.textConfigKey}.caption`):p(`${e.textConfigKey}.disabledCaption`),onClick:e.onClickEvent,renderFeeFunction:e.fee,isDisabled:!e.isAvailable},p(`${e.textConfigKey}.heading`).toLowerCase())))})]})})}const x8e=async(e,{retries:t,retryIntervalMs:n,nonRetryable:r,nonRetryableSilently:i})=>{let a=t;try{return await e()}catch(t){if(i&&i(t))return;if(r&&r(t))throw t;if(void 0!==a){if(a<=0)throw t;a-=1}return await((e=0)=>e&&new Promise((t=>setTimeout(t,e))))(n),x8e(e,{retries:a,retryIntervalMs:n,nonRetryable:r,nonRetryableSilently:i})}},O8e=async({checkout:e,provider:t,allowTokenListType:n,chainId:r,allowZero:i=!1,retryPolicy:a=Uke})=>{const o=r||(await e.getNetworkInfo({provider:t})).chainId,s=await t.getSigner().getAddress(),c=await x8e((()=>e.getAllBalances({provider:t,walletAddress:s,chainId:o})),{...a});if(void 0===c)return;const u=await e.getTokenAllowList({chainId:o,type:n}),l=new Map;u.tokens.forEach((e=>l.set(e.address?.toLowerCase()||Nke,!0)));const d=c.balances.filter((e=>!(e.balance.lte(0)&&!i)&&l.get(e.token.address?.toLowerCase()||Nke))).map((t=>({...t,token:{...t.token,icon:JRe(e.config.environment,KRe(t.token.address)?t.token.symbol:t.token.address??"")}})))??[];return u.tokens=u.tokens.map((t=>({...t,icon:JRe(e.config.environment,KRe(t.address)?t.symbol:t.address??"")}))),{allowList:u,allowedBalances:d}};function C8e({amount:e,fromTokenAddress:t,toTokenAddress:n,config:r}){const{t:i}=_ke(),{eventTargetState:{eventTarget:a}}=uV.useContext(zqe),{environment:o,theme:s,isOnRampEnabled:c,isSwapEnabled:u,isBridgeEnabled:l}=r,{connectLoaderState:{checkout:d,provider:f}}=uV.useContext(jRe),[p,h]=uV.useReducer(ARe,{...wRe,history:[]}),[m,y]=uV.useReducer(Y6e,q6e),{page:b}=OPe(),[g,v]=uV.useState(!1),w=uV.useMemo((()=>({swapState:m,swapDispatch:y})),[m,y]),T=uV.useMemo((()=>({viewState:p,viewDispatch:h})),[p,h]),E=uV.useCallback(((e,t)=>{h({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.ERROR_VIEW,tryAgain:t,error:e}}})}),[h]),A=uV.useCallback((()=>{h({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.SWAP}}})}),[h]),x=uV.useCallback((async()=>{if(!d)throw new Error("loadBalances: missing checkout");if(!f)throw new Error("loadBalances: missing provider");try{const e=await O8e({checkout:d,provider:f,allowTokenListType:ZH.SWAP});if(void 0===e)return!1;y({payload:{type:K6e.SET_ALLOWED_TOKENS,allowedTokens:e.allowList.tokens}}),y({payload:{type:K6e.SET_TOKEN_BALANCES,tokenBalances:e.allowedBalances}})}catch(e){if(Uke.nonRetryable(e))return E(e,x),!1}return!0}),[d,f]);return uV.useEffect((()=>{(async()=>{if(!d||!f)return;const e=await d.getNetworkInfo({provider:f});if(e.chainId!==Qke(d.config))return;let t;try{t=await d.config.remote.getConfig("dex")}catch(e){return void E(e)}const n=new hC({chainId:e.chainId,baseConfig:new Zt({environment:o}),secondaryFees:t.secondaryFees,overrides:t.overrides});y({payload:{type:K6e.SET_EXCHANGE,exchange:n}}),y({payload:{type:K6e.SET_NETWORK,network:e}}),await x()&&p.view.type===vRe.LOADING_VIEW&&A()})()}),[d,f]),Cq(ERe.Provider,{value:T,children:Cq(X6e.Provider,{value:w,children:Iq(d8e,{environment:o,children:[p.view.type===vRe.LOADING_VIEW&&Cq(PPe,{loadingText:i("views.LOADING_VIEW.text")}),p.view.type===x2e.SWAP&&Cq(a8e,{theme:s,fromAmount:p.view.data?.fromAmount??e,fromTokenAddress:p.view.data?.fromTokenAddress??t,toTokenAddress:p.view.data?.toTokenAddress??n}),p.view.type===x2e.IN_PROGRESS&&Cq(f8e,{transactionResponse:p.view.data.transactionResponse,swapForm:p.view.data.swapForm}),p.view.type===x2e.APPROVE_ERC20&&Cq(m8e,{data:p.view.data}),p.view.type===x2e.SUCCESS&&Cq(Lqe,{statusText:i("views.SWAP.success.text"),actionText:i("views.SWAP.success.actionText"),onRenderEvent:()=>{b({userJourney:bPe.SWAP,screen:"SwapSuccess",extras:{fromTokenAddress:p.view.data?.fromTokenAddress,fromAmount:p.view.data?.fromAmount,toTokenAddress:p.view.data?.toTokenAddress,toAmount:p.view.data?.toAmount}}),tKe(a,p.view.data.transactionHash)},onActionClick:()=>eKe(a),statusType:_qe.SUCCESS,testId:"success-view"}),p.view.type===x2e.FAIL&&Cq(Lqe,{statusText:i("views.SWAP.failed.text"),actionText:i("views.SWAP.failed.actionText"),onRenderEvent:()=>{b({userJourney:bPe.SWAP,screen:"SwapFailed"}),nKe(a,"Transaction failed")},onActionClick:()=>{p.view.type===x2e.FAIL&&h({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.SWAP,data:p.view.data}}})},statusType:_qe.FAILURE,onCloseClick:()=>eKe(a),testId:"fail-view"}),p.view.type===x2e.PRICE_SURGE&&Cq(Lqe,{statusText:i("views.SWAP.rejected.text"),actionText:i("views.SWAP.rejected.actionText"),onRenderEvent:()=>{b({userJourney:bPe.SWAP,screen:"PriceSurge"}),rKe(a,"Price surge")},onActionClick:()=>{p.view.type===x2e.PRICE_SURGE&&h({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.SWAP,data:p.view.data}}})},statusType:_qe.WARNING,onCloseClick:()=>eKe(a),testId:"price-surge-view"}),p.view.type===vRe.ERROR_VIEW&&Cq(NRe,{actionText:i("views.ERROR_VIEW.actionText"),onActionClick:async()=>{v(!0);const e=p.view;if(!e.tryAgain)return A(),void v(!1);await e.tryAgain()&&A(),v(!1)},onCloseClick:()=>eKe(a),errorEventActionLoading:g}),p.view.type===vRe.TOP_UP_VIEW&&Cq(A8e,{analytics:{userJourney:bPe.SWAP},checkout:d,provider:f,widgetEvent:kH.IMTBL_SWAP_WIDGET_EVENT,showOnrampOption:c,showSwapOption:u,showBridgeOption:l,onCloseButtonClick:()=>eKe(a)})]})})})}var I8e=Object.freeze({__proto__:null,default:C8e}),_8e=2147483647,P8e=36,S8e=1,k8e=26,R8e=38,N8e=700,M8e=72,D8e=128,L8e="-",j8e=/[^\x20-\x7E]/,F8e=/[\x2E\u3002\uFF0E\uFF61]/g,B8e={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},U8e=P8e-S8e,z8e=Math.floor,H8e=String.fromCharCode;
|
|
932
|
-
/*! https://mths.be/punycode v1.4.1 by @mathias */function W8e(e){throw new RangeError(B8e[e])}function V8e(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function G8e(e,t,n){var r=0;for(e=n?z8e(e/N8e):e>>1,e+=z8e(e/t);e>U8e*k8e>>1;r+=P8e)e=z8e(e/U8e);return z8e(r+(U8e+1)*e/(e+R8e))}function q8e(e){return function(e,t){var n=e.split("@"),r="";n.length>1&&(r=n[0]+"@",e=n[1]);var i=function(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}((e=e.replace(F8e,".")).split("."),t).join(".");return r+i}(e,(function(e){return j8e.test(e)?"xn--"+function(e){var t,n,r,i,a,o,s,c,u,l,d,f,p,h,m,y=[];for(e=function(e){for(var t,n,r=[],i=0,a=e.length;i<a;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<a?56320==(64512&(n=e.charCodeAt(i++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),i--):r.push(t);return r}(e),f=e.length,t=D8e,n=0,a=M8e,o=0;o<f;++o)(d=e[o])<128&&y.push(H8e(d));for(r=i=y.length,i&&y.push(L8e);r<f;){for(s=_8e,o=0;o<f;++o)(d=e[o])>=t&&d<s&&(s=d);for(s-t>z8e((_8e-n)/(p=r+1))&&W8e("overflow"),n+=(s-t)*p,t=s,o=0;o<f;++o)if((d=e[o])<t&&++n>_8e&&W8e("overflow"),d==t){for(c=n,u=P8e;!(c<(l=u<=a?S8e:u>=a+k8e?k8e:u-a));u+=P8e)m=c-l,h=P8e-l,y.push(H8e(V8e(l+m%h,0))),c=z8e(m/h);y.push(H8e(V8e(c,0))),a=G8e(n,p,r==i),n=0,++r}++n,++t}return y.join("")}(e):e}))}function K8e(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var X8e=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function Y8e(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}}function Z8e(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var J8e=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t};function Q8e(e,t,n,r){t=t||"&",n=n||"=";var i={};if("string"!=typeof e||0===e.length)return i;var a=/\+/g;e=e.split(t);var o=1e3;r&&"number"==typeof r.maxKeys&&(o=r.maxKeys);var s=e.length;o>0&&s>o&&(s=o);for(var c=0;c<s;++c){var u,l,d,f,p=e[c].replace(a,"%20"),h=p.indexOf(n);h>=0?(u=p.substr(0,h),l=p.substr(h+1)):(u=p,l=""),d=decodeURIComponent(u),f=decodeURIComponent(l),K8e(i,d)?X8e(i[d])?i[d].push(f):i[d]=[i[d],f]:i[d]=f}return i}var $8e={parse:h3e,resolve:function(e,t){return h3e(e,!1,!0).resolve(t)},resolveObject:function(e,t){return e?h3e(e,!1,!0).resolveObject(t):t},fileURLToPath:function(e){if("string"==typeof e)e=(new e3e).parse(e);else if(!(e instanceof e3e))throw new TypeError('The "path" argument must be of type string or an instance of URL. Received type '+typeof e+String(e));if("file:"!==e.protocol)throw new TypeError("The URL must be of scheme file");return function(e){const t=e.pathname;for(let e=0;e<t.length;e++)if("%"===t[e]){const n=32|t.codePointAt(e+2);if("2"===t[e+1]&&102===n)throw new TypeError("must not include encoded / characters")}return decodeURIComponent(t)}(e)},format:function(e){fv(e)&&(e=m3e({},e));return y3e(e)},Url:e3e,URL:Qt.URL,URLSearchParams:Qt.URLSearchParams};function e3e(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var t3e=/^([a-z0-9.+-]+:)/i,n3e=/:[0-9]*$/,r3e=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,i3e=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),a3e=["'"].concat(i3e),o3e=["%","/","?",";","#"].concat(a3e),s3e=["/","?","#"],c3e=255,u3e=/^[+a-z0-9A-Z_-]{0,63}$/,l3e=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,d3e={javascript:!0,"javascript:":!0},f3e={javascript:!0,"javascript:":!0},p3e={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function h3e(e,t,n){if(e&&mv(e)&&e instanceof e3e)return e;var r=new e3e;return r.parse(e,t,n),r}function m3e(e,t,n,r){if(!fv(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),a=-1!==i&&i<t.indexOf("#")?"?":"#",o=t.split(a);o[0]=o[0].replace(/\\/g,"/");var s=t=o.join(a);if(s=s.trim(),!r&&1===t.split("#").length){var c=r3e.exec(s);if(c)return e.path=s,e.href=s,e.pathname=c[1],c[2]?(e.search=c[2],e.query=n?Q8e(e.search.substr(1)):e.search.substr(1)):n&&(e.search="",e.query={}),e}var u,l,d,f,p=t3e.exec(s);if(p){var h=(p=p[0]).toLowerCase();e.protocol=h,s=s.substr(p.length)}if(r||p||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var m="//"===s.substr(0,2);!m||p&&f3e[p]||(s=s.substr(2),e.slashes=!0)}if(!f3e[p]&&(m||p&&!p3e[p])){var y,b,g=-1;for(u=0;u<s3e.length;u++)-1!==(l=s.indexOf(s3e[u]))&&(-1===g||l<g)&&(g=l);for(-1!==(b=-1===g?s.lastIndexOf("@"):s.lastIndexOf("@",g))&&(y=s.slice(0,b),s=s.slice(b+1),e.auth=decodeURIComponent(y)),g=-1,u=0;u<o3e.length;u++)-1!==(l=s.indexOf(o3e[u]))&&(-1===g||l<g)&&(g=l);-1===g&&(g=s.length),e.host=s.slice(0,g),s=s.slice(g),b3e(e),e.hostname=e.hostname||"";var v="["===e.hostname[0]&&"]"===e.hostname[e.hostname.length-1];if(!v){var w=e.hostname.split(/\./);for(u=0,d=w.length;u<d;u++){var T=w[u];if(T&&!T.match(u3e)){for(var E="",A=0,x=T.length;A<x;A++)T.charCodeAt(A)>127?E+="x":E+=T[A];if(!E.match(u3e)){var O=w.slice(0,u),C=w.slice(u+1),I=T.match(l3e);I&&(O.push(I[1]),C.unshift(I[2])),C.length&&(s="/"+C.join(".")+s),e.hostname=O.join(".");break}}}}e.hostname.length>c3e?e.hostname="":e.hostname=e.hostname.toLowerCase(),v||(e.hostname=q8e(e.hostname)),f=e.port?":"+e.port:"";var _=e.hostname||"";e.host=_+f,e.href+=e.host,v&&(e.hostname=e.hostname.substr(1,e.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!d3e[h])for(u=0,d=a3e.length;u<d;u++){var P=a3e[u];if(-1!==s.indexOf(P)){var S=encodeURIComponent(P);S===P&&(S=escape(P)),s=s.split(P).join(S)}}var k=s.indexOf("#");-1!==k&&(e.hash=s.substr(k),s=s.slice(0,k));var R=s.indexOf("?");if(-1!==R?(e.search=s.substr(R),e.query=s.substr(R+1),n&&(e.query=Q8e(e.query)),s=s.slice(0,R)):n&&(e.search="",e.query={}),s&&(e.pathname=s),p3e[h]&&e.hostname&&!e.pathname&&(e.pathname="/"),e.pathname||e.search){f=e.pathname||"";var N=e.search||"";e.path=f+N}return e.href=y3e(e),e}function y3e(e){var t=e.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var n=e.protocol||"",r=e.pathname||"",i=e.hash||"",a=!1,o="";e.host?a=t+e.host:e.hostname&&(a=t+(-1===e.hostname.indexOf(":")?e.hostname:"["+this.hostname+"]"),e.port&&(a+=":"+e.port)),e.query&&mv(e.query)&&Object.keys(e.query).length&&(o=function(e,t,n,r){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?Z8e(J8e(e),(function(r){var i=encodeURIComponent(Y8e(r))+n;return X8e(e[r])?Z8e(e[r],(function(e){return i+encodeURIComponent(Y8e(e))})).join(t):i+encodeURIComponent(Y8e(e[r]))})).join(t):r?encodeURIComponent(Y8e(r))+n+encodeURIComponent(Y8e(e)):""}(e.query));var s=e.search||o&&"?"+o||"";return n&&":"!==n.substr(-1)&&(n+=":"),e.slashes||(!n||p3e[n])&&!1!==a?(a="//"+(a||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):a||(a=""),i&&"#"!==i.charAt(0)&&(i="#"+i),s&&"?"!==s.charAt(0)&&(s="?"+s),r=r.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})),n+a+r+(s=s.replace("#","%23"))+i}function b3e(e){var t=e.host,n=n3e.exec(t);n&&(":"!==(n=n[0])&&(e.port=n.substr(1)),t=t.substr(0,t.length-n.length)),t&&(e.hostname=t)}e3e.prototype.parse=function(e,t,n){return m3e(this,e,t,n)},e3e.prototype.format=function(){return y3e(this)},e3e.prototype.resolve=function(e){return this.resolveObject(h3e(e,!1,!0)).format()},e3e.prototype.resolveObject=function(e){if(fv(e)){var t=new e3e;t.parse(e,!1,!0),e=t}for(var n,r=new e3e,i=Object.keys(this),a=0;a<i.length;a++){var o=i[a];r[o]=this[o]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var s=Object.keys(e),c=0;c<s.length;c++){var u=s[c];"protocol"!==u&&(r[u]=e[u])}return p3e[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!p3e[e.protocol]){for(var l=Object.keys(e),d=0;d<l.length;d++){var f=l[d];r[f]=e[f]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||f3e[e.protocol])r.pathname=e.pathname;else{for(n=(e.pathname||"").split("/");n.length&&!(e.host=n.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==n[0]&&n.unshift(""),n.length<2&&n.unshift(""),r.pathname=n.join("/")}if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var p=r.pathname||"",h=r.search||"";r.path=p+h}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var m,y=r.pathname&&"/"===r.pathname.charAt(0),b=e.host||e.pathname&&"/"===e.pathname.charAt(0),g=b||y||r.host&&e.pathname,v=g,w=r.pathname&&r.pathname.split("/")||[],T=r.protocol&&!p3e[r.protocol];if(n=e.pathname&&e.pathname.split("/")||[],T&&(r.hostname="",r.port=null,r.host&&(""===w[0]?w[0]=r.host:w.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===n[0]?n[0]=e.host:n.unshift(e.host)),e.host=null),g=g&&(""===n[0]||""===w[0])),b)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,w=n;else if(n.length)w||(w=[]),w.pop(),w=w.concat(n),r.search=e.search,r.query=e.query;else if(null!=e.search)return T&&(r.hostname=r.host=w.shift(),(m=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=m.shift(),r.host=r.hostname=m.shift())),r.search=e.search,r.query=e.query,dv(r.pathname)&&dv(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!w.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var E=w.slice(-1)[0],A=(r.host||e.host||w.length>1)&&("."===E||".."===E)||""===E,x=0,O=w.length;O>=0;O--)"."===(E=w[O])?w.splice(O,1):".."===E?(w.splice(O,1),x++):x&&(w.splice(O,1),x--);if(!g&&!v)for(;x--;x)w.unshift("..");!g||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),A&&"/"!==w.join("/").substr(-1)&&w.push("");var C=""===w[0]||w[0]&&"/"===w[0].charAt(0);return T&&(r.hostname=r.host=C?"":w.length?w.shift():"",(m=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=m.shift(),r.host=r.hostname=m.shift())),(g=g||r.host&&w.length)&&!C&&w.unshift(""),w.length?r.pathname=w.join("/"):(r.pathname=null,r.path=null),dv(r.pathname)&&dv(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},e3e.prototype.parseHost=function(){return b3e(this)};const g3e=e=>({position:"relative",maxWidth:"420px",height:"565px",borderRadius:"base.borderRadius.x6",overflow:"hidden",marginLeft:"base.spacing.x2",marginRight:"base.spacing.x2",marginBottom:"base.spacing.x2",display:e?"block":"none"}),v3e=e=>({display:e?"block":"none"});var w3e,T3e,E3e,A3e;!function(e){e.TRANSAK_WIDGET_OPEN="TRANSAK_WIDGET_OPEN",e.TRANSAK_ORDER_CREATED="TRANSAK_ORDER_CREATED",e.TRANSAK_ORDER_SUCCESSFUL="TRANSAK_ORDER_SUCCESSFUL",e.TRANSAK_ORDER_FAILED="TRANSAK_ORDER_FAILED"}(w3e||(w3e={})),function(e){e.PROCESSING="PROCESSING",e.COMPLETED="COMPLETED"}(T3e||(T3e={})),function(e){e.TRANSAK_WIDGET_INITIALISED="TRANSAK_WIDGET_INITIALISED",e.TRANSAK_WIDGET_OPEN="TRANSAK_WIDGET_OPEN",e.TRANSAK_ORDER_CREATED="TRANSAK_ORDER_CREATED",e.TRANSAK_ORDER_SUCCESSFUL="TRANSAK_ORDER_SUCCESSFUL",e.TRANSAK_ORDER_FAILED="TRANSAK_ORDER_FAILED"}(E3e||(E3e={})),function(e){e.PROCESSING="PROCESSING",e.COMPLETED="COMPLETED"}(A3e||(A3e={}));const x3e=["global.transak.com","global-stg.transak.com"],O3e={[E3e.TRANSAK_WIDGET_OPEN]:{screen:"InputScreen",control:"TransakWidgetOpen",controlType:"IframeEvent"},[E3e.TRANSAK_ORDER_CREATED]:{screen:"InputScreen",control:"OrderCreated",controlType:"IframeEvent"},[`${E3e.TRANSAK_ORDER_SUCCESSFUL}${A3e.PROCESSING}`]:{screen:"OrderInProgress",control:"PaymentProcessing",controlType:"IframeEvent"},[`${E3e.TRANSAK_ORDER_SUCCESSFUL}${A3e.COMPLETED}`]:{screen:"Success",control:"PaymentCompleted",controlType:"IframeEvent"},[E3e.TRANSAK_ORDER_FAILED]:{screen:"Failure",control:"PaymentFailed",controlType:"IframeEvent"}},C3e=e=>{const{track:t}=OPe(),{userJourney:n,ref:r,walletAddress:i,isPassportWallet:a,failedToLoadTimeoutInMs:o,onFailedToLoad:s}=e,[c,u]=uV.useState(!1),l=o||1e4,d=uV.useRef(void 0),f=uV.useCallback((e=>{const r=e.event_id,o=[E3e.TRANSAK_ORDER_SUCCESSFUL].includes(r)?`${r}${e.data.status}`:r,s=O3e?.[o]||{};Object.keys(s).length>=0&&t({...s,userJourney:n,extras:{walletAddress:i,isPassportWallet:a}})}),[]),p=uV.useCallback((t=>{switch(t.event_id){case E3e.TRANSAK_WIDGET_INITIALISED:(t=>{u(!0),clearTimeout(d.current),d.current=void 0,e.onInit?.(t)})(t.data);break;case E3e.TRANSAK_WIDGET_OPEN:e.onOpen?.(t.data);break;case E3e.TRANSAK_ORDER_CREATED:e.onOrderCreated?.(t.data);break;case E3e.TRANSAK_ORDER_SUCCESSFUL:t.data.status===A3e.PROCESSING&&e.onOrderProcessing?.(t.data),t.data.status===A3e.COMPLETED&&e.onOrderCompleted?.(t.data);break;case E3e.TRANSAK_ORDER_FAILED:e.onOrderFailed?.(t.data)}}),[]),h=uV.useCallback((e=>{const t=h3e(e.origin)?.host?.toLowerCase();e.source===r?.current?.contentWindow&&t&&x3e.includes(t)&&(f(e.data),p(e.data),console.log("@@@ Transak event",e))}),[r]);return uV.useEffect((()=>(window.addEventListener("message",h),()=>{clearTimeout(d.current),window.removeEventListener("message",h)})),[]),{initialised:c,onLoad:()=>{void 0!==s&&(void 0!==d.current||c||(d.current=setTimeout((()=>{c||s()}),l)))}}},I3e="transak-iframe",_3e=6e3;function P3e({passport:e,showIframe:t,tokenAmount:n,tokenAddress:r}){const{connectLoaderState:i}=uV.useContext(jRe),{checkout:a,provider:o}=i,{eventTargetState:{eventTarget:s}}=uV.useContext(zqe),{t:c}=_ke(),{viewState:u,viewDispatch:l}=uV.useContext(ERe),[d,f]=uV.useState(""),p=uV.useRef(),h=!!e&&o?.provider?.isPassport,m=uV.useMemo((()=>u.history.length>2&&u.history[u.history.length-2].type===vRe.TOP_UP_VIEW),[u.history]),{track:y}=OPe();return uV.useEffect((()=>{if(!a||!o)return;let t="";(async()=>{const i={exchangeType:cW.ONRAMP,web3Provider:o,tokenAddress:r,tokenAmount:n,passport:e};f(await a.createFiatRampUrl(i)),t=await o.getSigner().getAddress()})();const i=document.getElementById(I3e);if(!i)return;window.addEventListener("message",(e=>{if(!i)return;const a=$8e.parse(e.origin)?.host?.toLowerCase();e.source===i.contentWindow&&a&&x3e.includes(a)&&((async(e,t)=>{const n={userId:t.toLowerCase(),isPassportWallet:h};switch(e.event_id){case w3e.TRANSAK_WIDGET_OPEN:y({userJourney:bPe.ON_RAMP,screen:"InputScreen",control:"TransakWidgetOpen",controlType:"IframeEvent",extras:{...n}});break;case w3e.TRANSAK_ORDER_CREATED:y({userJourney:bPe.ON_RAMP,screen:"InputScreen",control:"OrderCreated",controlType:"IframeEvent",extras:{...n}});break;case w3e.TRANSAK_ORDER_SUCCESSFUL:e.data.status===T3e.PROCESSING&&y({userJourney:bPe.ON_RAMP,screen:"OrderInProgress",control:"PaymentProcessing",controlType:"IframeEvent",extras:{...n}}),e.data.status===T3e.COMPLETED&&y({userJourney:bPe.ON_RAMP,screen:"Success",control:"PaymentCompleted",controlType:"IframeEvent",extras:{...n}});break;case w3e.TRANSAK_ORDER_FAILED:y({userJourney:bPe.ON_RAMP,screen:"Failure",control:"PaymentFailed",controlType:"IframeEvent",extras:{...n}})}})(e.data,t),(e=>{if(p.current&&clearTimeout(p.current),e.event_id!==w3e.TRANSAK_WIDGET_OPEN)return e.event_id===w3e.TRANSAK_ORDER_SUCCESSFUL&&e.data.status===T3e.PROCESSING?(l({payload:{type:TRe.UPDATE_VIEW,view:{type:w8e.IN_PROGRESS_LOADING}}}),void(p.current=window.setTimeout((()=>{l({payload:{type:TRe.UPDATE_VIEW,view:{type:w8e.IN_PROGRESS}}})}),_3e))):void(e.event_id!==w3e.TRANSAK_ORDER_SUCCESSFUL||e.data.status!==T3e.COMPLETED?e.event_id===w3e.TRANSAK_ORDER_FAILED&&l({payload:{type:TRe.UPDATE_VIEW,view:{type:w8e.FAIL,data:{amount:n,tokenAddress:r},reason:`Transaction failed: ${e.data.statusReason}`}}}):l({payload:{type:TRe.UPDATE_VIEW,view:{type:w8e.SUCCESS,data:{transactionHash:e.data.transactionHash}}}}));l({payload:{type:TRe.UPDATE_VIEW,view:{type:w8e.ONRAMP,data:{amount:u.view.data?.amount??n,tokenAddress:u.view.data?.tokenAddress??r}}}})})(e.data))}))}),[a,o,n,r,e]),Cq(N3,{sx:v3e(t),children:Cq(_Pe,{header:Cq(xRe,{showBack:m,title:c("views.ONRAMP.header.title"),onCloseButtonClick:()=>sKe(s)}),footerBackgroundColor:"base.color.translucent.emphasis.200",children:Cq(N3,{sx:g3e(t),children:Cq("iframe",{title:"Transak",id:I3e,src:d,allow:"camera;microphone;fullscreen;payment",style:{height:"100%",width:"100%",border:"none",position:"absolute"}})})})})}function S3e(){const{eventTargetState:{eventTarget:e}}=uV.useContext(zqe),{t:t}=_ke();return Cq(_Pe,{testId:"order-in-progress-view",header:Cq(xRe,{transparent:!0,onCloseButtonClick:()=>sKe(e)}),footer:Cq(oNe,{}),heroContent:Cq(p8e,{}),floatHeader:!0,children:Iq(RRe,{heading:t("views.ONRAMP.IN_PROGRESS.content.heading"),children:[t("views.ONRAMP.IN_PROGRESS.content.body1"),Cq("br",{}),Cq("br",{}),t("views.ONRAMP.IN_PROGRESS.content.body2")]})})}function k3e({amount:e,tokenAddress:t,config:n}){const{isOnRampEnabled:r,isSwapEnabled:i,isBridgeEnabled:a}=n,[o,s]=uV.useReducer(ARe,{...wRe,history:[]}),c=uV.useMemo((()=>({viewState:o,viewDispatch:s})),[o,ARe]),{connectLoaderState:u}=uV.useContext(jRe),{checkout:l,provider:d}=u,[f,p]=uV.useState(t),{eventTargetState:{eventTarget:h}}=uV.useContext(zqe),{t:m}=_ke(),y=uV.useMemo((()=>o.view.type===w8e.ONRAMP),[o.view.type]);return uV.useEffect((()=>{l&&d&&(async()=>{if(!(await l.getNetworkInfo({provider:d})).isSupported)return;const e=f?.toLocaleLowerCase()===Nke?Nke:t;p(e)})()}),[l,d,s]),Iq(ERe.Provider,{value:c,children:[o.view.type===vRe.LOADING_VIEW&&Cq(PPe,{loadingText:m("views.ONRAMP.initialLoadingText")}),o.view.type===w8e.IN_PROGRESS_LOADING&&Cq(PPe,{loadingText:m("views.ONRAMP.IN_PROGRESS_LOADING.loading.text")}),o.view.type===w8e.IN_PROGRESS&&Cq(S3e,{}),o.view.type===w8e.SUCCESS&&Cq(Lqe,{statusText:m("views.ONRAMP.SUCCESS.text"),actionText:m("views.ONRAMP.SUCCESS.actionText"),onRenderEvent:()=>cKe(h,o.view.data.transactionHash),onActionClick:()=>sKe(h),statusType:_qe.SUCCESS,testId:"success-view"}),o.view.type===w8e.FAIL&&Cq(Lqe,{statusText:m("views.ONRAMP.FAIL.text"),actionText:m("views.ONRAMP.FAIL.actionText"),onRenderEvent:()=>uKe(h,o.view.reason??"Transaction failed"),onActionClick:()=>{s({payload:{type:TRe.UPDATE_VIEW,view:{type:w8e.ONRAMP,data:o.view.data}}})},statusType:_qe.FAILURE,onCloseClick:()=>sKe(h),testId:"fail-view"}),o.view.type!==w8e.SUCCESS&&o.view.type!==w8e.FAIL&&Cq(P3e,{passport:l?.passport,showIframe:y,tokenAmount:e??o.view.data?.amount,tokenAddress:f??o.view.data?.tokenAddress}),o.view.type===vRe.TOP_UP_VIEW&&Cq(A8e,{analytics:{userJourney:bPe.ON_RAMP},widgetEvent:kH.IMTBL_ONRAMP_WIDGET_EVENT,checkout:l,provider:d,showOnrampOption:r,showSwapOption:i,showBridgeOption:a,onCloseButtonClick:()=>sKe(h)})]})}var R3e=Object.freeze({__proto__:null,default:k3e});const N3e={walletProviderName:null,network:null,tokenBalances:[],supportedTopUps:null,walletConfig:{showDisconnectButton:!0,showNetworkMenu:!0}};var M3e;!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"}(M3e||(M3e={}));const D3e=uV.createContext({walletState:N3e,walletDispatch:()=>{}});D3e.displayName="WalletContext";const L3e=(e,t)=>{switch(t.payload.type){case M3e.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case M3e.SET_NETWORK:return{...e,network:t.payload.network};case M3e.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case M3e.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}},j3e=async(e,t)=>{const n=await e.getTokenAllowList({type:ZH.ALL,chainId:t}),r=new Set;return n.tokens.forEach((e=>{r.add(e.symbol)})),Array.from(r)},F3e={display:"flex",flexDirection:"row",justifyContent:"space-between",paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"},B3e={display:"flex",direction:"row",columnGap:"base.spacing.x1",alignItems:"center"},U3e={height:"base.icon.size.250",width:"base.icon.size.250",minWidth:"base.icon.size.250",fill:"base.color.accent.4",cursor:"pointer"};var z3e;function H3e(e){const{t:t}=_ke(),{viewDispatch:n}=uV.useContext(ERe),{totalBalance:r,loading:i}=e;return Iq(N3,{sx:F3e,children:[Iq(N3,{sx:B3e,children:[Cq(tee,{size:"medium",children:t("views.WALLET_BALANCES.totalTokenBalance.heading")}),Cq(N3,{sx:{pl:"base.spacing.x1"},children:Cq(d4,{testId:"coin-info-icon",variant:"tertiary",icon:"Information",sx:U3e,onClick:()=>n({payload:{type:TRe.UPDATE_VIEW,view:{type:z3e.COIN_INFO}}})})})]}),Iq(N3,{sx:B3e,children:[Cq(tee,{testId:"total-token-balance-value",weight:"bold",shimmer:i?1:0,shimmerSx:{minw:"100px"},children:t("views.WALLET_BALANCES.totalTokenBalance.totalHeading")}),!i&&Iq(tee,{testId:"total-token-balance",weight:"bold",children:["≈ USD $",r.toFixed(2)]})]})]})}!function(e){e.WALLET_BALANCES="WALLET_BALANCES",e.SETTINGS="SETTINGS",e.COIN_INFO="COIN_INFO",e.SUCCESS="SUCCESS",e.FAIL="FAIL"}(z3e||(z3e={}));const W3e=e=>({display:e?"":"none"});function V3e({balanceInfo:e,theme:t,bridgeToL2OnClick:n}){const{connectLoaderState:r}=uV.useContext(jRe),{track:i}=OPe(),{checkout:a,provider:o}=r,s=`≈ USD $${HRe(e.fiatAmount)}`,{walletState:c}=uV.useContext(D3e),{supportedTopUps:u,network:l}=c,[d,f]=uV.useState(),[p,h]=uV.useState(),[m,y]=uV.useState(),{eventTargetState:{eventTarget:b}}=uV.useContext(zqe),[g,v]=uV.useState([]),w=fNe(o);uV.useEffect((()=>{(async()=>{if(!a)return;const e=await a.getTokenAllowList({type:ZH.ONRAMP,chainId:Qke(a.config)});v(e.tokens)})()}),[a]),uV.useEffect((()=>{if(!l||!u||!a)return;const e=l.chainId===Qke(a.config)&&(u?.isOnRampEnabled??!0);f(e);const t=(l.chainId===Jke(a.config)||l.chainId===Qke(a.config))&&(u?.isBridgeEnabled??!0);h(t);const n=l.chainId===Qke(a.config)&&(u?.isSwapEnabled??!0)&&(u?.isSwapAvailable??!0);y(n)}),[l,u,a,w]);const T=uV.useMemo((()=>Boolean(d&&g.length>0&&g.find((t=>t.address?.toLowerCase()===e.address?.toLowerCase())))),[d,g]);return Iq(oae,{testId:`balance-item-${e.symbol}`,emphasized:!0,children:[Cq(oae.FramedImage,{use:Cq(a2e,{theme:t,src:e.icon,name:e.symbol,environment:a?.config.environment??Xt.PRODUCTION}),circularFrame:!0}),Cq(oae.Label,{children:e.symbol}),Cq(oae.Caption,{children:e.description}),Cq(oae.PriceDisplay,{testId:`balance-item-${e.symbol}`,use:Cq(qee,{size:"xSmall"}),price:VRe(e.balance),fiatAmount:s}),(d||m||p)&&Iq(oae.OverflowPopoverMenu,{size:"small",testId:"token-menu",onClick:()=>{i({userJourney:bPe.WALLET,screen:"WalletBalances",control:"BalanceItem",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}})},children:[Iq(oae,{testId:"balance-item-add-option",sx:W3e(T),onClick:()=>{i({userJourney:bPe.WALLET,screen:"WalletBalances",control:"AddTokens",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}}),$qe.sendRequestOnrampEvent(b,kH.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:e.address??"",amount:""})},children:[Cq(oae.Icon,{icon:"Add"}),Cq(oae.Label,{children:`Add ${e.symbol}`})]}),Iq(oae,{testId:"balance-item-swap-option",sx:W3e(m),onClick:()=>{i({userJourney:bPe.WALLET,screen:"WalletBalances",control:"SwapTokens",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}}),$qe.sendRequestSwapEvent(b,kH.IMTBL_WALLET_WIDGET_EVENT,{fromTokenAddress:e.address??"",toTokenAddress:"",amount:""})},children:[Cq(oae.Icon,{icon:"Exchange"}),Cq(oae.Label,{children:`Swap ${e.symbol}`})]}),Iq(oae,{testId:"balance-item-move-option",sx:W3e(p),onClick:()=>{i({userJourney:bPe.WALLET,screen:"WalletBalances",control:"MoveTokens",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}}),n(e.address)},children:[Cq(oae.Icon,{icon:"Minting"}),Cq(oae.Label,{children:`Move ${e.symbol}`})]})]})]})}const G3e={width:"100%",height:"100%",display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},q3e={width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},K3e=e=>e.filter((e=>"0.0"!==e.balance||KRe(e.address)));function X3e({balanceInfoItems:e,theme:t,bridgeToL2OnClick:n}){const{t:r}=_ke(),i=K3e(e);return Iq(N3,{sx:G3e,children:[0===i.length&&Cq(N3,{sx:q3e,children:Cq(tee,{testId:"no-tokens-found",children:r("views.WALLET_BALANCES.tokenBalancesList.noTokensFound")})}),i.map((e=>Cq(V3e,{balanceInfo:e,bridgeToL2OnClick:n,theme:t},e.id)))]})}const Y3e={display:"flex",flexDirection:"column",alignItems:"flex-start",paddingTop:"base.spacing.x4"},Z3e={fontWeight:"base.text.caption.small.bold.fontWeight",borderColor:"base.color.translucent.emphasis.1000",borderStyle:"solid",borderWidth:"base.border.size.200"},J3e={fontWeight:"base.text.caption.small.bold.fontWeight"},Q3e=e=>({width:"22px",filter:e?void 0:"grayscale(1)"}),$3e={paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"};function e4e(){const{t:e}=_ke(),{connectLoaderState:t}=uV.useContext(jRe),{eventTargetState:{eventTarget:n}}=uV.useContext(zqe),{checkout:r,provider:i}=t,{viewDispatch:a}=uV.useContext(ERe),{walletState:o,walletDispatch:s}=uV.useContext(D3e),{network:c}=o,[u,l]=uV.useState([]),{track:d}=OPe(),f=uV.useCallback((async e=>{if(r&&i&&c&&c.chainId!==e){d({userJourney:bPe.WALLET,screen:"WalletBalances",control:"SwitchNetwork",controlType:"Button",extras:{chainId:e}});try{const t=await r.switchNetwork({provider:i,chainId:e});!function(e,t,n){const r=new CustomEvent(kH.IMTBL_WALLET_WIDGET_EVENT,{detail:{type:MH.NETWORK_SWITCH,data:{network:n.name,chainId:n.chainId,provider:t}}});console.log("switch network event:",e,r),void 0!==e&&e.dispatchEvent(r)}(n,t.provider,t.network)}catch(e){e.type===uW.USER_REJECTED_REQUEST_ERROR||a({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.ERROR_VIEW,error:e}}})}}}),[r,i,c,s,a]);return uV.useEffect((()=>{(async()=>{if(r){const e=await r.getNetworkAllowList({type:YH.ALL});l(e?.networks??[])}else l([])})()}),[r]),Iq(N3,{testId:"network-menu",sx:Y3e,children:[Cq(tee,{testId:"network-heading",size:"medium",sx:$3e,children:e("views.WALLET_BALANCES.networkStatus.heading")}),Cq(sue,{children:r&&u?.sort(((e,t)=>URe(e,t,r.config))).map((e=>Iq(sue.Button,{testId:`${e.name}-network-button`,sx:e.chainId===c?.chainId?Z3e:J3e,size:"small",onClick:()=>f(e.chainId),children:[Cq(i7,{sx:Q3e(e.chainId===c?.chainId),use:Cq("img",{src:ZRe(r?.config.environment,e.chainId),alt:e.name})}),e.name]},e.chainId)))})]})}const t4e={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x2",flex:1},n4e={backgroundColor:"base.color.neutral.800",paddingX:"base.spacing.x1",borderRadius:"base.borderRadius.x6",flex:1},r4e={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},i4e=(e,t)=>{let n=460;e&&(n-=104),t&&(n-=98);return{height:`${n}px`,overflowY:"auto",borderRadius:"base.borderRadius.x6"}},a4e=async(e,t,n)=>{if(!e||!t||!n)return[];const r=await t.getSigner().getAddress(),i=await x8e((()=>e.getAllBalances({provider:t,walletAddress:r,chainId:n})),Uke);if(!i)return[];const a=((e,t,n)=>t.sort(((t,r)=>n===Qke(e)&&"imx"===t.token.symbol.toLowerCase()&&"imx"!==r.token.symbol.toLowerCase()?-1:n===Qke(e)&&"imx"===r.token.symbol.toLowerCase()&&"imx"!==t.token.symbol.toLowerCase()||t.balance.lt(r.balance)?1:t.balance.gt(r.balance)?-1:0)))(e.config,i.balances,n).map((t=>({...t,token:{...t.token,icon:JRe(e.config.environment,KRe(t.token.address)?t.token.symbol:t.token.address??"")}})));return a},o4e=(e,t,n)=>n?`${e.toString()}-${t.toLowerCase()}-${n.toLowerCase()}`:`${e.toString()}-${t.toLowerCase()}`,s4e=(e,t,n)=>t.map((t=>({id:o4e(e,t.token.symbol,t.token.address),balance:t.formattedBalance,fiatAmount:zRe(t.formattedBalance,t.token.symbol,n),symbol:t.token.symbol,address:t.token.address,description:t.token.name,icon:t.token.icon})));function c4e({balancesLoading:e,theme:t,showNetworkMenu:n}){const{t:r}=_ke(),{connectLoaderState:i}=uV.useContext(jRe),{checkout:a,provider:o}=i,{cryptoFiatState:s,cryptoFiatDispatch:c}=uV.useContext($6e),{walletState:u}=uV.useContext(D3e),{eventTargetState:{eventTarget:l}}=uV.useContext(zqe),{viewDispatch:d}=uV.useContext(ERe),[f,p]=uV.useState(0),{network:h,supportedTopUps:m,tokenBalances:y}=u,{conversions:b}=s,g=!fNe(o)&&n,{track:v,page:w}=OPe(),T=uV.useMemo((()=>s4e(h?.chainId,y,b)),[y,b,h?.chainId]);uV.useEffect((()=>{w({userJourney:bPe.WALLET,screen:"WalletBalances"})}),[]),uV.useEffect((()=>{(async()=>{if(!a)return;if(!c)return;if(!h)return;const e=await j3e(a,h.chainId);c({payload:{type:Q6e.SET_TOKEN_SYMBOLS,tokenSymbols:e}})})()}),[a,c,h?.chainId]),uV.useEffect((()=>{let e=0;T.forEach((t=>{const n=parseFloat(t.fiatAmount);Number.isNaN(n)||(e+=n)})),p(e)}),[T]);const E=uV.useMemo((()=>!(!a||!h)&&(h.chainId===Qke(a.config)&&Boolean(m?.isBridgeEnabled||m?.isSwapEnabled||m?.isOnRampEnabled))),[a,h,m]);return Cq(_Pe,{testId:"wallet-balances",header:Cq(xRe,{title:r("views.WALLET_BALANCES.header.title"),rightActions:Cq(d4,{icon:"SettingsCog",sx:gRe(),iconVariant:"bold",onClick:()=>{v({userJourney:bPe.WALLET,screen:"WalletBalances",control:"Settings",controlType:"Button"}),d({payload:{type:TRe.UPDATE_VIEW,view:{type:z3e.SETTINGS}}})},testId:"settings-button"}),onCloseButtonClick:()=>fKe(l)}),footer:Cq(oNe,{}),children:Iq(N3,{sx:t4e,children:[Iq(N3,{sx:n4e,children:[g&&Cq(e4e,{}),Cq(H3e,{totalBalance:f,loading:e}),Iq(N3,{sx:i4e(g,E),children:[e&&Iq(N3,{sx:r4e,children:[Cq(oae,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),Cq(oae,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"}),Cq(oae,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--3"})]}),!e&&Cq(X3e,{balanceInfoItems:T,bridgeToL2OnClick:e=>{$qe.sendRequestBridgeEvent(l,kH.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:e??"",amount:""})},theme:t})]})]}),E&&Iq(oae,{testId:"add-coins",emphasized:!0,onClick:()=>{v({userJourney:bPe.WALLET,screen:"WalletBalances",control:"AddCoins",controlType:"Button"}),d({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.TOP_UP_VIEW}}})},children:[Cq(oae.FramedIcon,{icon:"Add"}),Cq(oae.Label,{children:r("views.WALLET_BALANCES.addCoins")})]})]})})}function u4e(e){switch(e){case $H.METAMASK:return"MetaMaskSymbol";case $H.PASSPORT:return"PassportSymbolOutlined";case"walletconnect":return"WalletConnectSymbol";default:return"MetaMaskSymbol"}}const l4e={background:"base.color.status.success.bright",fill:"base.color.status.success.bright"},d4e={fill:"base.color.fixed.black.1000"};function f4e({provider:e,showL1Warning:t,setShowL1Warning:n}){const[r,i]=uV.useState(""),[a,o]=uV.useState(!1),{t:s}=_ke(),{track:c}=OPe(),u=uV.useMemo((()=>fNe(e)&&!t?"ShowPassword":a?"Tick":"CopyText"),[e,t,a]);uV.useEffect((()=>{e&&""===r&&(async()=>{const t=await e.getSigner().getAddress();i(t)})()}),[e,r]);return Iq(oae,{testId:"wallet-address",emphasized:!0,size:"medium",children:[Cq(oae.FramedLogo,{logo:u4e(mNe(e)),sx:{backgroundColor:"base.color.translucent.standard.200"}}),Cq(d4,{variant:"tertiary",iconVariant:"bold",size:"small",icon:u,iconSx:{...a?d4e:{}},onClick:async()=>{r&&"CopyText"===u?(c({userJourney:bPe.WALLET,screen:"Settings",control:"CopyWalletAddress",controlType:"Button"}),navigator.clipboard.writeText(r),o(!0),setTimeout((()=>o(!1)),1e3)):"ShowPassword"===u&&n(!0)},sx:{cursor:"pointer",...a?l4e:{}}}),Cq(oae.Label,{children:s("views.SETTINGS.walletAddress.label")}),Cq(oae.Caption,{testId:"wallet-address",children:$Re(r)})]})}const p4e={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x4"},h4e={marginTop:"32px"};function m4e(){return Cq(N3,{testId:"transfer-assets-l1-warning-hero",sx:{display:"flex",justifyContent:"center",padding:"base.spacing.x4"},children:Cq(N3,{children:Iq("svg",{xmlns:"http://www.w3.org/2000/svg",width:"135",height:"137",viewBox:"0 0 135 137",fill:"none",children:[Cq("path",{d:"M76.2361 65.9046L76.5095 17.3023C76.5157 15.9172 76.0711 14.9946 75.3435 14.6207C74.0964 13.9799 72.9093 14.4957 71.4798 15.3728L29.2306 41.5137L28.3702 98.7706L76.2398 65.9035L76.2361 65.9046Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M85.4571 126.862L85.791 76.8509C85.8102 74.0184 83.742 70.6325 81.1983 69.3267L47.8586 51.3375C46.7068 50.7462 45.739 49.8676 45.0526 48.788L43.4726 46.3043C42.7862 45.2247 41.8184 44.3461 40.6665 43.7548L36.2848 41.5054L31.2783 42.6987L30.909 101.567C30.9861 102.57 31.6727 103.52 32.9446 104.173L80.2378 129.343L81.6163 131.639L84.2802 129.667L84.2754 129.664C85.0031 129.123 85.4546 128.164 85.4632 126.862L85.4571 126.862Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M83.1421 78.7933C83.1612 75.96 81.0925 72.5732 78.5483 71.267L30.2174 45.562C28.8517 44.8609 28.1628 43.8191 28.1721 42.7358L27.7773 103.281C27.8544 104.284 28.5413 105.234 29.8134 105.887L78.1443 131.592C80.6909 132.9 82.7889 131.652 82.8068 128.821L83.1408 78.7956L83.1421 78.7933Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M36.8699 42.6587C36.8641 43.5432 35.5341 44.2721 33.9017 44.2823C32.2694 44.2925 30.9508 43.5854 30.9555 42.6973C30.9602 41.8091 32.2913 41.0838 33.9237 41.0736C34.7155 41.0681 35.4328 41.2334 35.963 41.5055C36.5244 41.7937 36.8726 42.2027 36.8699 42.6587Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M35.2866 42.6695C35.284 43.0802 34.6673 43.4179 33.9096 43.4227C33.1519 43.4276 32.5394 43.098 32.5419 42.6874C32.5445 42.2767 33.1612 41.939 33.9189 41.9342C34.2856 41.9315 34.6182 42.0084 34.8653 42.1352C35.1268 42.2695 35.288 42.4582 35.2853 42.6719L35.2866 42.6695Z",fill:"black"}),Cq("path",{d:"M70.9275 14.9238L29.4561 40.1902C28.389 40.9925 27.8611 41.9567 27.8526 42.8886C27.8526 42.8886 27.6951 44.5777 29.8905 45.7049C32.0859 46.832 34.8391 48.2668 34.8391 48.2668L36.1919 47.4119L31.26 44.8586C29.3491 43.8775 28.9381 42.1986 30.6697 40.8949L72.2083 15.5784C73.3784 14.6992 74.4371 14.4968 75.1905 14.8835C75.1905 14.8835 72.8927 13.4441 70.9288 14.9215L70.9275 14.9238Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M81.0605 110.741L83.1092 111.399L85.7093 118.337L85.7797 107.796L81.2805 106.491L81.0605 110.741Z",fill:"black"}),Cq("path",{d:"M83.1104 113.492C83.1312 110.487 84.073 109.095 87.3742 109.652C89.1483 109.952 90.9444 109.879 92.6948 109.428L96.5484 108.436C99.8885 107.577 102.639 104.113 102.664 100.741C102.686 97.3675 99.9706 95.3116 96.6329 96.1724L91.9518 97.3781C90.3645 97.7883 88.6894 97.6786 87.181 97.0768C84.1103 95.8485 83.2401 94.5701 83.2615 91.3841L81.2915 93.3582L74.7155 111.72L83.1115 113.496L83.1104 113.492Z",fill:"#F3F3F3"}),Cq("path",{d:"M83.1053 113.501C83.1261 110.496 84.0681 109.104 87.3701 109.661C89.1445 109.961 90.9411 109.888 92.6918 109.437L96.5463 108.445C99.8871 107.585 102.638 104.12 102.663 100.747C102.685 97.3736 99.9692 95.3172 96.6308 96.1782L91.9487 97.3841C90.361 97.7944 88.6855 97.6847 87.1768 97.0828C84.1055 95.8542 83.2351 94.5755 83.2564 91.3888",stroke:"black",strokeWidth:"1.33831",strokeMiterlimit:"10"}),Cq("path",{d:"M100.563 99.4451C99.4403 98.3218 97.1152 98.7714 95.3661 100.45C93.6171 102.129 93.1092 104.399 94.2323 105.522L94.7567 106.048L101.088 99.9711L100.563 99.4451Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M99.9733 105.056C101.727 103.381 102.236 101.114 101.111 99.9926C99.986 98.8713 97.6528 99.3204 95.8996 100.996C94.1464 102.671 93.637 104.938 94.762 106.059C95.8869 107.18 98.2201 106.731 99.9733 105.056Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M51.6986 91.7452C50.6642 91.2142 49.827 89.8416 49.8336 88.6901L49.9893 65.7522C49.9984 64.6019 50.8483 64.0955 51.8828 64.6265L72.5076 75.205C73.542 75.736 74.3793 77.1086 74.3726 78.2601L74.2169 101.198C74.2079 102.348 73.3579 102.855 72.3235 102.324L51.6986 91.7452Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M52.7617 91.0867C51.7272 90.5557 50.89 89.1831 50.8966 88.0315L51.0523 65.0931C51.0553 64.8339 51.101 64.6088 51.1799 64.4189C50.4902 64.3771 49.9962 64.8783 49.9906 65.7516L49.8349 88.69C49.8259 89.8403 50.6655 91.2142 51.7 91.7452L72.3252 102.324C73.1244 102.734 73.8145 102.522 74.0887 101.871C73.8709 101.859 73.6341 101.792 73.3845 101.664L52.7593 91.0855L52.7617 91.0867Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M66.9055 85.8915L66.8883 88.4023L64.3853 87.1169L61.8847 85.8328L59.3817 84.5474L57.6065 83.6358C57.2078 83.4311 56.8773 83.5922 56.875 83.9917L56.8689 85.042C56.8653 85.4439 57.1906 85.9418 57.5917 86.1478L59.3669 87.0594L61.8699 88.3448L61.8577 90.1235C61.8541 90.5254 62.1807 91.0209 62.5818 91.2269L63.6292 91.7647C64.0279 91.9695 64.3584 91.8083 64.362 91.4064L64.3742 89.6277L66.8772 90.9131L68.6523 91.8247C69.0511 92.0295 69.3829 91.8659 69.3852 91.4664L69.3974 89.6877L69.4095 87.909C69.4131 87.5071 69.0866 87.0116 68.6854 86.8056L66.9103 85.894L66.9055 85.8915Z",fill:"white"}),Cq("path",{d:"M59.3703 79.5438L59.3581 81.3271C59.3569 81.7313 59.6802 82.2293 60.0844 82.4371L61.862 83.3511L64.3662 84.6386L66.8728 85.9274L66.8862 84.1416C66.8874 83.7374 66.5641 83.2394 66.16 83.0316L64.3823 82.1176L61.8781 80.8301L59.3716 79.5414L59.3703 79.5438Z",fill:"white"}),Cq("path",{d:"M62.6235 73.7033C62.2248 73.4985 61.8943 73.6597 61.892 74.0592L61.8798 75.8379L59.3768 74.5525L57.6016 73.641C57.2029 73.4362 56.8724 73.5973 56.8688 73.9992L56.8566 75.7779L56.8445 77.5566C56.8409 77.9585 57.1674 78.4541 57.5686 78.6601L59.3437 79.5717L59.3609 77.0609L61.8639 78.3463L64.3645 79.6304L66.8675 80.9157L68.6426 81.8273C69.0414 82.0321 69.3719 81.8709 69.3755 81.469L69.3827 80.4224C69.3838 80.0193 69.061 79.5226 68.6598 79.3166L66.8847 78.405L64.3817 77.1197L64.3938 75.341C64.3974 74.9391 64.0709 74.4435 63.6697 74.2375L62.6224 73.6997L62.6235 73.7033Z",fill:"white"}),Cq("path",{d:"M46.8192 101.66L46.8314 99.6311C46.838 98.841 46.2586 97.8985 45.551 97.5353L42.5478 95.9937L42.5679 93.0481C42.5746 92.258 41.9976 91.3167 41.2875 90.9523L38.7449 89.6471C38.3611 89.4501 38.0161 89.4638 37.7758 89.6403L36.4656 90.6093L37.4387 91.7024L37.4277 93.3685L34.4246 91.827C34.0408 91.63 33.6957 91.6437 33.4554 91.8201L32.1452 92.7891L33.1181 93.8094L33.113 94.6306C33.1063 95.4207 33.6858 96.3632 34.3934 96.7264L37.3965 98.268L37.3764 101.214C37.3698 102.004 37.9468 102.945 38.6568 103.309L39.7002 103.845L40.8571 105.593L42.1673 104.624C42.3691 104.473 42.4965 104.205 42.4976 103.842L42.5177 100.897L44.2088 101.765L45.1822 103.415L46.4924 102.446C46.6966 102.297 46.8216 102.028 46.8227 101.665L46.8192 101.66Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M45.514 102.623L45.5261 100.594C45.5327 99.8036 44.9532 98.8609 44.2455 98.4977L41.2419 96.9558L41.262 94.0097C41.2674 93.2219 40.6916 92.2781 39.9815 91.9135L37.4385 90.6082C36.7284 90.2437 36.1455 90.5927 36.1388 91.3829L36.1187 94.329L33.1151 92.7872C32.405 92.4227 31.8184 92.7728 31.8154 93.5619L31.8033 95.5912C31.7967 96.3815 32.3762 97.3241 33.0839 97.6874L36.0875 99.2293L36.0673 102.175C36.0607 102.966 36.6378 103.907 37.3479 104.272L39.8909 105.577C40.601 105.941 41.1839 105.592 41.1906 104.802L41.2107 101.856L44.2143 103.398C44.9244 103.762 45.511 103.412 45.514 102.623Z",fill:"white",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M55.4177 54.343L85.7278 37.2672L70.5728 15.9224L55.4177 54.343Z",fill:"#FF637F",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M55.4176 54.3431L51.6289 52.2086L66.7839 13.7881L70.5727 15.9226L55.4176 54.3431Z",fill:"#131313",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M69.1528 25.261L71.9944 23.6602V34.3325L69.1528 35.9334V25.261Z",fill:"#131313",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M69.1528 38.0676L71.9944 36.4667V39.6684L69.1528 41.2693V38.0676Z",fill:"#131313",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"})]})})})}function y4e({provider:e,showL1Warning:t,setShowL1Warning:n}){const{t:r}=_ke();return Cq(wne,{size:"full",visible:t,showHeaderBar:!1,children:Iq(wne.Content,{children:[Cq(d4,{icon:"Close",variant:"tertiary",sx:{pos:"absolute",top:"base.spacing.x5",left:"base.spacing.x5",backdropFilter:"blur(30px)"},onClick:()=>n(!1)}),Cq(m4e,{}),Iq(N3,{sx:{px:"base.spacing.x6"},children:[Cq(qee,{sx:{marginTop:"base.spacing.x6",marginBottom:"base.spacing.x2",textAlign:"center"},children:r("views.SETTINGS.transferAssetsL1Warning.heading")}),Cq(tee,{size:"medium",sx:{display:"block",textAlign:"center",color:"base.color.text.body.secondary",marginBottom:"base.spacing.x13"},children:r("views.SETTINGS.transferAssetsL1Warning.body")}),Cq(f4e,{provider:e,showL1Warning:t,setShowL1Warning:n})]})]})})}function b4e({showDisconnectButton:e}){const[t,n]=uV.useState(!1),{t:r}=_ke(),{connectLoaderState:i}=uV.useContext(jRe),{provider:a}=i,{eventTargetState:{eventTarget:o}}=uV.useContext(zqe),{ethereumProvider:s}=aqe(),{page:c}=OPe();uV.useEffect((()=>{c({userJourney:bPe.WALLET,screen:"Settings"})}),[]);return Iq(_Pe,{testId:"wallet-balances",header:Cq(xRe,{showBack:!0,title:r("views.SETTINGS.header.title"),onCloseButtonClick:()=>fKe(o)}),footer:Cq(oNe,{}),children:[Iq(N3,{sx:p4e,children:[Cq(f4e,{provider:a,showL1Warning:t,setShowL1Warning:n}),e&&Cq(O3,{testId:"disconnect-button",variant:"secondary",sx:h4e,onClick:()=>{(async()=>{if(hNe(a))try{if(a.provider?.session){const e=a.provider?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>s?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}return void await a.provider.disconnect()}if(s){const e=s?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>s?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}await s.disconnect()}}catch(e){console.error(e)}})().then((()=>{!function(e){const t=new CustomEvent(kH.IMTBL_WALLET_WIDGET_EVENT,{detail:{type:MH.DISCONNECT_WALLET,data:{}}});console.log("disconnect wallet event:",e,t),void 0!==e&&e.dispatchEvent(t)}(o)}))},children:r("views.SETTINGS.disconnectButton.label")})]}),Cq(y4e,{provider:a,showL1Warning:t,setShowL1Warning:n})]})}function g4e(){return Cq(N3,{sx:{...IRe,background:"base.color.translucent.emphasis.100"},children:Cq(N3,{sx:{...ORe,...CRe},children:Iq("svg",{width:"430",height:"211",viewBox:"0 0 430 211",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Cq("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)"}),Cq("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"}),Cq("path",{d:"M131.005 34.0566L130.576 32.4244L128.944 32.8537L129.373 34.4858L131.005 34.0566Z",fill:"white"}),Cq("path",{d:"M77.1152 45.7678L76.5627 43.6667L74.4617 44.2193L75.0142 46.3203L77.1152 45.7678Z",fill:"white"}),Cq("path",{d:"M264.238 30.1945L262.093 29.8494L261.748 31.9942L263.893 32.3394L264.238 30.1945Z",fill:"white"}),Cq("path",{d:"M348.157 2.3323L348.776 1.04626L347.49 0.427149L346.871 1.71319L348.157 2.3323Z",fill:"white"}),Cq("path",{d:"M342.606 56.5062L342.054 54.4052L339.953 54.9577L340.505 57.0587L342.606 56.5062Z",fill:"white"}),Cq("path",{d:"M348.381 55.0847L349 53.7986L347.714 53.1795L347.095 54.4656L348.381 55.0847Z",fill:"white"}),Cq("path",{d:"M107.606 18.8096L106.681 17.7229L105.594 18.6483L106.52 19.735L107.606 18.8096Z",fill:"white"}),Cq("path",{d:"M233.14 2.3323L233.759 1.04626L232.473 0.427149L231.854 1.71319L233.14 2.3323Z",fill:"white"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("defs",{children:Iq("linearGradient",{id:"paint0_linear_4525_125520",x1:"191",y1:"124.403",x2:"247.716",y2:"304.676",gradientUnits:"userSpaceOnUse",children:[Cq("stop",{stopColor:"#AD48BA"}),Cq("stop",{offset:"0.65625",stopColor:"#D178FF",stopOpacity:"0.24"})]})})]})})})}function v4e(){const{t:e}=_ke(),{connectLoaderState:{provider:t}}=uV.useContext(jRe),n=fNe(t),{page:r}=OPe();return uV.useEffect((()=>{r({userJourney:bPe.WALLET,screen:"CoinInfo"})}),[]),Iq(_Pe,{testId:"coin-info",header:Cq(xRe,{showBack:!0,transparent:!0}),footer:Cq(oNe,{}),heroContent:Cq(g4e,{}),floatHeader:!0,children:[!n&&Cq(RRe,{heading:e("views.COIN_INFO.metamask.heading"),children:e("views.COIN_INFO.metamask.body")}),n&&Iq(RRe,{heading:e("views.COIN_INFO.passport.heading"),children:[e("views.COIN_INFO.passport.body1"),Cq(kae,{onClick:()=>window.open(Bke),children:e("views.COIN_INFO.passport.linkText")}),e("views.COIN_INFO.passport.body2")]})]})}var w4e,T4e,E4e,A4e,x4e,O4e,C4e=Object.freeze({__proto__:null,default:function(e){const{t:t}=_ke(),n=t("views.ERROR_VIEW.actionText"),r=t("views.LOADING_VIEW.text"),{eventTargetState:{eventTarget:i}}=uV.useContext(zqe),{config:{environment:a,isOnRampEnabled:o,isSwapEnabled:s,isBridgeEnabled:c,theme:u},walletConfig:{showDisconnectButton:l,showNetworkMenu:d}}=e,{connectLoaderState:{checkout:f,provider:p}}=uV.useContext(jRe),[h,m]=uV.useReducer(ARe,{...wRe,history:[]}),[y,b]=uV.useReducer(L3e,{...N3e,walletConfig:{showDisconnectButton:l,showNetworkMenu:d}}),g=uV.useMemo((()=>({walletState:y,walletDispatch:b})),[y,b]),v=uV.useMemo((()=>({viewState:h,viewDispatch:m})),[h,m]),{balancesLoading:w,refreshBalances:T}=(({checkout:e,provider:t,refreshCallback:n,errorCallback:r})=>{const[i,a]=uV.useState(!0),o=uV.useCallback((async(i=!1)=>{if(e&&t)try{const r=await e.getNetworkInfo({provider:t});if(!r.isSupported)return;i||a(!0);const o=await a4e(e,t,r.chainId);i||a(!1),n(o)}catch(e){Uke.nonRetryable(e)&&r(e),i||a(!1)}}),[e,t]);return N2e((()=>o(!0)),3e4),{balancesLoading:i,refreshBalances:o}})({checkout:f,provider:p,refreshCallback:e=>{b({payload:{type:M3e.SET_TOKEN_BALANCES,tokenBalances:e}})},errorCallback:e=>{console.error(e),m({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.ERROR_VIEW,error:new Error("Unable to fetch balances")}}})}});uV.useEffect((()=>{(async()=>{if(!f)return;let e;try{e=await f.isSwapAvailable()}catch(t){e=!1}b({payload:{type:M3e.SET_SUPPORTED_TOP_UPS,supportedTopUps:{isBridgeEnabled:c,isSwapEnabled:s,isOnRampEnabled:o,isSwapAvailable:e}}})})()}),[c,s,o,a]);const E=async()=>{if(f&&p)try{const e=await f.getNetworkInfo({provider:p});if(!e.isSupported)return;T(),m({payload:{type:TRe.UPDATE_VIEW,view:{type:z3e.WALLET_BALANCES}}}),b({payload:{type:M3e.SET_NETWORK,network:e}})}catch(e){console.error(e),m({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.ERROR_VIEW,error:e}}})}};return uV.useEffect((()=>{f&&p&&E()}),[f,p]),Cq(ERe.Provider,{value:v,children:Cq(d8e,{environment:a,children:Iq(D3e.Provider,{value:g,children:[h.view.type===vRe.LOADING_VIEW&&Cq(PPe,{loadingText:r}),h.view.type===z3e.WALLET_BALANCES&&Cq(c4e,{balancesLoading:w,theme:u,showNetworkMenu:d}),h.view.type===z3e.SETTINGS&&Cq(b4e,{showDisconnectButton:l}),h.view.type===z3e.COIN_INFO&&Cq(v4e,{}),h.view.type===vRe.ERROR_VIEW&&Cq(NRe,{actionText:n,onActionClick:async()=>{m({payload:{type:TRe.UPDATE_VIEW,view:{type:z3e.WALLET_BALANCES}}}),await E()},onCloseClick:()=>fKe(i)}),h.view.type===vRe.TOP_UP_VIEW&&Cq(A8e,{analytics:{userJourney:bPe.WALLET},widgetEvent:kH.IMTBL_WALLET_WIDGET_EVENT,checkout:f,provider:p,showOnrampOption:o,showSwapOption:s,showBridgeOption:c,onCloseButtonClick:()=>fKe(i)})]})})})}});!function(e){e.PAYMENT_METHODS="PAYMENT_METHODS",e.PAY_WITH_COINS="PAY_WITH_COINS",e.PAY_WITH_CARD="PAY_WITH_CARD",e.ORDER_SUMMARY="ORDER_SUMMARY",e.SALE_SUCCESS="SALE_SUCCESS",e.SALE_FAIL="SALE_FAIL"}(w4e||(w4e={})),function(e){e.INIT="INIT",e.REVIEW_ORDER="REVIEW_ORDER",e.EXECUTE_FUNDING_ROUTE="EXECUTE_FUNDING_ROUTE"}(T4e||(T4e={})),function(e){e.DEFAULT="DEFAULT_ERROR",e.INVALID_PARAMETERS="INVALID_PARAMETERS",e.TRANSACTION_FAILED="TRANSACTION_FAILED",e.SERVICE_BREAKDOWN="SERVICE_BREAKDOWN",e.PRODUCT_NOT_FOUND="PRODUCT_NOT_FOUND",e.INSUFFICIENT_STOCK="INSUFFICIENT_STOCK",e.TRANSAK_FAILED="TRANSAK_FAILED",e.WALLET_FAILED="WALLET_FAILED",e.WALLET_REJECTED="WALLET_REJECTED",e.WALLET_REJECTED_NO_FUNDS="WALLET_REJECTED_NO_FUNDS",e.WALLET_POPUP_BLOCKED="WALLET_POPUP_BLOCKED",e.FUNDING_ROUTE_EXECUTE_ERROR="FUNDING_ROUTE_EXECUTE_ERROR"}(E4e||(E4e={})),function(e){e.CRYPTO="crypto",e.FIAT="fiat"}(A4e||(A4e={})),function(e){e.SUFFICIENT="SUFFICIENT"}(x4e||(x4e={})),function(e){e.BEFORE="before",e.PENDING="pending",e.AFTER="after"}(O4e||(O4e={}));const I4e={[Xt.SANDBOX]:"https://api.sandbox.immutable.com/v1/primary-sales",[Xt.PRODUCTION]:"https://api.immutable.com/v1/primary-sales"},_4e=e=>e.map((({method:e,hash:t})=>`${e}: ${t}`)).join(" | "),P4e=e=>e.split(/[_\s-]+/).map((e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase())).join(""),S4e=e=>e.replace(/[^\u0000-\u00FF]/g,""),k4e=e=>{if(!e)return"";let t=e.trim().toLowerCase();if(t.startsWith("0x")&&(t=t.slice(2)),!/^[0-9a-f]+$/i.test(t))throw new Error("Invalid hexadecimal input");let n="";for(let e=0;e<t.length;e+=2){const r=parseInt(t.substr(e,2),16);n+=String.fromCharCode(r)}return n},R4e=async(e,t)=>{try{const n=t.getSigner(),r=await n.getAddress(),i=e.find((e=>e.methodCall.startsWith("approve")));if(!i||!n||!r)return e;const a=new pl(i.tokenAddress,["function allowance(address,address) view returns (uint256)"],n),o=await(n?.call({to:i.tokenAddress,data:a.interface.encodeFunctionData("allowance",[r,i.params.spender])})),s=jr.from(o),c=i.params.amount?jr.from(i.params.amount):jr.from(0);if(s.gte(jr.from("0"))&&s.gte(c))return e.filter((e=>e.methodCall!==i.methodCall))}catch{}return e};var N4e;!function(e){e.CONTRACT_ADDRESS="contract_address",e.CURRENCY_SYMBOL="currency_symbol"}(N4e||(N4e={}));const M4e=e=>{const{provider:t,items:n,environment:r,environmentId:i,waitFulfillmentSettlements:a}=e,[o,s]=uV.useState(void 0),[c,u]=uV.useState(void 0),[l,d]=uV.useState({done:!1,transactions:[]}),[f,p]=uV.useState([]),[h,m]=uV.useState(0),[y,b]=uV.useState([]),g=()=>d((e=>({...e,done:!0}))),v=()=>d({done:!1,transactions:[]}),w=uV.useCallback((async(e,n,r)=>{try{const i=t?.getSigner(),o=await(t?.getGasPrice()),s=await(i?.sendTransaction({to:e,data:n,gasPrice:o,gasLimit:r}));a&&await(s?.wait());const c=s?.hash;if(!c)throw new Error("Transaction hash is undefined");return[c,void 0]}catch(e){const t=`${e?.reason||e?.message||""}`.toLowerCase();let n=E4e.WALLET_FAILED;t.includes("failed")&&t.includes("open confirmation")&&(n=E4e.WALLET_POPUP_BLOCKED),t.includes("rejected")&&t.includes("user")&&(n=E4e.WALLET_REJECTED),t.includes("failed to submit")&&t.includes("highest gas limit")&&(n=E4e.WALLET_REJECTED_NO_FUNDS),(t.includes("status failed")||t.includes("transaction failed"))&&(n=E4e.TRANSACTION_FAILED);const r={type:n,data:{error:e}};return s(r),[void 0,r]}}),[t,a]),T=uV.useCallback((async(e,a)=>{try{const o=t?.getSigner(),c={recipient_address:await(o?.getAddress())||"",payment_type:e,currency_filter:N4e.CONTRACT_ADDRESS,currency_value:a,products:n.map((e=>({product_id:e.productId,quantity:e.qty})))},l=`${I4e[r]}/${i}/order/sign`,d=await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)}),{ok:f,status:h}=d;if(!f){const{code:e}=await d.json();let t;switch(h){case 400:t=E4e.SERVICE_BREAKDOWN;break;case 404:t="insufficient_stock"===e?E4e.INSUFFICIENT_STOCK:E4e.PRODUCT_NOT_FOUND;break;case 429:case 500:t=E4e.DEFAULT;break;default:throw new Error("Unknown error")}return void s({type:t})}const m=await d.json(),y=m.order.products.map((e=>e.detail.map((({token_id:e})=>e)))).flat(),g=((e,t)=>{const{order:n,transactions:r}=e;return{order:{currency:{name:n.currency.name,erc20Address:n.currency.erc20_address},products:n.products.map((e=>((e,t,n)=>({productId:e.product_id,image:n?.image||"",qty:n?.qty||1,name:n?.name||"",description:n?.description||"",currency:t,contractType:e.contract_type,collectionAddress:e.collection_address,amount:e.detail.map((({amount:e})=>e)),tokenId:e.detail.map((({token_id:e})=>e))}))(e,n.currency.name,t.find((t=>t.productId===e.product_id))))).reduce(((e,t)=>{const n=e.findIndex((e=>e.name===t.name));return-1===n&&e.push({...t}),n>-1&&(e[n].amount=[...e[n].amount,...t.amount],e[n].tokenId=[...e[n].tokenId,...t.tokenId]),e}),[]),totalAmount:Number(n.total_amount)},transactions:r.map((e=>({tokenAddress:e.contract_address,gasEstimate:e.gas_estimate,methodCall:e.method_call,params:{reference:e.params.reference||"",amount:e.params.amount||0,spender:e.params.spender||""},rawData:e.raw_data}))),transactionId:k4e(r.find((e=>e.method_call.startsWith("execute")))?.params.reference||"")}})(m,n);if(p(y),u(g),t){const e=await R4e(g.transactions,t);b(e)}return g}catch(e){s({type:E4e.DEFAULT,data:{error:e}})}}),[n,i,r,t]),E=async(e,t,n)=>{if(!e)return!1;const{tokenAddress:r,rawData:i,methodCall:a,gasEstimate:o}=e,[s,c]=await w(r,i,o);if(c||!s)return n(c,l.transactions),!1;const u={method:a,hash:s};return(e=>{d((t=>({...t,transactions:[...t.transactions,e]})))})(u),t(u),!0},A=uV.useCallback((async(e,n,r,i)=>{if(!e||!t)return s({type:E4e.DEFAULT,data:{reason:"No sign data"}}),[];const a=await R4e(e.transactions,t);let o=!0;for(const e of a){i&&i(e.methodCall,O4e.BEFORE);if(!await E(e,n,r)){o=!1;break}i&&i(e.methodCall,O4e.AFTER)}return(o?g:v)(),l.transactions}),[t,E,g,v,R4e,w]),x=uV.useCallback((async(e,n,r)=>{if(!y||l.done||!t)return!1;const i=y[h];r&&r(i.methodCall,O4e.BEFORE);const a=await E(i,e,n);return a&&(m((e=>e+1)),h===y.length-1&&g(),r&&r(i.methodCall,O4e.AFTER)),a}),[h,t,y]);return{sign:T,signResponse:c,signError:o,filteredTransactions:y,currentTransactionIndex:h,executeAll:A,executeResponse:l,tokenIds:f,executeNextTransaction:x}},D4e=(e,t)=>{const n=-1===e.findIndex((({name:e})=>eNe(e,t||"")));return t&&n&&console.warn(`[IMTBL]: invalid "preferredCurrency=${t}" widget input`),t&&!n?e.filter((({name:e})=>eNe(e,t))).map((({erc20_address:e,exchange_id:t,...n})=>({...n,base:!0,address:e,exchangeId:t}))):e.map((({erc20_address:e,exchange_id:t,...n})=>({...n,address:e,exchangeId:t})))},L4e={config:{contractId:""},currencies:[],products:{},totalAmount:{}},j4e=({items:e,environment:t,environmentId:n,provider:r,preferredCurrency:i})=>{const[a,o]=uV.useState(),s=uV.useRef(!1),[c,u]=uV.useState(""),[l,d]=uV.useState(L4e),[f,p]=uV.useState(void 0),h=e=>{p({type:E4e.SERVICE_BREAKDOWN,data:{reason:"Error fetching settlement currencies",error:e}})};return uV.useEffect((()=>{e?.length&&r&&(async()=>{try{const t=new URLSearchParams,n=e.map((({productId:e,qty:t})=>({id:e,qty:t})));t.append("products",btoa(JSON.stringify(n)));const i=r.getSigner(),a=await i.getAddress();t.append("wallet_address",a),u(t.toString())}catch(e){h(e)}})()}),[e,r]),uV.useEffect((()=>{t&&n&&c&&(async()=>{if(!s.current)try{s.current=!0;const e=`${I4e[t]}/${n}/order/quote?${c}`,r=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}});if(!r.ok)throw new Error(`${r.status} - ${r.statusText}`);const a=(({config:e,currencies:t,products:n,total_amount:r},i)=>({config:{contractId:e.contract_id},currencies:D4e(t,i),products:Object.entries(n).reduce(((e,[t,{product_id:n,...r}])=>({...e,[t]:{productId:t,...r}})),{}),totalAmount:r}))(await r.json(),i);d(a)}catch(e){h(e)}finally{s.current=!1}})()}),[t,n,c]),uV.useEffect((()=>{if(0===l.currencies.length)return;const e=i?l.currencies.find((e=>eNe(e.name,i))):void 0,t=e||l.currencies.find((e=>e.base))||l.currencies?.[0];o(t)}),[l]),{orderQuote:l,selectedCurrency:a,orderQuoteError:f}},F4e=uV.createContext({items:[],collectionName:"",provider:void 0,checkout:void 0,environmentId:"",environment:Xt.SANDBOX,recipientAddress:"",recipientEmail:"",sign:()=>Promise.resolve(void 0),executeAll:()=>Promise.resolve([]),executeNextTransaction:()=>Promise.resolve(!1),signResponse:void 0,signError:void 0,filteredTransactions:[],currentTransactionIndex:0,executeResponse:void 0,passport:void 0,isPassportWallet:!1,showCreditCardWarning:!1,setShowCreditCardWarning:()=>{},paymentMethod:void 0,setPaymentMethod:()=>{},goBackToPaymentMethods:()=>{},goToErrorView:()=>{},goToSuccessView:()=>{},config:{},fundingRoutes:[],disabledPaymentTypes:[],invalidParameters:!1,fromTokenAddress:"",orderQuote:L4e,signTokenIds:[],excludePaymentTypes:[],preferredCurrency:void 0,selectedCurrency:void 0,waitFulfillmentSettlements:!0,hideExcludedPaymentTypes:!1});F4e.displayName="SaleSaleContext";const B4e=1;function U4e(e){const{children:t,value:{config:n,environment:r,environmentId:i,items:a,provider:o,checkout:s,passport:c,collectionName:u,excludePaymentTypes:l,excludeFiatCurrencies:d,preferredCurrency:f,waitFulfillmentSettlements:p,hideExcludedPaymentTypes:h}}=e,m=uV.useRef(0),{viewDispatch:y}=uV.useContext(ERe),[{recipientEmail:b,recipientAddress:g},v]=uV.useState({recipientEmail:"",recipientAddress:""}),[w,T]=uV.useState(!1),[E,A]=uV.useState(void 0),x=e=>{if(e===jH.CREDIT&&!w)return A(void 0),void T(!0);A(e),T(!1)},[O]=uV.useState([]),[C,I]=uV.useState([]),[_,P]=uV.useState(!1),{selectedCurrency:S,orderQuote:k,orderQuoteError:R}=j4e({items:a,provider:o,environmentId:i,environment:n.environment,preferredCurrency:f}),N=S?.address||"",M=uV.useCallback(((e,t)=>{x(e),y({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.PAYMENT_METHODS,data:t}}})}),[]);uV.useEffect((()=>{(async()=>{const e=o?.getSigner(),t=await(e?.getAddress())||"",n=(await(c?.getUserInfo()))?.email||"";v({recipientEmail:n,recipientAddress:t})})()}),[o]);const{sign:D,executeAll:L,executeNextTransaction:j,signResponse:F,signError:B,filteredTransactions:U,currentTransactionIndex:z,executeResponse:H,tokenIds:W}=M4e({items:a,provider:o,fromTokenAddress:N,recipientAddress:g,environmentId:i,environment:r,waitFulfillmentSettlements:p}),V=uV.useCallback((async(e,t,n)=>{const r=t||N;if(!r||!r.startsWith("0x"))return void P(!0);const i=await D(e,r);return i?(n?.(i),i):void 0}),[D,N]),G=uV.useCallback(((e,t={})=>{m.current+=1,m.current>B4e&&(m.current=0,x(void 0)),y({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.SALE_FAIL,data:{...t,errorType:e,paymentMethod:E,transactions:H.transactions}}}})}),[E,x,H]),q=uV.useCallback((e=>{y({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.SALE_SUCCESS,data:{paymentMethod:E,transactions:H.transactions,tokenIds:W,...e}}}})}),[[E,H,W]]);uV.useEffect((()=>{B&&G(B.type,B.data)}),[B]),uV.useEffect((()=>{R&&G(R.type,R.data)}),[R]),uV.useEffect((()=>{!(!a||0===a.length)&&u&&i||P(!0)}),[a,u,i]),uV.useEffect((()=>{l?.length<=0||I(l)}),[l]);const K=uV.useMemo((()=>({config:n,items:a,fromTokenAddress:N,sign:V,signResponse:F,signError:B,filteredTransactions:U,currentTransactionIndex:z,executeAll:L,executeNextTransaction:j,executeResponse:H,environmentId:i,collectionName:u,environment:r,provider:o,checkout:s,recipientAddress:g,recipientEmail:b,showCreditCardWarning:w,setShowCreditCardWarning:T,paymentMethod:E,setPaymentMethod:x,goBackToPaymentMethods:M,goToErrorView:G,goToSuccessView:q,isPassportWallet:!!o?.provider?.isPassport,fundingRoutes:O,disabledPaymentTypes:C,invalidParameters:_,orderQuote:k,signTokenIds:W,excludePaymentTypes:l,excludeFiatCurrencies:d,selectedCurrency:S,waitFulfillmentSettlements:p,hideExcludedPaymentTypes:h})),[n,r,i,a,N,u,o,s,g,b,F,B,U,z,H,w,T,E,M,G,q,V,O,C,_,k,W,l,d,S,p,h]);return Cq(F4e.Provider,{value:K,children:t})}function z4e(){return uV.useContext(F4e)}const H4e={[Xt.SANDBOX]:"https://global-stg.transak.com",[Xt.PRODUCTION]:"https://global.transak.com/"},W4e={[Xt.SANDBOX]:"https://api-stg.transak.com",[Xt.PRODUCTION]:"https://api.transak.com"},V4e={[Xt.SANDBOX]:"STAGING",[Xt.PRODUCTION]:"PRODUCTION"},G4e={[Xt.SANDBOX]:"d14b44fb-0f84-4db5-affb-e044040d724b",[Xt.PRODUCTION]:"ad1bca70-d917-4628-bb0f-5609537498bc"},q4e=e=>{const{contractId:t,environment:n,transakParams:r,onError:i}=e,[a,o]=uV.useState(""),s=uV.useCallback((async()=>{try{const{calldata:e,nftData:i,estimatedGasLimit:a,cryptoCurrencyCode:o,excludeFiatCurrencies:s,...c}=r,u=i?.slice(0,1).map((e=>({...e,imageURL:S4e(e.imageURL),nftName:S4e(e.nftName)}))),l={contractId:t,cryptoCurrencyCode:o,calldata:e,nftData:u,estimatedGasLimit:(a>0?a:"30000000").toString()},d=`${W4e[n]}/cryptocoverage/api/v1/public/one-click-protocol/nft-transaction-id`,f=await fetch(d,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!f.ok)throw new Error("Failed to get NFT transaction ID");const{id:p}=await f.json(),h=`${H4e[n]}?`,m=new URLSearchParams({apiKey:G4e[n],environment:V4e[n],isNFT:"true",nftTransactionId:p,themeColor:"0D0D0D",...c});return s&&m.append("excludeFiatCurrencies",s.join(",")),`${h}${m.toString()}`}catch{i?.()}return""}),[t,n,r,i]);return uV.useEffect((()=>{(async()=>{const e=await s();o(e)})()}),[]),{iframeSrc:a}};function K4e(e){const{id:t,type:n,email:r,walletAddress:i,isPassportWallet:a,nftData:o,calldata:s,cryptoCurrencyCode:c,estimatedGasLimit:u,exchangeScreenTitle:l,partnerOrderId:d,excludeFiatCurrencies:f,onOpen:p,onInit:h,onOrderCreated:m,onOrderProcessing:y,onOrderCompleted:b,onOrderFailed:g,onFailedToLoad:v,failedToLoadTimeoutInMs:w,environment:T,contractId:E}=e,A=uV.useRef(null),{onLoad:x,initialised:O}=C3e({userJourney:bPe.SALE,ref:A,walletAddress:i,isPassportWallet:a,onOpen:p,onOrderCreated:m,onOrderProcessing:y,onOrderCompleted:b,onOrderFailed:g,onInit:h,failedToLoadTimeoutInMs:w,onFailedToLoad:v}),{iframeSrc:C}=q4e({type:n,contractId:E,environment:T,transakParams:{nftData:o,calldata:s,cryptoCurrencyCode:c,estimatedGasLimit:u,exchangeScreenTitle:l,email:r,walletAddress:i,partnerOrderId:d,excludeFiatCurrencies:f},onError:v});return Cq("iframe",{id:t,ref:A,src:C,title:"Transak-Iframe",allow:"camera;microphone;fullscreen;payment",style:{height:"100%",width:"100%",border:"none",position:"absolute",top:0,left:0,opacity:O?1:0,transition:"opacity 0.5s ease-out"},onLoad:x,onError:()=>v?.()})}function X4e(e){const{t:t}=_ke(),{onInit:n,onOpen:r,onOrderCreated:i,onOrderProcessing:a,onOrderCompleted:o,onOrderFailed:s}=e,{recipientEmail:c,recipientAddress:u,isPassportWallet:l,signResponse:d,goToErrorView:f,environment:p,orderQuote:h,excludeFiatCurrencies:m}=z4e(),y=d?.transactions.find((e=>e.methodCall.startsWith("execute")));if(!d||!y)return null;const b=uV.useMemo((()=>d.order.products.map((e=>({collectionAddress:e.collectionAddress,imageURL:e.image,nftName:e.name,price:e.amount,quantity:e.qty,tokenID:e.tokenId,nftType:e.contractType||"ERC721"})))),[d]);return Cq(K4e,{id:"transak-iframe",type:"nft-checkout",email:c,walletAddress:u,isPassportWallet:l,exchangeScreenTitle:t("views.PAY_WITH_CARD.screenTitle"),nftData:b,calldata:y.rawData,cryptoCurrencyCode:d.order.currency.name,estimatedGasLimit:y.gasEstimate,partnerOrderId:y.params.reference,excludeFiatCurrencies:m,onInit:n,onOpen:r,onOrderCreated:i,onOrderProcessing:a,onOrderCompleted:o,onOrderFailed:s,onFailedToLoad:()=>{f(E4e.TRANSAK_FAILED)},environment:p,contractId:h.config.contractId})}const Y4e=(e,t)=>({type:e.type,token:e.token,amount:e.fundsRequired.formattedAmount,balance:e.userBalance.formattedBalance,fiat:{symbol:"USD",balance:zRe(e.userBalance.formattedBalance,e.token.symbol,t),amount:zRe(e.fundsRequired.formattedAmount,e.token.symbol,t)}}),Z4e=()=>{const{track:e,page:t}=OPe(),{recipientAddress:n,signResponse:r,paymentMethod:i}=z4e(),{eventTargetState:{eventTarget:a}}=uV.useContext(zqe),o=w4e.PAYMENT_METHODS,s={location:"web",userJourney:bPe.SALE},c={userId:n,paymentMethod:i},u={amount:r?.order.totalAmount,currency:r?.order.currency.name};return{track:e,page:t,sendPageView:(e,n)=>{t({...s,screen:P4e(e),action:"Viewed",extras:{...n}})},sendCloseEvent:(t=o,n="Button",r="Pressed")=>{e({...s,screen:P4e(t),control:"Close",controlType:n,action:r,extras:{...c}}),mKe(a)},sendSuccessEvent:(t=o,n=[],r=[],l={})=>{e({...s,screen:P4e(t),control:"Success",controlType:"Event",action:"Succeeded",extras:{...l,...c,transactions:_4e(n),...u,paymentMethod:i,tokenIds:r}}),((e,t,n=[],r=[],i="")=>{const a=new CustomEvent(kH.IMTBL_SALE_WIDGET_EVENT,{detail:{type:LH.SUCCESS,data:{paymentMethod:t,transactions:n,tokenIds:r,transactionId:i}}});console.log("Sale success event:",a),void 0!==e&&e.dispatchEvent(a)})(a,i,n,r,l.transactionId)},sendFailedEvent:(t,n,r=[],l=o,d={})=>{e({...s,screen:P4e(l||o),control:"Fail",controlType:"Event",action:"Failed",extras:{...d,transactions:_4e(r),...n,...u,...c,paymentMethod:i,reason:t}}),((e,t,n,r,i=[],a="")=>{const o=new CustomEvent(kH.IMTBL_SALE_WIDGET_EVENT,{detail:{type:LH.FAILURE,data:{reason:t,error:n,paymentMethod:r,transactions:i,transactionId:a,timestamp:(new Date).getTime()}}});console.log("Sale failed event:",o),void 0!==e&&e.dispatchEvent(o)})(a,t,n,i,r,d.transactionId)},sendTransactionSuccessEvent:e=>{((e,t,n)=>{const r=new CustomEvent(kH.IMTBL_SALE_WIDGET_EVENT,{detail:{type:LH.TRANSACTION_SUCCESS,data:{paymentMethod:t,transactions:n}}});console.log("Sale transaction success event:",r),void 0!==e&&e.dispatchEvent(r)})(a,i,[e])},sendOrderCreated:(t,n)=>{e({...s,screen:P4e(t),control:"OrderCreated",controlType:"Event",extras:{...n}})},sendSelectedPaymentMethod:(t,n)=>{e({...s,screen:P4e(n),control:"Select",controlType:"MenuItem",extras:{paymentMethod:t}}),((e,t)=>{const n=new CustomEvent(kH.IMTBL_SALE_WIDGET_EVENT,{detail:{type:LH.PAYMENT_METHOD,data:{paymentMethod:t}}});console.log("Sale payment method event:",n),void 0!==e&&e.dispatchEvent(n)})(a,t)},sendSelectedPaymentToken:(t,n,r)=>{const i=Y4e(n,r);e({...s,screen:P4e(t),control:"Select",controlType:"MenuItem",extras:{...i}}),((e,t)=>{const n=new CustomEvent(kH.IMTBL_SALE_WIDGET_EVENT,{detail:{type:LH.PAYMENT_TOKEN,data:{...t}}});console.log("Sale payment token selected event:",n),void 0!==e&&e.dispatchEvent(n)})(a,i)},sendProceedToPay:(t,n,r,i="Button",a="Pressed")=>{e({...s,screen:P4e(t),control:"ProceedToPay",controlType:i,action:a,extras:{...c,...Y4e(n,r)}})},sendViewFeesEvent:(t,n="Button",r="Pressed")=>{e({...s,screen:P4e(t),control:"ViewFees",controlType:n,action:r,extras:{...c}})}}};function J4e(){const{sendPageView:e}=Z4e(),[t,n]=uV.useState(!1),{goBackToPaymentMethods:r,goToErrorView:i,signResponse:a,signTokenIds:o}=z4e(),{sendOrderCreated:s,sendCloseEvent:c,sendSuccessEvent:u}=Z4e(),{t:l}=_ke(),d=(e={})=>{const{id:t,status:n,cryptoAmount:r,cryptoCurrency:i,fiatAmount:s,fiatAmountInUsd:l,amountPaid:d,totalFeeInFiat:f,paymentOptionId:p,userId:h,userKycType:m,walletAddress:y,nftAssetInfo:b}=e,{nftDataBase64:g,quantity:v}=b||{},w={orderId:t,orderStatus:n,cryptoAmount:r,cryptoCurrency:i,fiatAmount:s,fiatAmountInUsd:l,amountPaid:d,totalFeeInFiat:f,paymentOption:p,userId:h,userKycType:m,walletAddress:y,nftDataBase64:g,quantity:v,signData:a,transactionId:a?.transactionId};u(w4e.SALE_SUCCESS,[],o,w),c(w4e.SALE_SUCCESS)};return uV.useEffect((()=>e(w4e.PAY_WITH_CARD)),[]),Cq(_Pe,{header:t&&Cq(xRe,{onCloseButtonClick:()=>r()}),children:Iq(Oq,{children:[Cq(jue,{visible:!t,children:Cq(jue.Content,{children:Cq(jue.Content.LoopingText,{text:[l("views.PAY_WITH_CARD.loading")]})})}),Cq(N3,{style:{display:"block",position:"relative",maxWidth:"420px",height:"565px",borderRadius:"1%",overflow:"hidden",margin:"0 auto",width:"100%"},children:Cq(X4e,{onInit:()=>n(!0),onOrderFailed:()=>{i(E4e.TRANSAK_FAILED)},onOrderCompleted:d,onOrderCreated:(e={})=>{const{id:t,status:n,cryptoAmount:r,cryptoCurrency:i,fiatAmount:o,fiatAmountInUsd:c,amountPaid:u,totalFeeInFiat:l,paymentOptionId:d,userId:f,userKycType:p,walletAddress:h,nftAssetInfo:m}=e,{nftDataBase64:y,quantity:b}=m||{};s(w4e.PAY_WITH_CARD,{orderId:t,orderStatus:n,cryptoAmount:r,cryptoCurrency:i,fiatAmount:o,fiatAmountInUsd:c,amountPaid:u,totalFeeInFiat:l,paymentOption:d,userId:f,userKycType:p,walletAddress:h,nftDataBase64:y,quantity:b,signData:a,transactionId:a?.transactionId})},onOrderProcessing:d})})]})})}var Q4e;!function(e){e.APPROVE="approve(address spender,uint256 amount)",e.EXECUTE="execute(address multicallSigner, bytes32 reference, address[] targets, bytes[] data, uint256 deadline, bytes signature)"}(Q4e||(Q4e={}));const $4e=e=>{switch(e){case Q4e.APPROVE:return"/access_coins.riv";case Q4e.EXECUTE:return"/purchasing_items.riv";default:return""}};var e9e;!function(e){e[e.START=0]="START",e[e.WAITING=1]="WAITING",e[e.PROCESSING=2]="PROCESSING",e[e.COMPLETED=3]="COMPLETED",e[e.ERROR=4]="ERROR"}(e9e||(e9e={}));const t9e={[Q4e.APPROVE]:{url:$4e(Q4e.APPROVE),stateMachine:"State",input:"mode",inputValues:{start:e9e.START,waiting:e9e.WAITING,processing:e9e.PROCESSING,completed:e9e.COMPLETED,error:e9e.ERROR}},[Q4e.EXECUTE]:{url:$4e(Q4e.EXECUTE),stateMachine:"State",input:"mode",inputValues:{start:e9e.START,waiting:e9e.WAITING,processing:e9e.PROCESSING,completed:e9e.COMPLETED,error:e9e.ERROR}}};function n9e(e){const{t:t}=_ke(),{addHandover:n}=DPe({id:NPe.GLOBAL});return{onTxnStepExecuteNextTransaction:uV.useCallback(((r,i)=>{switch(`${r}-${i}`){case`${Q4e.APPROVE}-${O4e.BEFORE}`:n({animationUrl:YRe(e,$4e(Q4e.APPROVE)),inputValue:t9e[Q4e.APPROVE].inputValues.processing,children:Cq(qee,{children:t("views.PAYMENT_METHODS.handover.approve.pending")})});break;case`${Q4e.APPROVE}-${O4e.AFTER}`:n({duration:zPe.MEDIUM,animationUrl:YRe(e,$4e(Q4e.APPROVE)),inputValue:t9e[Q4e.APPROVE].inputValues.completed,children:Cq(qee,{children:t("views.PAYMENT_METHODS.handover.approve.after")})});break;case`${Q4e.EXECUTE}-${O4e.BEFORE}`:n({animationUrl:YRe(e,$4e(Q4e.EXECUTE)),inputValue:t9e[Q4e.EXECUTE].inputValues.waiting,children:Cq(qee,{children:t("views.PAYMENT_METHODS.handover.execute.pending")})});break;case`${Q4e.EXECUTE}-${O4e.AFTER}`:n({animationUrl:YRe(e,$4e(Q4e.EXECUTE)),inputValue:t9e[Q4e.EXECUTE].inputValues.processing,children:Cq(qee,{children:t("views.PAYMENT_METHODS.handover.execute.after")})})}}),[e,n,t]),onTxnStepExecuteAll:uV.useCallback(((r,i)=>{switch(`${r}-${i}`){case`${Q4e.APPROVE}-${O4e.BEFORE}`:n({animationUrl:YRe(e,$4e(Q4e.APPROVE)),inputValue:t9e[Q4e.APPROVE].inputValues.waiting,children:Cq(qee,{children:t("views.PAYMENT_METHODS.handover.approve.before")})});break;case`${Q4e.APPROVE}-${O4e.AFTER}`:n({animationUrl:YRe(e,$4e(Q4e.APPROVE)),inputValue:t9e[Q4e.APPROVE].inputValues.completed,children:Cq(qee,{children:t("views.PAYMENT_METHODS.handover.approve.after")})});break;case`${Q4e.EXECUTE}-${O4e.BEFORE}`:n({animationUrl:YRe(e,$4e(Q4e.EXECUTE)),inputValue:t9e[Q4e.EXECUTE].inputValues.waiting,children:Cq(qee,{children:t("views.PAYMENT_METHODS.handover.execute.before")})});break;case`${Q4e.EXECUTE}-${O4e.AFTER}`:n({duration:zPe.MEDIUM,animationUrl:YRe(e,$4e(Q4e.EXECUTE)),inputValue:t9e[Q4e.EXECUTE].inputValues.processing,children:Cq(qee,{children:t("views.PAYMENT_METHODS.handover.execute.after")})})}}),[e,n,t])}}function r9e({headingText:e,subheadingText:t,primaryButtonText:n,onPrimaryButtonClick:r,secondaryButtonText:i,onSecondaryButtonClick:a}){return Iq(N3,{sx:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[Iq(N3,{children:[Cq(qee,{sx:{paddingBottom:"base.spacing.x4"},children:e}),Cq(tee,{size:"small",sx:{textAlign:"center",color:"base.color.text.body.secondary"},children:t})]}),Iq(N3,{children:[n&&r&&Cq(N3,{sx:{paddingBottom:"base.spacing.x2"},children:Cq(O3,{sx:{width:"100%"},variant:"primary",size:"large",testId:"handover-primary-button",onClick:r,children:n})}),i&&a&&Cq(N3,{sx:{paddingBottom:"base.spacing.x4"},children:Cq(O3,{sx:{width:"100%"},variant:"tertiary",size:"large",testId:"handover-secondary-button",onClick:a,children:i})})]})]})}const i9e={[Q4e.APPROVE]:{headingTextKey:"views.PAYMENT_METHODS.handover.approve.beforeWithCta.heading",ctaButtonTextKey:"views.PAYMENT_METHODS.handover.approve.beforeWithCta.ctaButton",animationUrl:$4e(Q4e.APPROVE),inputValue:e9e.WAITING},[Q4e.EXECUTE]:{headingTextKey:"views.PAYMENT_METHODS.handover.execute.beforeWithCta.heading",ctaButtonTextKey:"views.PAYMENT_METHODS.handover.execute.beforeWithCta.ctaButton",animationUrl:$4e(Q4e.EXECUTE),inputValue:e9e.START}};function a9e(){const e=uV.useRef(!1),t=uV.useRef(null),{t:n}=_ke(),{sendPageView:r,sendTransactionSuccessEvent:i,sendFailedEvent:a,sendCloseEvent:o,sendSuccessEvent:s}=Z4e(),{executeAll:c,executeNextTransaction:u,signResponse:l,filteredTransactions:d,currentTransactionIndex:f,executeResponse:p,signTokenIds:h,environment:m,provider:y,goToErrorView:b}=z4e(),{onTxnStepExecuteNextTransaction:g,onTxnStepExecuteAll:v}=n9e(m),{addHandover:w}=DPe({id:NPe.GLOBAL}),T=uV.useCallback((async()=>{c(l,(e=>{i(e)}),((e,t)=>{const n={transactionId:l?.transactionId};a(e.toString(),e,t,void 0,n),b(e.type,e.data)}),v)}),[l,m]),E=uV.useCallback((()=>{const e=d[f],t=i9e[e.methodCall],r=n(t.headingTextKey)||"",o=n(t.ctaButtonTextKey)||"";w({animationUrl:YRe(m,t.animationUrl),inputValue:t.inputValue,children:Cq(r9e,{headingText:r,primaryButtonText:o,onPrimaryButtonClick:()=>{try{u((e=>{i(e)}),((e,t)=>{const n={transactionId:l?.transactionId};a(e.toString(),e,t,void 0,n),b(e.type,e.data)}),g)}catch(e){b(E4e.SERVICE_BREAKDOWN,{error:e})}}})})}),[d,f,l,m]);return uV.useEffect((()=>r(w4e.PAY_WITH_COINS)),[]),uV.useEffect((()=>{if(!y||0===d.length)return;const e=f<d.length&&t.current!==f;fNe(y)&&e&&(t.current=f,E())}),[d,f,y]),uV.useEffect((()=>{l&&y&&!e.current&&(fNe(y)||(e.current=!0,T()))}),[l,y]),uV.useEffect((()=>{if(p?.done){const e={transactionId:l?.transactionId};w({duration:zPe.MEDIUM,animationUrl:YRe(m,$4e(Q4e.EXECUTE)),inputValue:e9e.COMPLETED,children:Cq(qee,{sx:{px:"base.spacing.x6"},children:n("views.PAYMENT_METHODS.handover.success")}),onClose:()=>{s(w4e.SALE_SUCCESS,p?.transactions,h,e),o(w4e.SALE_SUCCESS)}})}}),[p]),null}function o9e({type:e,onClick:t,disabled:n=!1,caption:r,size:i,rc:a=Cq("span",{})}){const{t:o}=_ke(),s={[jH.CRYPTO]:"Coins",[jH.DEBIT]:"BankCard",[jH.CREDIT]:"BankCard"};return Iq(oae,{rc:a,size:i||"medium",sx:{marginBottom:"base.spacing.x1",userSelect:"none",...n&&{filter:"opacity(0.5)",cursor:"not-allowed !important"}},...{disabled:n,emphasized:!0,onClick:n?void 0:()=>t(e)},children:[Cq(oae.FramedIcon,{icon:s[e]}),Cq(oae.Label,{size:"medium",children:o(`views.PAYMENT_METHODS.options.${e}.heading`)}),!n&&Cq(oae.IntentIcon,{}),Cq(oae.Caption,{children:r||o(`views.PAYMENT_METHODS.options.${e}.${n?"disabledCaption":"caption"}`)})]})}const s9e=[jH.CRYPTO,jH.DEBIT,jH.CREDIT];function c9e(e){const{disabledOptions:t=[],paymentOptions:n,onClick:r,captions:i,size:a,hideDisabledOptions:o}=e,s=uV.useMemo((()=>(n||s9e).filter((e=>!o||!t.includes(e)))),[n,t,o]);return Cq(N3,{testId:"payment-options-list",sx:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start"},rc:Cq(D0.div,{variants:uqe,initial:"hidden",animate:"show"}),children:s.map(((e,n)=>Cq(o9e,{type:e,size:a,onClick:r,disabled:t.includes(e),caption:i?.[e],rc:Cq(D0.div,{custom:n,variants:lqe})},`payment-type-${e}`)))})}function u9e(){const{t:e}=_ke(),{viewDispatch:t}=uV.useContext(ERe),{sign:n,goToErrorView:r,paymentMethod:i,setPaymentMethod:a,invalidParameters:o,disabledPaymentTypes:s,hideExcludedPaymentTypes:c}=z4e(),{sendPageView:u,sendCloseEvent:l,sendSelectedPaymentMethod:d}=Z4e();return uV.useEffect((()=>{i&&d(i,w4e.PAYMENT_METHODS),i&&[jH.DEBIT,jH.CREDIT].includes(i)&&(n(A4e.FIAT,void 0,(()=>{t({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.PAY_WITH_CARD}}})})),t({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.LOADING_VIEW,data:{loadingText:e("views.PAYMENT_METHODS.loading.ready1")}}}})),i&&i===jH.CRYPTO&&t({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.ORDER_SUMMARY,subView:T4e.INIT}}})}),[i]),uV.useEffect((()=>u(w4e.PAYMENT_METHODS)),[]),uV.useEffect((()=>{o&&r(E4e.INVALID_PARAMETERS)}),[o]),Cq(_Pe,{testId:"payment-methods",header:Cq(xRe,{onCloseButtonClick:()=>l(w4e.PAYMENT_METHODS)}),footer:Cq(oNe,{}),children:Iq(N3,{sx:{display:"flex",flexDirection:"column",paddingX:"base.spacing.x2",paddingY:"base.spacing.x8",rowGap:"base.spacing.x4"},children:[Cq(qee,{size:"small",sx:{paddingX:"base.spacing.x4"},children:e("views.PAYMENT_METHODS.header.heading")}),Cq(N3,{sx:{paddingX:"base.spacing.x2"},children:Cq(c9e,{hideDisabledOptions:c,disabledOptions:s,onClick:e=>{a(e)}})})]})})}function l9e({biomeTheme:e,transactionHash:t,blockExplorerLink:n,errorType:r}){const{t:i}=_ke(),{goBackToPaymentMethods:a,executeNextTransaction:o,signResponse:s,environment:c,provider:u}=z4e(),{sendTransactionSuccessEvent:l,sendFailedEvent:d}=Z4e(),{viewDispatch:f}=uV.useContext(ERe),{eventTargetState:{eventTarget:p}}=uV.useContext(zqe),{addHandover:h,closeHandover:m}=DPe({id:NPe.GLOBAL}),{onTxnStepExecuteNextTransaction:y}=n9e(c),[b,g]=uV.useState(r),v=()=>{mKe(p)},w=()=>{try{o((e=>{l(e),f({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.PAY_WITH_COINS}}})}),((e,t)=>{const n={transactionId:s?.transactionId};d(e.toString(),e,t,void 0,n),g(E4e.TRANSACTION_FAILED)}),y)}catch(e){g(E4e.SERVICE_BREAKDOWN)}},T={[E4e.TRANSACTION_FAILED]:{onActionClick:()=>{m(),a()},onSecondaryActionClick:t?()=>{window.open(n)}:v,statusType:_qe.FAILURE,statusIconStyles:{fill:e.color.status.fatal.dim}},[E4e.SERVICE_BREAKDOWN]:{onSecondaryActionClick:v,statusType:_qe.INFORMATION,statusIconStyles:{fill:e.color.status.fatal.dim}},[E4e.PRODUCT_NOT_FOUND]:{onSecondaryActionClick:v,statusType:_qe.INFORMATION,statusIconStyles:{fill:e.color.status.fatal.dim}},[E4e.INSUFFICIENT_STOCK]:{onSecondaryActionClick:v,statusType:_qe.INFORMATION,statusIconStyles:{fill:e.color.status.fatal.dim}},[E4e.TRANSAK_FAILED]:{onActionClick:()=>{m(),a()},onSecondaryActionClick:v,statusType:_qe.INFORMATION},[E4e.WALLET_FAILED]:{onActionClick:()=>{fNe(u)?w():(m(),a())},onSecondaryActionClick:v,statusType:_qe.INFORMATION,statusIconStyles:{fill:e.color.status.fatal.dim}},[E4e.WALLET_REJECTED_NO_FUNDS]:{onActionClick:()=>{m(),a()},onSecondaryActionClick:v,statusType:_qe.INFORMATION},[E4e.WALLET_REJECTED]:{onActionClick:()=>{fNe(u)?w():(m(),a())},onSecondaryActionClick:v,statusType:_qe.INFORMATION},[E4e.WALLET_POPUP_BLOCKED]:{onActionClick:()=>{fNe(u)?w():(m(),a())},onSecondaryActionClick:v,statusType:_qe.INFORMATION},[E4e.FUNDING_ROUTE_EXECUTE_ERROR]:{onActionClick:()=>{m(),a()},onSecondaryActionClick:v,statusType:_qe.INFORMATION},[E4e.INVALID_PARAMETERS]:{onSecondaryActionClick:v,statusType:_qe.ALERT,statusIconStyles:{fill:e.color.status.attention.dim,transform:"none"}},[E4e.DEFAULT]:{onActionClick:()=>{m(),a()},onSecondaryActionClick:v,statusType:_qe.INFORMATION}},E=()=>{const e=T[b||E4e.DEFAULT]||{},n=b===E4e.TRANSACTION_FAILED&&t?i(`views.SALE_FAIL.errors.${b}.secondaryAction`):i(`views.SALE_FAIL.errors.${E4e.DEFAULT}.secondaryAction`);return{headingText:i("views.PAYMENT_METHODS.handover.error.heading"),subheadingText:i(`views.SALE_FAIL.errors.${b}.description`),primaryButtonText:i(`views.SALE_FAIL.errors.${b}.primaryAction`),onPrimaryButtonClick:e?.onActionClick,secondaryButtonText:n,onSecondaryButtonClick:e?.onSecondaryActionClick}};return uV.useEffect((()=>{c&&b&&h({animationUrl:YRe(c,$4e(Q4e.APPROVE)),inputValue:e9e.ERROR,children:Cq(r9e,{...E()})})}),[b,c]),null}function d9e({balance:e,conversions:t,canOpen:n,onClick:r,onProceed:i,loading:a,priceDisplay:o}){const{t:s}=_ke(),{environment:c,config:{theme:u}}=z4e(),{token:l,userBalance:d,fundsRequired:f}=e.fundingItem,p=zRe(f.formattedAmount,l.symbol,t,""),h=zRe(d.formattedBalance,l.symbol,t,"");return Iq(j3,{sx:{w:"100%",bradtl:"base.borderRadius.x6",bradtr:"base.borderRadius.x6",px:"base.spacing.x4",pb:"base.spacing.x6",bg:"base.color.neutral.800",border:"0px solid transparent",borderTopWidth:"base.border.size.100",borderTopColor:"base.color.translucent.emphasis.400"},children:[Iq(oae,{size:"medium",children:[Cq(oae.FramedImage,{circularFrame:!0,use:Cq(a2e,{environment:c,theme:u,name:l.name,src:l.icon})}),Cq(oae.Label,{children:s(`views.ORDER_SUMMARY.orderReview.payWith.${e.type}`,{symbol:l.symbol})}),Cq(oae.Caption,{rc:Cq(qee,{size:"xSmall"}),children:`${s("views.ORDER_SUMMARY.orderReview.balance",{amount:Nee(VRe(d.formattedBalance))})} ${h?s("views.ORDER_SUMMARY.currency.fiat",{amount:Nee(VRe(h))}):""}`}),o&&Cq(oae.PriceDisplay,{use:Cq(qee,{size:"xSmall"}),fiatAmount:p?s("views.ORDER_SUMMARY.currency.fiat",{amount:p}):void 0,price:VRe(f.formattedAmount)}),n&&Cq(oae.StatefulButtCon,{icon:"ChevronExpand",onClick:r}),!n&&a&&Cq(zue,{radius:"base.icon.size.400"})]}),Cq(O3,{size:"large",onClick:()=>i(e),children:s("views.ORDER_SUMMARY.orderReview.continue")})]})}const f9e=(e,t)=>e.filter((e=>e.amount.gt(0)&&e.token)).reduce(((e,n)=>{if(!n.token)return e;const r={...n.token,address:n.token.address||"",symbol:n.token.symbol||t?.symbol||""},i=$Re(r.address,"...").toLowerCase(),a=r.symbol||i;if(!a)return e;if(e[a]){const t=e[a].amount.add(n.amount);return{...e,[a]:{...e[a],amount:t,formattedAmount:Xd(t,r.decimals)}}}return a?{...e,[a]:{...n,token:r,formattedAmount:Xd(n.amount,r.decimals)}}:e}),{}),p9e=e=>{if(e.type!==sW.SWAP)return{};const t=[e.fees.approvalGasFee,e.fees.swapGasFee,...e.fees.swapFees];return f9e(t,e.fundingItem.token)},h9e=(e,t,n)=>{const r=[];if(e.type!==sW.SWAP)return[];const i=(e,i,a="~ ")=>{if(e.amount.gt(0)){const o=Xd(e.amount,e?.token?.decimals);r.push({label:i,fiatAmount:`≈ ${n("drawers.feesBreakdown.fees.fiatPricePrefix")}${zRe(o,e.token?.symbol||"",t,"-.--",4)}`,amount:`${VRe(o)}`,prefix:a,token:e?.token})}};i(e.fees.swapGasFee,n("drawers.feesBreakdown.fees.swapGasFee.label")),i(e.fees.approvalGasFee,n("drawers.feesBreakdown.fees.approvalFee.label"));return Object.entries(f9e(e.fees.swapFees,e.fundingItem.token)).forEach((([,e])=>{const t=e?.basisPoints??0;i(e,n("drawers.feesBreakdown.fees.swapSecondaryFee.label",{amount:t?t/100+"%":""}),"")})),r};function m9e({rc:e=Cq("span",{}),balance:t,conversions:n,selected:r,onClick:i,size:a,environment:o,theme:s}){const{t:c}=_ke(),{token:u,userBalance:l}=t.fundingItem,d=zRe(l.formattedBalance,u.symbol,n,""),f=Object.entries(p9e(t));return Iq(oae,{rc:e,sx:{mb:"base.spacing.x1"},size:a,emphasized:!0,...{onClick:i,selected:r},children:[Cq(oae.FramedImage,{circularFrame:!0,alt:u.name,use:Cq(a2e,{environment:o,theme:s,name:u.name,src:u.icon})}),Cq(oae.PriceDisplay,{use:Cq(qee,{size:"xSmall"}),fiatAmount:d?c("views.ORDER_SUMMARY.currency.fiat",{amount:d}):void 0,price:VRe(l.formattedBalance)}),Cq(oae.Label,{sx:{display:"flex",wordBreak:"default"},children:u.symbol}),Cq(oae.Caption,{children:f.length>0&&f.map((([e,{token:t,formattedAmount:n}])=>Cq(N3,{rc:Cq("span",{}),sx:{d:"block"},children:c("views.ORDER_SUMMARY.coinsDrawer.fee",{symbol:t?.symbol||e,amount:Nee(VRe(n))})},e)))})]})}function y9e({conversions:e,balances:t,selectedIndex:n,visible:r,loading:i,transactionRequirement:a,onClose:o,onSelect:s,onPayWithCard:c,disabledPaymentTypes:u,theme:l,environment:d}){const{t:f}=_ke(),p=e=>()=>{s(e),o()};let h="medium";t.length>3&&(h="small");const m=[jH.DEBIT,jH.CREDIT],y=!m.every((e=>u?.includes(e)));return Cq(wne,{size:"full",visible:r,showHeaderBar:!0,onCloseDrawer:o,headerBarTitle:f("views.ORDER_SUMMARY.coinsDrawer.header"),children:Cq(wne.Content,{rc:Cq(D0.div,{variants:uqe,initial:"hidden",animate:"show"}),children:Iq(N3,{sx:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between",px:"base.spacing.x4"},children:[Iq(N3,{children:[Iq(N3,{sx:{display:"flex",justifyContent:"space-between",mb:"base.spacing.x2"},children:[Cq(dse,{size:"small",children:f("views.ORDER_SUMMARY.coinsDrawer.caption1")}),Cq(dse,{size:"small",children:f("views.ORDER_SUMMARY.coinsDrawer.caption2")})]}),t?.map(((t,r)=>Cq(m9e,{onClick:p(r),balance:t,selected:n===r,conversions:e,transactionRequirement:a,size:h,theme:l,environment:d,rc:Cq(D0.div,{variants:lqe,custom:r})},`${t.fundingItem.token.symbol}-${t.type}`))),i&&Cq(D0.div,{variants:lqe,custom:t.length,children:Cq(oae,{shimmer:!0,emphasized:!0,size:h,testId:"funding-balance-item-shimmer"})},"funding-balance-item-shimmer")]}),c&&Iq(N3,{sx:{pb:"base.spacing.x4"},rc:Cq(D0.div,{variants:lqe,custom:t.length+(i?1:0)}),children:[y&&Cq(X3,{size:"small",rc:Cq(dse,{}),sx:{my:"base.spacing.x4"},children:f("views.ORDER_SUMMARY.coinsDrawer.divider")}),Cq(c9e,{onClick:c,size:h,hideDisabledOptions:!0,paymentOptions:m,disabledOptions:u,captions:{[jH.DEBIT]:f("views.PAYMENT_METHODS.options.debit.caption"),[jH.CREDIT]:f("views.PAYMENT_METHODS.options.credit.caption")}})]})]})})})}function b9e({item:e,balance:t,pricing:n,conversions:r,size:i,sx:a,rc:o=Cq("span",{})}){const{t:s}=_ke(),{token:c}=t.fundingItem,u=n?.amount||0,l=zRe(u.toString(),c.symbol,r);return Iq(oae,{rc:o,emphasized:!0,size:i||"medium",sx:{pointerEvents:"none",mb:"base.spacing.x1",...a},children:[Cq(oae.FramedImage,{use:Cq(a2e,{src:e.image,name:e.name,defaultImage:e.image})}),Cq(oae.Label,{children:e.name}),Cq(oae.Caption,{children:s("views.ORDER_SUMMARY.orderItem.quantity",{qty:e.qty})}),u>0&&Cq(oae.PriceDisplay,{use:Cq(qee,{size:"xSmall"}),price:s("views.ORDER_SUMMARY.currency.price",{symbol:c.symbol,amount:VRe(u)}),fiatAmount:s("views.ORDER_SUMMARY.currency.fiat",{amount:l})})]},e.name)}const g9e=(e,t,n)=>{if(!t)return;const r=e.toLowerCase(),i=BRe[r]?.toLowerCase(),a=Object.values(t).find((e=>[r,i].includes(e.currency.toLowerCase())));if(a)return a;const o=n.get(r)||n.get(i);return o&&t.USDC?{currency:e,type:t.USDC.type,amount:t.USDC.amount/o}:void 0},v9e={mb:"0",bradbl:"0",bradbr:"0"};function w9e({items:e,balance:t,pricing:n,conversions:r,children:i}){return Iq(N3,{rc:Cq(D0.div,{variants:uqe,initial:"hidden",animate:"show"}),children:[e.map(((a,o)=>Cq(b9e,{item:a,balance:t,conversions:r,size:e.length>=3?"small":"medium",pricing:g9e(t.fundingItem.token.symbol,n?.[a.productId]?.pricing,r),sx:o===e.length-1&&i?v9e:void 0,rc:Cq(D0.div,{variants:lqe,custom:o})},a.name))),i]})}function T9e({sx:e,swapFees:t,onFeesClick:n}){return Cq(A2e,{gasFeeFiatValue:t.fiatAmount,gasFeeToken:t.token,gasFeeValue:t.amount,fees:t.formattedFees,onFeesClick:n,sx:e,loading:!1})}function E9e({fundingBalances:e,conversions:t,collectionName:n,loadingBalances:r,transactionRequirement:i,onBackButtonClick:a,onPayWithCard:o,onProceedToBuy:s}){const{eventTargetState:{eventTarget:c}}=uV.useContext(zqe),{t:u}=_ke(),{provider:l,items:d,orderQuote:f,disabledPaymentTypes:p,config:{theme:h,environment:m}}=z4e(),{sendSelectedPaymentToken:y,sendViewFeesEvent:b,sendPageView:g}=Z4e(),[v,w]=uV.useState(!1),[T,E]=uV.useState(0),[A,x]=uV.useState({token:void 0,amount:"",fiatAmount:"",formattedFees:[]}),O=uV.useMemo((()=>e[T]),[e,T,l]);uV.useEffect((()=>{if(!t?.size||!l)return;if(O.type!==sW.SWAP)return;const[[,e]]=Object.entries(p9e(O));e&&e.token&&x({token:e.token,amount:e.formattedAmount,fiatAmount:zRe(e.formattedAmount,e.token.symbol,t),formattedFees:h9e(O,t,u)})}),[O,t,l]),b8e((()=>{const r=e.map((({fundingItem:e})=>Y4e(e,t)));g(w4e.ORDER_SUMMARY,{subView:T4e.REVIEW_ORDER,tokens:r,items:d,collectionName:n})}),(()=>Boolean(d.length&&e.length&&!r&&t.size)),[d,e,r,t]);const C=d.length>1,I=!r&&O.type===sW.SWAP;return Iq(_Pe,{testId:"order-review",header:Cq(xRe,{showBack:!0,onCloseButtonClick:()=>mKe(c),onBackButtonClick:a,title:n}),bodyStyleOverrides:{display:"flex",flexDirection:"column",justifyContent:"space-between",height:"0"},children:[Cq(qee,{size:"small",sx:{px:"base.spacing.x4",pb:"base.spacing.x4"},children:u("views.ORDER_SUMMARY.orderReview.heading")}),Cq(N3,{sx:{display:"flex",flexDirection:"column",px:"base.spacing.x2",pb:"base.spacing.x8",flex:1,maxh:I?"45%":"60%",overflowY:"scroll",scrollbarWidth:"none",rowGap:"base.spacing.x4"},children:Cq(N3,{sx:{px:"base.spacing.x2"},children:Cq(w9e,{items:d,balance:O,pricing:f.products,conversions:t,children:!C&&I&&Cq(T9e,{swapFees:A,sx:{bradtl:"0",bradtr:"0",brad:"base.borderRadius.x6",border:"0px solid transparent",borderTopWidth:"base.border.size.200",borderTopColor:"base.color.translucent.inverse.1000"},onFeesClick:()=>b(w4e.ORDER_SUMMARY)})})})}),C&&I&&Cq(T9e,{swapFees:A,sx:{mb:"-12px",bradtl:"base.borderRadius.x6",bradtr:"base.borderRadius.x6",border:"0px solid transparent",borderTopWidth:"base.border.size.100",borderTopColor:"base.color.translucent.emphasis.400"},onFeesClick:()=>b(w4e.ORDER_SUMMARY)}),Cq(d9e,{onClick:()=>{w(!0)},onProceed:s,balance:O,conversions:t,canOpen:e.length>1,loading:r,priceDisplay:d.length>1}),Cq(y9e,{conversions:t,balances:e,onSelect:n=>{E(n);const{fundingItem:r}=e[n];y(T4e.REVIEW_ORDER,r,t)},onClose:()=>{w(!1)},selectedIndex:T,visible:v,loading:r,onPayWithCard:o,transactionRequirement:i,disabledPaymentTypes:p,theme:h,environment:m})]})}const A9e=(e,t)=>{const n=KRe(e.address)?e.symbol:e.address??"";return{...e,icon:JRe(t,n)}},x9e=(e,t)=>{return{type:x4e.SUFFICIENT,fundingItem:{type:nW.ERC20,token:A9e((n=e,n.current.type!==nW.ERC721&&n.current.token),t),fundsRequired:{amount:e.required.balance,formattedAmount:e.required.formattedBalance},userBalance:{balance:e.current.balance,formattedBalance:e.current.formattedBalance}}};var n},O9e=(e,t)=>{if(0===e.length)return[];const n=e.filter((e=>1===e.steps.length)),r=[nW.ERC20,nW.NATIVE];return n.flatMap((e=>e.steps.filter((e=>r.includes(e.fundingItem.type))))).map((e=>({...e,fundingItem:{...e.fundingItem,token:A9e(e.fundingItem.token,t)}})))},C9e=e=>{let t=[];const n=(r=e.name,(e,t)=>{const n=e.fundingItem&&e.fundingItem.token&&e.fundingItem.token.symbol===r?-1:0,i=t.fundingItem&&t.fundingItem.token&&t.fundingItem.token.symbol===r?-1:0;return n!==i?n-i:e.type===x4e.SUFFICIENT&&t.type===x4e.SUFFICIENT?0:e.type===x4e.SUFFICIENT?-1:t.type===x4e.SUFFICIENT?1:0});var r;return e=>(0===e.length||(t=Array.from(new Set([...t,...e])).sort(n)),t)},I9e=e=>({...e,amount:jr.from(0),formattedAmount:"0"}),_9e=(e,t)=>e.map((e=>((e,t)=>{if(e.type!==sW.SWAP)return e;if(!bNe(t))return e;const n={...e.fees,approvalGasFee:I9e(e.fees.approvalGasFee),swapGasFee:I9e(e.fees.swapGasFee)};return{...e,fees:n}})(e,t))),P9e=async e=>{const{provider:t,checkout:n,currencies:r,baseCurrency:i,onFundingBalance:a,getAmountByCurrency:o,getIsGasless:s,onComplete:c,onFundingRequirement:u}=e,l=t?.getSigner(),d=await(l?.getAddress())||"",f=n.config.environment,p=C9e(i),h=e=>{Array.isArray(e)&&e.length>0&&a(p(_9e(e,t)))},m=e=>eNe(e,i.name),y=r.map((async e=>{const r=o(e);if(!r)return null;const i=((e,t,n)=>[{type:nW.ERC20,tokenAddress:n,spenderAddress:t,amount:e}])(r,d,e.address),a=s()?void 0:{type:rW.GAS,gasToken:{type:iW.NATIVE,limit:jr.from("30000000")}};return{currency:e,smartCheckoutResult:await n.smartCheckout({provider:t,itemRequirements:i,transactionOrGasAmount:a,routingOptions:{bridge:!1,onRamp:!1,swap:!0},fundingRouteFullAmount:!0,onComplete:m(e.name)?()=>{c?.(p([]))}:void 0,onFundingRoute:m(e.name)?e=>{h(O9e([e],f))}:void 0})}})).filter(Boolean),b=await(async(e,t)=>{const n=e.map((async e=>{const n=await e;return t(n),n}));return await Promise.all(n)})(y,(({currency:e,smartCheckoutResult:t})=>{if(m(e.name)){const e=t.transactionRequirements[0];u(e)}t.sufficient&&h(((e,t)=>{if(!0===e.sufficient){const n=e.transactionRequirements.find((e=>e.type===nW.ERC20));if(n&&n.type===nW.ERC20)return[x9e(n,t)]}return!1===e.sufficient&&e?.router?.routingOutcome.type===aW.ROUTES_FOUND?O9e(e.router.routingOutcome.fundingRoutes,t):null})(t,f))}));return b},S9e=()=>{const e=uV.useRef(!1),{fromTokenAddress:t,orderQuote:n,provider:r,checkout:i,selectedCurrency:a}=z4e(),{cryptoFiatState:o}=uV.useContext($6e),[s,c]=uV.useState(),[u,l]=uV.useState([]),[d,f]=uV.useState([]),[p,h]=uV.useState(!1);return{fundingBalances:u,loadingBalances:p,fundingBalancesResult:d,transactionRequirement:s,queryFundingBalances:()=>{t&&r&&i&&n&&a&&(e.current||p||(async()=>{e.current=!0,h(!0);try{const e=await P9e({provider:r,checkout:i,currencies:n.currencies,routingOptions:{bridge:!1,onRamp:!1,swap:!0},baseCurrency:a,getAmountByCurrency:e=>{const t=g9e(e.name,n.totalAmount,o.conversions);return t?t.amount.toString():""},getIsGasless:()=>r.provider?.isPassport||!1,onFundingBalance:e=>{l([...e])},onComplete:()=>{h(!1)},onFundingRequirement:e=>{c(e)}});f(e)}catch{h(!1)}finally{e.current=!1}})())}}},k9e=e=>{if(e&&e.current.type!==nW.ERC721)return e.current.token},R9e=e=>{const t=e.find((({type:e})=>e===nW.NATIVE)),n=e.find((({type:e})=>e===nW.ERC20)),r={erc20:{value:n?.delta.formattedBalance,symbol:k9e(n)?.symbol},native:{value:t?.delta.formattedBalance,symbol:k9e(t)?.symbol}};let i=["views.PAYMENT_METHODS.topUp.subheading.erc20",r],a=n?.delta.formattedBalance||"0",o=k9e(n)?.address;return t&&n&&!t.sufficient&&!n.sufficient&&(i=["views.PAYMENT_METHODS.topUp.subheading.both",r]),t&&n&&!t.sufficient&&n.sufficient&&(a=t?.delta.formattedBalance||"0",o=k9e(t)?.address,i=["views.PAYMENT_METHODS.topUp.subheading.native",r]),{heading:["views.PAYMENT_METHODS.topUp.heading"],subheading:i,amount:a,tokenAddress:o}};class N9e{url;ttl;env;cacheMap;setCache(e,t){this.cacheMap[e]={data:t,ttl:(new Date).getTime()+1e3*this.ttl}}getCache(e){const t=this.cacheMap[e];return!t||t.ttl<=(new Date).getTime()?null:t.data}constructor(e){this.env=e.env,this.url=`${mW[this.env]}/checkout`,this.cacheMap={},this.ttl=void 0!==e.ttl?e.ttl:60}static isHttpError=e=>"code"in e;async getTransactions(e){const{txType:t,fromAddress:n}=e;try{const e=`${this.url}/v1/transactions?from_address=${n}&tx_type=${t}`,r=this.getCache(e);if(r)return Promise.resolve(r);const i=await ze.get(e);if(i.status>=400)return Promise.reject({code:i.status,message:i.statusText});const{data:a}=i;return this.setCache(e,a),Promise.resolve(a)}catch(e){let t=et.InternalServerError,n="InternalServerError";return ze.isAxiosError(e)&&(t=e.response?.status||t,n=e.message),Promise.reject({code:t,message:n})}}}var M9e;!function(e){e.BRIDGE="bridge"}(M9e||(M9e={}));const D9e={IN_PROGRESS:"in_progress",WITHDRAWAL_PENDING:"withdrawal_pending"},L9e={web3Provider:null,walletProviderName:null,from:null,to:null,tokenBridge:null,tokenBalances:[],allowedTokens:[],token:null,amount:"0"};var j9e;!function(e){e.SET_WALLETS_AND_NETWORKS="SET_WALLETS_AND_NETWORKS",e.SET_WALLET_PROVIDER_NAME="SET_WALLET_PROVIDER_NAME",e.SET_PROVIDER="SET_PROVIDER",e.SET_TOKEN_BRIDGE="SET_TOKEN_BRIDGE",e.SET_TOKEN_BALANCES="SET_TOKEN_BALANCES",e.SET_ALLOWED_TOKENS="SET_ALLOWED_TOKENS",e.SET_TOKEN_AND_AMOUNT="SET_TOKEN_AND_AMOUNT"}(j9e||(j9e={}));const F9e=uV.createContext({bridgeState:{...L9e,checkout:{}},bridgeDispatch:()=>{}});F9e.displayName="BridgeContext";const B9e=(e,t)=>{switch(t.payload.type){case j9e.SET_WALLETS_AND_NETWORKS:return{...e,from:t.payload.from,to:t.payload.to};case j9e.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case j9e.SET_PROVIDER:return{...e,web3Provider:t.payload.web3Provider};case j9e.SET_TOKEN_BRIDGE:return{...e,tokenBridge:t.payload.tokenBridge};case j9e.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case j9e.SET_ALLOWED_TOKENS:return{...e,allowedTokens:t.payload.allowedTokens};case j9e.SET_TOKEN_AND_AMOUNT:return{...e,token:t.payload.token,amount:t.payload.amount};default:return e}},U9e=(e,t)=>{const n=new CustomEvent(kH.IMTBL_BRIDGE_WIDGET_EVENT,{detail:{type:FH.TRANSACTION_SENT,data:{transactionHash:t}}});console.log("bridge success ",e,n),void 0!==e&&e.dispatchEvent(n)},z9e=(e,t)=>{const n=new CustomEvent(kH.IMTBL_BRIDGE_WIDGET_EVENT,{detail:{type:FH.FAILURE,data:{reason:t,timestamp:(new Date).getTime()}}});console.log("bridge failed ",e,n),void 0!==e&&e.dispatchEvent(n)};function H9e(e){const t=new CustomEvent(kH.IMTBL_BRIDGE_WIDGET_EVENT,{detail:{type:FH.CLOSE_WIDGET,data:{}}});console.log("bridge close ",e,t),void 0!==e&&e.dispatchEvent(t)}const W9e=(e,t)=>{const n=new CustomEvent(kH.IMTBL_BRIDGE_WIDGET_EVENT,{detail:{type:FH.CLAIM_WITHDRAWAL_SUCCESS,data:{transactionHash:t}}});console.log("bridge claim withdrawal success event:",e,n),void 0!==e&&e.dispatchEvent(n)},V9e=(e,t,n)=>{const r=new CustomEvent(kH.IMTBL_BRIDGE_WIDGET_EVENT,{detail:{type:FH.CLAIM_WITHDRAWAL_FAILURE,data:{transactionHash:t,reason:n,timestamp:(new Date).getTime()}}});console.log("bridge claim withdrawal failed event:",e,r),void 0!==e&&e.dispatchEvent(r)};function G9e(){return Iq(j3,{sx:{gap:"base.spacing.x2"},children:[Cq(z7,{sx:{h:"base.spacing.x4",w:"base.spacing.x32",mt:"base.spacing.x2"}}),Cq(oae,{shimmer:!0,emphasized:!0,size:"small"}),Cq(oae,{shimmer:!0,emphasized:!0,size:"small"}),Cq(oae,{shimmer:!0,emphasized:!0,size:"small"})]})}const q9e={px:"base.spacing.x4",display:"flex",flexDirection:"column",height:"100%"},K9e={flexGrow:"1",flexShrink:"0",flexBasis:"0"},X9e={flexGrow:"0",flexShrink:"1",mt:"base.spacing.x2"},Y9e={bg:"base.color.translucent.emphasis.100",borderRadius:"base.borderRadius.x4",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",height:"100%",px:"base.spacing.x5"};function Z9e({openWalletDrawer:e}){const{t:t}=_ke();return Iq(N3,{sx:Y9e,children:[Cq(tee,{sx:{mb:"base.spacing.x8"},children:t("views.TRANSACTIONS.status.emptyState.notConnected.body")}),Cq(O3,{variant:"secondary",size:"medium",testId:"transactions-connect-wallet-button",onClick:e,children:t("views.TRANSACTIONS.status.emptyState.notConnected.buttonText")})]})}const J9e={backgroundColor:"base.color.neutral.800",px:"base.spacing.x4",p:"base.spacing.x5",borderRadius:"base.borderRadius.x6"},Q9e={color:"base.color.text.body.secondary"};function $9e({checkout:e,isPassport:t}){const{t:n}=_ke(),[r,i]=uV.useState("");return uV.useEffect((()=>{e&&i(Kke[e.config.environment])}),[e]),Cq(N3,{sx:J9e,children:Iq(N3,{sx:{display:"flex",flexDirection:"column"},children:[Iq(N3,{children:[Cq(tee,{size:"small",children:n("views.TRANSACTIONS.support.body1")}),Iq(tee,{size:"small",sx:Q9e,children:[n("views.TRANSACTIONS.support.body2"),Cq(kae,{size:"small",rc:Cq("a",{target:"_blank",href:n("views.TRANSACTIONS.support.supportLink"),rel:"noreferrer"}),children:n("views.TRANSACTIONS.support.body3")})]})]}),t&&Iq(tee,{size:"small",sx:Q9e,children:[n("views.TRANSACTIONS.support.passport.body1")," ",Cq(kae,{size:"small",rc:Cq("a",{target:"_blank",href:r,rel:"noreferrer"}),children:n("views.TRANSACTIONS.support.passport.body2")})]})]})})}const e7e={display:"flex",flexDirection:"column",borderRadius:"base.borderRadius.x4",bg:"base.color.translucent.emphasis.100"},t7e={p:"base.spacing.x3",d:"flex",justifyContent:"space-between",position:"relative"},n7e={display:"flex",flexGrow:"1",alignItems:"center",gap:"base.spacing.x2"};function r7e({transaction:e,environment:t}){const n=RPe(e.details.from_chain),r=RPe(e.details.to_chain);return Iq(N3,{sx:{display:"flex",px:"base.spacing.x4",gap:"base.spacing.x2"},children:[Cq(i7,{sx:{w:"base.icon.size.400",h:"base.icon.size.400"},use:Cq("img",{src:ZRe(t,n),alt:$ke[n]})}),Iq(N3,{sx:{display:"flex",flexDirection:"column",flexGrow:"1"},children:[Cq(tee,{size:"xxSmall",sx:{color:"base.color.translucent.standard.900"},children:$ke[n]}),Cq(tse,{size:"xxSmall",sx:{color:"base.color.translucent.standard.600"},text:e.details.from_address})]}),Cq(N3,{sx:{flexGrow:"1"}}),Cq(S6,{icon:"ArrowForward",sx:{w:"base.icon.size.250",fill:"base.color.brand.4"}}),Cq(N3,{sx:{flexGrow:"1"}}),Cq(i7,{sx:{w:"base.icon.size.400",h:"base.icon.size.400"},use:Cq("img",{src:ZRe(t,r),alt:$ke[r]})}),Iq(N3,{sx:{display:"flex",flexDirection:"column",flexGrow:"1"},children:[Cq(tee,{size:"xxSmall",sx:{color:"base.color.translucent.standard.900"},children:$ke[r]}),Cq(tse,{size:"xxSmall",sx:{color:"base.color.translucent.standard.600"},text:e.details.to_address})]})]})}function i7e({label:e,details:t,transaction:n,fiatAmount:r,amount:i,icon:a,defaultTokenImage:o,environment:s}){const{track:c}=OPe(),u=uV.useMemo((()=>`${t.link}${t.hash}`),[t]);return Cq(N3,{testId:`transaction-item-${n.blockchain_metadata.transaction_hash}`,sx:e7e,children:Iq(M4,{chevronSide:"right",sx:{button:{p:"base.spacing.x1"},article:{pr:"base.spacing.x10"}},onExpandChange:e=>e&&c({userJourney:bPe.BRIDGE,screen:"TransactionItem",control:"Accordion",controlType:"Button"}),children:[Cq(M4.TargetLeftSlot,{sx:{pr:"base.spacing.x2"},children:Iq(oae,{size:"xSmall",children:[Cq(oae.FramedImage,{circularFrame:!0,use:Cq(a2e,{src:a,name:e,defaultImage:o})}),Cq(oae.Label,{children:e}),Cq(oae.Caption,{children:Cq(kae,{size:"xSmall",rc:Cq("a",{target:"_blank",href:u,rel:"noreferrer",onClick:e=>{return n=t,e.stopPropagation(),void c({userJourney:bPe.BRIDGE,screen:"TransactionItem",control:"Details",controlType:"Link",extras:{linkDetail:n}});var n}}),children:t.text})}),Cq(oae.PriceDisplay,{fiatAmount:r,price:i})]})}),Iq(M4.ExpandedContent,{sx:{pr:"0",pl:"0",mb:"base.spacing.x3",gap:"0"},children:[Cq(X3,{size:"xSmall",sx:{px:"base.spacing.x2"}}),Cq(r7e,{transaction:n,environment:s})]})]})})}const a7e=e=>{let t=440;return e&&(t-=20),{backgroundColor:"base.color.neutral.800",px:"base.spacing.x4",pt:"base.spacing.x5",pb:"base.spacing.x4",borderRadius:"base.borderRadius.x6",h:`${t}px`,w:"100%",overflowY:"scroll"}},o7e={borderRadius:"base.borderRadius.x4",display:"flex",flexDirection:"column",gap:"base.spacing.x5"};function s7e({label:e,transaction:t,fiatAmount:n,amount:r,icon:i,defaultTokenImage:a,environment:o}){const{viewDispatch:s}=uV.useContext(ERe),{track:c}=OPe(),u=_ke(),l=uV.useMemo((()=>(new Date).getTime()),[]),d=uV.useMemo((()=>t.details.current_status.withdrawal_ready_at?new Date(t.details.current_status.withdrawal_ready_at):void 0),[t]),f=t.details.current_status.status===D9e.WITHDRAWAL_PENDING,p=new Intl.RelativeTimeFormat(u[1].language||"en",{numeric:"auto"}),h=uV.useMemo((()=>{if(!f||void 0===d)return"";const e=(d.getTime()-l)/6e4;if(e<=1)return"in 1 minute";if(e<60)return p.format(Math.ceil(e),"minute");const t=e/60;if(e<1440)return p.format(Math.ceil(t),"hour");const n=t/24;return p.format(Math.ceil(n),"day")}),[l,u[1].language]),m=!!d&&d.getTime()<l,y=uV.useMemo((()=>!0===m?u.t("views.TRANSACTIONS.status.withdrawalPending.withdrawalReadyText"):`${u.t("views.TRANSACTIONS.status.withdrawalPending.withdrawalDelayText")} ${h}`),[h,u[1].language]);return Iq(N3,{testId:`transaction-item-${t.blockchain_metadata.transaction_hash}`,sx:e7e,children:[f&&Iq(Oq,{children:[Iq(N3,{sx:t7e,children:[Iq(N3,{sx:n7e,children:[Cq(S6,{icon:"Alert",variant:"bold",sx:{fill:m?"base.color.status.fatal.bright":"base.color.status.attention.bright",w:"base.icon.size.200"}}),Cq(tee,{testId:`transaction-item-${t.blockchain_metadata.transaction_hash}-action-message`,size:"xSmall",sx:{color:"base.color.text.body.secondary"},children:y})]}),f&&m&&Cq(O3,{testId:`transaction-item-${t.blockchain_metadata.transaction_hash}-action-button`,variant:"primary",size:"small",onClick:()=>{s({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.CLAIM_WITHDRAWAL,transaction:t}}})},children:u.t("views.TRANSACTIONS.status.withdrawalPending.actionButtonText")})]}),Cq(X3,{size:"small",sx:{color:"base.color.translucent.emphasis.300",opacity:.1}})]}),Iq(M4,{chevronSide:"right",sx:{button:{p:"base.spacing.x1"},article:{pr:"base.spacing.x10"},borderTopRightRadius:"0",borderTopLeftRadius:"0"},onExpandChange:e=>e&&c({userJourney:bPe.BRIDGE,screen:"TransactionItem",control:"Accordion",controlType:"Button"}),children:[Cq(M4.TargetLeftSlot,{sx:{pr:"base.spacing.x2"},children:Iq(oae,{size:"xSmall",children:[Cq(oae.FramedImage,{circularFrame:!0,use:Cq(a2e,{src:i,name:e,defaultImage:a})}),Cq(oae.Label,{children:e}),Cq(oae.Caption,{children:u.t("views.TRANSACTIONS.status.withdrawalPending.caption")}),Cq(oae.PriceDisplay,{fiatAmount:n,price:r})]})}),Iq(M4.ExpandedContent,{sx:{pr:"0",pl:"0",mb:"base.spacing.x3",gap:"0"},children:[Cq(X3,{size:"xSmall",sx:{px:"base.spacing.x2"}}),Cq(r7e,{transaction:t,environment:o})]})]})]})}const c7e={display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",p:"base.spacing.x2",pb:"base.spacing.x4"},u7e={position:"relative",pr:"base.spacing.x2"},l7e={width:"base.icon.size.400"},d7e={position:"absolute",top:"-6px",left:"18px",width:"20px",padding:"2px",backgroundColor:"base.color.translucent.inverse.900",borderRadius:"base.borderRadius.x2"},f7e={backgroundColor:"transparent",width:"base.icon.size.400",height:"base.icon.size.400",marginRight:"base.spacing.x1",padding:"base.spacing.x1"};function p7e({onChangeWalletClick:e}){const{t:t}=_ke(),{bridgeState:{from:n}}=uV.useContext(F9e),[r,i]=uV.useState(void 0),[a,o]=uV.useState(!1),{isWalletConnectEnabled:s,getWalletLogoUrl:c}=aqe(),{track:u}=OPe(),l=n?.walletAddress||"",d=n?.walletProviderInfo;return uV.useEffect((()=>{if(s){const e=hNe(n?.web3Provider);o(e),e&&(async()=>{i(await c())})()}}),[s,n]),Iq(N3,{sx:c7e,children:[Iq(N3,{sx:{display:"flex",alignItems:"center",gap:"base.spacing.x1"},children:[a&&r?Iq(N3,{sx:u7e,children:[Cq(i7,{sx:l7e,use:Cq("img",{src:r,alt:"walletconnect"})}),Cq(O8,{logo:"WalletConnectSymbol",sx:d7e})]}):d&&Cq(dNe,{src:d.icon,alt:d.name,sx:f7e}),Cq(tse,{leftSideLength:6,rightSideLength:4,text:l})]}),Cq(O3,{size:"small",variant:"tertiary",onClick:()=>{u({userJourney:bPe.BRIDGE,screen:y8e.TRANSACTIONS,controlType:"Button",control:"Pressed"}),e()},children:t("views.TRANSACTIONS.changeWallet.buttonText")})]})}function h7e({checkout:e,transactions:t,knownTokenMap:n,isPassport:r,defaultTokenImage:i,changeWallet:a}){const{cryptoFiatState:o}=uV.useContext($6e),{t:s}=_ke(),[c,u]=uV.useState(""),{environment:l}=e.config;uV.useEffect((()=>{e&&u(qke[e.config.environment])}),[e]);const d=uV.useCallback(((e,t)=>e.details.current_status.status===D9e.WITHDRAWAL_PENDING&&t.details.current_status.status!==D9e.WITHDRAWAL_PENDING?-1:e.details.current_status.status===t.details.current_status.status?0:1),[]),f=uV.useCallback((t=>KRe(t.details.from_token_address)?JRe(e.config.environment,function(e){switch(e){case qH.ETHEREUM:case qH.SEPOLIA:return"ETH";case qH.IMTBL_ZKEVM_TESTNET:case qH.IMTBL_ZKEVM_MAINNET:case qH.IMTBL_ZKEVM_DEVNET:return"IMX";default:return""}}(t.details.from_chain)):JRe(e.config.environment,t.details.from_token_address)),[e]);return Iq(N3,{sx:a7e(r),children:[Cq(p7e,{onChangeWalletClick:a}),Cq(N3,{testId:"move-transaction-list",sx:o7e,children:t.sort(d).map((e=>{const t=e.blockchain_metadata.transaction_hash,r=n[e.details.from_chain][e.details.from_token_address.toLowerCase()],a=Xd(e.details.amount,r.decimals),u=zRe(a,r.symbol,o.conversions);return e.details.current_status.status===D9e.WITHDRAWAL_PENDING?Cq(s7e,{label:r.symbol,transaction:e,fiatAmount:`${s("views.TRANSACTIONS.fiatPricePrefix")}${u}`,amount:a,icon:f(e),defaultTokenImage:i,environment:l},t):Cq(i7e,{label:r.symbol,details:{text:s("views.TRANSACTIONS.status.inProgress.stepInfo"),link:c,hash:t},transaction:e,fiatAmount:`${s("views.TRANSACTIONS.fiatPricePrefix")}${u}`,amount:a,icon:f(e),defaultTokenImage:i,environment:l},t)}))})]})}const m7e={backgroundColor:"base.color.neutral.800",px:"base.spacing.x4",pt:"base.spacing.x5",pb:"base.spacing.x4",borderRadius:"base.borderRadius.x6",h:"100%",w:"100%",display:"flex",flexDirection:"column"},y7e={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:"base.spacing.x5",flex:1},b7e={mb:"base.spacing.x8",color:"base.color.text.body.secondary"},g7e={color:"base.color.text.body.secondary"};function v7e({checkout:e,isPassport:t,changeWallet:n}){const{page:r}=OPe(),{t:i}=_ke(),[a,o]=uV.useState("");return uV.useEffect((()=>{e&&o(Kke[e.config.environment])}),[e]),uV.useEffect((()=>{r({userJourney:bPe.BRIDGE,screen:"NoTransactions"})}),[]),Iq(N3,{sx:m7e,children:[Cq(p7e,{onChangeWalletClick:n}),Iq(N3,{sx:y7e,children:[Cq(tee,{size:"small",sx:b7e,children:i("views.TRANSACTIONS.status.noTransactions.body")}),t&&Iq(tee,{size:"small",sx:g7e,children:[i("views.TRANSACTIONS.status.noTransactions.passport.body")," ",Cq(kae,{size:"small",rc:Cq("a",{target:"_blank",href:a,rel:"noreferrer"}),children:i("views.TRANSACTIONS.status.noTransactions.passport.link")})]})]})]})}function w7e({defaultTokenImage:e,onBackButtonClick:t}){const{eventTargetState:{eventTarget:n}}=uV.useContext(zqe),{cryptoFiatDispatch:r}=uV.useContext($6e),{bridgeDispatch:i,bridgeState:{checkout:a,from:o}}=uV.useContext(F9e),{page:s}=OPe(),{t:c}=_ke(),{track:u}=OPe(),[l,d]=uV.useState(!0),[f,p]=uV.useState(void 0),[h,m]=uV.useState([]),[y,b]=uV.useState(!1),g=fNe(o?.web3Provider),v=uV.useCallback((async()=>{if(!a)return{};const e=Jke(a.config);try{return((await a.getTokenAllowList({type:ZH.BRIDGE,chainId:e})).tokens??[]).reduce(((e,t)=>(e[t.address.toLowerCase()]=t,e)),{})}catch(e){return console.error(e),[]}}),[a]),w=uV.useCallback((async()=>{if(!o?.web3Provider)return{};if(!o?.walletAddress)return{};const e=Qke(a.config);try{return(await a.getAllBalances({provider:o?.web3Provider,walletAddress:o?.walletAddress,chainId:e})).balances.reduce(((e,t)=>(e[t.token.address.toLowerCase()]=t.token,e)),{})}catch(e){return console.error(e),[]}}),[a,o]),T=async e=>{const t=kPe(Jke(a.config)),n=kPe(Qke(a.config)),[i,o]=await Promise.all([v(),w()]),s={};Object.entries(e).forEach((([r,a])=>{(e[r]===t&&!i[r]||e[r]===n&&!o[r])&&(s[r]=a)}));const c=new _d(a.config.networkMap.get(Jke(a.config))?.rpcUrls[0]),u=new _d(a.config.networkMap.get(Qke(a.config))?.rpcUrls[0]),l=[],d=[];Object.entries(s).forEach((([e,n])=>{n===t?l.push(a.getTokenInfo({provider:c,tokenAddress:e})):d.push(a.getTokenInfo({provider:u,tokenAddress:e}))}));const f=await Promise.allSettled(l),p=await Promise.allSettled(d);f.filter((e=>"fulfilled"===e.status)).forEach((e=>{const t=e;i[t.value.address.toLowerCase()]=t.value})),p.filter((e=>"fulfilled"===e.status)).forEach((e=>{const t=e;o[t.value.address.toLowerCase()]=t.value}));const h=[];return Object.values(i).forEach((e=>h.push(e.symbol.toLowerCase()))),Object.values(o).forEach((e=>h.push(e.symbol.toLowerCase()))),r({payload:{type:Q6e.SET_TOKEN_SYMBOLS,tokenSymbols:h}}),{[t]:i,[n]:o}},E=uV.useCallback((async(e,t)=>new N9e({env:e}).getTransactions({txType:M9e.BRIDGE,fromAddress:t})),[]),A=uV.useCallback((async e=>{u({userJourney:bPe.BRIDGE,screen:"EmptyStateNotConnected",control:"WalletProvider",controlType:"Select",extras:{walletProviderName:e.providerDetail.info.name}});try{let t=!1;e.providerDetail.info.rdns===eW.METAMASK&&(t=!0);const n=new Ld(e.provider),r=await gNe(a,n,t),o=await r.getNetwork(),s=await r.getSigner().getAddress();m([]),i({payload:{type:j9e.SET_WALLETS_AND_NETWORKS,from:{web3Provider:r,walletProviderInfo:{...e.providerDetail.info},walletAddress:s.toLowerCase(),network:o.chainId},to:null}})}catch(e){console.error(e)}finally{b(!1)}}),[a]),x=uV.useCallback((async()=>{if(!o?.walletAddress)return;const e=await E(a.config.environment,o?.walletAddress),t={};return e.result.forEach((e=>{t[e.details.from_token_address]=e.details.from_chain})),{tokens:await T(t),transactions:e.result}}),[o,E]),{providers:O}=sqe({checkout:a}),C=uV.useMemo((()=>O),[O]);return uV.useEffect((()=>{(async()=>{d(!0);const e=await x8e(x,zke);if(!e)return void d(!1);const t=e.transactions.filter((t=>{const n=e.tokens[t.details.from_chain];if(!n)return!1;return!!n[t.details.from_token_address.toLowerCase()]}));p(e.tokens),m(t),d(!1)})()}),[o,a]),uV.useEffect((()=>{s({userJourney:bPe.BRIDGE,screen:"Transactions"})}),[]),Cq(_Pe,{testId:"bridge-view",header:Cq(xRe,{showBack:!0,onBackButtonClick:()=>{o&&(i({payload:{type:j9e.SET_WALLETS_AND_NETWORKS,from:{web3Provider:o?.web3Provider,walletAddress:o?.walletAddress,walletProviderInfo:o?.walletProviderInfo,network:o?.network},to:null}}),i({payload:{type:j9e.SET_TOKEN_AND_AMOUNT,token:null,amount:""}})),t()},title:c("views.TRANSACTIONS.layoutHeading"),onCloseButtonClick:()=>H9e(n)}),footer:Cq(oNe,{}),children:Iq(N3,{sx:q9e,children:[Iq(N3,{sx:K9e,children:[!o?.web3Provider&&Cq(Z9e,{openWalletDrawer:()=>b(!0)}),o?.web3Provider&&l&&Cq(G9e,{}),o?.web3Provider&&!l&&h.length>0&&f&&Cq(h7e,{checkout:a,transactions:h,knownTokenMap:f,isPassport:g,defaultTokenImage:e,changeWallet:()=>b(!0)}),o?.web3Provider&&!l&&0===h.length&&Cq(v7e,{checkout:a,isPassport:g,changeWallet:()=>b(!0)})]}),o?.web3Provider&&h.length>0&&Cq(N3,{sx:X9e,children:Cq($9e,{checkout:a,isPassport:g})}),Cq(mqe,{testId:"select-wallet-drawer",drawerText:{heading:c("views.TRANSACTIONS.walletSelection.heading")},showWalletSelectorTarget:!1,walletOptions:C,showDrawer:y,setShowDrawer:e=>{b(e)},onWalletChange:A})]})})}function T7e({transactionResponse:e}){const{t:t}=_ke(),{viewDispatch:n}=uV.useContext(ERe),{page:r}=OPe();return uV.useEffect((()=>{r({userJourney:bPe.BRIDGE,screen:"ClaimWithdrawalInProgress"})}),[]),uV.useEffect((()=>{e&&(async()=>{try{const t=await e.wait();if(1===t.status)return void n({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.CLAIM_WITHDRAWAL_SUCCESS,transactionHash:t.transactionHash}}});n({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.CLAIM_WITHDRAWAL_FAILURE,transactionHash:t.transactionHash,reason:"Transaction failed"}}})}catch(e){console.error(e),n({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.CLAIM_WITHDRAWAL_FAILURE,transactionHash:"",reason:"Transaction failed"}}})}})()}),[e]),Cq(PPe,{loadingText:t("views.CLAIM_WITHDRAWAL.IN_PROGRESS.loading.text")})}function E7e(e){return e?e.substring(0,6).concat("...").concat(e.substring(e.length-4)):""}const A7e={height:"100%",display:"flex",flexDirection:"column",paddingX:"base.spacing.x4"},x7e={paddingTop:"base.spacing.x10",paddingBottom:"base.spacing.x4"},O7e={display:"flex",flexDirection:"column",paddingY:"base.spacing.x6"};function C7e({testId:e,chainId:t,chainName:n,onNetworkClick:r,environment:i}){return Iq(oae,{testId:`${e}-network-list-${t}`,size:"medium",emphasized:!0,onClick:async()=>{await r(t)},sx:{marginBottom:"base.spacing.x1"},children:[Cq(oae.FramedImage,{use:Cq("img",{src:ZRe(i,t),alt:n})}),Cq(oae.Label,{size:"medium",children:n})]})}VH.IMTBL_ZKEVM_DEVNET,VH.IMTBL_ZKEVM_TESTNET,VH.IMTBL_ZKEVM_MAINNET,VH.ETHEREUM,VH.SEPOLIA;const I7e={position:"relative",width:"100%",backgroundColor:"base.color.translucent.emphasis.100",borderRadius:"base.borderRadius.x4",paddingX:"base.spacing.x3",paddingY:"base.spacing.x5",display:"flex",flexDirection:"row",gap:"base.spacing.x4",alignItems:"center","&:hover":{cursor:"pointer",backgroundColor:"base.color.translucent.emphasis.200"}},_7e={width:"base.icon.size.500",backgroundColor:"base.color.translucent.standard.200",borderRadius:"base.borderRadius.x2"},P7e={position:"absolute",top:"14px",left:"38px",width:"28px",padding:"base.spacing.x1",backgroundColor:"base.color.translucent.inverse.900",borderRadius:"base.borderRadius.x2"},S7e={color:"base.color.text.body.secondary"},k7e={paddingY:"base.spacing.x6",borderRadius:"base.borderRadius.x18"};function R7e({testId:e,walletProvider:t,walletProviderDetail:n,walletAddress:r,walletName:i,chainId:a,disableNetworkButton:o=!1,onWalletClick:s,onNetworkClick:c,environment:u}){const l=SPe(a),[d,f]=uV.useState(void 0),[p,h]=uV.useState("Other"),[m,y]=uV.useState(!1),{isWalletConnectEnabled:b,getWalletLogoUrl:g,getWalletName:v}=aqe(),w=uV.useMemo((()=>n?.info.rdns===eW.PASSPORT?i:hNe(t)?p:n?.info.name),[n,p,t]);return uV.useEffect((()=>{if(b){const e=hNe(t);y(e),e&&((async()=>{f(await g())})(),h(v()))}}),[b,t,g,v]),Iq(N3,{testId:`${e}-${n?.info.rdns}-${a}-button-wrapper`,sx:I7e,onClick:s,children:[m&&d?Iq(Oq,{children:[Cq(i7,{imageUrl:d,alt:"walletconnect",sx:_7e}),Cq(O8,{logo:"WalletConnectSymbol",sx:P7e})]}):n&&Cq(dNe,{src:n.info.icon,alt:n.info.name}),Iq(N3,{sx:{display:"flex",flexDirection:"column",flex:1},children:[Cq(qee,{size:"xSmall",sx:{textTransform:"capitalize"},children:w}),Cq(tee,{size:"xSmall",sx:S7e,children:r})]}),Iq(O3,{testId:`${e}-network-${a}-button`,size:"small",disabled:o,onClick:e=>{e.stopPropagation(),c(e)},variant:"tertiary",sx:k7e,children:[Cq(i7,{sx:{w:"base.icon.size.400",h:"base.icon.size.400"},use:Cq("img",{src:ZRe(u,a),alt:l[a]})}),l]})]})}const N7e="wallet-network-selector";function M7e(){const{t:e}=_ke(),{bridgeState:{checkout:t,from:n,to:r},bridgeDispatch:i}=uV.useContext(F9e),{viewDispatch:a}=uV.useContext(ERe),{providers:o}=sqe({checkout:t}),{environment:s}=t.config,{track:c}=OPe(),u=n?.web3Provider??null,l=n?.network??null,d=n?.walletAddress?.toLowerCase()??"",f=n?{provider:u,providerDetail:{provider:u,info:{...n.walletProviderInfo}}}:null,p=r?.web3Provider??null,h=r?.network??null,m=r?.walletAddress?.toLowerCase()??"",y=r?{provider:p,providerDetail:{provider:p,info:{...r.walletProviderInfo}}}:null,b=Jke(t.config),g=SPe(b),v=Qke(t.config),w=SPe(v),[T,E]=uV.useState(!1),[A,x]=uV.useState(!1),[O,C]=uV.useState(u),[I,_]=uV.useState(l),[P,S]=uV.useState(d),[k,R]=uV.useState(f),[N,M]=uV.useState(!1),[D,L]=uV.useState(!1),[j,F]=uV.useState(p),[B,U]=uV.useState(h),[z,H]=uV.useState(m),[W,V]=uV.useState(y),G=O&&I,q=j&&B,K=uV.useMemo((()=>O?mNe(O):null),[O]),X=uV.useMemo((()=>j?mNe(j):null),[j]),Y=uV.useMemo((()=>o),[o]),Z=uV.useMemo((()=>o.filter((e=>e.info.rdns!==eW.PASSPORT||e.info.rdns===eW.PASSPORT&&k?.providerDetail?.info?.rdns!==eW.PASSPORT))),[o,I,k]);function J(){F(null),U(null)}uV.useEffect((()=>{n&&r&&i({payload:{type:j9e.SET_WALLETS_AND_NETWORKS,from:null,to:null}})}),[n,r]);const Q=uV.useCallback((async e=>{J(),R(e);let n=!1;e.providerDetail.info.rdns===eW.METAMASK&&(n=!0);const r=new Ld(e.provider),i=await gNe(t,r,n);await(async e=>{C(e);const t=await e.getSigner().getAddress();if(S(t.toLowerCase()),c({userJourney:bPe.BRIDGE,screen:"WalletAndNetwork",control:"FromWallet",controlType:"Select",extras:{walletAddress:t.toLowerCase()}}),fNe(e))return _(v),E(!1),void c({userJourney:bPe.BRIDGE,screen:"WalletAndNetwork",control:"FromNetwork",controlType:"Select",extras:{chainId:v}});_(null),E(!1),setTimeout((()=>x(!0)),500)})(i)}),[t]),$=uV.useCallback((async e=>{O&&(J(),x(!1),_(e),c({userJourney:bPe.BRIDGE,screen:"WalletAndNetwork",control:"FromNetwork",controlType:"Select",extras:{chainId:e}}))}),[t,O]),ee=uV.useCallback((async e=>{j&&(M(!1),U(e),c({userJourney:bPe.BRIDGE,screen:"WalletAndNetwork",control:"ToNetwork",controlType:"Select",extras:{chainId:e}}))}),[t,j]),te=uV.useCallback((e=>{const t=P===e&&I===v?b:v;U(t),L(!1),c({userJourney:bPe.BRIDGE,screen:"WalletAndNetwork",control:"ToNetwork",controlType:"Select",extras:{chainId:t}})}),[P,I]),ne=uV.useCallback((e=>{F(e),e.getSigner().getAddress().then((e=>{H(e.toLowerCase()),te(e.toLowerCase()),c({userJourney:bPe.BRIDGE,screen:"WalletAndNetwork",control:"ToWallet",controlType:"Select",extras:{walletAddress:e.toLowerCase()}})}))}),[te]),re=uV.useCallback((async e=>{if(k?.providerDetail.info.rdns===e.providerDetail.info.rdns){F(O),V(e);const t=await O.getSigner().getAddress();return H(t.toLowerCase()),te(t.toLowerCase()),void c({userJourney:bPe.BRIDGE,screen:"WalletAndNetwork",control:"ToWallet",controlType:"Select",extras:{walletAddress:t.toLowerCase()}})}try{V(e);const n=new Ld(e.provider),r=await gNe(t,n,!1);if(hNe(r))ne(r);else{F(r);const e=await r.getSigner().getAddress();H(e.toLowerCase()),te(e.toLowerCase()),c({userJourney:bPe.BRIDGE,screen:"WalletAndNetwork",control:"ToWallet",controlType:"Select",extras:{walletAddress:e.toLowerCase()}})}}catch(e){console.error(e)}}),[K,O,te,ne]),ie=uV.useCallback((()=>{O&&I&&j&&B&&(i({payload:{type:j9e.SET_TOKEN_BALANCES,tokenBalances:[]}}),i({payload:{type:j9e.SET_ALLOWED_TOKENS,allowedTokens:[]}}),i({payload:{type:j9e.SET_WALLETS_AND_NETWORKS,from:{web3Provider:O,walletAddress:P.toLowerCase(),walletProviderInfo:k?.providerDetail.info,network:I},to:{web3Provider:j,walletAddress:z.toLowerCase(),walletProviderInfo:W?.providerDetail.info,network:B}}}),c({userJourney:bPe.BRIDGE,screen:"WalletAndNetwork",control:"Next",controlType:"Button",extras:{fromWalletAddress:P,fromNetwork:I,fromWallet:{address:P,rdns:k?.providerDetail.info.rdns,uuid:k?.providerDetail.info.uuid,isPassportWallet:fNe(O),isMetaMask:pNe(O)},toWalletAddress:z,toNetwork:B,toWallet:{address:z,rdns:W?.providerDetail.info.rdns,uuid:W?.providerDetail.info.uuid,isPassportWallet:fNe(j),isMetaMask:pNe(j)},moveType:I&&I===B?"transfer":"bridge"}}),a({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.BRIDGE_FORM}}}))}),[k,O,I,P,W,j,B,z]);return Iq(N3,{testId:N7e,sx:A7e,children:[Cq(qee,{testId:`${N7e}-heading`,size:"small",weight:"regular",sx:x7e,children:e("views.WALLET_NETWORK_SELECTION.heading")}),Cq(qee,{size:"xSmall",sx:{paddingBottom:"base.spacing.x2"},children:e("views.WALLET_NETWORK_SELECTION.fromFormInput.heading")}),Cq(mqe,{testId:`${N7e}-from`,drawerText:{heading:e("views.WALLET_NETWORK_SELECTION.fromFormInput.walletSelectorHeading"),defaultText:e("views.WALLET_NETWORK_SELECTION.fromFormInput.selectDefaultText")},showWalletSelectorTarget:!G,showDrawer:T,setShowDrawer:E,walletOptions:Y,onWalletChange:Q}),G&&K&&Iq(N3,{sx:{display:"flex",flexDirection:"column",gap:"base.spacing.x10"},children:[Cq(R7e,{testId:N7e,walletProviderDetail:k?.providerDetail,walletProvider:O,walletName:K,walletAddress:E7e(P),chainId:I,disableNetworkButton:K===$H.PASSPORT.toString(),onWalletClick:()=>{E(!0)},onNetworkClick:()=>x(!0),environment:s}),Iq(N3,{children:[Cq(qee,{size:"xSmall",sx:{paddingBottom:"base.spacing.x2"},children:e("views.WALLET_NETWORK_SELECTION.toFormInput.heading")}),Cq(mqe,{testId:`${N7e}-to`,drawerText:{heading:e("views.WALLET_NETWORK_SELECTION.toFormInput.walletSelectorHeading"),defaultText:e("views.WALLET_NETWORK_SELECTION.toFormInput.selectDefaultText")},showWalletSelectorTarget:!q,walletOptions:Z,showDrawer:D,setShowDrawer:L,onWalletChange:re})]})]}),Cq(wne,{headerBarTitle:e(A?"views.WALLET_NETWORK_SELECTION.fromFormInput.networkSelectorHeading":"views.WALLET_NETWORK_SELECTION.toFormInput.networkSelectorHeading"),size:"full",onCloseDrawer:()=>{A?x(!1):M(!1)},visible:A||N,children:Iq(wne.Content,{sx:{paddingX:"base.spacing.x4"},children:[Cq(C7e,{testId:N7e,chainName:w,onNetworkClick:A?$:ee,chainId:v,environment:s},w),(N||k?.providerDetail.info.rdns!==eW.PASSPORT)&&Cq(C7e,{testId:N7e,chainName:g,onNetworkClick:A?$:ee,chainId:b,environment:s},g)]})}),q&&X&&Iq(N3,{sx:{flex:1,display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[Cq(R7e,{testId:N7e,walletProviderDetail:W?.providerDetail,walletProvider:j,walletName:X,walletAddress:E7e(z),chainId:B,disableNetworkButton:I===b||X===$H.PASSPORT.toString()||P===z,onWalletClick:()=>{L(!0)},onNetworkClick:()=>{M(!0)},environment:s}),Cq(N3,{sx:O7e,children:Cq(O3,{testId:`${N7e}-submit-button`,size:"large",onClick:ie,children:e("views.WALLET_NETWORK_SELECTION.submitButton.text")})})]})]})}function D7e(){const{t:e}=_ke(),{viewDispatch:t}=uV.useContext(ERe),{eventTargetState:{eventTarget:n}}=uV.useContext(zqe),{page:r}=OPe();return uV.useEffect((()=>{r({userJourney:bPe.BRIDGE,screen:"WalletNetworkSelection"})}),[]),Cq(_Pe,{testId:"bridge-view",header:Cq(xRe,{title:e("views.WALLET_NETWORK_SELECTION.layoutHeading"),onCloseButtonClick:()=>H9e(n),rightActions:Cq(d4,{icon:"Minting",sx:gRe(),onClick:()=>{t({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.TRANSACTIONS}}})},testId:"move-transactions-button"})}),footer:Cq(oNe,{}),children:Cq(M7e,{})})}function L7e(e,t){return e&&0!==parseFloat(e)?t&&Number(e)>Number(t)?"views.BRIDGE_FORM.validation.insufficientBalance":"":"views.BRIDGE_FORM.validation.noAmountInputted"}const j7e={height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between",paddingTop:"base.spacing.x10"},F7e={paddingTop:"base.spacing.x4",display:"flex",gap:"base.spacing.x1"},B7e={display:"flex",flexDirection:"column",paddingY:"base.spacing.x6",paddingX:"base.spacing.x4"};function U7e({sx:e}){return Iq(N3,{sx:{...e,paddingTop:"0",marginTop:"base.spacing.x4"},rc:Cq("div",{}),children:[Cq(N3,{sx:{display:"flex",backgroundColor:"#F3F3F30A",borderRadius:"8px"},children:Cq(N3,{sx:{minw:"170px",height:"64px",WebkitMaskPosition:"left center",WebkitMaskRepeat:"no-repeat",WebkitMaskSize:"contain",WebkitMaskImage:'url(\'data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none"><path d="M154.75 39q1.65 0 2.85-1.15 1.15-1.15 1.15-2.85v-4q0-1.65-1.15-2.8-1.2-1.2-2.85-1.2h-93.6q-2.3 0-3.85 1.2-1.55 1.15-1.55 2.8v4q0 1.7 1.55 2.85Q58.85 39 61.15 39h93.6m-111.7-3.35q.2-1.3.2-2.65 0-1.35-.2-2.65-.75-4.9-4.5-8.65-4.7-4.7-11.3-4.7-6.65 0-11.3 4.7-4.7 4.7-4.7 11.3 0 6.65 4.7 11.3Q20.6 49 27.25 49q6.6 0 11.3-4.7 3.75-3.7 4.5-8.65Z" id="a"/></svg>\')'},rc:Cq("span",{}),children:Cq(z7,{rc:Cq("span",{})})})}),Cq(N3,{sx:{display:"flex",width:"100%",backgroundColor:"#F3F3F30A",borderRadius:"8px"},children:Cq(N3,{sx:{width:"100%",height:"64px",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:Cq("span",{}),children:Cq(z7,{rc:Cq("span",{})})})})]})}function z7e(e){const{t:t}=_ke(),{bridgeDispatch:n,bridgeState:{tokenBalances:r,allowedTokens:i,checkout:a,from:o,to:s,amount:c,token:u}}=uV.useContext(F9e),{cryptoFiatState:l,cryptoFiatDispatch:d}=uV.useContext($6e),{viewDispatch:f}=uV.useContext(ERe),{testId:p,defaultAmount:h,defaultTokenAddress:m,isTokenBalancesLoading:y,defaultTokenImage:b,environment:g,theme:v}=e,{track:w}=OPe(),[T,E]=uV.useState(h||""),[A,x]=uV.useState(""),[O,C]=uV.useState(),[I,_]=uV.useState(""),[P,S]=uV.useState(""),[k,R]=uV.useState(!1),N=uV.useRef(!1),M=O?`${t("views.BRIDGE_FORM.content.availableBalancePrefix")} ${VRe(O?.formattedBalance)}`:"",[D,L]=uV.useState([]),[j,F]=uV.useState(!1),B=uV.useCallback(((e,t)=>t?`${e.toLowerCase()}-${t.toLowerCase()}`:e.toLowerCase()),[]);uV.useEffect((()=>{if(0===r.length)return;const e=r.filter((e=>e.balance.gt(0))).map((e=>({id:B(e.token.symbol,e.token.address),name:e.token.name,symbol:e.token.symbol,icon:e.token.icon,balance:{formattedFiatAmount:0===l.conversions.size?HRe(""):zRe(e.formattedBalance,e.token.symbol,l.conversions),formattedAmount:VRe(e.formattedBalance)}})));L(e),N.current||(N.current=!0,m&&C(r.find((e=>KRe(e.token.address)&&m?.toLocaleUpperCase()===Nke||e.token.address?.toLowerCase()===m?.toLowerCase()))))}),[r,l.conversions,m,N.current,B,HRe]),uV.useEffect((()=>{if(c&&u){E(c);for(let e=0;e<r.length;e++){const t=r[e];if(t.token.address===u.address){C(t);break}}n({payload:{type:j9e.SET_TOKEN_AND_AMOUNT,token:null,amount:""}})}}),[c,u,r]);const U=uV.useMemo((()=>O&&O.token?B(O.token.symbol,O.token.address):void 0),[O,r,l.conversions,B]),z=e=>{if(E(e),A){const t=L7e(e,O?.formattedBalance);x(t)}var t;O&&(S(zRe(e,O.token.symbol,l.conversions)),t=!0,Number.isNaN(parseFloat(T))||parseFloat(T)<=0||!O||!o||!o.walletAddress||!s||!s.walletAddress||t&&k||!a||R(!0))};uV.useEffect((()=>{d({payload:{type:Q6e.SET_TOKEN_SYMBOLS,tokenSymbols:i.map((e=>e.symbol))}})}),[d,i]),uV.useEffect((()=>{T&&O&&S(zRe(T,O.token.symbol,l.conversions))}),[T,O]);const H=uV.useCallback((()=>{const e=O?"":"views.BRIDGE_FORM.validation.noTokenSelected";const t=L7e(T,O?.formattedBalance);return e&&_(e),t&&x(t),!e&&!t}),[O,T,_,x]),W=uV.useCallback((async()=>{H()&&a&&o?.web3Provider&&O&&(w({userJourney:bPe.BRIDGE,screen:"TokenAmount",control:"Review",controlType:"Button",extras:{tokenAddress:O.token.address,amount:T}}),n({payload:{type:j9e.SET_TOKEN_AND_AMOUNT,token:O.token,amount:T}}),f({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.BRIDGE_REVIEW}}}))}),[a,o?.web3Provider,H,O]);return Iq(N3,{testId:p,sx:j7e,children:[Iq(N3,{sx:{paddingX:"base.spacing.x4"},children:[Cq(qee,{testId:`${p}-content-heading`,size:"small",weight:"regular",sx:{paddingBottom:"base.spacing.x4"},children:t("views.BRIDGE_FORM.content.title")}),(!m||!y)&&Iq(N3,{sx:F7e,children:[Cq(l2e,{testId:"bridge-token",options:D,optionsLoading:y,coinSelectorHeading:t("views.BRIDGE_FORM.bridgeForm.from.selectorTitle"),selectedOption:U,subtext:M,textAlign:"left",errorMessage:t(I),onSelectChange:e=>(e=>{const t=r.find((t=>e===B(t.token.symbol,t.token.address)));t&&(C(t),_(""))})(e),defaultTokenImage:b,environment:g,theme:v}),Cq(d2e,{testId:"bridge-amount",type:"number",value:T,placeholder:t("views.BRIDGE_FORM.bridgeForm.from.inputPlaceholder"),subtext:`${t("views.BRIDGE_FORM.content.fiatPricePrefix")} $${HRe(P,!0)}`,validator:Yqe,onTextInputChange:e=>z(e),onTextInputEnter:W,textAlign:"right",inputMode:"decimal",errorMessage:t(A)})]}),m&&y&&Cq(U7e,{sx:F7e})]}),Iq(N3,{sx:B7e,children:[Cq(O3,{testId:`${p}-button`,variant:"primary",onClick:W,size:"large",children:t("views.BRIDGE_FORM.bridgeForm.buttonText")}),Cq(k2e,{visible:j,showHeaderBar:!1,onCloseDrawer:()=>F(!1),onRetry:async()=>{F(!1),await W()}})]})]})}const H7e=1e4;function W7e({amount:e,tokenAddress:t,defaultTokenImage:n,theme:r}){const{t:i}=_ke(),{bridgeState:a,bridgeDispatch:o}=uV.useContext(F9e),{checkout:s,from:c}=a,{eventTargetState:{eventTarget:u}}=uV.useContext(zqe),[l,d]=uV.useState(!1),{page:f}=OPe();uV.useEffect((()=>{(e||t)&&f({userJourney:bPe.BRIDGE,screen:"TokenAmount",extras:{amount:e,tokenAddress:t}})}),[]);const p=uV.useCallback((async()=>{if(s&&c?.web3Provider)try{const e=await O8e({checkout:s,provider:c.web3Provider,chainId:c?.network,allowTokenListType:ZH.BRIDGE,retryPolicy:{retryIntervalMs:0,retries:0}});if(void 0===e)return;o({payload:{type:j9e.SET_TOKEN_BALANCES,tokenBalances:e.allowedBalances}}),o({payload:{type:j9e.SET_ALLOWED_TOKENS,allowedTokens:e.allowList.tokens}})}catch(e){console.debug(e)}}),[s,c?.web3Provider,c?.network]);return N2e(p,H7e),uV.useEffect((()=>{s&&c?.web3Provider&&(d(!0),p().finally((()=>d(!1))))}),[s,c?.web3Provider]),Cq(_Pe,{testId:"bridge-view",header:Cq(xRe,{showBack:!0,title:i("views.BRIDGE_FORM.header.title"),onCloseButtonClick:()=>H9e(u)}),footer:Cq(oNe,{}),children:Cq(z7e,{testId:"bridge-form",defaultAmount:e,defaultTokenAddress:t,isTokenBalancesLoading:l,defaultTokenImage:n,environment:s?.config.environment,theme:r})})}const V7e={display:"flex",flexDirection:"column",alignItems:"center",paddingBottom:"base.spacing.x6",height:"100%",paddingX:"base.spacing.x6"},G7e={fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"15px",paddingX:"base.spacing.x6"},q7e={...G7e,color:"base.color.text.body.secondary"},K7e={display:"flex",flexDirection:"column",justifyContent:"flex-end",gap:"base.spacing.x2",height:"100%",width:"100%"},X7e={width:"100%",height:"base.spacing.x16"};function Y7e({environment:e,onCloseDrawer:t,visible:n,walletAddress:r,tokenSymbol:i,onAddCoinsClick:a}){const{t:o}=_ke(),[s,c]=uV.useState(!1),u=XRe(e,"/notenougheth.svg"),l=XRe(e,"/notenoughimx.svg"),d=o("drawers.notEnoughGas.content.heading",{token:i.toUpperCase()}),f=o("drawers.notEnoughGas.content.body",{token:i.toUpperCase()}),p=uV.useCallback((()=>{r&&""!==r&&navigator.clipboard.writeText(r),c(!0),setTimeout((()=>{c(!1)}),3e3)}),[r]);return Cq(wne,{size:"threeQuarter",visible:n,showHeaderBar:!0,headerBarTitle:void 0,onCloseDrawer:t,children:Iq(wne.Content,{testId:"not-enough-gas-bottom-sheet",sx:V7e,children:[Cq(K9,{sx:{w:"90px",h:i===Fke?"110px":"90px"},use:Cq("img",{src:i===Fke?u:l,alt:d})}),Cq(qee,{size:"small",weight:"bold",sx:G7e,testId:"not-enough-gas-heading",children:d}),Cq(tee,{sx:q7e,children:f}),Cq(N3,{sx:K7e,children:i===Fke?Iq(O3,{testId:"not-enough-gas-copy-address-button",sx:X7e,variant:"primary",onClick:p,children:[o("drawers.notEnoughGas.buttons.copyAddress"),Cq(O3.Icon,{icon:s?"Tick":"CopyText"})]}):Cq(O3,{testId:"not-enough-gas-add-imx-button",sx:X7e,variant:"primary",onClick:a,children:o("drawers.notEnoughGas.buttons.addMoreImx")})})]})})}const Z7e={borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",marginBottom:"2px",position:"relative"},J7e={borderTopLeftRadius:"0px",borderTopRightRadius:"0px",backgroundColor:"base.color.translucent.emphasis.100",position:"relative"},Q7e={width:"base.icon.size.400"},$7e={position:"absolute",top:"2px",left:"26px",width:"20px",padding:"2px",backgroundColor:"base.color.translucent.inverse.900",borderRadius:"base.borderRadius.x2"},eet={height:"100%",display:"flex",flexDirection:"column",paddingX:"base.spacing.x4"},tet={paddingTop:"base.spacing.x10",paddingBottom:"base.spacing.x4"},net={display:"flex",flexDirection:"column",alignItems:"center",paddingY:"base.spacing.x1"},ret={width:"base.icon.size.300",transform:"rotate(270deg)"},iet={width:"base.icon.size.400"},aet={backgroundColor:"base.color.translucent.standard.200",position:"absolute",width:"32px",height:"32px",padding:"6px",left:"base.spacing.x3"},oet={position:"absolute",right:"base.spacing.x3",w:"base.icon.size.400",h:"base.icon.size.400"},set=(e,t,n,r)=>{const i=[];if(!e?.fees||!e.token)return i;let a=jr.from(0);if(e.fees.bridgeFee&&(a=a.add(e.fees.bridgeFee)),e.fees.imtblFee&&(a=a.add(e.fees.imtblFee)),a.gt(0)&&i.push({label:r(t?"drawers.feesBreakdown.fees.serviceFee.depositLabel":"drawers.feesBreakdown.fees.serviceFee.withdrawLabel"),fiatAmount:`≈ ${r("drawers.feesBreakdown.fees.fiatPricePrefix")}${zRe(Xd(a,e.token.decimals),e.token.symbol,n.conversions)}`,amount:VRe(Xd(a,e.token.decimals)),token:e.token}),e.fees.sourceChainGas?.gt(0)){const t=Xd(e.fees.sourceChainGas,e.token.decimals);i.push({label:r("drawers.feesBreakdown.fees.gasFeeMove.label"),fiatAmount:`≈ ${r("drawers.feesBreakdown.fees.fiatPricePrefix")}${zRe(t,e.token.symbol,n.conversions)}`,amount:`${VRe(t)}`,prefix:"≈ ",token:e.token})}if(e.fees.approvalFee?.gt(0)){const t=Xd(e.fees.approvalFee,e.token.decimals);i.push({label:r("drawers.feesBreakdown.fees.approvalFee.label"),fiatAmount:`≈ ${r("drawers.feesBreakdown.fees.fiatPricePrefix")}${zRe(t,e.token.symbol,n.conversions)}`,amount:`${VRe(t)}`,prefix:"≈ ",token:e.token})}return i},cet=(e,t)=>new pl(e,["function transfer(address to, uint amount)"],t),uet="bridge-review-summary";function det(){const{t:e}=_ke(),{viewDispatch:t}=uV.useContext(ERe),{bridgeState:{checkout:n,tokenBridge:r,from:i,to:a,token:o,amount:s,tokenBalances:c},bridgeDispatch:u}=uV.useContext(F9e),{environment:l}=n.config,{track:d}=OPe(),{cryptoFiatState:f}=uV.useContext($6e),[p,h]=uV.useState(!1),[m,y]=uV.useState(void 0),[b,g]=uV.useState(""),[v,w]=uV.useState(""),[T,E]=uV.useState(void 0),[A,x]=uV.useState(void 0),[O,C]=uV.useState(!1),[I,_]=uV.useState(void 0),[P,S]=uV.useState(void 0),[k,R]=uV.useState(!1),[N,M]=uV.useState(!1),{isWalletConnectEnabled:D,getWalletLogoUrl:L}=aqe(),[j,F]=uV.useState(!1),B=uV.useMemo((()=>i?.network===a?.network),[i,a]),U=uV.useMemo((()=>Qke(n.config)===a?.network),[i,a,n]),z=uV.useMemo((()=>{if(!m)return!1;if(!o)return!0;const e=c.find((e=>KRe(e.token.address)));let t=jr.from(m.fees.totalFees);return KRe(o.address)&&(t=t.add(Yd(s,o.decimals))),!e||e.balance.lt(t)}),[c,m,o,s]),H=uV.useMemo((()=>o?.symbol?`${o?.symbol} ${s}`:`${s}`),[o,s]),W=uV.useMemo((()=>s&&o?zRe(s,o.symbol,f.conversions):""),[o,s]),V=uV.useMemo((()=>i?i.walletAddress:"-"),[i]),G=uV.useMemo((()=>i&&i.network),[i]),q=uV.useMemo((()=>a?a.walletAddress:"-"),[a]),K=uV.useMemo((()=>a?.network),[a]),X=uV.useCallback((async()=>{if(!(r&&s&&i&&a&&o))return;const e=o?.address?.toLowerCase()??Nke.toUpperCase(),t={gasEstimateType:XH.BRIDGE_TO_L2,fees:{},token:n.config.networkMap.get(i.network)?.nativeCurrency};let c;if(e===Nke.toLowerCase())c=n.providerCall(i.web3Provider,(async e=>await e.estimateGas({to:q,from:V,value:Yd(s,o.decimals)})));else{c=cet(e,i.web3Provider.getSigner()).estimateGas.transfer(q,Yd(s,o.decimals))}try{const[e,n]=await Promise.all([c,i.web3Provider.getGasPrice()]),r=e.mul(n),a=Xd(r,Mke);t.fees.sourceChainGas=r,t.fees.totalFees=r,y(t),g(a),w(zRe(a,Nke.toUpperCase(),f.conversions))}catch(e){console.error("Unable to fetch gas estimate",e)}}),[n,i,a,o,s]),Y=uV.useCallback((async()=>{if(!(r&&s&&i&&a&&o))return;const e=await r.getUnsignedBridgeBundledTx({senderAddress:V,recipientAddress:q,token:o.address??Nke.toUpperCase(),amount:Yd(s,o.decimals),sourceChainId:i?.network.toString(),destinationChainId:a?.network.toString(),gasMultiplier:"auto"}),t={contractToApprove:e.contractToApprove,unsignedTx:e.unsignedApprovalTx},c={feeData:e.feeData,unsignedTx:e.unsignedBridgeTx};E(t),x(c);const u=c.feeData,{totalFees:l,approvalFee:d}=u;let p=l;t.unsignedTx||(p=l.sub(d),u.approvalFee=jr.from(0));const h={gasEstimateType:XH.BRIDGE_TO_L2,fees:{...u,totalFees:p},token:n.config.networkMap.get(i.network)?.nativeCurrency};y(h);const m=Xd(h?.fees.totalFees||0,Mke);g(m),w(zRe(m,h?.token?.symbol||"",f.conversions))}),[n,r]);N2e((()=>{B?X():Y()}),Vke);const Z=uV.useCallback((()=>set(m,U,f,e)),[m,U]);uV.useEffect((()=>{(async()=>{h(!0),B?await X():await Y(),h(!1)})()}),[]);const J=uV.useCallback((e=>{u({payload:{type:j9e.SET_WALLETS_AND_NETWORKS,from:{web3Provider:e,walletAddress:i?.walletAddress,walletProviderInfo:i?.walletProviderInfo,network:i?.network},to:{web3Provider:a?.web3Provider,walletAddress:a?.walletAddress,walletProviderInfo:a?.walletProviderInfo,network:a?.network}}})}),[i?.web3Provider,i?.network,a?.web3Provider,a?.network]);uV.useEffect((()=>{if(!i?.web3Provider)return;const e=()=>{const e=new Ld(i?.web3Provider.provider);J(e),C(!1)};return nRe(i?.web3Provider,e),()=>{rRe(i?.web3Provider,e)}}),[i?.web3Provider]),uV.useEffect((()=>{if(D){const e=hNe(i?.web3Provider),t=hNe(a?.web3Provider);R(e),M(t),(async()=>{e&&_(await L()),t&&S(await L())})()}}),[D,i?.web3Provider,a?.web3Provider]),uV.useEffect((()=>{z&&F(!0)}),[z]);const Q=uV.useCallback((async()=>{if(B||T&&A)if(z)F(!0);else{try{const e=await(i?.web3Provider.provider).request({method:"eth_chainId",params:[]});if(parseInt(e.toString())!==i?.network)return void C(!0)}catch(e){console.error("Current network check failed",e)}d({userJourney:bPe.BRIDGE,screen:"Summary",control:"Submit",controlType:"Button",extras:{fromWalletAddress:V,fromNetwork:G,fromWallet:{address:V,rdns:i?.walletProviderInfo?.rdns,uuid:i?.walletProviderInfo?.uuid,isPassportWallet:fNe(i?.web3Provider),isMetaMask:pNe(i?.web3Provider)},toWalletAddress:q,toNetwork:K,toWallet:{address:q,rdns:a?.walletProviderInfo?.rdns,uuid:a?.walletProviderInfo?.uuid,isPassportWallet:fNe(a?.web3Provider),isMetaMask:pNe(a?.web3Provider)},amount:s,fiatAmount:W,tokenAddress:o?.address,moveType:B?"transfer":"bridge"}}),t({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.APPROVE_TRANSACTION,approveTransaction:T,transaction:A}}})}}),[t,T,A,i?.web3Provider,i?.network,i?.walletProviderInfo,a?.web3Provider,a?.network,a?.walletProviderInfo]);return Iq(N3,{testId:uet,sx:eet,children:[Cq(qee,{testId:`${uet}-heading`,size:"small",weight:"regular",sx:tet,children:e("views.BRIDGE_REVIEW.heading")}),Iq(oae,{testId:`${uet}-from-amount`,size:"small",emphasized:!0,sx:Z7e,children:[Cq(oae.Label,{size:"small",sx:{marginBottom:"base.spacing.x4",fontWeight:"bold"},children:e("views.BRIDGE_REVIEW.fromLabel.amountHeading")}),Cq(oae.Caption,{}),Cq(oae.PriceDisplay,{use:Cq(qee,{size:"xSmall",weight:"light"}),price:H??"-",fiatAmount:`${e("views.BRIDGE_REVIEW.fiatPricePrefix")}${W}`})]}),Iq(oae,{testId:`${uet}-from-address`,size:"xSmall",emphasized:!0,sx:J7e,children:[k&&I?Iq(Oq,{children:[Cq(oae.FramedImage,{imageUrl:I,alt:"walletconnect",sx:Q7e}),Cq(O8,{logo:"WalletConnectSymbol",sx:$7e})]}):i?.walletProviderInfo&&Cq(dNe,{src:i?.walletProviderInfo.icon,alt:i?.walletProviderInfo.name,sx:aet}),Iq(oae.Label,{sx:{marginLeft:k&&I?"0px":"45px"},children:[Cq("strong",{children:e("views.BRIDGE_REVIEW.fromLabel.heading")})," ",Cq(tee,{size:"small",sx:{color:"base.color.text.body.secondary"},children:E7e(V??"")})]}),G&&Cq(oae.FramedImage,{use:Cq("img",{src:ZRe(l,G),alt:$ke[G]}),sx:oet})]}),Cq(N3,{sx:net,children:Cq(S6,{icon:"ArrowBackward",sx:ret})}),Iq(oae,{testId:`${uet}-to-address`,size:"xSmall",emphasized:!0,sx:Z7e,children:[N&&P?Iq(Oq,{children:[Cq(oae.FramedImage,{imageUrl:P,alt:"walletconnect",sx:Q7e}),Cq(O8,{logo:"WalletConnectSymbol",sx:$7e})]}):a?.walletProviderInfo&&Cq(dNe,{src:a?.walletProviderInfo.icon,alt:a?.walletProviderInfo.name,sx:aet}),Iq(oae.Label,{sx:{marginLeft:N&&P?"0px":"45px"},children:[Cq("strong",{children:e("views.BRIDGE_REVIEW.toLabel.heading")})," ",Cq(tee,{size:"small",sx:{color:"base.color.text.body.secondary"},children:E7e(q??"")})]}),K&&Cq(oae.FramedImage,{use:Cq("img",{src:ZRe(l,K),alt:$ke[K]}),sx:oet})]}),Cq(A2e,{gasFeeValue:b,gasFeeFiatValue:v,gasFeeToken:m?.token,fees:Z(),onFeesClick:()=>{d({userJourney:bPe.BRIDGE,screen:"MoveCoins",control:"ViewFees",controlType:"Button"})},sx:{borderTopRightRadius:"0",borderTopLeftRadius:"0"},loading:p}),Cq(N3,{sx:{flex:1,display:"flex",flexDirection:"column",justifyContent:"flex-end",paddingY:"base.spacing.x6",width:"100%"},children:m&&!p&&Cq(O3,{size:"large",sx:{width:"100%"},onClick:Q,disabled:p,testId:`${uet}__submit-button`,children:p?Cq(O3.Icon,{icon:"Loading",sx:iet}):e("views.BRIDGE_REVIEW.submitButton.buttonText")})}),Cq(G6e,{visible:O,targetChainId:i?.network,provider:i?.web3Provider,checkout:n,onCloseDrawer:()=>C(!1),onNetworkSwitch:J}),Cq(Y7e,{environment:n.config.environment,visible:j,onCloseDrawer:()=>F(!1),walletAddress:i?.walletAddress||"",tokenSymbol:i?.network===Jke(n?.config)?Fke:jke,onAddCoinsClick:()=>{t({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.TOP_UP_VIEW}}})}})]})}function fet(){const{t:e}=_ke(),{eventTargetState:{eventTarget:t}}=uV.useContext(zqe),{page:n}=OPe();return uV.useEffect((()=>{n({userJourney:bPe.BRIDGE,screen:"Review"})}),[]),Cq(_Pe,{testId:"bridge-review",header:Cq(xRe,{showBack:!0,title:e("views.BRIDGE_REVIEW.layoutHeading"),onCloseButtonClick:()=>H9e(t)}),footer:Cq(oNe,{}),children:Cq(det,{})})}function pet({environment:e}){const{RiveComponent:t}=cue.useRive({src:`${Gke[e]}/v1/blob/img/rocket.riv`,autoplay:!0,layout:new cue.Layout({fit:cue.Fit.Cover}),stateMachines:"State Machine 1"});return Cq(N3,{sx:{...IRe,background:"base.color.translucent.emphasis.100"},children:Cq(N3,{sx:ORe,rc:Cq(t,{})})})}function het({transactionHash:e,isTransfer:t}){const{t:n}=_ke(),{eventTargetState:{eventTarget:r}}=uV.useContext(zqe),{page:i}=OPe(),{cryptoFiatState:a}=uV.useContext($6e),{viewDispatch:o}=uV.useContext(ERe),{bridgeState:{checkout:s,from:c,to:u,token:l,amount:d}}=uV.useContext(F9e);return uV.useEffect((()=>{U9e(r,e);const n=zRe(d,l?.symbol??"",a.conversions);i({userJourney:bPe.BRIDGE,screen:"InProgress",extras:{fromWalletAddress:c?.walletAddress,toWalletAddress:u?.walletAddress,amount:d,fiatAmount:n,tokenAddress:l?.address,moveType:t?"transfer":"bridge"}})}),[]),Cq(_Pe,{testId:"move-in-progress-view",header:Cq(xRe,{transparent:!0,onCloseButtonClick:()=>H9e(r),rightActions:Iq(Oq,{children:[Cq(d4,{icon:"Minting",sx:gRe(),onClick:()=>{o({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.TRANSACTIONS}}})},testId:"settings-button"}),!t&&Cq(dee,{isAnimated:!0,variant:"guidance",sx:{position:"absolute",right:"base.spacing.x14",top:"base.spacing.x1"}})]})}),footer:Cq(oNe,{}),heroContent:Cq(pet,{environment:s.config.environment}),floatHeader:!0,children:Iq(RRe,{heading:n(t?"views.IN_PROGRESS.transferHeading":"views.IN_PROGRESS.heading"),children:[!t&&Iq(Oq,{children:[n("views.IN_PROGRESS.body1"),Cq("br",{}),Cq("br",{})]}),n("views.IN_PROGRESS.body2")]})})}function met({bridgeTransaction:e}){const{t:t}=_ke(),{bridgeState:n}=uV.useContext(F9e),{checkout:r,from:i,to:a,token:o,amount:s}=n,{viewDispatch:c}=uV.useContext(ERe),{eventTargetState:{eventTarget:u}}=uV.useContext(zqe),{page:l}=OPe();uV.useEffect((()=>{l({userJourney:bPe.BRIDGE,screen:"ApproveTransaction",extras:{moveType:e?"bridge":"transfer"}})}),[]);const[d,f]=uV.useState(!1),[p,h]=uV.useState(!1),[m,y]=uV.useState(!1),[b,g]=uV.useState(!1),v=uV.useCallback((()=>{c({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.ERROR_VIEW,error:new Error("No checkout object or no provider object found")}}})}),[c]),w=uV.useCallback((()=>{c({payload:{type:TRe.GO_BACK}})}),[c]),T=e=>{if(e.type!==uW.UNPREDICTABLE_GAS_LIMIT){if(e.type===uW.TRANSACTION_FAILED||e.type===uW.INSUFFICIENT_FUNDS||e.receipt&&0===e.receipt.status){let t="Transaction failed";return e.type===uW.INSUFFICIENT_FUNDS&&(t="Insufficient funds"),e.receipt&&0===e.receipt.status&&(t="Transaction failed to settle on chain"),void c({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.BRIDGE_FAILURE,reason:t}}})}c({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.ERROR_VIEW,error:e}}})}else c({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.BRIDGE_FAILURE,reason:"Unpredictable gas limit"}}})},E=uV.useCallback((async()=>{if(!r||!i?.web3Provider)return void v();if(d)return;f(!0),h(!0);const e=o?.address?.toLowerCase()??Nke.toUpperCase();let t;try{if(e===Nke.toLowerCase()){const e={to:a?.walletAddress,value:Yd(s,o?.decimals)};t=(await r.sendTransaction({provider:i.web3Provider,transaction:e})).transactionResponse.hash}else{const n=cet(e,i.web3Provider.getSigner()),c=Yd(s,o?.decimals);t=(await r.providerCall(i.web3Provider,(async()=>await n.transfer(a?.walletAddress,c)))).hash}c({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.IN_PROGRESS,transactionHash:t,isTransfer:!0}}})}catch(e){h(!1),e.type===uW.USER_REJECTED_REQUEST_ERROR?g(!0):T(e)}finally{f(!1)}}),[r,i,v,c,d]),A=uV.useCallback((async()=>{let t=!1;const{approveTransaction:n,transaction:a}=e;if(r&&i?.web3Provider&&a){if(!d){if(f(!0),n.unsignedTx)try{h(!0);const e=await r.sendTransaction({provider:i.web3Provider,transaction:n.unsignedTx});if(1!==(await e.transactionResponse.wait()).status)return void c({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.BRIDGE_FAILURE,reason:"Transaction failed to settle on chain"}}})}catch(e){h(!1),e.type===uW.USER_REJECTED_REQUEST_ERROR?(g(!0),t=!0):T(e)}finally{f(!1)}try{if(t)return;h(!0);const e=await r.sendTransaction({provider:i.web3Provider,transaction:a.unsignedTx});c({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.IN_PROGRESS,transactionHash:e.transactionResponse.hash,isTransfer:!1}}});0===(await e.transactionResponse.wait()).status&&c({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.BRIDGE_FAILURE,reason:"Approval transaction failed to settle on chain"}}})}catch(e){e.type===uW.USER_REJECTED_REQUEST_ERROR?g(!0):T(e)}finally{y(!1),h(!1),f(!1)}}}else v()}),[r,i,v,c,e,d]);return Iq(Oq,{children:[m&&Cq(PPe,{loadingText:t("views.APPROVE_TRANSACTION.loadingView.text")}),!m&&Cq(_Pe,{header:Cq(xRe,{transparent:!0,showBack:!0,onCloseButtonClick:()=>H9e(u),onBackButtonClick:w}),floatHeader:!0,heroContent:Cq(h8e,{}),footer:Iq(N3,{sx:{width:"100%",flexDirection:"column"},children:[Cq(yRe,{loading:p,actionText:t("views.APPROVE_TRANSACTION."+(b?"footer.retryText":"footer.buttonText")),onActionClick:e?A:E}),Cq(oNe,{})]}),children:Cq(RRe,{heading:t("views.APPROVE_TRANSACTION.content.heading"),children:Cq(N3,{children:t("views.APPROVE_TRANSACTION.content.body")})})})]})}const yet={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x1",height:"100%"},bet={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"15px"},get={display:"flex",flexDirection:"column",justifyContent:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},vet={width:"100%",height:"base.spacing.x16"};function wet({visible:e,onClose:t,onChangeAccount:n}){const{t:r}=_ke(),{bridgeState:{checkout:i}}=uV.useContext(F9e),a=XRe(i.config.environment,"/tokens/eth.svg");return Cq(wne,{headerBarTitle:void 0,size:"full",onCloseDrawer:t,visible:e,showHeaderBar:!1,children:Cq(wne.Content,{children:Iq(N3,{testId:"not-enough-eth-drawer",sx:yet,children:[Cq(K9,{sx:{w:"base.icon.size.600",h:"base.icon.size.600"},use:Cq("img",{src:a,alt:"ETH"})}),Cq(qee,{size:"small",sx:bet,testId:"not-enough-gas-heading",children:`${r("drawers.notEnoughEthWithdrawal.content.heading1")} ${Fke} ${r("drawers.notEnoughEthWithdrawal.content.heading2")}`}),Cq(tee,{sx:bet,children:`${r("drawers.notEnoughEthWithdrawal.content.body1")} ${Fke} ${r("drawers.notEnoughEthWithdrawal.content.body2")}`}),Iq(N3,{sx:get,children:[Cq(O3,{testId:"not-enough-eth-drawer-retry-button",sx:vet,variant:"tertiary",onClick:n,children:r("drawers.notEnoughEthWithdrawal.buttons.retry")}),Cq(O3,{sx:vet,variant:"tertiary",onClick:t,testId:"not-enough-eth-drawer-dismiss-button",children:r("drawers.notEnoughEthWithdrawal.buttons.dismiss")})]})]})})})}function Tet({transaction:e}){const{t:t}=_ke(),{bridgeState:{checkout:n,tokenBridge:r,from:i}}=uV.useContext(F9e),{viewDispatch:a}=uV.useContext(ERe),{eventTargetState:{eventTarget:o}}=uV.useContext(zqe),{page:s}=OPe();uV.useEffect((()=>{s({userJourney:bPe.BRIDGE,screen:"ClaimWithdrawal"})}),[]);const[c,u]=uV.useState(!1),[l,d]=uV.useState(!1),[f,p]=uV.useState(!1),[h,m]=uV.useState(),[y,b]=uV.useState(!1),g=uV.useCallback((()=>{a({payload:{type:TRe.GO_BACK}})}),[a]);uV.useEffect((()=>{(async()=>{if(r&&e&&void 0!==e.details.current_status?.index){d(!0);try{const t=await(r?.getFlowRateWithdrawTx({recipient:e.details.to_address,index:e.details.current_status.index}));m(t)}catch(e){console.log(e)}finally{d(!1)}}})()}),[r,e]);const v=uV.useCallback((async({forceChangeAccount:e})=>{if(!(n&&r&&i?.web3Provider&&h))return;if(!h.pendingWithdrawal.canWithdraw||!h.unsignedTx)return void console.log(`Unable to process withdrawal transaction as it is not ready yet. Delay timeout at ${h.pendingWithdrawal.timeoutEnd} `);let t=i?.web3Provider;const o=Jke(n.config);if(u(!0),fNe(i?.web3Provider)||e)try{const e=await n.createProvider({walletProviderName:$H.METAMASK});t=(await n.connect({provider:e.provider,requestWalletPermissions:!0})).provider,b(!1)}catch(e){return console.log(e),p(!0),void u(!1)}let s,c=null;try{try{s=await t.estimateGas(h.unsignedTx)}catch(e){s=jr.from(Xke)}let e=null;try{e=await t.getFeeData()}catch(e){console.log(e)}let n=null;e&&e.lastBaseFeePerGas&&e.maxPriorityFeePerGas?n=e.lastBaseFeePerGas.add(e.maxPriorityFeePerGas):e&&e.gasPrice&&(n=e.gasPrice),n&&(c=s.mul(n))}catch(e){console.log(e)}try{const e=(await n.getAllBalances({provider:t,chainId:o})).balances.find((e=>KRe(e.token.address)));if(!e||e.balance.lt(c))return b(!0),void u(!1)}catch(e){console.log(e)}if((await t.getNetwork()).chainId!==o)try{t=(await n.switchNetwork({provider:t,chainId:o})).provider}catch(e){return p(!0),d(!1),void console.log(e)}try{const e=await n.sendTransaction({provider:t,transaction:h.unsignedTx});a({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.CLAIM_WITHDRAWAL_IN_PROGRESS,transactionResponse:e.transactionResponse}}})}catch(e){console.log(e),p(!0),u(!1)}finally{u(!1)}}),[r,i,h]);return Iq(_Pe,{testId:"claim-withdrawal",header:Cq(xRe,{transparent:!0,showBack:!0,onCloseButtonClick:()=>H9e(o),onBackButtonClick:g}),floatHeader:!0,heroContent:Cq(h8e,{}),footer:Iq(N3,{sx:{width:"100%",display:"flex",flexDirection:"column"},children:[Cq(N3,{sx:{pb:"base.spacing.x5",px:"base.spacing.x6",width:"100%",display:"flex",flexDirection:"column"},children:Cq(O3,{testId:"claim-withdrawal-continue-button",size:"large",variant:"primary",disabled:l,onClick:()=>c||l?void 0:v({forceChangeAccount:!0}),children:l||c?Cq(O3.Icon,{icon:"Loading",sx:{width:"base.icon.size.400"}}):t("views.CLAIM_WITHDRAWAL."+(f?"footer.retryText":"footer.buttonText"))})}),Cq(oNe,{})]}),children:[Iq(RRe,{heading:`${t("views.CLAIM_WITHDRAWAL.content.heading")} ${SPe(Jke(n.config))}`,children:[Cq(N3,{sx:{display:"flex",flexWrap:"wrap",pb:"base.spacing.x1"},children:t("views.CLAIM_WITHDRAWAL.content.body")}),Iq(N3,{children:[t("views.CLAIM_WITHDRAWAL.content.body2"),Cq(tse,{text:e.details.to_address.toLowerCase()??""})]})]}),Cq(wet,{visible:y,onClose:()=>b(!1),onChangeAccount:()=>v({forceChangeAccount:!0})})]})}function Eet({checkout:e,web3Provider:t,config:n,amount:r,tokenAddress:i}){const{t:a}=_ke(),{environment:o,isOnRampEnabled:s,isSwapEnabled:c,isBridgeEnabled:u,theme:l}=n,d=QRe(e.config.environment,l),{eventTargetState:{eventTarget:f}}=uV.useContext(zqe),{page:p}=OPe(),[h,m]=uV.useReducer(ARe,{...wRe,view:{type:y8e.WALLET_NETWORK_SELECTION},history:[{type:y8e.WALLET_NETWORK_SELECTION}]}),[y,b]=uV.useReducer(B9e,{...L9e,checkout:e,web3Provider:t??null,tokenBridge:(()=>{let t=Zy;e.config.isDevelopment&&(t=Yy),e.config.isProduction&&(t=Jy);const n=new _d(e.config.networkMap.get(Jke(e.config))?.rpcUrls[0]),r=new _d(e.config.networkMap.get(Qke(e.config))?.rpcUrls[0]),i=new Tg({baseConfig:new Zt({environment:e.config.environment}),bridgeInstance:t,rootProvider:n,childProvider:r});return new Pb(i)})()}),g=uV.useMemo((()=>({viewState:h,viewDispatch:m})),[h,m]),v=uV.useMemo((()=>({bridgeState:y,bridgeDispatch:b})),[y,b]),w=uV.useCallback((()=>{b({payload:{type:j9e.SET_WALLETS_AND_NETWORKS,from:null,to:null}}),b({payload:{type:j9e.SET_TOKEN_AND_AMOUNT,amount:"",token:null}}),m({payload:{type:TRe.GO_BACK_TO,view:{type:y8e.WALLET_NETWORK_SELECTION}}})}),[m]),T=uV.useCallback((()=>{m({payload:{type:TRe.GO_BACK_TO,view:{type:y8e.WALLET_NETWORK_SELECTION}}})}),[m]),E=uV.useCallback((()=>{m({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.TRANSACTIONS}}})}),[m]),A=uV.useCallback((()=>{m({payload:{type:TRe.GO_BACK_TO,view:{type:y8e.BRIDGE_REVIEW}}})}),[m]);return uV.useEffect((()=>{(async()=>{b({payload:{type:j9e.SET_PROVIDER,web3Provider:t??null}})})()}),[t]),Cq(ERe.Provider,{value:g,children:Cq(F9e.Provider,{value:v,children:Iq(d8e,{environment:o,children:[h.view.type===y8e.WALLET_NETWORK_SELECTION&&Cq(D7e,{}),h.view.type===y8e.BRIDGE_FORM&&Cq(W7e,{amount:r,tokenAddress:i,defaultTokenImage:d,theme:l}),h.view.type===y8e.BRIDGE_REVIEW&&Cq(fet,{}),h.view.type===y8e.IN_PROGRESS&&Cq(het,{transactionHash:h.view.transactionHash,isTransfer:h.view.isTransfer}),h.view.type===y8e.BRIDGE_FAILURE&&Cq(Lqe,{testId:"bridge-fail",statusText:a("views.BRIDGE_FAILURE.bridgeFailureText.statusText"),actionText:a("views.BRIDGE_FAILURE.bridgeFailureText.actionText"),onActionClick:A,statusType:_qe.FAILURE,onRenderEvent:()=>{let e="";h.view.type===y8e.BRIDGE_FAILURE&&(e=h.view.reason),p({userJourney:bPe.BRIDGE,screen:"Failed",extras:{reason:e}}),z9e(f,e)}}),h.view.type===y8e.APPROVE_TRANSACTION&&Cq(met,{bridgeTransaction:h.view.approveTransaction&&h.view.transaction?{approveTransaction:h.view.approveTransaction,transaction:h.view.transaction}:void 0}),h.view.type===y8e.TRANSACTIONS&&Cq(w7e,{onBackButtonClick:T,defaultTokenImage:d}),h.view.type===y8e.CLAIM_WITHDRAWAL&&Cq(Tet,{transaction:h.view.transaction}),h.view.type===vRe.ERROR_VIEW&&Cq(NRe,{actionText:a("views.ERROR_VIEW.actionText"),onActionClick:w,onCloseClick:()=>H9e(f),errorEventAction:()=>{p({userJourney:bPe.BRIDGE,screen:"Error"})}}),h.view.type===vRe.TOP_UP_VIEW&&Cq(A8e,{analytics:{userJourney:bPe.BRIDGE},widgetEvent:kH.IMTBL_BRIDGE_WIDGET_EVENT,checkout:e,provider:t,showOnrampOption:s,showSwapOption:c,showBridgeOption:u,onCloseButtonClick:()=>H9e(f)}),h.view.type===y8e.CLAIM_WITHDRAWAL_IN_PROGRESS&&Cq(T7e,{transactionResponse:h.view.transactionResponse}),h.view.type===y8e.CLAIM_WITHDRAWAL_SUCCESS&&Cq(Lqe,{statusText:a("views.CLAIM_WITHDRAWAL.IN_PROGRESS.success.text"),actionText:a("views.CLAIM_WITHDRAWAL.IN_PROGRESS.success.actionText"),onRenderEvent:()=>{p({userJourney:bPe.BRIDGE,screen:"ClaimWithdrawalSuccess"}),W9e(f,h.view.transactionHash)},onActionClick:E,statusType:_qe.SUCCESS,testId:"claim-withdrawal-success-view"}),h.view.type===y8e.CLAIM_WITHDRAWAL_FAILURE&&Cq(Lqe,{statusText:a("views.CLAIM_WITHDRAWAL.IN_PROGRESS.failure.text"),actionText:a("views.CLAIM_WITHDRAWAL.IN_PROGRESS.failure.actionText"),onRenderEvent:()=>{let e="";h.view.type===y8e.CLAIM_WITHDRAWAL_FAILURE&&(e=h.view.reason),p({userJourney:bPe.BRIDGE,screen:"ClaimWithdrawalFailure",extras:{reason:e}}),V9e(f,h.view.transactionHash,"Transaction failed")},onActionClick:E,statusType:_qe.FAILURE,onCloseClick:()=>H9e(f),testId:"claim-withdrawal-fail-view"})]})})})}var Aet,xet=Object.freeze({__proto__:null,default:Eet});function Oet({fundingRouteStep:e,onFundingRouteExecuted:t}){const{t:n}=_ke(),{config:r,provider:i,checkout:a,fromTokenAddress:o}=z4e(),{viewDispatch:s}=uV.useContext(ERe),{connectLoaderDispatch:c}=uV.useContext(jRe),[u,l]=uV.useState(void 0),[d,f]=uV.useState(void 0),[p,h]=uV.useState(void 0),[m,y]=uV.useState(Aet.LOADING),b=uV.useRef(!1),g=uV.useRef(void 0),v=uV.useRef(void 0),[w,T]=uV.useReducer(Hqe,Bqe),E=uV.useMemo((()=>({eventTargetState:w,eventTargetDispatch:T})),[w,T]),A=new EventTarget,x=e=>{s({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.SALE_FAIL,data:{errorType:E4e.FUNDING_ROUTE_EXECUTE_ERROR,errorData:e}}}})},O=uV.useCallback((async e=>{if(!a||!i)throw new Error("checkout or provider not available.");const t=await a.getNetworkInfo({provider:i});if(e.type===sW.BRIDGE){if(f({tokenAddress:e.fundingItem.token.address,amount:e.fundingItem.fundsRequired.formattedAmount}),t.chainId===Jke(a.config))return void y(Aet.EXECUTE_BRIDGE);b.current=Aet.EXECUTE_BRIDGE,y(Aet.SWITCH_NETWORK_ETH)}if(e.type===sW.SWAP){if(l({amount:e.fundingItem.fundsRequired.formattedAmount,fromTokenAddress:e.fundingItem.token.address,toTokenAddress:o}),t.chainId===Qke(a.config))return void y(Aet.EXECUTE_SWAP);b.current=Aet.EXECUTE_SWAP,y(Aet.SWITCH_NETWORK_ZKEVM)}e.type===sW.ONRAMP&&(h({amount:e.fundingItem.fundsRequired.formattedAmount,tokenAddress:e.fundingItem.token.address}),y(Aet.EXECUTE_ON_RAMP))}),[i,a]);uV.useEffect((()=>{if(e)try{O(e)}catch(e){x(e)}}),[e]);const C=()=>{g.current?(g.current=void 0,v.current=void 0,t()):x(v.current)},I=e=>{switch(e.detail.type){case DH.SUCCESS:{const t=e.detail.data;g.current=t,C();break}case FH.TRANSACTION_SENT:case UH.SUCCESS:{const t=e.detail.data;g.current=t;break}case FH.FAILURE:case DH.FAILURE:case UH.FAILURE:{const t=e.detail.data;v.current=t;break}case FH.CLOSE_WIDGET:case DH.CLOSE_WIDGET:case UH.CLOSE_WIDGET:C();case DH.REJECTED:}},_=e=>{switch(e.detail.type){case NH.SUCCESS:{const t=e.detail.data;c({payload:{type:LRe.SET_PROVIDER,provider:t.provider}}),!1!==b.current&&(y(b.current),b.current=!1);break}case NH.FAILURE:case NH.CLOSE_WIDGET:default:C()}};return uV.useEffect((()=>(A.addEventListener(kH.IMTBL_CONNECT_WIDGET_EVENT,_),A.addEventListener(kH.IMTBL_BRIDGE_WIDGET_EVENT,I),A.addEventListener(kH.IMTBL_SWAP_WIDGET_EVENT,I),()=>{A.removeEventListener(kH.IMTBL_CONNECT_WIDGET_EVENT,_),A.removeEventListener(kH.IMTBL_BRIDGE_WIDGET_EVENT,I),A.removeEventListener(kH.IMTBL_SWAP_WIDGET_EVENT,I)})),[]),uV.useEffect((()=>{T({payload:{type:Uqe.SET_EVENT_TARGET,eventTarget:A}})}),[a]),Iq(zqe.Provider,{value:E,children:[m===Aet.LOADING&&Cq(PPe,{loadingText:n("views.ORDER_SUMMARY.loading.balances")}),m===Aet.EXECUTE_BRIDGE&&Cq(Eet,{...d,config:r,checkout:a}),m===Aet.EXECUTE_SWAP&&Cq(C8e,{...u,config:r}),m===Aet.EXECUTE_ON_RAMP&&Cq(k3e,{config:r,...p}),m===Aet.SWITCH_NETWORK_ETH&&Cq(Wqe,{config:r,targetChainId:a.config.isProduction?VH.ETHEREUM:VH.SEPOLIA,web3Provider:i,checkout:a,deepLink:aNe.SWITCH_NETWORK}),m===Aet.SWITCH_NETWORK_ZKEVM&&Cq(Wqe,{config:r,targetChainId:a.config.isProduction?VH.IMTBL_ZKEVM_MAINNET:VH.IMTBL_ZKEVM_TESTNET,web3Provider:i,checkout:a,deepLink:aNe.SWITCH_NETWORK})]})}function Cet({text:e,duration:t,animationUrl:n,inputValue:r=0}){const{addHandover:i}=DPe({id:NPe.GLOBAL});return b8e((()=>{i({duration:t,animationUrl:n,inputValue:r,children:Cq(qee,{sx:{px:"base.spacing.x6"},children:e})})})),null}function Iet({subView:e}){const{t:t}=_ke(),{sendProceedToPay:n}=Z4e(),{fromTokenAddress:r,collectionName:i,goToErrorView:a,goBackToPaymentMethods:o,sign:s,selectedCurrency:c,setPaymentMethod:u,environment:l}=z4e(),{viewDispatch:d,viewState:f}=uV.useContext(ERe),{cryptoFiatDispatch:p,cryptoFiatState:h}=uV.useContext($6e),{addHandover:m,closeHandover:y}=DPe({id:NPe.GLOBAL}),b=e=>{m({animationUrl:YRe(l,$4e(Q4e.APPROVE)),inputValue:t9e[Q4e.APPROVE].inputValues.start,children:Cq(qee,{sx:{px:"base.spacing.x6"},children:t("views.PAYMENT_METHODS.handover.initial")})}),s(A4e.CRYPTO,e),d({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.PAY_WITH_COINS}}})},g=()=>{b(c?.address)},{fundingBalances:v,loadingBalances:w,fundingBalancesResult:T,transactionRequirement:E,queryFundingBalances:A}=S9e();return uV.useEffect((()=>{e===T4e.INIT&&r&&A()}),[e,r]),uV.useEffect((()=>{0!==v.length&&(y(),d({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.ORDER_SUMMARY,subView:T4e.REVIEW_ORDER}}}))}),[v]),uV.useEffect((()=>{if(!w&&T.length&&!(v.length>0))try{const e=T.find((e=>e.currency.base))?.smartCheckoutResult,t=R9e(e.transactionRequirements);u(void 0),y(),d({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.TOP_UP_VIEW,data:t}}})}catch(e){a(E4e.SERVICE_BREAKDOWN,e)}}),[v,w,T]),uV.useEffect((()=>{if(!p||0===v.length||w)return;const e=v.map((({fundingItem:e})=>e.token.symbol));p({payload:{type:Q6e.SET_TOKEN_SYMBOLS,tokenSymbols:e}})}),[p,v,w]),Iq(N3,{children:[e===T4e.INIT&&Cq(Cet,{text:t("views.ORDER_SUMMARY.loading.balances"),animationUrl:YRe(l,"/preparing_order.riv"),inputValue:0}),e===T4e.REVIEW_ORDER&&Cq(E9e,{fundingBalances:v,conversions:h.conversions,collectionName:i,loadingBalances:w,onBackButtonClick:o,onProceedToBuy:e=>{const{type:t,fundingItem:r}=e;n(w4e.ORDER_SUMMARY,r,h.conversions),t!==x4e.SUFFICIENT?(y(),d({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.ORDER_SUMMARY,subView:T4e.EXECUTE_FUNDING_ROUTE,data:{fundingBalance:e,onFundingRouteExecuted:g}}}})):b(r.token.address)},transactionRequirement:E,onPayWithCard:e=>o(e)}),e===T4e.EXECUTE_FUNDING_ROUTE&&Cq(Oet,{fundingRouteStep:f.view.data.fundingBalance,onFundingRouteExecuted:g})]})}function _et(){return Cq(N3,{testId:"credit-card-warning-hero",children:Cq(N3,{children:Iq("svg",{width:"430",height:"161",viewBox:"0 0 430 161",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Cq("path",{d:"M172.973 133.128C171.472 132.262 170.399 130.653 170.399 128.67V91.134C170.399 87.4566 171.381 83.9165 173.158 80.8356C174.934 77.7546 177.509 75.137 180.697 73.2962L199.556 62.4057L231.623 44.1673C233.339 43.1761 235.27 43.3005 236.772 44.1673L229.34 39.8763C227.838 39.0095 225.907 38.8851 224.191 39.8763L192.124 58.1147L173.265 69.0052C170.077 70.8461 166.889 72.6253 165.112 75.7062C163.336 78.7872 162.967 83.1656 162.967 86.843V124.379C162.967 126.361 164.04 127.971 165.541 128.837L172.973 133.128Z",fill:"#F3F3F3",stroke:"#131313",strokeWidth:"1.64647",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M239.133 48.6725V85.9384C239.133 96.0882 236.344 99.3065 228.835 103.776L178.124 133.123C174.691 135.105 170.4 132.629 170.4 128.665V91.3985C170.4 82.7861 172.193 78.066 180.698 73.5609L231.409 44.2142C234.842 42.2317 239.133 44.7076 239.133 48.6725Z",fill:"#F3F3F3",stroke:"#131313",strokeWidth:"1.64647",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M172.973 133.127C171.472 132.26 170.399 130.651 170.399 128.668V91.3681C170.399 87.6907 170.631 83.7216 172.407 80.6406L164.975 76.3496C163.198 79.4306 162.967 83.3997 162.967 87.0771L162.967 124.377C162.967 126.36 164.04 127.969 165.541 128.836L172.973 133.127Z",fill:"#131313",stroke:"#131313",strokeWidth:"1.64647",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M170.261 125.267V114.74L239.346 75.0625V85.3194L170.261 125.267Z",fill:"#0D0D0D",stroke:"black",strokeWidth:"0.823233"}),Iq("g",{clipPath:"url(#clip0_1548_70742)",children:[Cq("path",{d:"M228.362 71.9146C219.392 76.9925 219.392 93.5869 228.362 108.975C237.331 124.363 251.872 132.721 260.842 127.643L249.638 134.081C240.669 139.159 226.128 130.802 217.158 115.414C208.189 100.026 208.189 83.4311 217.158 78.3532L228.362 71.9146Z",fill:"black",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M228.361 71.9146C219.392 76.9925 219.392 93.5869 228.361 108.975C237.331 124.363 251.872 132.721 260.841 127.643C269.811 122.565 269.811 105.97 260.841 90.5822C251.872 75.194 237.331 66.8367 228.361 71.9146ZM234.856 83.0619C239.099 80.6582 245.416 83.268 250.539 89.0026L232.165 99.4117C229.72 92.1618 230.612 85.4657 234.856 83.0619ZM254.343 116.5C250.1 118.904 243.782 116.294 238.659 110.559L257.034 100.15C259.479 107.4 258.586 114.096 254.343 116.5Z",fill:"#FAFD7E",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M234.856 83.0618C239.099 80.658 245.417 83.2678 250.54 89.0024L232.165 99.4115C229.72 92.1617 230.613 85.4655 234.856 83.0618Z",fill:"#FAFD7E",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M254.347 116.5C250.104 118.903 243.787 116.294 238.664 110.559L257.038 100.15C259.483 107.4 258.591 114.096 254.347 116.5Z",fill:"#FAFD7E",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M232.165 99.4115C230.94 95.7844 230.552 92.299 231.001 89.4188C231.449 86.5386 232.734 84.2636 234.856 83.0618C236.977 81.8599 239.617 81.9114 242.368 82.9802L232.165 99.4115Z",fill:"black",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M246.835 116.581C244.084 115.513 241.225 113.426 238.664 110.559L247.853 105.357L257.042 100.154L246.84 116.586L246.835 116.581Z",fill:"black",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Cq("defs",{children:Cq("clipPath",{id:"clip0_1548_70742",children:Cq("rect",{width:"58",height:"66",fill:"white",transform:"translate(210 70)"})})})]})})})}function Pet(){const{t:e}=_ke(),{showCreditCardWarning:t,setShowCreditCardWarning:n,setPaymentMethod:r}=z4e();return Cq(wne,{size:"threeQuarter",visible:t,showHeaderBar:!1,children:Iq(wne.Content,{children:[Cq(d4,{icon:"Close",variant:"tertiary",sx:{pos:"absolute",top:"base.spacing.x5",left:"base.spacing.x5",backdropFilter:"blur(30px)"},onClick:()=>n(!1)}),Cq(_et,{}),Iq(N3,{sx:{px:"base.spacing.x12"},children:[Cq(qee,{sx:{marginTop:"base.spacing.x6",marginBottom:"base.spacing.x2",textAlign:"center"},children:e("views.PAYMENT_METHODS.creditCardWarningDrawer.heading")}),Cq(tee,{size:"medium",sx:{display:"block",textAlign:"center",color:"base.color.text.body.secondary",marginBottom:"base.spacing.x13"},children:e("views.PAYMENT_METHODS.creditCardWarningDrawer.body")}),Cq(O3,{sx:{width:"100%"},testId:"credit-card-button",variant:"primary",size:"large",onClick:()=>{r(jH.CREDIT)},children:e("views.PAYMENT_METHODS.creditCardWarningDrawer.ctaButton")})]})]})})}!function(e){e.LOADING="LOADING",e.EXECUTE_SWAP="EXECUTE_SWAP",e.EXECUTE_BRIDGE="EXECUTE_BRIDGE",e.EXECUTE_ON_RAMP="EXECUTE_ON_RAMP",e.SWITCH_NETWORK_ETH="SWITCH_NETWORK_ETH",e.SWITCH_NETWORK_ZKEVM="SWITCH_NETWORK_ZKEVM"}(Aet||(Aet={}));var ket=Object.freeze({__proto__:null,default:function(e){const{t:t}=_ke(),{config:n,items:r,environmentId:i,collectionName:a,excludePaymentTypes:o,excludeFiatCurrencies:s,preferredCurrency:c,hideExcludedPaymentTypes:u,waitFulfillmentSettlements:l=!0}=e,{connectLoaderState:d}=uV.useContext(jRe),{checkout:f,provider:p}=d,h=uV.useRef(),{eventTargetState:{eventTarget:m}}=uV.useContext(zqe),{theme:y}=n,b=uV.useMemo((()=>yAe(y)),[y]),[g,v]=uV.useReducer(ARe,wRe),w=uV.useMemo((()=>({viewState:g,viewDispatch:v})),[g,v]),T=g.view.data?.loadingText||t("views.LOADING_VIEW.text");uV.useEffect((()=>{f&&p&&(async()=>{const e=await f.getNetworkInfo({provider:p});h.current=e.chainId})()}),[f,p]);const E=uV.useRef(!1),A=uV.useCallback((()=>{f&&p&&(E.current||(E.current=!0,v({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.PAYMENT_METHODS}}})))}),[f,p]);return uV.useEffect((()=>{f&&p&&A()}),[f,p]),Cq(ERe.Provider,{value:w,children:Cq(U4e,{value:{config:n,items:r,environment:n.environment,environmentId:i,provider:p,checkout:f,passport:f?.passport,collectionName:a,excludePaymentTypes:o,excludeFiatCurrencies:s,preferredCurrency:c,waitFulfillmentSettlements:l,hideExcludedPaymentTypes:u},children:Iq(d8e,{environment:n.environment,children:[g.view.type===vRe.LOADING_VIEW&&Cq(PPe,{loadingText:T}),g.view.type===w4e.PAYMENT_METHODS&&Cq(u9e,{}),g.view.type===w4e.PAY_WITH_CARD&&Cq(J4e,{}),g.view.type===w4e.PAY_WITH_COINS&&Cq(a9e,{}),g.view.type===w4e.SALE_FAIL&&Cq(l9e,{biomeTheme:b,errorType:g.view.data?.errorType,transactionHash:g.view.data?.transactionHash,blockExplorerLink:OW.getTransactionLink(h.current,g.view.data?.transactionHash)}),g.view.type===w4e.ORDER_SUMMARY&&Cq(Iet,{subView:g.view.subView}),g.view.type===vRe.TOP_UP_VIEW&&Cq(A8e,{analytics:{userJourney:bPe.SALE},widgetEvent:kH.IMTBL_SALE_WIDGET_EVENT,checkout:f,provider:p,showOnrampOption:n.isOnRampEnabled,showSwapOption:n.isSwapEnabled,showBridgeOption:n.isBridgeEnabled,onCloseButtonClick:()=>mKe(m),onBackButtonClick:()=>{v({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.PAYMENT_METHODS}}})},amount:g.view.data?.amount,tokenAddress:g.view.data?.tokenAddress,heading:g.view.data?.heading,subheading:g.view.data?.subheading}),Cq(Pet,{})]})})})}}),Ret={exports:{}};!function(e,t){window,e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){n.r(t);var r="function"==typeof fetch?fetch.bind():function(e,t){return t=t||{},new Promise((function(n,r){var i=new XMLHttpRequest;for(var a in i.open(t.method||"get",e,!0),t.headers)i.setRequestHeader(a,t.headers[a]);function o(){var e,t=[],n=[],r={};return i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(i,a,o){t.push(a=a.toLowerCase()),n.push([a,o]),e=r[a],r[a]=e?e+","+o:o})),{ok:2==(i.status/100|0),status:i.status,statusText:i.statusText,url:i.responseURL,clone:o,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},headers:{keys:function(){return t},entries:function(){return n},get:function(e){return r[e.toLowerCase()]},has:function(e){return e.toLowerCase()in r}}}}i.withCredentials="include"==t.credentials,i.onload=function(){n(o())},i.onerror=r,i.send(t.body)}))};t.default=r},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.pluginName=t}return r(e,[{key:"track",value:function(e,t){window.analytics.track(e,t,{integration:{name:this.pluginName}})}}]),e}();t.default=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.YouTubeAnalytics=t.VimeoAnalytics=void 0;var r=a(n(3)),i=a(n(4));function a(e){return e&&e.__esModule?e:{default:e}}t.VimeoAnalytics=r.default,t.YouTubeAnalytics=i.default},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=a(n(0));function a(e){return e&&e.__esModule?e:{default:e}}var o=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"VimeoAnalytics"));return r.authToken=n,r.player=e,r.metadata={content:{},playback:{videoPlayer:"Vimeo"}},r.mostRecentHeartbeat=0,r.isPaused=!1,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),r(t,[{key:"initialize",value:function(){var e=this,t={loaded:this.retrieveMetadata,play:this.trackPlay,pause:this.trackPause,ended:this.trackEnded,timeupdate:this.trackHeartbeat};for(var n in t)this.registerHandler(n,t[n]);this.player.getVideoId().then((function(t){e.retrieveMetadata({id:t})})).catch(console.error)}},{key:"registerHandler",value:function(e,t){var n=this;this.player.on(e,(function(e){n.updateMetadata(e),t.call(n,e)}))}},{key:"trackPlay",value:function(){this.isPaused?(this.track("Video Playback Resumed",this.metadata.playback),this.isPaused=!1):(this.track("Video Playback Started",this.metadata.playback),this.track("Video Content Started",this.metadata.content))}},{key:"trackEnded",value:function(){this.track("Video Playback Completed",this.metadata.playback),this.track("Video Content Completed",this.metadata.content)}},{key:"trackHeartbeat",value:function(){var e=this.mostRecentHeartbeat,t=this.metadata.playback.position;t!==e&&t-e>=10&&(this.track("Video Content Playing",this.metadata.content),this.mostRecentHeartbeat=Math.floor(t))}},{key:"trackPause",value:function(){this.isPaused=!0,this.track("Video Playback Paused",this.metadata.playback)}},{key:"retrieveMetadata",value:function(e){var t=this;return new Promise((function(n,r){var a=e.id;(0,i.default)("https://api.vimeo.com/videos/"+a,{headers:{Authorization:"Bearer "+t.authToken}}).then((function(e){return e.ok?e.json():r(e)})).then((function(e){t.metadata.content.title=e.name,t.metadata.content.description=e.description,t.metadata.content.publisher=e.user.name,t.metadata.playback.position=0,t.metadata.playback.totalLength=e.duration})).catch((function(e){return console.error("Request to Vimeo API Failed with: ",e),r(e)}))}))}},{key:"updateMetadata",value:function(e){var t=this;return new Promise((function(n,r){t.player.getVolume().then((function(r){r&&(t.metadata.playback.sound=100*r),t.metadata.playback.position=e.seconds,n()})).catch(r)}))}}]),t}(a(n(1)).default);t.default=o},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=a(n(0));function a(e){return e&&e.__esModule?e:{default:e}}var o=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"YoutubeAnalytics"));return r.player=e,r.apiKey=n,r.playerLoaded=!1,r.playbackStarted=!1,r.contentStarted=!1,r.isPaused=!1,r.isBuffering=!1,r.isSeeking=!1,r.lastRecordedTime={timeReported:Date.now(),timeElapsed:0},r.metadata=[{playback:{video_player:"youtube"},content:{}}],r.playlistIndex=0,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),r(t,[{key:"initialize",value:function(){window.segmentYoutubeOnStateChange=this.onPlayerStateChange.bind(this),window.segmentYoutubeOnReady=this.onPlayerReady.bind(this),this.player.addEventListener("onReady","segmentYoutubeOnReady"),this.player.addEventListener("onStateChange","segmentYoutubeOnStateChange")}},{key:"onPlayerReady",value:function(e){this.retrieveMetadata()}},{key:"onPlayerStateChange",value:function(e){var t=this.player.getCurrentTime();switch(this.metadata[this.playlistIndex]&&(this.metadata[this.playlistIndex].playback.position=this.metadata[this.playlistIndex].content.position=t,this.metadata[this.playlistIndex].playback.quality=this.player.getPlaybackQuality(),this.metadata[this.playlistIndex].playback.sound=this.player.isMuted()?0:this.player.getVolume()),e.data){case-1:if(this.playerLoaded)break;this.retrieveMetadata(),this.playerLoaded=!0;break;case YT.PlayerState.BUFFERING:this.handleBuffer();break;case YT.PlayerState.PLAYING:this.handlePlay();break;case YT.PlayerState.PAUSED:this.handlePause();break;case YT.PlayerState.ENDED:this.handleEnd()}this.lastRecordedTime={timeReported:Date.now(),timeElapsed:1e3*this.player.getCurrentTime()}}},{key:"retrieveMetadata",value:function(){var e=this;return new Promise((function(t,n){var r=e.player.getVideoData(),a=e.player.getPlaylist()||[r.video_id],o=a.join();(0,i.default)("https://www.googleapis.com/youtube/v3/videos?id="+o+"&part=snippet,contentDetails&key="+e.apiKey).then((function(e){if(!e.ok){var t=new Error("Segment request to Youtube API failed (likely due to a bad API Key. Events will still be sent but will not contain video metadata)");throw t.response=e,t}return e.json()})).then((function(n){e.metadata=[];for(var r=0,i=0;i<a.length;i++){var o=n.items[i];e.metadata.push({content:{title:o.snippet.title,description:o.snippet.description,keywords:o.snippet.tags,channel:o.snippet.channelTitle,airdate:o.snippet.publishedAt}}),r+=s(o.contentDetails.duration)}for(i=0;i<a.length;i++)e.metadata[i].playback={total_length:r,video_player:"youtube"};t()})).catch((function(t){e.metadata=a.map((function(e){return{playback:{video_player:"youtube"},content:{}}})),n(t)}))}))}},{key:"handleBuffer",value:function(){var e=this.determineSeek();this.playbackStarted||(this.playbackStarted=!0,this.track("Video Playback Started",this.metadata[this.playlistIndex].playback)),e&&!this.isSeeking&&(this.isSeeking=!0,this.track("Video Playback Seek Started",this.metadata[this.playlistIndex].playback)),this.isSeeking&&(this.track("Video Playback Seek Completed",this.metadata[this.playlistIndex].playback),this.isSeeking=!1);var t=this.player.getPlaylist();t&&0===this.player.getCurrentTime()&&this.player.getPlaylistIndex()!==this.playlistIndex&&(this.contentStarted=!1,this.playlistIndex===t.length-1&&0===this.player.getPlaylistIndex()&&(this.track("Video Playback Completed",this.metadata[this.player.getPlaylistIndex()].playback),this.track("Video Playback Started",this.metadata[this.player.getPlaylistIndex()].playback))),this.track("Video Playback Buffer Started",this.metadata[this.playlistIndex].playback),this.isBuffering=!0}},{key:"handlePlay",value:function(){this.contentStarted||(this.playlistIndex=this.player.getPlaylistIndex(),-1===this.playlistIndex&&(this.playlistIndex=0),this.track("Video Content Started",this.metadata[this.playlistIndex].content),this.contentStarted=!0),this.isBuffering&&(this.track("Video Playback Buffer Completed",this.metadata[this.playlistIndex].playback),this.isBuffering=!1),this.isPaused&&(this.track("Video Playback Resumed",this.metadata[this.playlistIndex].playback),this.isPaused=!1)}},{key:"handlePause",value:function(){var e=this.determineSeek();this.isBuffering&&(this.track("Video Playback Buffer Completed",this.metadata[this.playlistIndex].playback),this.isBuffering=!1),this.isPaused||(e?(this.track("Video Playback Seek Started",this.metadata[this.playlistIndex].playback),this.isSeeking=!0):(this.track("Video Playback Paused",this.metadata[this.playlistIndex].playback),this.isPaused=!0))}},{key:"handleEnd",value:function(){this.track("Video Content Completed",this.metadata[this.playlistIndex].content),this.contentStarted=!1;var e=this.player.getPlaylistIndex(),t=this.player.getPlaylist();(t&&e===t.length-1||-1===e)&&(this.track("Video Playback Completed",this.metadata[this.playlistIndex].playback),this.playbackStarted=!1)}},{key:"determineSeek",value:function(){var e=this.isPaused||this.isBuffering?0:Date.now()-this.lastRecordedTime.timeReported,t=1e3*this.player.getCurrentTime()-this.lastRecordedTime.timeElapsed;return Math.abs(e-t)>2e3}}]),t}(a(n(1)).default);function s(e){var t=e.match(/PT(\d+H)?(\d+M)?(\d+S)?/);return t=t.slice(1).map((function(e){if(null!=e)return e.replace(/\D/,"")})),3600*(parseInt(t[0])||0)+60*(parseInt(t[1])||0)+(parseInt(t[2])||0)}t.default=o}])}(Ret);var Net=Ret.exports,Met=t({__proto__:null,default:lt(Net)},[Net]);e.WidgetsFactory=class{sdk;widgetConfig;constructor(e,t){if(this.sdk=e,this.widgetConfig=t,this.widgetConfig.theme||(this.widgetConfig.theme=Wke),t.walletConnect)try{iqe.getInstance().initialise(e.config.environment,t.walletConnect,this.widgetConfig.theme,e.config.remote.getConfig("connect"))}catch(e){console.warn("WalletConnect has not been set up correctly")}}updateProvider(e){aRe(e),oRe({provider:e})}create(e,t){const{provider:n}=t??{},r=t?.config||{};switch(e){case zH.CONNECT:return new uRe(this.sdk,{config:{...this.widgetConfig,...r},provider:n});case zH.BRIDGE:return new vKe(this.sdk,{config:{...this.widgetConfig,...r},provider:n});case zH.WALLET:return new hKe(this.sdk,{config:{...this.widgetConfig,...r},provider:n});case zH.SWAP:return new oKe(this.sdk,{config:{...this.widgetConfig,...r},provider:n});case zH.ONRAMP:return new dKe(this.sdk,{config:{...this.widgetConfig,...r},provider:n});case zH.SALE:return new bKe(this.sdk,{config:{...this.widgetConfig,...r},provider:n});default:throw new Error("widget type not supported")}}}}));
|
|
931
|
+
*/const d$e=e=>null!=e?e:IJe;var f$e={},p$e={},h$e={};let m$e;const y$e=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];h$e.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},h$e.getSymbolTotalCodewords=function(e){return y$e[e]},h$e.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},h$e.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');m$e=e},h$e.isKanjiModeEnabled=function(){return void 0!==m$e},h$e.toSJIS=function(e){return m$e(e)};var b$e={};function g$e(){this.buffer=[],this.length=0}!function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2},e.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},e.from=function(t,n){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+t)}}(t)}catch(e){return n}}}(b$e),g$e.prototype={get:function(e){const t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(let n=0;n<t;n++)this.putBit(1==(e>>>t-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var v$e=g$e;function w$e(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}w$e.prototype.set=function(e,t,n,r){const i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},w$e.prototype.get=function(e,t){return this.data[e*this.size+t]},w$e.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},w$e.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var T$e=w$e,E$e={};!function(e){const t=h$e.getSymbolSize;e.getRowColCoords=function(e){if(1===e)return[];const n=Math.floor(e/7)+2,r=t(e),i=145===r?26:2*Math.ceil((r-13)/(2*n-2)),a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){const n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)0===e&&0===t||0===e&&t===i-1||e===i-1&&0===t||n.push([r[e],r[t]]);return n}}(E$e);var A$e={};const x$e=h$e.getSymbolSize;A$e.getPositions=function(e){const t=x$e(e);return[[0,0],[t-7,0],[0,t-7]]};var O$e={};!function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t=3,n=3,r=40,i=10;function a(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}}e.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){const n=e.size;let r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let u=0;u<n;u++){let n=e.get(c,u);n===o?i++:(i>=5&&(r+=t+(i-5)),o=n,i=1),n=e.get(u,c),n===s?a++:(a>=5&&(r+=t+(a-5)),s=n,a=1)}i>=5&&(r+=t+(i-5)),a>=5&&(r+=t+(a-5))}return r},e.getPenaltyN2=function(e){const t=e.size;let r=0;for(let n=0;n<t-1;n++)for(let i=0;i<t-1;i++){const t=e.get(n,i)+e.get(n,i+1)+e.get(n+1,i)+e.get(n+1,i+1);4!==t&&0!==t||r++}return r*n},e.getPenaltyN3=function(e){const t=e.size;let n=0,i=0,a=0;for(let r=0;r<t;r++){i=a=0;for(let o=0;o<t;o++)i=i<<1&2047|e.get(r,o),o>=10&&(1488===i||93===i)&&n++,a=a<<1&2047|e.get(o,r),o>=10&&(1488===a||93===a)&&n++}return n*r},e.getPenaltyN4=function(e){let t=0;const n=e.data.length;for(let r=0;r<n;r++)t+=e.data[r];return Math.abs(Math.ceil(100*t/n/5)-10)*i},e.applyMask=function(e,t){const n=t.size;for(let r=0;r<n;r++)for(let i=0;i<n;i++)t.isReserved(i,r)||t.xor(i,r,a(e,i,r))},e.getBestMask=function(t,n){const r=Object.keys(e.Patterns).length;let i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);const r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}}(O$e);var C$e={};const I$e=b$e,_$e=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],P$e=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];C$e.getBlocksCount=function(e,t){switch(t){case I$e.L:return _$e[4*(e-1)+0];case I$e.M:return _$e[4*(e-1)+1];case I$e.Q:return _$e[4*(e-1)+2];case I$e.H:return _$e[4*(e-1)+3];default:return}},C$e.getTotalCodewordsCount=function(e,t){switch(t){case I$e.L:return P$e[4*(e-1)+0];case I$e.M:return P$e[4*(e-1)+1];case I$e.Q:return P$e[4*(e-1)+2];case I$e.H:return P$e[4*(e-1)+3];default:return}};var S$e={},k$e={};const R$e=new Uint8Array(512),N$e=new Uint8Array(256);!function(){let e=1;for(let t=0;t<255;t++)R$e[t]=e,N$e[e]=t,e<<=1,256&e&&(e^=285);for(let e=255;e<512;e++)R$e[e]=R$e[e-255]}(),k$e.log=function(e){if(e<1)throw new Error("log("+e+")");return N$e[e]},k$e.exp=function(e){return R$e[e]},k$e.mul=function(e,t){return 0===e||0===t?0:R$e[N$e[e]+N$e[t]]},function(e){const t=k$e;e.mul=function(e,n){const r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){const e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&0===r[i];)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}}(S$e);const M$e=S$e;function D$e(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}D$e.prototype.initialize=function(e){this.degree=e,this.genPoly=M$e.generateECPolynomial(this.degree)},D$e.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const n=M$e.mod(t,this.genPoly),r=this.degree-n.length;if(r>0){const e=new Uint8Array(this.degree);return e.set(n,r),e}return n};var L$e=D$e,j$e={},F$e={},B$e={isValid:function(e){return!isNaN(e)&&e>=1&&e<=40}},U$e={};const z$e="[0-9]+";let H$e="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";H$e=H$e.replace(/u/g,"\\u");const W$e="(?:(?![A-Z0-9 $%*+\\-./:]|"+H$e+")(?:.|[\r\n]))+";U$e.KANJI=new RegExp(H$e,"g"),U$e.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),U$e.BYTE=new RegExp(W$e,"g"),U$e.NUMERIC=new RegExp(z$e,"g"),U$e.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const V$e=new RegExp("^"+H$e+"$"),G$e=new RegExp("^"+z$e+"$"),q$e=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");U$e.testKanji=function(e){return V$e.test(e)},U$e.testNumeric=function(e){return G$e.test(e)},U$e.testAlphanumeric=function(e){return q$e.test(e)},function(e){const t=B$e,n=U$e;e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!t.isValid(n))throw new Error("Invalid version: "+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},e.isValid=function(e){return e&&e.bit&&e.ccBits},e.from=function(t,n){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(e){return n}}}(F$e),function(e){const t=h$e,n=C$e,r=b$e,i=F$e,a=B$e,o=t.getBCHDigit(7973);function s(e,t){return i.getCharCountIndicator(e,t)+4}function c(e,t){let n=0;return e.forEach((function(e){const r=s(e.mode,t);n+=r+e.getBitsLength()})),n}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw new Error("Invalid QR Code version");void 0===o&&(o=i.BYTE);const c=8*(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r));if(o===i.MIXED)return c;const u=c-s(o,e);switch(o){case i.NUMERIC:return Math.floor(u/10*3);case i.ALPHANUMERIC:return Math.floor(u/11*2);case i.KANJI:return Math.floor(u/13);case i.BYTE:default:return Math.floor(u/8)}},e.getBestVersionForData=function(t,n){let a;const o=r.from(n,r.M);if(Array.isArray(t)){if(t.length>1)return function(t,n){for(let r=1;r<=40;r++)if(c(t,r)<=e.getCapacity(r,n,i.MIXED))return r}(t,o);if(0===t.length)return 1;a=t[0]}else a=t;return function(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}(a.mode,a.getLength(),o)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw new Error("Invalid QR Code version");let n=e<<12;for(;t.getBCHDigit(n)-o>=0;)n^=7973<<t.getBCHDigit(n)-o;return e<<12|n}}(j$e);var K$e={};const X$e=h$e,Y$e=X$e.getBCHDigit(1335);K$e.getEncodedBits=function(e,t){const n=e.bit<<3|t;let r=n<<10;for(;X$e.getBCHDigit(r)-Y$e>=0;)r^=1335<<X$e.getBCHDigit(r)-Y$e;return 21522^(n<<10|r)};var Z$e={};const J$e=F$e;function Q$e(e){this.mode=J$e.NUMERIC,this.data=e.toString()}Q$e.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},Q$e.prototype.getLength=function(){return this.data.length},Q$e.prototype.getBitsLength=function(){return Q$e.getBitsLength(this.data.length)},Q$e.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);const i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,3*i+1))};var $$e=Q$e;const e0e=F$e,t0e=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function n0e(e){this.mode=e0e.ALPHANUMERIC,this.data=e}n0e.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},n0e.prototype.getLength=function(){return this.data.length},n0e.prototype.getBitsLength=function(){return n0e.getBitsLength(this.data.length)},n0e.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=45*t0e.indexOf(this.data[t]);n+=t0e.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(t0e.indexOf(this.data[t]),6)};var r0e=n0e;const i0e=function(e){for(var t=[],n=e.length,r=0;r<n;r++){var i=e.charCodeAt(r);if(i>=55296&&i<=56319&&n>r+1){var a=e.charCodeAt(r+1);a>=56320&&a<=57343&&(i=1024*(i-55296)+a-56320+65536,r+=1)}i<128?t.push(i):i<2048?(t.push(i>>6|192),t.push(63&i|128)):i<55296||i>=57344&&i<65536?(t.push(i>>12|224),t.push(i>>6&63|128),t.push(63&i|128)):i>=65536&&i<=1114111?(t.push(i>>18|240),t.push(i>>12&63|128),t.push(i>>6&63|128),t.push(63&i|128)):t.push(239,191,189)}return new Uint8Array(t).buffer},a0e=F$e;function o0e(e){this.mode=a0e.BYTE,"string"==typeof e&&(e=i0e(e)),this.data=new Uint8Array(e)}o0e.getBitsLength=function(e){return 8*e},o0e.prototype.getLength=function(){return this.data.length},o0e.prototype.getBitsLength=function(){return o0e.getBitsLength(this.data.length)},o0e.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)};var s0e=o0e;const c0e=F$e,u0e=h$e;function l0e(e){this.mode=c0e.KANJI,this.data=e}l0e.getBitsLength=function(e){return 13*e},l0e.prototype.getLength=function(){return this.data.length},l0e.prototype.getBitsLength=function(){return l0e.getBitsLength(this.data.length)},l0e.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=u0e.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");n-=49472}n=192*(n>>>8&255)+(255&n),e.put(n,13)}};var d0e=l0e,f0e={exports:{}};!function(e){var t={single_source_shortest_paths:function(e,n,r){var i={},a={};a[n]=0;var o,s,c,u,l,d,f,p=t.PriorityQueue.make();for(p.push(n,0);!p.empty();)for(c in s=(o=p.pop()).value,u=o.cost,l=e[s]||{})l.hasOwnProperty(c)&&(d=u+l[c],f=a[c],(void 0===a[c]||f>d)&&(a[c]=d,p.push(c,d),i[c]=s));if(void 0!==r&&void 0===a[r]){var h=["Could not find a path from ",n," to ",r,"."].join("");throw new Error(h)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,n,r){var i=t.single_source_shortest_paths(e,n,r);return t.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var n,r=t.PriorityQueue,i={};for(n in e=e||{},r)r.hasOwnProperty(n)&&(i[n]=r[n]);return i.queue=[],i.sorter=e.sorter||r.default_sorter,i},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t}(f0e);var p0e=f0e.exports;!function(e){const t=F$e,n=$$e,r=r0e,i=s0e,a=d0e,o=U$e,s=h$e,c=p0e;function u(e){return unescape(encodeURIComponent(e)).length}function l(e,t,n){const r=[];let i;for(;null!==(i=e.exec(n));)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){const n=l(o.NUMERIC,t.NUMERIC,e),r=l(o.ALPHANUMERIC,t.ALPHANUMERIC,e);let i,a;s.isKanjiModeEnabled()?(i=l(o.BYTE,t.BYTE,e),a=l(o.KANJI,t.KANJI,e)):(i=l(o.BYTE_KANJI,t.BYTE,e),a=[]);return n.concat(r,i,a).sort((function(e,t){return e.index-t.index})).map((function(e){return{data:e.data,mode:e.mode,length:e.length}}))}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e,o){let c;const u=t.getBestModeForData(e);if(c=t.from(o,u),c!==t.BYTE&&c.bit<u.bit)throw new Error('"'+e+'" cannot be encoded with mode '+t.toString(c)+".\n Suggested mode is: "+t.toString(u));switch(c!==t.KANJI||s.isKanjiModeEnabled()||(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce((function(e,t){return"string"==typeof t?e.push(p(t,null)):t.data&&e.push(p(t.data,t.mode)),e}),[])},e.fromString=function(n,r){const i=function(e){const n=[];for(let r=0;r<e.length;r++){const i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:u(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:u(i.data)}])}}return n}(d(n,s.isKanjiModeEnabled())),a=function(e,n){const r={},i={start:{}};let a=["start"];for(let o=0;o<e.length;o++){const s=e[o],c=[];for(let e=0;e<s.length;e++){const u=s[e],l=""+o+e;c.push(l),r[l]={node:u,lastCount:0},i[l]={};for(let e=0;e<a.length;e++){const o=a[e];r[o]&&r[o].node.mode===u.mode?(i[o][l]=f(r[o].lastCount+u.length,u.mode)-f(r[o].lastCount,u.mode),r[o].lastCount+=u.length):(r[o]&&(r[o].lastCount=u.length),i[o][l]=f(u.length,u.mode)+4+t.getCharCountIndicator(u.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}(i,r),o=c.find_path(a.map,"start","end"),l=[];for(let e=1;e<o.length-1;e++)l.push(a.table[o[e]].node);return e.fromArray(function(e){return e.reduce((function(e,t){const n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)}),[])}(l))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}}(Z$e);const h0e=h$e,m0e=b$e,y0e=v$e,b0e=T$e,g0e=E$e,v0e=A$e,w0e=O$e,T0e=C$e,E0e=L$e,A0e=j$e,x0e=K$e,O0e=F$e,C0e=Z$e;function I0e(e,t,n){const r=e.size,i=x0e.getEncodedBits(t,n);let a,o;for(a=0;a<15;a++)o=1==(i>>a&1),a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function _0e(e,t,n){const r=new y0e;n.forEach((function(t){r.put(t.mode.bit,4),r.put(t.getLength(),O0e.getCharCountIndicator(t.mode,e)),t.write(r)}));const i=8*(h0e.getSymbolTotalCodewords(e)-T0e.getTotalCodewordsCount(e,t));for(r.getLengthInBits()+4<=i&&r.put(0,4);r.getLengthInBits()%8!=0;)r.putBit(0);const a=(i-r.getLengthInBits())/8;for(let e=0;e<a;e++)r.put(e%2?17:236,8);return function(e,t,n){const r=h0e.getSymbolTotalCodewords(t),i=T0e.getTotalCodewordsCount(t,n),a=r-i,o=T0e.getBlocksCount(t,n),s=r%o,c=o-s,u=Math.floor(r/o),l=Math.floor(a/o),d=l+1,f=u-l,p=new E0e(f);let h=0;const m=new Array(o),y=new Array(o);let b=0;const g=new Uint8Array(e.buffer);for(let e=0;e<o;e++){const t=e<c?l:d;m[e]=g.slice(h,h+t),y[e]=p.encode(m[e]),h+=t,b=Math.max(b,t)}const v=new Uint8Array(r);let w,T,E=0;for(w=0;w<b;w++)for(T=0;T<o;T++)w<m[T].length&&(v[E++]=m[T][w]);for(w=0;w<f;w++)for(T=0;T<o;T++)v[E++]=y[T][w];return v}(r,e,t)}function P0e(e,t,n,r){let i;if(Array.isArray(e))i=C0e.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");{let r=t;if(!r){const t=C0e.rawSplit(e);r=A0e.getBestVersionForData(t,n)}i=C0e.fromString(e,r||40)}}const a=A0e.getBestVersionForData(i,n);if(!a)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<a)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+a+".\n")}else t=a;const o=_0e(t,n,i),s=h0e.getSymbolSize(t),c=new b0e(s);return function(e,t){const n=e.size,r=v0e.getPositions(t);for(let t=0;t<r.length;t++){const i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===t||6===t)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}(c,t),function(e){const t=e.size;for(let n=8;n<t-8;n++){const t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}(c),function(e,t){const n=g0e.getPositions(t);for(let t=0;t<n.length;t++){const r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)-2===t||2===t||-2===n||2===n||0===t&&0===n?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}(c,t),I0e(c,n,0),t>=7&&function(e,t){const n=e.size,r=A0e.getEncodedBits(t);let i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=1==(r>>t&1),e.set(i,a,o,!0),e.set(a,i,o,!0)}(c,t),function(e,t){const n=e.size;let r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(6===s&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=1==(t[o]>>>a&1)),e.set(i,s-n,r),a--,-1===a&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}(c,o),isNaN(r)&&(r=w0e.getBestMask(c,I0e.bind(null,c,n))),w0e.applyMask(r,c),I0e(c,n,r),{modules:c,version:t,errorCorrectionLevel:n,maskPattern:r,segments:i}}p$e.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");let n,r,i=m0e.M;return void 0!==t&&(i=m0e.from(t.errorCorrectionLevel,m0e.M),n=A0e.from(t.version),r=w0e.from(t.maskPattern),t.toSJISFunc&&h0e.setToSJISFunction(t.toSJISFunc)),P0e(e,n,i,r)};var S0e={},k0e={};!function(e){function t(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map((function(e){return[e,e]})))),6===t.length&&t.push("F","F");const n=parseInt(t.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:"#"+t.slice(0,6).join("")}}e.getOptions=function(e){e||(e={}),e.color||(e.color={});const n=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||"#000000ff"),light:t(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},e.getImageWidth=function(t,n){const r=e.getScale(t,n);return Math.floor((t+2*n.margin)*r)},e.qrToImageData=function(t,n,r){const i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+2*r.margin)*o),c=r.margin*o,u=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let l=4*(e*s+n),d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){d=u[a[Math.floor((e-c)/o)*i+Math.floor((n-c)/o)]?1:0]}t[l++]=d.r,t[l++]=d.g,t[l++]=d.b,t[l]=d.a}}}(k0e),function(e){const t=k0e;e.render=function(e,n,r){let i=r,a=n;void 0!==i||n&&n.getContext||(i=n,n=void 0),n||(a=function(){try{return document.createElement("canvas")}catch(e){throw new Error("You need to specify a canvas element")}}()),i=t.getOptions(i);const o=t.getImageWidth(e.modules.size,i),s=a.getContext("2d"),c=s.createImageData(o,o);return t.qrToImageData(c.data,e,i),function(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=n,t.width=n,t.style.height=n+"px",t.style.width=n+"px"}(s,a,o),s.putImageData(c,0,0),a},e.renderToDataURL=function(t,n,r){let i=r;void 0!==i||n&&n.getContext||(i=n,n=void 0),i||(i={});const a=e.render(t,n,i),o=i.type||"image/png",s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}}(S0e);var R0e={};const N0e=k0e;function M0e(e,t){const n=e.a/255,r=t+'="'+e.hex+'"';return n<1?r+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function D0e(e,t,n){let r=e+t;return void 0!==n&&(r+=" "+n),r}R0e.render=function(e,t,n){const r=N0e.getOptions(t),i=e.modules.size,a=e.modules.data,o=i+2*r.margin,s=r.color.light.a?"<path "+M0e(r.color.light,"fill")+' d="M0 0h'+o+"v"+o+'H0z"/>':"",c="<path "+M0e(r.color.dark,"stroke")+' d="'+function(e,t,n){let r="",i=0,a=!1,o=0;for(let s=0;s<e.length;s++){const c=Math.floor(s%t),u=Math.floor(s/t);c||a||(a=!0),e[s]?(o++,s>0&&c>0&&e[s-1]||(r+=a?D0e("M",c+n,.5+u+n):D0e("m",i,0),i=0,a=!1),c+1<t&&e[s+1]||(r+=D0e("h",o),o=0)):i++}return r}(a,i,r.margin)+'"/>',u='viewBox="0 0 '+o+" "+o+'"',l='<svg xmlns="http://www.w3.org/2000/svg" '+(r.width?'width="'+r.width+'" height="'+r.width+'" ':"")+u+' shape-rendering="crispEdges">'+s+c+"</svg>\n";return"function"==typeof n&&n(null,l),l};const L0e=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},j0e=p$e,F0e=S0e,B0e=R0e;function U0e(e,t,n,r,i){const a=[].slice.call(arguments,1),o=a.length,s="function"==typeof a[o-1];if(!s&&!L0e())throw new Error("Callback required as last argument");if(!s){if(o<1)throw new Error("Too few arguments provided");return 1===o?(n=t,t=r=void 0):2!==o||t.getContext||(r=n,n=t,t=void 0),new Promise((function(i,a){try{const a=j0e.create(n,r);i(e(a,t,r))}catch(e){a(e)}}))}if(o<2)throw new Error("Too few arguments provided");2===o?(i=n,n=t,t=r=void 0):3===o&&(t.getContext&&void 0===i?(i=r,r=void 0):(i=r,r=n,n=t,t=void 0));try{const a=j0e.create(n,r);i(null,e(a,t,r))}catch(e){i(e)}}f$e.create=j0e.create,f$e.toCanvas=U0e.bind(null,F0e.render),f$e.toDataURL=U0e.bind(null,F0e.renderToDataURL),f$e.toString=U0e.bind(null,(function(e,t,n){return B0e.render(e,n)}));var z0e=Object.defineProperty,H0e=Object.getOwnPropertySymbols,W0e=Object.prototype.hasOwnProperty,V0e=Object.prototype.propertyIsEnumerable,G0e=(e,t,n)=>t in e?z0e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,q0e=(e,t)=>{for(var n in t||(t={}))W0e.call(t,n)&&G0e(e,n,t[n]);if(H0e)for(var n of H0e(t))V0e.call(t,n)&&G0e(e,n,t[n]);return e};const K0e={getPreset:e=>({"--wcm-accent-color":"#3396FF","--wcm-accent-fill-color":"#FFFFFF","--wcm-z-index":"89","--wcm-background-color":"#3396FF","--wcm-background-border-radius":"8px","--wcm-container-border-radius":"30px","--wcm-wallet-icon-border-radius":"15px","--wcm-wallet-icon-large-border-radius":"30px","--wcm-wallet-icon-small-border-radius":"7px","--wcm-input-border-radius":"28px","--wcm-button-border-radius":"10px","--wcm-notification-border-radius":"36px","--wcm-secondary-button-border-radius":"28px","--wcm-icon-button-border-radius":"50%","--wcm-button-hover-highlight-border-radius":"10px","--wcm-text-big-bold-size":"20px","--wcm-text-big-bold-weight":"600","--wcm-text-big-bold-line-height":"24px","--wcm-text-big-bold-letter-spacing":"-0.03em","--wcm-text-big-bold-text-transform":"none","--wcm-text-xsmall-bold-size":"10px","--wcm-text-xsmall-bold-weight":"700","--wcm-text-xsmall-bold-line-height":"12px","--wcm-text-xsmall-bold-letter-spacing":"0.02em","--wcm-text-xsmall-bold-text-transform":"uppercase","--wcm-text-xsmall-regular-size":"12px","--wcm-text-xsmall-regular-weight":"600","--wcm-text-xsmall-regular-line-height":"14px","--wcm-text-xsmall-regular-letter-spacing":"-0.03em","--wcm-text-xsmall-regular-text-transform":"none","--wcm-text-small-thin-size":"14px","--wcm-text-small-thin-weight":"500","--wcm-text-small-thin-line-height":"16px","--wcm-text-small-thin-letter-spacing":"-0.03em","--wcm-text-small-thin-text-transform":"none","--wcm-text-small-regular-size":"14px","--wcm-text-small-regular-weight":"600","--wcm-text-small-regular-line-height":"16px","--wcm-text-small-regular-letter-spacing":"-0.03em","--wcm-text-small-regular-text-transform":"none","--wcm-text-medium-regular-size":"16px","--wcm-text-medium-regular-weight":"600","--wcm-text-medium-regular-line-height":"20px","--wcm-text-medium-regular-letter-spacing":"-0.03em","--wcm-text-medium-regular-text-transform":"none","--wcm-font-family":"-apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', sans-serif","--wcm-font-feature-settings":"'tnum' on, 'lnum' on, 'case' on","--wcm-success-color":"rgb(38,181,98)","--wcm-error-color":"rgb(242, 90, 103)","--wcm-overlay-background-color":"rgba(0, 0, 0, 0.3)","--wcm-overlay-backdrop-filter":"none"}[e]),setTheme(){const e=document.querySelector(":root"),{themeVariables:t}=fMe.state;if(e){const n=q0e(q0e(q0e({},function(){var e;const t={light:{foreground:{1:"rgb(20,20,20)",2:"rgb(121,134,134)",3:"rgb(158,169,169)"},background:{1:"rgb(255,255,255)",2:"rgb(241,243,243)",3:"rgb(228,231,231)"},overlay:"rgba(0,0,0,0.1)"},dark:{foreground:{1:"rgb(228,231,231)",2:"rgb(148,158,158)",3:"rgb(110,119,119)"},background:{1:"rgb(20,20,20)",2:"rgb(39,42,42)",3:"rgb(59,64,64)"},overlay:"rgba(255,255,255,0.1)"}}[null!=(e=fMe.state.themeMode)?e:"dark"];return{"--wcm-color-fg-1":t.foreground[1],"--wcm-color-fg-2":t.foreground[2],"--wcm-color-fg-3":t.foreground[3],"--wcm-color-bg-1":t.background[1],"--wcm-color-bg-2":t.background[2],"--wcm-color-bg-3":t.background[3],"--wcm-color-overlay":t.overlay}}()),{"--wcm-accent-color":"#3396FF","--wcm-accent-fill-color":"#FFFFFF","--wcm-z-index":"89","--wcm-background-color":"#3396FF","--wcm-background-border-radius":"8px","--wcm-container-border-radius":"30px","--wcm-wallet-icon-border-radius":"15px","--wcm-wallet-icon-large-border-radius":"30px","--wcm-wallet-icon-small-border-radius":"7px","--wcm-input-border-radius":"28px","--wcm-button-border-radius":"10px","--wcm-notification-border-radius":"36px","--wcm-secondary-button-border-radius":"28px","--wcm-icon-button-border-radius":"50%","--wcm-button-hover-highlight-border-radius":"10px","--wcm-text-big-bold-size":"20px","--wcm-text-big-bold-weight":"600","--wcm-text-big-bold-line-height":"24px","--wcm-text-big-bold-letter-spacing":"-0.03em","--wcm-text-big-bold-text-transform":"none","--wcm-text-xsmall-bold-size":"10px","--wcm-text-xsmall-bold-weight":"700","--wcm-text-xsmall-bold-line-height":"12px","--wcm-text-xsmall-bold-letter-spacing":"0.02em","--wcm-text-xsmall-bold-text-transform":"uppercase","--wcm-text-xsmall-regular-size":"12px","--wcm-text-xsmall-regular-weight":"600","--wcm-text-xsmall-regular-line-height":"14px","--wcm-text-xsmall-regular-letter-spacing":"-0.03em","--wcm-text-xsmall-regular-text-transform":"none","--wcm-text-small-thin-size":"14px","--wcm-text-small-thin-weight":"500","--wcm-text-small-thin-line-height":"16px","--wcm-text-small-thin-letter-spacing":"-0.03em","--wcm-text-small-thin-text-transform":"none","--wcm-text-small-regular-size":"14px","--wcm-text-small-regular-weight":"600","--wcm-text-small-regular-line-height":"16px","--wcm-text-small-regular-letter-spacing":"-0.03em","--wcm-text-small-regular-text-transform":"none","--wcm-text-medium-regular-size":"16px","--wcm-text-medium-regular-weight":"600","--wcm-text-medium-regular-line-height":"20px","--wcm-text-medium-regular-letter-spacing":"-0.03em","--wcm-text-medium-regular-text-transform":"none","--wcm-font-family":"-apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', sans-serif","--wcm-font-feature-settings":"'tnum' on, 'lnum' on, 'case' on","--wcm-success-color":"rgb(38,181,98)","--wcm-error-color":"rgb(242, 90, 103)","--wcm-overlay-background-color":"rgba(0, 0, 0, 0.3)","--wcm-overlay-backdrop-filter":"none"}),t);Object.entries(n).forEach((([t,n])=>e.style.setProperty(t,n)))}},globalCss:GZe`*,::after,::before{margin:0;padding:0;box-sizing:border-box;font-style:normal;text-rendering:optimizeSpeed;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-tap-highlight-color:transparent;backface-visibility:hidden}button{cursor:pointer;display:flex;justify-content:center;align-items:center;position:relative;border:none;background-color:transparent;transition:all .2s ease}@media (hover:hover) and (pointer:fine){button:active{transition:all .1s ease;transform:scale(.93)}}button::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;transition:background-color,.2s ease}button:disabled{cursor:not-allowed}button svg,button wcm-text{position:relative;z-index:1}input{border:none;outline:0;appearance:none}img{display:block}::selection{color:var(--wcm-accent-fill-color);background:var(--wcm-accent-color)}`},X0e=GZe`button{border-radius:var(--wcm-secondary-button-border-radius);height:28px;padding:0 10px;background-color:var(--wcm-accent-color)}button path{fill:var(--wcm-accent-fill-color)}button::after{border-radius:inherit;border:1px solid var(--wcm-color-overlay)}button:disabled::after{background-color:transparent}.wcm-icon-left svg{margin-right:5px}.wcm-icon-right svg{margin-left:5px}button:active::after{background-color:var(--wcm-color-overlay)}.wcm-ghost,.wcm-ghost:active::after,.wcm-outline{background-color:transparent}.wcm-ghost:active{opacity:.5}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}.wcm-ghost:hover::after{background-color:transparent}.wcm-ghost:hover{opacity:.5}}button:disabled{background-color:var(--wcm-color-bg-3);pointer-events:none}.wcm-ghost::after{border-color:transparent}.wcm-ghost path{fill:var(--wcm-color-fg-2)}.wcm-outline path{fill:var(--wcm-accent-color)}.wcm-outline:disabled{background-color:transparent;opacity:.5}`;var Y0e=Object.defineProperty,Z0e=Object.getOwnPropertyDescriptor,J0e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?Z0e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&Y0e(t,n,a),a};let Q0e=class extends GJe{constructor(){super(...arguments),this.disabled=!1,this.iconLeft=void 0,this.iconRight=void 0,this.onClick=()=>null,this.variant="default"}render(){const e={"wcm-icon-left":void 0!==this.iconLeft,"wcm-icon-right":void 0!==this.iconRight,"wcm-ghost":"ghost"===this.variant,"wcm-outline":"outline"===this.variant};let t="inverse";return"ghost"===this.variant&&(t="secondary"),"outline"===this.variant&&(t="accent"),xJe`<button class="${tQe(e)}" ?disabled="${this.disabled}" @click="${this.onClick}">${this.iconLeft}<wcm-text variant="small-regular" color="${t}"><slot></slot></wcm-text>${this.iconRight}</button>`}};Q0e.styles=[K0e.globalCss,X0e],J0e([ZJe({type:Boolean})],Q0e.prototype,"disabled",2),J0e([ZJe()],Q0e.prototype,"iconLeft",2),J0e([ZJe()],Q0e.prototype,"iconRight",2),J0e([ZJe()],Q0e.prototype,"onClick",2),J0e([ZJe()],Q0e.prototype,"variant",2),Q0e=J0e([KJe("wcm-button")],Q0e);const $0e=GZe`:host{display:inline-block}button{padding:0 15px 1px;height:40px;border-radius:var(--wcm-button-border-radius);color:var(--wcm-accent-fill-color);background-color:var(--wcm-accent-color)}button::after{content:'';top:0;bottom:0;left:0;right:0;position:absolute;background-color:transparent;border-radius:inherit;transition:background-color .2s ease;border:1px solid var(--wcm-color-overlay)}button:active::after{background-color:var(--wcm-color-overlay)}button:disabled{padding-bottom:0;background-color:var(--wcm-color-bg-3);color:var(--wcm-color-fg-3)}.wcm-secondary{color:var(--wcm-accent-color);background-color:transparent}.wcm-secondary::after{display:none}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}}`;var e1e=Object.defineProperty,t1e=Object.getOwnPropertyDescriptor,n1e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?t1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&e1e(t,n,a),a};let r1e=class extends GJe{constructor(){super(...arguments),this.disabled=!1,this.variant="primary"}render(){const e={"wcm-secondary":"secondary"===this.variant};return xJe`<button ?disabled="${this.disabled}" class="${tQe(e)}"><slot></slot></button>`}};r1e.styles=[K0e.globalCss,$0e],n1e([ZJe({type:Boolean})],r1e.prototype,"disabled",2),n1e([ZJe()],r1e.prototype,"variant",2),r1e=n1e([KJe("wcm-button-big")],r1e);const i1e=GZe`:host{background-color:var(--wcm-color-bg-2);border-top:1px solid var(--wcm-color-bg-3)}div{padding:10px 20px;display:inherit;flex-direction:inherit;align-items:inherit;width:inherit;justify-content:inherit}`;var a1e=Object.defineProperty,o1e=Object.getOwnPropertyDescriptor;let s1e=class extends GJe{render(){return xJe`<div><slot></slot></div>`}};s1e.styles=[K0e.globalCss,i1e],s1e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?o1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&a1e(t,n,a),a})([KJe("wcm-info-footer")],s1e);const c1e={CROSS_ICON:OJe`<svg width="12" height="12" viewBox="0 0 12 12"><path d="M9.94 11A.75.75 0 1 0 11 9.94L7.414 6.353a.5.5 0 0 1 0-.708L11 2.061A.75.75 0 1 0 9.94 1L6.353 4.586a.5.5 0 0 1-.708 0L2.061 1A.75.75 0 0 0 1 2.06l3.586 3.586a.5.5 0 0 1 0 .708L1 9.939A.75.75 0 1 0 2.06 11l3.586-3.586a.5.5 0 0 1 .708 0L9.939 11Z" fill="#fff"/></svg>`,WALLET_CONNECT_LOGO:OJe`<svg width="178" height="29" viewBox="0 0 178 29" id="wcm-wc-logo"><path d="M10.683 7.926c5.284-5.17 13.85-5.17 19.134 0l.636.623a.652.652 0 0 1 0 .936l-2.176 2.129a.343.343 0 0 1-.478 0l-.875-.857c-3.686-3.607-9.662-3.607-13.348 0l-.937.918a.343.343 0 0 1-.479 0l-2.175-2.13a.652.652 0 0 1 0-.936l.698-.683Zm23.633 4.403 1.935 1.895a.652.652 0 0 1 0 .936l-8.73 8.543a.687.687 0 0 1-.956 0L20.37 17.64a.172.172 0 0 0-.239 0l-6.195 6.063a.687.687 0 0 1-.957 0l-8.73-8.543a.652.652 0 0 1 0-.936l1.936-1.895a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .239 0l6.195-6.064a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .24 0l6.195-6.064a.687.687 0 0 1 .956 0ZM48.093 20.948l2.338-9.355c.139-.515.258-1.07.416-1.942.12.872.258 1.427.357 1.942l2.022 9.355h4.181l3.528-13.874h-3.21l-1.943 8.523a24.825 24.825 0 0 0-.456 2.457c-.158-.931-.317-1.625-.495-2.438l-1.883-8.542h-4.201l-2.042 8.542a41.204 41.204 0 0 0-.475 2.438 41.208 41.208 0 0 0-.476-2.438l-1.903-8.542h-3.349l3.508 13.874h4.083ZM63.33 21.304c1.585 0 2.596-.654 3.11-1.605-.059.297-.078.595-.078.892v.357h2.655V15.22c0-2.735-1.248-4.32-4.3-4.32-2.636 0-4.36 1.466-4.52 3.487h2.914c.1-.891.734-1.426 1.705-1.426.911 0 1.407.515 1.407 1.11 0 .435-.258.693-1.03.792l-1.388.159c-2.061.257-3.825 1.01-3.825 3.19 0 1.982 1.645 3.092 3.35 3.092Zm.891-2.041c-.773 0-1.348-.436-1.348-1.19 0-.733.655-1.09 1.645-1.268l.674-.119c.575-.118.892-.218 1.09-.396v.912c0 1.228-.892 2.06-2.06 2.06ZM70.398 7.074v13.874h2.874V7.074h-2.874ZM74.934 7.074v13.874h2.874V7.074h-2.874ZM84.08 21.304c2.735 0 4.5-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922H81.92ZM94.92 21.146c.633 0 1.248-.1 1.525-.179v-2.18c-.218.04-.475.06-.693.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.338v-2.24h-2.338V7.788H91.47v3.448H89.37v2.24h2.1v4.201c0 2.3 1.15 3.469 3.45 3.469ZM104.62 21.304c3.924 0 6.302-2.299 6.599-5.608h-3.111c-.238 1.803-1.506 3.032-3.369 3.032-2.2 0-3.746-1.784-3.746-4.796 0-2.953 1.605-4.638 3.805-4.638 1.883 0 2.953 1.15 3.171 2.834h3.191c-.317-3.448-2.854-5.41-6.342-5.41-3.984 0-7.036 2.695-7.036 7.214 0 4.677 2.676 7.372 6.838 7.372ZM117.449 21.304c2.993 0 5.114-1.882 5.114-5.172 0-3.23-2.121-5.233-5.114-5.233-2.972 0-5.093 2.002-5.093 5.233 0 3.29 2.101 5.172 5.093 5.172Zm0-2.22c-1.327 0-2.18-1.09-2.18-2.952 0-1.903.892-2.973 2.18-2.973 1.308 0 2.2 1.07 2.2 2.973 0 1.862-.872 2.953-2.2 2.953ZM126.569 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.229-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM137.464 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.228-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM149.949 21.304c2.735 0 4.499-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922h-3.984ZM160.876 21.304c3.013 0 4.658-1.645 4.975-4.201h-2.874c-.099 1.07-.713 1.982-2.001 1.982-1.309 0-2.2-1.21-2.2-2.993 0-1.942 1.03-2.933 2.259-2.933 1.209 0 1.803.872 1.883 1.882h2.873c-.218-2.358-1.823-4.142-4.776-4.142-2.874 0-5.153 1.903-5.153 5.193 0 3.25 1.923 5.212 5.014 5.212ZM172.067 21.146c.634 0 1.248-.1 1.526-.179v-2.18c-.218.04-.476.06-.694.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.339v-2.24h-2.339V7.788h-2.854v3.448h-2.1v2.24h2.1v4.201c0 2.3 1.15 3.469 3.449 3.469Z" fill="#fff"/></svg>`,WALLET_CONNECT_ICON:OJe`<svg width="28" height="20" viewBox="0 0 28 20"><g clip-path="url(#a)"><path d="M7.386 6.482c3.653-3.576 9.575-3.576 13.228 0l.44.43a.451.451 0 0 1 0 .648L19.55 9.033a.237.237 0 0 1-.33 0l-.606-.592c-2.548-2.496-6.68-2.496-9.228 0l-.648.634a.237.237 0 0 1-.33 0L6.902 7.602a.451.451 0 0 1 0-.647l.483-.473Zm16.338 3.046 1.339 1.31a.451.451 0 0 1 0 .648l-6.035 5.909a.475.475 0 0 1-.662 0L14.083 13.2a.119.119 0 0 0-.166 0l-4.283 4.194a.475.475 0 0 1-.662 0l-6.035-5.91a.451.451 0 0 1 0-.647l1.338-1.31a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0Z" fill="#000000"/></g><defs><clipPath id="a"><path fill="#ffffff" d="M0 0h28v20H0z"/></clipPath></defs></svg>`,WALLET_CONNECT_ICON_COLORED:OJe`<svg width="96" height="96" fill="none"><path fill="#fff" d="M25.322 33.597c12.525-12.263 32.83-12.263 45.355 0l1.507 1.476a1.547 1.547 0 0 1 0 2.22l-5.156 5.048a.814.814 0 0 1-1.134 0l-2.074-2.03c-8.737-8.555-22.903-8.555-31.64 0l-2.222 2.175a.814.814 0 0 1-1.134 0l-5.156-5.049a1.547 1.547 0 0 1 0-2.22l1.654-1.62Zm56.019 10.44 4.589 4.494a1.547 1.547 0 0 1 0 2.22l-20.693 20.26a1.628 1.628 0 0 1-2.267 0L48.283 56.632a.407.407 0 0 0-.567 0L33.03 71.012a1.628 1.628 0 0 1-2.268 0L10.07 50.75a1.547 1.547 0 0 1 0-2.22l4.59-4.494a1.628 1.628 0 0 1 2.267 0l14.687 14.38c.156.153.41.153.567 0l14.685-14.38a1.628 1.628 0 0 1 2.268 0l14.687 14.38c.156.153.41.153.567 0l14.686-14.38a1.628 1.628 0 0 1 2.268 0Z"/><path stroke="#000" d="M25.672 33.954c12.33-12.072 32.325-12.072 44.655 0l1.508 1.476a1.047 1.047 0 0 1 0 1.506l-5.157 5.048a.314.314 0 0 1-.434 0l-2.074-2.03c-8.932-8.746-23.409-8.746-32.34 0l-2.222 2.174a.314.314 0 0 1-.434 0l-5.157-5.048a1.047 1.047 0 0 1 0-1.506l1.655-1.62Zm55.319 10.44 4.59 4.494a1.047 1.047 0 0 1 0 1.506l-20.694 20.26a1.128 1.128 0 0 1-1.568 0l-14.686-14.38a.907.907 0 0 0-1.267 0L32.68 70.655a1.128 1.128 0 0 1-1.568 0L10.42 50.394a1.047 1.047 0 0 1 0-1.506l4.59-4.493a1.128 1.128 0 0 1 1.567 0l14.687 14.379a.907.907 0 0 0 1.266 0l-.35-.357.35.357 14.686-14.38a1.128 1.128 0 0 1 1.568 0l14.687 14.38a.907.907 0 0 0 1.267 0l14.686-14.38a1.128 1.128 0 0 1 1.568 0Z"/></svg>`,BACK_ICON:OJe`<svg width="10" height="18" viewBox="0 0 10 18"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.735.179a.75.75 0 0 1 .087 1.057L2.92 8.192a1.25 1.25 0 0 0 0 1.617l5.902 6.956a.75.75 0 1 1-1.144.97L1.776 10.78a2.75 2.75 0 0 1 0-3.559L7.678.265A.75.75 0 0 1 8.735.18Z" fill="#fff"/></svg>`,COPY_ICON:OJe`<svg width="24" height="24" fill="none"><path fill="#fff" fill-rule="evenodd" d="M7.01 7.01c.03-1.545.138-2.5.535-3.28A5 5 0 0 1 9.73 1.545C10.8 1 12.2 1 15 1c2.8 0 4.2 0 5.27.545a5 5 0 0 1 2.185 2.185C23 4.8 23 6.2 23 9c0 2.8 0 4.2-.545 5.27a5 5 0 0 1-2.185 2.185c-.78.397-1.735.505-3.28.534l-.001.01c-.03 1.54-.138 2.493-.534 3.27a5 5 0 0 1-2.185 2.186C13.2 23 11.8 23 9 23c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C1 19.2 1 17.8 1 15c0-2.8 0-4.2.545-5.27A5 5 0 0 1 3.73 7.545C4.508 7.149 5.46 7.04 7 7.01h.01ZM15 15.5c-1.425 0-2.403-.001-3.162-.063-.74-.06-1.139-.172-1.427-.319a3.5 3.5 0 0 1-1.53-1.529c-.146-.288-.257-.686-.318-1.427C8.501 11.403 8.5 10.425 8.5 9c0-1.425.001-2.403.063-3.162.06-.74.172-1.139.318-1.427a3.5 3.5 0 0 1 1.53-1.53c.288-.146.686-.257 1.427-.318.759-.062 1.737-.063 3.162-.063 1.425 0 2.403.001 3.162.063.74.06 1.139.172 1.427.318a3.5 3.5 0 0 1 1.53 1.53c.146.288.257.686.318 1.427.062.759.063 1.737.063 3.162 0 1.425-.001 2.403-.063 3.162-.06.74-.172 1.139-.319 1.427a3.5 3.5 0 0 1-1.529 1.53c-.288.146-.686.257-1.427.318-.759.062-1.737.063-3.162.063ZM7 8.511c-.444.009-.825.025-1.162.052-.74.06-1.139.172-1.427.318a3.5 3.5 0 0 0-1.53 1.53c-.146.288-.257.686-.318 1.427-.062.759-.063 1.737-.063 3.162 0 1.425.001 2.403.063 3.162.06.74.172 1.139.318 1.427a3.5 3.5 0 0 0 1.53 1.53c.288.146.686.257 1.427.318.759.062 1.737.063 3.162.063 1.425 0 2.403-.001 3.162-.063.74-.06 1.139-.172 1.427-.319a3.5 3.5 0 0 0 1.53-1.53c.146-.287.257-.685.318-1.426.027-.337.043-.718.052-1.162H15c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C7 13.2 7 11.8 7 9v-.489Z" clip-rule="evenodd"/></svg>`,RETRY_ICON:OJe`<svg width="15" height="16" viewBox="0 0 15 16"><path d="M6.464 2.03A.75.75 0 0 0 5.403.97L2.08 4.293a1 1 0 0 0 0 1.414L5.403 9.03a.75.75 0 0 0 1.06-1.06L4.672 6.177a.25.25 0 0 1 .177-.427h2.085a4 4 0 1 1-3.93 4.746c-.077-.407-.405-.746-.82-.746-.414 0-.755.338-.7.748a5.501 5.501 0 1 0 5.45-6.248H4.848a.25.25 0 0 1-.177-.427L6.464 2.03Z" fill="#fff"/></svg>`,DESKTOP_ICON:OJe`<svg width="16" height="16" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 5.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C2.204 1 3.13 1 4.98 1h6.04c1.85 0 2.775 0 3.466.394a3 3 0 0 1 1.12 1.12C16 3.204 16 4.13 16 5.98v1.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C13.796 12 12.87 12 11.02 12H4.98c-1.85 0-2.775 0-3.466-.394a3 3 0 0 1-1.12-1.12C0 9.796 0 8.87 0 7.02V5.98ZM4.98 2.5h6.04c.953 0 1.568.001 2.034.043.446.04.608.108.69.154a1.5 1.5 0 0 1 .559.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033v1.04c0 .952-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.046-.243.114-.69.154-.466.042-1.08.043-2.033.043H4.98c-.952 0-1.568-.001-2.034-.043-.446-.04-.608-.108-.69-.154a1.5 1.5 0 0 1-.559-.56c-.046-.08-.114-.243-.154-.69-.042-.465-.043-1.08-.043-2.033V5.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.046.243-.114.69-.154.465-.042 1.08-.043 2.033-.043Z" fill="#fff"/><path d="M4 14.25a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,MOBILE_ICON:OJe`<svg width="16" height="16" viewBox="0 0 16 16"><path d="M6.75 5a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M3 4.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C5.204 0 6.136 0 8 0s2.795 0 3.486.394a3 3 0 0 1 1.12 1.12C13 2.204 13 3.13 13 4.98v6.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C10.796 16 9.864 16 8 16s-2.795 0-3.486-.394a3 3 0 0 1-1.12-1.12C3 13.796 3 12.87 3 11.02V4.98Zm8.5 0v6.04c0 .953-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.045-.242.113-.693.154-.47.042-1.091.043-2.05.043-.959 0-1.58-.001-2.05-.043-.45-.04-.613-.109-.693-.154a1.5 1.5 0 0 1-.56-.56c-.046-.08-.114-.243-.154-.69-.042-.466-.043-1.08-.043-2.033V4.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.045.243-.113.693-.154C6.42 1.501 7.041 1.5 8 1.5c.959 0 1.58.001 2.05.043.45.04.613.109.693.154a1.5 1.5 0 0 1 .56.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033Z" fill="#fff"/></svg>`,ARROW_DOWN_ICON:OJe`<svg width="14" height="14" viewBox="0 0 14 14"><path d="M2.28 7.47a.75.75 0 0 0-1.06 1.06l5.25 5.25a.75.75 0 0 0 1.06 0l5.25-5.25a.75.75 0 0 0-1.06-1.06l-3.544 3.543a.25.25 0 0 1-.426-.177V.75a.75.75 0 0 0-1.5 0v10.086a.25.25 0 0 1-.427.176L2.28 7.47Z" fill="#fff"/></svg>`,ARROW_UP_RIGHT_ICON:OJe`<svg width="15" height="14" fill="none"><path d="M4.5 1.75A.75.75 0 0 1 5.25 1H12a1.5 1.5 0 0 1 1.5 1.5v6.75a.75.75 0 0 1-1.5 0V4.164a.25.25 0 0 0-.427-.176L4.061 11.5A.75.75 0 0 1 3 10.44l7.513-7.513a.25.25 0 0 0-.177-.427H5.25a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,ARROW_RIGHT_ICON:OJe`<svg width="6" height="14" viewBox="0 0 6 14"><path fill-rule="evenodd" clip-rule="evenodd" d="M2.181 1.099a.75.75 0 0 1 1.024.279l2.433 4.258a2.75 2.75 0 0 1 0 2.729l-2.433 4.257a.75.75 0 1 1-1.303-.744L4.335 7.62a1.25 1.25 0 0 0 0-1.24L1.902 2.122a.75.75 0 0 1 .28-1.023Z" fill="#fff"/></svg>`,QRCODE_ICON:OJe`<svg width="25" height="24" viewBox="0 0 25 24"><path d="M23.748 9a.748.748 0 0 0 .748-.752c-.018-2.596-.128-4.07-.784-5.22a6 6 0 0 0-2.24-2.24c-1.15-.656-2.624-.766-5.22-.784a.748.748 0 0 0-.752.748c0 .414.335.749.748.752 1.015.007 1.82.028 2.494.088.995.09 1.561.256 1.988.5.7.398 1.28.978 1.679 1.678.243.427.41.993.498 1.988.061.675.082 1.479.09 2.493a.753.753 0 0 0 .75.749ZM3.527.788C4.677.132 6.152.022 8.747.004A.748.748 0 0 1 9.5.752a.753.753 0 0 1-.749.752c-1.014.007-1.818.028-2.493.088-.995.09-1.561.256-1.988.5-.7.398-1.28.978-1.679 1.678-.243.427-.41.993-.499 1.988-.06.675-.081 1.479-.088 2.493A.753.753 0 0 1 1.252 9a.748.748 0 0 1-.748-.752c.018-2.596.128-4.07.784-5.22a6 6 0 0 1 2.24-2.24ZM1.252 15a.748.748 0 0 0-.748.752c.018 2.596.128 4.07.784 5.22a6 6 0 0 0 2.24 2.24c1.15.656 2.624.766 5.22.784a.748.748 0 0 0 .752-.748.753.753 0 0 0-.749-.752c-1.014-.007-1.818-.028-2.493-.089-.995-.089-1.561-.255-1.988-.498a4.5 4.5 0 0 1-1.679-1.68c-.243-.426-.41-.992-.499-1.987-.06-.675-.081-1.479-.088-2.493A.753.753 0 0 0 1.252 15ZM22.996 15.749a.753.753 0 0 1 .752-.749c.415 0 .751.338.748.752-.018 2.596-.128 4.07-.784 5.22a6 6 0 0 1-2.24 2.24c-1.15.656-2.624.766-5.22.784a.748.748 0 0 1-.752-.748c0-.414.335-.749.748-.752 1.015-.007 1.82-.028 2.494-.089.995-.089 1.561-.255 1.988-.498a4.5 4.5 0 0 0 1.679-1.68c.243-.426.41-.992.498-1.987.061-.675.082-1.479.09-2.493Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M7 4a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 11h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 4H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1ZM13.5 6.5A2.5 2.5 0 0 1 16 4h2a2.5 2.5 0 0 1 2.5 2.5v2A2.5 2.5 0 0 1 18 11h-2a2.5 2.5 0 0 1-2.5-2.5v-2Zm2.5-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1ZM7 13a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 20h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 13H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1Z" fill="#fff"/><path d="M13.5 15.5c0-.465 0-.697.038-.89a2 2 0 0 1 1.572-1.572C15.303 13 15.535 13 16 13v2.5h-2.5ZM18 13c.465 0 .697 0 .89.038a2 2 0 0 1 1.572 1.572c.038.193.038.425.038.89H18V13ZM18 17.5h2.5c0 .465 0 .697-.038.89a2 2 0 0 1-1.572 1.572C18.697 20 18.465 20 18 20v-2.5ZM13.5 17.5H16V20c-.465 0-.697 0-.89-.038a2 2 0 0 1-1.572-1.572c-.038-.193-.038-.425-.038-.89Z" fill="#fff"/></svg>`,SCAN_ICON:OJe`<svg width="16" height="16" fill="none"><path fill="#fff" d="M10 15.216c0 .422.347.763.768.74 1.202-.064 2.025-.222 2.71-.613a5.001 5.001 0 0 0 1.865-1.866c.39-.684.549-1.507.613-2.709a.735.735 0 0 0-.74-.768.768.768 0 0 0-.76.732c-.009.157-.02.306-.032.447-.073.812-.206 1.244-.384 1.555-.31.545-.761.996-1.306 1.306-.311.178-.743.311-1.555.384-.141.013-.29.023-.447.032a.768.768 0 0 0-.732.76ZM10 .784c0 .407.325.737.732.76.157.009.306.02.447.032.812.073 1.244.206 1.555.384a3.5 3.5 0 0 1 1.306 1.306c.178.311.311.743.384 1.555.013.142.023.29.032.447a.768.768 0 0 0 .76.732.734.734 0 0 0 .74-.768c-.064-1.202-.222-2.025-.613-2.71A5 5 0 0 0 13.477.658c-.684-.39-1.507-.549-2.709-.613a.735.735 0 0 0-.768.74ZM5.232.044A.735.735 0 0 1 6 .784a.768.768 0 0 1-.732.76c-.157.009-.305.02-.447.032-.812.073-1.244.206-1.555.384A3.5 3.5 0 0 0 1.96 3.266c-.178.311-.311.743-.384 1.555-.013.142-.023.29-.032.447A.768.768 0 0 1 .784 6a.735.735 0 0 1-.74-.768c.064-1.202.222-2.025.613-2.71A5 5 0 0 1 2.523.658C3.207.267 4.03.108 5.233.044ZM5.268 14.456a.768.768 0 0 1 .732.76.734.734 0 0 1-.768.74c-1.202-.064-2.025-.222-2.71-.613a5 5 0 0 1-1.865-1.866c-.39-.684-.549-1.507-.613-2.709A.735.735 0 0 1 .784 10c.407 0 .737.325.76.732.009.157.02.306.032.447.073.812.206 1.244.384 1.555a3.5 3.5 0 0 0 1.306 1.306c.311.178.743.311 1.555.384.142.013.29.023.447.032Z"/></svg>`,CHECKMARK_ICON:OJe`<svg width="13" height="12" viewBox="0 0 13 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.155.132a.75.75 0 0 1 .232 1.035L5.821 11.535a1 1 0 0 1-1.626.09L.665 7.21a.75.75 0 1 1 1.17-.937L4.71 9.867a.25.25 0 0 0 .406-.023L11.12.364a.75.75 0 0 1 1.035-.232Z" fill="#fff"/></svg>`,SEARCH_ICON:OJe`<svg width="20" height="21"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.432 13.992c-.354-.353-.91-.382-1.35-.146a5.5 5.5 0 1 1 2.265-2.265c-.237.441-.208.997.145 1.35l3.296 3.296a.75.75 0 1 1-1.06 1.061l-3.296-3.296Zm.06-5a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z" fill="#949E9E"/></svg>`,WALLET_PLACEHOLDER:OJe`<svg width="60" height="60" fill="none" viewBox="0 0 60 60"><g clip-path="url(#q)"><path id="wallet-placeholder-fill" fill="#fff" d="M0 24.9c0-9.251 0-13.877 1.97-17.332a15 15 0 0 1 5.598-5.597C11.023 0 15.648 0 24.9 0h10.2c9.252 0 13.877 0 17.332 1.97a15 15 0 0 1 5.597 5.598C60 11.023 60 15.648 60 24.9v10.2c0 9.252 0 13.877-1.97 17.332a15.001 15.001 0 0 1-5.598 5.597C48.977 60 44.352 60 35.1 60H24.9c-9.251 0-13.877 0-17.332-1.97a15 15 0 0 1-5.597-5.598C0 48.977 0 44.352 0 35.1V24.9Z"/><path id="wallet-placeholder-dash" stroke="#000" stroke-dasharray="4 4" stroke-width="1.5" d="M.04 41.708a231.598 231.598 0 0 1-.039-4.403l.75-.001L.75 35.1v-2.55H0v-5.1h.75V24.9l.001-2.204h-.75c.003-1.617.011-3.077.039-4.404l.75.016c.034-1.65.099-3.08.218-4.343l-.746-.07c.158-1.678.412-3.083.82-4.316l.713.236c.224-.679.497-1.296.827-1.875a14.25 14.25 0 0 1 1.05-1.585L3.076 5.9A15 15 0 0 1 5.9 3.076l.455.596a14.25 14.25 0 0 1 1.585-1.05c.579-.33 1.196-.603 1.875-.827l-.236-.712C10.812.674 12.217.42 13.895.262l.07.746C15.23.89 16.66.824 18.308.79l-.016-.75C19.62.012 21.08.004 22.695.001l.001.75L24.9.75h2.55V0h5.1v.75h2.55l2.204.001v-.75c1.617.003 3.077.011 4.404.039l-.016.75c1.65.034 3.08.099 4.343.218l.07-.746c1.678.158 3.083.412 4.316.82l-.236.713c.679.224 1.296.497 1.875.827a14.24 14.24 0 0 1 1.585 1.05l.455-.596A14.999 14.999 0 0 1 56.924 5.9l-.596.455c.384.502.735 1.032 1.05 1.585.33.579.602 1.196.827 1.875l.712-.236c.409 1.233.663 2.638.822 4.316l-.747.07c.119 1.264.184 2.694.218 4.343l.75-.016c.028 1.327.036 2.787.039 4.403l-.75.001.001 2.204v2.55H60v5.1h-.75v2.55l-.001 2.204h.75a231.431 231.431 0 0 1-.039 4.404l-.75-.016c-.034 1.65-.099 3.08-.218 4.343l.747.07c-.159 1.678-.413 3.083-.822 4.316l-.712-.236a10.255 10.255 0 0 1-.827 1.875 14.242 14.242 0 0 1-1.05 1.585l.596.455a14.997 14.997 0 0 1-2.824 2.824l-.455-.596c-.502.384-1.032.735-1.585 1.05-.579.33-1.196.602-1.875.827l.236.712c-1.233.409-2.638.663-4.316.822l-.07-.747c-1.264.119-2.694.184-4.343.218l.016.75c-1.327.028-2.787.036-4.403.039l-.001-.75-2.204.001h-2.55V60h-5.1v-.75H24.9l-2.204-.001v.75a231.431 231.431 0 0 1-4.404-.039l.016-.75c-1.65-.034-3.08-.099-4.343-.218l-.07.747c-1.678-.159-3.083-.413-4.316-.822l.236-.712a10.258 10.258 0 0 1-1.875-.827 14.252 14.252 0 0 1-1.585-1.05l-.455.596A14.999 14.999 0 0 1 3.076 54.1l.596-.455a14.24 14.24 0 0 1-1.05-1.585 10.259 10.259 0 0 1-.827-1.875l-.712.236C.674 49.188.42 47.783.262 46.105l.746-.07C.89 44.77.824 43.34.79 41.692l-.75.016Z"/><path fill="#fff" fill-rule="evenodd" d="M35.643 32.145c-.297-.743-.445-1.114-.401-1.275a.42.42 0 0 1 .182-.27c.134-.1.463-.1 1.123-.1.742 0 1.499.046 2.236-.05a6 6 0 0 0 5.166-5.166c.051-.39.051-.855.051-1.784 0-.928 0-1.393-.051-1.783a6 6 0 0 0-5.166-5.165c-.39-.052-.854-.052-1.783-.052h-7.72c-4.934 0-7.401 0-9.244 1.051a8 8 0 0 0-2.985 2.986C16.057 22.28 16.003 24.58 16 29 15.998 31.075 16 33.15 16 35.224A7.778 7.778 0 0 0 23.778 43H28.5c1.394 0 2.09 0 2.67-.116a6 6 0 0 0 4.715-4.714c.115-.58.115-1.301.115-2.744 0-1.31 0-1.964-.114-2.49a4.998 4.998 0 0 0-.243-.792Z" clip-rule="evenodd"/><path fill="#9EA9A9" fill-rule="evenodd" d="M37 18h-7.72c-2.494 0-4.266.002-5.647.126-1.361.122-2.197.354-2.854.728a6.5 6.5 0 0 0-2.425 2.426c-.375.657-.607 1.492-.729 2.853-.11 1.233-.123 2.777-.125 4.867 0 .7 0 1.05.097 1.181.096.13.182.181.343.2.163.02.518-.18 1.229-.581a6.195 6.195 0 0 1 3.053-.8H37c.977 0 1.32-.003 1.587-.038a4.5 4.5 0 0 0 3.874-3.874c.036-.268.039-.611.039-1.588 0-.976-.003-1.319-.038-1.587a4.5 4.5 0 0 0-3.875-3.874C38.32 18.004 37.977 18 37 18Zm-7.364 12.5h-7.414a4.722 4.722 0 0 0-4.722 4.723 6.278 6.278 0 0 0 6.278 6.278H28.5c1.466 0 1.98-.008 2.378-.087a4.5 4.5 0 0 0 3.535-3.536c.08-.397.087-.933.087-2.451 0-1.391-.009-1.843-.08-2.17a3.5 3.5 0 0 0-2.676-2.676c-.328-.072-.762-.08-2.108-.08Z" clip-rule="evenodd"/></g><defs><clipPath id="q"><path fill="#fff" d="M0 0h60v60H0z"/></clipPath></defs></svg>`,GLOBE_ICON:OJe`<svg width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="#fff" fill-rule="evenodd" d="M15.5 8a7.5 7.5 0 1 1-15 0 7.5 7.5 0 0 1 15 0Zm-2.113.75c.301 0 .535.264.47.558a6.01 6.01 0 0 1-2.867 3.896c-.203.116-.42-.103-.334-.32.409-1.018.691-2.274.797-3.657a.512.512 0 0 1 .507-.477h1.427Zm.47-2.058c.065.294-.169.558-.47.558H11.96a.512.512 0 0 1-.507-.477c-.106-1.383-.389-2.638-.797-3.656-.087-.217.13-.437.333-.32a6.01 6.01 0 0 1 2.868 3.895Zm-4.402.558c.286 0 .515-.24.49-.525-.121-1.361-.429-2.534-.83-3.393-.279-.6-.549-.93-.753-1.112a.535.535 0 0 0-.724 0c-.204.182-.474.513-.754 1.112-.4.859-.708 2.032-.828 3.393a.486.486 0 0 0 .49.525h2.909Zm-5.415 0c.267 0 .486-.21.507-.477.106-1.383.389-2.638.797-3.656.087-.217-.13-.437-.333-.32a6.01 6.01 0 0 0-2.868 3.895c-.065.294.169.558.47.558H4.04ZM2.143 9.308c-.065-.294.169-.558.47-.558H4.04c.267 0 .486.21.507.477.106 1.383.389 2.639.797 3.657.087.217-.13.436-.333.32a6.01 6.01 0 0 1-2.868-3.896Zm3.913-.033a.486.486 0 0 1 .49-.525h2.909c.286 0 .515.24.49.525-.121 1.361-.428 2.535-.83 3.394-.279.6-.549.93-.753 1.112a.535.535 0 0 1-.724 0c-.204-.182-.474-.513-.754-1.112-.4-.859-.708-2.033-.828-3.394Z" clip-rule="evenodd"/></svg>`},u1e=GZe`.wcm-toolbar-placeholder{top:0;bottom:0;left:0;right:0;width:100%;position:absolute;display:block;pointer-events:none;height:100px;border-radius:calc(var(--wcm-background-border-radius) * .9);background-color:var(--wcm-background-color);background-position:center;background-size:cover}.wcm-toolbar{height:38px;display:flex;position:relative;margin:5px 15px 5px 5px;justify-content:space-between;align-items:center}.wcm-toolbar img,.wcm-toolbar svg{height:28px;object-position:left center;object-fit:contain}#wcm-wc-logo path{fill:var(--wcm-accent-fill-color)}button{width:28px;height:28px;border-radius:var(--wcm-icon-button-border-radius);border:0;display:flex;justify-content:center;align-items:center;cursor:pointer;background-color:var(--wcm-color-bg-1);box-shadow:0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-bg-2)}button svg{display:block;object-position:center}button path{fill:var(--wcm-color-fg-1)}.wcm-toolbar div{display:flex}@media(hover:hover){button:hover{background-color:var(--wcm-color-bg-2)}}`;var l1e=Object.defineProperty,d1e=Object.getOwnPropertyDescriptor;let f1e=class extends GJe{render(){return xJe`<div class="wcm-toolbar-placeholder"></div><div class="wcm-toolbar">${c1e.WALLET_CONNECT_LOGO} <button @click="${aMe.close}">${c1e.CROSS_ICON}</button></div>`}};f1e.styles=[K0e.globalCss,u1e],f1e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?d1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&l1e(t,n,a),a})([KJe("wcm-modal-backcard")],f1e);const p1e=GZe`main{padding:20px;padding-top:0;width:100%}`;var h1e=Object.defineProperty,m1e=Object.getOwnPropertyDescriptor;let y1e=class extends GJe{render(){return xJe`<main><slot></slot></main>`}};y1e.styles=[K0e.globalCss,p1e],y1e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?m1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&h1e(t,n,a),a})([KJe("wcm-modal-content")],y1e);const b1e=GZe`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;var g1e=Object.defineProperty,v1e=Object.getOwnPropertyDescriptor;let w1e=class extends GJe{render(){return xJe`<footer><slot></slot></footer>`}};w1e.styles=[K0e.globalCss,b1e],w1e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?v1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&g1e(t,n,a),a})([KJe("wcm-modal-footer")],w1e);const T1e=GZe`header{display:flex;justify-content:center;align-items:center;padding:20px;position:relative}.wcm-border{border-bottom:1px solid var(--wcm-color-bg-2);margin-bottom:20px}header button{padding:15px 20px}header button:active{opacity:.5}@media(hover:hover){header button:hover{opacity:.5}}.wcm-back-btn{position:absolute;left:0}.wcm-action-btn{position:absolute;right:0}path{fill:var(--wcm-accent-color)}`;var E1e=Object.defineProperty,A1e=Object.getOwnPropertyDescriptor,x1e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?A1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&E1e(t,n,a),a};let O1e=class extends GJe{constructor(){super(...arguments),this.title="",this.onAction=void 0,this.actionIcon=void 0,this.border=!1}backBtnTemplate(){return xJe`<button class="wcm-back-btn" @click="${RNe.goBack}">${c1e.BACK_ICON}</button>`}actionBtnTemplate(){return xJe`<button class="wcm-action-btn" @click="${this.onAction}">${this.actionIcon}</button>`}render(){const e={"wcm-border":this.border},t=RNe.state.history.length>1,n=this.title?xJe`<wcm-text variant="big-bold">${this.title}</wcm-text>`:xJe`<slot></slot>`;return xJe`<header class="${tQe(e)}">${t?this.backBtnTemplate():null} ${n} ${this.onAction?this.actionBtnTemplate():null}</header>`}};O1e.styles=[K0e.globalCss,T1e],x1e([ZJe()],O1e.prototype,"title",2),x1e([ZJe()],O1e.prototype,"onAction",2),x1e([ZJe()],O1e.prototype,"actionIcon",2),x1e([ZJe({type:Boolean})],O1e.prototype,"border",2),O1e=x1e([KJe("wcm-modal-header")],O1e);const C1e={MOBILE_BREAKPOINT:600,WCM_RECENT_WALLET_DATA:"WCM_RECENT_WALLET_DATA",EXPLORER_WALLET_URL:"https://explorer.walletconnect.com/?type=wallet",getShadowRootElement(e,t){const n=e.renderRoot.querySelector(t);if(!n)throw new Error(`${t} not found`);return n},getWalletIcon({id:e,image_id:t}){const{walletImages:n}=BNe.state;return null!=n&&n[e]?n[e]:t?rMe.getWalletImageUrl(t):""},getWalletName:(e,t=!1)=>t&&e.length>8?`${e.substring(0,8)}..`:e,isMobileAnimation:()=>window.innerWidth<=C1e.MOBILE_BREAKPOINT,async preloadImage(e){const t=new Promise(((t,n)=>{const r=new Image;r.onload=t,r.onerror=n,r.crossOrigin="anonymous",r.src=e}));return Promise.race([t,NNe.wait(3e3)])},getErrorMessage:e=>e instanceof Error?e.message:"Unknown Error",debounce(e,t=500){let n;return(...r)=>{n&&clearTimeout(n),n=setTimeout((function(){e(...r)}),t)}},handleMobileLinking(e){const{walletConnectUri:t}=jNe.state,{mobile:n,name:r}=e,i=n?.native,a=n?.universal;C1e.setRecentWallet(e),t&&function(e){let t="";i?t=NNe.formatUniversalUrl(i,e,r):a&&(t=NNe.formatNativeUrl(a,e,r)),NNe.openHref(t,"_self")}(t)},handleAndroidLinking(){const{walletConnectUri:e}=jNe.state;e&&(NNe.setWalletConnectAndroidDeepLink(e),NNe.openHref(e,"_self"))},async handleUriCopy(){const{walletConnectUri:e}=jNe.state;if(e)try{await navigator.clipboard.writeText(e),hMe.openToast("Link copied","success")}catch{hMe.openToast("Failed to copy","error")}},getCustomImageUrls(){const{walletImages:e}=BNe.state,t=Object.values(e??{});return Object.values(t)},truncate:(e,t=8)=>e.length<=t?e:`${e.substring(0,4)}...${e.substring(e.length-4)}`,setRecentWallet(e){try{localStorage.setItem(C1e.WCM_RECENT_WALLET_DATA,JSON.stringify(e))}catch{console.info("Unable to set recent wallet")}},getRecentWallet(){try{const e=localStorage.getItem(C1e.WCM_RECENT_WALLET_DATA);return e?JSON.parse(e):void 0}catch{console.info("Unable to get recent wallet")}},caseSafeIncludes:(e,t)=>e.toUpperCase().includes(t.toUpperCase()),openWalletExplorerUrl(){NNe.openHref(C1e.EXPLORER_WALLET_URL,"_blank")},getCachedRouterWalletPlatforms(){const{desktop:e,mobile:t}=NNe.getWalletRouterData(),n=Boolean(e?.native),r=Boolean(e?.universal);return{isDesktop:n,isMobile:Boolean(t?.native)||Boolean(t?.universal),isWeb:r}},goToConnectingView(e){RNe.setData({Wallet:e});const t=NNe.isMobile(),{isDesktop:n,isWeb:r,isMobile:i}=C1e.getCachedRouterWalletPlatforms();t?i?RNe.push("MobileConnecting"):r?RNe.push("WebConnecting"):RNe.push("InstallWallet"):n?RNe.push("DesktopConnecting"):r?RNe.push("WebConnecting"):i?RNe.push("MobileQrcodeConnecting"):RNe.push("InstallWallet")}},I1e=GZe`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var _1e=Object.defineProperty,P1e=Object.getOwnPropertyDescriptor,S1e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?P1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&_1e(t,n,a),a};let k1e=class extends GJe{constructor(){super(),this.view=RNe.state.view,this.prevView=RNe.state.view,this.unsubscribe=void 0,this.oldHeight="0px",this.resizeObserver=void 0,this.unsubscribe=RNe.subscribe((e=>{this.view!==e.view&&this.onChangeRoute()}))}firstUpdated(){this.resizeObserver=new ResizeObserver((([e])=>{const t=`${e.contentRect.height}px`;"0px"!==this.oldHeight&&l$e(this.routerEl,{height:[this.oldHeight,t]},{duration:.2}),this.oldHeight=t})),this.resizeObserver.observe(this.contentEl)}disconnectedCallback(){var e,t;null==(e=this.unsubscribe)||e.call(this),null==(t=this.resizeObserver)||t.disconnect()}get routerEl(){return C1e.getShadowRootElement(this,".wcm-router")}get contentEl(){return C1e.getShadowRootElement(this,".wcm-content")}viewTemplate(){switch(this.view){case"ConnectWallet":return xJe`<wcm-connect-wallet-view></wcm-connect-wallet-view>`;case"DesktopConnecting":return xJe`<wcm-desktop-connecting-view></wcm-desktop-connecting-view>`;case"MobileConnecting":return xJe`<wcm-mobile-connecting-view></wcm-mobile-connecting-view>`;case"WebConnecting":return xJe`<wcm-web-connecting-view></wcm-web-connecting-view>`;case"MobileQrcodeConnecting":return xJe`<wcm-mobile-qr-connecting-view></wcm-mobile-qr-connecting-view>`;case"WalletExplorer":return xJe`<wcm-wallet-explorer-view></wcm-wallet-explorer-view>`;case"Qrcode":return xJe`<wcm-qrcode-view></wcm-qrcode-view>`;case"InstallWallet":return xJe`<wcm-install-wallet-view></wcm-install-wallet-view>`;default:return xJe`<div>Not Found</div>`}}async onChangeRoute(){await l$e(this.routerEl,{opacity:[1,0],scale:[1,1.02]},{duration:.15,delay:.1}).finished,this.view=RNe.state.view,l$e(this.routerEl,{opacity:[0,1],scale:[.99,1]},{duration:.37,delay:.05})}render(){return xJe`<div class="wcm-router"><div class="wcm-content">${this.viewTemplate()}</div></div>`}};k1e.styles=[K0e.globalCss,I1e],S1e([JJe()],k1e.prototype,"view",2),S1e([JJe()],k1e.prototype,"prevView",2),k1e=S1e([KJe("wcm-modal-router")],k1e);const R1e=GZe`div{height:36px;width:max-content;display:flex;justify-content:center;align-items:center;padding:9px 15px 11px;position:absolute;top:12px;box-shadow:0 6px 14px -6px rgba(10,16,31,.3),0 10px 32px -4px rgba(10,16,31,.15);z-index:2;left:50%;transform:translateX(-50%);pointer-events:none;backdrop-filter:blur(20px) saturate(1.8);-webkit-backdrop-filter:blur(20px) saturate(1.8);border-radius:var(--wcm-notification-border-radius);border:1px solid var(--wcm-color-overlay);background-color:var(--wcm-color-overlay)}svg{margin-right:5px}@-moz-document url-prefix(){div{background-color:var(--wcm-color-bg-3)}}.wcm-success path{fill:var(--wcm-accent-color)}.wcm-error path{fill:var(--wcm-error-color)}`;var N1e=Object.defineProperty,M1e=Object.getOwnPropertyDescriptor,D1e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?M1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&N1e(t,n,a),a};let L1e=class extends GJe{constructor(){super(),this.open=!1,this.unsubscribe=void 0,this.timeout=void 0,this.unsubscribe=hMe.subscribe((e=>{e.open?(this.open=!0,this.timeout=setTimeout((()=>hMe.closeToast()),2200)):(this.open=!1,clearTimeout(this.timeout))}))}disconnectedCallback(){var e;null==(e=this.unsubscribe)||e.call(this),clearTimeout(this.timeout),hMe.closeToast()}render(){const{message:e,variant:t}=hMe.state,n={"wcm-success":"success"===t,"wcm-error":"error"===t};return this.open?xJe`<div class="${tQe(n)}">${"success"===t?c1e.CHECKMARK_ICON:null} ${"error"===t?c1e.CROSS_ICON:null}<wcm-text variant="small-regular">${e}</wcm-text></div>`:null}};L1e.styles=[K0e.globalCss,R1e],D1e([JJe()],L1e.prototype,"open",2),L1e=D1e([KJe("wcm-modal-toast")],L1e);function j1e(e,t,n){return e!==t&&(e-t<0?t-e:e-t)<=n+.1}const F1e={generate(e,t,n){const r="#141414",i=[],a=function(e,t){const n=Array.prototype.slice.call(f$e.create(e,{errorCorrectionLevel:t}).modules.data,0),r=Math.sqrt(n.length);return n.reduce(((e,t,n)=>(n%r==0?e.push([t]):e[e.length-1].push(t))&&e),[])}(e,"Q"),o=t/a.length,s=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];s.forEach((({x:e,y:t})=>{const n=(a.length-7)*o*e,c=(a.length-7)*o*t;for(let e=0;e<s.length;e+=1){const t=o*(7-2*e);i.push(OJe`<rect fill="${e%2==0?r:"#ffffff"}" height="${t}" rx="${.45*t}" ry="${.45*t}" width="${t}" x="${n+o*e}" y="${c+o*e}">`)}}));const c=Math.floor((n+25)/o),u=a.length/2-c/2,l=a.length/2+c/2-1,d=[];a.forEach(((e,t)=>{e.forEach(((e,n)=>{if(a[t][n]&&!(t<7&&n<7||t>a.length-8&&n<7||t<7&&n>a.length-8)&&!(t>u&&t<l&&n>u&&n<l)){const e=t*o+o/2,r=n*o+o/2;d.push([e,r])}}))}));const f={};return d.forEach((([e,t])=>{f[e]?f[e].push(t):f[e]=[t]})),Object.entries(f).map((([e,t])=>{const n=t.filter((e=>t.every((t=>!j1e(e,t,o)))));return[Number(e),n]})).forEach((([e,t])=>{t.forEach((t=>{i.push(OJe`<circle cx="${e}" cy="${t}" fill="${r}" r="${o/2.5}">`)}))})),Object.entries(f).filter((([e,t])=>t.length>1)).map((([e,t])=>{const n=t.filter((e=>t.some((t=>j1e(e,t,o)))));return[Number(e),n]})).map((([e,t])=>{t.sort(((e,t)=>e<t?-1:1));const n=[];for(const e of t){const t=n.find((t=>t.some((t=>j1e(e,t,o)))));t?t.push(e):n.push([e])}return[e,n.map((e=>[e[0],e[e.length-1]]))]})).forEach((([e,t])=>{t.forEach((([t,n])=>{i.push(OJe`<line x1="${e}" x2="${e}" y1="${t}" y2="${n}" stroke="${r}" stroke-width="${o/1.25}" stroke-linecap="round">`)}))})),i}},B1e=GZe`@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}div{position:relative;user-select:none;display:block;overflow:hidden;aspect-ratio:1/1;animation:fadeIn ease .2s}.wcm-dark{background-color:#fff;border-radius:var(--wcm-container-border-radius);padding:18px;box-shadow:0 2px 5px #000}svg:first-child,wcm-wallet-image{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{width:25%;height:25%;border-radius:var(--wcm-wallet-icon-border-radius)}svg:first-child{transform:translateY(-50%) translateX(-50%) scale(.9)}svg:first-child path:first-child{fill:var(--wcm-accent-color)}svg:first-child path:last-child{stroke:var(--wcm-color-overlay)}`;var U1e=Object.defineProperty,z1e=Object.getOwnPropertyDescriptor,H1e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?z1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&U1e(t,n,a),a};let W1e=class extends GJe{constructor(){super(...arguments),this.uri="",this.size=0,this.imageId=void 0,this.walletId=void 0,this.imageUrl=void 0}svgTemplate(){const e="light"===fMe.state.themeMode?this.size:this.size-36;return OJe`<svg height="${e}" width="${e}">${F1e.generate(this.uri,e,e/4)}</svg>`}render(){const e={"wcm-dark":"dark"===fMe.state.themeMode};return xJe`<div style="${`width: ${this.size}px`}" class="${tQe(e)}">${this.walletId||this.imageUrl?xJe`<wcm-wallet-image walletId="${d$e(this.walletId)}" imageId="${d$e(this.imageId)}" imageUrl="${d$e(this.imageUrl)}"></wcm-wallet-image>`:c1e.WALLET_CONNECT_ICON_COLORED} ${this.svgTemplate()}</div>`}};W1e.styles=[K0e.globalCss,B1e],H1e([ZJe()],W1e.prototype,"uri",2),H1e([ZJe({type:Number})],W1e.prototype,"size",2),H1e([ZJe()],W1e.prototype,"imageId",2),H1e([ZJe()],W1e.prototype,"walletId",2),H1e([ZJe()],W1e.prototype,"imageUrl",2),W1e=H1e([KJe("wcm-qrcode")],W1e);const V1e=GZe`:host{position:relative;height:28px;width:80%}input{width:100%;height:100%;line-height:28px!important;border-radius:var(--wcm-input-border-radius);font-style:normal;font-family:-apple-system,system-ui,BlinkMacSystemFont,'Segoe UI',Roboto,Ubuntu,'Helvetica Neue',sans-serif;font-feature-settings:'case' on;font-weight:500;font-size:16px;letter-spacing:-.03em;padding:0 10px 0 34px;transition:.2s all ease;color:var(--wcm-color-fg-1);background-color:var(--wcm-color-bg-3);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay);caret-color:var(--wcm-accent-color)}input::placeholder{color:var(--wcm-color-fg-2)}svg{left:10px;top:4px;pointer-events:none;position:absolute;width:20px;height:20px}input:focus-within{box-shadow:inset 0 0 0 1px var(--wcm-accent-color)}path{fill:var(--wcm-color-fg-2)}`;var G1e=Object.defineProperty,q1e=Object.getOwnPropertyDescriptor,K1e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?q1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&G1e(t,n,a),a};let X1e=class extends GJe{constructor(){super(...arguments),this.onChange=()=>null}render(){return xJe`<input type="text" @input="${this.onChange}" placeholder="Search wallets"> ${c1e.SEARCH_ICON}`}};X1e.styles=[K0e.globalCss,V1e],K1e([ZJe()],X1e.prototype,"onChange",2),X1e=K1e([KJe("wcm-search-input")],X1e);const Y1e=GZe`@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}100%{stroke-dasharray:90,150;stroke-dashoffset:-124}}svg{animation:rotate 2s linear infinite;display:flex;justify-content:center;align-items:center}svg circle{stroke-linecap:round;animation:dash 1.5s ease infinite;stroke:var(--wcm-accent-color)}`;var Z1e=Object.defineProperty,J1e=Object.getOwnPropertyDescriptor;let Q1e=class extends GJe{render(){return xJe`<svg viewBox="0 0 50 50" width="24" height="24"><circle cx="25" cy="25" r="20" fill="none" stroke-width="4" stroke="#fff"/></svg>`}};Q1e.styles=[K0e.globalCss,Y1e],Q1e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?J1e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&Z1e(t,n,a),a})([KJe("wcm-spinner")],Q1e);const $1e=GZe`span{font-style:normal;font-family:var(--wcm-font-family);font-feature-settings:var(--wcm-font-feature-settings)}.wcm-xsmall-bold{font-family:var(--wcm-text-xsmall-bold-font-family);font-weight:var(--wcm-text-xsmall-bold-weight);font-size:var(--wcm-text-xsmall-bold-size);line-height:var(--wcm-text-xsmall-bold-line-height);letter-spacing:var(--wcm-text-xsmall-bold-letter-spacing);text-transform:var(--wcm-text-xsmall-bold-text-transform)}.wcm-xsmall-regular{font-family:var(--wcm-text-xsmall-regular-font-family);font-weight:var(--wcm-text-xsmall-regular-weight);font-size:var(--wcm-text-xsmall-regular-size);line-height:var(--wcm-text-xsmall-regular-line-height);letter-spacing:var(--wcm-text-xsmall-regular-letter-spacing);text-transform:var(--wcm-text-xsmall-regular-text-transform)}.wcm-small-thin{font-family:var(--wcm-text-small-thin-font-family);font-weight:var(--wcm-text-small-thin-weight);font-size:var(--wcm-text-small-thin-size);line-height:var(--wcm-text-small-thin-line-height);letter-spacing:var(--wcm-text-small-thin-letter-spacing);text-transform:var(--wcm-text-small-thin-text-transform)}.wcm-small-regular{font-family:var(--wcm-text-small-regular-font-family);font-weight:var(--wcm-text-small-regular-weight);font-size:var(--wcm-text-small-regular-size);line-height:var(--wcm-text-small-regular-line-height);letter-spacing:var(--wcm-text-small-regular-letter-spacing);text-transform:var(--wcm-text-small-regular-text-transform)}.wcm-medium-regular{font-family:var(--wcm-text-medium-regular-font-family);font-weight:var(--wcm-text-medium-regular-weight);font-size:var(--wcm-text-medium-regular-size);line-height:var(--wcm-text-medium-regular-line-height);letter-spacing:var(--wcm-text-medium-regular-letter-spacing);text-transform:var(--wcm-text-medium-regular-text-transform)}.wcm-big-bold{font-family:var(--wcm-text-big-bold-font-family);font-weight:var(--wcm-text-big-bold-weight);font-size:var(--wcm-text-big-bold-size);line-height:var(--wcm-text-big-bold-line-height);letter-spacing:var(--wcm-text-big-bold-letter-spacing);text-transform:var(--wcm-text-big-bold-text-transform)}:host(*){color:var(--wcm-color-fg-1)}.wcm-color-primary{color:var(--wcm-color-fg-1)}.wcm-color-secondary{color:var(--wcm-color-fg-2)}.wcm-color-tertiary{color:var(--wcm-color-fg-3)}.wcm-color-inverse{color:var(--wcm-accent-fill-color)}.wcm-color-accnt{color:var(--wcm-accent-color)}.wcm-color-error{color:var(--wcm-error-color)}`;var e5e=Object.defineProperty,t5e=Object.getOwnPropertyDescriptor,n5e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?t5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&e5e(t,n,a),a};let r5e=class extends GJe{constructor(){super(...arguments),this.variant="medium-regular",this.color="primary"}render(){const e={"wcm-big-bold":"big-bold"===this.variant,"wcm-medium-regular":"medium-regular"===this.variant,"wcm-small-regular":"small-regular"===this.variant,"wcm-small-thin":"small-thin"===this.variant,"wcm-xsmall-regular":"xsmall-regular"===this.variant,"wcm-xsmall-bold":"xsmall-bold"===this.variant,"wcm-color-primary":"primary"===this.color,"wcm-color-secondary":"secondary"===this.color,"wcm-color-tertiary":"tertiary"===this.color,"wcm-color-inverse":"inverse"===this.color,"wcm-color-accnt":"accent"===this.color,"wcm-color-error":"error"===this.color};return xJe`<span><slot class="${tQe(e)}"></slot></span>`}};r5e.styles=[K0e.globalCss,$1e],n5e([ZJe()],r5e.prototype,"variant",2),n5e([ZJe()],r5e.prototype,"color",2),r5e=n5e([KJe("wcm-text")],r5e);const i5e=GZe`button{width:100%;height:100%;border-radius:var(--wcm-button-hover-highlight-border-radius);display:flex;align-items:flex-start}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}button>div{width:80px;padding:5px 0;display:flex;flex-direction:column;align-items:center}wcm-text{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:center}wcm-wallet-image{height:60px;width:60px;transition:all .2s ease;border-radius:var(--wcm-wallet-icon-border-radius);margin-bottom:5px}.wcm-sublabel{margin-top:2px}`;var a5e=Object.defineProperty,o5e=Object.getOwnPropertyDescriptor,s5e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?o5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&a5e(t,n,a),a};let c5e=class extends GJe{constructor(){super(...arguments),this.onClick=()=>null,this.name="",this.walletId="",this.label=void 0,this.imageId=void 0,this.installed=!1,this.recent=!1}sublabelTemplate(){return this.recent?xJe`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">RECENT</wcm-text>`:this.installed?xJe`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">INSTALLED</wcm-text>`:null}handleClick(){DNe.click({name:"WALLET_BUTTON",walletId:this.walletId}),this.onClick()}render(){var e;return xJe`<button @click="${this.handleClick.bind(this)}"><div><wcm-wallet-image walletId="${this.walletId}" imageId="${d$e(this.imageId)}"></wcm-wallet-image><wcm-text variant="xsmall-regular">${null!=(e=this.label)?e:C1e.getWalletName(this.name,!0)}</wcm-text>${this.sublabelTemplate()}</div></button>`}};c5e.styles=[K0e.globalCss,i5e],s5e([ZJe()],c5e.prototype,"onClick",2),s5e([ZJe()],c5e.prototype,"name",2),s5e([ZJe()],c5e.prototype,"walletId",2),s5e([ZJe()],c5e.prototype,"label",2),s5e([ZJe()],c5e.prototype,"imageId",2),s5e([ZJe({type:Boolean})],c5e.prototype,"installed",2),s5e([ZJe({type:Boolean})],c5e.prototype,"recent",2),c5e=s5e([KJe("wcm-wallet-button")],c5e);const u5e=GZe`:host{display:block}div{overflow:hidden;position:relative;border-radius:inherit;width:100%;height:100%;background-color:var(--wcm-color-overlay)}svg{position:relative;width:100%;height:100%}div::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;border-radius:inherit;border:1px solid var(--wcm-color-overlay)}div img{width:100%;height:100%;object-fit:cover;object-position:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var l5e=Object.defineProperty,d5e=Object.getOwnPropertyDescriptor,f5e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?d5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&l5e(t,n,a),a};let p5e=class extends GJe{constructor(){super(...arguments),this.walletId="",this.imageId=void 0,this.imageUrl=void 0}render(){var e;const t=null!=(e=this.imageUrl)&&e.length?this.imageUrl:C1e.getWalletIcon({id:this.walletId,image_id:this.imageId});return xJe`${t.length?xJe`<div><img crossorigin="anonymous" src="${t}" alt="${this.id}"></div>`:c1e.WALLET_PLACEHOLDER}`}};p5e.styles=[K0e.globalCss,u5e],f5e([ZJe()],p5e.prototype,"walletId",2),f5e([ZJe()],p5e.prototype,"imageId",2),f5e([ZJe()],p5e.prototype,"imageUrl",2),p5e=f5e([KJe("wcm-wallet-image")],p5e);var h5e=Object.defineProperty,m5e=Object.getOwnPropertyDescriptor,y5e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?m5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&h5e(t,n,a),a};let b5e=class extends GJe{constructor(){super(),this.preload=!0,this.preloadData()}async loadImages(e){try{null!=e&&e.length&&await Promise.all(e.map((async e=>C1e.preloadImage(e))))}catch{console.info("Unsuccessful attempt at preloading some images",e)}}async preloadListings(){if(BNe.state.enableExplorer){await rMe.getRecomendedWallets(),jNe.setIsDataLoaded(!0);const{recomendedWallets:e}=rMe.state,t=e.map((e=>C1e.getWalletIcon(e)));await this.loadImages(t)}else jNe.setIsDataLoaded(!0)}async preloadCustomImages(){const e=C1e.getCustomImageUrls();await this.loadImages(e)}async preloadData(){try{this.preload&&(this.preload=!1,await Promise.all([this.preloadListings(),this.preloadCustomImages()]))}catch(e){console.error(e),hMe.openToast("Failed preloading","error")}}};y5e([JJe()],b5e.prototype,"preload",2),b5e=y5e([KJe("wcm-explorer-context")],b5e);var g5e=Object.defineProperty,v5e=Object.getOwnPropertyDescriptor;let w5e=class extends GJe{constructor(){super(),this.unsubscribeTheme=void 0,K0e.setTheme(),this.unsubscribeTheme=fMe.subscribe(K0e.setTheme)}disconnectedCallback(){var e;null==(e=this.unsubscribeTheme)||e.call(this)}};w5e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?v5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&g5e(t,n,a),a})([KJe("wcm-theme-context")],w5e);const T5e=GZe`@keyframes scroll{0%{transform:translate3d(0,0,0)}100%{transform:translate3d(calc(-70px * 9),0,0)}}.wcm-slider{position:relative;overflow-x:hidden;padding:10px 0;margin:0 -20px;width:calc(100% + 40px)}.wcm-track{display:flex;width:calc(70px * 18);animation:scroll 20s linear infinite;opacity:.7}.wcm-track svg{margin:0 5px}wcm-wallet-image{width:60px;height:60px;margin:0 5px;border-radius:var(--wcm-wallet-icon-border-radius)}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-title{display:flex;align-items:center;margin-bottom:10px}.wcm-title svg{margin-right:6px}.wcm-title path{fill:var(--wcm-accent-color)}wcm-modal-footer .wcm-title{padding:0 10px}wcm-button-big{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);filter:drop-shadow(0 0 17px var(--wcm-color-bg-1))}wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-info-footer wcm-text{text-align:center;margin-bottom:15px}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var E5e=Object.defineProperty,A5e=Object.getOwnPropertyDescriptor;let x5e=class extends GJe{onGoToQrcode(){RNe.push("Qrcode")}render(){const{recomendedWallets:e}=rMe.state,t=[...e,...e],n=2*NNe.RECOMMENDED_WALLET_AMOUNT;return xJe`<wcm-modal-header title="Connect your wallet" .onAction="${this.onGoToQrcode}" .actionIcon="${c1e.QRCODE_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-title">${c1e.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">WalletConnect</wcm-text></div><div class="wcm-slider"><div class="wcm-track">${[...Array(n)].map(((e,n)=>{const r=t[n%t.length];return r?xJe`<wcm-wallet-image walletId="${r.id}" imageId="${r.image_id}"></wcm-wallet-image>`:c1e.WALLET_PLACEHOLDER}))}</div><wcm-button-big @click="${C1e.handleAndroidLinking}"><wcm-text variant="medium-regular" color="inverse">Select Wallet</wcm-text></wcm-button-big></div></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">Choose WalletConnect to see supported apps on your device</wcm-text></wcm-info-footer>`}};x5e.styles=[K0e.globalCss,T5e],x5e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?A5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&E5e(t,n,a),a})([KJe("wcm-android-wallet-selection")],x5e);const O5e=GZe`@keyframes loading{to{stroke-dashoffset:0}}@keyframes shake{10%,90%{transform:translate3d(-1px,0,0)}20%,80%{transform:translate3d(1px,0,0)}30%,50%,70%{transform:translate3d(-2px,0,0)}40%,60%{transform:translate3d(2px,0,0)}}:host{display:flex;flex-direction:column;align-items:center}div{position:relative;width:110px;height:110px;display:flex;justify-content:center;align-items:center;margin:40px 0 20px 0;transform:translate3d(0,0,0)}svg{position:absolute;width:110px;height:110px;fill:none;stroke:transparent;stroke-linecap:round;stroke-width:2px;top:0;left:0}use{stroke:var(--wcm-accent-color);animation:loading 1s linear infinite}wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:90px;height:90px}wcm-text{margin-bottom:40px}.wcm-error svg{stroke:var(--wcm-error-color)}.wcm-error use{display:none}.wcm-error{animation:shake .4s cubic-bezier(.36,.07,.19,.97) both}.wcm-stale svg,.wcm-stale use{display:none}`;var C5e=Object.defineProperty,I5e=Object.getOwnPropertyDescriptor,_5e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?I5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&C5e(t,n,a),a};let P5e=class extends GJe{constructor(){super(...arguments),this.walletId=void 0,this.imageId=void 0,this.isError=!1,this.isStale=!1,this.label=""}svgLoaderTemplate(){var e,t;const n=null!=(t=null==(e=fMe.state.themeVariables)?void 0:e["--wcm-wallet-icon-large-border-radius"])?t:K0e.getPreset("--wcm-wallet-icon-large-border-radius");let r=0;r=n.includes("%")?.88*parseInt(n,10):parseInt(n,10),r*=1.17;return xJe`<svg viewBox="0 0 110 110" width="110" height="110"><rect id="wcm-loader" x="2" y="2" width="106" height="106" rx="${r}"/><use xlink:href="#wcm-loader" stroke-dasharray="106 ${317-1.57*r}" stroke-dashoffset="${425-1.8*r}"></use></svg>`}render(){const e={"wcm-error":this.isError,"wcm-stale":this.isStale};return xJe`<div class="${tQe(e)}">${this.svgLoaderTemplate()}<wcm-wallet-image walletId="${d$e(this.walletId)}" imageId="${d$e(this.imageId)}"></wcm-wallet-image></div><wcm-text variant="medium-regular" color="${this.isError?"error":"primary"}">${this.isError?"Connection declined":this.label}</wcm-text>`}};P5e.styles=[K0e.globalCss,O5e],_5e([ZJe()],P5e.prototype,"walletId",2),_5e([ZJe()],P5e.prototype,"imageId",2),_5e([ZJe({type:Boolean})],P5e.prototype,"isError",2),_5e([ZJe({type:Boolean})],P5e.prototype,"isStale",2),_5e([ZJe()],P5e.prototype,"label",2),P5e=_5e([KJe("wcm-connector-waiting")],P5e);const S5e={manualWallets(){var e,t;const{mobileWallets:n,desktopWallets:r}=BNe.state,i=null==(e=S5e.recentWallet())?void 0:e.id,a=NNe.isMobile()?n:r,o=a?.filter((e=>i!==e.id));return null!=(t=NNe.isMobile()?o?.map((({id:e,name:t,links:n})=>({id:e,name:t,mobile:n,links:n}))):o?.map((({id:e,name:t,links:n})=>({id:e,name:t,desktop:n,links:n}))))?t:[]},recentWallet:()=>C1e.getRecentWallet(),recomendedWallets(e=!1){var t;const n=e||null==(t=S5e.recentWallet())?void 0:t.id,{recomendedWallets:r}=rMe.state;return r.filter((e=>n!==e.id))}},k5e={onConnecting(e){C1e.goToConnectingView(e)},manualWalletsTemplate(){return S5e.manualWallets().map((e=>xJe`<wcm-wallet-button walletId="${e.id}" name="${e.name}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`))},recomendedWalletsTemplate(e=!1){return S5e.recomendedWallets(e).map((e=>xJe`<wcm-wallet-button name="${e.name}" walletId="${e.id}" imageId="${e.image_id}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`))},recentWalletTemplate(){const e=S5e.recentWallet();if(e)return xJe`<wcm-wallet-button name="${e.name}" walletId="${e.id}" imageId="${d$e(e.image_id)}" .recent="${!0}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`}},R5e=GZe`.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-desktop-title,.wcm-mobile-title{display:flex;align-items:center}.wcm-mobile-title{justify-content:space-between;margin-bottom:20px;margin-top:-10px}.wcm-desktop-title{margin-bottom:10px;padding:0 10px}.wcm-subtitle{display:flex;align-items:center}.wcm-subtitle:last-child path{fill:var(--wcm-color-fg-3)}.wcm-desktop-title svg,.wcm-mobile-title svg{margin-right:6px}.wcm-desktop-title path,.wcm-mobile-title path{fill:var(--wcm-accent-color)}`;var N5e=Object.defineProperty,M5e=Object.getOwnPropertyDescriptor;let D5e=class extends GJe{render(){const{explorerExcludedWalletIds:e,enableExplorer:t}=BNe.state,n="ALL"!==e&&t,r=k5e.manualWalletsTemplate(),i=k5e.recomendedWalletsTemplate();let a=[k5e.recentWalletTemplate(),...r,...i];a=a.filter(Boolean);const o=a.length>4||n;let s=[];s=o?a.slice(0,3):a;const c=Boolean(s.length);return xJe`<wcm-modal-header .border="${!0}" title="Connect your wallet" .onAction="${C1e.handleUriCopy}" .actionIcon="${c1e.COPY_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-mobile-title"><div class="wcm-subtitle">${c1e.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">Mobile</wcm-text></div><div class="wcm-subtitle">${c1e.SCAN_ICON}<wcm-text variant="small-regular" color="secondary">Scan with your wallet</wcm-text></div></div><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>${c?xJe`<wcm-modal-footer><div class="wcm-desktop-title">${c1e.DESKTOP_ICON}<wcm-text variant="small-regular" color="accent">Desktop</wcm-text></div><div class="wcm-grid">${s} ${o?xJe`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-footer>`:null}`}};D5e.styles=[K0e.globalCss,R5e],D5e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?M5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&N5e(t,n,a),a})([KJe("wcm-desktop-wallet-selection")],D5e);const L5e=GZe`div{background-color:var(--wcm-color-bg-2);padding:10px 20px 15px 20px;border-top:1px solid var(--wcm-color-bg-3);text-align:center}a{color:var(--wcm-accent-color);text-decoration:none;transition:opacity .2s ease-in-out;display:inline}a:active{opacity:.8}@media(hover:hover){a:hover{opacity:.8}}`;var j5e=Object.defineProperty,F5e=Object.getOwnPropertyDescriptor;let B5e=class extends GJe{render(){const{termsOfServiceUrl:e,privacyPolicyUrl:t}=BNe.state;return e??t?xJe`<div><wcm-text variant="small-regular" color="secondary">By connecting your wallet to this app, you agree to the app's ${e?xJe`<a href="${e}" target="_blank" rel="noopener noreferrer">Terms of Service</a>`:null} ${e&&t?"and":null} ${t?xJe`<a href="${t}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`:null}</wcm-text></div>`:null}};B5e.styles=[K0e.globalCss,L5e],B5e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?F5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&j5e(t,n,a),a})([KJe("wcm-legal-notice")],B5e);const U5e=GZe`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var z5e=Object.defineProperty,H5e=Object.getOwnPropertyDescriptor;let W5e=class extends GJe{onQrcode(){RNe.push("Qrcode")}render(){const{explorerExcludedWalletIds:e,enableExplorer:t}=BNe.state,n="ALL"!==e&&t,r=k5e.manualWalletsTemplate(),i=k5e.recomendedWalletsTemplate();let a=[k5e.recentWalletTemplate(),...r,...i];a=a.filter(Boolean);const o=a.length>8||n;let s=[];s=o?a.slice(0,7):a;const c=Boolean(s.length);return xJe`<wcm-modal-header title="Connect your wallet" .onAction="${this.onQrcode}" .actionIcon="${c1e.QRCODE_ICON}"></wcm-modal-header>${c?xJe`<wcm-modal-content><div>${s} ${o?xJe`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-content>`:null}`}};W5e.styles=[K0e.globalCss,U5e],W5e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?H5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&z5e(t,n,a),a})([KJe("wcm-mobile-wallet-selection")],W5e);const V5e=GZe`:host{all:initial}.wcm-overlay{top:0;bottom:0;left:0;right:0;position:fixed;z-index:var(--wcm-z-index);overflow:hidden;display:flex;justify-content:center;align-items:center;opacity:0;pointer-events:none;background-color:var(--wcm-overlay-background-color);backdrop-filter:var(--wcm-overlay-backdrop-filter)}@media(max-height:720px) and (orientation:landscape){.wcm-overlay{overflow:scroll;align-items:flex-start;padding:20px 0}}.wcm-active{pointer-events:auto}.wcm-container{position:relative;max-width:360px;width:100%;outline:0;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) var(--wcm-container-border-radius) var(--wcm-container-border-radius);border:1px solid var(--wcm-color-overlay);overflow:hidden}.wcm-card{width:100%;position:relative;border-radius:var(--wcm-container-border-radius);overflow:hidden;box-shadow:0 6px 14px -6px rgba(10,16,31,.12),0 10px 32px -4px rgba(10,16,31,.1),0 0 0 1px var(--wcm-color-overlay);background-color:var(--wcm-color-bg-1);color:var(--wcm-color-fg-1)}@media(max-width:600px){.wcm-container{max-width:440px;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) 0 0}.wcm-card{border-radius:var(--wcm-container-border-radius) var(--wcm-container-border-radius) 0 0}.wcm-overlay{align-items:flex-end}}@media(max-width:440px){.wcm-container{border:0}}`;var G5e=Object.defineProperty,q5e=Object.getOwnPropertyDescriptor,K5e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?q5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&G5e(t,n,a),a};let X5e=class extends GJe{constructor(){super(),this.open=!1,this.active=!1,this.unsubscribeModal=void 0,this.abortController=void 0,this.unsubscribeModal=aMe.subscribe((e=>{e.open?this.onOpenModalEvent():this.onCloseModalEvent()}))}disconnectedCallback(){var e;null==(e=this.unsubscribeModal)||e.call(this)}get overlayEl(){return C1e.getShadowRootElement(this,".wcm-overlay")}get containerEl(){return C1e.getShadowRootElement(this,".wcm-container")}toggleBodyScroll(e){if(document.querySelector("body"))if(e){const e=document.getElementById("wcm-styles");e?.remove()}else document.head.insertAdjacentHTML("beforeend",'<style id="wcm-styles">html,body{touch-action:none;overflow:hidden;overscroll-behavior:contain;}</style>')}onCloseModal(e){e.target===e.currentTarget&&aMe.close()}onOpenModalEvent(){this.toggleBodyScroll(!1),this.addKeyboardEvents(),this.open=!0,setTimeout((async()=>{const e=C1e.isMobileAnimation()?{y:["50vh","0vh"]}:{scale:[.98,1]};await Promise.all([l$e(this.overlayEl,{opacity:[0,1]},{delay:.1,duration:.2}).finished,l$e(this.containerEl,e,{delay:.1,duration:.2}).finished]),this.active=!0}),0)}async onCloseModalEvent(){this.toggleBodyScroll(!0),this.removeKeyboardEvents();const e=C1e.isMobileAnimation()?{y:["0vh","50vh"]}:{scale:[1,.98]};await Promise.all([l$e(this.overlayEl,{opacity:[1,0]},{duration:.2}).finished,l$e(this.containerEl,e,{duration:.2}).finished]),this.containerEl.removeAttribute("style"),this.active=!1,this.open=!1}addKeyboardEvents(){this.abortController=new AbortController,window.addEventListener("keydown",(e=>{var t;"Escape"===e.key?aMe.close():"Tab"===e.key&&(null!=(t=e.target)&&t.tagName.includes("wcm-")||this.containerEl.focus())}),this.abortController),this.containerEl.focus()}removeKeyboardEvents(){var e;null==(e=this.abortController)||e.abort(),this.abortController=void 0}render(){const e={"wcm-overlay":!0,"wcm-active":this.active};return xJe`<wcm-explorer-context></wcm-explorer-context><wcm-theme-context></wcm-theme-context><div id="wcm-modal" class="${tQe(e)}" @click="${this.onCloseModal}" role="alertdialog" aria-modal="true"><div class="wcm-container" tabindex="0">${this.open?xJe`<wcm-modal-backcard></wcm-modal-backcard><div class="wcm-card"><wcm-modal-router></wcm-modal-router><wcm-modal-toast></wcm-modal-toast></div>`:null}</div></div>`}};X5e.styles=[K0e.globalCss,V5e],K5e([JJe()],X5e.prototype,"open",2),K5e([JJe()],X5e.prototype,"active",2),X5e=K5e([KJe("wcm-modal")],X5e);const Y5e=GZe`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var Z5e=Object.defineProperty,J5e=Object.getOwnPropertyDescriptor,Q5e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?J5e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&Z5e(t,n,a),a};let $5e=class extends GJe{constructor(){super(...arguments),this.isMobile=!1,this.isDesktop=!1,this.isWeb=!1,this.isRetry=!1}onMobile(){NNe.isMobile()?RNe.replace("MobileConnecting"):RNe.replace("MobileQrcodeConnecting")}onDesktop(){RNe.replace("DesktopConnecting")}onWeb(){RNe.replace("WebConnecting")}render(){return xJe`<div>${this.isRetry?xJe`<slot></slot>`:null} ${this.isMobile?xJe`<wcm-button .onClick="${this.onMobile}" .iconLeft="${c1e.MOBILE_ICON}" variant="outline">Mobile</wcm-button>`:null} ${this.isDesktop?xJe`<wcm-button .onClick="${this.onDesktop}" .iconLeft="${c1e.DESKTOP_ICON}" variant="outline">Desktop</wcm-button>`:null} ${this.isWeb?xJe`<wcm-button .onClick="${this.onWeb}" .iconLeft="${c1e.GLOBE_ICON}" variant="outline">Web</wcm-button>`:null}</div>`}};$5e.styles=[K0e.globalCss,Y5e],Q5e([ZJe({type:Boolean})],$5e.prototype,"isMobile",2),Q5e([ZJe({type:Boolean})],$5e.prototype,"isDesktop",2),Q5e([ZJe({type:Boolean})],$5e.prototype,"isWeb",2),Q5e([ZJe({type:Boolean})],$5e.prototype,"isRetry",2),$5e=Q5e([KJe("wcm-platform-selection")],$5e);const e6e=GZe`button{display:flex;flex-direction:column;padding:5px 10px;border-radius:var(--wcm-button-hover-highlight-border-radius);height:100%;justify-content:flex-start}.wcm-icons{width:60px;height:60px;display:flex;flex-wrap:wrap;padding:7px;border-radius:var(--wcm-wallet-icon-border-radius);justify-content:space-between;align-items:center;margin-bottom:5px;background-color:var(--wcm-color-bg-2);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}.wcm-icons img{width:21px;height:21px;object-fit:cover;object-position:center;border-radius:calc(var(--wcm-wallet-icon-border-radius)/ 2);border:1px solid var(--wcm-color-overlay)}.wcm-icons svg{width:21px;height:21px}.wcm-icons img:nth-child(1),.wcm-icons img:nth-child(2),.wcm-icons svg:nth-child(1),.wcm-icons svg:nth-child(2){margin-bottom:4px}wcm-text{width:100%;text-align:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var t6e=Object.defineProperty,n6e=Object.getOwnPropertyDescriptor;let r6e=class extends GJe{onClick(){RNe.push("WalletExplorer")}render(){const{recomendedWallets:e}=rMe.state,t=[...e,...S5e.manualWallets()].reverse().slice(0,4);return xJe`<button @click="${this.onClick}"><div class="wcm-icons">${t.map((e=>{const t=C1e.getWalletIcon(e);if(t)return xJe`<img crossorigin="anonymous" src="${t}">`;const n=C1e.getWalletIcon({id:e.id});return n?xJe`<img crossorigin="anonymous" src="${n}">`:c1e.WALLET_PLACEHOLDER}))} ${[...Array(4-t.length)].map((()=>c1e.WALLET_PLACEHOLDER))}</div><wcm-text variant="xsmall-regular">View All</wcm-text></button>`}};r6e.styles=[K0e.globalCss,e6e],r6e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?n6e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&t6e(t,n,a),a})([KJe("wcm-view-all-wallets-button")],r6e);const i6e=GZe`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var a6e=Object.defineProperty,o6e=Object.getOwnPropertyDescriptor,s6e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?o6e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&a6e(t,n,a),a};let c6e=class extends GJe{constructor(){super(),this.walletId="",this.imageId="",this.uri="",setTimeout((()=>{const{walletConnectUri:e}=jNe.state;this.uri=e}),0)}get overlayEl(){return C1e.getShadowRootElement(this,".wcm-qr-container")}render(){return xJe`<div class="wcm-qr-container">${this.uri?xJe`<wcm-qrcode size="${this.overlayEl.offsetWidth}" uri="${this.uri}" walletId="${d$e(this.walletId)}" imageId="${d$e(this.imageId)}"></wcm-qrcode>`:xJe`<wcm-spinner></wcm-spinner>`}</div>`}};c6e.styles=[K0e.globalCss,i6e],s6e([ZJe()],c6e.prototype,"walletId",2),s6e([ZJe()],c6e.prototype,"imageId",2),s6e([JJe()],c6e.prototype,"uri",2),c6e=s6e([KJe("wcm-walletconnect-qr")],c6e);var u6e=Object.defineProperty,l6e=Object.getOwnPropertyDescriptor;let d6e=class extends GJe{viewTemplate(){return NNe.isAndroid()?xJe`<wcm-android-wallet-selection></wcm-android-wallet-selection>`:NNe.isMobile()?xJe`<wcm-mobile-wallet-selection></wcm-mobile-wallet-selection>`:xJe`<wcm-desktop-wallet-selection></wcm-desktop-wallet-selection>`}render(){return xJe`${this.viewTemplate()}<wcm-legal-notice></wcm-legal-notice>`}};d6e.styles=[K0e.globalCss],d6e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?l6e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&u6e(t,n,a),a})([KJe("wcm-connect-wallet-view")],d6e);const f6e=GZe`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var p6e=Object.defineProperty,h6e=Object.getOwnPropertyDescriptor,m6e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?h6e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&p6e(t,n,a),a};let y6e=class extends GJe{constructor(){super(),this.isError=!1,this.openDesktopApp()}onFormatAndRedirect(e){const{desktop:t,name:n}=NNe.getWalletRouterData(),r=t?.native;if(r){const t=NNe.formatNativeUrl(r,e,n);NNe.openHref(t,"_self")}}openDesktopApp(){const{walletConnectUri:e}=jNe.state,t=NNe.getWalletRouterData();C1e.setRecentWallet(t),e&&this.onFormatAndRedirect(e)}render(){const{name:e,id:t,image_id:n}=NNe.getWalletRouterData(),{isMobile:r,isWeb:i}=C1e.getCachedRouterWalletPlatforms();return xJe`<wcm-modal-header title="${e}" .onAction="${C1e.handleUriCopy}" .actionIcon="${c1e.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${d$e(n)}" label="${`Continue in ${e}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Connection can continue loading if ${e} is not installed on your device`}</wcm-text><wcm-platform-selection .isMobile="${r}" .isWeb="${i}" .isRetry="${!0}"><wcm-button .onClick="${this.openDesktopApp.bind(this)}" .iconRight="${c1e.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};y6e.styles=[K0e.globalCss,f6e],m6e([JJe()],y6e.prototype,"isError",2),y6e=m6e([KJe("wcm-desktop-connecting-view")],y6e);const b6e=GZe`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}wcm-button{margin-top:15px}`;var g6e=Object.defineProperty,v6e=Object.getOwnPropertyDescriptor;let w6e=class extends GJe{onInstall(e){e&&NNe.openHref(e,"_blank")}render(){const{name:e,id:t,image_id:n,homepage:r}=NNe.getWalletRouterData();return xJe`<wcm-modal-header title="${e}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${d$e(n)}" label="Not Detected" .isStale="${!0}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Download ${e} to continue. If multiple browser extensions are installed, disable non ${e} ones and try again`}</wcm-text><wcm-button .onClick="${()=>this.onInstall(r)}" .iconLeft="${c1e.ARROW_DOWN_ICON}">Download</wcm-button></wcm-info-footer>`}};w6e.styles=[K0e.globalCss,b6e],w6e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?v6e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&g6e(t,n,a),a})([KJe("wcm-install-wallet-view")],w6e);const T6e=GZe`wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:96px;height:96px;margin-bottom:20px}wcm-info-footer{display:flex;width:100%}.wcm-app-store{justify-content:space-between}.wcm-app-store wcm-wallet-image{margin-right:10px;margin-bottom:0;width:28px;height:28px;border-radius:var(--wcm-wallet-icon-small-border-radius)}.wcm-app-store div{display:flex;align-items:center}.wcm-app-store wcm-button{margin-right:-10px}.wcm-note{flex-direction:column;align-items:center;padding:5px 0}.wcm-note wcm-text{text-align:center}wcm-platform-selection{margin-top:-15px}.wcm-note wcm-text{margin-top:15px}.wcm-note wcm-text span{color:var(--wcm-accent-color)}`;var E6e=Object.defineProperty,A6e=Object.getOwnPropertyDescriptor,x6e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?A6e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&E6e(t,n,a),a};let O6e=class extends GJe{constructor(){super(),this.isError=!1,this.openMobileApp()}onFormatAndRedirect(e,t=!1){const{mobile:n,name:r}=NNe.getWalletRouterData(),i=n?.native,a=n?.universal;if(i&&!t){const t=NNe.formatNativeUrl(i,e,r);NNe.openHref(t,"_self")}else if(a){const t=NNe.formatUniversalUrl(a,e,r);NNe.openHref(t,"_self")}}openMobileApp(e=!1){const{walletConnectUri:t}=jNe.state,n=NNe.getWalletRouterData();C1e.setRecentWallet(n),t&&this.onFormatAndRedirect(t,e)}onGoToAppStore(e){e&&NNe.openHref(e,"_blank")}render(){const{name:e,id:t,image_id:n,app:r,mobile:i}=NNe.getWalletRouterData(),{isWeb:a}=C1e.getCachedRouterWalletPlatforms(),o=r?.ios,s=i?.universal;return xJe`<wcm-modal-header title="${e}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${d$e(n)}" label="Tap 'Open' to continue…" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer class="wcm-note"><wcm-platform-selection .isWeb="${a}" .isRetry="${!0}"><wcm-button .onClick="${()=>this.openMobileApp(!1)}" .iconRight="${c1e.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection>${s?xJe`<wcm-text color="secondary" variant="small-thin">Still doesn't work? <span tabindex="0" @click="${()=>this.openMobileApp(!0)}">Try this alternate link</span></wcm-text>`:null}</wcm-info-footer><wcm-info-footer class="wcm-app-store"><div><wcm-wallet-image walletId="${t}" imageId="${d$e(n)}"></wcm-wallet-image><wcm-text>${`Get ${e}`}</wcm-text></div><wcm-button .iconRight="${c1e.ARROW_RIGHT_ICON}" .onClick="${()=>this.onGoToAppStore(o)}" variant="ghost">App Store</wcm-button></wcm-info-footer>`}};O6e.styles=[K0e.globalCss,T6e],x6e([JJe()],O6e.prototype,"isError",2),O6e=x6e([KJe("wcm-mobile-connecting-view")],O6e);const C6e=GZe`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var I6e=Object.defineProperty,_6e=Object.getOwnPropertyDescriptor;let P6e=class extends GJe{render(){const{name:e,id:t,image_id:n}=NNe.getWalletRouterData(),{isDesktop:r,isWeb:i}=C1e.getCachedRouterWalletPlatforms();return xJe`<wcm-modal-header title="${e}" .onAction="${C1e.handleUriCopy}" .actionIcon="${c1e.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr walletId="${t}" imageId="${d$e(n)}"></wcm-walletconnect-qr></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Scan this QR Code with your phone's camera or inside ${e} app`}</wcm-text><wcm-platform-selection .isDesktop="${r}" .isWeb="${i}"></wcm-platform-selection></wcm-info-footer>`}};P6e.styles=[K0e.globalCss,C6e],P6e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?_6e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&I6e(t,n,a),a})([KJe("wcm-mobile-qr-connecting-view")],P6e);var S6e=Object.defineProperty,k6e=Object.getOwnPropertyDescriptor;let R6e=class extends GJe{render(){return xJe`<wcm-modal-header title="Scan the code" .onAction="${C1e.handleUriCopy}" .actionIcon="${c1e.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>`}};R6e.styles=[K0e.globalCss],R6e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?k6e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&S6e(t,n,a),a})([KJe("wcm-qrcode-view")],R6e);const N6e=GZe`wcm-modal-content{height:clamp(200px,60vh,600px);display:block;overflow:scroll;scrollbar-width:none;position:relative;margin-top:1px}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between;margin:-15px -10px;padding-top:20px}wcm-modal-content::after,wcm-modal-content::before{content:'';position:fixed;pointer-events:none;z-index:1;width:100%;height:20px;opacity:1}wcm-modal-content::before{box-shadow:0 -1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(var(--wcm-color-bg-1),rgba(255,255,255,0))}wcm-modal-content::after{box-shadow:0 1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(rgba(255,255,255,0),var(--wcm-color-bg-1));top:calc(100% - 20px)}wcm-modal-content::-webkit-scrollbar{display:none}.wcm-placeholder-block{display:flex;justify-content:center;align-items:center;height:100px;overflow:hidden}.wcm-empty,.wcm-loading{display:flex}.wcm-loading .wcm-placeholder-block{height:100%}.wcm-end-reached .wcm-placeholder-block{height:0;opacity:0}.wcm-empty .wcm-placeholder-block{opacity:1;height:100%}wcm-wallet-button{margin:calc((100% - 60px)/ 3) 0}`;var M6e=Object.defineProperty,D6e=Object.getOwnPropertyDescriptor,L6e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?D6e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&M6e(t,n,a),a};let j6e=class extends GJe{constructor(){super(...arguments),this.loading=!rMe.state.wallets.listings.length,this.firstFetch=!rMe.state.wallets.listings.length,this.search="",this.endReached=!1,this.intersectionObserver=void 0,this.searchDebounce=C1e.debounce((e=>{e.length>=1?(this.firstFetch=!0,this.endReached=!1,this.search=e,rMe.resetSearch(),this.fetchWallets()):this.search&&(this.search="",this.endReached=this.isLastPage(),rMe.resetSearch())}))}firstUpdated(){this.createPaginationObserver()}disconnectedCallback(){var e;null==(e=this.intersectionObserver)||e.disconnect()}get placeholderEl(){return C1e.getShadowRootElement(this,".wcm-placeholder-block")}createPaginationObserver(){this.intersectionObserver=new IntersectionObserver((([e])=>{e.isIntersecting&&(!this.search||!this.firstFetch)&&this.fetchWallets()})),this.intersectionObserver.observe(this.placeholderEl)}isLastPage(){const{wallets:e,search:t}=rMe.state,{listings:n,total:r}=this.search?t:e;return r<=40||n.length>=r}async fetchWallets(){var e;const{wallets:t,search:n}=rMe.state,{listings:r,total:i,page:a}=this.search?n:t;if(!this.endReached&&(this.firstFetch||i>40&&r.length<i))try{this.loading=!0;const t=null==(e=jNe.state.chains)?void 0:e.join(","),{listings:n}=await rMe.getWallets({page:this.firstFetch?1:a+1,entries:40,search:this.search,version:2,chains:t}),r=n.map((e=>C1e.getWalletIcon(e)));await Promise.all([...r.map((async e=>C1e.preloadImage(e))),NNe.wait(300)]),this.endReached=this.isLastPage()}catch(e){console.error(e),hMe.openToast(C1e.getErrorMessage(e),"error")}finally{this.loading=!1,this.firstFetch=!1}}onConnect(e){NNe.isAndroid()?C1e.handleMobileLinking(e):C1e.goToConnectingView(e)}onSearchChange(e){const{value:t}=e.target;this.searchDebounce(t)}render(){const{wallets:e,search:t}=rMe.state,{listings:n}=this.search?t:e,r=this.loading&&!n.length,i=this.search.length>=3;let a=k5e.manualWalletsTemplate(),o=k5e.recomendedWalletsTemplate(!0);i&&(a=a.filter((({values:e})=>C1e.caseSafeIncludes(e[0],this.search))),o=o.filter((({values:e})=>C1e.caseSafeIncludes(e[0],this.search))));const s=!this.loading&&!n.length&&!o.length,c={"wcm-loading":r,"wcm-end-reached":this.endReached||!this.loading,"wcm-empty":s};return xJe`<wcm-modal-header><wcm-search-input .onChange="${this.onSearchChange.bind(this)}"></wcm-search-input></wcm-modal-header><wcm-modal-content class="${tQe(c)}"><div class="wcm-grid">${r?null:a} ${r?null:o} ${r?null:n.map((e=>xJe`${e?xJe`<wcm-wallet-button imageId="${e.image_id}" name="${e.name}" walletId="${e.id}" .onClick="${()=>this.onConnect(e)}"></wcm-wallet-button>`:null}`))}</div><div class="wcm-placeholder-block">${s?xJe`<wcm-text variant="big-bold" color="secondary">No results found</wcm-text>`:null} ${!s&&this.loading?xJe`<wcm-spinner></wcm-spinner>`:null}</div></wcm-modal-content>`}};j6e.styles=[K0e.globalCss,N6e],L6e([JJe()],j6e.prototype,"loading",2),L6e([JJe()],j6e.prototype,"firstFetch",2),L6e([JJe()],j6e.prototype,"search",2),L6e([JJe()],j6e.prototype,"endReached",2),j6e=L6e([KJe("wcm-wallet-explorer-view")],j6e);const F6e=GZe`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var B6e=Object.defineProperty,U6e=Object.getOwnPropertyDescriptor,z6e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?U6e(t,n):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&B6e(t,n,a),a};let H6e=class extends GJe{constructor(){super(),this.isError=!1,this.openWebWallet()}onFormatAndRedirect(e){const{desktop:t,name:n}=NNe.getWalletRouterData(),r=t?.universal;if(r){const t=NNe.formatUniversalUrl(r,e,n);NNe.openHref(t,"_blank")}}openWebWallet(){const{walletConnectUri:e}=jNe.state,t=NNe.getWalletRouterData();C1e.setRecentWallet(t),e&&this.onFormatAndRedirect(e)}render(){const{name:e,id:t,image_id:n}=NNe.getWalletRouterData(),{isMobile:r,isDesktop:i}=C1e.getCachedRouterWalletPlatforms(),a=NNe.isMobile();return xJe`<wcm-modal-header title="${e}" .onAction="${C1e.handleUriCopy}" .actionIcon="${c1e.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${d$e(n)}" label="${`Continue in ${e}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`${e} web app has opened in a new tab. Go there, accept the connection, and come back`}</wcm-text><wcm-platform-selection .isMobile="${r}" .isDesktop="${!a&&i}" .isRetry="${!0}"><wcm-button .onClick="${this.openWebWallet.bind(this)}" .iconRight="${c1e.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};H6e.styles=[K0e.globalCss,F6e],z6e([JJe()],H6e.prototype,"isError",2),H6e=z6e([KJe("wcm-web-connecting-view")],H6e);var W6e=Object.freeze({__proto__:null,get WcmModal(){return X5e},get WcmQrCode(){return W1e}});function V6e({theme:e,environment:t}){const{t:n}=_ke(),r=e===WH.DARK?XRe(t,"/quickswapdark.webp"):XRe(t,"/quickswaplight.webp");return Iq(N3,{testId:"quickswap-footer-container",sx:pRe,children:[Iq(N3,{testId:"quickswap-logo",sx:hRe,children:[Cq(tee,{size:"xSmall",sx:{paddingRight:"base.spacing.x1"},children:"By"}),Cq("img",{style:{height:"26px"},alt:"Quickswap logo",src:r})]}),Cq(tee,{testId:"quickswap-footer-disclaimer-text",size:"xSmall",sx:mRe,children:n("footers.quickswapFooter.disclaimerText")})]})}function G6e({visible:e,targetChainId:t,provider:n,checkout:r,onCloseDrawer:i,onNetworkSwitch:a}){const{t:o}=_ke(),s=XRe(r.config.environment??Xt.PRODUCTION,"/switchnetworkethereum.svg"),c=XRe(r.config.environment??Xt.PRODUCTION,"/switchnetworkzkevm.svg"),u=SPe(t),l=t===Jke(r.config),d=uV.useCallback((async()=>{if(!r)return;const e=await r.switchNetwork({provider:n,chainId:t});a&&a(e.provider)}),[r,n,a,t]),f=hNe(n),p=uV.useMemo((()=>f?n.provider?.session?.peer?.metadata?.name:""),[n,f]),h=uV.useMemo((()=>p?.toLowerCase().includes("metamask")),[p]),m=uV.useMemo((()=>pNe(n)?"MetaMask wallet":f&&p?p:"wallet"),[n,f,p]),y=f&&h;return uV.useEffect((()=>{(new Image).src=s;(new Image).src=c}),[]),Cq(wne,{size:"threeQuarter",visible:e,onCloseDrawer:i,showHeaderBar:!1,children:Iq(wne.Content,{sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center"},children:[Cq(K9,{use:Cq("img",{src:l?s:c,alt:o("drawers.networkSwitch.heading",{wallet:m})})}),Cq(d4,{icon:"Close",variant:"tertiary",sx:{pos:"absolute",top:"base.spacing.x5",left:"base.spacing.x5",backdropFilter:"blur(30px)"},onClick:i}),Iq(N3,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:"base.spacing.x4",paddingX:"base.spacing.x6"},children:[Cq(qee,{size:"small",weight:"bold",sx:{textAlign:"center",paddingX:"base.spacing.x6"},children:o("drawers.networkSwitch.heading",{wallet:m})}),y&&Cq(tee,{size:"medium",weight:"regular",sx:{color:"base.color.text.body.secondary",textAlign:"center",paddingX:"base.spacing.x6"},children:o("drawers.networkSwitch.manualSwitch.body",{chain:u})}),!y&&Cq(tee,{size:"medium",weight:"regular",sx:{color:"base.color.text.body.secondary",textAlign:"center",paddingX:"base.spacing.x6"},children:o("drawers.networkSwitch.controlledSwitch.body",{chain:u})})]}),Iq(N3,{sx:{display:"flex",flexDirection:"column",paddingX:"base.spacing.x4",width:"100%"},children:[!y&&Cq(O3,{size:"large",variant:"primary",sx:{width:"100%",marginBottom:"base.spacing.x2"},onClick:d,children:o("drawers.networkSwitch.switchButton",{chain:u})}),Cq(oNe,{})]})]})})}const q6e={exchange:null,walletProviderName:null,network:null,tokenBalances:[],supportedTopUps:null,allowedTokens:[]};var K6e;!function(e){e.SET_EXCHANGE="SET_EXCHANGE",e.SET_WALLET_PROVIDER_NAME="SET_WALLET_PROVIDER_NAME",e.SET_NETWORK="SET_NETWORK",e.SET_SUPPORTED_TOP_UPS="SET_SUPPORTED_TOP_UPS",e.SET_TOKEN_BALANCES="SET_TOKEN_BALANCES",e.SET_ALLOWED_TOKENS="SET_ALLOWED_TOKENS"}(K6e||(K6e={}));const X6e=uV.createContext({swapState:q6e,swapDispatch:()=>{}});X6e.displayName="SwapContext";const Y6e=(e,t)=>{switch(t.payload.type){case K6e.SET_EXCHANGE:return{...e,exchange:t.payload.exchange};case K6e.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case K6e.SET_NETWORK:return{...e,network:t.payload.network};case K6e.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}};case K6e.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case K6e.SET_ALLOWED_TOKENS:return{...e,allowedTokens:t.payload.allowedTokens};default:return e}};var Z6e;!function(e){e.USD="usd"}(Z6e||(Z6e={}));const J6e={cryptoFiat:null,fiatSymbol:Z6e.USD,tokenSymbols:[],conversions:new Map};var Q6e;!function(e){e.SET_CRYPTO_FIAT="SET_CRYPTO_FIAT",e.SET_FIAT_SYMBOL="SET_FIAT_SYMBOL",e.SET_TOKEN_SYMBOLS="SET_TOKEN_SYMBOLS",e.SET_CONVERSIONS="SET_CONVERSIONS"}(Q6e||(Q6e={}));const $6e=uV.createContext({cryptoFiatState:J6e,cryptoFiatDispatch:()=>{}}),e2e=(e,t)=>{switch(t.payload.type){case Q6e.SET_CRYPTO_FIAT:return{...e,cryptoFiat:t.payload.cryptoFiat};case Q6e.SET_FIAT_SYMBOL:return{...e,fiatSymbol:t.payload.fiatSymbol};case Q6e.SET_TOKEN_SYMBOLS:return{...e,tokenSymbols:t.payload.tokenSymbols};case Q6e.SET_CONVERSIONS:return{...e,conversions:t.payload.conversions};default:return e}},t2e={fromAmountIn:async(e,t,n,r,i)=>{const a=await t.getSigner().getAddress();return e.getUnsignedSwapTxFromAmountIn(a,n.address,i.address,jr.from(Yd(r,n.decimals)))},fromAmountOut:async(e,t,n,r,i)=>{const a=await t.getSigner().getAddress();return e.getUnsignedSwapTxFromAmountOut(a,i.address,n.address,jr.from(Yd(r,n.decimals)))}},n2e={display:"flex",flexDirection:"row",justifyContent:"space-between",columnGap:"base.spacing.x1"},r2e={flex:1},i2e={flex:2};function a2e({src:e,name:t,environment:n,theme:r,defaultImage:i,...a}){const[o,s]=uV.useState(!1);return Cq("img",{src:uV.useMemo((()=>!e||o?i||r&&QRe(n,r)||"":e),[e,o]),alt:t,onError:()=>s(!0),...a})}function o2e({onClick:e,icon:t,name:n,symbol:r,balance:i,defaultTokenImage:a,testId:o,id:s}){const{t:c}=_ke();return Iq(oae,{testId:`${o}-coin-selector__option-${s}`,emphasized:!0,size:"small",onClick:e,children:[Cq(oae.FramedImage,{circularFrame:!0,use:Cq(a2e,{src:t,name:n,defaultImage:a})}),Cq(oae.Label,{children:n}),Cq(oae.Caption,{children:r}),i&&Cq(oae.PriceDisplay,{fiatAmount:`${c("drawers.coinSelector.option.fiatPricePrefix")}${i.formattedFiatAmount}`,price:i.formattedAmount})]})}const s2e={display:"flex",flexDirection:"column",gap:"2px",paddingX:"base.spacing.x4",paddingBottom:"base.spacing.x4"},c2e={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"};function u2e({heading:e,options:t,defaultTokenImage:n,optionsLoading:r,children:i,onCloseDrawer:a,visible:o}){const{t:s}=_ke();return Iq(wne,{headerBarTitle:e,size:"full",onCloseDrawer:a,visible:o,children:[Cq(wne.Target,{children:i}),Cq(wne.Content,{children:Iq(N3,{sx:s2e,children:[r&&0===t.length&&Iq(N3,{sx:c2e,children:[Cq(oae,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),Cq(oae,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"}),Cq(oae,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--3"})]}),!r&&0===t.length&&Cq(tee,{sx:{padding:"base.spacing.x4"},children:s("drawers.coinSelector.noCoins")}),!r&&t.map((({onClick:e,icon:t,name:r,symbol:i,balance:a,id:o,testId:s})=>Cq(o2e,{id:o,testId:s,onClick:e,icon:t,name:r,symbol:i,balance:a,defaultTokenImage:n},`${i}-${r}`)))]})})]})}function l2e({testId:e,options:t,optionsLoading:n,subtext:r,onSelectChange:i,textAlign:a,errorMessage:o,disabled:s,selectedOption:c,coinSelectorHeading:u,defaultTokenImage:l,environment:d=Xt.PRODUCTION,theme:f=WH.DARK}){const[p,h]=uV.useState(!1),m=uV.useMemo((()=>t.map((t=>({...t,testId:e,onClick:()=>{i(t.id),h(!1)}})))),[t,i,h]),y=t?.find((e=>e.id===c))??c;return Iq(N3,{children:[Cq(u2e,{heading:u,options:m,defaultTokenImage:l,optionsLoading:n??!1,visible:p,onCloseDrawer:()=>h(!1)}),Cq(dqe,{testId:`${e}-select-control`,textAlign:a??"left",subtext:o?void 0:r,isErrored:!!o,errorMessage:o,children:Cq(bae,{testId:`${e}-select`,size:"large",defaultLabel:"Select token",targetClickOveride:()=>h(!0),selectedOption:(()=>{if(c&&0!==t.length&&t.find((e=>e.id===c)))return c})(),sx:{minw:"170px"},children:y&&Iq(bae.Option,{optionKey:y.id,testId:y.testId,disabled:s,children:[!y.icon&&Cq(bae.Option.Icon,{icon:"Coins",variant:"bold"}),y.icon&&Cq(bae.Option.FramedImage,{use:Cq(a2e,{environment:d,theme:f,src:y.icon,name:y.name}),circularFrame:!0,sx:{background:"base.color.translucent.standard.100"}}),Cq(bae.Option.Label,{children:y.symbol})]},y.id)})})]})}function d2e({testId:e,value:t,placeholder:n,errorMessage:r,validator:i,onTextInputChange:a,onTextInputBlur:o,onTextInputFocus:s,onTextInputEnter:c,textAlign:u,type:l,subtext:d,maxButtonClick:f,disabled:p,inputMode:h}){return Cq(dqe,{testId:`${e}-text-control`,textAlign:u??"left",subtext:r?void 0:d,isErrored:!!r,errorMessage:r,sx:{width:"100%"},children:Cq(Hoe,{testId:`${e}-text`,onChange:e=>((e,t)=>{let n=e.target.value;"number"===l&&"."===n&&(n="0."),i(n)?a(n):a(t??"")})(e,t),sizeVariant:"large",value:t,inputMode:h,validationStatus:r?"error":"success",placeholder:n,onBlur:e=>{if(!o)return;const t=e.target.value;i(t)&&o(t)},onFocus:e=>{if(!s)return;const t=e.target.value;i(t)&&s(t)},onKeyDown:e=>{c&&"Enter"===e.key&&c()},disabled:p,hideClearValueButton:!0,sx:{minWidth:"100%"},children:f&&Cq(Hoe.Button,{testId:`${e}-max-button`,onClick:f,disabled:p,children:"max"})})})}function f2e({testId:e,options:t,textInputValue:n,textInputPlaceholder:r,textInputValidator:i,textInputType:a,onTextInputChange:o,onTextInputBlur:s,onTextInputFocus:c,textInputTextAlign:u,textInputSubtext:l,textInputErrorMessage:d,testInputMode:f,selectTextAlign:p,selectSubtext:h,selectErrorMessage:m,textInputMaxButtonClick:y,onSelectChange:b,textInputDisabled:g,selectInputDisabled:v,selectedOption:w,coinSelectorHeading:T,defaultTokenImage:E,environment:A,theme:x}){return Iq(N3,{sx:n2e,children:[Cq(N3,{sx:r2e,children:Cq(l2e,{testId:`${e}-select-form`,options:t,subtext:h,textAlign:p,errorMessage:m,onSelectChange:b,disabled:v,selectedOption:w,coinSelectorHeading:T,defaultTokenImage:E,environment:A,theme:x})}),Cq(N3,{sx:i2e,children:Cq(d2e,{type:a,testId:`${e}-text-form`,value:n,placeholder:r,subtext:l,textAlign:u,errorMessage:d,validator:i,onTextInputChange:o,onTextInputBlur:s,onTextInputFocus:c,maxButtonClick:y,disabled:g,inputMode:f})})]})}const p2e={display:"flex",flexDirection:"column",height:"100%",padding:"16px 16px 0 16px"},h2e={display:"flex",flexDirection:"column",gap:"10px",height:"100%"},m2e={display:"flex",width:"100%"},y2e=e=>({width:"65%",color:e?"base.color.text.body.primary":"base.color.text.body.secondary"}),b2e={width:"35%"},g2e={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"};function v2e({boldLabel:e,label:t,amount:n,fiatAmount:r,tokenSymbol:i,prefix:a=""}){const o=t.toLowerCase().replace(" ","-");return Iq(N3,{sx:m2e,testId:`fee-item-${o}`,children:[Cq(tee,{sx:y2e(e),children:t}),Cq(Uee,{testId:o,sx:b2e,price:`${a}${i} ${n}`,fiatAmount:r})]})}function w2e({fees:e,children:t,visible:n,onCloseDrawer:r,totalFiatAmount:i,totalAmount:a,tokenSymbol:o,loading:s=!1}){const{t:c}=_ke();return Iq(wne,{headerBarTitle:c("drawers.feesBreakdown.heading"),size:"threeQuarter",onCloseDrawer:r,visible:n,children:[Cq(wne.Target,{children:t}),Iq(wne.Content,{testId:"fees-breakdown-content",sx:p2e,children:[Iq(N3,{sx:h2e,children:[s&&Iq(N3,{sx:g2e,children:[Cq(oae,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),Cq(oae,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"})]}),!s&&e.map((({label:e,amount:t,fiatAmount:n,prefix:r,token:i})=>Cq(v2e,{label:e,amount:t,fiatAmount:n,tokenSymbol:i.symbol??o,prefix:r},e))),a&&Iq(Oq,{children:[Cq(X3,{size:"xSmall"}),Cq(v2e,{label:c("drawers.feesBreakdown.total"),amount:VRe(a),fiatAmount:i?`≈ ${c("drawers.feesBreakdown.fees.fiatPricePrefix")}${i}`:HRe("0"),tokenSymbol:o,boldLabel:!0},c("drawers.feesBreakdown.total"))]})]}),Cq(oNe,{})]})]})}const T2e={backgroundColor:"base.color.translucent.emphasis.100"},E2e={marginBottom:"base.spacing.x4",color:"base.color.text.body.secondary"};function A2e({gasFeeValue:e,gasFeeToken:t,gasFeeFiatValue:n,fees:r,onFeesClick:i,loading:a,sx:o}){const[s,c]=uV.useState(!1),{t:u}=_ke();if(!e&&!a)return null;const l=HRe(VRe(e)),d=t?.symbol;return Iq(Oq,{children:[Iq(M4,{targetClickOveride:()=>{c(!0),i?.()},sx:{...T2e,paddingBottom:"base.spacing.x2",...o},children:[Cq(M4.TargetLeftSlot,{children:Cq(tee,{size:"medium",sx:E2e,children:u("drawers.feesBreakdown.heading")})}),Iq(M4.TargetRightSlot,{children:[a&&Cq(N3,{sx:{width:"218px",position:"relative"},children:Cq(N3,{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:Cq("span",{}),children:Cq(z7,{rc:Cq("span",{})})})}),!a&&Cq(Uee,{testId:"fees-gas-fee__priceDisplay",fiatAmount:`≈ ${u("drawers.feesBreakdown.fees.fiatPricePrefix")}${n}`,price:`~ ${d} ${HRe(VRe(l))}`})]})]}),Cq(w2e,{tokenSymbol:d??"",fees:r,visible:s,loading:a,onCloseDrawer:()=>c(!1)})]})}var x2e;!function(e){e.SWAP="SWAP",e.IN_PROGRESS="IN_PROGRESS",e.SUCCESS="SUCCESS",e.FAIL="FAIL",e.PRICE_SURGE="PRICE_SURGE",e.APPROVE_ERC20="APPROVE_ERC20_SWAP"}(x2e||(x2e={}));const O2e={display:"flex",flexDirection:"column",paddingY:"base.spacing.x6",paddingX:"base.spacing.x4"},C2e={width:"base.icon.size.400"},I2e={display:"flex",flexDirection:"column",alignItems:"center",paddingY:"50px",paddingX:"base.spacing.x4",height:"100%"},_2e={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"15px"},P2e={display:"flex",flexDirection:"column",justifyContent:"flex-end",gap:"8px",height:"100%",width:"100%"},S2e={width:"100%",height:"64px"};function k2e({onCloseDrawer:e,visible:t,showHeaderBar:n,onRetry:r}){const{t:i}=_ke();return Cq(wne,{headerBarTitle:void 0,size:"full",onCloseDrawer:e,visible:t,showHeaderBar:n,children:Cq(wne.Content,{children:Iq(N3,{sx:I2e,children:[Cq(ase,{icon:"Information",colorVariant:"guidance",iconVariant:"bold"}),Iq(qee,{size:"small",sx:_2e,testId:"transaction-rejected-heading",children:[i("drawers.transactionFailed.content.heading1"),Cq("br",{}),i("drawers.transactionFailed.content.heading2")]}),Iq(tee,{sx:_2e,children:[i("drawers.transactionFailed.content.body1"),Cq("br",{}),i("drawers.transactionFailed.content.body2")]}),Iq(N3,{sx:P2e,children:[Cq(O3,{sx:S2e,variant:"tertiary",onClick:r,children:i("drawers.transactionFailed.buttons.retry")}),Cq(O3,{sx:S2e,variant:"tertiary",onClick:e,testId:"transaction-rejected-cancel-button",children:i("drawers.transactionFailed.buttons.cancel")})]})]})})})}function R2e({loading:e,updateLoading:t,validator:n,transaction:r,data:i,insufficientFundsForGas:a,openNotEnoughImxDrawer:o,openNetworkSwitchDrawer:s}){const{t:c}=_ke(),[u,l]=uV.useState(!1),{viewDispatch:d}=uV.useContext(ERe),{connectLoaderState:f}=uV.useContext(jRe),{checkout:p,provider:h}=f,{track:m}=OPe(),y=async()=>{const e=n();if(m({userJourney:bPe.SWAP,screen:"SwapCoins",control:"Swap",controlType:"Button",extras:{swapFromAddress:i?.fromTokenAddress,swapFromAmount:i?.fromAmount,swapFromTokenSymbol:i?.fromTokenSymbol,swapToAddress:i?.toTokenAddress,swapToAmount:i?.toAmount,swapToTokenSymbol:i?.toTokenSymbol,isSwapFormValid:e,hasFundsForGas:!a}}),e&&p&&h&&r)if(a)o();else{try{const e=await h.provider.request({method:"eth_chainId",params:[]});if(parseInt(e.toString())!==Qke(p.config))return void s()}catch(e){console.error("Current network check failed",e)}if(r)try{t(!0);const e={fromAmount:i?.fromAmount||"",fromTokenAddress:i?.fromTokenAddress||"",toTokenAddress:i?.toTokenAddress||"",toAmount:i?.toAmount||""};if(r.approval)return void d({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.APPROVE_ERC20,data:{approveTransaction:r.approval.transaction,transaction:r.swap.transaction,info:r.quote,swapFormInfo:e}}}});const n=await p.sendTransaction({provider:h,transaction:{...r.swap.transaction,gasPrice:fNe(h)?jr.from(0):void 0}});d({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.IN_PROGRESS,data:{transactionResponse:n.transactionResponse,swapForm:e}}}})}catch(e){if(console.error(e),t(!1),e.type===uW.USER_REJECTED_REQUEST_ERROR)return void l(!0);if(e.type===uW.UNPREDICTABLE_GAS_LIMIT)return void d({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.PRICE_SURGE,data:i}}});if(e.type===uW.TRANSACTION_FAILED||e.type===uW.INSUFFICIENT_FUNDS||e.receipt&&0===e.receipt.status)return void d({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.FAIL,reason:"Transaction failed",data:i}}});d({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.ERROR_VIEW,error:e}}})}}};return Iq(N3,{sx:O2e,children:[Cq(O3,{testId:"swap-button",disabled:e,variant:"primary",onClick:y,size:"large",children:e?Cq(O3.Icon,{icon:"Loading",sx:C2e}):c("views.SWAP.swapForm.buttonText")}),Cq(k2e,{visible:u,showHeaderBar:!1,onCloseDrawer:()=>l(!1),onRetry:()=>{y(),l(!1)}})]})}function N2e(e,t){const n=uV.useRef(e),r=uV.useRef(0);return k9((()=>{n.current=e}),[e]),uV.useEffect((()=>{if(t||0===t)return r.current=setInterval((()=>n.current()),t),()=>{clearInterval(r.current)}}),[t]),()=>{r.current&&clearInterval(r.current)}}const M2e={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x1",height:"100%"},D2e={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"base.spacing.x4"},L2e={display:"flex",flexDirection:"column",justifyContent:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},j2e={width:"100%",height:"base.spacing.x16"},F2e={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"base.spacing.x6"};function B2e({environment:e,visible:t,showAdjustAmount:n,hasZeroImx:r,onCloseDrawer:i,onAddCoinsClick:a}){const{t:o}=_ke(),s=function(e){return XRe(e,"/tokens/imx.svg")}(e);return Cq(wne,{size:"full",onCloseDrawer:i,visible:t,showHeaderBar:!1,children:Cq(wne.Content,{children:Iq(N3,{testId:"not-enough-gas-bottom-sheet",sx:M2e,children:[Cq(K9,{sx:{w:"base.icon.size.600",h:"base.icon.size.600"},use:Cq("img",{src:s,alt:o(`drawers.notEnoughImx.content.${r?"noImx":"insufficientImx"}.heading`)})}),Cq(qee,{size:"small",sx:D2e,testId:"not-enough-gas-heading",children:o(`drawers.notEnoughImx.content.${r?"noImx":"insufficientImx"}.heading`)}),Cq(tee,{sx:D2e,children:o(`drawers.notEnoughImx.content.${r?"noImx":"insufficientImx"}.body`)}),Iq(N3,{sx:L2e,children:[n&&Cq(O3,{testId:"not-enough-gas-adjust-amount-button",sx:j2e,variant:"tertiary",onClick:i,children:o("drawers.notEnoughImx.buttons.adjustAmount")}),Cq(O3,{testId:"not-enough-gas-add-imx-button",sx:j2e,variant:"tertiary",onClick:a,children:o("drawers.notEnoughImx.buttons.addMoreImx")}),Cq(O3,{sx:j2e,variant:"tertiary",onClick:i,testId:"not-enough-gas-cancel-button",children:o("drawers.notEnoughImx.buttons.cancel")})]}),Cq(N3,{sx:F2e,children:Cq(O8,{testId:"footer-logo-image",logo:"ImmutableHorizontalLockup",sx:{width:"base.spacing.x25"}})})]})})})}const U2e={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x4",paddingX:"base.spacing.x4",height:"100%"},z2e={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"base.spacing.x4"},H2e={display:"flex",flexDirection:"column",justifyContent:"flex-end",alignItems:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},W2e={width:"100%",height:"base.spacing.x16",marginBottom:"base.spacing.x16"},V2e={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"base.spacing.x6"},G2e={width:"base.icon.size.600",fill:"base.color.status.fatal.bright"};function q2e({visible:e,onCloseDrawer:t}){const{t:n}=_ke();return Cq(wne,{size:"full",onCloseDrawer:t,visible:e,showHeaderBar:!1,children:Cq(wne.Content,{children:Iq(N3,{testId:"unable-to-swap-bottom-sheet",sx:U2e,children:[Cq(S6,{icon:"Alert",testId:"unable-to-swap-icon",variant:"bold",sx:G2e}),Cq(qee,{size:"small",sx:z2e,testId:"unable-to-swap-heading",children:n("drawers.unableToSwap.heading")}),Cq(tee,{sx:z2e,children:n("drawers.unableToSwap.body")}),Cq(N3,{sx:H2e,children:Cq(O3,{sx:W2e,variant:"tertiary",onClick:t,testId:"unable-to-swap-cancel-button",children:n("drawers.unableToSwap.buttons.cancel")})}),Cq(N3,{sx:V2e,children:Cq(O8,{testId:"footer-logo-image",logo:"ImmutableHorizontalLockup",sx:{width:"base.spacing.x25"}})})]})})})}const K2e=(e,t=500)=>{const[n,r]=uV.useState(e);return uV.useEffect((()=>{const n=setTimeout((()=>{r(e)}),t);return()=>{clearTimeout(n)}}),[e,t]),n};class X2e{static id=0;promiseId=0;promise;isCancelled=!1;onCancel=null;rejectPromise=()=>{};constructor(e){X2e.id+=1,this.promiseId=X2e.id,this.promise=new Promise(((t,n)=>{this.rejectPromise=n,e((e=>{this.isCancelled?n({cancelled:!0}):t(e)}),(e=>{this.isCancelled?n({cancelled:!0}):n(e)}))}))}static all(e){return new X2e(((t,n)=>{Promise.all(e.map((e=>e instanceof X2e?e.promise:e))).then(t,n)}))}then(e,t){return new X2e(((n,r)=>{this.promise.then((t=>n(e?e(t):t)),(e=>t?n(t(e)):r(e)))}))}catch(e){return this.then(void 0,e)}finally(e){return new X2e(((t,n)=>{this.promise.then(t,n).finally((()=>{e&&e()}))}))}cancel(){this.isCancelled||(this.isCancelled=!0,this.onCancel&&this.onCancel(),this.rejectPromise({cancelled:!0}))}onCancelled(e){this.onCancel=e}get cancelled(){return this.isCancelled}}const Y2e=(e,t,n)=>{const r=[];if(!e.swap)return r;const i=(e,i,a="≈ ")=>{const o=jr.from(e?.value??0);if(e&&o.gt(0)){const s=Xd(o,e.token.decimals);r.push({label:i,fiatAmount:`≈ ${n("drawers.feesBreakdown.fees.fiatPricePrefix")}${zRe(s,e.token.symbol||"",t.conversions)}`,amount:`${VRe(s)}`,prefix:a,token:e.token})}};return e.swap&&e.swap.gasFeeEstimate&&i(e.swap.gasFeeEstimate,n("drawers.feesBreakdown.fees.swapGasFee.label")),e.approval&&e.approval.gasFeeEstimate&&i(e.approval.gasFeeEstimate,n("drawers.feesBreakdown.fees.approvalFee.label")),e.quote?.fees?.forEach((e=>{i(e.amount,n("drawers.feesBreakdown.fees.swapSecondaryFee.label",{amount:e.basisPoints/100+"%"}),"")})),r},Z2e=(e,t)=>{if(!bNe(e))return t;const n={...t};return n.swap?.gasFeeEstimate&&(n.swap.gasFeeEstimate.value=jr.from(0)),n.approval?.gasFeeEstimate&&(n.approval.gasFeeEstimate.value=jr.from(0)),n},J2e=(e,t)=>{if(!t.quote.fees)return t;const n=t.quote.fees.map((t=>t.amount.token.symbol?t:{...t,amount:{...t.amount,token:{...t.amount.token,symbol:e.address===t.amount.token.address?e.symbol:t.amount.token.symbol}}}));return{...t,quote:{...t.quote,fees:n}}},Q2e=(e,t)=>{if(!t.quote.amount&&!t.quote.amountWithMaxSlippage)return t;const n={...t.quote.amount,token:{...t.quote.amount.token,symbol:e.address===t.quote.amount.token.address?e.symbol:t.quote.amount.token.symbol}},r={...t.quote.amountWithMaxSlippage,token:{...t.quote.amountWithMaxSlippage.token,symbol:e.address===t.quote.amountWithMaxSlippage.token.address?e.symbol:t.quote.amountWithMaxSlippage.token.symbol}};return{...t,quote:{...t.quote,amount:n,amountWithMaxSlippage:r}}},$2e=(e,t,n,r,i)=>{const a=n.quote.fees[0],o=t,s=n.quote.amount.token,c=Yd(parseFloat(e).toString(),o.decimals),u=jr.from(n.quote.amount.value),l=o.decimals,d=n.quote.amount.token.decimals,f=Math.max(l,d),p=jr.from("10").pow(f-l),h=jr.from("10").pow(f-d),m=c.mul(p),y=u.mul(h),b=y.div(m),g=y.mod(m),v=jr.from("10").pow(f),w=g.mul(v).div(m),T=b.mul(v).add(w),E=HRe(VRe(Xd(T,f)),!0);return i(r,{fromSymbol:o.symbol,toSymbol:s.symbol,rate:E,fee:(a?.basisPoints??0)/100})};var e8e;!function(e){e.FROM="FROM",e.TO="TO"}(e8e||(e8e={}));const t8e=(e,t)=>void 0!==e&&(""!==e&&t!==e);let n8e;function r8e({data:e,theme:t}){const{t:n}=_ke(),{swapState:{allowedTokens:r,exchange:i,tokenBalances:a,network:o}}=uV.useContext(X6e),{connectLoaderState:s}=uV.useContext(jRe),{checkout:c,provider:u}=s,l=QRe(c?.config.environment,t),d=uV.useCallback(((e,t)=>KRe(t)?Nke:`${e.toLowerCase()}-${t.toLowerCase()}`),[]),{cryptoFiatState:f,cryptoFiatDispatch:p}=uV.useContext($6e),{viewDispatch:h}=uV.useContext(ERe),[m,y]=uV.useState(e8e.FROM),[b,g]=uV.useState(!1),{track:v}=OPe(),[w,T]=uV.useState(e?.fromAmount||""),[E,A]=uV.useState(""),x=K2e(w,Lke),[O,C]=uV.useState(),[I,_]=uV.useState(""),[P,S]=uV.useState(""),[k,R]=uV.useState(0),[N,M]=uV.useState(e?.toAmount||""),[D,L]=uV.useState(""),j=K2e(N,Lke),[F,B]=uV.useState(),[U,z]=uV.useState(""),[H,W]=uV.useState(""),[V,G]=uV.useState(null),[q,K]=uV.useState(""),[X,Y]=uV.useState(void 0),[Z,J]=uV.useState(""),[Q,$]=uV.useState([]),ee=uV.useMemo((()=>V?Y2e(V,f,n):[]),[V,f,n]),[te,ne]=uV.useState(null),[re,ie]=uV.useState(""),ae=uV.useMemo((()=>V&&re&&te?$2e(re,te,V,"views.SWAP.swapForm.conversionRate",n):""),[re,te,V,n]),[oe,se]=uV.useState(!1),[ce,ue]=uV.useState(!1),[le,de]=uV.useState(!1);uV.useEffect((()=>{if(0===a.length)return;if(!o)return;const t=a.filter((e=>e.balance.gt(0))).map((e=>({id:d(e.token.symbol,e.token.address),name:e.token.name,symbol:e.token.symbol,icon:e.token.icon,balance:{formattedAmount:VRe(e.formattedBalance),formattedFiatAmount:0===f.conversions.size?HRe(""):zRe(e.formattedBalance,e.token.symbol||"",f.conversions)}})));$(t),e?.fromTokenAddress&&!O&&(C(r.find((t=>KRe(t.address)&&e?.fromTokenAddress?.toLowerCase()===Nke||t.address?.toLowerCase()===e?.fromTokenAddress?.toLowerCase()))),_(a.find((t=>KRe(t.token.address)&&e?.fromTokenAddress?.toLowerCase()===Nke||t.token.address?.toLowerCase()===e?.fromTokenAddress?.toLowerCase()))?.formattedBalance??"")),t8e(e?.toTokenAddress,e?.fromTokenAddress)&&!F&&B(r.find((t=>KRe(t.address)&&e?.toTokenAddress?.toLowerCase()===Nke||t.address?.toLowerCase()===e?.toTokenAddress?.toLowerCase())))}),[a,r,f.conversions,e?.fromTokenAddress,e?.toTokenAddress,C,_,B,$,d,HRe,o]);const fe=uV.useMemo((()=>r.map((e=>({id:d(e.symbol,e.address),name:e.name,symbol:e.symbol,icon:e.icon})))),[r,O]);uV.useEffect((()=>{p({payload:{type:Q6e.SET_TOKEN_SYMBOLS,tokenSymbols:r.map((e=>e.symbol))}})}),[p,r]);const pe=()=>{A(""),S(""),L(""),z("")},he=()=>{n8e&&n8e.cancel(),ie(""),ne(null),J(""),G(null)},me=(e,t)=>!Number.isNaN(parseFloat(e))&&(!(parseFloat(e)<=0)&&(!!O&&(!!F&&(!t||!b)))),ye=async(e=!1)=>{me(w,e)&&(n8e&&n8e.cancel(),e||g(!0),await(async(e=!1)=>{if(u&&i&&O&&F){try{const e=t2e.fromAmountIn(i,u,O,w,F),t=X2e.all([e]);n8e=t;const n=await t;let a=Z2e(u,n[0]);a=J2e(O,a),a=Q2e(F,a);const o=a.swap.gasFeeEstimate;let s=jr.from(o?.value||0);a.approval?.gasFeeEstimate&&(s=s.add(a.approval.gasFeeEstimate.value));const c=Xd(s,Mke),l=o?.token,d=r.find((e=>e.address?.toLocaleLowerCase()===l?.address?.toLocaleLowerCase()));ne(O),ie(w),G(a),K(c),Y({name:d?.name||"",symbol:d?.symbol||"",decimals:d?.decimals||0,address:d?.address,icon:d?.icon}),J(zRe(c,d?.symbol||"",f.conversions)),M(HRe(VRe(Xd(a.quote.amount.value,a.quote.amount.token.decimals),a.quote.amount.token.decimals))),pe()}catch(e){e.cancelled||(console.error("Error fetching quote.",e),he(),se(!1),ue(!0))}e||g(!1)}})(e))},be=(e,t)=>!Number.isNaN(parseFloat(e))&&(!(parseFloat(e)<=0)&&(!!O&&(!!F&&(!t||!b)))),ge=async(e=!1)=>{be(N,e)&&(n8e&&n8e.cancel(),e||g(!0),await(async(e=!1)=>{if(u&&i&&O&&F){try{const e=t2e.fromAmountOut(i,u,F,N,O),t=X2e.all([e]);n8e=t;const n=await t;let a=Z2e(u,n[0]);a=J2e(O,a);const o=a.swap.gasFeeEstimate;let s=jr.from(o?.value||0);a.approval?.gasFeeEstimate&&(s=s.add(a.approval.gasFeeEstimate.value));const c=Xd(s,Mke),l=o?.token,d=r.find((e=>e.symbol===l?.symbol));ne(F),ie(N),G(a),K(c),Y({name:d?.name||"",symbol:d?.symbol||"",decimals:d?.decimals||0,address:d?.address,icon:d?.icon}),J(zRe(c,d?.symbol||"",f.conversions)),T(HRe(VRe(Xd(a.quote.amount.value,a.quote.amount.token.decimals)))),pe()}catch(e){e.cancelled||(he(),se(!1),ue(!0))}e||g(!1)}})(e))},ve=async(e=!1)=>{m===e8e.FROM?await ye(e):await ge(e)};N2e((()=>ve(!0)),Vke),uV.useEffect((()=>{if(m===e8e.FROM){if(x<=0)return g(!1),void he();(async()=>{await ve()})()}}),[x,O,F,k]),uV.useEffect((()=>{if(m===e8e.TO){if(j<=0)return g(!1),void he();(async()=>{await ve()})()}}),[j,F,O]);const we=uV.useMemo((()=>{if(!u)return!0;if(fNe(u))return!1;const e=a.find((e=>e.token.address?.toLowerCase()===Nke));if(!e)return!0;const t=O?.address?.toLowerCase()===Nke,n=Yd(0!==q.length?q:"0",18);const r=t&&!Number.isNaN(parseFloat(w))?Yd(w,O?.decimals||18):jr.from("0");return n.add(r).gt(e.balance)}),[q,a,O,w,u]);uV.useEffect((()=>{w&&O&&W(zRe(w,O.symbol,f.conversions))}),[w,O,f.conversions]);const Te=uV.useCallback((e=>{const t=a.find((t=>e===d(t.token.symbol,t.token.address)));t&&(F&&e===d(F.symbol,F?.address)&&B(void 0),C(t.token),_(t.formattedBalance),S(""))}),[F]),Ee=uV.useCallback((e=>{const t=r.find((t=>e===d(t.symbol,t.address)));t&&(O&&e===d(O.symbol,O?.address)&&C(void 0),B(t),z(""))}),[O]);return Iq(Oq,{children:[Iq(N3,{sx:{paddingX:"base.spacing.x4",marginBottom:"base.spacing.x2"},children:[Cq(qee,{size:"small",weight:"regular",sx:{paddingBottom:"base.spacing.x4"},children:n("views.SWAP.content.title")}),Iq(N3,{sx:{display:"flex",flexDirection:"column",rowGap:"base.spacing.x6",paddingBottom:"base.spacing.x2"},children:[Iq(N3,{children:[Cq(qee,{size:"xSmall",sx:{display:"flex",justifyContent:"space-between",paddingBottom:"base.spacing.x1"},children:n("views.SWAP.swapForm.from.label")}),Cq(f2e,{testId:"fromTokenInputs",options:Q,selectSubtext:O?`${n("views.SWAP.content.availableBalancePrefix")} ${VRe(I)}`:"",selectTextAlign:"left",textInputType:"number",testInputMode:"decimal",textInputValue:w,textInputPlaceholder:n("views.SWAP.swapForm.from.inputPlaceholder"),textInputSubtext:`${n("views.SWAP.content.fiatPricePrefix")} \n $${HRe(H,!0)}`,textInputTextAlign:"right",textInputValidator:Yqe,onTextInputChange:e=>{var t;(t=e)!==w&&(pe(),he(),M(""),me(t,!1)&&g(!0),T(t))},onTextInputFocus:()=>{y(e8e.FROM)},textInputMaxButtonClick:()=>{if(!I)return;const e=I.slice(0,I.indexOf(".")+Dke+1);pe(),he(),y(e8e.FROM),M(""),me(e,!1)&&g(!0),w===e?R(k+1):T(e),v({userJourney:bPe.SWAP,screen:"SwapCoins",control:"MaxFrom",controlType:"Button",extras:{fromBalance:I,fromBalanceTruncated:e}})},onSelectChange:Te,textInputErrorMessage:n(E),selectErrorMessage:n(P),selectedOption:O?d(O.symbol,O.address):void 0,coinSelectorHeading:n("views.SWAP.swapForm.from.selectorTitle"),defaultTokenImage:l,environment:c?.config.environment,theme:t})]}),Iq(N3,{children:[Iq(N3,{sx:{display:"flex",justifyContent:"space-between",paddingBottom:"base.spacing.x1"},children:[Cq(qee,{size:"xSmall",children:n("views.SWAP.swapForm.to.label")}),ae?.length>0&&Iq(ace,{children:[Cq(ace.Target,{children:Cq(S6,{icon:"InformationCircle",sx:{w:"base.icon.size.300"}})}),Cq(ace.Content,{children:ae})]})]}),Cq(f2e,{testId:"toTokenInputs",options:fe,selectTextAlign:"left",textInputType:"number",testInputMode:"decimal",textInputValue:N,textInputPlaceholder:n("views.SWAP.swapForm.to.inputPlaceholder"),textInputTextAlign:"right",textInputValidator:Yqe,onTextInputChange:e=>{var t;(t=e)!==N&&(pe(),he(),W(""),T(""),be(t,!1)&&g(!0),M(t))},onTextInputFocus:()=>{y(e8e.TO)},onSelectChange:Ee,textInputErrorMessage:n(D),selectErrorMessage:n(U),selectedOption:F?d(F.symbol,F.address):void 0,coinSelectorHeading:n("views.SWAP.swapForm.to.selectorTitle"),defaultTokenImage:l,environment:c?.config.environment,theme:t})]})]}),!fNe(u)&&Cq(A2e,{gasFeeFiatValue:Z,gasFeeToken:X,gasFeeValue:q,fees:ee,onFeesClick:()=>{v({userJourney:bPe.SWAP,screen:"SwapCoins",control:"ViewFees",controlType:"Button"})},sx:{paddingBottom:"0"},loading:b})]}),Cq(R2e,{validator:()=>{const e=function(e){return e?"":"views.SWAP.validation.noFromTokenSelected"}(O),t=function(e,t){return e&&0!==parseFloat(e)?t&&Number(e)>Number(t)?"views.SWAP.validation.insufficientBalance":"":"views.SWAP.validation.noAmountInputted"}(w,I),n=function(e){return e?"":"views.SWAP.validation.noToTokenSelected"}(F),r=(i=N)&&0!==parseFloat(i)?"":"views.SWAP.validation.noAmountInputted";var i;m===e8e.FROM?(L(""),t&&A(t)):m===e8e.TO&&(A(""),r&&L(r)),e&&S(e),n&&z(n);let a=!0;return(e||n||t&&m===e8e.FROM||r&&m===e8e.TO)&&(a=!1),v({userJourney:bPe.SWAP,screen:"SwapCoins",control:"FormValid",controlType:"Button",extras:{isSwapFormValid:a,swapFromAddress:O?.address,swapFromAmount:w,swapFromTokenSymbol:O?.symbol,swapToAddress:F?.address,swapToAmount:N,swapToTokenSymbol:F?.symbol}}),a},updateLoading:e=>{g(e)},loading:b,transaction:V,data:{fromAmount:w,toAmount:N,fromTokenSymbol:O?.symbol,fromTokenAddress:O?.address,toTokenSymbol:F?.symbol,toTokenAddress:F?.address},insufficientFundsForGas:we,openNotEnoughImxDrawer:()=>{ue(!1),se(!0)},openNetworkSwitchDrawer:()=>de(!0)}),Cq(B2e,{environment:c?.config.environment??Xt.PRODUCTION,visible:oe,showAdjustAmount:O?.address===Nke,hasZeroImx:!1,onAddCoinsClick:()=>{h({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.TOP_UP_VIEW},currentViewData:{fromTokenAddress:O?.address??"",fromAmount:w,toTokenAddress:F?.address??""}}})},onCloseDrawer:()=>se(!1)}),Cq(q2e,{visible:ce,onCloseDrawer:()=>{ue(!1),C(void 0),T(""),B(void 0),M("")}}),Cq(G6e,{visible:le,targetChainId:Qke(c?.config),provider:u,checkout:c,onCloseDrawer:()=>de(!1)})]})}const i8e=(e,t)=>{if(0===e.length)return!0;let n=!1;return e.forEach((e=>{e.token.symbol===t&&e.balance.eq(0)&&(n=!0)})),n};function a8e({theme:e,fromAmount:t,toAmount:n,fromTokenAddress:r,toTokenAddress:i}){const{t:a}=_ke(),{viewDispatch:o}=uV.useContext(ERe),{eventTargetState:{eventTarget:s}}=uV.useContext(zqe),{swapState:{tokenBalances:c}}=uV.useContext(X6e),{connectLoaderState:{checkout:u,provider:l}}=uV.useContext(jRe),[d,f]=uV.useState(!1),{page:p}=OPe();return uV.useEffect((()=>{p({userJourney:bPe.SWAP,screen:"SwapCoins",extras:{fromAmount:t,toAmount:n,fromTokenAddress:r,toTokenAddress:i}})}),[]),uV.useEffect((()=>{i8e(c,jke)&&!fNe(l)&&f(!0)}),[c]),Cq(_Pe,{header:Cq(xRe,{title:a("views.SWAP.header.title"),onCloseButtonClick:()=>eKe(s)}),footer:Cq(V6e,{environment:u?.config.environment,theme:e}),children:Iq(N3,{sx:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[Cq(r8e,{data:{fromAmount:t,toAmount:n,fromTokenAddress:r,toTokenAddress:i},theme:e}),Cq(B2e,{environment:u?.config.environment??Xt.PRODUCTION,visible:d,showAdjustAmount:!1,hasZeroImx:!0,onAddCoinsClick:()=>{o({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.TOP_UP_VIEW}}})},onCloseDrawer:()=>{f(!1)}})]})})}class o8e{baseConfig;constructor({baseConfig:e}){this.baseConfig=e}}const s8e={[Xt.SANDBOX]:"https://checkout-api.sandbox.immutable.com",[Xt.PRODUCTION]:"https://checkout-api.immutable.com"};class c8e{coinsCache;overridesCache;config;constructor(e){this.coinsCache=null,this.overridesCache=null,this.config=e.baseConfig}urlWithPath(e){return s8e[this.config.environment]+e}async fetchOverrides(){if(null!==this.overridesCache)return;const e=this.urlWithPath("/v1/fiat/coins/overrides"),t=await ze.get(e);if(200!==t.status)throw new Error(`Error fetching coins overrides: ${t.status} ${t.statusText}`);this.overridesCache=new Map(Object.entries(t.data))}async fetchCoins(){if(null!==this.coinsCache)return;await this.fetchOverrides();const e=this.urlWithPath("/v1/fiat/coins/all"),t=await ze.get(e);if(200!==t.status)throw new Error(`Error fetching coins list: ${t.status} ${t.statusText}`);const{data:n}=t;this.coinsCache=new Map;for(const e of n){const t=this.overridesCache.get(e.symbol.toLowerCase());this.coinsCache.set(e.symbol.toLowerCase(),t||e.id.toLowerCase())}}async convert({tokenSymbols:e,fiatSymbols:t=[]}){if(!e||0===e.length)throw new Error("Error missing token symbols to convert");const n=t.filter((e=>""!==e));0===n.length&&n.push("usd"),await this.fetchCoins();const r=e.map((e=>this.coinsCache.get(e.toLowerCase()))).filter((e=>""!==e&&void 0!==e)).join(","),i=n.join(",").toLowerCase(),a=this.urlWithPath(`/v1/fiat/conversion?ids=${r}¤cies=${i}`),o=await ze.get(a);if(200!==o.status)throw new Error(`Error fetching prices: ${o.status} ${o.statusText}`);const{data:s}=o,c={};for(const t of e){const e=t.toLowerCase(),n=this.coinsCache.get(e);c[e]={},n&&(c[e]=s[n]||{})}return c}}const u8e=async(e,t,n)=>{try{if(0===n.length)return new Map;return((e,t)=>{const n=new Map;for(const r in e){const i=e[r][t];void 0!==i&&n.set(r,i)}return n})(await e.convert({tokenSymbols:n,fiatSymbols:[t]}),t)}catch(e){return new Map}},l8e=["ETH","IMX"];function d8e({environment:e,children:t}){const[n,r]=uV.useReducer(e2e,J6e),{cryptoFiat:i,fiatSymbol:a,tokenSymbols:o}=n;return uV.useEffect((()=>{r({payload:{type:Q6e.SET_CRYPTO_FIAT,cryptoFiat:new c8e(new o8e({baseConfig:{environment:e}}))}})}),[]),uV.useEffect((()=>{i&&a&&(async()=>{const e=await u8e(i,a,[...new Set([...o,...l8e])]);r({payload:{type:Q6e.SET_CONVERSIONS,conversions:e}})})()}),[i,o,a]),Cq($6e.Provider,{value:{cryptoFiatState:n,cryptoFiatDispatch:r},children:t})}function f8e({transactionResponse:e,swapForm:t}){const{t:n}=_ke(),{viewDispatch:r}=uV.useContext(ERe),{page:i}=OPe();return uV.useEffect((()=>{i({userJourney:bPe.SWAP,screen:"SwapInProgress",extras:{swapFormInfo:t}})}),[]),uV.useEffect((()=>{(async()=>{try{const n=await e.wait();if(1===n.status)return void r({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.SUCCESS,data:{fromTokenAddress:t.fromTokenAddress,fromAmount:t.fromAmount,toTokenAddress:t.toTokenAddress,toAmount:t.toAmount||"",transactionHash:n.transactionHash}}}});r({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.FAIL,data:t,reason:"Transaction failed"}}})}catch{r({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.FAIL,data:t,reason:"Transaction failed"}}})}})()}),[e]),Cq(PPe,{loadingText:n("views.SWAP.IN_PROGRESS.loading.text")})}function p8e(){return Cq(N3,{sx:{...IRe,background:"base.color.translucent.emphasis.100"},children:Cq(N3,{sx:{...ORe,...CRe},children:Iq("svg",{width:"430",height:"305",viewBox:"0 0 430 305",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Cq("path",{d:"M94.0614 105.632L93.6321 104L92 104.429L92.4292 106.061L94.0614 105.632Z",fill:"white"}),Cq("path",{d:"M63.6531 193.101L63.1006 191L60.9996 191.553L61.5521 193.654L63.6531 193.101Z",fill:"white"}),Cq("path",{d:"M344.489 224.345L342.345 224L342 226.145L344.144 226.49L344.489 224.345Z",fill:"white"}),Cq("path",{d:"M372.286 139.905L372.905 138.619L371.619 138L371 139.286L372.286 139.905Z",fill:"white"}),Cq("path",{d:"M341.653 78.101L341.101 76L339 76.5525L339.552 78.6535L341.653 78.101Z",fill:"white"}),Cq("path",{d:"M359.286 242.905L359.905 241.619L358.619 241L358 242.286L359.286 242.905Z",fill:"white"}),Cq("path",{d:"M87.0123 112.087L86.0869 111L85.0002 111.925L85.9256 113.012L87.0123 112.087Z",fill:"white"}),Cq("path",{d:"M84.2862 248.905L84.9053 247.619L83.6192 247L83.0001 248.286L84.2862 248.905Z",fill:"white"}),Cq("path",{d:"M215.496 262.992C268.237 262.992 310.993 220.237 310.993 167.496C310.993 114.755 268.237 72 215.496 72C162.755 72 120 114.755 120 167.496C120 220.237 162.755 262.992 215.496 262.992Z",fill:"white",fillOpacity:"0.24",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M159.82 95.1695C179.975 79.6536 204.651 73.1506 227.89 77.0665C261.089 82.6606 253.281 101.028 199.197 121.314C151.934 139.037 123.49 136.348 143.823 110.95C148.422 105.208 153.721 99.8623 159.82 95.1695Z",fill:"white",fillOpacity:"0.08"}),Cq("path",{d:"M215.497 227.183C171.451 227.183 135.159 219.871 130.194 210.462H130.187C145.912 241.626 178.21 263.001 215.497 263.001C252.705 263.001 284.942 241.719 300.706 210.664C295.33 219.98 259.232 227.183 215.505 227.183H215.497Z",fill:"#36E0F8",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M284.219 219.607L283.978 219.84C281.275 222.482 256.583 215.986 253.172 218.418C222.389 240.36 182.779 269.061 146.099 219.397C146.099 219.397 140.761 217.641 138.609 216.686C139.425 217.96 140.279 219.226 141.165 220.469C170.425 261.516 227.423 271.073 268.47 241.813C276.97 235.752 284.118 228.503 289.852 220.454L292.424 216.841L288.252 218.302C287.086 218.713 285.851 219.11 284.553 219.498L284.227 219.599L284.219 219.607Z",fill:"black"}),Cq("path",{d:"M215.496 241.4C262.183 241.4 300.03 226.557 300.03 208.248C300.03 189.938 262.183 175.095 215.496 175.095C168.81 175.095 130.963 189.938 130.963 208.248C130.963 226.557 168.81 241.4 215.496 241.4Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M300.705 210.659C300.705 210.659 300.705 210.65 300.705 210.641C300.705 210.641 300.705 210.65 300.705 210.659Z",fill:"#EBE9E9",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M193.624 204.511C208.952 204.511 221.377 199.638 221.377 193.626C221.377 187.614 208.952 182.741 193.624 182.741C178.297 182.741 165.871 187.614 165.871 193.626C165.871 199.638 178.297 204.511 193.624 204.511Z",fill:"#D0F500",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M193.624 204.511C208.954 204.511 221.377 199.64 221.377 193.626V201.349C221.377 207.363 208.954 212.234 193.624 212.234C178.295 212.234 165.871 207.363 165.871 201.349V193.626C165.871 199.64 178.295 204.511 193.624 204.511Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M197.33 204.41C199.49 204.294 201.573 204.084 203.546 203.789V211.512C201.573 211.807 199.49 212.017 197.33 212.133V204.41Z",fill:"#D0F500"}),Cq("path",{d:"M206.398 203.291C211.246 202.304 215.255 200.774 217.905 198.901V206.624C215.255 208.497 211.246 210.027 206.398 211.014V203.291Z",fill:"black"}),Cq("path",{d:"M193.624 204.511C208.954 204.511 221.377 199.64 221.377 193.626V201.349C221.377 207.363 208.954 212.234 193.624 212.234C178.295 212.234 165.871 207.363 165.871 201.349V193.626C165.871 199.64 178.295 204.511 193.624 204.511Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M206.398 211.015C211.246 210.028 215.255 208.497 217.905 206.625",stroke:"#A66CFF",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M193.624 196.788C208.952 196.788 221.377 191.914 221.377 185.903C221.377 179.891 208.952 175.017 193.624 175.017C178.297 175.017 165.871 179.891 165.871 185.903C165.871 191.914 178.297 196.788 193.624 196.788Z",fill:"#D0F500",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M193.624 196.788C208.954 196.788 221.377 191.917 221.377 185.903V193.626C221.377 199.639 208.954 204.511 193.624 204.511C178.295 204.511 165.871 199.639 165.871 193.626V185.903C165.871 191.917 178.295 196.788 193.624 196.788Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M197.33 196.687C199.49 196.57 201.573 196.361 203.546 196.065V203.788C201.573 204.084 199.49 204.293 197.33 204.41V196.687Z",fill:"#36E0F8"}),Cq("path",{d:"M206.398 195.568C211.246 194.581 215.255 193.051 217.905 191.178V198.901C215.255 200.774 211.246 202.304 206.398 203.291V195.568Z",fill:"black"}),Cq("path",{d:"M193.624 196.788C208.954 196.788 221.377 191.917 221.377 185.903V193.626C221.377 199.639 208.954 204.511 193.624 204.511C178.295 204.511 165.871 199.639 165.871 193.626V185.903C165.871 191.917 178.295 196.788 193.624 196.788Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M206.398 203.291C211.246 202.304 215.255 200.774 217.905 198.901",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M193.624 189.065C208.952 189.065 221.377 184.192 221.377 178.18C221.377 172.168 208.952 167.294 193.624 167.294C178.297 167.294 165.871 172.168 165.871 178.18C165.871 184.192 178.297 189.065 193.624 189.065Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M193.624 189.065C208.954 189.065 221.377 184.194 221.377 178.18V185.903C221.377 191.917 208.954 196.788 193.624 196.788C178.295 196.788 165.871 191.917 165.871 185.903V178.18C165.871 184.194 178.295 189.065 193.624 189.065Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M197.33 188.965C199.49 188.849 201.573 188.639 203.546 188.343V196.067C201.573 196.362 199.49 196.571 197.33 196.688V188.965Z",fill:"#F191FA"}),Cq("path",{d:"M206.398 187.845C211.246 186.858 215.255 185.327 217.905 183.455V191.178C215.255 193.05 211.246 194.581 206.398 195.568V187.845Z",fill:"black"}),Cq("path",{d:"M193.624 189.065C208.954 189.065 221.377 184.194 221.377 178.18V185.903C221.377 191.917 208.954 196.788 193.624 196.788C178.295 196.788 165.871 191.917 165.871 185.903V178.18C165.871 184.194 178.295 189.065 193.624 189.065Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M206.398 195.569C211.246 194.582 215.255 193.052 217.905 191.179",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M238.601 212.934C253.929 212.934 266.354 208.06 266.354 202.049C266.354 196.037 253.929 191.164 238.601 191.164C223.274 191.164 210.848 196.037 210.848 202.049C210.848 208.06 223.274 212.934 238.601 212.934Z",fill:"#D0F500",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M238.601 212.935C253.931 212.935 266.354 208.063 266.354 202.049V209.772C266.354 215.786 253.931 220.658 238.601 220.658C223.272 220.658 210.848 215.786 210.848 209.772V202.049C210.848 208.063 223.272 212.935 238.601 212.935Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M242.307 212.833C244.467 212.717 246.55 212.507 248.523 212.212V219.935C246.55 220.23 244.467 220.44 242.307 220.556V212.833Z",fill:"#F191FA"}),Cq("path",{d:"M251.375 211.713C256.223 210.727 260.232 209.196 262.882 207.324V215.047C260.232 216.919 256.223 218.45 251.375 219.436V211.713Z",fill:"black"}),Cq("path",{d:"M238.601 212.935C253.931 212.935 266.354 208.063 266.354 202.049V209.772C266.354 215.786 253.931 220.658 238.601 220.658C223.272 220.658 210.848 215.786 210.848 209.772V202.049C210.848 208.063 223.272 212.935 238.601 212.935Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M251.375 219.437C256.223 218.45 260.232 216.919 262.882 215.047",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M238.601 205.21C253.929 205.21 266.354 200.336 266.354 194.324C266.354 188.313 253.929 183.439 238.601 183.439C223.274 183.439 210.848 188.313 210.848 194.324C210.848 200.336 223.274 205.21 238.601 205.21Z",fill:"#D0F500",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M238.601 205.21C253.931 205.21 266.354 200.339 266.354 194.325V202.048C266.354 208.062 253.931 212.934 238.601 212.934C223.272 212.934 210.848 208.062 210.848 202.048V194.325C210.848 200.339 223.272 205.21 238.601 205.21Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M242.307 205.109C244.467 204.993 246.55 204.783 248.523 204.488V212.211C246.55 212.506 244.467 212.716 242.307 212.832V205.109Z",fill:"#36E0F8"}),Cq("path",{d:"M251.375 203.989C256.223 203.003 260.232 201.472 262.882 199.6V207.323C260.232 209.195 256.223 210.726 251.375 211.712V203.989Z",fill:"black"}),Cq("path",{d:"M238.601 205.21C253.931 205.21 266.354 200.339 266.354 194.325V202.048C266.354 208.062 253.931 212.934 238.601 212.934C223.272 212.934 210.848 208.062 210.848 202.048V194.325C210.848 200.339 223.272 205.21 238.601 205.21Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M251.375 211.713C256.223 210.726 260.232 209.195 262.882 207.323",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M238.601 197.487C253.929 197.487 266.354 192.613 266.354 186.602C266.354 180.59 253.929 175.716 238.601 175.716C223.274 175.716 210.848 180.59 210.848 186.602C210.848 192.613 223.274 197.487 238.601 197.487Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M238.601 197.487C253.931 197.487 266.354 192.616 266.354 186.602V194.325C266.354 200.339 253.931 205.21 238.601 205.21C223.272 205.21 210.848 200.339 210.848 194.325V186.602C210.848 192.616 223.272 197.487 238.601 197.487Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M242.307 197.386C244.467 197.27 246.55 197.06 248.523 196.765V204.488C246.55 204.783 244.467 204.992 242.307 205.109V197.386Z",fill:"#F191FA"}),Cq("path",{d:"M251.375 196.267C256.223 195.28 260.232 193.75 262.882 191.877V199.6C260.232 201.473 256.223 203.003 251.375 203.99V196.267Z",fill:"#9AEFFB"}),Cq("path",{d:"M238.601 197.487C253.931 197.487 266.354 192.616 266.354 186.602V194.325C266.354 200.339 253.931 205.21 238.601 205.21C223.272 205.21 210.848 200.339 210.848 194.325V186.602C210.848 192.616 223.272 197.487 238.601 197.487Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M251.375 203.99C256.223 203.004 260.232 201.473 262.882 199.601",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M232.652 189.678C247.979 189.678 260.405 184.804 260.405 178.793C260.405 172.781 247.979 167.908 232.652 167.908C217.324 167.908 204.899 172.781 204.899 178.793C204.899 184.804 217.324 189.678 232.652 189.678Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M232.652 189.678C247.981 189.678 260.405 184.807 260.405 178.793V186.516C260.405 192.53 247.981 197.401 232.652 197.401C217.323 197.401 204.899 192.53 204.899 186.516V178.793C204.899 184.807 217.323 189.678 232.652 189.678Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M236.358 189.578C238.518 189.461 240.6 189.251 242.574 188.956V196.679C240.6 196.974 238.518 197.184 236.358 197.301V189.578Z",fill:"#F191FA"}),Cq("path",{d:"M245.426 188.458C250.274 187.471 254.283 185.94 256.932 184.067V191.791C254.283 193.663 250.274 195.194 245.426 196.18V188.458Z",fill:"black"}),Cq("path",{d:"M232.652 189.678C247.981 189.678 260.405 184.807 260.405 178.793V186.516C260.405 192.53 247.981 197.401 232.652 197.401C217.323 197.401 204.899 192.53 204.899 186.516V178.793C204.899 184.807 217.323 189.678 232.652 189.678Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M245.426 196.182C250.274 195.195 254.283 193.664 256.932 191.792",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M240.99 180.021C256.317 180.021 268.743 175.148 268.743 169.136C268.743 163.124 256.317 158.25 240.99 158.25C225.662 158.25 213.237 163.124 213.237 169.136C213.237 175.148 225.662 180.021 240.99 180.021Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M240.99 180.021C256.319 180.021 268.743 175.15 268.743 169.136V176.859C268.743 182.873 256.319 187.744 240.99 187.744C225.66 187.744 213.237 182.873 213.237 176.859V169.136C213.237 175.15 225.66 180.021 240.99 180.021Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M244.696 179.92C246.856 179.804 248.938 179.594 250.911 179.299V187.022C248.938 187.317 246.856 187.527 244.696 187.643V179.92Z",fill:"#9AEFFB"}),Cq("path",{d:"M253.763 178.801C258.612 177.815 262.621 176.284 265.27 174.412V182.135C262.621 184.007 258.612 185.538 253.763 186.524V178.801Z",fill:"black"}),Cq("path",{d:"M240.99 180.021C256.319 180.021 268.743 175.15 268.743 169.136V176.859C268.743 182.873 256.319 187.744 240.99 187.744C225.66 187.744 213.237 182.873 213.237 176.859V169.136C213.237 175.15 225.66 180.021 240.99 180.021Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M253.763 186.525C258.612 185.538 262.621 184.007 265.27 182.135",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M189.911 223.803C205.238 223.803 217.664 218.929 217.664 212.918C217.664 206.906 205.238 202.032 189.911 202.032C174.583 202.032 162.158 206.906 162.158 212.918C162.158 218.929 174.583 223.803 189.911 223.803Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M189.911 223.803C205.24 223.803 217.664 218.932 217.664 212.918V220.641C217.664 226.655 205.24 231.526 189.911 231.526C174.581 231.526 162.158 226.655 162.158 220.641V212.918C162.158 218.932 174.581 223.803 189.911 223.803Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M193.625 223.71C195.785 223.593 197.867 223.384 199.84 223.088V230.811C197.867 231.107 195.785 231.316 193.625 231.433V223.71Z",fill:"#F191FA"}),Cq("path",{d:"M202.685 222.583C207.533 221.596 211.542 220.066 214.191 218.193V225.916C211.542 227.789 207.533 229.319 202.685 230.306V222.583Z",fill:"#9AEFFB"}),Cq("path",{d:"M189.911 223.803C205.24 223.803 217.664 218.932 217.664 212.918V220.641C217.664 226.655 205.24 231.526 189.911 231.526C174.581 231.526 162.158 226.655 162.158 220.641V212.918C162.158 218.932 174.581 223.803 189.911 223.803Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M202.685 230.306C207.533 229.32 211.542 227.789 214.191 225.917",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M300.705 210.658C300.705 210.658 300.705 210.649 300.705 210.641C300.705 210.641 300.705 210.649 300.705 210.658Z",fill:"#A66CFF",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})]})})})}function h8e(){return Cq(N3,{testId:"wallet-approve-hero",sx:{...IRe,background:"base.color.translucent.emphasis.100"},children:Cq(N3,{sx:{...ORe,...CRe},children:Iq("svg",{width:"430",height:"305",viewBox:"0 0 430 305",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Cq("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"}),Cq("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"}),Cq("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"}),Cq("path",{d:"M159.384 154.519L155.93 147.991L158.939 141.463L162.388 147.991L159.384 154.519Z",fill:"#F191FA"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("path",{d:"M232.923 169.903L235.354 164.731",stroke:"black",strokeWidth:"0.469297",strokeMiterlimit:"10"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("path",{d:"M273.579 230.377L277.263 229.767L287.024 238.458L278.347 222.051L270.373 223.609L273.579 230.377Z",fill:"black"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("path",{d:"M208.107 253.158L205.685 248.573",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M191.634 240.96H185.758",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("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"}),Cq("path",{d:"M356.061 232.632L355.632 231L354 231.429L354.429 233.061L356.061 232.632Z",fill:"white"}),Cq("path",{d:"M57.6531 168.341L57.1006 166.24L54.9996 166.793L55.5521 168.894L57.6531 168.341Z",fill:"white"}),Cq("path",{d:"M103.489 244.345L101.345 244L101 246.145L103.144 246.49L103.489 244.345Z",fill:"white"}),Cq("path",{d:"M341.286 111.905L341.905 110.619L340.619 110L340 111.286L341.286 111.905Z",fill:"white"}),Cq("path",{d:"M323.144 179.08L322.592 176.979L320.491 177.531L321.043 179.632L323.144 179.08Z",fill:"white"}),Cq("path",{d:"M328.919 177.658L329.538 176.372L328.252 175.753L327.633 177.039L328.919 177.658Z",fill:"white"}),Cq("path",{d:"M88.1441 141.383L87.2188 140.296L86.1321 141.221L87.0574 142.308L88.1441 141.383Z",fill:"white"}),Cq("path",{d:"M258.286 89.9052L258.905 88.6191L257.619 88L257 89.2861L258.286 89.9052Z",fill:"white"})]})})})}function m8e({data:e}){const{t:t}=_ke(),{swapState:{allowedTokens:n}}=uV.useContext(X6e),{connectLoaderState:r}=uV.useContext(jRe),{checkout:i,provider:a}=r,{viewDispatch:o}=uV.useContext(ERe),{eventTargetState:{eventTarget:s}}=uV.useContext(zqe),c=fNe(a),[u,l]=uV.useState(!1),[d,f]=uV.useState(!1),[p,h]=uV.useState(!1),[m,y]=uV.useState(!1),[b,g]=uV.useState(!1),[v,w]=uV.useState(!1),{page:T,track:E}=OPe();uV.useEffect((()=>{T({userJourney:bPe.SWAP,screen:"ApproveERC20",extras:{swapFormInfo:e.swapFormInfo}})}),[]);const A=uV.useMemo((()=>n.find((t=>t.address===e.swapFormInfo.fromTokenAddress))),[n,e.swapFormInfo.fromTokenAddress]),x=uV.useCallback((()=>{o({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.ERROR_VIEW,error:new Error("No checkout object or no provider object found")}}})}),[o]),O=uV.useCallback((()=>{o({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.SWAP,data:e.swapFormInfo}}})}),[o]),C=(e,t)=>{e.type!==uW.UNPREDICTABLE_GAS_LIMIT?e.type===uW.TRANSACTION_FAILED||e.type===uW.INSUFFICIENT_FUNDS||e.receipt&&0===e.receipt.status?o({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.FAIL,reason:"Transaction failed",data:t}}}):(console.error("Approve ERC20 failed",e),o({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.ERROR_VIEW,error:e}}})):o({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.PRICE_SURGE,data:t}}})},I=(e,t=!1)=>({...e,gasPrice:t?jr.from(0):void 0}),_=uV.useCallback((async()=>{if(!m)if(E({userJourney:bPe.SWAP,screen:"ApproveERC20",control:"ApproveSpending",controlType:"Button"}),y(!0),i&&a){if(!u){l(!0);try{const t=await i.sendTransaction({provider:a,transaction:I(e.approveTransaction,c)});f(!0);if(1!==(await t.transactionResponse.wait()).status)return void o({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.FAIL,data:e.swapFormInfo}}});f(!1),l(!1),h(!0)}catch(t){if(f(!1),l(!1),t.type===uW.USER_REJECTED_REQUEST_ERROR)return void g(!0);C(t,e.swapFormInfo)}finally{y(!1)}}}else x()}),[i,a,x,o,w,e.approveTransaction,e.swapFormInfo,u,l,f]),P=uV.useMemo((()=>Iq(RRe,{heading:t(`views.APPROVE_ERC20.approveSpending.content.${c?"passport":"metamask"}.heading`),children:[c&&Cq(N3,{children:t("views.APPROVE_ERC20.approveSpending.content.passport.body")}),!c&&Cq(N3,{children:t("views.APPROVE_ERC20.approveSpending.content.metamask.body",{amount:`${e.swapFormInfo.fromAmount} ${A?.symbol||""}`})})]})),[e.swapFormInfo,A,c]),S=uV.useMemo((()=>Cq(yRe,{loading:m,actionText:t(b?"views.APPROVE_ERC20.approveSpending.footer.retryText":"views.APPROVE_ERC20.approveSpending.footer.buttonText"),onActionClick:_})),[b,_,m]),k=uV.useCallback((async()=>{if(!m)if(E({userJourney:bPe.SWAP,screen:"ApproveERC20",control:"ApproveSwap",controlType:"Button"}),y(!0),i&&a){if(!u){l(!0);try{const t=await i.sendTransaction({provider:a,transaction:I(e.transaction,c)});l(!1),o({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.IN_PROGRESS,data:{transactionResponse:t.transactionResponse,swapForm:e.swapFormInfo}}}})}catch(t){if(l(!1),t.type===uW.USER_REJECTED_REQUEST_ERROR)return void w(!0);C(t,e.swapFormInfo)}finally{y(!1)}}}else x()}),[i,a,x,o,w,e.transaction,e.swapFormInfo,u,l]),R=Cq(RRe,{heading:t("views.APPROVE_ERC20.approveSwap.content.heading"),children:Cq(N3,{children:t("views.APPROVE_ERC20.approveSwap.content.body")})}),N=uV.useMemo((()=>Cq(yRe,{loading:m,actionText:t(v?"views.APPROVE_ERC20.approveSwap.footer.retryText":"views.APPROVE_ERC20.approveSwap.footer.buttonText"),onActionClick:k})),[v,k,m]);return Iq(Oq,{children:[d&&Cq(PPe,{loadingText:t("views.APPROVE_ERC20.approveSpending.loading.text")}),!d&&Cq(_Pe,{header:Cq(xRe,{transparent:!0,showBack:!0,onCloseButtonClick:()=>eKe(s),onBackButtonClick:O}),floatHeader:!0,heroContent:Cq(p?h8e:p8e,{}),footer:p?N:S,children:p?R:P})]})}var y8e;!function(e){e.WALLET_NETWORK_SELECTION="WALLET_NETWORK_SELECTION",e.BRIDGE_FORM="BRIDGE_FORM",e.BRIDGE_REVIEW="BRIDGE_REVIEW",e.IN_PROGRESS="IN_PROGRESS",e.BRIDGE_FAILURE="BRIDGE_FAILURE",e.APPROVE_TRANSACTION="APPROVE_TRANSACTION",e.TRANSACTIONS="TRANSACTIONS",e.CLAIM_WITHDRAWAL="CLAIM_WITHDRAWAL",e.CLAIM_WITHDRAWAL_IN_PROGRESS="CLAIM_WITHDRAWAL_IN_PROGRESS",e.CLAIM_WITHDRAWAL_SUCCESS="CLAIM_WITHDRAWAL_SUCCESS",e.CLAIM_WITHDRAWAL_FAILURE="CLAIM_WITHDRAWAL_FAILURE"}(y8e||(y8e={}));const b8e=(e,t,n)=>{const r=uV.useRef(!1);uV.useEffect((()=>{r.current||("function"!=typeof t||t())&&(e(),r.current=!0)}),n||[])};const g8e=e=>{const{minPercentage:t,maxPercentage:n}=e;return void 0===t||void 0===n?"-.--":`${t}% to ${n}`},v8e=(e,t)=>{const{fees:n,token:r}=e;if(void 0===n.totalFees)return"-.--";if(void 0===r)return"-.--";const i=((e,t,n)=>{let r=-1;if(e&&t){const i=Xd(e,t.decimals),a=n.get(t.symbol.toLocaleLowerCase());if(a){const e=parseFloat(i);if(Number.isNaN(e))return r;r=e*a}}return r})(n.totalFees,r,t);return i<0?"-.--":function(e){if(e<0)return"-.--";const t=e.toString();if(t.includes("e")||0===e)return"0.00";if(e<.01)for(let n=0;n<t.length;n++)if("0"!==t[n]&&"."!==t[n])return e.toFixed(n-1);return e.toFixed(2)}(i)};var w8e;function T8e({testId:e,icon:t,iconVariant:n,intentIcon:r,heading:i,caption:a,onClick:o,renderFeeFunction:s,isDisabled:c}){return Cq(N3,{testId:"top-up-view",sx:{paddingY:"1px"},children:Iq(oae,{testId:`menu-item-${e}`,size:"small",emphasized:!0,onClick:c?void 0:o,sx:c?{opacity:"0.5",cursor:"not-allowed"}:{},children:[Cq(oae.Icon,{icon:t,variant:n}),Cq(oae.Label,{size:"medium",children:i}),Cq(oae.IntentIcon,{icon:r}),Iq(oae.Caption,{testId:`menu-item-caption-${e}`,children:[a,Cq("br",{}),c?"":s("-.--",!1)]})]})})}!function(e){e.ONRAMP="ONRAMP",e.IN_PROGRESS_LOADING="IN_PROGRESS_LOADING",e.IN_PROGRESS="IN_PROGRESS",e.SUCCESS="SUCCESS",e.FAIL="FAIL"}(w8e||(w8e={}));const E8e={[Xt.SANDBOX]:"https://checkout-playground.sandbox.immutable.com",[Xt.PRODUCTION]:"https://toolkit.immutable.com"};function A8e({widgetEvent:e,checkout:t,provider:n,showOnrampOption:r,showSwapOption:i,showBridgeOption:a,tokenAddress:o,amount:s,analytics:c,onCloseButtonClick:u,onBackButtonClick:l,heading:d,subheading:f}){const{t:p}=_ke(),{userJourney:h}=c,{viewDispatch:m}=uV.useContext(ERe),{cryptoFiatState:y,cryptoFiatDispatch:b}=uV.useContext($6e),{conversions:g,fiatSymbol:v}=y,w=t?.config.environment??Xt.SANDBOX,{eventTargetState:{eventTarget:T}}=uV.useContext(zqe),[E,A]=uV.useState("-.--"),[,x]=uV.useState("-.--"),[O,C]=uV.useState(!0),I=d?p(...d):p("views.TOP_UP_VIEW.header.title"),_=f?p(...f):null,{page:P,track:S}=OPe();b8e((()=>{P({userJourney:h,screen:"TopUp"})})),uV.useEffect((()=>{b&&b({payload:{type:Q6e.SET_TOKEN_SYMBOLS,tokenSymbols:l8e}})}),[b]),uV.useEffect((()=>{t&&(async()=>{const e=await t.gasEstimate({gasEstimateType:XH.BRIDGE_TO_L2}),n=await v8e(e,g);x(n)})()}),[void 0!==t]),uV.useEffect((()=>{t&&(async()=>{const e=await t.getExchangeFeeEstimate(),n=g8e(e);A(n)})()}),[void 0!==t]),uV.useEffect((()=>{t&&(async()=>{C(await t.isSwapAvailable())})()}),[void 0!==t]);const k=(e,t,n="Button")=>{S({userJourney:h,screen:"TopUp",control:e,controlType:n,extras:t})},R=()=>{if(e===kH.IMTBL_ONRAMP_WIDGET_EVENT){const t={tokenAddress:"",amount:""};return m({payload:{type:TRe.UPDATE_VIEW,view:{type:w8e.ONRAMP,data:t}}}),void k("OnRamp",{...t,widgetEvent:e})}const t={tokenAddress:o??"",amount:s??""};$qe.sendRequestOnrampEvent(T,e,t),k("OnRamp",{...t,widgetEvent:e})},N=e=>Cq(N3,{sx:{fontSize:"base.text.caption.small.regular.fontSize",c:"base.color.translucent.standard.600"},children:e}),M=[{testId:"onramp",icon:"BankCard",iconVariant:"bold",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.debit",onClickEvent:R,fee:()=>N(`${p("views.TOP_UP_VIEW.topUpOptions.debit.subcaption")} ≈ ${E}%`),isAvailable:!0,isEnabled:r},{testId:"onramp",icon:"BankCard",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.credit",onClickEvent:R,fee:()=>N(`${p("views.TOP_UP_VIEW.topUpOptions.credit.subcaption")} ≈ ${E}%`),isAvailable:!0,isEnabled:r},{testId:"advanced",icon:"Minting",iconVariant:"bold",intentIcon:"JumpTo",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.advanced",onClickEvent:()=>{const t=E8e[w];k("AdvancedOptions",{...{tokenAddress:o??"",amount:s??""},widgetEvent:e}),window.open(`${t}/squid-bridge/`,"_blank")},fee:()=>N(""),isAvailable:!0,isEnabled:!0},{testId:"swap",icon:"Swap",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.swap",onClickEvent:()=>{if(e===kH.IMTBL_SWAP_WIDGET_EVENT){const t={toTokenAddress:"",fromAmount:"",fromTokenAddress:""};return m({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.SWAP,data:t}}}),void k("Swap",{...t,widgetEvent:e})}const t={fromTokenAddress:"",toTokenAddress:o??"",amount:""};$qe.sendRequestSwapEvent(T,e,t),k("Swap",{...t,widgetEvent:e})},fee:()=>N(`${p("views.TOP_UP_VIEW.topUpOptions.swap.subcaption")} ≈ $0.05 ${v.toUpperCase()}`),isAvailable:O,isEnabled:i},{testId:"bridge",icon:"ArrowForward",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.bridge",onClickEvent:()=>{if(e===kH.IMTBL_BRIDGE_WIDGET_EVENT){const t={fromTokenAddress:"",fromAmount:""};return m({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.WALLET_NETWORK_SELECTION,data:t}}}),void k("Bridge",{...t,widgetEvent:e})}const t={tokenAddress:"",amount:""};$qe.sendRequestBridgeEvent(T,e,t),k("Bridge",{...t,widgetEvent:e})},fee:()=>N(""),isAvailable:!0,isEnabled:a}];return Cq(_Pe,{header:Cq(xRe,{onBackButtonClick:l,onCloseButtonClick:u,showBack:!0}),children:Iq(N3,{sx:{paddingX:"base.spacing.x4",paddingY:"base.spacing.x4"},children:[Cq(qee,{size:"small",children:I}),_&&Cq(tee,{size:"small",sx:{color:"base.color.text.body.secondary"},children:_}),Cq(N3,{sx:{paddingY:"base.spacing.x4"},children:M.sort(((e,t)=>Number(t.isAvailable)-Number(e.isAvailable))).map((e=>e.isEnabled&&Cq(T8e,{testId:e.testId,icon:e.icon,iconVariant:e.iconVariant,intentIcon:e.intentIcon,heading:p(`${e.textConfigKey}.heading`),caption:e.isAvailable?p(`${e.textConfigKey}.caption`):p(`${e.textConfigKey}.disabledCaption`),onClick:e.onClickEvent,renderFeeFunction:e.fee,isDisabled:!e.isAvailable},p(`${e.textConfigKey}.heading`).toLowerCase())))})]})})}const x8e=async(e,{retries:t,retryIntervalMs:n,nonRetryable:r,nonRetryableSilently:i})=>{let a=t;try{return await e()}catch(t){if(i&&i(t))return;if(r&&r(t))throw t;if(void 0!==a){if(a<=0)throw t;a-=1}return await((e=0)=>e&&new Promise((t=>setTimeout(t,e))))(n),x8e(e,{retries:a,retryIntervalMs:n,nonRetryable:r,nonRetryableSilently:i})}},O8e=async({checkout:e,provider:t,allowTokenListType:n,chainId:r,allowZero:i=!1,retryPolicy:a=Uke})=>{const o=r||(await e.getNetworkInfo({provider:t})).chainId,s=await t.getSigner().getAddress(),c=await x8e((()=>e.getAllBalances({provider:t,walletAddress:s,chainId:o})),{...a});if(void 0===c)return;const u=await e.getTokenAllowList({chainId:o,type:n}),l=new Map;u.tokens.forEach((e=>l.set(e.address?.toLowerCase()||Nke,!0)));const d=c.balances.filter((e=>!(e.balance.lte(0)&&!i)&&l.get(e.token.address?.toLowerCase()||Nke))).map((t=>({...t,token:{...t.token,icon:JRe(e.config.environment,KRe(t.token.address)?t.token.symbol:t.token.address??"")}})))??[];return u.tokens=u.tokens.map((t=>({...t,icon:JRe(e.config.environment,KRe(t.address)?t.symbol:t.address??"")}))),{allowList:u,allowedBalances:d}};function C8e({amount:e,fromTokenAddress:t,toTokenAddress:n,config:r}){const{t:i}=_ke(),{eventTargetState:{eventTarget:a}}=uV.useContext(zqe),{environment:o,theme:s,isOnRampEnabled:c,isSwapEnabled:u,isBridgeEnabled:l}=r,{connectLoaderState:{checkout:d,provider:f}}=uV.useContext(jRe),[p,h]=uV.useReducer(ARe,{...wRe,history:[]}),[m,y]=uV.useReducer(Y6e,q6e),{page:b}=OPe(),[g,v]=uV.useState(!1),w=uV.useMemo((()=>({swapState:m,swapDispatch:y})),[m,y]),T=uV.useMemo((()=>({viewState:p,viewDispatch:h})),[p,h]),E=uV.useCallback(((e,t)=>{h({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.ERROR_VIEW,tryAgain:t,error:e}}})}),[h]),A=uV.useCallback((()=>{h({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.SWAP}}})}),[h]),x=uV.useCallback((async()=>{if(!d)throw new Error("loadBalances: missing checkout");if(!f)throw new Error("loadBalances: missing provider");try{const e=await O8e({checkout:d,provider:f,allowTokenListType:ZH.SWAP});if(void 0===e)return!1;y({payload:{type:K6e.SET_ALLOWED_TOKENS,allowedTokens:e.allowList.tokens}}),y({payload:{type:K6e.SET_TOKEN_BALANCES,tokenBalances:e.allowedBalances}})}catch(e){if(Uke.nonRetryable(e))return E(e,x),!1}return!0}),[d,f]);return uV.useEffect((()=>{(async()=>{if(!d||!f)return;const e=await d.getNetworkInfo({provider:f});if(e.chainId!==Qke(d.config))return;let t;try{t=await d.config.remote.getConfig("dex")}catch(e){return void E(e)}const n=new hC({chainId:e.chainId,baseConfig:new Zt({environment:o}),secondaryFees:t.secondaryFees,overrides:t.overrides});y({payload:{type:K6e.SET_EXCHANGE,exchange:n}}),y({payload:{type:K6e.SET_NETWORK,network:e}}),await x()&&p.view.type===vRe.LOADING_VIEW&&A()})()}),[d,f]),Cq(ERe.Provider,{value:T,children:Cq(X6e.Provider,{value:w,children:Iq(d8e,{environment:o,children:[p.view.type===vRe.LOADING_VIEW&&Cq(PPe,{loadingText:i("views.LOADING_VIEW.text")}),p.view.type===x2e.SWAP&&Cq(a8e,{theme:s,fromAmount:p.view.data?.fromAmount??e,fromTokenAddress:p.view.data?.fromTokenAddress??t,toTokenAddress:p.view.data?.toTokenAddress??n}),p.view.type===x2e.IN_PROGRESS&&Cq(f8e,{transactionResponse:p.view.data.transactionResponse,swapForm:p.view.data.swapForm}),p.view.type===x2e.APPROVE_ERC20&&Cq(m8e,{data:p.view.data}),p.view.type===x2e.SUCCESS&&Cq(Lqe,{statusText:i("views.SWAP.success.text"),actionText:i("views.SWAP.success.actionText"),onRenderEvent:()=>{b({userJourney:bPe.SWAP,screen:"SwapSuccess",extras:{fromTokenAddress:p.view.data?.fromTokenAddress,fromAmount:p.view.data?.fromAmount,toTokenAddress:p.view.data?.toTokenAddress,toAmount:p.view.data?.toAmount}}),tKe(a,p.view.data.transactionHash)},onActionClick:()=>eKe(a),statusType:_qe.SUCCESS,testId:"success-view"}),p.view.type===x2e.FAIL&&Cq(Lqe,{statusText:i("views.SWAP.failed.text"),actionText:i("views.SWAP.failed.actionText"),onRenderEvent:()=>{b({userJourney:bPe.SWAP,screen:"SwapFailed"}),nKe(a,"Transaction failed")},onActionClick:()=>{p.view.type===x2e.FAIL&&h({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.SWAP,data:p.view.data}}})},statusType:_qe.FAILURE,onCloseClick:()=>eKe(a),testId:"fail-view"}),p.view.type===x2e.PRICE_SURGE&&Cq(Lqe,{statusText:i("views.SWAP.rejected.text"),actionText:i("views.SWAP.rejected.actionText"),onRenderEvent:()=>{b({userJourney:bPe.SWAP,screen:"PriceSurge"}),rKe(a,"Price surge")},onActionClick:()=>{p.view.type===x2e.PRICE_SURGE&&h({payload:{type:TRe.UPDATE_VIEW,view:{type:x2e.SWAP,data:p.view.data}}})},statusType:_qe.WARNING,onCloseClick:()=>eKe(a),testId:"price-surge-view"}),p.view.type===vRe.ERROR_VIEW&&Cq(NRe,{actionText:i("views.ERROR_VIEW.actionText"),onActionClick:async()=>{v(!0);const e=p.view;if(!e.tryAgain)return A(),void v(!1);await e.tryAgain()&&A(),v(!1)},onCloseClick:()=>eKe(a),errorEventActionLoading:g}),p.view.type===vRe.TOP_UP_VIEW&&Cq(A8e,{analytics:{userJourney:bPe.SWAP},checkout:d,provider:f,widgetEvent:kH.IMTBL_SWAP_WIDGET_EVENT,showOnrampOption:c,showSwapOption:u,showBridgeOption:l,onCloseButtonClick:()=>eKe(a)})]})})})}var I8e=Object.freeze({__proto__:null,default:C8e}),_8e=2147483647,P8e=36,S8e=1,k8e=26,R8e=38,N8e=700,M8e=72,D8e=128,L8e="-",j8e=/[^\x20-\x7E]/,F8e=/[\x2E\u3002\uFF0E\uFF61]/g,B8e={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},U8e=P8e-S8e,z8e=Math.floor,H8e=String.fromCharCode;
|
|
932
|
+
/*! https://mths.be/punycode v1.4.1 by @mathias */function W8e(e){throw new RangeError(B8e[e])}function V8e(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function G8e(e,t,n){var r=0;for(e=n?z8e(e/N8e):e>>1,e+=z8e(e/t);e>U8e*k8e>>1;r+=P8e)e=z8e(e/U8e);return z8e(r+(U8e+1)*e/(e+R8e))}function q8e(e){return function(e,t){var n=e.split("@"),r="";n.length>1&&(r=n[0]+"@",e=n[1]);var i=function(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}((e=e.replace(F8e,".")).split("."),t).join(".");return r+i}(e,(function(e){return j8e.test(e)?"xn--"+function(e){var t,n,r,i,a,o,s,c,u,l,d,f,p,h,m,y=[];for(e=function(e){for(var t,n,r=[],i=0,a=e.length;i<a;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<a?56320==(64512&(n=e.charCodeAt(i++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),i--):r.push(t);return r}(e),f=e.length,t=D8e,n=0,a=M8e,o=0;o<f;++o)(d=e[o])<128&&y.push(H8e(d));for(r=i=y.length,i&&y.push(L8e);r<f;){for(s=_8e,o=0;o<f;++o)(d=e[o])>=t&&d<s&&(s=d);for(s-t>z8e((_8e-n)/(p=r+1))&&W8e("overflow"),n+=(s-t)*p,t=s,o=0;o<f;++o)if((d=e[o])<t&&++n>_8e&&W8e("overflow"),d==t){for(c=n,u=P8e;!(c<(l=u<=a?S8e:u>=a+k8e?k8e:u-a));u+=P8e)m=c-l,h=P8e-l,y.push(H8e(V8e(l+m%h,0))),c=z8e(m/h);y.push(H8e(V8e(c,0))),a=G8e(n,p,r==i),n=0,++r}++n,++t}return y.join("")}(e):e}))}function K8e(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var X8e=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function Y8e(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}}function Z8e(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var J8e=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t};function Q8e(e,t,n,r){t=t||"&",n=n||"=";var i={};if("string"!=typeof e||0===e.length)return i;var a=/\+/g;e=e.split(t);var o=1e3;r&&"number"==typeof r.maxKeys&&(o=r.maxKeys);var s=e.length;o>0&&s>o&&(s=o);for(var c=0;c<s;++c){var u,l,d,f,p=e[c].replace(a,"%20"),h=p.indexOf(n);h>=0?(u=p.substr(0,h),l=p.substr(h+1)):(u=p,l=""),d=decodeURIComponent(u),f=decodeURIComponent(l),K8e(i,d)?X8e(i[d])?i[d].push(f):i[d]=[i[d],f]:i[d]=f}return i}var $8e={parse:h3e,resolve:function(e,t){return h3e(e,!1,!0).resolve(t)},resolveObject:function(e,t){return e?h3e(e,!1,!0).resolveObject(t):t},fileURLToPath:function(e){if("string"==typeof e)e=(new e3e).parse(e);else if(!(e instanceof e3e))throw new TypeError('The "path" argument must be of type string or an instance of URL. Received type '+typeof e+String(e));if("file:"!==e.protocol)throw new TypeError("The URL must be of scheme file");return function(e){const t=e.pathname;for(let e=0;e<t.length;e++)if("%"===t[e]){const n=32|t.codePointAt(e+2);if("2"===t[e+1]&&102===n)throw new TypeError("must not include encoded / characters")}return decodeURIComponent(t)}(e)},format:function(e){fv(e)&&(e=m3e({},e));return y3e(e)},Url:e3e,URL:Qt.URL,URLSearchParams:Qt.URLSearchParams};function e3e(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var t3e=/^([a-z0-9.+-]+:)/i,n3e=/:[0-9]*$/,r3e=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,i3e=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),a3e=["'"].concat(i3e),o3e=["%","/","?",";","#"].concat(a3e),s3e=["/","?","#"],c3e=255,u3e=/^[+a-z0-9A-Z_-]{0,63}$/,l3e=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,d3e={javascript:!0,"javascript:":!0},f3e={javascript:!0,"javascript:":!0},p3e={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function h3e(e,t,n){if(e&&mv(e)&&e instanceof e3e)return e;var r=new e3e;return r.parse(e,t,n),r}function m3e(e,t,n,r){if(!fv(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),a=-1!==i&&i<t.indexOf("#")?"?":"#",o=t.split(a);o[0]=o[0].replace(/\\/g,"/");var s=t=o.join(a);if(s=s.trim(),!r&&1===t.split("#").length){var c=r3e.exec(s);if(c)return e.path=s,e.href=s,e.pathname=c[1],c[2]?(e.search=c[2],e.query=n?Q8e(e.search.substr(1)):e.search.substr(1)):n&&(e.search="",e.query={}),e}var u,l,d,f,p=t3e.exec(s);if(p){var h=(p=p[0]).toLowerCase();e.protocol=h,s=s.substr(p.length)}if(r||p||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var m="//"===s.substr(0,2);!m||p&&f3e[p]||(s=s.substr(2),e.slashes=!0)}if(!f3e[p]&&(m||p&&!p3e[p])){var y,b,g=-1;for(u=0;u<s3e.length;u++)-1!==(l=s.indexOf(s3e[u]))&&(-1===g||l<g)&&(g=l);for(-1!==(b=-1===g?s.lastIndexOf("@"):s.lastIndexOf("@",g))&&(y=s.slice(0,b),s=s.slice(b+1),e.auth=decodeURIComponent(y)),g=-1,u=0;u<o3e.length;u++)-1!==(l=s.indexOf(o3e[u]))&&(-1===g||l<g)&&(g=l);-1===g&&(g=s.length),e.host=s.slice(0,g),s=s.slice(g),b3e(e),e.hostname=e.hostname||"";var v="["===e.hostname[0]&&"]"===e.hostname[e.hostname.length-1];if(!v){var w=e.hostname.split(/\./);for(u=0,d=w.length;u<d;u++){var T=w[u];if(T&&!T.match(u3e)){for(var E="",A=0,x=T.length;A<x;A++)T.charCodeAt(A)>127?E+="x":E+=T[A];if(!E.match(u3e)){var O=w.slice(0,u),C=w.slice(u+1),I=T.match(l3e);I&&(O.push(I[1]),C.unshift(I[2])),C.length&&(s="/"+C.join(".")+s),e.hostname=O.join(".");break}}}}e.hostname.length>c3e?e.hostname="":e.hostname=e.hostname.toLowerCase(),v||(e.hostname=q8e(e.hostname)),f=e.port?":"+e.port:"";var _=e.hostname||"";e.host=_+f,e.href+=e.host,v&&(e.hostname=e.hostname.substr(1,e.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!d3e[h])for(u=0,d=a3e.length;u<d;u++){var P=a3e[u];if(-1!==s.indexOf(P)){var S=encodeURIComponent(P);S===P&&(S=escape(P)),s=s.split(P).join(S)}}var k=s.indexOf("#");-1!==k&&(e.hash=s.substr(k),s=s.slice(0,k));var R=s.indexOf("?");if(-1!==R?(e.search=s.substr(R),e.query=s.substr(R+1),n&&(e.query=Q8e(e.query)),s=s.slice(0,R)):n&&(e.search="",e.query={}),s&&(e.pathname=s),p3e[h]&&e.hostname&&!e.pathname&&(e.pathname="/"),e.pathname||e.search){f=e.pathname||"";var N=e.search||"";e.path=f+N}return e.href=y3e(e),e}function y3e(e){var t=e.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var n=e.protocol||"",r=e.pathname||"",i=e.hash||"",a=!1,o="";e.host?a=t+e.host:e.hostname&&(a=t+(-1===e.hostname.indexOf(":")?e.hostname:"["+this.hostname+"]"),e.port&&(a+=":"+e.port)),e.query&&mv(e.query)&&Object.keys(e.query).length&&(o=function(e,t,n,r){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?Z8e(J8e(e),(function(r){var i=encodeURIComponent(Y8e(r))+n;return X8e(e[r])?Z8e(e[r],(function(e){return i+encodeURIComponent(Y8e(e))})).join(t):i+encodeURIComponent(Y8e(e[r]))})).join(t):r?encodeURIComponent(Y8e(r))+n+encodeURIComponent(Y8e(e)):""}(e.query));var s=e.search||o&&"?"+o||"";return n&&":"!==n.substr(-1)&&(n+=":"),e.slashes||(!n||p3e[n])&&!1!==a?(a="//"+(a||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):a||(a=""),i&&"#"!==i.charAt(0)&&(i="#"+i),s&&"?"!==s.charAt(0)&&(s="?"+s),r=r.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})),n+a+r+(s=s.replace("#","%23"))+i}function b3e(e){var t=e.host,n=n3e.exec(t);n&&(":"!==(n=n[0])&&(e.port=n.substr(1)),t=t.substr(0,t.length-n.length)),t&&(e.hostname=t)}e3e.prototype.parse=function(e,t,n){return m3e(this,e,t,n)},e3e.prototype.format=function(){return y3e(this)},e3e.prototype.resolve=function(e){return this.resolveObject(h3e(e,!1,!0)).format()},e3e.prototype.resolveObject=function(e){if(fv(e)){var t=new e3e;t.parse(e,!1,!0),e=t}for(var n,r=new e3e,i=Object.keys(this),a=0;a<i.length;a++){var o=i[a];r[o]=this[o]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var s=Object.keys(e),c=0;c<s.length;c++){var u=s[c];"protocol"!==u&&(r[u]=e[u])}return p3e[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!p3e[e.protocol]){for(var l=Object.keys(e),d=0;d<l.length;d++){var f=l[d];r[f]=e[f]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||f3e[e.protocol])r.pathname=e.pathname;else{for(n=(e.pathname||"").split("/");n.length&&!(e.host=n.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==n[0]&&n.unshift(""),n.length<2&&n.unshift(""),r.pathname=n.join("/")}if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var p=r.pathname||"",h=r.search||"";r.path=p+h}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var m,y=r.pathname&&"/"===r.pathname.charAt(0),b=e.host||e.pathname&&"/"===e.pathname.charAt(0),g=b||y||r.host&&e.pathname,v=g,w=r.pathname&&r.pathname.split("/")||[],T=r.protocol&&!p3e[r.protocol];if(n=e.pathname&&e.pathname.split("/")||[],T&&(r.hostname="",r.port=null,r.host&&(""===w[0]?w[0]=r.host:w.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===n[0]?n[0]=e.host:n.unshift(e.host)),e.host=null),g=g&&(""===n[0]||""===w[0])),b)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,w=n;else if(n.length)w||(w=[]),w.pop(),w=w.concat(n),r.search=e.search,r.query=e.query;else if(null!=e.search)return T&&(r.hostname=r.host=w.shift(),(m=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=m.shift(),r.host=r.hostname=m.shift())),r.search=e.search,r.query=e.query,dv(r.pathname)&&dv(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!w.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var E=w.slice(-1)[0],A=(r.host||e.host||w.length>1)&&("."===E||".."===E)||""===E,x=0,O=w.length;O>=0;O--)"."===(E=w[O])?w.splice(O,1):".."===E?(w.splice(O,1),x++):x&&(w.splice(O,1),x--);if(!g&&!v)for(;x--;x)w.unshift("..");!g||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),A&&"/"!==w.join("/").substr(-1)&&w.push("");var C=""===w[0]||w[0]&&"/"===w[0].charAt(0);return T&&(r.hostname=r.host=C?"":w.length?w.shift():"",(m=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=m.shift(),r.host=r.hostname=m.shift())),(g=g||r.host&&w.length)&&!C&&w.unshift(""),w.length?r.pathname=w.join("/"):(r.pathname=null,r.path=null),dv(r.pathname)&&dv(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},e3e.prototype.parseHost=function(){return b3e(this)};const g3e=e=>({position:"relative",maxWidth:"420px",height:"565px",borderRadius:"base.borderRadius.x6",overflow:"hidden",marginLeft:"base.spacing.x2",marginRight:"base.spacing.x2",marginBottom:"base.spacing.x2",display:e?"block":"none"}),v3e=e=>({display:e?"block":"none"});var w3e,T3e,E3e,A3e;!function(e){e.TRANSAK_WIDGET_OPEN="TRANSAK_WIDGET_OPEN",e.TRANSAK_ORDER_CREATED="TRANSAK_ORDER_CREATED",e.TRANSAK_ORDER_SUCCESSFUL="TRANSAK_ORDER_SUCCESSFUL",e.TRANSAK_ORDER_FAILED="TRANSAK_ORDER_FAILED"}(w3e||(w3e={})),function(e){e.PROCESSING="PROCESSING",e.COMPLETED="COMPLETED"}(T3e||(T3e={})),function(e){e.TRANSAK_WIDGET_INITIALISED="TRANSAK_WIDGET_INITIALISED",e.TRANSAK_WIDGET_OPEN="TRANSAK_WIDGET_OPEN",e.TRANSAK_ORDER_CREATED="TRANSAK_ORDER_CREATED",e.TRANSAK_ORDER_SUCCESSFUL="TRANSAK_ORDER_SUCCESSFUL",e.TRANSAK_ORDER_FAILED="TRANSAK_ORDER_FAILED"}(E3e||(E3e={})),function(e){e.PROCESSING="PROCESSING",e.COMPLETED="COMPLETED"}(A3e||(A3e={}));const x3e=["global.transak.com","global-stg.transak.com"],O3e={[E3e.TRANSAK_WIDGET_OPEN]:{screen:"InputScreen",control:"TransakWidgetOpen",controlType:"IframeEvent"},[E3e.TRANSAK_ORDER_CREATED]:{screen:"InputScreen",control:"OrderCreated",controlType:"IframeEvent"},[`${E3e.TRANSAK_ORDER_SUCCESSFUL}${A3e.PROCESSING}`]:{screen:"OrderInProgress",control:"PaymentProcessing",controlType:"IframeEvent"},[`${E3e.TRANSAK_ORDER_SUCCESSFUL}${A3e.COMPLETED}`]:{screen:"Success",control:"PaymentCompleted",controlType:"IframeEvent"},[E3e.TRANSAK_ORDER_FAILED]:{screen:"Failure",control:"PaymentFailed",controlType:"IframeEvent"}},C3e=e=>{const{track:t}=OPe(),{userJourney:n,ref:r,walletAddress:i,isPassportWallet:a,failedToLoadTimeoutInMs:o,onFailedToLoad:s}=e,[c,u]=uV.useState(!1),l=o||1e4,d=uV.useRef(void 0),f=uV.useCallback((e=>{const r=e.event_id,o=[E3e.TRANSAK_ORDER_SUCCESSFUL].includes(r)?`${r}${e.data.status}`:r,s=O3e?.[o]||{};Object.keys(s).length>=0&&t({...s,userJourney:n,extras:{walletAddress:i,isPassportWallet:a}})}),[]),p=uV.useCallback((t=>{switch(t.event_id){case E3e.TRANSAK_WIDGET_INITIALISED:(t=>{u(!0),clearTimeout(d.current),d.current=void 0,e.onInit?.(t)})(t.data);break;case E3e.TRANSAK_WIDGET_OPEN:e.onOpen?.(t.data);break;case E3e.TRANSAK_ORDER_CREATED:e.onOrderCreated?.(t.data);break;case E3e.TRANSAK_ORDER_SUCCESSFUL:t.data.status===A3e.PROCESSING&&e.onOrderProcessing?.(t.data),t.data.status===A3e.COMPLETED&&e.onOrderCompleted?.(t.data);break;case E3e.TRANSAK_ORDER_FAILED:e.onOrderFailed?.(t.data)}}),[]),h=uV.useCallback((e=>{const t=h3e(e.origin)?.host?.toLowerCase();e.source===r?.current?.contentWindow&&t&&x3e.includes(t)&&(f(e.data),p(e.data),console.log("@@@ Transak event",e))}),[r]);return uV.useEffect((()=>(window.addEventListener("message",h),()=>{clearTimeout(d.current),window.removeEventListener("message",h)})),[]),{initialised:c,onLoad:()=>{void 0!==s&&(void 0!==d.current||c||(d.current=setTimeout((()=>{c||s()}),l)))}}},I3e="transak-iframe",_3e=6e3;function P3e({passport:e,showIframe:t,tokenAmount:n,tokenAddress:r}){const{connectLoaderState:i}=uV.useContext(jRe),{checkout:a,provider:o}=i,{eventTargetState:{eventTarget:s}}=uV.useContext(zqe),{t:c}=_ke(),{viewState:u,viewDispatch:l}=uV.useContext(ERe),[d,f]=uV.useState(""),p=uV.useRef(),h=!!e&&o?.provider?.isPassport,m=uV.useMemo((()=>u.history.length>2&&u.history[u.history.length-2].type===vRe.TOP_UP_VIEW),[u.history]),{track:y}=OPe();return uV.useEffect((()=>{if(!a||!o)return;let t="";(async()=>{const i={exchangeType:cW.ONRAMP,web3Provider:o,tokenAddress:r,tokenAmount:n,passport:e};f(await a.createFiatRampUrl(i)),t=await o.getSigner().getAddress()})();const i=document.getElementById(I3e);if(!i)return;window.addEventListener("message",(e=>{if(!i)return;const a=$8e.parse(e.origin)?.host?.toLowerCase();e.source===i.contentWindow&&a&&x3e.includes(a)&&((async(e,t)=>{const n={userId:t.toLowerCase(),isPassportWallet:h};switch(e.event_id){case w3e.TRANSAK_WIDGET_OPEN:y({userJourney:bPe.ON_RAMP,screen:"InputScreen",control:"TransakWidgetOpen",controlType:"IframeEvent",extras:{...n}});break;case w3e.TRANSAK_ORDER_CREATED:y({userJourney:bPe.ON_RAMP,screen:"InputScreen",control:"OrderCreated",controlType:"IframeEvent",extras:{...n}});break;case w3e.TRANSAK_ORDER_SUCCESSFUL:e.data.status===T3e.PROCESSING&&y({userJourney:bPe.ON_RAMP,screen:"OrderInProgress",control:"PaymentProcessing",controlType:"IframeEvent",extras:{...n}}),e.data.status===T3e.COMPLETED&&y({userJourney:bPe.ON_RAMP,screen:"Success",control:"PaymentCompleted",controlType:"IframeEvent",extras:{...n}});break;case w3e.TRANSAK_ORDER_FAILED:y({userJourney:bPe.ON_RAMP,screen:"Failure",control:"PaymentFailed",controlType:"IframeEvent",extras:{...n}})}})(e.data,t),(e=>{if(p.current&&clearTimeout(p.current),e.event_id!==w3e.TRANSAK_WIDGET_OPEN)return e.event_id===w3e.TRANSAK_ORDER_SUCCESSFUL&&e.data.status===T3e.PROCESSING?(l({payload:{type:TRe.UPDATE_VIEW,view:{type:w8e.IN_PROGRESS_LOADING}}}),void(p.current=window.setTimeout((()=>{l({payload:{type:TRe.UPDATE_VIEW,view:{type:w8e.IN_PROGRESS}}})}),_3e))):void(e.event_id!==w3e.TRANSAK_ORDER_SUCCESSFUL||e.data.status!==T3e.COMPLETED?e.event_id===w3e.TRANSAK_ORDER_FAILED&&l({payload:{type:TRe.UPDATE_VIEW,view:{type:w8e.FAIL,data:{amount:n,tokenAddress:r},reason:`Transaction failed: ${e.data.statusReason}`}}}):l({payload:{type:TRe.UPDATE_VIEW,view:{type:w8e.SUCCESS,data:{transactionHash:e.data.transactionHash}}}}));l({payload:{type:TRe.UPDATE_VIEW,view:{type:w8e.ONRAMP,data:{amount:u.view.data?.amount??n,tokenAddress:u.view.data?.tokenAddress??r}}}})})(e.data))}))}),[a,o,n,r,e]),Cq(N3,{sx:v3e(t),children:Cq(_Pe,{header:Cq(xRe,{showBack:m,title:c("views.ONRAMP.header.title"),onCloseButtonClick:()=>sKe(s)}),footerBackgroundColor:"base.color.translucent.emphasis.200",children:Cq(N3,{sx:g3e(t),children:Cq("iframe",{title:"Transak",id:I3e,src:d,allow:"camera;microphone;fullscreen;payment",style:{height:"100%",width:"100%",border:"none",position:"absolute"}})})})})}function S3e(){const{eventTargetState:{eventTarget:e}}=uV.useContext(zqe),{t:t}=_ke();return Cq(_Pe,{testId:"order-in-progress-view",header:Cq(xRe,{transparent:!0,onCloseButtonClick:()=>sKe(e)}),footer:Cq(oNe,{}),heroContent:Cq(p8e,{}),floatHeader:!0,children:Iq(RRe,{heading:t("views.ONRAMP.IN_PROGRESS.content.heading"),children:[t("views.ONRAMP.IN_PROGRESS.content.body1"),Cq("br",{}),Cq("br",{}),t("views.ONRAMP.IN_PROGRESS.content.body2")]})})}function k3e({amount:e,tokenAddress:t,config:n}){const{isOnRampEnabled:r,isSwapEnabled:i,isBridgeEnabled:a}=n,[o,s]=uV.useReducer(ARe,{...wRe,history:[]}),c=uV.useMemo((()=>({viewState:o,viewDispatch:s})),[o,ARe]),{connectLoaderState:u}=uV.useContext(jRe),{checkout:l,provider:d}=u,[f,p]=uV.useState(t),{eventTargetState:{eventTarget:h}}=uV.useContext(zqe),{t:m}=_ke(),y=uV.useMemo((()=>o.view.type===w8e.ONRAMP),[o.view.type]);return uV.useEffect((()=>{l&&d&&(async()=>{if(!(await l.getNetworkInfo({provider:d})).isSupported)return;const e=f?.toLocaleLowerCase()===Nke?Nke:t;p(e)})()}),[l,d,s]),Iq(ERe.Provider,{value:c,children:[o.view.type===vRe.LOADING_VIEW&&Cq(PPe,{loadingText:m("views.ONRAMP.initialLoadingText")}),o.view.type===w8e.IN_PROGRESS_LOADING&&Cq(PPe,{loadingText:m("views.ONRAMP.IN_PROGRESS_LOADING.loading.text")}),o.view.type===w8e.IN_PROGRESS&&Cq(S3e,{}),o.view.type===w8e.SUCCESS&&Cq(Lqe,{statusText:m("views.ONRAMP.SUCCESS.text"),actionText:m("views.ONRAMP.SUCCESS.actionText"),onRenderEvent:()=>cKe(h,o.view.data.transactionHash),onActionClick:()=>sKe(h),statusType:_qe.SUCCESS,testId:"success-view"}),o.view.type===w8e.FAIL&&Cq(Lqe,{statusText:m("views.ONRAMP.FAIL.text"),actionText:m("views.ONRAMP.FAIL.actionText"),onRenderEvent:()=>uKe(h,o.view.reason??"Transaction failed"),onActionClick:()=>{s({payload:{type:TRe.UPDATE_VIEW,view:{type:w8e.ONRAMP,data:o.view.data}}})},statusType:_qe.FAILURE,onCloseClick:()=>sKe(h),testId:"fail-view"}),o.view.type!==w8e.SUCCESS&&o.view.type!==w8e.FAIL&&Cq(P3e,{passport:l?.passport,showIframe:y,tokenAmount:e??o.view.data?.amount,tokenAddress:f??o.view.data?.tokenAddress}),o.view.type===vRe.TOP_UP_VIEW&&Cq(A8e,{analytics:{userJourney:bPe.ON_RAMP},widgetEvent:kH.IMTBL_ONRAMP_WIDGET_EVENT,checkout:l,provider:d,showOnrampOption:r,showSwapOption:i,showBridgeOption:a,onCloseButtonClick:()=>sKe(h)})]})}var R3e=Object.freeze({__proto__:null,default:k3e});const N3e={walletProviderName:null,network:null,tokenBalances:[],supportedTopUps:null,walletConfig:{showDisconnectButton:!0,showNetworkMenu:!0}};var M3e;!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"}(M3e||(M3e={}));const D3e=uV.createContext({walletState:N3e,walletDispatch:()=>{}});D3e.displayName="WalletContext";const L3e=(e,t)=>{switch(t.payload.type){case M3e.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case M3e.SET_NETWORK:return{...e,network:t.payload.network};case M3e.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case M3e.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}},j3e=async(e,t)=>{const n=await e.getTokenAllowList({type:ZH.ALL,chainId:t}),r=new Set;return n.tokens.forEach((e=>{r.add(e.symbol)})),Array.from(r)},F3e={display:"flex",flexDirection:"row",justifyContent:"space-between",paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"},B3e={display:"flex",direction:"row",columnGap:"base.spacing.x1",alignItems:"center"},U3e={height:"base.icon.size.250",width:"base.icon.size.250",minWidth:"base.icon.size.250",fill:"base.color.accent.4",cursor:"pointer"};var z3e;function H3e(e){const{t:t}=_ke(),{viewDispatch:n}=uV.useContext(ERe),{totalBalance:r,loading:i}=e;return Iq(N3,{sx:F3e,children:[Iq(N3,{sx:B3e,children:[Cq(tee,{size:"medium",children:t("views.WALLET_BALANCES.totalTokenBalance.heading")}),Cq(N3,{sx:{pl:"base.spacing.x1"},children:Cq(d4,{testId:"coin-info-icon",variant:"tertiary",icon:"Information",sx:U3e,onClick:()=>n({payload:{type:TRe.UPDATE_VIEW,view:{type:z3e.COIN_INFO}}})})})]}),Iq(N3,{sx:B3e,children:[Cq(tee,{testId:"total-token-balance-value",weight:"bold",shimmer:i?1:0,shimmerSx:{minw:"100px"},children:t("views.WALLET_BALANCES.totalTokenBalance.totalHeading")}),!i&&Iq(tee,{testId:"total-token-balance",weight:"bold",children:["≈ USD $",r.toFixed(2)]})]})]})}!function(e){e.WALLET_BALANCES="WALLET_BALANCES",e.SETTINGS="SETTINGS",e.COIN_INFO="COIN_INFO",e.SUCCESS="SUCCESS",e.FAIL="FAIL"}(z3e||(z3e={}));const W3e=e=>({display:e?"":"none"});function V3e({balanceInfo:e,theme:t,bridgeToL2OnClick:n}){const{connectLoaderState:r}=uV.useContext(jRe),{track:i}=OPe(),{checkout:a,provider:o}=r,s=`≈ USD $${HRe(e.fiatAmount)}`,{walletState:c}=uV.useContext(D3e),{supportedTopUps:u,network:l}=c,[d,f]=uV.useState(),[p,h]=uV.useState(),[m,y]=uV.useState(),{eventTargetState:{eventTarget:b}}=uV.useContext(zqe),[g,v]=uV.useState([]),w=fNe(o);uV.useEffect((()=>{(async()=>{if(!a)return;const e=await a.getTokenAllowList({type:ZH.ONRAMP,chainId:Qke(a.config)});v(e.tokens)})()}),[a]),uV.useEffect((()=>{if(!l||!u||!a)return;const e=l.chainId===Qke(a.config)&&(u?.isOnRampEnabled??!0);f(e);const t=(l.chainId===Jke(a.config)||l.chainId===Qke(a.config))&&(u?.isBridgeEnabled??!0);h(t);const n=l.chainId===Qke(a.config)&&(u?.isSwapEnabled??!0)&&(u?.isSwapAvailable??!0);y(n)}),[l,u,a,w]);const T=uV.useMemo((()=>Boolean(d&&g.length>0&&g.find((t=>t.address?.toLowerCase()===e.address?.toLowerCase())))),[d,g]);return Iq(oae,{testId:`balance-item-${e.symbol}`,emphasized:!0,children:[Cq(oae.FramedImage,{use:Cq(a2e,{theme:t,src:e.icon,name:e.symbol,environment:a?.config.environment??Xt.PRODUCTION}),circularFrame:!0}),Cq(oae.Label,{children:e.symbol}),Cq(oae.Caption,{children:e.description}),Cq(oae.PriceDisplay,{testId:`balance-item-${e.symbol}`,use:Cq(qee,{size:"xSmall"}),price:VRe(e.balance),fiatAmount:s}),(d||m||p)&&Iq(oae.OverflowPopoverMenu,{size:"small",testId:"token-menu",onClick:()=>{i({userJourney:bPe.WALLET,screen:"WalletBalances",control:"BalanceItem",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}})},children:[Iq(oae,{testId:"balance-item-add-option",sx:W3e(T),onClick:()=>{i({userJourney:bPe.WALLET,screen:"WalletBalances",control:"AddTokens",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}}),$qe.sendRequestOnrampEvent(b,kH.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:e.address??"",amount:""})},children:[Cq(oae.Icon,{icon:"Add"}),Cq(oae.Label,{children:`Add ${e.symbol}`})]}),Iq(oae,{testId:"balance-item-swap-option",sx:W3e(m),onClick:()=>{i({userJourney:bPe.WALLET,screen:"WalletBalances",control:"SwapTokens",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}}),$qe.sendRequestSwapEvent(b,kH.IMTBL_WALLET_WIDGET_EVENT,{fromTokenAddress:e.address??"",toTokenAddress:"",amount:""})},children:[Cq(oae.Icon,{icon:"Exchange"}),Cq(oae.Label,{children:`Swap ${e.symbol}`})]}),Iq(oae,{testId:"balance-item-move-option",sx:W3e(p),onClick:()=>{i({userJourney:bPe.WALLET,screen:"WalletBalances",control:"MoveTokens",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}}),n(e.address)},children:[Cq(oae.Icon,{icon:"Minting"}),Cq(oae.Label,{children:`Move ${e.symbol}`})]})]})]})}const G3e={width:"100%",height:"100%",display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},q3e={width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},K3e=e=>e.filter((e=>"0.0"!==e.balance||KRe(e.address)));function X3e({balanceInfoItems:e,theme:t,bridgeToL2OnClick:n}){const{t:r}=_ke(),i=K3e(e);return Iq(N3,{sx:G3e,children:[0===i.length&&Cq(N3,{sx:q3e,children:Cq(tee,{testId:"no-tokens-found",children:r("views.WALLET_BALANCES.tokenBalancesList.noTokensFound")})}),i.map((e=>Cq(V3e,{balanceInfo:e,bridgeToL2OnClick:n,theme:t},e.id)))]})}const Y3e={display:"flex",flexDirection:"column",alignItems:"flex-start",paddingTop:"base.spacing.x4"},Z3e={fontWeight:"base.text.caption.small.bold.fontWeight",borderColor:"base.color.translucent.emphasis.1000",borderStyle:"solid",borderWidth:"base.border.size.200"},J3e={fontWeight:"base.text.caption.small.bold.fontWeight"},Q3e=e=>({width:"22px",filter:e?void 0:"grayscale(1)"}),$3e={paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"};function e4e(){const{t:e}=_ke(),{connectLoaderState:t}=uV.useContext(jRe),{eventTargetState:{eventTarget:n}}=uV.useContext(zqe),{checkout:r,provider:i}=t,{viewDispatch:a}=uV.useContext(ERe),{walletState:o,walletDispatch:s}=uV.useContext(D3e),{network:c}=o,[u,l]=uV.useState([]),{track:d}=OPe(),f=uV.useCallback((async e=>{if(r&&i&&c&&c.chainId!==e){d({userJourney:bPe.WALLET,screen:"WalletBalances",control:"SwitchNetwork",controlType:"Button",extras:{chainId:e}});try{const t=await r.switchNetwork({provider:i,chainId:e});!function(e,t,n){const r=new CustomEvent(kH.IMTBL_WALLET_WIDGET_EVENT,{detail:{type:MH.NETWORK_SWITCH,data:{network:n.name,chainId:n.chainId,provider:t}}});console.log("switch network event:",e,r),void 0!==e&&e.dispatchEvent(r)}(n,t.provider,t.network)}catch(e){e.type===uW.USER_REJECTED_REQUEST_ERROR||a({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.ERROR_VIEW,error:e}}})}}}),[r,i,c,s,a]);return uV.useEffect((()=>{(async()=>{if(r){const e=await r.getNetworkAllowList({type:YH.ALL});l(e?.networks??[])}else l([])})()}),[r]),Iq(N3,{testId:"network-menu",sx:Y3e,children:[Cq(tee,{testId:"network-heading",size:"medium",sx:$3e,children:e("views.WALLET_BALANCES.networkStatus.heading")}),Cq(sue,{children:r&&u?.sort(((e,t)=>URe(e,t,r.config))).map((e=>Iq(sue.Button,{testId:`${e.name}-network-button`,sx:e.chainId===c?.chainId?Z3e:J3e,size:"small",onClick:()=>f(e.chainId),children:[Cq(i7,{sx:Q3e(e.chainId===c?.chainId),use:Cq("img",{src:ZRe(r?.config.environment,e.chainId),alt:e.name})}),e.name]},e.chainId)))})]})}const t4e={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x2",flex:1},n4e={backgroundColor:"base.color.neutral.800",paddingX:"base.spacing.x1",borderRadius:"base.borderRadius.x6",flex:1},r4e={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},i4e=(e,t)=>{let n=460;e&&(n-=104),t&&(n-=98);return{height:`${n}px`,overflowY:"auto",borderRadius:"base.borderRadius.x6"}},a4e=async(e,t,n)=>{if(!e||!t||!n)return[];const r=await t.getSigner().getAddress(),i=await x8e((()=>e.getAllBalances({provider:t,walletAddress:r,chainId:n})),Uke);if(!i)return[];const a=((e,t,n)=>t.sort(((t,r)=>n===Qke(e)&&"imx"===t.token.symbol.toLowerCase()&&"imx"!==r.token.symbol.toLowerCase()?-1:n===Qke(e)&&"imx"===r.token.symbol.toLowerCase()&&"imx"!==t.token.symbol.toLowerCase()||t.balance.lt(r.balance)?1:t.balance.gt(r.balance)?-1:0)))(e.config,i.balances,n).map((t=>({...t,token:{...t.token,icon:JRe(e.config.environment,KRe(t.token.address)?t.token.symbol:t.token.address??"")}})));return a},o4e=(e,t,n)=>n?`${e.toString()}-${t.toLowerCase()}-${n.toLowerCase()}`:`${e.toString()}-${t.toLowerCase()}`,s4e=(e,t,n)=>t.map((t=>({id:o4e(e,t.token.symbol,t.token.address),balance:t.formattedBalance,fiatAmount:zRe(t.formattedBalance,t.token.symbol,n),symbol:t.token.symbol,address:t.token.address,description:t.token.name,icon:t.token.icon})));function c4e({balancesLoading:e,theme:t,showNetworkMenu:n}){const{t:r}=_ke(),{connectLoaderState:i}=uV.useContext(jRe),{checkout:a,provider:o}=i,{cryptoFiatState:s,cryptoFiatDispatch:c}=uV.useContext($6e),{walletState:u}=uV.useContext(D3e),{eventTargetState:{eventTarget:l}}=uV.useContext(zqe),{viewDispatch:d}=uV.useContext(ERe),[f,p]=uV.useState(0),{network:h,supportedTopUps:m,tokenBalances:y}=u,{conversions:b}=s,g=!fNe(o)&&n,{track:v,page:w}=OPe(),T=uV.useMemo((()=>s4e(h?.chainId,y,b)),[y,b,h?.chainId]);uV.useEffect((()=>{w({userJourney:bPe.WALLET,screen:"WalletBalances"})}),[]),uV.useEffect((()=>{(async()=>{if(!a)return;if(!c)return;if(!h)return;const e=await j3e(a,h.chainId);c({payload:{type:Q6e.SET_TOKEN_SYMBOLS,tokenSymbols:e}})})()}),[a,c,h?.chainId]),uV.useEffect((()=>{let e=0;T.forEach((t=>{const n=parseFloat(t.fiatAmount);Number.isNaN(n)||(e+=n)})),p(e)}),[T]);const E=uV.useMemo((()=>!(!a||!h)&&(h.chainId===Qke(a.config)&&Boolean(m?.isBridgeEnabled||m?.isSwapEnabled||m?.isOnRampEnabled))),[a,h,m]);return Cq(_Pe,{testId:"wallet-balances",header:Cq(xRe,{title:r("views.WALLET_BALANCES.header.title"),rightActions:Cq(d4,{icon:"SettingsCog",sx:gRe(),iconVariant:"bold",onClick:()=>{v({userJourney:bPe.WALLET,screen:"WalletBalances",control:"Settings",controlType:"Button"}),d({payload:{type:TRe.UPDATE_VIEW,view:{type:z3e.SETTINGS}}})},testId:"settings-button"}),onCloseButtonClick:()=>fKe(l)}),footer:Cq(oNe,{}),children:Iq(N3,{sx:t4e,children:[Iq(N3,{sx:n4e,children:[g&&Cq(e4e,{}),Cq(H3e,{totalBalance:f,loading:e}),Iq(N3,{sx:i4e(g,E),children:[e&&Iq(N3,{sx:r4e,children:[Cq(oae,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),Cq(oae,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"}),Cq(oae,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--3"})]}),!e&&Cq(X3e,{balanceInfoItems:T,bridgeToL2OnClick:e=>{$qe.sendRequestBridgeEvent(l,kH.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:e??"",amount:""})},theme:t})]})]}),E&&Iq(oae,{testId:"add-coins",emphasized:!0,onClick:()=>{v({userJourney:bPe.WALLET,screen:"WalletBalances",control:"AddCoins",controlType:"Button"}),d({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.TOP_UP_VIEW}}})},children:[Cq(oae.FramedIcon,{icon:"Add"}),Cq(oae.Label,{children:r("views.WALLET_BALANCES.addCoins")})]})]})})}function u4e(e){switch(e){case $H.METAMASK:return"MetaMaskSymbol";case $H.PASSPORT:return"PassportSymbolOutlined";case"walletconnect":return"WalletConnectSymbol";default:return"MetaMaskSymbol"}}const l4e={background:"base.color.status.success.bright",fill:"base.color.status.success.bright"},d4e={fill:"base.color.fixed.black.1000"};function f4e({provider:e,showL1Warning:t,setShowL1Warning:n}){const[r,i]=uV.useState(""),[a,o]=uV.useState(!1),{t:s}=_ke(),{track:c}=OPe(),u=uV.useMemo((()=>fNe(e)&&!t?"ShowPassword":a?"Tick":"CopyText"),[e,t,a]);uV.useEffect((()=>{e&&""===r&&(async()=>{const t=await e.getSigner().getAddress();i(t)})()}),[e,r]);return Iq(oae,{testId:"wallet-address",emphasized:!0,size:"medium",children:[Cq(oae.FramedLogo,{logo:u4e(mNe(e)),sx:{backgroundColor:"base.color.translucent.standard.200"}}),Cq(d4,{variant:"tertiary",iconVariant:"bold",size:"small",icon:u,iconSx:{...a?d4e:{}},onClick:async()=>{r&&"CopyText"===u?(c({userJourney:bPe.WALLET,screen:"Settings",control:"CopyWalletAddress",controlType:"Button"}),navigator.clipboard.writeText(r),o(!0),setTimeout((()=>o(!1)),1e3)):"ShowPassword"===u&&n(!0)},sx:{cursor:"pointer",...a?l4e:{}}}),Cq(oae.Label,{children:s("views.SETTINGS.walletAddress.label")}),Cq(oae.Caption,{testId:"wallet-address",children:$Re(r)})]})}const p4e={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x4"},h4e={marginTop:"32px"};function m4e(){return Cq(N3,{testId:"transfer-assets-l1-warning-hero",sx:{display:"flex",justifyContent:"center",padding:"base.spacing.x4"},children:Cq(N3,{children:Iq("svg",{xmlns:"http://www.w3.org/2000/svg",width:"135",height:"137",viewBox:"0 0 135 137",fill:"none",children:[Cq("path",{d:"M76.2361 65.9046L76.5095 17.3023C76.5157 15.9172 76.0711 14.9946 75.3435 14.6207C74.0964 13.9799 72.9093 14.4957 71.4798 15.3728L29.2306 41.5137L28.3702 98.7706L76.2398 65.9035L76.2361 65.9046Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M85.4571 126.862L85.791 76.8509C85.8102 74.0184 83.742 70.6325 81.1983 69.3267L47.8586 51.3375C46.7068 50.7462 45.739 49.8676 45.0526 48.788L43.4726 46.3043C42.7862 45.2247 41.8184 44.3461 40.6665 43.7548L36.2848 41.5054L31.2783 42.6987L30.909 101.567C30.9861 102.57 31.6727 103.52 32.9446 104.173L80.2378 129.343L81.6163 131.639L84.2802 129.667L84.2754 129.664C85.0031 129.123 85.4546 128.164 85.4632 126.862L85.4571 126.862Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M83.1421 78.7933C83.1612 75.96 81.0925 72.5732 78.5483 71.267L30.2174 45.562C28.8517 44.8609 28.1628 43.8191 28.1721 42.7358L27.7773 103.281C27.8544 104.284 28.5413 105.234 29.8134 105.887L78.1443 131.592C80.6909 132.9 82.7889 131.652 82.8068 128.821L83.1408 78.7956L83.1421 78.7933Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M36.8699 42.6587C36.8641 43.5432 35.5341 44.2721 33.9017 44.2823C32.2694 44.2925 30.9508 43.5854 30.9555 42.6973C30.9602 41.8091 32.2913 41.0838 33.9237 41.0736C34.7155 41.0681 35.4328 41.2334 35.963 41.5055C36.5244 41.7937 36.8726 42.2027 36.8699 42.6587Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M35.2866 42.6695C35.284 43.0802 34.6673 43.4179 33.9096 43.4227C33.1519 43.4276 32.5394 43.098 32.5419 42.6874C32.5445 42.2767 33.1612 41.939 33.9189 41.9342C34.2856 41.9315 34.6182 42.0084 34.8653 42.1352C35.1268 42.2695 35.288 42.4582 35.2853 42.6719L35.2866 42.6695Z",fill:"black"}),Cq("path",{d:"M70.9275 14.9238L29.4561 40.1902C28.389 40.9925 27.8611 41.9567 27.8526 42.8886C27.8526 42.8886 27.6951 44.5777 29.8905 45.7049C32.0859 46.832 34.8391 48.2668 34.8391 48.2668L36.1919 47.4119L31.26 44.8586C29.3491 43.8775 28.9381 42.1986 30.6697 40.8949L72.2083 15.5784C73.3784 14.6992 74.4371 14.4968 75.1905 14.8835C75.1905 14.8835 72.8927 13.4441 70.9288 14.9215L70.9275 14.9238Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M81.0605 110.741L83.1092 111.399L85.7093 118.337L85.7797 107.796L81.2805 106.491L81.0605 110.741Z",fill:"black"}),Cq("path",{d:"M83.1104 113.492C83.1312 110.487 84.073 109.095 87.3742 109.652C89.1483 109.952 90.9444 109.879 92.6948 109.428L96.5484 108.436C99.8885 107.577 102.639 104.113 102.664 100.741C102.686 97.3675 99.9706 95.3116 96.6329 96.1724L91.9518 97.3781C90.3645 97.7883 88.6894 97.6786 87.181 97.0768C84.1103 95.8485 83.2401 94.5701 83.2615 91.3841L81.2915 93.3582L74.7155 111.72L83.1115 113.496L83.1104 113.492Z",fill:"#F3F3F3"}),Cq("path",{d:"M83.1053 113.501C83.1261 110.496 84.0681 109.104 87.3701 109.661C89.1445 109.961 90.9411 109.888 92.6918 109.437L96.5463 108.445C99.8871 107.585 102.638 104.12 102.663 100.747C102.685 97.3736 99.9692 95.3172 96.6308 96.1782L91.9487 97.3841C90.361 97.7944 88.6855 97.6847 87.1768 97.0828C84.1055 95.8542 83.2351 94.5755 83.2564 91.3888",stroke:"black",strokeWidth:"1.33831",strokeMiterlimit:"10"}),Cq("path",{d:"M100.563 99.4451C99.4403 98.3218 97.1152 98.7714 95.3661 100.45C93.6171 102.129 93.1092 104.399 94.2323 105.522L94.7567 106.048L101.088 99.9711L100.563 99.4451Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M99.9733 105.056C101.727 103.381 102.236 101.114 101.111 99.9926C99.986 98.8713 97.6528 99.3204 95.8996 100.996C94.1464 102.671 93.637 104.938 94.762 106.059C95.8869 107.18 98.2201 106.731 99.9733 105.056Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M51.6986 91.7452C50.6642 91.2142 49.827 89.8416 49.8336 88.6901L49.9893 65.7522C49.9984 64.6019 50.8483 64.0955 51.8828 64.6265L72.5076 75.205C73.542 75.736 74.3793 77.1086 74.3726 78.2601L74.2169 101.198C74.2079 102.348 73.3579 102.855 72.3235 102.324L51.6986 91.7452Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M52.7617 91.0867C51.7272 90.5557 50.89 89.1831 50.8966 88.0315L51.0523 65.0931C51.0553 64.8339 51.101 64.6088 51.1799 64.4189C50.4902 64.3771 49.9962 64.8783 49.9906 65.7516L49.8349 88.69C49.8259 89.8403 50.6655 91.2142 51.7 91.7452L72.3252 102.324C73.1244 102.734 73.8145 102.522 74.0887 101.871C73.8709 101.859 73.6341 101.792 73.3845 101.664L52.7593 91.0855L52.7617 91.0867Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M66.9055 85.8915L66.8883 88.4023L64.3853 87.1169L61.8847 85.8328L59.3817 84.5474L57.6065 83.6358C57.2078 83.4311 56.8773 83.5922 56.875 83.9917L56.8689 85.042C56.8653 85.4439 57.1906 85.9418 57.5917 86.1478L59.3669 87.0594L61.8699 88.3448L61.8577 90.1235C61.8541 90.5254 62.1807 91.0209 62.5818 91.2269L63.6292 91.7647C64.0279 91.9695 64.3584 91.8083 64.362 91.4064L64.3742 89.6277L66.8772 90.9131L68.6523 91.8247C69.0511 92.0295 69.3829 91.8659 69.3852 91.4664L69.3974 89.6877L69.4095 87.909C69.4131 87.5071 69.0866 87.0116 68.6854 86.8056L66.9103 85.894L66.9055 85.8915Z",fill:"white"}),Cq("path",{d:"M59.3703 79.5438L59.3581 81.3271C59.3569 81.7313 59.6802 82.2293 60.0844 82.4371L61.862 83.3511L64.3662 84.6386L66.8728 85.9274L66.8862 84.1416C66.8874 83.7374 66.5641 83.2394 66.16 83.0316L64.3823 82.1176L61.8781 80.8301L59.3716 79.5414L59.3703 79.5438Z",fill:"white"}),Cq("path",{d:"M62.6235 73.7033C62.2248 73.4985 61.8943 73.6597 61.892 74.0592L61.8798 75.8379L59.3768 74.5525L57.6016 73.641C57.2029 73.4362 56.8724 73.5973 56.8688 73.9992L56.8566 75.7779L56.8445 77.5566C56.8409 77.9585 57.1674 78.4541 57.5686 78.6601L59.3437 79.5717L59.3609 77.0609L61.8639 78.3463L64.3645 79.6304L66.8675 80.9157L68.6426 81.8273C69.0414 82.0321 69.3719 81.8709 69.3755 81.469L69.3827 80.4224C69.3838 80.0193 69.061 79.5226 68.6598 79.3166L66.8847 78.405L64.3817 77.1197L64.3938 75.341C64.3974 74.9391 64.0709 74.4435 63.6697 74.2375L62.6224 73.6997L62.6235 73.7033Z",fill:"white"}),Cq("path",{d:"M46.8192 101.66L46.8314 99.6311C46.838 98.841 46.2586 97.8985 45.551 97.5353L42.5478 95.9937L42.5679 93.0481C42.5746 92.258 41.9976 91.3167 41.2875 90.9523L38.7449 89.6471C38.3611 89.4501 38.0161 89.4638 37.7758 89.6403L36.4656 90.6093L37.4387 91.7024L37.4277 93.3685L34.4246 91.827C34.0408 91.63 33.6957 91.6437 33.4554 91.8201L32.1452 92.7891L33.1181 93.8094L33.113 94.6306C33.1063 95.4207 33.6858 96.3632 34.3934 96.7264L37.3965 98.268L37.3764 101.214C37.3698 102.004 37.9468 102.945 38.6568 103.309L39.7002 103.845L40.8571 105.593L42.1673 104.624C42.3691 104.473 42.4965 104.205 42.4976 103.842L42.5177 100.897L44.2088 101.765L45.1822 103.415L46.4924 102.446C46.6966 102.297 46.8216 102.028 46.8227 101.665L46.8192 101.66Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M45.514 102.623L45.5261 100.594C45.5327 99.8036 44.9532 98.8609 44.2455 98.4977L41.2419 96.9558L41.262 94.0097C41.2674 93.2219 40.6916 92.2781 39.9815 91.9135L37.4385 90.6082C36.7284 90.2437 36.1455 90.5927 36.1388 91.3829L36.1187 94.329L33.1151 92.7872C32.405 92.4227 31.8184 92.7728 31.8154 93.5619L31.8033 95.5912C31.7967 96.3815 32.3762 97.3241 33.0839 97.6874L36.0875 99.2293L36.0673 102.175C36.0607 102.966 36.6378 103.907 37.3479 104.272L39.8909 105.577C40.601 105.941 41.1839 105.592 41.1906 104.802L41.2107 101.856L44.2143 103.398C44.9244 103.762 45.511 103.412 45.514 102.623Z",fill:"white",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M55.4177 54.343L85.7278 37.2672L70.5728 15.9224L55.4177 54.343Z",fill:"#FF637F",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M55.4176 54.3431L51.6289 52.2086L66.7839 13.7881L70.5727 15.9226L55.4176 54.3431Z",fill:"#131313",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M69.1528 25.261L71.9944 23.6602V34.3325L69.1528 35.9334V25.261Z",fill:"#131313",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M69.1528 38.0676L71.9944 36.4667V39.6684L69.1528 41.2693V38.0676Z",fill:"#131313",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"})]})})})}function y4e({provider:e,showL1Warning:t,setShowL1Warning:n}){const{t:r}=_ke();return Cq(wne,{size:"full",visible:t,showHeaderBar:!1,children:Iq(wne.Content,{children:[Cq(d4,{icon:"Close",variant:"tertiary",sx:{pos:"absolute",top:"base.spacing.x5",left:"base.spacing.x5",backdropFilter:"blur(30px)"},onClick:()=>n(!1)}),Cq(m4e,{}),Iq(N3,{sx:{px:"base.spacing.x6"},children:[Cq(qee,{sx:{marginTop:"base.spacing.x6",marginBottom:"base.spacing.x2",textAlign:"center"},children:r("views.SETTINGS.transferAssetsL1Warning.heading")}),Cq(tee,{size:"medium",sx:{display:"block",textAlign:"center",color:"base.color.text.body.secondary",marginBottom:"base.spacing.x13"},children:r("views.SETTINGS.transferAssetsL1Warning.body")}),Cq(f4e,{provider:e,showL1Warning:t,setShowL1Warning:n})]})]})})}function b4e({showDisconnectButton:e}){const[t,n]=uV.useState(!1),{t:r}=_ke(),{connectLoaderState:i}=uV.useContext(jRe),{provider:a}=i,{eventTargetState:{eventTarget:o}}=uV.useContext(zqe),{ethereumProvider:s}=aqe(),{page:c}=OPe();uV.useEffect((()=>{c({userJourney:bPe.WALLET,screen:"Settings"})}),[]);return Iq(_Pe,{testId:"wallet-balances",header:Cq(xRe,{showBack:!0,title:r("views.SETTINGS.header.title"),onCloseButtonClick:()=>fKe(o)}),footer:Cq(oNe,{}),children:[Iq(N3,{sx:p4e,children:[Cq(f4e,{provider:a,showL1Warning:t,setShowL1Warning:n}),e&&Cq(O3,{testId:"disconnect-button",variant:"secondary",sx:h4e,onClick:()=>{(async()=>{if(hNe(a))try{if(a.provider?.session){const e=a.provider?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>s?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}return void await a.provider.disconnect()}if(s){const e=s?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>s?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}await s.disconnect()}}catch(e){console.error(e)}})().then((()=>{!function(e){const t=new CustomEvent(kH.IMTBL_WALLET_WIDGET_EVENT,{detail:{type:MH.DISCONNECT_WALLET,data:{}}});console.log("disconnect wallet event:",e,t),void 0!==e&&e.dispatchEvent(t)}(o)}))},children:r("views.SETTINGS.disconnectButton.label")})]}),Cq(y4e,{provider:a,showL1Warning:t,setShowL1Warning:n})]})}function g4e(){return Cq(N3,{sx:{...IRe,background:"base.color.translucent.emphasis.100"},children:Cq(N3,{sx:{...ORe,...CRe},children:Iq("svg",{width:"430",height:"211",viewBox:"0 0 430 211",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Cq("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)"}),Cq("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"}),Cq("path",{d:"M131.005 34.0566L130.576 32.4244L128.944 32.8537L129.373 34.4858L131.005 34.0566Z",fill:"white"}),Cq("path",{d:"M77.1152 45.7678L76.5627 43.6667L74.4617 44.2193L75.0142 46.3203L77.1152 45.7678Z",fill:"white"}),Cq("path",{d:"M264.238 30.1945L262.093 29.8494L261.748 31.9942L263.893 32.3394L264.238 30.1945Z",fill:"white"}),Cq("path",{d:"M348.157 2.3323L348.776 1.04626L347.49 0.427149L346.871 1.71319L348.157 2.3323Z",fill:"white"}),Cq("path",{d:"M342.606 56.5062L342.054 54.4052L339.953 54.9577L340.505 57.0587L342.606 56.5062Z",fill:"white"}),Cq("path",{d:"M348.381 55.0847L349 53.7986L347.714 53.1795L347.095 54.4656L348.381 55.0847Z",fill:"white"}),Cq("path",{d:"M107.606 18.8096L106.681 17.7229L105.594 18.6483L106.52 19.735L107.606 18.8096Z",fill:"white"}),Cq("path",{d:"M233.14 2.3323L233.759 1.04626L232.473 0.427149L231.854 1.71319L233.14 2.3323Z",fill:"white"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("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"}),Cq("defs",{children:Iq("linearGradient",{id:"paint0_linear_4525_125520",x1:"191",y1:"124.403",x2:"247.716",y2:"304.676",gradientUnits:"userSpaceOnUse",children:[Cq("stop",{stopColor:"#AD48BA"}),Cq("stop",{offset:"0.65625",stopColor:"#D178FF",stopOpacity:"0.24"})]})})]})})})}function v4e(){const{t:e}=_ke(),{connectLoaderState:{provider:t}}=uV.useContext(jRe),n=fNe(t),{page:r}=OPe();return uV.useEffect((()=>{r({userJourney:bPe.WALLET,screen:"CoinInfo"})}),[]),Iq(_Pe,{testId:"coin-info",header:Cq(xRe,{showBack:!0,transparent:!0}),footer:Cq(oNe,{}),heroContent:Cq(g4e,{}),floatHeader:!0,children:[!n&&Cq(RRe,{heading:e("views.COIN_INFO.metamask.heading"),children:e("views.COIN_INFO.metamask.body")}),n&&Iq(RRe,{heading:e("views.COIN_INFO.passport.heading"),children:[e("views.COIN_INFO.passport.body1"),Cq(kae,{onClick:()=>window.open(Bke),children:e("views.COIN_INFO.passport.linkText")}),e("views.COIN_INFO.passport.body2")]})]})}var w4e,T4e,E4e,A4e,x4e,O4e,C4e=Object.freeze({__proto__:null,default:function(e){const{t:t}=_ke(),n=t("views.ERROR_VIEW.actionText"),r=t("views.LOADING_VIEW.text"),{eventTargetState:{eventTarget:i}}=uV.useContext(zqe),{config:{environment:a,isOnRampEnabled:o,isSwapEnabled:s,isBridgeEnabled:c,theme:u},walletConfig:{showDisconnectButton:l,showNetworkMenu:d}}=e,{connectLoaderState:{checkout:f,provider:p}}=uV.useContext(jRe),[h,m]=uV.useReducer(ARe,{...wRe,history:[]}),[y,b]=uV.useReducer(L3e,{...N3e,walletConfig:{showDisconnectButton:l,showNetworkMenu:d}}),g=uV.useMemo((()=>({walletState:y,walletDispatch:b})),[y,b]),v=uV.useMemo((()=>({viewState:h,viewDispatch:m})),[h,m]),{balancesLoading:w,refreshBalances:T}=(({checkout:e,provider:t,refreshCallback:n,errorCallback:r})=>{const[i,a]=uV.useState(!0),o=uV.useCallback((async(i=!1)=>{if(e&&t)try{const r=await e.getNetworkInfo({provider:t});if(!r.isSupported)return;i||a(!0);const o=await a4e(e,t,r.chainId);i||a(!1),n(o)}catch(e){Uke.nonRetryable(e)&&r(e),i||a(!1)}}),[e,t]);return N2e((()=>o(!0)),3e4),{balancesLoading:i,refreshBalances:o}})({checkout:f,provider:p,refreshCallback:e=>{b({payload:{type:M3e.SET_TOKEN_BALANCES,tokenBalances:e}})},errorCallback:e=>{console.error(e),m({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.ERROR_VIEW,error:new Error("Unable to fetch balances")}}})}});uV.useEffect((()=>{(async()=>{if(!f)return;let e;try{e=await f.isSwapAvailable()}catch(t){e=!1}b({payload:{type:M3e.SET_SUPPORTED_TOP_UPS,supportedTopUps:{isBridgeEnabled:c,isSwapEnabled:s,isOnRampEnabled:o,isSwapAvailable:e}}})})()}),[c,s,o,a]);const E=async()=>{if(f&&p)try{const e=await f.getNetworkInfo({provider:p});if(!e.isSupported)return;T(),m({payload:{type:TRe.UPDATE_VIEW,view:{type:z3e.WALLET_BALANCES}}}),b({payload:{type:M3e.SET_NETWORK,network:e}})}catch(e){console.error(e),m({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.ERROR_VIEW,error:e}}})}};return uV.useEffect((()=>{f&&p&&E()}),[f,p]),Cq(ERe.Provider,{value:v,children:Cq(d8e,{environment:a,children:Iq(D3e.Provider,{value:g,children:[h.view.type===vRe.LOADING_VIEW&&Cq(PPe,{loadingText:r}),h.view.type===z3e.WALLET_BALANCES&&Cq(c4e,{balancesLoading:w,theme:u,showNetworkMenu:d}),h.view.type===z3e.SETTINGS&&Cq(b4e,{showDisconnectButton:l}),h.view.type===z3e.COIN_INFO&&Cq(v4e,{}),h.view.type===vRe.ERROR_VIEW&&Cq(NRe,{actionText:n,onActionClick:async()=>{m({payload:{type:TRe.UPDATE_VIEW,view:{type:z3e.WALLET_BALANCES}}}),await E()},onCloseClick:()=>fKe(i)}),h.view.type===vRe.TOP_UP_VIEW&&Cq(A8e,{analytics:{userJourney:bPe.WALLET},widgetEvent:kH.IMTBL_WALLET_WIDGET_EVENT,checkout:f,provider:p,showOnrampOption:o,showSwapOption:s,showBridgeOption:c,onCloseButtonClick:()=>fKe(i)})]})})})}});!function(e){e.PAYMENT_METHODS="PAYMENT_METHODS",e.PAY_WITH_COINS="PAY_WITH_COINS",e.PAY_WITH_CARD="PAY_WITH_CARD",e.ORDER_SUMMARY="ORDER_SUMMARY",e.SALE_SUCCESS="SALE_SUCCESS",e.SALE_FAIL="SALE_FAIL"}(w4e||(w4e={})),function(e){e.INIT="INIT",e.REVIEW_ORDER="REVIEW_ORDER",e.EXECUTE_FUNDING_ROUTE="EXECUTE_FUNDING_ROUTE"}(T4e||(T4e={})),function(e){e.DEFAULT="DEFAULT_ERROR",e.INVALID_PARAMETERS="INVALID_PARAMETERS",e.TRANSACTION_FAILED="TRANSACTION_FAILED",e.SERVICE_BREAKDOWN="SERVICE_BREAKDOWN",e.PRODUCT_NOT_FOUND="PRODUCT_NOT_FOUND",e.INSUFFICIENT_STOCK="INSUFFICIENT_STOCK",e.TRANSAK_FAILED="TRANSAK_FAILED",e.WALLET_FAILED="WALLET_FAILED",e.WALLET_REJECTED="WALLET_REJECTED",e.WALLET_REJECTED_NO_FUNDS="WALLET_REJECTED_NO_FUNDS",e.WALLET_POPUP_BLOCKED="WALLET_POPUP_BLOCKED",e.FUNDING_ROUTE_EXECUTE_ERROR="FUNDING_ROUTE_EXECUTE_ERROR"}(E4e||(E4e={})),function(e){e.CRYPTO="crypto",e.FIAT="fiat"}(A4e||(A4e={})),function(e){e.SUFFICIENT="SUFFICIENT"}(x4e||(x4e={})),function(e){e.BEFORE="before",e.PENDING="pending",e.AFTER="after"}(O4e||(O4e={}));const I4e={[Xt.SANDBOX]:"https://api.sandbox.immutable.com/v1/primary-sales",[Xt.PRODUCTION]:"https://api.immutable.com/v1/primary-sales"},_4e=e=>e.map((({method:e,hash:t})=>`${e}: ${t}`)).join(" | "),P4e=e=>e.split(/[_\s-]+/).map((e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase())).join(""),S4e=e=>e.replace(/[^\u0000-\u00FF]/g,""),k4e=e=>{if(!e)return"";let t=e.trim().toLowerCase();if(t.startsWith("0x")&&(t=t.slice(2)),!/^[0-9a-f]+$/i.test(t))throw new Error("Invalid hexadecimal input");let n="";for(let e=0;e<t.length;e+=2){const r=parseInt(t.substr(e,2),16);n+=String.fromCharCode(r)}return n},R4e=async(e,t)=>{try{const n=t.getSigner(),r=await n.getAddress(),i=e.find((e=>e.methodCall.startsWith("approve")));if(!i||!n||!r)return e;const a=new pl(i.tokenAddress,["function allowance(address,address) view returns (uint256)"],n),o=await(n?.call({to:i.tokenAddress,data:a.interface.encodeFunctionData("allowance",[r,i.params.spender])})),s=jr.from(o),c=i.params.amount?jr.from(i.params.amount):jr.from(0);if(s.gte(jr.from("0"))&&s.gte(c))return e.filter((e=>e.methodCall!==i.methodCall))}catch{}return e};var N4e;!function(e){e.CONTRACT_ADDRESS="contract_address",e.CURRENCY_SYMBOL="currency_symbol"}(N4e||(N4e={}));const M4e=e=>{const{provider:t,items:n,environment:r,environmentId:i,waitFulfillmentSettlements:a}=e,[o,s]=uV.useState(void 0),[c,u]=uV.useState(void 0),[l,d]=uV.useState({done:!1,transactions:[]}),[f,p]=uV.useState([]),[h,m]=uV.useState(0),[y,b]=uV.useState([]),g=()=>d((e=>({...e,done:!0}))),v=()=>d({done:!1,transactions:[]}),w=uV.useCallback((async(e,n,r)=>{try{const i=t?.getSigner(),o=await(t?.getGasPrice()),s=await(i?.sendTransaction({to:e,data:n,gasPrice:o,gasLimit:r}));a&&await(s?.wait());const c=s?.hash;if(!c)throw new Error("Transaction hash is undefined");return[c,void 0]}catch(e){const t=`${e?.reason||e?.message||""}`.toLowerCase();let n=E4e.WALLET_FAILED;t.includes("failed")&&t.includes("open confirmation")&&(n=E4e.WALLET_POPUP_BLOCKED),t.includes("rejected")&&t.includes("user")&&(n=E4e.WALLET_REJECTED),t.includes("failed to submit")&&t.includes("highest gas limit")&&(n=E4e.WALLET_REJECTED_NO_FUNDS),(t.includes("status failed")||t.includes("transaction failed"))&&(n=E4e.TRANSACTION_FAILED);const r={type:n,data:{error:e}};return s(r),[void 0,r]}}),[t,a]),T=uV.useCallback((async(e,a)=>{try{const o=t?.getSigner(),c={recipient_address:await(o?.getAddress())||"",payment_type:e,currency_filter:N4e.CONTRACT_ADDRESS,currency_value:a,products:n.map((e=>({product_id:e.productId,quantity:e.qty})))},l=`${I4e[r]}/${i}/order/sign`,d=await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)}),{ok:f,status:h}=d;if(!f){const{code:e}=await d.json();let t;switch(h){case 400:t=E4e.SERVICE_BREAKDOWN;break;case 404:t="insufficient_stock"===e?E4e.INSUFFICIENT_STOCK:E4e.PRODUCT_NOT_FOUND;break;case 429:case 500:t=E4e.DEFAULT;break;default:throw new Error("Unknown error")}return void s({type:t})}const m=await d.json(),y=m.order.products.map((e=>e.detail.map((({token_id:e})=>e)))).flat(),g=((e,t)=>{const{order:n,transactions:r}=e;return{order:{currency:{name:n.currency.name,erc20Address:n.currency.erc20_address},products:n.products.map((e=>((e,t,n)=>({productId:e.product_id,image:n?.image||"",qty:n?.qty||1,name:n?.name||"",description:n?.description||"",currency:t,contractType:e.contract_type,collectionAddress:e.collection_address,amount:e.detail.map((({amount:e})=>e)),tokenId:e.detail.map((({token_id:e})=>e))}))(e,n.currency.name,t.find((t=>t.productId===e.product_id))))).reduce(((e,t)=>{const n=e.findIndex((e=>e.name===t.name));return-1===n&&e.push({...t}),n>-1&&(e[n].amount=[...e[n].amount,...t.amount],e[n].tokenId=[...e[n].tokenId,...t.tokenId]),e}),[]),totalAmount:Number(n.total_amount)},transactions:r.map((e=>({tokenAddress:e.contract_address,gasEstimate:e.gas_estimate,methodCall:e.method_call,params:{reference:e.params.reference||"",amount:e.params.amount||0,spender:e.params.spender||""},rawData:e.raw_data}))),transactionId:k4e(r.find((e=>e.method_call.startsWith("execute")))?.params.reference||"")}})(m,n);if(p(y),u(g),t){const e=await R4e(g.transactions,t);b(e)}return g}catch(e){s({type:E4e.DEFAULT,data:{error:e}})}}),[n,i,r,t]),E=async(e,t,n)=>{if(!e)return!1;const{tokenAddress:r,rawData:i,methodCall:a,gasEstimate:o}=e,[s,c]=await w(r,i,o);if(c||!s)return n(c,l.transactions),!1;const u={method:a,hash:s};return(e=>{d((t=>({...t,transactions:[...t.transactions,e]})))})(u),t(u),!0},A=uV.useCallback((async(e,n,r,i)=>{if(!e||!t)return s({type:E4e.DEFAULT,data:{reason:"No sign data"}}),[];const a=await R4e(e.transactions,t);let o=!0;for(const e of a){i&&i(e.methodCall,O4e.BEFORE);if(!await E(e,n,r)){o=!1;break}i&&i(e.methodCall,O4e.AFTER)}return(o?g:v)(),l.transactions}),[t,E,g,v,R4e,w]),x=uV.useCallback((async(e,n,r)=>{if(!y||l.done||!t)return!1;const i=y[h];r&&r(i.methodCall,O4e.BEFORE);const a=await E(i,e,n);return a&&(m((e=>e+1)),h===y.length-1&&g(),r&&r(i.methodCall,O4e.AFTER)),a}),[h,t,y]);return{sign:T,signResponse:c,signError:o,filteredTransactions:y,currentTransactionIndex:h,executeAll:A,executeResponse:l,tokenIds:f,executeNextTransaction:x}},D4e=(e,t)=>{const n=-1===e.findIndex((({name:e})=>eNe(e,t||"")));return t&&n&&console.warn(`[IMTBL]: invalid "preferredCurrency=${t}" widget input`),t&&!n?e.filter((({name:e})=>eNe(e,t))).map((({erc20_address:e,exchange_id:t,...n})=>({...n,base:!0,address:e,exchangeId:t}))):e.map((({erc20_address:e,exchange_id:t,...n})=>({...n,address:e,exchangeId:t})))},L4e={config:{contractId:""},currencies:[],products:{},totalAmount:{}},j4e=({items:e,environment:t,environmentId:n,provider:r,preferredCurrency:i})=>{const[a,o]=uV.useState(),s=uV.useRef(!1),[c,u]=uV.useState(""),[l,d]=uV.useState(L4e),[f,p]=uV.useState(void 0),h=e=>{p({type:E4e.SERVICE_BREAKDOWN,data:{reason:"Error fetching settlement currencies",error:e}})};return uV.useEffect((()=>{e?.length&&r&&(async()=>{try{const t=new URLSearchParams,n=e.map((({productId:e,qty:t})=>({id:e,qty:t})));t.append("products",btoa(JSON.stringify(n)));const i=r.getSigner(),a=await i.getAddress();t.append("wallet_address",a),u(t.toString())}catch(e){h(e)}})()}),[e,r]),uV.useEffect((()=>{t&&n&&c&&(async()=>{if(!s.current)try{s.current=!0;const e=`${I4e[t]}/${n}/order/quote?${c}`,r=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}});if(!r.ok)throw new Error(`${r.status} - ${r.statusText}`);const a=(({config:e,currencies:t,products:n,total_amount:r},i)=>({config:{contractId:e.contract_id},currencies:D4e(t,i),products:Object.entries(n).reduce(((e,[t,{product_id:n,...r}])=>({...e,[t]:{productId:t,...r}})),{}),totalAmount:r}))(await r.json(),i);d(a)}catch(e){h(e)}finally{s.current=!1}})()}),[t,n,c]),uV.useEffect((()=>{if(0===l.currencies.length)return;const e=i?l.currencies.find((e=>eNe(e.name,i))):void 0,t=e||l.currencies.find((e=>e.base))||l.currencies?.[0];o(t)}),[l]),{orderQuote:l,selectedCurrency:a,orderQuoteError:f}},F4e=uV.createContext({items:[],collectionName:"",provider:void 0,checkout:void 0,environmentId:"",environment:Xt.SANDBOX,recipientAddress:"",recipientEmail:"",sign:()=>Promise.resolve(void 0),executeAll:()=>Promise.resolve([]),executeNextTransaction:()=>Promise.resolve(!1),signResponse:void 0,signError:void 0,filteredTransactions:[],currentTransactionIndex:0,executeResponse:void 0,passport:void 0,isPassportWallet:!1,showCreditCardWarning:!1,setShowCreditCardWarning:()=>{},paymentMethod:void 0,setPaymentMethod:()=>{},goBackToPaymentMethods:()=>{},goToErrorView:()=>{},goToSuccessView:()=>{},config:{},fundingRoutes:[],disabledPaymentTypes:[],invalidParameters:!1,fromTokenAddress:"",orderQuote:L4e,signTokenIds:[],excludePaymentTypes:[],preferredCurrency:void 0,selectedCurrency:void 0,waitFulfillmentSettlements:!0,hideExcludedPaymentTypes:!1});F4e.displayName="SaleSaleContext";const B4e=1;function U4e(e){const{children:t,value:{config:n,environment:r,environmentId:i,items:a,provider:o,checkout:s,passport:c,collectionName:u,excludePaymentTypes:l,excludeFiatCurrencies:d,preferredCurrency:f,waitFulfillmentSettlements:p,hideExcludedPaymentTypes:h}}=e,m=uV.useRef(0),{viewDispatch:y}=uV.useContext(ERe),[{recipientEmail:b,recipientAddress:g},v]=uV.useState({recipientEmail:"",recipientAddress:""}),[w,T]=uV.useState(!1),[E,A]=uV.useState(void 0),x=e=>{if(e===jH.CREDIT&&!w)return A(void 0),void T(!0);A(e),T(!1)},[O]=uV.useState([]),[C,I]=uV.useState([]),[_,P]=uV.useState(!1),{selectedCurrency:S,orderQuote:k,orderQuoteError:R}=j4e({items:a,provider:o,environmentId:i,environment:n.environment,preferredCurrency:f}),N=S?.address||"",M=uV.useCallback(((e,t)=>{x(e),y({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.PAYMENT_METHODS,data:t}}})}),[]);uV.useEffect((()=>{(async()=>{const e=o?.getSigner(),t=await(e?.getAddress())||"",n=(await(c?.getUserInfo()))?.email||"";v({recipientEmail:n,recipientAddress:t})})()}),[o]);const{sign:D,executeAll:L,executeNextTransaction:j,signResponse:F,signError:B,filteredTransactions:U,currentTransactionIndex:z,executeResponse:H,tokenIds:W}=M4e({items:a,provider:o,fromTokenAddress:N,recipientAddress:g,environmentId:i,environment:r,waitFulfillmentSettlements:p}),V=uV.useCallback((async(e,t,n)=>{const r=t||N;if(!r||!r.startsWith("0x"))return void P(!0);const i=await D(e,r);return i?(n?.(i),i):void 0}),[D,N]),G=uV.useCallback(((e,t={})=>{m.current+=1,m.current>B4e&&(m.current=0,x(void 0)),y({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.SALE_FAIL,data:{...t,errorType:e,paymentMethod:E,transactions:H.transactions}}}})}),[E,x,H]),q=uV.useCallback((e=>{y({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.SALE_SUCCESS,data:{paymentMethod:E,transactions:H.transactions,tokenIds:W,...e}}}})}),[[E,H,W]]);uV.useEffect((()=>{B&&G(B.type,B.data)}),[B]),uV.useEffect((()=>{R&&G(R.type,R.data)}),[R]),uV.useEffect((()=>{!(!a||0===a.length)&&u&&i||P(!0)}),[a,u,i]),uV.useEffect((()=>{l?.length<=0||I(l)}),[l]);const K=uV.useMemo((()=>({config:n,items:a,fromTokenAddress:N,sign:V,signResponse:F,signError:B,filteredTransactions:U,currentTransactionIndex:z,executeAll:L,executeNextTransaction:j,executeResponse:H,environmentId:i,collectionName:u,environment:r,provider:o,checkout:s,recipientAddress:g,recipientEmail:b,showCreditCardWarning:w,setShowCreditCardWarning:T,paymentMethod:E,setPaymentMethod:x,goBackToPaymentMethods:M,goToErrorView:G,goToSuccessView:q,isPassportWallet:!!o?.provider?.isPassport,fundingRoutes:O,disabledPaymentTypes:C,invalidParameters:_,orderQuote:k,signTokenIds:W,excludePaymentTypes:l,excludeFiatCurrencies:d,selectedCurrency:S,waitFulfillmentSettlements:p,hideExcludedPaymentTypes:h})),[n,r,i,a,N,u,o,s,g,b,F,B,U,z,H,w,T,E,M,G,q,V,O,C,_,k,W,l,d,S,p,h]);return Cq(F4e.Provider,{value:K,children:t})}function z4e(){return uV.useContext(F4e)}const H4e={[Xt.SANDBOX]:"https://global-stg.transak.com",[Xt.PRODUCTION]:"https://global.transak.com/"},W4e={[Xt.SANDBOX]:"https://api-stg.transak.com",[Xt.PRODUCTION]:"https://api.transak.com"},V4e={[Xt.SANDBOX]:"STAGING",[Xt.PRODUCTION]:"PRODUCTION"},G4e={[Xt.SANDBOX]:"d14b44fb-0f84-4db5-affb-e044040d724b",[Xt.PRODUCTION]:"ad1bca70-d917-4628-bb0f-5609537498bc"},q4e=e=>{const{contractId:t,environment:n,transakParams:r,onError:i}=e,[a,o]=uV.useState(""),s=uV.useCallback((async()=>{try{const{calldata:e,nftData:i,estimatedGasLimit:a,cryptoCurrencyCode:o,excludeFiatCurrencies:s,...c}=r,u=i?.slice(0,1).map((e=>({...e,imageURL:S4e(e.imageURL),nftName:S4e(e.nftName)}))),l={contractId:t,cryptoCurrencyCode:o,calldata:e,nftData:u,estimatedGasLimit:(a>0?a:"30000000").toString()},d=`${W4e[n]}/cryptocoverage/api/v1/public/one-click-protocol/nft-transaction-id`,f=await fetch(d,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!f.ok)throw new Error("Failed to get NFT transaction ID");const{id:p}=await f.json(),h=`${H4e[n]}?`,m=new URLSearchParams({apiKey:G4e[n],environment:V4e[n],isNFT:"true",nftTransactionId:p,themeColor:"0D0D0D",...c});return s&&m.append("excludeFiatCurrencies",s.join(",")),`${h}${m.toString()}`}catch{i?.()}return""}),[t,n,r,i]);return uV.useEffect((()=>{(async()=>{const e=await s();o(e)})()}),[]),{iframeSrc:a}};function K4e(e){const{id:t,type:n,email:r,walletAddress:i,isPassportWallet:a,nftData:o,calldata:s,cryptoCurrencyCode:c,estimatedGasLimit:u,exchangeScreenTitle:l,partnerOrderId:d,excludeFiatCurrencies:f,onOpen:p,onInit:h,onOrderCreated:m,onOrderProcessing:y,onOrderCompleted:b,onOrderFailed:g,onFailedToLoad:v,failedToLoadTimeoutInMs:w,environment:T,contractId:E}=e,A=uV.useRef(null),{onLoad:x,initialised:O}=C3e({userJourney:bPe.SALE,ref:A,walletAddress:i,isPassportWallet:a,onOpen:p,onOrderCreated:m,onOrderProcessing:y,onOrderCompleted:b,onOrderFailed:g,onInit:h,failedToLoadTimeoutInMs:w,onFailedToLoad:v}),{iframeSrc:C}=q4e({type:n,contractId:E,environment:T,transakParams:{nftData:o,calldata:s,cryptoCurrencyCode:c,estimatedGasLimit:u,exchangeScreenTitle:l,email:r,walletAddress:i,partnerOrderId:d,excludeFiatCurrencies:f},onError:v});return Cq("iframe",{id:t,ref:A,src:C,title:"Transak-Iframe",allow:"camera;microphone;fullscreen;payment",style:{height:"100%",width:"100%",border:"none",position:"absolute",top:0,left:0,opacity:O?1:0,transition:"opacity 0.5s ease-out"},onLoad:x,onError:()=>v?.()})}function X4e(e){const{t:t}=_ke(),{onInit:n,onOpen:r,onOrderCreated:i,onOrderProcessing:a,onOrderCompleted:o,onOrderFailed:s}=e,{recipientEmail:c,recipientAddress:u,isPassportWallet:l,signResponse:d,goToErrorView:f,environment:p,orderQuote:h,excludeFiatCurrencies:m}=z4e(),y=d?.transactions.find((e=>e.methodCall.startsWith("execute")));if(!d||!y)return null;const b=uV.useMemo((()=>d.order.products.map((e=>({collectionAddress:e.collectionAddress,imageURL:e.image,nftName:e.name,price:e.amount,quantity:e.qty,tokenID:e.tokenId,nftType:e.contractType||"ERC721"})))),[d]);return Cq(K4e,{id:"transak-iframe",type:"nft-checkout",email:c,walletAddress:u,isPassportWallet:l,exchangeScreenTitle:t("views.PAY_WITH_CARD.screenTitle"),nftData:b,calldata:y.rawData,cryptoCurrencyCode:d.order.currency.name,estimatedGasLimit:y.gasEstimate,partnerOrderId:y.params.reference,excludeFiatCurrencies:m,onInit:n,onOpen:r,onOrderCreated:i,onOrderProcessing:a,onOrderCompleted:o,onOrderFailed:s,onFailedToLoad:()=>{f(E4e.TRANSAK_FAILED)},environment:p,contractId:h.config.contractId})}const Y4e=(e,t)=>{const{fundingItem:n}=e;return{settlementType:e.type,type:n.type,token:n.token,amount:n.fundsRequired.formattedAmount,balance:n.userBalance.formattedBalance,fiat:{symbol:"USD",balance:zRe(n.userBalance.formattedBalance,n.token.symbol,t),amount:zRe(n.fundsRequired.formattedAmount,n.token.symbol,t)}}},Z4e=()=>{const{track:e,page:t}=OPe(),{recipientAddress:n,signResponse:r,paymentMethod:i}=z4e(),{eventTargetState:{eventTarget:a}}=uV.useContext(zqe),o=w4e.PAYMENT_METHODS,s={location:"web",userJourney:bPe.SALE},c={userId:n,paymentMethod:i},u={amount:r?.order.totalAmount,currency:r?.order.currency.name};return{track:e,page:t,sendPageView:(e,n)=>{t({...s,screen:P4e(e),action:"Viewed",extras:{...n}})},sendCloseEvent:(t=o,n="Button",r="Pressed")=>{e({...s,screen:P4e(t),control:"Close",controlType:n,action:r,extras:{...c}}),mKe(a)},sendSuccessEvent:(t=o,n=[],r=[],l={})=>{e({...s,screen:P4e(t),control:"Success",controlType:"Event",action:"Succeeded",extras:{...l,...c,transactions:_4e(n),...u,paymentMethod:i,tokenIds:r}}),((e,t,n=[],r=[],i="")=>{const a=new CustomEvent(kH.IMTBL_SALE_WIDGET_EVENT,{detail:{type:LH.SUCCESS,data:{paymentMethod:t,transactions:n,tokenIds:r,transactionId:i}}});console.log("Sale success event:",a),void 0!==e&&e.dispatchEvent(a)})(a,i,n,r,l.transactionId)},sendFailedEvent:(t,n,r=[],l=o,d={})=>{e({...s,screen:P4e(l||o),control:"Fail",controlType:"Event",action:"Failed",extras:{...d,transactions:_4e(r),...n,...u,...c,paymentMethod:i,reason:t}}),((e,t,n,r,i=[],a="")=>{const o=new CustomEvent(kH.IMTBL_SALE_WIDGET_EVENT,{detail:{type:LH.FAILURE,data:{reason:t,error:n,paymentMethod:r,transactions:i,transactionId:a,timestamp:(new Date).getTime()}}});console.log("Sale failed event:",o),void 0!==e&&e.dispatchEvent(o)})(a,t,n,i,r,d.transactionId)},sendTransactionSuccessEvent:e=>{((e,t,n)=>{const r=new CustomEvent(kH.IMTBL_SALE_WIDGET_EVENT,{detail:{type:LH.TRANSACTION_SUCCESS,data:{paymentMethod:t,transactions:n}}});console.log("Sale transaction success event:",r),void 0!==e&&e.dispatchEvent(r)})(a,i,[e])},sendOrderCreated:(t,n)=>{e({...s,screen:P4e(t),control:"OrderCreated",controlType:"Event",extras:{...n}})},sendSelectedPaymentMethod:(t,n)=>{e({...s,screen:P4e(n),control:"Select",controlType:"MenuItem",extras:{paymentMethod:t}}),((e,t)=>{const n=new CustomEvent(kH.IMTBL_SALE_WIDGET_EVENT,{detail:{type:LH.PAYMENT_METHOD,data:{paymentMethod:t}}});console.log("Sale payment method event:",n),void 0!==e&&e.dispatchEvent(n)})(a,t)},sendSelectedPaymentToken:(t,n,r)=>{const i=Y4e(n,r);e({...s,screen:P4e(t),control:"Select",controlType:"MenuItem",extras:{...i}}),((e,t)=>{const n=new CustomEvent(kH.IMTBL_SALE_WIDGET_EVENT,{detail:{type:LH.PAYMENT_TOKEN,data:{...t}}});console.log("Sale payment token selected event:",n),void 0!==e&&e.dispatchEvent(n)})(a,i)},sendProceedToPay:(t,n,r,i="Button",a="Pressed")=>{e({...s,screen:P4e(t),control:"ProceedToPay",controlType:i,action:a,extras:{...c,...Y4e(n,r)}})},sendViewFeesEvent:(t,n="Button",r="Pressed")=>{e({...s,screen:P4e(t),control:"ViewFees",controlType:n,action:r,extras:{...c}})}}};function J4e(){const{sendPageView:e}=Z4e(),[t,n]=uV.useState(!1),{goBackToPaymentMethods:r,goToErrorView:i,signResponse:a,signTokenIds:o}=z4e(),{sendOrderCreated:s,sendCloseEvent:c,sendSuccessEvent:u}=Z4e(),{t:l}=_ke(),d=(e={})=>{const{id:t,status:n,cryptoAmount:r,cryptoCurrency:i,fiatAmount:s,fiatAmountInUsd:l,amountPaid:d,totalFeeInFiat:f,paymentOptionId:p,userId:h,userKycType:m,walletAddress:y,nftAssetInfo:b}=e,{nftDataBase64:g,quantity:v}=b||{},w={orderId:t,orderStatus:n,cryptoAmount:r,cryptoCurrency:i,fiatAmount:s,fiatAmountInUsd:l,amountPaid:d,totalFeeInFiat:f,paymentOption:p,userId:h,userKycType:m,walletAddress:y,nftDataBase64:g,quantity:v,signData:a,transactionId:a?.transactionId};u(w4e.SALE_SUCCESS,[],o,w),c(w4e.SALE_SUCCESS)};return uV.useEffect((()=>e(w4e.PAY_WITH_CARD)),[]),Cq(_Pe,{header:t&&Cq(xRe,{onCloseButtonClick:()=>r()}),children:Iq(Oq,{children:[Cq(jue,{visible:!t,children:Cq(jue.Content,{children:Cq(jue.Content.LoopingText,{text:[l("views.PAY_WITH_CARD.loading")]})})}),Cq(N3,{style:{display:"block",position:"relative",maxWidth:"420px",height:"565px",borderRadius:"1%",overflow:"hidden",margin:"0 auto",width:"100%"},children:Cq(X4e,{onInit:()=>n(!0),onOrderFailed:()=>{i(E4e.TRANSAK_FAILED)},onOrderCompleted:d,onOrderCreated:(e={})=>{const{id:t,status:n,cryptoAmount:r,cryptoCurrency:i,fiatAmount:o,fiatAmountInUsd:c,amountPaid:u,totalFeeInFiat:l,paymentOptionId:d,userId:f,userKycType:p,walletAddress:h,nftAssetInfo:m}=e,{nftDataBase64:y,quantity:b}=m||{};s(w4e.PAY_WITH_CARD,{orderId:t,orderStatus:n,cryptoAmount:r,cryptoCurrency:i,fiatAmount:o,fiatAmountInUsd:c,amountPaid:u,totalFeeInFiat:l,paymentOption:d,userId:f,userKycType:p,walletAddress:h,nftDataBase64:y,quantity:b,signData:a,transactionId:a?.transactionId})},onOrderProcessing:d})})]})})}var Q4e;!function(e){e.APPROVE="approve(address spender,uint256 amount)",e.EXECUTE="execute(address multicallSigner, bytes32 reference, address[] targets, bytes[] data, uint256 deadline, bytes signature)"}(Q4e||(Q4e={}));const $4e=e=>{switch(e){case Q4e.APPROVE:return"/access_coins.riv";case Q4e.EXECUTE:return"/purchasing_items.riv";default:return""}};var e9e;!function(e){e[e.START=0]="START",e[e.WAITING=1]="WAITING",e[e.PROCESSING=2]="PROCESSING",e[e.COMPLETED=3]="COMPLETED",e[e.ERROR=4]="ERROR"}(e9e||(e9e={}));const t9e={[Q4e.APPROVE]:{url:$4e(Q4e.APPROVE),stateMachine:"State",input:"mode",inputValues:{start:e9e.START,waiting:e9e.WAITING,processing:e9e.PROCESSING,completed:e9e.COMPLETED,error:e9e.ERROR}},[Q4e.EXECUTE]:{url:$4e(Q4e.EXECUTE),stateMachine:"State",input:"mode",inputValues:{start:e9e.START,waiting:e9e.WAITING,processing:e9e.PROCESSING,completed:e9e.COMPLETED,error:e9e.ERROR}}};function n9e(e){const{t:t}=_ke(),{addHandover:n}=DPe({id:NPe.GLOBAL});return{onTxnStepExecuteNextTransaction:uV.useCallback(((r,i)=>{switch(`${r}-${i}`){case`${Q4e.APPROVE}-${O4e.BEFORE}`:n({animationUrl:YRe(e,$4e(Q4e.APPROVE)),inputValue:t9e[Q4e.APPROVE].inputValues.processing,children:Cq(qee,{children:t("views.PAYMENT_METHODS.handover.approve.pending")})});break;case`${Q4e.APPROVE}-${O4e.AFTER}`:n({duration:zPe.MEDIUM,animationUrl:YRe(e,$4e(Q4e.APPROVE)),inputValue:t9e[Q4e.APPROVE].inputValues.completed,children:Cq(qee,{children:t("views.PAYMENT_METHODS.handover.approve.after")})});break;case`${Q4e.EXECUTE}-${O4e.BEFORE}`:n({animationUrl:YRe(e,$4e(Q4e.EXECUTE)),inputValue:t9e[Q4e.EXECUTE].inputValues.waiting,children:Cq(qee,{children:t("views.PAYMENT_METHODS.handover.execute.pending")})});break;case`${Q4e.EXECUTE}-${O4e.AFTER}`:n({animationUrl:YRe(e,$4e(Q4e.EXECUTE)),inputValue:t9e[Q4e.EXECUTE].inputValues.processing,children:Cq(qee,{children:t("views.PAYMENT_METHODS.handover.execute.after")})})}}),[e,n,t]),onTxnStepExecuteAll:uV.useCallback(((r,i)=>{switch(`${r}-${i}`){case`${Q4e.APPROVE}-${O4e.BEFORE}`:n({animationUrl:YRe(e,$4e(Q4e.APPROVE)),inputValue:t9e[Q4e.APPROVE].inputValues.waiting,children:Cq(qee,{children:t("views.PAYMENT_METHODS.handover.approve.before")})});break;case`${Q4e.APPROVE}-${O4e.AFTER}`:n({animationUrl:YRe(e,$4e(Q4e.APPROVE)),inputValue:t9e[Q4e.APPROVE].inputValues.completed,children:Cq(qee,{children:t("views.PAYMENT_METHODS.handover.approve.after")})});break;case`${Q4e.EXECUTE}-${O4e.BEFORE}`:n({animationUrl:YRe(e,$4e(Q4e.EXECUTE)),inputValue:t9e[Q4e.EXECUTE].inputValues.waiting,children:Cq(qee,{children:t("views.PAYMENT_METHODS.handover.execute.before")})});break;case`${Q4e.EXECUTE}-${O4e.AFTER}`:n({duration:zPe.MEDIUM,animationUrl:YRe(e,$4e(Q4e.EXECUTE)),inputValue:t9e[Q4e.EXECUTE].inputValues.processing,children:Cq(qee,{children:t("views.PAYMENT_METHODS.handover.execute.after")})})}}),[e,n,t])}}function r9e({headingText:e,subheadingText:t,primaryButtonText:n,onPrimaryButtonClick:r,secondaryButtonText:i,onSecondaryButtonClick:a}){return Iq(N3,{sx:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[Iq(N3,{children:[Cq(qee,{sx:{paddingBottom:"base.spacing.x4"},children:e}),Cq(tee,{size:"small",sx:{textAlign:"center",color:"base.color.text.body.secondary"},children:t})]}),Iq(N3,{children:[n&&r&&Cq(N3,{sx:{paddingBottom:"base.spacing.x2"},children:Cq(O3,{sx:{width:"100%"},variant:"primary",size:"large",testId:"handover-primary-button",onClick:r,children:n})}),i&&a&&Cq(N3,{sx:{paddingBottom:"base.spacing.x4"},children:Cq(O3,{sx:{width:"100%"},variant:"tertiary",size:"large",testId:"handover-secondary-button",onClick:a,children:i})})]})]})}const i9e={[Q4e.APPROVE]:{headingTextKey:"views.PAYMENT_METHODS.handover.approve.beforeWithCta.heading",ctaButtonTextKey:"views.PAYMENT_METHODS.handover.approve.beforeWithCta.ctaButton",animationUrl:$4e(Q4e.APPROVE),inputValue:e9e.WAITING},[Q4e.EXECUTE]:{headingTextKey:"views.PAYMENT_METHODS.handover.execute.beforeWithCta.heading",ctaButtonTextKey:"views.PAYMENT_METHODS.handover.execute.beforeWithCta.ctaButton",animationUrl:$4e(Q4e.EXECUTE),inputValue:e9e.START}};function a9e(){const e=uV.useRef(!1),t=uV.useRef(null),{t:n}=_ke(),{sendPageView:r,sendTransactionSuccessEvent:i,sendFailedEvent:a,sendCloseEvent:o,sendSuccessEvent:s}=Z4e(),{executeAll:c,executeNextTransaction:u,signResponse:l,filteredTransactions:d,currentTransactionIndex:f,executeResponse:p,signTokenIds:h,environment:m,provider:y,goToErrorView:b}=z4e(),{onTxnStepExecuteNextTransaction:g,onTxnStepExecuteAll:v}=n9e(m),{addHandover:w}=DPe({id:NPe.GLOBAL}),T=uV.useCallback((async()=>{c(l,(e=>{i(e)}),((e,t)=>{const n={transactionId:l?.transactionId};a(e.toString(),e,t,void 0,n),b(e.type,e.data)}),v)}),[l,m]),E=uV.useCallback((()=>{const e=d[f],t=i9e[e.methodCall],r=n(t.headingTextKey)||"",o=n(t.ctaButtonTextKey)||"";w({animationUrl:YRe(m,t.animationUrl),inputValue:t.inputValue,children:Cq(r9e,{headingText:r,primaryButtonText:o,onPrimaryButtonClick:()=>{try{u((e=>{i(e)}),((e,t)=>{const n={transactionId:l?.transactionId};a(e.toString(),e,t,void 0,n),b(e.type,e.data)}),g)}catch(e){b(E4e.SERVICE_BREAKDOWN,{error:e})}}})})}),[d,f,l,m]);return uV.useEffect((()=>r(w4e.PAY_WITH_COINS)),[]),uV.useEffect((()=>{if(!y||0===d.length)return;const e=f<d.length&&t.current!==f;fNe(y)&&e&&(t.current=f,E())}),[d,f,y]),uV.useEffect((()=>{l&&y&&!e.current&&(fNe(y)||(e.current=!0,T()))}),[l,y]),uV.useEffect((()=>{if(p?.done){const e={transactionId:l?.transactionId};w({duration:zPe.MEDIUM,animationUrl:YRe(m,$4e(Q4e.EXECUTE)),inputValue:e9e.COMPLETED,children:Cq(qee,{sx:{px:"base.spacing.x6"},children:n("views.PAYMENT_METHODS.handover.success")}),onClose:()=>{s(w4e.SALE_SUCCESS,p?.transactions,h,e),o(w4e.SALE_SUCCESS)}})}}),[p]),null}function o9e({type:e,onClick:t,disabled:n=!1,caption:r,size:i,rc:a=Cq("span",{})}){const{t:o}=_ke(),s={[jH.CRYPTO]:"Coins",[jH.DEBIT]:"BankCard",[jH.CREDIT]:"BankCard"};return Iq(oae,{rc:a,size:i||"medium",sx:{marginBottom:"base.spacing.x1",userSelect:"none",...n&&{filter:"opacity(0.5)",cursor:"not-allowed !important"}},...{disabled:n,emphasized:!0,onClick:n?void 0:()=>t(e)},children:[Cq(oae.FramedIcon,{icon:s[e]}),Cq(oae.Label,{size:"medium",children:o(`views.PAYMENT_METHODS.options.${e}.heading`)}),!n&&Cq(oae.IntentIcon,{}),Cq(oae.Caption,{children:r||o(`views.PAYMENT_METHODS.options.${e}.${n?"disabledCaption":"caption"}`)})]})}const s9e=[jH.CRYPTO,jH.DEBIT,jH.CREDIT];function c9e(e){const{disabledOptions:t=[],paymentOptions:n,onClick:r,captions:i,size:a,hideDisabledOptions:o}=e,s=uV.useMemo((()=>(n||s9e).filter((e=>!o||!t.includes(e)))),[n,t,o]);return uV.useEffect((()=>{1===s.length&&r(s[0])}),[s,r]),Cq(N3,{testId:"payment-options-list",sx:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start"},rc:Cq(D0.div,{variants:uqe,initial:"hidden",animate:"show"}),children:s.map(((e,n)=>Cq(o9e,{type:e,size:a,onClick:r,disabled:t.includes(e),caption:i?.[e],rc:Cq(D0.div,{custom:n,variants:lqe})},`payment-type-${e}`)))})}function u9e(){const{t:e}=_ke(),{viewDispatch:t}=uV.useContext(ERe),{sign:n,goToErrorView:r,paymentMethod:i,setPaymentMethod:a,invalidParameters:o,disabledPaymentTypes:s,hideExcludedPaymentTypes:c}=z4e(),{sendPageView:u,sendCloseEvent:l,sendSelectedPaymentMethod:d}=Z4e();return uV.useEffect((()=>{i&&d(i,w4e.PAYMENT_METHODS),i&&[jH.DEBIT,jH.CREDIT].includes(i)&&(n(A4e.FIAT,void 0,(()=>{t({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.PAY_WITH_CARD}}})})),t({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.LOADING_VIEW,data:{loadingText:e("views.PAYMENT_METHODS.loading.ready1")}}}})),i&&i===jH.CRYPTO&&t({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.ORDER_SUMMARY,subView:T4e.INIT}}})}),[i]),uV.useEffect((()=>u(w4e.PAYMENT_METHODS)),[]),uV.useEffect((()=>{o&&r(E4e.INVALID_PARAMETERS)}),[o]),Cq(_Pe,{testId:"payment-methods",header:Cq(xRe,{onCloseButtonClick:()=>l(w4e.PAYMENT_METHODS)}),footer:Cq(oNe,{}),children:Iq(N3,{sx:{display:"flex",flexDirection:"column",paddingX:"base.spacing.x2",paddingY:"base.spacing.x8",rowGap:"base.spacing.x4"},children:[Cq(qee,{size:"small",sx:{paddingX:"base.spacing.x4"},children:e("views.PAYMENT_METHODS.header.heading")}),Cq(N3,{sx:{paddingX:"base.spacing.x2"},children:Cq(c9e,{hideDisabledOptions:c,disabledOptions:s,onClick:e=>{a(e)}})})]})})}function l9e({biomeTheme:e,transactionHash:t,blockExplorerLink:n,errorType:r}){const{t:i}=_ke(),{goBackToPaymentMethods:a,executeNextTransaction:o,signResponse:s,environment:c,provider:u}=z4e(),{sendTransactionSuccessEvent:l,sendFailedEvent:d}=Z4e(),{viewDispatch:f}=uV.useContext(ERe),{eventTargetState:{eventTarget:p}}=uV.useContext(zqe),{addHandover:h,closeHandover:m}=DPe({id:NPe.GLOBAL}),{onTxnStepExecuteNextTransaction:y}=n9e(c),[b,g]=uV.useState(r),v=()=>{mKe(p)},w=()=>{try{o((e=>{l(e),f({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.PAY_WITH_COINS}}})}),((e,t)=>{const n={transactionId:s?.transactionId};d(e.toString(),e,t,void 0,n),g(E4e.TRANSACTION_FAILED)}),y)}catch(e){g(E4e.SERVICE_BREAKDOWN)}},T={[E4e.TRANSACTION_FAILED]:{onActionClick:()=>{m(),a()},onSecondaryActionClick:t?()=>{window.open(n)}:v,statusType:_qe.FAILURE,statusIconStyles:{fill:e.color.status.fatal.dim}},[E4e.SERVICE_BREAKDOWN]:{onSecondaryActionClick:v,statusType:_qe.INFORMATION,statusIconStyles:{fill:e.color.status.fatal.dim}},[E4e.PRODUCT_NOT_FOUND]:{onSecondaryActionClick:v,statusType:_qe.INFORMATION,statusIconStyles:{fill:e.color.status.fatal.dim}},[E4e.INSUFFICIENT_STOCK]:{onSecondaryActionClick:v,statusType:_qe.INFORMATION,statusIconStyles:{fill:e.color.status.fatal.dim}},[E4e.TRANSAK_FAILED]:{onActionClick:()=>{m(),a()},onSecondaryActionClick:v,statusType:_qe.INFORMATION},[E4e.WALLET_FAILED]:{onActionClick:()=>{fNe(u)?w():(m(),a())},onSecondaryActionClick:v,statusType:_qe.INFORMATION,statusIconStyles:{fill:e.color.status.fatal.dim}},[E4e.WALLET_REJECTED_NO_FUNDS]:{onActionClick:()=>{m(),a()},onSecondaryActionClick:v,statusType:_qe.INFORMATION},[E4e.WALLET_REJECTED]:{onActionClick:()=>{fNe(u)?w():(m(),a())},onSecondaryActionClick:v,statusType:_qe.INFORMATION},[E4e.WALLET_POPUP_BLOCKED]:{onActionClick:()=>{fNe(u)?w():(m(),a())},onSecondaryActionClick:v,statusType:_qe.INFORMATION},[E4e.FUNDING_ROUTE_EXECUTE_ERROR]:{onActionClick:()=>{m(),a()},onSecondaryActionClick:v,statusType:_qe.INFORMATION},[E4e.INVALID_PARAMETERS]:{onSecondaryActionClick:v,statusType:_qe.ALERT,statusIconStyles:{fill:e.color.status.attention.dim,transform:"none"}},[E4e.DEFAULT]:{onActionClick:()=>{m(),a()},onSecondaryActionClick:v,statusType:_qe.INFORMATION}},E=()=>{const e=T[b||E4e.DEFAULT]||{},n=b===E4e.TRANSACTION_FAILED&&t?i(`views.SALE_FAIL.errors.${b}.secondaryAction`):i(`views.SALE_FAIL.errors.${E4e.DEFAULT}.secondaryAction`);return{headingText:i("views.PAYMENT_METHODS.handover.error.heading"),subheadingText:i(`views.SALE_FAIL.errors.${b}.description`),primaryButtonText:i(`views.SALE_FAIL.errors.${b}.primaryAction`),onPrimaryButtonClick:e?.onActionClick,secondaryButtonText:n,onSecondaryButtonClick:e?.onSecondaryActionClick}};return uV.useEffect((()=>{c&&b&&h({animationUrl:YRe(c,$4e(Q4e.APPROVE)),inputValue:e9e.ERROR,children:Cq(r9e,{...E()})})}),[b,c]),null}function d9e({balance:e,conversions:t,canOpen:n,onClick:r,onProceed:i,loading:a,priceDisplay:o}){const{t:s}=_ke(),{environment:c,config:{theme:u}}=z4e(),{token:l,userBalance:d,fundsRequired:f}=e.fundingItem,p=zRe(f.formattedAmount,l.symbol,t,""),h=zRe(d.formattedBalance,l.symbol,t,"");return Iq(j3,{sx:{w:"100%",bradtl:"base.borderRadius.x6",bradtr:"base.borderRadius.x6",px:"base.spacing.x4",pb:"base.spacing.x6",bg:"base.color.neutral.800",border:"0px solid transparent",borderTopWidth:"base.border.size.100",borderTopColor:"base.color.translucent.emphasis.400"},children:[Iq(oae,{size:"medium",children:[Cq(oae.FramedImage,{circularFrame:!0,use:Cq(a2e,{environment:c,theme:u,name:l.name,src:l.icon})}),Cq(oae.Label,{children:s(`views.ORDER_SUMMARY.orderReview.payWith.${e.type}`,{symbol:l.symbol})}),Cq(oae.Caption,{rc:Cq(qee,{size:"xSmall"}),children:`${s("views.ORDER_SUMMARY.orderReview.balance",{amount:Nee(VRe(d.formattedBalance))})} ${h?s("views.ORDER_SUMMARY.currency.fiat",{amount:Nee(VRe(h))}):""}`}),o&&Cq(oae.PriceDisplay,{use:Cq(qee,{size:"xSmall"}),fiatAmount:p?s("views.ORDER_SUMMARY.currency.fiat",{amount:p}):void 0,price:VRe(f.formattedAmount)}),n&&Cq(oae.StatefulButtCon,{icon:"ChevronExpand",onClick:r}),!n&&a&&Cq(zue,{radius:"base.icon.size.400"})]}),Cq(O3,{size:"large",onClick:()=>i(e),children:s("views.ORDER_SUMMARY.orderReview.continue")})]})}const f9e=(e,t)=>e.filter((e=>e.amount.gt(0)&&e.token)).reduce(((e,n)=>{if(!n.token)return e;const r={...n.token,address:n.token.address||"",symbol:n.token.symbol||t?.symbol||""},i=$Re(r.address,"...").toLowerCase(),a=r.symbol||i;if(!a)return e;if(e[a]){const t=e[a].amount.add(n.amount);return{...e,[a]:{...e[a],amount:t,formattedAmount:Xd(t,r.decimals)}}}return a?{...e,[a]:{...n,token:r,formattedAmount:Xd(n.amount,r.decimals)}}:e}),{}),p9e=e=>{if(e.type!==sW.SWAP)return{};const t=[e.fees.approvalGasFee,e.fees.swapGasFee,...e.fees.swapFees];return f9e(t,e.fundingItem.token)},h9e=(e,t,n)=>{const r=[];if(e.type!==sW.SWAP)return[];const i=(e,i,a="~ ")=>{if(e.amount.gt(0)){const o=Xd(e.amount,e?.token?.decimals);r.push({label:i,fiatAmount:`≈ ${n("drawers.feesBreakdown.fees.fiatPricePrefix")}${zRe(o,e.token?.symbol||"",t,"-.--",4)}`,amount:`${VRe(o)}`,prefix:a,token:e?.token})}};i(e.fees.swapGasFee,n("drawers.feesBreakdown.fees.swapGasFee.label")),i(e.fees.approvalGasFee,n("drawers.feesBreakdown.fees.approvalFee.label"));return Object.entries(f9e(e.fees.swapFees,e.fundingItem.token)).forEach((([,e])=>{const t=e?.basisPoints??0;i(e,n("drawers.feesBreakdown.fees.swapSecondaryFee.label",{amount:t?t/100+"%":""}),"")})),r};function m9e({rc:e=Cq("span",{}),balance:t,conversions:n,selected:r,onClick:i,size:a,environment:o,theme:s}){const{t:c}=_ke(),{token:u,userBalance:l}=t.fundingItem,d=zRe(l.formattedBalance,u.symbol,n,""),f=Object.entries(p9e(t));return Iq(oae,{rc:e,sx:{mb:"base.spacing.x1"},size:a,emphasized:!0,...{onClick:i,selected:r},children:[Cq(oae.FramedImage,{circularFrame:!0,alt:u.name,use:Cq(a2e,{environment:o,theme:s,name:u.name,src:u.icon})}),Cq(oae.PriceDisplay,{use:Cq(qee,{size:"xSmall"}),fiatAmount:d?c("views.ORDER_SUMMARY.currency.fiat",{amount:d}):void 0,price:VRe(l.formattedBalance)}),Cq(oae.Label,{sx:{display:"flex",wordBreak:"default"},children:u.symbol}),Cq(oae.Caption,{children:f.length>0&&f.map((([e,{token:t,formattedAmount:n}])=>Cq(N3,{rc:Cq("span",{}),sx:{d:"block"},children:c("views.ORDER_SUMMARY.coinsDrawer.fee",{symbol:t?.symbol||e,amount:Nee(VRe(n))})},e)))})]})}function y9e({conversions:e,balances:t,selectedIndex:n,visible:r,loading:i,transactionRequirement:a,onClose:o,onSelect:s,onPayWithCard:c,disabledPaymentTypes:u,theme:l,environment:d}){const{t:f}=_ke(),p=e=>()=>{s(e),o()};let h="medium";t.length>3&&(h="small");const m=[jH.DEBIT,jH.CREDIT],y=!m.every((e=>u?.includes(e)));return Cq(wne,{size:"full",visible:r,showHeaderBar:!0,onCloseDrawer:o,headerBarTitle:f("views.ORDER_SUMMARY.coinsDrawer.header"),children:Cq(wne.Content,{rc:Cq(D0.div,{variants:uqe,initial:"hidden",animate:"show"}),children:Iq(N3,{sx:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between",px:"base.spacing.x4"},children:[Iq(N3,{children:[Iq(N3,{sx:{display:"flex",justifyContent:"space-between",mb:"base.spacing.x2"},children:[Cq(dse,{size:"small",children:f("views.ORDER_SUMMARY.coinsDrawer.caption1")}),Cq(dse,{size:"small",children:f("views.ORDER_SUMMARY.coinsDrawer.caption2")})]}),t?.map(((t,r)=>Cq(m9e,{onClick:p(r),balance:t,selected:n===r,conversions:e,transactionRequirement:a,size:h,theme:l,environment:d,rc:Cq(D0.div,{variants:lqe,custom:r})},`${t.fundingItem.token.symbol}-${t.type}`))),i&&Cq(D0.div,{variants:lqe,custom:t.length,children:Cq(oae,{shimmer:!0,emphasized:!0,size:h,testId:"funding-balance-item-shimmer"})},"funding-balance-item-shimmer")]}),c&&Iq(N3,{sx:{pb:"base.spacing.x4"},rc:Cq(D0.div,{variants:lqe,custom:t.length+(i?1:0)}),children:[y&&Cq(X3,{size:"small",rc:Cq(dse,{}),sx:{my:"base.spacing.x4"},children:f("views.ORDER_SUMMARY.coinsDrawer.divider")}),Cq(c9e,{onClick:c,size:h,hideDisabledOptions:!0,paymentOptions:m,disabledOptions:u,captions:{[jH.DEBIT]:f("views.PAYMENT_METHODS.options.debit.caption"),[jH.CREDIT]:f("views.PAYMENT_METHODS.options.credit.caption")}})]})]})})})}function b9e({item:e,balance:t,pricing:n,conversions:r,size:i,sx:a,rc:o=Cq("span",{})}){const{t:s}=_ke(),{token:c}=t.fundingItem,u=n?.amount||0,l=zRe(u.toString(),c.symbol,r);return Iq(oae,{rc:o,emphasized:!0,size:i||"medium",sx:{pointerEvents:"none",mb:"base.spacing.x1",...a},children:[Cq(oae.FramedImage,{use:Cq(a2e,{src:e.image,name:e.name,defaultImage:e.image})}),Cq(oae.Label,{children:e.name}),Cq(oae.Caption,{children:s("views.ORDER_SUMMARY.orderItem.quantity",{qty:e.qty})}),u>0&&Cq(oae.PriceDisplay,{use:Cq(qee,{size:"xSmall"}),price:s("views.ORDER_SUMMARY.currency.price",{symbol:c.symbol,amount:VRe(u)}),fiatAmount:s("views.ORDER_SUMMARY.currency.fiat",{amount:l})})]},e.name)}const g9e=(e,t,n)=>{if(!t)return;const r=e.toLowerCase(),i=BRe[r]?.toLowerCase(),a=Object.values(t).find((e=>[r,i].includes(e.currency.toLowerCase())));if(a)return a;const o=n.get(r)||n.get(i);return o&&t.USDC?{currency:e,type:t.USDC.type,amount:t.USDC.amount/o}:void 0},v9e={mb:"0",bradbl:"0",bradbr:"0"};function w9e({items:e,balance:t,pricing:n,conversions:r,children:i}){return Iq(N3,{rc:Cq(D0.div,{variants:uqe,initial:"hidden",animate:"show"}),children:[e.map(((a,o)=>Cq(b9e,{item:a,balance:t,conversions:r,size:e.length>=3?"small":"medium",pricing:g9e(t.fundingItem.token.symbol,n?.[a.productId]?.pricing,r),sx:o===e.length-1&&i?v9e:void 0,rc:Cq(D0.div,{variants:lqe,custom:o})},a.name))),i]})}function T9e({sx:e,swapFees:t,onFeesClick:n}){return Cq(A2e,{gasFeeFiatValue:t.fiatAmount,gasFeeToken:t.token,gasFeeValue:t.amount,fees:t.formattedFees,onFeesClick:n,sx:e,loading:!1})}function E9e({fundingBalances:e,conversions:t,collectionName:n,loadingBalances:r,transactionRequirement:i,onBackButtonClick:a,onPayWithCard:o,onProceedToBuy:s}){const{eventTargetState:{eventTarget:c}}=uV.useContext(zqe),{t:u}=_ke(),{provider:l,items:d,orderQuote:f,disabledPaymentTypes:p,config:{theme:h,environment:m}}=z4e(),{sendSelectedPaymentToken:y,sendViewFeesEvent:b,sendPageView:g}=Z4e(),[v,w]=uV.useState(!1),[T,E]=uV.useState(0),[A,x]=uV.useState({token:void 0,amount:"",fiatAmount:"",formattedFees:[]}),O=uV.useMemo((()=>e[T]),[e,T,l]);uV.useEffect((()=>{if(!t?.size||!l)return;if(O.type!==sW.SWAP)return;const[[,e]]=Object.entries(p9e(O));e&&e.token&&x({token:e.token,amount:e.formattedAmount,fiatAmount:zRe(e.formattedAmount,e.token.symbol,t),formattedFees:h9e(O,t,u)})}),[O,t,l]),b8e((()=>{const r=e.map((e=>Y4e(e,t)));g(w4e.ORDER_SUMMARY,{subView:T4e.REVIEW_ORDER,tokens:r,items:d,collectionName:n})}),(()=>Boolean(d.length&&e.length&&!r&&t.size)),[d,e,r,t]);const C=d.length>1,I=!r&&O.type===sW.SWAP;return Iq(_Pe,{testId:"order-review",header:Cq(xRe,{showBack:!0,onCloseButtonClick:()=>mKe(c),onBackButtonClick:a,title:n}),bodyStyleOverrides:{display:"flex",flexDirection:"column",justifyContent:"space-between",height:"0"},children:[Cq(qee,{size:"small",sx:{px:"base.spacing.x4",pb:"base.spacing.x4"},children:u("views.ORDER_SUMMARY.orderReview.heading")}),Cq(N3,{sx:{display:"flex",flexDirection:"column",px:"base.spacing.x2",pb:"base.spacing.x8",flex:1,maxh:I?"45%":"60%",overflowY:"scroll",scrollbarWidth:"none",rowGap:"base.spacing.x4"},children:Cq(N3,{sx:{px:"base.spacing.x2"},children:Cq(w9e,{items:d,balance:O,pricing:f.products,conversions:t,children:!C&&I&&Cq(T9e,{swapFees:A,sx:{bradtl:"0",bradtr:"0",brad:"base.borderRadius.x6",border:"0px solid transparent",borderTopWidth:"base.border.size.200",borderTopColor:"base.color.translucent.inverse.1000"},onFeesClick:()=>b(w4e.ORDER_SUMMARY)})})})}),C&&I&&Cq(T9e,{swapFees:A,sx:{mb:"-12px",bradtl:"base.borderRadius.x6",bradtr:"base.borderRadius.x6",border:"0px solid transparent",borderTopWidth:"base.border.size.100",borderTopColor:"base.color.translucent.emphasis.400"},onFeesClick:()=>b(w4e.ORDER_SUMMARY)}),Cq(d9e,{onClick:()=>{w(!0)},onProceed:s,balance:O,conversions:t,canOpen:e.length>1,loading:r,priceDisplay:d.length>1}),Cq(y9e,{conversions:t,balances:e,onSelect:n=>{E(n),y(T4e.REVIEW_ORDER,e[n],t)},onClose:()=>{w(!1)},selectedIndex:T,visible:v,loading:r,onPayWithCard:o,transactionRequirement:i,disabledPaymentTypes:p,theme:h,environment:m})]})}const A9e=(e,t)=>{const n=KRe(e.address)?e.symbol:e.address??"";return{...e,icon:JRe(t,n)}},x9e=(e,t)=>{return{type:x4e.SUFFICIENT,fundingItem:{type:nW.ERC20,token:A9e((n=e,n.current.type!==nW.ERC721&&n.current.token),t),fundsRequired:{amount:e.required.balance,formattedAmount:e.required.formattedBalance},userBalance:{balance:e.current.balance,formattedBalance:e.current.formattedBalance}}};var n},O9e=(e,t)=>{if(0===e.length)return[];const n=e.filter((e=>1===e.steps.length)),r=[nW.ERC20,nW.NATIVE];return n.flatMap((e=>e.steps.filter((e=>r.includes(e.fundingItem.type))))).map((e=>({...e,fundingItem:{...e.fundingItem,token:A9e(e.fundingItem.token,t)}})))},C9e=e=>{let t=[];const n=(r=e.name,(e,t)=>{const n=e.fundingItem&&e.fundingItem.token&&e.fundingItem.token.symbol===r?-1:0,i=t.fundingItem&&t.fundingItem.token&&t.fundingItem.token.symbol===r?-1:0;return n!==i?n-i:e.type===x4e.SUFFICIENT&&t.type===x4e.SUFFICIENT?0:e.type===x4e.SUFFICIENT?-1:t.type===x4e.SUFFICIENT?1:0});var r;return e=>(0===e.length||(t=Array.from(new Set([...t,...e])).sort(n)),t)},I9e=e=>({...e,amount:jr.from(0),formattedAmount:"0"}),_9e=(e,t)=>e.map((e=>((e,t)=>{if(e.type!==sW.SWAP)return e;if(!bNe(t))return e;const n={...e.fees,approvalGasFee:I9e(e.fees.approvalGasFee),swapGasFee:I9e(e.fees.swapGasFee)};return{...e,fees:n}})(e,t))),P9e=async e=>{const{provider:t,checkout:n,currencies:r,baseCurrency:i,onFundingBalance:a,getAmountByCurrency:o,getIsGasless:s,onComplete:c,onFundingRequirement:u}=e,l=t?.getSigner(),d=await(l?.getAddress())||"",f=n.config.environment,p=C9e(i),h=e=>{Array.isArray(e)&&e.length>0&&a(p(_9e(e,t)))},m=e=>eNe(e,i.name),y=r.map((async e=>{const r=o(e);if(!r)return null;const i=((e,t,n)=>[{type:nW.ERC20,tokenAddress:n,spenderAddress:t,amount:e}])(r,d,e.address),a=s()?void 0:{type:rW.GAS,gasToken:{type:iW.NATIVE,limit:jr.from("30000000")}};return{currency:e,smartCheckoutResult:await n.smartCheckout({provider:t,itemRequirements:i,transactionOrGasAmount:a,routingOptions:{bridge:!1,onRamp:!1,swap:!0},fundingRouteFullAmount:!0,onComplete:m(e.name)?()=>{c?.(p([]))}:void 0,onFundingRoute:m(e.name)?e=>{h(O9e([e],f))}:void 0})}})).filter(Boolean),b=await(async(e,t)=>{const n=e.map((async e=>{const n=await e;return t(n),n}));return await Promise.all(n)})(y,(({currency:e,smartCheckoutResult:t})=>{if(m(e.name)){const e=t.transactionRequirements[0];u(e)}t.sufficient&&h(((e,t)=>{if(!0===e.sufficient){const n=e.transactionRequirements.find((e=>e.type===nW.ERC20));if(n&&n.type===nW.ERC20)return[x9e(n,t)]}return!1===e.sufficient&&e?.router?.routingOutcome.type===aW.ROUTES_FOUND?O9e(e.router.routingOutcome.fundingRoutes,t):null})(t,f))}));return b},S9e=()=>{const e=uV.useRef(!1),{fromTokenAddress:t,orderQuote:n,provider:r,checkout:i,selectedCurrency:a}=z4e(),{cryptoFiatState:o}=uV.useContext($6e),[s,c]=uV.useState(),[u,l]=uV.useState([]),[d,f]=uV.useState([]),[p,h]=uV.useState(!1);return{fundingBalances:u,loadingBalances:p,fundingBalancesResult:d,transactionRequirement:s,queryFundingBalances:()=>{t&&r&&i&&n&&a&&(e.current||p||(async()=>{e.current=!0,h(!0);try{const e=await P9e({provider:r,checkout:i,currencies:n.currencies,routingOptions:{bridge:!1,onRamp:!1,swap:!0},baseCurrency:a,getAmountByCurrency:e=>{const t=g9e(e.name,n.totalAmount,o.conversions);return t?t.amount.toString():""},getIsGasless:()=>r.provider?.isPassport||!1,onFundingBalance:e=>{l([...e])},onComplete:()=>{h(!1)},onFundingRequirement:e=>{c(e)}});f(e)}catch{h(!1)}finally{e.current=!1}})())}}},k9e=e=>{if(e&&e.current.type!==nW.ERC721)return e.current.token},R9e=e=>{const t=e.find((({type:e})=>e===nW.NATIVE)),n=e.find((({type:e})=>e===nW.ERC20)),r={erc20:{value:n?.delta.formattedBalance,symbol:k9e(n)?.symbol},native:{value:t?.delta.formattedBalance,symbol:k9e(t)?.symbol}};let i=["views.PAYMENT_METHODS.topUp.subheading.erc20",r],a=n?.delta.formattedBalance||"0",o=k9e(n)?.address;return t&&n&&!t.sufficient&&!n.sufficient&&(i=["views.PAYMENT_METHODS.topUp.subheading.both",r]),t&&n&&!t.sufficient&&n.sufficient&&(a=t?.delta.formattedBalance||"0",o=k9e(t)?.address,i=["views.PAYMENT_METHODS.topUp.subheading.native",r]),{heading:["views.PAYMENT_METHODS.topUp.heading"],subheading:i,amount:a,tokenAddress:o}};class N9e{url;ttl;env;cacheMap;setCache(e,t){this.cacheMap[e]={data:t,ttl:(new Date).getTime()+1e3*this.ttl}}getCache(e){const t=this.cacheMap[e];return!t||t.ttl<=(new Date).getTime()?null:t.data}constructor(e){this.env=e.env,this.url=`${mW[this.env]}/checkout`,this.cacheMap={},this.ttl=void 0!==e.ttl?e.ttl:60}static isHttpError=e=>"code"in e;async getTransactions(e){const{txType:t,fromAddress:n}=e;try{const e=`${this.url}/v1/transactions?from_address=${n}&tx_type=${t}`,r=this.getCache(e);if(r)return Promise.resolve(r);const i=await ze.get(e);if(i.status>=400)return Promise.reject({code:i.status,message:i.statusText});const{data:a}=i;return this.setCache(e,a),Promise.resolve(a)}catch(e){let t=et.InternalServerError,n="InternalServerError";return ze.isAxiosError(e)&&(t=e.response?.status||t,n=e.message),Promise.reject({code:t,message:n})}}}var M9e;!function(e){e.BRIDGE="bridge"}(M9e||(M9e={}));const D9e={IN_PROGRESS:"in_progress",WITHDRAWAL_PENDING:"withdrawal_pending"},L9e={web3Provider:null,walletProviderName:null,from:null,to:null,tokenBridge:null,tokenBalances:[],allowedTokens:[],token:null,amount:"0"};var j9e;!function(e){e.SET_WALLETS_AND_NETWORKS="SET_WALLETS_AND_NETWORKS",e.SET_WALLET_PROVIDER_NAME="SET_WALLET_PROVIDER_NAME",e.SET_PROVIDER="SET_PROVIDER",e.SET_TOKEN_BRIDGE="SET_TOKEN_BRIDGE",e.SET_TOKEN_BALANCES="SET_TOKEN_BALANCES",e.SET_ALLOWED_TOKENS="SET_ALLOWED_TOKENS",e.SET_TOKEN_AND_AMOUNT="SET_TOKEN_AND_AMOUNT"}(j9e||(j9e={}));const F9e=uV.createContext({bridgeState:{...L9e,checkout:{}},bridgeDispatch:()=>{}});F9e.displayName="BridgeContext";const B9e=(e,t)=>{switch(t.payload.type){case j9e.SET_WALLETS_AND_NETWORKS:return{...e,from:t.payload.from,to:t.payload.to};case j9e.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case j9e.SET_PROVIDER:return{...e,web3Provider:t.payload.web3Provider};case j9e.SET_TOKEN_BRIDGE:return{...e,tokenBridge:t.payload.tokenBridge};case j9e.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case j9e.SET_ALLOWED_TOKENS:return{...e,allowedTokens:t.payload.allowedTokens};case j9e.SET_TOKEN_AND_AMOUNT:return{...e,token:t.payload.token,amount:t.payload.amount};default:return e}},U9e=(e,t)=>{const n=new CustomEvent(kH.IMTBL_BRIDGE_WIDGET_EVENT,{detail:{type:FH.TRANSACTION_SENT,data:{transactionHash:t}}});console.log("bridge success ",e,n),void 0!==e&&e.dispatchEvent(n)},z9e=(e,t)=>{const n=new CustomEvent(kH.IMTBL_BRIDGE_WIDGET_EVENT,{detail:{type:FH.FAILURE,data:{reason:t,timestamp:(new Date).getTime()}}});console.log("bridge failed ",e,n),void 0!==e&&e.dispatchEvent(n)};function H9e(e){const t=new CustomEvent(kH.IMTBL_BRIDGE_WIDGET_EVENT,{detail:{type:FH.CLOSE_WIDGET,data:{}}});console.log("bridge close ",e,t),void 0!==e&&e.dispatchEvent(t)}const W9e=(e,t)=>{const n=new CustomEvent(kH.IMTBL_BRIDGE_WIDGET_EVENT,{detail:{type:FH.CLAIM_WITHDRAWAL_SUCCESS,data:{transactionHash:t}}});console.log("bridge claim withdrawal success event:",e,n),void 0!==e&&e.dispatchEvent(n)},V9e=(e,t,n)=>{const r=new CustomEvent(kH.IMTBL_BRIDGE_WIDGET_EVENT,{detail:{type:FH.CLAIM_WITHDRAWAL_FAILURE,data:{transactionHash:t,reason:n,timestamp:(new Date).getTime()}}});console.log("bridge claim withdrawal failed event:",e,r),void 0!==e&&e.dispatchEvent(r)};function G9e(){return Iq(j3,{sx:{gap:"base.spacing.x2"},children:[Cq(z7,{sx:{h:"base.spacing.x4",w:"base.spacing.x32",mt:"base.spacing.x2"}}),Cq(oae,{shimmer:!0,emphasized:!0,size:"small"}),Cq(oae,{shimmer:!0,emphasized:!0,size:"small"}),Cq(oae,{shimmer:!0,emphasized:!0,size:"small"})]})}const q9e={px:"base.spacing.x4",display:"flex",flexDirection:"column",height:"100%"},K9e={flexGrow:"1",flexShrink:"0",flexBasis:"0"},X9e={flexGrow:"0",flexShrink:"1",mt:"base.spacing.x2"},Y9e={bg:"base.color.translucent.emphasis.100",borderRadius:"base.borderRadius.x4",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",height:"100%",px:"base.spacing.x5"};function Z9e({openWalletDrawer:e}){const{t:t}=_ke();return Iq(N3,{sx:Y9e,children:[Cq(tee,{sx:{mb:"base.spacing.x8"},children:t("views.TRANSACTIONS.status.emptyState.notConnected.body")}),Cq(O3,{variant:"secondary",size:"medium",testId:"transactions-connect-wallet-button",onClick:e,children:t("views.TRANSACTIONS.status.emptyState.notConnected.buttonText")})]})}const J9e={backgroundColor:"base.color.neutral.800",px:"base.spacing.x4",p:"base.spacing.x5",borderRadius:"base.borderRadius.x6"},Q9e={color:"base.color.text.body.secondary"};function $9e({checkout:e,isPassport:t}){const{t:n}=_ke(),[r,i]=uV.useState("");return uV.useEffect((()=>{e&&i(Kke[e.config.environment])}),[e]),Cq(N3,{sx:J9e,children:Iq(N3,{sx:{display:"flex",flexDirection:"column"},children:[Iq(N3,{children:[Cq(tee,{size:"small",children:n("views.TRANSACTIONS.support.body1")}),Iq(tee,{size:"small",sx:Q9e,children:[n("views.TRANSACTIONS.support.body2"),Cq(kae,{size:"small",rc:Cq("a",{target:"_blank",href:n("views.TRANSACTIONS.support.supportLink"),rel:"noreferrer"}),children:n("views.TRANSACTIONS.support.body3")})]})]}),t&&Iq(tee,{size:"small",sx:Q9e,children:[n("views.TRANSACTIONS.support.passport.body1")," ",Cq(kae,{size:"small",rc:Cq("a",{target:"_blank",href:r,rel:"noreferrer"}),children:n("views.TRANSACTIONS.support.passport.body2")})]})]})})}const e7e={display:"flex",flexDirection:"column",borderRadius:"base.borderRadius.x4",bg:"base.color.translucent.emphasis.100"},t7e={p:"base.spacing.x3",d:"flex",justifyContent:"space-between",position:"relative"},n7e={display:"flex",flexGrow:"1",alignItems:"center",gap:"base.spacing.x2"};function r7e({transaction:e,environment:t}){const n=RPe(e.details.from_chain),r=RPe(e.details.to_chain);return Iq(N3,{sx:{display:"flex",px:"base.spacing.x4",gap:"base.spacing.x2"},children:[Cq(i7,{sx:{w:"base.icon.size.400",h:"base.icon.size.400"},use:Cq("img",{src:ZRe(t,n),alt:$ke[n]})}),Iq(N3,{sx:{display:"flex",flexDirection:"column",flexGrow:"1"},children:[Cq(tee,{size:"xxSmall",sx:{color:"base.color.translucent.standard.900"},children:$ke[n]}),Cq(tse,{size:"xxSmall",sx:{color:"base.color.translucent.standard.600"},text:e.details.from_address})]}),Cq(N3,{sx:{flexGrow:"1"}}),Cq(S6,{icon:"ArrowForward",sx:{w:"base.icon.size.250",fill:"base.color.brand.4"}}),Cq(N3,{sx:{flexGrow:"1"}}),Cq(i7,{sx:{w:"base.icon.size.400",h:"base.icon.size.400"},use:Cq("img",{src:ZRe(t,r),alt:$ke[r]})}),Iq(N3,{sx:{display:"flex",flexDirection:"column",flexGrow:"1"},children:[Cq(tee,{size:"xxSmall",sx:{color:"base.color.translucent.standard.900"},children:$ke[r]}),Cq(tse,{size:"xxSmall",sx:{color:"base.color.translucent.standard.600"},text:e.details.to_address})]})]})}function i7e({label:e,details:t,transaction:n,fiatAmount:r,amount:i,icon:a,defaultTokenImage:o,environment:s}){const{track:c}=OPe(),u=uV.useMemo((()=>`${t.link}${t.hash}`),[t]);return Cq(N3,{testId:`transaction-item-${n.blockchain_metadata.transaction_hash}`,sx:e7e,children:Iq(M4,{chevronSide:"right",sx:{button:{p:"base.spacing.x1"},article:{pr:"base.spacing.x10"}},onExpandChange:e=>e&&c({userJourney:bPe.BRIDGE,screen:"TransactionItem",control:"Accordion",controlType:"Button"}),children:[Cq(M4.TargetLeftSlot,{sx:{pr:"base.spacing.x2"},children:Iq(oae,{size:"xSmall",children:[Cq(oae.FramedImage,{circularFrame:!0,use:Cq(a2e,{src:a,name:e,defaultImage:o})}),Cq(oae.Label,{children:e}),Cq(oae.Caption,{children:Cq(kae,{size:"xSmall",rc:Cq("a",{target:"_blank",href:u,rel:"noreferrer",onClick:e=>{return n=t,e.stopPropagation(),void c({userJourney:bPe.BRIDGE,screen:"TransactionItem",control:"Details",controlType:"Link",extras:{linkDetail:n}});var n}}),children:t.text})}),Cq(oae.PriceDisplay,{fiatAmount:r,price:i})]})}),Iq(M4.ExpandedContent,{sx:{pr:"0",pl:"0",mb:"base.spacing.x3",gap:"0"},children:[Cq(X3,{size:"xSmall",sx:{px:"base.spacing.x2"}}),Cq(r7e,{transaction:n,environment:s})]})]})})}const a7e=e=>{let t=440;return e&&(t-=20),{backgroundColor:"base.color.neutral.800",px:"base.spacing.x4",pt:"base.spacing.x5",pb:"base.spacing.x4",borderRadius:"base.borderRadius.x6",h:`${t}px`,w:"100%",overflowY:"scroll"}},o7e={borderRadius:"base.borderRadius.x4",display:"flex",flexDirection:"column",gap:"base.spacing.x5"};function s7e({label:e,transaction:t,fiatAmount:n,amount:r,icon:i,defaultTokenImage:a,environment:o}){const{viewDispatch:s}=uV.useContext(ERe),{track:c}=OPe(),u=_ke(),l=uV.useMemo((()=>(new Date).getTime()),[]),d=uV.useMemo((()=>t.details.current_status.withdrawal_ready_at?new Date(t.details.current_status.withdrawal_ready_at):void 0),[t]),f=t.details.current_status.status===D9e.WITHDRAWAL_PENDING,p=new Intl.RelativeTimeFormat(u[1].language||"en",{numeric:"auto"}),h=uV.useMemo((()=>{if(!f||void 0===d)return"";const e=(d.getTime()-l)/6e4;if(e<=1)return"in 1 minute";if(e<60)return p.format(Math.ceil(e),"minute");const t=e/60;if(e<1440)return p.format(Math.ceil(t),"hour");const n=t/24;return p.format(Math.ceil(n),"day")}),[l,u[1].language]),m=!!d&&d.getTime()<l,y=uV.useMemo((()=>!0===m?u.t("views.TRANSACTIONS.status.withdrawalPending.withdrawalReadyText"):`${u.t("views.TRANSACTIONS.status.withdrawalPending.withdrawalDelayText")} ${h}`),[h,u[1].language]);return Iq(N3,{testId:`transaction-item-${t.blockchain_metadata.transaction_hash}`,sx:e7e,children:[f&&Iq(Oq,{children:[Iq(N3,{sx:t7e,children:[Iq(N3,{sx:n7e,children:[Cq(S6,{icon:"Alert",variant:"bold",sx:{fill:m?"base.color.status.fatal.bright":"base.color.status.attention.bright",w:"base.icon.size.200"}}),Cq(tee,{testId:`transaction-item-${t.blockchain_metadata.transaction_hash}-action-message`,size:"xSmall",sx:{color:"base.color.text.body.secondary"},children:y})]}),f&&m&&Cq(O3,{testId:`transaction-item-${t.blockchain_metadata.transaction_hash}-action-button`,variant:"primary",size:"small",onClick:()=>{s({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.CLAIM_WITHDRAWAL,transaction:t}}})},children:u.t("views.TRANSACTIONS.status.withdrawalPending.actionButtonText")})]}),Cq(X3,{size:"small",sx:{color:"base.color.translucent.emphasis.300",opacity:.1}})]}),Iq(M4,{chevronSide:"right",sx:{button:{p:"base.spacing.x1"},article:{pr:"base.spacing.x10"},borderTopRightRadius:"0",borderTopLeftRadius:"0"},onExpandChange:e=>e&&c({userJourney:bPe.BRIDGE,screen:"TransactionItem",control:"Accordion",controlType:"Button"}),children:[Cq(M4.TargetLeftSlot,{sx:{pr:"base.spacing.x2"},children:Iq(oae,{size:"xSmall",children:[Cq(oae.FramedImage,{circularFrame:!0,use:Cq(a2e,{src:i,name:e,defaultImage:a})}),Cq(oae.Label,{children:e}),Cq(oae.Caption,{children:u.t("views.TRANSACTIONS.status.withdrawalPending.caption")}),Cq(oae.PriceDisplay,{fiatAmount:n,price:r})]})}),Iq(M4.ExpandedContent,{sx:{pr:"0",pl:"0",mb:"base.spacing.x3",gap:"0"},children:[Cq(X3,{size:"xSmall",sx:{px:"base.spacing.x2"}}),Cq(r7e,{transaction:t,environment:o})]})]})]})}const c7e={display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",p:"base.spacing.x2",pb:"base.spacing.x4"},u7e={position:"relative",pr:"base.spacing.x2"},l7e={width:"base.icon.size.400"},d7e={position:"absolute",top:"-6px",left:"18px",width:"20px",padding:"2px",backgroundColor:"base.color.translucent.inverse.900",borderRadius:"base.borderRadius.x2"},f7e={backgroundColor:"transparent",width:"base.icon.size.400",height:"base.icon.size.400",marginRight:"base.spacing.x1",padding:"base.spacing.x1"};function p7e({onChangeWalletClick:e}){const{t:t}=_ke(),{bridgeState:{from:n}}=uV.useContext(F9e),[r,i]=uV.useState(void 0),[a,o]=uV.useState(!1),{isWalletConnectEnabled:s,getWalletLogoUrl:c}=aqe(),{track:u}=OPe(),l=n?.walletAddress||"",d=n?.walletProviderInfo;return uV.useEffect((()=>{if(s){const e=hNe(n?.web3Provider);o(e),e&&(async()=>{i(await c())})()}}),[s,n]),Iq(N3,{sx:c7e,children:[Iq(N3,{sx:{display:"flex",alignItems:"center",gap:"base.spacing.x1"},children:[a&&r?Iq(N3,{sx:u7e,children:[Cq(i7,{sx:l7e,use:Cq("img",{src:r,alt:"walletconnect"})}),Cq(O8,{logo:"WalletConnectSymbol",sx:d7e})]}):d&&Cq(dNe,{src:d.icon,alt:d.name,sx:f7e}),Cq(tse,{leftSideLength:6,rightSideLength:4,text:l})]}),Cq(O3,{size:"small",variant:"tertiary",onClick:()=>{u({userJourney:bPe.BRIDGE,screen:y8e.TRANSACTIONS,controlType:"Button",control:"Pressed"}),e()},children:t("views.TRANSACTIONS.changeWallet.buttonText")})]})}function h7e({checkout:e,transactions:t,knownTokenMap:n,isPassport:r,defaultTokenImage:i,changeWallet:a}){const{cryptoFiatState:o}=uV.useContext($6e),{t:s}=_ke(),[c,u]=uV.useState(""),{environment:l}=e.config;uV.useEffect((()=>{e&&u(qke[e.config.environment])}),[e]);const d=uV.useCallback(((e,t)=>e.details.current_status.status===D9e.WITHDRAWAL_PENDING&&t.details.current_status.status!==D9e.WITHDRAWAL_PENDING?-1:e.details.current_status.status===t.details.current_status.status?0:1),[]),f=uV.useCallback((t=>KRe(t.details.from_token_address)?JRe(e.config.environment,function(e){switch(e){case qH.ETHEREUM:case qH.SEPOLIA:return"ETH";case qH.IMTBL_ZKEVM_TESTNET:case qH.IMTBL_ZKEVM_MAINNET:case qH.IMTBL_ZKEVM_DEVNET:return"IMX";default:return""}}(t.details.from_chain)):JRe(e.config.environment,t.details.from_token_address)),[e]);return Iq(N3,{sx:a7e(r),children:[Cq(p7e,{onChangeWalletClick:a}),Cq(N3,{testId:"move-transaction-list",sx:o7e,children:t.sort(d).map((e=>{const t=e.blockchain_metadata.transaction_hash,r=n[e.details.from_chain][e.details.from_token_address.toLowerCase()],a=Xd(e.details.amount,r.decimals),u=zRe(a,r.symbol,o.conversions);return e.details.current_status.status===D9e.WITHDRAWAL_PENDING?Cq(s7e,{label:r.symbol,transaction:e,fiatAmount:`${s("views.TRANSACTIONS.fiatPricePrefix")}${u}`,amount:a,icon:f(e),defaultTokenImage:i,environment:l},t):Cq(i7e,{label:r.symbol,details:{text:s("views.TRANSACTIONS.status.inProgress.stepInfo"),link:c,hash:t},transaction:e,fiatAmount:`${s("views.TRANSACTIONS.fiatPricePrefix")}${u}`,amount:a,icon:f(e),defaultTokenImage:i,environment:l},t)}))})]})}const m7e={backgroundColor:"base.color.neutral.800",px:"base.spacing.x4",pt:"base.spacing.x5",pb:"base.spacing.x4",borderRadius:"base.borderRadius.x6",h:"100%",w:"100%",display:"flex",flexDirection:"column"},y7e={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:"base.spacing.x5",flex:1},b7e={mb:"base.spacing.x8",color:"base.color.text.body.secondary"},g7e={color:"base.color.text.body.secondary"};function v7e({checkout:e,isPassport:t,changeWallet:n}){const{page:r}=OPe(),{t:i}=_ke(),[a,o]=uV.useState("");return uV.useEffect((()=>{e&&o(Kke[e.config.environment])}),[e]),uV.useEffect((()=>{r({userJourney:bPe.BRIDGE,screen:"NoTransactions"})}),[]),Iq(N3,{sx:m7e,children:[Cq(p7e,{onChangeWalletClick:n}),Iq(N3,{sx:y7e,children:[Cq(tee,{size:"small",sx:b7e,children:i("views.TRANSACTIONS.status.noTransactions.body")}),t&&Iq(tee,{size:"small",sx:g7e,children:[i("views.TRANSACTIONS.status.noTransactions.passport.body")," ",Cq(kae,{size:"small",rc:Cq("a",{target:"_blank",href:a,rel:"noreferrer"}),children:i("views.TRANSACTIONS.status.noTransactions.passport.link")})]})]})]})}function w7e({defaultTokenImage:e,onBackButtonClick:t}){const{eventTargetState:{eventTarget:n}}=uV.useContext(zqe),{cryptoFiatDispatch:r}=uV.useContext($6e),{bridgeDispatch:i,bridgeState:{checkout:a,from:o}}=uV.useContext(F9e),{page:s}=OPe(),{t:c}=_ke(),{track:u}=OPe(),[l,d]=uV.useState(!0),[f,p]=uV.useState(void 0),[h,m]=uV.useState([]),[y,b]=uV.useState(!1),g=fNe(o?.web3Provider),v=uV.useCallback((async()=>{if(!a)return{};const e=Jke(a.config);try{return((await a.getTokenAllowList({type:ZH.BRIDGE,chainId:e})).tokens??[]).reduce(((e,t)=>(e[t.address.toLowerCase()]=t,e)),{})}catch(e){return console.error(e),[]}}),[a]),w=uV.useCallback((async()=>{if(!o?.web3Provider)return{};if(!o?.walletAddress)return{};const e=Qke(a.config);try{return(await a.getAllBalances({provider:o?.web3Provider,walletAddress:o?.walletAddress,chainId:e})).balances.reduce(((e,t)=>(e[t.token.address.toLowerCase()]=t.token,e)),{})}catch(e){return console.error(e),[]}}),[a,o]),T=async e=>{const t=kPe(Jke(a.config)),n=kPe(Qke(a.config)),[i,o]=await Promise.all([v(),w()]),s={};Object.entries(e).forEach((([r,a])=>{(e[r]===t&&!i[r]||e[r]===n&&!o[r])&&(s[r]=a)}));const c=new _d(a.config.networkMap.get(Jke(a.config))?.rpcUrls[0]),u=new _d(a.config.networkMap.get(Qke(a.config))?.rpcUrls[0]),l=[],d=[];Object.entries(s).forEach((([e,n])=>{n===t?l.push(a.getTokenInfo({provider:c,tokenAddress:e})):d.push(a.getTokenInfo({provider:u,tokenAddress:e}))}));const f=await Promise.allSettled(l),p=await Promise.allSettled(d);f.filter((e=>"fulfilled"===e.status)).forEach((e=>{const t=e;i[t.value.address.toLowerCase()]=t.value})),p.filter((e=>"fulfilled"===e.status)).forEach((e=>{const t=e;o[t.value.address.toLowerCase()]=t.value}));const h=[];return Object.values(i).forEach((e=>h.push(e.symbol.toLowerCase()))),Object.values(o).forEach((e=>h.push(e.symbol.toLowerCase()))),r({payload:{type:Q6e.SET_TOKEN_SYMBOLS,tokenSymbols:h}}),{[t]:i,[n]:o}},E=uV.useCallback((async(e,t)=>new N9e({env:e}).getTransactions({txType:M9e.BRIDGE,fromAddress:t})),[]),A=uV.useCallback((async e=>{u({userJourney:bPe.BRIDGE,screen:"EmptyStateNotConnected",control:"WalletProvider",controlType:"Select",extras:{walletProviderName:e.providerDetail.info.name}});try{let t=!1;e.providerDetail.info.rdns===eW.METAMASK&&(t=!0);const n=new Ld(e.provider),r=await gNe(a,n,t),o=await r.getNetwork(),s=await r.getSigner().getAddress();m([]),i({payload:{type:j9e.SET_WALLETS_AND_NETWORKS,from:{web3Provider:r,walletProviderInfo:{...e.providerDetail.info},walletAddress:s.toLowerCase(),network:o.chainId},to:null}})}catch(e){console.error(e)}finally{b(!1)}}),[a]),x=uV.useCallback((async()=>{if(!o?.walletAddress)return;const e=await E(a.config.environment,o?.walletAddress),t={};return e.result.forEach((e=>{t[e.details.from_token_address]=e.details.from_chain})),{tokens:await T(t),transactions:e.result}}),[o,E]),{providers:O}=sqe({checkout:a}),C=uV.useMemo((()=>O),[O]);return uV.useEffect((()=>{(async()=>{d(!0);const e=await x8e(x,zke);if(!e)return void d(!1);const t=e.transactions.filter((t=>{const n=e.tokens[t.details.from_chain];if(!n)return!1;return!!n[t.details.from_token_address.toLowerCase()]}));p(e.tokens),m(t),d(!1)})()}),[o,a]),uV.useEffect((()=>{s({userJourney:bPe.BRIDGE,screen:"Transactions"})}),[]),Cq(_Pe,{testId:"bridge-view",header:Cq(xRe,{showBack:!0,onBackButtonClick:()=>{o&&(i({payload:{type:j9e.SET_WALLETS_AND_NETWORKS,from:{web3Provider:o?.web3Provider,walletAddress:o?.walletAddress,walletProviderInfo:o?.walletProviderInfo,network:o?.network},to:null}}),i({payload:{type:j9e.SET_TOKEN_AND_AMOUNT,token:null,amount:""}})),t()},title:c("views.TRANSACTIONS.layoutHeading"),onCloseButtonClick:()=>H9e(n)}),footer:Cq(oNe,{}),children:Iq(N3,{sx:q9e,children:[Iq(N3,{sx:K9e,children:[!o?.web3Provider&&Cq(Z9e,{openWalletDrawer:()=>b(!0)}),o?.web3Provider&&l&&Cq(G9e,{}),o?.web3Provider&&!l&&h.length>0&&f&&Cq(h7e,{checkout:a,transactions:h,knownTokenMap:f,isPassport:g,defaultTokenImage:e,changeWallet:()=>b(!0)}),o?.web3Provider&&!l&&0===h.length&&Cq(v7e,{checkout:a,isPassport:g,changeWallet:()=>b(!0)})]}),o?.web3Provider&&h.length>0&&Cq(N3,{sx:X9e,children:Cq($9e,{checkout:a,isPassport:g})}),Cq(mqe,{testId:"select-wallet-drawer",drawerText:{heading:c("views.TRANSACTIONS.walletSelection.heading")},showWalletSelectorTarget:!1,walletOptions:C,showDrawer:y,setShowDrawer:e=>{b(e)},onWalletChange:A})]})})}function T7e({transactionResponse:e}){const{t:t}=_ke(),{viewDispatch:n}=uV.useContext(ERe),{page:r}=OPe();return uV.useEffect((()=>{r({userJourney:bPe.BRIDGE,screen:"ClaimWithdrawalInProgress"})}),[]),uV.useEffect((()=>{e&&(async()=>{try{const t=await e.wait();if(1===t.status)return void n({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.CLAIM_WITHDRAWAL_SUCCESS,transactionHash:t.transactionHash}}});n({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.CLAIM_WITHDRAWAL_FAILURE,transactionHash:t.transactionHash,reason:"Transaction failed"}}})}catch(e){console.error(e),n({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.CLAIM_WITHDRAWAL_FAILURE,transactionHash:"",reason:"Transaction failed"}}})}})()}),[e]),Cq(PPe,{loadingText:t("views.CLAIM_WITHDRAWAL.IN_PROGRESS.loading.text")})}function E7e(e){return e?e.substring(0,6).concat("...").concat(e.substring(e.length-4)):""}const A7e={height:"100%",display:"flex",flexDirection:"column",paddingX:"base.spacing.x4"},x7e={paddingTop:"base.spacing.x10",paddingBottom:"base.spacing.x4"},O7e={display:"flex",flexDirection:"column",paddingY:"base.spacing.x6"};function C7e({testId:e,chainId:t,chainName:n,onNetworkClick:r,environment:i}){return Iq(oae,{testId:`${e}-network-list-${t}`,size:"medium",emphasized:!0,onClick:async()=>{await r(t)},sx:{marginBottom:"base.spacing.x1"},children:[Cq(oae.FramedImage,{use:Cq("img",{src:ZRe(i,t),alt:n})}),Cq(oae.Label,{size:"medium",children:n})]})}VH.IMTBL_ZKEVM_DEVNET,VH.IMTBL_ZKEVM_TESTNET,VH.IMTBL_ZKEVM_MAINNET,VH.ETHEREUM,VH.SEPOLIA;const I7e={position:"relative",width:"100%",backgroundColor:"base.color.translucent.emphasis.100",borderRadius:"base.borderRadius.x4",paddingX:"base.spacing.x3",paddingY:"base.spacing.x5",display:"flex",flexDirection:"row",gap:"base.spacing.x4",alignItems:"center","&:hover":{cursor:"pointer",backgroundColor:"base.color.translucent.emphasis.200"}},_7e={width:"base.icon.size.500",backgroundColor:"base.color.translucent.standard.200",borderRadius:"base.borderRadius.x2"},P7e={position:"absolute",top:"14px",left:"38px",width:"28px",padding:"base.spacing.x1",backgroundColor:"base.color.translucent.inverse.900",borderRadius:"base.borderRadius.x2"},S7e={color:"base.color.text.body.secondary"},k7e={paddingY:"base.spacing.x6",borderRadius:"base.borderRadius.x18"};function R7e({testId:e,walletProvider:t,walletProviderDetail:n,walletAddress:r,walletName:i,chainId:a,disableNetworkButton:o=!1,onWalletClick:s,onNetworkClick:c,environment:u}){const l=SPe(a),[d,f]=uV.useState(void 0),[p,h]=uV.useState("Other"),[m,y]=uV.useState(!1),{isWalletConnectEnabled:b,getWalletLogoUrl:g,getWalletName:v}=aqe(),w=uV.useMemo((()=>n?.info.rdns===eW.PASSPORT?i:hNe(t)?p:n?.info.name),[n,p,t]);return uV.useEffect((()=>{if(b){const e=hNe(t);y(e),e&&((async()=>{f(await g())})(),h(v()))}}),[b,t,g,v]),Iq(N3,{testId:`${e}-${n?.info.rdns}-${a}-button-wrapper`,sx:I7e,onClick:s,children:[m&&d?Iq(Oq,{children:[Cq(i7,{imageUrl:d,alt:"walletconnect",sx:_7e}),Cq(O8,{logo:"WalletConnectSymbol",sx:P7e})]}):n&&Cq(dNe,{src:n.info.icon,alt:n.info.name}),Iq(N3,{sx:{display:"flex",flexDirection:"column",flex:1},children:[Cq(qee,{size:"xSmall",sx:{textTransform:"capitalize"},children:w}),Cq(tee,{size:"xSmall",sx:S7e,children:r})]}),Iq(O3,{testId:`${e}-network-${a}-button`,size:"small",disabled:o,onClick:e=>{e.stopPropagation(),c(e)},variant:"tertiary",sx:k7e,children:[Cq(i7,{sx:{w:"base.icon.size.400",h:"base.icon.size.400"},use:Cq("img",{src:ZRe(u,a),alt:l[a]})}),l]})]})}const N7e="wallet-network-selector";function M7e(){const{t:e}=_ke(),{bridgeState:{checkout:t,from:n,to:r},bridgeDispatch:i}=uV.useContext(F9e),{viewDispatch:a}=uV.useContext(ERe),{providers:o}=sqe({checkout:t}),{environment:s}=t.config,{track:c}=OPe(),u=n?.web3Provider??null,l=n?.network??null,d=n?.walletAddress?.toLowerCase()??"",f=n?{provider:u,providerDetail:{provider:u,info:{...n.walletProviderInfo}}}:null,p=r?.web3Provider??null,h=r?.network??null,m=r?.walletAddress?.toLowerCase()??"",y=r?{provider:p,providerDetail:{provider:p,info:{...r.walletProviderInfo}}}:null,b=Jke(t.config),g=SPe(b),v=Qke(t.config),w=SPe(v),[T,E]=uV.useState(!1),[A,x]=uV.useState(!1),[O,C]=uV.useState(u),[I,_]=uV.useState(l),[P,S]=uV.useState(d),[k,R]=uV.useState(f),[N,M]=uV.useState(!1),[D,L]=uV.useState(!1),[j,F]=uV.useState(p),[B,U]=uV.useState(h),[z,H]=uV.useState(m),[W,V]=uV.useState(y),G=O&&I,q=j&&B,K=uV.useMemo((()=>O?mNe(O):null),[O]),X=uV.useMemo((()=>j?mNe(j):null),[j]),Y=uV.useMemo((()=>o),[o]),Z=uV.useMemo((()=>o.filter((e=>e.info.rdns!==eW.PASSPORT||e.info.rdns===eW.PASSPORT&&k?.providerDetail?.info?.rdns!==eW.PASSPORT))),[o,I,k]);function J(){F(null),U(null)}uV.useEffect((()=>{n&&r&&i({payload:{type:j9e.SET_WALLETS_AND_NETWORKS,from:null,to:null}})}),[n,r]);const Q=uV.useCallback((async e=>{J(),R(e);let n=!1;e.providerDetail.info.rdns===eW.METAMASK&&(n=!0);const r=new Ld(e.provider),i=await gNe(t,r,n);await(async e=>{C(e);const t=await e.getSigner().getAddress();if(S(t.toLowerCase()),c({userJourney:bPe.BRIDGE,screen:"WalletAndNetwork",control:"FromWallet",controlType:"Select",extras:{walletAddress:t.toLowerCase()}}),fNe(e))return _(v),E(!1),void c({userJourney:bPe.BRIDGE,screen:"WalletAndNetwork",control:"FromNetwork",controlType:"Select",extras:{chainId:v}});_(null),E(!1),setTimeout((()=>x(!0)),500)})(i)}),[t]),$=uV.useCallback((async e=>{O&&(J(),x(!1),_(e),c({userJourney:bPe.BRIDGE,screen:"WalletAndNetwork",control:"FromNetwork",controlType:"Select",extras:{chainId:e}}))}),[t,O]),ee=uV.useCallback((async e=>{j&&(M(!1),U(e),c({userJourney:bPe.BRIDGE,screen:"WalletAndNetwork",control:"ToNetwork",controlType:"Select",extras:{chainId:e}}))}),[t,j]),te=uV.useCallback((e=>{const t=P===e&&I===v?b:v;U(t),L(!1),c({userJourney:bPe.BRIDGE,screen:"WalletAndNetwork",control:"ToNetwork",controlType:"Select",extras:{chainId:t}})}),[P,I]),ne=uV.useCallback((e=>{F(e),e.getSigner().getAddress().then((e=>{H(e.toLowerCase()),te(e.toLowerCase()),c({userJourney:bPe.BRIDGE,screen:"WalletAndNetwork",control:"ToWallet",controlType:"Select",extras:{walletAddress:e.toLowerCase()}})}))}),[te]),re=uV.useCallback((async e=>{if(k?.providerDetail.info.rdns===e.providerDetail.info.rdns){F(O),V(e);const t=await O.getSigner().getAddress();return H(t.toLowerCase()),te(t.toLowerCase()),void c({userJourney:bPe.BRIDGE,screen:"WalletAndNetwork",control:"ToWallet",controlType:"Select",extras:{walletAddress:t.toLowerCase()}})}try{V(e);const n=new Ld(e.provider),r=await gNe(t,n,!1);if(hNe(r))ne(r);else{F(r);const e=await r.getSigner().getAddress();H(e.toLowerCase()),te(e.toLowerCase()),c({userJourney:bPe.BRIDGE,screen:"WalletAndNetwork",control:"ToWallet",controlType:"Select",extras:{walletAddress:e.toLowerCase()}})}}catch(e){console.error(e)}}),[K,O,te,ne]),ie=uV.useCallback((()=>{O&&I&&j&&B&&(i({payload:{type:j9e.SET_TOKEN_BALANCES,tokenBalances:[]}}),i({payload:{type:j9e.SET_ALLOWED_TOKENS,allowedTokens:[]}}),i({payload:{type:j9e.SET_WALLETS_AND_NETWORKS,from:{web3Provider:O,walletAddress:P.toLowerCase(),walletProviderInfo:k?.providerDetail.info,network:I},to:{web3Provider:j,walletAddress:z.toLowerCase(),walletProviderInfo:W?.providerDetail.info,network:B}}}),c({userJourney:bPe.BRIDGE,screen:"WalletAndNetwork",control:"Next",controlType:"Button",extras:{fromWalletAddress:P,fromNetwork:I,fromWallet:{address:P,rdns:k?.providerDetail.info.rdns,uuid:k?.providerDetail.info.uuid,isPassportWallet:fNe(O),isMetaMask:pNe(O)},toWalletAddress:z,toNetwork:B,toWallet:{address:z,rdns:W?.providerDetail.info.rdns,uuid:W?.providerDetail.info.uuid,isPassportWallet:fNe(j),isMetaMask:pNe(j)},moveType:I&&I===B?"transfer":"bridge"}}),a({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.BRIDGE_FORM}}}))}),[k,O,I,P,W,j,B,z]);return Iq(N3,{testId:N7e,sx:A7e,children:[Cq(qee,{testId:`${N7e}-heading`,size:"small",weight:"regular",sx:x7e,children:e("views.WALLET_NETWORK_SELECTION.heading")}),Cq(qee,{size:"xSmall",sx:{paddingBottom:"base.spacing.x2"},children:e("views.WALLET_NETWORK_SELECTION.fromFormInput.heading")}),Cq(mqe,{testId:`${N7e}-from`,drawerText:{heading:e("views.WALLET_NETWORK_SELECTION.fromFormInput.walletSelectorHeading"),defaultText:e("views.WALLET_NETWORK_SELECTION.fromFormInput.selectDefaultText")},showWalletSelectorTarget:!G,showDrawer:T,setShowDrawer:E,walletOptions:Y,onWalletChange:Q}),G&&K&&Iq(N3,{sx:{display:"flex",flexDirection:"column",gap:"base.spacing.x10"},children:[Cq(R7e,{testId:N7e,walletProviderDetail:k?.providerDetail,walletProvider:O,walletName:K,walletAddress:E7e(P),chainId:I,disableNetworkButton:K===$H.PASSPORT.toString(),onWalletClick:()=>{E(!0)},onNetworkClick:()=>x(!0),environment:s}),Iq(N3,{children:[Cq(qee,{size:"xSmall",sx:{paddingBottom:"base.spacing.x2"},children:e("views.WALLET_NETWORK_SELECTION.toFormInput.heading")}),Cq(mqe,{testId:`${N7e}-to`,drawerText:{heading:e("views.WALLET_NETWORK_SELECTION.toFormInput.walletSelectorHeading"),defaultText:e("views.WALLET_NETWORK_SELECTION.toFormInput.selectDefaultText")},showWalletSelectorTarget:!q,walletOptions:Z,showDrawer:D,setShowDrawer:L,onWalletChange:re})]})]}),Cq(wne,{headerBarTitle:e(A?"views.WALLET_NETWORK_SELECTION.fromFormInput.networkSelectorHeading":"views.WALLET_NETWORK_SELECTION.toFormInput.networkSelectorHeading"),size:"full",onCloseDrawer:()=>{A?x(!1):M(!1)},visible:A||N,children:Iq(wne.Content,{sx:{paddingX:"base.spacing.x4"},children:[Cq(C7e,{testId:N7e,chainName:w,onNetworkClick:A?$:ee,chainId:v,environment:s},w),(N||k?.providerDetail.info.rdns!==eW.PASSPORT)&&Cq(C7e,{testId:N7e,chainName:g,onNetworkClick:A?$:ee,chainId:b,environment:s},g)]})}),q&&X&&Iq(N3,{sx:{flex:1,display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[Cq(R7e,{testId:N7e,walletProviderDetail:W?.providerDetail,walletProvider:j,walletName:X,walletAddress:E7e(z),chainId:B,disableNetworkButton:I===b||X===$H.PASSPORT.toString()||P===z,onWalletClick:()=>{L(!0)},onNetworkClick:()=>{M(!0)},environment:s}),Cq(N3,{sx:O7e,children:Cq(O3,{testId:`${N7e}-submit-button`,size:"large",onClick:ie,children:e("views.WALLET_NETWORK_SELECTION.submitButton.text")})})]})]})}function D7e(){const{t:e}=_ke(),{viewDispatch:t}=uV.useContext(ERe),{eventTargetState:{eventTarget:n}}=uV.useContext(zqe),{page:r}=OPe();return uV.useEffect((()=>{r({userJourney:bPe.BRIDGE,screen:"WalletNetworkSelection"})}),[]),Cq(_Pe,{testId:"bridge-view",header:Cq(xRe,{title:e("views.WALLET_NETWORK_SELECTION.layoutHeading"),onCloseButtonClick:()=>H9e(n),rightActions:Cq(d4,{icon:"Minting",sx:gRe(),onClick:()=>{t({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.TRANSACTIONS}}})},testId:"move-transactions-button"})}),footer:Cq(oNe,{}),children:Cq(M7e,{})})}function L7e(e,t){return e&&0!==parseFloat(e)?t&&Number(e)>Number(t)?"views.BRIDGE_FORM.validation.insufficientBalance":"":"views.BRIDGE_FORM.validation.noAmountInputted"}const j7e={height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between",paddingTop:"base.spacing.x10"},F7e={paddingTop:"base.spacing.x4",display:"flex",gap:"base.spacing.x1"},B7e={display:"flex",flexDirection:"column",paddingY:"base.spacing.x6",paddingX:"base.spacing.x4"};function U7e({sx:e}){return Iq(N3,{sx:{...e,paddingTop:"0",marginTop:"base.spacing.x4"},rc:Cq("div",{}),children:[Cq(N3,{sx:{display:"flex",backgroundColor:"#F3F3F30A",borderRadius:"8px"},children:Cq(N3,{sx:{minw:"170px",height:"64px",WebkitMaskPosition:"left center",WebkitMaskRepeat:"no-repeat",WebkitMaskSize:"contain",WebkitMaskImage:'url(\'data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none"><path d="M154.75 39q1.65 0 2.85-1.15 1.15-1.15 1.15-2.85v-4q0-1.65-1.15-2.8-1.2-1.2-2.85-1.2h-93.6q-2.3 0-3.85 1.2-1.55 1.15-1.55 2.8v4q0 1.7 1.55 2.85Q58.85 39 61.15 39h93.6m-111.7-3.35q.2-1.3.2-2.65 0-1.35-.2-2.65-.75-4.9-4.5-8.65-4.7-4.7-11.3-4.7-6.65 0-11.3 4.7-4.7 4.7-4.7 11.3 0 6.65 4.7 11.3Q20.6 49 27.25 49q6.6 0 11.3-4.7 3.75-3.7 4.5-8.65Z" id="a"/></svg>\')'},rc:Cq("span",{}),children:Cq(z7,{rc:Cq("span",{})})})}),Cq(N3,{sx:{display:"flex",width:"100%",backgroundColor:"#F3F3F30A",borderRadius:"8px"},children:Cq(N3,{sx:{width:"100%",height:"64px",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:Cq("span",{}),children:Cq(z7,{rc:Cq("span",{})})})})]})}function z7e(e){const{t:t}=_ke(),{bridgeDispatch:n,bridgeState:{tokenBalances:r,allowedTokens:i,checkout:a,from:o,to:s,amount:c,token:u}}=uV.useContext(F9e),{cryptoFiatState:l,cryptoFiatDispatch:d}=uV.useContext($6e),{viewDispatch:f}=uV.useContext(ERe),{testId:p,defaultAmount:h,defaultTokenAddress:m,isTokenBalancesLoading:y,defaultTokenImage:b,environment:g,theme:v}=e,{track:w}=OPe(),[T,E]=uV.useState(h||""),[A,x]=uV.useState(""),[O,C]=uV.useState(),[I,_]=uV.useState(""),[P,S]=uV.useState(""),[k,R]=uV.useState(!1),N=uV.useRef(!1),M=O?`${t("views.BRIDGE_FORM.content.availableBalancePrefix")} ${VRe(O?.formattedBalance)}`:"",[D,L]=uV.useState([]),[j,F]=uV.useState(!1),B=uV.useCallback(((e,t)=>t?`${e.toLowerCase()}-${t.toLowerCase()}`:e.toLowerCase()),[]);uV.useEffect((()=>{if(0===r.length)return;const e=r.filter((e=>e.balance.gt(0))).map((e=>({id:B(e.token.symbol,e.token.address),name:e.token.name,symbol:e.token.symbol,icon:e.token.icon,balance:{formattedFiatAmount:0===l.conversions.size?HRe(""):zRe(e.formattedBalance,e.token.symbol,l.conversions),formattedAmount:VRe(e.formattedBalance)}})));L(e),N.current||(N.current=!0,m&&C(r.find((e=>KRe(e.token.address)&&m?.toLocaleUpperCase()===Nke||e.token.address?.toLowerCase()===m?.toLowerCase()))))}),[r,l.conversions,m,N.current,B,HRe]),uV.useEffect((()=>{if(c&&u){E(c);for(let e=0;e<r.length;e++){const t=r[e];if(t.token.address===u.address){C(t);break}}n({payload:{type:j9e.SET_TOKEN_AND_AMOUNT,token:null,amount:""}})}}),[c,u,r]);const U=uV.useMemo((()=>O&&O.token?B(O.token.symbol,O.token.address):void 0),[O,r,l.conversions,B]),z=e=>{if(E(e),A){const t=L7e(e,O?.formattedBalance);x(t)}var t;O&&(S(zRe(e,O.token.symbol,l.conversions)),t=!0,Number.isNaN(parseFloat(T))||parseFloat(T)<=0||!O||!o||!o.walletAddress||!s||!s.walletAddress||t&&k||!a||R(!0))};uV.useEffect((()=>{d({payload:{type:Q6e.SET_TOKEN_SYMBOLS,tokenSymbols:i.map((e=>e.symbol))}})}),[d,i]),uV.useEffect((()=>{T&&O&&S(zRe(T,O.token.symbol,l.conversions))}),[T,O]);const H=uV.useCallback((()=>{const e=O?"":"views.BRIDGE_FORM.validation.noTokenSelected";const t=L7e(T,O?.formattedBalance);return e&&_(e),t&&x(t),!e&&!t}),[O,T,_,x]),W=uV.useCallback((async()=>{H()&&a&&o?.web3Provider&&O&&(w({userJourney:bPe.BRIDGE,screen:"TokenAmount",control:"Review",controlType:"Button",extras:{tokenAddress:O.token.address,amount:T}}),n({payload:{type:j9e.SET_TOKEN_AND_AMOUNT,token:O.token,amount:T}}),f({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.BRIDGE_REVIEW}}}))}),[a,o?.web3Provider,H,O]);return Iq(N3,{testId:p,sx:j7e,children:[Iq(N3,{sx:{paddingX:"base.spacing.x4"},children:[Cq(qee,{testId:`${p}-content-heading`,size:"small",weight:"regular",sx:{paddingBottom:"base.spacing.x4"},children:t("views.BRIDGE_FORM.content.title")}),(!m||!y)&&Iq(N3,{sx:F7e,children:[Cq(l2e,{testId:"bridge-token",options:D,optionsLoading:y,coinSelectorHeading:t("views.BRIDGE_FORM.bridgeForm.from.selectorTitle"),selectedOption:U,subtext:M,textAlign:"left",errorMessage:t(I),onSelectChange:e=>(e=>{const t=r.find((t=>e===B(t.token.symbol,t.token.address)));t&&(C(t),_(""))})(e),defaultTokenImage:b,environment:g,theme:v}),Cq(d2e,{testId:"bridge-amount",type:"number",value:T,placeholder:t("views.BRIDGE_FORM.bridgeForm.from.inputPlaceholder"),subtext:`${t("views.BRIDGE_FORM.content.fiatPricePrefix")} $${HRe(P,!0)}`,validator:Yqe,onTextInputChange:e=>z(e),onTextInputEnter:W,textAlign:"right",inputMode:"decimal",errorMessage:t(A)})]}),m&&y&&Cq(U7e,{sx:F7e})]}),Iq(N3,{sx:B7e,children:[Cq(O3,{testId:`${p}-button`,variant:"primary",onClick:W,size:"large",children:t("views.BRIDGE_FORM.bridgeForm.buttonText")}),Cq(k2e,{visible:j,showHeaderBar:!1,onCloseDrawer:()=>F(!1),onRetry:async()=>{F(!1),await W()}})]})]})}const H7e=1e4;function W7e({amount:e,tokenAddress:t,defaultTokenImage:n,theme:r}){const{t:i}=_ke(),{bridgeState:a,bridgeDispatch:o}=uV.useContext(F9e),{checkout:s,from:c}=a,{eventTargetState:{eventTarget:u}}=uV.useContext(zqe),[l,d]=uV.useState(!1),{page:f}=OPe();uV.useEffect((()=>{(e||t)&&f({userJourney:bPe.BRIDGE,screen:"TokenAmount",extras:{amount:e,tokenAddress:t}})}),[]);const p=uV.useCallback((async()=>{if(s&&c?.web3Provider)try{const e=await O8e({checkout:s,provider:c.web3Provider,chainId:c?.network,allowTokenListType:ZH.BRIDGE,retryPolicy:{retryIntervalMs:0,retries:0}});if(void 0===e)return;o({payload:{type:j9e.SET_TOKEN_BALANCES,tokenBalances:e.allowedBalances}}),o({payload:{type:j9e.SET_ALLOWED_TOKENS,allowedTokens:e.allowList.tokens}})}catch(e){console.debug(e)}}),[s,c?.web3Provider,c?.network]);return N2e(p,H7e),uV.useEffect((()=>{s&&c?.web3Provider&&(d(!0),p().finally((()=>d(!1))))}),[s,c?.web3Provider]),Cq(_Pe,{testId:"bridge-view",header:Cq(xRe,{showBack:!0,title:i("views.BRIDGE_FORM.header.title"),onCloseButtonClick:()=>H9e(u)}),footer:Cq(oNe,{}),children:Cq(z7e,{testId:"bridge-form",defaultAmount:e,defaultTokenAddress:t,isTokenBalancesLoading:l,defaultTokenImage:n,environment:s?.config.environment,theme:r})})}const V7e={display:"flex",flexDirection:"column",alignItems:"center",paddingBottom:"base.spacing.x6",height:"100%",paddingX:"base.spacing.x6"},G7e={fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"15px",paddingX:"base.spacing.x6"},q7e={...G7e,color:"base.color.text.body.secondary"},K7e={display:"flex",flexDirection:"column",justifyContent:"flex-end",gap:"base.spacing.x2",height:"100%",width:"100%"},X7e={width:"100%",height:"base.spacing.x16"};function Y7e({environment:e,onCloseDrawer:t,visible:n,walletAddress:r,tokenSymbol:i,onAddCoinsClick:a}){const{t:o}=_ke(),[s,c]=uV.useState(!1),u=XRe(e,"/notenougheth.svg"),l=XRe(e,"/notenoughimx.svg"),d=o("drawers.notEnoughGas.content.heading",{token:i.toUpperCase()}),f=o("drawers.notEnoughGas.content.body",{token:i.toUpperCase()}),p=uV.useCallback((()=>{r&&""!==r&&navigator.clipboard.writeText(r),c(!0),setTimeout((()=>{c(!1)}),3e3)}),[r]);return Cq(wne,{size:"threeQuarter",visible:n,showHeaderBar:!0,headerBarTitle:void 0,onCloseDrawer:t,children:Iq(wne.Content,{testId:"not-enough-gas-bottom-sheet",sx:V7e,children:[Cq(K9,{sx:{w:"90px",h:i===Fke?"110px":"90px"},use:Cq("img",{src:i===Fke?u:l,alt:d})}),Cq(qee,{size:"small",weight:"bold",sx:G7e,testId:"not-enough-gas-heading",children:d}),Cq(tee,{sx:q7e,children:f}),Cq(N3,{sx:K7e,children:i===Fke?Iq(O3,{testId:"not-enough-gas-copy-address-button",sx:X7e,variant:"primary",onClick:p,children:[o("drawers.notEnoughGas.buttons.copyAddress"),Cq(O3.Icon,{icon:s?"Tick":"CopyText"})]}):Cq(O3,{testId:"not-enough-gas-add-imx-button",sx:X7e,variant:"primary",onClick:a,children:o("drawers.notEnoughGas.buttons.addMoreImx")})})]})})}const Z7e={borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",marginBottom:"2px",position:"relative"},J7e={borderTopLeftRadius:"0px",borderTopRightRadius:"0px",backgroundColor:"base.color.translucent.emphasis.100",position:"relative"},Q7e={width:"base.icon.size.400"},$7e={position:"absolute",top:"2px",left:"26px",width:"20px",padding:"2px",backgroundColor:"base.color.translucent.inverse.900",borderRadius:"base.borderRadius.x2"},eet={height:"100%",display:"flex",flexDirection:"column",paddingX:"base.spacing.x4"},tet={paddingTop:"base.spacing.x10",paddingBottom:"base.spacing.x4"},net={display:"flex",flexDirection:"column",alignItems:"center",paddingY:"base.spacing.x1"},ret={width:"base.icon.size.300",transform:"rotate(270deg)"},iet={width:"base.icon.size.400"},aet={backgroundColor:"base.color.translucent.standard.200",position:"absolute",width:"32px",height:"32px",padding:"6px",left:"base.spacing.x3"},oet={position:"absolute",right:"base.spacing.x3",w:"base.icon.size.400",h:"base.icon.size.400"},set=(e,t,n,r)=>{const i=[];if(!e?.fees||!e.token)return i;let a=jr.from(0);if(e.fees.bridgeFee&&(a=a.add(e.fees.bridgeFee)),e.fees.imtblFee&&(a=a.add(e.fees.imtblFee)),a.gt(0)&&i.push({label:r(t?"drawers.feesBreakdown.fees.serviceFee.depositLabel":"drawers.feesBreakdown.fees.serviceFee.withdrawLabel"),fiatAmount:`≈ ${r("drawers.feesBreakdown.fees.fiatPricePrefix")}${zRe(Xd(a,e.token.decimals),e.token.symbol,n.conversions)}`,amount:VRe(Xd(a,e.token.decimals)),token:e.token}),e.fees.sourceChainGas?.gt(0)){const t=Xd(e.fees.sourceChainGas,e.token.decimals);i.push({label:r("drawers.feesBreakdown.fees.gasFeeMove.label"),fiatAmount:`≈ ${r("drawers.feesBreakdown.fees.fiatPricePrefix")}${zRe(t,e.token.symbol,n.conversions)}`,amount:`${VRe(t)}`,prefix:"≈ ",token:e.token})}if(e.fees.approvalFee?.gt(0)){const t=Xd(e.fees.approvalFee,e.token.decimals);i.push({label:r("drawers.feesBreakdown.fees.approvalFee.label"),fiatAmount:`≈ ${r("drawers.feesBreakdown.fees.fiatPricePrefix")}${zRe(t,e.token.symbol,n.conversions)}`,amount:`${VRe(t)}`,prefix:"≈ ",token:e.token})}return i},cet=(e,t)=>new pl(e,["function transfer(address to, uint amount)"],t),uet="bridge-review-summary";function det(){const{t:e}=_ke(),{viewDispatch:t}=uV.useContext(ERe),{bridgeState:{checkout:n,tokenBridge:r,from:i,to:a,token:o,amount:s,tokenBalances:c},bridgeDispatch:u}=uV.useContext(F9e),{environment:l}=n.config,{track:d}=OPe(),{cryptoFiatState:f}=uV.useContext($6e),[p,h]=uV.useState(!1),[m,y]=uV.useState(void 0),[b,g]=uV.useState(""),[v,w]=uV.useState(""),[T,E]=uV.useState(void 0),[A,x]=uV.useState(void 0),[O,C]=uV.useState(!1),[I,_]=uV.useState(void 0),[P,S]=uV.useState(void 0),[k,R]=uV.useState(!1),[N,M]=uV.useState(!1),{isWalletConnectEnabled:D,getWalletLogoUrl:L}=aqe(),[j,F]=uV.useState(!1),B=uV.useMemo((()=>i?.network===a?.network),[i,a]),U=uV.useMemo((()=>Qke(n.config)===a?.network),[i,a,n]),z=uV.useMemo((()=>{if(!m)return!1;if(!o)return!0;const e=c.find((e=>KRe(e.token.address)));let t=jr.from(m.fees.totalFees);return KRe(o.address)&&(t=t.add(Yd(s,o.decimals))),!e||e.balance.lt(t)}),[c,m,o,s]),H=uV.useMemo((()=>o?.symbol?`${o?.symbol} ${s}`:`${s}`),[o,s]),W=uV.useMemo((()=>s&&o?zRe(s,o.symbol,f.conversions):""),[o,s]),V=uV.useMemo((()=>i?i.walletAddress:"-"),[i]),G=uV.useMemo((()=>i&&i.network),[i]),q=uV.useMemo((()=>a?a.walletAddress:"-"),[a]),K=uV.useMemo((()=>a?.network),[a]),X=uV.useCallback((async()=>{if(!(r&&s&&i&&a&&o))return;const e=o?.address?.toLowerCase()??Nke.toUpperCase(),t={gasEstimateType:XH.BRIDGE_TO_L2,fees:{},token:n.config.networkMap.get(i.network)?.nativeCurrency};let c;if(e===Nke.toLowerCase())c=n.providerCall(i.web3Provider,(async e=>await e.estimateGas({to:q,from:V,value:Yd(s,o.decimals)})));else{c=cet(e,i.web3Provider.getSigner()).estimateGas.transfer(q,Yd(s,o.decimals))}try{const[e,n]=await Promise.all([c,i.web3Provider.getGasPrice()]),r=e.mul(n),a=Xd(r,Mke);t.fees.sourceChainGas=r,t.fees.totalFees=r,y(t),g(a),w(zRe(a,Nke.toUpperCase(),f.conversions))}catch(e){console.error("Unable to fetch gas estimate",e)}}),[n,i,a,o,s]),Y=uV.useCallback((async()=>{if(!(r&&s&&i&&a&&o))return;const e=await r.getUnsignedBridgeBundledTx({senderAddress:V,recipientAddress:q,token:o.address??Nke.toUpperCase(),amount:Yd(s,o.decimals),sourceChainId:i?.network.toString(),destinationChainId:a?.network.toString(),gasMultiplier:"auto"}),t={contractToApprove:e.contractToApprove,unsignedTx:e.unsignedApprovalTx},c={feeData:e.feeData,unsignedTx:e.unsignedBridgeTx};E(t),x(c);const u=c.feeData,{totalFees:l,approvalFee:d}=u;let p=l;t.unsignedTx||(p=l.sub(d),u.approvalFee=jr.from(0));const h={gasEstimateType:XH.BRIDGE_TO_L2,fees:{...u,totalFees:p},token:n.config.networkMap.get(i.network)?.nativeCurrency};y(h);const m=Xd(h?.fees.totalFees||0,Mke);g(m),w(zRe(m,h?.token?.symbol||"",f.conversions))}),[n,r]);N2e((()=>{B?X():Y()}),Vke);const Z=uV.useCallback((()=>set(m,U,f,e)),[m,U]);uV.useEffect((()=>{(async()=>{h(!0),B?await X():await Y(),h(!1)})()}),[]);const J=uV.useCallback((e=>{u({payload:{type:j9e.SET_WALLETS_AND_NETWORKS,from:{web3Provider:e,walletAddress:i?.walletAddress,walletProviderInfo:i?.walletProviderInfo,network:i?.network},to:{web3Provider:a?.web3Provider,walletAddress:a?.walletAddress,walletProviderInfo:a?.walletProviderInfo,network:a?.network}}})}),[i?.web3Provider,i?.network,a?.web3Provider,a?.network]);uV.useEffect((()=>{if(!i?.web3Provider)return;const e=()=>{const e=new Ld(i?.web3Provider.provider);J(e),C(!1)};return nRe(i?.web3Provider,e),()=>{rRe(i?.web3Provider,e)}}),[i?.web3Provider]),uV.useEffect((()=>{if(D){const e=hNe(i?.web3Provider),t=hNe(a?.web3Provider);R(e),M(t),(async()=>{e&&_(await L()),t&&S(await L())})()}}),[D,i?.web3Provider,a?.web3Provider]),uV.useEffect((()=>{z&&F(!0)}),[z]);const Q=uV.useCallback((async()=>{if(B||T&&A)if(z)F(!0);else{try{const e=await(i?.web3Provider.provider).request({method:"eth_chainId",params:[]});if(parseInt(e.toString())!==i?.network)return void C(!0)}catch(e){console.error("Current network check failed",e)}d({userJourney:bPe.BRIDGE,screen:"Summary",control:"Submit",controlType:"Button",extras:{fromWalletAddress:V,fromNetwork:G,fromWallet:{address:V,rdns:i?.walletProviderInfo?.rdns,uuid:i?.walletProviderInfo?.uuid,isPassportWallet:fNe(i?.web3Provider),isMetaMask:pNe(i?.web3Provider)},toWalletAddress:q,toNetwork:K,toWallet:{address:q,rdns:a?.walletProviderInfo?.rdns,uuid:a?.walletProviderInfo?.uuid,isPassportWallet:fNe(a?.web3Provider),isMetaMask:pNe(a?.web3Provider)},amount:s,fiatAmount:W,tokenAddress:o?.address,moveType:B?"transfer":"bridge"}}),t({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.APPROVE_TRANSACTION,approveTransaction:T,transaction:A}}})}}),[t,T,A,i?.web3Provider,i?.network,i?.walletProviderInfo,a?.web3Provider,a?.network,a?.walletProviderInfo]);return Iq(N3,{testId:uet,sx:eet,children:[Cq(qee,{testId:`${uet}-heading`,size:"small",weight:"regular",sx:tet,children:e("views.BRIDGE_REVIEW.heading")}),Iq(oae,{testId:`${uet}-from-amount`,size:"small",emphasized:!0,sx:Z7e,children:[Cq(oae.Label,{size:"small",sx:{marginBottom:"base.spacing.x4",fontWeight:"bold"},children:e("views.BRIDGE_REVIEW.fromLabel.amountHeading")}),Cq(oae.Caption,{}),Cq(oae.PriceDisplay,{use:Cq(qee,{size:"xSmall",weight:"light"}),price:H??"-",fiatAmount:`${e("views.BRIDGE_REVIEW.fiatPricePrefix")}${W}`})]}),Iq(oae,{testId:`${uet}-from-address`,size:"xSmall",emphasized:!0,sx:J7e,children:[k&&I?Iq(Oq,{children:[Cq(oae.FramedImage,{imageUrl:I,alt:"walletconnect",sx:Q7e}),Cq(O8,{logo:"WalletConnectSymbol",sx:$7e})]}):i?.walletProviderInfo&&Cq(dNe,{src:i?.walletProviderInfo.icon,alt:i?.walletProviderInfo.name,sx:aet}),Iq(oae.Label,{sx:{marginLeft:k&&I?"0px":"45px"},children:[Cq("strong",{children:e("views.BRIDGE_REVIEW.fromLabel.heading")})," ",Cq(tee,{size:"small",sx:{color:"base.color.text.body.secondary"},children:E7e(V??"")})]}),G&&Cq(oae.FramedImage,{use:Cq("img",{src:ZRe(l,G),alt:$ke[G]}),sx:oet})]}),Cq(N3,{sx:net,children:Cq(S6,{icon:"ArrowBackward",sx:ret})}),Iq(oae,{testId:`${uet}-to-address`,size:"xSmall",emphasized:!0,sx:Z7e,children:[N&&P?Iq(Oq,{children:[Cq(oae.FramedImage,{imageUrl:P,alt:"walletconnect",sx:Q7e}),Cq(O8,{logo:"WalletConnectSymbol",sx:$7e})]}):a?.walletProviderInfo&&Cq(dNe,{src:a?.walletProviderInfo.icon,alt:a?.walletProviderInfo.name,sx:aet}),Iq(oae.Label,{sx:{marginLeft:N&&P?"0px":"45px"},children:[Cq("strong",{children:e("views.BRIDGE_REVIEW.toLabel.heading")})," ",Cq(tee,{size:"small",sx:{color:"base.color.text.body.secondary"},children:E7e(q??"")})]}),K&&Cq(oae.FramedImage,{use:Cq("img",{src:ZRe(l,K),alt:$ke[K]}),sx:oet})]}),Cq(A2e,{gasFeeValue:b,gasFeeFiatValue:v,gasFeeToken:m?.token,fees:Z(),onFeesClick:()=>{d({userJourney:bPe.BRIDGE,screen:"MoveCoins",control:"ViewFees",controlType:"Button"})},sx:{borderTopRightRadius:"0",borderTopLeftRadius:"0"},loading:p}),Cq(N3,{sx:{flex:1,display:"flex",flexDirection:"column",justifyContent:"flex-end",paddingY:"base.spacing.x6",width:"100%"},children:m&&!p&&Cq(O3,{size:"large",sx:{width:"100%"},onClick:Q,disabled:p,testId:`${uet}__submit-button`,children:p?Cq(O3.Icon,{icon:"Loading",sx:iet}):e("views.BRIDGE_REVIEW.submitButton.buttonText")})}),Cq(G6e,{visible:O,targetChainId:i?.network,provider:i?.web3Provider,checkout:n,onCloseDrawer:()=>C(!1),onNetworkSwitch:J}),Cq(Y7e,{environment:n.config.environment,visible:j,onCloseDrawer:()=>F(!1),walletAddress:i?.walletAddress||"",tokenSymbol:i?.network===Jke(n?.config)?Fke:jke,onAddCoinsClick:()=>{t({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.TOP_UP_VIEW}}})}})]})}function fet(){const{t:e}=_ke(),{eventTargetState:{eventTarget:t}}=uV.useContext(zqe),{page:n}=OPe();return uV.useEffect((()=>{n({userJourney:bPe.BRIDGE,screen:"Review"})}),[]),Cq(_Pe,{testId:"bridge-review",header:Cq(xRe,{showBack:!0,title:e("views.BRIDGE_REVIEW.layoutHeading"),onCloseButtonClick:()=>H9e(t)}),footer:Cq(oNe,{}),children:Cq(det,{})})}function pet({environment:e}){const{RiveComponent:t}=cue.useRive({src:`${Gke[e]}/v1/blob/img/rocket.riv`,autoplay:!0,layout:new cue.Layout({fit:cue.Fit.Cover}),stateMachines:"State Machine 1"});return Cq(N3,{sx:{...IRe,background:"base.color.translucent.emphasis.100"},children:Cq(N3,{sx:ORe,rc:Cq(t,{})})})}function het({transactionHash:e,isTransfer:t}){const{t:n}=_ke(),{eventTargetState:{eventTarget:r}}=uV.useContext(zqe),{page:i}=OPe(),{cryptoFiatState:a}=uV.useContext($6e),{viewDispatch:o}=uV.useContext(ERe),{bridgeState:{checkout:s,from:c,to:u,token:l,amount:d}}=uV.useContext(F9e);return uV.useEffect((()=>{U9e(r,e);const n=zRe(d,l?.symbol??"",a.conversions);i({userJourney:bPe.BRIDGE,screen:"InProgress",extras:{fromWalletAddress:c?.walletAddress,toWalletAddress:u?.walletAddress,amount:d,fiatAmount:n,tokenAddress:l?.address,moveType:t?"transfer":"bridge"}})}),[]),Cq(_Pe,{testId:"move-in-progress-view",header:Cq(xRe,{transparent:!0,onCloseButtonClick:()=>H9e(r),rightActions:Iq(Oq,{children:[Cq(d4,{icon:"Minting",sx:gRe(),onClick:()=>{o({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.TRANSACTIONS}}})},testId:"settings-button"}),!t&&Cq(dee,{isAnimated:!0,variant:"guidance",sx:{position:"absolute",right:"base.spacing.x14",top:"base.spacing.x1"}})]})}),footer:Cq(oNe,{}),heroContent:Cq(pet,{environment:s.config.environment}),floatHeader:!0,children:Iq(RRe,{heading:n(t?"views.IN_PROGRESS.transferHeading":"views.IN_PROGRESS.heading"),children:[!t&&Iq(Oq,{children:[n("views.IN_PROGRESS.body1"),Cq("br",{}),Cq("br",{})]}),n("views.IN_PROGRESS.body2")]})})}function met({bridgeTransaction:e}){const{t:t}=_ke(),{bridgeState:n}=uV.useContext(F9e),{checkout:r,from:i,to:a,token:o,amount:s}=n,{viewDispatch:c}=uV.useContext(ERe),{eventTargetState:{eventTarget:u}}=uV.useContext(zqe),{page:l}=OPe();uV.useEffect((()=>{l({userJourney:bPe.BRIDGE,screen:"ApproveTransaction",extras:{moveType:e?"bridge":"transfer"}})}),[]);const[d,f]=uV.useState(!1),[p,h]=uV.useState(!1),[m,y]=uV.useState(!1),[b,g]=uV.useState(!1),v=uV.useCallback((()=>{c({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.ERROR_VIEW,error:new Error("No checkout object or no provider object found")}}})}),[c]),w=uV.useCallback((()=>{c({payload:{type:TRe.GO_BACK}})}),[c]),T=e=>{if(e.type!==uW.UNPREDICTABLE_GAS_LIMIT){if(e.type===uW.TRANSACTION_FAILED||e.type===uW.INSUFFICIENT_FUNDS||e.receipt&&0===e.receipt.status){let t="Transaction failed";return e.type===uW.INSUFFICIENT_FUNDS&&(t="Insufficient funds"),e.receipt&&0===e.receipt.status&&(t="Transaction failed to settle on chain"),void c({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.BRIDGE_FAILURE,reason:t}}})}c({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.ERROR_VIEW,error:e}}})}else c({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.BRIDGE_FAILURE,reason:"Unpredictable gas limit"}}})},E=uV.useCallback((async()=>{if(!r||!i?.web3Provider)return void v();if(d)return;f(!0),h(!0);const e=o?.address?.toLowerCase()??Nke.toUpperCase();let t;try{if(e===Nke.toLowerCase()){const e={to:a?.walletAddress,value:Yd(s,o?.decimals)};t=(await r.sendTransaction({provider:i.web3Provider,transaction:e})).transactionResponse.hash}else{const n=cet(e,i.web3Provider.getSigner()),c=Yd(s,o?.decimals);t=(await r.providerCall(i.web3Provider,(async()=>await n.transfer(a?.walletAddress,c)))).hash}c({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.IN_PROGRESS,transactionHash:t,isTransfer:!0}}})}catch(e){h(!1),e.type===uW.USER_REJECTED_REQUEST_ERROR?g(!0):T(e)}finally{f(!1)}}),[r,i,v,c,d]),A=uV.useCallback((async()=>{let t=!1;const{approveTransaction:n,transaction:a}=e;if(r&&i?.web3Provider&&a){if(!d){if(f(!0),n.unsignedTx)try{h(!0);const e=await r.sendTransaction({provider:i.web3Provider,transaction:n.unsignedTx});if(1!==(await e.transactionResponse.wait()).status)return void c({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.BRIDGE_FAILURE,reason:"Transaction failed to settle on chain"}}})}catch(e){h(!1),e.type===uW.USER_REJECTED_REQUEST_ERROR?(g(!0),t=!0):T(e)}finally{f(!1)}try{if(t)return;h(!0);const e=await r.sendTransaction({provider:i.web3Provider,transaction:a.unsignedTx});c({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.IN_PROGRESS,transactionHash:e.transactionResponse.hash,isTransfer:!1}}});0===(await e.transactionResponse.wait()).status&&c({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.BRIDGE_FAILURE,reason:"Approval transaction failed to settle on chain"}}})}catch(e){e.type===uW.USER_REJECTED_REQUEST_ERROR?g(!0):T(e)}finally{y(!1),h(!1),f(!1)}}}else v()}),[r,i,v,c,e,d]);return Iq(Oq,{children:[m&&Cq(PPe,{loadingText:t("views.APPROVE_TRANSACTION.loadingView.text")}),!m&&Cq(_Pe,{header:Cq(xRe,{transparent:!0,showBack:!0,onCloseButtonClick:()=>H9e(u),onBackButtonClick:w}),floatHeader:!0,heroContent:Cq(h8e,{}),footer:Iq(N3,{sx:{width:"100%",flexDirection:"column"},children:[Cq(yRe,{loading:p,actionText:t("views.APPROVE_TRANSACTION."+(b?"footer.retryText":"footer.buttonText")),onActionClick:e?A:E}),Cq(oNe,{})]}),children:Cq(RRe,{heading:t("views.APPROVE_TRANSACTION.content.heading"),children:Cq(N3,{children:t("views.APPROVE_TRANSACTION.content.body")})})})]})}const yet={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x1",height:"100%"},bet={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"15px"},get={display:"flex",flexDirection:"column",justifyContent:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},vet={width:"100%",height:"base.spacing.x16"};function wet({visible:e,onClose:t,onChangeAccount:n}){const{t:r}=_ke(),{bridgeState:{checkout:i}}=uV.useContext(F9e),a=XRe(i.config.environment,"/tokens/eth.svg");return Cq(wne,{headerBarTitle:void 0,size:"full",onCloseDrawer:t,visible:e,showHeaderBar:!1,children:Cq(wne.Content,{children:Iq(N3,{testId:"not-enough-eth-drawer",sx:yet,children:[Cq(K9,{sx:{w:"base.icon.size.600",h:"base.icon.size.600"},use:Cq("img",{src:a,alt:"ETH"})}),Cq(qee,{size:"small",sx:bet,testId:"not-enough-gas-heading",children:`${r("drawers.notEnoughEthWithdrawal.content.heading1")} ${Fke} ${r("drawers.notEnoughEthWithdrawal.content.heading2")}`}),Cq(tee,{sx:bet,children:`${r("drawers.notEnoughEthWithdrawal.content.body1")} ${Fke} ${r("drawers.notEnoughEthWithdrawal.content.body2")}`}),Iq(N3,{sx:get,children:[Cq(O3,{testId:"not-enough-eth-drawer-retry-button",sx:vet,variant:"tertiary",onClick:n,children:r("drawers.notEnoughEthWithdrawal.buttons.retry")}),Cq(O3,{sx:vet,variant:"tertiary",onClick:t,testId:"not-enough-eth-drawer-dismiss-button",children:r("drawers.notEnoughEthWithdrawal.buttons.dismiss")})]})]})})})}function Tet({transaction:e}){const{t:t}=_ke(),{bridgeState:{checkout:n,tokenBridge:r,from:i}}=uV.useContext(F9e),{viewDispatch:a}=uV.useContext(ERe),{eventTargetState:{eventTarget:o}}=uV.useContext(zqe),{page:s}=OPe();uV.useEffect((()=>{s({userJourney:bPe.BRIDGE,screen:"ClaimWithdrawal"})}),[]);const[c,u]=uV.useState(!1),[l,d]=uV.useState(!1),[f,p]=uV.useState(!1),[h,m]=uV.useState(),[y,b]=uV.useState(!1),g=uV.useCallback((()=>{a({payload:{type:TRe.GO_BACK}})}),[a]);uV.useEffect((()=>{(async()=>{if(r&&e&&void 0!==e.details.current_status?.index){d(!0);try{const t=await(r?.getFlowRateWithdrawTx({recipient:e.details.to_address,index:e.details.current_status.index}));m(t)}catch(e){console.log(e)}finally{d(!1)}}})()}),[r,e]);const v=uV.useCallback((async({forceChangeAccount:e})=>{if(!(n&&r&&i?.web3Provider&&h))return;if(!h.pendingWithdrawal.canWithdraw||!h.unsignedTx)return void console.log(`Unable to process withdrawal transaction as it is not ready yet. Delay timeout at ${h.pendingWithdrawal.timeoutEnd} `);let t=i?.web3Provider;const o=Jke(n.config);if(u(!0),fNe(i?.web3Provider)||e)try{const e=await n.createProvider({walletProviderName:$H.METAMASK});t=(await n.connect({provider:e.provider,requestWalletPermissions:!0})).provider,b(!1)}catch(e){return console.log(e),p(!0),void u(!1)}let s,c=null;try{try{s=await t.estimateGas(h.unsignedTx)}catch(e){s=jr.from(Xke)}let e=null;try{e=await t.getFeeData()}catch(e){console.log(e)}let n=null;e&&e.lastBaseFeePerGas&&e.maxPriorityFeePerGas?n=e.lastBaseFeePerGas.add(e.maxPriorityFeePerGas):e&&e.gasPrice&&(n=e.gasPrice),n&&(c=s.mul(n))}catch(e){console.log(e)}try{const e=(await n.getAllBalances({provider:t,chainId:o})).balances.find((e=>KRe(e.token.address)));if(!e||e.balance.lt(c))return b(!0),void u(!1)}catch(e){console.log(e)}if((await t.getNetwork()).chainId!==o)try{t=(await n.switchNetwork({provider:t,chainId:o})).provider}catch(e){return p(!0),d(!1),void console.log(e)}try{const e=await n.sendTransaction({provider:t,transaction:h.unsignedTx});a({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.CLAIM_WITHDRAWAL_IN_PROGRESS,transactionResponse:e.transactionResponse}}})}catch(e){console.log(e),p(!0),u(!1)}finally{u(!1)}}),[r,i,h]);return Iq(_Pe,{testId:"claim-withdrawal",header:Cq(xRe,{transparent:!0,showBack:!0,onCloseButtonClick:()=>H9e(o),onBackButtonClick:g}),floatHeader:!0,heroContent:Cq(h8e,{}),footer:Iq(N3,{sx:{width:"100%",display:"flex",flexDirection:"column"},children:[Cq(N3,{sx:{pb:"base.spacing.x5",px:"base.spacing.x6",width:"100%",display:"flex",flexDirection:"column"},children:Cq(O3,{testId:"claim-withdrawal-continue-button",size:"large",variant:"primary",disabled:l,onClick:()=>c||l?void 0:v({forceChangeAccount:!0}),children:l||c?Cq(O3.Icon,{icon:"Loading",sx:{width:"base.icon.size.400"}}):t("views.CLAIM_WITHDRAWAL."+(f?"footer.retryText":"footer.buttonText"))})}),Cq(oNe,{})]}),children:[Iq(RRe,{heading:`${t("views.CLAIM_WITHDRAWAL.content.heading")} ${SPe(Jke(n.config))}`,children:[Cq(N3,{sx:{display:"flex",flexWrap:"wrap",pb:"base.spacing.x1"},children:t("views.CLAIM_WITHDRAWAL.content.body")}),Iq(N3,{children:[t("views.CLAIM_WITHDRAWAL.content.body2"),Cq(tse,{text:e.details.to_address.toLowerCase()??""})]})]}),Cq(wet,{visible:y,onClose:()=>b(!1),onChangeAccount:()=>v({forceChangeAccount:!0})})]})}function Eet({checkout:e,web3Provider:t,config:n,amount:r,tokenAddress:i}){const{t:a}=_ke(),{environment:o,isOnRampEnabled:s,isSwapEnabled:c,isBridgeEnabled:u,theme:l}=n,d=QRe(e.config.environment,l),{eventTargetState:{eventTarget:f}}=uV.useContext(zqe),{page:p}=OPe(),[h,m]=uV.useReducer(ARe,{...wRe,view:{type:y8e.WALLET_NETWORK_SELECTION},history:[{type:y8e.WALLET_NETWORK_SELECTION}]}),[y,b]=uV.useReducer(B9e,{...L9e,checkout:e,web3Provider:t??null,tokenBridge:(()=>{let t=Zy;e.config.isDevelopment&&(t=Yy),e.config.isProduction&&(t=Jy);const n=new _d(e.config.networkMap.get(Jke(e.config))?.rpcUrls[0]),r=new _d(e.config.networkMap.get(Qke(e.config))?.rpcUrls[0]),i=new Tg({baseConfig:new Zt({environment:e.config.environment}),bridgeInstance:t,rootProvider:n,childProvider:r});return new Pb(i)})()}),g=uV.useMemo((()=>({viewState:h,viewDispatch:m})),[h,m]),v=uV.useMemo((()=>({bridgeState:y,bridgeDispatch:b})),[y,b]),w=uV.useCallback((()=>{b({payload:{type:j9e.SET_WALLETS_AND_NETWORKS,from:null,to:null}}),b({payload:{type:j9e.SET_TOKEN_AND_AMOUNT,amount:"",token:null}}),m({payload:{type:TRe.GO_BACK_TO,view:{type:y8e.WALLET_NETWORK_SELECTION}}})}),[m]),T=uV.useCallback((()=>{m({payload:{type:TRe.GO_BACK_TO,view:{type:y8e.WALLET_NETWORK_SELECTION}}})}),[m]),E=uV.useCallback((()=>{m({payload:{type:TRe.UPDATE_VIEW,view:{type:y8e.TRANSACTIONS}}})}),[m]),A=uV.useCallback((()=>{m({payload:{type:TRe.GO_BACK_TO,view:{type:y8e.BRIDGE_REVIEW}}})}),[m]);return uV.useEffect((()=>{(async()=>{b({payload:{type:j9e.SET_PROVIDER,web3Provider:t??null}})})()}),[t]),Cq(ERe.Provider,{value:g,children:Cq(F9e.Provider,{value:v,children:Iq(d8e,{environment:o,children:[h.view.type===y8e.WALLET_NETWORK_SELECTION&&Cq(D7e,{}),h.view.type===y8e.BRIDGE_FORM&&Cq(W7e,{amount:r,tokenAddress:i,defaultTokenImage:d,theme:l}),h.view.type===y8e.BRIDGE_REVIEW&&Cq(fet,{}),h.view.type===y8e.IN_PROGRESS&&Cq(het,{transactionHash:h.view.transactionHash,isTransfer:h.view.isTransfer}),h.view.type===y8e.BRIDGE_FAILURE&&Cq(Lqe,{testId:"bridge-fail",statusText:a("views.BRIDGE_FAILURE.bridgeFailureText.statusText"),actionText:a("views.BRIDGE_FAILURE.bridgeFailureText.actionText"),onActionClick:A,statusType:_qe.FAILURE,onRenderEvent:()=>{let e="";h.view.type===y8e.BRIDGE_FAILURE&&(e=h.view.reason),p({userJourney:bPe.BRIDGE,screen:"Failed",extras:{reason:e}}),z9e(f,e)}}),h.view.type===y8e.APPROVE_TRANSACTION&&Cq(met,{bridgeTransaction:h.view.approveTransaction&&h.view.transaction?{approveTransaction:h.view.approveTransaction,transaction:h.view.transaction}:void 0}),h.view.type===y8e.TRANSACTIONS&&Cq(w7e,{onBackButtonClick:T,defaultTokenImage:d}),h.view.type===y8e.CLAIM_WITHDRAWAL&&Cq(Tet,{transaction:h.view.transaction}),h.view.type===vRe.ERROR_VIEW&&Cq(NRe,{actionText:a("views.ERROR_VIEW.actionText"),onActionClick:w,onCloseClick:()=>H9e(f),errorEventAction:()=>{p({userJourney:bPe.BRIDGE,screen:"Error"})}}),h.view.type===vRe.TOP_UP_VIEW&&Cq(A8e,{analytics:{userJourney:bPe.BRIDGE},widgetEvent:kH.IMTBL_BRIDGE_WIDGET_EVENT,checkout:e,provider:t,showOnrampOption:s,showSwapOption:c,showBridgeOption:u,onCloseButtonClick:()=>H9e(f)}),h.view.type===y8e.CLAIM_WITHDRAWAL_IN_PROGRESS&&Cq(T7e,{transactionResponse:h.view.transactionResponse}),h.view.type===y8e.CLAIM_WITHDRAWAL_SUCCESS&&Cq(Lqe,{statusText:a("views.CLAIM_WITHDRAWAL.IN_PROGRESS.success.text"),actionText:a("views.CLAIM_WITHDRAWAL.IN_PROGRESS.success.actionText"),onRenderEvent:()=>{p({userJourney:bPe.BRIDGE,screen:"ClaimWithdrawalSuccess"}),W9e(f,h.view.transactionHash)},onActionClick:E,statusType:_qe.SUCCESS,testId:"claim-withdrawal-success-view"}),h.view.type===y8e.CLAIM_WITHDRAWAL_FAILURE&&Cq(Lqe,{statusText:a("views.CLAIM_WITHDRAWAL.IN_PROGRESS.failure.text"),actionText:a("views.CLAIM_WITHDRAWAL.IN_PROGRESS.failure.actionText"),onRenderEvent:()=>{let e="";h.view.type===y8e.CLAIM_WITHDRAWAL_FAILURE&&(e=h.view.reason),p({userJourney:bPe.BRIDGE,screen:"ClaimWithdrawalFailure",extras:{reason:e}}),V9e(f,h.view.transactionHash,"Transaction failed")},onActionClick:E,statusType:_qe.FAILURE,onCloseClick:()=>H9e(f),testId:"claim-withdrawal-fail-view"})]})})})}var Aet,xet=Object.freeze({__proto__:null,default:Eet});function Oet({fundingRouteStep:e,onFundingRouteExecuted:t}){const{t:n}=_ke(),{config:r,provider:i,checkout:a,fromTokenAddress:o}=z4e(),{viewDispatch:s}=uV.useContext(ERe),{connectLoaderDispatch:c}=uV.useContext(jRe),[u,l]=uV.useState(void 0),[d,f]=uV.useState(void 0),[p,h]=uV.useState(void 0),[m,y]=uV.useState(Aet.LOADING),b=uV.useRef(!1),g=uV.useRef(void 0),v=uV.useRef(void 0),[w,T]=uV.useReducer(Hqe,Bqe),E=uV.useMemo((()=>({eventTargetState:w,eventTargetDispatch:T})),[w,T]),A=new EventTarget,x=e=>{s({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.SALE_FAIL,data:{errorType:E4e.FUNDING_ROUTE_EXECUTE_ERROR,errorData:e}}}})},O=uV.useCallback((async e=>{if(!a||!i)throw new Error("checkout or provider not available.");const t=await a.getNetworkInfo({provider:i});if(e.type===sW.BRIDGE){if(f({tokenAddress:e.fundingItem.token.address,amount:e.fundingItem.fundsRequired.formattedAmount}),t.chainId===Jke(a.config))return void y(Aet.EXECUTE_BRIDGE);b.current=Aet.EXECUTE_BRIDGE,y(Aet.SWITCH_NETWORK_ETH)}if(e.type===sW.SWAP){if(l({amount:e.fundingItem.fundsRequired.formattedAmount,fromTokenAddress:e.fundingItem.token.address,toTokenAddress:o}),t.chainId===Qke(a.config))return void y(Aet.EXECUTE_SWAP);b.current=Aet.EXECUTE_SWAP,y(Aet.SWITCH_NETWORK_ZKEVM)}e.type===sW.ONRAMP&&(h({amount:e.fundingItem.fundsRequired.formattedAmount,tokenAddress:e.fundingItem.token.address}),y(Aet.EXECUTE_ON_RAMP))}),[i,a]);uV.useEffect((()=>{if(e)try{O(e)}catch(e){x(e)}}),[e]);const C=()=>{g.current?(g.current=void 0,v.current=void 0,t()):x(v.current)},I=e=>{switch(e.detail.type){case DH.SUCCESS:{const t=e.detail.data;g.current=t,C();break}case FH.TRANSACTION_SENT:case UH.SUCCESS:{const t=e.detail.data;g.current=t;break}case FH.FAILURE:case DH.FAILURE:case UH.FAILURE:{const t=e.detail.data;v.current=t;break}case FH.CLOSE_WIDGET:case DH.CLOSE_WIDGET:case UH.CLOSE_WIDGET:C();case DH.REJECTED:}},_=e=>{switch(e.detail.type){case NH.SUCCESS:{const t=e.detail.data;c({payload:{type:LRe.SET_PROVIDER,provider:t.provider}}),!1!==b.current&&(y(b.current),b.current=!1);break}case NH.FAILURE:case NH.CLOSE_WIDGET:default:C()}};return uV.useEffect((()=>(A.addEventListener(kH.IMTBL_CONNECT_WIDGET_EVENT,_),A.addEventListener(kH.IMTBL_BRIDGE_WIDGET_EVENT,I),A.addEventListener(kH.IMTBL_SWAP_WIDGET_EVENT,I),()=>{A.removeEventListener(kH.IMTBL_CONNECT_WIDGET_EVENT,_),A.removeEventListener(kH.IMTBL_BRIDGE_WIDGET_EVENT,I),A.removeEventListener(kH.IMTBL_SWAP_WIDGET_EVENT,I)})),[]),uV.useEffect((()=>{T({payload:{type:Uqe.SET_EVENT_TARGET,eventTarget:A}})}),[a]),Iq(zqe.Provider,{value:E,children:[m===Aet.LOADING&&Cq(PPe,{loadingText:n("views.ORDER_SUMMARY.loading.balances")}),m===Aet.EXECUTE_BRIDGE&&Cq(Eet,{...d,config:r,checkout:a}),m===Aet.EXECUTE_SWAP&&Cq(C8e,{...u,config:r}),m===Aet.EXECUTE_ON_RAMP&&Cq(k3e,{config:r,...p}),m===Aet.SWITCH_NETWORK_ETH&&Cq(Wqe,{config:r,targetChainId:a.config.isProduction?VH.ETHEREUM:VH.SEPOLIA,web3Provider:i,checkout:a,deepLink:aNe.SWITCH_NETWORK}),m===Aet.SWITCH_NETWORK_ZKEVM&&Cq(Wqe,{config:r,targetChainId:a.config.isProduction?VH.IMTBL_ZKEVM_MAINNET:VH.IMTBL_ZKEVM_TESTNET,web3Provider:i,checkout:a,deepLink:aNe.SWITCH_NETWORK})]})}function Cet({text:e,duration:t,animationUrl:n,inputValue:r=0}){const{addHandover:i}=DPe({id:NPe.GLOBAL});return b8e((()=>{i({duration:t,animationUrl:n,inputValue:r,children:Cq(qee,{sx:{px:"base.spacing.x6"},children:e})})})),null}function Iet({subView:e}){const{t:t}=_ke(),{sendProceedToPay:n}=Z4e(),{fromTokenAddress:r,collectionName:i,goToErrorView:a,goBackToPaymentMethods:o,sign:s,selectedCurrency:c,setPaymentMethod:u,environment:l}=z4e(),{viewDispatch:d,viewState:f}=uV.useContext(ERe),{cryptoFiatDispatch:p,cryptoFiatState:h}=uV.useContext($6e),{addHandover:m,closeHandover:y}=DPe({id:NPe.GLOBAL}),b=e=>{m({animationUrl:YRe(l,$4e(Q4e.APPROVE)),inputValue:t9e[Q4e.APPROVE].inputValues.start,children:Cq(qee,{sx:{px:"base.spacing.x6"},children:t("views.PAYMENT_METHODS.handover.initial")})}),s(A4e.CRYPTO,e),d({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.PAY_WITH_COINS}}})},g=()=>{b(c?.address)},{fundingBalances:v,loadingBalances:w,fundingBalancesResult:T,transactionRequirement:E,queryFundingBalances:A}=S9e();return uV.useEffect((()=>{e===T4e.INIT&&r&&A()}),[e,r]),uV.useEffect((()=>{0!==v.length&&(y(),d({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.ORDER_SUMMARY,subView:T4e.REVIEW_ORDER}}}))}),[v]),uV.useEffect((()=>{if(!w&&T.length&&!(v.length>0))try{const e=T.find((e=>e.currency.base))?.smartCheckoutResult,t=R9e(e.transactionRequirements);u(void 0),y(),d({payload:{type:TRe.UPDATE_VIEW,view:{type:vRe.TOP_UP_VIEW,data:t}}})}catch(e){a(E4e.SERVICE_BREAKDOWN,e)}}),[v,w,T]),uV.useEffect((()=>{if(!p||0===v.length||w)return;const e=v.map((({fundingItem:e})=>e.token.symbol));p({payload:{type:Q6e.SET_TOKEN_SYMBOLS,tokenSymbols:e}})}),[p,v,w]),Iq(N3,{children:[e===T4e.INIT&&Cq(Cet,{text:t("views.ORDER_SUMMARY.loading.balances"),animationUrl:YRe(l,"/preparing_order.riv"),inputValue:0}),e===T4e.REVIEW_ORDER&&Cq(E9e,{fundingBalances:v,conversions:h.conversions,collectionName:i,loadingBalances:w,onBackButtonClick:o,onProceedToBuy:e=>{const{type:t,fundingItem:r}=e;n(w4e.ORDER_SUMMARY,e,h.conversions),t!==x4e.SUFFICIENT?(y(),d({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.ORDER_SUMMARY,subView:T4e.EXECUTE_FUNDING_ROUTE,data:{fundingBalance:e,onFundingRouteExecuted:g}}}})):b(r.token.address)},transactionRequirement:E,onPayWithCard:e=>o(e)}),e===T4e.EXECUTE_FUNDING_ROUTE&&Cq(Oet,{fundingRouteStep:f.view.data.fundingBalance,onFundingRouteExecuted:g})]})}function _et(){return Cq(N3,{testId:"credit-card-warning-hero",children:Cq(N3,{children:Iq("svg",{width:"430",height:"161",viewBox:"0 0 430 161",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Cq("path",{d:"M172.973 133.128C171.472 132.262 170.399 130.653 170.399 128.67V91.134C170.399 87.4566 171.381 83.9165 173.158 80.8356C174.934 77.7546 177.509 75.137 180.697 73.2962L199.556 62.4057L231.623 44.1673C233.339 43.1761 235.27 43.3005 236.772 44.1673L229.34 39.8763C227.838 39.0095 225.907 38.8851 224.191 39.8763L192.124 58.1147L173.265 69.0052C170.077 70.8461 166.889 72.6253 165.112 75.7062C163.336 78.7872 162.967 83.1656 162.967 86.843V124.379C162.967 126.361 164.04 127.971 165.541 128.837L172.973 133.128Z",fill:"#F3F3F3",stroke:"#131313",strokeWidth:"1.64647",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M239.133 48.6725V85.9384C239.133 96.0882 236.344 99.3065 228.835 103.776L178.124 133.123C174.691 135.105 170.4 132.629 170.4 128.665V91.3985C170.4 82.7861 172.193 78.066 180.698 73.5609L231.409 44.2142C234.842 42.2317 239.133 44.7076 239.133 48.6725Z",fill:"#F3F3F3",stroke:"#131313",strokeWidth:"1.64647",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M172.973 133.127C171.472 132.26 170.399 130.651 170.399 128.668V91.3681C170.399 87.6907 170.631 83.7216 172.407 80.6406L164.975 76.3496C163.198 79.4306 162.967 83.3997 162.967 87.0771L162.967 124.377C162.967 126.36 164.04 127.969 165.541 128.836L172.973 133.127Z",fill:"#131313",stroke:"#131313",strokeWidth:"1.64647",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M170.261 125.267V114.74L239.346 75.0625V85.3194L170.261 125.267Z",fill:"#0D0D0D",stroke:"black",strokeWidth:"0.823233"}),Iq("g",{clipPath:"url(#clip0_1548_70742)",children:[Cq("path",{d:"M228.362 71.9146C219.392 76.9925 219.392 93.5869 228.362 108.975C237.331 124.363 251.872 132.721 260.842 127.643L249.638 134.081C240.669 139.159 226.128 130.802 217.158 115.414C208.189 100.026 208.189 83.4311 217.158 78.3532L228.362 71.9146Z",fill:"black",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M228.361 71.9146C219.392 76.9925 219.392 93.5869 228.361 108.975C237.331 124.363 251.872 132.721 260.841 127.643C269.811 122.565 269.811 105.97 260.841 90.5822C251.872 75.194 237.331 66.8367 228.361 71.9146ZM234.856 83.0619C239.099 80.6582 245.416 83.268 250.539 89.0026L232.165 99.4117C229.72 92.1618 230.612 85.4657 234.856 83.0619ZM254.343 116.5C250.1 118.904 243.782 116.294 238.659 110.559L257.034 100.15C259.479 107.4 258.586 114.096 254.343 116.5Z",fill:"#FAFD7E",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M234.856 83.0618C239.099 80.658 245.417 83.2678 250.54 89.0024L232.165 99.4115C229.72 92.1617 230.613 85.4655 234.856 83.0618Z",fill:"#FAFD7E",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M254.347 116.5C250.104 118.903 243.787 116.294 238.664 110.559L257.038 100.15C259.483 107.4 258.591 114.096 254.347 116.5Z",fill:"#FAFD7E",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M232.165 99.4115C230.94 95.7844 230.552 92.299 231.001 89.4188C231.449 86.5386 232.734 84.2636 234.856 83.0618C236.977 81.8599 239.617 81.9114 242.368 82.9802L232.165 99.4115Z",fill:"black",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Cq("path",{d:"M246.835 116.581C244.084 115.513 241.225 113.426 238.664 110.559L247.853 105.357L257.042 100.154L246.84 116.586L246.835 116.581Z",fill:"black",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Cq("defs",{children:Cq("clipPath",{id:"clip0_1548_70742",children:Cq("rect",{width:"58",height:"66",fill:"white",transform:"translate(210 70)"})})})]})})})}function Pet(){const{t:e}=_ke(),{showCreditCardWarning:t,setShowCreditCardWarning:n,setPaymentMethod:r}=z4e();return Cq(wne,{size:"threeQuarter",visible:t,showHeaderBar:!1,children:Iq(wne.Content,{children:[Cq(d4,{icon:"Close",variant:"tertiary",sx:{pos:"absolute",top:"base.spacing.x5",left:"base.spacing.x5",backdropFilter:"blur(30px)"},onClick:()=>n(!1)}),Cq(_et,{}),Iq(N3,{sx:{px:"base.spacing.x12"},children:[Cq(qee,{sx:{marginTop:"base.spacing.x6",marginBottom:"base.spacing.x2",textAlign:"center"},children:e("views.PAYMENT_METHODS.creditCardWarningDrawer.heading")}),Cq(tee,{size:"medium",sx:{display:"block",textAlign:"center",color:"base.color.text.body.secondary",marginBottom:"base.spacing.x13"},children:e("views.PAYMENT_METHODS.creditCardWarningDrawer.body")}),Cq(O3,{sx:{width:"100%"},testId:"credit-card-button",variant:"primary",size:"large",onClick:()=>{r(jH.CREDIT)},children:e("views.PAYMENT_METHODS.creditCardWarningDrawer.ctaButton")})]})]})})}!function(e){e.LOADING="LOADING",e.EXECUTE_SWAP="EXECUTE_SWAP",e.EXECUTE_BRIDGE="EXECUTE_BRIDGE",e.EXECUTE_ON_RAMP="EXECUTE_ON_RAMP",e.SWITCH_NETWORK_ETH="SWITCH_NETWORK_ETH",e.SWITCH_NETWORK_ZKEVM="SWITCH_NETWORK_ZKEVM"}(Aet||(Aet={}));var ket=Object.freeze({__proto__:null,default:function(e){const{t:t}=_ke(),{config:n,items:r,environmentId:i,collectionName:a,excludePaymentTypes:o,excludeFiatCurrencies:s,preferredCurrency:c,hideExcludedPaymentTypes:u,waitFulfillmentSettlements:l=!0}=e,{connectLoaderState:d}=uV.useContext(jRe),{checkout:f,provider:p}=d,h=uV.useRef(),{eventTargetState:{eventTarget:m}}=uV.useContext(zqe),{theme:y}=n,b=uV.useMemo((()=>yAe(y)),[y]),[g,v]=uV.useReducer(ARe,wRe),w=uV.useMemo((()=>({viewState:g,viewDispatch:v})),[g,v]),T=g.view.data?.loadingText||t("views.LOADING_VIEW.text");uV.useEffect((()=>{f&&p&&(async()=>{const e=await f.getNetworkInfo({provider:p});h.current=e.chainId})()}),[f,p]);const E=uV.useRef(!1),A=uV.useCallback((()=>{f&&p&&(E.current||(E.current=!0,v({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.PAYMENT_METHODS}}})))}),[f,p]);return uV.useEffect((()=>{f&&p&&A()}),[f,p]),Cq(ERe.Provider,{value:w,children:Cq(U4e,{value:{config:n,items:r,environment:n.environment,environmentId:i,provider:p,checkout:f,passport:f?.passport,collectionName:a,excludePaymentTypes:o,excludeFiatCurrencies:s,preferredCurrency:c,waitFulfillmentSettlements:l,hideExcludedPaymentTypes:u},children:Iq(d8e,{environment:n.environment,children:[g.view.type===vRe.LOADING_VIEW&&Cq(PPe,{loadingText:T}),g.view.type===w4e.PAYMENT_METHODS&&Cq(u9e,{}),g.view.type===w4e.PAY_WITH_CARD&&Cq(J4e,{}),g.view.type===w4e.PAY_WITH_COINS&&Cq(a9e,{}),g.view.type===w4e.SALE_FAIL&&Cq(l9e,{biomeTheme:b,errorType:g.view.data?.errorType,transactionHash:g.view.data?.transactionHash,blockExplorerLink:OW.getTransactionLink(h.current,g.view.data?.transactionHash)}),g.view.type===w4e.ORDER_SUMMARY&&Cq(Iet,{subView:g.view.subView}),g.view.type===vRe.TOP_UP_VIEW&&Cq(A8e,{analytics:{userJourney:bPe.SALE},widgetEvent:kH.IMTBL_SALE_WIDGET_EVENT,checkout:f,provider:p,showOnrampOption:n.isOnRampEnabled,showSwapOption:n.isSwapEnabled,showBridgeOption:n.isBridgeEnabled,onCloseButtonClick:()=>mKe(m),onBackButtonClick:()=>{v({payload:{type:TRe.UPDATE_VIEW,view:{type:w4e.PAYMENT_METHODS}}})},amount:g.view.data?.amount,tokenAddress:g.view.data?.tokenAddress,heading:g.view.data?.heading,subheading:g.view.data?.subheading}),Cq(Pet,{})]})})})}}),Ret={exports:{}};!function(e,t){window,e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){n.r(t);var r="function"==typeof fetch?fetch.bind():function(e,t){return t=t||{},new Promise((function(n,r){var i=new XMLHttpRequest;for(var a in i.open(t.method||"get",e,!0),t.headers)i.setRequestHeader(a,t.headers[a]);function o(){var e,t=[],n=[],r={};return i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(i,a,o){t.push(a=a.toLowerCase()),n.push([a,o]),e=r[a],r[a]=e?e+","+o:o})),{ok:2==(i.status/100|0),status:i.status,statusText:i.statusText,url:i.responseURL,clone:o,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},headers:{keys:function(){return t},entries:function(){return n},get:function(e){return r[e.toLowerCase()]},has:function(e){return e.toLowerCase()in r}}}}i.withCredentials="include"==t.credentials,i.onload=function(){n(o())},i.onerror=r,i.send(t.body)}))};t.default=r},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.pluginName=t}return r(e,[{key:"track",value:function(e,t){window.analytics.track(e,t,{integration:{name:this.pluginName}})}}]),e}();t.default=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.YouTubeAnalytics=t.VimeoAnalytics=void 0;var r=a(n(3)),i=a(n(4));function a(e){return e&&e.__esModule?e:{default:e}}t.VimeoAnalytics=r.default,t.YouTubeAnalytics=i.default},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=a(n(0));function a(e){return e&&e.__esModule?e:{default:e}}var o=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"VimeoAnalytics"));return r.authToken=n,r.player=e,r.metadata={content:{},playback:{videoPlayer:"Vimeo"}},r.mostRecentHeartbeat=0,r.isPaused=!1,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),r(t,[{key:"initialize",value:function(){var e=this,t={loaded:this.retrieveMetadata,play:this.trackPlay,pause:this.trackPause,ended:this.trackEnded,timeupdate:this.trackHeartbeat};for(var n in t)this.registerHandler(n,t[n]);this.player.getVideoId().then((function(t){e.retrieveMetadata({id:t})})).catch(console.error)}},{key:"registerHandler",value:function(e,t){var n=this;this.player.on(e,(function(e){n.updateMetadata(e),t.call(n,e)}))}},{key:"trackPlay",value:function(){this.isPaused?(this.track("Video Playback Resumed",this.metadata.playback),this.isPaused=!1):(this.track("Video Playback Started",this.metadata.playback),this.track("Video Content Started",this.metadata.content))}},{key:"trackEnded",value:function(){this.track("Video Playback Completed",this.metadata.playback),this.track("Video Content Completed",this.metadata.content)}},{key:"trackHeartbeat",value:function(){var e=this.mostRecentHeartbeat,t=this.metadata.playback.position;t!==e&&t-e>=10&&(this.track("Video Content Playing",this.metadata.content),this.mostRecentHeartbeat=Math.floor(t))}},{key:"trackPause",value:function(){this.isPaused=!0,this.track("Video Playback Paused",this.metadata.playback)}},{key:"retrieveMetadata",value:function(e){var t=this;return new Promise((function(n,r){var a=e.id;(0,i.default)("https://api.vimeo.com/videos/"+a,{headers:{Authorization:"Bearer "+t.authToken}}).then((function(e){return e.ok?e.json():r(e)})).then((function(e){t.metadata.content.title=e.name,t.metadata.content.description=e.description,t.metadata.content.publisher=e.user.name,t.metadata.playback.position=0,t.metadata.playback.totalLength=e.duration})).catch((function(e){return console.error("Request to Vimeo API Failed with: ",e),r(e)}))}))}},{key:"updateMetadata",value:function(e){var t=this;return new Promise((function(n,r){t.player.getVolume().then((function(r){r&&(t.metadata.playback.sound=100*r),t.metadata.playback.position=e.seconds,n()})).catch(r)}))}}]),t}(a(n(1)).default);t.default=o},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=a(n(0));function a(e){return e&&e.__esModule?e:{default:e}}var o=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"YoutubeAnalytics"));return r.player=e,r.apiKey=n,r.playerLoaded=!1,r.playbackStarted=!1,r.contentStarted=!1,r.isPaused=!1,r.isBuffering=!1,r.isSeeking=!1,r.lastRecordedTime={timeReported:Date.now(),timeElapsed:0},r.metadata=[{playback:{video_player:"youtube"},content:{}}],r.playlistIndex=0,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),r(t,[{key:"initialize",value:function(){window.segmentYoutubeOnStateChange=this.onPlayerStateChange.bind(this),window.segmentYoutubeOnReady=this.onPlayerReady.bind(this),this.player.addEventListener("onReady","segmentYoutubeOnReady"),this.player.addEventListener("onStateChange","segmentYoutubeOnStateChange")}},{key:"onPlayerReady",value:function(e){this.retrieveMetadata()}},{key:"onPlayerStateChange",value:function(e){var t=this.player.getCurrentTime();switch(this.metadata[this.playlistIndex]&&(this.metadata[this.playlistIndex].playback.position=this.metadata[this.playlistIndex].content.position=t,this.metadata[this.playlistIndex].playback.quality=this.player.getPlaybackQuality(),this.metadata[this.playlistIndex].playback.sound=this.player.isMuted()?0:this.player.getVolume()),e.data){case-1:if(this.playerLoaded)break;this.retrieveMetadata(),this.playerLoaded=!0;break;case YT.PlayerState.BUFFERING:this.handleBuffer();break;case YT.PlayerState.PLAYING:this.handlePlay();break;case YT.PlayerState.PAUSED:this.handlePause();break;case YT.PlayerState.ENDED:this.handleEnd()}this.lastRecordedTime={timeReported:Date.now(),timeElapsed:1e3*this.player.getCurrentTime()}}},{key:"retrieveMetadata",value:function(){var e=this;return new Promise((function(t,n){var r=e.player.getVideoData(),a=e.player.getPlaylist()||[r.video_id],o=a.join();(0,i.default)("https://www.googleapis.com/youtube/v3/videos?id="+o+"&part=snippet,contentDetails&key="+e.apiKey).then((function(e){if(!e.ok){var t=new Error("Segment request to Youtube API failed (likely due to a bad API Key. Events will still be sent but will not contain video metadata)");throw t.response=e,t}return e.json()})).then((function(n){e.metadata=[];for(var r=0,i=0;i<a.length;i++){var o=n.items[i];e.metadata.push({content:{title:o.snippet.title,description:o.snippet.description,keywords:o.snippet.tags,channel:o.snippet.channelTitle,airdate:o.snippet.publishedAt}}),r+=s(o.contentDetails.duration)}for(i=0;i<a.length;i++)e.metadata[i].playback={total_length:r,video_player:"youtube"};t()})).catch((function(t){e.metadata=a.map((function(e){return{playback:{video_player:"youtube"},content:{}}})),n(t)}))}))}},{key:"handleBuffer",value:function(){var e=this.determineSeek();this.playbackStarted||(this.playbackStarted=!0,this.track("Video Playback Started",this.metadata[this.playlistIndex].playback)),e&&!this.isSeeking&&(this.isSeeking=!0,this.track("Video Playback Seek Started",this.metadata[this.playlistIndex].playback)),this.isSeeking&&(this.track("Video Playback Seek Completed",this.metadata[this.playlistIndex].playback),this.isSeeking=!1);var t=this.player.getPlaylist();t&&0===this.player.getCurrentTime()&&this.player.getPlaylistIndex()!==this.playlistIndex&&(this.contentStarted=!1,this.playlistIndex===t.length-1&&0===this.player.getPlaylistIndex()&&(this.track("Video Playback Completed",this.metadata[this.player.getPlaylistIndex()].playback),this.track("Video Playback Started",this.metadata[this.player.getPlaylistIndex()].playback))),this.track("Video Playback Buffer Started",this.metadata[this.playlistIndex].playback),this.isBuffering=!0}},{key:"handlePlay",value:function(){this.contentStarted||(this.playlistIndex=this.player.getPlaylistIndex(),-1===this.playlistIndex&&(this.playlistIndex=0),this.track("Video Content Started",this.metadata[this.playlistIndex].content),this.contentStarted=!0),this.isBuffering&&(this.track("Video Playback Buffer Completed",this.metadata[this.playlistIndex].playback),this.isBuffering=!1),this.isPaused&&(this.track("Video Playback Resumed",this.metadata[this.playlistIndex].playback),this.isPaused=!1)}},{key:"handlePause",value:function(){var e=this.determineSeek();this.isBuffering&&(this.track("Video Playback Buffer Completed",this.metadata[this.playlistIndex].playback),this.isBuffering=!1),this.isPaused||(e?(this.track("Video Playback Seek Started",this.metadata[this.playlistIndex].playback),this.isSeeking=!0):(this.track("Video Playback Paused",this.metadata[this.playlistIndex].playback),this.isPaused=!0))}},{key:"handleEnd",value:function(){this.track("Video Content Completed",this.metadata[this.playlistIndex].content),this.contentStarted=!1;var e=this.player.getPlaylistIndex(),t=this.player.getPlaylist();(t&&e===t.length-1||-1===e)&&(this.track("Video Playback Completed",this.metadata[this.playlistIndex].playback),this.playbackStarted=!1)}},{key:"determineSeek",value:function(){var e=this.isPaused||this.isBuffering?0:Date.now()-this.lastRecordedTime.timeReported,t=1e3*this.player.getCurrentTime()-this.lastRecordedTime.timeElapsed;return Math.abs(e-t)>2e3}}]),t}(a(n(1)).default);function s(e){var t=e.match(/PT(\d+H)?(\d+M)?(\d+S)?/);return t=t.slice(1).map((function(e){if(null!=e)return e.replace(/\D/,"")})),3600*(parseInt(t[0])||0)+60*(parseInt(t[1])||0)+(parseInt(t[2])||0)}t.default=o}])}(Ret);var Net=Ret.exports,Met=t({__proto__:null,default:lt(Net)},[Net]);e.WidgetsFactory=class{sdk;widgetConfig;constructor(e,t){if(this.sdk=e,this.widgetConfig=t,this.widgetConfig.theme||(this.widgetConfig.theme=Wke),t.walletConnect)try{iqe.getInstance().initialise(e.config.environment,t.walletConnect,this.widgetConfig.theme,e.config.remote.getConfig("connect"))}catch(e){console.warn("WalletConnect has not been set up correctly")}}updateProvider(e){aRe(e),oRe({provider:e})}create(e,t){const{provider:n}=t??{},r=t?.config||{};switch(e){case zH.CONNECT:return new uRe(this.sdk,{config:{...this.widgetConfig,...r},provider:n});case zH.BRIDGE:return new vKe(this.sdk,{config:{...this.widgetConfig,...r},provider:n});case zH.WALLET:return new hKe(this.sdk,{config:{...this.widgetConfig,...r},provider:n});case zH.SWAP:return new oKe(this.sdk,{config:{...this.widgetConfig,...r},provider:n});case zH.ONRAMP:return new dKe(this.sdk,{config:{...this.widgetConfig,...r},provider:n});case zH.SALE:return new bKe(this.sdk,{config:{...this.widgetConfig,...r},provider:n});default:throw new Error("widget type not supported")}}}}));
|