"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2540],{48334:function(e,t,n){var i=n(25675),a=n.n(i),s=n(47771),l=n(5376),r=n(94184),c=n.n(r),o=n(67294),d=n(30185),u=n(85893);t.Z=function(e){var t,n=(0,d.Z)(),i=n.handleCopy,r=n.render,m=(0,o.useState)({icon:e.icon,name:e.name}),x=m[0],h=m[1],f=(0,o.useState)(!1),A=f[0],g=f[1],toggle=function(){g(!A)},onChange=function(t){h({icon:t.icon,name:t.name}),e.handleChange&&e.handleChange(t.name),toggle()};return(0,o.useEffect)(function(){h({icon:e.icon,name:e.name})},[e]),(0,u.jsxs)("div",{className:"relative w-full mb-7",children:[(0,u.jsx)("div",{className:c()("text-primary-1100 font-bold lg:text-base text-sm mb-1",{hidden:!e.label}),children:e.label}),(0,u.jsxs)("div",{className:"rounded px-5 xl:px-8 h-16 bg-secondary-400 outline-none flex items-center justify-between ".concat(e.bordered?"border border-[#ffffff20]":""),onClick:e.hasCopy?function(){}:toggle,children:[(0,u.jsxs)("div",{className:"flex items-center gap-4",children:[(0,u.jsx)(a(),{priority:!0,height:44,width:38,src:x.icon,alt:"icon",className:c()({hidden:!e.icon})}),(0,u.jsx)("div",{className:"text-white font-medium text-sm xl:text-lg",children:e.name})]}),e.hasCopy?(0,u.jsx)("div",{onClick:function(){return i(e.name)},className:"cursor-pointer pl-4",children:r}):(0,u.jsx)("div",{onClick:toggle,className:"cursor-pointer",children:(0,u.jsx)(l.Hd,{})})]}),A&&(0,u.jsx)(s.E.div,{initial:{opacity:0,scale:.5},animate:{opacity:1,scale:1},transition:{duration:.2},className:"absolute z-10 w-full bg-primary-800 p-4 rounded max-h-56 overflow-y-auto mt-2",children:null===(t=e.items)||void 0===t?void 0:t.map(function(e){return(0,u.jsxs)(s.E.div,{onClick:function(){return onChange(e)},transition:{duration:.2},className:"font-bold text-white hover:text-primary-100 flex items-center gap-4 text-base cursor-pointer p-2.5 rounded w-full hover:bg-primary-900",children:[e.icon&&(0,u.jsx)(a(),{priority:!0,height:44,width:38,src:e.icon,alt:"icon"}),(0,u.jsx)("div",{children:e.name})]},e.name)})})]})}},12540:function(e,t,n){n.d(t,{zx:function(){return a.ZP},h4:function(){return i.ZP},HY:function(){return swap}});var i=n(82032),a=n(75832),s=n(50029),l=n(87794),r=n.n(l),c=n(5376),o=n(25675),d=n.n(o),u=n(73625),m=n(68663),x=n(58323),h=n(53830),f=n(16147),A=n(86339),g={src:"/_next/static/media/success.9feb26f0.png",height:560,width:560,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAA3UlEQVR42mMAAZW17ZpAfFB1bccvIP1LZ13nQWWgGFhSEchQX9fxDoj/AwX/a63r/M+wuuk/UOE7tXUdmgwa6zoOiq5p/S+8pvWn6Ybu/wwrav93HVv/M3HHrP8MqxoPMgitaf3ltXnif28gZlhc8r/p8Or/M05vB5uiua7jF4MgUIH35kn/55/b83/iic3/Z53Z+Z9hZQPIiv9qIAUgBzGsbv5vtaHnJ0iB7No2EP4JdBNI0SEG6bVtmlpAR4IkQParAiWgku9UYT5RgvjkoP76zl8gY0E6gV4GSwIA02iH7aMmVlMAAAAASUVORK5CYII=",blurWidth:8,blurHeight:8},p={src:"/_next/static/media/failed.18365ef1.png",height:596,width:596,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAMAAADz0U65AAAAP1BMVEX0RDfzRDf0QjXzQjX0QjXzQjX0QjXzQjX0QjXzQjX0QjXzQjX0QjXzQjX0QjXzQjX0QjX0QjXzQjX0QzbzQzbxrAXwAAAAE3RSTlMAAAAAanN0dK+vsLDDw9ra2+zsFAWl/AAAAD9JREFUeNolxskRgDAMA0A5J0cccKT+a4WZ7GuRUN07MuwQqdNQ9a542DAUpQR9Z/1pmhGTHbgo8TZka8O7pQ9mKwLZ6O38EAAAAABJRU5ErkJggg==",blurWidth:8,blurHeight:8},j=n(67294),b=n(48334),N=n(87066),S=n(9473),v=n(8456),w=n(50881),E=n(32437),C=n(85893),U=[{icon:h.Z,name:"BUSD",ratio:1},{icon:m.Z,name:"USDT",ratio:1},{icon:A.Z,name:"IMX",ratio:2},{icon:x.Z,name:"USD",ratio:1},{icon:f.Z,name:"BITP",ratio:.06}],Z=[{icon:h.Z,name:"BUSD",ratio:1},{icon:m.Z,name:"USDT",ratio:1},{icon:A.Z,name:"IMX",ratio:2},{icon:x.Z,name:"USD",ratio:1},{icon:f.Z,name:"BITP",ratio:.06},{icon:u.Z,name:"Quest Credit",ratio:3}],swap=function(){var e=(0,j.useState)(0),t=e[0],n=e[1],next=function(e){void 0!==e?n(t-1):n(t+1)},i=[(0,C.jsx)(SwapCoin,{next:next}),(0,C.jsx)(Success,{next:next,isSuccessful:!0}),(0,C.jsx)(Success,{next:next,isSuccessful:!1}),(0,C.jsx)(SwapTransactions,{})];return(0,C.jsx)("div",{className:"w-full xl:px-3",children:i[t]})},SwapCoin=function(e){e.next;var t,n=(0,S.v9)(function(e){return e.auth}).currentUser,i=(0,j.useState)("BUSD"),a=i[0],l=i[1],o=(0,j.useState)("BUSD"),d=o[0],u=o[1],m=(0,j.useState)(),x=m[0],h=m[1],f=(0,j.useState)(),A=f[0],g=f[1],p=(0,j.useState)(0),y=p[0],T=p[1],R=(0,j.useState)(0),Q=R[0],k=R[1],D=(0,j.useState)(1),I=D[0],O=D[1];(0,j.useEffect)(function(){h(U.filter(function(e){return e.name===a})[0].icon),g(Z.filter(function(e){return e.name===d})[0].icon)},[a,d]),(0,j.useEffect)(function(){P()},[]),(0,j.useEffect)(function(){U[2].ratio=I,Z[2].ratio=I},[I]);var P=(t=(0,s.Z)(r().mark(function _callee(){return r().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:(0,E.e)().then(function(e){O(e)});case 1:case"end":return e.stop()}},_callee)})),function(){return t.apply(this,arguments)});(0,j.useEffect)(function(){k(y*U.filter(function(e){return e.name==a})[0].ratio/Z.filter(function(e){return e.name==d})[0].ratio)},[y,a]),(0,j.useEffect)(function(){var e=U.filter(function(e){return e.name==a})[0].ratio;T(Q*Z.filter(function(e){return e.name==d})[0].ratio/e)},[Q,d]);var onRefreshHandler=function(){T(0),k(0),l("BUSD"),u("BUSD")},onSwapButtonClicked=function(){if(a==d){w.Z.warning({message:"Warning!",description:"Please choose differnt coins to swap"});return}if(0==y){w.Z.warning({message:"Warning!",description:"Please input token amount"});return}if(y<0){w.Z.warning({message:"Warning!",description:"Invalid token amount"});return}var e={user:n.id,coinFrom:a,fromTokenAmount:y,coinTo:d,toTokenAmount:Q};N.default.post("".concat(v.M6,"/swap"),e).then(function(e){e.data.success?w.Z.success({message:"Success!",description:e.data.message}):w.Z.warning({message:"Warning!",description:e.data.message})})},onSwapInputValueHandler=function(){l(d),u(a),T(Q),k(y)};return(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{className:"lg:text-2xl text-xl font-bold text-primary-900",children:"SWAP"}),(0,C.jsxs)("div",{className:"relative",children:[(0,C.jsxs)("div",{className:"mt-4 flex justify-between items-center",children:[(0,C.jsx)("div",{className:"lg:text-lg text-base font-bold text-primary-450",children:"SWAP TOKENS IN AN INSTANT"}),(0,C.jsx)("div",{onClick:function(){return onRefreshHandler()},children:(0,C.jsx)(c.HY,{})})]}),(0,C.jsx)("div",{className:"absolute opacity-40 right-0 lg:-left-8 mt-5 lg:w-modal w-full thin-line bg-white"})]}),(0,C.jsxs)("div",{className:"mt-24 flex items-center justify-between gap-2",children:[(0,C.jsx)(b.Z,{name:a,icon:x||U.filter(function(e){return e.name===a})[0].icon,handleChange:function(e){l(e)},items:U,label:"SWAP FROM"},0),(0,C.jsx)("input",{type:"number",placeholder:"0.00",className:"bg-secondary-400 text-xl text-right px-4 h-12 lg:w-60 lg:h-14 placeholder:text-white placeholder:font-medium font-medium text-white rounded border-none outline-none",value:y,onChange:function(e){return T(Number(e.target.value))}})]}),(0,C.jsx)("div",{className:"flex justify-center items-center mt-14",children:(0,C.jsx)("div",{onClick:function(){return onSwapInputValueHandler()},children:(0,C.jsx)(c.Td,{})})}),(0,C.jsxs)("div",{className:"mt-14 flex items-center justify-between gap-2",children:[(0,C.jsx)(b.Z,{name:d,icon:A||Z.filter(function(e){return e.name===d})[0].icon,handleChange:function(e){u(e)},items:Z,label:"SWAP TO"},0),(0,C.jsx)("input",{type:"number",placeholder:"0.00",className:"bg-secondary-400 text-xl text-right px-4 h-12 lg:w-60 lg:h-14 placeholder:text-white placeholder:font-medium font-medium text-white rounded border-none outline-none",value:Q,onChange:function(e){return k(Number(e.target.value))}})]}),(0,C.jsx)("button",{onClick:function(){return onSwapButtonClicked()},className:"mt-14 bg-secondary-300 text-white w-full rounded font-bold text-xl h-14",children:"SWAP"})]})},Success=function(e){var t=e.next,n=e.isSuccessful;return(0,C.jsxs)("div",{className:"flex flex-col justify-center items-center",children:[(0,C.jsxs)("div",{className:"lg:w-96 flex flex-col justify-center items-center",children:[(0,C.jsx)(d(),{className:"h-20 mt-10 w-20 lg:h-28 lg:w-28 object-contain",priority:!0,src:n?g:p,alt:"success"}),(0,C.jsx)("h3",{className:"text-primary-900 mt-10 font-bold text-3xl",children:n?"SWAP SUCCESSFUL":"SWAP UNSUCCESSFUL"}),(0,C.jsx)("p",{className:"mt-3 text-sm font-bold text-primary-450 text-center",children:"THE TRANSACTION HAS BEEN SUCCESSFULLY PROCESSED. THE TRANSFER MAY STILL BE IN PROCESS. PLEASE CHECK THE TRANSACTION RECORD LATER."}),(0,C.jsxs)("div",{className:"pb-7 gap-10 mt-3 flex justify-between px-5 items-center",children:[(0,C.jsxs)("div",{children:[(0,C.jsx)("p",{className:"mt-3 text-left text-sm font-bold text-primary-450",children:"FROM"}),(0,C.jsx)("p",{className:"text-white font-medium lg:text-xl text-base",children:"0.00 BUSD"})]}),(0,C.jsx)(c.Ni,{}),(0,C.jsxs)("div",{children:[(0,C.jsx)("p",{className:"mt-3 text-left text-sm font-bold text-primary-450",children:"TO"}),(0,C.jsx)("p",{className:"text-white font-medium lg:text-xl text-base",children:"0.00 USDT"})]})]}),(0,C.jsx)("div",{className:"opacity-40 w-full thin-line bg-white"})]}),(0,C.jsxs)("div",{className:"mt-16 flex justify-between gap-5",children:[(0,C.jsx)("button",{onClick:function(){return t(0)},className:" bg-secondary-300 px-5 lg:px-8 rounded font-bold text-base h-12",children:"BACK TO SWAP"}),(0,C.jsx)("button",{onClick:function(){return t()},className:" bg-primary-1150 whitespace-nowrap px-5 lg:px-8 rounded font-bold text-base h-12",children:"VIEW SWAP HISTORY"})]})]})},SwapTransactions=function(){return(0,C.jsxs)("div",{className:"pb-32",children:[(0,C.jsx)("div",{className:"lg:text-2xl text-xl font-bold text-primary-900",children:"SWAP TO QUEST CREDIT"}),(0,C.jsxs)("div",{className:"relative",children:[(0,C.jsxs)("div",{className:"mt-4 flex justify-between items-center",children:[(0,C.jsx)("div",{className:"lg:text-lg text-base font-bold text-primary-450",children:"RECENT TRANSACTION"}),(0,C.jsx)(c.HY,{})]}),(0,C.jsx)("div",{className:"absolute opacity-40 right-0 lg:-left-8 mt-5 lg:w-modal w-full thin-line bg-white"})]}),(0,C.jsxs)("div",{className:"mt-14 w-full",children:[(0,C.jsxs)("div",{className:"flex gap-7 items-center font-bold text-xs text-primary-1100",children:[(0,C.jsx)("div",{className:"hidden lg:block",children:"COIN"}),(0,C.jsx)("div",{children:"COIN NAME"}),(0,C.jsx)("div",{children:"AMOUNT"}),(0,C.jsx)(c.Ni,{}),(0,C.jsx)("div",{className:"hidden lg:block",children:"COIN"}),(0,C.jsx)("div",{children:"COIN NAME"}),(0,C.jsx)("div",{children:"AMOUNT"})]}),(0,C.jsxs)("div",{className:"grid grid-cols-5 lg:grid-cols-7 mt-5 items-center font-medium text-sm text-white",children:[(0,C.jsx)(d(),{className:"h-6 hidden lg:block w-7 lg:h-8 lg:w-9 object-contain",priority:!0,src:h.Z,alt:"coin"}),(0,C.jsx)("div",{children:"BUSD"}),(0,C.jsx)("div",{className:"ml-4 lg:ml-3",children:"20.00"}),(0,C.jsx)("div",{className:"ml-2.5 lg:ml-3.5",children:(0,C.jsx)(c.Ni,{})}),(0,C.jsx)(d(),{className:"h-6 hidden lg:block w-7 lg:-ml-3 lg:h-8 lg:w-9 object-contain",priority:!0,src:u.Z,alt:"quest credit"}),(0,C.jsx)("div",{children:"QUEST"}),(0,C.jsx)("div",{children:"2.00"})]})]})]})}},58323:function(e,t){t.Z={src:"/_next/static/media/paypal.481fc38e.png",height:277,width:239,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAICAYAAAA1BOUGAAAAtElEQVR42jVNPwtBcRQ98gXYZDNgkJGeTyAZjBZlZTYaGP0ZKJs3GV9mX4F6o2KQwWaSkkV+917Hq3fqdO45p+4BCDNLisjSOXlQF/SJuOio6ok6J9Pkiv5MbUNEPzxKADxgtKUW6T3mDnwVgihUZ0EmP7BUP7iAUJEjVC0qsy3/mpuGBv/WA/Gfgpq9zKQJbBqY3Osgvk66zN9Q1RqPA3fWZNmJ7qh75hXE4PZYVJ8shnH2A9gIh/n0s7WAAAAAAElFTkSuQmCC",blurWidth:7,blurHeight:8}},73625:function(e,t){t.Z={src:"/_next/static/media/qc.ec077b38.png",height:277,width:239,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAICAYAAAA1BOUGAAAAlklEQVR42jXMsQqCUBTG8QvRM7UELYFu1VRRZE01hHcPqjeIwNnRJ3DSTQcHuVffwMVdRHD3f0EP/Dh85+NeYca11Bx/VPhhNhbaIRRsj32Aj5J8olQdNtjCwQoXyl5IW0XS0nsOV5SQOFJmpowpCeqGFE/X1jt2br5t8MAZH6x59UJLqZdIEFDcESIlL8Q0hC9qvKfbADpKZazihXUYAAAAAElFTkSuQmCC",blurWidth:7,blurHeight:8}}}]);