@dayflow/core 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
1
- import e,{useMemo as t,useState as n,useCallback as r,useEffect as a,useRef as o,createContext as i,useContext as s}from"react";import{jsxs as l,jsx as d,Fragment as c}from"react/jsx-runtime";import{PanelRightClose as u,PanelRightOpen as h,ChevronLeft as g,ChevronRight as f,ChevronsUpDown as m,Check as v,ChevronsLeft as y,ChevronsRight as p,MoveRight as b,Gift as D,Heart as w,Star as x,MapPin as E,CalendarDays as M,Calendar as C}from"lucide-react";import k from"react-dom";import{createRoot as N}from"react-dom/client";var T;!function(e){e.DAY="day",e.WEEK="week",e.MONTH="month",e.YEAR="year"}(T||(T={}));const I=100,S=8,H=150,O=80,R=90,P=119;class ${constructor(e=I){this.cache=new Map,this.accessOrder=[],this.maxSize=e}getKey(e){return`${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`}get(e){const t=this.getKey(e),n=this.cache.get(t);if(n)return this.updateAccessOrder(t),n}set(e,t){const n=this.getKey(e);if(this.cache.size>=this.maxSize){const e=this.accessOrder.shift();void 0!==e&&this.cache.delete(e)}this.cache.set(n,t),this.updateAccessOrder(n)}updateAccessOrder(e){const t=this.accessOrder.indexOf(e);t>-1&&this.accessOrder.splice(t,1),this.accessOrder.push(e)}getSize(){return this.cache.size}clear(){this.cache.clear(),this.accessOrder=[]}}const j=[{id:"blue",name:"Blue",isDefault:!0,colors:{eventColor:"#eff6ff",eventSelectedColor:"rgba(59, 130, 246)",lineColor:"#3b82f6",textColor:"#1e3a8a"},darkColors:{eventColor:"rgba(30, 64, 175, 0.8)",eventSelectedColor:"rgba(30, 58, 138, 1)",lineColor:"#3b82f6",textColor:"#dbeafe"}},{id:"green",name:"Green",isDefault:!0,colors:{eventColor:"#f0fdf4",eventSelectedColor:"rgba(16, 185, 129, 1)",lineColor:"#10b981",textColor:"#064e3b"},darkColors:{eventColor:"rgba(4, 120, 87, 0.8)",eventSelectedColor:"rgba(6, 78, 59, 1)",lineColor:"#10b981",textColor:"#d1fae5"}},{id:"purple",name:"Purple",isDefault:!0,colors:{eventColor:"#faf5ff",eventSelectedColor:"rgba(139, 92, 246, 1)",lineColor:"#8b5cf6",textColor:"#5b21b6"},darkColors:{eventColor:"rgba(109, 40, 217, 0.8)",eventSelectedColor:"rgba(91, 33, 182, 1)",lineColor:"#8b5cf6",textColor:"#ede9fe"}},{id:"yellow",name:"Yellow",isDefault:!0,colors:{eventColor:"#fefce8",eventSelectedColor:"rgba(245, 158, 11, 1)",lineColor:"#f59e0b",textColor:"#78350f"},darkColors:{eventColor:"rgba(180, 83, 9, 0.8)",eventSelectedColor:"rgba(120, 53, 15, 1)",lineColor:"#f59e0b",textColor:"#fef3c7"}},{id:"red",name:"Red",isDefault:!0,colors:{eventColor:"#fef2f2",eventSelectedColor:"rgba(239, 68, 68, 1)",lineColor:"#ef4444",textColor:"#7f1d1d"},darkColors:{eventColor:"rgba(185, 28, 28, 0.8)",eventSelectedColor:"rgba(127, 29, 29, 1)",lineColor:"#ef4444",textColor:"#fee2e2"}},{id:"orange",name:"Orange",isDefault:!0,colors:{eventColor:"#fff7edb3",eventSelectedColor:"rgba(249, 115, 22, 1)",lineColor:"#f97316",textColor:"#7c2d12"},darkColors:{eventColor:"rgba(194, 65, 12, 0.8)",eventSelectedColor:"rgba(124, 45, 18, 1)",lineColor:"#f97316",textColor:"#fed7aa"}},{id:"pink",name:"Pink",isDefault:!0,colors:{eventColor:"#fdf2f8",eventSelectedColor:"rgba(236, 72, 153, 1)",lineColor:"#ec4899",textColor:"#831843"},darkColors:{eventColor:"rgba(190, 24, 93, 0.8)",eventSelectedColor:"rgba(131, 24, 67, 1)",lineColor:"#ec4899",textColor:"#fce7f3"}},{id:"teal",name:"Teal",isDefault:!0,colors:{eventColor:"#f0fdfa",eventSelectedColor:"rgba(20, 184, 166, 1)",lineColor:"#14b8a6",textColor:"#134e4a"},darkColors:{eventColor:"rgba(15, 118, 110, 0.8)",eventSelectedColor:"rgba(19, 78, 74, 1)",lineColor:"#14b8a6",textColor:"#ccfbf1"}},{id:"indigo",name:"Indigo",isDefault:!0,colors:{eventColor:"#eef2ffb3",eventSelectedColor:"rgba(99, 102, 241, 1)",lineColor:"#6366f1",textColor:"#312e81"},darkColors:{eventColor:"rgba(67, 56, 202, 0.8)",eventSelectedColor:"rgba(49, 46, 129, 1)",lineColor:"#6366f1",textColor:"#e0e7ff"}},{id:"gray",name:"Gray",isDefault:!0,colors:{eventColor:"#f9fafbb3",eventSelectedColor:"rgba(107, 114, 128, 1)",lineColor:"#6b7280",textColor:"#1f2937"},darkColors:{eventColor:"rgba(75, 85, 99, 0.8)",eventSelectedColor:"rgba(31, 41, 55, 1)",lineColor:"#6b7280",textColor:"#f3f4f6"}}];class Y{constructor(e,t,n="light"){this.calendars=new Map,this.defaultCalendarId=t||"blue",this.currentTheme=n;const r=e&&e.length>0;e?e.forEach(e=>{this.calendars.set(e.id,e)}):j.forEach(e=>{this.calendars.set(e.id,Object.assign(Object.assign({},e),{isVisible:!r&&e.isVisible}))})}register(e){this.calendars.set(e.id,e)}unregister(e){return this.calendars.delete(e)}get(e){return this.calendars.get(e)}getAll(){return Array.from(this.calendars.values())}getVisible(){return this.getAll().filter(e=>!1!==e.isVisible)}has(e){return this.calendars.has(e)}setVisibility(e,t){const n=this.calendars.get(e);n&&this.calendars.set(e,Object.assign(Object.assign({},n),{isVisible:t}))}setAllVisibility(e){this.calendars.forEach((t,n)=>{this.calendars.set(n,Object.assign(Object.assign({},t),{isVisible:e}))})}setDefaultCalendar(e){if(!this.has(e))throw new Error(`Calendar type '${e}' does not exist`);this.defaultCalendarId=e}getDefaultCalendarId(){return this.defaultCalendarId}getDefaultCalendar(){const e=this.get(this.defaultCalendarId);return e||this.getAll()[0]}setTheme(e){this.currentTheme=e}getTheme(){return this.currentTheme}resolveColors(e,t){const n=t||this.currentTheme,r=this.isDarkTheme(n);let a;return e&&(a=this.get(e)),a||(a=this.getDefaultCalendar()),r&&a.darkColors?a.darkColors:a.colors}getSelectedBgColor(e,t){return this.resolveColors(e,t).eventSelectedColor}getLineColor(e,t){return this.resolveColors(e,t).lineColor}getTextColor(e,t){return this.resolveColors(e,t).textColor}isDarkTheme(e){return"dark"===e||"light"!==e&&(!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-color-scheme: dark)").matches)}validate(e){const t=[];return e.id||t.push("Calendar type must have an id"),e.name||t.push("Calendar type must have a name"),e.colors?(e.colors.eventColor||t.push("Calendar colors must include eventColor"),e.colors.eventSelectedColor||t.push("Calendar colors must include eventSelectedColor"),e.colors.lineColor||t.push("Calendar colors must include lineColor"),e.colors.textColor||t.push("Calendar colors must include textColor")):t.push("Calendar type must have colors configuration"),t}}let L=new Y;function A(){return L}const Z=new class{constructor(){this.isDevelopment="production"!==process.env.NODE_ENV}formatMessage(e,t,...n){if(!this.isDevelopment)return;const r=(new Date).toISOString(),a=`[DayFlow ${e.toUpperCase()}] ${r}:`;switch(e){case"log":console.log(a,t,...n);break;case"warn":console.warn(a,t,...n);break;case"error":console.error(a,t,...n);break;case"debug":console.debug(a,t,...n)}}log(e,...t){this.formatMessage("log",e,...t)}warn(e,...t){this.formatMessage("warn",e,...t)}error(e,...t){this.formatMessage("error",e,...t)}debug(e,...t){this.formatMessage("debug",e,...t)}};function z(e,t="240px"){return"number"==typeof e?`${e}px`:"string"==typeof e&&e.trim().length>0?e:t}const F="240px";class V{constructor(t){var n,r,a,o;this.changeView=e=>{var t,n;if(!this.state.views.has(e))throw new Error(`View ${e} is not registered`);this.state.currentView=e,null===(n=(t=this.callbacks).onViewChange)||void 0===n||n.call(t,e)},this.getCurrentView=()=>{const e=this.state.views.get(this.state.currentView);if(!e)throw new Error(`Current view ${this.state.currentView} is not registered`);return e},this.setCurrentDate=e=>{var t,n;this.state.currentDate=new Date(e),null===(n=(t=this.callbacks).onDateChange)||void 0===n||n.call(t,this.state.currentDate),this.setVisibleMonth(this.state.currentDate)},this.getCurrentDate=()=>new Date(this.state.currentDate),this.setVisibleMonth=e=>{var t,n;const r=new Date(e.getFullYear(),e.getMonth(),1);this.visibleMonth.getFullYear()===r.getFullYear()&&this.visibleMonth.getMonth()===r.getMonth()||(this.visibleMonth=r,null===(n=(t=this.callbacks).onVisibleMonthChange)||void 0===n||n.call(t,new Date(this.visibleMonth)))},this.getVisibleMonth=()=>new Date(this.visibleMonth),this.goToToday=()=>{this.setCurrentDate(new Date)},this.goToPrevious=()=>{const e=new Date(this.state.currentDate);switch(this.state.currentView){case T.DAY:e.setDate(e.getDate()-1);break;case T.WEEK:e.setDate(e.getDate()-7);break;case T.MONTH:e.setMonth(e.getMonth()-1)}this.setCurrentDate(e)},this.goToNext=()=>{const e=new Date(this.state.currentDate);switch(this.state.currentView){case T.DAY:e.setDate(e.getDate()+1);break;case T.WEEK:e.setDate(e.getDate()+7);break;case T.MONTH:e.setMonth(e.getMonth()+1)}this.setCurrentDate(e)},this.selectDate=e=>{var t,n;this.setCurrentDate(e),null===(n=(t=this.callbacks).onDateChange)||void 0===n||n.call(t,new Date(e))},this.addEvent=e=>{var t,n;this.state.events=[...this.state.events,e],null===(n=(t=this.callbacks).onEventCreate)||void 0===n||n.call(t,e)},this.updateEvent=(e,t,n)=>{var r,a;const o=this.state.events.findIndex(t=>t.id===e);if(-1===o)throw new Error(`Event with id ${e} not found`);const i=Object.assign(Object.assign({},this.state.events[o]),t);this.state.events=[...this.state.events.slice(0,o),i,...this.state.events.slice(o+1)],n||null===(a=(r=this.callbacks).onEventUpdate)||void 0===a||a.call(r,i)},this.deleteEvent=e=>{var t,n;const r=this.state.events.findIndex(t=>t.id===e);if(-1===r)throw new Error(`Event with id ${e} not found`);this.state.events=[...this.state.events.slice(0,r),...this.state.events.slice(r+1)],null===(n=(t=this.callbacks).onEventDelete)||void 0===n||n.call(t,e)},this.getAllEvents=()=>[...this.state.events],this.getEvents=()=>{const e=this.getAllEvents(),t=new Set(this.calendarRegistry.getAll().filter(e=>!1!==e.isVisible).map(e=>e.id));return e.filter(e=>!e.calendarId||(!this.calendarRegistry.has(e.calendarId)||t.has(e.calendarId)))},this.getCalendars=()=>this.calendarRegistry.getAll(),this.setCalendarVisibility=(e,t)=>{var n,r;this.calendarRegistry.setVisibility(e,t),null===(r=(n=this.callbacks).onRender)||void 0===r||r.call(n)},this.setAllCalendarsVisibility=e=>{var t,n;this.calendarRegistry.setAllVisibility(e),null===(n=(t=this.callbacks).onRender)||void 0===n||n.call(t)},this.getSidebarConfig=()=>this.sidebarConfig,this.installPlugin=e=>{this.state.plugins.has(e.name)?Z.warn(`Plugin ${e.name} is already installed`):(this.state.plugins.set(e.name,e),e.install(this))},this.getPlugin=e=>{const t=this.state.plugins.get(e);return null==t?void 0:t.api},this.hasPlugin=e=>this.state.plugins.has(e),this.render=()=>e.createElement("div",{className:"calendar-app"},"Calendar App"),this.getPluginConfig=e=>{const t=this.state.plugins.get(e);return(null==t?void 0:t.config)||{}},this.updatePluginConfig=(e,t)=>{const n=this.state.plugins.get(e);n&&(n.config=Object.assign(Object.assign({},n.config),t))},this.getViewConfig=e=>{const t=this.state.views.get(e);return(null==t?void 0:t.config)||{}},this.triggerRender=()=>{var e,t;null===(t=(e=this.callbacks).onRender)||void 0===t||t.call(e)},this.getCalendarRegistry=()=>this.calendarRegistry,this.getUseEventDetailDialog=()=>this.useEventDetailDialog,this.setTheme=e=>{var t,n;this.calendarRegistry.setTheme(e),this.themeChangeListeners.forEach(t=>{t(e)}),null===(n=(t=this.callbacks).onRender)||void 0===n||n.call(t)},this.getTheme=()=>this.calendarRegistry.getTheme(),this.subscribeThemeChange=e=>(this.themeChangeListeners.add(e),()=>{this.unsubscribeThemeChange(e)}),this.unsubscribeThemeChange=e=>{this.themeChangeListeners.delete(e)},this.state={currentView:t.defaultView||T.WEEK,currentDate:t.initialDate||new Date,events:t.events||[],switcherMode:t.switcherMode||"buttons",plugins:new Map,views:new Map},this.callbacks=t.callbacks||{},this.themeChangeListeners=new Set,this.calendarRegistry=new Y(t.calendars,t.defaultCalendar,(null===(n=t.theme)||void 0===n?void 0:n.mode)||"light"),o=this.calendarRegistry,L=o,this.sidebarConfig=(e=>{if(!e)return{enabled:!1,width:F,initialCollapsed:!1};if(!0===e)return{enabled:!0,width:F,initialCollapsed:!1};const{enabled:t=!0,width:n,initialCollapsed:r=!1,render:a}=e;return{enabled:t,width:z(n,F),initialCollapsed:r,render:a}})(t.useSidebar),this.state.sidebar=this.sidebarConfig;const i=this.state.currentDate;this.visibleMonth=new Date(i.getFullYear(),i.getMonth(),1),this.useEventDetailDialog=null!==(r=t.useEventDetailDialog)&&void 0!==r&&r,t.views.forEach(e=>{this.state.views.set(e.type,e)}),null===(a=t.plugins)||void 0===a||a.forEach(e=>{this.installPlugin(e)})}}function B(e){const o=t(()=>new V(e),[]),[i,s]=n(o.state.currentView),[l,d]=n(o.state.currentDate),[c,u]=n(o.getEvents()),[,h]=n({}),g=r(()=>{h({})},[]);a(()=>{const e=o.changeView;o.changeView=t=>{e(t),s(t),g()};const t=o.setCurrentDate;o.setCurrentDate=e=>{t(e),d(new Date(e)),g()};const n=o.addEvent;o.addEvent=e=>{n(e),u([...o.getEvents()]),g()};const r=o.updateEvent;o.updateEvent=(e,t,n)=>{r(e,t,n),u([...o.getEvents()]),g()};const a=o.deleteEvent;o.deleteEvent=e=>{a(e),u([...o.getEvents()]),g()};const i=o.setCalendarVisibility;o.setCalendarVisibility=(e,t)=>{i(e,t),u([...o.getEvents()]),g()};const l=o.setAllCalendarsVisibility;o.setAllCalendarsVisibility=e=>{l(e),u([...o.getEvents()]),g()};const c=o.setVisibleMonth;return o.setVisibleMonth=e=>{c(e),g()},()=>{}},[o,g]),a(()=>{s(o.state.currentView),d(o.state.currentDate),u(o.getEvents())},[o]);const f=r(e=>{o.changeView(e)},[o]),m=r(e=>{o.setCurrentDate(e)},[o]),v=r(e=>{o.addEvent(e)},[o]),y=r((e,t,n)=>{o.updateEvent(e,t,n)},[o]),p=r(e=>{o.deleteEvent(e)},[o]),b=r(()=>{o.goToToday()},[o]),D=r(()=>{o.goToPrevious()},[o]),w=r(()=>{o.goToNext()},[o]),x=r(e=>{o.selectDate(e)},[o]),E=r((e,t)=>{o.setCalendarVisibility(e,t)},[o]),M=r(e=>{o.setAllCalendarsVisibility(e)},[o]);return{app:o,currentView:i,currentDate:l,events:c,changeView:f,setCurrentDate:m,addEvent:v,updateEvent:y,deleteEvent:p,goToToday:b,goToPrevious:D,goToNext:w,selectDate:x,getCalendars:()=>o.getCalendars(),setCalendarVisibility:E,setAllCalendarsVisibility:M,getAllEvents:()=>o.getAllEvents(),setVisibleMonth:e=>o.setVisibleMonth(e),getVisibleMonth:()=>o.getVisibleMonth(),sidebarConfig:o.getSidebarConfig()}}const W="p-2 flex justify-between",U="text-2xl font-semibold text-gray-900 dark:text-gray-100",q="relative overflow-y-auto calendar-content",_="w-20 flex-shrink-0 border-gray-200 dark:border-gray-700",G="relative h-[4.5rem] flex",X="absolute -top-2.5 right-2 text-[12px] text-gray-500 dark:text-gray-400",J="h-[4.5rem] border-t first:border-none border-gray-200 dark:border-gray-700 flex",K="absolute left-0 top-0 flex pointer-events-none",Q="ml-2 text-white text-xs font-bold px-1.5 bg-red-500 rounded-sm",ee="flex items-center border-b border-gray-200 dark:border-gray-700 sticky",te="w-20 flex-shrink-0 p-1 text-xs font-medium text-gray-500 dark:text-gray-400 flex justify-end",ne="calendar-event select-none pointer-events-auto px-0.5",re="rounded-xl my-0.5",ae="font-medium text-xs truncate pr-1",oe="absolute left-1 top-1 bottom-1 w-[3px] rounded-full",ie="h-3 w-3 mr-1",se="resize-handle absolute right-0 top-0 bottom-0 w-1 cursor-ew-resize opacity-0 group-hover:opacity-100 transition-opacity z-20",le="grid grid-cols-7 gap-1 text-xs justify-items-center",de="text-center text-gray-500 dark:text-gray-400 font-medium py-1 h-6 w-6",ce="text-center py-1 rounded text-xs h-6 w-6",ue="text-gray-900 dark:text-gray-100",he="text-gray-400 dark:text-gray-600",ge="bg-blue-500 rounded-full text-white",fe="bg-red-100 text-red-600 rounded-full font-medium",me="text-gray-600 dark:text-gray-300",ve="text-xs",ye="text-sm",pe="flex flex-col",be="mr-1";function De(e,t,n,r,a){return we(t,((e,t)=>{const n=e[t];if(void 0===n)throw new TypeError(Fo(t));return n})(e,t),n,r,a)}function we(e,t,n,r,a,o){const i=ze(t,n,r);if(a&&t!==i)throw new RangeError(Zo(e,t,n,r,o));return i}function xe(e){return null!==e&&/object|function/.test(typeof e)}function Ee(e,t=Map){const n=new t;return(t,...r)=>{if(n.has(t))return n.get(t);const a=e(t,...r);return n.set(t,a),a}}function Me(e){return Ce({name:e},1)}function Ce(e,t){return Ie(e=>({value:e,configurable:1,writable:!t}),e)}function ke(e){return Ie(e=>({get:e,configurable:1}),e)}function Ne(e){return{[Symbol.toStringTag]:{value:e,configurable:1}}}function Te(e,t){const n={};let r=e.length;for(const a of t)n[e[--r]]=a;return n}function Ie(e,t,n){const r={};for(const a in t)r[a]=e(t[a],a,n);return r}function Se(e,t,n){const r={};for(let a=0;a<t.length;a++){const o=t[a];r[o]=e(o,a,n)}return r}function He(e,t,n){const r={};for(let a=0;a<e.length;a++)r[t[a]]=n[e[a]];return r}function Oe(e,t){const n=Object.create(null);for(const r of e)n[r]=t[r];return n}function Re(e,t){for(const n of t)if(n in e)return 1;return 0}function Pe(e,t,n){for(const r of e)if(t[r]!==n[r])return 0;return 1}function $e(e,t,n){const r={...n};for(let n=0;n<t;n++)r[e[n]]=0;return r}function je(e,...t){return(...n)=>e(...t,...n)}function Ye(e){return e[0].toUpperCase()+e.substring(1)}function Le(e){return e.slice().sort()}function Ae(e,t){return String(t).padStart(e,"0")}function Ze(e,t){return Math.sign(e-t)}function ze(e,t,n){return Math.min(Math.max(e,t),n)}function Fe(e,t){return[Math.floor(e/t),Ve(e,t)]}function Ve(e,t){return(e%t+t)%t}function Be(e,t){return[We(e,t),Ue(e,t)]}function We(e,t){return Math.trunc(e/t)||0}function Ue(e,t){return e%t||0}function qe(e){return.5===Math.abs(e%1)}function _e(e,t,n){let r=0,a=0;for(let o=0;o<=t;o++){const t=e[n[o]],i=Yi[o],s=ji/i,[l,d]=Be(t,s);r+=d*i,a+=l}const[o,i]=Be(r,ji);return[a+o,i]}function Ge(e,t,n){const r={};for(let a=t;a>=0;a--){const t=Yi[a];r[n[a]]=We(e,t),e=Ue(e,t)}return r}function Xe(e){if(void 0!==e)return Ke(e)}function Je(e){return rt(Ke(e))}function Ke(e){return nt(cs(e))}function Qe(e,t){if(null==t)throw new RangeError(Fo(e));return t}function et(e){if(!xe(e))throw new TypeError(Ao);return e}function tt(e,t,n=e){if(typeof t!==e)throw new TypeError(zo(n,t));return t}function nt(e,t="number"){if(!Number.isInteger(e))throw new RangeError(Ro(t,e));return e||0}function rt(e,t="number"){if(e<=0)throw new RangeError(Po(t,e));return e}function at(e){if("symbol"==typeof e)throw new TypeError(Lo);return String(e)}function ot(e,t){return xe(e)?String(e):ls(e,t)}function it(e){if("string"==typeof e)return BigInt(e);if("bigint"!=typeof e)throw new TypeError(Yo(e));return e}function st(e,t="number"){if("bigint"==typeof e)throw new TypeError(jo(t));if(e=Number(e),!Number.isFinite(e))throw new RangeError($o(t,e));return e}function lt(e,t){return Math.trunc(st(e,t))||0}function dt(e,t){return nt(st(e,t),t)}function ct(e,t){return rt(lt(e,t),t)}function ut(e,t){let[n,r]=Be(t,ji),a=e+n;const o=Math.sign(a);return o&&o===-Math.sign(r)&&(a-=o,r+=o*ji),[a,r]}function ht(e,t,n=1){return ut(e[0]+t[0]*n,e[1]+t[1]*n)}function gt(e,t){return ut(e[0],e[1]+t)}function ft(e,t){return ht(t,e,-1)}function mt(e,t){return Ze(e[0],t[0])||Ze(e[1],t[1])}function vt(e,t,n){return-1===mt(e,t)||1===mt(e,n)}function yt(e,t=1){const n=BigInt(ji/t);return[Number(e/n),Number(e%n)*t]}function pt(e,t=1){const n=ji/t,[r,a]=Be(e,n);return[r,a*t]}function bt(e,t=1,n){const[r,a]=e,[o,i]=Be(a,t);return r*(ji/t)+(o+(n?i/t:0))}function Dt(e,t,n=Fe){const[r,a]=e,[o,i]=n(a,t);return[r*(ji/t)+o,i]}function wt(e){return De(e,"isoYear",Rs,Os,1),e.isoYear===Rs?De(e,"isoMonth",4,12,1):e.isoYear===Os&&De(e,"isoMonth",1,9,1),e}function xt(e){return Et({...e,...ks,isoHour:12}),e}function Et(e){const t=De(e,"isoYear",Rs,Os,1),n=t===Rs?1:t===Os?-1:0;return n&&Mt(It({...e,isoDay:e.isoDay+n,isoNanosecond:e.isoNanosecond-n})),e}function Mt(e){if(!e||vt(e,Hs,Ss))throw new RangeError(gi);return e}function Ct(e){return _e(e,5,Ds)[1]}function kt(e){const[t,n]=Fe(e,ji);return[Ge(n,5,Ds),t]}function Nt(e){return Dt(e,Ri)}function Tt(e){return Ot(e.isoYear,e.isoMonth,e.isoDay,e.isoHour,e.isoMinute,e.isoSecond,e.isoMillisecond)}function It(e){const t=Tt(e);if(void 0!==t){const[n,r]=Be(t,Ii);return[n,r*Oi+(e.isoMicrosecond||0)*Hi+(e.isoNanosecond||0)]}}function St(e,t){const[n,r]=kt(Ct(e)-t);return Mt(It({...e,isoDay:e.isoDay+r,...n}))}function Ht(...e){return Ot(...e)/Si}function Ot(...e){const[t,n]=Rt(...e),r=t.valueOf();if(!isNaN(r))return r-n*Ii}function Rt(e,t=1,n=1,r=0,a=0,o=0,i=0){const s=e===Rs?1:e===Os?-1:0,l=new Date;return l.setUTCHours(r,a,o,i),l.setUTCFullYear(e,t-1,n+s),[l,s]}function Pt(e,t){let[n,r]=gt(e,t);r<0&&(r+=ji,n-=1);const[a,o]=Fe(r,Oi),[i,s]=Fe(o,Hi);return $t(n*Ii+a,i,s)}function $t(e,t=0,n=0){const r=Math.ceil(Math.max(0,Math.abs(e)-Is)/Ii)*Math.sign(e),a=new Date(e-r*Ii);return Te(xs,[a.getUTCFullYear(),a.getUTCMonth()+1,a.getUTCDate()+r,a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds(),a.getUTCMilliseconds(),t,n])}function jt(e,t){if(t<-Is)throw new RangeError(gi);const n=e.formatToParts(t),r={};for(const e of n)r[e.type]=e.value;return r}function Yt(e){return[e.isoYear,e.isoMonth,e.isoDay]}function Lt(e,t){return[t,0]}function At(){return Ls}function Zt(e,t){switch(t){case 2:return Ft(e)?29:28;case 4:case 6:case 9:case 11:return 30}return 31}function zt(e){return Ft(e)?366:365}function Ft(e){return e%4==0&&(e%100!=0||e%400==0)}function Vt(e){const[t,n]=Rt(e.isoYear,e.isoMonth,e.isoDay);return Ve(t.getUTCDay()-n,7)||7}function Bt(e){return this.id===rs?(({isoYear:e})=>e<1?["gregory-inverse",1-e]:["gregory",e])(e):this.id===as?Zs(e):[]}function Wt(e){const t=Tt(e);if(t<As){const{isoYear:t}=e;return t<1?["japanese-inverse",1-t]:["japanese",t]}const n=jt(Jl(as),t),{era:r,eraYear:a}=Xa(n,as);return[r,a]}function Ut(e){return qt(e),Xt(e,1),e}function qt(e){return Gt(e,1),e}function _t(e){return Pe(ws,e,Gt(e))}function Gt(e,t){const{isoYear:n}=e,r=De(e,"isoMonth",1,At(),t);return{isoYear:n,isoMonth:r,isoDay:De(e,"isoDay",1,Zt(n,r),t)}}function Xt(e,t){return Te(Ds,[De(e,"isoHour",0,23,t),De(e,"isoMinute",0,59,t),De(e,"isoSecond",0,59,t),De(e,"isoMillisecond",0,999,t),De(e,"isoMicrosecond",0,999,t),De(e,"isoNanosecond",0,999,t)])}function Jt(e){return void 0===e?0:ol(et(e))}function Kt(e,t=0){e=dn(e);const n=il(e),r=sl(e,t);return[ol(e),r,n]}function Qt(e,t,n,r=9,a=0,o=4){t=dn(t);let i=rl(t,r,a),s=on(t),l=ul(t,o);const d=nl(t,r,a,1);return null==i?i=Math.max(n,d):fn(i,d),s=sn(s,d,1),e&&(l=(e=>e<4?(e+2)%4:e)(l)),[i,d,s,l]}function en(e,t=6,n){let r=on(e=cn(e,zs));const a=ul(e,7);let o=nl(e,t);return o=Qe(zs,o),r=sn(r,o,void 0,n),[o,r,a]}function tn(e){return ll(dn(e))}function nn(e,t){return rn(dn(e),t)}function rn(e,t=4){const n=ln(e);return[ul(e,4),...an(nl(e,t),n)]}function an(e,t){return null!=e?[Yi[e],e<4?9-3*e:-1]:[void 0===t?1:10**(9-t),t]}function on(e){const t=e[Vs];return void 0===t?1:lt(t,Vs)}function sn(e,t,n,r){const a=r?ji:Yi[t+1];if(a){const n=Yi[t];if(a%((e=we(Vs,e,1,a/n-(r?0:1),1))*n))throw new RangeError(zo(Vs,e))}else e=we(Vs,e,1,n?10**9:1,1);return e}function ln(e){let t=e[Bs];if(void 0!==t){if("number"!=typeof t){if("auto"===at(t))return;throw new RangeError(zo(Bs,t))}t=we(Bs,Math.floor(t),0,9,1)}return t}function dn(e){return void 0===e?{}:et(e)}function cn(e,t){return"string"==typeof e?{[t]:e}:et(e)}function un(e){return{overflow:_s[e]}}function hn(e,t,n=9,r=0,a){let o=t[e];if(void 0===o)return a?r:void 0;if(o=at(o),"auto"===o)return a?r:null;let i=Ni[o];if(void 0===i&&(i=vs[o]),void 0===i)throw new RangeError(Uo(e,o,Ni));return we(e,i,r,n,1,Ti),i}function gn(e,t,n,r=0){const a=n[e];if(void 0===a)return r;const o=at(a),i=t[o];if(void 0===i)throw new RangeError(Uo(e,o,t));return i}function fn(e,t){if(t>e)throw new RangeError(bi)}function mn(e){return{branding:pl,epochNanoseconds:e}}function vn(e,t,n){return{branding:yl,calendar:n,timeZone:t,epochNanoseconds:e}}function yn(e,t=e.calendar){return{branding:ml,calendar:t,...Oe(Cs,e)}}function pn(e,t=e.calendar){return{branding:fl,calendar:t,...Oe(Es,e)}}function bn(e,t=e.calendar){return{branding:hl,calendar:t,...Oe(Es,e)}}function Dn(e,t=e.calendar){return{branding:gl,calendar:t,...Oe(Es,e)}}function wn(e){return{branding:vl,...Oe(Ms,e)}}function xn(e){return{branding:bl,sign:jr(e),...Oe(hs,e)}}function En(e){return Dt(e.epochNanoseconds,Oi)[0]}function Mn(e){return e.epochNanoseconds}function Cn(e,t){return bt(Ar(e),Yi[t],1)}function kn(e,t,n,r,a,o,i){const s=us[n],l={...t,[s]:t[s]+r},d=i(e,a,t),c=i(e,a,l);return[o(d),o(c)]}function Nn(e,t,n){const r=bt(ft(t,n));if(!r)throw new RangeError(ri);return bt(ft(t,e))/r}function Tn(e,t,n,r){return In(e,On(t,n),r)}function In(e,t,n){const[r,a]=Sn(e,t,n);return Et({...kr(e,a),...r})}function Sn(e,t,n){return kt(An(Ct(e),t,n))}function Hn(e){return An(e,Pi,7)}function On(e,t){return Yi[e]*t}function Rn(e){const t=Pn(e);return[t,kr(t,1)]}function Pn(e){return Ns(6,e)}function $n(e,t,n){const r=Math.min(Vr(e),6);return Zr(Ln(Ar(e,r),t,n),r)}function jn(e,t,n,r,a,o,i,s,l,d){if(0===r&&1===a)return e;const c=Or(r,s)?Hr(s)&&r<6&&n>=6?Fn:zn:Vn;let[u,h,g]=c(e,t,n,r,a,o,i,s,l,d);return g&&7!==r&&(u=((e,t,n,r,a,o,i,s)=>{const l=jr(e);for(let d=r+1;d<=n;d++){if(7===d&&7!==n)continue;const r=bs(d,e);r[us[d]]+=l;const c=bt(ft(i(s(a,o,r)),t));if(c&&Math.sign(c)!==l)break;e=r}return e})(u,h,n,Math.max(6,r),i,s,l,d)),u}function Yn(e,t,n,r,a){if(6===t){const t=(e=>e[0]+e[1]/ji)(e);return[An(t,n,r),0]}return Ln(e,On(t,n),r,a)}function Ln(e,t,n,r){let[a,o]=e;r&&o<0&&(o+=ji,a-=1);const[i,s]=Fe(An(o,t,n),ji);return ut(a+i,s)}function An(e,t,n){return Zn(e/t,n)*t}function Zn(e,t){return Dl[t](e)}function zn(e,t,n,r,a,o){const i=jr(e),s=Ar(e),l=Yn(s,r,a,o),d=ft(s,l),c=Math.sign(l[0]-s[0])===i,u=Zr(l,Math.min(n,6));return[{...e,...u},ht(t,d),c]}function Fn(e,t,n,r,a,o,i,s,l,d){const c=jr(e)||1,u=bt(Ar(e,5)),h=On(r,a);let g=An(u,h,o);const[f,m]=kn(i,{...e,...ps},6,c,s,l,d),v=g-bt(ft(f,m));let y=0;v&&Math.sign(v)!==c?t=gt(f,g):(y+=c,g=An(v,h,o),t=gt(m,g));const p=zr(g);return[{...e,...p,days:e.days+y},t,Boolean(y)]}function Vn(e,t,n,r,a,o,i,s,l,d){const c=jr(e),u=us[r],h=bs(r,e);7===r&&(e={...e,weeks:e.weeks+Math.trunc(e.days/7)});const g=We(e[u],a)*a;h[u]=g;const[f,m]=kn(i,h,r,a*c,s,l,d),v=g+Nn(t,f,m)*c*a,y=An(v,a,o),p=Math.sign(y-v)===c;return h[u]=y,[h,p?m:f,p]}function Bn(e,t,n,r){const[a,o,i,s]=(e=>{const t=rn(e=dn(e));return[e.timeZone,...t]})(r),l=void 0!==a;return((e,t,n,r,a,o)=>{n=Ln(n,a,r,1);const i=t.R(n);return er(Pt(n,i),o)+(e?or(Hn(i)):"Z")})(l,t(l?e(a):wl),n.epochNanoseconds,o,i,s)}function Wn(e,t,n){const[r,a,o,i,s,l]=(e=>{e=dn(e);const t=ll(e),n=ln(e),r=cl(e),a=ul(e,4),o=nl(e,4);return[t,dl(e),r,a,...an(o,n)]})(n);return((e,t,n,r,a,o,i,s,l,d)=>{r=Ln(r,l,s,1);const c=e(n).R(r);return er(Pt(r,c),d)+or(Hn(c),i)+((e,t)=>1!==t?"["+(2===t?"!":"")+e+"]":"")(n,o)+ir(t,a)})(e,t.calendar,t.timeZone,t.epochNanoseconds,r,a,o,i,s,l)}function Un(e,t){const[n,r,a,o]=(e=>(e=dn(e),[ll(e),...rn(e)]))(t);return i=e.calendar,s=n,l=o,er(In(e,a,r),l)+ir(i,s);var i,s,l}function qn(e,t){return n=e.calendar,r=e,a=tn(t),tr(r)+ir(n,a);var n,r,a}function _n(e,t){return Kn(e.calendar,nr,e,tn(t))}function Gn(e,t){return Kn(e.calendar,rr,e,tn(t))}function Xn(e,t){const[n,r,a]=nn(t);return o=a,ar(Sn(e,r,n)[0],o);var o}function Jn(e,t){const[n,r,a]=nn(t,3);return r>1&&Yr(e={...e,...$n(e,r,n)}),((e,t)=>{const{sign:n}=e,r=-1===n?$r(e):e,{hours:a,minutes:o}=r,[i,s]=Dt(Ar(r,3),Ri,Be);Lr(i);const l=lr(s,t),d=t>=0||!n||l;return(n<0?"-":"")+"P"+Qn({Y:cr(r.years),M:cr(r.months),W:cr(r.weeks),D:cr(r.days)})+(a||o||i||d?"T"+Qn({H:cr(a),M:cr(o),S:cr(i,d)+l}):"")})(e,a)}function Kn(e,t,n,r){const a=r>1||0===r&&e!==ns;return 1===r?e===ns?t(n):tr(n):a?tr(n)+sr(e,2===r):t(n)}function Qn(e){const t=[];for(const n in e){const r=e[n];r&&t.push(r,n)}return t.join("")}function er(e,t){return tr(e)+"T"+ar(e,t)}function tr(e){return nr(e)+"-"+ki(e.isoDay)}function nr(e){const{isoYear:t}=e;return(t<0||t>9999?dr(t)+Ae(6,Math.abs(t)):Ae(4,t))+"-"+ki(e.isoMonth)}function rr(e){return ki(e.isoMonth)+"-"+ki(e.isoDay)}function ar(e,t){const n=[ki(e.isoHour),ki(e.isoMinute)];return-1!==t&&n.push(ki(e.isoSecond)+((e,t,n,r)=>lr(e*Oi+t*Hi+n,r))(e.isoMillisecond,e.isoMicrosecond,e.isoNanosecond,t)),n.join(":")}function or(e,t=0){if(1===t)return"";const[n,r]=Fe(Math.abs(e),$i),[a,o]=Fe(r,Pi),[i,s]=Fe(o,Ri);return dr(e)+ki(n)+":"+ki(a)+(i||s?":"+ki(i)+lr(s):"")}function ir(e,t){return 1!==t&&(t>1||0===t&&e!==ns)?sr(e,2===t):""}function sr(e,t){return"["+(t?"!":"")+"u-ca="+e+"]"}function lr(e,t){let n=Ae(9,e);return n=void 0===t?n.replace(Cl,""):n.slice(0,t),n?"."+n:""}function dr(e){return e<0?"-":"+"}function cr(e,t){return e||t?e.toLocaleString("fullwide",{useGrouping:0}):""}function ur(e,t){const{epochNanoseconds:n}=e,r=(t.R?t:t(e.timeZone)).R(n),a=Pt(n,r);return{calendar:e.calendar,...a,offsetNanoseconds:r}}function hr(e,t,n,r=0,a=0,o,i){if(void 0!==n&&1===r&&(1===r||i))return St(t,n);const s=e.I(t);if(void 0!==n&&3!==r){const e=((e,t,n,r)=>{const a=It(t);r&&(n=Hn(n));for(const t of e){let e=bt(ft(t,a));if(r&&(e=Hn(e)),e===n)return t}})(s,t,n,o);if(void 0!==e)return e;if(0===r)throw new RangeError(ui)}return i?It(t):gr(e,t,a,s)}function gr(e,t,n=0,r=e.I(t)){if(1===r.length)return r[0];if(1===n)throw new RangeError(hi);if(r.length)return r[3===n?1:0];const a=It(t),o=((e,t)=>{const n=e.R(gt(t,-ji));return(e=>{if(e>ji)throw new RangeError(ci);return e})(e.R(gt(t,ji))-n)})(e,a),i=o*(2===n?-1:1);return(r=e.I(Pt(a,i)))[2===n?0:r.length-1]}function fr(e,t){const n=e.I(t);if(n.length)return n[0];const r=gt(It(t),-ji);return e.O(r,1)}function mr(e,t,n){return mn(Mt(ht(t.epochNanoseconds,(e=>{if(Fr(e))throw new RangeError(yi);return Ar(e,5)})(e?$r(n):n))))}function vr(e,t,n,r,a,o=Object.create(null)){const i=t(r.timeZone),s=e(r.calendar);return{...r,...wr(i,s,r,n?$r(a):a,o)}}function yr(e,t,n,r,a=Object.create(null)){const{calendar:o}=n;return yn(xr(e(o),n,t?$r(r):r,a),o)}function pr(e,t,n,r,a){const{calendar:o}=n;return pn(Er(e(o),n,t?$r(r):r,a),o)}function br(e,t,n,r,a){const o=n.calendar,i=e(o);let s=xt(Mr(i,n));t&&(r=Pr(r)),r.sign<0&&(s=i.P(s,{...ys,months:1}),s=kr(s,-1));const l=i.P(s,r,a);return bn(Mr(i,l),o)}function Dr(e,t,n){return wn(Cr(t,e?$r(n):n)[0])}function wr(e,t,n,r,a){const o=Ar(r,5);let i=n.epochNanoseconds;if(Fr(r)){const s=kl(n,e);i=ht(gr(e,{...Er(t,s,{...r,...ps},a),...Oe(Ds,s)}),o)}else i=ht(i,o),Jt(a);return{epochNanoseconds:Mt(i)}}function xr(e,t,n,r){const[a,o]=Cr(t,n);return Et({...Er(e,t,{...n,...ps,days:n.days+o},r),...a})}function Er(e,t,n,r){if(n.years||n.months||n.weeks)return e.P(t,n,r);Jt(r);const a=n.days+Ar(n,5)[0];return a?xt(kr(t,a)):t}function Mr(e,t,n=1){return kr(t,n-e.day(t))}function Cr(e,t){const[n,r]=Ar(t,5),[a,o]=kt(Ct(e)+r);return[a,n+o]}function kr(e,t){return t?{...e,...$t(Tt(e)+t*Ii)}:e}function Nr(e,t,n){const r=e(n.calendar);return Hr(n)?[n,r,t(n.timeZone)]:[{...n,...ks},r]}function Tr(e){return e?Mn:It}function Ir(e){return e?je(wr,e):xr}function Sr(e){return e?je(ka,e):Na}function Hr(e){return e&&e.epochNanoseconds}function Or(e,t){return e<=6-(Hr(t)?1:0)}function Rr(e,t,n,r,a,o,i){const s=e(dn(i).relativeTo),l=Math.max(Vr(a),Vr(o));if(Or(l,s))return xn(Yr(((e,t,n,r)=>{const a=ht(Ar(e),Ar(t),r?-1:1);if(!Number.isFinite(a[0]))throw new RangeError(gi);return{...ys,...Zr(a,n)}})(a,o,l,r)));if(!s)throw new RangeError(vi);r&&(o=$r(o));const[d,c,u]=Nr(t,n,s),h=Ir(u),g=Sr(u),f=h(c,d,a);return xn(g(c,d,h(c,f,o),l))}function Pr(e){return xn($r(e))}function $r(e){const t={};for(const n of us)t[n]=-1*e[n]||0;return t}function jr(e,t=us){let n=0;for(const r of t){const t=Math.sign(e[r]);if(t){if(n&&n!==t)throw new RangeError(mi);n=t}}return n}function Yr(e){for(const t of ms)we(t,e[t],-Nl,Nl,1);return Lr(bt(Ar(e),Ri)),e}function Lr(e){if(!Number.isSafeInteger(e))throw new RangeError(fi)}function Ar(e,t=6){return _e(e,t,us)}function Zr(e,t=6){const[n,r]=e,a=Ge(r,t,us);if(a[us[t]]+=n*(ji/Yi[t]),!Number.isFinite(a[us[t]]))throw new RangeError(gi);return a}function zr(e,t=5){return Ge(e,t,us)}function Fr(e){return Boolean(jr(e,fs))}function Vr(e){let t=9;for(;t>0&&!e[us[t]];t--);return t}function Br(e,t){return[e,t]}function Wr(e){const t=Math.floor(e/xl)*xl;return[t,t+xl]}function Ur(e){const t=na(e);if(void 0===t)throw new RangeError(Di(e));return t}function qr(e,t,n){let r=Qr(ls(e));if(!r||r.j)throw new RangeError(Di(e));return t?r.calendar===ns&&(r=-271821===r.isoYear&&4===r.isoMonth?{...r,isoDay:20,...ks}:{...r,isoDay:1,...ks}):n&&r.calendar===ns&&(r={...r,isoYear:Ys}),pn(r.C?Xr(r):Jr(r))}function _r(e){if(e.calendar!==ns)throw new RangeError(wi(e.calendar))}function Gr(e,t,n=0,r=0){const a=ca(e.timeZone),o=Tl(a);let i;return Ut(e),i=e.C?hr(o,e,t,n,r,!o.$,e.j):fr(o,e),vn(i,a,lo(e.calendar))}function Xr(e){return Kr(Et(Ut(e)))}function Jr(e){return Kr(xt(qt(e)))}function Kr(e){return{...e,calendar:lo(e.calendar)}}function Qr(e){const t=zl.exec(e);return t?(e=>{const t=e[10],n="Z"===(t||"").toUpperCase();return{isoYear:ra(e),isoMonth:parseInt(e[4]),isoDay:parseInt(e[5]),...aa(e.slice(5)),...oa(e[16]),C:Boolean(e[6]),j:n,offset:n?void 0:t}})(t):void 0}function ea(e){const t=Al.exec(e);return t?(e=>({isoYear:ra(e),isoMonth:parseInt(e[4]),isoDay:1,...oa(e[5])}))(t):void 0}function ta(e){const t=Zl.exec(e);return t?(e=>({isoYear:Ys,isoMonth:parseInt(e[1]),isoDay:parseInt(e[2]),...oa(e[3])}))(t):void 0}function na(e,t){const n=Vl.exec(e);return n?((e,t)=>{const n=e[4]||e[5];if(t&&n)throw new RangeError(wi(n));return(e=>{if(Math.abs(e)>=ji)throw new RangeError(di);return e})((da(e[2])*$i+da(e[3])*Pi+da(e[4])*Ri+ia(e[5]||""))*la(e[1]))})(n,t):void 0}function ra(e){const t=la(e[1]),n=parseInt(e[2]||e[3]);if(t<0&&!n)throw new RangeError(wi(-0));return t*n}function aa(e){const t=da(e[3]);return{...kt(ia(e[4]||""))[0],isoHour:da(e[1]),isoMinute:da(e[2]),isoSecond:60===t?59:t}}function oa(e){let t,n;const r=[];if(e.replace(Bl,(e,a,o)=>{const i=Boolean(a),[s,l]=o.split("=").reverse();if(l){if("u-ca"===l)r.push(s),t||(t=i);else if(i||/[A-Z]/.test(l))throw new RangeError(wi(e))}else{if(n)throw new RangeError(wi(e));n=s}return""}),r.length>1&&t)throw new RangeError(wi(e));return{timeZone:n,calendar:r[0]||ns}}function ia(e){return parseInt(e.padEnd(9,"0"))}function sa(e){return new RegExp(`^${e}$`,"i")}function la(e){return e&&"+"!==e?-1:1}function da(e){return void 0===e?0:parseInt(e)}function ca(e){const t=ha(e);return"number"==typeof t?or(t):t?(e=>{if(_l.test(e))throw new RangeError(ii(e));if(ql.test(e))throw new RangeError(li);return e.toLowerCase().split("/").map((e,t)=>(e.length<=3||/\d/.test(e))&&!/etc|yap/.test(e)?e.toUpperCase():e.replace(/baja|dumont|[a-z]+/g,(e,n)=>e.length<=2&&!t||"in"===e||"chat"===e?e.toUpperCase():e.length>2||!n?Ye(e).replace(/island|noronha|murdo|rivadavia|urville/,Ye):e)).join("/")})(e):wl}function ua(e){const t=ha(e);return"number"==typeof t?t:t?t.resolvedOptions().timeZone:wl}function ha(e){const t=na(e=e.toUpperCase(),1);return void 0!==t?t:e!==wl?Ul(e):void 0}function ga(e,t){return mt(e.epochNanoseconds,t.epochNanoseconds)}function fa(e,t){return mt(e.epochNanoseconds,t.epochNanoseconds)}function ma(e,t){return va(e,t)||ya(e,t)}function va(e,t){return Ze(Tt(e),Tt(t))}function ya(e,t){return Ze(Ct(e),Ct(t))}function pa(e,t){if(e===t)return 1;try{return ua(e)===ua(t)}catch(e){}}function ba(e,t,n,r){const a=Qt(e,r,3,5),o=Sa(t.epochNanoseconds,n.epochNanoseconds,...a);return xn(e?$r(o):o)}function Da(e,t,n,r,a,o){const i=$a(r.calendar,a.calendar),[s,l,d,c]=Qt(n,o,5),u=r.epochNanoseconds,h=a.epochNanoseconds,g=mt(h,u);let f;if(g)if(s<6)f=Sa(u,h,s,l,d,c);else{const n=t(((e,t)=>{if(!pa(e,t))throw new RangeError(si);return e})(r.timeZone,a.timeZone)),u=e(i);f=Ta(u,n,r,a,g,s,o),f=jn(f,h,s,l,d,c,u,r,Mn,je(wr,n))}else f=ys;return xn(n?$r(f):f)}function wa(e,t,n,r,a){const o=$a(n.calendar,r.calendar),[i,s,l,d]=Qt(t,a,6),c=It(n),u=It(r),h=mt(u,c);let g;if(h)if(i<=6)g=Sa(c,u,i,s,l,d);else{const t=e(o);g=Ia(t,n,r,h,i,a),g=jn(g,u,i,s,l,d,t,n,It,xr)}else g=ys;return xn(t?$r(g):g)}function xa(e,t,n,r,a){const o=$a(n.calendar,r.calendar);return Ma(t,()=>e(o),n,r,...Qt(t,a,6,9,6))}function Ea(e,t,n,r,a){const o=$a(n.calendar,r.calendar),i=Qt(t,a,9,9,8),s=e(o),l=Mr(s,n),d=Mr(s,r);return l.isoYear===d.isoYear&&l.isoMonth===d.isoMonth&&l.isoDay===d.isoDay?xn(ys):Ma(t,()=>s,xt(l),xt(d),...i,8)}function Ma(e,t,n,r,a,o,i,s,l=6){const d=It(n),c=It(r);if(void 0===d||void 0===c)throw new RangeError(gi);let u;if(mt(c,d))if(6===a)u=Sa(d,c,a,o,i,s);else{const e=t();u=e.N(n,r,a),o===l&&1===i||(u=jn(u,c,a,o,i,s,e,n,It,Er))}else u=ys;return xn(e?$r(u):u)}function Ca(e,t,n,r){const[a,o,i,s]=Qt(e,r,5,5),l=An(Pa(t,n),On(o,i),s),d={...ys,...zr(l,a)};return xn(e?$r(d):d)}function ka(e,t,n,r,a,o){const i=mt(r.epochNanoseconds,n.epochNanoseconds);return i?a<6?Ha(n.epochNanoseconds,r.epochNanoseconds,a):Ta(t,e,n,r,i,a,o):ys}function Na(e,t,n,r,a){const o=It(t),i=It(n),s=mt(i,o);return s?r<=6?Ha(o,i,r):Ia(e,t,n,s,r,a):ys}function Ta(e,t,n,r,a,o,i){const[s,l,d]=((e,t,n,r)=>{function a(){return u={...kr(s,d++*-r),...i},h=gr(e,u),mt(l,h)===-r}const o=kl(t,e),i=Oe(Ds,o),s=kl(n,e),l=n.epochNanoseconds;let d=0;const c=Pa(o,s);let u,h;if(Math.sign(c)===-r&&d++,a()&&(-1===r||a()))throw new RangeError(ri);const g=bt(ft(h,l));return[o,u,g]})(t,n,r,a);var c,u;return{...6===o?(c=s,u=l,{...ys,days:Oa(c,u)}):e.N(s,l,o,i),...zr(d)}}function Ia(e,t,n,r,a,o){const[i,s,l]=((e,t,n)=>{let r=t,a=Pa(e,t);return Math.sign(a)===-n&&(r=kr(t,-n),a+=ji*n),[e,r,a]})(t,n,r);return{...e.N(i,s,a,o),...zr(l)}}function Sa(e,t,n,r,a,o){return{...ys,...Zr(Yn(ft(e,t),r,a,o),n)}}function Ha(e,t,n){return{...ys,...Zr(ft(e,t),n)}}function Oa(e,t){return Ra(Tt(e),Tt(t))}function Ra(e,t){return Math.trunc((t-e)/Ii)}function Pa(e,t){return Ct(t)-Ct(e)}function $a(e,t){if(e!==t)throw new RangeError(oi);return e}function ja(e){return this.m(e)[0]}function Ya(e){return this.m(e)[1]}function La(e){const[t]=this.v(e);return Ra(this.p(t),Tt(e))+1}function Aa(e){const t=Gl.exec(e);if(!t)throw new RangeError(Qo(e));return[parseInt(t[1]),Boolean(t[2])]}function Za(e,t){return"M"+ki(e)+(t?"L":"")}function za(e,t,n){return e+(t||n&&e>=n?1:0)}function Fa(e,t){return e-(t&&e>=t?1:0)}function Va(e,t){return(t+e)*(Math.sign(t)||1)||0}function Ba(e){return os[Ua(e)]}function Wa(e){return ss[Ua(e)]}function Ua(e){return co(e.id||ns)}function qa(e){function t(e){return((e,t)=>({...Xa(e,t),o:e.month,day:parseInt(e.day)}))(jt(n,e),r)}const n=Jl(e),r=co(e);return{id:e,h:_a(t),l:Ga(t)}}function _a(e){return Ee(t=>{const n=Tt(t);return e(n)},WeakMap)}function Ga(e){const t=e(0).year-js;return Ee(n=>{let r,a=Ot(n-t),o=0;const i=[],s=[];do{a+=400*Ii}while((r=e(a)).year<=n);do{if(a+=(1-r.day)*Ii,r.year===n&&(i.push(a),s.push(r.o)),a-=Ii,++o>100||a<-Is)throw new RangeError(ri)}while((r=e(a)).year>=n);return{i:i.reverse(),u:Mi(s.reverse())}})}function Xa(e,t){let n,r,a=Ja(e);if(e.era){const o=os[t],i=is[t]||{};void 0!==o&&(n="islamic"===t?"ah":e.era.normalize("NFD").toLowerCase().replace(/[^a-z0-9]/g,""),"bc"===n||"b"===n?n="bce":"ad"===n||"a"===n?n="ce":"beforeroc"===n&&(n="broc"),n=i[n]||n,r=a,a=Va(r,o[n]||0))}return{era:n,eraYear:r,year:a}}function Ja(e){return parseInt(e.relatedYear||e.year)}function Ka(e){const{year:t,o:n,day:r}=this.h(e),{u:a}=this.l(t);return[t,a[n]+1,r]}function Qa(e,t=1,n=1){return this.l(e).i[t-1]+(n-1)*Ii}function eo(e,t){const n=to.call(this,e);return[Fa(t,n),n===t]}function to(e){const t=io(this,e),n=io(this,e-1),r=t.length;if(r>n.length){const e=Wa(this);if(e<0)return-e;for(let e=0;e<r;e++)if(t[e]!==n[e])return e+1}}function no(e){return Ra(Qa.call(this,e),Qa.call(this,e+1))}function ro(e,t){const{i:n}=this.l(e);let r=t+1,a=n;return r>n.length&&(r=1,a=this.l(e+1).i),Ra(n[t-1],a[r-1])}function ao(e){return this.l(e).i.length}function oo(e){const t=this.h(e);return[t.era,t.eraYear]}function io(e,t){return Object.keys(e.l(t).u)}function so(e){return lo(ls(e))}function lo(e){if((e=e.toLowerCase())!==ns&&e!==rs){const t=Jl(e).resolvedOptions().calendar;if(co(e)!==co(t))throw new RangeError(ai(e));return t}return e}function co(e){return"islamicc"===e&&(e="islamic"),e.split("-")[0]}function uo(e,t){return n=>n===ns?e:n===rs||n===as?Object.assign(Object.create(e),{id:n}):Object.assign(Object.create(t),Xl(n))}function ho(e,t,n,r){const a=go(n,r,Ki,[],Vi);if(void 0!==a.timeZone){const r=n.F(a),o=mo(a),i=e(a.timeZone);return{epochNanoseconds:hr(t(i),{...r,...o},void 0!==a.offset?Ur(a.offset):void 0),timeZone:i}}return{...n.F(a),...ks}}function go(e,t,n,r=[],a=[]){return fo(t,[...e.fields(n),...a].sort(),r)}function fo(e,t,n,r=!n){const a={};let o,i=0;for(const r of t){if(r===o)throw new RangeError(Bo(r));if("constructor"===r||"__proto__"===r)throw new RangeError(Vo(r));let t=e[r];if(void 0!==t)i=1,ld[r]&&(t=ld[r](t,r)),a[r]=t;else if(n){if(n.includes(r))throw new TypeError(Fo(r));a[r]=ts[r]}o=r}if(r&&!i)throw new TypeError(Wo(t));return a}function mo(e,t){return Xt(dd({...ts,...e}),t)}function vo(e,t,n,r,a){t=Oe(n=e.fields(n),t),r=fo(r,a=e.fields(a),[]);let o=e.k(t,r);return o=fo(o,[...n,...a].sort(),[]),e.F(o)}function yo(e,t){const n=Ba(e),r=is[e.id||""]||{};let{era:a,eraYear:o,year:i}=t;if(void 0!==a||void 0!==o){if(void 0===a||void 0===o)throw new TypeError(Go);if(!n)throw new RangeError(_o);const e=n[r[a]||a];if(void 0===e)throw new RangeError(Jo(a));const t=Va(o,e);if(void 0!==i&&i!==t)throw new RangeError(Xo);i=t}else if(void 0===i)throw new TypeError(Ko(n));return i}function po(e,t,n,r){let{month:a,monthCode:o}=t;if(void 0!==o){const t=((e,t,n,r)=>{const a=e.L(n),[o,i]=Aa(t);let s=za(o,i,a);if(i){const t=Wa(e);if(void 0===t)throw new RangeError(ni);if(t>0){if(s>t)throw new RangeError(ni);if(void 0===a){if(1===r)throw new RangeError(ni);s--}}else{if(s!==-t)throw new RangeError(ni);if(void 0===a&&1===r)throw new RangeError(ni)}}return s})(e,o,n,r);if(void 0!==a&&a!==t)throw new RangeError(ei);a=t,r=1}else if(void 0===a)throw new TypeError(ti);return we("month",a,1,e.B(n),r)}function bo(e,t,n,r,a){return De(t,"day",1,e.U(r,n),a)}function Do(e,t,n,r){let a=0;const o=[];for(const e of n)void 0!==t[e]?a=1:o.push(e);if(Object.assign(e,t),a)for(const t of r||o)delete e[t]}function wo(e){const t=id(e.calendar),[n,r,a]=t.v(e),[o,i]=t.q(n,r);return{year:n,monthCode:Za(o,i),day:a}}function xo(e,t){return yn(kl(t,e))}function Eo(e,t){return pn(kl(t,e))}function Mo(e,t){return wn(kl(t,e))}function Co(e,t,n){const r=new Set(n);return(a,o)=>{const i=n&&Re(a,n);if(!Re(a=((e,t)=>{const n={};for(const r in t)e.has(r)||(n[r]=t[r]);return n})(r,a),e)){if(o&&i)throw new TypeError("Invalid formatting options");a={...t,...a}}return n&&(a.timeZone=wl,["full","long"].includes(a.J)&&(a.J="medium")),a}}function ko(e,t=No,n=0){const[r,,,a]=e;return(o,i=Zd,...s)=>{const l=t(a&&a(...s),o,i,r,n),d=l.resolvedOptions();return[l,...To(e,d,s)]}}function No(e,t,n,r,a){if(n=r(n,a),e){if(void 0!==n.timeZone)throw new TypeError(Ei);n.timeZone=e}return new Ps(t,n)}function To(e,t,n){const[,r,a]=e;return n.map(e=>(e.calendar&&((e,t,n)=>{if((n||e!==ns)&&e!==t)throw new RangeError(oi)})(e.calendar,t.calendar,a),r(e,t)))}function Io(e,t){return{...e,calendar:t}}function So(e){const t=Ho();return Pt(t,e.R(t))}function Ho(){return pt(Date.now(),Oi)}function Oo(){return Gd||(Gd=(new Ps).resolvedOptions().timeZone)}const Ro=(e,t)=>`Non-integer ${e}: ${t}`,Po=(e,t)=>`Non-positive ${e}: ${t}`,$o=(e,t)=>`Non-finite ${e}: ${t}`,jo=e=>`Cannot convert bigint to ${e}`,Yo=e=>`Invalid bigint: ${e}`,Lo="Cannot convert Symbol to string",Ao="Invalid object",Zo=(e,t,n,r,a)=>a?Zo(e,a[t],a[n],a[r]):zo(e,t)+`; must be between ${n}-${r}`,zo=(e,t)=>`Invalid ${e}: ${t}`,Fo=e=>`Missing ${e}`,Vo=e=>`Invalid field ${e}`,Bo=e=>`Duplicate field ${e}`,Wo=e=>"No valid fields: "+e.join(),Uo=(e,t,n)=>zo(e,t)+"; must be "+Object.keys(n).join(),qo="Invalid calling context",_o="Forbidden era/eraYear",Go="Mismatching era/eraYear",Xo="Mismatching year/eraYear",Jo=e=>`Invalid era: ${e}`,Ko=e=>"Missing year"+(e?"/era/eraYear":""),Qo=e=>`Invalid monthCode: ${e}`,ei="Mismatching month/monthCode",ti="Missing month/monthCode",ni="Invalid leap month",ri="Invalid protocol results",ai=e=>zo("Calendar",e),oi="Mismatching Calendars",ii=e=>zo("TimeZone",e),si="Mismatching TimeZones",li="Forbidden ICU TimeZone",di="Out-of-bounds offset",ci="Out-of-bounds TimeZone gap",ui="Invalid TimeZone offset",hi="Ambiguous offset",gi="Out-of-bounds date",fi="Out-of-bounds duration",mi="Cannot mix duration signs",vi="Missing relativeTo",yi="Cannot use large units",pi="Required smallestUnit or largestUnit",bi="smallestUnit > largestUnit",Di=e=>`Cannot parse: ${e}`,wi=e=>`Invalid substring: ${e}`,xi="Mismatching types for formatting",Ei="Cannot specify TimeZone",Mi=je(Se,(e,t)=>t),Ci=je(Se,(e,t,n)=>n),ki=je(Ae,2),Ni={nanosecond:0,microsecond:1,millisecond:2,second:3,minute:4,hour:5,day:6,week:7,month:8,year:9},Ti=Object.keys(Ni),Ii=864e5,Si=1e3,Hi=1e3,Oi=1e6,Ri=1e9,Pi=6e10,$i=36e11,ji=864e11,Yi=[1,Hi,Oi,Ri,Pi,$i,ji],Li=Ti.slice(0,6),Ai=Le(Li),Zi=["offset"],zi=["timeZone"],Fi=Li.concat(Zi),Vi=Fi.concat(zi),Bi=["era","eraYear"],Wi=Bi.concat(["year"]),Ui=["year"],qi=["monthCode"],_i=["month"].concat(qi),Gi=["day"],Xi=_i.concat(Ui),Ji=qi.concat(Ui),Ki=Gi.concat(Xi),Qi=Gi.concat(_i),es=Gi.concat(qi),ts=Ci(Li,0),ns="iso8601",rs="gregory",as="japanese",os={[rs]:{"gregory-inverse":-1,gregory:0},[as]:{"japanese-inverse":-1,japanese:0,meiji:1867,taisho:1911,showa:1925,heisei:1988,reiwa:2018},ethiopic:{ethioaa:0,ethiopic:5500},coptic:{"coptic-inverse":-1,coptic:0},roc:{"roc-inverse":-1,roc:0},buddhist:{be:0},islamic:{ah:0},indian:{saka:0},persian:{ap:0}},is={[rs]:{bce:"gregory-inverse",ce:"gregory"},[as]:{bce:"japanese-inverse",ce:"japanese"},ethiopic:{era0:"ethioaa",era1:"ethiopic"},coptic:{era0:"coptic-inverse",era1:"coptic"},roc:{broc:"roc-inverse",minguo:"roc"}},ss={chinese:13,dangi:13,hebrew:-6},ls=je(tt,"string"),ds=je(tt,"boolean"),cs=je(tt,"number"),us=Ti.map(e=>e+"s"),hs=Le(us),gs=us.slice(0,6),fs=us.slice(6),ms=fs.slice(1),vs=Mi(us),ys=Ci(us,0),ps=Ci(gs,0),bs=je($e,us),Ds=["isoNanosecond","isoMicrosecond","isoMillisecond","isoSecond","isoMinute","isoHour"],ws=["isoDay","isoMonth","isoYear"],xs=Ds.concat(ws),Es=Le(ws),Ms=Le(Ds),Cs=Le(xs),ks=Ci(Ms,0),Ns=je($e,xs),Ts=1e8,Is=Ts*Ii,Ss=[Ts,0],Hs=[-Ts,0],Os=275760,Rs=-271821,Ps=Intl.DateTimeFormat,$s="en-GB",js=1970,Ys=1972,Ls=12,As=Ot(1868,9,8),Zs=Ee(Wt,WeakMap),zs="smallestUnit",Fs="unit",Vs="roundingIncrement",Bs="fractionalSecondDigits",Ws="relativeTo",Us="direction",qs={constrain:0,reject:1},_s=Object.keys(qs),Gs={compatible:0,reject:1,earlier:2,later:3},Xs={reject:0,use:1,prefer:2,ignore:3},Js={auto:0,never:1,critical:2,always:3},Ks={auto:0,never:1,critical:2},Qs={auto:0,never:1},el={floor:0,halfFloor:1,ceil:2,halfCeil:3,trunc:4,halfTrunc:5,expand:6,halfExpand:7,halfEven:8},tl={previous:-1,next:1},nl=je(hn,zs),rl=je(hn,"largestUnit"),al=je(hn,Fs),ol=je(gn,"overflow",qs),il=je(gn,"disambiguation",Gs),sl=je(gn,"offset",Xs),ll=je(gn,"calendarName",Js),dl=je(gn,"timeZoneName",Ks),cl=je(gn,"offset",Qs),ul=je(gn,"roundingMode",el),hl="PlainYearMonth",gl="PlainMonthDay",fl="PlainDate",ml="PlainDateTime",vl="PlainTime",yl="ZonedDateTime",pl="Instant",bl="Duration",Dl=[Math.floor,e=>qe(e)?Math.floor(e):Math.round(e),Math.ceil,e=>qe(e)?Math.ceil(e):Math.round(e),Math.trunc,e=>qe(e)?Math.trunc(e)||0:Math.round(e),e=>e<0?Math.floor(e):Math.ceil(e),e=>Math.sign(e)*Math.round(Math.abs(e))||0,e=>qe(e)?(e=Math.trunc(e)||0)+e%2:Math.round(e)],wl="UTC",xl=5184e3,El=Ht(1847),Ml=Ht((new Date).getUTCFullYear()+10),Cl=/0+$/,kl=Ee(ur,WeakMap),Nl=2**32-1,Tl=Ee(e=>{const t=ha(e);return"object"==typeof t?new Sl(t):new Il(t||0)});class Il{constructor(e){this.$=e}R(){return this.$}I(e){return(e=>{const t=It({...e,...ks});if(!t||Math.abs(t[0])>1e8)throw new RangeError(gi)})(e),[St(e,this.$)]}O(){}}class Sl{constructor(e){this.nn=(e=>{function t(e){const t=ze(e,o,i),[s,l]=Wr(t),d=r(s),c=r(l);return d===c?d:n(a(s,l),d,c,e)}function n(t,n,r,a){let o,i;for(;(void 0===a||void 0===(o=a<t[0]?n:a>=t[1]?r:void 0))&&(i=t[1]-t[0]);){const n=t[0]+Math.floor(i/2);e(n)===r?t[1]=n:t[0]=n+1}return o}const r=Ee(e),a=Ee(Br);let o=El,i=Ml;return{tn(e){const n=t(e-86400),r=t(e+86400),a=e-n,o=e-r;if(n===r)return[a];const i=t(a);return i===t(o)?[e-i]:n>r?[a,o]:[]},rn:t,O(e,t){const s=ze(e,o,i);let[l,d]=Wr(s);const c=xl*t,u=t<0?()=>d>o||(o=s,0):()=>l<i||(i=s,0);for(;u();){const o=r(l),i=r(d);if(o!==i){const r=a(l,d);n(r,o,i);const s=r[0];if((Ze(s,e)||1)===t)return s}l+=c,d+=c}}}})((e=>t=>{const n=jt(e,t*Si);return Ht(Ja(n),parseInt(n.month),parseInt(n.day),parseInt(n.hour),parseInt(n.minute),parseInt(n.second))-t})(e))}R(e){return this.nn.rn((e=>Nt(e)[0])(e))*Ri}I(e){const[t,n]=[Ht((r=e).isoYear,r.isoMonth,r.isoDay,r.isoHour,r.isoMinute,r.isoSecond),r.isoMillisecond*Oi+r.isoMicrosecond*Hi+r.isoNanosecond];var r;return this.nn.tn(t).map(e=>Mt(gt(pt(e,Ri),n)))}O(e,t){const[n,r]=Nt(e),a=this.nn.O(n+(t>0||r?1:0),t);if(void 0!==a)return pt(a,Ri)}}const Hl="([+-])",Ol="(?:[.,](\\d{1,9}))?",Rl=`(?:(?:${Hl}(\\d{6}))|(\\d{4}))-?(\\d{2})`,Pl="(\\d{2})(?::?(\\d{2})(?::?(\\d{2})"+Ol+")?)?",$l=Hl+Pl,jl=Rl+"-?(\\d{2})(?:[T ]"+Pl+"(Z|"+$l+")?)?",Yl="\\[(!?)([^\\]]*)\\]",Ll=`((?:${Yl}){0,9})`,Al=sa(Rl+Ll),Zl=sa("(?:--)?(\\d{2})-?(\\d{2})"+Ll),zl=sa(jl+Ll),Fl=sa("T?"+Pl+"(?:"+$l+")?"+Ll),Vl=sa($l),Bl=new RegExp(Yl,"g"),Wl=sa(`${Hl}?P(\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?(?:T(?:(\\d+)${Ol}H)?(?:(\\d+)${Ol}M)?(?:(\\d+)${Ol}S)?)?`),Ul=Ee(e=>new Ps($s,{timeZone:e,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),ql=/^(AC|AE|AG|AR|AS|BE|BS|CA|CN|CS|CT|EA|EC|IE|IS|JS|MI|NE|NS|PL|PN|PR|PS|SS|VS)T$/,_l=/[^\w\/:+-]+/,Gl=/^M(\d{2})(L?)$/,Xl=Ee(qa),Jl=Ee(e=>new Ps($s,{calendar:e,timeZone:wl,era:"short",year:"numeric",month:"short",day:"numeric"})),Kl={P(e,t,n){const r=Jt(n);let a,{years:o,months:i,weeks:s,days:l}=t;if(l+=Ar(t,5)[0],o||i)a=((e,t,n,r,a)=>{let[o,i,s]=e.v(t);if(n){const[t,r]=e.q(o,i);o+=n,i=za(t,r,e.L(o)),i=we("month",i,1,e.B(o),a)}return r&&([o,i]=e.un(o,i,r)),s=we("day",s,1,e.U(o,i),a),e.p(o,i,s)})(this,e,o,i,r);else{if(!s&&!l)return e;a=Tt(e)}if(void 0===a)throw new RangeError(gi);return a+=(7*s+l)*Ii,xt($t(a))},N(e,t,n){if(n<=7){let r=0,a=Oa({...e,...ks},{...t,...ks});return 7===n&&([r,a]=Be(a,7)),{...ys,weeks:r,days:a}}const r=this.v(e),a=this.v(t);let[o,i,s]=((e,t,n,r,a,o,i)=>{let s=a-t,l=o-n,d=i-r;if(s||l){const c=Math.sign(s||l);let u=e.U(a,o),h=0;if(Math.sign(d)===-c){const r=u;[a,o]=e.un(a,o,-c),s=a-t,l=o-n,u=e.U(a,o),h=c<0?-r:u}if(d=i-Math.min(r,u)+h,s){const[r,i]=e.q(t,n),[d,u]=e.q(a,o);if(l=d-r||Number(u)-Number(i),Math.sign(l)===-c){const n=c<0&&-e.B(a);s=(a-=c)-t,l=o-za(r,i,e.L(a))+(n||e.B(a))}}}return[s,l,d]})(this,...r,...a);return 8===n&&(i+=this.cn(o,r[0]),o=0),{...ys,years:o,months:i,days:s}},F(e,t){const n=Jt(t),r=yo(this,e),a=po(this,e,r,n),o=bo(this,e,a,r,n);return pn(xt(this.V(r,a,o)),this.id||ns)},K(e,t){const n=Jt(t),r=yo(this,e),a=po(this,e,r,n);return bn(wt(this.V(r,a,1)),this.id||ns)},_(e,t){const n=Jt(t);let r,a,o,i=void 0!==e.eraYear||void 0!==e.year?yo(this,e):void 0;const s=!this.id;if(void 0===i&&s&&(i=Ys),void 0!==i){const t=po(this,e,i,n);r=bo(this,e,t,i,n);const s=this.L(i);a=Fa(t,s),o=t===s}else{if(void 0===e.monthCode)throw new TypeError(ti);if([a,o]=Aa(e.monthCode),this.id&&this.id!==rs&&this.id!==as)if(this.id&&"coptic"===co(this.id)&&0===n){const t=o||13!==a?30:6;r=e.day,r=ze(r,1,t)}else if(this.id&&"chinese"===co(this.id)&&0===n){const t=!o||1!==a&&9!==a&&10!==a&&11!==a&&12!==a?30:29;r=e.day,r=ze(r,1,t)}else r=e.day;else r=bo(this,e,po(this,e,Ys,n),Ys,n)}const l=this.G(a,o,r);if(!l)throw new RangeError("Cannot guess year");const[d,c]=l;return Dn(xt(this.V(d,c,r)),this.id||ns)},fields(e){return Ba(this)&&e.includes("year")?[...e,...Bi]:e},k(e,t){const n=Object.assign(Object.create(null),e);return Do(n,t,_i),Ba(this)&&(Do(n,t,Wi),this.id===as&&Do(n,t,Qi,Bi)),n},inLeapYear(e){const[t]=this.v(e);return this.sn(t)},monthsInYear(e){const[t]=this.v(e);return this.B(t)},daysInMonth(e){const[t,n]=this.v(e);return this.U(t,n)},daysInYear(e){const[t]=this.v(e);return this.fn(t)},dayOfYear:La,era(e){return this.hn(e)[0]},eraYear(e){return this.hn(e)[1]},monthCode(e){const[t,n]=this.v(e),[r,a]=this.q(t,n);return Za(r,a)},dayOfWeek:Vt,daysInWeek:()=>7},Ql={v:Yt,hn:Bt,q:Lt},ed={dayOfYear:La,v:Yt,p:Ot},td=Object.assign({},ed,{weekOfYear:ja,yearOfWeek:Ya,m(e){function t(e){return(7-e<r?7:0)-e}function n(e){const n=zt(h+e),r=e||1,a=t(Ve(l+n*r,7));return c=(n+(a-d)*r)/7}const r=this.id?1:4,a=Vt(e),o=this.dayOfYear(e),i=Ve(a-1,7),s=o-1,l=Ve(i-s,7),d=t(l);let c,u=Math.floor((s-d)/7)+1,h=e.isoYear;return u?u>n(0)&&(u=1,h++):(u=n(-1),h--),[u,h,c]}}),nd=Object.assign({},Kl,td,{v:Yt,hn:Bt,q:Lt,G(e,t){if(!t)return[Ys,e]},sn:Ft,L(){},B:At,cn:e=>e*Ls,U:Zt,fn:zt,V:(e,t,n)=>({isoYear:e,isoMonth:t,isoDay:n}),p:Ot,un:(e,t,n)=>(e+=We(n,Ls),(t+=Ue(n,Ls))<1?(e--,t+=Ls):t>Ls&&(e++,t-=Ls),[e,t]),year:e=>e.isoYear,month:e=>e.isoMonth,day:e=>e.isoDay}),rd={v:Ka,hn:oo,q:eo},ad={dayOfYear:La,v:Ka,p:Qa,weekOfYear:ja,yearOfWeek:Ya,m:()=>[]},od=Object.assign({},Kl,ad,{v:Ka,hn:oo,q:eo,G(e,t,n){const r=this.id&&"chinese"===co(this.id)?((e,t,n)=>{if(t)switch(e){case 1:return 1651;case 2:return n<30?1947:1765;case 3:return n<30?1966:1955;case 4:return n<30?1963:1944;case 5:return n<30?1971:1952;case 6:return n<30?1960:1941;case 7:return n<30?1968:1938;case 8:return n<30?1957:1718;case 9:return 1832;case 10:return 1870;case 11:return 1814;case 12:return 1890}return 1972})(e,t,n):Ys;let[a,o,i]=Ka.call(this,{isoYear:r,isoMonth:Ls,isoDay:31});const s=to.call(this,a),l=o===s;1===(Ze(e,Fa(o,s))||Ze(Number(t),Number(l))||Ze(n,i))&&a--;for(let r=0;r<100;r++){const o=a-r,i=to.call(this,o),s=za(e,t,i);if(t===(s===i)&&n<=ro.call(this,o,s))return[o,s]}},sn(e){const t=no.call(this,e);return t>no.call(this,e-1)&&t>no.call(this,e+1)},L:to,B:ao,cn(e,t){const n=t+e,r=Math.sign(e),a=r<0?-1:0;let o=0;for(let e=t;e!==n;e+=r)o+=ao.call(this,e+a);return o},U:ro,fn:no,V(e,t,n){return $t(Qa.call(this,e,t,n))},p:Qa,un(e,t,n){if(n){if(t+=n,!Number.isSafeInteger(t))throw new RangeError(gi);if(n<0)for(;t<1;)t+=ao.call(this,--e);else{let n;for(;t>(n=ao.call(this,e));)t-=n,e++}}return[e,t]},year(e){return this.h(e).year},month(e){const{year:t,o:n}=this.h(e),{u:r}=this.l(t);return r[n]+1},day(e){return this.h(e).day}}),id=uo(Ql,rd),sd=uo(nd,od),ld={...{era:ot,eraYear:lt,year:lt,month:ct,monthCode(e){const t=ot(e);return Aa(t),t},day:ct},...Ci(Li,lt),...Ci(us,dt),offset(e){const t=ot(e);return Ur(t),t}},dd=je(He,Li,Ds),cd=je(He,Ds,Li),ud="numeric",hd=["timeZoneName"],gd={month:ud,day:ud},fd={year:ud,month:ud},md=Object.assign({},fd,{day:ud}),vd={hour:ud,minute:ud,second:ud},yd=Object.assign({},md,vd),pd=Object.assign({},yd,{timeZoneName:"short"}),bd=Object.keys(fd),Dd=Object.keys(gd),wd=Object.keys(md),xd=Object.keys(vd),Ed=["dateStyle"],Md=bd.concat(Ed),Cd=Dd.concat(Ed),kd=wd.concat(Ed,["weekday"]),Nd=xd.concat(["dayPeriod","timeStyle","fractionalSecondDigits"]),Td=kd.concat(Nd),Id=hd.concat(Nd),Sd=hd.concat(kd),Hd=hd.concat(["day","weekday"],Nd),Od=hd.concat(["year","weekday"],Nd),Rd=Co(Td,yd),Pd=Co(Td,pd),$d=Co(Td,yd,hd),jd=Co(kd,md,Id),Yd=Co(Nd,vd,Sd),Ld=Co(Md,fd,Hd),Ad=Co(Cd,gd,Od),Zd={},zd=new Ps(void 0,{calendar:ns}).resolvedOptions().calendar===ns,Fd=[Rd,En],Vd=[Pd,En,0,(e,t)=>{const n=e.timeZone;if(t&&t.timeZone!==n)throw new RangeError(si);return n}],Bd=[$d,Tt],Wd=[jd,Tt],Ud=[Yd,e=>Ct(e)/Oi],qd=[Ld,Tt,zd],_d=[Ad,Tt,zd];let Gd;function Xd(e,t,n,r,a){function o(...e){if(!(this instanceof o))throw new TypeError(qo);xc(this,t(...e))}function i(e,t){return Object.defineProperties(function(...t){return e.call(this,s(this),...t)},Me(t))}function s(t){const n=wc(t);if(!n||n.branding!==e)throw new TypeError(qo);return n}return Object.defineProperties(o.prototype,{...ke(Ie(i,n)),...Ce(Ie(i,r)),...Ne("Temporal."+e)}),Object.defineProperties(o,{...Ce(a),...Me(e)}),[o,e=>{const t=Object.create(o.prototype);return xc(t,e),t},s]}function Jd(e){if(wc(e)||void 0!==e.calendar||void 0!==e.timeZone)throw new TypeError("Invalid bag");return e}function Kd(e){return Qd(e)||ns}function Qd(e){const{calendar:t}=e;if(void 0!==t)return ec(t)}function ec(e){if(xe(e)){const{calendar:t}=wc(e)||{};if(!t)throw new TypeError(ai(e));return t}return(e=>lo(function(e){const t=Qr(e)||ea(e)||ta(e);return t?t.calendar:e}(ls(e))))(e)}function tc(e){const t={};for(const n in e)t[n]=e=>{const{calendar:t}=e;return sd(t)[n](e)};return t}function nc(){throw new TypeError("Cannot use valueOf")}function rc(e){if(xe(e)){const{timeZone:t}=wc(e)||{};if(!t)throw new TypeError(ii(e));return t}return(e=>ca(function(e){const t=Qr(e);return t&&(t.timeZone||t.j&&wl||t.offset)||e}(ls(e))))(e)}function ac(e){if(xe(e)){const t=wc(e);return t&&t.branding===bl?t:function(e){const t=fo(e,hs);return xn(Yr({...ys,...t}))}(e)}return function(e){const t=(e=>{const t=Wl.exec(e);return t?(e=>{function t(e,t,o){let i=0,s=0;if(o&&([i,a]=Fe(a,Yi[o])),void 0!==e){if(r)throw new RangeError(wi(e));s=(e=>{const t=parseInt(e);if(!Number.isFinite(t))throw new RangeError(wi(e));return t})(e),n=1,t&&(a=ia(t)*(Yi[o]/Ri),r=1)}return i+s}let n=0,r=0,a=0,o={...Te(us,[t(e[2]),t(e[3]),t(e[4]),t(e[5]),t(e[6],e[7],5),t(e[8],e[9],4),t(e[10],e[11],3)]),...Ge(a,2,us)};if(!n)throw new RangeError(Wo(us));return la(e[1])<0&&(o=$r(o)),o})(t):void 0})(ls(e));if(!t)throw new RangeError(Di(e));return xn(Yr(t))}(e)}function oc(e){if(void 0!==e){if(xe(e)){const t=wc(e)||{};switch(t.branding){case yl:case fl:return t;case ml:return pn(t)}const n=Kd(e);return{...ho(rc,Tl,sd(n),e),calendar:n}}return function(e){const t=Qr(ls(e));if(!t)throw new RangeError(Di(e));if(t.timeZone)return Gr(t,t.offset?Ur(t.offset):void 0);if(t.j)throw new RangeError(Di(e));return Jr(t)}(e)}}function ic(e,t){if(xe(e)){const n=wc(e)||{};switch(n.branding){case vl:return Jt(t),n;case ml:return Jt(t),wn(n);case yl:return Jt(t),Mo(Tl,n)}return function(e,t){return wn(mo(fo(e,Ai,[],1),Jt(t)))}(e,t)}const n=function(e){let t,n=(e=>{const t=Fl.exec(e);return t?(oa(t[10]),aa(t)):void 0})(ls(e));if(!n){if(n=Qr(e),!n)throw new RangeError(Di(e));if(!n.C)throw new RangeError(Di(e));if(n.j)throw new RangeError(wi("Z"));_r(n)}if((t=ea(e))&&_t(t))throw new RangeError(Di(e));if((t=ta(e))&&_t(t))throw new RangeError(Di(e));return wn(Xt(n,1))}(e);return Jt(t),n}function sc(e){return void 0===e?void 0:ic(e)}function lc(e,t){if(xe(e)){const n=wc(e)||{};switch(n.branding){case ml:return Jt(t),n;case fl:return Jt(t),yn({...n,...ks});case yl:return Jt(t),xo(Tl,n)}return function(e,t,n){const r=go(e,t,Ki,[],Li),a=Jt(n);return yn(Et({...e.F(r,un(a)),...mo(r,a)}))}(sd(Kd(e)),e,t)}const n=function(e){const t=Qr(ls(e));if(!t||t.j)throw new RangeError(Di(e));return yn(Xr(t))}(e);return Jt(t),n}function dc(e,t){if(xe(e)){const n=wc(e);if(n&&n.branding===gl)return Jt(t),n;const r=Qd(e);return function(e,t,n,r){const a=go(e,n,Ki,Gi);return t&&void 0!==a.month&&void 0===a.monthCode&&void 0===a.year&&(a.year=Ys),e._(a,r)}(sd(r||ns),!r,e,t)}const n=function(e,t){const n=ta(ls(t));if(n)return _r(n),Dn(qt(n));const r=qr(t,0,1),{calendar:a}=r,o=e(a),[i,s,l]=o.v(r),[d,c]=o.q(i,s),[u,h]=o.G(d,c,l);return Dn(xt(o.V(u,h,l)),a)}(sd,e);return Jt(t),n}function cc(e,t){if(xe(e)){const n=wc(e);return n&&n.branding===hl?(Jt(t),n):function(e,t,n,r){const a=go(e,t,Xi,r);return e.K(a,n)}(sd(Kd(e)),e,t)}const n=function(e,t){const n=ea(ls(t));if(n)return _r(n),bn(wt(qt(n)));const r=qr(t,1);return bn(Mr(e(r.calendar),r))}(sd,e);return Jt(t),n}function uc(e,t){if(xe(e)){const n=wc(e)||{};switch(n.branding){case fl:return Jt(t),n;case ml:return Jt(t),pn(n);case yl:return Jt(t),Eo(Tl,n)}return function(e,t,n,r=[]){const a=go(e,t,Ki,r);return e.F(a,n)}(sd(Kd(e)),e,t)}const n=qr(e);return Jt(t),n}function hc(e,t){if(xe(e)){const n=wc(e);if(n&&n.branding===yl)return Kt(t),n;const r=Kd(e);return function(e,t,n,r,a,o){const i=go(n,a,Ki,zi,Vi),s=e(i.timeZone),[l,d,c]=Kt(o),u=n.F(i,un(l)),h=mo(i,l);return vn(hr(t(s),{...u,...h},void 0!==i.offset?Ur(i.offset):void 0,d,c),s,r)}(rc,Tl,sd(r),r,e,t)}return function(e,t){const n=Qr(ls(e));if(!n||!n.timeZone)throw new RangeError(Di(e));const{offset:r}=n,a=r?Ur(r):void 0,[,o,i]=Kt(t);return Gr(n,a,o,i)}(e,t)}function gc(e){return Ie(e=>t=>e(fc(t)),e)}function fc(e){return kl(e,Tl)}function mc(e){if(xe(e)){const t=wc(e);if(t)switch(t.branding){case pl:return t;case yl:return mn(t.epochNanoseconds)}}return function(e){const t=Qr(e=ot(e));if(!t)throw new RangeError(Di(e));let n;if(t.j)n=0;else{if(!t.offset)throw new RangeError(Di(e));n=Ur(t.offset)}return t.timeZone&&na(t.timeZone,1),mn(St(Ut(t),n))}(e)}function vc(){function e(e,n){return new t(e,n)}function t(e,t=Object.create(null)){su.set(this,((e,t)=>{const n=new Ps(e,t),r=n.resolvedOptions(),a=r.locale,o=Oe(Object.keys(t),r),i=Ee(bc),s=(e,...t)=>{if(e){if(2!==t.length)throw new TypeError(xi);for(const e of t)if(void 0===e)throw new TypeError(xi)}e||void 0!==t[0]||(t=[]);const r=t.map(e=>wc(e)||Number(e));let s,l=0;for(const e of r){const t="object"==typeof e?e.branding:void 0;if(l++&&t!==s)throw new TypeError(xi);s=t}return s?i(s)(a,o,...r):[n,...r]};return s.X=n,s})(e,t))}const n=Ps.prototype,r=Object.getOwnPropertyDescriptors(n),a=Object.getOwnPropertyDescriptors(Ps);for(const t in r){const n=r[t],a=t.startsWith("format")&&yc(t);"function"==typeof n.value?n.value="constructor"===t?e:a||pc(t):a&&(n.get=function(){if(!su.has(this))throw new TypeError(qo);return(...e)=>a.apply(this,e)},Object.defineProperties(n.get,Me(`get ${t}`)))}return a.prototype.value=t.prototype=Object.create({},r),Object.defineProperties(e,a),e}function yc(e){return Object.defineProperties(function(...t){const n=su.get(this),[r,...a]=n(e.includes("Range"),...t);return r[e](...a)},Me(e))}function pc(e){return Object.defineProperties(function(...t){return su.get(this).X[e](...t)},Me(e))}function bc(e){const t=jc[e];if(!t)throw new TypeError((e=>`Cannot format ${e}`)(e));return ko(t,Ee(No),1)}const Dc=new WeakMap,wc=Dc.get.bind(Dc),xc=Dc.set.bind(Dc),Ec={era:function(e){if(void 0!==e)return ls(e)},eraYear:Xe,year:Ke,month:Je,daysInMonth:Je,daysInYear:Je,inLeapYear:ds,monthsInYear:Je},Mc={monthCode:ls},Cc={day:Je},kc={dayOfWeek:Je,dayOfYear:Je,weekOfYear:function(e){if(void 0!==e)return Je(e)},yearOfWeek:Xe,daysInWeek:Je},Nc=tc(Object.assign({},Ec,Mc,Cc,kc)),Tc=tc({...Ec,...Mc}),Ic=tc({...Mc,...Cc}),Sc={calendarId:e=>e.calendar},Hc=Se(e=>t=>t[e],us.concat("sign")),Oc=Se((e,t)=>e=>e[Ds[t]],Li),Rc={epochMilliseconds:En,epochNanoseconds:function(e){return((e,t=1)=>{const[n,r]=e,a=Math.floor(r/t),o=ji/t;return BigInt(n)*BigInt(o)+BigInt(a)})(e.epochNanoseconds)}},[Pc,$c]=Xd(bl,function(e=0,t=0,n=0,r=0,a=0,o=0,i=0,s=0,l=0,d=0){return xn(Yr(Ie(dt,Te(us,[e,t,n,r,a,o,i,s,l,d]))))},{...Hc,blank:function(e){return!e.sign}},{with:(e,t)=>$c(function(e,t){return xn((n=e,r=t,Yr({...n,...fo(r,hs)})));var n,r}(e,t)),negated:e=>$c(Pr(e)),abs:e=>$c(function(e){return-1===e.sign?Pr(e):e}(e)),add:(e,t,n)=>$c(Rr(oc,sd,Tl,0,e,ac(t),n)),subtract:(e,t,n)=>$c(Rr(oc,sd,Tl,1,e,ac(t),n)),round:(e,t)=>$c(function(e,t,n,r,a){const o=Vr(r),[i,s,l,d,c]=((e,t,n)=>{e=cn(e,zs);let r=rl(e);const a=n(e[Ws]);let o=on(e);const i=ul(e,7);let s=nl(e);if(void 0===r&&void 0===s)throw new RangeError(pi);if(null==s&&(s=0),null==r&&(r=Math.max(s,t)),fn(r,s),o=sn(o,s,1),o>1&&s>5&&r!==s)throw new RangeError("For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit");return[r,s,o,i,a]})(a,o,e),u=Math.max(o,i);if(!c&&u<=6)return xn(Yr(((e,t,n,r,a)=>{const o=Yn(Ar(e),n,r,a);return{...ys,...Zr(o,t)}})(r,i,s,l,d)));if(!Hr(c)&&!r.sign)return r;if(!c)throw new RangeError(vi);const[h,g,f]=Nr(t,n,c),m=Tr(f),v=Ir(f),y=Sr(f),p=v(g,h,r);Hr(c)||(Et(h),Et(p));let b=y(g,h,p,i);const D=r.sign,w=jr(b);if(D&&w&&D!==w)throw new RangeError(ri);return b=jn(b,m(p),i,s,l,d,g,h,m,v),xn(b)}(oc,sd,Tl,e,t)),total:(e,t)=>function(e,t,n,r,a){const o=Vr(r),[i,s]=((e,t)=>{const n=t((e=cn(e,Fs))[Ws]);let r=al(e);return r=Qe(Fs,r),[r,n]})(a,e),l=Math.max(i,o);if(!s&&Or(l,s))return Cn(r,i);if(!s)throw new RangeError(vi);if(!r.sign)return 0;const[d,c,u]=Nr(t,n,s),h=Tr(u),g=Ir(u),f=Sr(u),m=g(c,d,r);Hr(s)||(Et(d),Et(m));const v=f(c,d,m,i);return Or(i,s)?Cn(v,i):((e,t,n,r,a,o,i)=>{const s=jr(e),[l,d]=kn(r,bs(n,e),n,s,a,o,i),c=Nn(t,l,d);return e[us[n]]+c*s})(v,h(m),i,c,d,h,g)}(oc,sd,Tl,e,t),toLocaleString(e,t,n){return Intl.DurationFormat?new Intl.DurationFormat(t,n).format(this):Jn(e)},toString:Jn,toJSON:e=>Jn(e),valueOf:nc},{from:e=>$c(ac(e)),compare:(e,t,n)=>function(e,t,n,r,a,o){const i=e(dn(o).relativeTo),s=Math.max(Vr(r),Vr(a));if(Pe(us,r,a))return 0;if(Or(s,i))return mt(Ar(r),Ar(a));if(!i)throw new RangeError(vi);const[l,d,c]=Nr(t,n,i),u=Tr(c),h=Ir(c);return mt(u(h(d,l,r)),u(h(d,l,a)))}(oc,sd,Tl,ac(e),ac(t),n)}),jc={Instant:Fd,PlainDateTime:Bd,PlainDate:Wd,PlainTime:Ud,PlainYearMonth:qd,PlainMonthDay:_d},Yc=ko(Fd),Lc=ko(Vd),Ac=ko(Bd),Zc=ko(Wd),zc=ko(Ud),Fc=ko(qd),Vc=ko(_d),[Bc,Wc]=Xd(vl,function(e=0,t=0,n=0,r=0,a=0,o=0){return wn(Xt(Ie(lt,Te(Ds,[e,t,n,r,a,o])),1))},Oc,{with(e,t,n){return Wc(function(e,t,n){return wn(((e,t,n)=>mo({...Oe(Ai,e),...fo(t,Ai)},Jt(n)))(e,t,n))}(this,Jd(t),n))},add:(e,t)=>Wc(Dr(0,e,ac(t))),subtract:(e,t)=>Wc(Dr(1,e,ac(t))),until:(e,t,n)=>$c(Ca(0,e,ic(t),n)),since:(e,t,n)=>$c(Ca(1,e,ic(t),n)),round:(e,t)=>Wc(function(e,t){const[n,r,a]=en(t,5);var o;return wn((o=a,Sn(e,On(n,r),o)[0]))}(e,t)),equals:(e,t)=>function(e,t){return!ya(e,t)}(e,ic(t)),toLocaleString(e,t,n){const[r,a]=zc(t,n,e);return r.format(a)},toString:Xn,toJSON:e=>Xn(e),valueOf:nc},{from:(e,t)=>Wc(ic(e,t)),compare:(e,t)=>ya(ic(e),ic(t))}),[Uc,qc]=Xd(ml,je(function(e,t,n,r,a=0,o=0,i=0,s=0,l=0,d=0,c=ns){return yn(Et(Ut(Ie(lt,Te(xs,[t,n,r,a,o,i,s,l,d])))),e(c))},so),{...Sc,...Nc,...Oc},{with:(e,t,n)=>qc(function(e,t,n,r){const a=e(t.calendar),o=[...a.fields(Ki),...Li].sort(),i={...wo(s=t),hour:s.isoHour,minute:s.isoMinute,second:s.isoSecond,millisecond:s.isoMillisecond,microsecond:s.isoMicrosecond,nanosecond:s.isoNanosecond};var s;const l=fo(n,o),d=Jt(r),c=a.k(i,l),u={...i,...l};return yn(Et({...a.F(c,un(d)),...Xt(dd(u),d)}))}(sd,e,Jd(t),n)),withCalendar:(e,t)=>qc(Io(e,ec(t))),withPlainTime:(e,t)=>qc(function(e,t=ks){return yn(Et({...e,...t}))}(e,sc(t))),add:(e,t,n)=>qc(yr(sd,0,e,ac(t),n)),subtract:(e,t,n)=>qc(yr(sd,1,e,ac(t),n)),until:(e,t,n)=>$c(wa(sd,0,e,lc(t),n)),since:(e,t,n)=>$c(wa(sd,1,e,lc(t),n)),round:(e,t)=>qc(function(e,t){return yn(Tn(e,...en(t)),e.calendar)}(e,t)),equals:(e,t)=>function(e,t){return!ma(e,t)&&e.calendar===t.calendar}(e,lc(t)),toZonedDateTime:(e,t,n)=>tu(function(e,t,n,r){const a=((e,t,n,r)=>{const a=(e=>il(dn(e)))(r);return gr(e(t),n,a)})(e,n,t,r);return vn(Mt(a),n,t.calendar)}(Tl,e,rc(t),n)),toPlainDate:e=>Qc(pn(e)),toPlainTime:e=>Wc(wn(e)),toLocaleString(e,t,n){const[r,a]=Ac(t,n,e);return r.format(a)},toString:Un,toJSON:e=>Un(e),valueOf:nc},{from:(e,t)=>qc(lc(e,t)),compare:(e,t)=>ma(lc(e),lc(t))}),[_c,Gc]=Xd(gl,je(function(e,t,n,r=ns,a=Ys){const o=lt(t),i=lt(n),s=e(r);return Dn(xt(qt({isoYear:lt(a),isoMonth:o,isoDay:i})),s)},so),{...Sc,...Ic},{with:(e,t,n)=>Gc(function(e,t,n,r){const a=e(t.calendar),o=a.fields(Ki).sort(),i=(e=>{const t=id(e.calendar),[n,r,a]=t.v(e),[o,i]=t.q(n,r);return{monthCode:Za(o,i),day:a}})(t),s=fo(n,o),l=a.k(i,s);return a._(l,r)}(sd,e,Jd(t),n)),equals:(e,t)=>function(e,t){return!va(e,t)&&e.calendar===t.calendar}(e,dc(t)),toPlainDate(e,t){return Qc(function(e,t,n,r){return((e,t,n)=>vo(e,t,es,et(n),Ui))(e(t.calendar),n,r)}(sd,e,this,t))},toLocaleString(e,t,n){const[r,a]=Vc(t,n,e);return r.format(a)},toString:Gn,toJSON:e=>Gn(e),valueOf:nc},{from:(e,t)=>Gc(dc(e,t))}),[Xc,Jc]=Xd(hl,je(function(e,t,n,r=ns,a=1){const o=lt(t),i=lt(n),s=e(r);return bn(wt(qt({isoYear:o,isoMonth:i,isoDay:lt(a)})),s)},so),{...Sc,...Tc},{with:(e,t,n)=>Jc(function(e,t,n,r){const a=e(t.calendar),o=a.fields(Xi).sort(),i=(e=>{const t=id(e.calendar),[n,r]=t.v(e),[a,o]=t.q(n,r);return{year:n,monthCode:Za(a,o)}})(t),s=fo(n,o),l=a.k(i,s);return a.K(l,r)}(sd,e,Jd(t),n)),add:(e,t,n)=>Jc(br(sd,0,e,ac(t),n)),subtract:(e,t,n)=>Jc(br(sd,1,e,ac(t),n)),until:(e,t,n)=>$c(Ea(sd,0,e,cc(t),n)),since:(e,t,n)=>$c(Ea(sd,1,e,cc(t),n)),equals:(e,t)=>function(e,t){return!va(e,t)&&e.calendar===t.calendar}(e,cc(t)),toPlainDate(e,t){return Qc(function(e,t,n,r){return((e,t,n)=>vo(e,t,Ji,et(n),Gi))(e(t.calendar),n,r)}(sd,e,this,t))},toLocaleString(e,t,n){const[r,a]=Fc(t,n,e);return r.format(a)},toString:_n,toJSON:e=>_n(e),valueOf:nc},{from:(e,t)=>Jc(cc(e,t)),compare:(e,t)=>va(cc(e),cc(t))}),[Kc,Qc]=Xd(fl,je(function(e,t,n,r,a=ns){return pn(xt(qt(Ie(lt,{isoYear:t,isoMonth:n,isoDay:r}))),e(a))},so),{...Sc,...Nc},{with:(e,t,n)=>Qc(function(e,t,n,r){const a=e(t.calendar),o=a.fields(Ki).sort(),i=wo(t),s=fo(n,o),l=a.k(i,s);return a.F(l,r)}(sd,e,Jd(t),n)),withCalendar:(e,t)=>Qc(Io(e,ec(t))),add:(e,t,n)=>Qc(pr(sd,0,e,ac(t),n)),subtract:(e,t,n)=>Qc(pr(sd,1,e,ac(t),n)),until:(e,t,n)=>$c(xa(sd,0,e,uc(t),n)),since:(e,t,n)=>$c(xa(sd,1,e,uc(t),n)),equals:(e,t)=>function(e,t){return!va(e,t)&&e.calendar===t.calendar}(e,uc(t)),toZonedDateTime(e,t){const n=xe(t)?t:{timeZone:t};return tu(function(e,t,n,r,a){const o=e(a.timeZone),i=a.plainTime,s=void 0!==i?t(i):void 0,l=n(o);let d;return d=s?gr(l,{...r,...s}):fr(l,{...r,...ks}),vn(d,o,r.calendar)}(rc,ic,Tl,e,n))},toPlainDateTime:(e,t)=>qc(function(e,t=ks){return yn(Et({...e,...t}))}(e,sc(t))),toPlainYearMonth(e){return Jc(function(e,t,n){return((e,t)=>{const n=go(e,t,Ji);return e.K(n,void 0)})(e(t.calendar),n)}(sd,e,this))},toPlainMonthDay(e){return Gc(function(e,t,n){return((e,t)=>{const n=go(e,t,es);return e._(n)})(e(t.calendar),n)}(sd,e,this))},toLocaleString(e,t,n){const[r,a]=Zc(t,n,e);return r.format(a)},toString:qn,toJSON:e=>qn(e),valueOf:nc},{from:(e,t)=>Qc(uc(e,t)),compare:(e,t)=>va(uc(e),uc(t))}),[eu,tu]=Xd(yl,je(function(e,t,n,r,a=ns){return vn(Mt(yt(it(n))),t(r),e(a))},so,function(e){return ca(ls(e))}),{...Rc,...Sc,...gc(Nc),...gc(Oc),offset:e=>or(fc(e).offsetNanoseconds),offsetNanoseconds:e=>fc(e).offsetNanoseconds,timeZoneId:e=>e.timeZone,hoursInDay:e=>function(e,t){const n=e(t.timeZone),r=kl(t,n),[a,o]=Rn(r),i=bt(ft(fr(n,a),fr(n,o)),$i,1);if(i<=0)throw new RangeError(ri);return i}(Tl,e)},{with:(e,t,n)=>tu(function(e,t,n,r,a){const{calendar:o,timeZone:i}=n,s=e(o),l=t(i),d=[...s.fields(Ki),...Fi].sort(),c=(e=>{const t=kl(e,Tl),n=or(t.offsetNanoseconds),r=id(e.calendar),[a,o,i]=r.v(t),[s,l]=r.q(a,o),d=Za(s,l);return{...cd(t),year:a,monthCode:d,day:i,offset:n}})(n),u=fo(r,d),h=s.k(c,u),g={...c,...u},[f,m,v]=Kt(a,2);return vn(hr(l,{...s.F(h,un(f)),...Xt(dd(g),f)},Ur(g.offset),m,v),i,o)}(sd,Tl,e,Jd(t),n)),withCalendar:(e,t)=>tu(Io(e,ec(t))),withTimeZone:(e,t)=>tu(function(e,t){return{...e,timeZone:t}}(e,rc(t))),withPlainTime:(e,t)=>tu(function(e,t,n){const r=t.timeZone,a=e(r),o={...kl(t,a),...n||ks};let i;return i=n?hr(a,o,o.offsetNanoseconds,2):fr(a,o),vn(i,r,t.calendar)}(Tl,e,sc(t))),add:(e,t,n)=>tu(vr(sd,Tl,0,e,ac(t),n)),subtract:(e,t,n)=>tu(vr(sd,Tl,1,e,ac(t),n)),until:(e,t,n)=>$c(xn(Da(sd,Tl,0,e,hc(t),n))),since:(e,t,n)=>$c(xn(Da(sd,Tl,1,e,hc(t),n))),round:(e,t)=>tu(function(e,t,n){let{epochNanoseconds:r,timeZone:a,calendar:o}=t;const[i,s,l]=en(n);if(0===i&&1===s)return t;const d=e(a);if(6===i)r=((e,t,n,r)=>{const a=kl(n,t),[o,i]=e(a),s=n.epochNanoseconds,l=fr(t,o),d=fr(t,i);if(vt(s,l,d))throw new RangeError(ri);return Zn(Nn(s,l,d),r)?d:l})(Rn,d,t,l);else{const e=d.R(r);r=hr(d,Tn(Pt(r,e),i,s,l),e,2,0,1)}return vn(r,a,o)}(Tl,e,t)),startOfDay:e=>tu(function(e,t){const{timeZone:n,calendar:r}=t,a=((e,t,n)=>fr(t,e(kl(n,t))))(Pn,e(n),t);return vn(a,n,r)}(Tl,e)),equals:(e,t)=>function(e,t){return!fa(e,t)&&!!pa(e.timeZone,t.timeZone)&&e.calendar===t.calendar}(e,hc(t)),toInstant:e=>ru(function(e){return mn(e.epochNanoseconds)}(e)),toPlainDateTime:e=>qc(xo(Tl,e)),toPlainDate:e=>Qc(Eo(Tl,e)),toPlainTime:e=>Wc(Mo(Tl,e)),toLocaleString(e,t,n={}){const[r,a]=Lc(t,n,e);return r.format(a)},toString:(e,t)=>Wn(Tl,e,t),toJSON:e=>Wn(Tl,e),valueOf:nc,getTimeZoneTransition(e,t){const{timeZone:n,epochNanoseconds:r}=e,a=function(e){const t=cn(e,Us),n=gn(Us,tl,t,0);if(!n)throw new RangeError(zo(Us,n));return n}(t),o=Tl(n).O(r,a);return o?tu({...e,epochNanoseconds:o}):null}},{from:(e,t)=>tu(hc(e,t)),compare:(e,t)=>fa(hc(e),hc(t))}),[nu,ru]=Xd(pl,function(e){return mn(Mt(yt(it(e))))},Rc,{add:(e,t)=>ru(mr(0,e,ac(t))),subtract:(e,t)=>ru(mr(1,e,ac(t))),until:(e,t,n)=>$c(ba(0,e,mc(t),n)),since:(e,t,n)=>$c(ba(1,e,mc(t),n)),round:(e,t)=>ru(function(e,t){const[n,r,a]=en(t,5,1);return mn(Yn(e.epochNanoseconds,n,r,a,1))}(e,t)),equals:(e,t)=>function(e,t){return!ga(e,t)}(e,mc(t)),toZonedDateTimeISO:(e,t)=>tu(function(e,t,n=ns){return vn(e.epochNanoseconds,t,n)}(e,rc(t))),toLocaleString(e,t,n){const[r,a]=Yc(t,n,e);return r.format(a)},toString:(e,t)=>Bn(rc,Tl,e,t),toJSON:e=>Bn(rc,Tl,e),valueOf:nc},{from:e=>ru(mc(e)),fromEpochMilliseconds:e=>ru(function(e){return mn(Mt(pt(dt(e),Oi)))}(e)),fromEpochNanoseconds:e=>ru(function(e){return mn(Mt(yt(it(e))))}(e)),compare:(e,t)=>ga(mc(e),mc(t))}),au=Object.defineProperties({},{...Ne("Temporal.Now"),...Ce({timeZoneId:()=>Oo(),instant:()=>ru(mn(Ho())),zonedDateTimeISO:(e=Oo())=>tu(vn(Ho(),rc(e),ns)),plainDateTimeISO:(e=Oo())=>qc(yn(So(Tl(rc(e))),ns)),plainDateISO:(e=Oo())=>Qc(pn(So(Tl(rc(e))),ns)),plainTimeISO:(e=Oo())=>Wc(wn(So(Tl(rc(e)))))})}),ou=Object.defineProperties({},{...Ne("Temporal"),...Ce({PlainYearMonth:Xc,PlainMonthDay:_c,PlainDate:Kc,PlainTime:Bc,PlainDateTime:Uc,ZonedDateTime:eu,Instant:nu,Duration:Pc,Now:au})}),iu=vc(),su=new WeakMap;function lu(e){var t;return e instanceof ou.PlainDate||("PlainDate"===(null===(t=null==e?void 0:e.constructor)||void 0===t?void 0:t.name)||!("hour"in e)&&!("timeZone"in e))}function du(e){return e instanceof Date}function cu(e,t=ou.Now.timeZoneId()){return ou.Instant.fromEpochMilliseconds(e.getTime()).toZonedDateTimeISO(t)}function uu(e){return ou.PlainDate.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()})}function hu(e){return new Date(e.epochMilliseconds)}function gu(e,t){return lu(e)?function(e,t=ou.Now.timeZoneId()){return hu(e.toZonedDateTime({timeZone:t,plainTime:ou.PlainTime.from({hour:0,minute:0})}))}(e,t):"hour"in e&&!("timeZone"in e)?new Date(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond):hu(e)}function fu(e,t){const n=Math.floor(t),r=Math.round(60*(t-n));return lu(e)?ou.PlainDateTime.from({year:e.year,month:e.month,day:e.day,hour:n,minute:r}):e.with({hour:n,minute:r,second:0,millisecond:0})}function mu(e,t){const n=lu(e)?e:e.toPlainDate(),r=lu(t)?t:t.toPlainDate();return 0===ou.PlainDate.compare(n,r)}function vu(e,t){return!mu(e,t)}function yu(e,t=ou.Now.timeZoneId()){return(lu(e)?e:e.toPlainDate()).toZonedDateTime({timeZone:t,plainTime:ou.PlainTime.from({hour:0,minute:0})})}function pu(e,t=ou.Now.timeZoneId()){return(lu(e)?e:e.toPlainDate()).toZonedDateTime({timeZone:t,plainTime:ou.PlainTime.from({hour:23,minute:59,second:59,millisecond:999})})}function bu(e,t){const n=lu(e)?e:e.toPlainDate(),r=lu(t)?t:t.toPlainDate();return n.until(r).days}function Du(e,t){const n=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((r.getTime()-n.getTime())/864e5)}function wu(e,t){const n=new Date(e);return n.setDate(n.getDate()+t),n}function xu(e=ou.Now.timeZoneId()){return ou.Now.zonedDateTimeISO(e)}function Eu(e=ou.Now.timeZoneId()){return ou.Now.plainDateISO(e)}Object.create(Intl),Ce({DateTimeFormat:iu});const Mu=e=>{if(e instanceof Date){return e.getHours()+e.getMinutes()/60}return lu(t=e)?0:"hour"in t&&void 0!==t.hour?t.hour+(null!==(n=t.minute)&&void 0!==n?n:0)/60:(console.warn("Warning: No hour property found in temporal object, returning 0"),0);var t,n},Cu=(e,t)=>{if(e instanceof Date){const n=new Date(e),r=Math.floor(t),a=Math.round(60*(t-r));return n.setHours(r,a,0,0),n}return fu(e,t)},ku=e=>{if(e instanceof Date){const t=new Date(e);return t.setHours(0,0,0,0),t}return yu(e)},Nu=e=>{if(e instanceof Date){const t=new Date(e);return t.setHours(23,59,59,999),t}return pu(e)},Tu=(e,t)=>{if(e instanceof Date&&t instanceof Date)return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate();return mu(e instanceof Date?ou.PlainDate.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}):lu(e)?e:e.toPlainDate(),t instanceof Date?ou.PlainDate.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}):lu(t)?t:t.toPlainDate())},Iu=(e,t)=>!Tu(e,t),Su=e=>A().resolveColors(e).eventColor,Hu=e=>A().resolveColors(e).textColor,Ou=e=>A().resolveColors(e).eventSelectedColor,Ru=e=>A().resolveColors(e).lineColor,Pu=.25,$u=(e,t=0)=>{const n=Math.floor(e),r=t||Math.round(60*(e-n));return`${n.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`},ju=e=>{if(e.allDay)return"All day";const t=Mu(e.start),n=Lu(e);return`${$u(t)} - ${$u(n)}`},Yu=e=>{const t=Pu;return Math.round(e/t)*t},Lu=e=>{if(!e.end)return 0;const t=Mu(e.end);if(e.allDay||!e.start)return t;const n=gu(e.start),r=gu(e.end);if(!(n.getFullYear()!==r.getFullYear()||n.getMonth()!==r.getMonth()||n.getDate()!==r.getDate()))return t;if(0===t&&0===r.getMinutes()&&0===r.getSeconds()&&0===r.getMilliseconds()){const e=r.getTime()-n.getTime();if(e>0&&e<864e5)return 24}return t},Au=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Zu=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],zu=["January","February","March","April","May","June","July","August","September","October","November","December"],Fu=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Vu=e=>{const t=e.getDay(),n=e.getDate()-t+(0===t?-6:1),r=new Date(e);r.setDate(n),r.setHours(0,0,0,0);const a=new Date(r);return a.setDate(r.getDate()+6),a.setHours(23,59,59,999),{monday:r,sunday:a}},Bu=()=>{const e=new Date,t=new Date,n=e.getDay(),r=e.getDate()-n+(0===n?-6:1);return Au.map((n,a)=>{const o=new Date(e);return o.setDate(r+a),{date:o.getDate(),month:o.toLocaleString("default",{month:"short"}),isToday:o.getDate()===t.getDate()&&o.getMonth()===t.getMonth()&&o.getFullYear()===t.getFullYear()}})},Wu=e=>{const t=new Date(e),n=t.getDate(),r=t.getMonth(),a=t.getFullYear(),o=new Date;return{date:t,day:n,month:r,year:a,monthName:zu[r],shortMonthName:Fu[r],isToday:o.getDate()===n&&o.getMonth()===r&&o.getFullYear()===a}},Uu=e=>{const t=[],n=new Date(e);for(let e=0;e<7;e++){const e=new Date(n);t.push(Wu(e)),n.setDate(n.getDate()+1)}return{days:t,startDate:new Date(e),monthYear:qu(t)}},qu=e=>{const t={};e.forEach(e=>{const n=`${e.month}-${e.year}`;t[n]=(t[n]||0)+1});let n=0,r="";Object.entries(t).forEach(([e,t])=>{t>n&&(n=t,r=e)});const[a,o]=r.split("-").map(Number);return{month:zu[a],monthIndex:a,year:o}},_u=(e,t=3)=>{const n=5*t,{monday:r}=Vu(e),a=[],o=Math.floor(n/2),i=new Date(r);i.setDate(i.getDate()-7*o);for(let e=0;e<n;e++){const t=new Date(i);t.setDate(t.getDate()+7*e),a.push(Uu(t))}return a};function Gu(e,t){const n=[],r=Math.floor(t/2),a=new Date(e),o=e.getDay(),i=0===o?6:o-1;a.setDate(e.getDate()-i),a.setHours(0,0,0,0);const s=new Date(a);s.setDate(s.getDate()-7*r);for(let e=0;e<t;e++){const t=new Date(s);t.setDate(t.getDate()+7*e),n.push(Uu(t))}return n}const Xu=(e,t)=>t.filter(t=>t.day===e&&!t.allDay),Ju=(e,t,n)=>t.filter(t=>{if(!t.allDay)return!1;if(!n)return t.day===e;const r=new Date(n);r.setDate(n.getDate()+e),r.setHours(0,0,0,0);const a=gu(t.start);a.setHours(0,0,0,0);const o=gu(t.end);return o.setHours(0,0,0,0),r>=a&&r<=o}),Ku=(e,t)=>{const n=new Date(e);return n.setDate(e.getDate()+t),n},Qu=(e,t,n)=>{const r=Ku(n,t);return Object.assign(Object.assign({},e),{day:t,start:e.allDay?ou.PlainDate.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate()}):ou.ZonedDateTime.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate(),hour:r.getHours(),minute:r.getMinutes(),timeZone:ou.Now.timeZoneId()}),end:e.allDay?ou.PlainDate.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate()}):ou.ZonedDateTime.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate(),hour:r.getHours(),minute:r.getMinutes(),timeZone:ou.Now.timeZoneId()})})},eh=(e,t)=>t?ou.PlainDate.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}):ou.ZonedDateTime.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),millisecond:e.getMilliseconds(),timeZone:ou.Now.timeZoneId()}),th=(e,t)=>{var n,r;const a=Ku(t,null!==(n=e.day)&&void 0!==n?n:0),o=null!==(r=e.allDay)&&void 0!==r&&r;return Object.assign(Object.assign({},e),{start:eh(a,o),end:eh(a,o)})},nh=(e,t)=>{const n=new Date(e);n.setHours(0,0,0,0);const r=new Date(t);r.setHours(0,0,0,0);const a=n.getTime()-r.getTime();return Math.floor(a/864e5)},rh=(e,t)=>{const n=nh(e,t);return n>=0&&n<=6},ah=(e,t)=>e.map(e=>{const n=gu(e.start),r=nh(n,t);return Object.assign(Object.assign({},e),{day:r})}),oh=(e,t)=>{const n=new Date(e);n.setHours(0,0,0,0);const r=new Date(t);r.setHours(0,0,0,0);const a=r.getTime()-n.getTime();return Math.floor(a/864e5)},ih=(e,t)=>{const n=new Date(t);return n.setDate(t.getDate()+6),n.setHours(23,59,59,999),e.filter(e=>{const r=gu(e.start);return r>=t&&r<=n}).map(e=>{const n=nh(gu(e.start),t);return Object.assign(Object.assign({},e),{day:n})})},sh=(e,t)=>{var n,r;const a=new Date(t);a.setDate(t.getDate()+(null!==(n=e.day)&&void 0!==n?n:0));const o=null!==(r=e.allDay)&&void 0!==r&&r;return Object.assign(Object.assign({},e),{start:eh(a,o),end:eh(a,o)})},lh=(e,t,n)=>{var r;const a=new Date(n);a.setDate(n.getDate()+t);const o=null!==(r=e.allDay)&&void 0!==r&&r;return Object.assign(Object.assign({},e),{day:t,start:eh(a,o),end:eh(a,o)})};function dh(){const e=new Date,t=e.getDay(),n=new Date(e),r=0===t?-6:1-t;n.setDate(e.getDate()+r),n.setHours(0,0,0,0);const a=[{id:"15",title:"C-早开始",day:3,startHour:8.5,endHour:10,calendarId:"teal"},{id:"16",title:"D-晚开始",day:3,startHour:9,endHour:10.5,calendarId:"red"},{id:"21",title:"A",day:0,startHour:14,endHour:16,calendarId:"blue"},{id:"22",title:"B",day:0,startHour:14.5,endHour:16,calendarId:"green"},{id:"23",title:"C",day:0,startHour:14.5,endHour:16,calendarId:"purple"},{id:"24",title:"D",day:0,startHour:15,endHour:16,calendarId:"yellow"},{id:"25",title:"E",day:0,startHour:15,endHour:16,calendarId:"red"},{id:"26",title:"F",day:0,startHour:15.5,endHour:16,calendarId:"orange"},{id:"27",title:"G",day:0,startHour:15,endHour:16,calendarId:"pink"},{id:"28",title:"H",day:0,startHour:15.5,endHour:16,calendarId:"teal"},{id:"29",title:"L",day:0,startHour:15.5,endHour:16,calendarId:"teal"},{id:"30",title:"I",day:0,startHour:15.5,endHour:16,calendarId:"blue"},{id:"99",title:"X",day:0,startHour:15.5,endHour:16,calendarId:"blue"},{id:"6",title:"假日",day:0,startHour:0,endHour:0,calendarId:"blue",allDay:!0},{id:"7",title:"研讨会",day:2,startHour:0,endHour:0,calendarId:"green",allDay:!0},{id:"8",title:"团队建设",day:4,startHour:0,endHour:0,calendarId:"purple",allDay:!0},{id:"41",title:"A",day:3,startHour:16,endHour:18.25,calendarId:"blue"},{id:"42",title:"B",day:3,startHour:16.5,endHour:18,calendarId:"green"},{id:"43",title:"C",day:3,startHour:16.75,endHour:17.75,calendarId:"purple"},{id:"44",title:"D",day:3,startHour:17,endHour:19,calendarId:"yellow"},{id:"45",title:"E",day:3,startHour:17.75,endHour:18.75,calendarId:"red"},{id:"46",title:"X",day:2,startHour:15,endHour:15.75,calendarId:"orange"},{id:"47",title:"Y",day:2,startHour:15.5,endHour:19.5,calendarId:"pink"},{id:"48",title:"Z",day:2,startHour:15,endHour:15.75,calendarId:"teal"},{id:"59",title:"Q",day:2,startHour:17,endHour:18,calendarId:"teal"},{id:"60",title:"W",day:2,startHour:15.5,endHour:18,calendarId:"teal"},{id:"31",title:"A",day:6,startHour:14,endHour:16,calendarId:"blue"},{id:"32",title:"B",day:6,startHour:14.5,endHour:16,calendarId:"green"},{id:"33",title:"C",day:6,startHour:14.5,endHour:16,calendarId:"purple"},{id:"34",title:"D",day:6,startHour:15,endHour:16,calendarId:"yellow"},{id:"35",title:"E",day:6,startHour:15.5,endHour:16.5,calendarId:"red"},{id:"36",title:"F",day:6,startHour:16.25,endHour:16.75,calendarId:"orange"},{id:"37",title:"G",day:6,startHour:16,endHour:17.25,calendarId:"pink"},{id:"51",title:"下周会议1",day:1,startHour:9,endHour:10,calendarId:"blue"},{id:"52",title:"下周会议2",day:3,startHour:14,endHour:15,calendarId:"green"},{id:"81",title:"A",day:5,startHour:14,endHour:16,calendarId:"blue"},{id:"82",title:"B",day:5,startHour:14.5,endHour:16,calendarId:"green"},{id:"83",title:"C",day:5,startHour:14.5,endHour:16,calendarId:"purple"},{id:"84",title:"D",day:5,startHour:15,endHour:16,calendarId:"yellow"},{id:"85",title:"E",day:5,startHour:15,endHour:16,calendarId:"red"},{id:"86",title:"F",day:5,startHour:15.75,endHour:17,calendarId:"orange"},{id:"87",title:"G",day:5,startHour:14.75,endHour:17.5,calendarId:"pink"}].map(e=>{const t=new Date(n);if(t.setDate(n.getDate()+e.day),e.allDay)return{id:e.id,title:e.title,start:ou.PlainDate.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}),end:ou.PlainDate.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}),allDay:!0,calendarId:e.calendarId,day:e.day};const r=Math.floor(e.startHour),a=Math.round(60*(e.startHour-r)),o=Math.floor(e.endHour),i=Math.round(60*(e.endHour-o));return{id:e.id,title:e.title,start:ou.ZonedDateTime.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:r,minute:a,timeZone:ou.Now.timeZoneId()}),end:ou.ZonedDateTime.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:o,minute:i,timeZone:ou.Now.timeZoneId()}),allDay:!1,calendarId:e.calendarId,day:e.day}});return a}function ch(){return Date.now().toString(36)+Math.random().toString(36).substring(2,8)}const uh=e=>{if(e.icon)return e.icon;return(e.name||e.id).charAt(0).toUpperCase()},hh=({app:e,calendars:o,toggleCalendarVisibility:i,isCollapsed:s,setCollapsed:m})=>{const v=e.getCurrentDate(),y=e.getVisibleMonth(),p=y.getFullYear(),b=y.getMonth(),[D,w]=n(()=>new Date(p,b,1));a(()=>{w(e=>e.getFullYear()===p&&e.getMonth()===b?e:new Date(p,b,1))},[p,b]);const x=t(()=>(new Date).toDateString(),[]),E=v.toDateString(),M=t(()=>Au.map(e=>e.charAt(0)),[]),C=t(()=>{const e=D.getFullYear(),t=D.getMonth(),n=(new Date(e,t,1).getDay()+6)%7,r=[];for(let a=0;a<42;a++){const o=new Date(e,t,a-n+1),i=o.toDateString();r.push({date:o.getDate(),fullDate:o,isCurrentMonth:o.getMonth()===t,isToday:i===x,isSelected:i===E})}return r},[D,E,x]),k=t(()=>D.toLocaleDateString(void 0,{month:"long",year:"numeric"}),[D]),N=r(t=>{w(n=>{const r=new Date(n.getFullYear(),n.getMonth()+t,1);return e.setVisibleMonth(r),r})},[e]),T=r(t=>{const n=new Date(t.getFullYear(),t.getMonth(),t.getDate());e.setCurrentDate(n),w(new Date(n.getFullYear(),n.getMonth(),1))},[e]);return l("div",{className:"flex h-full flex-col border-r border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-900",children:[l("div",{className:"flex items-center px-2 py-2",children:[d("button",{type:"button","aria-label":s?"Expand calendar sidebar":"Collapse calendar sidebar",className:"flex h-8 w-8 items-center justify-center rounded hover:bg-gray-100 dark:hover:bg-slate-800",onClick:()=>m(!s),children:d(s?u:h,{className:"h-4 w-4 text-gray-500 dark:text-gray-400"})}),!s&&d("span",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:"Calendars"})]}),s?d("div",{className:"flex-1 overflow-y-auto px-2 pb-3",children:d("ul",{className:"space-y-1",children:o.map(e=>{var t;const n=!1!==e.isVisible,r=(null===(t=e.colors)||void 0===t?void 0:t.lineColor)||"#3b82f6";return Boolean(e.icon),d("li",{children:l("label",{className:"group flex cursor-pointer items-center rounded px-2 py-2 transition hover:bg-gray-100 dark:hover:bg-slate-800",title:e.name,children:[d("input",{type:"checkbox",className:"calendar-checkbox",style:{"--checkbox-color":r},checked:n,onChange:t=>i(e.id,t.target.checked)}),d("span",{className:"flex-1 truncate text-sm text-gray-700 group-hover:text-gray-900 dark:text-gray-200 dark:group-hover:text-white",children:" "})]})},e.id)})})}):l(c,{children:[d("div",{className:"flex-1 overflow-y-auto px-2 pb-3",children:d("ul",{className:"space-y-1",children:o.map(e=>{var t;const n=!1!==e.isVisible,r=(null===(t=e.colors)||void 0===t?void 0:t.lineColor)||"#3b82f6",a=Boolean(e.icon);return d("li",{children:l("label",{className:"group flex cursor-pointer items-center rounded px-2 py-2 transition hover:bg-gray-100 dark:hover:bg-slate-800",title:e.name,children:[d("input",{type:"checkbox",className:"calendar-checkbox",style:{"--checkbox-color":r},checked:n,onChange:t=>i(e.id,t.target.checked)}),a&&d("span",{className:"mr-2 flex h-5 w-5 flex-shrink-0 items-center justify-center text-xs font-semibold text-white","aria-hidden":"true",children:uh(e)}),d("span",{className:"flex-1 truncate text-sm text-gray-700 group-hover:text-gray-900 dark:text-gray-200 dark:group-hover:text-white",children:e.name||e.id})]})},e.id)})})}),l("div",{className:"border-t border-gray-200 px-3 py-3 dark:border-slate-800",children:[l("div",{className:"mb-3 flex items-center justify-between",children:[d("button",{type:"button",className:"flex h-7 w-7 items-center justify-center rounded-full text-gray-500 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-slate-800",onClick:()=>N(-1),"aria-label":"Previous month",children:d(g,{className:"h-4 w-4"})}),d("span",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:k}),d("button",{type:"button",className:"flex h-7 w-7 items-center justify-center rounded-full text-gray-500 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-slate-800",onClick:()=>N(1),"aria-label":"Next month",children:d(f,{className:"h-4 w-4"})})]}),l("div",{className:le,children:[M.map(e=>d("div",{className:`${de} text-gray-500 dark:text-gray-400`,children:e},ch())),C.map(e=>d("button",{type:"button",className:`\n ${ce}\n ${e.isCurrentMonth?ue:he}\n ${e.isToday?ge:""}\n ${e.isSelected&&!e.isToday?fe:""}\n `,onClick:()=>T(e.fullDate),children:e.date},ch()))]})]})]})]})},gh=({options:e,value:t,onChange:r})=>{const[i,s]=n(!1),c=o(null);a(()=>{const e=e=>{c.current&&!c.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),e.find(e=>e.value===t);const u=e=>A().resolveColors(e).lineColor;return l("div",{className:"relative inline-block",ref:c,children:[l("button",{type:"button",onClick:()=>s(!i),className:"flex items-center space-x-2 bg-gray-100 dark:bg-gray-700 rounded-md px-2 py-1 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors h-8",children:[d("span",{className:"w-4 h-4 rounded-sm flex-shrink-0",style:{backgroundColor:u(t)}}),d(m,{className:"w-4 h-4 text-gray-600 dark:text-gray-300"})]}),i&&d("ul",{className:"absolute mt-1 w-full min-w-max bg-gray-100 dark:bg-gray-700 rounded-md shadow-lg dark:shadow-gray-900/50 z-10 overflow-hidden border dark:border-gray-600",children:e.map(e=>l("li",{className:"flex items-center px-2 py-1 cursor-pointer hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors "+(t===e.value?"font-semibold":""),onClick:()=>{return t=e.value,r(t),void s(!1);var t},children:[t===e.value?d("span",{className:"mr-2 text-sm",children:d(v,{width:12,height:12})}):d("div",{className:"mr-2 text-sm w-3 h-3",children:" "}),d("span",{className:"w-3 h-3 mr-2 rounded-sm flex-shrink-0",style:{backgroundColor:u(e.value)}}),d("span",{className:"text-sm whitespace-nowrap",children:e.label})]},e.value))})]})},fh=/(YYYY|YY|MM|DD|HH|mm)/g,mh=e=>e.toString().padStart(2,"0"),vh=(e,t)=>{const n=(null!=t?t:"").trim(),r=/[Hhms]/.test(e)||!n?e:`${e} ${n}`.trim();return r.replace(/(H{1,2}):MM/g,(e,t)=>`${t}:mm`)},yh=e=>e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),ph=e=>{let t,n=0,r="^";for(;null!==(t=fh.exec(e));){r+=yh(e.slice(n,t.index));const a=t[0];r+=`(?<${a}>\\d{${"YYYY"===a?4:2}})`,n=t.index+a.length}return r+=yh(e.slice(n))+"$",new RegExp(r)},bh=(e,t,n,r)=>{const a=e.trim();if(!a)return null;const o=a.match(t),i=null==o?void 0:o.groups;if(!i)return null;const s=i.YYYY?Number(i.YYYY):i.YY?Number(i.YY)+2e3:n.year,l=i.MM?Number(i.MM):n.month,d=i.DD?Number(i.DD):n.day,c=i.HH?Number(i.HH):n.hour,u=i.mm?Number(i.mm):n.minute;try{return ou.ZonedDateTime.from({timeZone:r,year:s,month:l,day:d,hour:c,minute:u,second:n.second,millisecond:n.millisecond,microsecond:n.microsecond,nanosecond:n.nanosecond})}catch(e){return null}},Dh=e=>{const t=e;if(t.timeZoneId&&"string"==typeof t.timeZoneId)return t.timeZoneId;if("timeZoneId"in e&&"string"==typeof e.timeZoneId)return e.timeZoneId;const n=e.timeZone;return n&&"string"==typeof n.id?n.id:"string"==typeof t.timeZone?t.timeZone:ou.Now.timeZoneId()},wh=(e,t,n)=>{var r,a,o,i,s,l,d,c,u,h,g,f,m,v,y,p,b,D,w,x,E,M,C,k;if(!e){const e=null!=t?t:n?Dh(n):ou.Now.timeZoneId();return null!=n?n:ou.Now.zonedDateTimeISO(e)}if(lu(e)){const n=null!=t?t:ou.Now.timeZoneId(),r=`${e.year}-${mh(e.month)}-${mh(e.day)}T00:00:00[${n}]`;return ou.ZonedDateTime.from(r)}if("hour"in e&&!("timeZone"in e)){const n=null!=t?t:ou.Now.timeZoneId();if("function"==typeof e.toZonedDateTime)try{return e.toZonedDateTime(n)}catch(e){}return ou.ZonedDateTime.from({timeZone:n,year:e.year,month:e.month,day:e.day,hour:e.hour,minute:e.minute,second:null!==(r=e.second)&&void 0!==r?r:0,millisecond:null!==(a=e.millisecond)&&void 0!==a?a:0,microsecond:null!==(o=e.microsecond)&&void 0!==o?o:0,nanosecond:null!==(i=e.nanosecond)&&void 0!==i?i:0})}try{return ou.ZonedDateTime.from(e)}catch(r){const a=e,o=null!==(u=null!==(c=null!==(d=null!==(l="string"==typeof(null==a?void 0:a.timeZone)?a.timeZone:null===(s=null==a?void 0:a.timeZone)||void 0===s?void 0:s.id)&&void 0!==l?l:null==a?void 0:a.timeZoneId)&&void 0!==d?d:t)&&void 0!==c?c:n?Dh(n):void 0)&&void 0!==u?u:ou.Now.timeZoneId();if("function"==typeof(null==a?void 0:a.toZonedDateTime))try{return a.toZonedDateTime({timeZone:o})}catch(e){}const i=null!=n?n:ou.Now.zonedDateTimeISO(o);return ou.ZonedDateTime.from({timeZone:o,year:null!==(h=null==a?void 0:a.year)&&void 0!==h?h:i.year,month:null!==(g=null==a?void 0:a.month)&&void 0!==g?g:i.month,day:null!==(f=null==a?void 0:a.day)&&void 0!==f?f:i.day,hour:null!==(v=null!==(m=null==a?void 0:a.hour)&&void 0!==m?m:null==n?void 0:n.hour)&&void 0!==v?v:0,minute:null!==(p=null!==(y=null==a?void 0:a.minute)&&void 0!==y?y:null==n?void 0:n.minute)&&void 0!==p?p:0,second:null!==(D=null!==(b=null==a?void 0:a.second)&&void 0!==b?b:null==n?void 0:n.second)&&void 0!==D?D:0,millisecond:null!==(x=null!==(w=null==a?void 0:a.millisecond)&&void 0!==w?w:null==n?void 0:n.millisecond)&&void 0!==x?x:0,microsecond:null!==(M=null!==(E=null==a?void 0:a.microsecond)&&void 0!==E?E:null==n?void 0:n.microsecond)&&void 0!==M?M:0,nanosecond:null!==(k=null!==(C=null==a?void 0:a.nanosecond)&&void 0!==C?C:null==n?void 0:n.nanosecond)&&void 0!==k?k:0})}},xh=(e,t,n)=>{const r=vh(t,n),a={YYYY:e.year.toString(),YY:mh(e.year%100),MM:mh(e.month),DD:mh(e.day),HH:mh(e.hour),mm:mh(e.minute)};return r.replace(fh,e=>{var t;return null!==(t=a[e])&&void 0!==t?t:e})},Eh=Array.from({length:24},(e,t)=>t),Mh=Array.from({length:60},(e,t)=>t),Ch=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],kh=(e,t)=>ou.PlainDate.compare(e,t),Nh=({value:e,format:i="YYYY-MM-DD HH:mm",showTimeFormat:s="HH:mm",showTime:c=!0,onChange:u,onOk:h,timeZone:m,disabled:v=!1,placement:D="bottomLeft",autoAdjustOverflow:w=!0,getPopupContainer:x,matchTriggerWidth:E=!1})=>{const M=t(()=>void 0===c||("object"==typeof c||Boolean(c)),[c]),C=t(()=>M?"object"==typeof c&&(null==c?void 0:c.format)?c.format:s:"",[M,c,s]),N=t(()=>vh(i,C),[i,C]),T=t(()=>ph(N),[N]),I=t(()=>{const t=null!=m?m:lu(e[0])?lu(e[1])?ou.Now.timeZoneId():Dh(e[1]):Dh(e[0]),n=wh(e[0],t);return[n,wh(e[1],t,n)]},[e,m]),[S,H]=n(I),O=o(I),[R,P]=n("start"),[$,j]=n([xh(I[0],i,C),xh(I[1],i,C)]),Y=o([xh(I[0],i,C),xh(I[1],i,C)]),L=o(I),[A,Z]=n(I[0].toPlainDate().with({day:1})),[z,F]=n(!1),V=r(e=>{F(e)},[]),[B,W]=n(D),U=o(D),q=o(null),_=o(null),G=o({start:{hour:null,minute:null},end:{hour:null,minute:null}}),X=o(!1);a(()=>{Y.current=$},[$]),a(()=>{L.current=S},[S]),a(()=>{const e=O.current,t=0!==ou.ZonedDateTime.compare(e[0],I[0]),n=0!==ou.ZonedDateTime.compare(e[1],I[1]);(t||n)&&H(I),O.current=I},[I]),a(()=>{Z(I[0].toPlainDate().with({day:1}))},[I[0]]);const J=r((e,t,n=0)=>{var r;if(!e||!t)return;const a=e.getBoundingClientRect(),o=t.getBoundingClientRect().top-a.top+e.scrollTop-n,i=(null===(r=window.matchMedia)||void 0===r?void 0:r.call(window,"(prefers-reduced-motion: reduce)").matches)?"auto":"smooth";Math.abs(e.scrollTop-o)>1&&e.scrollTo({top:o,behavior:i})},[]),K=r(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=G.current[e];["hour","minute"].forEach(e=>{const n=t[e];if(!n)return;const r=n.querySelector('[data-active="true"]');r&&J(n,r,0)})})})},[J]);a(()=>{z&&M&&K(R)},[R,z,K,M]);const Q=S[0].epochMilliseconds,ee=S[0].offsetNanoseconds,te=S[1].epochMilliseconds,ne=S[1].offsetNanoseconds;a(()=>{const[e,t]=L.current,n=xh(e,i,C),r=xh(t,i,C),[a,o]=Y.current;a===n&&o===r||(Y.current=[n,r],j([n,r]))},[Q,ee,te,ne,i,C]),a(()=>{if(!z)return;const e=e=>{var t,n;const r=e.target;if(null===(t=q.current)||void 0===t?void 0:t.contains(r))return;if(null===(n=_.current)||void 0===n?void 0:n.contains(r))return;r.closest("[data-rangepicker-popup]")||V(!1)},t=setTimeout(()=>{document.addEventListener("mousedown",e)},100);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[z]),a(()=>{z||(P("start"),X.current||H(I),X.current=!1)},[z,I]);const re=r(e=>{u&&u(e,[xh(e[0],i,C),xh(e[1],i,C)])},[C,i,u]),ae=r(e=>{h&&h(e,[xh(e[0],i,C),xh(e[1],i,C)])},[C,i,h]),oe=r((e,t)=>{H(n=>{const r=[...n];if("start"===e){const e=wh(r[1],Dh(t),t),n=ou.ZonedDateTime.compare(t,e)>0?t:e;return[t,n]}const a=wh(r[0],Dh(t),t);return[ou.ZonedDateTime.compare(a,t)>0?t:a,t]})},[]),ie=r((e,t)=>{if(v)return;const n="start"===e?0:1;H(r=>{const a=r[n],o=a.with({hour:t,minute:a.minute,second:0,millisecond:0,microsecond:0,nanosecond:0});if("start"===e){const e=wh(r[1],Dh(o),o);return[o,ou.ZonedDateTime.compare(o,e)>0?o:e]}const i=wh(r[0],Dh(o),o);return[ou.ZonedDateTime.compare(i,o)>0?o:i,o]}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=G.current[e].hour;if(!t)return;const n=t.querySelector('[data-active="true"]');n&&J(t,n,0)})})},[v]),se=r((e,t)=>{if(v)return;const n="start"===e?0:1;H(r=>{const a=r[n].with({minute:t,second:0,millisecond:0,microsecond:0,nanosecond:0});if("start"===e){const e=wh(r[1],Dh(a),a);return[a,ou.ZonedDateTime.compare(a,e)>0?a:e]}const o=wh(r[0],Dh(a),a);return[ou.ZonedDateTime.compare(o,a)>0?a:o,a]}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=G.current[e].minute;if(!t)return;const n=t.querySelector('[data-active="true"]');n&&J(t,n,0)})})},[v]),le=r((e,t)=>{const n="start"===e?0:1;j(e=>{const r=[...e];return r[n]=t,r})},[]),de=r((e,t)=>{const n="start"===e?0:1,r=S[n],a=Dh(r),o=bh(t,T,r,a);if(o){oe(e,o);const t=o.toPlainDate().with({day:1});return Z(t),"start"===e&&P("end"),!0}return j(e=>{const t=[...e];return t[n]=xh(S[n],i,C),t}),!1},[S,C,i,T,oe]),ce=r(e=>t=>{le(e,t.target.value)},[le]),ue=r(e=>t=>{var n;if(v)return;if(z)return;const r=t.relatedTarget;r&&(null===(n=q.current)||void 0===n?void 0:n.contains(r))||de(e,t.target.value)},[de,v,z]),he=r(e=>t=>{"Enter"===t.key&&(t.preventDefault(),de(e,t.currentTarget.value)),"Escape"===t.key&&t.currentTarget.blur()},[de]),ge=e=>{Z(t=>t.add({months:e}).with({day:1}))},fe=e=>{Z(t=>t.add({years:e}).with({day:1}))},me=t(()=>{const e=A,t=e.dayOfWeek%7,n=e.subtract({days:t});return Array.from({length:42},(e,t)=>n.add({days:t}))},[A]),ve=S[0].toPlainDate(),ye=S[1].toPlainDate(),pe=r((e=D)=>{if(!w||!q.current)return e;const t=q.current.getBoundingClientRect(),n=E?t.width:480,r=window.innerHeight-t.bottom,a=t.top,o=window.innerWidth-t.left,i=t.right;let s=e;return s.startsWith("bottom")&&r<500&&a>r?s=s.replace("bottom","top"):s.startsWith("top")&&a<500&&r>a&&(s=s.replace("top","bottom")),s.endsWith("Left")&&o<n&&i>o?s=s.replace("Left","Right"):s.endsWith("Right")&&i<n&&o>i&&(s=s.replace("Right","Left")),s},[w,E,D]),be=r(()=>{const e=pe();U.current!==e&&(U.current=e,W(e))},[pe]),De=e=>{if(v)return;P(e);const t=S["start"===e?0:1].toPlainDate().with({day:1});Z(t);const n=pe();U.current!==n&&(U.current=n,W(n)),V(!0)};a(()=>{if(!z)return;be();const e=()=>be();return window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[z,be]);const we=d("div",{ref:_,style:(()=>{if(!q.current)return{};const e=q.current.getBoundingClientRect(),t=U.current,n={position:"fixed",zIndex:9999};return t.startsWith("bottom")?n.top=e.bottom+8:n.bottom=window.innerHeight-e.top+8,t.endsWith("Left")?n.left=e.left:n.right=window.innerWidth-e.right,E&&(n.width=`${e.width}px`),n})(),"data-rangepicker-popup":"true",children:l("div",{className:"space-y-3 rounded-xl border border-slate-200 dark:border-gray-600 bg-white dark:bg-gray-800 p-3",style:{boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",width:E?"100%":void 0},children:[l("div",{className:"flex gap-1",children:[l("div",{className:"flex-3 rounded-xl border border-slate-200 dark:border-gray-600 bg-white dark:bg-gray-800 shadow-sm w-full",children:[l("div",{className:"flex items-center justify-between border-b border-slate-100 dark:border-gray-600 px-3 py-2 text-sm font-medium text-slate-700 dark:text-gray-300",children:[l("div",{className:"flex items-center gap-1",children:[d("button",{type:"button",disabled:v,onClick:()=>fe(-1),className:"rounded-md px-2 py-1 text-slate-400 dark:text-gray-400 transition hover:text-slate-600 dark:hover:text-gray-200 disabled:opacity-40",children:d(y,{width:14,height:12})}),d("button",{type:"button",disabled:v,onClick:()=>ge(-1),className:"rounded-md px-2 py-1 text-slate-400 dark:text-gray-400 transition hover:text-slate-600 dark:hover:text-gray-200 disabled:opacity-40",children:d(g,{width:14,height:12})})]}),l("div",{className:"text-sm font-semibold text-slate-700 dark:text-gray-300",children:[Ch[A.month-1]," ",A.year]}),l("div",{className:"flex items-center gap-1",children:[d("button",{type:"button",disabled:v,onClick:()=>ge(1),className:"rounded-md px-2 py-1 text-slate-400 dark:text-gray-400 transition hover:text-slate-600 dark:hover:text-gray-200 disabled:opacity-40",children:d(f,{width:14,height:12})}),d("button",{type:"button",disabled:v,onClick:()=>fe(1),className:"rounded-md px-2 py-1 text-slate-400 dark:text-gray-400 transition hover:text-slate-600 dark:hover:text-gray-200 disabled:opacity-40",children:d(p,{width:14,height:12})})]})]}),d("div",{className:"grid grid-cols-7 gap-1 px-3 pb-3 pt-2 text-center text-[11px] uppercase tracking-wide text-slate-400 dark:text-gray-500",children:["Su","Mo","Tu","We","Th","Fr","Sa"].map(e=>d("span",{children:e},e))}),d("div",{className:"grid grid-cols-7 gap-2 px-1 ",children:me.map(e=>{const t=e.month!==A.month,n=0===kh(e,ve),r=0===kh(e,ye),a=kh(e,ve)>=0&&kh(e,ye)<=0;return d("button",{type:"button",disabled:v,onClick:()=>(e=>{if(v)return;const t=(e,t)=>{var n,r,a,o;const i=Dh(e);return ou.ZonedDateTime.from({timeZone:i,year:t.year,month:t.month,day:t.day,hour:e.hour,minute:e.minute,second:null!==(n=e.second)&&void 0!==n?n:0,millisecond:null!==(r=e.millisecond)&&void 0!==r?r:0,microsecond:null!==(a=e.microsecond)&&void 0!==a?a:0,nanosecond:null!==(o=e.nanosecond)&&void 0!==o?o:0})};if("start"===R){const n=t(S[0],e),r=S[1].epochMilliseconds-S[0].epochMilliseconds,a=n.add({milliseconds:r});return void H([n,a])}const n=t(S[1],e),r=S[1].epochMilliseconds-S[0].epochMilliseconds;if(ou.ZonedDateTime.compare(n,S[0])<0){const n=t(S[0],e),a=n.add({milliseconds:r});return void H([n,a])}const a=[S[0],n];H(a),Z(n.toPlainDate().with({day:1}))})(e),className:`flex h-9 w-9 items-center justify-center rounded-md text-sm transition ${n||r?"bg-blue-500 text-white font-semibold":a?"bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-300":t?"text-slate-300 dark:text-gray-600":"text-slate-700 dark:text-gray-300 hover:bg-blue-50 dark:hover:bg-blue-900/30 hover:text-blue-600 dark:hover:text-blue-300"}`,children:e.day},e.toString())})})]}),M&&d("div",{className:"flex flex-1 justify-end sm:w-32",children:(()=>{const e=R,t=S["start"===e?0:1],n=t.minute,r=Mh.includes(n)?Mh:[...Mh,n].sort((e,t)=>e-t);return l("div",{className:"flex flex-col rounded-xl border border-slate-200 dark:border-gray-600 bg-white dark:bg-gray-800 shadow-sm sm:w-28",children:[d("div",{className:"flex border-b border-slate-100 dark:border-gray-600 justify-center",children:l("div",{className:"text-lg py-1 text-slate-700 dark:text-gray-300",children:[t.hour.toString().padStart(2,"0"),":",t.minute.toString().padStart(2,"0")]})}),l("div",{className:"flex p-1",children:[d("div",{className:"w-14",children:d("div",{className:"h-72 overflow-y-auto rounded-md border border-slate-100 dark:border-gray-600 bg-white dark:bg-gray-700",role:"listbox","aria-label":"Hour",ref:t=>{G.current[e].hour=t},children:Eh.map(n=>{const r=n===t.hour;return d("button",{type:"button",role:"option","aria-selected":r,disabled:v,onClick:()=>ie(e,n),className:"flex h-8 w-full items-center justify-center text-sm transition "+(r?"bg-blue-500 text-white font-semibold":"text-slate-600 dark:text-gray-300 hover:bg-blue-50 dark:hover:bg-blue-900/30 hover:text-blue-600 dark:hover:text-blue-300"),"data-active":r?"true":void 0,children:mh(n)},n)})})}),d("div",{className:"w-14",children:d("div",{className:"h-72 overflow-y-auto rounded-md border border-slate-100 dark:border-gray-600 bg-white dark:bg-gray-700",role:"listbox","aria-label":"Minute",ref:t=>{G.current[e].minute=t},children:r.map(t=>{const r=t===n;return d("button",{type:"button",role:"option","aria-selected":r,disabled:v,onClick:()=>se(e,t),className:"flex h-8 w-full items-center justify-center text-sm transition "+(r?"bg-blue-500 text-white font-semibold":"text-slate-600 dark:text-gray-300 hover:bg-blue-50 dark:hover:bg-blue-900/30 hover:text-blue-600 dark:hover:text-blue-300"),"data-active":r?"true":void 0,children:mh(t)},t)})})})]})]})})()})]}),d("div",{className:"flex justify-end",children:d("button",{type:"button",onClick:()=>{X.current=!0,re(S),ae(S),V(!1)},disabled:v,className:"inline-flex items-center rounded-full bg-blue-500 px-4 py-1.5 text-sm font-semibold text-white shadow-sm transition hover:bg-blue-400 disabled:cursor-not-allowed disabled:bg-slate-300",children:"OK"})})]})});return l("div",{className:"relative max-w-[400px]",ref:q,children:[l("div",{className:"flex items-center gap-2 rounded-lg border text-sm shadow-sm transition "+(v?"cursor-not-allowed border-slate-200 dark:border-gray-600 bg-slate-50 dark:bg-gray-800 text-slate-400 dark:text-gray-500":z?"border-blue-500 bg-white dark:bg-gray-700 shadow-md":"border-slate-200 dark:border-gray-600 bg-white dark:bg-gray-700 hover:border-blue-300 dark:hover:border-blue-500"),children:[d("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:d("input",{type:"text",value:$[0],onChange:ce("start"),onFocus:()=>De("start"),onClick:()=>De("start"),onBlur:ue("start"),onKeyDown:he("start"),className:"w-full rounded-md border px-2 py-1.5 text-sm font-medium transition focus:outline-none focus:ring-0 "+(v?"cursor-not-allowed border-transparent bg-transparent text-slate-400 dark:text-gray-500":"start"===R&&z?" bg-white dark:bg-gray-700 text-blue-600 dark:text-blue-400":"border-transparent bg-transparent text-slate-700 dark:text-gray-300 hover:border-blue-200 dark:hover:border-blue-400"),placeholder:N,autoComplete:"off",disabled:v})}),d(b,{className:"text-slate-400 dark:text-gray-500"}),d("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:d("input",{type:"text",value:$[1],onChange:ce("end"),onFocus:()=>De("end"),onClick:()=>De("end"),onBlur:ue("end"),onKeyDown:he("end"),className:"w-full rounded-md border px-2 py-1.5 text-sm font-medium transition focus:outline-none focus:ring-0 "+(v?"cursor-not-allowed border-transparent bg-transparent text-slate-400 dark:text-gray-500":"end"===R&&z?"bg-white dark:bg-gray-700 text-blue-600 dark:text-blue-400":"border-transparent bg-transparent text-slate-700 dark:text-gray-300 hover:border-blue-200 dark:hover:border-blue-400"),placeholder:N,autoComplete:"off",disabled:v})})]}),z&&(x?k.createPortal(we,x()):k.createPortal(we,document.body))]})},Th=({event:e,isOpen:n,isAllDay:r,onEventUpdate:a,onEventDelete:o,onClose:i})=>{var s;const c=t(()=>A().getVisible().map(e=>({label:e.name,value:e.id})),[]),u=t(()=>lu(e.start)?e.end&&!lu(e.end)&&(e.end.timeZoneId||e.end.timeZoneId)||ou.Now.timeZoneId():e.start.timeZoneId||e.start.timeZoneId||ou.Now.timeZoneId(),[e.end,e.start]),h=t=>{const[n,r]=t;a(Object.assign(Object.assign({},e),{start:n.toPlainDate(),end:r.toPlainDate()}))};if(!n)return null;if("undefined"==typeof window||"undefined"==typeof document)return null;const g=l("div",{className:"fixed inset-0 flex items-center justify-center",style:{pointerEvents:"auto",zIndex:9998},"data-event-detail-dialog":"true",children:[d("div",{className:"absolute inset-0 bg-black/60 dark:bg-black/80",onClick:e=>{const t=e.target;t.closest("[data-rangepicker-popup]")||t===e.currentTarget&&i()}}),l("div",{className:"relative bg-white dark:bg-gray-800 shadow-2xl border border-gray-200 dark:border-gray-700 rounded-lg p-6 max-w-md w-full mx-4",children:[d("button",{onClick:i,className:"absolute top-4 right-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-200 transition","aria-label":"Close",children:d("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:d("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),l("div",{className:"pr-8",children:[d("span",{className:"block text-xs text-gray-600 dark:text-gray-300 mb-1",children:"Event Title"}),l("div",{className:"flex items-center justify-between gap-3 mb-4",children:[d("div",{className:"flex-1",children:d("input",{type:"text",value:e.title,onChange:t=>{a(Object.assign(Object.assign({},e),{title:t.target.value}))},className:"w-full border border-slate-200 dark:border-gray-600 rounded-lg px-3 py-2 text-sm text-gray-900 dark:text-gray-100 dark:bg-gray-700 shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-400 dark:focus:ring-blue-500 focus:border-blue-400 dark:focus:border-blue-500 transition"})}),d(gh,{options:c,value:e.calendarId||"blue",onChange:t=>{a(Object.assign(Object.assign({},e),{calendarId:t}))}})]}),l("div",r?{className:"mb-4",children:[d("div",{className:"text-xs text-gray-600 dark:text-gray-300 mb-1",children:"Date Range"}),d(Nh,{value:[e.start,e.end],format:"YYYY-MM-DD",showTime:!1,timeZone:u,matchTriggerWidth:!0,onChange:h,onOk:h})]}:{className:"mb-4",children:[d("div",{className:"text-xs text-gray-600 dark:text-gray-300 mb-1",children:"Time Range"}),d(Nh,{value:[e.start,e.end],timeZone:u,onChange:t=>{const[n,r]=t;a(Object.assign(Object.assign({},e),{start:n,end:r}))},onOk:t=>{const[n,r]=t;a(Object.assign(Object.assign({},e),{start:n,end:r}))}})]}),l("div",{className:"mb-4",children:[d("span",{className:"block text-xs text-gray-600 dark:text-gray-300 mb-1",children:"Note"}),d("textarea",{value:null!==(s=e.description)&&void 0!==s?s:"",onChange:t=>a(Object.assign(Object.assign({},e),{description:t.target.value})),rows:4,className:"w-full border border-slate-200 dark:border-gray-600 rounded-lg px-3 py-2 text-sm text-gray-900 dark:text-gray-100 dark:bg-gray-700 shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-400 dark:focus:ring-blue-500 focus:border-blue-400 dark:focus:border-blue-500 transition resize-none",placeholder:"Add a note..."})]}),l("div",{className:"flex space-x-2",children:[d("button",r?{className:"px-3 py-2 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-200 rounded-lg hover:bg-blue-200 dark:hover:bg-blue-800 text-sm font-medium transition",onClick:()=>{const t=lu(e.start)?e.start:e.start.toPlainDate(),n=ou.ZonedDateTime.from({year:t.year,month:t.month,day:t.day,hour:9,minute:0,timeZone:ou.Now.timeZoneId()}),r=ou.ZonedDateTime.from({year:t.year,month:t.month,day:t.day,hour:10,minute:0,timeZone:ou.Now.timeZoneId()});a(Object.assign(Object.assign({},e),{allDay:!1,start:n,end:r}))},children:"Set as Timed Event"}:{className:"px-3 py-2 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-200 rounded-lg hover:bg-blue-200 dark:hover:bg-blue-800 text-sm font-medium transition",onClick:()=>{const t=lu(e.start)?e.start:e.start.toPlainDate();a(Object.assign(Object.assign({},e),{allDay:!0,start:t,end:t}))},children:"Set as All-day"}),d("button",{className:"px-3 py-2 bg-red-100 dark:bg-red-900 text-red-700 dark:text-red-200 rounded-lg hover:bg-red-200 dark:hover:bg-red-800 text-sm font-medium transition",onClick:()=>{o(e.id),i()},children:"Delete"})]})]})]})]}),f=document.body;return f?k.createPortal(g,f):null},Ih=i(void 0),Sh=()=>"undefined"==typeof window?"light":window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",Hh=({children:e,initialTheme:t="light",onThemeChange:o})=>{const[i,s]=n(t),[l,c]=n(Sh),u="auto"===i?l:i;a(()=>{s(t)},[t]);const h=r(e=>{s(e)},[]);a(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),t=e=>{const t=e.matches?"dark":"light";c(t)},n=e.matches?"dark":"light";return c(n),e.addEventListener?e.addEventListener("change",t):e.addListener&&e.addListener(t),()=>{e.removeEventListener?e.removeEventListener("change",t):e.removeListener&&e.removeListener(t)}},[]),a(()=>{if("undefined"==typeof document)return;const e=document.documentElement;e.classList.remove("light","dark"),e.classList.add(u),e.setAttribute("data-theme",u)},[u,i,l]),a(()=>{o&&o(i,u)},[i,u,o]);const g={theme:i,effectiveTheme:u,setTheme:h};return d(Ih.Provider,{value:g,children:e})},Oh=()=>{const e=s(Ih);if(void 0===e)throw new Error("useTheme must be used within a ThemeProvider");return e},Rh=({calendar:e,className:i,style:s,customDetailPanelContent:c,customEventDetailDialog:u,meta:h})=>{var g,f;const m=e.app,v=m.getCurrentView(),y=v.component,p=m.getSidebarConfig(),b=null!==(g=null==p?void 0:p.enabled)&&void 0!==g&&g,[D,w]=n(0),[x,E]=n(null!==(f=null==p?void 0:p.initialCollapsed)&&void 0!==f&&f),[M,C]=n(()=>m.getTheme());a(()=>{var e;E(null!==(e=null==p?void 0:p.initialCollapsed)&&void 0!==e&&e)},[null==p?void 0:p.initialCollapsed]),a(()=>{const e=m.subscribeThemeChange(e=>{C(e)});return()=>{e()}},[m]);const k=r(e=>{m.setTheme(e)},[m]),N=r(()=>{w(e=>e+1)},[]),T=t(()=>m.getCalendars(),[m,D]),I=r((e,t)=>{m.setCalendarVisibility(e,t),N()},[m,N]),S=r(e=>{m.setAllCalendarsVisibility(e),N()},[m,N]),H=o(null),O=u||(m.getUseEventDetailDialog()?Th:void 0),R={app:m,config:v.config||{},customDetailPanelContent:c,customEventDetailDialog:O,switcherMode:m.state.switcherMode,calendarRef:H,meta:h},P={app:m,calendars:T,toggleCalendarVisibility:I,toggleAll:S,isCollapsed:x,setCollapsed:E},$=x?"60px":z(null==p?void 0:p.width,"240px");return d(Hh,{initialTheme:M,onThemeChange:k,children:d("div",{className:`calendar-container ${null!=i?i:""}`,style:Object.assign({height:800},s),children:l("div",{className:"flex h-full",children:[b&&d("aside",{className:"shrink-0",style:{width:$},children:b?p.render?p.render(P):d(hh,Object.assign({},P)):null}),d("div",{className:"flex flex-col flex-1 h-full",ref:H,children:d("div",{className:"calendar-renderer h-full",children:d(y,Object.assign({},R))})})]})})})},Ph=({originalComponent:e,app:n,config:a,customDetailPanelContent:o,customEventDetailDialog:i,calendarRef:s,switcherMode:l,meta:c})=>{const u=n.getPlugin("events"),h=a.enableDrag?n.getPlugin("drag"):void 0,g=n.getCurrentDate(),f=n.state.currentView,m=n.getEvents(),v=r(e=>{u?u.update(e.id,e):n.updateEvent(e.id,e)},[u,n]),y=r(e=>{u?u.delete(e):n.deleteEvent(e)},[u,n]),p=r(e=>{u?u.add(e):n.addEvent(e)},[u,n]),b=r(e=>{n.setCurrentDate(e)},[n]),D=r(e=>{n.changeView(e)},[n]),w=t(()=>{const e=a.viewConfig||{};return h&&Object.assign(e,a.dragConfig||{}),u&&Object.assign(e,a.eventsConfig||{}),e},[a,h,u]),x=t(()=>({app:n,currentDate:g,currentView:f,events:m,onEventUpdate:v,onEventDelete:y,onEventCreate:p,onDateChange:b,onViewChange:D,config:w}),[n,g,f,m,v,y,p,b,D,w]),E=t(()=>{const e={currentDate:g,events:m,setEvents:e=>{m.forEach(e=>y(e.id)),e.forEach(e=>p(e))},updateEvent:v,deleteEvent:y,addEvent:p,goToPrevious:()=>{const e=new Date(g);switch(f){case T.DAY:e.setDate(e.getDate()-1);break;case T.WEEK:e.setDate(e.getDate()-7);break;case T.MONTH:e.setMonth(e.getMonth()-1)}b(e)},goToNext:()=>{const e=new Date(g);switch(f){case T.DAY:e.setDate(e.getDate()+1);break;case T.WEEK:e.setDate(e.getDate()+7);break;case T.MONTH:e.setMonth(e.getMonth()+1)}b(e)},goToToday:()=>{b(new Date)},changeView:D,selectDate:b};return Object.assign(Object.assign({calendar:e},x),{eventsService:u,dragService:h,customDetailPanelContent:o,customEventDetailDialog:i,calendarRef:s,switcherMode:l,meta:c})},[g,m,f,v,y,p,b,D,x,u,h,o,i,s,l,c]);return d(e,Object.assign({},E))},$h=e=>{if(!e)return"";let t,n,r;e instanceof Date?(t=e.getFullYear(),n=e.getMonth()+1,r=e.getDate()):lu(e)?(t=e.year,n=e.month,r=e.day):(!function(){ou.ZonedDateTime}(e),t=e.year,n=e.month,r=e.day);const a=String(n).padStart(2,"0");return`${String(r).padStart(2,"0")}/${a}/${t}`},jh=e=>`${["January","February","March","April","May","June","July","August","September","October","November","December"][e.getMonth()]} ${e.getFullYear()}`,Yh=e=>{const t=e.year,n=e.month;return`${e.day} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][n-1]} ${t}`};function Lh(e){return!("hour"in e)}function Ah(e){return"hour"in e&&!("timeZone"in e)}function Zh(e){return"timeZone"in e}function zh(e){if(Lh(e))return new Date(e.year,e.month-1,e.day);if(Ah(e))return new Date(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);const t=e.toInstant();return new Date(t.epochMilliseconds)}function Fh(e){return ou.PlainDate.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()})}function Vh(e){return ou.PlainDateTime.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),millisecond:e.getMilliseconds()})}function Bh(e,t){return ou.ZonedDateTime.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),millisecond:e.getMilliseconds(),timeZone:t})}function Wh(e){return new Date(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond)}function Uh(e){return new Date(e.year,e.month-1,e.day)}function qh(e){if(Lh(e))return 0;return e.hour+e.minute/60}function _h(e,t){const n=Math.floor(t),r=Math.round(60*(t-n));return Zh(e),e.with({hour:n,minute:r,second:0,millisecond:0})}function Gh(e,t){const n=Lh(e)?e:(Ah(e),e.toPlainDate()),r=Lh(t)?t:(Ah(t),t.toPlainDate());return n.equals(r)}function Xh(e){return Lh(e)?e:(Ah(e),e.toPlainDate())}const Jh=(e,t,n)=>`${e} ${t} ${n.split(" ").filter(Boolean).map(e=>`dark:${e}`).join(" ")}`.trim(),Kh={container:"bg-white dark:bg-gray-900",card:"bg-white dark:bg-gray-800",sidebar:"bg-gray-50 dark:bg-gray-900",text:"text-gray-900 dark:text-gray-100",textMuted:"text-gray-500 dark:text-gray-400",textSubtle:"text-gray-600 dark:text-gray-300",textEmphasis:"text-gray-900 dark:text-white",border:"border-gray-200 dark:border-gray-700",borderLight:"border-gray-100 dark:border-gray-800",borderStrong:"border-gray-300 dark:border-gray-600",bgPrimary:"bg-white dark:bg-gray-900",bgSecondary:"bg-gray-50 dark:bg-gray-800",bgTertiary:"bg-gray-100 dark:bg-gray-700",bgMuted:"bg-gray-100 dark:bg-gray-800",hover:"hover:bg-gray-100 dark:hover:bg-gray-800",hoverSubtle:"hover:bg-gray-50 dark:hover:bg-gray-900",active:"bg-gray-200 dark:bg-gray-700",focus:"focus:ring-blue-500 dark:focus:ring-blue-400",input:"bg-white dark:bg-gray-700 border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100",inputFocus:"focus:border-blue-500 dark:focus:border-blue-400 focus:ring-blue-500 dark:focus:ring-blue-400",buttonPrimary:"bg-blue-500 dark:bg-blue-600 text-white hover:bg-blue-600 dark:hover:bg-blue-700",buttonSecondary:"bg-gray-200 dark:bg-gray-700 text-gray-900 dark:text-gray-100 hover:bg-gray-300 dark:hover:bg-gray-600",buttonDanger:"bg-red-100 dark:bg-red-900 text-red-700 dark:text-red-200 hover:bg-red-200 dark:hover:bg-red-800",buttonSuccess:"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-200 hover:bg-blue-200 dark:hover:bg-blue-800",shadow:"shadow-sm dark:shadow-gray-900/50",shadowMd:"shadow-md dark:shadow-gray-900/50",shadowLg:"shadow-lg dark:shadow-gray-900/50",divider:"border-gray-200 dark:border-gray-700"},Qh=(e,t,n)=>e?t:n,eg=(...e)=>e.filter(Boolean).join(" ");function tg(e,t=!1){if(e instanceof ou.PlainDate||e instanceof ou.PlainDateTime)return e;if(e instanceof Date)return t?Fh(e):Vh(e);throw new Error("Invalid time type: "+typeof e)}function ng(e,t){if(e instanceof ou.ZonedDateTime)return e;if(e instanceof Date)return Bh(e,t);throw new Error("Invalid time type: "+typeof e)}function rg(e){var t;const n=tg(e.start,e.allDay),r=tg(e.end,e.allDay);return{id:e.id,title:e.title,description:e.description,start:n,end:r,allDay:null!==(t=e.allDay)&&void 0!==t&&t,calendarId:e.calendarId,meta:e.meta}}function ag(e){const t=ng(e.start,e.timeZone),n=ng(e.end,e.timeZone);return{id:e.id,title:e.title,description:e.description,start:t,end:n,allDay:!1,calendarId:e.calendarId,meta:e.meta}}function og(e){return e.map(e=>rg(e))}function ig(e){return e.map(e=>ag(e))}function sg(e,t,n,r){return rg(Object.assign({id:e,title:t,start:n,end:n,allDay:!0},r))}function lg(e,t,n,r,a){return rg(Object.assign({id:e,title:t,start:n,end:r},a))}function dg(e,t,n,r,a=!1,o){return rg(Object.assign({id:e,title:t,start:n,end:r,allDay:a},o))}function cg(e,t,n,r,a,o){return ag(Object.assign({id:e,title:t,start:n,end:r,timeZone:a},o))}const ug=e=>{const t=e.title.toLowerCase();return t.includes("holiday")||t.includes("vacation")||t.includes("假期")?d(D,{className:"h-3 w-3"}):t.includes("birthday")||t.includes("anniversary")||t.includes("生日")?d(w,{className:"h-3 w-3"}):t.includes("conference")||t.includes("meeting")||t.includes("会议")||t.includes("研讨")?d(x,{className:"h-3 w-3"}):t.includes("trip")||t.includes("travel")||t.includes("旅行")?d(E,{className:"h-3 w-3"}):d(M,{className:"h-3 w-3"})},hg=(e,t)=>{const n=[],r=new Date(t);return r.setDate(t.getDate()+6),r.setHours(23,59,59,999),e.forEach(e=>{const a=gu(e.start),o=gu(e.end),i=new Date(a);i.setHours(0,0,0,0);const s=new Date(o);s.setHours(0,0,0,0);let l=new Date(s);if(!e.allDay){if(!(0!==o.getHours()||0!==o.getMinutes()||0!==o.getSeconds())){const e=o.getTime()-a.getTime();e>0&&e<864e5&&(l=new Date(s),l.setDate(l.getDate()-1))}}const d=Du(i,l)>0;if(!d&&e.allDay){if(i<t||i>r)return;const a=Math.floor((i.getTime()-t.getTime())/864e5);return void(a>=0&&a<=6&&n.push({id:`${e.id}-week-${t.getTime()}`,originalEventId:e.id,event:e,startDayIndex:a,endDayIndex:a,segmentType:"single",totalDays:1,segmentIndex:0,isFirstSegment:!0,isLastSegment:!0}))}if(!d)return;const c=i;let u;if(e.allDay)u=new Date(s),u.setHours(23,59,59,999);else{0!==o.getHours()||0!==o.getMinutes()||0!==o.getSeconds()?(u=new Date(s),u.setHours(23,59,59,999)):(u=new Date(s),u.setTime(u.getTime()-1))}if(u<t||c>r)return;const h=c<t?t:c,g=u>r?r:u,f=Math.max(0,Math.floor((h.getTime()-t.getTime())/864e5)),m=Math.min(6,Math.floor((g.getTime()-t.getTime())/864e5)),v=c>=t,y=u<=r,p=0===f||6===m;let b;b=v&&y?"single":v?p&&6===m?"start-week-end":"start":y?p&&0===f?"end-week-start":"end":"middle";const D=Du(c,u)+1;n.push({id:`${e.id}-week-${t.getTime()}`,originalEventId:e.id,event:e,startDayIndex:f,endDayIndex:m,segmentType:b,totalDays:D,segmentIndex:0,isFirstSegment:v,isLastSegment:y})}),n},gg=(e,t)=>{if(e.allDay)return[];const n=gu(e.start),r=gu(e.end),a=new Date(n);a.setHours(0,0,0,0);const o=new Date(r);o.setHours(0,0,0,0);const i=Du(a,o);if(0===i)return[];const s=0!==r.getHours()||0!==r.getMinutes()||0!==r.getSeconds()||0!==r.getMilliseconds(),l=r.getTime()-n.getTime();if(!e.allDay&&1===i&&!s&&l<864e5)return[];const d=s?i:Math.max(0,i-1),c=[];for(let e=0;e<=d;e++){const o=new Date(a);o.setDate(a.getDate()+e);const i=Math.floor((o.getTime()-t.getTime())/864e5);if(i<0||i>6)continue;const l=0===e,u=e===d,h=l?n.getHours()+n.getMinutes()/60:0,g=u&&s?r.getHours()+r.getMinutes()/60:24;c.push({dayIndex:i,startHour:h,endHour:g,isFirst:l,isLast:u})}return c},fg=e.memo(({segment:e,segmentIndex:t,isDragging:n,isResizing:r=!1,isSelected:a=!1,onMoveStart:o,onResizeStart:i})=>{const s=17*t,c=`calc(${e.startDayIndex/7*100}% + 2px)`,u=`calc(${(e.endDayIndex-e.startDayIndex+1)/7*100}% - 4px)`,h=t=>{const n="left"===t;return(n?e.isFirstSegment:e.isLastSegment)&&i?d("div",{className:`resize-handle absolute ${n?"left-0":"right-0"} top-0 bottom-0 w-1 cursor-ew-resize opacity-0 group-hover:opacity-100 transition-opacity z-20`,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),i(t,e.event,n?"left":"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}}):null},g=e.event.calendarId||"blue",f=e.endDayIndex-e.startDayIndex+1;return l("div",{className:"absolute px-1 text-xs select-none flex items-center transition-all duration-200 hover:shadow-sm dark:hover:shadow-lg dark:hover:shadow-black/20 group",style:Object.assign({left:c,width:u,top:s-2+"px",height:"16px",borderRadius:(m=e.segmentType,{single:"0.25rem",start:"0.25rem 0 0 0.25rem","start-week-end":"0.25rem 0 0 0.25rem",end:"0 0.25rem 0.25rem 0","end-week-start":"0 0.25rem 0.25rem 0",middle:"0"}[m]),pointerEvents:"auto",zIndex:10},a||n?{backgroundColor:Ou(g),color:"#fff"}:{backgroundColor:Su(g),color:Hu(g)}),"data-segment-days":f,onMouseDown:t=>{t.preventDefault(),t.stopPropagation();t.target.closest(".resize-handle")||o(t,e.event)},title:`${e.event.title} (${$h(e.event.start)} - ${$h(e.event.end)})`,children:[h("left"),d("div",{className:"flex-1 min-w-0",style:{cursor:r?"ew-resize":"pointer"},children:(()=>{const t=e.event.allDay,n=e.event.calendarId||"blue",r=Mu(e.event.start),a=Lu(e.event),o=$u(r),i=$u(a);if(t){const t=()=>e.isFirstSegment?e.event.title:"middle"===e.segmentType||e.isLastSegment&&e.totalDays>1?"···":e.event.title;return l("div",{className:"flex items-center min-w-0 w-full pointer-events-auto",children:[e.isFirstSegment&&d("div",{className:"flex-shrink-0 mr-1",children:d("div",{className:"rounded-full p-0.5 text-white flex items-center justify-center",style:{backgroundColor:Ru(n),width:"12px",height:"12px"},children:ug(e.event)})}),d("div",{className:"flex-1 min-w-0",children:d("div",{className:"truncate font-medium text-xs",children:t()})}),e.isLastSegment&&"single"!==e.segmentType&&d("div",{className:"flex-shrink-0 ml-1 text-white/80 dark:text-white/90",children:d("div",{className:"w-1.5 h-1.5 rounded-full bg-white/60 dark:bg-white/80"})})]})}const s=e.isFirstSegment||e.isLastSegment?e.event.title:"···",c=e.endDayIndex-e.startDayIndex+1,u=c>1?{position:"absolute",right:`calc(${c>1?(c-1)/c*100:0}% + 2px)`,top:"50%",transform:"translateY(-50%)"}:void 0;return l("div",{className:"relative flex items-center min-w-0 w-full pointer-events-auto",children:[d("span",{className:"inline-block w-[3px] h-3 rounded-full flex-shrink-0 mr-1",style:{backgroundColor:Ru(n)}}),d("div",{className:"flex items-center min-w-0 flex-1",children:d("span",{className:"truncate font-medium text-xs",children:s})}),e.isFirstSegment&&d("span",{className:"text-xs font-medium whitespace-nowrap "+(1===c?"ml-2":""),style:u,children:o}),e.isLastSegment&&!e.event.allDay&&24!==a&&d("span",{className:"text-xs font-medium whitespace-nowrap ml-auto",children:`ends ${i}`})]})})()}),h("right")]});var m});fg.displayName="MultiDayEvent";const mg=({event:e,position:n,panelRef:r,isAllDay:a,eventVisibility:o,calendarRef:i,selectedEventElementRef:s,onEventUpdate:c,onEventDelete:u})=>{var h;const{effectiveTheme:g}=Oh(),f="dark"===g?"#1f2937":"white",m="dark"===g?"rgb(55, 65, 81)":"rgb(229, 231, 235)",v=t(()=>A().getVisible().map(e=>({label:e.name,value:e.id})),[]),y=t(()=>lu(e.start)?e.end&&!lu(e.end)&&(e.end.timeZoneId||e.end.timeZoneId)||ou.Now.timeZoneId():e.start.timeZoneId||e.start.timeZoneId||ou.Now.timeZoneId(),[e.end,e.start]),p=t=>{const[n,r]=t;c(Object.assign(Object.assign({},e),{start:n.toPlainDate(),end:r.toPlainDate()}))},b=(()=>{var e;let t={};if("sticky-top"===o){const r=null===(e=i.current)||void 0===e?void 0:e.querySelector(".calendar-content");if(r){const e=r.getBoundingClientRect().top+3-n.top;t=Object.assign({position:"absolute",width:"12px",height:"12px",backgroundColor:f,transform:"rotate(45deg)",transformOrigin:"center",top:e-6+"px",borderRight:""+(n.isSunday?`1px solid ${m}`:"none"),borderTop:""+(n.isSunday?`1px solid ${m}`:"none"),borderLeft:""+(n.isSunday?"none":`1px solid ${m}`),borderBottom:""+(n.isSunday?"none":`1px solid ${m}`)},n.isSunday?{right:"-6px"}:{left:"-6px"})}}else if("sticky-bottom"===o){const e=r.current;let a=200;if(e){const t=e.getBoundingClientRect(),n=window.getComputedStyle(e),r=parseInt(n.paddingBottom,10)||0,o=parseInt(n.borderBottomWidth,10)||0;a=t.height-r-o-6+11}t={position:"absolute",width:"12px",height:"12px",backgroundColor:f,transform:"rotate(45deg)",transformOrigin:"center",top:`${a}px`,left:n.isSunday?void 0:"-6px",right:n.isSunday?"-6px":void 0,borderRight:""+(n.isSunday?`1px solid ${m}`:"none"),borderTop:""+(n.isSunday?`1px solid ${m}`:"none"),borderLeft:""+(n.isSunday?"none":`1px solid ${m}`),borderBottom:""+(n.isSunday?"none":`1px solid ${m}`)}}else if(n&&s.current&&i.current){const e=s.current.getBoundingClientRect(),a=i.current.querySelector(".calendar-content");if(a){const o=a.getBoundingClientRect(),i=Math.max(e.top,o.top),s=Math.min(e.bottom,o.bottom),l=Math.max(0,s-i);let d;d=l===e.height?e.top+e.height/2:l>0?i+l/2:e.top+e.height/2;const c=d-n.top,u=r.current;let h=228;if(u){const e=u.getBoundingClientRect(),t=window.getComputedStyle(u),n=parseInt(t.paddingBottom,10)||0,r=parseInt(t.borderBottomWidth,10)||0;h=e.height-n-r+11}const g=12,v=Math.max(g,Math.min(h,c));t=Object.assign({position:"absolute",width:"12px",height:"12px",backgroundColor:f,transform:"rotate(45deg)",transformOrigin:"center",top:v-6+"px",borderRight:""+(n.isSunday?`1px solid ${m}`:"none"),borderTop:""+(n.isSunday?`1px solid ${m}`:"none"),borderLeft:""+(n.isSunday?"none":`1px solid ${m}`),borderBottom:""+(n.isSunday?"none":`1px solid ${m}`)},n.isSunday?{right:"-6px"}:{left:"-6px"})}}return t})(),D=l("div",{ref:r,className:"fixed bg-white dark:bg-gray-800 shadow-lg border border-gray-200 dark:border-gray-700 rounded-lg p-4 ","data-event-detail-panel":"true",style:{top:`${n.top}px`,left:`${n.left}px`,zIndex:9999,pointerEvents:"auto"},children:[d("div",{style:b}),d("span",{className:"block text-xs text-gray-600 dark:text-gray-300 mb-1",children:"Event Title"}),l("div",{className:"flex items-center justify-between gap-3 mb-3",children:[d("div",{className:"flex-1",children:d("input",{type:"text",value:e.title,onChange:t=>{c(Object.assign(Object.assign({},e),{title:t.target.value}))},className:"w-full border border-slate-200 dark:border-gray-600 rounded-lg px-3 py-1.5 text-sm text-gray-900 dark:text-gray-100 dark:bg-gray-700 shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-400 dark:focus:ring-blue-500 focus:border-blue-400 dark:focus:border-blue-500 transition"})}),d(gh,{options:v,value:e.calendarId||"blue",onChange:t=>{c(Object.assign(Object.assign({},e),{calendarId:t}))}})]}),l("div",a?{className:"mb-3",children:[d("div",{className:"text-xs text-gray-600 dark:text-gray-300 mb-1",children:"Date Range"}),d(Nh,{value:[e.start,e.end],format:"YYYY-MM-DD",showTime:!1,timeZone:y,matchTriggerWidth:!0,onChange:p,onOk:p})]}:{className:"mb-3",children:[d("div",{className:"text-xs text-gray-600 dark:text-gray-300 mb-1",children:"Time Range"}),d(Nh,{value:[e.start,e.end],timeZone:y,onChange:t=>{const[n,r]=t;c(Object.assign(Object.assign({},e),{start:n,end:r}))},onOk:t=>{const[n,r]=t;c(Object.assign(Object.assign({},e),{start:n,end:r}))}})]}),l("div",{className:"mb-3",children:[d("span",{className:"block text-xs text-gray-600 dark:text-gray-300 mb-1",children:"Note"}),d("textarea",{value:null!==(h=e.description)&&void 0!==h?h:"",onChange:t=>c(Object.assign(Object.assign({},e),{description:t.target.value})),rows:3,className:"w-full border border-slate-200 dark:border-gray-600 rounded-lg px-3 py-2 text-sm text-gray-900 dark:text-gray-100 dark:bg-gray-700 shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-400 dark:focus:ring-blue-500 focus:border-blue-400 dark:focus:border-blue-500 transition resize-none",placeholder:"Add a note..."})]}),l("div",{className:"flex space-x-2",children:[d("button",a?{className:"px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-200 rounded hover:bg-blue-200 dark:hover:bg-blue-800 text-xs font-medium transition",onClick:()=>{const t=lu(e.start)?e.start:e.start.toPlainDate(),n=ou.ZonedDateTime.from({year:t.year,month:t.month,day:t.day,hour:9,minute:0,timeZone:ou.Now.timeZoneId()}),r=ou.ZonedDateTime.from({year:t.year,month:t.month,day:t.day,hour:10,minute:0,timeZone:ou.Now.timeZoneId()});c(Object.assign(Object.assign({},e),{allDay:!1,start:n,end:r}))},children:"Set as Timed Event"}:{className:"px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-200 rounded hover:bg-blue-200 dark:hover:bg-blue-800 text-xs font-medium transition",onClick:()=>{const t=lu(e.start)?e.start:e.start.toPlainDate();c(Object.assign(Object.assign({},e),{allDay:!0,start:t,end:t}))},children:"Set as All-day"}),d("button",{className:"px-2 py-1 bg-red-100 dark:bg-red-900 text-red-700 dark:text-red-200 rounded hover:bg-red-200 dark:hover:bg-red-800 text-xs font-medium transition",onClick:()=>u(e.id),children:"Delete"})]})]});if("undefined"==typeof window||"undefined"==typeof document)return null;const w=document.body;return w?k.createPortal(D,w):null},vg=({event:e,position:t,panelRef:n,isAllDay:r,eventVisibility:a,calendarRef:o,selectedEventElementRef:i,onEventUpdate:s,onEventDelete:c,onClose:u,contentRenderer:h})=>{const{effectiveTheme:g}=Oh(),f="dark"===g?"#1f2937":"white",m="dark"===g?"rgb(55, 65, 81)":"rgb(229, 231, 235)",v=(()=>{var e;let r={};if("sticky-top"===a){const n=null===(e=o.current)||void 0===e?void 0:e.querySelector(".calendar-content");if(n){const e=n.getBoundingClientRect().top+3-t.top;r=Object.assign({position:"absolute",width:"12px",height:"12px",backgroundColor:f,transform:"rotate(45deg)",transformOrigin:"center",top:e-6+"px",borderRight:""+(t.isSunday?`1px solid ${m}`:"none"),borderTop:""+(t.isSunday?`1px solid ${m}`:"none"),borderLeft:""+(t.isSunday?"none":`1px solid ${m}`),borderBottom:""+(t.isSunday?"none":`1px solid ${m}`)},t.isSunday?{right:"-6px"}:{left:"-6px"})}}else if("sticky-bottom"===a){const e=n.current;let a=200;if(e){const t=e.getBoundingClientRect(),n=window.getComputedStyle(e),r=parseInt(n.paddingBottom,10)||0,o=parseInt(n.borderBottomWidth,10)||0;a=t.height-r-o-6+11}r={position:"absolute",width:"12px",height:"12px",backgroundColor:f,transform:"rotate(45deg)",transformOrigin:"center",top:`${a}px`,left:t.isSunday?void 0:"-6px",right:t.isSunday?"-6px":void 0,borderRight:""+(t.isSunday?`1px solid ${m}`:"none"),borderTop:""+(t.isSunday?`1px solid ${m}`:"none"),borderLeft:""+(t.isSunday?"none":`1px solid ${m}`),borderBottom:""+(t.isSunday?"none":`1px solid ${m}`)}}else if(t&&i.current&&o.current){const e=i.current.getBoundingClientRect(),a=o.current.querySelector(".calendar-content");if(a){const o=a.getBoundingClientRect(),i=Math.max(e.top,o.top),s=Math.min(e.bottom,o.bottom),l=Math.max(0,s-i);let d;d=l===e.height?e.top+e.height/2:l>0?i+l/2:e.top+e.height/2;const c=d-t.top,u=n.current;let h=228;if(u){const e=u.getBoundingClientRect(),t=window.getComputedStyle(u),n=parseInt(t.paddingBottom,10)||0,r=parseInt(t.borderBottomWidth,10)||0;h=e.height-n-r+11}const g=12,v=Math.max(g,Math.min(h,c));r=Object.assign({position:"absolute",width:"12px",height:"12px",backgroundColor:f,transform:"rotate(45deg)",transformOrigin:"center",top:v-6+"px",borderRight:""+(t.isSunday?`1px solid ${m}`:"none"),borderTop:""+(t.isSunday?`1px solid ${m}`:"none"),borderLeft:""+(t.isSunday?"none":`1px solid ${m}`),borderBottom:""+(t.isSunday?"none":`1px solid ${m}`)},t.isSunday?{right:"-6px"}:{left:"-6px"})}}return r})(),y=l("div",{ref:n,className:"fixed bg-white dark:bg-gray-800 shadow-lg border border-gray-200 dark:border-gray-700 rounded-lg p-3","data-event-detail-panel":"true",style:{top:`${t.top}px`,left:`${t.left}px`,zIndex:9999,pointerEvents:"auto",backgroundColor:"dark"===g?"#1f2937":"#ffffff"},children:[d("div",{style:v}),d(h,{event:e,isAllDay:r,onEventUpdate:s,onEventDelete:c,onClose:u})]});return k.createPortal(y,document.body)},yg=({event:e,layout:t,isAllDay:i=!1,allDayHeight:s=28,calendarRef:u,isBeingDragged:h=!1,isBeingResized:g=!1,isDayView:f=!1,isMonthView:m=!1,isMultiDay:v=!1,segment:y,segmentIndex:p=0,hourHeight:b,firstHour:D,selectedEventId:w,detailPanelEventId:x,onMoveStart:E,onResizeStart:C,onEventUpdate:N,onEventDelete:T,newlyCreatedEventId:I,onDetailPanelOpen:S,onEventSelect:H,onDetailPanelToggle:O,customDetailPanelContent:R,customEventDetailDialog:P,multiDaySegmentInfo:$})=>{const[j,Y]=n(!1),L=v&&y?`${e.id}::${y.id}`:void 0!==(null==$?void 0:$.dayIndex)?`${e.id}::day-${$.dayIndex}`:e.id,A=x===L,[Z,z]=n(null),[F,V]=n("visible"),B=o(null),W=o(null),U=o(null),q=o(null),_=void 0!==w?w===e.id:j,G=e=>{if(!u.current)return null;const t=u.current.getBoundingClientRect();if(m){const n=t.width/7,r=e-t.left,a=Math.floor(r/n);return Number.isFinite(a)?Math.max(0,Math.min(6,a)):null}const n=f?1:7,r=(t.width-80)/n,a=e-t.left-80,o=Math.floor(a/r);return Number.isFinite(o)?Math.max(0,Math.min(n-1,o)):null},X=e=>{if(!u.current)return null;const t=u.current.getBoundingClientRect();if(m){const n=t.width/7;return{left:t.left+e*n,width:n}}if(f){const e=t.width-80;return{left:t.left+80,width:e}}const n=(t.width-80)/7;return{left:t.left+80+e*n,width:n}},J=e=>{q.current=e},K=()=>{var t;if(null!==q.current)return q.current;if(x===L){const e=L.split("::"),t=e[e.length-1];if(t.startsWith("day-")){const e=Number(t.replace("day-",""));if(!Number.isNaN(e))return e}}return void 0!==(null==$?void 0:$.dayIndex)?$.dayIndex:y?y.startDayIndex:null!==(t=e.day)&&void 0!==t?t:0},Q=r(()=>{if(!U.current||!u.current||!W.current)return;const t=u.current.getBoundingClientRect(),n=K(),r=X(n);let a,o;if(r)a=r.left,o=r.width;else if(m)o=t.width/7,a=t.left+n*o;else{const e=80;o=(t.width-e)/7,a=t.left+e+n*o}const i=Math.min(window.innerWidth,t.right),s=Math.min(window.innerHeight,t.bottom);requestAnimationFrame(()=>{var r,o,l,d,c;if(!W.current)return;if(!U.current)return;const h=W.current.getBoundingClientRect(),g=h.width,p=h.height;let w,x,E;if("sticky-top"===F||"sticky-bottom"===F){const t=null===(r=u.current)||void 0===r?void 0:r.querySelector(".calendar-content");if(!t)return;const n=$?$.startHour:Mu(e.start),a=$?$.endHour:Lu(e),i=(n-D)*b,s=Math.max((a-n)*b,b/4),l=t.getBoundingClientRect(),d=t.scrollTop,c=l.top+i-d,h=null===(o=B.current)||void 0===o?void 0:o.getBoundingClientRect();if(!h)return;E={top:c,bottom:c+s,left:h.left,right:h.right,width:h.width,height:s,x:h.x,y:c,toJSON:()=>({})}}else E=U.current.getBoundingClientRect();if(m&&v&&y){const e=X(n),r=null!==(l=null==e?void 0:e.width)&&void 0!==l?l:t.width/7,a=null!==(d=null==e?void 0:e.left)&&void 0!==d?d:t.left+n*r,o=a+r;E={top:E.top,bottom:E.bottom,left:a,right:o,width:o-a,height:E.height,x:a,y:E.top,toJSON:()=>({})}}if(("sticky-top"===F||"sticky-bottom"===F)&&!m){const e=null!==(c=null==$?void 0:$.dayIndex)&&void 0!==c?c:K(),n=80,r=f?1:7,a=(t.width-n)/r,o=X(e),i=o?o.left:t.left+n+e*a,s=o?o.width:a,l=Math.max(0,f?E.width:s-3),d=f?E.left:i;E=Object.assign(Object.assign({},E),{left:d,right:d+l,width:l})}const M=i-E.right,C=E.left-t.left;w=M>=g+20?E.right+10:C>=g+20?E.left-g-10:M>C?Math.max(t.left+10,i-g-10):t.left+10;const k=E.top-p/2+E.height/2,N=Math.max(10,t.top+10),T=s-10;x=k<N?N:k+p>T?T-p:k,z(e=>e?Object.assign(Object.assign({},e),{top:x,left:w,isSunday:w<a}):null)})},[u,e.day,e.start,e.end,F,m,D,b,v,null==y?void 0:y.startDayIndex,null==y?void 0:y.endDayIndex,null==$?void 0:$.dayIndex,x,L]),ee=r(()=>{if(!j||!A||!B.current||!u.current||i||m)return;const t=u.current.querySelector(".calendar-content");if(!t)return;const n=$?$.startHour:Mu(e.start),r=$?$.endHour:Lu(e),a=(n-D)*b,o=a+Math.max((r-n)*b,b/4),s=t.getBoundingClientRect(),l=t.scrollTop;let d=o<l+6,c=a>l+s.height-6;const h=s.bottom<0,g=s.top>window.innerHeight;h?d=!0:g&&(c=!0),V(d?"sticky-top":c?"sticky-bottom":"visible"),Q()},[j,A,u,i,m,Mu(e.start),Lu(e),D,b,Q,null==$?void 0:$.startHour,null==$?void 0:$.endHour,null==$?void 0:$.dayIndex,x,L]);a(()=>{var e,t;if(!j||!A||i)return;const n=null===(e=u.current)||void 0===e?void 0:e.querySelector(".calendar-content");if(!n)return;const r=()=>ee(),a=()=>{ee(),Q()},o=[n];let s=null===(t=u.current)||void 0===t?void 0:t.parentElement;for(;s;){const e=window.getComputedStyle(s),t=e.overflowY,n=e.overflowX;"auto"!==t&&"scroll"!==t&&"auto"!==n&&"scroll"!==n||o.push(s),s=s.parentElement}return o.forEach(e=>{e.addEventListener("scroll",r)}),window.addEventListener("scroll",r,!0),window.addEventListener("resize",a),ee(),()=>{o.forEach(e=>{e.removeEventListener("scroll",r)}),window.removeEventListener("scroll",r,!0),window.removeEventListener("resize",a)}},[j,A,i,ee,Q,u,F]),a(()=>{if(!_&&!A)return;const e=e=>{var t,n;const r=e.target,a=null===(t=B.current)||void 0===t?void 0:t.contains(r),o=null===(n=W.current)||void 0===n?void 0:n.contains(r),i=r.closest("[data-event-detail-dialog]"),s=r.closest("[data-rangepicker-popup]");A?a||o||i||s||(H&&H(null),J(null),Y(!1),null==O||O(null)):_&&!a&&(H&&H(null),J(null),Y(!1),null==O||O(null))};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[_,A,H,O]),a(()=>{v&&y&&!y.isFirstSegment||I!==e.id||A||setTimeout(()=>{var t,n;if(B.current){let r=B.current;if(v){const e=B.current.querySelector("div");e&&(r=e)}v?y?J(y.startDayIndex):void 0!==(null==$?void 0:$.dayIndex)?J($.dayIndex):J(null!==(t=e.day)&&void 0!==t?t:null):J(null!==(n=e.day)&&void 0!==n?n:null),U.current=r,Y(!0),null==O||O(L),z({top:-9999,left:-9999,eventHeight:0,eventMiddleY:0,isSunday:!1}),requestAnimationFrame(()=>{Q()})}null==S||S()},150)},[I,e.id,A,S,Q,v,y,O,L]);const te=()=>y?d(fg,{segment:y,segmentIndex:null!=p?p:0,isDragging:h||_,isResizing:g,isSelected:_,onMoveStart:E||(()=>{}),onResizeStart:C}):null,le=()=>{if(v&&y){const{segmentType:e}=y;if("single"===e||"start"===e)return re;if("start-week-end"===e)return"rounded-l-xl rounded-r-none my-0.5";if("end"===e||"end-week-start"===e)return"rounded-r-xl rounded-l-none my-0.5";if("middle"===e)return"rounded-none my-0.5"}return re},de=e.calendarId||"blue";return l(c,{children:[d("div",{ref:B,"data-event-id":e.id,className:m?`\n ${ne}\n ${i?le():"rounded-sm"}\n `:`\n ${ne}\n shadow-sm\n ${i?le():"rounded-sm"}\n `,style:Object.assign(Object.assign({},(()=>{var n,r,a,o,l,d;if(m)return{opacity:h?.3:1,zIndex:_||A?1e3:1};if(i){const e={height:s-4+"px",opacity:h?.3:1,zIndex:_||A?1e3:1},t=p*s;if(Object.assign(e,{top:`${t}px`}),f)Object.assign(e,{width:"100%",left:"0px",right:"2px"});else if(v&&y){const t=(y.endDayIndex-y.startDayIndex+1)/7*100,n=y.startDayIndex/7*100,r=2,a=y.isFirstSegment?r:0,o=a+(y.isLastSegment?r:0);Object.assign(e,{width:o>0?`calc(${t}% - ${o}px)`:`${t}%`,left:a>0?`calc(${n}% + ${a}px)`:`${n}%`,position:"absolute",pointerEvents:"auto"})}else Object.assign(e,{width:"calc(100% - 3px)",left:"0px",position:"relative"});return e}const c=$?$.startHour:Mu(e.start),g=$?$.endHour:Lu(e),w={top:`${(c-D)*b+3}px`,height:Math.max((g-c)*b,b/4)-4+"px",position:"absolute",opacity:h?.3:1,zIndex:_||A?1e3:null!==(n=null==t?void 0:t.zIndex)&&void 0!==n?n:1};if(_&&A&&("sticky-top"===F||"sticky-bottom"===F)){const e=null===(r=u.current)||void 0===r?void 0:r.getBoundingClientRect();if(e){const t=null!==(a=null==$?void 0:$.dayIndex)&&void 0!==a?a:K(),n=80,r=f?1:7;let i=(e.width-n)/r,s=e.left+n+t*i;m&&(i=e.width/7,s=e.left+t*i);const c=X(t);c&&(s=c.left,i=c.width);let h=null===(o=u.current)||void 0===o?void 0:o.querySelector(".calendar-content");h||(h=null===(l=u.current)||void 0===l?void 0:l.querySelector(".calendar-renderer"));const g=null==h?void 0:h.getBoundingClientRect(),v=null===(d=B.current)||void 0===d?void 0:d.getBoundingClientRect(),y=null==v?void 0:v.left,p=null==v?void 0:v.width;if("sticky-top"===F){let t=g?g.top:e.top;return t=Math.max(t,0),t=Math.max(t,e.top),t=Math.min(t,e.bottom-6),t=Math.min(t,window.innerHeight-6),{position:"fixed",top:`${t}px`,left:`${f?y:s}px`,width:`${f?p:i-3}px`,height:"6px",zIndex:1e3,overflow:"hidden"}}let b=g?g.bottom:e.bottom;return b=Math.min(b,window.innerHeight),b=Math.min(b,e.bottom),b=Math.max(b,e.top+6),b=Math.max(b,6),{position:"fixed",top:b-6+"px",left:`${f?y:s}px`,width:`${f?p:i-3}px`,height:"6px",zIndex:1e3,overflow:"hidden"}}}return t&&!i?Object.assign(Object.assign({},w),{left:`${t.left}%`,width:t.width-1+"%",right:"auto"}):Object.assign(Object.assign({},w),{left:"0px",right:"3px"})})()),_?{backgroundColor:Ou(de),color:"#fff"}:{backgroundColor:Su(de),color:Hu(de)}),onClick:t=>{var n,r;if(t.preventDefault(),t.stopPropagation(),v)if(y){const e=G(t.clientX);if(null!==e){const t=Math.min(Math.max(e,y.startDayIndex),y.endDayIndex);J(t)}else J(y.startDayIndex)}else void 0!==(null==$?void 0:$.dayIndex)?J($.dayIndex):J(null!==(n=e.day)&&void 0!==n?n:null);else J(null!==(r=e.day)&&void 0!==r?r:null);H?H(e.id):Y(!0),null==O||O(null),z(null)},onDoubleClick:t=>{var n,r;t.preventDefault(),t.stopPropagation();let a=t.currentTarget;if(v){const e=a.querySelector("div");e&&(a=e)}if(U.current=a,v)if(y){const e=G(t.clientX);if(null!==e){const t=Math.min(Math.max(e,y.startDayIndex),y.endDayIndex);J(t)}else J(y.startDayIndex)}else void 0!==(null==$?void 0:$.dayIndex)?J($.dayIndex):J(null!==(n=e.day)&&void 0!==n?n:null);else J(null!==(r=e.day)&&void 0!==r?r:null);new Promise(t=>{if(!u.current||i||m)return void t();const n=u.current.querySelector(".calendar-content");if(!n)return void t();const r=$?$.startHour:Mu(e.start),a=$?$.endHour:Lu(e),o=(r-D)*b,s=o+Math.max((a-r)*b,b/4),l=n.scrollTop,d=n.clientHeight;if(o>=l&&s<=l+d)return void t();const c=((r+a)/2-D)*b-d/2,h=n.scrollHeight-d,g=Math.max(0,Math.min(h,c));n.scrollTo({top:g,behavior:"smooth"}),setTimeout(()=>{t()},300)}).then(()=>{Y(!0),null==O||O(L),z({top:-9999,left:-9999,eventHeight:0,eventMiddleY:0,isSunday:!1}),requestAnimationFrame(()=>{Q()})})},onMouseDown:E?t=>{var n;if($){const r=Object.assign(Object.assign({},e),{day:null!==(n=$.dayIndex)&&void 0!==n?n:e.day,_segmentInfo:$});E(t,r)}else E(t,e)}:void 0,children:m?v&&y?te():e.allDay?v?te():l("div",{className:"text-xs px-1 mb-0.5 rounded truncate cursor-pointer flex items-center",children:[e.title.toLowerCase().includes("easter")||e.title.toLowerCase().includes("holiday")?d("span",{className:`inline-block ${be} flex-shrink-0 ${_?"text-yellow-200":"text-yellow-600"}`,children:"⭐"}):d(M,{className:`${ie} ${_?"text-white":""}`}),d("span",{className:"truncate "+(_?"text-white":""),children:e.title})]}):(()=>{const t=`${Math.floor(Mu(e.start)).toString().padStart(2,"0")}:${Math.round(Mu(e.start)%1*60).toString().padStart(2,"0")}`;return l("div",{className:"text-xs mb-0.5 cursor-pointer flex items-center justify-between",children:[l("div",{className:"flex items-center flex-1 min-w-0",children:[d("span",{style:{backgroundColor:Ru(e.calendarId||"blue")},className:`inline-block w-[3px] h-3 ${be} flex-shrink-0 rounded-full`}),d("span",{className:"truncate "+(_?"text-white":""),children:e.title})]}),d("span",{className:`${ve} ml-1 flex-shrink-0 ${_?"text-white":""}`,style:_?void 0:{opacity:.8},children:t})]})})():e.allDay?l("div",{className:"h-full flex items-center overflow-hidden pl-3 px-1 py-0 relative group",children:[C&&d("div",{className:"resize-handle absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize opacity-0 group-hover:opacity-100 transition-opacity z-20",onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),C(t,e,"left")},onClick:e=>{e.preventDefault(),e.stopPropagation()}}),d(M,{className:ie}),d("div",{className:`${ae} pr-1`,style:{lineHeight:"1.2"},children:e.title}),C&&d("div",{className:se,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),C(t,e,"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}})]}):(()=>{const t=$?$.startHour:Mu(e.start),n=$?$.endHour:Lu(e),r=n-t,a=!$||$.isFirst,o=!$||$.isLast;return l(c,{children:[d("div",{className:oe,style:{backgroundColor:Ru(e.calendarId||"blue")}}),l("div",{className:"h-full flex flex-col overflow-hidden pl-3 "+(Lu(e)-Mu(e.start)<=.25?"px-1 py-0":"p-1"),children:[d("div",{className:`${ae} pr-1`,style:{lineHeight:r<=.25?"1.2":"normal"},children:e.title}),r>.5&&d("div",{className:"text-xs opacity-80 truncate",children:$?`${$u(t)} - ${$u(n)}`:ju(e)})]}),C&&l(c,{children:[a&&d("div",{className:"absolute top-0 left-0 w-full h-1.5 cursor-ns-resize z-10 rounded-t-sm",onMouseDown:t=>C(t,e,"top")}),o&&d("div",{className:"absolute bottom-0 left-0 w-full h-1.5 cursor-ns-resize z-10 rounded-b-sm",onMouseDown:t=>C(t,e,"bottom")}),!a&&o&&$&&d("div",{className:se,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),C(t,e,"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}})]})]})})()}),A&&d("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:9998,pointerEvents:"none"}}),(()=>{if(!A)return null;const t=()=>{H&&H(null),J(null),Y(!1),null==O||O(null)};if(P){const n=P,r={event:e,isOpen:A,isAllDay:i,onEventUpdate:N,onEventDelete:T,onClose:t};if("undefined"==typeof window||"undefined"==typeof document)return null;const a=document.body;return a?k.createPortal(d(n,Object.assign({},r)),a):null}return Z?R?d(vg,{event:e,position:Z,panelRef:W,isAllDay:i,eventVisibility:F,calendarRef:u,selectedEventElementRef:U,onEventUpdate:N,onEventDelete:T,onClose:t,contentRenderer:R}):d(mg,{event:e,position:Z,panelRef:W,isAllDay:i,eventVisibility:F,calendarRef:u,selectedEventElementRef:U,onEventUpdate:N,onEventDelete:T,onClose:t}):null})()]})};function pg(e){return Object.assign(Object.assign({},e),{parentId:void 0,children:[],_startHour:e.allDay?0:Mu(e.start),_endHour:e.allDay?0:Lu(e)})}function bg(e){var t;return null!==(t=e._startHour)&&void 0!==t?t:Mu(e.start)}function Dg(e){var t;return null!==(t=e._endHour)&&void 0!==t?t:Lu(e)}const wg=.25,xg=.5,Eg=25,Mg=1,Cg=.9;class kg{static getIndentStepPercent(e){return"day"===e?.5:2.5}static calculateDayEventLayouts(e,t={}){const n=e.map(pg);this.clearAllParentChildRelations(n);const r=new Map,a=n.filter(e=>!e.allDay);if(0===a.length)return r;const o=this.groupOverlappingEvents(a);for(let e=0;e<o.length;e++){const n=o[e];1===n.length?this.setSingleEventLayout(n[0],r):this.calculateComplexGroupLayout(n,r,t)}return r}static clearAllParentChildRelations(e){for(const t of e)t.parentId=void 0,t.children=[]}static setParentChildRelation(e,t){t.parentId=e.id,e.children.includes(t.id)||e.children.push(t.id)}static eventsOverlap(e,t){return e.day===t.day&&!e.allDay&&!t.allDay&&(bg(e)<Dg(t)&&bg(t)<Dg(e))}static groupOverlappingEvents(e){const t=[],n=new Set;for(const r of e){if(n.has(r.id))continue;const a=[r],o=[r];for(n.add(r.id);o.length>0;){const t=o.shift();for(const r of e)n.has(r.id)||this.eventsOverlap(t,r)&&(a.push(r),o.push(r),n.add(r.id))}t.push(a)}return t}static setSingleEventLayout(e,t){t.set(e.id,{id:e.id,left:0,width:100-Cg,zIndex:0,level:0,isPrimary:!0,indentOffset:0,importance:1})}static calculateComplexGroupLayout(e,t,n={}){const r=[...e].sort((e,t)=>{const n=bg(e),r=bg(t);if(n!==r)return n-r;return Dg(t)-bg(t)-(Dg(e)-bg(e))}),a=this.analyzeParallelGroups(r),o=this.buildNestedStructure(a,e);this.calculateLayoutFromStructure(o,t,n)}static analyzeParallelGroups(e){const t=[],n=new Set;for(const r of e){if(n.has(r.id))continue;const a=[r];n.add(r.id);for(const t of e){if(n.has(t.id))continue;Math.abs(bg(r)-bg(t))<=wg&&(a.push(t),n.add(t.id))}a.sort((e,t)=>bg(e)-bg(t));const o={events:a,startHour:Math.min(...a.map(e=>bg(e))),endHour:Math.max(...a.map(e=>Dg(e)))};t.push(o)}return t.sort((e,t)=>e.startHour-t.startHour),t}static shouldBeParallel(e,t){if(!this.eventsOverlap(e,t))return!1;const n=Math.abs(bg(e)-bg(t));if(n<=wg)return!0;if(n>wg&&n<xg)return!0;return!!this.checkExtendedEventParallel(e,t)}static checkExtendedEventParallel(e,t){return!!this.eventsOverlap(e,t)&&(!!this.isExtendedEventParallel(e,t)||!!this.isExtendedEventParallel(t,e))}static isExtendedEventParallel(e,t){const n=Dg(e)-bg(e);if(n<1.25)return!1;const r=bg(e)+.4*n,a=bg(t)>=r,o=this.eventsOverlap(e,t);return a&&o}static buildNestedStructure(e,t){const n=[],r=new Map,a=new Map;t.forEach(e=>a.set(e.id,e));for(const t of e)for(const e of t.events){const t={event:a.get(e.id),children:[],parent:null,depth:0,isProcessed:!1};n.push(t),r.set(e.id,t)}for(let n=0;n<e.length;n++){const o=e[n],i=o.events.map(e=>a.get(e.id));let s=!1;for(let l=n-1;l>=0&&!s;l--){const n=e[l],d=n.events.map(e=>a.get(e.id)),c={events:d,startHour:n.startHour,endHour:n.endHour};if(this.canGroupContain(c,{events:i,startHour:o.startHour,endHour:o.endHour})){const e=this.optimizeChildAssignments(i,c,t);for(const t of e){const e=r.get(t.child.id),n=r.get(t.parent.id);e.parent=n,e.depth=n.depth+1,n.children.push(e)}s=!0}}}const o=n.filter(e=>null===e.parent);return o.forEach(e=>{e.depth=0}),this.rebalanceLoadByGroups(e,n),o}static findAlternateBranchRoot(e,t,n){const r=n.get(e.id);if(!r)return null;let a=r;for(;a.parent&&a.depth>1;)a=a.parent;if(1!==a.depth)return null;const o=a.parent;if(!o)return null;const i=o.children.filter(e=>1===e.depth&&e.event.id!==a.event.id);let s=1/0,l=null;for(const e of i){const t=this.calculateBranchLoad(e);t<s&&(s=t,l=e)}return l?l.event:null}static calculateBranchLoad(e){let t=0;function n(e){t++;for(const t of e.children)n(t)}for(const t of e.children)n(t);return t}static canGroupContain(e,t){const n=t.startHour-e.startHour;if(this.checkLoadBalanceParallel(e,t))return!1;if(n<xg)return!1;let r=!1;for(const n of e.events){for(const e of t.events)if(this.canEventContain(n,e)){r=!0;break}if(r)break}return r}static checkLoadBalanceParallel(e,t){for(const n of e.events)for(const e of t.events){if(!this.eventsOverlap(n,e))continue;const t=Math.abs(bg(e)-bg(n));if(t<=wg)return!0;if(t>wg&&t<xg)return!0}return!1}static canEventContain(e,t){const n=bg(e)<=bg(t)&&Dg(e)>=Dg(t),r=bg(e)<=bg(t)&&bg(t)<Dg(e)&&this.eventsOverlap(e,t);return n||r}static optimizeChildAssignments(e,t,n){const r=[];if(1===e.length){const a=this.findBestParentInGroup(e[0],t,n);return a&&(r.push({child:e[0],parent:a}),this.setParentChildRelation(a,e[0])),r}if(1===t.events.length){const n=t.events[0];for(const t of e)this.canEventContain(n,t)&&(r.push({child:t,parent:n}),this.setParentChildRelation(n,t));return r}const a=t.events.filter(t=>e.every(e=>this.canEventContain(t,e)));if(0===a.length){for(const a of e){const o=this.findBestParentInGroup(a,t,n);if(o)r.push({child:a,parent:o}),this.setParentChildRelation(o,a);else{const t=e.find(e=>e.id!==a.id&&this.eventsOverlap(e,a));if(t){const e=this.buildTempNodeMap(n),o=this.findAlternateBranchRoot(t,Array.from(e.values()),e);o&&(r.push({child:a,parent:o}),this.setParentChildRelation(o,a))}}}return r}const o=[...e].sort((e,t)=>{const n=Dg(e)-bg(e);return Dg(t)-bg(t)-n});if(o.length%a.length===0){const e=o.length/a.length;for(let t=0;t<a.length;t++){const n=a[t],i=o.slice(t*e,(t+1)*e);for(const e of i)r.push({child:e,parent:n}),this.setParentChildRelation(n,e)}return r}for(let e=0;e<o.length;e++){const t=o[e],n=this.findParentWithMinLoadFromEvents(t,a,o);n&&(r.push({child:t,parent:n}),this.setParentChildRelation(n,t))}return r}static buildTempNodeMap(e){const t=new Map;for(const n of e){const e={event:n,children:[],parent:null,depth:0,isProcessed:!1};t.set(n.id,e)}for(const n of e)if(n.parentId){const e=t.get(n.id),r=t.get(n.parentId);e&&r&&(e.parent=r,e.depth=r.depth+1,r.children.push(e))}return t}static findParentWithMinLoadFromEvents(e,t,n){if(0===t.length)return null;let r=1/0,a=[];for(const e of t){const t=e.children.length;t<r?(r=t,a=[e]):t===r&&a.push(e)}const o=a.map(e=>e.children).flat(),i=Dg(e)-bg(e),s=i>Math.max(...o.map(e=>{const t=n.find(t=>t.id===e);return t?Dg(t)-bg(t):0}));n.every(e=>Dg(e)-bg(e)===i);return s?a[0]:a[a.length-1]}static findBestParentInGroup(e,t,n){const r=t.events.filter(t=>this.canEventContain(t,e));if(0===r.length)return null;if(1===r.length)return r[0];const a=r.map(e=>({parent:e,load:e.children.length,hasParallelSibling:!1}));for(const t of a)for(const r of t.parent.children){const a=n.find(e=>e.id===r);if(a&&this.shouldBeParallel(e,a)){t.hasParallelSibling=!0;break}}a.sort((t,n)=>{if(t.load!==n.load)return t.load-n.load;if(t.hasParallelSibling!==n.hasParallelSibling)return t.hasParallelSibling?-1:1;if(t.load!==n.load)return t.load-n.load;return Math.abs(bg(e)-bg(t.parent))-Math.abs(bg(e)-bg(n.parent))});return a[0].parent}static calculateLayoutFromStructure(e,t,n={}){const r=100-Cg;if(1===e.length)this.calculateNodeLayoutWithVirtualParallel(e[0],0,r,t,n);else{const a=e.length,o=(r-Mg*(a-1))/a;e.forEach((e,r)=>{const a=r*(o+Mg);this.calculateNodeLayoutWithVirtualParallel(e,a,Math.max(o,Eg),t,n)})}}static calculateNodeLayoutWithVirtualParallel(e,t,n,r,a={}){let o=e.depth*this.getIndentStepPercent(a.viewType);if(e.isProcessed){const t=this.findBranchRootIndent(e,a.viewType);null!==t&&(o=t)}let i=0;const s="day"===a.viewType;1===e.depth?i=s?.5:1.5:2===e.depth?i=s?-.01:-1:e.depth>=3&&(i=s?.55:-3.5);const l=t+o+i;let d=n-(o+i);if(l+d>t+n&&(d=t+n-l,console.warn(`⚠️ ${e.event.title}'s width exceeds parent event range, adjusted to: ${d.toFixed(1)}%`)),r.set(e.event.id,{id:e.event.id,left:l,width:d,zIndex:e.depth,level:e.depth,isPrimary:0===e.depth,indentOffset:o*(a.containerWidth||320)/100,importance:this.calculateEventImportance(e.event)}),0===e.children.length)return;const c=[...e.children].sort((e,t)=>{const n=Dg(e.event)-bg(e.event);return Dg(t.event)-bg(t.event)-n});if(1===c.length)this.calculateNodeLayoutWithVirtualParallel(c[0],l,d,r,a);else{const e=this.shouldChildrenBeParallel(c.map(e=>e.event));e?this.calculateParallelChildrenLayout(c,l,d,r,a):c.forEach(e=>{this.calculateNodeLayoutWithVirtualParallel(e,l,d,r,a)})}}static calculateParallelChildrenLayout(e,t,n,r,a={}){const o=e.length,i=e[0].depth,s=i*this.getIndentStepPercent(a.viewType);let l;const d="day"===a.viewType;l=1===i?d?.5:1.5:2===i?d?-.01:-1:d?.55:-3.5;const c=t+s+l,u=n-(s+l);if(u<=0)return void e.forEach(e=>{this.calculateNodeLayoutWithVirtualParallel(e,t,n,r,a)});let h;h=1===i?Mg*(d?.15:.3):Mg*(d?.1:.2);const g=(u-h*(o-1))/o;e.forEach((e,t)=>{const n=c+t*(g+h);if(r.set(e.event.id,{id:e.event.id,left:n,width:g,zIndex:e.depth,level:e.depth,isPrimary:0===e.depth,indentOffset:s*(a.containerWidth||320)/100,importance:this.calculateEventImportance(e.event)}),e.children.length>0){const t=[...e.children].sort((e,t)=>{const n=Dg(e.event)-bg(e.event);return Dg(t.event)-bg(t.event)-n});if(1===t.length)this.calculateNodeLayoutWithVirtualParallel(t[0],n,g,r,a);else{const e=this.shouldChildrenBeParallel(t.map(e=>e.event));e?this.calculateParallelChildrenLayout(t,n,g,r,a):t.forEach(e=>{this.calculateNodeLayoutWithVirtualParallel(e,n,g,r,a)})}}})}static findBranchRootIndent(e,t){let n=e;for(;n.parent&&n.parent.depth>0;)n=n.parent;if(1===n.depth){return n.depth*this.getIndentStepPercent(t)}return null}static shouldChildrenBeParallel(e){if(e.length<2)return!1;for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++)if(this.shouldBeParallel(e[t],e[n]))return!0;return!1}static calculateEventImportance(e){const t=Dg(e)-bg(e);return Math.max(.1,Math.min(1,t/4))}static countDescendants(e){let t=0;for(const n of e.children)t+=1+this.countDescendants(n);return t}static findTransferableLeaf(e,t){const n=[];return this.collectLeaves(e,n),n.find(e=>this.canEventContain(t.event,e.event))||n[0]}static collectLeaves(e,t){0===e.children.length?t.push(e):e.children.forEach(e=>this.collectLeaves(e,t))}static transferNode(e,t){e.parent&&(e.parent.children=e.parent.children.filter(t=>t!==e));const n=t.children;let r=null;for(const t of n){if(this.shouldBeParallel(e.event,t.event))break;if(this.canEventContain(t.event,e.event)){r=t;break}}r?(e.parent=r,e.depth=r.depth+1,r.children.push(e),this.setParentChildRelation(r.event,e.event)):(e.parent=t,e.depth=t.depth+1,t.children.push(e),this.setParentChildRelation(t.event,e.event))}static calculateParentLoads(e,t){var n,r;const a=[],o=null===(r=null===(n=e[0])||void 0===n?void 0:n.parent)||void 0===r?void 0:r.depth;if(void 0===o)return a;const i=t.filter(e=>e.depth===o);for(const e of i){const t=this.countDescendants(e);a.push({node:e,load:t})}return a.sort((e,t)=>t.load-e.load),a}static needsRebalancing(e){if(e.length<2)return!1;return e[0].load-e[e.length-1].load>=2}static rebalanceGroupLoad(e){let t=0;for(;t<5;){e.sort((e,t)=>t.load-e.load);const n=e[0],r=e[e.length-1];if(n.load-r.load<2)break;const a=this.findTransferableLeaf(n.node,r.node);if(!a)break;this.transferNode(a,r.node),n.load--,r.load++,t++}}static rebalanceLoadByGroups(e,t){for(let n=e.length-1;n>=1;n--){const r=e[n].events.map(e=>t.find(t=>t.event.id===e.id)),a=this.calculateParentLoads(r,t);this.needsRebalancing(a)&&this.rebalanceGroupLoad(a)}}}const Ng={HOUR_HEIGHT:72,FIRST_HOUR:0,LAST_HOUR:24,MIN_DURATION:.25,TIME_COLUMN_WIDTH:80,ALL_DAY_HEIGHT:28,getLineColor:e=>Ru(e),getDynamicPadding:e=>e.endHour-e.startHour<=.25?"px-1 py-0":"p-1"};const Tg=e=>{const{viewType:a,onEventsUpdate:i}=e,s=a===T.MONTH,l=o({active:!1,mode:null,eventId:null,startX:0,startY:0,dayIndex:0,startHour:0,endHour:0,originalDay:0,originalStartHour:0,originalEndHour:0,resizeDirection:null,hourOffset:null,duration:0,lastRawMouseHour:null,lastUpdateTime:0,initialMouseY:0,lastClientY:0,allDay:!1,targetDate:null,originalDate:null,originalEvent:null,dragOffset:0,originalStartDate:null,originalEndDate:null,eventDate:void 0,originalStartTime:null,originalEndTime:null,sourceElement:null,indicatorVisible:!1}),d=o({x:0,y:0}),c=t(()=>s?{active:!1,mode:null,eventId:null,targetDate:null,startDate:null,endDate:null}:{active:!1,mode:null,eventId:null,dayIndex:0,startHour:0,endHour:0,allDay:!1},[s]),[u,h]=n(c),g=t(()=>function(e,t){let n=null,r=0;const a=function(...a){const o=Date.now(),i=t-(o-r);i<=0||i>t?(n&&(clearTimeout(n),n=null),r=o,e.apply(this,a)):n||(n=setTimeout(()=>{r=Date.now(),n=null,e.apply(this,a)},i))};return a.cancel=()=>{n&&(clearTimeout(n),n=null),r=0},a}((e,t)=>i(e,"resize"===t),s?16:8),[s,i]),f=r(()=>{h(s?{active:!1,mode:null,eventId:null,targetDate:null,startDate:null,endDate:null}:{active:!1,mode:null,eventId:null,dayIndex:0,startHour:0,endHour:0,allDay:!1}),l.current={active:!1,mode:null,eventId:null,startX:0,startY:0,dayIndex:0,startHour:0,endHour:0,originalDay:0,originalStartHour:0,originalEndHour:0,duration:0,resizeDirection:null,hourOffset:null,lastRawMouseHour:null,lastUpdateTime:0,initialMouseY:0,lastClientY:0,allDay:!1,targetDate:null,originalDate:null,originalEvent:null,dragOffset:0,originalStartDate:null,originalEndDate:null,eventDate:void 0,originalStartTime:null,originalEndTime:null,sourceElement:null,indicatorVisible:!1}},[s]);return{dragRef:l,currentDragRef:d,dragState:u,setDragState:h,resetDragState:f,throttledSetEvents:g}},Ig={renderAllDayContent:({title:e,color:t})=>l("div",{className:"h-full flex items-center overflow-hidden pl-3 pt-1",children:[d(M,{className:"h-3 w-3 mr-1 text-white"}),d("div",{className:"font-medium text-xs truncate pr-1 text-white",children:e})]}),renderRegularContent:({drag:e,title:t,layout:n,formatTime:r,getLineColor:a,getDynamicPadding:o,color:i})=>l(c,{children:[d("div",{className:oe,style:{backgroundColor:a(i||"blue")}}),l("div",{className:`h-full flex flex-col overflow-hidden pl-3 text-white ${o(e)}`,children:[d("div",{className:"font-medium text-xs truncate pr-1 text-white",style:{lineHeight:e.endHour-e.startHour<=.25?"1.2":"normal"},children:t}),!e.allDay&&e.endHour-e.startHour>.5&&l("div",{className:"text-xs truncate time-display text-white opacity-90",children:[r(e.startHour)," - ",r(e.endHour)]})]})]}),renderDefaultContent:({drag:e,title:t,allDay:n})=>n?l("div",{className:"h-full flex items-center overflow-hidden pl-3 px-1 py-0",children:[d("svg",{className:"h-3 w-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:d("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 002 2z"})}),d("div",{className:"font-medium text-xs truncate pr-1",style:{lineHeight:1.2},children:t})]}):l(c,{children:[d("div",{className:"absolute left-0.5 top-1 bottom-1 w-0.5 rounded-full bg-blue-600 dark:bg-blue-400"}),d("div",{className:"h-full flex flex-col overflow-hidden pl-3 p-1",children:d("div",{className:"font-medium text-xs truncate pr-1 text-blue-900 dark:text-blue-100",children:t})})]})},Sg=({drag:e,color:t,title:n,layout:r,allDay:a,formatTime:o,getLineColor:i,getDynamicPadding:s,renderer:l=Ig})=>{const c=n||(a?"New All-day Event":"New Event");return d("div",{className:"drag-indicator-content",children:t?a?l.renderAllDayContent({drag:e,color:t,title:c,layout:r,allDay:a,formatTime:o,getLineColor:i,getDynamicPadding:s}):l.renderRegularContent({drag:e,color:t,title:c,layout:r,allDay:a,formatTime:o,getLineColor:i,getDynamicPadding:s}):l.renderDefaultContent({drag:e,color:t,title:c,layout:r,allDay:a,formatTime:o,getLineColor:i,getDynamicPadding:s})})},Hg=({event:e,isCreating:t,isMultiDay:n=!1,startDate:r,endDate:a})=>{const o=(()=>{if(t)return{title:"New Event",icon:d(C,{className:"h-3 w-3"}),showDateRange:!1};if(n&&r&&a){const t=Du(r,a)+1;return{title:e.title.replace(/ \(\d+天\)$/,""),showDateRange:!0,duration:t}}return{title:e.title,showDateRange:!1}})();return l("div",{className:"flex items-center space-x-2 text-white text-xs font-medium rounded-sm",children:[d("div",{className:"flex-shrink-0",children:o.icon}),d("div",{className:"flex-1 min-w-0",children:d("div",{className:"truncate font-medium",children:o.title})})]})},Og=n=>{const a=t(()=>Object.assign(Object.assign({},Ng),n),[n]),{viewType:i}=a,s=i===T.MONTH,l=(e=>{const{calendarRef:n,allDayRowRef:a,viewType:o,HOUR_HEIGHT:i=72,FIRST_HOUR:s=0,LAST_HOUR:l=24,TIME_COLUMN_WIDTH:d=80}=e,c=o===T.MONTH,u=o===T.WEEK,h=r(e=>{if(c||!n.current)return s;const t=n.current.querySelector(".calendar-content");if(!t)return s;const r=t.getBoundingClientRect(),a=t.scrollTop,o=window.getComputedStyle(t),d=parseInt(o.paddingTop,10)||0,u=(e-r.top+a-d)/i+s;return Math.max(s,Math.min(l,u))},[n,s,i,l,c]),g=r(e=>{if(c||!n.current)return 0;const t=n.current.getBoundingClientRect(),r=(t.width-d)/(u?7:1),a=e-t.left-d,o=Math.floor(a/r);return Math.max(0,Math.min(u?6:0,o))},[n,d,c,u]),f=r(e=>{if(c||!n.current)return;const t=n.current.querySelector(".calendar-content");if(!t)return;const r=t.getBoundingClientRect();e<r.top?t.scrollTop+=e-r.top:e+40>r.bottom&&(t.scrollTop+=e+40-r.bottom)},[n,c]),m=r(e=>{if(c||!(null==a?void 0:a.current))return!1;const t=a.current.getBoundingClientRect();return e>=t.top&&e<=t.bottom},[a,c]),v=t(()=>864e5,[]);return{pixelYToHour:h,getColumnDayIndex:g,checkIfInAllDayArea:m,handleDirectScroll:f,daysDifference:r((e,t)=>Du(e,t),[]),addDaysToDate:r((e,t)=>wu(e,t),[]),getTargetDateFromPosition:r((e,t)=>{if(o!==T.MONTH||!n.current)return null;const r=document.elementFromPoint(e,t);if(!r)return null;let a=r,i=0;for(;a&&!a.hasAttribute("data-date")&&i<10;)a=a.parentElement,i++;if(a&&a.hasAttribute("data-date")){const e=a.getAttribute("data-date");if(e)return new Date(e+"T00:00:00")}return null},[n,o]),ONE_DAY_MS:v}})(a),d=Tg(a),c=(t=>{const{calendarRef:n,allDayRowRef:a,viewType:i,getLineColor:s,getDynamicPadding:l,renderer:d,HOUR_HEIGHT:c=72,FIRST_HOUR:u=0,TIME_COLUMN_WIDTH:h=80,ALL_DAY_HEIGHT:g=60}=t,f=i===T.MONTH,m=i===T.DAY,v=o(null),y=o(null),p=o(null),b=r(()=>{y.current&&(y.current.unmount(),y.current=null),v.current&&(v.current.remove(),v.current=null),p.current=null},[]),D=r((t,r,o,i,D)=>{var w,x,E,M,C,k,T,I,S;b();const H=document.createElement("div");if(H.style.position=f?"fixed":"absolute",H.style.pointerEvents="none",H.style.zIndex="1000",f){let n,a;if(H.style.opacity="0.9",D){const e=D.getBoundingClientRect(),r=null!==(x=null!==(w=t.currentSegmentDays)&&void 0!==w?w:t.eventDurationDays)&&void 0!==x?x:1;n=e.width/r,a=e.height,H.className=`rounded-sm shadow-sm ${D.className}`}else n=120,a=22,H.className="rounded text-xs px-2 py-1";H.style.width=`${n}px`,H.style.height=`${a}px`,H.style.left=t.startX-n/2+"px",H.style.top=t.startY-a/2+"px",document.body.appendChild(H),y.current=N(H);const i=cu(new Date),s=t.originalEvent||{id:String(Date.now()),color:r||"blue",title:o||"New Event",start:i,end:i,allDay:!1,day:0};y.current.render(e.createElement(Hg,{event:s,isCreating:"create"===t.mode,targetDate:t.targetDate||null,startDate:t.originalStartDate||null,endDate:t.originalEndDate||null}))}else{if(D){const e=D.getBoundingClientRect();let r;if(r=t.allDay?null===(E=null==a?void 0:a.current)||void 0===E?void 0:E.getBoundingClientRect():null===(C=null===(M=n.current)||void 0===M?void 0:M.querySelector(".calendar-content"))||void 0===C?void 0:C.getBoundingClientRect(),r){if(t.allDay&&m)H.style.left=`${h}px`,H.style.top=D.offsetTop-2+"px",H.style.width=`calc(100% - ${h}px - 2px)`,H.style.height=`${e.height}px`;else if(t.allDay&&!m){const r=null===(k=n.current)||void 0===k?void 0:k.getBoundingClientRect();if(r){const n=(r.width-h)/7;H.style.left=`${h+t.dayIndex*n}px`,H.style.top=D.offsetTop-2+"px",H.style.width=n-2+"px",H.style.height=`${e.height}px`}}else{const n=(t.startHour-u)*c;H.style.left=e.left-r.left+"px",H.style.top=`${n+3}px`,H.style.width=`${e.width}px`,H.style.height=`${e.height}px`}H.className=D.className,H.style.opacity="0.8",H.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"}}else if(t.allDay){const e=m?"100%":`calc((100% - ${h}px) / 7)`;H.style.top="2px",H.style.height=g-4+"px",H.style.marginBottom="3px",m?(H.style.left=`${h}px`,H.style.width=`calc(100% - ${h}px - 2px)`):(H.style.left=`calc(${h}px + (${e} * ${t.dayIndex}))`,H.style.width=`calc(${e} - 2px)`),H.className="rounded-xl shadow-sm"}else{const e=(t.startHour-u)*c,n=(t.endHour-t.startHour)*c;if(H.style.top=`${e+3}px`,H.style.height=n-4+"px",H.style.color="#fff",H.className="rounded-sm shadow-sm",i){if(m)H.style.left=`${h}px`,H.style.width=`calc(100% - ${h}px)`;else{const e=`calc((100% - ${h}px) / 7)`;H.style.left=`calc(${h}px + (${e} * ${t.dayIndex}) + (${e} * ${i.left/100}))`,H.style.width=`calc((${e} * ${i.width/100}))`}H.style.zIndex=String(1e3)}else{const e=m?`calc(100% - ${h}px)`:`calc((100% - ${h}px) / 7)`;H.style.left=m?`${h}px`:`calc(${h}px + (${e} * ${t.dayIndex}))`,H.style.width=e}}t.allDay?null===(T=null==a?void 0:a.current)||void 0===T||T.appendChild(H):null===(S=null===(I=n.current)||void 0===I?void 0:I.querySelector(".calendar-content"))||void 0===S||S.appendChild(H),p.current={drag:t,color:r,title:o,layout:i},y.current=N(H),y.current.render(e.createElement(Sg,{drag:t,color:r,title:o,layout:i,allDay:t.allDay,formatTime:$u,getLineColor:s||(()=>""),getDynamicPadding:l||(()=>"0px"),renderer:d}))}r?(H.style.backgroundColor=Ou(r),H.style.color=Hu(r)):H.className+=" bg-blue-50/70 text-blue-900 border border-dashed border-blue-400",v.current=H},[b,f,m,a,n,$u,s,l,d,h,g,u,c]),w=r((...t)=>{var r,o;const i=v.current;if(i)if(f){const[e,n]=t,r=parseFloat(i.style.width)||120,a=parseFloat(i.style.height)||22;requestAnimationFrame(()=>{i.style.left=e-r/2+"px",i.style.top=n-a/2+"px",i.style.transition="none"})}else{const[f,v,b,D=!1,w]=t;if(D&&i.parentElement!==(null==a?void 0:a.current))null===(r=null==a?void 0:a.current)||void 0===r||r.appendChild(i);else if(!D){const e=null===(o=n.current)||void 0===o?void 0:o.querySelector(".calendar-content");i.parentElement!==e&&(null==e||e.appendChild(i))}if(D){if(m)i.style.left=`${h}px`,i.style.width=`calc(100% - ${h}px - 2px)`;else{const e=`calc((100% - ${h}px) / 7)`;i.style.left=`calc(${h}px + (${e} * ${f}))`,i.style.width=`calc(${e} - 2px)`,i.style.top="2px"}i.style.height=g-4+"px",i.style.marginBottom="3px",i.className=i.className.replace("rounded-sm","rounded-xl")}else{const e=(v-u)*c,t=(b-v)*c;if(i.style.top=`${e+3}px`,i.style.height=t-4+"px",i.style.marginBottom="0",i.className=i.className.replace("rounded-xl","rounded-sm"),w){if(m)i.style.left=`${h}px`,i.style.width=`calc(100% - ${h}px)`;else{const e=`calc((100% - ${h}px) / 7)`;i.style.left=`calc(${h}px + (${e} * ${f}) + (${e} * ${w.left/100}))`,i.style.width=`calc((${e} * ${w.width/100}))`}i.style.zIndex=String(w.zIndex+10)}else{const e=m?`calc(100% - ${h}px)`:`calc((100% - ${h}px) / 7)`;i.style.left=m?`${h}px`:`calc(${h}px + (${e} * ${f}))`,i.style.width=e}}if(i.style.cursor="grabbing",y.current&&p.current){const t=Object.assign(Object.assign({},p.current.drag),{dayIndex:f,startHour:v,endHour:b,allDay:D});p.current.drag=t,y.current.render(e.createElement(Sg,{drag:t,color:p.current.color,title:p.current.title,layout:w||p.current.layout,allDay:D,formatTime:$u,getLineColor:s||(()=>""),getDynamicPadding:l||(()=>"0px"),renderer:d}))}}},[f,a,$u,n,m,g,h,u,c,s,l,d]);return{dragIndicatorRef:v,reactRootRef:y,removeDragIndicator:b,createDragIndicator:D,updateDragIndicator:w}})(a),u=(e=>{const{options:t,common:n,state:a,manager:o}=e,{viewType:i,onEventsUpdate:s,onEventCreate:l,onEventEdit:d,calculateNewEventLayout:c,calculateDragLayout:u,currentWeekStart:h,events:g,FIRST_HOUR:f=0,LAST_HOUR:m=24,MIN_DURATION:v=.25}=t,{dragRef:y,currentDragRef:p,setDragState:b,resetDragState:D,throttledSetEvents:w}=a,{removeDragIndicator:x,createDragIndicator:E,updateDragIndicator:M}=o,{pixelYToHour:C,getColumnDayIndex:k,checkIfInAllDayArea:N,handleDirectScroll:I,daysDifference:S,addDaysToDate:H,getTargetDateFromPosition:O}=n,R=i===T.MONTH,P=i===T.DAY,$=864e5,j=(e,t,n=!1)=>{const r=new Date(e);r.setHours(0,0,0,0);const a=new Date(t);a.setHours(0,0,0,0);let o=Math.floor((a.getTime()-r.getTime())/$);if(o<=0)return 0;if(!n&&1===o){const n=0===t.getHours()&&0===t.getMinutes()&&0===t.getSeconds()&&0===t.getMilliseconds(),r=t.getTime()-e.getTime();if(n&&r<$)return 0}return o},Y=r(e=>{var t,n;e.preventDefault();const r=y.current;if(!r.active)return;"resize"===r.mode?r.allDay?document.body.style.cursor="ew-resize":document.body.style.cursor="ns-resize":document.body.style.cursor="grabbing";const a=N(e.clientY),o=P?r.dayIndex:k(e.clientX);if(a){if(!r.allDay){r.allDay=!0,r.startHour=0,r.endHour=0,r.eventDate=h?Ku(h,o):new Date,x(),r.indicatorVisible=!1;const e=null==g?void 0:g.find(e=>e.id===r.eventId);E(r,null==e?void 0:e.calendarId,null==e?void 0:e.title),r.sourceElement=null,r.indicatorVisible=!0}r.dayIndex=o,b(e=>Object.assign(Object.assign({},e),{dayIndex:o,startHour:0,endHour:0,allDay:!0})),M(o,0,0,!0)}else{I(e.clientY);const a=C(e.clientY);if(null!==(t=r.startDragDayIndex)&&void 0!==t||r.originalDay,r.dayIndex,r.allDay){r.allDay=!1,r.startHour=Yu(a),r.endHour=r.startHour+1,r.duration=1,r.hourOffset=0,r.eventDate=h?Ku(h,o):new Date,x(),r.indicatorVisible=!1;const e=null==g?void 0:g.find(e=>e.id===r.eventId);E(r,null==e?void 0:e.calendarId,null==e?void 0:e.title),r.sourceElement=null,r.indicatorVisible=!0}else{let e=Yu(a+(null!==(n=r.hourOffset)&&void 0!==n?n:0));e=Math.max(f,Math.min(m-r.duration,e)),r.startHour=e,r.endHour=e+r.duration}r.dayIndex=o,r.eventDate=h?Ku(h,o):new Date,b(e=>Object.assign(Object.assign({},e),{dayIndex:o,startHour:Yu(r.startHour),endHour:Yu(r.endHour),allDay:!1}));let i=null;if("move"===r.mode&&r.eventId&&u){const e=null==g?void 0:g.find(e=>e.id===r.eventId);e&&(i=u(e,o,Yu(r.startHour),Yu(r.endHour)))}M(o,Yu(r.startHour),Yu(r.endHour),!1,i)}},[u,N,E,h,g,f,k,I,m,P,C,x,M,y,b]),L=r(()=>{document.body.style.cursor="default";const e=y.current;if(!e.active||"move"!==e.mode||!e.eventId)return;let t=e.startHour,n=e.endHour;e.allDay||(t=Yu(e.startHour),n=Yu(e.endHour),n-t<v&&(n=t+v)),null==s||s(r=>r.map(r=>{var a,o;if(r.id!==e.eventId)return r;h?Ku(h,e.dayIndex):gu(r.start);const i=null!==(a=e.startDragDayIndex)&&void 0!==a?a:e.originalDay,s=e.dayIndex-i;let l,d;if(e.allDay){const t=e.originalStartDate?new Date(e.originalStartDate):gu(r.start);t.setHours(0,0,0,0);const n=new Date(t);n.setDate(n.getDate()+s);const a=new Date(n);e.eventDurationDays&&e.eventDurationDays>0&&a.setDate(a.getDate()+e.eventDurationDays),l=uu(n),d=uu(Nu(a))}else{const a=gu(r.start),i=gu(r.end);if(j(a,i,null!==(o=r.allDay)&&void 0!==o&&o)>0){const e=new Date(a);e.setDate(e.getDate()+s);const t=new Date(i);t.setDate(t.getDate()+s),l=cu(e),d=cu(t)}else{const r=h?Ku(h,e.dayIndex):new Date,a=Cu(r,t),o=Cu(r,n);l=cu(a),d=cu(o)}}const c=e.originalDay+s;return Object.assign(Object.assign({},r),{day:c,start:l,end:d,allDay:e.allDay})})),document.removeEventListener("mousemove",Y),document.removeEventListener("mouseup",L),x(),D()},[Y,x,D,s,v,h,y]),A=r(e=>{var t,n,r,a,o,i,s,l,d;e.preventDefault();const v=y.current;if(v.active)if("resize"===v.mode?R||v.allDay?document.body.style.cursor="ew-resize":document.body.style.cursor="ns-resize":document.body.style.cursor="grabbing",R){if("resize"!==v.mode){if("move"===v.mode){const r=Math.hypot(e.clientX-v.startX,e.clientY-v.startY);!v.indicatorVisible&&r>=3&&(E(v,null===(t=v.originalEvent)||void 0===t?void 0:t.calendarId,null===(n=v.originalEvent)||void 0===n?void 0:n.title,null,v.sourceElement||void 0),v.indicatorVisible=!0)}v.indicatorVisible&&M(e.clientX,e.clientY)}const o=O(e.clientX,e.clientY);if(!o)return;if("resize"===v.mode&&v.originalEvent&&v.resizeDirection){const e=gu(v.originalEvent.start);let t,n;const r=(e,t)=>{var n,r;e&&((null===(n=v.originalEvent)||void 0===n?void 0:n.allDay)?e.setHours(0,0,0,0):t&&e.setHours(t.hour,t.minute,null!==(r=t.second)&&void 0!==r?r:0,0))},a=v.originalStartTime,i=v.originalEndTime;if("left"===v.resizeDirection){t=new Date(o),r(t,a);const s=gu(v.originalEvent.end)||e;n=new Date(s),r(n,i),t>n&&(t=n)}else{const s=gu(v.originalEvent.start)||e;t=new Date(s),r(t,a),n=new Date(o),r(n,i),n<t&&(n=t)}v.originalStartDate=new Date(t.getTime()),v.originalEndDate=new Date(n.getTime());const s=v.originalEvent.allDay?uu(t):cu(t),l=v.originalEvent.allDay?uu(n):cu(n);w(e=>e.map(e=>e.id===v.eventId?Object.assign(Object.assign({},e),{start:s,end:l,title:e.title}):e),v.mode)}else if("move"===v.mode)if(v.originalStartDate&&v.originalEndDate){const e=S(v.originalStartDate,o),t=H(v.originalStartDate,e),n=H(v.originalEndDate,e);(null===(r=v.originalStartDate)||void 0===r?void 0:r.getTime())!==t.getTime()&&(v.originalStartDate=new Date(t.getTime()),v.originalEndDate=new Date(n.getTime()),v.targetDate=t)}else(null===(a=v.targetDate)||void 0===a?void 0:a.getTime())!==o.getTime()&&(v.targetDate=o)}else{I(e.clientY),v.lastClientY=e.clientY;const t=C(e.clientY);if("resize"===v.mode)if(v.allDay){const t=P?v.dayIndex:k(e.clientX);let n=v.originalStartDate||new Date,r=v.originalEndDate||new Date;"left"===v.resizeDirection?(n=h?Ku(h,t):new Date,n>r&&(n=r)):"right"===v.resizeDirection&&(r=h?Ku(h,t):new Date,r<n&&(r=n)),v.originalStartDate=new Date(n.getTime()),v.originalEndDate=new Date(r.getTime());const a=uu(n),o=uu(r);w(e=>e.map(e=>e.id!==v.eventId?e:Object.assign(Object.assign({},e),{start:a,end:o,allDay:!0})),v.mode)}else{let n=v.startHour,r=v.endHour;const a=null==g?void 0:g.find(e=>e.id===v.eventId);let d=v.dayIndex;if(a){const e=gu(a.start),t=gu(a.end),n=j(e,t,null!==(o=a.allDay)&&void 0!==o&&o);d=(null!==(i=a.day)&&void 0!==i?i:0)+n}let c=d,u=v.originalDay;if("top"===v.resizeDirection){const a=P?v.dayIndex:k(e.clientX),o=t+(null!==(s=null==v?void 0:v.hourOffset)&&void 0!==s?s:0);a<d?(u=a,n=Math.max(f,Math.min(m,o))):(u=d,o>v.originalEndHour?(n=v.originalEndHour,r=o,v.hourOffset=r-t):(n=Math.max(f,o),v.originalEndHour-n<Pu&&(n=v.originalEndHour-Pu)))}else if("bottom"===v.resizeDirection){const a=P?v.dayIndex:k(e.clientX),o=t+(null!==(l=null==v?void 0:v.hourOffset)&&void 0!==l?l:0);a!==v.dayIndex?(c=a,r=Math.max(f,Math.min(m,o))):o<v.originalStartHour?(r=v.originalStartHour,n=o,v.hourOffset=n-t):(r=Math.min(m,o),r-v.startHour<Pu&&(r=v.startHour+Pu))}else if("right"===v.resizeDirection){const t=P?v.dayIndex:k(e.clientX);c=Math.max(v.dayIndex,t)}c===u&&([n,r]=[Math.max(f,Math.min(n,r)),Math.min(m,Math.max(n,r))]);const[y,p]=[Yu(n),Yu(r)];v.startHour=n,v.endHour=r,v.dayIndex=u,w(e=>e.map(e=>{if(e.id!==v.eventId)return e;const t=gu(e.start),n=Cu(h?Ku(h,u):t,y),r=h?Ku(h,c):t,a=Cu(r,p),o=cu(n),i=cu(a);return Object.assign(Object.assign({},e),{start:o,end:i,day:u})}),v.mode),M(v.dayIndex,y,p,!1)}else if("create"===v.mode){const n=Yu(t),[r,a]=e.clientY<v.startY?[n,Math.max(n+Pu,v.endHour)]:[v.startHour,Math.max(v.startHour+Pu,n)];v.startHour=r,v.endHour=a;const o=null==c?void 0:c(v.dayIndex,r,a);M(v.dayIndex,r,a,!1,o)}else if("move"===v.mode){const n=P?v.dayIndex:k(e.clientX);let r=Yu(t+(null!==(d=v.hourOffset)&&void 0!==d?d:0));r=Math.max(f,Math.min(m-v.duration,r));const a=r+v.duration;v.dayIndex=n,v.startHour=r,v.endHour=a;let o=null;if(v.eventId&&u){const e=null==g?void 0:g.find(e=>e.id===v.eventId);e&&(o=u(e,n,Yu(r),Yu(a)))}M(n,Yu(r),Yu(a),!1,o)}}},[R,P,M,O,w,S,H,f,m,c,k,C,I,u,g,y,E]),Z=r(e=>{var t,n;document.body.style.cursor="default";const r=y.current;if(r.active){if(R){if("resize"===r.mode&&r.eventId&&r.originalStartDate&&r.originalEndDate){b(e=>"targetDate"in e?Object.assign(Object.assign({},e),{targetDate:r.originalStartDate,startDate:r.originalStartDate,endDate:r.originalEndDate}):e);const e=(null===(t=r.originalEvent)||void 0===t?void 0:t.allDay)||!1,n=e?uu(r.originalStartDate):cu(r.originalStartDate),a=e?uu(r.originalEndDate):cu(r.originalEndDate);w(e=>e.map(e=>e.id===r.eventId?Object.assign(Object.assign({},e),{start:n,end:a,title:e.title}):e))}else if("move"===r.mode)if(r.eventId&&r.originalStartDate&&r.originalEndDate){b(e=>"targetDate"in e?Object.assign(Object.assign({},e),{targetDate:r.originalStartDate,startDate:r.originalStartDate,endDate:r.originalEndDate}):e);const e=(null===(n=r.originalEvent)||void 0===n?void 0:n.allDay)||!1,t=e?uu(r.originalStartDate):cu(r.originalStartDate),a=e?uu(r.originalEndDate):cu(r.originalEndDate);w(e=>e.map(e=>e.id===r.eventId?Object.assign(Object.assign({},e),{start:t,end:a,title:e.title}):e))}else{const t=O(e.clientX,e.clientY)||r.targetDate;r.eventId&&t&&(b(e=>"targetDate"in e?Object.assign(Object.assign({},e),{targetDate:t}):e),w(e=>e.map(e=>{if(e.id!==r.eventId)return e;const n=gu(e.start),a=gu(e.end),o=new Date(t);o.setHours(n.getHours(),n.getMinutes(),0,0);const i=new Date(t);i.setHours(a.getHours(),a.getMinutes(),0,0);const s=e.allDay?uu(o):cu(o),l=e.allDay?uu(i):cu(i);return Object.assign(Object.assign({},e),{start:s,end:l})})))}}else{let[e,t]=[Yu(r.startHour),Yu(r.endHour)];if(t-e<v&&("top"===r.resizeDirection?e=t-v:t=e+v),"create"===r.mode){const n=h?Ku(h,r.dayIndex):new Date;b(n=>"dayIndex"in n?Object.assign(Object.assign({},n),{dayIndex:r.dayIndex,startHour:e,endHour:t}):n);const a=Cu(n,e),o=Cu(n,t),i=cu(a),s=cu(o);null==l||l({id:String(Date.now()),title:"New Event",day:r.dayIndex,start:i,end:s,calendarId:"blue",allDay:!1})}else"move"!==r.mode&&"resize"!==r.mode||(b(n=>"dayIndex"in n?Object.assign(Object.assign({},n),{dayIndex:r.dayIndex,startHour:e,endHour:t}):n),"move"===r.mode&&(null==s||s(e=>e.map(e=>e.id===r.eventId?Object.assign(Object.assign({},e),{day:r.dayIndex}):e))))}document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",Z),x(),r.indicatorVisible=!1,r.sourceElement=null,D()}},[R,A,x,D,O,w,v,h,l,s,y,b]),z=r((e,...t)=>{if(e.preventDefault(),e.stopPropagation(),!y.current.active)if(R){const[e]=t,n=new Date(e);n.setHours(9,0,0,0);const r=new Date(e);r.setHours(10,0,0,0);const a=cu(n),o=cu(r),i={id:String(Date.now()),title:"New Event",start:a,end:o,day:e.getDay(),calendarId:"blue",allDay:!1};null==l||l(i),d&&setTimeout(()=>{d(i)},50)}else{const[n,r]=t,a=y.current,o=Yu(r);Object.assign(a,{active:!0,mode:"create",eventId:null,startX:e.clientX,startY:e.clientY,dayIndex:n,startHour:o,endHour:o+1,allDay:!1,eventDate:h?Ku(h,n):new Date}),b({active:!0,mode:"create",eventId:null,dayIndex:n,startHour:a.startHour,endHour:a.endHour,allDay:!1});const i=null==c?void 0:c(n,a.startHour,a.endHour);E(a,"blue","New Event",i),a.sourceElement=null,a.indicatorVisible=!0,document.addEventListener("mousemove",A),document.addEventListener("mouseup",Z)}},[R,l,d,h,c,E,A,Z,y,b]),F=r((e,t)=>{var n,r,a;if(e.preventDefault(),e.stopPropagation(),y.current.active)return;const o=y.current,i=e.currentTarget;if(R){p.current={x:e.clientX-i.getBoundingClientRect().left,y:e.clientY-i.getBoundingClientRect().top};const n=gu(t.start),r=gu(t.end);let a=1;if(t.allDay&&t.start&&t.end){const e=new Date(n);e.setHours(0,0,0,0);const t=new Date(r);t.setHours(0,0,0,0),a=Math.floor((t.getTime()-e.getTime())/864e5+1),a=Math.max(1,a)}const s=i.getAttribute("data-segment-days"),l=s?parseInt(s,10):a;o.active=!0,o.mode="move",o.eventId=t.id,o.startX=e.clientX,o.startY=e.clientY,o.targetDate=n,o.originalDate=n,o.originalEvent=Object.assign({},t),o.lastUpdateTime=Date.now(),o.originalStartDate=n,o.originalEndDate=r,o.eventDurationDays=a,o.currentSegmentDays=l,b({active:!0,mode:"move",eventId:t.id,targetDate:n,startDate:n,endDate:r}),o.sourceElement=i,o.indicatorVisible=!1,document.addEventListener("mousemove",A),document.addEventListener("mouseup",Z)}else{const s=C(e.clientY),l=t._segmentInfo,d=!!l,c=d?l.dayIndex:null!==(n=t.day)&&void 0!==n?n:0,u=d?l.startHour:Mu(t.start);let h=0;if(t.allDay&&t.start&&t.end){const e=gu(t.start);e.setHours(0,0,0,0);const n=gu(t.end);n.setHours(0,0,0,0),h=Math.floor((n.getTime()-e.getTime())/864e5)}const g=gu(t.start);if(Object.assign(o,{active:!0,mode:"move",eventId:t.id,startX:e.clientX,startY:e.clientY,dayIndex:c,startHour:u,endHour:d?l.endHour:Lu(t),originalDay:null!==(r=t.day)&&void 0!==r?r:0,originalStartHour:Mu(t.start),originalEndHour:Lu(t),allDay:t.allDay||!1,eventDate:g,eventDurationDays:h,startDragDayIndex:c}),!t.allDay){o.hourOffset=u-s;const e=gu(t.start),n=gu(t.end).getTime()-e.getTime();o.duration=n/36e5}b({active:!0,mode:"move",eventId:t.id,dayIndex:null!==(a=t.day)&&void 0!==a?a:0,startHour:Mu(t.start),endHour:Lu(t),allDay:t.allDay||!1}),E(o,t.calendarId,t.title,null,i),o.sourceElement=i,o.indicatorVisible=!0,document.addEventListener("mousemove",Y),document.addEventListener("mouseup",L)}},[R,E,Z,A,Y,L,C,y,p,b]),V=r((e,t,n)=>{var r,a,o,i,s;if(e.preventDefault(),e.stopPropagation(),y.current.active)return;const l=y.current;if(R){const r=gu(t.start),a=gu(t.start),o=gu(t.end),i={hour:a.getHours(),minute:a.getMinutes(),second:a.getSeconds()},s={hour:o.getHours(),minute:o.getMinutes(),second:o.getSeconds()};l.active=!0,l.mode="resize",l.eventId=t.id,l.startX=e.clientX,l.startY=e.clientY,l.targetDate="left"===n?a:o,l.originalDate=r,l.originalEvent=Object.assign({},t),l.lastUpdateTime=Date.now(),l.resizeDirection=n,l.originalStartDate=a,l.originalEndDate=o,l.originalStartTime=i,l.originalEndTime=s,b({active:!0,mode:"resize",eventId:t.id,targetDate:"left"===n?a:o,startDate:a,endDate:o})}else if(t.allDay){const o=gu(t.start),i=gu(t.end);l.active=!0,l.mode="resize",l.eventId=t.id,l.startX=e.clientX,l.startY=e.clientY,l.allDay=!0,l.resizeDirection=n,l.originalStartDate=o,l.originalEndDate=i,l.originalEvent=Object.assign({},t),l.dayIndex=null!==(r=t.day)&&void 0!==r?r:0,b({active:!0,mode:"resize",eventId:t.id,dayIndex:null!==(a=t.day)&&void 0!==a?a:0,startHour:0,endHour:0,allDay:!0})}else{const r=C(e.clientY);Object.assign(l,{active:!0,mode:"resize",eventId:t.id,startX:e.clientX,startY:e.clientY,dayIndex:null!==(o=t.day)&&void 0!==o?o:0,startHour:Mu(t.start),endHour:Lu(t),originalDay:null!==(i=t.day)&&void 0!==i?i:0,originalStartHour:Mu(t.start),originalEndHour:Lu(t),resizeDirection:n,lastUpdateTime:Date.now(),initialMouseY:r,hourOffset:"top"===n?Mu(t.start)-r:Lu(t)-r,allDay:!1}),b({active:!0,mode:"resize",eventId:t.id,dayIndex:null!==(s=t.day)&&void 0!==s?s:0,startHour:Mu(t.start),endHour:Lu(t),allDay:!1})}document.addEventListener("mousemove",A),document.addEventListener("mouseup",Z)},[R,A,Z,C,y,b]);return{handleDragMove:A,handleDragEnd:Z,handleCreateStart:z,handleMoveStart:F,handleResizeStart:V,handleUniversalDragMove:Y,handleUniversalDragEnd:L}})({options:a,common:l,state:d,manager:c}),h=(e=>{const{options:t,common:n,state:a,manager:o,handleDragMove:i,handleDragEnd:s}=e,{viewType:l,currentWeekStart:d}=t,{dragRef:c,setDragState:u}=a,{createDragIndicator:h}=o,{pixelYToHour:g,getColumnDayIndex:f}=n,m=l===T.MONTH,v=r((e,t)=>{if(m)return;if(e.preventDefault(),e.stopPropagation(),c.current.active)return;const n=c.current;Object.assign(n,{active:!0,mode:"create",eventId:null,startX:e.clientX,startY:e.clientY,dayIndex:t,allDay:!0,eventDate:d?Ku(d,t):new Date}),u({active:!0,mode:"create",eventId:null,dayIndex:t,startHour:0,endHour:0,allDay:!0}),h(n,"blue","New All-day Event"),document.addEventListener("mousemove",i),document.addEventListener("mouseup",s)},[m,h,d,s,i,c,u]);return{handleCreateAllDayEvent:v,pixelYToHour:g,getColumnDayIndex:f}})({options:a,common:l,state:d,manager:c,handleDragMove:u.handleDragMove,handleDragEnd:u.handleDragEnd}),g=(e=>{const{common:t}=e,{daysDifference:n,addDaysToDate:r,getTargetDateFromPosition:a}=t;return{daysDifference:n,addDaysToDate:r,getTargetDateFromPosition:a}})({common:l});return Object.assign({createDragIndicator:c.createDragIndicator,updateDragIndicator:c.updateDragIndicator,removeDragIndicator:c.removeDragIndicator,handleCreateStart:u.handleCreateStart,handleMoveStart:u.handleMoveStart,handleResizeStart:u.handleResizeStart,dragState:d.dragState,isDragging:d.dragState.active},s?{daysDifference:g.daysDifference,addDaysToDate:g.addDaysToDate,getTargetDateFromPosition:g.getTargetDateFromPosition}:{handleCreateAllDayEvent:h.handleCreateAllDayEvent,pixelYToHour:h.pixelYToHour,getColumnDayIndex:h.getColumnDayIndex})};function Rg(e={}){const t=Object.assign({enableDrag:!0,enableResize:!0,enableCreate:!0,enableAllDayCreate:!0,supportedViews:[T.DAY,T.WEEK,T.MONTH]},e),n={getConfig:()=>t,updateConfig:e=>{Object.assign(t,e)},isViewSupported:e=>t.supportedViews.includes(e)};return{name:"drag",config:t,install:()=>{Z.log("Drag plugin installed - providing drag capabilities")},api:n}}function Pg(e,t){const n=e.getPlugin("drag"),r=Og(t);if(!n)return Z.warn("Drag plugin is not installed. Drag functionality will be disabled. Add createDragPlugin() to your plugins array to enable dragging."),{handleMoveStart:()=>{},handleCreateStart:()=>{},handleResizeStart:()=>{},handleCreateAllDayEvent:void 0,dragState:r.dragState,isDragging:!1};const a=n.getConfig(),o=n.isViewSupported(t.viewType);return o||console.info(`ℹ️ Drag functionality is not supported for ${t.viewType} view.`),{handleMoveStart:o&&a.enableDrag?r.handleMoveStart:()=>{},handleCreateStart:o&&a.enableCreate?r.handleCreateStart:()=>{},handleResizeStart:o&&a.enableResize?r.handleResizeStart:()=>{},handleCreateAllDayEvent:o&&a.enableAllDayCreate?r.handleCreateAllDayEvent:void 0,dragState:r.dragState,isDragging:!!o&&r.isDragging}}const $g=({handlePreviousMonth:e,handleToday:t,handleNextMonth:n})=>l("div",{className:"flex items-center gap-1",children:[d("button",{className:"calendar-nav-button group relative inline-flex items-center justify-center w-8 h-8 rounded-lg border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 hover:border-gray-300 dark:hover:border-gray-500 active:bg-gray-100 dark:active:bg-gray-600 transition-all duration-150 shadow-sm hover:shadow focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1",onClick:e,"aria-label":"Previous month",children:d(g,{className:"h-4 w-4 transition-transform group-hover:scale-110"})}),d("button",{className:"calendar-today-button inline-flex items-center justify-center px-4 py-[5px] text-sm font-medium rounded-lg border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 hover:bg-gray-50 dark:hover:bg-gray-700 hover:border-gray-300 dark:hover:border-gray-500 active:bg-gray-100 dark:active:bg-gray-600 transition-all duration-150 shadow-sm hover:shadow focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 min-w-[70px]",onClick:t,children:"Today"}),d("button",{className:"calendar-nav-button group relative inline-flex items-center justify-center w-8 h-8 rounded-lg border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 hover:border-gray-300 dark:hover:border-gray-500 active:bg-gray-100 dark:active:bg-gray-600 transition-all duration-150 shadow-sm hover:shadow focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1",onClick:n,"aria-label":"Next month",children:d(f,{className:"h-4 w-4 transition-transform group-hover:scale-110"})})]}),jg={[T.DAY]:"Day",[T.WEEK]:"Week",[T.MONTH]:"Month",[T.YEAR]:"Year"},Yg=()=>d("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"transition-transform duration-200",children:d("path",{d:"M4 6L8 10L12 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),Lg=({calendar:e,mode:t="buttons"})=>{const[r,i]=n(!1),s=o(null),c=Array.from(e.state.views.keys()),u=e.state.currentView;return a(()=>{const e=e=>{s.current&&!s.current.contains(e.target)&&i(!1)};if(r)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[r]),"select"===t?l("div",{className:"relative inline-block",ref:s,children:[l("button",{onClick:()=>i(!r),className:"flex items-center gap-2 px-3 py-1 text-sm font-medium border border-gray-200 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 transition-all duration-200 shadow-sm min-w-[120px] justify-between","aria-expanded":r,"aria-haspopup":"listbox",children:[d("span",{className:"text-gray-900 dark:text-gray-100",children:jg[u]}),d("span",{className:"text-gray-500 dark:text-gray-400 transition-transform duration-200 "+(r?"rotate-180":""),children:d(Yg,{})})]}),r&&d("div",{className:"absolute top-full mt-1 left-0 z-50 w-full min-w-[120px] bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg shadow-lg dark:shadow-gray-900/50 overflow-hidden animate-in",children:d("div",{className:"py-1",role:"listbox",children:c.map(t=>d("button",{onClick:()=>{e.changeView(t),i(!1)},className:"w-full text-left px-3 py-2 text-sm transition-colors duration-150 "+(u===t?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-medium":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700"),role:"option","aria-selected":u===t,children:jg[t]},t))})}),d("style",{children:"\n @keyframes slideIn {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n .animate-in {\n animation: slideIn 0.15s ease-out;\n }\n "})]}):d("div",{className:"inline-flex items-center gap-1 p-1 bg-gray-100 dark:bg-gray-800 rounded-lg",children:c.map(t=>d("button",{className:"px-4 py-1.5 text-sm font-medium rounded-md transition-all duration-200 "+(u===t?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 hover:bg-gray-50 dark:hover:bg-gray-700"),onClick:()=>e.changeView(t),children:jg[t]},t))})},Ag=({calendar:e,viewType:t,currentDate:n,onPrevious:r,onNext:a,onToday:o,customTitle:i,customSubtitle:s,showTodayBox:c,switcherMode:u="buttons"})=>{const h=void 0!==c?c:"day"!==t,g="buttons"===u,f=i||(()=>{switch(t){case"day":return n.toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"});case"week":case"month":return n.toLocaleDateString("en-US",{month:"long",year:"numeric"});default:return""}})(),m="day"===t?s||("day"===t?n.toLocaleDateString("en-US",{weekday:"long"}):null):null;return l("div","day"===t?{className:W,style:{position:"relative"},children:[l("div",{className:"flex-1",children:[d("div",{className:`${U} text-gray-900 dark:text-white`,children:f}),m&&d("div",{className:"mt-3 text-gray-600 dark:text-gray-400",children:m})]}),g&&d("div",{className:"absolute -translate-x-1/2",style:{left:"calc(5 / 7 * 100% + 0.5px)"},children:d(Lg,{mode:u,calendar:e})}),!g&&d("div",{className:"flex items-center gap-2",children:h&&r&&a&&o&&d($g,{handlePreviousMonth:r,handleNextMonth:a,handleToday:o})})]}:{className:W,style:{position:"relative"},children:[d("div",{children:d("h1",{className:U,children:f})}),g&&d("div",{className:"absolute left-1/2 -translate-x-1/2",children:d(Lg,{mode:u,calendar:e})}),(h||!g)&&r&&a&&o&&l("div",{className:"flex items-center gap-2",children:[!g&&d(Lg,{mode:u,calendar:e}),h&&d($g,{handlePreviousMonth:r,handleNextMonth:a,handleToday:o})]})]})},Zg=({app:r,customDetailPanelContent:o,customEventDetailDialog:i,calendarRef:s,switcherMode:c="buttons"})=>{const u=r.getCurrentDate(),h=r.getEvents(),[g,f]=n(new Date),[m,v]=n(null),[y,p]=n(null),{HOUR_HEIGHT:b,FIRST_HOUR:D,LAST_HOUR:w,TIME_COLUMN_WIDTH:x,ALL_DAY_HEIGHT:E}=Ng,M=e.useRef(null),C=t(()=>(e=>{const t=e.getDay(),n=e.getDate()-t+(0===t?-6:1),r=new Date(e);return r.setDate(n),r.setHours(0,0,0,0),r})(u),[u]),k=t(()=>h.filter(e=>{const t=gu(e.start);t.setHours(0,0,0,0);const n=new Date(u);return n.setHours(0,0,0,0),t.getTime()===n.getTime()}).map(e=>{const t=gu(e.start),n=Math.floor((t.getTime()-C.getTime())/864e5),r=Math.max(0,Math.min(6,n));return Object.assign(Object.assign({},e),{day:r})}),[h,u,C]),N=t(()=>kg.calculateDayEventLayouts(k,{viewType:"day"}),[k]),{handleMoveStart:I,handleCreateStart:S,handleResizeStart:H,handleCreateAllDayEvent:O,dragState:R,isDragging:P}=Pg(r,{calendarRef:s,allDayRowRef:M,viewType:T.DAY,onEventsUpdate:e=>{const t=e(k),n=new Set(t.map(e=>e.id)),a=k.filter(e=>!n.has(e.id)),o=new Set(k.map(e=>e.id)),i=t.filter(e=>!o.has(e.id)),s=t.filter(e=>{if(!o.has(e.id))return!1;const t=k.find(t=>t.id===e.id);return t&&(gu(t.start).getTime()!==gu(e.start).getTime()||gu(t.end).getTime()!==gu(e.end).getTime()||t.day!==e.day||Mu(t.start)!==Mu(e.start)||Mu(t.end)!==Mu(e.end)||t.title!==e.title)});a.forEach(e=>r.deleteEvent(e.id)),i.forEach(e=>r.addEvent(e)),s.forEach(e=>r.updateEvent(e.id,e))},onEventCreate:e=>{r.addEvent(e)},onEventEdit:()=>{},currentWeekStart:C,events:k,calculateNewEventLayout:(e,t,n)=>{const r=new Date(u),a=new Date(u);r.setHours(Math.floor(t),t%1*60,0,0),a.setHours(Math.floor(n),n%1*60,0,0);const o={id:"-1",title:"Temp",day:e,start:cu(r),end:cu(a),calendarId:"blue",allDay:!1},i=[...k.filter(e=>!e.allDay),o];return kg.calculateDayEventLayouts(i,{viewType:"day"}).get("-1")||null},calculateDragLayout:(e,t,n,r)=>{const a=k.map(a=>{if(a.id!==e.id)return a;const o=gu(a.start),i=Cu(o,n),s=Cu(o,r),l=cu(i),d=cu(s);return Object.assign(Object.assign({},a),{day:t,start:l,end:d})}),o=a.filter(e=>!e.allDay);if(0===o.length)return null;return kg.calculateDayEventLayouts(o,{viewType:"day"}).get(e.id)||null}}),$=e=>{r.updateEvent(e.id,e)},j=e=>{r.deleteEvent(e)},Y=Array.from({length:24},(e,t)=>({hour:t+D,label:$u(t+D)})),L=(()=>{const e=r.getCurrentDate().getFullYear(),t=r.getCurrentDate().getMonth(),n=new Date(e,t,1),a=new Date(e,t+1,0),o=[];for(let r=(0===n.getDay()?6:n.getDay()-1)-1;r>=0;r--){const n=new Date(e,t,-r);o.push({date:n.getDate(),isCurrentMonth:!1,isToday:!1,isSelected:!1,fullDate:n})}for(let n=1;n<=a.getDate();n++){const r=new Date(e,t,n),a=r.toDateString()===(new Date).toDateString(),i=r.toDateString()===u.toDateString();o.push({date:n,isCurrentMonth:!0,isToday:a,isSelected:i,fullDate:r})}const i=42-o.length;for(let n=1;n<=i;n++){const r=new Date(e,t+1,n);o.push({date:n,isCurrentMonth:!1,isToday:!1,isSelected:!1,fullDate:r})}return o})(),A=t(()=>{const e=new Date;e.setHours(0,0,0,0);const t=new Date(u);return t.setHours(0,0,0,0),t.getTime()===e.getTime()},[u]);return a(()=>{const e=setInterval(()=>f(new Date),6e4);return()=>clearInterval(e)},[]),l("div",{className:"flex h-full bg-gray-50 dark:bg-gray-800",children:[d("div",{className:`flex-none ${"buttons"===c?"":"md:w-[60%]"} w-[70%] bg-white dark:bg-gray-900 border-r border-gray-200 dark:border-gray-700`,children:l("div",{className:`relative ${pe} h-full`,children:[d(Ag,{calendar:r,viewType:T.DAY,currentDate:u,switcherMode:c,customSubtitle:g.toLocaleDateString("en-US",{weekday:"long"})}),l("div",{className:ee,ref:M,children:[d("div",{className:te,children:"all-day"}),d("div",{className:"flex flex-1 relative",children:d("div",{className:"w-full relative",style:{minHeight:`${E}px`},onDoubleClick:e=>{const t=Math.floor((u.getTime()-C.getTime())/864e5);null==O||O(e,t)},children:k.filter(e=>e.allDay).map(e=>d(yg,{event:e,isAllDay:!0,isDayView:!0,allDayHeight:E,calendarRef:s,isBeingDragged:P&&(null==R?void 0:R.eventId)===e.id&&"move"===(null==R?void 0:R.mode),hourHeight:b,firstHour:D,onMoveStart:I,onEventUpdate:$,onEventDelete:j,detailPanelEventId:y,onDetailPanelToggle:e=>p(e),customDetailPanelContent:o,customEventDetailDialog:i},e.id))})})]}),d("div",{className:q,style:{position:"relative"},children:l("div",{className:"relative flex",children:[A&&(()=>{const e=g,t=e.getHours()+e.getMinutes()/60;if(t<D||t>w)return null;return l("div",{className:K,style:{top:`${(t-D)*b}px`,width:"100%",height:0,zIndex:20},children:[l("div",{className:"flex items-center",style:{width:`${x}px`},children:[d("div",{className:"relative w-full flex items-center"}),d("div",{className:Q,children:$u(t)})]}),d("div",{className:"flex-1 flex items-center",children:d("div",{className:"h-0.5 w-full bg-red-600 relative"})})]})})(),d("div",{className:_,children:Y.map((e,t)=>d("div",{className:G,children:d("div",{className:X,children:0===t?"":e.label})},t))}),l("div",{className:"flex-grow relative",children:[Y.map((e,t)=>d("div",{className:J,onDoubleClick:e=>{var t,n,r,a;const o=Math.floor((u.getTime()-C.getTime())/864e5),i=null===(n=null===(t=s.current)||void 0===t?void 0:t.querySelector(".calendar-content"))||void 0===n?void 0:n.getBoundingClientRect();if(!i)return;const l=e.clientY-i.top+(null===(a=null===(r=s.current)||void 0===r?void 0:r.querySelector(".calendar-content"))||void 0===a?void 0:a.scrollTop)||0;S(e,o,D+l/b)}},t)),d("div",{className:"h-3 border-t border-gray-200 dark:border-gray-700 relative",children:d("div",{className:"absolute -top-2.5 -left-9 text-[12px] text-gray-500 dark:text-gray-400",children:"00.00"})}),d("div",{className:"absolute top-0 left-0 right-0 bottom-0 pointer-events-none",children:k.filter(e=>!e.allDay).map(e=>{const t=N.get(e.id);return d(yg,{event:e,layout:t,isDayView:!0,calendarRef:s,isBeingDragged:P&&(null==R?void 0:R.eventId)===e.id&&"move"===(null==R?void 0:R.mode),hourHeight:b,firstHour:D,onMoveStart:I,onResizeStart:H,onEventUpdate:$,onEventDelete:j,detailPanelEventId:y,onDetailPanelToggle:e=>p(e),customDetailPanelContent:o,customEventDetailDialog:i},e.id)})})]})]})})]})}),d("div",{className:`flex-none ${"buttons"===c?"":"md:w-[40%]"} w-[30%] bg-white dark:bg-gray-900`,children:l("div",{className:`${pe} h-full`,children:[d("div",{className:"px-2 border-b border-gray-200 dark:border-gray-700",children:l("div",{children:[l("div",{className:"flex items-center justify-end gap-2",children:[d("div",{className:W,style:{position:"relative"},children:d("div",{children:d("h1",{className:U,children:" "})})}),"select"===c?d(Lg,{mode:c,calendar:r}):null,d($g,{handlePreviousMonth:()=>r.goToPrevious(),handleNextMonth:()=>r.goToNext(),handleToday:()=>r.goToToday()})]}),l("div",{className:le,children:[Au.map(e=>d("div",{className:de,children:e.charAt(0)},e)),L.map((e,t)=>d("button",{className:`\n ${ce}\n ${e.isCurrentMonth?ue:he}\n ${e.isToday?ge:""}\n ${e.isSelected&&!e.isToday?fe:""}\n `,onClick:()=>{return t=e.fullDate,void r.setCurrentDate(t);var t},children:e.date},t))]})]})}),l("div",{className:"flex-1 p-4 overflow-y-auto",children:[d("h3",{className:"text-lg font-semibold mb-3",children:u.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric"})}),0===k.length?d("p",{className:`text-gray-500 dark:text-gray-400 ${ye}`,children:"No events for this day"}):d("div",{className:"space-y-2",children:k.map(e=>l("div",{className:`\n p-2 rounded border-l-4 cursor-pointer transition-colors\n ${(null==m?void 0:m.id)===e.id?"bg-blue-50 dark:bg-blue-900/30 border-blue-500":"bg-gray-50 dark:bg-gray-800 border-gray-300 dark:border-gray-600"}\n hover:bg-gray-100 dark:hover:bg-gray-700\n `,style:{borderLeftColor:Ru(e.calendarId||"blue")},onClick:()=>v(e),children:[d("div",{className:`font-medium ${ye}`,children:e.title}),!e.allDay&&l("div",{className:`${ve} ${me}`,children:[$u(Mu(e.start))," -"," ",$u(Lu(e))]}),e.allDay&&d("div",{className:`${ve} ${me}`,children:"All day"})]},e.id))})]})]})})]})},zg={enableDrag:!0,enableResize:!0,enableCreate:!0,showMiniCalendar:!0,showAllDay:!0,scrollToCurrentTime:!0,hourHeight:72,firstHour:0,lastHour:24,dragConfig:{supportedViews:[T.DAY],enableAllDayCreate:!0},eventsConfig:{enableAutoRecalculate:!0,enableValidation:!0},viewConfig:{showMiniCalendar:!0,showAllDay:!0,scrollToCurrentTime:!0}},Fg=(t={})=>{const n=Object.assign(Object.assign({},zg),t),r=t=>e.createElement(Ph,{viewType:T.DAY,originalComponent:Zg,app:t.app,config:n,className:"day-view-factory",customDetailPanelContent:t.customDetailPanelContent,customEventDetailDialog:t.customEventDetailDialog,calendarRef:t.calendarRef,switcherMode:t.switcherMode,meta:t.meta});return r.displayName="DayViewAdapter",{type:T.DAY,component:r,config:n}},Vg=({app:r,customDetailPanelContent:o,customEventDetailDialog:i,calendarRef:s,switcherMode:c="buttons"})=>{const u=r.getCurrentDate(),h=r.getEvents(),g=e=>{const t=e.getDay(),n=e.getDate()-t+(0===t?-6:1),r=new Date(e);return r.setDate(n),r.setHours(0,0,0,0),r},f=t(()=>g(u),[u]),[m,v]=n(new Date),[y,p]=n(null),[b,D]=n(null),{HOUR_HEIGHT:w,FIRST_HOUR:x,LAST_HOUR:E,TIME_COLUMN_WIDTH:M,ALL_DAY_HEIGHT:C}=Ng,k=e.useRef(null),N=t(()=>{const e=new Date(f);e.setDate(f.getDate()+6),e.setHours(23,59,59,999);return h.filter(t=>{const n=gu(t.start);n.setHours(0,0,0,0);const r=gu(t.end);return r.setHours(23,59,59,999),r>=f&&n<=e}).map(e=>{const t=gu(e.start),n=Math.floor((t.getTime()-f.getTime())/864e5),r=Math.max(0,Math.min(6,n));return Object.assign(Object.assign({},e),{day:r})})},[h,f]),I=t(()=>hg(N,f),[N,f]),S=t(()=>{const e=I.filter(e=>e.event.allDay);e.sort((e,t)=>{if(e.startDayIndex!==t.startDayIndex)return e.startDayIndex-t.startDayIndex;const n=e.endDayIndex-e.startDayIndex;return t.endDayIndex-t.startDayIndex-n});const t=[];return e.forEach(e=>{let n=0,r=!1;for(;!r;){t.some(t=>t.row===n&&!(e.endDayIndex<t.startDayIndex||e.startDayIndex>t.endDayIndex))?n++:r=!0}t.push(Object.assign(Object.assign({},e),{row:n}))}),t},[I]),H=t(()=>{if(0===S.length)return C;const e=Math.max(...S.map(e=>e.row));return C+e*C},[S,C]),O=t(()=>{const e=new Map;for(let t=0;t<7;t++){const n=[];N.forEach(e=>{if(e.allDay)return;const r=gg(e,f);if(r.length>0){const a=r.find(e=>e.dayIndex===t);if(a){const r=a.endHour>=24?23.99:a.endHour,o=Object.assign(Object.assign({},e),{start:cu(Cu(Ku(f,t),a.startHour)),end:cu(Cu(Ku(f,t),r)),day:t});n.push(o)}}else e.day===t&&n.push(e)});const r=kg.calculateDayEventLayouts(n,{viewType:"week"});e.set(t,r)}return e},[N,f]),{handleMoveStart:R,handleCreateStart:P,handleResizeStart:$,handleCreateAllDayEvent:j,dragState:Y,isDragging:L}=Pg(r,{calendarRef:s,allDayRowRef:k,viewType:T.WEEK,onEventsUpdate:(e,t)=>{const n=e(N),a=new Set(n.map(e=>e.id)),o=N.filter(e=>!a.has(e.id)),i=new Set(N.map(e=>e.id)),s=n.filter(e=>!i.has(e.id)),l=n.filter(e=>{if(!i.has(e.id))return!1;const t=N.find(t=>t.id===e.id);return t&&(gu(t.start).getTime()!==gu(e.start).getTime()||gu(t.end).getTime()!==gu(e.end).getTime()||t.day!==e.day||Mu(t.start)!==Mu(e.start)||Mu(t.end)!==Mu(e.end)||t.title!==e.title)});o.forEach(e=>r.deleteEvent(e.id)),s.forEach(e=>r.addEvent(e)),l.forEach(e=>r.updateEvent(e.id,e,t))},onEventCreate:e=>{r.addEvent(e)},onEventEdit:()=>{},currentWeekStart:f,events:N,calculateNewEventLayout:(e,t,n)=>{const r=new Date,a=new Date;r.setHours(Math.floor(t),t%1*60,0,0),a.setHours(Math.floor(n),n%1*60,0,0);const o={id:"-1",title:"Temp",day:e,start:cu(r),end:cu(a),calendarId:"blue",allDay:!1},i=[...N.filter(t=>t.day===e&&!t.allDay),o];return kg.calculateDayEventLayouts(i,{viewType:"week"}).get("-1")||null},calculateDragLayout:(e,t,n,r)=>{const a=N.map(a=>{if(a.id!==e.id)return a;const o=gu(a.start),i=Cu(o,n),s=Cu(o,r),l=cu(i),d=cu(s);return Object.assign(Object.assign({},a),{day:t,start:l,end:d})}),o=a.filter(e=>e.day===t&&!e.allDay);if(0===o.length)return null;return kg.calculateDayEventLayouts(o,{viewType:"week"}).get(e.id)||null}}),A=t(()=>["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],[]),Z=Array.from({length:24},(e,t)=>({hour:t+x,label:$u(t+x)})),z=t(()=>{const e=new Date;return e.setHours(0,0,0,0),A.map((t,n)=>{const r=new Date(f);r.setDate(f.getDate()+n);const a=new Date(r);return a.setHours(0,0,0,0),{date:r.getDate(),month:r.toLocaleString("default",{month:"short"}),fullDate:new Date(r),isToday:a.getTime()===e.getTime()}})},[f,A]),F=e=>{r.updateEvent(e.id,e)},V=e=>{r.deleteEvent(e)},B=t(()=>{const e=new Date,t=g(e);return f.getTime()===t.getTime()},[f]);return a(()=>{const e=setInterval(()=>v(new Date),6e4);return()=>clearInterval(e)},[]),l("div",{className:"relative flex flex-col bg-white dark:bg-gray-900 w-full overflow-hidden h-full",children:[d(Ag,{calendar:r,viewType:T.WEEK,currentDate:u,switcherMode:c,onPrevious:()=>r.goToPrevious(),onNext:()=>r.goToNext(),onToday:()=>r.goToToday()}),l("div",{className:"flex border-b border-gray-200 dark:border-gray-700",children:[d("div",{className:"w-20 p-2"}),A.map((e,t)=>l("div",{className:"flex flex-1 justify-center items-center text-center text-gray-500 dark:text-gray-400 text-sm p-1",children:[d("div",{className:"inline-flex items-center justify-center text-sm h-6 w-6 mt-1 mr-1",children:e}),d("div",{className:"inline-flex items-center justify-center h-6 w-6 rounded-full text-sm mt-1",children:z[t].date})]},t))]}),l("div",{className:ee,ref:k,children:[d("div",{className:te,children:"all-day"}),l("div",{className:"flex flex-1 relative",style:{minHeight:`${H}px`},children:[A.map((e,t)=>d("div",{className:"flex-1 border-r border-gray-200 dark:border-gray-700 relative",style:{minHeight:`${H}px`},onDoubleClick:e=>null==j?void 0:j(e,t)},`allday-${t}`)),d("div",{className:"absolute inset-0 pointer-events-none",children:S.map(e=>d(yg,{event:e.event,segment:e,segmentIndex:e.row,isAllDay:!0,isMultiDay:!0,allDayHeight:C,calendarRef:s,isBeingDragged:L&&(null==Y?void 0:Y.eventId)===e.event.id&&"move"===(null==Y?void 0:Y.mode),hourHeight:w,firstHour:x,onMoveStart:R,onResizeStart:$,onEventUpdate:F,onEventDelete:V,selectedEventId:b,detailPanelEventId:y,onEventSelect:e=>D(e),onDetailPanelToggle:e=>p(e),customDetailPanelContent:o,customEventDetailDialog:i},e.id))})]})]}),d("div",{className:q,style:{position:"relative"},children:l("div",{className:"relative flex",children:[B&&(()=>{const e=m,t=e.getHours()+e.getMinutes()/60;if(t<x||t>E)return null;const n=e.getDay(),r=0===n?6:n-1;return l("div",{className:K,style:{top:`${(t-x)*w}px`,width:"100%",height:0,zIndex:20},children:[l("div",{className:"flex items-center",style:{width:`${M}px`},children:[d("div",{className:"relative w-full flex items-center"}),d("div",{className:Q,children:$u(t)})]}),d("div",{className:"flex flex-1",children:A.map((e,t)=>d("div",{className:"flex-1 flex items-center",children:d("div",{className:"h-0.5 w-full relative "+(t===r?"bg-red-600 dark:bg-red-500":"bg-red-100 dark:bg-red-900/30"),style:{zIndex:9999},children:t===r&&0!==r&&d("div",{className:"absolute w-2 h-2 bg-red-700 dark:bg-red-500 rounded-full",style:{top:"-3px",left:"-4px"}})})},t))})]})})(),d("div",{className:_,children:Z.map((e,t)=>d("div",{className:G,children:d("div",{className:X,children:0===t?"":e.label})},t))}),l("div",{className:"flex-grow relative",children:[Z.map((e,t)=>d("div",{className:J,children:A.map((n,r)=>d("div",{className:"flex-1 relative border-r border-gray-200 dark:border-gray-700",onDoubleClick:t=>{P(t,r,e.hour)}},`${t}-${r}`))},t)),l("div",{className:"h-3 border-t border-gray-200 dark:border-gray-700 flex relative",children:[d("div",{className:"absolute -top-2.5 -left-9 text-[12px] text-gray-500 dark:text-gray-400",children:"00.00"}),A.map((e,t)=>d("div",{className:"flex-1 relative border-r border-gray-200 dark:border-gray-700"},`24-${t}`))]}),A.map((e,t)=>{const n=Xu(t,N),r=[];return n.forEach(e=>{const n=gg(e,f);if(n.length>0){const a=n.find(e=>e.dayIndex===t);a&&r.push({event:e,segmentInfo:Object.assign(Object.assign({},a),{dayIndex:t})})}else r.push({event:e})}),N.forEach(e=>{if(e.allDay||e.day===t)return;const n=gg(e,f).find(e=>e.dayIndex===t);n&&r.push({event:e,segmentInfo:Object.assign(Object.assign({},n),{dayIndex:t})})}),d("div",{className:"absolute top-0 pointer-events-none",style:{left:`calc(${100/7*t}%)`,width:100/7+"%",height:"100%"},children:r.map(({event:e,segmentInfo:n})=>{const r=O.get(t),a=null==r?void 0:r.get(e.id);return d(yg,{event:e,layout:a,calendarRef:s,isBeingDragged:L&&(null==Y?void 0:Y.eventId)===e.id&&"move"===(null==Y?void 0:Y.mode),hourHeight:w,firstHour:x,onMoveStart:R,onResizeStart:$,onEventUpdate:F,onEventDelete:V,selectedEventId:b,detailPanelEventId:y,onEventSelect:e=>D(e),onDetailPanelToggle:e=>p(e),customDetailPanelContent:o,customEventDetailDialog:i,multiDaySegmentInfo:n},n?`${e.id}-seg-${t}`:e.id)})},`events-day-${t}`)})]})]})})]})},Bg={enableDrag:!0,enableResize:!0,enableCreate:!0,showWeekends:!0,showAllDay:!0,startOfWeek:1,scrollToCurrentTime:!0,hourHeight:72,firstHour:0,lastHour:24,dragConfig:{supportedViews:[T.WEEK],enableAllDayCreate:!0},eventsConfig:{enableAutoRecalculate:!0,enableValidation:!0},viewConfig:{showWeekends:!0,showAllDay:!0,startOfWeek:1,scrollToCurrentTime:!0}},Wg=(t={})=>{const n=Object.assign(Object.assign({},Bg),t),r=t=>e.createElement(Ph,{viewType:T.WEEK,originalComponent:Vg,app:t.app,config:n,className:"week-view-factory",customDetailPanelContent:t.customDetailPanelContent,customEventDetailDialog:t.customEventDetailDialog,calendarRef:t.calendarRef,switcherMode:t.switcherMode,meta:t.meta});return r.displayName="WeekViewAdapter",{type:T.WEEK,component:r,config:n}},Ug=2,qg=50,_g=1900,Gg=2200,Xg=8,Jg=150,Kg=1400,Qg=1e3,ef=900;class tf{static trackScrollEvent(e=0){this.metrics.scrollEvents++,this.metrics.totalScrollDistance+=Math.abs(e),this.metrics.avgScrollDelta=this.metrics.totalScrollDistance/this.metrics.scrollEvents}static trackRenderTime(e){this.metrics.renderTime.push(e),e>16.67&&this.metrics.frameDrops++,this.metrics.renderTime.length>100&&this.metrics.renderTime.shift()}static trackCacheHit(){this.metrics.cacheHits++}static trackCacheMiss(){this.metrics.cacheMisses++}static getMetrics(){const e=this.metrics.renderTime.length>0?this.metrics.renderTime.reduce((e,t)=>e+t,0)/this.metrics.renderTime.length:0,t=this.metrics.cacheHits+this.metrics.cacheMisses>0?this.metrics.cacheHits/(this.metrics.cacheHits+this.metrics.cacheMisses)*100:0,n=Date.now()-this.metrics.startTime,r=e>0?1e3/e:0;return{scrollEvents:this.metrics.scrollEvents,avgRenderTime:Math.round(100*e)/100,cacheHitRate:Math.round(100*t)/100,uptime:Math.round(n/1e3),scrollEventsPerSecond:Math.round(this.metrics.scrollEvents/(n/1e3)*100)/100,estimatedFPS:Math.round(r),frameDrops:this.metrics.frameDrops,avgScrollDelta:Math.round(100*this.metrics.avgScrollDelta)/100}}static reset(){this.metrics={scrollEvents:0,renderTime:[],cacheHits:0,cacheMisses:0,startTime:Date.now(),frameDrops:0,avgScrollDelta:0,totalScrollDistance:0}}}tf.metrics={scrollEvents:0,renderTime:[],cacheHits:0,cacheMisses:0,startTime:Date.now(),frameDrops:0,avgScrollDelta:0,totalScrollDistance:0};class nf{constructor(e=qg){this.cache=new Map,this.accessOrder=[],this.maxSize=e}get(e){const t=this.cache.get(e);if(t)return tf.trackCacheHit(),this.updateAccessOrder(e),t;tf.trackCacheMiss()}set(e,t){if(this.cache.size>=this.maxSize){const e=this.accessOrder.shift();void 0!==e&&this.cache.delete(e)}this.cache.set(e,t),this.updateAccessOrder(e)}updateAccessOrder(e){const t=this.accessOrder.indexOf(e);t>-1&&this.accessOrder.splice(t,1),this.accessOrder.push(e)}getSize(){return this.cache.size}getHitRate(){return tf.getMetrics().cacheHitRate}clear(){this.cache.clear(),this.accessOrder=[]}}const rf=()=>{const[e,t]=n({yearHeight:ef,screenSize:"desktop"});return a(()=>{const e=()=>{const e=window.innerWidth;t(e<768?{yearHeight:Kg,screenSize:"mobile"}:e<1024?{yearHeight:Qg,screenSize:"tablet"}:{yearHeight:ef,screenSize:"desktop"})};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e},af=({currentDate:e,yearHeight:i,onCurrentYearChange:s})=>{const l=e.getFullYear(),d=(l-_g)*i,[c,u]=n(d),[h,g]=n(600),[f,m]=n(l),[v,y]=n(!1),p=o(document.createElement("div")),b=o(null),D=o(0),w=o(0),x=t(()=>{const e=performance.now(),t=Gg-_g+1,n=t*i,r=Math.floor(c/i),a=Math.min(t-1,Math.ceil((c+h)/i)),o=Math.max(0,r-Ug),s=Math.min(t-1,a+Ug),l=[];for(let e=o;e<=s;e++)l.push({index:e,year:_g+e,top:e*i,height:i});const d=performance.now()-e;return tf.trackRenderTime(d),{totalHeight:n,visibleItems:l}},[c,h,i]),E=r(e=>{const t=performance.now();if(t-D.current<Xg)return;D.current=t;const n=e.currentTarget.scrollTop,r=Math.abs(n-w.current);w.current=n,tf.trackScrollEvent(r),requestAnimationFrame(()=>{u(n);const e=n+h/2,t=Math.round(_g+e/i);t!==f&&t>=_g&&t<=Gg&&(m(t),null==s||s(t))}),y(!0),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{y(!1)},Jg)},[h,f,i,s]);a(()=>{const e=p.current;if(!e)return;e.scrollTop=d;const t=new ResizeObserver(([e])=>{g(e.contentRect.height)});return t.observe(e),()=>t.disconnect()},[d]);const M=r((e,t=!0)=>{if(!p.current)return;const n=(e-_g)*i-h/2+i/2;p.current.scrollTo({top:Math.max(0,n),behavior:t?"smooth":"auto"})},[i,h]),C=r(()=>{const e=Math.max(_g,f-1);m(e),M(e)},[f,M]),k=r(()=>{const e=Math.min(Gg,f+1);m(e),M(e)},[f,M]),N=r(()=>{const e=(new Date).getFullYear();m(e),M(e)},[M]);return a(()=>()=>{b.current&&clearTimeout(b.current)},[]),{scrollTop:c,containerHeight:h,currentYear:f,isScrolling:v,virtualData:x,scrollElementRef:p,handleScroll:E,scrollToYear:M,handlePreviousYear:C,handleNextYear:k,handleToday:N,setScrollTop:u,setContainerHeight:g,setCurrentYear:m,setIsScrolling:y}},of=()=>{const[e,t]=n({weekHeight:P,screenSize:"desktop",weeksPerView:6});return a(()=>{const e=()=>{const e=window.innerWidth,n=window.innerHeight-150,r=Math.max(80,Math.floor(n/6)),a=e<768?{weekHeight:Math.max(O,r),screenSize:"mobile",weeksPerView:6}:e<1024?{weekHeight:Math.max(R,r),screenSize:"tablet",weeksPerView:6}:{weekHeight:Math.max(P,r),screenSize:"desktop",weeksPerView:6};t(a)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e},sf=({currentDate:e,weekHeight:i,onCurrentMonthChange:s,initialWeeksToLoad:l=104})=>{const d=o(null),c=t(()=>{const t=new Date(e);return t.setDate(1),t.setHours(0,0,0,0),Gu(t,l)},[e,l]),u=t(()=>{const t=new Date(e);t.setDate(1),t.setHours(0,0,0,0);const n=c.findIndex(e=>e.days.some(e=>e.date.toDateString()===t.toDateString()));return n>0?n*i:0},[c,e,i]),[h,g]=n(u),[f,m]=n(600),[v,y]=n(zu[e.getMonth()]),[p,b]=n(e.getFullYear()),[D,w]=n(!1),[x,E]=n(c),[M,C]=n(!1),k=o(!1),[N,T]=n(!1),I=o(e),O=o(null),R=o(null),P=o(new $),j=o(0),Y=o(0),L=o(!1),A=r(e=>{e&&(O.current=e)},[]),Z=r(e=>{let t=P.current.get(e);return t||(t=Uu(e),P.current.set(e,t)),t},[]),z=r((e,t=26)=>{L.current||(L.current=!0,setTimeout(()=>{try{if("future"===e){const e=x[x.length-1],n=[];for(let r=1;r<=t;r++){const t=new Date(e.startDate);t.setDate(t.getDate()+7*r),n.push(Z(t))}E(e=>[...e,...n])}else{const e=x[0],n=[];for(let r=t;r>=1;r--){const t=new Date(e.startDate);t.setDate(t.getDate()-7*r),n.push(Z(t))}const r=n.length*i;E(e=>[...n,...e]),requestAnimationFrame(()=>{g(e=>e+r),O.current&&(O.current.scrollTop+=r)})}}finally{setTimeout(()=>{L.current=!1},200)}},0))},[x,Z,i]),F=t(()=>{const e=x.length*i,t=Math.floor(h/i);let n=Math.max(0,t);n=Math.min(n,Math.max(0,x.length-6));const r=Math.min(x.length-1,n+6-1),a=Math.max(0,n-15),o=Math.min(x.length-1,r+15),s=[];for(let e=a;e<=o;e++)s.push({index:e,weekData:x[e],top:e*i,height:i});return{totalHeight:e,visibleItems:s,displayStartIndex:n}},[h,f,i,x]),V=r(e=>{if(M||D||0===e.length||!N)return;const t=h+f/2,n=e.find(e=>e.top<=t&&e.top+e.height>t)||e[Math.floor(e.length/2)];if(!n)return;const r={};n.weekData.days.forEach(e=>{const t=`${zu[e.month]}-${e.year}`;r[t]=(r[t]||0)+1});let a="",o=0,i=0;Object.entries(r).forEach(([e,t])=>{if(t>i){i=t;const[n,r]=e.split("-");a=n,o=parseInt(r)}}),a&&o&&(d.current?a===d.current.month&&o===d.current.year&&(d.current=null,a===v&&o===p||(y(a),b(o),null==s||s(a,o))):a===v&&o===p||(y(a),b(o),null==s||s(a,o)))},[f,v,p,M,D,s,h,N]),B=r(e=>{const t=performance.now();if(t-j.current<S)return;j.current=t;const n=e.currentTarget,r=n.scrollTop;Y.current=r,g(r),M||requestAnimationFrame(()=>{const{scrollHeight:e,clientHeight:t}=n;r+t>e-10*i&&!L.current&&z("future",26),r<10*i&&!L.current&&z("past",26)}),w(!0),R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{w(!1)},H)},[i,z,M]),W=r((e,t=!0)=>{if(!O.current)return;C(!0),k.current=!0;const n=()=>{setTimeout(()=>{C(!1),k.current=!1},t?500:200)},r=x.findIndex(t=>t.days.some(t=>t.date.toDateString()===e.toDateString()));if(-1!==r){const e=r*i;return O.current.scrollTo({top:e,behavior:t?"smooth":"auto"}),void n()}const a=e.getDay(),o=0===a?6:a-1,s=new Date(e);s.setDate(e.getDate()-o),s.setHours(0,0,0,0);const l=x[0],d=x[x.length-1];let c=0,u=!1,h=!1;s<l.startDate?(c=Math.ceil((l.startDate.getTime()-s.getTime())/6048e5),u=!0):s>d.startDate&&(c=Math.ceil((s.getTime()-d.startDate.getTime())/6048e5),h=!0);const f=Math.min(c+10,52);if(u){const r=[];for(let e=f;e>=1;e--){const t=new Date(l.startDate);t.setDate(t.getDate()-7*e),r.push(Z(t))}const a=r.length*i;E(e=>[...r,...e]),requestAnimationFrame(()=>{const o=[...r,...x].findIndex(t=>t.days.some(t=>t.date.toDateString()===e.toDateString()));if(O.current&&-1!==o){const e=o*i;O.current.scrollTop+=a,g(e=>e+a),setTimeout(()=>{O.current&&O.current.scrollTo({top:e,behavior:t?"smooth":"auto"})},50)}n()})}else if(h){const r=[];for(let e=1;e<=f;e++){const t=new Date(d.startDate);t.setDate(t.getDate()+7*e),r.push(Z(t))}E(e=>[...e,...r]),requestAnimationFrame(()=>{const a=[...x,...r].findIndex(t=>t.days.some(t=>t.date.toDateString()===e.toDateString()));if(O.current&&-1!==a){const e=a*i;O.current.scrollTo({top:e,behavior:t?"smooth":"auto"})}n()})}else n()},[x,i,Z]),U=r(()=>{const e="January"===v?11:zu.indexOf(v)-1,t=new Date("January"===v?p-1:p,e,1);W(t)},[v,p,W]),q=r(()=>{const e="December"===v?0:zu.indexOf(v)+1,t=new Date("December"===v?p+1:p,e,1);W(t)},[v,p,W]),_=r(()=>{const e=new Date,t=zu[e.getMonth()],n=e.getFullYear(),r=new Date(n,e.getMonth(),1);d.current={month:t,year:n},y(t),b(n),null==s||s(t,n);const a=x.findIndex(e=>e.days.some(e=>e.date.toDateString()===r.toDateString()));if(-1!==a){const e=a*i,t=O.current;t&&(C(!0),k.current=!0,requestAnimationFrame(()=>{g(e),requestAnimationFrame(()=>{t&&(t.scrollTop=e,setTimeout(()=>{k.current=!1,C(!1)},200))})}))}else C(!0),k.current=!0,requestAnimationFrame(()=>{W(r,!0),setTimeout(()=>{k.current=!1,C(!1)},200)})},[x,i,s,W]);return a(()=>{V(F.visibleItems)},[F.visibleItems,V]),a(()=>{const t=I.current,n=t.getMonth(),r=t.getFullYear(),a=e.getMonth(),o=e.getFullYear();if(n!==a||r!==o){const e=new Date(o,a,1),t=zu[a];d.current={month:t,year:o},y(t),b(o),null==s||s(t,o),W(e,!0)}I.current=e},[e,s,W]),a(()=>{const e=O.current;if(!e)return;const t=new ResizeObserver(([e])=>{m(e.contentRect.height)});return t.observe(e),()=>t.disconnect()},[]),a(()=>{const e=O.current;e&&!N&&requestAnimationFrame(()=>{e&&u>0?(e.scrollTop=u,T(!0)):e&&T(!0)})},[N,u]),a(()=>()=>{R.current&&clearTimeout(R.current)},[]),{scrollTop:h,containerHeight:f,currentMonth:v,currentYear:p,isScrolling:D,virtualData:F,scrollElementRef:O,handleScroll:B,scrollToDate:W,handlePreviousMonth:U,handleNextMonth:q,handleToday:_,setScrollTop:g,setContainerHeight:m,setCurrentMonth:y,setCurrentYear:b,setIsScrolling:w,cache:P.current,scrollElementRefCallback:A,weeksData:x}},lf=e.memo(({currentMonth:e,currentYear:r,newlyCreatedEventId:i,isScrolling:s,isDragging:c,item:u,weekHeight:h,events:g,dragState:f,calendarRef:m,onEventUpdate:v,onEventDelete:y,onMoveStart:p,onCreateStart:b,onResizeStart:D,onDetailPanelOpen:w,onMoreEventsClick:x,onChangeView:E,onSelectDate:M,selectedEventId:C,onEventSelect:k,detailPanelEventId:N,onDetailPanelToggle:I,customDetailPanelContent:S,customEventDetailDialog:H})=>{const[O,R]=n(!1),P=o(null),$=t(()=>(e=>{const t=e-33-20,n=Math.floor(t/17);return Math.max(0,Math.min(4,n))})(h),[h]);a(()=>s?(R(!0),P.current&&(clearTimeout(P.current),P.current=null),()=>{P.current&&(clearTimeout(P.current),P.current=null)}):O?(P.current=setTimeout(()=>{R(!1),P.current=null},100),()=>{P.current&&(clearTimeout(P.current),P.current=null)}):void 0,[s,O]);const{weekData:j}=u,Y=j.days.find(e=>1===e.day),L=`${h}px`,A=t(()=>hg(g,j.startDate),[g,j.startDate]),z=t(()=>(e=>{const t=[];return e.forEach(e=>{if(!e.start||!e.end)return void Z.warn("Event missing start or end date:",e);const n=gu(e.start),r=gu(e.end),a=new Date(n);a.setHours(0,0,0,0);const o=new Date(r);o.setHours(0,0,0,0);let i=new Date(o);if(!e.allDay&&0===r.getHours()&&0===r.getMinutes()&&0===r.getSeconds()){const e=r.getTime()-n.getTime();e>0&&e<864e5&&(i=new Date(o),i.setDate(i.getDate()-1))}const s=a.toDateString()!==i.toDateString();if(!s||e.allDay)if(s&&e.allDay){const a=new Date(n);for(;a<=r;){const n=ou.PlainDate.from({year:a.getFullYear(),month:a.getMonth()+1,day:a.getDate()});t.push(Object.assign(Object.assign({},e),{start:n,end:n,day:a.getDay()})),a.setDate(a.getDate()+1)}}else t.push(Object.assign(Object.assign({},e),{start:e.start,end:e.end,day:n.getDay()}))}),t})(g),[g]),F=t(()=>(e=>{const t=[...e].sort((e,t)=>{const n=e.endDayIndex-e.startDayIndex+1,r=t.endDayIndex-t.startDayIndex+1;return e.startDayIndex>t.startDayIndex?1:n!==r?r-n:e.startDayIndex-t.startDayIndex}),n=[];t.forEach(e=>{let t=0,r=!1;for(;!r;)n.some(n=>{var r;const a=Math.abs((null!==(r=n.yPosition)&&void 0!==r?r:0)-t)<16,o=!(e.endDayIndex<n.startDayIndex||e.startDayIndex>n.endDayIndex);return a&&o})?t+=16:r=!0;n.push(Object.assign(Object.assign({},e),{yPosition:t}))});const r=[];return n.forEach(e=>{var t;const n=Math.floor((null!==(t=e.yPosition)&&void 0!==t?t:0)/16);r[n]||(r[n]=[]),r[n].push(e)}),r.forEach(e=>{e.sort((e,t)=>e.startDayIndex-t.startDayIndex)}),r})(A),[A]),V=t(()=>{const e=Array(7).fill(0);return F.forEach((t,n)=>{t.forEach(t=>{for(let r=t.startDayIndex;r<=t.endDayIndex;r++)e[r]=Math.max(e[r],n+1)})}),e},[F]),B=t(()=>Math.max(0,17*F.length),[F]),W=(t,n)=>{var a;const o=t.month===zu.indexOf(e)&&t.year===r;var s;const u=(e=>[...e].sort((e,t)=>e.allDay!==t.allDay?e.allDay?-1:1:e.allDay&&t.allDay?0:Mu(e.start)-Mu(t.start)))((s=t.date,z.filter(e=>{if(!e.start||!e.end)return gu(e.start).toDateString()===s.toDateString();const t=gu(e.start),n=gu(e.end);if(!e.allDay&&0===n.getHours()&&0===n.getMinutes()&&0===n.getSeconds()){const e=n.getTime()-t.getTime();if(e>0&&e<864e5)return t.toDateString()===s.toDateString()}return t.toDateString()===s.toDateString()||n.toDateString()===s.toDateString()}))),h=u.slice(0,$),g=u.length-h.length,O=g>0,R=[],P=null!==(a=V[n])&&void 0!==a?a:0;for(let e=0;e<P;e++)R.push(d("div",{className:"flex-shrink-0",style:{height:"17px",minHeight:"17px"}},`placeholder-layer-${e}-${t.date.getTime()}`));return h.forEach((e,t)=>{const n=F.flat().find(t=>t.originalEventId===e.id);e.allDay&&n||R.push(d(yg,{event:e,isAllDay:!!e.allDay,isMonthView:!0,calendarRef:m,hourHeight:72,firstHour:0,onEventUpdate:v,onEventDelete:y,onMoveStart:p,onResizeStart:D,isBeingDragged:c&&f.eventId===e.id&&"move"===f.mode,newlyCreatedEventId:i,onDetailPanelOpen:w,selectedEventId:C,onEventSelect:k,detailPanelEventId:N,onDetailPanelToggle:I,customDetailPanelContent:S,customEventDetailDialog:H},`${e.id}-${e.day}-${Mu(e.start)}-${t}`))}),l("div",{className:`\n relative flex flex-col border-r border-gray-200 dark:border-gray-700 last:border-r-0\n ${o?"text-gray-800 dark:text-gray-100":"text-gray-400 dark:text-gray-600"}\n `,style:{height:L},"data-date":(j=t.date,`${j.getFullYear()}-${String(j.getMonth()+1).padStart(2,"0")}-${String(j.getDate()).padStart(2,"0")}`),onDoubleClick:e=>b(e,t.date),children:[l("div",{className:"flex items-start justify-between p-2 pb-1 relative z-20",children:[d("div",{className:"flex-1"}),l("div",{className:"flex items-center",children:[d("span",{className:`\n inline-flex items-center justify-center h-5 w-5 rounded-full text-sm font-medium\n ${t.isToday?"bg-blue-500 text-white":o?"text-gray-900 dark:text-gray-100":"text-gray-400 dark:text-gray-600"}\n `,children:t.day}),1===t.day&&d("span",{className:"text-xs text-gray-500 dark:text-gray-400 ml-1",children:t.shortMonthName})]})]}),l("div",{className:"flex-1 overflow-hidden px-1",children:[R,O&&l("div",{className:"text-xs text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 cursor-pointer hover:underline",onClick:e=>{e.stopPropagation(),x?x(t.date):(null==M||M(t.date),null==E||E(T.DAY))},children:["+",g," more"]})]})]},`day-${t.date.getTime()}`);var j};return l("div",{className:"relative select-none border-b border-gray-200 dark:border-gray-700",style:{height:L},children:[Y&&d("div",{className:`\n absolute top-10 left-0 z-30 bg-white/50 dark:bg-gray-900/50 py-2 px-2 duration-300\n ${O?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"}\n `,style:{transition:"opacity 0.5s ease",maxWidth:"fit-content"},children:l("span",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:[Y.monthName," ",Y.year]})}),d("div",{className:"h-full flex flex-col",children:l("div",{className:"calendar-week relative h-full",children:[d("div",{className:"grid grid-cols-7 h-full",children:j.days.map((e,t)=>W(e,t))}),F.length>0&&d("div",{className:"absolute left-0 right-0 pointer-events-none",style:{top:"33px",height:`${B}px`,zIndex:10},children:F.map((e,t)=>d("div",{className:"absolute inset-0",children:e.map(e=>d(yg,{event:e.event,isAllDay:!!e.event.allDay,segment:e,segmentIndex:t,isMonthView:!0,isMultiDay:!0,calendarRef:m,hourHeight:72,firstHour:0,onEventUpdate:v,onEventDelete:y,onMoveStart:p,onResizeStart:D,isBeingDragged:c&&f.eventId===e.event.id&&"move"===f.mode,isBeingResized:c&&f.eventId===e.event.id&&"resize"===f.mode,newlyCreatedEventId:i,onDetailPanelOpen:w,selectedEventId:C,onEventSelect:k,detailPanelEventId:N,onDetailPanelToggle:I,customDetailPanelContent:S,customEventDetailDialog:H},e.id))},`layer-${t}`))})]})})]})});lf.displayName="WeekComponent";const df=({app:e,customDetailPanelContent:r,customEventDetailDialog:i,calendarRef:s,switcherMode:c="buttons"})=>{const u=e.getCurrentDate(),h=e.getEvents(),g=o(null),f=t(()=>{const e=g.current;return e&&e.length===h.length&&e.every((e,t)=>e===h[t])?e:(g.current=h,h)},[h]),m=t(()=>{const e=new Map,t=e=>{const t=new Date(e);t.setHours(0,0,0,0);const n=t.getDay(),r=0===n?-6:1-n;return t.setDate(t.getDate()+r),t.setHours(0,0,0,0),t},n=(t,n)=>{const r=e.get(t);r?r.push(n):e.set(t,[n])};return f.forEach(e=>{if(!e.start)return;const r=gu(e.start),a=e.end?gu(e.end):r,o=new Date(r);o.setHours(0,0,0,0);const i=new Date(a);i.setHours(0,0,0,0);let s=new Date(i);if(!e.allDay){0!==a.getHours()||0!==a.getMinutes()||0!==a.getSeconds()||0!==a.getMilliseconds()||s.setDate(s.getDate()-1)}s<o&&(s=new Date(o));const l=t(o),d=t(s);let c=l.getTime();const u=d.getTime();for(;c<=u;){n(c,e);const t=new Date(c);t.setDate(t.getDate()+7),t.setHours(0,0,0,0),c=t.getTime()}}),e},[f]),{screenSize:v}=of(),[y,p]=n(()=>{if("undefined"!=typeof window){const e=150,t=window.innerHeight-e;return Math.max(80,Math.floor(t/6))}return 119}),[b,D]=n(!1),w=o(y),x=o([]),[E,M]=n(null),[C,k]=n(null),[N,I]=n(null),S=t(()=>{const e=u.getDay(),t=u.getDate()-e+(0===e?-6:1),n=new Date(u);return n.setDate(t),n.setHours(0,0,0,0),n},[u]),{handleMoveStart:H,handleCreateStart:O,handleResizeStart:R,dragState:P,isDragging:$}=Pg(e,{calendarRef:s,viewType:T.MONTH,onEventsUpdate:(t,n)=>{const r=t(f),a=new Set(r.map(e=>e.id)),o=f.filter(e=>!a.has(e.id)),i=new Set(f.map(e=>e.id)),s=r.filter(e=>!i.has(e.id)),l=r.filter(e=>{if(!i.has(e.id))return!1;const t=f.find(t=>t.id===e.id);return t&&(gu(t.start).getTime()!==gu(e.start).getTime()||gu(t.end).getTime()!==gu(e.end).getTime()||t.day!==e.day||Mu(t.start)!==Mu(e.start)||Mu(t.end)!==Mu(e.end)||t.title!==e.title||(null==t?void 0:t.start)!==(null==e?void 0:e.start)||(null==t?void 0:t.end)!==(null==e?void 0:e.end))});o.forEach(t=>e.deleteEvent(t.id)),s.forEach(t=>e.addEvent(t)),l.forEach(t=>e.updateEvent(t.id,t,n))},onEventCreate:t=>{e.addEvent(t)},onEventEdit:e=>{M(e.id)},currentWeekStart:S,events:f}),{currentMonth:j,currentYear:Y,isScrolling:L,virtualData:A,scrollElementRef:Z,handleScroll:z,handlePreviousMonth:F,handleNextMonth:V,handleToday:B,setScrollTop:W}=sf({currentDate:u,weekHeight:y,onCurrentMonthChange:(t,n)=>{const r=zu.indexOf(t);r>=0&&e.setVisibleMonth(new Date(n,r,1))},initialWeeksToLoad:156}),U=o(0),[q,_]=n(0),G=t(()=>q-6*y,[q,y]),{visibleWeeks:X,startIndex:J}=t(()=>{const{visibleItems:e,displayStartIndex:t}=A,n=e.findIndex(e=>e.index===t);if(-1===n)return x.current.length>0?{visibleWeeks:x.current,startIndex:U.current}:{visibleWeeks:[],startIndex:t};const r=e.slice(n,n+8);return r.length>=6&&(x.current=r,U.current=t),{visibleWeeks:r,startIndex:t}},[A]),K=t(()=>J*y,[J,y]),Q=t(()=>{const e=A.totalHeight,t=J*y+16*y+G;return Math.max(0,e-t)},[A.totalHeight,J,y,G]);a(()=>{const e=Z.current;if(!e)return;const t=new ResizeObserver(t=>{for(const n of t){const t=n.contentRect.height;if(_(t),!b&&t>0){const n=Math.max(80,Math.floor(t/6));if(n!==w.current){const t=e.scrollTop;if(t>0){const r=Math.round(t/w.current)*n;e.scrollTop=r,W(r)}}p(n),w.current=n,requestAnimationFrame(()=>{D(!0)})}}});return t.observe(e),()=>{t.disconnect()}},[Z,b,W]);const ee=t=>{e.updateEvent(t.id,t)},te=t=>{e.deleteEvent(t)},ne=t=>{e.changeView(t)};return l("div",{className:"h-full flex flex-col bg-white dark:bg-gray-900",children:[d(Ag,{calendar:e,viewType:T.MONTH,currentDate:u,customTitle:`${j} ${Y}`,onPrevious:F,onNext:V,onToday:B,switcherMode:c}),d("div",{className:"sticky top-0 z-10 bg-white dark:bg-gray-900 border-b border-gray-200 dark:border-gray-700",children:d("div",{className:"grid grid-cols-7 px-2",children:Au.map((e,t)=>d("div",{className:"text-right text-gray-500 dark:text-gray-400 text-sm py-2 pr-2",children:e},t))})}),l("div",{ref:Z,className:"flex-1 overflow-auto will-change-scroll",style:{scrollSnapType:"y mandatory",overflow:"hidden auto",visibility:b?"visible":"hidden"},onScroll:z,children:[d("div",{style:{height:K}}),X.map((t,n)=>{var a;const o=null!==(a=m.get(t.weekData.startDate.getTime()))&&void 0!==a?a:[],l=5===n?Object.assign(Object.assign({},t),{height:t.height+G}):t;return d(lf,{item:l,weekHeight:y,currentMonth:j,currentYear:Y,screenSize:v,isScrolling:L,calendarRef:s,events:o,onEventUpdate:ee,onEventDelete:te,onMoveStart:H,onCreateStart:O,onResizeStart:R,isDragging:$,dragState:P,newlyCreatedEventId:E,onDetailPanelOpen:()=>M(null),onChangeView:ne,onSelectDate:e.selectDate,selectedEventId:C,onEventSelect:k,detailPanelEventId:N,onDetailPanelToggle:I,customDetailPanelContent:r,customEventDetailDialog:i},`week-${t.weekData.startDate.getTime()}`)}),d("div",{style:{height:Q}})]})]})},cf={enableDrag:!0,enableResize:!1,enableCreate:!0,showOtherMonth:!0,weekHeight:120,showWeekNumbers:!1,enableVirtualScroll:!0,initialWeeksToLoad:156,dragConfig:{supportedViews:[T.MONTH],enableAllDayCreate:!1},eventsConfig:{enableAutoRecalculate:!0,enableValidation:!0},virtualScrollConfig:{weekHeight:120,initialWeeksToLoad:156,enableVirtualScroll:!0,enableKeyboardNavigation:!0,supportedViews:[T.MONTH]},viewConfig:{showOtherMonth:!0,weekHeight:120,showWeekNumbers:!1,enableVirtualScroll:!0}},uf=(t={})=>{const n=Object.assign(Object.assign({},cf),t),r=t=>e.createElement(Ph,{viewType:T.MONTH,originalComponent:df,app:t.app,config:n,className:"month-view-factory",customDetailPanelContent:t.customDetailPanelContent,customEventDetailDialog:t.customEventDetailDialog,calendarRef:t.calendarRef,switcherMode:t.switcherMode,meta:t.meta});return r.displayName="MonthViewAdapter",{type:T.MONTH,component:r,config:n}},hf=({app:t})=>{const o=t.getCurrentDate(),{yearHeight:i,screenSize:s}=rf(),[c,u]=n(!1),h=e.useRef(new nf),m=e.useRef(new Date),{currentYear:v,isScrolling:y,virtualData:p,scrollElementRef:b,handleScroll:D,scrollToYear:w,handlePreviousYear:x,handleNextYear:E,handleToday:M}=af({currentDate:o,yearHeight:i}),C=r((e,t)=>{const n=new Date(e,t,1),r=0===n.getDay()?6:n.getDay()-1,a=[],i=m.current,s=o;for(let n=0;n<42;n++){const o=new Date(e,t,n-r+1),l=o.getDate(),d=o.getMonth()===t;a.push({date:l,isCurrentMonth:d,isToday:d&&o.toDateString()===i.toDateString(),isSelected:d&&o.toDateString()===s.toDateString(),fullDate:o})}return{year:e,month:t,monthName:zu[t],days:a}},[o]),k=r(e=>{let t=h.current.get(e);if(!t){const n=[];for(let t=0;t<12;t++)n.push(C(e,t));t={year:e,months:n},h.current.set(e,t)}return t},[C]),N=r(()=>{t.goToToday(),M()},[t,M]);a(()=>{const e=e=>{if(!e.repeat)switch(e.key){case"ArrowUp":e.preventDefault(),x();break;case"ArrowDown":e.preventDefault(),E();break;case"Home":e.preventDefault(),N();break;case"PageUp":e.preventDefault();const t=Math.max(_g,v-5);w(t);break;case"PageDown":e.preventDefault();const n=Math.min(Gg,v+5);w(n);break;case"F12":e.shiftKey&&(e.preventDefault(),u(!c))}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[v,x,E,N,w,c]);const T=e.memo(({monthData:e})=>l("div",{className:"h-fit",children:[d("div",{className:`text-red-600 font-semibold mb-2 sm:mb-3 ${"mobile"===s?"text-xs":"text-xs sm:text-sm"} `,children:e.monthName}),d("div",{className:"grid grid-cols-7 gap-0 mb-1 sm:mb-2",children:["M","T","W","T","F","S","S"].map((e,t)=>d("div",{className:"text-center text-gray-500 py-0.5 text-xs w-10",children:e},t))}),d("div",{className:"grid grid-cols-7 gap-0",children:e.days.map((e,n)=>d("button",{className:`\n text-center rounded-sm transition-colors\n w-10\n ${"mobile"===s?"text-xs py-1 min-h-[18px]":"text-xs py-1 sm:py-1.5 min-h-[20px] sm:min-h-[26px]"}\n ${e.isCurrentMonth?"text-gray-900 font-medium hover:bg-gray-100 active:bg-gray-200":"text-gray-300 cursor-not-allowed"}\n ${e.isToday?"bg-red-500 text-white hover:bg-red-600 font-bold shadow-sm ring-2 ring-red-200":""}\n ${e.isSelected&&!e.isToday?"bg-red-100 text-red-600 font-semibold ring-1 ring-red-300":""}\n `,onClick:()=>e.isCurrentMonth&&t.selectDate(e.fullDate),disabled:!e.isCurrentMonth,children:e.date},n))})]})),I=e.memo(({item:e})=>{const t=k(e.year);return d("div",{className:"absolute w-full",style:{top:e.top,height:e.height,contain:"layout style paint"},children:d("div",{className:"px-4 py-2 bg-white",children:d("div",{className:"mx-auto px-8",children:d("div",{className:"grid gap-3 lg:gap-8 "+("mobile"===s?"grid-cols-2 grid-rows-6":"tablet"===s?"grid-cols-3 grid-rows-4":"grid-cols-4 grid-rows-3"),children:t.months.map(e=>d(T,{monthData:e},`${e.year}-${e.month}`))})})})})});return T.displayName="MonthComponent",I.displayName="VirtualYearItem",l("div",{className:"relative flex flex-col bg-white shadow-md w-full overflow-hidden h-full",children:[d("div",{className:"p-2 bg-white",children:l("div",{className:"flex justify-between items-center",children:[d("h1",{className:"text-2xl font-semibold",children:v}),l("div",{className:"flex space-x-1",children:[d("button",{className:"p-1 text-gray-600 hover:bg-gray-100 rounded",onClick:()=>t.goToPrevious(),title:"Previous week",children:d(g,{className:"h-5 w-5"})}),d("button",{className:"px-4 py-1 text-sm text-gray-700 hover:bg-gray-100 rounded",onClick:()=>t.goToToday(),title:"Go to today",children:"Today"}),d("button",{className:"p-1 text-gray-600 hover:bg-gray-100 rounded",onClick:()=>t.goToNext(),title:"Next week",children:d(f,{className:"h-5 w-5"})})]})]})}),y&&d("div",{className:"absolute top-24 left-1/2 transform -translate-x-1/2 z-40 bg-white/95 backdrop-blur-sm py-2 px-4 rounded-lg shadow-lg border border-gray-200 transition-all duration-200 pointer-events-none",children:d("span",{className:"text-xl font-bold text-gray-900",children:v})}),d("div",{ref:b,className:"flex-1 overflow-auto bg-gray-50",onScroll:D,style:{contain:"layout style paint",scrollBehavior:"auto"},children:d("div",{className:"relative",style:{height:p.totalHeight},children:p.visibleItems.map(e=>d(I,{item:e},e.year))})}),d("div",{className:"absolute right-2 top-1/2 transform -translate-y-1/2 opacity-30 hover:opacity-70 transition-opacity",children:l("div",{className:"bg-gray-800 text-white text-xs px-2 py-1 rounded",children:[Math.round((v-_g)/(Gg-_g)*100),"%"]})})]})},gf={enableDrag:!1,enableResize:!1,enableCreate:!1,enableVirtualScroll:!0,showDebugInfo:!1,eventsConfig:{enableAutoRecalculate:!1,enableValidation:!0},viewConfig:{enableVirtualScroll:!0,showDebugInfo:!1}},ff=(t={})=>{const n=Object.assign(Object.assign({},gf),t),r=t=>e.createElement(Ph,{viewType:T.YEAR,originalComponent:hf,app:t.app,config:n,className:"year-view-factory",customDetailPanelContent:t.customDetailPanelContent,customEventDetailDialog:t.customEventDetailDialog,calendarRef:t.calendarRef,meta:t.meta});return r.displayName="YearViewAdapter",{type:T.YEAR,component:r,config:n}},mf={enableAutoRecalculate:!0,enableValidation:!0,defaultEvents:[],maxEventsPerDay:50};function vf(e={}){const t=Object.assign(Object.assign({},mf),e);let n;const r={getAll:()=>n.getAllEvents(),getById:e=>n.getAllEvents().find(t=>t.id===e),add:e=>{if(t.enableValidation){const t=r.validateEvent(e);if(t.length>0)throw new Error(`Event validation failed: ${t.join(", ")}`)}if(t.maxEventsPerDay&&void 0!==e.day){if(r.getByDay(e.day,n.getCurrentDate()).length>=t.maxEventsPerDay)throw new Error(`Maximum events per day (${t.maxEventsPerDay}) exceeded`)}if(n.addEvent(e),t.enableAutoRecalculate){const e=a(n.getCurrentDate()),t=ah(n.getAllEvents(),e);n.state.events=t}},update:(e,o)=>{const i=r.getById(e);if(!i)throw new Error(`Event with id ${e} not found`);const s=Object.assign(Object.assign({},i),o);if(t.enableValidation){const e=r.validateEvent(s);if(e.length>0)throw new Error(`Event validation failed: ${e.join(", ")}`)}if(n.updateEvent(e,o),t.enableAutoRecalculate){const e=a(n.getCurrentDate()),t=ah(n.getAllEvents(),e);n.state.events=t}return n.getAllEvents().find(t=>t.id===e)},delete:e=>{n.deleteEvent(e)},getByDate:e=>n.getAllEvents().filter(t=>{const n=gu(t.start);n.setHours(0,0,0,0);const r=new Date(e);return r.setHours(0,0,0,0),n.getTime()===r.getTime()}),getByDateRange:(e,t)=>n.getAllEvents().filter(n=>{const r=gu(n.start),a=gu(n.end);return r>=e&&r<=t||a>=e&&a<=t||r<=e&&a>=t}),getByDay:(e,t)=>n.getAllEvents().filter(t=>t.day===e),getAllDayEvents:(e,t)=>t.filter(t=>t.day===e&&t.allDay),recalculateEventDays:(e,t)=>ah(e,t),validateEvent:e=>{const t=[];return e.title&&""!==e.title.trim()||t.push("Event title is required"),e.start||t.push("Event start time is required"),e.end||t.push("Event end time is required"),e.start&&e.end&&!e.allDay&&e.start>=e.end&&t.push("Start time must be before end time"),e.id&&"string"!=typeof e.id&&t.push("Event ID must be a string"),t},filterEvents:(e,t)=>e.filter(t)};function a(e){const t=e.getDay(),n=e.getDate()-t+(0===t?-6:1),r=new Date(e);return r.setDate(n),r.setHours(0,0,0,0),r}return{name:"events",config:t,install:e=>{n=e,Z.log("Events plugin installed - providing event management services")},api:r}}export{V as CalendarApp,yg as CalendarEvent,Y as CalendarRegistry,gh as ColorPicker,Rh as DayFlowCalendar,Th as DefaultEventDetailDialog,mg as DefaultEventDetailPanel,vg as EventDetailPanelWithContent,kg as EventLayoutCalculator,Pu as TIME_STEP,Hh as ThemeProvider,Ag as ViewHeader,T as ViewType,wu as addDays,ph as buildParseRegExp,nh as calculateDayIndex,Qh as conditionalTheme,dg as convertDateEvent,cg as convertDateEventWithTimeZone,sg as createAllDayEvent,Cu as createDateWithHour,Fg as createDayView,Rg as createDragPlugin,rg as createEvent,th as createEventWithDate,sh as createEventWithRealDate,og as createEvents,vf as createEventsPlugin,uf as createMonthView,fu as createTemporalWithHour,lg as createTimedEvent,ag as createTimezoneEvent,ig as createTimezoneEvents,Wg as createWeekView,ff as createYearView,Fh as dateToPlainDate,Vh as dateToPlainDateTime,Bh as dateToZonedDateTime,bu as daysBetween,Du as daysDifference,Mu as extractHourFromDate,qh as extractHourFromTemporal,Yh as formatDate,$h as formatDateConsistent,ju as formatEventTimeRange,jh as formatMonthYear,xh as formatTemporal,$u as formatTime,Wu as generateDayData,ch as generateUniKey,Uu as generateWeekData,Gu as generateWeekRange,_u as generateWeeksData,Ju as getAllDayEventsForDay,Bu as getCurrentWeekDates,Ku as getDateByDayIndex,oh as getDayIndexByDate,Nu as getEndOfDay,pu as getEndOfTemporal,Su as getEventBgColor,Lu as getEventEndHour,Hu as getEventTextColor,Xu as getEventsForDay,ih as getEventsForWeek,Ru as getLineColor,qu as getMonthYearOfWeek,Xh as getPlainDate,Ou as getSelectedBgColor,ku as getStartOfDay,yu as getStartOfTemporal,dh as getTestEvents,Vu as getWeekRange,Dh as getZoneId,du as isDate,rh as isEventInWeek,Iu as isMultiDayEvent,vu as isMultiDayTemporalEvent,Lh as isPlainDate,Ah as isPlainDateTime,Tu as isSameDay,mu as isSamePlainDate,Gh as isSameTemporal,Zh as isZonedDateTime,eg as mergeClasses,vh as mergeFormatTemplate,zu as monthNames,z as normalizeCssWidth,wh as normalizeToZoned,xu as now,mh as pad,bh as parseTemporalString,Wh as plainDateTimeToDate,Uh as plainDateToDate,ah as recalculateEventDays,Yu as roundToTimeStep,_h as setHourInTemporal,Fu as shortMonthNames,zh as temporalToDate,Kh as themeClasses,Jh as themeCn,Eu as today,Qu as updateEventDateAndDay,lh as updateEventWithRealDate,B as useCalendarApp,Og as useDrag,Pg as useDragForView,rf as useResponsiveConfig,of as useResponsiveMonthConfig,Oh as useTheme,sf as useVirtualMonthScroll,af as useVirtualScroll,Au as weekDays,Zu as weekDaysFullName,hu as zonedDateTimeToDate};
1
+ import e,{useMemo as t,useState as n,useCallback as r,useEffect as a,useRef as o,createContext as i,useContext as s}from"react";import{jsxs as l,jsx as d,Fragment as c}from"react/jsx-runtime";import{PanelRightClose as u,PanelRightOpen as h,ChevronLeft as g,ChevronRight as f,ChevronsUpDown as m,Check as v,ChevronsLeft as y,ChevronsRight as p,MoveRight as b,Gift as D,Heart as w,Star as x,MapPin as E,CalendarDays as M,Calendar as C}from"lucide-react";import k from"react-dom";import{createRoot as T}from"react-dom/client";var N;!function(e){e.DAY="day",e.WEEK="week",e.MONTH="month",e.YEAR="year"}(N||(N={}));const I=100,S=8,H=150,O=80,R=90,P=119;class ${constructor(e=I){this.cache=new Map,this.accessOrder=[],this.maxSize=e}getKey(e){return`${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`}get(e){const t=this.getKey(e),n=this.cache.get(t);if(n)return this.updateAccessOrder(t),n}set(e,t){const n=this.getKey(e);if(this.cache.size>=this.maxSize){const e=this.accessOrder.shift();void 0!==e&&this.cache.delete(e)}this.cache.set(n,t),this.updateAccessOrder(n)}updateAccessOrder(e){const t=this.accessOrder.indexOf(e);t>-1&&this.accessOrder.splice(t,1),this.accessOrder.push(e)}getSize(){return this.cache.size}clear(){this.cache.clear(),this.accessOrder=[]}}const j=[{id:"blue",name:"Blue",isDefault:!0,colors:{eventColor:"#eff6ff",eventSelectedColor:"rgba(59, 130, 246)",lineColor:"#3b82f6",textColor:"#1e3a8a"},darkColors:{eventColor:"rgba(30, 64, 175, 0.8)",eventSelectedColor:"rgba(30, 58, 138, 1)",lineColor:"#3b82f6",textColor:"#dbeafe"}},{id:"green",name:"Green",isDefault:!0,colors:{eventColor:"#f0fdf4",eventSelectedColor:"rgba(16, 185, 129, 1)",lineColor:"#10b981",textColor:"#064e3b"},darkColors:{eventColor:"rgba(4, 120, 87, 0.8)",eventSelectedColor:"rgba(6, 78, 59, 1)",lineColor:"#10b981",textColor:"#d1fae5"}},{id:"purple",name:"Purple",isDefault:!0,colors:{eventColor:"#faf5ff",eventSelectedColor:"rgba(139, 92, 246, 1)",lineColor:"#8b5cf6",textColor:"#5b21b6"},darkColors:{eventColor:"rgba(109, 40, 217, 0.8)",eventSelectedColor:"rgba(91, 33, 182, 1)",lineColor:"#8b5cf6",textColor:"#ede9fe"}},{id:"yellow",name:"Yellow",isDefault:!0,colors:{eventColor:"#fefce8",eventSelectedColor:"rgba(245, 158, 11, 1)",lineColor:"#f59e0b",textColor:"#78350f"},darkColors:{eventColor:"rgba(180, 83, 9, 0.8)",eventSelectedColor:"rgba(120, 53, 15, 1)",lineColor:"#f59e0b",textColor:"#fef3c7"}},{id:"red",name:"Red",isDefault:!0,colors:{eventColor:"#fef2f2",eventSelectedColor:"rgba(239, 68, 68, 1)",lineColor:"#ef4444",textColor:"#7f1d1d"},darkColors:{eventColor:"rgba(185, 28, 28, 0.8)",eventSelectedColor:"rgba(127, 29, 29, 1)",lineColor:"#ef4444",textColor:"#fee2e2"}},{id:"orange",name:"Orange",isDefault:!0,colors:{eventColor:"#fff7edb3",eventSelectedColor:"rgba(249, 115, 22, 1)",lineColor:"#f97316",textColor:"#7c2d12"},darkColors:{eventColor:"rgba(194, 65, 12, 0.8)",eventSelectedColor:"rgba(124, 45, 18, 1)",lineColor:"#f97316",textColor:"#fed7aa"}},{id:"pink",name:"Pink",isDefault:!0,colors:{eventColor:"#fdf2f8",eventSelectedColor:"rgba(236, 72, 153, 1)",lineColor:"#ec4899",textColor:"#831843"},darkColors:{eventColor:"rgba(190, 24, 93, 0.8)",eventSelectedColor:"rgba(131, 24, 67, 1)",lineColor:"#ec4899",textColor:"#fce7f3"}},{id:"teal",name:"Teal",isDefault:!0,colors:{eventColor:"#f0fdfa",eventSelectedColor:"rgba(20, 184, 166, 1)",lineColor:"#14b8a6",textColor:"#134e4a"},darkColors:{eventColor:"rgba(15, 118, 110, 0.8)",eventSelectedColor:"rgba(19, 78, 74, 1)",lineColor:"#14b8a6",textColor:"#ccfbf1"}},{id:"indigo",name:"Indigo",isDefault:!0,colors:{eventColor:"#eef2ffb3",eventSelectedColor:"rgba(99, 102, 241, 1)",lineColor:"#6366f1",textColor:"#312e81"},darkColors:{eventColor:"rgba(67, 56, 202, 0.8)",eventSelectedColor:"rgba(49, 46, 129, 1)",lineColor:"#6366f1",textColor:"#e0e7ff"}},{id:"gray",name:"Gray",isDefault:!0,colors:{eventColor:"#f9fafbb3",eventSelectedColor:"rgba(107, 114, 128, 1)",lineColor:"#6b7280",textColor:"#1f2937"},darkColors:{eventColor:"rgba(75, 85, 99, 0.8)",eventSelectedColor:"rgba(31, 41, 55, 1)",lineColor:"#6b7280",textColor:"#f3f4f6"}}];class Y{constructor(e,t,n="light"){this.calendars=new Map,this.defaultCalendarId=t||"blue",this.currentTheme=n;const r=e&&e.length>0;e?e.forEach(e=>{this.calendars.set(e.id,e)}):j.forEach(e=>{this.calendars.set(e.id,Object.assign(Object.assign({},e),{isVisible:!r&&e.isVisible}))})}register(e){this.calendars.set(e.id,e)}unregister(e){return this.calendars.delete(e)}get(e){return this.calendars.get(e)}getAll(){return Array.from(this.calendars.values())}getVisible(){return this.getAll().filter(e=>!1!==e.isVisible)}has(e){return this.calendars.has(e)}setVisibility(e,t){const n=this.calendars.get(e);n&&this.calendars.set(e,Object.assign(Object.assign({},n),{isVisible:t}))}setAllVisibility(e){this.calendars.forEach((t,n)=>{this.calendars.set(n,Object.assign(Object.assign({},t),{isVisible:e}))})}setDefaultCalendar(e){if(!this.has(e))throw new Error(`Calendar type '${e}' does not exist`);this.defaultCalendarId=e}getDefaultCalendarId(){return this.defaultCalendarId}getDefaultCalendar(){const e=this.get(this.defaultCalendarId);return e||this.getAll()[0]}setTheme(e){this.currentTheme=e}getTheme(){return this.currentTheme}resolveColors(e,t){const n=t||this.currentTheme,r=this.isDarkTheme(n);let a;return e&&(a=this.get(e)),a||(a=this.getDefaultCalendar()),r&&a.darkColors?a.darkColors:a.colors}getSelectedBgColor(e,t){return this.resolveColors(e,t).eventSelectedColor}getLineColor(e,t){return this.resolveColors(e,t).lineColor}getTextColor(e,t){return this.resolveColors(e,t).textColor}isDarkTheme(e){return"dark"===e||"light"!==e&&(!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-color-scheme: dark)").matches)}validate(e){const t=[];return e.id||t.push("Calendar type must have an id"),e.name||t.push("Calendar type must have a name"),e.colors?(e.colors.eventColor||t.push("Calendar colors must include eventColor"),e.colors.eventSelectedColor||t.push("Calendar colors must include eventSelectedColor"),e.colors.lineColor||t.push("Calendar colors must include lineColor"),e.colors.textColor||t.push("Calendar colors must include textColor")):t.push("Calendar type must have colors configuration"),t}}let A=new Y;function L(){return A}const Z=new class{constructor(){this.isDevelopment="production"!==process.env.NODE_ENV}formatMessage(e,t,...n){if(!this.isDevelopment)return;const r=(new Date).toISOString(),a=`[DayFlow ${e.toUpperCase()}] ${r}:`;switch(e){case"log":console.log(a,t,...n);break;case"warn":console.warn(a,t,...n);break;case"error":console.error(a,t,...n);break;case"debug":console.debug(a,t,...n)}}log(e,...t){this.formatMessage("log",e,...t)}warn(e,...t){this.formatMessage("warn",e,...t)}error(e,...t){this.formatMessage("error",e,...t)}debug(e,...t){this.formatMessage("debug",e,...t)}};function F(e,t="240px"){return"number"==typeof e?`${e}px`:"string"==typeof e&&e.trim().length>0?e:t}const z="240px";class V{constructor(t){var n,r,a,o;this.changeView=e=>{var t,n;if(!this.state.views.has(e))throw new Error(`View ${e} is not registered`);this.state.currentView=e,null===(n=(t=this.callbacks).onViewChange)||void 0===n||n.call(t,e)},this.getCurrentView=()=>{const e=this.state.views.get(this.state.currentView);if(!e)throw new Error(`Current view ${this.state.currentView} is not registered`);return e},this.setCurrentDate=e=>{var t,n;this.state.currentDate=new Date(e),null===(n=(t=this.callbacks).onDateChange)||void 0===n||n.call(t,this.state.currentDate),this.setVisibleMonth(this.state.currentDate)},this.getCurrentDate=()=>new Date(this.state.currentDate),this.setVisibleMonth=e=>{var t,n;const r=new Date(e.getFullYear(),e.getMonth(),1);this.visibleMonth.getFullYear()===r.getFullYear()&&this.visibleMonth.getMonth()===r.getMonth()||(this.visibleMonth=r,null===(n=(t=this.callbacks).onVisibleMonthChange)||void 0===n||n.call(t,new Date(this.visibleMonth)))},this.getVisibleMonth=()=>new Date(this.visibleMonth),this.goToToday=()=>{this.setCurrentDate(new Date)},this.goToPrevious=()=>{const e=new Date(this.state.currentDate);switch(this.state.currentView){case N.DAY:e.setDate(e.getDate()-1);break;case N.WEEK:e.setDate(e.getDate()-7);break;case N.MONTH:e.setMonth(e.getMonth()-1)}this.setCurrentDate(e)},this.goToNext=()=>{const e=new Date(this.state.currentDate);switch(this.state.currentView){case N.DAY:e.setDate(e.getDate()+1);break;case N.WEEK:e.setDate(e.getDate()+7);break;case N.MONTH:e.setMonth(e.getMonth()+1)}this.setCurrentDate(e)},this.selectDate=e=>{var t,n;this.setCurrentDate(e),null===(n=(t=this.callbacks).onDateChange)||void 0===n||n.call(t,new Date(e))},this.addEvent=e=>{var t,n;this.state.events=[...this.state.events,e],null===(n=(t=this.callbacks).onEventCreate)||void 0===n||n.call(t,e)},this.updateEvent=(e,t,n)=>{var r,a;const o=this.state.events.findIndex(t=>t.id===e);if(-1===o)throw new Error(`Event with id ${e} not found`);const i=Object.assign(Object.assign({},this.state.events[o]),t);this.state.events=[...this.state.events.slice(0,o),i,...this.state.events.slice(o+1)],n||null===(a=(r=this.callbacks).onEventUpdate)||void 0===a||a.call(r,i)},this.deleteEvent=e=>{var t,n;const r=this.state.events.findIndex(t=>t.id===e);if(-1===r)throw new Error(`Event with id ${e} not found`);this.state.events=[...this.state.events.slice(0,r),...this.state.events.slice(r+1)],null===(n=(t=this.callbacks).onEventDelete)||void 0===n||n.call(t,e)},this.getAllEvents=()=>[...this.state.events],this.getEvents=()=>{const e=this.getAllEvents(),t=new Set(this.calendarRegistry.getAll().filter(e=>!1!==e.isVisible).map(e=>e.id));return e.filter(e=>!e.calendarId||(!this.calendarRegistry.has(e.calendarId)||t.has(e.calendarId)))},this.getCalendars=()=>this.calendarRegistry.getAll(),this.setCalendarVisibility=(e,t)=>{var n,r;this.calendarRegistry.setVisibility(e,t),null===(r=(n=this.callbacks).onRender)||void 0===r||r.call(n)},this.setAllCalendarsVisibility=e=>{var t,n;this.calendarRegistry.setAllVisibility(e),null===(n=(t=this.callbacks).onRender)||void 0===n||n.call(t)},this.getSidebarConfig=()=>this.sidebarConfig,this.installPlugin=e=>{this.state.plugins.has(e.name)?Z.warn(`Plugin ${e.name} is already installed`):(this.state.plugins.set(e.name,e),e.install(this))},this.getPlugin=e=>{const t=this.state.plugins.get(e);return null==t?void 0:t.api},this.hasPlugin=e=>this.state.plugins.has(e),this.render=()=>e.createElement("div",{className:"calendar-app"},"Calendar App"),this.getPluginConfig=e=>{const t=this.state.plugins.get(e);return(null==t?void 0:t.config)||{}},this.updatePluginConfig=(e,t)=>{const n=this.state.plugins.get(e);n&&(n.config=Object.assign(Object.assign({},n.config),t))},this.getViewConfig=e=>{const t=this.state.views.get(e);return(null==t?void 0:t.config)||{}},this.triggerRender=()=>{var e,t;null===(t=(e=this.callbacks).onRender)||void 0===t||t.call(e)},this.getCalendarRegistry=()=>this.calendarRegistry,this.getUseEventDetailDialog=()=>this.useEventDetailDialog,this.setTheme=e=>{var t,n;this.calendarRegistry.setTheme(e),this.themeChangeListeners.forEach(t=>{t(e)}),null===(n=(t=this.callbacks).onRender)||void 0===n||n.call(t)},this.getTheme=()=>this.calendarRegistry.getTheme(),this.subscribeThemeChange=e=>(this.themeChangeListeners.add(e),()=>{this.unsubscribeThemeChange(e)}),this.unsubscribeThemeChange=e=>{this.themeChangeListeners.delete(e)},this.state={currentView:t.defaultView||N.WEEK,currentDate:t.initialDate||new Date,events:t.events||[],switcherMode:t.switcherMode||"buttons",plugins:new Map,views:new Map},this.callbacks=t.callbacks||{},this.themeChangeListeners=new Set,this.calendarRegistry=new Y(t.calendars,t.defaultCalendar,(null===(n=t.theme)||void 0===n?void 0:n.mode)||"light"),o=this.calendarRegistry,A=o,this.sidebarConfig=(e=>{if(!e)return{enabled:!1,width:z,initialCollapsed:!1};if(!0===e)return{enabled:!0,width:z,initialCollapsed:!1};const{enabled:t=!0,width:n,initialCollapsed:r=!1,render:a}=e;return{enabled:t,width:F(n,z),initialCollapsed:r,render:a}})(t.useSidebar),this.state.sidebar=this.sidebarConfig;const i=this.state.currentDate;this.visibleMonth=new Date(i.getFullYear(),i.getMonth(),1),this.useEventDetailDialog=null!==(r=t.useEventDetailDialog)&&void 0!==r&&r,t.views.forEach(e=>{this.state.views.set(e.type,e)}),null===(a=t.plugins)||void 0===a||a.forEach(e=>{this.installPlugin(e)})}}function B(e){const o=t(()=>new V(e),[]),[i,s]=n(o.state.currentView),[l,d]=n(o.state.currentDate),[c,u]=n(o.getEvents()),[,h]=n({}),g=r(()=>{h({})},[]);a(()=>{const e=o.changeView;o.changeView=t=>{e(t),s(t),g()};const t=o.setCurrentDate;o.setCurrentDate=e=>{t(e),d(new Date(e)),g()};const n=o.addEvent;o.addEvent=e=>{n(e),u([...o.getEvents()]),g()};const r=o.updateEvent;o.updateEvent=(e,t,n)=>{r(e,t,n),u([...o.getEvents()]),g()};const a=o.deleteEvent;o.deleteEvent=e=>{a(e),u([...o.getEvents()]),g()};const i=o.setCalendarVisibility;o.setCalendarVisibility=(e,t)=>{i(e,t),u([...o.getEvents()]),g()};const l=o.setAllCalendarsVisibility;o.setAllCalendarsVisibility=e=>{l(e),u([...o.getEvents()]),g()};const c=o.setVisibleMonth;return o.setVisibleMonth=e=>{c(e),g()},()=>{}},[o,g]),a(()=>{s(o.state.currentView),d(o.state.currentDate),u(o.getEvents())},[o]);const f=r(e=>{o.changeView(e)},[o]),m=r(e=>{o.setCurrentDate(e)},[o]),v=r(e=>{o.addEvent(e)},[o]),y=r((e,t,n)=>{o.updateEvent(e,t,n)},[o]),p=r(e=>{o.deleteEvent(e)},[o]),b=r(()=>{o.goToToday()},[o]),D=r(()=>{o.goToPrevious()},[o]),w=r(()=>{o.goToNext()},[o]),x=r(e=>{o.selectDate(e)},[o]),E=r((e,t)=>{o.setCalendarVisibility(e,t)},[o]),M=r(e=>{o.setAllCalendarsVisibility(e)},[o]);return{app:o,currentView:i,currentDate:l,events:c,changeView:f,setCurrentDate:m,addEvent:v,updateEvent:y,deleteEvent:p,goToToday:b,goToPrevious:D,goToNext:w,selectDate:x,getCalendars:()=>o.getCalendars(),setCalendarVisibility:E,setAllCalendarsVisibility:M,getAllEvents:()=>o.getAllEvents(),setVisibleMonth:e=>o.setVisibleMonth(e),getVisibleMonth:()=>o.getVisibleMonth(),sidebarConfig:o.getSidebarConfig()}}const W="p-2 flex justify-between",U="text-2xl font-semibold text-gray-900 dark:text-gray-100",q="relative overflow-y-auto calendar-content",_="w-20 flex-shrink-0 border-gray-200 dark:border-gray-700",X="relative h-[4.5rem] flex",G="absolute -top-2.5 right-2 text-[12px] text-gray-500 dark:text-gray-400",J="h-[4.5rem] border-t first:border-none border-gray-200 dark:border-gray-700 flex",K="absolute left-0 top-0 flex pointer-events-none",Q="ml-2 text-white text-xs font-bold px-1.5 bg-red-500 rounded-sm",ee="flex items-center border-b border-gray-200 dark:border-gray-700 sticky",te="w-20 flex-shrink-0 p-1 text-xs font-medium text-gray-500 dark:text-gray-400 flex justify-end",ne="calendar-event select-none pointer-events-auto px-0.5",re="rounded-xl my-0.5",ae="font-medium text-xs truncate pr-1",oe="absolute left-1 top-1 bottom-1 w-[3px] rounded-full",ie="h-3 w-3 mr-1",se="resize-handle absolute right-0 top-0 bottom-0 w-1 cursor-ew-resize opacity-0 group-hover:opacity-100 transition-opacity z-20",le="grid grid-cols-7 gap-1 text-xs justify-items-center",de="text-center text-gray-500 dark:text-gray-400 font-medium py-1 h-6 w-6",ce="text-center py-1 rounded text-xs h-6 w-6",ue="text-gray-900 dark:text-gray-100",he="text-gray-400 dark:text-gray-600",ge="bg-blue-500 rounded-full text-white",fe="bg-red-100 text-red-600 rounded-full font-medium",me="text-gray-600 dark:text-gray-300",ve="text-xs",ye="text-sm",pe="flex flex-col",be="mr-1";function De(e,t,n,r,a){return we(t,((e,t)=>{const n=e[t];if(void 0===n)throw new TypeError(zo(t));return n})(e,t),n,r,a)}function we(e,t,n,r,a,o){const i=Fe(t,n,r);if(a&&t!==i)throw new RangeError(Zo(e,t,n,r,o));return i}function xe(e){return null!==e&&/object|function/.test(typeof e)}function Ee(e,t=Map){const n=new t;return(t,...r)=>{if(n.has(t))return n.get(t);const a=e(t,...r);return n.set(t,a),a}}function Me(e){return Ce({name:e},1)}function Ce(e,t){return Ie(e=>({value:e,configurable:1,writable:!t}),e)}function ke(e){return Ie(e=>({get:e,configurable:1}),e)}function Te(e){return{[Symbol.toStringTag]:{value:e,configurable:1}}}function Ne(e,t){const n={};let r=e.length;for(const a of t)n[e[--r]]=a;return n}function Ie(e,t,n){const r={};for(const a in t)r[a]=e(t[a],a,n);return r}function Se(e,t,n){const r={};for(let a=0;a<t.length;a++){const o=t[a];r[o]=e(o,a,n)}return r}function He(e,t,n){const r={};for(let a=0;a<e.length;a++)r[t[a]]=n[e[a]];return r}function Oe(e,t){const n=Object.create(null);for(const r of e)n[r]=t[r];return n}function Re(e,t){for(const n of t)if(n in e)return 1;return 0}function Pe(e,t,n){for(const r of e)if(t[r]!==n[r])return 0;return 1}function $e(e,t,n){const r={...n};for(let n=0;n<t;n++)r[e[n]]=0;return r}function je(e,...t){return(...n)=>e(...t,...n)}function Ye(e){return e[0].toUpperCase()+e.substring(1)}function Ae(e){return e.slice().sort()}function Le(e,t){return String(t).padStart(e,"0")}function Ze(e,t){return Math.sign(e-t)}function Fe(e,t,n){return Math.min(Math.max(e,t),n)}function ze(e,t){return[Math.floor(e/t),Ve(e,t)]}function Ve(e,t){return(e%t+t)%t}function Be(e,t){return[We(e,t),Ue(e,t)]}function We(e,t){return Math.trunc(e/t)||0}function Ue(e,t){return e%t||0}function qe(e){return.5===Math.abs(e%1)}function _e(e,t,n){let r=0,a=0;for(let o=0;o<=t;o++){const t=e[n[o]],i=Yi[o],s=ji/i,[l,d]=Be(t,s);r+=d*i,a+=l}const[o,i]=Be(r,ji);return[a+o,i]}function Xe(e,t,n){const r={};for(let a=t;a>=0;a--){const t=Yi[a];r[n[a]]=We(e,t),e=Ue(e,t)}return r}function Ge(e){if(void 0!==e)return Ke(e)}function Je(e){return rt(Ke(e))}function Ke(e){return nt(cs(e))}function Qe(e,t){if(null==t)throw new RangeError(zo(e));return t}function et(e){if(!xe(e))throw new TypeError(Lo);return e}function tt(e,t,n=e){if(typeof t!==e)throw new TypeError(Fo(n,t));return t}function nt(e,t="number"){if(!Number.isInteger(e))throw new RangeError(Ro(t,e));return e||0}function rt(e,t="number"){if(e<=0)throw new RangeError(Po(t,e));return e}function at(e){if("symbol"==typeof e)throw new TypeError(Ao);return String(e)}function ot(e,t){return xe(e)?String(e):ls(e,t)}function it(e){if("string"==typeof e)return BigInt(e);if("bigint"!=typeof e)throw new TypeError(Yo(e));return e}function st(e,t="number"){if("bigint"==typeof e)throw new TypeError(jo(t));if(e=Number(e),!Number.isFinite(e))throw new RangeError($o(t,e));return e}function lt(e,t){return Math.trunc(st(e,t))||0}function dt(e,t){return nt(st(e,t),t)}function ct(e,t){return rt(lt(e,t),t)}function ut(e,t){let[n,r]=Be(t,ji),a=e+n;const o=Math.sign(a);return o&&o===-Math.sign(r)&&(a-=o,r+=o*ji),[a,r]}function ht(e,t,n=1){return ut(e[0]+t[0]*n,e[1]+t[1]*n)}function gt(e,t){return ut(e[0],e[1]+t)}function ft(e,t){return ht(t,e,-1)}function mt(e,t){return Ze(e[0],t[0])||Ze(e[1],t[1])}function vt(e,t,n){return-1===mt(e,t)||1===mt(e,n)}function yt(e,t=1){const n=BigInt(ji/t);return[Number(e/n),Number(e%n)*t]}function pt(e,t=1){const n=ji/t,[r,a]=Be(e,n);return[r,a*t]}function bt(e,t=1,n){const[r,a]=e,[o,i]=Be(a,t);return r*(ji/t)+(o+(n?i/t:0))}function Dt(e,t,n=ze){const[r,a]=e,[o,i]=n(a,t);return[r*(ji/t)+o,i]}function wt(e){return De(e,"isoYear",Rs,Os,1),e.isoYear===Rs?De(e,"isoMonth",4,12,1):e.isoYear===Os&&De(e,"isoMonth",1,9,1),e}function xt(e){return Et({...e,...ks,isoHour:12}),e}function Et(e){const t=De(e,"isoYear",Rs,Os,1),n=t===Rs?1:t===Os?-1:0;return n&&Mt(It({...e,isoDay:e.isoDay+n,isoNanosecond:e.isoNanosecond-n})),e}function Mt(e){if(!e||vt(e,Hs,Ss))throw new RangeError(gi);return e}function Ct(e){return _e(e,5,Ds)[1]}function kt(e){const[t,n]=ze(e,ji);return[Xe(n,5,Ds),t]}function Tt(e){return Dt(e,Ri)}function Nt(e){return Ot(e.isoYear,e.isoMonth,e.isoDay,e.isoHour,e.isoMinute,e.isoSecond,e.isoMillisecond)}function It(e){const t=Nt(e);if(void 0!==t){const[n,r]=Be(t,Ii);return[n,r*Oi+(e.isoMicrosecond||0)*Hi+(e.isoNanosecond||0)]}}function St(e,t){const[n,r]=kt(Ct(e)-t);return Mt(It({...e,isoDay:e.isoDay+r,...n}))}function Ht(...e){return Ot(...e)/Si}function Ot(...e){const[t,n]=Rt(...e),r=t.valueOf();if(!isNaN(r))return r-n*Ii}function Rt(e,t=1,n=1,r=0,a=0,o=0,i=0){const s=e===Rs?1:e===Os?-1:0,l=new Date;return l.setUTCHours(r,a,o,i),l.setUTCFullYear(e,t-1,n+s),[l,s]}function Pt(e,t){let[n,r]=gt(e,t);r<0&&(r+=ji,n-=1);const[a,o]=ze(r,Oi),[i,s]=ze(o,Hi);return $t(n*Ii+a,i,s)}function $t(e,t=0,n=0){const r=Math.ceil(Math.max(0,Math.abs(e)-Is)/Ii)*Math.sign(e),a=new Date(e-r*Ii);return Ne(xs,[a.getUTCFullYear(),a.getUTCMonth()+1,a.getUTCDate()+r,a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds(),a.getUTCMilliseconds(),t,n])}function jt(e,t){if(t<-Is)throw new RangeError(gi);const n=e.formatToParts(t),r={};for(const e of n)r[e.type]=e.value;return r}function Yt(e){return[e.isoYear,e.isoMonth,e.isoDay]}function At(e,t){return[t,0]}function Lt(){return As}function Zt(e,t){switch(t){case 2:return zt(e)?29:28;case 4:case 6:case 9:case 11:return 30}return 31}function Ft(e){return zt(e)?366:365}function zt(e){return e%4==0&&(e%100!=0||e%400==0)}function Vt(e){const[t,n]=Rt(e.isoYear,e.isoMonth,e.isoDay);return Ve(t.getUTCDay()-n,7)||7}function Bt(e){return this.id===rs?(({isoYear:e})=>e<1?["gregory-inverse",1-e]:["gregory",e])(e):this.id===as?Zs(e):[]}function Wt(e){const t=Nt(e);if(t<Ls){const{isoYear:t}=e;return t<1?["japanese-inverse",1-t]:["japanese",t]}const n=jt(Jl(as),t),{era:r,eraYear:a}=Ga(n,as);return[r,a]}function Ut(e){return qt(e),Gt(e,1),e}function qt(e){return Xt(e,1),e}function _t(e){return Pe(ws,e,Xt(e))}function Xt(e,t){const{isoYear:n}=e,r=De(e,"isoMonth",1,Lt(),t);return{isoYear:n,isoMonth:r,isoDay:De(e,"isoDay",1,Zt(n,r),t)}}function Gt(e,t){return Ne(Ds,[De(e,"isoHour",0,23,t),De(e,"isoMinute",0,59,t),De(e,"isoSecond",0,59,t),De(e,"isoMillisecond",0,999,t),De(e,"isoMicrosecond",0,999,t),De(e,"isoNanosecond",0,999,t)])}function Jt(e){return void 0===e?0:ol(et(e))}function Kt(e,t=0){e=dn(e);const n=il(e),r=sl(e,t);return[ol(e),r,n]}function Qt(e,t,n,r=9,a=0,o=4){t=dn(t);let i=rl(t,r,a),s=on(t),l=ul(t,o);const d=nl(t,r,a,1);return null==i?i=Math.max(n,d):fn(i,d),s=sn(s,d,1),e&&(l=(e=>e<4?(e+2)%4:e)(l)),[i,d,s,l]}function en(e,t=6,n){let r=on(e=cn(e,Fs));const a=ul(e,7);let o=nl(e,t);return o=Qe(Fs,o),r=sn(r,o,void 0,n),[o,r,a]}function tn(e){return ll(dn(e))}function nn(e,t){return rn(dn(e),t)}function rn(e,t=4){const n=ln(e);return[ul(e,4),...an(nl(e,t),n)]}function an(e,t){return null!=e?[Yi[e],e<4?9-3*e:-1]:[void 0===t?1:10**(9-t),t]}function on(e){const t=e[Vs];return void 0===t?1:lt(t,Vs)}function sn(e,t,n,r){const a=r?ji:Yi[t+1];if(a){const n=Yi[t];if(a%((e=we(Vs,e,1,a/n-(r?0:1),1))*n))throw new RangeError(Fo(Vs,e))}else e=we(Vs,e,1,n?10**9:1,1);return e}function ln(e){let t=e[Bs];if(void 0!==t){if("number"!=typeof t){if("auto"===at(t))return;throw new RangeError(Fo(Bs,t))}t=we(Bs,Math.floor(t),0,9,1)}return t}function dn(e){return void 0===e?{}:et(e)}function cn(e,t){return"string"==typeof e?{[t]:e}:et(e)}function un(e){return{overflow:_s[e]}}function hn(e,t,n=9,r=0,a){let o=t[e];if(void 0===o)return a?r:void 0;if(o=at(o),"auto"===o)return a?r:null;let i=Ti[o];if(void 0===i&&(i=vs[o]),void 0===i)throw new RangeError(Uo(e,o,Ti));return we(e,i,r,n,1,Ni),i}function gn(e,t,n,r=0){const a=n[e];if(void 0===a)return r;const o=at(a),i=t[o];if(void 0===i)throw new RangeError(Uo(e,o,t));return i}function fn(e,t){if(t>e)throw new RangeError(bi)}function mn(e){return{branding:pl,epochNanoseconds:e}}function vn(e,t,n){return{branding:yl,calendar:n,timeZone:t,epochNanoseconds:e}}function yn(e,t=e.calendar){return{branding:ml,calendar:t,...Oe(Cs,e)}}function pn(e,t=e.calendar){return{branding:fl,calendar:t,...Oe(Es,e)}}function bn(e,t=e.calendar){return{branding:hl,calendar:t,...Oe(Es,e)}}function Dn(e,t=e.calendar){return{branding:gl,calendar:t,...Oe(Es,e)}}function wn(e){return{branding:vl,...Oe(Ms,e)}}function xn(e){return{branding:bl,sign:jr(e),...Oe(hs,e)}}function En(e){return Dt(e.epochNanoseconds,Oi)[0]}function Mn(e){return e.epochNanoseconds}function Cn(e,t){return bt(Lr(e),Yi[t],1)}function kn(e,t,n,r,a,o,i){const s=us[n],l={...t,[s]:t[s]+r},d=i(e,a,t),c=i(e,a,l);return[o(d),o(c)]}function Tn(e,t,n){const r=bt(ft(t,n));if(!r)throw new RangeError(ri);return bt(ft(t,e))/r}function Nn(e,t,n,r){return In(e,On(t,n),r)}function In(e,t,n){const[r,a]=Sn(e,t,n);return Et({...kr(e,a),...r})}function Sn(e,t,n){return kt(Ln(Ct(e),t,n))}function Hn(e){return Ln(e,Pi,7)}function On(e,t){return Yi[e]*t}function Rn(e){const t=Pn(e);return[t,kr(t,1)]}function Pn(e){return Ts(6,e)}function $n(e,t,n){const r=Math.min(Vr(e),6);return Zr(An(Lr(e,r),t,n),r)}function jn(e,t,n,r,a,o,i,s,l,d){if(0===r&&1===a)return e;const c=Or(r,s)?Hr(s)&&r<6&&n>=6?zn:Fn:Vn;let[u,h,g]=c(e,t,n,r,a,o,i,s,l,d);return g&&7!==r&&(u=((e,t,n,r,a,o,i,s)=>{const l=jr(e);for(let d=r+1;d<=n;d++){if(7===d&&7!==n)continue;const r=bs(d,e);r[us[d]]+=l;const c=bt(ft(i(s(a,o,r)),t));if(c&&Math.sign(c)!==l)break;e=r}return e})(u,h,n,Math.max(6,r),i,s,l,d)),u}function Yn(e,t,n,r,a){if(6===t){const t=(e=>e[0]+e[1]/ji)(e);return[Ln(t,n,r),0]}return An(e,On(t,n),r,a)}function An(e,t,n,r){let[a,o]=e;r&&o<0&&(o+=ji,a-=1);const[i,s]=ze(Ln(o,t,n),ji);return ut(a+i,s)}function Ln(e,t,n){return Zn(e/t,n)*t}function Zn(e,t){return Dl[t](e)}function Fn(e,t,n,r,a,o){const i=jr(e),s=Lr(e),l=Yn(s,r,a,o),d=ft(s,l),c=Math.sign(l[0]-s[0])===i,u=Zr(l,Math.min(n,6));return[{...e,...u},ht(t,d),c]}function zn(e,t,n,r,a,o,i,s,l,d){const c=jr(e)||1,u=bt(Lr(e,5)),h=On(r,a);let g=Ln(u,h,o);const[f,m]=kn(i,{...e,...ps},6,c,s,l,d),v=g-bt(ft(f,m));let y=0;v&&Math.sign(v)!==c?t=gt(f,g):(y+=c,g=Ln(v,h,o),t=gt(m,g));const p=Fr(g);return[{...e,...p,days:e.days+y},t,Boolean(y)]}function Vn(e,t,n,r,a,o,i,s,l,d){const c=jr(e),u=us[r],h=bs(r,e);7===r&&(e={...e,weeks:e.weeks+Math.trunc(e.days/7)});const g=We(e[u],a)*a;h[u]=g;const[f,m]=kn(i,h,r,a*c,s,l,d),v=g+Tn(t,f,m)*c*a,y=Ln(v,a,o),p=Math.sign(y-v)===c;return h[u]=y,[h,p?m:f,p]}function Bn(e,t,n,r){const[a,o,i,s]=(e=>{const t=rn(e=dn(e));return[e.timeZone,...t]})(r),l=void 0!==a;return((e,t,n,r,a,o)=>{n=An(n,a,r,1);const i=t.R(n);return er(Pt(n,i),o)+(e?or(Hn(i)):"Z")})(l,t(l?e(a):wl),n.epochNanoseconds,o,i,s)}function Wn(e,t,n){const[r,a,o,i,s,l]=(e=>{e=dn(e);const t=ll(e),n=ln(e),r=cl(e),a=ul(e,4),o=nl(e,4);return[t,dl(e),r,a,...an(o,n)]})(n);return((e,t,n,r,a,o,i,s,l,d)=>{r=An(r,l,s,1);const c=e(n).R(r);return er(Pt(r,c),d)+or(Hn(c),i)+((e,t)=>1!==t?"["+(2===t?"!":"")+e+"]":"")(n,o)+ir(t,a)})(e,t.calendar,t.timeZone,t.epochNanoseconds,r,a,o,i,s,l)}function Un(e,t){const[n,r,a,o]=(e=>(e=dn(e),[ll(e),...rn(e)]))(t);return i=e.calendar,s=n,l=o,er(In(e,a,r),l)+ir(i,s);var i,s,l}function qn(e,t){return n=e.calendar,r=e,a=tn(t),tr(r)+ir(n,a);var n,r,a}function _n(e,t){return Kn(e.calendar,nr,e,tn(t))}function Xn(e,t){return Kn(e.calendar,rr,e,tn(t))}function Gn(e,t){const[n,r,a]=nn(t);return o=a,ar(Sn(e,r,n)[0],o);var o}function Jn(e,t){const[n,r,a]=nn(t,3);return r>1&&Yr(e={...e,...$n(e,r,n)}),((e,t)=>{const{sign:n}=e,r=-1===n?$r(e):e,{hours:a,minutes:o}=r,[i,s]=Dt(Lr(r,3),Ri,Be);Ar(i);const l=lr(s,t),d=t>=0||!n||l;return(n<0?"-":"")+"P"+Qn({Y:cr(r.years),M:cr(r.months),W:cr(r.weeks),D:cr(r.days)})+(a||o||i||d?"T"+Qn({H:cr(a),M:cr(o),S:cr(i,d)+l}):"")})(e,a)}function Kn(e,t,n,r){const a=r>1||0===r&&e!==ns;return 1===r?e===ns?t(n):tr(n):a?tr(n)+sr(e,2===r):t(n)}function Qn(e){const t=[];for(const n in e){const r=e[n];r&&t.push(r,n)}return t.join("")}function er(e,t){return tr(e)+"T"+ar(e,t)}function tr(e){return nr(e)+"-"+ki(e.isoDay)}function nr(e){const{isoYear:t}=e;return(t<0||t>9999?dr(t)+Le(6,Math.abs(t)):Le(4,t))+"-"+ki(e.isoMonth)}function rr(e){return ki(e.isoMonth)+"-"+ki(e.isoDay)}function ar(e,t){const n=[ki(e.isoHour),ki(e.isoMinute)];return-1!==t&&n.push(ki(e.isoSecond)+((e,t,n,r)=>lr(e*Oi+t*Hi+n,r))(e.isoMillisecond,e.isoMicrosecond,e.isoNanosecond,t)),n.join(":")}function or(e,t=0){if(1===t)return"";const[n,r]=ze(Math.abs(e),$i),[a,o]=ze(r,Pi),[i,s]=ze(o,Ri);return dr(e)+ki(n)+":"+ki(a)+(i||s?":"+ki(i)+lr(s):"")}function ir(e,t){return 1!==t&&(t>1||0===t&&e!==ns)?sr(e,2===t):""}function sr(e,t){return"["+(t?"!":"")+"u-ca="+e+"]"}function lr(e,t){let n=Le(9,e);return n=void 0===t?n.replace(Cl,""):n.slice(0,t),n?"."+n:""}function dr(e){return e<0?"-":"+"}function cr(e,t){return e||t?e.toLocaleString("fullwide",{useGrouping:0}):""}function ur(e,t){const{epochNanoseconds:n}=e,r=(t.R?t:t(e.timeZone)).R(n),a=Pt(n,r);return{calendar:e.calendar,...a,offsetNanoseconds:r}}function hr(e,t,n,r=0,a=0,o,i){if(void 0!==n&&1===r&&(1===r||i))return St(t,n);const s=e.I(t);if(void 0!==n&&3!==r){const e=((e,t,n,r)=>{const a=It(t);r&&(n=Hn(n));for(const t of e){let e=bt(ft(t,a));if(r&&(e=Hn(e)),e===n)return t}})(s,t,n,o);if(void 0!==e)return e;if(0===r)throw new RangeError(ui)}return i?It(t):gr(e,t,a,s)}function gr(e,t,n=0,r=e.I(t)){if(1===r.length)return r[0];if(1===n)throw new RangeError(hi);if(r.length)return r[3===n?1:0];const a=It(t),o=((e,t)=>{const n=e.R(gt(t,-ji));return(e=>{if(e>ji)throw new RangeError(ci);return e})(e.R(gt(t,ji))-n)})(e,a),i=o*(2===n?-1:1);return(r=e.I(Pt(a,i)))[2===n?0:r.length-1]}function fr(e,t){const n=e.I(t);if(n.length)return n[0];const r=gt(It(t),-ji);return e.O(r,1)}function mr(e,t,n){return mn(Mt(ht(t.epochNanoseconds,(e=>{if(zr(e))throw new RangeError(yi);return Lr(e,5)})(e?$r(n):n))))}function vr(e,t,n,r,a,o=Object.create(null)){const i=t(r.timeZone),s=e(r.calendar);return{...r,...wr(i,s,r,n?$r(a):a,o)}}function yr(e,t,n,r,a=Object.create(null)){const{calendar:o}=n;return yn(xr(e(o),n,t?$r(r):r,a),o)}function pr(e,t,n,r,a){const{calendar:o}=n;return pn(Er(e(o),n,t?$r(r):r,a),o)}function br(e,t,n,r,a){const o=n.calendar,i=e(o);let s=xt(Mr(i,n));t&&(r=Pr(r)),r.sign<0&&(s=i.P(s,{...ys,months:1}),s=kr(s,-1));const l=i.P(s,r,a);return bn(Mr(i,l),o)}function Dr(e,t,n){return wn(Cr(t,e?$r(n):n)[0])}function wr(e,t,n,r,a){const o=Lr(r,5);let i=n.epochNanoseconds;if(zr(r)){const s=kl(n,e);i=ht(gr(e,{...Er(t,s,{...r,...ps},a),...Oe(Ds,s)}),o)}else i=ht(i,o),Jt(a);return{epochNanoseconds:Mt(i)}}function xr(e,t,n,r){const[a,o]=Cr(t,n);return Et({...Er(e,t,{...n,...ps,days:n.days+o},r),...a})}function Er(e,t,n,r){if(n.years||n.months||n.weeks)return e.P(t,n,r);Jt(r);const a=n.days+Lr(n,5)[0];return a?xt(kr(t,a)):t}function Mr(e,t,n=1){return kr(t,n-e.day(t))}function Cr(e,t){const[n,r]=Lr(t,5),[a,o]=kt(Ct(e)+r);return[a,n+o]}function kr(e,t){return t?{...e,...$t(Nt(e)+t*Ii)}:e}function Tr(e,t,n){const r=e(n.calendar);return Hr(n)?[n,r,t(n.timeZone)]:[{...n,...ks},r]}function Nr(e){return e?Mn:It}function Ir(e){return e?je(wr,e):xr}function Sr(e){return e?je(ka,e):Ta}function Hr(e){return e&&e.epochNanoseconds}function Or(e,t){return e<=6-(Hr(t)?1:0)}function Rr(e,t,n,r,a,o,i){const s=e(dn(i).relativeTo),l=Math.max(Vr(a),Vr(o));if(Or(l,s))return xn(Yr(((e,t,n,r)=>{const a=ht(Lr(e),Lr(t),r?-1:1);if(!Number.isFinite(a[0]))throw new RangeError(gi);return{...ys,...Zr(a,n)}})(a,o,l,r)));if(!s)throw new RangeError(vi);r&&(o=$r(o));const[d,c,u]=Tr(t,n,s),h=Ir(u),g=Sr(u),f=h(c,d,a);return xn(g(c,d,h(c,f,o),l))}function Pr(e){return xn($r(e))}function $r(e){const t={};for(const n of us)t[n]=-1*e[n]||0;return t}function jr(e,t=us){let n=0;for(const r of t){const t=Math.sign(e[r]);if(t){if(n&&n!==t)throw new RangeError(mi);n=t}}return n}function Yr(e){for(const t of ms)we(t,e[t],-Tl,Tl,1);return Ar(bt(Lr(e),Ri)),e}function Ar(e){if(!Number.isSafeInteger(e))throw new RangeError(fi)}function Lr(e,t=6){return _e(e,t,us)}function Zr(e,t=6){const[n,r]=e,a=Xe(r,t,us);if(a[us[t]]+=n*(ji/Yi[t]),!Number.isFinite(a[us[t]]))throw new RangeError(gi);return a}function Fr(e,t=5){return Xe(e,t,us)}function zr(e){return Boolean(jr(e,fs))}function Vr(e){let t=9;for(;t>0&&!e[us[t]];t--);return t}function Br(e,t){return[e,t]}function Wr(e){const t=Math.floor(e/xl)*xl;return[t,t+xl]}function Ur(e){const t=na(e);if(void 0===t)throw new RangeError(Di(e));return t}function qr(e,t,n){let r=Qr(ls(e));if(!r||r.j)throw new RangeError(Di(e));return t?r.calendar===ns&&(r=-271821===r.isoYear&&4===r.isoMonth?{...r,isoDay:20,...ks}:{...r,isoDay:1,...ks}):n&&r.calendar===ns&&(r={...r,isoYear:Ys}),pn(r.C?Gr(r):Jr(r))}function _r(e){if(e.calendar!==ns)throw new RangeError(wi(e.calendar))}function Xr(e,t,n=0,r=0){const a=ca(e.timeZone),o=Nl(a);let i;return Ut(e),i=e.C?hr(o,e,t,n,r,!o.$,e.j):fr(o,e),vn(i,a,lo(e.calendar))}function Gr(e){return Kr(Et(Ut(e)))}function Jr(e){return Kr(xt(qt(e)))}function Kr(e){return{...e,calendar:lo(e.calendar)}}function Qr(e){const t=Fl.exec(e);return t?(e=>{const t=e[10],n="Z"===(t||"").toUpperCase();return{isoYear:ra(e),isoMonth:parseInt(e[4]),isoDay:parseInt(e[5]),...aa(e.slice(5)),...oa(e[16]),C:Boolean(e[6]),j:n,offset:n?void 0:t}})(t):void 0}function ea(e){const t=Ll.exec(e);return t?(e=>({isoYear:ra(e),isoMonth:parseInt(e[4]),isoDay:1,...oa(e[5])}))(t):void 0}function ta(e){const t=Zl.exec(e);return t?(e=>({isoYear:Ys,isoMonth:parseInt(e[1]),isoDay:parseInt(e[2]),...oa(e[3])}))(t):void 0}function na(e,t){const n=Vl.exec(e);return n?((e,t)=>{const n=e[4]||e[5];if(t&&n)throw new RangeError(wi(n));return(e=>{if(Math.abs(e)>=ji)throw new RangeError(di);return e})((da(e[2])*$i+da(e[3])*Pi+da(e[4])*Ri+ia(e[5]||""))*la(e[1]))})(n,t):void 0}function ra(e){const t=la(e[1]),n=parseInt(e[2]||e[3]);if(t<0&&!n)throw new RangeError(wi(-0));return t*n}function aa(e){const t=da(e[3]);return{...kt(ia(e[4]||""))[0],isoHour:da(e[1]),isoMinute:da(e[2]),isoSecond:60===t?59:t}}function oa(e){let t,n;const r=[];if(e.replace(Bl,(e,a,o)=>{const i=Boolean(a),[s,l]=o.split("=").reverse();if(l){if("u-ca"===l)r.push(s),t||(t=i);else if(i||/[A-Z]/.test(l))throw new RangeError(wi(e))}else{if(n)throw new RangeError(wi(e));n=s}return""}),r.length>1&&t)throw new RangeError(wi(e));return{timeZone:n,calendar:r[0]||ns}}function ia(e){return parseInt(e.padEnd(9,"0"))}function sa(e){return new RegExp(`^${e}$`,"i")}function la(e){return e&&"+"!==e?-1:1}function da(e){return void 0===e?0:parseInt(e)}function ca(e){const t=ha(e);return"number"==typeof t?or(t):t?(e=>{if(_l.test(e))throw new RangeError(ii(e));if(ql.test(e))throw new RangeError(li);return e.toLowerCase().split("/").map((e,t)=>(e.length<=3||/\d/.test(e))&&!/etc|yap/.test(e)?e.toUpperCase():e.replace(/baja|dumont|[a-z]+/g,(e,n)=>e.length<=2&&!t||"in"===e||"chat"===e?e.toUpperCase():e.length>2||!n?Ye(e).replace(/island|noronha|murdo|rivadavia|urville/,Ye):e)).join("/")})(e):wl}function ua(e){const t=ha(e);return"number"==typeof t?t:t?t.resolvedOptions().timeZone:wl}function ha(e){const t=na(e=e.toUpperCase(),1);return void 0!==t?t:e!==wl?Ul(e):void 0}function ga(e,t){return mt(e.epochNanoseconds,t.epochNanoseconds)}function fa(e,t){return mt(e.epochNanoseconds,t.epochNanoseconds)}function ma(e,t){return va(e,t)||ya(e,t)}function va(e,t){return Ze(Nt(e),Nt(t))}function ya(e,t){return Ze(Ct(e),Ct(t))}function pa(e,t){if(e===t)return 1;try{return ua(e)===ua(t)}catch(e){}}function ba(e,t,n,r){const a=Qt(e,r,3,5),o=Sa(t.epochNanoseconds,n.epochNanoseconds,...a);return xn(e?$r(o):o)}function Da(e,t,n,r,a,o){const i=$a(r.calendar,a.calendar),[s,l,d,c]=Qt(n,o,5),u=r.epochNanoseconds,h=a.epochNanoseconds,g=mt(h,u);let f;if(g)if(s<6)f=Sa(u,h,s,l,d,c);else{const n=t(((e,t)=>{if(!pa(e,t))throw new RangeError(si);return e})(r.timeZone,a.timeZone)),u=e(i);f=Na(u,n,r,a,g,s,o),f=jn(f,h,s,l,d,c,u,r,Mn,je(wr,n))}else f=ys;return xn(n?$r(f):f)}function wa(e,t,n,r,a){const o=$a(n.calendar,r.calendar),[i,s,l,d]=Qt(t,a,6),c=It(n),u=It(r),h=mt(u,c);let g;if(h)if(i<=6)g=Sa(c,u,i,s,l,d);else{const t=e(o);g=Ia(t,n,r,h,i,a),g=jn(g,u,i,s,l,d,t,n,It,xr)}else g=ys;return xn(t?$r(g):g)}function xa(e,t,n,r,a){const o=$a(n.calendar,r.calendar);return Ma(t,()=>e(o),n,r,...Qt(t,a,6,9,6))}function Ea(e,t,n,r,a){const o=$a(n.calendar,r.calendar),i=Qt(t,a,9,9,8),s=e(o),l=Mr(s,n),d=Mr(s,r);return l.isoYear===d.isoYear&&l.isoMonth===d.isoMonth&&l.isoDay===d.isoDay?xn(ys):Ma(t,()=>s,xt(l),xt(d),...i,8)}function Ma(e,t,n,r,a,o,i,s,l=6){const d=It(n),c=It(r);if(void 0===d||void 0===c)throw new RangeError(gi);let u;if(mt(c,d))if(6===a)u=Sa(d,c,a,o,i,s);else{const e=t();u=e.N(n,r,a),o===l&&1===i||(u=jn(u,c,a,o,i,s,e,n,It,Er))}else u=ys;return xn(e?$r(u):u)}function Ca(e,t,n,r){const[a,o,i,s]=Qt(e,r,5,5),l=Ln(Pa(t,n),On(o,i),s),d={...ys,...Fr(l,a)};return xn(e?$r(d):d)}function ka(e,t,n,r,a,o){const i=mt(r.epochNanoseconds,n.epochNanoseconds);return i?a<6?Ha(n.epochNanoseconds,r.epochNanoseconds,a):Na(t,e,n,r,i,a,o):ys}function Ta(e,t,n,r,a){const o=It(t),i=It(n),s=mt(i,o);return s?r<=6?Ha(o,i,r):Ia(e,t,n,s,r,a):ys}function Na(e,t,n,r,a,o,i){const[s,l,d]=((e,t,n,r)=>{function a(){return u={...kr(s,d++*-r),...i},h=gr(e,u),mt(l,h)===-r}const o=kl(t,e),i=Oe(Ds,o),s=kl(n,e),l=n.epochNanoseconds;let d=0;const c=Pa(o,s);let u,h;if(Math.sign(c)===-r&&d++,a()&&(-1===r||a()))throw new RangeError(ri);const g=bt(ft(h,l));return[o,u,g]})(t,n,r,a);var c,u;return{...6===o?(c=s,u=l,{...ys,days:Oa(c,u)}):e.N(s,l,o,i),...Fr(d)}}function Ia(e,t,n,r,a,o){const[i,s,l]=((e,t,n)=>{let r=t,a=Pa(e,t);return Math.sign(a)===-n&&(r=kr(t,-n),a+=ji*n),[e,r,a]})(t,n,r);return{...e.N(i,s,a,o),...Fr(l)}}function Sa(e,t,n,r,a,o){return{...ys,...Zr(Yn(ft(e,t),r,a,o),n)}}function Ha(e,t,n){return{...ys,...Zr(ft(e,t),n)}}function Oa(e,t){return Ra(Nt(e),Nt(t))}function Ra(e,t){return Math.trunc((t-e)/Ii)}function Pa(e,t){return Ct(t)-Ct(e)}function $a(e,t){if(e!==t)throw new RangeError(oi);return e}function ja(e){return this.m(e)[0]}function Ya(e){return this.m(e)[1]}function Aa(e){const[t]=this.v(e);return Ra(this.p(t),Nt(e))+1}function La(e){const t=Xl.exec(e);if(!t)throw new RangeError(Qo(e));return[parseInt(t[1]),Boolean(t[2])]}function Za(e,t){return"M"+ki(e)+(t?"L":"")}function Fa(e,t,n){return e+(t||n&&e>=n?1:0)}function za(e,t){return e-(t&&e>=t?1:0)}function Va(e,t){return(t+e)*(Math.sign(t)||1)||0}function Ba(e){return os[Ua(e)]}function Wa(e){return ss[Ua(e)]}function Ua(e){return co(e.id||ns)}function qa(e){function t(e){return((e,t)=>({...Ga(e,t),o:e.month,day:parseInt(e.day)}))(jt(n,e),r)}const n=Jl(e),r=co(e);return{id:e,h:_a(t),l:Xa(t)}}function _a(e){return Ee(t=>{const n=Nt(t);return e(n)},WeakMap)}function Xa(e){const t=e(0).year-js;return Ee(n=>{let r,a=Ot(n-t),o=0;const i=[],s=[];do{a+=400*Ii}while((r=e(a)).year<=n);do{if(a+=(1-r.day)*Ii,r.year===n&&(i.push(a),s.push(r.o)),a-=Ii,++o>100||a<-Is)throw new RangeError(ri)}while((r=e(a)).year>=n);return{i:i.reverse(),u:Mi(s.reverse())}})}function Ga(e,t){let n,r,a=Ja(e);if(e.era){const o=os[t],i=is[t]||{};void 0!==o&&(n="islamic"===t?"ah":e.era.normalize("NFD").toLowerCase().replace(/[^a-z0-9]/g,""),"bc"===n||"b"===n?n="bce":"ad"===n||"a"===n?n="ce":"beforeroc"===n&&(n="broc"),n=i[n]||n,r=a,a=Va(r,o[n]||0))}return{era:n,eraYear:r,year:a}}function Ja(e){return parseInt(e.relatedYear||e.year)}function Ka(e){const{year:t,o:n,day:r}=this.h(e),{u:a}=this.l(t);return[t,a[n]+1,r]}function Qa(e,t=1,n=1){return this.l(e).i[t-1]+(n-1)*Ii}function eo(e,t){const n=to.call(this,e);return[za(t,n),n===t]}function to(e){const t=io(this,e),n=io(this,e-1),r=t.length;if(r>n.length){const e=Wa(this);if(e<0)return-e;for(let e=0;e<r;e++)if(t[e]!==n[e])return e+1}}function no(e){return Ra(Qa.call(this,e),Qa.call(this,e+1))}function ro(e,t){const{i:n}=this.l(e);let r=t+1,a=n;return r>n.length&&(r=1,a=this.l(e+1).i),Ra(n[t-1],a[r-1])}function ao(e){return this.l(e).i.length}function oo(e){const t=this.h(e);return[t.era,t.eraYear]}function io(e,t){return Object.keys(e.l(t).u)}function so(e){return lo(ls(e))}function lo(e){if((e=e.toLowerCase())!==ns&&e!==rs){const t=Jl(e).resolvedOptions().calendar;if(co(e)!==co(t))throw new RangeError(ai(e));return t}return e}function co(e){return"islamicc"===e&&(e="islamic"),e.split("-")[0]}function uo(e,t){return n=>n===ns?e:n===rs||n===as?Object.assign(Object.create(e),{id:n}):Object.assign(Object.create(t),Gl(n))}function ho(e,t,n,r){const a=go(n,r,Ki,[],Vi);if(void 0!==a.timeZone){const r=n.F(a),o=mo(a),i=e(a.timeZone);return{epochNanoseconds:hr(t(i),{...r,...o},void 0!==a.offset?Ur(a.offset):void 0),timeZone:i}}return{...n.F(a),...ks}}function go(e,t,n,r=[],a=[]){return fo(t,[...e.fields(n),...a].sort(),r)}function fo(e,t,n,r=!n){const a={};let o,i=0;for(const r of t){if(r===o)throw new RangeError(Bo(r));if("constructor"===r||"__proto__"===r)throw new RangeError(Vo(r));let t=e[r];if(void 0!==t)i=1,ld[r]&&(t=ld[r](t,r)),a[r]=t;else if(n){if(n.includes(r))throw new TypeError(zo(r));a[r]=ts[r]}o=r}if(r&&!i)throw new TypeError(Wo(t));return a}function mo(e,t){return Gt(dd({...ts,...e}),t)}function vo(e,t,n,r,a){t=Oe(n=e.fields(n),t),r=fo(r,a=e.fields(a),[]);let o=e.k(t,r);return o=fo(o,[...n,...a].sort(),[]),e.F(o)}function yo(e,t){const n=Ba(e),r=is[e.id||""]||{};let{era:a,eraYear:o,year:i}=t;if(void 0!==a||void 0!==o){if(void 0===a||void 0===o)throw new TypeError(Xo);if(!n)throw new RangeError(_o);const e=n[r[a]||a];if(void 0===e)throw new RangeError(Jo(a));const t=Va(o,e);if(void 0!==i&&i!==t)throw new RangeError(Go);i=t}else if(void 0===i)throw new TypeError(Ko(n));return i}function po(e,t,n,r){let{month:a,monthCode:o}=t;if(void 0!==o){const t=((e,t,n,r)=>{const a=e.L(n),[o,i]=La(t);let s=Fa(o,i,a);if(i){const t=Wa(e);if(void 0===t)throw new RangeError(ni);if(t>0){if(s>t)throw new RangeError(ni);if(void 0===a){if(1===r)throw new RangeError(ni);s--}}else{if(s!==-t)throw new RangeError(ni);if(void 0===a&&1===r)throw new RangeError(ni)}}return s})(e,o,n,r);if(void 0!==a&&a!==t)throw new RangeError(ei);a=t,r=1}else if(void 0===a)throw new TypeError(ti);return we("month",a,1,e.B(n),r)}function bo(e,t,n,r,a){return De(t,"day",1,e.U(r,n),a)}function Do(e,t,n,r){let a=0;const o=[];for(const e of n)void 0!==t[e]?a=1:o.push(e);if(Object.assign(e,t),a)for(const t of r||o)delete e[t]}function wo(e){const t=id(e.calendar),[n,r,a]=t.v(e),[o,i]=t.q(n,r);return{year:n,monthCode:Za(o,i),day:a}}function xo(e,t){return yn(kl(t,e))}function Eo(e,t){return pn(kl(t,e))}function Mo(e,t){return wn(kl(t,e))}function Co(e,t,n){const r=new Set(n);return(a,o)=>{const i=n&&Re(a,n);if(!Re(a=((e,t)=>{const n={};for(const r in t)e.has(r)||(n[r]=t[r]);return n})(r,a),e)){if(o&&i)throw new TypeError("Invalid formatting options");a={...t,...a}}return n&&(a.timeZone=wl,["full","long"].includes(a.J)&&(a.J="medium")),a}}function ko(e,t=To,n=0){const[r,,,a]=e;return(o,i=Zd,...s)=>{const l=t(a&&a(...s),o,i,r,n),d=l.resolvedOptions();return[l,...No(e,d,s)]}}function To(e,t,n,r,a){if(n=r(n,a),e){if(void 0!==n.timeZone)throw new TypeError(Ei);n.timeZone=e}return new Ps(t,n)}function No(e,t,n){const[,r,a]=e;return n.map(e=>(e.calendar&&((e,t,n)=>{if((n||e!==ns)&&e!==t)throw new RangeError(oi)})(e.calendar,t.calendar,a),r(e,t)))}function Io(e,t){return{...e,calendar:t}}function So(e){const t=Ho();return Pt(t,e.R(t))}function Ho(){return pt(Date.now(),Oi)}function Oo(){return Xd||(Xd=(new Ps).resolvedOptions().timeZone)}const Ro=(e,t)=>`Non-integer ${e}: ${t}`,Po=(e,t)=>`Non-positive ${e}: ${t}`,$o=(e,t)=>`Non-finite ${e}: ${t}`,jo=e=>`Cannot convert bigint to ${e}`,Yo=e=>`Invalid bigint: ${e}`,Ao="Cannot convert Symbol to string",Lo="Invalid object",Zo=(e,t,n,r,a)=>a?Zo(e,a[t],a[n],a[r]):Fo(e,t)+`; must be between ${n}-${r}`,Fo=(e,t)=>`Invalid ${e}: ${t}`,zo=e=>`Missing ${e}`,Vo=e=>`Invalid field ${e}`,Bo=e=>`Duplicate field ${e}`,Wo=e=>"No valid fields: "+e.join(),Uo=(e,t,n)=>Fo(e,t)+"; must be "+Object.keys(n).join(),qo="Invalid calling context",_o="Forbidden era/eraYear",Xo="Mismatching era/eraYear",Go="Mismatching year/eraYear",Jo=e=>`Invalid era: ${e}`,Ko=e=>"Missing year"+(e?"/era/eraYear":""),Qo=e=>`Invalid monthCode: ${e}`,ei="Mismatching month/monthCode",ti="Missing month/monthCode",ni="Invalid leap month",ri="Invalid protocol results",ai=e=>Fo("Calendar",e),oi="Mismatching Calendars",ii=e=>Fo("TimeZone",e),si="Mismatching TimeZones",li="Forbidden ICU TimeZone",di="Out-of-bounds offset",ci="Out-of-bounds TimeZone gap",ui="Invalid TimeZone offset",hi="Ambiguous offset",gi="Out-of-bounds date",fi="Out-of-bounds duration",mi="Cannot mix duration signs",vi="Missing relativeTo",yi="Cannot use large units",pi="Required smallestUnit or largestUnit",bi="smallestUnit > largestUnit",Di=e=>`Cannot parse: ${e}`,wi=e=>`Invalid substring: ${e}`,xi="Mismatching types for formatting",Ei="Cannot specify TimeZone",Mi=je(Se,(e,t)=>t),Ci=je(Se,(e,t,n)=>n),ki=je(Le,2),Ti={nanosecond:0,microsecond:1,millisecond:2,second:3,minute:4,hour:5,day:6,week:7,month:8,year:9},Ni=Object.keys(Ti),Ii=864e5,Si=1e3,Hi=1e3,Oi=1e6,Ri=1e9,Pi=6e10,$i=36e11,ji=864e11,Yi=[1,Hi,Oi,Ri,Pi,$i,ji],Ai=Ni.slice(0,6),Li=Ae(Ai),Zi=["offset"],Fi=["timeZone"],zi=Ai.concat(Zi),Vi=zi.concat(Fi),Bi=["era","eraYear"],Wi=Bi.concat(["year"]),Ui=["year"],qi=["monthCode"],_i=["month"].concat(qi),Xi=["day"],Gi=_i.concat(Ui),Ji=qi.concat(Ui),Ki=Xi.concat(Gi),Qi=Xi.concat(_i),es=Xi.concat(qi),ts=Ci(Ai,0),ns="iso8601",rs="gregory",as="japanese",os={[rs]:{"gregory-inverse":-1,gregory:0},[as]:{"japanese-inverse":-1,japanese:0,meiji:1867,taisho:1911,showa:1925,heisei:1988,reiwa:2018},ethiopic:{ethioaa:0,ethiopic:5500},coptic:{"coptic-inverse":-1,coptic:0},roc:{"roc-inverse":-1,roc:0},buddhist:{be:0},islamic:{ah:0},indian:{saka:0},persian:{ap:0}},is={[rs]:{bce:"gregory-inverse",ce:"gregory"},[as]:{bce:"japanese-inverse",ce:"japanese"},ethiopic:{era0:"ethioaa",era1:"ethiopic"},coptic:{era0:"coptic-inverse",era1:"coptic"},roc:{broc:"roc-inverse",minguo:"roc"}},ss={chinese:13,dangi:13,hebrew:-6},ls=je(tt,"string"),ds=je(tt,"boolean"),cs=je(tt,"number"),us=Ni.map(e=>e+"s"),hs=Ae(us),gs=us.slice(0,6),fs=us.slice(6),ms=fs.slice(1),vs=Mi(us),ys=Ci(us,0),ps=Ci(gs,0),bs=je($e,us),Ds=["isoNanosecond","isoMicrosecond","isoMillisecond","isoSecond","isoMinute","isoHour"],ws=["isoDay","isoMonth","isoYear"],xs=Ds.concat(ws),Es=Ae(ws),Ms=Ae(Ds),Cs=Ae(xs),ks=Ci(Ms,0),Ts=je($e,xs),Ns=1e8,Is=Ns*Ii,Ss=[Ns,0],Hs=[-Ns,0],Os=275760,Rs=-271821,Ps=Intl.DateTimeFormat,$s="en-GB",js=1970,Ys=1972,As=12,Ls=Ot(1868,9,8),Zs=Ee(Wt,WeakMap),Fs="smallestUnit",zs="unit",Vs="roundingIncrement",Bs="fractionalSecondDigits",Ws="relativeTo",Us="direction",qs={constrain:0,reject:1},_s=Object.keys(qs),Xs={compatible:0,reject:1,earlier:2,later:3},Gs={reject:0,use:1,prefer:2,ignore:3},Js={auto:0,never:1,critical:2,always:3},Ks={auto:0,never:1,critical:2},Qs={auto:0,never:1},el={floor:0,halfFloor:1,ceil:2,halfCeil:3,trunc:4,halfTrunc:5,expand:6,halfExpand:7,halfEven:8},tl={previous:-1,next:1},nl=je(hn,Fs),rl=je(hn,"largestUnit"),al=je(hn,zs),ol=je(gn,"overflow",qs),il=je(gn,"disambiguation",Xs),sl=je(gn,"offset",Gs),ll=je(gn,"calendarName",Js),dl=je(gn,"timeZoneName",Ks),cl=je(gn,"offset",Qs),ul=je(gn,"roundingMode",el),hl="PlainYearMonth",gl="PlainMonthDay",fl="PlainDate",ml="PlainDateTime",vl="PlainTime",yl="ZonedDateTime",pl="Instant",bl="Duration",Dl=[Math.floor,e=>qe(e)?Math.floor(e):Math.round(e),Math.ceil,e=>qe(e)?Math.ceil(e):Math.round(e),Math.trunc,e=>qe(e)?Math.trunc(e)||0:Math.round(e),e=>e<0?Math.floor(e):Math.ceil(e),e=>Math.sign(e)*Math.round(Math.abs(e))||0,e=>qe(e)?(e=Math.trunc(e)||0)+e%2:Math.round(e)],wl="UTC",xl=5184e3,El=Ht(1847),Ml=Ht((new Date).getUTCFullYear()+10),Cl=/0+$/,kl=Ee(ur,WeakMap),Tl=2**32-1,Nl=Ee(e=>{const t=ha(e);return"object"==typeof t?new Sl(t):new Il(t||0)});class Il{constructor(e){this.$=e}R(){return this.$}I(e){return(e=>{const t=It({...e,...ks});if(!t||Math.abs(t[0])>1e8)throw new RangeError(gi)})(e),[St(e,this.$)]}O(){}}class Sl{constructor(e){this.nn=(e=>{function t(e){const t=Fe(e,o,i),[s,l]=Wr(t),d=r(s),c=r(l);return d===c?d:n(a(s,l),d,c,e)}function n(t,n,r,a){let o,i;for(;(void 0===a||void 0===(o=a<t[0]?n:a>=t[1]?r:void 0))&&(i=t[1]-t[0]);){const n=t[0]+Math.floor(i/2);e(n)===r?t[1]=n:t[0]=n+1}return o}const r=Ee(e),a=Ee(Br);let o=El,i=Ml;return{tn(e){const n=t(e-86400),r=t(e+86400),a=e-n,o=e-r;if(n===r)return[a];const i=t(a);return i===t(o)?[e-i]:n>r?[a,o]:[]},rn:t,O(e,t){const s=Fe(e,o,i);let[l,d]=Wr(s);const c=xl*t,u=t<0?()=>d>o||(o=s,0):()=>l<i||(i=s,0);for(;u();){const o=r(l),i=r(d);if(o!==i){const r=a(l,d);n(r,o,i);const s=r[0];if((Ze(s,e)||1)===t)return s}l+=c,d+=c}}}})((e=>t=>{const n=jt(e,t*Si);return Ht(Ja(n),parseInt(n.month),parseInt(n.day),parseInt(n.hour),parseInt(n.minute),parseInt(n.second))-t})(e))}R(e){return this.nn.rn((e=>Tt(e)[0])(e))*Ri}I(e){const[t,n]=[Ht((r=e).isoYear,r.isoMonth,r.isoDay,r.isoHour,r.isoMinute,r.isoSecond),r.isoMillisecond*Oi+r.isoMicrosecond*Hi+r.isoNanosecond];var r;return this.nn.tn(t).map(e=>Mt(gt(pt(e,Ri),n)))}O(e,t){const[n,r]=Tt(e),a=this.nn.O(n+(t>0||r?1:0),t);if(void 0!==a)return pt(a,Ri)}}const Hl="([+-])",Ol="(?:[.,](\\d{1,9}))?",Rl=`(?:(?:${Hl}(\\d{6}))|(\\d{4}))-?(\\d{2})`,Pl="(\\d{2})(?::?(\\d{2})(?::?(\\d{2})"+Ol+")?)?",$l=Hl+Pl,jl=Rl+"-?(\\d{2})(?:[T ]"+Pl+"(Z|"+$l+")?)?",Yl="\\[(!?)([^\\]]*)\\]",Al=`((?:${Yl}){0,9})`,Ll=sa(Rl+Al),Zl=sa("(?:--)?(\\d{2})-?(\\d{2})"+Al),Fl=sa(jl+Al),zl=sa("T?"+Pl+"(?:"+$l+")?"+Al),Vl=sa($l),Bl=new RegExp(Yl,"g"),Wl=sa(`${Hl}?P(\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?(?:T(?:(\\d+)${Ol}H)?(?:(\\d+)${Ol}M)?(?:(\\d+)${Ol}S)?)?`),Ul=Ee(e=>new Ps($s,{timeZone:e,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),ql=/^(AC|AE|AG|AR|AS|BE|BS|CA|CN|CS|CT|EA|EC|IE|IS|JS|MI|NE|NS|PL|PN|PR|PS|SS|VS)T$/,_l=/[^\w\/:+-]+/,Xl=/^M(\d{2})(L?)$/,Gl=Ee(qa),Jl=Ee(e=>new Ps($s,{calendar:e,timeZone:wl,era:"short",year:"numeric",month:"short",day:"numeric"})),Kl={P(e,t,n){const r=Jt(n);let a,{years:o,months:i,weeks:s,days:l}=t;if(l+=Lr(t,5)[0],o||i)a=((e,t,n,r,a)=>{let[o,i,s]=e.v(t);if(n){const[t,r]=e.q(o,i);o+=n,i=Fa(t,r,e.L(o)),i=we("month",i,1,e.B(o),a)}return r&&([o,i]=e.un(o,i,r)),s=we("day",s,1,e.U(o,i),a),e.p(o,i,s)})(this,e,o,i,r);else{if(!s&&!l)return e;a=Nt(e)}if(void 0===a)throw new RangeError(gi);return a+=(7*s+l)*Ii,xt($t(a))},N(e,t,n){if(n<=7){let r=0,a=Oa({...e,...ks},{...t,...ks});return 7===n&&([r,a]=Be(a,7)),{...ys,weeks:r,days:a}}const r=this.v(e),a=this.v(t);let[o,i,s]=((e,t,n,r,a,o,i)=>{let s=a-t,l=o-n,d=i-r;if(s||l){const c=Math.sign(s||l);let u=e.U(a,o),h=0;if(Math.sign(d)===-c){const r=u;[a,o]=e.un(a,o,-c),s=a-t,l=o-n,u=e.U(a,o),h=c<0?-r:u}if(d=i-Math.min(r,u)+h,s){const[r,i]=e.q(t,n),[d,u]=e.q(a,o);if(l=d-r||Number(u)-Number(i),Math.sign(l)===-c){const n=c<0&&-e.B(a);s=(a-=c)-t,l=o-Fa(r,i,e.L(a))+(n||e.B(a))}}}return[s,l,d]})(this,...r,...a);return 8===n&&(i+=this.cn(o,r[0]),o=0),{...ys,years:o,months:i,days:s}},F(e,t){const n=Jt(t),r=yo(this,e),a=po(this,e,r,n),o=bo(this,e,a,r,n);return pn(xt(this.V(r,a,o)),this.id||ns)},K(e,t){const n=Jt(t),r=yo(this,e),a=po(this,e,r,n);return bn(wt(this.V(r,a,1)),this.id||ns)},_(e,t){const n=Jt(t);let r,a,o,i=void 0!==e.eraYear||void 0!==e.year?yo(this,e):void 0;const s=!this.id;if(void 0===i&&s&&(i=Ys),void 0!==i){const t=po(this,e,i,n);r=bo(this,e,t,i,n);const s=this.L(i);a=za(t,s),o=t===s}else{if(void 0===e.monthCode)throw new TypeError(ti);if([a,o]=La(e.monthCode),this.id&&this.id!==rs&&this.id!==as)if(this.id&&"coptic"===co(this.id)&&0===n){const t=o||13!==a?30:6;r=e.day,r=Fe(r,1,t)}else if(this.id&&"chinese"===co(this.id)&&0===n){const t=!o||1!==a&&9!==a&&10!==a&&11!==a&&12!==a?30:29;r=e.day,r=Fe(r,1,t)}else r=e.day;else r=bo(this,e,po(this,e,Ys,n),Ys,n)}const l=this.G(a,o,r);if(!l)throw new RangeError("Cannot guess year");const[d,c]=l;return Dn(xt(this.V(d,c,r)),this.id||ns)},fields(e){return Ba(this)&&e.includes("year")?[...e,...Bi]:e},k(e,t){const n=Object.assign(Object.create(null),e);return Do(n,t,_i),Ba(this)&&(Do(n,t,Wi),this.id===as&&Do(n,t,Qi,Bi)),n},inLeapYear(e){const[t]=this.v(e);return this.sn(t)},monthsInYear(e){const[t]=this.v(e);return this.B(t)},daysInMonth(e){const[t,n]=this.v(e);return this.U(t,n)},daysInYear(e){const[t]=this.v(e);return this.fn(t)},dayOfYear:Aa,era(e){return this.hn(e)[0]},eraYear(e){return this.hn(e)[1]},monthCode(e){const[t,n]=this.v(e),[r,a]=this.q(t,n);return Za(r,a)},dayOfWeek:Vt,daysInWeek:()=>7},Ql={v:Yt,hn:Bt,q:At},ed={dayOfYear:Aa,v:Yt,p:Ot},td=Object.assign({},ed,{weekOfYear:ja,yearOfWeek:Ya,m(e){function t(e){return(7-e<r?7:0)-e}function n(e){const n=Ft(h+e),r=e||1,a=t(Ve(l+n*r,7));return c=(n+(a-d)*r)/7}const r=this.id?1:4,a=Vt(e),o=this.dayOfYear(e),i=Ve(a-1,7),s=o-1,l=Ve(i-s,7),d=t(l);let c,u=Math.floor((s-d)/7)+1,h=e.isoYear;return u?u>n(0)&&(u=1,h++):(u=n(-1),h--),[u,h,c]}}),nd=Object.assign({},Kl,td,{v:Yt,hn:Bt,q:At,G(e,t){if(!t)return[Ys,e]},sn:zt,L(){},B:Lt,cn:e=>e*As,U:Zt,fn:Ft,V:(e,t,n)=>({isoYear:e,isoMonth:t,isoDay:n}),p:Ot,un:(e,t,n)=>(e+=We(n,As),(t+=Ue(n,As))<1?(e--,t+=As):t>As&&(e++,t-=As),[e,t]),year:e=>e.isoYear,month:e=>e.isoMonth,day:e=>e.isoDay}),rd={v:Ka,hn:oo,q:eo},ad={dayOfYear:Aa,v:Ka,p:Qa,weekOfYear:ja,yearOfWeek:Ya,m:()=>[]},od=Object.assign({},Kl,ad,{v:Ka,hn:oo,q:eo,G(e,t,n){const r=this.id&&"chinese"===co(this.id)?((e,t,n)=>{if(t)switch(e){case 1:return 1651;case 2:return n<30?1947:1765;case 3:return n<30?1966:1955;case 4:return n<30?1963:1944;case 5:return n<30?1971:1952;case 6:return n<30?1960:1941;case 7:return n<30?1968:1938;case 8:return n<30?1957:1718;case 9:return 1832;case 10:return 1870;case 11:return 1814;case 12:return 1890}return 1972})(e,t,n):Ys;let[a,o,i]=Ka.call(this,{isoYear:r,isoMonth:As,isoDay:31});const s=to.call(this,a),l=o===s;1===(Ze(e,za(o,s))||Ze(Number(t),Number(l))||Ze(n,i))&&a--;for(let r=0;r<100;r++){const o=a-r,i=to.call(this,o),s=Fa(e,t,i);if(t===(s===i)&&n<=ro.call(this,o,s))return[o,s]}},sn(e){const t=no.call(this,e);return t>no.call(this,e-1)&&t>no.call(this,e+1)},L:to,B:ao,cn(e,t){const n=t+e,r=Math.sign(e),a=r<0?-1:0;let o=0;for(let e=t;e!==n;e+=r)o+=ao.call(this,e+a);return o},U:ro,fn:no,V(e,t,n){return $t(Qa.call(this,e,t,n))},p:Qa,un(e,t,n){if(n){if(t+=n,!Number.isSafeInteger(t))throw new RangeError(gi);if(n<0)for(;t<1;)t+=ao.call(this,--e);else{let n;for(;t>(n=ao.call(this,e));)t-=n,e++}}return[e,t]},year(e){return this.h(e).year},month(e){const{year:t,o:n}=this.h(e),{u:r}=this.l(t);return r[n]+1},day(e){return this.h(e).day}}),id=uo(Ql,rd),sd=uo(nd,od),ld={...{era:ot,eraYear:lt,year:lt,month:ct,monthCode(e){const t=ot(e);return La(t),t},day:ct},...Ci(Ai,lt),...Ci(us,dt),offset(e){const t=ot(e);return Ur(t),t}},dd=je(He,Ai,Ds),cd=je(He,Ds,Ai),ud="numeric",hd=["timeZoneName"],gd={month:ud,day:ud},fd={year:ud,month:ud},md=Object.assign({},fd,{day:ud}),vd={hour:ud,minute:ud,second:ud},yd=Object.assign({},md,vd),pd=Object.assign({},yd,{timeZoneName:"short"}),bd=Object.keys(fd),Dd=Object.keys(gd),wd=Object.keys(md),xd=Object.keys(vd),Ed=["dateStyle"],Md=bd.concat(Ed),Cd=Dd.concat(Ed),kd=wd.concat(Ed,["weekday"]),Td=xd.concat(["dayPeriod","timeStyle","fractionalSecondDigits"]),Nd=kd.concat(Td),Id=hd.concat(Td),Sd=hd.concat(kd),Hd=hd.concat(["day","weekday"],Td),Od=hd.concat(["year","weekday"],Td),Rd=Co(Nd,yd),Pd=Co(Nd,pd),$d=Co(Nd,yd,hd),jd=Co(kd,md,Id),Yd=Co(Td,vd,Sd),Ad=Co(Md,fd,Hd),Ld=Co(Cd,gd,Od),Zd={},Fd=new Ps(void 0,{calendar:ns}).resolvedOptions().calendar===ns,zd=[Rd,En],Vd=[Pd,En,0,(e,t)=>{const n=e.timeZone;if(t&&t.timeZone!==n)throw new RangeError(si);return n}],Bd=[$d,Nt],Wd=[jd,Nt],Ud=[Yd,e=>Ct(e)/Oi],qd=[Ad,Nt,Fd],_d=[Ld,Nt,Fd];let Xd;function Gd(e,t,n,r,a){function o(...e){if(!(this instanceof o))throw new TypeError(qo);xc(this,t(...e))}function i(e,t){return Object.defineProperties(function(...t){return e.call(this,s(this),...t)},Me(t))}function s(t){const n=wc(t);if(!n||n.branding!==e)throw new TypeError(qo);return n}return Object.defineProperties(o.prototype,{...ke(Ie(i,n)),...Ce(Ie(i,r)),...Te("Temporal."+e)}),Object.defineProperties(o,{...Ce(a),...Me(e)}),[o,e=>{const t=Object.create(o.prototype);return xc(t,e),t},s]}function Jd(e){if(wc(e)||void 0!==e.calendar||void 0!==e.timeZone)throw new TypeError("Invalid bag");return e}function Kd(e){return Qd(e)||ns}function Qd(e){const{calendar:t}=e;if(void 0!==t)return ec(t)}function ec(e){if(xe(e)){const{calendar:t}=wc(e)||{};if(!t)throw new TypeError(ai(e));return t}return(e=>lo(function(e){const t=Qr(e)||ea(e)||ta(e);return t?t.calendar:e}(ls(e))))(e)}function tc(e){const t={};for(const n in e)t[n]=e=>{const{calendar:t}=e;return sd(t)[n](e)};return t}function nc(){throw new TypeError("Cannot use valueOf")}function rc(e){if(xe(e)){const{timeZone:t}=wc(e)||{};if(!t)throw new TypeError(ii(e));return t}return(e=>ca(function(e){const t=Qr(e);return t&&(t.timeZone||t.j&&wl||t.offset)||e}(ls(e))))(e)}function ac(e){if(xe(e)){const t=wc(e);return t&&t.branding===bl?t:function(e){const t=fo(e,hs);return xn(Yr({...ys,...t}))}(e)}return function(e){const t=(e=>{const t=Wl.exec(e);return t?(e=>{function t(e,t,o){let i=0,s=0;if(o&&([i,a]=ze(a,Yi[o])),void 0!==e){if(r)throw new RangeError(wi(e));s=(e=>{const t=parseInt(e);if(!Number.isFinite(t))throw new RangeError(wi(e));return t})(e),n=1,t&&(a=ia(t)*(Yi[o]/Ri),r=1)}return i+s}let n=0,r=0,a=0,o={...Ne(us,[t(e[2]),t(e[3]),t(e[4]),t(e[5]),t(e[6],e[7],5),t(e[8],e[9],4),t(e[10],e[11],3)]),...Xe(a,2,us)};if(!n)throw new RangeError(Wo(us));return la(e[1])<0&&(o=$r(o)),o})(t):void 0})(ls(e));if(!t)throw new RangeError(Di(e));return xn(Yr(t))}(e)}function oc(e){if(void 0!==e){if(xe(e)){const t=wc(e)||{};switch(t.branding){case yl:case fl:return t;case ml:return pn(t)}const n=Kd(e);return{...ho(rc,Nl,sd(n),e),calendar:n}}return function(e){const t=Qr(ls(e));if(!t)throw new RangeError(Di(e));if(t.timeZone)return Xr(t,t.offset?Ur(t.offset):void 0);if(t.j)throw new RangeError(Di(e));return Jr(t)}(e)}}function ic(e,t){if(xe(e)){const n=wc(e)||{};switch(n.branding){case vl:return Jt(t),n;case ml:return Jt(t),wn(n);case yl:return Jt(t),Mo(Nl,n)}return function(e,t){return wn(mo(fo(e,Li,[],1),Jt(t)))}(e,t)}const n=function(e){let t,n=(e=>{const t=zl.exec(e);return t?(oa(t[10]),aa(t)):void 0})(ls(e));if(!n){if(n=Qr(e),!n)throw new RangeError(Di(e));if(!n.C)throw new RangeError(Di(e));if(n.j)throw new RangeError(wi("Z"));_r(n)}if((t=ea(e))&&_t(t))throw new RangeError(Di(e));if((t=ta(e))&&_t(t))throw new RangeError(Di(e));return wn(Gt(n,1))}(e);return Jt(t),n}function sc(e){return void 0===e?void 0:ic(e)}function lc(e,t){if(xe(e)){const n=wc(e)||{};switch(n.branding){case ml:return Jt(t),n;case fl:return Jt(t),yn({...n,...ks});case yl:return Jt(t),xo(Nl,n)}return function(e,t,n){const r=go(e,t,Ki,[],Ai),a=Jt(n);return yn(Et({...e.F(r,un(a)),...mo(r,a)}))}(sd(Kd(e)),e,t)}const n=function(e){const t=Qr(ls(e));if(!t||t.j)throw new RangeError(Di(e));return yn(Gr(t))}(e);return Jt(t),n}function dc(e,t){if(xe(e)){const n=wc(e);if(n&&n.branding===gl)return Jt(t),n;const r=Qd(e);return function(e,t,n,r){const a=go(e,n,Ki,Xi);return t&&void 0!==a.month&&void 0===a.monthCode&&void 0===a.year&&(a.year=Ys),e._(a,r)}(sd(r||ns),!r,e,t)}const n=function(e,t){const n=ta(ls(t));if(n)return _r(n),Dn(qt(n));const r=qr(t,0,1),{calendar:a}=r,o=e(a),[i,s,l]=o.v(r),[d,c]=o.q(i,s),[u,h]=o.G(d,c,l);return Dn(xt(o.V(u,h,l)),a)}(sd,e);return Jt(t),n}function cc(e,t){if(xe(e)){const n=wc(e);return n&&n.branding===hl?(Jt(t),n):function(e,t,n,r){const a=go(e,t,Gi,r);return e.K(a,n)}(sd(Kd(e)),e,t)}const n=function(e,t){const n=ea(ls(t));if(n)return _r(n),bn(wt(qt(n)));const r=qr(t,1);return bn(Mr(e(r.calendar),r))}(sd,e);return Jt(t),n}function uc(e,t){if(xe(e)){const n=wc(e)||{};switch(n.branding){case fl:return Jt(t),n;case ml:return Jt(t),pn(n);case yl:return Jt(t),Eo(Nl,n)}return function(e,t,n,r=[]){const a=go(e,t,Ki,r);return e.F(a,n)}(sd(Kd(e)),e,t)}const n=qr(e);return Jt(t),n}function hc(e,t){if(xe(e)){const n=wc(e);if(n&&n.branding===yl)return Kt(t),n;const r=Kd(e);return function(e,t,n,r,a,o){const i=go(n,a,Ki,Fi,Vi),s=e(i.timeZone),[l,d,c]=Kt(o),u=n.F(i,un(l)),h=mo(i,l);return vn(hr(t(s),{...u,...h},void 0!==i.offset?Ur(i.offset):void 0,d,c),s,r)}(rc,Nl,sd(r),r,e,t)}return function(e,t){const n=Qr(ls(e));if(!n||!n.timeZone)throw new RangeError(Di(e));const{offset:r}=n,a=r?Ur(r):void 0,[,o,i]=Kt(t);return Xr(n,a,o,i)}(e,t)}function gc(e){return Ie(e=>t=>e(fc(t)),e)}function fc(e){return kl(e,Nl)}function mc(e){if(xe(e)){const t=wc(e);if(t)switch(t.branding){case pl:return t;case yl:return mn(t.epochNanoseconds)}}return function(e){const t=Qr(e=ot(e));if(!t)throw new RangeError(Di(e));let n;if(t.j)n=0;else{if(!t.offset)throw new RangeError(Di(e));n=Ur(t.offset)}return t.timeZone&&na(t.timeZone,1),mn(St(Ut(t),n))}(e)}function vc(){function e(e,n){return new t(e,n)}function t(e,t=Object.create(null)){su.set(this,((e,t)=>{const n=new Ps(e,t),r=n.resolvedOptions(),a=r.locale,o=Oe(Object.keys(t),r),i=Ee(bc),s=(e,...t)=>{if(e){if(2!==t.length)throw new TypeError(xi);for(const e of t)if(void 0===e)throw new TypeError(xi)}e||void 0!==t[0]||(t=[]);const r=t.map(e=>wc(e)||Number(e));let s,l=0;for(const e of r){const t="object"==typeof e?e.branding:void 0;if(l++&&t!==s)throw new TypeError(xi);s=t}return s?i(s)(a,o,...r):[n,...r]};return s.X=n,s})(e,t))}const n=Ps.prototype,r=Object.getOwnPropertyDescriptors(n),a=Object.getOwnPropertyDescriptors(Ps);for(const t in r){const n=r[t],a=t.startsWith("format")&&yc(t);"function"==typeof n.value?n.value="constructor"===t?e:a||pc(t):a&&(n.get=function(){if(!su.has(this))throw new TypeError(qo);return(...e)=>a.apply(this,e)},Object.defineProperties(n.get,Me(`get ${t}`)))}return a.prototype.value=t.prototype=Object.create({},r),Object.defineProperties(e,a),e}function yc(e){return Object.defineProperties(function(...t){const n=su.get(this),[r,...a]=n(e.includes("Range"),...t);return r[e](...a)},Me(e))}function pc(e){return Object.defineProperties(function(...t){return su.get(this).X[e](...t)},Me(e))}function bc(e){const t=jc[e];if(!t)throw new TypeError((e=>`Cannot format ${e}`)(e));return ko(t,Ee(To),1)}const Dc=new WeakMap,wc=Dc.get.bind(Dc),xc=Dc.set.bind(Dc),Ec={era:function(e){if(void 0!==e)return ls(e)},eraYear:Ge,year:Ke,month:Je,daysInMonth:Je,daysInYear:Je,inLeapYear:ds,monthsInYear:Je},Mc={monthCode:ls},Cc={day:Je},kc={dayOfWeek:Je,dayOfYear:Je,weekOfYear:function(e){if(void 0!==e)return Je(e)},yearOfWeek:Ge,daysInWeek:Je},Tc=tc(Object.assign({},Ec,Mc,Cc,kc)),Nc=tc({...Ec,...Mc}),Ic=tc({...Mc,...Cc}),Sc={calendarId:e=>e.calendar},Hc=Se(e=>t=>t[e],us.concat("sign")),Oc=Se((e,t)=>e=>e[Ds[t]],Ai),Rc={epochMilliseconds:En,epochNanoseconds:function(e){return((e,t=1)=>{const[n,r]=e,a=Math.floor(r/t),o=ji/t;return BigInt(n)*BigInt(o)+BigInt(a)})(e.epochNanoseconds)}},[Pc,$c]=Gd(bl,function(e=0,t=0,n=0,r=0,a=0,o=0,i=0,s=0,l=0,d=0){return xn(Yr(Ie(dt,Ne(us,[e,t,n,r,a,o,i,s,l,d]))))},{...Hc,blank:function(e){return!e.sign}},{with:(e,t)=>$c(function(e,t){return xn((n=e,r=t,Yr({...n,...fo(r,hs)})));var n,r}(e,t)),negated:e=>$c(Pr(e)),abs:e=>$c(function(e){return-1===e.sign?Pr(e):e}(e)),add:(e,t,n)=>$c(Rr(oc,sd,Nl,0,e,ac(t),n)),subtract:(e,t,n)=>$c(Rr(oc,sd,Nl,1,e,ac(t),n)),round:(e,t)=>$c(function(e,t,n,r,a){const o=Vr(r),[i,s,l,d,c]=((e,t,n)=>{e=cn(e,Fs);let r=rl(e);const a=n(e[Ws]);let o=on(e);const i=ul(e,7);let s=nl(e);if(void 0===r&&void 0===s)throw new RangeError(pi);if(null==s&&(s=0),null==r&&(r=Math.max(s,t)),fn(r,s),o=sn(o,s,1),o>1&&s>5&&r!==s)throw new RangeError("For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit");return[r,s,o,i,a]})(a,o,e),u=Math.max(o,i);if(!c&&u<=6)return xn(Yr(((e,t,n,r,a)=>{const o=Yn(Lr(e),n,r,a);return{...ys,...Zr(o,t)}})(r,i,s,l,d)));if(!Hr(c)&&!r.sign)return r;if(!c)throw new RangeError(vi);const[h,g,f]=Tr(t,n,c),m=Nr(f),v=Ir(f),y=Sr(f),p=v(g,h,r);Hr(c)||(Et(h),Et(p));let b=y(g,h,p,i);const D=r.sign,w=jr(b);if(D&&w&&D!==w)throw new RangeError(ri);return b=jn(b,m(p),i,s,l,d,g,h,m,v),xn(b)}(oc,sd,Nl,e,t)),total:(e,t)=>function(e,t,n,r,a){const o=Vr(r),[i,s]=((e,t)=>{const n=t((e=cn(e,zs))[Ws]);let r=al(e);return r=Qe(zs,r),[r,n]})(a,e),l=Math.max(i,o);if(!s&&Or(l,s))return Cn(r,i);if(!s)throw new RangeError(vi);if(!r.sign)return 0;const[d,c,u]=Tr(t,n,s),h=Nr(u),g=Ir(u),f=Sr(u),m=g(c,d,r);Hr(s)||(Et(d),Et(m));const v=f(c,d,m,i);return Or(i,s)?Cn(v,i):((e,t,n,r,a,o,i)=>{const s=jr(e),[l,d]=kn(r,bs(n,e),n,s,a,o,i),c=Tn(t,l,d);return e[us[n]]+c*s})(v,h(m),i,c,d,h,g)}(oc,sd,Nl,e,t),toLocaleString(e,t,n){return Intl.DurationFormat?new Intl.DurationFormat(t,n).format(this):Jn(e)},toString:Jn,toJSON:e=>Jn(e),valueOf:nc},{from:e=>$c(ac(e)),compare:(e,t,n)=>function(e,t,n,r,a,o){const i=e(dn(o).relativeTo),s=Math.max(Vr(r),Vr(a));if(Pe(us,r,a))return 0;if(Or(s,i))return mt(Lr(r),Lr(a));if(!i)throw new RangeError(vi);const[l,d,c]=Tr(t,n,i),u=Nr(c),h=Ir(c);return mt(u(h(d,l,r)),u(h(d,l,a)))}(oc,sd,Nl,ac(e),ac(t),n)}),jc={Instant:zd,PlainDateTime:Bd,PlainDate:Wd,PlainTime:Ud,PlainYearMonth:qd,PlainMonthDay:_d},Yc=ko(zd),Ac=ko(Vd),Lc=ko(Bd),Zc=ko(Wd),Fc=ko(Ud),zc=ko(qd),Vc=ko(_d),[Bc,Wc]=Gd(vl,function(e=0,t=0,n=0,r=0,a=0,o=0){return wn(Gt(Ie(lt,Ne(Ds,[e,t,n,r,a,o])),1))},Oc,{with(e,t,n){return Wc(function(e,t,n){return wn(((e,t,n)=>mo({...Oe(Li,e),...fo(t,Li)},Jt(n)))(e,t,n))}(this,Jd(t),n))},add:(e,t)=>Wc(Dr(0,e,ac(t))),subtract:(e,t)=>Wc(Dr(1,e,ac(t))),until:(e,t,n)=>$c(Ca(0,e,ic(t),n)),since:(e,t,n)=>$c(Ca(1,e,ic(t),n)),round:(e,t)=>Wc(function(e,t){const[n,r,a]=en(t,5);var o;return wn((o=a,Sn(e,On(n,r),o)[0]))}(e,t)),equals:(e,t)=>function(e,t){return!ya(e,t)}(e,ic(t)),toLocaleString(e,t,n){const[r,a]=Fc(t,n,e);return r.format(a)},toString:Gn,toJSON:e=>Gn(e),valueOf:nc},{from:(e,t)=>Wc(ic(e,t)),compare:(e,t)=>ya(ic(e),ic(t))}),[Uc,qc]=Gd(ml,je(function(e,t,n,r,a=0,o=0,i=0,s=0,l=0,d=0,c=ns){return yn(Et(Ut(Ie(lt,Ne(xs,[t,n,r,a,o,i,s,l,d])))),e(c))},so),{...Sc,...Tc,...Oc},{with:(e,t,n)=>qc(function(e,t,n,r){const a=e(t.calendar),o=[...a.fields(Ki),...Ai].sort(),i={...wo(s=t),hour:s.isoHour,minute:s.isoMinute,second:s.isoSecond,millisecond:s.isoMillisecond,microsecond:s.isoMicrosecond,nanosecond:s.isoNanosecond};var s;const l=fo(n,o),d=Jt(r),c=a.k(i,l),u={...i,...l};return yn(Et({...a.F(c,un(d)),...Gt(dd(u),d)}))}(sd,e,Jd(t),n)),withCalendar:(e,t)=>qc(Io(e,ec(t))),withPlainTime:(e,t)=>qc(function(e,t=ks){return yn(Et({...e,...t}))}(e,sc(t))),add:(e,t,n)=>qc(yr(sd,0,e,ac(t),n)),subtract:(e,t,n)=>qc(yr(sd,1,e,ac(t),n)),until:(e,t,n)=>$c(wa(sd,0,e,lc(t),n)),since:(e,t,n)=>$c(wa(sd,1,e,lc(t),n)),round:(e,t)=>qc(function(e,t){return yn(Nn(e,...en(t)),e.calendar)}(e,t)),equals:(e,t)=>function(e,t){return!ma(e,t)&&e.calendar===t.calendar}(e,lc(t)),toZonedDateTime:(e,t,n)=>tu(function(e,t,n,r){const a=((e,t,n,r)=>{const a=(e=>il(dn(e)))(r);return gr(e(t),n,a)})(e,n,t,r);return vn(Mt(a),n,t.calendar)}(Nl,e,rc(t),n)),toPlainDate:e=>Qc(pn(e)),toPlainTime:e=>Wc(wn(e)),toLocaleString(e,t,n){const[r,a]=Lc(t,n,e);return r.format(a)},toString:Un,toJSON:e=>Un(e),valueOf:nc},{from:(e,t)=>qc(lc(e,t)),compare:(e,t)=>ma(lc(e),lc(t))}),[_c,Xc]=Gd(gl,je(function(e,t,n,r=ns,a=Ys){const o=lt(t),i=lt(n),s=e(r);return Dn(xt(qt({isoYear:lt(a),isoMonth:o,isoDay:i})),s)},so),{...Sc,...Ic},{with:(e,t,n)=>Xc(function(e,t,n,r){const a=e(t.calendar),o=a.fields(Ki).sort(),i=(e=>{const t=id(e.calendar),[n,r,a]=t.v(e),[o,i]=t.q(n,r);return{monthCode:Za(o,i),day:a}})(t),s=fo(n,o),l=a.k(i,s);return a._(l,r)}(sd,e,Jd(t),n)),equals:(e,t)=>function(e,t){return!va(e,t)&&e.calendar===t.calendar}(e,dc(t)),toPlainDate(e,t){return Qc(function(e,t,n,r){return((e,t,n)=>vo(e,t,es,et(n),Ui))(e(t.calendar),n,r)}(sd,e,this,t))},toLocaleString(e,t,n){const[r,a]=Vc(t,n,e);return r.format(a)},toString:Xn,toJSON:e=>Xn(e),valueOf:nc},{from:(e,t)=>Xc(dc(e,t))}),[Gc,Jc]=Gd(hl,je(function(e,t,n,r=ns,a=1){const o=lt(t),i=lt(n),s=e(r);return bn(wt(qt({isoYear:o,isoMonth:i,isoDay:lt(a)})),s)},so),{...Sc,...Nc},{with:(e,t,n)=>Jc(function(e,t,n,r){const a=e(t.calendar),o=a.fields(Gi).sort(),i=(e=>{const t=id(e.calendar),[n,r]=t.v(e),[a,o]=t.q(n,r);return{year:n,monthCode:Za(a,o)}})(t),s=fo(n,o),l=a.k(i,s);return a.K(l,r)}(sd,e,Jd(t),n)),add:(e,t,n)=>Jc(br(sd,0,e,ac(t),n)),subtract:(e,t,n)=>Jc(br(sd,1,e,ac(t),n)),until:(e,t,n)=>$c(Ea(sd,0,e,cc(t),n)),since:(e,t,n)=>$c(Ea(sd,1,e,cc(t),n)),equals:(e,t)=>function(e,t){return!va(e,t)&&e.calendar===t.calendar}(e,cc(t)),toPlainDate(e,t){return Qc(function(e,t,n,r){return((e,t,n)=>vo(e,t,Ji,et(n),Xi))(e(t.calendar),n,r)}(sd,e,this,t))},toLocaleString(e,t,n){const[r,a]=zc(t,n,e);return r.format(a)},toString:_n,toJSON:e=>_n(e),valueOf:nc},{from:(e,t)=>Jc(cc(e,t)),compare:(e,t)=>va(cc(e),cc(t))}),[Kc,Qc]=Gd(fl,je(function(e,t,n,r,a=ns){return pn(xt(qt(Ie(lt,{isoYear:t,isoMonth:n,isoDay:r}))),e(a))},so),{...Sc,...Tc},{with:(e,t,n)=>Qc(function(e,t,n,r){const a=e(t.calendar),o=a.fields(Ki).sort(),i=wo(t),s=fo(n,o),l=a.k(i,s);return a.F(l,r)}(sd,e,Jd(t),n)),withCalendar:(e,t)=>Qc(Io(e,ec(t))),add:(e,t,n)=>Qc(pr(sd,0,e,ac(t),n)),subtract:(e,t,n)=>Qc(pr(sd,1,e,ac(t),n)),until:(e,t,n)=>$c(xa(sd,0,e,uc(t),n)),since:(e,t,n)=>$c(xa(sd,1,e,uc(t),n)),equals:(e,t)=>function(e,t){return!va(e,t)&&e.calendar===t.calendar}(e,uc(t)),toZonedDateTime(e,t){const n=xe(t)?t:{timeZone:t};return tu(function(e,t,n,r,a){const o=e(a.timeZone),i=a.plainTime,s=void 0!==i?t(i):void 0,l=n(o);let d;return d=s?gr(l,{...r,...s}):fr(l,{...r,...ks}),vn(d,o,r.calendar)}(rc,ic,Nl,e,n))},toPlainDateTime:(e,t)=>qc(function(e,t=ks){return yn(Et({...e,...t}))}(e,sc(t))),toPlainYearMonth(e){return Jc(function(e,t,n){return((e,t)=>{const n=go(e,t,Ji);return e.K(n,void 0)})(e(t.calendar),n)}(sd,e,this))},toPlainMonthDay(e){return Xc(function(e,t,n){return((e,t)=>{const n=go(e,t,es);return e._(n)})(e(t.calendar),n)}(sd,e,this))},toLocaleString(e,t,n){const[r,a]=Zc(t,n,e);return r.format(a)},toString:qn,toJSON:e=>qn(e),valueOf:nc},{from:(e,t)=>Qc(uc(e,t)),compare:(e,t)=>va(uc(e),uc(t))}),[eu,tu]=Gd(yl,je(function(e,t,n,r,a=ns){return vn(Mt(yt(it(n))),t(r),e(a))},so,function(e){return ca(ls(e))}),{...Rc,...Sc,...gc(Tc),...gc(Oc),offset:e=>or(fc(e).offsetNanoseconds),offsetNanoseconds:e=>fc(e).offsetNanoseconds,timeZoneId:e=>e.timeZone,hoursInDay:e=>function(e,t){const n=e(t.timeZone),r=kl(t,n),[a,o]=Rn(r),i=bt(ft(fr(n,a),fr(n,o)),$i,1);if(i<=0)throw new RangeError(ri);return i}(Nl,e)},{with:(e,t,n)=>tu(function(e,t,n,r,a){const{calendar:o,timeZone:i}=n,s=e(o),l=t(i),d=[...s.fields(Ki),...zi].sort(),c=(e=>{const t=kl(e,Nl),n=or(t.offsetNanoseconds),r=id(e.calendar),[a,o,i]=r.v(t),[s,l]=r.q(a,o),d=Za(s,l);return{...cd(t),year:a,monthCode:d,day:i,offset:n}})(n),u=fo(r,d),h=s.k(c,u),g={...c,...u},[f,m,v]=Kt(a,2);return vn(hr(l,{...s.F(h,un(f)),...Gt(dd(g),f)},Ur(g.offset),m,v),i,o)}(sd,Nl,e,Jd(t),n)),withCalendar:(e,t)=>tu(Io(e,ec(t))),withTimeZone:(e,t)=>tu(function(e,t){return{...e,timeZone:t}}(e,rc(t))),withPlainTime:(e,t)=>tu(function(e,t,n){const r=t.timeZone,a=e(r),o={...kl(t,a),...n||ks};let i;return i=n?hr(a,o,o.offsetNanoseconds,2):fr(a,o),vn(i,r,t.calendar)}(Nl,e,sc(t))),add:(e,t,n)=>tu(vr(sd,Nl,0,e,ac(t),n)),subtract:(e,t,n)=>tu(vr(sd,Nl,1,e,ac(t),n)),until:(e,t,n)=>$c(xn(Da(sd,Nl,0,e,hc(t),n))),since:(e,t,n)=>$c(xn(Da(sd,Nl,1,e,hc(t),n))),round:(e,t)=>tu(function(e,t,n){let{epochNanoseconds:r,timeZone:a,calendar:o}=t;const[i,s,l]=en(n);if(0===i&&1===s)return t;const d=e(a);if(6===i)r=((e,t,n,r)=>{const a=kl(n,t),[o,i]=e(a),s=n.epochNanoseconds,l=fr(t,o),d=fr(t,i);if(vt(s,l,d))throw new RangeError(ri);return Zn(Tn(s,l,d),r)?d:l})(Rn,d,t,l);else{const e=d.R(r);r=hr(d,Nn(Pt(r,e),i,s,l),e,2,0,1)}return vn(r,a,o)}(Nl,e,t)),startOfDay:e=>tu(function(e,t){const{timeZone:n,calendar:r}=t,a=((e,t,n)=>fr(t,e(kl(n,t))))(Pn,e(n),t);return vn(a,n,r)}(Nl,e)),equals:(e,t)=>function(e,t){return!fa(e,t)&&!!pa(e.timeZone,t.timeZone)&&e.calendar===t.calendar}(e,hc(t)),toInstant:e=>ru(function(e){return mn(e.epochNanoseconds)}(e)),toPlainDateTime:e=>qc(xo(Nl,e)),toPlainDate:e=>Qc(Eo(Nl,e)),toPlainTime:e=>Wc(Mo(Nl,e)),toLocaleString(e,t,n={}){const[r,a]=Ac(t,n,e);return r.format(a)},toString:(e,t)=>Wn(Nl,e,t),toJSON:e=>Wn(Nl,e),valueOf:nc,getTimeZoneTransition(e,t){const{timeZone:n,epochNanoseconds:r}=e,a=function(e){const t=cn(e,Us),n=gn(Us,tl,t,0);if(!n)throw new RangeError(Fo(Us,n));return n}(t),o=Nl(n).O(r,a);return o?tu({...e,epochNanoseconds:o}):null}},{from:(e,t)=>tu(hc(e,t)),compare:(e,t)=>fa(hc(e),hc(t))}),[nu,ru]=Gd(pl,function(e){return mn(Mt(yt(it(e))))},Rc,{add:(e,t)=>ru(mr(0,e,ac(t))),subtract:(e,t)=>ru(mr(1,e,ac(t))),until:(e,t,n)=>$c(ba(0,e,mc(t),n)),since:(e,t,n)=>$c(ba(1,e,mc(t),n)),round:(e,t)=>ru(function(e,t){const[n,r,a]=en(t,5,1);return mn(Yn(e.epochNanoseconds,n,r,a,1))}(e,t)),equals:(e,t)=>function(e,t){return!ga(e,t)}(e,mc(t)),toZonedDateTimeISO:(e,t)=>tu(function(e,t,n=ns){return vn(e.epochNanoseconds,t,n)}(e,rc(t))),toLocaleString(e,t,n){const[r,a]=Yc(t,n,e);return r.format(a)},toString:(e,t)=>Bn(rc,Nl,e,t),toJSON:e=>Bn(rc,Nl,e),valueOf:nc},{from:e=>ru(mc(e)),fromEpochMilliseconds:e=>ru(function(e){return mn(Mt(pt(dt(e),Oi)))}(e)),fromEpochNanoseconds:e=>ru(function(e){return mn(Mt(yt(it(e))))}(e)),compare:(e,t)=>ga(mc(e),mc(t))}),au=Object.defineProperties({},{...Te("Temporal.Now"),...Ce({timeZoneId:()=>Oo(),instant:()=>ru(mn(Ho())),zonedDateTimeISO:(e=Oo())=>tu(vn(Ho(),rc(e),ns)),plainDateTimeISO:(e=Oo())=>qc(yn(So(Nl(rc(e))),ns)),plainDateISO:(e=Oo())=>Qc(pn(So(Nl(rc(e))),ns)),plainTimeISO:(e=Oo())=>Wc(wn(So(Nl(rc(e)))))})}),ou=Object.defineProperties({},{...Te("Temporal"),...Ce({PlainYearMonth:Gc,PlainMonthDay:_c,PlainDate:Kc,PlainTime:Bc,PlainDateTime:Uc,ZonedDateTime:eu,Instant:nu,Duration:Pc,Now:au})}),iu=vc(),su=new WeakMap;function lu(e){var t;return e instanceof ou.PlainDate||("PlainDate"===(null===(t=null==e?void 0:e.constructor)||void 0===t?void 0:t.name)||!("hour"in e)&&!("timeZone"in e))}function du(e){return e instanceof Date}function cu(e,t=ou.Now.timeZoneId()){return ou.Instant.fromEpochMilliseconds(e.getTime()).toZonedDateTimeISO(t)}function uu(e){return ou.PlainDate.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()})}function hu(e){return new Date(e.epochMilliseconds)}function gu(e,t){return lu(e)?function(e,t=ou.Now.timeZoneId()){return hu(e.toZonedDateTime({timeZone:t,plainTime:ou.PlainTime.from({hour:0,minute:0})}))}(e,t):"hour"in e&&!("timeZone"in e)?new Date(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond):hu(e)}function fu(e,t){const n=Math.floor(t),r=Math.round(60*(t-n));return lu(e)?ou.PlainDateTime.from({year:e.year,month:e.month,day:e.day,hour:n,minute:r}):e.with({hour:n,minute:r,second:0,millisecond:0})}function mu(e,t){const n=lu(e)?e:e.toPlainDate(),r=lu(t)?t:t.toPlainDate();return 0===ou.PlainDate.compare(n,r)}function vu(e,t){return!mu(e,t)}function yu(e,t=ou.Now.timeZoneId()){return(lu(e)?e:e.toPlainDate()).toZonedDateTime({timeZone:t,plainTime:ou.PlainTime.from({hour:0,minute:0})})}function pu(e,t=ou.Now.timeZoneId()){return(lu(e)?e:e.toPlainDate()).toZonedDateTime({timeZone:t,plainTime:ou.PlainTime.from({hour:23,minute:59,second:59,millisecond:999})})}function bu(e,t){const n=lu(e)?e:e.toPlainDate(),r=lu(t)?t:t.toPlainDate();return n.until(r).days}function Du(e,t){const n=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((r.getTime()-n.getTime())/864e5)}function wu(e,t){const n=new Date(e);return n.setDate(n.getDate()+t),n}function xu(e=ou.Now.timeZoneId()){return ou.Now.zonedDateTimeISO(e)}function Eu(e=ou.Now.timeZoneId()){return ou.Now.plainDateISO(e)}Object.create(Intl),Ce({DateTimeFormat:iu});const Mu=e=>{if(e instanceof Date){return e.getHours()+e.getMinutes()/60}return lu(t=e)?0:"hour"in t&&void 0!==t.hour?t.hour+(null!==(n=t.minute)&&void 0!==n?n:0)/60:(console.warn("Warning: No hour property found in temporal object, returning 0"),0);var t,n},Cu=(e,t)=>{if(e instanceof Date){const n=new Date(e),r=Math.floor(t),a=Math.round(60*(t-r));return n.setHours(r,a,0,0),n}return fu(e,t)},ku=e=>{if(e instanceof Date){const t=new Date(e);return t.setHours(0,0,0,0),t}return yu(e)},Tu=e=>{if(e instanceof Date){const t=new Date(e);return t.setHours(23,59,59,999),t}return pu(e)},Nu=(e,t)=>{if(e instanceof Date&&t instanceof Date)return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate();return mu(e instanceof Date?ou.PlainDate.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}):lu(e)?e:e.toPlainDate(),t instanceof Date?ou.PlainDate.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}):lu(t)?t:t.toPlainDate())},Iu=(e,t)=>!Nu(e,t),Su=e=>L().resolveColors(e).eventColor,Hu=e=>L().resolveColors(e).textColor,Ou=e=>L().resolveColors(e).eventSelectedColor,Ru=e=>L().resolveColors(e).lineColor,Pu=.25,$u=(e,t=0)=>{const n=Math.floor(e),r=t||Math.round(60*(e-n));return`${n.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`},ju=e=>{if(e.allDay)return"All day";const t=Mu(e.start),n=Au(e);return`${$u(t)} - ${$u(n)}`},Yu=e=>{const t=Pu;return Math.round(e/t)*t},Au=e=>{if(!e.end)return 0;const t=Mu(e.end);if(e.allDay||!e.start)return t;const n=gu(e.start),r=gu(e.end);if(!(n.getFullYear()!==r.getFullYear()||n.getMonth()!==r.getMonth()||n.getDate()!==r.getDate()))return t;if(0===t&&0===r.getMinutes()&&0===r.getSeconds()&&0===r.getMilliseconds()){const e=r.getTime()-n.getTime();if(e>0&&e<864e5)return 24}return t},Lu=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Zu=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Fu=["January","February","March","April","May","June","July","August","September","October","November","December"],zu=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Vu=e=>{const t=e.getDay(),n=e.getDate()-t+(0===t?-6:1),r=new Date(e);r.setDate(n),r.setHours(0,0,0,0);const a=new Date(r);return a.setDate(r.getDate()+6),a.setHours(23,59,59,999),{monday:r,sunday:a}},Bu=()=>{const e=new Date,t=new Date,n=e.getDay(),r=e.getDate()-n+(0===n?-6:1);return Lu.map((n,a)=>{const o=new Date(e);return o.setDate(r+a),{date:o.getDate(),month:o.toLocaleString("default",{month:"short"}),isToday:o.getDate()===t.getDate()&&o.getMonth()===t.getMonth()&&o.getFullYear()===t.getFullYear()}})},Wu=e=>{const t=new Date(e),n=t.getDate(),r=t.getMonth(),a=t.getFullYear(),o=new Date;return{date:t,day:n,month:r,year:a,monthName:Fu[r],shortMonthName:zu[r],isToday:o.getDate()===n&&o.getMonth()===r&&o.getFullYear()===a}},Uu=e=>{const t=[],n=new Date(e);for(let e=0;e<7;e++){const e=new Date(n);t.push(Wu(e)),n.setDate(n.getDate()+1)}return{days:t,startDate:new Date(e),monthYear:qu(t)}},qu=e=>{const t={};e.forEach(e=>{const n=`${e.month}-${e.year}`;t[n]=(t[n]||0)+1});let n=0,r="";Object.entries(t).forEach(([e,t])=>{t>n&&(n=t,r=e)});const[a,o]=r.split("-").map(Number);return{month:Fu[a],monthIndex:a,year:o}},_u=(e,t=3)=>{const n=5*t,{monday:r}=Vu(e),a=[],o=Math.floor(n/2),i=new Date(r);i.setDate(i.getDate()-7*o);for(let e=0;e<n;e++){const t=new Date(i);t.setDate(t.getDate()+7*e),a.push(Uu(t))}return a};function Xu(e,t){const n=[],r=Math.floor(t/2),a=new Date(e),o=e.getDay(),i=0===o?6:o-1;a.setDate(e.getDate()-i),a.setHours(0,0,0,0);const s=new Date(a);s.setDate(s.getDate()-7*r);for(let e=0;e<t;e++){const t=new Date(s);t.setDate(t.getDate()+7*e),n.push(Uu(t))}return n}const Gu=(e,t)=>t.filter(t=>t.day===e&&!t.allDay),Ju=(e,t,n)=>t.filter(t=>{if(!t.allDay)return!1;if(!n)return t.day===e;const r=new Date(n);r.setDate(n.getDate()+e),r.setHours(0,0,0,0);const a=gu(t.start);a.setHours(0,0,0,0);const o=gu(t.end);return o.setHours(0,0,0,0),r>=a&&r<=o}),Ku=(e,t)=>{const n=new Date(e);return n.setDate(e.getDate()+t),n},Qu=(e,t,n)=>{const r=Ku(n,t);return Object.assign(Object.assign({},e),{day:t,start:e.allDay?ou.PlainDate.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate()}):ou.ZonedDateTime.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate(),hour:r.getHours(),minute:r.getMinutes(),timeZone:ou.Now.timeZoneId()}),end:e.allDay?ou.PlainDate.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate()}):ou.ZonedDateTime.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate(),hour:r.getHours(),minute:r.getMinutes(),timeZone:ou.Now.timeZoneId()})})},eh=(e,t)=>t?ou.PlainDate.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}):ou.ZonedDateTime.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),millisecond:e.getMilliseconds(),timeZone:ou.Now.timeZoneId()}),th=(e,t)=>{var n,r;const a=Ku(t,null!==(n=e.day)&&void 0!==n?n:0),o=null!==(r=e.allDay)&&void 0!==r&&r;return Object.assign(Object.assign({},e),{start:eh(a,o),end:eh(a,o)})},nh=(e,t)=>{const n=new Date(e);n.setHours(0,0,0,0);const r=new Date(t);r.setHours(0,0,0,0);const a=n.getTime()-r.getTime();return Math.floor(a/864e5)},rh=(e,t)=>{const n=nh(e,t);return n>=0&&n<=6},ah=(e,t)=>e.map(e=>{const n=gu(e.start),r=nh(n,t);return Object.assign(Object.assign({},e),{day:r})}),oh=(e,t)=>{const n=new Date(e);n.setHours(0,0,0,0);const r=new Date(t);r.setHours(0,0,0,0);const a=r.getTime()-n.getTime();return Math.floor(a/864e5)},ih=(e,t)=>{const n=new Date(t);return n.setDate(t.getDate()+6),n.setHours(23,59,59,999),e.filter(e=>{const r=gu(e.start);return r>=t&&r<=n}).map(e=>{const n=nh(gu(e.start),t);return Object.assign(Object.assign({},e),{day:n})})},sh=(e,t)=>{var n,r;const a=new Date(t);a.setDate(t.getDate()+(null!==(n=e.day)&&void 0!==n?n:0));const o=null!==(r=e.allDay)&&void 0!==r&&r;return Object.assign(Object.assign({},e),{start:eh(a,o),end:eh(a,o)})},lh=(e,t,n)=>{var r;const a=new Date(n);a.setDate(n.getDate()+t);const o=null!==(r=e.allDay)&&void 0!==r&&r;return Object.assign(Object.assign({},e),{day:t,start:eh(a,o),end:eh(a,o)})};function dh(){const e=new Date,t=e.getDay(),n=new Date(e),r=0===t?-6:1-t;n.setDate(e.getDate()+r),n.setHours(0,0,0,0);const a=[{id:"15",title:"C-早开始",day:3,startHour:8.5,endHour:10,calendarId:"teal"},{id:"16",title:"D-晚开始",day:3,startHour:9,endHour:10.5,calendarId:"red"},{id:"21",title:"A",day:0,startHour:14,endHour:16,calendarId:"blue"},{id:"22",title:"B",day:0,startHour:14.5,endHour:16,calendarId:"green"},{id:"23",title:"C",day:0,startHour:14.5,endHour:16,calendarId:"purple"},{id:"24",title:"D",day:0,startHour:15,endHour:16,calendarId:"yellow"},{id:"25",title:"E",day:0,startHour:15,endHour:16,calendarId:"red"},{id:"26",title:"F",day:0,startHour:15.5,endHour:16,calendarId:"orange"},{id:"27",title:"G",day:0,startHour:15,endHour:16,calendarId:"pink"},{id:"28",title:"H",day:0,startHour:15.5,endHour:16,calendarId:"teal"},{id:"29",title:"L",day:0,startHour:15.5,endHour:16,calendarId:"teal"},{id:"30",title:"I",day:0,startHour:15.5,endHour:16,calendarId:"blue"},{id:"99",title:"X",day:0,startHour:15.5,endHour:16,calendarId:"blue"},{id:"6",title:"假日",day:0,startHour:0,endHour:0,calendarId:"blue",allDay:!0},{id:"7",title:"研讨会",day:2,startHour:0,endHour:0,calendarId:"green",allDay:!0},{id:"8",title:"团队建设",day:4,startHour:0,endHour:0,calendarId:"purple",allDay:!0},{id:"41",title:"A",day:3,startHour:16,endHour:18.25,calendarId:"blue"},{id:"42",title:"B",day:3,startHour:16.5,endHour:18,calendarId:"green"},{id:"43",title:"C",day:3,startHour:16.75,endHour:17.75,calendarId:"purple"},{id:"44",title:"D",day:3,startHour:17,endHour:19,calendarId:"yellow"},{id:"45",title:"E",day:3,startHour:17.75,endHour:18.75,calendarId:"red"},{id:"46",title:"X",day:2,startHour:15,endHour:15.75,calendarId:"orange"},{id:"47",title:"Y",day:2,startHour:15.5,endHour:19.5,calendarId:"pink"},{id:"48",title:"Z",day:2,startHour:15,endHour:15.75,calendarId:"teal"},{id:"59",title:"Q",day:2,startHour:17,endHour:18,calendarId:"teal"},{id:"60",title:"W",day:2,startHour:15.5,endHour:18,calendarId:"teal"},{id:"31",title:"A",day:6,startHour:14,endHour:16,calendarId:"blue"},{id:"32",title:"B",day:6,startHour:14.5,endHour:16,calendarId:"green"},{id:"33",title:"C",day:6,startHour:14.5,endHour:16,calendarId:"purple"},{id:"34",title:"D",day:6,startHour:15,endHour:16,calendarId:"yellow"},{id:"35",title:"E",day:6,startHour:15.5,endHour:16.5,calendarId:"red"},{id:"36",title:"F",day:6,startHour:16.25,endHour:16.75,calendarId:"orange"},{id:"37",title:"G",day:6,startHour:16,endHour:17.25,calendarId:"pink"},{id:"51",title:"下周会议1",day:1,startHour:9,endHour:10,calendarId:"blue"},{id:"52",title:"下周会议2",day:3,startHour:14,endHour:15,calendarId:"green"},{id:"81",title:"A",day:5,startHour:14,endHour:16,calendarId:"blue"},{id:"82",title:"B",day:5,startHour:14.5,endHour:16,calendarId:"green"},{id:"83",title:"C",day:5,startHour:14.5,endHour:16,calendarId:"purple"},{id:"84",title:"D",day:5,startHour:15,endHour:16,calendarId:"yellow"},{id:"85",title:"E",day:5,startHour:15,endHour:16,calendarId:"red"},{id:"86",title:"F",day:5,startHour:15.75,endHour:17,calendarId:"orange"},{id:"87",title:"G",day:5,startHour:14.75,endHour:17.5,calendarId:"pink"}].map(e=>{const t=new Date(n);if(t.setDate(n.getDate()+e.day),e.allDay)return{id:e.id,title:e.title,start:ou.PlainDate.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}),end:ou.PlainDate.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}),allDay:!0,calendarId:e.calendarId,day:e.day};const r=Math.floor(e.startHour),a=Math.round(60*(e.startHour-r)),o=Math.floor(e.endHour),i=Math.round(60*(e.endHour-o));return{id:e.id,title:e.title,start:ou.ZonedDateTime.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:r,minute:a,timeZone:ou.Now.timeZoneId()}),end:ou.ZonedDateTime.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:o,minute:i,timeZone:ou.Now.timeZoneId()}),allDay:!1,calendarId:e.calendarId,day:e.day}});return a}function ch(){return Date.now().toString(36)+Math.random().toString(36).substring(2,8)}const uh=e=>{if(e.icon)return e.icon;return(e.name||e.id).charAt(0).toUpperCase()},hh=({app:e,calendars:o,toggleCalendarVisibility:i,isCollapsed:s,setCollapsed:m})=>{const v=e.getCurrentDate(),y=e.getVisibleMonth(),p=y.getFullYear(),b=y.getMonth(),[D,w]=n(!1),[x,E]=n(null),M=r((e,t)=>{w(!0),E(e.id);const n={calendarId:e.id,calendarName:e.name,calendarColors:e.colors,calendarIcon:e.icon};t.dataTransfer.setData("application/x-dayflow-calendar",JSON.stringify(n)),t.dataTransfer.effectAllowed="copy"},[]),C=r(()=>{w(!1),E(null)},[]),[k,T]=n(()=>new Date(p,b,1));a(()=>{T(e=>e.getFullYear()===p&&e.getMonth()===b?e:new Date(p,b,1))},[p,b]);const N=t(()=>(new Date).toDateString(),[]),I=v.toDateString(),S=t(()=>Lu.map(e=>e.charAt(0)),[]),H=t(()=>{const e=k.getFullYear(),t=k.getMonth(),n=(new Date(e,t,1).getDay()+6)%7,r=[];for(let a=0;a<42;a++){const o=new Date(e,t,a-n+1),i=o.toDateString();r.push({date:o.getDate(),fullDate:o,isCurrentMonth:o.getMonth()===t,isToday:i===N,isSelected:i===I})}return r},[k,I,N]),O=t(()=>k.toLocaleDateString(void 0,{month:"long",year:"numeric"}),[k]),R=r(t=>{T(n=>{const r=new Date(n.getFullYear(),n.getMonth()+t,1);return e.setVisibleMonth(r),r})},[e]),P=r(t=>{const n=new Date(t.getFullYear(),t.getMonth(),t.getDate());e.setCurrentDate(n),T(new Date(n.getFullYear(),n.getMonth(),1))},[e]);return l("div",{className:"flex h-full flex-col border-r border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-900",children:[l("div",{className:"flex items-center px-2 py-2",children:[d("button",{type:"button","aria-label":s?"Expand calendar sidebar":"Collapse calendar sidebar",className:"flex h-8 w-8 items-center justify-center rounded hover:bg-gray-100 dark:hover:bg-slate-800",onClick:()=>m(!s),children:d(s?u:h,{className:"h-4 w-4 text-gray-500 dark:text-gray-400"})}),!s&&d("span",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:"Calendars"})]}),s?d("div",{className:"flex-1 overflow-y-auto px-2 pb-3",children:d("ul",{className:"space-y-1",children:o.map(e=>{var t;const n=!1!==e.isVisible,r=(null===(t=e.colors)||void 0===t?void 0:t.lineColor)||"#3b82f6";return Boolean(e.icon),d("li",{children:d("div",{draggable:!0,onDragStart:t=>M(e,t),onDragEnd:C,className:"rounded transition "+(x===e.id?"opacity-50":""),children:l("label",{className:"group flex cursor-pointer items-center rounded px-2 py-2 transition hover:bg-gray-100 dark:hover:bg-slate-800",title:e.name,children:[d("input",{type:"checkbox",className:"calendar-checkbox",style:{"--checkbox-color":r},checked:n,onChange:t=>i(e.id,t.target.checked)}),d("span",{className:"flex-1 truncate text-sm text-gray-700 group-hover:text-gray-900 dark:text-gray-200 dark:group-hover:text-white",children:" "})]})})},e.id)})})}):l(c,{children:[d("div",{className:"flex-1 overflow-y-auto px-2 pb-3",children:d("ul",{className:"space-y-1",children:o.map(e=>{var t;const n=!1!==e.isVisible,r=(null===(t=e.colors)||void 0===t?void 0:t.lineColor)||"#3b82f6",a=Boolean(e.icon);return d("li",{children:d("div",{draggable:!0,onDragStart:t=>M(e,t),onDragEnd:C,className:"rounded transition "+(x===e.id?"opacity-50":""),children:l("label",{className:"group flex cursor-pointer items-center rounded px-2 py-2 transition hover:bg-gray-100 dark:hover:bg-slate-800",title:e.name,children:[d("input",{type:"checkbox",className:"calendar-checkbox",style:{"--checkbox-color":r},checked:n,onChange:t=>i(e.id,t.target.checked)}),a&&d("span",{className:"mr-2 flex h-5 w-5 flex-shrink-0 items-center justify-center text-xs font-semibold text-white","aria-hidden":"true",children:uh(e)}),d("span",{className:"flex-1 truncate text-sm text-gray-700 group-hover:text-gray-900 dark:text-gray-200 dark:group-hover:text-white",children:e.name||e.id})]})})},e.id)})})}),l("div",{className:"border-t border-gray-200 px-3 py-3 dark:border-slate-800",children:[l("div",{className:"mb-3 flex items-center justify-between",children:[d("button",{type:"button",className:"flex h-7 w-7 items-center justify-center rounded-full text-gray-500 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-slate-800",onClick:()=>R(-1),"aria-label":"Previous month",children:d(g,{className:"h-4 w-4"})}),d("span",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:O}),d("button",{type:"button",className:"flex h-7 w-7 items-center justify-center rounded-full text-gray-500 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-slate-800",onClick:()=>R(1),"aria-label":"Next month",children:d(f,{className:"h-4 w-4"})})]}),l("div",{className:le,children:[S.map(e=>d("div",{className:`${de} text-gray-500 dark:text-gray-400`,children:e},ch())),H.map(e=>d("button",{type:"button",className:`\n ${ce}\n ${e.isCurrentMonth?ue:he}\n ${e.isToday?ge:""}\n ${e.isSelected&&!e.isToday?fe:""}\n `,onClick:()=>P(e.fullDate),children:e.date},ch()))]})]})]})]})},gh=({options:e,value:t,onChange:r})=>{const[i,s]=n(!1),c=o(null);a(()=>{const e=e=>{c.current&&!c.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),e.find(e=>e.value===t);const u=e=>L().resolveColors(e).lineColor;return l("div",{className:"relative inline-block",ref:c,children:[l("button",{type:"button",onClick:()=>s(!i),className:"flex items-center space-x-2 bg-gray-100 dark:bg-gray-700 rounded-md px-2 py-1 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors h-8",children:[d("span",{className:"w-4 h-4 rounded-sm flex-shrink-0",style:{backgroundColor:u(t)}}),d(m,{className:"w-4 h-4 text-gray-600 dark:text-gray-300"})]}),i&&d("ul",{className:"absolute mt-1 w-full min-w-max bg-gray-100 dark:bg-gray-700 rounded-md shadow-lg dark:shadow-gray-900/50 z-10 overflow-hidden border dark:border-gray-600",children:e.map(e=>l("li",{className:"flex items-center px-2 py-1 cursor-pointer hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors "+(t===e.value?"font-semibold":""),onClick:()=>{return t=e.value,r(t),void s(!1);var t},children:[t===e.value?d("span",{className:"mr-2 text-sm",children:d(v,{width:12,height:12})}):d("div",{className:"mr-2 text-sm w-3 h-3",children:" "}),d("span",{className:"w-3 h-3 mr-2 rounded-sm flex-shrink-0",style:{backgroundColor:u(e.value)}}),d("span",{className:"text-sm whitespace-nowrap",children:e.label})]},e.value))})]})},fh=/(YYYY|YY|MM|DD|HH|mm)/g,mh=e=>e.toString().padStart(2,"0"),vh=(e,t)=>{const n=(null!=t?t:"").trim(),r=/[Hhms]/.test(e)||!n?e:`${e} ${n}`.trim();return r.replace(/(H{1,2}):MM/g,(e,t)=>`${t}:mm`)},yh=e=>e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),ph=e=>{let t,n=0,r="^";for(;null!==(t=fh.exec(e));){r+=yh(e.slice(n,t.index));const a=t[0];r+=`(?<${a}>\\d{${"YYYY"===a?4:2}})`,n=t.index+a.length}return r+=yh(e.slice(n))+"$",new RegExp(r)},bh=(e,t,n,r)=>{const a=e.trim();if(!a)return null;const o=a.match(t),i=null==o?void 0:o.groups;if(!i)return null;const s=i.YYYY?Number(i.YYYY):i.YY?Number(i.YY)+2e3:n.year,l=i.MM?Number(i.MM):n.month,d=i.DD?Number(i.DD):n.day,c=i.HH?Number(i.HH):n.hour,u=i.mm?Number(i.mm):n.minute;try{return ou.ZonedDateTime.from({timeZone:r,year:s,month:l,day:d,hour:c,minute:u,second:n.second,millisecond:n.millisecond,microsecond:n.microsecond,nanosecond:n.nanosecond})}catch(e){return null}},Dh=e=>{const t=e;if(t.timeZoneId&&"string"==typeof t.timeZoneId)return t.timeZoneId;if("timeZoneId"in e&&"string"==typeof e.timeZoneId)return e.timeZoneId;const n=e.timeZone;return n&&"string"==typeof n.id?n.id:"string"==typeof t.timeZone?t.timeZone:ou.Now.timeZoneId()},wh=(e,t,n)=>{var r,a,o,i,s,l,d,c,u,h,g,f,m,v,y,p,b,D,w,x,E,M,C,k;if(!e){const e=null!=t?t:n?Dh(n):ou.Now.timeZoneId();return null!=n?n:ou.Now.zonedDateTimeISO(e)}if(lu(e)){const n=null!=t?t:ou.Now.timeZoneId(),r=`${e.year}-${mh(e.month)}-${mh(e.day)}T00:00:00[${n}]`;return ou.ZonedDateTime.from(r)}if("hour"in e&&!("timeZone"in e)){const n=null!=t?t:ou.Now.timeZoneId();if("function"==typeof e.toZonedDateTime)try{return e.toZonedDateTime(n)}catch(e){}return ou.ZonedDateTime.from({timeZone:n,year:e.year,month:e.month,day:e.day,hour:e.hour,minute:e.minute,second:null!==(r=e.second)&&void 0!==r?r:0,millisecond:null!==(a=e.millisecond)&&void 0!==a?a:0,microsecond:null!==(o=e.microsecond)&&void 0!==o?o:0,nanosecond:null!==(i=e.nanosecond)&&void 0!==i?i:0})}try{return ou.ZonedDateTime.from(e)}catch(r){const a=e,o=null!==(u=null!==(c=null!==(d=null!==(l="string"==typeof(null==a?void 0:a.timeZone)?a.timeZone:null===(s=null==a?void 0:a.timeZone)||void 0===s?void 0:s.id)&&void 0!==l?l:null==a?void 0:a.timeZoneId)&&void 0!==d?d:t)&&void 0!==c?c:n?Dh(n):void 0)&&void 0!==u?u:ou.Now.timeZoneId();if("function"==typeof(null==a?void 0:a.toZonedDateTime))try{return a.toZonedDateTime({timeZone:o})}catch(e){}const i=null!=n?n:ou.Now.zonedDateTimeISO(o);return ou.ZonedDateTime.from({timeZone:o,year:null!==(h=null==a?void 0:a.year)&&void 0!==h?h:i.year,month:null!==(g=null==a?void 0:a.month)&&void 0!==g?g:i.month,day:null!==(f=null==a?void 0:a.day)&&void 0!==f?f:i.day,hour:null!==(v=null!==(m=null==a?void 0:a.hour)&&void 0!==m?m:null==n?void 0:n.hour)&&void 0!==v?v:0,minute:null!==(p=null!==(y=null==a?void 0:a.minute)&&void 0!==y?y:null==n?void 0:n.minute)&&void 0!==p?p:0,second:null!==(D=null!==(b=null==a?void 0:a.second)&&void 0!==b?b:null==n?void 0:n.second)&&void 0!==D?D:0,millisecond:null!==(x=null!==(w=null==a?void 0:a.millisecond)&&void 0!==w?w:null==n?void 0:n.millisecond)&&void 0!==x?x:0,microsecond:null!==(M=null!==(E=null==a?void 0:a.microsecond)&&void 0!==E?E:null==n?void 0:n.microsecond)&&void 0!==M?M:0,nanosecond:null!==(k=null!==(C=null==a?void 0:a.nanosecond)&&void 0!==C?C:null==n?void 0:n.nanosecond)&&void 0!==k?k:0})}},xh=(e,t,n)=>{const r=vh(t,n),a={YYYY:e.year.toString(),YY:mh(e.year%100),MM:mh(e.month),DD:mh(e.day),HH:mh(e.hour),mm:mh(e.minute)};return r.replace(fh,e=>{var t;return null!==(t=a[e])&&void 0!==t?t:e})},Eh=Array.from({length:24},(e,t)=>t),Mh=Array.from({length:60},(e,t)=>t),Ch=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],kh=(e,t)=>ou.PlainDate.compare(e,t),Th=({value:e,format:i="YYYY-MM-DD HH:mm",showTimeFormat:s="HH:mm",showTime:c=!0,onChange:u,onOk:h,timeZone:m,disabled:v=!1,placement:D="bottomLeft",autoAdjustOverflow:w=!0,getPopupContainer:x,matchTriggerWidth:E=!1})=>{const M=t(()=>void 0===c||("object"==typeof c||Boolean(c)),[c]),C=t(()=>M?"object"==typeof c&&(null==c?void 0:c.format)?c.format:s:"",[M,c,s]),T=t(()=>vh(i,C),[i,C]),N=t(()=>ph(T),[T]),I=t(()=>{const t=null!=m?m:lu(e[0])?lu(e[1])?ou.Now.timeZoneId():Dh(e[1]):Dh(e[0]),n=wh(e[0],t);return[n,wh(e[1],t,n)]},[e,m]),[S,H]=n(I),O=o(I),[R,P]=n("start"),[$,j]=n([xh(I[0],i,C),xh(I[1],i,C)]),Y=o([xh(I[0],i,C),xh(I[1],i,C)]),A=o(I),[L,Z]=n(I[0].toPlainDate().with({day:1})),[F,z]=n(!1),V=r(e=>{z(e)},[]),[B,W]=n(D),U=o(D),q=o(null),_=o(null),X=o({start:{hour:null,minute:null},end:{hour:null,minute:null}}),G=o(!1);a(()=>{Y.current=$},[$]),a(()=>{A.current=S},[S]),a(()=>{const e=O.current,t=0!==ou.ZonedDateTime.compare(e[0],I[0]),n=0!==ou.ZonedDateTime.compare(e[1],I[1]);(t||n)&&H(I),O.current=I},[I]),a(()=>{Z(I[0].toPlainDate().with({day:1}))},[I[0]]);const J=r((e,t,n=0)=>{var r;if(!e||!t)return;const a=e.getBoundingClientRect(),o=t.getBoundingClientRect().top-a.top+e.scrollTop-n,i=(null===(r=window.matchMedia)||void 0===r?void 0:r.call(window,"(prefers-reduced-motion: reduce)").matches)?"auto":"smooth";Math.abs(e.scrollTop-o)>1&&e.scrollTo({top:o,behavior:i})},[]),K=r(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=X.current[e];["hour","minute"].forEach(e=>{const n=t[e];if(!n)return;const r=n.querySelector('[data-active="true"]');r&&J(n,r,0)})})})},[J]);a(()=>{F&&M&&K(R)},[R,F,K,M]);const Q=S[0].epochMilliseconds,ee=S[0].offsetNanoseconds,te=S[1].epochMilliseconds,ne=S[1].offsetNanoseconds;a(()=>{const[e,t]=A.current,n=xh(e,i,C),r=xh(t,i,C),[a,o]=Y.current;a===n&&o===r||(Y.current=[n,r],j([n,r]))},[Q,ee,te,ne,i,C]),a(()=>{if(!F)return;const e=e=>{var t,n;const r=e.target;if(null===(t=q.current)||void 0===t?void 0:t.contains(r))return;if(null===(n=_.current)||void 0===n?void 0:n.contains(r))return;r.closest("[data-rangepicker-popup]")||V(!1)},t=setTimeout(()=>{document.addEventListener("mousedown",e)},100);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[F]),a(()=>{F||(P("start"),G.current||H(I),G.current=!1)},[F,I]);const re=r(e=>{u&&u(e,[xh(e[0],i,C),xh(e[1],i,C)])},[C,i,u]),ae=r(e=>{h&&h(e,[xh(e[0],i,C),xh(e[1],i,C)])},[C,i,h]),oe=r((e,t)=>{H(n=>{const r=[...n];if("start"===e){const e=wh(r[1],Dh(t),t),n=ou.ZonedDateTime.compare(t,e)>0?t:e;return[t,n]}const a=wh(r[0],Dh(t),t);return[ou.ZonedDateTime.compare(a,t)>0?t:a,t]})},[]),ie=r((e,t)=>{if(v)return;const n="start"===e?0:1;H(r=>{const a=r[n],o=a.with({hour:t,minute:a.minute,second:0,millisecond:0,microsecond:0,nanosecond:0});if("start"===e){const e=wh(r[1],Dh(o),o);return[o,ou.ZonedDateTime.compare(o,e)>0?o:e]}const i=wh(r[0],Dh(o),o);return[ou.ZonedDateTime.compare(i,o)>0?o:i,o]}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=X.current[e].hour;if(!t)return;const n=t.querySelector('[data-active="true"]');n&&J(t,n,0)})})},[v]),se=r((e,t)=>{if(v)return;const n="start"===e?0:1;H(r=>{const a=r[n].with({minute:t,second:0,millisecond:0,microsecond:0,nanosecond:0});if("start"===e){const e=wh(r[1],Dh(a),a);return[a,ou.ZonedDateTime.compare(a,e)>0?a:e]}const o=wh(r[0],Dh(a),a);return[ou.ZonedDateTime.compare(o,a)>0?a:o,a]}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=X.current[e].minute;if(!t)return;const n=t.querySelector('[data-active="true"]');n&&J(t,n,0)})})},[v]),le=r((e,t)=>{const n="start"===e?0:1;j(e=>{const r=[...e];return r[n]=t,r})},[]),de=r((e,t)=>{const n="start"===e?0:1,r=S[n],a=Dh(r),o=bh(t,N,r,a);if(o){oe(e,o);const t=o.toPlainDate().with({day:1});return Z(t),"start"===e&&P("end"),!0}return j(e=>{const t=[...e];return t[n]=xh(S[n],i,C),t}),!1},[S,C,i,N,oe]),ce=r(e=>t=>{le(e,t.target.value)},[le]),ue=r(e=>t=>{var n;if(v)return;if(F)return;const r=t.relatedTarget;r&&(null===(n=q.current)||void 0===n?void 0:n.contains(r))||de(e,t.target.value)},[de,v,F]),he=r(e=>t=>{"Enter"===t.key&&(t.preventDefault(),de(e,t.currentTarget.value)),"Escape"===t.key&&t.currentTarget.blur()},[de]),ge=e=>{Z(t=>t.add({months:e}).with({day:1}))},fe=e=>{Z(t=>t.add({years:e}).with({day:1}))},me=t(()=>{const e=L,t=e.dayOfWeek%7,n=e.subtract({days:t});return Array.from({length:42},(e,t)=>n.add({days:t}))},[L]),ve=S[0].toPlainDate(),ye=S[1].toPlainDate(),pe=r((e=D)=>{if(!w||!q.current)return e;const t=q.current.getBoundingClientRect(),n=E?t.width:480,r=window.innerHeight-t.bottom,a=t.top,o=window.innerWidth-t.left,i=t.right;let s=e;return s.startsWith("bottom")&&r<500&&a>r?s=s.replace("bottom","top"):s.startsWith("top")&&a<500&&r>a&&(s=s.replace("top","bottom")),s.endsWith("Left")&&o<n&&i>o?s=s.replace("Left","Right"):s.endsWith("Right")&&i<n&&o>i&&(s=s.replace("Right","Left")),s},[w,E,D]),be=r(()=>{const e=pe();U.current!==e&&(U.current=e,W(e))},[pe]),De=e=>{if(v)return;P(e);const t=S["start"===e?0:1].toPlainDate().with({day:1});Z(t);const n=pe();U.current!==n&&(U.current=n,W(n)),V(!0)};a(()=>{if(!F)return;be();const e=()=>be();return window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[F,be]);const we=d("div",{ref:_,style:(()=>{if(!q.current)return{};const e=q.current.getBoundingClientRect(),t=U.current,n={position:"fixed",zIndex:9999};return t.startsWith("bottom")?n.top=e.bottom+8:n.bottom=window.innerHeight-e.top+8,t.endsWith("Left")?n.left=e.left:n.right=window.innerWidth-e.right,E&&(n.width=`${e.width}px`),n})(),"data-rangepicker-popup":"true",children:l("div",{className:"space-y-3 rounded-xl border border-slate-200 dark:border-gray-600 bg-white dark:bg-gray-800 p-3",style:{boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",width:E?"100%":void 0},children:[l("div",{className:"flex gap-1",children:[l("div",{className:"flex-3 rounded-xl border border-slate-200 dark:border-gray-600 bg-white dark:bg-gray-800 shadow-sm w-full",children:[l("div",{className:"flex items-center justify-between border-b border-slate-100 dark:border-gray-600 px-3 py-2 text-sm font-medium text-slate-700 dark:text-gray-300",children:[l("div",{className:"flex items-center gap-1",children:[d("button",{type:"button",disabled:v,onClick:()=>fe(-1),className:"rounded-md px-2 py-1 text-slate-400 dark:text-gray-400 transition hover:text-slate-600 dark:hover:text-gray-200 disabled:opacity-40",children:d(y,{width:14,height:12})}),d("button",{type:"button",disabled:v,onClick:()=>ge(-1),className:"rounded-md px-2 py-1 text-slate-400 dark:text-gray-400 transition hover:text-slate-600 dark:hover:text-gray-200 disabled:opacity-40",children:d(g,{width:14,height:12})})]}),l("div",{className:"text-sm font-semibold text-slate-700 dark:text-gray-300",children:[Ch[L.month-1]," ",L.year]}),l("div",{className:"flex items-center gap-1",children:[d("button",{type:"button",disabled:v,onClick:()=>ge(1),className:"rounded-md px-2 py-1 text-slate-400 dark:text-gray-400 transition hover:text-slate-600 dark:hover:text-gray-200 disabled:opacity-40",children:d(f,{width:14,height:12})}),d("button",{type:"button",disabled:v,onClick:()=>fe(1),className:"rounded-md px-2 py-1 text-slate-400 dark:text-gray-400 transition hover:text-slate-600 dark:hover:text-gray-200 disabled:opacity-40",children:d(p,{width:14,height:12})})]})]}),d("div",{className:"grid grid-cols-7 gap-1 px-3 pb-3 pt-2 text-center text-[11px] uppercase tracking-wide text-slate-400 dark:text-gray-500",children:["Su","Mo","Tu","We","Th","Fr","Sa"].map(e=>d("span",{children:e},e))}),d("div",{className:"grid grid-cols-7 gap-2 px-1 ",children:me.map(e=>{const t=e.month!==L.month,n=0===kh(e,ve),r=0===kh(e,ye),a=kh(e,ve)>=0&&kh(e,ye)<=0;return d("button",{type:"button",disabled:v,onClick:()=>(e=>{if(v)return;const t=(e,t)=>{var n,r,a,o;const i=Dh(e);return ou.ZonedDateTime.from({timeZone:i,year:t.year,month:t.month,day:t.day,hour:e.hour,minute:e.minute,second:null!==(n=e.second)&&void 0!==n?n:0,millisecond:null!==(r=e.millisecond)&&void 0!==r?r:0,microsecond:null!==(a=e.microsecond)&&void 0!==a?a:0,nanosecond:null!==(o=e.nanosecond)&&void 0!==o?o:0})};if("start"===R){const n=t(S[0],e),r=S[1].epochMilliseconds-S[0].epochMilliseconds,a=n.add({milliseconds:r});return void H([n,a])}const n=t(S[1],e),r=S[1].epochMilliseconds-S[0].epochMilliseconds;if(ou.ZonedDateTime.compare(n,S[0])<0){const n=t(S[0],e),a=n.add({milliseconds:r});return void H([n,a])}const a=[S[0],n];H(a),Z(n.toPlainDate().with({day:1}))})(e),className:`flex h-9 w-9 items-center justify-center rounded-md text-sm transition ${n||r?"bg-blue-500 text-white font-semibold":a?"bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-300":t?"text-slate-300 dark:text-gray-600":"text-slate-700 dark:text-gray-300 hover:bg-blue-50 dark:hover:bg-blue-900/30 hover:text-blue-600 dark:hover:text-blue-300"}`,children:e.day},e.toString())})})]}),M&&d("div",{className:"flex flex-1 justify-end sm:w-32",children:(()=>{const e=R,t=S["start"===e?0:1],n=t.minute,r=Mh.includes(n)?Mh:[...Mh,n].sort((e,t)=>e-t);return l("div",{className:"flex flex-col rounded-xl border border-slate-200 dark:border-gray-600 bg-white dark:bg-gray-800 shadow-sm sm:w-28",children:[d("div",{className:"flex border-b border-slate-100 dark:border-gray-600 justify-center",children:l("div",{className:"text-lg py-1 text-slate-700 dark:text-gray-300",children:[t.hour.toString().padStart(2,"0"),":",t.minute.toString().padStart(2,"0")]})}),l("div",{className:"flex p-1",children:[d("div",{className:"w-14",children:d("div",{className:"h-72 overflow-y-auto rounded-md border border-slate-100 dark:border-gray-600 bg-white dark:bg-gray-700",role:"listbox","aria-label":"Hour",ref:t=>{X.current[e].hour=t},children:Eh.map(n=>{const r=n===t.hour;return d("button",{type:"button",role:"option","aria-selected":r,disabled:v,onClick:()=>ie(e,n),className:"flex h-8 w-full items-center justify-center text-sm transition "+(r?"bg-blue-500 text-white font-semibold":"text-slate-600 dark:text-gray-300 hover:bg-blue-50 dark:hover:bg-blue-900/30 hover:text-blue-600 dark:hover:text-blue-300"),"data-active":r?"true":void 0,children:mh(n)},n)})})}),d("div",{className:"w-14",children:d("div",{className:"h-72 overflow-y-auto rounded-md border border-slate-100 dark:border-gray-600 bg-white dark:bg-gray-700",role:"listbox","aria-label":"Minute",ref:t=>{X.current[e].minute=t},children:r.map(t=>{const r=t===n;return d("button",{type:"button",role:"option","aria-selected":r,disabled:v,onClick:()=>se(e,t),className:"flex h-8 w-full items-center justify-center text-sm transition "+(r?"bg-blue-500 text-white font-semibold":"text-slate-600 dark:text-gray-300 hover:bg-blue-50 dark:hover:bg-blue-900/30 hover:text-blue-600 dark:hover:text-blue-300"),"data-active":r?"true":void 0,children:mh(t)},t)})})})]})]})})()})]}),d("div",{className:"flex justify-end",children:d("button",{type:"button",onClick:()=>{G.current=!0,re(S),ae(S),V(!1)},disabled:v,className:"inline-flex items-center rounded-full bg-blue-500 px-4 py-1.5 text-sm font-semibold text-white shadow-sm transition hover:bg-blue-400 disabled:cursor-not-allowed disabled:bg-slate-300",children:"OK"})})]})});return l("div",{className:"relative max-w-[400px]",ref:q,children:[l("div",{className:"flex items-center gap-2 rounded-lg border text-sm shadow-sm transition "+(v?"cursor-not-allowed border-slate-200 dark:border-gray-600 bg-slate-50 dark:bg-gray-800 text-slate-400 dark:text-gray-500":F?"border-blue-500 bg-white dark:bg-gray-700 shadow-md":"border-slate-200 dark:border-gray-600 bg-white dark:bg-gray-700 hover:border-blue-300 dark:hover:border-blue-500"),children:[d("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:d("input",{type:"text",value:$[0],onChange:ce("start"),onFocus:()=>De("start"),onClick:()=>De("start"),onBlur:ue("start"),onKeyDown:he("start"),className:"w-full rounded-md border px-2 py-1.5 text-sm font-medium transition focus:outline-none focus:ring-0 "+(v?"cursor-not-allowed border-transparent bg-transparent text-slate-400 dark:text-gray-500":"start"===R&&F?" bg-white dark:bg-gray-700 text-blue-600 dark:text-blue-400":"border-transparent bg-transparent text-slate-700 dark:text-gray-300 hover:border-blue-200 dark:hover:border-blue-400"),placeholder:T,autoComplete:"off",disabled:v})}),d(b,{className:"text-slate-400 dark:text-gray-500"}),d("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:d("input",{type:"text",value:$[1],onChange:ce("end"),onFocus:()=>De("end"),onClick:()=>De("end"),onBlur:ue("end"),onKeyDown:he("end"),className:"w-full rounded-md border px-2 py-1.5 text-sm font-medium transition focus:outline-none focus:ring-0 "+(v?"cursor-not-allowed border-transparent bg-transparent text-slate-400 dark:text-gray-500":"end"===R&&F?"bg-white dark:bg-gray-700 text-blue-600 dark:text-blue-400":"border-transparent bg-transparent text-slate-700 dark:text-gray-300 hover:border-blue-200 dark:hover:border-blue-400"),placeholder:T,autoComplete:"off",disabled:v})})]}),F&&(x?k.createPortal(we,x()):k.createPortal(we,document.body))]})},Nh=({event:e,isOpen:n,isAllDay:r,onEventUpdate:a,onEventDelete:o,onClose:i})=>{var s;const c=t(()=>L().getVisible().map(e=>({label:e.name,value:e.id})),[]),u=t(()=>lu(e.start)?e.end&&!lu(e.end)&&(e.end.timeZoneId||e.end.timeZoneId)||ou.Now.timeZoneId():e.start.timeZoneId||e.start.timeZoneId||ou.Now.timeZoneId(),[e.end,e.start]),h=t=>{const[n,r]=t;a(Object.assign(Object.assign({},e),{start:n.toPlainDate(),end:r.toPlainDate()}))};if(!n)return null;if("undefined"==typeof window||"undefined"==typeof document)return null;const g=l("div",{className:"fixed inset-0 flex items-center justify-center",style:{pointerEvents:"auto",zIndex:9998},"data-event-detail-dialog":"true",children:[d("div",{className:"absolute inset-0 bg-black/60 dark:bg-black/80",onClick:e=>{const t=e.target;t.closest("[data-rangepicker-popup]")||t===e.currentTarget&&i()}}),l("div",{className:"relative bg-white dark:bg-gray-800 shadow-2xl border border-gray-200 dark:border-gray-700 rounded-lg p-6 max-w-md w-full mx-4",children:[d("button",{onClick:i,className:"absolute top-4 right-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-200 transition","aria-label":"Close",children:d("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:d("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),l("div",{className:"pr-8",children:[d("span",{className:"block text-xs text-gray-600 dark:text-gray-300 mb-1",children:"Event Title"}),l("div",{className:"flex items-center justify-between gap-3 mb-4",children:[d("div",{className:"flex-1",children:d("input",{type:"text",value:e.title,onChange:t=>{a(Object.assign(Object.assign({},e),{title:t.target.value}))},className:"w-full border border-slate-200 dark:border-gray-600 rounded-lg px-3 py-2 text-sm text-gray-900 dark:text-gray-100 dark:bg-gray-700 shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-400 dark:focus:ring-blue-500 focus:border-blue-400 dark:focus:border-blue-500 transition"})}),d(gh,{options:c,value:e.calendarId||"blue",onChange:t=>{a(Object.assign(Object.assign({},e),{calendarId:t}))}})]}),l("div",r?{className:"mb-4",children:[d("div",{className:"text-xs text-gray-600 dark:text-gray-300 mb-1",children:"Date Range"}),d(Th,{value:[e.start,e.end],format:"YYYY-MM-DD",showTime:!1,timeZone:u,matchTriggerWidth:!0,onChange:h,onOk:h})]}:{className:"mb-4",children:[d("div",{className:"text-xs text-gray-600 dark:text-gray-300 mb-1",children:"Time Range"}),d(Th,{value:[e.start,e.end],timeZone:u,onChange:t=>{const[n,r]=t;a(Object.assign(Object.assign({},e),{start:n,end:r}))},onOk:t=>{const[n,r]=t;a(Object.assign(Object.assign({},e),{start:n,end:r}))}})]}),l("div",{className:"mb-4",children:[d("span",{className:"block text-xs text-gray-600 dark:text-gray-300 mb-1",children:"Note"}),d("textarea",{value:null!==(s=e.description)&&void 0!==s?s:"",onChange:t=>a(Object.assign(Object.assign({},e),{description:t.target.value})),rows:4,className:"w-full border border-slate-200 dark:border-gray-600 rounded-lg px-3 py-2 text-sm text-gray-900 dark:text-gray-100 dark:bg-gray-700 shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-400 dark:focus:ring-blue-500 focus:border-blue-400 dark:focus:border-blue-500 transition resize-none",placeholder:"Add a note..."})]}),l("div",{className:"flex space-x-2",children:[d("button",r?{className:"px-3 py-2 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-200 rounded-lg hover:bg-blue-200 dark:hover:bg-blue-800 text-sm font-medium transition",onClick:()=>{const t=lu(e.start)?e.start:e.start.toPlainDate(),n=ou.ZonedDateTime.from({year:t.year,month:t.month,day:t.day,hour:9,minute:0,timeZone:ou.Now.timeZoneId()}),r=ou.ZonedDateTime.from({year:t.year,month:t.month,day:t.day,hour:10,minute:0,timeZone:ou.Now.timeZoneId()});a(Object.assign(Object.assign({},e),{allDay:!1,start:n,end:r}))},children:"Set as Timed Event"}:{className:"px-3 py-2 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-200 rounded-lg hover:bg-blue-200 dark:hover:bg-blue-800 text-sm font-medium transition",onClick:()=>{const t=lu(e.start)?e.start:e.start.toPlainDate();a(Object.assign(Object.assign({},e),{allDay:!0,start:t,end:t}))},children:"Set as All-day"}),d("button",{className:"px-3 py-2 bg-red-100 dark:bg-red-900 text-red-700 dark:text-red-200 rounded-lg hover:bg-red-200 dark:hover:bg-red-800 text-sm font-medium transition",onClick:()=>{o(e.id),i()},children:"Delete"})]})]})]})]}),f=document.body;return f?k.createPortal(g,f):null},Ih=(e,t,n)=>`${e} ${t} ${n.split(" ").filter(Boolean).map(e=>`dark:${e}`).join(" ")}`.trim(),Sh={container:"bg-white dark:bg-gray-900",card:"bg-white dark:bg-gray-800",sidebar:"bg-gray-50 dark:bg-gray-900",text:"text-gray-900 dark:text-gray-100",textMuted:"text-gray-500 dark:text-gray-400",textSubtle:"text-gray-600 dark:text-gray-300",textEmphasis:"text-gray-900 dark:text-white",border:"border-gray-200 dark:border-gray-700",borderLight:"border-gray-100 dark:border-gray-800",borderStrong:"border-gray-300 dark:border-gray-600",bgPrimary:"bg-white dark:bg-gray-900",bgSecondary:"bg-gray-50 dark:bg-gray-800",bgTertiary:"bg-gray-100 dark:bg-gray-700",bgMuted:"bg-gray-100 dark:bg-gray-800",hover:"hover:bg-gray-100 dark:hover:bg-gray-800",hoverSubtle:"hover:bg-gray-50 dark:hover:bg-gray-900",active:"bg-gray-200 dark:bg-gray-700",focus:"focus:ring-blue-500 dark:focus:ring-blue-400",input:"bg-white dark:bg-gray-700 border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100",inputFocus:"focus:border-blue-500 dark:focus:border-blue-400 focus:ring-blue-500 dark:focus:ring-blue-400",buttonPrimary:"bg-blue-500 dark:bg-blue-600 text-white hover:bg-blue-600 dark:hover:bg-blue-700",buttonSecondary:"bg-gray-200 dark:bg-gray-700 text-gray-900 dark:text-gray-100 hover:bg-gray-300 dark:hover:bg-gray-600",buttonDanger:"bg-red-100 dark:bg-red-900 text-red-700 dark:text-red-200 hover:bg-red-200 dark:hover:bg-red-800",buttonSuccess:"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-200 hover:bg-blue-200 dark:hover:bg-blue-800",shadow:"shadow-sm dark:shadow-gray-900/50",shadowMd:"shadow-md dark:shadow-gray-900/50",shadowLg:"shadow-lg dark:shadow-gray-900/50",divider:"border-gray-200 dark:border-gray-700"},Hh=(e,t,n)=>e?t:n,Oh=(...e)=>e.filter(Boolean).join(" "),Rh=e=>{if("undefined"==typeof document)return e;const t=document.documentElement,n=[t.getAttribute("data-dayflow-theme-override"),t.getAttribute("data-theme-override"),t.getAttribute("data-theme")];for(const e of n)if("light"===e||"dark"===e)return e;return t.classList.contains("dark")?"dark":t.classList.contains("light")?"light":e},Ph=i(void 0),$h=()=>"undefined"==typeof window?"light":window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",jh=({children:e,initialTheme:t="light",onThemeChange:o})=>{const[i,s]=n(t),[l,c]=n($h),u="auto"===i?l:i;a(()=>{s(t)},[t]);const h=r(e=>{s(e)},[]);a(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),t=e=>{const t=e.matches?"dark":"light";c(t)},n=e.matches?"dark":"light";return c(n),e.addEventListener?e.addEventListener("change",t):e.addListener&&e.addListener(t),()=>{e.removeEventListener?e.removeEventListener("change",t):e.removeListener&&e.removeListener(t)}},[]),a(()=>{if("undefined"==typeof document)return;const e=document.documentElement,t=Rh(u),n="auto"===i?t:u;e.classList.remove("light","dark"),e.classList.add(n),"auto"===i?e.removeAttribute("data-dayflow-theme-override"):e.setAttribute("data-dayflow-theme-override",n),e.setAttribute("data-theme",n)},[u,i,l]),a(()=>{o&&o(i,u)},[i,u,o]);const g={theme:i,effectiveTheme:u,setTheme:h};return d(Ph.Provider,{value:g,children:e})},Yh=()=>{const e=s(Ph);if(void 0===e)throw new Error("useTheme must be used within a ThemeProvider");return e},Ah=({calendar:e,className:i,style:s,customDetailPanelContent:c,customEventDetailDialog:u,meta:h})=>{var g,f;const m=e.app,v=m.getCurrentView(),y=v.component,p=m.getSidebarConfig(),b=null!==(g=null==p?void 0:p.enabled)&&void 0!==g&&g,[D,w]=n(0),[x,E]=n(null!==(f=null==p?void 0:p.initialCollapsed)&&void 0!==f&&f),[M,C]=n(()=>m.getTheme());a(()=>{var e;E(null!==(e=null==p?void 0:p.initialCollapsed)&&void 0!==e&&e)},[null==p?void 0:p.initialCollapsed]),a(()=>{const e=m.subscribeThemeChange(e=>{C(e)});return()=>{e()}},[m]);const k=r(e=>{m.setTheme(e)},[m]),T=r(()=>{w(e=>e+1)},[]),N=t(()=>m.getCalendars(),[m,D]),I=r((e,t)=>{m.setCalendarVisibility(e,t),T()},[m,T]),S=r(e=>{m.setAllCalendarsVisibility(e),T()},[m,T]),H=o(null),O=u||(m.getUseEventDetailDialog()?Nh:void 0),R={app:m,config:v.config||{},customDetailPanelContent:c,customEventDetailDialog:O,switcherMode:m.state.switcherMode,calendarRef:H,meta:h},P={app:m,calendars:N,toggleCalendarVisibility:I,toggleAll:S,isCollapsed:x,setCollapsed:E},$=x?"60px":F(null==p?void 0:p.width,"240px");return d(jh,{initialTheme:M,onThemeChange:k,children:d("div",{className:`calendar-container ${null!=i?i:""}`,style:Object.assign({height:800},s),children:l("div",{className:"flex h-full",children:[b&&d("aside",{className:"shrink-0",style:{width:$},children:b?p.render?p.render(P):d(hh,Object.assign({},P)):null}),d("div",{className:"flex flex-col flex-1 h-full",ref:H,children:d("div",{className:"calendar-renderer h-full",children:d(y,Object.assign({},R))})})]})})})},Lh=({originalComponent:e,app:n,config:a,customDetailPanelContent:o,customEventDetailDialog:i,calendarRef:s,switcherMode:l,meta:c})=>{const u=n.getPlugin("events"),h=a.enableDrag?n.getPlugin("drag"):void 0,g=n.getCurrentDate(),f=n.state.currentView,m=n.getEvents(),v=r(e=>{u?u.update(e.id,e):n.updateEvent(e.id,e)},[u,n]),y=r(e=>{u?u.delete(e):n.deleteEvent(e)},[u,n]),p=r(e=>{u?u.add(e):n.addEvent(e)},[u,n]),b=r(e=>{n.setCurrentDate(e)},[n]),D=r(e=>{n.changeView(e)},[n]),w=t(()=>{const e=a.viewConfig||{};return h&&Object.assign(e,a.dragConfig||{}),u&&Object.assign(e,a.eventsConfig||{}),e},[a,h,u]),x=t(()=>({app:n,currentDate:g,currentView:f,events:m,onEventUpdate:v,onEventDelete:y,onEventCreate:p,onDateChange:b,onViewChange:D,config:w}),[n,g,f,m,v,y,p,b,D,w]),E=t(()=>{const e={currentDate:g,events:m,setEvents:e=>{m.forEach(e=>y(e.id)),e.forEach(e=>p(e))},updateEvent:v,deleteEvent:y,addEvent:p,goToPrevious:()=>{const e=new Date(g);switch(f){case N.DAY:e.setDate(e.getDate()-1);break;case N.WEEK:e.setDate(e.getDate()-7);break;case N.MONTH:e.setMonth(e.getMonth()-1)}b(e)},goToNext:()=>{const e=new Date(g);switch(f){case N.DAY:e.setDate(e.getDate()+1);break;case N.WEEK:e.setDate(e.getDate()+7);break;case N.MONTH:e.setMonth(e.getMonth()+1)}b(e)},goToToday:()=>{b(new Date)},changeView:D,selectDate:b};return Object.assign(Object.assign({calendar:e},x),{eventsService:u,dragService:h,customDetailPanelContent:o,customEventDetailDialog:i,calendarRef:s,switcherMode:l,meta:c})},[g,m,f,v,y,p,b,D,x,u,h,o,i,s,l,c]);return d(e,Object.assign({},E))},Zh=e=>{if(!e)return"";let t,n,r;e instanceof Date?(t=e.getFullYear(),n=e.getMonth()+1,r=e.getDate()):lu(e)?(t=e.year,n=e.month,r=e.day):(!function(){ou.ZonedDateTime}(e),t=e.year,n=e.month,r=e.day);const a=String(n).padStart(2,"0");return`${String(r).padStart(2,"0")}/${a}/${t}`},Fh=e=>`${["January","February","March","April","May","June","July","August","September","October","November","December"][e.getMonth()]} ${e.getFullYear()}`,zh=e=>{const t=e.year,n=e.month;return`${e.day} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][n-1]} ${t}`};function Vh(e){return!("hour"in e)}function Bh(e){return"hour"in e&&!("timeZone"in e)}function Wh(e){return"timeZone"in e}function Uh(e){if(Vh(e))return new Date(e.year,e.month-1,e.day);if(Bh(e))return new Date(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);const t=e.toInstant();return new Date(t.epochMilliseconds)}function qh(e){return ou.PlainDate.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()})}function _h(e){return ou.PlainDateTime.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),millisecond:e.getMilliseconds()})}function Xh(e,t){return ou.ZonedDateTime.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),millisecond:e.getMilliseconds(),timeZone:t})}function Gh(e){return new Date(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond)}function Jh(e){return new Date(e.year,e.month-1,e.day)}function Kh(e){if(Vh(e))return 0;return e.hour+e.minute/60}function Qh(e,t){const n=Math.floor(t),r=Math.round(60*(t-n));return Wh(e),e.with({hour:n,minute:r,second:0,millisecond:0})}function eg(e,t){const n=Vh(e)?e:(Bh(e),e.toPlainDate()),r=Vh(t)?t:(Bh(t),t.toPlainDate());return n.equals(r)}function tg(e){return Vh(e)?e:(Bh(e),e.toPlainDate())}function ng(e,t=!1){if(e instanceof ou.PlainDate||e instanceof ou.PlainDateTime)return e;if(e instanceof Date)return t?qh(e):_h(e);throw new Error("Invalid time type: "+typeof e)}function rg(e,t){if(e instanceof ou.ZonedDateTime)return e;if(e instanceof Date)return Xh(e,t);throw new Error("Invalid time type: "+typeof e)}function ag(e){var t;const n=ng(e.start,e.allDay),r=ng(e.end,e.allDay);return{id:e.id,title:e.title,description:e.description,start:n,end:r,allDay:null!==(t=e.allDay)&&void 0!==t&&t,calendarId:e.calendarId,meta:e.meta}}function og(e){const t=rg(e.start,e.timeZone),n=rg(e.end,e.timeZone);return{id:e.id,title:e.title,description:e.description,start:t,end:n,allDay:!1,calendarId:e.calendarId,meta:e.meta}}function ig(e){return e.map(e=>ag(e))}function sg(e){return e.map(e=>og(e))}function lg(e,t,n,r){return ag(Object.assign({id:e,title:t,start:n,end:n,allDay:!0},r))}function dg(e,t,n,r,a){return ag(Object.assign({id:e,title:t,start:n,end:r},a))}function cg(e,t,n,r,a=!1,o){return ag(Object.assign({id:e,title:t,start:n,end:r,allDay:a},o))}function ug(e,t,n,r,a,o){return og(Object.assign({id:e,title:t,start:n,end:r,timeZone:a},o))}const hg=e=>{const t=e.title.toLowerCase();return t.includes("holiday")||t.includes("vacation")||t.includes("假期")?d(D,{className:"h-3 w-3"}):t.includes("birthday")||t.includes("anniversary")||t.includes("生日")?d(w,{className:"h-3 w-3"}):t.includes("conference")||t.includes("meeting")||t.includes("会议")||t.includes("研讨")?d(x,{className:"h-3 w-3"}):t.includes("trip")||t.includes("travel")||t.includes("旅行")?d(E,{className:"h-3 w-3"}):d(M,{className:"h-3 w-3"})},gg=(e,t)=>{const n=[],r=new Date(t);return r.setDate(t.getDate()+6),r.setHours(23,59,59,999),e.forEach(e=>{const a=gu(e.start),o=gu(e.end),i=new Date(a);i.setHours(0,0,0,0);const s=new Date(o);s.setHours(0,0,0,0);let l=new Date(s);if(!e.allDay){if(!(0!==o.getHours()||0!==o.getMinutes()||0!==o.getSeconds())){const e=o.getTime()-a.getTime();e>0&&e<864e5&&(l=new Date(s),l.setDate(l.getDate()-1))}}const d=Du(i,l)>0;if(!d&&e.allDay){if(i<t||i>r)return;const a=Math.floor((i.getTime()-t.getTime())/864e5);return void(a>=0&&a<=6&&n.push({id:`${e.id}-week-${t.getTime()}`,originalEventId:e.id,event:e,startDayIndex:a,endDayIndex:a,segmentType:"single",totalDays:1,segmentIndex:0,isFirstSegment:!0,isLastSegment:!0}))}if(!d)return;const c=i;let u;if(e.allDay)u=new Date(s),u.setHours(23,59,59,999);else{0!==o.getHours()||0!==o.getMinutes()||0!==o.getSeconds()?(u=new Date(s),u.setHours(23,59,59,999)):(u=new Date(s),u.setTime(u.getTime()-1))}if(u<t||c>r)return;const h=c<t?t:c,g=u>r?r:u,f=Math.max(0,Math.floor((h.getTime()-t.getTime())/864e5)),m=Math.min(6,Math.floor((g.getTime()-t.getTime())/864e5)),v=c>=t,y=u<=r,p=0===f||6===m;let b;b=v&&y?"single":v?p&&6===m?"start-week-end":"start":y?p&&0===f?"end-week-start":"end":"middle";const D=Du(c,u)+1;n.push({id:`${e.id}-week-${t.getTime()}`,originalEventId:e.id,event:e,startDayIndex:f,endDayIndex:m,segmentType:b,totalDays:D,segmentIndex:0,isFirstSegment:v,isLastSegment:y})}),n},fg=(e,t)=>{if(e.allDay)return[];const n=gu(e.start),r=gu(e.end),a=new Date(n);a.setHours(0,0,0,0);const o=new Date(r);o.setHours(0,0,0,0);const i=Du(a,o);if(0===i)return[];const s=0!==r.getHours()||0!==r.getMinutes()||0!==r.getSeconds()||0!==r.getMilliseconds(),l=r.getTime()-n.getTime();if(!e.allDay&&1===i&&!s&&l<864e5)return[];const d=s?i:Math.max(0,i-1),c=[];for(let e=0;e<=d;e++){const o=new Date(a);o.setDate(a.getDate()+e);const i=Math.floor((o.getTime()-t.getTime())/864e5);if(i<0||i>6)continue;const l=0===e,u=e===d,h=l?n.getHours()+n.getMinutes()/60:0,g=u&&s?r.getHours()+r.getMinutes()/60:24;c.push({dayIndex:i,startHour:h,endHour:g,isFirst:l,isLast:u})}return c},mg=e.memo(({segment:e,segmentIndex:t,isDragging:n,isResizing:r=!1,isSelected:a=!1,onMoveStart:o,onResizeStart:i})=>{const s=17*t,c=`calc(${e.startDayIndex/7*100}% + 2px)`,u=`calc(${(e.endDayIndex-e.startDayIndex+1)/7*100}% - 4px)`,h=t=>{const n="left"===t;return(n?e.isFirstSegment:e.isLastSegment)&&i?d("div",{className:`resize-handle absolute ${n?"left-0":"right-0"} top-0 bottom-0 w-1 cursor-ew-resize opacity-0 group-hover:opacity-100 transition-opacity z-20`,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),i(t,e.event,n?"left":"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}}):null},g=e.event.calendarId||"blue",f=e.endDayIndex-e.startDayIndex+1;return l("div",{className:"absolute px-1 text-xs select-none flex items-center transition-all duration-200 hover:shadow-sm dark:hover:shadow-lg dark:hover:shadow-black/20 group",style:Object.assign({left:c,width:u,top:s-2+"px",height:"16px",borderRadius:(m=e.segmentType,{single:"0.25rem",start:"0.25rem 0 0 0.25rem","start-week-end":"0.25rem 0 0 0.25rem",end:"0 0.25rem 0.25rem 0","end-week-start":"0 0.25rem 0.25rem 0",middle:"0"}[m]),pointerEvents:"auto",zIndex:10},a||n?{backgroundColor:Ou(g),color:"#fff"}:{backgroundColor:Su(g),color:Hu(g)}),"data-segment-days":f,onMouseDown:t=>{t.preventDefault(),t.stopPropagation();t.target.closest(".resize-handle")||o(t,e.event)},title:`${e.event.title} (${Zh(e.event.start)} - ${Zh(e.event.end)})`,children:[h("left"),d("div",{className:"flex-1 min-w-0",style:{cursor:r?"ew-resize":"pointer"},children:(()=>{const t=e.event.allDay,n=e.event.calendarId||"blue",r=Mu(e.event.start),a=Au(e.event),o=$u(r),i=$u(a);if(t){const t=()=>e.isFirstSegment?e.event.title:"middle"===e.segmentType||e.isLastSegment&&e.totalDays>1?"···":e.event.title;return l("div",{className:"flex items-center min-w-0 w-full pointer-events-auto",children:[e.isFirstSegment&&d("div",{className:"flex-shrink-0 mr-1",children:d("div",{className:"rounded-full p-0.5 text-white flex items-center justify-center",style:{backgroundColor:Ru(n),width:"12px",height:"12px"},children:hg(e.event)})}),d("div",{className:"flex-1 min-w-0",children:d("div",{className:"truncate font-medium text-xs",children:t()})}),e.isLastSegment&&"single"!==e.segmentType&&d("div",{className:"flex-shrink-0 ml-1 text-white/80 dark:text-white/90",children:d("div",{className:"w-1.5 h-1.5 rounded-full bg-white/60 dark:bg-white/80"})})]})}const s=e.isFirstSegment||e.isLastSegment?e.event.title:"···",c=e.endDayIndex-e.startDayIndex+1,u=c>1?{position:"absolute",right:`calc(${c>1?(c-1)/c*100:0}% + 2px)`,top:"50%",transform:"translateY(-50%)"}:void 0;return l("div",{className:"relative flex items-center min-w-0 w-full pointer-events-auto",children:[d("span",{className:"inline-block w-[3px] h-3 rounded-full flex-shrink-0 mr-1",style:{backgroundColor:Ru(n)}}),d("div",{className:"flex items-center min-w-0 flex-1",children:d("span",{className:"truncate font-medium text-xs",children:s})}),e.isFirstSegment&&d("span",{className:"text-xs font-medium whitespace-nowrap "+(1===c?"ml-2":""),style:u,children:o}),e.isLastSegment&&!e.event.allDay&&24!==a&&d("span",{className:"text-xs font-medium whitespace-nowrap ml-auto",children:`ends ${i}`})]})})()}),h("right")]});var m});mg.displayName="MultiDayEvent";const vg=({event:e,position:n,panelRef:r,isAllDay:a,eventVisibility:o,calendarRef:i,selectedEventElementRef:s,onEventUpdate:c,onEventDelete:u})=>{var h;const{effectiveTheme:g}=Yh(),f=Rh(g),m="dark"===f?"#1f2937":"white",v="dark"===f?"rgb(55, 65, 81)":"rgb(229, 231, 235)",y=t(()=>L().getVisible().map(e=>({label:e.name,value:e.id})),[]),p=t(()=>lu(e.start)?e.end&&!lu(e.end)&&(e.end.timeZoneId||e.end.timeZoneId)||ou.Now.timeZoneId():e.start.timeZoneId||e.start.timeZoneId||ou.Now.timeZoneId(),[e.end,e.start]),b=t=>{const[n,r]=t;c(Object.assign(Object.assign({},e),{start:n.toPlainDate(),end:r.toPlainDate()}))},D=(()=>{var e;let t={};if("sticky-top"===o){const r=null===(e=i.current)||void 0===e?void 0:e.querySelector(".calendar-content");if(r){const e=r.getBoundingClientRect().top+3-n.top;t=Object.assign({position:"absolute",width:"12px",height:"12px",backgroundColor:m,transform:"rotate(45deg)",transformOrigin:"center",top:e-6+"px",borderRight:""+(n.isSunday?`1px solid ${v}`:"none"),borderTop:""+(n.isSunday?`1px solid ${v}`:"none"),borderLeft:""+(n.isSunday?"none":`1px solid ${v}`),borderBottom:""+(n.isSunday?"none":`1px solid ${v}`)},n.isSunday?{right:"-6px"}:{left:"-6px"})}}else if("sticky-bottom"===o){const e=r.current;let a=200;if(e){const t=e.getBoundingClientRect(),n=window.getComputedStyle(e),r=parseInt(n.paddingBottom,10)||0,o=parseInt(n.borderBottomWidth,10)||0;a=t.height-r-o-6+11}t={position:"absolute",width:"12px",height:"12px",backgroundColor:m,transform:"rotate(45deg)",transformOrigin:"center",top:`${a}px`,left:n.isSunday?void 0:"-6px",right:n.isSunday?"-6px":void 0,borderRight:""+(n.isSunday?`1px solid ${v}`:"none"),borderTop:""+(n.isSunday?`1px solid ${v}`:"none"),borderLeft:""+(n.isSunday?"none":`1px solid ${v}`),borderBottom:""+(n.isSunday?"none":`1px solid ${v}`)}}else if(n&&s.current&&i.current){const e=s.current.getBoundingClientRect(),a=i.current.querySelector(".calendar-content");if(a){const o=a.getBoundingClientRect(),i=Math.max(e.top,o.top),s=Math.min(e.bottom,o.bottom),l=Math.max(0,s-i);let d;d=l===e.height?e.top+e.height/2:l>0?i+l/2:e.top+e.height/2;const c=d-n.top,u=r.current;let h=228;if(u){const e=u.getBoundingClientRect(),t=window.getComputedStyle(u),n=parseInt(t.paddingBottom,10)||0,r=parseInt(t.borderBottomWidth,10)||0;h=e.height-n-r+11}const g=12,f=Math.max(g,Math.min(h,c));t=Object.assign({position:"absolute",width:"12px",height:"12px",backgroundColor:m,transform:"rotate(45deg)",transformOrigin:"center",top:f-6+"px",borderRight:""+(n.isSunday?`1px solid ${v}`:"none"),borderTop:""+(n.isSunday?`1px solid ${v}`:"none"),borderLeft:""+(n.isSunday?"none":`1px solid ${v}`),borderBottom:""+(n.isSunday?"none":`1px solid ${v}`)},n.isSunday?{right:"-6px"}:{left:"-6px"})}}return t})(),w=l("div",{ref:r,className:"fixed bg-white dark:bg-gray-800 shadow-lg border border-gray-200 dark:border-gray-700 rounded-lg p-4 ","data-event-detail-panel":"true",style:{top:`${n.top}px`,left:`${n.left}px`,zIndex:9999,pointerEvents:"auto"},children:[d("div",{style:D}),d("span",{className:"block text-xs text-gray-600 dark:text-gray-300 mb-1",children:"Event Title"}),l("div",{className:"flex items-center justify-between gap-3 mb-3",children:[d("div",{className:"flex-1",children:d("input",{type:"text",value:e.title,onChange:t=>{c(Object.assign(Object.assign({},e),{title:t.target.value}))},className:"w-full border border-slate-200 dark:border-gray-600 rounded-lg px-3 py-1.5 text-sm text-gray-900 dark:text-gray-100 dark:bg-gray-700 shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-400 dark:focus:ring-blue-500 focus:border-blue-400 dark:focus:border-blue-500 transition"})}),d(gh,{options:y,value:e.calendarId||"blue",onChange:t=>{c(Object.assign(Object.assign({},e),{calendarId:t}))}})]}),l("div",a?{className:"mb-3",children:[d("div",{className:"text-xs text-gray-600 dark:text-gray-300 mb-1",children:"Date Range"}),d(Th,{value:[e.start,e.end],format:"YYYY-MM-DD",showTime:!1,timeZone:p,matchTriggerWidth:!0,onChange:b,onOk:b})]}:{className:"mb-3",children:[d("div",{className:"text-xs text-gray-600 dark:text-gray-300 mb-1",children:"Time Range"}),d(Th,{value:[e.start,e.end],timeZone:p,onChange:t=>{const[n,r]=t;c(Object.assign(Object.assign({},e),{start:n,end:r}))},onOk:t=>{const[n,r]=t;c(Object.assign(Object.assign({},e),{start:n,end:r}))}})]}),l("div",{className:"mb-3",children:[d("span",{className:"block text-xs text-gray-600 dark:text-gray-300 mb-1",children:"Note"}),d("textarea",{value:null!==(h=e.description)&&void 0!==h?h:"",onChange:t=>c(Object.assign(Object.assign({},e),{description:t.target.value})),rows:3,className:"w-full border border-slate-200 dark:border-gray-600 rounded-lg px-3 py-2 text-sm text-gray-900 dark:text-gray-100 dark:bg-gray-700 shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-400 dark:focus:ring-blue-500 focus:border-blue-400 dark:focus:border-blue-500 transition resize-none",placeholder:"Add a note..."})]}),l("div",{className:"flex space-x-2",children:[d("button",a?{className:"px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-200 rounded hover:bg-blue-200 dark:hover:bg-blue-800 text-xs font-medium transition",onClick:()=>{const t=lu(e.start)?e.start:e.start.toPlainDate(),n=ou.ZonedDateTime.from({year:t.year,month:t.month,day:t.day,hour:9,minute:0,timeZone:ou.Now.timeZoneId()}),r=ou.ZonedDateTime.from({year:t.year,month:t.month,day:t.day,hour:10,minute:0,timeZone:ou.Now.timeZoneId()});c(Object.assign(Object.assign({},e),{allDay:!1,start:n,end:r}))},children:"Set as Timed Event"}:{className:"px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-200 rounded hover:bg-blue-200 dark:hover:bg-blue-800 text-xs font-medium transition",onClick:()=>{const t=lu(e.start)?e.start:e.start.toPlainDate();c(Object.assign(Object.assign({},e),{allDay:!0,start:t,end:t}))},children:"Set as All-day"}),d("button",{className:"px-2 py-1 bg-red-100 dark:bg-red-900 text-red-700 dark:text-red-200 rounded hover:bg-red-200 dark:hover:bg-red-800 text-xs font-medium transition",onClick:()=>u(e.id),children:"Delete"})]})]});if("undefined"==typeof window||"undefined"==typeof document)return null;const x=document.body;return x?k.createPortal(w,x):null},yg=({event:e,position:t,panelRef:n,isAllDay:r,eventVisibility:a,calendarRef:o,selectedEventElementRef:i,onEventUpdate:s,onEventDelete:c,onClose:u,contentRenderer:h})=>{const{effectiveTheme:g}=Yh(),f=Rh(g),m="dark"===f?"#1f2937":"white",v="dark"===f?"rgb(55, 65, 81)":"rgb(229, 231, 235)",y=(()=>{var e;let r={};if("sticky-top"===a){const n=null===(e=o.current)||void 0===e?void 0:e.querySelector(".calendar-content");if(n){const e=n.getBoundingClientRect().top+3-t.top;r=Object.assign({position:"absolute",width:"12px",height:"12px",backgroundColor:m,transform:"rotate(45deg)",transformOrigin:"center",top:e-6+"px",borderRight:""+(t.isSunday?`1px solid ${v}`:"none"),borderTop:""+(t.isSunday?`1px solid ${v}`:"none"),borderLeft:""+(t.isSunday?"none":`1px solid ${v}`),borderBottom:""+(t.isSunday?"none":`1px solid ${v}`)},t.isSunday?{right:"-6px"}:{left:"-6px"})}}else if("sticky-bottom"===a){const e=n.current;let a=200;if(e){const t=e.getBoundingClientRect(),n=window.getComputedStyle(e),r=parseInt(n.paddingBottom,10)||0,o=parseInt(n.borderBottomWidth,10)||0;a=t.height-r-o-6+11}r={position:"absolute",width:"12px",height:"12px",backgroundColor:m,transform:"rotate(45deg)",transformOrigin:"center",top:`${a}px`,left:t.isSunday?void 0:"-6px",right:t.isSunday?"-6px":void 0,borderRight:""+(t.isSunday?`1px solid ${v}`:"none"),borderTop:""+(t.isSunday?`1px solid ${v}`:"none"),borderLeft:""+(t.isSunday?"none":`1px solid ${v}`),borderBottom:""+(t.isSunday?"none":`1px solid ${v}`)}}else if(t&&i.current&&o.current){const e=i.current.getBoundingClientRect(),a=o.current.querySelector(".calendar-content");if(a){const o=a.getBoundingClientRect(),i=Math.max(e.top,o.top),s=Math.min(e.bottom,o.bottom),l=Math.max(0,s-i);let d;d=l===e.height?e.top+e.height/2:l>0?i+l/2:e.top+e.height/2;const c=d-t.top,u=n.current;let h=228;if(u){const e=u.getBoundingClientRect(),t=window.getComputedStyle(u),n=parseInt(t.paddingBottom,10)||0,r=parseInt(t.borderBottomWidth,10)||0;h=e.height-n-r+11}const g=12,f=Math.max(g,Math.min(h,c));r=Object.assign({position:"absolute",width:"12px",height:"12px",backgroundColor:m,transform:"rotate(45deg)",transformOrigin:"center",top:f-6+"px",borderRight:""+(t.isSunday?`1px solid ${v}`:"none"),borderTop:""+(t.isSunday?`1px solid ${v}`:"none"),borderLeft:""+(t.isSunday?"none":`1px solid ${v}`),borderBottom:""+(t.isSunday?"none":`1px solid ${v}`)},t.isSunday?{right:"-6px"}:{left:"-6px"})}}return r})(),p=l("div",{ref:n,className:"fixed bg-white dark:bg-gray-800 shadow-lg border border-gray-200 dark:border-gray-700 rounded-lg p-3","data-event-detail-panel":"true",style:{top:`${t.top}px`,left:`${t.left}px`,zIndex:9999,pointerEvents:"auto",backgroundColor:"dark"===f?"#1f2937":"#ffffff"},children:[d("div",{style:y}),d(h,{event:e,isAllDay:r,onEventUpdate:s,onEventDelete:c,onClose:u})]});return k.createPortal(p,document.body)},pg=({event:e,layout:t,isAllDay:i=!1,allDayHeight:s=28,calendarRef:u,isBeingDragged:h=!1,isBeingResized:g=!1,isDayView:f=!1,isMonthView:m=!1,isMultiDay:v=!1,segment:y,segmentIndex:p=0,hourHeight:b,firstHour:D,selectedEventId:w,detailPanelEventId:x,onMoveStart:E,onResizeStart:C,onEventUpdate:T,onEventDelete:N,newlyCreatedEventId:I,onDetailPanelOpen:S,onEventSelect:H,onDetailPanelToggle:O,customDetailPanelContent:R,customEventDetailDialog:P,multiDaySegmentInfo:$})=>{const[j,Y]=n(!1),A=v&&y?`${e.id}::${y.id}`:void 0!==(null==$?void 0:$.dayIndex)?`${e.id}::day-${$.dayIndex}`:e.id,L=x===A,[Z,F]=n(null),[z,V]=n("visible"),B=o(null),W=o(null),U=o(null),q=o(null),_=void 0!==w?w===e.id:j,X=e=>{if(!u.current)return null;const t=u.current.getBoundingClientRect();if(m){const n=t.width/7,r=e-t.left,a=Math.floor(r/n);return Number.isFinite(a)?Math.max(0,Math.min(6,a)):null}const n=f?1:7,r=(t.width-80)/n,a=e-t.left-80,o=Math.floor(a/r);return Number.isFinite(o)?Math.max(0,Math.min(n-1,o)):null},G=e=>{if(!u.current)return null;const t=u.current.getBoundingClientRect();if(m){const n=t.width/7;return{left:t.left+e*n,width:n}}if(f){const e=t.width-80;return{left:t.left+80,width:e}}const n=(t.width-80)/7;return{left:t.left+80+e*n,width:n}},J=e=>{q.current=e},K=()=>{var t;if(null!==q.current)return q.current;if(x===A){const e=A.split("::"),t=e[e.length-1];if(t.startsWith("day-")){const e=Number(t.replace("day-",""));if(!Number.isNaN(e))return e}}return void 0!==(null==$?void 0:$.dayIndex)?$.dayIndex:y?y.startDayIndex:null!==(t=e.day)&&void 0!==t?t:0},Q=r(()=>{if(!U.current||!u.current||!W.current)return;const t=u.current.getBoundingClientRect(),n=K(),r=G(n);let a,o;if(r)a=r.left,o=r.width;else if(m)o=t.width/7,a=t.left+n*o;else{const e=80;o=(t.width-e)/7,a=t.left+e+n*o}const i=Math.min(window.innerWidth,t.right),s=Math.min(window.innerHeight,t.bottom);requestAnimationFrame(()=>{var r,o,l,d,c;if(!W.current)return;if(!U.current)return;const h=W.current.getBoundingClientRect(),g=h.width,p=h.height;let w,x,E;if("sticky-top"===z||"sticky-bottom"===z){const t=null===(r=u.current)||void 0===r?void 0:r.querySelector(".calendar-content");if(!t)return;const n=$?$.startHour:Mu(e.start),a=$?$.endHour:Au(e),i=(n-D)*b,s=Math.max((a-n)*b,b/4),l=t.getBoundingClientRect(),d=t.scrollTop,c=l.top+i-d,h=null===(o=B.current)||void 0===o?void 0:o.getBoundingClientRect();if(!h)return;E={top:c,bottom:c+s,left:h.left,right:h.right,width:h.width,height:s,x:h.x,y:c,toJSON:()=>({})}}else E=U.current.getBoundingClientRect();if(m&&v&&y){const e=G(n),r=null!==(l=null==e?void 0:e.width)&&void 0!==l?l:t.width/7,a=null!==(d=null==e?void 0:e.left)&&void 0!==d?d:t.left+n*r,o=a+r;E={top:E.top,bottom:E.bottom,left:a,right:o,width:o-a,height:E.height,x:a,y:E.top,toJSON:()=>({})}}if(("sticky-top"===z||"sticky-bottom"===z)&&!m){const e=null!==(c=null==$?void 0:$.dayIndex)&&void 0!==c?c:K(),n=80,r=f?1:7,a=(t.width-n)/r,o=G(e),i=o?o.left:t.left+n+e*a,s=o?o.width:a,l=Math.max(0,f?E.width:s-3),d=f?E.left:i;E=Object.assign(Object.assign({},E),{left:d,right:d+l,width:l})}const M=i-E.right,C=E.left-t.left;w=M>=g+20?E.right+10:C>=g+20?E.left-g-10:M>C?Math.max(t.left+10,i-g-10):t.left+10;const k=E.top-p/2+E.height/2,T=Math.max(10,t.top+10),N=s-10;x=k<T?T:k+p>N?N-p:k,F(e=>e?Object.assign(Object.assign({},e),{top:x,left:w,isSunday:w<a}):null)})},[u,e.day,e.start,e.end,z,m,D,b,v,null==y?void 0:y.startDayIndex,null==y?void 0:y.endDayIndex,null==$?void 0:$.dayIndex,x,A]),ee=r(()=>{if(!j||!L||!B.current||!u.current||i||m)return;const t=u.current.querySelector(".calendar-content");if(!t)return;const n=$?$.startHour:Mu(e.start),r=$?$.endHour:Au(e),a=(n-D)*b,o=a+Math.max((r-n)*b,b/4),s=t.getBoundingClientRect(),l=t.scrollTop;let d=o<l+6,c=a>l+s.height-6;const h=s.bottom<0,g=s.top>window.innerHeight;h?d=!0:g&&(c=!0),V(d?"sticky-top":c?"sticky-bottom":"visible"),Q()},[j,L,u,i,m,Mu(e.start),Au(e),D,b,Q,null==$?void 0:$.startHour,null==$?void 0:$.endHour,null==$?void 0:$.dayIndex,x,A]);a(()=>{var e,t;if(!j||!L||i)return;const n=null===(e=u.current)||void 0===e?void 0:e.querySelector(".calendar-content");if(!n)return;const r=()=>ee(),a=()=>{ee(),Q()},o=[n];let s=null===(t=u.current)||void 0===t?void 0:t.parentElement;for(;s;){const e=window.getComputedStyle(s),t=e.overflowY,n=e.overflowX;"auto"!==t&&"scroll"!==t&&"auto"!==n&&"scroll"!==n||o.push(s),s=s.parentElement}return o.forEach(e=>{e.addEventListener("scroll",r)}),window.addEventListener("scroll",r,!0),window.addEventListener("resize",a),ee(),()=>{o.forEach(e=>{e.removeEventListener("scroll",r)}),window.removeEventListener("scroll",r,!0),window.removeEventListener("resize",a)}},[j,L,i,ee,Q,u,z]),a(()=>{if(!_&&!L)return;const e=e=>{var t,n;const r=e.target,a=null===(t=B.current)||void 0===t?void 0:t.contains(r),o=null===(n=W.current)||void 0===n?void 0:n.contains(r),i=r.closest("[data-event-detail-dialog]"),s=r.closest("[data-rangepicker-popup]");L?a||o||i||s||(H&&H(null),J(null),Y(!1),null==O||O(null)):_&&!a&&(H&&H(null),J(null),Y(!1),null==O||O(null))};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[_,L,H,O]),a(()=>{v&&y&&!y.isFirstSegment||I!==e.id||L||setTimeout(()=>{var t,n;if(B.current){let r=B.current;if(v){const e=B.current.querySelector("div");e&&(r=e)}v?y?J(y.startDayIndex):void 0!==(null==$?void 0:$.dayIndex)?J($.dayIndex):J(null!==(t=e.day)&&void 0!==t?t:null):J(null!==(n=e.day)&&void 0!==n?n:null),U.current=r,Y(!0),null==O||O(A),F({top:-9999,left:-9999,eventHeight:0,eventMiddleY:0,isSunday:!1}),requestAnimationFrame(()=>{Q()})}null==S||S()},150)},[I,e.id,L,S,Q,v,y,O,A]);const te=()=>y?d(mg,{segment:y,segmentIndex:null!=p?p:0,isDragging:h||_,isResizing:g,isSelected:_,onMoveStart:E||(()=>{}),onResizeStart:C}):null,le=()=>{if(v&&y){const{segmentType:e}=y;if("single"===e||"start"===e)return re;if("start-week-end"===e)return"rounded-l-xl rounded-r-none my-0.5";if("end"===e||"end-week-start"===e)return"rounded-r-xl rounded-l-none my-0.5";if("middle"===e)return"rounded-none my-0.5"}return re},de=e.calendarId||"blue";return l(c,{children:[d("div",{ref:B,"data-event-id":e.id,className:m?`\n ${ne}\n ${i?le():"rounded-sm"}\n `:`\n ${ne}\n shadow-sm\n ${i?le():"rounded-sm"}\n `,style:Object.assign(Object.assign({},(()=>{var n,r,a,o,l,d;if(m)return{opacity:h?.3:1,zIndex:_||L?1e3:1};if(i){const e={height:s-4+"px",opacity:h?.3:1,zIndex:_||L?1e3:1},t=p*s;if(Object.assign(e,{top:`${t}px`}),f)Object.assign(e,{width:"100%",left:"0px",right:"2px"});else if(v&&y){const t=(y.endDayIndex-y.startDayIndex+1)/7*100,n=y.startDayIndex/7*100,r=2,a=y.isFirstSegment?r:0,o=a+(y.isLastSegment?r:0);Object.assign(e,{width:o>0?`calc(${t}% - ${o}px)`:`${t}%`,left:a>0?`calc(${n}% + ${a}px)`:`${n}%`,position:"absolute",pointerEvents:"auto"})}else Object.assign(e,{width:"calc(100% - 3px)",left:"0px",position:"relative"});return e}const c=$?$.startHour:Mu(e.start),g=$?$.endHour:Au(e),w={top:`${(c-D)*b+3}px`,height:Math.max((g-c)*b,b/4)-4+"px",position:"absolute",opacity:h?.3:1,zIndex:_||L?1e3:null!==(n=null==t?void 0:t.zIndex)&&void 0!==n?n:1};if(_&&L&&("sticky-top"===z||"sticky-bottom"===z)){const e=null===(r=u.current)||void 0===r?void 0:r.getBoundingClientRect();if(e){const t=null!==(a=null==$?void 0:$.dayIndex)&&void 0!==a?a:K(),n=80,r=f?1:7;let i=(e.width-n)/r,s=e.left+n+t*i;m&&(i=e.width/7,s=e.left+t*i);const c=G(t);c&&(s=c.left,i=c.width);let h=null===(o=u.current)||void 0===o?void 0:o.querySelector(".calendar-content");h||(h=null===(l=u.current)||void 0===l?void 0:l.querySelector(".calendar-renderer"));const g=null==h?void 0:h.getBoundingClientRect(),v=null===(d=B.current)||void 0===d?void 0:d.getBoundingClientRect(),y=null==v?void 0:v.left,p=null==v?void 0:v.width;if("sticky-top"===z){let t=g?g.top:e.top;return t=Math.max(t,0),t=Math.max(t,e.top),t=Math.min(t,e.bottom-6),t=Math.min(t,window.innerHeight-6),{position:"fixed",top:`${t}px`,left:`${f?y:s}px`,width:`${f?p:i-3}px`,height:"6px",zIndex:1e3,overflow:"hidden"}}let b=g?g.bottom:e.bottom;return b=Math.min(b,window.innerHeight),b=Math.min(b,e.bottom),b=Math.max(b,e.top+6),b=Math.max(b,6),{position:"fixed",top:b-6+"px",left:`${f?y:s}px`,width:`${f?p:i-3}px`,height:"6px",zIndex:1e3,overflow:"hidden"}}}return t&&!i?Object.assign(Object.assign({},w),{left:`${t.left}%`,width:t.width-1+"%",right:"auto"}):Object.assign(Object.assign({},w),{left:"0px",right:"3px"})})()),_?{backgroundColor:Ou(de),color:"#fff"}:{backgroundColor:Su(de),color:Hu(de)}),onClick:t=>{var n,r;if(t.preventDefault(),t.stopPropagation(),v)if(y){const e=X(t.clientX);if(null!==e){const t=Math.min(Math.max(e,y.startDayIndex),y.endDayIndex);J(t)}else J(y.startDayIndex)}else void 0!==(null==$?void 0:$.dayIndex)?J($.dayIndex):J(null!==(n=e.day)&&void 0!==n?n:null);else J(null!==(r=e.day)&&void 0!==r?r:null);H?H(e.id):Y(!0),null==O||O(null),F(null)},onDoubleClick:t=>{var n,r;t.preventDefault(),t.stopPropagation();let a=t.currentTarget;if(v){const e=a.querySelector("div");e&&(a=e)}if(U.current=a,v)if(y){const e=X(t.clientX);if(null!==e){const t=Math.min(Math.max(e,y.startDayIndex),y.endDayIndex);J(t)}else J(y.startDayIndex)}else void 0!==(null==$?void 0:$.dayIndex)?J($.dayIndex):J(null!==(n=e.day)&&void 0!==n?n:null);else J(null!==(r=e.day)&&void 0!==r?r:null);new Promise(t=>{if(!u.current||i||m)return void t();const n=u.current.querySelector(".calendar-content");if(!n)return void t();const r=$?$.startHour:Mu(e.start),a=$?$.endHour:Au(e),o=(r-D)*b,s=o+Math.max((a-r)*b,b/4),l=n.scrollTop,d=n.clientHeight;if(o>=l&&s<=l+d)return void t();const c=((r+a)/2-D)*b-d/2,h=n.scrollHeight-d,g=Math.max(0,Math.min(h,c));n.scrollTo({top:g,behavior:"smooth"}),setTimeout(()=>{t()},300)}).then(()=>{Y(!0),null==O||O(A),F({top:-9999,left:-9999,eventHeight:0,eventMiddleY:0,isSunday:!1}),requestAnimationFrame(()=>{Q()})})},onMouseDown:E?t=>{var n;if($){const r=Object.assign(Object.assign({},e),{day:null!==(n=$.dayIndex)&&void 0!==n?n:e.day,_segmentInfo:$});E(t,r)}else E(t,e)}:void 0,children:m?v&&y?te():e.allDay?v?te():l("div",{className:"text-xs px-1 mb-0.5 rounded truncate cursor-pointer flex items-center",children:[e.title.toLowerCase().includes("easter")||e.title.toLowerCase().includes("holiday")?d("span",{className:`inline-block ${be} flex-shrink-0 ${_?"text-yellow-200":"text-yellow-600"}`,children:"⭐"}):d(M,{className:`${ie} ${_?"text-white":""}`}),d("span",{className:"truncate "+(_?"text-white":""),children:e.title})]}):(()=>{const t=`${Math.floor(Mu(e.start)).toString().padStart(2,"0")}:${Math.round(Mu(e.start)%1*60).toString().padStart(2,"0")}`;return l("div",{className:"text-xs mb-0.5 cursor-pointer flex items-center justify-between",children:[l("div",{className:"flex items-center flex-1 min-w-0",children:[d("span",{style:{backgroundColor:Ru(e.calendarId||"blue")},className:`inline-block w-[3px] h-3 ${be} flex-shrink-0 rounded-full`}),d("span",{className:"truncate "+(_?"text-white":""),children:e.title})]}),d("span",{className:`${ve} ml-1 flex-shrink-0 ${_?"text-white":""}`,style:_?void 0:{opacity:.8},children:t})]})})():e.allDay?l("div",{className:"h-full flex items-center overflow-hidden pl-3 px-1 py-0 relative group",children:[C&&d("div",{className:"resize-handle absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize opacity-0 group-hover:opacity-100 transition-opacity z-20",onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),C(t,e,"left")},onClick:e=>{e.preventDefault(),e.stopPropagation()}}),d(M,{className:ie}),d("div",{className:`${ae} pr-1`,style:{lineHeight:"1.2"},children:e.title}),C&&d("div",{className:se,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),C(t,e,"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}})]}):(()=>{const t=$?$.startHour:Mu(e.start),n=$?$.endHour:Au(e),r=n-t,a=!$||$.isFirst,o=!$||$.isLast;return l(c,{children:[d("div",{className:oe,style:{backgroundColor:Ru(e.calendarId||"blue")}}),l("div",{className:"h-full flex flex-col overflow-hidden pl-3 "+(Au(e)-Mu(e.start)<=.25?"px-1 py-0":"p-1"),children:[d("div",{className:`${ae} pr-1`,style:{lineHeight:r<=.25?"1.2":"normal"},children:e.title}),r>.5&&d("div",{className:"text-xs opacity-80 truncate",children:$?`${$u(t)} - ${$u(n)}`:ju(e)})]}),C&&l(c,{children:[a&&d("div",{className:"absolute top-0 left-0 w-full h-1.5 cursor-ns-resize z-10 rounded-t-sm",onMouseDown:t=>C(t,e,"top")}),o&&d("div",{className:"absolute bottom-0 left-0 w-full h-1.5 cursor-ns-resize z-10 rounded-b-sm",onMouseDown:t=>C(t,e,"bottom")}),!a&&o&&$&&d("div",{className:se,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),C(t,e,"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}})]})]})})()}),L&&d("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:9998,pointerEvents:"none"}}),(()=>{if(!L)return null;const t=()=>{H&&H(null),J(null),Y(!1),null==O||O(null)};if(P){const n=P,r={event:e,isOpen:L,isAllDay:i,onEventUpdate:T,onEventDelete:N,onClose:t};if("undefined"==typeof window||"undefined"==typeof document)return null;const a=document.body;return a?k.createPortal(d(n,Object.assign({},r)),a):null}return Z?R?d(yg,{event:e,position:Z,panelRef:W,isAllDay:i,eventVisibility:z,calendarRef:u,selectedEventElementRef:U,onEventUpdate:T,onEventDelete:N,onClose:t,contentRenderer:R}):d(vg,{event:e,position:Z,panelRef:W,isAllDay:i,eventVisibility:z,calendarRef:u,selectedEventElementRef:U,onEventUpdate:T,onEventDelete:N,onClose:t}):null})()]})};function bg(e){return Object.assign(Object.assign({},e),{parentId:void 0,children:[],_startHour:e.allDay?0:Mu(e.start),_endHour:e.allDay?0:Au(e)})}function Dg(e){var t;return null!==(t=e._startHour)&&void 0!==t?t:Mu(e.start)}function wg(e){var t;return null!==(t=e._endHour)&&void 0!==t?t:Au(e)}const xg=.25,Eg=.5,Mg=25,Cg=1,kg=.9;class Tg{static getIndentStepPercent(e){return"day"===e?.5:2.5}static calculateDayEventLayouts(e,t={}){const n=e.map(bg);this.clearAllParentChildRelations(n);const r=new Map,a=n.filter(e=>!e.allDay);if(0===a.length)return r;const o=this.groupOverlappingEvents(a);for(let e=0;e<o.length;e++){const n=o[e];1===n.length?this.setSingleEventLayout(n[0],r):this.calculateComplexGroupLayout(n,r,t)}return r}static clearAllParentChildRelations(e){for(const t of e)t.parentId=void 0,t.children=[]}static setParentChildRelation(e,t){t.parentId=e.id,e.children.includes(t.id)||e.children.push(t.id)}static eventsOverlap(e,t){return e.day===t.day&&!e.allDay&&!t.allDay&&(Dg(e)<wg(t)&&Dg(t)<wg(e))}static groupOverlappingEvents(e){const t=[],n=new Set;for(const r of e){if(n.has(r.id))continue;const a=[r],o=[r];for(n.add(r.id);o.length>0;){const t=o.shift();for(const r of e)n.has(r.id)||this.eventsOverlap(t,r)&&(a.push(r),o.push(r),n.add(r.id))}t.push(a)}return t}static setSingleEventLayout(e,t){t.set(e.id,{id:e.id,left:0,width:100-kg,zIndex:0,level:0,isPrimary:!0,indentOffset:0,importance:1})}static calculateComplexGroupLayout(e,t,n={}){const r=[...e].sort((e,t)=>{const n=Dg(e),r=Dg(t);if(n!==r)return n-r;return wg(t)-Dg(t)-(wg(e)-Dg(e))}),a=this.analyzeParallelGroups(r),o=this.buildNestedStructure(a,e);this.calculateLayoutFromStructure(o,t,n)}static analyzeParallelGroups(e){const t=[],n=new Set;for(const r of e){if(n.has(r.id))continue;const a=[r];n.add(r.id);for(const t of e){if(n.has(t.id))continue;Math.abs(Dg(r)-Dg(t))<=xg&&(a.push(t),n.add(t.id))}a.sort((e,t)=>Dg(e)-Dg(t));const o={events:a,startHour:Math.min(...a.map(e=>Dg(e))),endHour:Math.max(...a.map(e=>wg(e)))};t.push(o)}return t.sort((e,t)=>e.startHour-t.startHour),t}static shouldBeParallel(e,t){if(!this.eventsOverlap(e,t))return!1;const n=Math.abs(Dg(e)-Dg(t));if(n<=xg)return!0;if(n>xg&&n<Eg)return!0;return!!this.checkExtendedEventParallel(e,t)}static checkExtendedEventParallel(e,t){return!!this.eventsOverlap(e,t)&&(!!this.isExtendedEventParallel(e,t)||!!this.isExtendedEventParallel(t,e))}static isExtendedEventParallel(e,t){const n=wg(e)-Dg(e);if(n<1.25)return!1;const r=Dg(e)+.4*n,a=Dg(t)>=r,o=this.eventsOverlap(e,t);return a&&o}static buildNestedStructure(e,t){const n=[],r=new Map,a=new Map;t.forEach(e=>a.set(e.id,e));for(const t of e)for(const e of t.events){const t={event:a.get(e.id),children:[],parent:null,depth:0,isProcessed:!1};n.push(t),r.set(e.id,t)}for(let n=0;n<e.length;n++){const o=e[n],i=o.events.map(e=>a.get(e.id));let s=!1;for(let l=n-1;l>=0&&!s;l--){const n=e[l],d=n.events.map(e=>a.get(e.id)),c={events:d,startHour:n.startHour,endHour:n.endHour};if(this.canGroupContain(c,{events:i,startHour:o.startHour,endHour:o.endHour})){const e=this.optimizeChildAssignments(i,c,t);for(const t of e){const e=r.get(t.child.id),n=r.get(t.parent.id);e.parent=n,e.depth=n.depth+1,n.children.push(e)}s=!0}}}const o=n.filter(e=>null===e.parent);return o.forEach(e=>{e.depth=0}),this.rebalanceLoadByGroups(e,n),o}static findAlternateBranchRoot(e,t,n){const r=n.get(e.id);if(!r)return null;let a=r;for(;a.parent&&a.depth>1;)a=a.parent;if(1!==a.depth)return null;const o=a.parent;if(!o)return null;const i=o.children.filter(e=>1===e.depth&&e.event.id!==a.event.id);let s=1/0,l=null;for(const e of i){const t=this.calculateBranchLoad(e);t<s&&(s=t,l=e)}return l?l.event:null}static calculateBranchLoad(e){let t=0;function n(e){t++;for(const t of e.children)n(t)}for(const t of e.children)n(t);return t}static canGroupContain(e,t){const n=t.startHour-e.startHour;if(this.checkLoadBalanceParallel(e,t))return!1;if(n<Eg)return!1;let r=!1;for(const n of e.events){for(const e of t.events)if(this.canEventContain(n,e)){r=!0;break}if(r)break}return r}static checkLoadBalanceParallel(e,t){for(const n of e.events)for(const e of t.events){if(!this.eventsOverlap(n,e))continue;const t=Math.abs(Dg(e)-Dg(n));if(t<=xg)return!0;if(t>xg&&t<Eg)return!0}return!1}static canEventContain(e,t){const n=Dg(e)<=Dg(t)&&wg(e)>=wg(t),r=Dg(e)<=Dg(t)&&Dg(t)<wg(e)&&this.eventsOverlap(e,t);return n||r}static optimizeChildAssignments(e,t,n){const r=[];if(1===e.length){const a=this.findBestParentInGroup(e[0],t,n);return a&&(r.push({child:e[0],parent:a}),this.setParentChildRelation(a,e[0])),r}if(1===t.events.length){const n=t.events[0];for(const t of e)this.canEventContain(n,t)&&(r.push({child:t,parent:n}),this.setParentChildRelation(n,t));return r}const a=t.events.filter(t=>e.every(e=>this.canEventContain(t,e)));if(0===a.length){for(const a of e){const o=this.findBestParentInGroup(a,t,n);if(o)r.push({child:a,parent:o}),this.setParentChildRelation(o,a);else{const t=e.find(e=>e.id!==a.id&&this.eventsOverlap(e,a));if(t){const e=this.buildTempNodeMap(n),o=this.findAlternateBranchRoot(t,Array.from(e.values()),e);o&&(r.push({child:a,parent:o}),this.setParentChildRelation(o,a))}}}return r}const o=[...e].sort((e,t)=>{const n=wg(e)-Dg(e);return wg(t)-Dg(t)-n});if(o.length%a.length===0){const e=o.length/a.length;for(let t=0;t<a.length;t++){const n=a[t],i=o.slice(t*e,(t+1)*e);for(const e of i)r.push({child:e,parent:n}),this.setParentChildRelation(n,e)}return r}for(let e=0;e<o.length;e++){const t=o[e],n=this.findParentWithMinLoadFromEvents(t,a,o);n&&(r.push({child:t,parent:n}),this.setParentChildRelation(n,t))}return r}static buildTempNodeMap(e){const t=new Map;for(const n of e){const e={event:n,children:[],parent:null,depth:0,isProcessed:!1};t.set(n.id,e)}for(const n of e)if(n.parentId){const e=t.get(n.id),r=t.get(n.parentId);e&&r&&(e.parent=r,e.depth=r.depth+1,r.children.push(e))}return t}static findParentWithMinLoadFromEvents(e,t,n){if(0===t.length)return null;let r=1/0,a=[];for(const e of t){const t=e.children.length;t<r?(r=t,a=[e]):t===r&&a.push(e)}const o=a.map(e=>e.children).flat(),i=wg(e)-Dg(e),s=i>Math.max(...o.map(e=>{const t=n.find(t=>t.id===e);return t?wg(t)-Dg(t):0}));n.every(e=>wg(e)-Dg(e)===i);return s?a[0]:a[a.length-1]}static findBestParentInGroup(e,t,n){const r=t.events.filter(t=>this.canEventContain(t,e));if(0===r.length)return null;if(1===r.length)return r[0];const a=r.map(e=>({parent:e,load:e.children.length,hasParallelSibling:!1}));for(const t of a)for(const r of t.parent.children){const a=n.find(e=>e.id===r);if(a&&this.shouldBeParallel(e,a)){t.hasParallelSibling=!0;break}}a.sort((t,n)=>{if(t.load!==n.load)return t.load-n.load;if(t.hasParallelSibling!==n.hasParallelSibling)return t.hasParallelSibling?-1:1;if(t.load!==n.load)return t.load-n.load;return Math.abs(Dg(e)-Dg(t.parent))-Math.abs(Dg(e)-Dg(n.parent))});return a[0].parent}static calculateLayoutFromStructure(e,t,n={}){const r=100-kg;if(1===e.length)this.calculateNodeLayoutWithVirtualParallel(e[0],0,r,t,n);else{const a=e.length,o=(r-Cg*(a-1))/a;e.forEach((e,r)=>{const a=r*(o+Cg);this.calculateNodeLayoutWithVirtualParallel(e,a,Math.max(o,Mg),t,n)})}}static calculateNodeLayoutWithVirtualParallel(e,t,n,r,a={}){let o=e.depth*this.getIndentStepPercent(a.viewType);if(e.isProcessed){const t=this.findBranchRootIndent(e,a.viewType);null!==t&&(o=t)}let i=0;const s="day"===a.viewType;1===e.depth?i=s?.5:1.5:2===e.depth?i=s?-.01:-1:e.depth>=3&&(i=s?.55:-3.5);const l=t+o+i;let d=n-(o+i);if(l+d>t+n&&(d=t+n-l,console.warn(`⚠️ ${e.event.title}'s width exceeds parent event range, adjusted to: ${d.toFixed(1)}%`)),r.set(e.event.id,{id:e.event.id,left:l,width:d,zIndex:e.depth,level:e.depth,isPrimary:0===e.depth,indentOffset:o*(a.containerWidth||320)/100,importance:this.calculateEventImportance(e.event)}),0===e.children.length)return;const c=[...e.children].sort((e,t)=>{const n=wg(e.event)-Dg(e.event);return wg(t.event)-Dg(t.event)-n});if(1===c.length)this.calculateNodeLayoutWithVirtualParallel(c[0],l,d,r,a);else{const e=this.shouldChildrenBeParallel(c.map(e=>e.event));e?this.calculateParallelChildrenLayout(c,l,d,r,a):c.forEach(e=>{this.calculateNodeLayoutWithVirtualParallel(e,l,d,r,a)})}}static calculateParallelChildrenLayout(e,t,n,r,a={}){const o=e.length,i=e[0].depth,s=i*this.getIndentStepPercent(a.viewType);let l;const d="day"===a.viewType;l=1===i?d?.5:1.5:2===i?d?-.01:-1:d?.55:-3.5;const c=t+s+l,u=n-(s+l);if(u<=0)return void e.forEach(e=>{this.calculateNodeLayoutWithVirtualParallel(e,t,n,r,a)});let h;h=1===i?Cg*(d?.15:.3):Cg*(d?.1:.2);const g=(u-h*(o-1))/o;e.forEach((e,t)=>{const n=c+t*(g+h);if(r.set(e.event.id,{id:e.event.id,left:n,width:g,zIndex:e.depth,level:e.depth,isPrimary:0===e.depth,indentOffset:s*(a.containerWidth||320)/100,importance:this.calculateEventImportance(e.event)}),e.children.length>0){const t=[...e.children].sort((e,t)=>{const n=wg(e.event)-Dg(e.event);return wg(t.event)-Dg(t.event)-n});if(1===t.length)this.calculateNodeLayoutWithVirtualParallel(t[0],n,g,r,a);else{const e=this.shouldChildrenBeParallel(t.map(e=>e.event));e?this.calculateParallelChildrenLayout(t,n,g,r,a):t.forEach(e=>{this.calculateNodeLayoutWithVirtualParallel(e,n,g,r,a)})}}})}static findBranchRootIndent(e,t){let n=e;for(;n.parent&&n.parent.depth>0;)n=n.parent;if(1===n.depth){return n.depth*this.getIndentStepPercent(t)}return null}static shouldChildrenBeParallel(e){if(e.length<2)return!1;for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++)if(this.shouldBeParallel(e[t],e[n]))return!0;return!1}static calculateEventImportance(e){const t=wg(e)-Dg(e);return Math.max(.1,Math.min(1,t/4))}static countDescendants(e){let t=0;for(const n of e.children)t+=1+this.countDescendants(n);return t}static findTransferableLeaf(e,t){const n=[];return this.collectLeaves(e,n),n.find(e=>this.canEventContain(t.event,e.event))||n[0]}static collectLeaves(e,t){0===e.children.length?t.push(e):e.children.forEach(e=>this.collectLeaves(e,t))}static transferNode(e,t){e.parent&&(e.parent.children=e.parent.children.filter(t=>t!==e));const n=t.children;let r=null;for(const t of n){if(this.shouldBeParallel(e.event,t.event))break;if(this.canEventContain(t.event,e.event)){r=t;break}}r?(e.parent=r,e.depth=r.depth+1,r.children.push(e),this.setParentChildRelation(r.event,e.event)):(e.parent=t,e.depth=t.depth+1,t.children.push(e),this.setParentChildRelation(t.event,e.event))}static calculateParentLoads(e,t){var n,r;const a=[],o=null===(r=null===(n=e[0])||void 0===n?void 0:n.parent)||void 0===r?void 0:r.depth;if(void 0===o)return a;const i=t.filter(e=>e.depth===o);for(const e of i){const t=this.countDescendants(e);a.push({node:e,load:t})}return a.sort((e,t)=>t.load-e.load),a}static needsRebalancing(e){if(e.length<2)return!1;return e[0].load-e[e.length-1].load>=2}static rebalanceGroupLoad(e){let t=0;for(;t<5;){e.sort((e,t)=>t.load-e.load);const n=e[0],r=e[e.length-1];if(n.load-r.load<2)break;const a=this.findTransferableLeaf(n.node,r.node);if(!a)break;this.transferNode(a,r.node),n.load--,r.load++,t++}}static rebalanceLoadByGroups(e,t){for(let n=e.length-1;n>=1;n--){const r=e[n].events.map(e=>t.find(t=>t.event.id===e.id)),a=this.calculateParentLoads(r,t);this.needsRebalancing(a)&&this.rebalanceGroupLoad(a)}}}const Ng={HOUR_HEIGHT:72,FIRST_HOUR:0,LAST_HOUR:24,MIN_DURATION:.25,TIME_COLUMN_WIDTH:80,ALL_DAY_HEIGHT:28,getLineColor:e=>Ru(e),getDynamicPadding:e=>e.endHour-e.startHour<=.25?"px-1 py-0":"p-1"};const Ig=e=>{const{viewType:a,onEventsUpdate:i}=e,s=a===N.MONTH,l=o({active:!1,mode:null,eventId:null,startX:0,startY:0,dayIndex:0,startHour:0,endHour:0,originalDay:0,originalStartHour:0,originalEndHour:0,resizeDirection:null,hourOffset:null,duration:0,lastRawMouseHour:null,lastUpdateTime:0,initialMouseY:0,lastClientY:0,allDay:!1,targetDate:null,originalDate:null,originalEvent:null,dragOffset:0,originalStartDate:null,originalEndDate:null,eventDate:void 0,originalStartTime:null,originalEndTime:null,sourceElement:null,indicatorVisible:!1}),d=o({x:0,y:0}),c=t(()=>s?{active:!1,mode:null,eventId:null,targetDate:null,startDate:null,endDate:null}:{active:!1,mode:null,eventId:null,dayIndex:0,startHour:0,endHour:0,allDay:!1},[s]),[u,h]=n(c),g=t(()=>function(e,t){let n=null,r=0;const a=function(...a){const o=Date.now(),i=t-(o-r);i<=0||i>t?(n&&(clearTimeout(n),n=null),r=o,e.apply(this,a)):n||(n=setTimeout(()=>{r=Date.now(),n=null,e.apply(this,a)},i))};return a.cancel=()=>{n&&(clearTimeout(n),n=null),r=0},a}((e,t)=>i(e,"resize"===t),s?16:8),[s,i]),f=r(()=>{h(s?{active:!1,mode:null,eventId:null,targetDate:null,startDate:null,endDate:null}:{active:!1,mode:null,eventId:null,dayIndex:0,startHour:0,endHour:0,allDay:!1}),l.current={active:!1,mode:null,eventId:null,startX:0,startY:0,dayIndex:0,startHour:0,endHour:0,originalDay:0,originalStartHour:0,originalEndHour:0,duration:0,resizeDirection:null,hourOffset:null,lastRawMouseHour:null,lastUpdateTime:0,initialMouseY:0,lastClientY:0,allDay:!1,targetDate:null,originalDate:null,originalEvent:null,dragOffset:0,originalStartDate:null,originalEndDate:null,eventDate:void 0,originalStartTime:null,originalEndTime:null,sourceElement:null,indicatorVisible:!1}},[s]);return{dragRef:l,currentDragRef:d,dragState:u,setDragState:h,resetDragState:f,throttledSetEvents:g}},Sg={renderAllDayContent:({title:e,color:t})=>l("div",{className:"h-full flex items-center overflow-hidden pl-3 pt-1",children:[d(M,{className:"h-3 w-3 mr-1 text-white"}),d("div",{className:"font-medium text-xs truncate pr-1 text-white",children:e})]}),renderRegularContent:({drag:e,title:t,layout:n,formatTime:r,getLineColor:a,getDynamicPadding:o,color:i})=>l(c,{children:[d("div",{className:oe,style:{backgroundColor:a(i||"blue")}}),l("div",{className:`h-full flex flex-col overflow-hidden pl-3 text-white ${o(e)}`,children:[d("div",{className:"font-medium text-xs truncate pr-1 text-white",style:{lineHeight:e.endHour-e.startHour<=.25?"1.2":"normal"},children:t}),!e.allDay&&e.endHour-e.startHour>.5&&l("div",{className:"text-xs truncate time-display text-white opacity-90",children:[r(e.startHour)," - ",r(e.endHour)]})]})]}),renderDefaultContent:({drag:e,title:t,allDay:n})=>n?l("div",{className:"h-full flex items-center overflow-hidden pl-3 px-1 py-0",children:[d("svg",{className:"h-3 w-3 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:d("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 002 2z"})}),d("div",{className:"font-medium text-xs truncate pr-1",style:{lineHeight:1.2},children:t})]}):l(c,{children:[d("div",{className:"absolute left-0.5 top-1 bottom-1 w-0.5 rounded-full bg-blue-600 dark:bg-blue-400"}),d("div",{className:"h-full flex flex-col overflow-hidden pl-3 p-1",children:d("div",{className:"font-medium text-xs truncate pr-1 text-blue-900 dark:text-blue-100",children:t})})]})},Hg=({drag:e,color:t,title:n,layout:r,allDay:a,formatTime:o,getLineColor:i,getDynamicPadding:s,renderer:l=Sg})=>{const c=n||(a?"New All-day Event":"New Event");return d("div",{className:"drag-indicator-content",children:t?a?l.renderAllDayContent({drag:e,color:t,title:c,layout:r,allDay:a,formatTime:o,getLineColor:i,getDynamicPadding:s}):l.renderRegularContent({drag:e,color:t,title:c,layout:r,allDay:a,formatTime:o,getLineColor:i,getDynamicPadding:s}):l.renderDefaultContent({drag:e,color:t,title:c,layout:r,allDay:a,formatTime:o,getLineColor:i,getDynamicPadding:s})})},Og=({event:e,isCreating:t,isMultiDay:n=!1,startDate:r,endDate:a})=>{const o=(()=>{if(t)return{title:"New Event",icon:d(C,{className:"h-3 w-3"}),showDateRange:!1};if(n&&r&&a){const t=Du(r,a)+1;return{title:e.title.replace(/ \(\d+天\)$/,""),showDateRange:!0,duration:t}}return{title:e.title,showDateRange:!1}})();return l("div",{className:"flex items-center space-x-2 text-white text-xs font-medium rounded-sm",children:[d("div",{className:"flex-shrink-0",children:o.icon}),d("div",{className:"flex-1 min-w-0",children:d("div",{className:"truncate font-medium",children:o.title})})]})},Rg=n=>{const a=t(()=>Object.assign(Object.assign({},Ng),n),[n]),{viewType:i}=a,s=i===N.MONTH,l=(e=>{const{calendarRef:n,allDayRowRef:a,viewType:o,HOUR_HEIGHT:i=72,FIRST_HOUR:s=0,LAST_HOUR:l=24,TIME_COLUMN_WIDTH:d=80}=e,c=o===N.MONTH,u=o===N.WEEK,h=r(e=>{if(c||!n.current)return s;const t=n.current.querySelector(".calendar-content");if(!t)return s;const r=t.getBoundingClientRect(),a=t.scrollTop,o=window.getComputedStyle(t),d=parseInt(o.paddingTop,10)||0,u=(e-r.top+a-d)/i+s;return Math.max(s,Math.min(l,u))},[n,s,i,l,c]),g=r(e=>{if(c||!n.current)return 0;const t=n.current.getBoundingClientRect(),r=(t.width-d)/(u?7:1),a=e-t.left-d,o=Math.floor(a/r);return Math.max(0,Math.min(u?6:0,o))},[n,d,c,u]),f=r(e=>{if(c||!n.current)return;const t=n.current.querySelector(".calendar-content");if(!t)return;const r=t.getBoundingClientRect();e<r.top?t.scrollTop+=e-r.top:e+40>r.bottom&&(t.scrollTop+=e+40-r.bottom)},[n,c]),m=r(e=>{if(c||!(null==a?void 0:a.current))return!1;const t=a.current.getBoundingClientRect();return e>=t.top&&e<=t.bottom},[a,c]),v=t(()=>864e5,[]);return{pixelYToHour:h,getColumnDayIndex:g,checkIfInAllDayArea:m,handleDirectScroll:f,daysDifference:r((e,t)=>Du(e,t),[]),addDaysToDate:r((e,t)=>wu(e,t),[]),getTargetDateFromPosition:r((e,t)=>{if(o!==N.MONTH||!n.current)return null;const r=document.elementFromPoint(e,t);if(!r)return null;let a=r,i=0;for(;a&&!a.hasAttribute("data-date")&&i<10;)a=a.parentElement,i++;if(a&&a.hasAttribute("data-date")){const e=a.getAttribute("data-date");if(e)return new Date(e+"T00:00:00")}return null},[n,o]),ONE_DAY_MS:v}})(a),d=Ig(a),c=(t=>{const{calendarRef:n,allDayRowRef:a,viewType:i,getLineColor:s,getDynamicPadding:l,renderer:d,HOUR_HEIGHT:c=72,FIRST_HOUR:u=0,TIME_COLUMN_WIDTH:h=80,ALL_DAY_HEIGHT:g=60}=t,f=i===N.MONTH,m=i===N.DAY,v=o(null),y=o(null),p=o(null),b=r(()=>{y.current&&(y.current.unmount(),y.current=null),v.current&&(v.current.remove(),v.current=null),p.current=null},[]),D=r((t,r,o,i,D)=>{var w,x,E,M,C,k,N,I,S;b();const H=document.createElement("div");if(H.style.position=f?"fixed":"absolute",H.style.pointerEvents="none",H.style.zIndex="1000",f){let n,a;if(H.style.opacity="0.9",D){const e=D.getBoundingClientRect(),r=null!==(x=null!==(w=t.currentSegmentDays)&&void 0!==w?w:t.eventDurationDays)&&void 0!==x?x:1;n=e.width/r,a=e.height,H.className=`rounded-sm shadow-sm ${D.className}`}else n=120,a=22,H.className="rounded text-xs px-2 py-1";H.style.width=`${n}px`,H.style.height=`${a}px`,H.style.left=t.startX-n/2+"px",H.style.top=t.startY-a/2+"px",document.body.appendChild(H),y.current=T(H);const i=cu(new Date),s=t.originalEvent||{id:String(Date.now()),color:r||"blue",title:o||"New Event",start:i,end:i,allDay:!1,day:0};y.current.render(e.createElement(Og,{event:s,isCreating:"create"===t.mode,targetDate:t.targetDate||null,startDate:t.originalStartDate||null,endDate:t.originalEndDate||null}))}else{if(D){const e=D.getBoundingClientRect();let r;if(r=t.allDay?null===(E=null==a?void 0:a.current)||void 0===E?void 0:E.getBoundingClientRect():null===(C=null===(M=n.current)||void 0===M?void 0:M.querySelector(".calendar-content"))||void 0===C?void 0:C.getBoundingClientRect(),r){if(t.allDay&&m)H.style.left=`${h}px`,H.style.top=D.offsetTop-2+"px",H.style.width=`calc(100% - ${h}px - 2px)`,H.style.height=`${e.height}px`;else if(t.allDay&&!m){const r=null===(k=n.current)||void 0===k?void 0:k.getBoundingClientRect();if(r){const n=(r.width-h)/7;H.style.left=`${h+t.dayIndex*n}px`,H.style.top=D.offsetTop-2+"px",H.style.width=n-2+"px",H.style.height=`${e.height}px`}}else{const n=(t.startHour-u)*c;H.style.left=e.left-r.left+"px",H.style.top=`${n+3}px`,H.style.width=`${e.width}px`,H.style.height=`${e.height}px`}H.className=D.className,H.style.opacity="0.8",H.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"}}else if(t.allDay){const e=m?"100%":`calc((100% - ${h}px) / 7)`;H.style.top="2px",H.style.height=g-4+"px",H.style.marginBottom="3px",m?(H.style.left=`${h}px`,H.style.width=`calc(100% - ${h}px - 2px)`):(H.style.left=`calc(${h}px + (${e} * ${t.dayIndex}))`,H.style.width=`calc(${e} - 2px)`),H.className="rounded-xl shadow-sm"}else{const e=(t.startHour-u)*c,n=(t.endHour-t.startHour)*c;if(H.style.top=`${e+3}px`,H.style.height=n-4+"px",H.style.color="#fff",H.className="rounded-sm shadow-sm",i){if(m)H.style.left=`${h}px`,H.style.width=`calc(100% - ${h}px)`;else{const e=`calc((100% - ${h}px) / 7)`;H.style.left=`calc(${h}px + (${e} * ${t.dayIndex}) + (${e} * ${i.left/100}))`,H.style.width=`calc((${e} * ${i.width/100}))`}H.style.zIndex=String(1e3)}else{const e=m?`calc(100% - ${h}px)`:`calc((100% - ${h}px) / 7)`;H.style.left=m?`${h}px`:`calc(${h}px + (${e} * ${t.dayIndex}))`,H.style.width=e}}t.allDay?null===(N=null==a?void 0:a.current)||void 0===N||N.appendChild(H):null===(S=null===(I=n.current)||void 0===I?void 0:I.querySelector(".calendar-content"))||void 0===S||S.appendChild(H),p.current={drag:t,color:r,title:o,layout:i},y.current=T(H),y.current.render(e.createElement(Hg,{drag:t,color:r,title:o,layout:i,allDay:t.allDay,formatTime:$u,getLineColor:s||(()=>""),getDynamicPadding:l||(()=>"0px"),renderer:d}))}r?(H.style.backgroundColor=Ou(r),H.style.color=Hu(r)):H.className+=" bg-blue-50/70 text-blue-900 border border-dashed border-blue-400",v.current=H},[b,f,m,a,n,$u,s,l,d,h,g,u,c]),w=r((...t)=>{var r,o;const i=v.current;if(i)if(f){const[e,n]=t,r=parseFloat(i.style.width)||120,a=parseFloat(i.style.height)||22;requestAnimationFrame(()=>{i.style.left=e-r/2+"px",i.style.top=n-a/2+"px",i.style.transition="none"})}else{const[f,v,b,D=!1,w]=t;if(D&&i.parentElement!==(null==a?void 0:a.current))null===(r=null==a?void 0:a.current)||void 0===r||r.appendChild(i);else if(!D){const e=null===(o=n.current)||void 0===o?void 0:o.querySelector(".calendar-content");i.parentElement!==e&&(null==e||e.appendChild(i))}if(D){if(m)i.style.left=`${h}px`,i.style.width=`calc(100% - ${h}px - 2px)`;else{const e=`calc((100% - ${h}px) / 7)`;i.style.left=`calc(${h}px + (${e} * ${f}))`,i.style.width=`calc(${e} - 2px)`,i.style.top="2px"}i.style.height=g-4+"px",i.style.marginBottom="3px",i.className=i.className.replace("rounded-sm","rounded-xl")}else{const e=(v-u)*c,t=(b-v)*c;if(i.style.top=`${e+3}px`,i.style.height=t-4+"px",i.style.marginBottom="0",i.className=i.className.replace("rounded-xl","rounded-sm"),w){if(m)i.style.left=`${h}px`,i.style.width=`calc(100% - ${h}px)`;else{const e=`calc((100% - ${h}px) / 7)`;i.style.left=`calc(${h}px + (${e} * ${f}) + (${e} * ${w.left/100}))`,i.style.width=`calc((${e} * ${w.width/100}))`}i.style.zIndex=String(w.zIndex+10)}else{const e=m?`calc(100% - ${h}px)`:`calc((100% - ${h}px) / 7)`;i.style.left=m?`${h}px`:`calc(${h}px + (${e} * ${f}))`,i.style.width=e}}if(i.style.cursor="grabbing",y.current&&p.current){const t=Object.assign(Object.assign({},p.current.drag),{dayIndex:f,startHour:v,endHour:b,allDay:D});p.current.drag=t,y.current.render(e.createElement(Hg,{drag:t,color:p.current.color,title:p.current.title,layout:w||p.current.layout,allDay:D,formatTime:$u,getLineColor:s||(()=>""),getDynamicPadding:l||(()=>"0px"),renderer:d}))}}},[f,a,$u,n,m,g,h,u,c,s,l,d]);return{dragIndicatorRef:v,reactRootRef:y,removeDragIndicator:b,createDragIndicator:D,updateDragIndicator:w}})(a),u=(e=>{const{options:t,common:n,state:a,manager:o}=e,{viewType:i,onEventsUpdate:s,onEventCreate:l,onEventEdit:d,calculateNewEventLayout:c,calculateDragLayout:u,currentWeekStart:h,events:g,FIRST_HOUR:f=0,LAST_HOUR:m=24,MIN_DURATION:v=.25}=t,{dragRef:y,currentDragRef:p,setDragState:b,resetDragState:D,throttledSetEvents:w}=a,{removeDragIndicator:x,createDragIndicator:E,updateDragIndicator:M}=o,{pixelYToHour:C,getColumnDayIndex:k,checkIfInAllDayArea:T,handleDirectScroll:I,daysDifference:S,addDaysToDate:H,getTargetDateFromPosition:O}=n,R=i===N.MONTH,P=i===N.DAY,$=864e5,j=(e,t,n=!1)=>{const r=new Date(e);r.setHours(0,0,0,0);const a=new Date(t);a.setHours(0,0,0,0);let o=Math.floor((a.getTime()-r.getTime())/$);if(o<=0)return 0;if(!n&&1===o){const n=0===t.getHours()&&0===t.getMinutes()&&0===t.getSeconds()&&0===t.getMilliseconds(),r=t.getTime()-e.getTime();if(n&&r<$)return 0}return o},Y=r(e=>{var t,n;e.preventDefault();const r=y.current;if(!r.active)return;"resize"===r.mode?r.allDay?document.body.style.cursor="ew-resize":document.body.style.cursor="ns-resize":document.body.style.cursor="grabbing";const a=T(e.clientY),o=P?r.dayIndex:k(e.clientX);if(a){if(!r.allDay){r.allDay=!0,r.startHour=0,r.endHour=0,r.eventDate=h?Ku(h,o):new Date,x(),r.indicatorVisible=!1;const e=null==g?void 0:g.find(e=>e.id===r.eventId);E(r,null==e?void 0:e.calendarId,null==e?void 0:e.title),r.sourceElement=null,r.indicatorVisible=!0}r.dayIndex=o,b(e=>Object.assign(Object.assign({},e),{dayIndex:o,startHour:0,endHour:0,allDay:!0})),M(o,0,0,!0)}else{I(e.clientY);const a=C(e.clientY);if(null!==(t=r.startDragDayIndex)&&void 0!==t||r.originalDay,r.dayIndex,r.allDay){r.allDay=!1,r.startHour=Yu(a),r.endHour=r.startHour+1,r.duration=1,r.hourOffset=0,r.eventDate=h?Ku(h,o):new Date,x(),r.indicatorVisible=!1;const e=null==g?void 0:g.find(e=>e.id===r.eventId);E(r,null==e?void 0:e.calendarId,null==e?void 0:e.title),r.sourceElement=null,r.indicatorVisible=!0}else{let e=Yu(a+(null!==(n=r.hourOffset)&&void 0!==n?n:0));e=Math.max(f,Math.min(m-r.duration,e)),r.startHour=e,r.endHour=e+r.duration}r.dayIndex=o,r.eventDate=h?Ku(h,o):new Date,b(e=>Object.assign(Object.assign({},e),{dayIndex:o,startHour:Yu(r.startHour),endHour:Yu(r.endHour),allDay:!1}));let i=null;if("move"===r.mode&&r.eventId&&u){const e=null==g?void 0:g.find(e=>e.id===r.eventId);e&&(i=u(e,o,Yu(r.startHour),Yu(r.endHour)))}M(o,Yu(r.startHour),Yu(r.endHour),!1,i)}},[u,T,E,h,g,f,k,I,m,P,C,x,M,y,b]),A=r(()=>{document.body.style.cursor="default";const e=y.current;if(!e.active||"move"!==e.mode||!e.eventId)return;let t=e.startHour,n=e.endHour;e.allDay||(t=Yu(e.startHour),n=Yu(e.endHour),n-t<v&&(n=t+v)),null==s||s(r=>r.map(r=>{var a,o;if(r.id!==e.eventId)return r;h?Ku(h,e.dayIndex):gu(r.start);const i=null!==(a=e.startDragDayIndex)&&void 0!==a?a:e.originalDay,s=e.dayIndex-i;let l,d;if(e.allDay){const t=e.originalStartDate?new Date(e.originalStartDate):gu(r.start);t.setHours(0,0,0,0);const n=new Date(t);n.setDate(n.getDate()+s);const a=new Date(n);e.eventDurationDays&&e.eventDurationDays>0&&a.setDate(a.getDate()+e.eventDurationDays),l=uu(n),d=uu(Tu(a))}else{const a=gu(r.start),i=gu(r.end);if(j(a,i,null!==(o=r.allDay)&&void 0!==o&&o)>0){const e=new Date(a);e.setDate(e.getDate()+s);const t=new Date(i);t.setDate(t.getDate()+s),l=cu(e),d=cu(t)}else{const r=h?Ku(h,e.dayIndex):new Date,a=Cu(r,t),o=Cu(r,n);l=cu(a),d=cu(o)}}const c=e.originalDay+s;return Object.assign(Object.assign({},r),{day:c,start:l,end:d,allDay:e.allDay})})),document.removeEventListener("mousemove",Y),document.removeEventListener("mouseup",A),x(),D()},[Y,x,D,s,v,h,y]),L=r(e=>{var t,n,r,a,o,i,s,l,d;e.preventDefault();const v=y.current;if(v.active)if("resize"===v.mode?R||v.allDay?document.body.style.cursor="ew-resize":document.body.style.cursor="ns-resize":document.body.style.cursor="grabbing",R){if("resize"!==v.mode){if("move"===v.mode){const r=Math.hypot(e.clientX-v.startX,e.clientY-v.startY);!v.indicatorVisible&&r>=3&&(E(v,null===(t=v.originalEvent)||void 0===t?void 0:t.calendarId,null===(n=v.originalEvent)||void 0===n?void 0:n.title,null,v.sourceElement||void 0),v.indicatorVisible=!0)}v.indicatorVisible&&M(e.clientX,e.clientY)}const o=O(e.clientX,e.clientY);if(!o)return;if("resize"===v.mode&&v.originalEvent&&v.resizeDirection){const e=gu(v.originalEvent.start);let t,n;const r=(e,t)=>{var n,r;e&&((null===(n=v.originalEvent)||void 0===n?void 0:n.allDay)?e.setHours(0,0,0,0):t&&e.setHours(t.hour,t.minute,null!==(r=t.second)&&void 0!==r?r:0,0))},a=v.originalStartTime,i=v.originalEndTime;if("left"===v.resizeDirection){t=new Date(o),r(t,a);const s=gu(v.originalEvent.end)||e;n=new Date(s),r(n,i),t>n&&(t=n)}else{const s=gu(v.originalEvent.start)||e;t=new Date(s),r(t,a),n=new Date(o),r(n,i),n<t&&(n=t)}v.originalStartDate=new Date(t.getTime()),v.originalEndDate=new Date(n.getTime());const s=v.originalEvent.allDay?uu(t):cu(t),l=v.originalEvent.allDay?uu(n):cu(n);w(e=>e.map(e=>e.id===v.eventId?Object.assign(Object.assign({},e),{start:s,end:l,title:e.title}):e),v.mode)}else if("move"===v.mode)if(v.originalStartDate&&v.originalEndDate){const e=S(v.originalStartDate,o),t=H(v.originalStartDate,e),n=H(v.originalEndDate,e);(null===(r=v.originalStartDate)||void 0===r?void 0:r.getTime())!==t.getTime()&&(v.originalStartDate=new Date(t.getTime()),v.originalEndDate=new Date(n.getTime()),v.targetDate=t)}else(null===(a=v.targetDate)||void 0===a?void 0:a.getTime())!==o.getTime()&&(v.targetDate=o)}else{I(e.clientY),v.lastClientY=e.clientY;const t=C(e.clientY);if("resize"===v.mode)if(v.allDay){const t=P?v.dayIndex:k(e.clientX);let n=v.originalStartDate||new Date,r=v.originalEndDate||new Date;"left"===v.resizeDirection?(n=h?Ku(h,t):new Date,n>r&&(n=r)):"right"===v.resizeDirection&&(r=h?Ku(h,t):new Date,r<n&&(r=n)),v.originalStartDate=new Date(n.getTime()),v.originalEndDate=new Date(r.getTime());const a=uu(n),o=uu(r);w(e=>e.map(e=>e.id!==v.eventId?e:Object.assign(Object.assign({},e),{start:a,end:o,allDay:!0})),v.mode)}else{let n=v.startHour,r=v.endHour;const a=null==g?void 0:g.find(e=>e.id===v.eventId);let d=v.dayIndex;if(a){const e=gu(a.start),t=gu(a.end),n=j(e,t,null!==(o=a.allDay)&&void 0!==o&&o);d=(null!==(i=a.day)&&void 0!==i?i:0)+n}let c=d,u=v.originalDay;if("top"===v.resizeDirection){const a=P?v.dayIndex:k(e.clientX),o=t+(null!==(s=null==v?void 0:v.hourOffset)&&void 0!==s?s:0);a<d?(u=a,n=Math.max(f,Math.min(m,o))):(u=d,o>v.originalEndHour?(n=v.originalEndHour,r=o,v.hourOffset=r-t):(n=Math.max(f,o),v.originalEndHour-n<Pu&&(n=v.originalEndHour-Pu)))}else if("bottom"===v.resizeDirection){const a=P?v.dayIndex:k(e.clientX),o=t+(null!==(l=null==v?void 0:v.hourOffset)&&void 0!==l?l:0);a!==v.dayIndex?(c=a,r=Math.max(f,Math.min(m,o))):o<v.originalStartHour?(r=v.originalStartHour,n=o,v.hourOffset=n-t):(r=Math.min(m,o),r-v.startHour<Pu&&(r=v.startHour+Pu))}else if("right"===v.resizeDirection){const t=P?v.dayIndex:k(e.clientX);c=Math.max(v.dayIndex,t)}c===u&&([n,r]=[Math.max(f,Math.min(n,r)),Math.min(m,Math.max(n,r))]);const[y,p]=[Yu(n),Yu(r)];v.startHour=n,v.endHour=r,v.dayIndex=u,w(e=>e.map(e=>{if(e.id!==v.eventId)return e;const t=gu(e.start),n=Cu(h?Ku(h,u):t,y),r=h?Ku(h,c):t,a=Cu(r,p),o=cu(n),i=cu(a);return Object.assign(Object.assign({},e),{start:o,end:i,day:u})}),v.mode),M(v.dayIndex,y,p,!1)}else if("create"===v.mode){const n=Yu(t),[r,a]=e.clientY<v.startY?[n,Math.max(n+Pu,v.endHour)]:[v.startHour,Math.max(v.startHour+Pu,n)];v.startHour=r,v.endHour=a;const o=null==c?void 0:c(v.dayIndex,r,a);M(v.dayIndex,r,a,!1,o)}else if("move"===v.mode){const n=P?v.dayIndex:k(e.clientX);let r=Yu(t+(null!==(d=v.hourOffset)&&void 0!==d?d:0));r=Math.max(f,Math.min(m-v.duration,r));const a=r+v.duration;v.dayIndex=n,v.startHour=r,v.endHour=a;let o=null;if(v.eventId&&u){const e=null==g?void 0:g.find(e=>e.id===v.eventId);e&&(o=u(e,n,Yu(r),Yu(a)))}M(n,Yu(r),Yu(a),!1,o)}}},[R,P,M,O,w,S,H,f,m,c,k,C,I,u,g,y,E]),Z=r(e=>{var t,n;document.body.style.cursor="default";const r=y.current;if(r.active){if(R){if("resize"===r.mode&&r.eventId&&r.originalStartDate&&r.originalEndDate){b(e=>"targetDate"in e?Object.assign(Object.assign({},e),{targetDate:r.originalStartDate,startDate:r.originalStartDate,endDate:r.originalEndDate}):e);const e=(null===(t=r.originalEvent)||void 0===t?void 0:t.allDay)||!1,n=e?uu(r.originalStartDate):cu(r.originalStartDate),a=e?uu(r.originalEndDate):cu(r.originalEndDate);w(e=>e.map(e=>e.id===r.eventId?Object.assign(Object.assign({},e),{start:n,end:a,title:e.title}):e))}else if("move"===r.mode)if(r.eventId&&r.originalStartDate&&r.originalEndDate){b(e=>"targetDate"in e?Object.assign(Object.assign({},e),{targetDate:r.originalStartDate,startDate:r.originalStartDate,endDate:r.originalEndDate}):e);const e=(null===(n=r.originalEvent)||void 0===n?void 0:n.allDay)||!1,t=e?uu(r.originalStartDate):cu(r.originalStartDate),a=e?uu(r.originalEndDate):cu(r.originalEndDate);w(e=>e.map(e=>e.id===r.eventId?Object.assign(Object.assign({},e),{start:t,end:a,title:e.title}):e))}else{const t=O(e.clientX,e.clientY)||r.targetDate;r.eventId&&t&&(b(e=>"targetDate"in e?Object.assign(Object.assign({},e),{targetDate:t}):e),w(e=>e.map(e=>{if(e.id!==r.eventId)return e;const n=gu(e.start),a=gu(e.end),o=new Date(t);o.setHours(n.getHours(),n.getMinutes(),0,0);const i=new Date(t);i.setHours(a.getHours(),a.getMinutes(),0,0);const s=e.allDay?uu(o):cu(o),l=e.allDay?uu(i):cu(i);return Object.assign(Object.assign({},e),{start:s,end:l})})))}}else{let[e,t]=[Yu(r.startHour),Yu(r.endHour)];if(t-e<v&&("top"===r.resizeDirection?e=t-v:t=e+v),"create"===r.mode){const n=h?Ku(h,r.dayIndex):new Date;b(n=>"dayIndex"in n?Object.assign(Object.assign({},n),{dayIndex:r.dayIndex,startHour:e,endHour:t}):n);const a=Cu(n,e),o=Cu(n,t),i=cu(a),s=cu(o);null==l||l({id:String(Date.now()),title:"New Event",day:r.dayIndex,start:i,end:s,calendarId:"blue",allDay:!1})}else"move"!==r.mode&&"resize"!==r.mode||(b(n=>"dayIndex"in n?Object.assign(Object.assign({},n),{dayIndex:r.dayIndex,startHour:e,endHour:t}):n),"move"===r.mode&&(null==s||s(e=>e.map(e=>e.id===r.eventId?Object.assign(Object.assign({},e),{day:r.dayIndex}):e))))}document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",Z),x(),r.indicatorVisible=!1,r.sourceElement=null,D()}},[R,L,x,D,O,w,v,h,l,s,y,b]),F=r((e,...t)=>{if(e.preventDefault(),e.stopPropagation(),!y.current.active)if(R){const[e]=t,n=new Date(e);n.setHours(9,0,0,0);const r=new Date(e);r.setHours(10,0,0,0);const a=cu(n),o=cu(r),i={id:String(Date.now()),title:"New Event",start:a,end:o,day:e.getDay(),calendarId:"blue",allDay:!1};null==l||l(i),d&&setTimeout(()=>{d(i)},50)}else{const[n,r]=t,a=y.current,o=Yu(r);Object.assign(a,{active:!0,mode:"create",eventId:null,startX:e.clientX,startY:e.clientY,dayIndex:n,startHour:o,endHour:o+1,allDay:!1,eventDate:h?Ku(h,n):new Date}),b({active:!0,mode:"create",eventId:null,dayIndex:n,startHour:a.startHour,endHour:a.endHour,allDay:!1});const i=null==c?void 0:c(n,a.startHour,a.endHour);E(a,"blue","New Event",i),a.sourceElement=null,a.indicatorVisible=!0,document.addEventListener("mousemove",L),document.addEventListener("mouseup",Z)}},[R,l,d,h,c,E,L,Z,y,b]),z=r((e,t)=>{var n,r,a;if(e.preventDefault(),e.stopPropagation(),y.current.active)return;const o=y.current,i=e.currentTarget;if(R){p.current={x:e.clientX-i.getBoundingClientRect().left,y:e.clientY-i.getBoundingClientRect().top};const n=gu(t.start),r=gu(t.end);let a=1;if(t.allDay&&t.start&&t.end){const e=new Date(n);e.setHours(0,0,0,0);const t=new Date(r);t.setHours(0,0,0,0),a=Math.floor((t.getTime()-e.getTime())/864e5+1),a=Math.max(1,a)}const s=i.getAttribute("data-segment-days"),l=s?parseInt(s,10):a;o.active=!0,o.mode="move",o.eventId=t.id,o.startX=e.clientX,o.startY=e.clientY,o.targetDate=n,o.originalDate=n,o.originalEvent=Object.assign({},t),o.lastUpdateTime=Date.now(),o.originalStartDate=n,o.originalEndDate=r,o.eventDurationDays=a,o.currentSegmentDays=l,b({active:!0,mode:"move",eventId:t.id,targetDate:n,startDate:n,endDate:r}),o.sourceElement=i,o.indicatorVisible=!1,document.addEventListener("mousemove",L),document.addEventListener("mouseup",Z)}else{const s=C(e.clientY),l=t._segmentInfo,d=!!l,c=d?l.dayIndex:null!==(n=t.day)&&void 0!==n?n:0,u=d?l.startHour:Mu(t.start);let h=0;if(t.allDay&&t.start&&t.end){const e=gu(t.start);e.setHours(0,0,0,0);const n=gu(t.end);n.setHours(0,0,0,0),h=Math.floor((n.getTime()-e.getTime())/864e5)}const g=gu(t.start);if(Object.assign(o,{active:!0,mode:"move",eventId:t.id,startX:e.clientX,startY:e.clientY,dayIndex:c,startHour:u,endHour:d?l.endHour:Au(t),originalDay:null!==(r=t.day)&&void 0!==r?r:0,originalStartHour:Mu(t.start),originalEndHour:Au(t),allDay:t.allDay||!1,eventDate:g,eventDurationDays:h,startDragDayIndex:c}),!t.allDay){o.hourOffset=u-s;const e=gu(t.start),n=gu(t.end).getTime()-e.getTime();o.duration=n/36e5}b({active:!0,mode:"move",eventId:t.id,dayIndex:null!==(a=t.day)&&void 0!==a?a:0,startHour:Mu(t.start),endHour:Au(t),allDay:t.allDay||!1}),E(o,t.calendarId,t.title,null,i),o.sourceElement=i,o.indicatorVisible=!0,document.addEventListener("mousemove",Y),document.addEventListener("mouseup",A)}},[R,E,Z,L,Y,A,C,y,p,b]),V=r((e,t,n)=>{var r,a,o,i,s;if(e.preventDefault(),e.stopPropagation(),y.current.active)return;const l=y.current;if(R){const r=gu(t.start),a=gu(t.start),o=gu(t.end),i={hour:a.getHours(),minute:a.getMinutes(),second:a.getSeconds()},s={hour:o.getHours(),minute:o.getMinutes(),second:o.getSeconds()};l.active=!0,l.mode="resize",l.eventId=t.id,l.startX=e.clientX,l.startY=e.clientY,l.targetDate="left"===n?a:o,l.originalDate=r,l.originalEvent=Object.assign({},t),l.lastUpdateTime=Date.now(),l.resizeDirection=n,l.originalStartDate=a,l.originalEndDate=o,l.originalStartTime=i,l.originalEndTime=s,b({active:!0,mode:"resize",eventId:t.id,targetDate:"left"===n?a:o,startDate:a,endDate:o})}else if(t.allDay){const o=gu(t.start),i=gu(t.end);l.active=!0,l.mode="resize",l.eventId=t.id,l.startX=e.clientX,l.startY=e.clientY,l.allDay=!0,l.resizeDirection=n,l.originalStartDate=o,l.originalEndDate=i,l.originalEvent=Object.assign({},t),l.dayIndex=null!==(r=t.day)&&void 0!==r?r:0,b({active:!0,mode:"resize",eventId:t.id,dayIndex:null!==(a=t.day)&&void 0!==a?a:0,startHour:0,endHour:0,allDay:!0})}else{const r=C(e.clientY);Object.assign(l,{active:!0,mode:"resize",eventId:t.id,startX:e.clientX,startY:e.clientY,dayIndex:null!==(o=t.day)&&void 0!==o?o:0,startHour:Mu(t.start),endHour:Au(t),originalDay:null!==(i=t.day)&&void 0!==i?i:0,originalStartHour:Mu(t.start),originalEndHour:Au(t),resizeDirection:n,lastUpdateTime:Date.now(),initialMouseY:r,hourOffset:"top"===n?Mu(t.start)-r:Au(t)-r,allDay:!1}),b({active:!0,mode:"resize",eventId:t.id,dayIndex:null!==(s=t.day)&&void 0!==s?s:0,startHour:Mu(t.start),endHour:Au(t),allDay:!1})}document.addEventListener("mousemove",L),document.addEventListener("mouseup",Z)},[R,L,Z,C,y,b]);return{handleDragMove:L,handleDragEnd:Z,handleCreateStart:F,handleMoveStart:z,handleResizeStart:V,handleUniversalDragMove:Y,handleUniversalDragEnd:A}})({options:a,common:l,state:d,manager:c}),h=(e=>{const{options:t,common:n,state:a,manager:o,handleDragMove:i,handleDragEnd:s}=e,{viewType:l,currentWeekStart:d}=t,{dragRef:c,setDragState:u}=a,{createDragIndicator:h}=o,{pixelYToHour:g,getColumnDayIndex:f}=n,m=l===N.MONTH,v=r((e,t)=>{if(m)return;if(e.preventDefault(),e.stopPropagation(),c.current.active)return;const n=c.current;Object.assign(n,{active:!0,mode:"create",eventId:null,startX:e.clientX,startY:e.clientY,dayIndex:t,allDay:!0,eventDate:d?Ku(d,t):new Date}),u({active:!0,mode:"create",eventId:null,dayIndex:t,startHour:0,endHour:0,allDay:!0}),h(n,"blue","New All-day Event"),document.addEventListener("mousemove",i),document.addEventListener("mouseup",s)},[m,h,d,s,i,c,u]);return{handleCreateAllDayEvent:v,pixelYToHour:g,getColumnDayIndex:f}})({options:a,common:l,state:d,manager:c,handleDragMove:u.handleDragMove,handleDragEnd:u.handleDragEnd}),g=(e=>{const{common:t}=e,{daysDifference:n,addDaysToDate:r,getTargetDateFromPosition:a}=t;return{daysDifference:n,addDaysToDate:r,getTargetDateFromPosition:a}})({common:l});return Object.assign({createDragIndicator:c.createDragIndicator,updateDragIndicator:c.updateDragIndicator,removeDragIndicator:c.removeDragIndicator,handleCreateStart:u.handleCreateStart,handleMoveStart:u.handleMoveStart,handleResizeStart:u.handleResizeStart,dragState:d.dragState,isDragging:d.dragState.active},s?{daysDifference:g.daysDifference,addDaysToDate:g.addDaysToDate,getTargetDateFromPosition:g.getTargetDateFromPosition}:{handleCreateAllDayEvent:h.handleCreateAllDayEvent,pixelYToHour:h.pixelYToHour,getColumnDayIndex:h.getColumnDayIndex})};function Pg(e={}){const t=Object.assign({enableDrag:!0,enableResize:!0,enableCreate:!0,enableAllDayCreate:!0,supportedViews:[N.DAY,N.WEEK,N.MONTH]},e),n={getConfig:()=>t,updateConfig:e=>{Object.assign(t,e)},isViewSupported:e=>t.supportedViews.includes(e)};return{name:"drag",config:t,install:()=>{Z.log("Drag plugin installed - providing drag capabilities")},api:n}}function $g(e,t){const n=e.getPlugin("drag"),r=Rg(t);if(!n)return Z.warn("Drag plugin is not installed. Drag functionality will be disabled. Add createDragPlugin() to your plugins array to enable dragging."),{handleMoveStart:()=>{},handleCreateStart:()=>{},handleResizeStart:()=>{},handleCreateAllDayEvent:void 0,dragState:r.dragState,isDragging:!1};const a=n.getConfig(),o=n.isViewSupported(t.viewType);return o||console.info(`ℹ️ Drag functionality is not supported for ${t.viewType} view.`),{handleMoveStart:o&&a.enableDrag?r.handleMoveStart:()=>{},handleCreateStart:o&&a.enableCreate?r.handleCreateStart:()=>{},handleResizeStart:o&&a.enableResize?r.handleResizeStart:()=>{},handleCreateAllDayEvent:o&&a.enableAllDayCreate?r.handleCreateAllDayEvent:void 0,dragState:r.dragState,isDragging:!!o&&r.isDragging}}const jg=({handlePreviousMonth:e,handleToday:t,handleNextMonth:n})=>l("div",{className:"flex items-center gap-1",children:[d("button",{className:"calendar-nav-button group relative inline-flex items-center justify-center w-8 h-8 rounded-lg border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 hover:border-gray-300 dark:hover:border-gray-500 active:bg-gray-100 dark:active:bg-gray-600 transition-all duration-150 shadow-sm hover:shadow focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1",onClick:e,"aria-label":"Previous month",children:d(g,{className:"h-4 w-4 transition-transform group-hover:scale-110"})}),d("button",{className:"calendar-today-button inline-flex items-center justify-center px-4 py-[5px] text-sm font-medium rounded-lg border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 hover:bg-gray-50 dark:hover:bg-gray-700 hover:border-gray-300 dark:hover:border-gray-500 active:bg-gray-100 dark:active:bg-gray-600 transition-all duration-150 shadow-sm hover:shadow focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 min-w-[70px]",onClick:t,children:"Today"}),d("button",{className:"calendar-nav-button group relative inline-flex items-center justify-center w-8 h-8 rounded-lg border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 hover:border-gray-300 dark:hover:border-gray-500 active:bg-gray-100 dark:active:bg-gray-600 transition-all duration-150 shadow-sm hover:shadow focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1",onClick:n,"aria-label":"Next month",children:d(f,{className:"h-4 w-4 transition-transform group-hover:scale-110"})})]}),Yg={[N.DAY]:"Day",[N.WEEK]:"Week",[N.MONTH]:"Month",[N.YEAR]:"Year"},Ag=()=>d("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"transition-transform duration-200",children:d("path",{d:"M4 6L8 10L12 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),Lg=({calendar:e,mode:t="buttons"})=>{const[r,i]=n(!1),s=o(null),c=Array.from(e.state.views.keys()),u=e.state.currentView;return a(()=>{const e=e=>{s.current&&!s.current.contains(e.target)&&i(!1)};if(r)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[r]),"select"===t?l("div",{className:"relative inline-block",ref:s,children:[l("button",{onClick:()=>i(!r),className:"flex items-center gap-2 px-3 py-1 text-sm font-medium border border-gray-200 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 transition-all duration-200 shadow-sm min-w-[120px] justify-between","aria-expanded":r,"aria-haspopup":"listbox",children:[d("span",{className:"text-gray-900 dark:text-gray-100",children:Yg[u]}),d("span",{className:"text-gray-500 dark:text-gray-400 transition-transform duration-200 "+(r?"rotate-180":""),children:d(Ag,{})})]}),r&&d("div",{className:"absolute top-full mt-1 left-0 z-50 w-full min-w-[120px] bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg shadow-lg dark:shadow-gray-900/50 overflow-hidden animate-in",children:d("div",{className:"py-1",role:"listbox",children:c.map(t=>d("button",{onClick:()=>{e.changeView(t),i(!1)},className:"w-full text-left px-3 py-2 text-sm transition-colors duration-150 "+(u===t?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-medium":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700"),role:"option","aria-selected":u===t,children:Yg[t]},t))})}),d("style",{children:"\n @keyframes slideIn {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n .animate-in {\n animation: slideIn 0.15s ease-out;\n }\n "})]}):d("div",{className:"inline-flex items-center gap-1 p-1 bg-gray-100 dark:bg-gray-800 rounded-lg",children:c.map(t=>d("button",{className:"px-4 py-1.5 text-sm font-medium rounded-md transition-all duration-200 "+(u===t?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 hover:bg-gray-50 dark:hover:bg-gray-700"),onClick:()=>e.changeView(t),children:Yg[t]},t))})},Zg=({calendar:e,viewType:t,currentDate:n,onPrevious:r,onNext:a,onToday:o,customTitle:i,customSubtitle:s,showTodayBox:c,switcherMode:u="buttons",stickyYear:h,stickyYearOffset:g=0,nextYear:f,nextYearOffset:m=0})=>{const v=void 0!==c?c:"day"!==t,y="buttons"===u,p=i||(()=>{switch(t){case"day":return n.toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"});case"week":case"month":return n.toLocaleDateString("en-US",{month:"long",year:"numeric"});case"year":return n.getFullYear().toString();default:return""}})(),b="day"===t?s||("day"===t?n.toLocaleDateString("en-US",{weekday:"long"}):null):null;return l("div","day"===t?{className:W,style:{position:"relative"},children:[l("div",{className:"flex-1",children:[d("div",{className:`${U} text-gray-900 dark:text-white`,children:p}),b&&d("div",{className:"mt-3 text-gray-600 dark:text-gray-400",children:b})]}),y&&d("div",{className:"absolute -translate-x-1/2",style:{left:"calc(5 / 7 * 100% + 0.5px)"},children:d(Lg,{mode:u,calendar:e})}),!y&&d("div",{className:"flex items-center gap-2",children:v&&r&&a&&o&&d(jg,{handlePreviousMonth:r,handleNextMonth:a,handleToday:o})})]}:{className:W,style:{position:"relative"},children:[d("div",{children:"year"===t&&h?l("div",{style:{position:"relative",overflow:"hidden"},children:[d("h1",{className:U,style:{position:"absolute",top:0,left:0,transform:`translateY(-${g}px)`,willChange:"transform"},children:h}),f&&d("h1",{className:U,style:{position:"absolute",top:0,left:0,transform:`translateY(${m}px)`,willChange:"transform"},children:f})]}):d("h1",{className:U,children:p})}),y&&d("div",{className:"absolute left-1/2 -translate-x-1/2",children:d(Lg,{mode:u,calendar:e})}),(v||!y)&&r&&a&&o&&l("div",{className:"flex items-center gap-2",children:[!y&&d(Lg,{mode:u,calendar:e}),v&&d(jg,{handlePreviousMonth:r,handleNextMonth:a,handleToday:o})]})]})};function Fg(e){const{app:t,onEventCreated:n}=e,a=r(e=>{e.dataTransfer.types.includes("application/x-dayflow-calendar")&&(e.preventDefault(),e.dataTransfer.dropEffect="copy")},[]),o=r((e,r,a,o)=>{e.preventDefault();const i=e.dataTransfer.getData("application/x-dayflow-calendar");if(!i)return null;try{const e=JSON.parse(i);let s,l,d=!1;o?(s=ou.PlainDateTime.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate(),hour:0,minute:0}),l=ou.PlainDateTime.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate(),hour:23,minute:59,second:59}),d=!0):void 0!==a?(s=ou.PlainDateTime.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate(),hour:a,minute:0}),l=s.add({hours:1})):(s=ou.PlainDateTime.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate(),hour:9,minute:0}),l=s.add({hours:1}));const c={id:`event-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:`New ${e.calendarName} Event`,description:"",start:s,end:l,calendarId:e.calendarId,allDay:d};return t.addEvent(c),null==n||n(c),c}catch(e){return console.error("Error creating event from calendar drop:",e),null}},[t,n]);return{handleDrop:o,handleDragOver:a}}const zg=({app:r,customDetailPanelContent:o,customEventDetailDialog:i,calendarRef:s,switcherMode:c="buttons"})=>{const u=r.getCurrentDate(),h=r.getEvents(),[g,f]=n(new Date),[m,v]=n(null),[y,p]=n(null),[b,D]=n(null),{HOUR_HEIGHT:w,FIRST_HOUR:x,LAST_HOUR:E,TIME_COLUMN_WIDTH:M,ALL_DAY_HEIGHT:C}=Ng,k=e.useRef(null),T=t(()=>(e=>{const t=e.getDay(),n=e.getDate()-t+(0===t?-6:1),r=new Date(e);return r.setDate(n),r.setHours(0,0,0,0),r})(u),[u]),I=t(()=>h.filter(e=>{const t=gu(e.start);t.setHours(0,0,0,0);const n=new Date(u);return n.setHours(0,0,0,0),t.getTime()===n.getTime()}).map(e=>{const t=gu(e.start),n=Math.floor((t.getTime()-T.getTime())/864e5),r=Math.max(0,Math.min(6,n));return Object.assign(Object.assign({},e),{day:r})}),[h,u,T]),S=t(()=>Tg.calculateDayEventLayouts(I,{viewType:"day"}),[I]),{handleMoveStart:H,handleCreateStart:O,handleResizeStart:R,handleCreateAllDayEvent:P,dragState:$,isDragging:j}=$g(r,{calendarRef:s,allDayRowRef:k,viewType:N.DAY,onEventsUpdate:e=>{const t=e(I),n=new Set(t.map(e=>e.id)),a=I.filter(e=>!n.has(e.id)),o=new Set(I.map(e=>e.id)),i=t.filter(e=>!o.has(e.id)),s=t.filter(e=>{if(!o.has(e.id))return!1;const t=I.find(t=>t.id===e.id);return t&&(gu(t.start).getTime()!==gu(e.start).getTime()||gu(t.end).getTime()!==gu(e.end).getTime()||t.day!==e.day||Mu(t.start)!==Mu(e.start)||Mu(t.end)!==Mu(e.end)||t.title!==e.title)});a.forEach(e=>r.deleteEvent(e.id)),i.forEach(e=>r.addEvent(e)),s.forEach(e=>r.updateEvent(e.id,e))},onEventCreate:e=>{r.addEvent(e)},onEventEdit:()=>{},currentWeekStart:T,events:I,calculateNewEventLayout:(e,t,n)=>{const r=new Date(u),a=new Date(u);r.setHours(Math.floor(t),t%1*60,0,0),a.setHours(Math.floor(n),n%1*60,0,0);const o={id:"-1",title:"Temp",day:e,start:cu(r),end:cu(a),calendarId:"blue",allDay:!1},i=[...I.filter(e=>!e.allDay),o];return Tg.calculateDayEventLayouts(i,{viewType:"day"}).get("-1")||null},calculateDragLayout:(e,t,n,r)=>{const a=I.map(a=>{if(a.id!==e.id)return a;const o=gu(a.start),i=Cu(o,n),s=Cu(o,r),l=cu(i),d=cu(s);return Object.assign(Object.assign({},a),{day:t,start:l,end:d})}),o=a.filter(e=>!e.allDay);if(0===o.length)return null;return Tg.calculateDayEventLayouts(o,{viewType:"day"}).get(e.id)||null}}),{handleDrop:Y,handleDragOver:A}=Fg({app:r,onEventCreated:e=>{D(e.id)}}),L=e=>{r.updateEvent(e.id,e)},Z=e=>{r.deleteEvent(e)},F=Array.from({length:24},(e,t)=>({hour:t+x,label:$u(t+x)})),z=(()=>{const e=r.getCurrentDate().getFullYear(),t=r.getCurrentDate().getMonth(),n=new Date(e,t,1),a=new Date(e,t+1,0),o=[];for(let r=(0===n.getDay()?6:n.getDay()-1)-1;r>=0;r--){const n=new Date(e,t,-r);o.push({date:n.getDate(),isCurrentMonth:!1,isToday:!1,isSelected:!1,fullDate:n})}for(let n=1;n<=a.getDate();n++){const r=new Date(e,t,n),a=r.toDateString()===(new Date).toDateString(),i=r.toDateString()===u.toDateString();o.push({date:n,isCurrentMonth:!0,isToday:a,isSelected:i,fullDate:r})}const i=42-o.length;for(let n=1;n<=i;n++){const r=new Date(e,t+1,n);o.push({date:n,isCurrentMonth:!1,isToday:!1,isSelected:!1,fullDate:r})}return o})(),V=t(()=>{const e=new Date;e.setHours(0,0,0,0);const t=new Date(u);return t.setHours(0,0,0,0),t.getTime()===e.getTime()},[u]);return a(()=>{const e=setInterval(()=>f(new Date),6e4);return()=>clearInterval(e)},[]),l("div",{className:"flex h-full bg-gray-50 dark:bg-gray-800",children:[d("div",{className:`flex-none ${"buttons"===c?"":"md:w-[60%]"} w-[70%] bg-white dark:bg-gray-900 border-r border-gray-200 dark:border-gray-700`,children:l("div",{className:`relative ${pe} h-full`,children:[d(Zg,{calendar:r,viewType:N.DAY,currentDate:u,switcherMode:c,customSubtitle:g.toLocaleDateString("en-US",{weekday:"long"})}),l("div",{className:ee,ref:k,children:[d("div",{className:te,children:"all-day"}),d("div",{className:"flex flex-1 relative",children:d("div",{className:"w-full relative",style:{minHeight:`${C}px`},onDoubleClick:e=>{const t=Math.floor((u.getTime()-T.getTime())/864e5);null==P||P(e,t)},onDragOver:A,onDrop:e=>{Y(e,u,void 0,!0)},children:I.filter(e=>e.allDay).map(e=>d(pg,{event:e,isAllDay:!0,isDayView:!0,allDayHeight:C,calendarRef:s,isBeingDragged:j&&(null==$?void 0:$.eventId)===e.id&&"move"===(null==$?void 0:$.mode),hourHeight:w,firstHour:x,onMoveStart:H,onEventUpdate:L,onEventDelete:Z,newlyCreatedEventId:b,onDetailPanelOpen:()=>D(null),detailPanelEventId:y,onDetailPanelToggle:e=>p(e),customDetailPanelContent:o,customEventDetailDialog:i},e.id))})})]}),d("div",{className:q,style:{position:"relative"},children:l("div",{className:"relative flex",children:[V&&(()=>{const e=g,t=e.getHours()+e.getMinutes()/60;if(t<x||t>E)return null;return l("div",{className:K,style:{top:`${(t-x)*w}px`,width:"100%",height:0,zIndex:20},children:[l("div",{className:"flex items-center",style:{width:`${M}px`},children:[d("div",{className:"relative w-full flex items-center"}),d("div",{className:Q,children:$u(t)})]}),d("div",{className:"flex-1 flex items-center",children:d("div",{className:"h-0.5 w-full bg-red-600 relative"})})]})})(),d("div",{className:_,children:F.map((e,t)=>d("div",{className:X,children:d("div",{className:G,children:0===t?"":e.label})},t))}),l("div",{className:"flex-grow relative",children:[F.map((e,t)=>d("div",{className:J,onDoubleClick:e=>{var t,n,r,a;const o=Math.floor((u.getTime()-T.getTime())/864e5),i=null===(n=null===(t=s.current)||void 0===t?void 0:t.querySelector(".calendar-content"))||void 0===n?void 0:n.getBoundingClientRect();if(!i)return;const l=e.clientY-i.top+(null===(a=null===(r=s.current)||void 0===r?void 0:r.querySelector(".calendar-content"))||void 0===a?void 0:a.scrollTop)||0;O(e,o,x+l/w)},onDragOver:A,onDrop:e=>{var t,n,r,a;const o=null===(n=null===(t=s.current)||void 0===t?void 0:t.querySelector(".calendar-content"))||void 0===n?void 0:n.getBoundingClientRect();if(!o)return;const i=e.clientY-o.top+(null===(a=null===(r=s.current)||void 0===r?void 0:r.querySelector(".calendar-content"))||void 0===a?void 0:a.scrollTop)||0,l=Math.floor(x+i/w);Y(e,u,l)}},t)),d("div",{className:"h-3 border-t border-gray-200 dark:border-gray-700 relative",children:d("div",{className:"absolute -top-2.5 -left-9 text-[12px] text-gray-500 dark:text-gray-400",children:"00.00"})}),d("div",{className:"absolute top-0 left-0 right-0 bottom-0 pointer-events-none",children:I.filter(e=>!e.allDay).map(e=>{const t=S.get(e.id);return d(pg,{event:e,layout:t,isDayView:!0,calendarRef:s,isBeingDragged:j&&(null==$?void 0:$.eventId)===e.id&&"move"===(null==$?void 0:$.mode),hourHeight:w,firstHour:x,onMoveStart:H,onResizeStart:R,onEventUpdate:L,onEventDelete:Z,newlyCreatedEventId:b,onDetailPanelOpen:()=>D(null),detailPanelEventId:y,onDetailPanelToggle:e=>p(e),customDetailPanelContent:o,customEventDetailDialog:i},e.id)})})]})]})})]})}),d("div",{className:`flex-none ${"buttons"===c?"":"md:w-[40%]"} w-[30%] bg-white dark:bg-gray-900`,children:l("div",{className:`${pe} h-full`,children:[d("div",{className:"px-2 border-b border-gray-200 dark:border-gray-700",children:l("div",{children:[l("div",{className:"flex items-center justify-end gap-2",children:[d("div",{className:W,style:{position:"relative"},children:d("div",{children:d("h1",{className:U,children:" "})})}),"select"===c?d(Lg,{mode:c,calendar:r}):null,d(jg,{handlePreviousMonth:()=>r.goToPrevious(),handleNextMonth:()=>r.goToNext(),handleToday:()=>r.goToToday()})]}),l("div",{className:le,children:[Lu.map(e=>d("div",{className:de,children:e.charAt(0)},e)),z.map((e,t)=>d("button",{className:`\n ${ce}\n ${e.isCurrentMonth?ue:he}\n ${e.isToday?ge:""}\n ${e.isSelected&&!e.isToday?fe:""}\n `,onClick:()=>{return t=e.fullDate,void r.setCurrentDate(t);var t},children:e.date},t))]})]})}),l("div",{className:"flex-1 p-4 overflow-y-auto",children:[d("h3",{className:"text-lg font-semibold mb-3",children:u.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric"})}),0===I.length?d("p",{className:`text-gray-500 dark:text-gray-400 ${ye}`,children:"No events for this day"}):d("div",{className:"space-y-2",children:I.map(e=>l("div",{className:`\n p-2 rounded border-l-4 cursor-pointer transition-colors\n ${(null==m?void 0:m.id)===e.id?"bg-blue-50 dark:bg-blue-900/30 border-blue-500":"bg-gray-50 dark:bg-gray-800 border-gray-300 dark:border-gray-600"}\n hover:bg-gray-100 dark:hover:bg-gray-700\n `,style:{borderLeftColor:Ru(e.calendarId||"blue")},onClick:()=>v(e),children:[d("div",{className:`font-medium ${ye}`,children:e.title}),!e.allDay&&l("div",{className:`${ve} ${me}`,children:[$u(Mu(e.start))," -"," ",$u(Au(e))]}),e.allDay&&d("div",{className:`${ve} ${me}`,children:"All day"})]},e.id))})]})]})})]})},Vg={enableDrag:!0,enableResize:!0,enableCreate:!0,showMiniCalendar:!0,showAllDay:!0,scrollToCurrentTime:!0,hourHeight:72,firstHour:0,lastHour:24,dragConfig:{supportedViews:[N.DAY],enableAllDayCreate:!0},eventsConfig:{enableAutoRecalculate:!0,enableValidation:!0},viewConfig:{showMiniCalendar:!0,showAllDay:!0,scrollToCurrentTime:!0}},Bg=(t={})=>{const n=Object.assign(Object.assign({},Vg),t),r=t=>e.createElement(Lh,{viewType:N.DAY,originalComponent:zg,app:t.app,config:n,className:"day-view-factory",customDetailPanelContent:t.customDetailPanelContent,customEventDetailDialog:t.customEventDetailDialog,calendarRef:t.calendarRef,switcherMode:t.switcherMode,meta:t.meta});return r.displayName="DayViewAdapter",{type:N.DAY,component:r,config:n}},Wg=({app:r,customDetailPanelContent:o,customEventDetailDialog:i,calendarRef:s,switcherMode:c="buttons"})=>{const u=r.getCurrentDate(),h=r.getEvents(),g=e=>{const t=e.getDay(),n=e.getDate()-t+(0===t?-6:1),r=new Date(e);return r.setDate(n),r.setHours(0,0,0,0),r},f=t(()=>g(u),[u]),[m,v]=n(new Date),[y,p]=n(null),[b,D]=n(null),[w,x]=n(null),{HOUR_HEIGHT:E,FIRST_HOUR:M,LAST_HOUR:C,TIME_COLUMN_WIDTH:k,ALL_DAY_HEIGHT:T}=Ng,I=e.useRef(null),S=t(()=>{const e=new Date(f);e.setDate(f.getDate()+6),e.setHours(23,59,59,999);return h.filter(t=>{const n=gu(t.start);n.setHours(0,0,0,0);const r=gu(t.end);return r.setHours(23,59,59,999),r>=f&&n<=e}).map(e=>{const t=gu(e.start),n=Math.floor((t.getTime()-f.getTime())/864e5),r=Math.max(0,Math.min(6,n));return Object.assign(Object.assign({},e),{day:r})})},[h,f]),H=t(()=>gg(S,f),[S,f]),O=t(()=>{const e=H.filter(e=>e.event.allDay);e.sort((e,t)=>{if(e.startDayIndex!==t.startDayIndex)return e.startDayIndex-t.startDayIndex;const n=e.endDayIndex-e.startDayIndex;return t.endDayIndex-t.startDayIndex-n});const t=[];return e.forEach(e=>{let n=0,r=!1;for(;!r;){t.some(t=>t.row===n&&!(e.endDayIndex<t.startDayIndex||e.startDayIndex>t.endDayIndex))?n++:r=!0}t.push(Object.assign(Object.assign({},e),{row:n}))}),t},[H]),R=t(()=>{if(0===O.length)return T;const e=Math.max(...O.map(e=>e.row));return T+e*T},[O,T]),P=t(()=>{const e=new Map;for(let t=0;t<7;t++){const n=[];S.forEach(e=>{if(e.allDay)return;const r=fg(e,f);if(r.length>0){const a=r.find(e=>e.dayIndex===t);if(a){const r=a.endHour>=24?23.99:a.endHour,o=Object.assign(Object.assign({},e),{start:cu(Cu(Ku(f,t),a.startHour)),end:cu(Cu(Ku(f,t),r)),day:t});n.push(o)}}else e.day===t&&n.push(e)});const r=Tg.calculateDayEventLayouts(n,{viewType:"week"});e.set(t,r)}return e},[S,f]),{handleMoveStart:$,handleCreateStart:j,handleResizeStart:Y,handleCreateAllDayEvent:A,dragState:L,isDragging:Z}=$g(r,{calendarRef:s,allDayRowRef:I,viewType:N.WEEK,onEventsUpdate:(e,t)=>{const n=e(S),a=new Set(n.map(e=>e.id)),o=S.filter(e=>!a.has(e.id)),i=new Set(S.map(e=>e.id)),s=n.filter(e=>!i.has(e.id)),l=n.filter(e=>{if(!i.has(e.id))return!1;const t=S.find(t=>t.id===e.id);return t&&(gu(t.start).getTime()!==gu(e.start).getTime()||gu(t.end).getTime()!==gu(e.end).getTime()||t.day!==e.day||Mu(t.start)!==Mu(e.start)||Mu(t.end)!==Mu(e.end)||t.title!==e.title)});o.forEach(e=>r.deleteEvent(e.id)),s.forEach(e=>r.addEvent(e)),l.forEach(e=>r.updateEvent(e.id,e,t))},onEventCreate:e=>{r.addEvent(e)},onEventEdit:()=>{},currentWeekStart:f,events:S,calculateNewEventLayout:(e,t,n)=>{const r=new Date,a=new Date;r.setHours(Math.floor(t),t%1*60,0,0),a.setHours(Math.floor(n),n%1*60,0,0);const o={id:"-1",title:"Temp",day:e,start:cu(r),end:cu(a),calendarId:"blue",allDay:!1},i=[...S.filter(t=>t.day===e&&!t.allDay),o];return Tg.calculateDayEventLayouts(i,{viewType:"week"}).get("-1")||null},calculateDragLayout:(e,t,n,r)=>{const a=S.map(a=>{if(a.id!==e.id)return a;const o=gu(a.start),i=Cu(o,n),s=Cu(o,r),l=cu(i),d=cu(s);return Object.assign(Object.assign({},a),{day:t,start:l,end:d})}),o=a.filter(e=>e.day===t&&!e.allDay);if(0===o.length)return null;return Tg.calculateDayEventLayouts(o,{viewType:"week"}).get(e.id)||null}}),{handleDrop:F,handleDragOver:z}=Fg({app:r,onEventCreated:e=>{x(e.id)}}),V=t(()=>["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],[]),B=Array.from({length:24},(e,t)=>({hour:t+M,label:$u(t+M)})),W=t(()=>{const e=new Date;return e.setHours(0,0,0,0),V.map((t,n)=>{const r=new Date(f);r.setDate(f.getDate()+n);const a=new Date(r);return a.setHours(0,0,0,0),{date:r.getDate(),month:r.toLocaleString("default",{month:"short"}),fullDate:new Date(r),isToday:a.getTime()===e.getTime()}})},[f,V]),U=e=>{r.updateEvent(e.id,e)},ne=e=>{r.deleteEvent(e)},re=t(()=>{const e=new Date,t=g(e);return f.getTime()===t.getTime()},[f]);return a(()=>{const e=setInterval(()=>v(new Date),6e4);return()=>clearInterval(e)},[]),l("div",{className:"relative flex flex-col bg-white dark:bg-gray-900 w-full overflow-hidden h-full",children:[d(Zg,{calendar:r,viewType:N.WEEK,currentDate:u,switcherMode:c,onPrevious:()=>r.goToPrevious(),onNext:()=>r.goToNext(),onToday:()=>r.goToToday()}),l("div",{className:"flex border-b border-gray-200 dark:border-gray-700",children:[d("div",{className:"w-20 p-2"}),V.map((e,t)=>l("div",{className:"flex flex-1 justify-center items-center text-center text-gray-500 dark:text-gray-400 text-sm p-1",children:[d("div",{className:"inline-flex items-center justify-center text-sm h-6 w-6 mt-1 mr-1",children:e}),d("div",{className:"inline-flex items-center justify-center h-6 w-6 rounded-full text-sm mt-1",children:W[t].date})]},t))]}),l("div",{className:ee,ref:I,children:[d("div",{className:te,children:"all-day"}),l("div",{className:"flex flex-1 relative",style:{minHeight:`${R}px`},children:[V.map((e,t)=>{const n=new Date(f);return n.setDate(f.getDate()+t),d("div",{className:"flex-1 border-r border-gray-200 dark:border-gray-700 relative",style:{minHeight:`${R}px`},onDoubleClick:e=>null==A?void 0:A(e,t),onDragOver:z,onDrop:e=>{F(e,n,void 0,!0)}},`allday-${t}`)}),d("div",{className:"absolute inset-0 pointer-events-none",children:O.map(e=>d(pg,{event:e.event,segment:e,segmentIndex:e.row,isAllDay:!0,isMultiDay:!0,allDayHeight:T,calendarRef:s,isBeingDragged:Z&&(null==L?void 0:L.eventId)===e.event.id&&"move"===(null==L?void 0:L.mode),hourHeight:E,firstHour:M,onMoveStart:$,onResizeStart:Y,onEventUpdate:U,onEventDelete:ne,newlyCreatedEventId:w,onDetailPanelOpen:()=>x(null),selectedEventId:b,detailPanelEventId:y,onEventSelect:e=>D(e),onDetailPanelToggle:e=>p(e),customDetailPanelContent:o,customEventDetailDialog:i},e.id))})]})]}),d("div",{className:q,style:{position:"relative"},children:l("div",{className:"relative flex",children:[re&&(()=>{const e=m,t=e.getHours()+e.getMinutes()/60;if(t<M||t>C)return null;const n=e.getDay(),r=0===n?6:n-1;return l("div",{className:K,style:{top:`${(t-M)*E}px`,width:"100%",height:0,zIndex:20},children:[l("div",{className:"flex items-center",style:{width:`${k}px`},children:[d("div",{className:"relative w-full flex items-center"}),d("div",{className:Q,children:$u(t)})]}),d("div",{className:"flex flex-1",children:V.map((e,t)=>d("div",{className:"flex-1 flex items-center",children:d("div",{className:"h-0.5 w-full relative "+(t===r?"bg-red-600 dark:bg-red-500":"bg-red-100 dark:bg-red-900/30"),style:{zIndex:9999},children:t===r&&0!==r&&d("div",{className:"absolute w-2 h-2 bg-red-700 dark:bg-red-500 rounded-full",style:{top:"-3px",left:"-4px"}})})},t))})]})})(),d("div",{className:_,children:B.map((e,t)=>d("div",{className:X,children:d("div",{className:G,children:0===t?"":e.label})},t))}),l("div",{className:"flex-grow relative",children:[B.map((e,t)=>d("div",{className:J,children:V.map((n,r)=>{const a=new Date(f);return a.setDate(f.getDate()+r),d("div",{className:"flex-1 relative border-r border-gray-200 dark:border-gray-700",onDoubleClick:t=>{j(t,r,e.hour)},onDragOver:z,onDrop:t=>{F(t,a,e.hour)}},`${t}-${r}`)})},t)),l("div",{className:"h-3 border-t border-gray-200 dark:border-gray-700 flex relative",children:[d("div",{className:"absolute -top-2.5 -left-9 text-[12px] text-gray-500 dark:text-gray-400",children:"00.00"}),V.map((e,t)=>d("div",{className:"flex-1 relative border-r border-gray-200 dark:border-gray-700"},`24-${t}`))]}),V.map((e,t)=>{const n=Gu(t,S),r=[];return n.forEach(e=>{const n=fg(e,f);if(n.length>0){const a=n.find(e=>e.dayIndex===t);a&&r.push({event:e,segmentInfo:Object.assign(Object.assign({},a),{dayIndex:t})})}else r.push({event:e})}),S.forEach(e=>{if(e.allDay||e.day===t)return;const n=fg(e,f).find(e=>e.dayIndex===t);n&&r.push({event:e,segmentInfo:Object.assign(Object.assign({},n),{dayIndex:t})})}),d("div",{className:"absolute top-0 pointer-events-none",style:{left:`calc(${100/7*t}%)`,width:100/7+"%",height:"100%"},children:r.map(({event:e,segmentInfo:n})=>{const r=P.get(t),a=null==r?void 0:r.get(e.id);return d(pg,{event:e,layout:a,calendarRef:s,isBeingDragged:Z&&(null==L?void 0:L.eventId)===e.id&&"move"===(null==L?void 0:L.mode),hourHeight:E,firstHour:M,onMoveStart:$,onResizeStart:Y,onEventUpdate:U,onEventDelete:ne,newlyCreatedEventId:w,onDetailPanelOpen:()=>x(null),selectedEventId:b,detailPanelEventId:y,onEventSelect:e=>D(e),onDetailPanelToggle:e=>p(e),customDetailPanelContent:o,customEventDetailDialog:i,multiDaySegmentInfo:n},n?`${e.id}-seg-${t}`:e.id)})},`events-day-${t}`)})]})]})})]})},Ug={enableDrag:!0,enableResize:!0,enableCreate:!0,showWeekends:!0,showAllDay:!0,startOfWeek:1,scrollToCurrentTime:!0,hourHeight:72,firstHour:0,lastHour:24,dragConfig:{supportedViews:[N.WEEK],enableAllDayCreate:!0},eventsConfig:{enableAutoRecalculate:!0,enableValidation:!0},viewConfig:{showWeekends:!0,showAllDay:!0,startOfWeek:1,scrollToCurrentTime:!0}},qg=(t={})=>{const n=Object.assign(Object.assign({},Ug),t),r=t=>e.createElement(Lh,{viewType:N.WEEK,originalComponent:Wg,app:t.app,config:n,className:"week-view-factory",customDetailPanelContent:t.customDetailPanelContent,customEventDetailDialog:t.customEventDetailDialog,calendarRef:t.calendarRef,switcherMode:t.switcherMode,meta:t.meta});return r.displayName="WeekViewAdapter",{type:N.WEEK,component:r,config:n}},_g=1,Xg=30,Gg=1970,Jg=2100,Kg=16,Qg=150,ef=1200,tf=850,nf=680;class rf{static trackScrollEvent(e=0){this.metrics.scrollEvents++,this.metrics.totalScrollDistance+=Math.abs(e),this.metrics.avgScrollDelta=this.metrics.totalScrollDistance/this.metrics.scrollEvents}static trackRenderTime(e){this.metrics.renderTime.push(e),e>16.67&&this.metrics.frameDrops++,this.metrics.renderTime.length>100&&this.metrics.renderTime.shift()}static trackCacheHit(){this.metrics.cacheHits++}static trackCacheMiss(){this.metrics.cacheMisses++}static getMetrics(){const e=this.metrics.renderTime.length>0?this.metrics.renderTime.reduce((e,t)=>e+t,0)/this.metrics.renderTime.length:0,t=this.metrics.cacheHits+this.metrics.cacheMisses>0?this.metrics.cacheHits/(this.metrics.cacheHits+this.metrics.cacheMisses)*100:0,n=Date.now()-this.metrics.startTime,r=e>0?1e3/e:0;return{scrollEvents:this.metrics.scrollEvents,avgRenderTime:Math.round(100*e)/100,cacheHitRate:Math.round(100*t)/100,uptime:Math.round(n/1e3),scrollEventsPerSecond:Math.round(this.metrics.scrollEvents/(n/1e3)*100)/100,estimatedFPS:Math.round(r),frameDrops:this.metrics.frameDrops,avgScrollDelta:Math.round(100*this.metrics.avgScrollDelta)/100}}static reset(){this.metrics={scrollEvents:0,renderTime:[],cacheHits:0,cacheMisses:0,startTime:Date.now(),frameDrops:0,avgScrollDelta:0,totalScrollDistance:0}}}rf.metrics={scrollEvents:0,renderTime:[],cacheHits:0,cacheMisses:0,startTime:Date.now(),frameDrops:0,avgScrollDelta:0,totalScrollDistance:0};class af{constructor(e=Xg){this.cache=new Map,this.accessOrder=[],this.maxSize=e}get(e){const t=this.cache.get(e);if(t)return rf.trackCacheHit(),this.updateAccessOrder(e),t;rf.trackCacheMiss()}set(e,t){if(this.cache.size>=this.maxSize){const e=this.accessOrder.shift();void 0!==e&&this.cache.delete(e)}this.cache.set(e,t),this.updateAccessOrder(e)}updateAccessOrder(e){const t=this.accessOrder.indexOf(e);t>-1&&this.accessOrder.splice(t,1),this.accessOrder.push(e)}getSize(){return this.cache.size}getHitRate(){return rf.getMetrics().cacheHitRate}clear(){this.cache.clear(),this.accessOrder=[]}}const of=()=>{const[e,t]=n({yearHeight:nf,screenSize:"desktop"});return a(()=>{const e=()=>{const e=window.innerWidth;t(e<640?{yearHeight:ef,screenSize:"mobile"}:e<900?{yearHeight:tf,screenSize:"tablet"}:{yearHeight:nf,screenSize:"desktop"})};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e},sf=({currentDate:e,yearHeight:i,onCurrentYearChange:s})=>{const l=e.getFullYear(),d=(l-Gg)*i,[c,u]=n(d),[h,g]=n(600),[f,m]=n(l),[v,y]=n(!1),p=o(document.createElement("div")),b=o(null),D=o(0),w=o(0),x=t(()=>{const e=performance.now(),t=Jg-Gg+1,n=t*i,r=Math.floor(c/i),a=Math.min(t-1,Math.ceil((c+h)/i)),o=Math.max(0,r-_g),s=Math.min(t-1,a+_g),l=[];for(let e=o;e<=s;e++)l.push({index:e,year:Gg+e,top:e*i,height:i});const d=performance.now()-e;return rf.trackRenderTime(d),{totalHeight:n,visibleItems:l}},[c,h,i]),E=r(e=>{const t=performance.now();if(t-D.current<Kg)return;D.current=t;const n=e.currentTarget.scrollTop,r=Math.abs(n-w.current);w.current=n,rf.trackScrollEvent(r),requestAnimationFrame(()=>{u(n);const e=n,t=Math.floor(Gg+e/i);t!==f&&t>=Gg&&t<=Jg&&(m(t),null==s||s(t))}),y(!0),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{y(!1)},Qg)},[h,f,i,s]);a(()=>{const e=p.current;if(!e)return;e.scrollTop=d;const t=new ResizeObserver(([e])=>{g(e.contentRect.height)});return t.observe(e),()=>t.disconnect()},[d]);const M=r((e,t=!0)=>{if(!p.current)return;const n=(e-Gg)*i-h/2+i/2;p.current.scrollTo({top:Math.max(0,n),behavior:t?"smooth":"auto"})},[i,h]),C=r(()=>{const e=Math.max(Gg,f-1);m(e),M(e)},[f,M]),k=r(()=>{const e=Math.min(Jg,f+1);m(e),M(e)},[f,M]),T=r(()=>{const e=(new Date).getFullYear();m(e),M(e)},[M]);return a(()=>()=>{b.current&&clearTimeout(b.current)},[]),{scrollTop:c,containerHeight:h,currentYear:f,isScrolling:v,virtualData:x,scrollElementRef:p,handleScroll:E,scrollToYear:M,handlePreviousYear:C,handleNextYear:k,handleToday:T,setScrollTop:u,setContainerHeight:g,setCurrentYear:m,setIsScrolling:y}},lf=()=>{const[e,t]=n({weekHeight:P,screenSize:"desktop",weeksPerView:6});return a(()=>{const e=()=>{const e=window.innerWidth,n=window.innerHeight-150,r=Math.max(80,Math.floor(n/6)),a=e<768?{weekHeight:Math.max(O,r),screenSize:"mobile",weeksPerView:6}:e<1024?{weekHeight:Math.max(R,r),screenSize:"tablet",weeksPerView:6}:{weekHeight:Math.max(P,r),screenSize:"desktop",weeksPerView:6};t(a)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e},df=({currentDate:e,weekHeight:i,onCurrentMonthChange:s,initialWeeksToLoad:l=104})=>{const d=o(null),c=t(()=>{const t=new Date(e);return t.setDate(1),t.setHours(0,0,0,0),Xu(t,l)},[e,l]),u=t(()=>{const t=new Date(e);t.setDate(1),t.setHours(0,0,0,0);const n=c.findIndex(e=>e.days.some(e=>e.date.toDateString()===t.toDateString()));return n>0?n*i:0},[c,e,i]),[h,g]=n(u),[f,m]=n(600),[v,y]=n(Fu[e.getMonth()]),[p,b]=n(e.getFullYear()),[D,w]=n(!1),[x,E]=n(c),[M,C]=n(!1),k=o(!1),[T,N]=n(!1),I=o(e),O=o(null),R=o(null),P=o(new $),j=o(0),Y=o(0),A=o(!1),L=r(e=>{e&&(O.current=e)},[]),Z=r(e=>{let t=P.current.get(e);return t||(t=Uu(e),P.current.set(e,t)),t},[]),F=r((e,t=26)=>{A.current||(A.current=!0,setTimeout(()=>{try{if("future"===e){const e=x[x.length-1],n=[];for(let r=1;r<=t;r++){const t=new Date(e.startDate);t.setDate(t.getDate()+7*r),n.push(Z(t))}E(e=>[...e,...n])}else{const e=x[0],n=[];for(let r=t;r>=1;r--){const t=new Date(e.startDate);t.setDate(t.getDate()-7*r),n.push(Z(t))}const r=n.length*i;E(e=>[...n,...e]),requestAnimationFrame(()=>{g(e=>e+r),O.current&&(O.current.scrollTop+=r)})}}finally{setTimeout(()=>{A.current=!1},200)}},0))},[x,Z,i]),z=t(()=>{const e=x.length*i,t=Math.floor(h/i);let n=Math.max(0,t);n=Math.min(n,Math.max(0,x.length-6));const r=Math.min(x.length-1,n+6-1),a=Math.max(0,n-15),o=Math.min(x.length-1,r+15),s=[];for(let e=a;e<=o;e++)s.push({index:e,weekData:x[e],top:e*i,height:i});return{totalHeight:e,visibleItems:s,displayStartIndex:n}},[h,f,i,x]),V=r(e=>{if(M||D||0===e.length||!T)return;const t=h+f/2,n=e.find(e=>e.top<=t&&e.top+e.height>t)||e[Math.floor(e.length/2)];if(!n)return;const r={};n.weekData.days.forEach(e=>{const t=`${Fu[e.month]}-${e.year}`;r[t]=(r[t]||0)+1});let a="",o=0,i=0;Object.entries(r).forEach(([e,t])=>{if(t>i){i=t;const[n,r]=e.split("-");a=n,o=parseInt(r)}}),a&&o&&(d.current?a===d.current.month&&o===d.current.year&&(d.current=null,a===v&&o===p||(y(a),b(o),null==s||s(a,o))):a===v&&o===p||(y(a),b(o),null==s||s(a,o)))},[f,v,p,M,D,s,h,T]),B=r(e=>{const t=performance.now();if(t-j.current<S)return;j.current=t;const n=e.currentTarget,r=n.scrollTop;Y.current=r,g(r),M||requestAnimationFrame(()=>{const{scrollHeight:e,clientHeight:t}=n;r+t>e-10*i&&!A.current&&F("future",26),r<10*i&&!A.current&&F("past",26)}),w(!0),R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{w(!1)},H)},[i,F,M]),W=r((e,t=!0)=>{if(!O.current)return;C(!0),k.current=!0;const n=()=>{setTimeout(()=>{C(!1),k.current=!1},t?500:200)},r=x.findIndex(t=>t.days.some(t=>t.date.toDateString()===e.toDateString()));if(-1!==r){const e=r*i;return O.current.scrollTo({top:e,behavior:t?"smooth":"auto"}),void n()}const a=e.getDay(),o=0===a?6:a-1,s=new Date(e);s.setDate(e.getDate()-o),s.setHours(0,0,0,0);const l=x[0],d=x[x.length-1];let c=0,u=!1,h=!1;s<l.startDate?(c=Math.ceil((l.startDate.getTime()-s.getTime())/6048e5),u=!0):s>d.startDate&&(c=Math.ceil((s.getTime()-d.startDate.getTime())/6048e5),h=!0);const f=Math.min(c+10,52);if(u){const r=[];for(let e=f;e>=1;e--){const t=new Date(l.startDate);t.setDate(t.getDate()-7*e),r.push(Z(t))}const a=r.length*i;E(e=>[...r,...e]),requestAnimationFrame(()=>{const o=[...r,...x].findIndex(t=>t.days.some(t=>t.date.toDateString()===e.toDateString()));if(O.current&&-1!==o){const e=o*i;O.current.scrollTop+=a,g(e=>e+a),setTimeout(()=>{O.current&&O.current.scrollTo({top:e,behavior:t?"smooth":"auto"})},50)}n()})}else if(h){const r=[];for(let e=1;e<=f;e++){const t=new Date(d.startDate);t.setDate(t.getDate()+7*e),r.push(Z(t))}E(e=>[...e,...r]),requestAnimationFrame(()=>{const a=[...x,...r].findIndex(t=>t.days.some(t=>t.date.toDateString()===e.toDateString()));if(O.current&&-1!==a){const e=a*i;O.current.scrollTo({top:e,behavior:t?"smooth":"auto"})}n()})}else n()},[x,i,Z]),U=r(()=>{const e="January"===v?11:Fu.indexOf(v)-1,t=new Date("January"===v?p-1:p,e,1);W(t)},[v,p,W]),q=r(()=>{const e="December"===v?0:Fu.indexOf(v)+1,t=new Date("December"===v?p+1:p,e,1);W(t)},[v,p,W]),_=r(()=>{const e=new Date,t=Fu[e.getMonth()],n=e.getFullYear(),r=new Date(n,e.getMonth(),1);d.current={month:t,year:n},y(t),b(n),null==s||s(t,n);const a=x.findIndex(e=>e.days.some(e=>e.date.toDateString()===r.toDateString()));if(-1!==a){const e=a*i,t=O.current;t&&(C(!0),k.current=!0,requestAnimationFrame(()=>{g(e),requestAnimationFrame(()=>{t&&(t.scrollTop=e,setTimeout(()=>{k.current=!1,C(!1)},200))})}))}else C(!0),k.current=!0,requestAnimationFrame(()=>{W(r,!0),setTimeout(()=>{k.current=!1,C(!1)},200)})},[x,i,s,W]);return a(()=>{V(z.visibleItems)},[z.visibleItems,V]),a(()=>{const t=I.current,n=t.getMonth(),r=t.getFullYear(),a=e.getMonth(),o=e.getFullYear();if(n!==a||r!==o){const e=new Date(o,a,1),t=Fu[a];d.current={month:t,year:o},y(t),b(o),null==s||s(t,o),W(e,!0)}I.current=e},[e,s,W]),a(()=>{const e=O.current;if(!e)return;const t=new ResizeObserver(([e])=>{m(e.contentRect.height)});return t.observe(e),()=>t.disconnect()},[]),a(()=>{const e=O.current;e&&!T&&requestAnimationFrame(()=>{e&&u>0?(e.scrollTop=u,N(!0)):e&&N(!0)})},[T,u]),a(()=>()=>{R.current&&clearTimeout(R.current)},[]),{scrollTop:h,containerHeight:f,currentMonth:v,currentYear:p,isScrolling:D,virtualData:z,scrollElementRef:O,handleScroll:B,scrollToDate:W,handlePreviousMonth:U,handleNextMonth:q,handleToday:_,setScrollTop:g,setContainerHeight:m,setCurrentMonth:y,setCurrentYear:b,setIsScrolling:w,cache:P.current,scrollElementRefCallback:L,weeksData:x}},cf=e.memo(({currentMonth:e,currentYear:r,newlyCreatedEventId:i,isScrolling:s,isDragging:c,item:u,weekHeight:h,events:g,dragState:f,calendarRef:m,onEventUpdate:v,onEventDelete:y,onMoveStart:p,onCreateStart:b,onResizeStart:D,onDetailPanelOpen:w,onMoreEventsClick:x,onChangeView:E,onSelectDate:M,selectedEventId:C,onEventSelect:k,detailPanelEventId:T,onDetailPanelToggle:I,customDetailPanelContent:S,customEventDetailDialog:H,onCalendarDrop:O,onCalendarDragOver:R})=>{const[P,$]=n(!1),j=o(null),Y=t(()=>(e=>{const t=e-33;if(t<=0)return 0;const n=Math.floor(t/17),r=Math.max(0,Math.min(4,n));return r===n&&t-17*r<20?Math.max(0,r-1):r})(h),[h]);a(()=>s?($(!0),j.current&&(clearTimeout(j.current),j.current=null),()=>{j.current&&(clearTimeout(j.current),j.current=null)}):P?(j.current=setTimeout(()=>{$(!1),j.current=null},100),()=>{j.current&&(clearTimeout(j.current),j.current=null)}):void 0,[s,P]);const{weekData:A}=u,L=A.days.find(e=>1===e.day),F=`${h}px`,z=t(()=>gg(g,A.startDate),[g,A.startDate]),V=t(()=>(e=>{const t=[];return e.forEach(e=>{if(!e.start||!e.end)return void Z.warn("Event missing start or end date:",e);const n=gu(e.start),r=gu(e.end),a=new Date(n);a.setHours(0,0,0,0);const o=new Date(r);o.setHours(0,0,0,0);let i=new Date(o);if(!e.allDay&&0===r.getHours()&&0===r.getMinutes()&&0===r.getSeconds()){const e=r.getTime()-n.getTime();e>0&&e<864e5&&(i=new Date(o),i.setDate(i.getDate()-1))}const s=a.toDateString()!==i.toDateString();if(!s||e.allDay)if(s&&e.allDay){const a=new Date(n);for(;a<=r;){const n=ou.PlainDate.from({year:a.getFullYear(),month:a.getMonth()+1,day:a.getDate()});t.push(Object.assign(Object.assign({},e),{start:n,end:n,day:a.getDay()})),a.setDate(a.getDate()+1)}}else t.push(Object.assign(Object.assign({},e),{start:e.start,end:e.end,day:n.getDay()}))}),t})(g),[g]),B=t(()=>(e=>{const t=[...e].sort((e,t)=>{const n=e.endDayIndex-e.startDayIndex+1,r=t.endDayIndex-t.startDayIndex+1;return e.startDayIndex>t.startDayIndex?1:n!==r?r-n:e.startDayIndex-t.startDayIndex}),n=[];t.forEach(e=>{let t=0,r=!1;for(;!r;)n.some(n=>{var r;const a=Math.abs((null!==(r=n.yPosition)&&void 0!==r?r:0)-t)<16,o=!(e.endDayIndex<n.startDayIndex||e.startDayIndex>n.endDayIndex);return a&&o})?t+=16:r=!0;n.push(Object.assign(Object.assign({},e),{yPosition:t}))});const r=[];return n.forEach(e=>{var t;const n=Math.floor((null!==(t=e.yPosition)&&void 0!==t?t:0)/16);r[n]||(r[n]=[]),r[n].push(e)}),r.forEach(e=>{e.sort((e,t)=>e.startDayIndex-t.startDayIndex)}),r})(z),[z]),W=t(()=>{const e=Array(7).fill(0);return B.forEach((t,n)=>{t.forEach(t=>{for(let r=t.startDayIndex;r<=t.endDayIndex;r++)e[r]=Math.max(e[r],n+1)})}),e},[B]),U=t(()=>Math.max(0,17*B.length),[B]),q=(t,n)=>{var a;const o=t.month===Fu.indexOf(e)&&t.year===r;var s;const u=(e=>[...e].sort((e,t)=>e.allDay!==t.allDay?e.allDay?-1:1:e.allDay&&t.allDay?0:Mu(e.start)-Mu(t.start)))((s=t.date,V.filter(e=>{if(!e.start||!e.end)return gu(e.start).toDateString()===s.toDateString();const t=gu(e.start),n=gu(e.end);if(!e.allDay&&0===n.getHours()&&0===n.getMinutes()&&0===n.getSeconds()){const e=n.getTime()-t.getTime();if(e>0&&e<864e5)return t.toDateString()===s.toDateString()}return t.toDateString()===s.toDateString()||n.toDateString()===s.toDateString()}))),h=u.slice(0,Y),g=u.length-h.length,P=g>0,$=[],j=null!==(a=W[n])&&void 0!==a?a:0;for(let e=0;e<j;e++)$.push(d("div",{className:"shrink-0",style:{height:"17px",minHeight:"17px"}},`placeholder-layer-${e}-${t.date.getTime()}`));return h.forEach((e,t)=>{const n=B.flat().find(t=>t.originalEventId===e.id);e.allDay&&n||$.push(d(pg,{event:e,isAllDay:!!e.allDay,isMonthView:!0,calendarRef:m,hourHeight:72,firstHour:0,onEventUpdate:v,onEventDelete:y,onMoveStart:p,onResizeStart:D,isBeingDragged:c&&f.eventId===e.id&&"move"===f.mode,newlyCreatedEventId:i,onDetailPanelOpen:w,selectedEventId:C,onEventSelect:k,detailPanelEventId:T,onDetailPanelToggle:I,customDetailPanelContent:S,customEventDetailDialog:H},`${e.id}-${e.day}-${Mu(e.start)}-${t}`))}),l("div",{className:`\n relative flex flex-col border-r border-gray-200 dark:border-gray-700 last:border-r-0\n ${o?"text-gray-800 dark:text-gray-100":"text-gray-400 dark:text-gray-600"}\n `,style:{height:F},"data-date":(A=t.date,`${A.getFullYear()}-${String(A.getMonth()+1).padStart(2,"0")}-${String(A.getDate()).padStart(2,"0")}`),onDoubleClick:e=>b(e,t.date),onDragOver:R,onDrop:e=>null==O?void 0:O(e,t.date),children:[l("div",{className:"flex items-start justify-between p-2 pb-1 relative z-20",children:[d("div",{className:"flex-1"}),l("div",{className:"flex items-center",children:[d("span",{className:`\n inline-flex items-center justify-center h-5 w-5 rounded-full text-sm font-medium\n ${t.isToday?"bg-blue-500 text-white":o?"text-gray-900 dark:text-gray-100":"text-gray-400 dark:text-gray-600"}\n `,children:t.day}),1===t.day&&d("span",{className:"text-xs text-gray-500 dark:text-gray-400 ml-1",children:t.shortMonthName})]})]}),l("div",{className:"flex-1 overflow-hidden px-1",children:[$,P&&l("div",{className:"text-xs text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 cursor-pointer hover:underline",onClick:e=>{e.stopPropagation(),x?x(t.date):(null==M||M(t.date),null==E||E(N.DAY))},children:["+",g," more"]})]})]},`day-${t.date.getTime()}`);var A};return l("div",{className:"relative select-none border-b border-gray-200 dark:border-gray-700",style:{height:F},children:[L&&d("div",{className:`\n absolute top-10 left-0 z-30 bg-white/50 dark:bg-gray-900/50 py-2 px-2 duration-300\n ${P?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"}\n `,style:{transition:"opacity 0.5s ease",maxWidth:"fit-content"},children:l("span",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:[L.monthName," ",L.year]})}),d("div",{className:"h-full flex flex-col",children:l("div",{className:"calendar-week relative h-full",children:[d("div",{className:"grid grid-cols-7 h-full",children:A.days.map((e,t)=>q(e,t))}),B.length>0&&d("div",{className:"absolute left-0 right-0 pointer-events-none",style:{top:"33px",height:`${U}px`,zIndex:10},children:B.map((e,t)=>d("div",{className:"absolute inset-0",children:e.map(e=>d(pg,{event:e.event,isAllDay:!!e.event.allDay,segment:e,segmentIndex:t,isMonthView:!0,isMultiDay:!0,calendarRef:m,hourHeight:72,firstHour:0,onEventUpdate:v,onEventDelete:y,onMoveStart:p,onResizeStart:D,isBeingDragged:c&&f.eventId===e.event.id&&"move"===f.mode,isBeingResized:c&&f.eventId===e.event.id&&"resize"===f.mode,newlyCreatedEventId:i,onDetailPanelOpen:w,selectedEventId:C,onEventSelect:k,detailPanelEventId:T,onDetailPanelToggle:I,customDetailPanelContent:S,customEventDetailDialog:H},e.id))},`layer-${t}`))})]})})]})});cf.displayName="WeekComponent";const uf=({app:e,customDetailPanelContent:r,customEventDetailDialog:i,calendarRef:s,switcherMode:c="buttons"})=>{const u=e.getCurrentDate(),h=e.getEvents(),g=o(null),f=t(()=>{const e=g.current;return e&&e.length===h.length&&e.every((e,t)=>e===h[t])?e:(g.current=h,h)},[h]),m=t(()=>{const e=new Map,t=e=>{const t=new Date(e);t.setHours(0,0,0,0);const n=t.getDay(),r=0===n?-6:1-n;return t.setDate(t.getDate()+r),t.setHours(0,0,0,0),t},n=(t,n)=>{const r=e.get(t);r?r.push(n):e.set(t,[n])};return f.forEach(e=>{if(!e.start)return;const r=gu(e.start),a=e.end?gu(e.end):r,o=new Date(r);o.setHours(0,0,0,0);const i=new Date(a);i.setHours(0,0,0,0);let s=new Date(i);if(!e.allDay){0!==a.getHours()||0!==a.getMinutes()||0!==a.getSeconds()||0!==a.getMilliseconds()||s.setDate(s.getDate()-1)}s<o&&(s=new Date(o));const l=t(o),d=t(s);let c=l.getTime();const u=d.getTime();for(;c<=u;){n(c,e);const t=new Date(c);t.setDate(t.getDate()+7),t.setHours(0,0,0,0),c=t.getTime()}}),e},[f]),{screenSize:v}=lf(),[y,p]=n(()=>{if("undefined"!=typeof window){const e=150,t=window.innerHeight-e;return Math.max(80,Math.floor(t/6))}return 119}),[b,D]=n(!1),w=o(y),x=o([]),[E,M]=n(null),[C,k]=n(null),[T,I]=n(null),S=t(()=>{const e=u.getDay(),t=u.getDate()-e+(0===e?-6:1),n=new Date(u);return n.setDate(t),n.setHours(0,0,0,0),n},[u]),{handleMoveStart:H,handleCreateStart:O,handleResizeStart:R,dragState:P,isDragging:$}=$g(e,{calendarRef:s,viewType:N.MONTH,onEventsUpdate:(t,n)=>{const r=t(f),a=new Set(r.map(e=>e.id)),o=f.filter(e=>!a.has(e.id)),i=new Set(f.map(e=>e.id)),s=r.filter(e=>!i.has(e.id)),l=r.filter(e=>{if(!i.has(e.id))return!1;const t=f.find(t=>t.id===e.id);return t&&(gu(t.start).getTime()!==gu(e.start).getTime()||gu(t.end).getTime()!==gu(e.end).getTime()||t.day!==e.day||Mu(t.start)!==Mu(e.start)||Mu(t.end)!==Mu(e.end)||t.title!==e.title||(null==t?void 0:t.start)!==(null==e?void 0:e.start)||(null==t?void 0:t.end)!==(null==e?void 0:e.end))});o.forEach(t=>e.deleteEvent(t.id)),s.forEach(t=>e.addEvent(t)),l.forEach(t=>e.updateEvent(t.id,t,n))},onEventCreate:t=>{e.addEvent(t)},onEventEdit:e=>{M(e.id)},currentWeekStart:S,events:f}),{handleDrop:j,handleDragOver:Y}=Fg({app:e,onEventCreated:e=>{M(e.id)}}),{currentMonth:A,currentYear:L,isScrolling:Z,virtualData:F,scrollElementRef:z,handleScroll:V,handlePreviousMonth:B,handleNextMonth:W,handleToday:U,setScrollTop:q}=df({currentDate:u,weekHeight:y,onCurrentMonthChange:(t,n)=>{const r=Fu.indexOf(t);r>=0&&e.setVisibleMonth(new Date(n,r,1))},initialWeeksToLoad:156}),_=o(0),[X,G]=n(0),J=t(()=>X-6*y,[X,y]),{visibleWeeks:K,startIndex:Q}=t(()=>{const{visibleItems:e,displayStartIndex:t}=F,n=e.findIndex(e=>e.index===t);if(-1===n)return x.current.length>0?{visibleWeeks:x.current,startIndex:_.current}:{visibleWeeks:[],startIndex:t};const r=e.slice(n,n+8);return r.length>=6&&(x.current=r,_.current=t),{visibleWeeks:r,startIndex:t}},[F]),ee=t(()=>Q*y,[Q,y]),te=t(()=>{const e=F.totalHeight,t=Q*y+16*y+J;return Math.max(0,e-t)},[F.totalHeight,Q,y,J]);a(()=>{const e=z.current;if(!e)return;const t=new ResizeObserver(t=>{for(const n of t){const t=n.contentRect.height;if(G(t),!b&&t>0){const n=Math.max(80,Math.floor(t/6));if(n!==w.current){const t=e.scrollTop;if(t>0){const r=Math.round(t/w.current)*n;e.scrollTop=r,q(r)}}p(n),w.current=n,requestAnimationFrame(()=>{D(!0)})}}});return t.observe(e),()=>{t.disconnect()}},[z,b,q]);const ne=t=>{e.updateEvent(t.id,t)},re=t=>{e.deleteEvent(t)},ae=t=>{e.changeView(t)};return l("div",{className:"h-full flex flex-col bg-white dark:bg-gray-900",children:[d(Zg,{calendar:e,viewType:N.MONTH,currentDate:u,customTitle:`${A} ${L}`,onPrevious:B,onNext:W,onToday:U,switcherMode:c}),d("div",{className:"sticky top-0 z-10 bg-white dark:bg-gray-900 border-b border-gray-200 dark:border-gray-700",children:d("div",{className:"grid grid-cols-7 px-2",children:Lu.map((e,t)=>d("div",{className:"text-right text-gray-500 dark:text-gray-400 text-sm py-2 pr-2",children:e},t))})}),l("div",{ref:z,className:"flex-1 overflow-auto will-change-scroll",style:{scrollSnapType:"y mandatory",overflow:"hidden auto",visibility:b?"visible":"hidden"},onScroll:V,children:[d("div",{style:{height:ee}}),K.map((t,n)=>{var a;const o=null!==(a=m.get(t.weekData.startDate.getTime()))&&void 0!==a?a:[],l=5===n?Object.assign(Object.assign({},t),{height:t.height+J}):t;return d(cf,{item:l,weekHeight:y,currentMonth:A,currentYear:L,screenSize:v,isScrolling:Z,calendarRef:s,events:o,onEventUpdate:ne,onEventDelete:re,onMoveStart:H,onCreateStart:O,onResizeStart:R,isDragging:$,dragState:P,newlyCreatedEventId:E,onDetailPanelOpen:()=>M(null),onChangeView:ae,onSelectDate:e.selectDate,selectedEventId:C,onEventSelect:k,detailPanelEventId:T,onDetailPanelToggle:I,customDetailPanelContent:r,customEventDetailDialog:i,onCalendarDrop:j,onCalendarDragOver:Y},`week-${t.weekData.startDate.getTime()}`)}),d("div",{style:{height:te}})]})]})},hf={enableDrag:!0,enableResize:!1,enableCreate:!0,showOtherMonth:!0,weekHeight:120,showWeekNumbers:!1,enableVirtualScroll:!0,initialWeeksToLoad:156,dragConfig:{supportedViews:[N.MONTH],enableAllDayCreate:!1},eventsConfig:{enableAutoRecalculate:!0,enableValidation:!0},virtualScrollConfig:{weekHeight:120,initialWeeksToLoad:156,enableVirtualScroll:!0,enableKeyboardNavigation:!0,supportedViews:[N.MONTH]},viewConfig:{showOtherMonth:!0,weekHeight:120,showWeekNumbers:!1,enableVirtualScroll:!0}},gf=(t={})=>{const n=Object.assign(Object.assign({},hf),t),r=t=>e.createElement(Lh,{viewType:N.MONTH,originalComponent:uf,app:t.app,config:n,className:"month-view-factory",customDetailPanelContent:t.customDetailPanelContent,customEventDetailDialog:t.customEventDetailDialog,calendarRef:t.calendarRef,switcherMode:t.switcherMode,meta:t.meta});return r.displayName="MonthViewAdapter",{type:N.MONTH,component:r,config:n}},ff=({app:t,switcherMode:o="buttons"})=>{const i=t.getCurrentDate(),{yearHeight:s,screenSize:c}=of(),[u,h]=n(!1);e.useRef(0),e.useRef(0),e.useRef(!1);const[g,f]=n({stickyOffset:0,nextOffset:0,showNext:!1}),m=e.useRef(new af),v=e.useRef(new Date),{currentYear:y,isScrolling:p,virtualData:b,scrollElementRef:D,handleScroll:w,scrollToYear:x,handlePreviousYear:E,handleNextYear:M,handleToday:C}=sf({currentDate:i,yearHeight:s}),k=r((e,t)=>{const n=new Date(e,t,1),r=0===n.getDay()?6:n.getDay()-1,a=[],o=v.current,s=i;for(let n=0;n<42;n++){const i=new Date(e,t,n-r+1),l=i.getDate(),d=i.getMonth()===t;a.push({date:l,isCurrentMonth:d,isToday:d&&i.toDateString()===o.toDateString(),isSelected:d&&i.toDateString()===s.toDateString(),fullDate:i})}return{year:e,month:t,monthName:Fu[t],days:a}},[i]),T=r(e=>{let t=m.current.get(e);if(!t){const n=[];for(let t=0;t<12;t++)n.push(k(e,t));t={year:e,months:n},m.current.set(e,t)}return t},[k]),I=r(()=>{t.goToToday(),C()},[t,C]);a(()=>{const e=e=>{if(!e.repeat)switch(e.key){case"ArrowUp":e.preventDefault(),E();break;case"ArrowDown":e.preventDefault(),M();break;case"Home":e.preventDefault(),I();break;case"PageUp":e.preventDefault();const t=Math.max(Gg,y-5);x(t);break;case"PageDown":e.preventDefault();const n=Math.min(Jg,y+5);x(n);break;case"F12":e.shiftKey&&(e.preventDefault(),h(!u))}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[y,E,M,I,x,u]);const S=e.memo(({monthData:e})=>l("div",{className:"h-fit",children:[d("div",{className:`text-red-600 font-semibold mb-2 sm:mb-3 ${"mobile"===c?"text-xs":"text-xs sm:text-sm"} `,children:e.monthName}),d("div",{className:"grid grid-cols-7 gap-0 mb-1 sm:mb-2",children:["M","T","W","T","F","S","S"].map((e,t)=>d("div",{className:"text-center text-gray-500 py-0.5 text-xs w-10",children:e},t))}),d("div",{className:"grid grid-cols-7 gap-0",children:e.days.map((e,n)=>d("button",{className:`\n text-center rounded-sm transition-colors\n w-10\n ${"mobile"===c?"text-xs py-1 min-h-[18px]":"text-xs py-1 sm:py-1.5 min-h-[20px] sm:min-h-[26px]"}\n ${e.isCurrentMonth?"text-gray-900 font-medium hover:bg-gray-100 active:bg-gray-200":"text-gray-300 cursor-not-allowed"}\n ${e.isToday?"bg-red-500 text-white hover:bg-red-600 font-bold shadow-sm ring-2 ring-red-200":""}\n ${e.isSelected&&!e.isToday?"bg-red-100 text-red-600 font-semibold ring-1 ring-red-300":""}\n `,onClick:()=>e.isCurrentMonth&&t.selectDate(e.fullDate),disabled:!e.isCurrentMonth,children:e.date},n))})]})),H=e.memo(({item:e})=>{const t=T(e.year);return d("div",{className:"absolute w-full",style:{top:e.top,height:e.height,contain:"layout style paint"},children:l("div",{className:"px-4 bg-white",children:[d("div",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 py-3 px-2",children:e.year}),d("div",{className:"mx-auto px-2",children:d("div",{className:"grid "+("mobile"===c?"grid-cols-2 grid-rows-6 gap-2":"tablet"===c?"grid-cols-3 grid-rows-4 gap-3":"grid-cols-4 grid-rows-3 gap-4"),children:t.months.map(e=>d(S,{monthData:e},`${e.year}-${e.month}`))})})]})})});return S.displayName="MonthComponent",H.displayName="VirtualYearItem",l("div",{className:"relative flex flex-col bg-white shadow-md w-full overflow-hidden h-full",children:[d(Zg,{calendar:t,viewType:N.YEAR,currentDate:i,onPrevious:()=>t.goToPrevious(),onNext:()=>t.goToNext(),onToday:()=>t.goToToday(),switcherMode:o,stickyYear:y,stickyYearOffset:0,nextYear:null,nextYearOffset:0}),p&&d("div",{className:"absolute top-24 left-1/2 transform -translate-x-1/2 z-40 bg-white/95 backdrop-blur-sm py-2 px-4 rounded-lg shadow-lg border border-gray-200 transition-all duration-200 pointer-events-none",children:d("span",{className:"text-xl font-bold text-gray-900",children:y})}),d("div",{ref:D,className:"flex-1 overflow-auto bg-gray-50",onScroll:w,style:{contain:"layout style paint",scrollBehavior:"auto"},children:d("div",{className:"relative",style:{height:b.totalHeight},children:b.visibleItems.map(e=>d(H,{item:e},e.year))})}),d("div",{className:"absolute right-2 top-1/2 transform -translate-y-1/2 opacity-30 hover:opacity-70 transition-opacity",children:l("div",{className:"bg-gray-800 text-white text-xs px-2 py-1 rounded",children:[Math.round((y-Gg)/(Jg-Gg)*100),"%"]})})]})},mf={enableDrag:!1,enableResize:!1,enableCreate:!1,enableVirtualScroll:!0,showDebugInfo:!1,eventsConfig:{enableAutoRecalculate:!1,enableValidation:!0},viewConfig:{enableVirtualScroll:!0,showDebugInfo:!1}},vf=(t={})=>{const n=Object.assign(Object.assign({},mf),t),r=t=>e.createElement(Lh,{viewType:N.YEAR,originalComponent:ff,app:t.app,config:n,className:"year-view-factory",customDetailPanelContent:t.customDetailPanelContent,customEventDetailDialog:t.customEventDetailDialog,calendarRef:t.calendarRef,meta:t.meta});return r.displayName="YearViewAdapter",{type:N.YEAR,component:r,config:n}},yf={enableAutoRecalculate:!0,enableValidation:!0,defaultEvents:[],maxEventsPerDay:50};function pf(e={}){const t=Object.assign(Object.assign({},yf),e);let n;const r={getAll:()=>n.getAllEvents(),getById:e=>n.getAllEvents().find(t=>t.id===e),add:e=>{if(t.enableValidation){const t=r.validateEvent(e);if(t.length>0)throw new Error(`Event validation failed: ${t.join(", ")}`)}if(t.maxEventsPerDay&&void 0!==e.day){if(r.getByDay(e.day,n.getCurrentDate()).length>=t.maxEventsPerDay)throw new Error(`Maximum events per day (${t.maxEventsPerDay}) exceeded`)}if(n.addEvent(e),t.enableAutoRecalculate){const e=a(n.getCurrentDate()),t=ah(n.getAllEvents(),e);n.state.events=t}},update:(e,o)=>{const i=r.getById(e);if(!i)throw new Error(`Event with id ${e} not found`);const s=Object.assign(Object.assign({},i),o);if(t.enableValidation){const e=r.validateEvent(s);if(e.length>0)throw new Error(`Event validation failed: ${e.join(", ")}`)}if(n.updateEvent(e,o),t.enableAutoRecalculate){const e=a(n.getCurrentDate()),t=ah(n.getAllEvents(),e);n.state.events=t}return n.getAllEvents().find(t=>t.id===e)},delete:e=>{n.deleteEvent(e)},getByDate:e=>n.getAllEvents().filter(t=>{const n=gu(t.start);n.setHours(0,0,0,0);const r=new Date(e);return r.setHours(0,0,0,0),n.getTime()===r.getTime()}),getByDateRange:(e,t)=>n.getAllEvents().filter(n=>{const r=gu(n.start),a=gu(n.end);return r>=e&&r<=t||a>=e&&a<=t||r<=e&&a>=t}),getByDay:(e,t)=>n.getAllEvents().filter(t=>t.day===e),getAllDayEvents:(e,t)=>t.filter(t=>t.day===e&&t.allDay),recalculateEventDays:(e,t)=>ah(e,t),validateEvent:e=>{const t=[];return e.title&&""!==e.title.trim()||t.push("Event title is required"),e.start||t.push("Event start time is required"),e.end||t.push("Event end time is required"),e.start&&e.end&&!e.allDay&&e.start>=e.end&&t.push("Start time must be before end time"),e.id&&"string"!=typeof e.id&&t.push("Event ID must be a string"),t},filterEvents:(e,t)=>e.filter(t)};function a(e){const t=e.getDay(),n=e.getDate()-t+(0===t?-6:1),r=new Date(e);return r.setDate(n),r.setHours(0,0,0,0),r}return{name:"events",config:t,install:e=>{n=e,Z.log("Events plugin installed - providing event management services")},api:r}}export{V as CalendarApp,pg as CalendarEvent,Y as CalendarRegistry,gh as ColorPicker,Ah as DayFlowCalendar,Nh as DefaultEventDetailDialog,vg as DefaultEventDetailPanel,yg as EventDetailPanelWithContent,Tg as EventLayoutCalculator,Pu as TIME_STEP,jh as ThemeProvider,Zg as ViewHeader,N as ViewType,wu as addDays,ph as buildParseRegExp,nh as calculateDayIndex,Hh as conditionalTheme,cg as convertDateEvent,ug as convertDateEventWithTimeZone,lg as createAllDayEvent,Cu as createDateWithHour,Bg as createDayView,Pg as createDragPlugin,ag as createEvent,th as createEventWithDate,sh as createEventWithRealDate,ig as createEvents,pf as createEventsPlugin,gf as createMonthView,fu as createTemporalWithHour,dg as createTimedEvent,og as createTimezoneEvent,sg as createTimezoneEvents,qg as createWeekView,vf as createYearView,qh as dateToPlainDate,_h as dateToPlainDateTime,Xh as dateToZonedDateTime,bu as daysBetween,Du as daysDifference,Mu as extractHourFromDate,Kh as extractHourFromTemporal,zh as formatDate,Zh as formatDateConsistent,ju as formatEventTimeRange,Fh as formatMonthYear,xh as formatTemporal,$u as formatTime,Wu as generateDayData,ch as generateUniKey,Uu as generateWeekData,Xu as generateWeekRange,_u as generateWeeksData,Ju as getAllDayEventsForDay,Bu as getCurrentWeekDates,Ku as getDateByDayIndex,oh as getDayIndexByDate,Tu as getEndOfDay,pu as getEndOfTemporal,Su as getEventBgColor,Au as getEventEndHour,Hu as getEventTextColor,Gu as getEventsForDay,ih as getEventsForWeek,Ru as getLineColor,qu as getMonthYearOfWeek,tg as getPlainDate,Ou as getSelectedBgColor,ku as getStartOfDay,yu as getStartOfTemporal,dh as getTestEvents,Vu as getWeekRange,Dh as getZoneId,du as isDate,rh as isEventInWeek,Iu as isMultiDayEvent,vu as isMultiDayTemporalEvent,Vh as isPlainDate,Bh as isPlainDateTime,Nu as isSameDay,mu as isSamePlainDate,eg as isSameTemporal,Wh as isZonedDateTime,Oh as mergeClasses,vh as mergeFormatTemplate,Fu as monthNames,F as normalizeCssWidth,wh as normalizeToZoned,xu as now,mh as pad,bh as parseTemporalString,Gh as plainDateTimeToDate,Jh as plainDateToDate,ah as recalculateEventDays,Rh as resolveAppliedTheme,Yu as roundToTimeStep,Qh as setHourInTemporal,zu as shortMonthNames,Uh as temporalToDate,Sh as themeClasses,Ih as themeCn,Eu as today,Qu as updateEventDateAndDay,lh as updateEventWithRealDate,B as useCalendarApp,Rg as useDrag,$g as useDragForView,of as useResponsiveConfig,lf as useResponsiveMonthConfig,Yh as useTheme,df as useVirtualMonthScroll,sf as useVirtualScroll,Lu as weekDays,Zu as weekDaysFullName,hu as zonedDateTimeToDate};