herald-exchange-onramp_offramp-widget 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@
20
20
  * @license qrcode.react
21
21
  * Copyright (c) Paul O'Shannessy
22
22
  * SPDX-License-Identifier: ISC
23
- */function wo(e,t=0){const n=[];return e.forEach((function(e,r){let o=null;e.forEach((function(i,s){if(!i&&null!==o)return n.push(`M${o+t} ${r+t}h${s-o}v1H${o+t}z`),void(o=null);if(s!==e.length-1)i&&null===o&&(o=s);else{if(!i)return;null===o?n.push(`M${s+t},${r+t} h1v1H${s+t}z`):n.push(`M${o+t},${r+t} h${s+1-o}v1H${o+t}z`)}}))})),n.join("")}function Go(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 Bo({value:t,level:n,minVersion:r,includeMargin:o,marginSize:i,imageSettings:s,size:a,boostLevel:l}){let c=e.useMemo((()=>{const e=(Array.isArray(t)?t:[t]).reduce(((e,t)=>(e.push(...bo.QrSegment.makeSegments(t)),e)),[]);return bo.QrCode.encodeSegments(e,go[n],r,void 0,void 0,l)}),[t,n,r,l]);const{cells:u,margin:d,numCells:f,calculatedImageSettings:p}=e.useMemo((()=>{let e=c.getModules();const t=function(e,t){return null!=t?Math.max(Math.floor(t),0):e?4:0}(o,i),n=e.length+2*t,r=function(e,t,n,r){if(null==r)return null;const o=e.length+2*n,i=Math.floor(.1*t),s=o/t,a=(r.width||i)*s,l=(r.height||i)*s,c=null==r.x?e.length/2-a/2:r.x*s,u=null==r.y?e.length/2-l/2:r.y*s,d=null==r.opacity?1:r.opacity;let f=null;if(r.excavate){let e=Math.floor(c),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(a+c-e),h:Math.ceil(l+u-t)}}return{x:c,y:u,h:l,w:a,excavation:f,opacity:d,crossOrigin:r.crossOrigin}}(e,a,t,s);return{cells:e,margin:t,numCells:n,calculatedImageSettings:r}}),[c,a,s,o,i]);return{qrcode:c,margin:d,cells:u,numCells:f,calculatedImageSettings:p}}var Ao=function(){try{(new Path2D).addPath(new Path2D)}catch(e){return!1}return!0}(),Fo=e.forwardRef((function(t,n){const r=t,{value:o,size:i=vo,level:s=_o,bgColor:a=yo,fgColor:l=Io,includeMargin:c=xo,minVersion:u=Co,boostLevel:d,marginSize:f,imageSettings:p}=r,h=mo(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:m}=h,b=mo(h,["style"]),g=null==p?void 0:p.src,v=e.useRef(null),_=e.useRef(null),y=e.useCallback((e=>{v.current=e,"function"==typeof n?n(e):n&&(n.current=e)}),[n]),[I,x]=e.useState(!1),{margin:C,cells:w,numCells:G,calculatedImageSettings:B}=Bo({value:o,level:s,minVersion:u,boostLevel:d,includeMargin:c,marginSize:f,imageSettings:p,size:i});e.useEffect((()=>{if(null!=v.current){const e=v.current,t=e.getContext("2d");if(!t)return;let n=w;const r=_.current,o=null!=B&&null!==r&&r.complete&&0!==r.naturalHeight&&0!==r.naturalWidth;o&&null!=B.excavation&&(n=Go(w,B.excavation));const s=window.devicePixelRatio||1;e.height=e.width=i*s;const c=i/G*s;t.scale(c,c),t.fillStyle=a,t.fillRect(0,0,G,G),t.fillStyle=l,Ao?t.fill(new Path2D(wo(n,C))):w.forEach((function(e,n){e.forEach((function(e,r){e&&t.fillRect(r+C,n+C,1,1)}))})),B&&(t.globalAlpha=B.opacity),o&&t.drawImage(r,B.x+C,B.y+C,B.w,B.h)}})),e.useEffect((()=>{x(!1)}),[g]);const A=ho({height:i,width:i},m);let F=null;return null!=g&&(F=e.createElement("img",{src:g,key:g,style:{display:"none"},onLoad:()=>{x(!0)},ref:_,crossOrigin:null==B?void 0:B.crossOrigin})),e.createElement(e.Fragment,null,e.createElement("canvas",ho({style:A,height:i,width:i,ref:y,role:"img"},b)),F)}));Fo.displayName="QRCodeCanvas";var No,Xo,Ro,Zo=e.forwardRef((function(t,n){const r=t,{value:o,size:i=vo,level:s=_o,bgColor:a=yo,fgColor:l=Io,includeMargin:c=xo,minVersion:u=Co,boostLevel:d,title:f,marginSize:p,imageSettings:h}=r,m=mo(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:b,cells:g,numCells:v,calculatedImageSettings:_}=Bo({value:o,level:s,minVersion:u,boostLevel:d,includeMargin:c,marginSize:p,imageSettings:h,size:i});let y=g,I=null;null!=h&&null!=_&&(null!=_.excavation&&(y=Go(g,_.excavation)),I=e.createElement("image",{href:h.src,height:_.h,width:_.w,x:_.x+b,y:_.y+b,preserveAspectRatio:"none",opacity:_.opacity,crossOrigin:_.crossOrigin}));const x=wo(y,b);return e.createElement("svg",ho({height:i,width:i,viewBox:`0 0 ${v} ${v}`,ref:n,role:"img"},m),!!f&&e.createElement("title",null,f),e.createElement("path",{fill:a,d:`M0,0 h${v}v${v}H0z`,shapeRendering:"crispEdges"}),e.createElement("path",{fill:l,d:x,shapeRendering:"crispEdges"}),I)}));function Qo(e){var t,n,r,o,i,s=e.mode,a=e.token;return"development"===s?(r={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={})[(i={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[i.MATIC]="https://api-amoy.polygonscan.com",t[i.BINANCE]="https://api-testnet.bscscan.com",t[i.SOLANA]="https://api.devnet.solana.com",t[i.POLYGON_AMOY]="https://api-amoy.polygonscan.com",t[i.NILE]="https://nile.trongrid.io",t[i.TRX]="https://api.shasta.trongrid.io",o=t):(r={BNB:56,ETH:1,BITCOIN:10001,AVAX:43113,MATIC:137,SOL:101,TRX:2},(n={})[(i={ETHEREUM:1,POLYGON:137,BINANCE:56,BITCOIN:10001,AVAX:43113,SOLANA:101,TRX:2}).ETHEREUM]="https://api.etherscan.io",n[i.MATIC]="https://api.polygonscan.com",n[i.BINANCE]="https://api.bscscan.com",n[i.SOLANA]="https://api.mainnet-beta.solana.com",n[i.POLYGON_AMOY]="https://api.polygonscan.com",n[i.TRX]="https://api.trongrid.io",o=n),o[r[a]]}Zo.displayName="QRCodeSVG","production"!=process.env.NODE_ENV?((No={})[(Ro={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",No[Ro.MATIC]="https://api-amoy.polygonscan.com",No[Ro.BINANCE]="https://api-testnet.bscscan.com",No[Ro.SOLANA]="https://api.devnet.solana.com",No[Ro.POLYGON_AMOY]="https://api-amoy.polygonscan.com",No[Ro.NILE]="https://nile.trongrid.io",No[Ro.TRX]="https://api.shasta.trongrid.io"):((Xo={})[(Ro={ETHEREUM:1,POLYGON:137,BINANCE:56,BITCOIN:10001,AVAX:43113,SOLANA:101,TRX:1}).ETHEREUM]="https://api.etherscan.io",Xo[Ro.MATIC]="https://api.polygonscan.com",Xo[Ro.BINANCE]="https://api.bscscan.com",Xo[Ro.SOLANA]="https://api.mainnet-beta.solana.com",Xo[Ro.POLYGON_AMOY]="https://api.polygonscan.com",Xo[Ro.TRX]="https://api.trongrid.io");var ko=function(t){var n,r,o=t.tokenSellData,i=t.setTokenSellData,s=t.apiKey,a=t.setStep,l=t.clientReferenceID,c=t.mode,u=zr().addToast,d=e.useState(!1),f=d[0],v=d[1],_=e.useState(!0),y=_[0],I=_[1],x=e.useState(!1),C=x[0];x[1];var w=e.useState(""),G=w[0],B=w[1],A=e.useState(!0),F=A[0],N=A[1],X=e.useState(!0),R=X[0],Z=X[1],Q=e.useState(!1),k=Q[0],L=Q[1],W=e.useState(null),E=W[0],V=W[1],U=e.useState(""),D=U[0],S=U[1],O=e.useState(!1),M=O[0],Y=O[1],j=e.useState(null),T=j[0],H=j[1],J=e.useRef(null),z=e.useRef(null),P=e.useState(o.network_type||""),K=P[0];P[1],e.useEffect((function(){window.scrollTo(0,0),ee()}),[]);var q=function(){te(m(m({},o),{transaction_hash:D}))};e.useEffect((function(){if(!y&&E){var e=E,t=["USDT","USDC"].includes(o.selectedCrypto)?o.network_type:o.selectedCrypto;$(e,t,o.selectedCrypto)}I(!1)}),[E,o]);var $=function(e,t,n){return b(void 0,void 0,void 0,(function(){var r,i,s;return g(this,(function(a){return r="TRX"===t?"tron":"SOL"===t?"solana":"ethereum",["TRX","SOL"].includes(t)||["USDC","USDT"].includes(n),i=o.from_amount.toString(),s="".concat(r,":").concat(e,"?amount=").concat(i,"&label=").concat(encodeURIComponent("HeraldExchangeSell")),B(s),[2]}))}))},ee=function(){return b(void 0,void 0,void 0,(function(){var e;return g(this,(function(t){return e=no(c),L(!0),Pr({url:"".concat(e,"/api/offramp/wallet_address"),headers:{"Content-Type":"application/json","X-API-KEY":s,"User-Id":l},onSuccess:function(e){var t,n,r;if(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.wallet_address){var i=(["USDT","USDC"].includes(o.selectedCrypto)?o.network_type:o.selectedCrypto).toLowerCase(),s=["eth","bnb","matic"].includes(i)?null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.wallet_address.evm:["evm","trx","sol"].includes(i)?null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.wallet_address[i]:"";V(s),L(!1)}},onError:function(){u("Error fetching exchange rate","error"),L(!1)}}),[2]}))}))},te=function(e){return b(void 0,void 0,void 0,(function(){var t,n,r;return g(this,(function(d){return Y(!0),t=no(c),(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===(r=o.exchange_rate)||void 0===r?void 0:r.toString()),n.append("transaction_hash",e.transaction_hash),n.append("bank_account",o.selectedBeneficiary),Pr({url:"".concat(t,"/api/offramp/transactions"),headers:{"X-API-KEY":s,"User-Id":l},method:"POST",body:n,onSuccess:function(e){(null==e?void 0:e.success)?(H({data:null==e?void 0:e.data}),v(!0),i(m(m({},o),{response:null==e?void 0:e.data})),Y(!1),u("".concat(null==e?void 0:e.message),"success"),a(4)):(u("".concat(null==e?void 0:e.message),"error"),v(!1),Y(!1))},onError:function(e){u(" ".concat(e),"error"),v(!1),Y(!1)}}),[2]}))}))};e.useEffect((function(){if(!y&&E&&F){var e=E,t=["USDT","USDC"].includes(o.selectedCrypto)?o.network_type:o.selectedCrypto,n=o.selectedCrypto,r=o.from_amount;if(e){var i=Date.now();J.current=setInterval((function(){["USDT","USDC"].includes(n)&&K?oe(K,e,i,r):ne(t,e,i,r)}),1e4)}}return I(!1),function(){J.current&&clearInterval(J.current)}}),[E,o,F]);var ne=function(e,t,n,r){return b(void 0,void 0,void 0,(function(){var o,i,s;return g(this,(function(a){switch(a.label){case 0:if(o="",i=Qo({mode:c,token:e}),"ETH"===e)o="".concat(i,"/api?module=account&action=txlist&address=").concat(t,"&startblock=0&endblock=99999999&sort=desc&apikey=").concat("B34RQKNPZUV8IM6866DQ58WCS2Q6SWAP8V");else if("BNB"===e)o="".concat(i,"/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(i,"/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,se()]:[2];o="".concat(i,"/v1/accounts/").concat(t,"/transactions?limit=10")}if(!R)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 s=a.sent(),re(s,t,e,n,r),[3,5];case 4:return a.sent(),[3,5];case 5:return[2]}}))}))},re=function(e,t,n,r,o){var i=[];"ETH"===n||"BNB"===n||"MATIC"===n?i=e.result:"TRX"===n?i=e.data:"SOL"===n&&(i=e.result),i.forEach((function(e){if(("TRX"==n?e.block_timestamp:1e3*e.timeStamp)>r){var t=e.hash||e.transactionHash||e.txID,i="TRX"==n?e.raw_data.contract[0].parameter.value.amount/1e6:e.value/1e18;o==i&&(z.current.value=t,S(t),N(!1))}}))},oe=function(e,t,n,r){return b(void 0,void 0,void 0,(function(){var o,i,s,a,l;return g(this,(function(u){switch(u.label){case 0:if(o="",i=Qo({mode:c,token:e}),s=function(e){var t,n,r=e.mode,o=e.token,i=e.networkType;return"development"===r?(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"===i?t[o]:n[i][o]||""}({mode:c,token:e,networkType:K}),["ETH","BNB","MATIC"].includes(K))a="ETH"==K?"B34RQKNPZUV8IM6866DQ58WCS2Q6SWAP8V":"BNB"==K?"876A7KYGBE2TVBBNY33I4GZPXE1Q4QH3QA":"KYV61TJQU5RDMTGY1D95J8R61HWCR9T7KT",o="".concat(i,"/api?module=account&action=tokentx&address=").concat(t,"&startblock=0&endblock=99999999&sort=desc&apikey=").concat(a);else{if("TRX"!==K)return"SOL"===K?[2,se()]:[2];o="".concat(i,"/v1/accounts/").concat(t,"/transactions/trc20")}u.label=1;case 1:return u.trys.push([1,4,,5]),[4,fetch(o)];case 2:return[4,u.sent().json()];case 3:return l=u.sent(),ie(l,t,e,n,s,r),[3,5];case 4:return u.sent(),[3,5];case 5:return[2]}}))}))},ie=function(e,t,n,r,o,i){(e.result||e.data||[]).forEach((function(e){if(("TRX"==K?e.block_timestamp:1e3*e.timeStamp)>r)if("TRX"==K){var t=e.hash||e.transaction_id||e.txID;parseFloat(e.value)/Math.pow(10,parseInt(e.token_info.decimals))==i&&(z.current.value=t,S(t),N(!1))}else if(o.toLowerCase()==e.contractAddress.toLowerCase()){t=e.hash||e.transactionHash||e.txID;parseFloat(e.value)/Math.pow(10,parseInt(e.tokenDecimal))==i&&(z.current.value=t,S(t),N(!1))}}))},se=function(){return b(void 0,void 0,void 0,(function(){return g(this,(function(e){return Z(!1),N(!1),[2]}))}))};return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:h.bank_head,children:[p.jsx("div",{style:{cursor:"pointer"},onClick:function(){return a(2)},children:p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",width:"18",height:"18",viewBox:"0 0 240.823 240.823",children:p.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"})})}),p.jsx("div",{className:h.bank_titles,children:"Sell Crypto"})]}),k?p.jsx(Kr,{}):E&&(null===(n=Object.keys(E))||void 0===n?void 0:n.length)>0?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:h.payment_details_wrap,children:p.jsxs("div",{className:h.sell_qr_payemnt_wrap,children:[p.jsxs("div",{className:h.sell_amt_details,children:[p.jsxs("div",{className:h.sell_amt_details_wrap,children:[p.jsxs("div",{className:h.sell_amt_pay,children:[p.jsx("span",{className:h.sell_pay_label,children:"You Pay "}),p.jsxs("span",{className:h.sell_pay_amt,children:[o.from_amount," ",o.selectedCrypto," ",["USDT","USDC"].includes(o.selectedCrypto)&&o.network_type?"(".concat(o.network_type,")"):""]})]}),p.jsxs("div",{className:h.sell_pay_amt,children:[p.jsx("span",{className:h.sell_pay_label,children:"You Get "}),p.jsxs("span",{className:h.sell_pay_amt,children:[null===(r=o.to_currency_conversion_value)||void 0===r?void 0:r.toFixed(4)," ",o.selectedFiat]})]})]}),p.jsx("div",{className:h.sell_estimated_info,children:p.jsxs("p",{children:[" ",p.jsx("span",{children:"Estimated Rate "})," ",p.jsxs("span",{children:["1 ",o.selectedCrypto," ="," ",isNaN(o.exchange_rate)?0:o.exchange_rate.toFixed(4)," ",o.selectedFiat]})]})})]}),p.jsx("div",{className:h.sell_payment_qr_box,children:p.jsx("div",{className:h.sell_payment_qr_frame,children:G?p.jsx(Fo,{value:G,size:128,bgColor:"#ffffff",fgColor:"#000000",level:"H"}):p.jsx(Kr,{})})})]})}),p.jsxs("form",{onSubmit:q,children:[p.jsxs("div",{className:h.sell_wallet_address_card,children:[C||E&&p.jsxs("div",{className:h.sell_wallet_data_card,children:[p.jsx("h6",{children:"Wallet Address"}),p.jsxs("div",{className:h.sell_wallet_code_card,children:[p.jsxs("div",{className:h.sell_wallet_code,children:[p.jsxs("span",{children:[" ",E]})," "]}),p.jsx("button",{className:"".concat(h.action_btn," ").concat(h.overlay," ").concat(h.item_center_column," ").concat(h.p_0),type:"button",onClick:function(){return b(void 0,void 0,void 0,(function(){return g(this,(function(e){switch(e.label){case 0:return[4,navigator.clipboard.writeText(E)];case 1:return e.sent(),u("Copied","success"),[2]}}))}))},children:p.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",children:[p.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),p.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"}),p.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"})]})})]})]}),p.jsxs("div",{className:h.sell_hash_box,children:[p.jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:p.jsxs("div",{className:h.sell_hash_label,children:["Transaction Hash ",p.jsx("span",{children:"*"})]})}),p.jsx("input",{className:h.sell_hash_fields,type:"text",placeholder:"Enter Transaction Hash",name:"transaction_hash",onChange:function(e){return S(e.target.value)},ref:z,disabled:R})]})]}),p.jsx("div",{className:h.efi_swap_action,children:F||M||f?p.jsx("div",{className:"mt-3",children:p.jsx(ao,{props:T,monitoring:F})}):p.jsx("button",{className:"".concat(h.action_btn," ").concat(h.primary," "),onClick:function(e){e.preventDefault(),q()},disabled:!D||M,children:M?p.jsx(qr,{}):"Submit"})})]})]}):p.jsx(p.Fragment,{children:p.jsxs("div",{className:h.no_wallet_details,children:[p.jsx("p",{children:"No Wallet Details Found"}),p.jsx("div",{children:p.jsx("button",{className:"".concat(h.action_btn," ").concat(h.primary," "),onClick:function(){return ee()},children:"Retry"})})]})})]})};const Lo=Object.create(null);Lo.open="0",Lo.close="1",Lo.ping="2",Lo.pong="3",Lo.message="4",Lo.upgrade="5",Lo.noop="6";const Wo=Object.create(null);Object.keys(Lo).forEach((e=>{Wo[Lo[e]]=e}));const Eo={type:"error",data:"parser error"},Vo="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),Uo="function"==typeof ArrayBuffer,Do=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,So=({type:e,data:t},n,r)=>Vo&&t instanceof Blob?n?r(t):Oo(t,r):Uo&&(t instanceof ArrayBuffer||Do(t))?n?r(t):Oo(new Blob([t]),r):r(Lo[e]+(t||"")),Oo=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function Mo(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Yo;const jo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",To="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)To[jo.charCodeAt(e)]=e;const Ho="function"==typeof ArrayBuffer,Jo=(e,t)=>{if("string"!=typeof e)return{type:"message",data:Po(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:zo(e.substring(1),t)};return Wo[n]?e.length>1?{type:Wo[n],data:e.substring(1)}:{type:Wo[n]}:Eo},zo=(e,t)=>{if(Ho){const n=(e=>{let t,n,r,o,i,s=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);const c=new ArrayBuffer(s),u=new Uint8Array(c);for(t=0;t<a;t+=4)n=To[e.charCodeAt(t)],r=To[e.charCodeAt(t+1)],o=To[e.charCodeAt(t+2)],i=To[e.charCodeAt(t+3)],u[l++]=n<<2|r>>4,u[l++]=(15&r)<<4|o>>2,u[l++]=(3&o)<<6|63&i;return c})(e);return Po(n,t)}return{base64:!0,data:e}},Po=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,Ko=String.fromCharCode(30);function qo(){return new TransformStream({transform(e,t){!function(e,t){Vo&&e.data instanceof Blob?e.data.arrayBuffer().then(Mo).then(t):Uo&&(e.data instanceof ArrayBuffer||Do(e.data))?t(Mo(e.data)):So(e,!1,(e=>{Yo||(Yo=new TextEncoder),t(Yo.encode(e))}))}(e,(n=>{const r=n.length;let o;if(r<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,r);else if(r<65536){o=new Uint8Array(3);const e=new DataView(o.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{o=new Uint8Array(9);const e=new DataView(o.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(o[0]|=128),t.enqueue(o),t.enqueue(n)}))}})}let $o;function ei(e){return e.reduce(((e,t)=>e+t.length),0)}function ti(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let o=0;o<t;o++)n[o]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function ni(e){if(e)return function(e){for(var t in ni.prototype)e[t]=ni.prototype[t];return e}(e)}ni.prototype.on=ni.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},ni.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},ni.prototype.off=ni.prototype.removeListener=ni.prototype.removeAllListeners=ni.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<r.length;o++)if((n=r[o])===t||n.fn===t){r.splice(o,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},ni.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,t)}return this},ni.prototype.emitReserved=ni.prototype.emit,ni.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},ni.prototype.hasListeners=function(e){return!!this.listeners(e).length};const ri="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),oi="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function ii(e,...t){return t.reduce(((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t)),{})}const si=oi.setTimeout,ai=oi.clearTimeout;function li(e,t){t.useNativeTimers?(e.setTimeoutFn=si.bind(oi),e.clearTimeoutFn=ai.bind(oi)):(e.setTimeoutFn=oi.setTimeout.bind(oi),e.clearTimeoutFn=oi.clearTimeout.bind(oi))}function ci(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class ui extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class di extends ni{constructor(e){super(),this.writable=!1,li(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 ui(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=Jo(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 fi extends di{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(Ko),r=[];for(let e=0;e<n.length;e++){const o=Jo(n[e],t);if(r.push(o),"error"===o.type)break}return r})(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,r=new Array(n);let o=0;e.forEach(((e,i)=>{So(e,!1,(e=>{r[i]=e,++o===n&&t(r.join(Ko))}))}))})(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]=ci()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let pi=!1;try{pi="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}const hi=pi;function mi(){}class bi extends fi{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 gi extends ni{constructor(e,t,n){super(),this.createRequest=e,li(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=ii(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=gi.requestsCount++,gi.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=mi,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete gi.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(gi.requestsCount=0,gi.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",vi);else if("function"==typeof addEventListener){addEventListener("onpagehide"in oi?"pagehide":"unload",vi,!1)}function vi(){for(let e in gi.requests)gi.requests.hasOwnProperty(e)&&gi.requests[e].abort()}const _i=function(){const e=yi({xdomain:!1});return e&&null!==e.responseType}();function yi(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||hi))return new XMLHttpRequest}catch(e){}if(!t)try{return new(oi[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const Ii="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class xi extends di{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=Ii?{}:ii(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],r=t===e.length-1;So(n,this.supportsBinary,(e=>{try{this.doWrite(n,e)}catch(e){}r&&ri((()=>{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]=ci()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Ci=oi.WebSocket||oi.MozWebSocket;const wi={websocket:class extends xi{createSocket(e,t,n){return Ii?new Ci(e,t,n):t?new Ci(e,t):new Ci(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends di{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){$o||($o=new TextDecoder);const n=[];let r=0,o=-1,i=!1;return new TransformStream({transform(s,a){for(n.push(s);;){if(0===r){if(ei(n)<1)break;const e=ti(n,1);i=!(128&~e[0]),o=127&e[0],r=o<126?3:126===o?1:2}else if(1===r){if(ei(n)<2)break;const e=ti(n,2);o=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(ei(n)<8)break;const e=ti(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),i=t.getUint32(0);if(i>Math.pow(2,21)-1){a.enqueue(Eo);break}o=i*Math.pow(2,32)+t.getUint32(4),r=3}else{if(ei(n)<o)break;const e=ti(n,o);a.enqueue(Jo(i?e:$o.decode(e),t)),r=0}if(0===o||o>e){a.enqueue(Eo);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=qo();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const o=()=>{n.read().then((({done:e,value:t})=>{e||(this.onPacket(t),o())})).catch((e=>{}))};o();const i={type:"open"};this.query.sid&&(i.data=`{"sid":"${this.query.sid}"}`),this._writer.write(i).then((()=>this.onOpen()))}))}))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this._writer.write(n).then((()=>{r&&ri((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends bi{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=_i&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new gi(yi,this.uri(),e)}}},Gi=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Bi=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ai(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let o=Gi.exec(e||""),i={},s=14;for(;s--;)i[Bi[s]]=o[s]||"";return-1!=n&&-1!=r&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=function(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1);"/"==t.slice(-1)&&r.splice(r.length-1,1);return r}(0,i.path),i.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,r){t&&(n[t]=r)})),n}(0,i.query),i}const Fi="function"==typeof addEventListener&&"function"==typeof removeEventListener,Ni=[];Fi&&addEventListener("offline",(()=>{Ni.forEach((e=>e()))}),!1);class Xi extends ni{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=Ai(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=Ai(t.host).host);li(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,r=n.length;e<r;e++){let r=n[e].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}(this.opts.query)),Fi&&(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"})},Ni.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&&Xi.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",Xi.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 r=this.writeBuffer[n].data;if(r&&(e+="string"==typeof(t=r)?function(e){let t=0,n=0;for(let r=0,o=e.length;r<o;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,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,ri((()=>{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,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=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),r&&this.once("flush",r),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(Xi.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(),Fi&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=Ni.indexOf(this._offlineEventListener);-1!==e&&Ni.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}Xi.protocol=4;class Ri extends Xi{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;Xi.priorWebsocketSuccess=!1;const r=()=>{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;Xi.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 i=e=>{const n=new Error("probe error: "+e);n.transport=t.name,o(),this.emitReserved("upgradeError",n)};function s(){i("transport closed")}function a(){i("socket closed")}function l(e){t&&e.name!==t.name&&o()}const c=()=>{t.removeListener("open",r),t.removeListener("error",i),t.removeListener("close",s),this.off("close",a),this.off("upgrading",l)};t.once("open",r),t.once("error",i),t.once("close",s),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 Zi=class extends Ri{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=>wi[e])).filter((e=>!!e))),super(e,n)}};const Qi="function"==typeof ArrayBuffer,ki=Object.prototype.toString,Li="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===ki.call(Blob),Wi="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===ki.call(File);function Ei(e){return Qi&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||Li&&e instanceof Blob||Wi&&e instanceof File}function Vi(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(Vi(e[t]))return!0;return!1}if(Ei(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return Vi(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&Vi(e[t]))return!0;return!1}function Ui(e){const t=[],n=e.data,r=e;return r.data=Di(n,t),r.attachments=t.length,{packet:r,buffers:t}}function Di(e,t){if(!e)return e;if(Ei(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 r=0;r<e.length;r++)n[r]=Di(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=Di(e[r],t));return n}return e}function Si(e,t){return e.data=Oi(e.data,t),delete e.attachments,e}function Oi(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]=Oi(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Oi(e[n],t));return e}const Mi=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Yi;!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"}(Yi||(Yi={}));function ji(e){return"[object Object]"===Object.prototype.toString.call(e)}class Ti extends ni{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===Yi.BINARY_EVENT;n||t.type===Yi.BINARY_ACK?(t.type=n?Yi.EVENT:Yi.ACK,this.reconstructor=new Hi(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!Ei(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===Yi[n.type])throw new Error("unknown packet type "+n.type);if(n.type===Yi.BINARY_EVENT||n.type===Yi.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const o=e.substring(r,t);if(o!=Number(o)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(o)}if("/"===e.charAt(t+1)){const r=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=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(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!Ti.isPayloadValid(n.type,r))throw new Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case Yi.CONNECT:return ji(t);case Yi.DISCONNECT:return void 0===t;case Yi.CONNECT_ERROR:return"string"==typeof t||ji(t);case Yi.EVENT:case Yi.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Mi.indexOf(t[0]));case Yi.ACK:case Yi.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Hi{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=Si(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var Ji=Object.freeze({__proto__:null,Decoder:Ti,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==Yi.EVENT&&e.type!==Yi.ACK||!Vi(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Yi.EVENT?Yi.BINARY_EVENT:Yi.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==Yi.BINARY_EVENT&&e.type!==Yi.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=Ui(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return Yi},protocol:5});function zi(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Pi=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Ki extends ni{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=[zi(e,"open",this.onopen.bind(this)),zi(e,"packet",this.onpacket.bind(this)),zi(e,"error",this.onerror.bind(this)),zi(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,r,o;if(Pi.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 i={type:Yi.EVENT,data:t,options:{}};if(i.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),i.id=e}const s=null===(r=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===r?void 0:r.writable,a=this.connected&&!(null===(o=this.io.engine)||void 0===o?void 0:o._hasPingExpired());return this.flags.volatile&&!s||(a?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)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"))}),r),i=(...e)=>{this.io.clearTimeoutFn(o),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise(((n,r)=>{const o=(e,t)=>e?r(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,...r)=>{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,...r)),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:Yi.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 Yi.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 Yi.EVENT:case Yi.BINARY_EVENT:this.onevent(e);break;case Yi.ACK:case Yi.BINARY_ACK:this.onack(e);break;case Yi.DISCONNECT:this.ondisconnect();break;case Yi.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(...r){n||(n=!0,t.packet({type:Yi.ACK,id:e,data:r}))}}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:Yi.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 qi(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}qi.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)},qi.prototype.reset=function(){this.attempts=0},qi.prototype.setMin=function(e){this.ms=e},qi.prototype.setMax=function(e){this.max=e},qi.prototype.setJitter=function(e){this.jitter=e};class $i extends ni{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,li(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 qi({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||Ji;this.encoder=new r.Encoder,this.decoder=new r.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 Zi(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=zi(t,"open",(function(){n.onopen(),e&&e()})),o=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},i=zi(t,"error",o);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn((()=>{r(),o(new Error("timeout")),t.close()}),e);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}return this.subs.push(r),this.subs.push(i),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(zi(e,"ping",this.onping.bind(this)),zi(e,"data",this.ondata.bind(this)),zi(e,"error",this.onerror.bind(this)),zi(e,"close",this.onclose.bind(this)),zi(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){ri((()=>{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 Ki(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 es={};function ts(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=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),r=Ai(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+t,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,o=n.id,i=n.path,s=es[o]&&i in es[o].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||s?a=new $i(r,t):(es[o]||(es[o]=new $i(r,t)),a=es[o]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}Object.assign(ts,{Manager:$i,Socket:Ki,io:ts,connect:ts});var ns,rs=null,os=0,is=function(e){var t=e.size;return p.jsx("div",{style:{width:t||20},className:h.dot_loader})},ss=function(t){var n,r,o=t.apiKey,i=t.parameters,s=t.clientReferenceID,a=t.mode,l=zr().addToast,c=function(t){var n=t.onConnectCallback,r=t.onDisconnectCallback,o=e.useRef(null);return e.useEffect((function(){return os+=1,rs||(rs=ts("https://woowga-node.herald.exchange:9001/",{transports:["websocket"]})),o.current=rs,n&&rs.on("connect",n),r&&rs.on("disconnect",r),function(){n&&rs.off("connect",n),r&&rs.off("disconnect",r),0==(os-=1)&&rs&&(rs.disconnect(),rs=null)}}),[]),o.current}({}),u=e.useState(1),d=u[0],f=u[1],b=e.useState(!1),g=b[0],v=b[1],_=e.useState(null),y=_[0],I=_[1],x=e.useState({from_amount:(null==i?void 0:i.from_amount)&&parseFloat(null==i?void 0:i.from_amount)>0?i.from_amount:"0",selectedCrypto:(null==i?void 0:i.from_currency)||"",selectedFiat:(null==i?void 0:i.to_currency)||"",to_currency_conversion_value:0,exchange_rate:0,minAmount:"0.0000001",maxAmount:"100000.0000",network_type:"",selectedBeneficiary:""}),C=x[0],w=x[1],G=e.useState(null),B=G[0],A=G[1],F=e.useState(null),N=F[0],X=F[1],R=e.useState([]),Z=R[0],Q=R[1],k=e.useState([]),L=k[0],W=k[1],E=e.useState([]),V=E[0],U=E[1],D=e.useState(null),S=D[0],O=D[1],M=e.useState(0);M[0];var Y=M[1],j=e.useState(0);j[0];var T=j[1],H=e.useState(0),J=H[0],z=H[1],P=e.useState(0),K=P[0],q=P[1],$=e.useState(0),ee=$[0],te=$[1],ne=e.useState(!1),re=ne[0],oe=ne[1],ie=e.useState(!0),se=ie[0],ae=ie[1],le=e.useState(null),ce=le[0],ue=le[1],de=e.useState({min:!1,max:!1}),fe=de[0],pe=de[1],he=e.useState({admin_commission:0,merchant_commission:0}),me=he[0],be=he[1];e.useEffect((function(){_e(),ve(),ge()}),[]);var ge=function(){var e=no(a);Pr({url:"".concat(e,"/api/lookup/configurations"),headers:{"Content-Type":"application/json","X-API-KEY":o,"User-Id":s},onSuccess:function(e){var t,n;(null==e?void 0:e.success)&&oe(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(){l("Error fetching configuration","error")}})},ve=function(){var e=no(a);Pr({url:"".concat(e,"/api/lookup/commissions"),headers:{"Content-Type":"application/json","X-API-KEY":o,"User-Id":s},onSuccess:function(e){(null==e?void 0:e.success)&&O(null==e?void 0:e.data)},onError:function(){l("Error fetching comission","error")}})},_e=function(){var e=no(a);v(!0),Pr({url:"".concat(e,"/api/lookup/currencies"),headers:{"Content-Type":"application/json","X-API-KEY":o,"User-Id":s},onSuccess:function(e){(null==e?void 0:e.success)&&I(null==e?void 0:e.data),v(!1)},onError:function(){l("Error fetching currency","error"),v(!1)}})};e.useEffect((function(){var e,t,n,r,o,s,a,l,c,u,d,f;if(y){var p=(null===(t=null===(e=null==y?void 0:y.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}})))||[];W(p);var h=(null==C?void 0:C.selectedFiat)?(null===(n=null==y?void 0:y.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==C?void 0:C.selectedFiat)})))||(null===(r=null==y?void 0:y.currencies)||void 0===r?void 0:r.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==p?void 0:p[0])||void 0===n?void 0:n.label)}))):null===(o=null==y?void 0:y.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==p?void 0:p[0])||void 0===n?void 0:n.label)})),b=C.selectedFiat&&p.find((function(e){return e.label===C.selectedFiat}))||(null==p?void 0:p[0]);X(b);var g=(null===(a=null===(s=null==y?void 0:y.currencies)||void 0===s?void 0:s.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}})))||[];Q(g);var v=(null===(c=null===(l=null==y?void 0:y.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,r;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===(r=null==e?void 0:e.supported_currency)||void 0===r?void 0:r.icon}})))||[];U(v);var _=(null==i?void 0:i.from_currency)?(null===(u=null==y?void 0:y.currencies)||void 0===u?void 0:u.find((function(e){var t;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null==i?void 0:i.from_currency)})))||(null===(d=null==y?void 0:y.currencies)||void 0===d?void 0:d.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==g?void 0:g[0])||void 0===n?void 0:n.label)}))):null===(f=null==y?void 0:y.currencies)||void 0===f?void 0:f.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==g?void 0:g[0])||void 0===n?void 0:n.label)}));A((null==i?void 0:i.from_currency)?g.find((function(e){return e.label===(null==i?void 0:i.from_currency)}))||(null==g?void 0:g[0]):(null==g?void 0:g[0])||[]),w((function(e){var t,n;return m(m({},e),{selectedCrypto:(null===(t=null==_?void 0:_.supported_currency)||void 0===t?void 0:t.code)||"",selectedFiat:(null===(n=null==h?void 0:h.supported_currency)||void 0===n?void 0:n.code)||""})}))}}),[y]),e.useEffect((function(){var e,t;if(S&&y){var n=null===(e=null==S?void 0:S.rules)||void 0===e?void 0:e.find((function(e){return"offramp"===(null==e?void 0:e.service)}));n&&ue(n);var r=null===(t=null==S?void 0:S.commission)||void 0===t?void 0:t.find((function(e){return"offramp"==(null==e?void 0:e.service)}));T((null==r?void 0:r.commission)?parseFloat(null==r?void 0:r.commission):0),be({admin_commission:(null==r?void 0:r.admin_commission)?parseFloat(null==r?void 0:r.admin_commission):0,merchant_commission:(null==r?void 0:r.commission)?parseFloat(null==r?void 0:r.commission):0}),n&&w((function(e){var t,r,o,i,s,a;return m(m({},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===(r=null==n?void 0:n.schema)||void 0===r?void 0:r.min))||void 0===o?void 0:o.toFixed(8),maxAmount:parseFloat(null===(i=null==n?void 0:n.schema)||void 0===i?void 0:i.max)<=0?"100000":null===(a=parseFloat(null===(s=null==n?void 0:n.schema)||void 0===s?void 0:s.max))||void 0===a?void 0:a.toFixed(8)})}))}}),[S,y]),e.useEffect((function(){c&&N&&B&&(q(0),ye())}),[B,N]),e.useEffect((function(){c&&c.on("getSDKExchangeRate",(function(e){z(parseFloat(e)),ae(!1)}))}),[c]);var ye=function(){z(0),ae(!0),c.emit("fetchSDKExchangeRate",{pair:"".concat(null==N?void 0:N.label,"-").concat(null==B?void 0:B.label),user_id:"",type:"sell",apiKey:o,userId:s})};e.useEffect((function(){pe({min:parseFloat(C.from_amount)<parseFloat(C.minAmount)||""===C.from_amount||parseFloat(C.from_amount)<=0,max:parseFloat(C.from_amount)>parseFloat(C.maxAmount)})}),[K,C]),e.useEffect((function(){var e,t,n;if(C){var r=J,o=re?null===(e=null==S?void 0:S.commission_ranges)||void 0===e?void 0:e.find((function(e){return parseFloat(e.from_amount)<=parseFloat(C.from_amount)*r&&parseFloat(e.to_amount)>=parseFloat(C.from_amount)*r&&e.currency===(null==N?void 0:N.label)&&"c-f"===e.type})):null,i=o?parseFloat(null==o?void 0:o.from_commission):0,s=o?parseFloat(null==o?void 0:o.to_commission):0,a=C.from_amount?parseFloat(C.from_amount):0,l=o?parseFloat(o.from_amount):0,c=o?parseFloat(o.to_amount):0,u=o?parseFloat(o.from_commission)-(i-s)/(c-l)*(a*r-l):0,d=((t=(null==me?void 0:me.admin_commission)+u,n=null==me?void 0:me.merchant_commission,100*(1-(1-t/100)*(1-n/100)))||0)/100*r;Y(d||0);var f=parseFloat((r-d).toFixed(6));q(f||0),te(a*f)}}),[J,C,S]),e.useEffect((function(){(null==V?void 0:V.length)>0&&["USDT","USDC"].includes(C.selectedCrypto)&&!C.network_type&&w((function(e){return m(m({},e),{network_type:V[0].value})}))}),[C,V]);return p.jsx(p.Fragment,{children:1===d?p.jsxs(p.Fragment,{children:[" ",p.jsxs("div",{className:h.field_card,children:[p.jsxs("div",{className:h.field_box,children:[p.jsx("div",{className:h.field_label,children:"You Pay"}),p.jsx("div",{className:h.field_form,children:p.jsx("input",{type:"text",className:h.input_control,value:C.from_amount,onChange:function(e){!function(e){var t,n;if(e.includes(".")){if(ce&&!to(e,null===(t=null==ce?void 0:ce.schema)||void 0===t?void 0:t.decimal))return void l("You can input upto ".concat(null===(n=null==ce?void 0:ce.schema)||void 0===n?void 0:n.decimal," decimal places."),"error");""===e?w(m(m({},C),{from_amount:""})):isNaN(Number(e))||w(m(m({},C),{from_amount:e}))}else""===e?w(m(m({},C),{from_amount:""})):isNaN(Number(e))||w(m(m({},C),{from_amount:e}))}(e.target.value)}})})]}),p.jsxs("div",{className:h.field_select_card,children:[p.jsx("div",{className:h.field_select,children:(null==Z?void 0:Z.length)>0?p.jsx(Yr,{backgroundColor:"#f3e2c3",placeholder:"Select",image:!0,singleicons:!0,value:B,isSearchable:!1,onChange:function(e){!function(e){var t,n,r=null===(t=null==y?void 0:y.currencies)||void 0===t?void 0:t.find((function(t){return t.unique_id===(null==e?void 0:e.value)}));w(m(m({},C),{selectedCrypto:(null===(n=null==r?void 0:r.supported_currency)||void 0===n?void 0:n.code)||""})),A(e)}(e)},isDisabled:g,options:Z}):p.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:p.jsx($r,{})})}),(null==V?void 0:V.length)>0&&["USDT","USDC"].includes(C.selectedCrypto)&&p.jsx("div",{className:h.selected__two,children:p.jsx(Yr,{backgroundColor:"#fff",placeholder:"Select",options:V,image:!0,singleicons:!0,isSearchable:!1,onChange:function(e){w(m(m({},C),{network_type:(null==e?void 0:e.value)||""}))},value:V.find((function(e){return e.value==C.network_type})),isDisabled:g})})]})]}),(null==fe?void 0:fe.min)&&p.jsxs("p",{children:["Invalid, Min : ",null===(n=parseFloat(null==C?void 0:C.minAmount))||void 0===n?void 0:n.toFixed(8)]}),(null==fe?void 0:fe.max)&&p.jsxs("p",{children:["Invalid, Max : ",null===(r=parseFloat(null==C?void 0:C.maxAmount))||void 0===r?void 0:r.toString()]}),p.jsxs("div",{className:h.info_box,children:[p.jsxs("div",{className:"".concat(h.ramp_space," ").concat(h.label_card),children:[p.jsx("div",{className:h.label_icons,children:p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",width:"12",height:"12",viewBox:"0 0 300 300",children:[p.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"}),p.jsx("circle",{cx:"150",cy:"65.5",r:"30.5","data-original":"#000000"}),p.jsx("circle",{cx:"150.5",cy:"234.5",r:"30.5","data-original":"#000000"})]})}),p.jsxs("div",{className:h.label_value,children:[p.jsx("span",{style:{marginRight:10},children:"Rate :"}),se?p.jsx(is,{}):"1 ".concat(C.selectedCrypto," = ").concat((null==K?void 0:K.toFixed(4))||0," ").concat(C.selectedFiat)]})]}),p.jsxs("div",{className:"".concat(h.ramp_space_top," ").concat(h.label_titles),children:[p.jsx("div",{className:h.label_dots}),p.jsxs("div",{className:h.ramp_details,children:[p.jsx("div",{className:h.ramp_head,children:"Withdrawal Method"}),p.jsx("div",{className:h.payment_box,children:p.jsxs("div",{className:"".concat(h.payment_check_card," ").concat(h.selected),children:[p.jsx("input",{type:"radio",name:"radioDefault",id:"radioDefault1",value:"0.10234",className:h.input_control}),p.jsx("div",{children:"Bank Transfer"}),p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 408.576 408.576",children:p.jsx("g",{children:p.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:"#F9C201"})})})]})})]})]})]}),p.jsxs("div",{className:h.field_card,children:[p.jsxs("div",{className:"".concat(h.field_box_res," ").concat(h.field_box),children:[p.jsx("div",{className:h.field_label,children:"You Receive ( estimate )"}),p.jsx("div",{className:h.field_form,children:se?p.jsx(is,{size:20}):p.jsx("input",{type:"text",className:h.input_control,value:(null==fe?void 0:fe.min)||(null==fe?void 0:fe.max)?0:Number(ee)&&Number(ee)>0?null==ee?void 0:ee.toFixed(4):0,disabled:!0})})]}),p.jsx("div",{className:h.field_select_card,children:p.jsx("div",{className:h.field_select,children:(null==L?void 0:L.length)>0?p.jsx(Yr,{backgroundColor:"#f3e2c3",placeholder:"Select",borderColor:"var(--no-color)",image:!0,singleicons:!0,options:L,value:N,isSearchable:!1,onChange:function(e){!function(e){var t,n,r=null===(t=null==y?void 0:y.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(m(m({},C),{selectedFiat:(null===(n=null==r?void 0:r.supported_currency)||void 0===n?void 0:n.code)||""})),X(e)}(e)},isDisabled:g||se}):p.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:p.jsx($r,{})})})})]}),p.jsxs("div",{style:{marginTop:20},className:h.info_card,children:[p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 32 32",children:p.jsxs("g",{id:"Layer_20","data-name":"Layer 20",children:[p.jsx("path",{fill:"#fbd63b",d:"M28 28H4L16 6z"}),p.jsx("path",{fill:"#f8be31",d:"m16 6 12 22H16z"}),p.jsx("path",{fill:"#333",d:"m16 21-2-7h4z"}),p.jsx("circle",{cx:"16",cy:"25",r:"1",fill:"#333"}),p.jsx("path",{d:"M16 14h2l-2 7zM16 24a1 1 0 0 1 0 2z"})]})}),p.jsx("div",{className:h.caution_info,children:"Cryptocurrencies are volatile, and prices can change rapidly, make sure to research and understand the market risks."})]}),p.jsx("div",{className:h.ramp_action,children:p.jsx("button",{className:"".concat(h.action_btn," ").concat(h.primary," "),onClick:function(){parseFloat(C.from_amount)>0?(w(m(m({},C),{to_currency_conversion_value:ee,exchange_rate:K})),f(2)):l("Please enter valid amount","error")},disabled:g||!(J>0)||fe.min||fe.max,children:"Sell Now"})})]}):2===d?p.jsx(so,{defaultTab:"select",setStep:f,data:C,apiKey:o,clientReferenceID:s,setTokenSellData:w,mode:a}):3===d?p.jsx(ko,{tokenSellData:C,setTokenSellData:w,apiKey:o,clientReferenceID:s,setStep:f,mode:a}):4===d?p.jsx(jr,{tokenSellData:C}):null})},as={},ls={};var cs,us,ds={};
23
+ */function wo(e,t=0){const n=[];return e.forEach((function(e,r){let o=null;e.forEach((function(i,s){if(!i&&null!==o)return n.push(`M${o+t} ${r+t}h${s-o}v1H${o+t}z`),void(o=null);if(s!==e.length-1)i&&null===o&&(o=s);else{if(!i)return;null===o?n.push(`M${s+t},${r+t} h1v1H${s+t}z`):n.push(`M${o+t},${r+t} h${s+1-o}v1H${o+t}z`)}}))})),n.join("")}function Go(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 Bo({value:t,level:n,minVersion:r,includeMargin:o,marginSize:i,imageSettings:s,size:a,boostLevel:l}){let c=e.useMemo((()=>{const e=(Array.isArray(t)?t:[t]).reduce(((e,t)=>(e.push(...bo.QrSegment.makeSegments(t)),e)),[]);return bo.QrCode.encodeSegments(e,go[n],r,void 0,void 0,l)}),[t,n,r,l]);const{cells:u,margin:d,numCells:f,calculatedImageSettings:p}=e.useMemo((()=>{let e=c.getModules();const t=function(e,t){return null!=t?Math.max(Math.floor(t),0):e?4:0}(o,i),n=e.length+2*t,r=function(e,t,n,r){if(null==r)return null;const o=e.length+2*n,i=Math.floor(.1*t),s=o/t,a=(r.width||i)*s,l=(r.height||i)*s,c=null==r.x?e.length/2-a/2:r.x*s,u=null==r.y?e.length/2-l/2:r.y*s,d=null==r.opacity?1:r.opacity;let f=null;if(r.excavate){let e=Math.floor(c),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(a+c-e),h:Math.ceil(l+u-t)}}return{x:c,y:u,h:l,w:a,excavation:f,opacity:d,crossOrigin:r.crossOrigin}}(e,a,t,s);return{cells:e,margin:t,numCells:n,calculatedImageSettings:r}}),[c,a,s,o,i]);return{qrcode:c,margin:d,cells:u,numCells:f,calculatedImageSettings:p}}var Ao=function(){try{(new Path2D).addPath(new Path2D)}catch(e){return!1}return!0}(),Fo=e.forwardRef((function(t,n){const r=t,{value:o,size:i=vo,level:s=_o,bgColor:a=yo,fgColor:l=Io,includeMargin:c=xo,minVersion:u=Co,boostLevel:d,marginSize:f,imageSettings:p}=r,h=mo(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:m}=h,b=mo(h,["style"]),g=null==p?void 0:p.src,v=e.useRef(null),_=e.useRef(null),y=e.useCallback((e=>{v.current=e,"function"==typeof n?n(e):n&&(n.current=e)}),[n]),[I,x]=e.useState(!1),{margin:C,cells:w,numCells:G,calculatedImageSettings:B}=Bo({value:o,level:s,minVersion:u,boostLevel:d,includeMargin:c,marginSize:f,imageSettings:p,size:i});e.useEffect((()=>{if(null!=v.current){const e=v.current,t=e.getContext("2d");if(!t)return;let n=w;const r=_.current,o=null!=B&&null!==r&&r.complete&&0!==r.naturalHeight&&0!==r.naturalWidth;o&&null!=B.excavation&&(n=Go(w,B.excavation));const s=window.devicePixelRatio||1;e.height=e.width=i*s;const c=i/G*s;t.scale(c,c),t.fillStyle=a,t.fillRect(0,0,G,G),t.fillStyle=l,Ao?t.fill(new Path2D(wo(n,C))):w.forEach((function(e,n){e.forEach((function(e,r){e&&t.fillRect(r+C,n+C,1,1)}))})),B&&(t.globalAlpha=B.opacity),o&&t.drawImage(r,B.x+C,B.y+C,B.w,B.h)}})),e.useEffect((()=>{x(!1)}),[g]);const A=ho({height:i,width:i},m);let F=null;return null!=g&&(F=e.createElement("img",{src:g,key:g,style:{display:"none"},onLoad:()=>{x(!0)},ref:_,crossOrigin:null==B?void 0:B.crossOrigin})),e.createElement(e.Fragment,null,e.createElement("canvas",ho({style:A,height:i,width:i,ref:y,role:"img"},b)),F)}));Fo.displayName="QRCodeCanvas";var No,Xo,Ro,Zo=e.forwardRef((function(t,n){const r=t,{value:o,size:i=vo,level:s=_o,bgColor:a=yo,fgColor:l=Io,includeMargin:c=xo,minVersion:u=Co,boostLevel:d,title:f,marginSize:p,imageSettings:h}=r,m=mo(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:b,cells:g,numCells:v,calculatedImageSettings:_}=Bo({value:o,level:s,minVersion:u,boostLevel:d,includeMargin:c,marginSize:p,imageSettings:h,size:i});let y=g,I=null;null!=h&&null!=_&&(null!=_.excavation&&(y=Go(g,_.excavation)),I=e.createElement("image",{href:h.src,height:_.h,width:_.w,x:_.x+b,y:_.y+b,preserveAspectRatio:"none",opacity:_.opacity,crossOrigin:_.crossOrigin}));const x=wo(y,b);return e.createElement("svg",ho({height:i,width:i,viewBox:`0 0 ${v} ${v}`,ref:n,role:"img"},m),!!f&&e.createElement("title",null,f),e.createElement("path",{fill:a,d:`M0,0 h${v}v${v}H0z`,shapeRendering:"crispEdges"}),e.createElement("path",{fill:l,d:x,shapeRendering:"crispEdges"}),I)}));function Qo(e){var t,n,r,o,i,s=e.mode,a=e.token;return"development"===s?(r={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={})[(i={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[i.MATIC]="https://api-amoy.polygonscan.com",t[i.BINANCE]="https://api-testnet.bscscan.com",t[i.SOLANA]="https://api.devnet.solana.com",t[i.POLYGON_AMOY]="https://api-amoy.polygonscan.com",t[i.NILE]="https://nile.trongrid.io",t[i.TRX]="https://api.shasta.trongrid.io",o=t):(r={BNB:56,ETH:1,BITCOIN:10001,AVAX:43113,MATIC:137,SOL:101,TRX:2},(n={})[(i={ETHEREUM:1,POLYGON:137,BINANCE:56,BITCOIN:10001,AVAX:43113,SOLANA:101,TRX:2}).ETHEREUM]="https://api.etherscan.io",n[i.MATIC]="https://api.polygonscan.com",n[i.BINANCE]="https://api.bscscan.com",n[i.SOLANA]="https://api.mainnet-beta.solana.com",n[i.POLYGON_AMOY]="https://api.polygonscan.com",n[i.TRX]="https://api.trongrid.io",o=n),o[r[a]]}Zo.displayName="QRCodeSVG","production"!=process.env.NODE_ENV?((No={})[(Ro={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",No[Ro.MATIC]="https://api-amoy.polygonscan.com",No[Ro.BINANCE]="https://api-testnet.bscscan.com",No[Ro.SOLANA]="https://api.devnet.solana.com",No[Ro.POLYGON_AMOY]="https://api-amoy.polygonscan.com",No[Ro.NILE]="https://nile.trongrid.io",No[Ro.TRX]="https://api.shasta.trongrid.io"):((Xo={})[(Ro={ETHEREUM:1,POLYGON:137,BINANCE:56,BITCOIN:10001,AVAX:43113,SOLANA:101,TRX:1}).ETHEREUM]="https://api.etherscan.io",Xo[Ro.MATIC]="https://api.polygonscan.com",Xo[Ro.BINANCE]="https://api.bscscan.com",Xo[Ro.SOLANA]="https://api.mainnet-beta.solana.com",Xo[Ro.POLYGON_AMOY]="https://api.polygonscan.com",Xo[Ro.TRX]="https://api.trongrid.io");var ko=function(t){var n,r,o=t.tokenSellData,i=t.setTokenSellData,s=t.apiKey,a=t.setStep,l=t.clientReferenceID,c=t.mode,u=zr().addToast,d=e.useState(!1),f=d[0],v=d[1],_=e.useState(!0),y=_[0],I=_[1],x=e.useState(!1),C=x[0];x[1];var w=e.useState(""),G=w[0],B=w[1],A=e.useState(!0),F=A[0],N=A[1],X=e.useState(!0),R=X[0],Z=X[1],Q=e.useState(!1),k=Q[0],L=Q[1],W=e.useState(null),E=W[0],V=W[1],U=e.useState(""),D=U[0],S=U[1],O=e.useState(!1),M=O[0],Y=O[1],j=e.useState(null),T=j[0],H=j[1],J=e.useRef(null),z=e.useRef(null),P=e.useState(o.network_type||""),K=P[0];P[1],e.useEffect((function(){window.scrollTo(0,0),ee()}),[]);var q=function(){te(m(m({},o),{transaction_hash:D}))};e.useEffect((function(){if(!y&&E){var e=E,t=["USDT","USDC"].includes(o.selectedCrypto)?o.network_type:o.selectedCrypto;$(e,t,o.selectedCrypto)}I(!1)}),[E,o]);var $=function(e,t,n){return b(void 0,void 0,void 0,(function(){var r,i,s;return g(this,(function(a){return r="TRX"===t?"tron":"SOL"===t?"solana":"ethereum",["TRX","SOL"].includes(t)||["USDC","USDT"].includes(n),i=o.from_amount.toString(),s="".concat(r,":").concat(e,"?amount=").concat(i,"&label=").concat(encodeURIComponent("HeraldExchangeSell")),B(s),[2]}))}))},ee=function(){return b(void 0,void 0,void 0,(function(){var e;return g(this,(function(t){return e=no(c),L(!0),Pr({url:"".concat(e,"/api/offramp/wallet_address"),headers:{"Content-Type":"application/json","X-API-KEY":s,"User-Id":l},onSuccess:function(e){var t,n,r;if(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.wallet_address){var i=(["USDT","USDC"].includes(o.selectedCrypto)?o.network_type:o.selectedCrypto).toLowerCase(),s=["eth","bnb","matic"].includes(i)?null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.wallet_address.evm:["evm","trx","sol"].includes(i)?null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.wallet_address[i]:"";V(s),L(!1)}},onError:function(){u("Error fetching exchange rate","error"),L(!1)}}),[2]}))}))},te=function(e){return b(void 0,void 0,void 0,(function(){var t,n,r;return g(this,(function(d){return Y(!0),t=no(c),(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===(r=o.exchange_rate)||void 0===r?void 0:r.toString()),n.append("transaction_hash",e.transaction_hash),n.append("bank_account",o.selectedBeneficiary),Pr({url:"".concat(t,"/api/offramp/transactions"),headers:{"X-API-KEY":s,"User-Id":l},method:"POST",body:n,onSuccess:function(e){(null==e?void 0:e.success)?(H({data:null==e?void 0:e.data}),v(!0),i(m(m({},o),{response:null==e?void 0:e.data})),Y(!1),u("".concat(null==e?void 0:e.message),"success"),a(4)):(u("".concat(null==e?void 0:e.message),"error"),v(!1),Y(!1))},onError:function(e){u(" ".concat(e),"error"),v(!1),Y(!1)}}),[2]}))}))};e.useEffect((function(){if(!y&&E&&F){var e=E,t=["USDT","USDC"].includes(o.selectedCrypto)?o.network_type:o.selectedCrypto,n=o.selectedCrypto,r=o.from_amount;if(e){var i=Date.now();J.current=setInterval((function(){["USDT","USDC"].includes(n)&&K?oe({currency:n,token:K,walletAddress:e,startTimestamp:i,expected_amount:r}):ne(t,e,i,r)}),1e4)}}return I(!1),function(){J.current&&clearInterval(J.current)}}),[E,o,F]);var ne=function(e,t,n,r){return b(void 0,void 0,void 0,(function(){var o,i,s;return g(this,(function(a){switch(a.label){case 0:if(o="",i=Qo({mode:c,token:e}),"ETH"===e)o="".concat(i,"/api?module=account&action=txlist&address=").concat(t,"&startblock=0&endblock=99999999&sort=desc&apikey=").concat("B34RQKNPZUV8IM6866DQ58WCS2Q6SWAP8V");else if("BNB"===e)o="".concat(i,"/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(i,"/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,se()]:[2];o="".concat(i,"/v1/accounts/").concat(t,"/transactions?limit=10")}if(!R)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 s=a.sent(),re(s,t,e,n,r),[3,5];case 4:return a.sent(),[3,5];case 5:return[2]}}))}))},re=function(e,t,n,r,o){var i=[];"ETH"===n||"BNB"===n||"MATIC"===n?i=e.result:"TRX"===n?i=e.data:"SOL"===n&&(i=e.result),i.forEach((function(e){if(("TRX"==n?e.block_timestamp:1e3*e.timeStamp)>r){var t=e.hash||e.transactionHash||e.txID,i="TRX"==n?e.raw_data.contract[0].parameter.value.amount/1e6:e.value/1e18;o==i&&(z.current.value=t,S(t),N(!1))}}))},oe=function(e){return b(void 0,[e],void 0,(function(e){var t,n,r,o,i,s=e.currency,a=e.token,l=e.walletAddress,u=e.startTimestamp,d=e.expected_amount;return g(this,(function(e){switch(e.label){case 0:if(t="",n=Qo({mode:c,token:a}),r=function(e){var t,n,r=e.mode,o=e.token,i=e.networkType;return"development"===r?(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"===i?t[o]:n[i][o]||""}({mode:c,token:s,networkType:K}),["ETH","BNB","MATIC"].includes(K))o="ETH"==K?"B34RQKNPZUV8IM6866DQ58WCS2Q6SWAP8V":"BNB"==K?"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"!==K)return"SOL"===K?[2,se()]:[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 i=e.sent(),ie(i,l,a,u,r,d),[3,5];case 4:return e.sent(),[3,5];case 5:return[2]}}))}))},ie=function(e,t,n,r,o,i){(e.result||e.data||[]).forEach((function(e){if(("TRX"==K?e.block_timestamp:1e3*e.timeStamp)>r)if("TRX"==K){var t=e.hash||e.transaction_id||e.txID;parseFloat(e.value)/Math.pow(10,parseInt(e.token_info.decimals))==i&&(z.current.value=t,S(t),N(!1))}else if(o.toLowerCase()==e.contractAddress.toLowerCase()){t=e.hash||e.transactionHash||e.txID;parseFloat(e.value)/Math.pow(10,parseInt(e.tokenDecimal))==i&&(z.current.value=t,S(t),N(!1))}}))},se=function(){return b(void 0,void 0,void 0,(function(){return g(this,(function(e){return Z(!1),N(!1),[2]}))}))};return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:h.bank_head,children:[p.jsx("div",{style:{cursor:"pointer"},onClick:function(){return a(2)},children:p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",width:"18",height:"18",viewBox:"0 0 240.823 240.823",children:p.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"})})}),p.jsx("div",{className:h.bank_titles,children:"Sell Crypto"})]}),k?p.jsx(Kr,{}):E&&(null===(n=Object.keys(E))||void 0===n?void 0:n.length)>0?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:h.payment_details_wrap,children:p.jsxs("div",{className:h.sell_qr_payemnt_wrap,children:[p.jsxs("div",{className:h.sell_amt_details,children:[p.jsxs("div",{className:h.sell_amt_details_wrap,children:[p.jsxs("div",{className:h.sell_amt_pay,children:[p.jsx("span",{className:h.sell_pay_label,children:"You Pay "}),p.jsxs("span",{className:h.sell_pay_amt,children:[o.from_amount," ",o.selectedCrypto," ",["USDT","USDC"].includes(o.selectedCrypto)&&o.network_type?"(".concat(o.network_type,")"):""]})]}),p.jsxs("div",{className:h.sell_pay_amt,children:[p.jsx("span",{className:h.sell_pay_label,children:"You Get "}),p.jsxs("span",{className:h.sell_pay_amt,children:[null===(r=o.to_currency_conversion_value)||void 0===r?void 0:r.toFixed(4)," ",o.selectedFiat]})]})]}),p.jsx("div",{className:h.sell_estimated_info,children:p.jsxs("p",{children:[" ",p.jsx("span",{children:"Estimated Rate "})," ",p.jsxs("span",{children:["1 ",o.selectedCrypto," ="," ",isNaN(o.exchange_rate)?0:o.exchange_rate.toFixed(4)," ",o.selectedFiat]})]})})]}),p.jsx("div",{className:h.sell_payment_qr_box,children:p.jsx("div",{className:h.sell_payment_qr_frame,children:G?p.jsx(Fo,{value:G,size:128,bgColor:"#ffffff",fgColor:"#000000",level:"H"}):p.jsx(Kr,{})})})]})}),p.jsxs("form",{onSubmit:q,children:[p.jsxs("div",{className:h.sell_wallet_address_card,children:[C||E&&p.jsxs("div",{className:h.sell_wallet_data_card,children:[p.jsx("h6",{children:"Wallet Address"}),p.jsxs("div",{className:h.sell_wallet_code_card,children:[p.jsxs("div",{className:h.sell_wallet_code,children:[p.jsxs("span",{children:[" ",E]})," "]}),p.jsx("button",{className:"".concat(h.action_btn," ").concat(h.overlay," ").concat(h.item_center_column," ").concat(h.p_0),type:"button",onClick:function(){return b(void 0,void 0,void 0,(function(){return g(this,(function(e){switch(e.label){case 0:return[4,navigator.clipboard.writeText(E)];case 1:return e.sent(),u("Copied","success"),[2]}}))}))},children:p.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",children:[p.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),p.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"}),p.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"})]})})]})]}),p.jsxs("div",{className:h.sell_hash_box,children:[p.jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:p.jsxs("div",{className:h.sell_hash_label,children:["Transaction Hash ",p.jsx("span",{children:"*"})]})}),p.jsx("input",{className:h.sell_hash_fields,type:"text",placeholder:"Enter Transaction Hash",name:"transaction_hash",onChange:function(e){return S(e.target.value)},ref:z,disabled:R})]})]}),p.jsx("div",{className:h.efi_swap_action,children:F||M||f?p.jsx("div",{className:"mt-3",children:p.jsx(ao,{props:T,monitoring:F})}):p.jsx("button",{className:"".concat(h.action_btn," ").concat(h.primary," "),onClick:function(e){e.preventDefault(),q()},disabled:!D||M,children:M?p.jsx(qr,{}):"Submit"})})]})]}):p.jsx(p.Fragment,{children:p.jsxs("div",{className:h.no_wallet_details,children:[p.jsx("p",{children:"No Wallet Details Found"}),p.jsx("div",{children:p.jsx("button",{className:"".concat(h.action_btn," ").concat(h.primary," "),onClick:function(){return ee()},children:"Retry"})})]})})]})};const Lo=Object.create(null);Lo.open="0",Lo.close="1",Lo.ping="2",Lo.pong="3",Lo.message="4",Lo.upgrade="5",Lo.noop="6";const Wo=Object.create(null);Object.keys(Lo).forEach((e=>{Wo[Lo[e]]=e}));const Eo={type:"error",data:"parser error"},Vo="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),Uo="function"==typeof ArrayBuffer,Do=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,So=({type:e,data:t},n,r)=>Vo&&t instanceof Blob?n?r(t):Oo(t,r):Uo&&(t instanceof ArrayBuffer||Do(t))?n?r(t):Oo(new Blob([t]),r):r(Lo[e]+(t||"")),Oo=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function Mo(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Yo;const jo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",To="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)To[jo.charCodeAt(e)]=e;const Ho="function"==typeof ArrayBuffer,Jo=(e,t)=>{if("string"!=typeof e)return{type:"message",data:Po(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:zo(e.substring(1),t)};return Wo[n]?e.length>1?{type:Wo[n],data:e.substring(1)}:{type:Wo[n]}:Eo},zo=(e,t)=>{if(Ho){const n=(e=>{let t,n,r,o,i,s=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);const c=new ArrayBuffer(s),u=new Uint8Array(c);for(t=0;t<a;t+=4)n=To[e.charCodeAt(t)],r=To[e.charCodeAt(t+1)],o=To[e.charCodeAt(t+2)],i=To[e.charCodeAt(t+3)],u[l++]=n<<2|r>>4,u[l++]=(15&r)<<4|o>>2,u[l++]=(3&o)<<6|63&i;return c})(e);return Po(n,t)}return{base64:!0,data:e}},Po=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,Ko=String.fromCharCode(30);function qo(){return new TransformStream({transform(e,t){!function(e,t){Vo&&e.data instanceof Blob?e.data.arrayBuffer().then(Mo).then(t):Uo&&(e.data instanceof ArrayBuffer||Do(e.data))?t(Mo(e.data)):So(e,!1,(e=>{Yo||(Yo=new TextEncoder),t(Yo.encode(e))}))}(e,(n=>{const r=n.length;let o;if(r<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,r);else if(r<65536){o=new Uint8Array(3);const e=new DataView(o.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{o=new Uint8Array(9);const e=new DataView(o.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(o[0]|=128),t.enqueue(o),t.enqueue(n)}))}})}let $o;function ei(e){return e.reduce(((e,t)=>e+t.length),0)}function ti(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let o=0;o<t;o++)n[o]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function ni(e){if(e)return function(e){for(var t in ni.prototype)e[t]=ni.prototype[t];return e}(e)}ni.prototype.on=ni.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},ni.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},ni.prototype.off=ni.prototype.removeListener=ni.prototype.removeAllListeners=ni.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<r.length;o++)if((n=r[o])===t||n.fn===t){r.splice(o,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},ni.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,t)}return this},ni.prototype.emitReserved=ni.prototype.emit,ni.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},ni.prototype.hasListeners=function(e){return!!this.listeners(e).length};const ri="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),oi="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function ii(e,...t){return t.reduce(((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t)),{})}const si=oi.setTimeout,ai=oi.clearTimeout;function li(e,t){t.useNativeTimers?(e.setTimeoutFn=si.bind(oi),e.clearTimeoutFn=ai.bind(oi)):(e.setTimeoutFn=oi.setTimeout.bind(oi),e.clearTimeoutFn=oi.clearTimeout.bind(oi))}function ci(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class ui extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class di extends ni{constructor(e){super(),this.writable=!1,li(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 ui(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=Jo(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 fi extends di{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(Ko),r=[];for(let e=0;e<n.length;e++){const o=Jo(n[e],t);if(r.push(o),"error"===o.type)break}return r})(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,r=new Array(n);let o=0;e.forEach(((e,i)=>{So(e,!1,(e=>{r[i]=e,++o===n&&t(r.join(Ko))}))}))})(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]=ci()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let pi=!1;try{pi="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}const hi=pi;function mi(){}class bi extends fi{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 gi extends ni{constructor(e,t,n){super(),this.createRequest=e,li(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=ii(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=gi.requestsCount++,gi.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=mi,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete gi.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(gi.requestsCount=0,gi.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",vi);else if("function"==typeof addEventListener){addEventListener("onpagehide"in oi?"pagehide":"unload",vi,!1)}function vi(){for(let e in gi.requests)gi.requests.hasOwnProperty(e)&&gi.requests[e].abort()}const _i=function(){const e=yi({xdomain:!1});return e&&null!==e.responseType}();function yi(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||hi))return new XMLHttpRequest}catch(e){}if(!t)try{return new(oi[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const Ii="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class xi extends di{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=Ii?{}:ii(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],r=t===e.length-1;So(n,this.supportsBinary,(e=>{try{this.doWrite(n,e)}catch(e){}r&&ri((()=>{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]=ci()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Ci=oi.WebSocket||oi.MozWebSocket;const wi={websocket:class extends xi{createSocket(e,t,n){return Ii?new Ci(e,t,n):t?new Ci(e,t):new Ci(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends di{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){$o||($o=new TextDecoder);const n=[];let r=0,o=-1,i=!1;return new TransformStream({transform(s,a){for(n.push(s);;){if(0===r){if(ei(n)<1)break;const e=ti(n,1);i=!(128&~e[0]),o=127&e[0],r=o<126?3:126===o?1:2}else if(1===r){if(ei(n)<2)break;const e=ti(n,2);o=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(ei(n)<8)break;const e=ti(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),i=t.getUint32(0);if(i>Math.pow(2,21)-1){a.enqueue(Eo);break}o=i*Math.pow(2,32)+t.getUint32(4),r=3}else{if(ei(n)<o)break;const e=ti(n,o);a.enqueue(Jo(i?e:$o.decode(e),t)),r=0}if(0===o||o>e){a.enqueue(Eo);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=qo();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const o=()=>{n.read().then((({done:e,value:t})=>{e||(this.onPacket(t),o())})).catch((e=>{}))};o();const i={type:"open"};this.query.sid&&(i.data=`{"sid":"${this.query.sid}"}`),this._writer.write(i).then((()=>this.onOpen()))}))}))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this._writer.write(n).then((()=>{r&&ri((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends bi{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=_i&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new gi(yi,this.uri(),e)}}},Gi=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Bi=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ai(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let o=Gi.exec(e||""),i={},s=14;for(;s--;)i[Bi[s]]=o[s]||"";return-1!=n&&-1!=r&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=function(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1);"/"==t.slice(-1)&&r.splice(r.length-1,1);return r}(0,i.path),i.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,r){t&&(n[t]=r)})),n}(0,i.query),i}const Fi="function"==typeof addEventListener&&"function"==typeof removeEventListener,Ni=[];Fi&&addEventListener("offline",(()=>{Ni.forEach((e=>e()))}),!1);class Xi extends ni{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=Ai(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=Ai(t.host).host);li(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,r=n.length;e<r;e++){let r=n[e].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}(this.opts.query)),Fi&&(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"})},Ni.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&&Xi.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",Xi.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 r=this.writeBuffer[n].data;if(r&&(e+="string"==typeof(t=r)?function(e){let t=0,n=0;for(let r=0,o=e.length;r<o;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,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,ri((()=>{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,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=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),r&&this.once("flush",r),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(Xi.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(),Fi&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=Ni.indexOf(this._offlineEventListener);-1!==e&&Ni.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}Xi.protocol=4;class Ri extends Xi{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;Xi.priorWebsocketSuccess=!1;const r=()=>{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;Xi.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 i=e=>{const n=new Error("probe error: "+e);n.transport=t.name,o(),this.emitReserved("upgradeError",n)};function s(){i("transport closed")}function a(){i("socket closed")}function l(e){t&&e.name!==t.name&&o()}const c=()=>{t.removeListener("open",r),t.removeListener("error",i),t.removeListener("close",s),this.off("close",a),this.off("upgrading",l)};t.once("open",r),t.once("error",i),t.once("close",s),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 Zi=class extends Ri{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=>wi[e])).filter((e=>!!e))),super(e,n)}};const Qi="function"==typeof ArrayBuffer,ki=Object.prototype.toString,Li="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===ki.call(Blob),Wi="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===ki.call(File);function Ei(e){return Qi&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||Li&&e instanceof Blob||Wi&&e instanceof File}function Vi(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(Vi(e[t]))return!0;return!1}if(Ei(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return Vi(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&Vi(e[t]))return!0;return!1}function Ui(e){const t=[],n=e.data,r=e;return r.data=Di(n,t),r.attachments=t.length,{packet:r,buffers:t}}function Di(e,t){if(!e)return e;if(Ei(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 r=0;r<e.length;r++)n[r]=Di(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=Di(e[r],t));return n}return e}function Si(e,t){return e.data=Oi(e.data,t),delete e.attachments,e}function Oi(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]=Oi(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Oi(e[n],t));return e}const Mi=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Yi;!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"}(Yi||(Yi={}));function ji(e){return"[object Object]"===Object.prototype.toString.call(e)}class Ti extends ni{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===Yi.BINARY_EVENT;n||t.type===Yi.BINARY_ACK?(t.type=n?Yi.EVENT:Yi.ACK,this.reconstructor=new Hi(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!Ei(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===Yi[n.type])throw new Error("unknown packet type "+n.type);if(n.type===Yi.BINARY_EVENT||n.type===Yi.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const o=e.substring(r,t);if(o!=Number(o)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(o)}if("/"===e.charAt(t+1)){const r=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=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(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!Ti.isPayloadValid(n.type,r))throw new Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case Yi.CONNECT:return ji(t);case Yi.DISCONNECT:return void 0===t;case Yi.CONNECT_ERROR:return"string"==typeof t||ji(t);case Yi.EVENT:case Yi.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Mi.indexOf(t[0]));case Yi.ACK:case Yi.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Hi{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=Si(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var Ji=Object.freeze({__proto__:null,Decoder:Ti,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==Yi.EVENT&&e.type!==Yi.ACK||!Vi(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Yi.EVENT?Yi.BINARY_EVENT:Yi.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==Yi.BINARY_EVENT&&e.type!==Yi.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=Ui(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return Yi},protocol:5});function zi(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Pi=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Ki extends ni{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=[zi(e,"open",this.onopen.bind(this)),zi(e,"packet",this.onpacket.bind(this)),zi(e,"error",this.onerror.bind(this)),zi(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,r,o;if(Pi.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 i={type:Yi.EVENT,data:t,options:{}};if(i.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),i.id=e}const s=null===(r=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===r?void 0:r.writable,a=this.connected&&!(null===(o=this.io.engine)||void 0===o?void 0:o._hasPingExpired());return this.flags.volatile&&!s||(a?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)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"))}),r),i=(...e)=>{this.io.clearTimeoutFn(o),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise(((n,r)=>{const o=(e,t)=>e?r(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,...r)=>{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,...r)),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:Yi.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 Yi.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 Yi.EVENT:case Yi.BINARY_EVENT:this.onevent(e);break;case Yi.ACK:case Yi.BINARY_ACK:this.onack(e);break;case Yi.DISCONNECT:this.ondisconnect();break;case Yi.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(...r){n||(n=!0,t.packet({type:Yi.ACK,id:e,data:r}))}}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:Yi.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 qi(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}qi.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)},qi.prototype.reset=function(){this.attempts=0},qi.prototype.setMin=function(e){this.ms=e},qi.prototype.setMax=function(e){this.max=e},qi.prototype.setJitter=function(e){this.jitter=e};class $i extends ni{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,li(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 qi({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||Ji;this.encoder=new r.Encoder,this.decoder=new r.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 Zi(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=zi(t,"open",(function(){n.onopen(),e&&e()})),o=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},i=zi(t,"error",o);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn((()=>{r(),o(new Error("timeout")),t.close()}),e);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}return this.subs.push(r),this.subs.push(i),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(zi(e,"ping",this.onping.bind(this)),zi(e,"data",this.ondata.bind(this)),zi(e,"error",this.onerror.bind(this)),zi(e,"close",this.onclose.bind(this)),zi(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){ri((()=>{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 Ki(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 es={};function ts(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=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),r=Ai(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+t,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,o=n.id,i=n.path,s=es[o]&&i in es[o].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||s?a=new $i(r,t):(es[o]||(es[o]=new $i(r,t)),a=es[o]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}Object.assign(ts,{Manager:$i,Socket:Ki,io:ts,connect:ts});var ns,rs=null,os=0,is=function(e){var t=e.size;return p.jsx("div",{style:{width:t||20},className:h.dot_loader})},ss=function(t){var n,r,o=t.apiKey,i=t.parameters,s=t.clientReferenceID,a=t.mode,l=zr().addToast,c=function(t){var n=t.onConnectCallback,r=t.onDisconnectCallback,o=t.mode,i=e.useRef(null);return e.useEffect((function(){os+=1;var e=function(e){return"production"===e?"https://woowga-node.herald.exchange:9001/":"https://efi-exchange.blockstall.com:9001/"}(o);return rs||(rs=ts(e,{transports:["websocket"]})),i.current=rs,n&&rs.on("connect",n),r&&rs.on("disconnect",r),function(){n&&rs.off("connect",n),r&&rs.off("disconnect",r),0==(os-=1)&&rs&&(rs.disconnect(),rs=null)}}),[]),i.current}({mode:a}),u=e.useState(1),d=u[0],f=u[1],b=e.useState(!1),g=b[0],v=b[1],_=e.useState(null),y=_[0],I=_[1],x=e.useState({from_amount:(null==i?void 0:i.from_amount)&&parseFloat(null==i?void 0:i.from_amount)>0?i.from_amount:"0",selectedCrypto:(null==i?void 0:i.from_currency)||"",selectedFiat:(null==i?void 0:i.to_currency)||"",to_currency_conversion_value:0,exchange_rate:0,minAmount:"0.0000001",maxAmount:"100000.0000",network_type:"",selectedBeneficiary:""}),C=x[0],w=x[1],G=e.useState(null),B=G[0],A=G[1],F=e.useState(null),N=F[0],X=F[1],R=e.useState([]),Z=R[0],Q=R[1],k=e.useState([]),L=k[0],W=k[1],E=e.useState([]),V=E[0],U=E[1],D=e.useState(null),S=D[0],O=D[1],M=e.useState(0);M[0];var Y=M[1],j=e.useState(0);j[0];var T=j[1],H=e.useState(0),J=H[0],z=H[1],P=e.useState(0),K=P[0],q=P[1],$=e.useState(0),ee=$[0],te=$[1],ne=e.useState(!1),re=ne[0],oe=ne[1],ie=e.useState(!0),se=ie[0],ae=ie[1],le=e.useState(null),ce=le[0],ue=le[1],de=e.useState({min:!1,max:!1}),fe=de[0],pe=de[1],he=e.useState({admin_commission:0,merchant_commission:0}),me=he[0],be=he[1];e.useEffect((function(){_e(),ve(),ge()}),[]);var ge=function(){var e=no(a);Pr({url:"".concat(e,"/api/lookup/configurations"),headers:{"Content-Type":"application/json","X-API-KEY":o,"User-Id":s},onSuccess:function(e){var t,n;(null==e?void 0:e.success)&&oe(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(){l("Error fetching configuration","error")}})},ve=function(){var e=no(a);Pr({url:"".concat(e,"/api/lookup/commissions"),headers:{"Content-Type":"application/json","X-API-KEY":o,"User-Id":s},onSuccess:function(e){(null==e?void 0:e.success)&&O(null==e?void 0:e.data)},onError:function(){l("Error fetching comission","error")}})},_e=function(){var e=no(a);v(!0),Pr({url:"".concat(e,"/api/lookup/currencies"),headers:{"Content-Type":"application/json","X-API-KEY":o,"User-Id":s},onSuccess:function(e){(null==e?void 0:e.success)&&I(null==e?void 0:e.data),v(!1)},onError:function(){l("Error fetching currency","error"),v(!1)}})};e.useEffect((function(){var e,t,n,r,o,s,a,l,c,u,d,f;if(y){var p=(null===(t=null===(e=null==y?void 0:y.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}})))||[];W(p);var h=(null==C?void 0:C.selectedFiat)?(null===(n=null==y?void 0:y.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==C?void 0:C.selectedFiat)})))||(null===(r=null==y?void 0:y.currencies)||void 0===r?void 0:r.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==p?void 0:p[0])||void 0===n?void 0:n.label)}))):null===(o=null==y?void 0:y.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==p?void 0:p[0])||void 0===n?void 0:n.label)})),b=C.selectedFiat&&p.find((function(e){return e.label===C.selectedFiat}))||(null==p?void 0:p[0]);X(b);var g=(null===(a=null===(s=null==y?void 0:y.currencies)||void 0===s?void 0:s.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}})))||[];Q(g);var v=(null===(c=null===(l=null==y?void 0:y.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,r;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===(r=null==e?void 0:e.supported_currency)||void 0===r?void 0:r.icon}})))||[];U(v);var _=(null==i?void 0:i.from_currency)?(null===(u=null==y?void 0:y.currencies)||void 0===u?void 0:u.find((function(e){var t;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null==i?void 0:i.from_currency)})))||(null===(d=null==y?void 0:y.currencies)||void 0===d?void 0:d.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==g?void 0:g[0])||void 0===n?void 0:n.label)}))):null===(f=null==y?void 0:y.currencies)||void 0===f?void 0:f.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==g?void 0:g[0])||void 0===n?void 0:n.label)}));A((null==i?void 0:i.from_currency)?g.find((function(e){return e.label===(null==i?void 0:i.from_currency)}))||(null==g?void 0:g[0]):(null==g?void 0:g[0])||[]),w((function(e){var t,n;return m(m({},e),{selectedCrypto:(null===(t=null==_?void 0:_.supported_currency)||void 0===t?void 0:t.code)||"",selectedFiat:(null===(n=null==h?void 0:h.supported_currency)||void 0===n?void 0:n.code)||""})}))}}),[y]),e.useEffect((function(){var e,t;if(S&&y){var n=null===(e=null==S?void 0:S.rules)||void 0===e?void 0:e.find((function(e){return"offramp"===(null==e?void 0:e.service)}));n&&ue(n);var r=null===(t=null==S?void 0:S.commission)||void 0===t?void 0:t.find((function(e){return"offramp"==(null==e?void 0:e.service)}));T((null==r?void 0:r.commission)?parseFloat(null==r?void 0:r.commission):0),be({admin_commission:(null==r?void 0:r.admin_commission)?parseFloat(null==r?void 0:r.admin_commission):0,merchant_commission:(null==r?void 0:r.commission)?parseFloat(null==r?void 0:r.commission):0}),n&&w((function(e){var t,r,o,i,s,a;return m(m({},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===(r=null==n?void 0:n.schema)||void 0===r?void 0:r.min))||void 0===o?void 0:o.toFixed(8),maxAmount:parseFloat(null===(i=null==n?void 0:n.schema)||void 0===i?void 0:i.max)<=0?"100000":null===(a=parseFloat(null===(s=null==n?void 0:n.schema)||void 0===s?void 0:s.max))||void 0===a?void 0:a.toFixed(8)})}))}}),[S,y]),e.useEffect((function(){c&&N&&B&&(q(0),ye())}),[B,N]),e.useEffect((function(){c&&c.on("getSDKExchangeRate",(function(e){z(parseFloat(e)),ae(!1)}))}),[c]);var ye=function(){z(0),ae(!0),c.emit("fetchSDKExchangeRate",{pair:"".concat(null==N?void 0:N.label,"-").concat(null==B?void 0:B.label),user_id:"",type:"sell",apiKey:o,userId:s})};e.useEffect((function(){pe({min:parseFloat(C.from_amount)<parseFloat(C.minAmount)||""===C.from_amount||parseFloat(C.from_amount)<=0,max:parseFloat(C.from_amount)>parseFloat(C.maxAmount)})}),[K,C]),e.useEffect((function(){var e,t,n;if(C){var r=J,o=re?null===(e=null==S?void 0:S.commission_ranges)||void 0===e?void 0:e.find((function(e){return parseFloat(e.from_amount)<=parseFloat(C.from_amount)*r&&parseFloat(e.to_amount)>=parseFloat(C.from_amount)*r&&e.currency===(null==N?void 0:N.label)&&"c-f"===e.type})):null,i=o?parseFloat(null==o?void 0:o.from_commission):0,s=o?parseFloat(null==o?void 0:o.to_commission):0,a=C.from_amount?parseFloat(C.from_amount):0,l=o?parseFloat(o.from_amount):0,c=o?parseFloat(o.to_amount):0,u=o?parseFloat(o.from_commission)-(i-s)/(c-l)*(a*r-l):0,d=((t=(null==me?void 0:me.admin_commission)+u,n=null==me?void 0:me.merchant_commission,100*(1-(1-t/100)*(1-n/100)))||0)/100*r;Y(d||0);var f=parseFloat((r-d).toFixed(6));q(f||0),te(a*f)}}),[J,C,S]),e.useEffect((function(){(null==V?void 0:V.length)>0&&["USDT","USDC"].includes(C.selectedCrypto)&&!C.network_type&&w((function(e){return m(m({},e),{network_type:V[0].value})}))}),[C,V]);return p.jsx(p.Fragment,{children:1===d?p.jsxs(p.Fragment,{children:[" ",p.jsxs("div",{className:h.field_card,children:[p.jsxs("div",{className:h.field_box,children:[p.jsx("div",{className:h.field_label,children:"You Pay"}),p.jsx("div",{className:h.field_form,children:p.jsx("input",{type:"text",className:h.input_control,value:C.from_amount,onChange:function(e){!function(e){var t,n;if(e.includes(".")){if(ce&&!to(e,null===(t=null==ce?void 0:ce.schema)||void 0===t?void 0:t.decimal))return void l("You can input upto ".concat(null===(n=null==ce?void 0:ce.schema)||void 0===n?void 0:n.decimal," decimal places."),"error");""===e?w(m(m({},C),{from_amount:""})):isNaN(Number(e))||w(m(m({},C),{from_amount:e}))}else""===e?w(m(m({},C),{from_amount:""})):isNaN(Number(e))||w(m(m({},C),{from_amount:e}))}(e.target.value)}})})]}),p.jsxs("div",{className:h.field_select_card,children:[p.jsx("div",{className:h.field_select,children:(null==Z?void 0:Z.length)>0?p.jsx(Yr,{backgroundColor:"#f3e2c3",placeholder:"Select",image:!0,singleicons:!0,value:B,isSearchable:!1,onChange:function(e){!function(e){var t,n,r=null===(t=null==y?void 0:y.currencies)||void 0===t?void 0:t.find((function(t){return t.unique_id===(null==e?void 0:e.value)}));w(m(m({},C),{selectedCrypto:(null===(n=null==r?void 0:r.supported_currency)||void 0===n?void 0:n.code)||""})),A(e)}(e)},isDisabled:g,options:Z}):p.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:p.jsx($r,{})})}),(null==V?void 0:V.length)>0&&["USDT","USDC"].includes(C.selectedCrypto)&&p.jsx("div",{className:h.selected__two,children:p.jsx(Yr,{backgroundColor:"#fff",placeholder:"Select",options:V,image:!0,singleicons:!0,isSearchable:!1,onChange:function(e){w(m(m({},C),{network_type:(null==e?void 0:e.value)||""}))},value:V.find((function(e){return e.value==C.network_type})),isDisabled:g})})]})]}),(null==fe?void 0:fe.min)&&p.jsxs("p",{children:["Invalid, Min : ",null===(n=parseFloat(null==C?void 0:C.minAmount))||void 0===n?void 0:n.toFixed(8)]}),(null==fe?void 0:fe.max)&&p.jsxs("p",{children:["Invalid, Max : ",null===(r=parseFloat(null==C?void 0:C.maxAmount))||void 0===r?void 0:r.toString()]}),p.jsxs("div",{className:h.info_box,children:[p.jsxs("div",{className:"".concat(h.ramp_space," ").concat(h.label_card),children:[p.jsx("div",{className:h.label_icons,children:p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",width:"12",height:"12",viewBox:"0 0 300 300",children:[p.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"}),p.jsx("circle",{cx:"150",cy:"65.5",r:"30.5","data-original":"#000000"}),p.jsx("circle",{cx:"150.5",cy:"234.5",r:"30.5","data-original":"#000000"})]})}),p.jsxs("div",{className:h.label_value,children:[p.jsx("span",{style:{marginRight:10},children:"Rate :"}),se?p.jsx(is,{}):"1 ".concat(C.selectedCrypto," = ").concat((null==K?void 0:K.toFixed(4))||0," ").concat(C.selectedFiat)]})]}),p.jsxs("div",{className:"".concat(h.ramp_space_top," ").concat(h.label_titles),children:[p.jsx("div",{className:h.label_dots}),p.jsxs("div",{className:h.ramp_details,children:[p.jsx("div",{className:h.ramp_head,children:"Withdrawal Method"}),p.jsx("div",{className:h.payment_box,children:p.jsxs("div",{className:"".concat(h.payment_check_card," ").concat(h.selected),children:[p.jsx("input",{type:"radio",name:"radioDefault",id:"radioDefault1",value:"0.10234",className:h.input_control}),p.jsx("div",{children:"Bank Transfer"}),p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 408.576 408.576",children:p.jsx("g",{children:p.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:"#F9C201"})})})]})})]})]})]}),p.jsxs("div",{className:h.field_card,children:[p.jsxs("div",{className:"".concat(h.field_box_res," ").concat(h.field_box),children:[p.jsx("div",{className:h.field_label,children:"You Receive ( estimate )"}),p.jsx("div",{className:h.field_form,children:se?p.jsx(is,{size:20}):p.jsx("input",{type:"text",className:h.input_control,value:(null==fe?void 0:fe.min)||(null==fe?void 0:fe.max)?0:Number(ee)&&Number(ee)>0?null==ee?void 0:ee.toFixed(4):0,disabled:!0})})]}),p.jsx("div",{className:h.field_select_card,children:p.jsx("div",{className:h.field_select,children:(null==L?void 0:L.length)>0?p.jsx(Yr,{backgroundColor:"#f3e2c3",placeholder:"Select",borderColor:"var(--no-color)",image:!0,singleicons:!0,options:L,value:N,isSearchable:!1,onChange:function(e){!function(e){var t,n,r=null===(t=null==y?void 0:y.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(m(m({},C),{selectedFiat:(null===(n=null==r?void 0:r.supported_currency)||void 0===n?void 0:n.code)||""})),X(e)}(e)},isDisabled:g||se}):p.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:p.jsx($r,{})})})})]}),p.jsxs("div",{style:{marginTop:20},className:h.info_card,children:[p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 32 32",children:p.jsxs("g",{id:"Layer_20","data-name":"Layer 20",children:[p.jsx("path",{fill:"#fbd63b",d:"M28 28H4L16 6z"}),p.jsx("path",{fill:"#f8be31",d:"m16 6 12 22H16z"}),p.jsx("path",{fill:"#333",d:"m16 21-2-7h4z"}),p.jsx("circle",{cx:"16",cy:"25",r:"1",fill:"#333"}),p.jsx("path",{d:"M16 14h2l-2 7zM16 24a1 1 0 0 1 0 2z"})]})}),p.jsx("div",{className:h.caution_info,children:"Cryptocurrencies are volatile, and prices can change rapidly, make sure to research and understand the market risks."})]}),p.jsx("div",{className:h.ramp_action,children:p.jsx("button",{className:"".concat(h.action_btn," ").concat(h.primary," "),onClick:function(){parseFloat(C.from_amount)>0?(w(m(m({},C),{to_currency_conversion_value:ee,exchange_rate:K})),f(2)):l("Please enter valid amount","error")},disabled:g||!(J>0)||fe.min||fe.max,children:"Sell Now"})})]}):2===d?p.jsx(so,{defaultTab:"select",setStep:f,data:C,apiKey:o,clientReferenceID:s,setTokenSellData:w,mode:a}):3===d?p.jsx(ko,{tokenSellData:C,setTokenSellData:w,apiKey:o,clientReferenceID:s,setStep:f,mode:a}):4===d?p.jsx(jr,{tokenSellData:C}):null})},as={},ls={};var cs,us,ds={};
24
24
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */function fs(){return cs||(cs=1,ds.read=function(e,t,n,r,o){var i,s,a=8*o-r-1,l=(1<<a)-1,c=l>>1,u=-7,d=n?o-1:0,f=n?-1:1,p=e[t+d];for(d+=f,i=p&(1<<-u)-1,p>>=-u,u+=a;u>0;i=256*i+e[t+d],d+=f,u-=8);for(s=i&(1<<-u)-1,i>>=-u,u+=r;u>0;s=256*s+e[t+d],d+=f,u-=8);if(0===i)i=1-c;else{if(i===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),i-=c}return(p?-1:1)*s*Math.pow(2,i-r)},ds.write=function(e,t,n,r,o,i){var s,a,l,c=8*i-o-1,u=(1<<c)-1,d=u>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,h=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+d>=1?f/l:f*Math.pow(2,1-d))*l>=2&&(s++,l/=2),s+d>=u?(a=0,s=u):s+d>=1?(a=(t*l-1)*Math.pow(2,o),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,o),s=0));o>=8;e[n+p]=255&a,p+=h,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;e[n+p]=255&s,p+=h,s/=256,c-=8);e[n+p-h]|=128*m}),ds}
25
25
  /*!
26
26
  * The buffer module from node.js, for the browser.