@inertiaui/modal-react 0.18.1 → 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 Ut = Object.defineProperty;
2
- var Bt = (t, e, n) => e in t ? Ut(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var q = (t, e, n) => Bt(t, typeof e != "symbol" ? e + "" : e, n);
4
- import * as pe from "react";
5
- import B, { createContext as Ie, 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 _t } from "react";
6
- import { jsx as C, jsxs as le, Fragment as Ye } from "react/jsx-runtime";
7
- import Te from "axios";
8
- import { router as ve, usePage as qt } from "@inertiajs/react";
9
- import { mergeDataIntoQueryString as Xt } 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,188 +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 Pe = new Vt(), mr = () => Pe.reset(), hr = (t, e) => Pe.put(t, e), Je = (t) => Pe.get(t), se = (t, e) => Pe.get(t ? `slideover.${e}` : `modal.${e}`), nt = {
67
- modifiedElements: [],
68
- bodyState: {
69
- hasOverflowHidden: !1,
70
- originalPaddingRight: ""
71
- },
72
- prepare() {
73
- const t = window.innerWidth - document.documentElement.clientWidth;
74
- this.bodyState.originalPaddingRight = document.body.style.paddingRight;
75
- const e = parseInt(window.getComputedStyle(document.body).paddingRight, 10);
76
- document.body.style.paddingRight = `${e + t}px`, document.body.classList.contains("overflow-hidden") || (document.body.classList.add("overflow-hidden"), this.bodyState.hasOverflowHidden = !0), Array.from(document.body.children).forEach((n) => {
77
- !n.classList.contains("im-dialog") && n.getAttribute("aria-hidden") !== "true" && (n.setAttribute("aria-hidden", "true"), this.modifiedElements.push(n));
78
- });
79
- },
80
- cleanup() {
81
- this.bodyState.hasOverflowHidden && (document.body.classList.remove("overflow-hidden"), this.bodyState.hasOverflowHidden = !1), document.body.style.paddingRight = this.bodyState.originalPaddingRight, this.bodyState.originalPaddingRight = "", this.modifiedElements.forEach((t) => {
82
- t.removeAttribute("aria-hidden");
83
- }), this.modifiedElements = [];
84
- }
85
- };
86
- function Ue(t = "inertiaui_modal_") {
87
- 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)}`;
88
70
  }
89
- function zt(t, e) {
90
- 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), {});
91
73
  }
92
- function ft(t, e) {
93
- 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), {});
94
76
  }
95
- function Gt(t) {
96
- 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), {});
97
79
  }
98
- function Zt(t, e = 3, n = 10) {
99
- return new Promise((r, i) => {
100
- const l = t();
101
- if (l) {
102
- 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);
103
85
  return;
104
86
  }
105
- let a = e * 1e3 / n;
106
- const m = setInterval(() => {
107
- const s = t();
108
- 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")));
109
91
  }, n);
110
92
  });
111
93
  }
112
- function me(t) {
113
- 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) : "";
114
- }
115
- const Re = Ie(null);
116
- Re.displayName = "ModalStackContext";
117
- let mt = null, ht = null, be = null, _e = null, qe = [], oe = {};
118
- const Yt = ({ children: t }) => {
119
- const [e, n] = $([]), [r, i] = $({}), l = (g) => {
120
- n((d) => {
121
- const f = g([...d]), h = (y) => {
122
- var N;
123
- return f.length < 2 ? !0 : ((N = f.map((v) => ({ id: v.id, shouldRender: v.shouldRender })).reverse().find((v) => v.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;
124
106
  };
125
- return f.forEach((y, N) => {
126
- f[N].onTopOfStack = h(y.id), f[N].getParentModal = () => N < 1 ? null : f.slice(0, N).reverse().find((v) => v.isOpen), f[N].getChildModal = () => N === f.length - 1 ? null : f.slice(N + 1).find((v) => v.isOpen);
127
- }), 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;
128
110
  });
129
111
  };
130
- D(() => {
131
- qe = e;
132
- }, [e]);
133
- class a {
134
- constructor(d, f, h, y, N) {
112
+ M(() => {
113
+ rt = t;
114
+ }, [t]);
115
+ class o {
116
+ constructor(s, m, p, g, x) {
135
117
  q(this, "show", () => {
136
- l(
137
- (d) => d.map((f) => (f.id === this.id && !f.isOpen && (f.isOpen = !0, f.shouldRender = !0), f))
118
+ a(
119
+ (s) => s.map((m) => (m.id === this.id && !m.isOpen && (m.isOpen = !0, m.shouldRender = !0), m))
138
120
  );
139
121
  });
140
- q(this, "setOpen", (d) => {
141
- d ? this.show() : this.close();
122
+ q(this, "setOpen", (s) => {
123
+ s ? this.show() : this.close();
142
124
  });
143
125
  q(this, "close", () => {
144
- l(
145
- (d) => d.map((f) => {
146
- var h;
147
- return f.id === this.id && f.isOpen && (Object.keys(f.listeners).forEach((y) => {
148
- f.off(y);
149
- }), f.isOpen = !1, (h = f.onCloseCallback) == null || h.call(f)), f;
126
+ a(
127
+ (s) => s.map((m) => {
128
+ var p;
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;
150
132
  })
151
133
  );
152
134
  });
153
135
  q(this, "afterLeave", () => {
154
- this.isOpen || l((d) => {
155
- const f = d.map((h) => {
156
- var y;
157
- return h.id === this.id && !h.isOpen && (h.shouldRender = !1, (y = h.afterLeaveCallback) == null || y.call(h), h.afterLeaveCallback = null), h;
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;
158
140
  });
159
- return this.index === 0 ? [] : f;
141
+ return this.index === 0 ? [] : m;
160
142
  });
161
143
  });
162
- q(this, "on", (d, f) => {
163
- 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);
164
146
  });
165
- q(this, "off", (d, f) => {
166
- var h;
167
- d = me(d), f ? this.listeners[d] = ((h = this.listeners[d]) == null ? void 0 : h.filter((y) => y !== f)) ?? [] : delete this.listeners[d];
147
+ q(this, "off", (s, m) => {
148
+ var p;
149
+ s = we(s), m ? this.listeners[s] = ((p = this.listeners[s]) == null ? void 0 : p.filter((g) => g !== m)) ?? [] : delete this.listeners[s];
168
150
  });
169
- q(this, "emit", (d, ...f) => {
170
- var h;
171
- (h = this.listeners[me(d)]) == null || h.forEach((y) => y(...f));
151
+ q(this, "emit", (s, ...m) => {
152
+ var p;
153
+ (p = this.listeners[we(s)]) == null || p.forEach((g) => g(...m));
172
154
  });
173
- q(this, "registerEventListenersFromProps", (d) => {
174
- const f = [];
175
- return Object.keys(d).filter((h) => h.startsWith("on")).forEach((h) => {
176
- const y = me(h).replace(/^on-/, "");
177
- this.on(y, d[h]), f.push(() => this.off(y, d[h]));
178
- }), () => f.forEach((h) => h());
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());
179
161
  });
180
- q(this, "reload", (d = {}) => {
181
- var h;
182
- let f = Object.keys(this.response.props);
183
- d.only && (f = ft(f, d.only)), d.except && (f = zt(f, d.except)), (h = this.response) != null && h.url && Te.get(this.response.url, {
162
+ q(this, "reload", (s = {}) => {
163
+ var p;
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, {
184
166
  headers: {
185
167
  Accept: "text/html, application/xhtml+xml",
186
168
  "X-Inertia": !0,
187
169
  "X-Inertia-Partial-Component": this.response.component,
188
170
  "X-Inertia-Version": this.response.version,
189
- "X-Inertia-Partial-Data": f.join(","),
190
- "X-InertiaUI-Modal": Ue(),
171
+ "X-Inertia-Partial-Data": m.join(","),
172
+ "X-InertiaUI-Modal": Qe(),
191
173
  "X-InertiaUI-Modal-Use-Router": 0,
192
- "X-InertiaUI-Modal-Base-Url": be
174
+ "X-InertiaUI-Modal-Base-Url": $e
193
175
  }
194
- }).then((y) => {
195
- this.updateProps(y.data.props);
176
+ }).then((g) => {
177
+ this.updateProps(g.data.props);
196
178
  });
197
179
  });
198
- q(this, "updateProps", (d) => {
199
- Object.assign(this.props, d), l((f) => f);
180
+ q(this, "updateProps", (s) => {
181
+ Object.assign(this.props, s), a((m) => m);
200
182
  });
201
- if (this.id = f.id ?? Ue(), this.isOpen = !1, this.shouldRender = !1, this.listeners = {}, this.component = d, this.props = f.props, this.response = f, this.config = h ?? {}, 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]) {
202
184
  this.config = {
203
185
  ...this.config,
204
- ...oe[this.id].config ?? {}
186
+ ...ce[this.id].config ?? {}
205
187
  };
206
- const v = oe[this.id].onClose, I = oe[this.id].onAfterLeave;
207
- v && (this.onCloseCallback = y ? () => {
208
- y(), v();
209
- } : v), I && (this.afterLeaveCallback = N ? () => {
210
- N(), I();
211
- } : I), 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];
212
194
  }
213
195
  this.index = -1, this.getParentModal = () => null, this.getChildModal = () => null, this.onTopOfStack = !0;
214
196
  }
@@ -216,268 +198,268 @@ const Yt = ({ children: t }) => {
216
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)}`;
217
199
  }
218
200
  }
