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