(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[277],{"./components/Spinner.tsx":function(e,n,t){"use strict";t("../node_modules/react/index.js");var s=t("../node_modules/react/jsx-runtime.js");n.Z=function(){return(0,s.jsxs)("svg",{className:"inline-block h-4 w-4 animate-spin ",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:12,cy:12,r:10,stroke:"currentColor",strokeWidth:3}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}},"./components/Tooltip.tsx":function(e,n,t){"use strict";var s=t("../node_modules/@tippyjs/react/dist/tippy-react.esm.js"),r=(t("../node_modules/react/index.js"),t("../node_modules/tippy.js/animations/scale.css"),t("../node_modules/react/jsx-runtime.js")),o=function(e){var n=e.children,t=e.content,o=e.className,a=e.contentClassName,i=e.placement,l=void 0===i?"top":i;return t?(0,r.jsx)(s.ZP,{animation:"scale",placement:l,appendTo:function(){return document.body},maxWidth:"15rem",interactive:!0,content:(0,r.jsx)("div",{className:"rounded border border-darkGray3 bg-darkGray p-3 text-xs leading-snug text-lavenderGray shadow-md ".concat(o),children:t}),children:(0,r.jsx)("div",{className:"".concat(a),children:n})}):(0,r.jsx)(r.Fragment,{children:n})};o.Content=function(e){e.className;var n=e.children;return(0,r.jsx)("div",{children:n})},n.Z=o},"./components/WalletModalButton.tsx":function(e,n,t){"use strict";t.d(n,{e:function(){return o}});var s=t("../node_modules/@solana/wallet-adapter-react-ui/lib/esm/WalletModalButton.js"),r=t("../node_modules/react/jsx-runtime.js");function o(){return(0,r.jsx)(s.e,{style:{padding:"0 64px",border:"solid",borderWidth:"1px",borderColor:"rgb(113 66 207)",borderRadius:"9999px",whiteSpace:"nowrap",background:"rgb(113 66 207)",height:"45px"}})}},"./components/panels/components/index.ts":function(e,n,t){"use strict";t.d(n,{Kk:function(){return a},_Z:function(){return i},YW:function(){return u},dk:function(){return m},Ar:function(){return p}});var s=t("./components/Spinner.tsx"),r=t("./components/Tooltip.tsx"),o=t("../node_modules/react/jsx-runtime.js");function a(e){var n=e.actionLabel,t=e.onAction,a=e.isActionDisabled,i=e.isActionLoading,l=e.tooltipContentOnDisabled;return(0,o.jsx)("button",{className:"action-btn text-base",onClick:t,disabled:a||i,children:i?(0,o.jsx)(s.Z,{}):a?(0,o.jsx)(r.Z,{content:l,children:n}):n})}function i(e){var n=e.amount,t=e.onAmountChange;return(0,o.jsx)("input",{type:"text",name:"amount",id:"amount",autoComplete:"amount",value:n,onChange:function(e){return t(e.target.value)},className:"input-no-spin mb-8 mt-1 block h-14 w-full rounded-full bg-darkGray4 px-4 text-center text-lg font-semibold focus:outline-none"})}var l=t("../staking/lib/app/index.js"),c=t("../node_modules/bn.js/lib/bn.js"),d=t.n(c);function u(e){var n=e.setAmount,t=e.isBalanceLoading,s=e.balance;return(0,o.jsxs)("div",{className:"mb-4 flex items-end justify-between md:items-center ",children:[(0,o.jsx)("label",{htmlFor:"amount",className:"block ",children:"Amount (PYTH)"}),(0,o.jsxs)("div",{className:"ml-auto mr-0 flex flex-col-reverse items-end space-x-2 md:flex-row md:items-center",children:[t?(0,o.jsx)("div",{className:"h-5 w-14 animate-pulse rounded-lg bg-darkGray4"}):(0,o.jsxs)("p",{className:"mt-2 md:mt-0",children:["Balance: ",null===s||void 0===s?void 0:s.toString()]}),(0,o.jsxs)("div",{className:"mb-2 flex space-x-2 md:mb-0",children:[(0,o.jsx)("button",{className:"outlined-btn hover:bg-darkGray4",onClick:function(){s&&n(new l.PythBalance(s.toBN().div(new(d())(2))).toString())},children:"Half"}),(0,o.jsx)("button",{className:"outlined-btn hover:bg-darkGray4",onClick:function(){s&&n(s.toString())},children:"Max"})]})]})]})}function m(e){var n=e.children;return(0,o.jsx)("div",{className:"mb-4 sm:mb-12 md:h-24",children:n})}function p(e){var n=e.children;return(0,o.jsx)("div",{className:"mx-auto max-w-xl text-center leading-6",children:n})}},"./hooks/useProfile.ts":function(e,n,t){"use strict";t.d(n,{U:function(){return c},r:function(){return l}});var s=t("../node_modules/next/dist/compiled/@babel/runtime/helpers/esm/asyncToGenerator.js"),r=t("../node_modules/next/dist/compiled/@babel/runtime/regenerator/index.js"),o=t.n(r),a=t("../node_modules/react-query/es/index.js"),i=t("./hooks/useProfileConnection.ts"),l="profile";function c(){var e=(0,i.H)().data;return(0,a.useQuery)([l,null===e||void 0===e?void 0:e.userPublicKey().toString()],(0,s.Z)(o().mark((function n(){return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,null===e||void 0===e?void 0:e.getProfile(e.userPublicKey());case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}}),n)}))),{enabled:void 0!==e})}},"./hooks/useProfileConnection.ts":function(e,n,t){"use strict";t.d(n,{H:function(){return m}});var s=t("../node_modules/next/dist/compiled/@babel/runtime/helpers/esm/asyncToGenerator.js"),r=t("../node_modules/next/dist/compiled/@babel/runtime/regenerator/index.js"),o=t.n(r),a=t("../staking/lib/app/index.js"),i=t("../node_modules/@solana/wallet-adapter-react/lib/esm/useConnection.js"),l=t("../node_modules/@solana/wallet-adapter-react/lib/esm/useAnchorWallet.js"),c=t("../node_modules/react-hot-toast/dist/index.mjs"),d=t("../node_modules/react-query/es/index.js"),u=t("./utils/capitalizeFirstLetter.ts");function m(){var e=(0,i.R)().connection,n=(0,l.z)();return(0,d.useQuery)(["create-profile-connection",null===n||void 0===n?void 0:n.publicKey.toString()],(0,s.Z)(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new a.ProfileConnection(e,n));case 1:case"end":return t.stop()}}),t)}))),{onError:function(e){c.ZP.error((0,u.f)(e.message))},enabled:void 0!==n})}},"./pages/profile.tsx":function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return g}});var s=t("./components/Spinner.tsx"),r=t("./components/WalletModalButton.tsx"),o=t("./components/panels/components/index.ts"),a=t("../node_modules/@solana/wallet-adapter-react/lib/esm/useWallet.js"),i=t("../node_modules/react/index.js"),l=t("./components/Layout.tsx"),c=t("./components/SEO.tsx"),d=t("./hooks/useProfile.ts"),u=t("../node_modules/next/dist/compiled/@babel/runtime/helpers/esm/asyncToGenerator.js"),m=t("../node_modules/next/dist/compiled/@babel/runtime/regenerator/index.js"),p=t.n(m),x=t("../node_modules/react-hot-toast/dist/index.mjs"),f=t("./utils/capitalizeFirstLetter.ts"),b=t("../node_modules/react-query/es/index.js"),j=t("../staking/lib/app/ProfileConnection.js"),h=t("./hooks/useProfileConnection.ts");var v=t("../node_modules/react/jsx-runtime.js"),g=function(){var e=(0,a.O)().connected,n=(0,i.useState)(),t=n[0],m=n[1],g=(0,d.U)(),y=g.data,w=g.isLoading;(0,i.useEffect)((function(){m(null===y||void 0===y?void 0:y.evm)}),[y]);var _=function(){var e=(0,b.useQueryClient)(),n=(0,h.H)().data;return(0,b.useMutation)(["update-profile"],function(){var e=(0,u.Z)(p().mark((function e(t){var s,r;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=t.currProfile,r=t.newProfile,n){e.next=3;break}return e.abrupt("return");case 3:if((0,j.areDifferentProfiles)(s,r)){e.next=7;break}return x.ZP.error("There is nothing to update."),e.abrupt("return");case 7:return e.prev=7,e.next=10,n.updateProfile(s,r);case 10:x.ZP.success("EVM address ".concat(""===r.evm?"removed":"submitted"," successfully.")),e.next=16;break;case 13:e.prev=13,e.t0=e.catch(7),x.ZP.error(e.t0.message);case 16:case"end":return e.stop()}}),e,null,[[7,13]])})));return function(n){return e.apply(this,arguments)}}(),{onSuccess:function(){e.invalidateQueries({predicate:function(e){return e.queryKey[0]==d.r}})},onError:function(e){x.ZP.error((0,f.f)(e.message))}})}();return(0,v.jsxs)(l.Z,{children:[(0,v.jsx)(c.Z,{title:"Profile"}),(0,v.jsx)("div",{className:"mx-8 mt-10 flex min-h-screen justify-center sm:mt-40",children:(0,v.jsxs)("div",{className:"w-full max-w-[600px]",children:[(0,v.jsx)("div",{className:"space-y-2",children:(0,v.jsx)("h2",{className:"mb-12 font-body text-[44px] font-light leading-10 -tracking-[.03em]",children:"Pyth Profile"})}),(0,v.jsx)("div",{className:"bg-[#252236] px-8 py-8",children:e?!w&&y?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)("div",{className:"space-y-2",children:[(0,v.jsx)("p",{className:"mb-4 text-[14px] font-medium leading-[18.2px] tracking-[.03em]",children:"EVM Address"}),(0,v.jsx)("input",{className:"flex h-10 w-full rounded-md border-none bg-[#312F47] px-3 py-2 text-sm outline-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",id:"evm-address",placeholder:"Enter your EVM address",autoComplete:"off",defaultValue:y.evm,onInput:function(e){m(e.target.value)}})]}),(0,v.jsx)("div",{className:"mt-8 flex items-center justify-center",children:(0,v.jsx)(o.Kk,{actionLabel:"Submit",onAction:function(){return _.mutate({currProfile:y,newProfile:{evm:t}})},isActionDisabled:!1,isActionLoading:_.isLoading,tooltipContentOnDisabled:""})})]}):(0,v.jsx)("div",{className:"mt-8 flex items-center justify-center",children:(0,v.jsx)(s.Z,{})}):(0,v.jsx)("div",{className:"mt-8 flex items-center justify-center",children:(0,v.jsx)(r.e,{})})})]})})]})}},"../node_modules/next/dist/build/webpack/loaders/next-client-pages-loader.js?absolutePagePath=private-next-pages%2Fprofile.tsx&page=%2Fprofile!":function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/profile",function(){return t("./pages/profile.tsx")}])},"../node_modules/@solana/wallet-adapter-react-ui/lib/esm/WalletModalButton.js":function(e,n,t){"use strict";t.d(n,{e:function(){return a}});var s=t("../node_modules/react/index.js"),r=t("../node_modules/@solana/wallet-adapter-react-ui/lib/esm/Button.js"),o=t("../node_modules/@solana/wallet-adapter-react-ui/lib/esm/useWalletModal.js");const a=({children:e="Select Wallet",onClick:n,...t})=>{const{visible:a,setVisible:i}=(0,o.h)(),l=(0,s.useCallback)((e=>{n&&n(e),e.defaultPrevented||i(!a)}),[n,i,a]);return s.createElement(r.z,{...t,className:"wallet-adapter-button-trigger",onClick:l},e)}}},function(e){e.O(0,[337,467,482,976,30,837,344,534,881,92,774,888,179],(function(){return n="../node_modules/next/dist/build/webpack/loaders/next-client-pages-loader.js?absolutePagePath=private-next-pages%2Fprofile.tsx&page=%2Fprofile!",e(e.s=n);var n}));var n=e.O();_N_E=n}]);