@ilamy/calendar 2.0.0 → 2.0.1
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/README.md +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +1 -1
- package/dist/shared/chunk-328e2ygt.js +2 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.js +1 -1
- package/package.json +1 -1
- package/dist/shared/chunk-6vnwf8sr.js +0 -2
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
A powerful, full-featured yet **lightweight and highly pluggable** React calendar component library built with **TypeScript**, **Tailwind CSS 4**, and **shadcn/ui**. The core is small — ~40 KB minified (≈13 KB gzipped) — with opt-in plugins for recurring events, agenda views, and more, so you only ship what you use. Built for high-performance scheduling with RFC 5545 recurring events, resource management, and drag-and-drop interactions.
|
|
8
8
|
|
|
9
9
|
<div align="center">
|
|
10
|
-
<img width="
|
|
10
|
+
<img width="1159" height="698" alt="Screenshot 2026-07-12 at 2 44 36 PM" src="https://github.com/user-attachments/assets/316c6ad4-2965-4dc4-b779-88b0ac916669" />
|
|
11
11
|
<p align="center"><i>Elegant month view with seamless event transitions</i></p>
|
|
12
12
|
</div>
|
|
13
13
|
|
package/dist/index.d.ts
CHANGED
|
@@ -716,6 +716,13 @@ interface IlamyCalendarProps {
|
|
|
716
716
|
*/
|
|
717
717
|
renderEventForm?: (props: EventFormProps) => React3.ReactNode;
|
|
718
718
|
/**
|
|
719
|
+
* Called when the "+N more" overflow indicator in a month/grid cell is
|
|
720
|
+
* clicked, receiving the cell's day and its full list of events.
|
|
721
|
+
* If provided, it overrides the built-in "all events" dialog, letting you
|
|
722
|
+
* render your own popover/dialog. When omitted, the default dialog opens.
|
|
723
|
+
*/
|
|
724
|
+
onMoreEventsClick?: (day: Dayjs3, events: CalendarEvent[]) => void;
|
|
725
|
+
/**
|
|
719
726
|
* Time format for displaying times in the calendar.
|
|
720
727
|
* - "12-hour": Times displayed as "1:00 PM" (default)
|
|
721
728
|
* - "24-hour": Times displayed as "13:00"
|
|
@@ -896,7 +903,8 @@ interface IlamyCalendarApi {
|
|
|
896
903
|
readonly orientation: "horizontal" | "vertical";
|
|
897
904
|
readonly setCurrentDate: (date: Dayjs3) => void;
|
|
898
905
|
readonly selectDate: (date: Dayjs3) => void;
|
|
899
|
-
|
|
906
|
+
/** Switch view; pass `date` to move there atomically in the same update. */
|
|
907
|
+
readonly setView: (view: CalendarView, date?: Dayjs3) => void;
|
|
900
908
|
readonly nextPeriod: () => void;
|
|
901
909
|
readonly prevPeriod: () => void;
|
|
902
910
|
readonly today: () => void;
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{A as v2,B as w2,C as H2,D as pP,E as c2,F as d2,G as I4,H as e2,a as _,b as G,c as O4,d as q,e as a2,f as P2,g as p2,h as $2,i as rP,j as f2,k as z2,l as d,m as b0,n as yP,o as N0,p as hP,q as k,r as nP,s as t2,t as s2,u as T0,v as x2,w as lP,x as xP,y as g2,z as E2}from"./shared/chunk-6vnwf8sr.js";import"./shared/chunk-jfadfww5.js";var NP="event-form",KP="event-mutation-scope",LP=({event:P,onChange:p})=>{return G((f)=>f.renderSlot)(NP,{event:P,onChange:p})},F0=({dialog:P,onResolve:p,onCancel:$})=>{let f=G((Y)=>Y.getEventManager);if(!(P.isOpen&&P.event))return null;let z=f(P.event),b={event:P.event,operation:P.operation,resolve:p,cancel:$};return z?.renderSlot?.(KP,b)};import{useEffect as M4,useMemo as F4}from"react";import{DndContext as T5,MouseSensor as S5,pointerWithin as g5,TouchSensor as D5,useSensor as FP,useSensors as E5}from"@dnd-kit/core";import{useRef as AP}from"react";import{useCallback as A0,useEffect as B5,useRef as O5,useState as I5}from"react";var h0={isOpen:!1,operation:"edit",event:null};function V0(P){let{applyScopedEdit:p,applyScopedDelete:$}=G((Q)=>({applyScopedEdit:Q.applyScopedEdit,applyScopedDelete:Q.applyScopedDelete})),[f,z]=I5(h0),b=O5(f);B5(()=>{b.current=f},[f]);let Y=A0((Q,X)=>{z({isOpen:!0,operation:"edit",event:Q,updates:X})},[]),Z=A0((Q)=>{z({isOpen:!0,operation:"delete",event:Q})},[]),J=A0(()=>z(h0),[]),U=A0((Q)=>{let X=b.current;if(!X.event)return;if(X.operation==="edit")p(X.event,X.updates??{},Q);else $(X.event,Q);z(h0),P?.()},[p,$,P]);return{dialogState:f,openEditDialog:Y,openDeleteDialog:Z,closeDialog:J,handleConfirm:U}}var _P=(P,p)=>{let{active:$,over:f}=P;if(!$||!f||!p)return null;let z=f.data.current||{},b=z.type==="time-cell",{resourceId:Y,allDay:Z}=z,J;if(b){let{date:N,hour:M=0,minute:F=0}=z;J=_(N).hour(M).minute(F)}else{let{date:N}=z;J=_(N)}let U=p.end.diff(p.start,"second"),Q=J.add(U,"second");if(Q.isSame(Q.startOf("day")))Q=Q.subtract(1,"day").endOf("day");let X={start:J,end:Q,resourceId:Y,allDay:b?!1:Z??p.allDay};return{activeEvent:p,updates:X}};import{DragOverlay as R5}from"@dnd-kit/core";import{snapCenterToCursor as H5}from"@dnd-kit/modifiers";import{useImperativeHandle as k5,useState as m5}from"react";import{jsx as GP}from"react/jsx-runtime";var MP=({ref:P})=>{let[p,$]=m5(null);return k5(P,()=>({setActiveEvent:$})),GP(R5,{modifiers:[H5],children:p&&GP("div",{className:q("cursor-grab truncate rounded bg-amber-200 p-2 text-[10px] shadow-lg sm:text-xs w-20",p.backgroundColor||"bg-blue-500",p.color||"text-white"),children:p?.title})})};import{jsx as VP,jsxs as WP,Fragment as w5}from"react/jsx-runtime";function BP({children:P}){let p=AP(null),$=AP(null),{updateEvent:f,getEventManager:z,disableDragAndDrop:b}=G((A)=>({updateEvent:A.updateEvent,getEventManager:A.getEventManager,disableDragAndDrop:A.disableDragAndDrop})),{dialogState:Y,openEditDialog:Z,closeDialog:J,handleConfirm:U}=V0(),Q=FP(S5,{activationConstraint:{distance:2}}),X=FP(D5,{activationConstraint:{delay:100,tolerance:5}}),N=E5(Q,X),M=(A,V)=>{let m=!V||Object.keys(V).length===0;if(!A?.id||m)return;if(z(A)?.applyEdit)Z(A,V);else f(A.id,V)},F=(A)=>{let{active:V}=A;if(V.data.current?.type==="calendar-event")$.current?.setActiveEvent(V.data.current.event),p.current=V.data.current.event},W=(A)=>{let V=_P(A,p.current);if(V){let{activeEvent:m,updates:B}=V;M(m,B)}p.current=null,$.current?.setActiveEvent(null)},K=(A)=>{p.current=null};if(b)return P;return WP(w5,{children:[WP(T5,{collisionDetection:g5,onDragCancel:K,onDragEnd:W,onDragStart:F,sensors:N,children:[P,VP(MP,{ref:$})]}),VP(F0,{dialog:Y,onCancel:J,onResolve:U})]})}import{Slot as C5}from"@radix-ui/react-slot";import{cva as v5}from"class-variance-authority";import{jsx as h5}from"react/jsx-runtime";var y5=v5("inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function R({className:P,variant:p,size:$,asChild:f=!1,...z}){return h5(f?C5:"button",{className:q(y5({variant:p,size:$,className:P})),"data-slot":"button",...z})}import*as W0 from"@radix-ui/react-checkbox";import{CheckIcon as j5}from"lucide-react";import{jsx as j0}from"react/jsx-runtime";function OP({className:P,...p}){return j0(W0.Root,{className:q("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",P),"data-slot":"checkbox",...p,children:j0(W0.Indicator,{className:"flex items-center justify-center text-current transition-none","data-slot":"checkbox-indicator",children:j0(j5,{className:"size-3.5"})})})}import{ChevronDownIcon as i5}from"lucide-react";import{useEffect as u5,useState as x5}from"react";import{jsx as o5}from"react/jsx-runtime";function P0({className:P,type:p,...$}){return o5("input",{className:q("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",P),"data-slot":"input",type:p,...$})}import*as y from"@radix-ui/react-popover";import{jsx as B0}from"react/jsx-runtime";function o({...P}){return B0(y.Root,{"data-slot":"popover",...P})}function i({...P}){return B0(y.Trigger,{"data-slot":"popover-trigger",...P})}function u({className:P,align:p="center",sideOffset:$=4,...f}){return B0(y.Portal,{children:B0(y.Content,{align:p,className:q("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",P),"data-slot":"popover-content",sideOffset:$,...f})})}import{jsx as x,jsxs as q0}from"react/jsx-runtime";var IP=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,o0=(P)=>Boolean(P&&IP.test(P)),c5=(P)=>{let p=P.match(/bg-([a-z]+)-\d+/)?.at(1);if(!p)return"Custom";return p.charAt(0).toUpperCase()+p.slice(1)};function RP({value:P,onChange:p,swatches:$=[],className:f,"aria-label":z="Select color"}){let[b,Y]=x5(o0(P)?P:"");u5(()=>{Y(o0(P)?P:"")},[P]);let Z=(X)=>{let N=X.target.value;if(Y(N),IP.test(N))p(N)},J=o0(P),U=$.find((X)=>X.value===P),Q;if(U)Q=U.label;else if(J)Q=P;else if(P)Q=c5(P);else Q="Pick a color";return q0(o,{children:[q0(i,{"aria-label":z,className:q("border-input focus-visible:border-ring focus-visible:ring-ring/50 flex h-9 w-full cursor-pointer items-center justify-between gap-2 rounded-md border bg-transparent px-3 text-sm shadow-xs outline-none focus-visible:ring-[3px]",f),"data-slot":"color-picker-trigger",type:"button",children:[q0("span",{className:"flex items-center gap-2",children:[x("span",{className:q("size-5 shrink-0 rounded-full border",!J&&P),style:J?{backgroundColor:P}:void 0}),x("span",{className:q(J&&"font-mono text-xs"),children:Q})]}),x(i5,{className:"size-4 shrink-0 opacity-50"})]}),q0(u,{className:"w-56","data-slot":"color-picker-content",children:[$.length>0&&x("div",{className:"grid grid-cols-7 gap-1.5",children:$.map((X)=>{let N=P===X.value;return x("button",{"aria-label":X.label,"aria-pressed":N,className:q("focus-visible:ring-ring size-6 cursor-pointer rounded-full border outline-none focus-visible:ring-2",X.value,N&&"ring-ring ring-2 ring-offset-1"),onClick:()=>p(X.value),type:"button"},X.value)})}),x("div",{className:"text-muted-foreground mt-3 mb-1.5 text-xs",children:"Custom"}),q0("div",{className:"flex items-center gap-2",children:[x("input",{"aria-label":"Custom color",className:"size-9 shrink-0 cursor-pointer rounded-md border bg-transparent",onChange:(X)=>p(X.target.value),type:"color",value:J?P:"#000000"}),x(P0,{"aria-label":"Hex color",className:"font-mono",onChange:Z,placeholder:"#000000",value:b})]})]})]})}import*as HP from"@radix-ui/react-label";import{jsx as d5}from"react/jsx-runtime";function l({className:P,...p}){return d5(HP.Root,{className:q("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",P),"data-slot":"label",...p})}import*as O from"@radix-ui/react-select";import{CheckIcon as r5,ChevronDownIcon as kP,ChevronUpIcon as n5}from"lucide-react";import{jsx as H,jsxs as i0}from"react/jsx-runtime";function mP({...P}){return H(O.Root,{"data-slot":"select",...P})}function TP({...P}){return H(O.Value,{"data-slot":"select-value",...P})}function SP({className:P,size:p="default",children:$,...f}){return i0(O.Trigger,{className:q("cursor-pointer border-input data-placeholder:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",P),"data-size":p,"data-slot":"select-trigger",...f,children:[$,H(O.Icon,{asChild:!0,children:H(kP,{className:"size-4 opacity-50"})})]})}function gP({className:P,children:p,position:$="popper",align:f="center",...z}){return H(O.Portal,{children:i0(O.Content,{align:f,className:q("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",$==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",P),"data-slot":"select-content",position:$,...z,children:[H(l5,{}),H(O.Viewport,{className:q("p-1",$==="popper"&&"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width) scroll-my-1"),children:p}),H(a5,{})]})})}function DP({className:P,children:p,...$}){return i0(O.Item,{className:q("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",P),"data-slot":"select-item",...$,children:[H("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:H(O.ItemIndicator,{children:H(r5,{className:"size-4"})})}),H(O.ItemText,{children:p})]})}function l5({className:P,...p}){return H(O.ScrollUpButton,{className:q("flex cursor-default items-center justify-center py-1",P),"data-slot":"select-scroll-up-button",...p,children:H(n5,{className:"size-4"})})}function a5({className:P,...p}){return H(O.ScrollDownButton,{className:q("flex cursor-default items-center justify-center py-1",P),"data-slot":"select-scroll-down-button",...p,children:H(kP,{className:"size-4"})})}import{jsx as t5}from"react/jsx-runtime";function EP({className:P,...p}){return t5("textarea",{className:q("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",P),"data-slot":"textarea",...p})}function wP(P){if(P===void 0)return;if(_.isDayjs(P))return P;let p=_(P);return p.isValid()?p:void 0}function CP(P){let p=P.replace("#",""),$=p.length===3?p.split("").map((Z)=>Z+Z).join(""):p;if(!/^[0-9a-fA-F]{6}$/.test($))return"#000000";let f=Number.parseInt($.slice(0,2),16),z=Number.parseInt($.slice(2,4),16),b=Number.parseInt($.slice(4,6),16);return(f*299+z*587+b*114)/1000>=128?"#000000":"#ffffff"}import{useEffect as Kp,useState as w}from"react";import{PopoverClose as bp}from"@radix-ui/react-popover";import{Calendar as Zp}from"lucide-react";import{useEffect as Yp,useRef as Qp,useState as Jp}from"react";import{useState as pp}from"react";import{ChevronLeftIcon as s5,ChevronRightIcon as e5}from"lucide-react";import{jsx as U0,jsxs as Pp}from"react/jsx-runtime";function p0({label:P,onPrev:p,onNext:$,prevLabel:f,nextLabel:z}){return Pp("div",{className:"mb-2 flex items-center justify-between",children:[U0(R,{"aria-label":f,onClick:p,size:"icon",variant:"ghost",children:U0(s5,{className:"size-4"})}),U0("div",{className:"text-sm font-medium select-none",children:P}),U0(R,{"aria-label":z,onClick:$,size:"icon",variant:"ghost",children:U0(e5,{className:"size-4"})})]})}import{jsx as h,jsxs as vP}from"react/jsx-runtime";function $p(P){let p=P.weekHover&&!P.isCurrentWeek;return q("p-0 text-center",P.weekHover&&"first:rounded-l-md last:rounded-r-md",p&&"group-hover/week:bg-accent",P.isCurrentWeek&&"bg-primary")}function fp(P){return q("w-full aspect-square text-sm select-none",!P.isDisabled&&"cursor-pointer",!(P.weekHover||P.isDisabled)&&"hover:bg-accent rounded-md",P.isOutside&&"text-muted-foreground/50",P.isCurrent&&"rounded-md ring-1 ring-inset ring-foreground/40",P.isCurrentWeek&&"text-primary-foreground font-medium",P.isSelected&&"bg-primary text-primary-foreground rounded-md font-medium",P.isDisabled&&"opacity-50 cursor-not-allowed")}function zp({day:P,state:p,onSelect:$}){return h("td",{className:$p(p),"data-disabled":p.isDisabled,"data-outside":p.isOutside,"data-selected":p.isSelected,role:"gridcell",tabIndex:-1,children:h("button",{"aria-disabled":p.isDisabled,"aria-hidden":p.isOutside,className:fp(p),"data-disabled":p.isDisabled,"data-selected":p.isSelected,disabled:p.isDisabled||p.isOutside,onClick:()=>$?.(P.toDate()),tabIndex:p.isOutside?-1:0,type:"button",children:P.format("D")})})}function K0({selected:P,defaultMonth:p,onSelect:$,disabled:f,firstDayOfWeek:z=0,className:b,weekHover:Y=!1,highlightedWeekOf:Z}){let[J,U]=pp(()=>_(p??P??new Date).startOf("month")),Q=hP(J,z),X=P?_(P).format("YYYY-MM-DD"):void 0,N=N0(_(),z).map((K)=>K.format("dd")),M,F;if(Z){let K=N0(Z,z);M=K.at(0),F=K.at(-1)}let W=(K)=>{let A=K.format("YYYY-MM-DD")===X,V=!1;if(M&&F){let m=!K.isBefore(M,"day"),B=!K.isAfter(F,"day");V=m&&B}return{isOutside:!K.isSame(J,"month"),isSelected:A,isDisabled:f?.(K.toDate())??!1,isCurrent:yP(K)&&!A,isCurrentWeek:V,weekHover:Y}};return vP("div",{className:q("bg-background p-3 w-72",b),"data-slot":"calendar",children:[h(p0,{label:J.format("MMMM YYYY"),nextLabel:"Next month",onNext:()=>U((K)=>K.add(1,"month")),onPrev:()=>U((K)=>K.subtract(1,"month")),prevLabel:"Previous month"}),vP("table",{className:"w-full border-collapse",role:"grid",children:[h("thead",{children:h("tr",{children:N.map((K,A)=>h("th",{className:"text-muted-foreground text-xs font-medium select-none py-1",children:K},A))})}),h("tbody",{children:Q.map((K,A)=>h("tr",{className:q(Y&&"group/week"),children:K.map((V)=>h(zp,{day:V,onSelect:$,state:W(V)},V.toISOString()))},A))})]})]})}import{jsx as $0,jsxs as u0}from"react/jsx-runtime";function jP({date:P,closeOnSelect:p,onChange:$,label:f="Pick a date",className:z,disabled:b}){let Y=G((X)=>X.firstDayOfWeek),Z=Qp(null),[J,U]=Jp(P);Yp(()=>{U(P)},[P]);let Q=(X)=>{if(U(X),p)Z.current?.click();$?.(X)};return $0("div",{className:z,children:u0(o,{children:[$0(i,{asChild:!0,children:u0(R,{className:q("data-[empty=true]:text-muted-foreground w-full justify-start text-left font-normal"),"data-empty":!P,variant:"outline",children:[$0(Zp,{}),J?_(J).format("ll"):$0("span",{children:f})]})}),u0(u,{align:"start",className:"w-auto p-0",children:[$0(bp,{ref:Z,style:{display:"none"}}),$0(K0,{defaultMonth:J,disabled:b,firstDayOfWeek:Y,onSelect:Q,selected:J})]})]})})}import{Clock as qp}from"lucide-react";import{useEffect as Up,useRef as iP,useState as x0}from"react";import{useMemo as Xp}from"react";function oP({timeFormat:P="12-hour",minTime:p="00:00",maxTime:$="23:45"}){return{timeOptions:Xp(()=>{let b=[],[Y,Z]=p.split(":").map(Number),[J,U]=$.split(":").map(Number),Q=Y*60+Z,X=J*60+U;for(let N=Q;N<=X;N+=15){let M=Math.floor(N/60),F=N%60,W=`${M.toString().padStart(2,"0")}:${F.toString().padStart(2,"0")}`;b.push(W)}return b},[p,$]),formatTime:(b)=>{let[Y,Z]=b.split(":").map(Number);if(P==="24-hour")return`${Y.toString().padStart(2,"0")}:${Z.toString().padStart(2,"0")}`;let J=Y>=12?"PM":"AM",U=Y;if(Y===0)U=12;else if(Y>12)U=Y-12;return`${U}:${Z.toString().padStart(2,"0")} ${J}`}}}import{jsx as c,jsxs as c0}from"react/jsx-runtime";var Np=(P)=>{P.stopPropagation()};function uP({value:P,onChange:p,minTime:$="00:00",maxTime:f="23:45",timeFormat:z="12-hour",placeholder:b="Select time...",className:Y,disabled:Z=!1,name:J}){let[U,Q]=x0(!1),[X,N]=x0(""),M=iP(null),F=iP(null),[W,K]=x0(0),{timeOptions:A,formatTime:V}=oP({timeFormat:z,minTime:$,maxTime:f}),m=A.filter((S)=>{return V(S).toLowerCase().includes(X.toLowerCase())}),B=(S)=>{p(S),Q(!1),N("")};Up(()=>{if(U){if(F.current)K(F.current.offsetWidth);setTimeout(()=>{M.current?.focus()},0)}},[U]);let Q0=P?V(P):b;return c0(o,{onOpenChange:Q,open:U,children:[c(i,{asChild:!0,children:c0(R,{"aria-controls":"time-picker-listbox","aria-expanded":U,className:q("w-full justify-start",Y),"data-testid":k.timePicker(J),disabled:Z,ref:F,role:"combobox",variant:"outline",children:[c(qp,{className:"mr-2 h-4 w-4"}),Q0]})}),c0(u,{align:"start",className:"p-0",style:{width:W},children:[c("div",{className:"p-2 border-b",children:c(P0,{className:"h-8",onChange:(S)=>N(S.target.value),placeholder:"Search time...",ref:M,value:X})}),c(d,{className:"h-[200px]",onWheel:Np,children:c("div",{className:"p-1",children:m.length===0?c("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"N/A"}):m.map((S)=>{let G0=V(S);return c("button",{className:q("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground",S===P&&"bg-accent text-accent-foreground"),onClick:()=>B(S),type:"button",children:G0},S)})})})]})]})}var cP=(P,p,$)=>{let[f,z]=p.split(":").map(Number),b=_(P).hour(f).minute(z);return $?b.hour(0).minute(0):b},dP=(P,p,$)=>{let[f,z]=p.split(":").map(Number),b=_(P).hour(f).minute(z);return $?b.hour(23).minute(59):b},d0=(P,p)=>{if(!p)return{min:"00:00",max:"23:59"};let $=_(P),{minStart:f,maxEnd:z,hasBusinessHours:b}=xP({allDates:[$],businessHours:p,hideNonBusinessHours:!1});if(!b)return{min:"00:00",max:"23:59"};return{min:`${f.toString().padStart(2,"0")}:00`,max:`${(z-1).toString().padStart(2,"0")}:45`}};import{jsx as I,jsxs as g,Fragment as Fp}from"react/jsx-runtime";var aP="bg-blue-100 text-blue-800",Lp=[{value:aP,label:"Blue"},{value:"bg-green-100 text-green-800",label:"Green"},{value:"bg-purple-100 text-purple-800",label:"Purple"},{value:"bg-red-100 text-red-800",label:"Red"},{value:"bg-yellow-100 text-yellow-800",label:"Yellow"},{value:"bg-pink-100 text-pink-800",label:"Pink"},{value:"bg-indigo-100 text-indigo-800",label:"Indigo"},{value:"bg-amber-100 text-amber-800",label:"Amber"},{value:"bg-emerald-100 text-emerald-800",label:"Emerald"},{value:"bg-sky-100 text-sky-800",label:"Sky"},{value:"bg-violet-100 text-violet-800",label:"Violet"},{value:"bg-rose-100 text-rose-800",label:"Rose"},{value:"bg-teal-100 text-teal-800",label:"Teal"},{value:"bg-orange-100 text-orange-800",label:"Orange"}],tP=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,_p=(P,p)=>{if(P&&tP.test(P))return P;return p??aP},Gp=(P)=>{if(tP.test(P))return{backgroundColor:P,color:CP(P)};return{backgroundColor:void 0,color:P}},Mp=({colorChanged:P,hadInitialColor:p,selectedColor:$,initialBackgroundColor:f,initialColor:z})=>{if(P||!p)return Gp($);return{backgroundColor:f,color:z}},r0=({name:P,label:p,placeholder:$,value:f,required:z=!1,multiline:b=!1,onChange:Y})=>g("div",{className:"grid gap-1 sm:gap-2",children:[I(l,{className:"text-xs sm:text-sm",htmlFor:P,children:p}),b?I(EP,{className:"min-h-16 text-sm",id:P,name:P,onChange:Y,placeholder:$,required:z,value:f}):I(P0,{className:"h-8 text-sm sm:h-9",id:P,name:P,onChange:Y,placeholder:$,required:z,value:f})]}),sP=({selectedEvent:P,onClose:p,onUpdate:$,onDelete:f,onAdd:z})=>{let{dialogState:b,openEditDialog:Y,openDeleteDialog:Z,closeDialog:J,handleConfirm:U}=V0(p),{t:Q,timeFormat:X,getEventManager:N,resources:M}=G((L)=>({t:L.t,timeFormat:L.timeFormat,getEventManager:L.getEventManager,resources:L.resources??[]})),{id:F,resourceId:W,resourceIds:K,start:A=_(),end:V=_().add(1,"hour"),allDay:m=!1,color:B,backgroundColor:Q0,title:S="",description:G0="",location:fP=""}=P??{},zP=M.length>0,bP=W??K?.at(0),ZP=zP&&bP===void 0,[S0,P5]=w(bP),g0=zP?S0:W,M0=nP(g0),YP=Boolean(P&&N(P)),[s,QP]=w(A.toDate()),[e,JP]=w(V.toDate()),[j,p5]=w(m),[D0,$5]=w(_p(Q0,B)),[f5,z5]=w(!1),b5=Boolean(B||Q0),Z5=(L)=>{$5(L),z5(!0)},[E0,XP]=w(A.format("HH:mm")),[w0,C0]=w(V.format("HH:mm")),[v,Y5]=w({title:S,description:G0,location:fP}),[v0,Q5]=w({}),J5={...P,...v0},X5=(L)=>Q5((D)=>({...D,...L})),q5=(L)=>{if(!L)return;if(QP(L),_(L).isAfter(_(e)))JP(L)},U5=(L)=>{if(!L)return;if(JP(L),L&&_(L).isBefore(_(s)))QP(L)},N5=(L)=>{if(XP(L),_(s).isSame(_(e),"day")&&L>w0)C0(L)},K5=(L)=>{if(C0(L),_(s).isSame(_(e),"day")&&L<E0)XP(L)},y0=(L)=>{let{name:D,value:E}=L.target;Y5((J0)=>({...J0,[D]:E}))};Kp(()=>{if(j)C0("23:59")},[j]);let L5=(L)=>{return M.find((E)=>String(E.id)===L)?.id??L},qP=ZP&&S0===void 0,_5=(L)=>{if(L.preventDefault(),qP)return;let D=cP(s,E0,j),E=dP(e,w0,j),J0=Mp({colorChanged:f5,hadInitialColor:b5,selectedColor:D0,initialBackgroundColor:Q0,initialColor:B}),X0={id:F||_().format("YYYYMMDDHHmmss"),title:v.title,start:D,end:E,resourceId:g0,description:v.description,location:v.location,allDay:j,...J0,...v0};if(P?.id&&YP){Y(P,{title:v.title,start:D,end:E,resourceId:g0,description:v.description,location:v.location,allDay:j,color:D0,...v0});return}if(F)$?.(X0);else z?.(X0);p()},G5=()=>{if(!P?.id)return;if(YP){Z(P);return}f?.(P),p()},UP;if(M0)UP=(L)=>!lP(_(L),M0);let M5=d0(s,M0),F5=d0(e,M0),A5=[["startDate",s,q5],["endDate",e,U5]],V5=[["startTime","start-time",E0,N5,M5],["endTime","end-time",w0,K5,F5]],W5=S0?.toString();return g(Fp,{children:[g("form",{className:"flex flex-col flex-1 min-h-0",onSubmit:_5,children:[I(d,{className:"flex-1 min-h-0",children:g("div",{className:"grid gap-3 sm:gap-4 p-1",children:[I(r0,{label:Q("title"),name:"title",onChange:y0,placeholder:Q("eventTitlePlaceholder"),required:!0,value:v.title}),I(r0,{label:Q("description"),multiline:!0,name:"description",onChange:y0,placeholder:Q("eventDescriptionPlaceholder"),value:v.description}),ZP&&g("div",{className:"grid gap-1 sm:gap-2",children:[I(l,{className:"text-xs sm:text-sm",htmlFor:"resource",children:Q("resource")}),g(mP,{onValueChange:(L)=>P5(L5(L)),value:W5,children:[I(SP,{className:"h-8 text-sm sm:h-9","data-testid":"resource-select",id:"resource",children:I(TP,{placeholder:Q("selectResource")})}),I(gP,{children:M.map((L)=>I(DP,{value:String(L.id),children:L.title},String(L.id)))})]})]}),g("div",{className:"flex items-center space-x-2",children:[I(OP,{checked:j,id:"allDay",onCheckedChange:(L)=>p5(L===!0)}),I(l,{className:"text-xs sm:text-sm",htmlFor:"allDay",children:Q("allDay")})]}),I("div",{className:"grid grid-cols-2 gap-2 sm:gap-4",children:A5.map(([L,D,E])=>g("div",{children:[I(l,{className:"text-xs sm:text-sm",children:Q(L)}),I(jP,{className:"mt-1",closeOnSelect:!0,date:D,disabled:UP,onChange:E})]},L))}),!j&&I("div",{className:"grid grid-cols-2 gap-2 sm:gap-4",children:V5.map(([L,D,E,J0,X0])=>g("div",{children:[I(l,{className:"text-xs sm:text-sm",children:Q(L)}),I(uP,{className:"mt-1 h-8 text-sm sm:h-9",maxTime:X0.max,minTime:X0.min,name:D,onChange:J0,placeholder:Q("searchTime"),timeFormat:X,value:E})]},L))}),g("div",{className:"grid gap-1 sm:gap-2",children:[I(l,{className:"text-xs sm:text-sm",children:Q("color")}),I(RP,{"aria-label":Q("color"),onChange:Z5,swatches:Lp,value:D0})]}),I(r0,{label:Q("location"),name:"location",onChange:y0,placeholder:Q("eventLocationPlaceholder"),value:v.location}),I(LP,{event:J5,onChange:X5})]})}),g(rP,{className:"mt-4 shrink-0 flex flex-col-reverse gap-2 sm:flex-row sm:gap-0",children:[F&&I(R,{className:"w-full sm:mr-auto sm:w-auto",onClick:G5,size:"sm",type:"button",variant:"destructive",children:Q("delete")}),g("div",{className:"flex w-full gap-2 sm:w-auto",children:[I(R,{className:"flex-1 sm:flex-none",onClick:p,size:"sm",type:"button",variant:"outline",children:Q("cancel")}),I(R,{className:"flex-1 sm:flex-none",disabled:qP,size:"sm",type:"submit",children:F?Q("update"):Q("create")})]})]})]}),I(F0,{dialog:b,onCancel:J,onResolve:U})]})};import{jsx as O0,jsxs as eP}from"react/jsx-runtime";var b2=()=>{let{t:P,selectedEvent:p,isEventFormOpen:$,closeEventForm:f,addEvent:z,updateEvent:b,deleteEvent:Y,renderEventForm:Z}=G((X)=>({t:X.t,selectedEvent:X.selectedEvent,isEventFormOpen:X.isEventFormOpen,closeEventForm:X.closeEventForm,addEvent:X.addEvent,updateEvent:X.updateEvent,deleteEvent:X.deleteEvent,renderEventForm:X.renderEventForm})),Q={open:$,onClose:f,selectedEvent:p,onAdd:z,onUpdate:(X)=>{b(X.id,X)},onDelete:(X)=>{Y(X.id)}};if(Z)return Z(Q);return O0(P2,{onOpenChange:f,open:$,children:eP(p2,{className:"flex flex-col h-[90vh] w-[90vw] max-w-[500px] p-4 sm:p-6 overflow-hidden gap-0",children:[eP($2,{className:"mb-2 sm:mb-4 shrink-0",children:[O0(f2,{className:"text-base sm:text-lg",children:p?.id?P("editEvent"):P("createEvent")}),O0(z2,{className:"text-xs sm:text-sm",children:p?.id?P("editEventDetails"):P("addNewEvent")})]}),O0(sP,{...Q})]})})};import{ChevronLeft as hp,ChevronRight as jp,Download as op,Plus as ip}from"lucide-react";import{ChevronDown as Ip}from"lucide-react";import{useState as Rp}from"react";function Z2(){let{currentLocale:P,timezone:p}=G((f)=>({currentLocale:f.currentLocale,timezone:f.timezone}));return{formatDateRange:(f,z)=>{let b=new Intl.DateTimeFormat(P,{timeZone:p,month:"short",day:"numeric"});if(f.year()===z.year())return b.formatRange(f.toDate(),z.toDate());return`${b.format(f.toDate())} – ${b.format(z.toDate())}`}}}import{useState as Vp}from"react";import{jsx as Ap}from"react/jsx-runtime";function I0({label:P,isSelected:p,isCurrent:$,onSelect:f}){return Ap("button",{"aria-pressed":p,className:q("hover:bg-accent rounded-md py-2 text-sm font-medium cursor-pointer select-none",$&&"ring-1 ring-inset ring-foreground/40",p&&"bg-primary text-primary-foreground"),onClick:f,type:"button",children:P})}import{jsx as n0,jsxs as Wp}from"react/jsx-runtime";function Y2({selected:P,onSelect:p}){let[$,f]=Vp(()=>P.year()),z=_(),b=Array.from({length:12},(Y,Z)=>({index:Z,label:P.month(Z).format("MMM")}));return Wp("div",{className:"w-72 p-3","data-slot":"month-grid",children:[n0(p0,{label:$,nextLabel:"Next year",onNext:()=>f((Y)=>Y+1),onPrev:()=>f((Y)=>Y-1),prevLabel:"Previous year"}),n0("div",{className:"grid grid-cols-3 gap-1",children:b.map((Y)=>{let Z=$===P.year()&&Y.index===P.month(),J=$===z.year()&&Y.index===z.month()&&!Z;return n0(I0,{isCurrent:J,isSelected:Z,label:Y.label,onSelect:()=>p(P.year($).month(Y.index).date(1))},Y.index)})})]})}import{useState as Bp}from"react";import{jsx as l0,jsxs as Op}from"react/jsx-runtime";var L0=12;function Q2({selected:P,onSelect:p}){let[$,f]=Bp(()=>P.year()-P.year()%L0),z=_(),b=Array.from({length:L0},(Y,Z)=>$+Z);return Op("div",{className:"w-72 p-3","data-slot":"year-grid",children:[l0(p0,{label:`${$} – ${$+L0-1}`,nextLabel:"Next years",onNext:()=>f((Y)=>Y+L0),onPrev:()=>f((Y)=>Y-L0),prevLabel:"Previous years"}),l0("div",{className:"grid grid-cols-3 gap-1",children:b.map((Y)=>{let Z=Y===P.year(),J=Y===z.year()&&!Z;return l0(I0,{isCurrent:J,isSelected:Z,label:Y,onSelect:()=>p(P.year(Y))},Y)})})]})}import{jsx as a,jsxs as J2}from"react/jsx-runtime";var Hp={day:"day",week:"week",month:"month",year:"year"};function kp(P){let p=P?.navigationStep??{amount:1,unit:P?.navigationUnit??"day"};if(p.amount!==1)return"range";return Hp[p.unit]??"range"}function X2({className:P}){let{currentDate:p,currentRange:$,view:f,selectDate:z,firstDayOfWeek:b,getViews:Y}=G((B)=>({currentDate:B.currentDate,currentRange:B.currentRange,view:B.view,selectDate:B.selectDate,firstDayOfWeek:B.firstDayOfWeek,getViews:B.getViews})),{formatDateRange:Z}=Z2(),[J,U]=Rp(!1),Q=N0(p,b),X=Q.at(0)??p,N=Q.at(-1)??p,M=(B)=>{z(B),U(!1)},F=kp(Y().find((B)=>B.name===f)),K={year:p.format("YYYY"),month:p.format("MMM YYYY"),week:Z(X,N),day:p.format("ddd, MMM D, YYYY"),range:Z($.start,$.end)}[F],A=a(K0,{defaultMonth:p.toDate(),firstDayOfWeek:b,onSelect:(B)=>B&&M(_(B)),selected:p.toDate()}),m={year:a(Q2,{onSelect:M,selected:p}),month:a(Y2,{onSelect:M,selected:p}),week:a(K0,{defaultMonth:p.toDate(),firstDayOfWeek:b,highlightedWeekOf:p,onSelect:(B)=>B&&M(_(B)),weekHover:!0}),day:A,range:A}[F];return J2(o,{onOpenChange:U,open:J,children:[a(i,{asChild:!0,children:J2(R,{className:q("font-semibold",P),"data-testid":"calendar-title",variant:"outline",children:[K,a(Ip,{className:"size-4 shrink-0 opacity-50"})]})}),a(u,{align:"start",className:"w-auto p-0",children:m})]})}var a0=`\r
|
|
1
|
+
import{A as v2,B as w2,C as H2,D as pP,E as c2,F as d2,G as I4,H as e2,a as _,b as G,c as O4,d as q,e as a2,f as P2,g as p2,h as $2,i as rP,j as f2,k as z2,l as d,m as b0,n as yP,o as N0,p as hP,q as k,r as nP,s as t2,t as s2,u as T0,v as x2,w as lP,x as xP,y as g2,z as E2}from"./shared/chunk-328e2ygt.js";import"./shared/chunk-jfadfww5.js";var NP="event-form",KP="event-mutation-scope",LP=({event:P,onChange:p})=>{return G((f)=>f.renderSlot)(NP,{event:P,onChange:p})},F0=({dialog:P,onResolve:p,onCancel:$})=>{let f=G((Y)=>Y.getEventManager);if(!(P.isOpen&&P.event))return null;let z=f(P.event),b={event:P.event,operation:P.operation,resolve:p,cancel:$};return z?.renderSlot?.(KP,b)};import{useEffect as M4,useMemo as F4}from"react";import{DndContext as T5,MouseSensor as S5,pointerWithin as g5,TouchSensor as D5,useSensor as FP,useSensors as E5}from"@dnd-kit/core";import{useRef as AP}from"react";import{useCallback as A0,useEffect as B5,useRef as O5,useState as I5}from"react";var h0={isOpen:!1,operation:"edit",event:null};function V0(P){let{applyScopedEdit:p,applyScopedDelete:$}=G((Q)=>({applyScopedEdit:Q.applyScopedEdit,applyScopedDelete:Q.applyScopedDelete})),[f,z]=I5(h0),b=O5(f);B5(()=>{b.current=f},[f]);let Y=A0((Q,X)=>{z({isOpen:!0,operation:"edit",event:Q,updates:X})},[]),Z=A0((Q)=>{z({isOpen:!0,operation:"delete",event:Q})},[]),J=A0(()=>z(h0),[]),U=A0((Q)=>{let X=b.current;if(!X.event)return;if(X.operation==="edit")p(X.event,X.updates??{},Q);else $(X.event,Q);z(h0),P?.()},[p,$,P]);return{dialogState:f,openEditDialog:Y,openDeleteDialog:Z,closeDialog:J,handleConfirm:U}}var _P=(P,p)=>{let{active:$,over:f}=P;if(!$||!f||!p)return null;let z=f.data.current||{},b=z.type==="time-cell",{resourceId:Y,allDay:Z}=z,J;if(b){let{date:N,hour:M=0,minute:F=0}=z;J=_(N).hour(M).minute(F)}else{let{date:N}=z;J=_(N)}let U=p.end.diff(p.start,"second"),Q=J.add(U,"second");if(Q.isSame(Q.startOf("day")))Q=Q.subtract(1,"day").endOf("day");let X={start:J,end:Q,resourceId:Y,allDay:b?!1:Z??p.allDay};return{activeEvent:p,updates:X}};import{DragOverlay as R5}from"@dnd-kit/core";import{snapCenterToCursor as H5}from"@dnd-kit/modifiers";import{useImperativeHandle as k5,useState as m5}from"react";import{jsx as GP}from"react/jsx-runtime";var MP=({ref:P})=>{let[p,$]=m5(null);return k5(P,()=>({setActiveEvent:$})),GP(R5,{modifiers:[H5],children:p&&GP("div",{className:q("cursor-grab truncate rounded bg-amber-200 p-2 text-[10px] shadow-lg sm:text-xs w-20",p.backgroundColor||"bg-blue-500",p.color||"text-white"),children:p?.title})})};import{jsx as VP,jsxs as WP,Fragment as w5}from"react/jsx-runtime";function BP({children:P}){let p=AP(null),$=AP(null),{updateEvent:f,getEventManager:z,disableDragAndDrop:b}=G((A)=>({updateEvent:A.updateEvent,getEventManager:A.getEventManager,disableDragAndDrop:A.disableDragAndDrop})),{dialogState:Y,openEditDialog:Z,closeDialog:J,handleConfirm:U}=V0(),Q=FP(S5,{activationConstraint:{distance:2}}),X=FP(D5,{activationConstraint:{delay:100,tolerance:5}}),N=E5(Q,X),M=(A,V)=>{let m=!V||Object.keys(V).length===0;if(!A?.id||m)return;if(z(A)?.applyEdit)Z(A,V);else f(A.id,V)},F=(A)=>{let{active:V}=A;if(V.data.current?.type==="calendar-event")$.current?.setActiveEvent(V.data.current.event),p.current=V.data.current.event},W=(A)=>{let V=_P(A,p.current);if(V){let{activeEvent:m,updates:B}=V;M(m,B)}p.current=null,$.current?.setActiveEvent(null)},K=(A)=>{p.current=null};if(b)return P;return WP(w5,{children:[WP(T5,{collisionDetection:g5,onDragCancel:K,onDragEnd:W,onDragStart:F,sensors:N,children:[P,VP(MP,{ref:$})]}),VP(F0,{dialog:Y,onCancel:J,onResolve:U})]})}import{Slot as C5}from"@radix-ui/react-slot";import{cva as v5}from"class-variance-authority";import{jsx as h5}from"react/jsx-runtime";var y5=v5("inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function R({className:P,variant:p,size:$,asChild:f=!1,...z}){return h5(f?C5:"button",{className:q(y5({variant:p,size:$,className:P})),"data-slot":"button",...z})}import*as W0 from"@radix-ui/react-checkbox";import{CheckIcon as j5}from"lucide-react";import{jsx as j0}from"react/jsx-runtime";function OP({className:P,...p}){return j0(W0.Root,{className:q("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",P),"data-slot":"checkbox",...p,children:j0(W0.Indicator,{className:"flex items-center justify-center text-current transition-none","data-slot":"checkbox-indicator",children:j0(j5,{className:"size-3.5"})})})}import{ChevronDownIcon as i5}from"lucide-react";import{useEffect as u5,useState as x5}from"react";import{jsx as o5}from"react/jsx-runtime";function P0({className:P,type:p,...$}){return o5("input",{className:q("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",P),"data-slot":"input",type:p,...$})}import*as y from"@radix-ui/react-popover";import{jsx as B0}from"react/jsx-runtime";function o({...P}){return B0(y.Root,{"data-slot":"popover",...P})}function i({...P}){return B0(y.Trigger,{"data-slot":"popover-trigger",...P})}function u({className:P,align:p="center",sideOffset:$=4,...f}){return B0(y.Portal,{children:B0(y.Content,{align:p,className:q("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",P),"data-slot":"popover-content",sideOffset:$,...f})})}import{jsx as x,jsxs as q0}from"react/jsx-runtime";var IP=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,o0=(P)=>Boolean(P&&IP.test(P)),c5=(P)=>{let p=P.match(/bg-([a-z]+)-\d+/)?.at(1);if(!p)return"Custom";return p.charAt(0).toUpperCase()+p.slice(1)};function RP({value:P,onChange:p,swatches:$=[],className:f,"aria-label":z="Select color"}){let[b,Y]=x5(o0(P)?P:"");u5(()=>{Y(o0(P)?P:"")},[P]);let Z=(X)=>{let N=X.target.value;if(Y(N),IP.test(N))p(N)},J=o0(P),U=$.find((X)=>X.value===P),Q;if(U)Q=U.label;else if(J)Q=P;else if(P)Q=c5(P);else Q="Pick a color";return q0(o,{children:[q0(i,{"aria-label":z,className:q("border-input focus-visible:border-ring focus-visible:ring-ring/50 flex h-9 w-full cursor-pointer items-center justify-between gap-2 rounded-md border bg-transparent px-3 text-sm shadow-xs outline-none focus-visible:ring-[3px]",f),"data-slot":"color-picker-trigger",type:"button",children:[q0("span",{className:"flex items-center gap-2",children:[x("span",{className:q("size-5 shrink-0 rounded-full border",!J&&P),style:J?{backgroundColor:P}:void 0}),x("span",{className:q(J&&"font-mono text-xs"),children:Q})]}),x(i5,{className:"size-4 shrink-0 opacity-50"})]}),q0(u,{className:"w-56","data-slot":"color-picker-content",children:[$.length>0&&x("div",{className:"grid grid-cols-7 gap-1.5",children:$.map((X)=>{let N=P===X.value;return x("button",{"aria-label":X.label,"aria-pressed":N,className:q("focus-visible:ring-ring size-6 cursor-pointer rounded-full border outline-none focus-visible:ring-2",X.value,N&&"ring-ring ring-2 ring-offset-1"),onClick:()=>p(X.value),type:"button"},X.value)})}),x("div",{className:"text-muted-foreground mt-3 mb-1.5 text-xs",children:"Custom"}),q0("div",{className:"flex items-center gap-2",children:[x("input",{"aria-label":"Custom color",className:"size-9 shrink-0 cursor-pointer rounded-md border bg-transparent",onChange:(X)=>p(X.target.value),type:"color",value:J?P:"#000000"}),x(P0,{"aria-label":"Hex color",className:"font-mono",onChange:Z,placeholder:"#000000",value:b})]})]})]})}import*as HP from"@radix-ui/react-label";import{jsx as d5}from"react/jsx-runtime";function l({className:P,...p}){return d5(HP.Root,{className:q("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",P),"data-slot":"label",...p})}import*as O from"@radix-ui/react-select";import{CheckIcon as r5,ChevronDownIcon as kP,ChevronUpIcon as n5}from"lucide-react";import{jsx as H,jsxs as i0}from"react/jsx-runtime";function mP({...P}){return H(O.Root,{"data-slot":"select",...P})}function TP({...P}){return H(O.Value,{"data-slot":"select-value",...P})}function SP({className:P,size:p="default",children:$,...f}){return i0(O.Trigger,{className:q("cursor-pointer border-input data-placeholder:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",P),"data-size":p,"data-slot":"select-trigger",...f,children:[$,H(O.Icon,{asChild:!0,children:H(kP,{className:"size-4 opacity-50"})})]})}function gP({className:P,children:p,position:$="popper",align:f="center",...z}){return H(O.Portal,{children:i0(O.Content,{align:f,className:q("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",$==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",P),"data-slot":"select-content",position:$,...z,children:[H(l5,{}),H(O.Viewport,{className:q("p-1",$==="popper"&&"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width) scroll-my-1"),children:p}),H(a5,{})]})})}function DP({className:P,children:p,...$}){return i0(O.Item,{className:q("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",P),"data-slot":"select-item",...$,children:[H("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:H(O.ItemIndicator,{children:H(r5,{className:"size-4"})})}),H(O.ItemText,{children:p})]})}function l5({className:P,...p}){return H(O.ScrollUpButton,{className:q("flex cursor-default items-center justify-center py-1",P),"data-slot":"select-scroll-up-button",...p,children:H(n5,{className:"size-4"})})}function a5({className:P,...p}){return H(O.ScrollDownButton,{className:q("flex cursor-default items-center justify-center py-1",P),"data-slot":"select-scroll-down-button",...p,children:H(kP,{className:"size-4"})})}import{jsx as t5}from"react/jsx-runtime";function EP({className:P,...p}){return t5("textarea",{className:q("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",P),"data-slot":"textarea",...p})}function wP(P){if(P===void 0)return;if(_.isDayjs(P))return P;let p=_(P);return p.isValid()?p:void 0}function CP(P){let p=P.replace("#",""),$=p.length===3?p.split("").map((Z)=>Z+Z).join(""):p;if(!/^[0-9a-fA-F]{6}$/.test($))return"#000000";let f=Number.parseInt($.slice(0,2),16),z=Number.parseInt($.slice(2,4),16),b=Number.parseInt($.slice(4,6),16);return(f*299+z*587+b*114)/1000>=128?"#000000":"#ffffff"}import{useEffect as Kp,useState as w}from"react";import{PopoverClose as bp}from"@radix-ui/react-popover";import{Calendar as Zp}from"lucide-react";import{useEffect as Yp,useRef as Qp,useState as Jp}from"react";import{useState as pp}from"react";import{ChevronLeftIcon as s5,ChevronRightIcon as e5}from"lucide-react";import{jsx as U0,jsxs as Pp}from"react/jsx-runtime";function p0({label:P,onPrev:p,onNext:$,prevLabel:f,nextLabel:z}){return Pp("div",{className:"mb-2 flex items-center justify-between",children:[U0(R,{"aria-label":f,onClick:p,size:"icon",variant:"ghost",children:U0(s5,{className:"size-4"})}),U0("div",{className:"text-sm font-medium select-none",children:P}),U0(R,{"aria-label":z,onClick:$,size:"icon",variant:"ghost",children:U0(e5,{className:"size-4"})})]})}import{jsx as h,jsxs as vP}from"react/jsx-runtime";function $p(P){let p=P.weekHover&&!P.isCurrentWeek;return q("p-0 text-center",P.weekHover&&"first:rounded-l-md last:rounded-r-md",p&&"group-hover/week:bg-accent",P.isCurrentWeek&&"bg-primary")}function fp(P){return q("w-full aspect-square text-sm select-none",!P.isDisabled&&"cursor-pointer",!(P.weekHover||P.isDisabled)&&"hover:bg-accent rounded-md",P.isOutside&&"text-muted-foreground/50",P.isCurrent&&"rounded-md ring-1 ring-inset ring-foreground/40",P.isCurrentWeek&&"text-primary-foreground font-medium",P.isSelected&&"bg-primary text-primary-foreground rounded-md font-medium",P.isDisabled&&"opacity-50 cursor-not-allowed")}function zp({day:P,state:p,onSelect:$}){return h("td",{className:$p(p),"data-disabled":p.isDisabled,"data-outside":p.isOutside,"data-selected":p.isSelected,role:"gridcell",tabIndex:-1,children:h("button",{"aria-disabled":p.isDisabled,"aria-hidden":p.isOutside,className:fp(p),"data-disabled":p.isDisabled,"data-selected":p.isSelected,disabled:p.isDisabled||p.isOutside,onClick:()=>$?.(P.toDate()),tabIndex:p.isOutside?-1:0,type:"button",children:P.format("D")})})}function K0({selected:P,defaultMonth:p,onSelect:$,disabled:f,firstDayOfWeek:z=0,className:b,weekHover:Y=!1,highlightedWeekOf:Z}){let[J,U]=pp(()=>_(p??P??new Date).startOf("month")),Q=hP(J,z),X=P?_(P).format("YYYY-MM-DD"):void 0,N=N0(_(),z).map((K)=>K.format("dd")),M,F;if(Z){let K=N0(Z,z);M=K.at(0),F=K.at(-1)}let W=(K)=>{let A=K.format("YYYY-MM-DD")===X,V=!1;if(M&&F){let m=!K.isBefore(M,"day"),B=!K.isAfter(F,"day");V=m&&B}return{isOutside:!K.isSame(J,"month"),isSelected:A,isDisabled:f?.(K.toDate())??!1,isCurrent:yP(K)&&!A,isCurrentWeek:V,weekHover:Y}};return vP("div",{className:q("bg-background p-3 w-72",b),"data-slot":"calendar",children:[h(p0,{label:J.format("MMMM YYYY"),nextLabel:"Next month",onNext:()=>U((K)=>K.add(1,"month")),onPrev:()=>U((K)=>K.subtract(1,"month")),prevLabel:"Previous month"}),vP("table",{className:"w-full border-collapse",role:"grid",children:[h("thead",{children:h("tr",{children:N.map((K,A)=>h("th",{className:"text-muted-foreground text-xs font-medium select-none py-1",children:K},A))})}),h("tbody",{children:Q.map((K,A)=>h("tr",{className:q(Y&&"group/week"),children:K.map((V)=>h(zp,{day:V,onSelect:$,state:W(V)},V.toISOString()))},A))})]})]})}import{jsx as $0,jsxs as u0}from"react/jsx-runtime";function jP({date:P,closeOnSelect:p,onChange:$,label:f="Pick a date",className:z,disabled:b}){let Y=G((X)=>X.firstDayOfWeek),Z=Qp(null),[J,U]=Jp(P);Yp(()=>{U(P)},[P]);let Q=(X)=>{if(U(X),p)Z.current?.click();$?.(X)};return $0("div",{className:z,children:u0(o,{children:[$0(i,{asChild:!0,children:u0(R,{className:q("data-[empty=true]:text-muted-foreground w-full justify-start text-left font-normal"),"data-empty":!P,variant:"outline",children:[$0(Zp,{}),J?_(J).format("ll"):$0("span",{children:f})]})}),u0(u,{align:"start",className:"w-auto p-0",children:[$0(bp,{ref:Z,style:{display:"none"}}),$0(K0,{defaultMonth:J,disabled:b,firstDayOfWeek:Y,onSelect:Q,selected:J})]})]})})}import{Clock as qp}from"lucide-react";import{useEffect as Up,useRef as iP,useState as x0}from"react";import{useMemo as Xp}from"react";function oP({timeFormat:P="12-hour",minTime:p="00:00",maxTime:$="23:45"}){return{timeOptions:Xp(()=>{let b=[],[Y,Z]=p.split(":").map(Number),[J,U]=$.split(":").map(Number),Q=Y*60+Z,X=J*60+U;for(let N=Q;N<=X;N+=15){let M=Math.floor(N/60),F=N%60,W=`${M.toString().padStart(2,"0")}:${F.toString().padStart(2,"0")}`;b.push(W)}return b},[p,$]),formatTime:(b)=>{let[Y,Z]=b.split(":").map(Number);if(P==="24-hour")return`${Y.toString().padStart(2,"0")}:${Z.toString().padStart(2,"0")}`;let J=Y>=12?"PM":"AM",U=Y;if(Y===0)U=12;else if(Y>12)U=Y-12;return`${U}:${Z.toString().padStart(2,"0")} ${J}`}}}import{jsx as c,jsxs as c0}from"react/jsx-runtime";var Np=(P)=>{P.stopPropagation()};function uP({value:P,onChange:p,minTime:$="00:00",maxTime:f="23:45",timeFormat:z="12-hour",placeholder:b="Select time...",className:Y,disabled:Z=!1,name:J}){let[U,Q]=x0(!1),[X,N]=x0(""),M=iP(null),F=iP(null),[W,K]=x0(0),{timeOptions:A,formatTime:V}=oP({timeFormat:z,minTime:$,maxTime:f}),m=A.filter((S)=>{return V(S).toLowerCase().includes(X.toLowerCase())}),B=(S)=>{p(S),Q(!1),N("")};Up(()=>{if(U){if(F.current)K(F.current.offsetWidth);setTimeout(()=>{M.current?.focus()},0)}},[U]);let Q0=P?V(P):b;return c0(o,{onOpenChange:Q,open:U,children:[c(i,{asChild:!0,children:c0(R,{"aria-controls":"time-picker-listbox","aria-expanded":U,className:q("w-full justify-start",Y),"data-testid":k.timePicker(J),disabled:Z,ref:F,role:"combobox",variant:"outline",children:[c(qp,{className:"mr-2 h-4 w-4"}),Q0]})}),c0(u,{align:"start",className:"p-0",style:{width:W},children:[c("div",{className:"p-2 border-b",children:c(P0,{className:"h-8",onChange:(S)=>N(S.target.value),placeholder:"Search time...",ref:M,value:X})}),c(d,{className:"h-[200px]",onWheel:Np,children:c("div",{className:"p-1",children:m.length===0?c("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"N/A"}):m.map((S)=>{let G0=V(S);return c("button",{className:q("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground",S===P&&"bg-accent text-accent-foreground"),onClick:()=>B(S),type:"button",children:G0},S)})})})]})]})}var cP=(P,p,$)=>{let[f,z]=p.split(":").map(Number),b=_(P).hour(f).minute(z);return $?b.hour(0).minute(0):b},dP=(P,p,$)=>{let[f,z]=p.split(":").map(Number),b=_(P).hour(f).minute(z);return $?b.hour(23).minute(59):b},d0=(P,p)=>{if(!p)return{min:"00:00",max:"23:59"};let $=_(P),{minStart:f,maxEnd:z,hasBusinessHours:b}=xP({allDates:[$],businessHours:p,hideNonBusinessHours:!1});if(!b)return{min:"00:00",max:"23:59"};return{min:`${f.toString().padStart(2,"0")}:00`,max:`${(z-1).toString().padStart(2,"0")}:45`}};import{jsx as I,jsxs as g,Fragment as Fp}from"react/jsx-runtime";var aP="bg-blue-100 text-blue-800",Lp=[{value:aP,label:"Blue"},{value:"bg-green-100 text-green-800",label:"Green"},{value:"bg-purple-100 text-purple-800",label:"Purple"},{value:"bg-red-100 text-red-800",label:"Red"},{value:"bg-yellow-100 text-yellow-800",label:"Yellow"},{value:"bg-pink-100 text-pink-800",label:"Pink"},{value:"bg-indigo-100 text-indigo-800",label:"Indigo"},{value:"bg-amber-100 text-amber-800",label:"Amber"},{value:"bg-emerald-100 text-emerald-800",label:"Emerald"},{value:"bg-sky-100 text-sky-800",label:"Sky"},{value:"bg-violet-100 text-violet-800",label:"Violet"},{value:"bg-rose-100 text-rose-800",label:"Rose"},{value:"bg-teal-100 text-teal-800",label:"Teal"},{value:"bg-orange-100 text-orange-800",label:"Orange"}],tP=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,_p=(P,p)=>{if(P&&tP.test(P))return P;return p??aP},Gp=(P)=>{if(tP.test(P))return{backgroundColor:P,color:CP(P)};return{backgroundColor:void 0,color:P}},Mp=({colorChanged:P,hadInitialColor:p,selectedColor:$,initialBackgroundColor:f,initialColor:z})=>{if(P||!p)return Gp($);return{backgroundColor:f,color:z}},r0=({name:P,label:p,placeholder:$,value:f,required:z=!1,multiline:b=!1,onChange:Y})=>g("div",{className:"grid gap-1 sm:gap-2",children:[I(l,{className:"text-xs sm:text-sm",htmlFor:P,children:p}),b?I(EP,{className:"min-h-16 text-sm",id:P,name:P,onChange:Y,placeholder:$,required:z,value:f}):I(P0,{className:"h-8 text-sm sm:h-9",id:P,name:P,onChange:Y,placeholder:$,required:z,value:f})]}),sP=({selectedEvent:P,onClose:p,onUpdate:$,onDelete:f,onAdd:z})=>{let{dialogState:b,openEditDialog:Y,openDeleteDialog:Z,closeDialog:J,handleConfirm:U}=V0(p),{t:Q,timeFormat:X,getEventManager:N,resources:M}=G((L)=>({t:L.t,timeFormat:L.timeFormat,getEventManager:L.getEventManager,resources:L.resources??[]})),{id:F,resourceId:W,resourceIds:K,start:A=_(),end:V=_().add(1,"hour"),allDay:m=!1,color:B,backgroundColor:Q0,title:S="",description:G0="",location:fP=""}=P??{},zP=M.length>0,bP=W??K?.at(0),ZP=zP&&bP===void 0,[S0,P5]=w(bP),g0=zP?S0:W,M0=nP(g0),YP=Boolean(P&&N(P)),[s,QP]=w(A.toDate()),[e,JP]=w(V.toDate()),[j,p5]=w(m),[D0,$5]=w(_p(Q0,B)),[f5,z5]=w(!1),b5=Boolean(B||Q0),Z5=(L)=>{$5(L),z5(!0)},[E0,XP]=w(A.format("HH:mm")),[w0,C0]=w(V.format("HH:mm")),[v,Y5]=w({title:S,description:G0,location:fP}),[v0,Q5]=w({}),J5={...P,...v0},X5=(L)=>Q5((D)=>({...D,...L})),q5=(L)=>{if(!L)return;if(QP(L),_(L).isAfter(_(e)))JP(L)},U5=(L)=>{if(!L)return;if(JP(L),L&&_(L).isBefore(_(s)))QP(L)},N5=(L)=>{if(XP(L),_(s).isSame(_(e),"day")&&L>w0)C0(L)},K5=(L)=>{if(C0(L),_(s).isSame(_(e),"day")&&L<E0)XP(L)},y0=(L)=>{let{name:D,value:E}=L.target;Y5((J0)=>({...J0,[D]:E}))};Kp(()=>{if(j)C0("23:59")},[j]);let L5=(L)=>{return M.find((E)=>String(E.id)===L)?.id??L},qP=ZP&&S0===void 0,_5=(L)=>{if(L.preventDefault(),qP)return;let D=cP(s,E0,j),E=dP(e,w0,j),J0=Mp({colorChanged:f5,hadInitialColor:b5,selectedColor:D0,initialBackgroundColor:Q0,initialColor:B}),X0={id:F||_().format("YYYYMMDDHHmmss"),title:v.title,start:D,end:E,resourceId:g0,description:v.description,location:v.location,allDay:j,...J0,...v0};if(P?.id&&YP){Y(P,{title:v.title,start:D,end:E,resourceId:g0,description:v.description,location:v.location,allDay:j,color:D0,...v0});return}if(F)$?.(X0);else z?.(X0);p()},G5=()=>{if(!P?.id)return;if(YP){Z(P);return}f?.(P),p()},UP;if(M0)UP=(L)=>!lP(_(L),M0);let M5=d0(s,M0),F5=d0(e,M0),A5=[["startDate",s,q5],["endDate",e,U5]],V5=[["startTime","start-time",E0,N5,M5],["endTime","end-time",w0,K5,F5]],W5=S0?.toString();return g(Fp,{children:[g("form",{className:"flex flex-col flex-1 min-h-0",onSubmit:_5,children:[I(d,{className:"flex-1 min-h-0",children:g("div",{className:"grid gap-3 sm:gap-4 p-1",children:[I(r0,{label:Q("title"),name:"title",onChange:y0,placeholder:Q("eventTitlePlaceholder"),required:!0,value:v.title}),I(r0,{label:Q("description"),multiline:!0,name:"description",onChange:y0,placeholder:Q("eventDescriptionPlaceholder"),value:v.description}),ZP&&g("div",{className:"grid gap-1 sm:gap-2",children:[I(l,{className:"text-xs sm:text-sm",htmlFor:"resource",children:Q("resource")}),g(mP,{onValueChange:(L)=>P5(L5(L)),value:W5,children:[I(SP,{className:"h-8 text-sm sm:h-9","data-testid":"resource-select",id:"resource",children:I(TP,{placeholder:Q("selectResource")})}),I(gP,{children:M.map((L)=>I(DP,{value:String(L.id),children:L.title},String(L.id)))})]})]}),g("div",{className:"flex items-center space-x-2",children:[I(OP,{checked:j,id:"allDay",onCheckedChange:(L)=>p5(L===!0)}),I(l,{className:"text-xs sm:text-sm",htmlFor:"allDay",children:Q("allDay")})]}),I("div",{className:"grid grid-cols-2 gap-2 sm:gap-4",children:A5.map(([L,D,E])=>g("div",{children:[I(l,{className:"text-xs sm:text-sm",children:Q(L)}),I(jP,{className:"mt-1",closeOnSelect:!0,date:D,disabled:UP,onChange:E})]},L))}),!j&&I("div",{className:"grid grid-cols-2 gap-2 sm:gap-4",children:V5.map(([L,D,E,J0,X0])=>g("div",{children:[I(l,{className:"text-xs sm:text-sm",children:Q(L)}),I(uP,{className:"mt-1 h-8 text-sm sm:h-9",maxTime:X0.max,minTime:X0.min,name:D,onChange:J0,placeholder:Q("searchTime"),timeFormat:X,value:E})]},L))}),g("div",{className:"grid gap-1 sm:gap-2",children:[I(l,{className:"text-xs sm:text-sm",children:Q("color")}),I(RP,{"aria-label":Q("color"),onChange:Z5,swatches:Lp,value:D0})]}),I(r0,{label:Q("location"),name:"location",onChange:y0,placeholder:Q("eventLocationPlaceholder"),value:v.location}),I(LP,{event:J5,onChange:X5})]})}),g(rP,{className:"mt-4 shrink-0 flex flex-col-reverse gap-2 sm:flex-row sm:gap-0",children:[F&&I(R,{className:"w-full sm:mr-auto sm:w-auto",onClick:G5,size:"sm",type:"button",variant:"destructive",children:Q("delete")}),g("div",{className:"flex w-full gap-2 sm:w-auto",children:[I(R,{className:"flex-1 sm:flex-none",onClick:p,size:"sm",type:"button",variant:"outline",children:Q("cancel")}),I(R,{className:"flex-1 sm:flex-none",disabled:qP,size:"sm",type:"submit",children:F?Q("update"):Q("create")})]})]})]}),I(F0,{dialog:b,onCancel:J,onResolve:U})]})};import{jsx as O0,jsxs as eP}from"react/jsx-runtime";var b2=()=>{let{t:P,selectedEvent:p,isEventFormOpen:$,closeEventForm:f,addEvent:z,updateEvent:b,deleteEvent:Y,renderEventForm:Z}=G((X)=>({t:X.t,selectedEvent:X.selectedEvent,isEventFormOpen:X.isEventFormOpen,closeEventForm:X.closeEventForm,addEvent:X.addEvent,updateEvent:X.updateEvent,deleteEvent:X.deleteEvent,renderEventForm:X.renderEventForm})),Q={open:$,onClose:f,selectedEvent:p,onAdd:z,onUpdate:(X)=>{b(X.id,X)},onDelete:(X)=>{Y(X.id)}};if(Z)return Z(Q);return O0(P2,{onOpenChange:f,open:$,children:eP(p2,{className:"flex flex-col h-[90vh] w-[90vw] max-w-[500px] p-4 sm:p-6 overflow-hidden gap-0",children:[eP($2,{className:"mb-2 sm:mb-4 shrink-0",children:[O0(f2,{className:"text-base sm:text-lg",children:p?.id?P("editEvent"):P("createEvent")}),O0(z2,{className:"text-xs sm:text-sm",children:p?.id?P("editEventDetails"):P("addNewEvent")})]}),O0(sP,{...Q})]})})};import{ChevronLeft as hp,ChevronRight as jp,Download as op,Plus as ip}from"lucide-react";import{ChevronDown as Ip}from"lucide-react";import{useState as Rp}from"react";function Z2(){let{currentLocale:P,timezone:p}=G((f)=>({currentLocale:f.currentLocale,timezone:f.timezone}));return{formatDateRange:(f,z)=>{let b=new Intl.DateTimeFormat(P,{timeZone:p,month:"short",day:"numeric"});if(f.year()===z.year())return b.formatRange(f.toDate(),z.toDate());return`${b.format(f.toDate())} – ${b.format(z.toDate())}`}}}import{useState as Vp}from"react";import{jsx as Ap}from"react/jsx-runtime";function I0({label:P,isSelected:p,isCurrent:$,onSelect:f}){return Ap("button",{"aria-pressed":p,className:q("hover:bg-accent rounded-md py-2 text-sm font-medium cursor-pointer select-none",$&&"ring-1 ring-inset ring-foreground/40",p&&"bg-primary text-primary-foreground"),onClick:f,type:"button",children:P})}import{jsx as n0,jsxs as Wp}from"react/jsx-runtime";function Y2({selected:P,onSelect:p}){let[$,f]=Vp(()=>P.year()),z=_(),b=Array.from({length:12},(Y,Z)=>({index:Z,label:P.month(Z).format("MMM")}));return Wp("div",{className:"w-72 p-3","data-slot":"month-grid",children:[n0(p0,{label:$,nextLabel:"Next year",onNext:()=>f((Y)=>Y+1),onPrev:()=>f((Y)=>Y-1),prevLabel:"Previous year"}),n0("div",{className:"grid grid-cols-3 gap-1",children:b.map((Y)=>{let Z=$===P.year()&&Y.index===P.month(),J=$===z.year()&&Y.index===z.month()&&!Z;return n0(I0,{isCurrent:J,isSelected:Z,label:Y.label,onSelect:()=>p(P.year($).month(Y.index).date(1))},Y.index)})})]})}import{useState as Bp}from"react";import{jsx as l0,jsxs as Op}from"react/jsx-runtime";var L0=12;function Q2({selected:P,onSelect:p}){let[$,f]=Bp(()=>P.year()-P.year()%L0),z=_(),b=Array.from({length:L0},(Y,Z)=>$+Z);return Op("div",{className:"w-72 p-3","data-slot":"year-grid",children:[l0(p0,{label:`${$} – ${$+L0-1}`,nextLabel:"Next years",onNext:()=>f((Y)=>Y+L0),onPrev:()=>f((Y)=>Y-L0),prevLabel:"Previous years"}),l0("div",{className:"grid grid-cols-3 gap-1",children:b.map((Y)=>{let Z=Y===P.year(),J=Y===z.year()&&!Z;return l0(I0,{isCurrent:J,isSelected:Z,label:Y,onSelect:()=>p(P.year(Y))},Y)})})]})}import{jsx as a,jsxs as J2}from"react/jsx-runtime";var Hp={day:"day",week:"week",month:"month",year:"year"};function kp(P){let p=P?.navigationStep??{amount:1,unit:P?.navigationUnit??"day"};if(p.amount!==1)return"range";return Hp[p.unit]??"range"}function X2({className:P}){let{currentDate:p,currentRange:$,view:f,selectDate:z,firstDayOfWeek:b,getViews:Y}=G((B)=>({currentDate:B.currentDate,currentRange:B.currentRange,view:B.view,selectDate:B.selectDate,firstDayOfWeek:B.firstDayOfWeek,getViews:B.getViews})),{formatDateRange:Z}=Z2(),[J,U]=Rp(!1),Q=N0(p,b),X=Q.at(0)??p,N=Q.at(-1)??p,M=(B)=>{z(B),U(!1)},F=kp(Y().find((B)=>B.name===f)),K={year:p.format("YYYY"),month:p.format("MMM YYYY"),week:Z(X,N),day:p.format("ddd, MMM D, YYYY"),range:Z($.start,$.end)}[F],A=a(K0,{defaultMonth:p.toDate(),firstDayOfWeek:b,onSelect:(B)=>B&&M(_(B)),selected:p.toDate()}),m={year:a(Q2,{onSelect:M,selected:p}),month:a(Y2,{onSelect:M,selected:p}),week:a(K0,{defaultMonth:p.toDate(),firstDayOfWeek:b,highlightedWeekOf:p,onSelect:(B)=>B&&M(_(B)),weekHover:!0}),day:A,range:A}[F];return J2(o,{onOpenChange:U,open:J,children:[a(i,{asChild:!0,children:J2(R,{className:q("font-semibold",P),"data-testid":"calendar-title",variant:"outline",children:[K,a(Ip,{className:"size-4 shrink-0 opacity-50"})]})}),a(u,{align:"start",className:"w-auto p-0",children:m})]})}var a0=`\r
|
|
2
2
|
`,mp=["BEGIN:VTIMEZONE","TZID:UTC","BEGIN:STANDARD","DTSTART:19700101T000000","TZNAME:UTC","TZOFFSETFROM:+0000","TZOFFSETTO:+0000","END:STANDARD","END:VTIMEZONE"].join(a0),R0=(P)=>{return P.replaceAll("\\","\\\\").replaceAll(";","\\;").replaceAll(",","\\,").replaceAll(`
|
|
3
3
|
`,"\\n").replaceAll("\r","")},q2=(P,p=!1)=>{if(p)return P.format("YYYYMMDD");return P.utc().format("YYYYMMDD[T]HHmmss[Z]")},Tp=(P)=>{return P.uid||`${P.id}@ilamy.calendar`},Sp=(P,p)=>{let $=_().utc().format("YYYYMMDD[T]HHmmss[Z]"),f=P.allDay?";VALUE=DATE":"",z=["BEGIN:VEVENT",`UID:${Tp(P)}`,`DTSTART${f}:${q2(P.start,P.allDay)}`,`DTEND${f}:${q2(P.end,P.allDay)}`,`SUMMARY:${R0(P.title)}`,P.description&&`DESCRIPTION:${R0(P.description)}`,P.location&&`LOCATION:${R0(P.location)}`].filter(Boolean),b=p("ical:vevent-properties",P).filter((Z)=>typeof Z==="string"),Y=[`DTSTAMP:${$}`,`CREATED:${$}`,`LAST-MODIFIED:${$}`,"STATUS:CONFIRMED","SEQUENCE:0","TRANSP:OPAQUE","END:VEVENT"];return[...z,...b,...Y].join(a0)},gp=(P,p,$="ilamy Calendar")=>{let f=R0($),z=P.map((b)=>Sp(b,p));return["BEGIN:VCALENDAR","VERSION:2.0","PRODID:-//ilamy//ilamy Calendar//EN","CALSCALE:GREGORIAN","METHOD:PUBLISH",`X-WR-CALNAME:${f}`,`X-WR-CALDESC:Exported from ${f}`,mp,...z,"END:VCALENDAR"].join(a0)},U2=(P,p,$="calendar.ics",f="ilamy Calendar")=>{let z=new Blob([gp(P,p,f)],{type:"text/calendar;charset=utf-8"}),b=URL.createObjectURL(z),Y=$;if(!$.endsWith(".ics"))Y=`${$}.ics`;let Z=document.createElement("a");Z.href=b,Z.download=Y,document.body.append(Z),Z.click(),Z.remove(),URL.revokeObjectURL(b)};function N2(){let{rawEvents:P,collect:p}=G(($)=>({rawEvents:$.rawEvents,collect:$.collect}));return()=>{let $=`ilamy-calendar-${_().format("YYYY-MM-DD")}.ics`;U2(P,p,$,"ilamy Calendar")}}import*as C from"@radix-ui/react-dropdown-menu";import{jsx as _0}from"react/jsx-runtime";function K2({...P}){return _0(C.Root,{"data-slot":"dropdown-menu",...P})}function L2({...P}){return _0(C.Trigger,{"data-slot":"dropdown-menu-trigger",...P})}function _2({className:P,sideOffset:p=4,align:$="end",...f}){return _0(C.Portal,{children:_0(C.Content,{align:$,className:q("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",P),"data-slot":"dropdown-menu-content",sideOffset:p,...f})})}function G2({className:P,...p}){return _0(C.Item,{className:q("focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",P),"data-slot":"dropdown-menu-item",...p})}import{Check as Dp,ChevronDown as Ep}from"lucide-react";function H0(){let{getViews:P,resources:p}=G((f)=>({getViews:f.getViews,resources:f.resources})),$=Boolean(p?.length);return P().filter((f)=>!$||f.supportsResources)}import{jsx as r,jsxs as t0}from"react/jsx-runtime";function M2({className:P}){let{view:p,setView:$,t:f}=G((J)=>({view:J.view,setView:J.setView,t:J.t})),z=H0(),b=z.find((J)=>J.name===p),Y=b?f(b.label??b.name):"",Z=b?.icon;return t0(K2,{children:[r(L2,{asChild:!0,className:P,children:t0(R,{size:"default",variant:"outline",children:[Z&&r(Z,{className:"size-4"}),r("span",{children:Y}),r(Ep,{className:"size-4 opacity-50"})]})}),r(_2,{align:"end",className:"min-w-40",children:z.map((J)=>{let U=J.icon;return t0(G2,{onSelect:()=>$(J.name),children:[r(U,{className:"size-4"}),r("span",{className:"flex-1",children:f(J.label??J.name)}),J.name===p&&r(Dp,{className:"size-4"})]},J.name)})})]})}import*as k0 from"@radix-ui/react-toggle-group";import{cva as wp}from"class-variance-authority";import{createContext as Cp,useContext as vp}from"react";import{jsx as s0}from"react/jsx-runtime";var yp=wp("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors outline-none hover:bg-muted hover:text-muted-foreground focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 cursor-pointer select-none",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-2.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),F2=Cp({size:"default",variant:"default"});function A2({className:P,variant:p,size:$,children:f,...z}){return s0(k0.Root,{className:q("flex items-center justify-center gap-1",P),"data-slot":"toggle-group",...z,children:s0(F2.Provider,{value:{variant:p,size:$},children:f})})}function V2({className:P,children:p,variant:$,size:f,...z}){let b=vp(F2);return s0(k0.Item,{className:q(yp({variant:b.variant||$,size:b.size||f}),P),"data-slot":"toggle-group-item",...z,children:p})}import{jsx as W2}from"react/jsx-runtime";function B2({className:P}){let{view:p,setView:$,t:f}=G((b)=>({view:b.view,setView:b.setView,t:b.t})),z=H0();return W2(A2,{className:q("bg-muted gap-0 rounded-lg p-0.75",P),onValueChange:(b)=>b&&$(b),size:"sm",type:"single",value:p,children:z.map((b)=>W2(V2,{className:"text-muted-foreground data-[state=on]:bg-background data-[state=on]:text-foreground rounded-md px-3 font-medium data-[state=on]:shadow-sm",value:b.name,children:f(b.label??b.name)},b.name))})}import{jsx as T,jsxs as f0}from"react/jsx-runtime";var O2=({className:P=""})=>{let{nextPeriod:p,prevPeriod:$,today:f,openEventForm:z,headerComponent:b,headerClassName:Y,t:Z,hideExportButton:J}=G((Q)=>({nextPeriod:Q.nextPeriod,prevPeriod:Q.prevPeriod,today:Q.today,openEventForm:Q.openEventForm,headerComponent:Q.headerComponent,headerClassName:Q.headerClassName,t:Q.t,hideExportButton:Q.hideExportButton})),U=N2();if(b)return b;return T("div",{className:q("@container/base-header w-full",Y),"data-testid":"calendar-header",children:f0("div",{className:q("flex flex-col items-center gap-2 @lg/base-header:flex-row @lg/base-header:justify-between",P),children:[f0("div",{className:"flex min-w-0 items-center gap-2",children:[f0("div",{className:"bg-background flex h-9 items-center rounded-lg border",children:[T(R,{"aria-label":Z("previous"),className:"h-full",onClick:$,size:"icon",variant:"ghost",children:T(hp,{className:"size-4"})}),T(R,{"aria-label":Z("next"),className:"h-full",onClick:p,size:"icon",variant:"ghost",children:T(jp,{className:"size-4"})})]}),T(R,{onClick:f,size:"default",variant:"outline",children:Z("today")}),T(X2,{})]}),f0("div",{className:"flex items-center gap-2",children:[T(B2,{className:"hidden @3xl/base-header:flex"}),T(M2,{className:"@3xl/base-header:hidden"}),!J&&f0(R,{"aria-label":Z("export"),onClick:U,size:"default",variant:"outline",children:[T(op,{className:"size-4"}),T("span",{className:"hidden @2xl/base-header:inline",children:Z("export")})]}),f0(R,{"aria-label":Z("new"),onClick:()=>z(),size:"default",children:[T(ip,{className:"size-4"}),T("span",{className:"hidden @2xl/base-header:inline",children:Z("new")})]})]})]})})};import{useMemo as u2}from"react";import{useRef as ep}from"react";import{useEffect as up,useRef as xp}from"react";var cp=/^(\d{1,2})(?::\d{1,2})?(?::\d{1,2})?$/,dp="[data-hour]",rp=(P)=>{let $=cp.exec(P)?.at(1);if(!$)return null;let f=Number.parseInt($,10);return f>=0&&f<=23?f:null},e0=(P)=>Number.parseInt(P.getAttribute("data-hour")??"",10),np=(P,p)=>{let $=P.at(0),f=P.at(-1);if(!$||!f)return null;if(p<=e0($))return $;if(p>=e0(f))return f;return P.find((z)=>e0(z)===p)??null},lp=(P,p,$,f)=>{let z=p.getBoundingClientRect(),b=$.getBoundingClientRect();if(f==="horizontal"){P.scrollTo({left:z.left-b.left,behavior:"auto"});return}P.scrollTo({top:z.top-b.top,behavior:"auto"})},m0=({viewportRef:P,scrollTime:p,enabled:$,scrollKey:f,axis:z="vertical"})=>{let b=xp(null);up(()=>{if(!$||!p)return;if(b.current===f)return;let Y=rp(p);if(Y===null)return;let Z=P.current;if(!Z)return;let J=Array.from(Z.querySelectorAll(dp)),U=J.at(0),Q=np(J,Y);if(!U||!Q)return;lp(Z,Q,U,z),b.current=f},[$,p,f,P,z])};import{memo as ap}from"react";import{jsx as sp}from"react/jsx-runtime";var tp=({children:P,className:p})=>{let{stickyViewHeader:$,viewHeaderClassName:f}=G((z)=>({stickyViewHeader:z.stickyViewHeader,viewHeaderClassName:z.viewHeaderClassName}));return sp("div",{className:q("flex h-12 w-fit",$&&"sticky top-0 z-21 bg-background",p,f),"data-testid":"horizontal-grid-header",children:P})},I2=ap(tp);import{jsx as z0,jsxs as R2}from"react/jsx-runtime";var k2=({rows:P,children:p,classes:$,allDay:f,gridType:z,variant:b="resource",dayNumberHeight:Y})=>{let{currentDate:Z,view:J,scrollTime:U}=G(),Q=ep(null),X=b==="resource",N=!X;m0({viewportRef:Q,scrollTime:U,enabled:z==="hour"&&X,scrollKey:`${J}-${Z.format("YYYY-MM-DD")}`,axis:"horizontal"});let F=p&&z0(I2,{className:$?.header,children:p});return R2("div",{className:"h-full flex flex-col","data-testid":"horizontal-grid-container",children:[N&&F,R2(d,{className:q("h-full",N&&"overflow-auto"),"data-testid":"horizontal-grid-scroll",viewPortProps:{className:"*:flex! *:flex-col! *:min-h-full",ref:Q},children:[X&&F,z0("div",{className:q("flex flex-1 w-fit",$?.body),"data-testid":"horizontal-grid-body",children:z0("div",{className:"relative w-full flex flex-col flex-1 gap-px bg-border","data-calendar-scroll-content":"true",children:P.map((W)=>z0(H2,{allDay:W.allDay??f,dayNumberHeight:Y,gridType:z,variant:b,...W},W.id))},Z.format("YYYY-MM"))}),z0(b0,{className:"z-30"}),z0(b0,{className:"z-30",orientation:"horizontal"})]})]})};import{useRef as K4}from"react";import{memo as Q4}from"react";import{memo as b4}from"react";import{useMemo as S2}from"react";var P4=(P)=>{let p=[],$=[],f=null;for(let z of P){if(f&&z.start.isSameOrAfter(f)){if($.length>0)p.push($);$=[]}$.push(z),f=f?_.max(f,z.end):z.end}if($.length>0)p.push($);return p},m2=(P,{gridStart:p,totalUnits:$,gridType:f,isDiscrete:z})=>{let b=P.start.diff(p,f,!0),Y=P.end.diff(p,f,!0);if(z){if(b=Math.floor(b),Y=Math.ceil(Y),Y<=b)Y=b+1}if(b<0)b=0;if(Y>$)Y=$;let Z=Math.max(0,Y-b);if(Z===0)return null;return{top:b/$*100,height:Z/$*100}},p4={2:25,3:50,4:60},$4=70,f4=(P)=>p4[P]??$4,z4=(P,p)=>{let $=P.length===1?P.at(0):void 0;if($){let Z=m2($,p);if(!Z)return[];return[{kind:"vertical",event:$,left:0,width:100,...Z}]}let f=[...P].sort((Z,J)=>{let U=J.end.diff(J.start,"minute")-Z.end.diff(Z.start,"minute");return U!==0?U:Z.start.diff(J.start)}),z=f.length,b=z>1?f4(z)/(z-1):0,Y=[];for(let Z=0;Z<z;Z++){let J=f.at(Z);if(!J)continue;let U=m2(J,p);if(!U)continue;let Q=Z===0?0:b*Z;Y.push({kind:"vertical",event:J,...U,left:Q,width:100-Q,zIndex:Z+1})}return Y},T2=({days:P,gridType:p="hour",events:$})=>{let f=$.filter((b)=>!b.allDay).toSorted((b,Y)=>b.start.diff(Y.start));if(f.length===0)return[];let z={gridStart:P.at(0)||_(),totalUnits:P.length,gridType:p,isDiscrete:p==="day"};return P4(f).flatMap((b)=>z4(b,z))};var D2=({days:P,gridType:p,resourceId:$})=>{let{getEventsForDateRange:f}=G(),z=P.at(0),b=P.at(-1),Y=z?.startOf("day"),Z=b?.endOf("day"),J=S2(()=>{if(!Y||!Z)return[];let Q=f(Y,Z);if($)Q=g2(Q,$);return Q.filter((X)=>!X.allDay)},[Y,Z,f,$]);return S2(()=>{return T2({days:P,events:J,gridType:p})},[P,p,J])};import{jsx as PP,jsxs as Y4}from"react/jsx-runtime";var Z4=({days:P,gridType:p="hour",resourceId:$,resource:f,"data-testid":z})=>{let{resources:b}=G((X)=>({resources:X.resources})),Y=D2({days:P,gridType:p,resourceId:$}),Z=P.at(0),J=P.at(-1)?.add(1,p),U=!$||b?.at(0)?.id===$,Q=p==="hour"&&Boolean(Z&&J);return Y4("div",{className:"relative w-full h-full pointer-events-none z-10 overflow-clip","data-testid":z,children:[Q&&Z&&J&&PP(w2,{rangeEnd:J,rangeStart:Z,resource:f,withDot:U}),Y.map((X,N)=>{let{event:M}=X,F=`event-${M.id}-${N}-${P.at(0)?.toISOString()}-${$??"no-resource"}`,W=M.end.diff(M.start,"minute")<=15;return PP("div",{className:"absolute",style:{left:`${X.left}%`,width:`calc(${X.width}% - var(--spacing) * 2)`,top:`${X.top}%`,height:`${X.height}%`},children:PP(E2,{className:q("pointer-events-auto",{"[&_p]:text-[10px] [&_p]:mt-0":W}),elementId:F,event:M})},k.listKey(F,"wrapper"))})]})},C2=b4(Z4);import{jsx as Z0,jsxs as X4}from"react/jsx-runtime";var J4=({id:P,days:p,resource:$,"data-testid":f,gridType:z,className:b,renderCell:Y,noEvents:Z,slotDurationMinutes:J=60})=>{let U=$?.id,Q=Math.floor(60/J),X=Array.from({length:Q},(M,F)=>F*J),N=X.length>1;return Z0("div",{className:q("flex flex-col flex-1 items-center min-w-20 justify-center bg-background relative",b),"data-testid":f||k.container.vertical.col(P),children:X4("div",{className:"w-full h-full relative grid gap-px bg-border",style:{gridTemplateRows:`repeat(${p.length}, minmax(0, 1fr))`},children:[p.map((M,F)=>{let W=M.format("HH");if(Y){let K=P===k.col.time,A=K?k.cell.verticalTime(W):k.cell.vertical(M,W,"00",U);return Z0("div",{className:"min-h-[60px] bg-background","data-hour":K?W:void 0,"data-testid":A,children:Y(M)},k.listKey(P,F,W))}return Z0("div",{className:"flex flex-col min-h-[60px]",children:X.map((K,A)=>{let V=String(K).padStart(2,"0"),m=k.cell.vertical(M,W,V,U),B=N&&A<X.length-1;return Z0(v2,{className:q("hover:bg-accent relative z-10 flex-1 min-h-0 cursor-pointer",B&&"border-b border-dashed"),"data-testid":m,day:N?M.minute(K):M,gridType:z,hour:z==="hour"?M.hour():void 0,minute:N?K:void 0,resourceId:U,shouldRenderEvents:!1},k.listKey(P,F,V))})},k.listKey(P,F,W))}),!Z&&Z0("div",{className:"absolute inset-0 z-10 pointer-events-none",children:Z0(C2,{"data-testid":k.container.eventsLayer("vertical",P),days:p,gridType:z,resource:$,resourceId:U})})]})})},y2=Q4(J4);import{memo as q4}from"react";import{jsx as h2,jsxs as N4}from"react/jsx-runtime";var U4=({children:P,classes:p,allDayRow:$,expandAllDayRow:f=!1})=>{let{stickyViewHeader:z,viewHeaderClassName:b}=G((Z)=>({stickyViewHeader:Z.stickyViewHeader,viewHeaderClassName:Z.viewHeaderClassName})),Y="min-w-full w-fit";return N4("div",{className:q(f&&"flex h-full flex-col",z&&"sticky top-0 z-21 bg-background",b),children:[h2("div",{className:q("min-h-12 border-b","min-w-full w-fit",p?.header),"data-testid":"vertical-grid-header",children:P}),$&&h2("div",{className:q("flex min-h-12 border-b","min-w-full w-fit",f&&"flex-1 overflow-hidden",p?.allDay),"data-testid":"vertical-grid-all-day",children:$})]})},j2=q4(U4);import{jsx as Y0,jsxs as o2}from"react/jsx-runtime";var i2=({columns:P,children:p,gridType:$="day",variant:f="resource",classes:z,allDayRow:b,slotDurationMinutes:Y,style:Z})=>{let J=f==="resource",U=!J,Q=P.every((A)=>!A.days?.length),{currentDate:X,view:N,scrollTime:M}=G(),F=K4(null);m0({viewportRef:F,scrollTime:M,enabled:$==="hour"&&!Q,scrollKey:`${N}-${X.format("YYYY-MM-DD")}`});let K=p&&Y0(j2,{allDayRow:b,classes:{header:z?.header,allDay:z?.allDay},expandAllDayRow:Q,children:p});if(Q&&K)return Y0("div",{className:"h-full flex flex-col","data-testid":"vertical-grid-container",style:Z,children:K});return o2("div",{className:"h-full flex flex-col","data-testid":"vertical-grid-container",style:Z,children:[U&&K,o2(d,{className:q("h-full",U&&"overflow-auto"),"data-testid":"vertical-grid-scroll",viewPortProps:{className:"*:flex! *:flex-col! *:min-h-full *:w-max",ref:F},children:[J&&K,Y0("div",{className:q("relative flex flex-1 min-w-full w-fit gap-px bg-border",z?.body),"data-calendar-scroll-content":"true","data-testid":"vertical-grid-body",children:P.map((A,V)=>Y0(y2,{...A,gridType:$,slotDurationMinutes:Y},k.listKey(A.id,V)))}),Y0(b0,{className:"z-30"})," ",Y0(b0,{className:"z-30",orientation:"horizontal"})," "]})]})};import{jsx as t}from"react/jsx-runtime";var L4=(P,p)=>p==="vertical",_4=({specs:P,header:p,composesResourceAxis:$,variant:f})=>{let{slotDuration:z}=G((N)=>({slotDuration:N.slotDuration})),b=P.some((N)=>N.gridType==="hour")?"hour":"day",Y=P.filter((N)=>!N.noEvents).map((N)=>N.day).filter((N)=>Boolean(N)),Z=P.find((N)=>N.noEvents),U=Boolean(Z?.className?.includes(pP))?{cell:"flex-1 min-w-0",spacer:pP}:void 0,Q;if(b==="hour")Q=$?t(d2,{columns:P}):t(c2,{classes:U,days:Y});return t(i2,{allDayRow:Q,classes:$?void 0:{header:"w-full",body:"w-full",allDay:"w-full"},columns:P,gridType:b,slotDurationMinutes:z,variant:f,children:p})},G4=({specs:P,header:p,composesResourceAxis:$,variant:f})=>{let z=P.some((Z)=>Z.columns?.some((J)=>J.gridType==="hour"))?"hour":"day",b=P.some((Z)=>Z.columns?.some((J)=>J.days)),Y=$?{header:q(b&&x2,"min-w-full"),body:"min-w-full"}:{body:"w-full",header:"w-full"};return t(k2,{classes:Y,dayNumberHeight:$?0:void 0,gridType:z,rows:P,variant:f,children:p})},r2=({view:P})=>{let{currentDate:p,firstDayOfWeek:$,hiddenDays:f,businessHours:z,hideNonBusinessHours:b,resources:Y,orientation:Z,weekViewGranularity:J}=G((K)=>({currentDate:K.currentDate,firstDayOfWeek:K.firstDayOfWeek,hiddenDays:K.hiddenDays,businessHours:K.businessHours,hideNonBusinessHours:K.hideNonBusinessHours,resources:K.resources,orientation:K.orientation,weekViewGranularity:K.weekViewGranularity})),U=u2(()=>({firstDayOfWeek:$,hiddenDays:f,businessHours:z,hideNonBusinessHours:b,resources:Y,orientation:Z,weekViewGranularity:J}),[$,f,z,b,Y,Z,J]),Q=u2(()=>P.columns?.(p,U),[P,p,U]);if(!Q||!P.layout){let K=P.component;if(K)return t(K,{});if(typeof process<"u"&&!1)console.warn(`[@ilamy/calendar] view "${P.name}" declares neither \`columns\` + \`layout\` nor \`component\` — rendering nothing.`);return null}let N=Boolean(Y?.length)&&Boolean(P.supportsResources),M=N?Z??"horizontal":P.layout,F=N?"resource":"regular",W=P.renderHeader?.({date:p,config:U});if(L4(Q,M))return t(_4,{composesResourceAxis:N,header:W,specs:Q,variant:F});return t(G4,{composesResourceAxis:N,header:W,specs:Q,variant:F})};var n2=(P)=>{if(!P||P.length===0)return;return new Set(P.map((p)=>T0[p]))};function l2(P){if(!P||!P.length)return[];return P.map((p)=>{return{...p,start:_.isDayjs(p.start)?p.start:_(p.start),end:_.isDayjs(p.end)?p.end:_(p.end)}})}import{jsx as n,jsxs as V4}from"react/jsx-runtime";var A4=()=>{let{view:P,getViews:p}=G((z)=>({view:z.view,getViews:z.getViews})),$=p().find((z)=>z.name===P);return V4("div",{className:"flex flex-col w-full h-full","data-testid":"ilamy-calendar",children:[n(O2,{className:"p-1 shrink-0 mb-1"}),n(BP,{children:n(a2,{className:"w-full min-h-0 flex-1",direction:"horizontal",transitionKey:P,children:n("div",{className:"border h-full w-full","data-calendar-viewport":"true","data-testid":"calendar-body",children:$?n(r2,{view:$},P):null})})}),n(b2,{})]})},$P=({events:P,firstDayOfWeek:p="sunday",initialView:$="month",initialDate:f,eventSpacing:z=t2,eventHeight:b=s2,stickyViewHeader:Y=!0,viewHeaderClassName:Z="",timeFormat:J="12-hour",hideNonBusinessHours:U=!1,hiddenDays:Q,resources:X,orientation:N,...M})=>{let F=Boolean(X?.length),W=F4(()=>l2(P),[P]);return M4(()=>{if(typeof process<"u"&&!1)console.warn("[@ilamy/calendar] `orientation` was provided without `resources` — it only applies when the calendar has resources, so it is ignored.")},[N,F]),n(e2,{eventHeight:b,eventSpacing:z,events:W,firstDayOfWeek:T0[p],hiddenDays:n2(Q),hideNonBusinessHours:U,initialDate:wP(f),initialView:$,orientation:N,resources:X,stickyViewHeader:Y,timeFormat:J,viewHeaderClassName:Z,...M,children:n(A4,{})})};import{jsx as B4}from"react/jsx-runtime";var W4=(P)=>B4($P,{...P});export{O4 as useIlamyCalendarContext,I4 as defaultTranslations,_ as dayjs,KP as SLOT_EVENT_MUTATION_SCOPE,NP as SLOT_EVENT_FORM,W4 as IlamyResourceCalendar,$P as IlamyCalendar};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{L as a5}from"./chunk-jfadfww5.js";import y from"dayjs";import C1 from"dayjs/plugin/isBetween.js";import m1 from"dayjs/plugin/isSameOrAfter.js";import D1 from"dayjs/plugin/isSameOrBefore.js";import x1 from"dayjs/plugin/localeData.js";import E1 from"dayjs/plugin/localizedFormat.js";import p1 from"dayjs/plugin/minMax.js";import v1 from"dayjs/plugin/timezone.js";import g1 from"dayjs/plugin/utc.js";import y1 from"dayjs/plugin/weekday.js";import c1 from"dayjs/plugin/weekOfYear.js";var B5,l1=(Q,q,J)=>{let Z=q.prototype,$=J.tz.setDefault;J.tz.setDefault=(B)=>{return B5=B,$(B)};let{startOf:P,endOf:X}=Z;function K(B,z){let U=B.$x?.$timezone||B5;if(!U)return z;let V=J.tz(z.format("YYYY-MM-DDTHH:mm:ss"),U).utcOffset();if(z.utcOffset()!==V)return z.tz(U,!0);return z}Z.startOf=function(B,z){let U=P.call(this,B,z);return K(this,U)},Z.endOf=X};y.extend(y1);y.extend(c1);y.extend(m1);y.extend(D1);y.extend(C1);y.extend(p1);y.extend(v1);y.extend(g1);y.extend(x1);y.extend(E1);y.extend(l1);var L5=(...Q)=>{return y.tz(...Q)};Object.assign(L5,y);var j=L5;import{useContext as i1}from"react";import{createContext as u1}from"react";var b0=u1(void 0);var d1=[];function S(Q){let q=i1(b0);if(!q)throw Error("useSmartCalendarContext must be used within a CalendarProvider");return Q?Q(q):q}function yQ(){let Q=S();return{currentDate:Q.currentDate,currentRange:Q.currentRange,view:Q.view,events:Q.events,rawEvents:Q.rawEvents,isEventFormOpen:Q.isEventFormOpen,selectedEvent:Q.selectedEvent,selectedDate:Q.selectedDate,firstDayOfWeek:Q.firstDayOfWeek,resources:Q.resources??d1,orientation:Q.orientation,setCurrentDate:Q.setCurrentDate,selectDate:Q.selectDate,setView:Q.setView,nextPeriod:Q.nextPeriod,prevPeriod:Q.prevPeriod,today:Q.today,addEvent:Q.addEvent,updateEvent:Q.updateEvent,deleteEvent:Q.deleteEvent,openEventForm:Q.openEventForm,closeEventForm:Q.closeEventForm,onEventClick:Q.onEventClick,renderCurrentTimeIndicator:Q.renderCurrentTimeIndicator,getEventsForResource:Q.getEventsForResource,businessHours:Q.businessHours,t:Q.t,timeFormat:Q.timeFormat,timezone:Q.timezone,currentLocale:Q.currentLocale,getEventsForDateRange:Q.getEventsForDateRange,applyScopedEdit:Q.applyScopedEdit,applyScopedDelete:Q.applyScopedDelete,getEventManager:Q.getEventManager,renderSlot:Q.renderSlot,collect:Q.collect,getViews:Q.getViews}}var G5={today:"Today",create:"Create",new:"New",update:"Update",delete:"Delete",cancel:"Cancel",export:"Export",previous:"Previous",next:"Next",event:"Event",events:"Events",newEvent:"New Event",title:"Title",description:"Description",location:"Location",allDay:"All day",startDate:"Start Date",endDate:"End Date",startTime:"Start Time",searchTime:"Search time...",endTime:"End Time",color:"Color",createEvent:"Create Event",editEvent:"Edit Event",addNewEvent:"Add a new event to your calendar",editEventDetails:"Edit your event details",eventTitlePlaceholder:"Event title",eventDescriptionPlaceholder:"Event description (optional)",eventLocationPlaceholder:"Event location (optional)",repeat:"Repeat",repeats:"Repeats",customRecurrence:"Custom recurrence",frequency:"Frequency",everyWeekday:"Every weekday",weeklyOn:"Weekly on",monthlyOnDay:"Monthly on day",monthlyOnThe:"Monthly on the",first:"first",second:"second",third:"third",fourth:"fourth",last:"last",daily:"Daily",weekly:"Weekly",monthly:"Monthly",yearly:"Yearly",interval:"Interval",repeatOn:"Repeat on",never:"Never",count:"Count",every:"Every",ends:"Ends",after:"After",occurrences:"occurrences",on:"On",editRecurringEvent:"Edit recurring event",deleteRecurringEvent:"Delete recurring event",editRecurringEventQuestion:"is a recurring event. How would you like to edit it?",deleteRecurringEventQuestion:"is a recurring event. How would you like to delete it?",thisEvent:"This event",thisEventDescription:"Only change this specific occurrence",thisAndFollowingEvents:"This and following events",thisAndFollowingEventsDescription:"Edit this and all future occurrences",allEvents:"All events",allEventsDescription:"Edit the entire recurring series",onlyChangeThis:"Only change this specific occurrence",changeThisAndFuture:"Change this and all future occurrences",changeEntireSeries:"Change the entire recurring series",onlyDeleteThis:"Only delete this specific occurrence",deleteThisAndFuture:"Delete this and all future occurrences",deleteEntireSeries:"Delete the entire recurring series",month:"Month",week:"Week",day:"Day",year:"Year",agenda:"Agenda",agendaNoEvents:"No upcoming events",more:"more",resources:"Resources",resource:"Resource",selectResource:"Select a resource",time:"Time",date:"Date",noResourcesVisible:"No resources visible",addResourcesOrShowExisting:"Add resources or show existing ones"};import{useMemo as MQ}from"react";import{useEffect as M1,useMemo as R1,useRef as S1}from"react";import{useMemo as W5,useState as o1}from"react";var F5=1,A5=24,U5=24,V5=4,O5="bg-[color-mix(in_oklch,var(--background),var(--foreground)_3%)] text-muted-foreground pointer-events-none",_5={sunday:0,monday:1,tuesday:2,wednesday:3,thursday:4,friday:5,saturday:6},E=0.05,N5=0.005,w0="h-12",uQ="h-24";var M5=({firstDayOfWeek:Q,dayMaxEvents:q=V5,businessHours:J,locale:Z,translations:$,translator:P,resources:X,orientation:K="horizontal",weekViewGranularity:B="hourly"})=>{let[z,U]=o1(Z||"en"),V=W5(()=>{if(P)return P;let O=$||G5;return(A)=>O[A]||A},[$,P]);return W5(()=>({firstDayOfWeek:Q,dayMaxEvents:q,businessHours:J,currentLocale:z,setCurrentLocale:U,t:V,resources:X,orientation:K,weekViewGranularity:B}),[Q,q,J,z,V,X,K,B])};import{useCallback as d,useEffect as r1,useMemo as R5,useRef as n1,useState as a1}from"react";var U0=(Q)=>{if(Q.resourceIds)return Q.resourceIds;if(Q.resourceId!==void 0)return[Q.resourceId];return[]};function K0(Q,q){return Q.filter((J)=>U0(J).includes(q))}function f0(Q,q,J){let Z=Q.start.isSameOrAfter(q)&&Q.start.isSameOrBefore(J),$=Q.end.isSameOrAfter(q)&&Q.end.isSameOrBefore(J),P=Q.start.isBefore(q)&&Q.end.isAfter(J);return Z||$||P}var S5=(Q)=>!Array.isArray(Q),H5=(Q,{onEventUpdate:q,onEventAdd:J,onEventDelete:Z,setCurrentEvents:$})=>{for(let P of Q.updated)q?.(P);for(let P of Q.added)J?.(P);for(let P of Q.deleted)Z?.(P);$(Q.events)},I5=({events:Q,pluginRuntime:q,getCurrentViewRange:J,resources:Z,onEventAdd:$,onEventUpdate:P,onEventDelete:X})=>{let[K,B]=a1(Q),z=n1(Q),U=d((L,_)=>q.transformEvents(K,{start:L,end:_}),[K,q]),V=R5(()=>{let{start:L,end:_}=J();return U(L,_)},[U,J]);r1(()=>{if(Q!==z.current)B(Q),z.current=Q},[Q]);let O=d((L)=>{B((_)=>[..._,L]),$?.(L)},[$]),A=d((L,_)=>{let I=K.find((w)=>w.id===L);if(!I)return;let H={...I,..._};B((w)=>w.map((k)=>k.id===L?H:k)),P?.(H)},[K,P]),R=d((L,_,I)=>{let H=q.getEventManager(L);if(!H?.applyEdit)return;let w=H.applyEdit({event:L,updates:_,currentEvents:K,scope:I});if(S5(w)){H5(w,{onEventUpdate:P,onEventAdd:$,onEventDelete:X,setCurrentEvents:B});return}P?.({...L,..._}),B(w)},[K,$,P,X,q]),Y=d((L,_)=>{let I=q.getEventManager(L);if(!I?.applyDelete)return;let H=I.applyDelete({event:L,currentEvents:K,scope:_});if(S5(H)){H5(H,{onEventUpdate:P,onEventAdd:$,onEventDelete:X,setCurrentEvents:B});return}X?.(L),B(H)},[K,$,P,X,q]),W=d((L)=>{let _=K.find((I)=>I.id===L);if(!_)return;B((I)=>I.filter((H)=>H.id!==L)),X?.(_)},[K,X]),N=d((L)=>K0(V,L),[V]),T=d((L)=>V.filter((_)=>U0(_).some((I)=>L.includes(I))),[V]),M=d((L)=>{if(L===void 0)return;return Z.find((_)=>_.id===L)},[Z]),b=d((L)=>{return Boolean(L.resourceIds&&L.resourceIds.length>1)},[]);return R5(()=>({events:V,rawEvents:K,setCurrentEvents:B,getEventsForDateRange:U,addEvent:O,updateEvent:A,deleteEvent:W,applyScopedEdit:R,applyScopedDelete:Y,getEventsForResource:N,getEventsForResources:T,getResourceById:M,isEventCrossResource:b}),[V,K,U,O,A,W,R,Y,N,T,M,b])};import{useCallback as V0,useMemo as t1,useState as r0}from"react";var s1=(Q)=>Q,T5=({currentDate:Q,t:q,disableEventClick:J,disableCellClick:Z,onEventClick:$,onCellClick:P})=>{let[X,K]=r0(!1),[B,z]=r0(null),[U,V]=r0(null),O=V0((N={})=>{let{start:T,end:M,resourceId:b,resource:L,allDay:_}=N;if(T)V(T);let I=T??Q;z(s1({title:q("newEvent"),start:I,end:M??I.add(1,"hour"),resourceId:b??L?.id,description:"",allDay:_??!1})),K(!0)},[Q,q]),A=V0(()=>{V(null),z(null),K(!1)},[]),R=V0((N)=>{z(N),K(!0)},[]),Y=V0((N)=>{if(J)return;if($)$(N);else R(N)},[J,$,R]),W=V0((N)=>{if(Z)return;if(P)P(N);else O(N)},[P,Z,O]);return t1(()=>({isEventFormOpen:X,selectedEvent:B,selectedDate:U,setIsEventFormOpen:K,setSelectedEvent:z,setSelectedDate:V,openEventForm:O,closeEventForm:A,handleEventClick:Y,handleDateClick:W}),[X,B,U,O,A,Y,W])};import{useCallback as l,useMemo as FQ,useRef as AQ,useState as UQ}from"react";import{clsx as e1}from"clsx";import{twMerge as Q2}from"tailwind-merge";function G(...Q){return Q2(e1(Q))}import{Square as l2}from"lucide-react";import{AnimatePresence as q2,motion as J2}from"motion/react";import{jsx as b5}from"react/jsx-runtime";var Z2={hidden:({direction:Q})=>({opacity:0,x:Q==="horizontal"?10:0,y:Q==="vertical"?-10:0}),visible:({delay:Q})=>({opacity:1,x:0,y:0,transition:{duration:0.2,ease:[0.4,0,0.2,1],delay:Q}}),exit:({direction:Q})=>({opacity:0,x:Q==="horizontal"?-10:0,y:Q==="vertical"?-10:0,transition:{duration:0.15}})},h=({children:Q,transitionKey:q,delay:J=0,className:Z,direction:$="vertical",layout:P,layoutId:X,"data-testid":K,ref:B,...z})=>b5(q2,{mode:"wait",children:b5(J2.div,{animate:"visible",className:G("inline-block w-full",Z),custom:{delay:J,direction:$},"data-testid":K,exit:"exit",initial:"hidden",layout:P,layoutId:X,ref:B,variants:Z2,...z,children:Q},q)});h.displayName="AnimatedSection";import{jsx as f5,Fragment as w5}from"react/jsx-runtime";var j0=({date:Q})=>{let{renderHour:q,timeFormat:J}=S();if(q)return f5(w5,{children:q(Q)});return f5(w5,{children:Q.format(J==="12-hour"?"h A":"H")})};function C(Q){return Q.isSame(j(),"day")}function D(Q){return Q.format("YYYY-MM-DD")}function p(Q,q){let J=Q.startOf("week").day(q),Z=Q.isBefore(J)?J.subtract(1,"week"):J;return Array.from({length:7},($,P)=>Z.add(P,"day"))}function n0(Q,q){let J=Q.startOf("month"),$=p(J,q).at(0)??J;return Array.from({length:6},(P,X)=>{let K=$.add(X,"week");return p(K,q)})}function h0(Q){let q=Q.daysInMonth(),J=Q.startOf("month");return Array.from({length:q},(Z,$)=>J.add($,"day"))}function j5({referenceDate:Q=j(),length:q=24}={}){let J=Q.startOf("day");return Array.from({length:q},(Z,$)=>J.hour($).minute(0).second(0).millisecond(0))}var k0=(Q,q)=>{let J=n0(Q,q),Z=J.at(0)?.at(0)??Q,$=J.at(-1)?.at(-1)??Q;return{start:Z.startOf("day"),end:$.endOf("day")}};var z0=(Q)=>String(Q).padStart(2,"0"),$2=(Q)=>typeof Q==="number"?z0(Q):Q,F={col:{time:"time-col",date:"date-col",day:(Q,q)=>{let J=`day-col-${D(Q)}`;return q!=null?`${J}-resource-${q}`:J},resource:(Q,q)=>`${Q}-col-resource-${q}`,allDay:(Q,q)=>`all-day-col-${D(Q)}-${q}`},cell:{day:(Q,q,J=0)=>{let Z=D(Q);return q!=null?`day-cell-${Z}-${z0(q)}-${z0(J)}`:`day-cell-${Z}`},verticalTime:(Q)=>`vertical-time-${z0(Q)}`,vertical:(Q,q,J,Z)=>{let $=`vertical-cell-${D(Q)}-${z0(q)}-${z0(J)}`;return Z!=null?`${$}-resource-${Z}`:$}},container:{vertical:{col:(Q)=>`vertical-col-${Q}`},horizontal:{row:(Q)=>`horizontal-row-${Q}`,rowLabel:(Q)=>`horizontal-row-label-${Q}`,event:(Q)=>`horizontal-event-${Q}`},eventsLayer:(Q,q)=>`${Q}-events-${q}`},header:{resource:{weekDay:"resource-week-day-header",columnsHeader:"resource-columns-header",monthDay:(Q)=>`resource-month-header-${Q.toISOString()}`,timeLabel:(Q,q)=>`resource-${Q}-time-label-${$2(q)}`},weekday:(Q,q)=>`${Q}-header-weekday-${q.toLowerCase()}`,week:{day:(Q)=>`week-header-day-${Q.toISOString()}`,hour:(Q,q)=>`week-header-hour-${Q.toISOString()}-${q}`,resource:(Q)=>`week-header-resource-${Q}`},year:{month:(Q,q)=>q?`year-month-${q}-${Q}`:`year-month-${Q}`,day:(Q,q)=>`year-day-${Q}-${q}`}},allDayRow:(Q)=>`allday-row-${Q??"main"}`,listKey:(...Q)=>Q.join("-"),dayNumber:(Q)=>C(Q)?"day-number-today":`day-number-${Q.format("D")}`,timePicker:(Q)=>`time-picker-${Q??""}`,droppable:{dayCell:(Q,q)=>{let J=Q.toISOString(),Z=q?.allDay?"-allday":"",$=q?.resourceId!=null?`-resource-${q.resourceId}`:"";return`drop-day-cell-${J}${Z}${$}`}}};import{jsx as h5}from"react/jsx-runtime";var $0="w-16 min-w-16 max-w-16",k5="w-[calc(100%-4rem)]",a0="w-10 sm:w-16 min-w-10 sm:min-w-16 max-w-10 sm:max-w-16",u="shadow-[1px_0_0_0_color-mix(in_oklch,var(--background),var(--foreground)_10%)]",s=({days:Q,gridType:q,renderLabel:J,widthClassName:Z=$0})=>({id:q==="hour"?F.col.time:F.col.date,day:void 0,days:Q,className:G("shrink-0",Z,"sticky left-0 bg-background z-20",u),gridType:q,noEvents:!0,renderCell:($)=>h5("div",{className:"text-muted-foreground p-2 text-right text-[10px] sm:text-xs flex flex-col items-center",children:J?J($):h5(j0,{date:$})})});var P2=(Q,q)=>{if(!q)return!0;let J=!1;return C0(q,{date:Q,onMatch:()=>{J=!0}}),J},C5=({date:Q,hour:q,minute:J=0,businessHours:Z})=>{if(!Z)return!0;if(q===void 0)return P2(Q,Z);let $=!1,P=q*60+J;return C0(Z,{date:Q,onMatch:(X)=>{let K=X.startTime??9,B=X.endTime??17,z=K*60,U=B*60;if(P>=z&&P<U)$=!0}}),$},C0=(Q,q)=>{let{date:J,onMatch:Z}=q;if(!Q)return;let $=Array.isArray(Q)?Q:[Q];for(let P of $)if(J&&P.daysOfWeek){let X=J.day();if(P.daysOfWeek.some((K)=>_5[K]===X))Z(P)}else Z(P)},m5=(Q)=>{let{allDates:q,businessHours:J,resourceBusinessHours:Z=[],hideNonBusinessHours:$}=Q,P=24,X=0,K=!1,B=(U)=>{K=!0,P=Math.min(P,U.startTime??9),X=Math.max(X,U.endTime??17)},z=(U)=>{C0(J,{date:U,onMatch:B});for(let V of Z)C0(V,{date:U,onMatch:B})};for(let U of q)z(U);if(!K&&$){if(z(),!K)P=9,X=17,K=!0}return{minStart:P,maxEnd:X,hasBusinessHours:K}};function m0(Q){return Q.flatMap((q)=>q.businessHours?[q.businessHours]:[])}function D0({referenceDate:Q,businessHours:q,hideNonBusinessHours:J,allDates:Z=[Q],resourceBusinessHours:$=[]}){let P=j5({referenceDate:Q}),X=Boolean(q)||$.length>0;if(!(J&&X))return P;let{minStart:B,maxEnd:z,hasBusinessHours:U}=m5({allDates:Z,businessHours:q,resourceBusinessHours:$,hideNonBusinessHours:J});if(!U)return P;if(B>=z)return[];return P.filter((V)=>{let O=V.hour();return O>=B&&O<z})}import{memo as X2}from"react";import{jsx as D5}from"react/jsx-runtime";var Y2=({className:Q})=>{let{t:q}=S();return D5("div",{className:G("w-16 shrink-0 sticky left-0 bg-background z-20 flex items-center justify-center px-1 text-xs text-muted-foreground",u,Q),children:D5("span",{className:"truncate",children:q("allDay")})})},x0=X2(Y2);import{memo as g2}from"react";import{memo as e5,useMemo as E2}from"react";import{useMemo as s0}from"react";var K2=(Q,q)=>{let J=Q.filter((X)=>X.end.diff(X.start,q)>0),Z=Q.filter((X)=>X.end.diff(X.start,q)===0),$=[...J].sort((X,K)=>{let B=X.start.diff(K.start);if(B!==0)return B;return K.end.diff(K.start)-X.end.diff(X.start)}),P=[...Z].sort((X,K)=>X.start.diff(K.start));return{sortedMultiUnit:$,sortedSingleUnit:P}},x5=(Q,{firstUnit:q,lastUnit:J,unitCount:Z,gridType:$})=>{let P=j.max(Q.start.startOf($),q),X=$==="hour"?Q.end.subtract(1,"minute"):Q.end,K=j.min(X.startOf($),J);return{startCol:Math.max(0,P.diff(q,$)),endCol:Math.min(Z-1,K.diff(q,$)),isTruncatedStart:Q.start.startOf($).isBefore(q),isTruncatedEnd:Q.end.startOf($).isAfter(J)}},t0=(Q,q,J)=>{for(let Z=0;Z<Q.length;Z++){let $=!0;for(let P=q;P<=J;P++)if(Q[Z][P]){$=!1;break}if($)return Z}return-1},E5=({days:Q,events:q,dayMaxEvents:J,gridType:Z="day"})=>{let $=Q.at(0),P=Q.at(-1);if(!$||!P)return[];let X={firstUnit:Z==="hour"?$.startOf("hour"):$.startOf("day"),lastUnit:Z==="hour"?P.endOf("hour"):P.endOf("day"),unitCount:Q.length,gridType:Z},{sortedMultiUnit:K,sortedSingleUnit:B}=K2(q,Z),z=Array.from({length:J},()=>Array.from({length:X.unitCount},()=>!1)),U=[],V=({row:O,startCol:A,endCol:R,event:Y,isTruncatedStart:W,isTruncatedEnd:N})=>{for(let M=A;M<=R;M++)z[O][M]=!0;let T=R-A+1;U.push({kind:"horizontal",event:Y,left:A/X.unitCount*100,width:T/X.unitCount*100,row:O,isTruncatedStart:W,isTruncatedEnd:N})};for(let O of K){let A=x5(O,X),R=t0(z,A.startCol,A.endCol);if(R!==-1){V({row:R,event:O,...A});continue}for(let Y=A.startCol+1;Y<=A.endCol;Y++){let W=t0(z,Y,A.endCol);if(W!==-1){V({row:W,startCol:Y,endCol:A.endCol,event:O,isTruncatedStart:!0,isTruncatedEnd:A.isTruncatedEnd});break}}}for(let O of B){let R=x5(O,X).startCol,Y=t0(z,R,R);if(Y!==-1)V({row:Y,startCol:R,endCol:R,event:O,isTruncatedStart:!1,isTruncatedEnd:!1})}return U};var e0=({days:Q,allDay:q,resourceId:J,gridType:Z})=>{let{getEventsForDateRange:$,dayMaxEvents:P}=S(),X=Q.at(0),K=Q.at(-1),B=X?.startOf("day"),z=K?.endOf("day"),U=s0(()=>{if(!B||!z)return[];let A=$(B,z);if(J)A=K0(A,J);if(q)A=A.filter((R)=>Boolean(R.allDay));return A},[$,B,z,J,q]),V=s0(()=>{let A=new Map;for(let R of Q){let Y=D(R),W=R.startOf("day"),N=R.endOf("day"),T=U.filter((M)=>f0(M,W,N));A.set(Y,T)}return A},[Q,U]);return{positionedEvents:s0(()=>{return E5({days:Q,events:U,dayMaxEvents:P,gridType:Z})},[Q,P,U,Z]),dayEventsMap:V}};import{jsx as p5,jsxs as z2}from"react/jsx-runtime";var c=({today:Q,dayNumber:q,weekday:J,className:Z,"data-testid":$})=>{return z2("div",{className:G("flex flex-col items-center",Z),"data-testid":$,"data-today":Q?"true":void 0,children:[J!=null&&p5("div",{className:G("w-full truncate text-center text-xs text-muted-foreground",Q&&"text-primary"),children:J}),p5("div",{className:G("flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-xs font-medium",Q&&"bg-primary text-primary-foreground"),children:q})]})};import H2,{memo as I2,useMemo as T2}from"react";import{useMemo as B2}from"react";var v5=(Q)=>{let{businessHours:q,getResourceById:J}=S((Z)=>({businessHours:Z.businessHours,getResourceById:Z.getResourceById}));return B2(()=>{if(Q!=null){let Z=J(Q);if(Z?.businessHours)return Z.businessHours}return q},[Q,J,q])};import*as x from"@radix-ui/react-dialog";import{XIcon as L2}from"lucide-react";import{jsx as o,jsxs as Q5}from"react/jsx-runtime";function g5({...Q}){return o(x.Root,{"data-slot":"dialog",...Q})}function G2({...Q}){return o(x.Portal,{"data-slot":"dialog-portal",...Q})}function F2({className:Q,...q}){return o(x.Overlay,{className:G("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",Q),"data-slot":"dialog-overlay",...q})}function y5({className:Q,children:q,...J}){return Q5(G2,{"data-slot":"dialog-portal",children:[o(F2,{}),Q5(x.Content,{className:G("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg max-h-[90%]",Q),"data-slot":"dialog-content",...J,children:[q,Q5(x.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[o(L2,{}),o("span",{className:"sr-only",children:"Close"})]})]})]})}function c5({className:Q,...q}){return o("div",{className:G("flex flex-col gap-2 text-center sm:text-left",Q),"data-slot":"dialog-header",...q})}function r9({className:Q,...q}){return o("div",{className:G("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",Q),"data-slot":"dialog-footer",...q})}function l5({className:Q,...q}){return o(x.Title,{className:G("text-lg leading-none font-semibold",Q),"data-slot":"dialog-title",...q})}function n9({className:Q,...q}){return o(x.Description,{className:G("text-muted-foreground text-sm",Q),"data-slot":"dialog-description",...q})}import{useImperativeHandle as N2,useState as u5}from"react";import{useDraggable as A2}from"@dnd-kit/core";import{memo as U2}from"react";import{jsx as O0,jsxs as _2}from"react/jsx-runtime";var V2=(Q,q)=>{if(Q&&q)return"rounded-none";if(Q)return"rounded-r-md rounded-l-none";if(q)return"rounded-l-md rounded-r-none";return"rounded-md"};function O2({elementId:Q,event:q,className:J,style:Z,disableDrag:$=!1,isTruncatedStart:P=!1,isTruncatedEnd:X=!1}){let{onEventClick:K,renderEvent:B,disableEventClick:z,disableDragAndDrop:U}=S(),{attributes:V,listeners:O,setNodeRef:A,isDragging:R}=A2({id:Q,data:{event:q,type:"calendar-event"},disabled:$||U}),Y=()=>{return _2("div",{className:G(q.backgroundColor||"bg-blue-500",q.color||"text-white","h-full w-full px-1 border-[1.5px] border-card text-left overflow-clip relative",V2(P,X)),style:{backgroundColor:q.backgroundColor,color:q.color},children:[P&&O0("div",{className:"absolute left-0 top-0 bottom-0 w-0.5 bg-foreground/25"}),O0("p",{className:G("text-[10px] font-semibold sm:text-xs mt-0.5",P&&"pl-1",X&&"pr-1"),children:q.title}),X&&O0("div",{className:"absolute right-0 top-0 bottom-0 w-0.5 bg-foreground/25"})]})},W=$||U;return O0(h,{className:G("truncate h-full w-full",W?z?"cursor-default":"cursor-pointer":"cursor-grab",R&&!W&&"cursor-grabbing shadow-lg",J),layout:!0,layoutId:Q,onClick:(b)=>{b.stopPropagation(),K(q)},ref:A,style:Z,transitionKey:Q,...V,...O,children:B?B(q):O0(Y,{})})}var E0=U2(O2,(Q,q)=>{return Q.elementId===q.elementId&&Q.disableDrag===q.disableDrag&&Q.className===q.className&&Q.event===q.event&&Q.isTruncatedStart===q.isTruncatedStart&&Q.isTruncatedEnd===q.isTruncatedEnd});import{jsx as _0,jsxs as W2}from"react/jsx-runtime";var i5=({ref:Q})=>{let[q,J]=u5(!1),[Z,$]=u5(null),{eventHeight:P}=S();return N2(Q,()=>({open:()=>J(!0),close:()=>J(!1),setSelectedDayEvents:(X)=>$(X)})),_0(g5,{onOpenChange:J,open:q,children:W2(y5,{className:"max-h-[80vh] max-w-md overflow-y-auto",children:[_0(c5,{children:_0(l5,{children:Z?.day.format("MMMM D, YYYY")})}),_0("div",{className:"mt-4 space-y-3",children:Z?.events.map((X)=>{return _0(E0,{className:"relative my-1",elementId:`all-events-dialog-event-${X.id}`,event:X,style:{height:`${P}px`}},X.id)})})]})})};import{useDroppable as M2}from"@dnd-kit/core";import{jsx as S2}from"react/jsx-runtime";function R2(Q,q,J){let Z=Q.hour(q??0).minute(J??0);if(q!==void 0&&J!==void 0)return{start:Z,end:Z.minute(J+15)};if(q!==void 0)return{start:Z,end:Z.hour(q+1).minute(0)};return{start:Z,end:Z.hour(23).minute(59)}}function d5({id:Q,type:q,date:J,hour:Z,minute:$,resourceId:P,allDay:X,children:K,className:B,style:z,"data-testid":U,disabled:V=!1}){let{onCellClick:O,isCellDisabled:A,getCellClassName:R,getResourceById:Y,disableDragAndDrop:W,disableCellClick:N,classesOverride:T,view:M}=S(),{start:b,end:L}=R2(J,Z,$),_=Y?.(P),I={start:b,end:L,resource:_,allDay:X},H=V||Boolean(A?.(I)),w=N||H,{isOver:k,setNodeRef:n}=M2({id:Q,data:{type:q,date:J,hour:Z,minute:$,resourceId:P,allDay:X},disabled:W||H}),a=(Z0)=>{if(Z0.stopPropagation(),w)return;O(I)},f=k&&!W&&!H,m=T?.disabledCell||O5,Y0=R?.(I);return S2("div",{className:G("droppable-cell",B,Y0,f&&"bg-accent",w?"cursor-default":"cursor-pointer",H&&m),"data-all-day":X?"true":void 0,"data-disabled":H.toString(),"data-end":L.toISOString(),"data-resource-id":P,"data-start":b.toISOString(),"data-testid":U,"data-view":M,onClick:a,ref:n,style:z,children:K})}import{jsx as p0,jsxs as v0,Fragment as o5}from"react/jsx-runtime";var b2=({day:Q,hour:q,minute:J,className:Z="",resourceId:$,gridType:P="day",shouldRenderEvents:X=!0,allDay:K=!1,precomputedEvents:B,"data-testid":z,showDayNumber:U=!1,children:V})=>{let O=H2.useRef(null),{dayMaxEvents:A=0,getEventsForDateRange:R,currentDate:Y,t:W,eventSpacing:N,eventHeight:T,onMoreEventsClick:M}=S(),b=v5($),L=T2(()=>{if(!X)return[];if(B)return B;let f=R(Q.startOf(P),Q.endOf(P));if(K)f=f.filter((m)=>m.allDay);if($)return K0(f,$);return f},[B,Q,$,R,P,X,K]),_=(f,m)=>{if(M){M(f,m);return}O.current?.setSelectedDayEvents({day:f,events:m}),O.current?.open()},I=Q.month()===Y.month(),H=L.length-A,w=H>0,k=C5({date:Q,hour:P==="hour"?Q.hour():void 0,businessHours:b}),n=P==="hour"?F.cell.day(Q,Q.format("HH"),Q.format("mm")):F.cell.day(Q),a=F.droppable.dayCell(Q,{allDay:K,resourceId:$});return v0(o5,{children:[p0(d5,{allDay:K,className:G("cursor-pointer overflow-clip p-1 bg-background hover:bg-accent min-h-[60px] relative min-w-0",Z),"data-testid":z||n,date:Q,disabled:!k||!I,hour:q,id:a,minute:J,resourceId:$,type:"day-cell",children:v0("div",{className:"flex flex-col h-full w-full","data-testid":"grid-cell-content",style:{gap:`${N}px`},children:[U&&p0(c,{className:"items-start","data-testid":F.dayNumber(Q),dayNumber:Q.format("D"),today:C(Q)}),X&&v0(o5,{children:[L.slice(0,A).map((f,m)=>p0("div",{className:"w-full shrink-0","data-testid":f?.title,style:{height:`${T}px`}},F.listKey("empty",m,f.id))),w&&v0("div",{className:"text-muted-foreground hover:text-foreground cursor-pointer text-[10px] whitespace-nowrap sm:text-xs shrink-0 mt-1",onClick:(f)=>{f.stopPropagation(),_(Q,L)},onKeyDown:(f)=>{if(f.key==="Enter"||f.key===" ")f.preventDefault(),f.stopPropagation(),_(Q,L)},role:"button",tabIndex:0,children:["+",H," ",W("more")]})]}),V]})}),p0(i5,{ref:O})]})},q5=I2(b2);import{jsx as r5}from"react/jsx-runtime";var B0=({resource:Q,className:q,children:J,"data-testid":Z})=>{let{renderResource:$}=S();return r5("div",{className:G("flex items-center justify-center p-2",q),"data-testid":Z,style:{color:Q.color,backgroundColor:Q.backgroundColor},children:$?$(Q):J??r5("div",{className:"text-sm font-medium truncate",children:Q.title})})};import{memo as m2}from"react";import{memo as w2}from"react";import{jsx as N0,jsxs as n5,Fragment as j2}from"react/jsx-runtime";var f2=({rangeStart:Q,rangeEnd:q,now:J,axis:Z="vertical",render:$,withDot:P=!0})=>{let X=J??a5(),K=X.valueOf();if(!(K>=Q.valueOf()&&K<q.valueOf()))return null;let z=q.diff(Q,"minute"),V=X.diff(Q,"minute")/z*100;if($)return N0(j2,{children:$({currentTime:X,rangeStart:Q,rangeEnd:q,progress:V,axis:Z})});if(Z==="horizontal")return n5("div",{className:"absolute top-0 bottom-0 z-50 flex -translate-x-1/2 flex-col items-center pointer-events-none","data-testid":"current-time-indicator",style:{left:`${V}%`},children:[P&&N0("div",{className:"size-2 shrink-0 rounded-full bg-red-500"}),N0("div",{className:"w-0.5 flex-1 bg-red-500"})]});return n5("div",{className:"absolute right-0 left-0 z-50 flex -translate-y-1/2 items-center pointer-events-none","data-testid":"current-time-indicator",style:{top:`${V}%`},children:[P&&N0("div",{className:"size-2 shrink-0 rounded-full bg-red-500"}),N0("div",{className:"h-0.5 flex-1 bg-red-500"})]})},t5=w2(f2);import{memo as h2}from"react";import{jsx as C2}from"react/jsx-runtime";var k2=({rangeStart:Q,rangeEnd:q,now:J,resource:Z,axis:$="vertical",withDot:P})=>{let{renderCurrentTimeIndicator:X,view:K}=S((z)=>({renderCurrentTimeIndicator:z.renderCurrentTimeIndicator,view:z.view})),B;if(X)B=(z)=>X({...z,resource:Z,view:K});return C2(t5,{axis:$,now:J,rangeEnd:q,rangeStart:Q,render:B,withDot:P})},s5=h2(k2);import{jsx as J5,jsxs as x2}from"react/jsx-runtime";var D2=({gridType:Q="day",days:q,resourceId:J,resource:Z,"data-testid":$,positionedEvents:P,dayNumberHeight:X=A5})=>{let{eventHeight:K,eventSpacing:B,resources:z}=S(),U=q.at(0)?.startOf("day"),V=!J||z?.at(0)?.id===J,O=q.at(0),A=q.at(-1)?.add(1,Q),R=Q==="hour"&&Boolean(O&&A);return x2("div",{className:"absolute inset-0 pointer-events-none z-10 overflow-clip","data-testid":$,children:[R&&O&&A&&J5(s5,{axis:"horizontal",rangeEnd:A,rangeStart:O,resource:Z,withDot:V}),P.map((Y)=>{let{event:W,row:N}=Y,T=X+B+N*(K+B),M=`${W.id}-${N}-${U?.toISOString()}-${J??"no-resource"}`;return J5("div",{className:"absolute z-10 pointer-events-auto overflow-clip","data-left":Y.left,"data-testid":F.container.horizontal.event(W.id),"data-top":T,"data-width":Y.width,style:{left:`calc(${Y.left}% + var(--spacing) * 0.25)`,width:`calc(${Y.width}% - var(--spacing) * 1)`,top:`${T}px`,height:`${K}px`},children:J5(E0,{className:"h-full w-full shadow",elementId:M,event:W,isTruncatedEnd:Y.isTruncatedEnd,isTruncatedStart:Y.isTruncatedStart})},F.listKey(M,"wrapper"))})]})},Z5=m2(D2);import{jsx as i,jsxs as $5}from"react/jsx-runtime";var p2=({id:Q,resource:q,gridType:J="day",variant:Z="resource",dayNumberHeight:$,className:P,columns:X=[],allDay:K,showDayNumber:B=!1})=>{let{renderResource:z}=S(),U=Z==="resource",V=X.some((Y)=>Y.days),O=E2(()=>{if(V)return[];return X.map((Y)=>Y.day).filter((Y)=>Boolean(Y))},[X,V]),{positionedEvents:A,dayEventsMap:R}=e0({days:O,gridType:J,resourceId:q?.id,allDay:K});return $5("div",{className:G("flex flex-1 relative min-w-0",P),"data-testid":F.container.horizontal.row(Q),children:[U&&q&&i(B0,{className:"w-20 sm:w-40 border-r sticky left-0 bg-background z-20 h-full","data-testid":F.container.horizontal.rowLabel(q.id),resource:q,children:z?z(q):i("div",{className:"wrap-break-word text-sm",children:q.title})}),$5("div",{className:"relative flex-1 flex min-w-0",children:[i("div",{className:"flex w-full min-w-0 gap-px bg-border",children:X.map((Y)=>{if(Y.days)return i(v2,{allDay:K,col:Y,dayNumberHeight:$,gridType:J,id:Q,resource:q,resourceId:q?.id,showDayNumber:B},Y.id);return Y.day?i(q5,{allDay:K,className:G("flex-1 w-20",Y.className),day:Y.day,gridType:J,hour:J==="hour"?Y.day.hour():void 0,precomputedEvents:R.get(D(Y.day)),resourceId:q?.id,showDayNumber:B},Y.day.toISOString()):null})}),!V&&i("div",{className:"absolute inset-0 z-10 pointer-events-none",children:i(Z5,{"data-testid":F.container.eventsLayer("horizontal",Q),dayNumberHeight:$,days:O,gridType:J,positionedEvents:A,resource:q,resourceId:q?.id})})]})]})},v2=e5(({col:Q,gridType:q="day",allDay:J,resource:Z,resourceId:$,dayNumberHeight:P,showDayNumber:X,id:K})=>{let B=Q.days??[],{positionedEvents:z}=e0({days:B,gridType:q,resourceId:$,allDay:J});return $5("div",{className:"flex relative w-full",children:[i("div",{className:"flex w-full gap-px bg-border",children:B.map((U)=>i(q5,{allDay:J,className:G("flex-1 w-20",Q.className),day:U,gridType:q,hour:q==="hour"?U.hour():void 0,resourceId:$,showDayNumber:X},U.toISOString()))}),i("div",{className:"absolute inset-0 z-10 pointer-events-none",children:i(Z5,{"data-testid":F.container.eventsLayer("horizontal",K),dayNumberHeight:P,days:B,gridType:q,positionedEvents:z,resource:Z,resourceId:$})})]})}),Q1=e5(p2);import{jsx as q1,jsxs as c2}from"react/jsx-runtime";var y2=({days:Q,classes:q,resource:J,showSpacer:Z=!0})=>{let $=Q.map((P,X)=>({id:F.col.allDay(P,X),day:P,gridType:"day",className:G("h-full min-h-12 bg-background",q?.cell)}));return c2("div",{className:G("flex w-full gap-px bg-border",q?.row),"data-testid":"all-day-row",children:[Z&&q1(x0,{className:q?.spacer}),q1(Q1,{allDay:!0,className:"flex-1 min-h-fit",columns:$,dayNumberHeight:0,gridType:"day",id:F.allDayRow(J?.id),resource:J,variant:"regular"})]})},J1=g2(y2);import{jsx as L0,jsxs as Z1}from"react/jsx-runtime";var v="min-w-20 flex-1",P0=({resources:Q,days:q,gridType:J,cellClassName:Z})=>{let $=q.map((P)=>{let X=Array.isArray(P),K=X?P.at(0):P;return{id:K?F.col.day(K):"day-col-unknown",day:X?void 0:P,days:X?P:void 0,className:Z,gridType:J}});return Q.map((P)=>({id:String(P.id),resource:P,columns:$}))},X0=({resources:Q,gutter:q,columnsFor:J})=>[q,...Q.flatMap((Z)=>{let $=J(Z);return(Array.isArray($)?$:[$]).map((X)=>({...X,resource:Z}))})],g0=({resources:Q})=>Z1("div",{className:"flex gap-px bg-border h-12 flex-1","data-testid":F.header.resource.columnsHeader,children:[L0("div",{className:G("shrink-0 sticky top-0 left-0 bg-background z-20",$0,u)}),Q.map((q)=>L0(B0,{className:G(v,"bg-background"),resource:q},F.listKey("resource-cell",q.id)))]}),G0=()=>{let{t:Q}=S((q)=>({t:q.t}));return L0("div",{className:"w-20 sm:w-40 border-b border-r shrink-0 flex justify-center items-center sticky top-0 left-0 bg-background z-20",children:L0("div",{className:"text-sm truncate px-1 min-w-0",children:Q("resources")})})},S4=({columns:Q})=>{let q=[],J=new Map;for(let Z of Q){if(!Z.resource||Z.noEvents||!Z.day)continue;let $=J.get(Z.resource.id);if(!$)$={resource:Z.resource,days:[],seenDayKeys:new Set},J.set(Z.resource.id,$),q.push($);let P=D(Z.day);if(!$.seenDayKeys.has(P))$.seenDayKeys.add(P),$.days.push(Z.day)}return Z1("div",{className:"flex w-full gap-px bg-border",children:[L0(x0,{}),q.map(({resource:Z,days:$})=>L0(J1,{classes:{cell:G("min-w-20",$.length>1&&"flex-1")},days:$,resource:Z,showSpacer:!1},F.allDayRow(Z.id)))]})};import{jsx as P5}from"react/jsx-runtime";var y0=({hours:Q,view:q,delayStep:J})=>P5("div",{className:G("flex gap-px bg-border border-b",w0),children:Q.map((Z,$)=>{let P=Z.isSame(j(),"hour"),X=Z.format("HH"),K=F.header.week.hour(Z,$);return P5(h,{className:G(v,"bg-background flex items-center justify-center text-xs shrink-0",P&&"bg-blue-50 text-blue-600 font-medium"),"data-hour":X,"data-testid":F.header.resource.timeLabel(q,X),delay:$*J,transitionKey:F.listKey(K,"motion"),children:P5(j0,{date:Z})},F.listKey(K,"animated"))})});import{jsx as Q0,jsxs as X1,Fragment as o2}from"react/jsx-runtime";var u2=({date:Q})=>{let{t:q}=S((Z)=>({t:Z.t})),J=C(Q);return Q0("div",{className:"flex flex-1 justify-center items-center min-h-12","data-testid":"day-view-header",children:X1(h,{className:G("flex justify-center items-center text-center text-sm font-semibold sm:text-xl",J&&"text-primary"),transitionKey:D(Q),children:[Q.format("dddd, LL"),J&&Q0("span",{className:"bg-primary text-primary-foreground ml-2 rounded-full px-1 py-0.5 text-xs sm:px-2 sm:text-sm",children:q("today")})]})})},$1=(Q,q)=>D0({referenceDate:Q,businessHours:q.businessHours,hideNonBusinessHours:q.hideNonBusinessHours,allDates:[Q],resourceBusinessHours:m0(q.resources??[])}),i2=({date:Q,config:q})=>{let J=$1(Q,q);return X1(o2,{children:[Q0(G0,{}),Q0("div",{className:"flex-1 flex flex-col",children:Q0(y0,{delayStep:E,hours:J,view:"day"})})]})},d2=(Q,q)=>{let J=q.resources??[],Z=$1(Q,q);if(!J.length)return[s({days:Z,gridType:"hour"}),{id:F.col.day(Q),day:Q,days:Z,className:G(k5,"flex-1"),gridType:"hour"}];if(q.orientation==="vertical")return X0({resources:J,gutter:s({days:Z,gridType:"hour"}),columnsFor:($)=>({id:F.col.day(Q,$.id),days:Z,day:Q,gridType:"hour"})});return P0({resources:J,days:Z,gridType:"hour",cellClassName:v})},P1={name:"day",label:"day",icon:l2,navigationUnit:"day",layout:"vertical",supportsResources:!0,range:(Q)=>({start:Q.startOf("day"),end:Q.endOf("day")}),columns:d2,renderHeader:({date:Q,config:q})=>{let J=q.resources??[];if(!J.length)return Q0(u2,{date:Q});if(q.orientation==="vertical")return Q0(g0,{resources:J});return Q0(i2,{config:q,date:Q})}};import{Grid3x3 as r2}from"lucide-react";import{jsx as X5}from"react/jsx-runtime";var Y1=({className:Q})=>{let{firstDayOfWeek:q,stickyViewHeader:J,viewHeaderClassName:Z,currentDate:$}=S(),P=p($,q);return X5("div",{className:G("flex w-full gap-px bg-border border-b",J&&"sticky top-0 z-20",Z,Q),"data-testid":"month-header",children:P.map((X,K)=>X5(h,{className:"py-2 text-center font-medium bg-background flex-1 min-w-0","data-testid":F.header.weekday("month",X.format("ddd")),delay:K*E,transitionKey:X.toISOString(),children:X5("span",{className:"text-sm capitalize truncate w-full block",children:X.format("ddd")})},X.toISOString()))})};import{jsx as q0,jsxs as e2,Fragment as s2}from"react/jsx-runtime";var n2=(Q,q)=>{let J=h0(Q);return X0({resources:q,gutter:s({days:J,gridType:"day",renderLabel:(Z)=>q0(c,{className:"flex-col-reverse",dayNumber:Z.format("D"),today:C(Z),weekday:Z.format("ddd")})}),columnsFor:(Z)=>({id:F.col.resource("month",Z.id),day:void 0,days:J,gridType:"day"})})},a2=({date:Q})=>{let q=h0(Q);return e2(s2,{children:[q0(G0,{}),q0("div",{className:"flex flex-1 gap-px bg-border border-b",children:q.map((J,Z)=>{let $=F.header.resource.monthDay(J),P=C(J);return q0(h,{className:"flex-1 w-20 bg-background shrink-0 flex items-center justify-center flex-col",delay:Z*E,transitionKey:F.listKey($,"motion"),children:q0(c,{className:"flex-col-reverse",dayNumber:J.format("D"),today:P,weekday:J.format("ddd")})},F.listKey($,"animated"))})})]})},t2=(Q,q)=>{let J=q.resources??[];if(J.length){if(q.orientation==="vertical")return n2(Q,J);return P0({resources:J,days:h0(Q),gridType:"day"})}return n0(Q,q.firstDayOfWeek).map((Z,$)=>({id:F.listKey("week",$),columns:Z.map((P)=>({id:F.col.day(P),day:P,className:"w-auto",gridType:"day"})),className:"flex-1",showDayNumber:!0}))},K1={name:"month",label:"month",icon:r2,navigationUnit:"month",layout:"horizontal",supportsResources:!0,range:(Q,q)=>k0(Q,q.firstDayOfWeek),columns:t2,renderHeader:({date:Q,config:q})=>{let J=q.resources??[];if(!J.length)return q0(Y1,{className:"h-12"});if(q.orientation==="vertical")return q0(g0,{resources:J});return q0(a2,{date:Q})}};import{Columns3 as qQ}from"lucide-react";import{jsx as c0}from"react/jsx-runtime";var z1=({days:Q})=>{let{weekViewGranularity:q}=S(),J=q==="hourly";return c0("div",{className:G("flex gap-px bg-border border-b",w0),children:Q.map((Z,$)=>{let P=C(Z),X=F.header.week.day(Z);return c0(h,{className:G("shrink-0 bg-background flex-1 flex items-center text-center font-medium min-w-20"),"data-testid":F.header.resource.weekDay,delay:$*E,transitionKey:F.listKey(X,"motion"),children:c0("div",{className:G(J?"sticky left-1/2":"w-full text-center"),children:c0(c,{dayNumber:Z.format("D"),today:P,weekday:Z.format("ddd")})})},F.listKey(X,"animated"))})})};import{jsx as l0,jsxs as QQ}from"react/jsx-runtime";var B1=({columns:Q})=>{let{currentDate:q}=S();return QQ("div",{className:"flex h-12 gap-px bg-border",children:[l0("div",{className:G("shrink-0 z-20 bg-background sticky left-0",$0,u),children:l0("span",{className:"px-2 h-full w-full flex justify-center items-start font-medium",children:q.week()})}),Q.map((J,Z)=>{let $=J.day;if(!$)return null;let P=C($),X=F.header.week.hour($,J.resourceId??"");return l0(h,{className:G(v,"flex flex-col items-center justify-center text-xs shrink-0 bg-background"),"data-testid":F.header.resource.timeLabel("week",$.format("HH")),delay:Z*E,transitionKey:F.listKey(X,"motion"),children:l0(c,{dayNumber:$.format("D"),today:P,weekday:$.format("ddd")})},F.listKey(X,"animated"))})]})};import{jsx as W0,jsxs as L1}from"react/jsx-runtime";var G1=({resources:Q})=>{let{weekViewGranularity:q,t:J,currentDate:Z}=S(),$=q==="hourly";return L1("div",{className:"flex h-12 gap-px bg-border",children:[W0("div",{className:G("shrink-0 z-20 bg-background sticky left-0",$0,u),children:L1("span",{className:G("px-2 h-full w-full flex flex-col justify-center text-xs text-muted-foreground text-center min-w-0",$?"justify-end":"justify-center"),children:[W0("span",{className:"truncate w-full",children:J("week")}),!$&&W0("span",{className:"font-medium text-foreground truncate w-full",children:Z.week()})]})}),Q.map((P)=>{return W0(B0,{className:G(v,"bg-background border-b"),resource:P,children:W0("div",{className:G("sticky text-sm font-medium truncate",$?"left-1/4":"left-1"),children:P.title})},F.listKey("resource-cell",P.id))})]})};import{jsx as g,jsxs as M0,Fragment as KQ}from"react/jsx-runtime";var u0=(Q,q)=>{let J=p(Q,q.firstDayOfWeek),{hiddenDays:Z}=q;if(!Z)return J;return J.filter(($)=>!Z.has($.day()))},i0=(Q)=>(Q.weekViewGranularity??"hourly")==="hourly",JQ=({date:Q,config:q})=>{let{t:J,selectDate:Z,openEventForm:$}=S((X)=>({t:X.t,selectDate:X.selectDate,openEventForm:X.openEventForm})),P=u0(Q,q);return M0("div",{className:"flex h-18 flex-1 gap-px bg-border","data-testid":"week-view-header",children:[g("div",{className:G(a0,"h-full shrink-0 items-center justify-center bg-background p-2 flex",u),children:M0("div",{className:"flex flex-col items-center justify-center min-w-0 w-full",children:[g("span",{className:"text-muted-foreground text-xs truncate w-full text-center",children:J("week")}),g("span",{className:"font-medium truncate w-full text-center",children:Q.week()})]})}),P.map((X,K)=>{let B=C(X),z=F.header.week.day(X);return g(h,{className:G("hover:bg-accent bg-background flex-1 min-w-0 flex flex-col justify-center cursor-pointer p-1 text-center sm:p-2 w-20 h-full"),"data-testid":F.header.weekday("week",X.format("dddd")),delay:K*E,onClick:()=>{Z(X),$({start:X})},transitionKey:z,children:g(c,{dayNumber:X.format("D"),today:B,weekday:X.format("ddd")})},z)})]})},F0=(Q,q,J)=>D0({referenceDate:Q,businessHours:q.businessHours,hideNonBusinessHours:q.hideNonBusinessHours,allDates:J,resourceBusinessHours:m0(q.resources??[])}),ZQ=(Q,q,J)=>{let Z=p(Q,q.firstDayOfWeek);if(i0(q)){let $=u0(Q,q);return X0({resources:J,gutter:s({days:F0(Q,q,Z),gridType:"hour"}),columnsFor:(P)=>$.map((X)=>({id:F.col.day(X,P.id),className:v,day:X,days:F0(X,q,Z),gridType:"hour"}))})}return X0({resources:J,gutter:s({days:Z,gridType:"day",renderLabel:($)=>g(c,{dayNumber:$.format("D"),today:C($),weekday:$.format("ddd")})}),columnsFor:($)=>({id:F.col.resource("week",$.id),className:v,day:void 0,days:Z,gridType:"day"})})},$Q=(Q,q,J)=>{let Z=p(Q,q.firstDayOfWeek);if(i0(q)){let $=Z.map((P)=>F0(P,q));return P0({resources:J,days:$,gridType:"hour",cellClassName:v})}return P0({resources:J,days:Z,gridType:"day",cellClassName:v})},PQ=({date:Q,config:q,resources:J})=>{let Z=u0(Q,q),$=i0(q),P=$?J.flatMap((X)=>Z.map((K)=>({day:K,resourceId:X.id}))):[];return M0("div",{className:"flex-1 flex flex-col",children:[g(G1,{resources:J}),$&&g(B1,{columns:P})]})},XQ=({date:Q,config:q})=>{let J=p(Q,q.firstDayOfWeek),Z=i0(q),$=Z?J.flatMap((P)=>F0(P,q)):[];return M0(KQ,{children:[g(G0,{}),M0("div",{className:"flex-1 flex flex-col",children:[g(z1,{days:J}),Z&&g(y0,{delayStep:N5,hours:$,view:"week"})]})]})},YQ=(Q,q)=>{let J=q.resources??[];if(J.length){if(q.orientation==="vertical")return ZQ(Q,q,J);return $Q(Q,q,J)}let Z=p(Q,q.firstDayOfWeek),$=u0(Q,q);return[s({days:F0(Q,q,Z),gridType:"hour",widthClassName:a0}),...$.map((P)=>({id:F.col.day(P),day:P,days:F0(P,q,Z),className:"flex-1 min-w-0",gridType:"hour"}))]},F1={name:"week",label:"week",icon:qQ,navigationUnit:"week",layout:"vertical",supportsResources:!0,range:(Q,q)=>{let J=p(Q,q.firstDayOfWeek),Z=J.at(0)??Q,$=J.at(-1)??Q;return{start:Z.startOf("day"),end:$.endOf("day")}},columns:YQ,renderHeader:({date:Q,config:q})=>{let J=q.resources??[];if(!J.length)return g(JQ,{config:q,date:Q});if(q.orientation==="vertical")return g(PQ,{config:q,date:Q,resources:J});return g(XQ,{config:q,date:Q,resources:J})}};import{Grid2x2 as GQ}from"lucide-react";import*as r from"@radix-ui/react-scroll-area";import{jsx as R0,jsxs as zQ}from"react/jsx-runtime";function A1({className:Q,children:q,viewPortProps:J,...Z}){return zQ(r.Root,{className:G("relative",Q),"data-slot":"scroll-area",...Z,children:[R0(r.Viewport,{...J,className:G("focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",J?.className),"data-slot":"scroll-area-viewport",children:q}),R0(Y5,{}),R0(r.Corner,{})]})}function Y5({className:Q,orientation:q="vertical",...J}){return R0(r.ScrollAreaScrollbar,{className:G("flex touch-none p-px transition-colors select-none",q==="vertical"&&"h-full w-2.5 border-l border-l-transparent",q==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",Q),"data-slot":"scroll-area-scrollbar",orientation:q,...J,children:R0(r.ScrollAreaThumb,{className:"bg-border relative flex-1 rounded-full","data-slot":"scroll-area-thumb"})})}import{jsx as J0,jsxs as S0}from"react/jsx-runtime";var BQ=["bg-primary","bg-blue-500","bg-green-500"],LQ=42,U1=()=>{let{currentDate:Q,setView:q,getEventsForDateRange:J,t:Z,firstDayOfWeek:$}=S(),P=Q.year(),X=p(j(),$).map((Y)=>({id:Y.day().toString(),label:Y.format("dd")})),K=()=>{return Array.from({length:12},(Y,W)=>{let N=j().year(P).month(W).startOf("month"),T=J(N,N.endOf("month"));return{date:N,name:N.format("MMMM"),eventCount:T.length,monthKey:N.format("MM")}})},B=(Y)=>{let W=Y.startOf("month"),N=p(W,$).at(0)??W;return Array.from({length:LQ},(T,M)=>{let b=N.add(M,"day"),L=b.startOf("day"),_=b.endOf("day"),I=J(L,_);return{date:b,dayKey:D(b),isInCurrentMonth:b.month()===Y.month(),isToday:C(b),isSelected:b.isSame(Q,"day"),eventCount:I.length}})},z=(Y,W,N)=>{N?.stopPropagation(),q(W,Y)},U=(Y)=>{let W=Y===1?Z("event"):Z("events");return`${Y} ${W}`},V=(Y)=>{let N=Y.isInCurrentMonth?"":"text-muted-foreground opacity-50",T=Y.isToday?"bg-primary text-primary-foreground rounded-full":"",M=Y.isSelected&&!Y.isToday?"bg-muted rounded-full font-bold":"",b=Y.eventCount>0&&!Y.isToday&&!Y.isSelected?"font-medium":"";return G("relative flex aspect-square w-full cursor-pointer flex-col items-center justify-center hover:bg-accent rounded-sm transition-colors duration-200",N,T,M,b)},O=(Y,W)=>{return G("h-[3px] w-[3px] rounded-full",W?"bg-primary-foreground":Y)},A=K(),R=(Y)=>{if(Y===0)return"";return U(Y)};return S0(A1,{className:"h-full","data-testid":"year-view",children:[J0("div",{className:"grid auto-rows-fr grid-cols-1 gap-4 p-4 sm:grid-cols-2 lg:grid-cols-3","data-testid":"year-grid",children:A.map((Y,W)=>{let N=B(Y.date),T=W*E;return S0("div",{className:"hover:border-primary flex flex-col rounded-lg border p-3 text-left transition-all duration-200 hover:shadow-md","data-testid":F.header.year.month(Y.monthKey),children:[S0(h,{className:"mb-2 flex items-center justify-between",delay:T,transitionKey:F.listKey("month",Y.monthKey),children:[J0("button",{className:"text-lg font-medium hover:underline cursor-pointer","data-testid":F.header.year.month(Y.monthKey,"title"),onClick:()=>z(Y.date,"month"),type:"button",children:Y.name}),Y.eventCount>0&&J0("span",{className:"bg-primary text-primary-foreground rounded-full px-2 py-1 text-xs","data-testid":F.header.year.month(Y.monthKey,"count"),children:U(Y.eventCount)})]},F.listKey("month",Y.monthKey)),S0("div",{className:"grid grid-cols-7 gap-px text-[0.6rem]","data-testid":F.header.year.month(Y.monthKey,"mini"),children:[X.map((M)=>J0("div",{className:"text-muted-foreground h-3 text-center",children:M.label},F.listKey("header",Y.monthKey,M.id))),N.map((M)=>{let b=F.header.year.day(Y.date.format("YYYY-MM"),M.dayKey),L=M.eventCount>0,_=Math.min(M.eventCount,3),I=BQ.slice(0,_);return S0("button",{className:V(M),"data-testid":b,onClick:(H)=>z(M.date,"day",H),title:R(M.eventCount),type:"button",children:[J0("span",{className:"text-center leading-none",children:M.date.date()}),L&&J0("div",{className:G("absolute bottom-0 flex w-full justify-center space-x-px",M.isToday&&"bottom-px"),children:I.map((H)=>J0("span",{className:O(H,M.isToday)},H))})]},M.dayKey)})]})]},Y.monthKey)})}),J0(Y5,{className:"z-30"})]})};var V1={name:"year",label:"year",icon:GQ,navigationUnit:"year",supportsResources:!1,range:(Q)=>({start:Q.startOf("year"),end:Q.endOf("year")}),component:U1};var O1=[P1,F1,K1,V1];var _1=(Q,q,J)=>q?.range?.(Q,{firstDayOfWeek:J})??k0(Q,J),N1=({initialDate:Q,initialView:q,firstDayOfWeek:J,onDateChange:Z,onViewChange:$,pluginRuntime:P})=>{let[X,K]=UQ(()=>({date:j.isDayjs(Q)?Q:j(Q),view:q})),B=AQ(X),z=l((L)=>{let _={...B.current,...L};return B.current=_,K(_),_},[]),U=l(()=>[...O1,...P.getViews()],[P]),V=l((L)=>U().find((_)=>_.name===L),[U]),O=l(()=>{return _1(X.date,V(X.view),J)},[X,J,V]),A=l((L)=>{let _=_1(L.date,V(L.view),J);Z?.(L.date,_)},[Z,J,V]),R=l((L)=>{A(z({date:L}))},[z,A]),Y=l((L)=>{let{date:_,view:I}=B.current,H=V(I),w=H?.navigationStep??{amount:1,unit:H?.navigationUnit??"day"},k=_.add(L*w.amount,w.unit);A(z({date:k}))},[z,A,V]),W=l(()=>Y(1),[Y]),N=l(()=>Y(-1),[Y]),T=l(()=>A(z({date:j()})),[z,A]),M=l((L,_)=>{let I=z(_?{view:L,date:_}:{view:L});$?.(L),A(I)},[z,$,A]),b=l((L)=>{let _=typeof L==="function"?L(B.current.date):L;z({date:_})},[z]);return FQ(()=>({currentDate:X.date,setCurrentDate:b,view:X.view,setView:M,selectDate:R,nextPeriod:W,prevPeriod:N,today:T,getCurrentViewRange:O,getAllViews:U}),[X,b,M,R,W,N,T,O,U])};import{createElement as VQ,Fragment as OQ}from"react";var W1=(Q)=>({transformEvents:(q,J)=>{return Q.reduce(($,P)=>P.transformEvents?P.transformEvents($,J):$,q).filter(($)=>f0($,J.start,J.end))},getEventManager:(q)=>Q.find((J)=>J.managesEvent?.(q)),collect:(q,J)=>Q.flatMap((Z)=>Z.contribute?.(q,J)??[]),renderSlot:(q,J)=>{let Z=[];for(let $ of Q){let P=$.renderSlot?.(q,J);if(P!==null&&P!==void 0)Z.push(VQ(OQ,{key:$.name},P))}return Z},getViews:()=>Q.flatMap((q)=>q.views??[]),getProviders:()=>Q.map((q)=>q.provider).filter((q)=>Boolean(q))});var _Q=[],NQ=[],H1=(Q)=>{let{events:q,firstDayOfWeek:J=0,initialView:Z="month",initialDate:$=j(),dayMaxEvents:P,businessHours:X,onEventAdd:K,onEventUpdate:B,onEventDelete:z,onDateChange:U,onViewChange:V,locale:O,timezone:A,translations:R,translator:Y,onEventClick:W,onCellClick:N,disableEventClick:T,disableCellClick:M,resources:b,orientation:L,weekViewGranularity:_}=Q,{plugins:I=NQ}=Q,H=M5({firstDayOfWeek:J,dayMaxEvents:P,businessHours:X,locale:O,translations:R,translator:Y,resources:b,orientation:L,weekViewGranularity:_}),w=R1(()=>W1(I),[I]),k=N1({initialDate:$,initialView:Z,firstDayOfWeek:J,onDateChange:U,onViewChange:V,pluginRuntime:w}),n=I5({events:q,pluginRuntime:w,getCurrentViewRange:k.getCurrentViewRange,resources:H.resources??_Q,onEventAdd:K,onEventUpdate:B,onEventDelete:z}),a=T5({currentDate:k.currentDate,t:H.t,disableEventClick:T,disableCellClick:M,onEventClick:W,onCellClick:N}),{setCurrentLocale:f}=H,{setCurrentDate:m}=k,{setCurrentEvents:Y0}=n,Z0=S1(void 0);M1(()=>{if(O&&O!==Z0.current)f(O),j.locale(O),m((t)=>t.locale(O)),Z0.current=O},[O,f,m]);let A0=S1(A);return M1(()=>{if(A&&A!==A0.current)j.tz.setDefault(A),m((t)=>t.tz(A)),Y0((t)=>t.map((e)=>({...e,start:e.start.tz(A),end:e.end.tz(A)}))),A0.current=A},[A,m,Y0]),R1(()=>{let{setCurrentLocale:t,...e}=H,{getCurrentViewRange:d0,getAllViews:H0,...I0}=k,{setCurrentEvents:o0,...T0}=n;return{...e,...I0,...T0,...a,getViews:H0,getEventManager:w.getEventManager,renderSlot:w.renderSlot,collect:w.collect,getProviders:w.getProviders,getEventResourceIds:U0,currentRange:k.getCurrentViewRange()}},[H,k,n,a,w])};import{jsx as WQ}from"react/jsx-runtime";var I1=(Q,q)=>Q.reduceRight((J,Z,$)=>WQ(Z,{children:J},$),q);import{jsx as HQ}from"react/jsx-runtime";var RQ=[],SQ=(Q)=>{let{events:q=RQ,firstDayOfWeek:J=0,initialView:Z="month",initialDate:$,renderEvent:P,onEventClick:X,onCellClick:K,isCellDisabled:B,getCellClassName:z,onViewChange:U,onEventAdd:V,onEventUpdate:O,onEventDelete:A,onDateChange:R,locale:Y,timezone:W,disableCellClick:N,disableEventClick:T,disableDragAndDrop:M,dayMaxEvents:b,eventSpacing:L=F5,eventHeight:_=U5,stickyViewHeader:I=!0,viewHeaderClassName:H="",headerComponent:w,headerClassName:k,businessHours:n,renderEventForm:a,onMoreEventsClick:f,translations:m,translator:Y0,timeFormat:Z0="12-hour",classesOverride:A0,renderCurrentTimeIndicator:t,renderHour:e,hideNonBusinessHours:d0=!1,hideExportButton:H0=!1,hiddenDays:I0,slotDuration:o0=60,scrollTime:T0,plugins:T1,resources:b1,renderResource:K5,orientation:w1,weekViewGranularity:f1}=Q,z5=H1({events:q,firstDayOfWeek:J,initialView:Z,initialDate:$,dayMaxEvents:b,businessHours:n,onEventAdd:V,onEventUpdate:O,onEventDelete:A,onDateChange:R,onViewChange:U,locale:Y,timezone:W,translations:m,translator:Y0,plugins:T1,onEventClick:X,onCellClick:K,disableEventClick:T,disableCellClick:N,resources:b1,orientation:w1,weekViewGranularity:f1});return MQ(()=>{let{handleEventClick:j1,handleDateClick:h1,...k1}=z5;return{...k1,renderEvent:P,onEventClick:j1,onCellClick:h1,isCellDisabled:B,getCellClassName:z,locale:Y,timezone:W,disableCellClick:N,disableEventClick:T,disableDragAndDrop:M,eventSpacing:L,eventHeight:_,stickyViewHeader:I,viewHeaderClassName:H,headerComponent:w,headerClassName:k,renderEventForm:a,onMoreEventsClick:f,timeFormat:Z0,classesOverride:A0,renderCurrentTimeIndicator:t,renderHour:e,hideNonBusinessHours:d0,hideExportButton:H0,hiddenDays:I0,slotDuration:o0,scrollTime:T0,renderResource:K5}},[z5,P,K5,B,z,Y,W,N,T,M,L,_,I,H,w,k,a,f,Z0,A0,t,e,d0,H0,I0,o0,T0])},nZ=({children:Q,...q})=>{let J=SQ(q),Z=I1(J.getProviders(),Q);return HQ(b0.Provider,{value:J,children:Z})};
|
|
2
|
+
export{j as a,S as b,yQ as c,G as d,h as e,g5 as f,y5 as g,c5 as h,r9 as i,l5 as j,n9 as k,A1 as l,Y5 as m,C as n,p as o,n0 as p,F as q,v5 as r,F5 as s,U5 as t,_5 as u,uQ as v,P2 as w,m5 as x,K0 as y,E0 as z,q5 as A,s5 as B,Q1 as C,a0 as D,J1 as E,S4 as F,G5 as G,nZ as H};
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -537,6 +537,7 @@ interface CalendarProviderProps {
|
|
|
537
537
|
headerClassName?: string;
|
|
538
538
|
businessHours?: BusinessHours | BusinessHours[];
|
|
539
539
|
renderEventForm?: (props: EventFormProps) => ReactNode3;
|
|
540
|
+
onMoreEventsClick?: (day: Dayjs3, events: CalendarEvent[]) => void;
|
|
540
541
|
translations?: Translations;
|
|
541
542
|
translator?: TranslatorFunction;
|
|
542
543
|
timeFormat?: TimeFormat;
|
package/dist/testing/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{H as b}from"../shared/chunk-
|
|
1
|
+
import{H as b}from"../shared/chunk-328e2ygt.js";import"../shared/chunk-jfadfww5.js";import{jsx as q}from"react/jsx-runtime";var y=({children:g,...k})=>q(b,{dayMaxEvents:5,...k,children:g});export{y as CalendarTestProvider};
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{L as t5}from"./chunk-jfadfww5.js";import g from"dayjs";import C1 from"dayjs/plugin/isBetween.js";import m1 from"dayjs/plugin/isSameOrAfter.js";import x1 from"dayjs/plugin/isSameOrBefore.js";import p1 from"dayjs/plugin/localeData.js";import E1 from"dayjs/plugin/localizedFormat.js";import D1 from"dayjs/plugin/minMax.js";import v1 from"dayjs/plugin/timezone.js";import g1 from"dayjs/plugin/utc.js";import y1 from"dayjs/plugin/weekday.js";import c1 from"dayjs/plugin/weekOfYear.js";var L5,l1=(Q,q,J)=>{let Z=q.prototype,$=J.tz.setDefault;J.tz.setDefault=(K)=>{return L5=K,$(K)};let{startOf:P,endOf:X}=Z;function Y(K,B){let N=K.$x?.$timezone||L5;if(!N)return B;let V=J.tz(B.format("YYYY-MM-DDTHH:mm:ss"),N).utcOffset();if(B.utcOffset()!==V)return B.tz(N,!0);return B}Z.startOf=function(K,B){let N=P.call(this,K,B);return Y(this,N)},Z.endOf=X};g.extend(y1);g.extend(c1);g.extend(m1);g.extend(x1);g.extend(C1);g.extend(D1);g.extend(v1);g.extend(g1);g.extend(p1);g.extend(E1);g.extend(l1);var G5=(...Q)=>{return g.tz(...Q)};Object.assign(G5,g);var j=G5;import{useContext as u1}from"react";import{createContext as i1}from"react";var T0=i1(void 0);var d1=[];function R(Q){let q=u1(T0);if(!q)throw Error("useSmartCalendarContext must be used within a CalendarProvider");return Q?Q(q):q}function vQ(){let Q=R();return{currentDate:Q.currentDate,currentRange:Q.currentRange,view:Q.view,events:Q.events,rawEvents:Q.rawEvents,isEventFormOpen:Q.isEventFormOpen,selectedEvent:Q.selectedEvent,selectedDate:Q.selectedDate,firstDayOfWeek:Q.firstDayOfWeek,resources:Q.resources??d1,orientation:Q.orientation,setCurrentDate:Q.setCurrentDate,selectDate:Q.selectDate,setView:Q.setView,nextPeriod:Q.nextPeriod,prevPeriod:Q.prevPeriod,today:Q.today,addEvent:Q.addEvent,updateEvent:Q.updateEvent,deleteEvent:Q.deleteEvent,openEventForm:Q.openEventForm,closeEventForm:Q.closeEventForm,onEventClick:Q.onEventClick,renderCurrentTimeIndicator:Q.renderCurrentTimeIndicator,getEventsForResource:Q.getEventsForResource,businessHours:Q.businessHours,t:Q.t,timeFormat:Q.timeFormat,timezone:Q.timezone,currentLocale:Q.currentLocale,getEventsForDateRange:Q.getEventsForDateRange,applyScopedEdit:Q.applyScopedEdit,applyScopedDelete:Q.applyScopedDelete,getEventManager:Q.getEventManager,renderSlot:Q.renderSlot,collect:Q.collect,getViews:Q.getViews}}var F5={today:"Today",create:"Create",new:"New",update:"Update",delete:"Delete",cancel:"Cancel",export:"Export",previous:"Previous",next:"Next",event:"Event",events:"Events",newEvent:"New Event",title:"Title",description:"Description",location:"Location",allDay:"All day",startDate:"Start Date",endDate:"End Date",startTime:"Start Time",searchTime:"Search time...",endTime:"End Time",color:"Color",createEvent:"Create Event",editEvent:"Edit Event",addNewEvent:"Add a new event to your calendar",editEventDetails:"Edit your event details",eventTitlePlaceholder:"Event title",eventDescriptionPlaceholder:"Event description (optional)",eventLocationPlaceholder:"Event location (optional)",repeat:"Repeat",repeats:"Repeats",customRecurrence:"Custom recurrence",frequency:"Frequency",everyWeekday:"Every weekday",weeklyOn:"Weekly on",monthlyOnDay:"Monthly on day",monthlyOnThe:"Monthly on the",first:"first",second:"second",third:"third",fourth:"fourth",last:"last",daily:"Daily",weekly:"Weekly",monthly:"Monthly",yearly:"Yearly",interval:"Interval",repeatOn:"Repeat on",never:"Never",count:"Count",every:"Every",ends:"Ends",after:"After",occurrences:"occurrences",on:"On",editRecurringEvent:"Edit recurring event",deleteRecurringEvent:"Delete recurring event",editRecurringEventQuestion:"is a recurring event. How would you like to edit it?",deleteRecurringEventQuestion:"is a recurring event. How would you like to delete it?",thisEvent:"This event",thisEventDescription:"Only change this specific occurrence",thisAndFollowingEvents:"This and following events",thisAndFollowingEventsDescription:"Edit this and all future occurrences",allEvents:"All events",allEventsDescription:"Edit the entire recurring series",onlyChangeThis:"Only change this specific occurrence",changeThisAndFuture:"Change this and all future occurrences",changeEntireSeries:"Change the entire recurring series",onlyDeleteThis:"Only delete this specific occurrence",deleteThisAndFuture:"Delete this and all future occurrences",deleteEntireSeries:"Delete the entire recurring series",month:"Month",week:"Week",day:"Day",year:"Year",agenda:"Agenda",agendaNoEvents:"No upcoming events",more:"more",resources:"Resources",resource:"Resource",selectResource:"Select a resource",time:"Time",date:"Date",noResourcesVisible:"No resources visible",addResourcesOrShowExisting:"Add resources or show existing ones"};import{useMemo as MQ}from"react";import{useEffect as S1,useMemo as R1,useRef as H1}from"react";import{useMemo as W5,useState as o1}from"react";var U5=1,N5=24,A5=24,V5=4,_5="bg-[color-mix(in_oklch,var(--background),var(--foreground)_3%)] text-muted-foreground pointer-events-none",M5={sunday:0,monday:1,tuesday:2,wednesday:3,thursday:4,friday:5,saturday:6},p=0.05,O5=0.005,b0="h-12",cQ="h-24";var S5=({firstDayOfWeek:Q,dayMaxEvents:q=V5,businessHours:J,locale:Z,translations:$,translator:P,resources:X,orientation:Y="horizontal",weekViewGranularity:K="hourly"})=>{let[B,N]=o1(Z||"en"),V=W5(()=>{if(P)return P;let _=$||F5;return(F)=>_[F]||F},[$,P]);return W5(()=>({firstDayOfWeek:Q,dayMaxEvents:q,businessHours:J,currentLocale:B,setCurrentLocale:N,t:V,resources:X,orientation:Y,weekViewGranularity:K}),[Q,q,J,B,V,X,Y,K])};import{useCallback as u,useEffect as r1,useMemo as R5,useRef as n1,useState as a1}from"react";var N0=(Q)=>{if(Q.resourceIds)return Q.resourceIds;if(Q.resourceId!==void 0)return[Q.resourceId];return[]};function K0(Q,q){return Q.filter((J)=>N0(J).includes(q))}function w0(Q,q,J){let Z=Q.start.isSameOrAfter(q)&&Q.start.isSameOrBefore(J),$=Q.end.isSameOrAfter(q)&&Q.end.isSameOrBefore(J),P=Q.start.isBefore(q)&&Q.end.isAfter(J);return Z||$||P}var H5=(Q)=>!Array.isArray(Q),I5=(Q,{onEventUpdate:q,onEventAdd:J,onEventDelete:Z,setCurrentEvents:$})=>{for(let P of Q.updated)q?.(P);for(let P of Q.added)J?.(P);for(let P of Q.deleted)Z?.(P);$(Q.events)},T5=({events:Q,pluginRuntime:q,getCurrentViewRange:J,resources:Z,onEventAdd:$,onEventUpdate:P,onEventDelete:X})=>{let[Y,K]=a1(Q),B=n1(Q),N=u((U,H)=>q.transformEvents(Y,{start:U,end:H}),[Y,q]),V=R5(()=>{let{start:U,end:H}=J();return N(U,H)},[N,J]);r1(()=>{if(Q!==B.current)K(Q),B.current=Q},[Q]);let _=u((U)=>{K((H)=>[...H,U]),$?.(U)},[$]),F=u((U,H)=>{let T=Y.find((w)=>w.id===U);if(!T)return;let b={...T,...H};K((w)=>w.map((C)=>C.id===U?b:C)),P?.(b)},[Y,P]),W=u((U,H,T)=>{let b=q.getEventManager(U);if(!b?.applyEdit)return;let w=b.applyEdit({event:U,updates:H,currentEvents:Y,scope:T});if(H5(w)){I5(w,{onEventUpdate:P,onEventAdd:$,onEventDelete:X,setCurrentEvents:K});return}P?.({...U,...H}),K(w)},[Y,$,P,X,q]),A=u((U,H)=>{let T=q.getEventManager(U);if(!T?.applyDelete)return;let b=T.applyDelete({event:U,currentEvents:Y,scope:H});if(H5(b)){I5(b,{onEventUpdate:P,onEventAdd:$,onEventDelete:X,setCurrentEvents:K});return}X?.(U),K(b)},[Y,$,P,X,q]),z=u((U)=>{let H=Y.find((T)=>T.id===U);if(!H)return;K((T)=>T.filter((b)=>b.id!==U)),X?.(H)},[Y,X]),O=u((U)=>K0(V,U),[V]),S=u((U)=>V.filter((H)=>N0(H).some((T)=>U.includes(T))),[V]),I=u((U)=>{if(U===void 0)return;return Z.find((H)=>H.id===U)},[Z]),M=u((U)=>{return Boolean(U.resourceIds&&U.resourceIds.length>1)},[]);return R5(()=>({events:V,rawEvents:Y,setCurrentEvents:K,getEventsForDateRange:N,addEvent:_,updateEvent:F,deleteEvent:z,applyScopedEdit:W,applyScopedDelete:A,getEventsForResource:O,getEventsForResources:S,getResourceById:I,isEventCrossResource:M}),[V,Y,N,_,F,z,W,A,O,S,I,M])};import{useCallback as A0,useMemo as t1,useState as r0}from"react";var s1=(Q)=>Q,b5=({currentDate:Q,t:q,disableEventClick:J,disableCellClick:Z,onEventClick:$,onCellClick:P})=>{let[X,Y]=r0(!1),[K,B]=r0(null),[N,V]=r0(null),_=A0((O={})=>{let{start:S,end:I,resourceId:M,resource:U,allDay:H}=O;if(S)V(S);let T=S??Q;B(s1({title:q("newEvent"),start:T,end:I??T.add(1,"hour"),resourceId:M??U?.id,description:"",allDay:H??!1})),Y(!0)},[Q,q]),F=A0(()=>{V(null),B(null),Y(!1)},[]),W=A0((O)=>{B(O),Y(!0)},[]),A=A0((O)=>{if(J)return;if($)$(O);else W(O)},[J,$,W]),z=A0((O)=>{if(Z)return;if(P)P(O);else _(O)},[P,Z,_]);return t1(()=>({isEventFormOpen:X,selectedEvent:K,selectedDate:N,setIsEventFormOpen:Y,setSelectedEvent:B,setSelectedDate:V,openEventForm:_,closeEventForm:F,handleEventClick:A,handleDateClick:z}),[X,K,N,_,F,A,z])};import{useCallback as t,useMemo as FQ,useState as M1}from"react";import{clsx as e1}from"clsx";import{twMerge as Q2}from"tailwind-merge";function L(...Q){return Q2(e1(Q))}import{Square as l2}from"lucide-react";import{AnimatePresence as q2,motion as J2}from"motion/react";import{jsx as w5}from"react/jsx-runtime";var Z2={hidden:({direction:Q})=>({opacity:0,x:Q==="horizontal"?10:0,y:Q==="vertical"?-10:0}),visible:({delay:Q})=>({opacity:1,x:0,y:0,transition:{duration:0.2,ease:[0.4,0,0.2,1],delay:Q}}),exit:({direction:Q})=>({opacity:0,x:Q==="horizontal"?-10:0,y:Q==="vertical"?-10:0,transition:{duration:0.15}})},h=({children:Q,transitionKey:q,delay:J=0,className:Z,direction:$="vertical",layout:P,layoutId:X,"data-testid":Y,ref:K,...B})=>w5(q2,{mode:"wait",children:w5(J2.div,{animate:"visible",className:L("inline-block w-full",Z),custom:{delay:J,direction:$},"data-testid":Y,exit:"exit",initial:"hidden",layout:P,layoutId:X,ref:K,variants:Z2,...B,children:Q},q)});h.displayName="AnimatedSection";import{jsx as j5,Fragment as f5}from"react/jsx-runtime";var f0=({date:Q})=>{let{renderHour:q,timeFormat:J}=R();if(q)return j5(f5,{children:q(Q)});return j5(f5,{children:Q.format(J==="12-hour"?"h A":"H")})};function k(Q){return Q.isSame(j(),"day")}function m(Q){return Q.format("YYYY-MM-DD")}function E(Q,q){let J=Q.startOf("week").day(q),Z=Q.isBefore(J)?J.subtract(1,"week"):J;return Array.from({length:7},($,P)=>Z.add(P,"day"))}function n0(Q,q){let J=Q.startOf("month"),$=E(J,q).at(0)??J;return Array.from({length:6},(P,X)=>{let Y=$.add(X,"week");return E(Y,q)})}function j0(Q){let q=Q.daysInMonth(),J=Q.startOf("month");return Array.from({length:q},(Z,$)=>J.add($,"day"))}function h5({referenceDate:Q=j(),length:q=24}={}){let J=Q.startOf("day");return Array.from({length:q},(Z,$)=>J.hour($).minute(0).second(0).millisecond(0))}var h0=(Q,q)=>{let J=n0(Q,q),Z=J.at(0)?.at(0)??Q,$=J.at(-1)?.at(-1)??Q;return{start:Z.startOf("day"),end:$.endOf("day")}};var z0=(Q)=>String(Q).padStart(2,"0"),$2=(Q)=>typeof Q==="number"?z0(Q):Q,G={col:{time:"time-col",date:"date-col",day:(Q,q)=>{let J=`day-col-${m(Q)}`;return q!=null?`${J}-resource-${q}`:J},resource:(Q,q)=>`${Q}-col-resource-${q}`,allDay:(Q,q)=>`all-day-col-${m(Q)}-${q}`},cell:{day:(Q,q,J=0)=>{let Z=m(Q);return q!=null?`day-cell-${Z}-${z0(q)}-${z0(J)}`:`day-cell-${Z}`},verticalTime:(Q)=>`vertical-time-${z0(Q)}`,vertical:(Q,q,J,Z)=>{let $=`vertical-cell-${m(Q)}-${z0(q)}-${z0(J)}`;return Z!=null?`${$}-resource-${Z}`:$}},container:{vertical:{col:(Q)=>`vertical-col-${Q}`},horizontal:{row:(Q)=>`horizontal-row-${Q}`,rowLabel:(Q)=>`horizontal-row-label-${Q}`,event:(Q)=>`horizontal-event-${Q}`},eventsLayer:(Q,q)=>`${Q}-events-${q}`},header:{resource:{weekDay:"resource-week-day-header",columnsHeader:"resource-columns-header",monthDay:(Q)=>`resource-month-header-${Q.toISOString()}`,timeLabel:(Q,q)=>`resource-${Q}-time-label-${$2(q)}`},weekday:(Q,q)=>`${Q}-header-weekday-${q.toLowerCase()}`,week:{day:(Q)=>`week-header-day-${Q.toISOString()}`,hour:(Q,q)=>`week-header-hour-${Q.toISOString()}-${q}`,resource:(Q)=>`week-header-resource-${Q}`},year:{month:(Q,q)=>q?`year-month-${q}-${Q}`:`year-month-${Q}`,day:(Q,q)=>`year-day-${Q}-${q}`}},allDayRow:(Q)=>`allday-row-${Q??"main"}`,listKey:(...Q)=>Q.join("-"),dayNumber:(Q)=>k(Q)?"day-number-today":`day-number-${Q.format("D")}`,timePicker:(Q)=>`time-picker-${Q??""}`,droppable:{dayCell:(Q,q)=>{let J=Q.toISOString(),Z=q?.allDay?"-allday":"",$=q?.resourceId!=null?`-resource-${q.resourceId}`:"";return`drop-day-cell-${J}${Z}${$}`}}};import{jsx as k5}from"react/jsx-runtime";var P0="w-16 min-w-16 max-w-16",C5="w-[calc(100%-4rem)]",a0="w-10 sm:w-16 min-w-10 sm:min-w-16 max-w-10 sm:max-w-16",l="shadow-[1px_0_0_0_color-mix(in_oklch,var(--background),var(--foreground)_10%)]",a=({days:Q,gridType:q,renderLabel:J,widthClassName:Z=P0})=>({id:q==="hour"?G.col.time:G.col.date,day:void 0,days:Q,className:L("shrink-0",Z,"sticky left-0 bg-background z-20",l),gridType:q,noEvents:!0,renderCell:($)=>k5("div",{className:"text-muted-foreground p-2 text-right text-[10px] sm:text-xs flex flex-col items-center",children:J?J($):k5(f0,{date:$})})});var P2=(Q,q)=>{if(!q)return!0;let J=!1;return k0(q,{date:Q,onMatch:()=>{J=!0}}),J},m5=({date:Q,hour:q,minute:J=0,businessHours:Z})=>{if(!Z)return!0;if(q===void 0)return P2(Q,Z);let $=!1,P=q*60+J;return k0(Z,{date:Q,onMatch:(X)=>{let Y=X.startTime??9,K=X.endTime??17,B=Y*60,N=K*60;if(P>=B&&P<N)$=!0}}),$},k0=(Q,q)=>{let{date:J,onMatch:Z}=q;if(!Q)return;let $=Array.isArray(Q)?Q:[Q];for(let P of $)if(J&&P.daysOfWeek){let X=J.day();if(P.daysOfWeek.some((Y)=>M5[Y]===X))Z(P)}else Z(P)},x5=(Q)=>{let{allDates:q,businessHours:J,resourceBusinessHours:Z=[],hideNonBusinessHours:$}=Q,P=24,X=0,Y=!1,K=(N)=>{Y=!0,P=Math.min(P,N.startTime??9),X=Math.max(X,N.endTime??17)},B=(N)=>{k0(J,{date:N,onMatch:K});for(let V of Z)k0(V,{date:N,onMatch:K})};for(let N of q)B(N);if(!Y&&$){if(B(),!Y)P=9,X=17,Y=!0}return{minStart:P,maxEnd:X,hasBusinessHours:Y}};function C0(Q){return Q.flatMap((q)=>q.businessHours?[q.businessHours]:[])}function m0({referenceDate:Q,businessHours:q,hideNonBusinessHours:J,allDates:Z=[Q],resourceBusinessHours:$=[]}){let P=h5({referenceDate:Q}),X=Boolean(q)||$.length>0;if(!(J&&X))return P;let{minStart:K,maxEnd:B,hasBusinessHours:N}=x5({allDates:Z,businessHours:q,resourceBusinessHours:$,hideNonBusinessHours:J});if(!N)return P;if(K>=B)return[];return P.filter((V)=>{let _=V.hour();return _>=K&&_<B})}import{memo as X2}from"react";import{jsx as p5}from"react/jsx-runtime";var Y2=({className:Q})=>{let{t:q}=R();return p5("div",{className:L("w-16 shrink-0 sticky left-0 bg-background z-20 flex items-center justify-center px-1 text-xs text-muted-foreground",l,Q),children:p5("span",{className:"truncate",children:q("allDay")})})},x0=X2(Y2);import{memo as g2}from"react";import{memo as Q1,useMemo as E2}from"react";import{useMemo as s0}from"react";var K2=(Q,q)=>{let J=Q.filter((X)=>X.end.diff(X.start,q)>0),Z=Q.filter((X)=>X.end.diff(X.start,q)===0),$=[...J].sort((X,Y)=>{let K=X.start.diff(Y.start);if(K!==0)return K;return Y.end.diff(Y.start)-X.end.diff(X.start)}),P=[...Z].sort((X,Y)=>X.start.diff(Y.start));return{sortedMultiUnit:$,sortedSingleUnit:P}},E5=(Q,{firstUnit:q,lastUnit:J,unitCount:Z,gridType:$})=>{let P=j.max(Q.start.startOf($),q),X=$==="hour"?Q.end.subtract(1,"minute"):Q.end,Y=j.min(X.startOf($),J);return{startCol:Math.max(0,P.diff(q,$)),endCol:Math.min(Z-1,Y.diff(q,$)),isTruncatedStart:Q.start.startOf($).isBefore(q),isTruncatedEnd:Q.end.startOf($).isAfter(J)}},t0=(Q,q,J)=>{for(let Z=0;Z<Q.length;Z++){let $=!0;for(let P=q;P<=J;P++)if(Q[Z][P]){$=!1;break}if($)return Z}return-1},D5=({days:Q,events:q,dayMaxEvents:J,gridType:Z="day"})=>{let $=Q.at(0),P=Q.at(-1);if(!$||!P)return[];let X={firstUnit:Z==="hour"?$.startOf("hour"):$.startOf("day"),lastUnit:Z==="hour"?P.endOf("hour"):P.endOf("day"),unitCount:Q.length,gridType:Z},{sortedMultiUnit:Y,sortedSingleUnit:K}=K2(q,Z),B=Array.from({length:J},()=>Array.from({length:X.unitCount},()=>!1)),N=[],V=({row:_,startCol:F,endCol:W,event:A,isTruncatedStart:z,isTruncatedEnd:O})=>{for(let I=F;I<=W;I++)B[_][I]=!0;let S=W-F+1;N.push({kind:"horizontal",event:A,left:F/X.unitCount*100,width:S/X.unitCount*100,row:_,isTruncatedStart:z,isTruncatedEnd:O})};for(let _ of Y){let F=E5(_,X),W=t0(B,F.startCol,F.endCol);if(W!==-1){V({row:W,event:_,...F});continue}for(let A=F.startCol+1;A<=F.endCol;A++){let z=t0(B,A,F.endCol);if(z!==-1){V({row:z,startCol:A,endCol:F.endCol,event:_,isTruncatedStart:!0,isTruncatedEnd:F.isTruncatedEnd});break}}}for(let _ of K){let W=E5(_,X).startCol,A=t0(B,W,W);if(A!==-1)V({row:A,startCol:W,endCol:W,event:_,isTruncatedStart:!1,isTruncatedEnd:!1})}return N};var e0=({days:Q,allDay:q,resourceId:J,gridType:Z})=>{let{getEventsForDateRange:$,dayMaxEvents:P}=R(),X=Q.at(0),Y=Q.at(-1),K=X?.startOf("day"),B=Y?.endOf("day"),N=s0(()=>{if(!K||!B)return[];let F=$(K,B);if(J)F=K0(F,J);if(q)F=F.filter((W)=>Boolean(W.allDay));return F},[$,K,B,J,q]),V=s0(()=>{let F=new Map;for(let W of Q){let A=m(W),z=W.startOf("day"),O=W.endOf("day"),S=N.filter((I)=>w0(I,z,O));F.set(A,S)}return F},[Q,N]);return{positionedEvents:s0(()=>{return D5({days:Q,events:N,dayMaxEvents:P,gridType:Z})},[Q,P,N,Z]),dayEventsMap:V}};import{jsx as v5,jsxs as z2}from"react/jsx-runtime";var c=({today:Q,dayNumber:q,weekday:J,className:Z,"data-testid":$})=>{return z2("div",{className:L("flex flex-col items-center",Z),"data-testid":$,"data-today":Q?"true":void 0,children:[J!=null&&v5("div",{className:L("w-full truncate text-center text-xs text-muted-foreground",Q&&"text-primary"),children:J}),v5("div",{className:L("flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-xs font-medium",Q&&"bg-primary text-primary-foreground"),children:q})]})};import H2,{memo as I2,useMemo as T2}from"react";import{useMemo as B2}from"react";var g5=(Q)=>{let{businessHours:q,getResourceById:J}=R((Z)=>({businessHours:Z.businessHours,getResourceById:Z.getResourceById}));return B2(()=>{if(Q!=null){let Z=J(Q);if(Z?.businessHours)return Z.businessHours}return q},[Q,J,q])};import*as x from"@radix-ui/react-dialog";import{XIcon as L2}from"lucide-react";import{jsx as d,jsxs as Q5}from"react/jsx-runtime";function y5({...Q}){return d(x.Root,{"data-slot":"dialog",...Q})}function G2({...Q}){return d(x.Portal,{"data-slot":"dialog-portal",...Q})}function F2({className:Q,...q}){return d(x.Overlay,{className:L("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",Q),"data-slot":"dialog-overlay",...q})}function c5({className:Q,children:q,...J}){return Q5(G2,{"data-slot":"dialog-portal",children:[d(F2,{}),Q5(x.Content,{className:L("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg max-h-[90%]",Q),"data-slot":"dialog-content",...J,children:[q,Q5(x.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[d(L2,{}),d("span",{className:"sr-only",children:"Close"})]})]})]})}function l5({className:Q,...q}){return d("div",{className:L("flex flex-col gap-2 text-center sm:text-left",Q),"data-slot":"dialog-header",...q})}function d9({className:Q,...q}){return d("div",{className:L("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",Q),"data-slot":"dialog-footer",...q})}function i5({className:Q,...q}){return d(x.Title,{className:L("text-lg leading-none font-semibold",Q),"data-slot":"dialog-title",...q})}function o9({className:Q,...q}){return d(x.Description,{className:L("text-muted-foreground text-sm",Q),"data-slot":"dialog-description",...q})}import{useImperativeHandle as M2,useState as u5}from"react";import{useDraggable as U2}from"@dnd-kit/core";import{memo as N2}from"react";import{jsx as V0,jsxs as _2}from"react/jsx-runtime";var A2=(Q,q)=>{if(Q&&q)return"rounded-none";if(Q)return"rounded-r-md rounded-l-none";if(q)return"rounded-l-md rounded-r-none";return"rounded-md"};function V2({elementId:Q,event:q,className:J,style:Z,disableDrag:$=!1,isTruncatedStart:P=!1,isTruncatedEnd:X=!1}){let{onEventClick:Y,renderEvent:K,disableEventClick:B,disableDragAndDrop:N}=R(),{attributes:V,listeners:_,setNodeRef:F,isDragging:W}=U2({id:Q,data:{event:q,type:"calendar-event"},disabled:$||N}),A=()=>{return _2("div",{className:L(q.backgroundColor||"bg-blue-500",q.color||"text-white","h-full w-full px-1 border-[1.5px] border-card text-left overflow-clip relative",A2(P,X)),style:{backgroundColor:q.backgroundColor,color:q.color},children:[P&&V0("div",{className:"absolute left-0 top-0 bottom-0 w-0.5 bg-foreground/25"}),V0("p",{className:L("text-[10px] font-semibold sm:text-xs mt-0.5",P&&"pl-1",X&&"pr-1"),children:q.title}),X&&V0("div",{className:"absolute right-0 top-0 bottom-0 w-0.5 bg-foreground/25"})]})},z=$||N;return V0(h,{className:L("truncate h-full w-full",z?B?"cursor-default":"cursor-pointer":"cursor-grab",W&&!z&&"cursor-grabbing shadow-lg",J),layout:!0,layoutId:Q,onClick:(M)=>{M.stopPropagation(),Y(q)},ref:F,style:Z,transitionKey:Q,...V,..._,children:K?K(q):V0(A,{})})}var p0=N2(V2,(Q,q)=>{return Q.elementId===q.elementId&&Q.disableDrag===q.disableDrag&&Q.className===q.className&&Q.event===q.event&&Q.isTruncatedStart===q.isTruncatedStart&&Q.isTruncatedEnd===q.isTruncatedEnd});import{jsx as _0,jsxs as O2}from"react/jsx-runtime";var d5=({ref:Q})=>{let[q,J]=u5(!1),[Z,$]=u5(null),{eventHeight:P}=R();return M2(Q,()=>({open:()=>J(!0),close:()=>J(!1),setSelectedDayEvents:(X)=>$(X)})),_0(y5,{onOpenChange:J,open:q,children:O2(c5,{className:"max-h-[80vh] max-w-md overflow-y-auto",children:[_0(l5,{children:_0(i5,{children:Z?.day.format("MMMM D, YYYY")})}),_0("div",{className:"mt-4 space-y-3",children:Z?.events.map((X)=>{return _0(p0,{className:"relative my-1",elementId:`all-events-dialog-event-${X.id}`,event:X,style:{height:`${P}px`}},X.id)})})]})})};import{useDroppable as W2}from"@dnd-kit/core";import{jsx as R2}from"react/jsx-runtime";function S2(Q,q,J){let Z=Q.hour(q??0).minute(J??0);if(q!==void 0&&J!==void 0)return{start:Z,end:Z.minute(J+15)};if(q!==void 0)return{start:Z,end:Z.hour(q+1).minute(0)};return{start:Z,end:Z.hour(23).minute(59)}}function o5({id:Q,type:q,date:J,hour:Z,minute:$,resourceId:P,allDay:X,children:Y,className:K,style:B,"data-testid":N,disabled:V=!1}){let{onCellClick:_,isCellDisabled:F,getCellClassName:W,getResourceById:A,disableDragAndDrop:z,disableCellClick:O,classesOverride:S,view:I}=R(),{start:M,end:U}=S2(J,Z,$),H=A?.(P),T={start:M,end:U,resource:H,allDay:X},b=V||Boolean(F?.(T)),w=O||b,{isOver:C,setNodeRef:r}=W2({id:Q,data:{type:q,date:J,hour:Z,minute:$,resourceId:P,allDay:X},disabled:z||b}),f=($0)=>{if($0.stopPropagation(),w)return;_(T)},y=C&&!z&&!b,s=S?.disabledCell||_5,Z0=W?.(T);return R2("div",{className:L("droppable-cell",K,Z0,y&&"bg-accent",w?"cursor-default":"cursor-pointer",b&&s),"data-all-day":X?"true":void 0,"data-disabled":b.toString(),"data-end":U.toISOString(),"data-resource-id":P,"data-start":M.toISOString(),"data-testid":N,"data-view":I,onClick:f,ref:r,style:B,children:Y})}import{jsx as E0,jsxs as D0,Fragment as r5}from"react/jsx-runtime";var b2=({day:Q,hour:q,minute:J,className:Z="",resourceId:$,gridType:P="day",shouldRenderEvents:X=!0,allDay:Y=!1,precomputedEvents:K,"data-testid":B,showDayNumber:N=!1,children:V})=>{let _=H2.useRef(null),{dayMaxEvents:F=0,getEventsForDateRange:W,currentDate:A,t:z,eventSpacing:O,eventHeight:S}=R(),I=g5($),M=T2(()=>{if(!X)return[];if(K)return K;let f=W(Q.startOf(P),Q.endOf(P));if(Y)f=f.filter((y)=>y.allDay);if($)return K0(f,$);return f},[K,Q,$,W,P,X,Y]),U=(f,y)=>{_.current?.setSelectedDayEvents({day:f,events:y}),_.current?.open()},H=Q.month()===A.month(),T=M.length-F,b=T>0,w=m5({date:Q,hour:P==="hour"?Q.hour():void 0,businessHours:I}),C=P==="hour"?G.cell.day(Q,Q.format("HH"),Q.format("mm")):G.cell.day(Q),r=G.droppable.dayCell(Q,{allDay:Y,resourceId:$});return D0(r5,{children:[E0(o5,{allDay:Y,className:L("cursor-pointer overflow-clip p-1 bg-background hover:bg-accent min-h-[60px] relative min-w-0",Z),"data-testid":B||C,date:Q,disabled:!w||!H,hour:q,id:r,minute:J,resourceId:$,type:"day-cell",children:D0("div",{className:"flex flex-col h-full w-full","data-testid":"grid-cell-content",style:{gap:`${O}px`},children:[N&&E0(c,{className:"items-start","data-testid":G.dayNumber(Q),dayNumber:Q.format("D"),today:k(Q)}),X&&D0(r5,{children:[M.slice(0,F).map((f,y)=>E0("div",{className:"w-full shrink-0","data-testid":f?.title,style:{height:`${S}px`}},G.listKey("empty",y,f.id))),b&&D0("div",{className:"text-muted-foreground hover:text-foreground cursor-pointer text-[10px] whitespace-nowrap sm:text-xs shrink-0 mt-1",onClick:(f)=>{f.stopPropagation(),U(Q,M)},onKeyDown:(f)=>{if(f.key==="Enter"||f.key===" ")f.preventDefault(),f.stopPropagation(),U(Q,M)},role:"button",tabIndex:0,children:["+",T," ",z("more")]})]}),V]})}),E0(d5,{ref:_})]})},q5=I2(b2);import{jsx as n5}from"react/jsx-runtime";var B0=({resource:Q,className:q,children:J,"data-testid":Z})=>{let{renderResource:$}=R();return n5("div",{className:L("flex items-center justify-center p-2",q),"data-testid":Z,style:{color:Q.color,backgroundColor:Q.backgroundColor},children:$?$(Q):J??n5("div",{className:"text-sm font-medium truncate",children:Q.title})})};import{memo as m2}from"react";import{memo as w2}from"react";import{jsx as M0,jsxs as a5,Fragment as j2}from"react/jsx-runtime";var f2=({rangeStart:Q,rangeEnd:q,now:J,axis:Z="vertical",render:$,withDot:P=!0})=>{let X=J??t5(),Y=X.valueOf();if(!(Y>=Q.valueOf()&&Y<q.valueOf()))return null;let B=q.diff(Q,"minute"),V=X.diff(Q,"minute")/B*100;if($)return M0(j2,{children:$({currentTime:X,rangeStart:Q,rangeEnd:q,progress:V,axis:Z})});if(Z==="horizontal")return a5("div",{className:"absolute top-0 bottom-0 z-50 flex -translate-x-1/2 flex-col items-center pointer-events-none","data-testid":"current-time-indicator",style:{left:`${V}%`},children:[P&&M0("div",{className:"size-2 shrink-0 rounded-full bg-red-500"}),M0("div",{className:"w-0.5 flex-1 bg-red-500"})]});return a5("div",{className:"absolute right-0 left-0 z-50 flex -translate-y-1/2 items-center pointer-events-none","data-testid":"current-time-indicator",style:{top:`${V}%`},children:[P&&M0("div",{className:"size-2 shrink-0 rounded-full bg-red-500"}),M0("div",{className:"h-0.5 flex-1 bg-red-500"})]})},s5=w2(f2);import{memo as h2}from"react";import{jsx as C2}from"react/jsx-runtime";var k2=({rangeStart:Q,rangeEnd:q,now:J,resource:Z,axis:$="vertical",withDot:P})=>{let{renderCurrentTimeIndicator:X,view:Y}=R((B)=>({renderCurrentTimeIndicator:B.renderCurrentTimeIndicator,view:B.view})),K;if(X)K=(B)=>X({...B,resource:Z,view:Y});return C2(s5,{axis:$,now:J,rangeEnd:q,rangeStart:Q,render:K,withDot:P})},e5=h2(k2);import{jsx as J5,jsxs as p2}from"react/jsx-runtime";var x2=({gridType:Q="day",days:q,resourceId:J,resource:Z,"data-testid":$,positionedEvents:P,dayNumberHeight:X=N5})=>{let{eventHeight:Y,eventSpacing:K,resources:B}=R(),N=q.at(0)?.startOf("day"),V=!J||B?.at(0)?.id===J,_=q.at(0),F=q.at(-1)?.add(1,Q),W=Q==="hour"&&Boolean(_&&F);return p2("div",{className:"absolute inset-0 pointer-events-none z-10 overflow-clip","data-testid":$,children:[W&&_&&F&&J5(e5,{axis:"horizontal",rangeEnd:F,rangeStart:_,resource:Z,withDot:V}),P.map((A)=>{let{event:z,row:O}=A,S=X+K+O*(Y+K),I=`${z.id}-${O}-${N?.toISOString()}-${J??"no-resource"}`;return J5("div",{className:"absolute z-10 pointer-events-auto overflow-clip","data-left":A.left,"data-testid":G.container.horizontal.event(z.id),"data-top":S,"data-width":A.width,style:{left:`calc(${A.left}% + var(--spacing) * 0.25)`,width:`calc(${A.width}% - var(--spacing) * 1)`,top:`${S}px`,height:`${Y}px`},children:J5(p0,{className:"h-full w-full shadow",elementId:I,event:z,isTruncatedEnd:A.isTruncatedEnd,isTruncatedStart:A.isTruncatedStart})},G.listKey(I,"wrapper"))})]})},Z5=m2(x2);import{jsx as i,jsxs as $5}from"react/jsx-runtime";var D2=({id:Q,resource:q,gridType:J="day",variant:Z="resource",dayNumberHeight:$,className:P,columns:X=[],allDay:Y,showDayNumber:K=!1})=>{let{renderResource:B}=R(),N=Z==="resource",V=X.some((A)=>A.days),_=E2(()=>{if(V)return[];return X.map((A)=>A.day).filter((A)=>Boolean(A))},[X,V]),{positionedEvents:F,dayEventsMap:W}=e0({days:_,gridType:J,resourceId:q?.id,allDay:Y});return $5("div",{className:L("flex flex-1 relative min-w-0",P),"data-testid":G.container.horizontal.row(Q),children:[N&&q&&i(B0,{className:"w-20 sm:w-40 border-r sticky left-0 bg-background z-20 h-full","data-testid":G.container.horizontal.rowLabel(q.id),resource:q,children:B?B(q):i("div",{className:"wrap-break-word text-sm",children:q.title})}),$5("div",{className:"relative flex-1 flex min-w-0",children:[i("div",{className:"flex w-full min-w-0 gap-px bg-border",children:X.map((A)=>{if(A.days)return i(v2,{allDay:Y,col:A,dayNumberHeight:$,gridType:J,id:Q,resource:q,resourceId:q?.id,showDayNumber:K},A.id);return A.day?i(q5,{allDay:Y,className:L("flex-1 w-20",A.className),day:A.day,gridType:J,hour:J==="hour"?A.day.hour():void 0,precomputedEvents:W.get(m(A.day)),resourceId:q?.id,showDayNumber:K},A.day.toISOString()):null})}),!V&&i("div",{className:"absolute inset-0 z-10 pointer-events-none",children:i(Z5,{"data-testid":G.container.eventsLayer("horizontal",Q),dayNumberHeight:$,days:_,gridType:J,positionedEvents:F,resource:q,resourceId:q?.id})})]})]})},v2=Q1(({col:Q,gridType:q="day",allDay:J,resource:Z,resourceId:$,dayNumberHeight:P,showDayNumber:X,id:Y})=>{let K=Q.days??[],{positionedEvents:B}=e0({days:K,gridType:q,resourceId:$,allDay:J});return $5("div",{className:"flex relative w-full",children:[i("div",{className:"flex w-full gap-px bg-border",children:K.map((N)=>i(q5,{allDay:J,className:L("flex-1 w-20",Q.className),day:N,gridType:q,hour:q==="hour"?N.hour():void 0,resourceId:$,showDayNumber:X},N.toISOString()))}),i("div",{className:"absolute inset-0 z-10 pointer-events-none",children:i(Z5,{"data-testid":G.container.eventsLayer("horizontal",Y),dayNumberHeight:P,days:K,gridType:q,positionedEvents:B,resource:Z,resourceId:$})})]})}),q1=Q1(D2);import{jsx as J1,jsxs as c2}from"react/jsx-runtime";var y2=({days:Q,classes:q,resource:J,showSpacer:Z=!0})=>{let $=Q.map((P,X)=>({id:G.col.allDay(P,X),day:P,gridType:"day",className:L("h-full min-h-12 bg-background",q?.cell)}));return c2("div",{className:L("flex w-full gap-px bg-border",q?.row),"data-testid":"all-day-row",children:[Z&&J1(x0,{className:q?.spacer}),J1(q1,{allDay:!0,className:"flex-1 min-h-fit",columns:$,dayNumberHeight:0,gridType:"day",id:G.allDayRow(J?.id),resource:J,variant:"regular"})]})},Z1=g2(y2);import{jsx as L0,jsxs as $1}from"react/jsx-runtime";var D="min-w-20 flex-1",X0=({resources:Q,days:q,gridType:J,cellClassName:Z})=>{let $=q.map((P)=>{let X=Array.isArray(P),Y=X?P.at(0):P;return{id:Y?G.col.day(Y):"day-col-unknown",day:X?void 0:P,days:X?P:void 0,className:Z,gridType:J}});return Q.map((P)=>({id:String(P.id),resource:P,columns:$}))},Y0=({resources:Q,gutter:q,columnsFor:J})=>[q,...Q.flatMap((Z)=>{let $=J(Z);return(Array.isArray($)?$:[$]).map((X)=>({...X,resource:Z}))})],v0=({resources:Q})=>$1("div",{className:"flex gap-px bg-border h-12 flex-1","data-testid":G.header.resource.columnsHeader,children:[L0("div",{className:L("shrink-0 sticky top-0 left-0 bg-background z-20",P0,l)}),Q.map((q)=>L0(B0,{className:L(D,"bg-background"),resource:q},G.listKey("resource-cell",q.id)))]}),G0=()=>{let{t:Q}=R((q)=>({t:q.t}));return L0("div",{className:"w-20 sm:w-40 border-b border-r shrink-0 flex justify-center items-center sticky top-0 left-0 bg-background z-20",children:L0("div",{className:"text-sm truncate px-1 min-w-0",children:Q("resources")})})},W4=({columns:Q})=>{let q=[],J=new Map;for(let Z of Q){if(!Z.resource||Z.noEvents||!Z.day)continue;let $=J.get(Z.resource.id);if(!$)$={resource:Z.resource,days:[],seenDayKeys:new Set},J.set(Z.resource.id,$),q.push($);let P=m(Z.day);if(!$.seenDayKeys.has(P))$.seenDayKeys.add(P),$.days.push(Z.day)}return $1("div",{className:"flex w-full gap-px bg-border",children:[L0(x0,{}),q.map(({resource:Z,days:$})=>L0(Z1,{classes:{cell:L("min-w-20",$.length>1&&"flex-1")},days:$,resource:Z,showSpacer:!1},G.allDayRow(Z.id)))]})};import{jsx as P5}from"react/jsx-runtime";var g0=({hours:Q,view:q,delayStep:J})=>P5("div",{className:L("flex gap-px bg-border border-b",b0),children:Q.map((Z,$)=>{let P=Z.isSame(j(),"hour"),X=Z.format("HH"),Y=G.header.week.hour(Z,$);return P5(h,{className:L(D,"bg-background flex items-center justify-center text-xs shrink-0",P&&"bg-blue-50 text-blue-600 font-medium"),"data-hour":X,"data-testid":G.header.resource.timeLabel(q,X),delay:$*J,transitionKey:G.listKey(Y,"motion"),children:P5(f0,{date:Z})},G.listKey(Y,"animated"))})});import{jsx as Q0,jsxs as Y1,Fragment as o2}from"react/jsx-runtime";var i2=({date:Q})=>{let{t:q}=R((Z)=>({t:Z.t})),J=k(Q);return Q0("div",{className:"flex flex-1 justify-center items-center min-h-12","data-testid":"day-view-header",children:Y1(h,{className:L("flex justify-center items-center text-center text-sm font-semibold sm:text-xl",J&&"text-primary"),transitionKey:m(Q),children:[Q.format("dddd, LL"),J&&Q0("span",{className:"bg-primary text-primary-foreground ml-2 rounded-full px-1 py-0.5 text-xs sm:px-2 sm:text-sm",children:q("today")})]})})},P1=(Q,q)=>m0({referenceDate:Q,businessHours:q.businessHours,hideNonBusinessHours:q.hideNonBusinessHours,allDates:[Q],resourceBusinessHours:C0(q.resources??[])}),u2=({date:Q,config:q})=>{let J=P1(Q,q);return Y1(o2,{children:[Q0(G0,{}),Q0("div",{className:"flex-1 flex flex-col",children:Q0(g0,{delayStep:p,hours:J,view:"day"})})]})},d2=(Q,q)=>{let J=q.resources??[],Z=P1(Q,q);if(!J.length)return[a({days:Z,gridType:"hour"}),{id:G.col.day(Q),day:Q,days:Z,className:L(C5,"flex-1"),gridType:"hour"}];if(q.orientation==="vertical")return Y0({resources:J,gutter:a({days:Z,gridType:"hour"}),columnsFor:($)=>({id:G.col.day(Q,$.id),days:Z,day:Q,gridType:"hour"})});return X0({resources:J,days:Z,gridType:"hour",cellClassName:D})},X1={name:"day",label:"day",icon:l2,navigationUnit:"day",layout:"vertical",supportsResources:!0,range:(Q)=>({start:Q.startOf("day"),end:Q.endOf("day")}),columns:d2,renderHeader:({date:Q,config:q})=>{let J=q.resources??[];if(!J.length)return Q0(i2,{date:Q});if(q.orientation==="vertical")return Q0(v0,{resources:J});return Q0(u2,{config:q,date:Q})}};import{Grid3x3 as r2}from"lucide-react";import{jsx as X5}from"react/jsx-runtime";var K1=({className:Q})=>{let{firstDayOfWeek:q,stickyViewHeader:J,viewHeaderClassName:Z,currentDate:$}=R(),P=E($,q);return X5("div",{className:L("flex w-full gap-px bg-border border-b",J&&"sticky top-0 z-20",Z,Q),"data-testid":"month-header",children:P.map((X,Y)=>X5(h,{className:"py-2 text-center font-medium bg-background flex-1 min-w-0","data-testid":G.header.weekday("month",X.format("ddd")),delay:Y*p,transitionKey:X.toISOString(),children:X5("span",{className:"text-sm capitalize truncate w-full block",children:X.format("ddd")})},X.toISOString()))})};import{jsx as q0,jsxs as e2,Fragment as s2}from"react/jsx-runtime";var n2=(Q,q)=>{let J=j0(Q);return Y0({resources:q,gutter:a({days:J,gridType:"day",renderLabel:(Z)=>q0(c,{className:"flex-col-reverse",dayNumber:Z.format("D"),today:k(Z),weekday:Z.format("ddd")})}),columnsFor:(Z)=>({id:G.col.resource("month",Z.id),day:void 0,days:J,gridType:"day"})})},a2=({date:Q})=>{let q=j0(Q);return e2(s2,{children:[q0(G0,{}),q0("div",{className:"flex flex-1 gap-px bg-border border-b",children:q.map((J,Z)=>{let $=G.header.resource.monthDay(J),P=k(J);return q0(h,{className:"flex-1 w-20 bg-background shrink-0 flex items-center justify-center flex-col",delay:Z*p,transitionKey:G.listKey($,"motion"),children:q0(c,{className:"flex-col-reverse",dayNumber:J.format("D"),today:P,weekday:J.format("ddd")})},G.listKey($,"animated"))})})]})},t2=(Q,q)=>{let J=q.resources??[];if(J.length){if(q.orientation==="vertical")return n2(Q,J);return X0({resources:J,days:j0(Q),gridType:"day"})}return n0(Q,q.firstDayOfWeek).map((Z,$)=>({id:G.listKey("week",$),columns:Z.map((P)=>({id:G.col.day(P),day:P,className:"w-auto",gridType:"day"})),className:"flex-1",showDayNumber:!0}))},z1={name:"month",label:"month",icon:r2,navigationUnit:"month",layout:"horizontal",supportsResources:!0,range:(Q,q)=>h0(Q,q.firstDayOfWeek),columns:t2,renderHeader:({date:Q,config:q})=>{let J=q.resources??[];if(!J.length)return q0(K1,{className:"h-12"});if(q.orientation==="vertical")return q0(v0,{resources:J});return q0(a2,{date:Q})}};import{Columns3 as qQ}from"lucide-react";import{jsx as y0}from"react/jsx-runtime";var B1=({days:Q})=>{let{weekViewGranularity:q}=R(),J=q==="hourly";return y0("div",{className:L("flex gap-px bg-border border-b",b0),children:Q.map((Z,$)=>{let P=k(Z),X=G.header.week.day(Z);return y0(h,{className:L("shrink-0 bg-background flex-1 flex items-center text-center font-medium min-w-20"),"data-testid":G.header.resource.weekDay,delay:$*p,transitionKey:G.listKey(X,"motion"),children:y0("div",{className:L(J?"sticky left-1/2":"w-full text-center"),children:y0(c,{dayNumber:Z.format("D"),today:P,weekday:Z.format("ddd")})})},G.listKey(X,"animated"))})})};import{jsx as c0,jsxs as QQ}from"react/jsx-runtime";var L1=({columns:Q})=>{let{currentDate:q}=R();return QQ("div",{className:"flex h-12 gap-px bg-border",children:[c0("div",{className:L("shrink-0 z-20 bg-background sticky left-0",P0,l),children:c0("span",{className:"px-2 h-full w-full flex justify-center items-start font-medium",children:q.week()})}),Q.map((J,Z)=>{let $=J.day;if(!$)return null;let P=k($),X=G.header.week.hour($,J.resourceId??"");return c0(h,{className:L(D,"flex flex-col items-center justify-center text-xs shrink-0 bg-background"),"data-testid":G.header.resource.timeLabel("week",$.format("HH")),delay:Z*p,transitionKey:G.listKey(X,"motion"),children:c0(c,{dayNumber:$.format("D"),today:P,weekday:$.format("ddd")})},G.listKey(X,"animated"))})]})};import{jsx as O0,jsxs as G1}from"react/jsx-runtime";var F1=({resources:Q})=>{let{weekViewGranularity:q,t:J,currentDate:Z}=R(),$=q==="hourly";return G1("div",{className:"flex h-12 gap-px bg-border",children:[O0("div",{className:L("shrink-0 z-20 bg-background sticky left-0",P0,l),children:G1("span",{className:L("px-2 h-full w-full flex flex-col justify-center text-xs text-muted-foreground text-center min-w-0",$?"justify-end":"justify-center"),children:[O0("span",{className:"truncate w-full",children:J("week")}),!$&&O0("span",{className:"font-medium text-foreground truncate w-full",children:Z.week()})]})}),Q.map((P)=>{return O0(B0,{className:L(D,"bg-background border-b"),resource:P,children:O0("div",{className:L("sticky text-sm font-medium truncate",$?"left-1/4":"left-1"),children:P.title})},G.listKey("resource-cell",P.id))})]})};import{jsx as v,jsxs as W0,Fragment as KQ}from"react/jsx-runtime";var l0=(Q,q)=>{let J=E(Q,q.firstDayOfWeek),{hiddenDays:Z}=q;if(!Z)return J;return J.filter(($)=>!Z.has($.day()))},i0=(Q)=>(Q.weekViewGranularity??"hourly")==="hourly",JQ=({date:Q,config:q})=>{let{t:J,selectDate:Z,openEventForm:$}=R((X)=>({t:X.t,selectDate:X.selectDate,openEventForm:X.openEventForm})),P=l0(Q,q);return W0("div",{className:"flex h-18 flex-1 gap-px bg-border","data-testid":"week-view-header",children:[v("div",{className:L(a0,"h-full shrink-0 items-center justify-center bg-background p-2 flex",l),children:W0("div",{className:"flex flex-col items-center justify-center min-w-0 w-full",children:[v("span",{className:"text-muted-foreground text-xs truncate w-full text-center",children:J("week")}),v("span",{className:"font-medium truncate w-full text-center",children:Q.week()})]})}),P.map((X,Y)=>{let K=k(X),B=G.header.week.day(X);return v(h,{className:L("hover:bg-accent bg-background flex-1 min-w-0 flex flex-col justify-center cursor-pointer p-1 text-center sm:p-2 w-20 h-full"),"data-testid":G.header.weekday("week",X.format("dddd")),delay:Y*p,onClick:()=>{Z(X),$({start:X})},transitionKey:B,children:v(c,{dayNumber:X.format("D"),today:K,weekday:X.format("ddd")})},B)})]})},F0=(Q,q,J)=>m0({referenceDate:Q,businessHours:q.businessHours,hideNonBusinessHours:q.hideNonBusinessHours,allDates:J,resourceBusinessHours:C0(q.resources??[])}),ZQ=(Q,q,J)=>{let Z=E(Q,q.firstDayOfWeek);if(i0(q)){let $=l0(Q,q);return Y0({resources:J,gutter:a({days:F0(Q,q,Z),gridType:"hour"}),columnsFor:(P)=>$.map((X)=>({id:G.col.day(X,P.id),className:D,day:X,days:F0(X,q,Z),gridType:"hour"}))})}return Y0({resources:J,gutter:a({days:Z,gridType:"day",renderLabel:($)=>v(c,{dayNumber:$.format("D"),today:k($),weekday:$.format("ddd")})}),columnsFor:($)=>({id:G.col.resource("week",$.id),className:D,day:void 0,days:Z,gridType:"day"})})},$Q=(Q,q,J)=>{let Z=E(Q,q.firstDayOfWeek);if(i0(q)){let $=Z.map((P)=>F0(P,q));return X0({resources:J,days:$,gridType:"hour",cellClassName:D})}return X0({resources:J,days:Z,gridType:"day",cellClassName:D})},PQ=({date:Q,config:q,resources:J})=>{let Z=l0(Q,q),$=i0(q),P=$?J.flatMap((X)=>Z.map((Y)=>({day:Y,resourceId:X.id}))):[];return W0("div",{className:"flex-1 flex flex-col",children:[v(F1,{resources:J}),$&&v(L1,{columns:P})]})},XQ=({date:Q,config:q})=>{let J=E(Q,q.firstDayOfWeek),Z=i0(q),$=Z?J.flatMap((P)=>F0(P,q)):[];return W0(KQ,{children:[v(G0,{}),W0("div",{className:"flex-1 flex flex-col",children:[v(B1,{days:J}),Z&&v(g0,{delayStep:O5,hours:$,view:"week"})]})]})},YQ=(Q,q)=>{let J=q.resources??[];if(J.length){if(q.orientation==="vertical")return ZQ(Q,q,J);return $Q(Q,q,J)}let Z=E(Q,q.firstDayOfWeek),$=l0(Q,q);return[a({days:F0(Q,q,Z),gridType:"hour",widthClassName:a0}),...$.map((P)=>({id:G.col.day(P),day:P,days:F0(P,q,Z),className:"flex-1 min-w-0",gridType:"hour"}))]},U1={name:"week",label:"week",icon:qQ,navigationUnit:"week",layout:"vertical",supportsResources:!0,range:(Q,q)=>{let J=E(Q,q.firstDayOfWeek),Z=J.at(0)??Q,$=J.at(-1)??Q;return{start:Z.startOf("day"),end:$.endOf("day")}},columns:YQ,renderHeader:({date:Q,config:q})=>{let J=q.resources??[];if(!J.length)return v(JQ,{config:q,date:Q});if(q.orientation==="vertical")return v(PQ,{config:q,date:Q,resources:J});return v(XQ,{config:q,date:Q,resources:J})}};import{Grid2x2 as GQ}from"lucide-react";import*as o from"@radix-ui/react-scroll-area";import{jsx as S0,jsxs as zQ}from"react/jsx-runtime";function N1({className:Q,children:q,viewPortProps:J,...Z}){return zQ(o.Root,{className:L("relative",Q),"data-slot":"scroll-area",...Z,children:[S0(o.Viewport,{...J,className:L("focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",J?.className),"data-slot":"scroll-area-viewport",children:q}),S0(Y5,{}),S0(o.Corner,{})]})}function Y5({className:Q,orientation:q="vertical",...J}){return S0(o.ScrollAreaScrollbar,{className:L("flex touch-none p-px transition-colors select-none",q==="vertical"&&"h-full w-2.5 border-l border-l-transparent",q==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",Q),"data-slot":"scroll-area-scrollbar",orientation:q,...J,children:S0(o.ScrollAreaThumb,{className:"bg-border relative flex-1 rounded-full","data-slot":"scroll-area-thumb"})})}import{jsx as J0,jsxs as R0}from"react/jsx-runtime";var BQ=["bg-primary","bg-blue-500","bg-green-500"],LQ=42,A1=()=>{let{currentDate:Q,selectDate:q,setView:J,getEventsForDateRange:Z,t:$,firstDayOfWeek:P}=R(),X=Q.year(),Y=E(j(),P).map((z)=>({id:z.day().toString(),label:z.format("dd")})),K=()=>{return Array.from({length:12},(z,O)=>{let S=j().year(X).month(O).startOf("month"),I=Z(S,S.endOf("month"));return{date:S,name:S.format("MMMM"),eventCount:I.length,monthKey:S.format("MM")}})},B=(z)=>{let O=z.startOf("month"),S=E(O,P).at(0)??O;return Array.from({length:LQ},(I,M)=>{let U=S.add(M,"day"),H=U.startOf("day"),T=U.endOf("day"),b=Z(H,T);return{date:U,dayKey:m(U),isInCurrentMonth:U.month()===z.month(),isToday:k(U),isSelected:U.isSame(Q,"day"),eventCount:b.length}})},N=(z,O,S)=>{S?.stopPropagation(),q(z),J(O)},V=(z)=>{let O=z===1?$("event"):$("events");return`${z} ${O}`},_=(z)=>{let S=z.isInCurrentMonth?"":"text-muted-foreground opacity-50",I=z.isToday?"bg-primary text-primary-foreground rounded-full":"",M=z.isSelected&&!z.isToday?"bg-muted rounded-full font-bold":"",U=z.eventCount>0&&!z.isToday&&!z.isSelected?"font-medium":"";return L("relative flex aspect-square w-full cursor-pointer flex-col items-center justify-center hover:bg-accent rounded-sm transition-colors duration-200",S,I,M,U)},F=(z,O)=>{return L("h-[3px] w-[3px] rounded-full",O?"bg-primary-foreground":z)},W=K(),A=(z)=>{if(z===0)return"";return V(z)};return R0(N1,{className:"h-full","data-testid":"year-view",children:[J0("div",{className:"grid auto-rows-fr grid-cols-1 gap-4 p-4 sm:grid-cols-2 lg:grid-cols-3","data-testid":"year-grid",children:W.map((z,O)=>{let S=B(z.date),I=O*p;return R0("div",{className:"hover:border-primary flex flex-col rounded-lg border p-3 text-left transition-all duration-200 hover:shadow-md","data-testid":G.header.year.month(z.monthKey),children:[R0(h,{className:"mb-2 flex items-center justify-between",delay:I,transitionKey:G.listKey("month",z.monthKey),children:[J0("button",{className:"text-lg font-medium hover:underline cursor-pointer","data-testid":G.header.year.month(z.monthKey,"title"),onClick:()=>N(z.date,"month"),type:"button",children:z.name}),z.eventCount>0&&J0("span",{className:"bg-primary text-primary-foreground rounded-full px-2 py-1 text-xs","data-testid":G.header.year.month(z.monthKey,"count"),children:V(z.eventCount)})]},G.listKey("month",z.monthKey)),R0("div",{className:"grid grid-cols-7 gap-px text-[0.6rem]","data-testid":G.header.year.month(z.monthKey,"mini"),children:[Y.map((M)=>J0("div",{className:"text-muted-foreground h-3 text-center",children:M.label},G.listKey("header",z.monthKey,M.id))),S.map((M)=>{let U=G.header.year.day(z.date.format("YYYY-MM"),M.dayKey),H=M.eventCount>0,T=Math.min(M.eventCount,3),b=BQ.slice(0,T);return R0("button",{className:_(M),"data-testid":U,onClick:(w)=>N(M.date,"day",w),title:A(M.eventCount),type:"button",children:[J0("span",{className:"text-center leading-none",children:M.date.date()}),H&&J0("div",{className:L("absolute bottom-0 flex w-full justify-center space-x-px",M.isToday&&"bottom-px"),children:b.map((w)=>J0("span",{className:F(w,M.isToday)},w))})]},M.dayKey)})]})]},z.monthKey)})}),J0(Y5,{className:"z-30"})]})};var V1={name:"year",label:"year",icon:GQ,navigationUnit:"year",supportsResources:!1,range:(Q)=>({start:Q.startOf("year"),end:Q.endOf("year")}),component:A1};var _1=[X1,U1,z1,V1];var K5=(Q,q,J)=>q?.range?.(Q,{firstDayOfWeek:J})??h0(Q,J),O1=({initialDate:Q,initialView:q,firstDayOfWeek:J,onDateChange:Z,onViewChange:$,pluginRuntime:P})=>{let[X,Y]=M1(j.isDayjs(Q)?Q:j(Q)),[K,B]=M1(q),N=t(()=>[..._1,...P.getViews()],[P]),V=t((M)=>N().find((U)=>U.name===M),[N]),_=t(()=>{return K5(X,V(K),J)},[X,K,J,V]),F=t((M)=>{Y(M);let U=K5(M,V(K),J);Z?.(M,U)},[Z,K,J,V]),W=F,A=t((M)=>{let U=V(K),H=U?.navigationStep??{amount:1,unit:U?.navigationUnit??"day"};F(X.add(M*H.amount,H.unit))},[X,K,F,V]),z=t(()=>A(1),[A]),O=t(()=>A(-1),[A]),S=t(()=>F(j()),[F]),I=t((M)=>{B(M),$?.(M);let U=K5(X,V(M),J);Z?.(X,U)},[$,Z,X,J,V]);return FQ(()=>({currentDate:X,setCurrentDate:Y,view:K,setView:I,selectDate:W,nextPeriod:z,prevPeriod:O,today:S,getCurrentViewRange:_,getAllViews:N}),[X,K,I,W,z,O,S,_,N])};import{createElement as UQ,Fragment as NQ}from"react";var W1=(Q)=>({transformEvents:(q,J)=>{return Q.reduce(($,P)=>P.transformEvents?P.transformEvents($,J):$,q).filter(($)=>w0($,J.start,J.end))},getEventManager:(q)=>Q.find((J)=>J.managesEvent?.(q)),collect:(q,J)=>Q.flatMap((Z)=>Z.contribute?.(q,J)??[]),renderSlot:(q,J)=>{let Z=[];for(let $ of Q){let P=$.renderSlot?.(q,J);if(P!==null&&P!==void 0)Z.push(UQ(NQ,{key:$.name},P))}return Z},getViews:()=>Q.flatMap((q)=>q.views??[]),getProviders:()=>Q.map((q)=>q.provider).filter((q)=>Boolean(q))});var AQ=[],VQ=[],I1=(Q)=>{let{events:q,firstDayOfWeek:J=0,initialView:Z="month",initialDate:$=j(),dayMaxEvents:P,businessHours:X,onEventAdd:Y,onEventUpdate:K,onEventDelete:B,onDateChange:N,onViewChange:V,locale:_,timezone:F,translations:W,translator:A,onEventClick:z,onCellClick:O,disableEventClick:S,disableCellClick:I,resources:M,orientation:U,weekViewGranularity:H}=Q,{plugins:T=VQ}=Q,b=S5({firstDayOfWeek:J,dayMaxEvents:P,businessHours:X,locale:_,translations:W,translator:A,resources:M,orientation:U,weekViewGranularity:H}),w=R1(()=>W1(T),[T]),C=O1({initialDate:$,initialView:Z,firstDayOfWeek:J,onDateChange:N,onViewChange:V,pluginRuntime:w}),r=T5({events:q,pluginRuntime:w,getCurrentViewRange:C.getCurrentViewRange,resources:b.resources??AQ,onEventAdd:Y,onEventUpdate:K,onEventDelete:B}),f=b5({currentDate:C.currentDate,t:b.t,disableEventClick:S,disableCellClick:I,onEventClick:z,onCellClick:O}),{setCurrentLocale:y}=b,{setCurrentDate:s}=C,{setCurrentEvents:Z0}=r,$0=H1(void 0);S1(()=>{if(_&&_!==$0.current)y(_),j.locale(_),s((n)=>n.locale(_)),$0.current=_},[_,y,s]);let U0=H1(F);return S1(()=>{if(F&&F!==U0.current)j.tz.setDefault(F),s((n)=>n.tz(F)),Z0((n)=>n.map((e)=>({...e,start:e.start.tz(F),end:e.end.tz(F)}))),U0.current=F},[F,s,Z0]),R1(()=>{let{setCurrentLocale:n,...e}=b,{getCurrentViewRange:u0,getAllViews:H0,...I0}=C,{setCurrentEvents:d0,...o0}=r;return{...e,...I0,...o0,...f,getViews:H0,getEventManager:w.getEventManager,renderSlot:w.renderSlot,collect:w.collect,getProviders:w.getProviders,getEventResourceIds:N0,currentRange:C.getCurrentViewRange()}},[b,C,r,f,w])};import{jsx as _Q}from"react/jsx-runtime";var T1=(Q,q)=>Q.reduceRight((J,Z,$)=>_Q(Z,{children:J},$),q);import{jsx as SQ}from"react/jsx-runtime";var OQ=[],WQ=(Q)=>{let{events:q=OQ,firstDayOfWeek:J=0,initialView:Z="month",initialDate:$,renderEvent:P,onEventClick:X,onCellClick:Y,isCellDisabled:K,getCellClassName:B,onViewChange:N,onEventAdd:V,onEventUpdate:_,onEventDelete:F,onDateChange:W,locale:A,timezone:z,disableCellClick:O,disableEventClick:S,disableDragAndDrop:I,dayMaxEvents:M,eventSpacing:U=U5,eventHeight:H=A5,stickyViewHeader:T=!0,viewHeaderClassName:b="",headerComponent:w,headerClassName:C,businessHours:r,renderEventForm:f,translations:y,translator:s,timeFormat:Z0="12-hour",classesOverride:$0,renderCurrentTimeIndicator:U0,renderHour:n,hideNonBusinessHours:e=!1,hideExportButton:u0=!1,hiddenDays:H0,slotDuration:I0=60,scrollTime:d0,plugins:o0,resources:b1,renderResource:z5,orientation:w1,weekViewGranularity:f1}=Q,B5=I1({events:q,firstDayOfWeek:J,initialView:Z,initialDate:$,dayMaxEvents:M,businessHours:r,onEventAdd:V,onEventUpdate:_,onEventDelete:F,onDateChange:W,onViewChange:N,locale:A,timezone:z,translations:y,translator:s,plugins:o0,onEventClick:X,onCellClick:Y,disableEventClick:S,disableCellClick:O,resources:b1,orientation:w1,weekViewGranularity:f1});return MQ(()=>{let{handleEventClick:j1,handleDateClick:h1,...k1}=B5;return{...k1,renderEvent:P,onEventClick:j1,onCellClick:h1,isCellDisabled:K,getCellClassName:B,locale:A,timezone:z,disableCellClick:O,disableEventClick:S,disableDragAndDrop:I,eventSpacing:U,eventHeight:H,stickyViewHeader:T,viewHeaderClassName:b,headerComponent:w,headerClassName:C,renderEventForm:f,timeFormat:Z0,classesOverride:$0,renderCurrentTimeIndicator:U0,renderHour:n,hideNonBusinessHours:e,hideExportButton:u0,hiddenDays:H0,slotDuration:I0,scrollTime:d0,renderResource:z5}},[B5,P,z5,K,B,A,z,O,S,I,U,H,T,b,w,C,f,Z0,$0,U0,n,e,u0,H0,I0,d0])},oZ=({children:Q,...q})=>{let J=WQ(q),Z=T1(J.getProviders(),Q);return SQ(T0.Provider,{value:J,children:Z})};
|
|
2
|
-
export{j as a,R as b,vQ as c,L as d,h as e,y5 as f,c5 as g,l5 as h,d9 as i,i5 as j,o9 as k,N1 as l,Y5 as m,k as n,E as o,n0 as p,G as q,g5 as r,U5 as s,A5 as t,M5 as u,cQ as v,P2 as w,x5 as x,K0 as y,p0 as z,q5 as A,e5 as B,q1 as C,a0 as D,Z1 as E,W4 as F,F5 as G,oZ as H};
|