(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[626],{4347:function(e,t,n){Promise.resolve().then(n.bind(n,1870))},9657:function(e,t,n){"use strict";n.d(t,{x:function(){return i}});var r=n(257);let i=r.env.NEXT_PUBLIC_BLACKFISH_URL?r.env.NEXT_PUBLIC_BLACKFISH_URL:""},1870:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return c}});var r=n(7437),i=n(2265),o=n(9376);let s=i.forwardRef(function(e,t){let{title:n,titleId:r,...o}=e;return i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":r},o),n?i.createElement("title",{id:r},n):null,i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z"}))});var a=n(9657);function c(){let[e,t]=(0,i.useState)(""),[n,c]=(0,i.useState)(null),u=(0,o.useSearchParams)();(0,i.useEffect)(()=>{"false"===u.get("success")&&c("Authentication failed. Please try again.")},[u]);let l=async t=>{t.preventDefault(),c(null);try{let t=await fetch("".concat(a.x,"/api/login?token=").concat(e),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"});if(t.redirected){let e=new URL(t.url).searchParams.get("success");if("false"===e)throw Error("Invalid token");window.location.href=t.url}}catch(e){c("Login failed. Please try again.")}};return(0,r.jsx)("div",{className:"flex items-center justify-center mt-96",children:(0,r.jsxs)("form",{onSubmit:l,className:"py-3 px-1 w-2/5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-center mb-4",children:[(0,r.jsx)("input",{type:"text",placeholder:"Enter authentication token",value:e,onChange:e=>t(e.target.value),className:"w-full rounded-none rounded-l-md border-0 py-1.5 pl-3 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-blue-500 sm:text-sm sm:leading-6",style:{boxSizing:"border-box"}}),(0,r.jsxs)("button",{type:"submit",className:"relative -ml-px inline-flex items-center gap-x-1.5 rounded-r-md px-3 py-2 text-sm font-semibold text-gray-900 ring-1 ring-inset ring-gray-300 hover:bg-gray-50",style:{boxSizing:"border-box",height:"100%"},children:[(0,r.jsx)(s,{className:"h-5 w-5"}),"Login"]})]}),n&&(0,r.jsx)("p",{className:"text-red-500 text-center mb-4",children:n})]})})}},9376:function(e,t,n){"use strict";var r=n(5475);n.o(r,"usePathname")&&n.d(t,{usePathname:function(){return r.usePathname}}),n.o(r,"useSearchParams")&&n.d(t,{useSearchParams:function(){return r.useSearchParams}})},257:function(e,t,n){"use strict";var r,i;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(i=n.g.process)?void 0:i.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,i=e.exports={};function o(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var c=[],u=!1,l=-1;function f(){u&&r&&(u=!1,r.length?c=r.concat(c):l=-1,c.length&&d())}function d(){if(!u){var e=a(f);u=!0;for(var t=c.length;t;){for(r=c,c=[];++l<t;)r&&r[l].run();l=-1,t=c.length}r=null,u=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function m(){}i.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new h(e,t)),1!==c.length||u||a(d)},h.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(e){return[]},i.binding=function(e){throw Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw Error("process.chdir is not supported")},i.umask=function(){return 0}}},n={};function r(e){var i=n[e];if(void 0!==i)return i.exports;var o=n[e]={exports:{}},s=!0;try{t[e](o,o.exports,r),s=!1}finally{s&&delete n[e]}return o.exports}r.ab="//";var i=r(229);e.exports=i}()}},function(e){e.O(0,[971,117,744],function(){return e(e.s=4347)}),_N_E=e.O()}]);