@innosolutions/inno-calendar 1.0.16 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agenda-dropdown-CxEeszRC.cjs +2 -0
- package/dist/agenda-dropdown-CxEeszRC.cjs.map +1 -0
- package/dist/{agenda-dropdown-D9OflMMJ.js → agenda-dropdown-DFF2jwXe.js} +1062 -1041
- package/dist/agenda-dropdown-DFF2jwXe.js.map +1 -0
- package/dist/{agenda-view-NksBBAUh.cjs → agenda-view-BotvTTEB.cjs} +2 -2
- package/dist/agenda-view-BotvTTEB.cjs.map +1 -0
- package/dist/{agenda-view-Dtf3kn3K.js → agenda-view-CRI1J_KB.js} +6 -2
- package/dist/agenda-view-CRI1J_KB.js.map +1 -0
- package/dist/components/event/event-card.d.ts.map +1 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.mjs +2 -2
- package/dist/components/views/timeline-view.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +3 -3
- package/dist/presets/index.cjs +1 -1
- package/dist/presets/index.mjs +1 -1
- package/dist/{tailwind-calendar-DIOJZnSl.cjs → tailwind-calendar-CQBD-ljO.cjs} +2 -2
- package/dist/{tailwind-calendar-DIOJZnSl.cjs.map → tailwind-calendar-CQBD-ljO.cjs.map} +1 -1
- package/dist/{tailwind-calendar-CsiX8U1l.js → tailwind-calendar-Y9dn5uKm.js} +2 -2
- package/dist/{tailwind-calendar-CsiX8U1l.js.map → tailwind-calendar-Y9dn5uKm.js.map} +1 -1
- package/package.json +1 -1
- package/dist/agenda-dropdown-D9OflMMJ.js.map +0 -1
- package/dist/agenda-dropdown-DYQVwzmJ.cjs +0 -2
- package/dist/agenda-dropdown-DYQVwzmJ.cjs.map +0 -1
- package/dist/agenda-view-Dtf3kn3K.js.map +0 -1
- package/dist/agenda-view-NksBBAUh.cjs.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),Z=require("./inno-calendar-provider-BAcxjBGI.cjs"),u=require("./index-D2U2F80P.cjs"),b=require("react"),L=require("./slot-selection-context-B_YLI-x7.cjs"),h=require("./agenda-view-BotvTTEB.cjs");function Se({view:t,className:s=""}){return e.jsx("div",{className:s,style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"400px",backgroundColor:"#f9fafb",borderRadius:"0.5rem",border:"1px dashed #d1d5db"},children:e.jsxs("div",{style:{textAlign:"center",color:"#6b7280"},children:[e.jsxs("p",{style:{fontSize:"1.125rem",fontWeight:500},children:[t.charAt(0).toUpperCase()+t.slice(1)," View"]}),e.jsx("p",{style:{fontSize:"0.875rem"},children:"Implementation pending"})]})})}function me({view:t,className:s}){return e.jsx(Se,{view:t,className:s})}function ze(t){const{events:s,resources:n,scheduleTypes:r,initialView:o="week",initialDate:a,initialFilters:c,preferences:m,locale:l,slots:g,renderEvent:j,onViewChange:k,onDateChange:w,onEventClick:y,onSlotSelect:C,onFiltersChange:D,className:M,children:v}=t,T=Z.useOptionalCalendarContext();if(T)return e.jsx("div",{className:M,style:{position:"relative"},children:v??e.jsx(me,{view:T.view,className:M})});const I=Z.useCalendar({events:s,resources:n,scheduleTypes:r,initialView:o,initialDate:a,initialFilters:c,preferences:m,locale:l,onViewChange:k,onDateChange:w,onEventClick:y,onSlotSelect:C,onFiltersChange:D});return e.jsx(Z.CalendarProvider,{value:I,children:e.jsx("div",{className:M,style:{position:"relative"},children:v??e.jsx(me,{view:I.view,className:M})})})}const Ee=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Le=["January","February","March","April","May","June","July","August","September","October","November","December"];function he(t){const s=t.hexColor;return s?{backgroundColor:s}:{}}function Ie({day:t,date:s,events:n,isCurrentMonth:r,onDayClick:o}){const a=L.isToday(s),c=3,m=n.length;return e.jsxs("button",{type:"button",onClick:()=>o?.(s),className:u.cn("flex h-9 sm:h-11 flex-1 flex-col items-center justify-start gap-0.5 rounded-md pt-0.5 sm:pt-1","hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","transition-colors",!r&&"opacity-40"),children:[e.jsx("div",{className:u.cn("flex size-5 sm:size-6 items-center justify-center rounded-full text-[10px] sm:text-xs font-medium",a&&"bg-primary font-semibold text-primary-foreground"),children:t}),m>0&&e.jsx("div",{className:"mt-0.5 flex items-center gap-0.5",children:m<=c?n.map(l=>e.jsx("div",{className:"size-1 sm:size-1.5 rounded-full bg-primary",style:he(l)},l.id)):e.jsxs(e.Fragment,{children:[n.slice(0,c).map(l=>e.jsx("div",{className:"size-1 sm:size-1.5 rounded-full bg-primary",style:he(l)},l.id)),e.jsxs("span",{className:"text-[6px] sm:text-[7px] font-medium text-muted-foreground",children:["+",m-c]})]})})]})}function He({date:t,events:s,onMonthClick:n,onDayClick:r}){const o=b.useMemo(()=>L.generateMonthGrid(t,0),[t]);return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("button",{type:"button",onClick:()=>n?.(t),className:u.cn("w-full rounded-t-lg border px-2 sm:px-3 py-1.5 sm:py-2 text-xs sm:text-sm font-semibold","hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","transition-colors"),children:Le[t.getMonth()]}),e.jsxs("div",{className:"flex-1 space-y-1.5 sm:space-y-2 rounded-b-lg border border-t-0 p-2 sm:p-3",children:[e.jsx("div",{className:"grid grid-cols-7 gap-x-0.5 text-center",children:Ee.map((a,c)=>e.jsxs("div",{className:"text-[9px] sm:text-xs font-medium text-muted-foreground",children:[e.jsx("span",{className:"sm:hidden",children:a[0]}),e.jsx("span",{className:"hidden sm:inline",children:a})]},c))}),e.jsx("div",{className:"grid grid-cols-7 gap-x-0.5 gap-y-1",children:o.map((a,c)=>{const m=L.getEventsForDay(s,a.date);return e.jsx(Ie,{day:a.date.getDate(),date:a.date,events:m,isCurrentMonth:a.isCurrentMonth,onDayClick:r},`${c+1}-${a.date.toISOString()}`)})})]})]})}function De({events:t,year:s,onMonthClick:n,onDayClick:r,className:o}){const a=b.useMemo(()=>L.getYearMonths(s),[s]);return e.jsxs("div",{className:u.cn("flex flex-col h-full",o),children:[e.jsx("div",{className:"flex items-center justify-center border-b px-4 py-3",children:e.jsx("h2",{className:"text-lg font-semibold",children:s})}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:e.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:a.map(c=>e.jsx(He,{date:c,events:t,onMonthClick:n,onDayClick:r},c.getMonth()))})})]})}function We({className:t}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e.jsx("path",{d:"m15 18-6-6 6-6"})})}function $e({className:t}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}const le=44,fe=4,Pe=56,ge=8,ce=80,ee=140,pe=100,Fe=2,Be=8,Ae=18;function Oe(t){return t.split(" ").map(s=>s[0]).join("").toUpperCase().slice(0,2)}function _e(t,s){const n=[];for(let r=0;r<s;r++){const o=new Date(t);o.setDate(o.getDate()+r),n.push(o)}return n}function Re(t,s,n){const r=[];return t.forEach((o,a)=>{for(let c=s;c<n;c++)r.push({hour:c,dayIndex:a,date:o})}),r}function Ve(t){return`${t.toString().padStart(2,"0")}:00`}function Ue(t){return t.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}function Ye(t,s){const n=t.toLocaleDateString("en-US",{month:"short"}),r=s.toLocaleDateString("en-US",{month:"short"}),o=t.getDate(),a=s.getDate(),c=s.getFullYear();return n===r?`${n} ${o} - ${a}, ${c}`:`${n} ${o} - ${r} ${a}, ${c}`}function je(t){const s=[...t].sort((o,a)=>o.startCol!==a.startCol?o.startCol-a.startCol:a.spanCols-o.spanCols),n=[],r=[];for(const o of s){let a=0;for(;r[a]!==void 0&&r[a]>o.startCol;)a++;r[a]=o.startCol+o.spanCols,n.push({...o,stackIndex:a})}return n}function Ge({src:t,alt:s,fallback:n,className:r}){return e.jsx("div",{className:u.cn("relative flex shrink-0 overflow-hidden rounded-sm border bg-muted",r),children:t?e.jsx("img",{src:t,alt:s,className:"aspect-square h-full w-full object-cover"}):e.jsx("div",{className:"flex h-full w-full items-center justify-center bg-muted text-muted-foreground",children:n})})}const Ke=7;function ae({daysToShow:t=Ke,events:s,users:n=[],selectedDate:r,onDateChange:o,onEventClick:a,visibleHours:c,className:m,getEventUserId:l,renderPopover:g}){const j=b.useRef(null),k=r??new Date,w=!0,y=c?.from??Be,C=c?.to??Ae,D=C-y,M=b.useMemo(()=>{const i=new Date(k);if(t===1||t===3)return i.setHours(0,0,0,0),i;const x=i.getDay(),p=x===0?-6:1-x;return i.setDate(i.getDate()+p),i.setHours(0,0,0,0),i},[k,t]),v=b.useMemo(()=>_e(M,t),[M,t]),T=b.useMemo(()=>Re(v,y,C),[w,v,y,C]),W=l??(i=>{if(i.user?.id)return i.user.id;const x=i.data;if(x?.userId)return String(x.userId);if(x?.user&&typeof x.user=="object"&&x.user.id)return String(x.user.id);if(i.participants?.[0]?.id)return i.participants[0].id}),B=b.useMemo(()=>{const i=new Map;for(const x of n)i.set(x.id,{id:x.id,name:x.name,avatar:x.avatar??void 0,email:x.email});for(const x of s){x.user?.id&&!i.has(x.user.id)&&i.set(x.user.id,{id:x.user.id,name:x.user.name,avatar:x.user.avatar??void 0,email:x.user.email});for(const p of x.participants||[])p.id&&!i.has(p.id)&&i.set(p.id,{id:p.id,name:p.name,avatar:p.avatar??void 0,email:p.email})}return Array.from(i.values())},[n,s]),A=b.useMemo(()=>{const i=[],x=new Map;for(const S of B)x.set(S.id,[]);x.set("unassigned",[]);for(const S of s){const P=W(S)??"unassigned";(x.get(P)??x.get("unassigned")).push(S)}const p=S=>{const P=[];for(const E of S){const V=E.startDate.getHours()+E.startDate.getMinutes()/60,q=E.endDate.getHours()+E.endDate.getMinutes()/60;for(let U=0;U<v.length;U++){const X=v[U],ne=L.startOfDay(X),re=L.endOfDay(X);if(E.startDate<=re&&E.endDate>=ne){let K=y,$=C;if(E.startDate>=ne&&(K=Math.max(y,V)),E.endDate<=re&&($=Math.min(C,q)),K=Math.max(y,Math.min(C,K)),$=Math.max(y,Math.min(C,$)),$>K){const J=U*D+Math.floor(K-y),oe=U*D+Math.ceil($-y);P.push({event:E,startCol:J,spanCols:Math.max(1,oe-J)})}}}}return P};for(const S of B){const P=x.get(S.id)??[],E=p(P),V=je(E),q=V.reduce((U,X)=>Math.max(U,X.stackIndex+1),0);i.push({user:S,events:V,maxStack:Math.max(q,1)})}const z=x.get("unassigned")??[];if(z.length>0){const S=p(z),P=je(S),E=P.reduce((V,q)=>Math.max(V,q.stackIndex+1),0);i.push({user:{id:"unassigned",name:"Unassigned",avatar:void 0,email:void 0},events:P,maxStack:Math.max(E,1)})}return i},[B,s,v,w,D,y,C,W]),O=b.useMemo(()=>{const i=new Map;for(const x of A)for(const p of x.events)for(let z=p.startCol;z<p.startCol+p.spanCols;z++){const S=i.get(z)??0;i.set(z,Math.max(S,p.stackIndex+1))}return i},[A]),F=b.useMemo(()=>{const i=T.length,x=ce,p=[];for(let z=0;z<i;z++){const S=O.get(z)??1;S>Fe?p.push(Math.max(x,S*pe)):p.push(x)}return p},[w,T.length,v.length,O]),_=i=>Math.max(Pe,i*(le+fe)+ge*2),R=()=>{const i=new Date(M);i.setDate(i.getDate()-t),o?.(i)},f=()=>{const i=new Date(M);i.setDate(i.getDate()+t),o?.(i)},H=ee+F.reduce((i,x)=>i+x,0),d=b.useMemo(()=>{const i=[0];for(let x=0;x<F.length;x++)i.push(i[x]+F[x]);return i},[F]),N=b.useMemo(()=>{const i=v[0],x=v[v.length-1];return!i||!x?"":t===1?i.toLocaleDateString("en-US",{weekday:"long",month:"short",day:"numeric",year:"numeric"}):Ye(i,x)},[v,t]);return e.jsxs("div",{className:u.cn("flex h-full flex-col",m),children:[e.jsxs("div",{className:"flex items-center justify-between border-b bg-background px-2 sm:px-4 py-2 sm:py-3 gap-2",children:[e.jsxs("div",{className:"flex items-center w-full gap-1 sm:gap-2 shrink-0",children:[e.jsx(h.Button,{variant:"outline",size:"icon",className:"size-7 sm:size-8",onClick:R,children:e.jsx(We,{className:"size-3.5 sm:size-4"})}),e.jsx(h.Button,{variant:"outline",size:"icon",className:"size-7 sm:size-8",onClick:f,children:e.jsx($e,{className:"size-3.5 sm:size-4"})})]}),e.jsx("span",{className:"text-xs sm:text-sm w-full font-medium truncate",children:N}),e.jsx("div",{className:"w-8 sm:w-16 shrink-0"})," "]}),e.jsx("div",{className:"ic-timeline-scroll-container flex-1",ref:j,children:e.jsxs("div",{className:"relative",style:{minWidth:H},children:[e.jsx("div",{className:"ic-timeline-header sticky top-0 z-20 border-b bg-background",children:e.jsxs("div",{className:"flex flex-col",children:[t>1&&e.jsxs("div",{className:"flex border-b",children:[e.jsx("div",{className:"flex shrink-0 items-center border-r bg-background px-2 py-1",style:{width:ee},children:e.jsx("span",{className:"text-[10px] font-medium uppercase text-muted-foreground",children:"Resources"})}),v.map((i,x)=>{const p=L.isToday(i),z=x*D,S=F.slice(z,z+D).reduce((P,E)=>P+E,0);return e.jsx("div",{className:u.cn("flex shrink-0 items-center justify-center border-r py-1.5 font-medium",p?"bg-primary/10 text-primary":"bg-muted/30"),style:{width:S},children:e.jsx("span",{className:"text-xs",children:Ue(i)})},`day-${i.toISOString()}`)})]}),e.jsxs("div",{className:"flex",children:[t===1&&e.jsx("div",{className:"flex shrink-0 items-center border-r bg-background px-2 py-2",style:{width:ee},children:e.jsx("span",{className:"text-[10px] font-medium uppercase text-muted-foreground",children:"Resources"})}),t>1&&e.jsx("div",{className:"sticky left-0 z-10 border-r bg-background",style:{width:ee}}),T.map((i,x)=>{const p=i.hour===y,z=L.isToday(i.date),S=F[x]??ce;return e.jsx("div",{className:u.cn("flex shrink-0 items-center justify-center py-1.5 text-[10px] text-muted-foreground",p&&x>0?"border-l-2 border-l-border":"border-r border-r-border/50",z&&"bg-primary/5"),style:{width:S},children:Ve(i.hour)},`hour-${i.dayIndex}-${i.hour}`)})]})]})}),A.map(i=>{const x=_(i.maxStack);return e.jsxs("div",{className:"relative flex border-b",style:{height:x},children:[e.jsx("div",{className:"sticky left-0 z-10",style:{width:ee},children:e.jsxs("div",{className:"flex h-full items-center gap-2 sm:gap-3 border-r bg-background px-2 sm:px-4",children:[e.jsx(Ge,{className:"size-7",src:i.user.avatar,alt:i.user.name,fallback:Oe(i.user.name)}),e.jsx("span",{className:"truncate text-xs sm:text-sm font-medium",children:i.user.name})]})}),e.jsxs("div",{className:"relative flex flex-1",children:[T.map((p,z)=>{const S=p.hour===y&&z>0,P=F[z]??ce;return e.jsx("div",{className:u.cn("shrink-0",S?"border-l-2 border-l-border":"border-r border-r-border/50",L.isToday(p.date)&&"bg-primary/5"),style:{width:P}},`cell-${p.dayIndex}-${p.hour}`)}),i.events.map(p=>{const z=(d[p.startCol]??0)+2,S=d[p.startCol+p.spanCols]??d[d.length-1]??0,P=d[p.startCol]??0,E=S-P-4,V=ge+p.stackIndex*(le+fe);return e.jsx("div",{className:"absolute",style:{left:z,width:Math.max(pe-4,E),top:V,height:le},children:e.jsx(h.EventCard,{event:p.event,variant:"compact",onClick:a,renderPopover:g,className:"h-full w-full"})},p.event.id)})]})]},i.user.id)}),A.length===0&&e.jsx("div",{className:"flex items-center justify-center py-20 text-muted-foreground",children:"No users or events to display"})]})})]})}function Je(t){switch(t){case"day":case"week":return"time";default:return"day"}}function qe({onEventClick:t,onSlotClick:s,onSlotSelect:n,onAddEvent:r,className:o,showHeader:a=!0,minSelectionMinutes:c=30,settingsContent:m,filterContent:l,renderPopover:g}){const{view:j,setView:k,selectedDate:w,setSelectedDate:y,slotDuration:C,filteredEvents:D,users:M,visibleHours:v,workingHours:T,badgeVariant:I}=Z.useInnoCalendar(),W=b.useMemo(()=>({startHour:v.start,endHour:v.end}),[v]),B=b.useMemo(()=>Je(j),[j]),A=b.useCallback(f=>{if(n){n(f);return}if(s){const H=f.startDate.getHours();s(f.startDate,H)}},[n,s]),O=b.useCallback(f=>{k("day"),y(f,"day")},[y,k]),F=b.useCallback(f=>{k("month"),y(f,"month")},[y,k]),_=b.useCallback(f=>{t?.(f)},[t]),R=()=>{const f=D,H=_,d=g;switch(j){case"day":return e.jsx(h.DayView,{events:f,date:w,visibleHours:W,workingHours:T,slotDuration:C,badgeVariant:I,onEventClick:H,renderPopover:d});case"week":return e.jsx(h.WeekView,{events:f,date:w,visibleHours:W,workingHours:T,slotDuration:C,badgeVariant:I,onEventClick:H,renderPopover:d});case"month":return e.jsx(h.MonthView,{events:f,date:w,badgeVariant:I,onEventClick:H,onDayClick:O,renderPopover:d});case"year":return e.jsx(De,{events:f,year:w.getFullYear(),onMonthClick:F,onDayClick:O});case"agenda":return e.jsx(h.AgendaView,{events:f,date:w,onEventClick:H,renderPopover:d});case"timeline-day":return e.jsx(ae,{daysToShow:1,events:f,users:M,selectedDate:w,visibleHours:{from:v.start,to:v.end},onEventClick:H,renderPopover:d});case"timeline-3day":return e.jsx(ae,{daysToShow:3,events:f,users:M,selectedDate:w,visibleHours:{from:v.start,to:v.end},onEventClick:H,renderPopover:d});case"timeline-week":return e.jsx(ae,{daysToShow:7,events:f,users:M,selectedDate:w,visibleHours:{from:v.start,to:v.end},onEventClick:H,renderPopover:d});default:return e.jsx(h.MonthView,{events:f,date:w,badgeVariant:I,onEventClick:H,onDayClick:O})}};return e.jsx(L.SlotSelectionProvider,{mode:B,onSelect:A,minDurationMinutes:c,slotDurationMinutes:C,enabled:!!(n||s),children:e.jsxs("div",{className:u.cn("flex flex-col h-full p-4",o),children:[a&&e.jsx(h.CalendarHeader,{currentDate:w,view:j,events:D,onViewChange:k,onNavigateToday:()=>y(new Date,j),onNavigatePrev:()=>{const f=new Date(w);j==="day"||j==="timeline-day"?f.setDate(f.getDate()-1):j==="timeline-3day"?f.setDate(f.getDate()-3):j==="week"||j==="timeline-week"?f.setDate(f.getDate()-7):j==="month"?f.setMonth(f.getMonth()-1):j==="year"?f.setFullYear(f.getFullYear()-1):f.setDate(f.getDate()-7),y(f,j)},onNavigateNext:()=>{const f=new Date(w);j==="day"||j==="timeline-day"?f.setDate(f.getDate()+1):j==="timeline-3day"?f.setDate(f.getDate()+3):j==="week"||j==="timeline-week"?f.setDate(f.getDate()+7):j==="month"?f.setMonth(f.getMonth()+1):j==="year"?f.setFullYear(f.getFullYear()+1):f.setDate(f.getDate()+7),y(f,j)},availableViews:["day","week","month","agenda"],showTimelineViews:!0,showSettings:!!m,...r&&{onAddEvent:r},settingsContent:m,filterContent:l}),e.jsx("div",{className:"flex-1 border rounded-lg bg-white overflow-x-auto",children:R()})]})})}function Xe({events:t,users:s=[],scheduleTypes:n=[],initialView:r="week",initialDate:o,initialSelectedUserId:a,initialScheduleTypeIds:c,initialParticipantIds:m,initialWorkingHoursView:l,initialSearchQuery:g,preferencesConfig:j,onEventClick:k,onSlotClick:w,onSlotSelect:y,onAddEvent:C,onEventDrop:D,onDateChange:M,onViewChange:v,className:T,showHeader:I=!0,minSelectionMinutes:W=30,renderPopover:B,settingsContent:A,filterContent:O}){return e.jsx(L.DragDropProvider,{...D&&{onEventDrop:D},children:e.jsx(Z.InnoCalendarProvider,{initialEvents:t,initialUsers:s,initialScheduleTypes:n,initialView:r,...o&&{initialDate:o},...a&&{initialSelectedUserId:a},...c&&{initialScheduleTypeIds:c},...m&&{initialParticipantIds:m},...l&&{initialWorkingHoursView:l},...g&&{initialSearchQuery:g},...j&&{preferencesConfig:j},...M&&{onDateChange:M},...v&&{onViewChange:v},children:e.jsx(qe,{...k&&{onEventClick:k},...w&&{onSlotClick:w},...y&&{onSlotSelect:y},...C&&{onAddEvent:C},...B&&{renderPopover:B},className:T,showHeader:I,minSelectionMinutes:W,settingsContent:A,filterContent:O})})})}const G=b.forwardRef(({className:t,children:s,...n},r)=>e.jsx("select",{ref:r,className:u.cn("flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm","ring-offset-background","focus:outline-none focus:ring-1 focus:ring-ring","disabled:cursor-not-allowed disabled:opacity-50","[&>option]:bg-background",t),...n,children:s}));G.displayName="Select";const Y=b.forwardRef(({className:t,...s},n)=>e.jsx("label",{ref:n,className:u.cn("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...s}));Y.displayName="Label";function Qe({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}),e.jsx("path",{d:"m15 5 4 4"})]})}function Me({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M3 6h18"}),e.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),e.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"}),e.jsx("line",{x1:"10",x2:"10",y1:"11",y2:"17"}),e.jsx("line",{x1:"14",x2:"14",y1:"11",y2:"17"})]})}function ie({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})}function Ze({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"m4.9 4.9 14.2 14.2"})]})}function te({className:t}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e.jsx("path",{d:"M20 6 9 17l-5-5"})})}function et({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"m9 12 2 2 4-4"})]})}function tt({className:t}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}function st({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}function nt({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"}),e.jsx("circle",{cx:"12",cy:"10",r:"3"})]})}function rt({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M8 2v4"}),e.jsx("path",{d:"M16 2v4"}),e.jsx("rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}),e.jsx("path",{d:"M3 10h18"})]})}function ot({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),e.jsx("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),e.jsx("path",{d:"M10 9H8"}),e.jsx("path",{d:"M16 13H8"}),e.jsx("path",{d:"M16 17H8"})]})}function Q({className:t}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:u.cn("animate-spin",t),children:e.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}const at={edit:"Edit",delete:"Delete",cancel:"Cancel Event",close:"Close",going:"Going",notGoing:"Not Going",confirmMeeting:"Confirm meeting took place",completed:"Completed",canceled:"Canceled",participants:"Participants",guest:"guest",guests:"guests",confirmed:"confirmed",organizer:"Organizer",client:"Client",more:"more",noDateProvided:"No date provided",eventNotFound:"Event not found",cancellationNote:"Cancellation Note",canceledOn:"Canceled on",acceptThisEvent:"Accept this event only",acceptAllEvents:"Accept all events",deleteConfirmTitle:"Delete Event",deleteConfirmDescription:"Are you sure you want to delete this event? This action cannot be undone."},se=b.forwardRef(({onClick:t,label:s,children:n,className:r,variant:o="ghost",...a},c)=>e.jsxs(h.Tooltip,{children:[e.jsx(h.TooltipTrigger,{asChild:!0,children:e.jsx("button",{type:"button",ref:c,onClick:t,className:u.cn("h-8 w-8 rounded-full flex items-center justify-center transition-colors",o==="ghost"&&"hover:bg-zinc-100 dark:hover:bg-zinc-800 text-zinc-600 dark:text-zinc-400",o==="destructive"&&"hover:bg-red-50 dark:hover:bg-red-950/30 text-zinc-600 dark:text-zinc-400 hover:text-red-600",r),"aria-label":s,...a,children:n})}),e.jsx(h.TooltipContent,{side:"bottom",className:"text-xs",children:s})]}));se.displayName="IconButton";function it({src:t,alt:s,initials:n,className:r,isClient:o}){const[a,c]=b.useState(!1);return e.jsx("div",{className:u.cn("relative h-7 w-7 rounded-full overflow-hidden shrink-0",r),children:t&&!a?e.jsx("img",{src:t,alt:s,className:"h-full w-full object-cover",onError:()=>c(!0)}):e.jsx("div",{className:u.cn("h-full w-full flex items-center justify-center text-[10px] font-medium",o?"bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300":"bg-zinc-200 dark:bg-zinc-700 text-zinc-700 dark:text-zinc-300"),children:n})})}function ve({participant:t,isEventCanceled:s=!1,labels:n}){const r=t.name||"Unknown",o=r.split(" ").map(w=>w[0]).join("").toUpperCase().slice(0,2),a=t.isOrganizer??!1,c=t.isConfirmed,m=c===!0,l=c===!1,g=t.isClient??!1,j=t.profilePicture||t.avatar,k=s;return e.jsxs("div",{className:u.cn("flex items-center gap-3 py-0",k&&"opacity-60"),children:[e.jsxs("div",{className:"relative",children:[e.jsx(it,{src:j,alt:r,initials:o,isClient:g,className:u.cn(k&&"grayscale")}),k||l?e.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 h-3.5 w-3.5 rounded-full bg-white dark:bg-zinc-900 flex items-center justify-center",children:e.jsx("div",{className:"h-3 w-3 rounded-full bg-red-100 dark:bg-red-900/50 flex items-center justify-center",children:e.jsx(ie,{className:"h-2 w-2 text-red-600 dark:text-red-400 stroke-[3]"})})}):m?e.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 h-3.5 w-3.5 rounded-full bg-white dark:bg-zinc-900 flex items-center justify-center",children:e.jsx("div",{className:"h-3 w-3 rounded-full bg-green-100 dark:bg-green-900/50 flex items-center justify-center",children:e.jsx(te,{className:"h-2 w-2 text-green-600 dark:text-green-400 stroke-[3]"})})}):null]}),e.jsxs("div",{className:"!h-fit min-w-0 gap-0",children:[e.jsx("div",{className:"gap-0",children:e.jsx("span",{className:u.cn("text-sm text-zinc-900 dark:text-zinc-100 truncate",k&&"line-through text-zinc-500 dark:text-zinc-500"),children:r})}),g&&e.jsx("div",{className:"text-[10px] px-1.5 w-fit py-0.5 rounded bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300 font-medium",children:n.client}),a&&!k&&e.jsx("div",{className:"text-xs text-zinc-500",children:n.organizer})]})]})}function lt({open:t,onOpenChange:s,title:n,children:r}){return b.useEffect(()=>{if(!t)return;const o=a=>{a.key==="Escape"&&s(!1)};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[t,s]),b.useEffect(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[t]),t?e.jsxs("div",{className:"fixed inset-0 z-50",children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>s(!1),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&s(!1)}}),e.jsx("div",{className:"fixed inset-x-4 top-[50%] translate-y-[-50%] max-w-md mx-auto",children:e.jsxs("div",{className:"bg-white dark:bg-zinc-900 rounded-2xl shadow-xl overflow-hidden",children:[n&&e.jsx("div",{className:"sr-only",children:n}),r]})})]}):null}function ct({open:t,onOpenChange:s,title:n,description:r,cancelLabel:o,confirmLabel:a,onConfirm:c,isLoading:m}){return t?e.jsxs("div",{className:"fixed inset-0 z-[60]",children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>s(!1),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&s(!1)}}),e.jsx("div",{className:"fixed inset-x-4 top-[50%] translate-y-[-50%] max-w-md mx-auto",children:e.jsxs("div",{className:"bg-white dark:bg-zinc-900 rounded-lg shadow-xl p-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-zinc-900 dark:text-zinc-100",children:n}),e.jsx("p",{className:"mt-2 text-sm text-zinc-600 dark:text-zinc-400",children:r}),e.jsxs("div",{className:"mt-4 flex justify-end gap-3",children:[e.jsx(h.Button,{variant:"outline",size:"sm",onClick:()=>s(!1),children:o}),e.jsxs(h.Button,{variant:"destructive",size:"sm",onClick:c,disabled:m,children:[m&&e.jsx(Q,{className:"h-4 w-4 mr-2"}),e.jsx(Me,{className:"h-4 w-4 mr-2"}),a]})]})]})})]}):null}function dt(t,s){return t.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"})}function xt(t,s){const n={hour:"2-digit",minute:"2-digit",hour12:!1};return`${t.toLocaleTimeString(void 0,n)} – ${s.toLocaleTimeString(void 0,n)}`}function ut(t){return t.toLocaleDateString(void 0,{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}function mt(t){const[s,n]=b.useState(()=>typeof window<"u"?window.matchMedia(t).matches:!1);return b.useEffect(()=>{if(typeof window>"u")return;const r=window.matchMedia(t),o=a=>n(a.matches);return r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[t]),s}function we({event:t,labels:s,isLoading:n,onClose:r,onEdit:o,onDelete:a,onCancel:c,onAccept:m,onDecline:l,onConfirmMeeting:g,canEdit:j=!0,canDelete:k=!1,canCancel:w=!0,isCurrentUserParticipant:y=!1,isCurrentUserClient:C=!1,currentUserAcceptStatus:D,isAcceptLoading:M=!1,isDeclineLoading:v=!1,isConfirmLoading:T=!1,isDeleteLoading:I=!1,renderParticipant:W,renderHeaderActions:B,renderCancelReason:A,renderDeleteConfirmation:O,formatDate:F=dt,formatTimeRange:_=xt}){const[R,f]=b.useState(!1),H=!(t.isCanceled||t.meetingTookPlace),d=t.isRecurring??!1,N=t.participantDetails,i=t.participantsNames||[],x=N&&N.length>0,p=D===!0,z=D===!1,S=y&&!C&&H,P=x?N.filter($=>$.isConfirmed).length:t.isAccepted?i.length:0,E=x?N.length:i.length,V=t.scheduleTypeColor||t.hexColor||"#039BE5",q=b.useCallback(()=>t.startDate?F(t.startDate):s.noDateProvided,[t.startDate,F,s.noDateProvided]),U=b.useCallback(()=>t.startDate&&t.endDate?_(t.startDate,t.endDate):null,[t.startDate,t.endDate,_]),X=()=>{r(),o?.(t)},ne=()=>{r(),c?.(t)},re=()=>{f(!0)},K=()=>{a?.(t),f(!1)};return n?e.jsx("div",{className:"flex h-48 items-center justify-center",children:e.jsx(Q,{className:"h-6 w-6 text-zinc-400"})}):e.jsxs(h.TooltipProvider,{delayDuration:300,children:[e.jsxs("div",{className:"flex flex-col gap-0.5 p-3",children:[e.jsx("div",{className:"flex items-start justify-end gap-0.5",children:B?B({onClose:r}):e.jsxs(e.Fragment,{children:[H&&j&&o&&e.jsx(se,{onClick:X,label:s.edit,children:e.jsx(Qe,{className:"h-[18px] w-[18px]"})}),H&&w&&c&&e.jsx(se,{onClick:ne,label:s.cancel,children:e.jsx(Ze,{className:"h-[18px] w-[18px]"})}),k&&a&&e.jsx(se,{onClick:re,label:s.delete,variant:"destructive",children:e.jsx(Me,{className:"h-[18px] w-[18px]"})}),e.jsx(se,{onClick:r,label:s.close,children:e.jsx(ie,{className:"h-[18px] w-[18px]"})})]})}),e.jsx("div",{children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded mt-1 shrink-0",style:{backgroundColor:V}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h2",{className:u.cn("text-[22px] font-normal text-zinc-900 dark:text-zinc-100 leading-tight",t.isCanceled&&"line-through opacity-60"),children:t.title}),t.meetingTookPlace&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 text-xs font-medium",children:[e.jsx(et,{className:"h-3 w-3"}),s.completed]}),t.isCanceled&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400 text-xs font-medium",children:[e.jsx(ie,{className:"h-3 w-3"}),s.canceled]})]}),e.jsxs("div",{className:"mt-1 text-sm text-zinc-600 dark:text-zinc-400",children:[e.jsx("span",{children:q()}),U()&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-1.5",children:"·"}),e.jsx("span",{children:U()})]})]}),d&&t.recurrenceSummary&&e.jsx("div",{className:"text-sm text-zinc-500 dark:text-zinc-500",children:t.recurrenceSummary})]})]})}),t.isCanceled&&e.jsx("div",{className:"mx-4 p-3 rounded-lg bg-red-50 dark:bg-red-950/30",children:A?A(t):e.jsx("div",{className:"flex items-start gap-0",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-red-700 dark:text-red-400",children:s.cancellationNote}),t.cancelReason&&e.jsxs("div",{className:"mt-1 text-sm text-red-600/80 dark:text-red-400/80 italic",children:['"',t.cancelReason,'"']}),t.canceledDate&&e.jsxs("div",{className:"mt-1.5 text-xs text-red-500/70 dark:text-red-400/60",children:[s.canceledOn," ",ut(t.canceledDate)]})]})})}),e.jsxs("div",{className:"space-y-0.5",children:[t.address&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(nt,{className:"h-5 w-5 text-zinc-400 mt-0.5 shrink-0"}),e.jsx("span",{className:"text-sm text-zinc-700 dark:text-zinc-300",children:t.address})]}),(x||i.length>0)&&e.jsxs("div",{className:"flex items-start gap-2 py-0",children:[e.jsx(st,{className:"h-5 w-5 text-zinc-400 mt-0.5 shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-0",children:[e.jsxs("span",{className:"text-sm text-zinc-900 dark:text-zinc-100 font-medium",children:[E," ",E!==1?s.guests:s.guest]}),E>0&&e.jsxs("span",{className:"text-xs text-zinc-500",children:["(",P," ",s.confirmed,")"]})]}),e.jsxs("div",{className:"mt-2 space-y-2",children:[x?N.slice(0,6).map(($,J)=>W?W($,J):e.jsx(ve,{participant:$,isEventCanceled:t.isCanceled,labels:s},$.id)):i.slice(0,6).map(($,J)=>{const oe={id:String(J),name:$,email:"",isConfirmed:t.isAccepted,isOrganizer:J===0,isClient:!1};return W?W(oe,J):e.jsx(ve,{participant:oe,isEventCanceled:t.isCanceled,labels:s},$)}),E>6&&e.jsxs("div",{className:"text-xs text-zinc-500 py-1.5 pl-10",children:["+",E-6," ",s.more]})]})]})]}),t.description&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ot,{className:"h-5 w-5 text-zinc-400 mt-0.5 shrink-0"}),e.jsx("p",{className:"text-sm text-zinc-700 dark:text-zinc-300 whitespace-pre-wrap",children:t.description})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(rt,{className:"h-5 w-5 text-zinc-400 mt-0.5 shrink-0"}),e.jsx("div",{className:"text-sm text-zinc-700 dark:text-zinc-300",children:x&&N.find($=>$.isOrganizer)?.name||i[0]||"Calendar"})]})]}),S&&m&&l&&e.jsx("div",{className:"border-t border-zinc-100 dark:border-zinc-800 mt-3 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[d?e.jsxs(h.DropdownMenu,{children:[e.jsx(h.DropdownMenuTrigger,{asChild:!0,children:e.jsxs("div",{className:"flex",children:[e.jsx(h.Button,{size:"sm",variant:"outline",className:u.cn("rounded-r-none gap-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",p&&"!bg-green-700 !text-white hover:!bg-green-700"),onClick:$=>{$.stopPropagation(),p||m(t)},disabled:M,children:M?e.jsx(Q,{className:"h-3.5 w-3.5"}):e.jsxs(e.Fragment,{children:[p&&e.jsx(te,{className:"h-3.5 w-3.5"}),s.going]})}),e.jsx(h.Button,{size:"sm",variant:"outline",className:u.cn("rounded-l-none px-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",p&&"!bg-green-700 !text-white hover:!bg-green-700"),children:e.jsx(tt,{className:"h-3.5 w-3.5"})})]})}),e.jsxs(h.DropdownMenuContent,{align:"start",children:[e.jsxs(h.DropdownMenuItem,{className:u.cn("gap-1.5 h-8 !border-none !bg-green-50 text-green-800 hover:!bg-green-100",p&&"!bg-green-700 !text-white hover:!bg-green-700"),onClick:()=>m(t),children:[e.jsx(te,{className:"h-3.5 w-3.5 mr-2 text-green-600"}),s.acceptThisEvent]}),e.jsxs(h.DropdownMenuItem,{onClick:()=>m(t),children:[e.jsx(te,{className:"h-3.5 w-3.5 mr-2 text-green-600"}),s.acceptAllEvents]})]})]}):e.jsx(h.Button,{size:"sm",variant:"outline",className:u.cn("gap-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",p&&"!bg-green-700 !text-white hover:!bg-green-700"),onClick:()=>{p||m(t)},disabled:M,children:M?e.jsx(Q,{className:"h-3.5 w-3.5"}):e.jsxs(e.Fragment,{children:[p&&e.jsx(te,{className:"h-3.5 w-3.5"}),s.going]})}),e.jsx(h.Button,{size:"sm",variant:"outline",className:u.cn("gap-1.5 h-8 !border-none !bg-rose-100 text-rose-800 hover:!bg-rose-200",z&&"!bg-rose-700 !text-white hover:!bg-rose-700"),onClick:()=>{z||l(t)},disabled:v,children:v?e.jsx(Q,{className:"h-3.5 w-3.5"}):e.jsxs(e.Fragment,{children:[z&&e.jsx(ie,{className:"h-3.5 w-3.5"}),s.notGoing]})})]})}),y&&p&&!t.meetingTookPlace&&!t.isCanceled&&g&&e.jsx("div",{className:"border-t border-zinc-100 dark:border-zinc-800 py-3",children:e.jsxs(h.Button,{size:"sm",variant:"outline",className:"w-full h-9 hover:!bg-green-100 hover:text-green-700 text-green-700 !bg-green-100 !border-none dark:text-green-400 dark:hover:bg-green-950/30",onClick:()=>g(t),disabled:T,children:[T&&e.jsx(Q,{className:"h-4 w-4 mr-2"}),s.confirmMeeting]})})]}),O?R&&O({onConfirm:K,onCancel:()=>f(!1),isLoading:I}):e.jsx(ct,{open:R,onOpenChange:f,title:s.deleteConfirmTitle,description:s.deleteConfirmDescription,cancelLabel:s.cancel,confirmLabel:s.delete,onConfirm:K,isLoading:I})]})}function ht({event:t,children:s,open:n,onOpenChange:r,isLoading:o,labels:a,onEdit:c,onDelete:m,onCancel:l,onAccept:g,onDecline:j,onConfirmMeeting:k,canEdit:w=!0,canDelete:y=!1,canCancel:C=!0,isCurrentUserParticipant:D,isCurrentUserClient:M,currentUserAcceptStatus:v,isAcceptLoading:T,isDeclineLoading:I,isConfirmLoading:W,isDeleteLoading:B,renderParticipant:A,renderHeaderActions:O,renderCancelReason:F,renderDeleteConfirmation:_,formatDate:R,formatTimeRange:f,className:H,width:d=360}){const N=mt("(min-width: 768px)"),i={...at,...a},x=b.useCallback(()=>{r?.(!1)},[r]),p={event:t,labels:i,isLoading:o,onClose:x,onEdit:c,onDelete:m,onCancel:l,onAccept:g,onDecline:j,onConfirmMeeting:k,canEdit:w,canDelete:y,canCancel:C,isCurrentUserParticipant:D,isCurrentUserClient:M,currentUserAcceptStatus:v,isAcceptLoading:T,isDeclineLoading:I,isConfirmLoading:W,isDeleteLoading:B,renderParticipant:A,renderHeaderActions:O,renderCancelReason:F,renderDeleteConfirmation:_,formatDate:R,formatTimeRange:f};return N?e.jsxs(h.Popover,{open:n??!1,onOpenChange:r??(()=>{}),children:[e.jsx(h.PopoverTrigger,{asChild:!0,children:s}),e.jsx(h.PopoverContent,{className:u.cn("p-0 shadow-lg !rounded-2xl bg-white dark:bg-zinc-900 overflow-hidden border z-50",H),style:{width:d},align:"center",side:"bottom",sideOffset:4,children:e.jsx(we,{...p})})]}):e.jsxs(e.Fragment,{children:[s,e.jsx(lt,{open:n??!1,onOpenChange:r??(()=>{}),title:t.title,children:e.jsx(we,{...p})})]})}function ft({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 16v-4"}),e.jsx("path",{d:"M12 8h.01"})]})}function gt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}const pt=[{value:15,label:"15 minutes"},{value:30,label:"30 minutes"},{value:60,label:"1 hour"}];function jt({value:t,onChange:s,isLocked:n=!1,className:r,labels:o={}}){const a={title:"Slot duration",lockedMessage:"This setting is locked by the administrator",infoMessage:"Set the time slot duration for day and week calendar views.",...o},c=m=>{n||s(Number(m.target.value))};return e.jsxs("div",{className:u.cn("flex flex-col gap-3",r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Y,{className:"text-sm font-semibold",children:a.title}),n?e.jsx(h.TooltipProvider,{delayDuration:100,children:e.jsxs(h.Tooltip,{children:[e.jsx(h.TooltipTrigger,{children:e.jsx(gt,{className:"size-3 text-muted-foreground"})}),e.jsx(h.TooltipContent,{children:e.jsx("p",{children:a.lockedMessage})})]})}):e.jsx(h.TooltipProvider,{delayDuration:100,children:e.jsxs(h.Tooltip,{children:[e.jsx(h.TooltipTrigger,{children:e.jsx(ft,{className:"size-3 text-muted-foreground"})}),e.jsx(h.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:a.infoMessage})})]})})]}),e.jsx(G,{value:t.toString(),onChange:c,disabled:n,className:"h-9 w-[128px] text-sm",children:pt.map(m=>e.jsx("option",{value:m.value.toString(),children:m.label},m.value))})]})}function vt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 16v-4"}),e.jsx("path",{d:"M12 8h.01"})]})}function wt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}function bt(){return Array.from({length:25},(t,s)=>({value:s,label:`${String(s).padStart(2,"0")}:00`}))}function yt({value:t,onChange:s,isLocked:n=!1,className:r,labels:o={}}){const a={title:"Visible hours",from:"From",to:"To",lockedMessage:"This setting is locked by the administrator",infoMessage:"Set the visible hour range for day and week views. Hours outside this range will be hidden.",...o},c=bt(),m=g=>{if(n)return;const j=Number(g.target.value);j<t.endHour&&s({...t,startHour:j})},l=g=>{if(n)return;const j=Number(g.target.value);j>t.startHour&&s({...t,endHour:j})};return e.jsxs("div",{className:u.cn("flex flex-col gap-3",r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Y,{className:"text-sm font-semibold",children:a.title}),n?e.jsx(h.TooltipProvider,{delayDuration:100,children:e.jsxs(h.Tooltip,{children:[e.jsx(h.TooltipTrigger,{children:e.jsx(wt,{className:"size-3 text-muted-foreground"})}),e.jsx(h.TooltipContent,{children:e.jsx("p",{children:a.lockedMessage})})]})}):e.jsx(h.TooltipProvider,{delayDuration:100,children:e.jsxs(h.Tooltip,{children:[e.jsx(h.TooltipTrigger,{children:e.jsx(vt,{className:"size-3 text-muted-foreground"})}),e.jsx(h.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:a.infoMessage})})]})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(Y,{className:"text-xs text-muted-foreground",children:a.from}),e.jsx(G,{value:t.startHour.toString(),onChange:m,disabled:n,className:"h-9 w-[88px] text-sm",children:c.map(g=>e.jsx("option",{value:g.value.toString(),disabled:g.value>=t.endHour,children:g.label},g.value))})]}),e.jsx("span",{className:"mt-5 text-muted-foreground",children:"—"}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(Y,{className:"text-xs text-muted-foreground",children:a.to}),e.jsx(G,{value:t.endHour.toString(),onChange:l,disabled:n,className:"h-9 w-[88px] text-sm",children:c.map(g=>e.jsx("option",{value:g.value.toString(),disabled:g.value<=t.startHour,children:g.label},g.value))})]})]})]})}function Nt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 16v-4"}),e.jsx("path",{d:"M12 8h.01"})]})}function kt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}const Ct=[{value:"dot",label:"Dot indicator"},{value:"colored",label:"Full color"},{value:"mixed",label:"Mixed"}];function Dt({value:t,onChange:s,isLocked:n=!1,className:r,labels:o={}}){const a={title:"Event display",lockedMessage:"This setting is locked by the administrator",infoMessage:"Choose how events are displayed. Dot shows a small indicator, colored fills the entire event, mixed uses both.",options:{dot:"Dot indicator",colored:"Full color",mixed:"Mixed"},...o},c=l=>a.options?.[l]??l,m=l=>{n||s(l.target.value)};return e.jsxs("div",{className:u.cn("flex flex-col gap-3",r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Y,{className:"text-sm font-semibold",children:a.title}),n?e.jsx(h.TooltipProvider,{delayDuration:100,children:e.jsxs(h.Tooltip,{children:[e.jsx(h.TooltipTrigger,{children:e.jsx(kt,{className:"size-3 text-muted-foreground"})}),e.jsx(h.TooltipContent,{children:e.jsx("p",{children:a.lockedMessage})})]})}):e.jsx(h.TooltipProvider,{delayDuration:100,children:e.jsxs(h.Tooltip,{children:[e.jsx(h.TooltipTrigger,{children:e.jsx(Nt,{className:"size-3 text-muted-foreground"})}),e.jsx(h.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:a.infoMessage})})]})})]}),e.jsx(G,{value:t,onChange:m,disabled:n,className:"h-9 w-[128px] text-sm",children:Ct.map(l=>e.jsx("option",{value:l.value,children:c(l.value)},l.value))})]})}function Mt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 16v-4"}),e.jsx("path",{d:"M12 8h.01"})]})}function Tt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}function St({className:t}){return e.jsx("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M20 6 9 17l-5-5"})})}const zt=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"];function Et(){return Array.from({length:25},(t,s)=>({value:s,label:`${String(s).padStart(2,"0")}:00`}))}const be={sunday:"Sun",monday:"Mon",tuesday:"Tue",wednesday:"Wed",thursday:"Thu",friday:"Fri",saturday:"Sat"};function Lt({dayLabel:t,config:s,onChange:n,disabled:r,hourOptions:o}){const a=()=>{r||n({...s,enabled:!s.enabled})},c=l=>{if(r)return;const g=Number(l.target.value);g<s.to&&n({...s,from:g})},m=l=>{if(r)return;const g=Number(l.target.value);g>s.from&&n({...s,to:g})};return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",role:"checkbox","aria-checked":s.enabled,"aria-label":`Enable ${t}`,onClick:a,disabled:r,className:u.cn("flex size-5 shrink-0 items-center justify-center rounded border transition-colors",s.enabled?"border-primary bg-primary text-primary-foreground":"border-input bg-background",r&&"cursor-not-allowed opacity-50"),children:s.enabled&&e.jsx(St,{className:"size-3"})}),e.jsx("span",{className:u.cn("w-10 text-sm",!s.enabled&&"text-muted-foreground"),children:t}),e.jsx(G,{value:s.from.toString(),onChange:c,disabled:r||!s.enabled,className:"h-8 w-[76px] text-xs",children:o.map(l=>e.jsx("option",{value:l.value.toString(),disabled:l.value>=s.to,children:l.label},l.value))}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"—"}),e.jsx(G,{value:s.to.toString(),onChange:m,disabled:r||!s.enabled,className:"h-8 w-[76px] text-xs",children:o.map(l=>e.jsx("option",{value:l.value.toString(),disabled:l.value<=s.from,children:l.label},l.value))})]})}function It({value:t,onChange:s,isLocked:n=!1,className:r,labels:o={}}){const a={title:"Working hours",lockedMessage:"This setting is locked by the administrator",infoMessage:"Configure working hours for each day of the week. Non-working hours will be grayed out in day and week views.",days:be,...o},c=Et(),m=(l,g)=>{n||s({...t,[l]:g})};return e.jsxs("div",{className:u.cn("flex flex-col gap-3",r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Y,{className:"text-sm font-semibold",children:a.title}),n?e.jsx(h.TooltipProvider,{delayDuration:100,children:e.jsxs(h.Tooltip,{children:[e.jsx(h.TooltipTrigger,{children:e.jsx(Tt,{className:"size-3 text-muted-foreground"})}),e.jsx(h.TooltipContent,{children:e.jsx("p",{children:a.lockedMessage})})]})}):e.jsx(h.TooltipProvider,{delayDuration:100,children:e.jsxs(h.Tooltip,{children:[e.jsx(h.TooltipTrigger,{children:e.jsx(Mt,{className:"size-3 text-muted-foreground"})}),e.jsx(h.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:a.infoMessage})})]})})]}),e.jsx("div",{className:"flex flex-col gap-2",children:zt.map(l=>e.jsx(Lt,{dayLabel:a.days?.[l]??be[l],config:t[l],onChange:g=>m(l,g),disabled:n,hourOptions:c},l))})]})}const Ht={sunday:{enabled:!1,from:8,to:18},monday:{enabled:!0,from:8,to:18},tuesday:{enabled:!0,from:8,to:18},wednesday:{enabled:!0,from:8,to:18},thursday:{enabled:!0,from:8,to:18},friday:{enabled:!0,from:8,to:18},saturday:{enabled:!1,from:8,to:18}};function Wt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}function $t({users:t,value:s,onChange:n,allLabel:r="All users",className:o,label:a}){const c=m=>{n(m.target.value)};return e.jsxs("div",{className:u.cn("flex flex-col gap-1",o),children:[a&&e.jsx(Y,{className:"text-xs text-muted-foreground",children:a}),e.jsxs("div",{className:"relative",children:[e.jsx(Wt,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),e.jsxs(G,{value:s,onChange:c,className:"h-9 w-full min-w-[120px] pl-8 pr-8 text-sm",children:[e.jsx("option",{value:"all",children:r}),t.map(m=>e.jsx("option",{value:m.id,children:m.name},m.id))]})]})]})}function Pt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"}),e.jsx("circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor"})]})}function Ft({scheduleTypes:t,value:s,onChange:n,allLabel:r="All types",className:o,label:a}){const c=l=>{n(l.target.value)},m=t.find(l=>String(l.id)===s);return e.jsxs("div",{className:u.cn("flex flex-col gap-1",o),children:[a&&e.jsx(Y,{className:"text-xs text-muted-foreground",children:a}),e.jsxs("div",{className:"relative",children:[m?e.jsx("span",{className:"pointer-events-none absolute left-2.5 top-1/2 size-3 -translate-y-1/2 rounded-full",style:{backgroundColor:m.color}}):e.jsx(Pt,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),e.jsxs(G,{value:s,onChange:c,className:"h-9 w-full min-w-[140px] pl-8 pr-8 text-sm",children:[e.jsx("option",{value:"all",children:r}),t.map(l=>e.jsx("option",{value:String(l.id),children:l.label},l.id))]})]})]})}function de({className:t}){return e.jsx("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}function Bt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}function At({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function xe({checked:t,onCheckedChange:s,className:n,children:r}){return e.jsx("button",{type:"button",role:"checkbox","aria-checked":t,onClick:()=>s(!t),className:n,children:r})}function Ot({src:t,alt:s,fallback:n,className:r}){const[o,a]=b.useState(!1);return!t||o?e.jsx("div",{className:u.cn("flex items-center justify-center bg-zinc-200 text-zinc-600 font-medium text-sm",r),children:n||"?"}):e.jsx("img",{src:t,alt:s||"",className:u.cn("object-cover",r),onError:()=>a(!0)})}function ye({value:t,onChange:s,placeholder:n,className:r}){return e.jsxs("div",{className:u.cn("relative",r),children:[e.jsx(Bt,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx("input",{type:"text",value:t,onChange:o=>s(o.target.value),placeholder:n,className:"h-9 w-full rounded-lg border border-border bg-white pl-9 pr-3 text-sm placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary"})]})}function Ne(t,s,n,r=.3){if(!s.trim())return t;const o=s.toLowerCase();return t.filter(a=>n(a).some(m=>m?m.toLowerCase().includes(o):!1))}const _t={title:"Filters",subtitle:"Filter calendar events",scheduleTypes:"Event Types",participants:"Participants",clearAll:"Clear all",selectAll:"Select all",unselectAll:"Unselect all",searchScheduleTypes:"Search event types...",searchParticipants:"Search participants...",noScheduleTypes:"No event types found",noParticipants:"No participants found"};function Rt({scheduleTypes:t,users:s,selectedScheduleTypeIds:n,onScheduleTypeChange:r,selectedUserIds:o,onUserChange:a,onClearAll:c,className:m,scheduleTypesLoading:l=!1,usersLoading:g=!1,labels:j,getScheduleTypeName:k}){const w={..._t,...j},[y,C]=b.useState(""),[D,M]=b.useState(""),v=b.useMemo(()=>y.trim()?Ne(t,y,d=>[d.name,k?.(d)||d.name]):t,[t,y,k]),T=b.useMemo(()=>D.trim()?Ne(s,D,d=>[d.name,d.email||""]):s,[s,D]),I=v.length>0&&v.every(d=>n.includes(d.id)),W=T.length>0&&T.every(d=>o.includes(d.id)),B=n.length+o.length,A=(d,N)=>{const i=N?[...n,d]:n.filter(x=>x!==d);r(i)},O=()=>{if(I){const d=new Set(v.map(N=>N.id));r(n.filter(N=>!d.has(N)))}else{const d=new Set([...n,...v.map(N=>N.id)]);r(Array.from(d))}},F=(d,N)=>{const i=N?[...o,d]:o.filter(x=>x!==d);a(i)},_=()=>{if(W){const d=new Set(T.map(N=>N.id));a(o.filter(N=>!d.has(N)))}else{const d=new Set([...o,...T.map(N=>N.id)]);a(Array.from(d))}},R=()=>{r([]),a([]),c?.()},f=d=>k?k(d):d.name,H=d=>d.colorHex||d.color||"#069AD7";return e.jsxs("div",{className:u.cn("flex min-w-72 max-w-72 flex-col rounded-lg border bg-white shadow-sm",m),children:[e.jsxs("header",{className:"flex items-start justify-between gap-2 px-4 pb-2 pt-4",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("h3",{className:"text-base font-semibold text-foreground",children:w.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:w.subtitle})]}),B>0&&e.jsxs("button",{type:"button",onClick:R,className:"flex h-auto items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-destructive transition-colors hover:bg-destructive/10",children:[e.jsx(At,{className:"h-3.5 w-3.5"}),w.clearAll]})]}),e.jsx("div",{className:"h-px w-full bg-border/60"}),e.jsxs("section",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[e.jsx("h4",{className:"text-sm font-medium text-foreground",children:w.scheduleTypes}),e.jsx("button",{type:"button",onClick:O,className:"text-xs font-medium text-primary transition-colors hover:text-primary/80",children:I?w.unselectAll:w.selectAll})]}),t.length>6&&e.jsx("div",{className:"px-4 pb-3",children:e.jsx(ye,{value:y,onChange:C,placeholder:w.searchScheduleTypes})}),e.jsxs("div",{className:"flex max-h-[220px] flex-col gap-2 overflow-y-auto px-4 pb-2 scrollbar-thin",children:[l?Array.from({length:4}).map((d,N)=>e.jsxs("div",{className:"flex animate-pulse items-center gap-2 rounded-md border border-border/60 bg-muted/40 p-2",children:[e.jsx("div",{className:"h-5 w-5 rounded bg-muted-foreground/20"}),e.jsx("div",{className:"h-3 w-24 rounded bg-muted-foreground/20"})]},`skeleton-${N}`)):v.map(d=>{const N=n.includes(d.id),i=H(d);return e.jsxs(xe,{checked:N,onCheckedChange:x=>A(d.id,x),className:u.cn("relative flex w-full cursor-pointer items-center justify-between gap-3 rounded-md border border-border bg-white px-3 py-2 transition-colors hover:border-primary/50",N&&"border-primary bg-primary/5"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:u.cn("flex h-4 w-4 items-center justify-center rounded border border-border text-xs transition-colors",N&&"border-primary bg-primary text-primary-foreground"),children:N&&e.jsx(de,{className:"h-3 w-3"})}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:f(d)})]}),e.jsx("div",{className:"h-4 w-4 rounded-full border",style:{backgroundColor:i,borderColor:i}})]},d.id)}),!l&&v.length===0&&e.jsx("p",{className:"px-2 py-1 text-xs text-muted-foreground",children:w.noScheduleTypes})]})]}),e.jsx("div",{className:"h-px w-full bg-border/60"}),e.jsxs("section",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[e.jsx("h4",{className:"text-sm font-medium text-foreground",children:w.participants}),e.jsx(xe,{checked:W,onCheckedChange:()=>_(),className:u.cn("flex h-5 w-5 items-center justify-center rounded border border-border bg-white transition-colors hover:border-primary/50",W&&"border-primary bg-primary text-primary-foreground"),children:W&&e.jsx(de,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"px-4 pb-3",children:e.jsx(ye,{value:D,onChange:M,placeholder:w.searchParticipants})}),e.jsxs("div",{className:"flex max-h-[400px] flex-col gap-2 overflow-y-auto px-4 pb-4 scrollbar-thin",children:[g?Array.from({length:4}).map((d,N)=>e.jsxs("div",{className:"flex animate-pulse items-center gap-3 rounded-md border border-border/60 bg-muted/40 p-3",children:[e.jsx("div",{className:"h-5 w-5 rounded bg-muted-foreground/20"}),e.jsx("div",{className:"h-10 w-10 rounded-full bg-muted-foreground/20"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-3 w-24 rounded bg-muted-foreground/20"}),e.jsx("div",{className:"h-2 w-32 rounded bg-muted-foreground/10"})]})]},`p-skeleton-${N}`)):T.map(d=>{const N=o.includes(d.id);return e.jsxs(xe,{checked:N,onCheckedChange:i=>F(d.id,i),className:u.cn("relative flex w-full cursor-pointer items-start gap-2 rounded-lg border border-border bg-white p-2 transition-colors hover:border-primary/50",N&&"border-primary bg-zinc-50"),children:[e.jsx("span",{className:u.cn("flex h-4 w-4 flex-shrink-0 items-center justify-center rounded border border-border transition-colors",N&&"border-primary bg-primary text-primary-foreground"),children:N&&e.jsx(de,{className:"h-2.5 w-2.5"})}),e.jsxs("div",{className:"flex flex-1 items-start gap-2",children:[e.jsx(Ot,{src:d.avatar??null,alt:d.name,fallback:d.name?.[0]?.toUpperCase()??"?",className:"h-10 w-10 rounded-lg"}),e.jsxs("div",{className:"flex max-w-[140px] flex-col gap-0.5 overflow-hidden",children:[e.jsx("span",{className:"line-clamp-1 text-sm font-medium text-foreground",children:d.name}),e.jsx("span",{className:"truncate text-[11px] text-muted-foreground",title:d.email,children:d.email})]})]})]},d.id)}),!g&&T.length===0&&e.jsx("p",{className:"px-4 text-xs text-muted-foreground",children:w.noParticipants})]})]})]})}function Vt({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5"}),e.jsx("path",{d:"M16 2v4"}),e.jsx("path",{d:"M8 2v4"}),e.jsx("path",{d:"M3 10h5"}),e.jsx("path",{d:"M17.5 17.5 16 16.25V14"}),e.jsx("circle",{cx:"16",cy:"16",r:"6"})]})}function Te({className:t}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}function Ut(t){const s=new Date;return s.setDate(s.getDate()+1),t.getFullYear()===s.getFullYear()&&t.getMonth()===s.getMonth()&&t.getDate()===s.getDate()}function ke(t){const s=t.getHours(),n=t.getMinutes(),r=s>=12?"PM":"AM";return`${s%12||12}:${n.toString().padStart(2,"0")} ${r}`}function Yt(t){return new Intl.DateTimeFormat("en-US",{weekday:"long",month:"short",day:"numeric"}).format(t)}function Gt(t){const s=ke(t.startDate),n=ke(t.endDate);return`${s} - ${n}`}function Kt(t){return L.isToday(t)?"Today":Ut(t)?"Tomorrow":Yt(t)}function Jt(t,s){const n=new Map;for(const r of t){const o=L.formatDateISO(r.startDate),a=n.get(o)??[];a.push(r),n.set(o,a)}return Array.from(n.entries()).map(([r,o])=>{const a=[...o].sort((m,l)=>m.startDate.getTime()-l.startDate.getTime()),c=s>0?a.slice(0,s):a;return{date:new Date(r),dateKey:r,events:c,hasMore:s>0&&a.length>s}}).sort((r,o)=>r.date.getTime()-o.date.getTime())}function qt({event:t,onClick:s,compact:n}){return e.jsxs("button",{type:"button",onClick:()=>s?.(t),className:u.cn("w-full text-left rounded-lg transition-colors","hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","flex items-start gap-3",n?"p-2":"p-3"),children:[e.jsx("div",{className:u.cn("shrink-0 rounded-full mt-1",n?"size-2":"size-2.5"),style:{backgroundColor:t.color??"#3b82f6"}}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:u.cn("font-medium truncate",n?"text-xs":"text-sm"),children:t.title}),e.jsx("p",{className:u.cn("text-muted-foreground truncate",n?"text-[10px]":"text-xs"),children:Gt(t)})]}),s&&e.jsx(Te,{className:u.cn("shrink-0 text-muted-foreground/50",n?"size-3":"size-4")})]})}function Xt({group:t,onEventClick:s,onViewMore:n,compact:r}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:u.cn("flex items-center justify-between px-2",r?"py-1":"py-1.5"),children:[e.jsx("h3",{className:u.cn("font-semibold",r?"text-xs":"text-sm",L.isToday(t.date)&&"text-primary"),children:Kt(t.date)}),t.hasMore&&n&&e.jsx("button",{type:"button",onClick:()=>n(t.date),className:u.cn("text-primary hover:underline",r?"text-[10px]":"text-xs"),children:"+more"})]}),e.jsx("div",{className:"space-y-0.5",children:t.events.map(o=>e.jsx(qt,{event:o,onClick:s,compact:r},o.id))})]})}function Qt({events:t,daysAhead:s=7,maxEventsPerDay:n=3,onEventClick:r,onViewAll:o,className:a,emptyState:c,title:m="Upcoming",showHeader:l=!0,compact:g=!1}){const j=Z.useOptionalCalendarContext(),k=j?.filteredEvents,w=j?.currentDate??new Date,y=t??k??[],C=b.useMemo(()=>{const v=L.startOfDay(w),T=new Date(v);return T.setDate(T.getDate()+s),y.filter(I=>I.endDate>=v&&I.startDate<T)},[y,s,w]),D=b.useMemo(()=>Jt(C,n),[C,n]),M=C.length;return D.length===0?e.jsxs("div",{className:u.cn("rounded-lg border bg-card",a),children:[l&&e.jsx("div",{className:u.cn("border-b px-4 flex items-center justify-between",g?"py-2":"py-3"),children:e.jsx("h2",{className:u.cn("font-semibold",g?"text-sm":"text-base"),children:m})}),e.jsx("div",{className:u.cn("flex flex-col items-center justify-center text-center",g?"py-6 px-4":"py-10 px-6"),children:c??e.jsxs(e.Fragment,{children:[e.jsx(Vt,{className:u.cn("text-muted-foreground/50 mb-2",g?"size-8":"size-10")}),e.jsx("p",{className:u.cn("text-muted-foreground",g?"text-xs":"text-sm"),children:"No upcoming events"})]})})]}):e.jsxs("div",{className:u.cn("rounded-lg border bg-card overflow-hidden",a),children:[l&&e.jsxs("div",{className:u.cn("border-b px-4 flex items-center justify-between",g?"py-2":"py-3"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:u.cn("font-semibold",g?"text-sm":"text-base"),children:m}),e.jsx("span",{className:u.cn("text-muted-foreground bg-muted rounded-full px-2",g?"text-[10px] py-0":"text-xs py-0.5"),children:M})]}),o&&e.jsxs("button",{type:"button",onClick:()=>o(),className:u.cn("text-primary hover:underline flex items-center gap-0.5",g?"text-xs":"text-sm"),children:["View all",e.jsx(Te,{className:"size-3"})]})]}),e.jsx("div",{className:u.cn("divide-y overflow-auto",g?"p-2 max-h-[280px]":"p-3 max-h-[400px]"),children:D.map(v=>e.jsx(Xt,{group:v,onEventClick:r,onViewMore:o?T=>o(T):void 0,compact:g},v.dateKey))})]})}function Zt({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M8 2v4"}),e.jsx("path",{d:"M16 2v4"}),e.jsx("rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}),e.jsx("path",{d:"M3 10h18"}),e.jsx("path",{d:"M8 14h.01"}),e.jsx("path",{d:"M12 14h.01"}),e.jsx("path",{d:"M16 14h.01"}),e.jsx("path",{d:"M8 18h.01"}),e.jsx("path",{d:"M12 18h.01"}),e.jsx("path",{d:"M16 18h.01"})]})}function es({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5"}),e.jsx("path",{d:"M16 2v4"}),e.jsx("path",{d:"M8 2v4"}),e.jsx("path",{d:"M3 10h5"}),e.jsx("path",{d:"M17.5 17.5 16 16.3V14"}),e.jsx("circle",{cx:"16",cy:"16",r:"6"})]})}function ts({className:t}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}function ss({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M15 3h6v6"}),e.jsx("path",{d:"M10 14 21 3"}),e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]})}function ns(t){const s=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${s}-${n}-${r}`}function Ce(t){const s=t.getHours(),n=t.getMinutes(),r=s>=12?"PM":"AM",o=s%12||12,a=String(n).padStart(2,"0");return`${o}:${a} ${r}`}function rs(t){const s=Ce(t.startDate),n=Ce(t.endDate);return`${s} - ${n}`}function os(t){const s=L.addDays(new Date,1);return t.getFullYear()===s.getFullYear()&&t.getMonth()===s.getMonth()&&t.getDate()===s.getDate()}function as(t){if(L.isToday(t))return"Today";if(os(t))return"Tomorrow";const s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],r=s[t.getDay()],o=n[t.getMonth()],a=t.getDate();return`${r}, ${o} ${a}`}function is(t,s){const n=new Map;for(const r of t){const o=ns(r.startDate),a=n.get(o)??[];a.push(r),n.set(o,a)}return Array.from(n.entries()).map(([r,o])=>{const a=[...o].sort((m,l)=>m.startDate.getTime()-l.startDate.getTime()),c=s>0?a.slice(0,s):a;return{date:new Date(r),dateKey:r,events:c,hasMore:s>0&&a.length>s}}).sort((r,o)=>r.date.getTime()-o.date.getTime())}function ls(t){const s=L.startOfDay(new Date),n=L.endOfDay(new Date);return t.filter(r=>r.startDate>=s&&r.startDate<=n).length}function ue({className:t}){return e.jsx("div",{className:u.cn("animate-pulse rounded-md bg-muted",t)})}function cs({event:t,onClick:s}){return e.jsxs("button",{type:"button",onClick:()=>s?.(t),className:u.cn("w-full text-left rounded-lg transition-colors","hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","flex items-start gap-3 p-2"),children:[e.jsx("div",{className:"shrink-0 rounded-full mt-1.5 size-2",style:{backgroundColor:t.color??"#3b82f6"}}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:t.title}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:rs(t)})]}),s&&e.jsx(ts,{className:"shrink-0 size-4 text-muted-foreground/50 mt-1"})]})}function ds({group:t,onEventClick:s}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5",children:[e.jsx("h3",{className:u.cn("text-xs font-semibold",L.isToday(t.date)&&"text-primary"),children:as(t.date)}),t.hasMore&&e.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["+",t.events.length," more"]})]}),e.jsx("div",{className:"space-y-0.5",children:t.events.map(n=>e.jsx(cs,{event:n,onClick:s},n.id))})]})}function xs({events:t,isLoading:s=!1,className:n,daysAhead:r=7,maxEventsPerDay:o=3,onEventClick:a,onNavigateToAgenda:c}){const[m,l]=b.useState(!1),g=b.useMemo(()=>{const C=L.startOfDay(new Date),D=L.addDays(C,r);return t.filter(M=>M.endDate>=C&&M.startDate<D)},[t,r]),j=b.useMemo(()=>is(g,o),[g,o]),k=b.useMemo(()=>ls(t),[t]),w=C=>{l(!1),a?.(C)},y=()=>{l(!1),c?.()};return e.jsxs(h.Popover,{open:m,onOpenChange:l,children:[e.jsxs(h.PopoverTrigger,{className:u.cn("relative rounded-xl hover:text-zinc-700 hover:!bg-zinc-300 !bg-zinc-200 text-zinc-600 shadow-none !px-2.5 p-2 max-h-10",n),children:[e.jsx(Zt,{className:"h-4 w-4"}),k>0&&e.jsx(h.Badge,{variant:"destructive",className:"absolute -right-4 -top-4 m-3 flex h-5 w-5 items-center justify-center rounded-full bg-primary p-0 text-[10px] font-medium hover:bg-primary",children:k>99?"99+":k})]}),e.jsxs(h.PopoverContent,{className:"w-80 rounded-xl p-0",align:"end",side:"bottom",sideOffset:8,children:[e.jsxs("div",{className:"flex items-center justify-between border-b p-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Upcoming"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:k>0?`${k} event${k>1?"s":""} today`:"No events today"})]}),c&&e.jsxs("button",{type:"button",onClick:y,className:"text-xs text-primary hover:underline flex items-center gap-1",children:["View all",e.jsx(ss,{className:"size-3"})]})]}),e.jsx("div",{className:"max-h-80 overflow-y-auto p-2",children:s?e.jsx("div",{className:"space-y-2 p-2",children:Array.from({length:3}).map((C,D)=>e.jsxs("div",{className:"flex space-x-3",children:[e.jsx(ue,{className:"h-2 w-2 rounded-full mt-2"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(ue,{className:"h-4 w-full"}),e.jsx(ue,{className:"h-3 w-3/4"})]})]},D))}):j.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(es,{className:"mb-2 h-8 w-8 text-muted-foreground/50"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No upcoming events"}),e.jsxs("p",{className:"text-xs text-muted-foreground/70",children:["Your schedule is clear for the next ",r," days"]})]}):e.jsx("div",{className:"space-y-3 divide-y",children:j.map(C=>e.jsx(ds,{group:C,onEventClick:w},C.dateKey))})})]})]})}exports.AgendaDropdown=xs;exports.AgendaWidget=Qt;exports.BadgeVariantSetting=Dt;exports.Calendar=ze;exports.CalendarFilterSidebar=Rt;exports.DEFAULT_WEEK_WORKING_HOURS=Ht;exports.EventPopover=ht;exports.InnoCalendar=Xe;exports.ScheduleTypeFilter=Ft;exports.SlotDurationSetting=jt;exports.TimelineView=ae;exports.UserFilter=$t;exports.VisibleHoursSetting=yt;exports.WorkingHoursSetting=It;exports.YearView=De;
|
|
2
|
+
//# sourceMappingURL=agenda-dropdown-CxEeszRC.cjs.map
|