@reservi/preact 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,58 +1,58 @@
1
- import { render as at, h as bt } from "preact";
2
- import { getLocaleText as R, dl as s, timeStringToMinutes as K, computeDrop as J, pxToSnappedMinutes as wt, computeResize as kt, THEME_TOKEN_VARS as Dt, themeToStyle as pt, CalendarApi as Mt, eventsToICS as St } from "@reservi/core";
3
- import { dayGridPlugin as ge, definePlugin as ye, defineTheme as fe, eventsToICS as be, listPlugin as we, multiMonthPlugin as ke, parseICS as De, resourcePlugin as pe, themeToStyle as Me, timeGridPlugin as Se, timelinePlugin as Ce } from "@reservi/core";
4
- import { jsx as d, jsxs as g, Fragment as Ct } from "preact/jsx-runtime";
1
+ import { render as At, h as Ce } from "preact";
2
+ import { getLocaleText as V, dl as m, timeStringToMinutes as X, computeDrop as ht, pxToSnappedMinutes as It, computeResize as $t, THEME_TOKEN_VARS as xe, themeToStyle as Pe, CalendarApi as Ae, eventsToICS as Ie } from "@reservi/core";
3
+ import { dayGridPlugin as Sn, definePlugin as On, defineTheme as Tn, eventsToICS as En, listPlugin as Mn, multiMonthPlugin as kn, parseICS as Cn, resourcePlugin as xn, themeToStyle as Pn, timeGridPlugin as An, timelinePlugin as In } from "@reservi/core";
4
+ import { jsx as u, jsxs as k, Fragment as $e } from "preact/jsx-runtime";
5
5
  import "@preact/signals";
