text: (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{75637:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,{v:function(){return NFTManage}});var _Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(83789),_Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(30266),_Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(80318),_Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(809),_Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__),axios__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(9669),axios__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_1__),next_export_i18n__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(37039),react__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(67294),react_icons_fa__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(89583),recoil__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(2804),_atoms__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(63569),_utils__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(43196),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(85893),NFTManage=function NFTManage(_ref){var trade=_ref.trade,user=(0,recoil__WEBPACK_IMPORTED_MODULE_4__.sJ)(_atoms__WEBPACK_IMPORTED_MODULE_5__.KL),apiLink=(0,recoil__WEBPACK_IMPORTED_MODULE_4__.sJ)(_atoms__WEBPACK_IMPORTED_MODULE_5__.H3),prefix=(0,recoil__WEBPACK_IMPORTED_MODULE_4__.sJ)(_atoms__WEBPACK_IMPORTED_MODULE_5__.uo),_useRecoilState=(0,recoil__WEBPACK_IMPORTED_MODULE_4__.FV)(_atoms__WEBPACK_IMPORTED_MODULE_5__.D2),_useRecoilState2=(0,_Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_8__.Z)(_useRecoilState,2),_broadcasts=_useRecoilState2[0],setBroadcasts=_useRecoilState2[1],_useState=(0,react__WEBPACK_IMPORTED_MODULE_3__.useState)("=="),randomUID=_useState[0],setRandomUID=_useState[1],_useTranslation=(0,next_export_i18n__WEBPACK_IMPORTED_MODULE_2__.$G)(),t=_useTranslation.t,randomUIDGen=function(_){var e=Math.round(Math.random()*(_.max-(_.min||0))),t=(0,_utils__WEBPACK_IMPORTED_MODULE_6__.s3)(e);setRandomUID(t)};(0,react__WEBPACK_IMPORTED_MODULE_3__.useEffect)((function(){"fts"===trade.kind&&axios__WEBPACK_IMPORTED_MODULE_1___default().get("".concat(apiLink,"api/set/").concat(trade.set)).then((function(_){var e=_.data;setInterval((function(){randomUIDGen(e.set)}),1e3)}))}),[]),(0,react__WEBPACK_IMPORTED_MODULE_3__.useEffect)((function(){"fts"!==trade.kind&&axios__WEBPACK_IMPORTED_MODULE_1___default().get("https://ipfs.io/ipfs/".concat(trade.script,"?").concat(trade.uid)).then((function(_ref3){var data=_ref3.data,code="(//".concat(data,'\n)("').concat(trade.uid,'")'),SVG=eval(code);document.getElementById("".concat(trade.item,"-").concat(trade.from,"-").concat(trade.to)).innerHTML=SVG.HTML}))}),[]),(0,react__WEBPACK_IMPORTED_MODULE_3__.useEffect)((function(){"fts"===trade.kind&&axios__WEBPACK_IMPORTED_MODULE_1___default().get("https://ipfs.io/ipfs/".concat(trade.script,"?").concat(randomUID)).then((function(_ref4){var data=_ref4.data,code="(//".concat(data,'\n)("').concat(randomUID,'")'),SVG=eval(code);document.getElementById("".concat(trade.item,"-").concat(trade.from,"-").concat(trade.to))&&(document.getElementById("".concat(trade.item,"-").concat(trade.from,"-").concat(trade.to)).innerHTML=SVG.HTML)}))}),[randomUID]);var handleDecline=function(){var _=(0,_Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_9__.Z)(_Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark((function _(){return _Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap((function(_){for(;;)switch(_.prev=_.next){case 0:(0,_utils__WEBPACK_IMPORTED_MODULE_6__.Yi)(user.name,prefix,{set:trade.set,uid:trade.uid,kind:trade.kind,price:trade.price},"cancel").then((function(_){_&&_.success&&setBroadcasts((function(e){return[].concat((0,_Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_10__.Z)(e),[_])}))}));case 1:case"end":return _.stop()}}),_)})));return function(){return _.apply(this,arguments)}}();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div",{className:"rounded-xl border shadow-xl h-auto border-transparent bg-gray-700 text-white flex flex-col",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div",{className:"text-center text-xl py-2 rounded-t-xl bg-white text-black",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("h1",{children:trade.to})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div",{className:"w-full flex justify-center py-2",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div",{className:"relative",children:["fts"===trade.kind&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div",{className:"bg-gray-700 absolute top-0 w-full h-full bg-opacity-70 flex justify-center items-center",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(react_icons_fa__WEBPACK_IMPORTED_MODULE_11__.g_g,{size:60,color:"#fff"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div",{id:"".concat(trade.item,"-").concat(trade.from,"-").concat(trade.to),className:"w-40"})]})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div",{className:"text-center text-xl pb-2",children:"fts"!==trade.kind?trade.item:trade.set}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div",{className:"text-center text-md",children:[t("price"),": ",(trade.price/1e3).toFixed(2)," DLUX"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div",{className:"flex sm:justify-center pt-2 pb-4 gap-3",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("button",{onClick:handleDecline,className:"px-3 py-1 rounded-lg border-2 text-white bg-red-500 border-red-600 focus:outline-none focus:ring-2 focus:ring-red-700",children:t("cancel")})})]})}},51584:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,{q:function(){return NFTTradeCard}});var _Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(83789),_Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(30266),_Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(80318),_Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(809),_Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__),axios__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(9669),axios__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_1__),next_export_i18n__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(37039),react__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(67294),react_icons_fa__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(89583),recoil__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(2804),_atoms__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(63569),_utils__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(43196),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(85893),NFTTradeCard=function NFTTradeCard(_ref){var trade=_ref.trade,user=(0,recoil__WEBPACK_IMPORTED_MODULE_4__.sJ)(_atoms__WEBPACK_IMPORTED_MODULE_5__.KL),apiLink=(0,recoil__WEBPACK_IMPORTED_MODULE_4__.sJ)(_atoms__WEBPACK_IMPORTED_MODULE_5__.H3),prefix=(0,recoil__WEBPACK_IMPORTED_MODULE_4__.sJ)(_atoms__WEBPACK_IMPORTED_MODULE_5__.uo),_useRecoilState=(0,recoil__WEBPACK_IMPORTED_MODULE_4__.FV)(_atoms__WEBPACK_IMPORTED_MODULE_5__.D2),_useRecoilState2=(0,_Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_8__.Z)(_useRecoilState,2),_broadcasts=_useRecoilState2[0],setBroadcasts=_useRecoilState2[1],_useState=(0,react__WEBPACK_IMPORTED_MODULE_3__.useState)("=="),randomUID=_useState[0],setRandomUID=_useState[1],_useTranslation=(0,next_export_i18n__WEBPACK_IMPORTED_MODULE_2__.$G)(),t=_useTranslation.t,randomUIDGen=function(_){var e=Math.round(Math.random()*(_.max-(_.min||0))),t=(0,_utils__WEBPACK_IMPORTED_MODULE_6__.s3)(e);setRandomUID(t)};(0,react__WEBPACK_IMPORTED_MODULE_3__.useEffect)((function(){"fts"===trade.kind&&axios__WEBPACK_IMPORTED_MODULE_1___default().get("".concat(apiLink,"api/set/").concat(trade.set)).then((function(_){var e=_.data;setInterval((function(){randomUIDGen(e.set)}),1e3)}))}),[]),(0,react__WEBPACK_IMPORTED_MODULE_3__.useEffect)((function(){axios__WEBPACK_IMPORTED_MODULE_1___default().get("https://ipfs.io/ipfs/".concat(trade.script,"?").concat(randomUID)).then((function(_ref3){var data=_ref3.data,code="(//".concat(data,'\n)("').concat(randomUID,'")'),SVG=eval(code);document.getElementById("".concat(trade.item,"-").concat(trade.from,"-").concat(trade.to))&&(document.getElementById("".concat(trade.item,"-").concat(trade.from,"-").concat(trade.to)).innerHTML=SVG.HTML)}))}),[randomUID]),(0,react__WEBPACK_IMPORTED_MODULE_3__.useEffect)((function(){"fts"!==trade.kind&&axios__WEBPACK_IMPORTED_MODULE_1___default().get("https://ipfs.io/ipfs/".concat(trade.script,"?").concat(trade.uid)).then((function(_ref4){var data=_ref4.data,code="(//".concat(data,'\n)("').concat(trade.uid,'")'),SVG=eval(code);document.getElementById("".concat(trade.item,"-").concat(trade.from,"-").concat(trade.to)).innerHTML=SVG.HTML}))}),[]);var handleAccept=function(){var _=(0,_Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_9__.Z)(_Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark((function _(){return _Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap((function(_){for(;;)switch(_.prev=_.next){case 0:(0,_utils__WEBPACK_IMPORTED_MODULE_6__.Yi)(user.name,prefix,{set:trade.set,uid:trade.uid,kind:trade.kind,price:trade.price},"complete").then((function(_){_&&_.success&&setBroadcasts((function(e){return[].concat((0,_Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_10__.Z)(e),[_])}))}));case 1:case"end":return _.stop()}}),_)})));return function(){return _.apply(this,arguments)}}(),handleDecline=function(){var _=(0,_Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_9__.Z)(_Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark((function _(){return _Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap((function(_){for(;;)switch(_.prev=_.next){case 0:(0,_utils__WEBPACK_IMPORTED_MODULE_6__.Yi)(user.name,prefix,{set:trade.set,uid:trade.uid,kind:trade.kind,price:trade.price},"cancel").then((function(_){_&&_.success&&setBroadcasts((function(e){return[].concat((0,_Users_noclue_ps_Desktop_Programavimas_Workspaces_marketplace_node_modules_next_node_modules_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_10__.Z)(e),[_])}))}));case 1:case"end":return _.stop()}}),_)})));return function(){return _.apply(this,arguments)}}();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div",{className:"rounded-xl border shadow-xl h-auto border-transparent bg-gray-700 text-white flex flex-col",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div",{className:"text-center text-xl py-2 rounded-t-xl bg-black",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("h1",{children:trade.from})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div",{className:"w-full flex justify-center py-2",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div",{className:"relative",children:["fts"===trade.kind&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div",{className:"bg-gray-700 absolute top-0 w-full h-full bg-opacity-70 flex justify-center items-center",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(react_icons_fa__WEBPACK_IMPORTED_MODULE_11__.g_g,{size:60,color:"#fff"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div",{id:"".concat(trade.item,"-").concat(trade.from,"-").concat(trade.to),className:"w-40"})]})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div",{className:"text-center text-xl pb-2",children:"fts"!==trade.kind?trade.item:trade.set}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div",{className:"text-center text-md",children:[t("price"),": ",(trade.price/1e3).toFixed(2)," DLUX"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div",{className:"flex sm:justify-center pt-2 pb-4 gap-3",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("button",{onClick:handleAccept,className:"px-3 py-1 rounded-lg border-2 text-white bg-green-500 border-green-600 focus:outline-none focus:ring-2 focus:ring-green-700",children:t("continue")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("button",{onClick:handleDecline,className:"px-3 py-1 rounded-lg border-2 text-white bg-red-500 border-red-600 focus:outline-none focus:ring-2 focus:ring-red-700",children:t("cancel")})]})]})}},25837:function(_,e,t){"use strict";t.r(e);var r=t(67294),a=t(2804),s=t(63569),n=t(9669),o=t.n(n),c=t(51584),i=t(75637),u=t(37039),d=t(85893);e.default=function(){var _=(0,r.useState)(!0),e=_[0],t=_[1],n=(0,r.useState)(),l=n[0],E=n[1],m=(0,r.useState)(),D=m[0],p=m[1],P=(0,r.useState)(),M=P[0],O=P[1],f=(0,r.useState)(),x=f[0],U=f[1],k=(0,r.useState)(!0),T=k[0],b=k[1],W=(0,u.$G)().t,I=(0,a.sJ)(s.KL),C=(0,a.sJ)(s.eY),L=(0,a.sJ)(s.H3);return(0,r.useEffect)((function(){I&&o().get("".concat(L,"api/trades/nfts/").concat(I.name)).then((function(_){var e=_.data;E(e.result.filter((function(_){return _.from!==I.name}))),O(e.result.filter((function(_){return _.from===I.name})))})),I&&o().get("".concat(L,"api/trades/fts/").concat(I.name)).then((function(_){var e=_.data.result;p(e.filter((function(_){return _.from!==I.name}))),U(e.filter((function(_){return _.from===I.name})))}))}),[I,C]),(0,d.jsxs)("div",{className:"mx-10 my-4 text-white font-medium",children:[(0,d.jsx)("title",{children:W("trades")}),(0,d.jsxs)("div",{className:"flex gap-4 justify-center",children:[(0,d.jsxs)("div",{className:"flex justify-center",children:[(0,d.jsx)("button",{onClick:function(){return b(!0)},className:"p-2 ".concat(T&&"bg-gray-800"," rounded-l-full bg-gray-700 text-white transition-all"),children:W("respond")}),(0,d.jsx)("button",{onClick:function(){return b(!1)},className:"p-2 ".concat(!T&&"bg-gray-800"," rounded-r-full bg-gray-700 text-white transition-all"),children:W("manage")})]}),(0,d.jsxs)("div",{className:"flex justify-center",children:[(0,d.jsx)("button",{onClick:function(){return t(!0)},className:"p-2 ".concat(e&&"bg-gray-800"," rounded-l-full bg-gray-700 text-white transition-all"),children:"NFTs"}),(0,d.jsx)("button",{onClick:function(){return t(!1)},className:"p-2 ".concat(!e&&"bg-gray-800"," rounded-r-full bg-gray-700 text-white transition-all"),children:"FTs"})]})]}),(0,d.jsx)("h1",{className:"text-3xl",children:W("trades")}),(0,d.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-4 xl:grid-cols-5 gap-8 my-5",children:e?T?l&&l.map((function(_){return(0,d.jsx)(c.q,{trade:_},_.item)})):M&&M.map((function(_){return(0,d.jsx)(i.v,{trade:_},_.item)})):T?D&&D.map((function(_){return(0,d.jsx)(c.q,{trade:_},_.item)})):x&&x.map((function(_){return(0,d.jsx)(i.v,{trade:_},_.item)}))})]})}},59473:function(_,e,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/trades",function(){return t(25837)}])}},function(_){_.O(0,[774,888,179],(function(){return e=59473,_(_.s=e);var e}));var e=_.O();_N_E=e}]);