1import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{i as n,r}from"./framework-BlZLPK95.js";import{t as i}from"./createLucideIcon-DQqBYLo1.js";import{t as a}from"./arrow-up-right-Bvvsb1Pm.js";import{S as o,g as s,h as c,m as l,o as u,p as d,r as f,s as p,t as m}from"./utils-C-sVO1wv.js";import{i as h,t as g}from"./shadowDom-CxEFe58L.js";import{t as _}from"./button-BPmGF07k.js";import{T as v,useLanguage as y}from"./language-eZb1juyP.js";import{d as b,h as x,r as S,t as C}from"./useBaseUiId-fudnyjjl.js";var w=i(`lock-keyhole`,[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]),T=i(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),E=t(n(),1),D={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},O={disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},k={valid(e){return e===null?null:e?{"data-valid":``}:{"data-invalid":``}}},A={invalid:void 0,name:void 0,validityData:{state:D,errors:[],error:``,value:``,initialValue:null},setValidityData:p,disabled:void 0,setTouched:p,setDirty:p,setFilled:p,setFocused:p,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:O,registerFieldControl:p,validation:{getValidationProps:(e,t=u)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:p,getInputControl:()=>null,commit:async()=>{},change:p}},j=E.createContext(A);function M(e=!0){let t=E.useContext(j);if(t.setValidityData===p&&!e)throw Error(d(28));return t}var N=E.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:p,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function P(){return E.useContext(N)}var F=E.createContext({controlId:void 0,registerControlId:p,labelId:void 0,setLabelId:p,messageIds:[],setMessageIds:p,getDescriptionProps:e=>e});function I(){return E.useContext(F)}function L(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=I(),u=C(t),d=n?i:void 0,f=s(()=>Symbol()),m=E.useRef(!1),h=E.useRef(t!=null),g=c(()=>{m.current&&a!==p&&(m.current=!1,a(f.current,void 0))});return l(()=>{if(a===p)return;let e;if(n){let n=r?.current;e=o(n)&&n.closest(`label`)!=null?t??null:d??u}else if(t!=null)h.current=!0,e=t;else if(h.current)e=u;else{g();return}if(e===void 0){g();return}m.current=!0,a(f.current,e)},[t,r,d,a,n,u,f,g]),E.useEffect(()=>g,[g]),i??u}function R(e,t,n,r,i=!0,a){let{registerFieldControl:o}=M(),c=s(()=>Symbol());l(()=>{let s=c.current;if(!i){o(s,void 0);return}o(s,{controlRef:e,getValue:r,id:t,name:a,value:n})},[e,i,r,t,a,o,c,n]),l(()=>{let e=c.current;return()=>{o(e,void 0)}},[o,c])}var z=E.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:u,defaultValue:d,autoFocus:p=!1,style:m,..._}=e,{state:v,name:y,disabled:C,setTouched:w,setDirty:T,validityData:D,setFocused:O,setFilled:A,validationMode:j,validation:N}=M(),{clearErrors:F}=P(),z=C||s,B=y??a,V={...v,disabled:z},{labelId:H}=I(),U=L({id:i});l(()=>{let e=o!=null;N.inputRef.current?.value||e&&o!==``?A(!0):e&&o===``&&A(!1)},[N.inputRef,A,o]);let W=E.useRef(null);l(()=>{p&&W.current===g(h(W.current))&&O(!0)},[p,O]);let[G]=x({controlled:o,default:d,name:`FieldControl`,state:`value`}),K=o!==void 0,q=K?G:void 0,J=c(()=>N.inputRef.current?.value);return R(N.inputRef,U,q,J,!z,a),f(`input`,e,{ref:[t,W],state:V,props:[{id:U,disabled:z,name:B,ref:N.inputRef,"aria-labelledby":H,autoFocus:p,...K?{value:q}:{defaultValue:d},onChange(e){let t=e.currentTarget.value;u?.(t,S(b,e.nativeEvent)),T(t!==(D.initialValue??``)),A(t!==``),e.nativeEvent.defaultPrevented||(F(B),N.change(t))},onFocus(){O(!0)},onBlur(e){w(!0),O(!1),j===`onBlur`&&N.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(w(!0),N.commit(e.currentTarget.value))}},_,e=>N.getValidationProps(z,e)],stateAttributesMapping:k})}),B=r(),V=E.forwardRef(function(e,t){return(0,B.jsx)(z,{ref:t,...e})});function H({className:e,type:t,...n}){return(0,B.jsx)(V,{type:t,"data-slot":`input`,className:m(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function U({className:e,...t}){return(0,B.jsx)(`textarea`,{"data-slot":`textarea`,className:m(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}var W=e({VisitorForm:()=>G});function G({kind:e,page:t}){let{t:n}=y(),r=(0,E.useId)(),i=e===`private`,[o,s]=(0,E.useState)(`idle`),[c,l]=(0,E.useState)(``);async function u(e){e.preventDefault();let n=e.currentTarget,r=Object.fromEntries(new FormData(n));s(`sending`),l(``);try{let e=await fetch(i?`/api/messages`:`/api/comments`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...r,page:t})}),a=await e.json();if(!e.ok)throw Error(a.error??`The message was not sent.`);s(`success`),l(i?`Your private message has been saved to the ownerâs inbox. It will not appear in public comments.`:`Thank you. Your comment is saved and awaiting review. It will appear on this page after approval.`),n.reset()}catch(e){s(`error`),l(e instanceof Error?e.message:`The connection failed. Please try again.`)}}return(0,B.jsxs)(`form`,{onSubmit:u,className:`visitor-form`,children:[(0,B.jsxs)(`div`,{className:`form-row`,children:[(0,B.jsxs)(`label`,{htmlFor:r+`-name`,children:[(0,B.jsx)(v,{children:i?`Your name`:`Public display name`}),(0,B.jsx)(H,{id:r+`-name`,name:`name`,autoComplete:`name`,maxLength:80,required:!0,placeholder:n(`How should I address you?`)})]}),i&&(0,B.jsxs)(`label`,{htmlFor:r+`-email`,children:[(0,B.jsx)(v,{children:`Reply email`}),(0,B.jsx)(H,{id:r+`-email`,name:`email`,type:`email`,autoComplete:`email`,maxLength:254,required:!0,placeholder:`[email protected]`})]})]}),i&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{htmlFor:r+`-org`,children:[(0,B.jsx)(v,{children:`Organization`}),(0,B.jsx)(`span`,{children:(0,B.jsx)(v,{children:`(optional)`})}),(0,B.jsx)(H,{id:r+`-org`,name:`organization`,autoComplete:`organization`,maxLength:150})]}),(0,B.jsxs)(`label`,{htmlFor:r+`-subject`,children:[(0,B.jsx)(v,{children:`Subject`}),(0,B.jsx)(H,{id:r+`-subject`,name:`subject`,maxLength:160,required:!0,placeholder:n(`A question, an idea, a collaborationâ¦`)})]})]}),(0,B.jsxs)(`label`,{htmlFor:r+`-body`,children:[(0,B.jsx)(v,{children:i?`Private message`:`Your comment`}),(0,B.jsx)(U,{id:r+`-body`,name:`body`,required:!0,maxLength:i?5e3:2e3,rows:i?6:4,placeholder:n(i?`Tell me what youâre thinking about.`:`Add a question or a thoughtful observation about this page.`)})]}),(0,B.jsx)(`div`,{className:`form-trap`,"aria-hidden":`true`,children:(0,B.jsxs)(`label`,{htmlFor:r+`-website`,children:[(0,B.jsx)(v,{children:`Leave this empty`}),(0,B.jsx)(H,{id:r+`-website`,name:`website`,tabIndex:-1,autoComplete:`off`})]})}),(0,B.jsxs)(`label`,{className:`consent-line`,children:[(0,B.jsx)(`input`,{type:`checkbox`,required:!0}),(0,B.jsx)(v,{children:i?`I agree to share this information privately with the site owner so they can respond.`:`I understand that my display name and comment may be published after review. I have not included private contact details.`})]}),(0,B.jsxs)(`div`,{className:`form-actions`,children:[(0,B.jsxs)(_,{type:`submit`,disabled:o===`sending`,className:`send-button`,children:[i?(0,B.jsx)(w,{size:16}):(0,B.jsx)(T,{size:16}),(0,B.jsx)(v,{children:o===`sending`?`Sendingâ¦`:i?`Send private message`:`Submit for review`}),(0,B.jsx)(a,{size:16})]}),(0,B.jsx)(`span`,{children:(0,B.jsx)(v,{children:i?`Private · owner-only inbox`:`Public · reviewed before appearing`})})]}),c&&(0,B.jsx)(`p`,{className:`form-result `+o,role:o===`error`?`alert`:`status`,children:(0,B.jsx)(v,{children:c})})]})}export{W as n,T as r,G 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.