herald-exchange-offramp-widget 1.0.2 → 1.0.3
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/Readme.md +10 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/SellAdminCryptoAccount.tsx +7 -5
package/dist/index.mjs
CHANGED
@@ -20,5 +20,5 @@ import*as e from"react";import t,{useState as n,useCallback as i,forwardRef as o
|
|
20
20
|
* @license qrcode.react
|
21
21
|
* Copyright (c) Paul O'Shannessy
|
22
22
|
* SPDX-License-Identifier: ISC
|
23
|
-
*/function Ro(e,t=0){const n=[];return e.forEach((function(e,i){let o=null;e.forEach((function(s,r){if(!s&&null!==o)return n.push(`M${o+t} ${i+t}h${r-o}v1H${o+t}z`),void(o=null);if(r!==e.length-1)s&&null===o&&(o=r);else{if(!s)return;null===o?n.push(`M${r+t},${i+t} h1v1H${r+t}z`):n.push(`M${o+t},${i+t} h${r+1-o}v1H${o+t}z`)}}))})),n.join("")}function Xo(e,t){return e.slice().map(((e,n)=>n<t.y||n>=t.y+t.h?e:e.map(((e,n)=>(n<t.x||n>=t.x+t.w)&&e))))}function ko({value:e,level:n,minVersion:i,includeMargin:o,marginSize:s,imageSettings:r,size:a,boostLevel:l}){let c=t.useMemo((()=>{const t=(Array.isArray(e)?e:[e]).reduce(((e,t)=>(e.push(...Go.QrSegment.makeSegments(t)),e)),[]);return Go.QrCode.encodeSegments(t,Co[n],i,void 0,void 0,l)}),[e,n,i,l]);const{cells:d,margin:u,numCells:p,calculatedImageSettings:m}=t.useMemo((()=>{let e=c.getModules();const t=function(e,t){return null!=t?Math.max(Math.floor(t),0):e?4:0}(o,s),n=e.length+2*t,i=function(e,t,n,i){if(null==i)return null;const o=e.length+2*n,s=Math.floor(.1*t),r=o/t,a=(i.width||s)*r,l=(i.height||s)*r,c=null==i.x?e.length/2-a/2:i.x*r,d=null==i.y?e.length/2-l/2:i.y*r,u=null==i.opacity?1:i.opacity;let p=null;if(i.excavate){let e=Math.floor(c),t=Math.floor(d);p={x:e,y:t,w:Math.ceil(a+c-e),h:Math.ceil(l+d-t)}}return{x:c,y:d,h:l,w:a,excavation:p,opacity:u,crossOrigin:i.crossOrigin}}(e,a,t,r);return{cells:e,margin:t,numCells:n,calculatedImageSettings:i}}),[c,a,r,o,s]);return{qrcode:c,margin:u,cells:d,numCells:p,calculatedImageSettings:m}}var No=function(){try{(new Path2D).addPath(new Path2D)}catch(e){return!1}return!0}(),Wo=t.forwardRef((function(e,n){const i=e,{value:o,size:s=Bo,level:r=wo,bgColor:a=Fo,fgColor:l=Zo,includeMargin:c=Qo,minVersion:d=Ao,boostLevel:u,marginSize:p,imageSettings:m}=i,g=_o(i,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:b}=g,f=_o(g,["style"]),h=null==m?void 0:m.src,I=t.useRef(null),v=t.useRef(null),y=t.useCallback((e=>{I.current=e,"function"==typeof n?n(e):n&&(n.current=e)}),[n]),[x,_]=t.useState(!1),{margin:G,cells:C,numCells:B,calculatedImageSettings:w}=ko({value:o,level:r,minVersion:d,boostLevel:u,includeMargin:c,marginSize:p,imageSettings:m,size:s});t.useEffect((()=>{if(null!=I.current){const e=I.current,t=e.getContext("2d");if(!t)return;let n=C;const i=v.current,o=null!=w&&null!==i&&i.complete&&0!==i.naturalHeight&&0!==i.naturalWidth;o&&null!=w.excavation&&(n=Xo(C,w.excavation));const r=window.devicePixelRatio||1;e.height=e.width=s*r;const c=s/B*r;t.scale(c,c),t.fillStyle=a,t.fillRect(0,0,B,B),t.fillStyle=l,No?t.fill(new Path2D(Ro(n,G))):C.forEach((function(e,n){e.forEach((function(e,i){e&&t.fillRect(i+G,n+G,1,1)}))})),w&&(t.globalAlpha=w.opacity),o&&t.drawImage(i,w.x+G,w.y+G,w.w,w.h)}})),t.useEffect((()=>{_(!1)}),[h]);const F=xo({height:s,width:s},b);let Z=null;return null!=h&&(Z=t.createElement("img",{src:h,key:h,style:{display:"none"},onLoad:()=>{_(!0)},ref:v,crossOrigin:null==w?void 0:w.crossOrigin})),t.createElement(t.Fragment,null,t.createElement("canvas",xo({style:F,height:s,width:s,ref:y,role:"img"},f)),Z)}));Wo.displayName="QRCodeCanvas";var Lo,Do,Vo,Uo=t.forwardRef((function(e,n){const i=e,{value:o,size:s=Bo,level:r=wo,bgColor:a=Fo,fgColor:l=Zo,includeMargin:c=Qo,minVersion:d=Ao,boostLevel:u,title:p,marginSize:m,imageSettings:g}=i,b=_o(i,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:f,cells:h,numCells:I,calculatedImageSettings:v}=ko({value:o,level:r,minVersion:d,boostLevel:u,includeMargin:c,marginSize:m,imageSettings:g,size:s});let y=h,x=null;null!=g&&null!=v&&(null!=v.excavation&&(y=Xo(h,v.excavation)),x=t.createElement("image",{href:g.src,height:v.h,width:v.w,x:v.x+f,y:v.y+f,preserveAspectRatio:"none",opacity:v.opacity,crossOrigin:v.crossOrigin}));const _=Ro(y,f);return t.createElement("svg",xo({height:s,width:s,viewBox:`0 0 ${I} ${I}`,ref:n,role:"img"},b),!!p&&t.createElement("title",null,p),t.createElement("path",{fill:a,d:`M0,0 h${I}v${I}H0z`,shapeRendering:"crispEdges"}),t.createElement("path",{fill:l,d:_,shapeRendering:"crispEdges"}),x)}));function Eo(e){var t,n,i,o,s,r=e.mode,a=e.token;return"development"===r?(i={BNB:97,BUSD:97,ETH:11155111,USDT:11155111,BITCOIN:10001,AVAX:43113,MATIC:84432,SOL:102,XRP:2,POLYGON_AMOY:84432,NILE:3,TRX:1},(t={})[(s={ETHEREUM:11155111,MATIC:84432,BINANCE:97,BITCOIN:10001,AVAX:43113,SOLANA:102,RIPPLE:2,POLYGON_AMOY:84432,NILE:3,TRX:1}).ETHEREUM]="https://api-sepolia.etherscan.io",t[s.MATIC]="https://api-amoy.polygonscan.com",t[s.BINANCE]="https://api-testnet.bscscan.com",t[s.SOLANA]="https://api.devnet.solana.com",t[s.POLYGON_AMOY]="https://api-amoy.polygonscan.com",t[s.NILE]="https://nile.trongrid.io",t[s.TRX]="https://api.shasta.trongrid.io",o=t):(i={BNB:56,ETH:1,BITCOIN:10001,AVAX:43113,MATIC:137,SOL:101,TRX:2},(n={})[(s={ETHEREUM:1,POLYGON:137,BINANCE:56,BITCOIN:10001,AVAX:43113,SOLANA:101,TRX:2}).ETHEREUM]="https://api.etherscan.io",n[s.MATIC]="https://api.polygonscan.com",n[s.BINANCE]="https://api.bscscan.com",n[s.SOLANA]="https://api.mainnet-beta.solana.com",n[s.POLYGON_AMOY]="https://api.polygonscan.com",n[s.TRX]="https://api.trongrid.io",o=n),o[i[a]]}Uo.displayName="QRCodeSVG","production"!=process.env.NODE_ENV?((Lo={})[(Vo={ETHEREUM:11155111,MATIC:84432,BINANCE:97,BITCOIN:10001,AVAX:43113,SOLANA:102,RIPPLE:2,POLYGON_AMOY:84432,NILE:3,TRX:1}).ETHEREUM]="https://api-sepolia.etherscan.io",Lo[Vo.MATIC]="https://api-amoy.polygonscan.com",Lo[Vo.BINANCE]="https://api-testnet.bscscan.com",Lo[Vo.SOLANA]="https://api.devnet.solana.com",Lo[Vo.POLYGON_AMOY]="https://api-amoy.polygonscan.com",Lo[Vo.NILE]="https://nile.trongrid.io",Lo[Vo.TRX]="https://api.shasta.trongrid.io"):((Do={})[(Vo={ETHEREUM:1,POLYGON:137,BINANCE:56,BITCOIN:10001,AVAX:43113,SOLANA:101,TRX:1}).ETHEREUM]="https://api.etherscan.io",Do[Vo.MATIC]="https://api.polygonscan.com",Do[Vo.BINANCE]="https://api.bscscan.com",Do[Vo.SOLANA]="https://api.mainnet-beta.solana.com",Do[Vo.POLYGON_AMOY]="https://api.polygonscan.com",Do[Vo.TRX]="https://api.trongrid.io");var Yo=function(e){var t,i,o=e.tokenSellData,s=e.setTokenSellData,r=e.apiKey,l=e.setStep,c=e.clientReferenceID,d=e.mode,u=io().addToast,m=n(!1),g=m[0],b=m[1],f=n(!0),h=f[0],I=f[1],v=n(!1),y=v[0];v[1];var w=n(""),F=w[0],Z=w[1],Q=n(!0),A=Q[0],R=Q[1],X=n(!0),k=X[0],N=X[1],W=n(!1),L=W[0],D=W[1],V=n(null),U=V[0],E=V[1],Y=n(""),S=Y[0],O=Y[1],M=n(!1),H=M[0],T=M[1],J=n(null),j=J[0],z=J[1],P=a(null),K=a(null),q=n(o.network_type||""),$=q[0];q[1],p((function(){window.scrollTo(0,0),ne()}),[]);var ee=function(){ie(G(G({},o),{transaction_hash:S}))};p((function(){if(!h&&U){var e=U,t=["USDT","USDC"].includes(o.selectedCrypto)?o.network_type:o.selectedCrypto;te(e,t,o.selectedCrypto)}I(!1)}),[U,o]);var te=function(e,t,n){return C(void 0,void 0,void 0,(function(){var i,s,r;return B(this,(function(a){return i="TRX"===t?"tron":"SOL"===t?"solana":"ethereum",["TRX","SOL"].includes(t)||["USDC","USDT"].includes(n),s=o.from_amount.toString(),r="".concat(i,":").concat(e,"?amount=").concat(s,"&label=").concat(encodeURIComponent("HeraldExchangeSell")),Z(r),[2]}))}))},ne=function(){return C(void 0,void 0,void 0,(function(){var e;return B(this,(function(t){return e=co(d),D(!0),oo({url:"".concat(e,"/api/offramp/wallet_address"),headers:{"Content-Type":"application/json","X-API-KEY":r,"User-Id":c},onSuccess:function(e){var t,n,i;if(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.wallet_address){var s=(["USDT","USDC"].includes(o.selectedCrypto)?o.network_type:o.selectedCrypto).toLowerCase(),r=["eth","bnb","matic"].includes(s)?null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.wallet_address.evm:["evm","trx","sol"].includes(s)?null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.wallet_address[s]:"";E(r),D(!1)}},onError:function(){u("Error fetching exchange rate","error"),D(!1)}}),[2]}))}))},ie=function(e){return C(void 0,void 0,void 0,(function(){var t,n,i;return B(this,(function(a){return T(!0),t=co(d),(n=new FormData).append("from",o.selectedCrypto),n.append("to",o.selectedFiat),["USDT","USDC"].includes(o.selectedCrypto)&&n.append("network_type",o.network_type),n.append("value",o.from_amount),n.append("initial_exchange_rate",null===(i=o.exchange_rate)||void 0===i?void 0:i.toString()),n.append("transaction_hash",e.transaction_hash),n.append("bank_account",o.selectedBeneficiary),oo({url:"".concat(t,"/api/offramp/transactions"),headers:{"X-API-KEY":r,"User-Id":c},method:"POST",body:n,onSuccess:function(e){(null==e?void 0:e.success)?(z({data:null==e?void 0:e.data}),b(!0),s(G(G({},o),{response:null==e?void 0:e.data})),T(!1),u("".concat(null==e?void 0:e.message),"success"),l(4)):(u("".concat(null==e?void 0:e.message),"error"),b(!1),T(!1))},onError:function(e){u(" ".concat(e),"error"),b(!1),T(!1)}}),[2]}))}))};p((function(){if(!h&&U&&A){var e=U,t=["USDT","USDC"].includes(o.selectedCrypto)?o.network_type:o.selectedCrypto,n=o.selectedCrypto,i=o.from_amount;if(e){var s=Date.now();P.current=setInterval((function(){["USDT","USDC"].includes(n)&&$?re({currency:n,token:$,walletAddress:e,startTimestamp:s,expected_amount:i}):oe(t,e,s,i)}),1e4)}}return I(!1),function(){P.current&&clearInterval(P.current)}}),[U,o,A]);var oe=function(e,t,n,i){return C(void 0,void 0,void 0,(function(){var o,s,r;return B(this,(function(a){switch(a.label){case 0:if(o="",s=Eo({mode:d,token:e}),"ETH"===e)o="".concat(s,"/api?module=account&action=txlist&address=").concat(t,"&startblock=0&endblock=99999999&sort=desc&apikey=").concat("B34RQKNPZUV8IM6866DQ58WCS2Q6SWAP8V");else if("BNB"===e)o="".concat(s,"/api?module=account&action=txlist&address=").concat(t,"&startblock=0&endblock=99999999&sort=desc&apikey=").concat("876A7KYGBE2TVBBNY33I4GZPXE1Q4QH3QA");else if("MATIC"===e||"POLYGON"===e||"POLYGON_AMOY"===e)o="".concat(s,"/api?module=account&action=txlist&address=").concat(t,"&startblock=0&endblock=99999999&sort=desc&apikey=").concat("KYV61TJQU5RDMTGY1D95J8R61HWCR9T7KT");else{if("TRX"!==e)return"SOL"===e?[2,le()]:[2];o="".concat(s,"/v1/accounts/").concat(t,"/transactions?limit=10")}if(!k)return[3,5];a.label=1;case 1:return a.trys.push([1,4,,5]),[4,fetch(o)];case 2:return[4,a.sent().json()];case 3:return r=a.sent(),se(r,t,e,n,i),[3,5];case 4:return a.sent(),[3,5];case 5:return[2]}}))}))},se=function(e,t,n,i,o){var s=[];"ETH"===n||"BNB"===n||"MATIC"===n?s=e.result:"TRX"===n?s=e.data:"SOL"===n&&(s=e.result),s.forEach((function(e){if(("TRX"==n?e.block_timestamp:1e3*e.timeStamp)>i){var t=e.hash||e.transactionHash||e.txID,s="TRX"==n?e.raw_data.contract[0].parameter.value.amount/1e6:e.value/1e18;o==s&&(K.current.value=t,O(t),R(!1))}}))},re=function(e){return C(void 0,[e],void 0,(function(e){var t,n,i,o,s,r=e.currency,a=e.token,l=e.walletAddress,c=e.startTimestamp,u=e.expected_amount;return B(this,(function(e){switch(e.label){case 0:if(t="",n=Eo({mode:d,token:a}),i=function(e){var t,n,i=e.mode,o=e.token,s=e.networkType;return"development"===i?(t={USDC:"Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",USDT:"Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr"},n={ETH:{USDC:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",USDT:"0x7169D38820dfd117C3FA1f22a697dBA58d90BA06",LINK:"0xb227f007804c16546Bd054dfED2E7A1fD5437678",MATIC:"0x8D38d6Ffa17FFD6dA49D4b53B6f0DFc8D291E867"},MATIC:{USDC:"0x702207d9c124c86c85A97222Cde98476f987ddaE",USDT:"0x702207d9c124c86c85A97222Cde98476f987ddaE",DAI:"0xb2df85a09cAB3a391Fd9ade76342583A0d4B75ce"},POLYGON_AMOY:{USDC:"0x702207d9c124c86c85A97222Cde98476f987ddaE",USDT:"0x702207d9c124c86c85A97222Cde98476f987ddaE",DAI:"0xb2df85a09cAB3a391Fd9ade76342583A0d4B75ce"},BNB:{USDT:"0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",USDC:"0xfbe87897c07Cc64b6FFc04257672854b90e5B17b"},SHASTA:{USDT:"TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs",USDC:"TSdZwNqpHofzP6BsBKGQUWdBeJphLmF6id"},TRX:{USDT:"TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs",USDC:"TSdZwNqpHofzP6BsBKGQUWdBeJphLmF6id"}}):(t={USDC:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",USDT:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"},n={ETH:{USDC:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",USDT:"0xdAC17F958D2ee523a2206206994597C13D831ec7"},MATIC:{USDC:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",USDT:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F"},POLYGON:{USDC:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",USDT:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F"},POLYGON_AMOY:{USDC:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",USDT:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F"},BNB:{USDT:"0x55d398326f99059fF775485246999027B3197955",USDC:"0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"},TRX:{USDT:"TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",USDC:"TLZSucJRjnqBKwvQz6n5hd29gbS4P7u7w8"}}),"SOL"===s?t[o]:n[s][o]||""}({mode:d,token:r,networkType:$}),["ETH","BNB","MATIC"].includes($))o="ETH"==$?"B34RQKNPZUV8IM6866DQ58WCS2Q6SWAP8V":"BNB"==$?"876A7KYGBE2TVBBNY33I4GZPXE1Q4QH3QA":"KYV61TJQU5RDMTGY1D95J8R61HWCR9T7KT",t="".concat(n,"/api?module=account&action=tokentx&address=").concat(l,"&startblock=0&endblock=99999999&sort=desc&apikey=").concat(o);else{if("TRX"!==$)return"SOL"===$?[2,le()]:[2];t="".concat(n,"/v1/accounts/").concat(l,"/transactions/trc20")}e.label=1;case 1:return e.trys.push([1,4,,5]),[4,fetch(t)];case 2:return[4,e.sent().json()];case 3:return s=e.sent(),ae(s,l,a,c,i,u),[3,5];case 4:return e.sent(),[3,5];case 5:return[2]}}))}))},ae=function(e,t,n,i,o,s){(e.result||e.data||[]).forEach((function(e){if(("TRX"==$?e.block_timestamp:1e3*e.timeStamp)>i)if("TRX"==$){var t=e.hash||e.transaction_id||e.txID;parseFloat(e.value)/Math.pow(10,parseInt(e.token_info.decimals))==s&&(K.current.value=t,O(t),R(!1))}else if(o.toLowerCase()==e.contractAddress.toLowerCase()){t=e.hash||e.transactionHash||e.txID;parseFloat(e.value)/Math.pow(10,parseInt(e.tokenDecimal))==s&&(K.current.value=t,O(t),R(!1))}}))},le=function(){return C(void 0,void 0,void 0,(function(){return B(this,(function(e){return N(!1),R(!1),[2]}))}))};return x.jsxs(x.Fragment,{children:[x.jsx("div",{className:_.sellPaymentDetailsWrap,children:x.jsxs("div",{className:_.offRampBankHead,children:[x.jsx("div",{style:{cursor:"pointer"},onClick:function(){return l(2)},children:x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",width:"18",height:"18",viewBox:"0 0 240.823 240.823",children:x.jsx("path",{d:"M57.633 129.007 165.93 237.268c4.752 4.74 12.451 4.74 17.215 0 4.752-4.74 4.752-12.439 0-17.179l-99.707-99.671 99.695-99.671c4.752-4.74 4.752-12.439 0-17.191-4.752-4.74-12.463-4.74-17.215 0L57.621 111.816c-4.679 4.691-4.679 12.511.012 17.191","data-original":"#000000"})})}),x.jsx("div",{className:_.bankTitles,children:"Sell Crypto"})]})}),L?x.jsx(so,{}):U&&(null===(t=Object.keys(U))||void 0===t?void 0:t.length)>0?x.jsxs(x.Fragment,{children:[x.jsx("div",{className:_.sellPaymentDetailsWrap,children:x.jsxs("div",{className:_.sellQRPayementWrap,children:[x.jsxs("div",{className:_.sellAmtDetails,children:[x.jsxs("div",{className:_.sellAmtDetailsWrap,children:[x.jsxs("div",{className:_.sellAmtPay,children:[x.jsx("span",{className:_.sellPayLabel,children:"You Pay "}),x.jsxs("span",{className:_.sellPayAmt,children:[o.from_amount," ",o.selectedCrypto," ",["USDT","USDC"].includes(o.selectedCrypto)&&o.network_type?"(".concat(o.network_type,")"):""]})]}),x.jsxs("div",{className:_.sellAmtGet,children:[x.jsx("span",{className:_.sellPayLabel,children:"You Get "}),x.jsxs("span",{className:_.sellPayAmt,children:[null===(i=o.to_currency_conversion_value)||void 0===i?void 0:i.toFixed(4)," ",o.selectedFiat]})]})]}),x.jsx("div",{className:_.sellEstimatedInfo,children:x.jsxs("p",{children:[" ",x.jsx("span",{children:"Estimated Rate "})," ",x.jsxs("span",{children:["1 ",o.selectedCrypto," ="," ",isNaN(o.exchange_rate)?0:o.exchange_rate.toFixed(4)," ",o.selectedFiat]})]})})]}),x.jsx("div",{className:_.sellPaymentQRBox,children:x.jsx("div",{className:_.sellPaymentQRFrame,children:F?x.jsx(Wo,{value:F,size:128,bgColor:"#ffffff",fgColor:"#000000",level:"H"}):x.jsx(so,{})})})]})}),x.jsxs("form",{onSubmit:ee,children:[x.jsxs("div",{className:_.selllWalletAddressCard,children:[y||U&&x.jsxs("div",{className:_.sellWalletDataCard,children:[x.jsx("h6",{children:"Wallet Address"}),x.jsxs("div",{className:_.sellWalletCodeCard,children:[x.jsxs("div",{className:_.sellWalletCode,children:[x.jsxs("span",{children:[" ",U]})," "]}),x.jsx("button",{className:"".concat(_.actionBtn," ").concat(_.overlay),type:"button",onClick:function(){return C(void 0,void 0,void 0,(function(){return B(this,(function(e){switch(e.label){case 0:return[4,navigator.clipboard.writeText(U)];case 1:return e.sent(),u("Copied","success"),[2]}}))}))},children:x.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#298BFF","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"icon icon-tabler icons-tabler-outline icon-tabler-copy",children:[x.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),x.jsx("path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z"}),x.jsx("path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1"})]})})]})]}),x.jsxs("div",{className:_.sellHashBox,children:[x.jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:x.jsxs("div",{className:_.sellHashLabel,children:["Transaction Hash ",x.jsx("span",{children:"*"})]})}),x.jsx("input",{className:_.sellHashFields,type:"text",placeholder:"Enter Transaction Hash",name:"transaction_hash",onChange:function(e){return O(e.target.value)},ref:K,disabled:k})]})]}),x.jsx("div",{className:_.efiSwapAction,children:A||H||g?x.jsx("div",{className:"mt-3",children:x.jsx(bo,{props:j,monitoring:A})}):x.jsx("button",{className:"".concat(_.actionBtn," ").concat(_.primary),onClick:function(e){e.preventDefault(),ee()},disabled:!S||H,children:H?x.jsx(ro,{}):"Submit"})})]})]}):x.jsx(x.Fragment,{children:x.jsxs("div",{className:_.no_wallet_details,children:[x.jsx("p",{children:"No Wallet Details Found"}),x.jsx("div",{children:x.jsx("button",{className:"".concat(_.actionBtn," ").concat(_.primary),onClick:function(){return ne()},children:"Retry"})})]})})]})};const So=Object.create(null);So.open="0",So.close="1",So.ping="2",So.pong="3",So.message="4",So.upgrade="5",So.noop="6";const Oo=Object.create(null);Object.keys(So).forEach((e=>{Oo[So[e]]=e}));const Mo={type:"error",data:"parser error"},Ho="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),To="function"==typeof ArrayBuffer,Jo=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,jo=({type:e,data:t},n,i)=>Ho&&t instanceof Blob?n?i(t):zo(t,i):To&&(t instanceof ArrayBuffer||Jo(t))?n?i(t):zo(new Blob([t]),i):i(So[e]+(t||"")),zo=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function Po(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Ko;const qo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$o="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)$o[qo.charCodeAt(e)]=e;const es="function"==typeof ArrayBuffer,ts=(e,t)=>{if("string"!=typeof e)return{type:"message",data:is(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:ns(e.substring(1),t)};return Oo[n]?e.length>1?{type:Oo[n],data:e.substring(1)}:{type:Oo[n]}:Mo},ns=(e,t)=>{if(es){const n=(e=>{let t,n,i,o,s,r=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(r--,"="===e[e.length-2]&&r--);const c=new ArrayBuffer(r),d=new Uint8Array(c);for(t=0;t<a;t+=4)n=$o[e.charCodeAt(t)],i=$o[e.charCodeAt(t+1)],o=$o[e.charCodeAt(t+2)],s=$o[e.charCodeAt(t+3)],d[l++]=n<<2|i>>4,d[l++]=(15&i)<<4|o>>2,d[l++]=(3&o)<<6|63&s;return c})(e);return is(n,t)}return{base64:!0,data:e}},is=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,os=String.fromCharCode(30);function ss(){return new TransformStream({transform(e,t){!function(e,t){Ho&&e.data instanceof Blob?e.data.arrayBuffer().then(Po).then(t):To&&(e.data instanceof ArrayBuffer||Jo(e.data))?t(Po(e.data)):jo(e,!1,(e=>{Ko||(Ko=new TextEncoder),t(Ko.encode(e))}))}(e,(n=>{const i=n.length;let o;if(i<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,i);else if(i<65536){o=new Uint8Array(3);const e=new DataView(o.buffer);e.setUint8(0,126),e.setUint16(1,i)}else{o=new Uint8Array(9);const e=new DataView(o.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(i))}e.data&&"string"!=typeof e.data&&(o[0]|=128),t.enqueue(o),t.enqueue(n)}))}})}let rs;function as(e){return e.reduce(((e,t)=>e+t.length),0)}function ls(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let i=0;for(let o=0;o<t;o++)n[o]=e[0][i++],i===e[0].length&&(e.shift(),i=0);return e.length&&i<e[0].length&&(e[0]=e[0].slice(i)),n}function cs(e){if(e)return function(e){for(var t in cs.prototype)e[t]=cs.prototype[t];return e}(e)}cs.prototype.on=cs.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},cs.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},cs.prototype.off=cs.prototype.removeListener=cs.prototype.removeAllListeners=cs.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,i=this._callbacks["$"+e];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<i.length;o++)if((n=i[o])===t||n.fn===t){i.splice(o,1);break}return 0===i.length&&delete this._callbacks["$"+e],this},cs.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(n){i=0;for(var o=(n=n.slice(0)).length;i<o;++i)n[i].apply(this,t)}return this},cs.prototype.emitReserved=cs.prototype.emit,cs.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},cs.prototype.hasListeners=function(e){return!!this.listeners(e).length};const ds="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),us="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function ps(e,...t){return t.reduce(((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t)),{})}const ms=us.setTimeout,gs=us.clearTimeout;function bs(e,t){t.useNativeTimers?(e.setTimeoutFn=ms.bind(us),e.clearTimeoutFn=gs.bind(us)):(e.setTimeoutFn=us.setTimeout.bind(us),e.clearTimeoutFn=us.clearTimeout.bind(us))}function fs(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class hs extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class Is extends cs{constructor(e){super(),this.writable=!1,bs(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new hs(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=ts(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}class vs extends Is{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split(os),i=[];for(let e=0;e<n.length;e++){const o=ts(n[e],t);if(i.push(o),"error"===o.type)break}return i})(e,this.socket.binaryType).forEach((e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,i=new Array(n);let o=0;e.forEach(((e,s)=>{jo(e,!1,(e=>{i[s]=e,++o===n&&t(i.join(os))}))}))})(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=fs()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let ys=!1;try{ys="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}const xs=ys;function _s(){}class Gs extends vs{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",((e,t)=>{this.onError("xhr post error",e,t)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",((e,t)=>{this.onError("xhr poll error",e,t)})),this.pollXhr=e}}class Cs extends cs{constructor(e,t,n){super(),this.createRequest=e,bs(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var e;const t=ps(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(t);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(e){}if("POST"===this._method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this._opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(n.getResponseHeader("set-cookie"))),4===n.readyState&&(200===n.status||1223===n.status?this._onLoad():this.setTimeoutFn((()=>{this._onError("number"==typeof n.status?n.status:0)}),0))},n.send(this._data)}catch(e){return void this.setTimeoutFn((()=>{this._onError(e)}),0)}"undefined"!=typeof document&&(this._index=Cs.requestsCount++,Cs.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=_s,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete Cs.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(Cs.requestsCount=0,Cs.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",Bs);else if("function"==typeof addEventListener){addEventListener("onpagehide"in us?"pagehide":"unload",Bs,!1)}function Bs(){for(let e in Cs.requests)Cs.requests.hasOwnProperty(e)&&Cs.requests[e].abort()}const ws=function(){const e=Fs({xdomain:!1});return e&&null!==e.responseType}();function Fs(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||xs))return new XMLHttpRequest}catch(e){}if(!t)try{return new(us[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const Zs="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class Qs extends Is{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=Zs?{}:ps(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],i=t===e.length-1;jo(n,this.supportsBinary,(e=>{try{this.doWrite(n,e)}catch(e){}i&&ds((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=fs()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const As=us.WebSocket||us.MozWebSocket;const Rs={websocket:class extends Qs{createSocket(e,t,n){return Zs?new As(e,t,n):t?new As(e,t):new As(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends Is{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then((()=>{this.onClose()})).catch((e=>{this.onError("webtransport error",e)})),this._transport.ready.then((()=>{this._transport.createBidirectionalStream().then((e=>{const t=function(e,t){rs||(rs=new TextDecoder);const n=[];let i=0,o=-1,s=!1;return new TransformStream({transform(r,a){for(n.push(r);;){if(0===i){if(as(n)<1)break;const e=ls(n,1);s=!(128&~e[0]),o=127&e[0],i=o<126?3:126===o?1:2}else if(1===i){if(as(n)<2)break;const e=ls(n,2);o=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),i=3}else if(2===i){if(as(n)<8)break;const e=ls(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),s=t.getUint32(0);if(s>Math.pow(2,21)-1){a.enqueue(Mo);break}o=s*Math.pow(2,32)+t.getUint32(4),i=3}else{if(as(n)<o)break;const e=ls(n,o);a.enqueue(ts(s?e:rs.decode(e),t)),i=0}if(0===o||o>e){a.enqueue(Mo);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),i=ss();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const o=()=>{n.read().then((({done:e,value:t})=>{e||(this.onPacket(t),o())})).catch((e=>{}))};o();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then((()=>this.onOpen()))}))}))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],i=t===e.length-1;this._writer.write(n).then((()=>{i&&ds((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends Gs{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=ws&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Cs(Fs,this.uri(),e)}}},Xs=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ks=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ns(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),i=e.indexOf("]");-1!=n&&-1!=i&&(e=e.substring(0,n)+e.substring(n,i).replace(/:/g,";")+e.substring(i,e.length));let o=Xs.exec(e||""),s={},r=14;for(;r--;)s[ks[r]]=o[r]||"";return-1!=n&&-1!=i&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=function(e,t){const n=/\/{2,9}/g,i=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||i.splice(0,1);"/"==t.slice(-1)&&i.splice(i.length-1,1);return i}(0,s.path),s.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,i){t&&(n[t]=i)})),n}(0,s.query),s}const Ws="function"==typeof addEventListener&&"function"==typeof removeEventListener,Ls=[];Ws&&addEventListener("offline",(()=>{Ls.forEach((e=>e()))}),!1);class Ds extends cs{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const n=Ns(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=Ns(t.host).host);bs(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach((e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e})),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let e=0,i=n.length;e<i;e++){let i=n[e].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}(this.opts.query)),Ws&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Ls.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);const e=this.opts.rememberUpgrade&&Ds.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",(e=>this._onClose("transport close",e)))}onOpen(){this.readyState="open",Ds.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn((()=>{this._onClose("ping timeout")}),e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let n=0;n<this.writeBuffer.length;n++){const i=this.writeBuffer[n].data;if(i&&(e+="string"==typeof(t=i)?function(e){let t=0,n=0;for(let i=0,o=e.length;i<o;i++)t=e.charCodeAt(i),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(i++,n+=4);return n}(t):Math.ceil(1.33*(t.byteLength||t.size))),n>0&&e>this._maxPayload)return this.writeBuffer.slice(0,n);e+=2}var t;return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,ds((()=>{this._onClose("ping timeout")}),this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket("message",e,t,n),this}send(e,t,n){return this._sendPacket("message",e,t,n),this}_sendPacket(e,t,n,i){if("function"==typeof t&&(i=t,t=void 0),"function"==typeof n&&(i=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const o={type:e,data:t,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?n():e()})):this.upgrading?n():e()),this}_onError(e){if(Ds.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Ws&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=Ls.indexOf(this._offlineEventListener);-1!==e&&Ls.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}Ds.protocol=4;class Vs extends Ds{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;Ds.priorWebsocketSuccess=!1;const i=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",(e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Ds.priorWebsocketSuccess="websocket"===t.name,this.transport.pause((()=>{n||"closed"!==this.readyState&&(c(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())}))}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}})))};function o(){n||(n=!0,c(),t.close(),t=null)}const s=e=>{const n=new Error("probe error: "+e);n.transport=t.name,o(),this.emitReserved("upgradeError",n)};function r(){s("transport closed")}function a(){s("socket closed")}function l(e){t&&e.name!==t.name&&o()}const c=()=>{t.removeListener("open",i),t.removeListener("error",s),t.removeListener("close",r),this.off("close",a),this.off("upgrading",l)};t.once("open",i),t.once("error",s),t.once("close",r),this.once("close",a),this.once("upgrading",l),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn((()=>{n||t.open()}),200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}let Us=class extends Vs{constructor(e,t={}){const n="object"==typeof e?e:t;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map((e=>Rs[e])).filter((e=>!!e))),super(e,n)}};const Es="function"==typeof ArrayBuffer,Ys=Object.prototype.toString,Ss="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Ys.call(Blob),Os="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===Ys.call(File);function Ms(e){return Es&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||Ss&&e instanceof Blob||Os&&e instanceof File}function Hs(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(Hs(e[t]))return!0;return!1}if(Ms(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return Hs(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&Hs(e[t]))return!0;return!1}function Ts(e){const t=[],n=e.data,i=e;return i.data=Js(n,t),i.attachments=t.length,{packet:i,buffers:t}}function Js(e,t){if(!e)return e;if(Ms(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let i=0;i<e.length;i++)n[i]=Js(e[i],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=Js(e[i],t));return n}return e}function js(e,t){return e.data=zs(e.data,t),delete e.attachments,e}function zs(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=zs(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=zs(e[n],t));return e}const Ps=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ks;!function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"}(Ks||(Ks={}));function qs(e){return"[object Object]"===Object.prototype.toString.call(e)}class $s extends cs{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===Ks.BINARY_EVENT;n||t.type===Ks.BINARY_ACK?(t.type=n?Ks.EVENT:Ks.ACK,this.reconstructor=new er(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!Ms(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(void 0===Ks[n.type])throw new Error("unknown packet type "+n.type);if(n.type===Ks.BINARY_EVENT||n.type===Ks.BINARY_ACK){const i=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const o=e.substring(i,t);if(o!=Number(o)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(o)}if("/"===e.charAt(t+1)){const i=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}n.nsp=e.substring(i,t)}else n.nsp="/";const i=e.charAt(t+1);if(""!==i&&Number(i)==i){const i=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(i,t+1))}if(e.charAt(++t)){const i=this.tryParse(e.substr(t));if(!$s.isPayloadValid(n.type,i))throw new Error("invalid payload");n.data=i}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case Ks.CONNECT:return qs(t);case Ks.DISCONNECT:return void 0===t;case Ks.CONNECT_ERROR:return"string"==typeof t||qs(t);case Ks.EVENT:case Ks.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Ps.indexOf(t[0]));case Ks.ACK:case Ks.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class er{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=js(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var tr=Object.freeze({__proto__:null,Decoder:$s,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==Ks.EVENT&&e.type!==Ks.ACK||!Hs(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Ks.EVENT?Ks.BINARY_EVENT:Ks.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==Ks.BINARY_EVENT&&e.type!==Ks.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Ts(e),n=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(n),i}},get PacketType(){return Ks},protocol:5});function nr(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const ir=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class or extends cs{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[nr(e,"open",this.onopen.bind(this)),nr(e,"packet",this.onpacket.bind(this)),nr(e,"error",this.onerror.bind(this)),nr(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var n,i,o;if(ir.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const s={type:Ks.EVENT,data:t,options:{}};if(s.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),s.id=e}const r=null===(i=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===i?void 0:i.writable,a=this.connected&&!(null===(o=this.io.engine)||void 0===o?void 0:o._hasPingExpired());return this.flags.volatile&&!r||(a?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,t){var n;const i=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===i)return void(this.acks[e]=t);const o=this.io.setTimeoutFn((()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))}),i),s=(...e)=>{this.io.clearTimeoutFn(o),t.apply(this,e)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...t){return new Promise(((n,i)=>{const o=(e,t)=>e?i(e):n(t);o.withError=!0,t.push(o),this.emit(e,...t)}))}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push(((e,...i)=>{if(n!==this._queue[0])return;return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...i)),n.pending=!1,this._drainQueue()})),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this._sendConnectPacket(e)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Ks.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach((e=>{if(!this.sendBuffer.some((t=>String(t.id)===e))){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}}))}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Ks.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ks.EVENT:case Ks.BINARY_EVENT:this.onevent(e);break;case Ks.ACK:case Ks.BINARY_ACK:this.onack(e);break;case Ks.DISCONNECT:this.ondisconnect();break;case Ks.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...i){n||(n=!0,t.packet({type:Ks.ACK,id:e,data:i}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((e=>this.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>{this.notifyOutgoingListeners(e),this.packet(e)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ks.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function sr(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}sr.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},sr.prototype.reset=function(){this.attempts=0},sr.prototype.setMin=function(e){this.ms=e},sr.prototype.setMax=function(e){this.max=e},sr.prototype.setJitter=function(e){this.jitter=e};class rr extends cs{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,bs(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new sr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const i=t.parser||tr;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Us(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const i=nr(t,"open",(function(){n.onopen(),e&&e()})),o=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},s=nr(t,"error",o);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn((()=>{i(),o(new Error("timeout")),t.close()}),e);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}return this.subs.push(i),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(nr(e,"ping",this.onping.bind(this)),nr(e,"data",this.ondata.bind(this)),nr(e,"error",this.onerror.bind(this)),nr(e,"close",this.onclose.bind(this)),nr(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){ds((()=>{this.emitReserved("packet",e)}),this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new or(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const e of t){if(this.nsps[e].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach((e=>e())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),null===(n=this.engine)||void 0===n||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const ar={};function lr(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let i=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),i=Ns(e)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const o=-1!==i.host.indexOf(":")?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+o+":"+i.port+t,i.href=i.protocol+"://"+o+(n&&n.port===i.port?"":":"+i.port),i}(e,(t=t||{}).path||"/socket.io"),i=n.source,o=n.id,s=n.path,r=ar[o]&&s in ar[o].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||r?a=new rr(i,t):(ar[o]||(ar[o]=new rr(i,t)),a=ar[o]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}Object.assign(lr,{Manager:rr,Socket:or,io:lr,connect:lr});var cr=null,dr=0,ur=function(e){var t=e.size;return x.jsx("div",{style:{width:t||20},className:_.dotLoader})},pr=function(e){var t,i,o=e.apiKey,s=e.parameters,r=e.clientReferenceID,l=e.mode,c=io().addToast,d=function(e){var t=e.onConnectCallback,n=e.onDisconnectCallback,i=e.mode,o=a(null);return p((function(){dr+=1;var e=function(e){return"production"===e?"https://woowga-node.herald.exchange:9001/":"https://efi-exchange.blockstall.com:9001/"}(i);return cr||(cr=lr(e,{transports:["websocket"]})),o.current=cr,t&&cr.on("connect",t),n&&cr.on("disconnect",n),function(){t&&cr.off("connect",t),n&&cr.off("disconnect",n),0==(dr-=1)&&cr&&(cr.disconnect(),cr=null)}}),[]),o.current}({mode:l}),u=n(1),m=u[0],g=u[1],b=n(!1),f=b[0],h=b[1],I=n(null),v=I[0],y=I[1],C=n({from_amount:(null==s?void 0:s.from_amount)&&parseFloat(null==s?void 0:s.from_amount)>0?s.from_amount:"0",selectedCrypto:(null==s?void 0:s.from_currency)||"",selectedFiat:(null==s?void 0:s.to_currency)||"",to_currency_conversion_value:0,exchange_rate:0,minAmount:"0.0000001",maxAmount:"100000.0000",network_type:"",selectedBeneficiary:""}),B=C[0],w=C[1],F=n(null),Z=F[0],Q=F[1],A=n(null),R=A[0],X=A[1],k=n([]),N=k[0],W=k[1],L=n([]),D=L[0],V=L[1],U=n([]),E=U[0],Y=U[1],S=n(null),O=S[0],M=S[1],H=n(0);H[0];var T=H[1],J=n(0);J[0];var j=J[1],z=n(0),P=z[0],K=z[1],q=n(0),$=q[0],ee=q[1],te=n(0),ne=te[0],ie=te[1],oe=n(!1),se=oe[0],re=oe[1],ae=n(!0),le=ae[0],ce=ae[1],de=n(null),ue=de[0],pe=de[1],me=n({min:!1,max:!1}),ge=me[0],be=me[1],fe=n({admin_commission:0,merchant_commission:0}),he=fe[0],Ie=fe[1];p((function(){xe(),ye(),ve()}),[]);var ve=function(){var e=co(l);oo({url:"".concat(e,"/api/lookup/configurations"),headers:{"Content-Type":"application/json","X-API-KEY":o,"User-Id":r},onSuccess:function(e){var t,n;(null==e?void 0:e.success)&&re(1===(null===(n=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.merchant_configuration)||void 0===n?void 0:n.range_calculation))},onError:function(){c("Error fetching configuration","error")}})},ye=function(){var e=co(l);oo({url:"".concat(e,"/api/lookup/commissions"),headers:{"Content-Type":"application/json","X-API-KEY":o,"User-Id":r},onSuccess:function(e){(null==e?void 0:e.success)&&M(null==e?void 0:e.data)},onError:function(){c("Error fetching comission","error")}})},xe=function(){var e=co(l);h(!0),oo({url:"".concat(e,"/api/lookup/currencies"),headers:{"Content-Type":"application/json","X-API-KEY":o,"User-Id":r},onSuccess:function(e){(null==e?void 0:e.success)&&y(null==e?void 0:e.data),h(!1)},onError:function(){c("Error fetching currency","error"),h(!1)}})};p((function(){var e,t,n,i,o,r,a,l,c,d,u,p;if(v){var m=(null===(t=null===(e=null==v?void 0:v.currencies)||void 0===e?void 0:e.filter((function(e){var t;return"FIAT"===(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.type)&&"offramp"===(null==e?void 0:e.service)})))||void 0===t?void 0:t.map((function(e){var t,n;return{label:null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code,value:null==e?void 0:e.unique_id,icon:null===(n=null==e?void 0:e.supported_currency)||void 0===n?void 0:n.icon}})))||[];V(m);var g=(null==B?void 0:B.selectedFiat)?(null===(n=null==v?void 0:v.currencies)||void 0===n?void 0:n.find((function(e){var t;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null==B?void 0:B.selectedFiat)})))||(null===(i=null==v?void 0:v.currencies)||void 0===i?void 0:i.find((function(e){var t,n;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null===(n=null==m?void 0:m[0])||void 0===n?void 0:n.label)}))):null===(o=null==v?void 0:v.currencies)||void 0===o?void 0:o.find((function(e){var t,n;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null===(n=null==m?void 0:m[0])||void 0===n?void 0:n.label)})),b=B.selectedFiat&&m.find((function(e){return e.label===B.selectedFiat}))||(null==m?void 0:m[0]);X(b);var f=(null===(a=null===(r=null==v?void 0:v.currencies)||void 0===r?void 0:r.filter((function(e){var t;return"CRYPTO"===(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.type)&&"offramp"===(null==e?void 0:e.service)})))||void 0===a?void 0:a.map((function(e){var t,n;return{label:null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code,value:null==e?void 0:e.unique_id,icon:null===(n=null==e?void 0:e.supported_currency)||void 0===n?void 0:n.icon}})))||[];W(f);var h=(null===(c=null===(l=null==v?void 0:v.currencies)||void 0===l?void 0:l.filter((function(e){var t,n;return"CRYPTO"===(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.type)&&"offramp"===(null==e?void 0:e.service)&&!["USDT","USDC"].includes(null===(n=null==e?void 0:e.supported_currency)||void 0===n?void 0:n.code)})))||void 0===c?void 0:c.map((function(e){var t,n,i;return{label:null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code,value:null===(n=null==e?void 0:e.supported_currency)||void 0===n?void 0:n.code,icon:null===(i=null==e?void 0:e.supported_currency)||void 0===i?void 0:i.icon}})))||[];Y(h);var I=(null==s?void 0:s.from_currency)?(null===(d=null==v?void 0:v.currencies)||void 0===d?void 0:d.find((function(e){var t;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null==s?void 0:s.from_currency)})))||(null===(u=null==v?void 0:v.currencies)||void 0===u?void 0:u.find((function(e){var t,n;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null===(n=null==f?void 0:f[0])||void 0===n?void 0:n.label)}))):null===(p=null==v?void 0:v.currencies)||void 0===p?void 0:p.find((function(e){var t,n;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null===(n=null==f?void 0:f[0])||void 0===n?void 0:n.label)}));Q((null==s?void 0:s.from_currency)?f.find((function(e){return e.label===(null==s?void 0:s.from_currency)}))||(null==f?void 0:f[0]):(null==f?void 0:f[0])||[]),w((function(e){var t,n;return G(G({},e),{selectedCrypto:(null===(t=null==I?void 0:I.supported_currency)||void 0===t?void 0:t.code)||"",selectedFiat:(null===(n=null==g?void 0:g.supported_currency)||void 0===n?void 0:n.code)||""})}))}}),[v]),p((function(){var e,t;if(O&&v){var n=null===(e=null==O?void 0:O.rules)||void 0===e?void 0:e.find((function(e){return"offramp"===(null==e?void 0:e.service)}));n&&pe(n);var i=null===(t=null==O?void 0:O.commission)||void 0===t?void 0:t.find((function(e){return"offramp"==(null==e?void 0:e.service)}));j((null==i?void 0:i.commission)?parseFloat(null==i?void 0:i.commission):0),Ie({admin_commission:(null==i?void 0:i.admin_commission)?parseFloat(null==i?void 0:i.admin_commission):0,merchant_commission:(null==i?void 0:i.commission)?parseFloat(null==i?void 0:i.commission):0}),n&&w((function(e){var t,i,o,s,r,a;return G(G({},e),{minAmount:parseFloat(null===(t=null==n?void 0:n.schema)||void 0===t?void 0:t.min)<=0?"0.0000001":null===(o=parseFloat(null===(i=null==n?void 0:n.schema)||void 0===i?void 0:i.min))||void 0===o?void 0:o.toFixed(8),maxAmount:parseFloat(null===(s=null==n?void 0:n.schema)||void 0===s?void 0:s.max)<=0?"100000":null===(a=parseFloat(null===(r=null==n?void 0:n.schema)||void 0===r?void 0:r.max))||void 0===a?void 0:a.toFixed(8)})}))}}),[O,v]),p((function(){d&&R&&Z&&(ee(0),_e())}),[Z,R]),p((function(){d&&d.on("getSDKExchangeRate",(function(e){K(parseFloat(e)),ce(!1)}))}),[d]);var _e=function(){K(0),ce(!0),d.emit("fetchSDKExchangeRate",{pair:"".concat(null==R?void 0:R.label,"-").concat(null==Z?void 0:Z.label),user_id:"",type:"sell",apiKey:o,userId:r})};p((function(){be({min:parseFloat(B.from_amount)<parseFloat(B.minAmount)||""===B.from_amount||parseFloat(B.from_amount)<=0,max:parseFloat(B.from_amount)>parseFloat(B.maxAmount)})}),[$,B]),p((function(){var e,t,n;if(B){var i=P,o=se?null===(e=null==O?void 0:O.commission_ranges)||void 0===e?void 0:e.find((function(e){return parseFloat(e.from_amount)<=parseFloat(B.from_amount)*i&&parseFloat(e.to_amount)>=parseFloat(B.from_amount)*i&&e.currency===(null==R?void 0:R.label)&&"c-f"===e.type})):null,s=o?parseFloat(null==o?void 0:o.from_commission):0,r=o?parseFloat(null==o?void 0:o.to_commission):0,a=B.from_amount?parseFloat(B.from_amount):0,l=o?parseFloat(o.from_amount):0,c=o?parseFloat(o.to_amount):0,d=o?parseFloat(o.from_commission)-(s-r)/(c-l)*(a*i-l):0,u=((t=(null==he?void 0:he.admin_commission)+d,n=null==he?void 0:he.merchant_commission,100*(1-(1-t/100)*(1-n/100)))||0)/100*i;T(u||0);var p=parseFloat((i-u).toFixed(6));ee(p||0),ie(a*p)}}),[P,B,O]),p((function(){(null==E?void 0:E.length)>0&&["USDT","USDC"].includes(B.selectedCrypto)&&!B.network_type&&w((function(e){return G(G({},e),{network_type:E[0].value})}))}),[B,E]);return x.jsx(x.Fragment,{children:1===m?x.jsxs(x.Fragment,{children:[" ",x.jsxs("div",{className:_.offRampFieldCard,children:[x.jsxs("div",{className:_.offRampFieldBox,children:[x.jsx("div",{className:_.offRampFieldLabel,children:"You Pay"}),x.jsxs("div",{className:_.offRampFieldForm,children:[x.jsx("input",{type:"text",className:_.inputControl,value:B.from_amount,onChange:function(e){!function(e){var t,n;if(e.includes(".")){if(ue&&!function(e,t){if(!/^\d*\.?\d*$/.test(e))return!1;var n=e.split(".");return 2!==n.length||n[1].length<=t}(e,null===(t=null==ue?void 0:ue.schema)||void 0===t?void 0:t.decimal))return void c("You can input upto ".concat(null===(n=null==ue?void 0:ue.schema)||void 0===n?void 0:n.decimal," decimal places."),"error");""===e?w(G(G({},B),{from_amount:""})):isNaN(Number(e))||w(G(G({},B),{from_amount:e}))}else""===e?w(G(G({},B),{from_amount:""})):isNaN(Number(e))||w(G(G({},B),{from_amount:e}))}(e.target.value)}}),(null==ge?void 0:ge.min)&&x.jsxs("p",{className:_.errorMsg,children:["Invalid, Min : ",null===(t=parseFloat(null==B?void 0:B.minAmount))||void 0===t?void 0:t.toFixed(8)]}),(null==ge?void 0:ge.max)&&x.jsxs("p",{className:_.errorMsg,children:["Invalid, Max : ",null===(i=parseFloat(null==B?void 0:B.maxAmount))||void 0===i?void 0:i.toString()]})]})]}),x.jsxs("div",{className:_.offRampFieldSelectCard,children:[x.jsx("div",{className:"".concat(_.offRampFieldSelect),children:(null==N?void 0:N.length)>0?x.jsx(qi,{backgroundColor:"var(--primary-set-color)",colorvalue:"var(--off-white)",placeholder:"Select",svgFill:"var(--off-white)",image:!0,singleicons:!0,value:Z,isSearchable:!1,onChange:function(e){!function(e){var t,n,i=null===(t=null==v?void 0:v.currencies)||void 0===t?void 0:t.find((function(t){return t.unique_id===(null==e?void 0:e.value)}));w(G(G({},B),{selectedCrypto:(null===(n=null==i?void 0:i.supported_currency)||void 0===n?void 0:n.code)||""})),Q(e)}(e)},isDisabled:f,options:N}):x.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:x.jsx(ao,{})})}),(null==E?void 0:E.length)>0&&["USDT","USDC"].includes(B.selectedCrypto)&&x.jsx("div",{className:_.selected__two,children:x.jsx(qi,{backgroundColor:"var(--no-set-color)",colorvalue:"var(--primary-set-color)",placeholder:"Select",options:E,image:!0,singleicons:!0,isSearchable:!1,onChange:function(e){w(G(G({},B),{network_type:(null==e?void 0:e.value)||""}))},value:E.find((function(e){return e.value==B.network_type})),isDisabled:f})})]})]}),x.jsxs("div",{className:_.offRampInfoBox,children:[x.jsxs("div",{className:"".concat(_.offRampLabelCard," ").concat(_.offRampSpace),children:[x.jsx("div",{className:_.offRampLabelIcons,children:x.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",width:"12",height:"12",viewBox:"0 0 300 300",fill:"#fff",children:[x.jsx("path",{d:"M240.3 171.5H59.7c-11.9 0-21.5-9.6-21.5-21.5s9.6-21.5 21.5-21.5h180.6c11.9 0 21.5 9.6 21.5 21.5s-9.6 21.5-21.5 21.5","data-original":"#000000"}),x.jsx("circle",{cx:"150",cy:"65.5",r:"30.5","data-original":"#000000"}),x.jsx("circle",{cx:"150.5",cy:"234.5",r:"30.5","data-original":"#000000"})]})}),x.jsxs("div",{className:_.offRampLabelValue,children:[x.jsx("span",{style:{marginRight:10},children:"Rate :"}),le?x.jsx(ur,{}):"1 ".concat(B.selectedCrypto," = ").concat((null==$?void 0:$.toFixed(4))||0," ").concat(B.selectedFiat)]})]}),x.jsxs("div",{className:"".concat(_.offRampLabelTitles," ").concat(_.offRampSpaceTop),children:[x.jsx("div",{className:_.offRampLabelDots}),x.jsxs("div",{className:_.offRampDetails,children:[x.jsx("div",{className:_.offRampHead,children:"Withdrawal Method"}),x.jsx("div",{className:_.offPaymentBox,children:x.jsxs("div",{className:_.offPaymentCheckCard,children:[x.jsx("div",{children:"Bank Transfer"}),x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 408.576 408.576",children:x.jsx("g",{children:x.jsx("path",{d:"M204.288 0C91.648 0 0 91.648 0 204.288s91.648 204.288 204.288 204.288 204.288-91.648 204.288-204.288S316.928 0 204.288 0zm114.176 150.528-130.56 129.536c-7.68 7.68-19.968 8.192-28.16.512L90.624 217.6c-8.192-7.68-8.704-20.48-1.536-28.672 7.68-8.192 20.48-8.704 28.672-1.024l54.784 50.176L289.28 121.344c8.192-8.192 20.992-8.192 29.184 0s8.192 20.992 0 29.184z",fill:"#22BB33"})})})]})})]})]})]}),x.jsxs("div",{className:_.offRampFieldCard,children:[x.jsxs("div",{className:_.offRampFieldBox,children:[x.jsx("div",{className:_.offRampFieldLabel,children:"You Receive ( estimate )"}),x.jsx("div",{className:_.offRampFieldForm,children:le?x.jsx(ur,{size:20}):x.jsx("input",{type:"text",className:_.inputControl,value:(null==ge?void 0:ge.min)||(null==ge?void 0:ge.max)?0:Number(ne)&&Number(ne)>0?null==ne?void 0:ne.toFixed(4):0,disabled:!0})})]}),x.jsx("div",{className:_.offRampFieldSelectCard,children:x.jsx("div",{className:_.offRampFieldSelect,children:(null==D?void 0:D.length)>0?x.jsx(qi,{backgroundColor:"var(--primary-set-color)",colorvalue:"var(--off-white)",placeholder:"Select",borderColor:"var(--no-color)",svgFill:"var(--off-white)",image:!0,singleicons:!0,options:D,value:R,isSearchable:!1,onChange:function(e){!function(e){var t,n,i=null===(t=null==v?void 0:v.currencies)||void 0===t?void 0:t.find((function(t){return(null==t?void 0:t.unique_id)===(null==e?void 0:e.value)}));w(G(G({},B),{selectedFiat:(null===(n=null==i?void 0:i.supported_currency)||void 0===n?void 0:n.code)||""})),X(e)}(e)},isDisabled:f||le}):x.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:x.jsx(ao,{})})})})]}),x.jsxs("div",{style:{marginTop:20},className:_.off_info_card,children:[x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 32 32",children:x.jsxs("g",{id:"Layer_20","data-name":"Layer 20",children:[x.jsx("path",{fill:"#fbd63b",d:"M28 28H4L16 6z"}),x.jsx("path",{fill:"#f8be31",d:"m16 6 12 22H16z"}),x.jsx("path",{fill:"#333",d:"m16 21-2-7h4z"}),x.jsx("circle",{cx:"16",cy:"25",r:"1",fill:"#333"}),x.jsx("path",{d:"M16 14h2l-2 7zM16 24a1 1 0 0 1 0 2z"})]})}),x.jsx("div",{className:_.off_caution_info,children:"Cryptocurrencies are volatile, and prices can change rapidly, make sure to research and understand the market risks."})]}),x.jsx("div",{className:_.offRampAction,children:x.jsx("button",{className:"".concat(_.actionBtn," ").concat(_.primary),onClick:function(){parseFloat(B.from_amount)>0?(w(G(G({},B),{to_currency_conversion_value:ne,exchange_rate:$})),g(2)):c("Please enter valid amount","error")},disabled:f||!(P>0)||ge.min||ge.max,children:"Sell Now"})})]}):2===m?x.jsx(go,{defaultTab:"select",setStep:g,data:B,apiKey:o,clientReferenceID:r,setTokenSellData:w,mode:l}):3===m?x.jsx(Yo,{tokenSellData:B,setTokenSellData:w,apiKey:o,clientReferenceID:r,setStep:g,mode:l}):4===m?x.jsx($i,{tokenSellData:B}):null})},mr=function(e){var t=e.apiKey,n=e.sellParameters,i=e.clientReferenceID,o=e.mode;return x.jsx(pr,{apiKey:t,parameters:n,clientReferenceID:i,mode:o})},gr=function(e){var t=e.apiKey,n=e.sellParameters,i=e.clientReferenceID,o=e.mode,s=void 0===o?"development":o;return x.jsx("div",{style:{position:"relative"},className:_.widgetComponent,id:"widget-container",children:x.jsx(no,{children:x.jsx(mr,{sellParameters:n,apiKey:t,clientReferenceID:i,mode:s})})})};export{gr as SellCryptoWidget};
|
23
|
+
*/function Ro(e,t=0){const n=[];return e.forEach((function(e,i){let o=null;e.forEach((function(s,r){if(!s&&null!==o)return n.push(`M${o+t} ${i+t}h${r-o}v1H${o+t}z`),void(o=null);if(r!==e.length-1)s&&null===o&&(o=r);else{if(!s)return;null===o?n.push(`M${r+t},${i+t} h1v1H${r+t}z`):n.push(`M${o+t},${i+t} h${r+1-o}v1H${o+t}z`)}}))})),n.join("")}function Xo(e,t){return e.slice().map(((e,n)=>n<t.y||n>=t.y+t.h?e:e.map(((e,n)=>(n<t.x||n>=t.x+t.w)&&e))))}function ko({value:e,level:n,minVersion:i,includeMargin:o,marginSize:s,imageSettings:r,size:a,boostLevel:l}){let c=t.useMemo((()=>{const t=(Array.isArray(e)?e:[e]).reduce(((e,t)=>(e.push(...Go.QrSegment.makeSegments(t)),e)),[]);return Go.QrCode.encodeSegments(t,Co[n],i,void 0,void 0,l)}),[e,n,i,l]);const{cells:d,margin:u,numCells:p,calculatedImageSettings:m}=t.useMemo((()=>{let e=c.getModules();const t=function(e,t){return null!=t?Math.max(Math.floor(t),0):e?4:0}(o,s),n=e.length+2*t,i=function(e,t,n,i){if(null==i)return null;const o=e.length+2*n,s=Math.floor(.1*t),r=o/t,a=(i.width||s)*r,l=(i.height||s)*r,c=null==i.x?e.length/2-a/2:i.x*r,d=null==i.y?e.length/2-l/2:i.y*r,u=null==i.opacity?1:i.opacity;let p=null;if(i.excavate){let e=Math.floor(c),t=Math.floor(d);p={x:e,y:t,w:Math.ceil(a+c-e),h:Math.ceil(l+d-t)}}return{x:c,y:d,h:l,w:a,excavation:p,opacity:u,crossOrigin:i.crossOrigin}}(e,a,t,r);return{cells:e,margin:t,numCells:n,calculatedImageSettings:i}}),[c,a,r,o,s]);return{qrcode:c,margin:u,cells:d,numCells:p,calculatedImageSettings:m}}var No=function(){try{(new Path2D).addPath(new Path2D)}catch(e){return!1}return!0}(),Wo=t.forwardRef((function(e,n){const i=e,{value:o,size:s=Bo,level:r=wo,bgColor:a=Fo,fgColor:l=Zo,includeMargin:c=Qo,minVersion:d=Ao,boostLevel:u,marginSize:p,imageSettings:m}=i,g=_o(i,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:b}=g,f=_o(g,["style"]),h=null==m?void 0:m.src,I=t.useRef(null),v=t.useRef(null),y=t.useCallback((e=>{I.current=e,"function"==typeof n?n(e):n&&(n.current=e)}),[n]),[x,_]=t.useState(!1),{margin:G,cells:C,numCells:B,calculatedImageSettings:w}=ko({value:o,level:r,minVersion:d,boostLevel:u,includeMargin:c,marginSize:p,imageSettings:m,size:s});t.useEffect((()=>{if(null!=I.current){const e=I.current,t=e.getContext("2d");if(!t)return;let n=C;const i=v.current,o=null!=w&&null!==i&&i.complete&&0!==i.naturalHeight&&0!==i.naturalWidth;o&&null!=w.excavation&&(n=Xo(C,w.excavation));const r=window.devicePixelRatio||1;e.height=e.width=s*r;const c=s/B*r;t.scale(c,c),t.fillStyle=a,t.fillRect(0,0,B,B),t.fillStyle=l,No?t.fill(new Path2D(Ro(n,G))):C.forEach((function(e,n){e.forEach((function(e,i){e&&t.fillRect(i+G,n+G,1,1)}))})),w&&(t.globalAlpha=w.opacity),o&&t.drawImage(i,w.x+G,w.y+G,w.w,w.h)}})),t.useEffect((()=>{_(!1)}),[h]);const F=xo({height:s,width:s},b);let Z=null;return null!=h&&(Z=t.createElement("img",{src:h,key:h,style:{display:"none"},onLoad:()=>{_(!0)},ref:v,crossOrigin:null==w?void 0:w.crossOrigin})),t.createElement(t.Fragment,null,t.createElement("canvas",xo({style:F,height:s,width:s,ref:y,role:"img"},f)),Z)}));Wo.displayName="QRCodeCanvas";var Lo,Do,Vo,Uo=t.forwardRef((function(e,n){const i=e,{value:o,size:s=Bo,level:r=wo,bgColor:a=Fo,fgColor:l=Zo,includeMargin:c=Qo,minVersion:d=Ao,boostLevel:u,title:p,marginSize:m,imageSettings:g}=i,b=_o(i,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:f,cells:h,numCells:I,calculatedImageSettings:v}=ko({value:o,level:r,minVersion:d,boostLevel:u,includeMargin:c,marginSize:m,imageSettings:g,size:s});let y=h,x=null;null!=g&&null!=v&&(null!=v.excavation&&(y=Xo(h,v.excavation)),x=t.createElement("image",{href:g.src,height:v.h,width:v.w,x:v.x+f,y:v.y+f,preserveAspectRatio:"none",opacity:v.opacity,crossOrigin:v.crossOrigin}));const _=Ro(y,f);return t.createElement("svg",xo({height:s,width:s,viewBox:`0 0 ${I} ${I}`,ref:n,role:"img"},b),!!p&&t.createElement("title",null,p),t.createElement("path",{fill:a,d:`M0,0 h${I}v${I}H0z`,shapeRendering:"crispEdges"}),t.createElement("path",{fill:l,d:_,shapeRendering:"crispEdges"}),x)}));function Eo(e){var t,n,i,o,s,r=e.mode,a=e.token;return"development"===r?(i={BNB:97,BUSD:97,ETH:11155111,USDT:11155111,BITCOIN:10001,AVAX:43113,MATIC:84432,SOL:102,XRP:2,POLYGON_AMOY:84432,NILE:3,TRX:1},(t={})[(s={ETHEREUM:11155111,MATIC:84432,BINANCE:97,BITCOIN:10001,AVAX:43113,SOLANA:102,RIPPLE:2,POLYGON_AMOY:84432,NILE:3,TRX:1}).ETHEREUM]="https://api-sepolia.etherscan.io",t[s.MATIC]="https://api-amoy.polygonscan.com",t[s.BINANCE]="https://api-testnet.bscscan.com",t[s.SOLANA]="https://api.devnet.solana.com",t[s.POLYGON_AMOY]="https://api-amoy.polygonscan.com",t[s.NILE]="https://nile.trongrid.io",t[s.TRX]="https://api.shasta.trongrid.io",o=t):(i={BNB:56,ETH:1,BITCOIN:10001,AVAX:43113,MATIC:137,SOL:101,TRX:2},(n={})[(s={ETHEREUM:1,POLYGON:137,BINANCE:56,BITCOIN:10001,AVAX:43113,SOLANA:101,TRX:2}).ETHEREUM]="https://api.etherscan.io",n[s.MATIC]="https://api.polygonscan.com",n[s.BINANCE]="https://api.bscscan.com",n[s.SOLANA]="https://api.mainnet-beta.solana.com",n[s.POLYGON_AMOY]="https://api.polygonscan.com",n[s.TRX]="https://api.trongrid.io",o=n),o[i[a]]}Uo.displayName="QRCodeSVG","production"!=process.env.NODE_ENV?((Lo={})[(Vo={ETHEREUM:11155111,MATIC:84432,BINANCE:97,BITCOIN:10001,AVAX:43113,SOLANA:102,RIPPLE:2,POLYGON_AMOY:84432,NILE:3,TRX:1}).ETHEREUM]="https://api-sepolia.etherscan.io",Lo[Vo.MATIC]="https://api-amoy.polygonscan.com",Lo[Vo.BINANCE]="https://api-testnet.bscscan.com",Lo[Vo.SOLANA]="https://api.devnet.solana.com",Lo[Vo.POLYGON_AMOY]="https://api-amoy.polygonscan.com",Lo[Vo.NILE]="https://nile.trongrid.io",Lo[Vo.TRX]="https://api.shasta.trongrid.io"):((Do={})[(Vo={ETHEREUM:1,POLYGON:137,BINANCE:56,BITCOIN:10001,AVAX:43113,SOLANA:101,TRX:1}).ETHEREUM]="https://api.etherscan.io",Do[Vo.MATIC]="https://api.polygonscan.com",Do[Vo.BINANCE]="https://api.bscscan.com",Do[Vo.SOLANA]="https://api.mainnet-beta.solana.com",Do[Vo.POLYGON_AMOY]="https://api.polygonscan.com",Do[Vo.TRX]="https://api.trongrid.io");var Yo=function(e){var t,i,o=e.tokenSellData,s=e.setTokenSellData,r=e.apiKey,l=e.setStep,c=e.clientReferenceID,d=e.mode,u=io().addToast,m=n(!1),g=m[0],b=m[1],f=n(!0),h=f[0],I=f[1],v=n(!1),y=v[0];v[1];var w=n(""),F=w[0],Z=w[1],Q=n(!0),A=Q[0],R=Q[1],X=n(!0),k=X[0],N=X[1],W=n(!1),L=W[0],D=W[1],V=n(null),U=V[0],E=V[1],Y=n(""),S=Y[0],O=Y[1],M=n(!1),H=M[0],T=M[1],J=n(null),j=J[0],z=J[1],P=a(null),K=a(null),q=n(o.network_type||""),$=q[0];q[1],p((function(){window.scrollTo(0,0),ne()}),[]);var ee=function(){ie(G(G({},o),{transaction_hash:S}))};p((function(){if(!h&&U){var e=U,t=["USDT","USDC"].includes(o.selectedCrypto)?o.network_type:o.selectedCrypto;te(e,t,o.selectedCrypto)}I(!1)}),[U,o]);var te=function(e,t,n){return C(void 0,void 0,void 0,(function(){var i,s,r;return B(this,(function(a){return i="TRX"===t?"tron":"SOL"===t?"solana":"ethereum",["TRX","SOL"].includes(t)||["USDC","USDT"].includes(n),s=o.from_amount.toString(),r="".concat(i,":").concat(e,"?amount=").concat(s,"&label=").concat(encodeURIComponent("HeraldExchangeSell")),Z(r),[2]}))}))},ne=function(){return C(void 0,void 0,void 0,(function(){var e;return B(this,(function(t){return e=co(d),D(!0),oo({url:"".concat(e,"/api/offramp/wallet_address"),headers:{"Content-Type":"application/json","X-API-KEY":r,"User-Id":c},onSuccess:function(e){var t,n,i;if(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.wallet_address){var s=(["USDT","USDC"].includes(o.selectedCrypto)?o.network_type:o.selectedCrypto).toLowerCase(),r=["eth","bnb","matic"].includes(s)?null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.wallet_address.evm:["evm","trx","sol"].includes(s)?null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.wallet_address[s]:"";E(r),D(!1)}},onError:function(){u("Error fetching exchange rate","error"),D(!1)}}),[2]}))}))},ie=function(e){return C(void 0,void 0,void 0,(function(){var t,n,i;return B(this,(function(a){return T(!0),t=co(d),(n=new FormData).append("from",o.selectedCrypto),n.append("to",o.selectedFiat),["USDT","USDC"].includes(o.selectedCrypto)&&n.append("network_type",o.network_type),n.append("value",o.from_amount),n.append("initial_exchange_rate",null===(i=o.exchange_rate)||void 0===i?void 0:i.toString()),n.append("transaction_hash",e.transaction_hash),n.append("bank_account",o.selectedBeneficiary),oo({url:"".concat(t,"/api/offramp/transactions"),headers:{"X-API-KEY":r,"User-Id":c},method:"POST",body:n,onSuccess:function(e){(null==e?void 0:e.success)?(z({data:null==e?void 0:e.data}),b(!0),s(G(G({},o),{response:null==e?void 0:e.data})),T(!1),u("".concat(null==e?void 0:e.message),"success"),l(4)):(u("".concat(null==e?void 0:e.message),"error"),b(!1),T(!1))},onError:function(e){u(" ".concat(e),"error"),b(!1),T(!1)}}),[2]}))}))};p((function(){if(!h&&U&&A){var e=U,t=["USDT","USDC"].includes(o.selectedCrypto)?o.network_type:o.selectedCrypto,n=o.selectedCrypto,i=o.from_amount;if(e&&"production"===d){var s=Date.now();P.current=setInterval((function(){["USDT","USDC"].includes(n)&&$?re({currency:n,token:$,walletAddress:e,startTimestamp:s,expected_amount:i}):oe(t,e,s,i)}),1e4)}else ce()}return I(!1),function(){P.current&&clearInterval(P.current)}}),[U,o,A]);var oe=function(e,t,n,i){return C(void 0,void 0,void 0,(function(){var o,s,r;return B(this,(function(a){switch(a.label){case 0:if(o="",s=Eo({mode:d,token:e}),"ETH"===e)o="".concat(s,"/api?module=account&action=txlist&address=").concat(t,"&startblock=0&endblock=99999999&sort=desc&apikey=").concat("B34RQKNPZUV8IM6866DQ58WCS2Q6SWAP8V");else if("BNB"===e)o="".concat(s,"/api?module=account&action=txlist&address=").concat(t,"&startblock=0&endblock=99999999&sort=desc&apikey=").concat("876A7KYGBE2TVBBNY33I4GZPXE1Q4QH3QA");else if("MATIC"===e||"POLYGON"===e||"POLYGON_AMOY"===e)o="".concat(s,"/api?module=account&action=txlist&address=").concat(t,"&startblock=0&endblock=99999999&sort=desc&apikey=").concat("KYV61TJQU5RDMTGY1D95J8R61HWCR9T7KT");else{if("TRX"!==e)return"SOL"===e?[2,le()]:[2];o="".concat(s,"/v1/accounts/").concat(t,"/transactions?limit=10")}if(!k)return[3,5];a.label=1;case 1:return a.trys.push([1,4,,5]),[4,fetch(o)];case 2:return[4,a.sent().json()];case 3:return r=a.sent(),se(r,t,e,n,i),[3,5];case 4:return a.sent(),[3,5];case 5:return[2]}}))}))},se=function(e,t,n,i,o){var s=[];"ETH"===n||"BNB"===n||"MATIC"===n?s=e.result:"TRX"===n?s=e.data:"SOL"===n&&(s=e.result),s.forEach((function(e){if(("TRX"==n?e.block_timestamp:1e3*e.timeStamp)>i){var t=e.hash||e.transactionHash||e.txID,s="TRX"==n?e.raw_data.contract[0].parameter.value.amount/1e6:e.value/1e18;o==s&&(K.current.value=t,O(t),R(!1))}}))},re=function(e){return C(void 0,[e],void 0,(function(e){var t,n,i,o,s,r=e.currency,a=e.token,l=e.walletAddress,c=e.startTimestamp,u=e.expected_amount;return B(this,(function(e){switch(e.label){case 0:if(t="",n=Eo({mode:d,token:a}),i=function(e){var t,n,i=e.mode,o=e.token,s=e.networkType;return"development"===i?(t={USDC:"Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",USDT:"Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr"},n={ETH:{USDC:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",USDT:"0x7169D38820dfd117C3FA1f22a697dBA58d90BA06",LINK:"0xb227f007804c16546Bd054dfED2E7A1fD5437678",MATIC:"0x8D38d6Ffa17FFD6dA49D4b53B6f0DFc8D291E867"},MATIC:{USDC:"0x702207d9c124c86c85A97222Cde98476f987ddaE",USDT:"0x702207d9c124c86c85A97222Cde98476f987ddaE",DAI:"0xb2df85a09cAB3a391Fd9ade76342583A0d4B75ce"},POLYGON_AMOY:{USDC:"0x702207d9c124c86c85A97222Cde98476f987ddaE",USDT:"0x702207d9c124c86c85A97222Cde98476f987ddaE",DAI:"0xb2df85a09cAB3a391Fd9ade76342583A0d4B75ce"},BNB:{USDT:"0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",USDC:"0xfbe87897c07Cc64b6FFc04257672854b90e5B17b"},SHASTA:{USDT:"TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs",USDC:"TSdZwNqpHofzP6BsBKGQUWdBeJphLmF6id"},TRX:{USDT:"TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs",USDC:"TSdZwNqpHofzP6BsBKGQUWdBeJphLmF6id"}}):(t={USDC:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",USDT:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"},n={ETH:{USDC:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",USDT:"0xdAC17F958D2ee523a2206206994597C13D831ec7"},MATIC:{USDC:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",USDT:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F"},POLYGON:{USDC:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",USDT:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F"},POLYGON_AMOY:{USDC:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",USDT:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F"},BNB:{USDT:"0x55d398326f99059fF775485246999027B3197955",USDC:"0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"},TRX:{USDT:"TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",USDC:"TLZSucJRjnqBKwvQz6n5hd29gbS4P7u7w8"}}),"SOL"===s?t[o]:n[s][o]||""}({mode:d,token:r,networkType:$}),["ETH","BNB","MATIC"].includes($))o="ETH"==$?"B34RQKNPZUV8IM6866DQ58WCS2Q6SWAP8V":"BNB"==$?"876A7KYGBE2TVBBNY33I4GZPXE1Q4QH3QA":"KYV61TJQU5RDMTGY1D95J8R61HWCR9T7KT",t="".concat(n,"/api?module=account&action=tokentx&address=").concat(l,"&startblock=0&endblock=99999999&sort=desc&apikey=").concat(o);else{if("TRX"!==$)return"SOL"===$?[2,le()]:[2];t="".concat(n,"/v1/accounts/").concat(l,"/transactions/trc20")}e.label=1;case 1:return e.trys.push([1,4,,5]),[4,fetch(t)];case 2:return[4,e.sent().json()];case 3:return s=e.sent(),ae(s,l,a,c,i,u),[3,5];case 4:return e.sent(),[3,5];case 5:return[2]}}))}))},ae=function(e,t,n,i,o,s){(e.result||e.data||[]).forEach((function(e){if(("TRX"==$?e.block_timestamp:1e3*e.timeStamp)>i)if("TRX"==$){var t=e.hash||e.transaction_id||e.txID;parseFloat(e.value)/Math.pow(10,parseInt(e.token_info.decimals))==s&&(K.current.value=t,O(t),R(!1))}else if(o.toLowerCase()==e.contractAddress.toLowerCase()){t=e.hash||e.transactionHash||e.txID;parseFloat(e.value)/Math.pow(10,parseInt(e.tokenDecimal))==s&&(K.current.value=t,O(t),R(!1))}}))},le=function(){return C(void 0,void 0,void 0,(function(){return B(this,(function(e){return N(!1),R(!1),[2]}))}))},ce=function(){R(!1),N(!1)};return x.jsxs(x.Fragment,{children:[x.jsx("div",{className:_.sellPaymentDetailsWrap,children:x.jsxs("div",{className:_.offRampBankHead,children:[x.jsx("div",{style:{cursor:"pointer"},onClick:function(){return l(2)},children:x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",width:"18",height:"18",viewBox:"0 0 240.823 240.823",children:x.jsx("path",{d:"M57.633 129.007 165.93 237.268c4.752 4.74 12.451 4.74 17.215 0 4.752-4.74 4.752-12.439 0-17.179l-99.707-99.671 99.695-99.671c4.752-4.74 4.752-12.439 0-17.191-4.752-4.74-12.463-4.74-17.215 0L57.621 111.816c-4.679 4.691-4.679 12.511.012 17.191","data-original":"#000000"})})}),x.jsx("div",{className:_.bankTitles,children:"Sell Crypto"})]})}),L?x.jsx(so,{}):U&&(null===(t=Object.keys(U))||void 0===t?void 0:t.length)>0?x.jsxs(x.Fragment,{children:[x.jsx("div",{className:_.sellPaymentDetailsWrap,children:x.jsxs("div",{className:_.sellQRPayementWrap,children:[x.jsxs("div",{className:_.sellAmtDetails,children:[x.jsxs("div",{className:_.sellAmtDetailsWrap,children:[x.jsxs("div",{className:_.sellAmtPay,children:[x.jsx("span",{className:_.sellPayLabel,children:"You Pay "}),x.jsxs("span",{className:_.sellPayAmt,children:[o.from_amount," ",o.selectedCrypto," ",["USDT","USDC"].includes(o.selectedCrypto)&&o.network_type?"(".concat(o.network_type,")"):""]})]}),x.jsxs("div",{className:_.sellAmtGet,children:[x.jsx("span",{className:_.sellPayLabel,children:"You Get "}),x.jsxs("span",{className:_.sellPayAmt,children:[null===(i=o.to_currency_conversion_value)||void 0===i?void 0:i.toFixed(4)," ",o.selectedFiat]})]})]}),x.jsx("div",{className:_.sellEstimatedInfo,children:x.jsxs("p",{children:[" ",x.jsx("span",{children:"Estimated Rate "})," ",x.jsxs("span",{children:["1 ",o.selectedCrypto," ="," ",isNaN(o.exchange_rate)?0:o.exchange_rate.toFixed(4)," ",o.selectedFiat]})]})})]}),x.jsx("div",{className:_.sellPaymentQRBox,children:x.jsx("div",{className:_.sellPaymentQRFrame,children:F?x.jsx(Wo,{value:F,size:128,bgColor:"#ffffff",fgColor:"#000000",level:"H"}):x.jsx(so,{})})})]})}),x.jsxs("form",{onSubmit:ee,children:[x.jsxs("div",{className:_.selllWalletAddressCard,children:[y||U&&x.jsxs("div",{className:_.sellWalletDataCard,children:[x.jsx("h6",{children:"Wallet Address"}),x.jsxs("div",{className:_.sellWalletCodeCard,children:[x.jsxs("div",{className:_.sellWalletCode,children:[x.jsxs("span",{children:[" ",U]})," "]}),x.jsx("button",{className:"".concat(_.actionBtn," ").concat(_.overlay),type:"button",onClick:function(){return C(void 0,void 0,void 0,(function(){return B(this,(function(e){switch(e.label){case 0:return[4,navigator.clipboard.writeText(U)];case 1:return e.sent(),u("Copied","success"),[2]}}))}))},children:x.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#298BFF","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"icon icon-tabler icons-tabler-outline icon-tabler-copy",children:[x.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),x.jsx("path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z"}),x.jsx("path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1"})]})})]})]}),x.jsxs("div",{className:_.sellHashBox,children:[x.jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:x.jsxs("div",{className:_.sellHashLabel,children:["Transaction Hash ",x.jsx("span",{children:"*"})]})}),x.jsx("input",{className:_.sellHashFields,type:"text",placeholder:"Enter Transaction Hash",name:"transaction_hash",onChange:function(e){return O(e.target.value)},ref:K,disabled:k})]})]}),x.jsx("div",{className:_.efiSwapAction,children:A||H||g?x.jsx("div",{className:"mt-3",children:x.jsx(bo,{props:j,monitoring:A})}):x.jsx("button",{className:"".concat(_.actionBtn," ").concat(_.primary),onClick:function(e){e.preventDefault(),ee()},disabled:!S||H,children:H?x.jsx(ro,{}):"Submit"})})]})]}):x.jsx(x.Fragment,{children:x.jsxs("div",{className:_.no_wallet_details,children:[x.jsx("p",{children:"No Wallet Details Found"}),x.jsx("div",{children:x.jsx("button",{className:"".concat(_.actionBtn," ").concat(_.primary),onClick:function(){return ne()},children:"Retry"})})]})})]})};const So=Object.create(null);So.open="0",So.close="1",So.ping="2",So.pong="3",So.message="4",So.upgrade="5",So.noop="6";const Oo=Object.create(null);Object.keys(So).forEach((e=>{Oo[So[e]]=e}));const Mo={type:"error",data:"parser error"},Ho="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),To="function"==typeof ArrayBuffer,Jo=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,jo=({type:e,data:t},n,i)=>Ho&&t instanceof Blob?n?i(t):zo(t,i):To&&(t instanceof ArrayBuffer||Jo(t))?n?i(t):zo(new Blob([t]),i):i(So[e]+(t||"")),zo=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function Po(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Ko;const qo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$o="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)$o[qo.charCodeAt(e)]=e;const es="function"==typeof ArrayBuffer,ts=(e,t)=>{if("string"!=typeof e)return{type:"message",data:is(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:ns(e.substring(1),t)};return Oo[n]?e.length>1?{type:Oo[n],data:e.substring(1)}:{type:Oo[n]}:Mo},ns=(e,t)=>{if(es){const n=(e=>{let t,n,i,o,s,r=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(r--,"="===e[e.length-2]&&r--);const c=new ArrayBuffer(r),d=new Uint8Array(c);for(t=0;t<a;t+=4)n=$o[e.charCodeAt(t)],i=$o[e.charCodeAt(t+1)],o=$o[e.charCodeAt(t+2)],s=$o[e.charCodeAt(t+3)],d[l++]=n<<2|i>>4,d[l++]=(15&i)<<4|o>>2,d[l++]=(3&o)<<6|63&s;return c})(e);return is(n,t)}return{base64:!0,data:e}},is=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,os=String.fromCharCode(30);function ss(){return new TransformStream({transform(e,t){!function(e,t){Ho&&e.data instanceof Blob?e.data.arrayBuffer().then(Po).then(t):To&&(e.data instanceof ArrayBuffer||Jo(e.data))?t(Po(e.data)):jo(e,!1,(e=>{Ko||(Ko=new TextEncoder),t(Ko.encode(e))}))}(e,(n=>{const i=n.length;let o;if(i<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,i);else if(i<65536){o=new Uint8Array(3);const e=new DataView(o.buffer);e.setUint8(0,126),e.setUint16(1,i)}else{o=new Uint8Array(9);const e=new DataView(o.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(i))}e.data&&"string"!=typeof e.data&&(o[0]|=128),t.enqueue(o),t.enqueue(n)}))}})}let rs;function as(e){return e.reduce(((e,t)=>e+t.length),0)}function ls(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let i=0;for(let o=0;o<t;o++)n[o]=e[0][i++],i===e[0].length&&(e.shift(),i=0);return e.length&&i<e[0].length&&(e[0]=e[0].slice(i)),n}function cs(e){if(e)return function(e){for(var t in cs.prototype)e[t]=cs.prototype[t];return e}(e)}cs.prototype.on=cs.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},cs.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},cs.prototype.off=cs.prototype.removeListener=cs.prototype.removeAllListeners=cs.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,i=this._callbacks["$"+e];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<i.length;o++)if((n=i[o])===t||n.fn===t){i.splice(o,1);break}return 0===i.length&&delete this._callbacks["$"+e],this},cs.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(n){i=0;for(var o=(n=n.slice(0)).length;i<o;++i)n[i].apply(this,t)}return this},cs.prototype.emitReserved=cs.prototype.emit,cs.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},cs.prototype.hasListeners=function(e){return!!this.listeners(e).length};const ds="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),us="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function ps(e,...t){return t.reduce(((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t)),{})}const ms=us.setTimeout,gs=us.clearTimeout;function bs(e,t){t.useNativeTimers?(e.setTimeoutFn=ms.bind(us),e.clearTimeoutFn=gs.bind(us)):(e.setTimeoutFn=us.setTimeout.bind(us),e.clearTimeoutFn=us.clearTimeout.bind(us))}function fs(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class hs extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class Is extends cs{constructor(e){super(),this.writable=!1,bs(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new hs(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=ts(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}class vs extends Is{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split(os),i=[];for(let e=0;e<n.length;e++){const o=ts(n[e],t);if(i.push(o),"error"===o.type)break}return i})(e,this.socket.binaryType).forEach((e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,i=new Array(n);let o=0;e.forEach(((e,s)=>{jo(e,!1,(e=>{i[s]=e,++o===n&&t(i.join(os))}))}))})(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=fs()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let ys=!1;try{ys="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}const xs=ys;function _s(){}class Gs extends vs{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",((e,t)=>{this.onError("xhr post error",e,t)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",((e,t)=>{this.onError("xhr poll error",e,t)})),this.pollXhr=e}}class Cs extends cs{constructor(e,t,n){super(),this.createRequest=e,bs(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var e;const t=ps(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(t);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(e){}if("POST"===this._method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this._opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(n.getResponseHeader("set-cookie"))),4===n.readyState&&(200===n.status||1223===n.status?this._onLoad():this.setTimeoutFn((()=>{this._onError("number"==typeof n.status?n.status:0)}),0))},n.send(this._data)}catch(e){return void this.setTimeoutFn((()=>{this._onError(e)}),0)}"undefined"!=typeof document&&(this._index=Cs.requestsCount++,Cs.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=_s,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete Cs.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(Cs.requestsCount=0,Cs.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",Bs);else if("function"==typeof addEventListener){addEventListener("onpagehide"in us?"pagehide":"unload",Bs,!1)}function Bs(){for(let e in Cs.requests)Cs.requests.hasOwnProperty(e)&&Cs.requests[e].abort()}const ws=function(){const e=Fs({xdomain:!1});return e&&null!==e.responseType}();function Fs(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||xs))return new XMLHttpRequest}catch(e){}if(!t)try{return new(us[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const Zs="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class Qs extends Is{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=Zs?{}:ps(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],i=t===e.length-1;jo(n,this.supportsBinary,(e=>{try{this.doWrite(n,e)}catch(e){}i&&ds((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=fs()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const As=us.WebSocket||us.MozWebSocket;const Rs={websocket:class extends Qs{createSocket(e,t,n){return Zs?new As(e,t,n):t?new As(e,t):new As(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends Is{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then((()=>{this.onClose()})).catch((e=>{this.onError("webtransport error",e)})),this._transport.ready.then((()=>{this._transport.createBidirectionalStream().then((e=>{const t=function(e,t){rs||(rs=new TextDecoder);const n=[];let i=0,o=-1,s=!1;return new TransformStream({transform(r,a){for(n.push(r);;){if(0===i){if(as(n)<1)break;const e=ls(n,1);s=!(128&~e[0]),o=127&e[0],i=o<126?3:126===o?1:2}else if(1===i){if(as(n)<2)break;const e=ls(n,2);o=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),i=3}else if(2===i){if(as(n)<8)break;const e=ls(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),s=t.getUint32(0);if(s>Math.pow(2,21)-1){a.enqueue(Mo);break}o=s*Math.pow(2,32)+t.getUint32(4),i=3}else{if(as(n)<o)break;const e=ls(n,o);a.enqueue(ts(s?e:rs.decode(e),t)),i=0}if(0===o||o>e){a.enqueue(Mo);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),i=ss();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const o=()=>{n.read().then((({done:e,value:t})=>{e||(this.onPacket(t),o())})).catch((e=>{}))};o();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then((()=>this.onOpen()))}))}))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],i=t===e.length-1;this._writer.write(n).then((()=>{i&&ds((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends Gs{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=ws&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Cs(Fs,this.uri(),e)}}},Xs=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ks=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ns(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),i=e.indexOf("]");-1!=n&&-1!=i&&(e=e.substring(0,n)+e.substring(n,i).replace(/:/g,";")+e.substring(i,e.length));let o=Xs.exec(e||""),s={},r=14;for(;r--;)s[ks[r]]=o[r]||"";return-1!=n&&-1!=i&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=function(e,t){const n=/\/{2,9}/g,i=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||i.splice(0,1);"/"==t.slice(-1)&&i.splice(i.length-1,1);return i}(0,s.path),s.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,i){t&&(n[t]=i)})),n}(0,s.query),s}const Ws="function"==typeof addEventListener&&"function"==typeof removeEventListener,Ls=[];Ws&&addEventListener("offline",(()=>{Ls.forEach((e=>e()))}),!1);class Ds extends cs{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const n=Ns(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=Ns(t.host).host);bs(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach((e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e})),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let e=0,i=n.length;e<i;e++){let i=n[e].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}(this.opts.query)),Ws&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Ls.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);const e=this.opts.rememberUpgrade&&Ds.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",(e=>this._onClose("transport close",e)))}onOpen(){this.readyState="open",Ds.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn((()=>{this._onClose("ping timeout")}),e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let n=0;n<this.writeBuffer.length;n++){const i=this.writeBuffer[n].data;if(i&&(e+="string"==typeof(t=i)?function(e){let t=0,n=0;for(let i=0,o=e.length;i<o;i++)t=e.charCodeAt(i),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(i++,n+=4);return n}(t):Math.ceil(1.33*(t.byteLength||t.size))),n>0&&e>this._maxPayload)return this.writeBuffer.slice(0,n);e+=2}var t;return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,ds((()=>{this._onClose("ping timeout")}),this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket("message",e,t,n),this}send(e,t,n){return this._sendPacket("message",e,t,n),this}_sendPacket(e,t,n,i){if("function"==typeof t&&(i=t,t=void 0),"function"==typeof n&&(i=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const o={type:e,data:t,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?n():e()})):this.upgrading?n():e()),this}_onError(e){if(Ds.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Ws&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=Ls.indexOf(this._offlineEventListener);-1!==e&&Ls.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}Ds.protocol=4;class Vs extends Ds{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;Ds.priorWebsocketSuccess=!1;const i=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",(e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Ds.priorWebsocketSuccess="websocket"===t.name,this.transport.pause((()=>{n||"closed"!==this.readyState&&(c(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())}))}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}})))};function o(){n||(n=!0,c(),t.close(),t=null)}const s=e=>{const n=new Error("probe error: "+e);n.transport=t.name,o(),this.emitReserved("upgradeError",n)};function r(){s("transport closed")}function a(){s("socket closed")}function l(e){t&&e.name!==t.name&&o()}const c=()=>{t.removeListener("open",i),t.removeListener("error",s),t.removeListener("close",r),this.off("close",a),this.off("upgrading",l)};t.once("open",i),t.once("error",s),t.once("close",r),this.once("close",a),this.once("upgrading",l),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn((()=>{n||t.open()}),200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}let Us=class extends Vs{constructor(e,t={}){const n="object"==typeof e?e:t;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map((e=>Rs[e])).filter((e=>!!e))),super(e,n)}};const Es="function"==typeof ArrayBuffer,Ys=Object.prototype.toString,Ss="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Ys.call(Blob),Os="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===Ys.call(File);function Ms(e){return Es&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||Ss&&e instanceof Blob||Os&&e instanceof File}function Hs(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(Hs(e[t]))return!0;return!1}if(Ms(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return Hs(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&Hs(e[t]))return!0;return!1}function Ts(e){const t=[],n=e.data,i=e;return i.data=Js(n,t),i.attachments=t.length,{packet:i,buffers:t}}function Js(e,t){if(!e)return e;if(Ms(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let i=0;i<e.length;i++)n[i]=Js(e[i],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=Js(e[i],t));return n}return e}function js(e,t){return e.data=zs(e.data,t),delete e.attachments,e}function zs(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=zs(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=zs(e[n],t));return e}const Ps=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ks;!function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"}(Ks||(Ks={}));function qs(e){return"[object Object]"===Object.prototype.toString.call(e)}class $s extends cs{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===Ks.BINARY_EVENT;n||t.type===Ks.BINARY_ACK?(t.type=n?Ks.EVENT:Ks.ACK,this.reconstructor=new er(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!Ms(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(void 0===Ks[n.type])throw new Error("unknown packet type "+n.type);if(n.type===Ks.BINARY_EVENT||n.type===Ks.BINARY_ACK){const i=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const o=e.substring(i,t);if(o!=Number(o)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(o)}if("/"===e.charAt(t+1)){const i=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}n.nsp=e.substring(i,t)}else n.nsp="/";const i=e.charAt(t+1);if(""!==i&&Number(i)==i){const i=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(i,t+1))}if(e.charAt(++t)){const i=this.tryParse(e.substr(t));if(!$s.isPayloadValid(n.type,i))throw new Error("invalid payload");n.data=i}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case Ks.CONNECT:return qs(t);case Ks.DISCONNECT:return void 0===t;case Ks.CONNECT_ERROR:return"string"==typeof t||qs(t);case Ks.EVENT:case Ks.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Ps.indexOf(t[0]));case Ks.ACK:case Ks.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class er{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=js(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var tr=Object.freeze({__proto__:null,Decoder:$s,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==Ks.EVENT&&e.type!==Ks.ACK||!Hs(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Ks.EVENT?Ks.BINARY_EVENT:Ks.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==Ks.BINARY_EVENT&&e.type!==Ks.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Ts(e),n=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(n),i}},get PacketType(){return Ks},protocol:5});function nr(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const ir=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class or extends cs{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[nr(e,"open",this.onopen.bind(this)),nr(e,"packet",this.onpacket.bind(this)),nr(e,"error",this.onerror.bind(this)),nr(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var n,i,o;if(ir.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const s={type:Ks.EVENT,data:t,options:{}};if(s.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),s.id=e}const r=null===(i=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===i?void 0:i.writable,a=this.connected&&!(null===(o=this.io.engine)||void 0===o?void 0:o._hasPingExpired());return this.flags.volatile&&!r||(a?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,t){var n;const i=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===i)return void(this.acks[e]=t);const o=this.io.setTimeoutFn((()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))}),i),s=(...e)=>{this.io.clearTimeoutFn(o),t.apply(this,e)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...t){return new Promise(((n,i)=>{const o=(e,t)=>e?i(e):n(t);o.withError=!0,t.push(o),this.emit(e,...t)}))}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push(((e,...i)=>{if(n!==this._queue[0])return;return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...i)),n.pending=!1,this._drainQueue()})),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this._sendConnectPacket(e)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Ks.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach((e=>{if(!this.sendBuffer.some((t=>String(t.id)===e))){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}}))}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Ks.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ks.EVENT:case Ks.BINARY_EVENT:this.onevent(e);break;case Ks.ACK:case Ks.BINARY_ACK:this.onack(e);break;case Ks.DISCONNECT:this.ondisconnect();break;case Ks.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...i){n||(n=!0,t.packet({type:Ks.ACK,id:e,data:i}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((e=>this.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>{this.notifyOutgoingListeners(e),this.packet(e)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ks.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function sr(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}sr.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},sr.prototype.reset=function(){this.attempts=0},sr.prototype.setMin=function(e){this.ms=e},sr.prototype.setMax=function(e){this.max=e},sr.prototype.setJitter=function(e){this.jitter=e};class rr extends cs{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,bs(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new sr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const i=t.parser||tr;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Us(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const i=nr(t,"open",(function(){n.onopen(),e&&e()})),o=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},s=nr(t,"error",o);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn((()=>{i(),o(new Error("timeout")),t.close()}),e);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}return this.subs.push(i),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(nr(e,"ping",this.onping.bind(this)),nr(e,"data",this.ondata.bind(this)),nr(e,"error",this.onerror.bind(this)),nr(e,"close",this.onclose.bind(this)),nr(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){ds((()=>{this.emitReserved("packet",e)}),this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new or(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const e of t){if(this.nsps[e].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach((e=>e())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),null===(n=this.engine)||void 0===n||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const ar={};function lr(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let i=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),i=Ns(e)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const o=-1!==i.host.indexOf(":")?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+o+":"+i.port+t,i.href=i.protocol+"://"+o+(n&&n.port===i.port?"":":"+i.port),i}(e,(t=t||{}).path||"/socket.io"),i=n.source,o=n.id,s=n.path,r=ar[o]&&s in ar[o].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||r?a=new rr(i,t):(ar[o]||(ar[o]=new rr(i,t)),a=ar[o]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}Object.assign(lr,{Manager:rr,Socket:or,io:lr,connect:lr});var cr=null,dr=0,ur=function(e){var t=e.size;return x.jsx("div",{style:{width:t||20},className:_.dotLoader})},pr=function(e){var t,i,o=e.apiKey,s=e.parameters,r=e.clientReferenceID,l=e.mode,c=io().addToast,d=function(e){var t=e.onConnectCallback,n=e.onDisconnectCallback,i=e.mode,o=a(null);return p((function(){dr+=1;var e=function(e){return"production"===e?"https://woowga-node.herald.exchange:9001/":"https://efi-exchange.blockstall.com:9001/"}(i);return cr||(cr=lr(e,{transports:["websocket"]})),o.current=cr,t&&cr.on("connect",t),n&&cr.on("disconnect",n),function(){t&&cr.off("connect",t),n&&cr.off("disconnect",n),0==(dr-=1)&&cr&&(cr.disconnect(),cr=null)}}),[]),o.current}({mode:l}),u=n(1),m=u[0],g=u[1],b=n(!1),f=b[0],h=b[1],I=n(null),v=I[0],y=I[1],C=n({from_amount:(null==s?void 0:s.from_amount)&&parseFloat(null==s?void 0:s.from_amount)>0?s.from_amount:"0",selectedCrypto:(null==s?void 0:s.from_currency)||"",selectedFiat:(null==s?void 0:s.to_currency)||"",to_currency_conversion_value:0,exchange_rate:0,minAmount:"0.0000001",maxAmount:"100000.0000",network_type:"",selectedBeneficiary:""}),B=C[0],w=C[1],F=n(null),Z=F[0],Q=F[1],A=n(null),R=A[0],X=A[1],k=n([]),N=k[0],W=k[1],L=n([]),D=L[0],V=L[1],U=n([]),E=U[0],Y=U[1],S=n(null),O=S[0],M=S[1],H=n(0);H[0];var T=H[1],J=n(0);J[0];var j=J[1],z=n(0),P=z[0],K=z[1],q=n(0),$=q[0],ee=q[1],te=n(0),ne=te[0],ie=te[1],oe=n(!1),se=oe[0],re=oe[1],ae=n(!0),le=ae[0],ce=ae[1],de=n(null),ue=de[0],pe=de[1],me=n({min:!1,max:!1}),ge=me[0],be=me[1],fe=n({admin_commission:0,merchant_commission:0}),he=fe[0],Ie=fe[1];p((function(){xe(),ye(),ve()}),[]);var ve=function(){var e=co(l);oo({url:"".concat(e,"/api/lookup/configurations"),headers:{"Content-Type":"application/json","X-API-KEY":o,"User-Id":r},onSuccess:function(e){var t,n;(null==e?void 0:e.success)&&re(1===(null===(n=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.merchant_configuration)||void 0===n?void 0:n.range_calculation))},onError:function(){c("Error fetching configuration","error")}})},ye=function(){var e=co(l);oo({url:"".concat(e,"/api/lookup/commissions"),headers:{"Content-Type":"application/json","X-API-KEY":o,"User-Id":r},onSuccess:function(e){(null==e?void 0:e.success)&&M(null==e?void 0:e.data)},onError:function(){c("Error fetching comission","error")}})},xe=function(){var e=co(l);h(!0),oo({url:"".concat(e,"/api/lookup/currencies"),headers:{"Content-Type":"application/json","X-API-KEY":o,"User-Id":r},onSuccess:function(e){(null==e?void 0:e.success)&&y(null==e?void 0:e.data),h(!1)},onError:function(){c("Error fetching currency","error"),h(!1)}})};p((function(){var e,t,n,i,o,r,a,l,c,d,u,p;if(v){var m=(null===(t=null===(e=null==v?void 0:v.currencies)||void 0===e?void 0:e.filter((function(e){var t;return"FIAT"===(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.type)&&"offramp"===(null==e?void 0:e.service)})))||void 0===t?void 0:t.map((function(e){var t,n;return{label:null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code,value:null==e?void 0:e.unique_id,icon:null===(n=null==e?void 0:e.supported_currency)||void 0===n?void 0:n.icon}})))||[];V(m);var g=(null==B?void 0:B.selectedFiat)?(null===(n=null==v?void 0:v.currencies)||void 0===n?void 0:n.find((function(e){var t;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null==B?void 0:B.selectedFiat)})))||(null===(i=null==v?void 0:v.currencies)||void 0===i?void 0:i.find((function(e){var t,n;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null===(n=null==m?void 0:m[0])||void 0===n?void 0:n.label)}))):null===(o=null==v?void 0:v.currencies)||void 0===o?void 0:o.find((function(e){var t,n;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null===(n=null==m?void 0:m[0])||void 0===n?void 0:n.label)})),b=B.selectedFiat&&m.find((function(e){return e.label===B.selectedFiat}))||(null==m?void 0:m[0]);X(b);var f=(null===(a=null===(r=null==v?void 0:v.currencies)||void 0===r?void 0:r.filter((function(e){var t;return"CRYPTO"===(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.type)&&"offramp"===(null==e?void 0:e.service)})))||void 0===a?void 0:a.map((function(e){var t,n;return{label:null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code,value:null==e?void 0:e.unique_id,icon:null===(n=null==e?void 0:e.supported_currency)||void 0===n?void 0:n.icon}})))||[];W(f);var h=(null===(c=null===(l=null==v?void 0:v.currencies)||void 0===l?void 0:l.filter((function(e){var t,n;return"CRYPTO"===(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.type)&&"offramp"===(null==e?void 0:e.service)&&!["USDT","USDC"].includes(null===(n=null==e?void 0:e.supported_currency)||void 0===n?void 0:n.code)})))||void 0===c?void 0:c.map((function(e){var t,n,i;return{label:null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code,value:null===(n=null==e?void 0:e.supported_currency)||void 0===n?void 0:n.code,icon:null===(i=null==e?void 0:e.supported_currency)||void 0===i?void 0:i.icon}})))||[];Y(h);var I=(null==s?void 0:s.from_currency)?(null===(d=null==v?void 0:v.currencies)||void 0===d?void 0:d.find((function(e){var t;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null==s?void 0:s.from_currency)})))||(null===(u=null==v?void 0:v.currencies)||void 0===u?void 0:u.find((function(e){var t,n;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null===(n=null==f?void 0:f[0])||void 0===n?void 0:n.label)}))):null===(p=null==v?void 0:v.currencies)||void 0===p?void 0:p.find((function(e){var t,n;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null===(n=null==f?void 0:f[0])||void 0===n?void 0:n.label)}));Q((null==s?void 0:s.from_currency)?f.find((function(e){return e.label===(null==s?void 0:s.from_currency)}))||(null==f?void 0:f[0]):(null==f?void 0:f[0])||[]),w((function(e){var t,n;return G(G({},e),{selectedCrypto:(null===(t=null==I?void 0:I.supported_currency)||void 0===t?void 0:t.code)||"",selectedFiat:(null===(n=null==g?void 0:g.supported_currency)||void 0===n?void 0:n.code)||""})}))}}),[v]),p((function(){var e,t;if(O&&v){var n=null===(e=null==O?void 0:O.rules)||void 0===e?void 0:e.find((function(e){return"offramp"===(null==e?void 0:e.service)}));n&&pe(n);var i=null===(t=null==O?void 0:O.commission)||void 0===t?void 0:t.find((function(e){return"offramp"==(null==e?void 0:e.service)}));j((null==i?void 0:i.commission)?parseFloat(null==i?void 0:i.commission):0),Ie({admin_commission:(null==i?void 0:i.admin_commission)?parseFloat(null==i?void 0:i.admin_commission):0,merchant_commission:(null==i?void 0:i.commission)?parseFloat(null==i?void 0:i.commission):0}),n&&w((function(e){var t,i,o,s,r,a;return G(G({},e),{minAmount:parseFloat(null===(t=null==n?void 0:n.schema)||void 0===t?void 0:t.min)<=0?"0.0000001":null===(o=parseFloat(null===(i=null==n?void 0:n.schema)||void 0===i?void 0:i.min))||void 0===o?void 0:o.toFixed(8),maxAmount:parseFloat(null===(s=null==n?void 0:n.schema)||void 0===s?void 0:s.max)<=0?"100000":null===(a=parseFloat(null===(r=null==n?void 0:n.schema)||void 0===r?void 0:r.max))||void 0===a?void 0:a.toFixed(8)})}))}}),[O,v]),p((function(){d&&R&&Z&&(ee(0),_e())}),[Z,R]),p((function(){d&&d.on("getSDKExchangeRate",(function(e){K(parseFloat(e)),ce(!1)}))}),[d]);var _e=function(){K(0),ce(!0),d.emit("fetchSDKExchangeRate",{pair:"".concat(null==R?void 0:R.label,"-").concat(null==Z?void 0:Z.label),user_id:"",type:"sell",apiKey:o,userId:r})};p((function(){be({min:parseFloat(B.from_amount)<parseFloat(B.minAmount)||""===B.from_amount||parseFloat(B.from_amount)<=0,max:parseFloat(B.from_amount)>parseFloat(B.maxAmount)})}),[$,B]),p((function(){var e,t,n;if(B){var i=P,o=se?null===(e=null==O?void 0:O.commission_ranges)||void 0===e?void 0:e.find((function(e){return parseFloat(e.from_amount)<=parseFloat(B.from_amount)*i&&parseFloat(e.to_amount)>=parseFloat(B.from_amount)*i&&e.currency===(null==R?void 0:R.label)&&"c-f"===e.type})):null,s=o?parseFloat(null==o?void 0:o.from_commission):0,r=o?parseFloat(null==o?void 0:o.to_commission):0,a=B.from_amount?parseFloat(B.from_amount):0,l=o?parseFloat(o.from_amount):0,c=o?parseFloat(o.to_amount):0,d=o?parseFloat(o.from_commission)-(s-r)/(c-l)*(a*i-l):0,u=((t=(null==he?void 0:he.admin_commission)+d,n=null==he?void 0:he.merchant_commission,100*(1-(1-t/100)*(1-n/100)))||0)/100*i;T(u||0);var p=parseFloat((i-u).toFixed(6));ee(p||0),ie(a*p)}}),[P,B,O]),p((function(){(null==E?void 0:E.length)>0&&["USDT","USDC"].includes(B.selectedCrypto)&&!B.network_type&&w((function(e){return G(G({},e),{network_type:E[0].value})}))}),[B,E]);return x.jsx(x.Fragment,{children:1===m?x.jsxs(x.Fragment,{children:[" ",x.jsxs("div",{className:_.offRampFieldCard,children:[x.jsxs("div",{className:_.offRampFieldBox,children:[x.jsx("div",{className:_.offRampFieldLabel,children:"You Pay"}),x.jsxs("div",{className:_.offRampFieldForm,children:[x.jsx("input",{type:"text",className:_.inputControl,value:B.from_amount,onChange:function(e){!function(e){var t,n;if(e.includes(".")){if(ue&&!function(e,t){if(!/^\d*\.?\d*$/.test(e))return!1;var n=e.split(".");return 2!==n.length||n[1].length<=t}(e,null===(t=null==ue?void 0:ue.schema)||void 0===t?void 0:t.decimal))return void c("You can input upto ".concat(null===(n=null==ue?void 0:ue.schema)||void 0===n?void 0:n.decimal," decimal places."),"error");""===e?w(G(G({},B),{from_amount:""})):isNaN(Number(e))||w(G(G({},B),{from_amount:e}))}else""===e?w(G(G({},B),{from_amount:""})):isNaN(Number(e))||w(G(G({},B),{from_amount:e}))}(e.target.value)}}),(null==ge?void 0:ge.min)&&x.jsxs("p",{className:_.errorMsg,children:["Invalid, Min : ",null===(t=parseFloat(null==B?void 0:B.minAmount))||void 0===t?void 0:t.toFixed(8)]}),(null==ge?void 0:ge.max)&&x.jsxs("p",{className:_.errorMsg,children:["Invalid, Max : ",null===(i=parseFloat(null==B?void 0:B.maxAmount))||void 0===i?void 0:i.toString()]})]})]}),x.jsxs("div",{className:_.offRampFieldSelectCard,children:[x.jsx("div",{className:"".concat(_.offRampFieldSelect),children:(null==N?void 0:N.length)>0?x.jsx(qi,{backgroundColor:"var(--primary-set-color)",colorvalue:"var(--off-white)",placeholder:"Select",svgFill:"var(--off-white)",image:!0,singleicons:!0,value:Z,isSearchable:!1,onChange:function(e){!function(e){var t,n,i=null===(t=null==v?void 0:v.currencies)||void 0===t?void 0:t.find((function(t){return t.unique_id===(null==e?void 0:e.value)}));w(G(G({},B),{selectedCrypto:(null===(n=null==i?void 0:i.supported_currency)||void 0===n?void 0:n.code)||""})),Q(e)}(e)},isDisabled:f,options:N}):x.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:x.jsx(ao,{})})}),(null==E?void 0:E.length)>0&&["USDT","USDC"].includes(B.selectedCrypto)&&x.jsx("div",{className:_.selected__two,children:x.jsx(qi,{backgroundColor:"var(--no-set-color)",colorvalue:"var(--primary-set-color)",placeholder:"Select",options:E,image:!0,singleicons:!0,isSearchable:!1,onChange:function(e){w(G(G({},B),{network_type:(null==e?void 0:e.value)||""}))},value:E.find((function(e){return e.value==B.network_type})),isDisabled:f})})]})]}),x.jsxs("div",{className:_.offRampInfoBox,children:[x.jsxs("div",{className:"".concat(_.offRampLabelCard," ").concat(_.offRampSpace),children:[x.jsx("div",{className:_.offRampLabelIcons,children:x.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",width:"12",height:"12",viewBox:"0 0 300 300",fill:"#fff",children:[x.jsx("path",{d:"M240.3 171.5H59.7c-11.9 0-21.5-9.6-21.5-21.5s9.6-21.5 21.5-21.5h180.6c11.9 0 21.5 9.6 21.5 21.5s-9.6 21.5-21.5 21.5","data-original":"#000000"}),x.jsx("circle",{cx:"150",cy:"65.5",r:"30.5","data-original":"#000000"}),x.jsx("circle",{cx:"150.5",cy:"234.5",r:"30.5","data-original":"#000000"})]})}),x.jsxs("div",{className:_.offRampLabelValue,children:[x.jsx("span",{style:{marginRight:10},children:"Rate :"}),le?x.jsx(ur,{}):"1 ".concat(B.selectedCrypto," = ").concat((null==$?void 0:$.toFixed(4))||0," ").concat(B.selectedFiat)]})]}),x.jsxs("div",{className:"".concat(_.offRampLabelTitles," ").concat(_.offRampSpaceTop),children:[x.jsx("div",{className:_.offRampLabelDots}),x.jsxs("div",{className:_.offRampDetails,children:[x.jsx("div",{className:_.offRampHead,children:"Withdrawal Method"}),x.jsx("div",{className:_.offPaymentBox,children:x.jsxs("div",{className:_.offPaymentCheckCard,children:[x.jsx("div",{children:"Bank Transfer"}),x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 408.576 408.576",children:x.jsx("g",{children:x.jsx("path",{d:"M204.288 0C91.648 0 0 91.648 0 204.288s91.648 204.288 204.288 204.288 204.288-91.648 204.288-204.288S316.928 0 204.288 0zm114.176 150.528-130.56 129.536c-7.68 7.68-19.968 8.192-28.16.512L90.624 217.6c-8.192-7.68-8.704-20.48-1.536-28.672 7.68-8.192 20.48-8.704 28.672-1.024l54.784 50.176L289.28 121.344c8.192-8.192 20.992-8.192 29.184 0s8.192 20.992 0 29.184z",fill:"#22BB33"})})})]})})]})]})]}),x.jsxs("div",{className:_.offRampFieldCard,children:[x.jsxs("div",{className:_.offRampFieldBox,children:[x.jsx("div",{className:_.offRampFieldLabel,children:"You Receive ( estimate )"}),x.jsx("div",{className:_.offRampFieldForm,children:le?x.jsx(ur,{size:20}):x.jsx("input",{type:"text",className:_.inputControl,value:(null==ge?void 0:ge.min)||(null==ge?void 0:ge.max)?0:Number(ne)&&Number(ne)>0?null==ne?void 0:ne.toFixed(4):0,disabled:!0})})]}),x.jsx("div",{className:_.offRampFieldSelectCard,children:x.jsx("div",{className:_.offRampFieldSelect,children:(null==D?void 0:D.length)>0?x.jsx(qi,{backgroundColor:"var(--primary-set-color)",colorvalue:"var(--off-white)",placeholder:"Select",borderColor:"var(--no-color)",svgFill:"var(--off-white)",image:!0,singleicons:!0,options:D,value:R,isSearchable:!1,onChange:function(e){!function(e){var t,n,i=null===(t=null==v?void 0:v.currencies)||void 0===t?void 0:t.find((function(t){return(null==t?void 0:t.unique_id)===(null==e?void 0:e.value)}));w(G(G({},B),{selectedFiat:(null===(n=null==i?void 0:i.supported_currency)||void 0===n?void 0:n.code)||""})),X(e)}(e)},isDisabled:f||le}):x.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:x.jsx(ao,{})})})})]}),x.jsxs("div",{style:{marginTop:20},className:_.off_info_card,children:[x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 32 32",children:x.jsxs("g",{id:"Layer_20","data-name":"Layer 20",children:[x.jsx("path",{fill:"#fbd63b",d:"M28 28H4L16 6z"}),x.jsx("path",{fill:"#f8be31",d:"m16 6 12 22H16z"}),x.jsx("path",{fill:"#333",d:"m16 21-2-7h4z"}),x.jsx("circle",{cx:"16",cy:"25",r:"1",fill:"#333"}),x.jsx("path",{d:"M16 14h2l-2 7zM16 24a1 1 0 0 1 0 2z"})]})}),x.jsx("div",{className:_.off_caution_info,children:"Cryptocurrencies are volatile, and prices can change rapidly, make sure to research and understand the market risks."})]}),x.jsx("div",{className:_.offRampAction,children:x.jsx("button",{className:"".concat(_.actionBtn," ").concat(_.primary),onClick:function(){parseFloat(B.from_amount)>0?(w(G(G({},B),{to_currency_conversion_value:ne,exchange_rate:$})),g(2)):c("Please enter valid amount","error")},disabled:f||!(P>0)||ge.min||ge.max,children:"Sell Now"})})]}):2===m?x.jsx(go,{defaultTab:"select",setStep:g,data:B,apiKey:o,clientReferenceID:r,setTokenSellData:w,mode:l}):3===m?x.jsx(Yo,{tokenSellData:B,setTokenSellData:w,apiKey:o,clientReferenceID:r,setStep:g,mode:l}):4===m?x.jsx($i,{tokenSellData:B}):null})},mr=function(e){var t=e.apiKey,n=e.sellParameters,i=e.clientReferenceID,o=e.mode;return x.jsx(pr,{apiKey:t,parameters:n,clientReferenceID:i,mode:o})},gr=function(e){var t=e.apiKey,n=e.sellParameters,i=e.clientReferenceID,o=e.mode,s=void 0===o?"development":o;return x.jsx("div",{style:{position:"relative"},className:_.widgetComponent,id:"widget-container",children:x.jsx(no,{children:x.jsx(mr,{sellParameters:n,apiKey:t,clientReferenceID:i,mode:s})})})};export{gr as SellCryptoWidget};
|
24
24
|
//# sourceMappingURL=index.mjs.map
|