@inertiaui/modal-react 0.19.4 → 0.19.5

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.
@@ -1,13 +1,13 @@
1
- var fn = Object.defineProperty;
2
- var mn = (e, t, n) => t in e ? fn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var q = (e, t, n) => mn(e, typeof t != "symbol" ? t + "" : t, n);
1
+ var pn = Object.defineProperty;
2
+ var hn = (e, t, n) => t in e ? pn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var q = (e, t, n) => hn(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as Ee from "react";
5
- import E, { createContext as H, useContext as R, useEffect as M, useRef as O, useState as S, createElement as Re, useMemo as C, forwardRef as ct, useImperativeHandle as St, useLayoutEffect as pn, useCallback as Y, Fragment as G, isValidElement as hn, cloneElement as vn, useId as Pe, useSyncExternalStore as gn, useReducer as wn, createRef as yn } from "react";
5
+ import E, { createContext as H, useContext as R, useEffect as M, useRef as O, useState as S, createElement as Re, useMemo as C, forwardRef as ct, useImperativeHandle as Ft, useLayoutEffect as vn, useCallback as Y, Fragment as G, isValidElement as gn, cloneElement as wn, useId as Pe, useSyncExternalStore as xn, useReducer as yn, createRef as bn } from "react";
6
6
  import { jsxs as se, Fragment as dt, jsx as T } from "react/jsx-runtime";
7
7
  import De from "axios";
8
- import { router as xe, usePage as xn } from "@inertiajs/react";
9
- import { mergeDataIntoQueryString as bn } from "@inertiajs/core";
10
- import { createPortal as En } from "react-dom";
8
+ import { router as ye, usePage as En } from "@inertiajs/react";
9
+ import { mergeDataIntoQueryString as $n } from "@inertiajs/core";
10
+ import { createPortal as Tn } from "react-dom";
11
11
  const ge = {
12
12
  type: "modal",
13
13
  navigate: !1,
@@ -28,7 +28,7 @@ const ge = {
28
28
  position: "right"
29
29
  }
30
30
  };
31
- class $n {
31
+ class On {
32
32
  constructor() {
33
33
  this.config = {}, this.reset();
34
34
  }
@@ -64,23 +64,24 @@ class $n {
64
64
  return r;
65
65
  }
66
66
  }
67
- const _e = new $n(), Ll = () => _e.reset(), Sl = (e, t) => _e.put(e, t), ft = (e) => _e.get(e), ce = (e, t) => _e.get(e ? `slideover.${t}` : `modal.${t}`);
68
- function Tn(e, t) {
67
+ const _e = new On(), Sl = () => _e.reset(), Fl = (e, t) => _e.put(e, t), ft = (e) => _e.get(e), ce = (e, t) => _e.get(e ? `slideover.${t}` : `modal.${t}`);
68
+ function Pn(e, t) {
69
69
  return e = typeof e == "string" ? new URL(e, window.location.origin) : e, t = typeof t == "string" ? new URL(t, window.location.origin) : t, `${e.origin}${e.pathname}` == `${t.origin}${t.pathname}`;
70
70
  }
71
71
  function et(e = "inertiaui_modal_") {
72
72
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `${e}${crypto.randomUUID()}` : `${e}${Date.now().toString(36)}_${Math.random().toString(36).substr(2, 9)}`;
73
73
  }
74
- function On(e, t) {
75
- return Array.isArray(e) ? e.filter((n) => !t.includes(n)) : Object.keys(e).reduce((n, r) => (t.includes(r) || (n[r] = e[r]), n), {});
74
+ function Ct(e, t, n = !1) {
75
+ const r = (l) => typeof l == "string" ? l.toLowerCase() : l;
76
+ return n && (t = t.map(r)), Array.isArray(e) ? e.filter((l) => !t.includes(n ? r(l) : l)) : Object.keys(e).reduce((l, o) => (t.includes(n ? r(o) : o) || (l[o] = e[o]), l), {});
76
77
  }
77
- function Ft(e, t) {
78
+ function Nt(e, t) {
78
79
  return Array.isArray(e) ? e.filter((n) => t.includes(n)) : t.reduce((n, r) => (r in e && (n[r] = e[r]), n), {});
79
80
  }
80
- function Pn(e) {
81
+ function Mn(e) {
81
82
  return Array.isArray(e) ? e.filter((t) => t !== null) : Object.keys(e).reduce((t, n) => (n in e && e[n] !== null && (t[n] = e[n]), t), {});
82
83
  }
83
- function Mn(e, t = 3, n = 10) {
84
+ function Ln(e, t = 3, n = 10) {
84
85
  return new Promise((r, l) => {
85
86
  const o = e();
86
87
  if (o) {
@@ -97,18 +98,39 @@ function Mn(e, t = 3, n = 10) {
97
98
  function we(e) {
98
99
  return e ? (e = e.replace(/_/g, "-"), e = e.replace(/-+/g, "-"), /[A-Z]/.test(e) ? (e = e.replace(/\s+/g, "").replace(/_/g, "").replace(/(?:^|\s|-)+([A-Za-z])/g, (t, n) => n.toUpperCase()), e = e.replace(/(.)(?=[A-Z])/g, "$1-"), e.toLowerCase()) : e) : "";
99
100
  }
101
+ function yt(e) {
102
+ return Ct(
103
+ e || {},
104
+ [
105
+ "name",
106
+ "slideover",
107
+ "closeButton",
108
+ "close-button",
109
+ "closeExplicitly",
110
+ "close-explicitly",
111
+ "maxWidth",
112
+ "max-width",
113
+ "paddingClasses",
114
+ "padding-classes",
115
+ "panelClasses",
116
+ "panel-classes",
117
+ "position"
118
+ ],
119
+ !0
120
+ );
121
+ }
100
122
  const Be = H(null);
101
123
  Be.displayName = "ModalStackContext";
102
- let Ct = null, kt = null, $e = null, rt = null, Ie = [], de = {};
103
- const Ln = ({ children: e }) => {
124
+ let At = null, kt = null, $e = null, rt = null, Ie = [], de = {};
125
+ const Sn = ({ children: e }) => {
104
126
  const [t, n] = S([]), [r, l] = S({}), o = (v) => {
105
127
  n((u) => {
106
128
  const m = v([...u]), p = (g) => {
107
- var x;
108
- return m.length < 2 ? !0 : ((x = m.map((h) => ({ id: h.id, shouldRender: h.shouldRender })).reverse().find((h) => h.shouldRender)) == null ? void 0 : x.id) === g;
129
+ var y;
130
+ return m.length < 2 ? !0 : ((y = m.map((h) => ({ id: h.id, shouldRender: h.shouldRender })).reverse().find((h) => h.shouldRender)) == null ? void 0 : y.id) === g;
109
131
  };
110
- return m.forEach((g, x) => {
111
- m[x].onTopOfStack = p(g.id), m[x].getParentModal = () => x < 1 ? null : m.slice(0, x).reverse().find((h) => h.isOpen), m[x].getChildModal = () => x === m.length - 1 ? null : m.slice(x + 1).find((h) => h.isOpen);
132
+ return m.forEach((g, y) => {
133
+ m[y].onTopOfStack = p(g.id), m[y].getParentModal = () => y < 1 ? null : m.slice(0, y).reverse().find((h) => h.isOpen), m[y].getChildModal = () => y === m.length - 1 ? null : m.slice(y + 1).find((h) => h.isOpen);
112
134
  }), m;
113
135
  });
114
136
  };
@@ -116,7 +138,7 @@ const Ln = ({ children: e }) => {
116
138
  Ie = t;
117
139
  }, [t]);
118
140
  class a {
119
- constructor(u, m, p, g, x) {
141
+ constructor(u, m, p, g, y) {
120
142
  q(this, "show", () => {
121
143
  o(
122
144
  (u) => u.map((m) => (m.id === this.id && !m.isOpen && (m.isOpen = !0, m.shouldRender = !0), m))
@@ -165,7 +187,7 @@ const Ln = ({ children: e }) => {
165
187
  q(this, "reload", (u = {}) => {
166
188
  var p;
167
189
  let m = Object.keys(this.response.props);
168
- u.only && (m = Ft(m, u.only)), u.except && (m = On(m, u.except)), (p = this.response) != null && p.url && De.get(this.response.url, {
190
+ u.only && (m = Nt(m, u.only)), u.except && (m = Ct(m, u.except)), (p = this.response) != null && p.url && De.get(this.response.url, {
169
191
  headers: {
170
192
  Accept: "text/html, application/xhtml+xml",
171
193
  "X-Inertia": !0,
@@ -181,9 +203,9 @@ const Ln = ({ children: e }) => {
181
203
  });
182
204
  });
183
205
  q(this, "updateProps", (u) => {
184
- Object.assign(this.props, u), o((m) => m);
206
+ Object.assign(this.props, yt(u)), o((m) => m);
185
207
  });
186
- if (this.id = m.id ?? et(), this.isOpen = !1, this.shouldRender = !1, this.listeners = {}, this.component = u, this.props = m.props, this.response = m, this.config = p ?? {}, this.onCloseCallback = g, this.afterLeaveCallback = x, de[this.id]) {
208
+ if (this.id = m.id ?? et(), this.isOpen = !1, this.shouldRender = !1, this.listeners = {}, this.component = u, this.props = yt(m.props), this.response = m, this.config = p ?? {}, this.onCloseCallback = g, this.afterLeaveCallback = y, de[this.id]) {
187
209
  this.config = {
188
210
  ...this.config,
189
211
  ...de[this.id].config ?? {}
@@ -191,8 +213,8 @@ const Ln = ({ children: e }) => {
191
213
  const h = de[this.id].onClose, $ = de[this.id].onAfterLeave;
192
214
  h && (this.onCloseCallback = g ? () => {
193
215
  g(), h();
194
- } : h), $ && (this.afterLeaveCallback = x ? () => {
195
- x(), $();
216
+ } : h), $ && (this.afterLeaveCallback = y ? () => {
217
+ y(), $();
196
218
  } : $), delete de[this.id];
197
219
  }
198
220
  this.index = -1, this.getParentModal = () => null, this.getChildModal = () => null, this.onTopOfStack = !0;
@@ -202,8 +224,8 @@ const Ln = ({ children: e }) => {
202
224
  }
203
225
  }
204
226
  const s = (v, u = {}, m = null, p = null) => kt(v.component).then((g) => i(g, v, u, m, p)), i = (v, u, m, p, g) => {
205
- const x = new a(v, u, m, p, g);
206
- return x.index = t.length, o((h) => [...h, x]), x.show(), x;
227
+ const y = new a(v, u, m, p, g);
228
+ return y.index = t.length, o((h) => [...h, y]), y.show(), y;
207
229
  };
208
230
  function c(v, u, m, p) {
209
231
  if (!r[v])
@@ -211,7 +233,7 @@ const Ln = ({ children: e }) => {
211
233
  const g = i(null, {}, u, m, p);
212
234
  return g.name = v, r[v].callback(g), g;
213
235
  }
214
- const f = (v, u = {}) => y(
236
+ const f = (v, u = {}) => x(
215
237
  v,
216
238
  u.method ?? "get",
217
239
  u.data ?? {},
@@ -224,41 +246,41 @@ const Ln = ({ children: e }) => {
224
246
  ).then((m) => {
225
247
  const p = u.listeners ?? {};
226
248
  return Object.keys(p).forEach((g) => {
227
- const x = we(g);
228
- m.on(x, p[g]);
249
+ const y = we(g);
250
+ m.on(y, p[g]);
229
251
  }), m;
230
- }), y = (v, u, m = {}, p = {}, g = {}, x = null, h = null, $ = "brackets", F = !1) => {
252
+ }), x = (v, u, m = {}, p = {}, g = {}, y = null, h = null, $ = "brackets", F = !1) => {
231
253
  const j = et();
232
- return new Promise((_, N) => {
254
+ return new Promise((_, A) => {
233
255
  if (v.startsWith("#")) {
234
- _(c(v.substring(1), g, x, h));
256
+ _(c(v.substring(1), g, y, h));
235
257
  return;
236
258
  }
237
- const [U, B] = bn(u, v || "", m, $);
259
+ const [U, B] = $n(u, v || "", m, $);
238
260
  let X = F && t.length === 0;
239
261
  if (t.length === 0 && ($e = typeof window < "u" ? window.location.href : ""), p = {
240
262
  ...p,
241
263
  Accept: "text/html, application/xhtml+xml",
242
264
  "X-Requested-With": "XMLHttpRequest",
243
265
  "X-Inertia": !0,
244
- "X-Inertia-Version": Ct,
266
+ "X-Inertia-Version": At,
245
267
  "X-InertiaUI-Modal": j,
246
268
  "X-InertiaUI-Modal-Use-Router": X ? 1 : 0,
247
269
  "X-InertiaUI-Modal-Base-Url": $e
248
270
  }, X)
249
271
  return rt = null, de[j] = {
250
272
  config: g,
251
- onClose: x,
273
+ onClose: y,
252
274
  onAfterLeave: h
253
- }, xe.visit(U, {
275
+ }, ye.visit(U, {
254
276
  method: u,
255
277
  data: B,
256
278
  headers: p,
257
279
  preserveScroll: !0,
258
280
  preserveState: !0,
259
- onError: N,
281
+ onError: A,
260
282
  onFinish: () => {
261
- Mn(() => rt).then(_);
283
+ Ln(() => rt).then(_);
262
284
  }
263
285
  });
264
286
  De({
@@ -266,8 +288,8 @@ const Ln = ({ children: e }) => {
266
288
  method: u,
267
289
  data: B,
268
290
  headers: p
269
- }).then((P) => _(s(P.data, g, x, h))).catch((P) => {
270
- N(P);
291
+ }).then((P) => _(s(P.data, g, y, h))).catch((P) => {
292
+ A(P);
271
293
  });
272
294
  });
273
295
  }, d = {
@@ -280,7 +302,7 @@ const Ln = ({ children: e }) => {
280
302
  Ie.reverse().forEach((v) => v.close());
281
303
  },
282
304
  reset: () => o(() => []),
283
- visit: y,
305
+ visit: x,
284
306
  visitModal: f,
285
307
  registerLocalModal: (v, u) => {
286
308
  l((m) => ({
@@ -301,20 +323,20 @@ const Ln = ({ children: e }) => {
301
323
  if (e === null)
302
324
  throw new Error("useModalStack must be used within a ModalStackProvider");
303
325
  return e;
304
- }, xt = ["closeButton", "closeExplicitly", "maxWidth", "paddingClasses", "panelClasses", "position", "slideover"], Sn = (e) => {
305
- e.initialPage && (Ct = e.initialPage.version), e.resolveComponent && (kt = e.resolveComponent);
306
- }, Fl = (e, t) => (Sn(t), /* @__PURE__ */ T(Ln, { children: /* @__PURE__ */ T(e, { ...t, children: ({ Component: r, props: l, key: o }) => /* @__PURE__ */ se(dt, { children: [
326
+ }, bt = ["closeButton", "closeExplicitly", "maxWidth", "paddingClasses", "panelClasses", "position", "slideover"], Fn = (e) => {
327
+ e.initialPage && (At = e.initialPage.version), e.resolveComponent && (kt = e.resolveComponent);
328
+ }, Cl = (e, t) => (Fn(t), /* @__PURE__ */ T(Sn, { children: /* @__PURE__ */ T(e, { ...t, children: ({ Component: r, props: l, key: o }) => /* @__PURE__ */ se(dt, { children: [
307
329
  (() => {
308
330
  const s = Re(r, { key: o, ...l });
309
331
  return typeof r.layout == "function" ? r.layout(s) : Array.isArray(r.layout) ? r.layout.concat(s).reverse().reduce((c, f) => Re(f, l, c)) : s;
310
332
  })(),
311
- /* @__PURE__ */ T(Fn, {})
312
- ] }) }) })), Fn = ({ children: e }) => {
333
+ /* @__PURE__ */ T(Cn, {})
334
+ ] }) }) })), Cn = ({ children: e }) => {
313
335
  var s;
314
336
  const t = R(Be);
315
337
  let n = !1, r = !1;
316
- M(() => xe.on("start", () => n = !0), []), M(() => xe.on("finish", () => n = !1), []), M(
317
- () => xe.on("navigate", function(i) {
338
+ M(() => ye.on("start", () => n = !0), []), M(() => ye.on("finish", () => n = !1), []), M(
339
+ () => ye.on("navigate", function(i) {
318
340
  const c = i.detail.page.props._inertiaui_modal;
319
341
  if (!c) {
320
342
  r && t.closeAll();
@@ -325,7 +347,7 @@ const Ln = ({ children: e }) => {
325
347
  console.error("No base url in modal response data so cannot navigate back");
326
348
  return;
327
349
  }
328
- !n && window.location.href !== c.baseUrl && xe.visit(c.baseUrl, {
350
+ !n && window.location.href !== c.baseUrl && ye.visit(c.baseUrl, {
329
351
  preserveScroll: !0,
330
352
  preserveState: !0
331
353
  });
@@ -337,23 +359,23 @@ const Ln = ({ children: e }) => {
337
359
  );
338
360
  const l = (i) => (Ie.length && (i.headers["X-InertiaUI-Modal-Base-Url"] = $e), i);
339
361
  M(() => (De.interceptors.request.use(l), () => De.interceptors.request.eject(l)), []);
340
- const o = xn(), a = O();
362
+ const o = En(), a = O();
341
363
  return M(() => {
342
- var f, y;
364
+ var f, x;
343
365
  const i = (f = o.props) == null ? void 0 : f._inertiaui_modal, c = a.current;
344
- a.current = i, i && c && i.component === c.component && Tn(i.url, c.url) && ((y = t.stack[0]) == null || y.updateProps(i.props ?? {}));
366
+ a.current = i, i && c && i.component === c.component && Pn(i.url, c.url) && ((x = t.stack[0]) == null || x.updateProps(i.props ?? {}));
345
367
  }, [(s = o.props) == null ? void 0 : s._inertiaui_modal]), /* @__PURE__ */ se(dt, { children: [
346
368
  e,
347
- t.stack.length > 0 && /* @__PURE__ */ T(At, { index: 0 })
369
+ t.stack.length > 0 && /* @__PURE__ */ T(Rt, { index: 0 })
348
370
  ] });
349
371
  }, mt = E.createContext(null);
350
372
  mt.displayName = "ModalIndexContext";
351
- const Nt = () => {
373
+ const It = () => {
352
374
  const e = E.useContext(mt);
353
375
  if (e === void 0)
354
376
  throw new Error("useModalIndex must be used within a ModalIndexProvider");
355
377
  return e;
356
- }, At = ({ index: e }) => {
378
+ }, Rt = ({ index: e }) => {
357
379
  const { stack: t } = Xe(), n = C(() => t[e], [t, e]);
358
380
  return (n == null ? void 0 : n.component) && /* @__PURE__ */ T(mt.Provider, { value: e, children: /* @__PURE__ */ T(
359
381
  n.component,
@@ -362,8 +384,8 @@ const Nt = () => {
362
384
  onModalEvent: (...r) => n.emit(...r)
363
385
  }
364
386
  ) });
365
- }, It = ct(({ name: e, children: t, onFocus: n = null, onBlur: r = null, onClose: l = null, onSuccess: o = null, ...a }, s) => {
366
- const i = Nt(), { stack: c, registerLocalModal: f, removeLocalModal: y } = Xe(), [b, w] = S(null), d = C(() => e ? b : c[i], [e, b, i, c]), v = C(() => {
387
+ }, Dt = ct(({ name: e, children: t, onFocus: n = null, onBlur: r = null, onClose: l = null, onSuccess: o = null, ...a }, s) => {
388
+ const i = It(), { stack: c, registerLocalModal: f, removeLocalModal: x } = Xe(), [b, w] = S(null), d = C(() => e ? b : c[i], [e, b, i, c]), v = C(() => {
367
389
  var h;
368
390
  return (h = c.find(($) => $.shouldRender && $.index > (d == null ? void 0 : d.index))) == null ? void 0 : h.index;
369
391
  }, [i, c]), u = C(() => (d == null ? void 0 : d.config.slideover) ?? a.slideover ?? ft("type") === "slideover", [a.slideover]), m = C(
@@ -385,7 +407,7 @@ const Nt = () => {
385
407
  return f(e, ($) => {
386
408
  h = $.registerEventListenersFromProps(a), w($);
387
409
  }), () => {
388
- h == null || h(), h = null, y(e);
410
+ h == null || h(), h = null, x(e);
389
411
  };
390
412
  }
391
413
  return d.registerEventListenersFromProps(a);
@@ -396,10 +418,10 @@ const Nt = () => {
396
418
  }, [d]), M(() => {
397
419
  d !== null && (d.isOpen ? o == null || o() : l == null || l());
398
420
  }, [d == null ? void 0 : d.isOpen]);
399
- const [g, x] = S(!1);
421
+ const [g, y] = S(!1);
400
422
  return M(() => {
401
- g && d !== null && d.isOpen && (d.onTopOfStack ? n == null || n() : r == null || r()), x(!0);
402
- }, [d == null ? void 0 : d.onTopOfStack]), St(
423
+ g && d !== null && d.isOpen && (d.onTopOfStack ? n == null || n() : r == null || r()), y(!0);
424
+ }, [d == null ? void 0 : d.onTopOfStack]), Ft(
403
425
  s,
404
426
  () => ({
405
427
  afterLeave: () => {
@@ -476,25 +498,25 @@ const Nt = () => {
476
498
  setOpen: d.setOpen,
477
499
  shouldRender: d.shouldRender
478
500
  }) : t,
479
- v && /* @__PURE__ */ T(At, { index: v })
501
+ v && /* @__PURE__ */ T(Rt, { index: v })
480
502
  ] });
481
503
  });
482
- It.displayName = "HeadlessModal";
483
- function Rt(e) {
504
+ Dt.displayName = "HeadlessModal";
505
+ function jt(e) {
484
506
  var t, n, r = "";
485
507
  if (typeof e == "string" || typeof e == "number") r += e;
486
508
  else if (typeof e == "object") if (Array.isArray(e)) {
487
509
  var l = e.length;
488
- for (t = 0; t < l; t++) e[t] && (n = Rt(e[t])) && (r && (r += " "), r += n);
510
+ for (t = 0; t < l; t++) e[t] && (n = jt(e[t])) && (r && (r += " "), r += n);
489
511
  } else for (n in e) e[n] && (r && (r += " "), r += n);
490
512
  return r;
491
513
  }
492
514
  function je() {
493
- for (var e, t, n = 0, r = "", l = arguments.length; n < l; n++) (e = arguments[n]) && (t = Rt(e)) && (r && (r += " "), r += t);
515
+ for (var e, t, n = 0, r = "", l = arguments.length; n < l; n++) (e = arguments[n]) && (t = jt(e)) && (r && (r += " "), r += t);
494
516
  return r;
495
517
  }
496
- var Cn = Object.defineProperty, kn = (e, t, n) => t in e ? Cn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, tt = (e, t, n) => (kn(e, typeof t != "symbol" ? t + "" : t, n), n);
497
- let Nn = class {
518
+ var Nn = Object.defineProperty, An = (e, t, n) => t in e ? Nn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, tt = (e, t, n) => (An(e, typeof t != "symbol" ? t + "" : t, n), n);
519
+ let kn = class {
498
520
  constructor() {
499
521
  tt(this, "current", this.detect()), tt(this, "handoffState", "pending"), tt(this, "currentId", 0);
500
522
  }
@@ -522,7 +544,7 @@ let Nn = class {
522
544
  get isHandoffComplete() {
523
545
  return this.handoffState === "complete";
524
546
  }
525
- }, ae = new Nn();
547
+ }, ae = new kn();
526
548
  function Ve(e) {
527
549
  return ae.isServer ? null : e instanceof Node ? e.ownerDocument : e != null && e.hasOwnProperty("current") && e.current instanceof Node ? e.current.ownerDocument : document;
528
550
  }
@@ -571,21 +593,21 @@ function pt() {
571
593
  let [e] = S(re);
572
594
  return M(() => () => e.dispose(), [e]), e;
573
595
  }
574
- let A = (e, t) => {
575
- ae.isServer ? M(e, t) : pn(e, t);
596
+ let k = (e, t) => {
597
+ ae.isServer ? M(e, t) : vn(e, t);
576
598
  };
577
599
  function ue(e) {
578
600
  let t = O(e);
579
- return A(() => {
601
+ return k(() => {
580
602
  t.current = e;
581
603
  }, [e]), t;
582
604
  }
583
605
  let L = function(e) {
584
606
  let t = ue(e);
585
607
  return E.useCallback((...n) => t.current(...n), [t]);
586
- }, An = H(void 0);
587
- function In() {
588
- return R(An);
608
+ }, In = H(void 0);
609
+ function Rn() {
610
+ return R(In);
589
611
  }
590
612
  function lt(...e) {
591
613
  return Array.from(new Set(e.flatMap((t) => typeof t == "string" ? t.split(" ") : []))).filter(Boolean).join(" ");
@@ -600,53 +622,53 @@ function ne(e, t, ...n) {
600
622
  }
601
623
  var Ue = ((e) => (e[e.None = 0] = "None", e[e.RenderStrategy = 1] = "RenderStrategy", e[e.Static = 2] = "Static", e))(Ue || {}), te = ((e) => (e[e.Unmount = 0] = "Unmount", e[e.Hidden = 1] = "Hidden", e))(te || {});
602
624
  function W() {
603
- let e = Dn();
604
- return Y((t) => Rn({ mergeRefs: e, ...t }), [e]);
625
+ let e = jn();
626
+ return Y((t) => Dn({ mergeRefs: e, ...t }), [e]);
605
627
  }
606
- function Rn({ ourProps: e, theirProps: t, slot: n, defaultTag: r, features: l, visible: o = !0, name: a, mergeRefs: s }) {
607
- s = s ?? jn;
608
- let i = Dt(t, e);
609
- if (o) return Ae(i, n, r, a, s);
628
+ function Dn({ ourProps: e, theirProps: t, slot: n, defaultTag: r, features: l, visible: o = !0, name: a, mergeRefs: s }) {
629
+ s = s ?? Un;
630
+ let i = Ut(t, e);
631
+ if (o) return ke(i, n, r, a, s);
610
632
  let c = l ?? 0;
611
633
  if (c & 2) {
612
- let { static: f = !1, ...y } = i;
613
- if (f) return Ae(y, n, r, a, s);
634
+ let { static: f = !1, ...x } = i;
635
+ if (f) return ke(x, n, r, a, s);
614
636
  }
615
637
  if (c & 1) {
616
- let { unmount: f = !0, ...y } = i;
638
+ let { unmount: f = !0, ...x } = i;
617
639
  return ne(f ? 0 : 1, { 0() {
618
640
  return null;
619
641
  }, 1() {
620
- return Ae({ ...y, hidden: !0, style: { display: "none" } }, n, r, a, s);
642
+ return ke({ ...x, hidden: !0, style: { display: "none" } }, n, r, a, s);
621
643
  } });
622
644
  }
623
- return Ae(i, n, r, a, s);
645
+ return ke(i, n, r, a, s);
624
646
  }
625
- function Ae(e, t = {}, n, r, l) {
647
+ function ke(e, t = {}, n, r, l) {
626
648
  let { as: o = n, children: a, refName: s = "ref", ...i } = nt(e, ["unmount", "static"]), c = e.ref !== void 0 ? { [s]: e.ref } : {}, f = typeof a == "function" ? a(t) : a;
627
649
  "className" in i && i.className && typeof i.className == "function" && (i.className = i.className(t)), i["aria-labelledby"] && i["aria-labelledby"] === i.id && (i["aria-labelledby"] = void 0);
628
- let y = {};
650
+ let x = {};
629
651
  if (t) {
630
652
  let b = !1, w = [];
631
653
  for (let [d, v] of Object.entries(t)) typeof v == "boolean" && (b = !0), v === !0 && w.push(d.replace(/([A-Z])/g, (u) => `-${u.toLowerCase()}`));
632
654
  if (b) {
633
- y["data-headlessui-state"] = w.join(" ");
634
- for (let d of w) y[`data-${d}`] = "";
655
+ x["data-headlessui-state"] = w.join(" ");
656
+ for (let d of w) x[`data-${d}`] = "";
635
657
  }
636
658
  }
637
- if (o === G && (Object.keys(le(i)).length > 0 || Object.keys(le(y)).length > 0)) if (!hn(f) || Array.isArray(f) && f.length > 1) {
638
- if (Object.keys(le(i)).length > 0) throw new Error(['Passing props on "Fragment"!', "", `The current component <${r} /> is rendering a "Fragment".`, "However we need to passthrough the following props:", Object.keys(le(i)).concat(Object.keys(le(y))).map((b) => ` - ${b}`).join(`
659
+ if (o === G && (Object.keys(le(i)).length > 0 || Object.keys(le(x)).length > 0)) if (!gn(f) || Array.isArray(f) && f.length > 1) {
660
+ if (Object.keys(le(i)).length > 0) throw new Error(['Passing props on "Fragment"!', "", `The current component <${r} /> is rendering a "Fragment".`, "However we need to passthrough the following props:", Object.keys(le(i)).concat(Object.keys(le(x))).map((b) => ` - ${b}`).join(`
639
661
  `), "", "You can apply a few solutions:", ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".', "Render a single element as the child so that we can forward the props onto that element."].map((b) => ` - ${b}`).join(`
640
662
  `)].join(`
641
663
  `));
642
664
  } else {
643
- let b = f.props, w = b == null ? void 0 : b.className, d = typeof w == "function" ? (...m) => lt(w(...m), i.className) : lt(w, i.className), v = d ? { className: d } : {}, u = Dt(f.props, le(nt(i, ["ref"])));
644
- for (let m in y) m in u && delete y[m];
645
- return vn(f, Object.assign({}, u, y, c, { ref: l(Un(f), c.ref) }, v));
665
+ let b = f.props, w = b == null ? void 0 : b.className, d = typeof w == "function" ? (...m) => lt(w(...m), i.className) : lt(w, i.className), v = d ? { className: d } : {}, u = Ut(f.props, le(nt(i, ["ref"])));
666
+ for (let m in x) m in u && delete x[m];
667
+ return wn(f, Object.assign({}, u, x, c, { ref: l(Hn(f), c.ref) }, v));
646
668
  }
647
- return Re(o, Object.assign({}, nt(i, ["ref"]), o !== G && c, o !== G && y), f);
669
+ return Re(o, Object.assign({}, nt(i, ["ref"]), o !== G && c, o !== G && x), f);
648
670
  }
649
- function Dn() {
671
+ function jn() {
650
672
  let e = O([]), t = Y((n) => {
651
673
  for (let r of e.current) r != null && (typeof r == "function" ? r(n) : r.current = n);
652
674
  }, []);
@@ -654,12 +676,12 @@ function Dn() {
654
676
  if (!n.every((r) => r == null)) return e.current = n, t;
655
677
  };
656
678
  }
657
- function jn(...e) {
679
+ function Un(...e) {
658
680
  return e.every((t) => t == null) ? void 0 : (t) => {
659
681
  for (let n of e) n != null && (typeof n == "function" ? n(t) : n.current = t);
660
682
  };
661
683
  }
662
- function Dt(...e) {
684
+ function Ut(...e) {
663
685
  if (e.length === 0) return {};
664
686
  if (e.length === 1) return e[0];
665
687
  let t = {}, n = {};
@@ -691,19 +713,19 @@ function nt(e, t = []) {
691
713
  for (let r of t) r in n && delete n[r];
692
714
  return n;
693
715
  }
694
- function Un(e) {
716
+ function Hn(e) {
695
717
  return E.version.split(".")[0] >= "19" ? e.props.ref : e.ref;
696
718
  }
697
- let Hn = "span";
719
+ let Wn = "span";
698
720
  var He = ((e) => (e[e.None = 1] = "None", e[e.Focusable = 2] = "Focusable", e[e.Hidden = 4] = "Hidden", e))(He || {});
699
- function Wn(e, t) {
721
+ function _n(e, t) {
700
722
  var n;
701
723
  let { features: r = 1, ...l } = e, o = { ref: t, "aria-hidden": (r & 2) === 2 ? !0 : (n = l["aria-hidden"]) != null ? n : void 0, hidden: (r & 4) === 4 ? !0 : void 0, style: { position: "fixed", top: 1, left: 1, width: 1, height: 0, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0", ...(r & 4) === 4 && (r & 2) !== 2 && { display: "none" } } };
702
- return W()({ ourProps: o, theirProps: l, slot: {}, defaultTag: Hn, name: "Hidden" });
724
+ return W()({ ourProps: o, theirProps: l, slot: {}, defaultTag: Wn, name: "Hidden" });
703
725
  }
704
- let it = D(Wn), jt = Symbol();
705
- function _n(e, t = !0) {
706
- return Object.assign(e, { [jt]: t });
726
+ let it = D(_n), Ht = Symbol();
727
+ function Bn(e, t = !0) {
728
+ return Object.assign(e, { [Ht]: t });
707
729
  }
708
730
  function Z(...e) {
709
731
  let t = O(e);
@@ -713,19 +735,19 @@ function Z(...e) {
713
735
  let n = L((r) => {
714
736
  for (let l of t.current) l != null && (typeof l == "function" ? l(r) : l.current = r);
715
737
  });
716
- return e.every((r) => r == null || (r == null ? void 0 : r[jt])) ? void 0 : n;
738
+ return e.every((r) => r == null || (r == null ? void 0 : r[Ht])) ? void 0 : n;
717
739
  }
718
740
  let ht = H(null);
719
741
  ht.displayName = "DescriptionContext";
720
- function Ut() {
742
+ function Wt() {
721
743
  let e = R(ht);
722
744
  if (e === null) {
723
745
  let t = new Error("You used a <Description /> component, but it is not inside a relevant parent.");
724
- throw Error.captureStackTrace && Error.captureStackTrace(t, Ut), t;
746
+ throw Error.captureStackTrace && Error.captureStackTrace(t, Wt), t;
725
747
  }
726
748
  return e;
727
749
  }
728
- function Bn() {
750
+ function Xn() {
729
751
  let [e, t] = S([]);
730
752
  return [e.length > 0 ? e.join(" ") : void 0, C(() => function(n) {
731
753
  let r = L((o) => (t((a) => [...a, o]), () => t((a) => {
@@ -735,21 +757,21 @@ function Bn() {
735
757
  return E.createElement(ht.Provider, { value: l }, n.children);
736
758
  }, [t])];
737
759
  }
738
- let Xn = "p";
739
- function Vn(e, t) {
740
- let n = Pe(), r = In(), { id: l = `headlessui-description-${n}`, ...o } = e, a = Ut(), s = Z(t);
741
- A(() => a.register(l), [l, a.register]);
760
+ let Vn = "p";
761
+ function qn(e, t) {
762
+ let n = Pe(), r = Rn(), { id: l = `headlessui-description-${n}`, ...o } = e, a = Wt(), s = Z(t);
763
+ k(() => a.register(l), [l, a.register]);
742
764
  let i = r || !1, c = C(() => ({ ...a.slot, disabled: i }), [a.slot, i]), f = { ref: s, ...a.props, id: l };
743
- return W()({ ourProps: f, theirProps: o, slot: c, defaultTag: Xn, name: a.name || "Description" });
765
+ return W()({ ourProps: f, theirProps: o, slot: c, defaultTag: Vn, name: a.name || "Description" });
744
766
  }
745
- let qn = D(Vn), Yn = Object.assign(qn, {});
746
- var Ht = ((e) => (e.Space = " ", e.Enter = "Enter", e.Escape = "Escape", e.Backspace = "Backspace", e.Delete = "Delete", e.ArrowLeft = "ArrowLeft", e.ArrowUp = "ArrowUp", e.ArrowRight = "ArrowRight", e.ArrowDown = "ArrowDown", e.Home = "Home", e.End = "End", e.PageUp = "PageUp", e.PageDown = "PageDown", e.Tab = "Tab", e))(Ht || {});
747
- let zn = H(() => {
767
+ let Yn = D(qn), zn = Object.assign(Yn, {});
768
+ var _t = ((e) => (e.Space = " ", e.Enter = "Enter", e.Escape = "Escape", e.Backspace = "Backspace", e.Delete = "Delete", e.ArrowLeft = "ArrowLeft", e.ArrowUp = "ArrowUp", e.ArrowRight = "ArrowRight", e.ArrowDown = "ArrowDown", e.Home = "Home", e.End = "End", e.PageUp = "PageUp", e.PageDown = "PageDown", e.Tab = "Tab", e))(_t || {});
769
+ let Gn = H(() => {
748
770
  });
749
- function Gn({ value: e, children: t }) {
750
- return E.createElement(zn.Provider, { value: e }, t);
771
+ function Kn({ value: e, children: t }) {
772
+ return E.createElement(Gn.Provider, { value: e }, t);
751
773
  }
752
- let Kn = class extends Map {
774
+ let Zn = class extends Map {
753
775
  constructor(t) {
754
776
  super(), this.factory = t;
755
777
  }
@@ -758,7 +780,7 @@ let Kn = class extends Map {
758
780
  return n === void 0 && (n = this.factory(t), this.set(t, n)), n;
759
781
  }
760
782
  };
761
- function Wt(e, t) {
783
+ function Bt(e, t) {
762
784
  let n = e(), r = /* @__PURE__ */ new Set();
763
785
  return { getSnapshot() {
764
786
  return n;
@@ -769,10 +791,10 @@ function Wt(e, t) {
769
791
  a && (n = a, r.forEach((s) => s()));
770
792
  } };
771
793
  }
772
- function _t(e) {
773
- return gn(e.subscribe, e.getSnapshot, e.getSnapshot);
794
+ function Xt(e) {
795
+ return xn(e.subscribe, e.getSnapshot, e.getSnapshot);
774
796
  }
775
- let Zn = new Kn(() => Wt(() => [], { ADD(e) {
797
+ let Jn = new Zn(() => Bt(() => [], { ADD(e) {
776
798
  return this.includes(e) ? this : [...this, e];
777
799
  }, REMOVE(e) {
778
800
  let t = this.indexOf(e);
@@ -781,33 +803,33 @@ let Zn = new Kn(() => Wt(() => [], { ADD(e) {
781
803
  return n.splice(t, 1), n;
782
804
  } }));
783
805
  function fe(e, t) {
784
- let n = Zn.get(t), r = Pe(), l = _t(n);
785
- if (A(() => {
806
+ let n = Jn.get(t), r = Pe(), l = Xt(n);
807
+ if (k(() => {
786
808
  if (e) return n.dispatch("ADD", r), () => n.dispatch("REMOVE", r);
787
809
  }, [n, e]), !e) return !1;
788
810
  let o = l.indexOf(r), a = l.length;
789
811
  return o === -1 && (o = a, a += 1), o === a - 1;
790
812
  }
791
813
  let ot = /* @__PURE__ */ new Map(), Te = /* @__PURE__ */ new Map();
792
- function bt(e) {
814
+ function Et(e) {
793
815
  var t;
794
816
  let n = (t = Te.get(e)) != null ? t : 0;
795
- return Te.set(e, n + 1), n !== 0 ? () => Et(e) : (ot.set(e, { "aria-hidden": e.getAttribute("aria-hidden"), inert: e.inert }), e.setAttribute("aria-hidden", "true"), e.inert = !0, () => Et(e));
817
+ return Te.set(e, n + 1), n !== 0 ? () => $t(e) : (ot.set(e, { "aria-hidden": e.getAttribute("aria-hidden"), inert: e.inert }), e.setAttribute("aria-hidden", "true"), e.inert = !0, () => $t(e));
796
818
  }
797
- function Et(e) {
819
+ function $t(e) {
798
820
  var t;
799
821
  let n = (t = Te.get(e)) != null ? t : 1;
800
822
  if (n === 1 ? Te.delete(e) : Te.set(e, n - 1), n !== 1) return;
801
823
  let r = ot.get(e);
802
824
  r && (r["aria-hidden"] === null ? e.removeAttribute("aria-hidden") : e.setAttribute("aria-hidden", r["aria-hidden"]), e.inert = r.inert, ot.delete(e));
803
825
  }
804
- function Jn(e, { allowed: t, disallowed: n } = {}) {
826
+ function Qn(e, { allowed: t, disallowed: n } = {}) {
805
827
  let r = fe(e, "inert-others");
806
- A(() => {
828
+ k(() => {
807
829
  var l, o;
808
830
  if (!r) return;
809
831
  let a = re();
810
- for (let i of (l = n == null ? void 0 : n()) != null ? l : []) i && a.add(bt(i));
832
+ for (let i of (l = n == null ? void 0 : n()) != null ? l : []) i && a.add(Et(i));
811
833
  let s = (o = t == null ? void 0 : t()) != null ? o : [];
812
834
  for (let i of s) {
813
835
  if (!i) continue;
@@ -815,14 +837,14 @@ function Jn(e, { allowed: t, disallowed: n } = {}) {
815
837
  if (!c) continue;
816
838
  let f = i.parentElement;
817
839
  for (; f && f !== c.body; ) {
818
- for (let y of f.children) s.some((b) => y.contains(b)) || a.add(bt(y));
840
+ for (let x of f.children) s.some((b) => x.contains(b)) || a.add(Et(x));
819
841
  f = f.parentElement;
820
842
  }
821
843
  }
822
844
  return a.dispose;
823
845
  }, [r, t, n]);
824
846
  }
825
- function Qn(e, t, n) {
847
+ function er(e, t, n) {
826
848
  let r = ue((l) => {
827
849
  let o = l.getBoundingClientRect();
828
850
  o.x === 0 && o.y === 0 && o.width === 0 && o.height === 0 && n();
@@ -843,16 +865,16 @@ function Qn(e, t, n) {
843
865
  return () => o.dispose();
844
866
  }, [t, r, e]);
845
867
  }
846
- let We = ["[contentEditable=true]", "[tabindex]", "a[href]", "area[href]", "button:not([disabled])", "iframe", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].map((e) => `${e}:not([tabindex='-1'])`).join(","), er = ["[data-autofocus]"].map((e) => `${e}:not([tabindex='-1'])`).join(",");
847
- var J = ((e) => (e[e.First = 1] = "First", e[e.Previous = 2] = "Previous", e[e.Next = 4] = "Next", e[e.Last = 8] = "Last", e[e.WrapAround = 16] = "WrapAround", e[e.NoScroll = 32] = "NoScroll", e[e.AutoFocus = 64] = "AutoFocus", e))(J || {}), at = ((e) => (e[e.Error = 0] = "Error", e[e.Overflow = 1] = "Overflow", e[e.Success = 2] = "Success", e[e.Underflow = 3] = "Underflow", e))(at || {}), tr = ((e) => (e[e.Previous = -1] = "Previous", e[e.Next = 1] = "Next", e))(tr || {});
848
- function nr(e = document.body) {
868
+ let We = ["[contentEditable=true]", "[tabindex]", "a[href]", "area[href]", "button:not([disabled])", "iframe", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].map((e) => `${e}:not([tabindex='-1'])`).join(","), tr = ["[data-autofocus]"].map((e) => `${e}:not([tabindex='-1'])`).join(",");
869
+ var J = ((e) => (e[e.First = 1] = "First", e[e.Previous = 2] = "Previous", e[e.Next = 4] = "Next", e[e.Last = 8] = "Last", e[e.WrapAround = 16] = "WrapAround", e[e.NoScroll = 32] = "NoScroll", e[e.AutoFocus = 64] = "AutoFocus", e))(J || {}), at = ((e) => (e[e.Error = 0] = "Error", e[e.Overflow = 1] = "Overflow", e[e.Success = 2] = "Success", e[e.Underflow = 3] = "Underflow", e))(at || {}), nr = ((e) => (e[e.Previous = -1] = "Previous", e[e.Next = 1] = "Next", e))(nr || {});
870
+ function rr(e = document.body) {
849
871
  return e == null ? [] : Array.from(e.querySelectorAll(We)).sort((t, n) => Math.sign((t.tabIndex || Number.MAX_SAFE_INTEGER) - (n.tabIndex || Number.MAX_SAFE_INTEGER)));
850
872
  }
851
- function rr(e = document.body) {
852
- return e == null ? [] : Array.from(e.querySelectorAll(er)).sort((t, n) => Math.sign((t.tabIndex || Number.MAX_SAFE_INTEGER) - (n.tabIndex || Number.MAX_SAFE_INTEGER)));
873
+ function lr(e = document.body) {
874
+ return e == null ? [] : Array.from(e.querySelectorAll(tr)).sort((t, n) => Math.sign((t.tabIndex || Number.MAX_SAFE_INTEGER) - (n.tabIndex || Number.MAX_SAFE_INTEGER)));
853
875
  }
854
- var Bt = ((e) => (e[e.Strict = 0] = "Strict", e[e.Loose = 1] = "Loose", e))(Bt || {});
855
- function lr(e, t = 0) {
876
+ var Vt = ((e) => (e[e.Strict = 0] = "Strict", e[e.Loose = 1] = "Loose", e))(Vt || {});
877
+ function ir(e, t = 0) {
856
878
  var n;
857
879
  return e === ((n = Ve(e)) == null ? void 0 : n.body) ? !1 : ne(t, { 0() {
858
880
  return e.matches(We);
@@ -865,7 +887,7 @@ function lr(e, t = 0) {
865
887
  return !1;
866
888
  } });
867
889
  }
868
- var ir = ((e) => (e[e.Keyboard = 0] = "Keyboard", e[e.Mouse = 1] = "Mouse", e))(ir || {});
890
+ var or = ((e) => (e[e.Keyboard = 0] = "Keyboard", e[e.Mouse = 1] = "Mouse", e))(or || {});
869
891
  typeof window < "u" && typeof document < "u" && (document.addEventListener("keydown", (e) => {
870
892
  e.metaKey || e.altKey || e.ctrlKey || (document.documentElement.dataset.headlessuiFocusVisible = "");
871
893
  }, !0), document.addEventListener("click", (e) => {
@@ -874,12 +896,12 @@ typeof window < "u" && typeof document < "u" && (document.addEventListener("keyd
874
896
  function Q(e) {
875
897
  e == null || e.focus({ preventScroll: !0 });
876
898
  }
877
- let or = ["textarea", "input"].join(",");
878
- function ar(e) {
899
+ let ar = ["textarea", "input"].join(",");
900
+ function sr(e) {
879
901
  var t, n;
880
- return (n = (t = e == null ? void 0 : e.matches) == null ? void 0 : t.call(e, or)) != null ? n : !1;
902
+ return (n = (t = e == null ? void 0 : e.matches) == null ? void 0 : t.call(e, ar)) != null ? n : !1;
881
903
  }
882
- function sr(e, t = (n) => n) {
904
+ function ur(e, t = (n) => n) {
883
905
  return e.slice().sort((n, r) => {
884
906
  let l = t(n), o = t(r);
885
907
  if (l === null || o === null) return 0;
@@ -888,7 +910,7 @@ function sr(e, t = (n) => n) {
888
910
  });
889
911
  }
890
912
  function Oe(e, t, { sorted: n = !0, relativeTo: r = null, skipElements: l = [] } = {}) {
891
- let o = Array.isArray(e) ? e.length > 0 ? e[0].ownerDocument : document : e.ownerDocument, a = Array.isArray(e) ? n ? sr(e) : e : t & 64 ? rr(e) : nr(e);
913
+ let o = Array.isArray(e) ? e.length > 0 ? e[0].ownerDocument : document : e.ownerDocument, a = Array.isArray(e) ? n ? ur(e) : e : t & 64 ? lr(e) : rr(e);
892
914
  l.length > 0 && a.length > 1 && (a = a.filter((w) => !l.some((d) => d != null && "current" in d ? (d == null ? void 0 : d.current) === w : d === w))), r = r ?? o.activeElement;
893
915
  let s = (() => {
894
916
  if (t & 5) return 1;
@@ -900,29 +922,29 @@ function Oe(e, t, { sorted: n = !0, relativeTo: r = null, skipElements: l = [] }
900
922
  if (t & 4) return Math.max(0, a.indexOf(r)) + 1;
901
923
  if (t & 8) return a.length - 1;
902
924
  throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
903
- })(), c = t & 32 ? { preventScroll: !0 } : {}, f = 0, y = a.length, b;
925
+ })(), c = t & 32 ? { preventScroll: !0 } : {}, f = 0, x = a.length, b;
904
926
  do {
905
- if (f >= y || f + y <= 0) return 0;
927
+ if (f >= x || f + x <= 0) return 0;
906
928
  let w = i + f;
907
- if (t & 16) w = (w + y) % y;
929
+ if (t & 16) w = (w + x) % x;
908
930
  else {
909
931
  if (w < 0) return 3;
910
- if (w >= y) return 1;
932
+ if (w >= x) return 1;
911
933
  }
912
934
  b = a[w], b == null || b.focus(c), f += s;
913
935
  } while (b !== o.activeElement);
914
- return t & 6 && ar(b) && b.select(), 2;
936
+ return t & 6 && sr(b) && b.select(), 2;
915
937
  }
916
- function Xt() {
938
+ function qt() {
917
939
  return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
918
940
  }
919
- function ur() {
941
+ function cr() {
920
942
  return /Android/gi.test(window.navigator.userAgent);
921
943
  }
922
- function cr() {
923
- return Xt() || ur();
944
+ function dr() {
945
+ return qt() || cr();
924
946
  }
925
- function ye(e, t, n, r) {
947
+ function xe(e, t, n, r) {
926
948
  let l = ue(n);
927
949
  M(() => {
928
950
  if (!e) return;
@@ -932,7 +954,7 @@ function ye(e, t, n, r) {
932
954
  return document.addEventListener(t, o, r), () => document.removeEventListener(t, o, r);
933
955
  }, [e, t, r]);
934
956
  }
935
- function Vt(e, t, n, r) {
957
+ function Yt(e, t, n, r) {
936
958
  let l = ue(n);
937
959
  M(() => {
938
960
  if (!e) return;
@@ -942,39 +964,39 @@ function Vt(e, t, n, r) {
942
964
  return window.addEventListener(t, o, r), () => window.removeEventListener(t, o, r);
943
965
  }, [e, t, r]);
944
966
  }
945
- const $t = 30;
946
- function dr(e, t, n) {
967
+ const Tt = 30;
968
+ function fr(e, t, n) {
947
969
  let r = fe(e, "outside-click"), l = ue(n), o = Y(function(i, c) {
948
970
  if (i.defaultPrevented) return;
949
971
  let f = c(i);
950
972
  if (f === null || !f.getRootNode().contains(f) || !f.isConnected) return;
951
- let y = function b(w) {
973
+ let x = function b(w) {
952
974
  return typeof w == "function" ? b(w()) : Array.isArray(w) || w instanceof Set ? w : [w];
953
975
  }(t);
954
- for (let b of y) if (b !== null && (b.contains(f) || i.composed && i.composedPath().includes(b))) return;
955
- return !lr(f, Bt.Loose) && f.tabIndex !== -1 && i.preventDefault(), l.current(i, f);
976
+ for (let b of x) if (b !== null && (b.contains(f) || i.composed && i.composedPath().includes(b))) return;
977
+ return !ir(f, Vt.Loose) && f.tabIndex !== -1 && i.preventDefault(), l.current(i, f);
956
978
  }, [l, t]), a = O(null);
957
- ye(r, "pointerdown", (i) => {
979
+ xe(r, "pointerdown", (i) => {
958
980
  var c, f;
959
981
  a.current = ((f = (c = i.composedPath) == null ? void 0 : c.call(i)) == null ? void 0 : f[0]) || i.target;
960
- }, !0), ye(r, "mousedown", (i) => {
982
+ }, !0), xe(r, "mousedown", (i) => {
961
983
  var c, f;
962
984
  a.current = ((f = (c = i.composedPath) == null ? void 0 : c.call(i)) == null ? void 0 : f[0]) || i.target;
963
- }, !0), ye(r, "click", (i) => {
964
- cr() || a.current && (o(i, () => a.current), a.current = null);
985
+ }, !0), xe(r, "click", (i) => {
986
+ dr() || a.current && (o(i, () => a.current), a.current = null);
965
987
  }, !0);
966
988
  let s = O({ x: 0, y: 0 });
967
- ye(r, "touchstart", (i) => {
989
+ xe(r, "touchstart", (i) => {
968
990
  s.current.x = i.touches[0].clientX, s.current.y = i.touches[0].clientY;
969
- }, !0), ye(r, "touchend", (i) => {
991
+ }, !0), xe(r, "touchend", (i) => {
970
992
  let c = { x: i.changedTouches[0].clientX, y: i.changedTouches[0].clientY };
971
- if (!(Math.abs(c.x - s.current.x) >= $t || Math.abs(c.y - s.current.y) >= $t)) return o(i, () => i.target instanceof HTMLElement ? i.target : null);
972
- }, !0), Vt(r, "blur", (i) => o(i, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), !0);
993
+ if (!(Math.abs(c.x - s.current.x) >= Tt || Math.abs(c.y - s.current.y) >= Tt)) return o(i, () => i.target instanceof HTMLElement ? i.target : null);
994
+ }, !0), Yt(r, "blur", (i) => o(i, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), !0);
973
995
  }
974
996
  function Me(...e) {
975
997
  return C(() => Ve(...e), [...e]);
976
998
  }
977
- function qt(e, t, n, r) {
999
+ function zt(e, t, n, r) {
978
1000
  let l = ue(n);
979
1001
  M(() => {
980
1002
  e = e ?? window;
@@ -984,7 +1006,7 @@ function qt(e, t, n, r) {
984
1006
  return e.addEventListener(t, o, r), () => e.removeEventListener(t, o, r);
985
1007
  }, [e, t, r]);
986
1008
  }
987
- function fr() {
1009
+ function mr() {
988
1010
  let e;
989
1011
  return { before({ doc: t }) {
990
1012
  var n;
@@ -995,8 +1017,8 @@ function fr() {
995
1017
  n.style(r, "paddingRight", `${o}px`);
996
1018
  } };
997
1019
  }
998
- function mr() {
999
- return Xt() ? { before({ doc: e, d: t, meta: n }) {
1020
+ function pr() {
1021
+ return qt() ? { before({ doc: e, d: t, meta: n }) {
1000
1022
  function r(l) {
1001
1023
  return n.containers.flatMap((o) => o()).some((o) => o.contains(l));
1002
1024
  }
@@ -1038,17 +1060,17 @@ function mr() {
1038
1060
  });
1039
1061
  } } : {};
1040
1062
  }
1041
- function pr() {
1063
+ function hr() {
1042
1064
  return { before({ doc: e, d: t }) {
1043
1065
  t.style(e.documentElement, "overflow", "hidden");
1044
1066
  } };
1045
1067
  }
1046
- function hr(e) {
1068
+ function vr(e) {
1047
1069
  let t = {};
1048
1070
  for (let n of e) Object.assign(t, n(t));
1049
1071
  return t;
1050
1072
  }
1051
- let oe = Wt(() => /* @__PURE__ */ new Map(), { PUSH(e, t) {
1073
+ let oe = Bt(() => /* @__PURE__ */ new Map(), { PUSH(e, t) {
1052
1074
  var n;
1053
1075
  let r = (n = this.get(e)) != null ? n : { doc: e, count: 0, d: re(), meta: /* @__PURE__ */ new Set() };
1054
1076
  return r.count++, r.meta.add(t), this.set(e, r), this;
@@ -1056,7 +1078,7 @@ let oe = Wt(() => /* @__PURE__ */ new Map(), { PUSH(e, t) {
1056
1078
  let n = this.get(e);
1057
1079
  return n && (n.count--, n.meta.delete(t)), this;
1058
1080
  }, SCROLL_PREVENT({ doc: e, d: t, meta: n }) {
1059
- let r = { doc: e, d: t, meta: hr(n) }, l = [mr(), fr(), pr()];
1081
+ let r = { doc: e, d: t, meta: vr(n) }, l = [pr(), mr(), hr()];
1060
1082
  l.forEach(({ before: o }) => o == null ? void 0 : o(r)), l.forEach(({ after: o }) => o == null ? void 0 : o(r));
1061
1083
  }, SCROLL_ALLOW({ d: e }) {
1062
1084
  e.dispose();
@@ -1071,44 +1093,44 @@ oe.subscribe(() => {
1071
1093
  (l && !r || !l && r) && oe.dispatch(n.count > 0 ? "SCROLL_PREVENT" : "SCROLL_ALLOW", n), n.count === 0 && oe.dispatch("TEARDOWN", n);
1072
1094
  }
1073
1095
  });
1074
- function vr(e, t, n = () => ({ containers: [] })) {
1075
- let r = _t(oe), l = t ? r.get(t) : void 0, o = l ? l.count > 0 : !1;
1076
- return A(() => {
1096
+ function gr(e, t, n = () => ({ containers: [] })) {
1097
+ let r = Xt(oe), l = t ? r.get(t) : void 0, o = l ? l.count > 0 : !1;
1098
+ return k(() => {
1077
1099
  if (!(!t || !e)) return oe.dispatch("PUSH", t, n), () => oe.dispatch("POP", t, n);
1078
1100
  }, [e, t]), o;
1079
1101
  }
1080
- function gr(e, t, n = () => [document.body]) {
1102
+ function wr(e, t, n = () => [document.body]) {
1081
1103
  let r = fe(e, "scroll-lock");
1082
- vr(r, t, (l) => {
1104
+ gr(r, t, (l) => {
1083
1105
  var o;
1084
1106
  return { containers: [...(o = l.containers) != null ? o : [], n] };
1085
1107
  });
1086
1108
  }
1087
- function wr(e = 0) {
1109
+ function xr(e = 0) {
1088
1110
  let [t, n] = S(e), r = Y((i) => n(i), [t]), l = Y((i) => n((c) => c | i), [t]), o = Y((i) => (t & i) === i, [t]), a = Y((i) => n((c) => c & ~i), [n]), s = Y((i) => n((c) => c ^ i), [n]);
1089
1111
  return { flags: t, setFlag: r, addFlag: l, hasFlag: o, removeFlag: a, toggleFlag: s };
1090
1112
  }
1091
- var Tt, Ot;
1092
- typeof process < "u" && typeof globalThis < "u" && typeof Element < "u" && ((Tt = process == null ? void 0 : process.env) == null ? void 0 : Tt.NODE_ENV) === "test" && typeof ((Ot = Element == null ? void 0 : Element.prototype) == null ? void 0 : Ot.getAnimations) > "u" && (Element.prototype.getAnimations = function() {
1113
+ var Ot, Pt;
1114
+ typeof process < "u" && typeof globalThis < "u" && typeof Element < "u" && ((Ot = process == null ? void 0 : process.env) == null ? void 0 : Ot.NODE_ENV) === "test" && typeof ((Pt = Element == null ? void 0 : Element.prototype) == null ? void 0 : Pt.getAnimations) > "u" && (Element.prototype.getAnimations = function() {
1093
1115
  return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.", "Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.", "", "Example usage:", "```js", "import { mockAnimationsApi } from 'jsdom-testing-mocks'", "mockAnimationsApi()", "```"].join(`
1094
1116
  `)), [];
1095
1117
  });
1096
1118
  var yr = ((e) => (e[e.None = 0] = "None", e[e.Closed = 1] = "Closed", e[e.Enter = 2] = "Enter", e[e.Leave = 4] = "Leave", e))(yr || {});
1097
- function xr(e) {
1119
+ function br(e) {
1098
1120
  let t = {};
1099
1121
  for (let n in e) e[n] === !0 && (t[`data-${n}`] = "");
1100
1122
  return t;
1101
1123
  }
1102
- function br(e, t, n, r) {
1103
- let [l, o] = S(n), { hasFlag: a, addFlag: s, removeFlag: i } = wr(e && l ? 3 : 0), c = O(!1), f = O(!1), y = pt();
1104
- return A(() => {
1124
+ function Er(e, t, n, r) {
1125
+ let [l, o] = S(n), { hasFlag: a, addFlag: s, removeFlag: i } = xr(e && l ? 3 : 0), c = O(!1), f = O(!1), x = pt();
1126
+ return k(() => {
1105
1127
  var b;
1106
1128
  if (e) {
1107
1129
  if (n && o(!0), !t) {
1108
1130
  n && s(3);
1109
1131
  return;
1110
1132
  }
1111
- return (b = r == null ? void 0 : r.start) == null || b.call(r, n), Er(t, { inFlight: c, prepare() {
1133
+ return (b = r == null ? void 0 : r.start) == null || b.call(r, n), $r(t, { inFlight: c, prepare() {
1112
1134
  f.current ? f.current = !1 : f.current = c.current, c.current = !0, !f.current && (n ? (s(3), i(4)) : (s(4), i(2)));
1113
1135
  }, run() {
1114
1136
  f.current ? n ? (i(3), s(4)) : (i(4), s(3)) : n ? i(1) : s(1);
@@ -1117,17 +1139,17 @@ function br(e, t, n, r) {
1117
1139
  f.current && typeof t.getAnimations == "function" && t.getAnimations().length > 0 || (c.current = !1, i(7), n || o(!1), (w = r == null ? void 0 : r.end) == null || w.call(r, n));
1118
1140
  } });
1119
1141
  }
1120
- }, [e, n, t, y]), e ? [l, { closed: a(1), enter: a(2), leave: a(4), transition: a(2) || a(4) }] : [n, { closed: void 0, enter: void 0, leave: void 0, transition: void 0 }];
1142
+ }, [e, n, t, x]), e ? [l, { closed: a(1), enter: a(2), leave: a(4), transition: a(2) || a(4) }] : [n, { closed: void 0, enter: void 0, leave: void 0, transition: void 0 }];
1121
1143
  }
1122
- function Er(e, { prepare: t, run: n, done: r, inFlight: l }) {
1144
+ function $r(e, { prepare: t, run: n, done: r, inFlight: l }) {
1123
1145
  let o = re();
1124
- return Tr(e, { prepare: t, inFlight: l }), o.nextFrame(() => {
1146
+ return Or(e, { prepare: t, inFlight: l }), o.nextFrame(() => {
1125
1147
  n(), o.requestAnimationFrame(() => {
1126
- o.add($r(e, r));
1148
+ o.add(Tr(e, r));
1127
1149
  });
1128
1150
  }), o.dispose;
1129
1151
  }
1130
- function $r(e, t) {
1152
+ function Tr(e, t) {
1131
1153
  var n, r;
1132
1154
  let l = re();
1133
1155
  if (!e) return l.dispose;
@@ -1140,7 +1162,7 @@ function $r(e, t) {
1140
1162
  o || t();
1141
1163
  }), l.dispose);
1142
1164
  }
1143
- function Tr(e, { inFlight: t, prepare: n }) {
1165
+ function Or(e, { inFlight: t, prepare: n }) {
1144
1166
  if (t != null && t.current) {
1145
1167
  n();
1146
1168
  return;
@@ -1164,20 +1186,20 @@ var z = ((e) => (e[e.Open = 1] = "Open", e[e.Closed = 2] = "Closed", e[e.Closing
1164
1186
  function ze() {
1165
1187
  return R(Ye);
1166
1188
  }
1167
- function Or({ value: e, children: t }) {
1189
+ function Pr({ value: e, children: t }) {
1168
1190
  return E.createElement(Ye.Provider, { value: e }, t);
1169
1191
  }
1170
- function Pr({ children: e }) {
1192
+ function Mr({ children: e }) {
1171
1193
  return E.createElement(Ye.Provider, { value: null }, e);
1172
1194
  }
1173
- function Mr(e) {
1195
+ function Lr(e) {
1174
1196
  function t() {
1175
1197
  document.readyState !== "loading" && (e(), document.removeEventListener("DOMContentLoaded", t));
1176
1198
  }
1177
1199
  typeof window < "u" && typeof document < "u" && (document.addEventListener("DOMContentLoaded", t), t());
1178
1200
  }
1179
1201
  let ee = [];
1180
- Mr(() => {
1202
+ Lr(() => {
1181
1203
  function e(t) {
1182
1204
  if (!(t.target instanceof HTMLElement) || t.target === document.body || ee[0] === t.target) return;
1183
1205
  let n = t.target;
@@ -1185,7 +1207,7 @@ Mr(() => {
1185
1207
  }
1186
1208
  window.addEventListener("click", e, { capture: !0 }), window.addEventListener("mousedown", e, { capture: !0 }), window.addEventListener("focus", e, { capture: !0 }), document.body.addEventListener("click", e, { capture: !0 }), document.body.addEventListener("mousedown", e, { capture: !0 }), document.body.addEventListener("focus", e, { capture: !0 });
1187
1209
  });
1188
- function Yt(e) {
1210
+ function Gt(e) {
1189
1211
  let t = L(e), n = O(!1);
1190
1212
  M(() => (n.current = !1, () => {
1191
1213
  n.current = !0, qe(() => {
@@ -1193,26 +1215,26 @@ function Yt(e) {
1193
1215
  });
1194
1216
  }), [t]);
1195
1217
  }
1196
- function Lr() {
1218
+ function Sr() {
1197
1219
  let e = typeof document > "u";
1198
1220
  return "useSyncExternalStore" in Ee ? ((t) => t.useSyncExternalStore)(Ee)(() => () => {
1199
1221
  }, () => !1, () => !e) : !1;
1200
1222
  }
1201
1223
  function Le() {
1202
- let e = Lr(), [t, n] = Ee.useState(ae.isHandoffComplete);
1224
+ let e = Sr(), [t, n] = Ee.useState(ae.isHandoffComplete);
1203
1225
  return t && ae.isHandoffComplete === !1 && n(!1), Ee.useEffect(() => {
1204
1226
  t !== !0 && n(!0);
1205
1227
  }, [t]), Ee.useEffect(() => ae.handoff(), []), e ? !1 : t;
1206
1228
  }
1207
- let zt = H(!1);
1208
- function Sr() {
1209
- return R(zt);
1229
+ let Kt = H(!1);
1230
+ function Fr() {
1231
+ return R(Kt);
1210
1232
  }
1211
- function Pt(e) {
1212
- return E.createElement(zt.Provider, { value: e.force }, e.children);
1233
+ function Mt(e) {
1234
+ return E.createElement(Kt.Provider, { value: e.force }, e.children);
1213
1235
  }
1214
- function Fr(e) {
1215
- let t = Sr(), n = R(Kt), r = Me(e), [l, o] = S(() => {
1236
+ function Cr(e) {
1237
+ let t = Fr(), n = R(Jt), r = Me(e), [l, o] = S(() => {
1216
1238
  var a;
1217
1239
  if (!t && n !== null) return (a = n.current) != null ? a : null;
1218
1240
  if (ae.isServer) return null;
@@ -1228,35 +1250,35 @@ function Fr(e) {
1228
1250
  t || n !== null && o(n.current);
1229
1251
  }, [n, o, t]), l;
1230
1252
  }
1231
- let Gt = G, Cr = D(function(e, t) {
1232
- let n = e, r = O(null), l = Z(_n((y) => {
1233
- r.current = y;
1234
- }), t), o = Me(r), a = Fr(r), [s] = S(() => {
1235
- var y;
1236
- return ae.isServer ? null : (y = o == null ? void 0 : o.createElement("div")) != null ? y : null;
1253
+ let Zt = G, Nr = D(function(e, t) {
1254
+ let n = e, r = O(null), l = Z(Bn((x) => {
1255
+ r.current = x;
1256
+ }), t), o = Me(r), a = Cr(r), [s] = S(() => {
1257
+ var x;
1258
+ return ae.isServer ? null : (x = o == null ? void 0 : o.createElement("div")) != null ? x : null;
1237
1259
  }), i = R(st), c = Le();
1238
- A(() => {
1260
+ k(() => {
1239
1261
  !a || !s || a.contains(s) || (s.setAttribute("data-headlessui-portal", ""), a.appendChild(s));
1240
- }, [a, s]), A(() => {
1262
+ }, [a, s]), k(() => {
1241
1263
  if (s && i) return i.register(s);
1242
- }, [i, s]), Yt(() => {
1243
- var y;
1244
- !a || !s || (s instanceof Node && a.contains(s) && a.removeChild(s), a.childNodes.length <= 0 && ((y = a.parentElement) == null || y.removeChild(a)));
1264
+ }, [i, s]), Gt(() => {
1265
+ var x;
1266
+ !a || !s || (s instanceof Node && a.contains(s) && a.removeChild(s), a.childNodes.length <= 0 && ((x = a.parentElement) == null || x.removeChild(a)));
1245
1267
  });
1246
1268
  let f = W();
1247
- return c ? !a || !s ? null : En(f({ ourProps: { ref: l }, theirProps: n, slot: {}, defaultTag: Gt, name: "Portal" }), s) : null;
1269
+ return c ? !a || !s ? null : Tn(f({ ourProps: { ref: l }, theirProps: n, slot: {}, defaultTag: Zt, name: "Portal" }), s) : null;
1248
1270
  });
1249
- function kr(e, t) {
1271
+ function Ar(e, t) {
1250
1272
  let n = Z(t), { enabled: r = !0, ...l } = e, o = W();
1251
- return r ? E.createElement(Cr, { ...l, ref: n }) : o({ ourProps: { ref: n }, theirProps: l, slot: {}, defaultTag: Gt, name: "Portal" });
1273
+ return r ? E.createElement(Nr, { ...l, ref: n }) : o({ ourProps: { ref: n }, theirProps: l, slot: {}, defaultTag: Zt, name: "Portal" });
1252
1274
  }
1253
- let Nr = G, Kt = H(null);
1254
- function Ar(e, t) {
1275
+ let kr = G, Jt = H(null);
1276
+ function Ir(e, t) {
1255
1277
  let { target: n, ...r } = e, l = { ref: Z(t) }, o = W();
1256
- return E.createElement(Kt.Provider, { value: n }, o({ ourProps: l, theirProps: r, defaultTag: Nr, name: "Popover.Group" }));
1278
+ return E.createElement(Jt.Provider, { value: n }, o({ ourProps: l, theirProps: r, defaultTag: kr, name: "Popover.Group" }));
1257
1279
  }
1258
1280
  let st = H(null);
1259
- function Ir() {
1281
+ function Rr() {
1260
1282
  let e = R(st), t = O([]), n = L((o) => (t.current.push(o), e && e.register(o), () => r(o))), r = L((o) => {
1261
1283
  let a = t.current.indexOf(o);
1262
1284
  a !== -1 && t.current.splice(a, 1), e && e.unregister(o);
@@ -1265,17 +1287,17 @@ function Ir() {
1265
1287
  return E.createElement(st.Provider, { value: l }, o);
1266
1288
  }, [l])];
1267
1289
  }
1268
- let Rr = D(kr), Zt = D(Ar), Dr = Object.assign(Rr, { Group: Zt });
1269
- function jr(e, t = typeof document < "u" ? document.defaultView : null, n) {
1290
+ let Dr = D(Ar), Qt = D(Ir), jr = Object.assign(Dr, { Group: Qt });
1291
+ function Ur(e, t = typeof document < "u" ? document.defaultView : null, n) {
1270
1292
  let r = fe(e, "escape");
1271
- qt(t, "keydown", (l) => {
1272
- r && (l.defaultPrevented || l.key === Ht.Escape && n(l));
1293
+ zt(t, "keydown", (l) => {
1294
+ r && (l.defaultPrevented || l.key === _t.Escape && n(l));
1273
1295
  });
1274
1296
  }
1275
- function Ur() {
1297
+ function Hr() {
1276
1298
  var e;
1277
1299
  let [t] = S(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(pointer: coarse)") : null), [n, r] = S((e = t == null ? void 0 : t.matches) != null ? e : !1);
1278
- return A(() => {
1300
+ return k(() => {
1279
1301
  if (!t) return;
1280
1302
  function l(o) {
1281
1303
  r(o.matches);
@@ -1283,7 +1305,7 @@ function Ur() {
1283
1305
  return t.addEventListener("change", l), () => t.removeEventListener("change", l);
1284
1306
  }, [t]), n;
1285
1307
  }
1286
- function Hr({ defaultContainers: e = [], portals: t, mainTreeNode: n } = {}) {
1308
+ function Wr({ defaultContainers: e = [], portals: t, mainTreeNode: n } = {}) {
1287
1309
  let r = Me(n), l = L(() => {
1288
1310
  var o, a;
1289
1311
  let s = [];
@@ -1294,10 +1316,10 @@ function Hr({ defaultContainers: e = [], portals: t, mainTreeNode: n } = {}) {
1294
1316
  });
1295
1317
  return { resolveContainers: l, contains: L((o) => l().some((a) => a.contains(o))) };
1296
1318
  }
1297
- let Jt = H(null);
1298
- function Mt({ children: e, node: t }) {
1299
- let [n, r] = S(null), l = Qt(t ?? n);
1300
- return E.createElement(Jt.Provider, { value: l }, e, l === null && E.createElement(it, { features: He.Hidden, ref: (o) => {
1319
+ let en = H(null);
1320
+ function Lt({ children: e, node: t }) {
1321
+ let [n, r] = S(null), l = tn(t ?? n);
1322
+ return E.createElement(en.Provider, { value: l }, e, l === null && E.createElement(it, { features: He.Hidden, ref: (o) => {
1301
1323
  var a, s;
1302
1324
  if (o) {
1303
1325
  for (let i of (s = (a = Ve(o)) == null ? void 0 : a.querySelectorAll("html > *, body > *")) != null ? s : []) if (i !== document.body && i !== document.head && i instanceof HTMLElement && i != null && i.contains(o)) {
@@ -1307,43 +1329,43 @@ function Mt({ children: e, node: t }) {
1307
1329
  }
1308
1330
  } }));
1309
1331
  }
1310
- function Qt(e = null) {
1332
+ function tn(e = null) {
1311
1333
  var t;
1312
- return (t = R(Jt)) != null ? t : e;
1334
+ return (t = R(en)) != null ? t : e;
1313
1335
  }
1314
1336
  function gt() {
1315
1337
  let e = O(!1);
1316
- return A(() => (e.current = !0, () => {
1338
+ return k(() => (e.current = !0, () => {
1317
1339
  e.current = !1;
1318
1340
  }), []), e;
1319
1341
  }
1320
1342
  var be = ((e) => (e[e.Forwards = 0] = "Forwards", e[e.Backwards = 1] = "Backwards", e))(be || {});
1321
- function Wr() {
1343
+ function _r() {
1322
1344
  let e = O(0);
1323
- return Vt(!0, "keydown", (t) => {
1345
+ return Yt(!0, "keydown", (t) => {
1324
1346
  t.key === "Tab" && (e.current = t.shiftKey ? 1 : 0);
1325
1347
  }, !0), e;
1326
1348
  }
1327
- function en(e) {
1349
+ function nn(e) {
1328
1350
  if (!e) return /* @__PURE__ */ new Set();
1329
1351
  if (typeof e == "function") return new Set(e());
1330
1352
  let t = /* @__PURE__ */ new Set();
1331
1353
  for (let n of e.current) n.current instanceof HTMLElement && t.add(n.current);
1332
1354
  return t;
1333
1355
  }
1334
- let _r = "div";
1356
+ let Br = "div";
1335
1357
  var ie = ((e) => (e[e.None = 0] = "None", e[e.InitialFocus = 1] = "InitialFocus", e[e.TabLock = 2] = "TabLock", e[e.FocusLock = 4] = "FocusLock", e[e.RestoreFocus = 8] = "RestoreFocus", e[e.AutoFocus = 16] = "AutoFocus", e))(ie || {});
1336
- function Br(e, t) {
1358
+ function Xr(e, t) {
1337
1359
  let n = O(null), r = Z(n, t), { initialFocus: l, initialFocusFallback: o, containers: a, features: s = 15, ...i } = e;
1338
1360
  Le() || (s = 0);
1339
1361
  let c = Me(n);
1340
- Yr(s, { ownerDocument: c });
1341
- let f = zr(s, { ownerDocument: c, container: n, initialFocus: l, initialFocusFallback: o });
1342
- Gr(s, { ownerDocument: c, container: n, containers: a, previousActiveElement: f });
1343
- let y = Wr(), b = L((p) => {
1362
+ zr(s, { ownerDocument: c });
1363
+ let f = Gr(s, { ownerDocument: c, container: n, initialFocus: l, initialFocusFallback: o });
1364
+ Kr(s, { ownerDocument: c, container: n, containers: a, previousActiveElement: f });
1365
+ let x = _r(), b = L((p) => {
1344
1366
  let g = n.current;
1345
- g && ((x) => x())(() => {
1346
- ne(y.current, { [be.Forwards]: () => {
1367
+ g && ((y) => y())(() => {
1368
+ ne(x.current, { [be.Forwards]: () => {
1347
1369
  Oe(g, J.First, { skipElements: [p.relatedTarget, o] });
1348
1370
  }, [be.Backwards]: () => {
1349
1371
  Oe(g, J.Last, { skipElements: [p.relatedTarget, o] });
@@ -1355,15 +1377,15 @@ function Br(e, t) {
1355
1377
  }));
1356
1378
  }, onBlur(p) {
1357
1379
  if (!(s & 4)) return;
1358
- let g = en(a);
1380
+ let g = nn(a);
1359
1381
  n.current instanceof HTMLElement && g.add(n.current);
1360
- let x = p.relatedTarget;
1361
- x instanceof HTMLElement && x.dataset.headlessuiFocusGuard !== "true" && (tn(g, x) || (v.current ? Oe(n.current, ne(y.current, { [be.Forwards]: () => J.Next, [be.Backwards]: () => J.Previous }) | J.WrapAround, { relativeTo: p.target }) : p.target instanceof HTMLElement && Q(p.target)));
1382
+ let y = p.relatedTarget;
1383
+ y instanceof HTMLElement && y.dataset.headlessuiFocusGuard !== "true" && (rn(g, y) || (v.current ? Oe(n.current, ne(x.current, { [be.Forwards]: () => J.Next, [be.Backwards]: () => J.Previous }) | J.WrapAround, { relativeTo: p.target }) : p.target instanceof HTMLElement && Q(p.target)));
1362
1384
  } }, m = W();
1363
- return E.createElement(E.Fragment, null, w && E.createElement(it, { as: "button", type: "button", "data-headlessui-focus-guard": !0, onFocus: b, features: He.Focusable }), m({ ourProps: u, theirProps: i, defaultTag: _r, name: "FocusTrap" }), w && E.createElement(it, { as: "button", type: "button", "data-headlessui-focus-guard": !0, onFocus: b, features: He.Focusable }));
1385
+ return E.createElement(E.Fragment, null, w && E.createElement(it, { as: "button", type: "button", "data-headlessui-focus-guard": !0, onFocus: b, features: He.Focusable }), m({ ourProps: u, theirProps: i, defaultTag: Br, name: "FocusTrap" }), w && E.createElement(it, { as: "button", type: "button", "data-headlessui-focus-guard": !0, onFocus: b, features: He.Focusable }));
1364
1386
  }
1365
- let Xr = D(Br), Vr = Object.assign(Xr, { features: ie });
1366
- function qr(e = !0) {
1387
+ let Vr = D(Xr), qr = Object.assign(Vr, { features: ie });
1388
+ function Yr(e = !0) {
1367
1389
  let t = O(ee.slice());
1368
1390
  return vt(([n], [r]) => {
1369
1391
  r === !0 && n === !1 && qe(() => {
@@ -1374,15 +1396,15 @@ function qr(e = !0) {
1374
1396
  return (n = t.current.find((r) => r != null && r.isConnected)) != null ? n : null;
1375
1397
  });
1376
1398
  }
1377
- function Yr(e, { ownerDocument: t }) {
1378
- let n = !!(e & 8), r = qr(n);
1399
+ function zr(e, { ownerDocument: t }) {
1400
+ let n = !!(e & 8), r = Yr(n);
1379
1401
  vt(() => {
1380
1402
  n || (t == null ? void 0 : t.activeElement) === (t == null ? void 0 : t.body) && Q(r());
1381
- }, [n]), Yt(() => {
1403
+ }, [n]), Gt(() => {
1382
1404
  n && Q(r());
1383
1405
  });
1384
1406
  }
1385
- function zr(e, { ownerDocument: t, container: n, initialFocus: r, initialFocusFallback: l }) {
1407
+ function Gr(e, { ownerDocument: t, container: n, initialFocus: r, initialFocusFallback: l }) {
1386
1408
  let o = O(null), a = fe(!!(e & 1), "focus-trap#initial-focus"), s = gt();
1387
1409
  return vt(() => {
1388
1410
  if (e === 0) return;
@@ -1415,35 +1437,35 @@ function zr(e, { ownerDocument: t, container: n, initialFocus: r, initialFocusFa
1415
1437
  });
1416
1438
  }, [l, a, e]), o;
1417
1439
  }
1418
- function Gr(e, { ownerDocument: t, container: n, containers: r, previousActiveElement: l }) {
1440
+ function Kr(e, { ownerDocument: t, container: n, containers: r, previousActiveElement: l }) {
1419
1441
  let o = gt(), a = !!(e & 4);
1420
- qt(t == null ? void 0 : t.defaultView, "focus", (s) => {
1442
+ zt(t == null ? void 0 : t.defaultView, "focus", (s) => {
1421
1443
  if (!a || !o.current) return;
1422
- let i = en(r);
1444
+ let i = nn(r);
1423
1445
  n.current instanceof HTMLElement && i.add(n.current);
1424
1446
  let c = l.current;
1425
1447
  if (!c) return;
1426
1448
  let f = s.target;
1427
- f && f instanceof HTMLElement ? tn(i, f) ? (l.current = f, Q(f)) : (s.preventDefault(), s.stopPropagation(), Q(c)) : Q(l.current);
1449
+ f && f instanceof HTMLElement ? rn(i, f) ? (l.current = f, Q(f)) : (s.preventDefault(), s.stopPropagation(), Q(c)) : Q(l.current);
1428
1450
  }, !0);
1429
1451
  }
1430
- function tn(e, t) {
1452
+ function rn(e, t) {
1431
1453
  for (let n of e) if (n.contains(t)) return !0;
1432
1454
  return !1;
1433
1455
  }
1434
- function nn(e) {
1456
+ function ln(e) {
1435
1457
  var t;
1436
- return !!(e.enter || e.enterFrom || e.enterTo || e.leave || e.leaveFrom || e.leaveTo) || ((t = e.as) != null ? t : ln) !== G || E.Children.count(e.children) === 1;
1458
+ return !!(e.enter || e.enterFrom || e.enterTo || e.leave || e.leaveFrom || e.leaveTo) || ((t = e.as) != null ? t : an) !== G || E.Children.count(e.children) === 1;
1437
1459
  }
1438
1460
  let Ge = H(null);
1439
1461
  Ge.displayName = "TransitionContext";
1440
- var Kr = ((e) => (e.Visible = "visible", e.Hidden = "hidden", e))(Kr || {});
1441
- function Zr() {
1462
+ var Zr = ((e) => (e.Visible = "visible", e.Hidden = "hidden", e))(Zr || {});
1463
+ function Jr() {
1442
1464
  let e = R(Ge);
1443
1465
  if (e === null) throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
1444
1466
  return e;
1445
1467
  }
1446
- function Jr() {
1468
+ function Qr() {
1447
1469
  let e = R(Ke);
1448
1470
  if (e === null) throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
1449
1471
  return e;
@@ -1453,7 +1475,7 @@ Ke.displayName = "NestingContext";
1453
1475
  function Ze(e) {
1454
1476
  return "children" in e ? Ze(e.children) : e.current.filter(({ el: t }) => t.current !== null).filter(({ state: t }) => t === "visible").length > 0;
1455
1477
  }
1456
- function rn(e, t) {
1478
+ function on(e, t) {
1457
1479
  let n = ue(e), r = O([]), l = gt(), o = pt(), a = L((w, d = te.Hidden) => {
1458
1480
  let v = r.current.findIndex(({ el: u }) => u === w);
1459
1481
  v !== -1 && (ne(d, { [te.Unmount]() {
@@ -1467,7 +1489,7 @@ function rn(e, t) {
1467
1489
  }), s = L((w) => {
1468
1490
  let d = r.current.find(({ el: v }) => v === w);
1469
1491
  return d ? d.state !== "visible" && (d.state = "visible") : r.current.push({ el: w, state: "visible" }), () => a(w, te.Unmount);
1470
- }), i = O([]), c = O(Promise.resolve()), f = O({ enter: [], leave: [] }), y = L((w, d, v) => {
1492
+ }), i = O([]), c = O(Promise.resolve()), f = O({ enter: [], leave: [] }), x = L((w, d, v) => {
1471
1493
  i.current.splice(0), t && (t.chains.current[d] = t.chains.current[d].filter(([u]) => u !== w)), t == null || t.chains.current[d].push([w, new Promise((u) => {
1472
1494
  i.current.push(u);
1473
1495
  })]), t == null || t.chains.current[d].push([w, new Promise((u) => {
@@ -1479,61 +1501,61 @@ function rn(e, t) {
1479
1501
  (u = i.current.shift()) == null || u();
1480
1502
  }).then(() => v(d));
1481
1503
  });
1482
- return C(() => ({ children: r, register: s, unregister: a, onStart: y, onStop: b, wait: c, chains: f }), [s, a, r, y, b, f, c]);
1504
+ return C(() => ({ children: r, register: s, unregister: a, onStart: x, onStop: b, wait: c, chains: f }), [s, a, r, x, b, f, c]);
1483
1505
  }
1484
- let ln = G, on = Ue.RenderStrategy;
1485
- function Qr(e, t) {
1506
+ let an = G, sn = Ue.RenderStrategy;
1507
+ function el(e, t) {
1486
1508
  var n, r;
1487
- let { transition: l = !0, beforeEnter: o, afterEnter: a, beforeLeave: s, afterLeave: i, enter: c, enterFrom: f, enterTo: y, entered: b, leave: w, leaveFrom: d, leaveTo: v, ...u } = e, [m, p] = S(null), g = O(null), x = nn(e), h = Z(...x ? [g, t, p] : t === null ? [] : [t]), $ = (n = u.unmount) == null || n ? te.Unmount : te.Hidden, { show: F, appear: j, initial: _ } = Zr(), [N, U] = S(F ? "visible" : "hidden"), B = Jr(), { register: X, unregister: P } = B;
1488
- A(() => X(g), [X, g]), A(() => {
1509
+ let { transition: l = !0, beforeEnter: o, afterEnter: a, beforeLeave: s, afterLeave: i, enter: c, enterFrom: f, enterTo: x, entered: b, leave: w, leaveFrom: d, leaveTo: v, ...u } = e, [m, p] = S(null), g = O(null), y = ln(e), h = Z(...y ? [g, t, p] : t === null ? [] : [t]), $ = (n = u.unmount) == null || n ? te.Unmount : te.Hidden, { show: F, appear: j, initial: _ } = Jr(), [A, U] = S(F ? "visible" : "hidden"), B = Qr(), { register: X, unregister: P } = B;
1510
+ k(() => X(g), [X, g]), k(() => {
1489
1511
  if ($ === te.Hidden && g.current) {
1490
- if (F && N !== "visible") {
1512
+ if (F && A !== "visible") {
1491
1513
  U("visible");
1492
1514
  return;
1493
1515
  }
1494
- return ne(N, { hidden: () => P(g), visible: () => X(g) });
1516
+ return ne(A, { hidden: () => P(g), visible: () => X(g) });
1495
1517
  }
1496
- }, [N, g, X, P, F, $]);
1518
+ }, [A, g, X, P, F, $]);
1497
1519
  let V = Le();
1498
- A(() => {
1499
- if (x && V && N === "visible" && g.current === null) throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
1500
- }, [g, N, V, x]);
1501
- let Se = _ && !j, Fe = j && F && _, pe = O(!1), K = rn(() => {
1520
+ k(() => {
1521
+ if (y && V && A === "visible" && g.current === null) throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
1522
+ }, [g, A, V, y]);
1523
+ let Se = _ && !j, Fe = j && F && _, pe = O(!1), K = on(() => {
1502
1524
  pe.current || (U("hidden"), P(g));
1503
1525
  }, B), Ce = L((Qe) => {
1504
1526
  pe.current = !0;
1505
- let Ne = Qe ? "enter" : "leave";
1506
- K.onStart(g, Ne, (ve) => {
1527
+ let Ae = Qe ? "enter" : "leave";
1528
+ K.onStart(g, Ae, (ve) => {
1507
1529
  ve === "enter" ? o == null || o() : ve === "leave" && (s == null || s());
1508
1530
  });
1509
- }), k = L((Qe) => {
1510
- let Ne = Qe ? "enter" : "leave";
1511
- pe.current = !1, K.onStop(g, Ne, (ve) => {
1531
+ }), N = L((Qe) => {
1532
+ let Ae = Qe ? "enter" : "leave";
1533
+ pe.current = !1, K.onStop(g, Ae, (ve) => {
1512
1534
  ve === "enter" ? a == null || a() : ve === "leave" && (i == null || i());
1513
- }), Ne === "leave" && !Ze(K) && (U("hidden"), P(g));
1535
+ }), Ae === "leave" && !Ze(K) && (U("hidden"), P(g));
1514
1536
  });
1515
1537
  M(() => {
1516
- x && l || (Ce(F), k(F));
1517
- }, [F, x, l]);
1518
- let ke = !(!l || !x || !V || Se), [, I] = br(ke, m, F, { start: Ce, end: k }), cn = le({ ref: h, className: ((r = lt(u.className, Fe && c, Fe && f, I.enter && c, I.enter && I.closed && f, I.enter && !I.closed && y, I.leave && w, I.leave && !I.closed && d, I.leave && I.closed && v, !I.transition && F && b)) == null ? void 0 : r.trim()) || void 0, ...xr(I) }), he = 0;
1519
- N === "visible" && (he |= z.Open), N === "hidden" && (he |= z.Closed), I.enter && (he |= z.Opening), I.leave && (he |= z.Closing);
1520
- let dn = W();
1521
- return E.createElement(Ke.Provider, { value: K }, E.createElement(Or, { value: he }, dn({ ourProps: cn, theirProps: u, defaultTag: ln, features: on, visible: N === "visible", name: "Transition.Child" })));
1538
+ y && l || (Ce(F), N(F));
1539
+ }, [F, y, l]);
1540
+ let Ne = !(!l || !y || !V || Se), [, I] = Er(Ne, m, F, { start: Ce, end: N }), fn = le({ ref: h, className: ((r = lt(u.className, Fe && c, Fe && f, I.enter && c, I.enter && I.closed && f, I.enter && !I.closed && x, I.leave && w, I.leave && !I.closed && d, I.leave && I.closed && v, !I.transition && F && b)) == null ? void 0 : r.trim()) || void 0, ...br(I) }), he = 0;
1541
+ A === "visible" && (he |= z.Open), A === "hidden" && (he |= z.Closed), I.enter && (he |= z.Opening), I.leave && (he |= z.Closing);
1542
+ let mn = W();
1543
+ return E.createElement(Ke.Provider, { value: K }, E.createElement(Pr, { value: he }, mn({ ourProps: fn, theirProps: u, defaultTag: an, features: sn, visible: A === "visible", name: "Transition.Child" })));
1522
1544
  }
1523
- function el(e, t) {
1524
- let { show: n, appear: r = !1, unmount: l = !0, ...o } = e, a = O(null), s = nn(e), i = Z(...s ? [a, t] : t === null ? [] : [t]);
1545
+ function tl(e, t) {
1546
+ let { show: n, appear: r = !1, unmount: l = !0, ...o } = e, a = O(null), s = ln(e), i = Z(...s ? [a, t] : t === null ? [] : [t]);
1525
1547
  Le();
1526
1548
  let c = ze();
1527
1549
  if (n === void 0 && c !== null && (n = (c & z.Open) === z.Open), n === void 0) throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");
1528
- let [f, y] = S(n ? "visible" : "hidden"), b = rn(() => {
1529
- n || y("hidden");
1550
+ let [f, x] = S(n ? "visible" : "hidden"), b = on(() => {
1551
+ n || x("hidden");
1530
1552
  }), [w, d] = S(!0), v = O([n]);
1531
- A(() => {
1553
+ k(() => {
1532
1554
  w !== !1 && v.current[v.current.length - 1] !== n && (v.current.push(n), d(!1));
1533
1555
  }, [v, n]);
1534
1556
  let u = C(() => ({ show: n, appear: r, initial: w }), [n, r, w]);
1535
- A(() => {
1536
- n ? y("visible") : !Ze(b) && a.current !== null && y("hidden");
1557
+ k(() => {
1558
+ n ? x("visible") : !Ze(b) && a.current !== null && x("hidden");
1537
1559
  }, [n, b]);
1538
1560
  let m = { unmount: l }, p = L(() => {
1539
1561
  var h;
@@ -1541,16 +1563,16 @@ function el(e, t) {
1541
1563
  }), g = L(() => {
1542
1564
  var h;
1543
1565
  w && d(!1), (h = e.beforeLeave) == null || h.call(e);
1544
- }), x = W();
1545
- return E.createElement(Ke.Provider, { value: b }, E.createElement(Ge.Provider, { value: u }, x({ ourProps: { ...m, as: G, children: E.createElement(an, { ref: i, ...m, ...o, beforeEnter: p, beforeLeave: g }) }, theirProps: {}, defaultTag: G, features: on, visible: f === "visible", name: "Transition" })));
1566
+ }), y = W();
1567
+ return E.createElement(Ke.Provider, { value: b }, E.createElement(Ge.Provider, { value: u }, y({ ourProps: { ...m, as: G, children: E.createElement(un, { ref: i, ...m, ...o, beforeEnter: p, beforeLeave: g }) }, theirProps: {}, defaultTag: G, features: sn, visible: f === "visible", name: "Transition" })));
1546
1568
  }
1547
- function tl(e, t) {
1569
+ function nl(e, t) {
1548
1570
  let n = R(Ge) !== null, r = ze() !== null;
1549
- return E.createElement(E.Fragment, null, !n && r ? E.createElement(ut, { ref: t, ...e }) : E.createElement(an, { ref: t, ...e }));
1571
+ return E.createElement(E.Fragment, null, !n && r ? E.createElement(ut, { ref: t, ...e }) : E.createElement(un, { ref: t, ...e }));
1550
1572
  }
1551
- let ut = D(el), an = D(Qr), me = D(tl), sn = Object.assign(ut, { Child: me, Root: ut });
1552
- var nl = ((e) => (e[e.Open = 0] = "Open", e[e.Closed = 1] = "Closed", e))(nl || {}), rl = ((e) => (e[e.SetTitleId = 0] = "SetTitleId", e))(rl || {});
1553
- let ll = { 0(e, t) {
1573
+ let ut = D(tl), un = D(el), me = D(nl), cn = Object.assign(ut, { Child: me, Root: ut });
1574
+ var rl = ((e) => (e[e.Open = 0] = "Open", e[e.Closed = 1] = "Closed", e))(rl || {}), ll = ((e) => (e[e.SetTitleId = 0] = "SetTitleId", e))(ll || {});
1575
+ let il = { 0(e, t) {
1554
1576
  return e.titleId === t.id ? e : { ...e, titleId: t.id };
1555
1577
  } }, wt = H(null);
1556
1578
  wt.displayName = "DialogContext";
@@ -1562,68 +1584,68 @@ function Je(e) {
1562
1584
  }
1563
1585
  return t;
1564
1586
  }
1565
- function il(e, t) {
1566
- return ne(t.type, ll, e, t);
1587
+ function ol(e, t) {
1588
+ return ne(t.type, il, e, t);
1567
1589
  }
1568
- let Lt = D(function(e, t) {
1569
- let n = Pe(), { id: r = `headlessui-dialog-${n}`, open: l, onClose: o, initialFocus: a, role: s = "dialog", autoFocus: i = !0, __demoMode: c = !1, unmount: f = !1, ...y } = e, b = O(!1);
1590
+ let St = D(function(e, t) {
1591
+ let n = Pe(), { id: r = `headlessui-dialog-${n}`, open: l, onClose: o, initialFocus: a, role: s = "dialog", autoFocus: i = !0, __demoMode: c = !1, unmount: f = !1, ...x } = e, b = O(!1);
1570
1592
  s = function() {
1571
1593
  return s === "dialog" || s === "alertdialog" ? s : (b.current || (b.current = !0, console.warn(`Invalid role [${s}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)), "dialog");
1572
1594
  }();
1573
1595
  let w = ze();
1574
1596
  l === void 0 && w !== null && (l = (w & z.Open) === z.Open);
1575
- let d = O(null), v = Z(d, t), u = Me(d), m = l ? 0 : 1, [p, g] = wn(il, { titleId: null, descriptionId: null, panelRef: yn() }), x = L(() => o(!1)), h = L((k) => g({ type: 0, id: k })), $ = Le() ? m === 0 : !1, [F, j] = Ir(), _ = { get current() {
1576
- var k;
1577
- return (k = p.panelRef.current) != null ? k : d.current;
1578
- } }, N = Qt(), { resolveContainers: U } = Hr({ mainTreeNode: N, portals: F, defaultContainers: [_] }), B = w !== null ? (w & z.Closing) === z.Closing : !1;
1579
- Jn(c || B ? !1 : $, { allowed: L(() => {
1580
- var k, ke;
1581
- return [(ke = (k = d.current) == null ? void 0 : k.closest("[data-headlessui-portal]")) != null ? ke : null];
1597
+ let d = O(null), v = Z(d, t), u = Me(d), m = l ? 0 : 1, [p, g] = yn(ol, { titleId: null, descriptionId: null, panelRef: bn() }), y = L(() => o(!1)), h = L((N) => g({ type: 0, id: N })), $ = Le() ? m === 0 : !1, [F, j] = Rr(), _ = { get current() {
1598
+ var N;
1599
+ return (N = p.panelRef.current) != null ? N : d.current;
1600
+ } }, A = tn(), { resolveContainers: U } = Wr({ mainTreeNode: A, portals: F, defaultContainers: [_] }), B = w !== null ? (w & z.Closing) === z.Closing : !1;
1601
+ Qn(c || B ? !1 : $, { allowed: L(() => {
1602
+ var N, Ne;
1603
+ return [(Ne = (N = d.current) == null ? void 0 : N.closest("[data-headlessui-portal]")) != null ? Ne : null];
1582
1604
  }), disallowed: L(() => {
1583
- var k;
1584
- return [(k = N == null ? void 0 : N.closest("body > *:not(#headlessui-portal-root)")) != null ? k : null];
1585
- }) }), dr($, U, (k) => {
1586
- k.preventDefault(), x();
1587
- }), jr($, u == null ? void 0 : u.defaultView, (k) => {
1588
- k.preventDefault(), k.stopPropagation(), document.activeElement && "blur" in document.activeElement && typeof document.activeElement.blur == "function" && document.activeElement.blur(), x();
1589
- }), gr(c || B ? !1 : $, u, U), Qn($, d, x);
1590
- let [X, P] = Bn(), V = C(() => [{ dialogState: m, close: x, setTitleId: h, unmount: f }, p], [m, p, x, h, f]), Se = C(() => ({ open: m === 0 }), [m]), Fe = { ref: v, id: r, role: s, tabIndex: -1, "aria-modal": c ? void 0 : m === 0 ? !0 : void 0, "aria-labelledby": p.titleId, "aria-describedby": X, unmount: f }, pe = !Ur(), K = ie.None;
1605
+ var N;
1606
+ return [(N = A == null ? void 0 : A.closest("body > *:not(#headlessui-portal-root)")) != null ? N : null];
1607
+ }) }), fr($, U, (N) => {
1608
+ N.preventDefault(), y();
1609
+ }), Ur($, u == null ? void 0 : u.defaultView, (N) => {
1610
+ N.preventDefault(), N.stopPropagation(), document.activeElement && "blur" in document.activeElement && typeof document.activeElement.blur == "function" && document.activeElement.blur(), y();
1611
+ }), wr(c || B ? !1 : $, u, U), er($, d, y);
1612
+ let [X, P] = Xn(), V = C(() => [{ dialogState: m, close: y, setTitleId: h, unmount: f }, p], [m, p, y, h, f]), Se = C(() => ({ open: m === 0 }), [m]), Fe = { ref: v, id: r, role: s, tabIndex: -1, "aria-modal": c ? void 0 : m === 0 ? !0 : void 0, "aria-labelledby": p.titleId, "aria-describedby": X, unmount: f }, pe = !Hr(), K = ie.None;
1591
1613
  $ && !c && (K |= ie.RestoreFocus, K |= ie.TabLock, i && (K |= ie.AutoFocus), pe && (K |= ie.InitialFocus));
1592
1614
  let Ce = W();
1593
- return E.createElement(Pr, null, E.createElement(Pt, { force: !0 }, E.createElement(Dr, null, E.createElement(wt.Provider, { value: V }, E.createElement(Zt, { target: d }, E.createElement(Pt, { force: !1 }, E.createElement(P, { slot: Se }, E.createElement(j, null, E.createElement(Vr, { initialFocus: a, initialFocusFallback: d, containers: U, features: K }, E.createElement(Gn, { value: x }, Ce({ ourProps: Fe, theirProps: y, slot: Se, defaultTag: ol, features: al, visible: m === 0, name: "Dialog" })))))))))));
1594
- }), ol = "div", al = Ue.RenderStrategy | Ue.Static;
1595
- function sl(e, t) {
1615
+ return E.createElement(Mr, null, E.createElement(Mt, { force: !0 }, E.createElement(jr, null, E.createElement(wt.Provider, { value: V }, E.createElement(Qt, { target: d }, E.createElement(Mt, { force: !1 }, E.createElement(P, { slot: Se }, E.createElement(j, null, E.createElement(qr, { initialFocus: a, initialFocusFallback: d, containers: U, features: K }, E.createElement(Kn, { value: y }, Ce({ ourProps: Fe, theirProps: x, slot: Se, defaultTag: al, features: sl, visible: m === 0, name: "Dialog" })))))))))));
1616
+ }), al = "div", sl = Ue.RenderStrategy | Ue.Static;
1617
+ function ul(e, t) {
1596
1618
  let { transition: n = !1, open: r, ...l } = e, o = ze(), a = e.hasOwnProperty("open") || o !== null, s = e.hasOwnProperty("onClose");
1597
1619
  if (!a && !s) throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");
1598
1620
  if (!a) throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");
1599
1621
  if (!s) throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");
1600
1622
  if (!o && typeof e.open != "boolean") throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);
1601
1623
  if (typeof e.onClose != "function") throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e.onClose}`);
1602
- return (r !== void 0 || n) && !l.static ? E.createElement(Mt, null, E.createElement(sn, { show: r, transition: n, unmount: l.unmount }, E.createElement(Lt, { ref: t, ...l }))) : E.createElement(Mt, null, E.createElement(Lt, { ref: t, open: r, ...l }));
1624
+ return (r !== void 0 || n) && !l.static ? E.createElement(Lt, null, E.createElement(cn, { show: r, transition: n, unmount: l.unmount }, E.createElement(St, { ref: t, ...l }))) : E.createElement(Lt, null, E.createElement(St, { ref: t, open: r, ...l }));
1603
1625
  }
1604
- let ul = "div";
1605
- function cl(e, t) {
1606
- let n = Pe(), { id: r = `headlessui-dialog-panel-${n}`, transition: l = !1, ...o } = e, [{ dialogState: a, unmount: s }, i] = Je("Dialog.Panel"), c = Z(t, i.panelRef), f = C(() => ({ open: a === 0 }), [a]), y = L((u) => {
1626
+ let cl = "div";
1627
+ function dl(e, t) {
1628
+ let n = Pe(), { id: r = `headlessui-dialog-panel-${n}`, transition: l = !1, ...o } = e, [{ dialogState: a, unmount: s }, i] = Je("Dialog.Panel"), c = Z(t, i.panelRef), f = C(() => ({ open: a === 0 }), [a]), x = L((u) => {
1607
1629
  u.stopPropagation();
1608
- }), b = { ref: c, id: r, onClick: y }, w = l ? me : G, d = l ? { unmount: s } : {}, v = W();
1609
- return E.createElement(w, { ...d }, v({ ourProps: b, theirProps: o, slot: f, defaultTag: ul, name: "Dialog.Panel" }));
1630
+ }), b = { ref: c, id: r, onClick: x }, w = l ? me : G, d = l ? { unmount: s } : {}, v = W();
1631
+ return E.createElement(w, { ...d }, v({ ourProps: b, theirProps: o, slot: f, defaultTag: cl, name: "Dialog.Panel" }));
1610
1632
  }
1611
- let dl = "div";
1612
- function fl(e, t) {
1633
+ let fl = "div";
1634
+ function ml(e, t) {
1613
1635
  let { transition: n = !1, ...r } = e, [{ dialogState: l, unmount: o }] = Je("Dialog.Backdrop"), a = C(() => ({ open: l === 0 }), [l]), s = { ref: t, "aria-hidden": !0 }, i = n ? me : G, c = n ? { unmount: o } : {}, f = W();
1614
- return E.createElement(i, { ...c }, f({ ourProps: s, theirProps: r, slot: a, defaultTag: dl, name: "Dialog.Backdrop" }));
1636
+ return E.createElement(i, { ...c }, f({ ourProps: s, theirProps: r, slot: a, defaultTag: fl, name: "Dialog.Backdrop" }));
1615
1637
  }
1616
- let ml = "h2";
1617
- function pl(e, t) {
1638
+ let pl = "h2";
1639
+ function hl(e, t) {
1618
1640
  let n = Pe(), { id: r = `headlessui-dialog-title-${n}`, ...l } = e, [{ dialogState: o, setTitleId: a }] = Je("Dialog.Title"), s = Z(t);
1619
1641
  M(() => (a(r), () => a(null)), [r, a]);
1620
1642
  let i = C(() => ({ open: o === 0 }), [o]), c = { ref: s, id: r };
1621
- return W()({ ourProps: c, theirProps: l, slot: i, defaultTag: ml, name: "Dialog.Title" });
1643
+ return W()({ ourProps: c, theirProps: l, slot: i, defaultTag: pl, name: "Dialog.Title" });
1622
1644
  }
1623
- let hl = D(sl), yt = D(cl);
1624
- D(fl);
1625
- let vl = D(pl), gl = Object.assign(hl, { Panel: yt, Title: vl, Description: Yn });
1626
- function un({ onClick: e }) {
1645
+ let vl = D(ul), xt = D(dl);
1646
+ D(ml);
1647
+ let gl = D(hl), wl = Object.assign(vl, { Panel: xt, Title: gl, Description: zn });
1648
+ function dn({ onClick: e }) {
1627
1649
  return /* @__PURE__ */ se(
1628
1650
  "button",
1629
1651
  {
@@ -1656,7 +1678,7 @@ function un({ onClick: e }) {
1656
1678
  }
1657
1679
  );
1658
1680
  }
1659
- const wl = ({ modalContext: e, config: t, children: n }) => {
1681
+ const xl = ({ modalContext: e, config: t, children: n }) => {
1660
1682
  const [r, l] = S(!1);
1661
1683
  return /* @__PURE__ */ T("div", { className: "im-modal-container fixed inset-0 z-40 overflow-y-auto p-4", children: /* @__PURE__ */ T(
1662
1684
  "div",
@@ -1689,12 +1711,12 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
1689
1711
  "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl": t.maxWidth === "7xl"
1690
1712
  }),
1691
1713
  children: /* @__PURE__ */ se(
1692
- yt,
1714
+ xt,
1693
1715
  {
1694
1716
  className: `im-modal-content relative ${t.paddingClasses} ${t.panelClasses}`,
1695
1717
  "data-inertiaui-modal-entered": r,
1696
1718
  children: [
1697
- t.closeButton && /* @__PURE__ */ T("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ T(un, { onClick: e.close }) }),
1719
+ t.closeButton && /* @__PURE__ */ T("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ T(dn, { onClick: e.close }) }),
1698
1720
  typeof n == "function" ? n({ modalContext: e, config: t }) : n
1699
1721
  ]
1700
1722
  }
@@ -1735,12 +1757,12 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
1735
1757
  "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl": t.maxWidth === "7xl"
1736
1758
  }),
1737
1759
  children: /* @__PURE__ */ se(
1738
- yt,
1760
+ xt,
1739
1761
  {
1740
1762
  className: `im-slideover-content relative ${t.paddingClasses} ${t.panelClasses}`,
1741
1763
  "data-inertiaui-modal-entered": r,
1742
1764
  children: [
1743
- t.closeButton && /* @__PURE__ */ T("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ T(un, { onClick: e.close }) }),
1765
+ t.closeButton && /* @__PURE__ */ T("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ T(dn, { onClick: e.close }) }),
1744
1766
  typeof n == "function" ? n({ modalContext: e, config: t }) : n
1745
1767
  ]
1746
1768
  }
@@ -1749,10 +1771,10 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
1749
1771
  )
1750
1772
  }
1751
1773
  ) });
1752
- }, xl = ct(({ name: e, children: t, onFocus: n = null, onBlur: r = null, onClose: l = null, onSuccess: o = null, onAfterLeave: a = null, ...s }, i) => {
1753
- const c = (y) => typeof t == "function" ? t(y) : t, f = O(null);
1754
- return St(i, () => f.current, [f]), /* @__PURE__ */ T(
1755
- It,
1774
+ }, bl = ct(({ name: e, children: t, onFocus: n = null, onBlur: r = null, onClose: l = null, onSuccess: o = null, onAfterLeave: a = null, ...s }, i) => {
1775
+ const c = (x) => typeof t == "function" ? t(x) : t, f = O(null);
1776
+ return Ft(i, () => f.current, [f]), /* @__PURE__ */ T(
1777
+ Dt,
1756
1778
  {
1757
1779
  ref: f,
1758
1780
  name: e,
@@ -1762,7 +1784,7 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
1762
1784
  onSuccess: o,
1763
1785
  ...s,
1764
1786
  children: ({
1765
- afterLeave: y,
1787
+ afterLeave: x,
1766
1788
  close: b,
1767
1789
  config: w,
1768
1790
  emit: d,
@@ -1771,19 +1793,19 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
1771
1793
  id: m,
1772
1794
  index: p,
1773
1795
  isOpen: g,
1774
- modalContext: x,
1796
+ modalContext: y,
1775
1797
  onTopOfStack: h,
1776
1798
  reload: $,
1777
1799
  setOpen: F,
1778
1800
  shouldRender: j
1779
1801
  }) => /* @__PURE__ */ T(
1780
- sn,
1802
+ cn,
1781
1803
  {
1782
1804
  appear: !0,
1783
1805
  show: g ?? !1,
1784
1806
  afterLeave: a,
1785
1807
  children: /* @__PURE__ */ se(
1786
- gl,
1808
+ wl,
1787
1809
  {
1788
1810
  as: "div",
1789
1811
  className: "im-dialog relative z-20",
@@ -1813,10 +1835,10 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
1813
1835
  w.slideover ? /* @__PURE__ */ T(
1814
1836
  yl,
1815
1837
  {
1816
- modalContext: x,
1838
+ modalContext: y,
1817
1839
  config: w,
1818
1840
  children: c({
1819
- afterLeave: y,
1841
+ afterLeave: x,
1820
1842
  close: b,
1821
1843
  config: w,
1822
1844
  emit: d,
@@ -1825,7 +1847,7 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
1825
1847
  id: m,
1826
1848
  index: p,
1827
1849
  isOpen: g,
1828
- modalContext: x,
1850
+ modalContext: y,
1829
1851
  onTopOfStack: h,
1830
1852
  reload: $,
1831
1853
  setOpen: F,
@@ -1833,12 +1855,12 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
1833
1855
  })
1834
1856
  }
1835
1857
  ) : /* @__PURE__ */ T(
1836
- wl,
1858
+ xl,
1837
1859
  {
1838
- modalContext: x,
1860
+ modalContext: y,
1839
1861
  config: w,
1840
1862
  children: c({
1841
- afterLeave: y,
1863
+ afterLeave: x,
1842
1864
  close: b,
1843
1865
  config: w,
1844
1866
  emit: d,
@@ -1847,7 +1869,7 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
1847
1869
  id: m,
1848
1870
  index: p,
1849
1871
  isOpen: g,
1850
- modalContext: x,
1872
+ modalContext: y,
1851
1873
  onTopOfStack: h,
1852
1874
  reload: $,
1853
1875
  setOpen: F,
@@ -1863,8 +1885,8 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
1863
1885
  }
1864
1886
  );
1865
1887
  });
1866
- xl.displayName = "Modal";
1867
- const Nl = ({
1888
+ bl.displayName = "Modal";
1889
+ const kl = ({
1868
1890
  href: e,
1869
1891
  method: t = "get",
1870
1892
  data: n = {},
@@ -1876,33 +1898,33 @@ const Nl = ({
1876
1898
  onClose: i = null,
1877
1899
  onError: c = null,
1878
1900
  onFocus: f = null,
1879
- onStart: y = null,
1901
+ onStart: x = null,
1880
1902
  onSuccess: b = null,
1881
1903
  navigate: w = null,
1882
1904
  children: d,
1883
1905
  ...v
1884
1906
  }) => {
1885
- const [u, m] = S(!1), [p, g] = S(null), { stack: x, visit: h } = Xe(), $ = C(() => w ?? ft("navigate"), [w]), F = {}, j = {};
1907
+ const [u, m] = S(!1), [p, g] = S(null), { stack: y, visit: h } = Xe(), $ = C(() => w ?? ft("navigate"), [w]), F = {}, j = {};
1886
1908
  Object.keys(v).forEach((P) => {
1887
- xt.includes(P) || (P.startsWith("on") && typeof v[P] == "function" ? P.toLowerCase() in window ? F[P] = v[P] : j[P] = v[P] : F[P] = v[P]);
1909
+ bt.includes(P) || (P.startsWith("on") && typeof v[P] == "function" ? P.toLowerCase() in window ? F[P] = v[P] : j[P] = v[P] : F[P] = v[P]);
1888
1910
  });
1889
- const [_, N] = S(!1);
1911
+ const [_, A] = S(!1);
1890
1912
  M(() => {
1891
- p && (p.onTopOfStack && _ ? f == null || f() : !p.onTopOfStack && !_ && (s == null || s()), N(!p.onTopOfStack));
1892
- }, [x]);
1913
+ p && (p.onTopOfStack && _ ? f == null || f() : !p.onTopOfStack && !_ && (s == null || s()), A(!p.onTopOfStack));
1914
+ }, [y]);
1893
1915
  const U = Y(() => {
1894
1916
  i == null || i();
1895
1917
  }, [i]), B = Y(() => {
1896
1918
  g(null), a == null || a();
1897
1919
  }, [a]), X = Y(
1898
1920
  (P) => {
1899
- P == null || P.preventDefault(), !u && (e.startsWith("#") || (m(!0), y == null || y()), h(
1921
+ P == null || P.preventDefault(), !u && (e.startsWith("#") || (m(!0), x == null || x()), h(
1900
1922
  e,
1901
1923
  t,
1902
1924
  n,
1903
1925
  l,
1904
- Pn(Ft(v, xt)),
1905
- () => U(x.length),
1926
+ Mn(Nt(v, bt)),
1927
+ () => U(y.length),
1906
1928
  B,
1907
1929
  o,
1908
1930
  $
@@ -1924,23 +1946,23 @@ const Nl = ({
1924
1946
  }
1925
1947
  );
1926
1948
  };
1927
- function Al() {
1928
- return Xe().stack[Nt()] ?? null;
1949
+ function Il() {
1950
+ return Xe().stack[It()] ?? null;
1929
1951
  }
1930
- const Il = (e) => (t) => (t.default.layout = (n) => Re(e, {}, n), t);
1952
+ const Rl = (e) => (t) => (t.default.layout = (n) => Re(e, {}, n), t);
1931
1953
  export {
1932
- It as HeadlessModal,
1933
- xl as Modal,
1934
- Nl as ModalLink,
1935
- Fn as ModalRoot,
1936
- Ln as ModalStackProvider,
1954
+ Dt as HeadlessModal,
1955
+ bl as Modal,
1956
+ kl as ModalLink,
1957
+ Cn as ModalRoot,
1958
+ Sn as ModalStackProvider,
1937
1959
  ft as getConfig,
1938
- Sn as initFromPageProps,
1939
- Sl as putConfig,
1940
- Fl as renderApp,
1941
- Ll as resetConfig,
1942
- Il as setPageLayout,
1943
- Al as useModal,
1944
- Nt as useModalIndex,
1960
+ Fn as initFromPageProps,
1961
+ Fl as putConfig,
1962
+ Cl as renderApp,
1963
+ Sl as resetConfig,
1964
+ Rl as setPageLayout,
1965
+ Il as useModal,
1966
+ It as useModalIndex,
1945
1967
  Xe as useModalStack
1946
1968
  };