@ilamy/calendar 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/dist/index.js +1 -1
- package/dist/shared/chunk-b53nxddz.js +2 -0
- package/dist/testing/index.js +1 -1
- package/package.json +1 -1
- package/dist/shared/chunk-7v2pzs62.js +0 -2
package/README.md
CHANGED
|
@@ -13,6 +13,14 @@ A powerful, full-featured yet **lightweight and highly pluggable** React calenda
|
|
|
13
13
|
|
|
14
14
|
---
|
|
15
15
|
|
|
16
|
+
## Support
|
|
17
|
+
|
|
18
|
+
ilamy Calendar is free and open source. If you'd like to support its development:
|
|
19
|
+
|
|
20
|
+
<a href="https://ko-fi.com/kcsujeet" target="_blank"><img src="https://ko-fi.com/img/githubbutton_sm.svg" alt="Buy me a coffee at ko-fi.com" style="height: 50px;" /></a>
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
16
24
|
## Features
|
|
17
25
|
|
|
18
26
|
### Core Views
|
|
@@ -150,14 +158,6 @@ For comprehensive guides, API references, and interactive demos, visit [ilamy.de
|
|
|
150
158
|
|
|
151
159
|
---
|
|
152
160
|
|
|
153
|
-
## Support
|
|
154
|
-
|
|
155
|
-
ilamy Calendar is free and open source. If you'd like to support its development:
|
|
156
|
-
|
|
157
|
-
<a href="https://ko-fi.com/kcsujeet" target="_blank"><img src="https://ko-fi.com/img/githubbutton_sm.svg" alt="Buy me a coffee at ko-fi.com" style="height: 50px;" /></a>
|
|
158
|
-
|
|
159
|
-
---
|
|
160
|
-
|
|
161
161
|
## License
|
|
162
162
|
|
|
163
163
|
MIT © [Sujeet Kc](https://github.com/kcsujeet)
|
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 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
|
|
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-b53nxddz.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
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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{L as a5}from"./chunk-7vqv0k0j.js";import v from"dayjs";import h2 from"dayjs/plugin/isBetween.js";import D2 from"dayjs/plugin/isSameOrAfter.js";import E2 from"dayjs/plugin/isSameOrBefore.js";import x2 from"dayjs/plugin/localeData.js";import m2 from"dayjs/plugin/localizedFormat.js";import p2 from"dayjs/plugin/minMax.js";import v2 from"dayjs/plugin/timezone.js";import g2 from"dayjs/plugin/utc.js";import y2 from"dayjs/plugin/weekday.js";import c2 from"dayjs/plugin/weekOfYear.js";var A5,l2=(Q,q,J)=>{let $=q.prototype,X=J.tz.setDefault;J.tz.setDefault=(z)=>{return A5=z,X(z)};let{startOf:Z,endOf:P}=$;function K(z,G){let _=z.$x?.$timezone||A5;if(!_)return G;let V=J.tz(G.format("YYYY-MM-DDTHH:mm:ss"),_).utcOffset();if(G.utcOffset()!==V)return G.tz(_,!0);return G}$.startOf=function(z,G){let _=Z.call(this,z,G);return K(this,_)},$.endOf=P};v.extend(y2);v.extend(c2);v.extend(D2);v.extend(E2);v.extend(h2);v.extend(p2);v.extend(v2);v.extend(g2);v.extend(x2);v.extend(m2);v.extend(l2);var L5=(...Q)=>{return v.tz(...Q)};Object.assign(L5,v);var f=L5;import{useContext as i2}from"react";import{createContext as u2}from"react";var b0=u2(void 0);var d2=[];function R(Q){let q=i2(b0);if(!q)throw Error("useSmartCalendarContext must be used within a CalendarProvider");return Q?Q(q):q}function p9(){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??d2,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 B5={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 O9}from"react";import{useEffect as M2,useMemo as R2,useRef as S2}from"react";import{useMemo as N5,useState as o2}from"react";var _5=1,F5=24,U5=24,V5=4,O5="bg-[color-mix(in_oklch,var(--background),var(--foreground)_3%)] text-muted-foreground pointer-events-none",W5={sunday:0,monday:1,tuesday:2,wednesday:3,thursday:4,friday:5,saturday:6},w0="h-12",y9="h-24";var M5=({firstDayOfWeek:Q,dayMaxEvents:q=V5,businessHours:J,locale:$,translations:X,translator:Z,resources:P,orientation:K="horizontal",weekViewGranularity:z="hourly"})=>{let[G,_]=o2($||"en"),V=N5(()=>{if(Z)return Z;let W=X||B5;return(A)=>W[A]||A},[X,Z]);return N5(()=>({firstDayOfWeek:Q,dayMaxEvents:q,businessHours:J,currentLocale:G,setCurrentLocale:_,t:V,resources:P,orientation:K,weekViewGranularity:z}),[Q,q,J,G,V,P,K,z])};import{useCallback as d,useEffect as r2,useMemo as R5,useRef as n2,useState as a2}from"react";var _0=(Q)=>{if(Q.resourceIds)return Q.resourceIds;if(Q.resourceId!==void 0)return[Q.resourceId];return[]};function K0(Q,q){return Q.filter((J)=>_0(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 S5=(Q)=>!Array.isArray(Q),H5=(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)},I5=({events:Q,pluginRuntime:q,getCurrentViewRange:J,resources:$,onEventAdd:X,onEventUpdate:Z,onEventDelete:P})=>{let[K,z]=a2(Q),G=n2(Q),_=d((B,O)=>q.transformEvents(K,{start:B,end:O}),[K,q]),V=R5(()=>{let{start:B,end:O}=J();return _(B,O)},[_,J]);r2(()=>{if(Q!==G.current)z(Q),G.current=Q},[Q]);let W=d((B)=>{z((O)=>[...O,B]),X?.(B)},[X]),A=d((B,O)=>{let S=K.find((w)=>w.id===B);if(!S)return;let b={...S,...O};z((w)=>w.map((C)=>C.id===B?b:C)),Z?.(b)},[K,Z]),M=d((B,O,S)=>{let b=q.getEventManager(B);if(!b?.applyEdit)return;let w=b.applyEdit({event:B,updates:O,currentEvents:K,scope:S});if(S5(w)){H5(w,{onEventUpdate:Z,onEventAdd:X,onEventDelete:P,setCurrentEvents:z});return}Z?.({...B,...O}),z(w)},[K,X,Z,P,q]),Y=d((B,O)=>{let S=q.getEventManager(B);if(!S?.applyDelete)return;let b=S.applyDelete({event:B,currentEvents:K,scope:O});if(S5(b)){H5(b,{onEventUpdate:Z,onEventAdd:X,onEventDelete:P,setCurrentEvents:z});return}P?.(B),z(b)},[K,X,Z,P,q]),N=d((B)=>{let O=K.find((S)=>S.id===B);if(!O)return;z((S)=>S.filter((b)=>b.id!==B)),P?.(O)},[K,P]),U=d((B)=>K0(V,B),[V]),H=d((B)=>V.filter((O)=>_0(O).some((S)=>B.includes(S))),[V]),I=d((B)=>{if(B===void 0)return;return $.find((O)=>O.id===B)},[$]),T=d((B)=>{return Boolean(B.resourceIds&&B.resourceIds.length>1)},[]);return R5(()=>({events:V,rawEvents:K,setCurrentEvents:z,getEventsForDateRange:_,addEvent:W,updateEvent:A,deleteEvent:N,applyScopedEdit:M,applyScopedDelete:Y,getEventsForResource:U,getEventsForResources:H,getResourceById:I,isEventCrossResource:T}),[V,K,_,W,A,N,M,Y,U,H,I,T])};import{useCallback as F0,useMemo as s2,useState as a0}from"react";var t2=(Q)=>Q,T5=({currentDate:Q,t:q,disableEventClick:J,disableCellClick:$,onEventClick:X,onCellClick:Z})=>{let[P,K]=a0(!1),[z,G]=a0(null),[_,V]=a0(null),W=F0((U={})=>{let{start:H,end:I,resourceId:T,resource:B,allDay:O}=U;if(H)V(H);let S=H??Q;G(t2({title:q("newEvent"),start:S,end:I??S.add(1,"hour"),resourceId:T??B?.id,description:"",allDay:O??!1})),K(!0)},[Q,q]),A=F0(()=>{V(null),G(null),K(!1)},[]),M=F0((U)=>{G(U),K(!0)},[]),Y=F0((U)=>{if(J)return;if(X)X(U);else M(U)},[J,X,M]),N=F0((U)=>{if($)return;if(Z)Z(U);else W(U)},[Z,$,W]);return s2(()=>({isEventFormOpen:P,selectedEvent:z,selectedDate:_,setIsEventFormOpen:K,setSelectedEvent:G,setSelectedDate:V,openEventForm:W,closeEventForm:A,handleEventClick:Y,handleDateClick:N}),[P,z,_,W,A,Y,N])};import{useCallback as c,useMemo as z9,useRef as A9,useState as L9}from"react";import{clsx as e2}from"clsx";import{twMerge as QQ}from"tailwind-merge";function L(...Q){return QQ(e2(Q))}import{Square as gQ}from"lucide-react";import{jsx as qQ}from"react/jsx-runtime";var k=({children:Q,transitionKey:q,delay:J=0,className:$,direction:X="vertical","data-testid":Z,ref:P,style:K,...z})=>{return qQ("div",{className:L("inline-block w-full animate-in fade-in fill-mode-backwards duration-500 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},...z,children:Q},q)};k.displayName="AnimatedSection";import{jsx as w5,Fragment as b5}from"react/jsx-runtime";var f0=({date:Q})=>{let{renderHour:q,timeFormat:J}=R();if(q)return w5(b5,{children:q(Q)});return w5(b5,{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 s0(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 j5({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=s0(Q,q),$=J.at(0)?.at(0)??Q,X=J.at(-1)?.at(-1)??Q;return{start:$.startOf("day"),end:X.endOf("day")}};var G0=(Q)=>String(Q).padStart(2,"0"),JQ=(Q)=>typeof Q==="number"?G0(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-${$}-${G0(q)}-${G0(J)}`:`day-cell-${$}`},verticalTime:(Q)=>`vertical-time-${G0(Q)}`,vertical:(Q,q,J,$)=>{let X=`vertical-cell-${D(Q)}-${G0(q)}-${G0(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-${JQ(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 f5}from"react/jsx-runtime";var Z0="w-16 min-w-16 max-w-16",k5="w-[calc(100%-4rem)]",t0="w-10 sm:w-16 min-w-10 sm:min-w-16 max-w-10 sm:max-w-16",l="shadow-[1px_0_0_0_color-mix(in_oklch,var(--background),var(--foreground)_10%)]",e=({days:Q,gridType:q,renderLabel:J,widthClassName:$=Z0})=>({id:q==="hour"?F.col.time:F.col.date,day:void 0,days:Q,className:L("shrink-0",$,"sticky left-0 bg-background z-20",l),gridType:q,noEvents:!0,renderCell:(X)=>f5("div",{className:"text-muted-foreground p-2 text-right text-[10px] sm:text-xs flex flex-col items-center",children:J?J(X):f5(f0,{date:X})})});var e0=(Q,q)=>{if(!q)return!0;let J=!1;return D0(q,{date:Q,onMatch:()=>{J=!0}}),J},$Q=/^(\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($Q);if(J){let $=Number(J[1]),X=Number(J[2]),Z=$*60+X<=1440;if(X<=59&&Z)return $*60+X}}return q*60},C5=({date:Q,hour:q,minute:J=0,durationMinutes:$,businessHours:X})=>{if(!X)return!0;if(q===void 0)return e0(Q,X);let Z=!1,P=q*60+J;return D0(X,{date:Q,onMatch:(K)=>{let z=h0(K.startTime,9),G=h0(K.endTime,17),_=P>=z,V=$?P+$<=G:P<G;if(_&&V)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)=>W5[K]===P))$(Z)}else $(Z)},h5=(Q)=>{let{allDates:q,businessHours:J,resourceBusinessHours:$=[],hideNonBusinessHours:X}=Q,Z=24,P=0,K=!1,z=(_)=>{K=!0,Z=Math.min(Z,h0(_.startTime,9)/60),P=Math.max(P,h0(_.endTime,17)/60)},G=(_)=>{D0(J,{date:_,onMatch:z});for(let V of $)D0(V,{date:_,onMatch:z})};for(let _ of q)G(_);if(!K&&X){if(G(),!K)Z=9,P=17,K=!0}return{minStart:Z,maxEnd:P,hasBusinessHours:K}};function E0(Q){return Q.flatMap((q)=>q.businessHours?[q.businessHours]:[])}function x0({referenceDate:Q,businessHours:q,hideNonBusinessHours:J,allDates:$=[Q],resourceBusinessHours:X=[]}){let Z=j5({referenceDate:Q}),P=Boolean(q)||X.length>0;if(!(J&&P))return Z;let{minStart:z,maxEnd:G,hasBusinessHours:_}=h5({allDates:$,businessHours:q,resourceBusinessHours:X,hideNonBusinessHours:J});if(!_)return Z;if(z>=G)return[];let V=Math.floor(z),W=Math.ceil(G);return Z.filter((A)=>{let M=A.hour();return M>=V&&M<W})}import{memo as XQ}from"react";import{jsx as D5}from"react/jsx-runtime";var ZQ=({className:Q})=>{let{t:q}=R();return D5("div",{className:L("w-16 shrink-0 sticky left-0 bg-background z-20 flex items-center justify-center px-1 text-xs text-muted-foreground",l,Q),children:D5("span",{className:"truncate",children:q("allDay")})})},m0=XQ(ZQ);import{memo as mQ}from"react";import{memo as e5,useMemo as DQ}from"react";import{useMemo as q5}from"react";var PQ=(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 z=P.start.diff(K.start);if(z!==0)return z;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}},E5=(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)}},Q5=(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},x5=({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:z}=PQ(q,$),G=Array.from({length:J},()=>Array.from({length:P.unitCount},()=>!1)),_=[],V=({row:W,startCol:A,endCol:M,event:Y,isTruncatedStart:N,isTruncatedEnd:U})=>{for(let I=A;I<=M;I++)G[W][I]=!0;let H=M-A+1;_.push({kind:"horizontal",event:Y,left:A/P.unitCount*100,width:H/P.unitCount*100,row:W,isTruncatedStart:N,isTruncatedEnd:U})};for(let W of K){let A=E5(W,P),M=Q5(G,A.startCol,A.endCol);if(M!==-1){V({row:M,event:W,...A});continue}for(let Y=A.startCol+1;Y<=A.endCol;Y++){let N=Q5(G,Y,A.endCol);if(N!==-1){V({row:N,startCol:Y,endCol:A.endCol,event:W,isTruncatedStart:!0,isTruncatedEnd:A.isTruncatedEnd});break}}}for(let W of z){let M=E5(W,P).startCol,Y=Q5(G,M,M);if(Y!==-1)V({row:Y,startCol:M,endCol:M,event:W,isTruncatedStart:!1,isTruncatedEnd:!1})}return _};var J5=({days:Q,allDay:q,resourceId:J,gridType:$})=>{let{getEventsForDateRange:X,dayMaxEvents:Z}=R(),P=Q.at(0),K=Q.at(-1),z=P?.startOf("day"),G=K?.endOf("day"),_=q5(()=>{if(!z||!G)return[];let A=X(z,G);if(J)A=K0(A,J);if(q)A=A.filter((M)=>Boolean(M.allDay));return A},[X,z,G,J,q]),V=q5(()=>{let A=new Map;for(let M of Q){let Y=D(M),N=M.startOf("day"),U=M.endOf("day"),H=_.filter((I)=>j0(I,N,U));A.set(Y,H)}return A},[Q,_]);return{positionedEvents:q5(()=>{return x5({days:Q,events:_,dayMaxEvents:Z,gridType:$})},[Q,Z,_,$]),dayEventsMap:V}};import{jsx as m5,jsxs as YQ}from"react/jsx-runtime";var y=({today:Q,dayNumber:q,weekday:J,className:$,"data-testid":X})=>{return YQ("div",{className:L("flex flex-col items-center",$),"data-testid":X,"data-today":Q?"true":void 0,children:[J!=null&&m5("div",{className:L("w-full truncate text-center text-xs text-muted-foreground",Q&&"text-primary"),children:J}),m5("div",{className:L("flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-xs font-medium",Q&&"bg-primary text-primary-foreground"),children:q})]})};import RQ,{memo as SQ,useMemo as d5}from"react";import{useMemo as KQ}from"react";var p5=(Q)=>{let{businessHours:q,getResourceById:J}=R(($)=>({businessHours:$.businessHours,getResourceById:$.getResourceById}));return KQ(()=>{if(Q!=null){let $=J(Q);if($?.businessHours)return $.businessHours}return q},[Q,J,q])};import*as E from"@radix-ui/react-dialog";import{XIcon as GQ}from"lucide-react";import{jsx as o,jsxs as $5}from"react/jsx-runtime";function v5({...Q}){return o(E.Root,{"data-slot":"dialog",...Q})}function zQ({...Q}){return o(E.Portal,{"data-slot":"dialog-portal",...Q})}function AQ({className:Q,...q}){return o(E.Overlay,{className:L("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",Q),"data-slot":"dialog-overlay",...q})}function g5({className:Q,children:q,...J}){return $5(zQ,{"data-slot":"dialog-portal",children:[o(AQ,{}),$5(E.Content,{className:L("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg max-h-[90%]",Q),"data-slot":"dialog-content",...J,children:[q,$5(E.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(GQ,{}),o("span",{className:"sr-only",children:"Close"})]})]})]})}function y5({className:Q,...q}){return o("div",{className:L("flex flex-col gap-2 text-center sm:text-left",Q),"data-slot":"dialog-header",...q})}function uq({className:Q,...q}){return o("div",{className:L("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",Q),"data-slot":"dialog-footer",...q})}function c5({className:Q,...q}){return o(E.Title,{className:L("text-lg leading-none font-semibold",Q),"data-slot":"dialog-title",...q})}function iq({className:Q,...q}){return o(E.Description,{className:L("text-muted-foreground text-sm",Q),"data-slot":"dialog-description",...q})}import{useImperativeHandle as VQ,useState as l5}from"react";import{useDraggable as LQ}from"@dnd-kit/core";import{memo as BQ}from"react";import{jsx as U0,jsxs as UQ}from"react/jsx-runtime";var _Q=(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 FQ({elementId:Q,event:q,className:J,style:$,disableDrag:X=!1,isTruncatedStart:Z=!1,isTruncatedEnd:P=!1}){let{onEventClick:K,renderEvent:z,disableEventClick:G,disableDragAndDrop:_}=R(),{attributes:V,listeners:W,setNodeRef:A,isDragging:M}=LQ({id:Q,data:{event:q,type:"calendar-event"},disabled:X||_}),Y=()=>{return UQ("div",{className:L(q.backgroundColor||"bg-blue-500",q.color||"text-white","h-full w-full px-1 border-[1.5px] border-card text-left overflow-clip relative",_Q(Z,P)),style:{backgroundColor:q.backgroundColor,color:q.color},children:[Z&&U0("div",{className:"absolute left-0 top-0 bottom-0 w-0.5 bg-foreground/25"}),U0("p",{className:L("text-[10px] font-semibold sm:text-xs mt-0.5",Z&&"pl-1",P&&"pr-1"),children:q.title}),P&&U0("div",{className:"absolute right-0 top-0 bottom-0 w-0.5 bg-foreground/25"})]})},N=X||_;return U0(k,{className:L("truncate h-full w-full",N?G?"cursor-default":"cursor-pointer":"cursor-grab",M&&!N&&"cursor-grabbing shadow-lg",J),onClick:(T)=>{T.stopPropagation(),K(q)},ref:A,style:$,transitionKey:Q,...V,...W,children:z?z(q):U0(Y,{})})}var p0=BQ(FQ,(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 V0,jsxs as OQ}from"react/jsx-runtime";var u5=({ref:Q})=>{let[q,J]=l5(!1),[$,X]=l5(null),{eventHeight:Z}=R();return VQ(Q,()=>({open:()=>J(!0),close:()=>J(!1),setSelectedDayEvents:(P)=>X(P)})),V0(v5,{onOpenChange:J,open:q,children:OQ(g5,{className:"max-h-[80vh] max-w-md overflow-y-auto",children:[V0(y5,{children:V0(c5,{children:$?.day.format("MMMM D, YYYY")})}),V0("div",{className:"mt-4 space-y-3",children:$?.events.map((P)=>{return V0(p0,{className:"relative my-1",elementId:`all-events-dialog-event-${P.id}`,event:P,style:{height:`${Z}px`}},P.id)})})]})})};import{useDroppable as WQ}from"@dnd-kit/core";import{jsx as MQ}from"react/jsx-runtime";function NQ(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 i5({id:Q,type:q,date:J,hour:$,minute:X,resourceId:Z,allDay:P,children:K,className:z,style:G,"data-testid":_,disabled:V=!1}){let{onCellClick:W,isCellDisabled:A,getCellClassName:M,getResourceById:Y,disableDragAndDrop:N,disableCellClick:U,classesOverride:H,view:I}=R(),{start:T,end:B}=NQ(J,$,X),O=Y?.(Z),S={start:T,end:B,resource:O,allDay:P},b=V||Boolean(A?.(S)),w=U||b,{isOver:C,setNodeRef:n}=WQ({id:Q,data:{type:q,date:J,hour:$,minute:X,resourceId:Z,allDay:P},disabled:N||b}),a=(j)=>{if(j.stopPropagation(),w)return;W(S)},s=C&&!N&&!b,i=H?.disabledCell||O5,q0=M?.(S);return MQ("div",{className:L("droppable-cell",z,q0,s&&"bg-accent",w?"cursor-default":"cursor-pointer",b&&i),"data-all-day":P?"true":void 0,"data-disabled":b.toString(),"data-end":B.toISOString(),"data-resource-id":Z,"data-start":T.toISOString(),"data-testid":_,"data-view":I,onClick:a,ref:n,style:G,children:K})}import{jsx as v0,jsxs as g0,Fragment as o5}from"react/jsx-runtime";var HQ=({day:Q,hour:q,minute:J,slotDurationMinutes:$=60,className:X="",resourceId:Z,gridType:P="day",shouldRenderEvents:K=!0,allDay:z=!1,precomputedEvents:G,"data-testid":_,showDayNumber:V=!1,children:W})=>{let A=RQ.useRef(null),{dayMaxEvents:M=0,getEventsForDateRange:Y,currentDate:N,t:U,eventSpacing:H,eventHeight:I,onMoreEventsClick:T}=R(),B=p5(Z),O=d5(()=>{if(!K)return[];if(G)return G;let j=Y(Q.startOf(P),Q.endOf(P));if(z)j=j.filter((g)=>g.allDay);if(Z)return K0(j,Z);return j},[G,Q,Z,Y,P,K,z]),S=(j,g)=>{if(T){T(j,g);return}A.current?.setSelectedDayEvents({day:j,events:g}),A.current?.open()},b=Q.month()===N.month(),w=O.length-M,C=w>0,n=d5(()=>{if(P==="hour")return C5({date:Q,hour:Q.hour(),minute:Q.minute(),durationMinutes:$,businessHours:B});return e0(Q,B)},[P,Q,$,B]),a=F.cell.day(Q,Q.format("HH"),Q.format("mm")),s=F.cell.day(Q),i=P==="hour"?a:s,q0=F.droppable.dayCell(Q,{allDay:z,resourceId:Z});return g0(o5,{children:[v0(i5,{allDay:z,className:L("cursor-pointer overflow-clip p-1 bg-background hover:bg-accent min-h-[60px] relative min-w-0",X),"data-testid":_||i,date:Q,disabled:!n||!b,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:`${H}px`},children:[V&&v0(y,{className:"items-start","data-testid":F.dayNumber(Q),dayNumber:Q.format("D"),today:h(Q)}),K&&g0(o5,{children:[O.slice(0,M).map((j,g)=>v0("div",{className:"w-full shrink-0","data-testid":j?.title,style:{height:`${I}px`}},F.listKey("empty",g,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(),S(Q,O)},onKeyDown:(j)=>{if(j.key==="Enter"||j.key===" ")j.preventDefault(),j.stopPropagation(),S(Q,O)},role:"button",tabIndex:0,children:["+",w," ",U("more")]})]}),W]})}),v0(u5,{ref:A})]})},X5=SQ(HQ);import{jsx as r5}from"react/jsx-runtime";var z0=({resource:Q,className:q,children:J,"data-testid":$})=>{let{renderResource:X}=R();return r5("div",{className:L("flex items-center justify-center p-2",q),"data-testid":$,style:{color:Q.color,backgroundColor:Q.backgroundColor},children:X?X(Q):J??r5("div",{className:"text-sm font-medium truncate",children:Q.title})})};import{memo as kQ}from"react";import{memo as IQ}from"react";import{jsx as O0,jsxs as n5,Fragment as bQ}from"react/jsx-runtime";var TQ=({rangeStart:Q,rangeEnd:q,now:J,axis:$="vertical",render:X,withDot:Z=!0})=>{let P=J??a5(),K=P.valueOf();if(!(K>=Q.valueOf()&&K<q.valueOf()))return null;let G=q.diff(Q,"minute"),V=P.diff(Q,"minute")/G*100;if(X)return O0(bQ,{children:X({currentTime:P,rangeStart:Q,rangeEnd:q,progress:V,axis:$})});if($==="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:[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 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:[Z&&O0("div",{className:"size-2 shrink-0 rounded-full bg-red-500"}),O0("div",{className:"h-0.5 flex-1 bg-red-500"})]})},s5=IQ(TQ);import{memo as wQ}from"react";import{jsx as fQ}from"react/jsx-runtime";var jQ=({rangeStart:Q,rangeEnd:q,now:J,resource:$,axis:X="vertical",withDot:Z})=>{let{renderCurrentTimeIndicator:P,view:K}=R((G)=>({renderCurrentTimeIndicator:G.renderCurrentTimeIndicator,view:G.view})),z;if(P)z=(G)=>P({...G,resource:$,view:K});return fQ(s5,{axis:X,now:J,rangeEnd:q,rangeStart:Q,render:z,withDot:Z})},t5=wQ(jQ);import{jsx as Z5,jsxs as hQ}from"react/jsx-runtime";var CQ=({gridType:Q="day",days:q,resourceId:J,resource:$,"data-testid":X,positionedEvents:Z,dayNumberHeight:P=F5})=>{let{eventHeight:K,eventSpacing:z,resources:G}=R(),_=q.at(0)?.startOf("day"),V=!J||G?.at(0)?.id===J,W=q.at(0),A=q.at(-1)?.add(1,Q),M=Q==="hour"&&Boolean(W&&A);return hQ("div",{className:"absolute inset-0 pointer-events-none z-10 overflow-clip","data-testid":X,children:[M&&W&&A&&Z5(t5,{axis:"horizontal",rangeEnd:A,rangeStart:W,resource:$,withDot:V}),Z.map((Y)=>{let{event:N,row:U}=Y,H=P+z+U*(K+z),I=`${N.id}-${U}-${_?.toISOString()}-${J??"no-resource"}`;return Z5("div",{className:"absolute z-10 pointer-events-auto overflow-clip","data-left":Y.left,"data-testid":F.container.horizontal.event(N.id),"data-top":H,"data-width":Y.width,style:{left:`calc(${Y.left}% + var(--spacing) * 0.25)`,width:`calc(${Y.width}% - var(--spacing) * 1)`,top:`${H}px`,height:`${K}px`},children:Z5(p0,{className:"h-full w-full shadow",elementId:I,event:N,isTruncatedEnd:Y.isTruncatedEnd,isTruncatedStart:Y.isTruncatedStart})},F.listKey(I,"wrapper"))})]})},P5=kQ(CQ);import{jsx as u,jsxs as Y5}from"react/jsx-runtime";var EQ=({id:Q,resource:q,gridType:J="day",variant:$="resource",dayNumberHeight:X,className:Z,columns:P=[],allDay:K,showDayNumber:z=!1})=>{let{renderResource:G}=R(),_=$==="resource",V=P.some((Y)=>Y.days),W=DQ(()=>{if(V)return[];return P.map((Y)=>Y.day).filter((Y)=>Boolean(Y))},[P,V]),{positionedEvents:A,dayEventsMap:M}=J5({days:W,gridType:J,resourceId:q?.id,allDay:K});return Y5("div",{className:L("flex flex-1 relative min-w-0",Z),"data-testid":F.container.horizontal.row(Q),children:[_&&q&&u(z0,{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:G?G(q):u("div",{className:"wrap-break-word text-sm",children:q.title})}),Y5("div",{className:"relative flex-1 flex min-w-0",children:[u("div",{className:"flex w-full min-w-0 gap-px bg-border",children:P.map((Y)=>{if(Y.days)return u(xQ,{allDay:K,col:Y,dayNumberHeight:X,gridType:J,id:Q,resource:q,resourceId:q?.id,showDayNumber:z},Y.id);return Y.day?u(X5,{allDay:K,className:L("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:z},Y.day.toISOString()):null})}),!V&&u("div",{className:"absolute inset-0 z-10 pointer-events-none",children:u(P5,{"data-testid":F.container.eventsLayer("horizontal",Q),dayNumberHeight:X,days:W,gridType:J,positionedEvents:A,resource:q,resourceId:q?.id})})]})]})},xQ=e5(({col:Q,gridType:q="day",allDay:J,resource:$,resourceId:X,dayNumberHeight:Z,showDayNumber:P,id:K})=>{let z=Q.days??[],{positionedEvents:G}=J5({days:z,gridType:q,resourceId:X,allDay:J});return Y5("div",{className:"flex relative w-full",children:[u("div",{className:"flex w-full gap-px bg-border",children:z.map((_)=>u(X5,{allDay:J,className:L("flex-1 w-20",Q.className),day:_,gridType:q,hour:q==="hour"?_.hour():void 0,resourceId:X,showDayNumber:P},_.toISOString()))}),u("div",{className:"absolute inset-0 z-10 pointer-events-none",children:u(P5,{"data-testid":F.container.eventsLayer("horizontal",K),dayNumberHeight:Z,days:z,gridType:q,positionedEvents:G,resource:$,resourceId:X})})]})}),Q2=e5(EQ);import{jsx as q2,jsxs as vQ}from"react/jsx-runtime";var pQ=({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:L("h-full min-h-12 bg-background",q?.cell)}));return vQ("div",{className:L("flex w-full gap-px bg-border",q?.row),"data-testid":"all-day-row",children:[$&&q2(m0,{className:q?.spacer}),q2(Q2,{allDay:!0,className:"flex-1 min-h-fit",columns:X,dayNumberHeight:0,gridType:"day",id:F.allDayRow(J?.id),resource:J,variant:"regular"})]})},J2=mQ(pQ);import{jsx as A0,jsxs as $2}from"react/jsx-runtime";var p="min-w-20 flex-1",P0=({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}))},Y0=({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})=>$2("div",{className:"flex gap-px bg-border h-12 flex-1","data-testid":F.header.resource.columnsHeader,children:[A0("div",{className:L("shrink-0 sticky top-0 left-0 bg-background z-20",Z0,l)}),Q.map((q)=>A0(z0,{className:L(p,"bg-background"),resource:q},F.listKey("resource-cell",q.id)))]}),L0=()=>{let{t:Q}=R((q)=>({t:q.t}));return A0("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:A0("div",{className:"text-sm truncate px-1 min-w-0",children:Q("resources")})})},WJ=({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 $2("div",{className:"flex w-full gap-px bg-border",children:[A0(m0,{}),q.map(({resource:$,days:X})=>A0(J2,{classes:{cell:L("min-w-20",X.length>1&&"flex-1")},days:X,resource:$,showSpacer:!1},F.allDayRow($.id)))]})};import{jsx as c0}from"react/jsx-runtime";var l0=({hours:Q,view:q})=>c0("div",{className:L("flex gap-px bg-border border-b",w0),children:Q.map((J,$)=>{let X=J.isSame(f(),"hour"),Z=J.format("HH"),P=F.header.week.hour(J,$);return c0("div",{className:L(p,"bg-background flex items-center justify-center text-xs shrink-0",X&&"bg-blue-50 text-blue-600 font-medium"),"data-hour":Z,"data-testid":F.header.resource.timeLabel(q,Z),children:c0(k,{className:"text-center",transitionKey:P,children:c0(f0,{date:J})})},P)})});import{jsx as $0,jsxs as P2,Fragment as uQ}from"react/jsx-runtime";var yQ=({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:P2(k,{className:L("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")})]})})},X2=(Q,q)=>x0({referenceDate:Q,businessHours:q.businessHours,hideNonBusinessHours:q.hideNonBusinessHours,allDates:[Q],resourceBusinessHours:E0(q.resources??[])}),cQ=({date:Q,config:q})=>{let J=X2(Q,q);return P2(uQ,{children:[$0(L0,{}),$0("div",{className:"flex-1 flex flex-col",children:$0(l0,{hours:J,view:"day"})})]})},lQ=(Q,q)=>{let J=q.resources??[],$=X2(Q,q);if(!J.length)return[e({days:$,gridType:"hour"}),{id:F.col.day(Q),day:Q,days:$,className:L(k5,"flex-1"),gridType:"hour"}];if(q.orientation==="vertical")return Y0({resources:J,gutter:e({days:$,gridType:"hour"}),columnsFor:(X)=>({id:F.col.day(Q,X.id),days:$,day:Q,gridType:"hour"})});return P0({resources:J,days:$,gridType:"hour",cellClassName:p})},Z2={name:"day",label:"day",icon:gQ,navigationUnit:"day",layout:"vertical",supportsResources:!0,range:(Q)=>({start:Q.startOf("day"),end:Q.endOf("day")}),columns:lQ,renderHeader:({date:Q,config:q})=>{let J=q.resources??[];if(!J.length)return $0(yQ,{date:Q});if(q.orientation==="vertical")return $0(y0,{resources:J});return $0(cQ,{config:q,date:Q})}};import{Grid3x3 as iQ}from"lucide-react";import{jsx as u0}from"react/jsx-runtime";var Y2=({className:Q})=>{let{firstDayOfWeek:q,stickyViewHeader:J,viewHeaderClassName:$,currentDate:X}=R(),Z=m(X,q);return u0("div",{className:L("flex w-full gap-px bg-border border-b",J&&"sticky top-0 z-20",$,Q),"data-testid":"month-header",children:Z.map((P)=>u0("div",{className:"py-2 text-center font-medium bg-background flex-1 min-w-0 flex items-center justify-center","data-testid":F.header.weekday("month",P.format("ddd")),children:u0(k,{transitionKey:P.toISOString(),children:u0("span",{className:"text-sm capitalize truncate w-full block",children:P.format("ddd")})})},P.toISOString()))})};import{jsx as Q0,jsxs as aQ,Fragment as nQ}from"react/jsx-runtime";var dQ=(Q,q)=>{let J=k0(Q);return Y0({resources:q,gutter:e({days:J,gridType:"day",renderLabel:($)=>Q0(y,{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"})})},oQ=({date:Q})=>{let q=k0(Q);return aQ(nQ,{children:[Q0(L0,{}),Q0("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 Q0("div",{className:"flex-1 w-20 bg-background shrink-0 flex items-center justify-center flex-col",children:Q0(k,{transitionKey:X,children:Q0(y,{className:"flex-col-reverse",dayNumber:J.format("D"),today:Z,weekday:J.format("ddd")})})},X)})})]})},rQ=(Q,q)=>{let J=q.resources??[];if(J.length){if(q.orientation==="vertical")return dQ(Q,J);return P0({resources:J,days:k0(Q),gridType:"day"})}return s0(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}))},K2={name:"month",label:"month",icon:iQ,navigationUnit:"month",layout:"horizontal",supportsResources:!0,range:(Q,q)=>C0(Q,q.firstDayOfWeek),columns:rQ,renderHeader:({date:Q,config:q})=>{let J=q.resources??[];if(!J.length)return Q0(Y2,{className:"h-12"});if(q.orientation==="vertical")return Q0(y0,{resources:J});return Q0(oQ,{date:Q})}};import{Columns3 as tQ}from"lucide-react";import{jsx as i0}from"react/jsx-runtime";var G2=({days:Q})=>{let{weekViewGranularity:q}=R(),J=q==="hourly";return i0("div",{className:L("flex gap-px bg-border border-b",w0),children:Q.map(($,X)=>{let Z=h($),P=F.header.week.day($);return i0("div",{className:L("shrink-0 bg-background flex-1 flex items-center text-center font-medium min-w-20"),"data-testid":F.header.resource.weekDay,children:i0(k,{className:L(J?"sticky left-1/2":"w-full text-center"),transitionKey:P,children:i0(y,{dayNumber:$.format("D"),today:Z,weekday:$.format("ddd")})})},P)})})};import{jsx as W0,jsxs as sQ}from"react/jsx-runtime";var z2=({columns:Q})=>{let{currentDate:q}=R();return sQ("div",{className:"flex h-12 gap-px bg-border",children:[W0("div",{className:L("shrink-0 z-20 bg-background sticky left-0",Z0,l),children:W0("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 W0("div",{className:L(p,"flex flex-col items-center justify-center text-xs shrink-0 bg-background"),"data-testid":F.header.resource.timeLabel("week",X.format("HH")),children:W0(k,{transitionKey:P,children:W0(y,{dayNumber:X.format("D"),today:Z,weekday:X.format("ddd")})})},P)})]})};import{jsx as N0,jsxs as A2}from"react/jsx-runtime";var L2=({resources:Q})=>{let{weekViewGranularity:q,t:J,currentDate:$}=R(),X=q==="hourly";return A2("div",{className:"flex h-12 gap-px bg-border",children:[N0("div",{className:L("shrink-0 z-20 bg-background sticky left-0",Z0,l),children:A2("span",{className:L("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(z0,{className:L(p,"bg-background border-b"),resource:Z,children:N0("div",{className:L("sticky text-sm font-medium truncate",X?"left-1/4":"left-1"),children:Z.title})},F.listKey("resource-cell",Z.id))})]})};import{jsx as x,jsxs as M0,Fragment as Z9}from"react/jsx-runtime";var d0=(Q,q)=>{let J=m(Q,q.firstDayOfWeek),{hiddenDays:$}=q;if(!$)return J;return J.filter((X)=>!$.has(X.day()))},o0=(Q)=>(Q.weekViewGranularity??"hourly")==="hourly",eQ=({date:Q,config:q})=>{let{t:J,selectDate:$,openEventForm:X}=R((P)=>({t:P.t,selectDate:P.selectDate,openEventForm:P.openEventForm})),Z=d0(Q,q);return M0("div",{className:"flex h-18 flex-1 gap-px bg-border","data-testid":"week-view-header",children:[x("div",{className:L(t0,"h-full shrink-0 items-center justify-center bg-background p-2 flex",l),children:M0("div",{className:"flex flex-col items-center justify-center min-w-0 w-full",children:[x("span",{className:"text-muted-foreground text-xs truncate w-full text-center",children:J("week")}),x("span",{className:"font-medium truncate w-full text-center",children:Q.week()})]})}),Z.map((P,K)=>{let z=h(P),G=F.header.week.day(P);return x("div",{className:L("hover:bg-accent bg-background flex-1 min-w-0 flex flex-col justify-center cursor-pointer p-1 text-center sm:p-2 w-20 h-full"),"data-testid":F.header.weekday("week",P.format("dddd")),onClick:()=>{$(P),X({start:P})},children:x(k,{transitionKey:G,children:x(y,{dayNumber:P.format("D"),today:z,weekday:P.format("ddd")})})},G)})]})},B0=(Q,q,J)=>x0({referenceDate:Q,businessHours:q.businessHours,hideNonBusinessHours:q.hideNonBusinessHours,allDates:J,resourceBusinessHours:E0(q.resources??[])}),Q9=(Q,q,J)=>{let $=m(Q,q.firstDayOfWeek);if(o0(q)){let X=d0(Q,q);return Y0({resources:J,gutter:e({days:B0(Q,q,$),gridType:"hour"}),columnsFor:(Z)=>X.map((P)=>({id:F.col.day(P,Z.id),className:p,day:P,days:B0(P,q,$),gridType:"hour"}))})}return Y0({resources:J,gutter:e({days:$,gridType:"day",renderLabel:(X)=>x(y,{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"})})},q9=(Q,q,J)=>{let $=m(Q,q.firstDayOfWeek);if(o0(q)){let X=$.map((Z)=>B0(Z,q));return P0({resources:J,days:X,gridType:"hour",cellClassName:p})}return P0({resources:J,days:$,gridType:"day",cellClassName:p})},J9=({date:Q,config:q,resources:J})=>{let $=d0(Q,q),X=o0(q),Z=X?J.flatMap((P)=>$.map((K)=>({day:K,resourceId:P.id}))):[];return M0("div",{className:"flex-1 flex flex-col",children:[x(L2,{resources:J}),X&&x(z2,{columns:Z})]})},$9=({date:Q,config:q})=>{let J=m(Q,q.firstDayOfWeek),$=o0(q),X=$?J.flatMap((Z)=>B0(Z,q)):[];return M0(Z9,{children:[x(L0,{}),M0("div",{className:"flex-1 flex flex-col",children:[x(G2,{days:J}),$&&x(l0,{hours:X,view:"week"})]})]})},X9=(Q,q)=>{let J=q.resources??[];if(J.length){if(q.orientation==="vertical")return Q9(Q,q,J);return q9(Q,q,J)}let $=m(Q,q.firstDayOfWeek),X=d0(Q,q);return[e({days:B0(Q,q,$),gridType:"hour",widthClassName:t0}),...X.map((Z)=>({id:F.col.day(Z),day:Z,days:B0(Z,q,$),className:"flex-1 min-w-0",gridType:"hour"}))]},B2={name:"week",label:"week",icon:tQ,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:X9,renderHeader:({date:Q,config:q})=>{let J=q.resources??[];if(!J.length)return x(eQ,{config:q,date:Q});if(q.orientation==="vertical")return x(J9,{config:q,date:Q,resources:J});return x($9,{config:q,date:Q,resources:J})}};import{Grid2x2 as G9}from"lucide-react";import*as r from"@radix-ui/react-scroll-area";import{jsx as R0,jsxs as P9}from"react/jsx-runtime";function _2({className:Q,children:q,viewPortProps:J,...$}){return P9(r.Root,{className:L("relative",Q),"data-slot":"scroll-area",...$,children:[R0(r.Viewport,{...J,className:L("focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",J?.className),"data-slot":"scroll-area-viewport",children:q}),R0(K5,{}),R0(r.Corner,{})]})}function K5({className:Q,orientation:q="vertical",...J}){return R0(r.ScrollAreaScrollbar,{className:L("flex touch-none p-px transition-colors select-none",q==="vertical"&&"h-full w-2.5 border-l border-l-transparent",q==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",Q),"data-slot":"scroll-area-scrollbar",orientation:q,...J,children:R0(r.ScrollAreaThumb,{className:"bg-border relative flex-1 rounded-full","data-slot":"scroll-area-thumb"})})}import{jsx as X0,jsxs as S0}from"react/jsx-runtime";var Y9=["bg-primary","bg-blue-500","bg-green-500"],K9=42,F2=()=>{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 U=f().year(Z).month(N).startOf("month"),H=J(U,U.endOf("month"));return{date:U,name:U.format("MMMM"),eventCount:H.length,monthKey:U.format("MM")}})},z=(Y)=>{let N=Y.startOf("month"),U=m(N,X).at(0)??N;return Array.from({length:K9},(H,I)=>{let T=U.add(I,"day"),B=T.startOf("day"),O=T.endOf("day"),S=J(B,O);return{date:T,dayKey:D(T),isInCurrentMonth:T.month()===Y.month(),isToday:h(T),isSelected:T.isSame(Q,"day"),eventCount:S.length}})},G=(Y,N,U)=>{U?.stopPropagation(),q(N,Y)},_=(Y)=>{let N=Y===1?$("event"):$("events");return`${Y} ${N}`},V=(Y)=>{let U=Y.isInCurrentMonth?"":"text-muted-foreground opacity-50",H=Y.isToday?"bg-primary text-primary-foreground rounded-full":"",I=Y.isSelected&&!Y.isToday?"bg-muted rounded-full font-bold":"",T=Y.eventCount>0&&!Y.isToday&&!Y.isSelected?"font-medium":"";return L("relative flex aspect-square w-full cursor-pointer flex-col items-center justify-center hover:bg-accent rounded-sm transition-colors duration-200",U,H,I,T)},W=(Y,N)=>{return L("h-[3px] w-[3px] rounded-full",N?"bg-primary-foreground":Y)},A=K(),M=(Y)=>{if(Y===0)return"";return _(Y)};return S0(_2,{className:"h-full","data-testid":"year-view",children:[X0("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)=>{let N=z(Y.date);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(k,{className:"mb-2 flex items-center justify-between",transitionKey:F.listKey("month",Y.monthKey),children:[X0("button",{className:"text-lg font-medium hover:underline cursor-pointer","data-testid":F.header.year.month(Y.monthKey,"title"),onClick:()=>G(Y.date,"month"),type:"button",children:Y.name}),Y.eventCount>0&&X0("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:_(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:[P.map((U)=>X0("div",{className:"text-muted-foreground h-3 text-center",children:U.label},F.listKey("header",Y.monthKey,U.id))),N.map((U)=>{let H=F.header.year.day(Y.date.format("YYYY-MM"),U.dayKey),I=U.eventCount>0,T=Math.min(U.eventCount,3),B=Y9.slice(0,T);return S0("button",{className:V(U),"data-testid":H,onClick:(O)=>G(U.date,"day",O),title:M(U.eventCount),type:"button",children:[X0("span",{className:"text-center leading-none",children:U.date.date()}),I&&X0("div",{className:L("absolute bottom-0 flex w-full justify-center space-x-px",U.isToday&&"bottom-px"),children:B.map((O)=>X0("span",{className:W(O,U.isToday)},O))})]},U.dayKey)})]})]},Y.monthKey)})}),X0(K5,{className:"z-30"})]})};var U2={name:"year",label:"year",icon:G9,navigationUnit:"year",supportsResources:!1,range:(Q)=>({start:Q.startOf("year"),end:Q.endOf("year")}),component:F2};var V2=[Z2,B2,K2,U2];var O2=(Q,q,J)=>q?.range?.(Q,{firstDayOfWeek:J})??C0(Q,J),W2=({initialDate:Q,initialView:q,firstDayOfWeek:J,onDateChange:$,onViewChange:X,pluginRuntime:Z})=>{let[P,K]=L9(()=>({date:f.isDayjs(Q)?Q:f(Q),view:q})),z=A9(P),G=c((B)=>{let O={...z.current,...B};return z.current=O,K(O),O},[]),_=c(()=>[...V2,...Z.getViews()],[Z]),V=c((B)=>_().find((O)=>O.name===B),[_]),W=c(()=>{return O2(P.date,V(P.view),J)},[P,J,V]),A=c((B)=>{let O=O2(B.date,V(B.view),J);$?.(B.date,O)},[$,J,V]),M=c((B)=>{A(G({date:B}))},[G,A]),Y=c((B)=>{let{date:O,view:S}=z.current,b=V(S),w=b?.navigationStep??{amount:1,unit:b?.navigationUnit??"day"},C=O.add(B*w.amount,w.unit);A(G({date:C}))},[G,A,V]),N=c(()=>Y(1),[Y]),U=c(()=>Y(-1),[Y]),H=c(()=>A(G({date:f()})),[G,A]),I=c((B,O)=>{let S=G(O?{view:B,date:O}:{view:B});X?.(B),A(S)},[G,X,A]),T=c((B)=>{let O=typeof B==="function"?B(z.current.date):B;G({date:O})},[G]);return z9(()=>({currentDate:P.date,setCurrentDate:T,view:P.view,setView:I,selectDate:M,nextPeriod:N,prevPeriod:U,today:H,getCurrentViewRange:W,getAllViews:_}),[P,T,I,M,N,U,H,W,_])};import{createElement as B9,Fragment as _9}from"react";var N2=(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(B9(_9,{key:X.name},Z))}return $},getViews:()=>Q.flatMap((q)=>q.views??[]),getProviders:()=>Q.map((q)=>q.provider).filter((q)=>Boolean(q))});var F9=[],U9=[],H2=(Q)=>{let{events:q,firstDayOfWeek:J=0,initialView:$="month",initialDate:X=f(),dayMaxEvents:Z,businessHours:P,onEventAdd:K,onEventUpdate:z,onEventDelete:G,onDateChange:_,onViewChange:V,locale:W,timezone:A,translations:M,translator:Y,onEventClick:N,onCellClick:U,disableEventClick:H,disableCellClick:I,resources:T,orientation:B,weekViewGranularity:O}=Q,{plugins:S=U9}=Q,b=M5({firstDayOfWeek:J,dayMaxEvents:Z,businessHours:P,locale:W,translations:M,translator:Y,resources:T,orientation:B,weekViewGranularity:O}),w=R2(()=>N2(S),[S]),C=W2({initialDate:X,initialView:$,firstDayOfWeek:J,onDateChange:_,onViewChange:V,pluginRuntime:w}),n=I5({events:q,pluginRuntime:w,getCurrentViewRange:C.getCurrentViewRange,resources:b.resources??F9,onEventAdd:K,onEventUpdate:z,onEventDelete:G}),a=T5({currentDate:C.currentDate,t:b.t,disableEventClick:H,disableCellClick:I,onEventClick:N,onCellClick:U}),{setCurrentLocale:s}=b,{setCurrentDate:i}=C,{setCurrentEvents:q0}=n,j=S2(void 0);M2(()=>{if(W&&W!==j.current)s(W),f.locale(W),i((t)=>t.locale(W)),j.current=W},[W,s,i]);let g=S2(A);return M2(()=>{if(A&&A!==g.current)f.tz.setDefault(A),i((t)=>t.tz(A)),q0((t)=>t.map((J0)=>({...J0,start:J0.start.tz(A),end:J0.end.tz(A)}))),g.current=A},[A,i,q0]),R2(()=>{let{setCurrentLocale:t,...J0}=b,{getCurrentViewRange:r0,getAllViews:H0,...I0}=C,{setCurrentEvents:n0,...T0}=n;return{...J0,...I0,...T0,...a,getViews:H0,getEventManager:w.getEventManager,renderSlot:w.renderSlot,collect:w.collect,getProviders:w.getProviders,getEventResourceIds:_0,currentRange:C.getCurrentViewRange()}},[b,C,n,a,w])};import{jsx as V9}from"react/jsx-runtime";var I2=(Q,q)=>Q.reduceRight((J,$,X)=>V9($,{children:J},X),q);import{jsx as M9}from"react/jsx-runtime";var W9=[],N9=(Q)=>{let{events:q=W9,firstDayOfWeek:J=0,initialView:$="month",initialDate:X,renderEvent:Z,onEventClick:P,onCellClick:K,isCellDisabled:z,getCellClassName:G,onViewChange:_,onEventAdd:V,onEventUpdate:W,onEventDelete:A,onDateChange:M,locale:Y,timezone:N,disableCellClick:U,disableEventClick:H,disableDragAndDrop:I,dayMaxEvents:T,eventSpacing:B=_5,eventHeight:O=U5,stickyViewHeader:S=!0,viewHeaderClassName:b="",headerComponent:w,headerClassName:C,businessHours:n,renderEventForm:a,onMoreEventsClick:s,translations:i,translator:q0,timeFormat:j="12-hour",classesOverride:g,renderCurrentTimeIndicator:t,renderHour:J0,hideNonBusinessHours:r0=!1,hideExportButton:H0=!1,hiddenDays:I0,slotDuration:n0=60,scrollTime:T0,plugins:T2,resources:b2,renderResource:G5,orientation:w2,weekViewGranularity:j2}=Q,z5=H2({events:q,firstDayOfWeek:J,initialView:$,initialDate:X,dayMaxEvents:T,businessHours:n,onEventAdd:V,onEventUpdate:W,onEventDelete:A,onDateChange:M,onViewChange:_,locale:Y,timezone:N,translations:i,translator:q0,plugins:T2,onEventClick:P,onCellClick:K,disableEventClick:H,disableCellClick:U,resources:b2,orientation:w2,weekViewGranularity:j2});return O9(()=>{let{handleEventClick:f2,handleDateClick:k2,...C2}=z5;return{...C2,renderEvent:Z,onEventClick:f2,onCellClick:k2,isCellDisabled:z,getCellClassName:G,locale:Y,timezone:N,disableCellClick:U,disableEventClick:H,disableDragAndDrop:I,eventSpacing:B,eventHeight:O,stickyViewHeader:S,viewHeaderClassName:b,headerComponent:w,headerClassName:C,renderEventForm:a,onMoreEventsClick:s,timeFormat:j,classesOverride:g,renderCurrentTimeIndicator:t,renderHour:J0,hideNonBusinessHours:r0,hideExportButton:H0,hiddenDays:I0,slotDuration:n0,scrollTime:T0,renderResource:G5}},[z5,Z,G5,z,G,Y,N,U,H,I,B,O,S,b,w,C,a,s,j,g,t,J0,r0,H0,I0,n0,T0])},v$=({children:Q,...q})=>{let J=N9(q),$=I2(J.getProviders(),Q);return M9(b0.Provider,{value:J,children:$})};
|
|
2
|
+
export{f as a,R as b,p9 as c,L as d,k as e,v5 as f,g5 as g,y5 as h,uq as i,c5 as j,iq as k,_2 as l,K5 as m,h as n,m as o,s0 as p,F as q,p5 as r,_5 as s,U5 as t,W5 as u,y9 as v,e0 as w,h5 as x,K0 as y,p0 as z,X5 as A,t5 as B,Q2 as C,t0 as D,J2 as E,WJ as F,B5 as G,v$ as H};
|
package/dist/testing/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{H as b}from"../shared/chunk-
|
|
1
|
+
import{H as b}from"../shared/chunk-b53nxddz.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,2 +0,0 @@
|
|
|
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};
|