1import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-BhjfaixL.js";import{t as r}from"./dist-vc8-vqPA.js";import{A as i,k as a}from"./QueryClientProvider-BP1U1FT_.js";import{r as o}from"./dist-CEWjkZ39.js";import{t as s}from"./utils-B6KiDbIe.js";import{t as c}from"./createLucideIcon-woUNXNh4.js";import{a as l,o as u}from"./dist-u87dkEyN.js";import{a as d,i as f,n as p,r as m,t as h}from"./select-NUc_Cj3a.js";import{A as g,D as _,N as v,S as y,j as b}from"./index-BzMKExGE.js";import{n as x,t as S}from"./label-DH1sFM99.js";import{t as C}from"./textarea-ep2DXuf1.js";var w=c(`life-buoy`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m4.93 4.93 4.24 4.24`,key:`1ymg45`}],[`path`,{d:`m14.83 9.17 4.24-4.24`,key:`1cb5xl`}],[`path`,{d:`m14.83 14.83 4.24 4.24`,key:`q42g0n`}],[`path`,{d:`m9.17 14.83-4.24 4.24`,key:`bqpfvv`}],[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}]]),T=c(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),E=e(n(),1),D=t(),O=Object.defineProperty,k=(e,t)=>O(e,`name`,{value:t,configurable:!0}),A=`Checkbox`,[j,M]=g(A),[N,P]=j(A);function F(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=_({prop:n,defaultProp:i??!1,onChange:c,caller:A}),[m,h]=E.useState(null),[g,v]=E.useState(null),y=E.useRef(!1),[b,x]=E.useReducer(e=>e+1,0),S=!m||!!o||!!m.closest(`form`),C={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:y,userInteractionCount:b,onUserInteraction:x,required:l,defaultChecked:!W(i)&&i,isFormControl:S,bubbleInput:g,setBubbleInput:v};return(0,D.jsx)(N,{scope:t,...C,children:U(d)?d(C):r})}k(F,`CheckboxProvider`);var I=`CheckboxTrigger`,L=E.forwardRef(k(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...i},a){let{control:s,value:c,disabled:l,checked:u,required:d,setControl:f,setChecked:p,hasConsumerStoppedPropagationRef:m,onUserInteraction:h,isFormControl:g,bubbleInput:_}=P(I,e),v=o(a,f),y=E.useRef(u);return E.useEffect(()=>{let e=s?.form;if(e){let t=k(()=>p(y.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[s,p]),(0,D.jsx)(r.button,{type:`button`,role:`checkbox`,"aria-checked":W(u)?`mixed`:u,"aria-required":d,"data-state":G(u),"data-disabled":l?``:void 0,disabled:l,value:c,...i,ref:v,onKeyDown:b(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:b(n,e=>{h(),p(e=>W(e)?!0:!e),_&&g&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())})})},`CheckboxTrigger`)),R=E.forwardRef(k(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,D.jsx)(F,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(L,{...d,ref:t,__scopeCheckbox:n}),e&&(0,D.jsx)(H,{__scopeCheckbox:n})]})})},`Checkbox`)),z=`CheckboxIndicator`,B=E.forwardRef(k(function(e,t){let{__scopeCheckbox:n,forceMount:i,...a}=e,o=P(z,n);return(0,D.jsx)(y,{present:i||W(o.checked)||o.checked===!0,children:(0,D.jsx)(r.span,{"data-state":G(o.checked),"data-disabled":o.disabled?``:void 0,...a,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),V=`CheckboxBubbleInput`,H=E.forwardRef(k(function({__scopeCheckbox:e,onClick:t,...n},i){let{control:a,hasConsumerStoppedPropagationRef:s,userInteractionCount:c,checked:u,defaultChecked:d,required:f,disabled:p,name:m,value:h,form:g,bubbleInput:_,setBubbleInput:v}=P(V,e),y=o(i,v),x=l(a),S=E.useRef(!1),C=E.useRef(u),w=E.useRef(c);E.useEffect(()=>{let e=_;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=c!==w.current;w.current=c;let i=C.current!==u;C.current=u;let a=!(r&&s.current);if(i&&n){S.current=!r;let t=new Event(`click`,{bubbles:a});e.indeterminate=W(u),n.call(e,!W(u)&&u),e.dispatchEvent(t),S.current=!1}},[_,u,s,c]);let T=E.useRef(!W(u)&&u);return(0,D.jsx)(r.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:d??T.current,required:f,disabled:p,name:m,value:h,form:g,...n,tabIndex:-1,ref:y,onClick:b(t,e=>{S.current&&e.stopPropagation()}),style:{...n.style,...x,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function U(e){return typeof e==`function`}k(U,`isFunction`);function W(e){return e===`indeterminate`}k(W,`isIndeterminate`);function G(e){return W(e)?`indeterminate`:e?`checked`:`unchecked`}k(G,`getState`);var K=E.forwardRef(({className:e,...t},n)=>(0,D.jsx)(R,{ref:n,className:s(`grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow cursor-pointer focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground`,e),...t,children:(0,D.jsx)(B,{className:s(`grid place-content-center text-current`),children:(0,D.jsx)(u,{className:`h-4 w-4`})})}));K.displayName=R.displayName;var q=a({method:`POST`}).handler(i(`2fd1006d525aeee183cc406da03448c6459782d0dd021f42670dcecf2a646070`)),J=[{value:`question`,label:`General question`},{value:`feedback`,label:`Feedback`},{value:`bug`,label:`Bug report`},{value:`employer_subscription`,label:`Subscription through my employer or medical insurer`},{value:`clinical_safety`,label:`Clinical safety concern`},{value:`other`,label:`Other`}],Y=`[email protected]`,X=`[email protected]`;function Z({region:e}){let[t,n]=(0,E.useState)({name:``,email:``,category:``,subject:``,message:``,babyAge:``,device:``,consent:!1}),[r,i]=(0,E.useState)(`idle`),[a,o]=(0,E.useState)({}),[s,c]=(0,E.useState)(``);function l(e,t){n(n=>({...n,[e]:t})),a[e]&&o(t=>({...t,[e]:``}))}function u(){let e={};return t.name.trim()||(e.name=`Name is required`),t.email.trim()?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t.email.trim())||(e.email=`Enter a valid email address`):e.email=`Email is required`,t.category||(e.category=`Please choose a category`),t.message.trim()||(e.message=`Me
1ssage is required`),t.consent||(e.consent=`Please agree to be contacted`),o(e),Object.keys(e).length===0}async function g(r){if(r.preventDefault(),u()){i(`submitting`);try{await q({data:{name:t.name.trim(),email:t.email.trim(),category:t.category,subject:t.subject.trim()||null,message:t.message.trim(),babyAge:t.babyAge.trim()||null,device:t.device.trim()||null,region:e||null,userAgent:typeof navigator<`u`?navigator.userAgent:null,consent:!0}}),c(t.category),i(`success`),n({name:``,email:``,category:``,subject:``,message:``,babyAge:``,device:``,consent:!1})}catch(e){console.error(`Support form failed`,e),i(`error`)}}}return r===`success`?(0,D.jsxs)(`div`,{className:`rounded-2xl border border-primary/40 bg-primary/5 p-6`,children:[(0,D.jsx)(`h3`,{className:`text-lg font-bold`,children:`Thank you`}),(0,D.jsxs)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:[`We have received your message and will acknowledge it within 24 hours.`,s===`clinical_safety`&&(0,D.jsxs)(D.Fragment,{children:[` `,`Because you selected a clinical safety concern, it has gone straight to our clinical team.`]})]}),(0,D.jsxs)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:[`If you need to follow up, email us at`,` `,(0,D.jsx)(`a`,{href:`mailto:${s===`clinical_safety`?Y:X}`,className:`font-semibold underline underline-offset-4 transition-opacity hover:opacity-70`,children:s===`clinical_safety`?Y:X}),`.`]}),(0,D.jsx)(v,{className:`mt-4`,onClick:()=>i(`idle`),children:`Send another message`})]}):(0,D.jsxs)(`form`,{onSubmit:g,className:`space-y-5`,noValidate:!0,children:[(0,D.jsxs)(`div`,{className:`grid gap-5 md:grid-cols-2`,children:[(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsx)(S,{htmlFor:`support-name`,children:`Name`}),(0,D.jsx)(x,{id:`support-name`,value:t.name,onChange:e=>l(`name`,e.target.value),"aria-invalid":!!a.name}),a.name&&(0,D.jsx)(`p`,{className:`text-xs text-destructive`,children:a.name})]}),(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsx)(S,{htmlFor:`support-email`,children:`Email`}),(0,D.jsx)(x,{id:`support-email`,type:`email`,value:t.email,onChange:e=>l(`email`,e.target.value),"aria-invalid":!!a.email}),a.email&&(0,D.jsx)(`p`,{className:`text-xs text-destructive`,children:a.email})]})]}),(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsx)(S,{htmlFor:`support-category`,children:`What is your message about?`}),(0,D.jsxs)(h,{value:t.category,onValueChange:e=>l(`category`,e),children:[(0,D.jsx)(f,{id:`support-category`,"aria-invalid":!!a.category,children:(0,D.jsx)(d,{placeholder:`Choose a category`})}),(0,D.jsx)(p,{children:J.map(e=>(0,D.jsx)(m,{value:e.value,children:e.label},e.value))})]}),a.category&&(0,D.jsx)(`p`,{className:`text-xs text-destructive`,children:a.category}),t.category===`clinical_safety`&&(0,D.jsx)(`p`,{className:`text-sm text-destructive`,children:`If you or your child may be seriously unwell, call your local emergency number. For a clinical safety concern about the app, we will prioritise your message.`})]}),(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsxs)(S,{htmlFor:`support-subject`,children:[`Subject `,(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:`(optional)`})]}),(0,D.jsx)(x,{id:`support-subject`,value:t.subject,onChange:e=>l(`subject`,e.target.value)})]}),(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsx)(S,{htmlFor:`support-message`,children:`Message`}),(0,D.jsx)(C,{id:`support-message`,rows:5,value:t.message,onChange:e=>l(`message`,e.target.value),"aria-invalid":!!a.message}),a.message&&(0,D.jsx)(`p`,{className:`text-xs text-destructive`,children:a.message})]}),(0,D.jsxs)(`div`,{className:`grid gap-5 md:grid-cols-2`,children:[(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsxs)(S,{htmlFor:`support-baby-age`,children:[`Baby's age `,(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:`(optional)`})]}),(0,D.jsx)(x,{id:`support-baby-age`,value:t.babyAge,onChange:e=>l(`babyAge`,e.target.value),placeholder:`e.g. 6 months, due in 3 weeks`})]}),(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsxs)(S,{htmlFor:`support-device`,children:[`Device `,(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:`(optional)`})]}),(0,D.jsx)(x,{id:`support-device`,value:t.device,onChange:e=>l(`device`,e.target.value),placeholder:`e.g. iPhone 15, Android`})]})]}),(0,D.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,D.jsx)(K,{id:`support-consent`,checked:t.consent,onCheckedChange:e=>l(`consent`,e===!0),"aria-invalid":!!a.consent}),(0,D.jsxs)(`div`,{className:`grid gap-1 leading-none`,children:[(0,D.jsx)(S,{htmlFor:`support-consent`,className:`text-sm font-normal`,children:`I agree that Parent Sense can store and use my details to respond to this message.`}),(0,D.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`We handle your information as set out in our`,` `,(0,D.jsx)(`a`,{href:`/privacy-policy`,className:`underline underline-offset-2 hover:text-foreground`,children:`privacy policy`})]}),a.consent&&(0,D.jsx)(`p`,{className:`text-xs text-destructive`,children:a.consent})]})]}),r===`error`&&(0,D.jsxs)(`p`,{className:`text-sm text-destructive`,children:[`Sorry, we couldn't send your message. Please try again or email`,` `,(0,D.jsx)(`a`,{href:`mailto:${X}`,className:`font-semibold underline underline-offset-4 transition-opacity hover:opacity-70`,children:X}),`.`]}),(0,D.jsx)(v,{type:`submit`,disabled:r===`submitting`,children:r===`submitting`?`Sending...`:`Send message`})]})}
1export{T as n,w as r,Z as t};
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.