6
- import { useRef as $, useLayoutEffect as ot, useState as N, useEffect as H } from "preact/hooks";
7
- function ce(r) {
8
- return { __rsvHost: !0, node: r };
9
- }
10
- function Et(r) {
11
- return typeof r == "object" && r !== null && r.__rsvHost === !0;
12
- }
13
- function L(r, t, e, n) {
14
- if (!r) return e;
15
- const o = r(t);
16
- return o === void 0 ? e : Et(o) ? n ? /* @__PURE__ */ d(xt, { bridge: n, node: o.node }) : e : o;
17
- }
18
- let Tt = 0;
19
- function xt({ bridge: r, node: t }) {
20
- const e = $("");
21
- e.current || (e.current = `rsv-host-${++Tt}`);
22
- const n = $(null), o = $(t);
23
- o.current = t;
24
- const a = $(!1);
25
- return ot(() => {
26
- const h = n.current;
27
- if (!h) return;
28
- const u = e.current;
29
- return a.current = !0, r.mount(u, h, o.current), () => {
30
- a.current = !1, r.unmount(u);
6
+ import { useRef as F, useLayoutEffect as jt, useState as K, useEffect as R } from "preact/hooks";
7
+ function pn(t) {
8
+ return { __rsvHost: !0, node: t };
9
+ }
10
+ function je(t) {
11
+ return typeof t == "object" && t !== null && t.__rsvHost === !0;
12
+ }
13
+ function L(t, e, r, n) {
14
+ if (!t) return r;
15
+ const a = t(e);
16
+ return a === void 0 ? r : je(a) ? n ? /* @__PURE__ */ u(Re, { bridge: n, node: a.node }) : r : a;
17
+ }
18
+ let Fe = 0;
19
+ function Re({ bridge: t, node: e }) {
20
+ const r = F("");
21
+ r.current || (r.current = `rsv-host-${++Fe}`);
22
+ const n = F(null), a = F(e);
23
+ a.current = e;
24
+ const o = F(!1);
25
+ return jt(() => {
26
+ const s = n.current;
27
+ if (!s) return;
28
+ const i = r.current;
29
+ return o.current = !0, t.mount(i, s, a.current), () => {
30
+ o.current = !1, t.unmount(i);
31
31
  };
32
- }, []), ot(() => {
33
- a.current && r.update(e.current, t);
34
- }), /* @__PURE__ */ d("div", { "data-rsv": "host", ref: n });
35
- }
36
- function F(...r) {
37
- return r.filter(Boolean).join(" ");
38
- }
39
- const dt = /* @__PURE__ */ new WeakSet();
40
- function A(r, t, e) {
41
- if (!r || !t) return;
42
- const n = r;
43
- dt.has(n) || (dt.add(n), t(Object.assign(e(), { el: n })));
44
- }
45
- function $t(r, t) {
46
- if (!r.length) return null;
47
- const e = [...r].sort((o, a) => o.breakpoint - a.breakpoint);
48
- let n = e[0].view;
49
- for (const o of e)
50
- t >= o.breakpoint && (n = o.view);
32
+ }, []), jt(() => {
33
+ o.current && t.update(r.current, e);
34
+ }), /* @__PURE__ */ u("div", { "data-rsv": "host", ref: n });
35
+ }
36
+ function N(...t) {
37
+ return t.filter(Boolean).join(" ");
38
+ }
39
+ const Ft = /* @__PURE__ */ new WeakSet();
40
+ function W(t, e, r) {
41
+ if (!t || !e) return;
42
+ const n = t;
43
+ Ft.has(n) || (Ft.add(n), e(Object.assign(r(), { el: n })));
44
+ }
45
+ function He(t, e) {
46
+ if (!t.length) return null;
47
+ const r = [...t].sort((a, o) => a.breakpoint - o.breakpoint);
48
+ let n = r[0].view;
49
+ for (const a of r)
50
+ e >= a.breakpoint && (n = a.view);
51
51
  return n;
52
52
  }
53
- const G = { prev: "‹", next: "›" }, Pt = /* @__PURE__ */ new Set(["", "title", "today", "prev", "next"]), Ot = /month|year/i, B = (r) => String(r).padStart(2, "0");
54
- function Lt() {
55
- return /* @__PURE__ */ g(
53
+ const rt = { prev: "‹", next: "›" }, Le = /* @__PURE__ */ new Set(["", "title", "today", "prev", "next"]), Ne = /month|year/i, nt = (t) => String(t).padStart(2, "0");
54
+ function Be() {
55
+ return /* @__PURE__ */ k(
56
56
  "svg",
57
57
  {
58
58
  "data-rsv": "title-icon",
@@ -66,158 +66,158 @@ function Lt() {
66
66
  "stroke-linejoin": "round",
67
67
  "aria-hidden": "true",
68
68
  children: [
69
- /* @__PURE__ */ d("rect", { x: "1", y: "2.5", width: "12", height: "10.5", rx: "1.5" }),
70
- /* @__PURE__ */ d("line", { x1: "1", y1: "5.5", x2: "13", y2: "5.5" }),
71
- /* @__PURE__ */ d("line", { x1: "4.5", y1: "1", x2: "4.5", y2: "3.5" }),
72
- /* @__PURE__ */ d("line", { x1: "9.5", y1: "1", x2: "9.5", y2: "3.5" })
69
+ /* @__PURE__ */ u("rect", { x: "1", y: "2.5", width: "12", height: "10.5", rx: "1.5" }),
70
+ /* @__PURE__ */ u("line", { x1: "1", y1: "5.5", x2: "13", y2: "5.5" }),
71
+ /* @__PURE__ */ u("line", { x1: "4.5", y1: "1", x2: "4.5", y2: "3.5" }),
72
+ /* @__PURE__ */ u("line", { x1: "9.5", y1: "1", x2: "9.5", y2: "3.5" })
73
73
  ]
74
74
  }
75
75
  );
76
76
  }
77
- function Ft(r) {
78
- var e;
79
- if ((e = r.views) != null && e.length) return r.views;
80
- const t = r.headerToolbar;
81
- return t ? [t.start, t.center, t.end].filter((n) => !!n).flatMap((n) => n.split(/\s+/)).flatMap((n) => n.split(",")).filter((n) => !Pt.has(n)) : [];
77
+ function Ke(t) {
78
+ var r;
79
+ if ((r = t.views) != null && r.length) return t.views;
80
+ const e = t.headerToolbar;
81
+ return e ? [e.start, e.center, e.end].filter((n) => !!n).flatMap((n) => n.split(/\s+/)).flatMap((n) => n.split(",")).filter((n) => !Le.has(n)) : [];
82
82
  }
83
- function Rt({ api: r, title: t, activeView: e, options: n }) {
84
- var V, Z, Y, tt, et;
85
- const o = R(n.locale), a = (Z = (V = n.slots) == null ? void 0 : V.toolbarStart) == null ? void 0 : Z.call(V), h = (tt = (Y = n.slots) == null ? void 0 : Y.toolbarEnd) == null ? void 0 : tt.call(Y), u = Ft(n), v = Ot.test(e), c = n.firstDay ?? o.firstDay, l = $(null), [f, b] = N(!1), k = s.toDate(r.getDate()), w = s.toDate(n.now ? s.from(n.now) : s.now()), [p, m] = N(k.getFullYear()), [S, i] = N(k.getMonth()), D = new Intl.DateTimeFormat(n.locale, { month: "short" }), C = new Intl.DateTimeFormat(n.locale, { month: "long" }), M = new Intl.DateTimeFormat(n.locale, { weekday: "short" }), E = Array.from(
83
+ function Ve({ api: t, title: e, activeView: r, options: n }) {
84
+ var I, $, j, U, _;
85
+ const a = V(n.locale), o = ($ = (I = n.slots) == null ? void 0 : I.toolbarStart) == null ? void 0 : $.call(I), s = (U = (j = n.slots) == null ? void 0 : j.toolbarEnd) == null ? void 0 : U.call(j), i = Ke(n), d = Ne.test(r), l = n.firstDay ?? a.firstDay, c = F(null), [p, D] = K(!1), v = m.toDate(t.getDate()), g = m.toDate(n.now ? m.from(n.now) : m.now()), [h, b] = K(v.getFullYear()), [w, S] = K(v.getMonth()), M = new Intl.DateTimeFormat(n.locale, { month: "short" }), x = new Intl.DateTimeFormat(n.locale, { month: "long" }), y = new Intl.DateTimeFormat(n.locale, { weekday: "short" }), f = Array.from(
86
86
  { length: 12 },
87
- (y, T) => D.format(new Date(2020, T, 1))
88
- ), x = () => {
89
- const y = s.toDate(r.getDate());
90
- m(y.getFullYear()), i(y.getMonth()), b(!0);
91
- }, I = (y) => {
92
- const T = p * 12 + S + y;
93
- m(Math.floor(T / 12)), i((T % 12 + 12) % 12);
94
- }, P = (y) => {
95
- r.gotoDate(y), b(!1);
87
+ (O, A) => M.format(new Date(2020, A, 1))
88
+ ), T = () => {
89
+ const O = m.toDate(t.getDate());
90
+ b(O.getFullYear()), S(O.getMonth()), D(!0);
91
+ }, C = (O) => {
92
+ const A = h * 12 + w + O;
93
+ b(Math.floor(A / 12)), S((A % 12 + 12) % 12);
94
+ }, E = (O) => {
95
+ t.gotoDate(O), D(!1);
96
96
  };
97
- H(() => {
98
- const y = (O) => {
99
- (O.ctrlKey || O.metaKey) && (O.key === "m" || O.key === "M") ? (O.preventDefault(), x()) : O.key === "Escape" && b(!1);
100
- }, T = (O) => {
101
- l.current && !l.current.contains(O.target) && b(!1);
97
+ R(() => {
98
+ const O = (H) => {
99
+ (H.ctrlKey || H.metaKey) && (H.key === "m" || H.key === "M") ? (H.preventDefault(), T()) : H.key === "Escape" && D(!1);
100
+ }, A = (H) => {
101
+ c.current && !c.current.contains(H.target) && D(!1);
102
102
  };
103
- return document.addEventListener("keydown", y), document.addEventListener("mousedown", T), () => {
104
- document.removeEventListener("keydown", y), document.removeEventListener("mousedown", T);
103
+ return document.addEventListener("keydown", O), document.addEventListener("mousedown", A), () => {
104
+ document.removeEventListener("keydown", O), document.removeEventListener("mousedown", A);
105
105
  };
106
106
  }, []);
107
- const Q = (() => {
108
- if (v) return { cells: [], dows: [] };
109
- const y = s.from(`${p}-${B(S + 1)}-01`), T = (s.dayOfWeek(y) - c + 7) % 7, O = s.subtract(y, { days: T }), rt = Array.from({ length: 42 }, (nt, ft) => s.toDate(s.add(O, { days: ft }))), yt = rt.slice(0, 7).map((nt) => M.format(nt));
110
- return { cells: rt, dows: yt };
107
+ const P = (() => {
108
+ if (d) return { cells: [], dows: [] };
109
+ const O = m.from(`${h}-${nt(w + 1)}-01`), A = (m.dayOfWeek(O) - l + 7) % 7, H = m.subtract(O, { days: A }), xt = Array.from({ length: 42 }, (Pt, ke) => m.toDate(m.add(H, { days: ke }))), Me = xt.slice(0, 7).map((Pt) => y.format(Pt));
110
+ return { cells: xt, dows: Me };
111
111
  })();
112
- return /* @__PURE__ */ g("div", { "data-rsv": "toolbar-wrap", class: F((et = n.classNames) == null ? void 0 : et.toolbar), ref: l, children: [
113
- /* @__PURE__ */ g("div", { "data-rsv": "toolbar", children: [
114
- /* @__PURE__ */ d("div", { "data-rsv": "toolbar-section", "data-rsv-area": "start", children: a }),
115
- /* @__PURE__ */ g("div", { "data-rsv": "toolbar-section", "data-rsv-area": "nav", children: [
116
- /* @__PURE__ */ d(
112
+ return /* @__PURE__ */ k("div", { "data-rsv": "toolbar-wrap", class: N((_ = n.classNames) == null ? void 0 : _.toolbar), ref: c, children: [
113
+ /* @__PURE__ */ k("div", { "data-rsv": "toolbar", children: [
114
+ /* @__PURE__ */ u("div", { "data-rsv": "toolbar-section", "data-rsv-area": "start", children: o }),
115
+ /* @__PURE__ */ k("div", { "data-rsv": "toolbar-section", "data-rsv-area": "nav", children: [
116
+ /* @__PURE__ */ u(
117
117
  "button",
118
118
  {
119
119
  type: "button",
120
120
  "data-rsv": "button",
121
- title: o.todayHint,
122
- "aria-label": o.todayHint,
123
- onClick: () => r.today(),
124
- children: o.today
121
+ title: a.todayHint,
122
+ "aria-label": a.todayHint,
123
+ onClick: () => t.today(),
124
+ children: a.today
125
125
  }
126
126
  ),
127
- /* @__PURE__ */ d(
127
+ /* @__PURE__ */ u(
128
128
  "button",
129
129
  {
130
130
  type: "button",
131
131
  "data-rsv": "button",
132
132
  "data-rsv-nav": "prev",
133
- title: o.prevHint,
134
- "aria-label": o.prevHint,
135
- onClick: () => r.prev(),
136
- children: G.prev
133
+ title: a.prevHint,
134
+ "aria-label": a.prevHint,
135
+ onClick: () => t.prev(),
136
+ children: rt.prev
137
137
  }
138
138
  ),
139
- /* @__PURE__ */ g("div", { "data-rsv": "datepicker-anchor", children: [
140
- /* @__PURE__ */ g(
139
+ /* @__PURE__ */ k("div", { "data-rsv": "datepicker-anchor", children: [
140
+ /* @__PURE__ */ k(
141
141
  "button",
142
142
  {
143
143
  type: "button",
144
144
  "data-rsv": "title",
145
145
  "aria-haspopup": "dialog",
146
- "aria-expanded": f,
147
- title: `${t} · Ctrl+M`,
148
- onClick: () => f ? b(!1) : x(),
146
+ "aria-expanded": p,
147
+ title: `${e} · Ctrl+M`,
148
+ onClick: () => p ? D(!1) : T(),
149
149
  children: [
150
- /* @__PURE__ */ d(Lt, {}),
151
- t
150
+ /* @__PURE__ */ u(Be, {}),
151
+ e
152
152
  ]
153
153
  }
154
154
  ),
155
- f && /* @__PURE__ */ g(
155
+ p && /* @__PURE__ */ k(
156
156
  "div",
157
157
  {
158
158
  "data-rsv": "datepicker",
159
- "data-rsv-mode": v ? "month" : "day",
159
+ "data-rsv-mode": d ? "month" : "day",
160
160
  role: "dialog",
161
- "aria-label": t,
161
+ "aria-label": e,
162
162
  children: [
163
- /* @__PURE__ */ g("div", { "data-rsv": "dp-head", children: [
164
- /* @__PURE__ */ d(
163
+ /* @__PURE__ */ k("div", { "data-rsv": "dp-head", children: [
164
+ /* @__PURE__ */ u(
165
165
  "button",
166
166
  {
167
167
  type: "button",
168
168
  "data-rsv": "dp-nav",
169
- "aria-label": o.prev,
170
- onClick: () => v ? m((y) => y - 1) : I(-1),
171
- children: G.prev
169
+ "aria-label": a.prev,
170
+ onClick: () => d ? b((O) => O - 1) : C(-1),
171
+ children: rt.prev
172
172
  }
173
173
  ),
174
- /* @__PURE__ */ d("span", { "data-rsv": "dp-label", children: v ? p : `${C.format(new Date(p, S, 1))} ${p}` }),
175
- /* @__PURE__ */ d(
174
+ /* @__PURE__ */ u("span", { "data-rsv": "dp-label", children: d ? h : `${x.format(new Date(h, w, 1))} ${h}` }),
175
+ /* @__PURE__ */ u(
176
176
  "button",
177
177
  {
178
178
  type: "button",
179
179
  "data-rsv": "dp-nav",
180
- "aria-label": o.next,
181
- onClick: () => v ? m((y) => y + 1) : I(1),
182
- children: G.next
180
+ "aria-label": a.next,
181
+ onClick: () => d ? b((O) => O + 1) : C(1),
182
+ children: rt.next
183
183
  }
184
184
  )
185
185
  ] }),
186
- v ? /* @__PURE__ */ d("div", { "data-rsv": "dp-grid", children: E.map((y, T) => /* @__PURE__ */ d(
186
+ d ? /* @__PURE__ */ u("div", { "data-rsv": "dp-grid", children: f.map((O, A) => /* @__PURE__ */ u(
187
187
  "button",
188
188
  {
189
189
  type: "button",
190
190
  "data-rsv": "dp-month",
191
191
  "data-active": String(
192
- p === k.getFullYear() && T === k.getMonth()
192
+ h === v.getFullYear() && A === v.getMonth()
193
193
  ),
194
194
  "data-today": String(
195
- p === w.getFullYear() && T === w.getMonth()
195
+ h === g.getFullYear() && A === g.getMonth()
196
196
  ),
197
- onClick: () => P(`${p}-${B(T + 1)}-01`),
198
- children: y
197
+ onClick: () => E(`${h}-${nt(A + 1)}-01`),
198
+ children: O
199
199
  },
200
- y
201
- )) }) : /* @__PURE__ */ g("div", { "data-rsv": "dp-days", children: [
202
- Q.dows.map((y, T) => /* @__PURE__ */ d("div", { "data-rsv": "dp-dow", children: y }, `dow-${T}`)),
203
- Q.cells.map((y) => {
204
- const T = `${y.getFullYear()}-${B(y.getMonth() + 1)}-${B(y.getDate())}`;
205
- return /* @__PURE__ */ d(
200
+ O
201
+ )) }) : /* @__PURE__ */ k("div", { "data-rsv": "dp-days", children: [
202
+ P.dows.map((O, A) => /* @__PURE__ */ u("div", { "data-rsv": "dp-dow", children: O }, `dow-${A}`)),
203
+ P.cells.map((O) => {
204
+ const A = `${O.getFullYear()}-${nt(O.getMonth() + 1)}-${nt(O.getDate())}`;
205
+ return /* @__PURE__ */ u(
206
206
  "button",
207
207
  {
208
208
  type: "button",
209
209
  "data-rsv": "dp-day",
210
- "data-other": String(y.getMonth() !== S),
210
+ "data-other": String(O.getMonth() !== w),
211
211
  "data-active": String(
212
- y.getFullYear() === k.getFullYear() && y.getMonth() === k.getMonth() && y.getDate() === k.getDate()
212
+ O.getFullYear() === v.getFullYear() && O.getMonth() === v.getMonth() && O.getDate() === v.getDate()
213
213
  ),
214
214
  "data-today": String(
215
- y.getFullYear() === w.getFullYear() && y.getMonth() === w.getMonth() && y.getDate() === w.getDate()
215
+ O.getFullYear() === g.getFullYear() && O.getMonth() === g.getMonth() && O.getDate() === g.getDate()
216
216
  ),
217
- onClick: () => P(T),
218
- children: y.getDate()
217
+ onClick: () => E(A),
218
+ children: O.getDate()
219
219
  },
220
- T
220
+ A
221
221
  );
222
222
  })
223
223
  ] })
@@ -225,22 +225,22 @@ function Rt({ api: r, title: t, activeView: e, options: n }) {
225
225
  }
226
226
  )
227
227
  ] }),
228
- /* @__PURE__ */ d(
228
+ /* @__PURE__ */ u(
229
229
  "button",
230
230
  {
231
231
  type: "button",
232
232
  "data-rsv": "button",
233
233
  "data-rsv-nav": "next",
234
- title: o.nextHint,
235
- "aria-label": o.nextHint,
236
- onClick: () => r.next(),
237
- children: G.next
234
+ title: a.nextHint,
235
+ "aria-label": a.nextHint,
236
+ onClick: () => t.next(),
237
+ children: rt.next
238
238
  }
239
239
  )
240
240
  ] }),
241
- /* @__PURE__ */ g("div", { "data-rsv": "toolbar-section", "data-rsv-area": "end", children: [
242
- h,
243
- n.onAddClick && /* @__PURE__ */ g(
241
+ /* @__PURE__ */ k("div", { "data-rsv": "toolbar-section", "data-rsv-area": "end", children: [
242
+ s,
243
+ n.onAddClick && /* @__PURE__ */ k(
244
244
  "button",
245
245
  {
246
246
  type: "button",
@@ -248,296 +248,1926 @@ function Rt({ api: r, title: t, activeView: e, options: n }) {
248
248
  "data-rsv-variant": "primary",
249
249
  onClick: n.onAddClick,
250
250
  children: [
251
- /* @__PURE__ */ d("span", { "data-rsv": "add-icon", "aria-hidden": "true", children: "+" }),
251
+ /* @__PURE__ */ u("span", { "data-rsv": "add-icon", "aria-hidden": "true", children: "+" }),
252
252
  n.addButtonText
253
253
  ]
254
254
  }
255
255
  )
256
256
  ] })
257
257
  ] }),
258
- u.length > 0 && /* @__PURE__ */ d("div", { "data-rsv": "toolbar-views", role: "tablist", children: u.map((y) => /* @__PURE__ */ d(
258
+ i.length > 0 && /* @__PURE__ */ u("div", { "data-rsv": "toolbar-views", role: "tablist", children: i.map((O) => /* @__PURE__ */ u(
259
259
  "button",
260
260
  {
261
261
  type: "button",
262
262
  "data-rsv": "view-tab",
263
263
  role: "tab",
264
- "aria-selected": y === e,
265
- "data-active": String(y === e),
266
- title: o.viewHint(o.views[y] ?? y),
267
- onClick: () => r.changeView(y),
268
- children: o.views[y] ?? y
264
+ "aria-selected": O === r,
265
+ "data-active": String(O === r),
266
+ title: a.viewHint(a.views[O] ?? O),
267
+ onClick: () => t.changeView(O),
268
+ children: a.views[O] ?? O
269
269
  },
270
- y
270
+ O
271
271
  )) })
272
272
  ] });
273
273
  }
274
- function U(r) {
275
- return r < 10 ? `0${r}` : String(r);
274
+ function dt(t) {
275
+ return t < 10 ? `0${t}` : String(t);
276
276
  }
277
- function It(r) {
278
- const t = (Math.round(r) % 1440 + 1440) % 1440;
279
- return `${U(Math.floor(t / 60))}:${U(t % 60)}`;
277
+ function Ye(t) {
278
+ const e = (Math.round(t) % 1440 + 1440) % 1440;
279
+ return `${dt(Math.floor(e / 60))}:${dt(e % 60)}`;
280
280
  }
281
- function At(r) {
282
- const t = Math.max(0, Math.round(r));
283
- return `${U(Math.floor(t / 60))}:${U(t % 60)}:00`;
281
+ function We(t) {
282
+ const e = Math.max(0, Math.round(t));
283
+ return `${dt(Math.floor(e / 60))}:${dt(e % 60)}:00`;
284
284
  }
285
- function X(r, t) {
286
- if (!t) return null;
287
- const e = new Intl.DateTimeFormat(r, t);
288
- return (n) => e.format(n);
285
+ function ct(t, e) {
286
+ if (!e) return null;
287
+ const r = new Intl.DateTimeFormat(t, e);
288
+ return (n) => r.format(n);
289
289
  }
290
- function W(r, t, e) {
291
- if (t === !1) return null;
292
- const n = new Intl.DateTimeFormat(r, t ?? e);
293
- return (o) => n.format(o);
290
+ function st(t, e, r) {
291
+ if (e === !1) return null;
292
+ const n = new Intl.DateTimeFormat(t, e ?? r);
293
+ return (a) => n.format(a);
294
294
  }
295
- function st(r, t) {
296
- r.trigger("navLinkDay", { date: t });
297
- const e = r.hasView("timeGridDay") ? "timeGridDay" : r.hasView("dayGridDay") ? "dayGridDay" : null;
298
- e && (r.gotoDate(s.toISOString(t)), r.changeView(e));
295
+ function ee(t, e) {
296
+ t.trigger("navLinkDay", { date: e });
297
+ const r = t.hasView("timeGridDay") ? "timeGridDay" : t.hasView("dayGridDay") ? "dayGridDay" : null;
298
+ r && (t.gotoDate(m.toISOString(e)), t.changeView(r));
299
299
  }
300
- const _ = 1440, Ht = {
300
+ const at = 1440, Ge = {
301
301
  moveLeft: ["ArrowLeft"],
302
302
  moveRight: ["ArrowRight"],
303
303
  moveUp: ["ArrowUp"],
304
304
  moveDown: ["ArrowDown"],
305
305
  activate: ["Enter", " "]
306
306
  };
307
- function Nt(r, t) {
308
- const e = Object.entries(Ht);
309
- for (const [n, o] of e)
310
- if (((t == null ? void 0 : t[n]) ?? o).includes(r)) return n;
307
+ function Ue(t, e) {
308
+ const r = Object.entries(Ge);
309
+ for (const [n, a] of r)
310
+ if (((e == null ? void 0 : e[n]) ?? a).includes(t)) return n;
311
311
  return null;
312
312
  }
313
- function lt(r, t) {
314
- const { api: e, event: n, kind: o } = t, a = K(t.snap ?? "00:30"), h = Nt(r.key, t.shortcuts);
315
- if (!h) return;
316
- if (h === "activate") {
317
- r.preventDefault(), e.trigger("eventClick", { event: n });
313
+ function re(t, e) {
314
+ const { api: r, event: n, kind: a } = e, o = X(e.snap ?? "00:30"), s = Ue(t.key, e.shortcuts);
315
+ if (!s) return;
316
+ if (s === "activate") {
317
+ t.preventDefault(), r.trigger("eventClick", { event: n });
318
318
  return;
319
319
  }
320
- let u = 0;
321
- switch (h) {
320
+ let i = 0;
321
+ switch (s) {
322
322
  case "moveLeft":
323
- u = -_;
323
+ i = -at;
324
324
  break;
325
325
  case "moveRight":
326
- u = _;
326
+ i = at;
327
327
  break;
328
328
  case "moveUp":
329
- u = o === "timeGrid" ? -a : -_ * 7;
329
+ i = a === "timeGrid" ? -o : -at * 7;
330
330
  break;
331
331
  case "moveDown":
332
- u = o === "timeGrid" ? a : _ * 7;
332
+ i = a === "timeGrid" ? o : at * 7;
333
333
  break;
334
334
  }
335
- r.preventDefault();
336
- const v = J(n.start, n.end, u, s);
337
- if (e.moveEvent(n.id, v.start, v.end)) {
338
- const c = e.getEventById(n.id);
339
- c && e.trigger("eventDrop", { event: c });
335
+ t.preventDefault();
336
+ const d = ht(n.start, n.end, i, m);
337
+ if (r.moveEvent(n.id, d.start, d.end)) {
338
+ const l = r.getEventById(n.id);
339
+ l && r.trigger("eventDrop", { event: l });
340
340
  }
341
341
  }
342
- const Vt = 1440, Yt = 4;
343
- function ct(r, t) {
342
+ function ze(t, e) {
344
343
  var n;
345
- const e = document.elementFromPoint(r, t);
346
- return ((n = e == null ? void 0 : e.closest('[data-rsv="day"]')) == null ? void 0 : n.dataset.date) ?? null;
347
- }
348
- function Gt(r, t) {
349
- r.stopPropagation();
350
- const { api: e, event: n, sourceDate: o } = t, a = r.clientX, h = r.clientY;
351
- let u = !1;
352
- const v = (l) => {
353
- !u && Math.hypot(l.clientX - a, l.clientY - h) > Yt && (u = !0, document.body.style.cursor = "grabbing");
354
- }, c = (l) => {
355
- var w;
356
- if (document.removeEventListener("pointermove", v), document.removeEventListener("pointerup", c), document.body.style.cursor = "", !u) return;
357
- (w = t.onMoved) == null || w.call(t);
358
- const f = ct(l.clientX, l.clientY);
359
- if (!f) return;
360
- const b = s.diff(s.from(o), s.from(f), "day");
361
- if (b === 0) return;
362
- const k = J(n.start, n.end, b * Vt, s);
363
- if (e.moveEvent(n.id, k.start, k.end)) {
364
- const p = e.getEventById(n.id);
365
- p && e.trigger("eventDrop", { event: p });
344
+ const r = document.elementFromPoint(t, e);
345
+ return ((n = r == null ? void 0 : r.closest('[data-rsv="day"]')) == null ? void 0 : n.dataset.date) ?? null;
346
+ }
347
+ function Xe(t, e) {
348
+ if (t.target.closest('[data-rsv="event"], [data-rsv="more-anchor"], [data-nav-link="true"]'))
349
+ return;
350
+ const { api: n } = e;
351
+ let a = e.startDate, o = !1;
352
+ const s = (d) => {
353
+ const l = ze(d.clientX, d.clientY);
354
+ l && l !== e.startDate && (o = !0), l && (a = l);
355
+ }, i = () => {
356
+ var D;
357
+ if (document.removeEventListener("pointermove", s), document.removeEventListener("pointerup", i), !o) return;
358
+ (D = e.onRangeSelect) == null || D.call(e);
359
+ const d = m.from(e.startDate), l = m.from(a), [c, p] = m.isBefore(d, l) ? [d, l] : [l, d];
360
+ n.select(m.toISOString(c), m.toISOString(m.add(p, { days: 1 })));
361
+ };
362
+ document.addEventListener("pointermove", s), document.addEventListener("pointerup", i);
363
+ }
364
+ function qe(t) {
365
+ if (Array.isArray(t)) return t;
366
+ }
367
+ function _e(t, e) {
368
+ var r = t == null ? null : typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
369
+ if (r != null) {
370
+ var n, a, o, s, i = [], d = !0, l = !1;
371
+ try {
372
+ if (o = (r = r.call(t)).next, e !== 0) for (; !(d = (n = o.call(r)).done) && (i.push(n.value), i.length !== e); d = !0) ;
373
+ } catch (c) {
374
+ l = !0, a = c;
375
+ } finally {
376
+ try {
377
+ if (!d && r.return != null && (s = r.return(), Object(s) !== s)) return;
378
+ } finally {
379
+ if (l) throw a;
380
+ }
381
+ }
382
+ return i;
383
+ }
384
+ }
385
+ function bt(t, e) {
386
+ (e == null || e > t.length) && (e = t.length);
387
+ for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
388
+ return n;
389
+ }
390
+ function ne(t, e) {
391
+ if (t) {
392
+ if (typeof t == "string") return bt(t, e);
393
+ var r = {}.toString.call(t).slice(8, -1);
394
+ return r === "Object" && t.constructor && (r = t.constructor.name), r === "Map" || r === "Set" ? Array.from(t) : r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? bt(t, e) : void 0;
395
+ }
396
+ }
397
+ function Ze() {
398
+ throw new TypeError(`Invalid attempt to destructure non-iterable instance.
399
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
400
+ }
401
+ function ae(t, e) {
402
+ return qe(t) || _e(t, e) || ne(t, e) || Ze();
403
+ }
404
+ var ft = {}, Z = {}, Rt;
405
+ function oe() {
406
+ if (Rt) return Z;
407
+ Rt = 1, Object.defineProperty(Z, "__esModule", { value: !0 }), Z.bind = void 0;
408
+ function t(e, r) {
409
+ var n = r.type, a = r.listener, o = r.options;
410
+ return e.addEventListener(n, a, o), function() {
411
+ e.removeEventListener(n, a, o);
412
+ };
413
+ }
414
+ return Z.bind = t, Z;
415
+ }
416
+ var Y = {}, Ht;
417
+ function Je() {
418
+ if (Ht) return Y;
419
+ Ht = 1;
420
+ var t = Y && Y.__assign || function() {
421
+ return t = Object.assign || function(o) {
422
+ for (var s, i = 1, d = arguments.length; i < d; i++) {
423
+ s = arguments[i];
424
+ for (var l in s) Object.prototype.hasOwnProperty.call(s, l) && (o[l] = s[l]);
425
+ }
426
+ return o;
427
+ }, t.apply(this, arguments);
428
+ };
429
+ Object.defineProperty(Y, "__esModule", { value: !0 }), Y.bindAll = void 0;
430
+ var e = /* @__PURE__ */ oe();
431
+ function r(o) {
432
+ if (!(typeof o > "u"))
433
+ return typeof o == "boolean" ? {
434
+ capture: o
435
+ } : o;
436
+ }
437
+ function n(o, s) {
438
+ if (s == null)
439
+ return o;
440
+ var i = t(t({}, o), { options: t(t({}, r(s)), r(o.options)) });
441
+ return i;
442
+ }
443
+ function a(o, s, i) {
444
+ var d = s.map(function(l) {
445
+ var c = n(l, i);
446
+ return (0, e.bind)(o, c);
447
+ });
448
+ return function() {
449
+ d.forEach(function(c) {
450
+ return c();
451
+ });
452
+ };
453
+ }
454
+ return Y.bindAll = a, Y;
455
+ }
456
+ var Lt;
457
+ function Qe() {
458
+ return Lt || (Lt = 1, (function(t) {
459
+ Object.defineProperty(t, "__esModule", { value: !0 }), t.bindAll = t.bind = void 0;
460
+ var e = /* @__PURE__ */ oe();
461
+ Object.defineProperty(t, "bind", { enumerable: !0, get: function() {
462
+ return e.bind;
463
+ } });
464
+ var r = /* @__PURE__ */ Je();
465
+ Object.defineProperty(t, "bindAll", { enumerable: !0, get: function() {
466
+ return r.bindAll;
467
+ } });
468
+ })(ft)), ft;
469
+ }
470
+ var q = /* @__PURE__ */ Qe(), ie = "data-pdnd-honey-pot";
471
+ function de(t) {
472
+ return t instanceof Element && t.hasAttribute(ie);
473
+ }
474
+ function se(t) {
475
+ var e = document.elementsFromPoint(t.x, t.y), r = ae(e, 2), n = r[0], a = r[1];
476
+ return n ? de(n) ? a ?? null : n : null;
477
+ }
478
+ function Q(t) {
479
+ "@babel/helpers - typeof";
480
+ return Q = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
481
+ return typeof e;
482
+ } : function(e) {
483
+ return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
484
+ }, Q(t);
485
+ }
486
+ function tr(t, e) {
487
+ if (Q(t) != "object" || !t) return t;
488
+ var r = t[Symbol.toPrimitive];
489
+ if (r !== void 0) {
490
+ var n = r.call(t, e);
491
+ if (Q(n) != "object") return n;
492
+ throw new TypeError("@@toPrimitive must return a primitive value.");
493
+ }
494
+ return (e === "string" ? String : Number)(t);
495
+ }
496
+ function er(t) {
497
+ var e = tr(t, "string");
498
+ return Q(e) == "symbol" ? e : e + "";
499
+ }
500
+ function ut(t, e, r) {
501
+ return (e = er(e)) in t ? Object.defineProperty(t, e, {
502
+ value: r,
503
+ enumerable: !0,
504
+ configurable: !0,
505
+ writable: !0
506
+ }) : t[e] = r, t;
507
+ }
508
+ var le = 2147483647, ce = {
509
+ inset: "unset",
510
+ border: "none",
511
+ padding: 0,
512
+ margin: 0,
513
+ overflow: "visible",
514
+ color: "inherit",
515
+ background: "transparent",
516
+ width: "auto",
517
+ height: "auto"
518
+ };
519
+ function G(t) {
520
+ var e = null;
521
+ return function() {
522
+ if (!e) {
523
+ for (var n = arguments.length, a = new Array(n), o = 0; o < n; o++)
524
+ a[o] = arguments[o];
525
+ var s = t.apply(this, a);
526
+ e = {
527
+ result: s
528
+ };
529
+ }
530
+ return e.result;
531
+ };
532
+ }
533
+ var z = G(function() {
534
+ return typeof HTMLElement < "u" && typeof HTMLElement.prototype.showPopover == "function";
535
+ });
536
+ function Nt(t, e) {
537
+ var r = Object.keys(t);
538
+ if (Object.getOwnPropertySymbols) {
539
+ var n = Object.getOwnPropertySymbols(t);
540
+ e && (n = n.filter(function(a) {
541
+ return Object.getOwnPropertyDescriptor(t, a).enumerable;
542
+ })), r.push.apply(r, n);
543
+ }
544
+ return r;
545
+ }
546
+ function Bt(t) {
547
+ for (var e = 1; e < arguments.length; e++) {
548
+ var r = arguments[e] != null ? arguments[e] : {};
549
+ e % 2 ? Nt(Object(r), !0).forEach(function(n) {
550
+ ut(t, n, r[n]);
551
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : Nt(Object(r)).forEach(function(n) {
552
+ Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(r, n));
553
+ });
554
+ }
555
+ return t;
556
+ }
557
+ var tt = 2, Kt = tt / 2;
558
+ function rr(t) {
559
+ return {
560
+ x: Math.floor(t.x),
561
+ y: Math.floor(t.y)
562
+ };
563
+ }
564
+ function nr(t) {
565
+ return {
566
+ x: t.x - Kt,
567
+ y: t.y - Kt
568
+ };
569
+ }
570
+ function ar(t) {
571
+ return {
572
+ x: Math.max(t.x, 0),
573
+ y: Math.max(t.y, 0)
574
+ };
575
+ }
576
+ function or(t) {
577
+ return {
578
+ x: Math.min(t.x, window.innerWidth - tt),
579
+ y: Math.min(t.y, window.innerHeight - tt)
580
+ };
581
+ }
582
+ function Vt(t) {
583
+ var e = t.client, r = or(ar(nr(rr(e))));
584
+ return DOMRect.fromRect({
585
+ x: r.x,
586
+ y: r.y,
587
+ width: tt,
588
+ height: tt
589
+ });
590
+ }
591
+ function Yt(t) {
592
+ var e = t.clientRect;
593
+ return {
594
+ left: "".concat(e.left, "px"),
595
+ top: "".concat(e.top, "px"),
596
+ width: "".concat(e.width, "px"),
597
+ height: "".concat(e.height, "px")
598
+ };
599
+ }
600
+ function ir(t) {
601
+ var e = t.client, r = t.clientRect;
602
+ return (
603
+ // is within horizontal bounds
604
+ e.x >= r.x && e.x <= r.x + r.width && // is within vertical bounds
605
+ e.y >= r.y && e.y <= r.y + r.height
606
+ );
607
+ }
608
+ function dr(t) {
609
+ var e = t.initial, r = document.createElement("div");
610
+ r.setAttribute(ie, "true"), z() && r.setAttribute("popover", "manual");
611
+ var n = Vt({
612
+ client: e
613
+ });
614
+ Object.assign(r.style, Bt(Bt({
615
+ position: "fixed"
616
+ }, z() ? (
617
+ // needs to come first as it has 'inset: unset' which
618
+ // needs to be overridden by our top / left values
619
+ ce
620
+ ) : {
621
+ // Fallback: using maximum possible z-index so that this element
622
+ // will always be on top of other positioned content.
623
+ zIndex: le
624
+ }), {}, {
625
+ // Setting a background color explicitly to avoid any inherited styles.
626
+ // Looks like this could be `opacity: 0`, but worried that _might_
627
+ // cause the element to be ignored on some platforms.
628
+ // When debugging, set backgroundColor to something like "red".
629
+ backgroundColor: "transparent",
630
+ // Being explicit to avoid inheriting styles
631
+ padding: 0,
632
+ margin: 0,
633
+ boxSizing: "border-box",
634
+ // We want this element to absorb pointer events,
635
+ // it's kind of the whole point 😉
636
+ pointerEvents: "auto"
637
+ }, Yt({
638
+ clientRect: n
639
+ }))), document.body.appendChild(r), z() && r.showPopover();
640
+ var a = q.bind(window, {
641
+ type: "pointermove",
642
+ listener: function(s) {
643
+ var i = {
644
+ x: s.clientX,
645
+ y: s.clientY
646
+ };
647
+ n = Vt({
648
+ client: i
649
+ }), Object.assign(r.style, Yt({
650
+ clientRect: n
651
+ }));
652
+ },
653
+ // using capture so we are less likely to be impacted by event stopping
654
+ options: {
655
+ capture: !0
656
+ }
657
+ });
658
+ return function(s) {
659
+ var i = s.current;
660
+ if (a(), ir({
661
+ client: i,
662
+ clientRect: n
663
+ })) {
664
+ r.remove();
665
+ return;
366
666
  }
667
+ function d() {
668
+ l(), r.remove();
669
+ }
670
+ var l = q.bindAll(window, [
671
+ {
672
+ type: "pointerdown",
673
+ listener: d
674
+ },
675
+ {
676
+ type: "pointermove",
677
+ listener: d
678
+ },
679
+ {
680
+ type: "focusin",
681
+ listener: d
682
+ },
683
+ {
684
+ type: "focusout",
685
+ listener: d
686
+ },
687
+ // a 'pointerdown' should happen before 'dragstart', but just being super safe
688
+ {
689
+ type: "dragstart",
690
+ listener: d
691
+ },
692
+ // if the user has dragged something out of the window
693
+ // and then is dragging something back into the window
694
+ // the first events we will see are "dragenter" (and then "dragover").
695
+ // So if we see any of these we need to clear the post drag fix.
696
+ {
697
+ type: "dragenter",
698
+ listener: d
699
+ },
700
+ {
701
+ type: "dragover",
702
+ listener: d
703
+ }
704
+ // Not adding a "wheel" event listener, as "wheel" by itself does not
705
+ // resolve the bug.
706
+ ], {
707
+ // Using `capture` so less likely to be impacted by other code stopping events
708
+ capture: !0
709
+ });
367
710
  };
368
- document.addEventListener("pointermove", v), document.addEventListener("pointerup", c);
369
711
  }
370
- function Bt(r, t) {
371
- if (r.target.closest('[data-rsv="event"], [data-rsv="more-anchor"], [data-nav-link="true"]'))
712
+ function sr() {
713
+ var t = null;
714
+ function e() {
715
+ return t = null, q.bind(window, {
716
+ type: "pointermove",
717
+ listener: function(a) {
718
+ t = {
719
+ x: a.clientX,
720
+ y: a.clientY
721
+ };
722
+ },
723
+ // listening for pointer move in capture phase
724
+ // so we are less likely to be impacted by events being stopped.
725
+ options: {
726
+ capture: !0
727
+ }
728
+ });
729
+ }
730
+ function r() {
731
+ var n = null;
732
+ return function(o) {
733
+ var s = o.eventName, i = o.payload;
734
+ if (s === "onDragStart") {
735
+ var d = i.location.initial.input, l = t ?? {
736
+ x: d.clientX,
737
+ y: d.clientY
738
+ };
739
+ n = dr({
740
+ initial: l
741
+ });
742
+ }
743
+ if (s === "onDrop") {
744
+ var c, p = i.location.current.input;
745
+ (c = n) === null || c === void 0 || c({
746
+ current: {
747
+ x: p.clientX,
748
+ y: p.clientY
749
+ }
750
+ }), n = null, t = null;
751
+ }
752
+ };
753
+ }
754
+ return {
755
+ bindEvents: e,
756
+ getOnPostDispatch: r
757
+ };
758
+ }
759
+ function lr(t) {
760
+ if (Array.isArray(t)) return bt(t);
761
+ }
762
+ function cr(t) {
763
+ if (typeof Symbol < "u" && t[Symbol.iterator] != null || t["@@iterator"] != null) return Array.from(t);
764
+ }
765
+ function ur() {
766
+ throw new TypeError(`Invalid attempt to spread non-iterable instance.
767
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
768
+ }
769
+ function ue(t) {
770
+ return lr(t) || cr(t) || ne(t) || ur();
771
+ }
772
+ var vr = G(function() {
773
+ return process.env.NODE_ENV === "test" ? !1 : navigator.userAgent.includes("Firefox");
774
+ }), vt = G(function() {
775
+ if (process.env.NODE_ENV === "test")
776
+ return !1;
777
+ var e = navigator, r = e.userAgent;
778
+ return r.includes("AppleWebKit") && !r.includes("Chrome");
779
+ });
780
+ function fr(t) {
781
+ return "nodeName" in t;
782
+ }
783
+ function gr(t) {
784
+ return fr(t) && t.ownerDocument !== document;
785
+ }
786
+ var wt = {
787
+ isLeavingWindow: Symbol("leaving"),
788
+ isEnteringWindow: Symbol("entering")
789
+ };
790
+ (function() {
791
+ if (typeof window > "u" || process.env.NODE_ENV === "test" || !vt())
372
792
  return;
373
- const { api: n } = t;
374
- let o = t.startDate, a = !1;
375
- const h = (v) => {
376
- const c = ct(v.clientX, v.clientY);
377
- c && c !== t.startDate && (a = !0), c && (o = c);
378
- }, u = () => {
379
- var b;
380
- if (document.removeEventListener("pointermove", h), document.removeEventListener("pointerup", u), !a) return;
381
- (b = t.onRangeSelect) == null || b.call(t);
382
- const v = s.from(t.startDate), c = s.from(o), [l, f] = s.isBefore(v, c) ? [v, c] : [c, v];
383
- n.select(s.toISOString(l), s.toISOString(s.add(f, { days: 1 })));
793
+ function e() {
794
+ return {
795
+ enterCount: 0,
796
+ isOverWindow: !1
797
+ };
798
+ }
799
+ var r = e();
800
+ function n() {
801
+ r = e();
802
+ }
803
+ q.bindAll(
804
+ window,
805
+ [{
806
+ type: "dragstart",
807
+ listener: function() {
808
+ r.enterCount = 0, r.isOverWindow = !0;
809
+ }
810
+ }, {
811
+ type: "drop",
812
+ listener: n
813
+ }, {
814
+ type: "dragend",
815
+ listener: n
816
+ }, {
817
+ type: "dragenter",
818
+ listener: function(o) {
819
+ !r.isOverWindow && r.enterCount === 0 && (o[wt.isEnteringWindow] = !0), r.isOverWindow = !0, r.enterCount++;
820
+ }
821
+ }, {
822
+ type: "dragleave",
823
+ listener: function(o) {
824
+ r.enterCount--, r.isOverWindow && r.enterCount === 0 && (o[wt.isLeavingWindow] = !0, r.isOverWindow = !1);
825
+ }
826
+ }],
827
+ // using `capture: true` so that adding event listeners
828
+ // in bubble phase will have the correct symbols
829
+ {
830
+ capture: !0
831
+ }
832
+ );
833
+ })();
834
+ function mr(t) {
835
+ var e = t.dragLeave;
836
+ return vt() ? e.hasOwnProperty(wt.isLeavingWindow) : !1;
837
+ }
838
+ function yr(t) {
839
+ var e = t.dragLeave, r = e.type, n = e.relatedTarget;
840
+ return r !== "dragleave" ? !1 : vt() ? mr({
841
+ dragLeave: e
842
+ }) : n == null ? !0 : vr() ? gr(n) : n instanceof HTMLIFrameElement;
843
+ }
844
+ function pr(t) {
845
+ var e = t.onDragEnd;
846
+ return [
847
+ // ## Detecting drag ending for removed draggables
848
+ //
849
+ // If a draggable element is removed during a drag and the user drops:
850
+ // 1. if over a valid drop target: we get a "drop" event to know the drag is finished
851
+ // 2. if not over a valid drop target (or cancelled): we get nothing
852
+ // The "dragend" event will not fire on the source draggable if it has been
853
+ // removed from the DOM.
854
+ // So we need to figure out if a drag operation has finished by looking at other events
855
+ // We can do this by looking at other events
856
+ // ### First detection: "pointermove" events
857
+ // 1. "pointermove" events cannot fire during a drag and drop operation
858
+ // according to the spec. So if we get a "pointermove" it means that
859
+ // the drag and drop operations has finished. So if we get a "pointermove"
860
+ // we know that the drag is over
861
+ // 2. 🦊😤 Drag and drop operations are _supposed_ to suppress
862
+ // other pointer events. However, firefox will allow a few
863
+ // pointer event to get through after a drag starts.
864
+ // The most I've seen is 3
865
+ {
866
+ type: "pointermove",
867
+ listener: /* @__PURE__ */ (function() {
868
+ var r = 0;
869
+ return function() {
870
+ if (r < 20) {
871
+ r++;
872
+ return;
873
+ }
874
+ e();
875
+ };
876
+ })()
877
+ },
878
+ // ### Second detection: "pointerdown" events
879
+ // If we receive this event then we know that a drag operation has finished
880
+ // and potentially another one is about to start.
881
+ // Note: `pointerdown` fires on all browsers / platforms before "dragstart"
882
+ {
883
+ type: "pointerdown",
884
+ listener: e
885
+ }
886
+ ];
887
+ }
888
+ function J(t) {
889
+ return {
890
+ altKey: t.altKey,
891
+ button: t.button,
892
+ buttons: t.buttons,
893
+ ctrlKey: t.ctrlKey,
894
+ metaKey: t.metaKey,
895
+ shiftKey: t.shiftKey,
896
+ clientX: t.clientX,
897
+ clientY: t.clientY,
898
+ pageX: t.pageX,
899
+ pageY: t.pageY
900
+ };
901
+ }
902
+ var hr = function(e) {
903
+ var r = [], n = null, a = function() {
904
+ for (var s = arguments.length, i = new Array(s), d = 0; d < s; d++)
905
+ i[d] = arguments[d];
906
+ r = i, !n && (n = requestAnimationFrame(function() {
907
+ n = null, e.apply(void 0, r);
908
+ }));
909
+ };
910
+ return a.cancel = function() {
911
+ n && (cancelAnimationFrame(n), n = null);
912
+ }, a;
913
+ }, gt = hr(function(t) {
914
+ return t();
915
+ }), ot = /* @__PURE__ */ (function() {
916
+ var t = null;
917
+ function e(n) {
918
+ var a = requestAnimationFrame(function() {
919
+ t = null, n();
920
+ });
921
+ t = {
922
+ frameId: a,
923
+ fn: n
924
+ };
925
+ }
926
+ function r() {
927
+ t && (cancelAnimationFrame(t.frameId), t.fn(), t = null);
928
+ }
929
+ return {
930
+ schedule: e,
931
+ flush: r
932
+ };
933
+ })();
934
+ function br(t) {
935
+ var e = t.source, r = t.initial, n = t.dispatchEvent, a = {
936
+ dropTargets: []
937
+ };
938
+ function o(i) {
939
+ n(i), a = {
940
+ dropTargets: i.payload.location.current.dropTargets
941
+ };
942
+ }
943
+ var s = {
944
+ start: function(d) {
945
+ var l = d.nativeSetDragImage, c = {
946
+ current: r,
947
+ previous: a,
948
+ initial: r
949
+ };
950
+ o({
951
+ eventName: "onGenerateDragPreview",
952
+ payload: {
953
+ source: e,
954
+ location: c,
955
+ nativeSetDragImage: l
956
+ }
957
+ }), ot.schedule(function() {
958
+ o({
959
+ eventName: "onDragStart",
960
+ payload: {
961
+ source: e,
962
+ location: c
963
+ }
964
+ });
965
+ });
966
+ },
967
+ dragUpdate: function(d) {
968
+ var l = d.current;
969
+ ot.flush(), gt.cancel(), o({
970
+ eventName: "onDropTargetChange",
971
+ payload: {
972
+ source: e,
973
+ location: {
974
+ initial: r,
975
+ previous: a,
976
+ current: l
977
+ }
978
+ }
979
+ });
980
+ },
981
+ drag: function(d) {
982
+ var l = d.current;
983
+ gt(function() {
984
+ ot.flush();
985
+ var c = {
986
+ initial: r,
987
+ previous: a,
988
+ current: l
989
+ };
990
+ o({
991
+ eventName: "onDrag",
992
+ payload: {
993
+ source: e,
994
+ location: c
995
+ }
996
+ });
997
+ });
998
+ },
999
+ drop: function(d) {
1000
+ var l = d.current, c = d.updatedSourcePayload;
1001
+ ot.flush(), gt.cancel(), o({
1002
+ eventName: "onDrop",
1003
+ payload: {
1004
+ source: c ?? e,
1005
+ location: {
1006
+ current: l,
1007
+ previous: a,
1008
+ initial: r
1009
+ }
1010
+ }
1011
+ });
1012
+ }
1013
+ };
1014
+ return s;
1015
+ }
1016
+ var Dt = {
1017
+ isActive: !1
1018
+ };
1019
+ function ve() {
1020
+ return !Dt.isActive;
1021
+ }
1022
+ function wr(t) {
1023
+ return t.dataTransfer ? t.dataTransfer.setDragImage.bind(t.dataTransfer) : null;
1024
+ }
1025
+ function Dr(t) {
1026
+ var e = t.current, r = t.next;
1027
+ if (e.length !== r.length)
1028
+ return !0;
1029
+ for (var n = 0; n < e.length; n++)
1030
+ if (e[n].element !== r[n].element)
1031
+ return !0;
1032
+ return !1;
1033
+ }
1034
+ function Sr(t) {
1035
+ var e = t.event, r = t.dragType, n = t.getDropTargetsOver, a = t.dispatchEvent;
1036
+ if (!ve())
1037
+ return;
1038
+ var o = Or({
1039
+ event: e,
1040
+ dragType: r,
1041
+ getDropTargetsOver: n
1042
+ });
1043
+ Dt.isActive = !0;
1044
+ var s = {
1045
+ current: o
1046
+ };
1047
+ mt({
1048
+ event: e,
1049
+ current: o.dropTargets
1050
+ });
1051
+ var i = br({
1052
+ source: r.payload,
1053
+ dispatchEvent: a,
1054
+ initial: o
1055
+ });
1056
+ function d(v) {
1057
+ var g = Dr({
1058
+ current: s.current.dropTargets,
1059
+ next: v.dropTargets
1060
+ });
1061
+ s.current = v, g && i.dragUpdate({
1062
+ current: s.current
1063
+ });
1064
+ }
1065
+ function l(v) {
1066
+ var g = J(v), h = de(v.target) ? se({
1067
+ x: g.clientX,
1068
+ y: g.clientY
1069
+ }) : v.target, b = n({
1070
+ target: h,
1071
+ input: g,
1072
+ source: r.payload,
1073
+ current: s.current.dropTargets
1074
+ });
1075
+ b.length && (v.preventDefault(), mt({
1076
+ event: v,
1077
+ current: b
1078
+ })), d({
1079
+ dropTargets: b,
1080
+ input: g
1081
+ });
1082
+ }
1083
+ function c() {
1084
+ s.current.dropTargets.length && d({
1085
+ dropTargets: [],
1086
+ input: s.current.input
1087
+ }), i.drop({
1088
+ current: s.current,
1089
+ updatedSourcePayload: null
1090
+ }), p();
1091
+ }
1092
+ function p() {
1093
+ Dt.isActive = !1, D();
1094
+ }
1095
+ var D = q.bindAll(
1096
+ window,
1097
+ [{
1098
+ // 👋 Note: we are repurposing the `dragover` event as our `drag` event
1099
+ // this is because firefox does not publish pointer coordinates during
1100
+ // a `drag` event, but does for every other type of drag event
1101
+ // `dragover` fires on all elements that are being dragged over
1102
+ // Because we are binding to `window` - our `dragover` is effectively the same as a `drag`
1103
+ // 🦊😤
1104
+ type: "dragover",
1105
+ listener: function(g) {
1106
+ l(g), i.drag({
1107
+ current: s.current
1108
+ });
1109
+ }
1110
+ }, {
1111
+ type: "dragenter",
1112
+ listener: l
1113
+ }, {
1114
+ type: "dragleave",
1115
+ listener: function(g) {
1116
+ yr({
1117
+ dragLeave: g
1118
+ }) && (d({
1119
+ input: s.current.input,
1120
+ dropTargets: []
1121
+ }), r.startedFrom === "external" && c());
1122
+ }
1123
+ }, {
1124
+ // A "drop" can only happen if the browser allowed the drop
1125
+ type: "drop",
1126
+ listener: function(g) {
1127
+ if (s.current = {
1128
+ dropTargets: s.current.dropTargets,
1129
+ input: J(g)
1130
+ }, !s.current.dropTargets.length) {
1131
+ c();
1132
+ return;
1133
+ }
1134
+ g.preventDefault(), mt({
1135
+ event: g,
1136
+ current: s.current.dropTargets
1137
+ }), i.drop({
1138
+ current: s.current,
1139
+ // When dropping something native, we need to extract the latest
1140
+ // `.items` from the "drop" event as it is now accessible
1141
+ updatedSourcePayload: r.type === "external" ? r.getDropPayload(g) : null
1142
+ }), p();
1143
+ }
1144
+ }, {
1145
+ // "dragend" fires when on the drag source (eg a draggable element)
1146
+ // when the drag is finished.
1147
+ // "dragend" will fire after "drop" (if there was a successful drop)
1148
+ // "dragend" does not fire if the draggable source has been removed during the drag
1149
+ // or for external drag sources (eg files)
1150
+ // This "dragend" listener will not fire if there was a successful drop
1151
+ // as we will have already removed the event listener
1152
+ type: "dragend",
1153
+ listener: function(g) {
1154
+ s.current = {
1155
+ dropTargets: s.current.dropTargets,
1156
+ input: J(g)
1157
+ }, c();
1158
+ }
1159
+ }].concat(ue(pr({
1160
+ onDragEnd: c
1161
+ }))),
1162
+ // Once we have started a managed drag operation it is important that we see / own all drag events
1163
+ // We got one adoption bug pop up where some code was stopping (`event.stopPropagation()`)
1164
+ // all "drop" events in the bubble phase on the `document.body`.
1165
+ // This meant that we never saw the "drop" event.
1166
+ {
1167
+ capture: !0
1168
+ }
1169
+ );
1170
+ i.start({
1171
+ nativeSetDragImage: wr(e)
1172
+ });
1173
+ }
1174
+ function mt(t) {
1175
+ var e, r = t.event, n = t.current, a = (e = n[0]) === null || e === void 0 ? void 0 : e.dropEffect;
1176
+ a != null && r.dataTransfer && (r.dataTransfer.dropEffect = a);
1177
+ }
1178
+ function Or(t) {
1179
+ var e = t.event, r = t.dragType, n = t.getDropTargetsOver, a = J(e);
1180
+ if (r.startedFrom === "external")
1181
+ return {
1182
+ input: a,
1183
+ dropTargets: []
1184
+ };
1185
+ var o = n({
1186
+ input: a,
1187
+ source: r.payload,
1188
+ target: e.target,
1189
+ current: []
1190
+ });
1191
+ return {
1192
+ input: a,
1193
+ dropTargets: o
1194
+ };
1195
+ }
1196
+ var Wt = {
1197
+ canStart: ve,
1198
+ start: Sr
1199
+ }, St = /* @__PURE__ */ new Map();
1200
+ function Tr(t) {
1201
+ var e = t.typeKey, r = t.mount, n = St.get(e);
1202
+ if (n)
1203
+ return n.usageCount++, n;
1204
+ var a = {
1205
+ typeKey: e,
1206
+ unmount: r(),
1207
+ usageCount: 1
1208
+ };
1209
+ return St.set(e, a), a;
1210
+ }
1211
+ function Er(t) {
1212
+ var e = Tr(t);
1213
+ return function() {
1214
+ e.usageCount--, !(e.usageCount > 0) && (e.unmount(), St.delete(t.typeKey));
384
1215
  };
385
- document.addEventListener("pointermove", h), document.addEventListener("pointerup", u);
386
1216
  }
387
- function ut({ api: r, model: t, options: e }) {
1217
+ function Et() {
1218
+ for (var t = arguments.length, e = new Array(t), r = 0; r < t; r++)
1219
+ e[r] = arguments[r];
1220
+ return function() {
1221
+ e.forEach(function(a) {
1222
+ return a();
1223
+ });
1224
+ };
1225
+ }
1226
+ function fe(t, e) {
1227
+ var r = e.attribute, n = e.value;
1228
+ return t.setAttribute(r, n), function() {
1229
+ return t.removeAttribute(r);
1230
+ };
1231
+ }
1232
+ function Gt(t, e) {
1233
+ var r = Object.keys(t);
1234
+ if (Object.getOwnPropertySymbols) {
1235
+ var n = Object.getOwnPropertySymbols(t);
1236
+ e && (n = n.filter(function(a) {
1237
+ return Object.getOwnPropertyDescriptor(t, a).enumerable;
1238
+ })), r.push.apply(r, n);
1239
+ }
1240
+ return r;
1241
+ }
1242
+ function B(t) {
1243
+ for (var e = 1; e < arguments.length; e++) {
1244
+ var r = arguments[e] != null ? arguments[e] : {};
1245
+ e % 2 ? Gt(Object(r), !0).forEach(function(n) {
1246
+ ut(t, n, r[n]);
1247
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : Gt(Object(r)).forEach(function(n) {
1248
+ Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(r, n));
1249
+ });
1250
+ }
1251
+ return t;
1252
+ }
1253
+ function yt(t, e) {
1254
+ var r = typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
1255
+ if (!r) {
1256
+ if (Array.isArray(t) || (r = Mr(t)) || e) {
1257
+ r && (t = r);
1258
+ var n = 0, a = function() {
1259
+ };
1260
+ return { s: a, n: function() {
1261
+ return n >= t.length ? { done: !0 } : { done: !1, value: t[n++] };
1262
+ }, e: function(l) {
1263
+ throw l;
1264
+ }, f: a };
1265
+ }
1266
+ throw new TypeError(`Invalid attempt to iterate non-iterable instance.
1267
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1268
+ }
1269
+ var o, s = !0, i = !1;
1270
+ return { s: function() {
1271
+ r = r.call(t);
1272
+ }, n: function() {
1273
+ var l = r.next();
1274
+ return s = l.done, l;
1275
+ }, e: function(l) {
1276
+ i = !0, o = l;
1277
+ }, f: function() {
1278
+ try {
1279
+ s || r.return == null || r.return();
1280
+ } finally {
1281
+ if (i) throw o;
1282
+ }
1283
+ } };
1284
+ }
1285
+ function Mr(t, e) {
1286
+ if (t) {
1287
+ if (typeof t == "string") return Ut(t, e);
1288
+ var r = {}.toString.call(t).slice(8, -1);
1289
+ return r === "Object" && t.constructor && (r = t.constructor.name), r === "Map" || r === "Set" ? Array.from(t) : r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? Ut(t, e) : void 0;
1290
+ }
1291
+ }
1292
+ function Ut(t, e) {
1293
+ (e == null || e > t.length) && (e = t.length);
1294
+ for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
1295
+ return n;
1296
+ }
1297
+ function pt(t) {
1298
+ return t.slice(0).reverse();
1299
+ }
1300
+ function kr(t) {
1301
+ var e = t.typeKey, r = t.defaultDropEffect, n = /* @__PURE__ */ new WeakMap(), a = "data-drop-target-for-".concat(e), o = "[".concat(a, "]");
1302
+ function s(v) {
1303
+ return n.set(v.element, v), function() {
1304
+ return n.delete(v.element);
1305
+ };
1306
+ }
1307
+ function i(v) {
1308
+ if (process.env.NODE_ENV !== "production") {
1309
+ var g = n.get(v.element);
1310
+ g && console.warn("You have already registered a [".concat(e, "] dropTarget on the same element"), {
1311
+ existing: g,
1312
+ proposed: v
1313
+ }), v.element instanceof HTMLIFrameElement && console.warn(`
1314
+ We recommend not registering <iframe> elements as drop targets
1315
+ as it can result in some strange browser event ordering.
1316
+ `.replace(/\s{2,}/g, " ").trim());
1317
+ }
1318
+ var h = Et(fe(v.element, {
1319
+ attribute: a,
1320
+ value: "true"
1321
+ }), s(v));
1322
+ return G(h);
1323
+ }
1324
+ function d(v) {
1325
+ var g, h, b, w, S = v.source, M = v.target, x = v.input, y = v.result, f = y === void 0 ? [] : y;
1326
+ if (M == null)
1327
+ return f;
1328
+ if (!(M instanceof Element))
1329
+ return M instanceof Node ? d({
1330
+ source: S,
1331
+ target: M.parentElement,
1332
+ input: x,
1333
+ result: f
1334
+ }) : f;
1335
+ var T = M.closest(o);
1336
+ if (T == null)
1337
+ return f;
1338
+ var C = n.get(T);
1339
+ if (C == null)
1340
+ return f;
1341
+ var E = {
1342
+ input: x,
1343
+ source: S,
1344
+ element: C.element
1345
+ };
1346
+ if (C.canDrop && !C.canDrop(E))
1347
+ return d({
1348
+ source: S,
1349
+ target: C.element.parentElement,
1350
+ input: x,
1351
+ result: f
1352
+ });
1353
+ var P = (g = (h = C.getData) === null || h === void 0 ? void 0 : h.call(C, E)) !== null && g !== void 0 ? g : {}, I = (b = (w = C.getDropEffect) === null || w === void 0 ? void 0 : w.call(C, E)) !== null && b !== void 0 ? b : r, $ = {
1354
+ data: P,
1355
+ element: C.element,
1356
+ dropEffect: I,
1357
+ // we are collecting _actual_ drop targets, so these are
1358
+ // being applied _not_ due to stickiness
1359
+ isActiveDueToStickiness: !1
1360
+ };
1361
+ return d({
1362
+ source: S,
1363
+ target: C.element.parentElement,
1364
+ input: x,
1365
+ // Using bubble ordering. Same ordering as `event.getPath()`
1366
+ result: [].concat(ue(f), [$])
1367
+ });
1368
+ }
1369
+ function l(v) {
1370
+ var g = v.eventName, h = v.payload, b = yt(h.location.current.dropTargets), w;
1371
+ try {
1372
+ for (b.s(); !(w = b.n()).done; ) {
1373
+ var S, M = w.value, x = n.get(M.element), y = B(B({}, h), {}, {
1374
+ self: M
1375
+ });
1376
+ x == null || (S = x[g]) === null || S === void 0 || S.call(
1377
+ x,
1378
+ // I cannot seem to get the types right here.
1379
+ // TS doesn't seem to like that one event can need `nativeSetDragImage`
1380
+ // @ts-expect-error
1381
+ y
1382
+ );
1383
+ }
1384
+ } catch (f) {
1385
+ b.e(f);
1386
+ } finally {
1387
+ b.f();
1388
+ }
1389
+ }
1390
+ var c = {
1391
+ onGenerateDragPreview: l,
1392
+ onDrag: l,
1393
+ onDragStart: l,
1394
+ onDrop: l,
1395
+ onDropTargetChange: function(g) {
1396
+ var h = g.payload, b = new Set(h.location.current.dropTargets.map(function(A) {
1397
+ return A.element;
1398
+ })), w = /* @__PURE__ */ new Set(), S = yt(h.location.previous.dropTargets), M;
1399
+ try {
1400
+ for (S.s(); !(M = S.n()).done; ) {
1401
+ var x, y = M.value;
1402
+ w.add(y.element);
1403
+ var f = n.get(y.element), T = b.has(y.element), C = B(B({}, h), {}, {
1404
+ self: y
1405
+ });
1406
+ if (f == null || (x = f.onDropTargetChange) === null || x === void 0 || x.call(f, C), !T) {
1407
+ var E;
1408
+ f == null || (E = f.onDragLeave) === null || E === void 0 || E.call(f, C);
1409
+ }
1410
+ }
1411
+ } catch (A) {
1412
+ S.e(A);
1413
+ } finally {
1414
+ S.f();
1415
+ }
1416
+ var P = yt(h.location.current.dropTargets), I;
1417
+ try {
1418
+ for (P.s(); !(I = P.n()).done; ) {
1419
+ var $, j, U = I.value;
1420
+ if (!w.has(U.element)) {
1421
+ var _ = B(B({}, h), {}, {
1422
+ self: U
1423
+ }), O = n.get(U.element);
1424
+ O == null || ($ = O.onDropTargetChange) === null || $ === void 0 || $.call(O, _), O == null || (j = O.onDragEnter) === null || j === void 0 || j.call(O, _);
1425
+ }
1426
+ }
1427
+ } catch (A) {
1428
+ P.e(A);
1429
+ } finally {
1430
+ P.f();
1431
+ }
1432
+ }
1433
+ };
1434
+ function p(v) {
1435
+ c[v.eventName](v);
1436
+ }
1437
+ function D(v) {
1438
+ var g = v.source, h = v.target, b = v.input, w = v.current, S = d({
1439
+ source: g,
1440
+ target: h,
1441
+ input: b
1442
+ });
1443
+ if (S.length >= w.length)
1444
+ return S;
1445
+ for (var M = pt(w), x = pt(S), y = [], f = 0; f < M.length; f++) {
1446
+ var T, C = M[f], E = x[f];
1447
+ if (E != null) {
1448
+ y.push(E);
1449
+ continue;
1450
+ }
1451
+ var P = y[f - 1], I = M[f - 1];
1452
+ if ((P == null ? void 0 : P.element) !== (I == null ? void 0 : I.element))
1453
+ break;
1454
+ var $ = n.get(C.element);
1455
+ if (!$)
1456
+ break;
1457
+ var j = {
1458
+ input: b,
1459
+ source: g,
1460
+ element: $.element
1461
+ };
1462
+ if ($.canDrop && !$.canDrop(j) || !((T = $.getIsSticky) !== null && T !== void 0 && T.call($, j)))
1463
+ break;
1464
+ y.push(B(B({}, C), {}, {
1465
+ // making it clear to consumers this drop target is active due to stickiness
1466
+ isActiveDueToStickiness: !0
1467
+ }));
1468
+ }
1469
+ return pt(y);
1470
+ }
1471
+ return {
1472
+ dropTargetForConsumers: i,
1473
+ getIsOver: D,
1474
+ dispatchEvent: p
1475
+ };
1476
+ }
1477
+ function Cr(t, e) {
1478
+ var r = typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
1479
+ if (!r) {
1480
+ if (Array.isArray(t) || (r = xr(t)) || e) {
1481
+ r && (t = r);
1482
+ var n = 0, a = function() {
1483
+ };
1484
+ return { s: a, n: function() {
1485
+ return n >= t.length ? { done: !0 } : { done: !1, value: t[n++] };
1486
+ }, e: function(l) {
1487
+ throw l;
1488
+ }, f: a };
1489
+ }
1490
+ throw new TypeError(`Invalid attempt to iterate non-iterable instance.
1491
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1492
+ }
1493
+ var o, s = !0, i = !1;
1494
+ return { s: function() {
1495
+ r = r.call(t);
1496
+ }, n: function() {
1497
+ var l = r.next();
1498
+ return s = l.done, l;
1499
+ }, e: function(l) {
1500
+ i = !0, o = l;
1501
+ }, f: function() {
1502
+ try {
1503
+ s || r.return == null || r.return();
1504
+ } finally {
1505
+ if (i) throw o;
1506
+ }
1507
+ } };
1508
+ }
1509
+ function xr(t, e) {
1510
+ if (t) {
1511
+ if (typeof t == "string") return zt(t, e);
1512
+ var r = {}.toString.call(t).slice(8, -1);
1513
+ return r === "Object" && t.constructor && (r = t.constructor.name), r === "Map" || r === "Set" ? Array.from(t) : r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? zt(t, e) : void 0;
1514
+ }
1515
+ }
1516
+ function zt(t, e) {
1517
+ (e == null || e > t.length) && (e = t.length);
1518
+ for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
1519
+ return n;
1520
+ }
1521
+ function Xt(t, e) {
1522
+ var r = Object.keys(t);
1523
+ if (Object.getOwnPropertySymbols) {
1524
+ var n = Object.getOwnPropertySymbols(t);
1525
+ e && (n = n.filter(function(a) {
1526
+ return Object.getOwnPropertyDescriptor(t, a).enumerable;
1527
+ })), r.push.apply(r, n);
1528
+ }
1529
+ return r;
1530
+ }
1531
+ function Pr(t) {
1532
+ for (var e = 1; e < arguments.length; e++) {
1533
+ var r = arguments[e] != null ? arguments[e] : {};
1534
+ e % 2 ? Xt(Object(r), !0).forEach(function(n) {
1535
+ ut(t, n, r[n]);
1536
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : Xt(Object(r)).forEach(function(n) {
1537
+ Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(r, n));
1538
+ });
1539
+ }
1540
+ return t;
1541
+ }
1542
+ function Ar() {
1543
+ var t = /* @__PURE__ */ new Set(), e = null;
1544
+ function r(o) {
1545
+ e && (!o.canMonitor || o.canMonitor(e.canMonitorArgs)) && e.active.add(o);
1546
+ }
1547
+ function n(o) {
1548
+ var s = Pr({}, o);
1549
+ t.add(s), r(s);
1550
+ function i() {
1551
+ t.delete(s), e && e.active.delete(s);
1552
+ }
1553
+ return G(i);
1554
+ }
1555
+ function a(o) {
1556
+ var s = o.eventName, i = o.payload;
1557
+ if (s === "onGenerateDragPreview") {
1558
+ e = {
1559
+ canMonitorArgs: {
1560
+ initial: i.location.initial,
1561
+ source: i.source
1562
+ },
1563
+ active: /* @__PURE__ */ new Set()
1564
+ };
1565
+ var d = Cr(t), l;
1566
+ try {
1567
+ for (d.s(); !(l = d.n()).done; ) {
1568
+ var c = l.value;
1569
+ r(c);
1570
+ }
1571
+ } catch (b) {
1572
+ d.e(b);
1573
+ } finally {
1574
+ d.f();
1575
+ }
1576
+ }
1577
+ if (e) {
1578
+ for (var p = Array.from(e.active), D = 0, v = p; D < v.length; D++) {
1579
+ var g = v[D];
1580
+ if (e.active.has(g)) {
1581
+ var h;
1582
+ (h = g[s]) === null || h === void 0 || h.call(g, i);
1583
+ }
1584
+ }
1585
+ s === "onDrop" && (e.active.clear(), e = null);
1586
+ }
1587
+ }
1588
+ return {
1589
+ dispatchEvent: a,
1590
+ monitorForConsumers: n
1591
+ };
1592
+ }
1593
+ function Ir(t) {
1594
+ var e = t.typeKey, r = t.mount, n = t.dispatchEventToSource, a = t.onPostDispatch, o = t.defaultDropEffect, s = Ar(), i = kr({
1595
+ typeKey: e,
1596
+ defaultDropEffect: o
1597
+ });
1598
+ function d(p) {
1599
+ n == null || n(p), i.dispatchEvent(p), s.dispatchEvent(p), a == null || a(p);
1600
+ }
1601
+ function l(p) {
1602
+ var D = p.event, v = p.dragType;
1603
+ Wt.start({
1604
+ event: D,
1605
+ dragType: v,
1606
+ getDropTargetsOver: i.getIsOver,
1607
+ dispatchEvent: d
1608
+ });
1609
+ }
1610
+ function c() {
1611
+ function p() {
1612
+ var D = {
1613
+ canStart: Wt.canStart,
1614
+ start: l
1615
+ };
1616
+ return r(D);
1617
+ }
1618
+ return Er({
1619
+ typeKey: e,
1620
+ mount: p
1621
+ });
1622
+ }
1623
+ return {
1624
+ registerUsage: c,
1625
+ dropTarget: i.dropTargetForConsumers,
1626
+ monitor: s.monitorForConsumers
1627
+ };
1628
+ }
1629
+ var $r = G(function() {
1630
+ return navigator.userAgent.toLocaleLowerCase().includes("android");
1631
+ }), jr = "pdnd:android-fallback", qt = "text/plain", Fr = "text/uri-list", Rr = "application/vnd.pdnd", et = /* @__PURE__ */ new WeakMap();
1632
+ function Hr(t) {
1633
+ return et.set(t.element, t), function() {
1634
+ et.delete(t.element);
1635
+ };
1636
+ }
1637
+ var _t = sr(), Mt = Ir({
1638
+ typeKey: "element",
1639
+ defaultDropEffect: "move",
1640
+ mount: function(e) {
1641
+ return Et(_t.bindEvents(), q.bind(document, {
1642
+ type: "dragstart",
1643
+ listener: function(n) {
1644
+ var a, o, s, i, d, l;
1645
+ if (e.canStart(n) && !n.defaultPrevented) {
1646
+ if (!n.dataTransfer) {
1647
+ process.env.NODE_ENV !== "production" && console.warn(`
1648
+ It appears as though you have are not testing DragEvents correctly.
1649
+
1650
+ - If you are unit testing, ensure you have polyfilled DragEvent.
1651
+ - If you are browser testing, ensure you are dispatching drag events correctly.
1652
+
1653
+ Please see our testing guides for more information:
1654
+ https://atlassian.design/components/pragmatic-drag-and-drop/core-package/testing
1655
+ `.replace(/ {2}/g, ""));
1656
+ return;
1657
+ }
1658
+ var c = n.target;
1659
+ if (c instanceof HTMLElement) {
1660
+ var p = et.get(c);
1661
+ if (p) {
1662
+ var D = J(n), v = {
1663
+ element: p.element,
1664
+ dragHandle: (a = p.dragHandle) !== null && a !== void 0 ? a : null,
1665
+ input: D
1666
+ };
1667
+ if (p.canDrag && !p.canDrag(v)) {
1668
+ n.preventDefault();
1669
+ return;
1670
+ }
1671
+ if (p.dragHandle) {
1672
+ var g = se({
1673
+ x: D.clientX,
1674
+ y: D.clientY
1675
+ });
1676
+ if (!p.dragHandle.contains(g)) {
1677
+ n.preventDefault();
1678
+ return;
1679
+ }
1680
+ }
1681
+ var h = (o = (s = p.getInitialDataForExternal) === null || s === void 0 ? void 0 : s.call(p, v)) !== null && o !== void 0 ? o : null;
1682
+ if (h)
1683
+ for (var b = 0, w = Object.entries(h); b < w.length; b++) {
1684
+ var S = ae(w[b], 2), M = S[0], x = S[1];
1685
+ n.dataTransfer.setData(M, x ?? "");
1686
+ }
1687
+ $r() && !n.dataTransfer.types.includes(qt) && !n.dataTransfer.types.includes(Fr) && n.dataTransfer.setData(qt, jr), n.dataTransfer.setData(Rr, "");
1688
+ var y = {
1689
+ element: p.element,
1690
+ dragHandle: (i = p.dragHandle) !== null && i !== void 0 ? i : null,
1691
+ data: (d = (l = p.getInitialData) === null || l === void 0 ? void 0 : l.call(p, v)) !== null && d !== void 0 ? d : {}
1692
+ }, f = {
1693
+ type: "element",
1694
+ payload: y,
1695
+ startedFrom: "internal"
1696
+ };
1697
+ e.start({
1698
+ event: n,
1699
+ dragType: f
1700
+ });
1701
+ }
1702
+ }
1703
+ }
1704
+ }
1705
+ }));
1706
+ },
1707
+ dispatchEventToSource: function(e) {
1708
+ var r, n, a = e.eventName, o = e.payload;
1709
+ (r = et.get(o.source.element)) === null || r === void 0 || (n = r[a]) === null || n === void 0 || n.call(
1710
+ r,
1711
+ // I cannot seem to get the types right here.
1712
+ // TS doesn't seem to like that one event can need `nativeSetDragImage`
1713
+ // @ts-expect-error
1714
+ o
1715
+ );
1716
+ },
1717
+ onPostDispatch: _t.getOnPostDispatch()
1718
+ }), ge = Mt.dropTarget, kt = Mt.monitor;
1719
+ function Lr(t) {
1720
+ if (process.env.NODE_ENV !== "production" && t.dragHandle && !t.element.contains(t.dragHandle) && console.warn("Drag handle element must be contained in draggable element", {
1721
+ element: t.element,
1722
+ dragHandle: t.dragHandle
1723
+ }), process.env.NODE_ENV !== "production") {
1724
+ var e = et.get(t.element);
1725
+ e && console.warn("You have already registered a `draggable` on the same element", {
1726
+ existing: e,
1727
+ proposed: t
1728
+ });
1729
+ }
1730
+ var r = Et(
1731
+ // making the draggable register the adapter rather than drop targets
1732
+ // this is because you *must* have a draggable element to start a drag
1733
+ // but you _might_ not have any drop targets immediately
1734
+ // (You might create drop targets async)
1735
+ Mt.registerUsage(),
1736
+ Hr(t),
1737
+ fe(t.element, {
1738
+ attribute: "draggable",
1739
+ value: "true"
1740
+ })
1741
+ );
1742
+ return G(r);
1743
+ }
1744
+ function Zt(t, e) {
1745
+ var r = Object.keys(t);
1746
+ if (Object.getOwnPropertySymbols) {
1747
+ var n = Object.getOwnPropertySymbols(t);
1748
+ e && (n = n.filter(function(a) {
1749
+ return Object.getOwnPropertyDescriptor(t, a).enumerable;
1750
+ })), r.push.apply(r, n);
1751
+ }
1752
+ return r;
1753
+ }
1754
+ function Jt(t) {
1755
+ for (var e = 1; e < arguments.length; e++) {
1756
+ var r = arguments[e] != null ? arguments[e] : {};
1757
+ e % 2 ? Zt(Object(r), !0).forEach(function(n) {
1758
+ ut(t, n, r[n]);
1759
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : Zt(Object(r)).forEach(function(n) {
1760
+ Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(r, n));
1761
+ });
1762
+ }
1763
+ return t;
1764
+ }
1765
+ function Nr() {
1766
+ return {
1767
+ x: 0,
1768
+ y: 0
1769
+ };
1770
+ }
1771
+ function Br(t) {
1772
+ var e = t.render, r = t.nativeSetDragImage, n = t.getOffset, a = n === void 0 ? Nr : n, o = document.createElement("div");
1773
+ z() && o.setAttribute("popover", "manual"), Object.assign(o.style, Jt(Jt({
1774
+ // Ensuring we don't cause reflow when adding the element to the page
1775
+ // Using `position:fixed` rather than `position:absolute` so we are
1776
+ // positioned on the current viewport.
1777
+ // `position:fixed` also creates a new stacking context, so we don't need to do that here
1778
+ position: "fixed"
1779
+ }, z() ? (
1780
+ // needs to come first as it has 'inset: unset' which
1781
+ // needs to be overridden by our top / left values
1782
+ ce
1783
+ ) : {
1784
+ // Fallback: using maximum possible z-index so that this element
1785
+ // will always be on top of other positioned content.
1786
+ zIndex: le
1787
+ }), {}, {
1788
+ // According to `mdn`, the element can be offscreen:
1789
+ // https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/setDragImage#imgelement
1790
+ //
1791
+ // However, that information does not appear in the specs:
1792
+ // https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-setdragimage-dev
1793
+ //
1794
+ // If the element is _completely_ offscreen, Safari@17.1 will cancel the drag
1795
+ top: 0,
1796
+ left: 0,
1797
+ // Avoiding any additional events caused by the new element (being super safe)
1798
+ pointerEvents: "none"
1799
+ })), document.body.append(o), z() && o.showPopover();
1800
+ var s = e({
1801
+ container: o
1802
+ });
1803
+ queueMicrotask(function() {
1804
+ var l = a({
1805
+ container: o
1806
+ });
1807
+ if (vt()) {
1808
+ var c = o.getBoundingClientRect();
1809
+ if (c.width === 0)
1810
+ return;
1811
+ o.style.left = "-".concat(c.width - 1e-4, "px");
1812
+ }
1813
+ r == null || r(o, l.x, l.y);
1814
+ });
1815
+ function i() {
1816
+ d(), s == null || s(), document.body.removeChild(o);
1817
+ }
1818
+ var d = kt({
1819
+ // Remove portal in the dragstart event so that the user will never see it
1820
+ onDragStart: i,
1821
+ // Backup: remove portal when the drop finishes (this would be an error case)
1822
+ onDrop: i
1823
+ });
1824
+ }
1825
+ function Kr(t) {
1826
+ var e = t.element, r = t.input;
1827
+ return function(a) {
1828
+ var o = a.container, s = e.getBoundingClientRect(), i = o.getBoundingClientRect(), d = Math.min(
1829
+ // difference
1830
+ r.clientX - s.x,
1831
+ // don't let the difference be more than the width of the container,
1832
+ // otherwise the pointer will be off the preview
1833
+ i.width
1834
+ ), l = Math.min(
1835
+ // difference
1836
+ r.clientY - s.y,
1837
+ // don't let the difference be more than the height of the container,
1838
+ // otherwise the pointer will be off the preview
1839
+ i.height
1840
+ );
1841
+ return {
1842
+ x: d,
1843
+ y: l
1844
+ };
1845
+ };
1846
+ }
1847
+ let me = 0;
1848
+ function lt() {
1849
+ me = Date.now();
1850
+ }
1851
+ function ye(t = 300) {
1852
+ return Date.now() - me < t;
1853
+ }
1854
+ const Ct = "rsv-timegrid-event", pe = "rsv-timegrid-col";
1855
+ function he(t, e, r) {
1856
+ return r ? Lr({
1857
+ element: t,
1858
+ getInitialData: () => ({ [Ct]: !0, id: e.id }),
1859
+ onGenerateDragPreview({ location: n, nativeSetDragImage: a }) {
1860
+ Br({
1861
+ nativeSetDragImage: a,
1862
+ getOffset: Kr({ element: t, input: n.current.input }),
1863
+ render({ container: o }) {
1864
+ const s = t.cloneNode(!0);
1865
+ s.setAttribute("data-rsv-drag-preview", "true"), s.style.width = `${t.offsetWidth}px`, s.style.height = `${t.offsetHeight}px`, o.appendChild(s);
1866
+ }
1867
+ });
1868
+ }
1869
+ }) : () => {
1870
+ };
1871
+ }
1872
+ function Vr(t) {
1873
+ return ge({
1874
+ element: t,
1875
+ canDrop: ({ source: e }) => e.data[Ct] === !0,
1876
+ getData: ({ element: e }) => ({
1877
+ [pe]: !0,
1878
+ dayIndex: Number(e.dataset.rsvDayIndex ?? 0)
1879
+ })
1880
+ });
1881
+ }
1882
+ function Yr(t, e, r, n) {
1883
+ const a = t.getBoundingClientRect(), o = r.maxMinutes - r.minMinutes;
1884
+ if (a.height === 0 || o <= 0) return r.minMinutes;
1885
+ const s = r.minMinutes + (e - a.top) / a.height * o, i = Math.max(r.minMinutes, Math.min(r.maxMinutes, s));
1886
+ return Math.round(i / n) * n;
1887
+ }
1888
+ function Ot(t, e) {
1889
+ return m.diff(t, e, "minute");
1890
+ }
1891
+ function Wr(t, e, r) {
1892
+ const n = m.add(m.startOf(t, "day"), { minutes: e });
1893
+ if (Ot(n, r.start) === 0) return null;
1894
+ const a = r.end ? Ot(r.start, r.end) : 0;
1895
+ return {
1896
+ start: n,
1897
+ end: r.end ? m.add(n, { minutes: a }) : null
1898
+ };
1899
+ }
1900
+ function Gr({
1901
+ api: t,
1902
+ getModel: e,
1903
+ snap: r,
1904
+ onPreview: n,
1905
+ onDragging: a
1906
+ }) {
1907
+ const o = X(r ?? "00:15") || 15, s = (i) => {
1908
+ const d = i.current.dropTargets.find((c) => c.data[pe] === !0);
1909
+ if (!d) return null;
1910
+ const l = Yr(
1911
+ d.element,
1912
+ i.current.input.clientY,
1913
+ e(),
1914
+ o
1915
+ );
1916
+ return { target: d, inicio: l };
1917
+ };
1918
+ return kt({
1919
+ canMonitor: ({ source: i }) => i.data[Ct] === !0,
1920
+ onDragStart: ({ source: i }) => {
1921
+ lt(), a(String(i.data.id));
1922
+ },
1923
+ onDrag: ({ source: i, location: d }) => {
1924
+ const l = s(d);
1925
+ if (!l) return;
1926
+ const c = t.getEventById(String(i.data.id));
1927
+ if (!c) return;
1928
+ const p = c.end ? Math.max(o, Ot(c.start, c.end)) : o;
1929
+ n({
1930
+ dayIndex: Number(l.target.data.dayIndex),
1931
+ startMin: l.inicio,
1932
+ endMin: l.inicio + p
1933
+ });
1934
+ },
1935
+ onDrop: ({ source: i, location: d }) => {
1936
+ var v;
1937
+ lt(), n(null), a(null);
1938
+ const l = s(d);
1939
+ if (!l) return;
1940
+ const c = t.getEventById(String(i.data.id));
1941
+ if (!c) return;
1942
+ const p = (v = e().days[Number(l.target.data.dayIndex)]) == null ? void 0 : v.date;
1943
+ if (!p) return;
1944
+ const D = Wr(p, l.inicio, c);
1945
+ if (D && t.moveEvent(c.id, D.start, D.end)) {
1946
+ const g = t.getEventById(c.id);
1947
+ g && t.trigger("eventDrop", { event: g });
1948
+ }
1949
+ }
1950
+ });
1951
+ }
1952
+ const be = "rsv-timegrid-event", we = "rsv-daygrid-day";
1953
+ function Ur(t, e) {
1954
+ const r = m.diff(m.startOf(e.start, "day"), m.startOf(t, "day"), "day");
1955
+ return r === 0 ? null : {
1956
+ start: m.add(e.start, { days: r }),
1957
+ end: e.end ? m.add(e.end, { days: r }) : null
1958
+ };
1959
+ }
1960
+ function zr(t) {
1961
+ return ge({
1962
+ element: t,
1963
+ canDrop: ({ source: e }) => e.data[be] === !0,
1964
+ // Sin capturas: la fecha se lee del DOM al soltar, porque Preact reutiliza
1965
+ // la celda al navegar de mes.
1966
+ getData: ({ element: e }) => ({
1967
+ [we]: !0,
1968
+ fechaISO: e.dataset.date ?? ""
1969
+ })
1970
+ });
1971
+ }
1972
+ function Xr({
1973
+ api: t,
1974
+ onPreview: e,
1975
+ onDragging: r
1976
+ }) {
1977
+ const n = (a) => a.current.dropTargets.find((o) => o.data[we] === !0) ?? null;
1978
+ return kt({
1979
+ canMonitor: ({ source: a }) => a.data[be] === !0,
1980
+ onDragStart: ({ source: a }) => {
1981
+ lt(), r(String(a.data.id));
1982
+ },
1983
+ onDrag: ({ location: a }) => {
1984
+ const o = n(a);
1985
+ e(o ? String(o.data.fechaISO) : null);
1986
+ },
1987
+ onDrop: ({ source: a, location: o }) => {
1988
+ lt(), e(null), r(null);
1989
+ const s = n(o);
1990
+ if (!s) return;
1991
+ const i = t.getEventById(String(a.data.id));
1992
+ if (!i) return;
1993
+ const d = Ur(m.from(String(s.data.fechaISO)), i);
1994
+ if (d && t.moveEvent(i.id, d.start, d.end)) {
1995
+ const l = t.getEventById(i.id);
1996
+ l && t.trigger("eventDrop", { event: l });
1997
+ }
1998
+ }
1999
+ });
2000
+ }
2001
+ function De({ api: t, model: e, options: r }) {
388
2002
  var v;
389
- const n = e.locale ?? "en", o = { type: r.getView().type }, a = W(n, e.dayHeaderFormat, { weekday: "short" }), h = ((v = t.weeks[0]) == null ? void 0 : v.days) ?? [], u = e.weekNumbers === !0;
390
- return /* @__PURE__ */ g(
2003
+ const n = r.locale ?? "en", a = { type: t.getView().type }, o = st(n, r.dayHeaderFormat, { weekday: "short" }), s = ((v = e.weeks[0]) == null ? void 0 : v.days) ?? [], i = r.weekNumbers === !0, [d, l] = K(null), [c, p] = K(null), D = F(/* @__PURE__ */ new Map());
2004
+ return R(
2005
+ () => Xr({ api: t, onPreview: l, onDragging: p }),
2006
+ [t]
2007
+ ), R(() => {
2008
+ const g = D.current;
2009
+ return () => {
2010
+ for (const h of g.values()) h();
2011
+ g.clear();
2012
+ };
2013
+ }, []), /* @__PURE__ */ k(
391
2014
  "div",
392
2015
  {
393
2016
  "data-rsv": "daygrid",
394
- "data-weeknumbers": String(u),
395
- style: `--rsv-cols:${t.columnCount}`,
2017
+ "data-weeknumbers": String(i),
2018
+ style: `--rsv-cols:${e.columnCount}`,
396
2019
  children: [
397
- /* @__PURE__ */ g("div", { "data-rsv": "daygrid-header", role: "row", children: [
398
- u && /* @__PURE__ */ d("div", { "data-rsv": "daygrid-weeknum-header", role: "columnheader" }),
399
- h.map((c) => {
400
- var k, w;
401
- const l = s.toDate(c.date), f = a ? a(l) : "", b = {
402
- date: l,
403
- text: f,
404
- dayOfWeek: c.dayOfWeek,
405
- dayNumber: s.dayOfMonth(c.date),
406
- isToday: c.isToday,
407
- view: o
2020
+ /* @__PURE__ */ k("div", { "data-rsv": "daygrid-header", role: "row", children: [
2021
+ i && /* @__PURE__ */ u("div", { "data-rsv": "daygrid-weeknum-header", role: "columnheader" }),
2022
+ s.map((g) => {
2023
+ var S, M;
2024
+ const h = m.toDate(g.date), b = o ? o(h) : "", w = {
2025
+ date: h,
2026
+ text: b,
2027
+ dayOfWeek: g.dayOfWeek,
2028
+ dayNumber: m.dayOfMonth(g.date),
2029
+ isToday: g.isToday,
2030
+ view: a
408
2031
  };
409
- return /* @__PURE__ */ d(
2032
+ return /* @__PURE__ */ u(
410
2033
  "div",
411
2034
  {
412
2035
  "data-rsv": "daygrid-dow",
413
2036
  role: "columnheader",
414
- "data-dow": String(c.dayOfWeek),
415
- class: F((k = e.classNames) == null ? void 0 : k.dayHeader),
416
- ref: (p) => {
417
- var m;
418
- return A(p, (m = e.hooks) == null ? void 0 : m.dayHeaderDidMount, () => b);
2037
+ "data-dow": String(g.dayOfWeek),
2038
+ class: N((S = r.classNames) == null ? void 0 : S.dayHeader),
2039
+ ref: (x) => {
2040
+ var y;
2041
+ return W(x, (y = r.hooks) == null ? void 0 : y.dayHeaderDidMount, () => w);
419
2042
  },
420
- children: L((w = e.slots) == null ? void 0 : w.dayHeaderContent, b, f, e.hostBridge)
2043
+ children: L((M = r.slots) == null ? void 0 : M.dayHeaderContent, w, b, r.hostBridge)
421
2044
  },
422
- c.dayOfWeek
2045
+ g.dayOfWeek
423
2046
  );
424
2047
  })
425
2048
  ] }),
426
- t.weeks.map((c, l) => /* @__PURE__ */ g("div", { "data-rsv": "daygrid-week", role: "row", children: [
427
- u && /* @__PURE__ */ d("div", { "data-rsv": "daygrid-weeknum", role: "rowheader", children: c.weekNumber }),
428
- c.days.map((f) => /* @__PURE__ */ d(
429
- _t,
2049
+ e.weeks.map((g, h) => /* @__PURE__ */ k("div", { "data-rsv": "daygrid-week", role: "row", children: [
2050
+ i && /* @__PURE__ */ u("div", { "data-rsv": "daygrid-weeknum", role: "rowheader", children: g.weekNumber }),
2051
+ g.days.map((b) => /* @__PURE__ */ u(
2052
+ qr,
430
2053
  {
431
- api: r,
432
- cell: f,
433
- options: e,
434
- view: o
2054
+ api: t,
2055
+ cell: b,
2056
+ options: r,
2057
+ view: a,
2058
+ dropActivo: d === m.toISOString(b.date),
2059
+ limpiezaDias: D,
2060
+ idArrastrado: c
435
2061
  },
436
- s.toISOString(f.date)
2062
+ m.toISOString(b.date)
437
2063
  ))
438
- ] }, l))
2064
+ ] }, h))
439
2065
  ]
440
2066
  }
441
2067
  );
442
2068
  }
443
- function _t({
444
- api: r,
445
- cell: t,
446
- options: e,
447
- view: n
2069
+ function qr({
2070
+ api: t,
2071
+ cell: e,
2072
+ options: r,
2073
+ view: n,
2074
+ dropActivo: a,
2075
+ limpiezaDias: o,
2076
+ idArrastrado: s
448
2077
  }) {
449
- var p, m, S;
450
- const o = s.toDate(t.date), a = s.dayOfMonth(t.date), h = e.navLinks ? /* @__PURE__ */ d(
2078
+ var S, M, x;
2079
+ const i = m.toDate(e.date), d = m.dayOfMonth(e.date), l = r.navLinks ? /* @__PURE__ */ u(
451
2080
  "a",
452
2081
  {
453
2082
  "data-rsv": "day-number",
454
2083
  "data-nav-link": "true",
455
2084
  role: "link",
456
2085
  tabIndex: 0,
457
- title: R(e.locale).navLinkHint(
458
- new Intl.DateTimeFormat(e.locale, { dateStyle: "long" }).format(o)
2086
+ title: V(r.locale).navLinkHint(
2087
+ new Intl.DateTimeFormat(r.locale, { dateStyle: "long" }).format(i)
459
2088
  ),
460
- onClick: (i) => {
461
- i.stopPropagation(), st(r, t.date);
2089
+ onClick: (y) => {
2090
+ y.stopPropagation(), ee(t, e.date);
462
2091
  },
463
- children: a
2092
+ children: d
464
2093
  }
465
- ) : /* @__PURE__ */ d("span", { "data-rsv": "day-number", children: a }), u = { date: o, dayNumber: a, isToday: t.isToday, isOther: t.isOther, view: n }, v = L(
466
- (p = e.slots) == null ? void 0 : p.dayCellContent,
467
- u,
468
- h,
469
- e.hostBridge
470
- ), [c, l] = N(!1), f = s.toISOString(t.date), b = $(!1), k = () => {
471
- if (b.current) {
472
- b.current = !1;
2094
+ ) : /* @__PURE__ */ u("span", { "data-rsv": "day-number", children: d }), c = { date: i, dayNumber: d, isToday: e.isToday, isOther: e.isOther, view: n }, p = L(
2095
+ (S = r.slots) == null ? void 0 : S.dayCellContent,
2096
+ c,
2097
+ l,
2098
+ r.hostBridge
2099
+ ), [D, v] = K(!1), g = m.toISOString(e.date), h = F(!1), b = () => {
2100
+ if (h.current) {
2101
+ h.current = !1;
473
2102
  return;
474
2103
  }
475
- r.trigger("dateClick", { date: t.date }), e.selectable && r.select(f, s.toISOString(s.add(t.date, { days: 1 })));
476
- }, w = (i) => {
477
- i.stopPropagation(), l(!0), r.trigger("moreLinkClick", {
478
- date: t.date,
479
- allEvents: [...t.events, ...t.hiddenEvents],
480
- hiddenEvents: t.hiddenEvents
2104
+ t.trigger("dateClick", { date: e.date }), r.selectable && t.select(g, m.toISOString(m.add(e.date, { days: 1 })));
2105
+ }, w = (y) => {
2106
+ y.stopPropagation(), v(!0), t.trigger("moreLinkClick", {
2107
+ date: e.date,
2108
+ allEvents: [...e.events, ...e.hiddenEvents],
2109
+ hiddenEvents: e.hiddenEvents
481
2110
  });
482
2111
  };
483
- return /* @__PURE__ */ g(
2112
+ return /* @__PURE__ */ k(
484
2113
  "div",
485
2114
  {
486
2115
  "data-rsv": "day",
487
2116
  role: "gridcell",
488
- "data-date": f,
489
- "data-today": String(t.isToday),
490
- "data-other": String(t.isOther),
491
- "data-weekend": String(t.isWeekend),
492
- "data-business": String(t.isBusiness),
493
- "data-selected": String(t.isSelected),
494
- class: F((m = e.classNames) == null ? void 0 : m.day),
495
- ref: (i) => {
496
- var D;
497
- return A(i, (D = e.hooks) == null ? void 0 : D.dayCellDidMount, () => u);
2117
+ "data-date": g,
2118
+ "data-rsv-drop": a ? "true" : void 0,
2119
+ "data-today": String(e.isToday),
2120
+ "data-other": String(e.isOther),
2121
+ "data-weekend": String(e.isWeekend),
2122
+ "data-business": String(e.isBusiness),
2123
+ "data-selected": String(e.isSelected),
2124
+ class: N((M = r.classNames) == null ? void 0 : M.day),
2125
+ ref: (y) => {
2126
+ var f;
2127
+ W(y, (f = r.hooks) == null ? void 0 : f.dayCellDidMount, () => c), !(!y || o.current.has(y)) && o.current.set(y, zr(y));
498
2128
  },
499
- onClick: k,
500
- onPointerDown: e.selectable ? (i) => Bt(i, {
501
- api: r,
502
- startDate: f,
2129
+ onClick: b,
2130
+ onPointerDown: r.selectable ? (y) => Xe(y, {
2131
+ api: t,
2132
+ startDate: g,
503
2133
  onRangeSelect: () => {
504
- b.current = !0;
2134
+ h.current = !0;
505
2135
  }
506
2136
  }) : void 0,
507
2137
  children: [
508
- v,
509
- t.events.filter((i) => i.display !== "none").map((i) => /* @__PURE__ */ d(
510
- vt,
2138
+ p,
2139
+ e.events.filter((y) => y.display !== "none").map((y) => /* @__PURE__ */ u(
2140
+ Se,
511
2141
  {
512
- api: r,
513
- event: i,
514
- options: e,
2142
+ api: t,
2143
+ event: y,
2144
+ options: r,
515
2145
  view: n,
516
- sourceDate: f
2146
+ arrastrandose: s === y.id
517
2147
  },
518
- i.id
2148
+ y.id
519
2149
  )),
520
- t.moreCount > 0 && /* @__PURE__ */ g("div", { "data-rsv": "more-anchor", children: [
521
- /* @__PURE__ */ d("button", { type: "button", "data-rsv": "more-link", onClick: w, children: L(
522
- (S = e.slots) == null ? void 0 : S.moreLinkContent,
2150
+ e.moreCount > 0 && /* @__PURE__ */ k("div", { "data-rsv": "more-anchor", children: [
2151
+ /* @__PURE__ */ u("button", { type: "button", "data-rsv": "more-link", onClick: w, children: L(
2152
+ (x = r.slots) == null ? void 0 : x.moreLinkContent,
523
2153
  {
524
- date: o,
525
- moreCount: t.moreCount,
526
- allEvents: [...t.events, ...t.hiddenEvents],
527
- hiddenEvents: t.hiddenEvents,
2154
+ date: i,
2155
+ moreCount: e.moreCount,
2156
+ allEvents: [...e.events, ...e.hiddenEvents],
2157
+ hiddenEvents: e.hiddenEvents,
528
2158
  view: n
529
2159
  },
530
- R(e.locale).more(t.moreCount),
531
- e.hostBridge
2160
+ V(r.locale).more(e.moreCount),
2161
+ r.hostBridge
532
2162
  ) }),
533
- c && /* @__PURE__ */ d(
534
- jt,
2163
+ D && /* @__PURE__ */ u(
2164
+ _r,
535
2165
  {
536
- api: r,
537
- cell: t,
538
- options: e,
2166
+ api: t,
2167
+ cell: e,
2168
+ options: r,
539
2169
  view: n,
540
- onClose: () => l(!1)
2170
+ onClose: () => v(!1)
541
2171
  }
542
2172
  )
543
2173
  ] })
@@ -545,463 +2175,502 @@ function _t({
545
2175
  }
546
2176
  );
547
2177
  }
548
- function jt({
549
- api: r,
550
- cell: t,
551
- options: e,
2178
+ function _r({
2179
+ api: t,
2180
+ cell: e,
2181
+ options: r,
552
2182
  view: n,
553
- onClose: o
2183
+ onClose: a
554
2184
  }) {
555
- const a = $(null), h = new Intl.DateTimeFormat(e.locale ?? "en", {
2185
+ const o = F(null), s = new Intl.DateTimeFormat(r.locale ?? "en", {
556
2186
  weekday: "long",
557
2187
  day: "numeric",
558
2188
  month: "long"
559
- }), u = [...t.events, ...t.hiddenEvents].filter((v) => v.display !== "none");
560
- return H(() => {
561
- const v = (l) => {
562
- a.current && !a.current.contains(l.target) && o();
563
- }, c = (l) => {
564
- l.key === "Escape" && o();
2189
+ }), i = [...e.events, ...e.hiddenEvents].filter((d) => d.display !== "none");
2190
+ return R(() => {
2191
+ const d = (c) => {
2192
+ o.current && !o.current.contains(c.target) && a();
2193
+ }, l = (c) => {
2194
+ c.key === "Escape" && a();
565
2195
  };
566
- return document.addEventListener("mousedown", v), document.addEventListener("keydown", c), () => {
567
- document.removeEventListener("mousedown", v), document.removeEventListener("keydown", c);
2196
+ return document.addEventListener("mousedown", d), document.addEventListener("keydown", l), () => {
2197
+ document.removeEventListener("mousedown", d), document.removeEventListener("keydown", l);
568
2198
  };
569
- }, [o]), /* @__PURE__ */ g("div", { "data-rsv": "more-popover", role: "dialog", ref: a, onClick: (v) => v.stopPropagation(), children: [
570
- /* @__PURE__ */ g("div", { "data-rsv": "more-popover-header", children: [
571
- /* @__PURE__ */ d("span", { "data-rsv": "more-popover-title", children: h.format(s.toDate(t.date)) }),
572
- /* @__PURE__ */ d("button", { type: "button", "data-rsv": "more-popover-close", "aria-label": "✕", onClick: o, children: "✕" })
2199
+ }, [a]), /* @__PURE__ */ k("div", { "data-rsv": "more-popover", role: "dialog", ref: o, onClick: (d) => d.stopPropagation(), children: [
2200
+ /* @__PURE__ */ k("div", { "data-rsv": "more-popover-header", children: [
2201
+ /* @__PURE__ */ u("span", { "data-rsv": "more-popover-title", children: s.format(m.toDate(e.date)) }),
2202
+ /* @__PURE__ */ u("button", { type: "button", "data-rsv": "more-popover-close", "aria-label": "✕", onClick: a, children: "✕" })
573
2203
  ] }),
574
- /* @__PURE__ */ d("div", { "data-rsv": "more-popover-body", children: u.map((v) => /* @__PURE__ */ d(
575
- vt,
2204
+ /* @__PURE__ */ u("div", { "data-rsv": "more-popover-body", children: i.map((d) => /* @__PURE__ */ u(
2205
+ Se,
576
2206
  {
577
- api: r,
578
- event: v,
579
- options: e,
2207
+ api: t,
2208
+ event: d,
2209
+ options: r,
580
2210
  view: n,
581
- sourceDate: s.toISOString(t.date)
2211
+ arrastrandose: !1
582
2212
  },
583
- v.id
2213
+ d.id
584
2214
  )) })
585
2215
  ] });
586
2216
  }
587
- function vt({
588
- api: r,
589
- event: t,
590
- options: e,
2217
+ function Se({
2218
+ api: t,
2219
+ event: e,
2220
+ options: r,
591
2221
  view: n,
592
- sourceDate: o
2222
+ arrastrandose: a
593
2223
  }) {
594
- var b, k;
595
- const a = e.editable === !0 && t.editable !== !1, h = r.selectedEventIds.value.has(t.id), u = $(!1), v = X(e.locale ?? "en", e.eventTimeFormat), c = t.allDay ? "" : v ? v(s.toDate(t.start)) : s.format(t.start, "HH:mm"), l = { event: t, isAllDay: t.allDay, timeText: c, view: n }, f = L(
596
- (b = e.slots) == null ? void 0 : b.eventContent,
597
- l,
598
- /* @__PURE__ */ g("span", { "data-rsv": "event-title", children: [
599
- c ? `${c} ` : "",
600
- t.title
2224
+ var h, b;
2225
+ const o = r.editable === !0 && e.editable !== !1, s = o && r.eventDraggable === !0, i = F(null), d = F(null);
2226
+ R(() => () => {
2227
+ var w;
2228
+ return (w = i.current) == null ? void 0 : w.call(i);
2229
+ }, []);
2230
+ const l = t.selectedEventIds.value.has(e.id), c = F(!1), p = ct(r.locale ?? "en", r.eventTimeFormat), D = e.allDay ? "" : p ? p(m.toDate(e.start)) : m.format(e.start, "HH:mm"), v = { event: e, isAllDay: e.allDay, timeText: D, view: n }, g = L(
2231
+ (h = r.slots) == null ? void 0 : h.eventContent,
2232
+ v,
2233
+ /* @__PURE__ */ k("span", { "data-rsv": "event-title", children: [
2234
+ D ? `${D} ` : "",
2235
+ e.title
601
2236
  ] }),
602
- e.hostBridge
2237
+ r.hostBridge
603
2238
  );
604
- return /* @__PURE__ */ d(
2239
+ return /* @__PURE__ */ u(
605
2240
  "div",
606
2241
  {
607
2242
  "data-rsv": "event",
608
2243
  role: "button",
609
2244
  tabIndex: 0,
610
- class: F((k = e.classNames) == null ? void 0 : k.event, ...t.classNames),
611
- "data-all-day": String(t.allDay),
612
- "data-display": t.display,
613
- "data-event-id": t.id,
614
- "data-editable": String(a),
615
- "data-rsv-selected": String(h),
2245
+ class: N((b = r.classNames) == null ? void 0 : b.event, ...e.classNames),
2246
+ "data-all-day": String(e.allDay),
2247
+ "data-display": e.display,
2248
+ "data-event-id": e.id,
2249
+ "data-editable": String(o),
2250
+ "data-rsv-selected": String(l),
2251
+ "data-rsv-dragging": a ? "true" : void 0,
616
2252
  ref: (w) => {
617
- var p;
618
- return A(w, (p = e.hooks) == null ? void 0 : p.eventDidMount, () => l);
2253
+ var S, M;
2254
+ W(w, (S = r.hooks) == null ? void 0 : S.eventDidMount, () => v), w !== d.current && ((M = i.current) == null || M.call(i), d.current = w, i.current = w ? he(w, e, s) : null);
619
2255
  },
620
- style: `--rsv-event-bg:${t.backgroundColor};--rsv-event-fg:${t.textColor};--rsv-event-border:${t.borderColor}`,
2256
+ style: `--rsv-event-bg:${e.backgroundColor};--rsv-event-fg:${e.textColor};--rsv-event-border:${e.borderColor}`,
621
2257
  onClick: (w) => {
622
- if (w.stopPropagation(), u.current) {
623
- u.current = !1;
2258
+ if (w.stopPropagation(), c.current) {
2259
+ c.current = !1;
624
2260
  return;
625
2261
  }
626
2262
  if (w.ctrlKey || w.metaKey) {
627
- r.toggleEventSelection(t.id);
2263
+ t.toggleEventSelection(e.id);
628
2264
  return;
629
2265
  }
630
- r.trigger("eventClick", { event: t, el: w.currentTarget }), t.url && window.open(t.url, "_self");
2266
+ t.trigger("eventClick", { event: e, el: w.currentTarget }), e.url && window.open(e.url, "_self");
631
2267
  },
632
- onPointerDown: a ? (w) => Gt(w, {
633
- api: r,
634
- event: t,
635
- sourceDate: o,
636
- onMoved: () => {
637
- u.current = !0;
638
- }
639
- }) : void 0,
640
- onKeyDown: a ? (w) => lt(w, {
641
- api: r,
642
- event: t,
2268
+ onKeyDown: o ? (w) => re(w, {
2269
+ api: t,
2270
+ event: e,
643
2271
  kind: "dayGrid",
644
- shortcuts: e.keyboardShortcuts
2272
+ shortcuts: r.keyboardShortcuts
645
2273
  }) : void 0,
646
- children: f
2274
+ children: g
647
2275
  }
648
2276
  );
649
2277
  }
650
- const j = 40, it = 16, Kt = {
2278
+ const it = 40, Qt = 16, Zr = {
651
2279
  update() {
652
2280
  },
653
2281
  getScrolled: () => 0,
654
2282
  stop() {
655
2283
  }
656
2284
  };
657
- function mt(r) {
658
- if (!r) return Kt;
659
- let t = 0, e = 0, n = 0;
660
- const o = () => {
661
- const a = r.getBoundingClientRect();
662
- let h = 0;
663
- if (t < a.top + j ? h = -it * (1 - Math.max(0, t - a.top) / j) : t > a.bottom - j && (h = it * (1 - Math.max(0, a.bottom - t) / j)), h !== 0) {
664
- const u = r.scrollTop;
665
- r.scrollTop += h, e += r.scrollTop - u;
2285
+ function Oe(t) {
2286
+ if (!t) return Zr;
2287
+ let e = 0, r = 0, n = 0;
2288
+ const a = () => {
2289
+ const o = t.getBoundingClientRect();
2290
+ let s = 0;
2291
+ if (e < o.top + it ? s = -Qt * (1 - Math.max(0, e - o.top) / it) : e > o.bottom - it && (s = Qt * (1 - Math.max(0, o.bottom - e) / it)), s !== 0) {
2292
+ const i = t.scrollTop;
2293
+ t.scrollTop += s, r += t.scrollTop - i;
666
2294
  }
667
- n = requestAnimationFrame(o);
2295
+ n = requestAnimationFrame(a);
668
2296
  };
669
- return n = requestAnimationFrame(o), {
670
- update(a) {
671
- t = a;
2297
+ return n = requestAnimationFrame(a), {
2298
+ update(o) {
2299
+ e = o;
672
2300
  },
673
- getScrolled: () => e,
2301
+ getScrolled: () => r,
674
2302
  stop() {
675
2303
  cancelAnimationFrame(n);
676
2304
  }
677
2305
  };
678
2306
  }
679
- function ht(r) {
680
- return r.closest('[data-rsv="tg-body"]');
681
- }
682
- function q(r, t) {
683
- r.preventDefault(), r.stopPropagation();
684
- const { api: e, event: n, model: o, columnEl: a, snap: h = "00:15", edge: u } = t, v = a.getBoundingClientRect(), c = o.maxMinutes - o.minMinutes, l = v.height === 0 ? 0 : v.height / c, f = r.clientY, b = mt(ht(a));
685
- b.update(r.clientY);
686
- const k = (p) => {
687
- b.update(p.clientY);
688
- }, w = (p) => {
689
- document.removeEventListener("pointermove", k), document.removeEventListener("pointerup", w), b.stop();
690
- const m = wt(p.clientY - f + b.getScrolled(), l, h);
691
- if (m === 0) return;
692
- const S = u ? kt(n.start, n.end, u, m, s) : J(n.start, n.end, m, s);
693
- if (e.moveEvent(n.id, S.start, S.end)) {
694
- const i = e.getEventById(n.id);
695
- i && e.trigger(u ? "eventResize" : "eventDrop", { event: i });
2307
+ function Te(t) {
2308
+ return t.closest('[data-rsv="tg-body"]');
2309
+ }
2310
+ function te(t, e) {
2311
+ t.preventDefault(), t.stopPropagation();
2312
+ const { api: r, event: n, model: a, columnEl: o, snap: s = "00:15", edge: i, onPreview: d } = e, l = o.getBoundingClientRect(), c = a.maxMinutes - a.minMinutes, p = l.height === 0 ? 0 : l.height / c, D = t.clientY, v = Oe(Te(o));
2313
+ v.update(t.clientY);
2314
+ const g = X(s) || 15, h = (S) => {
2315
+ const M = m.toDate(S);
2316
+ return M.getHours() * 60 + M.getMinutes();
2317
+ }, b = (S) => {
2318
+ if (v.update(S.clientY), !d) return;
2319
+ const M = It(S.clientY - D + v.getScrolled(), p, s), x = i ? $t(n.start, n.end, i, M, m) : ht(n.start, n.end, M, m), y = h(x.start), f = x.end ? h(x.end) : y + g;
2320
+ d({ startMin: Math.min(y, f), endMin: Math.max(y, f) });
2321
+ }, w = (S) => {
2322
+ document.removeEventListener("pointermove", b), document.removeEventListener("pointerup", w), v.stop(), d == null || d(null);
2323
+ const M = It(S.clientY - D + v.getScrolled(), p, s);
2324
+ if (M === 0) return;
2325
+ const x = i ? $t(n.start, n.end, i, M, m) : ht(n.start, n.end, M, m);
2326
+ if (r.moveEvent(n.id, x.start, x.end)) {
2327
+ const y = r.getEventById(n.id);
2328
+ y && r.trigger(i ? "eventResize" : "eventDrop", { event: y });
696
2329
  }
697
2330
  };
698
- document.addEventListener("pointermove", k), document.addEventListener("pointerup", w);
699
- }
700
- function Ut(r, t) {
701
- if (r.target.closest('[data-rsv="event"]')) return;
702
- const { api: e, date: n, model: o, columnEl: a, snap: h = "00:15" } = t, u = o.maxMinutes - o.minMinutes, v = K(h) || 15, c = (m) => {
703
- const S = a.getBoundingClientRect(), i = S.height === 0 ? 0 : S.height / u, D = o.minMinutes + (i === 0 ? 0 : (m - S.top) / i), C = Math.max(o.minMinutes, Math.min(o.maxMinutes, D));
704
- return Math.round(C / v) * v;
705
- }, l = c(r.clientY);
706
- let f = l, b = !1;
707
- const k = mt(ht(a));
708
- k.update(r.clientY);
709
- const w = (m) => {
710
- var i;
711
- k.update(m.clientY);
712
- const S = c(m.clientY);
713
- S !== l && (b = !0), f = S, b && ((i = t.onPreview) == null || i.call(t, {
714
- startMin: Math.min(l, f),
715
- endMin: Math.max(l, f)
2331
+ document.addEventListener("pointermove", b), document.addEventListener("pointerup", w);
2332
+ }
2333
+ function Jr(t, e) {
2334
+ if (t.target.closest('[data-rsv="event"]')) return;
2335
+ const { api: r, date: n, model: a, columnEl: o, snap: s = "00:15" } = e, i = a.maxMinutes - a.minMinutes, d = X(s) || 15, l = (b) => {
2336
+ const w = o.getBoundingClientRect(), S = w.height === 0 ? 0 : w.height / i, M = a.minMinutes + (S === 0 ? 0 : (b - w.top) / S), x = Math.max(a.minMinutes, Math.min(a.maxMinutes, M));
2337
+ return Math.round(x / d) * d;
2338
+ }, c = l(t.clientY);
2339
+ let p = c, D = !1;
2340
+ const v = Oe(Te(o));
2341
+ v.update(t.clientY);
2342
+ const g = (b) => {
2343
+ var S;
2344
+ v.update(b.clientY);
2345
+ const w = l(b.clientY);
2346
+ w !== c && (D = !0), p = w, D && ((S = e.onPreview) == null || S.call(e, {
2347
+ startMin: Math.min(c, p),
2348
+ endMin: Math.max(c, p)
716
2349
  }));
717
- }, p = () => {
718
- var D;
719
- if (document.removeEventListener("pointermove", w), document.removeEventListener("pointerup", p), k.stop(), (D = t.onPreview) == null || D.call(t, null), !b) return;
720
- const m = Math.min(l, f), S = Math.max(l, f), i = s.startOf(n, "day");
721
- e.select(
722
- s.toISOString(s.add(i, { minutes: m })),
723
- s.toISOString(s.add(i, { minutes: S }))
2350
+ }, h = () => {
2351
+ var M;
2352
+ if (document.removeEventListener("pointermove", g), document.removeEventListener("pointerup", h), v.stop(), (M = e.onPreview) == null || M.call(e, null), !D) return;
2353
+ const b = Math.min(c, p), w = Math.max(c, p), S = m.startOf(n, "day");
2354
+ r.select(
2355
+ m.toISOString(m.add(S, { minutes: b })),
2356
+ m.toISOString(m.add(S, { minutes: w }))
724
2357
  );
725
2358
  };
726
- document.addEventListener("pointermove", w), document.addEventListener("pointerup", p);
2359
+ document.addEventListener("pointermove", g), document.addEventListener("pointerup", h);
727
2360
  }
728
- function Wt({ api: r, model: t, options: e }) {
729
- const n = e.locale ?? "en", o = { type: r.getView().type }, a = W(n, e.dayHeaderFormat, {
2361
+ function Qr({ api: t, model: e, options: r }) {
2362
+ const n = r.locale ?? "en", a = { type: t.getView().type }, o = st(n, r.dayHeaderFormat, {
730
2363
  weekday: "short",
731
2364
  day: "numeric"
732
- }), h = X(n, e.slotLabelFormat), u = e.allDaySlot !== !1, v = `calc(var(--spacing-rsv-slot, 2.5rem) * ${t.slots.length})`, c = t.maxMinutes - t.minMinutes, l = K(e.snapDuration ?? e.slotDuration ?? "00:15") || 15, f = $(null), b = $(t);
733
- b.current = t;
734
- const [k, w] = N(null);
735
- H(() => {
736
- const i = f.current;
737
- if (!i) return;
738
- const D = {
2365
+ }), s = ct(n, r.slotLabelFormat), i = r.allDaySlot !== !1, d = `calc(var(--spacing-rsv-slot, 2.5rem) * ${e.slots.length})`, l = e.maxMinutes - e.minMinutes, c = X(r.snapDuration ?? r.slotDuration ?? "00:15") || 15, p = F(null), D = F(e);
2366
+ D.current = e;
2367
+ const [v, g] = K(null), [h, b] = K(null), w = F(null), S = F(/* @__PURE__ */ new Map());
2368
+ R(() => {
2369
+ const f = S.current;
2370
+ return () => {
2371
+ for (const T of f.values()) T();
2372
+ f.clear();
2373
+ };
2374
+ }, []), R(
2375
+ () => Gr({
2376
+ api: t,
2377
+ getModel: () => D.current,
2378
+ snap: r.snapDuration ?? r.slotDuration,
2379
+ onPreview: (f) => b(f ? { id: w.current ?? "", preview: f } : null),
2380
+ onDragging: (f) => {
2381
+ w.current = f, f === null && b(null);
2382
+ }
2383
+ }),
2384
+ [t, r.snapDuration, r.slotDuration]
2385
+ ), R(() => {
2386
+ const f = p.current;
2387
+ if (!f) return;
2388
+ const T = {
739
2389
  scrollToTime(C) {
740
- const M = b.current, E = M.maxMinutes - M.minMinutes, x = i.scrollHeight;
741
- if (E <= 0 || x <= 0) return;
742
- const P = (Math.max(M.minMinutes, Math.min(M.maxMinutes, K(C))) - M.minMinutes) / E * x;
743
- i.scrollTop = Math.max(0, Math.min(P, x - i.clientHeight));
2390
+ const E = D.current, P = E.maxMinutes - E.minMinutes, I = f.scrollHeight;
2391
+ if (P <= 0 || I <= 0) return;
2392
+ const j = (Math.max(E.minMinutes, Math.min(E.maxMinutes, X(C))) - E.minMinutes) / P * I;
2393
+ f.scrollTop = Math.max(0, Math.min(j, I - f.clientHeight));
744
2394
  },
745
2395
  getScrollTime() {
746
- const C = b.current, M = C.maxMinutes - C.minMinutes, E = i.scrollHeight;
747
- return M <= 0 || E <= 0 ? null : At(C.minMinutes + i.scrollTop / E * M);
2396
+ const C = D.current, E = C.maxMinutes - C.minMinutes, P = f.scrollHeight;
2397
+ return E <= 0 || P <= 0 ? null : We(C.minMinutes + f.scrollTop / P * E);
748
2398
  }
749
2399
  };
750
- return r.setViewAdapter(D), () => r.setViewAdapter(null);
751
- }, [r]);
752
- const p = e.scrollTime;
753
- H(() => {
754
- if (!p) return;
755
- let i = 0;
756
- const D = requestAnimationFrame(() => {
757
- i = requestAnimationFrame(() => r.scrollToTime(p));
2400
+ return t.setViewAdapter(T), () => t.setViewAdapter(null);
2401
+ }, [t]);
2402
+ const M = r.scrollTime;
2403
+ R(() => {
2404
+ if (!M) return;
2405
+ let f = 0;
2406
+ const T = requestAnimationFrame(() => {
2407
+ f = requestAnimationFrame(() => t.scrollToTime(M));
758
2408
  });
759
2409
  return () => {
760
- cancelAnimationFrame(D), cancelAnimationFrame(i);
2410
+ cancelAnimationFrame(T), cancelAnimationFrame(f);
761
2411
  };
762
- }, [r]);
763
- const m = (i, D) => {
764
- const C = i.getBoundingClientRect();
765
- if (C.height === 0 || c <= 0) return t.minMinutes;
766
- const M = (D - C.top) / C.height * c, E = Math.floor(Math.max(0, Math.min(c, M)) / l) * l;
767
- return t.minMinutes + E;
768
- }, S = t.days[0];
769
- return /* @__PURE__ */ g("div", { "data-rsv": "timegrid", style: `--rsv-tg-days:${t.days.length}`, children: [
770
- /* @__PURE__ */ g("div", { "data-rsv": "tg-header", role: "row", children: [
771
- /* @__PURE__ */ d("div", { "data-rsv": "tg-axis-corner" }),
772
- t.days.map((i) => {
773
- var E, x;
774
- const D = s.toDate(i.date), C = a ? a(D) : "", M = {
775
- date: D,
2412
+ }, [t]);
2413
+ const x = (f, T) => {
2414
+ const C = f.getBoundingClientRect();
2415
+ if (C.height === 0 || l <= 0) return e.minMinutes;
2416
+ const E = (T - C.top) / C.height * l, P = Math.floor(Math.max(0, Math.min(l, E)) / c) * c;
2417
+ return e.minMinutes + P;
2418
+ }, y = e.days[0];
2419
+ return /* @__PURE__ */ k("div", { "data-rsv": "timegrid", style: `--rsv-tg-days:${e.days.length}`, children: [
2420
+ /* @__PURE__ */ k("div", { "data-rsv": "tg-header", role: "row", children: [
2421
+ /* @__PURE__ */ u("div", { "data-rsv": "tg-axis-corner" }),
2422
+ e.days.map((f) => {
2423
+ var P, I;
2424
+ const T = m.toDate(f.date), C = o ? o(T) : "", E = {
2425
+ date: T,
776
2426
  text: C,
777
- dayOfWeek: s.dayOfWeek(i.date),
778
- dayNumber: s.dayOfMonth(i.date),
779
- isToday: i.isToday,
780
- view: o
2427
+ dayOfWeek: m.dayOfWeek(f.date),
2428
+ dayNumber: m.dayOfMonth(f.date),
2429
+ isToday: f.isToday,
2430
+ view: a
781
2431
  };
782
- return /* @__PURE__ */ d(
2432
+ return /* @__PURE__ */ u(
783
2433
  "div",
784
2434
  {
785
2435
  "data-rsv": "tg-col-header",
786
2436
  role: "columnheader",
787
- "data-today": String(i.isToday),
788
- "data-date": s.toISOString(i.date),
789
- "data-nav-link": e.navLinks ? "true" : void 0,
790
- class: F((E = e.classNames) == null ? void 0 : E.dayHeader),
791
- ref: (I) => {
792
- var P;
793
- return A(I, (P = e.hooks) == null ? void 0 : P.dayHeaderDidMount, () => M);
2437
+ "data-today": String(f.isToday),
2438
+ "data-date": m.toISOString(f.date),
2439
+ "data-nav-link": r.navLinks ? "true" : void 0,
2440
+ class: N((P = r.classNames) == null ? void 0 : P.dayHeader),
2441
+ ref: ($) => {
2442
+ var j;
2443
+ return W($, (j = r.hooks) == null ? void 0 : j.dayHeaderDidMount, () => E);
794
2444
  },
795
- onClick: e.navLinks ? () => st(r, i.date) : void 0,
796
- children: L((x = e.slots) == null ? void 0 : x.dayHeaderContent, M, C, e.hostBridge)
2445
+ onClick: r.navLinks ? () => ee(t, f.date) : void 0,
2446
+ children: L((I = r.slots) == null ? void 0 : I.dayHeaderContent, E, C, r.hostBridge)
797
2447
  },
798
- s.toISOString(i.date)
2448
+ m.toISOString(f.date)
799
2449
  );
800
2450
  })
801
2451
  ] }),
802
- u && /* @__PURE__ */ g("div", { "data-rsv": "tg-allday", role: "row", children: [
803
- /* @__PURE__ */ d("div", { "data-rsv": "tg-axis-label", children: R(e.locale).allDay }),
804
- t.days.map((i) => /* @__PURE__ */ d(
2452
+ i && /* @__PURE__ */ k("div", { "data-rsv": "tg-allday", role: "row", children: [
2453
+ /* @__PURE__ */ u("div", { "data-rsv": "tg-axis-label", children: V(r.locale).allDay }),
2454
+ e.days.map((f) => /* @__PURE__ */ u(
805
2455
  "div",
806
2456
  {
807
2457
  "data-rsv": "tg-allday-cell",
808
- onClick: () => r.trigger("dateClick", { date: i.date, allDay: !0 }),
809
- children: i.allDayEvents.filter((D) => D.display !== "none").map((D) => {
810
- var C, M;
811
- return /* @__PURE__ */ d(
2458
+ onClick: () => t.trigger("dateClick", { date: f.date, allDay: !0 }),
2459
+ children: f.allDayEvents.filter((T) => T.display !== "none").map((T) => {
2460
+ var C, E;
2461
+ return /* @__PURE__ */ u(
812
2462
  "div",
813
2463
  {
814
2464
  "data-rsv": "event",
815
2465
  "data-all-day": "true",
816
- "data-event-id": D.id,
817
- class: F((C = e.classNames) == null ? void 0 : C.event, ...D.classNames),
818
- "data-display": D.display,
819
- style: `--rsv-event-bg:${D.backgroundColor};--rsv-event-fg:${D.textColor};--rsv-event-border:${D.borderColor}`,
820
- onClick: (E) => {
821
- E.stopPropagation(), r.trigger("eventClick", { event: D, el: E.currentTarget }), D.url && window.open(D.url, "_self");
2466
+ "data-event-id": T.id,
2467
+ class: N((C = r.classNames) == null ? void 0 : C.event, ...T.classNames),
2468
+ "data-display": T.display,
2469
+ style: `--rsv-event-bg:${T.backgroundColor};--rsv-event-fg:${T.textColor};--rsv-event-border:${T.borderColor}`,
2470
+ onClick: (P) => {
2471
+ P.stopPropagation(), t.trigger("eventClick", { event: T, el: P.currentTarget }), T.url && window.open(T.url, "_self");
822
2472
  },
823
2473
  children: L(
824
- (M = e.slots) == null ? void 0 : M.eventContent,
825
- { event: D, isAllDay: !0, timeText: "", view: o },
826
- D.title,
827
- e.hostBridge
2474
+ (E = r.slots) == null ? void 0 : E.eventContent,
2475
+ { event: T, isAllDay: !0, timeText: "", view: a },
2476
+ T.title,
2477
+ r.hostBridge
828
2478
  )
829
2479
  },
830
- D.id
2480
+ T.id
831
2481
  );
832
2482
  })
833
2483
  },
834
- s.toISOString(i.date)
2484
+ m.toISOString(f.date)
835
2485
  ))
836
2486
  ] }),
837
- /* @__PURE__ */ g("div", { "data-rsv": "tg-body", ref: f, children: [
838
- /* @__PURE__ */ d("div", { "data-rsv": "tg-axis", style: `height:${v}`, children: t.slots.map((i) => {
839
- var E, x;
840
- const D = t.minMinutes + i.offsetMin;
2487
+ /* @__PURE__ */ k("div", { "data-rsv": "tg-body", ref: p, children: [
2488
+ /* @__PURE__ */ u("div", { "data-rsv": "tg-axis", style: `height:${d}`, children: e.slots.map((f) => {
2489
+ var P, I;
2490
+ const T = e.minMinutes + f.offsetMin;
841
2491
  let C = "";
842
- i.isMajor && (C = h && S ? h(s.toDate(s.add(s.startOf(S.date, "day"), { minutes: D }))) : i.label || It(D));
843
- const M = { text: C, minutes: D, isMajor: i.isMajor, view: o };
844
- return /* @__PURE__ */ d("div", { "data-rsv": "tg-slot", "data-major": String(i.isMajor), children: /* @__PURE__ */ d(
2492
+ f.isMajor && (C = s && y ? s(m.toDate(m.add(m.startOf(y.date, "day"), { minutes: T }))) : f.label || Ye(T));
2493
+ const E = { text: C, minutes: T, isMajor: f.isMajor, view: a };
2494
+ return /* @__PURE__ */ u("div", { "data-rsv": "tg-slot", "data-major": String(f.isMajor), children: /* @__PURE__ */ u(
845
2495
  "span",
846
2496
  {
847
2497
  "data-rsv": "tg-slot-label",
848
- class: F((E = e.classNames) == null ? void 0 : E.slotLabel),
849
- ref: (I) => {
850
- var P;
851
- return A(I, (P = e.hooks) == null ? void 0 : P.slotLabelDidMount, () => M);
2498
+ class: N((P = r.classNames) == null ? void 0 : P.slotLabel),
2499
+ ref: ($) => {
2500
+ var j;
2501
+ return W($, (j = r.hooks) == null ? void 0 : j.slotLabelDidMount, () => E);
852
2502
  },
853
- children: L((x = e.slots) == null ? void 0 : x.slotLabelContent, M, C, e.hostBridge)
2503
+ children: L((I = r.slots) == null ? void 0 : I.slotLabelContent, E, C, r.hostBridge)
854
2504
  }
855
- ) }, i.offsetMin);
2505
+ ) }, f.offsetMin);
856
2506
  }) }),
857
- t.days.map((i, D) => {
2507
+ e.days.map((f, T) => {
858
2508
  var C;
859
- return /* @__PURE__ */ g(
2509
+ return /* @__PURE__ */ k(
860
2510
  "div",
861
2511
  {
862
2512
  "data-rsv": "tg-col",
863
- "data-today": String(i.isToday),
864
- "data-date": s.toISOString(i.date),
865
- style: `height:${v}`,
866
- onClick: (M) => {
867
- const E = m(M.currentTarget, M.clientY);
868
- r.trigger("dateClick", {
869
- date: s.add(s.startOf(i.date, "day"), { minutes: E }),
2513
+ "data-today": String(f.isToday),
2514
+ "data-date": m.toISOString(f.date),
2515
+ "data-rsv-day-index": String(T),
2516
+ ref: (E) => {
2517
+ !E || S.current.has(E) || S.current.set(E, Vr(E));
2518
+ },
2519
+ style: `height:${d}`,
2520
+ onClick: (E) => {
2521
+ if (ye()) return;
2522
+ const P = x(E.currentTarget, E.clientY);
2523
+ t.trigger("dateClick", {
2524
+ date: m.add(m.startOf(f.date, "day"), { minutes: P }),
870
2525
  allDay: !1
871
2526
  });
872
2527
  },
873
- onPointerDown: e.selectable ? (M) => Ut(M, {
874
- api: r,
875
- date: i.date,
876
- model: t,
877
- columnEl: M.currentTarget,
878
- snap: e.snapDuration ?? e.slotDuration,
879
- onPreview: e.selectMirror ? (E) => w(
880
- E ? { dayIndex: D, startMin: E.startMin, endMin: E.endMin } : null
2528
+ onPointerDown: r.selectable ? (E) => Jr(E, {
2529
+ api: t,
2530
+ date: f.date,
2531
+ model: e,
2532
+ columnEl: E.currentTarget,
2533
+ snap: r.snapDuration ?? r.slotDuration,
2534
+ onPreview: r.selectMirror ? (P) => g(
2535
+ P ? { dayIndex: T, startMin: P.startMin, endMin: P.endMin } : null
881
2536
  ) : void 0
882
2537
  }) : void 0,
883
2538
  children: [
884
- e.businessHours && !i.businessPct && /* @__PURE__ */ d("div", { "data-rsv": "tg-nonbusiness", style: "top:0;height:100%" }),
885
- i.businessPct && /* @__PURE__ */ g(Ct, { children: [
886
- /* @__PURE__ */ d("div", { "data-rsv": "tg-nonbusiness", style: `top:0;height:${i.businessPct.topPct}%` }),
887
- /* @__PURE__ */ d(
2539
+ r.businessHours && !f.businessPct && /* @__PURE__ */ u("div", { "data-rsv": "tg-nonbusiness", style: "top:0;height:100%" }),
2540
+ f.businessPct && /* @__PURE__ */ k($e, { children: [
2541
+ /* @__PURE__ */ u("div", { "data-rsv": "tg-nonbusiness", style: `top:0;height:${f.businessPct.topPct}%` }),
2542
+ /* @__PURE__ */ u(
888
2543
  "div",
889
2544
  {
890
2545
  "data-rsv": "tg-nonbusiness",
891
- style: `top:${i.businessPct.bottomPct}%;height:${100 - i.businessPct.bottomPct}%`
2546
+ style: `top:${f.businessPct.bottomPct}%;height:${100 - f.businessPct.bottomPct}%`
892
2547
  }
893
2548
  )
894
2549
  ] }),
895
- (k == null ? void 0 : k.dayIndex) === D && c > 0 && /* @__PURE__ */ d(
2550
+ (v == null ? void 0 : v.dayIndex) === T && l > 0 && /* @__PURE__ */ u(
896
2551
  "div",
897
2552
  {
898
2553
  "data-rsv": "select-mirror",
899
- style: `top:${(k.startMin - t.minMinutes) / c * 100}%;height:${(k.endMin - k.startMin) / c * 100}%`
2554
+ style: `top:${(v.startMin - e.minMinutes) / l * 100}%;height:${(v.endMin - v.startMin) / l * 100}%`
900
2555
  }
901
2556
  ),
902
- i.timedSegs.filter((M) => M.event.display !== "none").map((M) => /* @__PURE__ */ d(
903
- Xt,
2557
+ f.timedSegs.filter((E) => E.event.display !== "none").map((E) => /* @__PURE__ */ u(
2558
+ tn,
904
2559
  {
905
- api: r,
906
- seg: M,
907
- model: t,
908
- options: e,
909
- view: o
2560
+ api: t,
2561
+ seg: E,
2562
+ model: e,
2563
+ options: r,
2564
+ view: a,
2565
+ dragging: (h == null ? void 0 : h.id) === E.event.id,
2566
+ onDragPreview: (P) => b(P ? { id: E.event.id, preview: { dayIndex: T, ...P } } : null)
910
2567
  },
911
- M.event.id
2568
+ E.event.id
912
2569
  )),
913
- ((C = t.nowIndicator) == null ? void 0 : C.dayIndex) === D && /* @__PURE__ */ d("div", { "data-rsv": "now-indicator", style: `top:${t.nowIndicator.topPct}%` })
2570
+ (h == null ? void 0 : h.preview.dayIndex) === T && l > 0 && /* @__PURE__ */ u(
2571
+ "div",
2572
+ {
2573
+ "data-rsv": "drag-mirror",
2574
+ style: `top:${(h.preview.startMin - e.minMinutes) / l * 100}%;height:${(h.preview.endMin - h.preview.startMin) / l * 100}%`
2575
+ }
2576
+ ),
2577
+ ((C = e.nowIndicator) == null ? void 0 : C.dayIndex) === T && /* @__PURE__ */ u("div", { "data-rsv": "now-indicator", style: `top:${e.nowIndicator.topPct}%` })
914
2578
  ]
915
2579
  },
916
- s.toISOString(i.date)
2580
+ m.toISOString(f.date)
917
2581
  );
918
2582
  })
919
2583
  ] })
920
2584
  ] });
921
2585
  }
922
- function Xt({
923
- api: r,
924
- seg: t,
925
- model: e,
2586
+ function tn({
2587
+ api: t,
2588
+ seg: e,
2589
+ model: r,
926
2590
  options: n,
927
- view: o
2591
+ view: a,
2592
+ dragging: o,
2593
+ onDragPreview: s
928
2594
  }) {
929
- var w, p;
930
- const { event: a } = t, h = n.editable === !0 && a.editable !== !1, u = r.selectedEventIds.value.has(a.id), v = 100 / t.colCount, c = X(n.locale ?? "en", n.eventTimeFormat), l = c ? c(s.toDate(a.start)) : s.format(a.start, "HH:mm"), f = { event: a, isAllDay: !1, timeText: l, view: o }, b = L(
931
- (w = n.slots) == null ? void 0 : w.eventContent,
932
- f,
933
- /* @__PURE__ */ g("span", { "data-rsv": "event-title", children: [
934
- l,
2595
+ var M, x;
2596
+ const { event: i } = e, d = n.editable === !0 && i.editable !== !1, l = d && n.eventDraggable === !0, c = F(null), p = F(null);
2597
+ R(() => () => {
2598
+ var y;
2599
+ return (y = c.current) == null ? void 0 : y.call(c);
2600
+ }, []);
2601
+ const D = t.selectedEventIds.value.has(i.id), v = 100 / e.colCount, g = ct(n.locale ?? "en", n.eventTimeFormat), h = g ? g(m.toDate(i.start)) : m.format(i.start, "HH:mm"), b = { event: i, isAllDay: !1, timeText: h, view: a }, w = L(
2602
+ (M = n.slots) == null ? void 0 : M.eventContent,
2603
+ b,
2604
+ /* @__PURE__ */ k("span", { "data-rsv": "event-title", children: [
2605
+ h,
935
2606
  " ",
936
- a.title
2607
+ i.title
937
2608
  ] }),
938
2609
  n.hostBridge
939
- ), k = (m) => m.closest('[data-rsv="tg-col"]') ?? m;
940
- return /* @__PURE__ */ g(
2610
+ ), S = (y) => y.closest('[data-rsv="tg-col"]') ?? y;
2611
+ return /* @__PURE__ */ k(
941
2612
  "div",
942
2613
  {
943
2614
  "data-rsv": "event",
944
2615
  "data-all-day": "false",
945
- "data-display": a.display,
946
- "data-event-id": a.id,
947
- "data-rsv-selected": String(u),
948
- class: F((p = n.classNames) == null ? void 0 : p.event, ...a.classNames),
2616
+ "data-display": i.display,
2617
+ "data-event-id": i.id,
2618
+ "data-rsv-selected": String(D),
2619
+ "data-rsv-dragging": o ? "true" : void 0,
2620
+ class: N((x = n.classNames) == null ? void 0 : x.event, ...i.classNames),
949
2621
  role: "button",
950
2622
  tabIndex: 0,
951
- ref: (m) => {
952
- var S;
953
- return A(m, (S = n.hooks) == null ? void 0 : S.eventDidMount, () => f);
2623
+ ref: (y) => {
2624
+ var f, T;
2625
+ W(y, (f = n.hooks) == null ? void 0 : f.eventDidMount, () => b), y !== p.current && ((T = c.current) == null || T.call(c), p.current = y, c.current = y ? he(y, i, l) : null);
954
2626
  },
955
- style: `position:absolute;top:${t.topPct}%;height:${t.heightPct}%;left:${t.col * v}%;width:${v}%;--rsv-event-bg:${a.backgroundColor};--rsv-event-fg:${a.textColor};--rsv-event-border:${a.borderColor}`,
956
- onClick: (m) => {
957
- if (m.stopPropagation(), m.ctrlKey || m.metaKey) {
958
- r.toggleEventSelection(a.id);
959
- return;
2627
+ style: `position:absolute;top:${e.topPct}%;height:${e.heightPct}%;left:${e.col * v}%;width:${v}%;--rsv-event-bg:${i.backgroundColor};--rsv-event-fg:${i.textColor};--rsv-event-border:${i.borderColor}`,
2628
+ onClick: (y) => {
2629
+ if (y.stopPropagation(), !ye()) {
2630
+ if (y.ctrlKey || y.metaKey) {
2631
+ t.toggleEventSelection(i.id);
2632
+ return;
2633
+ }
2634
+ t.trigger("eventClick", { event: i, el: y.currentTarget }), i.url && window.open(i.url, "_self");
960
2635
  }
961
- r.trigger("eventClick", { event: a, el: m.currentTarget }), a.url && window.open(a.url, "_self");
962
2636
  },
963
- onKeyDown: h ? (m) => lt(m, {
964
- api: r,
965
- event: a,
2637
+ onKeyDown: d ? (y) => re(y, {
2638
+ api: t,
2639
+ event: i,
966
2640
  kind: "timeGrid",
967
2641
  snap: n.snapDuration ?? n.slotDuration,
968
2642
  shortcuts: n.keyboardShortcuts
969
2643
  }) : void 0,
970
- onPointerDown: h ? (m) => q(m, {
971
- api: r,
972
- event: a,
973
- model: e,
974
- columnEl: k(m.currentTarget),
975
- snap: n.snapDuration
976
- }) : void 0,
977
2644
  children: [
978
- h && /* @__PURE__ */ d(
2645
+ d && /* @__PURE__ */ u(
979
2646
  "span",
980
2647
  {
981
2648
  "data-rsv": "resize-handle",
982
2649
  "data-edge": "start",
983
- onPointerDown: (m) => q(m, {
984
- api: r,
985
- event: a,
986
- model: e,
987
- columnEl: k(m.currentTarget),
2650
+ onPointerDown: (y) => te(y, {
2651
+ api: t,
2652
+ event: i,
2653
+ model: r,
2654
+ columnEl: S(y.currentTarget),
988
2655
  snap: n.snapDuration,
2656
+ onPreview: s,
989
2657
  edge: "start"
990
2658
  })
991
2659
  }
992
2660
  ),
993
- b,
994
- h && /* @__PURE__ */ d(
2661
+ w,
2662
+ d && /* @__PURE__ */ u(
995
2663
  "span",
996
2664
  {
997
2665
  "data-rsv": "resize-handle",
998
2666
  "data-edge": "end",
999
- onPointerDown: (m) => q(m, {
1000
- api: r,
1001
- event: a,
1002
- model: e,
1003
- columnEl: k(m.currentTarget),
2667
+ onPointerDown: (y) => te(y, {
2668
+ api: t,
2669
+ event: i,
2670
+ model: r,
2671
+ columnEl: S(y.currentTarget),
1004
2672
  snap: n.snapDuration,
2673
+ onPreview: s,
1005
2674
  edge: "end"
1006
2675
  })
1007
2676
  }
@@ -1010,203 +2679,203 @@ function Xt({
1010
2679
  }
1011
2680
  );
1012
2681
  }
1013
- function qt({ api: r, model: t, options: e }) {
1014
- const n = e.locale ?? "en", o = { type: r.getView().type }, a = R(e.locale), h = W(n, e.listDayFormat, {
2682
+ function en({ api: t, model: e, options: r }) {
2683
+ const n = r.locale ?? "en", a = { type: t.getView().type }, o = V(r.locale), s = st(n, r.listDayFormat, {
1015
2684
  weekday: "long",
1016
2685
  day: "numeric",
1017
2686
  month: "long"
1018
- }), u = e.listDaySideFormat ? W(n, e.listDaySideFormat, { month: "short", day: "2-digit" }) : null, v = X(n, e.eventTimeFormat);
1019
- return t.isEmpty ? /* @__PURE__ */ d("div", { "data-rsv": "list", children: /* @__PURE__ */ d("div", { "data-rsv": "list-empty", children: a.noEvents }) }) : /* @__PURE__ */ d("div", { "data-rsv": "list", role: "list", children: t.days.map((c) => /* @__PURE__ */ g("div", { "data-rsv": "list-day", "data-today": String(c.isToday), children: [
1020
- /* @__PURE__ */ g("div", { "data-rsv": "list-day-header", role: "heading", "aria-level": 3, children: [
1021
- /* @__PURE__ */ d("span", { "data-rsv": "list-day-text", children: h ? h(s.toDate(c.date)) : "" }),
1022
- u && /* @__PURE__ */ d("span", { "data-rsv": "list-day-side-text", children: u(s.toDate(c.date)) })
2687
+ }), i = r.listDaySideFormat ? st(n, r.listDaySideFormat, { month: "short", day: "2-digit" }) : null, d = ct(n, r.eventTimeFormat);
2688
+ return e.isEmpty ? /* @__PURE__ */ u("div", { "data-rsv": "list", children: /* @__PURE__ */ u("div", { "data-rsv": "list-empty", children: o.noEvents }) }) : /* @__PURE__ */ u("div", { "data-rsv": "list", role: "list", children: e.days.map((l) => /* @__PURE__ */ k("div", { "data-rsv": "list-day", "data-today": String(l.isToday), children: [
2689
+ /* @__PURE__ */ k("div", { "data-rsv": "list-day-header", role: "heading", "aria-level": 3, children: [
2690
+ /* @__PURE__ */ u("span", { "data-rsv": "list-day-text", children: s ? s(m.toDate(l.date)) : "" }),
2691
+ i && /* @__PURE__ */ u("span", { "data-rsv": "list-day-side-text", children: i(m.toDate(l.date)) })
1023
2692
  ] }),
1024
- c.events.filter((l) => l.display !== "none").map((l) => {
1025
- var k, w;
1026
- const f = l.allDay ? a.allDay : v ? v(s.toDate(l.start)) : s.format(l.start, "HH:mm"), b = { event: l, isAllDay: l.allDay, timeText: f, view: o };
1027
- return /* @__PURE__ */ g(
2693
+ l.events.filter((c) => c.display !== "none").map((c) => {
2694
+ var v, g;
2695
+ const p = c.allDay ? o.allDay : d ? d(m.toDate(c.start)) : m.format(c.start, "HH:mm"), D = { event: c, isAllDay: c.allDay, timeText: p, view: a };
2696
+ return /* @__PURE__ */ k(
1028
2697
  "div",
1029
2698
  {
1030
2699
  "data-rsv": "list-item",
1031
2700
  role: "listitem",
1032
2701
  tabIndex: 0,
1033
- "data-event-id": l.id,
1034
- class: F((k = e.classNames) == null ? void 0 : k.event, ...l.classNames),
1035
- "data-display": l.display,
1036
- ref: (p) => {
1037
- var m;
1038
- return A(p, (m = e.hooks) == null ? void 0 : m.eventDidMount, () => b);
2702
+ "data-event-id": c.id,
2703
+ class: N((v = r.classNames) == null ? void 0 : v.event, ...c.classNames),
2704
+ "data-display": c.display,
2705
+ ref: (h) => {
2706
+ var b;
2707
+ return W(h, (b = r.hooks) == null ? void 0 : b.eventDidMount, () => D);
1039
2708
  },
1040
- style: `--rsv-event-bg:${l.backgroundColor};--rsv-event-fg:${l.textColor};--rsv-event-border:${l.borderColor}`,
1041
- onClick: (p) => {
1042
- r.trigger("eventClick", { event: l, el: p.currentTarget }), l.url && window.open(l.url, "_self");
2709
+ style: `--rsv-event-bg:${c.backgroundColor};--rsv-event-fg:${c.textColor};--rsv-event-border:${c.borderColor}`,
2710
+ onClick: (h) => {
2711
+ t.trigger("eventClick", { event: c, el: h.currentTarget }), c.url && window.open(c.url, "_self");
1043
2712
  },
1044
2713
  children: [
1045
- /* @__PURE__ */ d("span", { "data-rsv": "list-item-time", children: f }),
1046
- /* @__PURE__ */ d(
2714
+ /* @__PURE__ */ u("span", { "data-rsv": "list-item-time", children: p }),
2715
+ /* @__PURE__ */ u(
1047
2716
  "span",
1048
2717
  {
1049
2718
  "data-rsv": "list-item-dot",
1050
- style: `--rsv-event-bg:${l.backgroundColor}`
2719
+ style: `--rsv-event-bg:${c.backgroundColor}`
1051
2720
  }
1052
2721
  ),
1053
- /* @__PURE__ */ d("div", { "data-rsv": "list-item-title", children: L(
1054
- (w = e.slots) == null ? void 0 : w.eventContent,
1055
- b,
1056
- l.title,
1057
- e.hostBridge
2722
+ /* @__PURE__ */ u("div", { "data-rsv": "list-item-title", children: L(
2723
+ (g = r.slots) == null ? void 0 : g.eventContent,
2724
+ D,
2725
+ c.title,
2726
+ r.hostBridge
1058
2727
  ) })
1059
2728
  ]
1060
2729
  },
1061
- l.id
2730
+ c.id
1062
2731
  );
1063
2732
  })
1064
- ] }, s.toISOString(c.date))) });
1065
- }
1066
- function zt({ api: r, model: t, options: e }) {
1067
- const n = e.locale ?? "en", o = new Intl.DateTimeFormat(n, { month: "long" });
1068
- return /* @__PURE__ */ d("div", { "data-rsv": "multimonth", children: t.months.map((a) => /* @__PURE__ */ g("section", { "data-rsv": "mm-month", children: [
1069
- /* @__PURE__ */ d("header", { "data-rsv": "mm-title", children: o.format(s.toDate(a.date)) }),
1070
- /* @__PURE__ */ d(ut, { api: r, model: a.dayGrid, options: e })
1071
- ] }, s.toISOString(a.date))) });
1072
- }
1073
- const z = 1.6;
1074
- function Jt({ api: r, model: t, options: e }) {
1075
- return /* @__PURE__ */ g("div", { "data-rsv": "timeline", children: [
1076
- /* @__PURE__ */ d("div", { "data-rsv": "tl-axis", role: "row", children: t.slots.map((n) => /* @__PURE__ */ d("div", { "data-rsv": "tl-slot", style: `left:${n.leftPct}%`, children: n.label }, n.leftPct)) }),
1077
- /* @__PURE__ */ d("div", { "data-rsv": "tl-body", style: `height:${t.laneCount * z + 0.5}rem`, children: t.segs.map((n) => /* @__PURE__ */ d(gt, { api: r, seg: n, options: e }, n.event.id)) })
2733
+ ] }, m.toISOString(l.date))) });
2734
+ }
2735
+ function rn({ api: t, model: e, options: r }) {
2736
+ const n = r.locale ?? "en", a = new Intl.DateTimeFormat(n, { month: "long" });
2737
+ return /* @__PURE__ */ u("div", { "data-rsv": "multimonth", children: e.months.map((o) => /* @__PURE__ */ k("section", { "data-rsv": "mm-month", children: [
2738
+ /* @__PURE__ */ u("header", { "data-rsv": "mm-title", children: a.format(m.toDate(o.date)) }),
2739
+ /* @__PURE__ */ u(De, { api: t, model: o.dayGrid, options: r })
2740
+ ] }, m.toISOString(o.date))) });
2741
+ }
2742
+ const Tt = 1.6;
2743
+ function nn({ api: t, model: e, options: r }) {
2744
+ return /* @__PURE__ */ k("div", { "data-rsv": "timeline", children: [
2745
+ /* @__PURE__ */ u("div", { "data-rsv": "tl-axis", role: "row", children: e.slots.map((n) => /* @__PURE__ */ u("div", { "data-rsv": "tl-slot", style: `left:${n.leftPct}%`, children: n.label }, n.leftPct)) }),
2746
+ /* @__PURE__ */ u("div", { "data-rsv": "tl-body", style: `height:${e.laneCount * Tt + 0.5}rem`, children: e.segs.map((n) => /* @__PURE__ */ u(Ee, { api: t, seg: n, options: r }, n.event.id)) })
1078
2747
  ] });
1079
2748
  }
1080
- function gt({
1081
- api: r,
1082
- seg: t,
1083
- options: e
2749
+ function Ee({
2750
+ api: t,
2751
+ seg: e,
2752
+ options: r
1084
2753
  }) {
1085
- var o;
1086
- const { event: n } = t;
1087
- return /* @__PURE__ */ d(
2754
+ var a;
2755
+ const { event: n } = e;
2756
+ return /* @__PURE__ */ u(
1088
2757
  "div",
1089
2758
  {
1090
2759
  "data-rsv": "event",
1091
2760
  "data-event-id": n.id,
1092
2761
  role: "button",
1093
2762
  tabIndex: 0,
1094
- style: `position:absolute;left:${t.leftPct}%;width:${t.widthPct}%;top:${t.lane * z}rem;height:${z - 0.2}rem;--rsv-event-bg:${n.backgroundColor};--rsv-event-fg:${n.textColor};--rsv-event-border:${n.borderColor}`,
1095
- onClick: (a) => r.trigger("eventClick", { event: n, el: a.currentTarget }),
2763
+ style: `position:absolute;left:${e.leftPct}%;width:${e.widthPct}%;top:${e.lane * Tt}rem;height:${Tt - 0.2}rem;--rsv-event-bg:${n.backgroundColor};--rsv-event-fg:${n.textColor};--rsv-event-border:${n.borderColor}`,
2764
+ onClick: (o) => t.trigger("eventClick", { event: n, el: o.currentTarget }),
1096
2765
  children: L(
1097
- (o = e.slots) == null ? void 0 : o.eventContent,
1098
- { event: n, isAllDay: n.allDay, timeText: "", view: { type: r.getView().type } },
2766
+ (a = r.slots) == null ? void 0 : a.eventContent,
2767
+ { event: n, isAllDay: n.allDay, timeText: "", view: { type: t.getView().type } },
1099
2768
  n.title,
1100
- e.hostBridge
2769
+ r.hostBridge
1101
2770
  )
1102
2771
  }
1103
2772
  );
1104
2773
  }
1105
- const Qt = 1.6;
1106
- function Zt({ api: r, model: t, options: e }) {
1107
- return /* @__PURE__ */ g("div", { "data-rsv": "resource-timeline", children: [
1108
- /* @__PURE__ */ g("div", { "data-rsv": "rt-header", role: "row", children: [
1109
- /* @__PURE__ */ d("div", { "data-rsv": "resource-area-header", children: e.locale === "es" ? "Recursos" : "Resources" }),
1110
- /* @__PURE__ */ d("div", { "data-rsv": "tl-axis", children: t.slots.map((n) => /* @__PURE__ */ d("div", { "data-rsv": "tl-slot", style: `left:${n.leftPct}%`, children: n.label }, n.leftPct)) })
2774
+ const an = 1.6;
2775
+ function on({ api: t, model: e, options: r }) {
2776
+ return /* @__PURE__ */ k("div", { "data-rsv": "resource-timeline", children: [
2777
+ /* @__PURE__ */ k("div", { "data-rsv": "rt-header", role: "row", children: [
2778
+ /* @__PURE__ */ u("div", { "data-rsv": "resource-area-header", children: r.locale === "es" ? "Recursos" : "Resources" }),
2779
+ /* @__PURE__ */ u("div", { "data-rsv": "tl-axis", children: e.slots.map((n) => /* @__PURE__ */ u("div", { "data-rsv": "tl-slot", style: `left:${n.leftPct}%`, children: n.label }, n.leftPct)) })
1111
2780
  ] }),
1112
- t.lanes.map((n) => {
1113
- const o = n.laneCount * Qt + 0.4;
1114
- return /* @__PURE__ */ g("div", { "data-rsv": "resource-row", role: "row", children: [
1115
- /* @__PURE__ */ g(
2781
+ e.lanes.map((n) => {
2782
+ const a = n.laneCount * an + 0.4;
2783
+ return /* @__PURE__ */ k("div", { "data-rsv": "resource-row", role: "row", children: [
2784
+ /* @__PURE__ */ k(
1116
2785
  "div",
1117
2786
  {
1118
2787
  "data-rsv": "resource-label",
1119
2788
  style: `padding-inline-start:${0.5 + n.row.depth * 1}rem`,
1120
2789
  children: [
1121
- n.row.hasChildren && /* @__PURE__ */ d(
2790
+ n.row.hasChildren && /* @__PURE__ */ u(
1122
2791
  "button",
1123
2792
  {
1124
2793
  type: "button",
1125
2794
  "data-rsv": "resource-toggle",
1126
2795
  "aria-expanded": n.row.expanded,
1127
- onClick: () => r.toggleResource(n.row.resource.id),
2796
+ onClick: () => t.toggleResource(n.row.resource.id),
1128
2797
  children: n.row.expanded ? "▾" : "▸"
1129
2798
  }
1130
2799
  ),
1131
- /* @__PURE__ */ d("span", { "data-rsv": "resource-title", children: n.row.resource.title })
2800
+ /* @__PURE__ */ u("span", { "data-rsv": "resource-title", children: n.row.resource.title })
1132
2801
  ]
1133
2802
  }
1134
2803
  ),
1135
- /* @__PURE__ */ d("div", { "data-rsv": "resource-lane", style: `height:${o}rem`, children: n.segs.map((a) => /* @__PURE__ */ d(gt, { api: r, seg: a, options: e }, a.event.id)) })
2804
+ /* @__PURE__ */ u("div", { "data-rsv": "resource-lane", style: `height:${a}rem`, children: n.segs.map((o) => /* @__PURE__ */ u(Ee, { api: t, seg: o, options: r }, o.event.id)) })
1136
2805
  ] }, n.row.resource.id);
1137
2806
  })
1138
2807
  ] });
1139
2808
  }
1140
- function te({ api: r, model: t, options: e }) {
1141
- const n = `calc(var(--spacing-rsv-slot, 2.5rem) * ${t.slots.length})`;
1142
- return /* @__PURE__ */ g("div", { "data-rsv": "timegrid", style: `--rsv-tg-days:${t.columns.length}`, children: [
1143
- /* @__PURE__ */ g("div", { "data-rsv": "tg-header", role: "row", children: [
1144
- /* @__PURE__ */ d("div", { "data-rsv": "tg-axis-corner" }),
1145
- t.columns.map((o) => /* @__PURE__ */ d("div", { "data-rsv": "tg-col-header", role: "columnheader", children: o.row.resource.title }, o.row.resource.id))
2809
+ function dn({ api: t, model: e, options: r }) {
2810
+ const n = `calc(var(--spacing-rsv-slot, 2.5rem) * ${e.slots.length})`;
2811
+ return /* @__PURE__ */ k("div", { "data-rsv": "timegrid", style: `--rsv-tg-days:${e.columns.length}`, children: [
2812
+ /* @__PURE__ */ k("div", { "data-rsv": "tg-header", role: "row", children: [
2813
+ /* @__PURE__ */ u("div", { "data-rsv": "tg-axis-corner" }),
2814
+ e.columns.map((a) => /* @__PURE__ */ u("div", { "data-rsv": "tg-col-header", role: "columnheader", children: a.row.resource.title }, a.row.resource.id))
1146
2815
  ] }),
1147
- /* @__PURE__ */ g("div", { "data-rsv": "tg-allday", role: "row", children: [
1148
- /* @__PURE__ */ d("div", { "data-rsv": "tg-axis-label", children: R(e.locale).allDay }),
1149
- t.columns.map((o) => /* @__PURE__ */ d("div", { "data-rsv": "tg-allday-cell", children: o.allDayEvents.map((a) => /* @__PURE__ */ d(
2816
+ /* @__PURE__ */ k("div", { "data-rsv": "tg-allday", role: "row", children: [
2817
+ /* @__PURE__ */ u("div", { "data-rsv": "tg-axis-label", children: V(r.locale).allDay }),
2818
+ e.columns.map((a) => /* @__PURE__ */ u("div", { "data-rsv": "tg-allday-cell", children: a.allDayEvents.map((o) => /* @__PURE__ */ u(
1150
2819
  "div",
1151
2820
  {
1152
2821
  "data-rsv": "event",
1153
2822
  "data-all-day": "true",
1154
- style: `--rsv-event-bg:${a.backgroundColor}`,
1155
- onClick: (h) => r.trigger("eventClick", { event: a, el: h.currentTarget }),
1156
- children: a.title
2823
+ style: `--rsv-event-bg:${o.backgroundColor}`,
2824
+ onClick: (s) => t.trigger("eventClick", { event: o, el: s.currentTarget }),
2825
+ children: o.title
1157
2826
  },
1158
- a.id
1159
- )) }, o.row.resource.id))
2827
+ o.id
2828
+ )) }, a.row.resource.id))
1160
2829
  ] }),
1161
- /* @__PURE__ */ g("div", { "data-rsv": "tg-body", children: [
1162
- /* @__PURE__ */ d("div", { "data-rsv": "tg-axis", style: `height:${n}`, children: t.slots.map((o) => /* @__PURE__ */ d("div", { "data-rsv": "tg-slot", "data-major": String(o.isMajor), children: /* @__PURE__ */ d("span", { "data-rsv": "tg-slot-label", children: o.label }) }, o.offsetMin)) }),
1163
- t.columns.map((o) => /* @__PURE__ */ g(
2830
+ /* @__PURE__ */ k("div", { "data-rsv": "tg-body", children: [
2831
+ /* @__PURE__ */ u("div", { "data-rsv": "tg-axis", style: `height:${n}`, children: e.slots.map((a) => /* @__PURE__ */ u("div", { "data-rsv": "tg-slot", "data-major": String(a.isMajor), children: /* @__PURE__ */ u("span", { "data-rsv": "tg-slot-label", children: a.label }) }, a.offsetMin)) }),
2832
+ e.columns.map((a) => /* @__PURE__ */ k(
1164
2833
  "div",
1165
2834
  {
1166
2835
  "data-rsv": "tg-col",
1167
- "data-rsv-resource-id": o.row.resource.id,
2836
+ "data-rsv-resource-id": a.row.resource.id,
1168
2837
  style: `height:${n}`,
1169
2838
  children: [
1170
- o.timedSegs.map((a) => {
1171
- const h = 100 / a.colCount;
1172
- return /* @__PURE__ */ g(
2839
+ a.timedSegs.map((o) => {
2840
+ const s = 100 / o.colCount;
2841
+ return /* @__PURE__ */ k(
1173
2842
  "div",
1174
2843
  {
1175
2844
  "data-rsv": "event",
1176
2845
  "data-all-day": "false",
1177
- "data-event-id": a.event.id,
2846
+ "data-event-id": o.event.id,
1178
2847
  role: "button",
1179
2848
  tabIndex: 0,
1180
- style: `position:absolute;top:${a.topPct}%;height:${a.heightPct}%;left:${a.col * h}%;width:${h}%;--rsv-event-bg:${a.event.backgroundColor};--rsv-event-fg:${a.event.textColor}`,
1181
- onClick: (u) => {
1182
- u.stopPropagation(), r.trigger("eventClick", { event: a.event });
2849
+ style: `position:absolute;top:${o.topPct}%;height:${o.heightPct}%;left:${o.col * s}%;width:${s}%;--rsv-event-bg:${o.event.backgroundColor};--rsv-event-fg:${o.event.textColor}`,
2850
+ onClick: (i) => {
2851
+ i.stopPropagation(), t.trigger("eventClick", { event: o.event });
1183
2852
  },
1184
2853
  children: [
1185
- s.format(a.event.start, "HH:mm"),
2854
+ m.format(o.event.start, "HH:mm"),
1186
2855
  " ",
1187
- a.event.title
2856
+ o.event.title
1188
2857
  ]
1189
2858
  },
1190
- a.event.id
2859
+ o.event.id
1191
2860
  );
1192
2861
  }),
1193
- t.nowTopPct != null && /* @__PURE__ */ d("div", { "data-rsv": "now-indicator", style: `top:${t.nowTopPct}%` })
2862
+ e.nowTopPct != null && /* @__PURE__ */ u("div", { "data-rsv": "now-indicator", style: `top:${e.nowTopPct}%` })
1194
2863
  ]
1195
2864
  },
1196
- o.row.resource.id
2865
+ a.row.resource.id
1197
2866
  ))
1198
2867
  ] })
1199
2868
  ] });
1200
2869
  }
1201
- function ee({ api: r, model: t }) {
1202
- return /* @__PURE__ */ g("div", { "data-rsv": "resource-daygrid", style: `--rsv-rdg-cols:${t.columns.length}`, children: [
1203
- /* @__PURE__ */ d("div", { "data-rsv": "rdg-header", role: "row", children: t.columns.map((e) => /* @__PURE__ */ d("div", { "data-rsv": "rdg-col-header", role: "columnheader", children: e.row.resource.title }, e.row.resource.id)) }),
1204
- /* @__PURE__ */ d("div", { "data-rsv": "rdg-body", role: "row", children: t.columns.map((e) => /* @__PURE__ */ d(
2870
+ function sn({ api: t, model: e }) {
2871
+ return /* @__PURE__ */ k("div", { "data-rsv": "resource-daygrid", style: `--rsv-rdg-cols:${e.columns.length}`, children: [
2872
+ /* @__PURE__ */ u("div", { "data-rsv": "rdg-header", role: "row", children: e.columns.map((r) => /* @__PURE__ */ u("div", { "data-rsv": "rdg-col-header", role: "columnheader", children: r.row.resource.title }, r.row.resource.id)) }),
2873
+ /* @__PURE__ */ u("div", { "data-rsv": "rdg-body", role: "row", children: e.columns.map((r) => /* @__PURE__ */ u(
1205
2874
  "div",
1206
2875
  {
1207
2876
  "data-rsv": "rdg-col",
1208
- "data-rsv-resource-id": e.row.resource.id,
1209
- children: e.events.map((n) => /* @__PURE__ */ g(
2877
+ "data-rsv-resource-id": r.row.resource.id,
2878
+ children: r.events.map((n) => /* @__PURE__ */ k(
1210
2879
  "div",
1211
2880
  {
1212
2881
  "data-rsv": "event",
@@ -1215,188 +2884,188 @@ function ee({ api: r, model: t }) {
1215
2884
  role: "button",
1216
2885
  tabIndex: 0,
1217
2886
  style: `--rsv-event-bg:${n.backgroundColor};--rsv-event-fg:${n.textColor};--rsv-event-border:${n.borderColor}`,
1218
- onClick: (o) => r.trigger("eventClick", { event: n, el: o.currentTarget }),
2887
+ onClick: (a) => t.trigger("eventClick", { event: n, el: a.currentTarget }),
1219
2888
  children: [
1220
- n.allDay ? "" : s.format(n.start, "HH:mm") + " ",
2889
+ n.allDay ? "" : m.format(n.start, "HH:mm") + " ",
1221
2890
  n.title
1222
2891
  ]
1223
2892
  },
1224
2893
  n.id
1225
2894
  ))
1226
2895
  },
1227
- e.row.resource.id
2896
+ r.row.resource.id
1228
2897
  )) })
1229
2898
  ] });
1230
2899
  }
1231
- function re({ api: r, model: t, options: e }) {
1232
- return /* @__PURE__ */ d("div", { "data-rsv": "resource-daygrid-month", style: `--rsv-rdgm-cols:${t.columnCount}`, children: t.weeks.map((n, o) => /* @__PURE__ */ d("div", { "data-rsv": "rdgm-week", role: "row", children: n.days.map((a) => /* @__PURE__ */ d(
1233
- ne,
2900
+ function ln({ api: t, model: e, options: r }) {
2901
+ return /* @__PURE__ */ u("div", { "data-rsv": "resource-daygrid-month", style: `--rsv-rdgm-cols:${e.columnCount}`, children: e.weeks.map((n, a) => /* @__PURE__ */ u("div", { "data-rsv": "rdgm-week", role: "row", children: n.days.map((o) => /* @__PURE__ */ u(
2902
+ cn,
1234
2903
  {
1235
- api: r,
1236
- cell: a,
1237
- options: e
2904
+ api: t,
2905
+ cell: o,
2906
+ options: r
1238
2907
  },
1239
- s.toISOString(a.date)
1240
- )) }, `week-${o}`)) });
2908
+ m.toISOString(o.date)
2909
+ )) }, `week-${a}`)) });
1241
2910
  }
1242
- function ne({
1243
- api: r,
1244
- cell: t,
1245
- options: e
2911
+ function cn({
2912
+ api: t,
2913
+ cell: e,
2914
+ options: r
1246
2915
  }) {
1247
- const n = s.dayOfMonth(t.date);
1248
- return /* @__PURE__ */ g(
2916
+ const n = m.dayOfMonth(e.date);
2917
+ return /* @__PURE__ */ k(
1249
2918
  "div",
1250
2919
  {
1251
2920
  "data-rsv": "day",
1252
2921
  role: "gridcell",
1253
- "data-date": s.toISOString(t.date),
1254
- "data-today": String(t.isToday),
1255
- "data-other": String(t.isOther),
2922
+ "data-date": m.toISOString(e.date),
2923
+ "data-today": String(e.isToday),
2924
+ "data-other": String(e.isOther),
1256
2925
  children: [
1257
- /* @__PURE__ */ d("span", { "data-rsv": "day-number", children: n }),
1258
- /* @__PURE__ */ d("div", { "data-rsv": "rdgm-columns", children: t.columns.map((o) => /* @__PURE__ */ g("div", { "data-rsv": "rdgm-col", "data-rsv-resource-id": o.row.resource.id, children: [
1259
- /* @__PURE__ */ d("span", { "data-rsv": "rdgm-col-label", children: o.row.resource.title }),
1260
- o.events.map((a) => {
1261
- const h = r.selectedEventIds.value.has(a.id);
1262
- return /* @__PURE__ */ g(
2926
+ /* @__PURE__ */ u("span", { "data-rsv": "day-number", children: n }),
2927
+ /* @__PURE__ */ u("div", { "data-rsv": "rdgm-columns", children: e.columns.map((a) => /* @__PURE__ */ k("div", { "data-rsv": "rdgm-col", "data-rsv-resource-id": a.row.resource.id, children: [
2928
+ /* @__PURE__ */ u("span", { "data-rsv": "rdgm-col-label", children: a.row.resource.title }),
2929
+ a.events.map((o) => {
2930
+ const s = t.selectedEventIds.value.has(o.id);
2931
+ return /* @__PURE__ */ k(
1263
2932
  "div",
1264
2933
  {
1265
2934
  "data-rsv": "event",
1266
- "data-all-day": String(a.allDay),
1267
- "data-event-id": a.id,
1268
- "data-rsv-selected": String(h),
2935
+ "data-all-day": String(o.allDay),
2936
+ "data-event-id": o.id,
2937
+ "data-rsv-selected": String(s),
1269
2938
  role: "button",
1270
2939
  tabIndex: 0,
1271
- style: `--rsv-event-bg:${a.backgroundColor};--rsv-event-fg:${a.textColor};--rsv-event-border:${a.borderColor}`,
1272
- onClick: (u) => {
1273
- if (u.stopPropagation(), u.ctrlKey || u.metaKey) {
1274
- r.toggleEventSelection(a.id);
2940
+ style: `--rsv-event-bg:${o.backgroundColor};--rsv-event-fg:${o.textColor};--rsv-event-border:${o.borderColor}`,
2941
+ onClick: (i) => {
2942
+ if (i.stopPropagation(), i.ctrlKey || i.metaKey) {
2943
+ t.toggleEventSelection(o.id);
1275
2944
  return;
1276
2945
  }
1277
- r.trigger("eventClick", { event: a, el: u.currentTarget }), a.url && window.open(a.url, "_self");
2946
+ t.trigger("eventClick", { event: o, el: i.currentTarget }), o.url && window.open(o.url, "_self");
1278
2947
  },
1279
2948
  children: [
1280
- a.allDay ? "" : `${s.format(a.start, "HH:mm")} `,
1281
- a.title
2949
+ o.allDay ? "" : `${m.format(o.start, "HH:mm")} `,
2950
+ o.title
1282
2951
  ]
1283
2952
  },
1284
- a.id
2953
+ o.id
1285
2954
  );
1286
2955
  }),
1287
- o.moreCount > 0 && /* @__PURE__ */ d(
2956
+ a.moreCount > 0 && /* @__PURE__ */ u(
1288
2957
  "span",
1289
2958
  {
1290
2959
  "data-rsv": "rdgm-more",
1291
- onClick: (a) => {
1292
- a.stopPropagation(), r.trigger("moreLinkClick", {
1293
- date: t.date,
1294
- allEvents: [...o.events, ...o.hiddenEvents],
1295
- hiddenEvents: o.hiddenEvents
2960
+ onClick: (o) => {
2961
+ o.stopPropagation(), t.trigger("moreLinkClick", {
2962
+ date: e.date,
2963
+ allEvents: [...a.events, ...a.hiddenEvents],
2964
+ hiddenEvents: a.hiddenEvents
1296
2965
  });
1297
2966
  },
1298
- children: R(e.locale).more(o.moreCount)
2967
+ children: V(r.locale).more(a.moreCount)
1299
2968
  }
1300
2969
  )
1301
- ] }, o.row.resource.id)) })
2970
+ ] }, a.row.resource.id)) })
1302
2971
  ]
1303
2972
  }
1304
2973
  );
1305
2974
  }
1306
- function ae({ api: r, options: t }) {
1307
- var c;
1308
- const e = r.viewModel.value, n = t.direction ?? R(t.locale).direction, o = r.getEffectiveOption("hourHeight", e.type), a = r.getEffectiveOption("height", e.type), h = [
1309
- t.themeTokens ? pt(t.themeTokens) : "",
1310
- o ? `${Dt.slotHeight}:${o}px` : "",
1311
- a != null && a !== "auto" ? `height:${typeof a == "number" ? `${a}px` : a}` : ""
1312
- ].filter(Boolean).join(";") || void 0, u = $(null);
1313
- H(() => (r.setRootEl(u.current), () => r.setRootEl(null)), [r]);
1314
- const v = $(t.responsiveViews);
1315
- return v.current = t.responsiveViews, H(() => {
1316
- const l = u.current;
1317
- if (!l || typeof ResizeObserver > "u") return;
1318
- let f = 0;
1319
- const b = new ResizeObserver((k) => {
1320
- const w = k[0], p = (w == null ? void 0 : w.contentRect.width) ?? l.clientWidth;
1321
- cancelAnimationFrame(f), f = requestAnimationFrame(() => {
1322
- const m = v.current;
1323
- if (!(m != null && m.length)) return;
1324
- const S = $t(m, p);
1325
- S && S !== r.getView().type && r.hasView(S) && r.changeView(S);
2975
+ function un({ api: t, options: e }) {
2976
+ var l;
2977
+ const r = t.viewModel.value, n = e.direction ?? V(e.locale).direction, a = t.getEffectiveOption("hourHeight", r.type), o = t.getEffectiveOption("height", r.type), s = [
2978
+ e.themeTokens ? Pe(e.themeTokens) : "",
2979
+ a ? `${xe.slotHeight}:${a}px` : "",
2980
+ o != null && o !== "auto" ? `height:${typeof o == "number" ? `${o}px` : o}` : ""
2981
+ ].filter(Boolean).join(";") || void 0, i = F(null);
2982
+ R(() => (t.setRootEl(i.current), () => t.setRootEl(null)), [t]);
2983
+ const d = F(e.responsiveViews);
2984
+ return d.current = e.responsiveViews, R(() => {
2985
+ const c = i.current;
2986
+ if (!c || typeof ResizeObserver > "u") return;
2987
+ let p = 0;
2988
+ const D = new ResizeObserver((v) => {
2989
+ const g = v[0], h = (g == null ? void 0 : g.contentRect.width) ?? c.clientWidth;
2990
+ cancelAnimationFrame(p), p = requestAnimationFrame(() => {
2991
+ const b = d.current;
2992
+ if (!(b != null && b.length)) return;
2993
+ const w = He(b, h);
2994
+ w && w !== t.getView().type && t.hasView(w) && t.changeView(w);
1326
2995
  });
1327
2996
  });
1328
- return b.observe(l), () => {
1329
- cancelAnimationFrame(f), b.disconnect();
2997
+ return D.observe(c), () => {
2998
+ cancelAnimationFrame(p), D.disconnect();
1330
2999
  };
1331
- }, [r]), /* @__PURE__ */ g(
3000
+ }, [t]), /* @__PURE__ */ k(
1332
3001
  "div",
1333
3002
  {
1334
- ref: u,
3003
+ ref: i,
1335
3004
  "data-rsv": "root",
1336
3005
  dir: n,
1337
- "data-rsv-theme": t.theme,
1338
- "data-rsv-autoheight": a === "auto" ? "true" : void 0,
1339
- style: h,
1340
- class: F((c = t.classNames) == null ? void 0 : c.root),
3006
+ "data-rsv-theme": e.theme,
3007
+ "data-rsv-autoheight": o === "auto" ? "true" : void 0,
3008
+ style: s,
3009
+ class: N((l = e.classNames) == null ? void 0 : l.root),
1341
3010
  children: [
1342
- t.headerToolbar !== !1 && /* @__PURE__ */ d(Rt, { api: r, title: e.title, activeView: e.type, options: t }),
1343
- /* @__PURE__ */ d("div", { "data-rsv": "view", "data-view": e.type, children: e.dayGrid ? /* @__PURE__ */ d(ut, { api: r, model: e.dayGrid, options: t }) : e.timeGrid ? /* @__PURE__ */ d(Wt, { api: r, model: e.timeGrid, options: t }) : e.list ? /* @__PURE__ */ d(qt, { api: r, model: e.list, options: t }) : e.multiMonth ? /* @__PURE__ */ d(zt, { api: r, model: e.multiMonth, options: t }) : e.resourceTimeGrid ? /* @__PURE__ */ d(te, { api: r, model: e.resourceTimeGrid, options: t }) : e.resourceDayGrid ? /* @__PURE__ */ d(ee, { api: r, model: e.resourceDayGrid, options: t }) : e.resourceDayGridMonth ? /* @__PURE__ */ d(re, { api: r, model: e.resourceDayGridMonth, options: t }) : e.resourceTimeline ? /* @__PURE__ */ d(Zt, { api: r, model: e.resourceTimeline, options: t }) : e.timeline ? /* @__PURE__ */ d(Jt, { api: r, model: e.timeline, options: t }) : /* @__PURE__ */ g("div", { "data-rsv": "unsupported", children: [
3011
+ e.headerToolbar !== !1 && /* @__PURE__ */ u(Ve, { api: t, title: r.title, activeView: r.type, options: e }),
3012
+ /* @__PURE__ */ u("div", { "data-rsv": "view", "data-view": r.type, children: r.dayGrid ? /* @__PURE__ */ u(De, { api: t, model: r.dayGrid, options: e }) : r.timeGrid ? /* @__PURE__ */ u(Qr, { api: t, model: r.timeGrid, options: e }) : r.list ? /* @__PURE__ */ u(en, { api: t, model: r.list, options: e }) : r.multiMonth ? /* @__PURE__ */ u(rn, { api: t, model: r.multiMonth, options: e }) : r.resourceTimeGrid ? /* @__PURE__ */ u(dn, { api: t, model: r.resourceTimeGrid, options: e }) : r.resourceDayGrid ? /* @__PURE__ */ u(sn, { api: t, model: r.resourceDayGrid, options: e }) : r.resourceDayGridMonth ? /* @__PURE__ */ u(ln, { api: t, model: r.resourceDayGridMonth, options: e }) : r.resourceTimeline ? /* @__PURE__ */ u(on, { api: t, model: r.resourceTimeline, options: e }) : r.timeline ? /* @__PURE__ */ u(nn, { api: t, model: r.timeline, options: e }) : /* @__PURE__ */ k("div", { "data-rsv": "unsupported", children: [
1344
3013
  'La vista "',
1345
- e.type,
3014
+ r.type,
1346
3015
  '" se implementa en una fase posterior.'
1347
3016
  ] }) })
1348
3017
  ]
1349
3018
  }
1350
3019
  );
1351
3020
  }
1352
- function ue(r, t) {
1353
- const e = new Mt(t);
1354
- return at(bt(ae, { api: e, options: t }), r), {
1355
- api: e,
3021
+ function hn(t, e) {
3022
+ const r = new Ae(e);
3023
+ return At(Ce(un, { api: r, options: e }), t), {
3024
+ api: r,
1356
3025
  destroy() {
1357
- at(null, r), e.destroy();
3026
+ At(null, t), r.destroy();
1358
3027
  }
1359
3028
  };
1360
3029
  }
1361
- function ve(r, t = "calendar.ics") {
3030
+ function bn(t, e = "calendar.ics") {
1362
3031
  if (typeof document > "u") return;
1363
- const e = St(r), n = new Blob([e], { type: "text/calendar;charset=utf-8" }), o = URL.createObjectURL(n), a = document.createElement("a");
1364
- a.href = o, a.download = t, document.body.appendChild(a), a.click(), a.remove(), URL.revokeObjectURL(o);
3032
+ const r = Ie(t), n = new Blob([r], { type: "text/calendar;charset=utf-8" }), a = URL.createObjectURL(n), o = document.createElement("a");
3033
+ o.href = a, o.download = e, document.body.appendChild(o), o.click(), o.remove(), URL.revokeObjectURL(a);
1365
3034
  }
1366
3035
  export {
1367
- ae as Calendar,
1368
- ut as DayGridView,
1369
- qt as ListView,
1370
- zt as MultiMonthView,
1371
- ee as ResourceDayGridView,
1372
- te as ResourceTimeGridView,
1373
- Zt as ResourceTimelineView,
1374
- Wt as TimeGridView,
1375
- Jt as TimelineView,
1376
- Rt as Toolbar,
1377
- A as callDidMount,
1378
- F as cx,
1379
- W as dateFormatter,
1380
- ge as dayGridPlugin,
1381
- ye as definePlugin,
1382
- fe as defineTheme,
1383
- ve as downloadICS,
1384
- be as eventsToICS,
1385
- lt as handleEventKeydown,
1386
- ce as hostSlot,
1387
- Et as isHostSlot,
1388
- we as listPlugin,
1389
- It as minutesToLabel,
1390
- At as minutesToTimeString,
1391
- ue as mount,
1392
- ke as multiMonthPlugin,
1393
- De as parseICS,
3036
+ un as Calendar,
3037
+ De as DayGridView,
3038
+ en as ListView,
3039
+ rn as MultiMonthView,
3040
+ sn as ResourceDayGridView,
3041
+ dn as ResourceTimeGridView,
3042
+ on as ResourceTimelineView,
3043
+ Qr as TimeGridView,
3044
+ nn as TimelineView,
3045
+ Ve as Toolbar,
3046
+ W as callDidMount,
3047
+ N as cx,
3048
+ st as dateFormatter,
3049
+ Sn as dayGridPlugin,
3050
+ On as definePlugin,
3051
+ Tn as defineTheme,
3052
+ bn as downloadICS,
3053
+ En as eventsToICS,
3054
+ re as handleEventKeydown,
3055
+ pn as hostSlot,
3056
+ je as isHostSlot,
3057
+ Mn as listPlugin,
3058
+ Ye as minutesToLabel,
3059
+ We as minutesToTimeString,
3060
+ hn as mount,
3061
+ kn as multiMonthPlugin,
3062
+ Cn as parseICS,
1394
3063
  L as renderSlot,
1395
- pe as resourcePlugin,
1396
- q as startEventDrag,
1397
- Me as themeToStyle,
1398
- X as timeFormatter,
1399
- Se as timeGridPlugin,
1400
- Ce as timelinePlugin
3064
+ xn as resourcePlugin,
3065
+ te as startEventDrag,
3066
+ Pn as themeToStyle,
3067
+ ct as timeFormatter,
3068
+ An as timeGridPlugin,
3069
+ In as timelinePlugin
1401
3070
  };
1402
3071
  //# sourceMappingURL=index.js.map