@inertiaui/modal-react 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,14 @@
1
- var Wt = Object.defineProperty;
2
- var Bt = (t, e, n) => e in t ? Wt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var X = (t, e, n) => Bt(t, typeof e != "symbol" ? e + "" : e, n);
4
- import * as ve from "react";
5
- import B, { createContext as Pe, useState as $, useEffect as D, useContext as de, useRef as j, createElement as Ne, useMemo as Y, forwardRef as Ze, useImperativeHandle as ct, useLayoutEffect as Ht, useCallback as V, Fragment as ae, isValidElement as Kt, cloneElement as qt } from "react";
6
- import { jsx as F, jsxs as le, Fragment as Ye } from "react/jsx-runtime";
7
- import Te from "axios";
8
- import { router as he, usePage as Xt } from "@inertiajs/react";
9
- import { mergeDataIntoQueryString as _t } from "@inertiajs/core";
10
- const fe = {
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);
4
+ import * as Ee from "react";
5
+ import E, { createContext as U, useState as L, useEffect as M, useContext as R, useRef as O, createElement as Ie, useMemo as C, forwardRef as dt, useImperativeHandle as Lt, 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";
6
+ import { jsx as T, jsxs as ue, Fragment as ct } from "react/jsx-runtime";
7
+ import Re 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";
11
+ const ge = {
11
12
  type: "modal",
12
13
  navigate: !1,
13
14
  modal: {
@@ -27,189 +28,169 @@ const fe = {
27
28
  position: "right"
28
29
  }
29
30
  };
30
- class Vt {
31
+ class $n {
31
32
  constructor() {
32
33
  this.config = {}, this.reset();
33
34
  }
34
35
  reset() {
35
- this.config = JSON.parse(JSON.stringify(fe));
36
+ this.config = JSON.parse(JSON.stringify(ge));
36
37
  }
37
- put(e, n) {
38
- if (typeof e == "object") {
38
+ put(t, n) {
39
+ if (typeof t == "object") {
39
40
  this.config = {
40
- type: e.type ?? fe.type,
41
- navigate: e.navigate ?? fe.navigate,
42
- modal: { ...fe.modal, ...e.modal ?? {} },
43
- slideover: { ...fe.slideover, ...e.slideover ?? {} }
41
+ type: t.type ?? ge.type,
42
+ navigate: t.navigate ?? ge.navigate,
43
+ modal: { ...ge.modal, ...t.modal ?? {} },
44
+ slideover: { ...ge.slideover, ...t.slideover ?? {} }
44
45
  };
45
46
  return;
46
47
  }
47
- const r = e.split(".");
48
- let i = this.config;
49
- for (let l = 0; l < r.length - 1; l++)
50
- i = i[r[l]] = i[r[l]] || {};
51
- i[r[r.length - 1]] = n;
48
+ const r = t.split(".");
49
+ let l = this.config;
50
+ for (let a = 0; a < r.length - 1; a++)
51
+ l = l[r[a]] = l[r[a]] || {};
52
+ l[r[r.length - 1]] = n;
52
53
  }
53
- get(e) {
54
- if (typeof e > "u")
54
+ get(t) {
55
+ if (typeof t > "u")
55
56
  return this.config;
56
- const n = e.split(".");
57
+ const n = t.split(".");
57
58
  let r = this.config;
58
- for (const i of n) {
59
- if (r[i] === void 0)
59
+ for (const l of n) {
60
+ if (r[l] === void 0)
60
61
  return null;
61
- r = r[i];
62
+ r = r[l];
62
63
  }
63
64
  return r;
64
65
  }
65
66
  }
66
- const Ie = new Vt(), mr = () => Ie.reset(), pr = (t, e) => Ie.put(t, e), Je = (t) => Ie.get(t), se = (t, e) => Ie.get(t ? `slideover.${e}` : `modal.${e}`), nt = {
67
- modifiedElements: [],
68
- bodyState: {
69
- hasOverflowHidden: !1,
70
- hasPointerEventsNone: !1,
71
- originalPaddingRight: ""
72
- },
73
- prepare() {
74
- const t = window.innerWidth - document.documentElement.clientWidth;
75
- this.bodyState.originalPaddingRight = document.body.style.paddingRight;
76
- const e = parseInt(window.getComputedStyle(document.body).paddingRight, 10);
77
- document.body.style.paddingRight = `${e + t}px`, document.body.classList.contains("overflow-hidden") || (document.body.classList.add("overflow-hidden"), this.bodyState.hasOverflowHidden = !0), document.body.classList.contains("pointer-events-none") || (document.body.classList.add("pointer-events-none"), this.bodyState.hasPointerEventsNone = !0), Array.from(document.body.children).forEach((n) => {
78
- !n.classList.contains("im-dialog") && n.getAttribute("aria-hidden") !== "true" && (n.setAttribute("aria-hidden", "true"), this.modifiedElements.push(n));
79
- });
80
- },
81
- cleanup() {
82
- this.bodyState.hasOverflowHidden && (document.body.classList.remove("overflow-hidden"), this.bodyState.hasOverflowHidden = !1), this.bodyState.hasPointerEventsNone && (document.body.classList.remove("pointer-events-none"), this.bodyState.hasPointerEventsNone = !1), document.body.style.paddingRight = this.bodyState.originalPaddingRight, this.bodyState.originalPaddingRight = "", this.modifiedElements.forEach((t) => {
83
- t.removeAttribute("aria-hidden");
84
- }), this.modifiedElements = [];
85
- }
86
- };
87
- function We(t = "inertiaui_modal_") {
88
- return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `${t}${crypto.randomUUID()}` : `${t}${Date.now().toString(36)}_${Math.random().toString(36).substr(2, 9)}`;
67
+ const We = new $n(), Ml = () => We.reset(), Sl = (e, t) => We.put(e, t), ft = (e) => We.get(e), de = (e, t) => We.get(e ? `slideover.${t}` : `modal.${t}`);
68
+ function Qe(e = "inertiaui_modal_") {
69
+ return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `${e}${crypto.randomUUID()}` : `${e}${Date.now().toString(36)}_${Math.random().toString(36).substr(2, 9)}`;
89
70
  }
90
- function zt(t, e) {
91
- return Array.isArray(t) ? t.filter((n) => !e.includes(n)) : Object.keys(t).reduce((n, r) => (e.includes(r) || (n[r] = t[r]), n), {});
71
+ function Tn(e, t) {
72
+ return Array.isArray(e) ? e.filter((n) => !t.includes(n)) : Object.keys(e).reduce((n, r) => (t.includes(r) || (n[r] = e[r]), n), {});
92
73
  }
93
- function ft(t, e) {
94
- return Array.isArray(t) ? t.filter((n) => e.includes(n)) : e.reduce((n, r) => (r in t && (n[r] = t[r]), n), {});
74
+ function Ft(e, t) {
75
+ return Array.isArray(e) ? e.filter((n) => t.includes(n)) : t.reduce((n, r) => (r in e && (n[r] = e[r]), n), {});
95
76
  }
96
- function Gt(t) {
97
- return Array.isArray(t) ? t.filter((e) => e !== null) : Object.keys(t).reduce((e, n) => (n in t && t[n] !== null && (e[n] = t[n]), e), {});
77
+ function On(e) {
78
+ 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), {});
98
79
  }
99
- function Zt(t, e = 3, n = 10) {
100
- return new Promise((r, i) => {
101
- const l = t();
102
- if (l) {
103
- r(l);
80
+ function Pn(e, t = 3, n = 10) {
81
+ return new Promise((r, l) => {
82
+ const a = e();
83
+ if (a) {
84
+ r(a);
104
85
  return;
105
86
  }
106
- let a = e * 1e3 / n;
107
- const m = setInterval(() => {
108
- const s = t();
109
- s && (clearInterval(m), r(s)), --a <= 0 && (clearInterval(m), i(new Error("Condition not met in time")));
87
+ let o = t * 1e3 / n;
88
+ const u = setInterval(() => {
89
+ const i = e();
90
+ i && (clearInterval(u), r(i)), --o <= 0 && (clearInterval(u), l(new Error("Condition not met in time")));
110
91
  }, n);
111
92
  });
112
93
  }
113
- function me(t) {
114
- return t ? (t = t.replace(/_/g, "-"), t = t.replace(/-+/g, "-"), /[A-Z]/.test(t) ? (t = t.replace(/\s+/g, "").replace(/_/g, "").replace(/(?:^|\s|-)+([A-Za-z])/g, (e, n) => n.toUpperCase()), t = t.replace(/(.)(?=[A-Z])/g, "$1-"), t.toLowerCase()) : t) : "";
115
- }
116
- const Re = Pe(null);
117
- Re.displayName = "ModalStackContext";
118
- let mt = null, pt = null, be = null, qe = null, Xe = [], oe = {};
119
- const Yt = ({ children: t }) => {
120
- const [e, n] = $([]), [r, i] = $({}), l = (g) => {
121
- n((d) => {
122
- const f = g([...d]), p = (y) => {
123
- var N;
124
- return f.length < 2 ? !0 : ((N = f.map((h) => ({ id: h.id, shouldRender: h.shouldRender })).reverse().find((h) => h.shouldRender)) == null ? void 0 : N.id) === y;
94
+ function we(e) {
95
+ 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) : "";
96
+ }
97
+ const _e = U(null);
98
+ _e.displayName = "ModalStackContext";
99
+ let Ct = null, kt = null, $e = null, nt = null, rt = [], ce = {};
100
+ const Mn = ({ children: e }) => {
101
+ const [t, n] = L([]), [r, l] = L({}), a = (v) => {
102
+ n((s) => {
103
+ const m = v([...s]), p = (g) => {
104
+ var x;
105
+ 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;
125
106
  };
126
- return f.forEach((y, N) => {
127
- f[N].onTopOfStack = p(y.id), f[N].getParentModal = () => N < 1 ? null : f.slice(0, N).reverse().find((h) => h.isOpen), f[N].getChildModal = () => N === f.length - 1 ? null : f.slice(N + 1).find((h) => h.isOpen);
128
- }), f;
107
+ return m.forEach((g, x) => {
108
+ 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);
109
+ }), m;
129
110
  });
130
111
  };
131
- D(() => {
132
- Xe = e;
133
- }, [e]);
134
- class a {
135
- constructor(d, f, p, y, N) {
136
- X(this, "show", () => {
137
- l(
138
- (d) => d.map((f) => (f.id === this.id && !f.isOpen && (f.isOpen = !0, f.shouldRender = !0), f))
112
+ M(() => {
113
+ rt = t;
114
+ }, [t]);
115
+ class o {
116
+ constructor(s, m, p, g, x) {
117
+ q(this, "show", () => {
118
+ a(
119
+ (s) => s.map((m) => (m.id === this.id && !m.isOpen && (m.isOpen = !0, m.shouldRender = !0), m))
139
120
  );
140
121
  });
141
- X(this, "setOpen", (d) => {
142
- d ? this.show() : this.close();
122
+ q(this, "setOpen", (s) => {
123
+ s ? this.show() : this.close();
143
124
  });
144
- X(this, "close", () => {
145
- l(
146
- (d) => d.map((f) => {
125
+ q(this, "close", () => {
126
+ a(
127
+ (s) => s.map((m) => {
147
128
  var p;
148
- return f.id === this.id && f.isOpen && (Object.keys(f.listeners).forEach((y) => {
149
- f.off(y);
150
- }), f.isOpen = !1, (p = f.onCloseCallback) == null || p.call(f)), f;
129
+ return m.id === this.id && m.isOpen && (Object.keys(m.listeners).forEach((g) => {
130
+ m.off(g);
131
+ }), m.isOpen = !1, (p = m.onCloseCallback) == null || p.call(m)), m;
151
132
  })
152
133
  );
153
134
  });
154
- X(this, "afterLeave", () => {
155
- this.isOpen || l((d) => {
156
- const f = d.map((p) => {
157
- var y;
158
- return p.id === this.id && !p.isOpen && (p.shouldRender = !1, (y = p.afterLeaveCallback) == null || y.call(p), p.afterLeaveCallback = null), p;
135
+ q(this, "afterLeave", () => {
136
+ this.isOpen || a((s) => {
137
+ const m = s.map((p) => {
138
+ var g;
139
+ return p.id === this.id && !p.isOpen && (p.shouldRender = !1, (g = p.afterLeaveCallback) == null || g.call(p), p.afterLeaveCallback = null), p;
159
140
  });
160
- return this.index === 0 ? [] : f;
141
+ return this.index === 0 ? [] : m;
161
142
  });
162
143
  });
163
- X(this, "on", (d, f) => {
164
- d = me(d), this.listeners[d] = this.listeners[d] ?? [], this.listeners[d].push(f);
144
+ q(this, "on", (s, m) => {
145
+ s = we(s), this.listeners[s] = this.listeners[s] ?? [], this.listeners[s].push(m);
165
146
  });
166
- X(this, "off", (d, f) => {
147
+ q(this, "off", (s, m) => {
167
148
  var p;
168
- d = me(d), f ? this.listeners[d] = ((p = this.listeners[d]) == null ? void 0 : p.filter((y) => y !== f)) ?? [] : delete this.listeners[d];
149
+ s = we(s), m ? this.listeners[s] = ((p = this.listeners[s]) == null ? void 0 : p.filter((g) => g !== m)) ?? [] : delete this.listeners[s];
169
150
  });
170
- X(this, "emit", (d, ...f) => {
151
+ q(this, "emit", (s, ...m) => {
171
152
  var p;
172
- (p = this.listeners[me(d)]) == null || p.forEach((y) => y(...f));
153
+ (p = this.listeners[we(s)]) == null || p.forEach((g) => g(...m));
173
154
  });
174
- X(this, "registerEventListenersFromProps", (d) => {
175
- const f = [];
176
- return Object.keys(d).filter((p) => p.startsWith("on")).forEach((p) => {
177
- const y = me(p).replace(/^on-/, "");
178
- this.on(y, d[p]), f.push(() => this.off(y, d[p]));
179
- }), () => f.forEach((p) => p());
155
+ q(this, "registerEventListenersFromProps", (s) => {
156
+ const m = [];
157
+ return Object.keys(s).filter((p) => p.startsWith("on")).forEach((p) => {
158
+ const g = we(p).replace(/^on-/, "");
159
+ this.on(g, s[p]), m.push(() => this.off(g, s[p]));
160
+ }), () => m.forEach((p) => p());
180
161
  });
181
- X(this, "reload", (d = {}) => {
162
+ q(this, "reload", (s = {}) => {
182
163
  var p;
183
- let f = Object.keys(this.response.props);
184
- d.only && (f = ft(f, d.only)), d.except && (f = zt(f, d.except)), (p = this.response) != null && p.url && Te.get(this.response.url, {
164
+ let m = Object.keys(this.response.props);
165
+ s.only && (m = Ft(m, s.only)), s.except && (m = Tn(m, s.except)), (p = this.response) != null && p.url && Re.get(this.response.url, {
185
166
  headers: {
186
167
  Accept: "text/html, application/xhtml+xml",
187
168
  "X-Inertia": !0,
188
169
  "X-Inertia-Partial-Component": this.response.component,
189
170
  "X-Inertia-Version": this.response.version,
190
- "X-Inertia-Partial-Data": f.join(","),
191
- "X-InertiaUI-Modal": We(),
171
+ "X-Inertia-Partial-Data": m.join(","),
172
+ "X-InertiaUI-Modal": Qe(),
192
173
  "X-InertiaUI-Modal-Use-Router": 0,
193
- "X-InertiaUI-Modal-Base-Url": be
174
+ "X-InertiaUI-Modal-Base-Url": $e
194
175
  }
195
- }).then((y) => {
196
- this.updateProps(y.data.props);
176
+ }).then((g) => {
177
+ this.updateProps(g.data.props);
197
178
  });
198
179
  });
199
- X(this, "updateProps", (d) => {
200
- Object.assign(this.props, d), l((f) => f);
180
+ q(this, "updateProps", (s) => {
181
+ Object.assign(this.props, s), a((m) => m);
201
182
  });
202
- if (this.id = f.id ?? We(), this.isOpen = !1, this.shouldRender = !1, this.listeners = {}, this.component = d, this.props = f.props, this.response = f, this.config = p ?? {}, this.onCloseCallback = y, this.afterLeaveCallback = N, oe[this.id]) {
183
+ if (this.id = m.id ?? Qe(), this.isOpen = !1, this.shouldRender = !1, this.listeners = {}, this.component = s, this.props = m.props, this.response = m, this.config = p ?? {}, this.onCloseCallback = g, this.afterLeaveCallback = x, ce[this.id]) {
203
184
  this.config = {
204
185
  ...this.config,
205
- ...oe[this.id].config ?? {}
186
+ ...ce[this.id].config ?? {}
206
187
  };
207
- const h = oe[this.id].onClose, k = oe[this.id].onAfterLeave;
208
- h && (this.onCloseCallback = y ? () => {
209
- y(), h();
210
- } : h), k && (this.afterLeaveCallback = N ? () => {
211
- N(), k();
212
- } : k), delete oe[this.id];
188
+ const h = ce[this.id].onClose, $ = ce[this.id].onAfterLeave;
189
+ h && (this.onCloseCallback = g ? () => {
190
+ g(), h();
191
+ } : h), $ && (this.afterLeaveCallback = x ? () => {
192
+ x(), $();
193
+ } : $), delete ce[this.id];
213
194
  }
214
195
  this.index = -1, this.getParentModal = () => null, this.getChildModal = () => null, this.onTopOfStack = !0;
215
196
  }
@@ -217,205 +198,205 @@ const Yt = ({ children: t }) => {
217
198
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `inertiaui_modal_${crypto.randomUUID()}` : `inertiaui_modal_${Date.now().toString(36)}_${Math.random().toString(36).substr(2, 9)}`;
218
199
  }
219
200
  }
220
- const m = (g, d = {}, f = null, p = null) => pt(g.component).then((y) => s(y, g, d, f, p)), s = (g, d, f, p, y) => {
221
- const N = new a(g, d, f, p, y);
222
- return N.index = e.length, l((h) => [...h, N]), N.show(), N;
201
+ const u = (v, s = {}, m = null, p = null) => kt(v.component).then((g) => i(g, v, s, m, p)), i = (v, s, m, p, g) => {
202
+ const x = new o(v, s, m, p, g);
203
+ return x.index = t.length, a((h) => [...h, x]), x.show(), x;
223
204
  };
224
- function v(g, d, f, p) {
225
- if (!r[g])
226
- throw new Error(`The local modal "${g}" has not been registered.`);
227
- const y = s(null, {}, d, f, p);
228
- return y.name = g, r[g].callback(y), y;
205
+ function d(v, s, m, p) {
206
+ if (!r[v])
207
+ throw new Error(`The local modal "${v}" has not been registered.`);
208
+ const g = i(null, {}, s, m, p);
209
+ return g.name = v, r[v].callback(g), g;
229
210
  }
230
- const b = (g, d = {}) => x(
231
- g,
232
- d.method ?? "get",
233
- d.data ?? {},
234
- d.headers ?? {},
235
- d.config ?? {},
236
- d.onClose,
237
- d.onAfterLeave,
238
- d.queryStringArrayFormat ?? "brackets",
239
- d.navigate ?? Je("navigate")
240
- ).then((f) => {
241
- const p = d.listeners ?? {};
242
- return Object.keys(p).forEach((y) => {
243
- const N = me(y);
244
- f.on(N, p[y]);
245
- }), f;
246
- }), x = (g, d, f = {}, p = {}, y = {}, N = null, h = null, k = "brackets", A = !1) => {
247
- const H = We();
248
- return new Promise((K, U) => {
249
- if (g.startsWith("#")) {
250
- K(v(g.substring(1), y, N, h));
211
+ const f = (v, s = {}) => y(
212
+ v,
213
+ s.method ?? "get",
214
+ s.data ?? {},
215
+ s.headers ?? {},
216
+ s.config ?? {},
217
+ s.onClose,
218
+ s.onAfterLeave,
219
+ s.queryStringArrayFormat ?? "brackets",
220
+ s.navigate ?? ft("navigate")
221
+ ).then((m) => {
222
+ const p = s.listeners ?? {};
223
+ return Object.keys(p).forEach((g) => {
224
+ const x = we(g);
225
+ m.on(x, p[g]);
226
+ }), m;
227
+ }), y = (v, s, m = {}, p = {}, g = {}, x = null, h = null, $ = "brackets", F = !1) => {
228
+ const j = Qe();
229
+ return new Promise((_, N) => {
230
+ if (v.startsWith("#")) {
231
+ _(d(v.substring(1), g, x, h));
251
232
  return;
252
233
  }
253
- const [W, O] = _t(d, g || "", f, k);
254
- let o = A && e.length === 0;
255
- if (e.length === 0 && (be = typeof window < "u" ? window.location.href : ""), p = {
234
+ const [H, B] = bn(s, v || "", m, $);
235
+ let X = F && t.length === 0;
236
+ if (t.length === 0 && ($e = typeof window < "u" ? window.location.href : ""), p = {
256
237
  ...p,
257
238
  Accept: "text/html, application/xhtml+xml",
258
239
  "X-Requested-With": "XMLHttpRequest",
259
240
  "X-Inertia": !0,
260
- "X-Inertia-Version": mt,
261
- "X-InertiaUI-Modal": H,
262
- "X-InertiaUI-Modal-Use-Router": o ? 1 : 0,
263
- "X-InertiaUI-Modal-Base-Url": be
264
- }, o)
265
- return qe = null, oe[H] = {
266
- config: y,
267
- onClose: N,
241
+ "X-Inertia-Version": Ct,
242
+ "X-InertiaUI-Modal": j,
243
+ "X-InertiaUI-Modal-Use-Router": X ? 1 : 0,
244
+ "X-InertiaUI-Modal-Base-Url": $e
245
+ }, X)
246
+ return nt = null, ce[j] = {
247
+ config: g,
248
+ onClose: x,
268
249
  onAfterLeave: h
269
- }, he.visit(W, {
270
- method: d,
271
- data: O,
250
+ }, xe.visit(H, {
251
+ method: s,
252
+ data: B,
272
253
  headers: p,
273
254
  preserveScroll: !0,
274
255
  preserveState: !0,
275
- onError: U,
256
+ onError: N,
276
257
  onFinish: () => {
277
- Zt(() => qe).then(K);
258
+ Pn(() => nt).then(_);
278
259
  }
279
260
  });
280
- Te({
281
- url: W,
282
- method: d,
283
- data: O,
261
+ Re({
262
+ url: H,
263
+ method: s,
264
+ data: B,
284
265
  headers: p
285
- }).then((u) => K(m(u.data, y, N, h))).catch((u) => {
286
- U(u);
266
+ }).then((P) => _(u(P.data, g, x, h))).catch((P) => {
267
+ N(P);
287
268
  });
288
269
  });
289
270
  }, c = {
290
- stack: e,
271
+ stack: t,
291
272
  localModals: r,
292
- push: s,
293
- pushFromResponseData: m,
273
+ push: i,
274
+ pushFromResponseData: u,
294
275
  closeAll: () => {
295
- Xe.reverse().forEach((g) => g.close());
276
+ rt.reverse().forEach((v) => v.close());
296
277
  },
297
- reset: () => l(() => []),
298
- visit: x,
299
- visitModal: b,
300
- registerLocalModal: (g, d) => {
301
- i((f) => ({
302
- ...f,
303
- [g]: { name: g, callback: d }
278
+ reset: () => a(() => []),
279
+ visit: y,
280
+ visitModal: f,
281
+ registerLocalModal: (v, s) => {
282
+ l((m) => ({
283
+ ...m,
284
+ [v]: { name: v, callback: s }
304
285
  }));
305
286
  },
306
- removeLocalModal: (g) => {
307
- i((d) => {
308
- const f = { ...d };
309
- return delete f[g], f;
287
+ removeLocalModal: (v) => {
288
+ l((s) => {
289
+ const m = { ...s };
290
+ return delete m[v], m;
310
291
  });
311
292
  }
312
293
  };
313
- return /* @__PURE__ */ F(Re.Provider, { value: c, children: t });
314
- }, Ae = () => {
315
- const t = de(Re);
316
- if (t === null)
294
+ return /* @__PURE__ */ T(_e.Provider, { value: c, children: e });
295
+ }, Be = () => {
296
+ const e = R(_e);
297
+ if (e === null)
317
298
  throw new Error("useModalStack must be used within a ModalStackProvider");
318
- return t;
319
- }, rt = ["closeButton", "closeExplicitly", "maxWidth", "paddingClasses", "panelClasses", "position", "slideover"], Jt = (t) => {
320
- t.initialPage && (mt = t.initialPage.version), t.resolveComponent && (pt = t.resolveComponent);
321
- }, hr = (t, e) => (Jt(e), /* @__PURE__ */ F(Yt, { children: /* @__PURE__ */ F(t, { ...e, children: ({ Component: r, props: i, key: l }) => /* @__PURE__ */ le(Ye, { children: [
299
+ return e;
300
+ }, xt = ["closeButton", "closeExplicitly", "maxWidth", "paddingClasses", "panelClasses", "position", "slideover"], Sn = (e) => {
301
+ e.initialPage && (Ct = e.initialPage.version), e.resolveComponent && (kt = e.resolveComponent);
302
+ }, Ll = (e, t) => (Sn(t), /* @__PURE__ */ T(Mn, { children: /* @__PURE__ */ T(e, { ...t, children: ({ Component: r, props: l, key: a }) => /* @__PURE__ */ ue(ct, { children: [
322
303
  (() => {
323
- const m = Ne(r, { key: l, ...i });
324
- return typeof r.layout == "function" ? r.layout(m) : Array.isArray(r.layout) ? r.layout.concat(m).reverse().reduce((v, b) => Ne(b, i, v)) : m;
304
+ const u = Ie(r, { key: a, ...l });
305
+ return typeof r.layout == "function" ? r.layout(u) : Array.isArray(r.layout) ? r.layout.concat(u).reverse().reduce((d, f) => Ie(f, l, d)) : u;
325
306
  })(),
326
- /* @__PURE__ */ F(Qt, {})
327
- ] }) }) })), Qt = ({ children: t }) => {
328
- var m;
329
- const e = de(Re);
307
+ /* @__PURE__ */ T(Ln, {})
308
+ ] }) }) })), Ln = ({ children: e }) => {
309
+ var u;
310
+ const t = R(_e);
330
311
  let n = !1, r = !1;
331
- D(() => he.on("start", () => n = !0), []), D(() => he.on("finish", () => n = !1), []), D(
332
- () => he.on("navigate", function(s) {
333
- const v = s.detail.page.props._inertiaui_modal;
334
- if (!v) {
335
- r && e.closeAll();
312
+ M(() => xe.on("start", () => n = !0), []), M(() => xe.on("finish", () => n = !1), []), M(
313
+ () => xe.on("navigate", function(i) {
314
+ const d = i.detail.page.props._inertiaui_modal;
315
+ if (!d) {
316
+ r && t.closeAll();
336
317
  return;
337
318
  }
338
- r = v, be = v.baseUrl, e.pushFromResponseData(v, {}, () => {
339
- if (!v.baseUrl) {
319
+ r = d, $e = d.baseUrl, t.pushFromResponseData(d, {}, () => {
320
+ if (!d.baseUrl) {
340
321
  console.error("No base url in modal response data so cannot navigate back");
341
322
  return;
342
323
  }
343
- !n && window.location.href !== v.baseUrl && he.visit(v.baseUrl, {
324
+ !n && window.location.href !== d.baseUrl && xe.visit(d.baseUrl, {
344
325
  preserveScroll: !0,
345
326
  preserveState: !0
346
327
  });
347
- }).then((b) => {
348
- qe = b;
328
+ }).then((f) => {
329
+ nt = f;
349
330
  });
350
331
  }),
351
332
  []
352
333
  );
353
- const i = (s) => (Xe.length && (s.headers["X-InertiaUI-Modal-Base-Url"] = be), s);
354
- D(() => (Te.interceptors.request.use(i), () => Te.interceptors.request.eject(i)), []);
355
- const l = Xt(), a = j();
356
- return D(() => {
357
- var b, x;
358
- const s = (b = l.props) == null ? void 0 : b._inertiaui_modal, v = a.current;
359
- a.current = s, s && v && s.component === v.component && s.url === v.url && ((x = e.stack[0]) == null || x.updateProps(s.props ?? {}));
360
- }, [(m = l.props) == null ? void 0 : m._inertiaui_modal]), /* @__PURE__ */ le(Ye, { children: [
361
- t,
362
- e.stack.length > 0 && /* @__PURE__ */ F(vt, { index: 0 })
334
+ const l = (i) => (rt.length && (i.headers["X-InertiaUI-Modal-Base-Url"] = $e), i);
335
+ M(() => (Re.interceptors.request.use(l), () => Re.interceptors.request.eject(l)), []);
336
+ const a = xn(), o = O();
337
+ return M(() => {
338
+ var f, y;
339
+ const i = (f = a.props) == null ? void 0 : f._inertiaui_modal, d = o.current;
340
+ o.current = i, i && d && i.component === d.component && i.url === d.url && ((y = t.stack[0]) == null || y.updateProps(i.props ?? {}));
341
+ }, [(u = a.props) == null ? void 0 : u._inertiaui_modal]), /* @__PURE__ */ ue(ct, { children: [
342
+ e,
343
+ t.stack.length > 0 && /* @__PURE__ */ T(At, { index: 0 })
363
344
  ] });
364
- }, Qe = B.createContext(null);
365
- Qe.displayName = "ModalIndexContext";
366
- const ht = () => {
367
- const t = B.useContext(Qe);
368
- if (t === void 0)
345
+ }, mt = E.createContext(null);
346
+ mt.displayName = "ModalIndexContext";
347
+ const Nt = () => {
348
+ const e = E.useContext(mt);
349
+ if (e === void 0)
369
350
  throw new Error("useModalIndex must be used within a ModalIndexProvider");
370
- return t;
371
- }, vt = ({ index: t }) => {
372
- const { stack: e } = Ae(), n = Y(() => e[t], [e, t]);
373
- return (n == null ? void 0 : n.component) && /* @__PURE__ */ F(Qe.Provider, { value: t, children: /* @__PURE__ */ F(
351
+ return e;
352
+ }, At = ({ index: e }) => {
353
+ const { stack: t } = Be(), n = C(() => t[e], [t, e]);
354
+ return (n == null ? void 0 : n.component) && /* @__PURE__ */ T(mt.Provider, { value: e, children: /* @__PURE__ */ T(
374
355
  n.component,
375
356
  {
376
357
  ...n.props,
377
358
  onModalEvent: (...r) => n.emit(...r)
378
359
  }
379
360
  ) });
380
- }, bt = Ze(({ name: t, children: e, onFocus: n = null, onBlur: r = null, onClose: i = null, onSuccess: l = null, ...a }, m) => {
381
- const s = ht(), { stack: v, registerLocalModal: b, removeLocalModal: x } = Ae(), [T, E] = $(null), c = Y(() => t ? T : v[s], [t, T, s, v]), g = Y(() => {
361
+ }, It = dt(({ name: e, children: t, onFocus: n = null, onBlur: r = null, onClose: l = null, onSuccess: a = null, ...o }, u) => {
362
+ const i = Nt(), { stack: d, registerLocalModal: f, removeLocalModal: y } = Be(), [b, w] = L(null), c = C(() => e ? b : d[i], [e, b, i, d]), v = C(() => {
382
363
  var h;
383
- return (h = v.find((k) => k.shouldRender && k.index > (c == null ? void 0 : c.index))) == null ? void 0 : h.index;
384
- }, [s, v]), d = Y(() => (c == null ? void 0 : c.config.slideover) ?? a.slideover ?? Je("type") === "slideover", [a.slideover]), f = Y(
364
+ return (h = d.find(($) => $.shouldRender && $.index > (c == null ? void 0 : c.index))) == null ? void 0 : h.index;
365
+ }, [i, d]), s = C(() => (c == null ? void 0 : c.config.slideover) ?? o.slideover ?? ft("type") === "slideover", [o.slideover]), m = C(
385
366
  () => ({
386
- slideover: d,
387
- closeButton: a.closeButton ?? se(d, "closeButton"),
388
- closeExplicitly: a.closeExplicitly ?? se(d, "closeExplicitly"),
389
- maxWidth: a.maxWidth ?? se(d, "maxWidth"),
390
- paddingClasses: a.paddingClasses ?? se(d, "paddingClasses"),
391
- panelClasses: a.panelClasses ?? se(d, "panelClasses"),
392
- position: a.position ?? se(d, "position"),
367
+ slideover: s,
368
+ closeButton: o.closeButton ?? de(s, "closeButton"),
369
+ closeExplicitly: o.closeExplicitly ?? de(s, "closeExplicitly"),
370
+ maxWidth: o.maxWidth ?? de(s, "maxWidth"),
371
+ paddingClasses: o.paddingClasses ?? de(s, "paddingClasses"),
372
+ panelClasses: o.panelClasses ?? de(s, "panelClasses"),
373
+ position: o.position ?? de(s, "position"),
393
374
  ...c == null ? void 0 : c.config
394
375
  }),
395
- [a, c == null ? void 0 : c.config]
376
+ [o, c == null ? void 0 : c.config]
396
377
  );
397
- D(() => {
398
- if (t) {
378
+ M(() => {
379
+ if (e) {
399
380
  let h = null;
400
- return b(t, (k) => {
401
- h = k.registerEventListenersFromProps(a), E(k);
381
+ return f(e, ($) => {
382
+ h = $.registerEventListenersFromProps(o), w($);
402
383
  }), () => {
403
- h == null || h(), h = null, x(t);
384
+ h == null || h(), h = null, y(e);
404
385
  };
405
386
  }
406
- return c.registerEventListenersFromProps(a);
407
- }, [t]);
408
- const p = j(c);
409
- D(() => {
387
+ return c.registerEventListenersFromProps(o);
388
+ }, [e]);
389
+ const p = O(c);
390
+ M(() => {
410
391
  p.current = c;
411
- }, [c]), D(() => {
412
- c !== null && (c.isOpen ? l == null || l() : i == null || i());
392
+ }, [c]), M(() => {
393
+ c !== null && (c.isOpen ? a == null || a() : l == null || l());
413
394
  }, [c == null ? void 0 : c.isOpen]);
414
- const [y, N] = $(!1);
415
- return D(() => {
416
- y && c !== null && c.isOpen && (c.onTopOfStack ? n == null || n() : r == null || r()), N(!0);
417
- }, [c == null ? void 0 : c.onTopOfStack]), ct(
418
- m,
395
+ const [g, x] = L(!1);
396
+ return M(() => {
397
+ g && c !== null && c.isOpen && (c.onTopOfStack ? n == null || n() : r == null || r()), x(!0);
398
+ }, [c == null ? void 0 : c.onTopOfStack]), Lt(
399
+ u,
419
400
  () => ({
420
401
  afterLeave: () => {
421
402
  var h;
@@ -426,8 +407,8 @@ const ht = () => {
426
407
  return (h = p.current) == null ? void 0 : h.close();
427
408
  },
428
409
  emit: (...h) => {
429
- var k;
430
- return (k = p.current) == null ? void 0 : k.emit(...h);
410
+ var $;
411
+ return ($ = p.current) == null ? void 0 : $.emit(...h);
431
412
  },
432
413
  getChildModal: () => {
433
414
  var h;
@@ -438,8 +419,8 @@ const ht = () => {
438
419
  return (h = p.current) == null ? void 0 : h.getParentModal();
439
420
  },
440
421
  reload: (...h) => {
441
- var k;
442
- return (k = p.current) == null ? void 0 : k.reload(...h);
422
+ var $;
423
+ return ($ = p.current) == null ? void 0 : $.reload(...h);
443
424
  },
444
425
  setOpen: () => {
445
426
  var h;
@@ -474,11 +455,11 @@ const ht = () => {
474
455
  }
475
456
  }),
476
457
  [c]
477
- ), (c == null ? void 0 : c.shouldRender) && /* @__PURE__ */ le(Ye, { children: [
478
- typeof e == "function" ? e({
458
+ ), (c == null ? void 0 : c.shouldRender) && /* @__PURE__ */ ue(ct, { children: [
459
+ typeof t == "function" ? t({
479
460
  afterLeave: c.afterLeave,
480
461
  close: c.close,
481
- config: f,
462
+ config: m,
482
463
  emit: c.emit,
483
464
  getChildModal: c.getChildModal,
484
465
  getParentModal: c.getParentModal,
@@ -490,31 +471,31 @@ const ht = () => {
490
471
  reload: c.reload,
491
472
  setOpen: c.setOpen,
492
473
  shouldRender: c.shouldRender
493
- }) : e,
494
- g && /* @__PURE__ */ F(vt, { index: g })
474
+ }) : t,
475
+ v && /* @__PURE__ */ T(At, { index: v })
495
476
  ] });
496
477
  });
497
- bt.displayName = "HeadlessModal";
498
- function gt(t) {
499
- var e, n, r = "";
500
- if (typeof t == "string" || typeof t == "number") r += t;
501
- else if (typeof t == "object") if (Array.isArray(t)) {
502
- var i = t.length;
503
- for (e = 0; e < i; e++) t[e] && (n = gt(t[e])) && (r && (r += " "), r += n);
504
- } else for (n in t) t[n] && (r && (r += " "), r += n);
478
+ It.displayName = "HeadlessModal";
479
+ function Rt(e) {
480
+ var t, n, r = "";
481
+ if (typeof e == "string" || typeof e == "number") r += e;
482
+ else if (typeof e == "object") if (Array.isArray(e)) {
483
+ var l = e.length;
484
+ for (t = 0; t < l; t++) e[t] && (n = Rt(e[t])) && (r && (r += " "), r += n);
485
+ } else for (n in e) e[n] && (r && (r += " "), r += n);
505
486
  return r;
506
487
  }
507
- function Se() {
508
- for (var t, e, n = 0, r = "", i = arguments.length; n < i; n++) (t = arguments[n]) && (e = gt(t)) && (r && (r += " "), r += e);
488
+ function De() {
489
+ for (var e, t, n = 0, r = "", l = arguments.length; n < l; n++) (e = arguments[n]) && (t = Rt(e)) && (r && (r += " "), r += t);
509
490
  return r;
510
491
  }
511
- var en = Object.defineProperty, tn = (t, e, n) => e in t ? en(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, Be = (t, e, n) => (tn(t, typeof e != "symbol" ? e + "" : e, n), n);
512
- let nn = class {
492
+ var Fn = Object.defineProperty, Cn = (e, t, n) => t in e ? Fn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, et = (e, t, n) => (Cn(e, typeof t != "symbol" ? t + "" : t, n), n);
493
+ let kn = class {
513
494
  constructor() {
514
- Be(this, "current", this.detect()), Be(this, "handoffState", "pending"), Be(this, "currentId", 0);
495
+ et(this, "current", this.detect()), et(this, "handoffState", "pending"), et(this, "currentId", 0);
515
496
  }
516
- set(e) {
517
- this.current !== e && (this.handoffState = "pending", this.currentId = 0, this.current = e);
497
+ set(t) {
498
+ this.current !== t && (this.handoffState = "pending", this.currentId = 0, this.current = t);
518
499
  }
519
500
  reset() {
520
501
  this.set(this.detect());
@@ -537,596 +518,1117 @@ let nn = class {
537
518
  get isHandoffComplete() {
538
519
  return this.handoffState === "complete";
539
520
  }
540
- }, Ee = new nn();
541
- function rn(t) {
542
- typeof queueMicrotask == "function" ? queueMicrotask(t) : Promise.resolve().then(t).catch((e) => setTimeout(() => {
543
- throw e;
521
+ }, oe = new kn();
522
+ function Xe(e) {
523
+ return oe.isServer ? null : e instanceof Node ? e.ownerDocument : e != null && e.hasOwnProperty("current") && e.current instanceof Node ? e.current.ownerDocument : document;
524
+ }
525
+ function Ve(e) {
526
+ typeof queueMicrotask == "function" ? queueMicrotask(e) : Promise.resolve().then(e).catch((t) => setTimeout(() => {
527
+ throw t;
544
528
  }));
545
529
  }
546
- function Me() {
547
- let t = [], e = { addEventListener(n, r, i, l) {
548
- return n.addEventListener(r, i, l), e.add(() => n.removeEventListener(r, i, l));
530
+ function re() {
531
+ let e = [], t = { addEventListener(n, r, l, a) {
532
+ return n.addEventListener(r, l, a), t.add(() => n.removeEventListener(r, l, a));
549
533
  }, requestAnimationFrame(...n) {
550
534
  let r = requestAnimationFrame(...n);
551
- return e.add(() => cancelAnimationFrame(r));
535
+ return t.add(() => cancelAnimationFrame(r));
552
536
  }, nextFrame(...n) {
553
- return e.requestAnimationFrame(() => e.requestAnimationFrame(...n));
537
+ return t.requestAnimationFrame(() => t.requestAnimationFrame(...n));
554
538
  }, setTimeout(...n) {
555
539
  let r = setTimeout(...n);
556
- return e.add(() => clearTimeout(r));
540
+ return t.add(() => clearTimeout(r));
557
541
  }, microTask(...n) {
558
542
  let r = { current: !0 };
559
- return rn(() => {
543
+ return Ve(() => {
560
544
  r.current && n[0]();
561
- }), e.add(() => {
545
+ }), t.add(() => {
562
546
  r.current = !1;
563
547
  });
564
- }, style(n, r, i) {
565
- let l = n.style.getPropertyValue(r);
566
- return Object.assign(n.style, { [r]: i }), this.add(() => {
567
- Object.assign(n.style, { [r]: l });
548
+ }, style(n, r, l) {
549
+ let a = n.style.getPropertyValue(r);
550
+ return Object.assign(n.style, { [r]: l }), this.add(() => {
551
+ Object.assign(n.style, { [r]: a });
568
552
  });
569
553
  }, group(n) {
570
- let r = Me();
554
+ let r = re();
571
555
  return n(r), this.add(() => r.dispose());
572
556
  }, add(n) {
573
- return t.includes(n) || t.push(n), () => {
574
- let r = t.indexOf(n);
575
- if (r >= 0) for (let i of t.splice(r, 1)) i();
557
+ return e.includes(n) || e.push(n), () => {
558
+ let r = e.indexOf(n);
559
+ if (r >= 0) for (let l of e.splice(r, 1)) l();
576
560
  };
577
561
  }, dispose() {
578
- for (let n of t.splice(0)) n();
562
+ for (let n of e.splice(0)) n();
579
563
  } };
580
- return e;
564
+ return t;
581
565
  }
582
- function yt() {
583
- let [t] = $(Me);
584
- return D(() => () => t.dispose(), [t]), t;
566
+ function pt() {
567
+ let [e] = L(re);
568
+ return M(() => () => e.dispose(), [e]), e;
585
569
  }
586
- let Q = (t, e) => {
587
- Ee.isServer ? D(t, e) : Ht(t, e);
570
+ let A = (e, t) => {
571
+ oe.isServer ? M(e, t) : pn(e, t);
588
572
  };
589
- function wt(t) {
590
- let e = j(t);
591
- return Q(() => {
592
- e.current = t;
593
- }, [t]), e;
594
- }
595
- let G = function(t) {
596
- let e = wt(t);
597
- return B.useCallback((...n) => e.current(...n), [e]);
598
- };
599
- function _e(...t) {
600
- return Array.from(new Set(t.flatMap((e) => typeof e == "string" ? e.split(" ") : []))).filter(Boolean).join(" ");
573
+ function se(e) {
574
+ let t = O(e);
575
+ return A(() => {
576
+ t.current = e;
577
+ }, [e]), t;
578
+ }
579
+ let S = function(e) {
580
+ let t = se(e);
581
+ return E.useCallback((...n) => t.current(...n), [t]);
582
+ }, Nn = U(void 0);
583
+ function An() {
584
+ return R(Nn);
601
585
  }
602
- function Le(t, e, ...n) {
603
- if (t in e) {
604
- let i = e[t];
605
- return typeof i == "function" ? i(...n) : i;
586
+ function lt(...e) {
587
+ return Array.from(new Set(e.flatMap((t) => typeof t == "string" ? t.split(" ") : []))).filter(Boolean).join(" ");
588
+ }
589
+ function ne(e, t, ...n) {
590
+ if (e in t) {
591
+ let l = t[e];
592
+ return typeof l == "function" ? l(...n) : l;
606
593
  }
607
- let r = new Error(`Tried to handle "${t}" but there is no handler defined. Only defined handlers are: ${Object.keys(e).map((i) => `"${i}"`).join(", ")}.`);
608
- throw Error.captureStackTrace && Error.captureStackTrace(r, Le), r;
609
- }
610
- var xt = ((t) => (t[t.None = 0] = "None", t[t.RenderStrategy = 1] = "RenderStrategy", t[t.Static = 2] = "Static", t))(xt || {}), J = ((t) => (t[t.Unmount = 0] = "Unmount", t[t.Hidden = 1] = "Hidden", t))(J || {});
611
- function Et() {
612
- let t = ln();
613
- return V((e) => an({ mergeRefs: t, ...e }), [t]);
614
- }
615
- function an({ ourProps: t, theirProps: e, slot: n, defaultTag: r, features: i, visible: l = !0, name: a, mergeRefs: m }) {
616
- m = m ?? sn;
617
- let s = Nt(e, t);
618
- if (l) return we(s, n, r, a, m);
619
- let v = i ?? 0;
620
- if (v & 2) {
621
- let { static: b = !1, ...x } = s;
622
- if (b) return we(x, n, r, a, m);
594
+ let r = new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map((l) => `"${l}"`).join(", ")}.`);
595
+ throw Error.captureStackTrace && Error.captureStackTrace(r, ne), r;
596
+ }
597
+ var je = ((e) => (e[e.None = 0] = "None", e[e.RenderStrategy = 1] = "RenderStrategy", e[e.Static = 2] = "Static", e))(je || {}), te = ((e) => (e[e.Unmount = 0] = "Unmount", e[e.Hidden = 1] = "Hidden", e))(te || {});
598
+ function W() {
599
+ let e = Rn();
600
+ return Y((t) => In({ mergeRefs: e, ...t }), [e]);
601
+ }
602
+ function In({ ourProps: e, theirProps: t, slot: n, defaultTag: r, features: l, visible: a = !0, name: o, mergeRefs: u }) {
603
+ u = u ?? Dn;
604
+ let i = Dt(t, e);
605
+ if (a) return Ae(i, n, r, o, u);
606
+ let d = l ?? 0;
607
+ if (d & 2) {
608
+ let { static: f = !1, ...y } = i;
609
+ if (f) return Ae(y, n, r, o, u);
623
610
  }
624
- if (v & 1) {
625
- let { unmount: b = !0, ...x } = s;
626
- return Le(b ? 0 : 1, { 0() {
611
+ if (d & 1) {
612
+ let { unmount: f = !0, ...y } = i;
613
+ return ne(f ? 0 : 1, { 0() {
627
614
  return null;
628
615
  }, 1() {
629
- return we({ ...x, hidden: !0, style: { display: "none" } }, n, r, a, m);
616
+ return Ae({ ...y, hidden: !0, style: { display: "none" } }, n, r, o, u);
630
617
  } });
631
618
  }
632
- return we(s, n, r, a, m);
633
- }
634
- function we(t, e = {}, n, r, i) {
635
- let { as: l = n, children: a, refName: m = "ref", ...s } = He(t, ["unmount", "static"]), v = t.ref !== void 0 ? { [m]: t.ref } : {}, b = typeof a == "function" ? a(e) : a;
636
- "className" in s && s.className && typeof s.className == "function" && (s.className = s.className(e)), s["aria-labelledby"] && s["aria-labelledby"] === s.id && (s["aria-labelledby"] = void 0);
637
- let x = {};
638
- if (e) {
639
- let T = !1, E = [];
640
- for (let [c, g] of Object.entries(e)) typeof g == "boolean" && (T = !0), g === !0 && E.push(c.replace(/([A-Z])/g, (d) => `-${d.toLowerCase()}`));
641
- if (T) {
642
- x["data-headlessui-state"] = E.join(" ");
643
- for (let c of E) x[`data-${c}`] = "";
619
+ return Ae(i, n, r, o, u);
620
+ }
621
+ function Ae(e, t = {}, n, r, l) {
622
+ let { as: a = n, children: o, refName: u = "ref", ...i } = tt(e, ["unmount", "static"]), d = e.ref !== void 0 ? { [u]: e.ref } : {}, f = typeof o == "function" ? o(t) : o;
623
+ "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);
624
+ let y = {};
625
+ if (t) {
626
+ let b = !1, w = [];
627
+ for (let [c, v] of Object.entries(t)) typeof v == "boolean" && (b = !0), v === !0 && w.push(c.replace(/([A-Z])/g, (s) => `-${s.toLowerCase()}`));
628
+ if (b) {
629
+ y["data-headlessui-state"] = w.join(" ");
630
+ for (let c of w) y[`data-${c}`] = "";
644
631
  }
645
632
  }
646
- if (l === ae && (Object.keys(te(s)).length > 0 || Object.keys(te(x)).length > 0)) if (!Kt(b) || Array.isArray(b) && b.length > 1) {
647
- if (Object.keys(te(s)).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(te(s)).concat(Object.keys(te(x))).map((T) => ` - ${T}`).join(`
648
- `), "", "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((T) => ` - ${T}`).join(`
633
+ if (a === G && (Object.keys(le(i)).length > 0 || Object.keys(le(y)).length > 0)) if (!hn(f) || Array.isArray(f) && f.length > 1) {
634
+ 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(`
635
+ `), "", "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(`
649
636
  `)].join(`
650
637
  `));
651
638
  } else {
652
- let T = b.props, E = T == null ? void 0 : T.className, c = typeof E == "function" ? (...f) => _e(E(...f), s.className) : _e(E, s.className), g = c ? { className: c } : {}, d = Nt(b.props, te(He(s, ["ref"])));
653
- for (let f in x) f in d && delete x[f];
654
- return qt(b, Object.assign({}, d, x, v, { ref: i(on(b), v.ref) }, g));
639
+ let b = f.props, w = b == null ? void 0 : b.className, c = typeof w == "function" ? (...m) => lt(w(...m), i.className) : lt(w, i.className), v = c ? { className: c } : {}, s = Dt(f.props, le(tt(i, ["ref"])));
640
+ for (let m in y) m in s && delete y[m];
641
+ return vn(f, Object.assign({}, s, y, d, { ref: l(jn(f), d.ref) }, v));
655
642
  }
656
- return Ne(l, Object.assign({}, He(s, ["ref"]), l !== ae && v, l !== ae && x), b);
643
+ return Ie(a, Object.assign({}, tt(i, ["ref"]), a !== G && d, a !== G && y), f);
657
644
  }
658
- function ln() {
659
- let t = j([]), e = V((n) => {
660
- for (let r of t.current) r != null && (typeof r == "function" ? r(n) : r.current = n);
645
+ function Rn() {
646
+ let e = O([]), t = Y((n) => {
647
+ for (let r of e.current) r != null && (typeof r == "function" ? r(n) : r.current = n);
661
648
  }, []);
662
649
  return (...n) => {
663
- if (!n.every((r) => r == null)) return t.current = n, e;
650
+ if (!n.every((r) => r == null)) return e.current = n, t;
664
651
  };
665
652
  }
666
- function sn(...t) {
667
- return t.every((e) => e == null) ? void 0 : (e) => {
668
- for (let n of t) n != null && (typeof n == "function" ? n(e) : n.current = e);
653
+ function Dn(...e) {
654
+ return e.every((t) => t == null) ? void 0 : (t) => {
655
+ for (let n of e) n != null && (typeof n == "function" ? n(t) : n.current = t);
669
656
  };
670
657
  }
671
- function Nt(...t) {
672
- if (t.length === 0) return {};
673
- if (t.length === 1) return t[0];
674
- let e = {}, n = {};
675
- for (let r of t) for (let i in r) i.startsWith("on") && typeof r[i] == "function" ? (n[i] != null || (n[i] = []), n[i].push(r[i])) : e[i] = r[i];
676
- if (e.disabled || e["aria-disabled"]) for (let r in n) /^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r) && (n[r] = [(i) => {
677
- var l;
678
- return (l = i == null ? void 0 : i.preventDefault) == null ? void 0 : l.call(i);
658
+ function Dt(...e) {
659
+ if (e.length === 0) return {};
660
+ if (e.length === 1) return e[0];
661
+ let t = {}, n = {};
662
+ for (let r of e) for (let l in r) l.startsWith("on") && typeof r[l] == "function" ? (n[l] != null || (n[l] = []), n[l].push(r[l])) : t[l] = r[l];
663
+ if (t.disabled || t["aria-disabled"]) for (let r in n) /^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r) && (n[r] = [(l) => {
664
+ var a;
665
+ return (a = l == null ? void 0 : l.preventDefault) == null ? void 0 : a.call(l);
679
666
  }]);
680
- for (let r in n) Object.assign(e, { [r](i, ...l) {
681
- let a = n[r];
682
- for (let m of a) {
683
- if ((i instanceof Event || (i == null ? void 0 : i.nativeEvent) instanceof Event) && i.defaultPrevented) return;
684
- m(i, ...l);
667
+ for (let r in n) Object.assign(t, { [r](l, ...a) {
668
+ let o = n[r];
669
+ for (let u of o) {
670
+ if ((l instanceof Event || (l == null ? void 0 : l.nativeEvent) instanceof Event) && l.defaultPrevented) return;
671
+ u(l, ...a);
685
672
  }
686
673
  } });
687
- return e;
674
+ return t;
688
675
  }
689
- function et(t) {
690
- var e;
691
- return Object.assign(Ze(t), { displayName: (e = t.displayName) != null ? e : t.name });
676
+ function D(e) {
677
+ var t;
678
+ return Object.assign(dt(e), { displayName: (t = e.displayName) != null ? t : e.name });
692
679
  }
693
- function te(t) {
694
- let e = Object.assign({}, t);
695
- for (let n in e) e[n] === void 0 && delete e[n];
696
- return e;
680
+ function le(e) {
681
+ let t = Object.assign({}, e);
682
+ for (let n in t) t[n] === void 0 && delete t[n];
683
+ return t;
697
684
  }
698
- function He(t, e = []) {
699
- let n = Object.assign({}, t);
700
- for (let r of e) r in n && delete n[r];
685
+ function tt(e, t = []) {
686
+ let n = Object.assign({}, e);
687
+ for (let r of t) r in n && delete n[r];
701
688
  return n;
702
689
  }
703
- function on(t) {
704
- return B.version.split(".")[0] >= "19" ? t.props.ref : t.ref;
690
+ function jn(e) {
691
+ return E.version.split(".")[0] >= "19" ? e.props.ref : e.ref;
705
692
  }
706
- let un = Symbol();
707
- function Tt(...t) {
708
- let e = j(t);
709
- D(() => {
710
- e.current = t;
711
- }, [t]);
712
- let n = G((r) => {
713
- for (let i of e.current) i != null && (typeof i == "function" ? i(r) : i.current = r);
693
+ let Hn = "span";
694
+ var He = ((e) => (e[e.None = 1] = "None", e[e.Focusable = 2] = "Focusable", e[e.Hidden = 4] = "Hidden", e))(He || {});
695
+ function Un(e, t) {
696
+ var n;
697
+ let { features: r = 1, ...l } = e, a = { 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" } } };
698
+ return W()({ ourProps: a, theirProps: l, slot: {}, defaultTag: Hn, name: "Hidden" });
699
+ }
700
+ let it = D(Un), jt = Symbol();
701
+ function Wn(e, t = !0) {
702
+ return Object.assign(e, { [jt]: t });
703
+ }
704
+ function Z(...e) {
705
+ let t = O(e);
706
+ M(() => {
707
+ t.current = e;
708
+ }, [e]);
709
+ let n = S((r) => {
710
+ for (let l of t.current) l != null && (typeof l == "function" ? l(r) : l.current = r);
711
+ });
712
+ return e.every((r) => r == null || (r == null ? void 0 : r[jt])) ? void 0 : n;
713
+ }
714
+ let ht = U(null);
715
+ ht.displayName = "DescriptionContext";
716
+ function Ht() {
717
+ let e = R(ht);
718
+ if (e === null) {
719
+ let t = new Error("You used a <Description /> component, but it is not inside a relevant parent.");
720
+ throw Error.captureStackTrace && Error.captureStackTrace(t, Ht), t;
721
+ }
722
+ return e;
723
+ }
724
+ function _n() {
725
+ let [e, t] = L([]);
726
+ return [e.length > 0 ? e.join(" ") : void 0, C(() => function(n) {
727
+ let r = S((a) => (t((o) => [...o, a]), () => t((o) => {
728
+ let u = o.slice(), i = u.indexOf(a);
729
+ return i !== -1 && u.splice(i, 1), u;
730
+ }))), l = C(() => ({ register: r, slot: n.slot, name: n.name, props: n.props, value: n.value }), [r, n.slot, n.name, n.props, n.value]);
731
+ return E.createElement(ht.Provider, { value: l }, n.children);
732
+ }, [t])];
733
+ }
734
+ let Bn = "p";
735
+ function Xn(e, t) {
736
+ let n = Pe(), r = An(), { id: l = `headlessui-description-${n}`, ...a } = e, o = Ht(), u = Z(t);
737
+ A(() => o.register(l), [l, o.register]);
738
+ let i = r || !1, d = C(() => ({ ...o.slot, disabled: i }), [o.slot, i]), f = { ref: u, ...o.props, id: l };
739
+ return W()({ ourProps: f, theirProps: a, slot: d, defaultTag: Bn, name: o.name || "Description" });
740
+ }
741
+ let Vn = D(Xn), qn = Object.assign(Vn, {});
742
+ var Ut = ((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))(Ut || {});
743
+ let Yn = U(() => {
744
+ });
745
+ function zn({ value: e, children: t }) {
746
+ return E.createElement(Yn.Provider, { value: e }, t);
747
+ }
748
+ let Gn = class extends Map {
749
+ constructor(t) {
750
+ super(), this.factory = t;
751
+ }
752
+ get(t) {
753
+ let n = super.get(t);
754
+ return n === void 0 && (n = this.factory(t), this.set(t, n)), n;
755
+ }
756
+ };
757
+ function Wt(e, t) {
758
+ let n = e(), r = /* @__PURE__ */ new Set();
759
+ return { getSnapshot() {
760
+ return n;
761
+ }, subscribe(l) {
762
+ return r.add(l), () => r.delete(l);
763
+ }, dispatch(l, ...a) {
764
+ let o = t[l].call(n, ...a);
765
+ o && (n = o, r.forEach((u) => u()));
766
+ } };
767
+ }
768
+ function _t(e) {
769
+ return gn(e.subscribe, e.getSnapshot, e.getSnapshot);
770
+ }
771
+ let Kn = new Gn(() => Wt(() => [], { ADD(e) {
772
+ return this.includes(e) ? this : [...this, e];
773
+ }, REMOVE(e) {
774
+ let t = this.indexOf(e);
775
+ if (t === -1) return this;
776
+ let n = this.slice();
777
+ return n.splice(t, 1), n;
778
+ } }));
779
+ function fe(e, t) {
780
+ let n = Kn.get(t), r = Pe(), l = _t(n);
781
+ if (A(() => {
782
+ if (e) return n.dispatch("ADD", r), () => n.dispatch("REMOVE", r);
783
+ }, [n, e]), !e) return !1;
784
+ let a = l.indexOf(r), o = l.length;
785
+ return a === -1 && (a = o, o += 1), a === o - 1;
786
+ }
787
+ let at = /* @__PURE__ */ new Map(), Te = /* @__PURE__ */ new Map();
788
+ function bt(e) {
789
+ var t;
790
+ let n = (t = Te.get(e)) != null ? t : 0;
791
+ return Te.set(e, n + 1), n !== 0 ? () => Et(e) : (at.set(e, { "aria-hidden": e.getAttribute("aria-hidden"), inert: e.inert }), e.setAttribute("aria-hidden", "true"), e.inert = !0, () => Et(e));
792
+ }
793
+ function Et(e) {
794
+ var t;
795
+ let n = (t = Te.get(e)) != null ? t : 1;
796
+ if (n === 1 ? Te.delete(e) : Te.set(e, n - 1), n !== 1) return;
797
+ let r = at.get(e);
798
+ r && (r["aria-hidden"] === null ? e.removeAttribute("aria-hidden") : e.setAttribute("aria-hidden", r["aria-hidden"]), e.inert = r.inert, at.delete(e));
799
+ }
800
+ function Zn(e, { allowed: t, disallowed: n } = {}) {
801
+ let r = fe(e, "inert-others");
802
+ A(() => {
803
+ var l, a;
804
+ if (!r) return;
805
+ let o = re();
806
+ for (let i of (l = n == null ? void 0 : n()) != null ? l : []) i && o.add(bt(i));
807
+ let u = (a = t == null ? void 0 : t()) != null ? a : [];
808
+ for (let i of u) {
809
+ if (!i) continue;
810
+ let d = Xe(i);
811
+ if (!d) continue;
812
+ let f = i.parentElement;
813
+ for (; f && f !== d.body; ) {
814
+ for (let y of f.children) u.some((b) => y.contains(b)) || o.add(bt(y));
815
+ f = f.parentElement;
816
+ }
817
+ }
818
+ return o.dispose;
819
+ }, [r, t, n]);
820
+ }
821
+ function Jn(e, t, n) {
822
+ let r = se((l) => {
823
+ let a = l.getBoundingClientRect();
824
+ a.x === 0 && a.y === 0 && a.width === 0 && a.height === 0 && n();
825
+ });
826
+ M(() => {
827
+ if (!e) return;
828
+ let l = t === null ? null : t instanceof HTMLElement ? t : t.current;
829
+ if (!l) return;
830
+ let a = re();
831
+ if (typeof ResizeObserver < "u") {
832
+ let o = new ResizeObserver(() => r.current(l));
833
+ o.observe(l), a.add(() => o.disconnect());
834
+ }
835
+ if (typeof IntersectionObserver < "u") {
836
+ let o = new IntersectionObserver(() => r.current(l));
837
+ o.observe(l), a.add(() => o.disconnect());
838
+ }
839
+ return () => a.dispose();
840
+ }, [t, r, e]);
841
+ }
842
+ let Ue = ["[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(","), Qn = ["[data-autofocus]"].map((e) => `${e}:not([tabindex='-1'])`).join(",");
843
+ 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 || {}), ot = ((e) => (e[e.Error = 0] = "Error", e[e.Overflow = 1] = "Overflow", e[e.Success = 2] = "Success", e[e.Underflow = 3] = "Underflow", e))(ot || {}), er = ((e) => (e[e.Previous = -1] = "Previous", e[e.Next = 1] = "Next", e))(er || {});
844
+ function tr(e = document.body) {
845
+ return e == null ? [] : Array.from(e.querySelectorAll(Ue)).sort((t, n) => Math.sign((t.tabIndex || Number.MAX_SAFE_INTEGER) - (n.tabIndex || Number.MAX_SAFE_INTEGER)));
846
+ }
847
+ function nr(e = document.body) {
848
+ return e == null ? [] : Array.from(e.querySelectorAll(Qn)).sort((t, n) => Math.sign((t.tabIndex || Number.MAX_SAFE_INTEGER) - (n.tabIndex || Number.MAX_SAFE_INTEGER)));
849
+ }
850
+ var Bt = ((e) => (e[e.Strict = 0] = "Strict", e[e.Loose = 1] = "Loose", e))(Bt || {});
851
+ function rr(e, t = 0) {
852
+ var n;
853
+ return e === ((n = Xe(e)) == null ? void 0 : n.body) ? !1 : ne(t, { 0() {
854
+ return e.matches(Ue);
855
+ }, 1() {
856
+ let r = e;
857
+ for (; r !== null; ) {
858
+ if (r.matches(Ue)) return !0;
859
+ r = r.parentElement;
860
+ }
861
+ return !1;
862
+ } });
863
+ }
864
+ var lr = ((e) => (e[e.Keyboard = 0] = "Keyboard", e[e.Mouse = 1] = "Mouse", e))(lr || {});
865
+ typeof window < "u" && typeof document < "u" && (document.addEventListener("keydown", (e) => {
866
+ e.metaKey || e.altKey || e.ctrlKey || (document.documentElement.dataset.headlessuiFocusVisible = "");
867
+ }, !0), document.addEventListener("click", (e) => {
868
+ e.detail === 1 ? delete document.documentElement.dataset.headlessuiFocusVisible : e.detail === 0 && (document.documentElement.dataset.headlessuiFocusVisible = "");
869
+ }, !0));
870
+ function Q(e) {
871
+ e == null || e.focus({ preventScroll: !0 });
872
+ }
873
+ let ir = ["textarea", "input"].join(",");
874
+ function ar(e) {
875
+ var t, n;
876
+ return (n = (t = e == null ? void 0 : e.matches) == null ? void 0 : t.call(e, ir)) != null ? n : !1;
877
+ }
878
+ function or(e, t = (n) => n) {
879
+ return e.slice().sort((n, r) => {
880
+ let l = t(n), a = t(r);
881
+ if (l === null || a === null) return 0;
882
+ let o = l.compareDocumentPosition(a);
883
+ return o & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : o & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
884
+ });
885
+ }
886
+ function Oe(e, t, { sorted: n = !0, relativeTo: r = null, skipElements: l = [] } = {}) {
887
+ let a = Array.isArray(e) ? e.length > 0 ? e[0].ownerDocument : document : e.ownerDocument, o = Array.isArray(e) ? n ? or(e) : e : t & 64 ? nr(e) : tr(e);
888
+ l.length > 0 && o.length > 1 && (o = o.filter((w) => !l.some((c) => c != null && "current" in c ? (c == null ? void 0 : c.current) === w : c === w))), r = r ?? a.activeElement;
889
+ let u = (() => {
890
+ if (t & 5) return 1;
891
+ if (t & 10) return -1;
892
+ throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
893
+ })(), i = (() => {
894
+ if (t & 1) return 0;
895
+ if (t & 2) return Math.max(0, o.indexOf(r)) - 1;
896
+ if (t & 4) return Math.max(0, o.indexOf(r)) + 1;
897
+ if (t & 8) return o.length - 1;
898
+ throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
899
+ })(), d = t & 32 ? { preventScroll: !0 } : {}, f = 0, y = o.length, b;
900
+ do {
901
+ if (f >= y || f + y <= 0) return 0;
902
+ let w = i + f;
903
+ if (t & 16) w = (w + y) % y;
904
+ else {
905
+ if (w < 0) return 3;
906
+ if (w >= y) return 1;
907
+ }
908
+ b = o[w], b == null || b.focus(d), f += u;
909
+ } while (b !== a.activeElement);
910
+ return t & 6 && ar(b) && b.select(), 2;
911
+ }
912
+ function Xt() {
913
+ return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
914
+ }
915
+ function ur() {
916
+ return /Android/gi.test(window.navigator.userAgent);
917
+ }
918
+ function sr() {
919
+ return Xt() || ur();
920
+ }
921
+ function ye(e, t, n, r) {
922
+ let l = se(n);
923
+ M(() => {
924
+ if (!e) return;
925
+ function a(o) {
926
+ l.current(o);
927
+ }
928
+ return document.addEventListener(t, a, r), () => document.removeEventListener(t, a, r);
929
+ }, [e, t, r]);
930
+ }
931
+ function Vt(e, t, n, r) {
932
+ let l = se(n);
933
+ M(() => {
934
+ if (!e) return;
935
+ function a(o) {
936
+ l.current(o);
937
+ }
938
+ return window.addEventListener(t, a, r), () => window.removeEventListener(t, a, r);
939
+ }, [e, t, r]);
940
+ }
941
+ const $t = 30;
942
+ function dr(e, t, n) {
943
+ let r = fe(e, "outside-click"), l = se(n), a = Y(function(i, d) {
944
+ if (i.defaultPrevented) return;
945
+ let f = d(i);
946
+ if (f === null || !f.getRootNode().contains(f) || !f.isConnected) return;
947
+ let y = function b(w) {
948
+ return typeof w == "function" ? b(w()) : Array.isArray(w) || w instanceof Set ? w : [w];
949
+ }(t);
950
+ for (let b of y) if (b !== null && (b.contains(f) || i.composed && i.composedPath().includes(b))) return;
951
+ return !rr(f, Bt.Loose) && f.tabIndex !== -1 && i.preventDefault(), l.current(i, f);
952
+ }, [l, t]), o = O(null);
953
+ ye(r, "pointerdown", (i) => {
954
+ var d, f;
955
+ o.current = ((f = (d = i.composedPath) == null ? void 0 : d.call(i)) == null ? void 0 : f[0]) || i.target;
956
+ }, !0), ye(r, "mousedown", (i) => {
957
+ var d, f;
958
+ o.current = ((f = (d = i.composedPath) == null ? void 0 : d.call(i)) == null ? void 0 : f[0]) || i.target;
959
+ }, !0), ye(r, "click", (i) => {
960
+ sr() || o.current && (a(i, () => o.current), o.current = null);
961
+ }, !0);
962
+ let u = O({ x: 0, y: 0 });
963
+ ye(r, "touchstart", (i) => {
964
+ u.current.x = i.touches[0].clientX, u.current.y = i.touches[0].clientY;
965
+ }, !0), ye(r, "touchend", (i) => {
966
+ let d = { x: i.changedTouches[0].clientX, y: i.changedTouches[0].clientY };
967
+ if (!(Math.abs(d.x - u.current.x) >= $t || Math.abs(d.y - u.current.y) >= $t)) return a(i, () => i.target instanceof HTMLElement ? i.target : null);
968
+ }, !0), Vt(r, "blur", (i) => a(i, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), !0);
969
+ }
970
+ function Me(...e) {
971
+ return C(() => Xe(...e), [...e]);
972
+ }
973
+ function qt(e, t, n, r) {
974
+ let l = se(n);
975
+ M(() => {
976
+ e = e ?? window;
977
+ function a(o) {
978
+ l.current(o);
979
+ }
980
+ return e.addEventListener(t, a, r), () => e.removeEventListener(t, a, r);
981
+ }, [e, t, r]);
982
+ }
983
+ function cr() {
984
+ let e;
985
+ return { before({ doc: t }) {
986
+ var n;
987
+ let r = t.documentElement, l = (n = t.defaultView) != null ? n : window;
988
+ e = Math.max(0, l.innerWidth - r.clientWidth);
989
+ }, after({ doc: t, d: n }) {
990
+ let r = t.documentElement, l = Math.max(0, r.clientWidth - r.offsetWidth), a = Math.max(0, e - l);
991
+ n.style(r, "paddingRight", `${a}px`);
992
+ } };
993
+ }
994
+ function fr() {
995
+ return Xt() ? { before({ doc: e, d: t, meta: n }) {
996
+ function r(l) {
997
+ return n.containers.flatMap((a) => a()).some((a) => a.contains(l));
998
+ }
999
+ t.microTask(() => {
1000
+ var l;
1001
+ if (window.getComputedStyle(e.documentElement).scrollBehavior !== "auto") {
1002
+ let u = re();
1003
+ u.style(e.documentElement, "scrollBehavior", "auto"), t.add(() => t.microTask(() => u.dispose()));
1004
+ }
1005
+ let a = (l = window.scrollY) != null ? l : window.pageYOffset, o = null;
1006
+ t.addEventListener(e, "click", (u) => {
1007
+ if (u.target instanceof HTMLElement) try {
1008
+ let i = u.target.closest("a");
1009
+ if (!i) return;
1010
+ let { hash: d } = new URL(i.href), f = e.querySelector(d);
1011
+ f && !r(f) && (o = f);
1012
+ } catch {
1013
+ }
1014
+ }, !0), t.addEventListener(e, "touchstart", (u) => {
1015
+ if (u.target instanceof HTMLElement) if (r(u.target)) {
1016
+ let i = u.target;
1017
+ for (; i.parentElement && r(i.parentElement); ) i = i.parentElement;
1018
+ t.style(i, "overscrollBehavior", "contain");
1019
+ } else t.style(u.target, "touchAction", "none");
1020
+ }), t.addEventListener(e, "touchmove", (u) => {
1021
+ if (u.target instanceof HTMLElement) {
1022
+ if (u.target.tagName === "INPUT") return;
1023
+ if (r(u.target)) {
1024
+ let i = u.target;
1025
+ for (; i.parentElement && i.dataset.headlessuiPortal !== "" && !(i.scrollHeight > i.clientHeight || i.scrollWidth > i.clientWidth); ) i = i.parentElement;
1026
+ i.dataset.headlessuiPortal === "" && u.preventDefault();
1027
+ } else u.preventDefault();
1028
+ }
1029
+ }, { passive: !1 }), t.add(() => {
1030
+ var u;
1031
+ let i = (u = window.scrollY) != null ? u : window.pageYOffset;
1032
+ a !== i && window.scrollTo(0, a), o && o.isConnected && (o.scrollIntoView({ block: "nearest" }), o = null);
1033
+ });
1034
+ });
1035
+ } } : {};
1036
+ }
1037
+ function mr() {
1038
+ return { before({ doc: e, d: t }) {
1039
+ t.style(e.documentElement, "overflow", "hidden");
1040
+ } };
1041
+ }
1042
+ function pr(e) {
1043
+ let t = {};
1044
+ for (let n of e) Object.assign(t, n(t));
1045
+ return t;
1046
+ }
1047
+ let ae = Wt(() => /* @__PURE__ */ new Map(), { PUSH(e, t) {
1048
+ var n;
1049
+ let r = (n = this.get(e)) != null ? n : { doc: e, count: 0, d: re(), meta: /* @__PURE__ */ new Set() };
1050
+ return r.count++, r.meta.add(t), this.set(e, r), this;
1051
+ }, POP(e, t) {
1052
+ let n = this.get(e);
1053
+ return n && (n.count--, n.meta.delete(t)), this;
1054
+ }, SCROLL_PREVENT({ doc: e, d: t, meta: n }) {
1055
+ let r = { doc: e, d: t, meta: pr(n) }, l = [fr(), cr(), mr()];
1056
+ l.forEach(({ before: a }) => a == null ? void 0 : a(r)), l.forEach(({ after: a }) => a == null ? void 0 : a(r));
1057
+ }, SCROLL_ALLOW({ d: e }) {
1058
+ e.dispose();
1059
+ }, TEARDOWN({ doc: e }) {
1060
+ this.delete(e);
1061
+ } });
1062
+ ae.subscribe(() => {
1063
+ let e = ae.getSnapshot(), t = /* @__PURE__ */ new Map();
1064
+ for (let [n] of e) t.set(n, n.documentElement.style.overflow);
1065
+ for (let n of e.values()) {
1066
+ let r = t.get(n.doc) === "hidden", l = n.count !== 0;
1067
+ (l && !r || !l && r) && ae.dispatch(n.count > 0 ? "SCROLL_PREVENT" : "SCROLL_ALLOW", n), n.count === 0 && ae.dispatch("TEARDOWN", n);
1068
+ }
1069
+ });
1070
+ function hr(e, t, n = () => ({ containers: [] })) {
1071
+ let r = _t(ae), l = t ? r.get(t) : void 0, a = l ? l.count > 0 : !1;
1072
+ return A(() => {
1073
+ if (!(!t || !e)) return ae.dispatch("PUSH", t, n), () => ae.dispatch("POP", t, n);
1074
+ }, [e, t]), a;
1075
+ }
1076
+ function vr(e, t, n = () => [document.body]) {
1077
+ let r = fe(e, "scroll-lock");
1078
+ hr(r, t, (l) => {
1079
+ var a;
1080
+ return { containers: [...(a = l.containers) != null ? a : [], n] };
714
1081
  });
715
- return t.every((r) => r == null || (r == null ? void 0 : r[un])) ? void 0 : n;
716
1082
  }
717
- function dn(t = 0) {
718
- let [e, n] = $(t), r = V((s) => n(s), [e]), i = V((s) => n((v) => v | s), [e]), l = V((s) => (e & s) === s, [e]), a = V((s) => n((v) => v & ~s), [n]), m = V((s) => n((v) => v ^ s), [n]);
719
- return { flags: e, setFlag: r, addFlag: i, hasFlag: l, removeFlag: a, toggleFlag: m };
1083
+ function gr(e = 0) {
1084
+ let [t, n] = L(e), r = Y((i) => n(i), [t]), l = Y((i) => n((d) => d | i), [t]), a = Y((i) => (t & i) === i, [t]), o = Y((i) => n((d) => d & ~i), [n]), u = Y((i) => n((d) => d ^ i), [n]);
1085
+ return { flags: t, setFlag: r, addFlag: l, hasFlag: a, removeFlag: o, toggleFlag: u };
720
1086
  }
721
- var at, it;
722
- typeof process < "u" && typeof globalThis < "u" && typeof Element < "u" && ((at = process == null ? void 0 : process.env) == null ? void 0 : at.NODE_ENV) === "test" && typeof ((it = Element == null ? void 0 : Element.prototype) == null ? void 0 : it.getAnimations) > "u" && (Element.prototype.getAnimations = function() {
1087
+ var Tt, Ot;
1088
+ 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() {
723
1089
  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(`
724
1090
  `)), [];
725
1091
  });
726
- var cn = ((t) => (t[t.None = 0] = "None", t[t.Closed = 1] = "Closed", t[t.Enter = 2] = "Enter", t[t.Leave = 4] = "Leave", t))(cn || {});
727
- function fn(t) {
728
- let e = {};
729
- for (let n in t) t[n] === !0 && (e[`data-${n}`] = "");
730
- return e;
1092
+ var wr = ((e) => (e[e.None = 0] = "None", e[e.Closed = 1] = "Closed", e[e.Enter = 2] = "Enter", e[e.Leave = 4] = "Leave", e))(wr || {});
1093
+ function yr(e) {
1094
+ let t = {};
1095
+ for (let n in e) e[n] === !0 && (t[`data-${n}`] = "");
1096
+ return t;
731
1097
  }
732
- function mn(t, e, n, r) {
733
- let [i, l] = $(n), { hasFlag: a, addFlag: m, removeFlag: s } = dn(t && i ? 3 : 0), v = j(!1), b = j(!1), x = yt();
734
- return Q(() => {
735
- var T;
736
- if (t) {
737
- if (n && l(!0), !e) {
738
- n && m(3);
1098
+ function xr(e, t, n, r) {
1099
+ let [l, a] = L(n), { hasFlag: o, addFlag: u, removeFlag: i } = gr(e && l ? 3 : 0), d = O(!1), f = O(!1), y = pt();
1100
+ return A(() => {
1101
+ var b;
1102
+ if (e) {
1103
+ if (n && a(!0), !t) {
1104
+ n && u(3);
739
1105
  return;
740
1106
  }
741
- return (T = r == null ? void 0 : r.start) == null || T.call(r, n), pn(e, { inFlight: v, prepare() {
742
- b.current ? b.current = !1 : b.current = v.current, v.current = !0, !b.current && (n ? (m(3), s(4)) : (m(4), s(2)));
1107
+ return (b = r == null ? void 0 : r.start) == null || b.call(r, n), br(t, { inFlight: d, prepare() {
1108
+ f.current ? f.current = !1 : f.current = d.current, d.current = !0, !f.current && (n ? (u(3), i(4)) : (u(4), i(2)));
743
1109
  }, run() {
744
- b.current ? n ? (s(3), m(4)) : (s(4), m(3)) : n ? s(1) : m(1);
1110
+ f.current ? n ? (i(3), u(4)) : (i(4), u(3)) : n ? i(1) : u(1);
745
1111
  }, done() {
746
- var E;
747
- b.current && typeof e.getAnimations == "function" && e.getAnimations().length > 0 || (v.current = !1, s(7), n || l(!1), (E = r == null ? void 0 : r.end) == null || E.call(r, n));
1112
+ var w;
1113
+ f.current && typeof t.getAnimations == "function" && t.getAnimations().length > 0 || (d.current = !1, i(7), n || a(!1), (w = r == null ? void 0 : r.end) == null || w.call(r, n));
748
1114
  } });
749
1115
  }
750
- }, [t, n, e, x]), t ? [i, { 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 }];
1116
+ }, [e, n, t, y]), e ? [l, { closed: o(1), enter: o(2), leave: o(4), transition: o(2) || o(4) }] : [n, { closed: void 0, enter: void 0, leave: void 0, transition: void 0 }];
751
1117
  }
752
- function pn(t, { prepare: e, run: n, done: r, inFlight: i }) {
753
- let l = Me();
754
- return vn(t, { prepare: e, inFlight: i }), l.nextFrame(() => {
755
- n(), l.requestAnimationFrame(() => {
756
- l.add(hn(t, r));
1118
+ function br(e, { prepare: t, run: n, done: r, inFlight: l }) {
1119
+ let a = re();
1120
+ return $r(e, { prepare: t, inFlight: l }), a.nextFrame(() => {
1121
+ n(), a.requestAnimationFrame(() => {
1122
+ a.add(Er(e, r));
757
1123
  });
758
- }), l.dispose;
1124
+ }), a.dispose;
759
1125
  }
760
- function hn(t, e) {
1126
+ function Er(e, t) {
761
1127
  var n, r;
762
- let i = Me();
763
- if (!t) return i.dispose;
764
- let l = !1;
765
- i.add(() => {
766
- l = !0;
1128
+ let l = re();
1129
+ if (!e) return l.dispose;
1130
+ let a = !1;
1131
+ l.add(() => {
1132
+ a = !0;
767
1133
  });
768
- let a = (r = (n = t.getAnimations) == null ? void 0 : n.call(t).filter((m) => m instanceof CSSTransition)) != null ? r : [];
769
- return a.length === 0 ? (e(), i.dispose) : (Promise.allSettled(a.map((m) => m.finished)).then(() => {
770
- l || e();
771
- }), i.dispose);
1134
+ let o = (r = (n = e.getAnimations) == null ? void 0 : n.call(e).filter((u) => u instanceof CSSTransition)) != null ? r : [];
1135
+ return o.length === 0 ? (t(), l.dispose) : (Promise.allSettled(o.map((u) => u.finished)).then(() => {
1136
+ a || t();
1137
+ }), l.dispose);
772
1138
  }
773
- function vn(t, { inFlight: e, prepare: n }) {
774
- if (e != null && e.current) {
1139
+ function $r(e, { inFlight: t, prepare: n }) {
1140
+ if (t != null && t.current) {
775
1141
  n();
776
1142
  return;
777
1143
  }
778
- let r = t.style.transition;
779
- t.style.transition = "none", n(), t.offsetHeight, t.style.transition = r;
780
- }
781
- /*!
782
- * tabbable 6.2.0
783
- * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
784
- */
785
- var St = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"], Oe = /* @__PURE__ */ St.join(","), Ot = typeof Element > "u", ie = Ot ? function() {
786
- } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, Fe = !Ot && Element.prototype.getRootNode ? function(t) {
787
- var e;
788
- return t == null || (e = t.getRootNode) === null || e === void 0 ? void 0 : e.call(t);
789
- } : function(t) {
790
- return t == null ? void 0 : t.ownerDocument;
791
- }, ke = function t(e, n) {
792
- var r;
793
- n === void 0 && (n = !0);
794
- var i = e == null || (r = e.getAttribute) === null || r === void 0 ? void 0 : r.call(e, "inert"), l = i === "" || i === "true", a = l || n && e && t(e.parentNode);
795
- return a;
796
- }, bn = function(e) {
797
- var n, r = e == null || (n = e.getAttribute) === null || n === void 0 ? void 0 : n.call(e, "contenteditable");
798
- return r === "" || r === "true";
799
- }, Ft = function(e, n, r) {
800
- if (ke(e))
801
- return [];
802
- var i = Array.prototype.slice.apply(e.querySelectorAll(Oe));
803
- return n && ie.call(e, Oe) && i.unshift(e), i = i.filter(r), i;
804
- }, kt = function t(e, n, r) {
805
- for (var i = [], l = Array.from(e); l.length; ) {
806
- var a = l.shift();
807
- if (!ke(a, !1))
808
- if (a.tagName === "SLOT") {
809
- var m = a.assignedElements(), s = m.length ? m : a.children, v = t(s, !0, r);
810
- r.flatten ? i.push.apply(i, v) : i.push({
811
- scopeParent: a,
812
- candidates: v
813
- });
814
- } else {
815
- var b = ie.call(a, Oe);
816
- b && r.filter(a) && (n || !e.includes(a)) && i.push(a);
817
- var x = a.shadowRoot || // check for an undisclosed shadow
818
- typeof r.getShadowRoot == "function" && r.getShadowRoot(a), T = !ke(x, !1) && (!r.shadowRootFilter || r.shadowRootFilter(a));
819
- if (x && T) {
820
- var E = t(x === !0 ? a.children : x.children, !0, r);
821
- r.flatten ? i.push.apply(i, E) : i.push({
822
- scopeParent: a,
823
- candidates: E
824
- });
825
- } else
826
- l.unshift.apply(l, a.children);
827
- }
1144
+ let r = e.style.transition;
1145
+ e.style.transition = "none", n(), e.offsetHeight, e.style.transition = r;
1146
+ }
1147
+ function vt(e, t) {
1148
+ let n = O([]), r = S(e);
1149
+ M(() => {
1150
+ let l = [...n.current];
1151
+ for (let [a, o] of t.entries()) if (n.current[a] !== o) {
1152
+ let u = r(t, l);
1153
+ return n.current = t, u;
1154
+ }
1155
+ }, [r, ...t]);
1156
+ }
1157
+ let qe = U(null);
1158
+ qe.displayName = "OpenClosedContext";
1159
+ var z = ((e) => (e[e.Open = 1] = "Open", e[e.Closed = 2] = "Closed", e[e.Closing = 4] = "Closing", e[e.Opening = 8] = "Opening", e))(z || {});
1160
+ function Ye() {
1161
+ return R(qe);
1162
+ }
1163
+ function Tr({ value: e, children: t }) {
1164
+ return E.createElement(qe.Provider, { value: e }, t);
1165
+ }
1166
+ function Or({ children: e }) {
1167
+ return E.createElement(qe.Provider, { value: null }, e);
1168
+ }
1169
+ function Pr(e) {
1170
+ function t() {
1171
+ document.readyState !== "loading" && (e(), document.removeEventListener("DOMContentLoaded", t));
1172
+ }
1173
+ typeof window < "u" && typeof document < "u" && (document.addEventListener("DOMContentLoaded", t), t());
1174
+ }
1175
+ let ee = [];
1176
+ Pr(() => {
1177
+ function e(t) {
1178
+ if (!(t.target instanceof HTMLElement) || t.target === document.body || ee[0] === t.target) return;
1179
+ let n = t.target;
1180
+ n = n.closest(Ue), ee.unshift(n ?? t.target), ee = ee.filter((r) => r != null && r.isConnected), ee.splice(10);
828
1181
  }
829
- return i;
830
- }, Ct = function(e) {
831
- return !isNaN(parseInt(e.getAttribute("tabindex"), 10));
832
- }, ne = function(e) {
833
- if (!e)
834
- throw new Error("No node provided");
835
- return e.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || bn(e)) && !Ct(e) ? 0 : e.tabIndex;
836
- }, gn = function(e, n) {
837
- var r = ne(e);
838
- return r < 0 && n && !Ct(e) ? 0 : r;
839
- }, yn = function(e, n) {
840
- return e.tabIndex === n.tabIndex ? e.documentOrder - n.documentOrder : e.tabIndex - n.tabIndex;
841
- }, Pt = function(e) {
842
- return e.tagName === "INPUT";
843
- }, wn = function(e) {
844
- return Pt(e) && e.type === "hidden";
845
- }, xn = function(e) {
846
- var n = e.tagName === "DETAILS" && Array.prototype.slice.apply(e.children).some(function(r) {
847
- return r.tagName === "SUMMARY";
1182
+ 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 });
1183
+ });
1184
+ function Yt(e) {
1185
+ let t = S(e), n = O(!1);
1186
+ M(() => (n.current = !1, () => {
1187
+ n.current = !0, Ve(() => {
1188
+ n.current && t();
1189
+ });
1190
+ }), [t]);
1191
+ }
1192
+ function Mr() {
1193
+ let e = typeof document > "u";
1194
+ return "useSyncExternalStore" in Ee ? ((t) => t.useSyncExternalStore)(Ee)(() => () => {
1195
+ }, () => !1, () => !e) : !1;
1196
+ }
1197
+ function Se() {
1198
+ let e = Mr(), [t, n] = Ee.useState(oe.isHandoffComplete);
1199
+ return t && oe.isHandoffComplete === !1 && n(!1), Ee.useEffect(() => {
1200
+ t !== !0 && n(!0);
1201
+ }, [t]), Ee.useEffect(() => oe.handoff(), []), e ? !1 : t;
1202
+ }
1203
+ let zt = U(!1);
1204
+ function Sr() {
1205
+ return R(zt);
1206
+ }
1207
+ function Pt(e) {
1208
+ return E.createElement(zt.Provider, { value: e.force }, e.children);
1209
+ }
1210
+ function Lr(e) {
1211
+ let t = Sr(), n = R(Kt), r = Me(e), [l, a] = L(() => {
1212
+ var o;
1213
+ if (!t && n !== null) return (o = n.current) != null ? o : null;
1214
+ if (oe.isServer) return null;
1215
+ let u = r == null ? void 0 : r.getElementById("headlessui-portal-root");
1216
+ if (u) return u;
1217
+ if (r === null) return null;
1218
+ let i = r.createElement("div");
1219
+ return i.setAttribute("id", "headlessui-portal-root"), r.body.appendChild(i);
848
1220
  });
849
- return n;
850
- }, En = function(e, n) {
851
- for (var r = 0; r < e.length; r++)
852
- if (e[r].checked && e[r].form === n)
853
- return e[r];
854
- }, Nn = function(e) {
855
- if (!e.name)
856
- return !0;
857
- var n = e.form || Fe(e), r = function(m) {
858
- return n.querySelectorAll('input[type="radio"][name="' + m + '"]');
859
- }, i;
860
- if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
861
- i = r(window.CSS.escape(e.name));
862
- else
863
- try {
864
- i = r(e.name);
865
- } catch (a) {
866
- return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", a.message), !1;
867
- }
868
- var l = En(i, e.form);
869
- return !l || l === e;
870
- }, Tn = function(e) {
871
- return Pt(e) && e.type === "radio";
872
- }, Sn = function(e) {
873
- return Tn(e) && !Nn(e);
874
- }, On = function(e) {
875
- var n, r = e && Fe(e), i = (n = r) === null || n === void 0 ? void 0 : n.host, l = !1;
876
- if (r && r !== e) {
877
- var a, m, s;
878
- for (l = !!((a = i) !== null && a !== void 0 && (m = a.ownerDocument) !== null && m !== void 0 && m.contains(i) || e != null && (s = e.ownerDocument) !== null && s !== void 0 && s.contains(e)); !l && i; ) {
879
- var v, b, x;
880
- r = Fe(i), i = (v = r) === null || v === void 0 ? void 0 : v.host, l = !!((b = i) !== null && b !== void 0 && (x = b.ownerDocument) !== null && x !== void 0 && x.contains(i));
1221
+ return M(() => {
1222
+ l !== null && (r != null && r.body.contains(l) || r == null || r.body.appendChild(l));
1223
+ }, [l, r]), M(() => {
1224
+ t || n !== null && a(n.current);
1225
+ }, [n, a, t]), l;
1226
+ }
1227
+ let Gt = G, Fr = D(function(e, t) {
1228
+ let n = e, r = O(null), l = Z(Wn((y) => {
1229
+ r.current = y;
1230
+ }), t), a = Me(r), o = Lr(r), [u] = L(() => {
1231
+ var y;
1232
+ return oe.isServer ? null : (y = a == null ? void 0 : a.createElement("div")) != null ? y : null;
1233
+ }), i = R(ut), d = Se();
1234
+ A(() => {
1235
+ !o || !u || o.contains(u) || (u.setAttribute("data-headlessui-portal", ""), o.appendChild(u));
1236
+ }, [o, u]), A(() => {
1237
+ if (u && i) return i.register(u);
1238
+ }, [i, u]), Yt(() => {
1239
+ var y;
1240
+ !o || !u || (u instanceof Node && o.contains(u) && o.removeChild(u), o.childNodes.length <= 0 && ((y = o.parentElement) == null || y.removeChild(o)));
1241
+ });
1242
+ let f = W();
1243
+ return d ? !o || !u ? null : En(f({ ourProps: { ref: l }, theirProps: n, slot: {}, defaultTag: Gt, name: "Portal" }), u) : null;
1244
+ });
1245
+ function Cr(e, t) {
1246
+ let n = Z(t), { enabled: r = !0, ...l } = e, a = W();
1247
+ return r ? E.createElement(Fr, { ...l, ref: n }) : a({ ourProps: { ref: n }, theirProps: l, slot: {}, defaultTag: Gt, name: "Portal" });
1248
+ }
1249
+ let kr = G, Kt = U(null);
1250
+ function Nr(e, t) {
1251
+ let { target: n, ...r } = e, l = { ref: Z(t) }, a = W();
1252
+ return E.createElement(Kt.Provider, { value: n }, a({ ourProps: l, theirProps: r, defaultTag: kr, name: "Popover.Group" }));
1253
+ }
1254
+ let ut = U(null);
1255
+ function Ar() {
1256
+ let e = R(ut), t = O([]), n = S((a) => (t.current.push(a), e && e.register(a), () => r(a))), r = S((a) => {
1257
+ let o = t.current.indexOf(a);
1258
+ o !== -1 && t.current.splice(o, 1), e && e.unregister(a);
1259
+ }), l = C(() => ({ register: n, unregister: r, portals: t }), [n, r, t]);
1260
+ return [t, C(() => function({ children: a }) {
1261
+ return E.createElement(ut.Provider, { value: l }, a);
1262
+ }, [l])];
1263
+ }
1264
+ let Ir = D(Cr), Zt = D(Nr), Rr = Object.assign(Ir, { Group: Zt });
1265
+ function Dr(e, t = typeof document < "u" ? document.defaultView : null, n) {
1266
+ let r = fe(e, "escape");
1267
+ qt(t, "keydown", (l) => {
1268
+ r && (l.defaultPrevented || l.key === Ut.Escape && n(l));
1269
+ });
1270
+ }
1271
+ function jr() {
1272
+ var e;
1273
+ let [t] = L(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(pointer: coarse)") : null), [n, r] = L((e = t == null ? void 0 : t.matches) != null ? e : !1);
1274
+ return A(() => {
1275
+ if (!t) return;
1276
+ function l(a) {
1277
+ r(a.matches);
881
1278
  }
882
- }
883
- return l;
884
- }, lt = function(e) {
885
- var n = e.getBoundingClientRect(), r = n.width, i = n.height;
886
- return r === 0 && i === 0;
887
- }, Fn = function(e, n) {
888
- var r = n.displayCheck, i = n.getShadowRoot;
889
- if (getComputedStyle(e).visibility === "hidden")
890
- return !0;
891
- var l = ie.call(e, "details>summary:first-of-type"), a = l ? e.parentElement : e;
892
- if (ie.call(a, "details:not([open]) *"))
893
- return !0;
894
- if (!r || r === "full" || r === "legacy-full") {
895
- if (typeof i == "function") {
896
- for (var m = e; e; ) {
897
- var s = e.parentElement, v = Fe(e);
898
- if (s && !s.shadowRoot && i(s) === !0)
899
- return lt(e);
900
- e.assignedSlot ? e = e.assignedSlot : !s && v !== e.ownerDocument ? e = v.host : e = s;
1279
+ return t.addEventListener("change", l), () => t.removeEventListener("change", l);
1280
+ }, [t]), n;
1281
+ }
1282
+ function Hr({ defaultContainers: e = [], portals: t, mainTreeNode: n } = {}) {
1283
+ let r = Me(n), l = S(() => {
1284
+ var a, o;
1285
+ let u = [];
1286
+ for (let i of e) i !== null && (i instanceof HTMLElement ? u.push(i) : "current" in i && i.current instanceof HTMLElement && u.push(i.current));
1287
+ if (t != null && t.current) for (let i of t.current) u.push(i);
1288
+ for (let i of (a = r == null ? void 0 : r.querySelectorAll("html > *, body > *")) != null ? a : []) i !== document.body && i !== document.head && i instanceof HTMLElement && i.id !== "headlessui-portal-root" && (n && (i.contains(n) || i.contains((o = n == null ? void 0 : n.getRootNode()) == null ? void 0 : o.host)) || u.some((d) => i.contains(d)) || u.push(i));
1289
+ return u;
1290
+ });
1291
+ return { resolveContainers: l, contains: S((a) => l().some((o) => o.contains(a))) };
1292
+ }
1293
+ let Jt = U(null);
1294
+ function Mt({ children: e, node: t }) {
1295
+ let [n, r] = L(null), l = Qt(t ?? n);
1296
+ return E.createElement(Jt.Provider, { value: l }, e, l === null && E.createElement(it, { features: He.Hidden, ref: (a) => {
1297
+ var o, u;
1298
+ if (a) {
1299
+ for (let i of (u = (o = Xe(a)) == null ? void 0 : o.querySelectorAll("html > *, body > *")) != null ? u : []) if (i !== document.body && i !== document.head && i instanceof HTMLElement && i != null && i.contains(a)) {
1300
+ r(i);
1301
+ break;
901
1302
  }
902
- e = m;
903
1303
  }
904
- if (On(e))
905
- return !e.getClientRects().length;
906
- if (r !== "legacy-full")
907
- return !0;
908
- } else if (r === "non-zero-area")
909
- return lt(e);
910
- return !1;
911
- }, kn = function(e) {
912
- if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))
913
- for (var n = e.parentElement; n; ) {
914
- if (n.tagName === "FIELDSET" && n.disabled) {
915
- for (var r = 0; r < n.children.length; r++) {
916
- var i = n.children.item(r);
917
- if (i.tagName === "LEGEND")
918
- return ie.call(n, "fieldset[disabled] *") ? !0 : !i.contains(e);
1304
+ } }));
1305
+ }
1306
+ function Qt(e = null) {
1307
+ var t;
1308
+ return (t = R(Jt)) != null ? t : e;
1309
+ }
1310
+ function gt() {
1311
+ let e = O(!1);
1312
+ return A(() => (e.current = !0, () => {
1313
+ e.current = !1;
1314
+ }), []), e;
1315
+ }
1316
+ var be = ((e) => (e[e.Forwards = 0] = "Forwards", e[e.Backwards = 1] = "Backwards", e))(be || {});
1317
+ function Ur() {
1318
+ let e = O(0);
1319
+ return Vt(!0, "keydown", (t) => {
1320
+ t.key === "Tab" && (e.current = t.shiftKey ? 1 : 0);
1321
+ }, !0), e;
1322
+ }
1323
+ function en(e) {
1324
+ if (!e) return /* @__PURE__ */ new Set();
1325
+ if (typeof e == "function") return new Set(e());
1326
+ let t = /* @__PURE__ */ new Set();
1327
+ for (let n of e.current) n.current instanceof HTMLElement && t.add(n.current);
1328
+ return t;
1329
+ }
1330
+ let Wr = "div";
1331
+ 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 || {});
1332
+ function _r(e, t) {
1333
+ let n = O(null), r = Z(n, t), { initialFocus: l, initialFocusFallback: a, containers: o, features: u = 15, ...i } = e;
1334
+ Se() || (u = 0);
1335
+ let d = Me(n);
1336
+ qr(u, { ownerDocument: d });
1337
+ let f = Yr(u, { ownerDocument: d, container: n, initialFocus: l, initialFocusFallback: a });
1338
+ zr(u, { ownerDocument: d, container: n, containers: o, previousActiveElement: f });
1339
+ let y = Ur(), b = S((p) => {
1340
+ let g = n.current;
1341
+ g && ((x) => x())(() => {
1342
+ ne(y.current, { [be.Forwards]: () => {
1343
+ Oe(g, J.First, { skipElements: [p.relatedTarget, a] });
1344
+ }, [be.Backwards]: () => {
1345
+ Oe(g, J.Last, { skipElements: [p.relatedTarget, a] });
1346
+ } });
1347
+ });
1348
+ }), w = fe(!!(u & 2), "focus-trap#tab-lock"), c = pt(), v = O(!1), s = { ref: r, onKeyDown(p) {
1349
+ p.key == "Tab" && (v.current = !0, c.requestAnimationFrame(() => {
1350
+ v.current = !1;
1351
+ }));
1352
+ }, onBlur(p) {
1353
+ if (!(u & 4)) return;
1354
+ let g = en(o);
1355
+ n.current instanceof HTMLElement && g.add(n.current);
1356
+ let x = p.relatedTarget;
1357
+ 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)));
1358
+ } }, m = W();
1359
+ 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: s, theirProps: i, defaultTag: Wr, name: "FocusTrap" }), w && E.createElement(it, { as: "button", type: "button", "data-headlessui-focus-guard": !0, onFocus: b, features: He.Focusable }));
1360
+ }
1361
+ let Br = D(_r), Xr = Object.assign(Br, { features: ie });
1362
+ function Vr(e = !0) {
1363
+ let t = O(ee.slice());
1364
+ return vt(([n], [r]) => {
1365
+ r === !0 && n === !1 && Ve(() => {
1366
+ t.current.splice(0);
1367
+ }), r === !1 && n === !0 && (t.current = ee.slice());
1368
+ }, [e, ee, t]), S(() => {
1369
+ var n;
1370
+ return (n = t.current.find((r) => r != null && r.isConnected)) != null ? n : null;
1371
+ });
1372
+ }
1373
+ function qr(e, { ownerDocument: t }) {
1374
+ let n = !!(e & 8), r = Vr(n);
1375
+ vt(() => {
1376
+ n || (t == null ? void 0 : t.activeElement) === (t == null ? void 0 : t.body) && Q(r());
1377
+ }, [n]), Yt(() => {
1378
+ n && Q(r());
1379
+ });
1380
+ }
1381
+ function Yr(e, { ownerDocument: t, container: n, initialFocus: r, initialFocusFallback: l }) {
1382
+ let a = O(null), o = fe(!!(e & 1), "focus-trap#initial-focus"), u = gt();
1383
+ return vt(() => {
1384
+ if (e === 0) return;
1385
+ if (!o) {
1386
+ l != null && l.current && Q(l.current);
1387
+ return;
1388
+ }
1389
+ let i = n.current;
1390
+ i && Ve(() => {
1391
+ if (!u.current) return;
1392
+ let d = t == null ? void 0 : t.activeElement;
1393
+ if (r != null && r.current) {
1394
+ if ((r == null ? void 0 : r.current) === d) {
1395
+ a.current = d;
1396
+ return;
919
1397
  }
920
- return !0;
1398
+ } else if (i.contains(d)) {
1399
+ a.current = d;
1400
+ return;
921
1401
  }
922
- n = n.parentElement;
923
- }
924
- return !1;
925
- }, Ce = function(e, n) {
926
- return !(n.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
927
- // because we're limited in the type of selectors we can use in JSDom (see related
928
- // note related to `candidateSelectors`)
929
- ke(n) || wn(n) || Fn(n, e) || // For a details element with a summary, the summary element gets the focus
930
- xn(n) || kn(n));
931
- }, Ve = function(e, n) {
932
- return !(Sn(n) || ne(n) < 0 || !Ce(e, n));
933
- }, Cn = function(e) {
934
- var n = parseInt(e.getAttribute("tabindex"), 10);
935
- return !!(isNaN(n) || n >= 0);
936
- }, Pn = function t(e) {
937
- var n = [], r = [];
938
- return e.forEach(function(i, l) {
939
- var a = !!i.scopeParent, m = a ? i.scopeParent : i, s = gn(m, a), v = a ? t(i.candidates) : m;
940
- s === 0 ? a ? n.push.apply(n, v) : n.push(m) : r.push({
941
- documentOrder: l,
942
- tabIndex: s,
943
- item: i,
944
- isScope: a,
945
- content: v
1402
+ if (r != null && r.current) Q(r.current);
1403
+ else {
1404
+ if (e & 16) {
1405
+ if (Oe(i, J.First | J.AutoFocus) !== ot.Error) return;
1406
+ } else if (Oe(i, J.First) !== ot.Error) return;
1407
+ if (l != null && l.current && (Q(l.current), (t == null ? void 0 : t.activeElement) === l.current)) return;
1408
+ console.warn("There are no focusable elements inside the <FocusTrap />");
1409
+ }
1410
+ a.current = t == null ? void 0 : t.activeElement;
946
1411
  });
947
- }), r.sort(yn).reduce(function(i, l) {
948
- return l.isScope ? i.push.apply(i, l.content) : i.push(l.content), i;
949
- }, []).concat(n);
950
- }, In = function(e, n) {
951
- n = n || {};
952
- var r;
953
- return n.getShadowRoot ? r = kt([e], n.includeContainer, {
954
- filter: Ve.bind(null, n),
955
- flatten: !1,
956
- getShadowRoot: n.getShadowRoot,
957
- shadowRootFilter: Cn
958
- }) : r = Ft(e, n.includeContainer, Ve.bind(null, n)), Pn(r);
959
- }, Rn = function(e, n) {
960
- n = n || {};
961
- var r;
962
- return n.getShadowRoot ? r = kt([e], n.includeContainer, {
963
- filter: Ce.bind(null, n),
964
- flatten: !0,
965
- getShadowRoot: n.getShadowRoot
966
- }) : r = Ft(e, n.includeContainer, Ce.bind(null, n)), r;
967
- }, ue = function(e, n) {
968
- if (n = n || {}, !e)
969
- throw new Error("No node provided");
970
- return ie.call(e, Oe) === !1 ? !1 : Ve(n, e);
971
- }, An = /* @__PURE__ */ St.concat("iframe").join(","), Ke = function(e, n) {
972
- if (n = n || {}, !e)
973
- throw new Error("No node provided");
974
- return ie.call(e, An) === !1 ? !1 : Ce(n, e);
975
- };
976
- let tt = Pe(null);
977
- tt.displayName = "OpenClosedContext";
978
- var re = ((t) => (t[t.Open = 1] = "Open", t[t.Closed = 2] = "Closed", t[t.Closing = 4] = "Closing", t[t.Opening = 8] = "Opening", t))(re || {});
979
- function It() {
980
- return de(tt);
981
- }
982
- function Mn({ value: t, children: e }) {
983
- return B.createElement(tt.Provider, { value: t }, e);
984
- }
985
- function Ln() {
986
- let t = typeof document > "u";
987
- return "useSyncExternalStore" in ve ? ((e) => e.useSyncExternalStore)(ve)(() => () => {
988
- }, () => !1, () => !t) : !1;
989
- }
990
- function Rt() {
991
- let t = Ln(), [e, n] = ve.useState(Ee.isHandoffComplete);
992
- return e && Ee.isHandoffComplete === !1 && n(!1), ve.useEffect(() => {
993
- e !== !0 && n(!0);
994
- }, [e]), ve.useEffect(() => Ee.handoff(), []), t ? !1 : e;
995
- }
996
- function jn() {
997
- let t = j(!1);
998
- return Q(() => (t.current = !0, () => {
999
- t.current = !1;
1000
- }), []), t;
1001
- }
1002
- function At(t) {
1003
- var e;
1004
- return !!(t.enter || t.enterFrom || t.enterTo || t.leave || t.leaveFrom || t.leaveTo) || ((e = t.as) != null ? e : Lt) !== ae || B.Children.count(t.children) === 1;
1005
- }
1006
- let je = Pe(null);
1007
- je.displayName = "TransitionContext";
1008
- var Dn = ((t) => (t.Visible = "visible", t.Hidden = "hidden", t))(Dn || {});
1009
- function $n() {
1010
- let t = de(je);
1011
- if (t === null) throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
1012
- return t;
1412
+ }, [l, o, e]), a;
1013
1413
  }
1014
- function Un() {
1015
- let t = de(De);
1016
- if (t === null) throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
1017
- return t;
1414
+ function zr(e, { ownerDocument: t, container: n, containers: r, previousActiveElement: l }) {
1415
+ let a = gt(), o = !!(e & 4);
1416
+ qt(t == null ? void 0 : t.defaultView, "focus", (u) => {
1417
+ if (!o || !a.current) return;
1418
+ let i = en(r);
1419
+ n.current instanceof HTMLElement && i.add(n.current);
1420
+ let d = l.current;
1421
+ if (!d) return;
1422
+ let f = u.target;
1423
+ f && f instanceof HTMLElement ? tn(i, f) ? (l.current = f, Q(f)) : (u.preventDefault(), u.stopPropagation(), Q(d)) : Q(l.current);
1424
+ }, !0);
1425
+ }
1426
+ function tn(e, t) {
1427
+ for (let n of e) if (n.contains(t)) return !0;
1428
+ return !1;
1429
+ }
1430
+ function nn(e) {
1431
+ var t;
1432
+ 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;
1433
+ }
1434
+ let ze = U(null);
1435
+ ze.displayName = "TransitionContext";
1436
+ var Gr = ((e) => (e.Visible = "visible", e.Hidden = "hidden", e))(Gr || {});
1437
+ function Kr() {
1438
+ let e = R(ze);
1439
+ if (e === null) throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
1440
+ return e;
1018
1441
  }
1019
- let De = Pe(null);
1020
- De.displayName = "NestingContext";
1021
- function $e(t) {
1022
- return "children" in t ? $e(t.children) : t.current.filter(({ el: e }) => e.current !== null).filter(({ state: e }) => e === "visible").length > 0;
1023
- }
1024
- function Mt(t, e) {
1025
- let n = wt(t), r = j([]), i = jn(), l = yt(), a = G((E, c = J.Hidden) => {
1026
- let g = r.current.findIndex(({ el: d }) => d === E);
1027
- g !== -1 && (Le(c, { [J.Unmount]() {
1028
- r.current.splice(g, 1);
1029
- }, [J.Hidden]() {
1030
- r.current[g].state = "hidden";
1031
- } }), l.microTask(() => {
1032
- var d;
1033
- !$e(r) && i.current && ((d = n.current) == null || d.call(n));
1442
+ function Zr() {
1443
+ let e = R(Ge);
1444
+ if (e === null) throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
1445
+ return e;
1446
+ }
1447
+ let Ge = U(null);
1448
+ Ge.displayName = "NestingContext";
1449
+ function Ke(e) {
1450
+ return "children" in e ? Ke(e.children) : e.current.filter(({ el: t }) => t.current !== null).filter(({ state: t }) => t === "visible").length > 0;
1451
+ }
1452
+ function rn(e, t) {
1453
+ let n = se(e), r = O([]), l = gt(), a = pt(), o = S((w, c = te.Hidden) => {
1454
+ let v = r.current.findIndex(({ el: s }) => s === w);
1455
+ v !== -1 && (ne(c, { [te.Unmount]() {
1456
+ r.current.splice(v, 1);
1457
+ }, [te.Hidden]() {
1458
+ r.current[v].state = "hidden";
1459
+ } }), a.microTask(() => {
1460
+ var s;
1461
+ !Ke(r) && l.current && ((s = n.current) == null || s.call(n));
1034
1462
  }));
1035
- }), m = G((E) => {
1036
- let c = r.current.find(({ el: g }) => g === E);
1037
- return c ? c.state !== "visible" && (c.state = "visible") : r.current.push({ el: E, state: "visible" }), () => a(E, J.Unmount);
1038
- }), s = j([]), v = j(Promise.resolve()), b = j({ enter: [], leave: [] }), x = G((E, c, g) => {
1039
- s.current.splice(0), e && (e.chains.current[c] = e.chains.current[c].filter(([d]) => d !== E)), e == null || e.chains.current[c].push([E, new Promise((d) => {
1040
- s.current.push(d);
1041
- })]), e == null || e.chains.current[c].push([E, new Promise((d) => {
1042
- Promise.all(b.current[c].map(([f, p]) => p)).then(() => d());
1043
- })]), c === "enter" ? v.current = v.current.then(() => e == null ? void 0 : e.wait.current).then(() => g(c)) : g(c);
1044
- }), T = G((E, c, g) => {
1045
- Promise.all(b.current[c].splice(0).map(([d, f]) => f)).then(() => {
1046
- var d;
1047
- (d = s.current.shift()) == null || d();
1048
- }).then(() => g(c));
1463
+ }), u = S((w) => {
1464
+ let c = r.current.find(({ el: v }) => v === w);
1465
+ return c ? c.state !== "visible" && (c.state = "visible") : r.current.push({ el: w, state: "visible" }), () => o(w, te.Unmount);
1466
+ }), i = O([]), d = O(Promise.resolve()), f = O({ enter: [], leave: [] }), y = S((w, c, v) => {
1467
+ i.current.splice(0), t && (t.chains.current[c] = t.chains.current[c].filter(([s]) => s !== w)), t == null || t.chains.current[c].push([w, new Promise((s) => {
1468
+ i.current.push(s);
1469
+ })]), t == null || t.chains.current[c].push([w, new Promise((s) => {
1470
+ Promise.all(f.current[c].map(([m, p]) => p)).then(() => s());
1471
+ })]), c === "enter" ? d.current = d.current.then(() => t == null ? void 0 : t.wait.current).then(() => v(c)) : v(c);
1472
+ }), b = S((w, c, v) => {
1473
+ Promise.all(f.current[c].splice(0).map(([s, m]) => m)).then(() => {
1474
+ var s;
1475
+ (s = i.current.shift()) == null || s();
1476
+ }).then(() => v(c));
1049
1477
  });
1050
- return Y(() => ({ children: r, register: m, unregister: a, onStart: x, onStop: T, wait: v, chains: b }), [m, a, r, x, T, b, v]);
1478
+ return C(() => ({ children: r, register: u, unregister: o, onStart: y, onStop: b, wait: d, chains: f }), [u, o, r, y, b, f, d]);
1051
1479
  }
1052
- let Lt = ae, jt = xt.RenderStrategy;
1053
- function Wn(t, e) {
1480
+ let ln = G, an = je.RenderStrategy;
1481
+ function Jr(e, t) {
1054
1482
  var n, r;
1055
- let { transition: i = !0, beforeEnter: l, afterEnter: a, beforeLeave: m, afterLeave: s, enter: v, enterFrom: b, enterTo: x, entered: T, leave: E, leaveFrom: c, leaveTo: g, ...d } = t, [f, p] = $(null), y = j(null), N = At(t), h = Tt(...N ? [y, e, p] : e === null ? [] : [e]), k = (n = d.unmount) == null || n ? J.Unmount : J.Hidden, { show: A, appear: H, initial: K } = $n(), [U, W] = $(A ? "visible" : "hidden"), O = Un(), { register: o, unregister: u } = O;
1056
- Q(() => o(y), [o, y]), Q(() => {
1057
- if (k === J.Hidden && y.current) {
1058
- if (A && U !== "visible") {
1059
- W("visible");
1483
+ let { transition: l = !0, beforeEnter: a, afterEnter: o, beforeLeave: u, afterLeave: i, enter: d, enterFrom: f, enterTo: y, entered: b, leave: w, leaveFrom: c, leaveTo: v, ...s } = e, [m, p] = L(null), g = O(null), x = nn(e), h = Z(...x ? [g, t, p] : t === null ? [] : [t]), $ = (n = s.unmount) == null || n ? te.Unmount : te.Hidden, { show: F, appear: j, initial: _ } = Kr(), [N, H] = L(F ? "visible" : "hidden"), B = Zr(), { register: X, unregister: P } = B;
1484
+ A(() => X(g), [X, g]), A(() => {
1485
+ if ($ === te.Hidden && g.current) {
1486
+ if (F && N !== "visible") {
1487
+ H("visible");
1060
1488
  return;
1061
1489
  }
1062
- return Le(U, { hidden: () => u(y), visible: () => o(y) });
1490
+ return ne(N, { hidden: () => P(g), visible: () => X(g) });
1063
1491
  }
1064
- }, [U, y, o, u, A, k]);
1065
- let w = Rt();
1066
- Q(() => {
1067
- if (N && w && U === "visible" && y.current === null) throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
1068
- }, [y, U, w, N]);
1069
- let C = K && !H, P = H && A && K, I = j(!1), S = Mt(() => {
1070
- I.current || (W("hidden"), u(y));
1071
- }, O), R = G((ee) => {
1072
- I.current = !0;
1073
- let Z = ee ? "enter" : "leave";
1074
- S.onStart(y, Z, (ce) => {
1075
- ce === "enter" ? l == null || l() : ce === "leave" && (m == null || m());
1492
+ }, [N, g, X, P, F, $]);
1493
+ let V = Se();
1494
+ A(() => {
1495
+ if (x && V && N === "visible" && g.current === null) throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
1496
+ }, [g, N, V, x]);
1497
+ let Le = _ && !j, Fe = j && F && _, pe = O(!1), K = rn(() => {
1498
+ pe.current || (H("hidden"), P(g));
1499
+ }, B), Ce = S((Je) => {
1500
+ pe.current = !0;
1501
+ let Ne = Je ? "enter" : "leave";
1502
+ K.onStart(g, Ne, (ve) => {
1503
+ ve === "enter" ? a == null || a() : ve === "leave" && (u == null || u());
1076
1504
  });
1077
- }), M = G((ee) => {
1078
- let Z = ee ? "enter" : "leave";
1079
- I.current = !1, S.onStop(y, Z, (ce) => {
1080
- ce === "enter" ? a == null || a() : ce === "leave" && (s == null || s());
1081
- }), Z === "leave" && !$e(S) && (W("hidden"), u(y));
1505
+ }), k = S((Je) => {
1506
+ let Ne = Je ? "enter" : "leave";
1507
+ pe.current = !1, K.onStop(g, Ne, (ve) => {
1508
+ ve === "enter" ? o == null || o() : ve === "leave" && (i == null || i());
1509
+ }), Ne === "leave" && !Ke(K) && (H("hidden"), P(g));
1082
1510
  });
1083
- D(() => {
1084
- N && i || (R(A), M(A));
1085
- }, [A, N, i]);
1086
- let z = !(!i || !N || !w || C), [, L] = mn(z, f, A, { start: R, end: M }), _ = te({ ref: h, className: ((r = _e(d.className, P && v, P && b, L.enter && v, L.enter && L.closed && b, L.enter && !L.closed && x, L.leave && E, L.leave && !L.closed && c, L.leave && L.closed && g, !L.transition && A && T)) == null ? void 0 : r.trim()) || void 0, ...fn(L) }), q = 0;
1087
- U === "visible" && (q |= re.Open), U === "hidden" && (q |= re.Closed), L.enter && (q |= re.Opening), L.leave && (q |= re.Closing);
1088
- let ye = Et();
1089
- return B.createElement(De.Provider, { value: S }, B.createElement(Mn, { value: q }, ye({ ourProps: _, theirProps: d, defaultTag: Lt, features: jt, visible: U === "visible", name: "Transition.Child" })));
1090
- }
1091
- function Bn(t, e) {
1092
- let { show: n, appear: r = !1, unmount: i = !0, ...l } = t, a = j(null), m = At(t), s = Tt(...m ? [a, e] : e === null ? [] : [e]);
1093
- Rt();
1094
- let v = It();
1095
- if (n === void 0 && v !== null && (n = (v & re.Open) === re.Open), n === void 0) throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");
1096
- let [b, x] = $(n ? "visible" : "hidden"), T = Mt(() => {
1097
- n || x("hidden");
1098
- }), [E, c] = $(!0), g = j([n]);
1099
- Q(() => {
1100
- E !== !1 && g.current[g.current.length - 1] !== n && (g.current.push(n), c(!1));
1101
- }, [g, n]);
1102
- let d = Y(() => ({ show: n, appear: r, initial: E }), [n, r, E]);
1103
- Q(() => {
1104
- n ? x("visible") : !$e(T) && a.current !== null && x("hidden");
1105
- }, [n, T]);
1106
- let f = { unmount: i }, p = G(() => {
1511
+ M(() => {
1512
+ x && l || (Ce(F), k(F));
1513
+ }, [F, x, l]);
1514
+ let ke = !(!l || !x || !V || Le), [, I] = xr(ke, m, F, { start: Ce, end: k }), dn = le({ ref: h, className: ((r = lt(s.className, Fe && d, Fe && f, I.enter && d, I.enter && I.closed && f, I.enter && !I.closed && y, I.leave && w, I.leave && !I.closed && c, I.leave && I.closed && v, !I.transition && F && b)) == null ? void 0 : r.trim()) || void 0, ...yr(I) }), he = 0;
1515
+ N === "visible" && (he |= z.Open), N === "hidden" && (he |= z.Closed), I.enter && (he |= z.Opening), I.leave && (he |= z.Closing);
1516
+ let cn = W();
1517
+ return E.createElement(Ge.Provider, { value: K }, E.createElement(Tr, { value: he }, cn({ ourProps: dn, theirProps: s, defaultTag: ln, features: an, visible: N === "visible", name: "Transition.Child" })));
1518
+ }
1519
+ function Qr(e, t) {
1520
+ let { show: n, appear: r = !1, unmount: l = !0, ...a } = e, o = O(null), u = nn(e), i = Z(...u ? [o, t] : t === null ? [] : [t]);
1521
+ Se();
1522
+ let d = Ye();
1523
+ if (n === void 0 && d !== null && (n = (d & z.Open) === z.Open), n === void 0) throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");
1524
+ let [f, y] = L(n ? "visible" : "hidden"), b = rn(() => {
1525
+ n || y("hidden");
1526
+ }), [w, c] = L(!0), v = O([n]);
1527
+ A(() => {
1528
+ w !== !1 && v.current[v.current.length - 1] !== n && (v.current.push(n), c(!1));
1529
+ }, [v, n]);
1530
+ let s = C(() => ({ show: n, appear: r, initial: w }), [n, r, w]);
1531
+ A(() => {
1532
+ n ? y("visible") : !Ke(b) && o.current !== null && y("hidden");
1533
+ }, [n, b]);
1534
+ let m = { unmount: l }, p = S(() => {
1107
1535
  var h;
1108
- E && c(!1), (h = t.beforeEnter) == null || h.call(t);
1109
- }), y = G(() => {
1536
+ w && c(!1), (h = e.beforeEnter) == null || h.call(e);
1537
+ }), g = S(() => {
1110
1538
  var h;
1111
- E && c(!1), (h = t.beforeLeave) == null || h.call(t);
1112
- }), N = Et();
1113
- return B.createElement(De.Provider, { value: T }, B.createElement(je.Provider, { value: d }, N({ ourProps: { ...f, as: ae, children: B.createElement(Dt, { ref: s, ...f, ...l, beforeEnter: p, beforeLeave: y }) }, theirProps: {}, defaultTag: ae, features: jt, visible: b === "visible", name: "Transition" })));
1539
+ w && c(!1), (h = e.beforeLeave) == null || h.call(e);
1540
+ }), x = W();
1541
+ return E.createElement(Ge.Provider, { value: b }, E.createElement(ze.Provider, { value: s }, x({ ourProps: { ...m, as: G, children: E.createElement(on, { ref: i, ...m, ...a, beforeEnter: p, beforeLeave: g }) }, theirProps: {}, defaultTag: G, features: an, visible: f === "visible", name: "Transition" })));
1114
1542
  }
1115
- function Hn(t, e) {
1116
- let n = de(je) !== null, r = It() !== null;
1117
- return B.createElement(B.Fragment, null, !n && r ? B.createElement(ze, { ref: e, ...t }) : B.createElement(Dt, { ref: e, ...t }));
1543
+ function el(e, t) {
1544
+ let n = R(ze) !== null, r = Ye() !== null;
1545
+ return E.createElement(E.Fragment, null, !n && r ? E.createElement(st, { ref: t, ...e }) : E.createElement(on, { ref: t, ...e }));
1118
1546
  }
1119
- let ze = et(Bn), Dt = et(Wn), Ue = et(Hn), Kn = Object.assign(ze, { Child: Ue, Root: ze });
1120
- function $t({ onClick: t }) {
1121
- return /* @__PURE__ */ le(
1547
+ let st = D(Qr), on = D(Jr), me = D(el), un = Object.assign(st, { Child: me, Root: st });
1548
+ var tl = ((e) => (e[e.Open = 0] = "Open", e[e.Closed = 1] = "Closed", e))(tl || {}), nl = ((e) => (e[e.SetTitleId = 0] = "SetTitleId", e))(nl || {});
1549
+ let rl = { 0(e, t) {
1550
+ return e.titleId === t.id ? e : { ...e, titleId: t.id };
1551
+ } }, wt = U(null);
1552
+ wt.displayName = "DialogContext";
1553
+ function Ze(e) {
1554
+ let t = R(wt);
1555
+ if (t === null) {
1556
+ let n = new Error(`<${e} /> is missing a parent <Dialog /> component.`);
1557
+ throw Error.captureStackTrace && Error.captureStackTrace(n, Ze), n;
1558
+ }
1559
+ return t;
1560
+ }
1561
+ function ll(e, t) {
1562
+ return ne(t.type, rl, e, t);
1563
+ }
1564
+ let St = D(function(e, t) {
1565
+ let n = Pe(), { id: r = `headlessui-dialog-${n}`, open: l, onClose: a, initialFocus: o, role: u = "dialog", autoFocus: i = !0, __demoMode: d = !1, unmount: f = !1, ...y } = e, b = O(!1);
1566
+ u = function() {
1567
+ return u === "dialog" || u === "alertdialog" ? u : (b.current || (b.current = !0, console.warn(`Invalid role [${u}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)), "dialog");
1568
+ }();
1569
+ let w = Ye();
1570
+ l === void 0 && w !== null && (l = (w & z.Open) === z.Open);
1571
+ let c = O(null), v = Z(c, t), s = Me(c), m = l ? 0 : 1, [p, g] = wn(ll, { titleId: null, descriptionId: null, panelRef: yn() }), x = S(() => a(!1)), h = S((k) => g({ type: 0, id: k })), $ = Se() ? m === 0 : !1, [F, j] = Ar(), _ = { get current() {
1572
+ var k;
1573
+ return (k = p.panelRef.current) != null ? k : c.current;
1574
+ } }, N = Qt(), { resolveContainers: H } = Hr({ mainTreeNode: N, portals: F, defaultContainers: [_] }), B = w !== null ? (w & z.Closing) === z.Closing : !1;
1575
+ Zn(d || B ? !1 : $, { allowed: S(() => {
1576
+ var k, ke;
1577
+ return [(ke = (k = c.current) == null ? void 0 : k.closest("[data-headlessui-portal]")) != null ? ke : null];
1578
+ }), disallowed: S(() => {
1579
+ var k;
1580
+ return [(k = N == null ? void 0 : N.closest("body > *:not(#headlessui-portal-root)")) != null ? k : null];
1581
+ }) }), dr($, H, (k) => {
1582
+ k.preventDefault(), x();
1583
+ }), Dr($, s == null ? void 0 : s.defaultView, (k) => {
1584
+ k.preventDefault(), k.stopPropagation(), document.activeElement && "blur" in document.activeElement && typeof document.activeElement.blur == "function" && document.activeElement.blur(), x();
1585
+ }), vr(d || B ? !1 : $, s, H), Jn($, c, x);
1586
+ let [X, P] = _n(), V = C(() => [{ dialogState: m, close: x, setTitleId: h, unmount: f }, p], [m, p, x, h, f]), Le = C(() => ({ open: m === 0 }), [m]), Fe = { ref: v, id: r, role: u, tabIndex: -1, "aria-modal": d ? void 0 : m === 0 ? !0 : void 0, "aria-labelledby": p.titleId, "aria-describedby": X, unmount: f }, pe = !jr(), K = ie.None;
1587
+ $ && !d && (K |= ie.RestoreFocus, K |= ie.TabLock, i && (K |= ie.AutoFocus), pe && (K |= ie.InitialFocus));
1588
+ let Ce = W();
1589
+ return E.createElement(Or, null, E.createElement(Pt, { force: !0 }, E.createElement(Rr, null, E.createElement(wt.Provider, { value: V }, E.createElement(Zt, { target: c }, E.createElement(Pt, { force: !1 }, E.createElement(P, { slot: Le }, E.createElement(j, null, E.createElement(Xr, { initialFocus: o, initialFocusFallback: c, containers: H, features: K }, E.createElement(zn, { value: x }, Ce({ ourProps: Fe, theirProps: y, slot: Le, defaultTag: il, features: al, visible: m === 0, name: "Dialog" })))))))))));
1590
+ }), il = "div", al = je.RenderStrategy | je.Static;
1591
+ function ol(e, t) {
1592
+ let { transition: n = !1, open: r, ...l } = e, a = Ye(), o = e.hasOwnProperty("open") || a !== null, u = e.hasOwnProperty("onClose");
1593
+ if (!o && !u) throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");
1594
+ if (!o) throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");
1595
+ if (!u) throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");
1596
+ if (!a && 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}`);
1597
+ 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}`);
1598
+ return (r !== void 0 || n) && !l.static ? E.createElement(Mt, null, E.createElement(un, { show: r, transition: n, unmount: l.unmount }, E.createElement(St, { ref: t, ...l }))) : E.createElement(Mt, null, E.createElement(St, { ref: t, open: r, ...l }));
1599
+ }
1600
+ let ul = "div";
1601
+ function sl(e, t) {
1602
+ let n = Pe(), { id: r = `headlessui-dialog-panel-${n}`, transition: l = !1, ...a } = e, [{ dialogState: o, unmount: u }, i] = Ze("Dialog.Panel"), d = Z(t, i.panelRef), f = C(() => ({ open: o === 0 }), [o]), y = S((s) => {
1603
+ s.stopPropagation();
1604
+ }), b = { ref: d, id: r, onClick: y }, w = l ? me : G, c = l ? { unmount: u } : {}, v = W();
1605
+ return E.createElement(w, { ...c }, v({ ourProps: b, theirProps: a, slot: f, defaultTag: ul, name: "Dialog.Panel" }));
1606
+ }
1607
+ let dl = "div";
1608
+ function cl(e, t) {
1609
+ let { transition: n = !1, ...r } = e, [{ dialogState: l, unmount: a }] = Ze("Dialog.Backdrop"), o = C(() => ({ open: l === 0 }), [l]), u = { ref: t, "aria-hidden": !0 }, i = n ? me : G, d = n ? { unmount: a } : {}, f = W();
1610
+ return E.createElement(i, { ...d }, f({ ourProps: u, theirProps: r, slot: o, defaultTag: dl, name: "Dialog.Backdrop" }));
1611
+ }
1612
+ let fl = "h2";
1613
+ function ml(e, t) {
1614
+ let n = Pe(), { id: r = `headlessui-dialog-title-${n}`, ...l } = e, [{ dialogState: a, setTitleId: o }] = Ze("Dialog.Title"), u = Z(t);
1615
+ M(() => (o(r), () => o(null)), [r, o]);
1616
+ let i = C(() => ({ open: a === 0 }), [a]), d = { ref: u, id: r };
1617
+ return W()({ ourProps: d, theirProps: l, slot: i, defaultTag: fl, name: "Dialog.Title" });
1618
+ }
1619
+ let pl = D(ol), yt = D(sl);
1620
+ D(cl);
1621
+ let hl = D(ml), vl = Object.assign(pl, { Panel: yt, Title: hl, Description: qn });
1622
+ function sn({ onClick: e }) {
1623
+ return /* @__PURE__ */ ue(
1122
1624
  "button",
1123
1625
  {
1124
1626
  type: "button",
1125
1627
  className: "im-close-button text-gray-400 hover:text-gray-500",
1126
- onClick: t,
1628
+ onClick: e,
1127
1629
  children: [
1128
- /* @__PURE__ */ F("span", { className: "sr-only", children: "Close" }),
1129
- /* @__PURE__ */ F(
1630
+ /* @__PURE__ */ T("span", { className: "sr-only", children: "Close" }),
1631
+ /* @__PURE__ */ T(
1130
1632
  "svg",
1131
1633
  {
1132
1634
  className: "size-6",
@@ -1136,7 +1638,7 @@ function $t({ onClick: t }) {
1136
1638
  strokeWidth: "2",
1137
1639
  stroke: "currentColor",
1138
1640
  "aria-hidden": "true",
1139
- children: /* @__PURE__ */ F(
1641
+ children: /* @__PURE__ */ T(
1140
1642
  "path",
1141
1643
  {
1142
1644
  strokeLinecap: "round",
@@ -1150,519 +1652,46 @@ function $t({ onClick: t }) {
1150
1652
  }
1151
1653
  );
1152
1654
  }
1153
- /*!
1154
- * focus-trap 7.6.2
1155
- * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
1156
- */
1157
- function Ge(t, e) {
1158
- (e == null || e > t.length) && (e = t.length);
1159
- for (var n = 0, r = Array(e); n < e; n++) r[n] = t[n];
1160
- return r;
1161
- }
1162
- function qn(t) {
1163
- if (Array.isArray(t)) return Ge(t);
1164
- }
1165
- function Xn(t, e, n) {
1166
- return (e = Zn(e)) in t ? Object.defineProperty(t, e, {
1167
- value: n,
1168
- enumerable: !0,
1169
- configurable: !0,
1170
- writable: !0
1171
- }) : t[e] = n, t;
1172
- }
1173
- function _n(t) {
1174
- if (typeof Symbol < "u" && t[Symbol.iterator] != null || t["@@iterator"] != null) return Array.from(t);
1175
- }
1176
- function Vn() {
1177
- throw new TypeError(`Invalid attempt to spread non-iterable instance.
1178
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1179
- }
1180
- function st(t, e) {
1181
- var n = Object.keys(t);
1182
- if (Object.getOwnPropertySymbols) {
1183
- var r = Object.getOwnPropertySymbols(t);
1184
- e && (r = r.filter(function(i) {
1185
- return Object.getOwnPropertyDescriptor(t, i).enumerable;
1186
- })), n.push.apply(n, r);
1187
- }
1188
- return n;
1189
- }
1190
- function ot(t) {
1191
- for (var e = 1; e < arguments.length; e++) {
1192
- var n = arguments[e] != null ? arguments[e] : {};
1193
- e % 2 ? st(Object(n), !0).forEach(function(r) {
1194
- Xn(t, r, n[r]);
1195
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : st(Object(n)).forEach(function(r) {
1196
- Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(n, r));
1197
- });
1198
- }
1199
- return t;
1200
- }
1201
- function zn(t) {
1202
- return qn(t) || _n(t) || Yn(t) || Vn();
1203
- }
1204
- function Gn(t, e) {
1205
- if (typeof t != "object" || !t) return t;
1206
- var n = t[Symbol.toPrimitive];
1207
- if (n !== void 0) {
1208
- var r = n.call(t, e || "default");
1209
- if (typeof r != "object") return r;
1210
- throw new TypeError("@@toPrimitive must return a primitive value.");
1211
- }
1212
- return (e === "string" ? String : Number)(t);
1213
- }
1214
- function Zn(t) {
1215
- var e = Gn(t, "string");
1216
- return typeof e == "symbol" ? e : e + "";
1217
- }
1218
- function Yn(t, e) {
1219
- if (t) {
1220
- if (typeof t == "string") return Ge(t, e);
1221
- var n = {}.toString.call(t).slice(8, -1);
1222
- return n === "Object" && t.constructor && (n = t.constructor.name), n === "Map" || n === "Set" ? Array.from(t) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? Ge(t, e) : void 0;
1223
- }
1224
- }
1225
- var ut = {
1226
- activateTrap: function(e, n) {
1227
- if (e.length > 0) {
1228
- var r = e[e.length - 1];
1229
- r !== n && r.pause();
1230
- }
1231
- var i = e.indexOf(n);
1232
- i === -1 || e.splice(i, 1), e.push(n);
1233
- },
1234
- deactivateTrap: function(e, n) {
1235
- var r = e.indexOf(n);
1236
- r !== -1 && e.splice(r, 1), e.length > 0 && e[e.length - 1].unpause();
1237
- }
1238
- }, Jn = function(e) {
1239
- return e.tagName && e.tagName.toLowerCase() === "input" && typeof e.select == "function";
1240
- }, Qn = function(e) {
1241
- return (e == null ? void 0 : e.key) === "Escape" || (e == null ? void 0 : e.key) === "Esc" || (e == null ? void 0 : e.keyCode) === 27;
1242
- }, ge = function(e) {
1243
- return (e == null ? void 0 : e.key) === "Tab" || (e == null ? void 0 : e.keyCode) === 9;
1244
- }, er = function(e) {
1245
- return ge(e) && !e.shiftKey;
1246
- }, tr = function(e) {
1247
- return ge(e) && e.shiftKey;
1248
- }, dt = function(e) {
1249
- return setTimeout(e, 0);
1250
- }, pe = function(e) {
1251
- for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), i = 1; i < n; i++)
1252
- r[i - 1] = arguments[i];
1253
- return typeof e == "function" ? e.apply(void 0, r) : e;
1254
- }, xe = function(e) {
1255
- return e.target.shadowRoot && typeof e.composedPath == "function" ? e.composedPath()[0] : e.target;
1256
- }, nr = [], rr = function(e, n) {
1257
- var r = (n == null ? void 0 : n.document) || document, i = (n == null ? void 0 : n.trapStack) || nr, l = ot({
1258
- returnFocusOnDeactivate: !0,
1259
- escapeDeactivates: !0,
1260
- delayInitialFocus: !0,
1261
- isKeyForward: er,
1262
- isKeyBackward: tr
1263
- }, n), a = {
1264
- // containers given to createFocusTrap()
1265
- // @type {Array<HTMLElement>}
1266
- containers: [],
1267
- // list of objects identifying tabbable nodes in `containers` in the trap
1268
- // NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap
1269
- // is active, but the trap should never get to a state where there isn't at least one group
1270
- // with at least one tabbable node in it (that would lead to an error condition that would
1271
- // result in an error being thrown)
1272
- // @type {Array<{
1273
- // container: HTMLElement,
1274
- // tabbableNodes: Array<HTMLElement>, // empty if none
1275
- // focusableNodes: Array<HTMLElement>, // empty if none
1276
- // posTabIndexesFound: boolean,
1277
- // firstTabbableNode: HTMLElement|undefined,
1278
- // lastTabbableNode: HTMLElement|undefined,
1279
- // firstDomTabbableNode: HTMLElement|undefined,
1280
- // lastDomTabbableNode: HTMLElement|undefined,
1281
- // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
1282
- // }>}
1283
- containerGroups: [],
1284
- // same order/length as `containers` list
1285
- // references to objects in `containerGroups`, but only those that actually have
1286
- // tabbable nodes in them
1287
- // NOTE: same order as `containers` and `containerGroups`, but __not necessarily__
1288
- // the same length
1289
- tabbableGroups: [],
1290
- nodeFocusedBeforeActivation: null,
1291
- mostRecentlyFocusedNode: null,
1292
- active: !1,
1293
- paused: !1,
1294
- // timer ID for when delayInitialFocus is true and initial focus in this trap
1295
- // has been delayed during activation
1296
- delayInitialFocusTimer: void 0,
1297
- // the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
1298
- recentNavEvent: void 0
1299
- }, m, s = function(o, u, w) {
1300
- return o && o[u] !== void 0 ? o[u] : l[w || u];
1301
- }, v = function(o, u) {
1302
- var w = typeof (u == null ? void 0 : u.composedPath) == "function" ? u.composedPath() : void 0;
1303
- return a.containerGroups.findIndex(function(C) {
1304
- var P = C.container, I = C.tabbableNodes;
1305
- return P.contains(o) || // fall back to explicit tabbable search which will take into consideration any
1306
- // web components if the `tabbableOptions.getShadowRoot` option was used for
1307
- // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
1308
- // look inside web components even if open)
1309
- (w == null ? void 0 : w.includes(P)) || I.find(function(S) {
1310
- return S === o;
1311
- });
1312
- });
1313
- }, b = function(o) {
1314
- var u = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, w = u.hasFallback, C = w === void 0 ? !1 : w, P = u.params, I = P === void 0 ? [] : P, S = l[o];
1315
- if (typeof S == "function" && (S = S.apply(void 0, zn(I))), S === !0 && (S = void 0), !S) {
1316
- if (S === void 0 || S === !1)
1317
- return S;
1318
- throw new Error("`".concat(o, "` was specified but was not a node, or did not return a node"));
1319
- }
1320
- var R = S;
1321
- if (typeof S == "string") {
1322
- try {
1323
- R = r.querySelector(S);
1324
- } catch (M) {
1325
- throw new Error("`".concat(o, '` appears to be an invalid selector; error="').concat(M.message, '"'));
1326
- }
1327
- if (!R && !C)
1328
- throw new Error("`".concat(o, "` as selector refers to no known node"));
1329
- }
1330
- return R;
1331
- }, x = function() {
1332
- var o = b("initialFocus", {
1333
- hasFallback: !0
1334
- });
1335
- if (o === !1)
1336
- return !1;
1337
- if (o === void 0 || o && !Ke(o, l.tabbableOptions))
1338
- if (v(r.activeElement) >= 0)
1339
- o = r.activeElement;
1340
- else {
1341
- var u = a.tabbableGroups[0], w = u && u.firstTabbableNode;
1342
- o = w || b("fallbackFocus");
1343
- }
1344
- else o === null && (o = b("fallbackFocus"));
1345
- if (!o)
1346
- throw new Error("Your focus-trap needs to have at least one focusable element");
1347
- return o;
1348
- }, T = function() {
1349
- if (a.containerGroups = a.containers.map(function(o) {
1350
- var u = In(o, l.tabbableOptions), w = Rn(o, l.tabbableOptions), C = u.length > 0 ? u[0] : void 0, P = u.length > 0 ? u[u.length - 1] : void 0, I = w.find(function(M) {
1351
- return ue(M);
1352
- }), S = w.slice().reverse().find(function(M) {
1353
- return ue(M);
1354
- }), R = !!u.find(function(M) {
1355
- return ne(M) > 0;
1356
- });
1357
- return {
1358
- container: o,
1359
- tabbableNodes: u,
1360
- focusableNodes: w,
1361
- /** True if at least one node with positive `tabindex` was found in this container. */
1362
- posTabIndexesFound: R,
1363
- /** First tabbable node in container, __tabindex__ order; `undefined` if none. */
1364
- firstTabbableNode: C,
1365
- /** Last tabbable node in container, __tabindex__ order; `undefined` if none. */
1366
- lastTabbableNode: P,
1367
- // NOTE: DOM order is NOT NECESSARILY "document position" order, but figuring that out
1368
- // would require more than just https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
1369
- // because that API doesn't work with Shadow DOM as well as it should (@see
1370
- // https://github.com/whatwg/dom/issues/320) and since this first/last is only needed, so far,
1371
- // to address an edge case related to positive tabindex support, this seems like a much easier,
1372
- // "close enough most of the time" alternative for positive tabindexes which should generally
1373
- // be avoided anyway...
1374
- /** First tabbable node in container, __DOM__ order; `undefined` if none. */
1375
- firstDomTabbableNode: I,
1376
- /** Last tabbable node in container, __DOM__ order; `undefined` if none. */
1377
- lastDomTabbableNode: S,
1378
- /**
1379
- * Finds the __tabbable__ node that follows the given node in the specified direction,
1380
- * in this container, if any.
1381
- * @param {HTMLElement} node
1382
- * @param {boolean} [forward] True if going in forward tab order; false if going
1383
- * in reverse.
1384
- * @returns {HTMLElement|undefined} The next tabbable node, if any.
1385
- */
1386
- nextTabbableNode: function(z) {
1387
- var L = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, _ = u.indexOf(z);
1388
- return _ < 0 ? L ? w.slice(w.indexOf(z) + 1).find(function(q) {
1389
- return ue(q);
1390
- }) : w.slice(0, w.indexOf(z)).reverse().find(function(q) {
1391
- return ue(q);
1392
- }) : u[_ + (L ? 1 : -1)];
1393
- }
1394
- };
1395
- }), a.tabbableGroups = a.containerGroups.filter(function(o) {
1396
- return o.tabbableNodes.length > 0;
1397
- }), a.tabbableGroups.length <= 0 && !b("fallbackFocus"))
1398
- throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");
1399
- if (a.containerGroups.find(function(o) {
1400
- return o.posTabIndexesFound;
1401
- }) && a.containerGroups.length > 1)
1402
- throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.");
1403
- }, E = function(o) {
1404
- var u = o.activeElement;
1405
- if (u)
1406
- return u.shadowRoot && u.shadowRoot.activeElement !== null ? E(u.shadowRoot) : u;
1407
- }, c = function(o) {
1408
- if (o !== !1 && o !== E(document)) {
1409
- if (!o || !o.focus) {
1410
- c(x());
1411
- return;
1412
- }
1413
- o.focus({
1414
- preventScroll: !!l.preventScroll
1415
- }), a.mostRecentlyFocusedNode = o, Jn(o) && o.select();
1416
- }
1417
- }, g = function(o) {
1418
- var u = b("setReturnFocus", {
1419
- params: [o]
1420
- });
1421
- return u || (u === !1 ? !1 : o);
1422
- }, d = function(o) {
1423
- var u = o.target, w = o.event, C = o.isBackward, P = C === void 0 ? !1 : C;
1424
- u = u || xe(w), T();
1425
- var I = null;
1426
- if (a.tabbableGroups.length > 0) {
1427
- var S = v(u, w), R = S >= 0 ? a.containerGroups[S] : void 0;
1428
- if (S < 0)
1429
- P ? I = a.tabbableGroups[a.tabbableGroups.length - 1].lastTabbableNode : I = a.tabbableGroups[0].firstTabbableNode;
1430
- else if (P) {
1431
- var M = a.tabbableGroups.findIndex(function(ee) {
1432
- var Z = ee.firstTabbableNode;
1433
- return u === Z;
1434
- });
1435
- if (M < 0 && (R.container === u || Ke(u, l.tabbableOptions) && !ue(u, l.tabbableOptions) && !R.nextTabbableNode(u, !1)) && (M = S), M >= 0) {
1436
- var z = M === 0 ? a.tabbableGroups.length - 1 : M - 1, L = a.tabbableGroups[z];
1437
- I = ne(u) >= 0 ? L.lastTabbableNode : L.lastDomTabbableNode;
1438
- } else ge(w) || (I = R.nextTabbableNode(u, !1));
1439
- } else {
1440
- var _ = a.tabbableGroups.findIndex(function(ee) {
1441
- var Z = ee.lastTabbableNode;
1442
- return u === Z;
1443
- });
1444
- if (_ < 0 && (R.container === u || Ke(u, l.tabbableOptions) && !ue(u, l.tabbableOptions) && !R.nextTabbableNode(u)) && (_ = S), _ >= 0) {
1445
- var q = _ === a.tabbableGroups.length - 1 ? 0 : _ + 1, ye = a.tabbableGroups[q];
1446
- I = ne(u) >= 0 ? ye.firstTabbableNode : ye.firstDomTabbableNode;
1447
- } else ge(w) || (I = R.nextTabbableNode(u));
1448
- }
1449
- } else
1450
- I = b("fallbackFocus");
1451
- return I;
1452
- }, f = function(o) {
1453
- var u = xe(o);
1454
- if (!(v(u, o) >= 0)) {
1455
- if (pe(l.clickOutsideDeactivates, o)) {
1456
- m.deactivate({
1457
- // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
1458
- // which will result in the outside click setting focus to the node
1459
- // that was clicked (and if not focusable, to "nothing"); by setting
1460
- // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
1461
- // on activation (or the configured `setReturnFocus` node), whether the
1462
- // outside click was on a focusable node or not
1463
- returnFocus: l.returnFocusOnDeactivate
1464
- });
1465
- return;
1466
- }
1467
- pe(l.allowOutsideClick, o) || o.preventDefault();
1468
- }
1469
- }, p = function(o) {
1470
- var u = xe(o), w = v(u, o) >= 0;
1471
- if (w || u instanceof Document)
1472
- w && (a.mostRecentlyFocusedNode = u);
1473
- else {
1474
- o.stopImmediatePropagation();
1475
- var C, P = !0;
1476
- if (a.mostRecentlyFocusedNode)
1477
- if (ne(a.mostRecentlyFocusedNode) > 0) {
1478
- var I = v(a.mostRecentlyFocusedNode), S = a.containerGroups[I].tabbableNodes;
1479
- if (S.length > 0) {
1480
- var R = S.findIndex(function(M) {
1481
- return M === a.mostRecentlyFocusedNode;
1482
- });
1483
- R >= 0 && (l.isKeyForward(a.recentNavEvent) ? R + 1 < S.length && (C = S[R + 1], P = !1) : R - 1 >= 0 && (C = S[R - 1], P = !1));
1484
- }
1485
- } else
1486
- a.containerGroups.some(function(M) {
1487
- return M.tabbableNodes.some(function(z) {
1488
- return ne(z) > 0;
1489
- });
1490
- }) || (P = !1);
1491
- else
1492
- P = !1;
1493
- P && (C = d({
1494
- // move FROM the MRU node, not event-related node (which will be the node that is
1495
- // outside the trap causing the focus escape we're trying to fix)
1496
- target: a.mostRecentlyFocusedNode,
1497
- isBackward: l.isKeyBackward(a.recentNavEvent)
1498
- })), c(C || a.mostRecentlyFocusedNode || x());
1499
- }
1500
- a.recentNavEvent = void 0;
1501
- }, y = function(o) {
1502
- var u = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
1503
- a.recentNavEvent = o;
1504
- var w = d({
1505
- event: o,
1506
- isBackward: u
1507
- });
1508
- w && (ge(o) && o.preventDefault(), c(w));
1509
- }, N = function(o) {
1510
- (l.isKeyForward(o) || l.isKeyBackward(o)) && y(o, l.isKeyBackward(o));
1511
- }, h = function(o) {
1512
- Qn(o) && pe(l.escapeDeactivates, o) !== !1 && (o.preventDefault(), m.deactivate());
1513
- }, k = function(o) {
1514
- var u = xe(o);
1515
- v(u, o) >= 0 || pe(l.clickOutsideDeactivates, o) || pe(l.allowOutsideClick, o) || (o.preventDefault(), o.stopImmediatePropagation());
1516
- }, A = function() {
1517
- if (a.active)
1518
- return ut.activateTrap(i, m), a.delayInitialFocusTimer = l.delayInitialFocus ? dt(function() {
1519
- c(x());
1520
- }) : c(x()), r.addEventListener("focusin", p, !0), r.addEventListener("mousedown", f, {
1521
- capture: !0,
1522
- passive: !1
1523
- }), r.addEventListener("touchstart", f, {
1524
- capture: !0,
1525
- passive: !1
1526
- }), r.addEventListener("click", k, {
1527
- capture: !0,
1528
- passive: !1
1529
- }), r.addEventListener("keydown", N, {
1530
- capture: !0,
1531
- passive: !1
1532
- }), r.addEventListener("keydown", h), m;
1533
- }, H = function() {
1534
- if (a.active)
1535
- return r.removeEventListener("focusin", p, !0), r.removeEventListener("mousedown", f, !0), r.removeEventListener("touchstart", f, !0), r.removeEventListener("click", k, !0), r.removeEventListener("keydown", N, !0), r.removeEventListener("keydown", h), m;
1536
- }, K = function(o) {
1537
- var u = o.some(function(w) {
1538
- var C = Array.from(w.removedNodes);
1539
- return C.some(function(P) {
1540
- return P === a.mostRecentlyFocusedNode;
1541
- });
1542
- });
1543
- u && c(x());
1544
- }, U = typeof window < "u" && "MutationObserver" in window ? new MutationObserver(K) : void 0, W = function() {
1545
- U && (U.disconnect(), a.active && !a.paused && a.containers.map(function(o) {
1546
- U.observe(o, {
1547
- subtree: !0,
1548
- childList: !0
1549
- });
1550
- }));
1551
- };
1552
- return m = {
1553
- get active() {
1554
- return a.active;
1555
- },
1556
- get paused() {
1557
- return a.paused;
1558
- },
1559
- activate: function(o) {
1560
- if (a.active)
1561
- return this;
1562
- var u = s(o, "onActivate"), w = s(o, "onPostActivate"), C = s(o, "checkCanFocusTrap");
1563
- C || T(), a.active = !0, a.paused = !1, a.nodeFocusedBeforeActivation = r.activeElement, u == null || u();
1564
- var P = function() {
1565
- C && T(), A(), W(), w == null || w();
1566
- };
1567
- return C ? (C(a.containers.concat()).then(P, P), this) : (P(), this);
1568
- },
1569
- deactivate: function(o) {
1570
- if (!a.active)
1571
- return this;
1572
- var u = ot({
1573
- onDeactivate: l.onDeactivate,
1574
- onPostDeactivate: l.onPostDeactivate,
1575
- checkCanReturnFocus: l.checkCanReturnFocus
1576
- }, o);
1577
- clearTimeout(a.delayInitialFocusTimer), a.delayInitialFocusTimer = void 0, H(), a.active = !1, a.paused = !1, W(), ut.deactivateTrap(i, m);
1578
- var w = s(u, "onDeactivate"), C = s(u, "onPostDeactivate"), P = s(u, "checkCanReturnFocus"), I = s(u, "returnFocus", "returnFocusOnDeactivate");
1579
- w == null || w();
1580
- var S = function() {
1581
- dt(function() {
1582
- I && c(g(a.nodeFocusedBeforeActivation)), C == null || C();
1583
- });
1584
- };
1585
- return I && P ? (P(g(a.nodeFocusedBeforeActivation)).then(S, S), this) : (S(), this);
1586
- },
1587
- pause: function(o) {
1588
- if (a.paused || !a.active)
1589
- return this;
1590
- var u = s(o, "onPause"), w = s(o, "onPostPause");
1591
- return a.paused = !0, u == null || u(), H(), W(), w == null || w(), this;
1592
- },
1593
- unpause: function(o) {
1594
- if (!a.paused || !a.active)
1595
- return this;
1596
- var u = s(o, "onUnpause"), w = s(o, "onPostUnpause");
1597
- return a.paused = !1, u == null || u(), T(), A(), W(), w == null || w(), this;
1598
- },
1599
- updateContainerElements: function(o) {
1600
- var u = [].concat(o).filter(Boolean);
1601
- return a.containers = u.map(function(w) {
1602
- return typeof w == "string" ? r.querySelector(w) : w;
1603
- }), a.active && T(), W(), this;
1604
- }
1605
- }, m.updateContainerElements(e), m;
1606
- };
1607
- function Ut(t, e, n) {
1608
- let r = null;
1609
- return t && (r = rr(t, {
1610
- clickOutsideDeactivates: !e,
1611
- escapeDeactivates: !e,
1612
- onDeactivate: () => n == null ? void 0 : n(),
1613
- fallbackFocus: () => t
1614
- }), r.activate()), { deactivate: () => {
1615
- r == null || r.deactivate(), r = null;
1616
- }, wrapper: t };
1617
- }
1618
- const ar = ({ modalContext: t, config: e, children: n }) => {
1619
- const [r, i] = $(!1), l = j(null), [a, m] = $(null);
1620
- function s() {
1621
- m(Ut(l.current, e == null ? void 0 : e.closeExplicitly, () => t.close())), i(!0);
1622
- }
1623
- return D(() => () => a == null ? void 0 : a.deactivate(), [a]), /* @__PURE__ */ F("div", { className: "im-modal-container fixed inset-0 z-40 overflow-y-auto p-4", children: /* @__PURE__ */ F(
1655
+ const gl = ({ modalContext: e, config: t, children: n }) => {
1656
+ const [r, l] = L(!1);
1657
+ return /* @__PURE__ */ T("div", { className: "im-modal-container fixed inset-0 z-40 overflow-y-auto p-4", children: /* @__PURE__ */ T(
1624
1658
  "div",
1625
1659
  {
1626
- className: Se("im-modal-positioner flex min-h-full justify-center", {
1627
- "items-start": e.position === "top",
1628
- "items-center": e.position === "center",
1629
- "items-end": e.position === "bottom"
1660
+ className: De("im-modal-positioner flex min-h-full justify-center", {
1661
+ "items-start": t.position === "top",
1662
+ "items-center": t.position === "center",
1663
+ "items-end": t.position === "bottom"
1630
1664
  }),
1631
- children: /* @__PURE__ */ F(
1632
- Ue,
1665
+ children: /* @__PURE__ */ T(
1666
+ me,
1633
1667
  {
1634
1668
  as: "div",
1635
- ref: l,
1636
1669
  enterFrom: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
1637
1670
  enterTo: "opacity-100 translate-y-0 sm:scale-100",
1638
1671
  leaveFrom: "opacity-100 translate-y-0 sm:scale-100",
1639
1672
  leaveTo: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
1640
- afterEnter: s,
1641
- afterLeave: t.afterLeave,
1642
- className: Se(
1643
- "im-modal-wrapper pointer-events-auto w-full transition duration-300 ease-in-out",
1644
- t.onTopOfStack ? "" : "blur-sm",
1673
+ afterEnter: () => l(!0),
1674
+ afterLeave: e.afterLeave,
1675
+ className: De("im-modal-wrapper w-full transition duration-300 ease-in-out", e.onTopOfStack ? "" : "blur-sm", {
1676
+ "sm:max-w-sm": t.maxWidth === "sm",
1677
+ "sm:max-w-md": t.maxWidth === "md",
1678
+ "sm:max-w-md md:max-w-lg": t.maxWidth === "lg",
1679
+ "sm:max-w-md md:max-w-xl": t.maxWidth === "xl",
1680
+ "sm:max-w-md md:max-w-xl lg:max-w-2xl": t.maxWidth === "2xl",
1681
+ "sm:max-w-md md:max-w-xl lg:max-w-3xl": t.maxWidth === "3xl",
1682
+ "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl": t.maxWidth === "4xl",
1683
+ "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl": t.maxWidth === "5xl",
1684
+ "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl": t.maxWidth === "6xl",
1685
+ "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl": t.maxWidth === "7xl"
1686
+ }),
1687
+ children: /* @__PURE__ */ ue(
1688
+ yt,
1645
1689
  {
1646
- "sm:max-w-sm": e.maxWidth === "sm",
1647
- "sm:max-w-md": e.maxWidth === "md",
1648
- "sm:max-w-md md:max-w-lg": e.maxWidth === "lg",
1649
- "sm:max-w-md md:max-w-xl": e.maxWidth === "xl",
1650
- "sm:max-w-md md:max-w-xl lg:max-w-2xl": e.maxWidth === "2xl",
1651
- "sm:max-w-md md:max-w-xl lg:max-w-3xl": e.maxWidth === "3xl",
1652
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl": e.maxWidth === "4xl",
1653
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl": e.maxWidth === "5xl",
1654
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl": e.maxWidth === "6xl",
1655
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl": e.maxWidth === "7xl"
1656
- }
1657
- ),
1658
- children: /* @__PURE__ */ le(
1659
- "div",
1660
- {
1661
- className: `im-modal-content relative ${e.paddingClasses} ${e.panelClasses}`,
1690
+ className: `im-modal-content relative ${t.paddingClasses} ${t.panelClasses}`,
1662
1691
  "data-inertiaui-modal-entered": r,
1663
1692
  children: [
1664
- e.closeButton && /* @__PURE__ */ F("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ F($t, { onClick: t.close }) }),
1665
- typeof n == "function" ? n({ modalContext: t, config: e }) : n
1693
+ t.closeButton && /* @__PURE__ */ T("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ T(sn, { onClick: e.close }) }),
1694
+ typeof n == "function" ? n({ modalContext: e, config: t }) : n
1666
1695
  ]
1667
1696
  }
1668
1697
  )
@@ -1670,53 +1699,45 @@ const ar = ({ modalContext: t, config: e, children: n }) => {
1670
1699
  )
1671
1700
  }
1672
1701
  ) });
1673
- }, ir = ({ modalContext: t, config: e, children: n }) => {
1674
- const [r, i] = $(!1), l = j(null), [a, m] = $(null);
1675
- function s() {
1676
- m(Ut(l.current, e == null ? void 0 : e.closeExplicitly, () => t.close())), i(!0);
1677
- }
1678
- return D(() => () => a == null ? void 0 : a.deactivate(), [a]), /* @__PURE__ */ F("div", { className: "im-slideover-container fixed inset-0 z-40 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ F(
1702
+ }, wl = ({ modalContext: e, config: t, children: n }) => {
1703
+ const [r, l] = L(!1);
1704
+ return /* @__PURE__ */ T("div", { className: "im-slideover-container fixed inset-0 z-40 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ T(
1679
1705
  "div",
1680
1706
  {
1681
- className: Se("im-slideover-positioner flex min-h-full items-center", {
1682
- "justify-start rtl:justify-end": (e == null ? void 0 : e.position) === "left",
1683
- "justify-end rtl:justify-start": (e == null ? void 0 : e.position) === "right"
1707
+ className: De("im-slideover-positioner flex min-h-full items-center", {
1708
+ "justify-start rtl:justify-end": (t == null ? void 0 : t.position) === "left",
1709
+ "justify-end rtl:justify-start": (t == null ? void 0 : t.position) === "right"
1684
1710
  }),
1685
- children: /* @__PURE__ */ F(
1686
- Ue,
1711
+ children: /* @__PURE__ */ T(
1712
+ me,
1687
1713
  {
1688
1714
  as: "div",
1689
- ref: l,
1690
- enterFrom: `opacity-0 ${e.position === "left" ? "-translate-x-full" : "translate-x-full"}`,
1715
+ enterFrom: `opacity-0 ${t.position === "left" ? "-translate-x-full" : "translate-x-full"}`,
1691
1716
  enterTo: "opacity-100 translate-x-0",
1692
1717
  leaveFrom: "opacity-100 translate-x-0",
1693
- leaveTo: `opacity-0 ${e.position === "left" ? "-translate-x-full" : "translate-x-full"}`,
1694
- afterEnter: s,
1695
- afterLeave: t.afterLeave,
1696
- className: Se(
1697
- "im-slideover-wrapper pointer-events-auto w-full transition duration-300 ease-in-out",
1698
- t.onTopOfStack ? "" : "blur-sm",
1718
+ leaveTo: `opacity-0 ${t.position === "left" ? "-translate-x-full" : "translate-x-full"}`,
1719
+ afterEnter: () => l(!0),
1720
+ afterLeave: e.afterLeave,
1721
+ className: De("im-slideover-wrapper w-full transition duration-300 ease-in-out", e.onTopOfStack ? "" : "blur-sm", {
1722
+ "sm:max-w-sm": t.maxWidth === "sm",
1723
+ "sm:max-w-md": t.maxWidth === "md",
1724
+ "sm:max-w-md md:max-w-lg": t.maxWidth === "lg",
1725
+ "sm:max-w-md md:max-w-xl": t.maxWidth === "xl",
1726
+ "sm:max-w-md md:max-w-xl lg:max-w-2xl": t.maxWidth === "2xl",
1727
+ "sm:max-w-md md:max-w-xl lg:max-w-3xl": t.maxWidth === "3xl",
1728
+ "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl": t.maxWidth === "4xl",
1729
+ "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl": t.maxWidth === "5xl",
1730
+ "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl": t.maxWidth === "6xl",
1731
+ "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl": t.maxWidth === "7xl"
1732
+ }),
1733
+ children: /* @__PURE__ */ ue(
1734
+ yt,
1699
1735
  {
1700
- "sm:max-w-sm": e.maxWidth === "sm",
1701
- "sm:max-w-md": e.maxWidth === "md",
1702
- "sm:max-w-md md:max-w-lg": e.maxWidth === "lg",
1703
- "sm:max-w-md md:max-w-xl": e.maxWidth === "xl",
1704
- "sm:max-w-md md:max-w-xl lg:max-w-2xl": e.maxWidth === "2xl",
1705
- "sm:max-w-md md:max-w-xl lg:max-w-3xl": e.maxWidth === "3xl",
1706
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl": e.maxWidth === "4xl",
1707
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl": e.maxWidth === "5xl",
1708
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl": e.maxWidth === "6xl",
1709
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl": e.maxWidth === "7xl"
1710
- }
1711
- ),
1712
- children: /* @__PURE__ */ le(
1713
- "div",
1714
- {
1715
- className: `im-slideover-content relative ${e.paddingClasses} ${e.panelClasses}`,
1736
+ className: `im-slideover-content relative ${t.paddingClasses} ${t.panelClasses}`,
1716
1737
  "data-inertiaui-modal-entered": r,
1717
1738
  children: [
1718
- e.closeButton && /* @__PURE__ */ F("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ F($t, { onClick: t.close }) }),
1719
- typeof n == "function" ? n({ modalContext: t, config: e }) : n
1739
+ t.closeButton && /* @__PURE__ */ T("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ T(sn, { onClick: e.close }) }),
1740
+ typeof n == "function" ? n({ modalContext: e, config: t }) : n
1720
1741
  ]
1721
1742
  }
1722
1743
  )
@@ -1724,52 +1745,50 @@ const ar = ({ modalContext: t, config: e, children: n }) => {
1724
1745
  )
1725
1746
  }
1726
1747
  ) });
1727
- }, lr = Ze(({ name: t, children: e, onFocus: n = null, onBlur: r = null, onClose: i = null, onSuccess: l = null, onAfterLeave: a = null, ...m }, s) => {
1728
- const v = (x) => typeof e == "function" ? e(x) : e, b = j(null);
1729
- return D(() => {
1730
- var x;
1731
- if (((x = b == null ? void 0 : b.current) == null ? void 0 : x.index) === 0)
1732
- return nt.prepare(), () => nt.cleanup();
1733
- }, [b]), ct(s, () => b.current, [b]), /* @__PURE__ */ F(
1734
- bt,
1748
+ }, yl = dt(({ name: e, children: t, onFocus: n = null, onBlur: r = null, onClose: l = null, onSuccess: a = null, onAfterLeave: o = null, ...u }, i) => {
1749
+ const d = (y) => typeof t == "function" ? t(y) : t, f = O(null);
1750
+ return Lt(i, () => f.current, [f]), /* @__PURE__ */ T(
1751
+ It,
1735
1752
  {
1736
- ref: b,
1737
- name: t,
1753
+ ref: f,
1754
+ name: e,
1738
1755
  onFocus: n,
1739
1756
  onBlur: r,
1740
- onClose: i,
1741
- onSuccess: l,
1742
- ...m,
1757
+ onClose: l,
1758
+ onSuccess: a,
1759
+ ...u,
1743
1760
  children: ({
1744
- afterLeave: x,
1745
- close: T,
1746
- config: E,
1761
+ afterLeave: y,
1762
+ close: b,
1763
+ config: w,
1747
1764
  emit: c,
1748
- getChildModal: g,
1749
- getParentModal: d,
1750
- id: f,
1765
+ getChildModal: v,
1766
+ getParentModal: s,
1767
+ id: m,
1751
1768
  index: p,
1752
- isOpen: y,
1753
- modalContext: N,
1769
+ isOpen: g,
1770
+ modalContext: x,
1754
1771
  onTopOfStack: h,
1755
- reload: k,
1756
- setOpen: A,
1757
- shouldRender: H
1758
- }) => /* @__PURE__ */ F(
1759
- Kn,
1772
+ reload: $,
1773
+ setOpen: F,
1774
+ shouldRender: j
1775
+ }) => /* @__PURE__ */ T(
1776
+ un,
1760
1777
  {
1761
1778
  appear: !0,
1762
- show: y ?? !1,
1763
- afterLeave: a,
1764
- children: /* @__PURE__ */ le(
1765
- "div",
1779
+ show: g ?? !1,
1780
+ afterLeave: o,
1781
+ children: /* @__PURE__ */ ue(
1782
+ vl,
1766
1783
  {
1784
+ as: "div",
1767
1785
  className: "im-dialog relative z-20",
1768
- "data-inertiaui-modal-id": f,
1786
+ onClose: () => w.closeExplicitly ? null : b(),
1787
+ "data-inertiaui-modal-id": m,
1769
1788
  "data-inertiaui-modal-index": p,
1770
1789
  children: [
1771
- p === 0 ? /* @__PURE__ */ F(
1772
- Ue,
1790
+ p === 0 ? /* @__PURE__ */ T(
1791
+ me,
1773
1792
  {
1774
1793
  enter: "transition transform ease-in-out duration-300",
1775
1794
  enterFrom: "opacity-0",
@@ -1777,58 +1796,58 @@ const ar = ({ modalContext: t, config: e, children: n }) => {
1777
1796
  leave: "transition transform ease-in-out duration-300",
1778
1797
  leaveFrom: "opacity-100",
1779
1798
  leaveTo: "opacity-0",
1780
- children: h ? /* @__PURE__ */ F(
1799
+ children: h ? /* @__PURE__ */ T(
1781
1800
  "div",
1782
1801
  {
1783
1802
  className: "im-backdrop fixed inset-0 z-30 bg-black/75",
1784
1803
  "aria-hidden": "true"
1785
1804
  }
1786
- ) : /* @__PURE__ */ F("div", {})
1805
+ ) : /* @__PURE__ */ T("div", {})
1787
1806
  }
1788
1807
  ) : null,
1789
- p > 0 && h ? /* @__PURE__ */ F("div", { className: "im-backdrop fixed inset-0 z-30 bg-black/75" }) : null,
1790
- E.slideover ? /* @__PURE__ */ F(
1791
- ir,
1808
+ p > 0 && h ? /* @__PURE__ */ T("div", { className: "im-backdrop fixed inset-0 z-30 bg-black/75" }) : null,
1809
+ w.slideover ? /* @__PURE__ */ T(
1810
+ wl,
1792
1811
  {
1793
- modalContext: N,
1794
- config: E,
1795
- children: v({
1796
- afterLeave: x,
1797
- close: T,
1798
- config: E,
1812
+ modalContext: x,
1813
+ config: w,
1814
+ children: d({
1815
+ afterLeave: y,
1816
+ close: b,
1817
+ config: w,
1799
1818
  emit: c,
1800
- getChildModal: g,
1801
- getParentModal: d,
1802
- id: f,
1819
+ getChildModal: v,
1820
+ getParentModal: s,
1821
+ id: m,
1803
1822
  index: p,
1804
- isOpen: y,
1805
- modalContext: N,
1823
+ isOpen: g,
1824
+ modalContext: x,
1806
1825
  onTopOfStack: h,
1807
- reload: k,
1808
- setOpen: A,
1809
- shouldRender: H
1826
+ reload: $,
1827
+ setOpen: F,
1828
+ shouldRender: j
1810
1829
  })
1811
1830
  }
1812
- ) : /* @__PURE__ */ F(
1813
- ar,
1831
+ ) : /* @__PURE__ */ T(
1832
+ gl,
1814
1833
  {
1815
- modalContext: N,
1816
- config: E,
1817
- children: v({
1818
- afterLeave: x,
1819
- close: T,
1820
- config: E,
1834
+ modalContext: x,
1835
+ config: w,
1836
+ children: d({
1837
+ afterLeave: y,
1838
+ close: b,
1839
+ config: w,
1821
1840
  emit: c,
1822
- getChildModal: g,
1823
- getParentModal: d,
1824
- id: f,
1841
+ getChildModal: v,
1842
+ getParentModal: s,
1843
+ id: m,
1825
1844
  index: p,
1826
- isOpen: y,
1827
- modalContext: N,
1845
+ isOpen: g,
1846
+ modalContext: x,
1828
1847
  onTopOfStack: h,
1829
- reload: k,
1830
- setOpen: A,
1831
- shouldRender: H
1848
+ reload: $,
1849
+ setOpen: F,
1850
+ shouldRender: j
1832
1851
  })
1833
1852
  }
1834
1853
  )
@@ -1840,84 +1859,84 @@ const ar = ({ modalContext: t, config: e, children: n }) => {
1840
1859
  }
1841
1860
  );
1842
1861
  });
1843
- lr.displayName = "Modal";
1844
- const br = ({
1845
- href: t,
1846
- method: e = "get",
1862
+ yl.displayName = "Modal";
1863
+ const kl = ({
1864
+ href: e,
1865
+ method: t = "get",
1847
1866
  data: n = {},
1848
1867
  as: r = "a",
1849
- headers: i = {},
1850
- queryStringArrayFormat: l = "brackets",
1851
- onAfterLeave: a = null,
1852
- onBlur: m = null,
1853
- onClose: s = null,
1854
- onError: v = null,
1855
- onFocus: b = null,
1856
- onStart: x = null,
1857
- onSuccess: T = null,
1858
- navigate: E = null,
1868
+ headers: l = {},
1869
+ queryStringArrayFormat: a = "brackets",
1870
+ onAfterLeave: o = null,
1871
+ onBlur: u = null,
1872
+ onClose: i = null,
1873
+ onError: d = null,
1874
+ onFocus: f = null,
1875
+ onStart: y = null,
1876
+ onSuccess: b = null,
1877
+ navigate: w = null,
1859
1878
  children: c,
1860
- ...g
1879
+ ...v
1861
1880
  }) => {
1862
- const [d, f] = $(!1), [p, y] = $(null), { stack: N, visit: h } = Ae(), k = Y(() => E ?? Je("navigate"), [E]), A = {}, H = {};
1863
- Object.keys(g).forEach((u) => {
1864
- rt.includes(u) || (u.startsWith("on") && typeof g[u] == "function" ? u.toLowerCase() in window ? A[u] = g[u] : H[u] = g[u] : A[u] = g[u]);
1881
+ const [s, m] = L(!1), [p, g] = L(null), { stack: x, visit: h } = Be(), $ = C(() => w ?? ft("navigate"), [w]), F = {}, j = {};
1882
+ Object.keys(v).forEach((P) => {
1883
+ 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]);
1865
1884
  });
1866
- const [K, U] = $(!1);
1867
- D(() => {
1868
- p && (p.onTopOfStack && K ? b == null || b() : !p.onTopOfStack && !K && (m == null || m()), U(!p.onTopOfStack));
1869
- }, [N]);
1870
- const W = V(() => {
1871
- s == null || s();
1872
- }, [s]), O = V(() => {
1873
- y(null), a == null || a();
1874
- }, [a]), o = V(
1875
- (u) => {
1876
- u == null || u.preventDefault(), !d && (t.startsWith("#") || (f(!0), x == null || x()), h(
1877
- t,
1885
+ const [_, N] = L(!1);
1886
+ M(() => {
1887
+ p && (p.onTopOfStack && _ ? f == null || f() : !p.onTopOfStack && !_ && (u == null || u()), N(!p.onTopOfStack));
1888
+ }, [x]);
1889
+ const H = Y(() => {
1890
+ i == null || i();
1891
+ }, [i]), B = Y(() => {
1892
+ g(null), o == null || o();
1893
+ }, [o]), X = Y(
1894
+ (P) => {
1895
+ P == null || P.preventDefault(), !s && (e.startsWith("#") || (m(!0), y == null || y()), h(
1878
1896
  e,
1897
+ t,
1879
1898
  n,
1880
- i,
1881
- Gt(ft(g, rt)),
1882
- () => W(N.length),
1883
- O,
1884
1899
  l,
1885
- k
1886
- ).then((w) => {
1887
- y(w), w.registerEventListenersFromProps(H), T == null || T();
1888
- }).catch((w) => {
1889
- console.error(w), v == null || v(w);
1890
- }).finally(() => f(!1)));
1900
+ On(Ft(v, xt)),
1901
+ () => H(x.length),
1902
+ B,
1903
+ a,
1904
+ $
1905
+ ).then((V) => {
1906
+ g(V), V.registerEventListenersFromProps(j), b == null || b();
1907
+ }).catch((V) => {
1908
+ console.error(V), d == null || d(V);
1909
+ }).finally(() => m(!1)));
1891
1910
  },
1892
- [t, e, n, i, l, g, W, O]
1911
+ [e, t, n, l, a, v, H, B]
1893
1912
  );
1894
- return /* @__PURE__ */ F(
1913
+ return /* @__PURE__ */ T(
1895
1914
  r,
1896
1915
  {
1897
- ...A,
1898
- href: t,
1899
- onClick: o,
1900
- children: typeof c == "function" ? c({ loading: d }) : c
1916
+ ...F,
1917
+ href: e,
1918
+ onClick: X,
1919
+ children: typeof c == "function" ? c({ loading: s }) : c
1901
1920
  }
1902
1921
  );
1903
1922
  };
1904
- function gr() {
1905
- return Ae().stack[ht()] ?? null;
1923
+ function Nl() {
1924
+ return Be().stack[Nt()] ?? null;
1906
1925
  }
1907
- const yr = (t) => (e) => (e.default.layout = (n) => Ne(t, {}, n), e);
1926
+ const Al = (e) => (t) => (t.default.layout = (n) => Ie(e, {}, n), t);
1908
1927
  export {
1909
- bt as HeadlessModal,
1910
- lr as Modal,
1911
- br as ModalLink,
1912
- Qt as ModalRoot,
1913
- Yt as ModalStackProvider,
1914
- Je as getConfig,
1915
- Jt as initFromPageProps,
1916
- pr as putConfig,
1917
- hr as renderApp,
1918
- mr as resetConfig,
1919
- yr as setPageLayout,
1920
- gr as useModal,
1921
- ht as useModalIndex,
1922
- Ae as useModalStack
1928
+ It as HeadlessModal,
1929
+ yl as Modal,
1930
+ kl as ModalLink,
1931
+ Ln as ModalRoot,
1932
+ Mn as ModalStackProvider,
1933
+ ft as getConfig,
1934
+ Sn as initFromPageProps,
1935
+ Sl as putConfig,
1936
+ Ll as renderApp,
1937
+ Ml as resetConfig,
1938
+ Al as setPageLayout,
1939
+ Nl as useModal,
1940
+ Nt as useModalIndex,
1941
+ Be as useModalStack
1923
1942
  };