1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[611,2992],{611:(e,t,n)=>{n.r(t),n.d(t,{AuthModal:()=>i});var a=n(8283),o=n(5469),s=n(1899),r=n(9896);function i(e){let{initialMode:t="login",nextPath:n="/",onClose:i,onSuccess:l}=e,[c,u]=(0,s.useState)(t);return(0,s.useEffect)(()=>{let e=document.body.style.overflow;document.body.style.overflow="hidden";let t=e=>{"Escape"===e.key&&i()};return window.addEventListener("keydown",t),()=>{document.body.style.overflow=e,window.removeEventListener("keydown",t)}},[i]),(0,a.jsxs)("div",{className:"auth-modal",role:"dialog","aria-modal":"true","aria-label":"register"===c?"Create account":"Log in",children:[(0,a.jsx)("button",{className:"auth-modal__scrim",type:"button","aria-label":"Close login popup",onClick:i}),(0,a.jsxs)("div",{className:"auth-modal__panel",children:[(0,a.jsx)("button",{className:"auth-modal__close",type:"button","aria-label":"Close login popup","data-tooltip":"Close",onClick:i,children:(0,a.jsx)(o.A,{size:18})}),(0,a.jsx)(r.AuthForm,{mode:c,nextPath:n,onSuccess:e=>{null==l||l(e),i()},onModeChange:u})]})]})}},1737:(e,t,n)=>{n.d(t,{A:()=>a});let a=(0,n(231).A)("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]])},9896:(e,t,n)=>{n.d(t,{AuthForm:()=>u});var a=n(8283),o=n(107),s=n.n(o),r=n(9884);let i=(0,n(231).A)("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);var l=n(1737),c=n(1899);function u(e){let{mode:t,nextPath:n="/",error:o,onSuccess:u,onModeChange:p}=e,m=(0,r.useRouter)(),[w,g]=(0,c.useState)(""),[f,x]=(0,c.useState)(""),[y,v]=(0,c.useState)(""),[b,j]=(0,c.useState)(""),[C,k]=(0,c.useState)("admin"===o?"Admin access is required for that page.":""),[_,A]=(0,c.useState)(!1),[L,E]=(0,c.useState)(!1),N=(0,c.useRef)(null),S="register"===t,P=S?i:l.A;(0,c.useEffect)(()=>{var e;null==(e=N.current)||e.focus({preventScroll:!0}),v(""),j(""),k("admin"===o?"Admin access is required for that page.":"")},[o,t]);let M=async()=>{if(_||L)return;k(""),E(!0);let e="number"==typeof window.screenLeft?window.screenLeft:window.screenX,t="number"==typeof window.screenTop?window.screenTop:window.screenY,a="number"==typeof window.outerWidth?window.outerWidth:window.innerWidth,o="number"==typeof window.outerHeight?window.outerHeight:window.innerHeight,s=Math.max(0,e+(a-520)/2),r=Math.max(0,t+(o-720)/2),i=window.open("about:blank","c6x-google-auth","popup=yes,width=".concat(520,",height=").concat(720,",left=").concat(Math.round(s),",top=").concat(Math.round(r)));if(!i){E(!1),k("Please allow popups to continue with Google.");return}let l=new URL("/api/auth/google",window.location.origin);l.searchParams.set("next",n||"/"),l.searchParams.set("popup","1"),l.searchParams.set("origin",window.location.origin),i.location.href=l.toString(),i.focus();let c=await new Promise(e=>{let t=!1,n=()=>{t||(t=!0,window.removeEventListener("message",a),window.clearInterval(o))},a=t=>{if(t.origin!==window.location.origin)return;let a=t.data;a&&"c6x-google-auth"===a.source&&(n(),e(a))},o=window.setInterval(()=>{i.closed&&(n(),e(null))},300);window.addEventListener("message",a)});if(E(!1),!c)return void k("Google sign-in was closed before it finished.");if(!c.ok||!c.user)return void k(c.message||"Google sign-in could not be completed.");let h=c.user;if(window.dispatchEvent(new CustomEvent("c6x:auth-changed",{detail:{user:h}})),u){u(h),m.refresh();return}m.push(d(c.nextPath||n,h)),m.refresh()},q=async e=>{let a,o;if(e.preventDefault(),_)return;if(S&&y!==b)return void k("Passwords do not match.");A(!0),k("");try{a=await fetch("/api/auth/".concat(t),{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:w,email:f,password:y})}),o=await a.json().catch(()=>({}))}catch(e){A(!1),k("Connection failed. Please try again.");return}if(A(!1),!a.ok)return void k("string"==typeof o.message?o.message:"Could not sign you in.");let s=o.user;if(!s)return void k("Signed in, but the session response was incomplete.");if(window.dispatchEvent(new CustomEvent("c6x:auth-changed",{detail:{user:s}})),u){u(s),m.refresh();return}m.push(d(n,s)),m.refresh()};return(0,a.jsxs)("section",{className:"auth-card","aria-label":S?"Create account":"Log in",children:[(0,a.jsx)("div",{className:"auth-card__icon","aria-hidden":"true",children:(0,a.jsx)(P,{size:28})}),(0,a.jsxs)("button",{className:"button button--secondary auth-form__oauth",type:"button",disabled:_||L,onClick:M,children:[(0,a.jsx)(h,{}),L?"Connecting to Google":"Continue with Google"]}),(0,a.jsx)("div",{className:"auth-form__divider","aria-hidden":"true",children:(0,a.jsx)("span",{children:"or"})}),(0,a.jsxs)("form",{className:"auth-form",onSubmit:q,children:[S?(0,a.jsxs)("label",{children:["Name",(0,a.jsx)("input",{value:w,onChange:e=>g(e.target.value),placeholder:"Your name",autoComplete:"name",maxLength:80})]}):null,(0,a.jsxs)("label",{children:["Email",(0,a.jsx)("input",{ref:N,value:f,onChange:e=>x(e.target.value),placeholder:"[email protected]",type:"email",autoComplete:"email",required:!0,maxLength:191})]}),(0,a.jsxs)("label",{children:["Password",(0,a.jsx)("input",{value:y,onChange:e=>v(e.target.value),placeholder:"At least 8 characters",type:"password",autoComplete:S?"new-password":"current-password",required:!0,minLength:8,maxLength:128})]}),S?(0,a.jsxs)("label",{children:["Confirm password",(0,a.jsx)("input",{value:b,onChange:e=>j(e.target.value),placeholder:"Repeat password",type:"password",autoComplete:"new-password",required:!0,minLength:8,maxLength:128})]}):null,C?(0,a.jsx)("span",{className:"auth-form__message",children:C}):null,(0,a.jsxs)("button",{className:"button button--primary auth-form__submit",type:"submit",disabled:_||L,children:[(0,a.jsx)(P,{size:18})," ",_?"Please wait":S?"Create account":"Log in"]})]}),(0,a.jsx)("div",{className:"auth-card__switch",children:S?p?(0,a.jsx)("button",{type:"button",onClick:()=>p("login"),children:"Already have an account?"}):(0,a.jsx)(s(),{href:"/login?next=".concat(encodeURIComponent(n)),children:"Already have an account?"}):p?(0,a.jsx)("button",{type:"button",onClick:()=>p("register"),children:"Create an account"}):(0,a.jsx)(s(),{href:"/register?next=".concat(encodeURIComponent(n)),children:"Create an account"})})]})}function d(e,t){return e.startsWith("/w3")&&"admin"!==t.role||e.startsWith("/dashboard")&&"admin"!==t.role?"/":e||"/"}function h(){return(0,a.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",children:[(0,a.jsx)("path",{fill:"#EA4335",d:"M12 10.2v3.9h5.5c-.2 1.3-.8 2.3-1.7 3.1l3 2.3c1.8-1.7 2.8-4.1 2.8-6.9 0-.7-.1-1.5-.2-2.1H12Z"}),(0,a.jsx)("path",{fill:"#34A853",d:"M12 21c2.6 0 4.8-.9 6.4-2.5l-3-2.3c-.8.6-1.9 1-3.4 1-2.6 0-4.8-1.8-5.6-4.1l-3.1 2.4A9.7 9.7 0 0 0 12 21Z"}),(0,a.jsx)("path",{fill:"#4A90E2",d:"M6.4 13.1A5.8 5.8 0 0 1 6.1 12c0-.4.1-.8.2-1.1l-3.1-2.4A9.7 9.7 0 0 0 2.4 12c0 1.5.4 3 1 4.3l3-2.3Z"}),(0,a.jsx)("path",{fill:"#FBBC05",d:"M12 6.8c1.4 0 2.6.5 3.6 1.4l2.7-2.7A9.8 9.8 0 0 0 2.4 12c0 1.5.4 3 1 4.3l3-2.3c.8-2.4 3-4.2 5.6-4.2Z"})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.