1import{K as g,bo as x,l as h,s as _,r as y,j as s,d as f,bq as d}from"./index-Ct8eLu1I.js";import{u as j}from"./useOrganizationSlug-Im1jCHRI.js";import{u as b}from"./useCustomPageFields-CjotJQo4.js";import{L as N}from"./LandingPageRenderer-Bcr_KE1h.js";import"./formImageStyles-B4p3kKKU.js";import"./sanitized-html-D_hDi9wu.js";import"./purify.es-C5KSVp3G.js";import"./sanitizeUrl-CAP9M8eB.js";import"./inline-rich-text-editor-BJwpKsR-.js";import"./index-DvDyV3_k.js";import"./index-CJLyLLo7.js";import"./index-Dh4i1-J3.js";import"./underline-DzSBTR4Z.js";import"./list-ordered-D8sNfrla.js";import"./link-BavsN2MW.js";import"./unlink-Cfws_j2J.js";import"./calendar-CbKSfKX5.js";import"./chevron-left-m_yK3qef.js";import"./users-YMaWm21U.js";import"./map-pin-DUB0IYFr.js";import"./external-link-Jsfrs_aE.js";import"./clock-B75jo-2Q.js";import"./facebook-DyrCiiOy.js";import"./globe-Cc4mX4QA.js";import"./linkedin-DS5j75_D.js";import"./youtube-2shWwjb9.js";const W=()=>{const{orgSlug:i,pageSlug:r}=g(),{data:t,isLoading:n}=j(i),{setOrganizationFromSlug:o}=x(),{data:a,isLoading:m}=h({queryKey:["custom-page-by-slug",t==null?void 0:t.id,r],queryFn:async()=>{if(!(t!=null&&t.id)||!r)return null;const{data:e,error:l}=await _.from("custom_pages").select("*").eq("organization_id",t.id).eq("slug",r).eq("is_published",!0).maybeSingle();if(l)throw l;return e},enabled:!!(t!=null&&t.id)&&!!r}),{fields:u,isLoading:p}=b(a==null?void 0:a.id);if(y.useEffect(()=>{i&&o(i)},[i,o]),n||m||p)return s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx(f,{className:"h-8 w-8 animate-spin text-primary"})});if(!t)return s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Organization Not Found"}),s.jsx("p",{className:"text-muted-foreground mt-2",children:"The organization you're looking for doesn't exist."})]})});if(!a)return s.jsx(d,{children:s.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Page Not Found"}),s.jsx("p",{className:"text-muted-foreground mt-2",children:"This page doesn't exist or hasn't been published."})]})})});const c=u.map(e=>({id:e.id,organization_id:t.id,field_type:e.field_type,field_order:e.field_order,label:e.label,help_text:e.help_text,image_url:e.image_url,image_styles:e.image_styles,options:e.options,heading_styles:e.heading_styles,divider_styles:e.divider_styles,label_styles:e.label_styles,help_text_styles:e.help_text_styles,text_color:e.text_color,width:e.width,created_at:e.created_at,updated_at:e.updated_at}));return s.jsx(d,{children:s.jsx(N,{fields:c,organization:{id:t.id,name:t.name,slug:t.slug,logo_url:t.logo_url}})})};export{W 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.