1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[26495],{26495:(e,t,n)=>{n.r(t),n.d(t,{LoginForm:()=>m});var a=n(4536),r=n(53066),i=n.n(r),l=n(11092),s=n(36029);let o=(0,s.createServerReference)("6027579d6f2c965ce6b84687ca8b761069c33a6570",s.callServer,void 0,s.findSourceMapURL,"loginAction"),c=(0,s.createServerReference)("60378a4c5b0d3ba0469a617338d41b2b848e54f311",s.callServer,void 0,s.findSourceMapURL,"authAppLoginAction");var d=n(81196);function u(e){let{next:t}=e,[n,r]=(0,l.useState)(!1),[i,s]=(0,l.useState)(!1),[o,c]=(0,l.useState)("");if((0,l.useEffect)(()=>r((0,d.SV)()),[]),!n)return null;async function u(){s(!0),c("");try{let e=await (0,d.TB)("/api/auth/passkeys/options",{purpose:"sign_in"}),n=(0,d.hu)(await navigator.credentials.get({publicKey:(0,d.ag)(e)})),a=await (0,d.TB)("/api/auth/passkeys/sign-in",{...n,next:t});window.location.assign(a.redirect||"/me")}catch(e){(0,d.KW)(e)||c(e.message),s(!1)}}return(0,a.jsxs)("div",{className:"passkey-sign-in",style:{marginTop:16},children:[o&&(0,a.jsx)("div",{className:"alert alert-error",role:"alert",children:o}),(0,a.jsx)("button",{type:"button",className:"btn btn-secondary btn-block",onClick:u,disabled:i,children:i?"Waiting for your passkeyâ¦":"Sign in with a passkey"}),(0,a.jsx)("p",{className:"muted",style:{textAlign:"center",marginTop:8},children:"Use your fingerprint, face or device code. No password needed."})]})}let p={};function m(e){var t;let{next:n,email:r}=e,[s,d,m]=(0,l.useActionState)(o,p),[g,f,x]=(0,l.useActionState)(c,p),b=null!=(t=s.approval)?t:g.approval;return b?(0,a.jsx)(h,{approval:b}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("form",{className:"form",action:d,children:[s.error&&(0,a.jsx)("div",{className:"alert alert-error",role:"alert",children:s.error}),n&&(0,a.jsx)("input",{type:"hidden",name:"next",value:n}),(0,a.jsxs)("div",{className:"field",children:[(0,a.jsx)("label",{htmlFor:"email",children:"Email"}),(0,a.jsx)("input",{id:"email",name:"email",type:"email",autoComplete:"email",required:!0,placeholder:"[email protected]",defaultValue:r})]}),(0,a.jsxs)("div",{className:"field",children:[(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:12,marginBottom:6},children:[(0,a.jsx)("label",{htmlFor:"password",style:{margin:0},children:"Password"}),(0,a.jsx)(i(),{href:"/forgot",style:{fontSize:"0.85rem"},children:"Forgot password?"})]}),(0,a.jsx)("input",{id:"password",name:"password",type:"password",autoComplete:"current-password",required:!0,placeholder:"Your password"})]}),(0,a.jsx)("button",{type:"submit",className:"btn btn-primary btn-block",disabled:m,children:m?"Logging inâ¦":"Log in"}),(0,a.jsxs)("p",{className:"muted",style:{textAlign:"center",marginTop:16},children:["New to Hottub? ",(0,a.jsx)(i(),{href:n?"/signup?next=".concat(encodeURIComponent(n)):"/signup",children:"Create your account"})]})]}),(0,a.jsx)(u,{next:n}),(0,a.jsxs)("details",{className:"auth-alternative",children:[(0,a.jsx)("summary",{children:"Use the Hottub Auth app instead"}),(0,a.jsxs)("form",{className:"form",action:f,style:{marginTop:16},children:[g.error&&(0,a.jsx)("div",{className:"alert alert-error",role:"alert",children:g.error}),n&&(0,a.jsx)("input",{type:"hidden",name:"next",value:n}),(0,a.jsxs)("div",{className:"field",children:[(0,a.jsx)("label",{htmlFor:"auth-app-email",children:"Hottub Auth"}),(0,a.jsx)("input",{id:"auth-app-email",name:"email",type:"email",autoComplete:"email",required:!0,placeholder:"[email protected]"})]}),(0,a.jsx)("button",{type:"submit",className:"btn btn-secondary btn-block",disabled:x,children:x?"Sending requestâ¦":"Sign in with Hottub Auth"}),(0,a.jsx)("p",{className:"muted",style:{textAlign:"center",marginTop:10},children:"Approve from a signed-in Hottub Auth app. No password is sent from this browser."})]})]})]})}function h(e){let{approval:t}=e,[n,r]=(0,l.useState)(null),s=(0,l.useMemo)(()=>new Date(t.expiresAt),[t.expiresAt]),o=(0,l.useMemo)(()=>"/me"===t.next?"/login":"/login?next=".concat(encodeURIComponent(t.next)),[t.next]);return(0,l.useEffect)(()=>{let e=!1,n=null;async function a(){if(!e){if(Date.now()>s.getTime())return void r("That sign-in request expired. Try logging in again.");try{let e=await fetch("/api/auth/login/approval/".concat(t.approvalId),{headers:{"x-hottub-claim":t.claimToken},cache:"no-store"}),n=await e.json().catch(()=>null);if(!e.ok){var i;r(null!=(i=null==n?void 0:n.error)?i:"Could not check that sign-in request.");return}if(r(null),(null==n?void 0:n.status)==="approved")return void window.location.assign(t.next);if((null==n?void 0:n.status)==="denied")return void r("That sign-in was denied in Hottub Auth.");
1if((null==n?void 0:n.status)==="expired")return void r("That sign-in request expired. Try logging in again.")}catch(t){e||r("Could not reach Hottub. Checking again shortly.")}n=setTimeout(a,3e3)}}return a(),()=>{e=!0,n&&clearTimeout(n)}},[t.approvalId,t.claimToken,t.next,s]),(0,a.jsxs)("div",{className:"form","aria-live":"polite",children:[n&&(0,a.jsx)("div",{className:"alert alert-error",children:n}),(0,a.jsxs)("div",{className:"field",style:{textAlign:"center"},children:[(0,a.jsx)("strong",{children:"Approve in Hottub Auth"}),(0,a.jsx)("div",{style:{fontFamily:"ui-monospace, SFMono-Regular, monospace",fontSize:"3rem",fontWeight:800,letterSpacing:"0.18em",margin:"12px 0"},children:t.matchCode}),(0,a.jsx)("p",{className:"muted",style:{margin:0},children:"Open Hottub Auth and approve the sign-in with this matching code."})]}),n&&(0,a.jsx)(i(),{href:o,className:"btn btn-primary btn-block",style:{textAlign:"center"},children:"Try again"})]})}},36029:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{callServer:function(){return a.callServer},createServerReference:function(){return i.createServerReference},findSourceMapURL:function(){return r.findSourceMapURL}});let a=n(81438),r=n(48474),i=n(74718)},36560:(e,t,n)=>{n.d(t,{l:()=>a});function a(){let e=function(){if("undefined"!=typeof document)for(let e of document.cookie.split(";")){let[t,...n]=e.trim().split("=");if("hottub_csrf"===t)return decodeURIComponent(n.join("="))}}();return e?{"x-csrf-token":e}:{}}},81196:(e,t,n)=>{n.d(t,{GD:()=>o,KW:()=>u,SV:()=>l,TB:()=>d,ag:()=>s,hu:()=>c});var a=n(36560);let r=e=>Uint8Array.from(atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(4*Math.ceil(e.length/4),"=")),e=>e.charCodeAt(0)),i=e=>e?btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):void 0,l=()=>"PublicKeyCredential"in window&&!!navigator.credentials;function s(e){var t;return{...e,challenge:r(e.challenge),allowCredentials:(null!=(t=e.allowCredentials)?t:[]).map(e=>({...e,id:r(e.id)}))}}function o(e){var t;return{...e,challenge:r(e.challenge),user:{...e.user,id:r(e.user.id)},excludeCredentials:(null!=(t=e.excludeCredentials)?t:[]).map(e=>({...e,id:r(e.id)}))}}function c(e){if(!e)throw Error("No passkey was chosen.");let t=e.response;return{id:e.id,type:e.type,response:{clientDataJSON:i(t.clientDataJSON),..."authenticatorData"in t?{authenticatorData:i(t.authenticatorData),signature:i(t.signature),userHandle:i(t.userHandle)}:{},..."attestationObject"in t?{attestationObject:i(t.attestationObject)}:{}}}}async function d(e,t){let n=await fetch(e,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json",...(0,a.l)()},body:JSON.stringify(t)}),r=await n.json().catch(()=>({}));if(!n.ok)throw Object.assign(Error(r.error||"That didnât work. Try again."),{status:n.status});return r}let u=e=>e instanceof DOMException&&("NotAllowedError"===e.name||"AbortError"===e.name)}}]);
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.