1import{j as e,I as Ye,af as as,r as d,v as Re,a6 as E,ad as w,O as S,aE as rs,s as te,o as se,L as os,K as ls,V as cs,ar as ds,Q as ms,y as ke,ca as ps,cb as hs,cc as us,cd as xs,av as gs,a2 as Je,R as js}from"./index-CEqNdWMB.js";import{i as is,w as ys}from"./invokeFunction-qR46wRWi.js";import{L as g}from"./label-MzaZtEZW.js";import{T as W}from"./textarea-BCupudha.js";import{T as fs,a as vs,b as Fe}from"./tabs-DG3YBuYE.js";import{D as Qe,a as Ie,b as Pe,c as De,d as Me,e as Te}from"./dialog-C4_r9fMQ.js";import{S as fe,a as ve,b as be,c as Ne,d as ae}from"./select-B9ajeO-3.js";import{T as bs,a as Ns,b as Ze,c as ge,d as _s,e as je}from"./table-DPXuLFXQ.js";import{s as ws}from"./sanitizeHtml-BOmBaa7C.js";import{S as Xe}from"./switch-B4O4aBmQ.js";import{R as ks,a as Cs}from"./radio-group-BnH3Df3E.js";import{r as Ss,i as Ts,v as As,d as Es}from"./ticketAttendance-CbJ88-er.js";import{c as $s,d as qs,a as Ls,e as Fs}from"./types-CNYLUhrh.js";import{p as Os}from"./addonOptions-B4Hcq4YI.js";import{C as Rs}from"./circle-alert-CBdxS-Js.js";import{C as Qs}from"./check-CYl4c-Z5.js";import{G as ze}from"./gift-BQ42OcFu.js";import{L as Ae}from"./loader-circle-CSZF46_Z.js";import{a as Is,b as Ps}from"./compGrants-CIzOmMdK.js";import{T as Ds}from"./ticket-BzO5GThO.js";import{C as ns}from"./copy-CMrnKNsJ.js";import{S as Ms}from"./store-CqwaTl6_.js";import{P as zs}from"./plus-RZqlGGkR.js";import{S as Vs}from"./search-Ct4PNFf0.js";import{I as Bs}from"./inbox-CXcSpSlp.js";import"./index-DjURd1vY.js";import"./index-NdaxtzIS.js";import"./form-layout-CimphA65.js";import"./index-BdQq_4o_.js";import"./index-BSd2hjwl.js";import"./chevron-up-C686eY-E.js";import"./purify.es-t2lEkcJL.js";import"./circle-CzO3hopn.js";import"./cutoffs-DdoWOCm-.js";const Us=({steps:n,current:v,problems:h=[],onSelect:m})=>e.jsx("div",{className:"-mx-1 flex gap-1.5 overflow-x-auto px-1 pb-1",children:n.map((u,o)=>{const r=o===v,i=o<v,x=h.includes(o);return e.jsxs("button",{type:"button",onClick:()=>m(o),className:Ye("flex shrink-0 items-center gap-2 rounded-full border px-3 py-1.5 text-xs transition-colors",r?"border-primary bg-primary/10 font-semibold text-foreground":"border-border text-muted-foreground hover:bg-muted/60"),children:[e.jsx("span",{className:Ye("flex h-5 w-5 items-center justify-center rounded-full text-[11px] font-semibold",r?"bg-primary text-primary-foreground":"bg-muted text-foreground"),children:x?e.jsx(Rs,{className:"h-3 w-3 text-destructive"}):i?e.jsx(Qs,{className:"h-3 w-3"}):o+1}),e.jsx("span",{className:"whitespace-nowrap",children:u})]},u)})}),Oe="__later__",Hs={pending:"Anything you pick is saved with the application and carries through when it's approved.",link:"Anything you pick is pre-filled on their $0 checkout page â they can still change it.",complete:"Anything you pick is recorded on their registration right now."},Ks=({resolved:n,compRegistrations:v,mode:h,choices:m,onChoice:u})=>{if(n.length===0)return e.jsx("p",{className:"py-6 text-sm text-muted-foreground",children:"This package doesn't include any complimentary add-ons."});const o=n.some(r=>r.purchaserQty>0&&r.addon.options.length>0);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["These come free with the package."," ",o?Hs[h]:"There's nothing to choose on them."]}),n.map(r=>{const i=m[r.addon.id]??[],x=r.addon.options.length>0;return e.jsxs("div",{className:"space-y-3 rounded-lg border p-4",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[e.jsx(ze,{className:"h-4 w-4 text-primary"}),r.addon.name]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[r.purchaserQty>0?`${r.purchaserQty} for the exhibitor`:"None for the exhibitor"," · ",e.jsxs("span",{className:"line-through",children:["$",(r.addon.price_cents/100).toFixed(2)," each"]})," ",e.jsx("span",{className:"font-medium text-primary",children:"included free"})]})]}),r.purchaserQty>0&&x&&e.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:Array.from({length:r.purchaserQty}).map((k,A)=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(g,{className:"text-xs font-medium",children:[r.addon.option_label||"Choose an option",r.purchaserQty>1&&` â #${A+1}`,r.addon.option_required&&h==="complete"&&e.jsx("span",{className:"text-destructive",children:" *"})]}),e.jsxs(fe,{value:i[A]||Oe,onValueChange:c=>u(r.addon.id,A,c===Oe?"":c),children:[e.jsx(ve,{className:"h-9",children:e.jsx(be,{})}),e.jsxs(Ne,{children:[e.jsx(ae,{value:Oe,children:"Let them choose at checkout"}),r.addon.options.map(c=>e.jsx(ae,{value:c.id,children:c.name},c.id))]})]})]},A))}),r.purchaserQty>0&&x&&h==="complete"&&r.addon.option_required&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"This one has to be answered here â the registration is created right away."}),e.jsx("p",{className:"border-t pt-2 text-xs text-muted-foreground",children:$s(r.addon.name,{purchaserQty:r.purchaserQty,perCompSeatQty:r.perCompSeatQty},v)})]},r.addon.id)})]})};function Gs(n,v){const h=[];for(const m of n){if(m.purchaserQty<=0||m.addon.options.length===0)continue;const u=v[m.addon.id]??[],o=Array.from({length:m.purchaserQty},(r,i)=>m.addon.options.some(x=>x.id===u[i])?u[i]:"");
1o.some(Boolean)&&h.push({addonId:m.addon.id,options:o})}return h}function Ws(n,v){const h=[];for(const m of n){if(m.purchaserQty<=0||!m.addon.option_required||m.addon.options.length===0)continue;const u=v[m.addon.id]??[];for(let o=0;o<m.purchaserQty;o++)if(!u[o]){h.push(m.addon.name);break}}return h}function Ys(n,v,h){const m=[];for(const u of n){if(u.purchaserQty<=0)continue;const o=v[u.addon.id]??[],r=[];for(let i=0;i<u.purchaserQty;i++){const x=o[i]||"",k=u.addon.options.find(A=>A.id===x);r.push({attendee_index:0,name:h,qty:1,...k?{option_id:k.id,option_name:k.name}:{}})}m.push({addon_id:u.addon.id,quantity:u.purchaserQty,assignments:r})}return m}const Js=[{value:"pending",title:"Save as a pending application",blurb:"Lands in âTo reviewâ. Nothing is sent â someone still approves it later."},{value:"link",title:"Approve and give them their $0 link",blurb:"They finish a zeroed-out checkout themselves, which issues their booth-staff code."},{value:"complete",title:"Approve and complete it now",blurb:"Creates the $0 order and registration right away, booth-staff code included."}],es=["Package & why comped","Their information","Included add-ons","What happens next"],ss=()=>({contact_name:"",spouse_name:"",email:"",phone:"",mobile:"",company:"",website:"",addressLine1:"",city:"",state:"",postalCode:"",country:"US",products_to_sell:"",faith_organizations:"",display_description:"",heard_about:"",notes:""}),Zs=({eventId:n,open:v,onOpenChange:h,onCreated:m})=>{const u=as(),[o,r]=d.useState(0),[i,x]=d.useState(ss()),[k,A]=d.useState(""),[c,R]=d.useState(""),[j,z]=d.useState("link"),[ie,Y]=d.useState(""),[J,ne]=d.useState(!1),[re,Z]=d.useState(!1),[P,X]=d.useState({}),[ee,_e]=d.useState(!1),[oe,le]=d.useState(null),[q,ce]=d.useState(null),C=(a,b)=>x(T=>({...T,[a]:b})),{data:_,isLoading:Ee}=Re({queryKey:["admin_exhibitor_setup",n],enabled:v&&!!n,queryFn:async()=>{var he,ue,xe;const[{data:a,error:b},{data:T},{data:y}]=await Promise.all([te.from("reg_events").select("id, modules_config, event_type, collect_address, require_address, address_skip_online_tickets").eq("id",n).maybeSingle(),te.from("reg_ticket_types").select("id, name, attendance_mode").eq("event_id",n).eq("is_active",!0).order("sort_order"),te.from("reg_addons").select("id, name, price_cents, max_quantity, option_label, option_required, options").eq("event_id",n).eq("is_enabled",!0).order("sort_order")]);if(b)throw b;const $=Ls((xe=(ue=(he=a==null?void 0:a.modules_config)==null?void 0:he.modules)==null?void 0:ue.exhibitors)==null?void 0:xe.config);return{event:a,packages:Fs($.packages),tickets:T??[],addons:(y??[]).map(O=>({id:O.id,name:O.name,price_cents:O.price_cents??0,max_quantity:O.max_quantity??1,option_label:O.option_label??null,option_required:O.option_required===!0,options:Os(O.options)}))}}}),V=(_==null?void 0:_.packages)??[],de=(_==null?void 0:_.tickets)??[],s=(_==null?void 0:_.addons)??[],D=(_==null?void 0:_.event)??null,p=V.find(a=>a.id===k)??null,L=d.useMemo(()=>{if(!p)return[];const a=new Map(s.map(b=>[b.id,b]));return qs(p.compAddons).flatMap(b=>{const T=a.get(b.addonId);return T?(b.purchaserQty??0)<=0&&(b.perCompSeatQty??0)<=0?[]:[{addon:T,purchaserQty:b.purchaserQty??0,perCompSeatQty:b.perCompSeatQty??0}]:[]})},[p,s]);d.useEffect(()=>{R((p==null?void 0:p.admissionTicketId)??""),X({})},[p==null?void 0:p.id,p==null?void 0:p.admissionTicketId]);const B=()=>{r(0),x(ss()),A(""),R(""),z("link"),Y(""),ne(!1),Z(!1),X({}),le(null),ce(null)},F=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email.trim()),U=j==="complete"&&!c,H=de.find(a=>a.id===c)??null,M=Ss(D==null?void 0:D.event_type,H==null?void 0:H.attendance_mode),Q=j==="complete"&&Ts(D,M),K=Q?As(Es({address_line1:i.addressLine1,address_city:i.city,address_state:i.state,address_postal_code:i.postalCode,address_country_code:i.country})):null,me=j==="complete"?Ws(L,P):[],pe=[!!k&&ie.trim().length>=3,F&&!(j==="complete"&&!i.contact_name.trim())&&!K,me.length===0,!U],$e=pe.map((a,b)=>a?-1:b).filter(a=>a>=0&&a<o),qe=pe.every(Boolean),Le=(a,b,T)=>X(y=>{const $=[...y[a]??[]];return $[b]=T,{...y,[a]:$}}),we=async()=>{_e(!0),le(null);try{const a=j==="complete"?Ys(L,P,i.contact_name.trim()||"Exhibitor"):[],b=Gs(L,P),T=await is("admin-create-exhibitor",{body:{event_id:n,package_id:k,mode:j,comp_reason:ie.trim(),send_emails:J,capacity_override:!0,ticket_type_id:c||void 0,...a.length?{addon_selections:a}:{},...b.length?{staff_addon_choices:b}:{},contact_name:i.contact_name.trim(),spouse_name:i.spouse_name.trim(),email:i.email.trim().toLowerCase(),phone:i.phone.trim(),mobile:i.mobile.trim(),home_address:{line1:i.addressLine1.trim(),city:i.city.trim(),state:i.state.trim(),postalCode:i.postalCode.trim(),country:i.country},business:{company:i.company.trim(),website:i.website.trim(),addressLine1:i.addressLine1.trim(),city:i.city.trim(),state:i.state.trim(),postalCode:i.postalCode.trim(),country:i.country,notes:i.notes.trim()},products_to_sell:i.products_to_sell.trim(),faith_organizations:i.faith_organizations.trim(),electricity_needed:re,display_description:i.display_description.trim(),heard_about:i.heard_about.trim()}}),y=T.data;if(!T.ok||!(y!=null&&y.ok))throw new Error((y==null?void 0:y.message)||T.message||(y==null?void 0:y.error)||"That didn't go through. Please try again.");
1await u.invalidateQueries({queryKey:["exhibitor_applications",n]}),await u.invalidateQueries({queryKey:["exhibitor_package_slots",n]}),m==null||m(y.application_id);const $=y==null?void 0:y.warning;$?S.warning($):j==="pending"?S.success("Saved â it's waiting in âTo reviewâ."):j==="complete"?S.success("Comped exhibitor created and registered."):S.success(J?"Approved â their $0 link is on its way.":"Approved â copy their $0 link below."),j==="pending"||j==="complete"&&!$?(h(!1),B()):ce({url:(y==null?void 0:y.checkout_url)??null,note:$??""})}catch(a){le((a==null?void 0:a.message)??"That didn't go through. Please try again.")}finally{_e(!1)}};return e.jsx(Qe,{open:v,onOpenChange:a=>{h(a),a||B()},children:e.jsxs(Ie,{className:"max-h-[90vh] max-w-3xl overflow-y-auto",children:[e.jsxs(Pe,{children:[e.jsxs(De,{className:"flex items-center gap-2",children:[e.jsx(ze,{className:"h-5 w-5 text-primary"}),"Add a comped exhibitor"]}),e.jsx(Me,{children:"For vendors and sponsors you're bringing in yourself. Everything is $0 â fill in whatever you have. Email and the reason are always needed; registering them now also requires their name and any mailing address required by the ticket."})]}),Ee?e.jsx("div",{className:"flex justify-center py-10",children:e.jsx(Ae,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):q?e.jsxs("div",{className:"space-y-4 py-2",children:[q.note?e.jsx("div",{className:"rounded-lg border border-amber-500/40 bg-amber-500/5 p-3 text-sm",children:q.note}):e.jsx("p",{className:"text-sm",children:"They're approved and comped at $0."}),q.url&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(g,{children:"Their private checkout link"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Send this to them. It opens a pre-filled $0 checkout that finishes their registration and issues any booth-staff codes. It expires in 15 days."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(E,{readOnly:!0,value:q.url,className:"font-mono text-xs"}),e.jsx(w,{variant:"outline",onClick:()=>{var a;(a=navigator.clipboard)==null||a.writeText(q.url).catch(()=>{}),S.success("Link copied.")},children:"Copy"})]})]}),e.jsx(Te,{children:e.jsx(w,{onClick:()=>{h(!1),B()},children:"Done"})})]}):V.length===0?e.jsx("p",{className:"py-8 text-sm text-muted-foreground",children:"This event has no exhibitor packages yet. Add one in the event's Exhibitors module first."}):e.jsxs("div",{className:"space-y-5 py-1",children:[e.jsx(Us,{steps:es,current:o,problems:$e,onSelect:r}),o===0&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{children:"Package"}),e.jsxs(fe,{value:k,onValueChange:A,children:[e.jsx(ve,{children:e.jsx(be,{placeholder:"Choose a vendor or sponsor package"})}),e.jsx(Ne,{children:V.map(a=>e.jsxs(ae,{value:a.id,children:[a.agreementKind==="sponsor"?"Sponsor":"Vendor"," · ",a.name]},a.id))})]}),p&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Normally ",(p.priceCents/100).toLocaleString("en-US",{style:"currency",currency:"USD"})," â ",e.jsx("span",{className:"font-medium text-foreground",children:"comped to $0"}),p.compRegistrations>0&&` · ${p.compRegistrations} booth-staff admission(s) included`,L.length>0&&` · ${L.length} complimentary add-on(s)`]})]}),e.jsxs("div",{className:"space-y-2 rounded-lg border border-primary/30 bg-primary/5 p-4",children:[e.jsxs(g,{htmlFor:"comp-reason",className:"text-sm font-semibold",children:["Why is this comped? ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(W,{id:"comp-reason",value:ie,onChange:a=>Y(a.target.value),rows:2,maxLength:1e3,placeholder:"e.g. Local ministry partner â table donated by the host church."}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Stored on the record and in its history, so anyone can see why later."})]})]}),o===1&&e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(g,{htmlFor:"ex-name",children:["Full name ",j==="complete"&&e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(E,{id:"ex-name",value:i.contact_name,onChange:a=>C("contact_name",a.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(g,{htmlFor:"ex-email",children:["Email ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(E,{id:"ex-email",type:"email",value:i.email,onChange:a=>C("email",a.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(g,{htmlFor:"ex-company",children:"Business / ministry"}),e.jsx(E,{id:"ex-company",value:i.company,onChange:a=>C("company",a.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(g,{htmlFor:"ex-website",children:"Website"}),e.jsx(E,{id:"ex-website",value:i.website,onChange:a=>C("website",a.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(g,{htmlFor:"ex-phone",children:"Phone"}),e.jsx(E,{id:"ex-phone",value:i.phone,onChange:a=>C("phone",a.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(g,{htmlFor:"ex-mobile",children:"Mobile"}),e.jsx(E,{id:"ex-mobile",value:i.mobile,onChange:a=>C("mobile",a.target.value)})]}),e.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[e.jsxs(g,{htmlFor:"ex-addr",children:["Address ",Q&&e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(E,{id:"ex-addr",value:i.addressLine1,onChange:a=>C("addressLine1",a.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(g,{htmlFor:"ex-city",children:["City ",Q&&e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(E,{id:"ex-city",value:i.city,onChange:a=>C("city",a.target.value)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(g,{htmlFor:"ex-state",children:["State ",Q&&i.country==="US"&&e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(E,{id:"ex-state",value:i.state,onChange:a=>C("state",a.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(g,{htmlFor:"ex-zip",children:["ZIP ",Q&&i.country==="US"&&e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(E,{id:"ex-zip",value:i.postalCode,onChange:a=>C("postalCode",a.target.value)})]})]}),e.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[e.jsxs(g,{htmlFor:"ex-country",children:["Country ",Q&&e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(fe,{value:i.country,onValueChange:a=>C("country",a),children:[e.jsx(ve,{id:"ex-country",children:e.jsx(be,{placeholder:"Choose a country"})}),e.jsx(Ne,{children:rs.map(a=>e.jsx(ae,{value:a.code,children:a.name},a.code))})]})]}),Q&&K&&e.jsxs("p",{className:"text-sm text-destructive sm:col-span-2",children:[K.message,"."]}),e.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[e.jsx(g,{htmlFor:"ex-products",children:"Products / services"}),e.jsx(W,{id:"ex-products",rows:2,value:i.products_to_sell,onChange:a=>C("products_to_sell",a.target.value)})]}),e.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[e.jsx(g,{htmlFor:"ex-faith",children:"Church / ministry involvement"}),e.jsx(W,{id:"ex-faith",rows:2,value:i.faith_organizations,onChange:a=>C("faith_organizations",a.target.value)})]}),e.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[e.jsx(g,{htmlFor:"ex-notes",children:"Staff notes"}),e.jsx(W,{id:"ex-notes",rows:2,value:i.notes,onChange:a=>C("notes",a.target.value)})]}),e.jsxs("div",{className:"flex items-center gap-3 sm:col-span-2",children:[e.jsx(Xe,{id:"ex-power",checked:re,onCheckedChange:Z}),e.jsx(g,{htmlFor:"ex-power",className:"font-normal",children:"Needs electricity at the table"})]})]}),o===2&&e.jsx(Ks,{resolved:L,compRegistrations:(p==null?void 0:p.compRegistrations)??0,mode:j,choices:P,onChoice:Le}),o===3&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(g,{children:"What should happen next?"}),e.jsx(ks,{value:j,onValueChange:a=>z(a),className:"space-y-2",children:Js.map(a=>e.jsxs("label",{htmlFor:`mode-${a.value}`,className:"flex cursor-pointer items-start gap-3 rounded-lg border p-3 hover:bg-muted/50",children:[e.jsx(Cs,{id:`mode-${a.value}`,value:a.value,className:"mt-1"}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm font-medium",children:a.title}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:a.blurb})]})]},a.value))}),j==="complete"&&!(p!=null&&p.admissionTicketId)&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{children:"Admission ticket for their registration"}),e.jsxs(fe,{value:c,onValueChange:R,children:[e.jsx(ve,{children:e.jsx(be,{placeholder:"Choose a ticket"})}),e.jsx(Ne,{children:de.map(a=>e.jsx(ae,{value:a.id,children:a.name},a.id))})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"This package isn't linked to a ticket, so pick the admission they should get."})]}),j==="complete"&&me.length>0&&e.jsxs("p",{className:"text-sm text-destructive",children:["Go back to âIncluded add-onsâ and choose an option for ",me.join(", "),"."]}),j==="complete"&&!i.contact_name.trim()&&e.jsx("p",{className:"text-sm text-destructive",children:"A full name is needed to register them â add it in âTheir informationâ."}),j==="complete"&&K&&e.jsxs("p",{className:"text-sm text-destructive",children:["Go back to âTheir informationâ: ",K.message,"."]}),e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border p-3",children:[e.jsx(Xe,{id:"ex-emails",checked:J,onCheckedChange:ne}),e.jsxs(g,{htmlFor:"ex-emails",className:"font-normal",children:["Send them an email",e.jsx("span",{className:"block text-xs text-muted-foreground",children:"Off by default â nothing is emailed unless you turn this on."})]})]})]}),oe&&e.jsx("p",{className:"text-sm text-destructive",children:oe}),e.jsxs(Te,{className:"gap-2 sm:justify-between",children:[e.jsx(w,{variant:"outline",onClick:()=>o===0?(h(!1),B()):r(o-1),disabled:ee,children:o===0?"Cancel":"Back"}),o<es.length-1?e.jsx(w,{onClick:()=>r(o+1),disabled:!pe[o],children:"Next"}):e.jsxs(w,{onClick:we,disabled:!qe||ee,children:[ee&&e.jsx(Ae,{className:"mr-2 h-4 w-4 animate-spin"}),j==="pending"?"Save application":j==="link"?"Approve & create link":"Approve & register"]})]})]})]})})};function Xs({eventId:n,orderId:v,compAddons:h}){const{data:m}=Is({orderId:v,purchaserCompAddons:h});if(!m)return null;const{grant:u,code:o,used:r,remaining:i,redeemers:x,addonLines:k}=m,A=u.status!=="active";return e.jsxs("section",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Complimentary admissions"}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(Ds,{className:"h-4 w-4 text-primary"}),e.jsx("code",{className:"rounded bg-muted px-2 py-1 font-mono text-base tracking-wide",children:o||"â"}),o&&e.jsx(w,{variant:"ghost",size:"sm",className:"h-7 px-2",onClick:()=>{var c;
1(c=navigator.clipboard)==null||c.writeText(o),S.success("Code copied.")},children:e.jsx(ns,{className:"h-3.5 w-3.5"})}),A&&e.jsx(se,{variant:"destructive",children:"Revoked"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[r," of ",u.seats_total," used · ",i," remaining",A&&" · this code can no longer be used"]}),x.length>0&&e.jsxs("div",{className:"border-t pt-3",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wider text-muted-foreground mb-1.5",children:"Who claimed a seat"}),e.jsx("ul",{className:"space-y-1 text-sm",children:x.map(c=>e.jsx("li",{children:e.jsxs(os,{to:`/admin/events/${n}/registrations?reg=${c.id}`,className:"group flex items-center justify-between gap-2 rounded px-1 py-1 hover:bg-muted",children:[e.jsxs("span",{className:"min-w-0",children:[e.jsxs("span",{className:"truncate",children:[c.first_name," ",c.last_name,e.jsxs("span",{className:"text-muted-foreground",children:[" · ",c.email]})]}),c.addons.length>0&&e.jsx("span",{className:"block text-xs text-muted-foreground",children:c.addons.map(R=>`${R.name} Ã${R.qty}`).join(" · ")})]}),e.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[e.jsx(se,{variant:"outline",children:c.status}),e.jsx(ls,{className:"h-3.5 w-3.5 text-muted-foreground opacity-0 group-hover:opacity-100"})]})]})},c.id))})]}),k.length>0&&e.jsxs("div",{className:"border-t pt-3",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wider text-muted-foreground mb-1.5",children:"Complimentary add-ons"}),e.jsx("ul",{className:"space-y-1 text-sm",children:k.map(c=>e.jsxs("li",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"truncate",children:c.name}),e.jsxs("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:[c.claimed," of ",c.promised," claimed"]})]},c.addonId))}),e.jsx("p",{className:"mt-1.5 text-xs text-muted-foreground",children:"Unclaimed units stay with the package â they can't be spent on anything else."})]})]})]})}const et=[{key:"capacity",label:"Event at full capacity"},{key:"not_a_fit",label:"Products/services not a fit for this event"},{key:"incomplete",label:"Incomplete application â please reapply"},{key:"duplicate",label:"Duplicate application"},{key:"other",label:"Other (write your own note)"}],Ce={pending:["submitted","in_review"],approved:["approved"],closed:["rejected","withdrawn","expired"]},Se=n=>(n/100).toLocaleString("en-US",{style:"currency",currency:"USD"}),ts={submitted:"bg-primary/10 text-primary",in_review:"bg-primary/10 text-primary",approved:"bg-emerald-500/10 text-emerald-700 dark:text-emerald-400",rejected:"bg-muted text-muted-foreground",withdrawn:"bg-muted text-muted-foreground",expired:"bg-muted text-muted-foreground"},N=({label:n,value:v,full:h})=>v?e.jsxs("div",{className:h?"sm:col-span-2 py-1.5":"py-1.5",children:[e.jsx("dt",{className:"text-xs text-muted-foreground",children:n}),e.jsx("dd",{className:"text-sm mt-0.5 whitespace-pre-wrap break-words",children:v})]}):null,G=({title:n,children:v})=>e.jsxs("section",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:n}),v]}),ye=({children:n})=>e.jsx("dl",{className:"grid gap-x-8 gap-y-1 sm:grid-cols-2",children:n}),Ot=()=>{var we,a,b,T,y,$,he,ue,xe,O,Ve,Be,Ue,He,Ke,Ge,We;const{id:n}=cs(),v=as(),[h,m]=d.useState("pending"),[u,o]=d.useState(""),[r,i]=d.useState(null),[x,k]=d.useState(!1),[A,c]=d.useState(!1),[R,j]=d.useState(!1),[z,ie]=d.useState("capacity"),[Y,J]=d.useState(""),[ne,re]=d.useState(""),[Z,P]=d.useState(!1),[X,ee]=d.useState(""),[_e,oe]=d.useState(!1),[le,q]=d.useState(!1),[ce,C]=d.useState(""),{data:_=[],isLoading:Ee}=Re({queryKey:["exhibitor_applications",n],enabled:!!n,queryFn:async()=>{const{data:t,error:l}=await te.from("reg_exhibitor_applications").select("*").eq("event_id",n).order("created_at",{ascending:!1});if(l)throw l;return t??[]}}),V=d.useMemo(()=>{const t={pending:0,approved:0,closed:0};for(const l of _)for(const[f,I]of Object.entries(Ce))I.includes(l.status)&&t[f]++;return t},[_]),de=d.useMemo(()=>{const t=u.trim().toLowerCase();return _.filter(l=>{var f;return Ce[h].includes(l.status)?t?`${l.contact_name} ${l.email} ${((f=l.business)==null?void 0:f.company)??""}`.toLowerCase().includes(t):!0:!1})},[_,h,u]),s=_.find(t=>
1t.id===r)??null,D=(s==null?void 0:s.status)==="approved"&&!s.registration_id?[...Array.isArray(s.activity)?s.activity:[]].reverse().find(t=>(t==null?void 0:t.action)==="auto_registration_failed"):null,{data:p}=Ps((s==null?void 0:s.order_id)??null,R&&(s==null?void 0:s.status)==="approved"),[L,B]=ds();d.useEffect(()=>{const t=L.get("app");if(!t||!_.length)return;const l=_.find(f=>f.id===t);l&&(i(t),m(Object.keys(Ce).find(f=>Ce[f].includes(l.status))??"pending")),L.delete("app"),B(L,{replace:!0})},[_,L,B]),d.useEffect(()=>q(!1),[r]);const{data:F}=Re({queryKey:["exhibitor_package_slots",n,s==null?void 0:s.package_id],enabled:!!n&&!!(s!=null&&s.package_id),queryFn:async()=>{const{data:t,error:l}=await te.rpc("exhibitor_package_slots",{_event_id:n,_package_id:s.package_id});if(l)throw l;return(t==null?void 0:t[0])??null}}),U=(F==null?void 0:F.remaining)??null,H=U!==null&&U<=0,M=async t=>{var l;k(!0);try{const f=await is("exhibitor-decision",{body:t}),I=((l=f.data)==null?void 0:l.error)==="no_capacity";return!f.ok&&!I?(S.error(ys(f.message??"That didn't go through. Please try again.",f.ref)),null):(await v.invalidateQueries({queryKey:["exhibitor_applications",n]}),await v.invalidateQueries({queryKey:["exhibitor_package_slots",n]}),f.data)}catch(f){return S.error((f==null?void 0:f.message)||"That didn't go through. Please try again."),null}finally{k(!1)}},Q=async()=>{var l;if(!s)return;const t=await M({application_id:s.id,action:s.status==="rejected"?"reapprove":"approve",decision_note:ne,capacity_override:Z});t!=null&&t.ok&&(c(!1),re(""),P(!1),S.success(t.email_sent?"Approved â the applicant has their private payment link.":"Approved, but the email didn't send. Copy the link and send it manually."),t.checkout_url&&((l=navigator.clipboard)==null||l.writeText(t.checkout_url).catch(()=>{})))},K=async()=>{if(!s)return;const t=await M({application_id:s.id,action:"reject",reason:z,custom_note:Y});t!=null&&t.ok&&(j(!1),J(""),S.success("Declined â a kind note is on its way to the applicant."))},me=async()=>{if(!s)return;const t=await M({application_id:s.id,action:"reissue_token"});t!=null&&t.ok&&S.success("A fresh link has been sent.")},pe=async()=>{if(!s)return;const t=await M({application_id:s.id,action:"save_notes",staff_notes:X});t!=null&&t.ok&&S.success("Notes saved.")},$e=async()=>{if(s!=null&&s.registration_id){k(!0);try{const{data:t,error:l}=await te.functions.invoke("resend-event-email",{body:{registration_id:s.registration_id,template_type:"exhibitor_welcome"}});if(l||(t==null?void 0:t.success)===!1)throw new Error((t==null?void 0:t.error)||(l==null?void 0:l.message)||"Send failed");S.success("Exhibitor email sent â agreement link and comp code included.")}catch(t){S.error((t==null?void 0:t.message)||"That email didn't send. Please try again.")}finally{k(!1)}}},qe=async()=>{if(!s)return;const t=await M({application_id:s.id,action:"update_email",email:ce});t!=null&&t.ok&&(q(!1),S.success("Email updated."))},Le=async()=>{if(!s)return;const t=await M({application_id:s.id,action:"resend_confirmation"});t!=null&&t.ok&&S.success("Application confirmation re-sent.")};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-display font-bold flex items-center gap-2",children:[e.jsx(Ms,{className:"h-6 w-6 text-primary"}),"Exhibitors"]}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Vendor and sponsor applications. Open one to read it, then approve or decline."})]}),e.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2 sm:w-auto",children:[e.jsxs(w,{variant:"outline",onClick:()=>oe(!0),children:[e.jsx(zs,{className:"h-4 w-4 mr-2"}),"Add exhibitor"]}),e.jsxs("div",{className:"relative w-full sm:w-64",children:[e.jsx(Vs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(E,{value:u,onChange:t=>o(t.target.value),placeholder:"Search name, email, company",className:"pl-9"})]})]})]}),e.jsx(fs,{value:h,onValueChange:t=>m(t),children:e.jsxs(vs,{children:[e.jsxs(Fe,{value:"pending",children:["To review (",V.pending,")"]}),e.jsxs(Fe,{value:"approved",children:["Approved (",V.approved,")"]}),e.jsxs(Fe,{value:"closed",children:["Closed (",V.closed,")"]})]})}),Ee?e.jsx(ms,{className:"h-40 w-full"}):de.length===0?e.jsxs("div",{className:"rounded-xl border border-dashed p-12 text-center text-muted-foreground",children:[e.jsx(Bs,{className:"h-8 w-8 mx-auto mb-3"}),"Nothing here yet."]}):e.jsx("div",{className:"rounded-xl border overflow-hidden",children:e.jsxs(bs,{children:[e.jsx(Ns,{children:e.jsxs(Ze,{children:[e.jsx(ge,{children:"Applicant"}),e.jsx(ge,{children:"Company"}),e.jsx(ge,{children:"Package"}),e.jsx(ge,{children:"Submitted"}),e.jsx(ge,{children:"Status"})]})}),e.jsx(_s,{children:de.map(t=>{var l,f,I;return e.jsxs(Ze,{className:"cursor-pointer",onClick:()=>{i(t.id),ee(t.staff_notes??"")},children:[e.jsxs(je,{children:[e.jsx("div",{className:"font-medium",children:t.contact_name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:t.email})]}),e.jsx(je,{className:"text-sm",children:((l=t.business)==null?void 0:l.company)??"â"}),e.jsxs(je,{className:"text-sm",children:[((f=t.package_snapshot)==null?void 0:f.name)??"â",e.jsx("div",{className:"text-xs text-muted-foreground",children:Se(Number(((I=t.package_snapshot)==null?void 0:I.priceCents)??0))})]}),e.jsx(je,{className:"text-sm text-muted-foreground",children:ke(new Date(t.created_at),"MMM d, yyyy")}),e.jsx(je,{children:e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx(se,{variant:"secondary",className:ts[t.status],children:t.status.replace("_"," ")}),t.is_comped&&e.jsx(se,{variant:"secondary",className:"bg-amber-500/10 text-amber-700 dark:text-amber-400",children:"Comped"})]})})]},t.id)})})]})}),e.jsx(ps,{open:!!s,onOpenChange:t=>!t&&i(null),children:e.jsx(hs,{className:"w-full sm:max-w-3xl xl:max-w-5xl overflow-y-auto",children:s&&e.jsxs(e.Fragment,{children:[e.jsx(us,{children:e.jsxs(xs,{className:"sr-only",children:["Application from ",s.contact_name]})}),e.jsxs("div",{className:"rounded-xl border bg-card p-5 space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-xl font-semibold leading-tight",children:s.contact_name}),e.jsx(se,{variant:"secondary",className:ts[s.status],children:s.status.replace("_"," ")}),s.is_comped&&e.jsx(se,{variant:"secondary",className:"bg-amber-500/10 text-amber-700 dark:text-amber-400",children:"Comped"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[(we=s.business)!=null&&we.company?`${s.business.company} · `:"","Submitted ",ke(new Date(s.created_at),"MMM d, yyyy")]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-sm font-medium",children:((a=s.package_snapshot)==null?void 0:a.name)??"â"}),e.jsx("p",{className:"font-display text-lg font-bold tabular-nums",children:Se(Number(((b=s.package_snapshot)==null?void 0:b.priceCents)??0))})]})]}),s.comp_reason&&e.jsxs("div",{className:"rounded-lg border border-amber-500/40 bg-amber-500/5 p-4",children:[e.jsxs("p",{className:"flex items-center gap-2 text-xs font-semibold uppercase tracking-wider text-amber-700 dark:text-amber-400",children:[e.jsx(ze,{className:"h-3.5 w-3.5"}),"Comped â why"]}),e.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:s.comp_reason})]}),D&&e.jsxs("div",{className:"rounded-lg border border-destructive/40 bg-destructive/5 p-4",children:[e.jsxs("p",{className:"flex items-center gap-2 text-xs font-semibold uppercase tracking-wider text-destructive",children:[e.jsx(gs,{className:"h-3.5 w-3.5"}),"Registration not created"]}),e.jsx("p",{className:"mt-1 text-sm",children:D.note||"The automatic registration did not finish."}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Send a fresh $0 checkout link so they can finish their registration."})]})]}),e.jsxs("div",{className:"mt-6 grid gap-8 xl:grid-cols-[1fr_300px]",children:[e.jsxs("div",{className:"space-y-8 min-w-0",children:[e.jsx(G,{title:"Package",children:e.jsxs(ye,{children:[e.jsx(N,{label:"Package",value:`${((T=s.package_snapshot)==null?void 0:T.name)??"â"} â ${Se(Number(((y=s.package_snapshot)==null?void 0:y.priceCents)??0))}`}),e.jsx(N,{label:"Type",value:s.agreement_kind==="sponsor"?"Sponsor":"Vendor"}),e.jsx(N,{label:"Slots",value:F?F.remaining===null?`${F.used} used â unlimited`:`${F.remaining} of ${F.used+F.remaining} left`:null}),e.jsx(N,{label:"Complimentary admissions",value:s.comp_count?String(s.comp_count):null})]})}),e.jsx(G,{title:"Contact",children:e.jsxs(ye,{children:[e.jsx(N,{full:!0,label:"Email",value:le?e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(E,{value:ce,onChange:t=>C(t.target.value),className:"h-8 w-64",type:"email",maxLength:200}),e.jsx(w,{size:"sm",onClick:qe,disabled:x,children:"Save"}),e.jsx(w,{size:"sm",variant:"ghost",onClick:()=>q(!1),children:"Cancel"})]}):e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"break-all",children:s.email}),e.jsx(w,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",onClick:()=>{C(s.email),q(!0)},children:"Edit"}),e.jsxs(w,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs gap-1",onClick:Le,disabled:x,children:[e.jsx(Je,{className:"h-3.5 w-3.5"}),"Resend confirmation"]})]})}),e.jsx(N,{label:"Phone",value:s.phone}),e.jsx(N,{label:"Mobile",value:s.mobile}),e.jsx(N,{label:"Spouse",value:s.spouse_name}),e.jsx(N,{full:!0,label:"Home",value:[($=s.home_address)==null?void 0:$.line1,(he=s.home_address)==null?void 0:he.city,(ue=s.home_address)==null?void 0:ue.state,(xe=s.home_address)==null?void 0:xe.postalCode].filter(
1Boolean).join(", ")})]})}),e.jsx(G,{title:"Business",children:e.jsxs(ye,{children:[e.jsx(N,{label:"Company",value:(O=s.business)==null?void 0:O.company}),e.jsx(N,{label:"Website",value:(Ve=s.business)==null?void 0:Ve.website}),e.jsx(N,{full:!0,label:"Address",value:[(Be=s.business)==null?void 0:Be.addressLine1,(Ue=s.business)==null?void 0:Ue.city,(He=s.business)==null?void 0:He.state,(Ke=s.business)==null?void 0:Ke.postalCode].filter(Boolean).join(", ")}),e.jsx(N,{full:!0,label:"Notes",value:(Ge=s.business)==null?void 0:Ge.notes})]})}),e.jsx(G,{title:"Vetting",children:e.jsxs(ye,{children:[e.jsx(N,{full:!0,label:"Products / services",value:s.products_to_sell}),e.jsx(N,{full:!0,label:"Church / ministry",value:s.faith_organizations}),e.jsx(N,{label:"Electricity",value:s.electricity_needed?"Yes":"No"}),e.jsx(N,{label:"Display",value:s.display_description}),e.jsx(N,{label:"Display height",value:s.display_height}),e.jsx(N,{label:"Heard about us",value:s.heard_about}),e.jsx(N,{label:"Prior events",value:s.prior_events}),(s.question_snapshot??[]).map(t=>{var l,f,I;return e.jsx(N,{full:!0,label:t.label,value:Array.isArray((l=s.question_answers)==null?void 0:l[t.id])?s.question_answers[t.id].join(", "):typeof((f=s.question_answers)==null?void 0:f[t.id])=="boolean"?s.question_answers[t.id]?"Yes":"No":(I=s.question_answers)==null?void 0:I[t.id]},t.id)})]})}),e.jsxs(G,{title:"Agreement",children:[e.jsx(ye,{children:e.jsx(N,{full:!0,label:"Signed",value:s.signer_name?`${s.signer_name} â ${s.signed_at?ke(new Date(s.signed_at),"MMM d, yyyy h:mm a"):""} (v${s.agreement_version})`:null})}),s.agreement_body&&e.jsxs("details",{children:[e.jsx("summary",{className:"text-sm text-primary cursor-pointer",children:"Read the signed agreement"}),e.jsx("div",{className:"prose prose-sm max-w-none mt-2 max-h-80 overflow-y-auto rounded-lg border p-4 text-muted-foreground",dangerouslySetInnerHTML:{__html:ws(s.agreement_body)}})]})]}),s.order_id&&e.jsx(Xs,{eventId:s.event_id,orderId:s.order_id,compAddons:(We=s.package_snapshot)==null?void 0:We.compAddons})]}),e.jsxs("aside",{className:"space-y-8 xl:border-l xl:border-border xl:pl-8",children:[e.jsx(G,{title:"Internal notes",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{value:X,onChange:t=>ee(t.target.value),rows:4,maxLength:4e3}),e.jsx(w,{size:"sm",variant:"outline",onClick:pe,disabled:x,children:"Save notes"})]})}),Array.isArray(s.activity)&&s.activity.length>0&&e.jsx(G,{title:"Activity",children:e.jsx("ul",{className:"space-y-2 text-xs text-muted-foreground",children:s.activity.map((t,l)=>e.jsxs("li",{className:"border-l-2 border-border pl-3",children:[e.jsx("span",{className:"block text-foreground",children:t.action}),t.at?ke(new Date(t.at),"MMM d, yyyy h:mm a"):"",t.note?` â ${t.note}`:""]},l))})})]})]}),e.jsxs("div",{className:"sticky bottom-0 -mx-6 mt-8 border-t bg-background px-6 py-4 flex flex-wrap justify-end gap-2",children:[s.status==="approved"&&e.jsxs(w,{variant:"ghost",onClick:()=>{var t;(t=navigator.clipboard)==null||t.writeText(s.email),S.success("Email copied.")},className:"gap-1 mr-auto",children:[e.jsx(ns,{className:"h-4 w-4"}),"Copy email"]}),s.status==="approved"&&!s.order_id&&e.jsxs(w,{variant:"outline",onClick:me,disabled:x,className:"gap-1",children:[e.jsx(js,{className:"h-4 w-4"}),D?"Send $0 checkout link":"Send a fresh link"]}),s.registration_id&&e.jsxs(w,{variant:"outline",onClick:$e,disabled:x,className:"gap-1",children:[e.jsx(Je,{className:"h-4 w-4"}),"Resend exhibitor email"]}),["submitted","in_review","approved"].includes(s.status)&&e.jsx(w,{variant:"outline",onClick:()=>j(!0),disabled:x,children:"Decline"}),s.status!=="approved"&&e.jsx(w,{onClick:()=>{P(!1),c(!0)},disabled:x,children:s.status==="rejected"?"Approve anyway":"Approve"})]})]})})}),e.jsx(Qe,{open:A,onOpenChange:c,children:e.jsxs(Ie,{children:[e.jsxs(Pe,{children:[e.jsx(De,{children:(s==null?void 0:s.status)==="rejected"?"Reactivate and approve":"Approve this applicant"}),e.jsx(Me,{children:(s==null?void 0:s.status)==="rejected"?"This will reactivate this application and approve this applicant. They'll receive a private payment link.":"They'll receive a private payment link. The slot is held once they pay."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm",children:U===null?"This package has unlimited slots.":H?"There are no slots available. You cannot approve this applicant unless a slot opens up.":`${U} slot${U===1?"":"s"} remaining.`}),H&&e.jsxs("label",{className:"flex items-start gap-2 text-sm",children:[e.jsx("input",{type:"checkbox",checked:Z,onChange:t=>P(t.target.checked),className:"mt-1"}),e.jsx("span",{children:"Override capacity and approve anyway (this is recorded on the application)."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(g,{className:"text-sm",children:"A personal note for the approval email (optional)"}),e.jsx(W,{value:ne,onChange:t=>re(t.target.value),rows:3,maxLength:2e3})]})]}),e.jsxs(Te,{children:[e.jsx(w,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsxs(w,{onClick:Q,disabled:x||H&&!Z,children:[x&&e.jsx(Ae,{className:"h-4 w-4 animate-spin mr-2"}),"Approve and send the link"]})]})]})}),e.jsx(Qe,{open:R,onOpenChange:j,children:e.jsxs(Ie,{children:[e.jsxs(Pe,{children:[e.jsx(De,{children:"Decline this application"}),e.jsx(Me,{children:"A reason is required. The email is warm and kind no matter which one you pick."})]}),e.jsxs("div",{className:"space-y-3",children:[p&&p.count>0&&e.jsxs("div",{className:"rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm",children:["This will also cancel ",p.count," comp registration",p.count===1?"":"s"," issued under this package",p.paidCents>0&&e.jsxs(e.Fragment,{children:[" and refund ",Se(p.paidCents)," paid by those attendees"]}),"."]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(g,{className:"text-sm",children:"Reason"}),e.jsxs(fe,{value:z,onValueChange:ie,children:[e.jsx(ve,{children:e.jsx(be,{})}),e.jsx(Ne,{children:et.map(t=>e.jsx(ae,{value:t.key,children:t.label},t.key))})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(g,{className:"text-sm",children:["Your note ",z==="other"&&e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(W,{value:Y,onChange:t=>J(t.target.value),rows:4,maxLength:2e3,placeholder:"Written in your own words â this goes into the email."})]})]}),e.jsxs(Te,{children:[e.jsx(w,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),e.jsxs(w,{variant:"destructive",onClick:K,disabled:x||z==="other"&&!Y.trim(),children:[x&&e.jsx(Ae,{className:"h-4 w-4 animate-spin mr-2"}),"Send the decline"]})]})]})}),n&&e.jsx(Zs,{eventId:n,open:_e,onOpenChange:oe,onCreated:t=>i(t)})]})};export{Ot 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.