219
- const m = (g, d = {}, f = null, h = null) => ht(g.component).then((y) => s(y, g, d, f, h)), s = (g, d, f, h, y) => {
220
- const N = new a(g, d, f, h, y);
221
- return N.index = e.length, l((v) => [...v, 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;
222
204
  };
223
- function p(g, d, f, h) {
224
- if (!r[g])
225
- throw new Error(`The local modal "${g}" has not been registered.`);
226
- const y = s(null, {}, d, f, h);
227
- 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;
228
210
  }
229
- const b = (g, d = {}) => w(
230
- g,
231
- d.method ?? "get",
232
- d.data ?? {},
233
- d.headers ?? {},
234
- d.config ?? {},
235
- d.onClose,
236
- d.onAfterLeave,
237
- d.queryStringArrayFormat ?? "brackets",
238
- d.navigate ?? Je("navigate")
239
- ).then((f) => {
240
- const h = d.listeners ?? {};
241
- return Object.keys(h).forEach((y) => {
242
- const N = me(y);
243
- f.on(N, h[y]);
244
- }), f;
245
- }), w = (g, d, f = {}, h = {}, y = {}, N = null, v = null, I = "brackets", A = !1) => {
246
- const H = Ue();
247
- return new Promise((K, W) => {
248
- if (g.startsWith("#")) {
249
- K(p(g.substring(1), y, N, v));
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));
250
232
  return;
251
233
  }
252
- const [U, O] = Xt(d, g || "", f, I);
253
- let o = A && e.length === 0;
254
- if (e.length === 0 && (be = typeof window < "u" ? window.location.href : ""), h = {
255
- ...h,
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 = {
237
+ ...p,
256
238
  Accept: "text/html, application/xhtml+xml",
257
239
  "X-Requested-With": "XMLHttpRequest",
258
240
  "X-Inertia": !0,
259
- "X-Inertia-Version": mt,
260
- "X-InertiaUI-Modal": H,
261
- "X-InertiaUI-Modal-Use-Router": o ? 1 : 0,
262
- "X-InertiaUI-Modal-Base-Url": be
263
- }, o)
264
- return _e = null, oe[H] = {
265
- config: y,
266
- onClose: N,
267
- onAfterLeave: v
268
- }, ve.visit(U, {
269
- method: d,
270
- data: O,
271
- headers: h,
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,
249
+ onAfterLeave: h
250
+ }, xe.visit(H, {
251
+ method: s,
252
+ data: B,
253
+ headers: p,
272
254
  preserveScroll: !0,
273
255
  preserveState: !0,
274
- onError: W,
256
+ onError: N,
275
257
  onFinish: () => {
276
- Zt(() => _e).then(K);
258
+ Pn(() => nt).then(_);
277
259
  }
278
260
  });
279
- Te({
280
- url: U,
281
- method: d,
282
- data: O,
283
- headers: h
284
- }).then((u) => K(m(u.data, y, N, v))).catch((u) => {
285
- W(u);
261
+ Re({
262
+ url: H,
263
+ method: s,
264
+ data: B,
265
+ headers: p
266
+ }).then((P) => _(u(P.data, g, x, h))).catch((P) => {
267
+ N(P);
286
268
  });
287
269
  });
288
270
  }, c = {
289
- stack: e,
271
+ stack: t,
290
272
  localModals: r,
291
- push: s,
292
- pushFromResponseData: m,
273
+ push: i,
274
+ pushFromResponseData: u,
293
275
  closeAll: () => {
294
- qe.reverse().forEach((g) => g.close());
276
+ rt.reverse().forEach((v) => v.close());
295
277
  },
296
- reset: () => l(() => []),
297
- visit: w,
298
- visitModal: b,
299
- registerLocalModal: (g, d) => {
300
- i((f) => ({
301
- ...f,
302
- [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 }
303
285
  }));
304
286
  },
305
- removeLocalModal: (g) => {
306
- i((d) => {
307
- const f = { ...d };
308
- return delete f[g], f;
287
+ removeLocalModal: (v) => {
288
+ l((s) => {
289
+ const m = { ...s };
290
+ return delete m[v], m;
309
291
  });
310
292
  }
311
293
  };
312
- return /* @__PURE__ */ C(Re.Provider, { value: c, children: t });
313
- }, Ae = () => {
314
- const t = de(Re);
315
- if (t === null)
294
+ return /* @__PURE__ */ T(_e.Provider, { value: c, children: e });
295
+ }, Be = () => {
296
+ const e = R(_e);
297
+ if (e === null)
316
298
  throw new Error("useModalStack must be used within a ModalStackProvider");
317
- return t;
318
- }, rt = ["closeButton", "closeExplicitly", "maxWidth", "paddingClasses", "panelClasses", "position", "slideover"], Jt = (t) => {
319
- t.initialPage && (mt = t.initialPage.version), t.resolveComponent && (ht = t.resolveComponent);
320
- }, vr = (t, e) => (Jt(e), /* @__PURE__ */ C(Yt, { children: /* @__PURE__ */ C(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: [
321
303
  (() => {
322
- const m = Ne(r, { key: l, ...i });
323
- return typeof r.layout == "function" ? r.layout(m) : Array.isArray(r.layout) ? r.layout.concat(m).reverse().reduce((p, b) => Ne(b, i, p)) : 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;
324
306
  })(),
325
- /* @__PURE__ */ C(Qt, {})
326
- ] }) }) })), Qt = ({ children: t }) => {
327
- var m;
328
- const e = de(Re);
307
+ /* @__PURE__ */ T(Ln, {})
308
+ ] }) }) })), Ln = ({ children: e }) => {
309
+ var u;
310
+ const t = R(_e);
329
311
  let n = !1, r = !1;
330
- D(() => ve.on("start", () => n = !0), []), D(() => ve.on("finish", () => n = !1), []), D(
331
- () => ve.on("navigate", function(s) {
332
- const p = s.detail.page.props._inertiaui_modal;
333
- if (!p) {
334
- 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();
335
317
  return;
336
318
  }
337
- r = p, be = p.baseUrl, e.pushFromResponseData(p, {}, () => {
338
- if (!p.baseUrl) {
319
+ r = d, $e = d.baseUrl, t.pushFromResponseData(d, {}, () => {
320
+ if (!d.baseUrl) {
339
321
  console.error("No base url in modal response data so cannot navigate back");
340
322
  return;
341
323
  }
342
- !n && window.location.href !== p.baseUrl && ve.visit(p.baseUrl, {
324
+ !n && window.location.href !== d.baseUrl && xe.visit(d.baseUrl, {
343
325
  preserveScroll: !0,
344
326
  preserveState: !0
345
327
  });
346
- }).then((b) => {
347
- _e = b;
328
+ }).then((f) => {
329
+ nt = f;
348
330
  });
349
331
  }),
350
332
  []
351
333
  );
352
- const i = (s) => (qe.length && (s.headers["X-InertiaUI-Modal-Base-Url"] = be), s);
353
- D(() => (Te.interceptors.request.use(i), () => Te.interceptors.request.eject(i)), []);
354
- const l = qt(), a = j();
355
- return D(() => {
356
- var b, w;
357
- const s = (b = l.props) == null ? void 0 : b._inertiaui_modal, p = a.current;
358
- a.current = s, s && p && s.component === p.component && s.url === p.url && ((w = e.stack[0]) == null || w.updateProps(s.props ?? {}));
359
- }, [(m = l.props) == null ? void 0 : m._inertiaui_modal]), /* @__PURE__ */ le(Ye, { children: [
360
- t,
361
- e.stack.length > 0 && /* @__PURE__ */ C(pt, { 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 })
362
344
  ] });
363
- }, Qe = B.createContext(null);
364
- Qe.displayName = "ModalIndexContext";
365
- const vt = () => {
366
- const t = B.useContext(Qe);
367
- 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)
368
350
  throw new Error("useModalIndex must be used within a ModalIndexProvider");
369
- return t;
370
- }, pt = ({ index: t }) => {
371
- const { stack: e } = Ae(), n = Y(() => e[t], [e, t]);
372
- return (n == null ? void 0 : n.component) && /* @__PURE__ */ C(Qe.Provider, { value: t, children: /* @__PURE__ */ C(
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(
373
355
  n.component,
374
356
  {
375
357
  ...n.props,
376
358
  onModalEvent: (...r) => n.emit(...r)
377
359
  }
378
360
  ) });
379
- }, bt = Ze(({ name: t, children: e, onFocus: n = null, onBlur: r = null, onClose: i = null, onSuccess: l = null, ...a }, m) => {
380
- const s = vt(), { stack: p, registerLocalModal: b, removeLocalModal: w } = Ae(), [T, E] = $(null), c = Y(() => t ? T : p[s], [t, T, s, p]), g = Y(() => {
381
- var v;
382
- return (v = p.find((I) => I.shouldRender && I.index > (c == null ? void 0 : c.index))) == null ? void 0 : v.index;
383
- }, [s, p]), d = Y(() => (c == null ? void 0 : c.config.slideover) ?? a.slideover ?? Je("type") === "slideover", [a.slideover]), f = 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(() => {
363
+ var h;
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(
384
366
  () => ({
385
- slideover: d,
386
- closeButton: a.closeButton ?? se(d, "closeButton"),
387
- closeExplicitly: a.closeExplicitly ?? se(d, "closeExplicitly"),
388
- maxWidth: a.maxWidth ?? se(d, "maxWidth"),
389
- paddingClasses: a.paddingClasses ?? se(d, "paddingClasses"),
390
- panelClasses: a.panelClasses ?? se(d, "panelClasses"),
391
- 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"),
392
374
  ...c == null ? void 0 : c.config
393
375
  }),
394
- [a, c == null ? void 0 : c.config]
376
+ [o, c == null ? void 0 : c.config]
395
377
  );
396
- D(() => {
397
- if (t) {
398
- let v = null;
399
- return b(t, (I) => {
400
- v = I.registerEventListenersFromProps(a), E(I);
378
+ M(() => {
379
+ if (e) {
380
+ let h = null;
381
+ return f(e, ($) => {
382
+ h = $.registerEventListenersFromProps(o), w($);
401
383
  }), () => {
402
- v == null || v(), v = null, w(t);
384
+ h == null || h(), h = null, y(e);
403
385
  };
404
386
  }
405
- return c.registerEventListenersFromProps(a);
406
- }, [t]);
407
- const h = j(c);
408
- D(() => {
409
- h.current = c;
410
- }, [c]), D(() => {
411
- c !== null && (c.isOpen ? l == null || l() : i == null || i());
387
+ return c.registerEventListenersFromProps(o);
388
+ }, [e]);
389
+ const p = O(c);
390
+ M(() => {
391
+ p.current = c;
392
+ }, [c]), M(() => {
393
+ c !== null && (c.isOpen ? a == null || a() : l == null || l());
412
394
  }, [c == null ? void 0 : c.isOpen]);
413
- const [y, N] = $(!1);
414
- return D(() => {
415
- y && c !== null && c.isOpen && (c.onTopOfStack ? n == null || n() : r == null || r()), N(!0);
416
- }, [c == null ? void 0 : c.onTopOfStack]), ct(
417
- 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,
418
400
  () => ({
419
401
  afterLeave: () => {
420
- var v;
421
- return (v = h.current) == null ? void 0 : v.afterLeave();
402
+ var h;
403
+ return (h = p.current) == null ? void 0 : h.afterLeave();
422
404
  },
423
405
  close: () => {
424
- var v;
425
- return (v = h.current) == null ? void 0 : v.close();
406
+ var h;
407
+ return (h = p.current) == null ? void 0 : h.close();
426
408
  },
427
- emit: (...v) => {
428
- var I;
429
- return (I = h.current) == null ? void 0 : I.emit(...v);
409
+ emit: (...h) => {
410
+ var $;
411
+ return ($ = p.current) == null ? void 0 : $.emit(...h);
430
412
  },
431
413
  getChildModal: () => {
432
- var v;
433
- return (v = h.current) == null ? void 0 : v.getChildModal();
414
+ var h;
415
+ return (h = p.current) == null ? void 0 : h.getChildModal();
434
416
  },
435
417
  getParentModal: () => {
436
- var v;
437
- return (v = h.current) == null ? void 0 : v.getParentModal();
418
+ var h;
419
+ return (h = p.current) == null ? void 0 : h.getParentModal();
438
420
  },
439
- reload: (...v) => {
440
- var I;
441
- return (I = h.current) == null ? void 0 : I.reload(...v);
421
+ reload: (...h) => {
422
+ var $;
423
+ return ($ = p.current) == null ? void 0 : $.reload(...h);
442
424
  },
443
425
  setOpen: () => {
444
- var v;
445
- return (v = h.current) == null ? void 0 : v.setOpen();
426
+ var h;
427
+ return (h = p.current) == null ? void 0 : h.setOpen();
446
428
  },
447
429
  get id() {
448
- var v;
449
- return (v = h.current) == null ? void 0 : v.id;
430
+ var h;
431
+ return (h = p.current) == null ? void 0 : h.id;
450
432
  },
451
433
  get index() {
452
- var v;
453
- return (v = h.current) == null ? void 0 : v.index;
434
+ var h;
435
+ return (h = p.current) == null ? void 0 : h.index;
454
436
  },
455
437
  get isOpen() {
456
- var v;
457
- return (v = h.current) == null ? void 0 : v.isOpen;
438
+ var h;
439
+ return (h = p.current) == null ? void 0 : h.isOpen;
458
440
  },
459
441
  get config() {
460
- var v;
461
- return (v = h.current) == null ? void 0 : v.config;
442
+ var h;
443
+ return (h = p.current) == null ? void 0 : h.config;
462
444
  },
463
445
  get modalContext() {
464
- return h.current;
446
+ return p.current;
465
447
  },
466
448
  get onTopOfStack() {
467
- var v;
468
- return (v = h.current) == null ? void 0 : v.onTopOfStack;
449
+ var h;
450
+ return (h = p.current) == null ? void 0 : h.onTopOfStack;
469
451
  },
470
452
  get shouldRender() {
471
- var v;
472
- return (v = h.current) == null ? void 0 : v.shouldRender;
453
+ var h;
454
+ return (h = p.current) == null ? void 0 : h.shouldRender;
473
455
  }
474
456
  }),
475
457
  [c]
476
- ), (c == null ? void 0 : c.shouldRender) && /* @__PURE__ */ le(Ye, { children: [
477
- typeof e == "function" ? e({
458
+ ), (c == null ? void 0 : c.shouldRender) && /* @__PURE__ */ ue(ct, { children: [
459
+ typeof t == "function" ? t({
478
460
  afterLeave: c.afterLeave,
479
461
  close: c.close,
480
- config: f,
462
+ config: m,
481
463
  emit: c.emit,
482
464
  getChildModal: c.getChildModal,
483
465
  getParentModal: c.getParentModal,
@@ -489,31 +471,31 @@ const vt = () => {
489
471
  reload: c.reload,
490
472
  setOpen: c.setOpen,
491
473
  shouldRender: c.shouldRender
492
- }) : e,
493
- g && /* @__PURE__ */ C(pt, { index: g })
474
+ }) : t,
475
+ v && /* @__PURE__ */ T(At, { index: v })
494
476
  ] });
495
477
  });
496
- bt.displayName = "HeadlessModal";
497
- function gt(t) {
498
- var e, n, r = "";
499
- if (typeof t == "string" || typeof t == "number") r += t;
500
- else if (typeof t == "object") if (Array.isArray(t)) {
501
- var i = t.length;
502
- for (e = 0; e < i; e++) t[e] && (n = gt(t[e])) && (r && (r += " "), r += n);
503
- } 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);
504
486
  return r;
505
487
  }
506
- function Se() {
507
- 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);
508
490
  return r;
509
491
  }
510
- 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);
511
- 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 {
512
494
  constructor() {
513
- 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);
514
496
  }
515
- set(e) {
516
- 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);
517
499
  }
518
500
  reset() {
519
501
  this.set(this.detect());
@@ -536,596 +518,1117 @@ let nn = class {
536
518
  get isHandoffComplete() {
537
519
  return this.handoffState === "complete";
538
520
  }
539
- }, Ee = new nn();
540
- function rn(t) {
541
- typeof queueMicrotask == "function" ? queueMicrotask(t) : Promise.resolve().then(t).catch((e) => setTimeout(() => {
542
- 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;
543
528
  }));
544
529
  }
545
- function Me() {
546
- let t = [], e = { addEventListener(n, r, i, l) {
547
- 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));
548
533
  }, requestAnimationFrame(...n) {
549
534
  let r = requestAnimationFrame(...n);
550
- return e.add(() => cancelAnimationFrame(r));
535
+ return t.add(() => cancelAnimationFrame(r));
551
536
  }, nextFrame(...n) {
552
- return e.requestAnimationFrame(() => e.requestAnimationFrame(...n));
537
+ return t.requestAnimationFrame(() => t.requestAnimationFrame(...n));
553
538
  }, setTimeout(...n) {
554
539
  let r = setTimeout(...n);
555
- return e.add(() => clearTimeout(r));
540
+ return t.add(() => clearTimeout(r));
556
541
  }, microTask(...n) {
557
542
  let r = { current: !0 };
558
- return rn(() => {
543
+ return Ve(() => {
559
544
  r.current && n[0]();
560
- }), e.add(() => {
545
+ }), t.add(() => {
561
546
  r.current = !1;
562
547
  });
563
- }, style(n, r, i) {
564
- let l = n.style.getPropertyValue(r);
565
- return Object.assign(n.style, { [r]: i }), this.add(() => {
566
- 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 });
567
552
  });
568
553
  }, group(n) {
569
- let r = Me();
554
+ let r = re();
570
555
  return n(r), this.add(() => r.dispose());
571
556
  }, add(n) {
572
- return t.includes(n) || t.push(n), () => {
573
- let r = t.indexOf(n);
574
- 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();
575
560
  };
576
561
  }, dispose() {
577
- for (let n of t.splice(0)) n();
562
+ for (let n of e.splice(0)) n();
578
563
  } };
579
- return e;
564
+ return t;
580
565
  }
581
- function yt() {
582
- let [t] = $(Me);
583
- return D(() => () => t.dispose(), [t]), t;
566
+ function pt() {
567
+ let [e] = L(re);
568
+ return M(() => () => e.dispose(), [e]), e;
584
569
  }
585
- let Q = (t, e) => {
586
- Ee.isServer ? D(t, e) : Ht(t, e);
570
+ let A = (e, t) => {
571
+ oe.isServer ? M(e, t) : pn(e, t);
587
572
  };
588
- function wt(t) {
589
- let e = j(t);
590
- return Q(() => {
591
- e.current = t;
592
- }, [t]), e;
593
- }
594
- let G = function(t) {
595
- let e = wt(t);
596
- return B.useCallback((...n) => e.current(...n), [e]);
597
- };
598
- function Xe(...t) {
599
- 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);
600
585
  }
601
- function Le(t, e, ...n) {
602
- if (t in e) {
603
- let i = e[t];
604
- 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;
605
593
  }
606
- 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(", ")}.`);
607
- throw Error.captureStackTrace && Error.captureStackTrace(r, Le), r;
608
- }
609
- 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 || {});
610
- function Et() {
611
- let t = ln();
612
- return V((e) => an({ mergeRefs: t, ...e }), [t]);
613
- }
614
- function an({ ourProps: t, theirProps: e, slot: n, defaultTag: r, features: i, visible: l = !0, name: a, mergeRefs: m }) {
615
- m = m ?? sn;
616
- let s = Nt(e, t);
617
- if (l) return we(s, n, r, a, m);
618
- let p = i ?? 0;
619
- if (p & 2) {
620
- let { static: b = !1, ...w } = s;
621
- if (b) return we(w, 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);
622
610
  }
623
- if (p & 1) {
624
- let { unmount: b = !0, ...w } = s;
625
- return Le(b ? 0 : 1, { 0() {
611
+ if (d & 1) {
612
+ let { unmount: f = !0, ...y } = i;
613
+ return ne(f ? 0 : 1, { 0() {
626
614
  return null;
627
615
  }, 1() {
628
- return we({ ...w, hidden: !0, style: { display: "none" } }, n, r, a, m);
616
+ return Ae({ ...y, hidden: !0, style: { display: "none" } }, n, r, o, u);
629
617
  } });
630
618
  }
631
- return we(s, n, r, a, m);
632
- }
633
- function we(t, e = {}, n, r, i) {
634
- let { as: l = n, children: a, refName: m = "ref", ...s } = He(t, ["unmount", "static"]), p = t.ref !== void 0 ? { [m]: t.ref } : {}, b = typeof a == "function" ? a(e) : a;
635
- "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);
636
- let w = {};
637
- if (e) {
638
- let T = !1, E = [];
639
- 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()}`));
640
- if (T) {
641
- w["data-headlessui-state"] = E.join(" ");
642
- for (let c of E) w[`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}`] = "";
643
631
  }
644
632
  }
645
- if (l === ae && (Object.keys(te(s)).length > 0 || Object.keys(te(w)).length > 0)) if (!Kt(b) || Array.isArray(b) && b.length > 1) {
646
- 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(w))).map((T) => ` - ${T}`).join(`
647
- `), "", "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(`
648
636
  `)].join(`
649
637
  `));
650
638
  } else {
651
- let T = b.props, E = T == null ? void 0 : T.className, c = typeof E == "function" ? (...f) => Xe(E(...f), s.className) : Xe(E, s.className), g = c ? { className: c } : {}, d = Nt(b.props, te(He(s, ["ref"])));
652
- for (let f in w) f in d && delete w[f];
653
- return _t(b, Object.assign({}, d, w, p, { ref: i(on(b), p.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));
654
642
  }
655
- return Ne(l, Object.assign({}, He(s, ["ref"]), l !== ae && p, l !== ae && w), b);
643
+ return Ie(a, Object.assign({}, tt(i, ["ref"]), a !== G && d, a !== G && y), f);
656
644
  }
657
- function ln() {
658
- let t = j([]), e = V((n) => {
659
- 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);
660
648
  }, []);
661
649
  return (...n) => {
662
- if (!n.every((r) => r == null)) return t.current = n, e;
650
+ if (!n.every((r) => r == null)) return e.current = n, t;
663
651
  };
664
652
  }
665
- function sn(...t) {
666
- return t.every((e) => e == null) ? void 0 : (e) => {
667
- 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);
668
656
  };
669
657
  }
670
- function Nt(...t) {
671
- if (t.length === 0) return {};
672
- if (t.length === 1) return t[0];
673
- let e = {}, n = {};
674
- 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];
675
- if (e.disabled || e["aria-disabled"]) for (let r in n) /^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r) && (n[r] = [(i) => {
676
- var l;
677
- 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);
678
666
  }]);
679
- for (let r in n) Object.assign(e, { [r](i, ...l) {
680
- let a = n[r];
681
- for (let m of a) {
682
- if ((i instanceof Event || (i == null ? void 0 : i.nativeEvent) instanceof Event) && i.defaultPrevented) return;
683
- 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);
684
672
  }
685
673
  } });
686
- return e;
674
+ return t;
687
675
  }
688
- function et(t) {
689
- var e;
690
- 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 });
691
679
  }
692
- function te(t) {
693
- let e = Object.assign({}, t);
694
- for (let n in e) e[n] === void 0 && delete e[n];
695
- 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;
696
684
  }
697
- function He(t, e = []) {
698
- let n = Object.assign({}, t);
699
- 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];
700
688
  return n;
701
689
  }
702
- function on(t) {
703
- 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;
704
692
  }
705
- let un = Symbol();
706
- function Tt(...t) {
707
- let e = j(t);
708
- D(() => {
709
- e.current = t;
710
- }, [t]);
711
- let n = G((r) => {
712
- 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);
713
711
  });
714
- return t.every((r) => r == null || (r == null ? void 0 : r[un])) ? void 0 : n;
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;
715
723
  }
716
- function dn(t = 0) {
717
- let [e, n] = $(t), r = V((s) => n(s), [e]), i = V((s) => n((p) => p | s), [e]), l = V((s) => (e & s) === s, [e]), a = V((s) => n((p) => p & ~s), [n]), m = V((s) => n((p) => p ^ s), [n]);
718
- return { flags: e, setFlag: r, addFlag: i, hasFlag: l, removeFlag: a, toggleFlag: m };
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])];
719
733
  }
720
- var at, it;
721
- 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() {
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] };
1081
+ });
1082
+ }
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 };
1086
+ }
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() {
722
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(`
723
1090
  `)), [];
724
1091
  });
725
- 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 || {});
726
- function fn(t) {
727
- let e = {};
728
- for (let n in t) t[n] === !0 && (e[`data-${n}`] = "");
729
- 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;
730
1097
  }
731
- function mn(t, e, n, r) {
732
- let [i, l] = $(n), { hasFlag: a, addFlag: m, removeFlag: s } = dn(t && i ? 3 : 0), p = j(!1), b = j(!1), w = yt();
733
- return Q(() => {
734
- var T;
735
- if (t) {
736
- if (n && l(!0), !e) {
737
- 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);
738
1105
  return;
739
1106
  }
740
- return (T = r == null ? void 0 : r.start) == null || T.call(r, n), hn(e, { inFlight: p, prepare() {
741
- b.current ? b.current = !1 : b.current = p.current, p.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)));
742
1109
  }, run() {
743
- 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);
744
1111
  }, done() {
745
- var E;
746
- b.current && typeof e.getAnimations == "function" && e.getAnimations().length > 0 || (p.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));
747
1114
  } });
748
1115
  }
749
- }, [t, n, e, w]), 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 }];
750
1117
  }
751
- function hn(t, { prepare: e, run: n, done: r, inFlight: i }) {
752
- let l = Me();
753
- return pn(t, { prepare: e, inFlight: i }), l.nextFrame(() => {
754
- n(), l.requestAnimationFrame(() => {
755
- l.add(vn(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));
756
1123
  });
757
- }), l.dispose;
1124
+ }), a.dispose;
758
1125
  }
759
- function vn(t, e) {
1126
+ function Er(e, t) {
760
1127
  var n, r;
761
- let i = Me();
762
- if (!t) return i.dispose;
763
- let l = !1;
764
- i.add(() => {
765
- l = !0;
1128
+ let l = re();
1129
+ if (!e) return l.dispose;
1130
+ let a = !1;
1131
+ l.add(() => {
1132
+ a = !0;
766
1133
  });
767
- let a = (r = (n = t.getAnimations) == null ? void 0 : n.call(t).filter((m) => m instanceof CSSTransition)) != null ? r : [];
768
- return a.length === 0 ? (e(), i.dispose) : (Promise.allSettled(a.map((m) => m.finished)).then(() => {
769
- l || e();
770
- }), 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);
771
1138
  }
772
- function pn(t, { inFlight: e, prepare: n }) {
773
- if (e != null && e.current) {
1139
+ function $r(e, { inFlight: t, prepare: n }) {
1140
+ if (t != null && t.current) {
774
1141
  n();
775
1142
  return;
776
1143
  }
777
- let r = t.style.transition;
778
- t.style.transition = "none", n(), t.offsetHeight, t.style.transition = r;
779
- }
780
- /*!
781
- * tabbable 6.2.0
782
- * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
783
- */
784
- 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() {
785
- } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, Fe = !Ot && Element.prototype.getRootNode ? function(t) {
786
- var e;
787
- return t == null || (e = t.getRootNode) === null || e === void 0 ? void 0 : e.call(t);
788
- } : function(t) {
789
- return t == null ? void 0 : t.ownerDocument;
790
- }, ke = function t(e, n) {
791
- var r;
792
- n === void 0 && (n = !0);
793
- 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);
794
- return a;
795
- }, bn = function(e) {
796
- var n, r = e == null || (n = e.getAttribute) === null || n === void 0 ? void 0 : n.call(e, "contenteditable");
797
- return r === "" || r === "true";
798
- }, Ft = function(e, n, r) {
799
- if (ke(e))
800
- return [];
801
- var i = Array.prototype.slice.apply(e.querySelectorAll(Oe));
802
- return n && ie.call(e, Oe) && i.unshift(e), i = i.filter(r), i;
803
- }, kt = function t(e, n, r) {
804
- for (var i = [], l = Array.from(e); l.length; ) {
805
- var a = l.shift();
806
- if (!ke(a, !1))
807
- if (a.tagName === "SLOT") {
808
- var m = a.assignedElements(), s = m.length ? m : a.children, p = t(s, !0, r);
809
- r.flatten ? i.push.apply(i, p) : i.push({
810
- scopeParent: a,
811
- candidates: p
812
- });
813
- } else {
814
- var b = ie.call(a, Oe);
815
- b && r.filter(a) && (n || !e.includes(a)) && i.push(a);
816
- var w = a.shadowRoot || // check for an undisclosed shadow
817
- typeof r.getShadowRoot == "function" && r.getShadowRoot(a), T = !ke(w, !1) && (!r.shadowRootFilter || r.shadowRootFilter(a));
818
- if (w && T) {
819
- var E = t(w === !0 ? a.children : w.children, !0, r);
820
- r.flatten ? i.push.apply(i, E) : i.push({
821
- scopeParent: a,
822
- candidates: E
823
- });
824
- } else
825
- l.unshift.apply(l, a.children);
826
- }
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);
827
1181
  }
828
- return i;
829
- }, Ct = function(e) {
830
- return !isNaN(parseInt(e.getAttribute("tabindex"), 10));
831
- }, ne = function(e) {
832
- if (!e)
833
- throw new Error("No node provided");
834
- return e.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || bn(e)) && !Ct(e) ? 0 : e.tabIndex;
835
- }, gn = function(e, n) {
836
- var r = ne(e);
837
- return r < 0 && n && !Ct(e) ? 0 : r;
838
- }, yn = function(e, n) {
839
- return e.tabIndex === n.tabIndex ? e.documentOrder - n.documentOrder : e.tabIndex - n.tabIndex;
840
- }, It = function(e) {
841
- return e.tagName === "INPUT";
842
- }, wn = function(e) {
843
- return It(e) && e.type === "hidden";
844
- }, xn = function(e) {
845
- var n = e.tagName === "DETAILS" && Array.prototype.slice.apply(e.children).some(function(r) {
846
- 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);
847
1220
  });
848
- return n;
849
- }, En = function(e, n) {
850
- for (var r = 0; r < e.length; r++)
851
- if (e[r].checked && e[r].form === n)
852
- return e[r];
853
- }, Nn = function(e) {
854
- if (!e.name)
855
- return !0;
856
- var n = e.form || Fe(e), r = function(m) {
857
- return n.querySelectorAll('input[type="radio"][name="' + m + '"]');
858
- }, i;
859
- if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
860
- i = r(window.CSS.escape(e.name));
861
- else
862
- try {
863
- i = r(e.name);
864
- } catch (a) {
865
- 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;
866
- }
867
- var l = En(i, e.form);
868
- return !l || l === e;
869
- }, Tn = function(e) {
870
- return It(e) && e.type === "radio";
871
- }, Sn = function(e) {
872
- return Tn(e) && !Nn(e);
873
- }, On = function(e) {
874
- var n, r = e && Fe(e), i = (n = r) === null || n === void 0 ? void 0 : n.host, l = !1;
875
- if (r && r !== e) {
876
- var a, m, s;
877
- 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; ) {
878
- var p, b, w;
879
- r = Fe(i), i = (p = r) === null || p === void 0 ? void 0 : p.host, l = !!((b = i) !== null && b !== void 0 && (w = b.ownerDocument) !== null && w !== void 0 && w.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);
880
1278
  }
881
- }
882
- return l;
883
- }, lt = function(e) {
884
- var n = e.getBoundingClientRect(), r = n.width, i = n.height;
885
- return r === 0 && i === 0;
886
- }, Fn = function(e, n) {
887
- var r = n.displayCheck, i = n.getShadowRoot;
888
- if (getComputedStyle(e).visibility === "hidden")
889
- return !0;
890
- var l = ie.call(e, "details>summary:first-of-type"), a = l ? e.parentElement : e;
891
- if (ie.call(a, "details:not([open]) *"))
892
- return !0;
893
- if (!r || r === "full" || r === "legacy-full") {
894
- if (typeof i == "function") {
895
- for (var m = e; e; ) {
896
- var s = e.parentElement, p = Fe(e);
897
- if (s && !s.shadowRoot && i(s) === !0)
898
- return lt(e);
899
- e.assignedSlot ? e = e.assignedSlot : !s && p !== e.ownerDocument ? e = p.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;
900
1302
  }
901
- e = m;
902
1303
  }
903
- if (On(e))
904
- return !e.getClientRects().length;
905
- if (r !== "legacy-full")
906
- return !0;
907
- } else if (r === "non-zero-area")
908
- return lt(e);
909
- return !1;
910
- }, kn = function(e) {
911
- if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))
912
- for (var n = e.parentElement; n; ) {
913
- if (n.tagName === "FIELDSET" && n.disabled) {
914
- for (var r = 0; r < n.children.length; r++) {
915
- var i = n.children.item(r);
916
- if (i.tagName === "LEGEND")
917
- 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;
918
1397
  }
919
- return !0;
1398
+ } else if (i.contains(d)) {
1399
+ a.current = d;
1400
+ return;
920
1401
  }
921
- n = n.parentElement;
922
- }
923
- return !1;
924
- }, Ce = function(e, n) {
925
- return !(n.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
926
- // because we're limited in the type of selectors we can use in JSDom (see related
927
- // note related to `candidateSelectors`)
928
- ke(n) || wn(n) || Fn(n, e) || // For a details element with a summary, the summary element gets the focus
929
- xn(n) || kn(n));
930
- }, Ve = function(e, n) {
931
- return !(Sn(n) || ne(n) < 0 || !Ce(e, n));
932
- }, Cn = function(e) {
933
- var n = parseInt(e.getAttribute("tabindex"), 10);
934
- return !!(isNaN(n) || n >= 0);
935
- }, In = function t(e) {
936
- var n = [], r = [];
937
- return e.forEach(function(i, l) {
938
- var a = !!i.scopeParent, m = a ? i.scopeParent : i, s = gn(m, a), p = a ? t(i.candidates) : m;
939
- s === 0 ? a ? n.push.apply(n, p) : n.push(m) : r.push({
940
- documentOrder: l,
941
- tabIndex: s,
942
- item: i,
943
- isScope: a,
944
- content: p
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;
945
1411
  });
946
- }), r.sort(yn).reduce(function(i, l) {
947
- return l.isScope ? i.push.apply(i, l.content) : i.push(l.content), i;
948
- }, []).concat(n);
949
- }, Pn = function(e, n) {
950
- n = n || {};
951
- var r;
952
- return n.getShadowRoot ? r = kt([e], n.includeContainer, {
953
- filter: Ve.bind(null, n),
954
- flatten: !1,
955
- getShadowRoot: n.getShadowRoot,
956
- shadowRootFilter: Cn
957
- }) : r = Ft(e, n.includeContainer, Ve.bind(null, n)), In(r);
958
- }, Rn = function(e, n) {
959
- n = n || {};
960
- var r;
961
- return n.getShadowRoot ? r = kt([e], n.includeContainer, {
962
- filter: Ce.bind(null, n),
963
- flatten: !0,
964
- getShadowRoot: n.getShadowRoot
965
- }) : r = Ft(e, n.includeContainer, Ce.bind(null, n)), r;
966
- }, ue = function(e, n) {
967
- if (n = n || {}, !e)
968
- throw new Error("No node provided");
969
- return ie.call(e, Oe) === !1 ? !1 : Ve(n, e);
970
- }, An = /* @__PURE__ */ St.concat("iframe").join(","), Ke = function(e, n) {
971
- if (n = n || {}, !e)
972
- throw new Error("No node provided");
973
- return ie.call(e, An) === !1 ? !1 : Ce(n, e);
974
- };
975
- let tt = Ie(null);
976
- tt.displayName = "OpenClosedContext";
977
- 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 || {});
978
- function Pt() {
979
- return de(tt);
980
- }
981
- function Mn({ value: t, children: e }) {
982
- return B.createElement(tt.Provider, { value: t }, e);
983
- }
984
- function Ln() {
985
- let t = typeof document > "u";
986
- return "useSyncExternalStore" in pe ? ((e) => e.useSyncExternalStore)(pe)(() => () => {
987
- }, () => !1, () => !t) : !1;
988
- }
989
- function Rt() {
990
- let t = Ln(), [e, n] = pe.useState(Ee.isHandoffComplete);
991
- return e && Ee.isHandoffComplete === !1 && n(!1), pe.useEffect(() => {
992
- e !== !0 && n(!0);
993
- }, [e]), pe.useEffect(() => Ee.handoff(), []), t ? !1 : e;
994
- }
995
- function jn() {
996
- let t = j(!1);
997
- return Q(() => (t.current = !0, () => {
998
- t.current = !1;
999
- }), []), t;
1000
- }
1001
- function At(t) {
1002
- var e;
1003
- 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;
1004
- }
1005
- let je = Ie(null);
1006
- je.displayName = "TransitionContext";
1007
- var Dn = ((t) => (t.Visible = "visible", t.Hidden = "hidden", t))(Dn || {});
1008
- function $n() {
1009
- let t = de(je);
1010
- if (t === null) throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
1011
- return t;
1412
+ }, [l, o, e]), a;
1012
1413
  }
1013
- function Wn() {
1014
- let t = de(De);
1015
- if (t === null) throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
1016
- 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;
1441
+ }
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;
1017
1446
  }
1018
- let De = Ie(null);
1019
- De.displayName = "NestingContext";
1020
- function $e(t) {
1021
- return "children" in t ? $e(t.children) : t.current.filter(({ el: e }) => e.current !== null).filter(({ state: e }) => e === "visible").length > 0;
1022
- }
1023
- function Mt(t, e) {
1024
- let n = wt(t), r = j([]), i = jn(), l = yt(), a = G((E, c = J.Hidden) => {
1025
- let g = r.current.findIndex(({ el: d }) => d === E);
1026
- g !== -1 && (Le(c, { [J.Unmount]() {
1027
- r.current.splice(g, 1);
1028
- }, [J.Hidden]() {
1029
- r.current[g].state = "hidden";
1030
- } }), l.microTask(() => {
1031
- var d;
1032
- !$e(r) && i.current && ((d = n.current) == null || d.call(n));
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));
1033
1462
  }));
1034
- }), m = G((E) => {
1035
- let c = r.current.find(({ el: g }) => g === E);
1036
- return c ? c.state !== "visible" && (c.state = "visible") : r.current.push({ el: E, state: "visible" }), () => a(E, J.Unmount);
1037
- }), s = j([]), p = j(Promise.resolve()), b = j({ enter: [], leave: [] }), w = G((E, c, g) => {
1038
- 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) => {
1039
- s.current.push(d);
1040
- })]), e == null || e.chains.current[c].push([E, new Promise((d) => {
1041
- Promise.all(b.current[c].map(([f, h]) => h)).then(() => d());
1042
- })]), c === "enter" ? p.current = p.current.then(() => e == null ? void 0 : e.wait.current).then(() => g(c)) : g(c);
1043
- }), T = G((E, c, g) => {
1044
- Promise.all(b.current[c].splice(0).map(([d, f]) => f)).then(() => {
1045
- var d;
1046
- (d = s.current.shift()) == null || d();
1047
- }).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));
1048
1477
  });
1049
- return Y(() => ({ children: r, register: m, unregister: a, onStart: w, onStop: T, wait: p, chains: b }), [m, a, r, w, T, b, p]);
1478
+ return C(() => ({ children: r, register: u, unregister: o, onStart: y, onStop: b, wait: d, chains: f }), [u, o, r, y, b, f, d]);
1050
1479
  }
1051
- let Lt = ae, jt = xt.RenderStrategy;
1052
- function Un(t, e) {
1480
+ let ln = G, an = je.RenderStrategy;
1481
+ function Jr(e, t) {
1053
1482
  var n, r;
1054
- let { transition: i = !0, beforeEnter: l, afterEnter: a, beforeLeave: m, afterLeave: s, enter: p, enterFrom: b, enterTo: w, entered: T, leave: E, leaveFrom: c, leaveTo: g, ...d } = t, [f, h] = $(null), y = j(null), N = At(t), v = Tt(...N ? [y, e, h] : e === null ? [] : [e]), I = (n = d.unmount) == null || n ? J.Unmount : J.Hidden, { show: A, appear: H, initial: K } = $n(), [W, U] = $(A ? "visible" : "hidden"), O = Wn(), { register: o, unregister: u } = O;
1055
- Q(() => o(y), [o, y]), Q(() => {
1056
- if (I === J.Hidden && y.current) {
1057
- if (A && W !== "visible") {
1058
- U("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");
1059
1488
  return;
1060
1489
  }
1061
- return Le(W, { hidden: () => u(y), visible: () => o(y) });
1490
+ return ne(N, { hidden: () => P(g), visible: () => X(g) });
1062
1491
  }
1063
- }, [W, y, o, u, A, I]);
1064
- let x = Rt();
1065
- Q(() => {
1066
- if (N && x && W === "visible" && y.current === null) throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
1067
- }, [y, W, x, N]);
1068
- let F = K && !H, k = H && A && K, P = j(!1), S = Mt(() => {
1069
- P.current || (U("hidden"), u(y));
1070
- }, O), R = G((ee) => {
1071
- P.current = !0;
1072
- let Z = ee ? "enter" : "leave";
1073
- S.onStart(y, Z, (ce) => {
1074
- 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());
1075
1504
  });
1076
- }), M = G((ee) => {
1077
- let Z = ee ? "enter" : "leave";
1078
- P.current = !1, S.onStop(y, Z, (ce) => {
1079
- ce === "enter" ? a == null || a() : ce === "leave" && (s == null || s());
1080
- }), Z === "leave" && !$e(S) && (U("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));
1081
1510
  });
1082
- D(() => {
1083
- N && i || (R(A), M(A));
1084
- }, [A, N, i]);
1085
- let z = !(!i || !N || !x || F), [, L] = mn(z, f, A, { start: R, end: M }), X = te({ ref: v, className: ((r = Xe(d.className, k && p, k && b, L.enter && p, L.enter && L.closed && b, L.enter && !L.closed && w, 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) }), _ = 0;
1086
- W === "visible" && (_ |= re.Open), W === "hidden" && (_ |= re.Closed), L.enter && (_ |= re.Opening), L.leave && (_ |= re.Closing);
1087
- let ye = Et();
1088
- return B.createElement(De.Provider, { value: S }, B.createElement(Mn, { value: _ }, ye({ ourProps: X, theirProps: d, defaultTag: Lt, features: jt, visible: W === "visible", name: "Transition.Child" })));
1089
- }
1090
- function Bn(t, e) {
1091
- 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]);
1092
- Rt();
1093
- let p = Pt();
1094
- if (n === void 0 && p !== null && (n = (p & re.Open) === re.Open), n === void 0) throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");
1095
- let [b, w] = $(n ? "visible" : "hidden"), T = Mt(() => {
1096
- n || w("hidden");
1097
- }), [E, c] = $(!0), g = j([n]);
1098
- Q(() => {
1099
- E !== !1 && g.current[g.current.length - 1] !== n && (g.current.push(n), c(!1));
1100
- }, [g, n]);
1101
- let d = Y(() => ({ show: n, appear: r, initial: E }), [n, r, E]);
1102
- Q(() => {
1103
- n ? w("visible") : !$e(T) && a.current !== null && w("hidden");
1104
- }, [n, T]);
1105
- let f = { unmount: i }, h = G(() => {
1106
- var v;
1107
- E && c(!1), (v = t.beforeEnter) == null || v.call(t);
1108
- }), y = G(() => {
1109
- var v;
1110
- E && c(!1), (v = t.beforeLeave) == null || v.call(t);
1111
- }), N = Et();
1112
- 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: h, beforeLeave: y }) }, theirProps: {}, defaultTag: ae, features: jt, visible: b === "visible", name: "Transition" })));
1113
- }
1114
- function Hn(t, e) {
1115
- let n = de(je) !== null, r = Pt() !== null;
1116
- return B.createElement(B.Fragment, null, !n && r ? B.createElement(ze, { ref: e, ...t }) : B.createElement(Dt, { ref: e, ...t }));
1117
- }
1118
- let ze = et(Bn), Dt = et(Un), We = et(Hn), Kn = Object.assign(ze, { Child: We, Root: ze });
1119
- function $t({ onClick: t }) {
1120
- return /* @__PURE__ */ le(
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(() => {
1535
+ var h;
1536
+ w && c(!1), (h = e.beforeEnter) == null || h.call(e);
1537
+ }), g = S(() => {
1538
+ var h;
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" })));
1542
+ }
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 }));
1546
+ }
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(
1121
1624
  "button",
1122
1625
  {
1123
1626
  type: "button",
1124
1627
  className: "im-close-button text-gray-400 hover:text-gray-500",
1125
- onClick: t,
1628
+ onClick: e,
1126
1629
  children: [
1127
- /* @__PURE__ */ C("span", { className: "sr-only", children: "Close" }),
1128
- /* @__PURE__ */ C(
1630
+ /* @__PURE__ */ T("span", { className: "sr-only", children: "Close" }),
1631
+ /* @__PURE__ */ T(
1129
1632
  "svg",
1130
1633
  {
1131
1634
  className: "size-6",
@@ -1135,7 +1638,7 @@ function $t({ onClick: t }) {
1135
1638
  strokeWidth: "2",
1136
1639
  stroke: "currentColor",
1137
1640
  "aria-hidden": "true",
1138
- children: /* @__PURE__ */ C(
1641
+ children: /* @__PURE__ */ T(
1139
1642
  "path",
1140
1643
  {
1141
1644
  strokeLinecap: "round",
@@ -1149,530 +1652,46 @@ function $t({ onClick: t }) {
1149
1652
  }
1150
1653
  );
1151
1654
  }
1152
- /*!
1153
- * focus-trap 7.6.4
1154
- * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
1155
- */
1156
- function Ge(t, e) {
1157
- (e == null || e > t.length) && (e = t.length);
1158
- for (var n = 0, r = Array(e); n < e; n++) r[n] = t[n];
1159
- return r;
1160
- }
1161
- function _n(t) {
1162
- if (Array.isArray(t)) return Ge(t);
1163
- }
1164
- function qn(t, e, n) {
1165
- return (e = Zn(e)) in t ? Object.defineProperty(t, e, {
1166
- value: n,
1167
- enumerable: !0,
1168
- configurable: !0,
1169
- writable: !0
1170
- }) : t[e] = n, t;
1171
- }
1172
- function Xn(t) {
1173
- if (typeof Symbol < "u" && t[Symbol.iterator] != null || t["@@iterator"] != null) return Array.from(t);
1174
- }
1175
- function Vn() {
1176
- throw new TypeError(`Invalid attempt to spread non-iterable instance.
1177
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1178
- }
1179
- function st(t, e) {
1180
- var n = Object.keys(t);
1181
- if (Object.getOwnPropertySymbols) {
1182
- var r = Object.getOwnPropertySymbols(t);
1183
- e && (r = r.filter(function(i) {
1184
- return Object.getOwnPropertyDescriptor(t, i).enumerable;
1185
- })), n.push.apply(n, r);
1186
- }
1187
- return n;
1188
- }
1189
- function ot(t) {
1190
- for (var e = 1; e < arguments.length; e++) {
1191
- var n = arguments[e] != null ? arguments[e] : {};
1192
- e % 2 ? st(Object(n), !0).forEach(function(r) {
1193
- qn(t, r, n[r]);
1194
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : st(Object(n)).forEach(function(r) {
1195
- Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(n, r));
1196
- });
1197
- }
1198
- return t;
1199
- }
1200
- function zn(t) {
1201
- return _n(t) || Xn(t) || Yn(t) || Vn();
1202
- }
1203
- function Gn(t, e) {
1204
- if (typeof t != "object" || !t) return t;
1205
- var n = t[Symbol.toPrimitive];
1206
- if (n !== void 0) {
1207
- var r = n.call(t, e || "default");
1208
- if (typeof r != "object") return r;
1209
- throw new TypeError("@@toPrimitive must return a primitive value.");
1210
- }
1211
- return (e === "string" ? String : Number)(t);
1212
- }
1213
- function Zn(t) {
1214
- var e = Gn(t, "string");
1215
- return typeof e == "symbol" ? e : e + "";
1216
- }
1217
- function Yn(t, e) {
1218
- if (t) {
1219
- if (typeof t == "string") return Ge(t, e);
1220
- var n = {}.toString.call(t).slice(8, -1);
1221
- 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;
1222
- }
1223
- }
1224
- var ut = {
1225
- activateTrap: function(e, n) {
1226
- if (e.length > 0) {
1227
- var r = e[e.length - 1];
1228
- r !== n && r._setPausedState(!0);
1229
- }
1230
- var i = e.indexOf(n);
1231
- i === -1 || e.splice(i, 1), e.push(n);
1232
- },
1233
- deactivateTrap: function(e, n) {
1234
- var r = e.indexOf(n);
1235
- r !== -1 && e.splice(r, 1), e.length > 0 && !e[e.length - 1]._isManuallyPaused() && e[e.length - 1]._setPausedState(!1);
1236
- }
1237
- }, Jn = function(e) {
1238
- return e.tagName && e.tagName.toLowerCase() === "input" && typeof e.select == "function";
1239
- }, Qn = function(e) {
1240
- return (e == null ? void 0 : e.key) === "Escape" || (e == null ? void 0 : e.key) === "Esc" || (e == null ? void 0 : e.keyCode) === 27;
1241
- }, ge = function(e) {
1242
- return (e == null ? void 0 : e.key) === "Tab" || (e == null ? void 0 : e.keyCode) === 9;
1243
- }, er = function(e) {
1244
- return ge(e) && !e.shiftKey;
1245
- }, tr = function(e) {
1246
- return ge(e) && e.shiftKey;
1247
- }, dt = function(e) {
1248
- return setTimeout(e, 0);
1249
- }, he = function(e) {
1250
- for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), i = 1; i < n; i++)
1251
- r[i - 1] = arguments[i];
1252
- return typeof e == "function" ? e.apply(void 0, r) : e;
1253
- }, xe = function(e) {
1254
- return e.target.shadowRoot && typeof e.composedPath == "function" ? e.composedPath()[0] : e.target;
1255
- }, nr = [], rr = function(e, n) {
1256
- var r = (n == null ? void 0 : n.document) || document, i = (n == null ? void 0 : n.trapStack) || nr, l = ot({
1257
- returnFocusOnDeactivate: !0,
1258
- escapeDeactivates: !0,
1259
- delayInitialFocus: !0,
1260
- isKeyForward: er,
1261
- isKeyBackward: tr
1262
- }, n), a = {
1263
- // containers given to createFocusTrap()
1264
- // @type {Array<HTMLElement>}
1265
- containers: [],
1266
- // list of objects identifying tabbable nodes in `containers` in the trap
1267
- // NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap
1268
- // is active, but the trap should never get to a state where there isn't at least one group
1269
- // with at least one tabbable node in it (that would lead to an error condition that would
1270
- // result in an error being thrown)
1271
- // @type {Array<{
1272
- // container: HTMLElement,
1273
- // tabbableNodes: Array<HTMLElement>, // empty if none
1274
- // focusableNodes: Array<HTMLElement>, // empty if none
1275
- // posTabIndexesFound: boolean,
1276
- // firstTabbableNode: HTMLElement|undefined,
1277
- // lastTabbableNode: HTMLElement|undefined,
1278
- // firstDomTabbableNode: HTMLElement|undefined,
1279
- // lastDomTabbableNode: HTMLElement|undefined,
1280
- // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
1281
- // }>}
1282
- containerGroups: [],
1283
- // same order/length as `containers` list
1284
- // references to objects in `containerGroups`, but only those that actually have
1285
- // tabbable nodes in them
1286
- // NOTE: same order as `containers` and `containerGroups`, but __not necessarily__
1287
- // the same length
1288
- tabbableGroups: [],
1289
- nodeFocusedBeforeActivation: null,
1290
- mostRecentlyFocusedNode: null,
1291
- active: !1,
1292
- paused: !1,
1293
- manuallyPaused: !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, x) {
1300
- return o && o[u] !== void 0 ? o[u] : l[x || u];
1301
- }, p = function(o, u) {
1302
- var x = typeof (u == null ? void 0 : u.composedPath) == "function" ? u.composedPath() : void 0;
1303
- return a.containerGroups.findIndex(function(F) {
1304
- var k = F.container, P = F.tabbableNodes;
1305
- return k.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
- (x == null ? void 0 : x.includes(k)) || P.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] : {}, x = u.hasFallback, F = x === void 0 ? !1 : x, k = u.params, P = k === void 0 ? [] : k, S = l[o];
1315
- if (typeof S == "function" && (S = S.apply(void 0, zn(P))), 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 && !F)
1328
- throw new Error("`".concat(o, "` as selector refers to no known node"));
1329
- }
1330
- return R;
1331
- }, w = 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 (p(r.activeElement) >= 0)
1339
- o = r.activeElement;
1340
- else {
1341
- var u = a.tabbableGroups[0], x = u && u.firstTabbableNode;
1342
- o = x || 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 = Pn(o, l.tabbableOptions), x = Rn(o, l.tabbableOptions), F = u.length > 0 ? u[0] : void 0, k = u.length > 0 ? u[u.length - 1] : void 0, P = x.find(function(M) {
1351
- return ue(M);
1352
- }), S = x.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: x,
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: F,
1365
- /** Last tabbable node in container, __tabindex__ order; `undefined` if none. */
1366
- lastTabbableNode: k,
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: P,
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, X = u.indexOf(z);
1388
- return X < 0 ? L ? x.slice(x.indexOf(z) + 1).find(function(_) {
1389
- return ue(_);
1390
- }) : x.slice(0, x.indexOf(z)).reverse().find(function(_) {
1391
- return ue(_);
1392
- }) : u[X + (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(w());
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, x = o.event, F = o.isBackward, k = F === void 0 ? !1 : F;
1424
- u = u || xe(x), T();
1425
- var P = null;
1426
- if (a.tabbableGroups.length > 0) {
1427
- var S = p(u, x), R = S >= 0 ? a.containerGroups[S] : void 0;
1428
- if (S < 0)
1429
- k ? P = a.tabbableGroups[a.tabbableGroups.length - 1].lastTabbableNode : P = a.tabbableGroups[0].firstTabbableNode;
1430
- else if (k) {
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
- P = ne(u) >= 0 ? L.lastTabbableNode : L.lastDomTabbableNode;
1438
- } else ge(x) || (P = R.nextTabbableNode(u, !1));
1439
- } else {
1440
- var X = a.tabbableGroups.findIndex(function(ee) {
1441
- var Z = ee.lastTabbableNode;
1442
- return u === Z;
1443
- });
1444
- if (X < 0 && (R.container === u || Ke(u, l.tabbableOptions) && !ue(u, l.tabbableOptions) && !R.nextTabbableNode(u)) && (X = S), X >= 0) {
1445
- var _ = X === a.tabbableGroups.length - 1 ? 0 : X + 1, ye = a.tabbableGroups[_];
1446
- P = ne(u) >= 0 ? ye.firstTabbableNode : ye.firstDomTabbableNode;
1447
- } else ge(x) || (P = R.nextTabbableNode(u));
1448
- }
1449
- } else
1450
- P = b("fallbackFocus");
1451
- return P;
1452
- }, f = function(o) {
1453
- var u = xe(o);
1454
- if (!(p(u, o) >= 0)) {
1455
- if (he(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
- he(l.allowOutsideClick, o) || o.preventDefault();
1468
- }
1469
- }, h = function(o) {
1470
- var u = xe(o), x = p(u, o) >= 0;
1471
- if (x || u instanceof Document)
1472
- x && (a.mostRecentlyFocusedNode = u);
1473
- else {
1474
- o.stopImmediatePropagation();
1475
- var F, k = !0;
1476
- if (a.mostRecentlyFocusedNode)
1477
- if (ne(a.mostRecentlyFocusedNode) > 0) {
1478
- var P = p(a.mostRecentlyFocusedNode), S = a.containerGroups[P].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 && (F = S[R + 1], k = !1) : R - 1 >= 0 && (F = S[R - 1], k = !1));
1484
- }
1485
- } else
1486
- a.containerGroups.some(function(M) {
1487
- return M.tabbableNodes.some(function(z) {
1488
- return ne(z) > 0;
1489
- });
1490
- }) || (k = !1);
1491
- else
1492
- k = !1;
1493
- k && (F = 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(F || a.mostRecentlyFocusedNode || w());
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 x = d({
1505
- event: o,
1506
- isBackward: u
1507
- });
1508
- x && (ge(o) && o.preventDefault(), c(x));
1509
- }, N = function(o) {
1510
- (l.isKeyForward(o) || l.isKeyBackward(o)) && y(o, l.isKeyBackward(o));
1511
- }, v = function(o) {
1512
- Qn(o) && he(l.escapeDeactivates, o) !== !1 && (o.preventDefault(), m.deactivate());
1513
- }, I = function(o) {
1514
- var u = xe(o);
1515
- p(u, o) >= 0 || he(l.clickOutsideDeactivates, o) || he(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(w());
1520
- }) : c(w()), r.addEventListener("focusin", h, !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", I, {
1527
- capture: !0,
1528
- passive: !1
1529
- }), r.addEventListener("keydown", N, {
1530
- capture: !0,
1531
- passive: !1
1532
- }), r.addEventListener("keydown", v), m;
1533
- }, H = function() {
1534
- if (a.active)
1535
- return r.removeEventListener("focusin", h, !0), r.removeEventListener("mousedown", f, !0), r.removeEventListener("touchstart", f, !0), r.removeEventListener("click", I, !0), r.removeEventListener("keydown", N, !0), r.removeEventListener("keydown", v), m;
1536
- }, K = function(o) {
1537
- var u = o.some(function(x) {
1538
- var F = Array.from(x.removedNodes);
1539
- return F.some(function(k) {
1540
- return k === a.mostRecentlyFocusedNode;
1541
- });
1542
- });
1543
- u && c(w());
1544
- }, W = typeof window < "u" && "MutationObserver" in window ? new MutationObserver(K) : void 0, U = function() {
1545
- W && (W.disconnect(), a.active && !a.paused && a.containers.map(function(o) {
1546
- W.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"), x = s(o, "onPostActivate"), F = s(o, "checkCanFocusTrap");
1563
- F || T(), a.active = !0, a.paused = !1, a.nodeFocusedBeforeActivation = r.activeElement, u == null || u();
1564
- var k = function() {
1565
- F && T(), A(), U(), x == null || x();
1566
- };
1567
- return F ? (F(a.containers.concat()).then(k, k), this) : (k(), 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, U(), ut.deactivateTrap(i, m);
1578
- var x = s(u, "onDeactivate"), F = s(u, "onPostDeactivate"), k = s(u, "checkCanReturnFocus"), P = s(u, "returnFocus", "returnFocusOnDeactivate");
1579
- x == null || x();
1580
- var S = function() {
1581
- dt(function() {
1582
- P && c(g(a.nodeFocusedBeforeActivation)), F == null || F();
1583
- });
1584
- };
1585
- return P && k ? (k(g(a.nodeFocusedBeforeActivation)).then(S, S), this) : (S(), this);
1586
- },
1587
- pause: function(o) {
1588
- return a.active ? (a.manuallyPaused = !0, this._setPausedState(!0, o)) : this;
1589
- },
1590
- unpause: function(o) {
1591
- return a.active ? (a.manuallyPaused = !1, i[i.length - 1] !== this ? this : this._setPausedState(!1, o)) : this;
1592
- },
1593
- updateContainerElements: function(o) {
1594
- var u = [].concat(o).filter(Boolean);
1595
- return a.containers = u.map(function(x) {
1596
- return typeof x == "string" ? r.querySelector(x) : x;
1597
- }), a.active && T(), U(), this;
1598
- }
1599
- }, Object.defineProperties(m, {
1600
- _isManuallyPaused: {
1601
- value: function() {
1602
- return a.manuallyPaused;
1603
- }
1604
- },
1605
- _setPausedState: {
1606
- value: function(o, u) {
1607
- if (a.paused === o)
1608
- return this;
1609
- if (a.paused = o, o) {
1610
- var x = s(u, "onPause"), F = s(u, "onPostPause");
1611
- x == null || x(), H(), U(), F == null || F();
1612
- } else {
1613
- var k = s(u, "onUnpause"), P = s(u, "onPostUnpause");
1614
- k == null || k(), T(), A(), U(), P == null || P();
1615
- }
1616
- return this;
1617
- }
1618
- }
1619
- }), m.updateContainerElements(e), m;
1620
- };
1621
- function Wt(t, e, n) {
1622
- let r = null;
1623
- return t && (r = rr(t, {
1624
- clickOutsideDeactivates: !e,
1625
- escapeDeactivates: !e,
1626
- onDeactivate: () => n == null ? void 0 : n(),
1627
- fallbackFocus: () => t
1628
- }), r.activate()), { deactivate: () => {
1629
- r == null || r.deactivate(), r = null;
1630
- }, wrapper: t };
1631
- }
1632
- const ar = ({ modalContext: t, config: e, children: n }) => {
1633
- const [r, i] = $(!1), l = j(null), [a, m] = $(null);
1634
- function s() {
1635
- m(Wt(l.current, e == null ? void 0 : e.closeExplicitly, () => t.close())), i(!0);
1636
- }
1637
- return D(() => () => a == null ? void 0 : a.deactivate(), [a]), /* @__PURE__ */ C("div", { className: "im-modal-container fixed inset-0 z-40 overflow-y-auto p-4", children: /* @__PURE__ */ C(
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(
1638
1658
  "div",
1639
1659
  {
1640
- className: Se("im-modal-positioner flex min-h-full justify-center", {
1641
- "items-start": e.position === "top",
1642
- "items-center": e.position === "center",
1643
- "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"
1644
1664
  }),
1645
- children: /* @__PURE__ */ C(
1646
- We,
1665
+ children: /* @__PURE__ */ T(
1666
+ me,
1647
1667
  {
1648
1668
  as: "div",
1649
- ref: l,
1650
1669
  enterFrom: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
1651
1670
  enterTo: "opacity-100 translate-y-0 sm:scale-100",
1652
1671
  leaveFrom: "opacity-100 translate-y-0 sm:scale-100",
1653
1672
  leaveTo: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
1654
- afterEnter: s,
1655
- afterLeave: t.afterLeave,
1656
- className: Se("im-modal-wrapper w-full transition duration-300 ease-in-out", t.onTopOfStack ? "" : "blur-sm", {
1657
- "sm:max-w-sm": e.maxWidth === "sm",
1658
- "sm:max-w-md": e.maxWidth === "md",
1659
- "sm:max-w-md md:max-w-lg": e.maxWidth === "lg",
1660
- "sm:max-w-md md:max-w-xl": e.maxWidth === "xl",
1661
- "sm:max-w-md md:max-w-xl lg:max-w-2xl": e.maxWidth === "2xl",
1662
- "sm:max-w-md md:max-w-xl lg:max-w-3xl": e.maxWidth === "3xl",
1663
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl": e.maxWidth === "4xl",
1664
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl": e.maxWidth === "5xl",
1665
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl": e.maxWidth === "6xl",
1666
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl": e.maxWidth === "7xl"
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"
1667
1686
  }),
1668
- children: /* @__PURE__ */ le(
1669
- "div",
1687
+ children: /* @__PURE__ */ ue(
1688
+ yt,
1670
1689
  {
1671
- className: `im-modal-content relative ${e.paddingClasses} ${e.panelClasses}`,
1690
+ className: `im-modal-content relative ${t.paddingClasses} ${t.panelClasses}`,
1672
1691
  "data-inertiaui-modal-entered": r,
1673
1692
  children: [
1674
- e.closeButton && /* @__PURE__ */ C("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ C($t, { onClick: t.close }) }),
1675
- 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
1676
1695
  ]
1677
1696
  }
1678
1697
  )
@@ -1680,49 +1699,45 @@ const ar = ({ modalContext: t, config: e, children: n }) => {
1680
1699
  )
1681
1700
  }
1682
1701
  ) });
1683
- }, ir = ({ modalContext: t, config: e, children: n }) => {
1684
- const [r, i] = $(!1), l = j(null), [a, m] = $(null);
1685
- function s() {
1686
- m(Wt(l.current, e == null ? void 0 : e.closeExplicitly, () => t.close())), i(!0);
1687
- }
1688
- return D(() => () => a == null ? void 0 : a.deactivate(), [a]), /* @__PURE__ */ C("div", { className: "im-slideover-container fixed inset-0 z-40 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ C(
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(
1689
1705
  "div",
1690
1706
  {
1691
- className: Se("im-slideover-positioner flex min-h-full items-center", {
1692
- "justify-start rtl:justify-end": (e == null ? void 0 : e.position) === "left",
1693
- "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"
1694
1710
  }),
1695
- children: /* @__PURE__ */ C(
1696
- We,
1711
+ children: /* @__PURE__ */ T(
1712
+ me,
1697
1713
  {
1698
1714
  as: "div",
1699
- ref: l,
1700
- 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"}`,
1701
1716
  enterTo: "opacity-100 translate-x-0",
1702
1717
  leaveFrom: "opacity-100 translate-x-0",
1703
- leaveTo: `opacity-0 ${e.position === "left" ? "-translate-x-full" : "translate-x-full"}`,
1704
- afterEnter: s,
1705
- afterLeave: t.afterLeave,
1706
- className: Se("im-slideover-wrapper w-full transition duration-300 ease-in-out", t.onTopOfStack ? "" : "blur-sm", {
1707
- "sm:max-w-sm": e.maxWidth === "sm",
1708
- "sm:max-w-md": e.maxWidth === "md",
1709
- "sm:max-w-md md:max-w-lg": e.maxWidth === "lg",
1710
- "sm:max-w-md md:max-w-xl": e.maxWidth === "xl",
1711
- "sm:max-w-md md:max-w-xl lg:max-w-2xl": e.maxWidth === "2xl",
1712
- "sm:max-w-md md:max-w-xl lg:max-w-3xl": e.maxWidth === "3xl",
1713
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl": e.maxWidth === "4xl",
1714
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl": e.maxWidth === "5xl",
1715
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl": e.maxWidth === "6xl",
1716
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl": e.maxWidth === "7xl"
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"
1717
1732
  }),
1718
- children: /* @__PURE__ */ le(
1719
- "div",
1733
+ children: /* @__PURE__ */ ue(
1734
+ yt,
1720
1735
  {
1721
- className: `im-slideover-content relative ${e.paddingClasses} ${e.panelClasses}`,
1736
+ className: `im-slideover-content relative ${t.paddingClasses} ${t.panelClasses}`,
1722
1737
  "data-inertiaui-modal-entered": r,
1723
1738
  children: [
1724
- e.closeButton && /* @__PURE__ */ C("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ C($t, { onClick: t.close }) }),
1725
- 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
1726
1741
  ]
1727
1742
  }
1728
1743
  )
@@ -1730,52 +1745,50 @@ const ar = ({ modalContext: t, config: e, children: n }) => {
1730
1745
  )
1731
1746
  }
1732
1747
  ) });
1733
- }, lr = Ze(({ name: t, children: e, onFocus: n = null, onBlur: r = null, onClose: i = null, onSuccess: l = null, onAfterLeave: a = null, ...m }, s) => {
1734
- const p = (w) => typeof e == "function" ? e(w) : e, b = j(null);
1735
- return D(() => {
1736
- var w;
1737
- if (((w = b == null ? void 0 : b.current) == null ? void 0 : w.index) === 0)
1738
- return nt.prepare(), () => nt.cleanup();
1739
- }, [b]), ct(s, () => b.current, [b]), /* @__PURE__ */ C(
1740
- 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,
1741
1752
  {
1742
- ref: b,
1743
- name: t,
1753
+ ref: f,
1754
+ name: e,
1744
1755
  onFocus: n,
1745
1756
  onBlur: r,
1746
- onClose: i,
1747
- onSuccess: l,
1748
- ...m,
1757
+ onClose: l,
1758
+ onSuccess: a,
1759
+ ...u,
1749
1760
  children: ({
1750
- afterLeave: w,
1751
- close: T,
1752
- config: E,
1761
+ afterLeave: y,
1762
+ close: b,
1763
+ config: w,
1753
1764
  emit: c,
1754
- getChildModal: g,
1755
- getParentModal: d,
1756
- id: f,
1757
- index: h,
1758
- isOpen: y,
1759
- modalContext: N,
1760
- onTopOfStack: v,
1761
- reload: I,
1762
- setOpen: A,
1763
- shouldRender: H
1764
- }) => /* @__PURE__ */ C(
1765
- Kn,
1765
+ getChildModal: v,
1766
+ getParentModal: s,
1767
+ id: m,
1768
+ index: p,
1769
+ isOpen: g,
1770
+ modalContext: x,
1771
+ onTopOfStack: h,
1772
+ reload: $,
1773
+ setOpen: F,
1774
+ shouldRender: j
1775
+ }) => /* @__PURE__ */ T(
1776
+ un,
1766
1777
  {
1767
1778
  appear: !0,
1768
- show: y ?? !1,
1769
- afterLeave: a,
1770
- children: /* @__PURE__ */ le(
1771
- "div",
1779
+ show: g ?? !1,
1780
+ afterLeave: o,
1781
+ children: /* @__PURE__ */ ue(
1782
+ vl,
1772
1783
  {
1784
+ as: "div",
1773
1785
  className: "im-dialog relative z-20",
1774
- "data-inertiaui-modal-id": f,
1775
- "data-inertiaui-modal-index": h,
1786
+ onClose: () => w.closeExplicitly ? null : b(),
1787
+ "data-inertiaui-modal-id": m,
1788
+ "data-inertiaui-modal-index": p,
1776
1789
  children: [
1777
- h === 0 ? /* @__PURE__ */ C(
1778
- We,
1790
+ p === 0 ? /* @__PURE__ */ T(
1791
+ me,
1779
1792
  {
1780
1793
  enter: "transition transform ease-in-out duration-300",
1781
1794
  enterFrom: "opacity-0",
@@ -1783,58 +1796,58 @@ const ar = ({ modalContext: t, config: e, children: n }) => {
1783
1796
  leave: "transition transform ease-in-out duration-300",
1784
1797
  leaveFrom: "opacity-100",
1785
1798
  leaveTo: "opacity-0",
1786
- children: v ? /* @__PURE__ */ C(
1799
+ children: h ? /* @__PURE__ */ T(
1787
1800
  "div",
1788
1801
  {
1789
1802
  className: "im-backdrop fixed inset-0 z-30 bg-black/75",
1790
1803
  "aria-hidden": "true"
1791
1804
  }
1792
- ) : /* @__PURE__ */ C("div", {})
1805
+ ) : /* @__PURE__ */ T("div", {})
1793
1806
  }
1794
1807
  ) : null,
1795
- h > 0 && v ? /* @__PURE__ */ C("div", { className: "im-backdrop fixed inset-0 z-30 bg-black/75" }) : null,
1796
- E.slideover ? /* @__PURE__ */ C(
1797
- 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,
1798
1811
  {
1799
- modalContext: N,
1800
- config: E,
1801
- children: p({
1802
- afterLeave: w,
1803
- close: T,
1804
- config: E,
1812
+ modalContext: x,
1813
+ config: w,
1814
+ children: d({
1815
+ afterLeave: y,
1816
+ close: b,
1817
+ config: w,
1805
1818
  emit: c,
1806
- getChildModal: g,
1807
- getParentModal: d,
1808
- id: f,
1809
- index: h,
1810
- isOpen: y,
1811
- modalContext: N,
1812
- onTopOfStack: v,
1813
- reload: I,
1814
- setOpen: A,
1815
- shouldRender: H
1819
+ getChildModal: v,
1820
+ getParentModal: s,
1821
+ id: m,
1822
+ index: p,
1823
+ isOpen: g,
1824
+ modalContext: x,
1825
+ onTopOfStack: h,
1826
+ reload: $,
1827
+ setOpen: F,
1828
+ shouldRender: j
1816
1829
  })
1817
1830
  }
1818
- ) : /* @__PURE__ */ C(
1819
- ar,
1831
+ ) : /* @__PURE__ */ T(
1832
+ gl,
1820
1833
  {
1821
- modalContext: N,
1822
- config: E,
1823
- children: p({
1824
- afterLeave: w,
1825
- close: T,
1826
- config: E,
1834
+ modalContext: x,
1835
+ config: w,
1836
+ children: d({
1837
+ afterLeave: y,
1838
+ close: b,
1839
+ config: w,
1827
1840
  emit: c,
1828
- getChildModal: g,
1829
- getParentModal: d,
1830
- id: f,
1831
- index: h,
1832
- isOpen: y,
1833
- modalContext: N,
1834
- onTopOfStack: v,
1835
- reload: I,
1836
- setOpen: A,
1837
- shouldRender: H
1841
+ getChildModal: v,
1842
+ getParentModal: s,
1843
+ id: m,
1844
+ index: p,
1845
+ isOpen: g,
1846
+ modalContext: x,
1847
+ onTopOfStack: h,
1848
+ reload: $,
1849
+ setOpen: F,
1850
+ shouldRender: j
1838
1851
  })
1839
1852
  }
1840
1853
  )
@@ -1846,84 +1859,84 @@ const ar = ({ modalContext: t, config: e, children: n }) => {
1846
1859
  }
1847
1860
  );
1848
1861
  });
1849
- lr.displayName = "Modal";
1850
- const br = ({
1851
- href: t,
1852
- method: e = "get",
1862
+ yl.displayName = "Modal";
1863
+ const kl = ({
1864
+ href: e,
1865
+ method: t = "get",
1853
1866
  data: n = {},
1854
1867
  as: r = "a",
1855
- headers: i = {},
1856
- queryStringArrayFormat: l = "brackets",
1857
- onAfterLeave: a = null,
1858
- onBlur: m = null,
1859
- onClose: s = null,
1860
- onError: p = null,
1861
- onFocus: b = null,
1862
- onStart: w = null,
1863
- onSuccess: T = null,
1864
- 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,
1865
1878
  children: c,
1866
- ...g
1879
+ ...v
1867
1880
  }) => {
1868
- const [d, f] = $(!1), [h, y] = $(null), { stack: N, visit: v } = Ae(), I = Y(() => E ?? Je("navigate"), [E]), A = {}, H = {};
1869
- Object.keys(g).forEach((u) => {
1870
- 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]);
1871
1884
  });
1872
- const [K, W] = $(!1);
1873
- D(() => {
1874
- h && (h.onTopOfStack && K ? b == null || b() : !h.onTopOfStack && !K && (m == null || m()), W(!h.onTopOfStack));
1875
- }, [N]);
1876
- const U = V(() => {
1877
- s == null || s();
1878
- }, [s]), O = V(() => {
1879
- y(null), a == null || a();
1880
- }, [a]), o = V(
1881
- (u) => {
1882
- u == null || u.preventDefault(), !d && (t.startsWith("#") || (f(!0), w == null || w()), v(
1883
- 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(
1884
1896
  e,
1897
+ t,
1885
1898
  n,
1886
- i,
1887
- Gt(ft(g, rt)),
1888
- () => U(N.length),
1889
- O,
1890
1899
  l,
1891
- I
1892
- ).then((x) => {
1893
- y(x), x.registerEventListenersFromProps(H), T == null || T();
1894
- }).catch((x) => {
1895
- console.error(x), p == null || p(x);
1896
- }).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)));
1897
1910
  },
1898
- [t, e, n, i, l, g, U, O]
1911
+ [e, t, n, l, a, v, H, B]
1899
1912
  );
1900
- return /* @__PURE__ */ C(
1913
+ return /* @__PURE__ */ T(
1901
1914
  r,
1902
1915
  {
1903
- ...A,
1904
- href: t,
1905
- onClick: o,
1906
- 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
1907
1920
  }
1908
1921
  );
1909
1922
  };
1910
- function gr() {
1911
- return Ae().stack[vt()] ?? null;
1923
+ function Nl() {
1924
+ return Be().stack[Nt()] ?? null;
1912
1925
  }
1913
- 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);
1914
1927
  export {
1915
- bt as HeadlessModal,
1916
- lr as Modal,
1917
- br as ModalLink,
1918
- Qt as ModalRoot,
1919
- Yt as ModalStackProvider,
1920
- Je as getConfig,
1921
- Jt as initFromPageProps,
1922
- hr as putConfig,
1923
- vr as renderApp,
1924
- mr as resetConfig,
1925
- yr as setPageLayout,
1926
- gr as useModal,
1927
- vt as useModalIndex,
1928
- 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
1929
1942
  };