@imtbl/sdk 1.30.0-alpha.7 → 1.30.0-alpha.8
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-51ce1387.js → BridgeWidget-e42b9f82.js} +1 -1
- package/dist/browser/checkout/{HorizontalMenu-75e465c0.js → HorizontalMenu-abeb3f9e.js} +1 -1
- package/dist/browser/checkout/{OnRampWidget-2c83424e.js → OnRampWidget-be92b2b1.js} +1 -1
- package/dist/browser/checkout/{SaleWidget-d31be72e.js → SaleWidget-303c922e.js} +1 -1
- package/dist/browser/checkout/{SpendingCapHero-b0dce7c9.js → SpendingCapHero-84dc756f.js} +1 -1
- package/dist/browser/checkout/SwapWidget-0ebc34b3.js +1 -0
- package/dist/browser/checkout/{TopUpView-e7c322fa.js → TopUpView-658767e5.js} +1 -1
- package/dist/browser/checkout/{WalletWidget-8718feff.js → WalletWidget-bc2804c5.js} +1 -1
- package/dist/browser/checkout/{auto-track-3704c9a6.js → auto-track-8ee8c1c4.js} +1 -1
- package/dist/browser/checkout/{balance-d56c60d4.js → balance-1f0de3ac.js} +1 -1
- package/dist/browser/checkout/index-05a0f5e3.js +1 -0
- package/dist/browser/checkout/{index-7d430f20.js → index-17ada566.js} +1 -1
- package/dist/browser/checkout/{index-e8c4ec89.js → index-784363ef.js} +1 -1
- package/dist/browser/checkout/{index-aad9a3ee.js → index-8cc6b23b.js} +2 -2
- package/dist/browser/checkout/{index-80392bd7.js → index-9e6fdcc3.js} +1 -1
- package/dist/browser/checkout/{index-ea3863ef.js → index-cab90969.js} +1 -1
- package/dist/browser/checkout/{index-9d6944b2.js → index-ed4cd0bb.js} +1 -1
- package/dist/browser/checkout/{index-020bde05.js → index-f2932839.js} +1 -1
- package/dist/browser/checkout/{index.umd-14e670d3.js → index.umd-c8f6d9c7.js} +1 -1
- package/dist/browser/checkout/{retry-ebd849e0.js → retry-d0541bc6.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 +1 -1
- 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.js +7 -7
- package/dist/orderbook.js +1 -1
- package/dist/passport.js +4 -4
- package/dist/x.js +3 -3
- package/package.json +1 -1
- package/dist/browser/checkout/SwapWidget-a9d28254.js +0 -1
- package/dist/browser/checkout/index-761dc84d.js +0 -1
|
@@ -928,5 +928,5 @@ const P3e=1;class k3e{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 H4e=e=>null!=e?e:i3e;var W4e={},V4e={},G4e={};let q4e;const K4e=[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];G4e.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},G4e.getSymbolTotalCodewords=function(e){return K4e[e]},G4e.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},G4e.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');q4e=e},G4e.isKanjiModeEnabled=function(){return void 0!==q4e},G4e.toSJIS=function(e){return q4e(e)};var X4e={};function Y4e(){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}}}(X4e),Y4e.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 J4e=Y4e;function Z4e(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)}Z4e.prototype.set=function(e,t,n,r){const i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},Z4e.prototype.get=function(e,t){return this.data[e*this.size+t]},Z4e.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},Z4e.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var Q4e=Z4e,$4e={};!function(e){const t=G4e.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}}($4e);var e9e={};const t9e=G4e.getSymbolSize;e9e.getPositions=function(e){const t=t9e(e);return[[0,0],[t-7,0],[0,t-7]]};var n9e={};!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}}(n9e);var r9e={};const i9e=X4e,a9e=[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],o9e=[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];r9e.getBlocksCount=function(e,t){switch(t){case i9e.L:return a9e[4*(e-1)+0];case i9e.M:return a9e[4*(e-1)+1];case i9e.Q:return a9e[4*(e-1)+2];case i9e.H:return a9e[4*(e-1)+3];default:return}},r9e.getTotalCodewordsCount=function(e,t){switch(t){case i9e.L:return o9e[4*(e-1)+0];case i9e.M:return o9e[4*(e-1)+1];case i9e.Q:return o9e[4*(e-1)+2];case i9e.H:return o9e[4*(e-1)+3];default:return}};var s9e={},c9e={};const u9e=new Uint8Array(512),l9e=new Uint8Array(256);!function(){let e=1;for(let t=0;t<255;t++)u9e[t]=e,l9e[e]=t,e<<=1,256&e&&(e^=285);for(let e=255;e<512;e++)u9e[e]=u9e[e-255]}(),c9e.log=function(e){if(e<1)throw new Error("log("+e+")");return l9e[e]},c9e.exp=function(e){return u9e[e]},c9e.mul=function(e,t){return 0===e||0===t?0:u9e[l9e[e]+l9e[t]]},function(e){const t=c9e;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}}(s9e);const d9e=s9e;function f9e(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}f9e.prototype.initialize=function(e){this.degree=e,this.genPoly=d9e.generateECPolynomial(this.degree)},f9e.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=d9e.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 p9e=f9e,h9e={},m9e={},y9e={isValid:function(e){return!isNaN(e)&&e>=1&&e<=40}},b9e={};const g9e="[0-9]+";let v9e="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";v9e=v9e.replace(/u/g,"\\u");const w9e="(?:(?![A-Z0-9 $%*+\\-./:]|"+v9e+")(?:.|[\r\n]))+";b9e.KANJI=new RegExp(v9e,"g"),b9e.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),b9e.BYTE=new RegExp(w9e,"g"),b9e.NUMERIC=new RegExp(g9e,"g"),b9e.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const T9e=new RegExp("^"+v9e+"$"),E9e=new RegExp("^"+g9e+"$"),A9e=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");b9e.testKanji=function(e){return T9e.test(e)},b9e.testNumeric=function(e){return E9e.test(e)},b9e.testAlphanumeric=function(e){return A9e.test(e)},function(e){const t=y9e,n=b9e;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}}}(m9e),function(e){const t=G4e,n=r9e,r=X4e,i=m9e,a=y9e,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}}(h9e);var x9e={};const O9e=G4e,C9e=O9e.getBCHDigit(1335);x9e.getEncodedBits=function(e,t){const n=e.bit<<3|t;let r=n<<10;for(;O9e.getBCHDigit(r)-C9e>=0;)r^=1335<<O9e.getBCHDigit(r)-C9e;return 21522^(n<<10|r)};var I9e={};const S9e=m9e;function _9e(e){this.mode=S9e.NUMERIC,this.data=e.toString()}_9e.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},_9e.prototype.getLength=function(){return this.data.length},_9e.prototype.getBitsLength=function(){return _9e.getBitsLength(this.data.length)},_9e.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 P9e=_9e;const k9e=m9e,R9e=["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 N9e(e){this.mode=k9e.ALPHANUMERIC,this.data=e}N9e.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},N9e.prototype.getLength=function(){return this.data.length},N9e.prototype.getBitsLength=function(){return N9e.getBitsLength(this.data.length)},N9e.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=45*R9e.indexOf(this.data[t]);n+=R9e.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(R9e.indexOf(this.data[t]),6)};var M9e=N9e;const D9e=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},L9e=m9e;function F9e(e){this.mode=L9e.BYTE,"string"==typeof e&&(e=D9e(e)),this.data=new Uint8Array(e)}F9e.getBitsLength=function(e){return 8*e},F9e.prototype.getLength=function(){return this.data.length},F9e.prototype.getBitsLength=function(){return F9e.getBitsLength(this.data.length)},F9e.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)};var B9e=F9e;const j9e=m9e,U9e=G4e;function z9e(e){this.mode=j9e.KANJI,this.data=e}z9e.getBitsLength=function(e){return 13*e},z9e.prototype.getLength=function(){return this.data.length},z9e.prototype.getBitsLength=function(){return z9e.getBitsLength(this.data.length)},z9e.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=U9e.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 H9e=z9e,W9e={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}(W9e);var V9e=W9e.exports;!function(e){const t=m9e,n=P9e,r=M9e,i=B9e,a=H9e,o=b9e,s=G4e,c=V9e;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()))}}(I9e);const G9e=G4e,q9e=X4e,K9e=J4e,X9e=Q4e,Y9e=$4e,J9e=e9e,Z9e=n9e,Q9e=r9e,$9e=p9e,e7e=h9e,t7e=x9e,n7e=m9e,r7e=I9e;function i7e(e,t,n){const r=e.size,i=t7e.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 a7e(e,t,n){const r=new K9e;n.forEach((function(t){r.put(t.mode.bit,4),r.put(t.getLength(),n7e.getCharCountIndicator(t.mode,e)),t.write(r)}));const i=8*(G9e.getSymbolTotalCodewords(e)-Q9e.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=G9e.getSymbolTotalCodewords(t),i=Q9e.getTotalCodewordsCount(t,n),a=r-i,o=Q9e.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 $9e(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 o7e(e,t,n,r){let i;if(Array.isArray(e))i=r7e.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");{let r=t;if(!r){const t=r7e.rawSplit(e);r=e7e.getBestVersionForData(t,n)}i=r7e.fromString(e,r||40)}}const a=e7e.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=a7e(t,n,i),s=G9e.getSymbolSize(t),c=new X9e(s);return function(e,t){const n=e.size,r=J9e.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=Y9e.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),i7e(c,n,0),t>=7&&function(e,t){const n=e.size,r=e7e.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=Z9e.getBestMask(c,i7e.bind(null,c,n))),Z9e.applyMask(r,c),i7e(c,n,r),{modules:c,version:t,errorCorrectionLevel:n,maskPattern:r,segments:i}}V4e.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");let n,r,i=q9e.M;return void 0!==t&&(i=q9e.from(t.errorCorrectionLevel,q9e.M),n=e7e.from(t.version),r=Z9e.from(t.maskPattern),t.toSJISFunc&&G9e.setToSJISFunction(t.toSJISFunc)),o7e(e,n,i,r)};var s7e={},c7e={};!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}}}(c7e),function(e){const t=c7e;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)}}(s7e);var u7e={};const l7e=c7e;function d7e(e,t){const n=e.a/255,r=t+'="'+e.hex+'"';return n<1?r+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function f7e(e,t,n){let r=e+t;return void 0!==n&&(r+=" "+n),r}u7e.render=function(e,t,n){const r=l7e.getOptions(t),i=e.modules.size,a=e.modules.data,o=i+2*r.margin,s=r.color.light.a?"<path "+d7e(r.color.light,"fill")+' d="M0 0h'+o+"v"+o+'H0z"/>':"",c="<path "+d7e(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?f7e("M",c+n,.5+u+n):f7e("m",i,0),i=0,a=!1),c+1<t&&e[s+1]||(r+=f7e("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 p7e=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},h7e=V4e,m7e=s7e,y7e=u7e;function b7e(e,t,n,r,i){const a=[].slice.call(arguments,1),o=a.length,s="function"==typeof a[o-1];if(!s&&!p7e())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=h7e.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=h7e.create(n,r);i(null,e(a,t,r))}catch(e){i(e)}}W4e.create=h7e.create,W4e.toCanvas=b7e.bind(null,m7e.render),W4e.toDataURL=b7e.bind(null,m7e.renderToDataURL),W4e.toString=b7e.bind(null,(function(e,t,n){return y7e.render(e,n)}));var g7e=Object.defineProperty,v7e=Object.getOwnPropertySymbols,w7e=Object.prototype.hasOwnProperty,T7e=Object.prototype.propertyIsEnumerable,E7e=(e,t,n)=>t in e?g7e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,A7e=(e,t)=>{for(var n in t||(t={}))w7e.call(t,n)&&E7e(e,n,t[n]);if(v7e)for(var n of v7e(t))T7e.call(t,n)&&E7e(e,n,t[n]);return e};const x7e={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}=GHe.state;if(e){const n=A7e(A7e(A7e({},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=GHe.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:E8e`*,::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)}`},O7e=E8e`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 C7e=Object.defineProperty,I7e=Object.getOwnPropertyDescriptor,S7e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?I7e(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&&C7e(t,n,a),a};let _7e=class extends E3e{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"),t3e`<button class="${R3e(e)}" ?disabled="${this.disabled}" @click="${this.onClick}">${this.iconLeft}<wcm-text variant="small-regular" color="${t}"><slot></slot></wcm-text>${this.iconRight}</button>`}};_7e.styles=[x7e.globalCss,O7e],S7e([I3e({type:Boolean})],_7e.prototype,"disabled",2),S7e([I3e()],_7e.prototype,"iconLeft",2),S7e([I3e()],_7e.prototype,"iconRight",2),S7e([I3e()],_7e.prototype,"onClick",2),S7e([I3e()],_7e.prototype,"variant",2),_7e=S7e([x3e("wcm-button")],_7e);const P7e=E8e`: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 k7e=Object.defineProperty,R7e=Object.getOwnPropertyDescriptor,N7e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?R7e(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&&k7e(t,n,a),a};let M7e=class extends E3e{constructor(){super(...arguments),this.disabled=!1,this.variant="primary"}render(){const e={"wcm-secondary":"secondary"===this.variant};return t3e`<button ?disabled="${this.disabled}" class="${R3e(e)}"><slot></slot></button>`}};M7e.styles=[x7e.globalCss,P7e],N7e([I3e({type:Boolean})],M7e.prototype,"disabled",2),N7e([I3e()],M7e.prototype,"variant",2),M7e=N7e([x3e("wcm-button-big")],M7e);const D7e=E8e`: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 L7e=Object.defineProperty,F7e=Object.getOwnPropertyDescriptor;let B7e=class extends E3e{render(){return t3e`<div><slot></slot></div>`}};B7e.styles=[x7e.globalCss,D7e],B7e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?F7e(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&&L7e(t,n,a),a})([x3e("wcm-info-footer")],B7e);const j7e={CROSS_ICON:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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>`},U7e=E8e`.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 z7e=Object.defineProperty,H7e=Object.getOwnPropertyDescriptor;let W7e=class extends E3e{render(){return t3e`<div class="wcm-toolbar-placeholder"></div><div class="wcm-toolbar">${j7e.WALLET_CONNECT_LOGO} <button @click="${BHe.close}">${j7e.CROSS_ICON}</button></div>`}};W7e.styles=[x7e.globalCss,U7e],W7e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?H7e(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&&z7e(t,n,a),a})([x3e("wcm-modal-backcard")],W7e);const V7e=E8e`main{padding:20px;padding-top:0;width:100%}`;var G7e=Object.defineProperty,q7e=Object.getOwnPropertyDescriptor;let K7e=class extends E3e{render(){return t3e`<main><slot></slot></main>`}};K7e.styles=[x7e.globalCss,V7e],K7e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?q7e(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&&G7e(t,n,a),a})([x3e("wcm-modal-content")],K7e);const X7e=E8e`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;var Y7e=Object.defineProperty,J7e=Object.getOwnPropertyDescriptor;let Z7e=class extends E3e{render(){return t3e`<footer><slot></slot></footer>`}};Z7e.styles=[x7e.globalCss,X7e],Z7e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?J7e(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&&Y7e(t,n,a),a})([x3e("wcm-modal-footer")],Z7e);const Q7e=E8e`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 $7e=Object.defineProperty,eet=Object.getOwnPropertyDescriptor,tet=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?eet(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&&$7e(t,n,a),a};let net=class extends E3e{constructor(){super(...arguments),this.title="",this.onAction=void 0,this.actionIcon=void 0,this.border=!1}backBtnTemplate(){return t3e`<button class="wcm-back-btn" @click="${dHe.goBack}">${j7e.BACK_ICON}</button>`}actionBtnTemplate(){return t3e`<button class="wcm-action-btn" @click="${this.onAction}">${this.actionIcon}</button>`}render(){const e={"wcm-border":this.border},t=dHe.state.history.length>1,n=this.title?t3e`<wcm-text variant="big-bold">${this.title}</wcm-text>`:t3e`<slot></slot>`;return t3e`<header class="${R3e(e)}">${t?this.backBtnTemplate():null} ${n} ${this.onAction?this.actionBtnTemplate():null}</header>`}};net.styles=[x7e.globalCss,Q7e],tet([I3e()],net.prototype,"title",2),tet([I3e()],net.prototype,"onAction",2),tet([I3e()],net.prototype,"actionIcon",2),tet([I3e({type:Boolean})],net.prototype,"border",2),net=tet([x3e("wcm-modal-header")],net);const ret={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}=gHe.state;return null!=n&&n[e]?n[e]:t?LHe.getWalletImageUrl(t):""},getWalletName:(e,t=!1)=>t&&e.length>8?`${e.substring(0,8)}..`:e,isMobileAnimation:()=>window.innerWidth<=ret.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,fHe.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}=yHe.state,{mobile:n,name:r}=e,i=n?.native,a=n?.universal;ret.setRecentWallet(e),t&&function(e){let t="";i?t=fHe.formatUniversalUrl(i,e,r):a&&(t=fHe.formatNativeUrl(a,e,r)),fHe.openHref(t,"_self")}(t)},handleAndroidLinking(){const{walletConnectUri:e}=yHe.state;e&&(fHe.setWalletConnectAndroidDeepLink(e),fHe.openHref(e,"_self"))},async handleUriCopy(){const{walletConnectUri:e}=yHe.state;if(e)try{await navigator.clipboard.writeText(e),KHe.openToast("Link copied","success")}catch{KHe.openToast("Failed to copy","error")}},getCustomImageUrls(){const{walletImages:e}=gHe.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(ret.WCM_RECENT_WALLET_DATA,JSON.stringify(e))}catch{console.info("Unable to set recent wallet")}},getRecentWallet(){try{const e=localStorage.getItem(ret.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(){fHe.openHref(ret.EXPLORER_WALLET_URL,"_blank")},getCachedRouterWalletPlatforms(){const{desktop:e,mobile:t}=fHe.getWalletRouterData(),n=Boolean(e?.native),r=Boolean(e?.universal);return{isDesktop:n,isMobile:Boolean(t?.native)||Boolean(t?.universal),isWeb:r}},goToConnectingView(e){dHe.setData({Wallet:e});const t=fHe.isMobile(),{isDesktop:n,isWeb:r,isMobile:i}=ret.getCachedRouterWalletPlatforms();t?i?dHe.push("MobileConnecting"):r?dHe.push("WebConnecting"):dHe.push("InstallWallet"):n?dHe.push("DesktopConnecting"):r?dHe.push("WebConnecting"):i?dHe.push("MobileQrcodeConnecting"):dHe.push("InstallWallet")}},iet=E8e`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var aet=Object.defineProperty,oet=Object.getOwnPropertyDescriptor,set=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?oet(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&&aet(t,n,a),a};let cet=class extends E3e{constructor(){super(),this.view=dHe.state.view,this.prevView=dHe.state.view,this.unsubscribe=void 0,this.oldHeight="0px",this.resizeObserver=void 0,this.unsubscribe=dHe.subscribe((e=>{this.view!==e.view&&this.onChangeRoute()}))}firstUpdated(){this.resizeObserver=new ResizeObserver((([e])=>{const t=`${e.contentRect.height}px`;"0px"!==this.oldHeight&&z4e(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 ret.getShadowRootElement(this,".wcm-router")}get contentEl(){return ret.getShadowRootElement(this,".wcm-content")}viewTemplate(){switch(this.view){case"ConnectWallet":return t3e`<wcm-connect-wallet-view></wcm-connect-wallet-view>`;case"DesktopConnecting":return t3e`<wcm-desktop-connecting-view></wcm-desktop-connecting-view>`;case"MobileConnecting":return t3e`<wcm-mobile-connecting-view></wcm-mobile-connecting-view>`;case"WebConnecting":return t3e`<wcm-web-connecting-view></wcm-web-connecting-view>`;case"MobileQrcodeConnecting":return t3e`<wcm-mobile-qr-connecting-view></wcm-mobile-qr-connecting-view>`;case"WalletExplorer":return t3e`<wcm-wallet-explorer-view></wcm-wallet-explorer-view>`;case"Qrcode":return t3e`<wcm-qrcode-view></wcm-qrcode-view>`;case"InstallWallet":return t3e`<wcm-install-wallet-view></wcm-install-wallet-view>`;default:return t3e`<div>Not Found</div>`}}async onChangeRoute(){await z4e(this.routerEl,{opacity:[1,0],scale:[1,1.02]},{duration:.15,delay:.1}).finished,this.view=dHe.state.view,z4e(this.routerEl,{opacity:[0,1],scale:[.99,1]},{duration:.37,delay:.05})}render(){return t3e`<div class="wcm-router"><div class="wcm-content">${this.viewTemplate()}</div></div>`}};cet.styles=[x7e.globalCss,iet],set([S3e()],cet.prototype,"view",2),set([S3e()],cet.prototype,"prevView",2),cet=set([x3e("wcm-modal-router")],cet);const uet=E8e`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 det=Object.defineProperty,fet=Object.getOwnPropertyDescriptor,pet=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?fet(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&&det(t,n,a),a};let het=class extends E3e{constructor(){super(),this.open=!1,this.unsubscribe=void 0,this.timeout=void 0,this.unsubscribe=KHe.subscribe((e=>{e.open?(this.open=!0,this.timeout=setTimeout((()=>KHe.closeToast()),2200)):(this.open=!1,clearTimeout(this.timeout))}))}disconnectedCallback(){var e;null==(e=this.unsubscribe)||e.call(this),clearTimeout(this.timeout),KHe.closeToast()}render(){const{message:e,variant:t}=KHe.state,n={"wcm-success":"success"===t,"wcm-error":"error"===t};return this.open?t3e`<div class="${R3e(n)}">${"success"===t?j7e.CHECKMARK_ICON:null} ${"error"===t?j7e.CROSS_ICON:null}<wcm-text variant="small-regular">${e}</wcm-text></div>`:null}};het.styles=[x7e.globalCss,uet],pet([S3e()],het.prototype,"open",2),het=pet([x3e("wcm-modal-toast")],het);function met(e,t,n){return e!==t&&(e-t<0?t-e:e-t)<=n+.1}const yet={generate(e,t,n){const r="#141414",i=[],a=function(e,t){const n=Array.prototype.slice.call(W4e.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(n3e`<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=>!met(e,t,o)))));return[Number(e),n]})).forEach((([e,t])=>{t.forEach((t=>{i.push(n3e`<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=>met(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=>met(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(n3e`<line x1="${e}" x2="${e}" y1="${t}" y2="${n}" stroke="${r}" stroke-width="${o/1.25}" stroke-linecap="round">`)}))})),i}},bet=E8e`@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 get=Object.defineProperty,vet=Object.getOwnPropertyDescriptor,wet=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?vet(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&&get(t,n,a),a};let Tet=class extends E3e{constructor(){super(...arguments),this.uri="",this.size=0,this.imageId=void 0,this.walletId=void 0,this.imageUrl=void 0}svgTemplate(){const e="light"===GHe.state.themeMode?this.size:this.size-36;return n3e`<svg height="${e}" width="${e}">${yet.generate(this.uri,e,e/4)}</svg>`}render(){const e={"wcm-dark":"dark"===GHe.state.themeMode};return t3e`<div style="${`width: ${this.size}px`}" class="${R3e(e)}">${this.walletId||this.imageUrl?t3e`<wcm-wallet-image walletId="${H4e(this.walletId)}" imageId="${H4e(this.imageId)}" imageUrl="${H4e(this.imageUrl)}"></wcm-wallet-image>`:j7e.WALLET_CONNECT_ICON_COLORED} ${this.svgTemplate()}</div>`}};Tet.styles=[x7e.globalCss,bet],wet([I3e()],Tet.prototype,"uri",2),wet([I3e({type:Number})],Tet.prototype,"size",2),wet([I3e()],Tet.prototype,"imageId",2),wet([I3e()],Tet.prototype,"walletId",2),wet([I3e()],Tet.prototype,"imageUrl",2),Tet=wet([x3e("wcm-qrcode")],Tet);const Eet=E8e`: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 Aet=Object.defineProperty,xet=Object.getOwnPropertyDescriptor,Oet=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?xet(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&&Aet(t,n,a),a};let Cet=class extends E3e{constructor(){super(...arguments),this.onChange=()=>null}render(){return t3e`<input type="text" @input="${this.onChange}" placeholder="Search wallets"> ${j7e.SEARCH_ICON}`}};Cet.styles=[x7e.globalCss,Eet],Oet([I3e()],Cet.prototype,"onChange",2),Cet=Oet([x3e("wcm-search-input")],Cet);const Iet=E8e`@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 _et=Object.defineProperty,Pet=Object.getOwnPropertyDescriptor;let ket=class extends E3e{render(){return t3e`<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>`}};ket.styles=[x7e.globalCss,Iet],ket=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?Pet(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&&_et(t,n,a),a})([x3e("wcm-spinner")],ket);const Ret=E8e`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 Net=Object.defineProperty,Met=Object.getOwnPropertyDescriptor,Det=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?Met(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&&Net(t,n,a),a};let Let=class extends E3e{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 t3e`<span><slot class="${R3e(e)}"></slot></span>`}};Let.styles=[x7e.globalCss,Ret],Det([I3e()],Let.prototype,"variant",2),Det([I3e()],Let.prototype,"color",2),Let=Det([x3e("wcm-text")],Let);const Fet=E8e`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 Bet=Object.defineProperty,jet=Object.getOwnPropertyDescriptor,Uet=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?jet(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&&Bet(t,n,a),a};let zet=class extends E3e{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?t3e`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">RECENT</wcm-text>`:this.installed?t3e`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">INSTALLED</wcm-text>`:null}handleClick(){hHe.click({name:"WALLET_BUTTON",walletId:this.walletId}),this.onClick()}render(){var e;return t3e`<button @click="${this.handleClick.bind(this)}"><div><wcm-wallet-image walletId="${this.walletId}" imageId="${H4e(this.imageId)}"></wcm-wallet-image><wcm-text variant="xsmall-regular">${null!=(e=this.label)?e:ret.getWalletName(this.name,!0)}</wcm-text>${this.sublabelTemplate()}</div></button>`}};zet.styles=[x7e.globalCss,Fet],Uet([I3e()],zet.prototype,"onClick",2),Uet([I3e()],zet.prototype,"name",2),Uet([I3e()],zet.prototype,"walletId",2),Uet([I3e()],zet.prototype,"label",2),Uet([I3e()],zet.prototype,"imageId",2),Uet([I3e({type:Boolean})],zet.prototype,"installed",2),Uet([I3e({type:Boolean})],zet.prototype,"recent",2),zet=Uet([x3e("wcm-wallet-button")],zet);const Het=E8e`: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 Wet=Object.defineProperty,Vet=Object.getOwnPropertyDescriptor,Get=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?Vet(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&&Wet(t,n,a),a};let qet=class extends E3e{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:ret.getWalletIcon({id:this.walletId,image_id:this.imageId});return t3e`${t.length?t3e`<div><img crossorigin="anonymous" src="${t}" alt="${this.id}"></div>`:j7e.WALLET_PLACEHOLDER}`}};qet.styles=[x7e.globalCss,Het],Get([I3e()],qet.prototype,"walletId",2),Get([I3e()],qet.prototype,"imageId",2),Get([I3e()],qet.prototype,"imageUrl",2),qet=Get([x3e("wcm-wallet-image")],qet);var Ket=Object.defineProperty,Xet=Object.getOwnPropertyDescriptor,Yet=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?Xet(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&&Ket(t,n,a),a};let Jet=class extends E3e{constructor(){super(),this.preload=!0,this.preloadData()}async loadImages(e){try{null!=e&&e.length&&await Promise.all(e.map((async e=>ret.preloadImage(e))))}catch{console.info("Unsuccessful attempt at preloading some images",e)}}async preloadListings(){if(gHe.state.enableExplorer){await LHe.getRecomendedWallets(),yHe.setIsDataLoaded(!0);const{recomendedWallets:e}=LHe.state,t=e.map((e=>ret.getWalletIcon(e)));await this.loadImages(t)}else yHe.setIsDataLoaded(!0)}async preloadCustomImages(){const e=ret.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),KHe.openToast("Failed preloading","error")}}};Yet([S3e()],Jet.prototype,"preload",2),Jet=Yet([x3e("wcm-explorer-context")],Jet);var Zet=Object.defineProperty,Qet=Object.getOwnPropertyDescriptor;let $et=class extends E3e{constructor(){super(),this.unsubscribeTheme=void 0,x7e.setTheme(),this.unsubscribeTheme=GHe.subscribe(x7e.setTheme)}disconnectedCallback(){var e;null==(e=this.unsubscribeTheme)||e.call(this)}};$et=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?Qet(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&&Zet(t,n,a),a})([x3e("wcm-theme-context")],$et);const ett=E8e`@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 ttt=Object.defineProperty,ntt=Object.getOwnPropertyDescriptor;let rtt=class extends E3e{onGoToQrcode(){dHe.push("Qrcode")}render(){const{recomendedWallets:e}=LHe.state,t=[...e,...e],n=2*fHe.RECOMMENDED_WALLET_AMOUNT;return t3e`<wcm-modal-header title="Connect your wallet" .onAction="${this.onGoToQrcode}" .actionIcon="${j7e.QRCODE_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-title">${j7e.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?t3e`<wcm-wallet-image walletId="${r.id}" imageId="${r.image_id}"></wcm-wallet-image>`:j7e.WALLET_PLACEHOLDER}))}</div><wcm-button-big @click="${ret.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>`}};rtt.styles=[x7e.globalCss,ett],rtt=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?ntt(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&&ttt(t,n,a),a})([x3e("wcm-android-wallet-selection")],rtt);const itt=E8e`@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 att=Object.defineProperty,ott=Object.getOwnPropertyDescriptor,stt=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?ott(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&&att(t,n,a),a};let ctt=class extends E3e{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=GHe.state.themeVariables)?void 0:e["--wcm-wallet-icon-large-border-radius"])?t:x7e.getPreset("--wcm-wallet-icon-large-border-radius");let r=0;r=n.includes("%")?.88*parseInt(n,10):parseInt(n,10),r*=1.17;return t3e`<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 t3e`<div class="${R3e(e)}">${this.svgLoaderTemplate()}<wcm-wallet-image walletId="${H4e(this.walletId)}" imageId="${H4e(this.imageId)}"></wcm-wallet-image></div><wcm-text variant="medium-regular" color="${this.isError?"error":"primary"}">${this.isError?"Connection declined":this.label}</wcm-text>`}};ctt.styles=[x7e.globalCss,itt],stt([I3e()],ctt.prototype,"walletId",2),stt([I3e()],ctt.prototype,"imageId",2),stt([I3e({type:Boolean})],ctt.prototype,"isError",2),stt([I3e({type:Boolean})],ctt.prototype,"isStale",2),stt([I3e()],ctt.prototype,"label",2),ctt=stt([x3e("wcm-connector-waiting")],ctt);const utt={manualWallets(){var e,t;const{mobileWallets:n,desktopWallets:r}=gHe.state,i=null==(e=utt.recentWallet())?void 0:e.id,a=fHe.isMobile()?n:r,o=a?.filter((e=>i!==e.id));return null!=(t=fHe.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:()=>ret.getRecentWallet(),recomendedWallets(e=!1){var t;const n=e||null==(t=utt.recentWallet())?void 0:t.id,{recomendedWallets:r}=LHe.state;return r.filter((e=>n!==e.id))}},ltt={onConnecting(e){ret.goToConnectingView(e)},manualWalletsTemplate(){return utt.manualWallets().map((e=>t3e`<wcm-wallet-button walletId="${e.id}" name="${e.name}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`))},recomendedWalletsTemplate(e=!1){return utt.recomendedWallets(e).map((e=>t3e`<wcm-wallet-button name="${e.name}" walletId="${e.id}" imageId="${e.image_id}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`))},recentWalletTemplate(){const e=utt.recentWallet();if(e)return t3e`<wcm-wallet-button name="${e.name}" walletId="${e.id}" imageId="${H4e(e.image_id)}" .recent="${!0}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`}},dtt=E8e`.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 ftt=Object.defineProperty,ptt=Object.getOwnPropertyDescriptor;let htt=class extends E3e{render(){const{explorerExcludedWalletIds:e,enableExplorer:t}=gHe.state,n="ALL"!==e&&t,r=ltt.manualWalletsTemplate(),i=ltt.recomendedWalletsTemplate();let a=[ltt.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 t3e`<wcm-modal-header .border="${!0}" title="Connect your wallet" .onAction="${ret.handleUriCopy}" .actionIcon="${j7e.COPY_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-mobile-title"><div class="wcm-subtitle">${j7e.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">Mobile</wcm-text></div><div class="wcm-subtitle">${j7e.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?t3e`<wcm-modal-footer><div class="wcm-desktop-title">${j7e.DESKTOP_ICON}<wcm-text variant="small-regular" color="accent">Desktop</wcm-text></div><div class="wcm-grid">${s} ${o?t3e`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-footer>`:null}`}};htt.styles=[x7e.globalCss,dtt],htt=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?ptt(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&&ftt(t,n,a),a})([x3e("wcm-desktop-wallet-selection")],htt);const mtt=E8e`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 ytt=Object.defineProperty,btt=Object.getOwnPropertyDescriptor;let gtt=class extends E3e{render(){const{termsOfServiceUrl:e,privacyPolicyUrl:t}=gHe.state;return e??t?t3e`<div><wcm-text variant="small-regular" color="secondary">By connecting your wallet to this app, you agree to the app's ${e?t3e`<a href="${e}" target="_blank" rel="noopener noreferrer">Terms of Service</a>`:null} ${e&&t?"and":null} ${t?t3e`<a href="${t}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`:null}</wcm-text></div>`:null}};gtt.styles=[x7e.globalCss,mtt],gtt=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?btt(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&&ytt(t,n,a),a})([x3e("wcm-legal-notice")],gtt);const vtt=E8e`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var wtt=Object.defineProperty,Ttt=Object.getOwnPropertyDescriptor;let Ett=class extends E3e{onQrcode(){dHe.push("Qrcode")}render(){const{explorerExcludedWalletIds:e,enableExplorer:t}=gHe.state,n="ALL"!==e&&t,r=ltt.manualWalletsTemplate(),i=ltt.recomendedWalletsTemplate();let a=[ltt.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 t3e`<wcm-modal-header title="Connect your wallet" .onAction="${this.onQrcode}" .actionIcon="${j7e.QRCODE_ICON}"></wcm-modal-header>${c?t3e`<wcm-modal-content><div>${s} ${o?t3e`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-content>`:null}`}};Ett.styles=[x7e.globalCss,vtt],Ett=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?Ttt(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&&wtt(t,n,a),a})([x3e("wcm-mobile-wallet-selection")],Ett);const Att=E8e`: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 xtt=Object.defineProperty,Ott=Object.getOwnPropertyDescriptor,Ctt=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?Ott(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&&xtt(t,n,a),a};let Itt=class extends E3e{constructor(){super(),this.open=!1,this.active=!1,this.unsubscribeModal=void 0,this.abortController=void 0,this.unsubscribeModal=BHe.subscribe((e=>{e.open?this.onOpenModalEvent():this.onCloseModalEvent()}))}disconnectedCallback(){var e;null==(e=this.unsubscribeModal)||e.call(this)}get overlayEl(){return ret.getShadowRootElement(this,".wcm-overlay")}get containerEl(){return ret.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&&BHe.close()}onOpenModalEvent(){this.toggleBodyScroll(!1),this.addKeyboardEvents(),this.open=!0,setTimeout((async()=>{const e=ret.isMobileAnimation()?{y:["50vh","0vh"]}:{scale:[.98,1]};await Promise.all([z4e(this.overlayEl,{opacity:[0,1]},{delay:.1,duration:.2}).finished,z4e(this.containerEl,e,{delay:.1,duration:.2}).finished]),this.active=!0}),0)}async onCloseModalEvent(){this.toggleBodyScroll(!0),this.removeKeyboardEvents();const e=ret.isMobileAnimation()?{y:["0vh","50vh"]}:{scale:[1,.98]};await Promise.all([z4e(this.overlayEl,{opacity:[1,0]},{duration:.2}).finished,z4e(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?BHe.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 t3e`<wcm-explorer-context></wcm-explorer-context><wcm-theme-context></wcm-theme-context><div id="wcm-modal" class="${R3e(e)}" @click="${this.onCloseModal}" role="alertdialog" aria-modal="true"><div class="wcm-container" tabindex="0">${this.open?t3e`<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>`}};Itt.styles=[x7e.globalCss,Att],Ctt([S3e()],Itt.prototype,"open",2),Ctt([S3e()],Itt.prototype,"active",2),Itt=Ctt([x3e("wcm-modal")],Itt);const Stt=E8e`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var _tt=Object.defineProperty,Ptt=Object.getOwnPropertyDescriptor,ktt=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?Ptt(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&&_tt(t,n,a),a};let Rtt=class extends E3e{constructor(){super(...arguments),this.isMobile=!1,this.isDesktop=!1,this.isWeb=!1,this.isRetry=!1}onMobile(){fHe.isMobile()?dHe.replace("MobileConnecting"):dHe.replace("MobileQrcodeConnecting")}onDesktop(){dHe.replace("DesktopConnecting")}onWeb(){dHe.replace("WebConnecting")}render(){return t3e`<div>${this.isRetry?t3e`<slot></slot>`:null} ${this.isMobile?t3e`<wcm-button .onClick="${this.onMobile}" .iconLeft="${j7e.MOBILE_ICON}" variant="outline">Mobile</wcm-button>`:null} ${this.isDesktop?t3e`<wcm-button .onClick="${this.onDesktop}" .iconLeft="${j7e.DESKTOP_ICON}" variant="outline">Desktop</wcm-button>`:null} ${this.isWeb?t3e`<wcm-button .onClick="${this.onWeb}" .iconLeft="${j7e.GLOBE_ICON}" variant="outline">Web</wcm-button>`:null}</div>`}};Rtt.styles=[x7e.globalCss,Stt],ktt([I3e({type:Boolean})],Rtt.prototype,"isMobile",2),ktt([I3e({type:Boolean})],Rtt.prototype,"isDesktop",2),ktt([I3e({type:Boolean})],Rtt.prototype,"isWeb",2),ktt([I3e({type:Boolean})],Rtt.prototype,"isRetry",2),Rtt=ktt([x3e("wcm-platform-selection")],Rtt);const Ntt=E8e`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 Mtt=Object.defineProperty,Dtt=Object.getOwnPropertyDescriptor;let Ltt=class extends E3e{onClick(){dHe.push("WalletExplorer")}render(){const{recomendedWallets:e}=LHe.state,t=[...e,...utt.manualWallets()].reverse().slice(0,4);return t3e`<button @click="${this.onClick}"><div class="wcm-icons">${t.map((e=>{const t=ret.getWalletIcon(e);if(t)return t3e`<img crossorigin="anonymous" src="${t}">`;const n=ret.getWalletIcon({id:e.id});return n?t3e`<img crossorigin="anonymous" src="${n}">`:j7e.WALLET_PLACEHOLDER}))} ${[...Array(4-t.length)].map((()=>j7e.WALLET_PLACEHOLDER))}</div><wcm-text variant="xsmall-regular">View All</wcm-text></button>`}};Ltt.styles=[x7e.globalCss,Ntt],Ltt=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?Dtt(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&&Mtt(t,n,a),a})([x3e("wcm-view-all-wallets-button")],Ltt);const Ftt=E8e`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var Btt=Object.defineProperty,jtt=Object.getOwnPropertyDescriptor,Utt=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?jtt(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&&Btt(t,n,a),a};let ztt=class extends E3e{constructor(){super(),this.walletId="",this.imageId="",this.uri="",setTimeout((()=>{const{walletConnectUri:e}=yHe.state;this.uri=e}),0)}get overlayEl(){return ret.getShadowRootElement(this,".wcm-qr-container")}render(){return t3e`<div class="wcm-qr-container">${this.uri?t3e`<wcm-qrcode size="${this.overlayEl.offsetWidth}" uri="${this.uri}" walletId="${H4e(this.walletId)}" imageId="${H4e(this.imageId)}"></wcm-qrcode>`:t3e`<wcm-spinner></wcm-spinner>`}</div>`}};ztt.styles=[x7e.globalCss,Ftt],Utt([I3e()],ztt.prototype,"walletId",2),Utt([I3e()],ztt.prototype,"imageId",2),Utt([S3e()],ztt.prototype,"uri",2),ztt=Utt([x3e("wcm-walletconnect-qr")],ztt);var Htt=Object.defineProperty,Wtt=Object.getOwnPropertyDescriptor;let Vtt=class extends E3e{viewTemplate(){return fHe.isAndroid()?t3e`<wcm-android-wallet-selection></wcm-android-wallet-selection>`:fHe.isMobile()?t3e`<wcm-mobile-wallet-selection></wcm-mobile-wallet-selection>`:t3e`<wcm-desktop-wallet-selection></wcm-desktop-wallet-selection>`}render(){return t3e`${this.viewTemplate()}<wcm-legal-notice></wcm-legal-notice>`}};Vtt.styles=[x7e.globalCss],Vtt=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?Wtt(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&&Htt(t,n,a),a})([x3e("wcm-connect-wallet-view")],Vtt);const Gtt=E8e`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var qtt=Object.defineProperty,Ktt=Object.getOwnPropertyDescriptor,Xtt=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?Ktt(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&&qtt(t,n,a),a};let Ytt=class extends E3e{constructor(){super(),this.isError=!1,this.openDesktopApp()}onFormatAndRedirect(e){const{desktop:t,name:n}=fHe.getWalletRouterData(),r=t?.native;if(r){const t=fHe.formatNativeUrl(r,e,n);fHe.openHref(t,"_self")}}openDesktopApp(){const{walletConnectUri:e}=yHe.state,t=fHe.getWalletRouterData();ret.setRecentWallet(t),e&&this.onFormatAndRedirect(e)}render(){const{name:e,id:t,image_id:n}=fHe.getWalletRouterData(),{isMobile:r,isWeb:i}=ret.getCachedRouterWalletPlatforms();return t3e`<wcm-modal-header title="${e}" .onAction="${ret.handleUriCopy}" .actionIcon="${j7e.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${H4e(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="${j7e.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Ytt.styles=[x7e.globalCss,Gtt],Xtt([S3e()],Ytt.prototype,"isError",2),Ytt=Xtt([x3e("wcm-desktop-connecting-view")],Ytt);const Jtt=E8e`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 Ztt=Object.defineProperty,Qtt=Object.getOwnPropertyDescriptor;let $tt=class extends E3e{onInstall(e){e&&fHe.openHref(e,"_blank")}render(){const{name:e,id:t,image_id:n,homepage:r}=fHe.getWalletRouterData();return t3e`<wcm-modal-header title="${e}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${H4e(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="${j7e.ARROW_DOWN_ICON}">Download</wcm-button></wcm-info-footer>`}};$tt.styles=[x7e.globalCss,Jtt],$tt=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?Qtt(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&&Ztt(t,n,a),a})([x3e("wcm-install-wallet-view")],$tt);const ent=E8e`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 tnt=Object.defineProperty,nnt=Object.getOwnPropertyDescriptor,rnt=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?nnt(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&&tnt(t,n,a),a};let int=class extends E3e{constructor(){super(),this.isError=!1,this.openMobileApp()}onFormatAndRedirect(e,t=!1){const{mobile:n,name:r}=fHe.getWalletRouterData(),i=n?.native,a=n?.universal;if(i&&!t){const t=fHe.formatNativeUrl(i,e,r);fHe.openHref(t,"_self")}else if(a){const t=fHe.formatUniversalUrl(a,e,r);fHe.openHref(t,"_self")}}openMobileApp(e=!1){const{walletConnectUri:t}=yHe.state,n=fHe.getWalletRouterData();ret.setRecentWallet(n),t&&this.onFormatAndRedirect(t,e)}onGoToAppStore(e){e&&fHe.openHref(e,"_blank")}render(){const{name:e,id:t,image_id:n,app:r,mobile:i}=fHe.getWalletRouterData(),{isWeb:a}=ret.getCachedRouterWalletPlatforms(),o=r?.ios,s=i?.universal;return t3e`<wcm-modal-header title="${e}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${H4e(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="${j7e.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection>${s?t3e`<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="${H4e(n)}"></wcm-wallet-image><wcm-text>${`Get ${e}`}</wcm-text></div><wcm-button .iconRight="${j7e.ARROW_RIGHT_ICON}" .onClick="${()=>this.onGoToAppStore(o)}" variant="ghost">App Store</wcm-button></wcm-info-footer>`}};int.styles=[x7e.globalCss,ent],rnt([S3e()],int.prototype,"isError",2),int=rnt([x3e("wcm-mobile-connecting-view")],int);const ant=E8e`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var ont=Object.defineProperty,snt=Object.getOwnPropertyDescriptor;let cnt=class extends E3e{render(){const{name:e,id:t,image_id:n}=fHe.getWalletRouterData(),{isDesktop:r,isWeb:i}=ret.getCachedRouterWalletPlatforms();return t3e`<wcm-modal-header title="${e}" .onAction="${ret.handleUriCopy}" .actionIcon="${j7e.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr walletId="${t}" imageId="${H4e(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>`}};cnt.styles=[x7e.globalCss,ant],cnt=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?snt(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&&ont(t,n,a),a})([x3e("wcm-mobile-qr-connecting-view")],cnt);var unt=Object.defineProperty,lnt=Object.getOwnPropertyDescriptor;let dnt=class extends E3e{render(){return t3e`<wcm-modal-header title="Scan the code" .onAction="${ret.handleUriCopy}" .actionIcon="${j7e.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>`}};dnt.styles=[x7e.globalCss],dnt=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?lnt(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&&unt(t,n,a),a})([x3e("wcm-qrcode-view")],dnt);const fnt=E8e`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 pnt=Object.defineProperty,hnt=Object.getOwnPropertyDescriptor,mnt=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?hnt(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&&pnt(t,n,a),a};let ynt=class extends E3e{constructor(){super(...arguments),this.loading=!LHe.state.wallets.listings.length,this.firstFetch=!LHe.state.wallets.listings.length,this.search="",this.endReached=!1,this.intersectionObserver=void 0,this.searchDebounce=ret.debounce((e=>{e.length>=1?(this.firstFetch=!0,this.endReached=!1,this.search=e,LHe.resetSearch(),this.fetchWallets()):this.search&&(this.search="",this.endReached=this.isLastPage(),LHe.resetSearch())}))}firstUpdated(){this.createPaginationObserver()}disconnectedCallback(){var e;null==(e=this.intersectionObserver)||e.disconnect()}get placeholderEl(){return ret.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}=LHe.state,{listings:n,total:r}=this.search?t:e;return r<=40||n.length>=r}async fetchWallets(){var e;const{wallets:t,search:n}=LHe.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=yHe.state.chains)?void 0:e.join(","),{listings:n}=await LHe.getWallets({page:this.firstFetch?1:a+1,entries:40,search:this.search,version:2,chains:t}),r=n.map((e=>ret.getWalletIcon(e)));await Promise.all([...r.map((async e=>ret.preloadImage(e))),fHe.wait(300)]),this.endReached=this.isLastPage()}catch(e){console.error(e),KHe.openToast(ret.getErrorMessage(e),"error")}finally{this.loading=!1,this.firstFetch=!1}}onConnect(e){fHe.isAndroid()?ret.handleMobileLinking(e):ret.goToConnectingView(e)}onSearchChange(e){const{value:t}=e.target;this.searchDebounce(t)}render(){const{wallets:e,search:t}=LHe.state,{listings:n}=this.search?t:e,r=this.loading&&!n.length,i=this.search.length>=3;let a=ltt.manualWalletsTemplate(),o=ltt.recomendedWalletsTemplate(!0);i&&(a=a.filter((({values:e})=>ret.caseSafeIncludes(e[0],this.search))),o=o.filter((({values:e})=>ret.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 t3e`<wcm-modal-header><wcm-search-input .onChange="${this.onSearchChange.bind(this)}"></wcm-search-input></wcm-modal-header><wcm-modal-content class="${R3e(c)}"><div class="wcm-grid">${r?null:a} ${r?null:o} ${r?null:n.map((e=>t3e`${e?t3e`<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?t3e`<wcm-text variant="big-bold" color="secondary">No results found</wcm-text>`:null} ${!s&&this.loading?t3e`<wcm-spinner></wcm-spinner>`:null}</div></wcm-modal-content>`}};ynt.styles=[x7e.globalCss,fnt],mnt([S3e()],ynt.prototype,"loading",2),mnt([S3e()],ynt.prototype,"firstFetch",2),mnt([S3e()],ynt.prototype,"search",2),mnt([S3e()],ynt.prototype,"endReached",2),ynt=mnt([x3e("wcm-wallet-explorer-view")],ynt);const bnt=E8e`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var gnt=Object.defineProperty,vnt=Object.getOwnPropertyDescriptor,wnt=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?vnt(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&&gnt(t,n,a),a};let Tnt=class extends E3e{constructor(){super(),this.isError=!1,this.openWebWallet()}onFormatAndRedirect(e){const{desktop:t,name:n}=fHe.getWalletRouterData(),r=t?.universal;if(r){const t=fHe.formatUniversalUrl(r,e,n);fHe.openHref(t,"_blank")}}openWebWallet(){const{walletConnectUri:e}=yHe.state,t=fHe.getWalletRouterData();ret.setRecentWallet(t),e&&this.onFormatAndRedirect(e)}render(){const{name:e,id:t,image_id:n}=fHe.getWalletRouterData(),{isMobile:r,isDesktop:i}=ret.getCachedRouterWalletPlatforms(),a=fHe.isMobile();return t3e`<wcm-modal-header title="${e}" .onAction="${ret.handleUriCopy}" .actionIcon="${j7e.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${H4e(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="${j7e.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Tnt.styles=[x7e.globalCss,bnt],wnt([S3e()],Tnt.prototype,"isError",2),Tnt=wnt([x3e("wcm-web-connecting-view")],Tnt);var Ent=Object.freeze({__proto__:null,get WcmModal(){return Itt},get WcmQrCode(){return Tet}});function Ant({theme:e,environment:t}){const{t:n}=uUe(),r=e===RZ.DARK?Rze(t,"/quickswapdark.webp"):Rze(t,"/quickswaplight.webp");return y1(kae,{testId:"quickswap-footer-container",sx:ZUe,children:[y1(kae,{testId:"quickswap-logo",sx:QUe,children:[m1(jce,{size:"xSmall",sx:{paddingRight:"base.spacing.x1"},children:"By"}),m1("img",{style:{height:"26px"},alt:"Quickswap logo",src:r})]}),m1(jce,{testId:"quickswap-footer-disclaimer-text",size:"xSmall",sx:$Ue,children:n("footers.quickswapFooter.disclaimerText")})]})}function xnt({visible:e,targetChainId:t,provider:n,checkout:r,onCloseDrawer:i,onNetworkSwitch:a}){const{t:o}=uUe(),s=Rze(r.config.environment??qt.PRODUCTION,"/switchnetworkethereum.png"),c=Rze(r.config.environment??qt.PRODUCTION,"/switchnetworkzkevm.png"),u=TBe(t),l=t===NUe(r.config),d=QQ.useCallback((async()=>{if(!r)return;const e=await r.switchNetwork({provider:n,chainId:t});a&&a(e.provider)}),[r,n,a,t]),f=Xze(n),p=QQ.useMemo((()=>f?n.provider?.session?.peer?.metadata?.name:""),[n,f]),h=QQ.useMemo((()=>p?.toLowerCase().includes("metamask")),[p]),m=QQ.useMemo((()=>Kze(n)?"MetaMask wallet":f&&p?p:"wallet"),[n,f,p]),y=f&&h;return QQ.useEffect((()=>{(new Image).src=s;(new Image).src=c}),[]),m1(Cde,{size:"threeQuarter",visible:e,onCloseDrawer:i,showHeaderBar:!1,children:y1(Cde.Content,{sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center"},children:[m1(Pse,{aspectRatio:"21:9",responsiveSizes:[450,512,640,720,860,1024,1280,1440],imageUrl:l?s:c}),m1(soe,{icon:"Close",variant:"tertiary",sx:{pos:"absolute",top:"base.spacing.x5",left:"base.spacing.x5",backdropFilter:"blur(30px)"},onClick:i}),y1(kae,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:"base.spacing.x4",paddingX:"base.spacing.x6"},children:[m1(Que,{size:"small",weight:"bold",sx:{textAlign:"center",paddingX:"base.spacing.x6"},children:o("drawers.networkSwitch.heading",{wallet:m})}),y&&m1(jce,{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&&m1(jce,{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})})]}),y1(kae,{sx:{display:"flex",flexDirection:"column",paddingX:"base.spacing.x4",width:"100%"},children:[!y&&m1(xae,{size:"large",variant:"primary",sx:{width:"100%",marginBottom:"base.spacing.x2"},onClick:d,children:o("drawers.networkSwitch.switchButton",{chain:u})}),m1(Uze,{})]})]})})}const Ont={exchange:null,walletProviderName:null,network:null,tokenBalances:[],supportedTopUps:null,allowedTokens:[]};var Cnt;!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"}(Cnt||(Cnt={}));const Int=QQ.createContext({swapState:Ont,swapDispatch:()=>{}});Int.displayName="SwapContext";const Snt=(e,t)=>{switch(t.payload.type){case Cnt.SET_EXCHANGE:return{...e,exchange:t.payload.exchange};case Cnt.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case Cnt.SET_NETWORK:return{...e,network:t.payload.network};case Cnt.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 Cnt.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case Cnt.SET_ALLOWED_TOKENS:return{...e,allowedTokens:t.payload.allowedTokens};default:return e}};var _nt;!function(e){e.USD="usd"}(_nt||(_nt={}));const Pnt={cryptoFiat:null,fiatSymbol:_nt.USD,tokenSymbols:[],conversions:new Map};var knt;!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"}(knt||(knt={}));const Rnt=QQ.createContext({cryptoFiatState:Pnt,cryptoFiatDispatch:()=>{}}),Nnt=(e,t)=>{switch(t.payload.type){case knt.SET_CRYPTO_FIAT:return{...e,cryptoFiat:t.payload.cryptoFiat};case knt.SET_FIAT_SYMBOL:return{...e,fiatSymbol:t.payload.fiatSymbol};case knt.SET_TOKEN_SYMBOLS:return{...e,tokenSymbols:t.payload.tokenSymbols};case knt.SET_CONVERSIONS:return{...e,conversions:t.payload.conversions};default:return e}},Mnt={fromAmountIn:async(e,t,n,r,i)=>{const a=await t.getSigner().getAddress();return e.getUnsignedSwapTxFromAmountIn(a,n.address,i.address,jr.from(Gp(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(Gp(r,n.decimals)))}},Dnt={display:"flex",flexDirection:"row",justifyContent:"space-between",columnGap:"base.spacing.x1"},Lnt={flex:1},Fnt={flex:2};function Bnt({onClick:e,icon:t,name:n,symbol:r,balance:i,defaultTokenImage:a,testId:o,id:s}){const{t:c}=uUe();return y1(nhe,{testId:`${o}-coin-selector__option-${s}`,emphasized:!0,size:"small",onClick:e,children:[!t&&m1(nhe.Icon,{icon:"Coins",variant:"bold"}),t&&m1(nhe.FramedImage,{imageUrl:t,circularFrame:!0,defaultImageUrl:a}),m1(nhe.Label,{children:n}),m1(nhe.Caption,{children:r}),i&&m1(nhe.PriceDisplay,{fiatAmount:`${c("drawers.coinSelector.option.fiatPricePrefix")}${i.formattedFiatAmount}`,price:i.formattedAmount})]})}const jnt={display:"flex",flexDirection:"column",gap:"2px",paddingX:"base.spacing.x4",paddingBottom:"base.spacing.x4"},Unt={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"};function znt({heading:e,options:t,defaultTokenImage:n,optionsLoading:r,children:i,onCloseDrawer:a,visible:o}){const{t:s}=uUe();return y1(Cde,{headerBarTitle:e,size:"full",onCloseDrawer:a,visible:o,children:[m1(Cde.Target,{children:i}),m1(Cde.Content,{children:y1(kae,{sx:jnt,children:[r&&0===t.length&&y1(kae,{sx:Unt,children:[m1(nhe,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),m1(nhe,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"}),m1(nhe,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--3"})]}),!r&&0===t.length&&m1(jce,{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})=>m1(Bnt,{id:o,testId:s,onClick:e,icon:t,name:r,symbol:i,balance:a,defaultTokenImage:n},`${i}-${r}`)))]})})]})}function Hnt({testId:e,options:t,optionsLoading:n,subtext:r,onSelectChange:i,textAlign:a,errorMessage:o,disabled:s,selectedOption:c,coinSelectorHeading:u,defaultTokenImage:l}){const[d,f]=QQ.useState(!1);return y1(kae,{children:[m1(znt,{heading:u,options:QQ.useMemo((()=>t.map((t=>({...t,testId:e,onClick:()=>{i(t.id),f(!1)}})))),[t,i,f]),defaultTokenImage:l,optionsLoading:n??!1,visible:d,onCloseDrawer:()=>f(!1)}),m1(V0e,{testId:`${e}-select-control`,textAlign:a??"left",subtext:o?void 0:r,isErrored:!!o,errorMessage:o,children:m1(phe,{testId:`${e}-select`,size:"large",defaultLabel:"Select coin",targetClickOveride:()=>f(!0),selectedOption:(()=>{if(c&&0!==t.length&&t.find((e=>e.id===c)))return c})(),sx:{minw:"170px"},children:t.filter((e=>e.id===c))?.map((e=>y1(phe.Option,{optionKey:e.id,testId:e.testId,disabled:s,children:[!e.icon&&m1(phe.Option.Icon,{icon:"Coins",variant:"bold"}),e.icon&&m1(phe.Option.FramedImage,{imageUrl:e.icon,circularFrame:!0,defaultImageUrl:l,sx:{background:"base.color.translucent.standard.100"}}),m1(phe.Option.Label,{children:e.symbol})]},e.id)))})})]})}function Wnt({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}){return m1(V0e,{testId:`${e}-text-control`,textAlign:u??"left",subtext:r?void 0:d,isErrored:!!r,errorMessage:r,sx:{width:"100%"},children:m1(Lme,{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,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&&m1(Lme.Button,{testId:`${e}-max-button`,onClick:f,disabled:p,children:"max"})})})}function Vnt({testId:e,options:t,textInputValue:n,textInputPlaceholder:r,textInputValidator:i,textInputType:a,onTextInputChange:o,onTextInputBlur:s,onTextInputFocus:c,textInputTextAlign:u,textInputSubtext:l,textInputErrorMessage:d,selectTextAlign:f,selectSubtext:p,selectErrorMessage:h,textInputMaxButtonClick:m,onSelectChange:y,textInputDisabled:b,selectInputDisabled:g,selectedOption:v,coinSelectorHeading:w,defaultTokenImage:T}){return y1(kae,{sx:Dnt,children:[m1(kae,{sx:Lnt,children:m1(Hnt,{testId:`${e}-select-form`,options:t,subtext:p,textAlign:f,errorMessage:h,onSelectChange:y,disabled:g,selectedOption:v,coinSelectorHeading:w,defaultTokenImage:T})}),m1(kae,{sx:Fnt,children:m1(Wnt,{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:m,disabled:b})})]})}const Gnt={display:"flex",flexDirection:"column",height:"100%",padding:"16px 16px 0 16px"},qnt={display:"flex",flexDirection:"column",gap:"10px",height:"100%"},Knt={display:"flex",width:"100%"},Xnt=e=>({width:"50%",color:e?"base.color.text.body.primary":"base.color.text.body.secondary"}),Ynt={width:"50%"},Jnt={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"};function Znt({boldLabel:e,label:t,amount:n,fiatAmount:r,tokenSymbol:i,prefix:a=""}){const o=t.toLowerCase().replace(" ","-");return y1(kae,{sx:Knt,testId:`fee-item-${o}`,children:[m1(jce,{sx:Xnt(e),children:t}),m1(que,{testId:o,sx:Ynt,price:`${a}${i} ${n}`,fiatAmount:r})]})}function Qnt({fees:e,children:t,visible:n,onCloseDrawer:r,totalFiatAmount:i,totalAmount:a,tokenSymbol:o,loading:s=!1}){const{t:c}=uUe();return y1(Cde,{headerBarTitle:c("drawers.feesBreakdown.heading"),size:"threeQuarter",onCloseDrawer:r,visible:n,children:[m1(Cde.Target,{children:t}),y1(Cde.Content,{testId:"fees-breakdown-content",sx:Gnt,children:[y1(kae,{sx:qnt,children:[s&&y1(kae,{sx:Jnt,children:[m1(nhe,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),m1(nhe,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"})]}),!s&&e.map((({label:e,amount:t,fiatAmount:n,prefix:r})=>m1(Znt,{label:e,amount:t,fiatAmount:n,tokenSymbol:o,prefix:r},e))),a&&y1(h1,{children:[m1(qae,{size:"xSmall"}),m1(Znt,{label:c("drawers.feesBreakdown.total"),amount:Sze(a),fiatAmount:i?`~ ${c("drawers.feesBreakdown.fees.fiatPricePrefix")}${i}`:Cze("0"),tokenSymbol:o,boldLabel:!0},c("drawers.feesBreakdown.total"))]})]}),m1(Uze,{})]})]})}const $nt={backgroundColor:"base.color.translucent.emphasis.100"},ert={marginBottom:"base.spacing.x4",color:"base.color.text.body.secondary"};function trt({gasFeeValue:e,gasFeeToken:t,gasFeeFiatValue:n,fees:r,onFeesClick:i,loading:a,sx:o}){const[s,c]=QQ.useState(!1),{t:u}=uUe();if(!e&&!a)return m1(kae,{});const l=Cze(Sze(e)),d=t?.symbol;return y1(h1,{children:[y1(Poe,{targetClickOveride:()=>{c(!0),i?.()},sx:{...$nt,paddingBottom:"base.spacing.x2",...o},children:[m1(Poe.TargetLeftSlot,{children:m1(jce,{size:"medium",sx:ert,children:u("drawers.feesBreakdown.heading")})}),y1(Poe.TargetRightSlot,{children:[a&&m1(kae,{sx:{width:"218px",position:"relative"},children:m1(kae,{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:m1("span",{}),children:m1(Ice,{rc:m1("span",{})})})}),!a&&m1(que,{testId:"fees-gas-fee__priceDisplay",fiatAmount:`~ ${u("drawers.feesBreakdown.fees.fiatPricePrefix")}${n}`,price:`~ ${d} ${Cze(Sze(l))}`})]})]}),m1(Qnt,{tokenSymbol:d??"",fees:r,visible:s,loading:a,onCloseDrawer:()=>c(!1)})]})}var nrt;!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"}(nrt||(nrt={}));const rrt={display:"flex",flexDirection:"column",paddingY:"base.spacing.x6",paddingX:"base.spacing.x4"},irt={width:"base.icon.size.400"},art={display:"flex",flexDirection:"column",alignItems:"center",paddingY:"50px",paddingX:"base.spacing.x4",height:"100%"},ort={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"15px"},srt={display:"flex",flexDirection:"column",justifyContent:"flex-end",gap:"8px",height:"100%",width:"100%"},crt={width:"100%",height:"64px"};function urt({onCloseDrawer:e,visible:t,showHeaderBar:n,onRetry:r}){const{t:i}=uUe();return m1(Cde,{headerBarTitle:void 0,size:"full",onCloseDrawer:e,visible:t,showHeaderBar:n,children:m1(Cde.Content,{children:y1(kae,{sx:art,children:[m1(lye,{icon:"Information",colorVariant:"guidance",iconVariant:"bold"}),y1(Que,{size:"small",sx:ort,testId:"transaction-rejected-heading",children:[i("drawers.transactionFailed.content.heading1"),m1("br",{}),i("drawers.transactionFailed.content.heading2")]}),y1(jce,{sx:ort,children:[i("drawers.transactionFailed.content.body1"),m1("br",{}),i("drawers.transactionFailed.content.body2")]}),y1(kae,{sx:srt,children:[m1(xae,{sx:crt,variant:"tertiary",onClick:r,children:i("drawers.transactionFailed.buttons.retry")}),m1(xae,{sx:crt,variant:"tertiary",onClick:e,testId:"transaction-rejected-cancel-button",children:i("drawers.transactionFailed.buttons.cancel")})]})]})})})}function lrt({loading:e,updateLoading:t,validator:n,transaction:r,data:i,insufficientFundsForGas:a,openNotEnoughImxDrawer:o,openNetworkSwitchDrawer:s}){const{t:c}=uUe(),[u,l]=QQ.useState(!1),{viewDispatch:d}=QQ.useContext(oze),{connectLoaderState:f}=QQ.useContext(Tze),{checkout:p,provider:h}=f,{track:m}=yBe(),y=async()=>{const e=n();if(m({userJourney:cBe.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())!==MUe(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:aze.UPDATE_VIEW,view:{type:nrt.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:qze(h)?jr.from(0):void 0}});d({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.IN_PROGRESS,data:{transactionResponse:n.transactionResponse,swapForm:e}}}})}catch(e){if(console.error(e),t(!1),e.type===QZ.USER_REJECTED_REQUEST_ERROR)return void l(!0);if(e.type===QZ.UNPREDICTABLE_GAS_LIMIT)return void d({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.PRICE_SURGE,data:i}}});if(e.type===QZ.TRANSACTION_FAILED||e.type===QZ.INSUFFICIENT_FUNDS||e.receipt&&0===e.receipt.status)return void d({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.FAIL,reason:"Transaction failed",data:i}}});d({payload:{type:aze.UPDATE_VIEW,view:{type:rze.ERROR_VIEW,error:e}}})}}};return y1(kae,{sx:rrt,children:[m1(xae,{testId:"swap-button",disabled:e,variant:"primary",onClick:y,size:"large",children:e?m1(xae.Icon,{icon:"Loading",sx:irt}):c("views.SWAP.swapForm.buttonText")}),m1(urt,{visible:u,showHeaderBar:!1,onCloseDrawer:()=>l(!1),onRetry:()=>{y(),l(!1)}})]})}function drt(e,t){const n=QQ.useRef(e),r=QQ.useRef(0);return sse((()=>{n.current=e}),[e]),QQ.useEffect((()=>{if(t||0===t)return r.current=setInterval((()=>n.current()),t),()=>{clearInterval(r.current)}}),[t]),()=>{r.current&&clearInterval(r.current)}}const frt={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x1",height:"100%"},prt={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"base.spacing.x4"},hrt={display:"flex",flexDirection:"column",justifyContent:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},mrt={width:"100%",height:"base.spacing.x16"},yrt={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"base.spacing.x6"};function brt({environment:e,visible:t,showAdjustAmount:n,hasZeroImx:r,onCloseDrawer:i,onAddCoinsClick:a}){const{t:o}=uUe(),s=function(e){return Rze(e,"/tokens/imx.svg")}(e);return m1(Cde,{size:"full",onCloseDrawer:i,visible:t,showHeaderBar:!1,children:m1(Cde.Content,{children:y1(kae,{testId:"not-enough-gas-bottom-sheet",sx:frt,children:[m1(xse,{imageUrl:s,imageResizeServiceUrl:_Ue[e],sx:{w:"base.icon.size.600",h:"base.icon.size.600"}}),m1(Que,{size:"small",sx:prt,testId:"not-enough-gas-heading",children:o(`drawers.notEnoughImx.content.${r?"noImx":"insufficientImx"}.heading`)}),m1(jce,{sx:prt,children:o(`drawers.notEnoughImx.content.${r?"noImx":"insufficientImx"}.body`)}),y1(kae,{sx:hrt,children:[n&&m1(xae,{testId:"not-enough-gas-adjust-amount-button",sx:mrt,variant:"tertiary",onClick:i,children:o("drawers.notEnoughImx.buttons.adjustAmount")}),m1(xae,{testId:"not-enough-gas-add-imx-button",sx:mrt,variant:"tertiary",onClick:a,children:o("drawers.notEnoughImx.buttons.addMoreImx")}),m1(xae,{sx:mrt,variant:"tertiary",onClick:i,testId:"not-enough-gas-cancel-button",children:o("drawers.notEnoughImx.buttons.cancel")})]}),m1(kae,{sx:yrt,children:m1(xie,{testId:"footer-logo-image",logo:"ImmutableHorizontalLockup",sx:{width:"base.spacing.x25"}})})]})})})}const grt={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x4",paddingX:"base.spacing.x4",height:"100%"},vrt={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"base.spacing.x4"},wrt={display:"flex",flexDirection:"column",justifyContent:"flex-end",alignItems:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},Trt={width:"100%",height:"base.spacing.x16",marginBottom:"base.spacing.x16"},Ert={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"base.spacing.x6"},Art={width:"base.icon.size.600",fill:"base.color.status.fatal.bright"};function xrt({visible:e,onCloseDrawer:t}){const{t:n}=uUe();return m1(Cde,{size:"full",onCloseDrawer:t,visible:e,showHeaderBar:!1,children:m1(Cde.Content,{children:y1(kae,{testId:"unable-to-swap-bottom-sheet",sx:grt,children:[m1(Yne,{icon:"Alert",testId:"unable-to-swap-icon",variant:"bold",sx:Art}),m1(Que,{size:"small",sx:vrt,testId:"unable-to-swap-heading",children:n("drawers.unableToSwap.heading")}),m1(jce,{sx:vrt,children:n("drawers.unableToSwap.body")}),m1(kae,{sx:wrt,children:m1(xae,{sx:Trt,variant:"tertiary",onClick:t,testId:"unable-to-swap-cancel-button",children:n("drawers.unableToSwap.buttons.cancel")})}),m1(kae,{sx:Ert,children:m1(xie,{testId:"footer-logo-image",logo:"ImmutableHorizontalLockup",sx:{width:"base.spacing.x25"}})})]})})})}const Ort=(e,t=500)=>{const[n,r]=QQ.useState(e);return QQ.useEffect((()=>{const n=setTimeout((()=>{r(e)}),t);return()=>{clearTimeout(n)}}),[e,t]),n};class Crt{static id=0;promiseId=0;promise;isCancelled=!1;onCancel=null;rejectPromise=()=>{};constructor(e){Crt.id+=1,this.promiseId=Crt.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 Crt(((t,n)=>{Promise.all(e.map((e=>e instanceof Crt?e.promise:e))).then(t,n)}))}then(e,t){return new Crt(((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 Crt(((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}}var Irt;!function(e){e.FROM="FROM",e.TO="TO"}(Irt||(Irt={}));const Srt=({swapFromToken:e,swapToToken:t,swapFromAmount:n,swapToAmount:r,conversion:i})=>{const a={fromToConversion:"",swapToAmount:""};if(!r)return a;if(a.swapToAmount=Sze(r),n&&e&&t){const n=Cze(Sze(Vp(i,t.decimals)),!0);a.fromToConversion=`1 ${e.symbol} ≈ ${n} ${t.symbol}`}return a},_rt=(e,t)=>void 0!==e&&(""!==e&&t!==e);let Prt;function krt({data:e,theme:t}){const{t:n}=uUe(),{swapState:{allowedTokens:r,exchange:i,tokenBalances:a,network:o}}=QQ.useContext(Int),{connectLoaderState:s}=QQ.useContext(Tze),{checkout:c,provider:u}=s,l=Mze(c?.config.environment,t),d=QQ.useCallback(((e,t)=>kze(t)?hUe:`${e.toLowerCase()}-${t.toLowerCase()}`),[]),{cryptoFiatState:f,cryptoFiatDispatch:p}=QQ.useContext(Rnt),{viewDispatch:h}=QQ.useContext(oze),[m,y]=QQ.useState(Irt.FROM),[b,g]=QQ.useState(!1),[v,w]=QQ.useState(jr.from(0)),[T,E]=QQ.useState(""),{track:A}=yBe(),[x,O]=QQ.useState(e?.fromAmount||""),[C,I]=QQ.useState(""),S=Ort(x,bUe),[_,P]=QQ.useState(),[k,R]=QQ.useState(""),[N,M]=QQ.useState(""),[D,L]=QQ.useState(0),[F,B]=QQ.useState(e?.toAmount||""),[j,U]=QQ.useState(""),z=Ort(F,bUe),[H,W]=QQ.useState(),[V,G]=QQ.useState(""),[q,K]=QQ.useState(""),[X,Y]=QQ.useState(null),[J,Z]=QQ.useState(""),[Q,$]=QQ.useState(void 0),[ee,te]=QQ.useState(""),[ne,re]=QQ.useState([]),[ie,ae]=QQ.useState(!1),[oe,se]=QQ.useState(!1),[ce,ue]=QQ.useState(!1);QQ.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:Sze(e.formattedBalance),formattedFiatAmount:0===f.conversions.size?Cze(""):Oze(e.formattedBalance,e.token.symbol||"",f.conversions)}})));re(t),e?.fromTokenAddress&&!_&&(P(r.find((t=>kze(t.address)&&e?.fromTokenAddress?.toLowerCase()===hUe||t.address?.toLowerCase()===e?.fromTokenAddress?.toLowerCase()))),R(a.find((t=>kze(t.token.address)&&e?.fromTokenAddress?.toLowerCase()===hUe||t.token.address?.toLowerCase()===e?.fromTokenAddress?.toLowerCase()))?.formattedBalance??"")),_rt(e?.toTokenAddress,e?.fromTokenAddress)&&!H&&W(r.find((t=>kze(t.address)&&e?.toTokenAddress?.toLowerCase()===hUe||t.address?.toLowerCase()===e?.toTokenAddress?.toLowerCase())))}),[a,r,f.conversions,e?.fromTokenAddress,e?.toTokenAddress,P,R,W,re,d,Cze,o]);const le=QQ.useMemo((()=>r.map((e=>({id:d(e.symbol,e.address),name:e.name,symbol:e.symbol,icon:e.icon})))),[r,_]);QQ.useEffect((()=>{p({payload:{type:knt.SET_TOKEN_SYMBOLS,tokenSymbols:r.map((e=>e.symbol))}})}),[p,r]);const de=()=>{I(""),M(""),U(""),G("")},fe=()=>{Prt&&Prt.cancel(),E(""),te(""),Y(null)},pe=(e,t)=>!Number.isNaN(parseFloat(e))&&(!(parseFloat(e)<=0)&&(!!_&&(!!H&&(!t||!b)))),he=async(e=!1)=>{pe(x,e)&&(Prt&&Prt.cancel(),e||g(!0),await(async(e=!1)=>{if(u&&i&&_&&H){try{e||E("");const t=Mnt.fromAmountIn(i,u,_,x,H),n=Mnt.fromAmountIn(i,u,_,"1",H),a=Crt.all([t,n]);Prt=a;const o=await a,s=o[0],c=o[1];w(c.quote.amount.value);const l=s.swap.gasFeeEstimate;let d=jr.from(l?.value||0);s.approval?.gasFeeEstimate&&(d=d.add(s.approval.gasFeeEstimate.value));const p=Vp(d,mUe),h=l?.token,m=r.find((e=>e.address?.toLocaleLowerCase()===h?.address?.toLocaleLowerCase()));Y(s),Z(p),$({name:m?.name||"",symbol:m?.symbol||"",decimals:m?.decimals||0,address:m?.address,icon:m?.icon}),te(Oze(p,m?.symbol||"",f.conversions)),B(Cze(Sze(Vp(s.quote.amount.value,s.quote.amount.token.decimals),s.quote.amount.token.decimals))),de()}catch(e){e.cancelled||(fe(),ae(!1),se(!0))}e||g(!1)}})(e))},me=(e,t)=>!Number.isNaN(parseFloat(e))&&(!(parseFloat(e)<=0)&&(!!_&&(!!H&&(!t||!b)))),ye=async(e=!1)=>{me(F,e)&&(Prt&&Prt.cancel(),e||g(!0),await(async(e=!1)=>{if(u&&i&&_&&H){try{e||E("");const t=Mnt.fromAmountOut(i,u,H,F,_),n=Mnt.fromAmountIn(i,u,_,"1",H),a=Crt.all([t,n]);Prt=a;const o=await a,s=o[0],c=o[1];w(c.quote.amount.value);const l=s.swap.gasFeeEstimate;let d=jr.from(l?.value||0);s.approval?.gasFeeEstimate&&(d=d.add(s.approval.gasFeeEstimate.value));const p=Vp(d,mUe),h=l?.token,m=r.find((e=>e.symbol===h?.symbol));Y(s),Z(p),$({name:m?.name||"",symbol:m?.symbol||"",decimals:m?.decimals||0,address:m?.address,icon:m?.icon}),te(Oze(p,m?.symbol||"",f.conversions)),O(Cze(Sze(Vp(s.quote.amount.value,s.quote.amount.token.decimals)))),de()}catch(e){e.cancelled||(fe(),ae(!1),se(!0))}e||g(!1)}})(e))},be=async(e=!1)=>{m===Irt.FROM?await he(e):await ye(e)};drt((()=>be(!0)),OUe),QQ.useEffect((()=>{if(m===Irt.FROM){if(S<=0)return g(!1),void fe();(async()=>{await be()})()}}),[S,_,H,D]),QQ.useEffect((()=>{if(m===Irt.TO){if(z<=0)return g(!1),void fe();(async()=>{await be()})()}}),[z,H,_]);const ge=QQ.useMemo((()=>{if(!u)return!0;if(qze(u))return!1;const e=a.find((e=>e.token.address?.toLowerCase()===hUe));if(!e)return!0;const t=_?.address?.toLowerCase()===hUe,n=qp(0!==J.length?J:"0"),r=t&&!Number.isNaN(parseFloat(x))?Gp(x,_?.decimals||18):jr.from("0");return n.add(r).gt(e.balance)}),[J,a,_,x,u]);QQ.useEffect((()=>{x&&_&&K(Oze(x,_.symbol,f.conversions))}),[x,_]);const ve=QQ.useCallback((e=>{const t=a.find((t=>e===d(t.token.symbol,t.token.address)));t&&(H&&e===d(H.symbol,H?.address)&&W(void 0),P(t.token),R(t.formattedBalance),M(""))}),[H]),we=QQ.useCallback((e=>{const t=r.find((t=>e===d(t.symbol,t.address)));t&&(_&&e===d(_.symbol,_?.address)&&P(void 0),W(t),G(""))}),[_]);return QQ.useEffect((()=>{X&&v&&E(Srt({swapFromToken:_,swapFromAmount:x,swapToToken:H,swapToAmount:F,conversion:v}).fromToConversion)}),[X,v]),y1(h1,{children:[y1(kae,{sx:{paddingX:"base.spacing.x4",marginBottom:"base.spacing.x2"},children:[m1(Que,{size:"small",weight:"regular",sx:{paddingBottom:"base.spacing.x4"},children:n("views.SWAP.content.title")}),y1(kae,{sx:{display:"flex",flexDirection:"column",rowGap:"base.spacing.x6",paddingBottom:"base.spacing.x2"},children:[y1(kae,{children:[m1(Que,{size:"xSmall",sx:{display:"flex",justifyContent:"space-between",paddingBottom:"base.spacing.x1"},children:n("views.SWAP.swapForm.from.label")}),m1(Vnt,{testId:"fromTokenInputs",options:ne,selectSubtext:_?`${n("views.SWAP.content.availableBalancePrefix")} ${Sze(k)}`:"",selectTextAlign:"left",textInputType:"number",textInputValue:x,textInputPlaceholder:n("views.SWAP.swapForm.from.inputPlaceholder"),textInputSubtext:`${n("views.SWAP.content.fiatPricePrefix")} \n $${Cze(q,!0)}`,textInputTextAlign:"right",textInputValidator:C1e,onTextInputChange:e=>{return t=e,de(),fe(),B(""),pe(t,!1)&&g(!0),void O(t);var t},onTextInputFocus:()=>{y(Irt.FROM)},textInputMaxButtonClick:()=>{if(!k)return;const e=k.slice(0,k.indexOf(".")+yUe+1);de(),fe(),y(Irt.FROM),B(""),pe(e,!1)&&g(!0),x===e?L(D+1):O(e),A({userJourney:cBe.SWAP,screen:"SwapCoins",control:"MaxFrom",controlType:"Button",extras:{fromBalance:k,fromBalanceTruncated:e}})},onSelectChange:ve,textInputErrorMessage:n(C),selectErrorMessage:n(N),selectedOption:_?d(_.symbol,_.address):void 0,coinSelectorHeading:n("views.SWAP.swapForm.from.selectorTitle"),defaultTokenImage:l})]}),y1(kae,{children:[y1(kae,{sx:{display:"flex",justifyContent:"space-between",paddingBottom:"base.spacing.x1"},children:[m1(Que,{size:"xSmall",children:n("views.SWAP.swapForm.to.label")}),m1(jce,{sx:{color:"base.color.brand.4"},size:"small",children:T})]}),m1(Vnt,{testId:"toTokenInputs",options:le,selectTextAlign:"left",textInputType:"number",textInputValue:F,textInputPlaceholder:n("views.SWAP.swapForm.to.inputPlaceholder"),textInputTextAlign:"right",textInputValidator:C1e,onTextInputChange:e=>{return t=e,de(),fe(),K(""),O(""),me(t,!1)&&g(!0),void B(t);var t},onTextInputFocus:()=>{y(Irt.TO)},onSelectChange:we,textInputErrorMessage:n(j),selectErrorMessage:n(V),selectedOption:H?d(H.symbol,H.address):void 0,coinSelectorHeading:n("views.SWAP.swapForm.to.selectorTitle"),defaultTokenImage:l})]})]}),m1(trt,{gasFeeFiatValue:ee,gasFeeToken:Q,gasFeeValue:J,fees:[{label:n("drawers.feesBreakdown.fees.gasFeeSwap.label"),fiatAmount:`~ ${n("drawers.feesBreakdown.fees.fiatPricePrefix")}${ee}`,amount:Sze(J),prefix:"~"}],onFeesClick:()=>{A({userJourney:cBe.SWAP,screen:"SwapCoins",control:"ViewFees",controlType:"Button"})},sx:{paddingBottom:"0"},loading:b})]}),m1(lrt,{validator:()=>{const e=function(e){return e?"":"views.SWAP.validation.noFromTokenSelected"}(_),t=function(e,t){return e&&0!==parseFloat(e)?t&&Number(e)>Number(t)?"views.SWAP.validation.insufficientBalance":"":"views.SWAP.validation.noAmountInputted"}(x,k),n=function(e){return e?"":"views.SWAP.validation.noToTokenSelected"}(H),r=(i=F)&&0!==parseFloat(i)?"":"views.SWAP.validation.noAmountInputted";var i;m===Irt.FROM?(U(""),t&&I(t)):m===Irt.TO&&(I(""),r&&U(r)),e&&M(e),n&&G(n);let a=!0;return(e||n||t&&m===Irt.FROM||r&&m===Irt.TO)&&(a=!1),A({userJourney:cBe.SWAP,screen:"SwapCoins",control:"FormValid",controlType:"Button",extras:{isSwapFormValid:a,swapFromAddress:_?.address,swapFromAmount:x,swapFromTokenSymbol:_?.symbol,swapToAddress:H?.address,swapToAmount:F,swapToTokenSymbol:H?.symbol}}),a},updateLoading:e=>{g(e)},loading:b,transaction:X,data:{fromAmount:x,toAmount:F,fromTokenSymbol:_?.symbol,fromTokenAddress:_?.address,toTokenSymbol:H?.symbol,toTokenAddress:H?.address},insufficientFundsForGas:ge,openNotEnoughImxDrawer:()=>{se(!1),ae(!0)},openNetworkSwitchDrawer:()=>ue(!0)}),m1(brt,{environment:c?.config.environment??qt.PRODUCTION,visible:ie,showAdjustAmount:_?.address===hUe,hasZeroImx:!1,onAddCoinsClick:()=>{h({payload:{type:aze.UPDATE_VIEW,view:{type:rze.TOP_UP_VIEW},currentViewData:{fromTokenAddress:_?.address??"",fromAmount:x,toTokenAddress:H?.address??""}}})},onCloseDrawer:()=>ae(!1)}),m1(xrt,{visible:oe,onCloseDrawer:()=>{se(!1),P(void 0),O(""),W(void 0),B("")}}),m1(xnt,{visible:ce,targetChainId:MUe(c?.config),provider:u,checkout:c,onCloseDrawer:()=>ue(!1)})]})}const Rrt=(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 Nrt({theme:e,fromAmount:t,toAmount:n,fromTokenAddress:r,toTokenAddress:i}){const{t:a}=uUe(),{viewDispatch:o}=QQ.useContext(oze),{eventTargetState:{eventTarget:s}}=QQ.useContext(g1e),{swapState:{tokenBalances:c}}=QQ.useContext(Int),{connectLoaderState:{checkout:u,provider:l}}=QQ.useContext(Tze),[d,f]=QQ.useState(!1),{page:p}=yBe();return QQ.useEffect((()=>{p({userJourney:cBe.SWAP,screen:"SwapCoins",extras:{fromAmount:t,toAmount:n,fromTokenAddress:r,toTokenAddress:i}})}),[]),QQ.useEffect((()=>{console.log("tokenBalances",c,"isPassportProvider",qze(l),l),Rrt(c,gUe)&&!qze(l)&&f(!0)}),[c]),m1(vBe,{header:m1(cze,{title:a("views.SWAP.header.title"),onCloseButtonClick:()=>k1e(s)}),footer:m1(Ant,{environment:u?.config.environment,theme:e}),children:y1(kae,{sx:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[m1(krt,{data:{fromAmount:t,toAmount:n,fromTokenAddress:r,toTokenAddress:i},theme:e}),m1(brt,{environment:u?.config.environment??qt.PRODUCTION,visible:d,showAdjustAmount:!1,hasZeroImx:!0,onAddCoinsClick:()=>{o({payload:{type:aze.UPDATE_VIEW,view:{type:rze.TOP_UP_VIEW}}})},onCloseDrawer:()=>{f(!1)}})]})})}class Mrt{baseConfig;constructor({baseConfig:e}){this.baseConfig=e}}const Drt={[qt.SANDBOX]:"https://checkout-api.sandbox.immutable.com",[qt.PRODUCTION]:"https://checkout-api.immutable.com"};class Lrt{coinsCache;overridesCache;config;constructor(e){this.coinsCache=null,this.overridesCache=null,this.config=e.baseConfig}urlWithPath(e){return Drt[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 Frt=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,fiatSymbol:t}),t)}catch(e){return new Map}},Brt=["ETH","IMX"];function jrt({environment:e,children:t}){const[n,r]=QQ.useReducer(Nnt,Pnt),{cryptoFiat:i,fiatSymbol:a,tokenSymbols:o}=n;return QQ.useEffect((()=>{r({payload:{type:knt.SET_CRYPTO_FIAT,cryptoFiat:new Lrt(new Mrt({baseConfig:{environment:e}}))}})}),[]),QQ.useEffect((()=>{i&&a&&(async()=>{const e=await Frt(i,a,[...new Set([...o,...Brt])]);r({payload:{type:knt.SET_CONVERSIONS,conversions:e}})})()}),[i,o,a]),m1(Rnt.Provider,{value:{cryptoFiatState:n,cryptoFiatDispatch:r},children:t})}function Urt({transactionResponse:e,swapForm:t}){const{t:n}=uUe(),{viewDispatch:r}=QQ.useContext(oze),{page:i}=yBe();return QQ.useEffect((()=>{i({userJourney:cBe.SWAP,screen:"SwapInProgress",extras:{swapFormInfo:t}})}),[]),QQ.useEffect((()=>{(async()=>{try{const n=await e.wait();if(1===n.status)return void r({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.SUCCESS,data:{fromTokenAddress:t.fromTokenAddress,fromAmount:t.fromAmount,toTokenAddress:t.toTokenAddress,toAmount:t.toAmount||"",transactionHash:n.transactionHash}}}});r({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.FAIL,data:t,reason:"Transaction failed"}}})}catch{r({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.FAIL,data:t,reason:"Transaction failed"}}})}})()}),[e]),m1(wBe,{loadingText:n("views.SWAP.IN_PROGRESS.loading.text")})}function zrt(){return m1(kae,{sx:{...dze,background:"base.color.translucent.emphasis.100"},children:m1(kae,{sx:{...uze,...lze},children:y1("svg",{width:"430",height:"305",viewBox:"0 0 430 305",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[m1("path",{d:"M94.0614 105.632L93.6321 104L92 104.429L92.4292 106.061L94.0614 105.632Z",fill:"white"}),m1("path",{d:"M63.6531 193.101L63.1006 191L60.9996 191.553L61.5521 193.654L63.6531 193.101Z",fill:"white"}),m1("path",{d:"M344.489 224.345L342.345 224L342 226.145L344.144 226.49L344.489 224.345Z",fill:"white"}),m1("path",{d:"M372.286 139.905L372.905 138.619L371.619 138L371 139.286L372.286 139.905Z",fill:"white"}),m1("path",{d:"M341.653 78.101L341.101 76L339 76.5525L339.552 78.6535L341.653 78.101Z",fill:"white"}),m1("path",{d:"M359.286 242.905L359.905 241.619L358.619 241L358 242.286L359.286 242.905Z",fill:"white"}),m1("path",{d:"M87.0123 112.087L86.0869 111L85.0002 111.925L85.9256 113.012L87.0123 112.087Z",fill:"white"}),m1("path",{d:"M84.2862 248.905L84.9053 247.619L83.6192 247L83.0001 248.286L84.2862 248.905Z",fill:"white"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M206.398 211.015C211.246 210.028 215.255 208.497 217.905 206.625",stroke:"#A66CFF",strokeLinecap:"round",strokeLinejoin:"round"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M206.398 203.291C211.246 202.304 215.255 200.774 217.905 198.901",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M206.398 195.569C211.246 194.582 215.255 193.052 217.905 191.179",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M251.375 219.437C256.223 218.45 260.232 216.919 262.882 215.047",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M251.375 211.713C256.223 210.726 260.232 209.195 262.882 207.323",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M251.375 203.99C256.223 203.004 260.232 201.473 262.882 199.601",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M245.426 196.182C250.274 195.195 254.283 193.664 256.932 191.792",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M253.763 186.525C258.612 185.538 262.621 184.007 265.27 182.135",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M202.685 230.306C207.533 229.32 211.542 227.789 214.191 225.917",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),m1("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 Hrt(){return m1(kae,{testId:"wallet-approve-hero",sx:{...dze,background:"base.color.translucent.emphasis.100"},children:m1(kae,{sx:{...uze,...lze},children:y1("svg",{width:"430",height:"305",viewBox:"0 0 430 305",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M159.384 154.519L155.93 147.991L158.939 141.463L162.388 147.991L159.384 154.519Z",fill:"#F191FA"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M232.923 169.903L235.354 164.731",stroke:"black",strokeWidth:"0.469297",strokeMiterlimit:"10"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M273.579 230.377L277.263 229.767L287.024 238.458L278.347 222.051L270.373 223.609L273.579 230.377Z",fill:"black"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M208.107 253.158L205.685 248.573",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),m1("path",{d:"M191.634 240.96H185.758",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),m1("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"}),m1("path",{d:"M356.061 232.632L355.632 231L354 231.429L354.429 233.061L356.061 232.632Z",fill:"white"}),m1("path",{d:"M57.6531 168.341L57.1006 166.24L54.9996 166.793L55.5521 168.894L57.6531 168.341Z",fill:"white"}),m1("path",{d:"M103.489 244.345L101.345 244L101 246.145L103.144 246.49L103.489 244.345Z",fill:"white"}),m1("path",{d:"M341.286 111.905L341.905 110.619L340.619 110L340 111.286L341.286 111.905Z",fill:"white"}),m1("path",{d:"M323.144 179.08L322.592 176.979L320.491 177.531L321.043 179.632L323.144 179.08Z",fill:"white"}),m1("path",{d:"M328.919 177.658L329.538 176.372L328.252 175.753L327.633 177.039L328.919 177.658Z",fill:"white"}),m1("path",{d:"M88.1441 141.383L87.2188 140.296L86.1321 141.221L87.0574 142.308L88.1441 141.383Z",fill:"white"}),m1("path",{d:"M258.286 89.9052L258.905 88.6191L257.619 88L257 89.2861L258.286 89.9052Z",fill:"white"})]})})})}function Wrt({data:e}){const{t:t}=uUe(),{swapState:{allowedTokens:n}}=QQ.useContext(Int),{connectLoaderState:r}=QQ.useContext(Tze),{checkout:i,provider:a}=r,{viewDispatch:o}=QQ.useContext(oze),{eventTargetState:{eventTarget:s}}=QQ.useContext(g1e),c=qze(a),[u,l]=QQ.useState(!1),[d,f]=QQ.useState(!1),[p,h]=QQ.useState(!1),[m,y]=QQ.useState(!1),[b,g]=QQ.useState(!1),[v,w]=QQ.useState(!1),{page:T,track:E}=yBe();QQ.useEffect((()=>{T({userJourney:cBe.SWAP,screen:"ApproveERC20",extras:{swapFormInfo:e.swapFormInfo}})}),[]);const A=QQ.useMemo((()=>n.find((t=>t.address===e.swapFormInfo.fromTokenAddress))),[n,e.swapFormInfo.fromTokenAddress]),x=QQ.useCallback((()=>{o({payload:{type:aze.UPDATE_VIEW,view:{type:rze.ERROR_VIEW,error:new Error("No checkout object or no provider object found")}}})}),[o]),O=QQ.useCallback((()=>{o({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.SWAP,data:e.swapFormInfo}}})}),[o]),C=(e,t)=>{e.type!==QZ.UNPREDICTABLE_GAS_LIMIT?e.type===QZ.TRANSACTION_FAILED||e.type===QZ.INSUFFICIENT_FUNDS||e.receipt&&0===e.receipt.status?o({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.FAIL,reason:"Transaction failed",data:t}}}):(console.error("Approve ERC20 failed",e),o({payload:{type:aze.UPDATE_VIEW,view:{type:rze.ERROR_VIEW,error:e}}})):o({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.PRICE_SURGE,data:t}}})},I=(e,t=!1)=>({...e,gasPrice:t?jr.from(0):void 0}),S=QQ.useCallback((async()=>{if(!m)if(E({userJourney:cBe.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:aze.UPDATE_VIEW,view:{type:nrt.FAIL,data:e.swapFormInfo}}});f(!1),l(!1),h(!0)}catch(t){if(f(!1),l(!1),t.type===QZ.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]),_=QQ.useMemo((()=>y1(yze,{heading:t(`views.APPROVE_ERC20.approveSpending.content.${c?"passport":"metamask"}.heading`),children:[c&&m1(kae,{children:t("views.APPROVE_ERC20.approveSpending.content.passport.body")}),!c&&m1(kae,{children:t("views.APPROVE_ERC20.approveSpending.content.metamask.body",{amount:`${e.swapFormInfo.fromAmount} ${A?.symbol||""}`})})]})),[e.swapFormInfo,A,c]),P=QQ.useMemo((()=>m1(eze,{loading:m,actionText:t(b?"views.APPROVE_ERC20.approveSpending.footer.retryText":"views.APPROVE_ERC20.approveSpending.footer.buttonText"),onActionClick:S})),[b,S,m]),k=QQ.useCallback((async()=>{if(!m)if(E({userJourney:cBe.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:aze.UPDATE_VIEW,view:{type:nrt.IN_PROGRESS,data:{transactionResponse:t.transactionResponse,swapForm:e.swapFormInfo}}}})}catch(t){if(l(!1),t.type===QZ.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=m1(yze,{heading:t("views.APPROVE_ERC20.approveSwap.content.heading"),children:m1(kae,{children:t("views.APPROVE_ERC20.approveSwap.content.body")})}),N=QQ.useMemo((()=>m1(eze,{loading:m,actionText:t(v?"views.APPROVE_ERC20.approveSwap.footer.retryText":"views.APPROVE_ERC20.approveSwap.footer.buttonText"),onActionClick:k})),[v,k,m]);return y1(h1,{children:[d&&m1(wBe,{loadingText:t("views.APPROVE_ERC20.approveSpending.loading.text")}),!d&&m1(vBe,{header:m1(cze,{transparent:!0,showBack:!0,onCloseButtonClick:()=>k1e(s),onBackButtonClick:O}),floatHeader:!0,heroContent:m1(p?Hrt:zrt,{}),footer:p?N:P,children:p?R:_})]})}var Vrt;!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"}(Vrt||(Vrt={}));const Grt=e=>{const{minPercentage:t,maxPercentage:n}=e;return void 0===t||void 0===n?"-.--":`${t}% to ${n}`},qrt=(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=Vp(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 Krt;function Xrt({testId:e,icon:t,heading:n,caption:r,onClick:i,renderFeeFunction:a,isDisabled:o}){return m1(kae,{testId:"top-up-view",sx:{paddingY:"1px"},children:y1(nhe,{testId:`menu-item-${e}`,size:"medium",emphasized:!0,onClick:o?void 0:i,sx:o?{opacity:"0.5",cursor:"not-allowed"}:{},children:[m1(nhe.Icon,{icon:t}),m1(nhe.Label,{size:"medium",children:n}),m1(nhe.IntentIcon,{}),y1(nhe.Caption,{testId:`menu-item-caption-${e}`,children:[r,m1("br",{}),o?"":a("-.--",!1)]})]})})}!function(e){e.ONRAMP="ONRAMP",e.IN_PROGRESS_LOADING="IN_PROGRESS_LOADING",e.IN_PROGRESS="IN_PROGRESS",e.SUCCESS="SUCCESS",e.FAIL="FAIL"}(Krt||(Krt={}));const Yrt={[qt.SANDBOX]:"https://checkout-playground.sandbox.immutable.com",[qt.PRODUCTION]:"https://toolkit.immutable.com"};function Jrt({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}=uUe(),{userJourney:h}=c,{viewDispatch:m}=QQ.useContext(oze),{cryptoFiatState:y,cryptoFiatDispatch:b}=QQ.useContext(Rnt),{conversions:g,fiatSymbol:v}=y,w=t?.config.environment??qt.SANDBOX,{eventTargetState:{eventTarget:T}}=QQ.useContext(g1e),[E,A]=QQ.useState("-.--"),[x,O]=QQ.useState("-.--"),[C,I]=QQ.useState(!0),S=d?p(...d):p("views.TOP_UP_VIEW.header.title"),_=f?p(...f):null,{page:P,track:k}=yBe();QQ.useEffect((()=>{P({userJourney:h,screen:"TopUp"})}),[]),QQ.useEffect((()=>{b&&b({payload:{type:knt.SET_TOKEN_SYMBOLS,tokenSymbols:Brt}})}),[b]),QQ.useEffect((()=>{t&&(async()=>{const e=await t.gasEstimate({gasEstimateType:FZ.BRIDGE_TO_L2}),n=await qrt(e,g);O(n)})()}),[void 0!==t]),QQ.useEffect((()=>{t&&(async()=>{const e=await t.getExchangeFeeEstimate(),n=Grt(e);A(n)})()}),[void 0!==t]),QQ.useEffect((()=>{t&&(async()=>{I(await t.isSwapAvailable())})()}),[void 0!==t]);const R=(e,t,n="Button")=>{k({userJourney:h,screen:"TopUp",control:e,controlType:n,extras:t})},N=e=>m1(kae,{sx:{fontSize:"base.text.caption.small.regular.fontSize",c:"base.color.translucent.standard.600"},children:e}),M=[{testId:"onramp",icon:"BankCard",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.onramp",onClickEvent:()=>{if(e===wZ.IMTBL_ONRAMP_WIDGET_EVENT){const t={tokenAddress:"",amount:""};return m({payload:{type:aze.UPDATE_VIEW,view:{type:Krt.ONRAMP,data:t}}}),void R("OnRamp",{...t,widgetEvent:e})}const t={tokenAddress:o??"",amount:s??""};P1e.sendRequestOnrampEvent(T,e,t),R("OnRamp",{...t,widgetEvent:e})},fee:()=>N(`${p("views.TOP_UP_VIEW.topUpOptions.onramp.subcaption")} ≈ ${E}%`),isAvailable:!0,isEnabled:r},{testId:"swap",icon:"Swap",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.swap",onClickEvent:()=>{if(e===wZ.IMTBL_SWAP_WIDGET_EVENT){const t={toTokenAddress:"",fromAmount:"",fromTokenAddress:""};return m({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.SWAP,data:t}}}),void R("Swap",{...t,widgetEvent:e})}const t={fromTokenAddress:"",toTokenAddress:o??"",amount:""};P1e.sendRequestSwapEvent(T,e,t),R("Swap",{...t,widgetEvent:e})},fee:()=>N(`${p("views.TOP_UP_VIEW.topUpOptions.swap.subcaption")} ≈ $0.05 ${v.toUpperCase()}`),isAvailable:C,isEnabled:i},{testId:"bridge",icon:"Minting",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.bridge",onClickEvent:()=>{if(e===wZ.IMTBL_BRIDGE_WIDGET_EVENT){const t={fromTokenAddress:"",fromAmount:""};return m({payload:{type:aze.UPDATE_VIEW,view:{type:Vrt.WALLET_NETWORK_SELECTION,data:t}}}),void R("Bridge",{...t,widgetEvent:e})}const t={tokenAddress:"",amount:""};P1e.sendRequestBridgeEvent(T,e,t),R("Bridge",{...t,widgetEvent:e})},fee:()=>N(`${p("views.TOP_UP_VIEW.topUpOptions.bridge.subcaption")} ≈ $${x} ${v.toUpperCase()}`),isAvailable:!0,isEnabled:a},{testId:"advanced",icon:"JumpTo",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.advanced",onClickEvent:()=>{const t=Yrt[w];R("AdvancedOptions",{...{tokenAddress:o??"",amount:s??""},widgetEvent:e}),window.open(`${t}/faster-bridge/`,"_blank")},fee:()=>N(""),isAvailable:!0,isEnabled:!0}];return m1(vBe,{header:m1(cze,{onBackButtonClick:l,onCloseButtonClick:u,showBack:!0}),footer:m1(Uze,{}),children:y1(kae,{sx:{paddingX:"base.spacing.x4",paddingY:"base.spacing.x4"},children:[m1(Que,{size:"small",children:S}),_&&m1(jce,{size:"small",sx:{color:"base.color.text.body.secondary"},children:_}),m1(kae,{sx:{paddingY:"base.spacing.x4"},children:M.sort(((e,t)=>Number(t.isAvailable)-Number(e.isAvailable))).map((e=>e.isEnabled&&m1(Xrt,{testId:e.testId,icon:e.icon,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 Zrt=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),Zrt(e,{retries:a,retryIntervalMs:n,nonRetryable:r,nonRetryableSilently:i})}},Qrt=async({checkout:e,provider:t,allowTokenListType:n,chainId:r,allowZero:i=!1,retryPolicy:a=TUe})=>{const o=r||(await e.getNetworkInfo({provider:t})).chainId,s=await t.getSigner().getAddress(),c=await Zrt((()=>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()||hUe,!0)));const d=c.balances.filter((e=>!(e.balance.lte(0)&&!i)&&l.get(e.token.address?.toLowerCase()||hUe))).map((t=>({...t,token:{...t.token,icon:Nze(e.config.environment,kze(t.token.address)?t.token.symbol:t.token.address??"")}})))??[];return u.tokens=u.tokens.map((t=>({...t,icon:Nze(e.config.environment,kze(t.address)?t.symbol:t.address??"")}))),{allowList:u,allowedBalances:d}};function $rt({amount:e,fromTokenAddress:t,toTokenAddress:n,config:r}){const{t:i}=uUe(),{eventTargetState:{eventTarget:a}}=QQ.useContext(g1e),{environment:o,theme:s,isOnRampEnabled:c,isSwapEnabled:u,isBridgeEnabled:l}=r,{connectLoaderState:{checkout:d,provider:f}}=QQ.useContext(Tze),[p,h]=QQ.useReducer(sze,{...ize,history:[]}),[m,y]=QQ.useReducer(Snt,Ont),{page:b}=yBe(),[g,v]=QQ.useState(!1),w=QQ.useMemo((()=>({swapState:m,swapDispatch:y})),[m,y]),T=QQ.useMemo((()=>({viewState:p,viewDispatch:h})),[p,h]),E=QQ.useCallback(((e,t)=>{h({payload:{type:aze.UPDATE_VIEW,view:{type:rze.ERROR_VIEW,tryAgain:t,error:e}}})}),[h]),A=QQ.useCallback((()=>{h({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.SWAP}}})}),[h]),x=QQ.useCallback((async()=>{if(!d)throw new Error("loadBalances: missing checkout");if(!f)throw new Error("loadBalances: missing provider");try{const e=await Qrt({checkout:d,provider:f,allowTokenListType:jZ.SWAP});if(void 0===e)return!1;y({payload:{type:Cnt.SET_ALLOWED_TOKENS,allowedTokens:e.allowList.tokens}}),y({payload:{type:Cnt.SET_TOKEN_BALANCES,tokenBalances:e.allowedBalances}})}catch(e){if(TUe.nonRetryable(e))return E(e,x),!1}return!0}),[d,f]);return QQ.useEffect((()=>{(async()=>{if(!d||!f)return;const e=await d.getNetworkInfo({provider:f});if(e.chainId!==MUe(d.config))return;let t;try{t=await d.config.remote.getConfig("dex")}catch(e){return void E(e)}const n=new fD({chainId:e.chainId,baseConfig:new Xt({environment:o}),secondaryFees:t.secondaryFees,overrides:t.overrides});y({payload:{type:Cnt.SET_EXCHANGE,exchange:n}}),y({payload:{type:Cnt.SET_NETWORK,network:e}}),await x()&&p.view.type===rze.LOADING_VIEW&&A()})()}),[d,f]),m1(oze.Provider,{value:T,children:m1(Int.Provider,{value:w,children:y1(jrt,{environment:o,children:[p.view.type===rze.LOADING_VIEW&&m1(wBe,{loadingText:i("views.LOADING_VIEW.text")}),p.view.type===nrt.SWAP&&m1(Nrt,{theme:s,fromAmount:p.view.data?.fromAmount??e,fromTokenAddress:p.view.data?.fromTokenAddress??t,toTokenAddress:p.view.data?.toTokenAddress??n}),p.view.type===nrt.IN_PROGRESS&&m1(Urt,{transactionResponse:p.view.data.transactionResponse,swapForm:p.view.data.swapForm}),p.view.type===nrt.APPROVE_ERC20&&m1(Wrt,{data:p.view.data}),p.view.type===nrt.SUCCESS&&m1(p1e,{statusText:i("views.SWAP.success.text"),actionText:i("views.SWAP.success.actionText"),onRenderEvent:()=>{b({userJourney:cBe.SWAP,screen:"SwapSuccess",extras:{fromTokenAddress:p.view.data?.fromTokenAddress,fromAmount:p.view.data?.fromAmount,toTokenAddress:p.view.data?.toTokenAddress,toAmount:p.view.data?.toAmount}}),R1e(a,p.view.data.transactionHash)},onActionClick:()=>k1e(a),statusType:a1e.SUCCESS,testId:"success-view"}),p.view.type===nrt.FAIL&&m1(p1e,{statusText:i("views.SWAP.failed.text"),actionText:i("views.SWAP.failed.actionText"),onRenderEvent:()=>{b({userJourney:cBe.SWAP,screen:"SwapFailed"}),N1e(a,"Transaction failed")},onActionClick:()=>{p.view.type===nrt.FAIL&&h({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.SWAP,data:p.view.data}}})},statusType:a1e.FAILURE,onCloseClick:()=>k1e(a),testId:"fail-view"}),p.view.type===nrt.PRICE_SURGE&&m1(p1e,{statusText:i("views.SWAP.rejected.text"),actionText:i("views.SWAP.rejected.actionText"),onRenderEvent:()=>{b({userJourney:cBe.SWAP,screen:"PriceSurge"}),M1e(a,"Price surge")},onActionClick:()=>{p.view.type===nrt.PRICE_SURGE&&h({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.SWAP,data:p.view.data}}})},statusType:a1e.WARNING,onCloseClick:()=>k1e(a),testId:"price-surge-view"}),p.view.type===rze.ERROR_VIEW&&m1(bze,{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:()=>k1e(a),errorEventActionLoading:g}),p.view.type===rze.TOP_UP_VIEW&&m1(Jrt,{analytics:{userJourney:cBe.SWAP},checkout:d,provider:f,widgetEvent:wZ.IMTBL_SWAP_WIDGET_EVENT,showOnrampOption:c,showSwapOption:u,showBridgeOption:l,onCloseButtonClick:()=>k1e(a)})]})})})}var eit=Object.freeze({__proto__:null,default:$rt}),tit=2147483647,nit=36,rit=1,iit=26,ait=38,oit=700,sit=72,cit=128,uit="-",lit=/[^\x20-\x7E]/,dit=/[\x2E\u3002\uFF0E\uFF61]/g,fit={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},pit=nit-rit,hit=Math.floor,mit=String.fromCharCode;
|
|
931
|
+
*/const H4e=e=>null!=e?e:i3e;var W4e={},V4e={},G4e={};let q4e;const K4e=[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];G4e.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},G4e.getSymbolTotalCodewords=function(e){return K4e[e]},G4e.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},G4e.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');q4e=e},G4e.isKanjiModeEnabled=function(){return void 0!==q4e},G4e.toSJIS=function(e){return q4e(e)};var X4e={};function Y4e(){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}}}(X4e),Y4e.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 J4e=Y4e;function Z4e(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)}Z4e.prototype.set=function(e,t,n,r){const i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},Z4e.prototype.get=function(e,t){return this.data[e*this.size+t]},Z4e.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},Z4e.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var Q4e=Z4e,$4e={};!function(e){const t=G4e.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}}($4e);var e9e={};const t9e=G4e.getSymbolSize;e9e.getPositions=function(e){const t=t9e(e);return[[0,0],[t-7,0],[0,t-7]]};var n9e={};!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}}(n9e);var r9e={};const i9e=X4e,a9e=[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],o9e=[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];r9e.getBlocksCount=function(e,t){switch(t){case i9e.L:return a9e[4*(e-1)+0];case i9e.M:return a9e[4*(e-1)+1];case i9e.Q:return a9e[4*(e-1)+2];case i9e.H:return a9e[4*(e-1)+3];default:return}},r9e.getTotalCodewordsCount=function(e,t){switch(t){case i9e.L:return o9e[4*(e-1)+0];case i9e.M:return o9e[4*(e-1)+1];case i9e.Q:return o9e[4*(e-1)+2];case i9e.H:return o9e[4*(e-1)+3];default:return}};var s9e={},c9e={};const u9e=new Uint8Array(512),l9e=new Uint8Array(256);!function(){let e=1;for(let t=0;t<255;t++)u9e[t]=e,l9e[e]=t,e<<=1,256&e&&(e^=285);for(let e=255;e<512;e++)u9e[e]=u9e[e-255]}(),c9e.log=function(e){if(e<1)throw new Error("log("+e+")");return l9e[e]},c9e.exp=function(e){return u9e[e]},c9e.mul=function(e,t){return 0===e||0===t?0:u9e[l9e[e]+l9e[t]]},function(e){const t=c9e;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}}(s9e);const d9e=s9e;function f9e(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}f9e.prototype.initialize=function(e){this.degree=e,this.genPoly=d9e.generateECPolynomial(this.degree)},f9e.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=d9e.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 p9e=f9e,h9e={},m9e={},y9e={isValid:function(e){return!isNaN(e)&&e>=1&&e<=40}},b9e={};const g9e="[0-9]+";let v9e="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";v9e=v9e.replace(/u/g,"\\u");const w9e="(?:(?![A-Z0-9 $%*+\\-./:]|"+v9e+")(?:.|[\r\n]))+";b9e.KANJI=new RegExp(v9e,"g"),b9e.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),b9e.BYTE=new RegExp(w9e,"g"),b9e.NUMERIC=new RegExp(g9e,"g"),b9e.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const T9e=new RegExp("^"+v9e+"$"),E9e=new RegExp("^"+g9e+"$"),A9e=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");b9e.testKanji=function(e){return T9e.test(e)},b9e.testNumeric=function(e){return E9e.test(e)},b9e.testAlphanumeric=function(e){return A9e.test(e)},function(e){const t=y9e,n=b9e;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}}}(m9e),function(e){const t=G4e,n=r9e,r=X4e,i=m9e,a=y9e,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}}(h9e);var x9e={};const O9e=G4e,C9e=O9e.getBCHDigit(1335);x9e.getEncodedBits=function(e,t){const n=e.bit<<3|t;let r=n<<10;for(;O9e.getBCHDigit(r)-C9e>=0;)r^=1335<<O9e.getBCHDigit(r)-C9e;return 21522^(n<<10|r)};var I9e={};const S9e=m9e;function _9e(e){this.mode=S9e.NUMERIC,this.data=e.toString()}_9e.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},_9e.prototype.getLength=function(){return this.data.length},_9e.prototype.getBitsLength=function(){return _9e.getBitsLength(this.data.length)},_9e.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 P9e=_9e;const k9e=m9e,R9e=["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 N9e(e){this.mode=k9e.ALPHANUMERIC,this.data=e}N9e.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},N9e.prototype.getLength=function(){return this.data.length},N9e.prototype.getBitsLength=function(){return N9e.getBitsLength(this.data.length)},N9e.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=45*R9e.indexOf(this.data[t]);n+=R9e.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(R9e.indexOf(this.data[t]),6)};var M9e=N9e;const D9e=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},L9e=m9e;function F9e(e){this.mode=L9e.BYTE,"string"==typeof e&&(e=D9e(e)),this.data=new Uint8Array(e)}F9e.getBitsLength=function(e){return 8*e},F9e.prototype.getLength=function(){return this.data.length},F9e.prototype.getBitsLength=function(){return F9e.getBitsLength(this.data.length)},F9e.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)};var B9e=F9e;const j9e=m9e,U9e=G4e;function z9e(e){this.mode=j9e.KANJI,this.data=e}z9e.getBitsLength=function(e){return 13*e},z9e.prototype.getLength=function(){return this.data.length},z9e.prototype.getBitsLength=function(){return z9e.getBitsLength(this.data.length)},z9e.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=U9e.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 H9e=z9e,W9e={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}(W9e);var V9e=W9e.exports;!function(e){const t=m9e,n=P9e,r=M9e,i=B9e,a=H9e,o=b9e,s=G4e,c=V9e;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()))}}(I9e);const G9e=G4e,q9e=X4e,K9e=J4e,X9e=Q4e,Y9e=$4e,J9e=e9e,Z9e=n9e,Q9e=r9e,$9e=p9e,e7e=h9e,t7e=x9e,n7e=m9e,r7e=I9e;function i7e(e,t,n){const r=e.size,i=t7e.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 a7e(e,t,n){const r=new K9e;n.forEach((function(t){r.put(t.mode.bit,4),r.put(t.getLength(),n7e.getCharCountIndicator(t.mode,e)),t.write(r)}));const i=8*(G9e.getSymbolTotalCodewords(e)-Q9e.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=G9e.getSymbolTotalCodewords(t),i=Q9e.getTotalCodewordsCount(t,n),a=r-i,o=Q9e.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 $9e(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 o7e(e,t,n,r){let i;if(Array.isArray(e))i=r7e.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");{let r=t;if(!r){const t=r7e.rawSplit(e);r=e7e.getBestVersionForData(t,n)}i=r7e.fromString(e,r||40)}}const a=e7e.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=a7e(t,n,i),s=G9e.getSymbolSize(t),c=new X9e(s);return function(e,t){const n=e.size,r=J9e.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=Y9e.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),i7e(c,n,0),t>=7&&function(e,t){const n=e.size,r=e7e.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=Z9e.getBestMask(c,i7e.bind(null,c,n))),Z9e.applyMask(r,c),i7e(c,n,r),{modules:c,version:t,errorCorrectionLevel:n,maskPattern:r,segments:i}}V4e.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");let n,r,i=q9e.M;return void 0!==t&&(i=q9e.from(t.errorCorrectionLevel,q9e.M),n=e7e.from(t.version),r=Z9e.from(t.maskPattern),t.toSJISFunc&&G9e.setToSJISFunction(t.toSJISFunc)),o7e(e,n,i,r)};var s7e={},c7e={};!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}}}(c7e),function(e){const t=c7e;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)}}(s7e);var u7e={};const l7e=c7e;function d7e(e,t){const n=e.a/255,r=t+'="'+e.hex+'"';return n<1?r+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function f7e(e,t,n){let r=e+t;return void 0!==n&&(r+=" "+n),r}u7e.render=function(e,t,n){const r=l7e.getOptions(t),i=e.modules.size,a=e.modules.data,o=i+2*r.margin,s=r.color.light.a?"<path "+d7e(r.color.light,"fill")+' d="M0 0h'+o+"v"+o+'H0z"/>':"",c="<path "+d7e(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?f7e("M",c+n,.5+u+n):f7e("m",i,0),i=0,a=!1),c+1<t&&e[s+1]||(r+=f7e("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 p7e=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},h7e=V4e,m7e=s7e,y7e=u7e;function b7e(e,t,n,r,i){const a=[].slice.call(arguments,1),o=a.length,s="function"==typeof a[o-1];if(!s&&!p7e())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=h7e.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=h7e.create(n,r);i(null,e(a,t,r))}catch(e){i(e)}}W4e.create=h7e.create,W4e.toCanvas=b7e.bind(null,m7e.render),W4e.toDataURL=b7e.bind(null,m7e.renderToDataURL),W4e.toString=b7e.bind(null,(function(e,t,n){return y7e.render(e,n)}));var g7e=Object.defineProperty,v7e=Object.getOwnPropertySymbols,w7e=Object.prototype.hasOwnProperty,T7e=Object.prototype.propertyIsEnumerable,E7e=(e,t,n)=>t in e?g7e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,A7e=(e,t)=>{for(var n in t||(t={}))w7e.call(t,n)&&E7e(e,n,t[n]);if(v7e)for(var n of v7e(t))T7e.call(t,n)&&E7e(e,n,t[n]);return e};const x7e={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}=GHe.state;if(e){const n=A7e(A7e(A7e({},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=GHe.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:E8e`*,::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)}`},O7e=E8e`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 C7e=Object.defineProperty,I7e=Object.getOwnPropertyDescriptor,S7e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?I7e(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&&C7e(t,n,a),a};let _7e=class extends E3e{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"),t3e`<button class="${R3e(e)}" ?disabled="${this.disabled}" @click="${this.onClick}">${this.iconLeft}<wcm-text variant="small-regular" color="${t}"><slot></slot></wcm-text>${this.iconRight}</button>`}};_7e.styles=[x7e.globalCss,O7e],S7e([I3e({type:Boolean})],_7e.prototype,"disabled",2),S7e([I3e()],_7e.prototype,"iconLeft",2),S7e([I3e()],_7e.prototype,"iconRight",2),S7e([I3e()],_7e.prototype,"onClick",2),S7e([I3e()],_7e.prototype,"variant",2),_7e=S7e([x3e("wcm-button")],_7e);const P7e=E8e`: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 k7e=Object.defineProperty,R7e=Object.getOwnPropertyDescriptor,N7e=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?R7e(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&&k7e(t,n,a),a};let M7e=class extends E3e{constructor(){super(...arguments),this.disabled=!1,this.variant="primary"}render(){const e={"wcm-secondary":"secondary"===this.variant};return t3e`<button ?disabled="${this.disabled}" class="${R3e(e)}"><slot></slot></button>`}};M7e.styles=[x7e.globalCss,P7e],N7e([I3e({type:Boolean})],M7e.prototype,"disabled",2),N7e([I3e()],M7e.prototype,"variant",2),M7e=N7e([x3e("wcm-button-big")],M7e);const D7e=E8e`: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 L7e=Object.defineProperty,F7e=Object.getOwnPropertyDescriptor;let B7e=class extends E3e{render(){return t3e`<div><slot></slot></div>`}};B7e.styles=[x7e.globalCss,D7e],B7e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?F7e(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&&L7e(t,n,a),a})([x3e("wcm-info-footer")],B7e);const j7e={CROSS_ICON:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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:n3e`<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>`},U7e=E8e`.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 z7e=Object.defineProperty,H7e=Object.getOwnPropertyDescriptor;let W7e=class extends E3e{render(){return t3e`<div class="wcm-toolbar-placeholder"></div><div class="wcm-toolbar">${j7e.WALLET_CONNECT_LOGO} <button @click="${BHe.close}">${j7e.CROSS_ICON}</button></div>`}};W7e.styles=[x7e.globalCss,U7e],W7e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?H7e(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&&z7e(t,n,a),a})([x3e("wcm-modal-backcard")],W7e);const V7e=E8e`main{padding:20px;padding-top:0;width:100%}`;var G7e=Object.defineProperty,q7e=Object.getOwnPropertyDescriptor;let K7e=class extends E3e{render(){return t3e`<main><slot></slot></main>`}};K7e.styles=[x7e.globalCss,V7e],K7e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?q7e(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&&G7e(t,n,a),a})([x3e("wcm-modal-content")],K7e);const X7e=E8e`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;var Y7e=Object.defineProperty,J7e=Object.getOwnPropertyDescriptor;let Z7e=class extends E3e{render(){return t3e`<footer><slot></slot></footer>`}};Z7e.styles=[x7e.globalCss,X7e],Z7e=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?J7e(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&&Y7e(t,n,a),a})([x3e("wcm-modal-footer")],Z7e);const Q7e=E8e`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 $7e=Object.defineProperty,eet=Object.getOwnPropertyDescriptor,tet=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?eet(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&&$7e(t,n,a),a};let net=class extends E3e{constructor(){super(...arguments),this.title="",this.onAction=void 0,this.actionIcon=void 0,this.border=!1}backBtnTemplate(){return t3e`<button class="wcm-back-btn" @click="${dHe.goBack}">${j7e.BACK_ICON}</button>`}actionBtnTemplate(){return t3e`<button class="wcm-action-btn" @click="${this.onAction}">${this.actionIcon}</button>`}render(){const e={"wcm-border":this.border},t=dHe.state.history.length>1,n=this.title?t3e`<wcm-text variant="big-bold">${this.title}</wcm-text>`:t3e`<slot></slot>`;return t3e`<header class="${R3e(e)}">${t?this.backBtnTemplate():null} ${n} ${this.onAction?this.actionBtnTemplate():null}</header>`}};net.styles=[x7e.globalCss,Q7e],tet([I3e()],net.prototype,"title",2),tet([I3e()],net.prototype,"onAction",2),tet([I3e()],net.prototype,"actionIcon",2),tet([I3e({type:Boolean})],net.prototype,"border",2),net=tet([x3e("wcm-modal-header")],net);const ret={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}=gHe.state;return null!=n&&n[e]?n[e]:t?LHe.getWalletImageUrl(t):""},getWalletName:(e,t=!1)=>t&&e.length>8?`${e.substring(0,8)}..`:e,isMobileAnimation:()=>window.innerWidth<=ret.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,fHe.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}=yHe.state,{mobile:n,name:r}=e,i=n?.native,a=n?.universal;ret.setRecentWallet(e),t&&function(e){let t="";i?t=fHe.formatUniversalUrl(i,e,r):a&&(t=fHe.formatNativeUrl(a,e,r)),fHe.openHref(t,"_self")}(t)},handleAndroidLinking(){const{walletConnectUri:e}=yHe.state;e&&(fHe.setWalletConnectAndroidDeepLink(e),fHe.openHref(e,"_self"))},async handleUriCopy(){const{walletConnectUri:e}=yHe.state;if(e)try{await navigator.clipboard.writeText(e),KHe.openToast("Link copied","success")}catch{KHe.openToast("Failed to copy","error")}},getCustomImageUrls(){const{walletImages:e}=gHe.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(ret.WCM_RECENT_WALLET_DATA,JSON.stringify(e))}catch{console.info("Unable to set recent wallet")}},getRecentWallet(){try{const e=localStorage.getItem(ret.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(){fHe.openHref(ret.EXPLORER_WALLET_URL,"_blank")},getCachedRouterWalletPlatforms(){const{desktop:e,mobile:t}=fHe.getWalletRouterData(),n=Boolean(e?.native),r=Boolean(e?.universal);return{isDesktop:n,isMobile:Boolean(t?.native)||Boolean(t?.universal),isWeb:r}},goToConnectingView(e){dHe.setData({Wallet:e});const t=fHe.isMobile(),{isDesktop:n,isWeb:r,isMobile:i}=ret.getCachedRouterWalletPlatforms();t?i?dHe.push("MobileConnecting"):r?dHe.push("WebConnecting"):dHe.push("InstallWallet"):n?dHe.push("DesktopConnecting"):r?dHe.push("WebConnecting"):i?dHe.push("MobileQrcodeConnecting"):dHe.push("InstallWallet")}},iet=E8e`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var aet=Object.defineProperty,oet=Object.getOwnPropertyDescriptor,set=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?oet(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&&aet(t,n,a),a};let cet=class extends E3e{constructor(){super(),this.view=dHe.state.view,this.prevView=dHe.state.view,this.unsubscribe=void 0,this.oldHeight="0px",this.resizeObserver=void 0,this.unsubscribe=dHe.subscribe((e=>{this.view!==e.view&&this.onChangeRoute()}))}firstUpdated(){this.resizeObserver=new ResizeObserver((([e])=>{const t=`${e.contentRect.height}px`;"0px"!==this.oldHeight&&z4e(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 ret.getShadowRootElement(this,".wcm-router")}get contentEl(){return ret.getShadowRootElement(this,".wcm-content")}viewTemplate(){switch(this.view){case"ConnectWallet":return t3e`<wcm-connect-wallet-view></wcm-connect-wallet-view>`;case"DesktopConnecting":return t3e`<wcm-desktop-connecting-view></wcm-desktop-connecting-view>`;case"MobileConnecting":return t3e`<wcm-mobile-connecting-view></wcm-mobile-connecting-view>`;case"WebConnecting":return t3e`<wcm-web-connecting-view></wcm-web-connecting-view>`;case"MobileQrcodeConnecting":return t3e`<wcm-mobile-qr-connecting-view></wcm-mobile-qr-connecting-view>`;case"WalletExplorer":return t3e`<wcm-wallet-explorer-view></wcm-wallet-explorer-view>`;case"Qrcode":return t3e`<wcm-qrcode-view></wcm-qrcode-view>`;case"InstallWallet":return t3e`<wcm-install-wallet-view></wcm-install-wallet-view>`;default:return t3e`<div>Not Found</div>`}}async onChangeRoute(){await z4e(this.routerEl,{opacity:[1,0],scale:[1,1.02]},{duration:.15,delay:.1}).finished,this.view=dHe.state.view,z4e(this.routerEl,{opacity:[0,1],scale:[.99,1]},{duration:.37,delay:.05})}render(){return t3e`<div class="wcm-router"><div class="wcm-content">${this.viewTemplate()}</div></div>`}};cet.styles=[x7e.globalCss,iet],set([S3e()],cet.prototype,"view",2),set([S3e()],cet.prototype,"prevView",2),cet=set([x3e("wcm-modal-router")],cet);const uet=E8e`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 det=Object.defineProperty,fet=Object.getOwnPropertyDescriptor,pet=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?fet(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&&det(t,n,a),a};let het=class extends E3e{constructor(){super(),this.open=!1,this.unsubscribe=void 0,this.timeout=void 0,this.unsubscribe=KHe.subscribe((e=>{e.open?(this.open=!0,this.timeout=setTimeout((()=>KHe.closeToast()),2200)):(this.open=!1,clearTimeout(this.timeout))}))}disconnectedCallback(){var e;null==(e=this.unsubscribe)||e.call(this),clearTimeout(this.timeout),KHe.closeToast()}render(){const{message:e,variant:t}=KHe.state,n={"wcm-success":"success"===t,"wcm-error":"error"===t};return this.open?t3e`<div class="${R3e(n)}">${"success"===t?j7e.CHECKMARK_ICON:null} ${"error"===t?j7e.CROSS_ICON:null}<wcm-text variant="small-regular">${e}</wcm-text></div>`:null}};het.styles=[x7e.globalCss,uet],pet([S3e()],het.prototype,"open",2),het=pet([x3e("wcm-modal-toast")],het);function met(e,t,n){return e!==t&&(e-t<0?t-e:e-t)<=n+.1}const yet={generate(e,t,n){const r="#141414",i=[],a=function(e,t){const n=Array.prototype.slice.call(W4e.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(n3e`<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=>!met(e,t,o)))));return[Number(e),n]})).forEach((([e,t])=>{t.forEach((t=>{i.push(n3e`<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=>met(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=>met(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(n3e`<line x1="${e}" x2="${e}" y1="${t}" y2="${n}" stroke="${r}" stroke-width="${o/1.25}" stroke-linecap="round">`)}))})),i}},bet=E8e`@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 get=Object.defineProperty,vet=Object.getOwnPropertyDescriptor,wet=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?vet(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&&get(t,n,a),a};let Tet=class extends E3e{constructor(){super(...arguments),this.uri="",this.size=0,this.imageId=void 0,this.walletId=void 0,this.imageUrl=void 0}svgTemplate(){const e="light"===GHe.state.themeMode?this.size:this.size-36;return n3e`<svg height="${e}" width="${e}">${yet.generate(this.uri,e,e/4)}</svg>`}render(){const e={"wcm-dark":"dark"===GHe.state.themeMode};return t3e`<div style="${`width: ${this.size}px`}" class="${R3e(e)}">${this.walletId||this.imageUrl?t3e`<wcm-wallet-image walletId="${H4e(this.walletId)}" imageId="${H4e(this.imageId)}" imageUrl="${H4e(this.imageUrl)}"></wcm-wallet-image>`:j7e.WALLET_CONNECT_ICON_COLORED} ${this.svgTemplate()}</div>`}};Tet.styles=[x7e.globalCss,bet],wet([I3e()],Tet.prototype,"uri",2),wet([I3e({type:Number})],Tet.prototype,"size",2),wet([I3e()],Tet.prototype,"imageId",2),wet([I3e()],Tet.prototype,"walletId",2),wet([I3e()],Tet.prototype,"imageUrl",2),Tet=wet([x3e("wcm-qrcode")],Tet);const Eet=E8e`: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 Aet=Object.defineProperty,xet=Object.getOwnPropertyDescriptor,Oet=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?xet(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&&Aet(t,n,a),a};let Cet=class extends E3e{constructor(){super(...arguments),this.onChange=()=>null}render(){return t3e`<input type="text" @input="${this.onChange}" placeholder="Search wallets"> ${j7e.SEARCH_ICON}`}};Cet.styles=[x7e.globalCss,Eet],Oet([I3e()],Cet.prototype,"onChange",2),Cet=Oet([x3e("wcm-search-input")],Cet);const Iet=E8e`@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 _et=Object.defineProperty,Pet=Object.getOwnPropertyDescriptor;let ket=class extends E3e{render(){return t3e`<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>`}};ket.styles=[x7e.globalCss,Iet],ket=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?Pet(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&&_et(t,n,a),a})([x3e("wcm-spinner")],ket);const Ret=E8e`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 Net=Object.defineProperty,Met=Object.getOwnPropertyDescriptor,Det=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?Met(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&&Net(t,n,a),a};let Let=class extends E3e{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 t3e`<span><slot class="${R3e(e)}"></slot></span>`}};Let.styles=[x7e.globalCss,Ret],Det([I3e()],Let.prototype,"variant",2),Det([I3e()],Let.prototype,"color",2),Let=Det([x3e("wcm-text")],Let);const Fet=E8e`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 Bet=Object.defineProperty,jet=Object.getOwnPropertyDescriptor,Uet=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?jet(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&&Bet(t,n,a),a};let zet=class extends E3e{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?t3e`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">RECENT</wcm-text>`:this.installed?t3e`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">INSTALLED</wcm-text>`:null}handleClick(){hHe.click({name:"WALLET_BUTTON",walletId:this.walletId}),this.onClick()}render(){var e;return t3e`<button @click="${this.handleClick.bind(this)}"><div><wcm-wallet-image walletId="${this.walletId}" imageId="${H4e(this.imageId)}"></wcm-wallet-image><wcm-text variant="xsmall-regular">${null!=(e=this.label)?e:ret.getWalletName(this.name,!0)}</wcm-text>${this.sublabelTemplate()}</div></button>`}};zet.styles=[x7e.globalCss,Fet],Uet([I3e()],zet.prototype,"onClick",2),Uet([I3e()],zet.prototype,"name",2),Uet([I3e()],zet.prototype,"walletId",2),Uet([I3e()],zet.prototype,"label",2),Uet([I3e()],zet.prototype,"imageId",2),Uet([I3e({type:Boolean})],zet.prototype,"installed",2),Uet([I3e({type:Boolean})],zet.prototype,"recent",2),zet=Uet([x3e("wcm-wallet-button")],zet);const Het=E8e`: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 Wet=Object.defineProperty,Vet=Object.getOwnPropertyDescriptor,Get=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?Vet(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&&Wet(t,n,a),a};let qet=class extends E3e{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:ret.getWalletIcon({id:this.walletId,image_id:this.imageId});return t3e`${t.length?t3e`<div><img crossorigin="anonymous" src="${t}" alt="${this.id}"></div>`:j7e.WALLET_PLACEHOLDER}`}};qet.styles=[x7e.globalCss,Het],Get([I3e()],qet.prototype,"walletId",2),Get([I3e()],qet.prototype,"imageId",2),Get([I3e()],qet.prototype,"imageUrl",2),qet=Get([x3e("wcm-wallet-image")],qet);var Ket=Object.defineProperty,Xet=Object.getOwnPropertyDescriptor,Yet=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?Xet(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&&Ket(t,n,a),a};let Jet=class extends E3e{constructor(){super(),this.preload=!0,this.preloadData()}async loadImages(e){try{null!=e&&e.length&&await Promise.all(e.map((async e=>ret.preloadImage(e))))}catch{console.info("Unsuccessful attempt at preloading some images",e)}}async preloadListings(){if(gHe.state.enableExplorer){await LHe.getRecomendedWallets(),yHe.setIsDataLoaded(!0);const{recomendedWallets:e}=LHe.state,t=e.map((e=>ret.getWalletIcon(e)));await this.loadImages(t)}else yHe.setIsDataLoaded(!0)}async preloadCustomImages(){const e=ret.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),KHe.openToast("Failed preloading","error")}}};Yet([S3e()],Jet.prototype,"preload",2),Jet=Yet([x3e("wcm-explorer-context")],Jet);var Zet=Object.defineProperty,Qet=Object.getOwnPropertyDescriptor;let $et=class extends E3e{constructor(){super(),this.unsubscribeTheme=void 0,x7e.setTheme(),this.unsubscribeTheme=GHe.subscribe(x7e.setTheme)}disconnectedCallback(){var e;null==(e=this.unsubscribeTheme)||e.call(this)}};$et=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?Qet(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&&Zet(t,n,a),a})([x3e("wcm-theme-context")],$et);const ett=E8e`@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 ttt=Object.defineProperty,ntt=Object.getOwnPropertyDescriptor;let rtt=class extends E3e{onGoToQrcode(){dHe.push("Qrcode")}render(){const{recomendedWallets:e}=LHe.state,t=[...e,...e],n=2*fHe.RECOMMENDED_WALLET_AMOUNT;return t3e`<wcm-modal-header title="Connect your wallet" .onAction="${this.onGoToQrcode}" .actionIcon="${j7e.QRCODE_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-title">${j7e.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?t3e`<wcm-wallet-image walletId="${r.id}" imageId="${r.image_id}"></wcm-wallet-image>`:j7e.WALLET_PLACEHOLDER}))}</div><wcm-button-big @click="${ret.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>`}};rtt.styles=[x7e.globalCss,ett],rtt=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?ntt(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&&ttt(t,n,a),a})([x3e("wcm-android-wallet-selection")],rtt);const itt=E8e`@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 att=Object.defineProperty,ott=Object.getOwnPropertyDescriptor,stt=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?ott(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&&att(t,n,a),a};let ctt=class extends E3e{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=GHe.state.themeVariables)?void 0:e["--wcm-wallet-icon-large-border-radius"])?t:x7e.getPreset("--wcm-wallet-icon-large-border-radius");let r=0;r=n.includes("%")?.88*parseInt(n,10):parseInt(n,10),r*=1.17;return t3e`<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 t3e`<div class="${R3e(e)}">${this.svgLoaderTemplate()}<wcm-wallet-image walletId="${H4e(this.walletId)}" imageId="${H4e(this.imageId)}"></wcm-wallet-image></div><wcm-text variant="medium-regular" color="${this.isError?"error":"primary"}">${this.isError?"Connection declined":this.label}</wcm-text>`}};ctt.styles=[x7e.globalCss,itt],stt([I3e()],ctt.prototype,"walletId",2),stt([I3e()],ctt.prototype,"imageId",2),stt([I3e({type:Boolean})],ctt.prototype,"isError",2),stt([I3e({type:Boolean})],ctt.prototype,"isStale",2),stt([I3e()],ctt.prototype,"label",2),ctt=stt([x3e("wcm-connector-waiting")],ctt);const utt={manualWallets(){var e,t;const{mobileWallets:n,desktopWallets:r}=gHe.state,i=null==(e=utt.recentWallet())?void 0:e.id,a=fHe.isMobile()?n:r,o=a?.filter((e=>i!==e.id));return null!=(t=fHe.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:()=>ret.getRecentWallet(),recomendedWallets(e=!1){var t;const n=e||null==(t=utt.recentWallet())?void 0:t.id,{recomendedWallets:r}=LHe.state;return r.filter((e=>n!==e.id))}},ltt={onConnecting(e){ret.goToConnectingView(e)},manualWalletsTemplate(){return utt.manualWallets().map((e=>t3e`<wcm-wallet-button walletId="${e.id}" name="${e.name}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`))},recomendedWalletsTemplate(e=!1){return utt.recomendedWallets(e).map((e=>t3e`<wcm-wallet-button name="${e.name}" walletId="${e.id}" imageId="${e.image_id}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`))},recentWalletTemplate(){const e=utt.recentWallet();if(e)return t3e`<wcm-wallet-button name="${e.name}" walletId="${e.id}" imageId="${H4e(e.image_id)}" .recent="${!0}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`}},dtt=E8e`.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 ftt=Object.defineProperty,ptt=Object.getOwnPropertyDescriptor;let htt=class extends E3e{render(){const{explorerExcludedWalletIds:e,enableExplorer:t}=gHe.state,n="ALL"!==e&&t,r=ltt.manualWalletsTemplate(),i=ltt.recomendedWalletsTemplate();let a=[ltt.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 t3e`<wcm-modal-header .border="${!0}" title="Connect your wallet" .onAction="${ret.handleUriCopy}" .actionIcon="${j7e.COPY_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-mobile-title"><div class="wcm-subtitle">${j7e.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">Mobile</wcm-text></div><div class="wcm-subtitle">${j7e.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?t3e`<wcm-modal-footer><div class="wcm-desktop-title">${j7e.DESKTOP_ICON}<wcm-text variant="small-regular" color="accent">Desktop</wcm-text></div><div class="wcm-grid">${s} ${o?t3e`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-footer>`:null}`}};htt.styles=[x7e.globalCss,dtt],htt=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?ptt(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&&ftt(t,n,a),a})([x3e("wcm-desktop-wallet-selection")],htt);const mtt=E8e`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 ytt=Object.defineProperty,btt=Object.getOwnPropertyDescriptor;let gtt=class extends E3e{render(){const{termsOfServiceUrl:e,privacyPolicyUrl:t}=gHe.state;return e??t?t3e`<div><wcm-text variant="small-regular" color="secondary">By connecting your wallet to this app, you agree to the app's ${e?t3e`<a href="${e}" target="_blank" rel="noopener noreferrer">Terms of Service</a>`:null} ${e&&t?"and":null} ${t?t3e`<a href="${t}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`:null}</wcm-text></div>`:null}};gtt.styles=[x7e.globalCss,mtt],gtt=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?btt(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&&ytt(t,n,a),a})([x3e("wcm-legal-notice")],gtt);const vtt=E8e`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var wtt=Object.defineProperty,Ttt=Object.getOwnPropertyDescriptor;let Ett=class extends E3e{onQrcode(){dHe.push("Qrcode")}render(){const{explorerExcludedWalletIds:e,enableExplorer:t}=gHe.state,n="ALL"!==e&&t,r=ltt.manualWalletsTemplate(),i=ltt.recomendedWalletsTemplate();let a=[ltt.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 t3e`<wcm-modal-header title="Connect your wallet" .onAction="${this.onQrcode}" .actionIcon="${j7e.QRCODE_ICON}"></wcm-modal-header>${c?t3e`<wcm-modal-content><div>${s} ${o?t3e`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-content>`:null}`}};Ett.styles=[x7e.globalCss,vtt],Ett=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?Ttt(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&&wtt(t,n,a),a})([x3e("wcm-mobile-wallet-selection")],Ett);const Att=E8e`: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 xtt=Object.defineProperty,Ott=Object.getOwnPropertyDescriptor,Ctt=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?Ott(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&&xtt(t,n,a),a};let Itt=class extends E3e{constructor(){super(),this.open=!1,this.active=!1,this.unsubscribeModal=void 0,this.abortController=void 0,this.unsubscribeModal=BHe.subscribe((e=>{e.open?this.onOpenModalEvent():this.onCloseModalEvent()}))}disconnectedCallback(){var e;null==(e=this.unsubscribeModal)||e.call(this)}get overlayEl(){return ret.getShadowRootElement(this,".wcm-overlay")}get containerEl(){return ret.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&&BHe.close()}onOpenModalEvent(){this.toggleBodyScroll(!1),this.addKeyboardEvents(),this.open=!0,setTimeout((async()=>{const e=ret.isMobileAnimation()?{y:["50vh","0vh"]}:{scale:[.98,1]};await Promise.all([z4e(this.overlayEl,{opacity:[0,1]},{delay:.1,duration:.2}).finished,z4e(this.containerEl,e,{delay:.1,duration:.2}).finished]),this.active=!0}),0)}async onCloseModalEvent(){this.toggleBodyScroll(!0),this.removeKeyboardEvents();const e=ret.isMobileAnimation()?{y:["0vh","50vh"]}:{scale:[1,.98]};await Promise.all([z4e(this.overlayEl,{opacity:[1,0]},{duration:.2}).finished,z4e(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?BHe.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 t3e`<wcm-explorer-context></wcm-explorer-context><wcm-theme-context></wcm-theme-context><div id="wcm-modal" class="${R3e(e)}" @click="${this.onCloseModal}" role="alertdialog" aria-modal="true"><div class="wcm-container" tabindex="0">${this.open?t3e`<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>`}};Itt.styles=[x7e.globalCss,Att],Ctt([S3e()],Itt.prototype,"open",2),Ctt([S3e()],Itt.prototype,"active",2),Itt=Ctt([x3e("wcm-modal")],Itt);const Stt=E8e`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var _tt=Object.defineProperty,Ptt=Object.getOwnPropertyDescriptor,ktt=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?Ptt(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&&_tt(t,n,a),a};let Rtt=class extends E3e{constructor(){super(...arguments),this.isMobile=!1,this.isDesktop=!1,this.isWeb=!1,this.isRetry=!1}onMobile(){fHe.isMobile()?dHe.replace("MobileConnecting"):dHe.replace("MobileQrcodeConnecting")}onDesktop(){dHe.replace("DesktopConnecting")}onWeb(){dHe.replace("WebConnecting")}render(){return t3e`<div>${this.isRetry?t3e`<slot></slot>`:null} ${this.isMobile?t3e`<wcm-button .onClick="${this.onMobile}" .iconLeft="${j7e.MOBILE_ICON}" variant="outline">Mobile</wcm-button>`:null} ${this.isDesktop?t3e`<wcm-button .onClick="${this.onDesktop}" .iconLeft="${j7e.DESKTOP_ICON}" variant="outline">Desktop</wcm-button>`:null} ${this.isWeb?t3e`<wcm-button .onClick="${this.onWeb}" .iconLeft="${j7e.GLOBE_ICON}" variant="outline">Web</wcm-button>`:null}</div>`}};Rtt.styles=[x7e.globalCss,Stt],ktt([I3e({type:Boolean})],Rtt.prototype,"isMobile",2),ktt([I3e({type:Boolean})],Rtt.prototype,"isDesktop",2),ktt([I3e({type:Boolean})],Rtt.prototype,"isWeb",2),ktt([I3e({type:Boolean})],Rtt.prototype,"isRetry",2),Rtt=ktt([x3e("wcm-platform-selection")],Rtt);const Ntt=E8e`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 Mtt=Object.defineProperty,Dtt=Object.getOwnPropertyDescriptor;let Ltt=class extends E3e{onClick(){dHe.push("WalletExplorer")}render(){const{recomendedWallets:e}=LHe.state,t=[...e,...utt.manualWallets()].reverse().slice(0,4);return t3e`<button @click="${this.onClick}"><div class="wcm-icons">${t.map((e=>{const t=ret.getWalletIcon(e);if(t)return t3e`<img crossorigin="anonymous" src="${t}">`;const n=ret.getWalletIcon({id:e.id});return n?t3e`<img crossorigin="anonymous" src="${n}">`:j7e.WALLET_PLACEHOLDER}))} ${[...Array(4-t.length)].map((()=>j7e.WALLET_PLACEHOLDER))}</div><wcm-text variant="xsmall-regular">View All</wcm-text></button>`}};Ltt.styles=[x7e.globalCss,Ntt],Ltt=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?Dtt(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&&Mtt(t,n,a),a})([x3e("wcm-view-all-wallets-button")],Ltt);const Ftt=E8e`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var Btt=Object.defineProperty,jtt=Object.getOwnPropertyDescriptor,Utt=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?jtt(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&&Btt(t,n,a),a};let ztt=class extends E3e{constructor(){super(),this.walletId="",this.imageId="",this.uri="",setTimeout((()=>{const{walletConnectUri:e}=yHe.state;this.uri=e}),0)}get overlayEl(){return ret.getShadowRootElement(this,".wcm-qr-container")}render(){return t3e`<div class="wcm-qr-container">${this.uri?t3e`<wcm-qrcode size="${this.overlayEl.offsetWidth}" uri="${this.uri}" walletId="${H4e(this.walletId)}" imageId="${H4e(this.imageId)}"></wcm-qrcode>`:t3e`<wcm-spinner></wcm-spinner>`}</div>`}};ztt.styles=[x7e.globalCss,Ftt],Utt([I3e()],ztt.prototype,"walletId",2),Utt([I3e()],ztt.prototype,"imageId",2),Utt([S3e()],ztt.prototype,"uri",2),ztt=Utt([x3e("wcm-walletconnect-qr")],ztt);var Htt=Object.defineProperty,Wtt=Object.getOwnPropertyDescriptor;let Vtt=class extends E3e{viewTemplate(){return fHe.isAndroid()?t3e`<wcm-android-wallet-selection></wcm-android-wallet-selection>`:fHe.isMobile()?t3e`<wcm-mobile-wallet-selection></wcm-mobile-wallet-selection>`:t3e`<wcm-desktop-wallet-selection></wcm-desktop-wallet-selection>`}render(){return t3e`${this.viewTemplate()}<wcm-legal-notice></wcm-legal-notice>`}};Vtt.styles=[x7e.globalCss],Vtt=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?Wtt(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&&Htt(t,n,a),a})([x3e("wcm-connect-wallet-view")],Vtt);const Gtt=E8e`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var qtt=Object.defineProperty,Ktt=Object.getOwnPropertyDescriptor,Xtt=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?Ktt(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&&qtt(t,n,a),a};let Ytt=class extends E3e{constructor(){super(),this.isError=!1,this.openDesktopApp()}onFormatAndRedirect(e){const{desktop:t,name:n}=fHe.getWalletRouterData(),r=t?.native;if(r){const t=fHe.formatNativeUrl(r,e,n);fHe.openHref(t,"_self")}}openDesktopApp(){const{walletConnectUri:e}=yHe.state,t=fHe.getWalletRouterData();ret.setRecentWallet(t),e&&this.onFormatAndRedirect(e)}render(){const{name:e,id:t,image_id:n}=fHe.getWalletRouterData(),{isMobile:r,isWeb:i}=ret.getCachedRouterWalletPlatforms();return t3e`<wcm-modal-header title="${e}" .onAction="${ret.handleUriCopy}" .actionIcon="${j7e.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${H4e(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="${j7e.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Ytt.styles=[x7e.globalCss,Gtt],Xtt([S3e()],Ytt.prototype,"isError",2),Ytt=Xtt([x3e("wcm-desktop-connecting-view")],Ytt);const Jtt=E8e`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 Ztt=Object.defineProperty,Qtt=Object.getOwnPropertyDescriptor;let $tt=class extends E3e{onInstall(e){e&&fHe.openHref(e,"_blank")}render(){const{name:e,id:t,image_id:n,homepage:r}=fHe.getWalletRouterData();return t3e`<wcm-modal-header title="${e}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${H4e(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="${j7e.ARROW_DOWN_ICON}">Download</wcm-button></wcm-info-footer>`}};$tt.styles=[x7e.globalCss,Jtt],$tt=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?Qtt(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&&Ztt(t,n,a),a})([x3e("wcm-install-wallet-view")],$tt);const ent=E8e`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 tnt=Object.defineProperty,nnt=Object.getOwnPropertyDescriptor,rnt=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?nnt(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&&tnt(t,n,a),a};let int=class extends E3e{constructor(){super(),this.isError=!1,this.openMobileApp()}onFormatAndRedirect(e,t=!1){const{mobile:n,name:r}=fHe.getWalletRouterData(),i=n?.native,a=n?.universal;if(i&&!t){const t=fHe.formatNativeUrl(i,e,r);fHe.openHref(t,"_self")}else if(a){const t=fHe.formatUniversalUrl(a,e,r);fHe.openHref(t,"_self")}}openMobileApp(e=!1){const{walletConnectUri:t}=yHe.state,n=fHe.getWalletRouterData();ret.setRecentWallet(n),t&&this.onFormatAndRedirect(t,e)}onGoToAppStore(e){e&&fHe.openHref(e,"_blank")}render(){const{name:e,id:t,image_id:n,app:r,mobile:i}=fHe.getWalletRouterData(),{isWeb:a}=ret.getCachedRouterWalletPlatforms(),o=r?.ios,s=i?.universal;return t3e`<wcm-modal-header title="${e}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${H4e(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="${j7e.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection>${s?t3e`<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="${H4e(n)}"></wcm-wallet-image><wcm-text>${`Get ${e}`}</wcm-text></div><wcm-button .iconRight="${j7e.ARROW_RIGHT_ICON}" .onClick="${()=>this.onGoToAppStore(o)}" variant="ghost">App Store</wcm-button></wcm-info-footer>`}};int.styles=[x7e.globalCss,ent],rnt([S3e()],int.prototype,"isError",2),int=rnt([x3e("wcm-mobile-connecting-view")],int);const ant=E8e`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var ont=Object.defineProperty,snt=Object.getOwnPropertyDescriptor;let cnt=class extends E3e{render(){const{name:e,id:t,image_id:n}=fHe.getWalletRouterData(),{isDesktop:r,isWeb:i}=ret.getCachedRouterWalletPlatforms();return t3e`<wcm-modal-header title="${e}" .onAction="${ret.handleUriCopy}" .actionIcon="${j7e.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr walletId="${t}" imageId="${H4e(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>`}};cnt.styles=[x7e.globalCss,ant],cnt=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?snt(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&&ont(t,n,a),a})([x3e("wcm-mobile-qr-connecting-view")],cnt);var unt=Object.defineProperty,lnt=Object.getOwnPropertyDescriptor;let dnt=class extends E3e{render(){return t3e`<wcm-modal-header title="Scan the code" .onAction="${ret.handleUriCopy}" .actionIcon="${j7e.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>`}};dnt.styles=[x7e.globalCss],dnt=((e,t,n,r)=>{for(var i,a=r>1?void 0:r?lnt(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&&unt(t,n,a),a})([x3e("wcm-qrcode-view")],dnt);const fnt=E8e`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 pnt=Object.defineProperty,hnt=Object.getOwnPropertyDescriptor,mnt=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?hnt(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&&pnt(t,n,a),a};let ynt=class extends E3e{constructor(){super(...arguments),this.loading=!LHe.state.wallets.listings.length,this.firstFetch=!LHe.state.wallets.listings.length,this.search="",this.endReached=!1,this.intersectionObserver=void 0,this.searchDebounce=ret.debounce((e=>{e.length>=1?(this.firstFetch=!0,this.endReached=!1,this.search=e,LHe.resetSearch(),this.fetchWallets()):this.search&&(this.search="",this.endReached=this.isLastPage(),LHe.resetSearch())}))}firstUpdated(){this.createPaginationObserver()}disconnectedCallback(){var e;null==(e=this.intersectionObserver)||e.disconnect()}get placeholderEl(){return ret.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}=LHe.state,{listings:n,total:r}=this.search?t:e;return r<=40||n.length>=r}async fetchWallets(){var e;const{wallets:t,search:n}=LHe.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=yHe.state.chains)?void 0:e.join(","),{listings:n}=await LHe.getWallets({page:this.firstFetch?1:a+1,entries:40,search:this.search,version:2,chains:t}),r=n.map((e=>ret.getWalletIcon(e)));await Promise.all([...r.map((async e=>ret.preloadImage(e))),fHe.wait(300)]),this.endReached=this.isLastPage()}catch(e){console.error(e),KHe.openToast(ret.getErrorMessage(e),"error")}finally{this.loading=!1,this.firstFetch=!1}}onConnect(e){fHe.isAndroid()?ret.handleMobileLinking(e):ret.goToConnectingView(e)}onSearchChange(e){const{value:t}=e.target;this.searchDebounce(t)}render(){const{wallets:e,search:t}=LHe.state,{listings:n}=this.search?t:e,r=this.loading&&!n.length,i=this.search.length>=3;let a=ltt.manualWalletsTemplate(),o=ltt.recomendedWalletsTemplate(!0);i&&(a=a.filter((({values:e})=>ret.caseSafeIncludes(e[0],this.search))),o=o.filter((({values:e})=>ret.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 t3e`<wcm-modal-header><wcm-search-input .onChange="${this.onSearchChange.bind(this)}"></wcm-search-input></wcm-modal-header><wcm-modal-content class="${R3e(c)}"><div class="wcm-grid">${r?null:a} ${r?null:o} ${r?null:n.map((e=>t3e`${e?t3e`<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?t3e`<wcm-text variant="big-bold" color="secondary">No results found</wcm-text>`:null} ${!s&&this.loading?t3e`<wcm-spinner></wcm-spinner>`:null}</div></wcm-modal-content>`}};ynt.styles=[x7e.globalCss,fnt],mnt([S3e()],ynt.prototype,"loading",2),mnt([S3e()],ynt.prototype,"firstFetch",2),mnt([S3e()],ynt.prototype,"search",2),mnt([S3e()],ynt.prototype,"endReached",2),ynt=mnt([x3e("wcm-wallet-explorer-view")],ynt);const bnt=E8e`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var gnt=Object.defineProperty,vnt=Object.getOwnPropertyDescriptor,wnt=(e,t,n,r)=>{for(var i,a=r>1?void 0:r?vnt(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&&gnt(t,n,a),a};let Tnt=class extends E3e{constructor(){super(),this.isError=!1,this.openWebWallet()}onFormatAndRedirect(e){const{desktop:t,name:n}=fHe.getWalletRouterData(),r=t?.universal;if(r){const t=fHe.formatUniversalUrl(r,e,n);fHe.openHref(t,"_blank")}}openWebWallet(){const{walletConnectUri:e}=yHe.state,t=fHe.getWalletRouterData();ret.setRecentWallet(t),e&&this.onFormatAndRedirect(e)}render(){const{name:e,id:t,image_id:n}=fHe.getWalletRouterData(),{isMobile:r,isDesktop:i}=ret.getCachedRouterWalletPlatforms(),a=fHe.isMobile();return t3e`<wcm-modal-header title="${e}" .onAction="${ret.handleUriCopy}" .actionIcon="${j7e.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${H4e(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="${j7e.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Tnt.styles=[x7e.globalCss,bnt],wnt([S3e()],Tnt.prototype,"isError",2),Tnt=wnt([x3e("wcm-web-connecting-view")],Tnt);var Ent=Object.freeze({__proto__:null,get WcmModal(){return Itt},get WcmQrCode(){return Tet}});function Ant({theme:e,environment:t}){const{t:n}=uUe(),r=e===RZ.DARK?Rze(t,"/quickswapdark.webp"):Rze(t,"/quickswaplight.webp");return y1(kae,{testId:"quickswap-footer-container",sx:ZUe,children:[y1(kae,{testId:"quickswap-logo",sx:QUe,children:[m1(jce,{size:"xSmall",sx:{paddingRight:"base.spacing.x1"},children:"By"}),m1("img",{style:{height:"26px"},alt:"Quickswap logo",src:r})]}),m1(jce,{testId:"quickswap-footer-disclaimer-text",size:"xSmall",sx:$Ue,children:n("footers.quickswapFooter.disclaimerText")})]})}function xnt({visible:e,targetChainId:t,provider:n,checkout:r,onCloseDrawer:i,onNetworkSwitch:a}){const{t:o}=uUe(),s=Rze(r.config.environment??qt.PRODUCTION,"/switchnetworkethereum.png"),c=Rze(r.config.environment??qt.PRODUCTION,"/switchnetworkzkevm.png"),u=TBe(t),l=t===NUe(r.config),d=QQ.useCallback((async()=>{if(!r)return;const e=await r.switchNetwork({provider:n,chainId:t});a&&a(e.provider)}),[r,n,a,t]),f=Xze(n),p=QQ.useMemo((()=>f?n.provider?.session?.peer?.metadata?.name:""),[n,f]),h=QQ.useMemo((()=>p?.toLowerCase().includes("metamask")),[p]),m=QQ.useMemo((()=>Kze(n)?"MetaMask wallet":f&&p?p:"wallet"),[n,f,p]),y=f&&h;return QQ.useEffect((()=>{(new Image).src=s;(new Image).src=c}),[]),m1(Cde,{size:"threeQuarter",visible:e,onCloseDrawer:i,showHeaderBar:!1,children:y1(Cde.Content,{sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center"},children:[m1(Pse,{aspectRatio:"21:9",responsiveSizes:[450,512,640,720,860,1024,1280,1440],imageUrl:l?s:c}),m1(soe,{icon:"Close",variant:"tertiary",sx:{pos:"absolute",top:"base.spacing.x5",left:"base.spacing.x5",backdropFilter:"blur(30px)"},onClick:i}),y1(kae,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:"base.spacing.x4",paddingX:"base.spacing.x6"},children:[m1(Que,{size:"small",weight:"bold",sx:{textAlign:"center",paddingX:"base.spacing.x6"},children:o("drawers.networkSwitch.heading",{wallet:m})}),y&&m1(jce,{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&&m1(jce,{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})})]}),y1(kae,{sx:{display:"flex",flexDirection:"column",paddingX:"base.spacing.x4",width:"100%"},children:[!y&&m1(xae,{size:"large",variant:"primary",sx:{width:"100%",marginBottom:"base.spacing.x2"},onClick:d,children:o("drawers.networkSwitch.switchButton",{chain:u})}),m1(Uze,{})]})]})})}const Ont={exchange:null,walletProviderName:null,network:null,tokenBalances:[],supportedTopUps:null,allowedTokens:[]};var Cnt;!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"}(Cnt||(Cnt={}));const Int=QQ.createContext({swapState:Ont,swapDispatch:()=>{}});Int.displayName="SwapContext";const Snt=(e,t)=>{switch(t.payload.type){case Cnt.SET_EXCHANGE:return{...e,exchange:t.payload.exchange};case Cnt.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case Cnt.SET_NETWORK:return{...e,network:t.payload.network};case Cnt.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 Cnt.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case Cnt.SET_ALLOWED_TOKENS:return{...e,allowedTokens:t.payload.allowedTokens};default:return e}};var _nt;!function(e){e.USD="usd"}(_nt||(_nt={}));const Pnt={cryptoFiat:null,fiatSymbol:_nt.USD,tokenSymbols:[],conversions:new Map};var knt;!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"}(knt||(knt={}));const Rnt=QQ.createContext({cryptoFiatState:Pnt,cryptoFiatDispatch:()=>{}}),Nnt=(e,t)=>{switch(t.payload.type){case knt.SET_CRYPTO_FIAT:return{...e,cryptoFiat:t.payload.cryptoFiat};case knt.SET_FIAT_SYMBOL:return{...e,fiatSymbol:t.payload.fiatSymbol};case knt.SET_TOKEN_SYMBOLS:return{...e,tokenSymbols:t.payload.tokenSymbols};case knt.SET_CONVERSIONS:return{...e,conversions:t.payload.conversions};default:return e}},Mnt={fromAmountIn:async(e,t,n,r,i)=>{const a=await t.getSigner().getAddress();return e.getUnsignedSwapTxFromAmountIn(a,n.address,i.address,jr.from(Gp(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(Gp(r,n.decimals)))}},Dnt={display:"flex",flexDirection:"row",justifyContent:"space-between",columnGap:"base.spacing.x1"},Lnt={flex:1},Fnt={flex:2};function Bnt({onClick:e,icon:t,name:n,symbol:r,balance:i,defaultTokenImage:a,testId:o,id:s}){const{t:c}=uUe();return y1(nhe,{testId:`${o}-coin-selector__option-${s}`,emphasized:!0,size:"small",onClick:e,children:[!t&&m1(nhe.Icon,{icon:"Coins",variant:"bold"}),t&&m1(nhe.FramedImage,{imageUrl:t,circularFrame:!0,defaultImageUrl:a}),m1(nhe.Label,{children:n}),m1(nhe.Caption,{children:r}),i&&m1(nhe.PriceDisplay,{fiatAmount:`${c("drawers.coinSelector.option.fiatPricePrefix")}${i.formattedFiatAmount}`,price:i.formattedAmount})]})}const jnt={display:"flex",flexDirection:"column",gap:"2px",paddingX:"base.spacing.x4",paddingBottom:"base.spacing.x4"},Unt={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"};function znt({heading:e,options:t,defaultTokenImage:n,optionsLoading:r,children:i,onCloseDrawer:a,visible:o}){const{t:s}=uUe();return y1(Cde,{headerBarTitle:e,size:"full",onCloseDrawer:a,visible:o,children:[m1(Cde.Target,{children:i}),m1(Cde.Content,{children:y1(kae,{sx:jnt,children:[r&&0===t.length&&y1(kae,{sx:Unt,children:[m1(nhe,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),m1(nhe,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"}),m1(nhe,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--3"})]}),!r&&0===t.length&&m1(jce,{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})=>m1(Bnt,{id:o,testId:s,onClick:e,icon:t,name:r,symbol:i,balance:a,defaultTokenImage:n},`${i}-${r}`)))]})})]})}function Hnt({testId:e,options:t,optionsLoading:n,subtext:r,onSelectChange:i,textAlign:a,errorMessage:o,disabled:s,selectedOption:c,coinSelectorHeading:u,defaultTokenImage:l}){const[d,f]=QQ.useState(!1);return y1(kae,{children:[m1(znt,{heading:u,options:QQ.useMemo((()=>t.map((t=>({...t,testId:e,onClick:()=>{i(t.id),f(!1)}})))),[t,i,f]),defaultTokenImage:l,optionsLoading:n??!1,visible:d,onCloseDrawer:()=>f(!1)}),m1(V0e,{testId:`${e}-select-control`,textAlign:a??"left",subtext:o?void 0:r,isErrored:!!o,errorMessage:o,children:m1(phe,{testId:`${e}-select`,size:"large",defaultLabel:"Select coin",targetClickOveride:()=>f(!0),selectedOption:(()=>{if(c&&0!==t.length&&t.find((e=>e.id===c)))return c})(),sx:{minw:"170px"},children:t.filter((e=>e.id===c))?.map((e=>y1(phe.Option,{optionKey:e.id,testId:e.testId,disabled:s,children:[!e.icon&&m1(phe.Option.Icon,{icon:"Coins",variant:"bold"}),e.icon&&m1(phe.Option.FramedImage,{imageUrl:e.icon,circularFrame:!0,defaultImageUrl:l,sx:{background:"base.color.translucent.standard.100"}}),m1(phe.Option.Label,{children:e.symbol})]},e.id)))})})]})}function Wnt({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}){return m1(V0e,{testId:`${e}-text-control`,textAlign:u??"left",subtext:r?void 0:d,isErrored:!!r,errorMessage:r,sx:{width:"100%"},children:m1(Lme,{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,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&&m1(Lme.Button,{testId:`${e}-max-button`,onClick:f,disabled:p,children:"max"})})})}function Vnt({testId:e,options:t,textInputValue:n,textInputPlaceholder:r,textInputValidator:i,textInputType:a,onTextInputChange:o,onTextInputBlur:s,onTextInputFocus:c,textInputTextAlign:u,textInputSubtext:l,textInputErrorMessage:d,selectTextAlign:f,selectSubtext:p,selectErrorMessage:h,textInputMaxButtonClick:m,onSelectChange:y,textInputDisabled:b,selectInputDisabled:g,selectedOption:v,coinSelectorHeading:w,defaultTokenImage:T}){return y1(kae,{sx:Dnt,children:[m1(kae,{sx:Lnt,children:m1(Hnt,{testId:`${e}-select-form`,options:t,subtext:p,textAlign:f,errorMessage:h,onSelectChange:y,disabled:g,selectedOption:v,coinSelectorHeading:w,defaultTokenImage:T})}),m1(kae,{sx:Fnt,children:m1(Wnt,{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:m,disabled:b})})]})}const Gnt={display:"flex",flexDirection:"column",height:"100%",padding:"16px 16px 0 16px"},qnt={display:"flex",flexDirection:"column",gap:"10px",height:"100%"},Knt={display:"flex",width:"100%"},Xnt=e=>({width:"50%",color:e?"base.color.text.body.primary":"base.color.text.body.secondary"}),Ynt={width:"50%"},Jnt={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"};function Znt({boldLabel:e,label:t,amount:n,fiatAmount:r,tokenSymbol:i,prefix:a=""}){const o=t.toLowerCase().replace(" ","-");return y1(kae,{sx:Knt,testId:`fee-item-${o}`,children:[m1(jce,{sx:Xnt(e),children:t}),m1(que,{testId:o,sx:Ynt,price:`${a}${i} ${n}`,fiatAmount:r})]})}function Qnt({fees:e,children:t,visible:n,onCloseDrawer:r,totalFiatAmount:i,totalAmount:a,tokenSymbol:o,loading:s=!1}){const{t:c}=uUe();return y1(Cde,{headerBarTitle:c("drawers.feesBreakdown.heading"),size:"threeQuarter",onCloseDrawer:r,visible:n,children:[m1(Cde.Target,{children:t}),y1(Cde.Content,{testId:"fees-breakdown-content",sx:Gnt,children:[y1(kae,{sx:qnt,children:[s&&y1(kae,{sx:Jnt,children:[m1(nhe,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),m1(nhe,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"})]}),!s&&e.map((({label:e,amount:t,fiatAmount:n,prefix:r})=>m1(Znt,{label:e,amount:t,fiatAmount:n,tokenSymbol:o,prefix:r},e))),a&&y1(h1,{children:[m1(qae,{size:"xSmall"}),m1(Znt,{label:c("drawers.feesBreakdown.total"),amount:Sze(a),fiatAmount:i?`~ ${c("drawers.feesBreakdown.fees.fiatPricePrefix")}${i}`:Cze("0"),tokenSymbol:o,boldLabel:!0},c("drawers.feesBreakdown.total"))]})]}),m1(Uze,{})]})]})}const $nt={backgroundColor:"base.color.translucent.emphasis.100"},ert={marginBottom:"base.spacing.x4",color:"base.color.text.body.secondary"};function trt({gasFeeValue:e,gasFeeToken:t,gasFeeFiatValue:n,fees:r,onFeesClick:i,loading:a,sx:o}){const[s,c]=QQ.useState(!1),{t:u}=uUe();if(!e&&!a)return m1(kae,{});const l=Cze(Sze(e)),d=t?.symbol;return y1(h1,{children:[y1(Poe,{targetClickOveride:()=>{c(!0),i?.()},sx:{...$nt,paddingBottom:"base.spacing.x2",...o},children:[m1(Poe.TargetLeftSlot,{children:m1(jce,{size:"medium",sx:ert,children:u("drawers.feesBreakdown.heading")})}),y1(Poe.TargetRightSlot,{children:[a&&m1(kae,{sx:{width:"218px",position:"relative"},children:m1(kae,{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:m1("span",{}),children:m1(Ice,{rc:m1("span",{})})})}),!a&&m1(que,{testId:"fees-gas-fee__priceDisplay",fiatAmount:`~ ${u("drawers.feesBreakdown.fees.fiatPricePrefix")}${n}`,price:`~ ${d} ${Cze(Sze(l))}`})]})]}),m1(Qnt,{tokenSymbol:d??"",fees:r,visible:s,loading:a,onCloseDrawer:()=>c(!1)})]})}var nrt;!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"}(nrt||(nrt={}));const rrt={display:"flex",flexDirection:"column",paddingY:"base.spacing.x6",paddingX:"base.spacing.x4"},irt={width:"base.icon.size.400"},art={display:"flex",flexDirection:"column",alignItems:"center",paddingY:"50px",paddingX:"base.spacing.x4",height:"100%"},ort={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"15px"},srt={display:"flex",flexDirection:"column",justifyContent:"flex-end",gap:"8px",height:"100%",width:"100%"},crt={width:"100%",height:"64px"};function urt({onCloseDrawer:e,visible:t,showHeaderBar:n,onRetry:r}){const{t:i}=uUe();return m1(Cde,{headerBarTitle:void 0,size:"full",onCloseDrawer:e,visible:t,showHeaderBar:n,children:m1(Cde.Content,{children:y1(kae,{sx:art,children:[m1(lye,{icon:"Information",colorVariant:"guidance",iconVariant:"bold"}),y1(Que,{size:"small",sx:ort,testId:"transaction-rejected-heading",children:[i("drawers.transactionFailed.content.heading1"),m1("br",{}),i("drawers.transactionFailed.content.heading2")]}),y1(jce,{sx:ort,children:[i("drawers.transactionFailed.content.body1"),m1("br",{}),i("drawers.transactionFailed.content.body2")]}),y1(kae,{sx:srt,children:[m1(xae,{sx:crt,variant:"tertiary",onClick:r,children:i("drawers.transactionFailed.buttons.retry")}),m1(xae,{sx:crt,variant:"tertiary",onClick:e,testId:"transaction-rejected-cancel-button",children:i("drawers.transactionFailed.buttons.cancel")})]})]})})})}function lrt({loading:e,updateLoading:t,validator:n,transaction:r,data:i,insufficientFundsForGas:a,openNotEnoughImxDrawer:o,openNetworkSwitchDrawer:s}){const{t:c}=uUe(),[u,l]=QQ.useState(!1),{viewDispatch:d}=QQ.useContext(oze),{connectLoaderState:f}=QQ.useContext(Tze),{checkout:p,provider:h}=f,{track:m}=yBe(),y=async()=>{const e=n();if(m({userJourney:cBe.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())!==MUe(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:aze.UPDATE_VIEW,view:{type:nrt.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:qze(h)?jr.from(0):void 0}});d({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.IN_PROGRESS,data:{transactionResponse:n.transactionResponse,swapForm:e}}}})}catch(e){if(console.error(e),t(!1),e.type===QZ.USER_REJECTED_REQUEST_ERROR)return void l(!0);if(e.type===QZ.UNPREDICTABLE_GAS_LIMIT)return void d({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.PRICE_SURGE,data:i}}});if(e.type===QZ.TRANSACTION_FAILED||e.type===QZ.INSUFFICIENT_FUNDS||e.receipt&&0===e.receipt.status)return void d({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.FAIL,reason:"Transaction failed",data:i}}});d({payload:{type:aze.UPDATE_VIEW,view:{type:rze.ERROR_VIEW,error:e}}})}}};return y1(kae,{sx:rrt,children:[m1(xae,{testId:"swap-button",disabled:e,variant:"primary",onClick:y,size:"large",children:e?m1(xae.Icon,{icon:"Loading",sx:irt}):c("views.SWAP.swapForm.buttonText")}),m1(urt,{visible:u,showHeaderBar:!1,onCloseDrawer:()=>l(!1),onRetry:()=>{y(),l(!1)}})]})}function drt(e,t){const n=QQ.useRef(e),r=QQ.useRef(0);return sse((()=>{n.current=e}),[e]),QQ.useEffect((()=>{if(t||0===t)return r.current=setInterval((()=>n.current()),t),()=>{clearInterval(r.current)}}),[t]),()=>{r.current&&clearInterval(r.current)}}const frt={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x1",height:"100%"},prt={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"base.spacing.x4"},hrt={display:"flex",flexDirection:"column",justifyContent:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},mrt={width:"100%",height:"base.spacing.x16"},yrt={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"base.spacing.x6"};function brt({environment:e,visible:t,showAdjustAmount:n,hasZeroImx:r,onCloseDrawer:i,onAddCoinsClick:a}){const{t:o}=uUe(),s=function(e){return Rze(e,"/tokens/imx.svg")}(e);return m1(Cde,{size:"full",onCloseDrawer:i,visible:t,showHeaderBar:!1,children:m1(Cde.Content,{children:y1(kae,{testId:"not-enough-gas-bottom-sheet",sx:frt,children:[m1(xse,{imageUrl:s,imageResizeServiceUrl:_Ue[e],sx:{w:"base.icon.size.600",h:"base.icon.size.600"}}),m1(Que,{size:"small",sx:prt,testId:"not-enough-gas-heading",children:o(`drawers.notEnoughImx.content.${r?"noImx":"insufficientImx"}.heading`)}),m1(jce,{sx:prt,children:o(`drawers.notEnoughImx.content.${r?"noImx":"insufficientImx"}.body`)}),y1(kae,{sx:hrt,children:[n&&m1(xae,{testId:"not-enough-gas-adjust-amount-button",sx:mrt,variant:"tertiary",onClick:i,children:o("drawers.notEnoughImx.buttons.adjustAmount")}),m1(xae,{testId:"not-enough-gas-add-imx-button",sx:mrt,variant:"tertiary",onClick:a,children:o("drawers.notEnoughImx.buttons.addMoreImx")}),m1(xae,{sx:mrt,variant:"tertiary",onClick:i,testId:"not-enough-gas-cancel-button",children:o("drawers.notEnoughImx.buttons.cancel")})]}),m1(kae,{sx:yrt,children:m1(xie,{testId:"footer-logo-image",logo:"ImmutableHorizontalLockup",sx:{width:"base.spacing.x25"}})})]})})})}const grt={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x4",paddingX:"base.spacing.x4",height:"100%"},vrt={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"base.spacing.x4"},wrt={display:"flex",flexDirection:"column",justifyContent:"flex-end",alignItems:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},Trt={width:"100%",height:"base.spacing.x16",marginBottom:"base.spacing.x16"},Ert={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"base.spacing.x6"},Art={width:"base.icon.size.600",fill:"base.color.status.fatal.bright"};function xrt({visible:e,onCloseDrawer:t}){const{t:n}=uUe();return m1(Cde,{size:"full",onCloseDrawer:t,visible:e,showHeaderBar:!1,children:m1(Cde.Content,{children:y1(kae,{testId:"unable-to-swap-bottom-sheet",sx:grt,children:[m1(Yne,{icon:"Alert",testId:"unable-to-swap-icon",variant:"bold",sx:Art}),m1(Que,{size:"small",sx:vrt,testId:"unable-to-swap-heading",children:n("drawers.unableToSwap.heading")}),m1(jce,{sx:vrt,children:n("drawers.unableToSwap.body")}),m1(kae,{sx:wrt,children:m1(xae,{sx:Trt,variant:"tertiary",onClick:t,testId:"unable-to-swap-cancel-button",children:n("drawers.unableToSwap.buttons.cancel")})}),m1(kae,{sx:Ert,children:m1(xie,{testId:"footer-logo-image",logo:"ImmutableHorizontalLockup",sx:{width:"base.spacing.x25"}})})]})})})}const Ort=(e,t=500)=>{const[n,r]=QQ.useState(e);return QQ.useEffect((()=>{const n=setTimeout((()=>{r(e)}),t);return()=>{clearTimeout(n)}}),[e,t]),n};class Crt{static id=0;promiseId=0;promise;isCancelled=!1;onCancel=null;rejectPromise=()=>{};constructor(e){Crt.id+=1,this.promiseId=Crt.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 Crt(((t,n)=>{Promise.all(e.map((e=>e instanceof Crt?e.promise:e))).then(t,n)}))}then(e,t){return new Crt(((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 Crt(((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}}var Irt;!function(e){e.FROM="FROM",e.TO="TO"}(Irt||(Irt={}));const Srt=({swapFromToken:e,swapToToken:t,swapFromAmount:n,swapToAmount:r,conversion:i})=>{const a={fromToConversion:"",swapToAmount:""};if(!r)return a;if(a.swapToAmount=Sze(r),n&&e&&t){const n=Cze(Sze(Vp(i,t.decimals)),!0);a.fromToConversion=`1 ${e.symbol} ≈ ${n} ${t.symbol}`}return a},_rt=(e,t)=>void 0!==e&&(""!==e&&t!==e);let Prt;function krt({data:e,theme:t}){const{t:n}=uUe(),{swapState:{allowedTokens:r,exchange:i,tokenBalances:a,network:o}}=QQ.useContext(Int),{connectLoaderState:s}=QQ.useContext(Tze),{checkout:c,provider:u}=s,l=Mze(c?.config.environment,t),d=QQ.useCallback(((e,t)=>kze(t)?hUe:`${e.toLowerCase()}-${t.toLowerCase()}`),[]),{cryptoFiatState:f,cryptoFiatDispatch:p}=QQ.useContext(Rnt),{viewDispatch:h}=QQ.useContext(oze),[m,y]=QQ.useState(Irt.FROM),[b,g]=QQ.useState(!1),[v,w]=QQ.useState(jr.from(0)),[T,E]=QQ.useState(""),{track:A}=yBe(),[x,O]=QQ.useState(e?.fromAmount||""),[C,I]=QQ.useState(""),S=Ort(x,bUe),[_,P]=QQ.useState(),[k,R]=QQ.useState(""),[N,M]=QQ.useState(""),[D,L]=QQ.useState(0),[F,B]=QQ.useState(e?.toAmount||""),[j,U]=QQ.useState(""),z=Ort(F,bUe),[H,W]=QQ.useState(),[V,G]=QQ.useState(""),[q,K]=QQ.useState(""),[X,Y]=QQ.useState(null),[J,Z]=QQ.useState(""),[Q,$]=QQ.useState(void 0),[ee,te]=QQ.useState(""),[ne,re]=QQ.useState([]),[ie,ae]=QQ.useState(!1),[oe,se]=QQ.useState(!1),[ce,ue]=QQ.useState(!1);QQ.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:Sze(e.formattedBalance),formattedFiatAmount:0===f.conversions.size?Cze(""):Oze(e.formattedBalance,e.token.symbol||"",f.conversions)}})));re(t),e?.fromTokenAddress&&!_&&(P(r.find((t=>kze(t.address)&&e?.fromTokenAddress?.toLowerCase()===hUe||t.address?.toLowerCase()===e?.fromTokenAddress?.toLowerCase()))),R(a.find((t=>kze(t.token.address)&&e?.fromTokenAddress?.toLowerCase()===hUe||t.token.address?.toLowerCase()===e?.fromTokenAddress?.toLowerCase()))?.formattedBalance??"")),_rt(e?.toTokenAddress,e?.fromTokenAddress)&&!H&&W(r.find((t=>kze(t.address)&&e?.toTokenAddress?.toLowerCase()===hUe||t.address?.toLowerCase()===e?.toTokenAddress?.toLowerCase())))}),[a,r,f.conversions,e?.fromTokenAddress,e?.toTokenAddress,P,R,W,re,d,Cze,o]);const le=QQ.useMemo((()=>r.map((e=>({id:d(e.symbol,e.address),name:e.name,symbol:e.symbol,icon:e.icon})))),[r,_]);QQ.useEffect((()=>{p({payload:{type:knt.SET_TOKEN_SYMBOLS,tokenSymbols:r.map((e=>e.symbol))}})}),[p,r]);const de=()=>{I(""),M(""),U(""),G("")},fe=()=>{Prt&&Prt.cancel(),E(""),te(""),Y(null)},pe=(e,t)=>!Number.isNaN(parseFloat(e))&&(!(parseFloat(e)<=0)&&(!!_&&(!!H&&(!t||!b)))),he=async(e=!1)=>{pe(x,e)&&(Prt&&Prt.cancel(),e||g(!0),await(async(e=!1)=>{if(u&&i&&_&&H){try{e||E("");const t=Mnt.fromAmountIn(i,u,_,x,H),n=Mnt.fromAmountIn(i,u,_,"1",H),a=Crt.all([t,n]);Prt=a;const o=await a,s=o[0],c=o[1];w(c.quote.amount.value);const l=s.swap.gasFeeEstimate;let d=jr.from(l?.value||0);s.approval?.gasFeeEstimate&&(d=d.add(s.approval.gasFeeEstimate.value));const p=Vp(d,mUe),h=l?.token,m=r.find((e=>e.address?.toLocaleLowerCase()===h?.address?.toLocaleLowerCase()));Y(s),Z(p),$({name:m?.name||"",symbol:m?.symbol||"",decimals:m?.decimals||0,address:m?.address,icon:m?.icon}),te(Oze(p,m?.symbol||"",f.conversions)),B(Cze(Sze(Vp(s.quote.amount.value,s.quote.amount.token.decimals),s.quote.amount.token.decimals))),de()}catch(e){e.cancelled||(fe(),ae(!1),se(!0))}e||g(!1)}})(e))},me=(e,t)=>!Number.isNaN(parseFloat(e))&&(!(parseFloat(e)<=0)&&(!!_&&(!!H&&(!t||!b)))),ye=async(e=!1)=>{me(F,e)&&(Prt&&Prt.cancel(),e||g(!0),await(async(e=!1)=>{if(u&&i&&_&&H){try{e||E("");const t=Mnt.fromAmountOut(i,u,H,F,_),n=Mnt.fromAmountIn(i,u,_,"1",H),a=Crt.all([t,n]);Prt=a;const o=await a,s=o[0],c=o[1];w(c.quote.amount.value);const l=s.swap.gasFeeEstimate;let d=jr.from(l?.value||0);s.approval?.gasFeeEstimate&&(d=d.add(s.approval.gasFeeEstimate.value));const p=Vp(d,mUe),h=l?.token,m=r.find((e=>e.symbol===h?.symbol));Y(s),Z(p),$({name:m?.name||"",symbol:m?.symbol||"",decimals:m?.decimals||0,address:m?.address,icon:m?.icon}),te(Oze(p,m?.symbol||"",f.conversions)),O(Cze(Sze(Vp(s.quote.amount.value,s.quote.amount.token.decimals)))),de()}catch(e){e.cancelled||(fe(),ae(!1),se(!0))}e||g(!1)}})(e))},be=async(e=!1)=>{m===Irt.FROM?await he(e):await ye(e)};drt((()=>be(!0)),OUe),QQ.useEffect((()=>{if(m===Irt.FROM){if(S<=0)return g(!1),void fe();(async()=>{await be()})()}}),[S,_,H,D]),QQ.useEffect((()=>{if(m===Irt.TO){if(z<=0)return g(!1),void fe();(async()=>{await be()})()}}),[z,H,_]);const ge=QQ.useMemo((()=>{if(!u)return!0;if(console.log("insufficientFundsForGas checking",qze(u),u),qze(u))return!1;const e=a.find((e=>e.token.address?.toLowerCase()===hUe));if(!e)return!0;const t=_?.address?.toLowerCase()===hUe,n=qp(0!==J.length?J:"0"),r=t&&!Number.isNaN(parseFloat(x))?Gp(x,_?.decimals||18):jr.from("0");return n.add(r).gt(e.balance)}),[J,a,_,x,u]);QQ.useEffect((()=>{x&&_&&K(Oze(x,_.symbol,f.conversions))}),[x,_]);const ve=QQ.useCallback((e=>{const t=a.find((t=>e===d(t.token.symbol,t.token.address)));t&&(H&&e===d(H.symbol,H?.address)&&W(void 0),P(t.token),R(t.formattedBalance),M(""))}),[H]),we=QQ.useCallback((e=>{const t=r.find((t=>e===d(t.symbol,t.address)));t&&(_&&e===d(_.symbol,_?.address)&&P(void 0),W(t),G(""))}),[_]);return QQ.useEffect((()=>{X&&v&&E(Srt({swapFromToken:_,swapFromAmount:x,swapToToken:H,swapToAmount:F,conversion:v}).fromToConversion)}),[X,v]),y1(h1,{children:[y1(kae,{sx:{paddingX:"base.spacing.x4",marginBottom:"base.spacing.x2"},children:[m1(Que,{size:"small",weight:"regular",sx:{paddingBottom:"base.spacing.x4"},children:n("views.SWAP.content.title")}),y1(kae,{sx:{display:"flex",flexDirection:"column",rowGap:"base.spacing.x6",paddingBottom:"base.spacing.x2"},children:[y1(kae,{children:[m1(Que,{size:"xSmall",sx:{display:"flex",justifyContent:"space-between",paddingBottom:"base.spacing.x1"},children:n("views.SWAP.swapForm.from.label")}),m1(Vnt,{testId:"fromTokenInputs",options:ne,selectSubtext:_?`${n("views.SWAP.content.availableBalancePrefix")} ${Sze(k)}`:"",selectTextAlign:"left",textInputType:"number",textInputValue:x,textInputPlaceholder:n("views.SWAP.swapForm.from.inputPlaceholder"),textInputSubtext:`${n("views.SWAP.content.fiatPricePrefix")} \n $${Cze(q,!0)}`,textInputTextAlign:"right",textInputValidator:C1e,onTextInputChange:e=>{return t=e,de(),fe(),B(""),pe(t,!1)&&g(!0),void O(t);var t},onTextInputFocus:()=>{y(Irt.FROM)},textInputMaxButtonClick:()=>{if(!k)return;const e=k.slice(0,k.indexOf(".")+yUe+1);de(),fe(),y(Irt.FROM),B(""),pe(e,!1)&&g(!0),x===e?L(D+1):O(e),A({userJourney:cBe.SWAP,screen:"SwapCoins",control:"MaxFrom",controlType:"Button",extras:{fromBalance:k,fromBalanceTruncated:e}})},onSelectChange:ve,textInputErrorMessage:n(C),selectErrorMessage:n(N),selectedOption:_?d(_.symbol,_.address):void 0,coinSelectorHeading:n("views.SWAP.swapForm.from.selectorTitle"),defaultTokenImage:l})]}),y1(kae,{children:[y1(kae,{sx:{display:"flex",justifyContent:"space-between",paddingBottom:"base.spacing.x1"},children:[m1(Que,{size:"xSmall",children:n("views.SWAP.swapForm.to.label")}),m1(jce,{sx:{color:"base.color.brand.4"},size:"small",children:T})]}),m1(Vnt,{testId:"toTokenInputs",options:le,selectTextAlign:"left",textInputType:"number",textInputValue:F,textInputPlaceholder:n("views.SWAP.swapForm.to.inputPlaceholder"),textInputTextAlign:"right",textInputValidator:C1e,onTextInputChange:e=>{return t=e,de(),fe(),K(""),O(""),me(t,!1)&&g(!0),void B(t);var t},onTextInputFocus:()=>{y(Irt.TO)},onSelectChange:we,textInputErrorMessage:n(j),selectErrorMessage:n(V),selectedOption:H?d(H.symbol,H.address):void 0,coinSelectorHeading:n("views.SWAP.swapForm.to.selectorTitle"),defaultTokenImage:l})]})]}),m1(trt,{gasFeeFiatValue:ee,gasFeeToken:Q,gasFeeValue:J,fees:[{label:n("drawers.feesBreakdown.fees.gasFeeSwap.label"),fiatAmount:`~ ${n("drawers.feesBreakdown.fees.fiatPricePrefix")}${ee}`,amount:Sze(J),prefix:"~"}],onFeesClick:()=>{A({userJourney:cBe.SWAP,screen:"SwapCoins",control:"ViewFees",controlType:"Button"})},sx:{paddingBottom:"0"},loading:b})]}),m1(lrt,{validator:()=>{const e=function(e){return e?"":"views.SWAP.validation.noFromTokenSelected"}(_),t=function(e,t){return e&&0!==parseFloat(e)?t&&Number(e)>Number(t)?"views.SWAP.validation.insufficientBalance":"":"views.SWAP.validation.noAmountInputted"}(x,k),n=function(e){return e?"":"views.SWAP.validation.noToTokenSelected"}(H),r=(i=F)&&0!==parseFloat(i)?"":"views.SWAP.validation.noAmountInputted";var i;m===Irt.FROM?(U(""),t&&I(t)):m===Irt.TO&&(I(""),r&&U(r)),e&&M(e),n&&G(n);let a=!0;return(e||n||t&&m===Irt.FROM||r&&m===Irt.TO)&&(a=!1),A({userJourney:cBe.SWAP,screen:"SwapCoins",control:"FormValid",controlType:"Button",extras:{isSwapFormValid:a,swapFromAddress:_?.address,swapFromAmount:x,swapFromTokenSymbol:_?.symbol,swapToAddress:H?.address,swapToAmount:F,swapToTokenSymbol:H?.symbol}}),a},updateLoading:e=>{g(e)},loading:b,transaction:X,data:{fromAmount:x,toAmount:F,fromTokenSymbol:_?.symbol,fromTokenAddress:_?.address,toTokenSymbol:H?.symbol,toTokenAddress:H?.address},insufficientFundsForGas:ge,openNotEnoughImxDrawer:()=>{se(!1),ae(!0)},openNetworkSwitchDrawer:()=>ue(!0)}),m1(brt,{environment:c?.config.environment??qt.PRODUCTION,visible:ie,showAdjustAmount:_?.address===hUe,hasZeroImx:!1,onAddCoinsClick:()=>{h({payload:{type:aze.UPDATE_VIEW,view:{type:rze.TOP_UP_VIEW},currentViewData:{fromTokenAddress:_?.address??"",fromAmount:x,toTokenAddress:H?.address??""}}})},onCloseDrawer:()=>ae(!1)}),m1(xrt,{visible:oe,onCloseDrawer:()=>{se(!1),P(void 0),O(""),W(void 0),B("")}}),m1(xnt,{visible:ce,targetChainId:MUe(c?.config),provider:u,checkout:c,onCloseDrawer:()=>ue(!1)})]})}const Rrt=(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 Nrt({theme:e,fromAmount:t,toAmount:n,fromTokenAddress:r,toTokenAddress:i}){const{t:a}=uUe(),{viewDispatch:o}=QQ.useContext(oze),{eventTargetState:{eventTarget:s}}=QQ.useContext(g1e),{swapState:{tokenBalances:c}}=QQ.useContext(Int),{connectLoaderState:{checkout:u,provider:l}}=QQ.useContext(Tze),[d,f]=QQ.useState(!1),{page:p}=yBe();return QQ.useEffect((()=>{p({userJourney:cBe.SWAP,screen:"SwapCoins",extras:{fromAmount:t,toAmount:n,fromTokenAddress:r,toTokenAddress:i}})}),[]),QQ.useEffect((()=>{console.log("tokenBalances",c,"isPassportProvider",qze(l),l),Rrt(c,gUe)&&!qze(l)&&f(!0)}),[c]),m1(vBe,{header:m1(cze,{title:a("views.SWAP.header.title"),onCloseButtonClick:()=>k1e(s)}),footer:m1(Ant,{environment:u?.config.environment,theme:e}),children:y1(kae,{sx:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[m1(krt,{data:{fromAmount:t,toAmount:n,fromTokenAddress:r,toTokenAddress:i},theme:e}),m1(brt,{environment:u?.config.environment??qt.PRODUCTION,visible:d,showAdjustAmount:!1,hasZeroImx:!0,onAddCoinsClick:()=>{o({payload:{type:aze.UPDATE_VIEW,view:{type:rze.TOP_UP_VIEW}}})},onCloseDrawer:()=>{f(!1)}})]})})}class Mrt{baseConfig;constructor({baseConfig:e}){this.baseConfig=e}}const Drt={[qt.SANDBOX]:"https://checkout-api.sandbox.immutable.com",[qt.PRODUCTION]:"https://checkout-api.immutable.com"};class Lrt{coinsCache;overridesCache;config;constructor(e){this.coinsCache=null,this.overridesCache=null,this.config=e.baseConfig}urlWithPath(e){return Drt[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 Frt=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,fiatSymbol:t}),t)}catch(e){return new Map}},Brt=["ETH","IMX"];function jrt({environment:e,children:t}){const[n,r]=QQ.useReducer(Nnt,Pnt),{cryptoFiat:i,fiatSymbol:a,tokenSymbols:o}=n;return QQ.useEffect((()=>{r({payload:{type:knt.SET_CRYPTO_FIAT,cryptoFiat:new Lrt(new Mrt({baseConfig:{environment:e}}))}})}),[]),QQ.useEffect((()=>{i&&a&&(async()=>{const e=await Frt(i,a,[...new Set([...o,...Brt])]);r({payload:{type:knt.SET_CONVERSIONS,conversions:e}})})()}),[i,o,a]),m1(Rnt.Provider,{value:{cryptoFiatState:n,cryptoFiatDispatch:r},children:t})}function Urt({transactionResponse:e,swapForm:t}){const{t:n}=uUe(),{viewDispatch:r}=QQ.useContext(oze),{page:i}=yBe();return QQ.useEffect((()=>{i({userJourney:cBe.SWAP,screen:"SwapInProgress",extras:{swapFormInfo:t}})}),[]),QQ.useEffect((()=>{(async()=>{try{const n=await e.wait();if(1===n.status)return void r({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.SUCCESS,data:{fromTokenAddress:t.fromTokenAddress,fromAmount:t.fromAmount,toTokenAddress:t.toTokenAddress,toAmount:t.toAmount||"",transactionHash:n.transactionHash}}}});r({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.FAIL,data:t,reason:"Transaction failed"}}})}catch{r({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.FAIL,data:t,reason:"Transaction failed"}}})}})()}),[e]),m1(wBe,{loadingText:n("views.SWAP.IN_PROGRESS.loading.text")})}function zrt(){return m1(kae,{sx:{...dze,background:"base.color.translucent.emphasis.100"},children:m1(kae,{sx:{...uze,...lze},children:y1("svg",{width:"430",height:"305",viewBox:"0 0 430 305",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[m1("path",{d:"M94.0614 105.632L93.6321 104L92 104.429L92.4292 106.061L94.0614 105.632Z",fill:"white"}),m1("path",{d:"M63.6531 193.101L63.1006 191L60.9996 191.553L61.5521 193.654L63.6531 193.101Z",fill:"white"}),m1("path",{d:"M344.489 224.345L342.345 224L342 226.145L344.144 226.49L344.489 224.345Z",fill:"white"}),m1("path",{d:"M372.286 139.905L372.905 138.619L371.619 138L371 139.286L372.286 139.905Z",fill:"white"}),m1("path",{d:"M341.653 78.101L341.101 76L339 76.5525L339.552 78.6535L341.653 78.101Z",fill:"white"}),m1("path",{d:"M359.286 242.905L359.905 241.619L358.619 241L358 242.286L359.286 242.905Z",fill:"white"}),m1("path",{d:"M87.0123 112.087L86.0869 111L85.0002 111.925L85.9256 113.012L87.0123 112.087Z",fill:"white"}),m1("path",{d:"M84.2862 248.905L84.9053 247.619L83.6192 247L83.0001 248.286L84.2862 248.905Z",fill:"white"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M206.398 211.015C211.246 210.028 215.255 208.497 217.905 206.625",stroke:"#A66CFF",strokeLinecap:"round",strokeLinejoin:"round"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M206.398 203.291C211.246 202.304 215.255 200.774 217.905 198.901",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M206.398 195.569C211.246 194.582 215.255 193.052 217.905 191.179",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M251.375 219.437C256.223 218.45 260.232 216.919 262.882 215.047",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M251.375 211.713C256.223 210.726 260.232 209.195 262.882 207.323",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M251.375 203.99C256.223 203.004 260.232 201.473 262.882 199.601",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M245.426 196.182C250.274 195.195 254.283 193.664 256.932 191.792",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M253.763 186.525C258.612 185.538 262.621 184.007 265.27 182.135",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M202.685 230.306C207.533 229.32 211.542 227.789 214.191 225.917",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),m1("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 Hrt(){return m1(kae,{testId:"wallet-approve-hero",sx:{...dze,background:"base.color.translucent.emphasis.100"},children:m1(kae,{sx:{...uze,...lze},children:y1("svg",{width:"430",height:"305",viewBox:"0 0 430 305",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M159.384 154.519L155.93 147.991L158.939 141.463L162.388 147.991L159.384 154.519Z",fill:"#F191FA"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M232.923 169.903L235.354 164.731",stroke:"black",strokeWidth:"0.469297",strokeMiterlimit:"10"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M273.579 230.377L277.263 229.767L287.024 238.458L278.347 222.051L270.373 223.609L273.579 230.377Z",fill:"black"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M208.107 253.158L205.685 248.573",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),m1("path",{d:"M191.634 240.96H185.758",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),m1("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"}),m1("path",{d:"M356.061 232.632L355.632 231L354 231.429L354.429 233.061L356.061 232.632Z",fill:"white"}),m1("path",{d:"M57.6531 168.341L57.1006 166.24L54.9996 166.793L55.5521 168.894L57.6531 168.341Z",fill:"white"}),m1("path",{d:"M103.489 244.345L101.345 244L101 246.145L103.144 246.49L103.489 244.345Z",fill:"white"}),m1("path",{d:"M341.286 111.905L341.905 110.619L340.619 110L340 111.286L341.286 111.905Z",fill:"white"}),m1("path",{d:"M323.144 179.08L322.592 176.979L320.491 177.531L321.043 179.632L323.144 179.08Z",fill:"white"}),m1("path",{d:"M328.919 177.658L329.538 176.372L328.252 175.753L327.633 177.039L328.919 177.658Z",fill:"white"}),m1("path",{d:"M88.1441 141.383L87.2188 140.296L86.1321 141.221L87.0574 142.308L88.1441 141.383Z",fill:"white"}),m1("path",{d:"M258.286 89.9052L258.905 88.6191L257.619 88L257 89.2861L258.286 89.9052Z",fill:"white"})]})})})}function Wrt({data:e}){const{t:t}=uUe(),{swapState:{allowedTokens:n}}=QQ.useContext(Int),{connectLoaderState:r}=QQ.useContext(Tze),{checkout:i,provider:a}=r,{viewDispatch:o}=QQ.useContext(oze),{eventTargetState:{eventTarget:s}}=QQ.useContext(g1e),c=qze(a),[u,l]=QQ.useState(!1),[d,f]=QQ.useState(!1),[p,h]=QQ.useState(!1),[m,y]=QQ.useState(!1),[b,g]=QQ.useState(!1),[v,w]=QQ.useState(!1),{page:T,track:E}=yBe();QQ.useEffect((()=>{T({userJourney:cBe.SWAP,screen:"ApproveERC20",extras:{swapFormInfo:e.swapFormInfo}})}),[]);const A=QQ.useMemo((()=>n.find((t=>t.address===e.swapFormInfo.fromTokenAddress))),[n,e.swapFormInfo.fromTokenAddress]),x=QQ.useCallback((()=>{o({payload:{type:aze.UPDATE_VIEW,view:{type:rze.ERROR_VIEW,error:new Error("No checkout object or no provider object found")}}})}),[o]),O=QQ.useCallback((()=>{o({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.SWAP,data:e.swapFormInfo}}})}),[o]),C=(e,t)=>{e.type!==QZ.UNPREDICTABLE_GAS_LIMIT?e.type===QZ.TRANSACTION_FAILED||e.type===QZ.INSUFFICIENT_FUNDS||e.receipt&&0===e.receipt.status?o({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.FAIL,reason:"Transaction failed",data:t}}}):(console.error("Approve ERC20 failed",e),o({payload:{type:aze.UPDATE_VIEW,view:{type:rze.ERROR_VIEW,error:e}}})):o({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.PRICE_SURGE,data:t}}})},I=(e,t=!1)=>({...e,gasPrice:t?jr.from(0):void 0}),S=QQ.useCallback((async()=>{if(!m)if(E({userJourney:cBe.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:aze.UPDATE_VIEW,view:{type:nrt.FAIL,data:e.swapFormInfo}}});f(!1),l(!1),h(!0)}catch(t){if(f(!1),l(!1),t.type===QZ.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]),_=QQ.useMemo((()=>y1(yze,{heading:t(`views.APPROVE_ERC20.approveSpending.content.${c?"passport":"metamask"}.heading`),children:[c&&m1(kae,{children:t("views.APPROVE_ERC20.approveSpending.content.passport.body")}),!c&&m1(kae,{children:t("views.APPROVE_ERC20.approveSpending.content.metamask.body",{amount:`${e.swapFormInfo.fromAmount} ${A?.symbol||""}`})})]})),[e.swapFormInfo,A,c]),P=QQ.useMemo((()=>m1(eze,{loading:m,actionText:t(b?"views.APPROVE_ERC20.approveSpending.footer.retryText":"views.APPROVE_ERC20.approveSpending.footer.buttonText"),onActionClick:S})),[b,S,m]),k=QQ.useCallback((async()=>{if(!m)if(E({userJourney:cBe.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:aze.UPDATE_VIEW,view:{type:nrt.IN_PROGRESS,data:{transactionResponse:t.transactionResponse,swapForm:e.swapFormInfo}}}})}catch(t){if(l(!1),t.type===QZ.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=m1(yze,{heading:t("views.APPROVE_ERC20.approveSwap.content.heading"),children:m1(kae,{children:t("views.APPROVE_ERC20.approveSwap.content.body")})}),N=QQ.useMemo((()=>m1(eze,{loading:m,actionText:t(v?"views.APPROVE_ERC20.approveSwap.footer.retryText":"views.APPROVE_ERC20.approveSwap.footer.buttonText"),onActionClick:k})),[v,k,m]);return y1(h1,{children:[d&&m1(wBe,{loadingText:t("views.APPROVE_ERC20.approveSpending.loading.text")}),!d&&m1(vBe,{header:m1(cze,{transparent:!0,showBack:!0,onCloseButtonClick:()=>k1e(s),onBackButtonClick:O}),floatHeader:!0,heroContent:m1(p?Hrt:zrt,{}),footer:p?N:P,children:p?R:_})]})}var Vrt;!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"}(Vrt||(Vrt={}));const Grt=e=>{const{minPercentage:t,maxPercentage:n}=e;return void 0===t||void 0===n?"-.--":`${t}% to ${n}`},qrt=(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=Vp(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 Krt;function Xrt({testId:e,icon:t,heading:n,caption:r,onClick:i,renderFeeFunction:a,isDisabled:o}){return m1(kae,{testId:"top-up-view",sx:{paddingY:"1px"},children:y1(nhe,{testId:`menu-item-${e}`,size:"medium",emphasized:!0,onClick:o?void 0:i,sx:o?{opacity:"0.5",cursor:"not-allowed"}:{},children:[m1(nhe.Icon,{icon:t}),m1(nhe.Label,{size:"medium",children:n}),m1(nhe.IntentIcon,{}),y1(nhe.Caption,{testId:`menu-item-caption-${e}`,children:[r,m1("br",{}),o?"":a("-.--",!1)]})]})})}!function(e){e.ONRAMP="ONRAMP",e.IN_PROGRESS_LOADING="IN_PROGRESS_LOADING",e.IN_PROGRESS="IN_PROGRESS",e.SUCCESS="SUCCESS",e.FAIL="FAIL"}(Krt||(Krt={}));const Yrt={[qt.SANDBOX]:"https://checkout-playground.sandbox.immutable.com",[qt.PRODUCTION]:"https://toolkit.immutable.com"};function Jrt({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}=uUe(),{userJourney:h}=c,{viewDispatch:m}=QQ.useContext(oze),{cryptoFiatState:y,cryptoFiatDispatch:b}=QQ.useContext(Rnt),{conversions:g,fiatSymbol:v}=y,w=t?.config.environment??qt.SANDBOX,{eventTargetState:{eventTarget:T}}=QQ.useContext(g1e),[E,A]=QQ.useState("-.--"),[x,O]=QQ.useState("-.--"),[C,I]=QQ.useState(!0),S=d?p(...d):p("views.TOP_UP_VIEW.header.title"),_=f?p(...f):null,{page:P,track:k}=yBe();QQ.useEffect((()=>{P({userJourney:h,screen:"TopUp"})}),[]),QQ.useEffect((()=>{b&&b({payload:{type:knt.SET_TOKEN_SYMBOLS,tokenSymbols:Brt}})}),[b]),QQ.useEffect((()=>{t&&(async()=>{const e=await t.gasEstimate({gasEstimateType:FZ.BRIDGE_TO_L2}),n=await qrt(e,g);O(n)})()}),[void 0!==t]),QQ.useEffect((()=>{t&&(async()=>{const e=await t.getExchangeFeeEstimate(),n=Grt(e);A(n)})()}),[void 0!==t]),QQ.useEffect((()=>{t&&(async()=>{I(await t.isSwapAvailable())})()}),[void 0!==t]);const R=(e,t,n="Button")=>{k({userJourney:h,screen:"TopUp",control:e,controlType:n,extras:t})},N=e=>m1(kae,{sx:{fontSize:"base.text.caption.small.regular.fontSize",c:"base.color.translucent.standard.600"},children:e}),M=[{testId:"onramp",icon:"BankCard",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.onramp",onClickEvent:()=>{if(e===wZ.IMTBL_ONRAMP_WIDGET_EVENT){const t={tokenAddress:"",amount:""};return m({payload:{type:aze.UPDATE_VIEW,view:{type:Krt.ONRAMP,data:t}}}),void R("OnRamp",{...t,widgetEvent:e})}const t={tokenAddress:o??"",amount:s??""};P1e.sendRequestOnrampEvent(T,e,t),R("OnRamp",{...t,widgetEvent:e})},fee:()=>N(`${p("views.TOP_UP_VIEW.topUpOptions.onramp.subcaption")} ≈ ${E}%`),isAvailable:!0,isEnabled:r},{testId:"swap",icon:"Swap",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.swap",onClickEvent:()=>{if(e===wZ.IMTBL_SWAP_WIDGET_EVENT){const t={toTokenAddress:"",fromAmount:"",fromTokenAddress:""};return m({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.SWAP,data:t}}}),void R("Swap",{...t,widgetEvent:e})}const t={fromTokenAddress:"",toTokenAddress:o??"",amount:""};P1e.sendRequestSwapEvent(T,e,t),R("Swap",{...t,widgetEvent:e})},fee:()=>N(`${p("views.TOP_UP_VIEW.topUpOptions.swap.subcaption")} ≈ $0.05 ${v.toUpperCase()}`),isAvailable:C,isEnabled:i},{testId:"bridge",icon:"Minting",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.bridge",onClickEvent:()=>{if(e===wZ.IMTBL_BRIDGE_WIDGET_EVENT){const t={fromTokenAddress:"",fromAmount:""};return m({payload:{type:aze.UPDATE_VIEW,view:{type:Vrt.WALLET_NETWORK_SELECTION,data:t}}}),void R("Bridge",{...t,widgetEvent:e})}const t={tokenAddress:"",amount:""};P1e.sendRequestBridgeEvent(T,e,t),R("Bridge",{...t,widgetEvent:e})},fee:()=>N(`${p("views.TOP_UP_VIEW.topUpOptions.bridge.subcaption")} ≈ $${x} ${v.toUpperCase()}`),isAvailable:!0,isEnabled:a},{testId:"advanced",icon:"JumpTo",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.advanced",onClickEvent:()=>{const t=Yrt[w];R("AdvancedOptions",{...{tokenAddress:o??"",amount:s??""},widgetEvent:e}),window.open(`${t}/faster-bridge/`,"_blank")},fee:()=>N(""),isAvailable:!0,isEnabled:!0}];return m1(vBe,{header:m1(cze,{onBackButtonClick:l,onCloseButtonClick:u,showBack:!0}),footer:m1(Uze,{}),children:y1(kae,{sx:{paddingX:"base.spacing.x4",paddingY:"base.spacing.x4"},children:[m1(Que,{size:"small",children:S}),_&&m1(jce,{size:"small",sx:{color:"base.color.text.body.secondary"},children:_}),m1(kae,{sx:{paddingY:"base.spacing.x4"},children:M.sort(((e,t)=>Number(t.isAvailable)-Number(e.isAvailable))).map((e=>e.isEnabled&&m1(Xrt,{testId:e.testId,icon:e.icon,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 Zrt=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),Zrt(e,{retries:a,retryIntervalMs:n,nonRetryable:r,nonRetryableSilently:i})}},Qrt=async({checkout:e,provider:t,allowTokenListType:n,chainId:r,allowZero:i=!1,retryPolicy:a=TUe})=>{const o=r||(await e.getNetworkInfo({provider:t})).chainId,s=await t.getSigner().getAddress(),c=await Zrt((()=>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()||hUe,!0)));const d=c.balances.filter((e=>!(e.balance.lte(0)&&!i)&&l.get(e.token.address?.toLowerCase()||hUe))).map((t=>({...t,token:{...t.token,icon:Nze(e.config.environment,kze(t.token.address)?t.token.symbol:t.token.address??"")}})))??[];return u.tokens=u.tokens.map((t=>({...t,icon:Nze(e.config.environment,kze(t.address)?t.symbol:t.address??"")}))),{allowList:u,allowedBalances:d}};function $rt({amount:e,fromTokenAddress:t,toTokenAddress:n,config:r}){const{t:i}=uUe(),{eventTargetState:{eventTarget:a}}=QQ.useContext(g1e),{environment:o,theme:s,isOnRampEnabled:c,isSwapEnabled:u,isBridgeEnabled:l}=r,{connectLoaderState:{checkout:d,provider:f}}=QQ.useContext(Tze),[p,h]=QQ.useReducer(sze,{...ize,history:[]}),[m,y]=QQ.useReducer(Snt,Ont),{page:b}=yBe(),[g,v]=QQ.useState(!1),w=QQ.useMemo((()=>({swapState:m,swapDispatch:y})),[m,y]),T=QQ.useMemo((()=>({viewState:p,viewDispatch:h})),[p,h]),E=QQ.useCallback(((e,t)=>{h({payload:{type:aze.UPDATE_VIEW,view:{type:rze.ERROR_VIEW,tryAgain:t,error:e}}})}),[h]),A=QQ.useCallback((()=>{h({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.SWAP}}})}),[h]),x=QQ.useCallback((async()=>{if(!d)throw new Error("loadBalances: missing checkout");if(!f)throw new Error("loadBalances: missing provider");try{const e=await Qrt({checkout:d,provider:f,allowTokenListType:jZ.SWAP});if(void 0===e)return!1;y({payload:{type:Cnt.SET_ALLOWED_TOKENS,allowedTokens:e.allowList.tokens}}),y({payload:{type:Cnt.SET_TOKEN_BALANCES,tokenBalances:e.allowedBalances}})}catch(e){if(TUe.nonRetryable(e))return E(e,x),!1}return!0}),[d,f]);return QQ.useEffect((()=>{(async()=>{if(!d||!f)return;const e=await d.getNetworkInfo({provider:f});if(e.chainId!==MUe(d.config))return;let t;try{t=await d.config.remote.getConfig("dex")}catch(e){return void E(e)}const n=new fD({chainId:e.chainId,baseConfig:new Xt({environment:o}),secondaryFees:t.secondaryFees,overrides:t.overrides});y({payload:{type:Cnt.SET_EXCHANGE,exchange:n}}),y({payload:{type:Cnt.SET_NETWORK,network:e}}),await x()&&p.view.type===rze.LOADING_VIEW&&A()})()}),[d,f]),m1(oze.Provider,{value:T,children:m1(Int.Provider,{value:w,children:y1(jrt,{environment:o,children:[p.view.type===rze.LOADING_VIEW&&m1(wBe,{loadingText:i("views.LOADING_VIEW.text")}),p.view.type===nrt.SWAP&&m1(Nrt,{theme:s,fromAmount:p.view.data?.fromAmount??e,fromTokenAddress:p.view.data?.fromTokenAddress??t,toTokenAddress:p.view.data?.toTokenAddress??n}),p.view.type===nrt.IN_PROGRESS&&m1(Urt,{transactionResponse:p.view.data.transactionResponse,swapForm:p.view.data.swapForm}),p.view.type===nrt.APPROVE_ERC20&&m1(Wrt,{data:p.view.data}),p.view.type===nrt.SUCCESS&&m1(p1e,{statusText:i("views.SWAP.success.text"),actionText:i("views.SWAP.success.actionText"),onRenderEvent:()=>{b({userJourney:cBe.SWAP,screen:"SwapSuccess",extras:{fromTokenAddress:p.view.data?.fromTokenAddress,fromAmount:p.view.data?.fromAmount,toTokenAddress:p.view.data?.toTokenAddress,toAmount:p.view.data?.toAmount}}),R1e(a,p.view.data.transactionHash)},onActionClick:()=>k1e(a),statusType:a1e.SUCCESS,testId:"success-view"}),p.view.type===nrt.FAIL&&m1(p1e,{statusText:i("views.SWAP.failed.text"),actionText:i("views.SWAP.failed.actionText"),onRenderEvent:()=>{b({userJourney:cBe.SWAP,screen:"SwapFailed"}),N1e(a,"Transaction failed")},onActionClick:()=>{p.view.type===nrt.FAIL&&h({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.SWAP,data:p.view.data}}})},statusType:a1e.FAILURE,onCloseClick:()=>k1e(a),testId:"fail-view"}),p.view.type===nrt.PRICE_SURGE&&m1(p1e,{statusText:i("views.SWAP.rejected.text"),actionText:i("views.SWAP.rejected.actionText"),onRenderEvent:()=>{b({userJourney:cBe.SWAP,screen:"PriceSurge"}),M1e(a,"Price surge")},onActionClick:()=>{p.view.type===nrt.PRICE_SURGE&&h({payload:{type:aze.UPDATE_VIEW,view:{type:nrt.SWAP,data:p.view.data}}})},statusType:a1e.WARNING,onCloseClick:()=>k1e(a),testId:"price-surge-view"}),p.view.type===rze.ERROR_VIEW&&m1(bze,{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:()=>k1e(a),errorEventActionLoading:g}),p.view.type===rze.TOP_UP_VIEW&&m1(Jrt,{analytics:{userJourney:cBe.SWAP},checkout:d,provider:f,widgetEvent:wZ.IMTBL_SWAP_WIDGET_EVENT,showOnrampOption:c,showSwapOption:u,showBridgeOption:l,onCloseButtonClick:()=>k1e(a)})]})})})}var eit=Object.freeze({__proto__:null,default:$rt}),tit=2147483647,nit=36,rit=1,iit=26,ait=38,oit=700,sit=72,cit=128,uit="-",lit=/[^\x20-\x7E]/,dit=/[\x2E\u3002\uFF0E\uFF61]/g,fit={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},pit=nit-rit,hit=Math.floor,mit=String.fromCharCode;
|
|
932
932
|
/*! https://mths.be/punycode v1.4.1 by @mathias */function yit(e){throw new RangeError(fit[e])}function bit(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function git(e,t,n){var r=0;for(e=n?hit(e/oit):e>>1,e+=hit(e/t);e>pit*iit>>1;r+=nit)e=hit(e/pit);return hit(r+(pit+1)*e/(e+ait))}function vit(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(dit,".")).split("."),t).join(".");return r+i}(e,(function(e){return lit.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=cit,n=0,a=sit,o=0;o<f;++o)(d=e[o])<128&&y.push(mit(d));for(r=i=y.length,i&&y.push(uit);r<f;){for(s=tit,o=0;o<f;++o)(d=e[o])>=t&&d<s&&(s=d);for(s-t>hit((tit-n)/(p=r+1))&&yit("overflow"),n+=(s-t)*p,t=s,o=0;o<f;++o)if((d=e[o])<t&&++n>tit&&yit("overflow"),d==t){for(c=n,u=nit;!(c<(l=u<=a?rit:u>=a+iit?iit:u-a));u+=nit)m=c-l,h=nit-l,y.push(mit(bit(l+m%h,0))),c=hit(m/h);y.push(mit(bit(c,0))),a=git(n,p,r==i),n=0,++r}++n,++t}return y.join("")}(e):e}))}function wit(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Tit=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function Eit(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}}function Ait(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 xit=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t};function Oit(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),wit(i,d)?Tit(i[d])?i[d].push(f):i[d]=[i[d],f]:i[d]=f}return i}var Cit={parse:zit,resolve:function(e,t){return zit(e,!1,!0).resolve(t)},resolveObject:function(e,t){return e?zit(e,!1,!0).resolveObject(t):t},fileURLToPath:function(e){if("string"==typeof e)e=(new Iit).parse(e);else if(!(e instanceof Iit))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){dS(e)&&(e=Hit({},e));return Wit(e)},Url:Iit,URL:Jt.URL,URLSearchParams:Jt.URLSearchParams};function Iit(){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 Sit=/^([a-z0-9.+-]+:)/i,_it=/:[0-9]*$/,Pit=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,kit=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),Rit=["'"].concat(kit),Nit=["%","/","?",";","#"].concat(Rit),Mit=["/","?","#"],Dit=255,Lit=/^[+a-z0-9A-Z_-]{0,63}$/,Fit=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Bit={javascript:!0,"javascript:":!0},jit={javascript:!0,"javascript:":!0},Uit={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function zit(e,t,n){if(e&&hS(e)&&e instanceof Iit)return e;var r=new Iit;return r.parse(e,t,n),r}function Hit(e,t,n,r){if(!dS(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=Pit.exec(s);if(c)return e.path=s,e.href=s,e.pathname=c[1],c[2]?(e.search=c[2],e.query=n?Oit(e.search.substr(1)):e.search.substr(1)):n&&(e.search="",e.query={}),e}var u,l,d,f,p=Sit.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&&jit[p]||(s=s.substr(2),e.slashes=!0)}if(!jit[p]&&(m||p&&!Uit[p])){var y,b,g=-1;for(u=0;u<Mit.length;u++)-1!==(l=s.indexOf(Mit[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<Nit.length;u++)-1!==(l=s.indexOf(Nit[u]))&&(-1===g||l<g)&&(g=l);-1===g&&(g=s.length),e.host=s.slice(0,g),s=s.slice(g),Vit(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(Lit)){for(var E="",A=0,x=T.length;A<x;A++)T.charCodeAt(A)>127?E+="x":E+=T[A];if(!E.match(Lit)){var O=w.slice(0,u),C=w.slice(u+1),I=T.match(Fit);I&&(O.push(I[1]),C.unshift(I[2])),C.length&&(s="/"+C.join(".")+s),e.hostname=O.join(".");break}}}}e.hostname.length>Dit?e.hostname="":e.hostname=e.hostname.toLowerCase(),v||(e.hostname=vit(e.hostname)),f=e.port?":"+e.port:"";var S=e.hostname||"";e.host=S+f,e.href+=e.host,v&&(e.hostname=e.hostname.substr(1,e.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!Bit[h])for(u=0,d=Rit.length;u<d;u++){var _=Rit[u];if(-1!==s.indexOf(_)){var P=encodeURIComponent(_);P===_&&(P=escape(_)),s=s.split(_).join(P)}}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=Oit(e.query)),s=s.slice(0,R)):n&&(e.search="",e.query={}),s&&(e.pathname=s),Uit[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=Wit(e),e}function Wit(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&&hS(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?Ait(xit(e),(function(r){var i=encodeURIComponent(Eit(r))+n;return Tit(e[r])?Ait(e[r],(function(e){return i+encodeURIComponent(Eit(e))})).join(t):i+encodeURIComponent(Eit(e[r]))})).join(t):r?encodeURIComponent(Eit(r))+n+encodeURIComponent(Eit(e)):""}(e.query));var s=e.search||o&&"?"+o||"";return n&&":"!==n.substr(-1)&&(n+=":"),e.slashes||(!n||Uit[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 Vit(e){var t=e.host,n=_it.exec(t);n&&(":"!==(n=n[0])&&(e.port=n.substr(1)),t=t.substr(0,t.length-n.length)),t&&(e.hostname=t)}Iit.prototype.parse=function(e,t,n){return Hit(this,e,t,n)},Iit.prototype.format=function(){return Wit(this)},Iit.prototype.resolve=function(e){return this.resolveObject(zit(e,!1,!0)).format()},Iit.prototype.resolveObject=function(e){if(dS(e)){var t=new Iit;t.parse(e,!1,!0),e=t}for(var n,r=new Iit,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 Uit[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!Uit[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||jit[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&&!Uit[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,lS(r.pathname)&&lS(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),lS(r.pathname)&&lS(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},Iit.prototype.parseHost=function(){return Vit(this)};const Git=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"}),qit=e=>({display:e?"block":"none"});var Kit,Xit,Yit,Jit;!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"}(Kit||(Kit={})),function(e){e.PROCESSING="PROCESSING",e.COMPLETED="COMPLETED"}(Xit||(Xit={})),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"}(Yit||(Yit={})),function(e){e.PROCESSING="PROCESSING",e.COMPLETED="COMPLETED"}(Jit||(Jit={}));const Zit=["global.transak.com","global-stg.transak.com"],Qit={[Yit.TRANSAK_WIDGET_OPEN]:{screen:"InputScreen",control:"TransakWidgetOpen",controlType:"IframeEvent"},[Yit.TRANSAK_ORDER_CREATED]:{screen:"InputScreen",control:"OrderCreated",controlType:"IframeEvent"},[`${Yit.TRANSAK_ORDER_SUCCESSFUL}${Jit.PROCESSING}`]:{screen:"OrderInProgress",control:"PaymentProcessing",controlType:"IframeEvent"},[`${Yit.TRANSAK_ORDER_SUCCESSFUL}${Jit.COMPLETED}`]:{screen:"Success",control:"PaymentCompleted",controlType:"IframeEvent"},[Yit.TRANSAK_ORDER_FAILED]:{screen:"Failure",control:"PaymentFailed",controlType:"IframeEvent"}},$it=e=>{const{track:t}=yBe(),{userJourney:n,ref:r,walletAddress:i,isPassportWallet:a,failedToLoadTimeoutInMs:o,onFailedToLoad:s}=e,[c,u]=QQ.useState(!1),l=o||1e4,d=QQ.useRef(void 0),f=QQ.useCallback((e=>{const r=e.event_id,o=[Yit.TRANSAK_ORDER_SUCCESSFUL].includes(r)?`${r}${e.data.status}`:r,s=Qit?.[o]||{};Object.keys(s).length>=0&&t({...s,userJourney:n,extras:{walletAddress:i,isPassportWallet:a}})}),[]),p=QQ.useCallback((t=>{switch(t.event_id){case Yit.TRANSAK_WIDGET_INITIALISED:(t=>{u(!0),clearTimeout(d.current),d.current=void 0,e.onInit?.(t)})(t.data);break;case Yit.TRANSAK_WIDGET_OPEN:e.onOpen?.(t.data);break;case Yit.TRANSAK_ORDER_CREATED:e.onOrderCreated?.(t.data);break;case Yit.TRANSAK_ORDER_SUCCESSFUL:t.data.status===Jit.PROCESSING&&e.onOrderProcessing?.(t.data),t.data.status===Jit.COMPLETED&&e.onOrderCompleted?.(t.data);break;case Yit.TRANSAK_ORDER_FAILED:e.onOrderFailed?.(t.data)}}),[]),h=QQ.useCallback((e=>{const t=zit(e.origin)?.host?.toLowerCase();e.source===r?.current?.contentWindow&&t&&Zit.includes(t)&&(f(e.data),p(e.data),console.log("@@@ Transak event",e))}),[r]);return QQ.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)))}}},eat="transak-iframe",tat=6e3;function nat({passport:e,showIframe:t,tokenAmount:n,tokenAddress:r}){const{connectLoaderState:i}=QQ.useContext(Tze),{checkout:a,provider:o}=i,{eventTargetState:{eventTarget:s}}=QQ.useContext(g1e),{t:c}=uUe(),{viewState:u,viewDispatch:l}=QQ.useContext(oze),[d,f]=QQ.useState(""),p=QQ.useRef(),h=!!e&&o?.provider?.isPassport,m=QQ.useMemo((()=>u.history.length>2&&u.history[u.history.length-2].type===rze.TOP_UP_VIEW),[u.history]),{track:y}=yBe();return QQ.useEffect((()=>{if(!a||!o)return;let t="";(async()=>{const i={exchangeType:ZZ.ONRAMP,web3Provider:o,tokenAddress:r,tokenAmount:n,passport:e};f(await a.createFiatRampUrl(i)),t=await o.getSigner().getAddress()})();const i=document.getElementById(eat);if(!i)return;window.addEventListener("message",(e=>{if(!i)return;const a=Cit.parse(e.origin)?.host?.toLowerCase();e.source===i.contentWindow&&a&&Zit.includes(a)&&((async(e,t)=>{const n={userId:t.toLowerCase(),isPassportWallet:h};switch(e.event_id){case Kit.TRANSAK_WIDGET_OPEN:y({userJourney:cBe.ON_RAMP,screen:"InputScreen",control:"TransakWidgetOpen",controlType:"IframeEvent",extras:{...n}});break;case Kit.TRANSAK_ORDER_CREATED:y({userJourney:cBe.ON_RAMP,screen:"InputScreen",control:"OrderCreated",controlType:"IframeEvent",extras:{...n}});break;case Kit.TRANSAK_ORDER_SUCCESSFUL:e.data.status===Xit.PROCESSING&&y({userJourney:cBe.ON_RAMP,screen:"OrderInProgress",control:"PaymentProcessing",controlType:"IframeEvent",extras:{...n}}),e.data.status===Xit.COMPLETED&&y({userJourney:cBe.ON_RAMP,screen:"Success",control:"PaymentCompleted",controlType:"IframeEvent",extras:{...n}});break;case Kit.TRANSAK_ORDER_FAILED:y({userJourney:cBe.ON_RAMP,screen:"Failure",control:"PaymentFailed",controlType:"IframeEvent",extras:{...n}})}})(e.data,t),(e=>{if(p.current&&clearTimeout(p.current),e.event_id!==Kit.TRANSAK_WIDGET_OPEN)return e.event_id===Kit.TRANSAK_ORDER_SUCCESSFUL&&e.data.status===Xit.PROCESSING?(l({payload:{type:aze.UPDATE_VIEW,view:{type:Krt.IN_PROGRESS_LOADING}}}),void(p.current=window.setTimeout((()=>{l({payload:{type:aze.UPDATE_VIEW,view:{type:Krt.IN_PROGRESS}}})}),tat))):void(e.event_id!==Kit.TRANSAK_ORDER_SUCCESSFUL||e.data.status!==Xit.COMPLETED?e.event_id===Kit.TRANSAK_ORDER_FAILED&&l({payload:{type:aze.UPDATE_VIEW,view:{type:Krt.FAIL,data:{amount:n,tokenAddress:r},reason:`Transaction failed: ${e.data.statusReason}`}}}):l({payload:{type:aze.UPDATE_VIEW,view:{type:Krt.SUCCESS,data:{transactionHash:e.data.transactionHash}}}}));l({payload:{type:aze.UPDATE_VIEW,view:{type:Krt.ONRAMP,data:{amount:u.view.data?.amount??n,tokenAddress:u.view.data?.tokenAddress??r}}}})})(e.data))}))}),[a,o,n,r,e]),m1(kae,{sx:qit(t),children:m1(vBe,{header:m1(cze,{showBack:m,title:c("views.ONRAMP.header.title"),onCloseButtonClick:()=>B1e(s)}),footerBackgroundColor:"base.color.translucent.emphasis.200",children:m1(kae,{sx:Git(t),children:m1("iframe",{title:"Transak",id:eat,src:d,allow:"camera;microphone;fullscreen;payment",style:{height:"100%",width:"100%",border:"none",position:"absolute"}})})})})}function rat(){const{eventTargetState:{eventTarget:e}}=QQ.useContext(g1e),{t:t}=uUe();return m1(vBe,{testId:"order-in-progress-view",header:m1(cze,{transparent:!0,onCloseButtonClick:()=>B1e(e)}),footer:m1(Uze,{}),heroContent:m1(zrt,{}),floatHeader:!0,children:y1(yze,{heading:t("views.ONRAMP.IN_PROGRESS.content.heading"),children:[t("views.ONRAMP.IN_PROGRESS.content.body1"),m1("br",{}),m1("br",{}),t("views.ONRAMP.IN_PROGRESS.content.body2")]})})}function iat({amount:e,tokenAddress:t,config:n}){const{isOnRampEnabled:r,isSwapEnabled:i,isBridgeEnabled:a}=n,[o,s]=QQ.useReducer(sze,{...ize,history:[]}),c=QQ.useMemo((()=>({viewState:o,viewDispatch:s})),[o,sze]),{connectLoaderState:u}=QQ.useContext(Tze),{checkout:l,provider:d}=u,[f,p]=QQ.useState(t),{eventTargetState:{eventTarget:h}}=QQ.useContext(g1e),{t:m}=uUe(),y=QQ.useMemo((()=>o.view.type===Krt.ONRAMP),[o.view.type]);return QQ.useEffect((()=>{l&&d&&(async()=>{if(!(await l.getNetworkInfo({provider:d})).isSupported)return;const e=f?.toLocaleLowerCase()===hUe?hUe:t;p(e)})()}),[l,d,s]),y1(oze.Provider,{value:c,children:[o.view.type===rze.LOADING_VIEW&&m1(wBe,{loadingText:m("views.ONRAMP.initialLoadingText")}),o.view.type===Krt.IN_PROGRESS_LOADING&&m1(wBe,{loadingText:m("views.ONRAMP.IN_PROGRESS_LOADING.loading.text")}),o.view.type===Krt.IN_PROGRESS&&m1(rat,{}),o.view.type===Krt.SUCCESS&&m1(p1e,{statusText:m("views.ONRAMP.SUCCESS.text"),actionText:m("views.ONRAMP.SUCCESS.actionText"),onRenderEvent:()=>j1e(h,o.view.data.transactionHash),onActionClick:()=>B1e(h),statusType:a1e.SUCCESS,testId:"success-view"}),o.view.type===Krt.FAIL&&m1(p1e,{statusText:m("views.ONRAMP.FAIL.text"),actionText:m("views.ONRAMP.FAIL.actionText"),onRenderEvent:()=>U1e(h,o.view.reason??"Transaction failed"),onActionClick:()=>{s({payload:{type:aze.UPDATE_VIEW,view:{type:Krt.ONRAMP,data:o.view.data}}})},statusType:a1e.FAILURE,onCloseClick:()=>B1e(h),testId:"fail-view"}),o.view.type!==Krt.SUCCESS&&o.view.type!==Krt.FAIL&&m1(nat,{passport:l?.passport,showIframe:y,tokenAmount:o.view.data?.amount??e,tokenAddress:o.view.data?.tokenAddress??f}),o.view.type===rze.TOP_UP_VIEW&&m1(Jrt,{analytics:{userJourney:cBe.ON_RAMP},widgetEvent:wZ.IMTBL_ONRAMP_WIDGET_EVENT,checkout:l,provider:d,showOnrampOption:r,showSwapOption:i,showBridgeOption:a,onCloseButtonClick:()=>B1e(h)})]})}var aat=Object.freeze({__proto__:null,default:iat});const oat={walletProviderName:null,network:null,tokenBalances:[],supportedTopUps:null,walletConfig:{showDisconnectButton:!0,showNetworkMenu:!0}};var sat;!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"}(sat||(sat={}));const cat=QQ.createContext({walletState:oat,walletDispatch:()=>{}});cat.displayName="WalletContext";const uat=(e,t)=>{switch(t.payload.type){case sat.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case sat.SET_NETWORK:return{...e,network:t.payload.network};case sat.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case sat.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}},lat=async(e,t)=>{const n=await e.getTokenAllowList({type:jZ.ALL,chainId:t}),r=new Set;return n.tokens.forEach((e=>{r.add(e.symbol)})),Array.from(r)},dat={display:"flex",flexDirection:"row",justifyContent:"space-between",paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"},fat={display:"flex",direction:"row",columnGap:"base.spacing.x1",alignItems:"center"},pat={height:"base.icon.size.250",width:"base.icon.size.250",minWidth:"base.icon.size.250",fill:"base.color.accent.4",cursor:"pointer"};var hat;function mat(e){const{t:t}=uUe(),{viewDispatch:n}=QQ.useContext(oze),{totalBalance:r,loading:i}=e;return y1(kae,{sx:dat,children:[y1(kae,{sx:fat,children:[m1(jce,{size:"medium",children:t("views.WALLET_BALANCES.totalTokenBalance.heading")}),m1(kae,{sx:{pl:"base.spacing.x1"},children:m1(soe,{testId:"coin-info-icon",variant:"tertiary",icon:"Information",sx:pat,onClick:()=>n({payload:{type:aze.UPDATE_VIEW,view:{type:hat.COIN_INFO}}})})})]}),y1(kae,{sx:fat,children:[m1(jce,{testId:"total-token-balance-value",weight:"bold",shimmer:i?1:0,shimmerSx:{minw:"100px"},children:t("views.WALLET_BALANCES.totalTokenBalance.totalHeading")}),!i&&y1(jce,{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"}(hat||(hat={}));const yat=e=>({display:e?"":"none"});function bat({balanceInfo:e,theme:t,bridgeToL2OnClick:n}){const{connectLoaderState:r}=QQ.useContext(Tze),{track:i}=yBe(),{checkout:a,provider:o}=r,s=`≈ USD $${Cze(e.fiatAmount)}`,{walletState:c}=QQ.useContext(cat),{supportedTopUps:u,network:l}=c,[d,f]=QQ.useState(),[p,h]=QQ.useState(),[m,y]=QQ.useState(),{eventTargetState:{eventTarget:b}}=QQ.useContext(g1e),[g,v]=QQ.useState([]),w=qze(o);QQ.useEffect((()=>{(async()=>{if(!a)return;const e=await a.getTokenAllowList({type:jZ.ONRAMP,chainId:MUe(a.config)});v(e.tokens)})()}),[a]),QQ.useEffect((()=>{if(!l||!u||!a)return;const e=l.chainId===MUe(a.config)&&(u?.isOnRampEnabled??!0);f(e);const t=(l.chainId===NUe(a.config)||l.chainId===MUe(a.config))&&(u?.isBridgeEnabled??!0);h(t);const n=l.chainId===MUe(a.config)&&(u?.isSwapEnabled??!0)&&(u?.isSwapAvailable??!0);y(n)}),[l,u,a,w]);const T=QQ.useMemo((()=>Boolean(d&&g.length>0&&g.find((t=>t.address?.toLowerCase()===e.address?.toLowerCase())))),[d,g]);return y1(nhe,{testId:`balance-item-${e.symbol}`,emphasized:!0,children:[m1(nhe.FramedImage,{imageUrl:e.icon,defaultImageUrl:Mze(a?.config.environment,t),circularFrame:!0}),m1(nhe.Label,{children:e.symbol}),m1(nhe.Caption,{children:e.description}),m1(nhe.PriceDisplay,{testId:`balance-item-${e.symbol}`,use:m1(Que,{size:"xSmall"}),price:Sze(e.balance),fiatAmount:s}),(d||m||p)&&y1(nhe.OverflowPopoverMenu,{size:"small",testId:"token-menu",onClick:()=>{i({userJourney:cBe.WALLET,screen:"WalletBalances",control:"BalanceItem",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}})},children:[y1(nhe,{testId:"balance-item-add-option",sx:yat(T),onClick:()=>{i({userJourney:cBe.WALLET,screen:"WalletBalances",control:"AddTokens",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}}),P1e.sendRequestOnrampEvent(b,wZ.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:e.address??"",amount:""})},children:[m1(nhe.Icon,{icon:"Add"}),m1(nhe.Label,{children:`Add ${e.symbol}`})]}),y1(nhe,{testId:"balance-item-swap-option",sx:yat(m),onClick:()=>{i({userJourney:cBe.WALLET,screen:"WalletBalances",control:"SwapTokens",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}}),P1e.sendRequestSwapEvent(b,wZ.IMTBL_WALLET_WIDGET_EVENT,{fromTokenAddress:e.address??"",toTokenAddress:"",amount:""})},children:[m1(nhe.Icon,{icon:"Exchange"}),m1(nhe.Label,{children:`Swap ${e.symbol}`})]}),y1(nhe,{testId:"balance-item-move-option",sx:yat(p),onClick:()=>{i({userJourney:cBe.WALLET,screen:"WalletBalances",control:"MoveTokens",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}}),n(e.address)},children:[m1(nhe.Icon,{icon:"Minting"}),m1(nhe.Label,{children:`Move ${e.symbol}`})]})]})]})}const gat={width:"100%",height:"100%",display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},vat={width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},wat=e=>e.filter((e=>"0.0"!==e.balance||kze(e.address)));function Tat({balanceInfoItems:e,theme:t,bridgeToL2OnClick:n}){const{t:r}=uUe(),i=wat(e);return y1(kae,{sx:gat,children:[0===i.length&&m1(kae,{sx:vat,children:m1(jce,{testId:"no-tokens-found",children:r("views.WALLET_BALANCES.tokenBalancesList.noTokensFound")})}),i.map((e=>m1(bat,{balanceInfo:e,bridgeToL2OnClick:n,theme:t},e.id)))]})}const Eat={display:"flex",flexDirection:"column",alignItems:"flex-start",paddingTop:"base.spacing.x4"},Aat={fontWeight:"base.text.caption.small.bold.fontWeight",borderColor:"base.color.translucent.emphasis.1000",borderStyle:"solid",borderWidth:"base.border.size.200"},xat={fontWeight:"base.text.caption.small.bold.fontWeight"},Oat=(e,t)=>({paddingRight:"base.spacing.x1",width:"22px",fill:t?e:"base.color.brand.4"}),Cat={paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"};function Iat(){const{t:e}=uUe(),{connectLoaderState:t}=QQ.useContext(Tze),{eventTargetState:{eventTarget:n}}=QQ.useContext(g1e),{checkout:r,provider:i}=t,{viewDispatch:a}=QQ.useContext(oze),{walletState:o,walletDispatch:s}=QQ.useContext(cat),{network:c}=o,[u,l]=QQ.useState([]),{track:d}=yBe(),f=QQ.useCallback((async e=>{if(r&&i&&c&&c.chainId!==e){d({userJourney:cBe.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(wZ.IMTBL_WALLET_WIDGET_EVENT,{detail:{type:AZ.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===QZ.USER_REJECTED_REQUEST_ERROR||a({payload:{type:aze.UPDATE_VIEW,view:{type:rze.ERROR_VIEW,error:e}}})}}}),[r,i,c,s,a]);return QQ.useEffect((()=>{(async()=>{if(r){const e=await r.getNetworkAllowList({type:BZ.ALL});l(e?.networks??[])}else l([])})()}),[r]),y1(kae,{testId:"network-menu",sx:Eat,children:[m1(jce,{testId:"network-heading",size:"medium",sx:Cat,children:e("views.WALLET_BALANCES.networkStatus.heading")}),m1($be,{children:r&&u?.sort(((e,t)=>Aze(e,t,r.config))).map((e=>y1($be.Button,{testId:`${e.name}-network-button`,sx:e.chainId===c?.chainId?Aat:xat,size:"small",onClick:()=>f(e.chainId),children:[m1(xae.Icon,{icon:LUe[e.chainId],iconVariant:"bold",sx:Oat(DUe[e.chainId],e.chainId===c?.chainId)}),e.name]},e.chainId)))})]})}const Sat={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x2",flex:1},_at={backgroundColor:"base.color.neutral.800",paddingX:"base.spacing.x1",borderRadius:"base.borderRadius.x6",flex:1},Pat={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},kat=(e,t)=>{let n=460;e&&(n-=104),t&&(n-=98);return{height:`${n}px`,overflowY:"auto",borderRadius:"base.borderRadius.x6"}},Rat=async(e,t,n)=>{if(!e||!t||!n)return[];const r=await t.getSigner().getAddress(),i=await Zrt((()=>e.getAllBalances({provider:t,walletAddress:r,chainId:n})),TUe);if(!i)return[];const a=((e,t,n)=>t.sort(((t,r)=>n===MUe(e)&&"imx"===t.token.symbol.toLowerCase()&&"imx"!==r.token.symbol.toLowerCase()?-1:n===MUe(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:Nze(e.config.environment,kze(t.token.address)?t.token.symbol:t.token.address??"")}})));return a},Nat=(e,t,n)=>n?`${e.toString()}-${t.toLowerCase()}-${n.toLowerCase()}`:`${e.toString()}-${t.toLowerCase()}`,Mat=(e,t,n)=>t.map((t=>({id:Nat(e,t.token.symbol,t.token.address),balance:t.formattedBalance,fiatAmount:Oze(t.formattedBalance,t.token.symbol,n),symbol:t.token.symbol,address:t.token.address,description:t.token.name,icon:t.token.icon})));function Dat({balancesLoading:e,theme:t,showNetworkMenu:n}){const{t:r}=uUe(),{connectLoaderState:i}=QQ.useContext(Tze),{checkout:a,provider:o}=i,{cryptoFiatState:s,cryptoFiatDispatch:c}=QQ.useContext(Rnt),{walletState:u}=QQ.useContext(cat),{eventTargetState:{eventTarget:l}}=QQ.useContext(g1e),{viewDispatch:d}=QQ.useContext(oze),[f,p]=QQ.useState(0),{network:h,supportedTopUps:m,tokenBalances:y}=u,{conversions:b}=s,g=!qze(o)&&n,{track:v,page:w}=yBe(),T=QQ.useMemo((()=>Mat(h?.chainId,y,b)),[y,b,h?.chainId]);QQ.useEffect((()=>{w({userJourney:cBe.WALLET,screen:"WalletBalances"})}),[]),QQ.useEffect((()=>{(async()=>{if(!a)return;if(!c)return;if(!h)return;const e=await lat(a,h.chainId);c({payload:{type:knt.SET_TOKEN_SYMBOLS,tokenSymbols:e}})})()}),[a,c,h?.chainId]),QQ.useEffect((()=>{let e=0;T.forEach((t=>{const n=parseFloat(t.fiatAmount);Number.isNaN(n)||(e+=n)})),p(e)}),[T]);const E=QQ.useMemo((()=>!(!a||!h)&&(h.chainId===MUe(a.config)&&Boolean(m?.isBridgeEnabled||m?.isSwapEnabled||m?.isOnRampEnabled))),[a,h,m]);return m1(vBe,{testId:"wallet-balances",header:m1(cze,{title:r("views.WALLET_BALANCES.header.title"),rightActions:m1(soe,{icon:"SettingsCog",sx:nze(),iconVariant:"bold",onClick:()=>{v({userJourney:cBe.WALLET,screen:"WalletBalances",control:"Settings",controlType:"Button"}),d({payload:{type:aze.UPDATE_VIEW,view:{type:hat.SETTINGS}}})},testId:"settings-button"}),onCloseButtonClick:()=>W1e(l)}),footer:m1(Uze,{}),children:y1(kae,{sx:Sat,children:[y1(kae,{sx:_at,children:[g&&m1(Iat,{}),m1(mat,{totalBalance:f,loading:e}),y1(kae,{sx:kat(g,E),children:[e&&y1(kae,{sx:Pat,children:[m1(nhe,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),m1(nhe,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"}),m1(nhe,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--3"})]}),!e&&m1(Tat,{balanceInfoItems:T,bridgeToL2OnClick:e=>{P1e.sendRequestBridgeEvent(l,wZ.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:e??"",amount:""})},theme:t})]})]}),E&&y1(nhe,{testId:"add-coins",emphasized:!0,onClick:()=>{v({userJourney:cBe.WALLET,screen:"WalletBalances",control:"AddCoins",controlType:"Button"}),d({payload:{type:aze.UPDATE_VIEW,view:{type:rze.TOP_UP_VIEW}}})},children:[m1(nhe.FramedIcon,{icon:"Add"}),m1(nhe.Label,{children:r("views.WALLET_BALANCES.addCoins")})]})]})})}const Lat={width:"100%",height:"88px",display:"flex",flexDirection:"row",justifyContent:"space-between",padding:"24px 11px 24px 32px",backgroundColor:"base.color.translucent.emphasis.400",borderRadius:"base.borderRadius.x6"},Fat={width:"100%",display:"flex"},Bat={width:"318px",display:"flex",flexDirection:"column"},jat={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},Uat={background:"base.color.status.success.bright",fill:"base.color.status.success.bright"};function zat({textToCopy:e}){const[t,n]=QQ.useState(!1),{track:r}=yBe();return m1(kae,{children:e&&m1(kae,{sx:{cursor:"pointer"},children:m1(soe,{sx:t?Uat:{},onClick:()=>{null!=e&&(r({userJourney:cBe.WALLET,screen:"Settings",control:"CopyWalletAddress",controlType:"Button"}),navigator.clipboard.writeText(e)),n(!0),setTimeout((()=>{n(!1)}),3e3)},size:"small",icon:t?"Tick":"CopyText"})})})}function Hat({provider:e}){const[t,n]=QQ.useState("");return QQ.useEffect((()=>{e&&(async()=>{const t=await e.getSigner().getAddress();n(t)})()}),[e]),m1(kae,{sx:Lat,children:y1(kae,{sx:Fat,children:[y1(kae,{sx:Bat,children:[m1(Que,{size:"xSmall",children:"Wallet address"}),m1(jce,{testId:"wallet-address",size:"xSmall",sx:jat,children:t})]}),m1(zat,{textToCopy:t})]})})}const Wat={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x4"},Vat={marginTop:"32px"};function Gat({showDisconnectButton:e}){const{t:t}=uUe(),{connectLoaderState:n}=QQ.useContext(Tze),{provider:r}=n,{eventTargetState:{eventTarget:i}}=QQ.useContext(g1e),{ethereumProvider:a}=B0e(),{page:o}=yBe();QQ.useEffect((()=>{o({userJourney:cBe.WALLET,screen:"Settings"})}),[]);return m1(vBe,{testId:"wallet-balances",header:m1(cze,{showBack:!0,title:t("views.SETTINGS.header.title"),onCloseButtonClick:()=>W1e(i)}),footer:m1(Uze,{}),children:y1(kae,{sx:Wat,children:[m1(Hat,{provider:r}),e&&m1(xae,{testId:"disconnect-button",variant:"secondary",sx:Vat,onClick:()=>{(async()=>{if(Xze(r))try{if(r.provider?.session){const e=r.provider?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>a?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}return void await r.provider.disconnect()}if(a){const e=a?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>a?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}await a.disconnect()}}catch(e){console.error(e)}})().then((()=>{!function(e){const t=new CustomEvent(wZ.IMTBL_WALLET_WIDGET_EVENT,{detail:{type:AZ.DISCONNECT_WALLET,data:{}}});console.log("disconnect wallet event:",e,t),void 0!==e&&e.dispatchEvent(t)}(i)}))},children:t("views.SETTINGS.disconnectButton.label")})]})})}function qat(){return m1(kae,{sx:{...dze,background:"base.color.translucent.emphasis.100"},children:m1(kae,{sx:{...uze,...lze},children:y1("svg",{width:"430",height:"211",viewBox:"0 0 430 211",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[m1("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)"}),m1("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"}),m1("path",{d:"M131.005 34.0566L130.576 32.4244L128.944 32.8537L129.373 34.4858L131.005 34.0566Z",fill:"white"}),m1("path",{d:"M77.1152 45.7678L76.5627 43.6667L74.4617 44.2193L75.0142 46.3203L77.1152 45.7678Z",fill:"white"}),m1("path",{d:"M264.238 30.1945L262.093 29.8494L261.748 31.9942L263.893 32.3394L264.238 30.1945Z",fill:"white"}),m1("path",{d:"M348.157 2.3323L348.776 1.04626L347.49 0.427149L346.871 1.71319L348.157 2.3323Z",fill:"white"}),m1("path",{d:"M342.606 56.5062L342.054 54.4052L339.953 54.9577L340.505 57.0587L342.606 56.5062Z",fill:"white"}),m1("path",{d:"M348.381 55.0847L349 53.7986L347.714 53.1795L347.095 54.4656L348.381 55.0847Z",fill:"white"}),m1("path",{d:"M107.606 18.8096L106.681 17.7229L105.594 18.6483L106.52 19.735L107.606 18.8096Z",fill:"white"}),m1("path",{d:"M233.14 2.3323L233.759 1.04626L232.473 0.427149L231.854 1.71319L233.14 2.3323Z",fill:"white"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("defs",{children:y1("linearGradient",{id:"paint0_linear_4525_125520",x1:"191",y1:"124.403",x2:"247.716",y2:"304.676",gradientUnits:"userSpaceOnUse",children:[m1("stop",{stopColor:"#AD48BA"}),m1("stop",{offset:"0.65625",stopColor:"#D178FF",stopOpacity:"0.24"})]})})]})})})}function Kat(){const{t:e}=uUe(),{connectLoaderState:{provider:t}}=QQ.useContext(Tze),n=qze(t),{page:r}=yBe();return QQ.useEffect((()=>{r({userJourney:cBe.WALLET,screen:"CoinInfo"})}),[]),y1(vBe,{testId:"coin-info",header:m1(cze,{showBack:!0,transparent:!0}),footer:m1(Uze,{}),heroContent:m1(qat,{}),floatHeader:!0,children:[!n&&m1(yze,{heading:e("views.COIN_INFO.metamask.heading"),children:e("views.COIN_INFO.metamask.body")}),n&&y1(yze,{heading:e("views.COIN_INFO.passport.heading"),children:[e("views.COIN_INFO.passport.body1"),m1(xhe,{onClick:()=>window.open(wUe),children:e("views.COIN_INFO.passport.linkText")}),e("views.COIN_INFO.passport.body2")]})]})}var Xat,Yat,Jat,Zat,Qat,$at,eot,tot=Object.freeze({__proto__:null,default:function(e){const{t:t}=uUe(),n=t("views.ERROR_VIEW.actionText"),r=t("views.LOADING_VIEW.text"),{eventTargetState:{eventTarget:i}}=QQ.useContext(g1e),{config:{environment:a,isOnRampEnabled:o,isSwapEnabled:s,isBridgeEnabled:c,theme:u},walletConfig:{showDisconnectButton:l,showNetworkMenu:d}}=e,{connectLoaderState:{checkout:f,provider:p}}=QQ.useContext(Tze),[h,m]=QQ.useReducer(sze,{...ize,history:[]}),[y,b]=QQ.useReducer(uat,{...oat,walletConfig:{showDisconnectButton:l,showNetworkMenu:d}}),g=QQ.useMemo((()=>({walletState:y,walletDispatch:b})),[y,b]),v=QQ.useMemo((()=>({viewState:h,viewDispatch:m})),[h,m]),{balancesLoading:w,refreshBalances:T}=(({checkout:e,provider:t,refreshCallback:n,errorCallback:r})=>{const[i,a]=QQ.useState(!0),o=QQ.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 Rat(e,t,r.chainId);i||a(!1),n(o)}catch(e){TUe.nonRetryable(e)&&r(e),i||a(!1)}}),[e,t]);return drt((()=>o(!0)),3e4),{balancesLoading:i,refreshBalances:o}})({checkout:f,provider:p,refreshCallback:e=>{b({payload:{type:sat.SET_TOKEN_BALANCES,tokenBalances:e}})},errorCallback:e=>{console.error(e),m({payload:{type:aze.UPDATE_VIEW,view:{type:rze.ERROR_VIEW,error:new Error("Unable to fetch balances")}}})}});QQ.useEffect((()=>{(async()=>{if(!f)return;let e;try{e=await f.isSwapAvailable()}catch(t){e=!1}b({payload:{type:sat.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:aze.UPDATE_VIEW,view:{type:hat.WALLET_BALANCES}}}),b({payload:{type:sat.SET_NETWORK,network:e}})}catch(e){console.error(e),m({payload:{type:aze.UPDATE_VIEW,view:{type:rze.ERROR_VIEW,error:e}}})}};return QQ.useEffect((()=>{f&&p&&E()}),[f,p]),m1(oze.Provider,{value:v,children:m1(jrt,{environment:a,children:y1(cat.Provider,{value:g,children:[h.view.type===rze.LOADING_VIEW&&m1(wBe,{loadingText:r}),h.view.type===hat.WALLET_BALANCES&&m1(Dat,{balancesLoading:w,theme:u,showNetworkMenu:d}),h.view.type===hat.SETTINGS&&m1(Gat,{showDisconnectButton:l}),h.view.type===hat.COIN_INFO&&m1(Kat,{}),h.view.type===rze.ERROR_VIEW&&m1(bze,{actionText:n,onActionClick:async()=>{m({payload:{type:aze.UPDATE_VIEW,view:{type:hat.WALLET_BALANCES}}}),await E()},onCloseClick:()=>W1e(i)}),h.view.type===rze.TOP_UP_VIEW&&m1(Jrt,{analytics:{userJourney:cBe.WALLET},widgetEvent:wZ.IMTBL_WALLET_WIDGET_EVENT,checkout:f,provider:p,showOnrampOption:o,showSwapOption:s,showBridgeOption:c,onCloseButtonClick:()=>W1e(i)})]})})})}});!function(e){e.PAYMENT_METHODS="PAYMENT_METHODS",e.PAY_WITH_COINS="PAY_WITH_COINS",e.PAY_WITH_CARD="PAY_WITH_CARD",e.FUND_WITH_SMART_CHECKOUT="FUND_WITH_SMART_CHECKOUT",e.ORDER_SUMMARY="ORDER_SUMMARY",e.SALE_SUCCESS="SALE_SUCCESS",e.SALE_FAIL="SALE_FAIL"}(Xat||(Xat={})),function(e){e.INIT="INIT",e.LOADING="LOADING",e.FUNDING_ROUTE_SELECT="FUNDING_ROUTE_SELECT",e.FUNDING_ROUTE_EXECUTE="FUNDING_ROUTE_EXECUTE"}(Yat||(Yat={})),function(e){e.INIT="INIT",e.REVIEW_ORDER="REVIEW_ORDER",e.EXECUTE_FUNDING_ROUTE="EXECUTE_FUNDING_ROUTE"}(Jat||(Jat={})),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.SMART_CHECKOUT_ERROR="SMART_CHECKOUT_ERROR",e.SMART_CHECKOUT_EXECUTE_ERROR="SMART_CHECKOUT_EXECUTE_ERROR"}(Zat||(Zat={})),function(e){e.FRACTIONAL_BALANCE_BLOCKED="FRACTIONAL_BALANCE_BLOCKED"}(Qat||(Qat={})),function(e){e.CRYPTO="crypto",e.FIAT="fiat"}($at||($at={})),function(e){e.SUFFICIENT="SUFFICIENT"}(eot||(eot={}));const not={[qt.SANDBOX]:"https://api.sandbox.immutable.com/v1/primary-sales",[qt.PRODUCTION]:"https://api.immutable.com/v1/primary-sales"},rot=e=>e.map((({method:e,hash:t})=>`${e}: ${t}`)).join(" | "),iot=e=>e.split(/[_\s-]+/).map((e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase())).join(""),aot=e=>e.replace(/[^\u0000-\u00FF]/g,""),oot=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};var sot;!function(e){e.CONTRACT_ADDRESS="contract_address",e.CURRENCY_SYMBOL="currency_symbol"}(sot||(sot={}));const cot=e=>{const{provider:t,items:n,environment:r,environmentId:i}=e,[a,o]=QQ.useState(void 0),[s,c]=QQ.useState(void 0),[u,l]=QQ.useState({done:!1,transactions:[]}),[d,f]=QQ.useState([]),p=()=>l((e=>({...e,done:!0}))),h=()=>l({done:!1,transactions:[]}),m=QQ.useCallback((async(e,n,r,i,a)=>{let s;try{const o=t?.getSigner(),c=await(t?.getGasPrice()),u=await(o?.sendTransaction({to:e,data:n,gasPrice:c,gasLimit:r}));return(e=>{l((t=>({...t,transactions:[...t.transactions,e]})))})({method:i,hash:u?.hash}),a&&await(u?.wait()),s=u?.hash||"",[s,void 0]}catch(e){const t=`${e?.reason||e?.message||""}`.toLowerCase();s=e?.transactionHash;let n=Zat.WALLET_FAILED;return t.includes("failed")&&t.includes("open confirmation")&&(n=Zat.WALLET_POPUP_BLOCKED),t.includes("rejected")&&t.includes("user")&&(n=Zat.WALLET_REJECTED),t.includes("failed to submit")&&t.includes("highest gas limit")&&(n=Zat.WALLET_REJECTED_NO_FUNDS),(t.includes("status failed")||t.includes("transaction failed"))&&(n=Zat.TRANSACTION_FAILED),o({type:n,data:{error:e}}),[void 0,e]}}),[t]),y=QQ.useCallback((async(e,a)=>{try{const s=t?.getSigner(),u={recipient_address:await(s?.getAddress())||"",payment_type:e,currency_filter:sot.CONTRACT_ADDRESS,currency_value:a,products:n.map((e=>({product_id:e.productId,quantity:e.qty})))},l=`${not[r]}/${i}/order/sign`,d=await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)}),{ok:p,status:h}=d;if(!p){const{code:e}=await d.json();let t;switch(h){case 400:t=Zat.SERVICE_BREAKDOWN;break;case 404:t="insufficient_stock"===e?Zat.INSUFFICIENT_STOCK:Zat.PRODUCT_NOT_FOUND;break;case 429:case 500:t=Zat.DEFAULT;break;default:throw new Error("Unknown error")}return void o({type:t})}const m=await d.json(),y=m.order.products.map((e=>e.detail.map((({token_id:e})=>e)))).flat(),b=((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:oot(r.find((e=>e.method_call.startsWith("execute")))?.params.reference||"")}})(m,n);return f(y),c(b),b}catch(e){o({type:Zat.DEFAULT,data:{error:e}})}}),[n,i,r,t]);return{sign:y,signResponse:s,signError:a,execute:async(e,n,r,i)=>{if(!e||!t)return o({type:Zat.DEFAULT,data:{reason:"No sign data"}}),[];let a=!0;const s=[],c=await(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 Xl(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})(e.transactions,t);for(const e of c){const{tokenAddress:t,rawData:o,methodCall:c,gasEstimate:u}=e,[l,d]=await m(t,o,u,c,n);if(d||!l){a=!1,i(d,s);break}s.push({method:c,hash:l}),r({method:c,hash:l})}return(a?p:h)(),s},executeResponse:u,tokenIds:d}},uot=(e,t)=>{const n=[];for(const t of e.steps)switch(t.type){case JZ.BRIDGE:n.push(t.fees.approvalGasFee),n.push(...t.fees.bridgeFees),n.push(t.fees.bridgeGasFee);break;case JZ.SWAP:n.push(t.fees.approvalGasFee),n.push(...t.fees.swapFees),n.push(t.fees.swapGasFee)}let r=0;for(const e of n)if(e.token){const n=Oze(e.formattedAmount,e.token.symbol,t);r+=parseFloat(n)}return xze(r)},lot=e=>{if(e.sufficient||e.router?.routingOutcome.type!==XZ.ROUTES_FOUND)return[];const t=[];for(const n of e.transactionRequirements){const{token:e}=n.current;t.includes(e.symbol)||t.push(e.symbol)}for(const n of e.router.routingOutcome.fundingRoutes)for(const e of n.steps)t.includes(e.fundingItem.token.symbol)||t.push(e.fundingItem.token.symbol);return t},dot=(e,t,n)=>{const r=e?.data?.transactionRequirements||[],i=r.find((({type:e})=>e===GZ.NATIVE)),a=r.find((({type:e})=>e===GZ.ERC20)),o={erc20:{value:a?.delta.formattedBalance,symbol:n},native:{value:i?.delta.formattedBalance,symbol:"IMX"}};let s=["views.PAYMENT_METHODS.topUp.subheading.both",o];i?.sufficient&&!a?.sufficient&&(s=["views.PAYMENT_METHODS.topUp.subheading.erc20",o]),!i?.sufficient&&a?.sufficient&&(s=["views.PAYMENT_METHODS.topUp.subheading.native",o]);return{amount:a?.delta.formattedBalance||"0",heading:["views.PAYMENT_METHODS.topUp.heading"],subheading:s,tokenAddress:t}},fot=({checkout:e,provider:t,items:n,amount:r,tokenAddress:i})=>{const[a,o]=QQ.useState(void 0),[s,c]=QQ.useState(void 0),u=QQ.useCallback((async()=>{let n;try{const a=t?.getSigner(),s=await(a?.getAddress())||"",c=((e,t,n)=>[{type:GZ.ERC20,tokenAddress:n,spenderAddress:t,amount:e}])(r,s,i),u={type:qZ.GAS,gasToken:{type:KZ.NATIVE,limit:jr.from("30000000")}},l=await(e?.smartCheckout({provider:t,itemRequirements:c,transactionOrGasAmount:u}));if(!l)throw new Error;if(n=((e,t)=>{const n={...e};if(!!t?.provider?.isPassport&&(n.transactionRequirements=e.transactionRequirements.map((e=>e.type===GZ.NATIVE?{...e,sufficient:!0}:e)),n.sufficient=n.transactionRequirements.every((e=>e.sufficient))),n.sufficient||n.router?.routingOutcome.type!==XZ.ROUTES_FOUND)return n;const r=[],i=n.router?.routingOutcome.fundingRoutes.filter((e=>!e.steps.some((e=>r.includes(e.type)))));let a;return a=0===i?.length?{type:XZ.NO_ROUTES_FOUND,message:"Smart Checkout did not find any routes to fulfill the transaction"}:{type:XZ.ROUTES_FOUND,fundingRoutes:i},{...n,router:{...n.router,routingOutcome:a}}})({...l},t),!n.sufficient)throw new Error(Qat.FRACTIONAL_BALANCE_BLOCKED);return o(n),l}catch(e){c({type:Zat.SMART_CHECKOUT_ERROR,data:{error:e,transactionRequirements:n?.transactionRequirements}})}}),[e,t,n,r,i]);return{smartCheckout:u,smartCheckoutResult:a,smartCheckoutError:s}},pot={contractId:"",currencies:[],currencyConversion:{}},hot=({amount:e,environment:t,environmentId:n})=>{const[r,i]=QQ.useState(),a=QQ.useRef(!1),[o,s]=QQ.useState(pot),[c,u]=QQ.useState(void 0);return QQ.useEffect((()=>{t&&n&&e&&(async()=>{if(!a.current)try{a.current=!0;const r=`${not[t]}/${n}/client-config?amount=${e}`,i=await fetch(r,{method:"GET",headers:{"Content-Type":"application/json"}});if(!i.ok)throw new Error(`${i.status} - ${i.statusText}`);const o=(e=>({contractId:e.contract_id,currencies:e.currencies.map((({erc20_address:e,exchange_id:t,...n})=>({...n,address:e,exchangeId:t}))),currencyConversion:Object.entries(e.currency_conversion).reduce(((e,[t,{amount:n,name:r,type:i}])=>(e[t]={amount:n,name:r,type:i},e)),{})}))(await i.json());s(o)}catch(e){u({type:Zat.DEFAULT,data:{reason:"Error fetching settlement currencies"}})}finally{a.current=!1}})()}),[t,n,e]),QQ.useEffect((()=>{if(0===o.currencies.length)return;const e=o.currencies.find((e=>e.base))||o.currencies?.[0];i(e)}),[o]),{clientConfig:o,selectedCurrency:r,clientConfigError:c}},mot=QQ.createContext({items:[],amount:"",collectionName:"",provider:void 0,checkout:void 0,environmentId:"",environment:qt.SANDBOX,recipientAddress:"",recipientEmail:"",sign:()=>Promise.resolve(void 0),execute:()=>Promise.resolve([]),signResponse:void 0,signError:void 0,executeResponse:void 0,passport:void 0,isPassportWallet:!1,paymentMethod:void 0,setPaymentMethod:()=>{},goBackToPaymentMethods:()=>{},goToErrorView:()=>{},goToSuccessView:()=>{},config:{},querySmartCheckout:()=>Promise.resolve(void 0),smartCheckoutResult:void 0,smartCheckoutError:void 0,fundingRoutes:[],disabledPaymentTypes:[],invalidParameters:!1,fromTokenAddress:"",clientConfig:pot,signTokenIds:[],excludePaymentTypes:[],multicurrency:!1,selectedCurrency:void 0});mot.displayName="SaleSaleContext";const yot=1;function bot(e){const{children:t,value:{config:n,environment:r,environmentId:i,items:a,amount:o,provider:s,checkout:c,passport:u,collectionName:l,excludePaymentTypes:d,multicurrency:f}}=e,p=QQ.useRef(0),{viewDispatch:h}=QQ.useContext(oze),[{recipientEmail:m,recipientAddress:y},b]=QQ.useState({recipientEmail:"",recipientAddress:""}),[g,v]=QQ.useState(void 0),[w]=QQ.useState([]),[T,E]=QQ.useState([]),[A,x]=QQ.useState(!1),{selectedCurrency:O,clientConfig:C,clientConfigError:I}=hot({amount:o,environmentId:i,environment:n.environment}),S=O?.address||"",_=QQ.useCallback(((e,t)=>{v(e),h({payload:{type:aze.UPDATE_VIEW,view:{type:Xat.PAYMENT_METHODS,data:t}}})}),[]);QQ.useEffect((()=>{(async()=>{const e=s?.getSigner(),t=await(e?.getAddress())||"",n=(await(u?.getUserInfo()))?.email||"";b({recipientEmail:n,recipientAddress:t})})()}),[s]);const{sign:P,execute:k,signResponse:R,signError:N,executeResponse:M,tokenIds:D}=cot({items:a,provider:s,fromTokenAddress:S,recipientAddress:y,environmentId:i,environment:r}),L=QQ.useCallback((async(e,t,n)=>{const r=t||S;if(!r||!r.startsWith("0x"))return void x(!0);const i=await P(e,r);return i?(n?.(i),i):void 0}),[P,S]),F=QQ.useCallback(((e,t={})=>{p.current+=1,p.current>yot&&(p.current=0,v(void 0)),h({payload:{type:aze.UPDATE_VIEW,view:{type:Xat.SALE_FAIL,data:{...t,errorType:e,paymentMethod:g,transactions:M.transactions}}}})}),[g,v,M]),B=QQ.useCallback((e=>{h({payload:{type:aze.UPDATE_VIEW,view:{type:Xat.SALE_SUCCESS,data:{paymentMethod:g,transactions:M.transactions,tokenIds:D,...e}}}})}),[[g,M,D]]);QQ.useEffect((()=>{N&&F(N.type,N.data)}),[N]),QQ.useEffect((()=>{I&&F(I.type,I.data)}),[I]);const{smartCheckout:j,smartCheckoutResult:U,smartCheckoutError:z}=fot({provider:s,checkout:c,items:a,amount:o,tokenAddress:S});QQ.useEffect((()=>{if(z)return z.data?.error?.message===Qat.FRACTIONAL_BALANCE_BLOCKED?((e=>{E((t=>Array.from(new Set([...t||[],...e]))))})([CZ.CRYPTO]),v(void 0),void h({payload:{type:aze.UPDATE_VIEW,view:{type:rze.TOP_UP_VIEW,data:dot(z,S,O?.name)}}})):void F(z.type,z.data)}),[z]);const H=QQ.useCallback((async e=>{const t=await j();return e?.(t),t}),[j]);QQ.useEffect((()=>{!(!a||0===a.length)&&!(!o||"0"===o)&&l&&i||x(!0)}),[a,o,l,i]),QQ.useEffect((()=>{d?.length<=0||E(d)}),[d]);const W=QQ.useMemo((()=>({config:n,items:a,amount:o,fromTokenAddress:S,sign:L,signResponse:R,signError:N,execute:k,executeResponse:M,environmentId:i,collectionName:l,environment:r,provider:s,checkout:c,recipientAddress:y,recipientEmail:m,paymentMethod:g,setPaymentMethod:v,goBackToPaymentMethods:_,goToErrorView:F,goToSuccessView:B,isPassportWallet:!!s?.provider?.isPassport,querySmartCheckout:H,smartCheckoutResult:U,smartCheckoutError:z,fundingRoutes:w,disabledPaymentTypes:T,invalidParameters:A,clientConfig:C,signTokenIds:D,excludePaymentTypes:d,multicurrency:f,selectedCurrency:O})),[n,r,i,a,o,S,l,s,c,y,m,R,N,M,g,_,F,B,L,H,U,z,w,T,A,C,D,d,f,O]);return m1(mot.Provider,{value:W,children:t})}function got(){return QQ.useContext(mot)}class vot{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=`${iQ[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 wot;!function(e){e.BRIDGE="bridge"}(wot||(wot={}));const Tot={IN_PROGRESS:"in_progress",WITHDRAWAL_PENDING:"withdrawal_pending"},Eot={web3Provider:null,walletProviderName:null,from:null,to:null,tokenBridge:null,tokenBalances:[],allowedTokens:[],token:null,amount:"0"};var Aot;!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"}(Aot||(Aot={}));const xot=QQ.createContext({bridgeState:{...Eot,checkout:{}},bridgeDispatch:()=>{}});xot.displayName="BridgeContext";const Oot=(e,t)=>{switch(t.payload.type){case Aot.SET_WALLETS_AND_NETWORKS:return{...e,from:t.payload.from,to:t.payload.to};case Aot.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case Aot.SET_PROVIDER:return{...e,web3Provider:t.payload.web3Provider};case Aot.SET_TOKEN_BRIDGE:return{...e,tokenBridge:t.payload.tokenBridge};case Aot.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case Aot.SET_ALLOWED_TOKENS:return{...e,allowedTokens:t.payload.allowedTokens};case Aot.SET_TOKEN_AND_AMOUNT:return{...e,token:t.payload.token,amount:t.payload.amount};default:return e}},Cot=(e,t)=>{const n=new CustomEvent(wZ.IMTBL_BRIDGE_WIDGET_EVENT,{detail:{type:IZ.TRANSACTION_SENT,data:{transactionHash:t}}});console.log("bridge success ",e,n),void 0!==e&&e.dispatchEvent(n)},Iot=(e,t)=>{const n=new CustomEvent(wZ.IMTBL_BRIDGE_WIDGET_EVENT,{detail:{type:IZ.FAILURE,data:{reason:t,timestamp:(new Date).getTime()}}});console.log("bridge failed ",e,n),void 0!==e&&e.dispatchEvent(n)};function Sot(e){const t=new CustomEvent(wZ.IMTBL_BRIDGE_WIDGET_EVENT,{detail:{type:IZ.CLOSE_WIDGET,data:{}}});console.log("bridge close ",e,t),void 0!==e&&e.dispatchEvent(t)}const _ot=(e,t)=>{const n=new CustomEvent(wZ.IMTBL_BRIDGE_WIDGET_EVENT,{detail:{type:IZ.CLAIM_WITHDRAWAL_SUCCESS,data:{transactionHash:t}}});console.log("bridge claim withdrawal success event:",e,n),void 0!==e&&e.dispatchEvent(n)},Pot=(e,t,n)=>{const r=new CustomEvent(wZ.IMTBL_BRIDGE_WIDGET_EVENT,{detail:{type:IZ.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 kot(){return y1(Dae,{sx:{gap:"base.spacing.x2"},children:[m1(Ice,{sx:{h:"base.spacing.x4",w:"base.spacing.x32",mt:"base.spacing.x2"}}),m1(nhe,{shimmer:!0,emphasized:!0,size:"small"}),m1(nhe,{shimmer:!0,emphasized:!0,size:"small"}),m1(nhe,{shimmer:!0,emphasized:!0,size:"small"})]})}const Rot={px:"base.spacing.x4",display:"flex",flexDirection:"column",height:"100%"},Not={flexGrow:"1",flexShrink:"0",flexBasis:"0"},Mot={flexGrow:"0",flexShrink:"1",mt:"base.spacing.x2"},Dot={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 Lot({openWalletDrawer:e}){const{t:t}=uUe();return y1(kae,{sx:Dot,children:[m1(jce,{sx:{mb:"base.spacing.x8"},children:t("views.TRANSACTIONS.status.emptyState.notConnected.body")}),m1(xae,{variant:"secondary",size:"medium",testId:"transactions-connect-wallet-button",onClick:e,children:t("views.TRANSACTIONS.status.emptyState.notConnected.buttonText")})]})}const Fot={backgroundColor:"base.color.neutral.800",px:"base.spacing.x4",p:"base.spacing.x5",borderRadius:"base.borderRadius.x6"},Bot={color:"base.color.text.body.secondary"};function jot({checkout:e,isPassport:t}){const{t:n}=uUe(),[r,i]=QQ.useState("");return QQ.useEffect((()=>{e&&i(SUe[e.config.environment])}),[e]),m1(kae,{sx:Fot,children:y1(kae,{sx:{display:"flex",flexDirection:"column"},children:[y1(kae,{children:[m1(jce,{size:"small",children:n("views.TRANSACTIONS.support.body1")}),y1(jce,{size:"small",sx:Bot,children:[n("views.TRANSACTIONS.support.body2"),m1(xhe,{size:"small",rc:m1("a",{target:"_blank",href:n("views.TRANSACTIONS.support.supportLink"),rel:"noreferrer"}),children:n("views.TRANSACTIONS.support.body3")})]})]}),t&&y1(jce,{size:"small",sx:Bot,children:[n("views.TRANSACTIONS.support.passport.body1")," ",m1(xhe,{size:"small",rc:m1("a",{target:"_blank",href:r,rel:"noreferrer"}),children:n("views.TRANSACTIONS.support.passport.body2")})]})]})})}var Uot={},zot=dt(fa),Hot=dt(lo),Wot=dt(ed),Vot=dt(Rr),Got=dt(rs),qot=dt(Id),Kot=dt(cf),Xot=dt(Ki),Yot=dt(lr),Jot=dt(ad),Zot=dt(Rd),Qot=dt(mi),$ot=dt(na),est=dt(hl),tst=dt(Qa),nst=dt(Rl),rst=dt(Kp),ist=dt(df),ast=dt(Sf);!function(e){var t=ut&&ut.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=ut&&ut.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=ut&&ut.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&t(r,e,i);return n(r,e),r};Object.defineProperty(e,"__esModule",{value:!0}),e.formatBytes32String=e.Utf8ErrorFuncs=e.toUtf8String=e.toUtf8CodePoints=e.toUtf8Bytes=e._toEscapedUtf8String=e.nameprep=e.hexDataSlice=e.hexDataLength=e.hexZeroPad=e.hexValue=e.hexStripZeros=e.hexConcat=e.isHexString=e.hexlify=e.base64=e.base58=e.TransactionDescription=e.LogDescription=e.Interface=e.SigningKey=e.HDNode=e.defaultPath=e.isBytesLike=e.isBytes=e.zeroPad=e.stripZeros=e.concat=e.arrayify=e.shallowCopy=e.resolveProperties=e.getStatic=e.defineReadOnly=e.deepCopy=e.checkProperties=e.poll=e.fetchJson=e._fetchData=e.RLP=e.Logger=e.checkResultErrors=e.FormatTypes=e.ParamType=e.FunctionFragment=e.EventFragment=e.ErrorFragment=e.ConstructorFragment=e.Fragment=e.defaultAbiCoder=e.AbiCoder=void 0,e.Indexed=e.Utf8ErrorReason=e.UnicodeNormalizationForm=e.SupportedAlgorithm=e.mnemonicToSeed=e.isValidMnemonic=e.entropyToMnemonic=e.mnemonicToEntropy=e.getAccountPath=e.verifyTypedData=e.verifyMessage=e.recoverPublicKey=e.computePublicKey=e.recoverAddress=e.computeAddress=e.getJsonWalletAddress=e.TransactionTypes=e.serializeTransaction=e.parseTransaction=e.accessListify=e.joinSignature=e.splitSignature=e.soliditySha256=e.solidityKeccak256=e.solidityPack=e.shuffled=e.randomBytes=e.sha512=e.sha256=e.ripemd160=e.keccak256=e.computeHmac=e.commify=e.parseUnits=e.formatUnits=e.parseEther=e.formatEther=e.isAddress=e.getCreate2Address=e.getContractAddress=e.getIcapAddress=e.getAddress=e._TypedDataEncoder=e.id=e.isValidName=e.namehash=e.hashMessage=e.dnsEncode=e.parseBytes32String=void 0;var i=ZP;Object.defineProperty(e,"AbiCoder",{enumerable:!0,get:function(){return i.AbiCoder}}),Object.defineProperty(e,"checkResultErrors",{enumerable:!0,get:function(){return i.checkResultErrors}}),Object.defineProperty(e,"ConstructorFragment",{enumerable:!0,get:function(){return i.ConstructorFragment}}),Object.defineProperty(e,"defaultAbiCoder",{enumerable:!0,get:function(){return i.defaultAbiCoder}}),Object.defineProperty(e,"ErrorFragment",{enumerable:!0,get:function(){return i.ErrorFragment}}),Object.defineProperty(e,"EventFragment",{enumerable:!0,get:function(){return i.EventFragment}}),Object.defineProperty(e,"FormatTypes",{enumerable:!0,get:function(){return i.FormatTypes}}),Object.defineProperty(e,"Fragment",{enumerable:!0,get:function(){return i.Fragment}}),Object.defineProperty(e,"FunctionFragment",{enumerable:!0,get:function(){return i.FunctionFragment}}),Object.defineProperty(e,"Indexed",{enumerable:!0,get:function(){return i.Indexed}}),Object.defineProperty(e,"Interface",{enumerable:!0,get:function(){return i.Interface}}),Object.defineProperty(e,"LogDescription",{enumerable:!0,get:function(){return i.LogDescription}}),Object.defineProperty(e,"ParamType",{enumerable:!0,get:function(){return i.ParamType}}),Object.defineProperty(e,"TransactionDescription",{enumerable:!0,get:function(){return i.TransactionDescription}});var a=zot;Object.defineProperty(e,"getAddress",{enumerable:!0,get:function(){return a.getAddress}}),Object.defineProperty(e,"getCreate2Address",{enumerable:!0,get:function(){return a.getCreate2Address}}),Object.defineProperty(e,"getContractAddress",{enumerable:!0,get:function(){return a.getContractAddress}}),Object.defineProperty(e,"getIcapAddress",{enumerable:!0,get:function(){return a.getIcapAddress}}),Object.defineProperty(e,"isAddress",{enumerable:!0,get:function(){return a.isAddress}});var o=r(Hot);e.base64=o;var s=Wot;Object.defineProperty(e,"base58",{enumerable:!0,get:function(){return s.Base58}});var c=Vot;Object.defineProperty(e,"arrayify",{enumerable:!0,get:function(){return c.arrayify}}),Object.defineProperty(e,"concat",{enumerable:!0,get:function(){return c.concat}}),Object.defineProperty(e,"hexConcat",{enumerable:!0,get:function(){return c.hexConcat}}),Object.defineProperty(e,"hexDataSlice",{enumerable:!0,get:function(){return c.hexDataSlice}}),Object.defineProperty(e,"hexDataLength",{enumerable:!0,get:function(){return c.hexDataLength}}),Object.defineProperty(e,"hexlify",{enumerable:!0,get:function(){return c.hexlify}}),Object.defineProperty(e,"hexStripZeros",{enumerable:!0,get:function(){return c.hexStripZeros}}),Object.defineProperty(e,"hexValue",{enumerable:!0,get:function(){return c.hexValue}}),Object.defineProperty(e,"hexZeroPad",{enumerable:!0,get:function(){return c.hexZeroPad}}),Object.defineProperty(e,"isBytes",{enumerable:!0,get:function(){return c.isBytes}}),Object.defineProperty(e,"isBytesLike",{enumerable:!0,get:function(){return c.isBytesLike}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return c.isHexString}}),Object.defineProperty(e,"joinSignature",{enumerable:!0,get:function(){return c.joinSignature}}),Object.defineProperty(e,"zeroPad",{enumerable:!0,get:function(){return c.zeroPad}}),Object.defineProperty(e,"splitSignature",{enumerable:!0,get:function(){return c.splitSignature}}),Object.defineProperty(e,"stripZeros",{enumerable:!0,get:function(){return c.stripZeros}});var u=Got;Object.defineProperty(e,"_TypedDataEncoder",{enumerable:!0,get:function(){return u._TypedDataEncoder}}),Object.defineProperty(e,"dnsEncode",{enumerable:!0,get:function(){return u.dnsEncode}}),Object.defineProperty(e,"hashMessage",{enumerable:!0,get:function(){return u.hashMessage}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return u.id}}),Object.defineProperty(e,"isValidName",{enumerable:!0,get:function(){return u.isValidName}}),Object.defineProperty(e,"namehash",{enumerable:!0,get:function(){return u.namehash}});var l=qot;Object.defineProperty(e,"defaultPath",{enumerable:!0,get:function(){return l.defaultPath}}),Object.defineProperty(e,"entropyToMnemonic",{enumerable:!0,get:function(){return l.entropyToMnemonic}}),Object.defineProperty(e,"getAccountPath",{enumerable:!0,get:function(){return l.getAccountPath}}),Object.defineProperty(e,"HDNode",{enumerable:!0,get:function(){return l.HDNode}}),Object.defineProperty(e,"isValidMnemonic",{enumerable:!0,get:function(){return l.isValidMnemonic}}),Object.defineProperty(e,"mnemonicToEntropy",{enumerable:!0,get:function(){return l.mnemonicToEntropy}}),Object.defineProperty(e,"mnemonicToSeed",{enumerable:!0,get:function(){return l.mnemonicToSeed}});var d=Kot;Object.defineProperty(e,"getJsonWalletAddress",{enumerable:!0,get:function(){return d.getJsonWalletAddress}});var f=Xot;Object.defineProperty(e,"keccak256",{enumerable:!0,get:function(){return f.keccak256}});var p=Yot;Object.defineProperty(e,"Logger",{enumerable:!0,get:function(){return p.Logger}});var h=Jot;Object.defineProperty(e,"computeHmac",{enumerable:!0,get:function(){return h.computeHmac}}),Object.defineProperty(e,"ripemd160",{enumerable:!0,get:function(){return h.ripemd160}}),Object.defineProperty(e,"sha256",{enumerable:!0,get:function(){return h.sha256}}),Object.defineProperty(e,"sha512",{enumerable:!0,get:function(){return h.sha512}});var m=zN;Object.defineProperty(e,"solidityKeccak256",{enumerable:!0,get:function(){return m.keccak256}}),Object.defineProperty(e,"solidityPack",{enumerable:!0,get:function(){return m.pack}}),Object.defineProperty(e,"soliditySha256",{enumerable:!0,get:function(){return m.sha256}});var y=Zot;Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return y.randomBytes}}),Object.defineProperty(e,"shuffled",{enumerable:!0,get:function(){return y.shuffled}});var b=Qot;Object.defineProperty(e,"checkProperties",{enumerable:!0,get:function(){return b.checkProperties}}),Object.defineProperty(e,"deepCopy",{enumerable:!0,get:function(){return b.deepCopy}}),Object.defineProperty(e,"defineReadOnly",{enumerable:!0,get:function(){return b.defineReadOnly}}),Object.defineProperty(e,"getStatic",{enumerable:!0,get:function(){return b.getStatic}}),Object.defineProperty(e,"resolveProperties",{enumerable:!0,get:function(){return b.resolveProperties}}),Object.defineProperty(e,"shallowCopy",{enumerable:!0,get:function(){return b.shallowCopy}});var g=r($ot);e.RLP=g;var v=est;Object.defineProperty(e,"computePublicKey",{enumerable:!0,get:function(){return v.computePublicKey}}),Object.defineProperty(e,"recoverPublicKey",{enumerable:!0,get:function(){return v.recoverPublicKey}}),Object.defineProperty(e,"SigningKey",{enumerable:!0,get:function(){return v.SigningKey}});var w=tst;Object.defineProperty(e,"formatBytes32String",{enumerable:!0,get:function(){return w.formatBytes32String}}),Object.defineProperty(e,"nameprep",{enumerable:!0,get:function(){return w.nameprep}}),Object.defineProperty(e,"parseBytes32String",{enumerable:!0,get:function(){return w.parseBytes32String}}),Object.defineProperty(e,"_toEscapedUtf8String",{enumerable:!0,get:function(){return w._toEscapedUtf8String}}),Object.defineProperty(e,"toUtf8Bytes",{enumerable:!0,get:function(){return w.toUtf8Bytes}}),Object.defineProperty(e,"toUtf8CodePoints",{enumerable:!0,get:function(){return w.toUtf8CodePoints}}),Object.defineProperty(e,"toUtf8String",{enumerable:!0,get:function(){return w.toUtf8String}}),Object.defineProperty(e,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return w.Utf8ErrorFuncs}});var T=nst;Object.defineProperty(e,"accessListify",{enumerable:!0,get:function(){return T.accessListify}}),Object.defineProperty(e,"computeAddress",{enumerable:!0,get:function(){return T.computeAddress}}),Object.defineProperty(e,"parseTransaction",{enumerable:!0,get:function(){return T.parse}}),Object.defineProperty(e,"recoverAddress",{enumerable:!0,get:function(){return T.recoverAddress}}),Object.defineProperty(e,"serializeTransaction",{enumerable:!0,get:function(){return T.serialize}}),Object.defineProperty(e,"TransactionTypes",{enumerable:!0,get:function(){return T.TransactionTypes}});var E=rst;Object.defineProperty(e,"commify",{enumerable:!0,get:function(){return E.commify}}),Object.defineProperty(e,"formatEther",{enumerable:!0,get:function(){return E.formatEther}}),Object.defineProperty(e,"parseEther",{enumerable:!0,get:function(){return E.parseEther}}),Object.defineProperty(e,"formatUnits",{enumerable:!0,get:function(){return E.formatUnits}}),Object.defineProperty(e,"parseUnits",{enumerable:!0,get:function(){return E.parseUnits}});var A=ist;Object.defineProperty(e,"verifyMessage",{enumerable:!0,get:function(){return A.verifyMessage}}),Object.defineProperty(e,"verifyTypedData",{enumerable:!0,get:function(){return A.verifyTypedData}});var x=ast;Object.defineProperty(e,"_fetchData",{enumerable:!0,get:function(){return x._fetchData}}),Object.defineProperty(e,"fetchJson",{enumerable:!0,get:function(){return x.fetchJson}}),Object.defineProperty(e,"poll",{enumerable:!0,get:function(){return x.poll}});var O=Jot;Object.defineProperty(e,"SupportedAlgorithm",{enumerable:!0,get:function(){return O.SupportedAlgorithm}});var C=tst;Object.defineProperty(e,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return C.UnicodeNormalizationForm}}),Object.defineProperty(e,"Utf8ErrorReason",{enumerable:!0,get:function(){return C.Utf8ErrorReason}})}(Uot);const ost={display:"flex",flexDirection:"column",borderRadius:"base.borderRadius.x4",bg:"base.color.translucent.emphasis.100"},sst={p:"base.spacing.x3",d:"flex",justifyContent:"space-between",position:"relative"},cst={display:"flex",flexGrow:"1",alignItems:"center",gap:"base.spacing.x2"};function ust({transaction:e}){const t=ABe(e.details.from_chain),n=ABe(e.details.to_chain);return y1(kae,{sx:{display:"flex",px:"base.spacing.x4",gap:"base.spacing.x2"},children:[m1(Yne,{icon:LUe[t],sx:{w:"base.icon.size.250",fill:DUe[t]},variant:"bold"}),y1(kae,{sx:{display:"flex",flexDirection:"column",flexGrow:"1"},children:[m1(jce,{size:"xxSmall",sx:{color:"base.color.translucent.standard.900"},children:FUe[t]}),m1(Kme,{size:"xxSmall",sx:{color:"base.color.translucent.standard.600"},text:e.details.from_address})]}),m1(kae,{sx:{flexGrow:"1"}}),m1(Yne,{icon:"ArrowForward",sx:{w:"base.icon.size.250",fill:"base.color.brand.4"}}),m1(kae,{sx:{flexGrow:"1"}}),m1(Yne,{icon:LUe[n],sx:{w:"base.icon.size.250",fill:DUe[n]},variant:"bold"}),y1(kae,{sx:{display:"flex",flexDirection:"column",flexGrow:"1"},children:[m1(jce,{size:"xxSmall",sx:{color:"base.color.translucent.standard.900"},children:FUe[n]}),m1(Kme,{size:"xxSmall",sx:{color:"base.color.translucent.standard.600"},text:e.details.to_address})]})]})}function lst({label:e,details:t,transaction:n,fiatAmount:r,amount:i,icon:a,defaultTokenImage:o}){const{track:s}=yBe(),c=QQ.useMemo((()=>`${t.link}${t.hash}`),[t]);return m1(kae,{testId:`transaction-item-${n.blockchain_metadata.transaction_hash}`,sx:ost,children:y1(Poe,{chevronSide:"right",sx:{button:{p:"base.spacing.x1"},article:{pr:"base.spacing.x10"}},onExpandChange:e=>e&&s({userJourney:cBe.BRIDGE,screen:"TransactionItem",control:"Accordion",controlType:"Button"}),children:[m1(Poe.TargetLeftSlot,{sx:{pr:"base.spacing.x2"},children:y1(nhe,{size:"xSmall",children:[m1(nhe.FramedImage,{imageUrl:a,circularFrame:!0,defaultImageUrl:o}),m1(nhe.Label,{children:e}),m1(nhe.Caption,{children:m1(xhe,{size:"xSmall",rc:m1("a",{target:"_blank",href:c,rel:"noreferrer",onClick:e=>{return n=t,e.stopPropagation(),void s({userJourney:cBe.BRIDGE,screen:"TransactionItem",control:"Details",controlType:"Link",extras:{linkDetail:n}});var n}}),children:t.text})}),m1(nhe.PriceDisplay,{fiatAmount:r,price:i})]})}),y1(Poe.ExpandedContent,{sx:{pr:"0",pl:"0",mb:"base.spacing.x3",gap:"0"},children:[m1(qae,{size:"xSmall",sx:{px:"base.spacing.x2"}}),m1(ust,{transaction:n})]})]})})}const dst=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"}},fst={borderRadius:"base.borderRadius.x4",display:"flex",flexDirection:"column",gap:"base.spacing.x5"};function pst({label:e,transaction:t,fiatAmount:n,amount:r,icon:i,defaultTokenImage:a}){const{viewDispatch:o}=QQ.useContext(oze),{track:s}=yBe(),c=uUe(),u=QQ.useMemo((()=>(new Date).getTime()),[]),l=QQ.useMemo((()=>t.details.current_status.withdrawal_ready_at?new Date(t.details.current_status.withdrawal_ready_at):void 0),[t]),d=t.details.current_status.status===Tot.WITHDRAWAL_PENDING,f=new Intl.RelativeTimeFormat(c[1].language||"en",{numeric:"auto"}),p=QQ.useMemo((()=>{if(!d||void 0===l)return"";const e=(l.getTime()-u)/6e4;if(e<=1)return"in 1 minute";if(e<60)return f.format(Math.ceil(e),"minute");const t=e/60;if(e<1440)return f.format(Math.ceil(t),"hour");const n=t/24;return f.format(Math.ceil(n),"day")}),[u,c[1].language]),h=!!l&&l.getTime()<u,m=QQ.useMemo((()=>!0===h?c.t("views.TRANSACTIONS.status.withdrawalPending.withdrawalReadyText"):`${c.t("views.TRANSACTIONS.status.withdrawalPending.withdrawalDelayText")} ${p}`),[p,c[1].language]);return y1(kae,{testId:`transaction-item-${t.blockchain_metadata.transaction_hash}`,sx:ost,children:[d&&y1(h1,{children:[y1(kae,{sx:sst,children:[y1(kae,{sx:cst,children:[m1(Yne,{icon:"Alert",variant:"bold",sx:{fill:h?"base.color.status.fatal.bright":"base.color.status.attention.bright",w:"base.icon.size.200"}}),m1(jce,{testId:`transaction-item-${t.blockchain_metadata.transaction_hash}-action-message`,size:"xSmall",sx:{color:"base.color.text.body.secondary"},children:m})]}),d&&h&&m1(xae,{testId:`transaction-item-${t.blockchain_metadata.transaction_hash}-action-button`,variant:"primary",size:"small",onClick:()=>{o({payload:{type:aze.UPDATE_VIEW,view:{type:Vrt.CLAIM_WITHDRAWAL,transaction:t}}})},children:c.t("views.TRANSACTIONS.status.withdrawalPending.actionButtonText")})]}),m1(qae,{size:"small",sx:{color:"base.color.translucent.emphasis.300",opacity:.1}})]}),y1(Poe,{chevronSide:"right",sx:{button:{p:"base.spacing.x1"},article:{pr:"base.spacing.x10"},borderTopRightRadius:"0",borderTopLeftRadius:"0"},onExpandChange:e=>e&&s({userJourney:cBe.BRIDGE,screen:"TransactionItem",control:"Accordion",controlType:"Button"}),children:[m1(Poe.TargetLeftSlot,{sx:{pr:"base.spacing.x2"},children:y1(nhe,{size:"xSmall",children:[m1(nhe.FramedImage,{imageUrl:i,circularFrame:!0,defaultImageUrl:a}),m1(nhe.Label,{children:e}),m1(nhe.Caption,{children:c.t("views.TRANSACTIONS.status.withdrawalPending.caption")}),m1(nhe.PriceDisplay,{fiatAmount:n,price:r})]})}),y1(Poe.ExpandedContent,{sx:{pr:"0",pl:"0",mb:"base.spacing.x3",gap:"0"},children:[m1(qae,{size:"xSmall",sx:{px:"base.spacing.x2"}}),m1(ust,{transaction:t})]})]})]})}const hst={display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",p:"base.spacing.x2",pb:"base.spacing.x4"},mst={position:"relative",pr:"base.spacing.x2"},yst={width:"base.icon.size.400"},bst={position:"absolute",top:"-6px",left:"18px",width:"20px",padding:"2px",backgroundColor:"base.color.translucent.inverse.900",borderRadius:"base.borderRadius.x2"},gst={backgroundColor:"transparent",width:"base.icon.size.400",height:"base.icon.size.400",marginRight:"base.spacing.x1",padding:"base.spacing.x1"};function vst({onChangeWalletClick:e}){const{t:t}=uUe(),{bridgeState:{from:n}}=QQ.useContext(xot),[r,i]=QQ.useState(void 0),[a,o]=QQ.useState(!1),{isWalletConnectEnabled:s,getWalletLogoUrl:c}=B0e(),{track:u}=yBe(),l=n?.walletAddress||"",d=n?.walletProviderInfo;return QQ.useEffect((()=>{if(s){const e=Xze(n?.web3Provider);o(e),e&&(async()=>{i(await c())})()}}),[s,n]),y1(kae,{sx:hst,children:[y1(kae,{sx:{display:"flex",alignItems:"center",gap:"base.spacing.x1"},children:[a&&r?y1(kae,{sx:mst,children:[m1(Dse,{imageUrl:r,alt:"walletconnect",sx:yst}),m1(xie,{logo:"WalletConnectSymbol",sx:bst})]}):d&&m1(Gze,{src:d.icon,alt:d.name,sx:gst}),m1(Kme,{leftSideLength:6,rightSideLength:4,text:l})]}),m1(xae,{size:"small",variant:"tertiary",onClick:()=>{u({userJourney:cBe.BRIDGE,screen:Vrt.TRANSACTIONS,controlType:"Button",control:"Pressed"}),e()},children:t("views.TRANSACTIONS.changeWallet.buttonText")})]})}function wst({checkout:e,transactions:t,knownTokenMap:n,isPassport:r,defaultTokenImage:i,changeWallet:a}){const{cryptoFiatState:o}=QQ.useContext(Rnt),{t:s}=uUe(),[c,u]=QQ.useState("");QQ.useEffect((()=>{e&&u(IUe[e.config.environment])}),[e]);const l=QQ.useCallback(((e,t)=>e.details.current_status.status===Tot.WITHDRAWAL_PENDING&&t.details.current_status.status!==Tot.WITHDRAWAL_PENDING?-1:e.details.current_status.status===t.details.current_status.status?0:1),[]),d=QQ.useCallback((t=>kze(t.details.from_token_address)?Nze(e.config.environment,function(e){switch(e){case DZ.ETHEREUM:case DZ.SEPOLIA:return"ETH";case DZ.IMTBL_ZKEVM_TESTNET:case DZ.IMTBL_ZKEVM_MAINNET:case DZ.IMTBL_ZKEVM_DEVNET:return"IMX";default:return""}}(t.details.from_chain)):Nze(e.config.environment,t.details.from_token_address)),[e]);return y1(kae,{sx:dst(r),children:[m1(vst,{onChangeWalletClick:a}),m1(kae,{testId:"move-transaction-list",sx:fst,children:t.sort(l).map((e=>{const t=e.blockchain_metadata.transaction_hash,r=n[e.details.from_chain][e.details.from_token_address.toLowerCase()],a=Uot.formatUnits(e.details.amount,r.decimals),u=Oze(a,r.symbol,o.conversions);return e.details.current_status.status===Tot.WITHDRAWAL_PENDING?m1(pst,{label:r.name,transaction:e,fiatAmount:`${s("views.TRANSACTIONS.fiatPricePrefix")}${u}`,amount:a,icon:d(e),defaultTokenImage:i},t):m1(lst,{label:r.name,details:{text:s("views.TRANSACTIONS.status.inProgress.stepInfo"),link:c,hash:t},transaction:e,fiatAmount:`${s("views.TRANSACTIONS.fiatPricePrefix")}${u}`,amount:a,icon:d(e),defaultTokenImage:i},t)}))})]})}const Tst={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"},Est={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:"base.spacing.x5",flex:1},Ast={mb:"base.spacing.x8",color:"base.color.text.body.secondary"},xst={color:"base.color.text.body.secondary"};function Ost({checkout:e,isPassport:t,changeWallet:n}){const{page:r}=yBe(),{t:i}=uUe(),[a,o]=QQ.useState("");return QQ.useEffect((()=>{e&&o(SUe[e.config.environment])}),[e]),QQ.useEffect((()=>{r({userJourney:cBe.BRIDGE,screen:"NoTransactions"})}),[]),y1(kae,{sx:Tst,children:[m1(vst,{onChangeWalletClick:n}),y1(kae,{sx:Est,children:[m1(jce,{size:"small",sx:Ast,children:i("views.TRANSACTIONS.status.noTransactions.body")}),t&&y1(jce,{size:"small",sx:xst,children:[i("views.TRANSACTIONS.status.noTransactions.passport.body")," ",m1(xhe,{size:"small",rc:m1("a",{target:"_blank",href:a,rel:"noreferrer"}),children:i("views.TRANSACTIONS.status.noTransactions.passport.link")})]})]})]})}function Cst({defaultTokenImage:e,onBackButtonClick:t}){const{eventTargetState:{eventTarget:n}}=QQ.useContext(g1e),{cryptoFiatDispatch:r}=QQ.useContext(Rnt),{bridgeDispatch:i,bridgeState:{checkout:a,from:o}}=QQ.useContext(xot),{page:s}=yBe(),{t:c}=uUe(),{track:u}=yBe(),[l,d]=QQ.useState(!0),[f,p]=QQ.useState(void 0),[h,m]=QQ.useState([]),[y,b]=QQ.useState(!1),g=qze(o?.web3Provider),v=QQ.useCallback((async()=>{if(!a)return{};const e=NUe(a.config);try{return((await a.getTokenAllowList({type:jZ.BRIDGE,chainId:e})).tokens??[]).reduce(((e,t)=>(e[t.address.toLowerCase()]=t,e)),{})}catch(e){return console.error(e),[]}}),[a]),w=QQ.useCallback((async()=>{if(!o?.web3Provider)return{};if(!o?.walletAddress)return{};const e=MUe(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=EBe(NUe(a.config)),n=EBe(MUe(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 xp(a.config.networkMap.get(NUe(a.config))?.rpcUrls[0]),u=new xp(a.config.networkMap.get(MUe(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:knt.SET_TOKEN_SYMBOLS,tokenSymbols:h}}),{[t]:i,[n]:o}},E=QQ.useCallback((async(e,t)=>new vot({env:e}).getTransactions({txType:wot.BRIDGE,fromAddress:t})),[]),A=QQ.useCallback((async e=>{u({userJourney:cBe.BRIDGE,screen:"EmptyStateNotConnected",control:"WalletProvider",controlType:"Select",extras:{walletProviderName:e.providerDetail.info.name}});try{let t=!1;e.providerDetail.info.rdns===WZ.METAMASK&&(t=!0);const n=new Rp(e.provider),r=await Zze(a,n,t),o=await r.getNetwork(),s=await r.getSigner().getAddress();m([]),i({payload:{type:Aot.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=QQ.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}=U0e({checkout:a}),C=QQ.useMemo((()=>O),[O]);return QQ.useEffect((()=>{(async()=>{d(!0);const e=await Zrt(x,EUe);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]),QQ.useEffect((()=>{s({userJourney:cBe.BRIDGE,screen:"Transactions"})}),[]),m1(vBe,{testId:"bridge-view",header:m1(cze,{showBack:!0,onBackButtonClick:()=>{o&&(i({payload:{type:Aot.SET_WALLETS_AND_NETWORKS,from:{web3Provider:o?.web3Provider,walletAddress:o?.walletAddress,walletProviderInfo:o?.walletProviderInfo,network:o?.network},to:null}}),i({payload:{type:Aot.SET_TOKEN_AND_AMOUNT,token:null,amount:""}})),t()},title:c("views.TRANSACTIONS.layoutHeading"),onCloseButtonClick:()=>Sot(n)}),footer:m1(Uze,{}),children:y1(kae,{sx:Rot,children:[y1(kae,{sx:Not,children:[!o?.web3Provider&&m1(Lot,{openWalletDrawer:()=>b(!0)}),o?.web3Provider&&l&&m1(kot,{}),o?.web3Provider&&!l&&h.length>0&&f&&m1(wst,{checkout:a,transactions:h,knownTokenMap:f,isPassport:g,defaultTokenImage:e,changeWallet:()=>b(!0)}),o?.web3Provider&&!l&&0===h.length&&m1(Ost,{checkout:a,isPassport:g,changeWallet:()=>b(!0)})]}),o?.web3Provider&&h.length>0&&m1(kae,{sx:Mot,children:m1(jot,{checkout:a,isPassport:g})}),m1(X0e,{testId:"select-wallet-drawer",drawerText:{heading:c("views.TRANSACTIONS.walletSelection.heading")},showWalletSelectorTarget:!1,walletOptions:C,showDrawer:y,setShowDrawer:e=>{b(e)},onWalletChange:A})]})})}function Ist({transactionResponse:e}){const{t:t}=uUe(),{viewDispatch:n}=QQ.useContext(oze),{page:r}=yBe();return QQ.useEffect((()=>{r({userJourney:cBe.BRIDGE,screen:"ClaimWithdrawalInProgress"})}),[]),QQ.useEffect((()=>{e&&(async()=>{try{const t=await e.wait();if(1===t.status)return void n({payload:{type:aze.UPDATE_VIEW,view:{type:Vrt.CLAIM_WITHDRAWAL_SUCCESS,transactionHash:t.transactionHash}}});n({payload:{type:aze.UPDATE_VIEW,view:{type:Vrt.CLAIM_WITHDRAWAL_FAILURE,transactionHash:t.transactionHash,reason:"Transaction failed"}}})}catch(e){console.error(e),n({payload:{type:aze.UPDATE_VIEW,view:{type:Vrt.CLAIM_WITHDRAWAL_FAILURE,transactionHash:"",reason:"Transaction failed"}}})}})()}),[e]),m1(wBe,{loadingText:t("views.CLAIM_WITHDRAWAL.IN_PROGRESS.loading.text")})}function Sst(e){return e?e.substring(0,6).concat("...").concat(e.substring(e.length-4)):""}const _st={height:"100%",display:"flex",flexDirection:"column",paddingX:"base.spacing.x4"},Pst={paddingTop:"base.spacing.x10",paddingBottom:"base.spacing.x4"},kst={display:"flex",flexDirection:"column",paddingY:"base.spacing.x6"},Rst={[NZ.IMTBL_ZKEVM_DEVNET]:"base.color.text.link.primary",[NZ.IMTBL_ZKEVM_TESTNET]:"base.color.text.link.primary",[NZ.IMTBL_ZKEVM_MAINNET]:"base.color.text.link.primary",[NZ.ETHEREUM]:"base.color.accent.5",[NZ.SEPOLIA]:"base.color.accent.5"},Nst=e=>({backgroundColor:Rst[e],"& svg":{fill:"base.color.brand.2"}});function Mst({testId:e,chainId:t,chainName:n,onNetworkClick:r}){return y1(nhe,{testId:`${e}-network-list-${t}`,size:"medium",emphasized:!0,onClick:async()=>{await r(t)},sx:{marginBottom:"base.spacing.x1"},children:[m1(nhe.FramedIcon,{icon:LUe[t],circularFrame:!0,sx:Nst(t)}),m1(nhe.Label,{size:"medium",children:n})]})}const Dst={[NZ.IMTBL_ZKEVM_DEVNET]:"base.color.text.link.primary",[NZ.IMTBL_ZKEVM_TESTNET]:"base.color.text.link.primary",[NZ.IMTBL_ZKEVM_MAINNET]:"base.color.text.link.primary",[NZ.ETHEREUM]:"base.color.accent.5",[NZ.SEPOLIA]:"base.color.accent.5"},Lst={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"}},Fst={width:"base.icon.size.500",backgroundColor:"base.color.translucent.standard.200",borderRadius:"base.borderRadius.x2"},Bst={position:"absolute",top:"14px",left:"38px",width:"28px",padding:"base.spacing.x1",backgroundColor:"base.color.translucent.inverse.900",borderRadius:"base.borderRadius.x2"},jst={color:"base.color.text.body.secondary"},Ust={paddingY:"base.spacing.x6",borderRadius:"base.borderRadius.x18"},zst=e=>({fill:"base.color.brand.2",width:"base.icon.size.300",backgroundColor:Dst[e],borderRadius:"100%",padding:"base.spacing.x1"});function Hst({testId:e,walletProvider:t,walletProviderDetail:n,walletAddress:r,walletName:i,chainId:a,disableNetworkButton:o=!1,onWalletClick:s,onNetworkClick:c}){const u=TBe(a),[l,d]=QQ.useState(void 0),[f,p]=QQ.useState("Other"),[h,m]=QQ.useState(!1),{isWalletConnectEnabled:y,getWalletLogoUrl:b,getWalletName:g}=B0e(),v=QQ.useMemo((()=>n?.info.rdns===WZ.PASSPORT?i:Xze(t)?f:n?.info.name),[n,f,t]);return QQ.useEffect((()=>{if(y){const e=Xze(t);m(e),e&&((async()=>{d(await b())})(),p(g()))}}),[y,t,b,g]),y1(kae,{testId:`${e}-${n?.info.rdns}-${a}-button-wrapper`,sx:Lst,onClick:s,children:[h&&l?y1(h1,{children:[m1(Dse,{imageUrl:l,alt:"walletconnect",sx:Fst}),m1(xie,{logo:"WalletConnectSymbol",sx:Bst})]}):n&&m1(Gze,{src:n.info.icon,alt:n.info.name}),y1(kae,{sx:{display:"flex",flexDirection:"column",flex:1},children:[m1(Que,{size:"xSmall",sx:{textTransform:"capitalize"},children:v}),m1(jce,{size:"xSmall",sx:jst,children:r})]}),y1(xae,{testId:`${e}-network-${a}-button`,size:"small",disabled:o,onClick:e=>{e.stopPropagation(),c(e)},variant:"tertiary",sx:Ust,children:[m1(xae.Icon,{icon:LUe[a],sx:zst(a)}),u]})]})}const Wst="wallet-network-selector";function Vst(){const{t:e}=uUe(),{bridgeState:{checkout:t,from:n,to:r},bridgeDispatch:i}=QQ.useContext(xot),{viewDispatch:a}=QQ.useContext(oze),{providers:o}=U0e({checkout:t}),{track:s}=yBe(),c=n?.web3Provider??null,u=n?.network??null,l=n?.walletAddress?.toLowerCase()??"",d=n?{provider:c,providerDetail:{provider:c,info:{...n.walletProviderInfo}}}:null,f=r?.web3Provider??null,p=r?.network??null,h=r?.walletAddress?.toLowerCase()??"",m=r?{provider:f,providerDetail:{provider:f,info:{...r.walletProviderInfo}}}:null,y=NUe(t.config),b=TBe(y),g=MUe(t.config),v=TBe(g),[w,T]=QQ.useState(!1),[E,A]=QQ.useState(!1),[x,O]=QQ.useState(c),[C,I]=QQ.useState(u),[S,_]=QQ.useState(l),[P,k]=QQ.useState(d),[R,N]=QQ.useState(!1),[M,D]=QQ.useState(f),[L,F]=QQ.useState(p),[B,j]=QQ.useState(h),[U,z]=QQ.useState(m),H=x&&C,W=M&&L,V=QQ.useMemo((()=>x?Yze(x):null),[x]),G=QQ.useMemo((()=>M?Yze(M):null),[M]),q=QQ.useMemo((()=>o),[o]),K=QQ.useMemo((()=>o.filter((e=>e.info.rdns!==WZ.PASSPORT||e.info.rdns===WZ.PASSPORT&&C===y))),[o,C]);function X(){D(null),F(null)}QQ.useEffect((()=>{n&&r&&i({payload:{type:Aot.SET_WALLETS_AND_NETWORKS,from:null,to:null}})}),[n,r]);const Y=QQ.useCallback((async e=>{X(),k(e);let n=!1;e.providerDetail.info.rdns===WZ.METAMASK&&(n=!0);const r=new Rp(e.provider),i=await Zze(t,r,n);await(async e=>{O(e);const t=await e.getSigner().getAddress();if(_(t.toLowerCase()),s({userJourney:cBe.BRIDGE,screen:"WalletAndNetwork",control:"FromWallet",controlType:"Select",extras:{walletAddress:t.toLowerCase()}}),qze(e))return I(g),T(!1),void s({userJourney:cBe.BRIDGE,screen:"WalletAndNetwork",control:"FromNetwork",controlType:"Select",extras:{chainId:g}});I(null),T(!1),setTimeout((()=>A(!0)),500)})(i)}),[t]),J=QQ.useCallback((async e=>{x&&(X(),A(!1),I(e),s({userJourney:cBe.BRIDGE,screen:"WalletAndNetwork",control:"FromNetwork",controlType:"Select",extras:{chainId:e}}))}),[t,x]),Z=QQ.useCallback((()=>{const e=C===y?g:y;F(e),N(!1),s({userJourney:cBe.BRIDGE,screen:"WalletAndNetwork",control:"ToNetwork",controlType:"Select",extras:{chainId:e}})}),[C]),Q=QQ.useCallback((e=>{D(e),e.getSigner().getAddress().then((e=>{j(e.toLowerCase()),Z(),s({userJourney:cBe.BRIDGE,screen:"WalletAndNetwork",control:"ToWallet",controlType:"Select",extras:{walletAddress:e.toLowerCase()}})}))}),[Z]),$=QQ.useCallback((async e=>{if(P?.providerDetail.info.rdns===e.providerDetail.info.rdns){D(x),z(e);const t=await x.getSigner().getAddress();return j(t.toLowerCase()),Z(),void s({userJourney:cBe.BRIDGE,screen:"WalletAndNetwork",control:"ToWallet",controlType:"Select",extras:{walletAddress:t.toLowerCase()}})}try{z(e);const n=new Rp(e.provider),r=await Zze(t,n,!1);if(Xze(r))Q(r),Z();else{D(r);const e=await r.getSigner().getAddress();j(e.toLowerCase()),Z(),s({userJourney:cBe.BRIDGE,screen:"WalletAndNetwork",control:"ToWallet",controlType:"Select",extras:{walletAddress:e.toLowerCase()}})}}catch(e){console.error(e)}}),[V,x,Z,Q]),ee=QQ.useCallback((()=>{x&&C&&M&&L&&(i({payload:{type:Aot.SET_TOKEN_BALANCES,tokenBalances:[]}}),i({payload:{type:Aot.SET_ALLOWED_TOKENS,allowedTokens:[]}}),i({payload:{type:Aot.SET_WALLETS_AND_NETWORKS,from:{web3Provider:x,walletAddress:S.toLowerCase(),walletProviderInfo:P?.providerDetail.info,network:C},to:{web3Provider:M,walletAddress:B.toLowerCase(),walletProviderInfo:U?.providerDetail.info,network:L}}}),s({userJourney:cBe.BRIDGE,screen:"WalletAndNetwork",control:"Next",controlType:"Button",extras:{fromWalletAddress:S,fromNetwork:C,fromWallet:{address:S,rdns:P?.providerDetail.info.rdns,uuid:P?.providerDetail.info.uuid,isPassportWallet:qze(x),isMetaMask:Kze(x)},toWalletAddress:B,toNetwork:L,toWallet:{address:B,rdns:U?.providerDetail.info.rdns,uuid:U?.providerDetail.info.uuid,isPassportWallet:qze(M),isMetaMask:Kze(M)}}}),a({payload:{type:aze.UPDATE_VIEW,view:{type:Vrt.BRIDGE_FORM}}}))}),[P,x,C,S,U,M,L,B]);return y1(kae,{testId:Wst,sx:_st,children:[m1(Que,{testId:`${Wst}-heading`,size:"small",weight:"regular",sx:Pst,children:e("views.WALLET_NETWORK_SELECTION.heading")}),m1(Que,{size:"xSmall",sx:{paddingBottom:"base.spacing.x2"},children:e("views.WALLET_NETWORK_SELECTION.fromFormInput.heading")}),m1(X0e,{testId:`${Wst}-from`,drawerText:{heading:e("views.WALLET_NETWORK_SELECTION.fromFormInput.walletSelectorHeading"),defaultText:e("views.WALLET_NETWORK_SELECTION.fromFormInput.selectDefaultText")},showWalletSelectorTarget:!H,showDrawer:w,setShowDrawer:T,walletOptions:q,onWalletChange:Y}),H&&V&&y1(kae,{sx:{display:"flex",flexDirection:"column",gap:"base.spacing.x10"},children:[m1(Hst,{testId:Wst,walletProviderDetail:P?.providerDetail,walletProvider:x,walletName:V,walletAddress:Sst(S),chainId:C,onWalletClick:()=>{T(!0)},onNetworkClick:()=>A(!0)}),y1(kae,{children:[m1(Que,{size:"xSmall",sx:{paddingBottom:"base.spacing.x2"},children:e("views.WALLET_NETWORK_SELECTION.toFormInput.heading")}),m1(X0e,{testId:`${Wst}-to`,drawerText:{heading:e("views.WALLET_NETWORK_SELECTION.toFormInput.walletSelectorHeading"),defaultText:e("views.WALLET_NETWORK_SELECTION.toFormInput.selectDefaultText")},showWalletSelectorTarget:!W,walletOptions:K,showDrawer:R,setShowDrawer:N,onWalletChange:$})]})]}),m1(Cde,{headerBarTitle:e("views.WALLET_NETWORK_SELECTION.fromFormInput.networkSelectorHeading"),size:"full",onCloseDrawer:()=>{A(!1)},visible:E,children:y1(Cde.Content,{sx:{paddingX:"base.spacing.x4"},children:[m1(Mst,{testId:Wst,chainName:v,onNetworkClick:J,chainId:g},v),P?.providerDetail.info.rdns!==WZ.PASSPORT&&m1(Mst,{testId:Wst,chainName:b,onNetworkClick:J,chainId:y},b)]})}),W&&G&&y1(kae,{sx:{flex:1,display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[m1(Hst,{testId:Wst,walletProviderDetail:U?.providerDetail,walletProvider:M,walletName:G,walletAddress:Sst(B),chainId:L,disableNetworkButton:!0,onWalletClick:()=>{N(!0)},onNetworkClick:()=>{}}),m1(kae,{sx:kst,children:m1(xae,{testId:`${Wst}-submit-button`,size:"large",onClick:ee,children:e("views.WALLET_NETWORK_SELECTION.submitButton.text")})})]})]})}function Gst(){const{t:e}=uUe(),{viewDispatch:t}=QQ.useContext(oze),{eventTargetState:{eventTarget:n}}=QQ.useContext(g1e),{page:r}=yBe();return QQ.useEffect((()=>{r({userJourney:cBe.BRIDGE,screen:"WalletNetworkSelection"})}),[]),m1(vBe,{testId:"bridge-view",header:m1(cze,{title:e("views.WALLET_NETWORK_SELECTION.layoutHeading"),onCloseButtonClick:()=>Sot(n),rightActions:m1(soe,{icon:"Minting",sx:nze(),onClick:()=>{t({payload:{type:aze.UPDATE_VIEW,view:{type:Vrt.TRANSACTIONS}}})},testId:"move-transactions-button"})}),footer:m1(Uze,{}),children:m1(Vst,{})})}function qst(e,t){return e&&0!==parseFloat(e)?t&&Number(e)>Number(t)?"views.BRIDGE_FORM.validation.insufficientBalance":"":"views.BRIDGE_FORM.validation.noAmountInputted"}const Kst={height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between",paddingTop:"base.spacing.x10"},Xst={paddingTop:"base.spacing.x4",display:"flex",gap:"base.spacing.x1"},Yst={display:"flex",flexDirection:"column",paddingY:"base.spacing.x6",paddingX:"base.spacing.x4"};function Jst({sx:e}){return y1(kae,{sx:{...e,paddingTop:"0",marginTop:"base.spacing.x4"},rc:m1("div",{}),children:[m1(kae,{sx:{display:"flex",backgroundColor:"#F3F3F30A",borderRadius:"8px"},children:m1(kae,{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:m1("span",{}),children:m1(Ice,{rc:m1("span",{})})})}),m1(kae,{sx:{display:"flex",width:"100%",backgroundColor:"#F3F3F30A",borderRadius:"8px"},children:m1(kae,{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:m1("span",{}),children:m1(Ice,{rc:m1("span",{})})})})]})}function Zst(e){const{t:t}=uUe(),{bridgeDispatch:n,bridgeState:{tokenBalances:r,allowedTokens:i,checkout:a,from:o,to:s,amount:c,token:u}}=QQ.useContext(xot),{cryptoFiatState:l,cryptoFiatDispatch:d}=QQ.useContext(Rnt),{viewDispatch:f}=QQ.useContext(oze),{testId:p,defaultAmount:h,defaultTokenAddress:m,isTokenBalancesLoading:y,defaultTokenImage:b}=e,{track:g}=yBe(),[v,w]=QQ.useState(h||""),[T,E]=QQ.useState(""),[A,x]=QQ.useState(),[O,C]=QQ.useState(""),[I,S]=QQ.useState(""),[_,P]=QQ.useState(!1),k=QQ.useRef(!1),R=A?`${t("views.BRIDGE_FORM.content.availableBalancePrefix")} ${Sze(A?.formattedBalance)}`:"",[N,M]=QQ.useState([]),[D,L]=QQ.useState(!1),F=QQ.useCallback(((e,t)=>t?`${e.toLowerCase()}-${t.toLowerCase()}`:e.toLowerCase()),[]);QQ.useEffect((()=>{if(0===r.length)return;const e=r.filter((e=>e.balance.gt(0))).map((e=>({id:F(e.token.symbol,e.token.address),name:e.token.name,symbol:e.token.symbol,icon:e.token.icon,balance:{formattedFiatAmount:0===l.conversions.size?Cze(""):Oze(e.formattedBalance,e.token.symbol,l.conversions),formattedAmount:Sze(e.formattedBalance)}})));M(e),k.current||(k.current=!0,m&&x(r.find((e=>kze(e.token.address)&&m?.toLocaleUpperCase()===hUe||e.token.address?.toLowerCase()===m?.toLowerCase()))))}),[r,l.conversions,m,k.current,F,Cze]),QQ.useEffect((()=>{if(c&&u){w(c);for(let e=0;e<r.length;e++){const t=r[e];if(t.token.address===u.address){x(t);break}}n({payload:{type:Aot.SET_TOKEN_AND_AMOUNT,token:null,amount:""}})}}),[c,u,r]);const B=QQ.useMemo((()=>A&&A.token?F(A.token.symbol,A.token.address):void 0),[A,r,l.conversions,F]),j=e=>{let t=e;if("."===t&&(t="0."),w(t),T){const e=qst(t,A?.formattedBalance);E(e)}var n;A&&(S(Oze(t,A.token.symbol,l.conversions)),n=!0,Number.isNaN(parseFloat(v))||parseFloat(v)<=0||!A||!o||!o.walletAddress||!s||!s.walletAddress||n&&_||!a||P(!0))};QQ.useEffect((()=>{d({payload:{type:knt.SET_TOKEN_SYMBOLS,tokenSymbols:i.map((e=>e.symbol))}})}),[d,i]),QQ.useEffect((()=>{v&&A&&S(Oze(v,A.token.symbol,l.conversions))}),[v,A]);const U=QQ.useCallback((()=>{const e=A?"":"views.BRIDGE_FORM.validation.noTokenSelected";const t=qst(v,A?.formattedBalance);return e&&C(e),t&&E(t),!e&&!t}),[A,v,C,E]),z=QQ.useCallback((async()=>{U()&&a&&o?.web3Provider&&A&&(g({userJourney:cBe.BRIDGE,screen:"TokenAmount",control:"Review",controlType:"Button",extras:{tokenAddress:A.token.address,amount:v}}),n({payload:{type:Aot.SET_TOKEN_AND_AMOUNT,token:A.token,amount:v}}),f({payload:{type:aze.UPDATE_VIEW,view:{type:Vrt.BRIDGE_REVIEW}}}))}),[a,o?.web3Provider,U,A]);return y1(kae,{testId:p,sx:Kst,children:[y1(kae,{sx:{paddingX:"base.spacing.x4"},children:[m1(Que,{testId:`${p}-content-heading`,size:"small",weight:"regular",sx:{paddingBottom:"base.spacing.x4"},children:t("views.BRIDGE_FORM.content.title")}),(!m||!y)&&y1(kae,{sx:Xst,children:[m1(Hnt,{testId:"bridge-token",options:N,optionsLoading:y,coinSelectorHeading:t("views.BRIDGE_FORM.bridgeForm.from.selectorTitle"),selectedOption:B,subtext:R,textAlign:"left",errorMessage:t(O),onSelectChange:e=>(e=>{const t=r.find((t=>e===F(t.token.symbol,t.token.address)));t&&(x(t),C(""))})(e),defaultTokenImage:b}),m1(Wnt,{testId:"bridge-amount",type:"number",value:v,placeholder:t("views.BRIDGE_FORM.bridgeForm.from.inputPlaceholder"),subtext:`${t("views.BRIDGE_FORM.content.fiatPricePrefix")} $${Cze(I,!0)}`,validator:C1e,onTextInputChange:e=>j(e),onTextInputEnter:z,textAlign:"right",errorMessage:t(T)})]}),m&&y&&m1(Jst,{sx:Xst})]}),y1(kae,{sx:Yst,children:[m1(xae,{testId:`${p}-button`,variant:"primary",onClick:z,size:"large",children:t("views.BRIDGE_FORM.bridgeForm.buttonText")}),m1(urt,{visible:D,showHeaderBar:!1,onCloseDrawer:()=>L(!1),onRetry:async()=>{L(!1),await z()}})]})]})}const Qst=1e4;function $st({amount:e,tokenAddress:t,defaultTokenImage:n}){const{t:r}=uUe(),{bridgeState:i,bridgeDispatch:a}=QQ.useContext(xot),{checkout:o,from:s}=i,{eventTargetState:{eventTarget:c}}=QQ.useContext(g1e),[u,l]=QQ.useState(!1),{page:d}=yBe();QQ.useEffect((()=>{(e||t)&&d({userJourney:cBe.BRIDGE,screen:"TokenAmount",extras:{amount:e,tokenAddress:t}})}),[]);const f=QQ.useCallback((async()=>{if(o&&s?.web3Provider)try{const e=await Qrt({checkout:o,provider:s.web3Provider,chainId:s?.network,allowTokenListType:jZ.BRIDGE,retryPolicy:{retryIntervalMs:0,retries:0}});if(void 0===e)return;a({payload:{type:Aot.SET_TOKEN_BALANCES,tokenBalances:e.allowedBalances}}),a({payload:{type:Aot.SET_ALLOWED_TOKENS,allowedTokens:e.allowList.tokens}})}catch(e){console.debug(e)}}),[o,s?.web3Provider,s?.network]);return drt(f,Qst),QQ.useEffect((()=>{o&&s?.web3Provider&&(l(!0),f().finally((()=>l(!1))))}),[o,s?.web3Provider]),m1(vBe,{testId:"bridge-view",header:m1(cze,{showBack:!0,title:r("views.BRIDGE_FORM.header.title"),onCloseButtonClick:()=>Sot(c)}),footer:m1(Uze,{}),children:m1(Zst,{testId:"bridge-form",defaultAmount:e,defaultTokenAddress:t,isTokenBalancesLoading:u,defaultTokenImage:n})})}const ect={display:"flex",flexDirection:"column",alignItems:"center",paddingBottom:"base.spacing.x6",height:"100%",paddingX:"base.spacing.x6"},tct={fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"15px",paddingX:"base.spacing.x6"},nct={...tct,color:"base.color.text.body.secondary"},rct={display:"flex",flexDirection:"column",justifyContent:"flex-end",gap:"base.spacing.x2",height:"100%",width:"100%"},ict={width:"100%",height:"base.spacing.x16"};function act({environment:e,onCloseDrawer:t,visible:n,walletAddress:r,tokenSymbol:i,onAddCoinsClick:a}){const{t:o}=uUe(),[s,c]=QQ.useState(!1),u=Rze(e,"/notenougheth.svg"),l=Rze(e,"/notenoughimx.svg"),d=o("drawers.notEnoughGas.content.heading",{token:i.toUpperCase()}),f=o("drawers.notEnoughGas.content.body",{token:i.toUpperCase()}),p=QQ.useCallback((()=>{r&&""!==r&&navigator.clipboard.writeText(r),c(!0),setTimeout((()=>{c(!1)}),3e3)}),[r]);return m1(Cde,{size:"threeQuarter",visible:n,showHeaderBar:!0,headerBarTitle:void 0,onCloseDrawer:t,children:y1(Cde.Content,{testId:"not-enough-gas-bottom-sheet",sx:ect,children:[m1(xse,{imageUrl:i===vUe?u:l,imageResizeServiceUrl:_Ue[e],sx:{w:"90px",h:i===vUe?"110px":"90px"}}),m1(Que,{size:"small",weight:"bold",sx:tct,testId:"not-enough-gas-heading",children:d}),m1(jce,{sx:nct,children:f}),m1(kae,{sx:rct,children:i===vUe?y1(xae,{testId:"not-enough-gas-copy-address-button",sx:ict,variant:"primary",onClick:p,children:[o("drawers.notEnoughGas.buttons.copyAddress"),m1(xae.Icon,{icon:s?"Tick":"CopyText"})]}):m1(xae,{testId:"not-enough-gas-add-imx-button",sx:ict,variant:"primary",onClick:a,children:o("drawers.notEnoughGas.buttons.addMoreImx")})})]})})}const oct={borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",marginBottom:"2px",position:"relative"},sct={borderTopLeftRadius:"0px",borderTopRightRadius:"0px",backgroundColor:"base.color.translucent.emphasis.100",position:"relative"},cct={width:"base.icon.size.400"},uct={position:"absolute",top:"2px",left:"26px",width:"20px",padding:"2px",backgroundColor:"base.color.translucent.inverse.900",borderRadius:"base.borderRadius.x2"},lct={height:"100%",display:"flex",flexDirection:"column",paddingX:"base.spacing.x4"},dct={paddingTop:"base.spacing.x10",paddingBottom:"base.spacing.x4"},fct={display:"flex",flexDirection:"column",alignItems:"center",paddingY:"base.spacing.x1"},pct={width:"base.icon.size.300",transform:"rotate(270deg)"},hct={width:"base.icon.size.400"},mct={backgroundColor:"base.color.translucent.standard.200",position:"absolute",width:"32px",height:"32px",padding:"6px",left:"base.spacing.x3"},yct=(e,t,n)=>{const r=[];if(!e?.fees||!e.token)return r;let i=jr.from(0);if(e.fees.bridgeFee&&(i=i.add(e.fees.bridgeFee)),e.fees.imtblFee&&(i=i.add(e.fees.imtblFee)),i.gt(0)&&r.push({label:n("drawers.feesBreakdown.fees.serviceFee.label"),fiatAmount:`~ ${n("drawers.feesBreakdown.fees.fiatPricePrefix")}${Oze(Vp(i,e.token.decimals),e.token.symbol,t.conversions)}`,amount:Sze(Vp(i,e.token.decimals))}),e.fees.sourceChainGas?.gt(0)){const i=Vp(e.fees.sourceChainGas,e.token.decimals);r.push({label:n("drawers.feesBreakdown.fees.gasFeeMove.label"),fiatAmount:`~ ${n("drawers.feesBreakdown.fees.fiatPricePrefix")}${Oze(i,e.token.symbol,t.conversions)}`,amount:`${Sze(i)}`,prefix:"~ "})}if(e.fees.approvalFee?.gt(0)){const i=Vp(e.fees.approvalFee,e.token.decimals);r.push({label:n("drawers.feesBreakdown.fees.gasFeeApproval.label"),fiatAmount:`~ ${n("drawers.feesBreakdown.fees.fiatPricePrefix")}${Oze(i,e.token.symbol,t.conversions)}`,amount:`${Sze(i)}`,prefix:"~ "})}return r},bct="bridge-review-summary";function gct(){const{t:e}=uUe(),{viewDispatch:t}=QQ.useContext(oze),{bridgeState:{checkout:n,tokenBridge:r,from:i,to:a,token:o,amount:s,tokenBalances:c},bridgeDispatch:u}=QQ.useContext(xot),{track:l}=yBe(),{cryptoFiatState:d}=QQ.useContext(Rnt),[f,p]=QQ.useState(!1),[h,m]=QQ.useState(void 0),[y,b]=QQ.useState(""),[g,v]=QQ.useState(""),[w,T]=QQ.useState(void 0),[E,A]=QQ.useState(void 0),[x,O]=QQ.useState(!1),[C,I]=QQ.useState(void 0),[S,_]=QQ.useState(void 0),[P,k]=QQ.useState(!1),[R,N]=QQ.useState(!1),{isWalletConnectEnabled:M,getWalletLogoUrl:D}=B0e(),[L,F]=QQ.useState(!1),B=QQ.useMemo((()=>{if(!h)return!1;if(!o)return!0;const e=c.find((e=>kze(e.token.address)));let t=jr.from(h.fees.totalFees);return kze(o.address)&&(t=t.add(Gp(s,o.decimals))),!e||e.balance.lt(t)}),[c,h,o,s]),j=QQ.useMemo((()=>o?.symbol?`${o?.symbol} ${s}`:`${s}`),[o,s]),U=QQ.useMemo((()=>s&&o?Oze(s,o.symbol,d.conversions):""),[o,s]),z=QQ.useMemo((()=>i?i.walletAddress:"-"),[i]),H=QQ.useMemo((()=>i&&i.network),[i]),W=QQ.useMemo((()=>a?a.walletAddress:"-"),[a]),V=QQ.useMemo((()=>a?.network),[a]),G=QQ.useCallback((async()=>{if(!(r&&s&&i&&a&&o))return;const e=await r.getUnsignedBridgeBundledTx({senderAddress:z,recipientAddress:W,token:o.address??hUe.toUpperCase(),amount:Gp(s,o.decimals),sourceChainId:i?.network.toString(),destinationChainId:a?.network.toString(),gasMultiplier:1.1}),t={contractToApprove:e.contractToApprove,unsignedTx:e.unsignedApprovalTx},c={feeData:e.feeData,unsignedTx:e.unsignedBridgeTx};T(t),A(c);const u=c.feeData,{totalFees:l,approvalFee:f}=u;let p=l;t.unsignedTx||(p=l.sub(f),u.approvalFee=jr.from(0));const h={gasEstimateType:FZ.BRIDGE_TO_L2,fees:{...u,totalFees:p},token:n.config.networkMap.get(i.network)?.nativeCurrency};m(h);const y=Vp(h?.fees.totalFees||0,mUe);b(y),v(Oze(y,h?.token?.symbol||"",d.conversions))}),[n,r]);drt((()=>G()),OUe);const q=QQ.useCallback((()=>yct(h,d,e)),[h]);QQ.useEffect((()=>{(async()=>{p(!0),await G(),p(!1)})()}),[]);const K=QQ.useCallback((e=>{u({payload:{type:Aot.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]);QQ.useEffect((()=>{if(!i?.web3Provider)return;const e=()=>{const e=new Rp(i?.web3Provider.provider);K(e),O(!1)};return UUe(i?.web3Provider,e),()=>{zUe(i?.web3Provider,e)}}),[i?.web3Provider]),QQ.useEffect((()=>{if(M){const e=Xze(i?.web3Provider),t=Xze(a?.web3Provider);k(e),N(t),(async()=>{e&&I(await D()),t&&_(await D())})()}}),[M,i?.web3Provider,a?.web3Provider]),QQ.useEffect((()=>{B&&F(!0)}),[B]);const X=QQ.useCallback((async()=>{if(w&&E)if(B)F(!0);else{try{const e=await(i?.web3Provider.provider).request({method:"eth_chainId",params:[]});if(parseInt(e.toString())!==i?.network)return void O(!0)}catch(e){console.error("Current network check failed",e)}l({userJourney:cBe.BRIDGE,screen:"Summary",control:"Submit",controlType:"Button",extras:{fromWalletAddress:z,fromNetwork:H,fromWallet:{address:z,rdns:i?.walletProviderInfo?.rdns,uuid:i?.walletProviderInfo?.uuid,isPassportWallet:qze(i?.web3Provider),isMetaMask:Kze(i?.web3Provider)},toWalletAddress:W,toNetwork:V,toWallet:{address:W,rdns:a?.walletProviderInfo?.rdns,uuid:a?.walletProviderInfo?.uuid,isPassportWallet:qze(a?.web3Provider),isMetaMask:Kze(a?.web3Provider)},amount:s,fiatAmount:U,tokenAddress:o?.address}}),t({payload:{type:aze.UPDATE_VIEW,view:{type:Vrt.APPROVE_TRANSACTION,approveTransaction:w,transaction:E}}})}}),[t,w,E,i?.web3Provider,i?.network,i?.walletProviderInfo,a?.web3Provider,a?.network,a?.walletProviderInfo]);return y1(kae,{testId:bct,sx:lct,children:[m1(Que,{testId:`${bct}-heading`,size:"small",weight:"regular",sx:dct,children:e("views.BRIDGE_REVIEW.heading")}),y1(nhe,{testId:`${bct}-from-amount`,size:"small",emphasized:!0,sx:oct,children:[m1(nhe.Label,{size:"small",sx:{marginBottom:"base.spacing.x4",fontWeight:"bold"},children:e("views.BRIDGE_REVIEW.fromLabel.amountHeading")}),m1(nhe.Caption,{}),m1(nhe.PriceDisplay,{use:m1(Que,{size:"xSmall",weight:"light"}),price:j??"-",fiatAmount:`${e("views.BRIDGE_REVIEW.fiatPricePrefix")}${U}`})]}),y1(nhe,{testId:`${bct}-from-address`,size:"xSmall",emphasized:!0,sx:sct,children:[P&&C?y1(h1,{children:[m1(nhe.FramedImage,{imageUrl:C,alt:"walletconnect",sx:cct}),m1(xie,{logo:"WalletConnectSymbol",sx:uct})]}):i?.walletProviderInfo&&m1(Gze,{src:i?.walletProviderInfo.icon,alt:i?.walletProviderInfo.name,sx:mct}),y1(nhe.Label,{sx:{marginLeft:P&&C?"0px":"45px"},children:[m1("strong",{children:e("views.BRIDGE_REVIEW.fromLabel.heading")})," ",m1(jce,{size:"small",sx:{color:"base.color.text.body.secondary"},children:Sst(z??"")})]}),H&&m1(nhe.IntentIcon,{icon:LUe[H],sx:zst(H)})]}),m1(kae,{sx:fct,children:m1(Yne,{icon:"ArrowBackward",sx:pct})}),y1(nhe,{testId:`${bct}-to-address`,size:"xSmall",emphasized:!0,sx:oct,children:[R&&S?y1(h1,{children:[m1(nhe.FramedImage,{imageUrl:S,alt:"walletconnect",sx:cct}),m1(xie,{logo:"WalletConnectSymbol",sx:uct})]}):a?.walletProviderInfo&&m1(Gze,{src:a?.walletProviderInfo.icon,alt:a?.walletProviderInfo.name,sx:mct}),y1(nhe.Label,{sx:{marginLeft:R&&S?"0px":"45px"},children:[m1("strong",{children:e("views.BRIDGE_REVIEW.toLabel.heading")})," ",m1(jce,{size:"small",sx:{color:"base.color.text.body.secondary"},children:Sst(W??"")})]}),V&&m1(nhe.IntentIcon,{icon:LUe[V],sx:zst(V)})]}),m1(trt,{gasFeeValue:y,gasFeeFiatValue:g,gasFeeToken:h?.token,fees:q(),onFeesClick:()=>{l({userJourney:cBe.BRIDGE,screen:"MoveCoins",control:"ViewFees",controlType:"Button"})},sx:{borderTopRightRadius:"0",borderTopLeftRadius:"0"},loading:f}),m1(kae,{sx:{flex:1,display:"flex",flexDirection:"column",justifyContent:"flex-end",paddingY:"base.spacing.x6",width:"100%"},children:h&&!f&&m1(xae,{size:"large",sx:{width:"100%"},onClick:X,disabled:f,testId:`${bct}__submit-button`,children:f?m1(xae.Icon,{icon:"Loading",sx:hct}):e("views.BRIDGE_REVIEW.submitButton.buttonText")})}),m1(xnt,{visible:x,targetChainId:i?.network,provider:i?.web3Provider,checkout:n,onCloseDrawer:()=>O(!1),onNetworkSwitch:K}),m1(act,{environment:n.config.environment,visible:L,onCloseDrawer:()=>F(!1),walletAddress:i?.walletAddress||"",tokenSymbol:i?.network===NUe(n?.config)?vUe:gUe,onAddCoinsClick:()=>{t({payload:{type:aze.UPDATE_VIEW,view:{type:rze.TOP_UP_VIEW}}})}})]})}function vct(){const{t:e}=uUe(),{eventTargetState:{eventTarget:t}}=QQ.useContext(g1e),{page:n}=yBe();return QQ.useEffect((()=>{n({userJourney:cBe.BRIDGE,screen:"Review"})}),[]),m1(vBe,{testId:"bridge-review",header:m1(cze,{showBack:!0,title:e("views.BRIDGE_REVIEW.layoutHeading"),onCloseButtonClick:()=>Sot(t)}),footer:m1(Uze,{}),children:m1(gct,{})})}function wct({environment:e}){const{RiveComponent:t}=ege.useRive({src:`${CUe[e]}/v1/blob/img/rocket.riv`,autoplay:!0,layout:new ege.Layout({fit:ege.Fit.Cover}),stateMachines:"State Machine 1"});return m1(kae,{sx:{...dze,background:"base.color.translucent.emphasis.100"},children:m1(kae,{sx:uze,rc:m1(t,{})})})}function Tct({transactionHash:e}){const{t:t}=uUe(),{eventTargetState:{eventTarget:n}}=QQ.useContext(g1e),{page:r}=yBe(),{cryptoFiatState:i}=QQ.useContext(Rnt),{viewDispatch:a}=QQ.useContext(oze),{bridgeState:{checkout:o,from:s,to:c,token:u,amount:l}}=QQ.useContext(xot);return QQ.useEffect((()=>{Cot(n,e);const t=Oze(l,u?.symbol??"",i.conversions);r({userJourney:cBe.BRIDGE,screen:"InProgress",extras:{fromWalletAddress:s?.walletAddress,toWalletAddress:c?.walletAddress,amount:l,fiatAmount:t,tokenAddress:u?.address}})}),[]),m1(vBe,{testId:"move-in-progress-view",header:m1(cze,{transparent:!0,onCloseButtonClick:()=>Sot(n),rightActions:y1(h1,{children:[m1(soe,{icon:"Minting",sx:nze(),onClick:()=>{a({payload:{type:aze.UPDATE_VIEW,view:{type:Vrt.TRANSACTIONS}}})},testId:"settings-button"}),m1(gue,{isAnimated:!0,variant:"guidance",sx:{position:"absolute",right:"base.spacing.x14",top:"base.spacing.x1"}})]})}),footer:m1(Uze,{}),heroContent:m1(wct,{environment:o.config.environment}),floatHeader:!0,children:y1(yze,{heading:t("views.IN_PROGRESS.heading"),children:[t("views.IN_PROGRESS.body1"),m1("br",{}),m1("br",{}),t("views.IN_PROGRESS.body2")]})})}function Ect({approveTransaction:e,transaction:t}){const{t:n}=uUe(),{bridgeState:r}=QQ.useContext(xot),{checkout:i,from:a}=r,{viewDispatch:o}=QQ.useContext(oze),{eventTargetState:{eventTarget:s}}=QQ.useContext(g1e),{page:c}=yBe();QQ.useEffect((()=>{c({userJourney:cBe.BRIDGE,screen:"ApproveTransaction"})}),[]);const[u,l]=QQ.useState(!1),[d,f]=QQ.useState(!1),[p,h]=QQ.useState(!1),[m,y]=QQ.useState(!1),b=QQ.useCallback((()=>{o({payload:{type:aze.UPDATE_VIEW,view:{type:rze.ERROR_VIEW,error:new Error("No checkout object or no provider object found")}}})}),[o]),g=QQ.useCallback((()=>{o({payload:{type:aze.GO_BACK}})}),[o]),v=e=>{if(e.type!==QZ.UNPREDICTABLE_GAS_LIMIT){if(e.type===QZ.TRANSACTION_FAILED||e.type===QZ.INSUFFICIENT_FUNDS||e.receipt&&0===e.receipt.status){let t="Transaction failed";return e.type===QZ.INSUFFICIENT_FUNDS&&(t="Insufficient funds"),e.receipt&&0===e.receipt.status&&(t="Transaction failed to settle on chain"),void o({payload:{type:aze.UPDATE_VIEW,view:{type:Vrt.BRIDGE_FAILURE,reason:t}}})}o({payload:{type:aze.UPDATE_VIEW,view:{type:rze.ERROR_VIEW,error:e}}})}else o({payload:{type:aze.UPDATE_VIEW,view:{type:Vrt.BRIDGE_FAILURE,reason:"Unpredictable gas limit"}}})},w=QQ.useCallback((async()=>{let n=!1;if(i&&a?.web3Provider&&t){if(!u){if(l(!0),e.unsignedTx)try{f(!0);const t=await i.sendTransaction({provider:a.web3Provider,transaction:e.unsignedTx});if(1!==(await t.transactionResponse.wait()).status)return void o({payload:{type:aze.UPDATE_VIEW,view:{type:Vrt.BRIDGE_FAILURE,reason:"Transaction failed to settle on chain"}}})}catch(e){f(!1),e.type===QZ.USER_REJECTED_REQUEST_ERROR?(y(!0),n=!0):v(e)}finally{l(!1)}try{if(n)return;f(!0);const e=await i.sendTransaction({provider:a.web3Provider,transaction:t.unsignedTx});h(!0);const r=await e.transactionResponse.wait();if(0===r.status)return void o({payload:{type:aze.UPDATE_VIEW,view:{type:Vrt.BRIDGE_FAILURE,reason:"Approval transaction failed to settle on chain"}}});o({payload:{type:aze.UPDATE_VIEW,view:{type:Vrt.IN_PROGRESS,transactionHash:r.transactionHash}}})}catch(e){e.type===QZ.USER_REJECTED_REQUEST_ERROR?y(!0):v(e)}finally{h(!1),f(!1),l(!1)}}}else b()}),[i,a,b,o,t,e,u]);return y1(h1,{children:[p&&m1(wBe,{loadingText:n("views.APPROVE_TRANSACTION.loadingView.text")}),!p&&m1(vBe,{header:m1(cze,{transparent:!0,showBack:!0,onCloseButtonClick:()=>Sot(s),onBackButtonClick:g}),floatHeader:!0,heroContent:m1(Hrt,{}),footer:y1(kae,{sx:{width:"100%",flexDirection:"column"},children:[m1(eze,{loading:d,actionText:n("views.APPROVE_TRANSACTION."+(m?"footer.retryText":"footer.buttonText")),onActionClick:w}),m1(Uze,{})]}),children:m1(yze,{heading:n("views.APPROVE_TRANSACTION.content.heading"),children:m1(kae,{children:n("views.APPROVE_TRANSACTION.content.body")})})})]})}const Act={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x1",height:"100%"},xct={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"15px"},Oct={display:"flex",flexDirection:"column",justifyContent:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},Cct={width:"100%",height:"base.spacing.x16"};function Ict({visible:e,onClose:t,onChangeAccount:n}){const{t:r}=uUe(),{bridgeState:{checkout:i}}=QQ.useContext(xot),a=Rze(i.config.environment,"/tokens/eth.svg");return m1(Cde,{headerBarTitle:void 0,size:"full",onCloseDrawer:t,visible:e,showHeaderBar:!1,children:m1(Cde.Content,{children:y1(kae,{testId:"not-enough-eth-drawer",sx:Act,children:[m1(xse,{imageUrl:a,imageResizeServiceUrl:_Ue[i.config.environment],sx:{w:"base.icon.size.600",h:"base.icon.size.600"}}),m1(Que,{size:"small",sx:xct,testId:"not-enough-gas-heading",children:`${r("drawers.notEnoughEthWithdrawal.content.heading1")} ${vUe} ${r("drawers.notEnoughEthWithdrawal.content.heading2")}`}),m1(jce,{sx:xct,children:`${r("drawers.notEnoughEthWithdrawal.content.body1")} ${vUe} ${r("drawers.notEnoughEthWithdrawal.content.body2")}`}),y1(kae,{sx:Oct,children:[m1(xae,{testId:"not-enough-eth-drawer-retry-button",sx:Cct,variant:"tertiary",onClick:n,children:r("drawers.notEnoughEthWithdrawal.buttons.retry")}),m1(xae,{sx:Cct,variant:"tertiary",onClick:t,testId:"not-enough-eth-drawer-dismiss-button",children:r("drawers.notEnoughEthWithdrawal.buttons.dismiss")})]})]})})})}function Sct({transaction:e}){const{t:t}=uUe(),{bridgeState:{checkout:n,tokenBridge:r,from:i}}=QQ.useContext(xot),{viewDispatch:a}=QQ.useContext(oze),{eventTargetState:{eventTarget:o}}=QQ.useContext(g1e),{page:s}=yBe();QQ.useEffect((()=>{s({userJourney:cBe.BRIDGE,screen:"ClaimWithdrawal"})}),[]);const[c,u]=QQ.useState(!1),[l,d]=QQ.useState(!1),[f,p]=QQ.useState(!1),[h,m]=QQ.useState(),[y,b]=QQ.useState(!1),g=QQ.useCallback((()=>{a({payload:{type:aze.GO_BACK}})}),[a]);QQ.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=QQ.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=NUe(n.config);if(u(!0),qze(i?.web3Provider)||e)try{const e=await n.createProvider({walletProviderName:HZ.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(PUe)}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=>kze(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:aze.UPDATE_VIEW,view:{type:Vrt.CLAIM_WITHDRAWAL_IN_PROGRESS,transactionResponse:e.transactionResponse}}})}catch(e){console.log(e),p(!0),u(!1)}finally{u(!1)}}),[r,i,h]);return y1(vBe,{testId:"claim-withdrawal",header:m1(cze,{transparent:!0,showBack:!0,onCloseButtonClick:()=>Sot(o),onBackButtonClick:g}),floatHeader:!0,heroContent:m1(Hrt,{}),footer:y1(kae,{sx:{width:"100%",display:"flex",flexDirection:"column"},children:[m1(kae,{sx:{pb:"base.spacing.x5",px:"base.spacing.x6",width:"100%",display:"flex",flexDirection:"column"},children:m1(xae,{testId:"claim-withdrawal-continue-button",size:"large",variant:"primary",disabled:l,onClick:()=>c||l?void 0:v({forceChangeAccount:!0}),children:l||c?m1(xae.Icon,{icon:"Loading",sx:{width:"base.icon.size.400"}}):t("views.CLAIM_WITHDRAWAL."+(f?"footer.retryText":"footer.buttonText"))})}),m1(Uze,{})]}),children:[y1(yze,{heading:`${t("views.CLAIM_WITHDRAWAL.content.heading")} ${TBe(NUe(n.config))}`,children:[m1(kae,{sx:{display:"flex",flexWrap:"wrap",pb:"base.spacing.x1"},children:t("views.CLAIM_WITHDRAWAL.content.body")}),y1(kae,{children:[t("views.CLAIM_WITHDRAWAL.content.body2"),m1(Kme,{text:e.details.to_address.toLowerCase()??""})]})]}),m1(Ict,{visible:y,onClose:()=>b(!1),onChangeAccount:()=>v({forceChangeAccount:!0})})]})}function _ct({checkout:e,web3Provider:t,config:n,amount:r,tokenAddress:i}){const{t:a}=uUe(),{environment:o,isOnRampEnabled:s,isSwapEnabled:c,isBridgeEnabled:u,theme:l}=n,d=Mze(e.config.environment,l),{eventTargetState:{eventTarget:f}}=QQ.useContext(g1e),{page:p}=yBe(),[h,m]=QQ.useReducer(sze,{...ize,view:{type:Vrt.WALLET_NETWORK_SELECTION},history:[{type:Vrt.WALLET_NETWORK_SELECTION}]}),[y,b]=QQ.useReducer(Oot,{...Eot,checkout:e,web3Provider:t??null,tokenBridge:(()=>{let t=iC;e.config.isDevelopment&&(t=rC),e.config.isProduction&&(t=aC);const n=new xp(e.config.networkMap.get(NUe(e.config))?.rpcUrls[0]),r=new xp(e.config.networkMap.get(MUe(e.config))?.rpcUrls[0]),i=new wI({baseConfig:new Xt({environment:e.config.environment}),bridgeInstance:t,rootProvider:n,childProvider:r});return new PC(i)})()}),g=QQ.useMemo((()=>({viewState:h,viewDispatch:m})),[h,m]),v=QQ.useMemo((()=>({bridgeState:y,bridgeDispatch:b})),[y,b]),w=QQ.useCallback((()=>{b({payload:{type:Aot.SET_WALLETS_AND_NETWORKS,from:null,to:null}}),b({payload:{type:Aot.SET_TOKEN_AND_AMOUNT,amount:"",token:null}}),m({payload:{type:aze.GO_BACK_TO,view:{type:Vrt.WALLET_NETWORK_SELECTION}}})}),[m]),T=QQ.useCallback((()=>{m({payload:{type:aze.GO_BACK_TO,view:{type:Vrt.WALLET_NETWORK_SELECTION}}})}),[m]),E=QQ.useCallback((()=>{m({payload:{type:aze.UPDATE_VIEW,view:{type:Vrt.TRANSACTIONS}}})}),[m]),A=QQ.useCallback((()=>{m({payload:{type:aze.GO_BACK_TO,view:{type:Vrt.BRIDGE_REVIEW}}})}),[m]);return QQ.useEffect((()=>{(async()=>{b({payload:{type:Aot.SET_PROVIDER,web3Provider:t??null}})})()}),[t]),m1(oze.Provider,{value:g,children:m1(xot.Provider,{value:v,children:y1(jrt,{environment:o,children:[h.view.type===Vrt.WALLET_NETWORK_SELECTION&&m1(Gst,{}),h.view.type===Vrt.BRIDGE_FORM&&m1($st,{amount:r,tokenAddress:i,defaultTokenImage:d}),h.view.type===Vrt.BRIDGE_REVIEW&&m1(vct,{}),h.view.type===Vrt.IN_PROGRESS&&m1(Tct,{transactionHash:h.view.transactionHash}),h.view.type===Vrt.BRIDGE_FAILURE&&m1(p1e,{testId:"bridge-fail",statusText:a("views.BRIDGE_FAILURE.bridgeFailureText.statusText"),actionText:a("views.BRIDGE_FAILURE.bridgeFailureText.actionText"),onActionClick:A,statusType:a1e.FAILURE,onRenderEvent:()=>{let e="";h.view.type===Vrt.BRIDGE_FAILURE&&(e=h.view.reason),p({userJourney:cBe.BRIDGE,screen:"Failed",extras:{reason:e}}),Iot(f,e)}}),h.view.type===Vrt.APPROVE_TRANSACTION&&m1(Ect,{approveTransaction:h.view.approveTransaction,transaction:h.view.transaction}),h.view.type===Vrt.TRANSACTIONS&&m1(Cst,{onBackButtonClick:T,defaultTokenImage:d}),h.view.type===Vrt.CLAIM_WITHDRAWAL&&m1(Sct,{transaction:h.view.transaction}),h.view.type===rze.ERROR_VIEW&&m1(bze,{actionText:a("views.ERROR_VIEW.actionText"),onActionClick:w,onCloseClick:()=>Sot(f),errorEventAction:()=>{p({userJourney:cBe.BRIDGE,screen:"Error"})}}),h.view.type===rze.TOP_UP_VIEW&&m1(Jrt,{analytics:{userJourney:cBe.BRIDGE},widgetEvent:wZ.IMTBL_BRIDGE_WIDGET_EVENT,checkout:e,provider:t,showOnrampOption:s,showSwapOption:c,showBridgeOption:u,onCloseButtonClick:()=>Sot(f)}),h.view.type===Vrt.CLAIM_WITHDRAWAL_IN_PROGRESS&&m1(Ist,{transactionResponse:h.view.transactionResponse}),h.view.type===Vrt.CLAIM_WITHDRAWAL_SUCCESS&&m1(p1e,{statusText:a("views.CLAIM_WITHDRAWAL.IN_PROGRESS.success.text"),actionText:a("views.CLAIM_WITHDRAWAL.IN_PROGRESS.success.actionText"),onRenderEvent:()=>{p({userJourney:cBe.BRIDGE,screen:"ClaimWithdrawalSuccess"}),_ot(f,h.view.transactionHash)},onActionClick:E,statusType:a1e.SUCCESS,testId:"claim-withdrawal-success-view"}),h.view.type===Vrt.CLAIM_WITHDRAWAL_FAILURE&&m1(p1e,{statusText:a("views.CLAIM_WITHDRAWAL.IN_PROGRESS.failure.text"),actionText:a("views.CLAIM_WITHDRAWAL.IN_PROGRESS.failure.actionText"),onRenderEvent:()=>{let e="";h.view.type===Vrt.CLAIM_WITHDRAWAL_FAILURE&&(e=h.view.reason),p({userJourney:cBe.BRIDGE,screen:"ClaimWithdrawalFailure",extras:{reason:e}}),Pot(f,h.view.transactionHash,"Transaction failed")},onActionClick:E,statusType:a1e.FAILURE,onCloseClick:()=>Sot(f),testId:"claim-withdrawal-fail-view"})]})})})}var Pct,kct=Object.freeze({__proto__:null,default:_ct});function Rct({fundingRouteStep:e,onFundingRouteExecuted:t}){const{t:n}=uUe(),{config:r,provider:i,checkout:a,fromTokenAddress:o}=got(),{viewDispatch:s}=QQ.useContext(oze),{connectLoaderDispatch:c}=QQ.useContext(Tze),[u,l]=QQ.useState(void 0),[d,f]=QQ.useState(void 0),[p,h]=QQ.useState(void 0),[m,y]=QQ.useState(Pct.LOADING),b=QQ.useRef(!1),g=QQ.useRef(void 0),v=QQ.useRef(void 0),[w,T]=QQ.useReducer(v1e,y1e),E=QQ.useMemo((()=>({eventTargetState:w,eventTargetDispatch:T})),[w,T]),A=new EventTarget,x=e=>{s({payload:{type:aze.UPDATE_VIEW,view:{type:Xat.SALE_FAIL,data:{errorType:Zat.SMART_CHECKOUT_EXECUTE_ERROR,errorData:e}}}})},O=QQ.useCallback((async e=>{if(!a||!i)throw new Error("checkout or provider not available.");const t=await a.getNetworkInfo({provider:i});if(e.type===JZ.BRIDGE){if(f({tokenAddress:e.fundingItem.token.address,amount:e.fundingItem.fundsRequired.formattedAmount}),t.chainId===NUe(a.config))return void y(Pct.EXECUTE_BRIDGE);b.current=Pct.EXECUTE_BRIDGE,y(Pct.SWITCH_NETWORK_ETH)}if(e.type===JZ.SWAP){if(l({amount:e.fundingItem.fundsRequired.formattedAmount,fromTokenAddress:e.fundingItem.token.address,toTokenAddress:o}),t.chainId===MUe(a.config))return void y(Pct.EXECUTE_SWAP);b.current=Pct.EXECUTE_SWAP,y(Pct.SWITCH_NETWORK_ZKEVM)}e.type===JZ.ONRAMP&&(h({amount:e.fundingItem.fundsRequired.formattedAmount,tokenAddress:e.fundingItem.token.address}),y(Pct.EXECUTE_ON_RAMP))}),[i,a]);QQ.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 xZ.SUCCESS:{const t=e.detail.data;g.current=t,C();break}case IZ.TRANSACTION_SENT:case _Z.SUCCESS:{const t=e.detail.data;g.current=t;break}case IZ.FAILURE:case xZ.FAILURE:case _Z.FAILURE:{const t=e.detail.data;v.current=t;break}case IZ.CLOSE_WIDGET:case xZ.CLOSE_WIDGET:case _Z.CLOSE_WIDGET:C();case xZ.REJECTED:}},S=e=>{switch(e.detail.type){case EZ.SUCCESS:{const t=e.detail.data;c({payload:{type:wze.SET_PROVIDER,provider:t.provider}}),!1!==b.current&&(y(b.current),b.current=!1);break}case EZ.FAILURE:case EZ.CLOSE_WIDGET:default:C()}};return QQ.useEffect((()=>(A.addEventListener(wZ.IMTBL_CONNECT_WIDGET_EVENT,S),A.addEventListener(wZ.IMTBL_BRIDGE_WIDGET_EVENT,I),A.addEventListener(wZ.IMTBL_SWAP_WIDGET_EVENT,I),()=>{A.removeEventListener(wZ.IMTBL_CONNECT_WIDGET_EVENT,S),A.removeEventListener(wZ.IMTBL_BRIDGE_WIDGET_EVENT,I),A.removeEventListener(wZ.IMTBL_SWAP_WIDGET_EVENT,I)})),[]),QQ.useEffect((()=>{T({payload:{type:b1e.SET_EVENT_TARGET,eventTarget:A}})}),[a]),y1(g1e.Provider,{value:E,children:[m===Pct.LOADING&&m1(wBe,{loadingText:n("views.FUND_WITH_SMART_CHECKOUT.loading.checkingBalances")}),m===Pct.EXECUTE_BRIDGE&&m1(_ct,{...d,config:r,checkout:a}),m===Pct.EXECUTE_SWAP&&m1($rt,{...u,config:r}),m===Pct.EXECUTE_ON_RAMP&&m1(iat,{config:r,...p}),m===Pct.SWITCH_NETWORK_ETH&&m1(w1e,{config:r,targetChainId:a.config.isProduction?NZ.ETHEREUM:NZ.SEPOLIA,web3Provider:i,checkout:a,deepLink:jze.SWITCH_NETWORK}),m===Pct.SWITCH_NETWORK_ZKEVM&&m1(w1e,{config:r,targetChainId:a.config.isProduction?NZ.IMTBL_ZKEVM_MAINNET:NZ.IMTBL_ZKEVM_TESTNET,web3Provider:i,checkout:a,deepLink:jze.SWITCH_NETWORK})]})}!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"}(Pct||(Pct={}));const Nct={[NZ.IMTBL_ZKEVM_DEVNET]:"Immutable",[NZ.IMTBL_ZKEVM_MAINNET]:"Immutable",[NZ.IMTBL_ZKEVM_TESTNET]:"Immutable",[NZ.ETHEREUM]:"EthToken",[NZ.SEPOLIA]:"EthToken"},Mct={[NZ.IMTBL_ZKEVM_DEVNET]:"base.color.text.link.primary",[NZ.IMTBL_ZKEVM_TESTNET]:"base.color.text.link.primary",[NZ.IMTBL_ZKEVM_MAINNET]:"base.color.text.link.primary",[NZ.ETHEREUM]:"base.color.accent.5",[NZ.SEPOLIA]:"base.color.accent.5"};function Dct({onClick:e,fundingRoute:t,toggleVisible:n,selected:r,size:i="small"}){const{t:a}=uUe(),o=t.steps[0],{cryptoFiatState:s}=QQ.useContext(Rnt),{isPassportWallet:c}=got(),[u,l]=QQ.useState(void 0),[d,f]=QQ.useState(void 0);QQ.useEffect((()=>{if(s.conversions)try{l(uot(t,s.conversions)),f(Oze(o.fundingItem.userBalance.formattedBalance,o.fundingItem.token.symbol,s.conversions))}catch{l(void 0),f(void 0)}}),[s,t]);return y1(nhe,{emphasized:!0,testId:"funding-route-menu-item",onClick:e,selected:r,size:i,children:[n&&m1(nhe.IntentIcon,{icon:"ChevronExpand"}),m1(nhe.FramedIcon,{icon:"Coins",circularFrame:!0}),m1(nhe.PriceDisplay,{use:m1(Que,{size:"xSmall"}),fiatAmount:`${a("views.FUND_WITH_SMART_CHECKOUT.currency.usdEstimate")}${d}`,price:Sze(o.fundingItem.userBalance.formattedBalance)}),y1(nhe.Label,{sx:{display:"flex",wordBreak:"default"},children:[o.fundingItem.token.symbol,c?null:y1($be.Button,{rc:m1("a",{}),sx:{pointerEvents:"none",cursor:"default",height:"100%",marginLeft:"base.spacing.x2",fontSize:"base.text.body.xxSmall.regular.fontSize",fontWeight:"base.text.body.xxSmall.regular.fontWeight",color:"base.color.brand.4",paddingLeft:"base.spacing.x2",paddingRight:"base.spacing.x2"},size:"small",children:[m1(xae.Icon,{icon:Nct[o.chainId],sx:{width:"14px",fill:Mct[o.chainId]}}),TBe(o.chainId)]})]}),y1(nhe.Caption,{children:["Fees ≈ USD $",u]})]})}function Lct({visible:e,onCloseDrawer:t,fundingRoutes:n,activeFundingRouteIndex:r}){const{t:i}=uUe();return m1(Cde,{size:"full",onCloseDrawer:()=>t(r),visible:e,showHeaderBar:!0,headerBarTitle:i("views.FUND_WITH_SMART_CHECKOUT.fundingRouteDrawer.header"),children:m1(Cde.Content,{children:n.map(((e,n)=>m1(Dct,{onClick:()=>{t(n)},fundingRoute:e,selected:r===n,size:"medium"},e.steps[0].fundingItem.type+e.steps[0].fundingItem.token)))})})}function Fct({fundingRoute:e,collectionName:t}){const{t:n}=uUe(),{items:r}=got(),i=r[0],a=e.steps[0],{cryptoFiatState:o}=QQ.useContext(Rnt),[s,c]=QQ.useState(void 0);return QQ.useEffect((()=>{if(o.conversions)try{c(Oze(a.fundingItem.fundsRequired.formattedAmount,a.fundingItem.token.symbol,o.conversions))}catch{c(void 0)}}),[o,e]),y1(nhe,{emphasized:!0,testId:"funding-route-purchase-item",size:"medium",children:[m1(nhe.FramedImage,{imageUrl:i?.image}),m1(nhe.PriceDisplay,{use:m1(Que,{size:"xSmall"}),price:`${a?.fundingItem.token.symbol} \n ${Sze(a.fundingItem.fundsRequired.formattedAmount)}`,fiatAmount:`${n("views.FUND_WITH_SMART_CHECKOUT.currency.usdEstimate")}${s}`}),y1(nhe.Label,{children:[i?.name,i?.qty>1?` x${i.qty}`:null]}),m1(nhe.Caption,{children:t})]},i?.name)}function Bct({fundingRoutes:e,collectionName:t,onFundingRouteSelected:n}){const{t:r}=uUe(),[i,a]=QQ.useState(!1),[o,s]=QQ.useState(0),{viewDispatch:c}=QQ.useContext(oze),{eventTargetState:{eventTarget:u}}=QQ.useContext(g1e),{goBackToPaymentMethods:l}=got();return y1(vBe,{testId:"funding-route-select",header:m1(cze,{onCloseButtonClick:()=>q1e(u)}),footer:m1(Uze,{}),children:[y1(kae,{sx:{display:"flex",flexDirection:"column",paddingX:"base.spacing.x2",paddingY:"base.spacing.x8",rowGap:"base.spacing.x4",height:"100%"},children:[m1(Que,{size:"small",children:r("views.FUND_WITH_SMART_CHECKOUT.fundingRouteSelect.heading")}),0===e.length?[m1(jce,{size:"small",children:r("views.FUND_WITH_SMART_CHECKOUT.fundingRouteSelect.noRoutesAvailable")},"noRoutesAvailableText"),m1(xae,{variant:"tertiary",children:r("views.FUND_WITH_SMART_CHECKOUT.fundingRouteSelect.payWithCard")},"payWithCardButton")]:[m1(Dct,{"data-testid":"funding-route-select-selected-route",onClick:e.length>1?()=>{a(!0)}:()=>{},fundingRoute:e[o],selected:!0,toggleVisible:e.length>1},"selectedFundingRouteMenuItem"),m1(Fct,{fundingRoute:e[o],collectionName:t},"purchaseMenuItem"),m1(xae,{sx:{mt:"auto"},variant:"primary",onClick:()=>{n(e[o]),c({payload:{type:aze.UPDATE_VIEW,view:{type:Xat.FUND_WITH_SMART_CHECKOUT,subView:Yat.FUNDING_ROUTE_EXECUTE}}})},children:r("views.FUND_WITH_SMART_CHECKOUT.fundingRouteSelect.continue")},"continueButton"),m1(xae,{variant:"tertiary",onClick:()=>l(),children:r("views.FUND_WITH_SMART_CHECKOUT.fundingRouteSelect.payWithCardInstead")},"payWithCardButton")]]}),m1(Lct,{visible:i,onCloseDrawer:e=>{s(e),a(!1)},fundingRoutes:e,activeFundingRouteIndex:o})]})}const jct=()=>{const{track:e,page:t}=yBe(),{recipientAddress:n,signResponse:r,paymentMethod:i}=got(),{eventTargetState:{eventTarget:a}}=QQ.useContext(g1e),o=Xat.PAYMENT_METHODS,s={location:"web",userJourney:cBe.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:iot(e),action:"Viewed",...n})},sendCloseEvent:(t=o,n="Button",r="Pressed")=>{e({...s,screen:iot(t),control:"Close",controlType:n,action:r,extras:{...c}}),q1e(a)},sendSuccessEvent:(t=o,n=[],r=[],l={})=>{e({...s,screen:iot(t),control:"Success",controlType:"Event",action:"Succeeded",extras:{...l,...c,transactions:rot(n),...u,paymentMethod:i,tokenIds:r}}),((e,t,n=[],r=[],i="")=>{const a=new CustomEvent(wZ.IMTBL_SALE_WIDGET_EVENT,{detail:{type:OZ.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:iot(l||o),control:"Fail",controlType:"Event",action:"Failed",extras:{...d,transactions:rot(r),...n,...u,...c,paymentMethod:i,reason:t}}),((e,t,n,r,i=[],a="")=>{const o=new CustomEvent(wZ.IMTBL_SALE_WIDGET_EVENT,{detail:{type:OZ.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(wZ.IMTBL_SALE_WIDGET_EVENT,{detail:{type:OZ.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:iot(t),control:"OrderCreated",controlType:"Event",extras:{...n}})},sendSelectedPaymentMethod:(t,n)=>{e({...s,screen:iot(n),control:"Select",controlType:"MenuItem",extras:{paymentMethod:t}}),((e,t)=>{const n=new CustomEvent(wZ.IMTBL_SALE_WIDGET_EVENT,{detail:{type:OZ.PAYMENT_METHOD,data:{paymentMethod:t}}});console.log("Sale payment method event:",n),void 0!==e&&e.dispatchEvent(n)})(a,t)}}};function Uct({subView:e}){const{t:t}=uUe(),{sendPageView:n}=jct(),{viewDispatch:r}=QQ.useContext(oze),[i,a]=QQ.useState(void 0),[o,s]=QQ.useState(0),{querySmartCheckout:c,fundingRoutes:u,smartCheckoutResult:l,collectionName:d,fromTokenAddress:f,sign:p}=got(),{cryptoFiatDispatch:h}=QQ.useContext(Rnt);QQ.useEffect((()=>{e===Yat.INIT&&f&&c()}),[e,f]),QQ.useEffect((()=>{l&&l.sufficient&&(p($at.CRYPTO),r({payload:{type:aze.UPDATE_VIEW,view:{type:Xat.PAY_WITH_COINS}}}))}),[l]),QQ.useEffect((()=>{if(!h||!l)return;const e=lot(l);h({payload:{type:knt.SET_TOKEN_SYMBOLS,tokenSymbols:e}})}),[h,l]);const m=QQ.useMemo((()=>{if(i)return i.steps[o]}),[i,o]);return QQ.useEffect((()=>n(Xat.FUND_WITH_SMART_CHECKOUT,{subView:e,...!!m&&{fundingStep:m.type}})),[]),y1(kae,{children:[e===Yat.INIT&&m1(wBe,{loadingText:t("views.FUND_WITH_SMART_CHECKOUT.loading.checkingBalances")}),e===Yat.FUNDING_ROUTE_SELECT&&m1(Bct,{fundingRoutes:u,collectionName:d,onFundingRouteSelected:e=>{a(e)}}),e===Yat.FUNDING_ROUTE_EXECUTE&&m1(Rct,{onFundingRouteExecuted:()=>{i&&(o===i.steps.length-1?(s(0),a(void 0),r({payload:{type:aze.UPDATE_VIEW,view:{type:Xat.FUND_WITH_SMART_CHECKOUT,subView:Yat.INIT}}})):s(o+1))},fundingRouteStep:m})]})}const zct={[qt.SANDBOX]:"https://global-stg.transak.com",[qt.PRODUCTION]:"https://global.transak.com/"},Hct={[qt.SANDBOX]:"https://api-stg.transak.com",[qt.PRODUCTION]:"https://api.transak.com"},Wct={[qt.SANDBOX]:"STAGING",[qt.PRODUCTION]:"PRODUCTION"},Vct={[qt.SANDBOX]:"d14b44fb-0f84-4db5-affb-e044040d724b",[qt.PRODUCTION]:"ad1bca70-d917-4628-bb0f-5609537498bc"},Gct=e=>{const{contractId:t,environment:n,transakParams:r,onError:i}=e,[a,o]=QQ.useState(""),s=QQ.useCallback((async()=>{try{const{calldata:e,nftData:i,estimatedGasLimit:a,cryptoCurrencyCode:o,...s}=r,c=i?.slice(0,1).map((e=>({...e,imageURL:aot(e.imageURL),nftName:aot(e.nftName)}))),u={contractId:t,cryptoCurrencyCode:o,calldata:e,nftData:c,estimatedGasLimit:(a>0?a:"30000000").toString()},l=`${Hct[n]}/cryptocoverage/api/v1/public/one-click-protocol/nft-transaction-id`,d=await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!d.ok)throw new Error("Failed to get NFT transaction ID");const{id:f}=await d.json(),p=`${zct[n]}?`;return`${p}${new URLSearchParams({apiKey:Vct[n],environment:Wct[n],isNFT:"true",nftTransactionId:f,themeColor:"0D0D0D",...s}).toString()}`}catch{i?.()}return""}),[t,n,r,i]);return QQ.useEffect((()=>{(async()=>{const e=await s();o(e)})()}),[]),{iframeSrc:a}};function qct(e){const{id:t,type:n,email:r,walletAddress:i,isPassportWallet:a,nftData:o,calldata:s,cryptoCurrencyCode:c,estimatedGasLimit:u,exchangeScreenTitle:l,partnerOrderId:d,onOpen:f,onInit:p,onOrderCreated:h,onOrderProcessing:m,onOrderCompleted:y,onOrderFailed:b,onFailedToLoad:g,failedToLoadTimeoutInMs:v,environment:w,contractId:T}=e,E=QQ.useRef(null),{onLoad:A,initialised:x}=$it({userJourney:cBe.SALE,ref:E,walletAddress:i,isPassportWallet:a,onOpen:f,onOrderCreated:h,onOrderProcessing:m,onOrderCompleted:y,onOrderFailed:b,onInit:p,failedToLoadTimeoutInMs:v,onFailedToLoad:g}),{iframeSrc:O}=Gct({type:n,contractId:T,environment:w,transakParams:{nftData:o,calldata:s,cryptoCurrencyCode:c,estimatedGasLimit:u,exchangeScreenTitle:l,email:r,walletAddress:i,partnerOrderId:d},onError:g});return m1("iframe",{id:t,ref:E,src:O,title:"Transak-Iframe",allow:"camera;microphone;fullscreen;payment",style:{height:"100%",width:"100%",border:"none",position:"absolute",top:0,left:0,opacity:x?1:0,transition:"opacity 0.5s ease-out"},onLoad:A,onError:()=>g?.()})}function Kct(e){const{t:t}=uUe(),{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,clientConfig:h}=got(),m=d?.transactions.find((e=>e.methodCall.startsWith("execute")));if(!d||!m)return null;const y=QQ.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 m1(qct,{id:"transak-iframe",type:"nft-checkout",email:c,walletAddress:u,isPassportWallet:l,exchangeScreenTitle:t("views.PAY_WITH_CARD.screenTitle"),nftData:y,calldata:m.rawData,cryptoCurrencyCode:d.order.currency.name,estimatedGasLimit:m.gasEstimate,partnerOrderId:m.params.reference,onInit:n,onOpen:r,onOrderCreated:i,onOrderProcessing:a,onOrderCompleted:o,onOrderFailed:s,onFailedToLoad:()=>{f(Zat.TRANSAK_FAILED)},environment:p,contractId:h.contractId})}function Xct(){const{sendPageView:e}=jct(),[t,n]=QQ.useState(!1),{goBackToPaymentMethods:r,goToErrorView:i,signResponse:a,signTokenIds:o}=got(),{sendOrderCreated:s,sendCloseEvent:c,sendSuccessEvent:u}=jct(),{t:l}=uUe(),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(Xat.SALE_SUCCESS,[],o,w),c(Xat.SALE_SUCCESS)};return QQ.useEffect((()=>e(Xat.PAY_WITH_CARD)),[]),m1(vBe,{header:t&&m1(cze,{onCloseButtonClick:()=>r()}),children:y1(h1,{children:[m1(Sge,{visible:!t,children:m1(Sge.Content,{children:m1(Sge.Content.LoopingText,{text:[l("views.PAY_WITH_CARD.loading")]})})}),m1(kae,{style:{display:"block",position:"relative",maxWidth:"420px",height:"565px",borderRadius:"1%",overflow:"hidden",margin:"0 auto",width:"100%"},children:m1(Kct,{onInit:()=>n(!0),onOrderFailed:()=>{i(Zat.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(Xat.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})})]})})}function Yct(){const{t:e}=uUe(),t=QQ.useRef(!1),{sendPageView:n,sendTransactionSuccessEvent:r,sendFailedEvent:i,sendCloseEvent:a,sendSuccessEvent:o}=jct(),{execute:s,signResponse:c,executeResponse:u,signTokenIds:l,provider:d}=got(),f=u?.transactions.length||0;let p=[e("views.PAYMENT_METHODS.loading.ready1"),e("views.PAYMENT_METHODS.loading.ready2"),e("views.PAYMENT_METHODS.loading.ready3")];f>=1&&(p=[e("views.PAYMENT_METHODS.loading.processing1"),e("views.PAYMENT_METHODS.loading.processing2"),e("views.PAYMENT_METHODS.loading.processing3")]);return QQ.useEffect((()=>{void 0!==c&&!1===t.current&&(t.current=!0,(async()=>{const e=!("isMetaMask"in d?.provider&&d?.provider.isMetaMask);s(c,e,(e=>{r(e)}),((e,t)=>{const n={transactionId:c?.transactionId};i(e.toString(),e,t,void 0,n)}))})())}),[c]),QQ.useEffect((()=>{if(!0===u?.done){const e={transactionId:c?.transactionId};o(Xat.SALE_SUCCESS,u?.transactions,l,e),a(Xat.SALE_SUCCESS)}}),[u]),QQ.useEffect((()=>n(Xat.PAY_WITH_COINS)),[]),m1(wBe,{loadingText:p})}function Jct({type:e,onClick:t,disabled:n=!1,caption:r,rc:i=m1("span",{})}){const{t:a}=uUe(),o={[CZ.CRYPTO]:"Coins",[CZ.DEBIT]:"BankCard",[CZ.CREDIT]:"BankCard"};return y1(nhe,{rc:i,size:"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:[m1(nhe.FramedIcon,{icon:o[e]}),m1(nhe.Label,{size:"medium",children:a(`views.PAYMENT_METHODS.options.${e}.heading`)}),!n&&m1(nhe.IntentIcon,{}),m1(nhe.Caption,{children:r||a(`views.PAYMENT_METHODS.options.${e}.${n?"disabledCaption":"caption"}`)})]})}const Zct=[CZ.CRYPTO,CZ.DEBIT,CZ.CREDIT];function Qct(e){const{disabledOptions:t=[],paymentOptions:n,onClick:r,captions:i}=e,a=n||Zct;return m1(kae,{testId:"payment-options-list",sx:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start"},rc:m1(O7.div,{variants:H0e,initial:"hidden",animate:"show"}),children:a.map(((e,n)=>m1(Jct,{type:e,onClick:r,disabled:t.includes(e),caption:i?.[e],rc:m1(O7.div,{custom:n,variants:W0e})},`payment-type-${e}`)))})}function $ct(){return m1(kae,{testId:"credit-card-warning-hero",children:m1(kae,{children:y1("svg",{width:"430",height:"161",viewBox:"0 0 430 161",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[m1("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"}),m1("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"}),m1("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"}),m1("path",{d:"M170.261 125.267V114.74L239.346 75.0625V85.3194L170.261 125.267Z",fill:"#0D0D0D",stroke:"black",strokeWidth:"0.823233"}),y1("g",{clipPath:"url(#clip0_1548_70742)",children:[m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"}),m1("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"})]}),m1("defs",{children:m1("clipPath",{id:"clip0_1548_70742",children:m1("rect",{width:"58",height:"66",fill:"white",transform:"translate(210 70)"})})})]})})})}function eut({visible:e,setShowCreditCardWarning:t,setPaymentMethod:n}){const{t:r}=uUe();return m1(Cde,{size:"threeQuarter",visible:e,showHeaderBar:!1,onCloseDrawer:()=>t(!1),children:y1(Cde.Content,{children:[m1(soe,{icon:"Close",variant:"tertiary",sx:{pos:"absolute",top:"base.spacing.x5",left:"base.spacing.x5",backdropFilter:"blur(30px)"},onClick:()=>t(!1)}),m1($ct,{}),y1(kae,{sx:{px:"base.spacing.x12"},children:[m1(Que,{sx:{marginTop:"base.spacing.x6",marginBottom:"base.spacing.x2",textAlign:"center"},children:r("views.PAYMENT_METHODS.creditCardWarningDrawer.heading")}),m1(jce,{size:"medium",sx:{display:"block",textAlign:"center",color:"base.color.text.body.secondary",marginBottom:"base.spacing.x13"},children:r("views.PAYMENT_METHODS.creditCardWarningDrawer.body")}),m1(xae,{sx:{width:"100%"},testId:"credit-card-button",variant:"primary",size:"large",onClick:()=>n(CZ.CREDIT),children:r("views.PAYMENT_METHODS.creditCardWarningDrawer.ctaButton")})]})]})})}function tut(){const[e,t]=QQ.useState(!1),{t:n}=uUe(),{viewDispatch:r}=QQ.useContext(oze),{sign:i,goToErrorView:a,paymentMethod:o,setPaymentMethod:s,disabledPaymentTypes:c,invalidParameters:u,multicurrency:l}=got(),{sendPageView:d,sendCloseEvent:f,sendSelectedPaymentMethod:p}=jct();return QQ.useEffect((()=>{if(o&&p(o,Xat.PAYMENT_METHODS),o&&[CZ.DEBIT,CZ.CREDIT].includes(o)&&(i($at.FIAT,void 0,(()=>{r({payload:{type:aze.UPDATE_VIEW,view:{type:Xat.PAY_WITH_CARD}}})})),r({payload:{type:aze.UPDATE_VIEW,view:{type:rze.LOADING_VIEW,data:{loadingText:n("views.PAYMENT_METHODS.loading.ready1")}}}})),o&&o===CZ.CRYPTO){if(l)return void r({payload:{type:aze.UPDATE_VIEW,view:{type:Xat.ORDER_SUMMARY,subView:Jat.INIT}}});r({payload:{type:aze.UPDATE_VIEW,view:{type:Xat.FUND_WITH_SMART_CHECKOUT,subView:Yat.INIT}}})}}),[o]),QQ.useEffect((()=>d(Xat.PAYMENT_METHODS)),[]),QQ.useEffect((()=>{u&&a(Zat.INVALID_PARAMETERS)}),[u]),y1(vBe,{testId:"payment-methods",header:m1(cze,{onCloseButtonClick:()=>f(Xat.PAYMENT_METHODS)}),footer:m1(Uze,{}),children:[y1(kae,{sx:{display:"flex",flexDirection:"column",paddingX:"base.spacing.x2",paddingY:"base.spacing.x8",rowGap:"base.spacing.x4"},children:[m1(Que,{size:"small",sx:{paddingX:"base.spacing.x4"},children:n("views.PAYMENT_METHODS.header.heading")}),m1(kae,{sx:{paddingX:"base.spacing.x2"},children:m1(Qct,{disabledOptions:c,onClick:e=>{e===CZ.CREDIT?t(!0):s(e)}})})]}),m1(eut,{visible:e,setShowCreditCardWarning:t,setPaymentMethod:s})]})}function nut({biomeTheme:e,transactionHash:t,blockExplorerLink:n,errorType:r=Zat.DEFAULT}){const{t:i}=uUe(),{goBackToPaymentMethods:a}=got(),{eventTargetState:{eventTarget:o}}=QQ.useContext(g1e),s=()=>{q1e(o)},c={[Zat.TRANSACTION_FAILED]:{onActionClick:a,onSecondaryActionClick:t?()=>{window.open(n)}:s,statusType:a1e.FAILURE,statusIconStyles:{fill:e.color.status.destructive.dim}},[Zat.SERVICE_BREAKDOWN]:{onSecondaryActionClick:s,statusType:a1e.INFORMATION,statusIconStyles:{fill:e.color.status.fatal.dim}},[Zat.PRODUCT_NOT_FOUND]:{onSecondaryActionClick:s,statusType:a1e.INFORMATION,statusIconStyles:{fill:e.color.status.fatal.dim}},[Zat.INSUFFICIENT_STOCK]:{onSecondaryActionClick:s,statusType:a1e.INFORMATION,statusIconStyles:{fill:e.color.status.fatal.dim}},[Zat.TRANSAK_FAILED]:{onActionClick:a,onSecondaryActionClick:s,statusType:a1e.INFORMATION},[Zat.WALLET_FAILED]:{onActionClick:a,onSecondaryActionClick:s,statusType:a1e.INFORMATION,statusIconStyles:{fill:e.color.status.fatal.dim}},[Zat.WALLET_REJECTED_NO_FUNDS]:{onActionClick:a,onSecondaryActionClick:s,statusType:a1e.INFORMATION},[Zat.WALLET_REJECTED]:{onActionClick:()=>{a(CZ.CRYPTO)},onSecondaryActionClick:s,statusType:a1e.INFORMATION},[Zat.WALLET_POPUP_BLOCKED]:{onActionClick:()=>{a(CZ.CRYPTO)},onSecondaryActionClick:s,statusType:a1e.INFORMATION},[Zat.SMART_CHECKOUT_ERROR]:{onActionClick:a,onSecondaryActionClick:s,statusType:a1e.INFORMATION},[Zat.SMART_CHECKOUT_EXECUTE_ERROR]:{onActionClick:a,onSecondaryActionClick:s,statusType:a1e.INFORMATION},[Zat.INVALID_PARAMETERS]:{onSecondaryActionClick:s,statusType:a1e.ALERT,statusIconStyles:{fill:e.color.status.attention.dim,transform:"none"}},[Zat.DEFAULT]:{onActionClick:a,onSecondaryActionClick:s,statusType:a1e.INFORMATION}};return m1(p1e,{...(()=>{const n=c[r]||{},a=r===Zat.TRANSACTION_FAILED&&t?i(`views.SALE_FAIL.errors.${r}.secondaryAction`):i(`views.SALE_FAIL.errors.${Zat.DEFAULT}.secondaryAction`);return{testId:"fail-view",statusText:i(`views.SALE_FAIL.errors.${r}.description`),actionText:i(`views.SALE_FAIL.errors.${r}.primaryAction`),onActionClick:n?.onActionClick,secondaryActionText:a,onSecondaryActionClick:n?.onSecondaryActionClick,onCloseClick:s,statusType:n.statusType,statusIconStyles:{transform:"rotate(180deg)",fill:e.color.status.guidance.dim,...n.statusIconStyles}}})()})}function rut({balance:e,conversions:t,canOpen:n,onClick:r,onProceed:i,loading:a,priceDisplay:o}){const{t:s}=uUe(),{token:c,userBalance:u,fundsRequired:l}=e.fundingItem,d=Oze(u.formattedBalance,c.symbol,t,"");return y1(Dae,{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:[y1(nhe,{size:"medium",children:[m1(nhe.FramedImage,{imageUrl:c.icon,alt:c.name,circularFrame:!0}),m1(nhe.Label,{children:s("views.ORDER_SUMMARY.orderReview.payWith",{symbol:c.symbol})}),m1(nhe.Caption,{rc:m1(Que,{size:"xSmall"}),children:s("views.ORDER_SUMMARY.orderReview.balance",{amount:Sze(u.formattedBalance)})}),o&&m1(nhe.PriceDisplay,{use:m1(Que,{size:"xSmall"}),fiatAmount:d?s("views.ORDER_SUMMARY.currency.fiat",{amount:d}):void 0,price:s("views.ORDER_SUMMARY.currency.price",{symbol:c.symbol,amount:Sze(l.formattedAmount)})}),n&&m1(nhe.StatefulButtCon,{icon:"ChevronExpand",onClick:r}),!n&&a&&m1(Rge,{radius:"base.icon.size.400"})]}),m1(xae,{size:"large",onClick:()=>i(e),children:s("views.ORDER_SUMMARY.orderReview.continue")})]})}const iut=e=>{let t=[];e.type===JZ.SWAP&&(t=[e.fees.approvalGasFee,e.fees.swapGasFee,...e.fees.swapFees]);const n=t.filter((e=>e.amount.gt(0)&&e.token)).reduce(((e,{amount:t,token:n})=>{if(!n)return e;if(e[n.symbol]){const r=e[n.symbol].amount.add(t);return{...e,[n.symbol]:{...e[n.symbol],amount:r,formattedAmount:Vp(r,n.decimals)}}}return n.symbol?{...e,[n.symbol]:{amount:t,symbol:n.symbol,formattedAmount:Vp(t,n.decimals)}}:e}),{});return n};function aut({rc:e=m1("span",{}),balance:t,conversions:n,selected:r,transactionRequirement:i,onClick:a,theme:o}){const{t:s}=uUe(),{environment:c}=got(),{token:u,userBalance:l,fundsRequired:d}=t.fundingItem,f=Oze(l.formattedBalance,u.symbol,n,""),p=Object.entries(iut(t));return y1(nhe,{rc:e,sx:{mb:"base.spacing.x1"},size:"medium",emphasized:!0,...{onClick:a,selected:r},children:[m1(nhe.FramedImage,{circularFrame:!0,alt:u.name,imageUrl:u.icon,defaultImageUrl:Mze(c,o)}),m1(nhe.PriceDisplay,{use:m1(Que,{size:"xSmall"}),fiatAmount:f?s("views.ORDER_SUMMARY.currency.fiat",{amount:f}):void 0,price:Sze(l.formattedBalance)}),m1(nhe.Label,{sx:{display:"flex",wordBreak:"default"},children:u.symbol}),y1(nhe.Caption,{children:[s(`views.ORDER_SUMMARY.coinsDrawer.stepType${i?.sufficient?".":".delta."}${t.type}`,{required:{symbol:i?.current.type!==GZ.ERC721&&i?.current.token.symbol,amount:Sze(i?.current.formattedBalance||0)},symbol:t.fundingItem.token.symbol,amount:Sze(d.formattedAmount)}),p.length>0&&" | ",p.length>0&&p.map((([e,{formattedAmount:t}])=>y1("span",{children:[s("views.ORDER_SUMMARY.coinsDrawer.fee",{symbol:e,amount:Sze(t)})," "]},e)))]})]})}function out({conversions:e,balances:t,selectedIndex:n,visible:r,loading:i,transactionRequirement:a,onClose:o,onSelect:s,onPayWithCard:c,disabledPaymentTypes:u,theme:l}){const{t:d}=uUe(),f=e=>()=>{s(e),o()};return m1(Cde,{size:"full",visible:r,showHeaderBar:!0,onCloseDrawer:o,headerBarTitle:d("views.ORDER_SUMMARY.coinsDrawer.header"),children:m1(Cde.Content,{rc:m1(O7.div,{variants:H0e,initial:"hidden",animate:"show"}),children:y1(kae,{sx:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between",px:"base.spacing.x4"},children:[y1(kae,{children:[y1(kae,{sx:{display:"flex",justifyContent:"space-between",mb:"base.spacing.x2"},children:[m1($me,{size:"small",children:d("views.ORDER_SUMMARY.coinsDrawer.caption1")}),m1($me,{size:"small",children:d("views.ORDER_SUMMARY.coinsDrawer.caption2")})]}),t.map(((t,r)=>m1(aut,{theme:l,onClick:f(r),balance:t,selected:n===r,conversions:e,transactionRequirement:a,rc:m1(O7.div,{variants:W0e,custom:r})},`${t.fundingItem.token.symbol}-${t.type}`))),i&&m1(O7.div,{variants:W0e,custom:t.length,children:m1(nhe,{shimmer:!0,emphasized:!0,testId:"funding-balance-item-shimmer"})},"funding-balance-item-shimmer")]}),c&&y1(kae,{sx:{pb:"base.spacing.x4"},rc:m1(O7.div,{variants:W0e,custom:t.length+(i?1:0)}),children:[m1(qae,{size:"small",rc:m1($me,{}),sx:{my:"base.spacing.x4"},children:d("views.ORDER_SUMMARY.coinsDrawer.divider")}),m1(Qct,{onClick:c,paymentOptions:[CZ.DEBIT,CZ.CREDIT].filter((e=>!u?.includes(e))),captions:{[CZ.DEBIT]:d("views.ORDER_SUMMARY.coinsDrawer.payWithCard.caption"),[CZ.CREDIT]:d("views.ORDER_SUMMARY.coinsDrawer.payWithCard.caption")}})]})]})})})}function sut({item:e,balance:t,conversions:n,rc:r=m1("span",{})}){const{t:i}=uUe(),{token:a,fundsRequired:o}=t.fundingItem,s=o.formattedAmount,c=Oze(s,a.symbol,n);return y1(nhe,{rc:r,emphasized:!0,size:"medium",sx:{pointerEvents:"none",mb:"base.spacing.x1"},children:[m1(nhe.FramedImage,{imageUrl:e.image}),m1(nhe.Label,{children:e.name}),m1(nhe.Caption,{children:e.qty>1?i("views.ORDER_SUMMARY.orderItem.quantity",{qty:e.qty}):null}),m1(nhe.PriceDisplay,{use:m1(Que,{size:"xSmall"}),price:i("views.ORDER_SUMMARY.currency.price",{symbol:a.symbol,amount:Sze(s)}),fiatAmount:i("views.ORDER_SUMMARY.currency.fiat",{amount:c})})]},e.name)}function cut({items:e,balance:t,conversions:n}){return m1(kae,{rc:m1(O7.div,{variants:H0e,initial:"hidden",animate:"show"}),children:e.map(((e,r)=>m1(sut,{item:e,balance:t,conversions:n,rc:m1(O7.div,{variants:W0e,custom:r})},e.name)))})}function uut({items:e,fundingBalances:t,conversions:n,collectionName:r,loadingBalances:i,transactionRequirement:a,onBackButtonClick:o,onPayWithCard:s,onProceedToBuy:c,disabledPaymentTypes:u,theme:l}){const{eventTargetState:{eventTarget:d}}=QQ.useContext(g1e),{t:f}=uUe(),[p,h]=QQ.useState(!1),[m,y]=QQ.useState(0);return y1(vBe,{testId:"order-review",header:m1(cze,{showBack:!0,onCloseButtonClick:()=>q1e(d),onBackButtonClick:o,title:r}),footer:m1(Uze,{}),bodyStyleOverrides:{display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[y1(kae,{sx:{display:"flex",flexDirection:"column",paddingX:"base.spacing.x2",paddingY:"base.spacing.x8",rowGap:"base.spacing.x4"},children:[m1(Que,{size:"small",sx:{paddingX:"base.spacing.x4"},children:f("views.ORDER_SUMMARY.orderReview.heading")}),m1(kae,{sx:{paddingX:"base.spacing.x2"},children:m1(cut,{items:e,balance:t[m],conversions:n})})]}),m1(rut,{onClick:()=>{h(!0)},onProceed:c,balance:t[m],conversions:n,canOpen:t.length>1,loading:i}),m1(out,{theme:l,conversions:n,balances:t,onSelect:e=>{y(e)},onClose:()=>{h(!1)},selectedIndex:m,visible:p,loading:i,onPayWithCard:s,transactionRequirement:a,disabledPaymentTypes:u})]})}const lut=(e,t)=>{const n=kze(e.address)?e.symbol:e.address??"";return{...e,icon:Nze(t,n)}},dut=(e,t)=>{return{type:eot.SUFFICIENT,fundingItem:{type:GZ.ERC20,token:lut((n=e,n.current.type!==GZ.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},fut=(e,t)=>{if(0===e.length)return[];const n=e.filter((e=>1===e.steps.length)),r=[GZ.ERC20,GZ.NATIVE];return n.flatMap((e=>e.steps.filter((e=>r.includes(e.fundingItem.type))))).map((e=>({...e,fundingItem:{...e.fundingItem,token:lut(e.fundingItem.token,t)}})))},put=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===eot.SUFFICIENT&&t.type===eot.SUFFICIENT?0:e.type===eot.SUFFICIENT?-1:t.type===eot.SUFFICIENT?1:0});var r;return e=>(0===e.length||(t=Array.from(new Set([...t,...e])).sort(n)),t)},hut=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=put(i),h=e=>{Array.isArray(e)&&e.length>0&&a(p(e))},m=r.map((async e=>{const r=((e,t,n)=>[{type:GZ.ERC20,tokenAddress:n,spenderAddress:t,amount:e}])(o(e)||"0",d,e.address),i=s()?void 0:{type:qZ.GAS,gasToken:{type:KZ.NATIVE,limit:jr.from("30000000")}};return{currency:e,smartCheckoutResult:await n.smartCheckout({provider:t,itemRequirements:r,transactionOrGasAmount:i,routingOptions:{bridge:!1,onRamp:!1,swap:!0},fundingRouteFullAmount:!0,onComplete:()=>{c?.(p([]))},onFundingRoute:e=>{h(fut([e],f))}})}})),y=await(async(e,t)=>{const n=e.map((async e=>{const n=await e;return t(n),n}));return await Promise.all(n)})(m,(({currency:e,smartCheckoutResult:t})=>{if(h(((e,t)=>{if(!0===e.sufficient){const n=e.transactionRequirements.find((e=>e.type===GZ.ERC20));if(n&&n.type===GZ.ERC20)return[dut(n,t)]}return!1===e.sufficient&&e?.router?.routingOutcome.type===XZ.ROUTES_FOUND?fut(e.router.routingOutcome.fundingRoutes,t):null})(t,f)),e.base){const e=t.transactionRequirements[0];u(e)}}));return y},mut=()=>{const e=QQ.useRef(!1),{fromTokenAddress:t,clientConfig:n,provider:r,checkout:i,selectedCurrency:a}=got(),[o,s]=QQ.useState(),[c,u]=QQ.useState([]),[l,d]=QQ.useState([]),[f,p]=QQ.useState(!1);return{fundingBalances:c,loadingBalances:f,fundingBalancesResult:l,transactionRequirement:o,queryFundingBalances:()=>{t&&r&&i&&n&&a&&(e.current||(async()=>{e.current=!0,p(!0);try{const e=await hut({provider:r,checkout:i,currencies:n.currencies,routingOptions:{bridge:!1,onRamp:!1,swap:!0},baseCurrency:a,getAmountByCurrency:e=>n.currencyConversion?.[e.name]?.amount?.toString(),getIsGasless:()=>r.provider?.isPassport||!1,onFundingBalance:e=>{u([...e])},onComplete:()=>{p(!1)},onFundingRequirement:e=>{s(e)}});d(e)}catch{p(!1)}finally{e.current=!1}})())}}},yut=e=>{if(e&&e.current.type!==GZ.ERC721)return e.current.token},but=e=>{const t=e.find((({type:e})=>e===GZ.NATIVE)),n=e.find((({type:e})=>e===GZ.ERC20)),r={erc20:{value:n?.delta.formattedBalance,symbol:yut(n)?.symbol},native:{value:t?.delta.formattedBalance,symbol:yut(t)?.symbol}};let i=["views.PAYMENT_METHODS.topUp.subheading.erc20",r],a=n?.delta.formattedBalance||"0",o=yut(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=yut(t)?.address,i=["views.PAYMENT_METHODS.topUp.subheading.native",r]),{heading:["views.PAYMENT_METHODS.topUp.heading"],subheading:i,amount:a,tokenAddress:o}};function gut({subView:e}){const{t:t}=uUe(),{items:n,fromTokenAddress:r,collectionName:i,disabledPaymentTypes:a,goToErrorView:o,goBackToPaymentMethods:s,sign:c,selectedCurrency:u,config:l}=got(),{viewDispatch:d,viewState:f}=QQ.useContext(oze),{cryptoFiatDispatch:p,cryptoFiatState:h}=QQ.useContext(Rnt),m=e=>{c($at.CRYPTO,e),d({payload:{type:aze.UPDATE_VIEW,view:{type:Xat.PAY_WITH_COINS}}})},y=()=>{m(u?.address)},{fundingBalances:b,loadingBalances:g,fundingBalancesResult:v,transactionRequirement:w,queryFundingBalances:T}=mut();return QQ.useEffect((()=>{e===Jat.INIT&&r&&T()}),[e,r]),QQ.useEffect((()=>{0!==b.length&&d({payload:{type:aze.UPDATE_VIEW,view:{type:Xat.ORDER_SUMMARY,subView:Jat.REVIEW_ORDER}}})}),[b]),QQ.useEffect((()=>{if(!g&&v.length&&!(b.length>0))try{const e=v.find((e=>e.currency.base))?.smartCheckoutResult,t=but(e.transactionRequirements);d({payload:{type:aze.UPDATE_VIEW,view:{type:rze.TOP_UP_VIEW,data:t}}})}catch(e){o(Zat.SMART_CHECKOUT_EXECUTE_ERROR,e)}}),[b,g,v]),QQ.useEffect((()=>{if(!p||0===b.length||g)return;const e=b.map((({fundingItem:e})=>e.token.symbol));p({payload:{type:knt.SET_TOKEN_SYMBOLS,tokenSymbols:e}})}),[p,b,g]),y1(kae,{children:[e===Jat.INIT&&m1(wBe,{loadingText:t("views.FUND_WITH_SMART_CHECKOUT.loading.checkingBalances")}),e===Jat.REVIEW_ORDER&&m1(uut,{items:n,theme:l.theme,fundingBalances:b,conversions:h.conversions,collectionName:i,loadingBalances:g,onBackButtonClick:s,onProceedToBuy:e=>{const{type:t,fundingItem:{token:n}}=e;t!==eot.SUFFICIENT?d({payload:{type:aze.UPDATE_VIEW,view:{type:Xat.ORDER_SUMMARY,subView:Jat.EXECUTE_FUNDING_ROUTE,data:{fundingBalance:e,onFundingRouteExecuted:y}}}}):m(n.address)},transactionRequirement:w,onPayWithCard:e=>s(e),disabledPaymentTypes:a}),e===Jat.EXECUTE_FUNDING_ROUTE&&m1(Rct,{fundingRouteStep:f.view.data.fundingBalance,onFundingRouteExecuted:y})]})}var vut=Object.freeze({__proto__:null,default:function(e){const{t:t}=uUe(),{config:n,amount:r,items:i,environmentId:a,collectionName:o,excludePaymentTypes:s,multicurrency:c=!1}=e,{connectLoaderState:u}=QQ.useContext(Tze),{checkout:l,provider:d}=u,f=QQ.useRef(),{eventTargetState:{eventTarget:p}}=QQ.useContext(g1e),{theme:h}=n,m=QQ.useMemo((()=>sRe(h)),[h]),[y,b]=QQ.useReducer(sze,ize),g=QQ.useMemo((()=>({viewState:y,viewDispatch:b})),[y,b]),v=y.view.data?.loadingText||t("views.LOADING_VIEW.text");QQ.useEffect((()=>{l&&d&&(async()=>{const e=await l.getNetworkInfo({provider:d});f.current=e.chainId})()}),[l,d]);const w=QQ.useRef(!1),T=QQ.useCallback((()=>{l&&d&&(w.current||(w.current=!0,b({payload:{type:aze.UPDATE_VIEW,view:{type:Xat.PAYMENT_METHODS}}})))}),[l,d]);return QQ.useEffect((()=>{l&&d&&T()}),[l,d]),m1(oze.Provider,{value:g,children:m1(bot,{value:{config:n,items:i,amount:r,environment:n.environment,environmentId:a,provider:d,checkout:l,passport:l?.passport,collectionName:o,excludePaymentTypes:s,multicurrency:c},children:y1(jrt,{environment:n.environment,children:[y.view.type===rze.LOADING_VIEW&&m1(wBe,{loadingText:v}),y.view.type===Xat.PAYMENT_METHODS&&m1(tut,{}),y.view.type===Xat.PAY_WITH_CARD&&m1(Xct,{}),y.view.type===Xat.PAY_WITH_COINS&&m1(Yct,{}),y.view.type===Xat.SALE_FAIL&&m1(nut,{biomeTheme:m,errorType:y.view.data?.errorType,transactionHash:y.view.data?.transactionHash,blockExplorerLink:hQ.getTransactionLink(f.current,y.view.data?.transactionHash)}),y.view.type===Xat.FUND_WITH_SMART_CHECKOUT&&m1(Uct,{subView:y.view.subView}),y.view.type===Xat.ORDER_SUMMARY&&m1(gut,{subView:y.view.subView}),y.view.type===rze.TOP_UP_VIEW&&m1(Jrt,{analytics:{userJourney:cBe.SALE},widgetEvent:wZ.IMTBL_SALE_WIDGET_EVENT,checkout:l,provider:d,showOnrampOption:n.isOnRampEnabled,showSwapOption:n.isSwapEnabled,showBridgeOption:n.isBridgeEnabled,onCloseButtonClick:()=>q1e(p),onBackButtonClick:()=>{b({payload:{type:aze.UPDATE_VIEW,view:{type:Xat.PAYMENT_METHODS}}})},amount:y.view.data?.amount,tokenAddress:y.view.data?.tokenAddress,heading:y.view.data?.heading,subheading:y.view.data?.subheading})]})})})}}),wut={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}])}(wut);var Tut=wut.exports,Eut=t({__proto__:null,default:lt(Tut)},[Tut]);e.WidgetsFactory=class{sdk;widgetConfig;constructor(e,t){if(this.sdk=e,this.widgetConfig=t,this.widgetConfig.theme||(this.widgetConfig.theme=xUe),t.walletConnect)try{F0e.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){WUe(e),VUe({provider:e})}create(e,t){const{provider:n}=t??{},r=t?.config||{};switch(e){case PZ.CONNECT:return new KUe(this.sdk,{config:{...this.widgetConfig,...r},provider:n});case PZ.BRIDGE:return new J1e(this.sdk,{config:{...this.widgetConfig,...r},provider:n});case PZ.WALLET:return new G1e(this.sdk,{config:{...this.widgetConfig,...r},provider:n});case PZ.SWAP:return new F1e(this.sdk,{config:{...this.widgetConfig,...r},provider:n});case PZ.ONRAMP:return new H1e(this.sdk,{config:{...this.widgetConfig,...r},provider:n});case PZ.SALE:return new X1e(this.sdk,{config:{...this.widgetConfig,...r},provider:n});default:throw new Error("widget type not supported")}}}}));
|