1import{a as l,j as e}from"./vendor-query-CRhh6spR.js";import{S as A}from"./SiteFooter-TTNglDDv.js";import{b as T,I as y,B as N,h as r,s as v}from"./index-BkVb42KZ.js";import{L as d}from"./label-Xk_s6Ck5.js";import{C as B}from"./checkbox-C5dv2RGl.js";import{K}from"./KnucklLogo-Cu1rMULr.js";import{H as O}from"./Head-B4hXUiBE.js";import{t as W,f as b,W as E}from"./rate-limiter-WC2fj22N.js";import{L as p}from"./vendor-react-BAmwgVqg.js";import{H as F}from"./hard-hat-DFuF37sz.js";import{M as _}from"./mail-DS62qYck.js";import{C as z}from"./circle-check-BibDl6sq.js";import{A as R}from"./arrow-left-B9mh4lKG.js";import{o as U,b as D,s as w,l as k}from"./types-OJGJKHt5.js";import"./textarea-BQTQ5UjX.js";import"./feedback-B_lOwORB.js";import"./appReview-Bk4fLWAZ.js";import"./check-BtcgJ1Z4.js";import"./star-BpldOkBP.js";import"./lightbulb-DpFV_zaq.js";import"./bug-CC6EGtcS.js";import"./heart-eiWSLpyF.js";import"./send-5x2Iukow.js";import"./message-square-plus-C0jguNXr.js";import"./vendor-charts-BVeOEGzI.js";import"./vendor-stripe-2y4Jo9_W.js";import"./vendor-supabase-Csx7YFID.js";function je(){const{t:n}=T(),s=n.waitlist,C=U({email:w().trim().max(255,s.emailMax).refine(t=>!t||/^[^\s@]+@[^\s@]+\.[a-zA-Z]{2,}$/.test(t),{message:s.emailInvalid}).optional().or(k("")),phone:w().trim().refine(t=>!t||/^\+?[1-9]\d{6,14}$/.test(t.replace(/[\s()-]/g,"")),{message:s.phoneInvalid}).optional().or(k("")),smsOptIn:D()}).refine(t=>t.email&&t.email.length>0||t.phone&&t.phone.length>0,{message:s.emailOrPhoneRequired}),[a,S]=l.useState(""),[i,I]=l.useState(""),[m,L]=l.useState(!1),[x,u]=l.useState(!1),[M,h]=l.useState(!1),H=async t=>{t.preventDefault();const f=C.safeParse({email:a,phone:i,smsOptIn:m});if(!f.success){r.error(f.error.issues[0].message);return}const g=W(E);if(!g.allowed){r.error(n.validations.tooManySubmissions.replace("{retry}",b(g.retryAfterMs)));return}u(!0);try{const c=crypto.randomUUID(),P=a.trim()||null,j=i.trim().replace(/[\s()-]/g,"")||null,{error:o}=await v.from("waitlist_signups").insert({id:c,email:P,phone:j,sms_opt_in:m&&!!j});if(o){if(o.code==="23505"){r.info(s.alreadyOnList),h(!0);return}if(o.code==="22023"){r.error(i.trim()&&!a.trim()?s.phoneInvalid:s.emailInvalid);return}if(o.code==="53400"){r.error(n.validations.tooManyAttempts.replace("{retry}",b(60*60*1e3)));return}throw o}await v.functions.invoke("waitlist-signup-email",{body:{signupId:c}}),h(!0)}catch{r.error(s.somethingWentWrong)}finally{u(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(O,{title:"Join the Knuckl Waitlist | Construction Marketplace",description:"Get early access to Knuckl. Post work, find work, bid work.",noindex:!0}),e.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[e.jsx("header",{className:"p-4",children:e.jsx(p,{to:"/",className:"inline-block",children:e.jsx(K,{className:"h-8"})})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 pb-16",children:e.jsx("div",{className:"w-full max-w-md",children:M?e.jsxs("div",{className:"text-center space-y-6",children:[e.jsx("div",{className:"mx-auto h-16 w-16 rounded-full bg-success/10 flex items-center justify-center",children:e.jsx(z,{className:"h-8 w-8 text-success"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:s.successHeading}),e.jsx("p",{className:"text-muted-foreground leading-relaxed",children:a.trim()&&i.trim()?s.successBodyBoth:a.trim()?s.successBodyEmail:s.successBodyPhone})]}),e.jsx(p,{to:"/",children:e.jsxs(N,{variant:"outline",className:"gap-2",children:[e.jsx(R,{className:"h-4 w-4"}),s.backToHome]})})]}):e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx("div",{className:"mx-auto h-16 w-16 rounded-card bg-primary/10 flex items-center justify-center",children:e.jsx(F,{className:"h-8 w-8 text-primary"})}),e.jsx("h1",{className:"text-2xl font-bold text-foreground tracking-tight",children:s.heading}),e.jsx("p",{className:"text-muted-foreground leading-relaxed",children:s.intro})]}),e.jsxs("form",{onSubmit:H,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(d,{htmlFor:"waitlist-email",children:s.emailLabel}),e.jsx(y,{id:"waitlist-email",type:"email",name:"email",inputMode:"email",autoComplete:"email",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,enterKeyHint:"next",placeholder:s.emailPlaceholder,value:a,onChange:t=>S(t.target.value),className:"mt-1"})]}),e.jsxs("div",{className:"relative flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 h-px bg-border"}),e.jsx("span",{className:"text-xs text-muted-foreground px-2",children:s.or}),e.jsx("div",{className:"flex-1 h-px bg-border"})]}),e.jsxs("div",{children:[e.jsx(d,{htmlFor:"waitlist-phone",children:s.phoneLabel}),e.jsx(y,{id:"waitlist-phone",type:"tel",name:"phone",inputMode:"tel",autoComplete:"tel",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,enterKeyHint:"go",placeholder:s.phonePlaceholder,value:i,onChange:t=>I(t.target.value),className:"mt-1"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(B,{id:"sms-opt-in",checked:m,onCheckedChange:t=>L(t===!0),className:"mt-0.5"}),e.jsxs(d,{htmlFor:"sms-opt-in",className:"text-xs text-muted-foreground font-normal leading-snug cursor-pointer",children:[s.smsConsent," ",e.jsx("a",{href:"/sms-opt-in.html",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"View SMS terms"})]})]}),e.jsxs(N,{type:"submit",className:"w-full gap-2",disabled:x,children:[e.jsx(_,{className:"h-4 w-4"}),x?s.signingUp:s.joinCta]})]}),e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s.noSpam}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.readOur," ",e.jsx(p,{to:"/privacy",className:"text-primary hover:underline",children:s.privacyPolicy})]})]})]})})}),e.jsx(A,{})]})]})}export{je as default};
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.