@ilamy/calendar 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +28 -5
- package/dist/index.js +2 -2
- package/dist/plugins/agenda.d.ts +8 -4
- package/dist/plugins/agenda.js +1 -1
- package/dist/plugins/drag-to-create.d.ts +8 -4
- package/dist/plugins/drag-to-create.js +1 -1
- package/dist/plugins/recurrence.d.ts +8 -4
- package/dist/plugins/recurrence.js +2 -2
- package/dist/shared/{chunk-a9j9sahk.js → chunk-6g0xvnsf.js} +1 -1
- package/dist/shared/chunk-7v2pzs62.js +2 -0
- package/dist/shared/chunk-7vqv0k0j.js +2 -0
- package/dist/testing/index.d.ts +8 -4
- package/dist/testing/index.js +1 -1
- package/package.json +1 -3
- package/dist/shared/chunk-328e2ygt.js +0 -2
- package/dist/shared/chunk-jfadfww5.js +0 -2
package/dist/index.d.ts
CHANGED
|
@@ -64,15 +64,19 @@ interface BusinessHours {
|
|
|
64
64
|
*/
|
|
65
65
|
daysOfWeek?: WeekDays[];
|
|
66
66
|
/**
|
|
67
|
-
* Start time for business hours
|
|
67
|
+
* Start time for business hours: a whole 24-hour number (0-24) or an
|
|
68
|
+
* 'HH:mm' string for sub-hour boundaries (e.g. '09:15'). Fractional
|
|
69
|
+
* numbers round to the nearest hour — use a string for sub-hour precision.
|
|
68
70
|
* @default 9
|
|
69
71
|
*/
|
|
70
|
-
startTime?: number;
|
|
72
|
+
startTime?: number | string;
|
|
71
73
|
/**
|
|
72
|
-
* End time for business hours
|
|
74
|
+
* End time for business hours: a whole 24-hour number (0-24) or an
|
|
75
|
+
* 'HH:mm' string for sub-hour boundaries (e.g. '17:15'). Fractional
|
|
76
|
+
* numbers round to the nearest hour — use a string for sub-hour precision.
|
|
73
77
|
* @default 17
|
|
74
78
|
*/
|
|
75
|
-
endTime?: number;
|
|
79
|
+
endTime?: number | string;
|
|
76
80
|
}
|
|
77
81
|
/**
|
|
78
82
|
* Resource interface representing a calendar resource (person, room, equipment, etc.)
|
|
@@ -341,7 +345,26 @@ interface EventMutationScopeSlotContext {
|
|
|
341
345
|
import dayjs from "dayjs";
|
|
342
346
|
type Dayjs3 = dayjs.Dayjs3;
|
|
343
347
|
type ManipulateType3 = dayjs.ManipulateType3;
|
|
344
|
-
|
|
348
|
+
/**
|
|
349
|
+
* dayjs's statics without its call signatures. Mapping over the keys drops the
|
|
350
|
+
* call signatures, which is what lets the exported type re-advertise only the
|
|
351
|
+
* single-argument constructor.
|
|
352
|
+
*/
|
|
353
|
+
type DayjsStatics = { [K in keyof typeof dayjs] : (typeof dayjs)[K] };
|
|
354
|
+
/**
|
|
355
|
+
* The configured dayjs: a one-argument constructor plus every dayjs static.
|
|
356
|
+
*
|
|
357
|
+
* The constructor forwards its arguments to `dayjs.tz()`, whose second
|
|
358
|
+
* parameter is a TIMEZONE and not a parse format, so `dayjs(input, 'YYYY-MM-DD')`
|
|
359
|
+
* threw `RangeError: invalid time zone` at runtime while type-checking cleanly
|
|
360
|
+
* (see the recurrence date-picker bug). Format parsing would additionally need
|
|
361
|
+
* the CustomParseFormat plugin, which this module deliberately does not extend
|
|
362
|
+
* (https://day.js.org/docs/en/parse/string-format). Offering only the
|
|
363
|
+
* one-argument form turns that mistake into a compile error. To parse in an
|
|
364
|
+
* explicit zone, call `dayjs.tz(input, timezone)`.
|
|
365
|
+
*/
|
|
366
|
+
type ConfiguredDayjs = ((date?: dayjs.ConfigType) => dayjs.Dayjs3) & DayjsStatics;
|
|
367
|
+
declare const _default: ConfiguredDayjs;
|
|
345
368
|
/**
|
|
346
369
|
* The calendar's plugin mount points. These belong to the host (the components
|
|
347
370
|
* that render them: the event form and the drag-and-drop flow), NOT to the
|
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-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
|
|
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 u2,w as lP,x as uP,y as g2,z as E2}from"./shared/chunk-7v2pzs62.js";import"./shared/chunk-7vqv0k0j.js";var NP="event-form",KP="event-mutation-scope",LP=({event:P,onChange:p})=>{return G((f)=>f.renderSlot)(NP,{event:P,onChange:p})},M0=({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 F4,useMemo as M4}from"react";import{DndContext as T5,MouseSensor as S5,pointerWithin as g5,TouchSensor as D5,useSensor as MP,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:F=0,minute:M=0}=z;J=_(N).hour(F).minute(M)}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 FP=({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=MP(S5,{activationConstraint:{distance:2}}),X=MP(D5,{activationConstraint:{delay:100,tolerance:5}}),N=E5(Q,X),F=(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)},M=(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;F(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:M,sensors:N,children:[P,VP(FP,{ref:$})]}),VP(M0,{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 x5,useState as u5}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 x({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 u,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]=u5(o0(P)?P:"");x5(()=>{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:[u("span",{className:q("size-5 shrink-0 rounded-full border",!J&&P),style:J?{backgroundColor:P}:void 0}),u("span",{className:q(J&&"font-mono text-xs"),children:Q})]}),u(i5,{className:"size-4 shrink-0 opacity-50"})]}),q0(x,{className:"w-56","data-slot":"color-picker-content",children:[$.length>0&&u("div",{className:"grid grid-cols-7 gap-1.5",children:$.map((X)=>{let N=P===X.value;return u("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)})}),u("div",{className:"text-muted-foreground mt-3 mb-1.5 text-xs",children:"Custom"}),q0("div",{className:"flex items-center gap-2",children:[u("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"}),u(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")),F,M;if(Z){let K=N0(Z,z);F=K.at(0),M=K.at(-1)}let W=(K)=>{let A=K.format("YYYY-MM-DD")===X,V=!1;if(F&&M){let m=!K.isBefore(F,"day"),B=!K.isAfter(M,"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 x0}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:x0(o,{children:[$0(i,{asChild:!0,children:x0(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})]})}),x0(x,{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 u0}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 F=Math.floor(N/60),M=N%60,W=`${F.toString().padStart(2,"0")}:${M.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 xP({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]=u0(!1),[X,N]=u0(""),F=iP(null),M=iP(null),[W,K]=u0(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(M.current)K(M.current.offsetWidth);setTimeout(()=>{F.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:M,role:"combobox",variant:"outline",children:[c(qp,{className:"mr-2 h-4 w-4"}),Q0]})}),c0(x,{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:F,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}=uP({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 Mp}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}},Fp=({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:F}=G((L)=>({t:L.t,timeFormat:L.timeFormat,getEventManager:L.getEventManager,resources:L.resources??[]})),{id:M,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=F.length>0,bP=W??K?.at(0),ZP=zP&&bP===void 0,[S0,P5]=w(bP),g0=zP?S0:W,F0=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 F.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=Fp({colorChanged:f5,hadInitialColor:b5,selectedColor:D0,initialBackgroundColor:Q0,initialColor:B}),X0={id:M||_().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(M)$?.(X0);else z?.(X0);p()},G5=()=>{if(!P?.id)return;if(YP){Z(P);return}f?.(P),p()},UP;if(F0)UP=(L)=>!lP(_(L),F0);let F5=d0(s,F0),M5=d0(e,F0),A5=[["startDate",s,q5],["endDate",e,U5]],V5=[["startTime","start-time",E0,N5,F5],["endTime","end-time",w0,K5,M5]],W5=S0?.toString();return g(Mp,{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:F.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(xP,{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:[M&&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:M?Q("update"):Q("create")})]})]})]}),I(M0,{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,F=(B)=>{z(B),U(!1)},M=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)}[M],A=a(K0,{defaultMonth:p.toDate(),firstDayOfWeek:b,onSelect:(B)=>B&&F(_(B)),selected:p.toDate()}),m={year:a(Q2,{onSelect:F,selected:p}),month:a(Y2,{onSelect:F,selected:p}),week:a(K0,{defaultMonth:p.toDate(),firstDayOfWeek:b,highlightedWeekOf:p,onSelect:(B)=>B&&F(_(B)),weekHover:!0}),day:A,range:A}[M];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(x,{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
|
-
`,"\\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};
|
|
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 F2({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"}}),M2=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(M2.Provider,{value:{variant:p,size:$},children:f})})}function V2({className:P,children:p,variant:$,size:f,...z}){let b=vp(M2);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(F2,{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 x2}from"react";import{useRef as ep}from"react";import{useEffect as xp,useRef as up}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=up(null);xp(()=>{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 M=p&&z0(I2,{className:$?.header,children:p});return R2("div",{className:"h-full flex flex-col","data-testid":"horizontal-grid-container",children:[N&&M,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&&M,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:F}=X,M=`event-${F.id}-${N}-${P.at(0)?.toISOString()}-${$??"no-resource"}`,W=F.end.diff(F.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:M,event:F})},k.listKey(M,"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},(F,M)=>M*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((F,M)=>{let W=F.format("HH");if(Y){let K=P===k.col.time,A=K?k.cell.verticalTime(W):k.cell.vertical(F,W,"00",U);return Z0("div",{className:"min-h-[60px] bg-background","data-hour":K?W:void 0,"data-testid":A,children:Y(F)},k.listKey(P,M,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(F,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?F.minute(K):F,gridType:z,hour:z==="hour"?F.hour():void 0,minute:N?K:void 0,resourceId:U,shouldRenderEvents:!1,slotDurationMinutes:J},k.listKey(P,M,V))})},k.listKey(P,M,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:F}=G(),M=K4(null);m0({viewportRef:M,scrollTime:F,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:M},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&&u2,"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=x2(()=>({firstDayOfWeek:$,hiddenDays:f,businessHours:z,hideNonBusinessHours:b,resources:Y,orientation:Z,weekViewGranularity:J}),[$,f,z,b,Y,Z,J]),Q=x2(()=>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),F=N?Z??"horizontal":P.layout,M=N?"resource":"regular",W=P.renderHeader?.({date:p,config:U});if(L4(Q,F))return t(_4,{composesResourceAxis:N,header:W,specs:Q,variant:M});return t(G4,{composesResourceAxis:N,header:W,specs:Q,variant:M})};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,...F})=>{let M=Boolean(X?.length),W=M4(()=>l2(P),[P]);return F4(()=>{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,M]),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,...F,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};
|
package/dist/plugins/agenda.d.ts
CHANGED
|
@@ -64,15 +64,19 @@ interface BusinessHours {
|
|
|
64
64
|
*/
|
|
65
65
|
daysOfWeek?: WeekDays[];
|
|
66
66
|
/**
|
|
67
|
-
* Start time for business hours
|
|
67
|
+
* Start time for business hours: a whole 24-hour number (0-24) or an
|
|
68
|
+
* 'HH:mm' string for sub-hour boundaries (e.g. '09:15'). Fractional
|
|
69
|
+
* numbers round to the nearest hour — use a string for sub-hour precision.
|
|
68
70
|
* @default 9
|
|
69
71
|
*/
|
|
70
|
-
startTime?: number;
|
|
72
|
+
startTime?: number | string;
|
|
71
73
|
/**
|
|
72
|
-
* End time for business hours
|
|
74
|
+
* End time for business hours: a whole 24-hour number (0-24) or an
|
|
75
|
+
* 'HH:mm' string for sub-hour boundaries (e.g. '17:15'). Fractional
|
|
76
|
+
* numbers round to the nearest hour — use a string for sub-hour precision.
|
|
73
77
|
* @default 17
|
|
74
78
|
*/
|
|
75
|
-
endTime?: number;
|
|
79
|
+
endTime?: number | string;
|
|
76
80
|
}
|
|
77
81
|
/**
|
|
78
82
|
* Resource interface representing a calendar resource (person, room, equipment, etc.)
|
package/dist/plugins/agenda.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as s,K as J}from"../shared/chunk-
|
|
1
|
+
import{I as s,K as J}from"../shared/chunk-6g0xvnsf.js";import{L as $}from"../shared/chunk-7vqv0k0j.js";import{List as w}from"lucide-react";import{createElement as y}from"react";import{useIlamyCalendarContext as d}from"@ilamy/calendar";import*as b from"@radix-ui/react-scroll-area";import{jsx as z,jsxs as S}from"react/jsx-runtime";function V({className:l,children:r,viewPortProps:c,...f}){return S(b.Root,{className:s("relative",l),"data-slot":"scroll-area",...f,children:[z(b.Viewport,{...c,className:s("focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",c?.className),"data-slot":"scroll-area-viewport",children:r}),z(k,{}),z(b.Corner,{})]})}function k({className:l,orientation:r="vertical",...c}){return z(b.ScrollAreaScrollbar,{className:s("flex touch-none p-px transition-colors select-none",r==="vertical"&&"h-full w-2.5 border-l border-l-transparent",r==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",l),"data-slot":"scroll-area-scrollbar",orientation:r,...c,children:z(b.ScrollAreaThumb,{className:"bg-border relative flex-1 rounded-full","data-slot":"scroll-area-thumb"})})}var R={day:(l)=>({start:l.startOf("day"),end:l.endOf("day")}),week:(l,r)=>{let c=(l.day()-r+7)%7,f=l.subtract(c,"day").startOf("day");return{start:f,end:f.add(6,"day").endOf("day")}},month:(l)=>({start:l.startOf("month"),end:l.endOf("month")})},u={day:{amount:1,unit:"day"},week:{amount:1,unit:"week"},month:{amount:1,unit:"month"}},q=(l,r,c=0)=>{if(typeof r==="number")return{start:l.startOf("day"),end:l.add(r-1,"day").endOf("day")};return R[r](l,c)},Y=(l)=>{if(typeof l==="number")return{amount:l,unit:"day"};return u[l]};var I=(l,r,c)=>{if(l.allDay)return l.start.isSameOrBefore(c)&&l.end.isSameOrAfter(r);return l.start.isSameOrAfter(r)&&l.start.isSameOrBefore(c)},E=(l,r)=>{let c=l.allDay?0:1,f=r.allDay?0:1;if(c!==f)return c-f;return l.start.valueOf()-r.start.valueOf()},Z=(l,r)=>{let c=[],f=r.end.startOf("day"),m=r.start.startOf("day");while(m.isSameOrBefore(f)){let i=m.startOf("day"),h=m.endOf("day"),N=l.filter((x)=>I(x,i,h)).sort(E);if(N.length>0)c.push({key:m.format("YYYY-MM-DD"),date:i,events:N});m=m.add(1,"day")}return c};import{useIlamyCalendarContext as g}from"@ilamy/calendar";import{memo as C}from"react";import{jsx as P,jsxs as _,Fragment as j}from"react/jsx-runtime";var D=({rangeStart:l,rangeEnd:r,now:c,axis:f="vertical",render:m,withDot:i=!0})=>{let h=c??$(),N=h.valueOf();if(!(N>=l.valueOf()&&N<r.valueOf()))return null;let x=r.diff(l,"minute"),o=h.diff(l,"minute")/x*100;if(m)return P(j,{children:m({currentTime:h,rangeStart:l,rangeEnd:r,progress:o,axis:f})});if(f==="horizontal")return _("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:`${o}%`},children:[i&&P("div",{className:"size-2 shrink-0 rounded-full bg-red-500"}),P("div",{className:"w-0.5 flex-1 bg-red-500"})]});return _("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:`${o}%`},children:[i&&P("div",{className:"size-2 shrink-0 rounded-full bg-red-500"}),P("div",{className:"h-0.5 flex-1 bg-red-500"})]})},F=C(D);import{jsx as G,jsxs as p}from"react/jsx-runtime";var O=({today:l,dayNumber:r,weekday:c,className:f,"data-testid":m})=>{return p("div",{className:s("flex flex-col items-center",f),"data-testid":m,"data-today":l?"true":void 0,children:[c!=null&&G("div",{className:s("w-full truncate text-center text-xs text-muted-foreground",l&&"text-primary"),children:c}),G("div",{className:s("flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-xs font-medium",l&&"bg-primary text-primary-foreground"),children:r})]})};import{useIlamyCalendarContext as v}from"@ilamy/calendar";import{jsx as H,jsxs as a}from"react/jsx-runtime";var t=(l)=>l==="24-hour"?"HH:mm":"h:mm A",L=({event:l,day:r})=>{let{t:c,timeFormat:f,onEventClick:m}=v(),i=l.start.format(t(f)),h=l.allDay?c("allDay"):i,N=l.start.startOf("day"),x=l.end.startOf("day").diff(N,"day")+1,o=r.startOf("day").diff(N,"day")+1,W=Boolean(l.allDay)&&x>1,A=`(${c("day")} ${o}/${x})`,U=W?A:null;return a("button",{className:"hover:bg-accent flex w-full cursor-pointer items-center gap-2 rounded px-2 py-1 text-left text-sm",onClick:()=>m(l),type:"button",children:[H("span",{className:"text-muted-foreground w-20 shrink-0",children:h}),H("span",{className:s("size-3 shrink-0 rounded-full border",l.backgroundColor||"bg-blue-500",l.color),style:{backgroundColor:l.backgroundColor}}),H("span",{className:"truncate",children:l.title}),U&&H("span",{className:"text-muted-foreground shrink-0 text-xs",children:U})]})};import{jsx as Q,jsxs as M}from"react/jsx-runtime";var B=({group:l})=>{let{view:r,renderCurrentTimeIndicator:c}=g(),f=l.date.isSame($(),"day"),m;if(c)m=(i)=>c({...i,view:r});return M("div",{className:"flex gap-4 border-b px-2 py-3","data-testid":J("agenda-day",l.key),children:[Q("div",{className:"text-muted-foreground flex w-16 shrink-0 flex-col items-center text-center",children:Q(O,{className:"flex-col-reverse",dayNumber:l.date.format("D"),today:f,weekday:l.date.format("ddd")})}),M("div",{className:"relative flex flex-1 flex-col gap-1",children:[f&&Q(F,{rangeEnd:l.date.endOf("day"),rangeStart:l.date.startOf("day"),render:m}),l.events.map((i)=>Q(L,{day:l.date,event:i},J(l.key,i.id)))]})]})};import{jsx as X}from"react/jsx-runtime";var T=({window:l})=>{let{currentDate:r,getEventsForDateRange:c,t:f,firstDayOfWeek:m}=d(),i=q(r,l,m),h=c(i.start,i.end),N=Z(h,i);if(N.length===0)return X("div",{className:"text-muted-foreground flex h-full items-center justify-center p-4 text-sm","data-testid":"agenda-empty",children:f("agendaNoEvents")});return X(V,{className:"h-full","data-testid":"agenda-view",children:X("div",{className:"flex flex-col",children:N.map((x)=>X(B,{group:x},x.key))})})};var K=({window:l="month"}={})=>({name:"agenda",label:"agenda",icon:w,navigationStep:Y(l),range:(r,c)=>q(r,l,c.firstDayOfWeek),supportsResources:!1,component:()=>y(T,{window:l})});var n=(l={})=>({name:"agenda",views:[K(l)]});export{K as createAgendaView,n as agendaPlugin};
|
|
@@ -64,15 +64,19 @@ interface BusinessHours {
|
|
|
64
64
|
*/
|
|
65
65
|
daysOfWeek?: WeekDays[];
|
|
66
66
|
/**
|
|
67
|
-
* Start time for business hours
|
|
67
|
+
* Start time for business hours: a whole 24-hour number (0-24) or an
|
|
68
|
+
* 'HH:mm' string for sub-hour boundaries (e.g. '09:15'). Fractional
|
|
69
|
+
* numbers round to the nearest hour — use a string for sub-hour precision.
|
|
68
70
|
* @default 9
|
|
69
71
|
*/
|
|
70
|
-
startTime?: number;
|
|
72
|
+
startTime?: number | string;
|
|
71
73
|
/**
|
|
72
|
-
* End time for business hours
|
|
74
|
+
* End time for business hours: a whole 24-hour number (0-24) or an
|
|
75
|
+
* 'HH:mm' string for sub-hour boundaries (e.g. '17:15'). Fractional
|
|
76
|
+
* numbers round to the nearest hour — use a string for sub-hour precision.
|
|
73
77
|
* @default 17
|
|
74
78
|
*/
|
|
75
|
-
endTime?: number;
|
|
79
|
+
endTime?: number | string;
|
|
76
80
|
}
|
|
77
81
|
/**
|
|
78
82
|
* Resource interface representing a calendar resource (person, room, equipment, etc.)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{L as E}from"../shared/chunk-
|
|
1
|
+
import{L as E}from"../shared/chunk-7vqv0k0j.js";import{useIlamyCalendarContext as s}from"@ilamy/calendar";import{useRef as o,useState as r}from"react";import{createPortal as t}from"react-dom";import{useEffect as c,useRef as C}from"react";var P=(J,q)=>{let Q=Math.min(J.top,q.top),H=Math.min(J.left,q.left),B=Math.max(J.left+J.width,q.left+q.width),V=Math.max(J.top+J.height,q.top+q.height);return{top:Q,left:H,width:B-H,height:V-Q}},y=(J,q)=>{let Q=Math.max(J.top,q.top),H=Math.max(J.left,q.left),B=Math.min(J.left+J.width,q.left+q.width),V=Math.min(J.top+J.height,q.top+q.height),I=B-H,Y=V-Q;if(I<=0||Y<=0)return null;return{top:Q,left:H,width:I,height:Y}},b=(J,q,Q)=>{let H=0,B=0;if(J.clientY<q.top+Q.edge)B=-Q.speed;else if(J.clientY>q.top+q.height-Q.edge)B=Q.speed;if(J.clientX<q.left+Q.edge)H=-Q.speed;else if(J.clientX>q.left+q.width-Q.edge)H=Q.speed;let V=Q.axis??"both";return{x:V==="y"?0:H,y:V==="x"?0:B}};var S=new Set(["auto","scroll","overlay"]),d=(J)=>{let q=getComputedStyle(J),Q=S.has(q.overflowY)&&J.scrollHeight>J.clientHeight,H=S.has(q.overflowX)&&J.scrollWidth>J.clientWidth;return Q||H},f=(J)=>{let q=J instanceof HTMLElement?J:null;while(q){if(d(q))return q;q=q.parentElement}return null};var F=(J,q,Q=2)=>Math.hypot(J,q)>=Q,R=(J,q)=>{let Q=J.allDay===q.allDay,H=J.resourceId===q.resourceId;return Q&&H},h=(J,q)=>{let Q=J.start.isAfter(q.start),H=Q?q:J,B=Q?J:q;return{start:H.start,end:B.end,allDay:H.allDay,resourceId:H.resourceId}};var i=400,a=10,n=40,l=5;function m(J){let q=C(J);q.current=J;let Q=C(null);c(()=>{let H=()=>{document.body.style.setProperty("user-select","none"),document.body.style.setProperty("-webkit-user-select","none")},B=()=>{document.body.style.removeProperty("user-select"),document.body.style.removeProperty("-webkit-user-select")},V=null,I=()=>{if(V!==null)clearTimeout(V),V=null},Y=null,G=null,X=null,j=()=>{if(X!==null)cancelAnimationFrame(X),X=null},A=()=>{X=null;let $=Q.current;if(!$?.active)return;if(!Y||!G)return;let K=b(G,Y.getBoundingClientRect(),{edge:n,speed:l,axis:q.current.scrollAxis});if(K.x===0&&K.y===0)return;Y.scrollBy({left:K.x,top:K.y,behavior:"instant"}),q.current.onMove(G,$.payload),X=requestAnimationFrame(A)},O=()=>{if(X===null)X=requestAnimationFrame(A)},D=($)=>{if(Q.current?.active)$.preventDefault()},W=($)=>{$.stopImmediatePropagation(),$.preventDefault(),window.removeEventListener("click",W,{capture:!0})},N=()=>{I(),j(),window.removeEventListener("touchmove",D),B(),Y=null,G=null,Q.current=null},Z=()=>{let $=Q.current!==null;if(N(),$)q.current.onCancel?.()},k=($)=>{if($.active=!0,I(),H(),window.getSelection()?.removeAllRanges(),$.pointerType==="touch")window.addEventListener("touchmove",D,{passive:!1});q.current.onStart?.($.payload)},M=($)=>{if($.button!==0||!$.isPrimary)return;let K=q.current.resolvePress($);if(K===null)return;I();let U={pointerId:$.pointerId,pointerType:$.pointerType,originX:$.clientX,originY:$.clientY,payload:K,active:!1};if(Q.current=U,Y=f($.target),$.pointerType==="touch"){let _=q.current.longPressMs??i;V=setTimeout(()=>{if(Q.current===U)k(U)},_)}},z=($,K)=>{let U=K.clientX-$.originX,_=K.clientY-$.originY;if($.pointerType==="touch"){let u=q.current.touchCancelSlopPx??a;if(F(U,_,u))Z();return!1}if(!F(U,_,q.current.thresholdPx))return!1;return k($),!0},T=($)=>{let K=Q.current;if(!K||$.pointerId!==K.pointerId)return;if(!K.active&&!z(K,$))return;G={clientX:$.clientX,clientY:$.clientY},q.current.onMove(G,K.payload),O()},x=($)=>{let K=Q.current;if(!K||$.pointerId!==K.pointerId)return;if(!K.active){N();return}window.addEventListener("click",W,{capture:!0});let{payload:U}=K;N(),q.current.onEnd(U)},w=($)=>{if($.key==="Escape")Z()};return document.addEventListener("pointerdown",M),window.addEventListener("pointermove",T),window.addEventListener("pointerup",x),window.addEventListener("pointercancel",Z),window.addEventListener("blur",Z),window.addEventListener("keydown",w),()=>{document.removeEventListener("pointerdown",M),window.removeEventListener("pointermove",T),window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",Z),window.removeEventListener("blur",Z),window.removeEventListener("keydown",w),window.removeEventListener("click",W,{capture:!0}),window.removeEventListener("touchmove",D),I(),j(),B()}},[])}var L=(J,q)=>{let Q=J?.closest("[data-start]");if(!Q)return null;if(Q.dataset.disabled==="true")return null;let H=Q.dataset.start,B=Q.dataset.end;if(!H||!B)return null;let V=(I)=>q?E.utc(I).tz(q):E.utc(I).local();return{start:V(H),end:V(B),resourceId:Q.dataset.resourceId,allDay:Q.dataset.allDay==="true",element:Q}};import{jsx as p,jsxs as Jq,Fragment as qq}from"react/jsx-runtime";var v=(J,q)=>{let Q=P(J.element.getBoundingClientRect(),q.element.getBoundingClientRect()),H=J.element.closest("[data-calendar-scroll-content]");if(H instanceof HTMLElement){let I=H.getBoundingClientRect();return{rect:{top:Q.top-I.top,left:Q.left-I.left,width:Q.width,height:Q.height},content:H}}let B=J.element.closest("[data-calendar-viewport]");if(!B)return{rect:Q,content:null};let V=y(Q,B.getBoundingClientRect());if(!V)return null;return{rect:V,content:null}};function e({rect:J,content:q}){return t(p("div",{"aria-hidden":"true",className:`pointer-events-none ${q?"absolute z-15":"fixed z-50"} rounded-sm border border-primary bg-primary/20`,style:{top:J.top,left:J.left,width:J.width,height:J.height}}),q??document.body)}function g({children:J,options:q}){let{openEventForm:Q,resources:H,timezone:B,orientation:V}=s(),[I,Y]=r(null),G=o(null),A=H.length>0?V==="vertical"?"y":"x":"both",O=()=>{G.current=null,Y(null)},D=(W,N)=>{let Z=h(W,N),k=H.find((z)=>String(z.id)===Z.resourceId),M={start:Z.start,end:Z.end,resource:k,allDay:Z.allDay};if(q.onSelect)q.onSelect(M,Q);else Q({start:Z.start,end:Z.end,allDay:Z.allDay,resourceId:Z.resourceId})};return m({scrollAxis:A,resolvePress:(W)=>L(W.target,B),onStart:(W)=>{G.current=W,Y(v(W,W))},onMove:({clientX:W,clientY:N},Z)=>{let k=L(document.elementFromPoint(W,N),B);if(k&&R(Z,k))G.current=k;let M=G.current??Z;Y(v(Z,M))},onEnd:(W)=>{let N=G.current??W;D(W,N),O()},onCancel:O}),Jq(qq,{children:[J,I&&p(e,{...I})]})}import{jsx as $q}from"react/jsx-runtime";var Qq=(J={})=>({name:"drag-to-create",provider:({children:q})=>$q(g,{options:J,children:q})});export{Qq as dragToCreatePlugin};
|
|
@@ -64,15 +64,19 @@ interface BusinessHours {
|
|
|
64
64
|
*/
|
|
65
65
|
daysOfWeek?: WeekDays[];
|
|
66
66
|
/**
|
|
67
|
-
* Start time for business hours
|
|
67
|
+
* Start time for business hours: a whole 24-hour number (0-24) or an
|
|
68
|
+
* 'HH:mm' string for sub-hour boundaries (e.g. '09:15'). Fractional
|
|
69
|
+
* numbers round to the nearest hour — use a string for sub-hour precision.
|
|
68
70
|
* @default 9
|
|
69
71
|
*/
|
|
70
|
-
startTime?: number;
|
|
72
|
+
startTime?: number | string;
|
|
71
73
|
/**
|
|
72
|
-
* End time for business hours
|
|
74
|
+
* End time for business hours: a whole 24-hour number (0-24) or an
|
|
75
|
+
* 'HH:mm' string for sub-hour boundaries (e.g. '17:15'). Fractional
|
|
76
|
+
* numbers round to the nearest hour — use a string for sub-hour precision.
|
|
73
77
|
* @default 17
|
|
74
78
|
*/
|
|
75
|
-
endTime?: number;
|
|
79
|
+
endTime?: number | string;
|
|
76
80
|
}
|
|
77
81
|
/**
|
|
78
82
|
* Resource interface representing a calendar resource (person, room, equipment, etc.)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{I as
|
|
2
|
-
`).find((l)=>l.startsWith("RRULE:"))||""}catch{return""}},ko=(o)=>{let i=[],l=o.rrule?_i(o.rrule):"";if(l)i.push(l);if(o.exdates?.length){let m=o.exdates.map((f)=>Yo(J(f),o.allDay)).join(",");i.push(`EXDATE:${m}`)}if(o.recurrenceId){let m=Yo(J(o.recurrenceId),o.allDay);i.push(`RECURRENCE-ID:${m}`)}return i};import"@ilamy/calendar";import{SLOT_EVENT_FORM as Jl,SLOT_EVENT_MUTATION_SCOPE as Zl}from"@ilamy/calendar";import{useIlamyCalendarContext as Xi}from"@ilamy/calendar";import{Slot as Gi}from"@radix-ui/react-slot";import{cva as Hi}from"class-variance-authority";import{jsx as wi}from"react/jsx-runtime";var Ji=Hi("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 _o({className:o,variant:i,size:l,asChild:m=!1,...f}){return wi(m?Gi:"button",{className:G(Ji({variant:i,size:l,className:o})),"data-slot":"button",...f})}import*as q from"@radix-ui/react-dialog";import{XIcon as Zi}from"lucide-react";import{jsx as b,jsxs as Go}from"react/jsx-runtime";function qo({...o}){return b(q.Root,{"data-slot":"dialog",...o})}function $i({...o}){return b(q.Portal,{"data-slot":"dialog-portal",...o})}function Vi({className:o,...i}){return b(q.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",o),"data-slot":"dialog-overlay",...i})}function ao({className:o,children:i,...l}){return Go($i,{"data-slot":"dialog-portal",children:[b(Vi,{}),Go(q.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%]",o),"data-slot":"dialog-content",...l,children:[i,Go(q.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:[b(Zi,{}),b("span",{className:"sr-only",children:"Close"})]})]})]})}function bo({className:o,...i}){return b("div",{className:G("flex flex-col gap-2 text-center sm:text-left",o),"data-slot":"dialog-header",...i})}function Ko({className:o,...i}){return b("div",{className:G("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",o),"data-slot":"dialog-footer",...i})}function Bo({className:o,...i}){return b(q.Title,{className:G("text-lg leading-none font-semibold",o),"data-slot":"dialog-title",...i})}function Wo({className:o,...i}){return b(q.Description,{className:G("text-muted-foreground text-sm",o),"data-slot":"dialog-description",...i})}import{jsx as M,jsxs as v}from"react/jsx-runtime";var hi=[{scope:"this",title:"thisEvent",editKey:"onlyChangeThis",deleteKey:"onlyDeleteThis"},{scope:"following",title:"thisAndFollowingEvents",editKey:"changeThisAndFuture",deleteKey:"deleteThisAndFuture"},{scope:"all",title:"allEvents",editKey:"changeEntireSeries",deleteKey:"deleteEntireSeries"}];function Mo({isOpen:o,onClose:i,onConfirm:l,operationType:m,eventTitle:f}){let{t:N}=Xi(),c=(k)=>{l(k),i()},z=m==="edit",g=N("deleteRecurringEvent"),_=N("deleteRecurringEventQuestion");if(z)g=N("editRecurringEvent"),_=N("editRecurringEventQuestion");return M(qo,{onOpenChange:(k)=>{if(!k)i()},open:o,children:v(ao,{className:"max-w-md",children:[v(bo,{children:[M(Bo,{children:g}),v(Wo,{children:['"',f,'" ',_]})]}),M("div",{className:"space-y-3",children:hi.map(({scope:k,title:$,editKey:V,deleteKey:Y})=>M(_o,{className:"w-full justify-start h-auto p-4",onClick:()=>c(k),variant:"outline",children:v("div",{className:"text-left",children:[M("div",{className:"font-medium",children:N($)}),M("div",{className:"text-sm text-muted-foreground",children:N(z?V:Y)})]})},k))}),M(Ko,{children:M(_o,{onClick:i,variant:"outline",children:N("cancel")})})]})})}import{useIlamyCalendarContext as vi}from"@ilamy/calendar";import{useState as ti}from"react";import{useIlamyCalendarContext as di}from"@ilamy/calendar";import{jsx as t}from"react/jsx-runtime";function Fo({className:o,...i}){return t("div",{className:G("text-card-foreground flex flex-col gap-1 rounded-xl border shadow-sm",o),"data-slot":"card",...i})}function Lo({className:o,...i}){return t("div",{className:G("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 p-4 pb-0 has-data-[slot=card-action]:grid-cols-[1fr_auto]",o),"data-slot":"card-header",...i})}function Ao({className:o,...i}){return t("div",{className:G("leading-none font-semibold",o),"data-slot":"card-title",...i})}function Co({className:o,...i}){return t("div",{className:G("p-4 pt-0",o),"data-slot":"card-content",...i})}import*as e from"@radix-ui/react-checkbox";import{CheckIcon as Qi}from"lucide-react";import{jsx as Ho}from"react/jsx-runtime";function p({className:o,...i}){return Ho(e.Root,{className:G("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",o),"data-slot":"checkbox",...i,children:Ho(e.Indicator,{className:"flex items-center justify-center text-current transition-none","data-slot":"checkbox-indicator",children:Ho(Qi,{className:"size-3.5"})})})}import{useEffect as ni,useState as Vo}from"react";import{RRule as vo}from"rrule";import{createContext as Yi,useContext as qi}from"react";var Po=Yi(null),To=Po.Provider,K=()=>{let o=qi(Po);if(!o)throw Error("useRecurrenceEditor must be used within a RecurrenceEditor");return o};import{RRule as X}from"rrule";var ai=[X.SU,X.MO,X.TU,X.WE,X.TH,X.FR,X.SA],bi=[X.MO,X.TU,X.WE,X.TH,X.FR],Ki=["first","second","third","fourth"],Uo=(o)=>ai.at(J(o).day())??X.SU,Do=(o)=>{let i=J(o);return i.add(7,"day").month()!==i.month()?-1:Math.ceil(i.date()/7)},Bi={daily:()=>({freq:X.DAILY}),weekdays:()=>({freq:X.WEEKLY,byweekday:bi}),weeklyOnDay:(o)=>({freq:X.WEEKLY,byweekday:[Uo(o)]}),monthlyOnDay:(o)=>({freq:X.MONTHLY,bymonthday:J(o).date()}),monthlyOnWeekday:(o)=>({freq:X.MONTHLY,byweekday:[Uo(o).nth(Do(o))]})},S=(o,i)=>{let l=Bi[o];if(!l)return null;return{interval:1,dtstart:i,...l(i)}},po=(o)=>{if(o==null)return"";return(Array.isArray(o)?o:[o]).map((l)=>typeof l==="object"?`${l.weekday}:${l.n??""}`:`${l}:`).sort().join(",")},Wi=(o,i)=>{if(!i)return!1;let l=o.freq===i.freq,m=po(o.byweekday)===po(i.byweekday),f=(o.bymonthday??null)===(i.bymonthday??null);return l&&m&&f},Mi=["daily","weekdays","weeklyOnDay","monthlyOnDay","monthlyOnWeekday"],s=(o,i)=>{if(!o)return"once";if(Boolean(o.interval)&&o.interval!==1)return"customize";return Mi.find((f)=>Wi(o,S(f,i)))??"customize"},j=(o,i,l)=>{let m=J(i).format("dddd"),f=Do(i),N=f===-1?"last":Ki.at(f-1)??"last",c=l(N);return{daily:l("daily"),weekdays:l("everyWeekday"),weeklyOnDay:`${l("weeklyOn")} ${m}`,monthlyOnDay:`${l("monthlyOnDay")} ${J(i).date()}`,monthlyOnWeekday:`${l("monthlyOnThe")} ${c} ${m}`}[o]??l("customRecurrence")},D=(o)=>{if(Array.isArray(o))return o;return o?[o]:[]};import{useIlamyCalendarContext as Ci}from"@ilamy/calendar";import{jsx as Fi}from"react/jsx-runtime";function oo({className:o,type:i,...l}){return Fi("input",{className:G("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",o),"data-slot":"input",type:i,...l})}import*as yo from"@radix-ui/react-label";import{jsx as Li}from"react/jsx-runtime";function a({className:o,...i}){return Li(yo.Root,{className:G("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",o),"data-slot":"label",...i})}import{jsx as Ai}from"react/jsx-runtime";var Io="YYYY-MM-DD",xo=({date:o,onChange:i,className:l})=>{let m=o?J(o).format(Io):"",f=(N)=>{let c=N.target.value;if(!c){i?.(void 0);return}let z=J(c,Io);i?.(z.isValid()?z.toDate():void 0)};return Ai("input",{className:G("flex h-9 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none transition-shadow focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50",l),onChange:f,type:"date",value:m})};import{jsx as A,jsxs as wo,Fragment as Ui}from"react/jsx-runtime";var Pi=[{type:"never",id:"never",labelKey:"never"},{type:"count",id:"after",labelKey:"after"},{type:"until",id:"on",labelKey:"on"}],Ti=(o)=>Math.max(1,Number.parseInt(o,10)||1),Oo=()=>{let{t:o}=Ci(),{opts:i,update:l,setEndType:m,setUntil:f}=K(),N="never";if(i?.until)N="until";else if(i?.count)N="count";let c=i?.count||1,z=i?.until??void 0;return wo("div",{children:[A(a,{className:"text-xs",children:o("ends")}),A("div",{className:"space-y-2 mt-1",children:Pi.map(({type:g,id:_,labelKey:k})=>{let $=g==="count"&&N==="count",V=g==="until"&&N==="until";return wo("div",{className:"flex items-center space-x-2",children:[A(p,{checked:N===g,id:_,onCheckedChange:()=>m(g)}),A(a,{className:"text-xs",htmlFor:_,children:o(k)}),$&&wo(Ui,{children:[A(oo,{className:"h-6 w-16 text-xs","data-testid":"count-input",min:"1",onChange:(Y)=>l({count:Ti(Y.target.value)}),type:"number",value:c}),A("span",{className:"text-xs",children:o("occurrences")})]}),V&&A(xo,{className:"h-6",date:z,onChange:f})]},g)})})]})};import{useIlamyCalendarContext as xi}from"@ilamy/calendar";import*as H from"@radix-ui/react-select";import{CheckIcon as pi,ChevronDownIcon as So,ChevronUpIcon as Di}from"lucide-react";import{jsx as Q,jsxs as Jo}from"react/jsx-runtime";function y({...o}){return Q(H.Root,{"data-slot":"select",...o})}function I({...o}){return Q(H.Value,{"data-slot":"select-value",...o})}function x({className:o,size:i="default",children:l,...m}){return Jo(H.Trigger,{className:G("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",o),"data-size":i,"data-slot":"select-trigger",...m,children:[l,Q(H.Icon,{asChild:!0,children:Q(So,{className:"size-4 opacity-50"})})]})}function O({className:o,children:i,position:l="popper",align:m="center",...f}){return Q(H.Portal,{children:Jo(H.Content,{align:m,className:G("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",l==="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",o),"data-slot":"select-content",position:l,...f,children:[Q(yi,{}),Q(H.Viewport,{className:G("p-1",l==="popper"&&"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width) scroll-my-1"),children:i}),Q(Ii,{})]})})}function C({className:o,children:i,...l}){return Jo(H.Item,{className:G("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",o),"data-slot":"select-item",...l,children:[Q("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:Q(H.ItemIndicator,{children:Q(pi,{className:"size-4"})})}),Q(H.ItemText,{children:i})]})}function yi({className:o,...i}){return Q(H.ScrollUpButton,{className:G("flex cursor-default items-center justify-center py-1",o),"data-slot":"select-scroll-up-button",...i,children:Q(Di,{className:"size-4"})})}function Ii({className:o,...i}){return Q(H.ScrollDownButton,{className:G("flex cursor-default items-center justify-center py-1",o),"data-slot":"select-scroll-down-button",...i,children:Q(So,{className:"size-4"})})}import{RRule as r}from"rrule";import{jsx as P,jsxs as io}from"react/jsx-runtime";var Zo={DAILY:r.DAILY,WEEKLY:r.WEEKLY,MONTHLY:r.MONTHLY,YEARLY:r.YEARLY},Oi=Object.fromEntries(Object.entries(Zo).map(([o,i])=>[i,o])),Si=(o)=>Math.max(1,Number.parseInt(o,10)||1),so=()=>{let{t:o}=xi(),{opts:i,custom:l,update:m}=K();if(!l)return null;let f=Oi[i?.freq??r.DAILY]||"DAILY",N=i?.interval||1;return io("div",{className:"grid grid-cols-2 gap-4",children:[io("div",{children:[P(a,{className:"text-xs",htmlFor:"frequency",children:o("frequency")}),io(y,{onValueChange:(c)=>m({freq:Zo[c]}),value:f,children:[P(x,{className:"h-8 w-full","data-testid":"frequency-select",id:"frequency",children:P(I,{})}),P(O,{children:Object.keys(Zo).map((c)=>P(C,{value:c,children:o(c.toLowerCase())},c))})]})]}),io("div",{children:[P(a,{className:"text-xs",htmlFor:"interval",children:o("every")}),P(oo,{className:"h-8",id:"interval",min:"1",onChange:(c)=>m({interval:Si(c.target.value)}),type:"number",value:N})]})]})};import{useIlamyCalendarContext as si}from"@ilamy/calendar";import{RRule as ji}from"rrule";import{jsx as u,jsxs as $o}from"react/jsx-runtime";var jo=()=>{let{t:o}=si(),{opts:i,custom:l,reference:m,setMonthlyMode:f}=K();if(!l||i?.freq!==ji.MONTHLY)return null;let c=D(i?.byweekday).some((z)=>typeof z==="object"&&z.n!=null)?"weekday":"day";return $o("div",{children:[u(a,{className:"text-xs",htmlFor:"monthly-mode",children:o("repeatOn")}),$o(y,{onValueChange:(z)=>f(z),value:c,children:[u(x,{className:"h-8 w-full","data-testid":"monthly-mode-select",id:"monthly-mode",children:u(I,{})}),$o(O,{children:[u(C,{value:"day",children:j("monthlyOnDay",m,o)}),u(C,{value:"weekday",children:j("monthlyOnWeekday",m,o)})]})]})]})};import{useIlamyCalendarContext as ri}from"@ilamy/calendar";import{jsx as R,jsxs as ro}from"react/jsx-runtime";var ui=["daily","weekdays","weeklyOnDay","monthlyOnDay","monthlyOnWeekday","customize"],uo=()=>{let{t:o}=ri(),{opts:i,custom:l,reference:m,selectPreset:f}=K(),N=l?"customize":s(i,m);return ro("div",{children:[R(a,{className:"text-xs",htmlFor:"recurrence-preset",children:o("repeats")}),ro(y,{onValueChange:(c)=>f(c),value:N,children:[R(x,{className:"h-8 w-full","data-testid":"preset-select",id:"recurrence-preset",children:R(I,{})}),R(O,{children:ui.map((c)=>R(C,{value:c,children:j(c,m,o)},c))})]})]})};import{useIlamyCalendarContext as Ri}from"@ilamy/calendar";import{RRule as F}from"rrule";import{jsx as lo,jsxs as no}from"react/jsx-runtime";var Ro=[F.SU,F.MO,F.TU,F.WE,F.TH,F.FR,F.SA],Eo=()=>{let{t:o,firstDayOfWeek:i}=Ri(),{opts:l,custom:m,toggleDay:f}=K();if(!m||l?.freq!==F.WEEKLY)return null;let N=D(l?.byweekday),c=Ro.map((g,_)=>({value:g,label:J().day(_).format("ddd")})),z=Ro.map((g,_)=>c[(_+i)%7]);return no("div",{children:[lo(a,{className:"text-xs",children:o("repeatOn")}),lo("div",{className:"flex flex-wrap gap-1 mt-1",children:z.map((g,_)=>no("div",{className:"flex items-center space-x-1",children:[lo(p,{checked:N.includes(g.value),id:mo("day",_),onCheckedChange:()=>f(g.value)}),lo(a,{className:"text-xs cursor-pointer",htmlFor:mo("day",_),children:g.label})]},mo("weekday",_)))})]})};import{jsx as B,jsxs as fo}from"react/jsx-runtime";var Ei=(o,i)=>{if(!o)return i("customRecurrence");try{let l=new vo(o).toText();if(!(Boolean(l)&&!l.toLowerCase().includes("error")))return i("customRecurrence");return l.charAt(0).toUpperCase()+l.slice(1)}catch{return i("customRecurrence")}},to=({value:o,onChange:i,referenceDate:l})=>{let{t:m}=di(),f=(w)=>w?.dtstart??l??J().toDate(),[N,c]=Vo(Boolean(o)),[z,g]=Vo(()=>o||null),[_,k]=Vo(()=>s(o??null,f(o??null))==="customize");ni(()=>{if(c(Boolean(o)),o){g(o);let w=o.dtstart??l??J().toDate();k(s(o,w)==="customize")}},[o,l]);let $=f(z),V=(w)=>{if(!z)return;let Z={...z,...w};g(Z),i(N?Z:null)},Y=(w)=>{if(c(w),!w){i(null);return}if(z){i(z);return}let Z={freq:vo.DAILY,interval:1};g(Z),k(!1),i(Z)},zo={opts:z,custom:_,reference:$,update:V,selectPreset:(w)=>{if(w==="customize"){k(!0);return}k(!1);let Z=S(w,$);if(!Z)return;let U={...Z,count:z?.count,until:z?.until};g(U),i(U)},toggleDay:(w)=>{let Z=D(z?.byweekday),E=Z.includes(w)?Z.filter((gi)=>gi!==w):[...Z,w];V({byweekday:E.length?E:void 0})},setMonthlyMode:(w)=>{if(w==="weekday"){let U=S("monthlyOnWeekday",$);V({byweekday:U?.byweekday,bymonthday:void 0});return}let Z=S("monthlyOnDay",$);V({bymonthday:Z?.bymonthday,byweekday:void 0})},setEndType:(w)=>{let Z={count:void 0,until:void 0};if(w==="count")Z.count=z?.count||1;if(w==="until")Z.until=z?.until||J().add(1,"month").endOf("day").toDate();V(Z)},setUntil:(w)=>{let Z=w?J(w).endOf("day").toDate():void 0;V({until:Z})}},go=Boolean(N&&o);return B(To,{value:zo,children:fo(Fo,{"data-testid":"recurrence-editor",children:[fo(Lo,{className:"pb-3",children:[fo("div",{className:"flex items-center space-x-2",children:[B(p,{checked:N,"data-testid":"toggle-recurrence",id:"recurring",onCheckedChange:Y}),B(Ao,{className:"text-sm",children:m("repeat")})]}),go&&B("p",{className:"text-xs text-muted-foreground",children:Ei(o??null,m)})]}),N&&B(Co,{className:"pt-0",children:fo("div",{className:"space-y-4",children:[B(uo,{}),B(so,{}),B(Eo,{}),B(jo,{}),B(Oo,{})]})})]})})};import{jsx as ei}from"react/jsx-runtime";var eo=({event:o,onChange:i})=>{let{rawEvents:l}=vi(),m=o.uid,f;if(m)f=l.find((g)=>{return(g.uid||`${g.id}@ilamy.calendar`)===m&&Boolean(g.rrule)});let[N,c]=ti(o.rrule??f?.rrule??null);return ei(to,{onChange:(g)=>{if(!g){c(null),i({rrule:void 0});return}let _=g.dtstart??o.start?.toDate(),k=_?{...g,dtstart:_}:g;c(k),i({rrule:k})},referenceDate:o.start?.toDate(),value:N})};var Xo=(o)=>{return Boolean(o.rrule||o.recurrenceId||o.uid)},h=(o)=>{return o.uid||`${o.id}@ilamy.calendar`},No=(o,i)=>{let l=h(i),m=o.findIndex((f)=>{let N=h(f)===l,c=Boolean(f.rrule)&&!f.recurrenceId;return N&&c});if(m===-1)throw Error("Base recurring event not found");return m},co=(o)=>o.start.subtract(1,"day").endOf("day").toDate(),ho=(o)=>o.recurrenceId??o.start.toISOString(),oi=(o,i)=>{let l=ho(i),m=o.exdates||[],f=m.includes(l)?m:[...m,l];return{baseEvent:{...o,exdates:f},targetEventStartISO:l}};var ol=({targetEvent:o,updatedEvents:i,baseEventIndex:l,baseEvent:m})=>{let f=ho(o),N=h(m),{baseEvent:c}=oi(m,o);i[l]=c;let z=(k)=>{let $=Boolean(k.recurrenceId),V=h(k)===N,Y=k.recurrenceId===f;return $&&V&&Y},g=i.find(z);return{events:i.filter((k)=>!z(k)),updated:g?[]:[c],added:[],deleted:g?[g]:[]}},il=({targetEvent:o,updatedEvents:i,baseEventIndex:l,baseEvent:m})=>{let f={...m,rrule:{...m.rrule,until:co(o)}};return i[l]=f,{events:i,updated:[f],added:[],deleted:[]}},ll=({targetEvent:o,updatedEvents:i})=>{let l=h(o),m=i.filter((N)=>h(N)===l);return{events:i.filter((N)=>h(N)!==l),updated:[],added:[],deleted:m}},ml={this:ol,following:il,all:ll},ii=({targetEvent:o,currentEvents:i,scope:l})=>{let m=[...i],f=No(m,o),N=m[f],c=ml[l];if(!c)throw Error(`Invalid scope: ${l}. Must be 'this', 'following', or 'all'`);return c({targetEvent:o,updatedEvents:m,baseEventIndex:f,baseEvent:N})};import{RRule as fl}from"rrule";var d=(o)=>{return new Date(Date.UTC(o.year(),o.month(),o.date(),o.hour(),o.minute(),o.second(),o.millisecond()))},li=(o,i)=>{return i.year(o.getUTCFullYear()).month(o.getUTCMonth()).date(o.getUTCDate()).hour(o.getUTCHours()).minute(o.getUTCMinutes()).second(o.getUTCSeconds()).millisecond(o.getUTCMilliseconds())};var Qo=({event:o,currentEvents:i,startDate:l,endDate:m})=>{if(!o.rrule)return[];try{let f=d(o.start),N;if(o.rrule.until)N=d(J(o.rrule.until));let c={...o.rrule,dtstart:f,until:N},z=new fl(c),g=h(o),_=i.filter((W)=>{let T=Boolean(W.recurrenceId),L=h(W)===g;return T&&L}),k=o.end.diff(o.start),$=d(l.subtract(k,"millisecond")),V=d(m);return z.between($,V,!0).map((W,T)=>{let L=li(W,o.start),n=_.find((E)=>mi(E.recurrenceId)?.isSame(L));if(n)return{...o,...n};let zo=o.end.diff(o.start),go=L.add(zo,"millisecond"),w=`${o.id}_${T}`,Z=h(o);return{...o,id:w,start:L,end:go,uid:Z,rrule:void 0}}).filter((W)=>{let T=W.start.toISOString();if(o.exdates?.includes(T)??!1)return!1;return W.start.isSameOrBefore(m)&&W.end.isSameOrAfter(l)})}catch(f){throw Error(`Invalid RRULE options: ${JSON.stringify(o.rrule)}. Error: ${f instanceof Error?f.message:"Unknown error"}`)}};var fi=(o,i)=>{let l=i.diff(i.startOf("day"),"millisecond");return o.startOf("day").add(l,"millisecond")},Nl=(o,i,l)=>{let m=o.end.diff(o.start),f=l.start||i.start,N=l.end||f.add(m),c=`${o.id}_following`,z=`${c}@ilamy.calendar`;return{...o,...l,rrule:{...o.rrule,...l.rrule,dtstart:f.toDate()},id:c,uid:z,start:f,end:N,recurrenceId:void 0}},cl=(o,i)=>{return(l)=>{let m=Boolean(l.recurrenceId)&&!l.rrule,f=h(l)===o,N=Boolean(l.recurrenceId)&&J(l.recurrenceId).isAfter(i);return m&&f&&N}},zl=(o,i)=>{let l=o.start;if(i.start)l=fi(o.start,i.start);let m=o.end;if(i.start&&i.end)m=l.add(i.end.diff(i.start),"millisecond");else if(i.start)m=l.add(o.end.diff(o.start),"millisecond");else if(i.end)m=fi(o.end,i.end);let f=i.rrule??o.rrule,N;if(f)N={...f,dtstart:l.toDate()};return{start:l,end:m,rrule:N}},gl=(o,i)=>{if(i&&o.recurrenceId)return o.recurrenceId;return o.start.toISOString()},kl=({updatedEvents:o,targetEvent:i,detachedOverride:l,updatedBaseEvent:m,baseChanged:f})=>{let N=o.findIndex((c)=>c.id===i.id);if(N===-1)throw Error("Detached override not found");return o[N]=l,{events:o,updated:f?[m,l]:[l],added:[],deleted:[]}},_l=({targetEvent:o,updates:i,updatedEvents:l,baseEventIndex:m,baseEvent:f})=>{let N=h(f),c=Boolean(o.recurrenceId&&!o.rrule),z=gl(o,c),g=f.exdates||[],_=g.includes(z)?g:[...g,z],k=_!==g||f.uid!==N,$={...f,exdates:_,uid:N};l[m]=$;let V={...o,...i,recurrenceId:z,rrule:void 0,uid:N};if(c)return kl({updatedEvents:l,targetEvent:o,detachedOverride:V,updatedBaseEvent:$,baseChanged:k});let Y={...V,id:`${f.id}_modified_${Date.now()}`};return l.push(Y),{events:l,updated:[$],added:[Y],deleted:[]}},Gl=({targetEvent:o,updates:i,updatedEvents:l,baseEventIndex:m,baseEvent:f})=>{let N=co(o),c=h(f),z=cl(c,N),g=(f.exdates??[]).filter((Y)=>!J(Y).isAfter(N)),_={...f,exdates:g,rrule:{...f.rrule,until:N}};l[m]=_;let k=Nl(f,o,i);l.push(k);let $=l.filter(z);return{events:l.filter((Y)=>!z(Y)),updated:[_],added:[k],deleted:$}},Hl=({updates:o,updatedEvents:i,baseEventIndex:l,baseEvent:m})=>{let f=h(m),N=zl(m,o),c={...m,...o,start:N.start,end:N.end,rrule:N.rrule,exdates:void 0,uid:f};i[l]=c;let z=(k)=>{let $=Boolean(k.recurrenceId)&&!k.rrule,V=h(k)===f;return $&&V},g=i.filter((k)=>!z(k)),_=i.filter(z);return{events:g,updated:[c],added:[],deleted:_}},wl={this:_l,following:Gl,all:Hl},Ni=({targetEvent:o,updates:i,currentEvents:l,scope:m})=>{let f=[...l],N=No(f,o),c=f[N],z=wl[m];if(!z)throw Error(`Invalid scope: ${m}. Must be 'this', 'following', or 'all'`);return z({targetEvent:o,updates:i,updatedEvents:f,baseEventIndex:N,baseEvent:c})};import{jsx as ci}from"react/jsx-runtime";var $l=()=>({name:"recurrence",transformEvents:(o,i)=>o.flatMap((l)=>{if(!l.rrule)return[l];return Qo({event:l,currentEvents:o,startDate:i.start,endDate:i.end})}),managesEvent:(o)=>Xo(o),applyEdit:({event:o,updates:i,currentEvents:l,scope:m})=>Ni({targetEvent:o,updates:i??{},currentEvents:l,scope:m}),applyDelete:({event:o,currentEvents:i,scope:l})=>ii({targetEvent:o,currentEvents:i,scope:l}),contribute:(o,i)=>{if(o!=="ical:vevent-properties")return[];return ko(i)},renderSlot:(o,i)=>{if(o===Jl){let{event:l,onChange:m}=i;return ci(eo,{event:l,onChange:m})}if(o===Zl){let{event:l,operation:m,resolve:f,cancel:N}=i;return ci(Mo,{eventTitle:l.title||"",isOpen:!0,onClose:N,onConfirm:(c)=>f(c),operationType:m})}return null}});export{$l as recurrencePlugin,ko as recurrenceICalProperties,Xo as isRecurringEvent,Qo as generateRecurringEvents,Sf as Weekday,Of as RRule};
|
|
1
|
+
import{I as J,J as li,K as mo}from"../shared/chunk-6g0xvnsf.js";import{L as H}from"../shared/chunk-7vqv0k0j.js";import{RRule as af,Weekday as Sf}from"rrule";import{RRule as gi}from"rrule";var Ko=(o,i=!1)=>{if(i)return o.format("YYYYMMDD");return o.utc().format("YYYYMMDD[T]HHmmss[Z]")},ki=(o)=>{try{return new gi(o).toString().split(`
|
|
2
|
+
`).find((l)=>l.startsWith("RRULE:"))||""}catch{return""}},ko=(o)=>{let i=[],l=o.rrule?ki(o.rrule):"";if(l)i.push(l);if(o.exdates?.length){let m=o.exdates.map((f)=>Ko(H(f),o.allDay)).join(",");i.push(`EXDATE:${m}`)}if(o.recurrenceId){let m=Ko(H(o.recurrenceId),o.allDay);i.push(`RECURRENCE-ID:${m}`)}return i};import"@ilamy/calendar";import{SLOT_EVENT_FORM as Hl,SLOT_EVENT_MUTATION_SCOPE as Xl}from"@ilamy/calendar";import{useIlamyCalendarContext as _i}from"@ilamy/calendar";import{Slot as Gi}from"@radix-ui/react-slot";import{cva as Ji}from"class-variance-authority";import{jsx as Zi}from"react/jsx-runtime";var $i=Ji("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 Go({className:o,variant:i,size:l,asChild:m=!1,...f}){return Zi(m?Gi:"button",{className:J($i({variant:i,size:l,className:o})),"data-slot":"button",...f})}import*as Y from"@radix-ui/react-dialog";import{XIcon as Hi}from"lucide-react";import{jsx as W,jsxs as Jo}from"react/jsx-runtime";function Yo({...o}){return W(Y.Root,{"data-slot":"dialog",...o})}function Xi({...o}){return W(Y.Portal,{"data-slot":"dialog-portal",...o})}function Qi({className:o,...i}){return W(Y.Overlay,{className:J("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",o),"data-slot":"dialog-overlay",...i})}function Bo({className:o,children:i,...l}){return Jo(Xi,{"data-slot":"dialog-portal",children:[W(Qi,{}),Jo(Y.Content,{className:J("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%]",o),"data-slot":"dialog-content",...l,children:[i,Jo(Y.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:[W(Hi,{}),W("span",{className:"sr-only",children:"Close"})]})]})]})}function Wo({className:o,...i}){return W("div",{className:J("flex flex-col gap-2 text-center sm:text-left",o),"data-slot":"dialog-header",...i})}function bo({className:o,...i}){return W("div",{className:J("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",o),"data-slot":"dialog-footer",...i})}function ho({className:o,...i}){return W(Y.Title,{className:J("text-lg leading-none font-semibold",o),"data-slot":"dialog-title",...i})}function Lo({className:o,...i}){return W(Y.Description,{className:J("text-muted-foreground text-sm",o),"data-slot":"dialog-description",...i})}import{jsx as F,jsxs as v}from"react/jsx-runtime";var qi=[{scope:"this",title:"thisEvent",editKey:"onlyChangeThis",deleteKey:"onlyDeleteThis"},{scope:"following",title:"thisAndFollowingEvents",editKey:"changeThisAndFuture",deleteKey:"deleteThisAndFuture"},{scope:"all",title:"allEvents",editKey:"changeEntireSeries",deleteKey:"deleteEntireSeries"}];function Fo({isOpen:o,onClose:i,onConfirm:l,operationType:m,eventTitle:f}){let{t:N}=_i(),z=(k)=>{l(k),i()},c=m==="edit",g=N("deleteRecurringEvent"),G=N("deleteRecurringEventQuestion");if(c)g=N("editRecurringEvent"),G=N("editRecurringEventQuestion");return F(Yo,{onOpenChange:(k)=>{if(!k)i()},open:o,children:v(Bo,{className:"max-w-md",children:[v(Wo,{children:[F(ho,{children:g}),v(Lo,{children:['"',f,'" ',G]})]}),F("div",{className:"space-y-3",children:qi.map(({scope:k,title:Q,editKey:_,deleteKey:K})=>F(Go,{className:"w-full justify-start h-auto p-4",onClick:()=>z(k),variant:"outline",children:v("div",{className:"text-left",children:[F("div",{className:"font-medium",children:N(Q)}),F("div",{className:"text-sm text-muted-foreground",children:N(c?_:K)})]})},k))}),F(bo,{children:F(Go,{onClick:i,variant:"outline",children:N("cancel")})})]})})}import{useIlamyCalendarContext as vi}from"@ilamy/calendar";import{useState as ti}from"react";import{useIlamyCalendarContext as di}from"@ilamy/calendar";import{jsx as t}from"react/jsx-runtime";function Mo({className:o,...i}){return t("div",{className:J("text-card-foreground flex flex-col gap-1 rounded-xl border shadow-sm",o),"data-slot":"card",...i})}function Ao({className:o,...i}){return t("div",{className:J("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 p-4 pb-0 has-data-[slot=card-action]:grid-cols-[1fr_auto]",o),"data-slot":"card-header",...i})}function Co({className:o,...i}){return t("div",{className:J("leading-none font-semibold",o),"data-slot":"card-title",...i})}function Po({className:o,...i}){return t("div",{className:J("p-4 pt-0",o),"data-slot":"card-content",...i})}import*as e from"@radix-ui/react-checkbox";import{CheckIcon as Vi}from"lucide-react";import{jsx as Zo}from"react/jsx-runtime";function y({className:o,...i}){return Zo(e.Root,{className:J("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",o),"data-slot":"checkbox",...i,children:Zo(e.Indicator,{className:"flex items-center justify-center text-current transition-none","data-slot":"checkbox-indicator",children:Zo(Vi,{className:"size-3.5"})})})}import{useEffect as Ei,useState as _o}from"react";import{RRule as no}from"rrule";import{createContext as wi,useContext as Ki}from"react";var To=wi(null),Uo=To.Provider,b=()=>{let o=Ki(To);if(!o)throw Error("useRecurrenceEditor must be used within a RecurrenceEditor");return o};import{RRule as q}from"rrule";var Yi=[q.SU,q.MO,q.TU,q.WE,q.TH,q.FR,q.SA],Bi=[q.MO,q.TU,q.WE,q.TH,q.FR],Wi=["first","second","third","fourth"],Do=(o)=>Yi.at(H(o).day())??q.SU,Io=(o)=>{let i=H(o);return i.add(7,"day").month()!==i.month()?-1:Math.ceil(i.date()/7)},bi={daily:()=>({freq:q.DAILY}),weekdays:()=>({freq:q.WEEKLY,byweekday:Bi}),weeklyOnDay:(o)=>({freq:q.WEEKLY,byweekday:[Do(o)]}),monthlyOnDay:(o)=>({freq:q.MONTHLY,bymonthday:H(o).date()}),monthlyOnWeekday:(o)=>({freq:q.MONTHLY,byweekday:[Do(o).nth(Io(o))]})},S=(o,i)=>{let l=bi[o];if(!l)return null;return{interval:1,dtstart:i,...l(i)}},yo=(o)=>{if(o==null)return"";return(Array.isArray(o)?o:[o]).map((l)=>typeof l==="object"?`${l.weekday}:${l.n??""}`:`${l}:`).sort().join(",")},hi=(o,i)=>{if(!i)return!1;let l=o.freq===i.freq,m=yo(o.byweekday)===yo(i.byweekday),f=(o.bymonthday??null)===(i.bymonthday??null);return l&&m&&f},Li=["daily","weekdays","weeklyOnDay","monthlyOnDay","monthlyOnWeekday"],j=(o,i)=>{if(!o)return"once";if(Boolean(o.interval)&&o.interval!==1)return"customize";return Li.find((f)=>hi(o,S(f,i)))??"customize"},R=(o,i,l)=>{let m=H(i).format("dddd"),f=Io(i),N=f===-1?"last":Wi.at(f-1)??"last",z=l(N);return{daily:l("daily"),weekdays:l("everyWeekday"),weeklyOnDay:`${l("weeklyOn")} ${m}`,monthlyOnDay:`${l("monthlyOnDay")} ${H(i).date()}`,monthlyOnWeekday:`${l("monthlyOnThe")} ${z} ${m}`}[o]??l("customRecurrence")},I=(o)=>{if(Array.isArray(o))return o;return o?[o]:[]};import{useIlamyCalendarContext as Pi}from"@ilamy/calendar";import{jsx as Fi}from"react/jsx-runtime";function oo({className:o,type:i,...l}){return Fi("input",{className:J("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",o),"data-slot":"input",type:i,...l})}import*as po from"@radix-ui/react-label";import{jsx as Mi}from"react/jsx-runtime";function B({className:o,...i}){return Mi(po.Root,{className:J("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",o),"data-slot":"label",...i})}import{jsx as Ci}from"react/jsx-runtime";var Ai="YYYY-MM-DD",Oo=({date:o,onChange:i,className:l})=>{let m=o?H(o).format(Ai):"",f=(N)=>{let z=N.target.value;if(!z){i?.(void 0);return}let c=H(z);i?.(c.isValid()?c.toDate():void 0)};return Ci("input",{className:J("flex h-9 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none transition-shadow focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50",l),onChange:f,type:"date",value:m})};import{jsx as C,jsxs as $o,Fragment as Di}from"react/jsx-runtime";var Ti=[{type:"never",id:"never",labelKey:"never"},{type:"count",id:"after",labelKey:"after"},{type:"until",id:"on",labelKey:"on"}],Ui=(o)=>Math.max(1,Number.parseInt(o,10)||1),xo=()=>{let{t:o}=Pi(),{opts:i,update:l,setEndType:m,setUntil:f}=b(),N="never";if(i?.until)N="until";else if(i?.count)N="count";let z=i?.count||1,c=i?.until??void 0;return $o("div",{children:[C(B,{className:"text-xs",children:o("ends")}),C("div",{className:"space-y-2 mt-1",children:Ti.map(({type:g,id:G,labelKey:k})=>{let Q=g==="count"&&N==="count",_=g==="until"&&N==="until";return $o("div",{className:"flex items-center space-x-2",children:[C(y,{checked:N===g,id:G,onCheckedChange:()=>m(g)}),C(B,{className:"text-xs",htmlFor:G,children:o(k)}),Q&&$o(Di,{children:[C(oo,{className:"h-6 w-16 text-xs","data-testid":"count-input",min:"1",onChange:(K)=>l({count:Ui(K.target.value)}),type:"number",value:z}),C("span",{className:"text-xs",children:o("occurrences")})]}),_&&C(Oo,{className:"h-6",date:c,onChange:f})]},g)})})]})};import{useIlamyCalendarContext as xi}from"@ilamy/calendar";import*as Z from"@radix-ui/react-select";import{CheckIcon as yi,ChevronDownIcon as ao,ChevronUpIcon as Ii}from"lucide-react";import{jsx as w,jsxs as Ho}from"react/jsx-runtime";function p({...o}){return w(Z.Root,{"data-slot":"select",...o})}function O({...o}){return w(Z.Value,{"data-slot":"select-value",...o})}function x({className:o,size:i="default",children:l,...m}){return Ho(Z.Trigger,{className:J("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",o),"data-size":i,"data-slot":"select-trigger",...m,children:[l,w(Z.Icon,{asChild:!0,children:w(ao,{className:"size-4 opacity-50"})})]})}function a({className:o,children:i,position:l="popper",align:m="center",...f}){return w(Z.Portal,{children:Ho(Z.Content,{align:m,className:J("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",l==="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",o),"data-slot":"select-content",position:l,...f,children:[w(pi,{}),w(Z.Viewport,{className:J("p-1",l==="popper"&&"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width) scroll-my-1"),children:i}),w(Oi,{})]})})}function P({className:o,children:i,...l}){return Ho(Z.Item,{className:J("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",o),"data-slot":"select-item",...l,children:[w("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:w(Z.ItemIndicator,{children:w(yi,{className:"size-4"})})}),w(Z.ItemText,{children:i})]})}function pi({className:o,...i}){return w(Z.ScrollUpButton,{className:J("flex cursor-default items-center justify-center py-1",o),"data-slot":"select-scroll-up-button",...i,children:w(Ii,{className:"size-4"})})}function Oi({className:o,...i}){return w(Z.ScrollDownButton,{className:J("flex cursor-default items-center justify-center py-1",o),"data-slot":"select-scroll-down-button",...i,children:w(ao,{className:"size-4"})})}import{RRule as s}from"rrule";import{jsx as T,jsxs as io}from"react/jsx-runtime";var Xo={DAILY:s.DAILY,WEEKLY:s.WEEKLY,MONTHLY:s.MONTHLY,YEARLY:s.YEARLY},ai=Object.fromEntries(Object.entries(Xo).map(([o,i])=>[i,o])),Si=(o)=>Math.max(1,Number.parseInt(o,10)||1),So=()=>{let{t:o}=xi(),{opts:i,custom:l,update:m}=b();if(!l)return null;let f=ai[i?.freq??s.DAILY]||"DAILY",N=i?.interval||1;return io("div",{className:"grid grid-cols-2 gap-4",children:[io("div",{children:[T(B,{className:"text-xs",htmlFor:"frequency",children:o("frequency")}),io(p,{onValueChange:(z)=>m({freq:Xo[z]}),value:f,children:[T(x,{className:"h-8 w-full","data-testid":"frequency-select",id:"frequency",children:T(O,{})}),T(a,{children:Object.keys(Xo).map((z)=>T(P,{value:z,children:o(z.toLowerCase())},z))})]})]}),io("div",{children:[T(B,{className:"text-xs",htmlFor:"interval",children:o("every")}),T(oo,{className:"h-8",id:"interval",min:"1",onChange:(z)=>m({interval:Si(z.target.value)}),type:"number",value:N})]})]})};import{useIlamyCalendarContext as ji}from"@ilamy/calendar";import{RRule as Ri}from"rrule";import{jsx as u,jsxs as Qo}from"react/jsx-runtime";var jo=()=>{let{t:o}=ji(),{opts:i,custom:l,reference:m,setMonthlyMode:f}=b();if(!l||i?.freq!==Ri.MONTHLY)return null;let z=I(i?.byweekday).some((c)=>typeof c==="object"&&c.n!=null)?"weekday":"day";return Qo("div",{children:[u(B,{className:"text-xs",htmlFor:"monthly-mode",children:o("repeatOn")}),Qo(p,{onValueChange:(c)=>f(c),value:z,children:[u(x,{className:"h-8 w-full","data-testid":"monthly-mode-select",id:"monthly-mode",children:u(O,{})}),Qo(a,{children:[u(P,{value:"day",children:R("monthlyOnDay",m,o)}),u(P,{value:"weekday",children:R("monthlyOnWeekday",m,o)})]})]})]})};import{useIlamyCalendarContext as si}from"@ilamy/calendar";import{jsx as r,jsxs as Ro}from"react/jsx-runtime";var ui=["daily","weekdays","weeklyOnDay","monthlyOnDay","monthlyOnWeekday","customize"],so=()=>{let{t:o}=si(),{opts:i,custom:l,reference:m,selectPreset:f}=b(),N=l?"customize":j(i,m);return Ro("div",{children:[r(B,{className:"text-xs",htmlFor:"recurrence-preset",children:o("repeats")}),Ro(p,{onValueChange:(z)=>f(z),value:N,children:[r(x,{className:"h-8 w-full","data-testid":"preset-select",id:"recurrence-preset",children:r(O,{})}),r(a,{children:ui.map((z)=>r(P,{value:z,children:R(z,m,o)},z))})]})]})};import{useIlamyCalendarContext as ri}from"@ilamy/calendar";import{RRule as M}from"rrule";import{jsx as lo,jsxs as ro}from"react/jsx-runtime";var uo=[M.SU,M.MO,M.TU,M.WE,M.TH,M.FR,M.SA],Eo=()=>{let{t:o,firstDayOfWeek:i}=ri(),{opts:l,custom:m,toggleDay:f}=b();if(!m||l?.freq!==M.WEEKLY)return null;let N=I(l?.byweekday),z=uo.map((g,G)=>({value:g,label:H().day(G).format("ddd")})),c=uo.map((g,G)=>z[(G+i)%7]);return ro("div",{children:[lo(B,{className:"text-xs",children:o("repeatOn")}),lo("div",{className:"flex flex-wrap gap-1 mt-1",children:c.map((g,G)=>ro("div",{className:"flex items-center space-x-1",children:[lo(y,{checked:N.includes(g.value),id:mo("day",G),onCheckedChange:()=>f(g.value)}),lo(B,{className:"text-xs cursor-pointer",htmlFor:mo("day",G),children:g.label})]},mo("weekday",G)))})]})};import{jsx as h,jsxs as fo}from"react/jsx-runtime";var ni=(o,i)=>{if(!o)return i("customRecurrence");try{let l=new no(o).toText();if(!(Boolean(l)&&!l.toLowerCase().includes("error")))return i("customRecurrence");return l.charAt(0).toUpperCase()+l.slice(1)}catch{return i("customRecurrence")}},vo=({value:o,onChange:i,referenceDate:l})=>{let{t:m}=di(),f=($)=>$?.dtstart??l??H().toDate(),[N,z]=_o(Boolean(o)),[c,g]=_o(()=>o||null),[G,k]=_o(()=>j(o??null,f(o??null))==="customize");Ei(()=>{if(z(Boolean(o)),o){g(o);let $=o.dtstart??l??H().toDate();k(j(o,$)==="customize")}},[o,l]);let Q=f(c),_=($)=>{if(!c)return;let X={...c,...$};g(X),i(N?X:null)},K=($)=>{if(z($),!$){i(null);return}if(c){i(c);return}let X={freq:no.DAILY,interval:1};g(X),k(!1),i(X)},co={opts:c,custom:G,reference:Q,update:_,selectPreset:($)=>{if($==="customize"){k(!0);return}k(!1);let X=S($,Q);if(!X)return;let D={...X,count:c?.count,until:c?.until};g(D),i(D)},toggleDay:($)=>{let X=I(c?.byweekday),n=X.includes($)?X.filter((ci)=>ci!==$):[...X,$];_({byweekday:n.length?n:void 0})},setMonthlyMode:($)=>{if($==="weekday"){let D=S("monthlyOnWeekday",Q);_({byweekday:D?.byweekday,bymonthday:void 0});return}let X=S("monthlyOnDay",Q);_({bymonthday:X?.bymonthday,byweekday:void 0})},setEndType:($)=>{let X={count:void 0,until:void 0};if($==="count")X.count=c?.count||1;if($==="until")X.until=c?.until||H().add(1,"month").endOf("day").toDate();_(X)},setUntil:($)=>{let X=$?H($).endOf("day").toDate():void 0;_({until:X})}},go=Boolean(N&&o);return h(Uo,{value:co,children:fo(Mo,{"data-testid":"recurrence-editor",children:[fo(Ao,{className:"pb-3",children:[fo("div",{className:"flex items-center space-x-2",children:[h(y,{checked:N,"data-testid":"toggle-recurrence",id:"recurring",onCheckedChange:K}),h(Co,{className:"text-sm",children:m("repeat")})]}),go&&h("p",{className:"text-xs text-muted-foreground",children:ni(o??null,m)})]}),N&&h(Po,{className:"pt-0",children:fo("div",{className:"space-y-4",children:[h(so,{}),h(So,{}),h(Eo,{}),h(jo,{}),h(xo,{})]})})]})})};import{jsx as ei}from"react/jsx-runtime";var to=({event:o,onChange:i})=>{let{rawEvents:l}=vi(),m=o.uid,f;if(m)f=l.find((g)=>{return(g.uid||`${g.id}@ilamy.calendar`)===m&&Boolean(g.rrule)});let[N,z]=ti(o.rrule??f?.rrule??null);return ei(vo,{onChange:(g)=>{if(!g){z(null),i({rrule:void 0});return}let G=g.dtstart??o.start?.toDate(),k=G?{...g,dtstart:G}:g;z(k),i({rrule:k})},referenceDate:o.start?.toDate(),value:N})};var qo=(o)=>{return Boolean(o.rrule||o.recurrenceId||o.uid)},V=(o)=>{return o.uid||`${o.id}@ilamy.calendar`},No=(o,i)=>{let l=V(i),m=o.findIndex((f)=>{let N=V(f)===l,z=Boolean(f.rrule)&&!f.recurrenceId;return N&&z});if(m===-1)throw Error("Base recurring event not found");return m},zo=(o)=>o.start.subtract(1,"day").endOf("day").toDate(),Vo=(o)=>o.recurrenceId??o.start.toISOString(),eo=(o,i)=>{let l=Vo(i),m=o.exdates||[],f=m.includes(l)?m:[...m,l];return{baseEvent:{...o,exdates:f},targetEventStartISO:l}};var ol=({targetEvent:o,updatedEvents:i,baseEventIndex:l,baseEvent:m})=>{let f=Vo(o),N=V(m),{baseEvent:z}=eo(m,o);i[l]=z;let c=(k)=>{let Q=Boolean(k.recurrenceId),_=V(k)===N,K=k.recurrenceId===f;return Q&&_&&K},g=i.find(c);return{events:i.filter((k)=>!c(k)),updated:g?[]:[z],added:[],deleted:g?[g]:[]}},il=({targetEvent:o,updatedEvents:i,baseEventIndex:l,baseEvent:m})=>{let f={...m,rrule:{...m.rrule,until:zo(o)}};return i[l]=f,{events:i,updated:[f],added:[],deleted:[]}},ll=({targetEvent:o,updatedEvents:i})=>{let l=V(o),m=i.filter((N)=>V(N)===l);return{events:i.filter((N)=>V(N)!==l),updated:[],added:[],deleted:m}},ml={this:ol,following:il,all:ll},oi=({targetEvent:o,currentEvents:i,scope:l})=>{let m=[...i],f=No(m,o),N=m[f],z=ml[l];if(!z)throw Error(`Invalid scope: ${l}. Must be 'this', 'following', or 'all'`);return z({targetEvent:o,updatedEvents:m,baseEventIndex:f,baseEvent:N})};import{RRule as fl}from"rrule";var d=(o)=>{return new Date(Date.UTC(o.year(),o.month(),o.date(),o.hour(),o.minute(),o.second(),o.millisecond()))},ii=(o,i)=>{return i.year(o.getUTCFullYear()).month(o.getUTCMonth()).date(o.getUTCDate()).hour(o.getUTCHours()).minute(o.getUTCMinutes()).second(o.getUTCSeconds()).millisecond(o.getUTCMilliseconds())};var wo=({event:o,currentEvents:i,startDate:l,endDate:m})=>{if(!o.rrule)return[];try{let f=d(o.start),N;if(o.rrule.until)N=d(H(o.rrule.until));let z={...o.rrule,dtstart:f,until:N},c=new fl(z),g=V(o),G=i.filter((L)=>{let U=Boolean(L.recurrenceId),A=V(L)===g;return U&&A}),k=o.end.diff(o.start),Q=d(l.subtract(k,"millisecond")),_=d(m);return c.between(Q,_,!0).map((L,U)=>{let A=ii(L,o.start),E=G.find((n)=>li(n.recurrenceId)?.isSame(A));if(E)return{...o,...E};let co=o.end.diff(o.start),go=A.add(co,"millisecond"),$=`${o.id}_${U}`,X=V(o);return{...o,id:$,start:A,end:go,uid:X,rrule:void 0}}).filter((L)=>{let U=L.start.toISOString();if(o.exdates?.includes(U)??!1)return!1;return L.start.isSameOrBefore(m)&&L.end.isSameOrAfter(l)})}catch(f){throw Error(`Invalid RRULE options: ${JSON.stringify(o.rrule)}. Error: ${f instanceof Error?f.message:"Unknown error"}`)}};var mi=(o,i)=>{let l=i.diff(i.startOf("day"),"millisecond");return o.startOf("day").add(l,"millisecond")},Nl=(o,i,l)=>{let m=o.end.diff(o.start),f=l.start||i.start,N=l.end||f.add(m),z=`${o.id}_following`,c=`${z}@ilamy.calendar`;return{...o,...l,rrule:{...o.rrule,...l.rrule,dtstart:f.toDate()},id:z,uid:c,start:f,end:N,recurrenceId:void 0}},zl=(o,i)=>{return(l)=>{let m=Boolean(l.recurrenceId)&&!l.rrule,f=V(l)===o,N=Boolean(l.recurrenceId)&&H(l.recurrenceId).isAfter(i);return m&&f&&N}},cl=(o,i)=>{let l=o.start;if(i.start)l=mi(o.start,i.start);let m=o.end;if(i.start&&i.end)m=l.add(i.end.diff(i.start),"millisecond");else if(i.start)m=l.add(o.end.diff(o.start),"millisecond");else if(i.end)m=mi(o.end,i.end);let f=i.rrule??o.rrule,N;if(f)N={...f,dtstart:l.toDate()};return{start:l,end:m,rrule:N}},gl=(o,i)=>{if(i&&o.recurrenceId)return o.recurrenceId;return o.start.toISOString()},kl=({updatedEvents:o,targetEvent:i,detachedOverride:l,updatedBaseEvent:m,baseChanged:f})=>{let N=o.findIndex((z)=>z.id===i.id);if(N===-1)throw Error("Detached override not found");return o[N]=l,{events:o,updated:f?[m,l]:[l],added:[],deleted:[]}},Gl=({targetEvent:o,updates:i,updatedEvents:l,baseEventIndex:m,baseEvent:f})=>{let N=V(f),z=Boolean(o.recurrenceId&&!o.rrule),c=gl(o,z),g=f.exdates||[],G=g.includes(c)?g:[...g,c],k=G!==g||f.uid!==N,Q={...f,exdates:G,uid:N};l[m]=Q;let _={...o,...i,recurrenceId:c,rrule:void 0,uid:N};if(z)return kl({updatedEvents:l,targetEvent:o,detachedOverride:_,updatedBaseEvent:Q,baseChanged:k});let K={..._,id:`${f.id}_modified_${Date.now()}`};return l.push(K),{events:l,updated:[Q],added:[K],deleted:[]}},Jl=({targetEvent:o,updates:i,updatedEvents:l,baseEventIndex:m,baseEvent:f})=>{let N=zo(o),z=V(f),c=zl(z,N),g=(f.exdates??[]).filter((K)=>!H(K).isAfter(N)),G={...f,exdates:g,rrule:{...f.rrule,until:N}};l[m]=G;let k=Nl(f,o,i);l.push(k);let Q=l.filter(c);return{events:l.filter((K)=>!c(K)),updated:[G],added:[k],deleted:Q}},Zl=({updates:o,updatedEvents:i,baseEventIndex:l,baseEvent:m})=>{let f=V(m),N=cl(m,o),z={...m,...o,start:N.start,end:N.end,rrule:N.rrule,exdates:void 0,uid:f};i[l]=z;let c=(k)=>{let Q=Boolean(k.recurrenceId)&&!k.rrule,_=V(k)===f;return Q&&_},g=i.filter((k)=>!c(k)),G=i.filter(c);return{events:g,updated:[z],added:[],deleted:G}},$l={this:Gl,following:Jl,all:Zl},fi=({targetEvent:o,updates:i,currentEvents:l,scope:m})=>{let f=[...l],N=No(f,o),z=f[N],c=$l[m];if(!c)throw Error(`Invalid scope: ${m}. Must be 'this', 'following', or 'all'`);return c({targetEvent:o,updates:i,updatedEvents:f,baseEventIndex:N,baseEvent:z})};import{jsx as Ni}from"react/jsx-runtime";var Ql=()=>({name:"recurrence",transformEvents:(o,i)=>o.flatMap((l)=>{if(!l.rrule)return[l];return wo({event:l,currentEvents:o,startDate:i.start,endDate:i.end})}),managesEvent:(o)=>qo(o),applyEdit:({event:o,updates:i,currentEvents:l,scope:m})=>fi({targetEvent:o,updates:i??{},currentEvents:l,scope:m}),applyDelete:({event:o,currentEvents:i,scope:l})=>oi({targetEvent:o,currentEvents:i,scope:l}),contribute:(o,i)=>{if(o!=="ical:vevent-properties")return[];return ko(i)},renderSlot:(o,i)=>{if(o===Hl){let{event:l,onChange:m}=i;return Ni(to,{event:l,onChange:m})}if(o===Xl){let{event:l,operation:m,resolve:f,cancel:N}=i;return Ni(Fo,{eventTitle:l.title||"",isOpen:!0,onClose:N,onConfirm:(z)=>f(z),operationType:m})}return null}});export{Ql as recurrencePlugin,ko as recurrenceICalProperties,qo as isRecurringEvent,wo as generateRecurringEvents,Sf as Weekday,af as RRule};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{L as r}from"./chunk-
|
|
1
|
+
import{L as r}from"./chunk-7vqv0k0j.js";function n(e){if(e===void 0)return;if(r.isDayjs(e))return e;let t=r(e);return t.isValid()?t:void 0}var f=(...e)=>e.join("-");import{clsx as a}from"clsx";import{twMerge as s}from"tailwind-merge";function i(...e){return s(a(e))}
|
|
2
2
|
export{i as I,n as J,f as K};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{L as t5}from"./chunk-7vqv0k0j.js";import g from"dayjs";import x2 from"dayjs/plugin/isBetween.js";import E2 from"dayjs/plugin/isSameOrAfter.js";import m2 from"dayjs/plugin/isSameOrBefore.js";import p2 from"dayjs/plugin/localeData.js";import v2 from"dayjs/plugin/localizedFormat.js";import g2 from"dayjs/plugin/minMax.js";import y2 from"dayjs/plugin/timezone.js";import c2 from"dayjs/plugin/utc.js";import l2 from"dayjs/plugin/weekday.js";import u2 from"dayjs/plugin/weekOfYear.js";var G5,i2=(Q,q,J)=>{let $=q.prototype,X=J.tz.setDefault;J.tz.setDefault=(L)=>{return G5=L,X(L)};let{startOf:Z,endOf:P}=$;function K(L,z){let V=L.$x?.$timezone||G5;if(!V)return z;let A=J.tz(z.format("YYYY-MM-DDTHH:mm:ss"),V).utcOffset();if(z.utcOffset()!==A)return z.tz(V,!0);return z}$.startOf=function(L,z){let V=Z.call(this,L,z);return K(this,V)},$.endOf=P};g.extend(l2);g.extend(u2);g.extend(E2);g.extend(m2);g.extend(x2);g.extend(g2);g.extend(y2);g.extend(c2);g.extend(p2);g.extend(v2);g.extend(i2);var F5=(...Q)=>{return g.tz(...Q)};Object.assign(F5,g);var f=F5;import{useContext as o2}from"react";import{createContext as d2}from"react";var b0=d2(void 0);var r2=[];function R(Q){let q=o2(b0);if(!q)throw Error("useSmartCalendarContext must be used within a CalendarProvider");return Q?Q(q):q}function g9(){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??r2,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 U5={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 N9}from"react";import{useEffect as R2,useMemo as H2,useRef as I2}from"react";import{useMemo as S5,useState as n2}from"react";var V5=1,A5=24,W5=24,_5=4,O5="bg-[color-mix(in_oklch,var(--background),var(--foreground)_3%)] text-muted-foreground pointer-events-none",N5={sunday:0,monday:1,tuesday:2,wednesday:3,thursday:4,friday:5,saturday:6},E=0.05,M5=0.005,w0="h-12",l9="h-24";var R5=({firstDayOfWeek:Q,dayMaxEvents:q=_5,businessHours:J,locale:$,translations:X,translator:Z,resources:P,orientation:K="horizontal",weekViewGranularity:L="hourly"})=>{let[z,V]=n2($||"en"),A=S5(()=>{if(Z)return Z;let _=X||U5;return(B)=>_[B]||B},[X,Z]);return S5(()=>({firstDayOfWeek:Q,dayMaxEvents:q,businessHours:J,currentLocale:z,setCurrentLocale:V,t:A,resources:P,orientation:K,weekViewGranularity:L}),[Q,q,J,z,A,P,K,L])};import{useCallback as o,useEffect as a2,useMemo as H5,useRef as s2,useState as t2}from"react";var V0=(Q)=>{if(Q.resourceIds)return Q.resourceIds;if(Q.resourceId!==void 0)return[Q.resourceId];return[]};function z0(Q,q){return Q.filter((J)=>V0(J).includes(q))}function j0(Q,q,J){let $=Q.start.isSameOrAfter(q)&&Q.start.isSameOrBefore(J),X=Q.end.isSameOrAfter(q)&&Q.end.isSameOrBefore(J),Z=Q.start.isBefore(q)&&Q.end.isAfter(J);return $||X||Z}var I5=(Q)=>!Array.isArray(Q),T5=(Q,{onEventUpdate:q,onEventAdd:J,onEventDelete:$,setCurrentEvents:X})=>{for(let Z of Q.updated)q?.(Z);for(let Z of Q.added)J?.(Z);for(let Z of Q.deleted)$?.(Z);X(Q.events)},b5=({events:Q,pluginRuntime:q,getCurrentViewRange:J,resources:$,onEventAdd:X,onEventUpdate:Z,onEventDelete:P})=>{let[K,L]=t2(Q),z=s2(Q),V=o((U,W)=>q.transformEvents(K,{start:U,end:W}),[K,q]),A=H5(()=>{let{start:U,end:W}=J();return V(U,W)},[V,J]);a2(()=>{if(Q!==z.current)L(Q),z.current=Q},[Q]);let _=o((U)=>{L((W)=>[...W,U]),X?.(U)},[X]),B=o((U,W)=>{let H=K.find((w)=>w.id===U);if(!H)return;let I={...H,...W};L((w)=>w.map((C)=>C.id===U?I:C)),Z?.(I)},[K,Z]),M=o((U,W,H)=>{let I=q.getEventManager(U);if(!I?.applyEdit)return;let w=I.applyEdit({event:U,updates:W,currentEvents:K,scope:H});if(I5(w)){T5(w,{onEventUpdate:Z,onEventAdd:X,onEventDelete:P,setCurrentEvents:L});return}Z?.({...U,...W}),L(w)},[K,X,Z,P,q]),Y=o((U,W)=>{let H=q.getEventManager(U);if(!H?.applyDelete)return;let I=H.applyDelete({event:U,currentEvents:K,scope:W});if(I5(I)){T5(I,{onEventUpdate:Z,onEventAdd:X,onEventDelete:P,setCurrentEvents:L});return}P?.(U),L(I)},[K,X,Z,P,q]),N=o((U)=>{let W=K.find((H)=>H.id===U);if(!W)return;L((H)=>H.filter((I)=>I.id!==U)),P?.(W)},[K,P]),O=o((U)=>z0(A,U),[A]),T=o((U)=>A.filter((W)=>V0(W).some((H)=>U.includes(H))),[A]),S=o((U)=>{if(U===void 0)return;return $.find((W)=>W.id===U)},[$]),b=o((U)=>{return Boolean(U.resourceIds&&U.resourceIds.length>1)},[]);return H5(()=>({events:A,rawEvents:K,setCurrentEvents:L,getEventsForDateRange:V,addEvent:_,updateEvent:B,deleteEvent:N,applyScopedEdit:M,applyScopedDelete:Y,getEventsForResource:O,getEventsForResources:T,getResourceById:S,isEventCrossResource:b}),[A,K,V,_,B,N,M,Y,O,T,S,b])};import{useCallback as A0,useMemo as e2,useState as n0}from"react";var QQ=(Q)=>Q,w5=({currentDate:Q,t:q,disableEventClick:J,disableCellClick:$,onEventClick:X,onCellClick:Z})=>{let[P,K]=n0(!1),[L,z]=n0(null),[V,A]=n0(null),_=A0((O={})=>{let{start:T,end:S,resourceId:b,resource:U,allDay:W}=O;if(T)A(T);let H=T??Q;z(QQ({title:q("newEvent"),start:H,end:S??H.add(1,"hour"),resourceId:b??U?.id,description:"",allDay:W??!1})),K(!0)},[Q,q]),B=A0(()=>{A(null),z(null),K(!1)},[]),M=A0((O)=>{z(O),K(!0)},[]),Y=A0((O)=>{if(J)return;if(X)X(O);else M(O)},[J,X,M]),N=A0((O)=>{if($)return;if(Z)Z(O);else _(O)},[Z,$,_]);return e2(()=>({isEventFormOpen:P,selectedEvent:L,selectedDate:V,setIsEventFormOpen:K,setSelectedEvent:z,setSelectedDate:A,openEventForm:_,closeEventForm:B,handleEventClick:Y,handleDateClick:N}),[P,L,V,_,B,Y,N])};import{useCallback as l,useMemo as G9,useRef as F9,useState as U9}from"react";import{clsx as qQ}from"clsx";import{twMerge as JQ}from"tailwind-merge";function G(...Q){return JQ(qQ(Q))}import{Square as cQ}from"lucide-react";import{jsx as $Q}from"react/jsx-runtime";var k=({children:Q,transitionKey:q,delay:J=0,className:$,direction:X="vertical","data-testid":Z,ref:P,style:K,...L})=>{return $Q("div",{className:G("inline-block w-full animate-in fade-in fill-mode-backwards duration-200 ease-in-out",X==="horizontal"?"slide-in-from-right-2.5":"slide-in-from-top-2.5",$),"data-testid":Z,ref:P,style:{animationDelay:`${J}s`,...K},...L,children:Q},q)};k.displayName="AnimatedSection";import{jsx as f5,Fragment as j5}from"react/jsx-runtime";var f0=({date:Q})=>{let{renderHour:q,timeFormat:J}=R();if(q)return f5(j5,{children:q(Q)});return f5(j5,{children:Q.format(J==="12-hour"?"h A":"H")})};function h(Q){return Q.isSame(f(),"day")}function D(Q){return Q.format("YYYY-MM-DD")}function m(Q,q){let J=Q.startOf("week").day(q),$=Q.isBefore(J)?J.subtract(1,"week"):J;return Array.from({length:7},(X,Z)=>$.add(Z,"day"))}function a0(Q,q){let J=Q.startOf("month"),X=m(J,q).at(0)??J;return Array.from({length:6},(Z,P)=>{let K=X.add(P,"week");return m(K,q)})}function k0(Q){let q=Q.daysInMonth(),J=Q.startOf("month");return Array.from({length:q},($,X)=>J.add(X,"day"))}function k5({referenceDate:Q=f(),length:q=24}={}){let J=Q.startOf("day");return Array.from({length:q},($,X)=>J.hour(X).minute(0).second(0).millisecond(0))}var C0=(Q,q)=>{let J=a0(Q,q),$=J.at(0)?.at(0)??Q,X=J.at(-1)?.at(-1)??Q;return{start:$.startOf("day"),end:X.endOf("day")}};var L0=(Q)=>String(Q).padStart(2,"0"),XQ=(Q)=>typeof Q==="number"?L0(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 $=D(Q);return q!=null?`day-cell-${$}-${L0(q)}-${L0(J)}`:`day-cell-${$}`},verticalTime:(Q)=>`vertical-time-${L0(Q)}`,vertical:(Q,q,J,$)=>{let X=`vertical-cell-${D(Q)}-${L0(q)}-${L0(J)}`;return $!=null?`${X}-resource-${$}`:X}},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-${XQ(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)=>h(Q)?"day-number-today":`day-number-${Q.format("D")}`,timePicker:(Q)=>`time-picker-${Q??""}`,droppable:{dayCell:(Q,q)=>{let J=Q.toISOString(),$=q?.allDay?"-allday":"",X=q?.resourceId!=null?`-resource-${q.resourceId}`:"";return`drop-day-cell-${J}${$}${X}`}}};import{jsx as C5}from"react/jsx-runtime";var P0="w-16 min-w-16 max-w-16",h5="w-[calc(100%-4rem)]",s0="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%)]",Q0=({days:Q,gridType:q,renderLabel:J,widthClassName:$=P0})=>({id:q==="hour"?F.col.time:F.col.date,day:void 0,days:Q,className:G("shrink-0",$,"sticky left-0 bg-background z-20",u),gridType:q,noEvents:!0,renderCell:(X)=>C5("div",{className:"text-muted-foreground p-2 text-right text-[10px] sm:text-xs flex flex-col items-center",children:J?J(X):C5(f0,{date:X})})});var t0=(Q,q)=>{if(!q)return!0;let J=!1;return D0(q,{date:Q,onMatch:()=>{J=!0}}),J},ZQ=/^(\d{1,2}):(\d{2})$/,h0=(Q,q)=>{if(typeof Q==="number")return Math.round(Q)*60;if(typeof Q==="string"){let J=Q.match(ZQ);if(J){let $=Number(J[1]),X=Number(J[2]),Z=$*60+X<=1440;if(X<=59&&Z)return $*60+X}}return q*60},D5=({date:Q,hour:q,minute:J=0,durationMinutes:$,businessHours:X})=>{if(!X)return!0;if(q===void 0)return t0(Q,X);let Z=!1,P=q*60+J;return D0(X,{date:Q,onMatch:(K)=>{let L=h0(K.startTime,9),z=h0(K.endTime,17),V=P>=L,A=$?P+$<=z:P<z;if(V&&A)Z=!0}}),Z},D0=(Q,q)=>{let{date:J,onMatch:$}=q;if(!Q)return;let X=Array.isArray(Q)?Q:[Q];for(let Z of X)if(J&&Z.daysOfWeek){let P=J.day();if(Z.daysOfWeek.some((K)=>N5[K]===P))$(Z)}else $(Z)},x5=(Q)=>{let{allDates:q,businessHours:J,resourceBusinessHours:$=[],hideNonBusinessHours:X}=Q,Z=24,P=0,K=!1,L=(V)=>{K=!0,Z=Math.min(Z,h0(V.startTime,9)/60),P=Math.max(P,h0(V.endTime,17)/60)},z=(V)=>{D0(J,{date:V,onMatch:L});for(let A of $)D0(A,{date:V,onMatch:L})};for(let V of q)z(V);if(!K&&X){if(z(),!K)Z=9,P=17,K=!0}return{minStart:Z,maxEnd:P,hasBusinessHours:K}};function x0(Q){return Q.flatMap((q)=>q.businessHours?[q.businessHours]:[])}function E0({referenceDate:Q,businessHours:q,hideNonBusinessHours:J,allDates:$=[Q],resourceBusinessHours:X=[]}){let Z=k5({referenceDate:Q}),P=Boolean(q)||X.length>0;if(!(J&&P))return Z;let{minStart:L,maxEnd:z,hasBusinessHours:V}=x5({allDates:$,businessHours:q,resourceBusinessHours:X,hideNonBusinessHours:J});if(!V)return Z;if(L>=z)return[];let A=Math.floor(L),_=Math.ceil(z);return Z.filter((B)=>{let M=B.hour();return M>=A&&M<_})}import{memo as PQ}from"react";import{jsx as E5}from"react/jsx-runtime";var YQ=({className:Q})=>{let{t:q}=R();return E5("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:E5("span",{className:"truncate",children:q("allDay")})})},m0=PQ(YQ);import{memo as vQ}from"react";import{memo as q2,useMemo as EQ}from"react";import{useMemo as Q5}from"react";var KQ=(Q,q)=>{let J=Q.filter((P)=>P.end.diff(P.start,q)>0),$=Q.filter((P)=>P.end.diff(P.start,q)===0),X=[...J].sort((P,K)=>{let L=P.start.diff(K.start);if(L!==0)return L;return K.end.diff(K.start)-P.end.diff(P.start)}),Z=[...$].sort((P,K)=>P.start.diff(K.start));return{sortedMultiUnit:X,sortedSingleUnit:Z}},m5=(Q,{firstUnit:q,lastUnit:J,unitCount:$,gridType:X})=>{let Z=f.max(Q.start.startOf(X),q),P=X==="hour"?Q.end.subtract(1,"minute"):Q.end,K=f.min(P.startOf(X),J);return{startCol:Math.max(0,Z.diff(q,X)),endCol:Math.min($-1,K.diff(q,X)),isTruncatedStart:Q.start.startOf(X).isBefore(q),isTruncatedEnd:Q.end.startOf(X).isAfter(J)}},e0=(Q,q,J)=>{for(let $=0;$<Q.length;$++){let X=!0;for(let Z=q;Z<=J;Z++)if(Q[$][Z]){X=!1;break}if(X)return $}return-1},p5=({days:Q,events:q,dayMaxEvents:J,gridType:$="day"})=>{let X=Q.at(0),Z=Q.at(-1);if(!X||!Z)return[];let P={firstUnit:$==="hour"?X.startOf("hour"):X.startOf("day"),lastUnit:$==="hour"?Z.endOf("hour"):Z.endOf("day"),unitCount:Q.length,gridType:$},{sortedMultiUnit:K,sortedSingleUnit:L}=KQ(q,$),z=Array.from({length:J},()=>Array.from({length:P.unitCount},()=>!1)),V=[],A=({row:_,startCol:B,endCol:M,event:Y,isTruncatedStart:N,isTruncatedEnd:O})=>{for(let S=B;S<=M;S++)z[_][S]=!0;let T=M-B+1;V.push({kind:"horizontal",event:Y,left:B/P.unitCount*100,width:T/P.unitCount*100,row:_,isTruncatedStart:N,isTruncatedEnd:O})};for(let _ of K){let B=m5(_,P),M=e0(z,B.startCol,B.endCol);if(M!==-1){A({row:M,event:_,...B});continue}for(let Y=B.startCol+1;Y<=B.endCol;Y++){let N=e0(z,Y,B.endCol);if(N!==-1){A({row:N,startCol:Y,endCol:B.endCol,event:_,isTruncatedStart:!0,isTruncatedEnd:B.isTruncatedEnd});break}}}for(let _ of L){let M=m5(_,P).startCol,Y=e0(z,M,M);if(Y!==-1)A({row:Y,startCol:M,endCol:M,event:_,isTruncatedStart:!1,isTruncatedEnd:!1})}return V};var q5=({days:Q,allDay:q,resourceId:J,gridType:$})=>{let{getEventsForDateRange:X,dayMaxEvents:Z}=R(),P=Q.at(0),K=Q.at(-1),L=P?.startOf("day"),z=K?.endOf("day"),V=Q5(()=>{if(!L||!z)return[];let B=X(L,z);if(J)B=z0(B,J);if(q)B=B.filter((M)=>Boolean(M.allDay));return B},[X,L,z,J,q]),A=Q5(()=>{let B=new Map;for(let M of Q){let Y=D(M),N=M.startOf("day"),O=M.endOf("day"),T=V.filter((S)=>j0(S,N,O));B.set(Y,T)}return B},[Q,V]);return{positionedEvents:Q5(()=>{return p5({days:Q,events:V,dayMaxEvents:Z,gridType:$})},[Q,Z,V,$]),dayEventsMap:A}};import{jsx as v5,jsxs as zQ}from"react/jsx-runtime";var c=({today:Q,dayNumber:q,weekday:J,className:$,"data-testid":X})=>{return zQ("div",{className:G("flex flex-col items-center",$),"data-testid":X,"data-today":Q?"true":void 0,children:[J!=null&&v5("div",{className:G("w-full truncate text-center text-xs text-muted-foreground",Q&&"text-primary"),children:J}),v5("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 HQ,{memo as IQ,useMemo as r5}from"react";import{useMemo as LQ}from"react";var g5=(Q)=>{let{businessHours:q,getResourceById:J}=R(($)=>({businessHours:$.businessHours,getResourceById:$.getResourceById}));return LQ(()=>{if(Q!=null){let $=J(Q);if($?.businessHours)return $.businessHours}return q},[Q,J,q])};import*as x from"@radix-ui/react-dialog";import{XIcon as BQ}from"lucide-react";import{jsx as r,jsxs as J5}from"react/jsx-runtime";function y5({...Q}){return r(x.Root,{"data-slot":"dialog",...Q})}function GQ({...Q}){return r(x.Portal,{"data-slot":"dialog-portal",...Q})}function FQ({className:Q,...q}){return r(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 c5({className:Q,children:q,...J}){return J5(GQ,{"data-slot":"dialog-portal",children:[r(FQ,{}),J5(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,J5(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:[r(BQ,{}),r("span",{className:"sr-only",children:"Close"})]})]})]})}function l5({className:Q,...q}){return r("div",{className:G("flex flex-col gap-2 text-center sm:text-left",Q),"data-slot":"dialog-header",...q})}function dq({className:Q,...q}){return r("div",{className:G("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",Q),"data-slot":"dialog-footer",...q})}function u5({className:Q,...q}){return r(x.Title,{className:G("text-lg leading-none font-semibold",Q),"data-slot":"dialog-title",...q})}function oq({className:Q,...q}){return r(x.Description,{className:G("text-muted-foreground text-sm",Q),"data-slot":"dialog-description",...q})}import{useImperativeHandle as OQ,useState as i5}from"react";import{useDraggable as UQ}from"@dnd-kit/core";import{memo as VQ}from"react";import{jsx as W0,jsxs as _Q}from"react/jsx-runtime";var AQ=(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 WQ({elementId:Q,event:q,className:J,style:$,disableDrag:X=!1,isTruncatedStart:Z=!1,isTruncatedEnd:P=!1}){let{onEventClick:K,renderEvent:L,disableEventClick:z,disableDragAndDrop:V}=R(),{attributes:A,listeners:_,setNodeRef:B,isDragging:M}=UQ({id:Q,data:{event:q,type:"calendar-event"},disabled:X||V}),Y=()=>{return _Q("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",AQ(Z,P)),style:{backgroundColor:q.backgroundColor,color:q.color},children:[Z&&W0("div",{className:"absolute left-0 top-0 bottom-0 w-0.5 bg-foreground/25"}),W0("p",{className:G("text-[10px] font-semibold sm:text-xs mt-0.5",Z&&"pl-1",P&&"pr-1"),children:q.title}),P&&W0("div",{className:"absolute right-0 top-0 bottom-0 w-0.5 bg-foreground/25"})]})},N=X||V;return W0(k,{className:G("truncate h-full w-full",N?z?"cursor-default":"cursor-pointer":"cursor-grab",M&&!N&&"cursor-grabbing shadow-lg",J),onClick:(b)=>{b.stopPropagation(),K(q)},ref:B,style:$,transitionKey:Q,...A,..._,children:L?L(q):W0(Y,{})})}var p0=VQ(WQ,(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 NQ}from"react/jsx-runtime";var d5=({ref:Q})=>{let[q,J]=i5(!1),[$,X]=i5(null),{eventHeight:Z}=R();return OQ(Q,()=>({open:()=>J(!0),close:()=>J(!1),setSelectedDayEvents:(P)=>X(P)})),_0(y5,{onOpenChange:J,open:q,children:NQ(c5,{className:"max-h-[80vh] max-w-md overflow-y-auto",children:[_0(l5,{children:_0(u5,{children:$?.day.format("MMMM D, YYYY")})}),_0("div",{className:"mt-4 space-y-3",children:$?.events.map((P)=>{return _0(p0,{className:"relative my-1",elementId:`all-events-dialog-event-${P.id}`,event:P,style:{height:`${Z}px`}},P.id)})})]})})};import{useDroppable as MQ}from"@dnd-kit/core";import{jsx as RQ}from"react/jsx-runtime";function SQ(Q,q,J){let $=Q.hour(q??0).minute(J??0);if(q!==void 0&&J!==void 0)return{start:$,end:$.minute(J+15)};if(q!==void 0)return{start:$,end:$.hour(q+1).minute(0)};return{start:$,end:$.hour(23).minute(59)}}function o5({id:Q,type:q,date:J,hour:$,minute:X,resourceId:Z,allDay:P,children:K,className:L,style:z,"data-testid":V,disabled:A=!1}){let{onCellClick:_,isCellDisabled:B,getCellClassName:M,getResourceById:Y,disableDragAndDrop:N,disableCellClick:O,classesOverride:T,view:S}=R(),{start:b,end:U}=SQ(J,$,X),W=Y?.(Z),H={start:b,end:U,resource:W,allDay:P},I=A||Boolean(B?.(H)),w=O||I,{isOver:C,setNodeRef:a}=MQ({id:Q,data:{type:q,date:J,hour:$,minute:X,resourceId:Z,allDay:P},disabled:N||I}),s=(j)=>{if(j.stopPropagation(),w)return;_(H)},t=C&&!N&&!I,d=T?.disabledCell||O5,q0=M?.(H);return RQ("div",{className:G("droppable-cell",L,q0,t&&"bg-accent",w?"cursor-default":"cursor-pointer",I&&d),"data-all-day":P?"true":void 0,"data-disabled":I.toString(),"data-end":U.toISOString(),"data-resource-id":Z,"data-start":b.toISOString(),"data-testid":V,"data-view":S,onClick:s,ref:a,style:z,children:K})}import{jsx as v0,jsxs as g0,Fragment as n5}from"react/jsx-runtime";var TQ=({day:Q,hour:q,minute:J,slotDurationMinutes:$=60,className:X="",resourceId:Z,gridType:P="day",shouldRenderEvents:K=!0,allDay:L=!1,precomputedEvents:z,"data-testid":V,showDayNumber:A=!1,children:_})=>{let B=HQ.useRef(null),{dayMaxEvents:M=0,getEventsForDateRange:Y,currentDate:N,t:O,eventSpacing:T,eventHeight:S,onMoreEventsClick:b}=R(),U=g5(Z),W=r5(()=>{if(!K)return[];if(z)return z;let j=Y(Q.startOf(P),Q.endOf(P));if(L)j=j.filter((y)=>y.allDay);if(Z)return z0(j,Z);return j},[z,Q,Z,Y,P,K,L]),H=(j,y)=>{if(b){b(j,y);return}B.current?.setSelectedDayEvents({day:j,events:y}),B.current?.open()},I=Q.month()===N.month(),w=W.length-M,C=w>0,a=r5(()=>{if(P==="hour")return D5({date:Q,hour:Q.hour(),minute:Q.minute(),durationMinutes:$,businessHours:U});return t0(Q,U)},[P,Q,$,U]),s=F.cell.day(Q,Q.format("HH"),Q.format("mm")),t=F.cell.day(Q),d=P==="hour"?s:t,q0=F.droppable.dayCell(Q,{allDay:L,resourceId:Z});return g0(n5,{children:[v0(o5,{allDay:L,className:G("cursor-pointer overflow-clip p-1 bg-background hover:bg-accent min-h-[60px] relative min-w-0",X),"data-testid":V||d,date:Q,disabled:!a||!I,hour:q,id:q0,minute:J,resourceId:Z,type:"day-cell",children:g0("div",{className:"flex flex-col h-full w-full","data-testid":"grid-cell-content",style:{gap:`${T}px`},children:[A&&v0(c,{className:"items-start","data-testid":F.dayNumber(Q),dayNumber:Q.format("D"),today:h(Q)}),K&&g0(n5,{children:[W.slice(0,M).map((j,y)=>v0("div",{className:"w-full shrink-0","data-testid":j?.title,style:{height:`${S}px`}},F.listKey("empty",y,j.id))),C&&g0("div",{className:"text-muted-foreground hover:text-foreground cursor-pointer text-[10px] whitespace-nowrap sm:text-xs shrink-0 mt-1",onClick:(j)=>{j.stopPropagation(),H(Q,W)},onKeyDown:(j)=>{if(j.key==="Enter"||j.key===" ")j.preventDefault(),j.stopPropagation(),H(Q,W)},role:"button",tabIndex:0,children:["+",w," ",O("more")]})]}),_]})}),v0(d5,{ref:B})]})},$5=IQ(TQ);import{jsx as a5}from"react/jsx-runtime";var B0=({resource:Q,className:q,children:J,"data-testid":$})=>{let{renderResource:X}=R();return a5("div",{className:G("flex items-center justify-center p-2",q),"data-testid":$,style:{color:Q.color,backgroundColor:Q.backgroundColor},children:X?X(Q):J??a5("div",{className:"text-sm font-medium truncate",children:Q.title})})};import{memo as hQ}from"react";import{memo as bQ}from"react";import{jsx as O0,jsxs as s5,Fragment as jQ}from"react/jsx-runtime";var wQ=({rangeStart:Q,rangeEnd:q,now:J,axis:$="vertical",render:X,withDot:Z=!0})=>{let P=J??t5(),K=P.valueOf();if(!(K>=Q.valueOf()&&K<q.valueOf()))return null;let z=q.diff(Q,"minute"),A=P.diff(Q,"minute")/z*100;if(X)return O0(jQ,{children:X({currentTime:P,rangeStart:Q,rangeEnd:q,progress:A,axis:$})});if($==="horizontal")return s5("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:`${A}%`},children:[Z&&O0("div",{className:"size-2 shrink-0 rounded-full bg-red-500"}),O0("div",{className:"w-0.5 flex-1 bg-red-500"})]});return s5("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:`${A}%`},children:[Z&&O0("div",{className:"size-2 shrink-0 rounded-full bg-red-500"}),O0("div",{className:"h-0.5 flex-1 bg-red-500"})]})},e5=bQ(wQ);import{memo as fQ}from"react";import{jsx as CQ}from"react/jsx-runtime";var kQ=({rangeStart:Q,rangeEnd:q,now:J,resource:$,axis:X="vertical",withDot:Z})=>{let{renderCurrentTimeIndicator:P,view:K}=R((z)=>({renderCurrentTimeIndicator:z.renderCurrentTimeIndicator,view:z.view})),L;if(P)L=(z)=>P({...z,resource:$,view:K});return CQ(e5,{axis:X,now:J,rangeEnd:q,rangeStart:Q,render:L,withDot:Z})},Q2=fQ(kQ);import{jsx as X5,jsxs as xQ}from"react/jsx-runtime";var DQ=({gridType:Q="day",days:q,resourceId:J,resource:$,"data-testid":X,positionedEvents:Z,dayNumberHeight:P=A5})=>{let{eventHeight:K,eventSpacing:L,resources:z}=R(),V=q.at(0)?.startOf("day"),A=!J||z?.at(0)?.id===J,_=q.at(0),B=q.at(-1)?.add(1,Q),M=Q==="hour"&&Boolean(_&&B);return xQ("div",{className:"absolute inset-0 pointer-events-none z-10 overflow-clip","data-testid":X,children:[M&&_&&B&&X5(Q2,{axis:"horizontal",rangeEnd:B,rangeStart:_,resource:$,withDot:A}),Z.map((Y)=>{let{event:N,row:O}=Y,T=P+L+O*(K+L),S=`${N.id}-${O}-${V?.toISOString()}-${J??"no-resource"}`;return X5("div",{className:"absolute z-10 pointer-events-auto overflow-clip","data-left":Y.left,"data-testid":F.container.horizontal.event(N.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:X5(p0,{className:"h-full w-full shadow",elementId:S,event:N,isTruncatedEnd:Y.isTruncatedEnd,isTruncatedStart:Y.isTruncatedStart})},F.listKey(S,"wrapper"))})]})},Z5=hQ(DQ);import{jsx as i,jsxs as P5}from"react/jsx-runtime";var mQ=({id:Q,resource:q,gridType:J="day",variant:$="resource",dayNumberHeight:X,className:Z,columns:P=[],allDay:K,showDayNumber:L=!1})=>{let{renderResource:z}=R(),V=$==="resource",A=P.some((Y)=>Y.days),_=EQ(()=>{if(A)return[];return P.map((Y)=>Y.day).filter((Y)=>Boolean(Y))},[P,A]),{positionedEvents:B,dayEventsMap:M}=q5({days:_,gridType:J,resourceId:q?.id,allDay:K});return P5("div",{className:G("flex flex-1 relative min-w-0",Z),"data-testid":F.container.horizontal.row(Q),children:[V&&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})}),P5("div",{className:"relative flex-1 flex min-w-0",children:[i("div",{className:"flex w-full min-w-0 gap-px bg-border",children:P.map((Y)=>{if(Y.days)return i(pQ,{allDay:K,col:Y,dayNumberHeight:X,gridType:J,id:Q,resource:q,resourceId:q?.id,showDayNumber:L},Y.id);return Y.day?i($5,{allDay:K,className:G("flex-1 w-20",Y.className),day:Y.day,gridType:J,hour:J==="hour"?Y.day.hour():void 0,precomputedEvents:M.get(D(Y.day)),resourceId:q?.id,showDayNumber:L},Y.day.toISOString()):null})}),!A&&i("div",{className:"absolute inset-0 z-10 pointer-events-none",children:i(Z5,{"data-testid":F.container.eventsLayer("horizontal",Q),dayNumberHeight:X,days:_,gridType:J,positionedEvents:B,resource:q,resourceId:q?.id})})]})]})},pQ=q2(({col:Q,gridType:q="day",allDay:J,resource:$,resourceId:X,dayNumberHeight:Z,showDayNumber:P,id:K})=>{let L=Q.days??[],{positionedEvents:z}=q5({days:L,gridType:q,resourceId:X,allDay:J});return P5("div",{className:"flex relative w-full",children:[i("div",{className:"flex w-full gap-px bg-border",children:L.map((V)=>i($5,{allDay:J,className:G("flex-1 w-20",Q.className),day:V,gridType:q,hour:q==="hour"?V.hour():void 0,resourceId:X,showDayNumber:P},V.toISOString()))}),i("div",{className:"absolute inset-0 z-10 pointer-events-none",children:i(Z5,{"data-testid":F.container.eventsLayer("horizontal",K),dayNumberHeight:Z,days:L,gridType:q,positionedEvents:z,resource:$,resourceId:X})})]})}),J2=q2(mQ);import{jsx as $2,jsxs as yQ}from"react/jsx-runtime";var gQ=({days:Q,classes:q,resource:J,showSpacer:$=!0})=>{let X=Q.map((Z,P)=>({id:F.col.allDay(Z,P),day:Z,gridType:"day",className:G("h-full min-h-12 bg-background",q?.cell)}));return yQ("div",{className:G("flex w-full gap-px bg-border",q?.row),"data-testid":"all-day-row",children:[$&&$2(m0,{className:q?.spacer}),$2(J2,{allDay:!0,className:"flex-1 min-h-fit",columns:X,dayNumberHeight:0,gridType:"day",id:F.allDayRow(J?.id),resource:J,variant:"regular"})]})},X2=vQ(gQ);import{jsx as G0,jsxs as Z2}from"react/jsx-runtime";var p="min-w-20 flex-1",Y0=({resources:Q,days:q,gridType:J,cellClassName:$})=>{let X=q.map((Z)=>{let P=Array.isArray(Z),K=P?Z.at(0):Z;return{id:K?F.col.day(K):"day-col-unknown",day:P?void 0:Z,days:P?Z:void 0,className:$,gridType:J}});return Q.map((Z)=>({id:String(Z.id),resource:Z,columns:X}))},K0=({resources:Q,gutter:q,columnsFor:J})=>[q,...Q.flatMap(($)=>{let X=J($);return(Array.isArray(X)?X:[X]).map((P)=>({...P,resource:$}))})],y0=({resources:Q})=>Z2("div",{className:"flex gap-px bg-border h-12 flex-1","data-testid":F.header.resource.columnsHeader,children:[G0("div",{className:G("shrink-0 sticky top-0 left-0 bg-background z-20",P0,u)}),Q.map((q)=>G0(B0,{className:G(p,"bg-background"),resource:q},F.listKey("resource-cell",q.id)))]}),F0=()=>{let{t:Q}=R((q)=>({t:q.t}));return G0("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:G0("div",{className:"text-sm truncate px-1 min-w-0",children:Q("resources")})})},MJ=({columns:Q})=>{let q=[],J=new Map;for(let $ of Q){if(!$.resource||$.noEvents||!$.day)continue;let X=J.get($.resource.id);if(!X)X={resource:$.resource,days:[],seenDayKeys:new Set},J.set($.resource.id,X),q.push(X);let Z=D($.day);if(!X.seenDayKeys.has(Z))X.seenDayKeys.add(Z),X.days.push($.day)}return Z2("div",{className:"flex w-full gap-px bg-border",children:[G0(m0,{}),q.map(({resource:$,days:X})=>G0(X2,{classes:{cell:G("min-w-20",X.length>1&&"flex-1")},days:X,resource:$,showSpacer:!1},F.allDayRow($.id)))]})};import{jsx as Y5}from"react/jsx-runtime";var c0=({hours:Q,view:q,delayStep:J})=>Y5("div",{className:G("flex gap-px bg-border border-b",w0),children:Q.map(($,X)=>{let Z=$.isSame(f(),"hour"),P=$.format("HH"),K=F.header.week.hour($,X);return Y5(k,{className:G(p,"bg-background flex items-center justify-center text-xs shrink-0",Z&&"bg-blue-50 text-blue-600 font-medium"),"data-hour":P,"data-testid":F.header.resource.timeLabel(q,P),delay:X*J,transitionKey:F.listKey(K,"motion"),children:Y5(f0,{date:$})},F.listKey(K,"animated"))})});import{jsx as $0,jsxs as K2,Fragment as dQ}from"react/jsx-runtime";var lQ=({date:Q})=>{let{t:q}=R(($)=>({t:$.t})),J=h(Q);return $0("div",{className:"flex flex-1 justify-center items-center min-h-12","data-testid":"day-view-header",children:K2(k,{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&&$0("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")})]})})},P2=(Q,q)=>E0({referenceDate:Q,businessHours:q.businessHours,hideNonBusinessHours:q.hideNonBusinessHours,allDates:[Q],resourceBusinessHours:x0(q.resources??[])}),uQ=({date:Q,config:q})=>{let J=P2(Q,q);return K2(dQ,{children:[$0(F0,{}),$0("div",{className:"flex-1 flex flex-col",children:$0(c0,{delayStep:E,hours:J,view:"day"})})]})},iQ=(Q,q)=>{let J=q.resources??[],$=P2(Q,q);if(!J.length)return[Q0({days:$,gridType:"hour"}),{id:F.col.day(Q),day:Q,days:$,className:G(h5,"flex-1"),gridType:"hour"}];if(q.orientation==="vertical")return K0({resources:J,gutter:Q0({days:$,gridType:"hour"}),columnsFor:(X)=>({id:F.col.day(Q,X.id),days:$,day:Q,gridType:"hour"})});return Y0({resources:J,days:$,gridType:"hour",cellClassName:p})},Y2={name:"day",label:"day",icon:cQ,navigationUnit:"day",layout:"vertical",supportsResources:!0,range:(Q)=>({start:Q.startOf("day"),end:Q.endOf("day")}),columns:iQ,renderHeader:({date:Q,config:q})=>{let J=q.resources??[];if(!J.length)return $0(lQ,{date:Q});if(q.orientation==="vertical")return $0(y0,{resources:J});return $0(uQ,{config:q,date:Q})}};import{Grid3x3 as oQ}from"lucide-react";import{jsx as K5}from"react/jsx-runtime";var z2=({className:Q})=>{let{firstDayOfWeek:q,stickyViewHeader:J,viewHeaderClassName:$,currentDate:X}=R(),Z=m(X,q);return K5("div",{className:G("flex w-full gap-px bg-border border-b",J&&"sticky top-0 z-20",$,Q),"data-testid":"month-header",children:Z.map((P,K)=>K5(k,{className:"py-2 text-center font-medium bg-background flex-1 min-w-0","data-testid":F.header.weekday("month",P.format("ddd")),delay:K*E,transitionKey:P.toISOString(),children:K5("span",{className:"text-sm capitalize truncate w-full block",children:P.format("ddd")})},P.toISOString()))})};import{jsx as X0,jsxs as tQ,Fragment as sQ}from"react/jsx-runtime";var rQ=(Q,q)=>{let J=k0(Q);return K0({resources:q,gutter:Q0({days:J,gridType:"day",renderLabel:($)=>X0(c,{className:"flex-col-reverse",dayNumber:$.format("D"),today:h($),weekday:$.format("ddd")})}),columnsFor:($)=>({id:F.col.resource("month",$.id),day:void 0,days:J,gridType:"day"})})},nQ=({date:Q})=>{let q=k0(Q);return tQ(sQ,{children:[X0(F0,{}),X0("div",{className:"flex flex-1 gap-px bg-border border-b",children:q.map((J,$)=>{let X=F.header.resource.monthDay(J),Z=h(J);return X0(k,{className:"flex-1 w-20 bg-background shrink-0 flex items-center justify-center flex-col",delay:$*E,transitionKey:F.listKey(X,"motion"),children:X0(c,{className:"flex-col-reverse",dayNumber:J.format("D"),today:Z,weekday:J.format("ddd")})},F.listKey(X,"animated"))})})]})},aQ=(Q,q)=>{let J=q.resources??[];if(J.length){if(q.orientation==="vertical")return rQ(Q,J);return Y0({resources:J,days:k0(Q),gridType:"day"})}return a0(Q,q.firstDayOfWeek).map(($,X)=>({id:F.listKey("week",X),columns:$.map((Z)=>({id:F.col.day(Z),day:Z,className:"w-auto",gridType:"day"})),className:"flex-1",showDayNumber:!0}))},L2={name:"month",label:"month",icon:oQ,navigationUnit:"month",layout:"horizontal",supportsResources:!0,range:(Q,q)=>C0(Q,q.firstDayOfWeek),columns:aQ,renderHeader:({date:Q,config:q})=>{let J=q.resources??[];if(!J.length)return X0(z2,{className:"h-12"});if(q.orientation==="vertical")return X0(y0,{resources:J});return X0(nQ,{date:Q})}};import{Columns3 as Q9}from"lucide-react";import{jsx as l0}from"react/jsx-runtime";var B2=({days:Q})=>{let{weekViewGranularity:q}=R(),J=q==="hourly";return l0("div",{className:G("flex gap-px bg-border border-b",w0),children:Q.map(($,X)=>{let Z=h($),P=F.header.week.day($);return l0(k,{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:X*E,transitionKey:F.listKey(P,"motion"),children:l0("div",{className:G(J?"sticky left-1/2":"w-full text-center"),children:l0(c,{dayNumber:$.format("D"),today:Z,weekday:$.format("ddd")})})},F.listKey(P,"animated"))})})};import{jsx as u0,jsxs as eQ}from"react/jsx-runtime";var G2=({columns:Q})=>{let{currentDate:q}=R();return eQ("div",{className:"flex h-12 gap-px bg-border",children:[u0("div",{className:G("shrink-0 z-20 bg-background sticky left-0",P0,u),children:u0("span",{className:"px-2 h-full w-full flex justify-center items-start font-medium",children:q.week()})}),Q.map((J,$)=>{let X=J.day;if(!X)return null;let Z=h(X),P=F.header.week.hour(X,J.resourceId??"");return u0(k,{className:G(p,"flex flex-col items-center justify-center text-xs shrink-0 bg-background"),"data-testid":F.header.resource.timeLabel("week",X.format("HH")),delay:$*E,transitionKey:F.listKey(P,"motion"),children:u0(c,{dayNumber:X.format("D"),today:Z,weekday:X.format("ddd")})},F.listKey(P,"animated"))})]})};import{jsx as N0,jsxs as F2}from"react/jsx-runtime";var U2=({resources:Q})=>{let{weekViewGranularity:q,t:J,currentDate:$}=R(),X=q==="hourly";return F2("div",{className:"flex h-12 gap-px bg-border",children:[N0("div",{className:G("shrink-0 z-20 bg-background sticky left-0",P0,u),children:F2("span",{className:G("px-2 h-full w-full flex flex-col justify-center text-xs text-muted-foreground text-center min-w-0",X?"justify-end":"justify-center"),children:[N0("span",{className:"truncate w-full",children:J("week")}),!X&&N0("span",{className:"font-medium text-foreground truncate w-full",children:$.week()})]})}),Q.map((Z)=>{return N0(B0,{className:G(p,"bg-background border-b"),resource:Z,children:N0("div",{className:G("sticky text-sm font-medium truncate",X?"left-1/4":"left-1"),children:Z.title})},F.listKey("resource-cell",Z.id))})]})};import{jsx as v,jsxs as M0,Fragment as Y9}from"react/jsx-runtime";var i0=(Q,q)=>{let J=m(Q,q.firstDayOfWeek),{hiddenDays:$}=q;if(!$)return J;return J.filter((X)=>!$.has(X.day()))},d0=(Q)=>(Q.weekViewGranularity??"hourly")==="hourly",q9=({date:Q,config:q})=>{let{t:J,selectDate:$,openEventForm:X}=R((P)=>({t:P.t,selectDate:P.selectDate,openEventForm:P.openEventForm})),Z=i0(Q,q);return M0("div",{className:"flex h-18 flex-1 gap-px bg-border","data-testid":"week-view-header",children:[v("div",{className:G(s0,"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:[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()})]})}),Z.map((P,K)=>{let L=h(P),z=F.header.week.day(P);return v(k,{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",P.format("dddd")),delay:K*E,onClick:()=>{$(P),X({start:P})},transitionKey:z,children:v(c,{dayNumber:P.format("D"),today:L,weekday:P.format("ddd")})},z)})]})},U0=(Q,q,J)=>E0({referenceDate:Q,businessHours:q.businessHours,hideNonBusinessHours:q.hideNonBusinessHours,allDates:J,resourceBusinessHours:x0(q.resources??[])}),J9=(Q,q,J)=>{let $=m(Q,q.firstDayOfWeek);if(d0(q)){let X=i0(Q,q);return K0({resources:J,gutter:Q0({days:U0(Q,q,$),gridType:"hour"}),columnsFor:(Z)=>X.map((P)=>({id:F.col.day(P,Z.id),className:p,day:P,days:U0(P,q,$),gridType:"hour"}))})}return K0({resources:J,gutter:Q0({days:$,gridType:"day",renderLabel:(X)=>v(c,{dayNumber:X.format("D"),today:h(X),weekday:X.format("ddd")})}),columnsFor:(X)=>({id:F.col.resource("week",X.id),className:p,day:void 0,days:$,gridType:"day"})})},$9=(Q,q,J)=>{let $=m(Q,q.firstDayOfWeek);if(d0(q)){let X=$.map((Z)=>U0(Z,q));return Y0({resources:J,days:X,gridType:"hour",cellClassName:p})}return Y0({resources:J,days:$,gridType:"day",cellClassName:p})},X9=({date:Q,config:q,resources:J})=>{let $=i0(Q,q),X=d0(q),Z=X?J.flatMap((P)=>$.map((K)=>({day:K,resourceId:P.id}))):[];return M0("div",{className:"flex-1 flex flex-col",children:[v(U2,{resources:J}),X&&v(G2,{columns:Z})]})},Z9=({date:Q,config:q})=>{let J=m(Q,q.firstDayOfWeek),$=d0(q),X=$?J.flatMap((Z)=>U0(Z,q)):[];return M0(Y9,{children:[v(F0,{}),M0("div",{className:"flex-1 flex flex-col",children:[v(B2,{days:J}),$&&v(c0,{delayStep:M5,hours:X,view:"week"})]})]})},P9=(Q,q)=>{let J=q.resources??[];if(J.length){if(q.orientation==="vertical")return J9(Q,q,J);return $9(Q,q,J)}let $=m(Q,q.firstDayOfWeek),X=i0(Q,q);return[Q0({days:U0(Q,q,$),gridType:"hour",widthClassName:s0}),...X.map((Z)=>({id:F.col.day(Z),day:Z,days:U0(Z,q,$),className:"flex-1 min-w-0",gridType:"hour"}))]},V2={name:"week",label:"week",icon:Q9,navigationUnit:"week",layout:"vertical",supportsResources:!0,range:(Q,q)=>{let J=m(Q,q.firstDayOfWeek),$=J.at(0)??Q,X=J.at(-1)??Q;return{start:$.startOf("day"),end:X.endOf("day")}},columns:P9,renderHeader:({date:Q,config:q})=>{let J=q.resources??[];if(!J.length)return v(q9,{config:q,date:Q});if(q.orientation==="vertical")return v(X9,{config:q,date:Q,resources:J});return v(Z9,{config:q,date:Q,resources:J})}};import{Grid2x2 as B9}from"lucide-react";import*as n from"@radix-ui/react-scroll-area";import{jsx as S0,jsxs as K9}from"react/jsx-runtime";function A2({className:Q,children:q,viewPortProps:J,...$}){return K9(n.Root,{className:G("relative",Q),"data-slot":"scroll-area",...$,children:[S0(n.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}),S0(z5,{}),S0(n.Corner,{})]})}function z5({className:Q,orientation:q="vertical",...J}){return S0(n.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:S0(n.ScrollAreaThumb,{className:"bg-border relative flex-1 rounded-full","data-slot":"scroll-area-thumb"})})}import{jsx as Z0,jsxs as R0}from"react/jsx-runtime";var z9=["bg-primary","bg-blue-500","bg-green-500"],L9=42,W2=()=>{let{currentDate:Q,setView:q,getEventsForDateRange:J,t:$,firstDayOfWeek:X}=R(),Z=Q.year(),P=m(f(),X).map((Y)=>({id:Y.day().toString(),label:Y.format("dd")})),K=()=>{return Array.from({length:12},(Y,N)=>{let O=f().year(Z).month(N).startOf("month"),T=J(O,O.endOf("month"));return{date:O,name:O.format("MMMM"),eventCount:T.length,monthKey:O.format("MM")}})},L=(Y)=>{let N=Y.startOf("month"),O=m(N,X).at(0)??N;return Array.from({length:L9},(T,S)=>{let b=O.add(S,"day"),U=b.startOf("day"),W=b.endOf("day"),H=J(U,W);return{date:b,dayKey:D(b),isInCurrentMonth:b.month()===Y.month(),isToday:h(b),isSelected:b.isSame(Q,"day"),eventCount:H.length}})},z=(Y,N,O)=>{O?.stopPropagation(),q(N,Y)},V=(Y)=>{let N=Y===1?$("event"):$("events");return`${Y} ${N}`},A=(Y)=>{let O=Y.isInCurrentMonth?"":"text-muted-foreground opacity-50",T=Y.isToday?"bg-primary text-primary-foreground rounded-full":"",S=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",O,T,S,b)},_=(Y,N)=>{return G("h-[3px] w-[3px] rounded-full",N?"bg-primary-foreground":Y)},B=K(),M=(Y)=>{if(Y===0)return"";return V(Y)};return R0(A2,{className:"h-full","data-testid":"year-view",children:[Z0("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:B.map((Y,N)=>{let O=L(Y.date),T=N*E;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":F.header.year.month(Y.monthKey),children:[R0(k,{className:"mb-2 flex items-center justify-between",delay:T,transitionKey:F.listKey("month",Y.monthKey),children:[Z0("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&&Z0("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:V(Y.eventCount)})]},F.listKey("month",Y.monthKey)),R0("div",{className:"grid grid-cols-7 gap-px text-[0.6rem]","data-testid":F.header.year.month(Y.monthKey,"mini"),children:[P.map((S)=>Z0("div",{className:"text-muted-foreground h-3 text-center",children:S.label},F.listKey("header",Y.monthKey,S.id))),O.map((S)=>{let b=F.header.year.day(Y.date.format("YYYY-MM"),S.dayKey),U=S.eventCount>0,W=Math.min(S.eventCount,3),H=z9.slice(0,W);return R0("button",{className:A(S),"data-testid":b,onClick:(I)=>z(S.date,"day",I),title:M(S.eventCount),type:"button",children:[Z0("span",{className:"text-center leading-none",children:S.date.date()}),U&&Z0("div",{className:G("absolute bottom-0 flex w-full justify-center space-x-px",S.isToday&&"bottom-px"),children:H.map((I)=>Z0("span",{className:_(I,S.isToday)},I))})]},S.dayKey)})]})]},Y.monthKey)})}),Z0(z5,{className:"z-30"})]})};var _2={name:"year",label:"year",icon:B9,navigationUnit:"year",supportsResources:!1,range:(Q)=>({start:Q.startOf("year"),end:Q.endOf("year")}),component:W2};var O2=[Y2,V2,L2,_2];var N2=(Q,q,J)=>q?.range?.(Q,{firstDayOfWeek:J})??C0(Q,J),M2=({initialDate:Q,initialView:q,firstDayOfWeek:J,onDateChange:$,onViewChange:X,pluginRuntime:Z})=>{let[P,K]=U9(()=>({date:f.isDayjs(Q)?Q:f(Q),view:q})),L=F9(P),z=l((U)=>{let W={...L.current,...U};return L.current=W,K(W),W},[]),V=l(()=>[...O2,...Z.getViews()],[Z]),A=l((U)=>V().find((W)=>W.name===U),[V]),_=l(()=>{return N2(P.date,A(P.view),J)},[P,J,A]),B=l((U)=>{let W=N2(U.date,A(U.view),J);$?.(U.date,W)},[$,J,A]),M=l((U)=>{B(z({date:U}))},[z,B]),Y=l((U)=>{let{date:W,view:H}=L.current,I=A(H),w=I?.navigationStep??{amount:1,unit:I?.navigationUnit??"day"},C=W.add(U*w.amount,w.unit);B(z({date:C}))},[z,B,A]),N=l(()=>Y(1),[Y]),O=l(()=>Y(-1),[Y]),T=l(()=>B(z({date:f()})),[z,B]),S=l((U,W)=>{let H=z(W?{view:U,date:W}:{view:U});X?.(U),B(H)},[z,X,B]),b=l((U)=>{let W=typeof U==="function"?U(L.current.date):U;z({date:W})},[z]);return G9(()=>({currentDate:P.date,setCurrentDate:b,view:P.view,setView:S,selectDate:M,nextPeriod:N,prevPeriod:O,today:T,getCurrentViewRange:_,getAllViews:V}),[P,b,S,M,N,O,T,_,V])};import{createElement as V9,Fragment as A9}from"react";var S2=(Q)=>({transformEvents:(q,J)=>{return Q.reduce((X,Z)=>Z.transformEvents?Z.transformEvents(X,J):X,q).filter((X)=>j0(X,J.start,J.end))},getEventManager:(q)=>Q.find((J)=>J.managesEvent?.(q)),collect:(q,J)=>Q.flatMap(($)=>$.contribute?.(q,J)??[]),renderSlot:(q,J)=>{let $=[];for(let X of Q){let Z=X.renderSlot?.(q,J);if(Z!==null&&Z!==void 0)$.push(V9(A9,{key:X.name},Z))}return $},getViews:()=>Q.flatMap((q)=>q.views??[]),getProviders:()=>Q.map((q)=>q.provider).filter((q)=>Boolean(q))});var W9=[],_9=[],T2=(Q)=>{let{events:q,firstDayOfWeek:J=0,initialView:$="month",initialDate:X=f(),dayMaxEvents:Z,businessHours:P,onEventAdd:K,onEventUpdate:L,onEventDelete:z,onDateChange:V,onViewChange:A,locale:_,timezone:B,translations:M,translator:Y,onEventClick:N,onCellClick:O,disableEventClick:T,disableCellClick:S,resources:b,orientation:U,weekViewGranularity:W}=Q,{plugins:H=_9}=Q,I=R5({firstDayOfWeek:J,dayMaxEvents:Z,businessHours:P,locale:_,translations:M,translator:Y,resources:b,orientation:U,weekViewGranularity:W}),w=H2(()=>S2(H),[H]),C=M2({initialDate:X,initialView:$,firstDayOfWeek:J,onDateChange:V,onViewChange:A,pluginRuntime:w}),a=b5({events:q,pluginRuntime:w,getCurrentViewRange:C.getCurrentViewRange,resources:I.resources??W9,onEventAdd:K,onEventUpdate:L,onEventDelete:z}),s=w5({currentDate:C.currentDate,t:I.t,disableEventClick:T,disableCellClick:S,onEventClick:N,onCellClick:O}),{setCurrentLocale:t}=I,{setCurrentDate:d}=C,{setCurrentEvents:q0}=a,j=I2(void 0);R2(()=>{if(_&&_!==j.current)t(_),f.locale(_),d((e)=>e.locale(_)),j.current=_},[_,t,d]);let y=I2(B);return R2(()=>{if(B&&B!==y.current)f.tz.setDefault(B),d((e)=>e.tz(B)),q0((e)=>e.map((J0)=>({...J0,start:J0.start.tz(B),end:J0.end.tz(B)}))),y.current=B},[B,d,q0]),H2(()=>{let{setCurrentLocale:e,...J0}=I,{getCurrentViewRange:o0,getAllViews:H0,...I0}=C,{setCurrentEvents:r0,...T0}=a;return{...J0,...I0,...T0,...s,getViews:H0,getEventManager:w.getEventManager,renderSlot:w.renderSlot,collect:w.collect,getProviders:w.getProviders,getEventResourceIds:V0,currentRange:C.getCurrentViewRange()}},[I,C,a,s,w])};import{jsx as O9}from"react/jsx-runtime";var b2=(Q,q)=>Q.reduceRight((J,$,X)=>O9($,{children:J},X),q);import{jsx as R9}from"react/jsx-runtime";var M9=[],S9=(Q)=>{let{events:q=M9,firstDayOfWeek:J=0,initialView:$="month",initialDate:X,renderEvent:Z,onEventClick:P,onCellClick:K,isCellDisabled:L,getCellClassName:z,onViewChange:V,onEventAdd:A,onEventUpdate:_,onEventDelete:B,onDateChange:M,locale:Y,timezone:N,disableCellClick:O,disableEventClick:T,disableDragAndDrop:S,dayMaxEvents:b,eventSpacing:U=V5,eventHeight:W=W5,stickyViewHeader:H=!0,viewHeaderClassName:I="",headerComponent:w,headerClassName:C,businessHours:a,renderEventForm:s,onMoreEventsClick:t,translations:d,translator:q0,timeFormat:j="12-hour",classesOverride:y,renderCurrentTimeIndicator:e,renderHour:J0,hideNonBusinessHours:o0=!1,hideExportButton:H0=!1,hiddenDays:I0,slotDuration:r0=60,scrollTime:T0,plugins:w2,resources:j2,renderResource:L5,orientation:f2,weekViewGranularity:k2}=Q,B5=T2({events:q,firstDayOfWeek:J,initialView:$,initialDate:X,dayMaxEvents:b,businessHours:a,onEventAdd:A,onEventUpdate:_,onEventDelete:B,onDateChange:M,onViewChange:V,locale:Y,timezone:N,translations:d,translator:q0,plugins:w2,onEventClick:P,onCellClick:K,disableEventClick:T,disableCellClick:O,resources:j2,orientation:f2,weekViewGranularity:k2});return N9(()=>{let{handleEventClick:C2,handleDateClick:h2,...D2}=B5;return{...D2,renderEvent:Z,onEventClick:C2,onCellClick:h2,isCellDisabled:L,getCellClassName:z,locale:Y,timezone:N,disableCellClick:O,disableEventClick:T,disableDragAndDrop:S,eventSpacing:U,eventHeight:W,stickyViewHeader:H,viewHeaderClassName:I,headerComponent:w,headerClassName:C,renderEventForm:s,onMoreEventsClick:t,timeFormat:j,classesOverride:y,renderCurrentTimeIndicator:e,renderHour:J0,hideNonBusinessHours:o0,hideExportButton:H0,hiddenDays:I0,slotDuration:r0,scrollTime:T0,renderResource:L5}},[B5,Z,L5,L,z,Y,N,O,T,S,U,W,H,I,w,C,s,t,j,y,e,J0,o0,H0,I0,r0,T0])},o$=({children:Q,...q})=>{let J=S9(q),$=b2(J.getProviders(),Q);return R9(b0.Provider,{value:J,children:$})};
|
|
2
|
+
export{f as a,R as b,g9 as c,G as d,k as e,y5 as f,c5 as g,l5 as h,dq as i,u5 as j,oq as k,A2 as l,z5 as m,h as n,m as o,a0 as p,F as q,g5 as r,V5 as s,W5 as t,N5 as u,l9 as v,t0 as w,x5 as x,z0 as y,p0 as z,$5 as A,Q2 as B,J2 as C,s0 as D,X2 as E,MJ as F,U5 as G,o$ as H};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import t from"dayjs";import O from"dayjs/plugin/isBetween.js";import c from"dayjs/plugin/isSameOrAfter.js";import z from"dayjs/plugin/isSameOrBefore.js";import v from"dayjs/plugin/localeData.js";import D from"dayjs/plugin/localizedFormat.js";import Y from"dayjs/plugin/minMax.js";import M from"dayjs/plugin/timezone.js";import $ from"dayjs/plugin/utc.js";import b from"dayjs/plugin/weekday.js";import h from"dayjs/plugin/weekOfYear.js";var i,J=(n,a,f)=>{let m=a.prototype,x=f.tz.setDefault;f.tz.setDefault=(r)=>{return i=r,x(r)};let{startOf:d,endOf:s}=m;function u(r,e){let o=r.$x?.$timezone||i;if(!o)return e;let l=f.tz(e.format("YYYY-MM-DDTHH:mm:ss"),o).utcOffset();if(e.utcOffset()!==l)return e.tz(o,!0);return e}m.startOf=function(r,e){let o=d.call(this,r,e);return u(this,o)},m.endOf=s};t.extend(b);t.extend(h);t.extend(c);t.extend(z);t.extend(O);t.extend(Y);t.extend(M);t.extend($);t.extend(v);t.extend(D);t.extend(J);var p=(...n)=>{return t.tz(...n)};Object.assign(p,t);var g=p;
|
|
2
|
+
export{g as L};
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -65,15 +65,19 @@ interface BusinessHours {
|
|
|
65
65
|
*/
|
|
66
66
|
daysOfWeek?: WeekDays[];
|
|
67
67
|
/**
|
|
68
|
-
* Start time for business hours
|
|
68
|
+
* Start time for business hours: a whole 24-hour number (0-24) or an
|
|
69
|
+
* 'HH:mm' string for sub-hour boundaries (e.g. '09:15'). Fractional
|
|
70
|
+
* numbers round to the nearest hour — use a string for sub-hour precision.
|
|
69
71
|
* @default 9
|
|
70
72
|
*/
|
|
71
|
-
startTime?: number;
|
|
73
|
+
startTime?: number | string;
|
|
72
74
|
/**
|
|
73
|
-
* End time for business hours
|
|
75
|
+
* End time for business hours: a whole 24-hour number (0-24) or an
|
|
76
|
+
* 'HH:mm' string for sub-hour boundaries (e.g. '17:15'). Fractional
|
|
77
|
+
* numbers round to the nearest hour — use a string for sub-hour precision.
|
|
74
78
|
* @default 17
|
|
75
79
|
*/
|
|
76
|
-
endTime?: number;
|
|
80
|
+
endTime?: number | string;
|
|
77
81
|
}
|
|
78
82
|
/**
|
|
79
83
|
* Resource interface representing a calendar resource (person, room, equipment, etc.)
|
package/dist/testing/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{H as b}from"../shared/chunk-
|
|
1
|
+
import{H as b}from"../shared/chunk-7v2pzs62.js";import"../shared/chunk-7vqv0k0j.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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ilamy/calendar",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "A full-featured React calendar component library built with Shadcn-Ui, Tailwind CSS, and TypeScript.",
|
|
5
5
|
"author": "Sujeet Kc",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"shadcn",
|
|
22
22
|
"radix-ui",
|
|
23
23
|
"dnd-kit",
|
|
24
|
-
"motion",
|
|
25
24
|
"events",
|
|
26
25
|
"scheduling",
|
|
27
26
|
"drag-and-drop",
|
|
@@ -93,7 +92,6 @@
|
|
|
93
92
|
"class-variance-authority": "^0.7.1",
|
|
94
93
|
"clsx": "^2.1.1",
|
|
95
94
|
"lucide-react": "^0.475.0",
|
|
96
|
-
"motion": "^12.36.0",
|
|
97
95
|
"rrule": "^2.8.1",
|
|
98
96
|
"tailwind-merge": "^3.5.0"
|
|
99
97
|
},
|
|
@@ -1,2 +0,0 @@
|
|
|
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};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import t from"dayjs";import z from"dayjs/plugin/isBetween.js";import O from"dayjs/plugin/isSameOrAfter.js";import c from"dayjs/plugin/isSameOrBefore.js";import Y from"dayjs/plugin/localeData.js";import D from"dayjs/plugin/localizedFormat.js";import h from"dayjs/plugin/minMax.js";import H from"dayjs/plugin/timezone.js";import M from"dayjs/plugin/utc.js";import $ from"dayjs/plugin/weekday.js";import b from"dayjs/plugin/weekOfYear.js";var i,v=(n,a,f)=>{let m=a.prototype,d=f.tz.setDefault;f.tz.setDefault=(r)=>{return i=r,d(r)};let{startOf:s,endOf:x}=m;function u(r,e){let o=r.$x?.$timezone||i;if(!o)return e;let l=f.tz(e.format("YYYY-MM-DDTHH:mm:ss"),o).utcOffset();if(e.utcOffset()!==l)return e.tz(o,!0);return e}m.startOf=function(r,e){let o=s.call(this,r,e);return u(this,o)},m.endOf=x};t.extend($);t.extend(b);t.extend(O);t.extend(c);t.extend(z);t.extend(h);t.extend(H);t.extend(M);t.extend(Y);t.extend(D);t.extend(v);var p=(...n)=>{return t.tz(...n)};Object.assign(p,t);var G=p;
|
|
2
|
-
export{G as L};
|