@mlw-packages/react-components 1.7.17 → 1.7.19

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.js CHANGED
@@ -486,7 +486,9 @@ var require_colors2 = __commonJS({
486
486
  var index_exports = {};
487
487
  __export(index_exports, {
488
488
  AddButton: () => AddButton,
489
+ Agenda: () => Agenda,
489
490
  AgendaDaysToShow: () => AgendaDaysToShow,
491
+ AgendaDaysToShowAgenda: () => AgendaDaysToShowAgenda,
490
492
  AgendaView: () => AgendaView,
491
493
  AlertDialogActionBase: () => AlertDialogActionBase,
492
494
  AlertDialogBase: () => AlertDialogBase,
@@ -517,6 +519,7 @@ __export(index_exports, {
517
519
  ButtonGroupBase: () => ButtonGroupBase,
518
520
  CalendarBase: () => CalendarBase,
519
521
  CalendarDndProvider: () => CalendarDndProvider,
522
+ CalendarDndProviderAgenda: () => CalendarDndProviderAgenda,
520
523
  CardBase: () => CardBase,
521
524
  CardContentBase: () => CardContentBase,
522
525
  CardDescriptionBase: () => CardDescriptionBase,
@@ -567,9 +570,12 @@ __export(index_exports, {
567
570
  CopyButton: () => CopyButton,
568
571
  DateTimePicker: () => DateTimePicker,
569
572
  DayView: () => DayView,
573
+ DayViewAgenda: () => DayViewAgenda,
570
574
  DebouncedInput: () => DebouncedInput,
571
575
  DefaultEndHour: () => DefaultEndHour,
576
+ DefaultEndHourAgenda: () => DefaultEndHourAgenda,
572
577
  DefaultStartHour: () => DefaultStartHour,
578
+ DefaultStartHourAgenda: () => DefaultStartHourAgenda,
573
579
  DestructiveDialog: () => DestructiveDialog,
574
580
  DialogBase: () => DialogBase,
575
581
  DialogCloseBase: () => DialogCloseBase,
@@ -610,14 +616,20 @@ __export(index_exports, {
610
616
  DropDownMenuSubTriggerBase: () => DropDownMenuSubTriggerBase,
611
617
  DropDownMenuTriggerBase: () => DropDownMenuTriggerBase,
612
618
  DroppableCell: () => DroppableCell,
619
+ DroppableCellAgenda: () => DroppableCellAgenda,
613
620
  EditButton: () => EditButton,
614
621
  EndHour: () => EndHour,
622
+ EndHourAgenda: () => EndHourAgenda,
615
623
  ErrorMessage: () => ErrorMessage_default,
624
+ EventAgenda: () => EventAgenda,
616
625
  EventCalendar: () => EventCalendar,
617
626
  EventDialog: () => EventDialog,
618
627
  EventGap: () => EventGap,
628
+ EventGapAgenda: () => EventGapAgenda,
619
629
  EventHeight: () => EventHeight,
630
+ EventHeightAgenda: () => EventHeightAgenda,
620
631
  EventItem: () => EventItem,
632
+ EventItemAgenda: () => EventItemAgenda,
621
633
  EventsPopup: () => EventsPopup,
622
634
  FavoriteButton: () => FavoriteButton,
623
635
  FileUploader: () => FileUploader,
@@ -649,6 +661,7 @@ __export(index_exports, {
649
661
  ModalTriggerBase: () => ModalTriggerBase,
650
662
  ModeToggleBase: () => ModeToggleBase,
651
663
  MonthView: () => MonthView,
664
+ MonthViewAgenda: () => MonthViewAgenda,
652
665
  MoreButton: () => MoreButton,
653
666
  MultiCombobox: () => MultiCombobox,
654
667
  MultiSelectBase: () => MultiSelectBase,
@@ -734,6 +747,7 @@ __export(index_exports, {
734
747
  SkeletonBase: () => SkeletonBase,
735
748
  SlideBase: () => SlideBase,
736
749
  StartHour: () => StartHour,
750
+ StartHourAgenda: () => StartHourAgenda,
737
751
  StatusIndicator: () => StatusIndicator,
738
752
  SwitchBase: () => SwitchBase,
739
753
  TableBase: () => TableBase,
@@ -759,6 +773,7 @@ __export(index_exports, {
759
773
  TooltipSimple: () => TooltipSimple_default,
760
774
  TooltipTriggerBase: () => TooltipTriggerBase,
761
775
  TooltipWithTotal: () => TooltipWithTotal_default,
776
+ UndatedEvents: () => UndatedEvents,
762
777
  UniversalTooltipRenderer: () => UniversalTooltipRenderer,
763
778
  UnlockButton: () => UnlockButton,
764
779
  UploadButton: () => UploadButton,
@@ -766,8 +781,11 @@ __export(index_exports, {
766
781
  ViewButton: () => ViewButton,
767
782
  VisibilityButton: () => VisibilityButton,
768
783
  WeekCellsHeight: () => WeekCellsHeight,
784
+ WeekCellsHeightAgenda: () => WeekCellsHeightAgenda,
769
785
  WeekView: () => WeekView,
786
+ WeekViewAgenda: () => WeekViewAgenda,
770
787
  addHoursToDate: () => addHoursToDate,
788
+ addHoursToDateAgenda: () => addHoursToDateAgenda,
771
789
  badgeVariants: () => badgeVariants,
772
790
  buttonVariantsBase: () => buttonVariantsBase,
773
791
  compactTick: () => compactTick,
@@ -778,13 +796,19 @@ __export(index_exports, {
778
796
  formatFieldName: () => formatFieldName,
779
797
  generateAdditionalColors: () => generateAdditionalColors,
780
798
  getAgendaEventsForDay: () => getAgendaEventsForDay,
799
+ getAgendaEventsForDayAgenda: () => getAgendaEventsForDayAgenda,
781
800
  getAllEventsForDay: () => getAllEventsForDay,
801
+ getAllEventsForDayAgenda: () => getAllEventsForDayAgenda,
782
802
  getArrowByType: () => getArrowByType,
783
803
  getBorderRadiusClasses: () => getBorderRadiusClasses,
804
+ getBorderRadiusClassesAgenda: () => getBorderRadiusClassesAgenda,
784
805
  getDateByType: () => getDateByType,
785
806
  getEventColorClasses: () => getEventColorClasses,
807
+ getEventColorClassesAgenda: () => getEventColorClassesAgenda,
786
808
  getEventsForDay: () => getEventsForDay,
809
+ getEventsForDayAgenda: () => getEventsForDayAgenda,
787
810
  getSpanningEventsForDay: () => getSpanningEventsForDay,
811
+ getSpanningEventsForDayAgenda: () => getSpanningEventsForDayAgenda,
788
812
  getValid12Hour: () => getValid12Hour,
789
813
  getValidArrow12Hour: () => getValidArrow12Hour,
790
814
  getValidArrowHour: () => getValidArrowHour,
@@ -794,10 +818,12 @@ __export(index_exports, {
794
818
  getValidMinuteOrSecond: () => getValidMinuteOrSecond,
795
819
  getValidNumber: () => getValidNumber,
796
820
  isMultiDayEvent: () => isMultiDayEvent,
821
+ isMultiDayEventAgenda: () => isMultiDayEventAgenda,
797
822
  isValid12Hour: () => isValid12Hour,
798
823
  isValidHour: () => isValidHour,
799
824
  isValidMinuteOrSecond: () => isValidMinuteOrSecond,
800
825
  niceCeil: () => niceCeil,
826
+ normalizeAttendDate: () => normalizeAttendDate,
801
827
  renderInsideBarLabel: () => renderInsideBarLabel,
802
828
  renderPillLabel: () => pillLabelRenderer_default,
803
829
  resolveChartMargins: () => resolveChartMargins,
@@ -808,12 +834,16 @@ __export(index_exports, {
808
834
  setMinutes: () => setMinutes,
809
835
  setSeconds: () => setSeconds,
810
836
  sortEvents: () => sortEvents,
837
+ sortEventsAgenda: () => sortEventsAgenda,
811
838
  toast: () => toast2,
812
839
  useCalendarDnd: () => useCalendarDnd,
840
+ useCalendarDndAgenda: () => useCalendarDndAgenda,
813
841
  useChartHighlights: () => useChartHighlights,
814
842
  useCurrentTimeIndicator: () => useCurrentTimeIndicator,
843
+ useCurrentTimeIndicatorAgenda: () => useCurrentTimeIndicatorAgenda,
815
844
  useDrag: () => useDrag,
816
845
  useEventVisibility: () => useEventVisibility,
846
+ useEventVisibilityAgenda: () => useEventVisibilityAgenda,
817
847
  useIsMobile: () => useIsMobile,
818
848
  useTheme: () => useTheme
819
849
  });
@@ -12387,7 +12417,7 @@ function AgendaView({
12387
12417
  onEventSelect,
12388
12418
  showUndatedEvents = false
12389
12419
  }) {
12390
- const isValidDate3 = (d) => {
12420
+ const isValidDate6 = (d) => {
12391
12421
  try {
12392
12422
  const t = d instanceof Date ? d.getTime() : new Date(String(d)).getTime();
12393
12423
  return !isNaN(t);
@@ -12396,11 +12426,11 @@ function AgendaView({
12396
12426
  }
12397
12427
  };
12398
12428
  const datedEvents = (0, import_react52.useMemo)(
12399
- () => events.filter((e) => isValidDate3(e.start) && isValidDate3(e.end)),
12429
+ () => events.filter((e) => isValidDate6(e.start) && isValidDate6(e.end)),
12400
12430
  [events]
12401
12431
  );
12402
12432
  const undatedEvents = (0, import_react52.useMemo)(
12403
- () => events.filter((e) => !(isValidDate3(e.start) && isValidDate3(e.end))),
12433
+ () => events.filter((e) => !(isValidDate6(e.start) && isValidDate6(e.end))),
12404
12434
  [events]
12405
12435
  );
12406
12436
  const days = (0, import_react52.useMemo)(() => {
@@ -13090,19 +13120,14 @@ function EventCalendar({
13090
13120
  onEventUpdate,
13091
13121
  onEventDelete,
13092
13122
  className,
13093
- initialView = "month",
13094
- mode = "default"
13123
+ initialView = "month"
13095
13124
  }) {
13096
- const isAgendaOnly = mode === "agenda-only";
13097
13125
  const [currentDate, setCurrentDate] = (0, import_react58.useState)(/* @__PURE__ */ new Date());
13098
- const [view, setView] = (0, import_react58.useState)(
13099
- isAgendaOnly ? "agenda" : initialView
13100
- );
13126
+ const [view, setView] = (0, import_react58.useState)(initialView);
13101
13127
  const [isFading, setIsFading] = (0, import_react58.useState)(false);
13102
13128
  const FADE_DURATION = 220;
13103
13129
  const changeView = (0, import_react58.useCallback)(
13104
13130
  (next) => {
13105
- if (isAgendaOnly) return;
13106
13131
  if (next === view) return;
13107
13132
  setIsFading(true);
13108
13133
  window.setTimeout(() => {
@@ -13110,7 +13135,7 @@ function EventCalendar({
13110
13135
  requestAnimationFrame(() => setIsFading(false));
13111
13136
  }, FADE_DURATION);
13112
13137
  },
13113
- [view, isAgendaOnly]
13138
+ [view]
13114
13139
  );
13115
13140
  const [isPaging, setIsPaging] = (0, import_react58.useState)(false);
13116
13141
  const [pageDirection, setPageDirection] = (0, import_react58.useState)(
@@ -13140,7 +13165,6 @@ function EventCalendar({
13140
13165
  if (isEventDialogOpen || e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLElement && e.target.isContentEditable) {
13141
13166
  return;
13142
13167
  }
13143
- if (isAgendaOnly) return;
13144
13168
  switch (e.key.toLowerCase()) {
13145
13169
  case "m":
13146
13170
  changeView("month");
@@ -13161,7 +13185,7 @@ function EventCalendar({
13161
13185
  return () => {
13162
13186
  window.removeEventListener("keydown", handleKeyDown);
13163
13187
  };
13164
- }, [isEventDialogOpen, changeView, isAgendaOnly]);
13188
+ }, [isEventDialogOpen, changeView]);
13165
13189
  const handlePrevious = () => {
13166
13190
  pageTransition(() => {
13167
13191
  if (view === "month") {
@@ -13192,13 +13216,11 @@ function EventCalendar({
13192
13216
  setCurrentDate(/* @__PURE__ */ new Date());
13193
13217
  };
13194
13218
  const handleEventSelect = (event) => {
13195
- if (isAgendaOnly) return;
13196
13219
  console.log("Event selected:", event);
13197
13220
  setSelectedEvent(event);
13198
13221
  setIsEventDialogOpen(true);
13199
13222
  };
13200
13223
  const handleEventCreate = (startTime) => {
13201
- if (isAgendaOnly) return;
13202
13224
  console.log("Creating new event at:", startTime);
13203
13225
  const minutes = startTime.getMinutes();
13204
13226
  const remainder = minutes % 15;
@@ -13225,9 +13247,13 @@ function EventCalendar({
13225
13247
  if (event.id) {
13226
13248
  onEventUpdate?.(event);
13227
13249
  (0, import_sonner3.toast)(`Evento "${event.title}" atualizado`, {
13228
- description: (0, import_date_fns7.format)(new Date(event.start), "d 'de' MMMM 'de' yyyy", {
13229
- locale: import_locale3.ptBR
13230
- }),
13250
+ description: (0, import_date_fns7.format)(
13251
+ new Date(event.start ?? event.attend_date ?? event.end ?? Date.now()),
13252
+ "d 'de' MMMM 'de' yyyy",
13253
+ {
13254
+ locale: import_locale3.ptBR
13255
+ }
13256
+ ),
13231
13257
  position: "bottom-left"
13232
13258
  });
13233
13259
  } else {
@@ -13236,9 +13262,11 @@ function EventCalendar({
13236
13262
  id: Math.random().toString(36).substring(2, 11)
13237
13263
  });
13238
13264
  (0, import_sonner3.toast)(`Evento "${event.title}" adicionado`, {
13239
- description: (0, import_date_fns7.format)(new Date(event.start), "d 'de' MMMM 'de' yyyy", {
13240
- locale: import_locale3.ptBR
13241
- }),
13265
+ description: (0, import_date_fns7.format)(
13266
+ new Date(event.start ?? event.attend_date ?? event.end ?? Date.now()),
13267
+ "d 'de' MMMM 'de' yyyy",
13268
+ { locale: import_locale3.ptBR }
13269
+ ),
13242
13270
  position: "bottom-left"
13243
13271
  });
13244
13272
  }
@@ -13253,7 +13281,9 @@ function EventCalendar({
13253
13281
  if (deletedEvent) {
13254
13282
  (0, import_sonner3.toast)(`Evento "${deletedEvent.title}" exclu\xEDdo`, {
13255
13283
  description: (0, import_date_fns7.format)(
13256
- new Date(deletedEvent.start),
13284
+ new Date(
13285
+ deletedEvent.start ?? deletedEvent.attend_date ?? deletedEvent.end ?? Date.now()
13286
+ ),
13257
13287
  "d 'de' MMMM 'de' yyyy",
13258
13288
  { locale: import_locale3.ptBR }
13259
13289
  ),
@@ -13265,7 +13295,9 @@ function EventCalendar({
13265
13295
  onEventUpdate?.(updatedEvent);
13266
13296
  (0, import_sonner3.toast)(`Evento "${updatedEvent.title}" movido`, {
13267
13297
  description: (0, import_date_fns7.format)(
13268
- new Date(updatedEvent.start),
13298
+ new Date(
13299
+ updatedEvent.start ?? updatedEvent.attend_date ?? updatedEvent.end ?? Date.now()
13300
+ ),
13269
13301
  "d 'de' MMMM 'de' yyyy",
13270
13302
  { locale: import_locale3.ptBR }
13271
13303
  ),
@@ -13323,7 +13355,7 @@ function EventCalendar({
13323
13355
  ),
13324
13356
  children: [
13325
13357
  /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center gap-1 sm:gap-4", children: [
13326
- !isAgendaOnly && /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13358
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13327
13359
  ButtonBase,
13328
13360
  {
13329
13361
  className: "max-[479px]:aspect-square max-[479px]:p-0!",
@@ -13366,7 +13398,7 @@ function EventCalendar({
13366
13398
  ] }),
13367
13399
  /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("h2", { className: "font-semibold text-sm sm:text-lg md:text-xl", children: viewTitle })
13368
13400
  ] }),
13369
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "flex items-center gap-2", children: !isAgendaOnly && /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
13401
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
13370
13402
  /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuBase, { children: [
13371
13403
  /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuTriggerBase, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13372
13404
  ButtonBase,
@@ -13411,8 +13443,7 @@ function EventCalendar({
13411
13443
  /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "M" })
13412
13444
  ] }),
13413
13445
  /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("week"), children: [
13414
- "Semana",
13415
- " ",
13446
+ "Semana ",
13416
13447
  /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "S" })
13417
13448
  ] }),
13418
13449
  /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("day"), children: [
@@ -13420,8 +13451,7 @@ function EventCalendar({
13420
13451
  /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "D" })
13421
13452
  ] }),
13422
13453
  /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("agenda"), children: [
13423
- "Agenda",
13424
- " ",
13454
+ "Agenda ",
13425
13455
  /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "A" })
13426
13456
  ] })
13427
13457
  ] })
@@ -13493,8 +13523,7 @@ function EventCalendar({
13493
13523
  {
13494
13524
  currentDate,
13495
13525
  events,
13496
- onEventSelect: isAgendaOnly ? void 0 : handleEventSelect,
13497
- showUndatedEvents: isAgendaOnly
13526
+ onEventSelect: handleEventSelect
13498
13527
  }
13499
13528
  )
13500
13529
  ]
@@ -13523,7 +13552,7 @@ function EventCalendar({
13523
13552
  "--event-height": `${EventHeight}px`,
13524
13553
  "--week-cells-height": `${WeekCellsHeight}px`
13525
13554
  },
13526
- children: isAgendaOnly ? calendarContent : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(CalendarDndProvider, { onEventUpdate: handleEventUpdate, children: calendarContent })
13555
+ children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(CalendarDndProvider, { onEventUpdate: handleEventUpdate, children: calendarContent })
13527
13556
  }
13528
13557
  );
13529
13558
  }
@@ -13993,6 +14022,7 @@ function EventDialog({
13993
14022
  // src/components/event-calendar/EventItem.tsx
13994
14023
  var import_date_fns9 = require("date-fns");
13995
14024
  var import_react62 = require("react");
14025
+ var import_react63 = require("@phosphor-icons/react");
13996
14026
  var import_jsx_runtime80 = require("react/jsx-runtime");
13997
14027
  var formatTimeWithOptionalMinutes = (date) => {
13998
14028
  return (0, import_date_fns9.format)(date, "HH:mm");
@@ -14020,17 +14050,26 @@ function EventWrapper({
14020
14050
  onTouchStart,
14021
14051
  ariaLabel
14022
14052
  }) {
14023
- const hasValidTimeForWrapper = isValidDate(event.start) && isValidDate(event.end);
14024
- const displayEnd = hasValidTimeForWrapper ? currentTime ? new Date(
14025
- new Date(currentTime).getTime() + (new Date(event.end).getTime() - new Date(event.start).getTime())
14026
- ) : new Date(event.end) : void 0;
14053
+ const hasValidTimeForWrapper = isValidDate(event.start) && isValidDate(event.end) || isValidDate(event.attend_date);
14054
+ const displayEnd = (() => {
14055
+ if (isValidDate(event.start) && isValidDate(event.end)) {
14056
+ return currentTime ? new Date(
14057
+ new Date(currentTime).getTime() + (new Date(event.end).getTime() - new Date(event.start).getTime())
14058
+ ) : new Date(event.end);
14059
+ }
14060
+ if (isValidDate(event.attend_date)) {
14061
+ const start = new Date(event.attend_date);
14062
+ return addHoursToDate(start, 1);
14063
+ }
14064
+ return void 0;
14065
+ })();
14027
14066
  const isEventInPast = displayEnd ? (0, import_date_fns9.isPast)(displayEnd) : false;
14028
14067
  const colorClasses = hasValidTimeForWrapper ? getEventColorClasses(event.color) : "bg-gray-200/50 hover:bg-gray-200/40 text-gray-900/80 dark:bg-gray-700/25 dark:text-gray-200/90 shadow-none";
14029
14068
  return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
14030
14069
  "button",
14031
14070
  {
14032
14071
  className: cn(
14033
- "flex w-full select-none overflow-hidden px-3 py-1 text-left font-medium outline-none transition-transform duration-150 ease-out backdrop-blur-sm focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring data-dragging:cursor-grabbing data-past-event:line-through data-dragging:shadow-lg sm:px-3 rounded-lg shadow-sm hover:shadow-md hover:scale-105",
14072
+ "flex w-full select-none overflow-hidden px-3 py-1 text-left font-medium outline-none transition-transform duration-150 ease-out backdrop-blur-sm focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring data-dragging:cursor-grabbing data-past-event:line-through data-dragging:shadow-lg sm:px-3 rounded-lg shadow-sm hover:shadow-md ",
14034
14073
  colorClasses,
14035
14074
  getBorderRadiusClasses(isFirstDay, isLastDay),
14036
14075
  className
@@ -14051,7 +14090,6 @@ function EventWrapper({
14051
14090
  function EventItem({
14052
14091
  event,
14053
14092
  view,
14054
- isDragging,
14055
14093
  onClick,
14056
14094
  showTime,
14057
14095
  currentTime,
@@ -14130,12 +14168,9 @@ function EventItem({
14130
14168
  dndListeners,
14131
14169
  event,
14132
14170
  ariaLabel,
14133
- isDragging,
14134
14171
  isFirstDay,
14135
14172
  isLastDay,
14136
14173
  onClick,
14137
- onMouseDown,
14138
- onTouchStart,
14139
14174
  children: children || /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "flex items-center gap-2 truncate", children: [
14140
14175
  !event.allDay && hasValidTime && displayStart && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "truncate font-normal opacity-80 sm:text-[11px] bg-white/10 px-2 py-0.5 rounded-full text-[11px]", children: formatTimeWithOptionalMinutes(displayStart) }),
14141
14176
  /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
@@ -14167,27 +14202,22 @@ function EventItem({
14167
14202
  dndListeners,
14168
14203
  event,
14169
14204
  ariaLabel,
14170
- isDragging,
14171
14205
  isFirstDay,
14172
14206
  isLastDay,
14173
- onClick,
14174
- onMouseDown,
14175
- onTouchStart,
14176
14207
  children: durationMinutes < 45 ? /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
14177
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: cn("truncate", agendaOnly ? "text-lg" : ""), children: event.title }),
14208
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: cn("truncate text-lg"), children: event.title }),
14178
14209
  showTime && hasValidTime && displayStart && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "ml-2 inline-block bg-white/10 px-2 py-0.5 rounded-full text-[11px] opacity-90", children: formatTimeWithOptionalMinutes(displayStart) })
14179
14210
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
14180
14211
  /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
14181
14212
  "div",
14182
14213
  {
14183
14214
  className: cn(
14184
- "truncate font-medium",
14185
- agendaOnly ? "text-lg" : ""
14215
+ "truncate font-medium text-lg"
14186
14216
  ),
14187
14217
  children: event.title
14188
14218
  }
14189
14219
  ),
14190
- showTime && hasValidTime && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "truncate font-normal opacity-70 sm:text-[11px]", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "inline-block bg-white/5 px-2 py-0.5 rounded-full", children: getEventTime() }) })
14220
+ showTime && hasValidTime && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "truncate font-normal opacity-70 sm:text-[15px]", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "inline-block bg-white/5 px-0.5 py-0.5 rounded-full", children: getEventTime() }) })
14191
14221
  ] })
14192
14222
  }
14193
14223
  );
@@ -14228,7 +14258,7 @@ function EventItem({
14228
14258
  {
14229
14259
  className: cn(
14230
14260
  "my-1 opacity-90",
14231
- agendaOnly ? "text-sm" : "text-xs"
14261
+ agendaOnly ? "text-md" : "text-xs"
14232
14262
  ),
14233
14263
  style: {
14234
14264
  display: "-webkit-box",
@@ -14247,7 +14277,7 @@ function EventItem({
14247
14277
  "button",
14248
14278
  {
14249
14279
  className: cn(
14250
- "flex w-full flex-col gap-2 rounded-lg p-3 text-left outline-none transition-shadow duration-150 ease-out hover:bg-white/3 focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring data-past-event:line-through data-past-event:opacity-90",
14280
+ "flex w-full flex-col gap-2 rounded-lg p-3 text-left outline-none transition-shadow duration-150 ease-out hover:bg-white/3 focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring data-past-event:line-through data-past-event:opacity-90 border-2 border-border",
14251
14281
  colorClasses,
14252
14282
  className
14253
14283
  ),
@@ -14260,32 +14290,29 @@ function EventItem({
14260
14290
  ...dndListeners,
14261
14291
  ...dndAttributes,
14262
14292
  children: [
14263
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: cn("font-medium", agendaOnly ? "text-lg" : "text-sm"), children: event.title }),
14264
- /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
14265
- "div",
14266
- {
14267
- className: cn(
14268
- "opacity-70 flex items-center gap-2",
14269
- agendaOnly ? "text-sm" : "text-xs"
14270
- ),
14271
- children: [
14272
- event.allDay ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "uppercase", children: "All day" }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "uppercase", children: [
14293
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex w-full justify-between border-b-2 border-black/5 ", children: [
14294
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: cn("font-bold text-lg"), children: event.title }),
14295
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
14296
+ "div",
14297
+ {
14298
+ className: cn(
14299
+ "opacity-90 flex items-center gap-2 text-lg"
14300
+ ),
14301
+ children: event.allDay ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { children: "Dia todo" }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "uppercase font-semibold flex items-center gap-2", children: [
14273
14302
  formatTimeWithOptionalMinutes(displayStart),
14274
- " -",
14275
- " ",
14276
- formatTimeWithOptionalMinutes(displayEnd)
14277
- ] }),
14278
- event.location && /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "opacity-80 flex items-center gap-1", children: [
14279
- "-",
14280
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "truncate", children: event.location })
14303
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "opacity-70", children: "-" }),
14304
+ formatTimeWithOptionalMinutes(displayEnd),
14305
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react63.ClockUserIcon, {})
14281
14306
  ] })
14282
- ]
14283
- }
14284
- ),
14307
+ }
14308
+ )
14309
+ ] }),
14285
14310
  event.description && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
14286
14311
  "div",
14287
14312
  {
14288
- className: cn("my-1 opacity-90", agendaOnly ? "text-sm" : "text-xs"),
14313
+ className: cn(
14314
+ "my-1 opacity-90 flex text-md"
14315
+ ),
14289
14316
  style: {
14290
14317
  display: "-webkit-box",
14291
14318
  WebkitLineClamp: 2,
@@ -14303,9 +14330,9 @@ function EventItem({
14303
14330
  // src/components/event-calendar/EventsPopUp.tsx
14304
14331
  var import_date_fns10 = require("date-fns");
14305
14332
  var import_locale5 = require("date-fns/locale");
14306
- var import_react63 = require("react");
14333
+ var import_react64 = require("react");
14307
14334
  var import_framer_motion18 = require("framer-motion");
14308
- var import_react64 = require("@phosphor-icons/react");
14335
+ var import_react65 = require("@phosphor-icons/react");
14309
14336
  var import_jsx_runtime81 = require("react/jsx-runtime");
14310
14337
  function EventsPopup({
14311
14338
  date,
@@ -14314,8 +14341,8 @@ function EventsPopup({
14314
14341
  onClose,
14315
14342
  onEventSelect
14316
14343
  }) {
14317
- const popupRef = (0, import_react63.useRef)(null);
14318
- (0, import_react63.useEffect)(() => {
14344
+ const popupRef = (0, import_react64.useRef)(null);
14345
+ (0, import_react64.useEffect)(() => {
14319
14346
  const handleClickOutside = (event) => {
14320
14347
  if (popupRef.current && !popupRef.current.contains(event.target)) {
14321
14348
  onClose();
@@ -14326,7 +14353,7 @@ function EventsPopup({
14326
14353
  document.removeEventListener("mousedown", handleClickOutside);
14327
14354
  };
14328
14355
  }, [onClose]);
14329
- (0, import_react63.useEffect)(() => {
14356
+ (0, import_react64.useEffect)(() => {
14330
14357
  const handleEscKey = (event) => {
14331
14358
  if (event.key === "Escape") {
14332
14359
  onClose();
@@ -14341,7 +14368,7 @@ function EventsPopup({
14341
14368
  if (onEventSelect) onEventSelect(event);
14342
14369
  onClose();
14343
14370
  };
14344
- const adjustedPosition = (0, import_react63.useMemo)(() => {
14371
+ const adjustedPosition = (0, import_react64.useMemo)(() => {
14345
14372
  const positionCopy = { ...position };
14346
14373
  if (popupRef.current) {
14347
14374
  const rect = popupRef.current.getBoundingClientRect();
@@ -14385,7 +14412,7 @@ function EventsPopup({
14385
14412
  className: "rounded-full p-1 hover:bg-muted",
14386
14413
  onClick: onClose,
14387
14414
  type: "button",
14388
- children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_react64.XIcon, { className: "h-4 w-4" })
14415
+ children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_react65.XIcon, { className: "h-4 w-4" })
14389
14416
  }
14390
14417
  )
14391
14418
  ] }),
@@ -14422,11 +14449,11 @@ function EventsPopup({
14422
14449
  // src/components/event-calendar/hooks/use-current-time-indicator.ts
14423
14450
  var import_date_fns11 = require("date-fns");
14424
14451
  var import_locale6 = require("date-fns/locale");
14425
- var import_react65 = require("react");
14452
+ var import_react66 = require("react");
14426
14453
  function useCurrentTimeIndicator(currentDate, view) {
14427
- const [currentTimePosition, setCurrentTimePosition] = (0, import_react65.useState)(0);
14428
- const [currentTimeVisible, setCurrentTimeVisible] = (0, import_react65.useState)(false);
14429
- (0, import_react65.useEffect)(() => {
14454
+ const [currentTimePosition, setCurrentTimePosition] = (0, import_react66.useState)(0);
14455
+ const [currentTimeVisible, setCurrentTimeVisible] = (0, import_react66.useState)(false);
14456
+ (0, import_react66.useEffect)(() => {
14430
14457
  const calculateTimePosition = () => {
14431
14458
  const now = /* @__PURE__ */ new Date();
14432
14459
  const hours = now.getHours();
@@ -14457,15 +14484,15 @@ function useCurrentTimeIndicator(currentDate, view) {
14457
14484
  }
14458
14485
 
14459
14486
  // src/components/event-calendar/hooks/use-event-visibility.ts
14460
- var import_react66 = require("react");
14487
+ var import_react67 = require("react");
14461
14488
  function useEventVisibility({
14462
14489
  eventHeight,
14463
14490
  eventGap
14464
14491
  }) {
14465
- const contentRef = (0, import_react66.useRef)(null);
14466
- const observerRef = (0, import_react66.useRef)(null);
14467
- const [contentHeight, setContentHeight] = (0, import_react66.useState)(null);
14468
- (0, import_react66.useLayoutEffect)(() => {
14492
+ const contentRef = (0, import_react67.useRef)(null);
14493
+ const observerRef = (0, import_react67.useRef)(null);
14494
+ const [contentHeight, setContentHeight] = (0, import_react67.useState)(null);
14495
+ (0, import_react67.useLayoutEffect)(() => {
14469
14496
  if (!contentRef.current) return;
14470
14497
  const updateHeight = () => {
14471
14498
  if (contentRef.current) {
@@ -14485,7 +14512,7 @@ function useEventVisibility({
14485
14512
  }
14486
14513
  };
14487
14514
  }, []);
14488
- const getVisibleEventCount = (0, import_react66.useMemo)(() => {
14515
+ const getVisibleEventCount = (0, import_react67.useMemo)(() => {
14489
14516
  return (totalEvents) => {
14490
14517
  if (!contentHeight) return totalEvents;
14491
14518
  const maxEvents = Math.floor(contentHeight / (eventHeight + eventGap));
@@ -14505,7 +14532,7 @@ function useEventVisibility({
14505
14532
  // src/components/event-calendar/MonthView.tsx
14506
14533
  var import_date_fns12 = require("date-fns");
14507
14534
  var import_locale7 = require("date-fns/locale");
14508
- var import_react67 = require("react");
14535
+ var import_react68 = require("react");
14509
14536
  var import_jsx_runtime82 = require("react/jsx-runtime");
14510
14537
  function MonthView({
14511
14538
  currentDate,
@@ -14513,21 +14540,21 @@ function MonthView({
14513
14540
  onEventSelect,
14514
14541
  onEventCreate
14515
14542
  }) {
14516
- const days = (0, import_react67.useMemo)(() => {
14543
+ const days = (0, import_react68.useMemo)(() => {
14517
14544
  const monthStart = (0, import_date_fns12.startOfMonth)(currentDate);
14518
14545
  const monthEnd = (0, import_date_fns12.endOfMonth)(monthStart);
14519
14546
  const calendarStart = (0, import_date_fns12.startOfWeek)(monthStart, { weekStartsOn: 0 });
14520
14547
  const calendarEnd = (0, import_date_fns12.endOfWeek)(monthEnd, { weekStartsOn: 0 });
14521
14548
  return (0, import_date_fns12.eachDayOfInterval)({ end: calendarEnd, start: calendarStart });
14522
14549
  }, [currentDate]);
14523
- const weekdays = (0, import_react67.useMemo)(() => {
14550
+ const weekdays = (0, import_react68.useMemo)(() => {
14524
14551
  return Array.from({ length: 7 }).map((_, i) => {
14525
14552
  const date = (0, import_date_fns12.addDays)((0, import_date_fns12.startOfWeek)(/* @__PURE__ */ new Date(), { weekStartsOn: 0 }), i);
14526
14553
  const short = (0, import_date_fns12.format)(date, "EEE", { locale: import_locale7.ptBR });
14527
14554
  return short.charAt(0).toUpperCase() + short.slice(1);
14528
14555
  });
14529
14556
  }, []);
14530
- const weeks = (0, import_react67.useMemo)(() => {
14557
+ const weeks = (0, import_react68.useMemo)(() => {
14531
14558
  const result = [];
14532
14559
  let week = [];
14533
14560
  for (let i = 0; i < days.length; i++) {
@@ -14543,12 +14570,12 @@ function MonthView({
14543
14570
  e.stopPropagation();
14544
14571
  onEventSelect(event);
14545
14572
  };
14546
- const [isMounted, setIsMounted] = (0, import_react67.useState)(false);
14573
+ const [isMounted, setIsMounted] = (0, import_react68.useState)(false);
14547
14574
  const { contentRef, getVisibleEventCount } = useEventVisibility({
14548
14575
  eventGap: EventGap,
14549
14576
  eventHeight: EventHeight
14550
14577
  });
14551
- (0, import_react67.useEffect)(() => {
14578
+ (0, import_react68.useEffect)(() => {
14552
14579
  setIsMounted(true);
14553
14580
  }, []);
14554
14581
  return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "contents", "data-slot": "month-view", children: [
@@ -14824,7 +14851,7 @@ function addHoursToDate(date, hours) {
14824
14851
  // src/components/event-calendar/WeekView.tsx
14825
14852
  var import_date_fns15 = require("date-fns");
14826
14853
  var import_locale8 = require("date-fns/locale");
14827
- var import_react68 = require("react");
14854
+ var import_react69 = require("react");
14828
14855
  var import_jsx_runtime83 = require("react/jsx-runtime");
14829
14856
  function WeekView({
14830
14857
  currentDate,
@@ -14832,23 +14859,23 @@ function WeekView({
14832
14859
  onEventSelect,
14833
14860
  onEventCreate
14834
14861
  }) {
14835
- const days = (0, import_react68.useMemo)(() => {
14862
+ const days = (0, import_react69.useMemo)(() => {
14836
14863
  const weekStart2 = (0, import_date_fns15.startOfWeek)(currentDate, { weekStartsOn: 0 });
14837
14864
  const weekEnd = (0, import_date_fns15.endOfWeek)(currentDate, { weekStartsOn: 0 });
14838
14865
  return (0, import_date_fns15.eachDayOfInterval)({ end: weekEnd, start: weekStart2 });
14839
14866
  }, [currentDate]);
14840
- const weekStart = (0, import_react68.useMemo)(
14867
+ const weekStart = (0, import_react69.useMemo)(
14841
14868
  () => (0, import_date_fns15.startOfWeek)(currentDate, { weekStartsOn: 0 }),
14842
14869
  [currentDate]
14843
14870
  );
14844
- const hours = (0, import_react68.useMemo)(() => {
14871
+ const hours = (0, import_react69.useMemo)(() => {
14845
14872
  const dayStart = (0, import_date_fns15.startOfDay)(currentDate);
14846
14873
  return (0, import_date_fns15.eachHourOfInterval)({
14847
14874
  end: (0, import_date_fns15.addHours)(dayStart, EndHour - 1),
14848
14875
  start: (0, import_date_fns15.addHours)(dayStart, StartHour)
14849
14876
  });
14850
14877
  }, [currentDate]);
14851
- const allDayEvents = (0, import_react68.useMemo)(() => {
14878
+ const allDayEvents = (0, import_react69.useMemo)(() => {
14852
14879
  return events.filter((event) => {
14853
14880
  return event.allDay || isMultiDayEvent(event);
14854
14881
  }).filter((event) => {
@@ -14859,7 +14886,7 @@ function WeekView({
14859
14886
  );
14860
14887
  });
14861
14888
  }, [events, days]);
14862
- const processedDayEvents = (0, import_react68.useMemo)(() => {
14889
+ const processedDayEvents = (0, import_react69.useMemo)(() => {
14863
14890
  const result = days.map((day) => {
14864
14891
  const dayEvents = events.filter((event) => {
14865
14892
  if (event.allDay || isMultiDayEvent(event)) return false;
@@ -15105,11 +15132,11 @@ function WeekView({
15105
15132
  }
15106
15133
 
15107
15134
  // src/components/ui/form/CheckBoxThree.tsx
15108
- var import_react69 = require("react");
15135
+ var import_react70 = require("react");
15109
15136
  var import_framer_motion19 = require("framer-motion");
15110
15137
  var import_jsx_runtime84 = require("react/jsx-runtime");
15111
15138
  function useCheckboxTree(initialTree) {
15112
- const initialCheckedNodes = (0, import_react69.useMemo)(() => {
15139
+ const initialCheckedNodes = (0, import_react70.useMemo)(() => {
15113
15140
  const checkedSet = /* @__PURE__ */ new Set();
15114
15141
  const initializeCheckedNodes = (node) => {
15115
15142
  if (node.defaultChecked) {
@@ -15120,8 +15147,8 @@ function useCheckboxTree(initialTree) {
15120
15147
  initializeCheckedNodes(initialTree);
15121
15148
  return checkedSet;
15122
15149
  }, [initialTree]);
15123
- const [checkedNodes, setCheckedNodes] = (0, import_react69.useState)(initialCheckedNodes);
15124
- const isChecked = (0, import_react69.useCallback)(
15150
+ const [checkedNodes, setCheckedNodes] = (0, import_react70.useState)(initialCheckedNodes);
15151
+ const isChecked = (0, import_react70.useCallback)(
15125
15152
  (node) => {
15126
15153
  if (!node.children) {
15127
15154
  return checkedNodes.has(node.id);
@@ -15139,7 +15166,7 @@ function useCheckboxTree(initialTree) {
15139
15166
  },
15140
15167
  [checkedNodes]
15141
15168
  );
15142
- const handleCheck = (0, import_react69.useCallback)(
15169
+ const handleCheck = (0, import_react70.useCallback)(
15143
15170
  (node) => {
15144
15171
  const newCheckedNodes = new Set(checkedNodes);
15145
15172
  const toggleNode = (n, check) => {
@@ -15169,9 +15196,9 @@ function CheckboxTree({ tree, renderNode }) {
15169
15196
  onCheckedChange,
15170
15197
  children
15171
15198
  }) => {
15172
- const [open, setOpen] = (0, import_react69.useState)(() => !!node.children && status !== false);
15173
- const checkboxRef = (0, import_react69.useRef)(null);
15174
- (0, import_react69.useEffect)(() => {
15199
+ const [open, setOpen] = (0, import_react70.useState)(() => !!node.children && status !== false);
15200
+ const checkboxRef = (0, import_react70.useRef)(null);
15201
+ (0, import_react70.useEffect)(() => {
15175
15202
  if (checkboxRef.current) {
15176
15203
  checkboxRef.current.indeterminate = status === "indeterminate";
15177
15204
  }
@@ -15255,11 +15282,11 @@ function CheckboxTree({ tree, renderNode }) {
15255
15282
  }
15256
15283
 
15257
15284
  // src/components/selects/MultiSelectBase.tsx
15258
- var import_react70 = require("@phosphor-icons/react");
15259
- var import_react71 = require("react");
15285
+ var import_react71 = require("@phosphor-icons/react");
15286
+ var import_react72 = require("react");
15260
15287
  var import_framer_motion20 = require("framer-motion");
15261
15288
  var import_jsx_runtime85 = require("react/jsx-runtime");
15262
- var MultiSelectContext = (0, import_react71.createContext)(null);
15289
+ var MultiSelectContext = (0, import_react72.createContext)(null);
15263
15290
  function MultiSelectBase({
15264
15291
  children,
15265
15292
  values,
@@ -15269,12 +15296,12 @@ function MultiSelectBase({
15269
15296
  empty,
15270
15297
  error
15271
15298
  }) {
15272
- const [open, setOpen] = (0, import_react71.useState)(false);
15273
- const [internalValues, setInternalValues] = (0, import_react71.useState)(
15299
+ const [open, setOpen] = (0, import_react72.useState)(false);
15300
+ const [internalValues, setInternalValues] = (0, import_react72.useState)(
15274
15301
  new Set(values ?? defaultValues)
15275
15302
  );
15276
15303
  const selectedValues = values ? new Set(values) : internalValues;
15277
- const [items, setItems] = (0, import_react71.useState)(/* @__PURE__ */ new Map());
15304
+ const [items, setItems] = (0, import_react72.useState)(/* @__PURE__ */ new Map());
15278
15305
  function toggleValue(value) {
15279
15306
  if (disabled) return;
15280
15307
  const getNewSet = (prev) => {
@@ -15289,7 +15316,7 @@ function MultiSelectBase({
15289
15316
  setInternalValues(getNewSet);
15290
15317
  onValuesChange?.([...getNewSet(selectedValues)]);
15291
15318
  }
15292
- const onItemAdded = (0, import_react71.useCallback)((value, label) => {
15319
+ const onItemAdded = (0, import_react72.useCallback)((value, label) => {
15293
15320
  setItems((prev) => {
15294
15321
  if (prev.get(value) === label) return prev;
15295
15322
  return new Map(prev).set(value, label);
@@ -15346,7 +15373,7 @@ function MultiSelectTriggerBase({
15346
15373
  ),
15347
15374
  children: [
15348
15375
  children,
15349
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react70.CaretUpDownIcon, { className: "size-4 shrink-0 opacity-50" })
15376
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react71.CaretUpDownIcon, { className: "size-4 shrink-0 opacity-50" })
15350
15377
  ]
15351
15378
  }
15352
15379
  ) }),
@@ -15361,13 +15388,13 @@ function MultiSelectValueBase({
15361
15388
  ...props
15362
15389
  }) {
15363
15390
  const { selectedValues, toggleValue, items, open } = useMultiSelectContext();
15364
- const [overflowAmount, setOverflowAmount] = (0, import_react71.useState)(0);
15365
- const valueRef = (0, import_react71.useRef)(null);
15366
- const overflowRef = (0, import_react71.useRef)(null);
15367
- const mutationObserverRef = (0, import_react71.useRef)(null);
15368
- const resizeObserverRef = (0, import_react71.useRef)(null);
15391
+ const [overflowAmount, setOverflowAmount] = (0, import_react72.useState)(0);
15392
+ const valueRef = (0, import_react72.useRef)(null);
15393
+ const overflowRef = (0, import_react72.useRef)(null);
15394
+ const mutationObserverRef = (0, import_react72.useRef)(null);
15395
+ const resizeObserverRef = (0, import_react72.useRef)(null);
15369
15396
  const shouldWrap = overflowBehavior === "wrap" || overflowBehavior === "wrap-when-open" && open;
15370
- const checkOverflow = (0, import_react71.useCallback)(() => {
15397
+ const checkOverflow = (0, import_react72.useCallback)(() => {
15371
15398
  if (valueRef.current == null) return;
15372
15399
  const containerElement = valueRef.current;
15373
15400
  const overflowElement = overflowRef.current;
@@ -15388,7 +15415,7 @@ function MultiSelectValueBase({
15388
15415
  }
15389
15416
  setOverflowAmount(amount);
15390
15417
  }, []);
15391
- const handleResize = (0, import_react71.useCallback)(
15418
+ const handleResize = (0, import_react72.useCallback)(
15392
15419
  (node) => {
15393
15420
  if (node == null) {
15394
15421
  valueRef.current = null;
@@ -15451,7 +15478,7 @@ function MultiSelectValueBase({
15451
15478
  } : void 0,
15452
15479
  children: [
15453
15480
  items.get(value),
15454
- clickToRemove && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react70.XIcon, { className: "size-3 text-muted-foreground group-hover:text-destructive" })
15481
+ clickToRemove && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react71.XIcon, { className: "size-3 text-muted-foreground group-hover:text-destructive" })
15455
15482
  ]
15456
15483
  },
15457
15484
  value
@@ -15511,7 +15538,7 @@ function MultiSelectItemBase({
15511
15538
  }) {
15512
15539
  const { toggleValue, selectedValues, onItemAdded } = useMultiSelectContext();
15513
15540
  const isSelected = selectedValues.has(value);
15514
- (0, import_react71.useEffect)(() => {
15541
+ (0, import_react72.useEffect)(() => {
15515
15542
  onItemAdded(value, badgeLabel ?? children);
15516
15543
  }, [value, children, onItemAdded, badgeLabel]);
15517
15544
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
@@ -15535,7 +15562,7 @@ function MultiSelectItemBase({
15535
15562
  initial: { scale: 0 },
15536
15563
  animate: { scale: isSelected ? 1 : 0 },
15537
15564
  transition: { type: "spring", stiffness: 500, damping: 30 },
15538
- children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react70.CheckIcon, { className: "size-4" })
15565
+ children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react71.CheckIcon, { className: "size-4" })
15539
15566
  }
15540
15567
  ) }),
15541
15568
  children
@@ -15552,7 +15579,7 @@ function MultiSelectSeparatorBase(props) {
15552
15579
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(CommandSeparatorBase, { ...props });
15553
15580
  }
15554
15581
  function useMultiSelectContext() {
15555
- const context = (0, import_react71.useContext)(MultiSelectContext);
15582
+ const context = (0, import_react72.useContext)(MultiSelectContext);
15556
15583
  if (context == null) {
15557
15584
  throw new Error(
15558
15585
  "useMultiSelectContext must be used within a MultiSelectContext"
@@ -15568,51 +15595,2285 @@ function debounce(func, wait) {
15568
15595
  };
15569
15596
  }
15570
15597
 
15571
- // src/hooks/use-drag.tsx
15572
- var import_react72 = require("react");
15573
- var useDrag = (options = {}) => {
15574
- const [isDragging, setIsDragging] = (0, import_react72.useState)(null);
15575
- const [positions, setPositions] = (0, import_react72.useState)({});
15576
- const dragStartPos = (0, import_react72.useRef)(null);
15577
- const dragId = (0, import_react72.useRef)(null);
15578
- const handleMouseDown = (0, import_react72.useCallback)((id, e) => {
15579
- e.preventDefault();
15580
- const currentPosition = positions[id] || { top: 0, left: 0 };
15581
- dragStartPos.current = {
15582
- x: e.clientX,
15583
- y: e.clientY,
15584
- elementX: currentPosition.left,
15585
- elementY: currentPosition.top
15586
- };
15587
- dragId.current = id;
15588
- setIsDragging(id);
15589
- options.onDragStart?.(id);
15590
- }, [positions, options]);
15591
- const handleMouseMove = (0, import_react72.useCallback)((e) => {
15592
- if (!isDragging || !dragStartPos.current || !dragId.current) return;
15593
- const deltaX = e.clientX - dragStartPos.current.x;
15594
- const deltaY = e.clientY - dragStartPos.current.y;
15595
- const newPosition = {
15596
- left: dragStartPos.current.elementX + deltaX,
15597
- top: dragStartPos.current.elementY + deltaY
15598
- };
15599
- newPosition.left = Math.max(0, Math.min(window.innerWidth - 300, newPosition.left));
15600
- newPosition.top = Math.max(0, Math.min(window.innerHeight - 200, newPosition.top));
15601
- setPositions((prev) => ({
15602
- ...prev,
15603
- [dragId.current]: newPosition
15604
- }));
15605
- options.onDrag?.(dragId.current, newPosition);
15606
- }, [isDragging, options]);
15607
- const handleMouseUp = (0, import_react72.useCallback)(() => {
15608
- if (dragId.current) {
15609
- options.onDragEnd?.(dragId.current);
15598
+ // src/components/event-calendar-view/Agenda.tsx
15599
+ var import_date_fns16 = require("date-fns");
15600
+ var import_locale9 = require("date-fns/locale");
15601
+ var import_react73 = require("react");
15602
+ var import_react74 = require("@phosphor-icons/react");
15603
+ var import_tailwind_merge2 = require("tailwind-merge");
15604
+ var import_jsx_runtime86 = require("react/jsx-runtime");
15605
+ function Agenda({
15606
+ currentDate,
15607
+ events,
15608
+ onEventSelect,
15609
+ showUndatedEvents = true
15610
+ }) {
15611
+ const isValidDate6 = (d) => {
15612
+ try {
15613
+ const t = d instanceof Date ? d.getTime() : new Date(String(d)).getTime();
15614
+ return !isNaN(t);
15615
+ } catch {
15616
+ return false;
15610
15617
  }
15611
- setIsDragging(null);
15612
- dragStartPos.current = null;
15613
- dragId.current = null;
15614
- }, [options]);
15615
- (0, import_react72.useEffect)(() => {
15618
+ };
15619
+ const datedEvents = (0, import_react73.useMemo)(
15620
+ () => events.filter(
15621
+ (e) => isValidDate6(e.start) && isValidDate6(e.end) || isValidDate6(e.attend_date)
15622
+ ),
15623
+ [events]
15624
+ );
15625
+ const undatedEvents = (0, import_react73.useMemo)(
15626
+ () => events.filter(
15627
+ (e) => !(isValidDate6(e.start) && isValidDate6(e.end)) && !isValidDate6(e.attend_date)
15628
+ ),
15629
+ [events]
15630
+ );
15631
+ const days = (0, import_react73.useMemo)(() => {
15632
+ console.log("Agenda view updating with date:", currentDate.toISOString());
15633
+ return Array.from(
15634
+ { length: AgendaDaysToShowAgenda },
15635
+ (_, i) => (0, import_date_fns16.addDays)(new Date(currentDate), i)
15636
+ );
15637
+ }, [currentDate]);
15638
+ const handleEventClick = (event, e) => {
15639
+ e.stopPropagation();
15640
+ console.log("Agenda view event clicked:", event);
15641
+ if (onEventSelect) onEventSelect(event);
15642
+ };
15643
+ const hasEvents = days.some(
15644
+ (day) => getAgendaEventsForDayAgenda(datedEvents, day).length > 0
15645
+ );
15646
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "border-border/70 border-t px-4", children: !hasEvents && !(showUndatedEvents && undatedEvents.length > 0) ? /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "flex min-h-[70svh] flex-col items-center justify-center py-16 text-center", children: [
15647
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react74.CalendarIcon, { className: "mb-2 text-muted-foreground/50", size: 32 }),
15648
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("h3", { className: "font-medium text-lg", children: "Nenhum evento encontrado" }),
15649
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("p", { className: "text-muted-foreground", children: "N\xE3o h\xE1 eventos agendados para este per\xEDodo." })
15650
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_jsx_runtime86.Fragment, { children: [
15651
+ days.map((day) => {
15652
+ const dayEvents = getAgendaEventsForDayAgenda(datedEvents, day);
15653
+ if (dayEvents.length === 0) return null;
15654
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
15655
+ "div",
15656
+ {
15657
+ className: (0, import_tailwind_merge2.twMerge)("relative my-12 border-border/70 border-t", (0, import_date_fns16.isToday)(day) ? "border-blue-200" : ""),
15658
+ children: [
15659
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
15660
+ "span",
15661
+ {
15662
+ className: (0, import_tailwind_merge2.twMerge)("-top-3 absolute left-0 flex h-6 items-center bg-background pe-4 uppercase data-today:font-extrabold sm:pe-4 text-lg font-bold", (0, import_date_fns16.isToday)(day) ? "text-blue-500" : ""),
15663
+ "data-today": (0, import_date_fns16.isToday)(day) || void 0,
15664
+ children: (() => {
15665
+ const s = (0, import_date_fns16.format)(day, "d MMM, EEEE", { locale: import_locale9.ptBR });
15666
+ return s.split(" ").map((w) => w ? w[0].toUpperCase() + w.slice(1) : w).join(" ");
15667
+ })()
15668
+ }
15669
+ ),
15670
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "mt-6 space-y-2", children: dayEvents.map((event) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
15671
+ EventItemAgenda,
15672
+ {
15673
+ event,
15674
+ onClick: onEventSelect ? (e) => handleEventClick(event, e) : void 0,
15675
+ view: "agenda",
15676
+ className: onEventSelect ? void 0 : "cursor-default hover:shadow-none hover:scale-100"
15677
+ },
15678
+ event.id
15679
+ )) })
15680
+ ]
15681
+ },
15682
+ day.toString()
15683
+ );
15684
+ }),
15685
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
15686
+ UndatedEvents,
15687
+ {
15688
+ events,
15689
+ onEventSelect,
15690
+ show: showUndatedEvents,
15691
+ className: "my-12"
15692
+ }
15693
+ )
15694
+ ] }) });
15695
+ }
15696
+
15697
+ // src/components/event-calendar-view/CalendarDND.tsx
15698
+ var import_core4 = require("@dnd-kit/core");
15699
+ var import_date_fns17 = require("date-fns");
15700
+ var import_react76 = require("react");
15701
+
15702
+ // src/components/event-calendar-view/hooks.ts
15703
+ var import_react75 = require("react");
15704
+ var CalendarDndContext2 = (0, import_react75.createContext)({
15705
+ activeEvent: null,
15706
+ activeId: null,
15707
+ activeView: null,
15708
+ currentTime: null,
15709
+ dragHandlePosition: null,
15710
+ eventHeight: null,
15711
+ isMultiDay: false,
15712
+ multiDayWidth: null
15713
+ });
15714
+ var useCalendarDndAgenda = () => (0, import_react75.useContext)(CalendarDndContext2);
15715
+
15716
+ // src/components/event-calendar-view/CalendarDND.tsx
15717
+ var import_jsx_runtime87 = require("react/jsx-runtime");
15718
+ function CalendarDndProviderAgenda({
15719
+ children,
15720
+ onEventUpdate
15721
+ }) {
15722
+ const [activeEvent, setActiveEvent] = (0, import_react76.useState)(null);
15723
+ const [activeId, setActiveId] = (0, import_react76.useState)(null);
15724
+ const [activeView, setActiveView] = (0, import_react76.useState)(
15725
+ null
15726
+ );
15727
+ const [currentTime, setCurrentTime] = (0, import_react76.useState)(null);
15728
+ const [eventHeight, setEventHeight] = (0, import_react76.useState)(null);
15729
+ const [isMultiDay, setIsMultiDay] = (0, import_react76.useState)(false);
15730
+ const [multiDayWidth, setMultiDayWidth] = (0, import_react76.useState)(null);
15731
+ const [dragHandlePosition, setDragHandlePosition] = (0, import_react76.useState)(null);
15732
+ const eventDimensions = (0, import_react76.useRef)({ height: 0 });
15733
+ const sensors = (0, import_core4.useSensors)(
15734
+ (0, import_core4.useSensor)(import_core4.MouseSensor, {
15735
+ // Require the mouse to move by 5px before activating
15736
+ activationConstraint: {
15737
+ distance: 5
15738
+ }
15739
+ }),
15740
+ (0, import_core4.useSensor)(import_core4.TouchSensor, {
15741
+ // Press delay of 250ms, with tolerance of 5px of movement
15742
+ activationConstraint: {
15743
+ delay: 250,
15744
+ tolerance: 5
15745
+ }
15746
+ }),
15747
+ (0, import_core4.useSensor)(import_core4.PointerSensor, {
15748
+ // Require the pointer to move by 5px before activating
15749
+ activationConstraint: {
15750
+ distance: 5
15751
+ }
15752
+ })
15753
+ );
15754
+ const dndContextId = (0, import_react76.useId)();
15755
+ const handleDragStart = (event) => {
15756
+ const { active } = event;
15757
+ if (!active.data.current) {
15758
+ console.error("Missing data in drag start event", event);
15759
+ return;
15760
+ }
15761
+ const {
15762
+ event: calendarEvent,
15763
+ view,
15764
+ height,
15765
+ isMultiDay: eventIsMultiDay,
15766
+ multiDayWidth: eventMultiDayWidth,
15767
+ dragHandlePosition: eventDragHandlePosition
15768
+ } = active.data.current;
15769
+ setActiveEvent(calendarEvent);
15770
+ setActiveId(active.id);
15771
+ setActiveView(view);
15772
+ setCurrentTime(calendarEvent.start ? new Date(calendarEvent.start) : null);
15773
+ setIsMultiDay(eventIsMultiDay || false);
15774
+ setMultiDayWidth(eventMultiDayWidth || null);
15775
+ setDragHandlePosition(eventDragHandlePosition || null);
15776
+ if (height) {
15777
+ eventDimensions.current.height = height;
15778
+ setEventHeight(height);
15779
+ }
15780
+ };
15781
+ const handleDragOver = (event) => {
15782
+ const { over } = event;
15783
+ if (over && activeEvent && over.data.current) {
15784
+ const { date, time } = over.data.current;
15785
+ if (time !== void 0 && activeView !== "month") {
15786
+ const newTime = new Date(date);
15787
+ const hours = Math.floor(time);
15788
+ const fractionalHour = time - hours;
15789
+ let minutes = 0;
15790
+ if (fractionalHour < 0.125) minutes = 0;
15791
+ else if (fractionalHour < 0.375) minutes = 15;
15792
+ else if (fractionalHour < 0.625) minutes = 30;
15793
+ else minutes = 45;
15794
+ newTime.setHours(hours, minutes, 0, 0);
15795
+ if (!currentTime || newTime.getHours() !== currentTime.getHours() || newTime.getMinutes() !== currentTime.getMinutes() || newTime.getDate() !== currentTime.getDate() || newTime.getMonth() !== currentTime.getMonth() || newTime.getFullYear() !== currentTime.getFullYear()) {
15796
+ setCurrentTime(newTime);
15797
+ }
15798
+ } else if (activeView === "month") {
15799
+ const newTime = new Date(date);
15800
+ if (currentTime) {
15801
+ newTime.setHours(
15802
+ currentTime.getHours(),
15803
+ currentTime.getMinutes(),
15804
+ currentTime.getSeconds(),
15805
+ currentTime.getMilliseconds()
15806
+ );
15807
+ }
15808
+ if (!currentTime || newTime.getDate() !== currentTime.getDate() || newTime.getMonth() !== currentTime.getMonth() || newTime.getFullYear() !== currentTime.getFullYear()) {
15809
+ setCurrentTime(newTime);
15810
+ }
15811
+ }
15812
+ }
15813
+ };
15814
+ const handleDragEnd = (event) => {
15815
+ const { active, over } = event;
15816
+ if (!over || !activeEvent || !currentTime) {
15817
+ setActiveEvent(null);
15818
+ setActiveId(null);
15819
+ setActiveView(null);
15820
+ setCurrentTime(null);
15821
+ setEventHeight(null);
15822
+ setIsMultiDay(false);
15823
+ setMultiDayWidth(null);
15824
+ setDragHandlePosition(null);
15825
+ return;
15826
+ }
15827
+ try {
15828
+ if (!active.data.current || !over.data.current) {
15829
+ throw new Error("Missing data in drag event");
15830
+ }
15831
+ const activeData = active.data.current;
15832
+ const overData = over.data.current;
15833
+ if (!activeData.event || !overData.date) {
15834
+ throw new Error("Missing required event data");
15835
+ }
15836
+ const calendarEvent = activeData.event;
15837
+ const date = overData.date;
15838
+ const time = overData.time;
15839
+ const newStart = new Date(date);
15840
+ if (time !== void 0) {
15841
+ const hours = Math.floor(time);
15842
+ const fractionalHour = time - hours;
15843
+ let minutes = 0;
15844
+ if (fractionalHour < 0.125) minutes = 0;
15845
+ else if (fractionalHour < 0.375) minutes = 15;
15846
+ else if (fractionalHour < 0.625) minutes = 30;
15847
+ else minutes = 45;
15848
+ newStart.setHours(hours, minutes, 0, 0);
15849
+ } else {
15850
+ newStart.setHours(
15851
+ currentTime.getHours(),
15852
+ currentTime.getMinutes(),
15853
+ currentTime.getSeconds(),
15854
+ currentTime.getMilliseconds()
15855
+ );
15856
+ }
15857
+ if (!calendarEvent.start || !calendarEvent.end) {
15858
+ console.error("Cannot compute duration: event start or end is null", calendarEvent);
15859
+ return;
15860
+ }
15861
+ const originalStart = new Date(calendarEvent.start);
15862
+ const originalEnd = new Date(calendarEvent.end);
15863
+ const durationMinutes = (0, import_date_fns17.differenceInMinutes)(originalEnd, originalStart);
15864
+ const newEnd = (0, import_date_fns17.addMinutes)(newStart, durationMinutes);
15865
+ const hasStartTimeChanged = originalStart.getFullYear() !== newStart.getFullYear() || originalStart.getMonth() !== newStart.getMonth() || originalStart.getDate() !== newStart.getDate() || originalStart.getHours() !== newStart.getHours() || originalStart.getMinutes() !== newStart.getMinutes();
15866
+ if (hasStartTimeChanged) {
15867
+ onEventUpdate({
15868
+ ...calendarEvent,
15869
+ end: newEnd,
15870
+ start: newStart
15871
+ });
15872
+ }
15873
+ } catch (error) {
15874
+ console.error("Error in drag end handler:", error);
15875
+ } finally {
15876
+ setActiveEvent(null);
15877
+ setActiveId(null);
15878
+ setActiveView(null);
15879
+ setCurrentTime(null);
15880
+ setEventHeight(null);
15881
+ setIsMultiDay(false);
15882
+ setMultiDayWidth(null);
15883
+ setDragHandlePosition(null);
15884
+ }
15885
+ };
15886
+ return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
15887
+ import_core4.DndContext,
15888
+ {
15889
+ id: dndContextId,
15890
+ onDragEnd: handleDragEnd,
15891
+ onDragOver: handleDragOver,
15892
+ onDragStart: handleDragStart,
15893
+ sensors,
15894
+ children: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
15895
+ CalendarDndContext2.Provider,
15896
+ {
15897
+ value: {
15898
+ activeEvent,
15899
+ activeId,
15900
+ activeView,
15901
+ currentTime,
15902
+ dragHandlePosition,
15903
+ eventHeight,
15904
+ isMultiDay,
15905
+ multiDayWidth
15906
+ },
15907
+ children: [
15908
+ children,
15909
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_core4.DragOverlay, { adjustScale: false, dropAnimation: null, children: activeEvent && activeView && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
15910
+ "div",
15911
+ {
15912
+ style: {
15913
+ height: eventHeight ? `${eventHeight}px` : "auto",
15914
+ width: isMultiDay && multiDayWidth ? `${multiDayWidth}%` : "100%"
15915
+ },
15916
+ children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
15917
+ EventItemAgenda,
15918
+ {
15919
+ currentTime: currentTime || void 0,
15920
+ event: activeEvent,
15921
+ isDragging: true,
15922
+ isFirstDay: dragHandlePosition?.data?.isFirstDay !== false,
15923
+ isLastDay: dragHandlePosition?.data?.isLastDay !== false,
15924
+ showTime: activeView !== "month",
15925
+ view: activeView
15926
+ }
15927
+ )
15928
+ }
15929
+ ) })
15930
+ ]
15931
+ }
15932
+ )
15933
+ }
15934
+ );
15935
+ }
15936
+
15937
+ // src/components/event-calendar-view/constants.ts
15938
+ var EventHeightAgenda = 24;
15939
+ var EventGapAgenda = 4;
15940
+ var WeekCellsHeightAgenda = 64;
15941
+ var AgendaDaysToShowAgenda = 30;
15942
+ var StartHourAgenda = 0;
15943
+ var EndHourAgenda = 24;
15944
+ var DefaultStartHourAgenda = 9;
15945
+ var DefaultEndHourAgenda = 10;
15946
+
15947
+ // src/components/event-calendar-view/DayView.tsx
15948
+ var import_date_fns22 = require("date-fns");
15949
+ var import_react80 = require("react");
15950
+
15951
+ // src/components/event-calendar-view/utils.ts
15952
+ var import_date_fns18 = require("date-fns");
15953
+ var import_date_fns19 = require("date-fns");
15954
+ function getEventColorClassesAgenda(color) {
15955
+ const eventColor = color || "sky";
15956
+ switch (eventColor) {
15957
+ case "sky":
15958
+ return "bg-sky-200/50 hover:bg-sky-200/40 text-sky-950/80 dark:bg-sky-400/25 dark:hover:bg-sky-400/20 dark:text-sky-200 shadow-sky-700/8";
15959
+ case "amber":
15960
+ return "bg-amber-200/50 hover:bg-amber-200/40 text-amber-950/80 dark:bg-amber-400/25 dark:hover:bg-amber-400/20 dark:text-amber-200 shadow-amber-700/8";
15961
+ case "violet":
15962
+ return "bg-violet-200/50 hover:bg-violet-200/40 text-violet-950/80 dark:bg-violet-400/25 dark:hover:bg-violet-400/20 dark:text-violet-200 shadow-violet-700/8";
15963
+ case "rose":
15964
+ return "bg-rose-200/50 hover:bg-rose-200/40 text-rose-950/80 dark:bg-rose-400/25 dark:hover:bg-rose-400/20 dark:text-rose-200 shadow-rose-700/8";
15965
+ case "emerald":
15966
+ return "bg-emerald-200/50 hover:bg-emerald-200/40 text-emerald-950/80 dark:bg-emerald-400/25 dark:hover:bg-emerald-400/20 dark:text-emerald-200 shadow-emerald-700/8";
15967
+ case "orange":
15968
+ return "bg-orange-200/50 hover:bg-orange-200/40 text-orange-950/80 dark:bg-orange-400/25 dark:hover:bg-orange-400/20 dark:text-orange-200 shadow-orange-700/8";
15969
+ default:
15970
+ return "bg-sky-200/50 hover:bg-sky-200/40 text-sky-950/80 dark:bg-sky-400/25 dark:hover:bg-sky-400/20 dark:text-sky-200 shadow-sky-700/8";
15971
+ }
15972
+ }
15973
+ function getBorderRadiusClassesAgenda(isFirstDay, isLastDay) {
15974
+ if (isFirstDay && isLastDay) {
15975
+ return "rounded";
15976
+ }
15977
+ if (isFirstDay) {
15978
+ return "rounded-l rounded-r-none";
15979
+ }
15980
+ if (isLastDay) {
15981
+ return "rounded-r rounded-l-none";
15982
+ }
15983
+ return "rounded-none";
15984
+ }
15985
+ function isMultiDayEventAgenda(event) {
15986
+ const eventStart = isValidDate3(event.start) ? new Date(event.start) : void 0;
15987
+ const eventEnd = isValidDate3(event.end) ? new Date(event.end) : void 0;
15988
+ if (!eventStart || !eventEnd) return !!event.allDay;
15989
+ return event.allDay || eventStart.getDate() !== eventEnd.getDate();
15990
+ }
15991
+ function getEventsForDayAgenda(events, day) {
15992
+ return events.filter((event) => {
15993
+ const eventStart = isValidDate3(event.start) ? new Date(event.start) : isValidDate3(event.attend_date) ? normalizeAttendDate(event.attend_date) : void 0;
15994
+ return eventStart ? (0, import_date_fns18.isSameDay)(day, eventStart) : false;
15995
+ }).sort((a, b) => getEventStartTimestamp2(a) - getEventStartTimestamp2(b));
15996
+ }
15997
+ function sortEventsAgenda(events) {
15998
+ return [...events].sort((a, b) => {
15999
+ const aIsMultiDay = isMultiDayEventAgenda(a);
16000
+ const bIsMultiDay = isMultiDayEventAgenda(b);
16001
+ if (aIsMultiDay && !bIsMultiDay) return -1;
16002
+ if (!aIsMultiDay && bIsMultiDay) return 1;
16003
+ return getEventStartTimestamp2(a) - getEventStartTimestamp2(b);
16004
+ });
16005
+ }
16006
+ function getSpanningEventsForDayAgenda(events, day) {
16007
+ return events.filter((event) => {
16008
+ if (!isMultiDayEventAgenda(event)) return false;
16009
+ const eventStart = isValidDate3(event.start) ? new Date(event.start) : void 0;
16010
+ const eventEnd = isValidDate3(event.end) ? new Date(event.end) : void 0;
16011
+ if (!eventStart || !eventEnd) return false;
16012
+ return !(0, import_date_fns18.isSameDay)(day, eventStart) && ((0, import_date_fns18.isSameDay)(day, eventEnd) || day > eventStart && day < eventEnd);
16013
+ });
16014
+ }
16015
+ function getAllEventsForDayAgenda(events, day) {
16016
+ return events.filter((event) => {
16017
+ const eventStart = isValidDate3(event.start) ? new Date(event.start) : void 0;
16018
+ const eventEnd = isValidDate3(event.end) ? new Date(event.end) : void 0;
16019
+ if (!eventStart) return false;
16020
+ return (0, import_date_fns18.isSameDay)(day, eventStart) || (eventEnd ? (0, import_date_fns18.isSameDay)(day, eventEnd) : false) || (eventEnd ? day > eventStart && day < eventEnd : false);
16021
+ });
16022
+ }
16023
+ function getAgendaEventsForDayAgenda(events, day) {
16024
+ return events.filter((event) => {
16025
+ const eventStart = isValidDate3(event.start) ? new Date(event.start) : isValidDate3(event.attend_date) ? normalizeAttendDate(event.attend_date) : void 0;
16026
+ const eventEnd = isValidDate3(event.end) ? new Date(event.end) : isValidDate3(event.attend_date) ? (() => {
16027
+ const dt = normalizeAttendDate(event.attend_date);
16028
+ return dt ? (0, import_date_fns19.addHours)(dt, 1) : void 0;
16029
+ })() : void 0;
16030
+ if (!eventStart) return false;
16031
+ return (0, import_date_fns18.isSameDay)(day, eventStart) || (eventEnd ? (0, import_date_fns18.isSameDay)(day, eventEnd) : false) || (eventEnd ? day > eventStart && day < eventEnd : false);
16032
+ }).sort((a, b) => getEventStartTimestamp2(a) - getEventStartTimestamp2(b));
16033
+ }
16034
+ function isValidDate3(d) {
16035
+ try {
16036
+ const t = d instanceof Date ? d.getTime() : new Date(String(d)).getTime();
16037
+ return !isNaN(t);
16038
+ } catch {
16039
+ return false;
16040
+ }
16041
+ }
16042
+ function getEventStartTimestamp2(e) {
16043
+ if (isValidDate3(e.start)) return new Date(e.start).getTime();
16044
+ if (isValidDate3(e.attend_date))
16045
+ return normalizeAttendDate(e.attend_date).getTime();
16046
+ return Number.MAX_SAFE_INTEGER;
16047
+ }
16048
+ function normalizeAttendDate(d) {
16049
+ if (d === void 0 || d === null) return void 0;
16050
+ try {
16051
+ const dt = d instanceof Date ? d : new Date(String(d));
16052
+ if (isNaN(dt.getTime())) return void 0;
16053
+ if (dt.getHours() !== 0 || dt.getMinutes() !== 0 || dt.getSeconds() !== 0 || dt.getMilliseconds() !== 0) {
16054
+ return dt;
16055
+ }
16056
+ return new Date(dt.getFullYear(), dt.getMonth(), dt.getDate());
16057
+ } catch {
16058
+ return void 0;
16059
+ }
16060
+ }
16061
+ function addHoursToDateAgenda(date, hours) {
16062
+ const result = new Date(date);
16063
+ result.setHours(result.getHours() + hours);
16064
+ return result;
16065
+ }
16066
+
16067
+ // src/components/event-calendar-view/hooks/use-current-time-indicator.ts
16068
+ var import_date_fns20 = require("date-fns");
16069
+ var import_locale10 = require("date-fns/locale");
16070
+ var import_react77 = require("react");
16071
+ function useCurrentTimeIndicatorAgenda(currentDate, view) {
16072
+ const [currentTimePosition, setCurrentTimePosition] = (0, import_react77.useState)(0);
16073
+ const [currentTimeVisible, setCurrentTimeVisible] = (0, import_react77.useState)(false);
16074
+ (0, import_react77.useEffect)(() => {
16075
+ const calculateTimePosition = () => {
16076
+ const now = /* @__PURE__ */ new Date();
16077
+ const hours = now.getHours();
16078
+ const minutes = now.getMinutes();
16079
+ const totalMinutes = (hours - StartHourAgenda) * 60 + minutes;
16080
+ const dayStartMinutes = 0;
16081
+ const dayEndMinutes = (EndHourAgenda - StartHourAgenda) * 60;
16082
+ const position = (totalMinutes - dayStartMinutes) / (dayEndMinutes - dayStartMinutes) * 100;
16083
+ let isCurrentTimeVisible = false;
16084
+ if (view === "day") {
16085
+ isCurrentTimeVisible = (0, import_date_fns20.isSameDay)(now, currentDate);
16086
+ } else if (view === "week") {
16087
+ const startOfWeekDate = (0, import_date_fns20.startOfWeek)(currentDate, { locale: import_locale10.ptBR });
16088
+ const endOfWeekDate = (0, import_date_fns20.endOfWeek)(currentDate, { locale: import_locale10.ptBR });
16089
+ isCurrentTimeVisible = (0, import_date_fns20.isWithinInterval)(now, {
16090
+ end: endOfWeekDate,
16091
+ start: startOfWeekDate
16092
+ });
16093
+ }
16094
+ setCurrentTimePosition(position);
16095
+ setCurrentTimeVisible(isCurrentTimeVisible);
16096
+ };
16097
+ calculateTimePosition();
16098
+ const interval = setInterval(calculateTimePosition, 6e4);
16099
+ return () => clearInterval(interval);
16100
+ }, [currentDate, view]);
16101
+ return { currentTimePosition, currentTimeVisible };
16102
+ }
16103
+
16104
+ // src/components/event-calendar-view/EventItemAgenda.tsx
16105
+ var import_date_fns21 = require("date-fns");
16106
+ var import_react78 = require("react");
16107
+ var import_react79 = require("@phosphor-icons/react");
16108
+ var import_jsx_runtime88 = require("react/jsx-runtime");
16109
+ var formatTimeWithOptionalMinutes2 = (date) => {
16110
+ return (0, import_date_fns21.format)(date, "HH:mm");
16111
+ };
16112
+ var isValidDate4 = (d) => {
16113
+ try {
16114
+ const dt = d instanceof Date ? d : new Date(String(d));
16115
+ return !isNaN(dt.getTime());
16116
+ } catch {
16117
+ return false;
16118
+ }
16119
+ };
16120
+ function EventWrapper2({
16121
+ event,
16122
+ isFirstDay = true,
16123
+ isLastDay = true,
16124
+ isDragging,
16125
+ onClick,
16126
+ className,
16127
+ children,
16128
+ currentTime,
16129
+ dndListeners,
16130
+ dndAttributes,
16131
+ onMouseDown,
16132
+ onTouchStart,
16133
+ ariaLabel
16134
+ }) {
16135
+ const hasValidTimeForWrapper = isValidDate4(event.start) && isValidDate4(event.end) || isValidDate4(event.attend_date);
16136
+ const displayEnd = (() => {
16137
+ if (isValidDate4(event.start) && isValidDate4(event.end)) {
16138
+ return currentTime ? new Date(
16139
+ new Date(currentTime).getTime() + (new Date(event.end).getTime() - new Date(event.start).getTime())
16140
+ ) : new Date(event.end);
16141
+ }
16142
+ if (isValidDate4(event.attend_date)) {
16143
+ const start = normalizeAttendDate(event.attend_date);
16144
+ return start ? addHoursToDateAgenda(start, 1) : void 0;
16145
+ }
16146
+ return void 0;
16147
+ })();
16148
+ const isEventInPast = displayEnd ? (0, import_date_fns21.isPast)(displayEnd) : false;
16149
+ const colorClasses = hasValidTimeForWrapper ? getEventColorClassesAgenda(event.color) : "bg-gray-200/50 hover:bg-gray-200/40 text-gray-900/80 dark:bg-gray-700/25 dark:text-gray-200/90 shadow-none";
16150
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
16151
+ "button",
16152
+ {
16153
+ className: cn(
16154
+ "flex w-full select-none overflow-hidden px-3 py-1 text-left font-medium outline-none transition-transform duration-150 ease-out backdrop-blur-sm focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring data-dragging:cursor-grabbing data-past-event:line-through data-dragging:shadow-lg sm:px-3 rounded-lg shadow-sm hover:shadow-md ",
16155
+ colorClasses,
16156
+ getBorderRadiusClassesAgenda(isFirstDay, isLastDay),
16157
+ className
16158
+ ),
16159
+ "data-dragging": isDragging || void 0,
16160
+ "data-past-event": isEventInPast || void 0,
16161
+ onClick,
16162
+ onMouseDown,
16163
+ onTouchStart,
16164
+ "aria-label": ariaLabel,
16165
+ type: "button",
16166
+ ...dndListeners,
16167
+ ...dndAttributes,
16168
+ children
16169
+ }
16170
+ );
16171
+ }
16172
+ function EventItemAgenda({
16173
+ event,
16174
+ view,
16175
+ onClick,
16176
+ showTime,
16177
+ currentTime,
16178
+ isFirstDay = true,
16179
+ isLastDay = true,
16180
+ children,
16181
+ className,
16182
+ dndListeners,
16183
+ dndAttributes,
16184
+ onMouseDown,
16185
+ onTouchStart,
16186
+ agendaOnly = false
16187
+ }) {
16188
+ const eventColor = event.color;
16189
+ const hasValidTime = isValidDate4(event.start) && isValidDate4(event.end) || isValidDate4(event.attend_date);
16190
+ const colorClasses = hasValidTime ? getEventColorClassesAgenda(eventColor) : "bg-gray-200/50 hover:bg-gray-200/40 text-gray-900/80 dark:bg-gray-700/25 dark:text-gray-200/90 shadow-none";
16191
+ const displayStart = (0, import_react78.useMemo)(() => {
16192
+ if (!hasValidTime) return void 0;
16193
+ if (isValidDate4(event.start))
16194
+ return currentTime || new Date(event.start);
16195
+ if (isValidDate4(event.attend_date))
16196
+ return currentTime || normalizeAttendDate(event.attend_date);
16197
+ return void 0;
16198
+ }, [currentTime, event.start, event.attend_date, hasValidTime]);
16199
+ const displayEnd = (0, import_react78.useMemo)(() => {
16200
+ if (!hasValidTime) return void 0;
16201
+ if (isValidDate4(event.end)) {
16202
+ return currentTime ? new Date(
16203
+ new Date(currentTime).getTime() + (new Date(event.end).getTime() - new Date(event.start).getTime())
16204
+ ) : new Date(event.end);
16205
+ }
16206
+ if (isValidDate4(event.attend_date)) {
16207
+ const start = normalizeAttendDate(event.attend_date);
16208
+ return start ? addHoursToDateAgenda(start, 1) : void 0;
16209
+ }
16210
+ return void 0;
16211
+ }, [currentTime, event.start, event.end, event.attend_date, hasValidTime]);
16212
+ const durationMinutes = (0, import_react78.useMemo)(() => {
16213
+ if (!hasValidTime || !displayStart || !displayEnd) return 0;
16214
+ return (0, import_date_fns21.differenceInMinutes)(displayEnd, displayStart);
16215
+ }, [displayStart, displayEnd, hasValidTime]);
16216
+ const getEventTime = () => {
16217
+ if (!hasValidTime) return "";
16218
+ if (event.allDay) return "All day";
16219
+ if (durationMinutes < 45) {
16220
+ return formatTimeWithOptionalMinutes2(displayStart);
16221
+ }
16222
+ return `${formatTimeWithOptionalMinutes2(
16223
+ displayStart
16224
+ )} - ${formatTimeWithOptionalMinutes2(displayEnd)}`;
16225
+ };
16226
+ let ariaLabel;
16227
+ if (!hasValidTime) {
16228
+ ariaLabel = event.title;
16229
+ } else if (event.allDay) {
16230
+ ariaLabel = `${event.title}, All day`;
16231
+ } else if (durationMinutes < 45) {
16232
+ ariaLabel = `${event.title}, ${formatTimeWithOptionalMinutes2(
16233
+ displayStart
16234
+ )}`;
16235
+ } else {
16236
+ ariaLabel = `${event.title}, ${formatTimeWithOptionalMinutes2(
16237
+ displayStart
16238
+ )} - ${formatTimeWithOptionalMinutes2(displayEnd)}`;
16239
+ }
16240
+ if (view === "month") {
16241
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
16242
+ EventWrapper2,
16243
+ {
16244
+ className: cn(
16245
+ "mt-[var(--event-gap)] h-[var(--event-height)] items-center text-[10px] sm:text-xs",
16246
+ className
16247
+ ),
16248
+ currentTime,
16249
+ dndAttributes,
16250
+ dndListeners,
16251
+ event,
16252
+ ariaLabel,
16253
+ isFirstDay,
16254
+ isLastDay,
16255
+ onClick,
16256
+ children: children || /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("span", { className: "flex items-center gap-2 truncate", children: [
16257
+ !event.allDay && hasValidTime && displayStart && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "truncate font-normal opacity-80 sm:text-[11px] bg-white/10 px-2 py-0.5 rounded-full text-[11px]", children: formatTimeWithOptionalMinutes2(displayStart) }),
16258
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
16259
+ "span",
16260
+ {
16261
+ className: cn(
16262
+ "truncate",
16263
+ agendaOnly ? "font-bold text-lg" : "font-medium"
16264
+ ),
16265
+ children: event.title
16266
+ }
16267
+ )
16268
+ ] })
16269
+ }
16270
+ );
16271
+ }
16272
+ if (view === "week" || view === "day") {
16273
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
16274
+ EventWrapper2,
16275
+ {
16276
+ className: cn(
16277
+ "py-1",
16278
+ durationMinutes < 45 ? "items-center" : "flex-col",
16279
+ view === "week" ? "text-[10px] sm:text-xs" : "text-xs",
16280
+ className
16281
+ ),
16282
+ currentTime,
16283
+ dndAttributes,
16284
+ dndListeners,
16285
+ event,
16286
+ ariaLabel,
16287
+ isFirstDay,
16288
+ isLastDay,
16289
+ children: durationMinutes < 45 ? /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
16290
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: cn("truncate text-lg"), children: event.title }),
16291
+ showTime && hasValidTime && displayStart && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "ml-2 inline-block bg-white/10 px-2 py-0.5 rounded-full text-[11px] opacity-90", children: formatTimeWithOptionalMinutes2(displayStart) })
16292
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, { children: [
16293
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: cn("truncate font-medium text-lg"), children: event.title }),
16294
+ showTime && hasValidTime && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "truncate font-normal opacity-70 sm:text-[15px]", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "inline-block bg-white/5 px-0.5 py-0.5 rounded-full", children: getEventTime() }) })
16295
+ ] })
16296
+ }
16297
+ );
16298
+ }
16299
+ if (!hasValidTime) {
16300
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
16301
+ "button",
16302
+ {
16303
+ className: cn(
16304
+ "flex w-full flex-col gap-2 rounded-lg p-3 text-left outline-none transition-shadow duration-150 ease-out hover:bg-white/3 focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring",
16305
+ getEventColorClassesAgenda(eventColor),
16306
+ className
16307
+ ),
16308
+ "aria-label": ariaLabel,
16309
+ onClick,
16310
+ onMouseDown,
16311
+ onTouchStart,
16312
+ type: "button",
16313
+ ...dndListeners,
16314
+ ...dndAttributes,
16315
+ children: [
16316
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: cn("font-medium", agendaOnly ? "text-lg" : "text-sm"), children: event.title }),
16317
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
16318
+ "div",
16319
+ {
16320
+ className: cn(
16321
+ "opacity-70 flex items-center gap-2",
16322
+ agendaOnly ? "text-sm" : "text-xs"
16323
+ ),
16324
+ children: event.location && /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("span", { className: "opacity-80 flex items-center gap-1", children: [
16325
+ "-",
16326
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "truncate", children: event.location })
16327
+ ] })
16328
+ }
16329
+ ),
16330
+ event.description && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
16331
+ "div",
16332
+ {
16333
+ className: cn(
16334
+ "my-1 opacity-90",
16335
+ agendaOnly ? "text-md" : "text-xs"
16336
+ ),
16337
+ style: {
16338
+ display: "-webkit-box",
16339
+ WebkitLineClamp: 2,
16340
+ WebkitBoxOrient: "vertical",
16341
+ overflow: "hidden"
16342
+ },
16343
+ children: event.description
16344
+ }
16345
+ )
16346
+ ]
16347
+ }
16348
+ );
16349
+ }
16350
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
16351
+ "button",
16352
+ {
16353
+ className: cn(
16354
+ "flex w-full flex-col gap-2 rounded-lg p-3 text-left outline-none transition-shadow duration-150 ease-out hover:bg-white/3 focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring data-past-event:line-through data-past-event:opacity-90 border-2 border-border",
16355
+ colorClasses,
16356
+ className
16357
+ ),
16358
+ "data-past-event": (0, import_date_fns21.isPast)(displayEnd) || void 0,
16359
+ "aria-label": ariaLabel,
16360
+ onClick,
16361
+ onMouseDown,
16362
+ onTouchStart,
16363
+ type: "button",
16364
+ ...dndListeners,
16365
+ ...dndAttributes,
16366
+ children: [
16367
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "flex w-full justify-between ", children: [
16368
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: cn("font-bold text-lg"), children: event.title }),
16369
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: cn("opacity-90 flex items-center gap-2 text-lg"), children: event.allDay ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { children: "Dia todo" }) : /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("span", { className: "uppercase font-semibold flex items-center gap-2", children: [
16370
+ formatTimeWithOptionalMinutes2(displayStart),
16371
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "opacity-70", children: "-" }),
16372
+ formatTimeWithOptionalMinutes2(displayEnd),
16373
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react79.ClockUserIcon, {})
16374
+ ] }) })
16375
+ ] }),
16376
+ event.description && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
16377
+ "div",
16378
+ {
16379
+ className: cn("my-1 opacity-90 flex text-md"),
16380
+ style: {
16381
+ display: "-webkit-box",
16382
+ WebkitLineClamp: 2,
16383
+ WebkitBoxOrient: "vertical",
16384
+ overflow: "hidden"
16385
+ },
16386
+ children: event.description
16387
+ }
16388
+ )
16389
+ ]
16390
+ }
16391
+ );
16392
+ }
16393
+
16394
+ // src/components/event-calendar-view/DroppableCell.tsx
16395
+ var import_core5 = require("@dnd-kit/core");
16396
+ var import_jsx_runtime89 = require("react/jsx-runtime");
16397
+ function DroppableCellAgenda({
16398
+ id,
16399
+ date,
16400
+ time,
16401
+ children,
16402
+ className,
16403
+ onClick
16404
+ }) {
16405
+ const { activeEvent } = useCalendarDndAgenda();
16406
+ const { setNodeRef, isOver } = (0, import_core5.useDroppable)({
16407
+ data: {
16408
+ date,
16409
+ time
16410
+ },
16411
+ id
16412
+ });
16413
+ const formattedTime = time !== void 0 ? `${Math.floor(time)}:${Math.round((time - Math.floor(time)) * 60).toString().padStart(2, "0")}` : null;
16414
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
16415
+ "div",
16416
+ {
16417
+ className: cn(
16418
+ "flex h-full flex-col overflow-hidden px-0.5 py-1 data-dragging:bg-accent sm:px-1",
16419
+ className
16420
+ ),
16421
+ "data-dragging": isOver && activeEvent ? true : void 0,
16422
+ onClick,
16423
+ ref: setNodeRef,
16424
+ title: formattedTime ? `${formattedTime}` : void 0,
16425
+ children
16426
+ }
16427
+ );
16428
+ }
16429
+
16430
+ // src/components/event-calendar-view/DayView.tsx
16431
+ var import_jsx_runtime90 = require("react/jsx-runtime");
16432
+ function DayViewAgenda({
16433
+ currentDate,
16434
+ events,
16435
+ onEventSelect,
16436
+ showUndatedEvents
16437
+ }) {
16438
+ const hours = (0, import_react80.useMemo)(() => {
16439
+ const dayStart = (0, import_date_fns22.startOfDay)(currentDate);
16440
+ return (0, import_date_fns22.eachHourOfInterval)({
16441
+ end: (0, import_date_fns22.addHours)(dayStart, EndHourAgenda - 1),
16442
+ start: (0, import_date_fns22.addHours)(dayStart, StartHourAgenda)
16443
+ });
16444
+ }, [currentDate]);
16445
+ const dayEvents = (0, import_react80.useMemo)(() => {
16446
+ const dayStart = (0, import_date_fns22.startOfDay)(currentDate);
16447
+ const dayEnd = (0, import_date_fns22.endOfDay)(currentDate);
16448
+ return events.map((event) => {
16449
+ let eventStart = event.start != null ? new Date(event.start) : void 0;
16450
+ let eventEnd = event.end != null ? new Date(event.end) : void 0;
16451
+ if ((!eventStart || !eventEnd) && event.attend_date) {
16452
+ try {
16453
+ const ad = new Date(event.attend_date);
16454
+ const hasTime = ad.getHours() !== 0 || ad.getMinutes() !== 0 || ad.getSeconds() !== 0 || ad.getMilliseconds() !== 0;
16455
+ if (hasTime) {
16456
+ if (!eventStart) eventStart = ad;
16457
+ if (!eventEnd) eventEnd = (0, import_date_fns22.addHours)(ad, 1);
16458
+ }
16459
+ } catch {
16460
+ }
16461
+ }
16462
+ return { event, eventStart, eventEnd };
16463
+ }).filter(({ eventStart, eventEnd }) => !!eventStart && !!eventEnd).filter(
16464
+ ({ eventStart, eventEnd }) => (0, import_date_fns22.areIntervalsOverlapping)(
16465
+ { start: eventStart, end: eventEnd },
16466
+ { start: dayStart, end: dayEnd }
16467
+ )
16468
+ ).map(({ event }) => event).sort((a, b) => {
16469
+ const aStart = a.start ? new Date(a.start).getTime() : a.attend_date ? new Date(a.attend_date).getTime() : 0;
16470
+ const bStart = b.start ? new Date(b.start).getTime() : b.attend_date ? new Date(b.attend_date).getTime() : 0;
16471
+ return aStart - bStart;
16472
+ });
16473
+ }, [currentDate, events]);
16474
+ const allDayEvents = (0, import_react80.useMemo)(() => {
16475
+ return dayEvents.filter((event) => {
16476
+ return event.allDay || isMultiDayEventAgenda(event);
16477
+ });
16478
+ }, [dayEvents]);
16479
+ const timeEvents = (0, import_react80.useMemo)(() => {
16480
+ return dayEvents.filter((event) => {
16481
+ return !event.allDay && !isMultiDayEventAgenda(event);
16482
+ });
16483
+ }, [dayEvents]);
16484
+ const positionedEvents = (0, import_react80.useMemo)(() => {
16485
+ const result = [];
16486
+ const dayStart = (0, import_date_fns22.startOfDay)(currentDate);
16487
+ const sortedEvents = [...timeEvents].sort((a, b) => {
16488
+ const aStart = new Date(a.start);
16489
+ const bStart = new Date(b.start);
16490
+ const aEnd = new Date(a.end);
16491
+ const bEnd = new Date(b.end);
16492
+ if (aStart < bStart) return -1;
16493
+ if (aStart > bStart) return 1;
16494
+ const aDuration = (0, import_date_fns22.differenceInMinutes)(aEnd, aStart);
16495
+ const bDuration = (0, import_date_fns22.differenceInMinutes)(bEnd, bStart);
16496
+ return bDuration - aDuration;
16497
+ });
16498
+ const columns = [];
16499
+ for (const event of sortedEvents) {
16500
+ let eventStart = event.start != null ? new Date(event.start) : void 0;
16501
+ let eventEnd = event.end != null ? new Date(event.end) : void 0;
16502
+ if ((!eventStart || !eventEnd) && event.attend_date) {
16503
+ try {
16504
+ const ad = new Date(event.attend_date);
16505
+ const hasTime = ad.getHours() !== 0 || ad.getMinutes() !== 0 || ad.getSeconds() !== 0 || ad.getMilliseconds() !== 0;
16506
+ if (hasTime) {
16507
+ if (!eventStart) eventStart = ad;
16508
+ if (!eventEnd) eventEnd = (0, import_date_fns22.addHours)(ad, 1);
16509
+ }
16510
+ } catch {
16511
+ }
16512
+ }
16513
+ if (!eventStart || !eventEnd) continue;
16514
+ const adjustedStart = (0, import_date_fns22.isSameDay)(currentDate, eventStart) ? eventStart : dayStart;
16515
+ const adjustedEnd = (0, import_date_fns22.isSameDay)(currentDate, eventEnd) ? eventEnd : (0, import_date_fns22.addHours)(dayStart, 24);
16516
+ const startHour = (0, import_date_fns22.getHours)(adjustedStart) + (0, import_date_fns22.getMinutes)(adjustedStart) / 60;
16517
+ const endHour = (0, import_date_fns22.getHours)(adjustedEnd) + (0, import_date_fns22.getMinutes)(adjustedEnd) / 60;
16518
+ const top = (startHour - StartHourAgenda) * WeekCellsHeightAgenda;
16519
+ const height = (endHour - startHour) * WeekCellsHeightAgenda;
16520
+ let columnIndex = 0;
16521
+ let placed = false;
16522
+ while (!placed) {
16523
+ const col = columns[columnIndex] || [];
16524
+ if (col.length === 0) {
16525
+ columns[columnIndex] = col;
16526
+ placed = true;
16527
+ } else {
16528
+ const overlaps = col.some(
16529
+ (c) => (0, import_date_fns22.areIntervalsOverlapping)(
16530
+ { end: adjustedEnd, start: adjustedStart },
16531
+ { end: c.end, start: c.start }
16532
+ )
16533
+ );
16534
+ if (!overlaps) {
16535
+ placed = true;
16536
+ } else {
16537
+ columnIndex++;
16538
+ }
16539
+ }
16540
+ }
16541
+ const currentColumn = columns[columnIndex] || [];
16542
+ columns[columnIndex] = currentColumn;
16543
+ currentColumn.push({ start: adjustedStart, end: adjustedEnd, event });
16544
+ const width = columnIndex === 0 ? 1 : 0.9;
16545
+ const left = columnIndex === 0 ? 0 : columnIndex * 0.1;
16546
+ result.push({
16547
+ event,
16548
+ height,
16549
+ left,
16550
+ top,
16551
+ width,
16552
+ zIndex: 10 + columnIndex
16553
+ });
16554
+ }
16555
+ return result;
16556
+ }, [currentDate, timeEvents]);
16557
+ const handleEventClick = (event, e) => {
16558
+ e.stopPropagation();
16559
+ onEventSelect(event);
16560
+ };
16561
+ const showAllDaySection = allDayEvents.length > 0;
16562
+ const { currentTimePosition, currentTimeVisible } = useCurrentTimeIndicatorAgenda(
16563
+ currentDate,
16564
+ "day"
16565
+ );
16566
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "contents", "data-slot": "day-view", children: [
16567
+ showAllDaySection && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "border-border/70 border-t bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "grid grid-cols-[3rem_1fr] sm:grid-cols-[4rem_1fr]", children: [
16568
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "absolute bottom-0 left-0 h-6 w-16 max-w-full pe-2 text-right text-[10px] text-muted-foreground/70 sm:pe-4 sm:text-xs", children: "All day" }) }),
16569
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "relative border-border/70 border-r p-1 last:border-r-0", children: allDayEvents.map((event) => {
16570
+ const eventStart = new Date(
16571
+ event.start ?? event.attend_date ?? event.end ?? Date.now()
16572
+ );
16573
+ const eventEnd = new Date(
16574
+ event.end ?? event.attend_date ?? event.start ?? Date.now()
16575
+ );
16576
+ const isFirstDay = (0, import_date_fns22.isSameDay)(currentDate, eventStart);
16577
+ const isLastDay = (0, import_date_fns22.isSameDay)(currentDate, eventEnd);
16578
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
16579
+ EventItemAgenda,
16580
+ {
16581
+ event,
16582
+ isFirstDay,
16583
+ isLastDay,
16584
+ onClick: (e) => handleEventClick(event, e),
16585
+ view: "month",
16586
+ children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { children: event.title })
16587
+ },
16588
+ `spanning-${event.id}`
16589
+ );
16590
+ }) })
16591
+ ] }) }),
16592
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "grid flex-1 grid-cols-[3rem_1fr] overflow-hidden border-border/70 border-t sm:grid-cols-[4rem_1fr]", children: [
16593
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { children: hours.map((hour, index) => /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
16594
+ "div",
16595
+ {
16596
+ className: "relative h-[var(--week-cells-height)] border-border/70 border-b last:border-b-0",
16597
+ children: index > 0 && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "-top-3 absolute left-0 flex h-6 w-16 max-w-full items-center justify-end bg-background pe-2 text-[10px] text-muted-foreground/70 sm:pe-4 sm:text-xs", children: (0, import_date_fns22.format)(hour, "HH:mm") })
16598
+ },
16599
+ hour.toString()
16600
+ )) }),
16601
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "relative", children: [
16602
+ positionedEvents.map((positionedEvent) => {
16603
+ const evt = positionedEvent.event;
16604
+ const eventStart = new Date(
16605
+ evt.start ?? evt.attend_date ?? evt.end ?? Date.now()
16606
+ );
16607
+ const eventEnd = new Date(
16608
+ evt.end ?? evt.attend_date ?? evt.start ?? Date.now()
16609
+ );
16610
+ const isFirstDay = (0, import_date_fns22.isSameDay)(currentDate, eventStart);
16611
+ const isLastDay = (0, import_date_fns22.isSameDay)(currentDate, eventEnd);
16612
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
16613
+ "div",
16614
+ {
16615
+ className: "absolute z-10 px-0.5",
16616
+ style: {
16617
+ height: `${positionedEvent.height}px`,
16618
+ left: `${positionedEvent.left * 100}%`,
16619
+ top: `${positionedEvent.top}px`,
16620
+ width: `${positionedEvent.width * 100}%`,
16621
+ zIndex: positionedEvent.zIndex
16622
+ },
16623
+ children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
16624
+ EventItemAgenda,
16625
+ {
16626
+ event: evt,
16627
+ view: "day",
16628
+ isFirstDay,
16629
+ isLastDay,
16630
+ onClick: (e) => handleEventClick(evt, e),
16631
+ showTime: true
16632
+ }
16633
+ )
16634
+ },
16635
+ positionedEvent.event.id
16636
+ );
16637
+ }),
16638
+ currentTimeVisible && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
16639
+ "div",
16640
+ {
16641
+ className: "pointer-events-none absolute right-0 left-0 z-20",
16642
+ style: { top: `${currentTimePosition}%` },
16643
+ children: /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "relative flex items-center", children: [
16644
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "-left-1 absolute h-2 w-2 rounded-full bg-primary" }),
16645
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "h-[2px] w-full bg-primary" })
16646
+ ] })
16647
+ }
16648
+ ),
16649
+ hours.map((hour) => {
16650
+ const hourValue = (0, import_date_fns22.getHours)(hour);
16651
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
16652
+ "div",
16653
+ {
16654
+ className: "relative h-[var(--week-cells-height)] border-border/70 border-b last:border-b-0",
16655
+ children: [0, 1, 2, 3].map((quarter) => {
16656
+ const quarterHourTime = hourValue + quarter * 0.25;
16657
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
16658
+ DroppableCellAgenda,
16659
+ {
16660
+ className: cn(
16661
+ "absolute h-[calc(var(--week-cells-height)/4)] w-full",
16662
+ quarter === 0 && "top-0",
16663
+ quarter === 1 && "top-[calc(var(--week-cells-height)/4)]",
16664
+ quarter === 2 && "top-[calc(var(--week-cells-height)/4*2)]",
16665
+ quarter === 3 && "top-[calc(var(--week-cells-height)/4*3)]"
16666
+ ),
16667
+ date: currentDate,
16668
+ id: `day-cell-${currentDate.toISOString()}-${quarterHourTime}`,
16669
+ onClick: () => {
16670
+ const startTime = new Date(currentDate);
16671
+ startTime.setHours(hourValue);
16672
+ startTime.setMinutes(quarter * 15);
16673
+ },
16674
+ time: quarterHourTime
16675
+ },
16676
+ `${hour.toString()}-${quarter}`
16677
+ );
16678
+ })
16679
+ },
16680
+ hour.toString()
16681
+ );
16682
+ })
16683
+ ] })
16684
+ ] }),
16685
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
16686
+ UndatedEvents,
16687
+ {
16688
+ events,
16689
+ onEventSelect,
16690
+ show: showUndatedEvents
16691
+ }
16692
+ )
16693
+ ] });
16694
+ }
16695
+
16696
+ // src/components/event-calendar-view/EventAgenda.tsx
16697
+ var import_date_fns23 = require("date-fns");
16698
+ var import_locale11 = require("date-fns/locale");
16699
+ var import_react81 = require("react");
16700
+ var import_sonner4 = require("sonner");
16701
+ var import_react82 = require("@phosphor-icons/react");
16702
+ var import_jsx_runtime91 = require("react/jsx-runtime");
16703
+ function EventAgenda({
16704
+ events = [],
16705
+ onEventUpdate,
16706
+ className,
16707
+ initialView = "month",
16708
+ mode,
16709
+ initialDate
16710
+ }) {
16711
+ const [currentDate, setCurrentDate] = (0, import_react81.useState)(
16712
+ initialDate && new Date(initialDate) || /* @__PURE__ */ new Date()
16713
+ );
16714
+ const [view, setView] = (0, import_react81.useState)(initialView);
16715
+ const [isFading, setIsFading] = (0, import_react81.useState)(false);
16716
+ const FADE_DURATION = 220;
16717
+ const changeView = (0, import_react81.useCallback)(
16718
+ (next) => {
16719
+ if (mode === "agenda-only") return;
16720
+ if (next === view) return;
16721
+ setIsFading(true);
16722
+ window.setTimeout(() => {
16723
+ setView(next);
16724
+ requestAnimationFrame(() => setIsFading(false));
16725
+ }, FADE_DURATION);
16726
+ },
16727
+ [view, mode]
16728
+ );
16729
+ const [isPaging, setIsPaging] = (0, import_react81.useState)(false);
16730
+ const [pageDirection, setPageDirection] = (0, import_react81.useState)(
16731
+ null
16732
+ );
16733
+ const PAGE_DURATION = 200;
16734
+ const pageTransition = (0, import_react81.useCallback)(
16735
+ (applyDateChange, direction) => {
16736
+ setIsPaging(true);
16737
+ setPageDirection(direction);
16738
+ window.setTimeout(() => {
16739
+ applyDateChange();
16740
+ requestAnimationFrame(() => {
16741
+ setIsPaging(false);
16742
+ setPageDirection(null);
16743
+ });
16744
+ }, PAGE_DURATION);
16745
+ },
16746
+ []
16747
+ );
16748
+ const [isEventDialogOpen, setIsEventDialogOpen] = (0, import_react81.useState)(false);
16749
+ (0, import_react81.useEffect)(() => {
16750
+ const handleKeyDown = (e) => {
16751
+ if (isEventDialogOpen || e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLElement && e.target.isContentEditable) {
16752
+ return;
16753
+ }
16754
+ if (mode === "agenda-only") return;
16755
+ switch (e.key.toLowerCase()) {
16756
+ case "m":
16757
+ changeView("month");
16758
+ break;
16759
+ case "w":
16760
+ case "s":
16761
+ changeView("week");
16762
+ break;
16763
+ case "d":
16764
+ changeView("day");
16765
+ break;
16766
+ case "a":
16767
+ changeView("agenda");
16768
+ break;
16769
+ }
16770
+ };
16771
+ window.addEventListener("keydown", handleKeyDown);
16772
+ return () => {
16773
+ window.removeEventListener("keydown", handleKeyDown);
16774
+ };
16775
+ }, [isEventDialogOpen, changeView, mode]);
16776
+ (0, import_react81.useEffect)(() => {
16777
+ if (mode === "agenda-only") setView("agenda");
16778
+ }, [mode]);
16779
+ const handlePrevious = () => {
16780
+ pageTransition(() => {
16781
+ if (view === "month") {
16782
+ setCurrentDate((0, import_date_fns23.subMonths)(currentDate, 1));
16783
+ } else if (view === "week") {
16784
+ setCurrentDate((0, import_date_fns23.subWeeks)(currentDate, 1));
16785
+ } else if (view === "day") {
16786
+ setCurrentDate((0, import_date_fns23.addDays)(currentDate, -1));
16787
+ } else if (view === "agenda") {
16788
+ setCurrentDate((0, import_date_fns23.addDays)(currentDate, -AgendaDaysToShowAgenda));
16789
+ }
16790
+ }, "right");
16791
+ };
16792
+ const handleNext = () => {
16793
+ pageTransition(() => {
16794
+ if (view === "month") {
16795
+ setCurrentDate((0, import_date_fns23.addMonths)(currentDate, 1));
16796
+ } else if (view === "week") {
16797
+ setCurrentDate((0, import_date_fns23.addWeeks)(currentDate, 1));
16798
+ } else if (view === "day") {
16799
+ setCurrentDate((0, import_date_fns23.addDays)(currentDate, 1));
16800
+ } else if (view === "agenda") {
16801
+ setCurrentDate((0, import_date_fns23.addDays)(currentDate, AgendaDaysToShowAgenda));
16802
+ }
16803
+ }, "left");
16804
+ };
16805
+ const handleToday = () => {
16806
+ setCurrentDate(/* @__PURE__ */ new Date());
16807
+ };
16808
+ const handleEventSelect = (event) => {
16809
+ console.log("Event selected:", event);
16810
+ setIsEventDialogOpen(true);
16811
+ };
16812
+ const handleEventUpdate = (updatedEvent) => {
16813
+ onEventUpdate?.(updatedEvent);
16814
+ const startDate = updatedEvent.start ?? /* @__PURE__ */ new Date();
16815
+ (0, import_sonner4.toast)(`Evento "${updatedEvent.title}" movido`, {
16816
+ description: (0, import_date_fns23.format)(startDate, "d 'de' MMMM 'de' yyyy", { locale: import_locale11.ptBR }),
16817
+ position: "bottom-left"
16818
+ });
16819
+ };
16820
+ const viewTitle = (0, import_react81.useMemo)(() => {
16821
+ const capitalize = (s) => s && s.length > 0 ? s.charAt(0).toUpperCase() + s.slice(1) : s;
16822
+ if (view === "month") {
16823
+ return capitalize((0, import_date_fns23.format)(currentDate, "MMMM yyyy", { locale: import_locale11.ptBR }));
16824
+ }
16825
+ if (view === "week") {
16826
+ const start = (0, import_date_fns23.startOfWeek)(currentDate, { weekStartsOn: 1 });
16827
+ const end = (0, import_date_fns23.endOfWeek)(currentDate, { weekStartsOn: 1 });
16828
+ if ((0, import_date_fns23.isSameMonth)(start, end)) {
16829
+ return capitalize((0, import_date_fns23.format)(start, "MMMM yyyy", { locale: import_locale11.ptBR }));
16830
+ }
16831
+ const s1 = capitalize((0, import_date_fns23.format)(start, "MMM", { locale: import_locale11.ptBR }));
16832
+ const s2 = capitalize((0, import_date_fns23.format)(end, "MMM yyyy", { locale: import_locale11.ptBR }));
16833
+ return `${s1} - ${s2}`;
16834
+ }
16835
+ if (view === "day") {
16836
+ const dayNum = (0, import_date_fns23.format)(currentDate, "d", { locale: import_locale11.ptBR });
16837
+ const month = capitalize((0, import_date_fns23.format)(currentDate, "MMMM", { locale: import_locale11.ptBR }));
16838
+ const year = (0, import_date_fns23.format)(currentDate, "yyyy", { locale: import_locale11.ptBR });
16839
+ const short = `${dayNum} de ${month} de ${year}`;
16840
+ return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_jsx_runtime91.Fragment, { children: [
16841
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { "aria-hidden": "true", className: "min-[480px]:hidden", children: short }),
16842
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { "aria-hidden": "true", className: "max-[479px]:hidden min-md:hidden", children: short })
16843
+ ] });
16844
+ }
16845
+ if (view === "agenda") {
16846
+ const start = currentDate;
16847
+ const end = (0, import_date_fns23.addDays)(currentDate, AgendaDaysToShowAgenda - 1);
16848
+ if ((0, import_date_fns23.isSameMonth)(start, end)) {
16849
+ return capitalize((0, import_date_fns23.format)(start, "MMMM yyyy", { locale: import_locale11.ptBR }));
16850
+ }
16851
+ const s1 = capitalize((0, import_date_fns23.format)(start, "MMMM", { locale: import_locale11.ptBR }));
16852
+ const s2 = capitalize((0, import_date_fns23.format)(end, "MMMM yyyy", { locale: import_locale11.ptBR }));
16853
+ return `${s1} - ${s2}`;
16854
+ }
16855
+ return capitalize((0, import_date_fns23.format)(currentDate, "MMMM yyyy", { locale: import_locale11.ptBR }));
16856
+ }, [currentDate, view]);
16857
+ const calendarContent = /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_jsx_runtime91.Fragment, { children: [
16858
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
16859
+ "div",
16860
+ {
16861
+ className: cn(
16862
+ "flex items-center justify-between p-2 sm:p-4",
16863
+ className
16864
+ ),
16865
+ children: [
16866
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex items-center gap-1 sm:gap-4", children: [
16867
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
16868
+ ButtonBase,
16869
+ {
16870
+ className: "max-[479px]:aspect-square max-[479px]:p-0!",
16871
+ onClick: handleToday,
16872
+ variant: "outline",
16873
+ children: [
16874
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
16875
+ import_react82.CalendarIcon,
16876
+ {
16877
+ "aria-hidden": "true",
16878
+ className: "min-[480px]:hidden",
16879
+ size: 16
16880
+ }
16881
+ ),
16882
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "max-[479px]:sr-only", children: "Hoje" })
16883
+ ]
16884
+ }
16885
+ ),
16886
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex items-center sm:gap-2", children: [
16887
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
16888
+ ButtonBase,
16889
+ {
16890
+ "aria-label": "Anterior",
16891
+ onClick: handlePrevious,
16892
+ size: "icon",
16893
+ variant: "ghost",
16894
+ children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react82.CaretLeftIcon, { "aria-hidden": "true", size: 16 })
16895
+ }
16896
+ ),
16897
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
16898
+ ButtonBase,
16899
+ {
16900
+ "aria-label": "Pr\xF3ximo",
16901
+ onClick: handleNext,
16902
+ size: "icon",
16903
+ variant: "ghost",
16904
+ children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react82.CaretRightIcon, { "aria-hidden": "true", size: 16 })
16905
+ }
16906
+ )
16907
+ ] }),
16908
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("h2", { className: "font-semibold text-xl", children: viewTitle })
16909
+ ] }),
16910
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_jsx_runtime91.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(DropDownMenuBase, { children: [
16911
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(DropDownMenuTriggerBase, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
16912
+ ButtonBase,
16913
+ {
16914
+ className: "gap-2 px-3 py-1.5 max-[479px]:h-8",
16915
+ variant: "outline",
16916
+ children: [
16917
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("span", { className: "flex items-center gap-2", children: [
16918
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "hidden min-[480px]:inline-block", children: (() => {
16919
+ const labels = {
16920
+ month: "M\xEAs",
16921
+ week: "Semana",
16922
+ day: "Dia",
16923
+ agenda: "Agenda"
16924
+ };
16925
+ return labels[view] || view;
16926
+ })() }),
16927
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "min-[480px]:hidden", children: (() => {
16928
+ const labels = {
16929
+ month: "M",
16930
+ week: "S",
16931
+ day: "D",
16932
+ agenda: "A"
16933
+ };
16934
+ return labels[view] || view;
16935
+ })() })
16936
+ ] }),
16937
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
16938
+ import_react82.CaretDownIcon,
16939
+ {
16940
+ "aria-hidden": "true",
16941
+ className: "-me-1 opacity-60",
16942
+ size: 16
16943
+ }
16944
+ )
16945
+ ]
16946
+ }
16947
+ ) }),
16948
+ mode === "agenda-only" ? null : /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
16949
+ DropDownMenuContentBase,
16950
+ {
16951
+ align: "end",
16952
+ className: "min-w-32 rounded-md p-1",
16953
+ children: [
16954
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
16955
+ DropDownMenuItemBase,
16956
+ {
16957
+ onClick: () => changeView("month"),
16958
+ className: cn(
16959
+ "flex items-center justify-between gap-2 px-3 py-2 rounded",
16960
+ view === "month"
16961
+ ),
16962
+ children: [
16963
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { children: " M\xEAs " }) }),
16964
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex items-center gap-2", children: view === "month" ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react82.Check, { "aria-hidden": true, className: "opacity-80", size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(DropDownMenuShortcutBase, { children: "M" }) })
16965
+ ]
16966
+ }
16967
+ ),
16968
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
16969
+ DropDownMenuItemBase,
16970
+ {
16971
+ onClick: () => changeView("week"),
16972
+ className: cn(
16973
+ "flex items-center justify-between gap-2 px-3 py-2 rounded",
16974
+ view === "week"
16975
+ ),
16976
+ children: [
16977
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex items-center gap-2", children: "Semana" }),
16978
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex items-center gap-2", children: view === "week" ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react82.Check, { "aria-hidden": true, className: "opacity-80", size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(DropDownMenuShortcutBase, { children: "S" }) })
16979
+ ]
16980
+ }
16981
+ ),
16982
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
16983
+ DropDownMenuItemBase,
16984
+ {
16985
+ onClick: () => changeView("day"),
16986
+ className: cn(
16987
+ "flex items-center justify-between gap-2 px-3 py-2 rounded",
16988
+ view === "day"
16989
+ ),
16990
+ children: [
16991
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex items-center gap-2", children: "Dia" }),
16992
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex items-center gap-2", children: view === "day" ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react82.Check, { "aria-hidden": true, className: "opacity-80", size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(DropDownMenuShortcutBase, { children: "D" }) })
16993
+ ]
16994
+ }
16995
+ ),
16996
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
16997
+ DropDownMenuItemBase,
16998
+ {
16999
+ onClick: () => changeView("agenda"),
17000
+ className: cn(
17001
+ "flex items-center justify-between gap-2 px-3 py-2 rounded",
17002
+ view === "agenda"
17003
+ ),
17004
+ children: [
17005
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex items-center gap-2", children: "Agenda" }),
17006
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex items-center gap-2", children: view === "agenda" ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react82.Check, { "aria-hidden": true, className: "opacity-80", size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(DropDownMenuShortcutBase, { children: "A" }) })
17007
+ ]
17008
+ }
17009
+ )
17010
+ ]
17011
+ }
17012
+ )
17013
+ ] }) }) })
17014
+ ]
17015
+ }
17016
+ ),
17017
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
17018
+ "div",
17019
+ {
17020
+ className: cn(
17021
+ "flex flex-1 flex-col transition-all duration-200 ease-in-out",
17022
+ isFading ? "opacity-0 -translate-y-2 pointer-events-none" : isPaging ? pageDirection === "left" ? "-translate-x-4 opacity-0 pointer-events-none" : "translate-x-4 opacity-0 pointer-events-none" : "opacity-100 translate-y-0"
17023
+ ),
17024
+ "aria-live": "polite",
17025
+ children: [
17026
+ view === "month" && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
17027
+ MonthViewAgenda,
17028
+ {
17029
+ currentDate,
17030
+ events,
17031
+ onEventSelect: handleEventSelect
17032
+ }
17033
+ ),
17034
+ view === "week" && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
17035
+ WeekViewAgenda,
17036
+ {
17037
+ currentDate,
17038
+ events,
17039
+ onEventSelect: handleEventSelect
17040
+ }
17041
+ ),
17042
+ view === "day" && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
17043
+ DayViewAgenda,
17044
+ {
17045
+ currentDate,
17046
+ events,
17047
+ onEventSelect: handleEventSelect
17048
+ }
17049
+ ),
17050
+ view === "agenda" && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
17051
+ Agenda,
17052
+ {
17053
+ currentDate,
17054
+ events,
17055
+ onEventSelect: handleEventSelect
17056
+ }
17057
+ )
17058
+ ]
17059
+ }
17060
+ )
17061
+ ] });
17062
+ return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
17063
+ "div",
17064
+ {
17065
+ className: "flex flex-col rounded-lg border has-data-[slot=month-view]:flex-1 px-6",
17066
+ style: {
17067
+ "--event-gap": `${EventGapAgenda}px`,
17068
+ "--event-height": `${EventHeightAgenda}px`,
17069
+ "--week-cells-height": `${WeekCellsHeightAgenda}px`
17070
+ },
17071
+ children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(CalendarDndProviderAgenda, { onEventUpdate: handleEventUpdate, children: calendarContent })
17072
+ }
17073
+ );
17074
+ }
17075
+
17076
+ // src/components/event-calendar-view/UndatedEvents.tsx
17077
+ var import_react83 = require("react");
17078
+ var import_jsx_runtime92 = require("react/jsx-runtime");
17079
+ var isValidDate5 = (d) => {
17080
+ try {
17081
+ const t = d instanceof Date ? d.getTime() : new Date(String(d)).getTime();
17082
+ return !isNaN(t);
17083
+ } catch {
17084
+ return false;
17085
+ }
17086
+ };
17087
+ function UndatedEvents({
17088
+ events,
17089
+ onEventSelect,
17090
+ className,
17091
+ title = "Data de Atendimento n\xE3o Prevista",
17092
+ show = true
17093
+ }) {
17094
+ const undatedEvents = (0, import_react83.useMemo)(
17095
+ () => events.filter(
17096
+ (e) => !(isValidDate5(e.start) && isValidDate5(e.end)) && !isValidDate5(e.attend_date)
17097
+ ),
17098
+ [events]
17099
+ );
17100
+ if (!show || undatedEvents.length === 0) return null;
17101
+ return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "relative border-border/70 border-t", children: [
17102
+ /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "-top-3 absolute left-0 flex h-6 items-center bg-background pe-4 uppercase sm:pe-4 text-lg", children: title }),
17103
+ /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "mt-6 space-y-2", children: undatedEvents.map((event) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
17104
+ EventItemAgenda,
17105
+ {
17106
+ event,
17107
+ onClick: onEventSelect ? () => onEventSelect(event) : void 0,
17108
+ view: "agenda",
17109
+ agendaOnly: true,
17110
+ className: "cursor-default hover:shadow-none hover:scale-100 bg-gray-200/50 hover:bg-gray-200/40 text-gray-900/80 dark:bg-gray-700/25 dark:text-gray-200/90 shadow-none "
17111
+ },
17112
+ event.id
17113
+ )) })
17114
+ ] }) });
17115
+ }
17116
+
17117
+ // src/components/event-calendar-view/hooks/use-event-visibility.ts
17118
+ var import_react84 = require("react");
17119
+ function useEventVisibilityAgenda({
17120
+ eventHeight,
17121
+ eventGap
17122
+ }) {
17123
+ const contentRef = (0, import_react84.useRef)(null);
17124
+ const observerRef = (0, import_react84.useRef)(null);
17125
+ const [contentHeight, setContentHeight] = (0, import_react84.useState)(null);
17126
+ (0, import_react84.useLayoutEffect)(() => {
17127
+ if (!contentRef.current) return;
17128
+ const updateHeight = () => {
17129
+ if (contentRef.current) {
17130
+ setContentHeight(contentRef.current.clientHeight);
17131
+ }
17132
+ };
17133
+ updateHeight();
17134
+ if (!observerRef.current) {
17135
+ observerRef.current = new ResizeObserver(() => {
17136
+ updateHeight();
17137
+ });
17138
+ }
17139
+ observerRef.current.observe(contentRef.current);
17140
+ return () => {
17141
+ if (observerRef.current) {
17142
+ observerRef.current.disconnect();
17143
+ }
17144
+ };
17145
+ }, []);
17146
+ const getVisibleEventCount = (0, import_react84.useMemo)(() => {
17147
+ return (totalEvents) => {
17148
+ if (!contentHeight) return totalEvents;
17149
+ const maxEvents = Math.floor(contentHeight / (eventHeight + eventGap));
17150
+ if (totalEvents <= maxEvents) {
17151
+ return totalEvents;
17152
+ }
17153
+ return maxEvents > 0 ? maxEvents - 1 : 0;
17154
+ };
17155
+ }, [contentHeight, eventHeight, eventGap]);
17156
+ return {
17157
+ contentHeight,
17158
+ contentRef,
17159
+ getVisibleEventCount
17160
+ };
17161
+ }
17162
+
17163
+ // src/components/event-calendar-view/MonthView.tsx
17164
+ var import_date_fns24 = require("date-fns");
17165
+ var import_locale12 = require("date-fns/locale");
17166
+ var import_react85 = require("react");
17167
+ var import_tailwind_merge3 = require("tailwind-merge");
17168
+ var import_jsx_runtime93 = require("react/jsx-runtime");
17169
+ function MonthViewAgenda({
17170
+ currentDate,
17171
+ events,
17172
+ onEventSelect,
17173
+ showUndatedEvents
17174
+ }) {
17175
+ const days = (0, import_react85.useMemo)(() => {
17176
+ const monthStart = (0, import_date_fns24.startOfMonth)(currentDate);
17177
+ const monthEnd = (0, import_date_fns24.endOfMonth)(monthStart);
17178
+ const calendarStart = (0, import_date_fns24.startOfWeek)(monthStart, { weekStartsOn: 0 });
17179
+ const calendarEnd = (0, import_date_fns24.endOfWeek)(monthEnd, { weekStartsOn: 0 });
17180
+ return (0, import_date_fns24.eachDayOfInterval)({ end: calendarEnd, start: calendarStart });
17181
+ }, [currentDate]);
17182
+ const weekdays = (0, import_react85.useMemo)(() => {
17183
+ return Array.from({ length: 7 }).map((_, i) => {
17184
+ const date = (0, import_date_fns24.addDays)((0, import_date_fns24.startOfWeek)(/* @__PURE__ */ new Date(), { weekStartsOn: 0 }), i);
17185
+ const short = (0, import_date_fns24.format)(date, "EEE", { locale: import_locale12.ptBR });
17186
+ return short.charAt(0).toUpperCase() + short.slice(1);
17187
+ });
17188
+ }, []);
17189
+ const weeks = (0, import_react85.useMemo)(() => {
17190
+ const result = [];
17191
+ let week = [];
17192
+ for (let i = 0; i < days.length; i++) {
17193
+ week.push(days[i]);
17194
+ if (week.length === 7 || i === days.length - 1) {
17195
+ result.push(week);
17196
+ week = [];
17197
+ }
17198
+ }
17199
+ return result;
17200
+ }, [days]);
17201
+ const handleEventClick = (event, e) => {
17202
+ e.stopPropagation();
17203
+ onEventSelect(event);
17204
+ };
17205
+ const [isMounted, setIsMounted] = (0, import_react85.useState)(false);
17206
+ const { contentRef, getVisibleEventCount } = useEventVisibilityAgenda({
17207
+ eventGap: EventGapAgenda,
17208
+ eventHeight: EventHeightAgenda
17209
+ });
17210
+ (0, import_react85.useEffect)(() => {
17211
+ setIsMounted(true);
17212
+ }, []);
17213
+ return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "contents", "data-slot": "month-view", children: [
17214
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "grid grid-cols-7 border-border/70 border-b", children: weekdays.map((day) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
17215
+ "div",
17216
+ {
17217
+ className: "py-2 text-center text-muted-foreground/70 text-sm uppercase tracking-wide bg-muted/5",
17218
+ children: day
17219
+ },
17220
+ day
17221
+ )) }),
17222
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "grid flex-1 auto-rows-fr", children: weeks.map((week, weekIndex) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
17223
+ "div",
17224
+ {
17225
+ className: "grid grid-cols-7 [&:last-child>*]:border-b-0",
17226
+ children: week.map((day, dayIndex) => {
17227
+ if (!day) return null;
17228
+ const dayEvents = getEventsForDayAgenda(events, day);
17229
+ const spanningEvents = getSpanningEventsForDayAgenda(events, day);
17230
+ const isCurrentMonth = (0, import_date_fns24.isSameMonth)(day, currentDate);
17231
+ const cellId = `month-cell-${day.toISOString()}`;
17232
+ const allDayEvents = [...spanningEvents, ...dayEvents];
17233
+ const allEvents = getAllEventsForDayAgenda(events, day);
17234
+ const isReferenceCell = weekIndex === 0 && dayIndex === 0;
17235
+ const visibleCount = isMounted ? getVisibleEventCount(allDayEvents.length) : void 0;
17236
+ const hasMore = visibleCount !== void 0 && allDayEvents.length > visibleCount;
17237
+ const remainingCount = hasMore ? allDayEvents.length - visibleCount : 0;
17238
+ return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
17239
+ "div",
17240
+ {
17241
+ className: "group border-border/70 border-r border-b last:border-r-0 data-outside-cell:bg-muted/25 data-outside-cell:text-muted-foreground/70 hover:bg-muted/5 transition-colors p-2 ",
17242
+ "data-outside-cell": !isCurrentMonth || void 0,
17243
+ "data-today": (0, import_date_fns24.isToday)(day) || void 0,
17244
+ children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
17245
+ DroppableCellAgenda,
17246
+ {
17247
+ date: day,
17248
+ id: cellId,
17249
+ onClick: () => {
17250
+ const startTime = new Date(day);
17251
+ startTime.setHours(DefaultStartHourAgenda, 0, 0);
17252
+ },
17253
+ children: [
17254
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
17255
+ "div",
17256
+ {
17257
+ className: (0, import_tailwind_merge3.twMerge)(
17258
+ `mt-1 inline-flex w-7 h-7 items-center justify-center rounded-full text-sm font-semibold text-muted-foreground`,
17259
+ (0, import_date_fns24.isToday)(day) ? "bg-blue-500 text-white" : ""
17260
+ ),
17261
+ children: (0, import_date_fns24.format)(day, "d")
17262
+ }
17263
+ ),
17264
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
17265
+ "div",
17266
+ {
17267
+ className: "min-h-[calc((var(--event-height)+var(--event-gap))*2)] sm:min-h-[calc((var(--event-height)+var(--event-gap))*3)] lg:min-h-[calc((var(--event-height)+var(--event-gap))*4)] px-1 py-1",
17268
+ ref: isReferenceCell ? contentRef : null,
17269
+ children: [
17270
+ sortEventsAgenda(allDayEvents).map((event, index) => {
17271
+ const eventStart = new Date(
17272
+ event.start ?? event.attend_date ?? event.end ?? Date.now()
17273
+ );
17274
+ const eventEnd = new Date(
17275
+ event.end ?? event.attend_date ?? event.start ?? Date.now()
17276
+ );
17277
+ const isFirstDay = (0, import_date_fns24.isSameDay)(day, eventStart);
17278
+ const isLastDay = (0, import_date_fns24.isSameDay)(day, eventEnd);
17279
+ const isHidden = isMounted && visibleCount && index >= visibleCount;
17280
+ if (!visibleCount) return null;
17281
+ if (!isFirstDay) {
17282
+ return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
17283
+ "div",
17284
+ {
17285
+ "aria-hidden": isHidden ? "true" : void 0,
17286
+ className: "aria-hidden:hidden",
17287
+ children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
17288
+ EventItemAgenda,
17289
+ {
17290
+ event,
17291
+ isFirstDay,
17292
+ isLastDay,
17293
+ onClick: (e) => handleEventClick(event, e),
17294
+ view: "month",
17295
+ children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { "aria-hidden": true, className: "invisible", children: [
17296
+ !event.allDay && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("span", { children: [
17297
+ (0, import_date_fns24.format)(eventStart, "HH:mm"),
17298
+ " "
17299
+ ] }),
17300
+ event.title
17301
+ ] })
17302
+ }
17303
+ )
17304
+ },
17305
+ `spanning-${event.id}-${day.toISOString().slice(0, 10)}`
17306
+ );
17307
+ }
17308
+ return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
17309
+ "div",
17310
+ {
17311
+ "aria-hidden": isHidden ? "true" : void 0,
17312
+ className: "aria-hidden:hidden",
17313
+ children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
17314
+ EventItemAgenda,
17315
+ {
17316
+ className: "cursor-default",
17317
+ event,
17318
+ isFirstDay,
17319
+ isLastDay,
17320
+ onClick: (e) => handleEventClick(event, e),
17321
+ view: "month",
17322
+ children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("span", { className: "flex items-center gap-2 truncate", children: [
17323
+ !event.allDay && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "truncate font-normal opacity-80 sm:text-[11px] bg-white/10 px-2 py-0.5 rounded-full text-[11px]", children: (0, import_date_fns24.format)(eventStart, "HH:mm") }),
17324
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "truncate font-medium", children: event.title })
17325
+ ] })
17326
+ }
17327
+ )
17328
+ },
17329
+ event.id
17330
+ );
17331
+ }),
17332
+ hasMore && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(PopoverBase, { modal: true, children: [
17333
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(PopoverTriggerBase, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
17334
+ "button",
17335
+ {
17336
+ className: "mt-[var(--event-gap)] flex h-[var(--event-height)] w-full select-none items-center overflow-hidden px-2 text-left text-[10px] text-muted-foreground outline-none backdrop-blur-md rounded-md transition hover:bg-muted/60 hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 sm:text-xs",
17337
+ onClick: (e) => e.stopPropagation(),
17338
+ type: "button",
17339
+ "aria-label": `Show ${remainingCount} more events on ${(0, import_date_fns24.format)(
17340
+ day,
17341
+ "PPP",
17342
+ { locale: import_locale12.ptBR }
17343
+ )}`,
17344
+ children: [
17345
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("span", { className: "font-medium", children: [
17346
+ "+ ",
17347
+ remainingCount
17348
+ ] }),
17349
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "sr-only", children: " more" })
17350
+ ]
17351
+ }
17352
+ ) }),
17353
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
17354
+ PopoverContentBase,
17355
+ {
17356
+ align: "center",
17357
+ className: "max-w-52 p-3",
17358
+ style: {
17359
+ "--event-height": `${EventHeightAgenda}px`
17360
+ },
17361
+ children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "space-y-2", children: [
17362
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "font-medium text-sm", children: (0, import_date_fns24.format)(day, "EEE d", { locale: import_locale12.ptBR }) }),
17363
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "space-y-1", children: sortEventsAgenda(allEvents).map((event) => {
17364
+ const eventStart = new Date(
17365
+ event.start ?? event.end ?? Date.now()
17366
+ );
17367
+ const eventEnd = new Date(
17368
+ event.end ?? event.start ?? Date.now()
17369
+ );
17370
+ const isFirstDay = (0, import_date_fns24.isSameDay)(day, eventStart);
17371
+ const isLastDay = (0, import_date_fns24.isSameDay)(day, eventEnd);
17372
+ return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
17373
+ EventItemAgenda,
17374
+ {
17375
+ event,
17376
+ isFirstDay,
17377
+ isLastDay,
17378
+ onClick: (e) => handleEventClick(event, e),
17379
+ view: "month"
17380
+ },
17381
+ event.id
17382
+ );
17383
+ }) })
17384
+ ] })
17385
+ }
17386
+ )
17387
+ ] })
17388
+ ]
17389
+ }
17390
+ )
17391
+ ]
17392
+ }
17393
+ )
17394
+ },
17395
+ day.toString()
17396
+ );
17397
+ })
17398
+ },
17399
+ `week-${week}`
17400
+ )) }),
17401
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
17402
+ UndatedEvents,
17403
+ {
17404
+ events,
17405
+ onEventSelect,
17406
+ className: "my-12",
17407
+ show: showUndatedEvents
17408
+ }
17409
+ )
17410
+ ] });
17411
+ }
17412
+
17413
+ // src/components/event-calendar-view/WeekView.tsx
17414
+ var import_date_fns26 = require("date-fns");
17415
+ var import_date_fns27 = require("date-fns");
17416
+ var import_locale13 = require("date-fns/locale");
17417
+ var import_react87 = require("react");
17418
+
17419
+ // src/components/event-calendar-view/DraggablaEvent.tsx
17420
+ var import_core6 = require("@dnd-kit/core");
17421
+ var import_utilities2 = require("@dnd-kit/utilities");
17422
+ var import_date_fns25 = require("date-fns");
17423
+ var import_react86 = require("react");
17424
+ var import_jsx_runtime94 = require("react/jsx-runtime");
17425
+ function DraggableEvent2({
17426
+ event,
17427
+ view,
17428
+ showTime,
17429
+ onClick,
17430
+ height,
17431
+ isMultiDay,
17432
+ multiDayWidth,
17433
+ isFirstDay = true,
17434
+ isLastDay = true,
17435
+ "aria-hidden": ariaHidden
17436
+ }) {
17437
+ const { activeId } = useCalendarDndAgenda();
17438
+ const elementRef = (0, import_react86.useRef)(null);
17439
+ const [dragHandlePosition, setDragHandlePosition] = (0, import_react86.useState)(null);
17440
+ const eventStart = new Date(event.start ?? Date.now());
17441
+ const eventEnd = new Date(event.end ?? Date.now());
17442
+ const isMultiDayEvent2 = isMultiDay || event.allDay || (0, import_date_fns25.differenceInDays)(eventEnd, eventStart) >= 1;
17443
+ const { attributes, listeners, setNodeRef, transform, isDragging } = (0, import_core6.useDraggable)({
17444
+ data: {
17445
+ dragHandlePosition,
17446
+ event,
17447
+ height: height || elementRef.current?.offsetHeight || null,
17448
+ isFirstDay,
17449
+ isLastDay,
17450
+ isMultiDay: isMultiDayEvent2,
17451
+ multiDayWidth,
17452
+ view
17453
+ },
17454
+ id: `${event.id}-${view}`
17455
+ });
17456
+ const handleMouseDown = (e) => {
17457
+ if (elementRef.current) {
17458
+ const rect = elementRef.current.getBoundingClientRect();
17459
+ setDragHandlePosition({
17460
+ x: e.clientX - rect.left,
17461
+ y: e.clientY - rect.top
17462
+ });
17463
+ }
17464
+ };
17465
+ if (isDragging || activeId === `${event.id}-${view}`) {
17466
+ return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
17467
+ "div",
17468
+ {
17469
+ className: "opacity-0",
17470
+ ref: setNodeRef,
17471
+ style: { height: height || "auto" }
17472
+ }
17473
+ );
17474
+ }
17475
+ const style = transform ? {
17476
+ height: height || "auto",
17477
+ transform: import_utilities2.CSS.Translate.toString(transform),
17478
+ width: isMultiDayEvent2 && multiDayWidth ? `${multiDayWidth}%` : void 0
17479
+ } : {
17480
+ height: height || "auto",
17481
+ width: isMultiDayEvent2 && multiDayWidth ? `${multiDayWidth}%` : void 0
17482
+ };
17483
+ const handleTouchStart = (e) => {
17484
+ if (elementRef.current) {
17485
+ const rect = elementRef.current.getBoundingClientRect();
17486
+ const touch = e.touches[0];
17487
+ if (touch) {
17488
+ setDragHandlePosition({
17489
+ x: touch.clientX - rect.left,
17490
+ y: touch.clientY - rect.top
17491
+ });
17492
+ }
17493
+ }
17494
+ };
17495
+ return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
17496
+ "div",
17497
+ {
17498
+ className: "touch-none",
17499
+ ref: (node) => {
17500
+ setNodeRef(node);
17501
+ if (elementRef) elementRef.current = node;
17502
+ },
17503
+ style,
17504
+ children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
17505
+ EventItemAgenda,
17506
+ {
17507
+ "aria-hidden": ariaHidden,
17508
+ dndAttributes: attributes,
17509
+ dndListeners: listeners,
17510
+ event,
17511
+ isDragging,
17512
+ isFirstDay,
17513
+ isLastDay,
17514
+ onClick,
17515
+ onMouseDown: handleMouseDown,
17516
+ onTouchStart: handleTouchStart,
17517
+ showTime,
17518
+ view
17519
+ }
17520
+ )
17521
+ }
17522
+ );
17523
+ }
17524
+
17525
+ // src/components/event-calendar-view/WeekView.tsx
17526
+ var import_jsx_runtime95 = require("react/jsx-runtime");
17527
+ function WeekViewAgenda({
17528
+ currentDate,
17529
+ events,
17530
+ onEventSelect,
17531
+ onEventCreate
17532
+ }) {
17533
+ const days = (0, import_react87.useMemo)(() => {
17534
+ const weekStart2 = (0, import_date_fns26.startOfWeek)(currentDate, { weekStartsOn: 0 });
17535
+ const weekEnd = (0, import_date_fns26.endOfWeek)(currentDate, { weekStartsOn: 0 });
17536
+ return (0, import_date_fns26.eachDayOfInterval)({ end: weekEnd, start: weekStart2 });
17537
+ }, [currentDate]);
17538
+ const weekStart = (0, import_react87.useMemo)(
17539
+ () => (0, import_date_fns26.startOfWeek)(currentDate, { weekStartsOn: 0 }),
17540
+ [currentDate]
17541
+ );
17542
+ const hours = (0, import_react87.useMemo)(() => {
17543
+ const dayStart = (0, import_date_fns26.startOfDay)(currentDate);
17544
+ return (0, import_date_fns26.eachHourOfInterval)({
17545
+ end: (0, import_date_fns26.addHours)(dayStart, EndHour - 1),
17546
+ start: (0, import_date_fns26.addHours)(dayStart, StartHour)
17547
+ });
17548
+ }, [currentDate]);
17549
+ const allDayEvents = (0, import_react87.useMemo)(() => {
17550
+ return events.filter((event) => {
17551
+ return event.allDay || isMultiDayEventAgenda(event);
17552
+ }).filter((event) => {
17553
+ const eventStart = event.start ? new Date(event.start) : void 0;
17554
+ const eventEnd = event.end ? new Date(event.end) : void 0;
17555
+ return days.some((day) => {
17556
+ if (eventStart && (0, import_date_fns26.isSameDay)(day, eventStart)) return true;
17557
+ if (eventEnd && (0, import_date_fns26.isSameDay)(day, eventEnd)) return true;
17558
+ if (eventStart && eventEnd && day > eventStart && day < eventEnd) return true;
17559
+ return false;
17560
+ });
17561
+ });
17562
+ }, [events, days]);
17563
+ const processedDayEvents = (0, import_react87.useMemo)(() => {
17564
+ const result = days.map((day) => {
17565
+ const dayEventsWithIntervals = events.filter((event) => !event.allDay && !isMultiDayEventAgenda(event)).map((event) => {
17566
+ let eventStart = event.start != null ? new Date(event.start) : void 0;
17567
+ let eventEnd = event.end != null ? new Date(event.end) : void 0;
17568
+ if ((!eventStart || !eventEnd) && event.attend_date) {
17569
+ try {
17570
+ const ad = new Date(event.attend_date);
17571
+ const hasTime = ad.getHours() !== 0 || ad.getMinutes() !== 0 || ad.getSeconds() !== 0 || ad.getMilliseconds() !== 0;
17572
+ if (hasTime) {
17573
+ if (!eventStart) eventStart = ad;
17574
+ if (!eventEnd) eventEnd = (0, import_date_fns26.addHours)(ad, 1);
17575
+ }
17576
+ } catch {
17577
+ }
17578
+ }
17579
+ return { event, eventStart, eventEnd };
17580
+ }).filter(({ eventStart, eventEnd }) => !!eventStart && !!eventEnd).filter(({ eventStart, eventEnd }) => {
17581
+ const dayStart2 = (0, import_date_fns26.startOfDay)(day);
17582
+ const dayEnd = (0, import_date_fns27.endOfDay)(day);
17583
+ return (0, import_date_fns26.areIntervalsOverlapping)(
17584
+ { start: eventStart, end: eventEnd },
17585
+ { start: dayStart2, end: dayEnd }
17586
+ );
17587
+ });
17588
+ const sortedEvents = [...dayEventsWithIntervals].sort((a, b) => {
17589
+ const aStart = a.eventStart.getTime();
17590
+ const bStart = b.eventStart.getTime();
17591
+ if (aStart < bStart) return -1;
17592
+ if (aStart > bStart) return 1;
17593
+ const aDuration = (0, import_date_fns26.differenceInMinutes)(
17594
+ a.eventEnd,
17595
+ a.eventStart
17596
+ );
17597
+ const bDuration = (0, import_date_fns26.differenceInMinutes)(
17598
+ b.eventEnd,
17599
+ b.eventStart
17600
+ );
17601
+ return bDuration - aDuration;
17602
+ });
17603
+ const positionedEvents = [];
17604
+ const dayStart = (0, import_date_fns26.startOfDay)(day);
17605
+ const columns = [];
17606
+ for (const item of sortedEvents) {
17607
+ const event = item.event;
17608
+ const eventStart = item.eventStart;
17609
+ const eventEnd = item.eventEnd;
17610
+ const adjustedStart = (0, import_date_fns26.isSameDay)(day, eventStart) ? eventStart : dayStart;
17611
+ const adjustedEnd = (0, import_date_fns26.isSameDay)(day, eventEnd) ? eventEnd : (0, import_date_fns26.addHours)(dayStart, 24);
17612
+ const startHour = (0, import_date_fns26.getHours)(adjustedStart) + (0, import_date_fns26.getMinutes)(adjustedStart) / 60;
17613
+ const endHour = (0, import_date_fns26.getHours)(adjustedEnd) + (0, import_date_fns26.getMinutes)(adjustedEnd) / 60;
17614
+ const top = (startHour - StartHour) * WeekCellsHeightAgenda;
17615
+ const height = (endHour - startHour) * WeekCellsHeightAgenda;
17616
+ let columnIndex = 0;
17617
+ let placed = false;
17618
+ while (!placed) {
17619
+ const col = columns[columnIndex] || [];
17620
+ if (col.length === 0) {
17621
+ columns[columnIndex] = col;
17622
+ placed = true;
17623
+ } else {
17624
+ const overlaps = col.some(
17625
+ (c) => (0, import_date_fns26.areIntervalsOverlapping)(
17626
+ { end: adjustedEnd, start: adjustedStart },
17627
+ { end: c.end, start: c.start }
17628
+ )
17629
+ );
17630
+ if (!overlaps) {
17631
+ placed = true;
17632
+ } else {
17633
+ columnIndex++;
17634
+ }
17635
+ }
17636
+ }
17637
+ const currentColumn = columns[columnIndex] || [];
17638
+ columns[columnIndex] = currentColumn;
17639
+ currentColumn.push({ start: adjustedStart, end: adjustedEnd, event });
17640
+ const width = columnIndex === 0 ? 1 : 0.7;
17641
+ const left = columnIndex === 0 ? 0 : columnIndex * 0.3;
17642
+ positionedEvents.push({
17643
+ event,
17644
+ height,
17645
+ left,
17646
+ top,
17647
+ width,
17648
+ zIndex: 10 + columnIndex
17649
+ });
17650
+ }
17651
+ return positionedEvents;
17652
+ });
17653
+ return result;
17654
+ }, [days, events]);
17655
+ const handleEventClick = (event, e) => {
17656
+ e.stopPropagation();
17657
+ onEventSelect(event);
17658
+ };
17659
+ const showAllDaySection = allDayEvents.length > 0;
17660
+ const { currentTimePosition, currentTimeVisible } = useCurrentTimeIndicatorAgenda(
17661
+ currentDate,
17662
+ "week"
17663
+ );
17664
+ return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "flex h-full flex-col", "data-slot": "week-view", children: [
17665
+ /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "sticky top-0 z-30 grid grid-cols-8 border-border/70 border-b bg-background", children: [
17666
+ /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "py-2 text-center text-muted-foreground/70 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "max-[479px]:sr-only", children: (0, import_date_fns26.format)(/* @__PURE__ */ new Date(), "O") }) }),
17667
+ days.map((day) => /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
17668
+ "div",
17669
+ {
17670
+ className: "py-2 text-center text-muted-foreground/70 text-sm data-today:font-medium data-today:text-foreground",
17671
+ "data-today": (0, import_date_fns26.isToday)(day) || void 0,
17672
+ children: [
17673
+ /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("span", { "aria-hidden": "true", className: "sm:hidden", children: [
17674
+ (0, import_date_fns26.format)(day, "EEE", { locale: import_locale13.ptBR })[0],
17675
+ " ",
17676
+ (0, import_date_fns26.format)(day, "d", { locale: import_locale13.ptBR })
17677
+ ] }),
17678
+ /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "max-sm:hidden", children: (0, import_date_fns26.format)(day, "EEE dd", { locale: import_locale13.ptBR }) })
17679
+ ]
17680
+ },
17681
+ day.toString()
17682
+ ))
17683
+ ] }),
17684
+ showAllDaySection && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "border-border/70 border-b bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "grid grid-cols-8", children: [
17685
+ /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "relative border-border/70 border-r", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "absolute bottom-0 left-0 h-6 w-16 max-w-full pe-2 text-right text-[10px] text-muted-foreground/70 sm:pe-4 sm:text-xs", children: "All day" }) }),
17686
+ days.map((day, dayIndex) => {
17687
+ const dayAllDayEvents = allDayEvents.filter((event) => {
17688
+ const eventStart = event.start ? new Date(event.start) : void 0;
17689
+ const eventEnd = event.end ? new Date(event.end) : void 0;
17690
+ if (!eventStart && !eventEnd) return false;
17691
+ return eventStart && (0, import_date_fns26.isSameDay)(day, eventStart) || eventStart && eventEnd && day > eventStart && day < eventEnd || eventEnd && (0, import_date_fns26.isSameDay)(day, eventEnd);
17692
+ });
17693
+ return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
17694
+ "div",
17695
+ {
17696
+ className: "relative border-border/70 border-r p-1 last:border-r-0",
17697
+ "data-today": (0, import_date_fns26.isToday)(day) || void 0,
17698
+ children: dayAllDayEvents.map((event) => {
17699
+ const eventStart = event.start ? new Date(event.start) : void 0;
17700
+ const eventEnd = event.end ? new Date(event.end) : void 0;
17701
+ const isFirstDay = eventStart ? (0, import_date_fns26.isSameDay)(day, eventStart) : false;
17702
+ const isLastDay = eventEnd ? (0, import_date_fns26.isSameDay)(day, eventEnd) : false;
17703
+ const isFirstVisibleDay = eventStart ? dayIndex === 0 && (0, import_date_fns26.isBefore)(eventStart, weekStart) : false;
17704
+ const shouldShowTitle = isFirstDay || isFirstVisibleDay;
17705
+ return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
17706
+ EventItemAgenda,
17707
+ {
17708
+ event,
17709
+ isFirstDay,
17710
+ isLastDay,
17711
+ onClick: (e) => handleEventClick(event, e),
17712
+ view: "month",
17713
+ children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
17714
+ "div",
17715
+ {
17716
+ "aria-hidden": !shouldShowTitle,
17717
+ className: cn(
17718
+ "truncate",
17719
+ !shouldShowTitle && "invisible"
17720
+ ),
17721
+ children: event.title
17722
+ }
17723
+ )
17724
+ },
17725
+ `spanning-${event.id}`
17726
+ );
17727
+ })
17728
+ },
17729
+ day.toString()
17730
+ );
17731
+ })
17732
+ ] }) }),
17733
+ /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "grid flex-1 grid-cols-8 overflow-hidden", children: [
17734
+ /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "grid auto-cols-fr border-border/70 border-r", children: hours.map((hour, index) => /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
17735
+ "div",
17736
+ {
17737
+ className: "relative min-h-[var(--week-cells-height)] border-border/70 border-b last:border-b-0",
17738
+ children: index > 0 && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "-top-3 absolute left-0 flex h-6 w-16 max-w-full items-center justify-end bg-background pe-2 text-[10px] text-muted-foreground/70 sm:pe-4 sm:text-xs", children: (0, import_date_fns26.format)(hour, "HH:mm") })
17739
+ },
17740
+ hour.toString()
17741
+ )) }),
17742
+ days.map((day, dayIndex) => /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
17743
+ "div",
17744
+ {
17745
+ className: "relative grid auto-cols-fr border-border/70 border-r last:border-r-0",
17746
+ "data-today": (0, import_date_fns26.isToday)(day) || void 0,
17747
+ children: [
17748
+ (processedDayEvents[dayIndex] ?? []).map((positionedEvent) => /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
17749
+ "div",
17750
+ {
17751
+ className: "absolute z-10 px-0.5",
17752
+ onClick: (e) => e.stopPropagation(),
17753
+ style: {
17754
+ height: `${positionedEvent.height}px`,
17755
+ left: `${positionedEvent.left * 100}%`,
17756
+ top: `${positionedEvent.top}px`,
17757
+ width: `${positionedEvent.width * 100}%`,
17758
+ zIndex: positionedEvent.zIndex
17759
+ },
17760
+ children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "size-full", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
17761
+ DraggableEvent2,
17762
+ {
17763
+ event: positionedEvent.event,
17764
+ height: positionedEvent.height,
17765
+ onClick: (e) => handleEventClick(positionedEvent.event, e),
17766
+ showTime: true,
17767
+ view: "week"
17768
+ }
17769
+ ) })
17770
+ },
17771
+ positionedEvent.event.id
17772
+ )),
17773
+ currentTimeVisible && (0, import_date_fns26.isToday)(day) && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
17774
+ "div",
17775
+ {
17776
+ className: "pointer-events-none absolute right-0 left-0 z-20",
17777
+ style: { top: `${currentTimePosition}%` },
17778
+ children: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "relative flex items-center", children: [
17779
+ /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "-left-1 absolute h-2 w-2 rounded-full bg-primary" }),
17780
+ /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "h-[2px] w-full bg-primary" })
17781
+ ] })
17782
+ }
17783
+ ),
17784
+ hours.map((hour) => {
17785
+ const hourValue = (0, import_date_fns26.getHours)(hour);
17786
+ return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
17787
+ "div",
17788
+ {
17789
+ className: "relative min-h-[var(--week-cells-height)] border-border/70 border-b last:border-b-0",
17790
+ children: [0, 1, 2, 3].map((quarter) => {
17791
+ const quarterHourTime = hourValue + quarter * 0.25;
17792
+ return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
17793
+ DroppableCellAgenda,
17794
+ {
17795
+ className: cn(
17796
+ "absolute h-[calc(var(--week-cells-height)/4)] w-full",
17797
+ quarter === 0 && "top-0",
17798
+ quarter === 1 && "top-[calc(var(--week-cells-height)/4)]",
17799
+ quarter === 2 && "top-[calc(var(--week-cells-height)/4*2)]",
17800
+ quarter === 3 && "top-[calc(var(--week-cells-height)/4*)]"
17801
+ ),
17802
+ date: day,
17803
+ id: `week-cell-${day.toISOString()}-${quarterHourTime}`,
17804
+ onClick: () => {
17805
+ const startTime = new Date(day);
17806
+ startTime.setHours(hourValue);
17807
+ startTime.setMinutes(quarter * 15);
17808
+ if (onEventCreate) onEventCreate(startTime);
17809
+ },
17810
+ time: quarterHourTime
17811
+ },
17812
+ `${hour.toString()}-${quarter}`
17813
+ );
17814
+ })
17815
+ },
17816
+ hour.toString()
17817
+ );
17818
+ })
17819
+ ]
17820
+ },
17821
+ day.toString()
17822
+ ))
17823
+ ] })
17824
+ ] });
17825
+ }
17826
+
17827
+ // src/components/ui/data/Banner.tsx
17828
+ var import_react88 = require("@phosphor-icons/react");
17829
+ var import_react89 = __toESM(require("react"));
17830
+ var import_jsx_runtime96 = require("react/jsx-runtime");
17831
+
17832
+ // src/hooks/use-drag.tsx
17833
+ var import_react90 = require("react");
17834
+ var useDrag = (options = {}) => {
17835
+ const [isDragging, setIsDragging] = (0, import_react90.useState)(null);
17836
+ const [positions, setPositions] = (0, import_react90.useState)({});
17837
+ const dragStartPos = (0, import_react90.useRef)(null);
17838
+ const dragId = (0, import_react90.useRef)(null);
17839
+ const handleMouseDown = (0, import_react90.useCallback)((id, e) => {
17840
+ e.preventDefault();
17841
+ const currentPosition = positions[id] || { top: 0, left: 0 };
17842
+ dragStartPos.current = {
17843
+ x: e.clientX,
17844
+ y: e.clientY,
17845
+ elementX: currentPosition.left,
17846
+ elementY: currentPosition.top
17847
+ };
17848
+ dragId.current = id;
17849
+ setIsDragging(id);
17850
+ options.onDragStart?.(id);
17851
+ }, [positions, options]);
17852
+ const handleMouseMove = (0, import_react90.useCallback)((e) => {
17853
+ if (!isDragging || !dragStartPos.current || !dragId.current) return;
17854
+ const deltaX = e.clientX - dragStartPos.current.x;
17855
+ const deltaY = e.clientY - dragStartPos.current.y;
17856
+ const newPosition = {
17857
+ left: dragStartPos.current.elementX + deltaX,
17858
+ top: dragStartPos.current.elementY + deltaY
17859
+ };
17860
+ newPosition.left = Math.max(0, Math.min(window.innerWidth - 300, newPosition.left));
17861
+ newPosition.top = Math.max(0, Math.min(window.innerHeight - 200, newPosition.top));
17862
+ setPositions((prev) => ({
17863
+ ...prev,
17864
+ [dragId.current]: newPosition
17865
+ }));
17866
+ options.onDrag?.(dragId.current, newPosition);
17867
+ }, [isDragging, options]);
17868
+ const handleMouseUp = (0, import_react90.useCallback)(() => {
17869
+ if (dragId.current) {
17870
+ options.onDragEnd?.(dragId.current);
17871
+ }
17872
+ setIsDragging(null);
17873
+ dragStartPos.current = null;
17874
+ dragId.current = null;
17875
+ }, [options]);
17876
+ (0, import_react90.useEffect)(() => {
15616
17877
  if (isDragging) {
15617
17878
  document.addEventListener("mousemove", handleMouseMove);
15618
17879
  document.addEventListener("mouseup", handleMouseUp);
@@ -15624,16 +17885,16 @@ var useDrag = (options = {}) => {
15624
17885
  };
15625
17886
  }
15626
17887
  }, [isDragging, handleMouseMove, handleMouseUp]);
15627
- const setPosition = (0, import_react72.useCallback)((id, position) => {
17888
+ const setPosition = (0, import_react90.useCallback)((id, position) => {
15628
17889
  setPositions((prev) => ({
15629
17890
  ...prev,
15630
17891
  [id]: position
15631
17892
  }));
15632
17893
  }, []);
15633
- const getPosition = (0, import_react72.useCallback)((id) => {
17894
+ const getPosition = (0, import_react90.useCallback)((id) => {
15634
17895
  return positions[id] || { top: 0, left: 0 };
15635
17896
  }, [positions]);
15636
- const isElementDragging = (0, import_react72.useCallback)((id) => {
17897
+ const isElementDragging = (0, import_react90.useCallback)((id) => {
15637
17898
  return isDragging === id;
15638
17899
  }, [isDragging]);
15639
17900
  return {