1import{a as _e,r as x,j as e,Y as Be,I as me,u as Le,m as Fe}from"./index-B3pqyAJu-a11ffbb081c7.js";import{p as ke,b as Ue,u as Re,g as Oe,i as E,f as $e,s as ee,d as He,c as We,h as Ye,j as qe}from"./publicFormSchema-C5gy27oR-a11ffbb081c7.js";import{F as Ce,a as Ge}from"./FormHeaderImage-C5Tb3yWD-a11ffbb081c7.js";import{s as Je}from"./model-ITYZaxy2-a11ffbb081c7.js";import{T as Ve}from"./type-Dxj6MHEF-a11ffbb081c7.js";import{C as Ze}from"./calendar-clock-C7fibYHL-a11ffbb081c7.js";import{P as Qe}from"./palette-B5XPIY8S-a11ffbb081c7.js";import{R as Ke}from"./rotate-ccw-Dqoybf3j-a11ffbb081c7.js";import{T as ze}from"./trash-2-CnTsVE3s-a11ffbb081c7.js";import{C as ue}from"./check-B0pPilp1-a11ffbb081c7.js";import{C as Xe}from"./clipboard--rQUoxUO-a11ffbb081c7.js";import{E as et}from"./earth-BFAtqOQj-a11ffbb081c7.js";import{L as tt}from"./link-2-CXyXzx4x-a11ffbb081c7.js";import{M as st}from"./megaphone-mwypd0CP-a11ffbb081c7.js";import{E as lt}from"./eye-BotVkh0A-a11ffbb081c7.js";import{A as at}from"./arrow-left-8kd6IdZq-a11ffbb081c7.js";import{S as it}from"./settings-2-Smbyg374-a11ffbb081c7.js";import{E as rt}from"./external-link-BCooE84a-a11ffbb081c7.js";import{C as nt}from"./copy-DxqRlHSQ-a11ffbb081c7.js";/** 2 * @license lucide-react v0.453.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const pe=_e("ImageUp",[["path",{d:"M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21",key:"9csbqa"}],["path",{d:"m14 19.5 3-3 3 3",key:"9vmjn0"}],["path",{d:"M17 22v-5.5",key:"1aa6fl"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);function ot({open:a,field:l,onClose:p,onSave:n}){const[i,d]=x.useState(l);x.useEffect(()=>d(l),[l]);const N=!!(a&&i),o=(i==null?void 0:i.type)==="select"||(i==null?void 0:i.type)==="multiselect"||(i==null?void 0:i.type)==="radio",z=x.useMemo(()=>((i==null?void 0:i.options)??[]).join(` 7`),[i==null?void 0:i.options]);if(!N||!i)return null;const b="mt-2 w-full rounded-xl border border-white/10 bg-black/30 px-4 py-3 text-sm text-white outline-none placeholder:text-zinc-600 focus:border-[#D4A843]",j="block text-sm font-bold text-zinc-200";return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4 backdrop-blur-sm",children:e.jsxs("div",{className:"max-h-[92vh] w-full max-w-xl overflow-y-auto rounded-2xl border border-white/10 bg-[#18181b] p-6 text-zinc-100 shadow-2xl",children:[e.jsxs("div",{className:"mb-5 flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-black uppercase tracking-[0.14em] text-[#D4A843]",children:"Field settings"}),e.jsxs("div",{className:"mt-1 text-xl font-bold text-white",children:["Edit â",i.label,"â"]}),e.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"Change what the guest sees and how the answer is stored."})]}),e.jsx("button",{className:"rounded-lg border border-white/10 px-3 py-1.5 text-sm font-medium text-zinc-400 transition hover:bg-white/5 hover:text-white",onClick:p,children:"Close"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:j,children:["Field key ",e.jsx("span",{className:"font-normal text-zinc-500",children:"(advanced)"})]}),e.jsx("input",{className:`${b} font-mono`,value:i.id,onChange:m=>d({...i,id:m.target.value.toLowerCase().replace(/[^a-z0-9_]+/g,"_")}),placeholder:"customer_question"}),e.jsx("div",{className:"mt-1 text-xs text-zinc-500",children:"Used in submissions and integrations. Keep it unique."})]}),e.jsxs("div",{children:[e.jsx("label",{className:j,children:"Question or label shown to guests"}),e.jsx("input",{className:b,value:i.label,onChange:m=>d({...i,label:m.target.value})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:j,children:"Answer type"}),e.jsxs("select",{className:`${b} [color-scheme:dark]`,value:i.type,onChange:m=>d({...i,type:m.target.value}),children:[e.jsx("option",{value:"text",children:"Text"}),e.jsx("option",{value:"phone",children:"Phone"}),e.jsx("option",{value:"email",children:"Email"}),e.jsx("option",{value:"date",children:"Date"}),e.jsx("option",{value:"birthday",children:"Birthday (MM-DD-YYYY)"}),e.jsx("option",{value:"url",children:"Website / URL"}),e.jsx("option",{value:"number",children:"Number"}),e.jsx("option",{value:"time",children:"Time"}),e.jsx("option",{value:"textarea",children:"Textarea"}),e.jsx("option",{value:"select",children:"Select (dropdown)"}),e.jsx("option",{value:"multiselect",children:"Multi-select (checkboxes)"}),e.jsx("option",{value:"radio",children:"Radio buttons"}),e.jsx("option",{value:"checkbox",children:"Checkbox"}),e.jsx("option",{value:"file",children:"File Upload"}),e.jsx("option",{value:"image",children:"Image Upload"}),e.jsx("option",{value:"heading",children:"Heading / divider"}),e.jsx("option",{value:"paragraph",children:"Paragraph / instructions"}),e.jsx("option",{value:"hidden",children:"Hidden value"})]})]}),e.jsxs("label",{className:"flex items-center gap-3 pt-8 text-sm font-bold text-zinc-200",children:[e.jsx("input",{type:"checkbox",checked:!!i.required,onChange:m=>d({...i,required:m.target.checked}),className:"h-5 w-5 rounded accent-[#D4A843]"}),"Required answer"]})]}),!["heading","paragraph"].includes(i.type)&&e.jsxs("div",{children:[e.jsx("label",{className:j,children:"Placeholder or example"}),e.jsx("input",{className:b,value:i.placeholder??"",onChange:m=>d({...i,placeholder:m.target.value})})]}),(i.type==="text"||i.type==="textarea")&&e.jsxs("div",{children:[e.jsx("label",{className:j,children:"Maximum characters"}),e.jsx("input",{className:b,type:"number",min:1,max:1e4,value:i.maxLength??"",onChange:m=>d({...i,maxLength:m.target.value?Number(m.target.value):void 0}),placeholder:i.type==="textarea"?"Default: 2,000":"Default: 120"}),e.jsx("div",{className:"mt-1 text-xs text-zinc-500",children:"Leave blank to use the website standard for this field."})]}),o&&e.jsxs("div",{children:[e.jsxs("label",{className:j,children:["Choices ",e.jsx("span",{className:"font-normal text-zinc-500",children:"(one per line)"})]}),e.jsx("textarea",{className:`${b} font-mono text-xs`,rows:6,value:z,onChange:m=>d({...i,options:m.target.value.split(` 8`).map(h=>
8h.trim()).filter(Boolean)})})]}),i.type==="hidden"&&e.jsxs("div",{children:[e.jsx("label",{className:j,children:"Hidden value"}),e.jsx("input",{className:b,value:String(i.default??""),onChange:m=>d({...i,default:m.target.value})})]}),e.jsxs("div",{children:[e.jsxs("label",{className:j,children:["CRM destination ",e.jsx("span",{className:"font-normal text-zinc-500",children:"(optional, advanced)"})]}),e.jsx("input",{className:`${b} font-mono`,value:i.mapTo??"",onChange:m=>d({...i,mapTo:m.target.value}),placeholder:"guest.phone, guest.full_name, submission.city, ..."})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-3",children:[e.jsx("button",{className:"rounded-xl border border-white/10 px-4 py-2.5 text-sm font-bold text-zinc-300 transition hover:bg-white/5",onClick:p,children:"Cancel"}),e.jsx("button",{className:"rounded-xl bg-[#D4A843] px-5 py-2.5 text-sm font-black text-black transition hover:bg-[#E6C56B]",onClick:()=>n(i),children:"Apply"})]})]})]})})}function ct(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z",stroke:"currentColor",strokeWidth:"2"}),e.jsx("circle",{cx:"12",cy:"12",r:"3",stroke:"currentColor",strokeWidth:"2"})]})}function dt(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M14.7 6.3a5 5 0 0 0-6.9 6.9L3 18l3 3 4.8-4.8a5 5 0 0 0 6.9-6.9l-3 3-2.1-2.1 3.1-3.9Z",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"})})}function be(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("path",{d:"M12 20h9",stroke:"currentColor",strokeWidth:"2"}),e.jsx("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5Z",stroke:"currentColor",strokeWidth:"2"})]})}function ge(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("path",{d:"M3 6h18",stroke:"currentColor",strokeWidth:"2"}),e.jsx("path",{d:"M8 6V4h8v2",stroke:"currentColor",strokeWidth:"2"}),e.jsx("path",{d:"M6 6l1 16h10l1-16",stroke:"currentColor",strokeWidth:"2"})]})}function fe(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M12 5l-7 7h14l-7-7Z",fill:"currentColor"})})}function ve(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M12 19l7-7H5l7 7Z",fill:"currentColor"})})}function je(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M12 5v14M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}const xt=[{value:"public",label:"Standard link",icon:et,description:"Use on the website, social profiles, email, or anywhere guests can click."},{value:"unlisted",label:"Unlisted link",icon:tt,description:"Only people with the link can find it. It is not promoted in website navigation."},{value:"campaign",label:"Campaign / QR",icon:st,description:"Use for flyers, ads, QR codes, and tracked campaign links."}],ht=["#D4A843","#8B5CF6","#7BC1BC","#EC4899","#F97316","#2563EB"];function we(a){if(!a)return"";const l=new Date(a);return Number.isNaN(l.getTime())?"":new Date(l.getTime()-l.getTimezoneOffset()*6e4).toISOString().slice(0,16)}function mt({form:a,settings:l,onFormChange:p,onSettingsChange:n}){var M,A;const[i,d]=x.useState("content"),[N,o]=x.useState(!1),[z,b]=x.useState(""),[j,m]=x.useState(!1),h=x.useRef(null),k=(l==null?void 0:l.rollout)??{},C=typeof(l==null?void 0:l.theme)=="object"?l.theme:{card:(l==null?void 0:l.theme)==="light"?"light":"dark",buttonText:(l==null?void 0:l.submitButtonText)||"Submit",buttonColor:"#D4A843"},D=!!String(l.headerTitle||"").trim(),v=D?l.headerTitle:a.title||"",L=D?l.headerDescription??a.description??"":a.description||"",$=D&&(l.headerTitle!==(a.title||"")||(l.headerDescription??a.description??"")!==(a.description||"")),F=ke(a.slug),H=Ue(a.slug,typeof window>"u"?void 0:window.location.origin),U=x.useMemo(()=>a.status==="archived"?{tone:"text-zinc-300",title:"Archived",detail:"This form is stored but cannot accept entr
8ies."}:a.status!=="published"?{tone:"text-amber-300",title:"Draft â not live",detail:"Save your work, then choose Save & go live when it is ready."}:k.opensAt&&new Date(k.opensAt).getTime()>Date.now()?{tone:"text-sky-300",title:"Published and scheduled",detail:"The link works now, but entries begin at the scheduled opening time."}:{tone:"text-emerald-300",title:"Published â live",detail:"Saving this form updates the public page without unpublishing it."},[a.status,k.opensAt]),I=t=>{n({...l,rollout:{...k,...t}})},T=t=>{n({...l,theme:{...C,...t}})},R=()=>{n({...l,headerTitle:a.title||"",headerDescription:a.description||""})},J=async()=>{try{await navigator.clipboard.writeText(H),o(!0),window.setTimeout(()=>o(!1),1800)}catch{o(!1)}},O=async t=>{var g;if(t){if(t.size>10*1024*1024){b("Header images must be 10 MB or smaller.");return}m(!0),b("Importing and formatting the imageâ¦");try{const w=await Re(a.id,t);n({...l,headerImage:{...w.headerImage,alt:((g=l.headerImage)==null?void 0:g.alt)||`${v||a.title||"Form"} header image`}}),b("Image imported. Save the form to publish this change.")}catch(w){b((w==null?void 0:w.message)||"The header image could not be imported.")}finally{m(!1),h.current&&(h.current.value="")}}},V=()=>{const t={...l};delete t.headerImage,n(t),b("Header image removed. Save the form to publish this change.")},Z=[{value:"content",label:"Content & link",icon:Ve},{value:"rollout",label:"Go-live rules",icon:Ze},{value:"appearance",label:"Appearance & response",icon:Qe}];return e.jsxs("section",{className:"rounded-2xl border border-white/10 bg-[#18181b] text-zinc-100 shadow-2xl",children:[e.jsxs("div",{className:"border-b border-white/10 px-5 pt-5",children:[e.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-black uppercase tracking-[0.16em] text-[#D4A843]",children:"Form setup"}),e.jsx("h2",{className:"mt-1 text-xl font-bold text-white",children:"Edit exactly what guests will see"}),e.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"Content, launch rules, and styling are separated so a copied form cannot hide old template settings."})]}),e.jsxs("div",{className:`rounded-xl border border-white/10 bg-black/25 px-4 py-3 ${U.tone}`,children:[e.jsx("div",{className:"text-sm font-bold",children:U.title}),e.jsx("div",{className:"mt-0.5 max-w-md text-xs text-zinc-400",children:U.detail})]})]}),e.jsx("div",{className:"mt-5 flex flex-wrap gap-2",children:Z.map(t=>{const g=t.icon;return e.jsxs("button",{type:"button",onClick:()=>d(t.value),className:`inline-flex items-center gap-2 rounded-t-xl border border-b-0 px-4 py-3 text-sm font-bold transition ${i===t.value?"border-white/15 bg-[#242429] text-white":"border-transparent text-zinc-500 hover:text-zinc-200"}`,children:[e.jsx(g,{className:"h-4 w-4"}),t.label]},t.value)})})]}),e.jsxs("div",{className:"bg-[#242429] p-5",children:[i==="content"&&e.jsxs("div",{className:"space-y-5",children:[$&&e.jsxs("div",{className:"flex flex-col gap-3 rounded-xl border border-amber-400/30 bg-amber-400/10 p-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-bold text-amber-200",children:"This copy still contains public text from the original form."}),e.jsxs("div",{className:"mt-1 text-sm text-amber-100/70",children:["The live page currently shows â",v,",â even though the form is named â",a.title,".â"]})]}),e.jsxs("button",{type:"button",onClick:R,className:"inline-flex shrink-0 items-center justify-center gap-2 rounded-xl bg-amber-300 px-4 py-2 text-sm font-black text-black",children:[e.jsx(Ke,{className:"h-4 w-4"}),"Use this formâs name"]})]}),e.jsxs("div",{className:"grid gap-5 lg:grid-cols-2",children:[e.jsxs("label",{className:"block text-sm font-bold text-zinc-200",children:["Form name ",e.jsx("span",{className:"font-normal text-zinc-500",children:"(admin workspace)"}),e.jsx("input",{value:a.title||"",onChange:t=>{const g=t.target.value,w=!l.headerTitle||l.headerTitle===a.title;p({...a,title:g}),w&&n({...l,headerTitle:g})},className:"mt-2 w-full rounded-xl border border-white/10 bg-black/30 px-4 py-3 text-white outline-none focus:border-[#D4A843]"}),e.jsx("span",{className:"mt-1 block text-xs font-normal text-zinc-500",children:"Used to identify this form inside Guest Management."})]}),e.jsxs("label",{className:"block text-sm font-bold text-zinc-200",children:["Public headline ",e.jsx("span",{className:"font-normal text-[#D4A843]",children:"(shown live)"}
8),e.jsx("input",{value:v,onChange:t=>n({...l,headerTitle:t.target.value}),className:"mt-2 w-full rounded-xl border border-white/10 bg-black/30 px-4 py-3 text-white outline-none focus:border-[#D4A843]"}),e.jsx("span",{className:"mt-1 block text-xs font-normal text-zinc-500",children:"This is the large heading guests see on the public page."})]}),e.jsxs("label",{className:"block text-sm font-bold text-zinc-200",children:["Internal description",e.jsx("textarea",{value:a.description||"",onChange:t=>{const g=t.target.value,w=l.headerDescription===void 0||l.headerDescription===(a.description||"");p({...a,description:g}),w&&n({...l,headerDescription:g})},rows:3,className:"mt-2 w-full rounded-xl border border-white/10 bg-black/30 px-4 py-3 text-white outline-none focus:border-[#D4A843]"})]}),e.jsxs("label",{className:"block text-sm font-bold text-zinc-200",children:["Public introduction ",e.jsx("span",{className:"font-normal text-[#D4A843]",children:"(shown live)"}),e.jsx("textarea",{value:L,onChange:t=>n({...l,headerDescription:t.target.value}),rows:3,className:"mt-2 w-full rounded-xl border border-white/10 bg-black/30 px-4 py-3 text-white outline-none focus:border-[#D4A843]"})]})]}),e.jsxs("div",{className:"rounded-xl border border-white/10 bg-black/20 p-4",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-bold text-zinc-200",children:["2:1 header image ",e.jsx("span",{className:"font-normal text-[#D4A843]",children:"(shown live)"})]}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-zinc-500",children:"Import JPG, PNG, WebP, HEIC, or HEIF up to 10 MB. Images are automatically centered and formatted to an exact 2:1 ratio. For the sharpest result, start with 1600 Ã 800 pixels or larger."})]}),e.jsx("input",{ref:h,type:"file",accept:"image/jpeg,image/png,image/webp,image/heic,image/heif,.heic,.heif",className:"hidden",onChange:t=>{var g;return O(((g=t.target.files)==null?void 0:g[0])||null)}}),e.jsxs("button",{type:"button",disabled:j,onClick:()=>{var t;return(t=h.current)==null?void 0:t.click()},className:"inline-flex shrink-0 items-center justify-center gap-2 rounded-xl bg-[#D4A843] px-4 py-2 text-sm font-black text-black disabled:cursor-wait disabled:opacity-60",children:[j?e.jsx(Be,{className:"h-4 w-4 animate-spin"}):e.jsx(pe,{className:"h-4 w-4"}),(M=l.headerImage)!=null&&M.url?"Replace image":"Import image"]})]}),(A=l.headerImage)!=null&&A.url?e.jsxs("div",{className:"mt-4 grid gap-4 lg:grid-cols-[minmax(0,1.4fr)_minmax(240px,1fr)]",children:[e.jsx(Ce,{image:l.headerImage,className:"max-w-none rounded-xl"}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("label",{className:"block text-sm font-bold text-zinc-200",children:["Image description ",e.jsx("span",{className:"font-normal text-zinc-500",children:"(accessibility)"}),e.jsx("input",{value:l.headerImage.alt||"",onChange:t=>n({...l,headerImage:{...l.headerImage,alt:t.target.value}}),className:"mt-2 w-full rounded-xl border border-white/10 bg-black/30 px-4 py-3 text-white outline-none focus:border-[#D4A843]",placeholder:"Describe the image for screen readers"})]}),e.jsxs("div",{className:"text-xs text-zinc-500",children:["Stored at ",l.headerImage.width||1080," Ã ",l.headerImage.height||540," pixels."]}),e.jsxs("button",{type:"button",onClick:V,className:"inline-flex items-center justify-center gap-2 rounded-xl border border-red-400/20 px-4 py-2 text-sm font-bold text-red-300 hover:bg-red-400/10",children:[e.jsx(ze,{className:"h-4 w-4"}),"Remove header image"]})]})]}):e.jsx("button",{type:"button",disabled:j,onClick:()=>{var t;return(t=h.current)==null?void 0:t.click()},className:"mt-4 flex aspect-[2/1] max-h-64 w-full items-center justify-center rounded-xl border border-dashed border-white/20 bg-black/20 text-sm font-bold text-zinc-400 hover:border-[#D4A843]/60 hover:text-zinc-200 disabled:cursor-wait",children:e.jsxs("span",{className:"flex flex-col items-center gap-2",children:[e.jsx(pe,{className:"h-7 w-7 text-[#D4A843]"}),"Choose a 2:1 header image"]})}),z&&e.jsx("p",{className:"mt-3 text-xs text-zinc-300",role:"status","aria-live":"polite",children:z})]}),e.jsxs("div",{className:"rounded-xl border border-white/10 bg-black/20 p-4",children:[e.jsxs("label",{className:"block text-sm font-bold text-zinc-200",children:["Public link slug",e.jsx("input",{value:a.slug||"",onChange:t=>p({...a,slug:Je(t.target.value)}),className:"mt-2 w-full rounded-xl border border-white/10 bg-black/30 px-4 py-3 font-mono text-white outline-none focus:border-[#D4A843]"})]}),e.jsxs("div",{className:"mt-3 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx("code",{className:"min-w-0 flex-1 overflow-x-auto rounded-lg bg-black/30 px-3 py-2 text-sm text-emerald-300",children:H}),e.jsxs("button",{type:"button",onClick:J,className:"inline-flex items-center justify-center gap-2 rounded-xl border border-white/10 px-4 py-2 text-sm font-bold text-zinc-200 hover:bg-white/5",children:[N?e.jsx(ue,{className:"h-4 w-4 text-emerald-300"}):e.jsx(Xe,{className:"h-4 w-4"}),N?"Copied":"Copy exact link"]})]}),e.jsxs("p",{className:"mt-2 text-xs text-zinc-500",children:["Use this complete canonical URL. Short root paths such as /",a.slug||"your-form"," can conflict with existing website pages; this formâs safe link is ",F,"."]}
8)]})]}),i==="rollout"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-bold text-white",children:"How will people receive this form?"}),e.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"All options use a shareable link. This choice organizes how you distribute it; Publish controls whether it accepts entries."}),e.jsx("div",{className:"mt-4 grid gap-3 lg:grid-cols-3",children:xt.map(t=>{const g=t.icon,w=(k.visibility||"public")===t.value;return e.jsxs("button",{type:"button",onClick:()=>I({visibility:t.value}),className:`rounded-xl border p-4 text-left transition ${w?"border-[#D4A843] bg-[#D4A843]/10":"border-white/10 bg-black/20 hover:border-white/20"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 font-bold text-white",children:[e.jsx(g,{className:`h-4 w-4 ${w?"text-[#D4A843]":"text-zinc-500"}`}),t.label]}),e.jsx("p",{className:"mt-2 text-xs leading-relaxed text-zinc-400",children:t.description})]},t.value)})})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-3",children:[e.jsxs("label",{className:"block text-sm font-bold text-zinc-200",children:["Start accepting entries ",e.jsx("span",{className:"font-normal text-zinc-500",children:"(optional)"}),e.jsx(me,{type:"datetime-local",value:we(k.opensAt),onChange:t=>I({opensAt:t.target.value?new Date(t.target.value).toISOString():null}),className:"mt-2 w-full rounded-xl border border-white/10 bg-black/30 px-4 py-3 text-white [color-scheme:dark]"}),e.jsx("span",{className:"mt-1 block text-xs font-normal text-zinc-500",children:"Leave blank to start immediately after publishing."})]}),e.jsxs("label",{className:"block text-sm font-bold text-zinc-200",children:["Stop accepting entries ",e.jsx("span",{className:"font-normal text-zinc-500",children:"(optional)"}),e.jsx(me,{type:"datetime-local",value:we(a.closes_at),onChange:t=>p({...a,closes_at:t.target.value?new Date(t.target.value).toISOString():null}),className:"mt-2 w-full rounded-xl border border-white/10 bg-black/30 px-4 py-3 text-white [color-scheme:dark]"}),e.jsx("span",{className:"mt-1 block text-xs font-normal text-zinc-500",children:"Leave blank to keep the form open."})]}),e.jsxs("label",{className:"block text-sm font-bold text-zinc-200",children:["Stop after this many entries ",e.jsx("span",{className:"font-normal text-zinc-500",children:"(optional)"}),e.jsx("input",{type:"number",min:"1",value:k.maxSubmissions||"",onChange:t=>I({maxSubmissions:t.target.value?Number(t.target.value):null}),className:"mt-2 w-full rounded-xl border border-white/10 bg-black/30 px-4 py-3 text-white",placeholder:"Unlimited"}),e.jsx("span",{className:"mt-1 block text-xs font-normal text-zinc-500",children:"Leave blank for unlimited submissions."})]})]}),e.jsxs("label",{className:"block text-sm font-bold text-zinc-200",children:["Message shown when closed or full",e.jsx("input",{value:k.closedMessage||"",onChange:t=>I({closedMessage:t.target.value}),className:"mt-2 w-full rounded-xl border border-white/10 bg-black/30 px-4 py-3 text-white",placeholder:"This form is no longer accepting entries."})]})]}),i==="appearance"&&e.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-bold text-zinc-200",children:"Form style"}),e.jsx("div",{className:"mt-3 grid grid-cols-2 gap-3",children:["dark","light"].map(t=>e.jsxs("button",{type:"button",onClick:()=>T({card:t}),className:`rounded-xl border p-4 text-left ${C.card===t?"border-[#D4A843]":"border-white/10"} ${t==="dark"?"bg-black text-white":"bg-[#f7f3ea] text-zinc-900"}`,children:[e.jsxs("div",{className:"flex items-center justify-between font-bold",children:["Chakoâs ",t==="dark"?"Dark":"Light",C.card===t&&e.jsx(ue,{className:"h-4 w-4"})]}),e.jsx("div",{className:"mt-2 text-xs opacity-60",children:"Current brand surface, spacing, and accessible contrast."})]},t))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-bold text-zinc-200",children:"Primary button color"}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3",children:[ht.map(t=>e.jsx("button",{type:"button",title:t,"aria-label":`Use ${t}`,onClick:()=>T({buttonColor:t}),className:`h-10 w-10 rounded-full border-2 ${String(C.buttonColor||"#D4A843").toUpperCase()===t?"border-white ring-2 ring-[#D4A843]":"border-white/20"}`,style:{backgroundColor:t}},t)),e.jsx("input",{type:"color",value:C.buttonColor||"#D4A843",onChange:t=>T({buttonColor:t.target.value}
8),className:"h-10 w-14 rounded-lg border border-white/10 bg-black/30 p-1"}),e.jsx("code",{className:"text-xs text-zinc-400",children:C.buttonColor||"#D4A843"})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("label",{className:"block text-sm font-bold text-zinc-200",children:["Submit button text",e.jsx("input",{value:l.submitButtonText||C.buttonText||"Submit",onChange:t=>n({...l,submitButtonText:t.target.value,theme:{...C,buttonText:t.target.value}}),className:"mt-2 w-full rounded-xl border border-white/10 bg-black/30 px-4 py-3 text-white"})]}),e.jsxs("label",{className:"block text-sm font-bold text-zinc-200",children:["Thank-you message",e.jsx("textarea",{value:l.thankYouMessage||l.successMessage||"",onChange:t=>n({...l,thankYouMessage:t.target.value,successMessage:t.target.value}),rows:3,className:"mt-2 w-full rounded-xl border border-white/10 bg-black/30 px-4 py-3 text-white"})]}),e.jsxs("label",{className:"block text-sm font-bold text-zinc-200",children:["Send guests to another page after submission ",e.jsx("span",{className:"font-normal text-zinc-500",children:"(optional)"}),e.jsx("input",{type:"text",value:l.redirectUrl||"",onChange:t=>n({...l,redirectUrl:t.target.value}),className:"mt-2 w-full rounded-xl border border-white/10 bg-black/30 px-4 py-3 text-white",placeholder:"/events or https://â¦"}),e.jsx("span",{className:"mt-1 block text-xs font-normal text-zinc-500",children:"Leave blank to show the thank-you message on this form."})]}),e.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-white/10 bg-black/20 p-3 text-sm text-zinc-400",children:[e.jsx(lt,{className:"h-4 w-4 text-[#D4A843]"}),"Use Preview above to see these choices with the actual live headline and fields."]})]})]})]})]})}const Se=[{id:"first_name",label:"First Name",type:"text",category:"Personal Info"},{id:"last_name",label:"Last Name",type:"text",category:"Personal Info"},{id:"email",label:"Email",type:"email",category:"Personal Info"},{id:"phone",label:"Phone Number",type:"phone",category:"Personal Info"},{id:"birthday",label:"Birthday (optional)",type:"birthday",category:"Personal Info"},{id:"website",label:"Website / URL",type:"url",category:"Personal Info"},{id:"dob_day",label:"Day of Birth",type:"select",category:"Birthday"},{id:"dob_month",label:"Month of Birth",type:"select",category:"Birthday"},{id:"dob_year",label:"Year of Birth",type:"select",category:"Birthday"},{id:"event_date",label:"Event Date",type:"date",category:"Event Details"},{id:"party_size",label:"# of People Attending",type:"number",category:"Event Details"},{id:"event_type",label:"Event Type",type:"select",category:"Event Details"},{id:"preferred_time",label:"Preferred Time",type:"time",category:"Event Details"},{id:"sms_optin",label:"SMS Opt-In",type:"checkbox",category:"Communication"},{id:"email_optin",label:"Email Opt-In",type:"checkbox",category:"Communication"},{id:"message",label:"Message",type:"textarea",category:"Communication"},{id:"contact_method",label:"Preferred Contact Method",type:"radio",category:"Communication"},{id:"vip_interest",label:"VIP Interest",type:"checkbox",category:"Membership"},{id:"membership_type",label:"Membership Type",type:"select",category:"Membership"},{id:"budget_range",label:"Budget Range",type:"select",category:"Catering"},{id:"dietary_restrictions",label:"Dietary Restrictions",type:"textarea",category:"Catering"},{id:"venue_type",label:"Venue Type",type:"select",category:"Catering"},{id:"upload_resume",label:"Upload Resume",type:"file",category:"Uploads"},{id:"upload_picture",label:"Upload Picture",type:"image",category:"Uploads"},{id:"section_heading",label:"Section Heading",type:"heading",category:"Layout & Content"},{id:"instructions",label:"Instructions / Paragraph",type:"paragraph",category:"Layout & Content"},{id:"campaign_code",label:"Hidden Campaign Value",type:"hidden",category:"Layout & Content"}],ut=a=>{switch(a){case"email":return"ð§";case"phone":return"ð±";case"date":return"ð
";case"time":return"ð";case"checkbox":return"âï¸";case"textarea":return"ð";case"select":return"â¼";case"number":return"#";case"file":return"ð";case"image":return"ð¼ï¸";default:return"Aa"}};function B(a="id"){return`${a}_${Math.random().toString(16).slice(2)}_${Date.now().toString(16)}`}function pt(a){var l;return(l=a==null?void 0:a.sections)!=null&&l.length?a:Array.isArray(a==null?void 0:a.fields)?{sections:[{id:B("s"),fields:a.fields}]}:{sections:[{id:B("s"),fields:[]}]}}function ye(a){const l=pt(a==null?void 0:a.schema);return Ye(l,{enabled:!qe(a==null?void 0:a.slug,a==null?void 0:a.settings)})}function Ne({categories:a,onSelect:l,onCustom:p,onClose:n}){return e.jsxs("div",{className:"absolute left-0 right-0 z-50 mt-2 max-h-[28rem] overflow-y-auto rounded-2xl border border-white/10 bg-[#242429] p-4 text-zinc-100 shadow-2xl",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-bold text-white",children:"Add a field"}),e.jsx("div",{className:"text-xs text-zinc-500",children:"Choose a starting field, then customize its label and rules."})]}),e.jsx("button",{type:"button",onClick:n,className:"rounded-lg p-2 text-zinc-500 hover:bg-white/5 hover:text-white",children:"â"})]}),a.map(i=>e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"mb-2 border-b border-white/10 pb-2 text-xs font-black uppercase tracking-wide text-[#D4A843]",children:i}),e.jsx("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:Se.filter(d=>d.category===i).map(d=>e.jsxs("button",{type:"button",onClick:()=>l(d),className:"flex items-center gap-3 rounded-xl border border-white/10 bg-black/20 p-3 text-left text-sm text-zinc-200 transition hover:border-violet-400/40 hover:bg-violet-400/10",children:[e.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-white/5 text-sm",children:ut(d.type)}),e.jsx("span",{children:d.label})]},d.id))})]},i)),e.jsx("button",{type:"button",onClick:p,className:"w-full rounded-xl border border-violet-400/40 bg-violet-400/10 py-3 text-sm font-bold text-violet-200 hover:bg-violet-400/15",children:"+ Custom field"})]})}function _t(){var ce,de,xe;const[,a]=Le(),p=Fe().id,[n,i]=x.useState(null),[d,N]=x.useState({sections:[{id:B("s"),fields:[]}]}
8),[o,z]=x.useState({}),[b,j]=x.useState("build"),[m,h]=x.useState(""),[k,C]=x.useState(""),[D,v]=x.useState(!1),[L,$]=x.useState(!1),[F,H]=x.useState(!0),[U,I]=x.useState(!1),[T,R]=x.useState(null),[J,O]=x.useState(null),[V,Z]=x.useState({}),[M,A]=x.useState(null),[t,g]=x.useState([]),[w,te]=x.useState(!1),se=Array.from(new Set(Se.map(s=>s.category)));x.useEffect(()=>{fetch("/api/guest-mgmt/categories/tree?includeInactive=0").then(s=>s.json()).then(s=>{const r=s.flat||[];g(r.map(c=>({slug:c.slug,name:c.name})))}).catch(()=>g([]))},[]);const S=x.useMemo(()=>d.sections.flatMap(s=>s.fields),[d.sections]),le=async()=>{C("");try{const r=(await Oe(p)).form;i(r),N(ye(r)),z(r.settings??{}),h(""),v(!1)}catch(s){v(E(s)),C(s.message||"Failed to load the form")}};x.useEffect(()=>{le()},[p]);const W=async(s=d,r=o,c=n)=>{$(!0),h("");const u={slug:c.slug,title:c.title,description:c.description,status:c.status,schema:s,settings:r,experience_id:c.experience_id??null,closes_at:c.closes_at??null};try{const f=await $e(p,u);return i(f.form),N(ye(f.form)),z(f.form.settings??{}),h("Saved."),v(!1),!0}catch(f){const y=E(f);return v(y),h(y?"Your Dashboard HQ session expired before the form could be saved. Your unsaved changes are still here. Sign in again, then choose Retry save.":f.message||"Save failed"),!1}finally{$(!1)}},De=async()=>{h("");try{if(!await W())return;const s=await ee(p,"published");i(s.form),h("Published. The form is now live."),v(!1)}catch(s){v(E(s)),h(s.message||"Publish failed")}},ae=async()=>{h("");try{const s=await ee(p,"draft");i(s.form),h("Unpublished."),v(!1)}catch(s){v(E(s)),h(s.message||"Failed to unpublish")}},Ie=async()=>{h("");try{const s=await ee(p,"archived");i(s.form),h("Archived."),v(!1)}catch(s){v(E(s)),h(s.message||"Failed to archive")}},Ae=async()=>{try{const s=await He(p);a(`/admin/forms/${s.form.id}/builder`)}catch(s){v(E(s)),h(s.message||"Failed to duplicate")}},Te=async()=>{if(window.confirm(`Permanently delete â${n.title}â? This cannot be undone.`)){h("");try{await We(p),a("/admin/guest-mgmt?tab=forms")}catch(s){v(E(s)),h(s.message||"Failed to delete form")}}},[ie,_]=x.useState(!1),Q=s=>{const r=S[s];R(s),O({...r}),I(!0)},Me=s=>{if(T===null)return;const r=JSON.parse(JSON.stringify(d));let c=0;for(const u of r.sections)for(let f=0;f<u.fields.length;f++){if(c===T){const y=s.id.trim().toLowerCase().replace(/[^a-z0-9_]+/g,"_");if(!y||S.some((P,G)=>G!==T&&P.id===y)){h("Each field needs a unique field key.");return}u.fields[f]={...s,id:y},N(r),I(!1),R(null),O(null);return}c++}},re=s=>{const r=JSON.parse(JSON.stringify(d));let c=0;for(const u of r.sections){const f=[];for(const y of u.fields)c!==s&&f.push(y),c++;u.fields=f}r.sections.some(u=>u.fields.length)||(r.sections=[{id:B("s"),fields:[]}]),N(r)},Y=(s,r)=>{var P;const c=[...S],u=s+r;if(u<0||u>=c.length)return;const f=c[s];c[s]=c[u],c[u]=f;const y={sections:[{id:((P=d.sections[0])==null?void 0:P.id)??B("s"),fields:c}]};N(y)},q=(s,r)=>{var he;const c=(r==null?void 0:r.id)||"custom_field";let u=c,f=2;for(;S.some(Ee=>Ee.id===u);)u=`${c}_${f}`,f+=1;const y=r?{id:u,type:r.type,label:r.label,required:!1,placeholder:r.type==="phone"?"Phone Number":"Aa",mapTo:`submission.${r.id}`,...r.type==="radio"?{options:["Phone","Email"]}:{}}:{id:u,type:"text",label:"New Field",required:!1,placeholder:"Aa",mapTo:"submission.new_field"},P=[...S],G=s+1;P.splice(G,0,y);const Pe={sections:[{id:((he=d.sections[0])==null?void 0:he.id)??B("s"),fields:P}]};N(Pe),A(null),r||setTimeout(()=>Q(G),0)};if(!n)return k?e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-[#0f0f10] p-6 text-zinc-100",children:e.jsxs("div",{className:"w-full max-w-xl rounded-2xl border border-amber-400/30 bg-[#18181b] p-6 shadow-2xl",children:[e.jsx("div",{className:"text-xs font-black uppercase tracking-[0.16em] text-amber-300",children:"Form builder"}),e.jsx("h1",{className:"mt-2 text-2xl font-bold text-white",children:D?"Your session expired":"The form could not be loaded"}),e.jsx("p",{className:"mt-3 text-sm leading-relaxed text-zinc-300",children:k}),e.jsxs("div",{className:"mt-5 flex flex-wrap gap-3",children:[D&&e.jsx("a",{href:"/team-login",target:"_blank",rel:"noreferrer",className:"rounded-xl bg-[#D4A843] px-4 py-2 text-sm font-black text-black",children:"Sign in again"}),e.jsx("button",{type:"button",onClick:le,className:"rounded-xl border border-white/10 px-4 py-2 text-sm font-bold text-white",children:"Retry loading"})]})]})}):e.jsx("div",{className:"p-6",children:"Loadingâ¦"});const K=typeof(o==null?void 0:o.theme)=="object"?{...o.theme,buttonText:o.submitButtonText||o.theme.buttonText||"Submit"}:{card:(o==null?void 0:o.theme)==="light"?"light":"dark",buttonText:(o==null?void 0:o.submitButtonText)||"Submit",buttonColor:"#D4A843"},ne=!!String(o.headerTitle||"").trim(),oe=ne?o.headerTitle:n.title,X=ne?o.headerDescription??n.description:n.description;return e.jsxs("div",{className:"min-h-screen bg-[#0f0f10] font-sans text-zinc-100",children:[e.jsx("div",{className:"sticky top-0 z-40 border-b border-white/10 bg-[#111113]/95 backdrop-blur-sm",children:e.jsxs("div",{className:"mx-auto flex max-w-7xl flex-col gap-3 px-6 py-4 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>a("/admin/guest-mgmt?tab=forms"),className:"rounded-xl border border-white/10 bg-white/5 p-2 text-zinc-300 hover:bg-white/10 hover:text-white",title:"Back to forms",children:e.jsx(at,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-black uppercase tracking-[0.14em] text-[#D4A843]",children:["Form builder ",e.jsx("span",{className:`rounded-full px-2 py-0.5 tracking-normal ${n.status==="published"?"bg-emerald-400/10 text-emerald-300":n.status==="archived"?"bg-zinc-400/10 text-zinc-400":"bg-amber-400/10 text-amber-300"}`,children:n.status})]}),e.jsx("div",{className:"mt-1 text-xl font-semibold text-white",children:n.title})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("div",{className:"inline-flex rounded-xl border border-white/10 bg-black/30 p-1",children:[e.jsxs("button",{className:`inline-flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-bold transition ${b==="build"?"bg-[#D4A843] text-black":"text-zinc-400 hover:text-white"}`,onClick:()=>j("build"),children:[e.jsx(dt,{})," Build"]}),e.jsxs("button",{className:`inline-flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-bold transition ${b==="preview"?"bg-[#D4A843] text-black":"text-zinc-400 hover:text-white"}`,onClick:()=>j("preview"),children:[e.jsx(ct,{})," Preview"]})]}),e.jsx("button",{className:`rounded-xl border px-3 py-2 transition ${F?"border-violet-400/50 bg-vi
8olet-400/15 text-violet-200":"border-white/10 bg-white/5 text-zinc-300 hover:bg-white/10"}`,onClick:()=>H(s=>!s),title:F?"Hide form setup":"Show form setup",children:e.jsx(it,{className:"h-4 w-4"})}),e.jsx("a",{href:ke(n.slug),target:"_blank",rel:"noreferrer",className:"rounded-xl border border-white/10 bg-white/5 px-3 py-2 text-zinc-300 hover:bg-white/10 hover:text-white",title:"Open exact public form",children:e.jsx(rt,{className:"h-4 w-4"})}),e.jsx("button",{className:"rounded-xl border border-white/10 bg-white/5 px-4 py-2 text-sm font-bold text-white transition hover:bg-white/10 disabled:opacity-50",onClick:()=>W(),disabled:L,children:L?"Savingâ¦":n.status==="published"?"Save live changes":"Save draft"}),n.status!=="published"&&n.status!=="archived"&&e.jsx("button",{className:"rounded-xl bg-emerald-400 px-5 py-2 text-sm font-black text-black shadow-lg shadow-emerald-950/30 transition hover:bg-emerald-300",onClick:De,children:"Save & Go Live"}),e.jsxs("div",{className:"relative",children:[e.jsx("button",{className:"rounded-xl border border-white/10 bg-white/5 px-3 py-2 font-bold text-zinc-300 hover:bg-white/10",onClick:()=>_(!ie),title:"More actions",children:"â®"}),ie&&e.jsxs("div",{className:"absolute right-0 z-50 mt-2 w-48 overflow-hidden rounded-xl border border-white/10 bg-[#242429] p-1 text-sm shadow-2xl",children:[n.status==="published"&&e.jsx("button",{className:"w-full rounded-lg px-3 py-2 text-left text-amber-300 hover:bg-white/5",onClick:()=>{ae(),_(!1)},children:"Unpublish"}),e.jsxs("button",{className:"w-full rounded-lg px-3 py-2 text-left text-zinc-200 hover:bg-white/5",onClick:()=>{Ae(),_(!1)},children:[e.jsx(nt,{className:"mr-2 inline h-4 w-4"}),"Duplicate"]}),n.status!=="archived"&&e.jsx("button",{className:"w-full rounded-lg px-3 py-2 text-left text-zinc-400 hover:bg-white/5 hover:text-red-300",onClick:()=>{Ie(),_(!1)},children:"Archive"}),n.status==="archived"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"w-full rounded-lg px-3 py-2 text-left text-zinc-200 hover:bg-white/5",onClick:()=>{ae(),_(!1)},children:"Restore to Draft"}),e.jsxs("button",{className:"w-full rounded-lg px-3 py-2 text-left text-red-300 hover:bg-red-400/10",onClick:()=>{Te(),_(!1)},children:[e.jsx(ze,{className:"mr-2 inline h-4 w-4"}),"Delete permanently"]})]})]})]})]})]})}),m&&e.jsx("div",{className:"mx-auto mt-4 max-w-7xl px-6",children:e.jsxs("div",{className:`rounded-xl border px-4 py-3 text-sm ${D?"border-amber-400/30 bg-amber-400/10 text-amber-100":"border-white/10 bg-white/5 text-zinc-200"}`,children:[e.jsx("p",{children:m}),D&&e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx("a",{href:"/team-login",target:"_blank",rel:"noreferrer",className:"rounded-lg bg-[#D4A843] px-3 py-2 text-xs font-black text-black",children:"Sign in again"}),e.jsx("button",{type:"button",onClick:()=>W(),disabled:L,className:"rounded-lg border border-white/15 px-3 py-2 text-xs font-bold text-white",children:"Retry save"})]})]})}),F&&e.jsx("div",{className:"mx-auto max-w-7xl px-6 pt-6",children:e.jsx(mt,{form:n,settings:o,onFormChange:i,onSettingsChange:z})}),e.jsxs("div",{className:"mx-auto max-w-7xl px-6 py-10",children:[b==="preview"?e.jsxs("div",{children:[e.jsx(Ce,{image:o.headerImage,className:"mb-6"}),e.jsx(Ge,{title:oe,description:X,schema:d,theme:K,mode:"preview",value:V,onChange:Z,onSubmit:()=>alert("Preview only â publish to enable public submissions.")})]}):e.jsx("div",{className:"relative",children:e.jsx("div",{className:"mx-auto max-w-2xl",children:e.jsxs("div",{className:"rounded-2xl border border-white/10 bg-[#18181b] p-8 text-zinc-100 shadow-2xl sm:p-10",children:[e.jsx("div",{className:"mb-2 text-xs font-black uppercase tracking-[0.16em] text-[#D4A843]",children:"Field editor"}),e.jsx("h1",{className:"text-4xl font-semibold tracking-tight text-white",children:oe}),X&&e.jsx("p",{className:"mt-4 whitespace-pre-line text-base leading-relaxed text-zinc-400",children:X}),e.jsxs("div",{className:"mt-6 rounded-xl border border-white/10 bg-black/20 p-4",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm font-semibold text-white",children:["Guest Experience Mapping ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsx("div",{className:"mt-1 text-xs text-zinc-500",children:"Submissions will be tagged with this experience in Guest Management"})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>te(!w),className:"flex min-w-[180px] items-center gap-2 rounded-xl border border-white/10 bg-[#242429] px-4 py-2 text-sm font-medium text-zinc-200 transition hover:border-white/20",children:[e.jsx("span",{className:"flex-1 text-left truncate",children:(ce=o.experienceSlugs)!=null&&ce.length?((de=t.find(s=>
8s.slug===o.experienceSlugs[0]))==null?void 0:de.name)||o.experienceSlugs[0]:"Select experience..."}),e.jsx("span",{className:"text-[#D4A843]",children:"â¼"})]}),w&&e.jsx("div",{className:"absolute right-0 z-50 mt-2 max-h-60 w-72 overflow-y-auto rounded-xl border border-white/10 bg-[#242429] p-1 shadow-2xl",children:t.length===0?e.jsx("div",{className:"p-4 text-sm text-zinc-400",children:"No guest categories found. Configure them in Guest Management first."}):t.map(s=>{var r,c;return e.jsxs("button",{onClick:()=>{const u={...o,experienceSlugs:[s.slug]};z(u),te(!1),W(d,u,n)},className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm transition hover:bg-white/5 ${((r=o.experienceSlugs)==null?void 0:r[0])===s.slug?"bg-[#D4A843]/10 text-[#E6C56B]":"text-zinc-200"}`,children:[((c=o.experienceSlugs)==null?void 0:c[0])===s.slug&&e.jsx("span",{className:"text-[#D4A843]",children:"â"}),e.jsx("span",{children:s.name}),e.jsx("span",{className:"ml-auto text-xs opacity-50",children:s.slug})]},s.slug)})})]})]}),!((xe=o.experienceSlugs)!=null&&xe.length)&&e.jsx("div",{className:"mt-2 text-xs text-red-400",children:"Required: Please select an experience to map form submissions"})]}),e.jsxs("div",{className:"mt-10 space-y-6",children:[S.map((s,r)=>e.jsxs("div",{className:"relative rounded-2xl border border-white/10 bg-black/20 p-5",children:[e.jsx("div",{className:"absolute -left-20 top-0 hidden flex-col items-center gap-3 md:flex",children:e.jsxs("div",{className:"flex w-14 flex-col items-center gap-3 rounded-xl border border-white/10 bg-[#242429] p-3 shadow-md",children:[e.jsx("button",{className:"text-violet-300 transition hover:text-violet-200",onClick:()=>Q(r),title:"Edit",children:e.jsx(be,{})}),e.jsx("div",{className:"h-px w-8 bg-white/10"}),e.jsx("button",{className:"text-red-400 transition hover:text-red-300",onClick:()=>re(r),title:"Delete",children:e.jsx(ge,{})})]})}),e.jsx("div",{className:"absolute -right-20 top-0 hidden flex-col items-center gap-3 md:flex",children:e.jsxs("div",{className:"flex w-14 flex-col items-center gap-3 rounded-xl border border-white/10 bg-[#242429] p-3 shadow-md",children:[e.jsx("button",{className:"text-zinc-300 transition hover:text-white disabled:opacity-30",disabled:r===0,onClick:()=>Y(r,-1),title:"Move up",children:e.jsx(fe,{})}),e.jsx("div",{className:"h-px w-8 bg-white/10"}),e.jsx("button",{className:"text-zinc-300 transition hover:text-white disabled:opacity-30",disabled:r===S.length-1,onClick:()=>Y(r,1),title:"Move down",children:e.jsx(ve,{})})]})}),e.jsxs("div",{className:"flex items-center justify-between gap-3 text-sm font-semibold text-white",children:[e.jsxs("span",{children:[s.label,s.required?e.jsx("span",{className:"text-[#D4A843]",children:"*"}):""]}),e.jsx("span",{className:"rounded-full bg-white/5 px-2 py-1 text-[10px] font-black uppercase tracking-wide text-zinc-500",children:s.type})]}),e.jsxs("div",{className:"mt-4 flex items-center gap-2 md:hidden",children:[e.jsxs("button",{className:"inline-flex flex-1 items-center justify-center gap-2 rounded-lg border border-white/10 px-3 py-2 text-sm font-bold text-violet-300",onClick:()=>Q(r),children:[e.jsx(be,{})," Edit"]}),e.jsx("button",{className:"rounded-lg border border-white/10 p-2 text-zinc-300 disabled:opacity-30",disabled:r===0,onClick:()=>Y(r,-1),title:"Move up",children:e.jsx(fe,{})}),e.jsx("button",{className:"rounded-lg border border-white/10 p-2 text-zinc-300 disabled:opacity-30",disabled:r===S.length-1,onClick:()=>Y(r,1),title:"Move down",children:e.jsx(ve,{})}),e.jsx("button",{className:"rounded-lg border border-red-400/20 p-2 text-red-400",onClick:()=>re(r),title:"Delete",children:e.jsx(ge,{})})]}),e.jsx("div",{className:"mt-2",children:s.type==="textarea"?e.jsx("textarea",{className:"w-full rounded-xl border border-white/10 bg-black/30 px-4 py-3 text-zinc-300 placeholder:text-zinc-600",rows:5,placeholder:s.placeholder??"",disabled:!0}):e.jsx("input",{className:"w-full rounded-xl border border-white/10 bg-black/30 px-4 py-3 text-zinc-300 placeholder:text-zinc-600",placeholder:s.placeholder??(s.type==="phone"?"Phone Number":"Aa"),disabled:!0})}),e.jsxs("div",{className:"mt-6 relative",children:[e.jsxs("button",{className:"flex w-full items-center justify-center gap-2 rounded-xl border border-dashed border-violet-400/30 py-3 text-sm font-bold text-violet-300 transition hover:bg-violet-400/10",onClick:()=>A(M===r?null:r),children:[e.jsx(je,{})," Add field"]}),M===r&&e.jsx(Ne,{categories:se,onSelect:c=>q(r,c),onCustom:()=>q(r),onClose:()=>A(null)})]})]},s.id)),S.length===0&&e.jsxs("div",{className:"relative",children:[e.jsxs("button",{className:"flex w-full items-center justify-center gap-2 rounded-xl border border-dashed border-violet-400/40 bg-violet-400/10 py-4 font-bold text-violet-200 transition hover:bg-violet-400/15",onClick:()=>A(M===-1?null:-1),children:[e.jsx(je,{})," Add field"]}),M===-1&&e.jsx(Ne,{categories:se,onSelect:s=>q(-1,s),onCustom:()=>q(-1),onClose:()=>A(null)})]})]}),e.jsx("button",{className:"mt-10 w-full rounded-xl py-4 text-lg font-semibold opacity-80",style:{backgroundColor:K.buttonColor??"#e11d48",color:"white"},disabled:!0,children:K.buttonText??"Submit"})]})})}),e.jsx(ot,{open:U,field:J,onClose:()=>{I(!1),R(null),O(null)},onSave:Me})]})]})}export{_t 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.