1import{u as j,aj as A,b as y,a as S,Q as L,r as l,s as E,j as e,B as c,av as K,cS as B,c as O,bo as U,ao as N,G as T,S as _}from"./index-ByYYWl6V.js";import{L as M}from"./LanguageSwitcher-DnKojN5t.js";import{A as b,b as g,a as v}from"./avatar-DfyiTc_8.js";import{S as V,e as z,a as D}from"./sheet-ke76V1vr.js";import{M as F}from"./menu-B83JlL33.js";import{L as G}from"./layout-dashboard-woW9s7V_.js";import{C as I}from"./clock-CUm8QZGC.js";import{C as q}from"./calendar-DY8QzU4v.js";import{L as P}from"./link-2-C5arFvZC.js";import{S as Q}from"./settings-Cp6SvoNk.js";import"./dropdown-menu-BZRKspBv.js";import"./index-CnBNeFET.js";import"./chevron-right-X_hlXzqd.js";import"./circle-DcpkfI2n.js";import"./index-C4Lchjjk.js";function R(){const{user:a,isAdmin:n}=j(),s=A();return{hasAccess:!!a&&(n||s.calendar.active),userEmail:a==null?void 0:a.email}}const H=[{to:"/booking",labelKey:"calendar.layout.nav.dashboard",icon:G,end:!0},{to:"/booking/event-types",labelKey:"calendar.layout.nav.eventTypes",icon:N},{to:"/booking/availability",labelKey:"calendar.layout.nav.availability",icon:I},{to:"/booking/bookings",labelKey:"calendar.layout.nav.bookings",icon:q},{to:"/booking/integrations",labelKey:"calendar.layout.nav.integrations",icon:P},{to:"/booking/custom-domain",labelKey:"calendar.layout.nav.customDomain",icon:T},{to:"/booking/settings",labelKey:"calendar.layout.nav.settings",icon:Q}];function J(){const a=y(),n=S(),{user:s}=j(),{td:d}=L(),m=(s==null?void 0:s.email)??"",x=m.split("@")[0]||"User",[u,k]=l.useState(null),[r,w]=l.useState(null),[C,h]=l.useState(!1);l.useEffect(()=>{if(!s)return;let t=!1;return E.from("profiles").select("display_name, avatar_url").eq("id",s.id).single().then(({data:o})=>{t||!o||(k(o.display_name??null),w(o.avatar_url??null))}),()=>{t=!0}},[s]),l.useEffect(()=>{h(!1)},[n.pathname]);const i=(u==null?void 0:u.trim())||x.charAt(0).toUpperCase()+x.slice(1),p=i.charAt(0).toUpperCase(),f=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-4 py-4 border-b space-y-3",children:[e.jsxs(c,{variant:"ghost",size:"sm",className:"w-full justify-start -ml-1.5 h-8 text-muted-foreground hover:text-foreground",onClick:()=>a("/dashboard"),children:[e.jsx(K,{className:"h-3.5 w-3.5 mr-2"})," Back to workspace"]}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsxs(b,{className:"h-8 w-8",children:[r?e.jsx(g,{src:r,alt:i}):null,e.jsx(v,{className:"bg-primary text-primary-foreground text-xs font-semibold",children:p})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold leading-tight truncate",children:i}),e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"Calendar"})]})]})]}),e.jsx("nav",{className:"flex-1 p-2 space-y-0.5 overflow-y-auto",children:H.map(t=>e.jsxs(B,{to:t.to,end:t.end,className:({isActive:o})=>O("flex items-center gap-2.5 rounded-md px-2.5 py-2 text-sm transition-colors",o?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[e.jsx(t.icon,{className:"h-4 w-4"}),e.jsx("span",{children:d(t.labelKey)})]},t.to))}),e.jsxs("div",{className:"p-3 border-t flex items-center justify-between gap-2",children:[m?e.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:m}):e.jsx("span",{}),e.jsx(M,{})]})]});return e.jsxs("div",{className:"h-screen flex flex-col md:flex-row bg-background text-foreground",children:[e.jsxs("header",{className:"md:hidden flex items-center justify-between border-b px-3 h-12 bg-background",children:[e.jsxs(V,{open:C,onOpenChange:h,children:[e.jsx(z,{asChild:!0,children:e.jsx(c,{variant:"ghost",size:"icon","aria-label":"Open calendar menu",children:e.jsx(F,{className:"h-5 w-5"})})}),e.jsx(D,{side:"left",className:"p-0 w-64 flex flex-col bg-muted/10",children:f})]}),e.jsx("div",{className:"flex items-center gap-2 text-sm font-semibold",children:e.jsx("span",{children:d("calendar.layout.section")})}),e.jsxs(b,{className:"h-7 w-7",children:[r?e.jsx(g,{src:r,alt:i}):null,e.jsx(v,{className:"bg-primary text-primary-foreground text-[10px] font-semibold",children:p})]})]}),e.jsx("aside",{className:"hidden md:flex w-60 border-r flex-col bg-muted/10",children:f}),e.jsx("main",{className:"flex-1 overflow-auto",children:e.jsx(U,{})})]})}function de(){const{hasAccess:a}=R(),n=y();return a?e.jsx(J,{}):e.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:e.jsxs("div",{className:"text-center max-w-md mx-auto p-8 space-y-4",children:[e.jsx(N,{className:"h-16 w-16 text-muted-foreground mx-auto"}),e.jsx("h1",{className:"text-2xl font-bold",children:"Calendar"}),e.jsx("p",{className:"text-muted-foreground",children:"Share a personal booking page so clients can pick a time that works for both of you. Included in all Vsble Suite plans, or available as a standalone subscription."}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(c,{onClick:()=>{n("/dashboard"),setTimeout(()=>window.dispatchEvent(new CustomEvent("open-account-tab",{detail:"booking"})),100)},className:"w-full",children:"View standalone plans"}),e.jsxs(c,{variant:"outline",onClick:()=>{n("/dashboard"),setTimeout(()=>window.dispatchEvent(new CustomEvent("start-trial")),100)},className:"w-full",children:[e.jsx(_,{className:"h-4 w-4 mr-2"}),"Start free trial (includes all tools)"]})]})]})})}export{de 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.