@weekwise/react 0.1.1 → 0.2.0
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 +9 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useDocumentCursor.d.ts +7 -0
- package/dist/hooks/useTimeOffset.d.ts +1 -0
- package/dist/hooks/useToday.d.ts +2 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +376 -352
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -137,6 +137,15 @@ Colors, the surface around the card and the "now" line use the same `--ww-*` the
|
|
|
137
137
|
`@weekwise/dom` (listed in its README). Event content is yours: style it in the render function.
|
|
138
138
|
The part of an event that continues from or into another day has `data-continues-before` /
|
|
139
139
|
`data-continues-after` on its element, e.g. to square its corners there.
|
|
140
|
+
A day/week event is a size container named `ww-event`, so content can fit short events (15
|
|
141
|
+
minutes is 11px high in a compact calendar) with a container query:
|
|
142
|
+
|
|
143
|
+
```css
|
|
144
|
+
@container ww-event (max-height: 25px) {
|
|
145
|
+
.my-event { display: flex; align-items: center; padding-block: 0; line-height: 1; }
|
|
146
|
+
.my-event__time { display: none; }
|
|
147
|
+
}
|
|
148
|
+
```
|
|
140
149
|
|
|
141
150
|
## Props
|
|
142
151
|
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { default as useCalendarSize } from "./useCalendarSize";
|
|
|
2
2
|
export { default as useComputed } from "./useComputed";
|
|
3
3
|
export { default as useControlled } from "./useControlled";
|
|
4
4
|
export { default as useCurrentRef } from "./useCurrentRef";
|
|
5
|
+
export { default as useDocumentCursor, type DocumentCursor } from "./useDocumentCursor";
|
|
5
6
|
export { default as useEventCallback } from "./useEventCallback";
|
|
6
7
|
export { default as useGlobalListeners } from "./useGlobalListeners";
|
|
7
8
|
export { default as useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Cursors set on the whole page while a gesture runs: see the `ww-cursor-*` classes in Calendar.module.css. */
|
|
2
|
+
export type DocumentCursor = "grabbing" | "not-allowed";
|
|
3
|
+
/**
|
|
4
|
+
* Shows `cursor` over the whole page, the calendar, its overlays and outside it, until it is
|
|
5
|
+
* `null` or the component unmounts. The page's elements keep their own cursors otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export default function useDocumentCursor(cursor: DocumentCursor | null): void;
|
package/dist/hooks/useToday.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Start of today as a timestamp. Changes at midnight, so components that
|
|
3
3
|
* depend on it (today's column, the now line, past-day limits) re-render
|
|
4
|
-
* when the date rolls over
|
|
4
|
+
* when the date rolls over, and with the adapter: in another time zone
|
|
5
|
+
* today may already be another day.
|
|
5
6
|
*/
|
|
6
7
|
export default function useToday(): number;
|
package/dist/index.cjs
CHANGED
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
A component is changing the default state of an uncontrolled value after being initialized.
|
|
10
10
|
To suppress this warning opt to use a controlled value.
|
|
11
11
|
More info: https://reactjs.org/link/controlled-components
|
|
12
|
-
${a.current.stack}`)},[i,r,t])}function y(n){let{controlled:r,default:i}=n,[a,o]=(0,e.useState)(()=>i===void 0&&`initialState`in n&&n.initialState!==void 0?n.initialState:i),[s]=(0,e.useState)(i),c=_(r);t.isDevEnvironment&&v(c,r,s,i);let l=(0,e.useCallback)(e=>{c||o(e)},[c]);return[c?r:a,l,c]}var b={};function x(t,n){let r=(0,e.useRef)(b);return r.current===b&&(r.current=t(n)),r}function S(){if(t.isDevEnvironment)throw Error(`useEventCallback: Cannot call an event handler while rendering.`)}function C(){let e={next:void 0,callback:S,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function w(t){let n=x(C).current;return n.next=t,(0,e.useInsertionEffect)(n.effect),n.trampoline}function T(){let[t]=(0,e.useState)(()=>({current:new Map})),{addGlobalListener:n,removeGlobalListener:r,removeAllGlobalListeners:i}=(0,e.useMemo)(()=>{function e(e,n,r,i){let a=typeof i!=`boolean`&&i?.once?n=>{t.current.delete(r),e instanceof Document?r.call(e,n):r(n)}:r;e.addEventListener(n,r,i),t.current.set(r,{type:n,target:e,fn:a,options:i})}function n(e,n,r,i){let a=t.current.get(r)?.fn||r;e.removeEventListener(n,a,i),t.current.delete(r)}function r(){t.current.forEach(({target:e,type:t,options:r},i)=>{n(e,t,i,r)})}return{addGlobalListener:e,removeGlobalListener:n,removeAllGlobalListeners:r}},[t]);return(0,e.useEffect)(()=>i,[i]),{addGlobalListener:n,removeGlobalListener:r,removeAllGlobalListeners:i}}var E=e=>!e||typeof e==`function`?e:t=>{e.current=t};function D(...e){return t=>{e.forEach(e=>{E(e)?.(t)})}}function ee(...t){return(0,e.useMemo)(()=>D(...t),t)}function te(t){let[{state:n}]=(0,e.useState)(()=>({state:{activePointId:null,clientX:0,clientY:0,initialClientX:0,initialClientY:0,isDistanceReached:!1}})),r=(0,e.useRef)(t);r.current=t;let{addGlobalListener:i,removeGlobalListener:a}=T();return{listeners:(0,e.useMemo)(()=>{let e={},t=e=>{`stopPropagation`in e&&`preventDefault`in e&&(e.stopPropagation(),e.preventDefault())},o=(e,t)=>{let{current:{distance:i=0,...a}}=r,{clientX:o,clientY:s}=e,{clientX:c,clientY:l}=n;n.clientX=o,n.clientY=s,t!==void 0&&(n.activePointId=t);let u=e=>({shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,clientX:o,clientY:s});return{start(e,t){return n.initialClientX=o,n.initialClientY=s,n.isDistanceReached=i===0,a.onMoveStart({type:`movestart`,pointerType:e,...u(t)})},move(e,t,r,d){let f=o-n.initialClientX,p=s-n.initialClientY;!n.isDistanceReached&&f**2+p**2>=i**2&&(n.isDistanceReached=!0),n.isDistanceReached&&a.onMove({type:`move`,pointerType:e,deltaX:r??o-c,deltaY:d??s-l,initialDeltaX:f,initialDeltaY:p,...u(t)})},end(e,t){a.onMoveEnd({type:`moveend`,pointerType:e,...u(t)})}}};if(typeof PointerEvent>`u`){let r=e=>{e.button===0&&o(e).move(`mouse`,e)},s=e=>{e.button===0&&o(e).end(`mouse`,e)};e.onMouseDown=e=>{e.button===0&&(o(e).start(`mouse`,e)===!1?o(e,null):(i(window,`mousemove`,r,!1),i(window,`mouseup`,s,!1),t(e)))};let c=e=>{let t=[...e.changedTouches].findIndex(({identifier:e})=>e===n.activePointId);if(t>=0){let n=e.changedTouches[t];o(n).move(`touch`,e)}},l=e=>{let t=[...e.changedTouches].findIndex(({identifier:e})=>e===n.activePointId);t>=0&&(o(e.changedTouches[t],null).end(`touch`,e),i(window,`touchmove`,c),a(window,`touchend`,l),a(window,`touchcancel`,l))};e.onTouchStart=e=>{if(e.changedTouches.length===0||n.activePointId!==null)return;let r=e.changedTouches[0];o(r,r.identifier).start(`touch`,e)===!1?o(r,null):(i(window,`touchmove`,c,!1),i(window,`touchend`,l,!1),i(window,`touchcancel`,l,!1),t(e))}}else{let r=e=>{if(e.pointerId===n.activePointId){let t=e.pointerType||`mouse`;o(e).move(t,e)}},s=e=>{if(e.pointerId===n.activePointId){let t=e.pointerType||`mouse`;o(e,null).end(t,e),a(window,`pointermove`,r,!1),a(window,`pointerup`,s,!1),a(window,`pointercancel`,s,!1)}};e.onPointerDown=e=>{if(e.button===0&&n.activePointId===null){let n=e.pointerType||`mouse`;o(e,e.pointerId).start(n,e)===!1?o(e,null):(i(window,`pointermove`,r,!1),i(window,`pointerup`,s,!1),i(window,`pointercancel`,s,!1),t(e))}}}let s=(e,t,n)=>{let{start:r,move:i,end:a}=o({clientX:0,clientY:0});r(`keyboard`,e)?(i(`keyboard`,e,t,n),a(`keyboard`,e)):o({clientX:0,clientY:0},null)};return e.onKeyDown=e=>{switch(e.key){case`Left`:case`ArrowLeft`:t(e),s(e,-1,0);break;case`Right`:case`ArrowRight`:t(e),s(e,1,0);break;case`Up`:case`ArrowUp`:t(e),s(e,0,-1);break;case`Down`:case`ArrowDown`:t(e),s(e,0,1)}},e},[i,a,n])}}function O(t){let n=(0,e.useRef)(void 0);return(0,e.useEffect)(()=>{n.current=t},[t]),n.current}function k(){let t=null,n=0,r=e=>(n+=1,t===null&&(t=document.createElement(`div`),t.style.width=`99px`,t.style.height=`99px`,t.style.overflow=`scroll`,t.style.position=`absolute`,t.style.top=`-9999px`,t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`role`,`presentation`),document.body.appendChild(t),window.addEventListener(`resize`,e)),{element:t,cleanup:()=>{t&&--n<=0&&(document.body.removeChild(t),window.removeEventListener(`resize`,e),t=null,n=0)}});return function(){let[t,n]=(0,e.useState)({height:0,width:0});return f(()=>{let t=()=>{let t=i.offsetHeight-i.clientHeight,r=i.offsetWidth-i.clientWidth;(0,e.startTransition)(()=>{n(e=>{let{height:n,width:i}=e;return n!==t||i!==r?{height:t,width:r}:e})})},{element:i,cleanup:a}=r(t);return t(),a},[]),t}}var ne=k();function A(t){let[n,r]=(0,e.useState)(t),i=(0,e.useRef)(t);return[n,(0,e.useCallback)(e=>{i.current=e,r(e)},[]),i]}function j(t,n,r=!0){let i=(0,e.useRef)(null),a=h(t);(0,e.useEffect)(()=>{if(r){let e=new Date,t=n-(e.getMinutes()*60+e.getSeconds())*1e3%n;i.current=setTimeout(()=>{a.current(),i.current=setInterval(a.current,n)},t),a.current()}return()=>{i.current&&clearTimeout(i.current)}},[a,n,r])}function re(){let{getToday:t,addDays:n,toMillis:r,fromMillis:i}=l(),[a,o]=(0,e.useState)(()=>r(t()));return(0,e.useEffect)(()=>{let e=r(n(i(a),1)),s=Math.max(e-Date.now(),0)+1e3,c=setTimeout(()=>o(r(t())),s);return()=>clearTimeout(c)},[n,i,t,r,a]),a}var M=(0,e.createContext)(void 0);t.isDevEnvironment&&(M.displayName=`CalendarContext`);function N(){let t=(0,e.useContext)(M);if(!t)throw Error(`CalendarContext is required`);return t}var P=(0,e.createContext)(null);t.isDevEnvironment&&(P.displayName=`ThemeSourceContext`);function F(n){let{view:r,defaultView:i,startWeek:a,viewValue:o,defaultViewValue:s,dateUtils:c,onChangeView:l,onChangeViewValue:u}=n,[d,f]=y({controlled:r,default:i,initialState:`week`}),p=(0,e.useCallback)((e,n)=>(0,t.normalizeViewValue)(c,e,n,a),[c,a]),[m,g]=y({controlled:o,default:s,initialState:p(d)}),_=w((e,t)=>{g(e),u?.(e,t)}),v=w((0,t.mergeCallbacks)(e=>{f(e)},l)),b=h(m),x=(0,e.useRef)(d),S=(0,e.useRef)(a),C=(0,e.useRef)(c);return(0,e.useEffect)(()=>{let e=x.current,n=S.current!==a,r=C.current,i=r===c?b.current:(0,t.transferDay)(r,c,b.current);x.current=d,S.current=a,C.current=c;let o=e===d&&!n?p(d,i):(0,t.getViewChangeTarget)(c,e,d,i,a);_(o,d)},[p,_,d,b,c,a]),{view:d,viewValue:m,changeViewValue:_,changeView:v}}function I(e){let{dateUtils:n,view:r,viewValue:i,changeViewValue:a,startWeek:o}=e,s=(e,i)=>()=>a((0,t.getNavigationTarget)(n,r,e,i,o),r);return{goForward:w(s(i,1)),goBackward:w(s(i,-1)),goToday:w(s(n.getToday(),0))}}function L(e){return(0,a.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,height:`12`,viewBox:`0 0 13 12`,width:`13`,...e,children:(0,a.jsx)(`path`,{d:`M1.77498 2.29504L6.35498 6.87504L10.945 2.29504L12.355 3.70504L6.35498 9.70504L0.35498 3.70504L1.77498 2.29504Z`,fill:`currentColor`})})}var R=()=>()=>{},z=()=>!0,B=()=>!1;function V(){return(0,e.useSyncExternalStore)(R,z,B)}function ie(e){let n={display:`contents`};if(!e)return n;let r=getComputedStyle(e);for(let e of t.THEME_PROPERTIES){let t=r.getPropertyValue(e).trim();t&&(n[e===`font-family`?`fontFamily`:e]=t)}return n}function H({children:t,container:n}){let r=V(),i=(0,e.useContext)(P);return r?n?(0,o.createPortal)(t,n):(0,o.createPortal)((0,a.jsx)(`div`,{style:ie(i?.current),children:t}),document.body):null}var U={root:`_root_1aojr_1`,root__toggle:`_root__toggle_1aojr_6`,root__toggleLabel:`_root__toggleLabel_1aojr_30`,root__toggleIcon:`_root__toggleIcon_1aojr_37`,root__toggleIcon_open:`_root__toggleIcon_open_1aojr_43`,popover:`_popover_1aojr_47`,popover__header:`_popover__header_1aojr_71`,popover__title:`_popover__title_1aojr_93`,popover__navBackward:`_popover__navBackward_1aojr_98`,popover__navForward:`_popover__navForward_1aojr_102`,popover__grid:`_popover__grid_1aojr_106`,popover__weekday:`_popover__weekday_1aojr_112`,popover__day:`_popover__day_1aojr_122`,popover__day_outside:`_popover__day_outside_1aojr_140`,popover__day_selected:`_popover__day_selected_1aojr_145`,popover__day_rangeStart:`_popover__day_rangeStart_1aojr_152`,popover__day_rangeEnd:`_popover__day_rangeEnd_1aojr_157`,popover__day_today:`_popover__day_today_1aojr_162`};function W({renderHeading:n,type:r=`button`,onClick:o,onKeyDown:s,className:c,...u}){let{view:f,viewValue:p,changeViewValue:m,startWeek:h}=N(),g=l(),_=d(),{getStartOfWeek:v,getStartOfMonth:y,addMonths:b}=g,[x,S]=(0,e.useState)(!1),[C,w]=(0,e.useState)(()=>y(p)),T=(0,e.useRef)(null),{refs:E,floatingStyles:D}=(0,i.useFloating)({placement:`bottom`,middleware:[(0,i.offset)(6),(0,i.flip)({padding:8}),(0,i.shift)({padding:8})],whileElementsMounted:i.autoUpdate});(0,e.useEffect)(()=>{x&&w(y(p))},[x,y,p]),(0,e.useEffect)(()=>{if(!x)return;let e=e=>{let t=e.target;T.current?.contains(t)||E.floating.current?.contains(t)||S(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[x,E.floating]);let ee=(0,e.useMemo)(()=>n?n(p,f):(0,t.getViewHeading)(g,f,p,h),[g,n,h,f,p]),te=(0,e.useMemo)(()=>(0,t.getMonthGrid)(g,C,h),[g,C,h]),O=e=>{o?.(e),S(e=>!e)},k=e=>{s?.(e),e.key===`Escape`&&S(!1)},ne=e=>{m(f===`week`?v(e,h):e,f),S(!1)};return(0,a.jsxs)(`div`,{ref:T,className:U.root,children:[(0,a.jsxs)(`button`,{type:r,"aria-label":_.chooseDate,"aria-expanded":x,"aria-haspopup":`dialog`,...u,onClick:O,onKeyDown:k,ref:E.setReference,className:(0,t.cx)(c,U.root__toggle),children:[(0,a.jsx)(`span`,{className:U.root__toggleLabel,children:ee}),(0,a.jsx)(L,{className:(0,t.cx)(U.root__toggleIcon,{[U.root__toggleIcon_open]:x})})]}),x&&(0,a.jsx)(H,{children:(0,a.jsxs)(`div`,{ref:E.setFloating,style:D,role:`dialog`,"aria-label":_.chooseDate,className:U.popover,children:[(0,a.jsxs)(`div`,{className:U.popover__header,children:[(0,a.jsx)(`button`,{type:`button`,"aria-label":_.previousMonth,onClick:()=>w(e=>b(e,-1)),children:(0,a.jsx)(L,{className:U.popover__navBackward})}),(0,a.jsx)(`div`,{className:U.popover__title,children:(0,t.formatMonthYear)(g,C)}),(0,a.jsx)(`button`,{type:`button`,"aria-label":_.nextMonth,onClick:()=>w(e=>b(e,1)),children:(0,a.jsx)(L,{className:U.popover__navForward})})]}),(0,a.jsxs)(`div`,{className:U.popover__grid,children:[te.slice(0,7).map(e=>(0,a.jsx)(`div`,{className:U.popover__weekday,children:g.weekDayShortName(g.getWeekDay(e))},g.getWeekDay(e))),te.map((e,n)=>{let r=g.getMonths(e)!==g.getMonths(C),i=g.isToday(e),o=f!==`month`&&(0,t.isInViewPeriod)(g,f,p,e),s=o&&(f===`day`||n%7==0),c=o&&(f===`day`||n%7==6);return(0,a.jsx)(`button`,{type:`button`,onClick:()=>ne(e),className:(0,t.cx)(U.popover__day,{[U.popover__day_outside]:r,[U.popover__day_today]:i,[U.popover__day_selected]:o,[U.popover__day_rangeStart]:s,[U.popover__day_rangeEnd]:c}),children:g.getMonthDay(e)},g.toMillis(e))})]})]})})]})}var G={root:`_root_l1csz_1`,root__icon:`_root__icon_l1csz_21`,root__icon_forward:`_root__icon_forward_l1csz_25`,root__icon_backward:`_root__icon_backward_l1csz_29`};function K({direction:e=`forward`,type:n=`button`,onClick:r,className:i,children:o,...s}){let{goForward:c,goBackward:l}=N(),u=d(),f=w((0,t.mergeCallbacks)(r,()=>{e===`forward`?c():e===`backward`&&l()}));return(0,a.jsx)(`button`,{type:n,"aria-label":e===`forward`?u.next:u.previous,...s,onClick:f,className:(0,t.cx)(i,G.root),children:o??(0,a.jsx)(L,{className:(0,t.cx)(G.root__icon,{[G.root__icon_backward]:e===`backward`,[G.root__icon_forward]:e===`forward`})})})}var q={root:`_root_1n590_1`,root__icon:`_root__icon_1n590_25`,root__icon_open:`_root__icon_open_1n590_32`,list:`_list_1n590_36`,list__option:`_list__option_1n590_48`,list__option_active:`_list__option_active_1n590_67`,list__check:`_list__check_1n590_75`},J=[`day`,`week`,`month`];function ae({className:n}){let{view:r,changeView:o}=N(),s=d(),{addGlobalListener:c,removeGlobalListener:l}=T(),u=(0,e.useId)(),[f,p]=(0,e.useState)(!1),[m,h]=(0,e.useState)(r),g=(0,e.useRef)(new Map),{refs:_,floatingStyles:v}=(0,i.useFloating)({placement:`bottom-end`,middleware:[(0,i.offset)(6),(0,i.flip)({padding:8}),(0,i.shift)({padding:8})],whileElementsMounted:i.autoUpdate}),y=e=>{p(!1);let t=_.reference.current;e&&t instanceof HTMLElement&&t.focus()},b=(e=r)=>{h(e),p(!0)},x=e=>{y(!0),o(e)};(0,e.useEffect)(()=>{f&&g.current.get(m)?.focus()},[f,m]),(0,e.useEffect)(()=>{if(!f)return;let e=e=>{let t=e.target,n=_.reference.current;n instanceof Node&&n.contains(t)||_.floating.current?.contains(t)||p(!1)};return c(document,`pointerdown`,e),()=>l(document,`pointerdown`,e)},[c,f,_.floating,_.reference,l]);let S=e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),b())},C=e=>{let t=J.indexOf(m),n=t=>{e.preventDefault(),h(J[(t+J.length)%J.length]??m)};switch(e.key){case`ArrowDown`:return n(t+1);case`ArrowUp`:return n(t-1);case`Home`:return n(0);case`End`:return n(J.length-1);case`Enter`:case` `:return e.preventDefault(),x(m);case`Escape`:return e.preventDefault(),y(!0);case`Tab`:return y(!1)}},w=`${u}-list`;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(`button`,{ref:_.setReference,type:`button`,"aria-haspopup":`listbox`,"aria-expanded":f,"aria-controls":f?w:void 0,"aria-label":`${s.chooseView}: ${s[r]}`,className:(0,t.cx)(n,q.root),onClick:()=>f?y(!1):b(),onKeyDown:S,children:[s[r],(0,a.jsx)(L,{"aria-hidden":`true`,className:(0,t.cx)(q.root__icon,{[q.root__icon_open]:f})})]}),f&&(0,a.jsx)(H,{children:(0,a.jsx)(`div`,{ref:_.setFloating,id:w,role:`listbox`,"aria-label":s.chooseView,style:v,className:q.list,onKeyDown:C,children:J.map(e=>(0,a.jsxs)(`div`,{ref:t=>{t?g.current.set(e,t):g.current.delete(e)},id:`${u}-${e}`,role:`option`,tabIndex:-1,"aria-selected":e===r,className:(0,t.cx)(q.list__option,{[q.list__option_active]:e===m}),onClick:()=>x(e),onPointerMove:()=>h(e),children:[s[e],e===r&&(0,a.jsx)(`svg`,{"aria-hidden":`true`,className:q.list__check,viewBox:`0 0 16 16`,width:`14`,height:`14`,children:(0,a.jsx)(`path`,{d:`M3 8.5 6.5 12 13 4.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})})]},e))})})]})}var Y={root:`_root_1lvdm_1`,root__navigationPane:`_root__navigationPane_1lvdm_12`,root__viewList:`_root__viewList_1lvdm_13`,root__today:`_root__today_1lvdm_26`,root__viewTab:`_root__viewTab_1lvdm_55`,root__viewTab_isActive:`_root__viewTab_isActive_1lvdm_75`,root__viewTab_disabled:`_root__viewTab_disabled_1lvdm_83`,root__viewSelect:`_root__viewSelect_1lvdm_89`};function oe(e){let{goToday:n,changeView:r,view:i}=N(),o=d(),s=e,c={day:{type:`button`,"aria-selected":i===`day`,onClick:(0,t.mergeCallbacks)(void 0,()=>r(`day`)),className:(0,t.cx)(Y.root__viewTab,{[Y.root__viewTab_isActive]:i===`day`}),children:o.day},week:{type:`button`,"aria-selected":i===`week`,onClick:(0,t.mergeCallbacks)(void 0,()=>r(`week`)),className:(0,t.cx)(Y.root__viewTab,{[Y.root__viewTab_isActive]:i===`week`}),children:o.week},month:{type:`button`,"aria-selected":i===`month`,onClick:(0,t.mergeCallbacks)(void 0,()=>r(`month`)),className:(0,t.cx)(Y.root__viewTab,{[Y.root__viewTab_isActive]:i===`month`}),children:o.month}},l={type:`button`,onClick:w(n),className:Y.root__today,children:o.today};return(0,a.jsxs)(`div`,{...s,className:(0,t.cx)(s.className,Y.root),children:[(0,a.jsx)(W,{}),(0,a.jsxs)(`div`,{className:Y.root__navigationPane,role:`group`,children:[(0,a.jsx)(K,{direction:`backward`}),(0,a.jsx)(`button`,{...l}),(0,a.jsx)(K,{direction:`forward`})]}),(0,a.jsxs)(`div`,{className:Y.root__viewList,children:[(0,a.jsx)(`button`,{...c.day}),(0,a.jsx)(`button`,{...c.week}),(0,a.jsx)(`button`,{...c.month})]}),(0,a.jsx)(`div`,{className:Y.root__viewSelect,children:(0,a.jsx)(ae,{})})]})}var se=(0,e.createContext)(void 0);t.isDevEnvironment&&(se.displayName=`CalendarViewportContext`);function ce(){let t=(0,e.useContext)(se);if(!t)throw Error(`CalendarViewportContext is required`);return t}var le={root:`_root_i43d6_1`};function ue({coordinates:e,className:n,style:r,...i}){return(0,a.jsx)(`span`,{tabIndex:-1,...i,className:(0,t.cx)(n,le.root),style:{...r,...e?{top:`calc(${e.y}px + 20px)`,left:`calc(${e.x}px + 20px)`}:null}})}var de={root:`_root_mqfwg_1`,root_isDragging:`_root_isDragging_mqfwg_11`,root_isReturning:`_root_isReturning_mqfwg_20`,"ww-drag-return":`_ww-drag-return_mqfwg_36`,root_isBlocked:`_root_isBlocked_mqfwg_33`},fe={isStart:!0,isEnd:!0};function pe({showPreview:n=!0,pxPerMinute:i=1,...o}){let{eventMap:s,eventRenderer:c,pointerPreviewRenderer:l,view:u}=N(),{viewportRef:d}=ce(),{isDragging:p,canDrop:m,dropData:h,eventItem:g,source:_,x:v,y,...b}=(0,r.useDragAndDrop)(({draggable:e,overlay:t,droppable:n,canDrop:r})=>{let i=[...n.dropTargets.values()].shift(),a=[...e.dragTargets.values()].shift();return{...t.transform,source:[...e.dragTargets.keys()].shift()??null,canDrop:r(),dropData:i,eventItem:a?a.filter(e=>e.event)[0]:null,isDragging:e.isDragging,x:e.x,y:e.y}}),x=(0,e.useMemo)(()=>{if(!g)return null;let{key:e}=JSON.parse(g.event);return s.get(e)?.value??null},[g,s]),S=(0,e.useRef)(null),[C,w]=(0,e.useState)(null);if(f(()=>{if(!p||h){S.current=p?b:null,w(null);return}let e=S.current,t=d.current;if(C||!e||!_||!t)return;let n=_.getBoundingClientRect(),r=t.getBoundingClientRect();w({container:t,style:{left:n.left-r.left,top:n.top-r.top,width:n.width,height:n.height,"--ww-return-left":`${e.left}px`,"--ww-return-top":`${e.top}px`,"--ww-return-width":`${e.width}px`,"--ww-return-height":`${e.height}px`}})}),!p)return null;if(!h)return C?(0,a.jsx)(H,{container:C.container,children:(0,a.jsx)(`div`,{...o,className:(0,t.cx)(o.className,de.root,de.root_isReturning),style:C.style,children:x==null?null:c.current?.(x,u,fe)})}):null;let T=!m;return(0,a.jsxs)(H,{container:d.current,children:[(0,a.jsx)(`div`,{...o,className:(0,t.cx)(o.className,de.root,{[de.root_isDragging]:p,[de.root_isBlocked]:T}),style:{...b},children:x==null?null:c.current?.(x,u,fe)}),n&&!T&&(0,a.jsx)(ue,{coordinates:{x:v,y},children:h?l.current?.(h.date,Math.round(b.top/i),Math.round(b.height/i)):null})]})}function me(e,t){return{...t,...e}}function he(e){return Array.from({length:Math.ceil(e.length/7)},(t,n)=>e.slice(n*7,n*7+7))}function ge(e,t,n){let r=e?.querySelectorAll(`[data-day-index]`)??[],i=-1,a=1/0;for(let e of r){let r=e.getBoundingClientRect(),o=t<r.left?r.left-t:t>=r.right?t-r.right:0,s=n<r.top?r.top-n:n>=r.bottom?n-r.bottom:0,c=Math.hypot(o,s);c<a&&(a=c,i=Number(e.dataset.dayIndex))}return i}var X={root:`_root_diwsf_1`,root__head:`_root__head_diwsf_10`,root__weekday:`_root__weekday_diwsf_20`,root__body:`_root__body_diwsf_30`,root__viewport:`_root__viewport_diwsf_36`,root__week:`_root__week_diwsf_20`,root__day:`_root__day_diwsf_61`,root__day_isOver:`_root__day_isOver_diwsf_85`,root__dayNumber:`_root__dayNumber_diwsf_99`,root__event:`_root__event_diwsf_121`,root__event_span:`_root__event_span_diwsf_150`,root__event_continuesBefore:`_root__event_continuesBefore_diwsf_156`,root__event_continuesAfter:`_root__event_continuesAfter_diwsf_162`,root__event_isResizing:`_root__event_isResizing_diwsf_168`,root__event_isResizeSource:`_root__event_isResizeSource_diwsf_172`,root__resize:`_root__resize_diwsf_177`,root__resizeStart:`_root__resizeStart_diwsf_185`,root__resizeEnd:`_root__resizeEnd_diwsf_189`,root_isResizing:`_root_isResizing_diwsf_193`,root__event_isDragging:`_root__event_isDragging_diwsf_198`,root__dragOverlay:`_root__dragOverlay_diwsf_203`,root__more:`_root__more_diwsf_228`};function _e(n){let{ref:i,targetDate:o,children:s,onDoubleClick:c,...u}=n,{onEventChange:d,onEventCreate:f,getIsDayDisabled:p,disabled:m,eventMap:h}=N(),g=l(),{getHours:_,getMinutes:v,getNow:y}=g,b=(0,e.useRef)(null),{register:x,isOver:S}=(0,r.useDragAndDrop)(({registerDropTarget:e,isOver:t})=>({register:e,isOver:t(b.current)}));(0,e.useEffect)(()=>{let e=b.current;if(e)return x(e,{data:{date:o},onDrop:async e=>{let[n]=await Promise.all(e.items.filter(e=>e.kind===`text`&&e.types.has(`event`)&&`getText`in e).map(async e=>{let t=await e.getText(`event`);return JSON.parse(t)})),r=n&&h.get(n.key);if(!r)return;let i=g.fromMillis(n.day??n.date),a=(0,t.toDayMinutes)(g,i,o)/1440;a!==0&&d(r.key,g.addDays(g.getStartOfDay(r.date),a),{from:_(r.date)*60+v(r.date),duration:r.duration})},getDropOperationForPoint:(e,t)=>m||!e.has(`event`)||p&&p(o)?`cancel`:t[0]})},[g,m,h,_,p,v,d,x,o]);let C=w(e=>{if(c?.(e),e.defaultPrevented||m||p&&p(o))return;let t=y();f(o,{from:_(t)*60+v(t),duration:60})}),T=ee(b,i);return(0,a.jsx)(`div`,{...u,ref:T,onDoubleClick:C,className:(0,t.cx)(u.className,X.root__day,{[X.root__day_isOver]:S}),children:s})}function ve(){let t=(0,e.useRef)(null);return[(0,e.useCallback)((e,n)=>{t.current=setInterval(e,n)},[]),(0,e.useCallback)(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[])]}var ye={x:{[-1]:!1,1:!1},y:{[-1]:!1,1:!1}};function be({delta:e,disabled:t}){let n=O(e);return g(r=>{if(t||!n||!r)return ye;let i={x:Math.sign(e.x-n.x),y:Math.sign(e.y-n.y)};return{x:{[-1]:r.x[-1]||i.x===-1,1:r.x[1]||i.x===1},y:{[-1]:r.y[-1]||i.y===-1,1:r.y[1]||i.y===1}}},[t,e,n])}function xe(n){let{acceleration:r,activator:i=0,canScroll:a,enabled:o,interval:s=5,pointerCoordinates:c,order:l=0,delta:u,threshold:d,activeNodeRect:f,scrollableAncestors:p,scrollableAncestorsRects:m}=n,[h,g]=ve(),_=be({delta:u,disabled:!o}),v=(0,e.useRef)({x:0,y:0}),y=(0,e.useRef)({x:0,y:0}),b=(0,e.useRef)(null),x=(0,e.useMemo)(()=>l===0?[[...p].reverse(),[...m].reverse()]:[[...p],[...m]],[l,p,m]),S=(0,e.useMemo)(()=>{switch(i){case 0:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case 1:return f}},[i,f,c]),C=(0,e.useCallback)(()=>{let e=b.current;if(!e)return;let t=v.current.x*y.current.x,n=v.current.y*y.current.y;e.scrollBy(t,n)},[]);(0,e.useEffect)(()=>{let[e,n]=x;if(!o||!e.length||!S)g();else{for(let[i,o]of e.entries()){if(!o||a?.(o)===!1)continue;let e=n[i];if(!e)continue;let{direction:c,speed:l}=(0,t.getScrollDirectionAndSpeed)(o,e,S,r,d);for(let e of[`x`,`y`])_[e][c[e]]||(l[e]=0,c[e]=0);if(l.x>0||l.y>0){g(),h(C,s),b.current=o,v.current=l,y.current=c;return}}v.current={x:0,y:0},y.current={x:0,y:0},g()}},[r,C,a,o,s,S,p,x,d,g,h,...Object.entries(S||{}),...Object.entries(_),...Object.entries(d||{})])}function Se(t,n=!1){let r=(0,e.useRef)(t);r.current=t;let i=(0,e.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window,{current:t}=r;return new e(t)},[n]);return(0,e.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Ce(n,r=t.getClientRect,i){let[a,o]=(0,e.useReducer)(l,null),s=Se(e=>{if(n)for(let r of e){let{type:e,target:i}=r;if(e===`childList`&&(0,t.isHTMLElement)(i)&&i.contains(n)){o();break}}}),c=p(o);return f(()=>{o(),n?(c?.observe(n),s?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),s?.disconnect())},[n,s,c]),a;function l(e){if(!n)return null;if(n.isConnected===!1)return e??i??null;let a=r(n);return(0,t.shallowEqual)(a,e)?e:a}}var we=[];function Te(n,r){let i=(0,e.useRef)(n),a=(0,e.useMemo)(()=>n?(0,t.getScrollableAncestors)(n,r):we,[n,r]);return(0,e.useEffect)(()=>{i.current=n},[n]),a}var Ee=[];function De(n,r=t.getClientRect){let[i,a]=(0,e.useReducer)(s,Ee),o=p(a);return n.length>0&&i===Ee&&a(),f(()=>{n.length?n.forEach(e=>o?.observe(e)):(o?.disconnect(),a())},[n,o]),i;function s(){return n.length?n.map(e=>{if(e===document.scrollingElement){let n=(0,t.getWindow)(e),r=n.innerWidth,i=n.innerHeight;return{top:0,left:0,right:r,bottom:i,width:r,height:i}}return new t.Rect(r(e),e)}):Ee}}function Oe(n){let[r,i]=(0,e.useState)(null),a=(0,e.useRef)(n),o=(0,e.useCallback)(e=>{let n=(0,t.getScrollableElement)(e.target);n&&i(e=>e?(e.set(n,(0,t.getScrollCoordinates)(n)),new Map(e)):null)},[]);return(0,e.useEffect)(()=>{let e=a.current;if(n!==e){r(e);let s=n.map(e=>{let n=(0,t.getScrollableElement)(e);return n?(n.addEventListener(`scroll`,o,{passive:!0}),[n,(0,t.getScrollCoordinates)(n)]):null}).filter(e=>(0,t.isNotNull)(e));i(s.length?new Map(s):null),a.current=n}return()=>{r(n),r(e)};function r(e){e.forEach(e=>{let n=(0,t.getScrollableElement)(e);n&&n.removeEventListener(`scroll`,o)})}},[o,n]),(0,e.useMemo)(()=>n.length?r?Array.from(r.values()).reduce((e,n)=>(0,t.add)(e,n),t.defaultCoordinates):(0,t.getScrollOffsets)(n):t.defaultCoordinates,[n,r])}function ke(n,r=t.emptyArray){let i=(0,e.useRef)(null);return(0,e.useEffect)(()=>{i.current=null},r),(0,e.useEffect)(()=>{let e=n!==t.defaultCoordinates;e&&!i.current&&(i.current=n),!e&&i.current&&(i.current=null)},[n]),i.current?(0,t.subtract)(n,i.current):t.defaultCoordinates}var Z={Start:`start`,Move:`move`,Stop:`stop`},Ae={isActive:!1,initialTranslate:{x:0,y:0},translate:{x:0,y:0},delta:{x:0,y:0},context:null};function je({autoScrollEnabled:n=!0,modifiers:r=[],activeNode:i=null,containerNode:a=null}){let[o,s]=(0,e.useReducer)(Me,Ae),c=typeof i==`function`?i(o.context):i,l=typeof a==`function`?a(o.context):a,u=Ce(o.isActive?c:null),d=Ce(o.isActive?l:null),f=Te(o.isActive?c:null),p=De(f),m=ke(Oe(f)),h=(0,e.useMemo)(()=>{let e=e=>(t,n)=>{s({type:e,coordinates:t,context:n})};return{start:e(Z.Start),move:e(Z.Move),stop:e(Z.Stop)}},[]),g=(0,t.add)(o.initialTranslate,o.translate);xe({delta:o.translate,enabled:n&&o.isActive,activeNodeRect:u,pointerCoordinates:g,scrollableAncestors:f,scrollableAncestorsRects:p});let _=(0,t.add)(o.translate,m),v=(0,t.adjustScrollRect)(u,m),y=(0,t.adjustScrollRect)(d,m),b=(0,t.applyMoveTransformModifiers)(r,{delta:o.delta,transform:{...o.translate,left:o.translate.x,top:o.translate.y,height:u?.height||0,width:u?.width||0},context:o.context,activeNodeRect:u,containerNodeRect:d,translate:_,initialTranslate:o.initialTranslate});return[{context:o.context,isActive:o.currentAction===`move`,transform:b,translate:o.translate,initialTranslate:o.initialTranslate,containerNodeRect:d,activeNodeRect:u,delta:o.delta},h,{pointerCoordinates:g,scrollAdjustmentActiveNodeRect:v,scrollAdjustmentContainerNodeRect:y}]}function Me(e,n){let r={[Z.Start]:(e,{coordinates:t,context:n})=>({...e,isActive:!0,currentAction:Z.Start,initialTranslate:{...t},context:n}),[Z.Move]:(e,{coordinates:t})=>({...e,currentAction:Z.Move,translate:{x:t.x-e.initialTranslate.x,y:t.y-e.initialTranslate.y},delta:{x:t.x-(e.translate.x+e.initialTranslate.x),y:t.y-(e.translate.y+e.initialTranslate.y)}}),[Z.Stop]:()=>({...Ae,currentAction:Z.Stop})};return(0,t.match)(n.type,r,e,n)}var Ne=6;function Pe(n){let{ref:i,eventData:o,weekDays:s,resizable:c=!1,resize:u,isResizeSource:d=!1,isAnyResizing:f=!1,children:p,...m}=n,{disabled:h}=N(),g=l(),{viewportRef:_}=ce(),v=(0,e.useRef)(null),y=(0,e.useRef)(null),{attributes:b,isDragging:x,overElement:S,register:C,setOverlayTransform:T}=(0,r.useDragAndDrop)(({registerDragSource:e,draggable:t,droppable:n,setTransform:r,isActive:i})=>{let a=i(v.current),[o]=a?[...n.dropTargets].pop()??[null]:[null];return{attributes:t.attributes,isDragging:a,overElement:o,register:e,setOverlayTransform:r}}),E=Ce(x?S:null),[{transform:D,context:O},k]=je({autoScrollEnabled:!1,activeNode:()=>v.current,containerNode:()=>_.current,modifiers:[function({activeNodeRect:e,containerNodeRect:n,transform:r,translate:i,initialTranslate:a}){if(!n||!e||!E)return r;r.x=i.x+a.x-n.left,r.y=i.y+a.y-n.top,r.left=E.left-n.left+Ne,r.width=E.width-12,r.height=e.height;let o=e.top+i.y,s=E.top+t.MONTH_WEEK_GEOMETRY.header,c=E.top+E.height-e.height;return r.top=Math.max(s,Math.min(o,c))-n.top,r}]}),ne=w(e=>{O===`overlay`&&T(e)});(0,e.useEffect)(()=>{ne(D)},[ne,...Object.values(D)]);let A=w(()=>{let e=y.current??s[o.column],t={...o,date:g.toMillis(o.date),day:e&&g.toMillis(e)};return[{event:JSON.stringify(t)}]});(0,e.useEffect)(()=>{if(v.current&&!h)return C(v.current,{getItems:A,onDragStart(e){k.start({x:e.x,y:e.y},`overlay`)},onDragMove(e){k.move({x:e.x,y:e.y})},onDragEnd(e){k.stop({x:e.x,y:e.y})},getAllowedDropOperations(){return[`move`]}})},[k,h,A,C]);let j=e=>{e.stopPropagation();let t=e.currentTarget.parentElement;if(!t)return;let n=t.getBoundingClientRect(),r=Math.floor((e.clientX-n.left)/n.width*s.length),i=Math.min(Math.max(r,o.column),o.column+o.span-1);y.current=s[i]??null},re=e=>({onMoveStart:()=>(u?.start(o.key,e),!0),onMove:e=>u?.move(e.clientX,e.clientY),onMoveEnd:()=>u?.end()}),{listeners:M}=te(re(`start`)),{listeners:P}=te(re(`end`)),F=ee(v,i),I=o.span>1||!o.isStart||!o.isEnd,L=me({"--ww-column":o.column+1,"--ww-span":o.span,"--ww-row":o.lane+2},m.style);return(0,a.jsxs)(`div`,{...m,...f?null:b,ref:F,style:L,"data-key":String(o.key),"data-continues-before":o.isStart?void 0:``,"data-continues-after":o.isEnd?void 0:``,onPointerDown:j,onDoubleClick:e=>e.stopPropagation(),className:(0,t.cx)(m.className,X.root__event,{[X.root__event_span]:I,[X.root__event_continuesBefore]:!o.isStart,[X.root__event_continuesAfter]:!o.isEnd,[X.root__event_isDragging]:x,[X.root__event_isResizeSource]:d}),children:[p,c&&o.isStart&&(0,a.jsx)(`div`,{...M,"data-edge":`start`,className:(0,t.cx)(X.root__resize,X.root__resizeStart)}),c&&o.isEnd&&(0,a.jsx)(`div`,{...P,"data-edge":`end`,className:(0,t.cx)(X.root__resize,X.root__resizeEnd)})]})}function Fe({bar:e,children:n}){return(0,a.jsx)(`div`,{"aria-hidden":`true`,"data-key":String(e.key),"data-continues-before":e.isStart?void 0:``,"data-continues-after":e.isEnd?void 0:``,className:(0,t.cx)(X.root__event,X.root__event_isResizing,{[X.root__event_span]:e.span>1||!e.isStart||!e.isEnd,[X.root__event_continuesBefore]:!e.isStart,[X.root__event_continuesAfter]:!e.isEnd}),style:me({"--ww-column":e.column+1,"--ww-span":e.span,"--ww-row":e.lane+2}),children:n})}function Ie(e){let{days:t,firstDayIndex:n,layout:r,sourceBars:i,lanes:o,resizingKey:s,resize:c}=e,{viewValue:u,eventRenderer:f,view:p,disabled:m}=N(),{getMonthDay:h,isSameMonth:g,isToday:_,toMillis:v}=l(),y=d(),b=s!==void 0,x=e=>f.current?.(e.value,p,{isStart:e.isStart,isEnd:e.isEnd}),S=(e,n=!1)=>(0,a.jsx)(Pe,{eventData:e,weekDays:t,resizable:!m,resize:c,isResizeSource:n,isAnyResizing:b,children:x(e)},e.key);return(0,a.jsxs)(`div`,{className:X.root__week,children:[t.map((e,t)=>(0,a.jsx)(_e,{targetDate:e,"data-day-index":n+t,"data-is-outside":!g(e,u)||void 0,"data-is-today":_(e)?!0:void 0,style:me({"--ww-column":t+1}),children:(0,a.jsx)(`span`,{className:X.root__dayNumber,children:h(e)})},v(e))),[...r.bars.map(e=>e.key===s?(0,a.jsx)(Fe,{bar:e,children:x(e)},`preview-${e.key}`):S(e)),...i.map(e=>S(e,!0))],t.map((e,t)=>r.hidden[t]>0&&(0,a.jsx)(`span`,{className:X.root__more,style:me({"--ww-column":t+1,"--ww-row":o+2}),children:y.more(r.hidden[t])},`more-${v(e)}`))]})}function Le(n,r){let[i,a]=(0,e.useState)(r),o=()=>{let e=n.current?.firstElementChild;e?.clientHeight&&a((0,t.getMonthLaneCount)(e.clientHeight,r))},s=p(o);return f(()=>{o();let e=n.current?.firstElementChild;return e&&s?.observe(e),()=>{e&&s?.unobserve(e)}},[s,r]),i}function Re(n){let{days:r,viewportRef:i,dateUtils:a,eventMap:o,disabled:s,getIsDayDisabled:c,onEventChange:l}=n,[u,d,f]=A(null),{addGlobalListener:p,removeAllGlobalListeners:m}=T(),h=w((e=!0)=>{let t=f.current;t&&(m(),d(null),e&&t.result&&l(t.key,t.result.date,t.result.info))}),g=w(e=>{e.key===`Escape`&&h(!1)}),_=w((e,t)=>{s||f.current||(d({key:e,edge:t,result:null}),p(document,`keydown`,g,!0))}),v=w((e,n)=>{let s=f.current,l=s&&o.get(s.key),u=r[ge(i.current,e,n)];s&&l&&u&&!c?.(u)&&d({...s,result:(0,t.resizeEventDays)(a,l,s.edge,u)})}),y=(0,e.useMemo)(()=>({start:_,move:v,end:h}),[h,v,_]),b=(0,e.useMemo)(()=>{let e=u?.result&&o.get(u.key);if(!u?.result||!e)return o;let[n]=(0,t.getEventTimeFrameFromInfo)(a,u.result.date,u.result.info);return new Map(o).set(u.key,{...e,date:n,duration:u.result.info.duration})},[a,o,u]);return{resizingKey:u?.key,actions:y,eventMap:b}}var ze=[];function Be(n){let{className:r,style:i,...o}=n,{viewValue:s,eventMap:c,startWeek:u,disabled:d,getIsDayDisabled:f,onEventChange:p}=N(),m=l();re();let h=(0,e.useRef)(null),g=(0,e.useMemo)(()=>(0,t.getMonthGrid)(m,s,u),[m,u,s]),_=(0,e.useMemo)(()=>he(g),[g]),v=(0,e.useMemo)(()=>(0,t.getWeekdayNames)(m,u),[m,u]),y=Re({days:g,viewportRef:h,dateUtils:m,eventMap:c,disabled:d,getIsDayDisabled:f,onEventChange:p}),b=Le(h,3),x=(0,e.useMemo)(()=>_.map(e=>(0,t.arrangeMonthWeek)(c,m,e,b)),[m,c,b,_]),S=(0,e.useMemo)(()=>y.eventMap===c?x:_.map(e=>(0,t.arrangeMonthWeek)(y.eventMap,m,e,b)),[m,c,b,x,y.eventMap,_]),C=(0,e.useMemo)(()=>({viewportRef:h}),[]);return(0,a.jsxs)(se.Provider,{value:C,children:[(0,a.jsxs)(`div`,{...o,className:(0,t.cx)(r,X.root,{[X.root_isResizing]:y.resizingKey!==void 0}),style:me({"--ww-month-lanes":b},i),children:[(0,a.jsx)(`div`,{className:X.root__head,children:v.map(e=>(0,a.jsx)(`div`,{className:X.root__weekday,children:e},e))}),(0,a.jsx)(`div`,{className:X.root__body,children:(0,a.jsx)(`div`,{ref:h,className:X.root__viewport,children:_.map((e,t)=>(0,a.jsx)(Ie,{days:e,firstDayIndex:t*7,layout:S[t],sourceBars:y.resizingKey===void 0?ze:x[t].bars.filter(e=>e.key===y.resizingKey),lanes:b,resizingKey:y.resizingKey,resize:y.actions},m.toMillis(e[0])))})})]}),(0,a.jsx)(pe,{className:X.root__dragOverlay,showPreview:!1})]})}var Ve=1440;function He(n){let{days:r,viewportRef:i,dateUtils:a,bounds:o,timeStep:s,preventOutBoundsChanges:c}=n,[l,u]=(0,e.useState)(null),d=(0,e.useRef)(null),f=(0,e.useRef)(n);f.current=n;let p=o.hideMinMaxTime?o.hourMin*60:0,m=o.hideMinMaxTime?(o.hourMax-o.hourMin)*60:Ve,h=(0,e.useCallback)((e,n)=>{let l=d.current,p=i.current;if(!l||!p)return;l.x=e,l.y=n;let{disabled:h,getIsDayDisabled:g}=f.current,_=[...p.querySelectorAll(`[data-day-index]`)],v=p.getBoundingClientRect(),y=(e=>Math.round(e/s)*s)(Math.min(Math.max((n-v.top)/v.height*m,0),m)),b=0,x=1/0;_.forEach(t=>{let n=t.getBoundingClientRect(),r=e<n.left?n.left-e:e>n.right?e-n.right:0;r<x&&(x=r,b=Number(t.dataset.dayIndex))});let S=(0,t.resizeEventRange)({start:l.original[0],end:l.original[1]},l.edge,b,y,{dayCount:r.length,bounds:o,timeStep:s,crossDays:!c||o.hourMin<=0&&o.hourMax>=24,getFrame:e=>{if(!c)return[0,m];let[n,i]=(0,t.getTimeFrame)(a,r[e],o);return[Math.ceil(n/s)*s,Math.min(Math.ceil(i/s)*s,m)]},canEditDay:e=>!h&&!g?.(r[e])&&!(c&&(0,t.isPastDay)(a,r[e]))});S&&(l.range=S),u({key:l.key,range:l.range,x:e,y:n,blocked:!S})},[o,a,r,c,s,m,i]),g=(0,e.useMemo)(()=>({start(e,n,i,o){let s=f.current.eventMap.get(e);if(!s||!r[0])return;let c=(0,t.toDayMinutes)(a,r[0],s.date),l=[c,c+s.duration];d.current={key:e,edge:n,original:l,range:l,x:i,y:o},u({key:e,range:l,x:i,y:o,blocked:!1})},move:h,end(){let e=d.current;if(d.current=null,u(null),!e)return;let[n,i]=e.range;if(n===e.original[0]&&i===e.original[1])return;let o=Math.floor(n/Ve);f.current.onEventChange(e.key,(0,t.fromDayMinutes)(a,r[0],o*Ve),{from:n-o*Ve,duration:i-n})}}),[a,r,h]),_=l!==null;(0,e.useEffect)(()=>{if(!_)return;let e=()=>d.current&&h(d.current.x,d.current.y);return document.addEventListener(`scroll`,e,!0),()=>document.removeEventListener(`scroll`,e,!0)},[_,h]);let v=l?.blocked??!1;return(0,e.useEffect)(()=>{if(v)return document.documentElement.classList.add(`ww-cursor-not-allowed`),()=>document.documentElement.classList.remove(`ww-cursor-not-allowed`)},[v]),{state:l,actions:g,previewOf:e=>{let n=Math.floor(e[0]/Ve);return{date:(0,t.fromDayMinutes)(a,r[0],n*Ve),top:e[0]-n*Ve-p,duration:e[1]-e[0]}}}}var Ue=(0,e.createContext)(void 0);t.isDevEnvironment&&(Ue.displayName=`DayWeekViewContext`);function We(){let t=(0,e.useContext)(Ue);if(!t)throw Error(`DayWeekViewContext is required`);return t}function Ge(n=!0,r=6e4){let{hideMinMaxTime:i,hourMin:a,hourMax:o}=N(),s=l(),c=()=>(0,t.getNowOffset)(s,{hourMin:a,hourMax:o,hideMinMaxTime:i}),[u,d]=(0,e.useState)([0,!0]);return j(()=>d(c()),r,n),u}var Ke={root:`_root_6z2c5_1`,root_timeLimit:`_root_timeLimit_6z2c5_8`,root_isToday:`_root_isToday_6z2c5_8`,root_isPast:`_root_isPast_6z2c5_18`,root__container:`_root__container_6z2c5_36`,root__spotlight:`_root__spotlight_6z2c5_57`,root__timeLine:`_root__timeLine_6z2c5_67`,root_offLimits:`_root_offLimits_6z2c5_119`};function qe(n){let{ref:i,targetDate:o,children:s,...c}=n,{onEventChange:u,onEventCreate:d,getIsDayDisabled:f,pointerPreviewRenderer:p,eventMap:m,...h}=N(),{viewportRef:g,getTimeFrame:_,pxPerMinute:v}=We(),{hideMinMaxTime:y,preventOutBoundsChanges:b,timeStep:x,hourMin:S,hourMax:C,disabled:w}=h,T=l(),{isBefore:E,isToday:D}=T,O=x*v,k=e=>Je(e,v,x),ne=e=>_(e).map(e=>e*v),A=(0,e.useRef)(null),j=(0,e.useRef)(null),{register:M,getTransform:P}=(0,r.useDragAndDrop)(({registerDropTarget:e,getTransform:t})=>({register:e,getTransform:t})),F=re(),I=(0,e.useMemo)(()=>{let e=D(o);return{isToday:e,isPast:E(o)&&!e}},[E,D,o,F]),[{isActive:L,transform:R},z,{scrollAdjustmentActiveNodeRect:B}]=je({activeNode:A.current,containerNode:A.current?.parentElement,modifiers:[function({activeNodeRect:e,initialTranslate:t,translate:n,transform:r}){if(!e)return r;let i=t.y-e.top;r.x=r.left+t.x,r.y=r.top+t.y,r.top=Math.floor(i/O)*O,r.height=O,r.left=0,r.width=e.width;let a;return n.y>0?(a=O-i%O,r.height=Math.ceil((r.height+n.y-a)/O)*O):(a=i%O,r.height=Math.ceil((r.height-n.y-a)/O)*O,r.top-=r.height-O),r.height=Math.max(r.height,O),r},function({transform:e}){if(!b)return e;let[t,n]=_(o).map(e=>Math.ceil(e/x)*O);return e.top<t&&(e.height=Math.max(e.height-(t-e.top),O),e.top=t),e.height+e.top>=n&&(e.height=Math.max(n-e.top,O)),e},t.boundingResizableContainerModifier,(0,t.getTimeStepEqualizerModifier)(O)]}),[V,ie]=Ge(I.isToday);(0,e.useEffect)(()=>{let e=A.current;if(e)return M(e,{data:{date:o},onDrop:async e=>{let[n]=await Promise.all(e.items.filter(e=>e.kind===`text`&&e.types.has(`event`)&&`getText`in e).map(async e=>{let t=await e.getText(`event`);return JSON.parse(t)})),r=P(),i=Je(r.top,v,x),a=Je(r.height,v,x),s=y?S*60:0,c=m.get(n.key),l=c?(0,t.toDayMinutes)(T,c.date,c.date):0;if(c&&l+c.duration>1440){if(b&&(S>0||C<24)){z.stop({x:e.x,y:e.y});return}let r=T.getStartOfDay(T.fromMillis(n.date)),a=(0,t.toDayMinutes)(T,c.date,r)+s+n.start-l,d=s+i-a,f=Math.floor(d/1440);u(n.key,T.addDays(o,f),{from:d-f*24*60,duration:c.duration})}else y?u(n.key,o,{from:i+S*60,duration:a}):u(n.key,o,{from:i,duration:a});z.stop({x:e.x,y:e.y})},getDropOperationForPoint:(e,t)=>{if(w||!e.has(`event`)||f&&f(o))return`cancel`;let{isPast:n,isToday:r}=I;if(b){if(!r&&n)return`cancel`;let[e,t]=_(o).map(e=>e*v),i=P();if(i.y<e||i.y>t||r&&i.height>t-e)return`cancel`}return t[0]}})},[z,T,w,m,f,_,P,y,C,S,u,b,v,M,o,x,I]);let{listeners:U}=te({distance:Math.max(Math.min(5,x),1),onMoveStart:e=>{if(!w){if(b){let{isToday:e,isPast:t}=I;if(t&&!e)return!1}z.start({x:e.clientX,y:e.clientY})}},onMove:e=>{if(L)z.move({x:e.clientX,y:e.clientY});else if(B){if(b){let[t,n]=ne(o),r=e.clientY-B.top;if(r<t||r>n){z.stop({x:e.clientX,y:e.clientY});return}}L||z.move({x:e.clientX,y:e.clientY})}},onMoveEnd:e=>{z.stop({x:e.clientX,y:e.clientY}),L&&(y?d(o,{from:k(R.top)+S*60,duration:k(R.height)}):d(o,{from:k(R.top),duration:k(R.height)}))}}),W=ee(A,i),G=(0,t.formatNowOffset)(T,V,{hourMin:S,hideMinMaxTime:y}),K=()=>p.current?.(o,k(R.top),k(R.height));return(0,a.jsxs)(`div`,{...c,...U,ref:W,className:(0,t.cx)(c.className,Ke.root,{[Ke.root_timeLimit]:b,[Ke.root_isToday]:I.isToday,[Ke.root_isPast]:I.isPast,[Ke.root_offLimits]:ie}),style:{...c.style,"--offset":V},children:[I.isToday&&!ie&&(0,a.jsx)(H,{container:g.current,children:(0,a.jsx)(`span`,{tabIndex:-1,className:Ke.root__timeLine,"data-now":G,style:{"--offset":V}})}),(0,a.jsx)(`div`,{ref:j,className:Ke.root__container,children:s}),L&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{className:Ke.root__spotlight,style:R?{...R}:void 0}),(0,a.jsx)(ue,{coordinates:{x:R.x,y:R.y},children:K()})]})]})}function Je(e,t,n){return Math.round(e/t/n)*n}function Ye(n,r){let[i,a]=(0,e.useState)(null);return f(()=>{let e=n.current,i=n.current?.parentElement;if(e&&i){let{height:n,width:o,...s}=(0,t.getClientRect)(e),{left:c,top:l}=(0,t.subtract)(s,(0,t.getClientRect)(i));a((0,t.round)(r,{height:n,width:o,x:c,y:l}))}},[n,...Object.values(r)]),i}function Xe(t,n){let[r,i]=(0,e.useState)(!0),{preventOutBoundsChanges:a}=N(),{isBefore:o,isToday:s}=l(),{getTimeFrame:c}=We();return f(()=>{if(n&&a){if(o(t)&&!s(t))i(!1);else if(s(t)){let{height:e,y:r}=n,a=e+r,[o,s]=c(t);i(a>o&&r<s)}}},[t,n,c,a,o,s]),r}var Q={root:`_root_1qnpq_1`,root_isDragging:`_root_isDragging_1qnpq_7`,root__resizeTop:`_root__resizeTop_1qnpq_7`,root__resizeBottom:`_root__resizeBottom_1qnpq_9`,root_isResizing:`_root_isResizing_1qnpq_11`,root_isDisabled:`_root_isDisabled_1qnpq_38`,root__container:`_root__container_1qnpq_54`,root__dragPreview:`_root__dragPreview_1qnpq_97`,root_isPreview:`_root_isPreview_1qnpq_103`,root_isResizeSource:`_root_isResizeSource_1qnpq_108`};function Ze(n){let{ref:i,eventData:o,children:s,...c}=n,{eventMap:u,...d}=N(),f=l(),{timeStep:p,preventOutBoundsChanges:m,disabled:h}=d,g=(0,e.useRef)(null),_=(0,e.useRef)(null),v=(0,e.useRef)(null),{viewportRef:y,getTimeFrame:b,pxPerMinute:x,resize:S,resizing:C}=We(),T=p*x,E=Ye(g,o.rect),D=Xe(u.get(o.key)?.date??o.date,E),{attributes:O,isDragging:k,overElement:ne,overData:A,register:j,setOverlayTransform:re}=(0,r.useDragAndDrop)(({registerDragSource:e,draggable:t,droppable:n,setTransform:r,isActive:i})=>{let a=i(g.current),[o,s]=a?[...n.dropTargets].pop()??[null,null]:[null,null];return{attributes:t.attributes,overElement:o,overData:s,isDragging:a,register:e,setOverlayTransform:r}}),M=Ce(k?ne:null),[{isActive:P,transform:F,context:I},L]=je({autoScrollEnabled:!k,activeNode:e=>e===`overlay`?g.current:e===`top`?_.current:v.current,containerNode:e=>e===`overlay`?y.current:g.current?.parentElement?.parentElement??null,modifiers:[function({activeNodeRect:e,containerNodeRect:t,context:n,transform:r,translate:i,initialTranslate:a}){if(n!==`overlay`||!t||!e||!M)return r;r.x=i.x+a.x-t.left,r.y=i.y+a.y-t.top,r.left=M.left-t.left,r.width=M.width,r.top=e.top-t.top,r.height=e.height;let o;return i.y>0?(o=T-(a.y-e.top)%T,r.top+=Math.ceil((i.y-o)/T)*T):(o=(a.y-e.top)%T,r.top+=Math.floor((i.y+o)/T)*T),r},function({transform:e,context:t}){if(!m||t!==`overlay`||!A)return e;let[n,r]=b(A.date).map(e=>Math.ceil(e/p)*T);return e.top<n&&(e.top=n),e.top+e.height>r&&(e.top=r-e.height),e},Qe(T)]}),R=(0,t.mergeCallbacks)(()=>S.end(),e=>{L.stop({x:e.clientX,y:e.clientY})}),z=e=>({onMoveStart:t=>(L.start({x:t.clientX,y:t.clientY},e),S.start(o.key,e,t.clientX,t.clientY),!0),onMove:e=>{L.move({x:e.clientX,y:e.clientY}),S.move(e.clientX,e.clientY)},onMoveEnd:R}),{listeners:B}=te(z(`bottom`)),{listeners:V}=te(z(`top`)),ie=ee(g,i),H=P&&k&&I===`overlay`,U=C?.key===o.key,W=w(e=>{I===`overlay`&&re(e)});(0,e.useEffect)(()=>{W(F)},[W,...Object.values(F)]),(0,e.useEffect)(()=>{if(!g.current)return;let e={...(0,t.omit)(o,`rect`),date:f.toMillis(o.date)},n=[{event:JSON.stringify(e)}];return j(g.current,{getItems(){return n},onDragStart(e){L.start({x:e.x,y:e.y},`overlay`)},onDragMove(e){L.move({x:e.x,y:e.y})},onDragEnd(e){L.stop({x:e.x,y:e.y})},getAllowedDropOperations(){return[`move`]}})},[L,o,j]);let G=(0,t.cx)(c.className,Q.root,{[Q.root_isDragging]:H,[Q.root_isResizeSource]:U,[Q.root_isDisabled]:h}),K={...c.style,top:`${o.rect.y}%`,left:`${o.rect.x}%`,width:`${o.rect.width}%`,height:`${o.rect.height}%`},q=w((0,t.mergeCallbacks)(c.onPointerDown,e=>e.stopPropagation()));return(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(`div`,{...c,...O,ref:ie,className:G,style:K,onPointerDown:q,"data-continues-before":o.isStart?void 0:``,"data-continues-after":o.isEnd?void 0:``,children:[D&&o.isStart&&(0,a.jsx)(`div`,{...V,ref:_,className:Q.root__resizeTop}),(0,a.jsx)(`div`,{role:`button`,tabIndex:0,className:Q.root__container,children:s}),D&&o.isEnd&&(0,a.jsx)(`div`,{...B,ref:v,className:Q.root__resizeBottom})]})})}function Qe(e){return n=>{let r=[(0,t.getTimeStepEqualizerModifier)(e)];return n.context===`overlay`&&r.push(t.boundingDraggableContainerModifier),(0,t.applyMoveTransformModifiers)(r,n)}}function $e({part:e,timelineMinutes:t,children:n}){let r=e=>`${e/t*100}%`;return(0,a.jsx)(`div`,{"aria-hidden":`true`,className:`${Q.root} ${Q.root_isResizing} ${Q.root_isPreview}`,"data-continues-before":e.isStart?void 0:``,"data-continues-after":e.isEnd?void 0:``,style:{top:r(e.start),height:r(e.duration),left:0,width:`100%`},children:(0,a.jsx)(`div`,{className:Q.root__container,children:n})})}var $={root:`_root_1140w_1`,root_scrollable:`_root_scrollable_1140w_10`,root__body:`_root__body_1140w_10`,root__head:`_root__head_1140w_14`,root__main:`_root__main_1140w_29`,root__viewport:`_root__viewport_1140w_43`,root__column:`_root__column_1140w_51`,root__headerCell:`_root__headerCell_1140w_76`,root__headerCellDay:`_root__headerCellDay_1140w_103`,root__headerCellLabel:`_root__headerCellLabel_1140w_110`,root__headerCellName:`_root__headerCellName_1140w_117`,root__headerCellToday:`_root__headerCellToday_1140w_124`,root__row:`_root__row_1140w_139`,root__timeStep:`_root__timeStep_1140w_161`,root__timeStep_overTime:`_root__timeStep_overTime_1140w_173`,root__rowHeadTime:`_root__rowHeadTime_1140w_177`,root__hiddenEventsLayer:`_root__hiddenEventsLayer_1140w_191`,root__hiddenEventsColumn:`_root__hiddenEventsColumn_1140w_204`,root__hiddenEvents:`_root__hiddenEvents_1140w_191`,root__hiddenEventsIcon:`_root__hiddenEventsIcon_1140w_251`};function et({scrollerRef:n,columns:r,rowHeight:i}){let{hourMin:o,hideMinMaxTime:s,size:c}=N(),u=l(),f=d(),{addGlobalListener:m,removeGlobalListener:h}=T(),[g,_]=(0,e.useState)(null),v=i/60,y=w(()=>{let e=n.current;if(!e)return;let t={top:e.scrollTop,height:e.clientHeight};_(e=>e?.top===t.top&&e.height===t.height?e:t)}),b=p(y);(0,e.useEffect)(()=>{let e=n.current;if(e)return y(),m(e,`scroll`,y,{passive:!0}),b?.observe(e),()=>{h(e,`scroll`,y),b?.unobserve(e)}},[m,y,h,b,n]),(0,e.useEffect)(y,[y,i,r]);let x=(0,e.useMemo)(()=>g&&g.height>0?r.map(e=>(0,t.getHiddenEvents)(e,v,g.top,g.height)):null,[r,v,g]);if(!x||!g)return null;let S=e=>n.current?.scrollTo({top:(0,t.getRevealScrollTop)(e,v,g.top,g.height),behavior:`smooth`}),C=(e,n)=>{let[r]=e;if(!r)return null;let i=e.length===1&&c!==`narrow`?(0,t.formatNowOffset)(u,r.start,{hourMin:o,hideMinMaxTime:s}):e.length;return(0,a.jsxs)(`button`,{type:`button`,className:$.root__hiddenEvents,"data-direction":n,"aria-label":n===`above`?f.earlier(e.length):f.later(e.length),onClick:()=>S(r),children:[(0,a.jsx)(L,{"aria-hidden":`true`,className:$.root__hiddenEventsIcon}),i]})};return(0,a.jsxs)(`div`,{className:$.root__hiddenEventsLayer,children:[(0,a.jsx)(`div`,{}),x.map(({above:e,below:t},n)=>(0,a.jsxs)(`div`,{className:$.root__hiddenEventsColumn,children:[C(e,`above`),C(t,`below`)]},n))]})}function tt(t,n,r){let[i,a]=(0,e.useState)();return f(()=>{let e=!1,n=()=>{let n=t.current;if(e||!n)return;let i=0,o=document.createRange();if(typeof o.getBoundingClientRect!=`function`)return;for(let e of n.querySelectorAll(`time`)){o.selectNodeContents(e);let t=getComputedStyle(e),n=o.getBoundingClientRect().width;i=Math.max(i,n+parseFloat(t.paddingLeft)+parseFloat(t.paddingRight))}let s=n.closest(`.${$.root}`)?.parentElement??document.body,c=parseFloat(getComputedStyle(s).getPropertyValue(`--ww-time-column`));a(i>(Number.isNaN(c)?r:c)?Math.ceil(i):void 0)};return n(),document.fonts?.ready.then(n),()=>{e=!0}},[r,n.join(`|`),t]),i}var nt={regular:64,compact:44,narrow:40};function rt({rowHeight:n,...r}){let{viewValue:i,hourMin:o,hourMax:s,view:c,eventMap:u,preventOutBoundsChanges:f,eventRenderer:p,timeStep:m,scrollable:h,size:g,hideMinMaxTime:_,disabled:v,getIsDayDisabled:y,onEventChange:b,pointerPreviewRenderer:x}=N(),S=l(),C=d(),{getMonthDay:w,getWeekDay:T,isToday:E,weekDayShortName:D}=S,te=re(),O=n??t.ROW_HEIGHTS[g],k=(0,e.useRef)(null),A=(0,e.useRef)(null),j=(0,e.useMemo)(()=>(0,t.buildTimeRows)(S,m,{hourMin:o,hourMax:s,hideMinMaxTime:_},f),[S,m,o,s,_,f]),M=tt(k,(0,e.useMemo)(()=>j.map(({time:e})=>e),[j]),nt[g]),P=(0,e.useMemo)(()=>(0,t.getVisibleDays)(S,c,i),[S,c,i]),F=(0,e.useMemo)(()=>({hourMin:o,hourMax:s,hideMinMaxTime:_}),[o,s,_]),I=(0,e.useMemo)(()=>(0,t.arrangeEventsByDay)(u,S,j.length*60,P,F),[u,S,j.length,P,F]),L=(0,e.useMemo)(()=>I.map(({events:e})=>e),[I]),{state:R,actions:z,previewOf:B}=He({days:P,viewportRef:k,dateUtils:S,bounds:F,timeStep:m,preventOutBoundsChanges:f,disabled:v,getIsDayDisabled:y,eventMap:u,onEventChange:b}),V=(0,e.useMemo)(()=>R?(0,t.splitIntoDays)(R.range[0],R.range[1],P.length,F):[],[R,P.length,F]),ie=R?u.get(R.key)?.value:void 0,H=(0,e.useCallback)(e=>(0,t.getTimeFrame)(S,e,{hourMin:o,hourMax:s,hideMinMaxTime:_}),[S,_,s,o]),U=(0,e.useMemo)(()=>P.map((e,t)=>{let n=T(e),r=E(e),i=I[t]?.events??[];return{attributes:r?{"data-is-today":!0}:void 0,events:i,day:w(e),isToday:r,targetDate:e,weekDayName:D(n),weekDayNumber:n}}),[te,S,P,I,w,T,E,D]),W=ne(),G=r,K=$.root__head,q=$.root__body,J=$.root__viewport,ae=$.root__column,Y=$.root__headerCell,oe=$.root__headerCellDay,ce=$.root__row,le=$.root__rowHeadTime,de=$.root__timeStep,fe=ee(k),me=(0,e.useMemo)(()=>({viewportRef:k,getTimeFrame:H,pxPerMinute:O/60,resize:z,resizing:R}),[k,H,O,z,R]),he=(0,e.useMemo)(()=>({viewportRef:k}),[k]),ge=(e,t)=>(0,a.jsx)(Ze,{"data-idx":t,eventData:e,children:p.current?.(e.value,c,{isStart:e.isStart,isEnd:e.isEnd})},e.key);return(0,a.jsx)(Ue.Provider,{value:me,children:(0,a.jsx)(se.Provider,{value:he,children:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(`div`,{...G,className:(0,t.cx)(G.className,$.root,{[$.root_scrollable]:h}),style:{...G.style,"--calendar-column-count":U.length,"--scrollbar-width":W.width,"--scrollbar-height":W.height,...M!==void 0&&{"--ww-time-column":`${M}px`}},children:[(0,a.jsxs)(`div`,{className:K,children:[(0,a.jsx)(`div`,{className:Y}),U.map(e=>(0,a.jsxs)(`div`,{className:Y,...e.attributes,children:[(0,a.jsx)(`span`,{className:oe,children:e.day}),(0,a.jsxs)(`span`,{className:$.root__headerCellLabel,children:[(0,a.jsx)(`span`,{className:$.root__headerCellName,children:e.weekDayName}),e.isToday&&(0,a.jsx)(`span`,{className:$.root__headerCellToday,children:C.today})]})]},e.weekDayNumber))]}),(0,a.jsxs)(`div`,{className:$.root__main,children:[(0,a.jsx)(`div`,{ref:A,className:q,children:(0,a.jsxs)(`div`,{ref:fe,className:J,style:{height:j.length*O},children:[(0,a.jsx)(`div`,{className:ae,children:j.map(({time:e,value:n,steps:r},i)=>(0,a.jsxs)(`div`,{className:ce,style:{height:O,"--translateY":i*O,"--calendar-rows-count":r.length},children:[(0,a.jsx)(`time`,{className:le,children:e}),r.map(([e,,n])=>(0,a.jsx)(`div`,{className:(0,t.cx)(de,{[$.root__timeStep_overTime]:n})},e))]},n))}),U.map((e,t)=>(0,a.jsx)(`div`,{className:ae,"data-day-index":t,...e.attributes,children:(0,a.jsxs)(qe,{id:`${e.weekDayNumber}`,targetDate:e.targetDate,children:[e.events.map((e,t)=>ge(e,t)),V.filter(e=>e.dayIndex===t).map(e=>(0,a.jsx)($e,{part:e,timelineMinutes:j.length*60,children:ie===void 0?null:p.current?.(ie,c,{isStart:e.isStart,isEnd:e.isEnd})},`resize`))]})},e.weekDayNumber))]})}),h&&(0,a.jsx)(et,{scrollerRef:A,columns:L,rowHeight:O})]})]}),(0,a.jsx)(pe,{pxPerMinute:O/60}),R&&!R.blocked&&(0,a.jsx)(ue,{coordinates:{x:R.x,y:R.y},children:(()=>{let{date:e,top:t,duration:n}=B(R.range);return x.current?.(e,t,n)})()})]})})})}var it={root:`_root_1jr3p_2`,root__head:`_root__head_1jr3p_22`,root__body:`_root__body_1jr3p_26`,root__body_readonly:`_root__body_readonly_1jr3p_35`};function at(i){let{ref:o,disabled:s=!1,children:c,hideMinMaxTime:u=!1,timeFrame:d,startWeek:f,timeStep:p=15,items:g,onEventCreate:_,onEventChange:v,onEventDelete:y,onEventEdit:b,eventTimeFrameResolver:S,eventKeyResolver:C,getIsDayDisabled:T,pointerPreviewFormat:E,scrollable:D=!1,view:te,defaultView:O,viewValue:k,defaultViewValue:ne,onChangeView:A,onChangeViewValue:j,...re}=i,{hourMax:N,hourMin:L}={hourMin:0,hourMax:24,...d},R=h({eventTimeFrameResolver:S,eventKeyResolver:C}),z=l(),B=f??z.weekStartsOn,V=(0,e.useRef)(null),ie=ee(V,o),{viewValue:H,changeViewValue:U,view:W,changeView:G}=F({view:te,defaultView:O,viewValue:k,defaultViewValue:ne,onChangeView:A,onChangeViewValue:j,dateUtils:z,startWeek:B}),K=m(V),q=x(n.createDragAndDropApi).current,J=(0,e.useMemo)(()=>(0,t.buildEventMap)(g,R.current,z,{hourMin:L,hideMinMaxTime:u}),[z,u,L,g,R]),{goBackward:ae,goForward:Y,goToday:se}=I({changeViewValue:U,dateUtils:z,startWeek:B,view:W,viewValue:H}),ce=w((e,n,r)=>{let i=J.get(e);i&&v?.(i.value,...(0,t.getEventTimeFrameFromInfo)(z,n,r))}),le=w((e,n)=>{_?.(...(0,t.getEventTimeFrameFromInfo)(z,e,n))}),ue=w(e=>{let t=J.get(e);t&&b?.(t.value)}),de=w(e=>{let t=J.get(e);t&&y?.(t.value)}),fe=h((e,n,r)=>{let[i,a]=(0,t.getTimelineRange)(z,e,n,r,{hourMin:L,hideMinMaxTime:u});return E?E(i,a):(0,t.formatTimelineRange)(z,i,a)}),pe=h(c);(0,e.useEffect)(()=>{if(V.current)return q.getState().registerRootElement(V.current)},[q]);let me={...re,ref:ie},he=(0,e.useMemo)(()=>({disabled:s,getIsDayDisabled:T,preventOutBoundsChanges:!!d,changeView:G,changeViewValue:U,eventMap:J,goBackward:ae,goForward:Y,goToday:se,hideMinMaxTime:u,hourMax:N,hourMin:L,timeStep:p,scrollable:D,size:K,startWeek:B,view:W,viewValue:H,onEventCreate:le,onEventChange:ce,onEventDelete:de,onEventEdit:ue,eventRenderer:pe,pointerPreviewRenderer:fe}),[s,fe,T,G,U,J,ae,Y,se,u,N,L,D,K,B,p,W,H,le,ce,de,ue,pe]);return(0,a.jsx)(`div`,{...me,className:(0,t.cx)(me.className,it.root),"data-ww-size":K===`regular`?void 0:K,children:(0,a.jsx)(M.Provider,{value:he,children:(0,a.jsx)(r.DragAndDropContext.Provider,{value:q,children:(0,a.jsxs)(P.Provider,{value:V,children:[(0,a.jsx)(`div`,{className:it.root__head,children:(0,a.jsx)(oe,{})}),(0,a.jsx)(`div`,{className:it.root__body,children:W===`month`?(0,a.jsx)(Be,{}):(0,a.jsx)(rt,{})})]})})})})}exports.Calendar=at,exports.default=at,exports.DateLocalizationContext=s,exports.DateLocalizationProvider=function(n){let{adapter:r,messages:i,children:o}=n,c=(0,e.useMemo)(()=>typeof r==`function`?new r:r,[r]),l=(0,e.useMemo)(()=>(0,t.resolveMessages)(c.locale,i),[c.locale,i]);return(0,a.jsx)(s.Provider,{value:c,children:(0,a.jsx)(u.Provider,{value:l,children:o})})},exports.MessagesContext=u,Object.defineProperty(exports,"builtInMessages",{enumerable:!0,get:function(){return t.builtInMessages}}),Object.defineProperty(exports,"resolveMessages",{enumerable:!0,get:function(){return t.resolveMessages}}),exports.useDateUtils=c,exports.useMessages=d;
|
|
12
|
+
${a.current.stack}`)},[i,r,t])}function y(n){let{controlled:r,default:i}=n,[a,o]=(0,e.useState)(()=>i===void 0&&`initialState`in n&&n.initialState!==void 0?n.initialState:i),[s]=(0,e.useState)(i),c=_(r);t.isDevEnvironment&&v(c,r,s,i);let l=(0,e.useCallback)(e=>{c||o(e)},[c]);return[c?r:a,l,c]}function b(t){(0,e.useEffect)(()=>{if(!t)return;let e=`ww-cursor-${t}`,n=document.documentElement;return n.classList.add(e),()=>n.classList.remove(e)},[t])}var x={};function S(t,n){let r=(0,e.useRef)(x);return r.current===x&&(r.current=t(n)),r}function C(){if(t.isDevEnvironment)throw Error(`useEventCallback: Cannot call an event handler while rendering.`)}function w(){let e={next:void 0,callback:C,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function T(t){let n=S(w).current;return n.next=t,(0,e.useInsertionEffect)(n.effect),n.trampoline}function E(){let[t]=(0,e.useState)(()=>({current:new Map})),{addGlobalListener:n,removeGlobalListener:r,removeAllGlobalListeners:i}=(0,e.useMemo)(()=>{function e(e,n,r,i){let a=typeof i!=`boolean`&&i?.once?n=>{t.current.delete(r),e instanceof Document?r.call(e,n):r(n)}:r;e.addEventListener(n,r,i),t.current.set(r,{type:n,target:e,fn:a,options:i})}function n(e,n,r,i){let a=t.current.get(r)?.fn||r;e.removeEventListener(n,a,i),t.current.delete(r)}function r(){t.current.forEach(({target:e,type:t,options:r},i)=>{n(e,t,i,r)})}return{addGlobalListener:e,removeGlobalListener:n,removeAllGlobalListeners:r}},[t]);return(0,e.useEffect)(()=>i,[i]),{addGlobalListener:n,removeGlobalListener:r,removeAllGlobalListeners:i}}var D=e=>!e||typeof e==`function`?e:t=>{e.current=t};function O(...e){return t=>{e.forEach(e=>{D(e)?.(t)})}}function k(...t){return(0,e.useMemo)(()=>O(...t),t)}function A(t){let[{state:n}]=(0,e.useState)(()=>({state:{activePointId:null,clientX:0,clientY:0,initialClientX:0,initialClientY:0,isDistanceReached:!1}})),r=(0,e.useRef)(t);r.current=t;let{addGlobalListener:i,removeGlobalListener:a}=E();return{listeners:(0,e.useMemo)(()=>{let e={},t=e=>{`stopPropagation`in e&&`preventDefault`in e&&(e.stopPropagation(),e.preventDefault())},o=(e,t)=>{let{current:{distance:i=0,...a}}=r,{clientX:o,clientY:s}=e,{clientX:c,clientY:l}=n;n.clientX=o,n.clientY=s,t!==void 0&&(n.activePointId=t);let u=e=>({shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,clientX:o,clientY:s});return{start(e,t){return n.initialClientX=o,n.initialClientY=s,n.isDistanceReached=i===0,a.onMoveStart({type:`movestart`,pointerType:e,...u(t)})},move(e,t,r,d){let f=o-n.initialClientX,p=s-n.initialClientY;!n.isDistanceReached&&f**2+p**2>=i**2&&(n.isDistanceReached=!0),n.isDistanceReached&&a.onMove({type:`move`,pointerType:e,deltaX:r??o-c,deltaY:d??s-l,initialDeltaX:f,initialDeltaY:p,...u(t)})},end(e,t){a.onMoveEnd({type:`moveend`,pointerType:e,...u(t)})}}};if(typeof PointerEvent>`u`){let r=e=>{e.button===0&&o(e).move(`mouse`,e)},s=e=>{e.button===0&&o(e).end(`mouse`,e)};e.onMouseDown=e=>{e.button===0&&(o(e).start(`mouse`,e)===!1?o(e,null):(i(window,`mousemove`,r,!1),i(window,`mouseup`,s,!1),t(e)))};let c=e=>{let t=[...e.changedTouches].findIndex(({identifier:e})=>e===n.activePointId);if(t>=0){let n=e.changedTouches[t];o(n).move(`touch`,e)}},l=e=>{let t=[...e.changedTouches].findIndex(({identifier:e})=>e===n.activePointId);t>=0&&(o(e.changedTouches[t],null).end(`touch`,e),i(window,`touchmove`,c),a(window,`touchend`,l),a(window,`touchcancel`,l))};e.onTouchStart=e=>{if(e.changedTouches.length===0||n.activePointId!==null)return;let r=e.changedTouches[0];o(r,r.identifier).start(`touch`,e)===!1?o(r,null):(i(window,`touchmove`,c,!1),i(window,`touchend`,l,!1),i(window,`touchcancel`,l,!1),t(e))}}else{let r=e=>{if(e.pointerId===n.activePointId){let t=e.pointerType||`mouse`;o(e).move(t,e)}},s=e=>{if(e.pointerId===n.activePointId){let t=e.pointerType||`mouse`;o(e,null).end(t,e),a(window,`pointermove`,r,!1),a(window,`pointerup`,s,!1),a(window,`pointercancel`,s,!1)}};e.onPointerDown=e=>{if(e.button===0&&n.activePointId===null){let n=e.pointerType||`mouse`;o(e,e.pointerId).start(n,e)===!1?o(e,null):(i(window,`pointermove`,r,!1),i(window,`pointerup`,s,!1),i(window,`pointercancel`,s,!1),t(e))}}}let s=(e,t,n)=>{let{start:r,move:i,end:a}=o({clientX:0,clientY:0});r(`keyboard`,e)?(i(`keyboard`,e,t,n),a(`keyboard`,e)):o({clientX:0,clientY:0},null)};return e.onKeyDown=e=>{switch(e.key){case`Left`:case`ArrowLeft`:t(e),s(e,-1,0);break;case`Right`:case`ArrowRight`:t(e),s(e,1,0);break;case`Up`:case`ArrowUp`:t(e),s(e,0,-1);break;case`Down`:case`ArrowDown`:t(e),s(e,0,1)}},e},[i,a,n])}}function j(t){let n=(0,e.useRef)(void 0);return(0,e.useEffect)(()=>{n.current=t},[t]),n.current}function M(){let t=null,n=0,r=e=>(n+=1,t===null&&(t=document.createElement(`div`),t.style.width=`99px`,t.style.height=`99px`,t.style.overflow=`scroll`,t.style.position=`absolute`,t.style.top=`-9999px`,t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`role`,`presentation`),document.body.appendChild(t),window.addEventListener(`resize`,e)),{element:t,cleanup:()=>{t&&--n<=0&&(document.body.removeChild(t),window.removeEventListener(`resize`,e),t=null,n=0)}});return function(){let[t,n]=(0,e.useState)({height:0,width:0});return f(()=>{let t=()=>{let t=i.offsetHeight-i.clientHeight,r=i.offsetWidth-i.clientWidth;(0,e.startTransition)(()=>{n(e=>{let{height:n,width:i}=e;return n!==t||i!==r?{height:t,width:r}:e})})},{element:i,cleanup:a}=r(t);return t(),a},[]),t}}var N=M();function P(t){let[n,r]=(0,e.useState)(t),i=(0,e.useRef)(t);return[n,(0,e.useCallback)(e=>{i.current=e,r(e)},[]),i]}function F(t,n,r=!0){let i=(0,e.useRef)(null),a=h(t);(0,e.useEffect)(()=>{if(r){let e=new Date,t=n-(e.getMinutes()*60+e.getSeconds())*1e3%n;i.current=setTimeout(()=>{a.current(),i.current=setInterval(a.current,n)},t),a.current()}return()=>{i.current&&clearTimeout(i.current)}},[a,n,r])}var I=e=>e.toMillis(e.getToday());function L(){let t=l(),[n,r]=(0,e.useState)(()=>({dateUtils:t,today:I(t)})),i=n;n.dateUtils!==t&&(i={dateUtils:t,today:I(t)},r(i));let{today:a}=i;return(0,e.useEffect)(()=>{let e=t.toMillis(t.addDays(t.fromMillis(a),1)),n=Math.max(e-Date.now(),0)+1e3,i=setTimeout(()=>r({dateUtils:t,today:I(t)}),n);return()=>clearTimeout(i)},[t,a]),a}var R=(0,e.createContext)(void 0);t.isDevEnvironment&&(R.displayName=`CalendarContext`);function z(){let t=(0,e.useContext)(R);if(!t)throw Error(`CalendarContext is required`);return t}var B=(0,e.createContext)(null);t.isDevEnvironment&&(B.displayName=`ThemeSourceContext`);function V(n){let{view:r,defaultView:i,startWeek:a,viewValue:o,defaultViewValue:s,dateUtils:c,onChangeView:l,onChangeViewValue:u}=n,[d,f]=y({controlled:r,default:i,initialState:`week`}),p=(0,e.useCallback)((e,n)=>(0,t.normalizeViewValue)(c,e,n,a),[c,a]),[m,g]=y({controlled:o,default:s,initialState:p(d)}),_=T((e,t)=>{g(e),u?.(e,t)}),v=T((0,t.mergeCallbacks)(e=>{f(e)},l)),b=h(m),x=(0,e.useRef)(d),S=(0,e.useRef)(a),C=(0,e.useRef)(c);return(0,e.useEffect)(()=>{let e=x.current,n=S.current!==a,r=C.current,i=r===c?b.current:(0,t.transferDay)(r,c,b.current);x.current=d,S.current=a,C.current=c;let o=e===d&&!n?p(d,i):(0,t.getViewChangeTarget)(c,e,d,i,a);_(o,d)},[p,_,d,b,c,a]),{view:d,viewValue:m,changeViewValue:_,changeView:v}}function H(e){let{dateUtils:n,view:r,viewValue:i,changeViewValue:a,startWeek:o}=e,s=(e,i)=>()=>a((0,t.getNavigationTarget)(n,r,e,i,o),r);return{goForward:T(s(i,1)),goBackward:T(s(i,-1)),goToday:T(s(n.getToday(),0))}}function U(e){return(0,a.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,height:`12`,viewBox:`0 0 13 12`,width:`13`,...e,children:(0,a.jsx)(`path`,{d:`M1.77498 2.29504L6.35498 6.87504L10.945 2.29504L12.355 3.70504L6.35498 9.70504L0.35498 3.70504L1.77498 2.29504Z`,fill:`currentColor`})})}var ee=()=>()=>{},W=()=>!0,te=()=>!1;function ne(){return(0,e.useSyncExternalStore)(ee,W,te)}function re(e){let n={display:`contents`};if(!e)return n;let r=getComputedStyle(e);for(let e of t.THEME_PROPERTIES){let t=r.getPropertyValue(e).trim();t&&(n[e===`font-family`?`fontFamily`:e]=t)}return n}function G({children:t,container:n}){let r=ne(),i=(0,e.useContext)(B);return r?n?(0,o.createPortal)(t,n):(0,o.createPortal)((0,a.jsx)(`div`,{style:re(i?.current),children:t}),document.body):null}var K={root:`_root_1aojr_1`,root__toggle:`_root__toggle_1aojr_6`,root__toggleLabel:`_root__toggleLabel_1aojr_30`,root__toggleIcon:`_root__toggleIcon_1aojr_37`,root__toggleIcon_open:`_root__toggleIcon_open_1aojr_43`,popover:`_popover_1aojr_47`,popover__header:`_popover__header_1aojr_71`,popover__title:`_popover__title_1aojr_93`,popover__navBackward:`_popover__navBackward_1aojr_98`,popover__navForward:`_popover__navForward_1aojr_102`,popover__grid:`_popover__grid_1aojr_106`,popover__weekday:`_popover__weekday_1aojr_112`,popover__day:`_popover__day_1aojr_122`,popover__day_outside:`_popover__day_outside_1aojr_140`,popover__day_selected:`_popover__day_selected_1aojr_145`,popover__day_rangeStart:`_popover__day_rangeStart_1aojr_152`,popover__day_rangeEnd:`_popover__day_rangeEnd_1aojr_157`,popover__day_today:`_popover__day_today_1aojr_162`};function ie({renderHeading:n,type:r=`button`,onClick:o,onKeyDown:s,className:c,...u}){let{view:f,viewValue:p,changeViewValue:m,startWeek:h}=z(),g=l(),_=d(),{getStartOfWeek:v,getStartOfMonth:y,addMonths:b}=g,[x,S]=(0,e.useState)(!1),[C,w]=(0,e.useState)(()=>y(p)),T=(0,e.useRef)(null),{refs:E,floatingStyles:D}=(0,i.useFloating)({placement:`bottom`,middleware:[(0,i.offset)(6),(0,i.flip)({padding:8}),(0,i.shift)({padding:8})],whileElementsMounted:i.autoUpdate});(0,e.useEffect)(()=>{x&&w(y(p))},[x,y,p]),(0,e.useEffect)(()=>{if(!x)return;let e=e=>{let t=e.target;T.current?.contains(t)||E.floating.current?.contains(t)||S(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[x,E.floating]);let O=(0,e.useMemo)(()=>n?n(p,f):(0,t.getViewHeading)(g,f,p,h),[g,n,h,f,p]),k=(0,e.useMemo)(()=>(0,t.getMonthGrid)(g,C,h),[g,C,h]),A=e=>{o?.(e),S(e=>!e)},j=e=>{s?.(e),e.key===`Escape`&&S(!1)},M=e=>{m(f===`week`?v(e,h):e,f),S(!1)};return(0,a.jsxs)(`div`,{ref:T,className:K.root,children:[(0,a.jsxs)(`button`,{type:r,"aria-label":_.chooseDate,"aria-expanded":x,"aria-haspopup":`dialog`,...u,onClick:A,onKeyDown:j,ref:E.setReference,className:(0,t.cx)(c,K.root__toggle),children:[(0,a.jsx)(`span`,{className:K.root__toggleLabel,children:O}),(0,a.jsx)(U,{className:(0,t.cx)(K.root__toggleIcon,{[K.root__toggleIcon_open]:x})})]}),x&&(0,a.jsx)(G,{children:(0,a.jsxs)(`div`,{ref:E.setFloating,style:D,role:`dialog`,"aria-label":_.chooseDate,className:K.popover,children:[(0,a.jsxs)(`div`,{className:K.popover__header,children:[(0,a.jsx)(`button`,{type:`button`,"aria-label":_.previousMonth,onClick:()=>w(e=>b(e,-1)),children:(0,a.jsx)(U,{className:K.popover__navBackward})}),(0,a.jsx)(`div`,{className:K.popover__title,children:(0,t.formatMonthYear)(g,C)}),(0,a.jsx)(`button`,{type:`button`,"aria-label":_.nextMonth,onClick:()=>w(e=>b(e,1)),children:(0,a.jsx)(U,{className:K.popover__navForward})})]}),(0,a.jsxs)(`div`,{className:K.popover__grid,children:[k.slice(0,7).map(e=>(0,a.jsx)(`div`,{className:K.popover__weekday,children:g.weekDayShortName(g.getWeekDay(e))},g.getWeekDay(e))),k.map((e,n)=>{let r=g.getMonths(e)!==g.getMonths(C),i=g.isToday(e),o=f!==`month`&&(0,t.isInViewPeriod)(g,f,p,e),s=o&&(f===`day`||n%7==0),c=o&&(f===`day`||n%7==6);return(0,a.jsx)(`button`,{type:`button`,onClick:()=>M(e),className:(0,t.cx)(K.popover__day,{[K.popover__day_outside]:r,[K.popover__day_today]:i,[K.popover__day_selected]:o,[K.popover__day_rangeStart]:s,[K.popover__day_rangeEnd]:c}),children:g.getMonthDay(e)},g.toMillis(e))})]})]})})]})}var q={root:`_root_l1csz_1`,root__icon:`_root__icon_l1csz_21`,root__icon_forward:`_root__icon_forward_l1csz_25`,root__icon_backward:`_root__icon_backward_l1csz_29`};function ae({direction:e=`forward`,type:n=`button`,onClick:r,className:i,children:o,...s}){let{goForward:c,goBackward:l}=z(),u=d(),f=T((0,t.mergeCallbacks)(r,()=>{e===`forward`?c():e===`backward`&&l()}));return(0,a.jsx)(`button`,{type:n,"aria-label":e===`forward`?u.next:u.previous,...s,onClick:f,className:(0,t.cx)(i,q.root),children:o??(0,a.jsx)(U,{className:(0,t.cx)(q.root__icon,{[q.root__icon_backward]:e===`backward`,[q.root__icon_forward]:e===`forward`})})})}var J={root:`_root_gpxmh_1`,root__icon:`_root__icon_gpxmh_25`,root__icon_open:`_root__icon_open_gpxmh_32`,list:`_list_gpxmh_36`,list__option:`_list__option_gpxmh_48`,list__option_active:`_list__option_active_gpxmh_68`,list__check:`_list__check_gpxmh_76`},Y=[`day`,`week`,`month`];function oe({className:n}){let{view:r,changeView:o}=z(),s=d(),{addGlobalListener:c,removeGlobalListener:l}=E(),u=(0,e.useId)(),[f,p]=(0,e.useState)(!1),[m,h]=(0,e.useState)(r),g=(0,e.useRef)(new Map),{refs:_,floatingStyles:v}=(0,i.useFloating)({placement:`bottom-end`,middleware:[(0,i.offset)(6),(0,i.flip)({padding:8}),(0,i.shift)({padding:8})],whileElementsMounted:i.autoUpdate}),y=e=>{p(!1);let t=_.reference.current;e&&t instanceof HTMLElement&&t.focus()},b=(e=r)=>{h(e),p(!0)},x=e=>{y(!0),o(e)};(0,e.useEffect)(()=>{f&&g.current.get(m)?.focus()},[f,m]),(0,e.useEffect)(()=>{if(!f)return;let e=e=>{let t=e.target,n=_.reference.current;n instanceof Node&&n.contains(t)||_.floating.current?.contains(t)||p(!1)};return c(document,`pointerdown`,e),()=>l(document,`pointerdown`,e)},[c,f,_.floating,_.reference,l]);let S=e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),b())},C=e=>{let t=Y.indexOf(m),n=t=>{e.preventDefault(),h(Y[(t+Y.length)%Y.length]??m)};switch(e.key){case`ArrowDown`:return n(t+1);case`ArrowUp`:return n(t-1);case`Home`:return n(0);case`End`:return n(Y.length-1);case`Enter`:case` `:return e.preventDefault(),x(m);case`Escape`:return e.preventDefault(),y(!0);case`Tab`:return y(!1)}},w=`${u}-list`;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(`button`,{ref:_.setReference,type:`button`,"aria-haspopup":`listbox`,"aria-expanded":f,"aria-controls":f?w:void 0,"aria-label":`${s.chooseView}: ${s[r]}`,className:(0,t.cx)(n,J.root),onClick:()=>f?y(!1):b(),onKeyDown:S,children:[s[r],(0,a.jsx)(U,{"aria-hidden":`true`,className:(0,t.cx)(J.root__icon,{[J.root__icon_open]:f})})]}),f&&(0,a.jsx)(G,{children:(0,a.jsx)(`div`,{ref:_.setFloating,id:w,role:`listbox`,"aria-label":s.chooseView,style:v,className:J.list,onKeyDown:C,children:Y.map(e=>(0,a.jsxs)(`div`,{ref:t=>{t?g.current.set(e,t):g.current.delete(e)},id:`${u}-${e}`,role:`option`,tabIndex:-1,"aria-selected":e===r,className:(0,t.cx)(J.list__option,{[J.list__option_active]:e===m}),onClick:()=>x(e),onPointerMove:()=>h(e),children:[s[e],e===r&&(0,a.jsx)(`svg`,{"aria-hidden":`true`,className:J.list__check,viewBox:`0 0 16 16`,width:`14`,height:`14`,children:(0,a.jsx)(`path`,{d:`M3 8.5 6.5 12 13 4.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})})]},e))})})]})}var X={root:`_root_1lvdm_1`,root__navigationPane:`_root__navigationPane_1lvdm_12`,root__viewList:`_root__viewList_1lvdm_13`,root__today:`_root__today_1lvdm_26`,root__viewTab:`_root__viewTab_1lvdm_55`,root__viewTab_isActive:`_root__viewTab_isActive_1lvdm_75`,root__viewTab_disabled:`_root__viewTab_disabled_1lvdm_83`,root__viewSelect:`_root__viewSelect_1lvdm_89`};function se(e){let{goToday:n,changeView:r,view:i}=z(),o=d(),s=e,c={day:{type:`button`,"aria-selected":i===`day`,onClick:(0,t.mergeCallbacks)(void 0,()=>r(`day`)),className:(0,t.cx)(X.root__viewTab,{[X.root__viewTab_isActive]:i===`day`}),children:o.day},week:{type:`button`,"aria-selected":i===`week`,onClick:(0,t.mergeCallbacks)(void 0,()=>r(`week`)),className:(0,t.cx)(X.root__viewTab,{[X.root__viewTab_isActive]:i===`week`}),children:o.week},month:{type:`button`,"aria-selected":i===`month`,onClick:(0,t.mergeCallbacks)(void 0,()=>r(`month`)),className:(0,t.cx)(X.root__viewTab,{[X.root__viewTab_isActive]:i===`month`}),children:o.month}},l={type:`button`,onClick:T(n),className:X.root__today,children:o.today};return(0,a.jsxs)(`div`,{...s,className:(0,t.cx)(s.className,X.root),children:[(0,a.jsx)(ie,{}),(0,a.jsxs)(`div`,{className:X.root__navigationPane,role:`group`,children:[(0,a.jsx)(ae,{direction:`backward`}),(0,a.jsx)(`button`,{...l}),(0,a.jsx)(ae,{direction:`forward`})]}),(0,a.jsxs)(`div`,{className:X.root__viewList,children:[(0,a.jsx)(`button`,{...c.day}),(0,a.jsx)(`button`,{...c.week}),(0,a.jsx)(`button`,{...c.month})]}),(0,a.jsx)(`div`,{className:X.root__viewSelect,children:(0,a.jsx)(oe,{})})]})}var ce=(0,e.createContext)(void 0);t.isDevEnvironment&&(ce.displayName=`CalendarViewportContext`);function le(){let t=(0,e.useContext)(ce);if(!t)throw Error(`CalendarViewportContext is required`);return t}var ue={root:`_root_1pvvm_1`};function de({coordinates:e,className:n,style:r,...i}){return(0,a.jsx)(`span`,{tabIndex:-1,...i,className:(0,t.cx)(n,ue.root),style:{...r,...e?{top:`calc(${e.y}px + 20px)`,left:`calc(${e.x}px + 20px)`}:null}})}var fe={root:`_root_ssdmn_1`,root_isDragging:`_root_isDragging_ssdmn_14`,root_isReturning:`_root_isReturning_ssdmn_23`,"ww-drag-return":`_ww-drag-return_ssdmn_39`,root_isBlocked:`_root_isBlocked_ssdmn_36`},pe={isStart:!0,isEnd:!0};function me({showPreview:n=!0,pxPerMinute:i=1,...o}){let{eventMap:s,eventRenderer:c,pointerPreviewRenderer:l,view:u}=z(),{viewportRef:d}=le(),{isDragging:p,canDrop:m,dropData:h,eventItem:g,source:_,x:v,y,...x}=(0,r.useDragAndDrop)(({draggable:e,overlay:t,droppable:n,canDrop:r})=>{let i=[...n.dropTargets.values()].shift(),a=[...e.dragTargets.values()].shift();return{...t.transform,source:[...e.dragTargets.keys()].shift()??null,canDrop:r(),dropData:i,eventItem:a?a.filter(e=>e.event)[0]:null,isDragging:e.isDragging,x:e.x,y:e.y}}),S=(0,e.useMemo)(()=>{if(!g)return null;let{key:e}=JSON.parse(g.event);return s.get(e)?.value??null},[g,s]),C=(0,e.useRef)(null),w=(0,e.useRef)(!1),[T,E]=(0,e.useState)(!1),[D,O]=(0,e.useState)(null);if(f(()=>{if(p){w.current=m,h&&_&&(C.current={transform:x,source:_,eventValue:S},E(!0),O(null));return}E(!1);let e=C.current;C.current=null;let t=d.current;if(!e||w.current||!t||!e.source.isConnected)return;let{transform:n}=e,r=e.source.getBoundingClientRect(),i=t.getBoundingClientRect();O({container:t,eventValue:e.eventValue,style:{left:r.left-i.left,top:r.top-i.top,width:r.width,height:r.height,"--ww-return-left":`${n.left}px`,"--ww-return-top":`${n.top}px`,"--ww-return-width":`${n.width}px`,"--ww-return-height":`${n.height}px`}})}),b(p?m?`grabbing`:`not-allowed`:null),!p)return D?(0,a.jsx)(G,{container:D.container,children:(0,a.jsx)(`div`,{...o,className:(0,t.cx)(o.className,fe.root,fe.root_isReturning),style:D.style,onAnimationEnd:()=>O(null),children:D.eventValue==null?null:c.current?.(D.eventValue,u,pe)})}):null;if(!T)return null;let k=!m;return(0,a.jsxs)(G,{container:d.current,children:[(0,a.jsx)(`div`,{...o,className:(0,t.cx)(o.className,fe.root,{[fe.root_isDragging]:p,[fe.root_isBlocked]:k}),style:{...x},children:S==null?null:c.current?.(S,u,pe)}),n&&!k&&(0,a.jsx)(de,{coordinates:{x:v,y},children:h?l.current?.(h.date,Math.round(x.top/i),Math.round(x.height/i)):null})]})}function he(e,t){return{...t,...e}}function ge(e){return Array.from({length:Math.ceil(e.length/7)},(t,n)=>e.slice(n*7,n*7+7))}function _e(e,t,n){let r=e?.querySelectorAll(`[data-day-index]`)??[],i=-1,a=1/0;for(let e of r){let r=e.getBoundingClientRect(),o=t<r.left?r.left-t:t>=r.right?t-r.right:0,s=n<r.top?r.top-n:n>=r.bottom?n-r.bottom:0,c=Math.hypot(o,s);c<a&&(a=c,i=Number(e.dataset.dayIndex))}return i}var Z={root:`_root_fq0jy_1`,root__head:`_root__head_fq0jy_11`,root__weekday:`_root__weekday_fq0jy_21`,root__body:`_root__body_fq0jy_31`,root__viewport:`_root__viewport_fq0jy_37`,root__week:`_root__week_fq0jy_21`,root__day:`_root__day_fq0jy_62`,root__day_isOver:`_root__day_isOver_fq0jy_86`,root__dayNumber:`_root__dayNumber_fq0jy_100`,root__event:`_root__event_fq0jy_122`,root__event_span:`_root__event_span_fq0jy_153`,root__event_continuesBefore:`_root__event_continuesBefore_fq0jy_159`,root__event_continuesAfter:`_root__event_continuesAfter_fq0jy_165`,root__event_isResizing:`_root__event_isResizing_fq0jy_171`,root__event_isResizeSource:`_root__event_isResizeSource_fq0jy_175`,root__resize:`_root__resize_fq0jy_180`,root__resizeStart:`_root__resizeStart_fq0jy_188`,root__resizeEnd:`_root__resizeEnd_fq0jy_192`,root_isResizing:`_root_isResizing_fq0jy_196`,root__event_isDragging:`_root__event_isDragging_fq0jy_201`,root__dragOverlay:`_root__dragOverlay_fq0jy_206`,root__more:`_root__more_fq0jy_231`};function ve(n){let{ref:i,targetDate:o,children:s,onDoubleClick:c,...u}=n,{onEventChange:d,onEventCreate:f,getIsDayDisabled:p,disabled:m,eventMap:h}=z(),g=l(),{getHours:_,getMinutes:v,getNow:y}=g,b=(0,e.useRef)(null),{register:x,isOver:S}=(0,r.useDragAndDrop)(({registerDropTarget:e,isOver:t})=>({register:e,isOver:t(b.current)}));(0,e.useEffect)(()=>{let e=b.current;if(e)return x(e,{data:{date:o},onDrop:async e=>{let[n]=await Promise.all(e.items.filter(e=>e.kind===`text`&&e.types.has(`event`)&&`getText`in e).map(async e=>{let t=await e.getText(`event`);return JSON.parse(t)})),r=n&&h.get(n.key);if(!r)return;let i=g.fromMillis(n.day??n.date),a=(0,t.toDayMinutes)(g,i,o)/1440;a!==0&&d(r.key,g.addDays(g.getStartOfDay(r.date),a),{from:_(r.date)*60+v(r.date),duration:r.duration})},getDropOperationForPoint:(e,t)=>m||!e.has(`event`)||p&&p(o)?`cancel`:t[0]})},[g,m,h,_,p,v,d,x,o]);let C=T(e=>{if(c?.(e),e.defaultPrevented||m||p&&p(o))return;let t=y();f(o,{from:_(t)*60+v(t),duration:60})}),w=k(b,i);return(0,a.jsx)(`div`,{...u,ref:w,onDoubleClick:C,className:(0,t.cx)(u.className,Z.root__day,{[Z.root__day_isOver]:S}),children:s})}function ye(){let t=(0,e.useRef)(null);return[(0,e.useCallback)((e,n)=>{t.current=setInterval(e,n)},[]),(0,e.useCallback)(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[])]}var be={x:{[-1]:!1,1:!1},y:{[-1]:!1,1:!1}};function xe({delta:e,disabled:t}){let n=j(e);return g(r=>{if(t||!n||!r)return be;let i={x:Math.sign(e.x-n.x),y:Math.sign(e.y-n.y)};return{x:{[-1]:r.x[-1]||i.x===-1,1:r.x[1]||i.x===1},y:{[-1]:r.y[-1]||i.y===-1,1:r.y[1]||i.y===1}}},[t,e,n])}function Se(n){let{acceleration:r,activator:i=0,canScroll:a,enabled:o,interval:s=5,pointerCoordinates:c,order:l=0,delta:u,threshold:d,activeNodeRect:f,scrollableAncestors:p,scrollableAncestorsRects:m}=n,[h,g]=ye(),_=xe({delta:u,disabled:!o}),v=(0,e.useRef)({x:0,y:0}),y=(0,e.useRef)({x:0,y:0}),b=(0,e.useRef)(null),x=(0,e.useMemo)(()=>l===0?[[...p].reverse(),[...m].reverse()]:[[...p],[...m]],[l,p,m]),S=(0,e.useMemo)(()=>{switch(i){case 0:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case 1:return f}},[i,f,c]),C=(0,e.useCallback)(()=>{let e=b.current;if(!e)return;let t=v.current.x*y.current.x,n=v.current.y*y.current.y;e.scrollBy(t,n)},[]);(0,e.useEffect)(()=>{let[e,n]=x;if(!o||!e.length||!S)g();else{for(let[i,o]of e.entries()){if(!o||a?.(o)===!1)continue;let e=n[i];if(!e)continue;let{direction:c,speed:l}=(0,t.getScrollDirectionAndSpeed)(o,e,S,r,d);for(let e of[`x`,`y`])_[e][c[e]]||(l[e]=0,c[e]=0);if(l.x>0||l.y>0){g(),h(C,s),b.current=o,v.current=l,y.current=c;return}}v.current={x:0,y:0},y.current={x:0,y:0},g()}},[r,C,a,o,s,S,p,x,d,g,h,...Object.entries(S||{}),...Object.entries(_),...Object.entries(d||{})])}function Ce(t,n=!1){let r=(0,e.useRef)(t);r.current=t;let i=(0,e.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window,{current:t}=r;return new e(t)},[n]);return(0,e.useEffect)(()=>()=>i?.disconnect(),[i]),i}function we(n,r=t.getClientRect,i){let[a,o]=(0,e.useReducer)(l,null),s=Ce(e=>{if(n)for(let r of e){let{type:e,target:i}=r;if(e===`childList`&&(0,t.isHTMLElement)(i)&&i.contains(n)){o();break}}}),c=p(o);return f(()=>{o(),n?(c?.observe(n),s?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),s?.disconnect())},[n,s,c]),a;function l(e){if(!n)return null;if(n.isConnected===!1)return e??i??null;let a=r(n);return(0,t.shallowEqual)(a,e)?e:a}}var Te=[];function Ee(n,r){let i=(0,e.useRef)(n),a=(0,e.useMemo)(()=>n?(0,t.getScrollableAncestors)(n,r):Te,[n,r]);return(0,e.useEffect)(()=>{i.current=n},[n]),a}var De=[];function Oe(n,r=t.getClientRect){let[i,a]=(0,e.useReducer)(s,De),o=p(a);return n.length>0&&i===De&&a(),f(()=>{n.length?n.forEach(e=>o?.observe(e)):(o?.disconnect(),a())},[n,o]),i;function s(){return n.length?n.map(e=>{if(e===document.scrollingElement){let n=(0,t.getWindow)(e),r=n.innerWidth,i=n.innerHeight;return{top:0,left:0,right:r,bottom:i,width:r,height:i}}return new t.Rect(r(e),e)}):De}}function ke(n){let[r,i]=(0,e.useState)(null),a=(0,e.useRef)(n),o=(0,e.useCallback)(e=>{let n=(0,t.getScrollableElement)(e.target);n&&i(e=>e?(e.set(n,(0,t.getScrollCoordinates)(n)),new Map(e)):null)},[]);return(0,e.useEffect)(()=>{let e=a.current;if(n!==e){r(e);let s=n.map(e=>{let n=(0,t.getScrollableElement)(e);return n?(n.addEventListener(`scroll`,o,{passive:!0}),[n,(0,t.getScrollCoordinates)(n)]):null}).filter(e=>(0,t.isNotNull)(e));i(s.length?new Map(s):null),a.current=n}return()=>{r(n),r(e)};function r(e){e.forEach(e=>{let n=(0,t.getScrollableElement)(e);n&&n.removeEventListener(`scroll`,o)})}},[o,n]),(0,e.useMemo)(()=>n.length?r?Array.from(r.values()).reduce((e,n)=>(0,t.add)(e,n),t.defaultCoordinates):(0,t.getScrollOffsets)(n):t.defaultCoordinates,[n,r])}function Ae(n,r=t.emptyArray){let i=(0,e.useRef)(null);return(0,e.useEffect)(()=>{i.current=null},r),(0,e.useEffect)(()=>{let e=n!==t.defaultCoordinates;e&&!i.current&&(i.current=n),!e&&i.current&&(i.current=null)},[n]),i.current?(0,t.subtract)(n,i.current):t.defaultCoordinates}var je={Start:`start`,Move:`move`,Stop:`stop`},Me={isActive:!1,initialTranslate:{x:0,y:0},translate:{x:0,y:0},delta:{x:0,y:0},context:null};function Ne({autoScrollEnabled:n=!0,modifiers:r=[],activeNode:i=null,containerNode:a=null}){let[o,s]=(0,e.useReducer)(Pe,Me),c=typeof i==`function`?i(o.context):i,l=typeof a==`function`?a(o.context):a,u=we(o.isActive?c:null),d=we(o.isActive?l:null),f=Ee(o.isActive?c:null),p=Oe(f),m=Ae(ke(f)),h=(0,e.useMemo)(()=>{let e=e=>(t,n)=>{s({type:e,coordinates:t,context:n})};return{start:e(je.Start),move:e(je.Move),stop:e(je.Stop)}},[]),g=(0,t.add)(o.initialTranslate,o.translate);Se({delta:o.translate,enabled:n&&o.isActive,activeNodeRect:u,pointerCoordinates:g,scrollableAncestors:f,scrollableAncestorsRects:p});let _=(0,t.add)(o.translate,m),v=(0,t.adjustScrollRect)(u,m),y=(0,t.adjustScrollRect)(d,m),b=(0,t.applyMoveTransformModifiers)(r,{delta:o.delta,transform:{...o.translate,left:o.translate.x,top:o.translate.y,height:u?.height||0,width:u?.width||0},context:o.context,activeNodeRect:u,containerNodeRect:d,translate:_,initialTranslate:o.initialTranslate});return[{context:o.context,isActive:o.currentAction===`move`,transform:b,translate:o.translate,initialTranslate:o.initialTranslate,containerNodeRect:d,activeNodeRect:u,delta:o.delta},h,{pointerCoordinates:g,scrollAdjustmentActiveNodeRect:v,scrollAdjustmentContainerNodeRect:y}]}function Pe(e,n){let r={[je.Start]:(e,{coordinates:t,context:n})=>({...e,isActive:!0,currentAction:je.Start,initialTranslate:{...t},context:n}),[je.Move]:(e,{coordinates:t})=>({...e,currentAction:je.Move,translate:{x:t.x-e.initialTranslate.x,y:t.y-e.initialTranslate.y},delta:{x:t.x-(e.translate.x+e.initialTranslate.x),y:t.y-(e.translate.y+e.initialTranslate.y)}}),[je.Stop]:()=>({...Me,currentAction:je.Stop})};return(0,t.match)(n.type,r,e,n)}var Fe=6;function Ie(n){let{ref:i,eventData:o,weekDays:s,resizable:c=!1,resize:u,isResizeSource:d=!1,isAnyResizing:f=!1,children:p,...m}=n,{disabled:h}=z(),g=l(),{viewportRef:_}=le(),v=(0,e.useRef)(null),y=(0,e.useRef)(null),{attributes:b,isDragging:x,overElement:S,register:C,setOverlayTransform:w}=(0,r.useDragAndDrop)(({registerDragSource:e,draggable:t,droppable:n,setTransform:r,isActive:i})=>{let a=i(v.current),[o]=a?[...n.dropTargets].pop()??[null]:[null];return{attributes:t.attributes,isDragging:a,overElement:o,register:e,setOverlayTransform:r}}),E=we(x?S:null),[{transform:D,context:O},j]=Ne({autoScrollEnabled:!1,activeNode:()=>v.current,containerNode:()=>_.current,modifiers:[function({activeNodeRect:e,containerNodeRect:n,transform:r,translate:i,initialTranslate:a}){if(!n||!e||!E)return r;r.x=i.x+a.x-n.left,r.y=i.y+a.y-n.top,r.left=E.left-n.left+Fe,r.width=E.width-12,r.height=e.height;let o=e.top+i.y,s=E.top+t.MONTH_WEEK_GEOMETRY.header,c=E.top+E.height-e.height;return r.top=Math.max(s,Math.min(o,c))-n.top,r}]}),M=T(e=>{O===`overlay`&&S&&w(e)});(0,e.useEffect)(()=>{M(D)},[M,...Object.values(D)]);let N=T(()=>{let e=y.current??s[o.column],t={...o,date:g.toMillis(o.date),day:e&&g.toMillis(e)};return[{event:JSON.stringify(t)}]});(0,e.useEffect)(()=>{if(v.current&&!h)return C(v.current,{getItems:N,onDragStart(e){j.start({x:e.x,y:e.y},`overlay`)},onDragMove(e){j.move({x:e.x,y:e.y})},onDragEnd(e){j.stop({x:e.x,y:e.y})},getAllowedDropOperations(){return[`move`]}})},[j,h,N,C]);let P=e=>{e.stopPropagation();let t=e.currentTarget.parentElement;if(!t)return;let n=t.getBoundingClientRect(),r=Math.floor((e.clientX-n.left)/n.width*s.length),i=Math.min(Math.max(r,o.column),o.column+o.span-1);y.current=s[i]??null},F=e=>({onMoveStart:()=>(u?.start(o.key,e),!0),onMove:e=>u?.move(e.clientX,e.clientY),onMoveEnd:()=>u?.end()}),{listeners:I}=A(F(`start`)),{listeners:L}=A(F(`end`)),R=k(v,i),B=o.span>1||!o.isStart||!o.isEnd,V=he({"--ww-column":o.column+1,"--ww-span":o.span,"--ww-row":o.lane+2},m.style);return(0,a.jsxs)(`div`,{...m,...f?null:b,ref:R,style:V,"data-key":String(o.key),"data-continues-before":o.isStart?void 0:``,"data-continues-after":o.isEnd?void 0:``,onPointerDown:P,onDoubleClick:e=>e.stopPropagation(),className:(0,t.cx)(m.className,Z.root__event,{[Z.root__event_span]:B,[Z.root__event_continuesBefore]:!o.isStart,[Z.root__event_continuesAfter]:!o.isEnd,[Z.root__event_isDragging]:x,[Z.root__event_isResizeSource]:d}),children:[p,c&&o.isStart&&(0,a.jsx)(`div`,{...I,"data-edge":`start`,className:(0,t.cx)(Z.root__resize,Z.root__resizeStart)}),c&&o.isEnd&&(0,a.jsx)(`div`,{...L,"data-edge":`end`,className:(0,t.cx)(Z.root__resize,Z.root__resizeEnd)})]})}function Le({bar:e,children:n}){return(0,a.jsx)(`div`,{"aria-hidden":`true`,"data-key":String(e.key),"data-continues-before":e.isStart?void 0:``,"data-continues-after":e.isEnd?void 0:``,className:(0,t.cx)(Z.root__event,Z.root__event_isResizing,{[Z.root__event_span]:e.span>1||!e.isStart||!e.isEnd,[Z.root__event_continuesBefore]:!e.isStart,[Z.root__event_continuesAfter]:!e.isEnd}),style:he({"--ww-column":e.column+1,"--ww-span":e.span,"--ww-row":e.lane+2}),children:n})}function Re(e){let{days:t,firstDayIndex:n,layout:r,sourceBars:i,lanes:o,resizingKey:s,resize:c}=e,{viewValue:u,eventRenderer:f,view:p,disabled:m}=z(),{getMonthDay:h,isSameMonth:g,isToday:_,toMillis:v}=l(),y=d(),b=s!==void 0,x=e=>f.current?.(e.value,p,{isStart:e.isStart,isEnd:e.isEnd}),S=(e,n=!1)=>(0,a.jsx)(Ie,{eventData:e,weekDays:t,resizable:!m,resize:c,isResizeSource:n,isAnyResizing:b,children:x(e)},e.key);return(0,a.jsxs)(`div`,{className:Z.root__week,children:[t.map((e,t)=>(0,a.jsx)(ve,{targetDate:e,"data-day-index":n+t,"data-is-outside":!g(e,u)||void 0,"data-is-today":_(e)?!0:void 0,style:he({"--ww-column":t+1}),children:(0,a.jsx)(`span`,{className:Z.root__dayNumber,children:h(e)})},v(e))),[...r.bars.map(e=>e.key===s?(0,a.jsx)(Le,{bar:e,children:x(e)},`preview-${e.key}`):S(e)),...i.map(e=>S(e,!0))],t.map((e,t)=>r.hidden[t]>0&&(0,a.jsx)(`span`,{className:Z.root__more,style:he({"--ww-column":t+1,"--ww-row":o+2}),children:y.more(r.hidden[t])},`more-${v(e)}`))]})}function ze(n,r){let[i,a]=(0,e.useState)(r),o=()=>{let e=n.current?.firstElementChild;e?.clientHeight&&a((0,t.getMonthLaneCount)(e.clientHeight,r))},s=p(o);return f(()=>{o();let e=n.current?.firstElementChild;return e&&s?.observe(e),()=>{e&&s?.unobserve(e)}},[s,r]),i}function Be(n){let{days:r,viewportRef:i,dateUtils:a,eventMap:o,disabled:s,getIsDayDisabled:c,onEventChange:l}=n,[u,d,f]=P(null),{addGlobalListener:p,removeAllGlobalListeners:m}=E(),h=T((e=!0)=>{let t=f.current;t&&(m(),d(null),e&&t.result&&l(t.key,t.result.date,t.result.info))}),g=T(e=>{e.key===`Escape`&&h(!1)}),_=T((e,t)=>{s||f.current||(d({key:e,edge:t,result:null}),p(document,`keydown`,g,!0))}),v=T((e,n)=>{let s=f.current,l=s&&o.get(s.key),u=r[_e(i.current,e,n)];s&&l&&u&&!c?.(u)&&d({...s,result:(0,t.resizeEventDays)(a,l,s.edge,u)})}),y=(0,e.useMemo)(()=>({start:_,move:v,end:h}),[h,v,_]),b=(0,e.useMemo)(()=>{let e=u?.result&&o.get(u.key);if(!u?.result||!e)return o;let[n]=(0,t.getEventTimeFrameFromInfo)(a,u.result.date,u.result.info);return new Map(o).set(u.key,{...e,date:n,duration:u.result.info.duration})},[a,o,u]);return{resizingKey:u?.key,actions:y,eventMap:b}}var Ve=[];function He(n){let{className:r,style:i,...o}=n,{viewValue:s,eventMap:c,startWeek:u,disabled:d,getIsDayDisabled:f,onEventChange:p}=z(),m=l();L();let h=(0,e.useRef)(null),g=(0,e.useMemo)(()=>(0,t.getMonthGrid)(m,s,u),[m,u,s]),_=(0,e.useMemo)(()=>ge(g),[g]),v=(0,e.useMemo)(()=>(0,t.getWeekdayNames)(m,u),[m,u]),y=Be({days:g,viewportRef:h,dateUtils:m,eventMap:c,disabled:d,getIsDayDisabled:f,onEventChange:p}),b=ze(h,3),x=(0,e.useMemo)(()=>_.map(e=>(0,t.arrangeMonthWeek)(c,m,e,b)),[m,c,b,_]),S=(0,e.useMemo)(()=>y.eventMap===c?x:_.map(e=>(0,t.arrangeMonthWeek)(y.eventMap,m,e,b)),[m,c,b,x,y.eventMap,_]),C=(0,e.useMemo)(()=>({viewportRef:h}),[]);return(0,a.jsxs)(ce.Provider,{value:C,children:[(0,a.jsxs)(`div`,{...o,className:(0,t.cx)(r,Z.root,{[Z.root_isResizing]:y.resizingKey!==void 0}),style:he({"--ww-month-lanes":b},i),children:[(0,a.jsx)(`div`,{className:Z.root__head,children:v.map(e=>(0,a.jsx)(`div`,{className:Z.root__weekday,children:e},e))}),(0,a.jsx)(`div`,{className:Z.root__body,children:(0,a.jsx)(`div`,{ref:h,className:Z.root__viewport,children:_.map((e,t)=>(0,a.jsx)(Re,{days:e,firstDayIndex:t*7,layout:S[t],sourceBars:y.resizingKey===void 0?Ve:x[t].bars.filter(e=>e.key===y.resizingKey),lanes:b,resizingKey:y.resizingKey,resize:y.actions},m.toMillis(e[0])))})})]}),(0,a.jsx)(me,{className:Z.root__dragOverlay,showPreview:!1})]})}var Ue=1440;function We(n){let{days:r,viewportRef:i,dateUtils:a,bounds:o,timeStep:s,preventOutBoundsChanges:c}=n,[l,u]=(0,e.useState)(null),d=(0,e.useRef)(null),f=(0,e.useRef)(n);f.current=n;let p=o.hideMinMaxTime?o.hourMin*60:0,m=o.hideMinMaxTime?(o.hourMax-o.hourMin)*60:Ue,h=(0,e.useCallback)((e,n)=>{let l=d.current,p=i.current;if(!l||!p)return;l.x=e,l.y=n;let{disabled:h,getIsDayDisabled:g}=f.current,_=[...p.querySelectorAll(`[data-day-index]`)],v=p.getBoundingClientRect(),y=(e=>Math.round(e/s)*s)(Math.min(Math.max((n-v.top)/v.height*m,0),m)),b=0,x=1/0;_.forEach(t=>{let n=t.getBoundingClientRect(),r=e<n.left?n.left-e:e>n.right?e-n.right:0;r<x&&(x=r,b=Number(t.dataset.dayIndex))});let S=(0,t.resizeEventRange)({start:l.original[0],end:l.original[1]},l.edge,b,y,{dayCount:r.length,bounds:o,timeStep:s,crossDays:!c||o.hourMin<=0&&o.hourMax>=24,getFrame:e=>{if(!c)return[0,m];let[n,i]=(0,t.getTimeFrame)(a,r[e],o);return[Math.ceil(n/s)*s,Math.min(Math.ceil(i/s)*s,m)]},canEditDay:e=>!h&&!g?.(r[e])&&!(c&&(0,t.isPastDay)(a,r[e]))});S&&(l.range=S),u({key:l.key,range:l.range,x:e,y:n,blocked:!S})},[o,a,r,c,s,m,i]),g=(0,e.useMemo)(()=>({start(e,n,i,o){let s=f.current.eventMap.get(e);if(!s||!r[0])return;let c=(0,t.toDayMinutes)(a,r[0],s.date),l=[c,c+s.duration];d.current={key:e,edge:n,original:l,range:l,x:i,y:o},u({key:e,range:l,x:i,y:o,blocked:!1})},move:h,end(){let e=d.current;if(d.current=null,u(null),!e)return;let[n,i]=e.range;if(n===e.original[0]&&i===e.original[1])return;let o=Math.floor(n/Ue);f.current.onEventChange(e.key,(0,t.fromDayMinutes)(a,r[0],o*Ue),{from:n-o*Ue,duration:i-n})}}),[a,r,h]),_=l!==null;return(0,e.useEffect)(()=>{if(!_)return;let e=()=>d.current&&h(d.current.x,d.current.y);return document.addEventListener(`scroll`,e,!0),()=>document.removeEventListener(`scroll`,e,!0)},[_,h]),b(l?.blocked?`not-allowed`:null),{state:l,actions:g,previewOf:e=>{let n=Math.floor(e[0]/Ue);return{date:(0,t.fromDayMinutes)(a,r[0],n*Ue),top:e[0]-n*Ue-p,duration:e[1]-e[0]}}}}var Ge=(0,e.createContext)(void 0);t.isDevEnvironment&&(Ge.displayName=`DayWeekViewContext`);function Ke(){let t=(0,e.useContext)(Ge);if(!t)throw Error(`DayWeekViewContext is required`);return t}function qe(n=!0,r=6e4){let{hideMinMaxTime:i,hourMin:a,hourMax:o}=z(),s=l(),[c,u]=(0,e.useState)(null);return F(()=>u(Date.now()),r,n),(0,e.useMemo)(()=>c===null?[0,!0]:(0,t.getNowOffset)(s,{hourMin:a,hourMax:o,hideMinMaxTime:i}),[c,s,a,o,i])}var Je={root:`_root_1l2ji_1`,root_timeLimit:`_root_timeLimit_1l2ji_8`,root_isToday:`_root_isToday_1l2ji_8`,root_isPast:`_root_isPast_1l2ji_18`,root__container:`_root__container_1l2ji_36`,root__spotlight:`_root__spotlight_1l2ji_57`,root__timeLine:`_root__timeLine_1l2ji_67`,root_offLimits:`_root_offLimits_1l2ji_121`};function Ye(n){let{ref:i,targetDate:o,children:s,...c}=n,{onEventChange:u,onEventCreate:d,getIsDayDisabled:f,pointerPreviewRenderer:p,eventMap:m,...h}=z(),{viewportRef:g,getTimeFrame:_,pxPerMinute:v}=Ke(),{hideMinMaxTime:y,preventOutBoundsChanges:b,timeStep:x,hourMin:S,hourMax:C,disabled:w}=h,T=l(),{isBefore:E,isToday:D}=T,O=x*v,j=e=>Xe(e,v,x),M=e=>_(e).map(e=>e*v),N=(0,e.useRef)(null),P=(0,e.useRef)(null),{register:F,getTransform:I}=(0,r.useDragAndDrop)(({registerDropTarget:e,getTransform:t})=>({register:e,getTransform:t})),R=L(),B=(0,e.useMemo)(()=>{let e=D(o);return{isToday:e,isPast:E(o)&&!e}},[E,D,o,R]),[{isActive:V,transform:H},U,{scrollAdjustmentActiveNodeRect:ee}]=Ne({activeNode:N.current,containerNode:N.current?.parentElement,modifiers:[function({activeNodeRect:e,initialTranslate:t,translate:n,transform:r}){if(!e)return r;let i=t.y-e.top;r.x=r.left+t.x,r.y=r.top+t.y,r.top=Math.floor(i/O)*O,r.height=O,r.left=0,r.width=e.width;let a;return n.y>0?(a=O-i%O,r.height=Math.ceil((r.height+n.y-a)/O)*O):(a=i%O,r.height=Math.ceil((r.height-n.y-a)/O)*O,r.top-=r.height-O),r.height=Math.max(r.height,O),r},function({transform:e}){if(!b)return e;let[t,n]=_(o).map(e=>Math.ceil(e/x)*O);return e.top<t&&(e.height=Math.max(e.height-(t-e.top),O),e.top=t),e.height+e.top>=n&&(e.height=Math.max(n-e.top,O)),e},t.boundingResizableContainerModifier,(0,t.getTimeStepEqualizerModifier)(O)]}),[W,te]=qe(B.isToday);(0,e.useEffect)(()=>{let e=N.current;if(e)return F(e,{data:{date:o},onDrop:async e=>{let[n]=await Promise.all(e.items.filter(e=>e.kind===`text`&&e.types.has(`event`)&&`getText`in e).map(async e=>{let t=await e.getText(`event`);return JSON.parse(t)})),r=I(),i=Xe(r.top,v,x),a=Xe(r.height,v,x),s=y?S*60:0,c=m.get(n.key),l=c?(0,t.toDayMinutes)(T,c.date,c.date):0;if(c&&l+c.duration>1440){if(b&&(S>0||C<24)){U.stop({x:e.x,y:e.y});return}let r=T.getStartOfDay(T.fromMillis(n.date)),a=(0,t.toDayMinutes)(T,c.date,r)+s+n.start-l,d=s+i-a,f=Math.floor(d/1440);u(n.key,T.addDays(o,f),{from:d-f*24*60,duration:c.duration})}else y?u(n.key,o,{from:i+S*60,duration:a}):u(n.key,o,{from:i,duration:a});U.stop({x:e.x,y:e.y})},getDropOperationForPoint:(e,t)=>{if(w||!e.has(`event`)||f&&f(o))return`cancel`;let{isPast:n,isToday:r}=B;if(b){if(!r&&n)return`cancel`;let[e,t]=_(o).map(e=>e*v),i=I();if(i.y<e||i.y>t||r&&i.height>t-e)return`cancel`}return t[0]}})},[U,T,w,m,f,_,I,y,C,S,u,b,v,F,o,x,B]);let{listeners:ne}=A({distance:Math.max(Math.min(5,x),1),onMoveStart:e=>{if(!w){if(b){let{isToday:e,isPast:t}=B;if(t&&!e)return!1}U.start({x:e.clientX,y:e.clientY})}},onMove:e=>{if(V)U.move({x:e.clientX,y:e.clientY});else if(ee){if(b){let[t,n]=M(o),r=e.clientY-ee.top;if(r<t||r>n){U.stop({x:e.clientX,y:e.clientY});return}}V||U.move({x:e.clientX,y:e.clientY})}},onMoveEnd:e=>{U.stop({x:e.clientX,y:e.clientY}),V&&(y?d(o,{from:j(H.top)+S*60,duration:j(H.height)}):d(o,{from:j(H.top),duration:j(H.height)}))}}),re=k(N,i),K=(0,t.formatNowOffset)(T,W,{hourMin:S,hideMinMaxTime:y}),ie=()=>p.current?.(o,j(H.top),j(H.height));return(0,a.jsxs)(`div`,{...c,...ne,ref:re,className:(0,t.cx)(c.className,Je.root,{[Je.root_timeLimit]:b,[Je.root_isToday]:B.isToday,[Je.root_isPast]:B.isPast,[Je.root_offLimits]:te}),style:{...c.style,"--offset":W*v},children:[B.isToday&&!te&&(0,a.jsx)(G,{container:g.current,children:(0,a.jsx)(`span`,{tabIndex:-1,className:Je.root__timeLine,"data-now":K,style:{"--offset":W*v}})}),(0,a.jsx)(`div`,{ref:P,className:Je.root__container,children:s}),V&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{className:Je.root__spotlight,style:H?{...H}:void 0}),(0,a.jsx)(de,{coordinates:{x:H.x,y:H.y},children:ie()})]})]})}function Xe(e,t,n){return Math.round(e/t/n)*n}function Ze(n,r){let[i,a]=(0,e.useState)(null);return f(()=>{let e=n.current,i=n.current?.parentElement;if(e&&i){let{height:n,width:o,...s}=(0,t.getClientRect)(e),{left:c,top:l}=(0,t.subtract)(s,(0,t.getClientRect)(i));a((0,t.round)(r,{height:n,width:o,x:c,y:l}))}},[n,...Object.values(r)]),i}function Qe(t,n){let[r,i]=(0,e.useState)(!0),{preventOutBoundsChanges:a}=z(),{isBefore:o,isToday:s}=l(),{getTimeFrame:c}=Ke();return f(()=>{if(n&&a){if(o(t)&&!s(t))i(!1);else if(s(t)){let{height:e,y:r}=n,a=e+r,[o,s]=c(t);i(a>o&&r<s)}}},[t,n,c,a,o,s]),r}var Q={root:`_root_d2kfg_1`,root_isDragging:`_root_isDragging_d2kfg_10`,root__resizeTop:`_root__resizeTop_d2kfg_10`,root__resizeBottom:`_root__resizeBottom_d2kfg_12`,root_isResizing:`_root_isResizing_d2kfg_14`,root_isDisabled:`_root_isDisabled_d2kfg_41`,root__container:`_root__container_d2kfg_57`,root__dragPreview:`_root__dragPreview_d2kfg_104`,root_isPreview:`_root_isPreview_d2kfg_110`,root_isResizeSource:`_root_isResizeSource_d2kfg_115`};function $e(n){let{ref:i,eventData:o,children:s,...c}=n,{eventMap:u,...d}=z(),f=l(),{timeStep:p,preventOutBoundsChanges:m,disabled:h}=d,g=(0,e.useRef)(null),_=(0,e.useRef)(null),v=(0,e.useRef)(null),{viewportRef:y,getTimeFrame:b,pxPerMinute:x,resize:S,resizing:C}=Ke(),w=p*x,E=Ze(g,o.rect),D=Qe(u.get(o.key)?.date??o.date,E),{attributes:O,isDragging:j,overElement:M,overData:N,register:P,setOverlayTransform:F}=(0,r.useDragAndDrop)(({registerDragSource:e,draggable:t,droppable:n,setTransform:r,isActive:i})=>{let a=i(g.current),[o,s]=a?[...n.dropTargets].pop()??[null,null]:[null,null];return{attributes:t.attributes,overElement:o,overData:s,isDragging:a,register:e,setOverlayTransform:r}}),I=we(j?M:null),[{isActive:L,transform:R,context:B},V]=Ne({activeNode:e=>e===`overlay`?g.current:e===`top`?_.current:v.current,containerNode:e=>e===`overlay`?y.current:g.current?.parentElement?.parentElement??null,modifiers:[function({activeNodeRect:e,containerNodeRect:t,context:n,transform:r,translate:i,initialTranslate:a}){if(n!==`overlay`||!t||!e||!I)return r;r.x=i.x+a.x-t.left,r.y=i.y+a.y-t.top,r.left=I.left-t.left,r.width=I.width,r.top=e.top-t.top,r.height=e.height;let o;return i.y>0?(o=w-(a.y-e.top)%w,r.top+=Math.ceil((i.y-o)/w)*w):(o=(a.y-e.top)%w,r.top+=Math.floor((i.y+o)/w)*w),r},function({transform:e,context:t}){if(!m||t!==`overlay`||!N)return e;let[n,r]=b(N.date).map(e=>Math.ceil(e/p)*w);return e.top<n&&(e.top=n),e.top+e.height>r&&(e.top=r-e.height),e},et(w)]}),H=(0,t.mergeCallbacks)(()=>S.end(),e=>{V.stop({x:e.clientX,y:e.clientY})}),U=e=>({onMoveStart:t=>(V.start({x:t.clientX,y:t.clientY},e),S.start(o.key,e,t.clientX,t.clientY),!0),onMove:e=>{V.move({x:e.clientX,y:e.clientY}),S.move(e.clientX,e.clientY)},onMoveEnd:H}),{listeners:ee}=A(U(`bottom`)),{listeners:W}=A(U(`top`)),te=k(g,i),ne=L&&j&&B===`overlay`,re=C?.key===o.key,G=T(e=>{B===`overlay`&&M&&F(e)});(0,e.useEffect)(()=>{G(R)},[G,...Object.values(R)]),(0,e.useEffect)(()=>{if(!g.current)return;let e={...(0,t.omit)(o,`rect`),date:f.toMillis(o.date)},n=[{event:JSON.stringify(e)}];return P(g.current,{getItems(){return n},onDragStart(e){V.start({x:e.x,y:e.y},`overlay`)},onDragMove(e){V.move({x:e.x,y:e.y})},onDragEnd(e){V.stop({x:e.x,y:e.y})},getAllowedDropOperations(){return[`move`]}})},[V,o,P]);let K=(0,t.cx)(c.className,Q.root,{[Q.root_isDragging]:ne,[Q.root_isResizeSource]:re,[Q.root_isDisabled]:h}),ie={...c.style,top:`${o.rect.y}%`,left:`${o.rect.x}%`,width:`${o.rect.width}%`,height:`${o.rect.height}%`},q=T((0,t.mergeCallbacks)(c.onPointerDown,e=>e.stopPropagation()));return(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(`div`,{...c,...O,ref:te,className:K,style:ie,onPointerDown:q,"data-continues-before":o.isStart?void 0:``,"data-continues-after":o.isEnd?void 0:``,children:[D&&o.isStart&&(0,a.jsx)(`div`,{...W,ref:_,className:Q.root__resizeTop}),(0,a.jsx)(`div`,{role:`button`,tabIndex:0,className:Q.root__container,children:s}),D&&o.isEnd&&(0,a.jsx)(`div`,{...ee,ref:v,className:Q.root__resizeBottom})]})})}function et(e){return n=>{let r=[(0,t.getTimeStepEqualizerModifier)(e)];return n.context===`overlay`&&r.push(t.boundingDraggableContainerModifier),(0,t.applyMoveTransformModifiers)(r,n)}}function tt({part:e,timelineMinutes:t,children:n}){let r=e=>`${e/t*100}%`;return(0,a.jsx)(`div`,{"aria-hidden":`true`,className:`${Q.root} ${Q.root_isResizing} ${Q.root_isPreview}`,"data-continues-before":e.isStart?void 0:``,"data-continues-after":e.isEnd?void 0:``,style:{top:r(e.start),height:r(e.duration),left:0,width:`100%`},children:(0,a.jsx)(`div`,{className:Q.root__container,children:n})})}var $={root:`_root_19kk1_1`,root_scrollable:`_root_scrollable_19kk1_11`,root__body:`_root__body_19kk1_11`,root__head:`_root__head_19kk1_15`,root__main:`_root__main_19kk1_30`,root__viewport:`_root__viewport_19kk1_44`,root__column:`_root__column_19kk1_52`,root__headerCell:`_root__headerCell_19kk1_77`,root__headerCellDay:`_root__headerCellDay_19kk1_104`,root__headerCellLabel:`_root__headerCellLabel_19kk1_111`,root__headerCellName:`_root__headerCellName_19kk1_118`,root__headerCellToday:`_root__headerCellToday_19kk1_125`,root__row:`_root__row_19kk1_140`,root__timeStep:`_root__timeStep_19kk1_162`,root__timeStep_overTime:`_root__timeStep_overTime_19kk1_174`,root__rowHeadTime:`_root__rowHeadTime_19kk1_178`,root__hiddenEventsLayer:`_root__hiddenEventsLayer_19kk1_194`,root__hiddenEventsColumn:`_root__hiddenEventsColumn_19kk1_207`,root__hiddenEvents:`_root__hiddenEvents_19kk1_194`,root__hiddenEventsIcon:`_root__hiddenEventsIcon_19kk1_254`};function nt({scrollerRef:n,columns:r,rowHeight:i}){let{hourMin:o,hideMinMaxTime:s,size:c}=z(),u=l(),f=d(),{addGlobalListener:m,removeGlobalListener:h}=E(),[g,_]=(0,e.useState)(null),v=i/60,y=T(()=>{let e=n.current;if(!e)return;let t={top:e.scrollTop,height:e.clientHeight};_(e=>e?.top===t.top&&e.height===t.height?e:t)}),b=p(y);(0,e.useEffect)(()=>{let e=n.current;if(e)return y(),m(e,`scroll`,y,{passive:!0}),b?.observe(e),()=>{h(e,`scroll`,y),b?.unobserve(e)}},[m,y,h,b,n]),(0,e.useEffect)(y,[y,i,r]);let x=(0,e.useMemo)(()=>g&&g.height>0?r.map(e=>(0,t.getHiddenEvents)(e,v,g.top,g.height)):null,[r,v,g]);if(!x||!g)return null;let S=e=>n.current?.scrollTo({top:(0,t.getRevealScrollTop)(e,v,g.top,g.height),behavior:`smooth`}),C=(e,n)=>{let[r]=e;if(!r)return null;let i=e.length===1&&c!==`narrow`?(0,t.formatNowOffset)(u,r.start,{hourMin:o,hideMinMaxTime:s}):e.length;return(0,a.jsxs)(`button`,{type:`button`,className:$.root__hiddenEvents,"data-direction":n,"aria-label":n===`above`?f.earlier(e.length):f.later(e.length),onClick:()=>S(r),children:[(0,a.jsx)(U,{"aria-hidden":`true`,className:$.root__hiddenEventsIcon}),i]})};return(0,a.jsxs)(`div`,{className:$.root__hiddenEventsLayer,children:[(0,a.jsx)(`div`,{}),x.map(({above:e,below:t},n)=>(0,a.jsxs)(`div`,{className:$.root__hiddenEventsColumn,children:[C(e,`above`),C(t,`below`)]},n))]})}function rt(t,n,r){let[i,a]=(0,e.useState)();return f(()=>{let e=!1,n=()=>{let n=t.current;if(e||!n)return;let i=0,o=document.createRange();if(typeof o.getBoundingClientRect!=`function`)return;for(let e of n.querySelectorAll(`time`)){o.selectNodeContents(e);let t=getComputedStyle(e),n=o.getBoundingClientRect().width;i=Math.max(i,n+parseFloat(t.paddingLeft)+parseFloat(t.paddingRight))}let s=n.closest(`.${$.root}`)?.parentElement??document.body,c=parseFloat(getComputedStyle(s).getPropertyValue(`--ww-time-column`));a(i>(Number.isNaN(c)?r:c)?Math.ceil(i):void 0)};return n(),document.fonts?.ready.then(n),()=>{e=!0}},[r,n.join(`|`),t]),i}var it={regular:64,compact:44,narrow:40};function at({rowHeight:n,...r}){let{viewValue:i,hourMin:o,hourMax:s,view:c,eventMap:u,preventOutBoundsChanges:f,eventRenderer:p,timeStep:m,scrollable:h,size:g,hideMinMaxTime:_,disabled:v,getIsDayDisabled:y,onEventChange:b,pointerPreviewRenderer:x}=z(),S=l(),C=d(),{getMonthDay:w,getWeekDay:T,isToday:E,weekDayShortName:D}=S,O=L(),A=n??t.ROW_HEIGHTS[g],j=(0,e.useRef)(null),M=(0,e.useRef)(null),P=(0,e.useMemo)(()=>(0,t.buildTimeRows)(S,m,{hourMin:o,hourMax:s,hideMinMaxTime:_},f),[S,m,o,s,_,f]),F=rt(j,(0,e.useMemo)(()=>P.map(({time:e})=>e),[P]),it[g]),I=(0,e.useMemo)(()=>(0,t.getVisibleDays)(S,c,i),[S,c,i]),R=(0,e.useMemo)(()=>({hourMin:o,hourMax:s,hideMinMaxTime:_}),[o,s,_]),B=(0,e.useMemo)(()=>(0,t.arrangeEventsByDay)(u,S,P.length*60,I,R),[u,S,P.length,I,R]),V=(0,e.useMemo)(()=>B.map(({events:e})=>e),[B]),{state:H,actions:U,previewOf:ee}=We({days:I,viewportRef:j,dateUtils:S,bounds:R,timeStep:m,preventOutBoundsChanges:f,disabled:v,getIsDayDisabled:y,eventMap:u,onEventChange:b}),W=(0,e.useMemo)(()=>H?(0,t.splitIntoDays)(H.range[0],H.range[1],I.length,R):[],[H,I.length,R]),te=H?u.get(H.key)?.value:void 0,ne=(0,e.useCallback)(e=>(0,t.getTimeFrame)(S,e,{hourMin:o,hourMax:s,hideMinMaxTime:_}),[S,_,s,o]),re=(0,e.useMemo)(()=>I.map((e,t)=>{let n=T(e),r=E(e),i=B[t]?.events??[];return{attributes:r?{"data-is-today":!0}:void 0,events:i,day:w(e),isToday:r,targetDate:e,weekDayName:D(n),weekDayNumber:n}}),[O,S,I,B,w,T,E,D]),G=N(),K=r,ie=$.root__head,q=$.root__body,ae=$.root__viewport,J=$.root__column,Y=$.root__headerCell,oe=$.root__headerCellDay,X=$.root__row,se=$.root__rowHeadTime,le=$.root__timeStep,ue=k(j),fe=(0,e.useMemo)(()=>({viewportRef:j,getTimeFrame:ne,pxPerMinute:A/60,resize:U,resizing:H}),[j,ne,A,U,H]),pe=(0,e.useMemo)(()=>({viewportRef:j}),[j]),he=(e,t)=>(0,a.jsx)($e,{"data-idx":t,eventData:e,children:p.current?.(e.value,c,{isStart:e.isStart,isEnd:e.isEnd})},e.key);return(0,a.jsx)(Ge.Provider,{value:fe,children:(0,a.jsx)(ce.Provider,{value:pe,children:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(`div`,{...K,className:(0,t.cx)(K.className,$.root,{[$.root_scrollable]:h}),style:{...K.style,"--calendar-column-count":re.length,"--scrollbar-width":G.width,"--scrollbar-height":G.height,...F!==void 0&&{"--ww-time-column":`${F}px`}},children:[(0,a.jsxs)(`div`,{className:ie,children:[(0,a.jsx)(`div`,{className:Y}),re.map(e=>(0,a.jsxs)(`div`,{className:Y,...e.attributes,children:[(0,a.jsx)(`span`,{className:oe,children:e.day}),(0,a.jsxs)(`span`,{className:$.root__headerCellLabel,children:[(0,a.jsx)(`span`,{className:$.root__headerCellName,children:e.weekDayName}),e.isToday&&(0,a.jsx)(`span`,{className:$.root__headerCellToday,children:C.today})]})]},e.weekDayNumber))]}),(0,a.jsxs)(`div`,{className:$.root__main,children:[(0,a.jsx)(`div`,{ref:M,className:q,children:(0,a.jsxs)(`div`,{ref:ue,className:ae,style:{height:P.length*A},children:[(0,a.jsx)(`div`,{className:J,children:P.map(({time:e,value:n,steps:r},i)=>(0,a.jsxs)(`div`,{className:X,style:{height:A,"--translateY":i*A,"--calendar-rows-count":r.length},children:[(0,a.jsx)(`time`,{className:se,children:e}),r.map(([e,,n])=>(0,a.jsx)(`div`,{className:(0,t.cx)(le,{[$.root__timeStep_overTime]:n})},e))]},n))}),re.map((e,t)=>(0,a.jsx)(`div`,{className:J,"data-day-index":t,...e.attributes,children:(0,a.jsxs)(Ye,{id:`${e.weekDayNumber}`,targetDate:e.targetDate,children:[e.events.map((e,t)=>he(e,t)),W.filter(e=>e.dayIndex===t).map(e=>(0,a.jsx)(tt,{part:e,timelineMinutes:P.length*60,children:te===void 0?null:p.current?.(te,c,{isStart:e.isStart,isEnd:e.isEnd})},`resize`))]})},e.weekDayNumber))]})}),h&&(0,a.jsx)(nt,{scrollerRef:M,columns:V,rowHeight:A})]})]}),(0,a.jsx)(me,{pxPerMinute:A/60}),H&&!H.blocked&&(0,a.jsx)(de,{coordinates:{x:H.x,y:H.y},children:(()=>{let{date:e,top:t,duration:n}=ee(H.range);return x.current?.(e,t,n)})()})]})})})}var ot={root:`_root_uggip_2`,root__head:`_root__head_uggip_22`,root__body:`_root__body_uggip_26`,root__body_readonly:`_root__body_readonly_uggip_35`};function st(i){let{ref:o,disabled:s=!1,children:c,hideMinMaxTime:u=!1,timeFrame:d,startWeek:f,timeStep:p=15,items:g,onEventCreate:_,onEventChange:v,onEventDelete:y,onEventEdit:b,eventTimeFrameResolver:x,eventKeyResolver:C,getIsDayDisabled:w,pointerPreviewFormat:E,scrollable:D=!1,view:O,defaultView:A,viewValue:j,defaultViewValue:M,onChangeView:N,onChangeViewValue:P,...F}=i,{hourMax:I,hourMin:L}={hourMin:0,hourMax:24,...d},z=h({eventTimeFrameResolver:x,eventKeyResolver:C}),U=l(),ee=f??U.weekStartsOn,W=(0,e.useRef)(null),te=k(W,o),{viewValue:ne,changeViewValue:re,view:G,changeView:K}=V({view:O,defaultView:A,viewValue:j,defaultViewValue:M,onChangeView:N,onChangeViewValue:P,dateUtils:U,startWeek:ee}),ie=m(W),q=S(()=>(0,n.createDragAndDropApi)({input:`pointer`})).current,ae=(0,e.useMemo)(()=>(0,t.buildEventMap)(g,z.current,U,{hourMin:L,hideMinMaxTime:u}),[U,u,L,g,z]),{goBackward:J,goForward:Y,goToday:oe}=H({changeViewValue:re,dateUtils:U,startWeek:ee,view:G,viewValue:ne}),X=T((e,n,r)=>{let i=ae.get(e);i&&v?.(i.value,...(0,t.getEventTimeFrameFromInfo)(U,n,r))}),ce=T((e,n)=>{_?.(...(0,t.getEventTimeFrameFromInfo)(U,e,n))}),le=T(e=>{let t=ae.get(e);t&&b?.(t.value)}),ue=T(e=>{let t=ae.get(e);t&&y?.(t.value)}),de=h((e,n,r)=>{let[i,a]=(0,t.getTimelineRange)(U,e,n,r,{hourMin:L,hideMinMaxTime:u});return E?E(i,a):(0,t.formatTimelineRange)(U,i,a)}),fe=h(c);(0,e.useEffect)(()=>{if(W.current)return q.getState().registerRootElement(W.current)},[q]);let pe={...F,ref:te},me=(0,e.useMemo)(()=>({disabled:s,getIsDayDisabled:w,preventOutBoundsChanges:!!d,changeView:K,changeViewValue:re,eventMap:ae,goBackward:J,goForward:Y,goToday:oe,hideMinMaxTime:u,hourMax:I,hourMin:L,timeStep:p,scrollable:D,size:ie,startWeek:ee,view:G,viewValue:ne,onEventCreate:ce,onEventChange:X,onEventDelete:ue,onEventEdit:le,eventRenderer:fe,pointerPreviewRenderer:de}),[s,de,w,K,re,ae,J,Y,oe,u,I,L,D,ie,ee,p,G,ne,ce,X,ue,le,fe]);return(0,a.jsx)(`div`,{...pe,className:(0,t.cx)(pe.className,ot.root),"data-ww-size":ie===`regular`?void 0:ie,children:(0,a.jsx)(R.Provider,{value:me,children:(0,a.jsx)(r.DragAndDropContext.Provider,{value:q,children:(0,a.jsxs)(B.Provider,{value:W,children:[(0,a.jsx)(`div`,{className:ot.root__head,children:(0,a.jsx)(se,{})}),(0,a.jsx)(`div`,{className:ot.root__body,children:G===`month`?(0,a.jsx)(He,{}):(0,a.jsx)(at,{})})]})})})})}exports.Calendar=st,exports.default=st,exports.DateLocalizationContext=s,exports.DateLocalizationProvider=function(n){let{adapter:r,messages:i,children:o}=n,c=(0,e.useMemo)(()=>typeof r==`function`?new r:r,[r]),l=(0,e.useMemo)(()=>(0,t.resolveMessages)(c.locale,i),[c.locale,i]);return(0,a.jsx)(s.Provider,{value:c,children:(0,a.jsx)(u.Provider,{value:l,children:o})})},exports.MessagesContext=u,Object.defineProperty(exports,"builtInMessages",{enumerable:!0,get:function(){return t.builtInMessages}}),Object.defineProperty(exports,"resolveMessages",{enumerable:!0,get:function(){return t.resolveMessages}}),exports.useDateUtils=c,exports.useMessages=d;
|
|
13
13
|
//# sourceMappingURL=index.cjs.map
|