PageSourceSearch

https://hostshare.co/_next/static/chunks/0vyzr-fpjo7~c.js

js hostshare.co collected 2026-10-05 05:56:54 UTC 38,079 bytes, 4 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,503587,e=>{"use strict";var t=e.i(385504),a=e.i(321422),n=e.i(622236),s=e.i(914912),i=e.i(269264),r=e.i(933188),l=e.i(969569),o=e.i(266287),d=e.i(657065),c=e.i(163287),u=e.i(405551),m=e.i(88043),p=e.i(638584),h=e.i(726799),x=e.i(549162),f=e.i(985902),y=e.i(610012),g=e.i(173554),b=e.i(477325),w=e.i(480784),v=e.i(152088),_=e.i(137673);let j="https://return-to.invalid";function N(e){if(!(!e||!e.startsWith("/")||e.startsWith("//")||e.startsWith("/\\")||/[\x00-\x1f\x7f]/.test(e))&&!e.includes("://"))try{let t=new URL(e,j);if(t.origin!==j)return;return`${t.pathname}${t.search}${t.hash}`}catch{return}}function S(e,t,a="/search"){return N(e)??N(t)??a}var C=e.i(38190),I=e.i(864552),P=e.i(753015),k=e.i(974343),T=e.i(195704),E=e.i(554594),A=e.i(521465);function O(e){return{...e?.attr_utm_source!=null?{attr_utm_source:e.attr_utm_source}:{},...e?.attr_utm_medium!=null?{attr_utm_medium:e.attr_utm_medium}:{},...e?.attr_utm_campaign!=null?{attr_utm_campaign:e.attr_utm_campaign}:{},...e?.attr_utm_term!=null?{attr_utm_term:e.attr_utm_term}:{},...e?.attr_utm_content!=null?{attr_utm_content:e.attr_utm_content}:{},...e?.attr_referrer!=null?{attr_referrer:e.attr_referrer}:{},...e?.attr_fbp!=null?{attr_fbp:e.attr_fbp}:{},...e?.attr_fbc!=null?{attr_fbc:e.attr_fbc}:{},...e?.attr_event_source_url!=null?{attr_event_source_url:e.attr_event_source_url}:{},...e?.attr_click_ids&&Object.keys(e.attr_click_ids).length>0?{attr_click_ids:e.attr_click_ids}:{},...e?.ref!=null?{ref:e.ref}:{},...e?.code!=null?{code:e.code}:{}}}async function F(e=3e3,t){window.IS_HUMAN_INITIALIZED||await new Promise(a=>{let n;if(t?.aborted)return void a();let s=Date.now(),i=()=>{clearTimeout(n),a()};t?.addEventListener("abort",i,{once:!0});let r=()=>{if(window.IS_HUMAN_INITIALIZED||Date.now()-s>=e){t?.removeEventListener("abort",i),a();return}n=setTimeout(r,100)};r()})}let L="signin-overlay";function R(){if(document.getElementById(L))return;let e=document.createElement("div");e.id=L,e.style.cssText="position:fixed;inset:0;z-index:100;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;background:rgba(0,0,0,0.25);transition:opacity 150ms;opacity:0;",e.innerHTML=`
2    <svg class="animate-spin" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-6.219-8.56"/></svg>
3    <p style="font-size:14px;font-weight:500;color:rgba(255,255,255,0.9);">Signing you in...</p>
4  `,document.body.appendChild(e),requestAnimationFrame(()=>{e.style.opacity="1"})}function z(){document.getElementById(L)?.remove()}function D({value:e,onChange:n,error:s}){let[i,r]=(0,a.useState)(()=>((e,t,a)=>{let n=(e+t+a).replace(/\D/g,"");if(0===n.length)return"";let s=n.slice(0,2);return n.length>2&&(s+=` / ${n.slice(2,4)}`),n.length>4&&(s+=` / ${n.slice(4,8)}`),s})(e.mm,e.dd,e.yyyy));return(0,t.jsxs)("div",{children:[(0,t.jsx)("input",{type:"text",inputMode:"numeric",value:i,onChange:e=>{let t=e.target.value.replace(/\D/g,"").slice(0,8),a="";t.length>0&&(a=t.slice(0,2)),t.length>2&&(a+=` / ${t.slice(2,4)}`),t.length>4&&(a+=` / ${t.slice(4,8)}`),r(a),n({mm:t.slice(0,2),dd:t.slice(2,4),yyyy:t.slice(4,8)})},placeholder:"MM / DD / YYYY","aria-label":"Date of birth",className:(0,v.cn)("h-14 w-full rounded-xl border border-input bg-transparent px-4 text-[16px] font-normal text-foreground outline-none transition-colors","placeholder:text-muted-foreground/60","focus:border-ring focus:ring-2 focus:ring-ring/20",s&&"border-destructive focus:border-destructive focus:ring-destructive/20")}),s&&(0,t.jsx)("p",{className:"mt-1.5 text-xs text-destructive",role:"alert",children:s})]})}function M({inputMode:e,identifier:a,selectedCountryIso2:n,loading:s,error:i,sso:r,onIdentifierChange:l,onCountryChange:o,onSwitchMode:d,onSubmit:c,googleBtnRef:u,onGoogleClick:w,onAppleClick:v}){let _=r&&(r.googleClientId||r.appleClientId);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-1 text-center",children:[(0,t.jsx)("h1",{className:"text-3xl font-semibold text-primary",children:"Sign in or join Hostshare"}),(0,t.jsx)("p",{className:"text-muted-foreground",children:"Continue with phone, email, or social."})]}),i&&(0,t.jsx)("p",{className:"text-sm text-destructive text-center",role:"alert",children:i}),(0,t.jsxs)("form",{onSubmit:c,className:"space-y-3",children:[(0,t.jsx)("div",{className:"space-y-2",children:"phone"===e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(g.Label,{htmlFor:"identifier",className:"text-[13px] font-bold",children:"Phone number"}),(0,t.jsx)(b.PhoneInput,{id:"identifier",defaultCountry:n,initialDigits:(()=>
4{if(a.startsWith("+"))try{return(0,I.parsePhoneNumberWithError)(a).nationalNumber}catch{}return a.replace(/\D/g,"")})(),onChange:e=>{l(e)},onCountryChange:o,disabled:s})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(g.Label,{htmlFor:"identifier",className:"text-[13px] font-bold",children:"Email address"}),(0,t.jsx)(y.Input,{type:"email",id:"identifier",className:"h-14 rounded-xl px-4 text-[16px] font-normal",value:a,onChange:e=>l(e.target.value),placeholder:"[email protected]",autoComplete:"username",disabled:s})]})}),a.length>0&&(0,t.jsxs)("p",{className:"text-[11px] font-normal text-muted-foreground/70",children:["phone"===e?(0,t.jsxs)(t.Fragment,{children:["We'll send a confirmation code by text. Message and data rates may apply."," "]}):(0,t.jsxs)(t.Fragment,{children:["We'll send a confirmation code by email."," "]}),(0,t.jsx)("a",{href:"/privacy",className:"underline hover:text-muted-foreground",children:"Privacy Policy"})]}),(0,t.jsx)(f.Button,{type:"submit",className:"w-full h-14 rounded-xl text-base",disabled:s,children:s?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.Loader2,{className:"animate-spin"}),"One moment…"]}):"Continue"})]}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:"absolute inset-0 flex items-center",children:(0,t.jsx)("span",{className:"w-full border-t"})}),(0,t.jsx)("div",{className:"relative flex justify-center text-xs lowercase",children:(0,t.jsx)("span",{className:"bg-popover px-2 text-muted-foreground",children:"or"})})]}),(0,t.jsxs)("div",{className:"flex gap-2.5 [&>*]:flex-1",children:[r?.googleClientId&&(0,t.jsx)(f.Button,{variant:"outline",className:"h-14 w-full rounded-[14px]",onClick:w,disabled:s,type:"button","aria-label":"Continue with Google",children:(0,t.jsx)(x.GoogleIcon,{className:"size-5"})}),r?.appleClientId&&(0,t.jsx)(f.Button,{variant:"outline",className:"h-14 w-full rounded-[14px]",onClick:v,disabled:s,type:"button","aria-label":"Continue with Apple",children:(0,t.jsx)(x.AppleIcon,{className:"size-5"})}),"phone"===e?(0,t.jsx)(f.Button,{variant:"outline",className:"h-14 w-full rounded-[14px]",onClick:d,type:"button","aria-label":"Use email instead",children:(0,t.jsx)(p.Mail,{className:"size-5"})}):(0,t.jsx)(f.Button,{variant:"outline",className:"h-14 w-full rounded-[14px]",onClick:d,type:"button","aria-label":"Use phone instead",children:(0,t.jsx)(h.Phone,{className:"size-5"})})]}),(0,t.jsx)("div",{ref:u,className:"hidden","aria-hidden":"true"}),!_&&(0,t.jsx)("p",{className:"text-center text-xs text-muted-foreground",children:"phone"===e?"Use the mail icon above to switch to email":"Use the phone icon above to switch to phone"}),(0,t.jsxs)("p",{className:"text-center text-[11px] text-muted-foreground/70",children:["By continuing, you agree to Hostshare's"," ",(0,t.jsx)("a",{href:"/terms",className:"underline hover:text-muted-foreground",children:"Terms"})," ","and"," ",(0,t.jsx)("a",{href:"/privacy",className:"underline hover:text-muted-foreground",children:"Privacy Policy"}),"."]})]})}function B({identifier:e,inputMode:n,flowId:s,loading:i,error:o,resendCooldown:d,accountExists:p,subView:h,dispatchedTo:x,debugOtpCode:b,returnTo:j,onSubViewChange:N,onSuccess:I,onFinalizeRequired:k,onFlowRestart:T,onResend:E,onSwitchToOtp:A}){var F;let{t:L}=(0,_.useLocalize)(),[R,z]=(0,a.useState)(!1),[D,M]=(0,a.useState)(o),[U,$]=(0,a.useState)(""),[W,Y]=(0,a.useState)(!1),[q,V]=(0,a.useState)("idle"),[H,J]=(0,a.useState)(0);(0,a.useEffect)(()=>{if(H<=0)return;let e=setTimeout(()=>J(e=>e-1),1e3);return()=>clearTimeout(e)},[H]),(0,a.useEffect)(()=>{M(o)},[o]),(0,a.useEffect)(()=>{M(null)},[h]);let Z=(0,a.useCallback)(async e=>{z(!0),M(null);try{let t={flow_id:s,...O((0,C.getAttribution)()),...e},a=await fetch("/api/auth/flow/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),i=await a.json();if("success"===i.status.type){let t=i.payload;"login"===t.__type?(P.default.identify(t.account_id),P.default.capture("user_signed_in",{method:null!=e.code?"otp":"password",input_mode:n}),window.location.href=S(j,i.returnTo)):"finalize-required"===t.__type&&k(t.flow_id);return}let r=function(e,t){let a=e.payload;
4switch((null!==a&&"object"==typeof a&&"code"in a?a.code:void 0)??e.status?.code){case"INVALID_CREDENTIALS":return{message:t("Incorrect password. Please try again."),restartFlow:!1};case"INVALID_CODE":return{message:t("That code didn’t match. Try again or resend."),restartFlow:!1};case"TOO_MANY_ATTEMPTS":return{message:t("Too many incorrect attempts. Enter your email or phone to start again."),restartFlow:!0};case"FLOW_EXPIRED":return{message:t("Your sign-in timed out. Enter your email or phone to start again."),restartFlow:!0};case"SERVICE_UNAVAILABLE":return{message:t("Verification is unavailable right now. Please try again in a moment."),restartFlow:!1};default:return{message:t("Something went wrong. Please try again."),restartFlow:!1}}}(i,L);if(r.restartFlow)return void T(r.message);M(r.message)}catch{M("Something went wrong. Please try again.")}finally{z(!1)}},[s,k,T,n,j,L]),G=(0,a.useCallback)(async()=>{if("sending"!==q&&!(H>0)){V("sending");try{let t=await fetch("/api/auth/reset-password/request",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e})}),a=await t.json(),n="error"===a.status.type?a.payload:null;if(n&&"__type"in n&&"error"===n.__type&&2===n.sub_code)return void V("rate-limited")}catch{}V("sent"),J(60)}},[q,H,e]),X=(0,a.useCallback)(e=>{Z({code:e})},[Z]),K=(0,a.useCallback)(e=>{e.preventDefault(),U&&Z({password:U})},[U,Z]),Q=function(e,t){if("email"===t||"phone"!==t&&e.includes("@")){let[t,a]=e.split("@");return t&&a?`${t[0]}***@${a}`:e}let a=e.replace(/\D/g,"");return`+${a.slice(0,a.length-4).replace(/./g,"·")} ${a.slice(-4)}`}(e,n);return(0,t.jsxs)(r.AnimatePresence,{mode:"wait",initial:!1,children:["otp"===h&&(0,t.jsxs)(l.motion.div,{className:"flex flex-1 flex-col justify-between",initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.18,ease:[.25,.1,.25,1]},children:[(0,t.jsxs)("div",{className:"space-y-1 text-center",children:[(0,t.jsx)("h1",{className:"text-3xl font-semibold text-primary",children:"Confirm it's you"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:"none"===(F={dispatchedTo:x,inputMode:n,maskedId:Q}).dispatchedTo?L("Enter the 6-digit code to continue"):"email"===F.dispatchedTo&&"phone"===F.inputMode?L("We sent a 6-digit code to your email on file"):`${L("We sent a 6-digit code to")} ${F.maskedId}`})]}),(0,t.jsx)("div",{className:"py-4",children:(0,t.jsx)(w.OtpInput,{onComplete:X,disabled:R,error:D})}),b&&(0,t.jsxs)("div",{className:"rounded-lg border border-yellow-500/40 bg-yellow-500/10 px-4 py-3 text-center",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-yellow-600 dark:text-yellow-400 mb-1",children:"QA — code is:"}),(0,t.jsx)("p",{className:"text-2xl font-mono font-bold tracking-widest text-yellow-700 dark:text-yellow-300",children:b})]}),(0,t.jsxs)("p",{className:"text-center text-sm text-muted-foreground",children:["Didn't get it?"," ",(0,t.jsx)("button",{type:"button",onClick:()=>void E(),disabled:d>0,className:"underline text-primary transition-opacity disabled:cursor-not-allowed disabled:opacity-50",children:d>0?`Send a new code (${d}s)`:"Send a new code"})]}),(0,t.jsx)(f.Button,{type:"button",variant:"outline",className:"mt-auto w-full h-12 rounded-xl",onClick:()=>N("alternatives"),children:"Try another way"})]},"otp"),"alternatives"===h&&(0,t.jsxs)(l.motion.div,{className:"flex-1 space-y-4",initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.18,ease:[.25,.1,.25,1]},children:[(0,t.jsx)("div",{className:"space-y-1 text-center pt-2",children:(0,t.jsx)("h1",{className:"text-2xl font-semibold text-primary",children:"Try another way"})}),(0,t.jsxs)("div",{className:"rounded-xl border border-input bg-muted/30 p-4 space-y-1.5",children:[(0,t.jsx)("p",{className:"text-sm font-semibold text-foreground",children:"Not receiving your co
4de?"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"email"===n?"Check your spam or junk folder — the email comes from [email protected].":"Make sure the phone number you entered is correct and can receive SMS."})]}),!0!==p&&(0,t.jsxs)("div",{className:"rounded-xl border border-input p-4 space-y-2",children:[(0,t.jsxs)("p",{className:"text-sm font-semibold text-foreground",children:["Verify ","email"===n?"email":"phone"," later"]}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"You can still finish setting up your account, but you'll need to verify before you can book."}),(0,t.jsx)(f.Button,{type:"button",variant:"outline",className:"w-full h-10 rounded-xl text-sm",onClick:()=>k(s),children:"Continue to setup"})]}),!1!==p&&(0,t.jsxs)("div",{className:"rounded-xl border border-input p-4 space-y-2",children:[(0,t.jsx)("p",{className:"text-sm font-semibold text-foreground",children:"Use a password"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:!0===p?"Sign in with your password instead.":"Already have an account? Sign in with your password instead."}),(0,t.jsx)(f.Button,{type:"button",variant:"outline",className:"w-full h-10 rounded-xl text-sm",onClick:()=>N("password"),children:"Use password instead"})]})]},"alternatives"),"password"===h&&(0,t.jsxs)(l.motion.div,{className:"flex flex-1 flex-col",initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.18,ease:[.25,.1,.25,1]},children:[(0,t.jsxs)("div",{className:"space-y-1 text-center",children:[(0,t.jsx)("h1",{className:"text-3xl font-semibold text-primary",children:"Enter your password"}),(0,t.jsxs)("p",{className:"text-muted-foreground text-sm",children:["Signing in to ",Q]})]}),D&&(0,t.jsx)("p",{className:"mt-4 text-sm text-destructive text-center",role:"alert",children:D}),(0,t.jsxs)("form",{onSubmit:K,className:"mt-4 space-y-3",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(g.Label,{htmlFor:"verify-password",className:"text-[13px] font-bold",children:"Password"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(y.Input,{type:W?"text":"password",id:"verify-password",className:"h-14 rounded-xl px-4 pr-12 text-[16px]",value:U,onChange:e=>$(e.target.value),placeholder:"Your password",autoComplete:"current-password",autoFocus:!0,disabled:R}),(0,t.jsx)("button",{type:"button",onClick:()=>Y(e=>!e),className:"absolute right-4 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors","aria-label":W?"Hide password":"Show password",children:W?(0,t.jsx)(u.EyeOff,{className:"size-4"}):(0,t.jsx)(c.Eye,{className:"size-4"})})]})]}),(0,t.jsx)(f.Button,{type:"submit",className:"w-full h-14 rounded-xl text-base",disabled:R||!U,children:R?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.Loader2,{className:"animate-spin"}),"One moment…"]}):"Sign in"}),(0,t.jsx)("div",{className:"text-center pt-1",children:"rate-limited"===q?(0,t.jsx)("p",{className:"text-sm text-destructive",children:"Unable to reset password. Please try again in 1 hour."}):"sent"===q?(0,t.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Check your inbox — we sent a reset link to ",Q,"."," ",(0,t.jsx)("button",{type:"button",onClick:()=>void G(),disabled:H>0,className:(0,v.cn)("transition-colors",H>0?"opacity-50 cursor-default":"underline hover:text-foreground"),children:H>0?`Resend (${H}s)`:"Resend"})]}):(0,t.jsx)("button",{type:"button",onClick:()=>void G(),disabled:"sending"===q,className:"text-sm text-muted-foreground underline hover:text-foreground transition-colors disabled:opacity-50",children:"sending"===q?"Sending…":"Forgot password?"})})]}),(0,t.jsx)(f.Button,{type:"button",variant:"outline",className:"mt-auto w-full h-12 rounded-xl",onClick:()=>void A(),children:"Use a code instead"})]},"password")]})}function U({flowId:e,inputMode:n,identifier:r,initialFirstName:l,initialLastName:d,needsRealEmail:p=!1,ssoProvider:h,ssoUserId:x,onSuccess:_,onBack:j}){let[N,S]=(0,a.useState)(l??""),[I,E]=(0,a.useState)(d??""),[F,L]=(0,a.useState)({mm:"",dd:"",yyyy:""}),[R,z]=(0,a.useState)(null),[M,B]=(0,a.useState)(""),[$,W]=(0,a.useState)(null),[Y,q]=(0,a.useState)(""),[V,H]=(0,a.useState)(!1),[J,Z]=(0,a.useState)(!1),[G,X]=(0,a.useState)(null),[K,Q]=(0,a.useState)(""),[ee,et]=(0,a.useState)(null),[ea,en]=(0,a.useState)(!1),[es,ei]=(0,a.useState)(!1),[er,el]=(0,a.useState)(!1),[eo,ed]=(0,a.useState)(!1),ec=(0,i.useQueryClient)(),eu=(0,s.useRouter)(),em=(0,a.useRef)(!1);(0,a.useEffect)(()=>{h&&!em.current&&(em.current=!0,x&&(P.default.identify(x,{sso_finalize_pending:!0,sso_provider:h}),P.default.startSessionRecording({sampling:!0})),(0,k.capture)(T.EVENTS.SSO_FINALIZE_SHOWN,{provider:h,has_relay_email:p}))},[]);let ep=(0,a.useCallback)(async()=>{et(null);let t=K.trim();if(!t)return void et("Please enter your email address");el(!0);try{let a=await fetch("/api/auth/flow/real-email/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flow_id:e,email:t})}),n=await a.json();if("success"===n.status.type)return void en(!0);let s=n.payload;
4et("EMAIL_EXISTS"===s.code?"This email is already in use. Sign in instead.":s.message??"We couldn't send a code. Please try again.")}catch{et("Something went wrong. Please try again.")}finally{el(!1)}},[e,K]),eh=(0,a.useCallback)(async t=>{et(null),ed(!0);try{let a=await fetch("/api/auth/flow/real-email/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flow_id:e,code:t})}),n=await a.json();if("success"===n.status.type)return void ei(!0);let s=n.payload;et("MAX_VERIFY_ATTEMPTS"===s.code?"Too many incorrect attempts. Request a new code.":"That code didn't match. Try again or resend.")}catch{et("Something went wrong. Please try again.")}finally{ed(!1)}},[e]),ex=(0,a.useCallback)(()=>{let{mm:e,dd:t,yyyy:a}=F;if(!e||!t||!a||a.length<4)return"Please enter your full date of birth as MM / DD / YYYY (4-digit year)";let n=parseInt(e,10),s=parseInt(t,10),i=parseInt(a,10);if(n<1||n>12||s<1||s>31)return"Please enter a valid date of birth";let r=new Date(i,n-1,s),l=new Date,o=l.getFullYear()-r.getFullYear(),d=l.getMonth()-r.getMonth();return((d<0||0===d&&l.getDate()<r.getDate())&&o--,o<18)?"You must be at least 18 years old to join Hostshare":null},[F]),ef=(0,a.useCallback)(async t=>{t.preventDefault(),h&&(0,k.capture)(T.EVENTS.SSO_FINALIZE_SUBMITTED,{provider:h}),X(null),W(null);let a=ex();if(z(a),a)return;if(!N.trim()||!I.trim())return void X("Please enter your first and last name");if(p){if(!es)return void X("Please verify your email address to continue")}else if(!M.trim())return void X("phone"===n?"Please enter your email address":"Please enter your phone number");if("sso"!==n&&!(0,A.getPasswordRequirements)(Y).every(e=>e.met))return void X(Y?"Your password doesn't meet all the requirements yet":"Please create a password");let{mm:s,dd:i,yyyy:r}=F,l=`${r}-${s.padStart(2,"0")}-${i.padStart(2,"0")}`;Z(!0);try{let t=(0,C.getAttribution)(),a={flow_id:e,first_name:N.trim(),last_name:I.trim(),date_of_birth:l,secondary_contact:p?K.trim():M.trim(),..."sso"!==n&&Y?{password:Y}:{},...O(t)},s=await fetch("/api/auth/flow/finalize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),i=await s.json();if("success"===i.status.type){(0,C.clearAttribution)();let e=i.payload;P.default.identify(e.account_id,{first_name:N.trim(),last_name:I.trim(),...h?{sso_finalize_pending:!1}:{}}),P.default.capture("user_signed_up",{input_mode:n,...e.channel?{channel:e.channel}:{},...e.source?{signup_source:e.source}:{},...t?.attr_utm_source?{utm_source:t.attr_utm_source}:{},...t?.attr_utm_medium?{utm_medium:t.attr_utm_medium}:{},...t?.attr_utm_campaign?{utm_campaign:t.attr_utm_campaign}:{}}),await ec.invalidateQueries({queryKey:o.queryKeys.me.detail()}),eu.refresh(),_();return}let r=i.payload;h&&(0,k.capture)(T.EVENTS.SSO_FINALIZE_ERROR,{provider:h,error_code:r.code}),"EMAIL_EXISTS"===r.code||"PHONE_EXISTS"===r.code?W(r.message??"This contact is already linked to an account."):X(r.message??"Account creation failed. Please try again.")}catch{h&&(0,k.capture)(T.EVENTS.SSO_FINALIZE_ERROR,{provider:h,error_code:"network_error"}),X("Something went wrong. Please try again.")}finally{Z(!1)}},[e,N,I,F,M,Y,n,p,K,es,ex,ec,eu,_,h]),ey="phone"===n?M:r;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-1 text-center",children:[(0,t.jsx)("h1",{className:"text-3xl font-semibold text-primary",children:"Let's create your account"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:"This information is required to book or host."})]}),G&&(0,t.jsx)("p",{className:"text-sm text-destructive text-center",role:"alert",children:G}),(0,t.jsxs)("form",{onSubmit:ef,className:"space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(g.Label,{className:"text-[13px] font-bold",children:"phone"===n?"Phone number":"Email"}),(0,t.jsxs)("div",{className:"flex h-14 items-center rounded-xl border border-input bg-muted/30 px-4",children:[(0,t.jsx)("span",{className:"flex-1 truncate text-[16px] text-foreground",children:r}),(0,t.jsx)("button",{type:"button",onClick:j,className:"ml-2 shrink-0 text-sm font-medium text-primary hover:underline",children:"Edit"})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(g.Label,{className:"text-[13px] font-bold",children:"Legal name"}),(0,t.jsxs)("div",{className:(0,v.cn)("overflow-hidden rounded-xl border border-input transition-colors focus-within:border-ring",J&&"opacity-50"),children:[(0,t.jsx)("input",{id:"first-name","aria-label":"First name",className:"h-14 w-full border-0 bg-transparent px-4 text-[16px] font-normal text-foreground outline-none placeholder:text-muted-foreground
4/60 disabled:cursor-not-allowed",placeholder:"First name",value:N,onChange:e=>S(e.target.value),autoComplete:"given-name",disabled:J}),(0,t.jsx)("div",{className:"border-t border-input",children:(0,t.jsx)("input",{id:"last-name","aria-label":"Last name",className:"h-14 w-full border-0 bg-transparent px-4 text-[16px] font-normal text-foreground outline-none placeholder:text-muted-foreground/60 disabled:cursor-not-allowed",placeholder:"Last name",value:I,onChange:e=>E(e.target.value),autoComplete:"family-name",disabled:J})})]}),(0,t.jsx)("p",{className:"px-4 text-[11px] font-normal text-muted-foreground/70",children:"Match what's on your government ID."})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(g.Label,{className:"text-[13px] font-bold",children:"Date of birth"}),(0,t.jsx)(D,{value:F,onChange:e=>{L(e),z(null)},error:R}),!R&&(0,t.jsx)("p",{className:"px-4 text-[11px] font-normal text-muted-foreground/70",children:"You must be at least 18 to use Hostshare."})]}),p?(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(g.Label,{htmlFor:"real-email",className:"text-[13px] font-bold",children:"Email"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(y.Input,{type:"email",id:"real-email",className:(0,v.cn)("h-14 flex-1 rounded-xl px-4",ee&&"border-destructive focus-visible:ring-destructive"),value:K,onChange:e=>{Q(e.target.value),et(null)},placeholder:"[email protected]",autoComplete:"email",disabled:J||er||es}),!es&&(0,t.jsx)(f.Button,{type:"button",variant:"outline",className:"h-14 shrink-0 rounded-xl px-4",onClick:()=>void ep(),disabled:J||er||!K.trim(),children:er?(0,t.jsx)(m.Loader2,{className:"animate-spin"}):ea?"Resend":"Send code"})]}),es?(0,t.jsx)("p",{className:"px-4 text-[11px] font-medium text-primary",role:"status",children:"Email verified — you're all set."}):ea?(0,t.jsxs)("div",{className:"space-y-2 pt-1",children:[(0,t.jsxs)("p",{className:"px-4 text-[11px] font-normal text-muted-foreground/70",children:["Enter the 6-digit code we sent to ",K.trim(),"."]}),(0,t.jsx)(w.OtpInput,{onComplete:e=>void eh(e),disabled:eo,error:ee})]}):ee?(0,t.jsx)("p",{className:"text-xs text-destructive",role:"alert",children:ee}):(0,t.jsx)("p",{className:"px-4 text-[11px] font-normal text-muted-foreground/70",children:"Apple hid your email, so we need a real address for receipts, host messages, and account recovery."})]}):"phone"===n?(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(g.Label,{htmlFor:"secondary-email",className:"text-[13px] font-bold",children:"Email"}),(0,t.jsx)(y.Input,{type:"email",id:"secondary-email",className:(0,v.cn)("h-14 rounded-xl px-4",$&&"border-destructive focus-visible:ring-destructive"),value:M,onChange:e=>{B(e.target.value),W(null)},placeholder:"[email protected]",autoComplete:"email",disabled:J}),$?(0,t.jsx)("p",{className:"text-xs text-destructive",role:"alert",children:$}):(0,t.jsx)("p",{className:"px-4 text-[11px] font-normal text-muted-foreground/70",children:"We'll send trip receipts and host messages here. You can verify it later."})]}):(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(g.Label,{htmlFor:"secondary-phone",className:"text-[13px] font-bold",children:"Phone number"}),(0,t.jsx)(b.PhoneInput,{id:"secondary-phone",defaultCountry:"US",initialDigits:M.replace(/\D/g,""),onChange:e=>{B(e),W(null)},disabled:J}),$?(0,t.jsx)("p",{className:"text-xs text-destructive",role:"alert",children:$}):(0,t.jsx)("p",{className:"px-4 text-[11px] font-normal text-muted-foreground/70",children:"We'll use this as a backup way to reach you"})]}),"sso"!==n&&(0,t.jsxs)("div",{className:"space-y-2",children:[ey.length>0&&(0,t.jsx)("input",{type:"email",name:"email",autoComplete:"username",value:ey,readOnly:!0,tabIndex:-1,"aria-hidden":"true",className:"sr-only pointer-events-none"}),(0,t.jsx)(g.Label,{htmlFor:"new-password",className:"text-[13px] font-bold",children:"Create a password"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(y.Input,{type:V?"text":"password",id:"new-password",className:"h-14 rounded-xl px-4 pr-12 placeholder:text-muted-foreground
4/60",value:Y,onChange:e=>q(e.target.value),placeholder:"At least 8 characters",autoComplete:"new-password",disabled:J}),(0,t.jsx)("button",{type:"button",onClick:()=>H(e=>!e),className:"absolute right-4 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors","aria-label":V?"Hide password":"Show password",children:V?(0,t.jsx)(u.EyeOff,{className:"size-4"}):(0,t.jsx)(c.Eye,{className:"size-4"})})]}),(0,t.jsx)(A.PasswordStrength,{password:Y})]}),(0,t.jsxs)("div",{className:"-mx-6 mt-8 space-y-2 border-t border-border bg-popover px-6 pt-3 pb-6",children:[(0,t.jsx)(f.Button,{type:"submit",className:"w-full h-14 rounded-xl text-base",disabled:J,children:J?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.Loader2,{className:"animate-spin"}),"Creating account…"]}):"Agree and continue"}),(0,t.jsxs)("p",{className:"text-center text-[11px] text-muted-foreground/70",children:["By creating an account, you agree to Hostshare's"," ",(0,t.jsx)("a",{href:"/terms",className:"underline hover:text-muted-foreground",children:"Terms of Service"})," ","and"," ",(0,t.jsx)("a",{href:"/privacy",className:"underline hover:text-muted-foreground",children:"Privacy Policy"}),"."]})]})]})]})}e.s(["UnifiedAuthFlow",0,function({onSuccess:e,onClose:i,sso:o,initialFlowId:c,initialFirstName:u,initialLastName:m,initialNeedsRealEmail:p,initialSsoProvider:h,initialSsoUserId:x,returnTo:f,headerSlot:y}){let g=(0,s.useRouter)(),[b,w]=(0,a.useState)(c?"finalize":"identity"),[_,j]=(0,a.useState)(c?"sso":"email"),[N,k]=(0,a.useState)("US"),[T,A]=(0,a.useState)(""),[L,D]=(0,a.useState)(c??null),[$,W]=(0,a.useState)(u),[Y,q]=(0,a.useState)(m),[V,H]=(0,a.useState)(p??!1),[J,Z]=(0,a.useState)(h),[G,X]=(0,a.useState)(!1),[K,Q]=(0,a.useState)(null),[ee,et]=(0,a.useState)("otp"),[ea,en]=(0,a.useState)("none"),[es,ei]=(0,a.useState)(null),[er,el]=(0,a.useState)(0),[eo,ed]=(0,a.useState)(void 0);(0,a.useEffect)(()=>{if(er<=0)return;let e=setTimeout(()=>el(e=>e-1),1e3);return()=>clearTimeout(e)},[er]);let[ec,eu]=(0,a.useState)({});(0,a.useEffect)(()=>{fetch("/api/countries").then(e=>e.json()).then(e=>{if("success"!==e.status.type)return;let t={};for(let a of e.payload.countries)t[a.iso2]=a.id;eu(t)}).catch(()=>{})},[]);let em=(0,a.useRef)(Promise.resolve());(0,a.useEffect)(()=>{let e=new AbortController;return em.current=F(1e4,e.signal),()=>e.abort()},[]);let ep=(0,a.useRef)(null),eh=(0,a.useRef)(f);(0,a.useEffect)(()=>{eh.current=f},[f]);let ex=(0,a.useRef)(!1),ef=(0,a.useRef)(null),ey=(0,a.useCallback)(e=>{window.google?.accounts?.id&&window.google.accounts.id.renderButton(e,{type:"standard",size:"large",text:"signin_with",width:300})},[]),eg=(0,a.useCallback)(e=>{ef.current=e,e&&ex.current&&ey(e)},[ey]);(0,a.useEffect)(()=>{if(!o?.googleClientId||ex.current)return;let e=()=>{!ex.current&&(ex.current=!0,window.google.accounts.id.initialize({client_id:o.googleClientId,callback:({credential:e})=>{R(),fetch("/api/auth/sso/google",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id_token:e,...O((0,C.getAttribution)())})}).then(e=>e.json()).then(e=>{"finalize-required"===e.__type&&e.flow_id?(z(),j("sso"),Z("google"),e.user_id&&(P.default.identify(e.user_id,{email:e.email??void 0,is_internal:(0,E.isInternalEmail)(e.email),sso_finalize_pending:!0,sso_provider:"google"}),P.default.startSessionRecording({sampling:!0})),e.email&&A(e.email),e.first_name&&W(e.first_name),e.last_name&&q(e.last_name),D(e.flow_id),w("finalize")):"login"===e.__type?window.location.assign(S(eh.current,e.return_to)):"sso-account"===e.__type&&e.provider?(z(),Q(`This account uses ${e.provider}. Please sign in with ${e.provider} instead.`)):(z(),Q("Google sign in failed. Please try again."))}).catch(()=>{z(),Q("Something went wrong. Please try again.")})}}),ef.current&&ey(ef.current))};if(window.google?.accounts?.id)return void e();if(!document.querySelector('script[src*="accounts.google.com/gsi/client"]')){let t=document.createElement("script");t.src="https://accounts.google.com/gsi/client",t.async=!0,t.defer=!0,t.onload=e,document.head.appendChild(t)}},[o?.googleClientId,ey]),(0,a.useEffect)(()=>()=>z(),[]);let eb=(0,a.useCallback)(()=>{let e=ef.current?.querySelector('[role="button"]')??ef.current?.querySelector("div[tabindex]");e?.click()},[]),ew=(0,a.useRef)(!1);(0,a.useEffect)(()=>
4{if(!o?.appleClientId||!o?.appleRedirectUri||ew.current)return;let e=()=>{!ew.current&&window.AppleID&&(ew.current=!0,window.AppleID.auth.init({clientId:o.appleClientId,scope:"email name",redirectURI:o.appleRedirectUri,usePopup:!0}))};if(window.AppleID)return void e();if(!document.querySelector('script[src*="appleid.cdn-apple.com"]')){let t=document.createElement("script");t.src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js",t.async=!0,t.defer=!0,t.onload=e,document.head.appendChild(t)}},[o?.appleClientId,o?.appleRedirectUri]);let ev=(0,a.useCallback)(async()=>{if(!window.AppleID)return void Q("Apple sign in is not available. Please try again.");R();try{let e=await window.AppleID.auth.signIn(),t=await fetch("/api/auth/sso/apple",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id_token:e.authorization.id_token,oauth_code:e.authorization.code,user_email:e.user?.email??null,user_first_name:e.user?.name?.firstName??null,user_last_name:e.user?.name?.lastName??null,...O((0,C.getAttribution)())})}),a=await t.json();"finalize-required"===a.__type&&a.flow_id?(z(),j("sso"),Z("apple"),a.user_id&&(P.default.identify(a.user_id,{email:a.email??void 0,is_internal:(0,E.isInternalEmail)(a.email),sso_finalize_pending:!0,sso_provider:"apple"}),P.default.startSessionRecording({sampling:!0})),a.email&&A(a.email),a.first_name&&W(a.first_name),a.last_name&&q(a.last_name),H(!!a.needs_real_email),D(a.flow_id),w("finalize")):"login"===a.__type?window.location.assign(S(f,a.return_to)):"sso-account"===a.__type&&a.provider?(z(),Q(`This account uses ${a.provider}. Please sign in with ${a.provider} instead.`)):(z(),Q("Apple sign in failed. Please try again."))}catch(e){z(),e?.error!=="popup_closed_by_user"&&Q("Something went wrong. Please try again.")}},[f]),e_=(0,a.useCallback)(async e=>{if(e.preventDefault(),!T.trim())return void Q("phone"===_?"Please enter your phone number.":"Please enter your email address.");if(L&&ep.current===T.trim())return void w("verify");if("phone"===_)try{if(!(0,I.parsePhoneNumberWithError)(T.trim()).isValid())return void Q("Please enter a valid phone number.")}catch{Q("Please enter a valid phone number.");return}X(!0),Q(null);try{let e="phone"===_?ec[N]??229:void 0,a={identifier:T.trim(),channel:"phone"===_?"phone":"email",...void 0!==e?{country_id:e}:{}};await em.current;let n=await fetch("/api/auth/flow/begin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),s=await n.json();if("success"!==s.status.type){let e=s.payload;Q(e.message??"Something went wrong. Please try again.");return}let i=s.payload;if(D(i.flow_id),ep.current=T.trim(),el(60*("flow-started"===i.__type&&"none"!==i.dispatched_to)),"flow-started"===i.__type){var t;ei(i.account_exists),en(i.dispatched_to),ed(i.debug_otp_code??void 0),et((t={hasPassword:i.has_password,dispatchedTo:i.dispatched_to,emailFailed:i.email_failed}).emailFailed?"otp":t.hasPassword&&"none"===t.dispatchedTo?"password":"otp"),i.email_failed&&Q("We couldn't send your sign-in code. You can request a new one below."),w("verify")}else"finalize-required"===i.__type&&w("finalize")}catch{Q("Something went wrong. Please try again.")}finally{X(!1)}},[L,T,_,N]),ej=(0,a.useCallback)(async()=>{if(!(er>0)&&L)try{let e=await fetch("/api/auth/flow/resend",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flow_id:L})}),t=await e.json();if("success"!==t.status.type)return void Q("We couldn't send a new code. Please try again.");let a=t.payload;el(a.cooldown_seconds),a.sent?(en(a.dispatched_to),Q(null)):Q("Please wait a moment before requesting another code.")}catch{Q("We couldn't send a new code. Please try again.")}},[L,er]),eN=(0,a.useCallback)(async()=>{let e="phone"===_?ec[N]??229:void 0;try{let t=await fetch("/api/auth/flow/begin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identifier:T.trim(),channel:"phone"===_?"phone":"email",...void 0!==e?{country_id:e}:{},prefer_otp:!0})}),a=await t.json();if("success"!==a.status.type)return void Q("We couldn't send a code. Please try again.");let n=a.payload;D(n.flow_id),en(n.dispatched_to),n.email_failed||"none"===n.dispatched_to?Q("We couldn't send your sign-in code. You can request a new one below."):Q(null),el(0),et("otp")}catch{Q("We couldn't send a code. Please try again.")}},[T,_,N,ec]),eS=(0,a.useCallback)(()=>{j(e=>"phone"===e?"email":"phone"),A(""),D(null),ep.current=null,el(0),ei(null),Q(null)},[]);(0,a.useCallback)(e=>{A(e)},[]);let eC=(0,a.useCallback)(()=>
4{if("verify"===b){if("alternatives"===ee)return void et("otp");w("identity"),Q(null)}else"finalize"===b&&(w("identity"),D(null),ep.current=null,el(0),ei(null),Q(null),Z(void 0))},[b,ee]),eI=(0,a.useCallback)(()=>{e?e():g.push("/search")},[e,g]),eP=(0,a.useCallback)(()=>{e&&e(),g.push("/onboarding")},[e,g]),ek=(0,a.useCallback)(e=>{D(e),w("finalize")},[]),eT=(0,a.useCallback)(e=>{D(null),ep.current=null,ei(null),el(0),et("otp"),Q(e),w("identity"),Z(void 0)},[]),eE="verify"===b||"finalize"===b&&!c,eA=eE?(0,t.jsx)("button",{type:"button",onClick:eC,className:(0,v.cn)("flex size-8 items-center justify-center rounded-full text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",!y&&"absolute left-2 top-3 z-10"),"aria-label":"verify"===b&&"alternatives"===ee?"Back to code entry":"Go back",children:(0,t.jsx)(d.ArrowLeft,{className:"size-4"})}):null;return(0,t.jsxs)("div",{className:(0,v.cn)("relative flex-1 flex flex-col",eE&&!y&&"pt-10"),children:[eA&&(y?(0,n.createPortal)(eA,y):eA),(0,t.jsxs)(r.AnimatePresence,{mode:"wait",initial:!1,children:["identity"===b&&(0,t.jsx)(l.motion.div,{className:"flex-1 space-y-4 pb-6",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2,ease:[.25,.1,.25,1]},children:(0,t.jsx)(M,{inputMode:_,identifier:T,selectedCountryIso2:N,loading:G,error:K,sso:o,onIdentifierChange:e=>{if(A(e),"phone"!==_)return},onCountryChange:k,onSwitchMode:eS,onSubmit:e_,googleBtnRef:eg,onGoogleClick:eb,onAppleClick:ev})},"identity"),"verify"===b&&L&&(0,t.jsx)(l.motion.div,{className:"flex-1 flex flex-col pb-6",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2,ease:[.25,.1,.25,1]},children:(0,t.jsx)(B,{identifier:T,inputMode:_,flowId:L,loading:G,error:K,resendCooldown:er,accountExists:es,subView:ee,dispatchedTo:ea,debugOtpCode:eo,returnTo:f,onSubViewChange:et,onSuccess:eI,onFinalizeRequired:ek,onFlowRestart:eT,onResend:ej,onSwitchToOtp:eN})},"verify"),"finalize"===b&&L&&(0,t.jsx)(l.motion.div,{className:"flex-1 space-y-4",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2,ease:[.25,.1,.25,1]},children:(0,t.jsx)(U,{flowId:L,inputMode:_,identifier:T,initialFirstName:$,initialLastName:Y,needsRealEmail:V,ssoProvider:J,ssoUserId:x,onSuccess:eP,onBack:eC})},"finalize")]})]})}],503587)}]);

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.