PageSourceSearch

https://favekad.com/build/assets/ShowWedding-umtZhC58.js

js favekad.com collected 2026-10-06 19:01:31 UTC 110,618 bytes, 9 lines download raw bytes

1import{r as d,a as R,j as e,B as j,t as y,h as pe,i as jt,e as We,L as Is}from"./app-DLIH-JBO.js";import{D as yt,a as Nt,b as bt,c as Ds,N as wt}from"./Navigation-Chu8E7qU.js";import{f as qs,a as _t}from"./dateFormat-DeDvxu2m.js";import{D as Ct}from"./DashboardSubNav-ClH-Pxzf.js";import{I as F}from"./input-L7UhxUWC.js";import{L as S}from"./label-DgpWtm6c.js";import{T as ue}from"./textarea-noCiXqXG.js";import{S as os}from"./switch-D2vKcRE2.js";import{S as Ce,a as ke,b as Se,c as Ee,d as H}from"./select-DKPbB1t1.js";import{B as Ne}from"./badge-DWtIf9HM.js";import{T as kt,a as St,b as be,c as we}from"./tabs-olLRwVRh.js";import{C as re}from"./checkbox-f36uB1Kq.js";import{D as Os,a as Ws,b as Hs,c as Ys,d as Qs,e as Et}from"./dialog-7ahSoXbL.js";import{E as ss}from"./eye-D4ccC50Z.js";import{L as se}from"./loader-circle-CMJe2RGS.js";import{C as $t}from"./circle-alert-C2lZdcX0.js";import{C as Ts}from"./circle-check-big-BHwmkZFp.js";import{S as He}from"./send-v1NLIjvP.js";import{M as Te}from"./mail-BrcG_IZP.js";import{R as Ks,b as Ft,P as Xs,C as js,a as Rt,T as Js,D as Zs,O as ys}from"./index-hcWG9kgt.js";import{X as Re}from"./x-i1z-Evlp.js";import{S as At}from"./settings-DAcPD2uT.js";import{P as De}from"./plus-B1xh-cV-.js";import{U as Fe}from"./upload-DyOTWxBi.js";import{C as Pt}from"./chevron-down-DXaNeuzj.js";import{U as Ns}from"./users-BguS5T5j.js";import{D as Gs}from"./download-XzkXz_gd.js";import{S as bs}from"./search-VHPNd-Oy.js";import{T as _e}from"./trash-2-FjJjspxI.js";import{P as et}from"./pencil-BztIWBgn.js";import{C as ts}from"./check-CmUkfjpY.js";import{C as ws}from"./clock-DY8uhjBU.js";import{U as as}from"./user-plus-IA9VQuN7.js";import{P as It,a as Dt,b as Tt}from"./popover-Bv8YIEWD.js";import{P as Pe}from"./index-BmPFGD3d.js";import{b as Be}from"./index-BHtpPDsi.js";import{c as Ye}from"./createLucideIcon-df6k00O5.js";import{B as Je}from"./bell-BSpQQnk1.js";import{M as Gt}from"./message-square-G9ZeeCyd.js";import{C as st}from"./copy-DAgeS4O4.js";import{M as Mt}from"./Monogram-B71X3BIo.js";import{A as zt}from"./arrow-left-yr7pBaxq.js";import{E as Lt}from"./external-link-DjWpFzGh.js";import{C as Ms}from"./calendar-C2h_n3r2.js";import{E as cs}from"./eye-off-DXD71IAe.js";import{M as zs}from"./map-pin-BIipiPJq.js";import{F as ms}from"./file-text-DzSsVgkQ.js";import{S as ze}from"./save-DRj7Y5OZ.js";import{H as Ze}from"./heart-B_DM_78k.js";import{P as Vt}from"./palette-CL7CA647.js";import{I as us}from"./image-Cl6JUFRW.js";/* empty css            */import"./index-B94IB3b5.js";import"./Combination-BKD86nj0.js";import"./index-Df27Acbu.js";import"./index-DLD4ZXS5.js";import"./index-XJoa54kn.js";import"./circle-DzDb0dun.js";import"./chevron-right-C50O5Ql0.js";import"./logo-CqHQ9BWz.js";import"./logo-dark-C8G0-FGt.js";import"./building-2-BDvaE8Gw.js";import"./user-DvpkoEGT.js";import"./layout-dashboard-bz8T89WG.js";import"./book-open-ale0JS3A.js";import"./wand-sparkles-h_gaUkhT.js";import"./menu-BxlPOOHk.js";import"./arrow-right-BIwzBUdr.js";import"./chart-column-5UJIVbK7.js";import"./zap-CBbdmtB8.js";import"./sparkles-Bv9rUtm8.js";import"./index-BdQq_4o_.js";const Ut=[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]],Bt=Ye("car",Ut);const qt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ls=Ye("circle-question-mark",qt);const Ot=[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Wt=Ye("compass",Ot);const Ht=[["path",{d:"M10 22v-6.57",key:"1wmca3"}],["path",{d:"M12 11h.01",key:"z322tv"}],["path",{d:"M12 7h.01",key:"1ivr5q"}],["path",{d:"M14 15.43V22",key:"1q2vjd"}],["path",{d:"M15 16a5 5 0 0 0-6 0",key:"o9wqvi"}],["path",{d:"M16 11h.01",key:"xkw8gn"}],["path",{d:"M16 7h.01",key:"1kdx03"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 7h.01",key:"1vti4s"}],["rect",{x:"4",y:"2",width:"16",height:"20",rx:"2",key:"1uxh74"}]],Yt=Ye("hotel",Ht);const Qt=[["path",{d:"M16 5H3",key:"m91uny"}],["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 19H3",key:"zzsher"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]],ps=Ye("list-plus",Qt),Kt=({isOpen:n,onClose:s,weddingId:l,eventId:m,eventGuestId:u,mode:o="invitation",onSent:N})=>
1{const[w,x]=d.useState(!0),[a,g]=d.useState(!1),[p,C]=d.useState(null),[_,$]=d.useState(null);d.useEffect(()=>{n&&u&&te()},[n,u,o]);const te=async()=>{x(!0),$(null);const Y=o==="reminder"?"preview-reminder":"preview-email";try{const B=await R.get(`/api/weddings/${l}/events/${m}/guests/${u}/${Y}`);C(B.data.data)}catch(B){$(B.response?.data?.message||"Failed to load preview")}finally{x(!1)}},M=async()=>{g(!0);try{o==="reminder"?(await R.post(`/api/weddings/${l}/events/${m}/guests/bulk-send-reminder`,{event_guest_ids:[u]}),y.success("Reminder sent successfully!")):(await R.post(`/api/weddings/${l}/events/${m}/guests/${u}/send-rsvp`),y.success("Invitation sent successfully!")),N?.(),s()}catch(Y){y.error(Y.response?.data?.message||"Failed to send invitation")}finally{g(!1)}};return e.jsx(Os,{open:n,onOpenChange:Y=>!Y&&s(),children:e.jsxs(Ws,{className:"max-w-4xl max-h-[90vh] overflow-hidden flex flex-col",children:[e.jsxs(Hs,{children:[e.jsxs(Ys,{className:"flex items-center gap-2",children:[e.jsx(ss,{className:"h-5 w-5"}),o==="reminder"?"Reminder":"Invitation"," Email Preview"]}),e.jsxs(Qs,{children:["Preview the ",o==="reminder"?"reminder":"invitation"," email before sending"]})]}),w?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(se,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):_?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx($t,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("p",{className:"text-destructive",children:_})]}):p?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground w-16",children:"To:"}),e.jsx("span",{className:"font-medium",children:p.guest_name}),p.to?e.jsxs("span",{className:"text-muted-foreground",children:["<",p.to,">"]}):e.jsx(Ne,{variant:"destructive",className:"text-xs",children:"No email"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground w-16",children:"Subject:"}),e.jsx("span",{className:"font-medium",children:p.subject})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground w-16",children:"Event:"}),e.jsx("span",{children:p.event_name}),p.event_date&&e.jsxs("span",{className:"text-muted-foreground",children:["(",p.event_date,")"]})]}),o==="reminder"&&p.reminder_sent&&e.jsxs("div",{className:"flex items-center gap-2 text-sm pt-2 border-t border-border",children:[e.jsx(Ts,{className:"h-4 w-4 text-blue-500"}),e.jsxs("span",{className:"text-blue-600",children:["Reminder previously sent on ",p.reminder_sent_at]})]}),o==="invitation"&&p.already_sent&&e.jsxs("div",{className:"flex items-center gap-2 text-sm pt-2 border-t border-border",children:[e.jsx(Ts,{className:"h-4 w-4 text-green-500"}),e.jsxs("span",{className:"text-green-600",children:["Previously sent on ",p.sent_at]})]})]}),e.jsx("div",{className:"flex-1 overflow-auto border rounded-lg bg-white",children:e.jsx("div",{className:"p-4",dangerouslySetInnerHTML:{__html:p.html}})}),e.jsxs(Et,{className:"gap-2",children:[e.jsx(j,{variant:"outline",onClick:s,children:"Cancel"}),p.to?e.jsx(j,{onClick:M,disabled:a,className:"bg-primary text-black",children:a?e.jsxs(e.Fragment,{children:[e.jsx(se,{className:"h-4 w-4 mr-2 animate-spin"}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(He,{className:"h-4 w-4 mr-2"}),o==="reminder"?p.reminder_sent?"Resend Reminder":"Send Reminder":p.already_sent?"Resend Invitation":"Send Invitation"]})}):e.jsxs(j,{disabled:!0,className:"bg-muted",children:[e.jsx(Te,{className:"h-4 w-4 mr-2"}),"No Email Address"]})]})]}):null]})})},Xt=Ks,Jt=Ft,Zt=Xs,tt=d.forwardRef(({className:n,...s},l)=>e.jsx(ys,{className:pe("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...s,ref:l}));tt.displayName=ys.displayName;const ea=jt("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4  border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),at=d.forwardRef(({side:n="right",className:s,children:l,...m},u)=>e.jsxs(Zt,{children:[e.jsx(tt,{}),e.jsxs(js,{ref:u,className:pe(ea({side:n}),s),...m,children:[l,e.jsxs(Rt,{className:"absolute right-4 top-4 roun
1ded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-secondary hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[e.jsx(Re,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));at.displayName=js.displayName;const nt=({className:n,...s})=>e.jsx("div",{className:pe("flex flex-col space-y-2 text-center sm:text-left",n),...s});nt.displayName="SheetHeader";const lt=d.forwardRef(({className:n,...s},l)=>e.jsx(Js,{ref:l,className:pe("text-lg font-semibold text-foreground",n),...s}));lt.displayName=Js.displayName;const rt=d.forwardRef(({className:n,...s},l)=>e.jsx(Zs,{ref:l,className:pe("text-sm text-muted-foreground",n),...s}));rt.displayName=Zs.displayName;const sa=({categories:n,events:s,showCategoryForm:l,setShowCategoryForm:m,newCategory:u,setNewCategory:o,onAddCategory:N,onDeleteCategory:w,onCategoryEventsChange:x})=>e.jsxs(Xt,{children:[e.jsx(Jt,{asChild:!0,children:e.jsxs(j,{variant:"outline",size:"sm",children:[e.jsx(At,{className:"h-4 w-4 mr-1"}),"Categories (",n.length,")"]})}),e.jsxs(at,{className:"overflow-y-auto",children:[e.jsxs(nt,{children:[e.jsx(lt,{children:"Guest Categories"}),e.jsx(rt,{children:"Organize guests into categories for easier management"})]}),e.jsxs("div",{className:"mt-6 space-y-4",children:[e.jsxs(j,{size:"sm",onClick:()=>m(!l),children:[e.jsx(De,{className:"h-4 w-4 mr-1"}),"Add Category"]}),l&&e.jsxs("form",{onSubmit:N,className:"flex gap-2 p-4 bg-muted/50 rounded-lg",children:[e.jsx(F,{placeholder:"Category name",value:u.name,onChange:a=>o({...u,name:a.target.value}),required:!0}),e.jsx(F,{type:"color",value:u.color,onChange:a=>o({...u,color:a.target.value}),className:"w-20"}),e.jsx(j,{type:"submit",size:"sm",children:"Add"})]}),e.jsxs("div",{className:"space-y-3",children:[n.map(a=>e.jsxs("div",{className:"p-3 bg-muted/30 rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs(Ne,{style:{backgroundColor:a.color},className:"text-white",children:[a.name," (",a.guests_count,")"]}),e.jsx(j,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>w(a.id),children:e.jsx(Re,{className:"h-3 w-3 text-muted-foreground hover:text-destructive"})})]}),s.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-2 ml-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Auto-invite to:"}),s.map(g=>e.jsxs("label",{className:"flex items-center gap-1 cursor-pointer text-xs",children:[e.jsx(re,{checked:a.events?.some(p=>p.id===g.id)||!1,onCheckedChange:p=>x(a.id,g.id,!!p)}),g.name]},g.id))]})]},a.id)),n.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"No categories yet. Add one to organize your guests."})]})]})]})]}),ta=({weddingId:n,events:s,importingGuests:l,onImport:m})=>{const[u,o]=d.useState(!1),[N,w]=d.useState([]),x=d.useRef(null),a=d.useRef(null),g=()=>{a.current?.click()},p=()=>{w([]),o(!0)},C=$=>{m($,[])},_=$=>{m($,N),o(!1),w([])};return e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:a,type:"file",accept:".csv,.xlsx,.xls",onChange:C,className:"hidden"}),e.jsx("input",{ref:x,type:"file",accept:".csv,.xlsx,.xls",onChange:_,className:"hidden"}),e.jsxs(yt,{children:[e.jsx(Nt,{asChild:!0,children:e.jsxs(j,{variant:"outline",size:"sm",disabled:l,children:[l?e.jsx(se,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(Fe,{className:"h-4 w-4 mr-1"}),l?"Importing...":"Import CSV",e.jsx(Pt,{className:"h-3 w-3 ml-1"})]})}),e.jsxs(bt,{align:"end",children:[e.jsxs(Ds,{onClick:g,children:[e.jsx(Fe,{className:"h-4 w-4 mr-2"}),"Import to Guest List"]}),s.length>0&&e.jsxs(Ds,{onClick:p,children:[e.jsx(Fe,{className:"h-4 w-4 mr-2"}),"Import & Invite to Event..."]})]})]}),e.jsx(Os,{open:u,onOpenChange:o,children:e.jsxs(Ws,{children:[e.jsxs(Hs,{children:[e.jsx(Ys,{children:"Import & Invite to Event"}),e.jsx(Qs,{children:"Import guests from a CSV file and automatically invite them to selected events."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(S,{className:"mb-2 block text-sm",children:"Select events to invite imported guests to"}),e.jsx("div",{className:"flex flex-wrap gap-3",children:s.map($=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-sm",children:[e.jsx(re,{checked:N.includes($.id),onCheckedChange:te=>{w(te?[...N,$.id]:N.filter(M=>M!==$.id))}}),$.name]},$.id))})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(j,{size:"sm",onClick:()=>x.current?.click(),disabled:l||N.length===0,children:[l?e.jsx(se,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(Fe,{className:"h-4 w-4 mr-1"}),l?"Importing...":"Choose CSV File & Import"]}),N.length===0&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"Select at least one event"})]})]})]})})]})},aa=({importResult:n,onDismiss:s})=>e.jsxs("div",{className:`mb-4 p-4 rounded-lg border ${n.errors>0?"bg-yellow-50 border-yellow-200 dark:bg-yellow-900/20 dark:border-yellow-800":"bg-green-50 border-green-200 dark:bg-green-900/20 dark:border-green-800"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:n.errors>
10?e.jsx("span",{className:"text-yellow-800 dark:text-yellow-200",children:"Import completed with warnings"}):e.jsx("span",{className:"text-green-800 dark:text-green-200",children:"Import successful"})}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[n.imported," guest",n.imported!==1?"s":""," imported",n.errors>0&&`, ${n.errors} row${n.errors!==1?"s":""} skipped`]})]}),e.jsxs(j,{variant:"ghost",size:"sm",onClick:s,children:[e.jsx("span",{className:"sr-only",children:"Dismiss"}),"×"]})]}),n.warnings.length>0&&e.jsx("ul",{className:"mt-2 space-y-1",children:n.warnings.map((l,m)=>e.jsxs("li",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:["• ",l]},m))})]}),na=({weddingId:n,guests:s,categories:l,events:m,loading:u,showGuestForm:o,setShowGuestForm:N,editingGuest:w,newGuest:x,setNewGuest:a,onAddGuest:g,onUpdateGuest:p,onEditGuest:C,onDeleteGuest:_,onResetGuestForm:$,onOpenNewGuestForm:te,selectedGuests:M,setSelectedGuests:Y,deletingGuests:B,onBulkDeleteGuests:de,importingGuests:me,importResult:ee,setImportResult:I,onImport:Q,showCategoryForm:q,setShowCategoryForm:fe,newCategory:he,setNewCategory:oe,onAddCategory:ne,onDeleteCategory:ce,onCategoryEventsChange:ae})=>{const[L,Z]=d.useState(""),[O,V]=d.useState("all"),[W,G]=d.useState("all"),D=s.filter(r=>{const i=L===""||r.full_name.toLowerCase().includes(L.toLowerCase())||r.email?.toLowerCase().includes(L.toLowerCase())||r.relationship?.toLowerCase().includes(L.toLowerCase()),f=O==="all"||O==="uncategorized"&&!r.guest_category_id||r.guest_category_id?.toString()===O,h=r.event_guests?.map(T=>T.wedding_event_id)??[],P=W==="all"||W==="not_invited"&&h.length===0||h.includes(Number(W));return i&&f&&P});return e.jsxs("div",{className:"glass-card p-6 rounded-xl",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 mb-4",children:[e.jsxs("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[e.jsx(Ns,{className:"h-5 w-5"}),"All Guests (",s.length,")"]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("a",{href:"/api/weddings/guests/template",download:!0,children:e.jsxs(j,{variant:"outline",size:"sm",type:"button",children:[e.jsx(Gs,{className:"h-4 w-4 mr-1"}),"Template"]})}),e.jsx(ta,{weddingId:n,events:m,importingGuests:me,onImport:Q}),e.jsx("a",{href:`/api/weddings/${n}/guests/export`,download:!0,children:e.jsxs(j,{variant:"outline",size:"sm",type:"button",children:[e.jsx(Gs,{className:"h-4 w-4 mr-1"}),"Export"]})}),e.jsx(sa,{categories:l,events:m,showCategoryForm:q,setShowCategoryForm:fe,newCategory:he,setNewCategory:oe,onAddCategory:ne,onDeleteCategory:ce,onCategoryEventsChange:ae}),e.jsxs(j,{size:"sm",onClick:()=>te(),children:[e.jsx(De,{className:"h-4 w-4 mr-1"}),"New Guest"]})]})]}),ee&&e.jsx(aa,{importResult:ee,onDismiss:()=>I(null)}),o&&e.jsxs("form",{onSubmit:w?p:g,className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6 p-4 bg-muted/50 rounded-lg",children:[e.jsxs("div",{className:"md:col-span-2 flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:w?"Edit Guest":"New Guest"}),e.jsx(j,{type:"button",variant:"ghost",size:"sm",onClick:$,children:e.jsx(Re,{className:"h-4 w-4"})})]}),e.jsx(F,{placeholder:"First Name *",value:x.first_name,onChange:r=>a({...x,first_name:r.target.value}),required:!0}),e.jsx(F,{placeholder:"Last Name",value:x.last_name,onChange:r=>a({...x,last_name:r.target.value})}),e.jsx(F,{type:"email",placeholder:"Email",value:x.email,onChange:r=>a({...x,email:r.target.value})}),e.jsx(F,{placeholder:"Phone",value:x.phone,onChange:r=>a({...x,phone:r.target.value})}),e.jsx(F,{placeholder:"Relationship (e.g., Friend of Groom)",value:x.relationship,onChange:r=>a({...x,relationship:r.target.value})}),e.jsxs("div",{children:[e.jsx(S,{htmlFor:"max_pax",children:"Total Pax (Including Guest)"}),e.jsx(F,{id:"max_pax",type:"number",min:"1",max:"21",placeholder:"Leave empty for default",value:x.max_pax!==""?Number(x.max_pax):"",onChange:r=>{const i=r.target.value;a({...x,max_pax:i?Math.max(1,Number(i)).toString():""})}}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Total number of people including the guest themselves. Default is 6 if not set."})]}),e.jsxs("div",{children:[e.jsx(S,{children:"Guest Category"}),e.jsxs(Ce,{value:x.guest_category_id,onValueChange:r=>a({...x,guest_category_id:r}),children:[e.jsx(ke,{children:e.jsx(Se,{placeholder:"Select category (optional)"})}),e.jsx(Ee,{children:l.map(r=>
1e.jsx(H,{value:r.id.toString(),children:r.name},r.id))})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Group guests for easier management (e.g., Family, Friends, Colleagues)"})]}),m.length>0&&e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(S,{className:"mb-2 block",children:"Invite to Events"}),e.jsx("div",{className:"flex flex-wrap gap-3",children:m.map(r=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-sm",children:[e.jsx(re,{checked:x.assign_to_events.includes(r.id),onCheckedChange:i=>{a({...x,assign_to_events:i?[...x.assign_to_events,r.id]:x.assign_to_events.filter(f=>f!==r.id)})}}),r.name]},r.id))}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:w?"Check events to invite this guest to, or uncheck to remove them":"This guest will be invited to the selected events"})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(j,{type:"submit",children:w?"Update Guest":"Create Guest"})})]}),s.length>0&&e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(F,{placeholder:"Search guests...",value:L,onChange:r=>Z(r.target.value),className:"pl-9"})]}),l.length>0&&e.jsxs(Ce,{value:O,onValueChange:V,children:[e.jsx(ke,{className:"w-48",children:e.jsx(Se,{placeholder:"All Categories"})}),e.jsxs(Ee,{children:[e.jsx(H,{value:"all",children:"All Categories"}),e.jsx(H,{value:"uncategorized",children:"Uncategorized"}),l.map(r=>e.jsxs(H,{value:r.id.toString(),children:[r.name," (",r.guests_count,")"]},r.id))]})]}),m.length>0&&e.jsxs(Ce,{value:W,onValueChange:G,children:[e.jsx(ke,{className:"w-48",children:e.jsx(Se,{placeholder:"All Events"})}),e.jsxs(Ee,{children:[e.jsx(H,{value:"all",children:"All Events"}),e.jsx(H,{value:"not_invited",children:"Not invited yet"}),m.map(r=>e.jsxs(H,{value:r.id.toString(),children:[r.name," (",r.event_guests_count,")"]},r.id))]})]})]}),u?e.jsx("div",{className:"animate-pulse space-y-2",children:[1,2,3].map(r=>e.jsx("div",{className:"h-16 bg-muted rounded"},r))}):s.length===0?e.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No guests added yet"}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-sm",children:[e.jsx(re,{checked:M.length===D.length&&D.length>0,onCheckedChange:r=>{Y(r?D.map(i=>i.id):[])}}),M.length>0?`${M.length} of ${s.length} selected`:"Select all"]}),M.length>0&&e.jsxs(j,{variant:"destructive",size:"sm",onClick:()=>de(M),disabled:B,children:[B?e.jsx(se,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(_e,{className:"h-4 w-4 mr-1"}),"Delete Selected (",M.length,")"]}),M.length===0&&s.length>0&&e.jsxs(j,{variant:"outline",size:"sm",className:"text-destructive border-destructive/30 hover:bg-destructive/10",onClick:()=>de(s.map(r=>r.id)),disabled:B,children:[B?e.jsx(se,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(_e,{className:"h-4 w-4 mr-1"}),"Delete All"]})]}),D.length===0&&L!==""?e.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No guests match your search"}):D.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-3 p-4 bg-muted/30 rounded-lg",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx(re,{checked:M.includes(r.id),onCheckedChange:i=>{Y(i?[...M,r.id]:M.filter(f=>f!==r.id))}}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium break-words",children:r.full_name}),e.jsxs("div",{className:"text-sm text-muted-foreground break-words",children:[r.email&&e.jsx("span",{className:"mr-3",children:r.email}),r.relationship&&e.jsx("span",{children:r.relationship})]})]})]}),e.jsxs("div",{className:"flex shrink-0 max-w-[45%] items-center gap-2 flex-wrap justify-end",children:[r.event_guests?.map(i=>{const f=m.find(h=>h.id===i.wedding_event_id);return f?e.jsx(Ne,{variant:"outline",className:"text-xs",children:f.name},i.id):null}),(!r.event_guests||r.event_guests.length===0)&&e.jsx(Ne,{variant:"outline",className:"text-xs text-muted-foreground",children:"Not invited"}),r.category&&e.jsx(Ne,{style:{backgroundColor:r.category.color},className:"text-white text-xs",children:r.category.name}),e.jsx(j,{variant:"ghost",size:"sm",onClick:()=>C(r),children:e.jsx(et,{className:"h-4 w-4"})}),e.jsx(j,{variant:"ghost",size:"sm",onClick:()=>_(r.id),children:e.jsx(_e,{className:"h-4 w-4 text-destructive"})})]})]},r.id))]})]})},la=({stats:n,loading:s})=>{if(s)return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 animate-pulse",children:[1,2,3,4].map(m=>e.jsx("div",{className:"h-24 bg-muted rounded-xl"},m))});const l=[{label:"Total Guests",value:n.total,subValue:`${n.invited_headcount} pax at this event`,icon:Ns,color:"text-blue-500",bgColor:"bg-blue-500/10"},{label:"Attending",value:n.attending,subValue:`${n.total_attending} confirmed pax`,icon:ts,color:"text-green-500",bgColor:"bg-green-500/10"},{label:"Not Attending",value:n.not_attending,subValue:`${n.total_not_attending} declined pax`,icon:Re,color:"text-red-500",bgColor:"bg-red-500/10"},{label:"Pending",value:n.pending,subValue:`${n.total_pending} pax awaiting`,icon:ws,color:"text-orange-500",bgColor:"bg-orange-500/10"},{label:"Invited",value:n.invited,subValue:`${n.not_invited} not sent`,icon:Te,color:"text-purple-500",bgColor:"bg-purple-500/10"}];return e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 ga
1p-4",children:l.map((m,u)=>{const o=m.icon;return e.jsxs("div",{className:"bg-muted/30 rounded-xl p-4 transition-all hover:bg-muted/50",children:[e.jsx("div",{className:`w-10 h-10 rounded-lg ${m.bgColor} flex items-center justify-center mb-3`,children:e.jsx(o,{className:`h-5 w-5 ${m.color}`})}),e.jsx("div",{className:"text-2xl font-bold",children:m.value}),e.jsx("div",{className:"text-sm text-muted-foreground",children:m.label}),m.subValue&&e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:m.subValue})]},u)})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 px-1 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(as,{className:"h-4 w-4"}),"This event: ",e.jsx("strong",{className:"text-foreground",children:n.invited_headcount})," pax invited"]}),e.jsx("span",{className:"text-muted-foreground/40",children:"|"}),e.jsxs("span",{children:["Confirmed Pax: ",e.jsx("strong",{className:"text-green-500",children:n.total_attending})]}),e.jsx("span",{className:"text-muted-foreground/40",children:"|"}),e.jsxs("span",{children:["Declined Pax: ",e.jsx("strong",{className:"text-red-500",children:n.total_not_attending})]}),e.jsx("span",{className:"text-muted-foreground/40",children:"|"}),e.jsxs("span",{children:["Pending Pax: ",e.jsx("strong",{className:"text-orange-500",children:n.total_pending})]})]}),n.wedding_invited_headcount!==void 0&&n.wedding_guest_count!==void 0&&e.jsxs("div",{className:"px-1 text-xs text-muted-foreground italic",children:["Wedding total: ",e.jsx("strong",{className:"text-foreground not-italic",children:n.wedding_guest_count})," guests"," · ",e.jsx("strong",{className:"text-foreground not-italic",children:n.wedding_invited_headcount})," unique pax invited across all events"]})]})};var Vs=1,ra=.9,ia=.8,da=.17,hs=.1,xs=.999,oa=.9999,ca=.99,ma=/[\\\/_+.#"@\[\(\{&]/,ua=/[\\\/_+.#"@\[\(\{&]/g,ha=/[\s-]/,it=/[\s-]/g;function fs(n,s,l,m,u,o,N){if(o===s.length)return u===n.length?Vs:ca;var w=`${u},${o}`;if(N[w]!==void 0)return N[w];for(var x=m.charAt(o),a=l.indexOf(x,u),g=0,p,C,_,$;a>=0;)p=fs(n,s,l,m,a+1,o+1,N),p>g&&(a===u?p*=Vs:ma.test(n.charAt(a-1))?(p*=ia,_=n.slice(u,a-1).match(ua),_&&u>0&&(p*=Math.pow(xs,_.length))):ha.test(n.charAt(a-1))?(p*=ra,$=n.slice(u,a-1).match(it),$&&u>0&&(p*=Math.pow(xs,$.length))):(p*=da,u>0&&(p*=Math.pow(xs,a-u))),n.charAt(a)!==s.charAt(o)&&(p*=oa)),(p<hs&&l.charAt(a-1)===m.charAt(o+1)||m.charAt(o+1)===m.charAt(o)&&l.charAt(a-1)!==m.charAt(o))&&(C=fs(n,s,l,m,a+1,o+2,N),C*hs>p&&(p=C*hs)),p>g&&(g=p),a=l.indexOf(x,a+1);return N[w]=g,g}function Us(n){return n.toLowerCase().replace(it," ")}function xa(n,s,l){return n=l&&l.length>0?`${n+" "+l.join(" ")}`:n,fs(n,s,Us(n),Us(s),0,0,{})}var qe='[cmdk-group=""]',gs='[cmdk-group-items=""]',ga='[cmdk-group-heading=""]',dt='[cmdk-item=""]',Bs=`${dt}:not([aria-disabled="true"])`,vs="cmdk-item-select",Le="data-value",pa=(n,s,l)=>xa(n,s,l),ot=d.createContext(void 0),Qe=()=>d.useContext(ot),ct=d.createContext(void 0),_s=()=>d.useContext(ct),mt=d.createContext(void 0),ut=d.forwardRef((n,s)=>{let l=Ve(()=>{var r,i;return{search:"",value:(i=(r=n.value)!=null?r:n.defaultValue)!=null?i:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),m=Ve(()=>new Set),u=Ve(()=>new Map),o=Ve(()=>new Map),N=Ve(()=>new Set),w=ht(n),{label:x,children:a,value:g,onValueChange:p,filter:C,shouldFilter:_,loop:$,disablePointerSelection:te=!1,vimBindings:M=!0,...Y}=n,B=Be(),de=Be(),me=Be(),ee=d.useRef(null),I=Sa();Ge(()=>{if(g!==void 0){let r=g.trim();l.current.value=r,Q.emit()}},[g]),Ge(()=>{I(6,ce)},[]);let Q=d.useMemo(()=>({subscribe:r=>(N.current.add(r),()=>N.current.delete(r)),snapshot:()=>l.current,setState:(r,i,f)=>{var h,P,T,J;if(!Object.is(l.current[r],i)){if(l.current[r]=i,r==="search")ne(),he(),I(1,oe);else if(r==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let K=document.getElementById(me);K?K.focus():(h=document.getElementById(B))==null||h.focus()}
vendor: 8,947 bytes, line 1
1if(I(7,()=>{var K;l.current.selectedItemId=(K=ae())==null?void 0:K.id,Q.emit()}),f||I(5,ce),((P=w.current)==null?void 0:P.value)!==void 0){let K=i??"";(J=(T=w.current).onValueChange)==null||J.call(T,K);return}}Q.emit()}},emit:()=>{N.current.forEach(r=>r())}}),[]),q=d.useMemo(()=>({value:(r,i,f)=>{var h;i!==((h=o.current.get(r))==null?void 0:h.value)&&(o.current.set(r,{value:i,keywords:f}),l.current.filtered.items.set(r,fe(i,f)),I(2,()=>{he(),Q.emit()}))},item:(r,i)=>(m.current.add(r),i&&(u.current.has(i)?u.current.get(i).add(r):u.current.set(i,new Set([r]))),I(3,()=>{ne(),he(),l.current.value||oe(),Q.emit()}),()=>{o.current.delete(r),m.current.delete(r),l.current.filtered.items.delete(r);let f=ae();I(4,()=>{ne(),f?.getAttribute("id")===r&&oe(),Q.emit()})}),group:r=>(u.current.has(r)||u.current.set(r,new Set),()=>{o.current.delete(r),u.current.delete(r)}),filter:()=>w.current.shouldFilter,label:x||n["aria-label"],getDisablePointerSelection:()=>w.current.disablePointerSelection,listId:B,inputId:me,labelId:de,listInnerRef:ee}),[]);function fe(r,i){var f,h;let P=(h=(f=w.current)==null?void 0:f.filter)!=null?h:pa;return r?P(r,l.current.search,i):0}function he(){if(!l.current.search||w.current.shouldFilter===!1)return;let r=l.current.filtered.items,i=[];l.current.filtered.groups.forEach(h=>{let P=u.current.get(h),T=0;P.forEach(J=>{let K=r.get(J);T=Math.max(K,T)}),i.push([h,T])});let f=ee.current;L().sort((h,P)=>{var T,J;let K=h.getAttribute("id"),ve=P.getAttribute("id");return((T=r.get(ve))!=null?T:0)-((J=r.get(K))!=null?J:0)}).forEach(h=>{let P=h.closest(gs);P?P.appendChild(h.parentElement===P?h:h.closest(`${gs} > *`)):f.appendChild(h.parentElement===f?h:h.closest(`${gs} > *`))}),i.sort((h,P)=>P[1]-h[1]).forEach(h=>{var P;let T=(P=ee.current)==null?void 0:P.querySelector(`${qe}[${Le}="${encodeURIComponent(h[0])}"]`);T?.parentElement.appendChild(T)})}function oe(){let r=L().find(f=>f.getAttribute("aria-disabled")!=="true"),i=r?.getAttribute(Le);Q.setState("value",i||void 0)}function ne(){var r,i,f,h;if(!l.current.search||w.current.shouldFilter===!1){l.current.filtered.count=m.current.size;return}l.current.filtered.groups=new Set;let P=0;for(let T of m.current){let J=(i=(r=o.current.get(T))==null?void 0:r.value)!=null?i:"",K=(h=(f=o.current.get(T))==null?void 0:f.keywords)!=null?h:[],ve=fe(J,K);l.current.filtered.items.set(T,ve),ve>0&&P++}for(let[T,J]of u.current)for(let K of J)if(l.current.filtered.items.get(K)>0){l.current.filtered.groups.add(T);break}l.current.filtered.count=P}function ce(){var r,i,f;let h=ae();h&&(((r=h.parentElement)==null?void 0:r.firstChild)===h&&((f=(i=h.closest(qe))==null?void 0:i.querySelector(ga))==null||f.scrollIntoView({block:"nearest"})),h.scrollIntoView({block:"nearest"}))}function ae(){var r;return(r=ee.current)==null?void 0:r.querySelector(`${dt}[aria-selected="true"]`)}function L(){var r;return Array.from(((r=ee.current)==null?void 0:r.querySelectorAll(Bs))||[])}function Z(r){let i=L()[r];i&&Q.setState("value",i.getAttribute(Le))}function O(r){var i;let f=ae(),h=L(),P=h.findIndex(J=>J===f),T=h[P+r];(i=w.current)!=null&&i.loop&&(T=P+r<0?h[h.length-1]:P+r===h.length?h[0]:h[P+r]),T&&Q.setState("value",T.getAttribute(Le))}function V(r){let i=ae(),f=i?.closest(qe),h;for(;f&&!h;)f=r>0?Ca(f,qe):ka(f,qe),h=f?.querySelector(Bs);h?Q.setState("value",h.getAttribute(Le)):O(r)}let W=()=>Z(L().length-1),G=r=>{r.preventDefault(),r.metaKey?W():r.altKey?V(1):O(1)},D=r=>{r.preventDefault(),r.metaKey?Z(0):r.altKey?V(-1):O(-1)};return d.createElement(Pe.div,{ref:s,tabIndex:-1,...Y,"cmdk-root":"",onKeyDown:r=>{var i;(i=Y.onKeyDown)==null||i.call(Y,r);let f=r.nativeEvent.isComposing||r.keyCode===229;if(!(r.defaultPrevented||f))switch(r.key){case"n":case"j":{M&&r.ctrlKey&&G(r);break}case"ArrowDown":{G(r);break}case"p":case"k":{M&&r.ctrlKey&&D(r);break}case"ArrowUp":{D(r);break}case"Home":{r.preventDefault(),Z(0);break}case"End":{r.preventDefault(),W();break}case"Enter":{r.preventDefault();let h=ae();if(h){let P=new Event(vs);h.dispatchEvent(P)}}}}},d.createElement("label",{"cmdk-label":"",htmlFor:q.inputId,id:q.labelId,style:$a},x),ns(n,r=>d.createElement(ct.Provider,{value:Q},d.createElement(ot.Provider,{value:q},r))))}),fa=d.forwardRef((n,s)=>{var l,m;let u=Be(),o=d.useRef(null),N=d.useContext(mt),w=Qe(),x=ht(n),a=(m=(l=x.current)==null?void 0:l.forceMount)!=null?m:N?.forceMount;Ge(()=>{if(!a)return w.item(u,N?.id)},[a]);let g=xt(u,o,[n.value,n.children,o],n.keywords),p=_s(),C=Ae(I=>I.value&&I.value===g.current),_=Ae(I=>a||w.filter()===!1?!0:I.search?I.filtered.items.get(u)>0:!0);d.useEffect(()=>{let I=o.current;if(!(!I||n.disabled))return I.addEventListener(vs,$),()=>I.removeEventListener(vs,$)},[_,n.onSelect,n.disabled]);function $(){var I,Q;te(),(Q=(I=x.current).onSelect)==null||Q.call(I,g.current)}function te(){p.setState("value",g.current,!0)}if(!_)return null;let{disabled:M,value:Y,onSelect:B,forceMount:de,keywords:me,...ee}=n;return d.createElement(Pe.div,{ref:We(o,s),...ee,id:u,"cmdk-item":"",role:"option","aria-disabled":!!M,"aria-selected":!!C,"data-disabled":!!M,"data-selected":!!C,onPointerMove:M||w.getDisablePointerSelection()?void 0:te,onClick:M?void 0:$},n.children)}),va=d.forwardRef((n,s)=>{let{heading:l,children:m,forceMount:u,...o}=n,N=Be(),w=d.useRef(null),x=d.useRef(null),a=Be(),g=Qe(),p=Ae(_=>u||g.filter()===!1?!0:_.search?_.filtered.groups.has(N):!0);Ge(()=>g.group(N),[]),xt(N,w,[n.value,n.heading,x]);let C=d.useMemo(()=>({id:N,forceMount:u}),[u]);return d.createElement(Pe.div,{ref:We(w,s),...o,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},l&&d.createElement("div",{ref:x,"cmdk-group-heading":"","aria-hidden":!0,id:a},l),ns(n,_=>d.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":l?a:void 0},d.createElement(mt.Provider,{value:C},_))))}),ja=d.forwardRef((n,s)=>{let{alwaysRender:l,...m}=n,u=d.useRef(null),o=Ae(N=>!N.search);return!l&&!o?null:d.createElement(Pe.div,{ref:We(u,s),...m,"cmdk-separator":"",role:"separator"})}),ya=d.forwardRef((n,s)=>{let{onValueChange:l,...m}=n,u=n.value!=null,o=_s(),N=Ae(a=>a.search),w=Ae(a=>a.selectedItemId),x=Qe();return d.useEffect(()=>{n.value!=null&&o.setState("search",n.value)},[n.value]),d.createElement(Pe.input,{ref:s,...m,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":x.listId,"aria-labelledby":x.labelId,"aria-activedescendant":w,id:x.inputId,type:"text",value:u?n.value:N,onChange:a=>{u||o.setState("search",a.target.value),l?.(a.target.value)}})}),Na=d.forwardRef((n,s)=>{let{children:l,label:m="Suggestions",...u}=n,o=d.useRef(null),N=d.useRef(null),w=Ae(a=>a.selectedItemId),x=Qe();return d.useEffect(()=>{if(N.current&&o.current){let a=N.current,g=o.current,p,C=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let _=a.offsetHeight;g.style.setProperty("--cmdk-list-height",_.toFixed(1)+"px")})});return C.observe(a),()=>{cancelAnimationFrame(p),C.unobserve(a)}}},[]),d.createElement(Pe.div,{ref:We(o,s),...u,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":w,"aria-label":m,id:x.listId},ns(n,a=>d.createElement("div",{ref:We(N,x.listInnerRef),"cmdk-list-sizer":""},a)))}),ba=d.forwardRef((n,s)=>{let{open:l,onOpenChange:m,overlayClassName:u,contentClassName:o,container:N,...w}=n;return d.createElement(Ks,{open:l,onOpenChange:m},d.createElement(Xs,{container:N},d.createElement(ys,{"cmdk-overlay":"",className:u}),d.createElement(js,{"aria-label":n.label,"cmdk-dialog":"",className:o},d.createElement(ut,{ref:s,...w}))))}),wa=d.forwardRef((n,s)=>Ae(l=>l.filtered.count===0)?d.createElement(Pe.div,{ref:s,...n,"cmdk-empty":"",role:"presentation"}):null),_a=d.forwardRef((n,s)=>{let{progress:l,children:m,label:u="Loading...",...o}=n;return d.createElement(Pe.div,{ref:s,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":l,"aria-valuemin":0,"aria-valuemax":100,"aria-label":u},ns(n,N=>d.createElement("div",{"aria-hidden":!0},N)))}),ie=Object.assign(ut,{List:Na,Item:fa,Input:ya,Group:va,Separator:ja,Dialog:ba,Empty:wa,Loading:_a});function Ca(n,s){let l=n.nextElementSibling;for(;l;){if(l.matches(s))return l;l=l.nextElementSibling}}function ka(n,s){let l=n.previousElementSibling;for(;l;){if(l.matches(s))return l;l=l.previousElementSibling}}function ht(n){let s=d.useRef(n);return Ge(()=>{s.current=n}),s}var Ge=typeof window>"u"?d.useEffect:d.useLayoutEffect;function Ve(n){let s=d.useRef();return s.current===void 0&&(s.current=n()),s}function Ae(n){let s=_s(),l=()=>n(s.snapshot());return d.useSyncExternalStore(s.subscribe,l,l)}function xt(n,s,l,m=[]){let u=d.useRef(),o=Qe();return Ge(()=>{var N;let w=(()=>{var a;for(let g of l){if(typeof g=="string")return g.trim();if(typeof g=="object"&&"current"in g)return g.current?(a=g.current.textContent)==null?void 0:a.trim():u.current}})(),x=m.map(a=>a.trim());o.value(n,w,x),(N=s.current)==null||N.setAttribute(Le,w),u.current=w}),u}var Sa=()=>
1{let[n,s]=d.useState(),l=Ve(()=>new Map);return Ge(()=>{l.current.forEach(m=>m()),l.current=new Map},[n]),(m,u)=>{l.current.set(m,u),s({})}};function Ea(n){let s=n.type;return typeof s=="function"?s(n.props):"render"in s?s.render(n.props):n}function ns({asChild:n,children:s},l){return n&&d.isValidElement(s)?d.cloneElement(Ea(s),{ref:s.ref},l(s.props.children)):l(s)}var $a={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const gt=d.forwardRef(({className:n,...s},l)=>e.jsx(ie,{ref:l,className:pe("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",n),...s}));gt.displayName=ie.displayName;const pt=d.forwardRef(({className:n,...s},l)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(bs,{className:"mr-1 h-4 w-4 shrink-0 opacity-50"}),e.jsx(ie.Input,{ref:l,className:pe("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",n),...s})]}));pt.displayName=ie.Input.displayName;const ft=d.forwardRef(({className:n,...s},l)=>e.jsx(ie.List,{ref:l,className:pe("max-h-[300px] overflow-y-auto overflow-x-hidden",n),...s}));ft.displayName=ie.List.displayName;const vt=d.forwardRef((n,s)=>e.jsx(ie.Empty,{ref:s,className:"py-6 text-center text-sm",...n}));vt.displayName=ie.Empty.displayName;const es=d.forwardRef(({className:n,...s},l)=>e.jsx(ie.Group,{ref:l,className:pe("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",n),...s}));es.displayName=ie.Group.displayName;const Fa=d.forwardRef(({className:n,...s},l)=>e.jsx(ie.Separator,{ref:l,className:pe("-mx-1 h-px bg-border",n),...s}));Fa.displayName=ie.Separator.displayName;const Ue=d.forwardRef(({className:n,...s},l)=>e.jsx(ie.Item,{ref:l,className:pe("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",n),...s}));Ue.displayName=ie.Item.displayName;const Ra=({selectedEvent:n,guestsNotInEvent:s,categories:l,addGuestsPickerOpen:m,setAddGuestsPickerOpen:u,addGuestsSelected:o,setAddGuestsSelected:N,onInvite:w,addingAllGuests:x,onCreateNewGuest:a})=>e.jsxs(It,{open:m,onOpenChange:g=>{u(g),g||N([])},children:[e.jsx(Dt,{asChild:!0,children:e.jsxs(j,{size:"sm",variant:"outline",disabled:s.length===0,children:[e.jsx(ps,{className:"h-4 w-4 mr-2"}),s.length===0?"All Guests Invited":`Invite Guests to ${n.name}`]})}),e.jsxs(Tt,{className:"w-80 p-0",align:"start",children:[e.jsxs(gt,{children:[e.jsx(pt,{placeholder:"Search guests..."}),e.jsxs(ft,{className:"max-h-64",children:[e.jsx(vt,{children:"No guests found."}),e.jsx(es,{children:e.jsxs(Ue,{onSelect:()=>{N(o.length===s.length?[]:s.map(g=>g.id))},children:[e.jsx(re,{checked:o.length===s.length&&s.length>0,className:"mr-2"}),e.jsxs("span",{className:"font-medium",children:["Select All (",s.length,")"]})]})}),l.filter(g=>s.some(p=>p.guest_category_id===g.id)).map(g=>{const p=s.filter(_=>_.guest_category_id===g.id),C=p.every(_=>o.includes(_.id));return e.jsxs(es,{heading:g.name,children:[e.jsxs(Ue,{onSelect:()=>{const _=p.map($=>$.id);N(C?o.filter($=>!_.includes($)):[...new Set([...o,..._])])},children:[e.jsx(re,{checked:C,className:"mr-2"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["All ",g.name," (",p.length,")"]})]}),p.map(_=>e.jsxs(Ue,{value:_.full_name,onSelect:()=>{N(o.includes(_.id)?o.filter($=>$!==_.id):[...o,_.id])},children:[e.jsx(re,{checked:o.includes(_.id),className:"mr-2"}),e.jsx("span",{children:_.full_name}),_.email&&e.jsx("span",{className:"ml-auto text-xs text-muted-foreground truncate max-w-[120px]",children:_.email})]},_.id))]},g.id)}),s.filter(g=>!g.guest_category_id).length>0&&e.jsx(es,{heading:"Uncategorized",children:(()=>{const g=s.filter(C=>!C.guest_category_id),p=g.every(C=>o.includes(C.id));return e.jsxs(e.Fragment,{children:[e.jsxs(Ue,{onSelect:()=>{const C=g.map(_=>_.id);N(p?o.filter(_=>!C.includes(_)):[...new Set([...o,...C])])},children:[e.jsx(re,{checked:p,className:"mr-2"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["All Uncategorized (",g.length,")"]})]}),g.map(C=>e.jsxs(Ue,{value:C.full_name,onSelect:()=>{N(o.includes(C.id)?o.filter(_=>_!==C.id):[...o,C.id])},children:[e.jsx(re,{checked:o.includes(C.id),className:"mr-2"}),e.jsx("span",{children:C.full_name}),C.email&&e.jsx("span",{className:"ml-auto text-xs text-muted-foreground truncate max-w-[120px]",children:C.email})]},C.id))]})})()})]})]}),e.jsxs("div",{className:"border-t p-2 space-y-2",children:[o.length>0&&e.jsxs(j,{size:"sm",className:"w-full",onClick:w,disabled:x,children:[x?e.jsx(se,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(ps,{className:"h-4 w-4 mr-2"}),"Invite ",o.length," Guest",o.length!==1?"s":""]}),e.jsxs("button",{type:"button",className:"w-full text-xs text-muted-foreground hover:text-foreground text-center py-1 transition-colors",onClick:()=>{u(!1),a()},children:[e.jsx(as,{className:"h-3 w-3 inline mr-1"}),"Guest not listed? Create new guest"]})]})]})]}),Aa=n=>qs(n,"TBD"),Pa=n=>{const s={pending:"bg-orange-100 text-orange-700 border-orange-200",attending:"bg-green-100 text-green-700 border-green-200",not_attending:"bg-red-100 text-red-700 border-red-200"};return s[n]||s.pending},Ia=({weddingId:n,events:s,guests:l,categories:m,selectedEvent:u,eventGuests:o,eventGuestsLoading:N,rsvpStats:w,selectedEventGuests:x,bulkSending:a,sendingReminder:g,addingAllGuests:p,guestsNotInEvent:C,addGuestsPickerOpen:_,setAddGuestsPickerOpen:$,addGuestsSelected:te,setAddGuestsSelected:M,setSelectedEvent:Y,setSelectedEventGuests:B,onInviteGuests:de,onRemoveEventGuest:me,onUpdateRsvpStatus:ee,onUpdateTotalPax:I,onBulkSendInvitations:Q,onBulkSendReminder:q,toggleSelectEventGuest:fe,toggleSelectAll:he,onPreviewEmail:oe,onPreviewReminder:ne,onCreateNewGuest:ce,onImportToEvent:ae,importingGuests:L})=>
1{const Z=d.useRef(null),[O,V]=d.useState("all"),[W,G]=d.useState(""),D=d.useMemo(()=>{let i=o;O!=="all"&&(i=i.filter(h=>h.rsvp_status===O));const f=W.trim().toLowerCase();return f&&(i=i.filter(h=>{const P=(h.guest.full_name??"").toLowerCase(),T=(h.guest.email??"").toLowerCase(),J=(h.guest.phone??"").toLowerCase();return P.includes(f)||T.includes(f)||J.includes(f)})),i},[o,O,W]),r=i=>{u&&ae(i,[u.id])};return s.length===0?e.jsx("div",{className:"glass-card p-6 rounded-xl",children:e.jsxs("div",{className:"text-center py-12 space-y-3",children:[e.jsx(Te,{className:"h-12 w-12 text-muted-foreground/40 mx-auto"}),e.jsx("p",{className:"text-muted-foreground font-medium",children:"No events created yet"}),e.jsxs("p",{className:"text-sm text-muted-foreground max-w-md mx-auto",children:["Go to the ",e.jsx("strong",{children:"Events"})," tab to create your wedding events (e.g., Ceremony, Reception), then come back here to manage RSVPs."]})]})}):e.jsxs("div",{className:"glass-card p-6 rounded-xl",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[e.jsx(Te,{className:"h-5 w-5"}),"Event RSVPs"]}),s.length<=4?e.jsx("div",{className:"flex items-center gap-1 bg-muted/50 rounded-lg p-1",children:s.map(i=>e.jsx("button",{type:"button",onClick:()=>{Y(i),B([])},className:`px-3 py-1.5 rounded-md text-sm font-medium transition-colors ${u?.id===i.id?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"}`,children:i.name},i.id))}):e.jsxs(Ce,{value:u?.id.toString()||"",onValueChange:i=>{const f=s.find(h=>h.id.toString()===i);Y(f||null),B([])},children:[e.jsx(ke,{className:"w-64",children:e.jsx(Se,{placeholder:"Select an event"})}),e.jsx(Ee,{children:s.map(i=>e.jsxs(H,{value:i.id.toString(),children:[i.name," (",Aa(i.event_date),")"]},i.id))})]})]}),u?e.jsxs(e.Fragment,{children:[w&&e.jsx("div",{className:"mb-6",children:e.jsx(la,{stats:w,loading:N})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-4 p-4 bg-muted/30 rounded-lg",children:[e.jsx(Ra,{selectedEvent:u,guestsNotInEvent:C,categories:m,addGuestsPickerOpen:_,setAddGuestsPickerOpen:$,addGuestsSelected:te,setAddGuestsSelected:M,onInvite:de,addingAllGuests:p,onCreateNewGuest:ce}),e.jsx("input",{ref:Z,type:"file",accept:".csv,.xlsx,.xls",onChange:r,className:"hidden"}),e.jsxs(j,{variant:"outline",size:"sm",onClick:()=>Z.current?.click(),disabled:L,children:[L?e.jsx(se,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(Fe,{className:"h-4 w-4 mr-1"}),"Import CSV to This Event"]}),o.filter(i=>i.guest.email).length>0&&e.jsxs(j,{size:"sm",variant:"outline",onClick:()=>{const i=o.filter(f=>f.guest.email).map(f=>f.id);B(i),Q(i)},disabled:a,children:[a&&x.length===o.filter(i=>i.guest.email).length?e.jsx(se,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(He,{className:"h-4 w-4 mr-2"}),"Send to All"]}),o.some(i=>i.rsvp_status==="pending"&&i.invitation_sent_at&&i.guest.email)&&e.jsxs(j,{size:"sm",variant:"outline",onClick:q,disabled:g,children:[g?e.jsx(se,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(Je,{className:"h-4 w-4 mr-2"}),"Send Reminder"]}),x.length>0&&(()=>{const i=o.filter(h=>x.includes(h.id)&&h.invitation_sent_at!==null).length,f=x.length-i;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(j,{size:"sm",onClick:()=>Q(),disabled:a,className:"bg-primary text-black",children:[a?e.jsx(se,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(He,{className:"h-4 w-4 mr-2"}),"Send to ",x.length," Selected"]}),e.jsxs(j,{size:"sm",variant:"outline",onClick:()=>q(x),disabled:g,children:[g?e.jsx(se,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(Je,{className:"h-4 w-4 mr-2"}),"Remind Selected"]}),i>0&&e.jsxs("span",{className:"text-xs text-amber-600",children:[i," already sent, ",f," new"]})]})})(),e.jsxs("div",{className:"flex items-center gap-3 ml-auto",children:[e.jsxs("div",{className:"relative",children:[e.jsx(bs,{className:"h-3.5 w-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e.jsx(F,{type:"search",value:W,onChange:i=>G(i.target.value),placeholder:"Search guests…",className:"h-8 text-xs w-48 pl-8 pr-7"}),W&&e.jsx("button",{type:"button",onClick:()=>G(""),className:"absolute right-1.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground p-0.5","aria-label":"Clear search",children:e.jsx(Re,{className:"h-3 w-3"})})]}),e.jsxs(Ce,{value:O,onValueChange:V,children:[e.jsx(ke,{className:"w-36 h-8 text-xs",children:e.jsx(Se,{placeholder:"Filter status"})}),e.jsxs(Ee,{children:[e.jsx(H,{value:"all",children:"All Statuses"}),e.jsx(H,{value:"pending",children:"Pending"}),e.jsx(H,{value:"attending",children:"Attending"}),e.jsx(H,{value:"not_attending",children:"Declined"})]})]}),e.jsxs("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:[D.length,O!=="all"||W?`/${o.length}`:""," guests",x.length>0&&` · ${x.length} selected`]})]})]}),o.length>0&&x.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground mb-3 flex items-center gap-1",children:'Select guests using the checkboxes below, then click "Send to Selected" to send invitations in bulk.'}),N?e.jsx("div",{className:"animate-pulse space-y-2",children:[1,2,3].map(i=>e.jsx("div",{className:"h-16 bg-muted rounded"},i))}):D.length===0&&o.length===0?e.jsxs("div",{className:"text-center py-12 space-y-4",children:[e.jsx(as,{className:"h-12 w-12 text-muted-foreground
1/40 mx-auto"}),e.jsxs("p",{className:"text-muted-foreground font-medium",children:["No guests invited to ",u.name," yet"]}),e.jsxs("div",{className:"flex items-center justify-center gap-3",children:[e.jsxs(j,{variant:"outline",size:"sm",onClick:()=>$(!0),disabled:C.length===0,children:[e.jsx(ps,{className:"h-4 w-4 mr-2"}),"Invite Existing Guests"]}),e.jsxs(j,{variant:"outline",size:"sm",onClick:()=>Z.current?.click(),children:[e.jsx(Fe,{className:"h-4 w-4 mr-2"}),"Import CSV"]}),e.jsxs(j,{variant:"outline",size:"sm",onClick:ce,children:[e.jsx(as,{className:"h-4 w-4 mr-2"}),"Create New Guest"]})]})]}):D.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No guests with this status."}):e.jsx("div",{className:"border rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-muted/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-left",children:e.jsx(re,{checked:x.length===D.filter(i=>i.guest.email).length&&D.filter(i=>i.guest.email).length>0,onCheckedChange:he})}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"Guest"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"Email"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"RSVP Status"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"Total Pax"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"Invited"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"Reminder"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"Notes"}),e.jsx("th",{className:"px-4 py-3 text-right text-sm font-medium",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-border",children:D.map(i=>e.jsxs("tr",{className:"hover:bg-muted/30",children:[e.jsx("td",{className:"px-4 py-3",children:i.guest.email&&e.jsx(re,{checked:x.includes(i.id),onCheckedChange:()=>fe(i.id)})}),e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("div",{className:"font-medium",children:i.guest.full_name}),i.guest.relationship&&e.jsx("div",{className:"text-xs text-muted-foreground",children:i.guest.relationship})]}),e.jsx("td",{className:"px-4 py-3 text-sm",children:i.guest.email||e.jsx("span",{className:"text-muted-foreground italic",children:"No email"})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs(Ce,{value:i.rsvp_status,onValueChange:f=>ee(i.id,f),children:[e.jsx(ke,{className:`w-32 h-8 text-xs ${Pa(i.rsvp_status)}`,children:e.jsx(Se,{})}),e.jsxs(Ee,{children:[e.jsx(H,{value:"pending",children:"Pending"}),e.jsx(H,{value:"attending",children:"Attending"}),e.jsx(H,{value:"not_attending",children:"Declined"})]})]})}),e.jsx("td",{className:"px-4 py-3 text-sm",children:e.jsx("input",{type:"number",min:1,max:21,className:"w-16 h-8 text-center text-sm border rounded px-1 bg-background",value:i.total_pax,onChange:f=>{const h=parseInt(f.target.value,10);!isNaN(h)&&h>=1&&I(i.id,h)}})}),e.jsx("td",{className:"px-4 py-3",children:i.invitation_sent_at?e.jsxs("div",{className:"flex items-center text-green-600 text-sm",children:[e.jsx(ts,{className:"h-4 w-4 mr-1"}),"Sent"]}):e.jsxs("div",{className:"flex items-center text-muted-foreground text-sm",children:[e.jsx(ws,{className:"h-4 w-4 mr-1"}),"Not sent"]})}),e.jsx("td",{className:"px-4 py-3",children:i.reminder_sent_at?e.jsxs("div",{className:"flex items-center text-blue-600 text-sm",title:_t(i.reminder_sent_at),children:[e.jsx(Je,{className:"h-4 w-4 mr-1"}),"Sent"]}):e.jsx("span",{className:"text-muted-foreground/40 text-sm",children:"-"})}),e.jsx("td",{className:"px-4 py-3 text-sm",children:i.notes?e.jsxs("span",{className:"flex items-start gap-1 text-muted-foreground",title:i.notes,children:[e.jsx(Gt,{className:"h-3.5 w-3.5 mt-0.5 flex-shrink-0"}),e.jsx("span",{className:"line-clamp-2 max-w-[150px]",children:i.notes})]}):e.jsx("span",{className:"text-muted-foreground/40",children:"-"})}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(j,{variant:"outline",size:"sm",title:"Copy RSVP link",onClick:()=>{navigator.clipboard.writeText(i.rsvp_link),y.success("RSVP link copied to clipboard")},children:e.jsx(st,{className:"h-4 w-4"})}),i.guest.email&&e.jsx(j,{variant:"outline",size:"sm",title:"Preview invitation email",onClick:()=>oe(i.id),children:e.jsx(ss,{className:"h-4 w-4"})}),i.guest.email&&i.invitation_sent_at&&e.jsx(j,{variant:"outline",size:"sm",title:"Preview reminder email",onClick:()=>ne(i.id),children:e.jsx(Je,{className:"h-4 w-4"})}),e.jsx(j,{variant:"ghost",size:"sm",onClick:()=>me(i.id),children:e.jsx(_e,{className:"h-4 w-4 text-destructive"})})]})})]},i.id))})]})})]}):e.jsx("div",{className:"text-center py-12 space-y-3",children:e.jsx("p",{className:"text-muted-foreground",children:"Select an event above to manage RSVPs"})})]})}
1,Oe={first_name:"",last_name:"",email:"",phone:"",relationship:"",guest_category_id:"",max_pax:"",assign_to_events:[]};function Da(n){const[s,l]=d.useState([]),[m,u]=d.useState([]),[o,N]=d.useState([]),[w,x]=d.useState(!0),[a,g]=d.useState(null),[p,C]=d.useState([]),[_,$]=d.useState(!1),[te,M]=d.useState(null),[Y,B]=d.useState([]),[de,me]=d.useState(!1),[ee,I]=d.useState(!1),[Q,q]=d.useState(!1),fe=d.useRef(null),[he,oe]=d.useState(!1),[ne,ce]=d.useState(null),[ae,L]=d.useState(!1),[Z,O]=d.useState(null),[V,W]=d.useState({...Oe}),[G,D]=d.useState(!1),[r,i]=d.useState({name:"",color:"#6366f1"}),[f,h]=d.useState([]),[P,T]=d.useState(!1),[J,K]=d.useState(!1),[ve,Ke]=d.useState([]),ls=s.filter(v=>!p.some(b=>b.wedding_guest_id===v.id));d.useEffect(()=>{le()},[n]),d.useEffect(()=>{a&&(xe(a.id),je(a.id))},[a]);const le=async()=>{try{const[v,b,A]=await Promise.all([R.get(`/api/weddings/${n}/guests`),R.get(`/api/weddings/${n}/categories`),R.get(`/api/weddings/${n}/events`)]);l(v.data.data),u(b.data.data),N(A.data.data),A.data.data.length>0&&!a&&g(A.data.data[0])}catch(v){console.error(v)}finally{x(!1)}},xe=async v=>{$(!0);try{const A=[...(await R.get(`/api/weddings/${n}/events/${v}/guests`)).data.data].sort((U,z)=>U.guest.full_name.localeCompare(z.guest.full_name));C(A)}catch(b){console.error(b)}finally{$(!1)}},je=async v=>{try{const b=await R.get(`/api/weddings/${n}/events/${v}/guests/stats`);M(b.data.data)}catch(b){console.error(b)}};return{guests:s,categories:m,events:o,loading:w,selectedEvent:a,eventGuests:p,eventGuestsLoading:_,rsvpStats:te,selectedEventGuests:Y,bulkSending:de,sendingReminder:ee,addingAllGuests:Q,guestsNotInEvent:ls,importFileRef:fe,importingGuests:he,importResult:ne,setImportResult:ce,showGuestForm:ae,setShowGuestForm:L,editingGuest:Z,newGuest:V,setNewGuest:W,showCategoryForm:G,setShowCategoryForm:D,newCategory:r,setNewCategory:i,selectedGuests:f,setSelectedGuests:h,deletingGuests:P,addGuestsPickerOpen:J,setAddGuestsPickerOpen:K,addGuestsSelected:ve,setAddGuestsSelected:Ke,setSelectedEvent:g,setSelectedEventGuests:B,fetchData:le,fetchEventGuests:xe,fetchRsvpStats:je,handleAddGuest:async v=>{v.preventDefault();try{const A=(await R.post(`/api/weddings/${n}/guests`,{...V,guest_category_id:V.guest_category_id||null,max_pax:V.max_pax!==""?Number(V.max_pax):null})).data.data?.id;return A&&V.assign_to_events.length>0&&await Promise.all(V.assign_to_events.map(U=>R.post(`/api/weddings/${n}/events/${U}/guests`,{wedding_guest_id:A}))),y.success("Guest added successfully!"),L(!1),W({...Oe}),le(),A}catch(b){if(b.response?.status===422&&b.response?.data?.errors){const A=Object.values(b.response.data.errors).flat();y.error(A.join(", "))}else y.error(b.response?.data?.message||"Failed to add guest");return null}},handleUpdateGuest:async v=>{if(v.preventDefault(),!!Z)try{await R.put(`/api/weddings/${n}/guests/${Z.id}`,{...V,guest_category_id:V.guest_category_id||null,max_pax:V.max_pax!==""?Number(V.max_pax):null});const b=new Map((Z.event_guests??[]).map(X=>[X.wedding_event_id,X.id])),A=Array.from(b.keys()),U=V.assign_to_events,z=U.filter(X=>!b.has(X)),$e=A.filter(X=>!U.includes(X));(z.length>0||$e.length>0)&&await Promise.all([...z.map(X=>R.post(`/api/weddings/${n}/events/${X}/guests`,{wedding_guest_id:Z.id})),...$e.map(X=>R.delete(`/api/weddings/${n}/events/${X}/guests/${b.get(X)}`))]),y.success("Guest updated successfully!"),L(!1),O(null),W({...Oe}),le(),a&&(z.includes(a.id)||$e.includes(a.id))&&(xe(a.id),je(a.id))}catch(b){y.error(b.response?.data?.message||"Failed to update guest")}},handleEditGuest:v=>{O(v),W({first_name:v.first_name,last_name:v.last_name||"",email:v.email||"",phone:v.phone||"",relationship:v.relationship||"",guest_category_id:v.guest_category_id?.toString()||"",max_pax:v.max_pax??"",assign_to_events:v.event_guests?.map(b=>b.wedding_event_id)??[]}),L(!0)},handleDeleteGuest:async v=>{if(confirm("Are you sure you want to delete this guest?"))try{await R.delete(`/api/weddings/${n}/guests/${v}`),y.success("Guest deleted successfully!"),h(b=>b.filter(A=>A!==v)),le()}catch{y.error("Failed to delete guest")}},handleBulkDeleteGuests:async v=>{if(v.length===0)return;const b=v.length===s.length?"ALL":v.length.toString();if(confirm(`Are you sure you want to delete ${b} guest${v.length!==1?"s":""}? This will also remove them from all events and RSVPs.`)){T(!0);try{const A=await R.post(`/api/weddings/${n}/guests/bulk-delete`,{guest_ids:v});y.success(A.data.message),h([]),le()}catch(A){y.error(A.response?.data?.message||"Failed to delete guests")}finally{T(!1)}}},handleImportGuests:async(v,b=[])=>{const A=v.target.files?.[0];if(!A)return;oe(!0);const U=new FormData;U.append("file",A),b.forEach(z=>{U.append("event_ids[]",z.toString())});try{const z=await R.post(`/api/weddings/${n}/guests/import`,U,{headers:{"Content-Type":"multipart/form-data"}});ce({imported:z.data.imported,errors:z.data.errors,warnings:z.data.warnings||[]}),y.success(z.data.message),le()}catch(z){console.error("Guest import failed:",z),y.error(z.response?.data?.message||"Failed to import guests")}finally{v.target.value="",oe(!1)}},handleAddCategory:async v=>{v.preventDefault();try{await R.post(`/api/weddings/${n}/categories`,r),y.success("Category added successfully!"),D(!1),i({name:"",color:"#6366f1"}),le()}catch(b){y.error(b.response?.data?.message||"Failed to add category")}}
1,handleDeleteCategory:async v=>{if(confirm("Are you sure you want to delete this category? Guests in this category will be uncategorized."))try{await R.delete(`/api/weddings/${n}/categories/${v}`),y.success("Category deleted successfully!"),le()}catch{y.error("Failed to delete category")}},handleCategoryEventsChange:async(v,b,A)=>{const z=m.find(X=>X.id===v)?.events?.map(X=>X.id)||[],$e=A?[...z,b]:z.filter(X=>X!==b);try{await R.put(`/api/weddings/${n}/categories/${v}/events`,{event_ids:$e}),y.success("Category events updated!"),le()}catch{y.error("Failed to update category events")}},handleAddSelectedGuestsToEvent:async()=>{if(!(!a||ve.length===0)){q(!0);try{const v=await R.post(`/api/weddings/${n}/events/${a.id}/guests/add`,{guest_ids:ve});y.success(v.data.message),Ke([]),K(!1),xe(a.id),je(a.id),le()}catch(v){y.error(v.response?.data?.message||"Failed to add guests")}finally{q(!1)}}},handleRemoveEventGuest:async v=>{if(a)try{await R.delete(`/api/weddings/${n}/events/${a.id}/guests/${v}`),y.success("Guest removed from event"),xe(a.id),je(a.id),le()}catch{y.error("Failed to remove guest")}},handleUpdateRsvpStatus:async(v,b)=>{if(a)try{await R.put(`/api/weddings/${n}/events/${a.id}/guests/${v}`,{rsvp_status:b}),y.success("RSVP status updated!"),xe(a.id),je(a.id)}catch{y.error("Failed to update RSVP status")}},handleUpdateTotalPax:async(v,b)=>{if(a)try{await R.put(`/api/weddings/${n}/events/${a.id}/guests/${v}`,{total_pax:b}),y.success("Total pax updated!"),xe(a.id),je(a.id)}catch{y.error("Failed to update total pax")}},handleBulkSendInvitations:async v=>{const b=v||Y;if(!a||b.length===0)return;const A=p.filter(ge=>b.includes(ge.id)),U=A.filter(ge=>ge.invitation_sent_at!==null),z=A.filter(ge=>ge.invitation_sent_at===null),$e=A.filter(ge=>!ge.guest.email);let X=`Send invitations to ${A.length} selected guest(s)?
2
3`;X+=`- ${z.length} new invitation(s)
4`,U.length>0&&(X+=`- ${U.length} already sent (will be skipped)
5`),$e.length>0&&(X+=`- ${$e.length} without email (will fail)
6`);let Ps=!1;if(confirm(X)){U.length>0&&(Ps=confirm(`${U.length} guest(s) already received invitations.
7
8Click OK to resend to ALL selected guests (including already sent).
9Click Cancel to only send to new guests.`)),me(!0);try{const ge=await R.post(`/api/weddings/${n}/events/${a.id}/guests/bulk-send-rsvp`,{event_guest_ids:b,resend:Ps});y.success(ge.data.message),B([]),xe(a.id),je(a.id)}catch(ge){y.error(ge.response?.data?.message||"Failed to send invitations")}finally{me(!1)}}},handleBulkSendReminder:async v=>{if(!a)return;const b=v||Y,A=b.length>0;if(A){const U=p.filter(z=>b.includes(z.id)&&z.guest.email);if(U.length===0){y.info("No selected guests with email to send reminders to.");return}if(!confirm(`Send RSVP reminder to ${U.length} selected guest(s)?`))return}else{const U=p.filter(z=>z.rsvp_status==="pending"&&z.invitation_sent_at&&z.guest.email);if(U.length===0){y.info("No pending guests with email to send reminders to.");return}if(!confirm(`Send RSVP reminder to ${U.length} pending guest(s)?`))return}I(!0);try{const U=await R.post(`/api/weddings/${n}/events/${a.id}/guests/bulk-send-reminder`,A?{event_guest_ids:b}:{});y.success(U.data.message),B([]),xe(a.id)}catch(U){y.error(U.response?.data?.message||"Failed to send reminders")}finally{I(!1)}},toggleSelectEventGuest:v=>{B(b=>b.includes(v)?b.filter(A=>A!==v):[...b,v])},toggleSelectAll:()=>{const v=p.filter(b=>b.guest.email);Y.length===v.length?B([]):B(v.map(b=>b.id))},resetGuestForm:()=>{O(null),W({...Oe}),L(!1)},openNewGuestForm:v=>{O(null),W({...Oe,assign_to_events:v||[]}),L(!0)}}}const sl=({wedding:n})=>{const[s,l]=d.useState(n),[m,u]=d.useState(!1),[o,N]=d.useState("guests"),[w,x]=d.useState("all-guests"),a=Da(s.id),[g,p]=d.useState(""),[C,_]=d.useState([]),[$,te]=d.useState(!1),[M,Y]=d.useState(null),[B,de]=d.useState(!1),[me,ee]=d.useState("invitation"),[I,Q]=d.useState(null),[q,fe]=d.useState([]),[he,oe]=d.useState(!1),[ne,ce]=d.useState(!1),[ae,L]=d.useState(null),[Z,O]=d.useState(!1),[V,W]=d.useState(null),[G,D]=d.useState({name:"",description:"",event_date:"",start_time:"",end_time:"",venue_name:"",venue_address:"",dress_code:"",is_active:!0});d.useEffect(()=>{r()},[s.id]);const r=async()=>{oe(!0);try{const t=await R.get(`/api/weddings/${s.id}/gallery`);fe(t.data.data)}catch(t){console.error(t)}finally{oe(!1)}},i=async(t,c)=>{const E=t.target.files?.[0];if(!E)return;Q(c);const k=new FormData;k.append("image",E),k.append("field",c);try{const ye=await R.post(`/api/weddings/${s.id}/upload-image`,k,{headers:{"Content-Type":"multipart/form-data"}});l({...s,[c]:ye.data.data.path,[`${c}_url`]:ye.data.data.url}),y.success("Image uploaded successfully!")}catch(ye){y.error(ye.response?.data?.message||"Failed to upload image")}finally{Q(null),t.target.value=""}},f=12,h=5,P=async t=>{const c=t.target.files;if(!c||c.length===0)return;const E=f-q.length;if(E<=0){y.error(`Gallery limit reached. Maximum ${f} photos allowed.`),t.target.value="";return}const k=Array.from(c).slice(0,E);c.length>E&&y.warning(`Only uploading ${E} of ${c.length} photos (gallery limit: ${f}).`,{duration:5e3});const ye=k.filter(Ie=>Ie.size>h*1024*1024?(y.error(`"${Ie.name}" exceeds ${h}MB limit`,{description:`File size: ${(Ie.size/(1024*1024)).toFixed(1)}MB. Please compress or resize before uploading.`,duration:6e3}),!1):!0);if(ye.length===0){t.target.value="";return}ce(!0);let Me=0;for(const Ie of ye){const Xe=new FormData;Xe.append("image",Ie),Xe.append("category","general");try{await R.post(`/api/weddings/${s.id}/gallery`,Xe,{headers:{"Content-Type":"multipart/form-data"}}),Me++}catch(v){y.error(`Failed to upload "${Ie.name}": ${v.response?.data?.message||"Unknown error"}`)}}Me>0&&(y.success(`${Me} photo${Me>1?"s":""} uploaded successfully!`),r()),ce(!1),t.target.value=""},T=async(t,c)=>{try{await R.put(`/api/weddings/${s.id}/gallery/${t}`,c),y.success("Image updated!"),r()}catch{y.error("Failed to update image")}},J=async t=>{if(confirm("Are you sure you want to delete this image?"))try{await R.delete(`/api/weddings/${s.id}/gallery/${t}`),y.success("Image deleted!"),r()}catch{y.error("Failed to delete image")}},K=async t=>{t.preventDefault(),u(!0);try{const c={...s,wedding_date:s.wedding_date?s.wedding_date.substring(0,10):null,rsvp_deadline:s.rsvp_deadline?s.rsvp_deadline.substring(0,10):null};await R.put(`/api/weddings/${s.id}`,c),y.success("Wedding updated successfully!")}catch(c){y.error(c.response?.data?.message||"Failed to update wedding")}finally{u(!1)}},ve=async t=>{t.preventDefault();try{await R.post(`/api/weddings/${s.id}/events`,G),y.success("Event added successfully!"),O(!1),D({name:"",description:"",event_date:"",start_time:"",end_time:"",venue_name:"",venue_address:"",dress_code:"",is_active:!0}),a.fetchData()}catch(c){y.error(c.response?.data?.message||"Failed to add event")}},Ke=async t=>{if(confirm("Are you sure you want to delete this event?"))try{await R.delete(`/api/weddings/${s.id}/events/${t}`),y.success("Event deleted successfully!"),a.selectedEvent?.id===t&&a.setSelectedEvent(null),a.fetchData()}catch{y.error("Failed to delete event")}},ls=t=>{W(t),D({name:t.name,description:t.description||"",event_date:t.event_date?t.event_date.split("T")[0]:"",start_time:t.start_time?t.start_time.substring(0,5):"",end_time:t.end_time?t.end_time.substring(0,5):"",venue_name:t.venue_name||"",venue_address:t.venue_address||"",dress_code:t.dress_code||"",is_active:t.is_active}),O(!0)},le=async t=>{if(t.preventDefault(),!!V)try{await R.put(`/api/weddings/${s.id}/events/${V.id}`,G),y.success("Event updated successfully!"),O(!1),W(null),D({name:"",description:"",event_date:"",start_time:"",end_time:"",venue_name:"",venue_address:"",dress_code:"",is_active:!0}),a.fetchData()}catch(c){if(c.response?.status===422&&c.response?.data?.errors){const E=Object.values(c.response.data.errors).flat();y.error(E.join(", "))}else y.error(c.response?.data?.message||"Failed to update event")}},xe=async t=>{try{await R.put(`/api/weddings/${s.id}/events/${t.id}`,{is_active:!t.is_active}),y.success(t.is_active?"Event hidden from wedding site":"Event visible on wedding site"),a.fetchData()}catch{y.error("Failed to update event visibility")}},je=t=>{L(t),ee("invitation"),de(!0)},Cs=t=>{L(t),ee("reminder"),de(!0)},ks=async()=>{const t=`${window.location.origin}/w/${s.slug}`;try{await navigator.clipboard.writeText(t),y.success("Wedding link copied to clipboard!")}catch{const c=document.createElement("textarea");c.value=t,c.style.position="fixed",c.style.opacity="0",document.body.appendChild(c),c.select(),document.execCommand("copy"),document.body.removeChild(c),y.success("Wedding link copied to clipboard!")}},Ss=t=>{a.setSelectedEvent(t),a.setSelectedEventGuests([]),x("event-rsvps"),N("guests")},Es=t=>{a.setSelectedEvent(t),a.setSelectedEventGuests([]),x("event-rsvps"),N("guests")},$s=async t=>{Y(t);try{await R.post(`/api/weddings/${s.id}/guests/${t}/send-thank-you`,{custom_message:g||null}
9),y.success("Thank you note sent!"),a.fetchData()}catch(c){y.error(c.response?.data?.message||"Failed to send thank you note")}finally{Y(null)}},Fs=async()=>{if(C.length!==0){te(!0);try{const t=await R.post(`/api/weddings/${s.id}/guests/bulk-send-thank-you`,{guest_ids:C,custom_message:g||null});y.success(t.data.message),_([]),a.fetchData()}catch(t){y.error(t.response?.data?.message||"Failed to send thank you notes")}finally{te(!1)}}},Rs=t=>{_(c=>c.includes(t)?c.filter(E=>E!==t):[...c,t])},As=()=>{const t=a.guests.filter(c=>c.email);C.length===t.length?_([]):_(t.map(c=>c.id))},rs=t=>t?t.substring(0,10):"",is=t=>qs(t,"TBD"),ds=t=>{if(!t)return"";const[c,E]=t.substring(0,5).split(":"),k=parseInt(c),ye=k>=12?"PM":"AM";return`${k%12||12}:${E} ${ye}`};return e.jsxs("div",{className:"min-h-screen",children:[e.jsx(wt,{}),e.jsx(Ct,{}),e.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-7xl",children:[e.jsxs("div",{className:"mb-8 animate-fade-in",children:[e.jsx(j,{variant:"outline",size:"sm",className:"mb-4",asChild:!0,children:e.jsxs(Is,{href:route("weddings.dashboard"),
9children:[e.jsx(zt,{className:"h-4 w-4"}),"Back to Dashboard"]})}),e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h1",{className:"text-3xl md:text-4xl font-display font-bold tracking-tight",children:s.title}),e.jsx(Ne,{variant:s.status==="published"?"default":"secondary",children:s.status})]}),e.jsxs("p",{className:"text-muted-foreground",children:[s.groom_name," & ",s.bride_name," - ",is(s.wedding_date)]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-4 md:mt-0",children:[e.jsxs(j,{variant:"outline",size:"sm",onClick:ks,children:[e.jsx(st,{className:"h-4 w-4 mr-2"}),"Copy Link"]}),s.status==="published"&&e.jsx(j,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:route("wedding.show",{slug:s.slug}),target:"_blank",rel:"noopener noreferrer",children:[e.jsx(Lt,{className:"h-4 w-4 mr-2"}),"View Public Page"]})})]})]})]}),e.jsxs(kt,{value:o,onValueChange:N,className:"animate-fade-in",children:[e.jsxs(St,{className:"mb-6 flex-wrap h-auto gap-1",children:[e.jsxs(be,{value:"guests",children:["Guests & RSVPs (",a.guests.length,")"]}),e.jsxs(be,{value:"events",children:["Events (",a.events.length,")"]}),e.jsx(be,{value:"rsvp-settings",children:"RSVP Settings"}),e.jsx(be,{value:"details",children:"Details"}),e.jsx(be,{value:"page-design",children:"Page Design"}),e.jsx(be,{value:"gallery",children:"Gallery"}),e.jsx(be,{value:"travel",children:"Travel & Stay"}),e.jsx(be,{value:"faqs",children:"FAQs"}),e.jsx(be,{value:"thank-you",children:"Thank You"})]}),e.jsx(we,{value:"guests",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-1 bg-muted/50 rounded-lg p-1 w-fit",children:[e.jsxs("button",{type:"button",onClick:()=>x("all-guests"),className:`px-4 py-2 rounded-md text-sm font-medium transition-colors ${w==="all-guests"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"}`,children:["All Guests (",a.guests.length,")"]}),e.jsx("button",{type:"button",onClick:()=>x("event-rsvps"),className:`px-4 py-2 rounded-md text-sm font-medium transition-colors ${w==="event-rsvps"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"}`,children:"Event RSVPs"})]}),w==="all-guests"&&e.jsx(na,{weddingId:s.id,guests:a.guests,categories:a.categories,events:a.events,loading:a.loading,showGuestForm:a.showGuestForm,setShowGuestForm:a.setShowGuestForm,editingGuest:a.editingGuest,newGuest:a.newGuest,setNewGuest:a.setNewGuest,onAddGuest:a.handleAddGuest,onUpdateGuest:a.handleUpdateGuest,onEditGuest:a.handleEditGuest,onDeleteGuest:a.handleDeleteGuest,onResetGuestForm:a.resetGuestForm,onOpenNewGuestForm:a.openNewGuestForm,selectedGuests:a.selectedGuests,setSelectedGuests:a.setSelectedGuests,deletingGuests:a.deletingGuests,onBulkDeleteGuests:a.handleBulkDeleteGuests,importingGuests:a.importingGuests,importResult:a.importResult,setImportResult:()=>a.setImportResult(null),onImport:a.handleImportGuests,showCategoryForm:a.showCategoryForm,setShowCategoryForm:a.setShowCategoryForm,newCategory:a.newCategory,setNewCategory:a.setNewCategory,onAddCategory:a.handleAddCategory,onDeleteCategory:a.handleDeleteCategory,onCategoryEventsChange:a.handleCategoryEventsChange}),w==="event-rsvps"&&e.jsx(Ia,{weddingId:s.id,events:a.events,guests:a.guests,categories:a.categories,selectedEvent:a.selectedEvent,eventGuests:a.eventGuests,eventGuestsLoading:a.eventGuestsLoading,rsvpStats:a.rsvpStats,selectedEventGuests:a.selectedEventGuests,bulkSending:a.bulkSending,sendingReminder:a.sendingReminder,addingAllGuests:a.addingAllGuests,guestsNotInEvent:a.guestsNotInEvent,addGuestsPickerOpen:a.addGuestsPickerOpen,setAddGuestsPickerOpen:a.setAddGuestsPickerOpen,addGuestsSelected:a.addGuestsSelected,setAddGuestsSelected:a.setAddGuestsSelected,setSelectedEvent:a.setSelectedEvent,setSelectedEventGuests:a.setSelectedEventGuests,onInviteGuests:a.handleAddSelectedGuestsToEvent,onRemoveEventGuest:a.handleRemoveEventGuest,onUpdateRsvpStatus:a.handleUpdateRsvpStatus,onUpdateTotalPax:a.handleUpdateTotalPax,onBulkSendInvitations:a.handleBulkSendInvitations,onBulkSendReminder:a.handleBulkSendReminder,toggleSelectEventGuest:a.toggleSelectEventGuest,toggleSelectAll:a.toggleSelectAll,onPreviewEmail:je,onPreviewReminder:Cs,onCreateNewGuest:()=>{x("all-guests"),a.openNewGuestForm(a.selectedEvent?[a.selectedEvent.id]:[])},onImportToEvent:a.handleImportGuests,importingGuests:a.importingGuests})]})}),e.jsx(we,{value:"events",children:e.jsxs("div",{className:"glass-card p-6 rounded-xl",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[e.jsx(Ms,{className:"h-5 w-5"}),"Events"]}),e.jsxs(j,{size:"sm",onClick:()=>{W(null),D({name:"",description:"",event_date:"",start_time:"",end_time:"",venue_name:"",venue_address:"",dress_code:"",is_active:!0}),O(!Z)},children:[e.jsx(De,{className:"h-4 w-4 mr-1"}),"Add Event"]})]}),Z&&e.jsxs("form",{onSubmit:V?le:ve,className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6 p-4 bg-muted/50 rounded-lg",children:[e.jsxs("div",{className:"md:col-span-2 flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:V?"Edit Event":"Add New Event"}),V&&e.jsx(j,{type:"button",variant:"ghost",size:"sm",onClick:()=>{W(null),O(!1),D({name:"",description:"",event_date:"",start_time:"",end_time:"",venue_name:"",venue_address:"",dress_code:"",is_active:!0})},children:e.jsx(Re,{className:"h-4 w-4"})})]}),e.jsxs("div",{children:[e.jsx(S,{children:"Event Name *"}),e.jsx(F,{placeholder:"e.g. Wedding Ceremony, Reception",value:G.name,onChange:t=>D({...G,name:t.target.value}),required:!0})]}),e.jsxs("div",{children:[e.jsx(S,{children:"Event Date *"}),e.jsx(F,{type:"date",value:G.event_date,onChange:t=>D({...G,event_date:t.target.value}),required:!0})]}),e.jsxs("div",{children:[e.jsx(S,{children:"Start Time"}),e.jsx(F,{type:"time",value:G.start_time,onChange:t=>D({...G,start_time:t.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"When does this event begin?"})]}),e.jsxs("div",{children:[e.jsx(S,{children:"End Time"}),e.jsx(F,{type:"time",value:G.end_time,onChange:t=>D({...G,end_time:t.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"When does this event end?"})]}),e.jsxs("div",{children:[e.jsx(S,{children:"Venue Name"}),e.jsx(F,{placeholder:"e.g. Grand Ballroom, The Gardens",value:G.venue_name,onChange:t=>D({...G,venue_name:t.target.value})})]}),e.jsxs("div",{children:[e.jsx(S,{children:"Venue Address"}),e.jsx(F,{placeholder:"Full address for directions",value:G.venue_address,onChange:t=>D({...G,venue_address:t.target.value})})]}),e.jsxs("div",{children:[e.jsx(S,{children:"Dress Code"}),e.jsx(F,{placeholder:"e.g. Formal, Smart Casual",value:G.dress_code,onChange:t=>D({...G,dress_code:t.target.value})})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(S,{children:"Description"}),e.jsx(ue,{placeholder:"Brief description of this event",value:G.description,onChange:t=>D({...G,description:t.target.value}),rows:2})]}),e.jsxs("div",{className:"md:col-span-2 flex items-center gap-3",children:[e.jsx(os,{checked:G.is_active,onCheckedChange:t=>D({...G,is_active:t})}),e.jsxs(S,{className:"flex items-center gap-1.5",children:[G.is_active?e.jsx(ss,{className:"h-4 w-4"}):e.jsx(cs,{className:"h-4 w-4"}),G.is_active?"Visible on wedding site":"Hidden from wedding site"]})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(j,{type:"submit",children:V?"Update Event":"Add Event"})})]}),a.loading?e.jsx("div",{className:"animate-pulse space-y-2",children:[1,2].map(t=>e.jsx("div",{className:"h-24 bg-muted rounded"},t))}):a.events.length===0?e.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No events added yet"}):e.jsx("div",{className:"space-y-4",children:a.events.map(t=>e.jsx("div",{className:`p-4 rounded-lg ${t.is_active?"bg-muted/30":"bg-muted/10 opacity-60 border border-dashed border-muted-foreground
9/30"}`,children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"font-semibold text-lg flex items-center gap-2",children:[t.name,!t.is_active&&e.jsxs(Ne,{variant:"outline",className:"text-xs font-normal",children:[e.jsx(cs,{className:"h-3 w-3 mr-1"}),"Hidden"]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground mt-1",children:[e.jsx(Ms,{className:"inline h-3 w-3 mr-1"}),is(t.event_date),t.start_time&&` at ${ds(t.start_time)}`,t.end_time&&` - ${ds(t.end_time)}`]}),t.venue_name&&e.jsxs("div",{className:"text-sm text-muted-foreground mt-1",children:[e.jsx(zs,{className:"inline h-3 w-3 mr-1"}),t.venue_name]}),t.description&&e.jsxs("div",{className:"text-sm text-muted-foreground mt-1",children:[e.jsx(ms,{className:"inline h-3 w-3 mr-1"}),t.description]}),t.dress_code&&e.jsx(Ne,{variant:"outline",className:"mt-2",children:t.dress_code})]}),e.jsxs("div",{className:"flex flex-col items-end gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Ne,{children:[t.event_guests_count," guests"]}),e.jsx(j,{variant:"ghost",size:"sm",title:t.is_active?"Hide from wedding site":"Show on wedding site",onClick:()=>xe(t),children:t.is_active?e.jsx(ss,{className:"h-4 w-4"}):e.jsx(cs,{className:"h-4 w-4 text-muted-foreground"})}),e.jsx(j,{variant:"ghost",size:"sm",onClick:()=>ls(t),children:e.jsx(et,{className:"h-4 w-4"})}),e.jsx(j,{variant:"ghost",size:"sm",onClick:()=>Ke(t.id),children:e.jsx(_e,{className:"h-4 w-4 text-destructive"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(j,{variant:"outline",size:"sm",onClick:()=>Ss(t),children:[e.jsx(Ns,{className:"h-3 w-3 mr-1"}),"Manage Guests"]}),e.jsxs(j,{variant:"outline",size:"sm",onClick:()=>Es(t),children:[e.jsx(Te,{className:"h-3 w-3 mr-1"}),"Manage Invitations"]})]})]})]})},t.id))})]})}),e.jsxs(we,{value:"rsvp-settings",children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-3 rounded-xl border border-border bg-muted/30 p-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Looking for more options?"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Manage all RSVP configuration on a dedicated page."})]}),e.jsx(j,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(Is,{href:route("weddings.rsvp-settings",{wedding:s.id}),children:[e.jsx(Te,{className:"h-4 w-4 mr-2"}),"Open RSVP Settings"]})})]}),e.jsxs("form",{onSubmit:K,className:"space-y-6",children:[e.jsxs("div",{className:"glass-card p-6 rounded-xl",children:[e.jsxs("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[e.jsx(Te,{className:"h-5 w-5"}),"RSVP Settings"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(S,{htmlFor:"rsvp_deadline",children:"RSVP Deadline"}),e.jsx(F,{id:"rsvp_deadline",type:"date",value:rs(s.rsvp_deadline),onChange:t=>l({...s,rsvp_deadline:t.target.value})})]}),e.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[e.jsx(os,{id:"rsvp_allow_plus_one",checked:s.rsvp_allow_plus_one,onCheckedChange:t=>l({...s,rsvp_allow_plus_one:t})}),e.jsxs("div",{children:[e.jsx(S,{htmlFor:"rsvp_allow_plus_one",children:"Allow Plus Ones"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'Show "Will you be bringing a guest?" on the RSVP form'})]})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(S,{htmlFor:"invitation_text",children:"Invitation Text"}),e.jsx(ue,{id:"invitation_text",value:s.invitation_text||"",onChange:t=>l({...s,invitation_text:t.target.value}),placeholder:"The Lee family cordially invites you to celebrate...",rows:3}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Custom greeting for the invitation email. Leave blank to use the default."})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(S,{htmlFor:"rsvp_message",children:"RSVP Message"}),e.jsx(ue,{id:"rsvp_message",value:s.rsvp_message||"",onChange:t=>l({...s,rsvp_message:t.target.value}),placeholder:"We can't wait to celebrate our special day with you...",rows:3})]})]})]}),e.jsxs(j,{type:"submit",className:"w-full bg-primary text-black",disabled:m,children:[e.jsx(ze,{className:"h-4 w-4 mr-2"}),m?"Saving...":"Save Changes"]})]})]}),e.jsx(we,{value:"details",children:e.jsxs("form",{onSubmit:K,className:"space-y-6",children:[e.jsxs("div",{className:"glass-card p-6 rounded-xl",children:[e.jsxs("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[e.jsx(Ze,{className:"h-5 w-5 text-pink-500"}),"Couple Information"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(S,{htmlFor:"title",children:"Wedding Title"}),e.jsx(F,{id:"title",value:s.title,onChange:t=>l({...s,title:t.target.value})})]}),e.jsxs("div",{children:[e.jsx(S,{htmlFor:"groom_name",children:"Groom's Name"}),e.jsx(F,{id:"groom_name",value:s.groom_name,onChange:t=>l({...s,groom_name:t.target.value})})]}),e.jsxs("div",{children:[e.jsx(S,{htmlFor:"bride_name",children:"Bride's Name"}),e.jsx(F,{id:"bride_name",value:s.bride_name,onChange:t=>l({...s,bride_name:t.target.value})})]}),e.jsxs("div",{children:[e.jsx(S,{htmlFor:"wedding_date",children:"Wedding Date"}),e.jsx(F,{id:"wedding_date",type:"date",value:rs(s.wedding_date),onChange:t=>l({...s,wedding_date:t.target.value})})]})]})]}),e.jsxs("div",{className:"glass-card p-6 rounded-xl",children:[e.jsxs("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[e.jsx(zs,{className:"h-5 w-5"}),"Venue"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(S,{htmlFor:"venue_name",children:"Venue Name"}),e.jsx(F,{id:"venue_name",value:s.venue_name||"",onChange:t=>l({...s,venue_name:t.target.value})})]}),e.jsxs("div",{children:[e.jsx(S,{htmlFor:"venue_address",children:"Venue Address"}),e.jsx(ue,{id:"venue_address",value:s.venue_address||"",onChange:t=>l({...s,venue_address:t.target.value}),rows:2})]})]})]}),e.jsxs("div",{className:"glass-card p-6 rounded-xl",children:[e.jsxs("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[e.jsx(ms,{className:"h-5 w-5"}),"Details"]}
9),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(S,{htmlFor:"description",children:"Description"}),e.jsx(ue,{id:"description",value:s.description||"",onChange:t=>l({...s,description:t.target.value}),rows:3})]}),e.jsxs("div",{children:[e.jsx(S,{htmlFor:"background_story",children:"Once Upon a Time"}),e.jsx(ue,{id:"background_story",value:s.background_story||"",onChange:t=>l({...s,background_story:t.target.value}),rows:4})]})]})]}),e.jsxs("div",{className:"glass-card p-6 rounded-xl",children:[e.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Settings"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(S,{htmlFor:"status",children:"Status"}),e.jsxs(Ce,{value:s.status,onValueChange:t=>l({...s,status:t}),children:[e.jsx(ke,{children:e.jsx(Se,{})}),e.jsxs(Ee,{children:[e.jsx(H,{value:"draft",children:"Draft"}),e.jsx(H,{value:"published",children:"Published"}),e.jsx(H,{value:"completed",children:"Completed"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-4 mt-6",children:[e.jsx(os,{checked:s.is_active,onCheckedChange:t=>l({...s,is_active:t})}),e.jsx(S,{children:"Active"})]})]})]}),e.jsxs(j,{type:"submit",className:"w-full bg-primary text-black",disabled:m,children:[e.jsx(ze,{className:"h-4 w-4 mr-2"}),m?"Saving...":"Save Changes"]})]})}),e.jsx(we,{value:"page-design",children:e.jsxs("form",{onSubmit:K,className:"space-y-6",children:[e.jsxs("div",{className:"glass-card p-6 rounded-xl",children:[e.jsxs("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[e.jsx(Vt,{className:"h-5 w-5"}),"Theme Colors"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx(S,{htmlFor:"primary_color",children:"Primary Color"}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(F,{type:"color",id:"primary_color",value:s.primary_color||"#344c38",onChange:t=>l({...s,primary_color:t.target.value}),className:"w-16 h-10 p-1 cursor-pointer"}),e.jsx(F,{value:s.primary_color||"#344c38",onChange:t=>l({...s,primary_color:t.target.value}),placeholder:"#344c38"})]})]}),e.jsxs("div",{children:[e.jsx(S,{htmlFor:"accent_color",children:"Accent Color"}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(F,{type:"color",id:"accent_color",value:s.accent_color||"#8b7355",onChange:t=>l({...s,accent_color:t.target.value}),className:"w-16 h-10 p-1 cursor-pointer"}),e.jsx(F,{value:s.accent_color||"#8b7355",onChange:t=>l({...s,accent_color:t.target.value}),placeholder:"#8b7355"})]})]}),e.jsxs("div",{children:[e.jsx(S,{htmlFor:"background_color",children:"Backgroun
9d Color"}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(F,{type:"color",id:"background_color",value:s.background_color||"#f5f0e8",onChange:t=>l({...s,background_color:t.target.value}),className:"w-16 h-10 p-1 cursor-pointer"}),e.jsx(F,{value:s.background_color||"#f5f0e8",onChange:t=>l({...s,background_color:t.target.value}),placeholder:"#f5f0e8"})]})]})]})]}),e.jsxs("div",{className:"glass-card p-6 rounded-xl",children:[e.jsxs("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[e.jsx(ms,{className:"h-5 w-5"}),"Font Style"]}),e.jsxs("div",{children:[e.jsx(S,{htmlFor:"font_family",children:"Font Preset"}),e.jsxs(Ce,{value:s.font_family||"classic",onValueChange:t=>l({...s,font_family:t}),children:[e.jsx(ke,{className:"w-full md:w-64",children:e.jsx(Se,{})}),e.jsxs(Ee,{children:[e.jsx(H,{value:"classic",children:"Classic (Cormorant Garamond)"}),e.jsx(H,{value:"modern",children:"Modern (Playfair Display)"}),e.jsx(H,{value:"romantic",children:"Romantic (Cinzel)"}),e.jsx(H,{value:"elegant",children:"Elegant (Libre Baskerville)"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Changes the fonts used throughout your wedding website."})]})]}),e.jsxs("div",{className:"glass-card p-6 rounded-xl",children:[e.jsxs("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[e.jsx(Ze,{className:"h-5 w-5"}),"Logo / Monogram"]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Upload a custom logo, or pick a monogram style. The monogram is drawn from the couple's initials and renders crisply anywhere it appears (website header, invitation previews, print)."}),e.jsxs("div",{className:"space-y-2 mb-6",children:[e.jsx(S,{children:"Custom Logo (optional)"}),s.logo&&e.jsxs("div",{className:"relative w-32 h-20 rounded-lg overflow-hidden bg-muted flex items-center justify-center",children:[e.jsx("img",{src:s.logo.startsWith("http")?s.logo:`/storage/${s.logo}`,alt:"Logo",className:"max-w-full max-h-full object-contain"}),e.jsx("button",{type:"button",className:"absolute top-1 right-1 bg-black/50 text-white rounded-full p-1 hover:bg-black/70 transition-colors",onClick:()=>l({...s,logo:null,logo_url:null}),children:e.jsx(Re,{className:"h-3 w-3"})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(F,{value:s.logo||"",onChange:t=>l({...s,logo:t.target.value}),placeholder:"Paste URL or upload",className:"flex-1"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"file",accept:"image/*",onChange:t=>i(t,"logo"),className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:I==="logo"}),e.jsx(j,{type:"button",variant:"outline",size:"icon",disabled:I==="logo",children:I==="logo"?e.jsx(se,{className:"h-4 w-4 animate-spin"}):e.jsx(Fe,{className:"h-4 w-4"})})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"When a logo is uploaded it takes precedence over the monogram."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(S,{children:"Monogram Style"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:["classic","modern","ornate","minimal"].map(t=>{const c=(s.monogram_variant??"classic")===t,E=s.groom_name?.charAt(0)?.toUpperCase()||"G",k=s.bride_name?.charAt(0)?.toUpperCase()||"B";return e.jsxs("button",{type:"button",onClick:()=>l({...s,monogram_variant:t}),className:`group relative rounded-xl border p-4 flex flex-col items-center justify-center gap-2 transition-all ${c?"border-primary ring-2 ring-primary/40 bg-primary/5":"border-border hover:border-primary/60 hover:bg-muted/40"}`,"aria-pressed":c,children:[e.jsx("div",{className:"h-20 w-20 flex items-center justify-center",children:e.jsx(Mt,{initials1:E,initials2:k,variant:t,color:s.primary_color||void 0,accentColor:s.accent_color||void 0,fluid:!0})}),e.jsx("span",{className:"text-xs font-medium capitalize tracking-wide",children:t}),c&&e.jsx("span",{className:"absolute top-2 right-2 inline-flex items-center justify-center rounded-full bg-primary text-[10px] text-black w-5 h-5",children:e.jsx(ts,{className:"h-3 w-3"})})]},t)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Pick a frame style. The monogram uses the couple's first-name initials and inherits your theme colours."})]})]}),e.jsxs("div",{className:"glass-card p-6 rounded-xl",children:[e.jsxs("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[e.jsx(us,{className:"h-5 w-5"}),"Page Images"]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Upload images or paste URLs for each section. Max 5MB per image."}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[{field:"hero_image",label:"Hero Image",desc:"Our Story banner"},{field:"story_image",label:"Story Image",desc:'Beside "Once Upon a Time" text'},{field:"celebrate_image",label:"Celebrate Image",desc:"Join us section"},{field:"travel_hero_image",label:"Travel Hero Image",desc:"Travel & Stay banner"},{field:"getting_there_image",label:"Getting There Image",desc:"Directions section"},{field:"where_to_stay_image",label:"Where to Stay Image",desc:"Accommodations section"}
9,{field:"rsvp_background_image",label:"RSVP Background",desc:"RSVP section background"},{field:"favicon",label:"Favicon",desc:"Browser tab icon (small square image)"}].map(({field:t,label:c,desc:E})=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(S,{children:c}),e.jsx("p",{className:"text-xs text-muted-foreground",children:E}),s[t]&&e.jsxs("div",{className:"relative w-full h-24 rounded-lg overflow-hidden bg-muted",children:[e.jsx("img",{src:s[t]?.startsWith("http")?s[t]:`/storage/${s[t]}`,alt:c,className:"w-full h-full object-cover"}),e.jsx("button",{type:"button",className:"absolute top-1 right-1 bg-black/50 text-white rounded-full p-1 hover:bg-black/70 transition-colors",onClick:()=>l({...s,[t]:null}),children:e.jsx(Re,{className:"h-3 w-3"})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(F,{value:s[t]||"",onChange:k=>l({...s,[t]:k.target.value}),placeholder:"Paste URL or upload",className:"flex-1"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"file",accept:"image/*",onChange:k=>i(k,t),className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:I===t}),e.jsx(j,{type:"button",variant:"outline",size:"icon",disabled:I===t,children:I===t?e.jsx(se,{className:"h-4 w-4 animate-spin"}):e.jsx(Fe,{className:"h-4 w-4"})})]})]})]},t))})]}),e.jsxs(j,{type:"submit",className:"w-full bg-primary text-black",disabled:m,children:[e.jsx(ze,{className:"h-4 w-4 mr-2"}),m?"Saving...":"Save Changes"]})]})}),e.jsx(we,{value:"gallery",children:e.jsxs("div",{className:"glass-card p-6 rounded-xl",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[e.jsx(us,{className:"h-5 w-5"}),"Photo Gallery"]}),e.jsxs("span",{className:`text-sm ${q.length>=f?"text-destructive font-medium":"text-muted-foreground"}`,children:[q.length,"/",f]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"file",accept:".jpg,.jpeg,.png,.webp",multiple:!0,onChange:P,className:"hidden",id:"gallery-upload",disabled:ne||q.length>=f}),e.jsx("label",{htmlFor:"gallery-upload",children:e.jsx(j,{type:"button",size:"sm",asChild:!0,disabled:ne||q.length>=f,children:e.jsxs("span",{className:"cursor-pointer",children:[ne?e.jsx(se,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(De,{className:"h-4 w-4 mr-1"}),ne?"Uploading...":q.length>=f?"Limit Reached":"Upload Photos"]})})})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"Upload pre-wedding photos, engagement pictures, or any other images you'd like to share with your guests. Accepted formats: JPG, PNG, WEBP. Max 5MB per photo."}),he?e.jsx("div",{className:"animate-pulse grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:[1,2,3,4].map(t=>e.jsx("div",{className:"aspect-square bg-muted rounded-lg"},t))}):q.length===0?e.jsxs("div",{className:"text-center py-12 border-2 border-dashed border-muted rounded-lg",children:[e.jsx(us,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground/50"}),e.jsx("p",{className:"text-muted-foreground",children:"No photos uploaded yet"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Upload photos to create your wedding gallery"})]}):e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:q.map(t=>e.jsxs("div",{className:"group relative aspect-square bg-muted rounded-lg overflow-hidden",children:[e.jsx("img",{src:t.image_url,alt:t.title||"Gallery image",className:"w-full h-full object-cover"}),e.jsxs("div",{className:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex flex-col justify-between p-3",children:[e.jsxs("div",{className:"flex justify-end gap-1",children:[e.jsx(j,{variant:"secondary",size:"sm",className:"h-8 w-8 p-0",onClick:()=>T(t.id,{is_featured:!t.is_featured}),title:t.is_featured?"Remove from featured":"Set as featured",children:e.jsx(Ze,{className:`h-4 w-4 ${t.is_featured?"fill-pink-500 text-pink-500":""}`})}),e.jsx(j,{variant:"destructive",size:"sm",className:"h-8 w-8 p-0",onClick:()=>J(t.id),children:e.jsx(_e,{className:"h-4 w-4"})})]}),e.jsx("div",{children:e.jsxs(Ce,{value:t.category,onValueChange:c=>T(t.id,{category:c}),children:[e.jsx(ke,{className:"h-8 text-xs bg-white/90",children:e.jsx(Se,{})}),e.jsxs(Ee,{children:[e.jsx(H,{value:"general",children:"General"}),e.jsx(H,{value:"pre-wedding",children:"Pre-Wedding"}),e.jsx(H,{value:"engagement",children:"Engagement"})]})]})})]}),t.is_featured&&e.jsx("div",{className:"absolute top-2 left-2",children:e.jsx(Ne,{className:"bg-pink-500 text-white text-xs",children:"Featured"})})]},t.id))}),q.length>0&&e.jsxs("div",{className:"mt-6 pt-6 border-t",children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:"Gallery Statistics"}),e.jsxs("div",{className:"flex gap-4 text-sm text-muted-foreground",children:[e.jsxs("span",{children:["Total: ",q.length," photos"]}),e.jsxs("span",{children:["Featured: ",q.filter(t=>t.is_featured).length]}),e.jsxs("span",{children:["Pre-Wedding: ",q.filter(t=>t.category==="pre-wedding").length]}),e.jsxs("span",{children:["Engagement: ",q.filter(t=>t.category==="engagement").length]})]})]})]})}),e.jsx(we,{value:"travel",children:e.jsxs("form",{onSubmit:K,className:"space-y-6",children:[e.jsxs("div",{className:"glass-card p-6 rounded-xl",children:[e.jsxs("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[e.jsx(Bt,{className:"h-5 w-5"}),"Getting There"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(S,{htmlFor:"getting_there_by_car",children:"By Car"}),e.jsx(ue,{id:"getting_there_by_car",value:s.getting_there_by_car||"",onChange:t=>l({...s,getting_there_by_car:t.target.value}),placeholder:"Directions for guests driving to the venue...",rows:3})]}),e.jsxs("div",{children:[e.jsx(S,{htmlFor:"getting_there_by_train",children:"By Train"}),e.jsx(ue,{id:"getting_there_by_train",value:s.getting_there_by_train||"",onChange:t=>l({...s,getting_there_by_train:t.target.value}),placeholder:"Nearest train station and directions from there...",rows:3})]}),e.jsxs("div",{children:[e.jsx(S,{htmlFor:"getting_there_by_plane",children:"By Plane"}),e.jsx(ue,{id:"getting_there_by_plane",value:s.getting_there_by_plane||"",onChange:t=>l({...s,getting_there_by_plane:t.target.value}),placeholder:"Nearest airport and transportation options...",rows:3})]})]})]}),e.jsxs("div",{className:"glass-card p-6 rounded-xl",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[e.jsx(Yt,{className:"h-5 w-5"}),"Hotels & Accommodations"]}),e.jsxs(j,{type:"button",size:"sm",onClick:()=>{const t=s.hotels||[];l({...s,hotels:[...t,{name:"",description:"",link:"",email:""}]})},children:[e.jsx(De,{className:"h-4 w-4 mr-1"}),"Add Hotel"]})]}),!s.hotels||s.hotels.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No hotels added yet. Add recommended accommodations for your guests."}):e.jsx("div",{className:"space-y-4",children:s.hotels.map((t,c)=>e.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[e.jsxs("div",{className:"flex justify-between items-start mb-3",children:[e.jsxs("span",{className:"text-sm font-medium",children:["Hotel ",c+1]}),e.jsx(j,{type:"button",variant:"ghost",size:"sm",onClick:()=>{const E=[...s.hotels||[]];E.splice(c,1),l({...s,hotels:E})},children:e.jsx(_e,{className:"h-4 w-4 text-destructive"})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(S,{children:"Hotel Name"}),e.jsx(F,{value:t.name,onChange:E=>{const k=[...s.hotels||[]];k[c]={...k[c],name:E.target.value},l({...s,hotels:k})},placeholder:"Hotel name"})]}),e.jsxs("div",{children:[e.jsx(S,{children:"Website Link (optional)"}),e.jsx(F,{value:t.link||"",onChange:E=>{const k=[...s.hotels||[]];k[c]={...k[c],link:E.target.value},l({...s,hotels:k})},placeholder:"https://hotel-website.com"})]}),e.jsxs("div",{children:[e.jsx(S,{children:"Email (optional)"}),e.jsx(F,{type:"email",value:t.email||"",onChange:E=>{const k=[...s.hotels||[]];k[c]={...k[c],email:E.target.value},l({...s,hotels:k})},placeholder:"[email protected]"})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(S,{children:"Description"}),e.jsx(ue,{value:t.description,onChange:E=>{const k=[...s.hotels||[]];k[c]={...k[c],description:E.target.value},l({...s,hotels:k})},placeholder:"A brief description of the hotel and any special rates...",rows:2})]})]})]},c))})]}),e.jsxs("div",{className:"glass-card p-6 rounded-xl",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[e.jsx(Wt,{className:"h-5 w-5"}),"Things to Do"]}),e.jsxs(j,{type:"button",size:"sm",onClick:()=>{const t=s.things_to_do||[];l({...s,things_to_do:[...t,{name:"",image:"",description:""}]})},children:[e.jsx(De,{className:"h-4 w-4 mr-1"}),"Add Activity"]})]}),!s.things_to_do||s.things_to_do.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No activities added yet. Suggest local attractions for your guests."}):e.jsx("div",{className:"space-y-4",children:s.things_to_do.map((t,c)=>e.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[e.jsxs("div",{className:"flex justify-between items-start mb-3",children:[e.jsxs("span",{className:"text-sm font-medium",children:["Activity ",c+1]}),e.jsx(j,{type:"button",variant:"ghost",size:"sm",onClick:()=>{const E=[...s.things_to_do||[]];E.splice(c,1),l({...s,things_to_do:E})},children:e.jsx(_e,{className:"h-4 w-4 text-destructive"})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(S,{children:"Activity Name"}),e.jsx(F,{value:t.name,onChange:E=>{const k=[...s.things_to_do||[]];k[c]={...k[c],name:E.target.value},l({...s,things_to_do:k})},placeholder:"e.g., Explore the Old Town"})]}),e.jsxs("div",{children:[e.jsx(S,{children:"Image URL"}),e.jsx(F,{value:t.image,onChange:E=>{const k=[...s.things_to_do||[]];k[c]={...k[c],image:E.target.value},l({...s,things_to_do:k})},placeholder:"https://example.com/activity.jpg"})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(S,{children:"Description (optional)"}),e.jsx(F,{value:t.description||"",onChange:E=>{const k=[...s.things_to_do||[]];k[c]={...k[c],description:E.target.value},l({...s,things_to_do:k})},placeholder:"A short description of the activity"})]})]})]},c))})]}),e.jsxs(j,{type:"submit",className:"w-full bg-primary text-black",disabled:m,children:[e.jsx(ze,{className:"h-4 w-4 mr-2"}),m?"Saving...":"Save Changes"]})]})}),e.jsx(we,{value:"faqs",children:e.jsxs("form",{onSubmit:K,className:"space-y-6",children:[e.jsxs("div",{className:"glass-card p-6 rounded-xl",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[e.jsx(Ls,{className:"h-5 w-5"}),"Frequently Asked Questions"]}),e.jsxs(j,{type:"button",size:"sm",onClick:()=>{const t=s.faqs||[];l({...s,faqs:[...t,{question:"",answer:""}]})},children:[e.jsx(De,{className:"h-4 w-4 mr-1"}),"Add FAQ"]})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Add common questions and answers for your guests. If left empty, default FAQs will be shown."}),!s.faqs||s.faqs.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(Ls,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground
9/50"}),e.jsx("p",{className:"text-muted-foreground",children:"No custom FAQs added yet."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Default FAQs about dress code will be shown."})]}):e.jsx("div",{className:"space-y-4",children:s.faqs.map((t,c)=>e.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[e.jsxs("div",{className:"flex justify-between items-start mb-3",children:[e.jsxs("span",{className:"text-sm font-medium",children:["FAQ ",c+1]}),e.jsx(j,{type:"button",variant:"ghost",size:"sm",onClick:()=>{const E=[...s.faqs||[]];E.splice(c,1),l({...s,faqs:E})},children:e.jsx(_e,{className:"h-4 w-4 text-destructive"})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(S,{children:"Question"}),e.jsx(F,{value:t.question,onChange:E=>{const k=[...s.faqs||[]];k[c]={...k[c],question:E.target.value},l({...s,faqs:k})},placeholder:"e.g., What is the dress code?"})]}),e.jsxs("div",{children:[e.jsx(S,{children:"Answer"}),e.jsx(ue,{value:t.answer,onChange:E=>{const k=[...s.faqs||[]];k[c]={...k[c],answer:E.target.value},l({...s,faqs:k})},placeholder:"The dress code is...",rows:3})]})]})]},c))})]}),e.jsxs(j,{type:"submit",className:"w-full bg-primary text-black",disabled:m,children:[e.jsx(ze,{className:"h-4 w-4 mr-2"}),m?"Saving...":"Save Changes"]})]})}),e.jsx(we,{value:"thank-you",children:e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"glass-card p-6 rounded-xl",children:[e.jsxs("h2",{className:"text-xl font-semibold flex items-center gap-2 mb-4",children:[e.jsx(Ze,{className:"h-5 w-5 text-pink-500"}),"Send Thank You Notes"]}),e.jsx("div",{className:"mb-6 p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:e.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:[e.jsx("strong",{children:"Post-Wedding Feature:"})," This feature is designed to be used after your wedding to thank guests for attending. You can send a personalised thank you email to each guest individually or in bulk."]})}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"Send a personalised thank you note to your wedding guests. You can customise the message below, or use the default."}),e.jsxs("div",{className:"mb-6",children:[e.jsx(S,{htmlFor:"thank_you_message",children:"Custom Message (optional)"}),e.jsx(ue,{id:"thank_you_message",value:g,onChange:t=>p(t.target.value),rows:4,placeholder:"Write a personal thank you message to your guests... Leave empty to use the default message.",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"This message will be included in the email sent to your guests. If left empty, a default thank you message will be used."}),e.jsxs(j,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>{y.success("Thank you message saved for this session.")},children:[e.jsx(ze,{className:"h-4 w-4 mr-1"}),"Save Message"]})]}),e.jsxs("div",{className:"mb-6 p-4 bg-muted/30 rounded-lg border border-border",children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:g?"Your Custom Message:":"Default Message Preview:"}),e.jsx("p",{className:"text-sm text-muted-foreground italic",children:g||"We are truly grateful that you were part of our special day. Your presence, love, and warm wishes made our wedding celebration unforgettable. Thank you for sharing in our joy and for the beautiful memories we created together."})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-4 p-4 bg-muted/30 rounded-lg",children:[C.length>0&&e.jsxs(j,{size:"sm",onClick:Fs,disabled:$,className:"bg-primary text-black",children:[$?e.jsx(se,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(He,{className:"h-4 w-4 mr-2"}),"Send to ",C.length," Guest",C.length>1?"s":""]}),e.jsxs("span",{className:"text-sm text-muted-foreground ml-auto",children:[a.guests.filter(t=>t.email).length," guests with email / ",a.guests.length," total"]})]}),a.loading?e.jsx("div",{className:"animate-pulse space-y-2",children:[1,2,3].map(t=>e.jsx("div",{className:"h-16 bg-muted rounded"},t))}):a.guests.length===0?e.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No guests added yet. Go to the Guests tab to add your wedding guests."}):e.jsx("div",{className:"border rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-muted/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-left",children:e.jsx(re,{checked:C.length===a.guests.filter(t=>t.email).length&&a.guests.filter(t=>t.email).length>0,onCheckedChange:As})}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"Guest"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"Email"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"Status"}),e.jsx("th",{className:"px-4 py-3 text-right text-sm font-medium",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-border",children:a.guests.map(t=>e.jsxs("tr",{className:"hover:bg-muted/30",children:[e.jsx("td",{className:"px-4 py-3",children:t.email&&e.jsx(re,{checked:C.includes(t.id),onCheckedChange:()=>
9Rs(t.id)})}),e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("div",{className:"font-medium",children:t.full_name}),t.relationship&&e.jsx("div",{className:"text-xs text-muted-foreground",children:t.relationship})]}),e.jsx("td",{className:"px-4 py-3 text-sm",children:t.email||e.jsx("span",{className:"text-muted-foreground italic",children:"No email"})}),e.jsx("td",{className:"px-4 py-3",children:t.thank_you_sent_at?e.jsxs("div",{className:"flex items-center text-green-600 text-sm",children:[e.jsx(ts,{className:"h-4 w-4 mr-1"}),"Sent"]}):e.jsxs("div",{className:"flex items-center text-muted-foreground text-sm",children:[e.jsx(ws,{className:"h-4 w-4 mr-1"}),"Not sent"]})}),e.jsx("td",{className:"px-4 py-3 text-right",children:t.email&&e.jsx(j,{variant:"outline",size:"sm",onClick:()=>$s(t.id),disabled:M===t.id,children:M===t.id?e.jsx(se,{className:"h-4 w-4 animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(He,{className:"h-4 w-4 mr-1"}),t.thank_you_sent_at?"Resend":"Send"]})})})]},t.id))})]})})]})})})]})]}),a.selectedEvent&&ae&&e.jsx(Kt,{isOpen:B,onClose:()=>{de(!1),L(null)},weddingId:s.id,eventId:a.selectedEvent.id,eventGuestId:ae,mode:me,onSent:()=>{a.fetchEventGuests(a.selectedEvent.id),a.fetchRsvpStats(a.selectedEvent.id)}})]})};export{sl 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.