@inertiaui/modal-react 0.16.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
- var Or = Object.defineProperty;
2
- var Pr = (e, t, n) => t in e ? Or(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var le = (e, t, n) => Pr(e, typeof t != "symbol" ? t + "" : t, n);
4
- import * as Xe from "react";
5
- import O, { createContext as ae, useState as V, useEffect as L, useContext as Z, useRef as j, createElement as rt, useMemo as B, forwardRef as It, useImperativeHandle as yn, useLayoutEffect as Rr, useCallback as oe, Fragment as se, isValidElement as Sr, cloneElement as Cr, useId as Ge, useSyncExternalStore as $r, useReducer as Fr, createRef as kr } from "react";
6
- import lt from "axios";
7
- import { router as Ve, usePage as jr } from "@inertiajs/react";
8
- import { mergeDataIntoQueryString as _r } from "@inertiajs/core";
9
- import { createPortal as Mr } from "react-dom";
10
- const De = {
1
+ var Wt = Object.defineProperty;
2
+ var Bt = (t, e, n) => e in t ? Wt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var X = (t, e, n) => Bt(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import * as ve from "react";
5
+ import B, { createContext as Pe, useState as $, useEffect as D, useContext as de, useRef as j, createElement as Ne, useMemo as Y, forwardRef as Ze, useImperativeHandle as ct, useLayoutEffect as Ht, useCallback as V, Fragment as ae, isValidElement as Kt, cloneElement as qt } from "react";
6
+ import { jsx as F, jsxs as le, Fragment as Ye } from "react/jsx-runtime";
7
+ import Te from "axios";
8
+ import { router as he, usePage as Xt } from "@inertiajs/react";
9
+ import { mergeDataIntoQueryString as _t } from "@inertiajs/core";
10
+ const fe = {
11
11
  type: "modal",
12
12
  navigate: !1,
13
13
  modal: {
@@ -27,804 +27,208 @@ const De = {
27
27
  position: "right"
28
28
  }
29
29
  };
30
- class Ar {
30
+ class Vt {
31
31
  constructor() {
32
32
  this.config = {}, this.reset();
33
33
  }
34
34
  reset() {
35
- this.config = JSON.parse(JSON.stringify(De));
35
+ this.config = JSON.parse(JSON.stringify(fe));
36
36
  }
37
- put(t, n) {
38
- if (typeof t == "object") {
37
+ put(e, n) {
38
+ if (typeof e == "object") {
39
39
  this.config = {
40
- type: t.type ?? De.type,
41
- navigate: t.navigate ?? De.navigate,
42
- modal: { ...De.modal, ...t.modal ?? {} },
43
- slideover: { ...De.slideover, ...t.slideover ?? {} }
40
+ type: e.type ?? fe.type,
41
+ navigate: e.navigate ?? fe.navigate,
42
+ modal: { ...fe.modal, ...e.modal ?? {} },
43
+ slideover: { ...fe.slideover, ...e.slideover ?? {} }
44
44
  };
45
45
  return;
46
46
  }
47
- const r = t.split(".");
48
- let l = this.config;
49
- for (let o = 0; o < r.length - 1; o++)
50
- l = l[r[o]] = l[r[o]] || {};
51
- l[r[r.length - 1]] = n;
47
+ const r = e.split(".");
48
+ let i = this.config;
49
+ for (let l = 0; l < r.length - 1; l++)
50
+ i = i[r[l]] = i[r[l]] || {};
51
+ i[r[r.length - 1]] = n;
52
52
  }
53
- get(t) {
54
- if (typeof t > "u")
53
+ get(e) {
54
+ if (typeof e > "u")
55
55
  return this.config;
56
- const n = t.split(".");
56
+ const n = e.split(".");
57
57
  let r = this.config;
58
- for (const l of n) {
59
- if (r[l] === void 0)
58
+ for (const i of n) {
59
+ if (r[i] === void 0)
60
60
  return null;
61
- r = r[l];
61
+ r = r[i];
62
62
  }
63
63
  return r;
64
64
  }
65
65
  }
66
- const st = new Ar(), Wa = () => st.reset(), Ua = (e, t) => st.put(e, t), Nt = (e) => st.get(e), Me = (e, t) => st.get(e ? `slideover.${t}` : `modal.${t}`);
67
- var Ct = { exports: {} }, We = {};
68
- /**
69
- * @license React
70
- * react-jsx-runtime.production.min.js
71
- *
72
- * Copyright (c) Facebook, Inc. and its affiliates.
73
- *
74
- * This source code is licensed under the MIT license found in the
75
- * LICENSE file in the root directory of this source tree.
76
- */
77
- var un;
78
- function Lr() {
79
- if (un) return We;
80
- un = 1;
81
- var e = O, t = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, l = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, o = { key: !0, ref: !0, __self: !0, __source: !0 };
82
- function u(s, i, p) {
83
- var c, w = {}, b = null, y = null;
84
- p !== void 0 && (b = "" + p), i.key !== void 0 && (b = "" + i.key), i.ref !== void 0 && (y = i.ref);
85
- for (c in i) r.call(i, c) && !o.hasOwnProperty(c) && (w[c] = i[c]);
86
- if (s && s.defaultProps) for (c in i = s.defaultProps, i) w[c] === void 0 && (w[c] = i[c]);
87
- return { $$typeof: t, type: s, key: b, ref: y, props: w, _owner: l.current };
66
+ const Ie = new Vt(), mr = () => Ie.reset(), pr = (t, e) => Ie.put(t, e), Je = (t) => Ie.get(t), se = (t, e) => Ie.get(t ? `slideover.${e}` : `modal.${e}`), nt = {
67
+ modifiedElements: [],
68
+ bodyState: {
69
+ hasOverflowHidden: !1,
70
+ hasPointerEventsNone: !1,
71
+ originalPaddingRight: ""
72
+ },
73
+ prepare() {
74
+ const t = window.innerWidth - document.documentElement.clientWidth;
75
+ this.bodyState.originalPaddingRight = document.body.style.paddingRight;
76
+ const e = parseInt(window.getComputedStyle(document.body).paddingRight, 10);
77
+ document.body.style.paddingRight = `${e + t}px`, document.body.classList.contains("overflow-hidden") || (document.body.classList.add("overflow-hidden"), this.bodyState.hasOverflowHidden = !0), document.body.classList.contains("pointer-events-none") || (document.body.classList.add("pointer-events-none"), this.bodyState.hasPointerEventsNone = !0), Array.from(document.body.children).forEach((n) => {
78
+ !n.classList.contains("im-dialog") && n.getAttribute("aria-hidden") !== "true" && (n.setAttribute("aria-hidden", "true"), this.modifiedElements.push(n));
79
+ });
80
+ },
81
+ cleanup() {
82
+ this.bodyState.hasOverflowHidden && (document.body.classList.remove("overflow-hidden"), this.bodyState.hasOverflowHidden = !1), this.bodyState.hasPointerEventsNone && (document.body.classList.remove("pointer-events-none"), this.bodyState.hasPointerEventsNone = !1), document.body.style.paddingRight = this.bodyState.originalPaddingRight, this.bodyState.originalPaddingRight = "", this.modifiedElements.forEach((t) => {
83
+ t.removeAttribute("aria-hidden");
84
+ }), this.modifiedElements = [];
88
85
  }
89
- return We.Fragment = n, We.jsx = u, We.jsxs = u, We;
90
- }
91
- var Ue = {};
92
- /**
93
- * @license React
94
- * react-jsx-runtime.development.js
95
- *
96
- * Copyright (c) Facebook, Inc. and its affiliates.
97
- *
98
- * This source code is licensed under the MIT license found in the
99
- * LICENSE file in the root directory of this source tree.
100
- */
101
- var sn;
102
- function Ir() {
103
- return sn || (sn = 1, process.env.NODE_ENV !== "production" && function() {
104
- var e = O, t = Symbol.for("react.element"), n = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), l = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), s = Symbol.for("react.context"), i = Symbol.for("react.forward_ref"), p = Symbol.for("react.suspense"), c = Symbol.for("react.suspense_list"), w = Symbol.for("react.memo"), b = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), g = Symbol.iterator, f = "@@iterator";
105
- function d(a) {
106
- if (a === null || typeof a != "object")
107
- return null;
108
- var h = g && a[g] || a[f];
109
- return typeof h == "function" ? h : null;
110
- }
111
- var m = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
112
- function v(a) {
113
- {
114
- for (var h = arguments.length, E = new Array(h > 1 ? h - 1 : 0), P = 1; P < h; P++)
115
- E[P - 1] = arguments[P];
116
- x("error", a, E);
117
- }
118
- }
119
- function x(a, h, E) {
120
- {
121
- var P = m.ReactDebugCurrentFrame, k = P.getStackAddendum();
122
- k !== "" && (h += "%s", E = E.concat([k]));
123
- var _ = E.map(function(C) {
124
- return String(C);
125
- });
126
- _.unshift("Warning: " + h), Function.prototype.apply.call(console[a], console, _);
127
- }
128
- }
129
- var T = !1, F = !1, X = !1, U = !1, ee = !1, te;
130
- te = Symbol.for("react.module.reference");
131
- function H(a) {
132
- return !!(typeof a == "string" || typeof a == "function" || a === r || a === o || ee || a === l || a === p || a === c || U || a === y || T || F || X || typeof a == "object" && a !== null && (a.$$typeof === b || a.$$typeof === w || a.$$typeof === u || a.$$typeof === s || a.$$typeof === i || // This needs to include all possible module reference object
133
- // types supported by any Flight configuration anywhere since
134
- // we don't know which Flight build this will end up being used
135
- // with.
136
- a.$$typeof === te || a.getModuleId !== void 0));
137
- }
138
- function q(a, h, E) {
139
- var P = a.displayName;
140
- if (P)
141
- return P;
142
- var k = h.displayName || h.name || "";
143
- return k !== "" ? E + "(" + k + ")" : E;
144
- }
145
- function G(a) {
146
- return a.displayName || "Context";
147
- }
148
- function M(a) {
149
- if (a == null)
150
- return null;
151
- if (typeof a.tag == "number" && v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof a == "function")
152
- return a.displayName || a.name || null;
153
- if (typeof a == "string")
154
- return a;
155
- switch (a) {
156
- case r:
157
- return "Fragment";
158
- case n:
159
- return "Portal";
160
- case o:
161
- return "Profiler";
162
- case l:
163
- return "StrictMode";
164
- case p:
165
- return "Suspense";
166
- case c:
167
- return "SuspenseList";
168
- }
169
- if (typeof a == "object")
170
- switch (a.$$typeof) {
171
- case s:
172
- var h = a;
173
- return G(h) + ".Consumer";
174
- case u:
175
- var E = a;
176
- return G(E._context) + ".Provider";
177
- case i:
178
- return q(a, a.render, "ForwardRef");
179
- case w:
180
- var P = a.displayName || null;
181
- return P !== null ? P : M(a.type) || "Memo";
182
- case b: {
183
- var k = a, _ = k._payload, C = k._init;
184
- try {
185
- return M(C(_));
186
- } catch {
187
- return null;
188
- }
189
- }
190
- }
191
- return null;
192
- }
193
- var $ = Object.assign, I = 0, be, xe, he, ne, Ee, N, Te;
194
- function Y() {
195
- }
196
- Y.__reactDisabledLog = !0;
197
- function bt() {
198
- {
199
- if (I === 0) {
200
- be = console.log, xe = console.info, he = console.warn, ne = console.error, Ee = console.group, N = console.groupCollapsed, Te = console.groupEnd;
201
- var a = {
202
- configurable: !0,
203
- enumerable: !0,
204
- value: Y,
205
- writable: !0
206
- };
207
- Object.defineProperties(console, {
208
- info: a,
209
- log: a,
210
- warn: a,
211
- error: a,
212
- group: a,
213
- groupCollapsed: a,
214
- groupEnd: a
215
- });
216
- }
217
- I++;
218
- }
219
- }
220
- function Oe() {
221
- {
222
- if (I--, I === 0) {
223
- var a = {
224
- configurable: !0,
225
- enumerable: !0,
226
- writable: !0
227
- };
228
- Object.defineProperties(console, {
229
- log: $({}, a, {
230
- value: be
231
- }),
232
- info: $({}, a, {
233
- value: xe
234
- }),
235
- warn: $({}, a, {
236
- value: he
237
- }),
238
- error: $({}, a, {
239
- value: ne
240
- }),
241
- group: $({}, a, {
242
- value: Ee
243
- }),
244
- groupCollapsed: $({}, a, {
245
- value: N
246
- }),
247
- groupEnd: $({}, a, {
248
- value: Te
249
- })
250
- });
251
- }
252
- I < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
253
- }
254
- }
255
- var Ie = m.ReactCurrentDispatcher, Pe;
256
- function de(a, h, E) {
257
- {
258
- if (Pe === void 0)
259
- try {
260
- throw Error();
261
- } catch (k) {
262
- var P = k.stack.trim().match(/\n( *(at )?)/);
263
- Pe = P && P[1] || "";
264
- }
265
- return `
266
- ` + Pe + a;
267
- }
268
- }
269
- var fe = !1, Qe;
270
- {
271
- var Qn = typeof WeakMap == "function" ? WeakMap : Map;
272
- Qe = new Qn();
273
- }
274
- function Xt(a, h) {
275
- if (!a || fe)
276
- return "";
277
- {
278
- var E = Qe.get(a);
279
- if (E !== void 0)
280
- return E;
281
- }
282
- var P;
283
- fe = !0;
284
- var k = Error.prepareStackTrace;
285
- Error.prepareStackTrace = void 0;
286
- var _;
287
- _ = Ie.current, Ie.current = null, bt();
288
- try {
289
- if (h) {
290
- var C = function() {
291
- throw Error();
292
- };
293
- if (Object.defineProperty(C.prototype, "props", {
294
- set: function() {
295
- throw Error();
296
- }
297
- }), typeof Reflect == "object" && Reflect.construct) {
298
- try {
299
- Reflect.construct(C, []);
300
- } catch (J) {
301
- P = J;
302
- }
303
- Reflect.construct(a, [], C);
304
- } else {
305
- try {
306
- C.call();
307
- } catch (J) {
308
- P = J;
309
- }
310
- a.call(C.prototype);
311
- }
312
- } else {
313
- try {
314
- throw Error();
315
- } catch (J) {
316
- P = J;
317
- }
318
- a();
319
- }
320
- } catch (J) {
321
- if (J && P && typeof J.stack == "string") {
322
- for (var S = J.stack.split(`
323
- `), K = P.stack.split(`
324
- `), D = S.length - 1, W = K.length - 1; D >= 1 && W >= 0 && S[D] !== K[W]; )
325
- W--;
326
- for (; D >= 1 && W >= 0; D--, W--)
327
- if (S[D] !== K[W]) {
328
- if (D !== 1 || W !== 1)
329
- do
330
- if (D--, W--, W < 0 || S[D] !== K[W]) {
331
- var re = `
332
- ` + S[D].replace(" at new ", " at ");
333
- return a.displayName && re.includes("<anonymous>") && (re = re.replace("<anonymous>", a.displayName)), typeof a == "function" && Qe.set(a, re), re;
334
- }
335
- while (D >= 1 && W >= 0);
336
- break;
337
- }
338
- }
339
- } finally {
340
- fe = !1, Ie.current = _, Oe(), Error.prepareStackTrace = k;
341
- }
342
- var _e = a ? a.displayName || a.name : "", Re = _e ? de(_e) : "";
343
- return typeof a == "function" && Qe.set(a, Re), Re;
344
- }
345
- function er(a, h, E) {
346
- return Xt(a, !1);
347
- }
348
- function tr(a) {
349
- var h = a.prototype;
350
- return !!(h && h.isReactComponent);
351
- }
352
- function et(a, h, E) {
353
- if (a == null)
354
- return "";
355
- if (typeof a == "function")
356
- return Xt(a, tr(a));
357
- if (typeof a == "string")
358
- return de(a);
359
- switch (a) {
360
- case p:
361
- return de("Suspense");
362
- case c:
363
- return de("SuspenseList");
364
- }
365
- if (typeof a == "object")
366
- switch (a.$$typeof) {
367
- case i:
368
- return er(a.render);
369
- case w:
370
- return et(a.type, h, E);
371
- case b: {
372
- var P = a, k = P._payload, _ = P._init;
373
- try {
374
- return et(_(k), h, E);
375
- } catch {
376
- }
377
- }
378
- }
379
- return "";
380
- }
381
- var Ne = Object.prototype.hasOwnProperty, qt = {}, Kt = m.ReactDebugCurrentFrame;
382
- function tt(a) {
383
- if (a) {
384
- var h = a._owner, E = et(a.type, a._source, h ? h.type : null);
385
- Kt.setExtraStackFrame(E);
386
- } else
387
- Kt.setExtraStackFrame(null);
388
- }
389
- function nr(a, h, E, P, k) {
390
- {
391
- var _ = Function.call.bind(Ne);
392
- for (var C in a)
393
- if (_(a, C)) {
394
- var S = void 0;
395
- try {
396
- if (typeof a[C] != "function") {
397
- var K = Error((P || "React class") + ": " + E + " type `" + C + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof a[C] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
398
- throw K.name = "Invariant Violation", K;
399
- }
400
- S = a[C](h, C, P, E, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
401
- } catch (D) {
402
- S = D;
403
- }
404
- S && !(S instanceof Error) && (tt(k), v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", P || "React class", E, C, typeof S), tt(null)), S instanceof Error && !(S.message in qt) && (qt[S.message] = !0, tt(k), v("Failed %s type: %s", E, S.message), tt(null));
405
- }
406
- }
407
- }
408
- var rr = Array.isArray;
409
- function xt(a) {
410
- return rr(a);
411
- }
412
- function lr(a) {
413
- {
414
- var h = typeof Symbol == "function" && Symbol.toStringTag, E = h && a[Symbol.toStringTag] || a.constructor.name || "Object";
415
- return E;
416
- }
417
- }
418
- function ar(a) {
419
- try {
420
- return zt(a), !1;
421
- } catch {
422
- return !0;
423
- }
424
- }
425
- function zt(a) {
426
- return "" + a;
427
- }
428
- function Gt(a) {
429
- if (ar(a))
430
- return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", lr(a)), zt(a);
431
- }
432
- var Jt = m.ReactCurrentOwner, ir = {
433
- key: !0,
434
- ref: !0,
435
- __self: !0,
436
- __source: !0
437
- }, Zt, Qt;
438
- function or(a) {
439
- if (Ne.call(a, "ref")) {
440
- var h = Object.getOwnPropertyDescriptor(a, "ref").get;
441
- if (h && h.isReactWarning)
442
- return !1;
443
- }
444
- return a.ref !== void 0;
445
- }
446
- function ur(a) {
447
- if (Ne.call(a, "key")) {
448
- var h = Object.getOwnPropertyDescriptor(a, "key").get;
449
- if (h && h.isReactWarning)
450
- return !1;
451
- }
452
- return a.key !== void 0;
453
- }
454
- function sr(a, h) {
455
- typeof a.ref == "string" && Jt.current;
456
- }
457
- function cr(a, h) {
458
- {
459
- var E = function() {
460
- Zt || (Zt = !0, v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", h));
461
- };
462
- E.isReactWarning = !0, Object.defineProperty(a, "key", {
463
- get: E,
464
- configurable: !0
465
- });
466
- }
467
- }
468
- function dr(a, h) {
469
- {
470
- var E = function() {
471
- Qt || (Qt = !0, v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", h));
472
- };
473
- E.isReactWarning = !0, Object.defineProperty(a, "ref", {
474
- get: E,
475
- configurable: !0
476
- });
477
- }
478
- }
479
- var fr = function(a, h, E, P, k, _, C) {
480
- var S = {
481
- // This tag allows us to uniquely identify this as a React Element
482
- $$typeof: t,
483
- // Built-in properties that belong on the element
484
- type: a,
485
- key: h,
486
- ref: E,
487
- props: C,
488
- // Record the component responsible for creating this element.
489
- _owner: _
490
- };
491
- return S._store = {}, Object.defineProperty(S._store, "validated", {
492
- configurable: !1,
493
- enumerable: !1,
494
- writable: !0,
495
- value: !1
496
- }), Object.defineProperty(S, "_self", {
497
- configurable: !1,
498
- enumerable: !1,
499
- writable: !1,
500
- value: P
501
- }), Object.defineProperty(S, "_source", {
502
- configurable: !1,
503
- enumerable: !1,
504
- writable: !1,
505
- value: k
506
- }), Object.freeze && (Object.freeze(S.props), Object.freeze(S)), S;
507
- };
508
- function pr(a, h, E, P, k) {
509
- {
510
- var _, C = {}, S = null, K = null;
511
- E !== void 0 && (Gt(E), S = "" + E), ur(h) && (Gt(h.key), S = "" + h.key), or(h) && (K = h.ref, sr(h, k));
512
- for (_ in h)
513
- Ne.call(h, _) && !ir.hasOwnProperty(_) && (C[_] = h[_]);
514
- if (a && a.defaultProps) {
515
- var D = a.defaultProps;
516
- for (_ in D)
517
- C[_] === void 0 && (C[_] = D[_]);
518
- }
519
- if (S || K) {
520
- var W = typeof a == "function" ? a.displayName || a.name || "Unknown" : a;
521
- S && cr(C, W), K && dr(C, W);
522
- }
523
- return fr(a, S, K, k, P, Jt.current, C);
524
- }
525
- }
526
- var Et = m.ReactCurrentOwner, en = m.ReactDebugCurrentFrame;
527
- function je(a) {
528
- if (a) {
529
- var h = a._owner, E = et(a.type, a._source, h ? h.type : null);
530
- en.setExtraStackFrame(E);
531
- } else
532
- en.setExtraStackFrame(null);
533
- }
534
- var Tt;
535
- Tt = !1;
536
- function Ot(a) {
537
- return typeof a == "object" && a !== null && a.$$typeof === t;
538
- }
539
- function tn() {
540
- {
541
- if (Et.current) {
542
- var a = M(Et.current.type);
543
- if (a)
544
- return `
545
-
546
- Check the render method of \`` + a + "`.";
547
- }
548
- return "";
549
- }
550
- }
551
- function mr(a) {
552
- return "";
553
- }
554
- var nn = {};
555
- function hr(a) {
556
- {
557
- var h = tn();
558
- if (!h) {
559
- var E = typeof a == "string" ? a : a.displayName || a.name;
560
- E && (h = `
561
-
562
- Check the top-level render call using <` + E + ">.");
563
- }
564
- return h;
565
- }
566
- }
567
- function rn(a, h) {
568
- {
569
- if (!a._store || a._store.validated || a.key != null)
570
- return;
571
- a._store.validated = !0;
572
- var E = hr(h);
573
- if (nn[E])
574
- return;
575
- nn[E] = !0;
576
- var P = "";
577
- a && a._owner && a._owner !== Et.current && (P = " It was passed a child from " + M(a._owner.type) + "."), je(a), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', E, P), je(null);
578
- }
579
- }
580
- function ln(a, h) {
581
- {
582
- if (typeof a != "object")
583
- return;
584
- if (xt(a))
585
- for (var E = 0; E < a.length; E++) {
586
- var P = a[E];
587
- Ot(P) && rn(P, h);
588
- }
589
- else if (Ot(a))
590
- a._store && (a._store.validated = !0);
591
- else if (a) {
592
- var k = d(a);
593
- if (typeof k == "function" && k !== a.entries)
594
- for (var _ = k.call(a), C; !(C = _.next()).done; )
595
- Ot(C.value) && rn(C.value, h);
596
- }
597
- }
598
- }
599
- function vr(a) {
600
- {
601
- var h = a.type;
602
- if (h == null || typeof h == "string")
603
- return;
604
- var E;
605
- if (typeof h == "function")
606
- E = h.propTypes;
607
- else if (typeof h == "object" && (h.$$typeof === i || // Note: Memo only checks outer props here.
608
- // Inner props are checked in the reconciler.
609
- h.$$typeof === w))
610
- E = h.propTypes;
611
- else
612
- return;
613
- if (E) {
614
- var P = M(h);
615
- nr(E, a.props, "prop", P, a);
616
- } else if (h.PropTypes !== void 0 && !Tt) {
617
- Tt = !0;
618
- var k = M(h);
619
- v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", k || "Unknown");
620
- }
621
- typeof h.getDefaultProps == "function" && !h.getDefaultProps.isReactClassApproved && v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
622
- }
623
- }
624
- function gr(a) {
625
- {
626
- for (var h = Object.keys(a.props), E = 0; E < h.length; E++) {
627
- var P = h[E];
628
- if (P !== "children" && P !== "key") {
629
- je(a), v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", P), je(null);
630
- break;
631
- }
632
- }
633
- a.ref !== null && (je(a), v("Invalid attribute `ref` supplied to `React.Fragment`."), je(null));
634
- }
635
- }
636
- var an = {};
637
- function on(a, h, E, P, k, _) {
638
- {
639
- var C = H(a);
640
- if (!C) {
641
- var S = "";
642
- (a === void 0 || typeof a == "object" && a !== null && Object.keys(a).length === 0) && (S += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
643
- var K = mr();
644
- K ? S += K : S += tn();
645
- var D;
646
- a === null ? D = "null" : xt(a) ? D = "array" : a !== void 0 && a.$$typeof === t ? (D = "<" + (M(a.type) || "Unknown") + " />", S = " Did you accidentally export a JSX literal instead of a component?") : D = typeof a, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", D, S);
647
- }
648
- var W = pr(a, h, E, k, _);
649
- if (W == null)
650
- return W;
651
- if (C) {
652
- var re = h.children;
653
- if (re !== void 0)
654
- if (P)
655
- if (xt(re)) {
656
- for (var _e = 0; _e < re.length; _e++)
657
- ln(re[_e], a);
658
- Object.freeze && Object.freeze(re);
659
- } else
660
- v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
661
- else
662
- ln(re, a);
663
- }
664
- if (Ne.call(h, "key")) {
665
- var Re = M(a), J = Object.keys(h).filter(function(Tr) {
666
- return Tr !== "key";
667
- }), Pt = J.length > 0 ? "{key: someKey, " + J.join(": ..., ") + ": ...}" : "{key: someKey}";
668
- if (!an[Re + Pt]) {
669
- var Er = J.length > 0 ? "{" + J.join(": ..., ") + ": ...}" : "{}";
670
- v(`A props object containing a "key" prop is being spread into JSX:
671
- let props = %s;
672
- <%s {...props} />
673
- React keys must be passed directly to JSX without using spread:
674
- let props = %s;
675
- <%s key={someKey} {...props} />`, Pt, Re, Er, Re), an[Re + Pt] = !0;
676
- }
677
- }
678
- return a === r ? gr(W) : vr(W), W;
679
- }
680
- }
681
- function wr(a, h, E) {
682
- return on(a, h, E, !0);
683
- }
684
- function yr(a, h, E) {
685
- return on(a, h, E, !1);
686
- }
687
- var br = yr, xr = wr;
688
- Ue.Fragment = r, Ue.jsx = br, Ue.jsxs = xr;
689
- }()), Ue;
86
+ };
87
+ function We(t = "inertiaui_modal_") {
88
+ return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `${t}${crypto.randomUUID()}` : `${t}${Date.now().toString(36)}_${Math.random().toString(36).substr(2, 9)}`;
690
89
  }
691
- process.env.NODE_ENV === "production" ? Ct.exports = Lr() : Ct.exports = Ir();
692
- var R = Ct.exports;
693
- function Nr(e, t) {
694
- return Array.isArray(e) ? e.filter((n) => !t.includes(n)) : Object.keys(e).reduce((n, r) => (t.includes(r) || (n[r] = e[r]), n), {});
90
+ function zt(t, e) {
91
+ return Array.isArray(t) ? t.filter((n) => !e.includes(n)) : Object.keys(t).reduce((n, r) => (e.includes(r) || (n[r] = t[r]), n), {});
695
92
  }
696
- function bn(e, t) {
697
- return Array.isArray(e) ? e.filter((n) => t.includes(n)) : t.reduce((n, r) => (r in e && (n[r] = e[r]), n), {});
93
+ function ft(t, e) {
94
+ return Array.isArray(t) ? t.filter((n) => e.includes(n)) : e.reduce((n, r) => (r in t && (n[r] = t[r]), n), {});
698
95
  }
699
- function Dr(e) {
700
- 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), {});
96
+ function Gt(t) {
97
+ return Array.isArray(t) ? t.filter((e) => e !== null) : Object.keys(t).reduce((e, n) => (n in t && t[n] !== null && (e[n] = t[n]), e), {});
701
98
  }
702
- function Wr(e, t = 3, n = 10) {
703
- return new Promise((r, l) => {
704
- const o = e();
705
- if (o) {
706
- r(o);
99
+ function Zt(t, e = 3, n = 10) {
100
+ return new Promise((r, i) => {
101
+ const l = t();
102
+ if (l) {
103
+ r(l);
707
104
  return;
708
105
  }
709
- let u = t * 1e3 / n;
710
- const s = setInterval(() => {
711
- const i = e();
712
- i && (clearInterval(s), r(i)), --u <= 0 && (clearInterval(s), l(new Error("Condition not met in time")));
106
+ let a = e * 1e3 / n;
107
+ const m = setInterval(() => {
108
+ const s = t();
109
+ s && (clearInterval(m), r(s)), --a <= 0 && (clearInterval(m), i(new Error("Condition not met in time")));
713
110
  }, n);
714
111
  });
715
112
  }
716
- function He(e) {
717
- 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) : "";
113
+ function me(t) {
114
+ return t ? (t = t.replace(/_/g, "-"), t = t.replace(/-+/g, "-"), /[A-Z]/.test(t) ? (t = t.replace(/\s+/g, "").replace(/_/g, "").replace(/(?:^|\s|-)+([A-Za-z])/g, (e, n) => n.toUpperCase()), t = t.replace(/(.)(?=[A-Z])/g, "$1-"), t.toLowerCase()) : t) : "";
718
115
  }
719
- const ct = ae(null);
720
- ct.displayName = "ModalStackContext";
721
- let xn = null, En = null, qe = null, $t = null, Ft = [];
722
- const Ur = ({ children: e }) => {
723
- const [t, n] = V([]), [r, l] = V({}), o = (f) => {
116
+ const Re = Pe(null);
117
+ Re.displayName = "ModalStackContext";
118
+ let mt = null, pt = null, be = null, qe = null, Xe = [], oe = {};
119
+ const Yt = ({ children: t }) => {
120
+ const [e, n] = $([]), [r, i] = $({}), l = (g) => {
724
121
  n((d) => {
725
- const m = f([...d]), v = (x) => {
726
- var T;
727
- return m.length < 2 ? !0 : ((T = m.map((F) => ({ id: F.id, shouldRender: F.shouldRender })).reverse().find((F) => F.shouldRender)) == null ? void 0 : T.id) === x;
122
+ const f = g([...d]), p = (y) => {
123
+ var N;
124
+ return f.length < 2 ? !0 : ((N = f.map((h) => ({ id: h.id, shouldRender: h.shouldRender })).reverse().find((h) => h.shouldRender)) == null ? void 0 : N.id) === y;
728
125
  };
729
- return m.forEach((x, T) => {
730
- m[T].onTopOfStack = v(x.id), m[T].getParentModal = () => T < 1 ? null : m.slice(0, T).reverse().find((F) => F.isOpen), m[T].getChildModal = () => T === m.length - 1 ? null : m.slice(T + 1).find((F) => F.isOpen);
731
- }), m;
126
+ return f.forEach((y, N) => {
127
+ f[N].onTopOfStack = p(y.id), f[N].getParentModal = () => N < 1 ? null : f.slice(0, N).reverse().find((h) => h.isOpen), f[N].getChildModal = () => N === f.length - 1 ? null : f.slice(N + 1).find((h) => h.isOpen);
128
+ }), f;
732
129
  });
733
130
  };
734
- L(() => {
735
- Ft = t;
736
- }, [t]);
737
- class u {
738
- constructor(d, m, v, x, T) {
739
- le(this, "update", (d, m, v) => {
740
- o(
741
- (x) => x.map((T) => (T.id === this.id && (T.config = d, T.onCloseCallback = m, T.afterLeaveCallback = v), T))
742
- );
743
- });
744
- le(this, "show", () => {
745
- o(
746
- (d) => d.map((m) => (m.id === this.id && !m.isOpen && (m.isOpen = !0, m.shouldRender = !0), m))
131
+ D(() => {
132
+ Xe = e;
133
+ }, [e]);
134
+ class a {
135
+ constructor(d, f, p, y, N) {
136
+ X(this, "show", () => {
137
+ l(
138
+ (d) => d.map((f) => (f.id === this.id && !f.isOpen && (f.isOpen = !0, f.shouldRender = !0), f))
747
139
  );
748
140
  });
749
- le(this, "setOpen", (d) => {
141
+ X(this, "setOpen", (d) => {
750
142
  d ? this.show() : this.close();
751
143
  });
752
- le(this, "close", () => {
753
- o(
754
- (d) => d.map((m) => {
755
- var v;
756
- return m.id === this.id && m.isOpen && (Object.keys(m.listeners).forEach((x) => {
757
- m.off(x);
758
- }), m.isOpen = !1, (v = m.onCloseCallback) == null || v.call(m)), m;
144
+ X(this, "close", () => {
145
+ l(
146
+ (d) => d.map((f) => {
147
+ var p;
148
+ return f.id === this.id && f.isOpen && (Object.keys(f.listeners).forEach((y) => {
149
+ f.off(y);
150
+ }), f.isOpen = !1, (p = f.onCloseCallback) == null || p.call(f)), f;
759
151
  })
760
152
  );
761
153
  });
762
- le(this, "afterLeave", () => {
763
- this.isOpen || o((d) => {
764
- const m = d.map((v) => {
765
- var x;
766
- return v.id === this.id && !v.isOpen && (v.shouldRender = !1, (x = v.afterLeaveCallback) == null || x.call(v), v.afterLeaveCallback = null), v;
154
+ X(this, "afterLeave", () => {
155
+ this.isOpen || l((d) => {
156
+ const f = d.map((p) => {
157
+ var y;
158
+ return p.id === this.id && !p.isOpen && (p.shouldRender = !1, (y = p.afterLeaveCallback) == null || y.call(p), p.afterLeaveCallback = null), p;
767
159
  });
768
- return this.index === 0 ? [] : m;
160
+ return this.index === 0 ? [] : f;
769
161
  });
770
162
  });
771
- le(this, "on", (d, m) => {
772
- d = He(d), this.listeners[d] = this.listeners[d] ?? [], this.listeners[d].push(m);
163
+ X(this, "on", (d, f) => {
164
+ d = me(d), this.listeners[d] = this.listeners[d] ?? [], this.listeners[d].push(f);
773
165
  });
774
- le(this, "off", (d, m) => {
775
- var v;
776
- d = He(d), m ? this.listeners[d] = ((v = this.listeners[d]) == null ? void 0 : v.filter((x) => x !== m)) ?? [] : delete this.listeners[d];
166
+ X(this, "off", (d, f) => {
167
+ var p;
168
+ d = me(d), f ? this.listeners[d] = ((p = this.listeners[d]) == null ? void 0 : p.filter((y) => y !== f)) ?? [] : delete this.listeners[d];
777
169
  });
778
- le(this, "emit", (d, ...m) => {
779
- var v;
780
- (v = this.listeners[He(d)]) == null || v.forEach((x) => x(...m));
170
+ X(this, "emit", (d, ...f) => {
171
+ var p;
172
+ (p = this.listeners[me(d)]) == null || p.forEach((y) => y(...f));
781
173
  });
782
- le(this, "registerEventListenersFromProps", (d) => {
783
- const m = [];
784
- return Object.keys(d).filter((v) => v.startsWith("on")).forEach((v) => {
785
- const x = He(v).replace(/^on-/, "");
786
- this.on(x, d[v]), m.push(() => this.off(x, d[v]));
787
- }), () => m.forEach((v) => v());
174
+ X(this, "registerEventListenersFromProps", (d) => {
175
+ const f = [];
176
+ return Object.keys(d).filter((p) => p.startsWith("on")).forEach((p) => {
177
+ const y = me(p).replace(/^on-/, "");
178
+ this.on(y, d[p]), f.push(() => this.off(y, d[p]));
179
+ }), () => f.forEach((p) => p());
788
180
  });
789
- le(this, "reload", (d = {}) => {
790
- var v;
791
- let m = Object.keys(this.response.props);
792
- d.only && (m = bn(m, d.only)), d.except && (m = Nr(m, d.except)), (v = this.response) != null && v.url && lt.get(this.response.url, {
181
+ X(this, "reload", (d = {}) => {
182
+ var p;
183
+ let f = Object.keys(this.response.props);
184
+ d.only && (f = ft(f, d.only)), d.except && (f = zt(f, d.except)), (p = this.response) != null && p.url && Te.get(this.response.url, {
793
185
  headers: {
794
186
  Accept: "text/html, application/xhtml+xml",
795
187
  "X-Inertia": !0,
796
188
  "X-Inertia-Partial-Component": this.response.component,
797
189
  "X-Inertia-Version": this.response.version,
798
- "X-Inertia-Partial-Data": m.join(","),
799
- "X-InertiaUI-Modal": !0,
190
+ "X-Inertia-Partial-Data": f.join(","),
191
+ "X-InertiaUI-Modal": We(),
800
192
  "X-InertiaUI-Modal-Use-Router": 0,
801
- "X-InertiaUI-Modal-Base-Url": qe
193
+ "X-InertiaUI-Modal-Base-Url": be
802
194
  }
803
- }).then((x) => {
804
- this.updateProps(x.data.props);
195
+ }).then((y) => {
196
+ this.updateProps(y.data.props);
805
197
  });
806
198
  });
807
- le(this, "updateProps", (d) => {
808
- Object.assign(this.props, d), o((m) => m);
199
+ X(this, "updateProps", (d) => {
200
+ Object.assign(this.props, d), l((f) => f);
809
201
  });
810
- this.id = u.generateId(), this.isOpen = !1, this.shouldRender = !1, this.listeners = {}, this.component = d, this.props = m.props, this.response = m, this.config = v, this.onCloseCallback = x, this.afterLeaveCallback = T, this.index = -1, this.getParentModal = () => null, this.getChildModal = () => null, this.onTopOfStack = !0;
202
+ if (this.id = f.id ?? We(), this.isOpen = !1, this.shouldRender = !1, this.listeners = {}, this.component = d, this.props = f.props, this.response = f, this.config = p ?? {}, this.onCloseCallback = y, this.afterLeaveCallback = N, oe[this.id]) {
203
+ this.config = {
204
+ ...this.config,
205
+ ...oe[this.id].config ?? {}
206
+ };
207
+ const h = oe[this.id].onClose, k = oe[this.id].onAfterLeave;
208
+ h && (this.onCloseCallback = y ? () => {
209
+ y(), h();
210
+ } : h), k && (this.afterLeaveCallback = N ? () => {
211
+ N(), k();
212
+ } : k), delete oe[this.id];
213
+ }
214
+ this.index = -1, this.getParentModal = () => null, this.getChildModal = () => null, this.onTopOfStack = !0;
811
215
  }
812
216
  static generateId() {
813
217
  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)}`;
814
218
  }
815
219
  }
816
- const s = (f, d = {}, m = null, v = null) => En(f.component).then((x) => i(x, f, d, m, v)), i = (f, d, m, v, x) => {
817
- const T = new u(f, d, m, v, x);
818
- return T.index = t.length, o((F) => [...F, T]), T.show(), T;
220
+ const m = (g, d = {}, f = null, p = null) => pt(g.component).then((y) => s(y, g, d, f, p)), s = (g, d, f, p, y) => {
221
+ const N = new a(g, d, f, p, y);
222
+ return N.index = e.length, l((h) => [...h, N]), N.show(), N;
819
223
  };
820
- function p(f, d, m, v) {
821
- if (!r[f])
822
- throw new Error(`The local modal "${f}" has not been registered.`);
823
- const x = i(null, {}, d, m, v);
824
- return x.name = f, r[f].callback(x), x;
224
+ function v(g, d, f, p) {
225
+ if (!r[g])
226
+ throw new Error(`The local modal "${g}" has not been registered.`);
227
+ const y = s(null, {}, d, f, p);
228
+ return y.name = g, r[g].callback(y), y;
825
229
  }
826
- const c = (f, d = {}) => w(
827
- f,
230
+ const b = (g, d = {}) => x(
231
+ g,
828
232
  d.method ?? "get",
829
233
  d.data ?? {},
830
234
  d.headers ?? {},
@@ -832,254 +236,249 @@ const Ur = ({ children: e }) => {
832
236
  d.onClose,
833
237
  d.onAfterLeave,
834
238
  d.queryStringArrayFormat ?? "brackets",
835
- d.navigate ?? Nt("navigate")
836
- ).then((m) => {
837
- const v = d.listeners ?? {};
838
- return Object.keys(v).forEach((x) => {
839
- const T = He(x);
840
- m.on(T, v[x]);
841
- }), m;
842
- }), w = (f, d, m = {}, v = {}, x = {}, T = null, F = null, X = "brackets", U = !1) => new Promise((ee, te) => {
843
- if (f.startsWith("#")) {
844
- ee(p(f.substring(1), x, T, F));
845
- return;
846
- }
847
- const [H, q] = _r(d, f || "", m, X);
848
- let G = U && t.length === 0;
849
- if (t.length === 0 && (qe = typeof window < "u" ? window.location.href : ""), v = {
850
- ...v,
851
- Accept: "text/html, application/xhtml+xml",
852
- "X-Requested-With": "XMLHttpRequest",
853
- "X-Inertia": !0,
854
- "X-Inertia-Version": xn,
855
- "X-InertiaUI-Modal": !0,
856
- "X-InertiaUI-Modal-Use-Router": G ? 1 : 0,
857
- "X-InertiaUI-Modal-Base-Url": qe
858
- }, G)
859
- return $t = null, Ve.visit(H, {
239
+ d.navigate ?? Je("navigate")
240
+ ).then((f) => {
241
+ const p = d.listeners ?? {};
242
+ return Object.keys(p).forEach((y) => {
243
+ const N = me(y);
244
+ f.on(N, p[y]);
245
+ }), f;
246
+ }), x = (g, d, f = {}, p = {}, y = {}, N = null, h = null, k = "brackets", A = !1) => {
247
+ const H = We();
248
+ return new Promise((K, U) => {
249
+ if (g.startsWith("#")) {
250
+ K(v(g.substring(1), y, N, h));
251
+ return;
252
+ }
253
+ const [W, O] = _t(d, g || "", f, k);
254
+ let o = A && e.length === 0;
255
+ if (e.length === 0 && (be = typeof window < "u" ? window.location.href : ""), p = {
256
+ ...p,
257
+ Accept: "text/html, application/xhtml+xml",
258
+ "X-Requested-With": "XMLHttpRequest",
259
+ "X-Inertia": !0,
260
+ "X-Inertia-Version": mt,
261
+ "X-InertiaUI-Modal": H,
262
+ "X-InertiaUI-Modal-Use-Router": o ? 1 : 0,
263
+ "X-InertiaUI-Modal-Base-Url": be
264
+ }, o)
265
+ return qe = null, oe[H] = {
266
+ config: y,
267
+ onClose: N,
268
+ onAfterLeave: h
269
+ }, he.visit(W, {
270
+ method: d,
271
+ data: O,
272
+ headers: p,
273
+ preserveScroll: !0,
274
+ preserveState: !0,
275
+ onError: U,
276
+ onFinish: () => {
277
+ Zt(() => qe).then(K);
278
+ }
279
+ });
280
+ Te({
281
+ url: W,
860
282
  method: d,
861
- data: q,
862
- headers: v,
863
- preserveScroll: !0,
864
- preserveState: !0,
865
- onError: te,
866
- onFinish: () => {
867
- Wr(() => $t).then((M) => {
868
- const $ = M.onCloseCallback, I = M.afterLeaveCallback;
869
- M.update(
870
- x,
871
- () => {
872
- T == null || T(), $ == null || $();
873
- },
874
- () => {
875
- F == null || F(), I == null || I();
876
- }
877
- ), ee(M);
878
- });
879
- }
283
+ data: O,
284
+ headers: p
285
+ }).then((u) => K(m(u.data, y, N, h))).catch((u) => {
286
+ U(u);
880
287
  });
881
- lt({
882
- url: H,
883
- method: d,
884
- data: q,
885
- headers: v
886
- }).then((M) => ee(s(M.data, x, T, F))).catch((M) => {
887
- te(M);
888
288
  });
889
- }), g = {
890
- stack: t,
289
+ }, c = {
290
+ stack: e,
891
291
  localModals: r,
892
- push: i,
893
- pushFromResponseData: s,
292
+ push: s,
293
+ pushFromResponseData: m,
894
294
  closeAll: () => {
895
- Ft.reverse().forEach((f) => f.close());
295
+ Xe.reverse().forEach((g) => g.close());
896
296
  },
897
- reset: () => o(() => []),
898
- visit: w,
899
- visitModal: c,
900
- registerLocalModal: (f, d) => {
901
- l((m) => ({
902
- ...m,
903
- [f]: { name: f, callback: d }
297
+ reset: () => l(() => []),
298
+ visit: x,
299
+ visitModal: b,
300
+ registerLocalModal: (g, d) => {
301
+ i((f) => ({
302
+ ...f,
303
+ [g]: { name: g, callback: d }
904
304
  }));
905
305
  },
906
- removeLocalModal: (f) => {
907
- l((d) => {
908
- const m = { ...d };
909
- return delete m[f], m;
306
+ removeLocalModal: (g) => {
307
+ i((d) => {
308
+ const f = { ...d };
309
+ return delete f[g], f;
910
310
  });
911
311
  }
912
312
  };
913
- return /* @__PURE__ */ R.jsx(ct.Provider, { value: g, children: e });
914
- }, dt = () => {
915
- const e = Z(ct);
916
- if (e === null)
313
+ return /* @__PURE__ */ F(Re.Provider, { value: c, children: t });
314
+ }, Ae = () => {
315
+ const t = de(Re);
316
+ if (t === null)
917
317
  throw new Error("useModalStack must be used within a ModalStackProvider");
918
- return e;
919
- }, cn = ["closeButton", "closeExplicitly", "maxWidth", "paddingClasses", "panelClasses", "position", "slideover"], Hr = (e) => {
920
- e.initialPage && (xn = e.initialPage.version), e.resolveComponent && (En = e.resolveComponent);
921
- }, Ha = (e, t) => {
922
- Hr(t);
923
- const n = ({ Component: r, props: l, key: o }) => {
924
- const u = () => {
925
- const s = rt(r, { key: o, ...l });
926
- return typeof r.layout == "function" ? r.layout(s) : Array.isArray(r.layout) ? r.layout.concat(s).reverse().reduce((p, c) => rt(c, l, p)) : s;
927
- };
928
- return /* @__PURE__ */ R.jsxs(R.Fragment, { children: [
929
- u(),
930
- /* @__PURE__ */ R.jsx(Br, {})
931
- ] });
932
- };
933
- return /* @__PURE__ */ R.jsx(Ur, { children: /* @__PURE__ */ R.jsx(e, { ...t, children: n }) });
934
- }, Br = ({ children: e }) => {
935
- var s;
936
- const t = Z(ct);
318
+ return t;
319
+ }, rt = ["closeButton", "closeExplicitly", "maxWidth", "paddingClasses", "panelClasses", "position", "slideover"], Jt = (t) => {
320
+ t.initialPage && (mt = t.initialPage.version), t.resolveComponent && (pt = t.resolveComponent);
321
+ }, hr = (t, e) => (Jt(e), /* @__PURE__ */ F(Yt, { children: /* @__PURE__ */ F(t, { ...e, children: ({ Component: r, props: i, key: l }) => /* @__PURE__ */ le(Ye, { children: [
322
+ (() => {
323
+ const m = Ne(r, { key: l, ...i });
324
+ return typeof r.layout == "function" ? r.layout(m) : Array.isArray(r.layout) ? r.layout.concat(m).reverse().reduce((v, b) => Ne(b, i, v)) : m;
325
+ })(),
326
+ /* @__PURE__ */ F(Qt, {})
327
+ ] }) }) })), Qt = ({ children: t }) => {
328
+ var m;
329
+ const e = de(Re);
937
330
  let n = !1, r = !1;
938
- L(() => Ve.on("start", () => n = !0), []), L(() => Ve.on("finish", () => n = !1), []), L(
939
- () => Ve.on("navigate", function(i) {
940
- const p = i.detail.page.props._inertiaui_modal;
941
- if (!p) {
942
- r && t.closeAll();
331
+ D(() => he.on("start", () => n = !0), []), D(() => he.on("finish", () => n = !1), []), D(
332
+ () => he.on("navigate", function(s) {
333
+ const v = s.detail.page.props._inertiaui_modal;
334
+ if (!v) {
335
+ r && e.closeAll();
943
336
  return;
944
337
  }
945
- r = p, qe = p.baseUrl, t.pushFromResponseData(p, {}, () => {
946
- if (!p.baseUrl) {
338
+ r = v, be = v.baseUrl, e.pushFromResponseData(v, {}, () => {
339
+ if (!v.baseUrl) {
947
340
  console.error("No base url in modal response data so cannot navigate back");
948
341
  return;
949
342
  }
950
- !n && window.location.href !== p.baseUrl && Ve.visit(p.baseUrl, {
343
+ !n && window.location.href !== v.baseUrl && he.visit(v.baseUrl, {
951
344
  preserveScroll: !0,
952
345
  preserveState: !0
953
346
  });
954
- }).then((c) => {
955
- $t = c;
347
+ }).then((b) => {
348
+ qe = b;
956
349
  });
957
350
  }),
958
351
  []
959
352
  );
960
- const l = (i) => (Ft.length && (i.headers["X-InertiaUI-Modal-Base-Url"] = qe), i);
961
- L(() => (lt.interceptors.request.use(l), () => lt.interceptors.request.eject(l)), []);
962
- const o = jr(), u = j();
963
- return L(() => {
964
- var c, w;
965
- const i = (c = o.props) == null ? void 0 : c._inertiaui_modal, p = u.current;
966
- u.current = i, i && p && i.component === p.component && i.url === p.url && ((w = t.stack[0]) == null || w.updateProps(i.props ?? {}));
967
- }, [(s = o.props) == null ? void 0 : s._inertiaui_modal]), /* @__PURE__ */ R.jsxs(R.Fragment, { children: [
968
- e,
969
- t.stack.length > 0 && /* @__PURE__ */ R.jsx(On, { index: 0 })
353
+ const i = (s) => (Xe.length && (s.headers["X-InertiaUI-Modal-Base-Url"] = be), s);
354
+ D(() => (Te.interceptors.request.use(i), () => Te.interceptors.request.eject(i)), []);
355
+ const l = Xt(), a = j();
356
+ return D(() => {
357
+ var b, x;
358
+ const s = (b = l.props) == null ? void 0 : b._inertiaui_modal, v = a.current;
359
+ a.current = s, s && v && s.component === v.component && s.url === v.url && ((x = e.stack[0]) == null || x.updateProps(s.props ?? {}));
360
+ }, [(m = l.props) == null ? void 0 : m._inertiaui_modal]), /* @__PURE__ */ le(Ye, { children: [
361
+ t,
362
+ e.stack.length > 0 && /* @__PURE__ */ F(vt, { index: 0 })
970
363
  ] });
971
- }, Dt = O.createContext(null);
972
- Dt.displayName = "ModalIndexContext";
973
- const Tn = () => {
974
- const e = O.useContext(Dt);
975
- if (e === void 0)
364
+ }, Qe = B.createContext(null);
365
+ Qe.displayName = "ModalIndexContext";
366
+ const ht = () => {
367
+ const t = B.useContext(Qe);
368
+ if (t === void 0)
976
369
  throw new Error("useModalIndex must be used within a ModalIndexProvider");
977
- return e;
978
- }, On = ({ index: e }) => {
979
- const { stack: t } = dt(), n = B(() => t[e], [t, e]);
980
- return (n == null ? void 0 : n.component) && /* @__PURE__ */ R.jsx(Dt.Provider, { value: e, children: /* @__PURE__ */ R.jsx(
370
+ return t;
371
+ }, vt = ({ index: t }) => {
372
+ const { stack: e } = Ae(), n = Y(() => e[t], [e, t]);
373
+ return (n == null ? void 0 : n.component) && /* @__PURE__ */ F(Qe.Provider, { value: t, children: /* @__PURE__ */ F(
981
374
  n.component,
982
375
  {
983
376
  ...n.props,
984
377
  onModalEvent: (...r) => n.emit(...r)
985
378
  }
986
379
  ) });
987
- }, Pn = It(({ name: e, children: t, ...n }, r) => {
988
- const l = Tn(), { stack: o, registerLocalModal: u, removeLocalModal: s } = dt(), [i, p] = V(null), c = B(() => e ? i : o[l], [e, i, l, o]), w = B(() => {
989
- var f;
990
- return (f = o.find((d) => d.shouldRender && d.index > (c == null ? void 0 : c.index))) == null ? void 0 : f.index;
991
- }, [l, o]), b = B(() => (c == null ? void 0 : c.config.slideover) ?? n.slideover ?? Nt("type") === "slideover", [n.slideover]), y = B(
380
+ }, bt = Ze(({ name: t, children: e, onFocus: n = null, onBlur: r = null, onClose: i = null, onSuccess: l = null, ...a }, m) => {
381
+ const s = ht(), { stack: v, registerLocalModal: b, removeLocalModal: x } = Ae(), [T, E] = $(null), c = Y(() => t ? T : v[s], [t, T, s, v]), g = Y(() => {
382
+ var h;
383
+ return (h = v.find((k) => k.shouldRender && k.index > (c == null ? void 0 : c.index))) == null ? void 0 : h.index;
384
+ }, [s, v]), d = Y(() => (c == null ? void 0 : c.config.slideover) ?? a.slideover ?? Je("type") === "slideover", [a.slideover]), f = Y(
992
385
  () => ({
993
- slideover: b,
994
- closeButton: n.closeButton ?? Me(b, "closeButton"),
995
- closeExplicitly: n.closeExplicitly ?? Me(b, "closeExplicitly"),
996
- maxWidth: n.maxWidth ?? Me(b, "maxWidth"),
997
- paddingClasses: n.paddingClasses ?? Me(b, "paddingClasses"),
998
- panelClasses: n.panelClasses ?? Me(b, "panelClasses"),
999
- position: n.position ?? Me(b, "position"),
386
+ slideover: d,
387
+ closeButton: a.closeButton ?? se(d, "closeButton"),
388
+ closeExplicitly: a.closeExplicitly ?? se(d, "closeExplicitly"),
389
+ maxWidth: a.maxWidth ?? se(d, "maxWidth"),
390
+ paddingClasses: a.paddingClasses ?? se(d, "paddingClasses"),
391
+ panelClasses: a.panelClasses ?? se(d, "panelClasses"),
392
+ position: a.position ?? se(d, "position"),
1000
393
  ...c == null ? void 0 : c.config
1001
394
  }),
1002
- [n, c == null ? void 0 : c.config]
395
+ [a, c == null ? void 0 : c.config]
1003
396
  );
1004
- L(() => {
1005
- if (e) {
1006
- let f = null;
1007
- return u(e, (d) => {
1008
- f = d.registerEventListenersFromProps(n), p(d);
397
+ D(() => {
398
+ if (t) {
399
+ let h = null;
400
+ return b(t, (k) => {
401
+ h = k.registerEventListenersFromProps(a), E(k);
1009
402
  }), () => {
1010
- f == null || f(), f = null, s(e);
403
+ h == null || h(), h = null, x(t);
1011
404
  };
1012
405
  }
1013
- return c.registerEventListenersFromProps(n);
1014
- }, [e]);
1015
- const g = j(c);
1016
- return L(() => {
1017
- g.current = c;
1018
- }, [c]), yn(
1019
- r,
406
+ return c.registerEventListenersFromProps(a);
407
+ }, [t]);
408
+ const p = j(c);
409
+ D(() => {
410
+ p.current = c;
411
+ }, [c]), D(() => {
412
+ c !== null && (c.isOpen ? l == null || l() : i == null || i());
413
+ }, [c == null ? void 0 : c.isOpen]);
414
+ const [y, N] = $(!1);
415
+ return D(() => {
416
+ y && c !== null && c.isOpen && (c.onTopOfStack ? n == null || n() : r == null || r()), N(!0);
417
+ }, [c == null ? void 0 : c.onTopOfStack]), ct(
418
+ m,
1020
419
  () => ({
1021
420
  afterLeave: () => {
1022
- var f;
1023
- return (f = g.current) == null ? void 0 : f.afterLeave();
421
+ var h;
422
+ return (h = p.current) == null ? void 0 : h.afterLeave();
1024
423
  },
1025
424
  close: () => {
1026
- var f;
1027
- return (f = g.current) == null ? void 0 : f.close();
425
+ var h;
426
+ return (h = p.current) == null ? void 0 : h.close();
1028
427
  },
1029
- emit: (...f) => {
1030
- var d;
1031
- return (d = g.current) == null ? void 0 : d.emit(...f);
428
+ emit: (...h) => {
429
+ var k;
430
+ return (k = p.current) == null ? void 0 : k.emit(...h);
1032
431
  },
1033
432
  getChildModal: () => {
1034
- var f;
1035
- return (f = g.current) == null ? void 0 : f.getChildModal();
433
+ var h;
434
+ return (h = p.current) == null ? void 0 : h.getChildModal();
1036
435
  },
1037
436
  getParentModal: () => {
1038
- var f;
1039
- return (f = g.current) == null ? void 0 : f.getParentModal();
437
+ var h;
438
+ return (h = p.current) == null ? void 0 : h.getParentModal();
1040
439
  },
1041
- reload: (...f) => {
1042
- var d;
1043
- return (d = g.current) == null ? void 0 : d.reload(...f);
440
+ reload: (...h) => {
441
+ var k;
442
+ return (k = p.current) == null ? void 0 : k.reload(...h);
1044
443
  },
1045
444
  setOpen: () => {
1046
- var f;
1047
- return (f = g.current) == null ? void 0 : f.setOpen();
445
+ var h;
446
+ return (h = p.current) == null ? void 0 : h.setOpen();
1048
447
  },
1049
448
  get id() {
1050
- var f;
1051
- return (f = g.current) == null ? void 0 : f.id;
449
+ var h;
450
+ return (h = p.current) == null ? void 0 : h.id;
1052
451
  },
1053
452
  get index() {
1054
- var f;
1055
- return (f = g.current) == null ? void 0 : f.index;
453
+ var h;
454
+ return (h = p.current) == null ? void 0 : h.index;
1056
455
  },
1057
456
  get isOpen() {
1058
- var f;
1059
- return (f = g.current) == null ? void 0 : f.isOpen;
457
+ var h;
458
+ return (h = p.current) == null ? void 0 : h.isOpen;
1060
459
  },
1061
460
  get config() {
1062
- var f;
1063
- return (f = g.current) == null ? void 0 : f.config;
461
+ var h;
462
+ return (h = p.current) == null ? void 0 : h.config;
1064
463
  },
1065
464
  get modalContext() {
1066
- return g.current;
465
+ return p.current;
1067
466
  },
1068
467
  get onTopOfStack() {
1069
- var f;
1070
- return (f = g.current) == null ? void 0 : f.onTopOfStack;
468
+ var h;
469
+ return (h = p.current) == null ? void 0 : h.onTopOfStack;
1071
470
  },
1072
471
  get shouldRender() {
1073
- var f;
1074
- return (f = g.current) == null ? void 0 : f.shouldRender;
472
+ var h;
473
+ return (h = p.current) == null ? void 0 : h.shouldRender;
1075
474
  }
1076
475
  }),
1077
476
  [c]
1078
- ), (c == null ? void 0 : c.shouldRender) && /* @__PURE__ */ R.jsxs(R.Fragment, { children: [
1079
- typeof t == "function" ? t({
477
+ ), (c == null ? void 0 : c.shouldRender) && /* @__PURE__ */ le(Ye, { children: [
478
+ typeof e == "function" ? e({
1080
479
  afterLeave: c.afterLeave,
1081
480
  close: c.close,
1082
- config: y,
481
+ config: f,
1083
482
  emit: c.emit,
1084
483
  getChildModal: c.getChildModal,
1085
484
  getParentModal: c.getParentModal,
@@ -1091,31 +490,31 @@ const Tn = () => {
1091
490
  reload: c.reload,
1092
491
  setOpen: c.setOpen,
1093
492
  shouldRender: c.shouldRender
1094
- }) : t,
1095
- w && /* @__PURE__ */ R.jsx(On, { index: w })
493
+ }) : e,
494
+ g && /* @__PURE__ */ F(vt, { index: g })
1096
495
  ] });
1097
496
  });
1098
- Pn.displayName = "HeadlessModal";
1099
- function Rn(e) {
1100
- var t, n, r = "";
1101
- if (typeof e == "string" || typeof e == "number") r += e;
1102
- else if (typeof e == "object") if (Array.isArray(e)) {
1103
- var l = e.length;
1104
- for (t = 0; t < l; t++) e[t] && (n = Rn(e[t])) && (r && (r += " "), r += n);
1105
- } else for (n in e) e[n] && (r && (r += " "), r += n);
497
+ bt.displayName = "HeadlessModal";
498
+ function gt(t) {
499
+ var e, n, r = "";
500
+ if (typeof t == "string" || typeof t == "number") r += t;
501
+ else if (typeof t == "object") if (Array.isArray(t)) {
502
+ var i = t.length;
503
+ for (e = 0; e < i; e++) t[e] && (n = gt(t[e])) && (r && (r += " "), r += n);
504
+ } else for (n in t) t[n] && (r && (r += " "), r += n);
1106
505
  return r;
1107
506
  }
1108
- function at() {
1109
- for (var e, t, n = 0, r = "", l = arguments.length; n < l; n++) (e = arguments[n]) && (t = Rn(e)) && (r && (r += " "), r += t);
507
+ function Se() {
508
+ for (var t, e, n = 0, r = "", i = arguments.length; n < i; n++) (t = arguments[n]) && (e = gt(t)) && (r && (r += " "), r += e);
1110
509
  return r;
1111
510
  }
1112
- var Vr = Object.defineProperty, Yr = (e, t, n) => t in e ? Vr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Rt = (e, t, n) => (Yr(e, typeof t != "symbol" ? t + "" : t, n), n);
1113
- let Xr = class {
511
+ var en = Object.defineProperty, tn = (t, e, n) => e in t ? en(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, Be = (t, e, n) => (tn(t, typeof e != "symbol" ? e + "" : e, n), n);
512
+ let nn = class {
1114
513
  constructor() {
1115
- Rt(this, "current", this.detect()), Rt(this, "handoffState", "pending"), Rt(this, "currentId", 0);
514
+ Be(this, "current", this.detect()), Be(this, "handoffState", "pending"), Be(this, "currentId", 0);
1116
515
  }
1117
- set(t) {
1118
- this.current !== t && (this.handoffState = "pending", this.currentId = 0, this.current = t);
516
+ set(e) {
517
+ this.current !== e && (this.handoffState = "pending", this.currentId = 0, this.current = e);
1119
518
  }
1120
519
  reset() {
1121
520
  this.set(this.detect());
@@ -1138,1117 +537,596 @@ let Xr = class {
1138
537
  get isHandoffComplete() {
1139
538
  return this.handoffState === "complete";
1140
539
  }
1141
- }, Fe = new Xr();
1142
- function ft(e) {
1143
- return Fe.isServer ? null : e instanceof Node ? e.ownerDocument : e != null && e.hasOwnProperty("current") && e.current instanceof Node ? e.current.ownerDocument : document;
1144
- }
1145
- function pt(e) {
1146
- typeof queueMicrotask == "function" ? queueMicrotask(e) : Promise.resolve().then(e).catch((t) => setTimeout(() => {
1147
- throw t;
540
+ }, Ee = new nn();
541
+ function rn(t) {
542
+ typeof queueMicrotask == "function" ? queueMicrotask(t) : Promise.resolve().then(t).catch((e) => setTimeout(() => {
543
+ throw e;
1148
544
  }));
1149
545
  }
1150
- function ye() {
1151
- let e = [], t = { addEventListener(n, r, l, o) {
1152
- return n.addEventListener(r, l, o), t.add(() => n.removeEventListener(r, l, o));
546
+ function Me() {
547
+ let t = [], e = { addEventListener(n, r, i, l) {
548
+ return n.addEventListener(r, i, l), e.add(() => n.removeEventListener(r, i, l));
1153
549
  }, requestAnimationFrame(...n) {
1154
550
  let r = requestAnimationFrame(...n);
1155
- return t.add(() => cancelAnimationFrame(r));
551
+ return e.add(() => cancelAnimationFrame(r));
1156
552
  }, nextFrame(...n) {
1157
- return t.requestAnimationFrame(() => t.requestAnimationFrame(...n));
553
+ return e.requestAnimationFrame(() => e.requestAnimationFrame(...n));
1158
554
  }, setTimeout(...n) {
1159
555
  let r = setTimeout(...n);
1160
- return t.add(() => clearTimeout(r));
556
+ return e.add(() => clearTimeout(r));
1161
557
  }, microTask(...n) {
1162
558
  let r = { current: !0 };
1163
- return pt(() => {
559
+ return rn(() => {
1164
560
  r.current && n[0]();
1165
- }), t.add(() => {
561
+ }), e.add(() => {
1166
562
  r.current = !1;
1167
563
  });
1168
- }, style(n, r, l) {
1169
- let o = n.style.getPropertyValue(r);
1170
- return Object.assign(n.style, { [r]: l }), this.add(() => {
1171
- Object.assign(n.style, { [r]: o });
564
+ }, style(n, r, i) {
565
+ let l = n.style.getPropertyValue(r);
566
+ return Object.assign(n.style, { [r]: i }), this.add(() => {
567
+ Object.assign(n.style, { [r]: l });
1172
568
  });
1173
569
  }, group(n) {
1174
- let r = ye();
570
+ let r = Me();
1175
571
  return n(r), this.add(() => r.dispose());
1176
572
  }, add(n) {
1177
- return e.includes(n) || e.push(n), () => {
1178
- let r = e.indexOf(n);
1179
- if (r >= 0) for (let l of e.splice(r, 1)) l();
573
+ return t.includes(n) || t.push(n), () => {
574
+ let r = t.indexOf(n);
575
+ if (r >= 0) for (let i of t.splice(r, 1)) i();
1180
576
  };
1181
577
  }, dispose() {
1182
- for (let n of e.splice(0)) n();
578
+ for (let n of t.splice(0)) n();
1183
579
  } };
1184
- return t;
580
+ return e;
1185
581
  }
1186
- function Wt() {
1187
- let [e] = V(ye);
1188
- return L(() => () => e.dispose(), [e]), e;
582
+ function yt() {
583
+ let [t] = $(Me);
584
+ return D(() => () => t.dispose(), [t]), t;
1189
585
  }
1190
- let z = (e, t) => {
1191
- Fe.isServer ? L(e, t) : Rr(e, t);
586
+ let Q = (t, e) => {
587
+ Ee.isServer ? D(t, e) : Ht(t, e);
1192
588
  };
1193
- function ke(e) {
1194
- let t = j(e);
1195
- return z(() => {
1196
- t.current = e;
1197
- }, [e]), t;
1198
- }
1199
- let A = function(e) {
1200
- let t = ke(e);
1201
- return O.useCallback((...n) => t.current(...n), [t]);
1202
- }, qr = ae(void 0);
1203
- function Kr() {
1204
- return Z(qr);
1205
- }
1206
- function kt(...e) {
1207
- return Array.from(new Set(e.flatMap((t) => typeof t == "string" ? t.split(" ") : []))).filter(Boolean).join(" ");
589
+ function wt(t) {
590
+ let e = j(t);
591
+ return Q(() => {
592
+ e.current = t;
593
+ }, [t]), e;
594
+ }
595
+ let G = function(t) {
596
+ let e = wt(t);
597
+ return B.useCallback((...n) => e.current(...n), [e]);
598
+ };
599
+ function _e(...t) {
600
+ return Array.from(new Set(t.flatMap((e) => typeof e == "string" ? e.split(" ") : []))).filter(Boolean).join(" ");
1208
601
  }
1209
- function we(e, t, ...n) {
1210
- if (e in t) {
1211
- let l = t[e];
1212
- return typeof l == "function" ? l(...n) : l;
602
+ function Le(t, e, ...n) {
603
+ if (t in e) {
604
+ let i = e[t];
605
+ return typeof i == "function" ? i(...n) : i;
1213
606
  }
1214
- let r = new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map((l) => `"${l}"`).join(", ")}.`);
1215
- throw Error.captureStackTrace && Error.captureStackTrace(r, we), r;
1216
- }
1217
- var it = ((e) => (e[e.None = 0] = "None", e[e.RenderStrategy = 1] = "RenderStrategy", e[e.Static = 2] = "Static", e))(it || {}), ge = ((e) => (e[e.Unmount = 0] = "Unmount", e[e.Hidden = 1] = "Hidden", e))(ge || {});
1218
- function ie() {
1219
- let e = Gr();
1220
- return oe((t) => zr({ mergeRefs: e, ...t }), [e]);
1221
- }
1222
- function zr({ ourProps: e, theirProps: t, slot: n, defaultTag: r, features: l, visible: o = !0, name: u, mergeRefs: s }) {
1223
- s = s ?? Jr;
1224
- let i = Sn(t, e);
1225
- if (o) return nt(i, n, r, u, s);
1226
- let p = l ?? 0;
1227
- if (p & 2) {
1228
- let { static: c = !1, ...w } = i;
1229
- if (c) return nt(w, n, r, u, s);
607
+ let r = new Error(`Tried to handle "${t}" but there is no handler defined. Only defined handlers are: ${Object.keys(e).map((i) => `"${i}"`).join(", ")}.`);
608
+ throw Error.captureStackTrace && Error.captureStackTrace(r, Le), r;
609
+ }
610
+ var xt = ((t) => (t[t.None = 0] = "None", t[t.RenderStrategy = 1] = "RenderStrategy", t[t.Static = 2] = "Static", t))(xt || {}), J = ((t) => (t[t.Unmount = 0] = "Unmount", t[t.Hidden = 1] = "Hidden", t))(J || {});
611
+ function Et() {
612
+ let t = ln();
613
+ return V((e) => an({ mergeRefs: t, ...e }), [t]);
614
+ }
615
+ function an({ ourProps: t, theirProps: e, slot: n, defaultTag: r, features: i, visible: l = !0, name: a, mergeRefs: m }) {
616
+ m = m ?? sn;
617
+ let s = Nt(e, t);
618
+ if (l) return we(s, n, r, a, m);
619
+ let v = i ?? 0;
620
+ if (v & 2) {
621
+ let { static: b = !1, ...x } = s;
622
+ if (b) return we(x, n, r, a, m);
1230
623
  }
1231
- if (p & 1) {
1232
- let { unmount: c = !0, ...w } = i;
1233
- return we(c ? 0 : 1, { 0() {
624
+ if (v & 1) {
625
+ let { unmount: b = !0, ...x } = s;
626
+ return Le(b ? 0 : 1, { 0() {
1234
627
  return null;
1235
628
  }, 1() {
1236
- return nt({ ...w, hidden: !0, style: { display: "none" } }, n, r, u, s);
629
+ return we({ ...x, hidden: !0, style: { display: "none" } }, n, r, a, m);
1237
630
  } });
1238
631
  }
1239
- return nt(i, n, r, u, s);
1240
- }
1241
- function nt(e, t = {}, n, r, l) {
1242
- let { as: o = n, children: u, refName: s = "ref", ...i } = St(e, ["unmount", "static"]), p = e.ref !== void 0 ? { [s]: e.ref } : {}, c = typeof u == "function" ? u(t) : u;
1243
- "className" in i && i.className && typeof i.className == "function" && (i.className = i.className(t)), i["aria-labelledby"] && i["aria-labelledby"] === i.id && (i["aria-labelledby"] = void 0);
1244
- let w = {};
1245
- if (t) {
1246
- let b = !1, y = [];
1247
- for (let [g, f] of Object.entries(t)) typeof f == "boolean" && (b = !0), f === !0 && y.push(g.replace(/([A-Z])/g, (d) => `-${d.toLowerCase()}`));
1248
- if (b) {
1249
- w["data-headlessui-state"] = y.join(" ");
1250
- for (let g of y) w[`data-${g}`] = "";
632
+ return we(s, n, r, a, m);
633
+ }
634
+ function we(t, e = {}, n, r, i) {
635
+ let { as: l = n, children: a, refName: m = "ref", ...s } = He(t, ["unmount", "static"]), v = t.ref !== void 0 ? { [m]: t.ref } : {}, b = typeof a == "function" ? a(e) : a;
636
+ "className" in s && s.className && typeof s.className == "function" && (s.className = s.className(e)), s["aria-labelledby"] && s["aria-labelledby"] === s.id && (s["aria-labelledby"] = void 0);
637
+ let x = {};
638
+ if (e) {
639
+ let T = !1, E = [];
640
+ for (let [c, g] of Object.entries(e)) typeof g == "boolean" && (T = !0), g === !0 && E.push(c.replace(/([A-Z])/g, (d) => `-${d.toLowerCase()}`));
641
+ if (T) {
642
+ x["data-headlessui-state"] = E.join(" ");
643
+ for (let c of E) x[`data-${c}`] = "";
1251
644
  }
1252
645
  }
1253
- if (o === se && (Object.keys(Se(i)).length > 0 || Object.keys(Se(w)).length > 0)) if (!Sr(c) || Array.isArray(c) && c.length > 1) {
1254
- if (Object.keys(Se(i)).length > 0) throw new Error(['Passing props on "Fragment"!', "", `The current component <${r} /> is rendering a "Fragment".`, "However we need to passthrough the following props:", Object.keys(Se(i)).concat(Object.keys(Se(w))).map((b) => ` - ${b}`).join(`
1255
- `), "", "You can apply a few solutions:", ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".', "Render a single element as the child so that we can forward the props onto that element."].map((b) => ` - ${b}`).join(`
646
+ if (l === ae && (Object.keys(te(s)).length > 0 || Object.keys(te(x)).length > 0)) if (!Kt(b) || Array.isArray(b) && b.length > 1) {
647
+ if (Object.keys(te(s)).length > 0) throw new Error(['Passing props on "Fragment"!', "", `The current component <${r} /> is rendering a "Fragment".`, "However we need to passthrough the following props:", Object.keys(te(s)).concat(Object.keys(te(x))).map((T) => ` - ${T}`).join(`
648
+ `), "", "You can apply a few solutions:", ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".', "Render a single element as the child so that we can forward the props onto that element."].map((T) => ` - ${T}`).join(`
1256
649
  `)].join(`
1257
650
  `));
1258
651
  } else {
1259
- let b = c.props, y = b == null ? void 0 : b.className, g = typeof y == "function" ? (...m) => kt(y(...m), i.className) : kt(y, i.className), f = g ? { className: g } : {}, d = Sn(c.props, Se(St(i, ["ref"])));
1260
- for (let m in w) m in d && delete w[m];
1261
- return Cr(c, Object.assign({}, d, w, p, { ref: l(Zr(c), p.ref) }, f));
652
+ let T = b.props, E = T == null ? void 0 : T.className, c = typeof E == "function" ? (...f) => _e(E(...f), s.className) : _e(E, s.className), g = c ? { className: c } : {}, d = Nt(b.props, te(He(s, ["ref"])));
653
+ for (let f in x) f in d && delete x[f];
654
+ return qt(b, Object.assign({}, d, x, v, { ref: i(on(b), v.ref) }, g));
1262
655
  }
1263
- return rt(o, Object.assign({}, St(i, ["ref"]), o !== se && p, o !== se && w), c);
656
+ return Ne(l, Object.assign({}, He(s, ["ref"]), l !== ae && v, l !== ae && x), b);
1264
657
  }
1265
- function Gr() {
1266
- let e = j([]), t = oe((n) => {
1267
- for (let r of e.current) r != null && (typeof r == "function" ? r(n) : r.current = n);
658
+ function ln() {
659
+ let t = j([]), e = V((n) => {
660
+ for (let r of t.current) r != null && (typeof r == "function" ? r(n) : r.current = n);
1268
661
  }, []);
1269
662
  return (...n) => {
1270
- if (!n.every((r) => r == null)) return e.current = n, t;
663
+ if (!n.every((r) => r == null)) return t.current = n, e;
1271
664
  };
1272
665
  }
1273
- function Jr(...e) {
1274
- return e.every((t) => t == null) ? void 0 : (t) => {
1275
- for (let n of e) n != null && (typeof n == "function" ? n(t) : n.current = t);
666
+ function sn(...t) {
667
+ return t.every((e) => e == null) ? void 0 : (e) => {
668
+ for (let n of t) n != null && (typeof n == "function" ? n(e) : n.current = e);
1276
669
  };
1277
670
  }
1278
- function Sn(...e) {
1279
- if (e.length === 0) return {};
1280
- if (e.length === 1) return e[0];
1281
- let t = {}, n = {};
1282
- for (let r of e) for (let l in r) l.startsWith("on") && typeof r[l] == "function" ? (n[l] != null || (n[l] = []), n[l].push(r[l])) : t[l] = r[l];
1283
- if (t.disabled || t["aria-disabled"]) for (let r in n) /^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r) && (n[r] = [(l) => {
1284
- var o;
1285
- return (o = l == null ? void 0 : l.preventDefault) == null ? void 0 : o.call(l);
671
+ function Nt(...t) {
672
+ if (t.length === 0) return {};
673
+ if (t.length === 1) return t[0];
674
+ let e = {}, n = {};
675
+ for (let r of t) for (let i in r) i.startsWith("on") && typeof r[i] == "function" ? (n[i] != null || (n[i] = []), n[i].push(r[i])) : e[i] = r[i];
676
+ if (e.disabled || e["aria-disabled"]) for (let r in n) /^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r) && (n[r] = [(i) => {
677
+ var l;
678
+ return (l = i == null ? void 0 : i.preventDefault) == null ? void 0 : l.call(i);
1286
679
  }]);
1287
- for (let r in n) Object.assign(t, { [r](l, ...o) {
1288
- let u = n[r];
1289
- for (let s of u) {
1290
- if ((l instanceof Event || (l == null ? void 0 : l.nativeEvent) instanceof Event) && l.defaultPrevented) return;
1291
- s(l, ...o);
680
+ for (let r in n) Object.assign(e, { [r](i, ...l) {
681
+ let a = n[r];
682
+ for (let m of a) {
683
+ if ((i instanceof Event || (i == null ? void 0 : i.nativeEvent) instanceof Event) && i.defaultPrevented) return;
684
+ m(i, ...l);
1292
685
  }
1293
686
  } });
1294
- return t;
1295
- }
1296
- function Q(e) {
1297
- var t;
1298
- return Object.assign(It(e), { displayName: (t = e.displayName) != null ? t : e.name });
1299
- }
1300
- function Se(e) {
1301
- let t = Object.assign({}, e);
1302
- for (let n in t) t[n] === void 0 && delete t[n];
1303
- return t;
1304
- }
1305
- function St(e, t = []) {
1306
- let n = Object.assign({}, e);
1307
- for (let r of t) r in n && delete n[r];
1308
- return n;
1309
- }
1310
- function Zr(e) {
1311
- return O.version.split(".")[0] >= "19" ? e.props.ref : e.ref;
1312
- }
1313
- let Qr = "span";
1314
- var ot = ((e) => (e[e.None = 1] = "None", e[e.Focusable = 2] = "Focusable", e[e.Hidden = 4] = "Hidden", e))(ot || {});
1315
- function el(e, t) {
1316
- var n;
1317
- let { features: r = 1, ...l } = e, o = { ref: t, "aria-hidden": (r & 2) === 2 ? !0 : (n = l["aria-hidden"]) != null ? n : void 0, hidden: (r & 4) === 4 ? !0 : void 0, style: { position: "fixed", top: 1, left: 1, width: 1, height: 0, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0", ...(r & 4) === 4 && (r & 2) !== 2 && { display: "none" } } };
1318
- return ie()({ ourProps: o, theirProps: l, slot: {}, defaultTag: Qr, name: "Hidden" });
1319
- }
1320
- let jt = Q(el), Cn = Symbol();
1321
- function tl(e, t = !0) {
1322
- return Object.assign(e, { [Cn]: t });
1323
- }
1324
- function ce(...e) {
1325
- let t = j(e);
1326
- L(() => {
1327
- t.current = e;
1328
- }, [e]);
1329
- let n = A((r) => {
1330
- for (let l of t.current) l != null && (typeof l == "function" ? l(r) : l.current = r);
1331
- });
1332
- return e.every((r) => r == null || (r == null ? void 0 : r[Cn])) ? void 0 : n;
1333
- }
1334
- let Ut = ae(null);
1335
- Ut.displayName = "DescriptionContext";
1336
- function $n() {
1337
- let e = Z(Ut);
1338
- if (e === null) {
1339
- let t = new Error("You used a <Description /> component, but it is not inside a relevant parent.");
1340
- throw Error.captureStackTrace && Error.captureStackTrace(t, $n), t;
1341
- }
1342
687
  return e;
1343
688
  }
1344
- function nl() {
1345
- let [e, t] = V([]);
1346
- return [e.length > 0 ? e.join(" ") : void 0, B(() => function(n) {
1347
- let r = A((o) => (t((u) => [...u, o]), () => t((u) => {
1348
- let s = u.slice(), i = s.indexOf(o);
1349
- return i !== -1 && s.splice(i, 1), s;
1350
- }))), l = B(() => ({ register: r, slot: n.slot, name: n.name, props: n.props, value: n.value }), [r, n.slot, n.name, n.props, n.value]);
1351
- return O.createElement(Ut.Provider, { value: l }, n.children);
1352
- }, [t])];
1353
- }
1354
- let rl = "p";
1355
- function ll(e, t) {
1356
- let n = Ge(), r = Kr(), { id: l = `headlessui-description-${n}`, ...o } = e, u = $n(), s = ce(t);
1357
- z(() => u.register(l), [l, u.register]);
1358
- let i = r || !1, p = B(() => ({ ...u.slot, disabled: i }), [u.slot, i]), c = { ref: s, ...u.props, id: l };
1359
- return ie()({ ourProps: c, theirProps: o, slot: p, defaultTag: rl, name: u.name || "Description" });
1360
- }
1361
- let al = Q(ll), il = Object.assign(al, {});
1362
- var Fn = ((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))(Fn || {});
1363
- let ol = ae(() => {
1364
- });
1365
- function ul({ value: e, children: t }) {
1366
- return O.createElement(ol.Provider, { value: e }, t);
1367
- }
1368
- let sl = class extends Map {
1369
- constructor(t) {
1370
- super(), this.factory = t;
1371
- }
1372
- get(t) {
1373
- let n = super.get(t);
1374
- return n === void 0 && (n = this.factory(t), this.set(t, n)), n;
1375
- }
1376
- };
1377
- function kn(e, t) {
1378
- let n = e(), r = /* @__PURE__ */ new Set();
1379
- return { getSnapshot() {
1380
- return n;
1381
- }, subscribe(l) {
1382
- return r.add(l), () => r.delete(l);
1383
- }, dispatch(l, ...o) {
1384
- let u = t[l].call(n, ...o);
1385
- u && (n = u, r.forEach((s) => s()));
1386
- } };
1387
- }
1388
- function jn(e) {
1389
- return $r(e.subscribe, e.getSnapshot, e.getSnapshot);
1390
- }
1391
- let cl = new sl(() => kn(() => [], { ADD(e) {
1392
- return this.includes(e) ? this : [...this, e];
1393
- }, REMOVE(e) {
1394
- let t = this.indexOf(e);
1395
- if (t === -1) return this;
1396
- let n = this.slice();
1397
- return n.splice(t, 1), n;
1398
- } }));
1399
- function Ae(e, t) {
1400
- let n = cl.get(t), r = Ge(), l = jn(n);
1401
- if (z(() => {
1402
- if (e) return n.dispatch("ADD", r), () => n.dispatch("REMOVE", r);
1403
- }, [n, e]), !e) return !1;
1404
- let o = l.indexOf(r), u = l.length;
1405
- return o === -1 && (o = u, u += 1), o === u - 1;
1406
- }
1407
- let _t = /* @__PURE__ */ new Map(), Ke = /* @__PURE__ */ new Map();
1408
- function dn(e) {
1409
- var t;
1410
- let n = (t = Ke.get(e)) != null ? t : 0;
1411
- return Ke.set(e, n + 1), n !== 0 ? () => fn(e) : (_t.set(e, { "aria-hidden": e.getAttribute("aria-hidden"), inert: e.inert }), e.setAttribute("aria-hidden", "true"), e.inert = !0, () => fn(e));
1412
- }
1413
- function fn(e) {
1414
- var t;
1415
- let n = (t = Ke.get(e)) != null ? t : 1;
1416
- if (n === 1 ? Ke.delete(e) : Ke.set(e, n - 1), n !== 1) return;
1417
- let r = _t.get(e);
1418
- r && (r["aria-hidden"] === null ? e.removeAttribute("aria-hidden") : e.setAttribute("aria-hidden", r["aria-hidden"]), e.inert = r.inert, _t.delete(e));
1419
- }
1420
- function dl(e, { allowed: t, disallowed: n } = {}) {
1421
- let r = Ae(e, "inert-others");
1422
- z(() => {
1423
- var l, o;
1424
- if (!r) return;
1425
- let u = ye();
1426
- for (let i of (l = n == null ? void 0 : n()) != null ? l : []) i && u.add(dn(i));
1427
- let s = (o = t == null ? void 0 : t()) != null ? o : [];
1428
- for (let i of s) {
1429
- if (!i) continue;
1430
- let p = ft(i);
1431
- if (!p) continue;
1432
- let c = i.parentElement;
1433
- for (; c && c !== p.body; ) {
1434
- for (let w of c.children) s.some((b) => w.contains(b)) || u.add(dn(w));
1435
- c = c.parentElement;
1436
- }
1437
- }
1438
- return u.dispose;
1439
- }, [r, t, n]);
1440
- }
1441
- function fl(e, t, n) {
1442
- let r = ke((l) => {
1443
- let o = l.getBoundingClientRect();
1444
- o.x === 0 && o.y === 0 && o.width === 0 && o.height === 0 && n();
1445
- });
1446
- L(() => {
1447
- if (!e) return;
1448
- let l = t === null ? null : t instanceof HTMLElement ? t : t.current;
1449
- if (!l) return;
1450
- let o = ye();
1451
- if (typeof ResizeObserver < "u") {
1452
- let u = new ResizeObserver(() => r.current(l));
1453
- u.observe(l), o.add(() => u.disconnect());
1454
- }
1455
- if (typeof IntersectionObserver < "u") {
1456
- let u = new IntersectionObserver(() => r.current(l));
1457
- u.observe(l), o.add(() => u.disconnect());
1458
- }
1459
- return () => o.dispose();
1460
- }, [t, r, e]);
1461
- }
1462
- let ut = ["[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(","), pl = ["[data-autofocus]"].map((e) => `${e}:not([tabindex='-1'])`).join(",");
1463
- var pe = ((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))(pe || {}), Mt = ((e) => (e[e.Error = 0] = "Error", e[e.Overflow = 1] = "Overflow", e[e.Success = 2] = "Success", e[e.Underflow = 3] = "Underflow", e))(Mt || {}), ml = ((e) => (e[e.Previous = -1] = "Previous", e[e.Next = 1] = "Next", e))(ml || {});
1464
- function hl(e = document.body) {
1465
- return e == null ? [] : Array.from(e.querySelectorAll(ut)).sort((t, n) => Math.sign((t.tabIndex || Number.MAX_SAFE_INTEGER) - (n.tabIndex || Number.MAX_SAFE_INTEGER)));
1466
- }
1467
- function vl(e = document.body) {
1468
- return e == null ? [] : Array.from(e.querySelectorAll(pl)).sort((t, n) => Math.sign((t.tabIndex || Number.MAX_SAFE_INTEGER) - (n.tabIndex || Number.MAX_SAFE_INTEGER)));
1469
- }
1470
- var _n = ((e) => (e[e.Strict = 0] = "Strict", e[e.Loose = 1] = "Loose", e))(_n || {});
1471
- function gl(e, t = 0) {
1472
- var n;
1473
- return e === ((n = ft(e)) == null ? void 0 : n.body) ? !1 : we(t, { 0() {
1474
- return e.matches(ut);
1475
- }, 1() {
1476
- let r = e;
1477
- for (; r !== null; ) {
1478
- if (r.matches(ut)) return !0;
1479
- r = r.parentElement;
1480
- }
1481
- return !1;
1482
- } });
1483
- }
1484
- var wl = ((e) => (e[e.Keyboard = 0] = "Keyboard", e[e.Mouse = 1] = "Mouse", e))(wl || {});
1485
- typeof window < "u" && typeof document < "u" && (document.addEventListener("keydown", (e) => {
1486
- e.metaKey || e.altKey || e.ctrlKey || (document.documentElement.dataset.headlessuiFocusVisible = "");
1487
- }, !0), document.addEventListener("click", (e) => {
1488
- e.detail === 1 ? delete document.documentElement.dataset.headlessuiFocusVisible : e.detail === 0 && (document.documentElement.dataset.headlessuiFocusVisible = "");
1489
- }, !0));
1490
- function me(e) {
1491
- e == null || e.focus({ preventScroll: !0 });
1492
- }
1493
- let yl = ["textarea", "input"].join(",");
1494
- function bl(e) {
1495
- var t, n;
1496
- return (n = (t = e == null ? void 0 : e.matches) == null ? void 0 : t.call(e, yl)) != null ? n : !1;
1497
- }
1498
- function xl(e, t = (n) => n) {
1499
- return e.slice().sort((n, r) => {
1500
- let l = t(n), o = t(r);
1501
- if (l === null || o === null) return 0;
1502
- let u = l.compareDocumentPosition(o);
1503
- return u & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : u & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
1504
- });
1505
- }
1506
- function ze(e, t, { sorted: n = !0, relativeTo: r = null, skipElements: l = [] } = {}) {
1507
- let o = Array.isArray(e) ? e.length > 0 ? e[0].ownerDocument : document : e.ownerDocument, u = Array.isArray(e) ? n ? xl(e) : e : t & 64 ? vl(e) : hl(e);
1508
- l.length > 0 && u.length > 1 && (u = u.filter((y) => !l.some((g) => g != null && "current" in g ? (g == null ? void 0 : g.current) === y : g === y))), r = r ?? o.activeElement;
1509
- let s = (() => {
1510
- if (t & 5) return 1;
1511
- if (t & 10) return -1;
1512
- throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
1513
- })(), i = (() => {
1514
- if (t & 1) return 0;
1515
- if (t & 2) return Math.max(0, u.indexOf(r)) - 1;
1516
- if (t & 4) return Math.max(0, u.indexOf(r)) + 1;
1517
- if (t & 8) return u.length - 1;
1518
- throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
1519
- })(), p = t & 32 ? { preventScroll: !0 } : {}, c = 0, w = u.length, b;
1520
- do {
1521
- if (c >= w || c + w <= 0) return 0;
1522
- let y = i + c;
1523
- if (t & 16) y = (y + w) % w;
1524
- else {
1525
- if (y < 0) return 3;
1526
- if (y >= w) return 1;
1527
- }
1528
- b = u[y], b == null || b.focus(p), c += s;
1529
- } while (b !== o.activeElement);
1530
- return t & 6 && bl(b) && b.select(), 2;
1531
- }
1532
- function Mn() {
1533
- return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
1534
- }
1535
- function El() {
1536
- return /Android/gi.test(window.navigator.userAgent);
1537
- }
1538
- function Tl() {
1539
- return Mn() || El();
1540
- }
1541
- function Be(e, t, n, r) {
1542
- let l = ke(n);
1543
- L(() => {
1544
- if (!e) return;
1545
- function o(u) {
1546
- l.current(u);
1547
- }
1548
- return document.addEventListener(t, o, r), () => document.removeEventListener(t, o, r);
1549
- }, [e, t, r]);
1550
- }
1551
- function An(e, t, n, r) {
1552
- let l = ke(n);
1553
- L(() => {
1554
- if (!e) return;
1555
- function o(u) {
1556
- l.current(u);
1557
- }
1558
- return window.addEventListener(t, o, r), () => window.removeEventListener(t, o, r);
1559
- }, [e, t, r]);
1560
- }
1561
- const pn = 30;
1562
- function Ol(e, t, n) {
1563
- let r = Ae(e, "outside-click"), l = ke(n), o = oe(function(i, p) {
1564
- if (i.defaultPrevented) return;
1565
- let c = p(i);
1566
- if (c === null || !c.getRootNode().contains(c) || !c.isConnected) return;
1567
- let w = function b(y) {
1568
- return typeof y == "function" ? b(y()) : Array.isArray(y) || y instanceof Set ? y : [y];
1569
- }(t);
1570
- for (let b of w) if (b !== null && (b.contains(c) || i.composed && i.composedPath().includes(b))) return;
1571
- return !gl(c, _n.Loose) && c.tabIndex !== -1 && i.preventDefault(), l.current(i, c);
1572
- }, [l, t]), u = j(null);
1573
- Be(r, "pointerdown", (i) => {
1574
- var p, c;
1575
- u.current = ((c = (p = i.composedPath) == null ? void 0 : p.call(i)) == null ? void 0 : c[0]) || i.target;
1576
- }, !0), Be(r, "mousedown", (i) => {
1577
- var p, c;
1578
- u.current = ((c = (p = i.composedPath) == null ? void 0 : p.call(i)) == null ? void 0 : c[0]) || i.target;
1579
- }, !0), Be(r, "click", (i) => {
1580
- Tl() || u.current && (o(i, () => u.current), u.current = null);
1581
- }, !0);
1582
- let s = j({ x: 0, y: 0 });
1583
- Be(r, "touchstart", (i) => {
1584
- s.current.x = i.touches[0].clientX, s.current.y = i.touches[0].clientY;
1585
- }, !0), Be(r, "touchend", (i) => {
1586
- let p = { x: i.changedTouches[0].clientX, y: i.changedTouches[0].clientY };
1587
- if (!(Math.abs(p.x - s.current.x) >= pn || Math.abs(p.y - s.current.y) >= pn)) return o(i, () => i.target instanceof HTMLElement ? i.target : null);
1588
- }, !0), An(r, "blur", (i) => o(i, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), !0);
1589
- }
1590
- function Je(...e) {
1591
- return B(() => ft(...e), [...e]);
1592
- }
1593
- function Ln(e, t, n, r) {
1594
- let l = ke(n);
1595
- L(() => {
1596
- e = e ?? window;
1597
- function o(u) {
1598
- l.current(u);
1599
- }
1600
- return e.addEventListener(t, o, r), () => e.removeEventListener(t, o, r);
1601
- }, [e, t, r]);
1602
- }
1603
- function Pl() {
1604
- let e;
1605
- return { before({ doc: t }) {
1606
- var n;
1607
- let r = t.documentElement, l = (n = t.defaultView) != null ? n : window;
1608
- e = Math.max(0, l.innerWidth - r.clientWidth);
1609
- }, after({ doc: t, d: n }) {
1610
- let r = t.documentElement, l = Math.max(0, r.clientWidth - r.offsetWidth), o = Math.max(0, e - l);
1611
- n.style(r, "paddingRight", `${o}px`);
1612
- } };
1613
- }
1614
- function Rl() {
1615
- return Mn() ? { before({ doc: e, d: t, meta: n }) {
1616
- function r(l) {
1617
- return n.containers.flatMap((o) => o()).some((o) => o.contains(l));
1618
- }
1619
- t.microTask(() => {
1620
- var l;
1621
- if (window.getComputedStyle(e.documentElement).scrollBehavior !== "auto") {
1622
- let s = ye();
1623
- s.style(e.documentElement, "scrollBehavior", "auto"), t.add(() => t.microTask(() => s.dispose()));
1624
- }
1625
- let o = (l = window.scrollY) != null ? l : window.pageYOffset, u = null;
1626
- t.addEventListener(e, "click", (s) => {
1627
- if (s.target instanceof HTMLElement) try {
1628
- let i = s.target.closest("a");
1629
- if (!i) return;
1630
- let { hash: p } = new URL(i.href), c = e.querySelector(p);
1631
- c && !r(c) && (u = c);
1632
- } catch {
1633
- }
1634
- }, !0), t.addEventListener(e, "touchstart", (s) => {
1635
- if (s.target instanceof HTMLElement) if (r(s.target)) {
1636
- let i = s.target;
1637
- for (; i.parentElement && r(i.parentElement); ) i = i.parentElement;
1638
- t.style(i, "overscrollBehavior", "contain");
1639
- } else t.style(s.target, "touchAction", "none");
1640
- }), t.addEventListener(e, "touchmove", (s) => {
1641
- if (s.target instanceof HTMLElement) {
1642
- if (s.target.tagName === "INPUT") return;
1643
- if (r(s.target)) {
1644
- let i = s.target;
1645
- for (; i.parentElement && i.dataset.headlessuiPortal !== "" && !(i.scrollHeight > i.clientHeight || i.scrollWidth > i.clientWidth); ) i = i.parentElement;
1646
- i.dataset.headlessuiPortal === "" && s.preventDefault();
1647
- } else s.preventDefault();
1648
- }
1649
- }, { passive: !1 }), t.add(() => {
1650
- var s;
1651
- let i = (s = window.scrollY) != null ? s : window.pageYOffset;
1652
- o !== i && window.scrollTo(0, o), u && u.isConnected && (u.scrollIntoView({ block: "nearest" }), u = null);
1653
- });
1654
- });
1655
- } } : {};
689
+ function et(t) {
690
+ var e;
691
+ return Object.assign(Ze(t), { displayName: (e = t.displayName) != null ? e : t.name });
1656
692
  }
1657
- function Sl() {
1658
- return { before({ doc: e, d: t }) {
1659
- t.style(e.documentElement, "overflow", "hidden");
1660
- } };
693
+ function te(t) {
694
+ let e = Object.assign({}, t);
695
+ for (let n in e) e[n] === void 0 && delete e[n];
696
+ return e;
1661
697
  }
1662
- function Cl(e) {
1663
- let t = {};
1664
- for (let n of e) Object.assign(t, n(t));
1665
- return t;
698
+ function He(t, e = []) {
699
+ let n = Object.assign({}, t);
700
+ for (let r of e) r in n && delete n[r];
701
+ return n;
1666
702
  }
1667
- let $e = kn(() => /* @__PURE__ */ new Map(), { PUSH(e, t) {
1668
- var n;
1669
- let r = (n = this.get(e)) != null ? n : { doc: e, count: 0, d: ye(), meta: /* @__PURE__ */ new Set() };
1670
- return r.count++, r.meta.add(t), this.set(e, r), this;
1671
- }, POP(e, t) {
1672
- let n = this.get(e);
1673
- return n && (n.count--, n.meta.delete(t)), this;
1674
- }, SCROLL_PREVENT({ doc: e, d: t, meta: n }) {
1675
- let r = { doc: e, d: t, meta: Cl(n) }, l = [Rl(), Pl(), Sl()];
1676
- l.forEach(({ before: o }) => o == null ? void 0 : o(r)), l.forEach(({ after: o }) => o == null ? void 0 : o(r));
1677
- }, SCROLL_ALLOW({ d: e }) {
1678
- e.dispose();
1679
- }, TEARDOWN({ doc: e }) {
1680
- this.delete(e);
1681
- } });
1682
- $e.subscribe(() => {
1683
- let e = $e.getSnapshot(), t = /* @__PURE__ */ new Map();
1684
- for (let [n] of e) t.set(n, n.documentElement.style.overflow);
1685
- for (let n of e.values()) {
1686
- let r = t.get(n.doc) === "hidden", l = n.count !== 0;
1687
- (l && !r || !l && r) && $e.dispatch(n.count > 0 ? "SCROLL_PREVENT" : "SCROLL_ALLOW", n), n.count === 0 && $e.dispatch("TEARDOWN", n);
1688
- }
1689
- });
1690
- function $l(e, t, n = () => ({ containers: [] })) {
1691
- let r = jn($e), l = t ? r.get(t) : void 0, o = l ? l.count > 0 : !1;
1692
- return z(() => {
1693
- if (!(!t || !e)) return $e.dispatch("PUSH", t, n), () => $e.dispatch("POP", t, n);
1694
- }, [e, t]), o;
703
+ function on(t) {
704
+ return B.version.split(".")[0] >= "19" ? t.props.ref : t.ref;
1695
705
  }
1696
- function Fl(e, t, n = () => [document.body]) {
1697
- let r = Ae(e, "scroll-lock");
1698
- $l(r, t, (l) => {
1699
- var o;
1700
- return { containers: [...(o = l.containers) != null ? o : [], n] };
706
+ let un = Symbol();
707
+ function Tt(...t) {
708
+ let e = j(t);
709
+ D(() => {
710
+ e.current = t;
711
+ }, [t]);
712
+ let n = G((r) => {
713
+ for (let i of e.current) i != null && (typeof i == "function" ? i(r) : i.current = r);
1701
714
  });
715
+ return t.every((r) => r == null || (r == null ? void 0 : r[un])) ? void 0 : n;
1702
716
  }
1703
- function kl(e = 0) {
1704
- let [t, n] = V(e), r = oe((i) => n(i), [t]), l = oe((i) => n((p) => p | i), [t]), o = oe((i) => (t & i) === i, [t]), u = oe((i) => n((p) => p & ~i), [n]), s = oe((i) => n((p) => p ^ i), [n]);
1705
- return { flags: t, setFlag: r, addFlag: l, hasFlag: o, removeFlag: u, toggleFlag: s };
717
+ function dn(t = 0) {
718
+ let [e, n] = $(t), r = V((s) => n(s), [e]), i = V((s) => n((v) => v | s), [e]), l = V((s) => (e & s) === s, [e]), a = V((s) => n((v) => v & ~s), [n]), m = V((s) => n((v) => v ^ s), [n]);
719
+ return { flags: e, setFlag: r, addFlag: i, hasFlag: l, removeFlag: a, toggleFlag: m };
1706
720
  }
1707
- var mn, hn;
1708
- typeof process < "u" && typeof globalThis < "u" && typeof Element < "u" && ((mn = process == null ? void 0 : process.env) == null ? void 0 : mn.NODE_ENV) === "test" && typeof ((hn = Element == null ? void 0 : Element.prototype) == null ? void 0 : hn.getAnimations) > "u" && (Element.prototype.getAnimations = function() {
721
+ var at, it;
722
+ typeof process < "u" && typeof globalThis < "u" && typeof Element < "u" && ((at = process == null ? void 0 : process.env) == null ? void 0 : at.NODE_ENV) === "test" && typeof ((it = Element == null ? void 0 : Element.prototype) == null ? void 0 : it.getAnimations) > "u" && (Element.prototype.getAnimations = function() {
1709
723
  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(`
1710
724
  `)), [];
1711
725
  });
1712
- var jl = ((e) => (e[e.None = 0] = "None", e[e.Closed = 1] = "Closed", e[e.Enter = 2] = "Enter", e[e.Leave = 4] = "Leave", e))(jl || {});
1713
- function _l(e) {
1714
- let t = {};
1715
- for (let n in e) e[n] === !0 && (t[`data-${n}`] = "");
1716
- return t;
726
+ var cn = ((t) => (t[t.None = 0] = "None", t[t.Closed = 1] = "Closed", t[t.Enter = 2] = "Enter", t[t.Leave = 4] = "Leave", t))(cn || {});
727
+ function fn(t) {
728
+ let e = {};
729
+ for (let n in t) t[n] === !0 && (e[`data-${n}`] = "");
730
+ return e;
1717
731
  }
1718
- function Ml(e, t, n, r) {
1719
- let [l, o] = V(n), { hasFlag: u, addFlag: s, removeFlag: i } = kl(e && l ? 3 : 0), p = j(!1), c = j(!1), w = Wt();
1720
- return z(() => {
1721
- var b;
1722
- if (e) {
1723
- if (n && o(!0), !t) {
1724
- n && s(3);
732
+ function mn(t, e, n, r) {
733
+ let [i, l] = $(n), { hasFlag: a, addFlag: m, removeFlag: s } = dn(t && i ? 3 : 0), v = j(!1), b = j(!1), x = yt();
734
+ return Q(() => {
735
+ var T;
736
+ if (t) {
737
+ if (n && l(!0), !e) {
738
+ n && m(3);
1725
739
  return;
1726
740
  }
1727
- return (b = r == null ? void 0 : r.start) == null || b.call(r, n), Al(t, { inFlight: p, prepare() {
1728
- c.current ? c.current = !1 : c.current = p.current, p.current = !0, !c.current && (n ? (s(3), i(4)) : (s(4), i(2)));
741
+ return (T = r == null ? void 0 : r.start) == null || T.call(r, n), pn(e, { inFlight: v, prepare() {
742
+ b.current ? b.current = !1 : b.current = v.current, v.current = !0, !b.current && (n ? (m(3), s(4)) : (m(4), s(2)));
1729
743
  }, run() {
1730
- c.current ? n ? (i(3), s(4)) : (i(4), s(3)) : n ? i(1) : s(1);
744
+ b.current ? n ? (s(3), m(4)) : (s(4), m(3)) : n ? s(1) : m(1);
1731
745
  }, done() {
1732
- var y;
1733
- c.current && typeof t.getAnimations == "function" && t.getAnimations().length > 0 || (p.current = !1, i(7), n || o(!1), (y = r == null ? void 0 : r.end) == null || y.call(r, n));
746
+ var E;
747
+ b.current && typeof e.getAnimations == "function" && e.getAnimations().length > 0 || (v.current = !1, s(7), n || l(!1), (E = r == null ? void 0 : r.end) == null || E.call(r, n));
1734
748
  } });
1735
749
  }
1736
- }, [e, n, t, w]), e ? [l, { closed: u(1), enter: u(2), leave: u(4), transition: u(2) || u(4) }] : [n, { closed: void 0, enter: void 0, leave: void 0, transition: void 0 }];
750
+ }, [t, n, e, x]), t ? [i, { closed: a(1), enter: a(2), leave: a(4), transition: a(2) || a(4) }] : [n, { closed: void 0, enter: void 0, leave: void 0, transition: void 0 }];
1737
751
  }
1738
- function Al(e, { prepare: t, run: n, done: r, inFlight: l }) {
1739
- let o = ye();
1740
- return Il(e, { prepare: t, inFlight: l }), o.nextFrame(() => {
1741
- n(), o.requestAnimationFrame(() => {
1742
- o.add(Ll(e, r));
752
+ function pn(t, { prepare: e, run: n, done: r, inFlight: i }) {
753
+ let l = Me();
754
+ return vn(t, { prepare: e, inFlight: i }), l.nextFrame(() => {
755
+ n(), l.requestAnimationFrame(() => {
756
+ l.add(hn(t, r));
1743
757
  });
1744
- }), o.dispose;
758
+ }), l.dispose;
1745
759
  }
1746
- function Ll(e, t) {
760
+ function hn(t, e) {
1747
761
  var n, r;
1748
- let l = ye();
1749
- if (!e) return l.dispose;
1750
- let o = !1;
1751
- l.add(() => {
1752
- o = !0;
762
+ let i = Me();
763
+ if (!t) return i.dispose;
764
+ let l = !1;
765
+ i.add(() => {
766
+ l = !0;
1753
767
  });
1754
- let u = (r = (n = e.getAnimations) == null ? void 0 : n.call(e).filter((s) => s instanceof CSSTransition)) != null ? r : [];
1755
- return u.length === 0 ? (t(), l.dispose) : (Promise.allSettled(u.map((s) => s.finished)).then(() => {
1756
- o || t();
1757
- }), l.dispose);
768
+ let a = (r = (n = t.getAnimations) == null ? void 0 : n.call(t).filter((m) => m instanceof CSSTransition)) != null ? r : [];
769
+ return a.length === 0 ? (e(), i.dispose) : (Promise.allSettled(a.map((m) => m.finished)).then(() => {
770
+ l || e();
771
+ }), i.dispose);
1758
772
  }
1759
- function Il(e, { inFlight: t, prepare: n }) {
1760
- if (t != null && t.current) {
773
+ function vn(t, { inFlight: e, prepare: n }) {
774
+ if (e != null && e.current) {
1761
775
  n();
1762
776
  return;
1763
777
  }
1764
- let r = e.style.transition;
1765
- e.style.transition = "none", n(), e.offsetHeight, e.style.transition = r;
1766
- }
1767
- function Ht(e, t) {
1768
- let n = j([]), r = A(e);
1769
- L(() => {
1770
- let l = [...n.current];
1771
- for (let [o, u] of t.entries()) if (n.current[o] !== u) {
1772
- let s = r(t, l);
1773
- return n.current = t, s;
1774
- }
1775
- }, [r, ...t]);
1776
- }
1777
- let mt = ae(null);
1778
- mt.displayName = "OpenClosedContext";
1779
- var ue = ((e) => (e[e.Open = 1] = "Open", e[e.Closed = 2] = "Closed", e[e.Closing = 4] = "Closing", e[e.Opening = 8] = "Opening", e))(ue || {});
1780
- function ht() {
1781
- return Z(mt);
1782
- }
1783
- function Nl({ value: e, children: t }) {
1784
- return O.createElement(mt.Provider, { value: e }, t);
1785
- }
1786
- function Dl({ children: e }) {
1787
- return O.createElement(mt.Provider, { value: null }, e);
1788
- }
1789
- function Wl(e) {
1790
- function t() {
1791
- document.readyState !== "loading" && (e(), document.removeEventListener("DOMContentLoaded", t));
1792
- }
1793
- typeof window < "u" && typeof document < "u" && (document.addEventListener("DOMContentLoaded", t), t());
1794
- }
1795
- let ve = [];
1796
- Wl(() => {
1797
- function e(t) {
1798
- if (!(t.target instanceof HTMLElement) || t.target === document.body || ve[0] === t.target) return;
1799
- let n = t.target;
1800
- n = n.closest(ut), ve.unshift(n ?? t.target), ve = ve.filter((r) => r != null && r.isConnected), ve.splice(10);
1801
- }
1802
- 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 });
1803
- });
1804
- function In(e) {
1805
- let t = A(e), n = j(!1);
1806
- L(() => (n.current = !1, () => {
1807
- n.current = !0, pt(() => {
1808
- n.current && t();
1809
- });
1810
- }), [t]);
1811
- }
1812
- function Ul() {
1813
- let e = typeof document > "u";
1814
- return "useSyncExternalStore" in Xe ? ((t) => t.useSyncExternalStore)(Xe)(() => () => {
1815
- }, () => !1, () => !e) : !1;
1816
- }
1817
- function Ze() {
1818
- let e = Ul(), [t, n] = Xe.useState(Fe.isHandoffComplete);
1819
- return t && Fe.isHandoffComplete === !1 && n(!1), Xe.useEffect(() => {
1820
- t !== !0 && n(!0);
1821
- }, [t]), Xe.useEffect(() => Fe.handoff(), []), e ? !1 : t;
1822
- }
1823
- let Nn = ae(!1);
1824
- function Hl() {
1825
- return Z(Nn);
1826
- }
1827
- function vn(e) {
1828
- return O.createElement(Nn.Provider, { value: e.force }, e.children);
1829
- }
1830
- function Bl(e) {
1831
- let t = Hl(), n = Z(Wn), r = Je(e), [l, o] = V(() => {
1832
- var u;
1833
- if (!t && n !== null) return (u = n.current) != null ? u : null;
1834
- if (Fe.isServer) return null;
1835
- let s = r == null ? void 0 : r.getElementById("headlessui-portal-root");
1836
- if (s) return s;
1837
- if (r === null) return null;
1838
- let i = r.createElement("div");
1839
- return i.setAttribute("id", "headlessui-portal-root"), r.body.appendChild(i);
1840
- });
1841
- return L(() => {
1842
- l !== null && (r != null && r.body.contains(l) || r == null || r.body.appendChild(l));
1843
- }, [l, r]), L(() => {
1844
- t || n !== null && o(n.current);
1845
- }, [n, o, t]), l;
1846
- }
1847
- let Dn = se, Vl = Q(function(e, t) {
1848
- let n = e, r = j(null), l = ce(tl((w) => {
1849
- r.current = w;
1850
- }), t), o = Je(r), u = Bl(r), [s] = V(() => {
1851
- var w;
1852
- return Fe.isServer ? null : (w = o == null ? void 0 : o.createElement("div")) != null ? w : null;
1853
- }), i = Z(At), p = Ze();
1854
- z(() => {
1855
- !u || !s || u.contains(s) || (s.setAttribute("data-headlessui-portal", ""), u.appendChild(s));
1856
- }, [u, s]), z(() => {
1857
- if (s && i) return i.register(s);
1858
- }, [i, s]), In(() => {
1859
- var w;
1860
- !u || !s || (s instanceof Node && u.contains(s) && u.removeChild(s), u.childNodes.length <= 0 && ((w = u.parentElement) == null || w.removeChild(u)));
1861
- });
1862
- let c = ie();
1863
- return p ? !u || !s ? null : Mr(c({ ourProps: { ref: l }, theirProps: n, slot: {}, defaultTag: Dn, name: "Portal" }), s) : null;
1864
- });
1865
- function Yl(e, t) {
1866
- let n = ce(t), { enabled: r = !0, ...l } = e, o = ie();
1867
- return r ? O.createElement(Vl, { ...l, ref: n }) : o({ ourProps: { ref: n }, theirProps: l, slot: {}, defaultTag: Dn, name: "Portal" });
1868
- }
1869
- let Xl = se, Wn = ae(null);
1870
- function ql(e, t) {
1871
- let { target: n, ...r } = e, l = { ref: ce(t) }, o = ie();
1872
- return O.createElement(Wn.Provider, { value: n }, o({ ourProps: l, theirProps: r, defaultTag: Xl, name: "Popover.Group" }));
1873
- }
1874
- let At = ae(null);
1875
- function Kl() {
1876
- let e = Z(At), t = j([]), n = A((o) => (t.current.push(o), e && e.register(o), () => r(o))), r = A((o) => {
1877
- let u = t.current.indexOf(o);
1878
- u !== -1 && t.current.splice(u, 1), e && e.unregister(o);
1879
- }), l = B(() => ({ register: n, unregister: r, portals: t }), [n, r, t]);
1880
- return [t, B(() => function({ children: o }) {
1881
- return O.createElement(At.Provider, { value: l }, o);
1882
- }, [l])];
1883
- }
1884
- let zl = Q(Yl), Un = Q(ql), Gl = Object.assign(zl, { Group: Un });
1885
- function Jl(e, t = typeof document < "u" ? document.defaultView : null, n) {
1886
- let r = Ae(e, "escape");
1887
- Ln(t, "keydown", (l) => {
1888
- r && (l.defaultPrevented || l.key === Fn.Escape && n(l));
1889
- });
1890
- }
1891
- function Zl() {
778
+ let r = t.style.transition;
779
+ t.style.transition = "none", n(), t.offsetHeight, t.style.transition = r;
780
+ }
781
+ /*!
782
+ * tabbable 6.2.0
783
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
784
+ */
785
+ var St = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"], Oe = /* @__PURE__ */ St.join(","), Ot = typeof Element > "u", ie = Ot ? function() {
786
+ } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, Fe = !Ot && Element.prototype.getRootNode ? function(t) {
1892
787
  var e;
1893
- let [t] = V(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(pointer: coarse)") : null), [n, r] = V((e = t == null ? void 0 : t.matches) != null ? e : !1);
1894
- return z(() => {
1895
- if (!t) return;
1896
- function l(o) {
1897
- r(o.matches);
1898
- }
1899
- return t.addEventListener("change", l), () => t.removeEventListener("change", l);
1900
- }, [t]), n;
1901
- }
1902
- function Ql({ defaultContainers: e = [], portals: t, mainTreeNode: n } = {}) {
1903
- let r = Je(n), l = A(() => {
1904
- var o, u;
1905
- let s = [];
1906
- for (let i of e) i !== null && (i instanceof HTMLElement ? s.push(i) : "current" in i && i.current instanceof HTMLElement && s.push(i.current));
1907
- if (t != null && t.current) for (let i of t.current) s.push(i);
1908
- for (let i of (o = r == null ? void 0 : r.querySelectorAll("html > *, body > *")) != null ? o : []) i !== document.body && i !== document.head && i instanceof HTMLElement && i.id !== "headlessui-portal-root" && (n && (i.contains(n) || i.contains((u = n == null ? void 0 : n.getRootNode()) == null ? void 0 : u.host)) || s.some((p) => i.contains(p)) || s.push(i));
1909
- return s;
1910
- });
1911
- return { resolveContainers: l, contains: A((o) => l().some((u) => u.contains(o))) };
1912
- }
1913
- let Hn = ae(null);
1914
- function gn({ children: e, node: t }) {
1915
- let [n, r] = V(null), l = Bn(t ?? n);
1916
- return O.createElement(Hn.Provider, { value: l }, e, l === null && O.createElement(jt, { features: ot.Hidden, ref: (o) => {
1917
- var u, s;
1918
- if (o) {
1919
- for (let i of (s = (u = ft(o)) == null ? void 0 : u.querySelectorAll("html > *, body > *")) != null ? s : []) if (i !== document.body && i !== document.head && i instanceof HTMLElement && i != null && i.contains(o)) {
1920
- r(i);
1921
- break;
788
+ return t == null || (e = t.getRootNode) === null || e === void 0 ? void 0 : e.call(t);
789
+ } : function(t) {
790
+ return t == null ? void 0 : t.ownerDocument;
791
+ }, ke = function t(e, n) {
792
+ var r;
793
+ n === void 0 && (n = !0);
794
+ var i = e == null || (r = e.getAttribute) === null || r === void 0 ? void 0 : r.call(e, "inert"), l = i === "" || i === "true", a = l || n && e && t(e.parentNode);
795
+ return a;
796
+ }, bn = function(e) {
797
+ var n, r = e == null || (n = e.getAttribute) === null || n === void 0 ? void 0 : n.call(e, "contenteditable");
798
+ return r === "" || r === "true";
799
+ }, Ft = function(e, n, r) {
800
+ if (ke(e))
801
+ return [];
802
+ var i = Array.prototype.slice.apply(e.querySelectorAll(Oe));
803
+ return n && ie.call(e, Oe) && i.unshift(e), i = i.filter(r), i;
804
+ }, kt = function t(e, n, r) {
805
+ for (var i = [], l = Array.from(e); l.length; ) {
806
+ var a = l.shift();
807
+ if (!ke(a, !1))
808
+ if (a.tagName === "SLOT") {
809
+ var m = a.assignedElements(), s = m.length ? m : a.children, v = t(s, !0, r);
810
+ r.flatten ? i.push.apply(i, v) : i.push({
811
+ scopeParent: a,
812
+ candidates: v
813
+ });
814
+ } else {
815
+ var b = ie.call(a, Oe);
816
+ b && r.filter(a) && (n || !e.includes(a)) && i.push(a);
817
+ var x = a.shadowRoot || // check for an undisclosed shadow
818
+ typeof r.getShadowRoot == "function" && r.getShadowRoot(a), T = !ke(x, !1) && (!r.shadowRootFilter || r.shadowRootFilter(a));
819
+ if (x && T) {
820
+ var E = t(x === !0 ? a.children : x.children, !0, r);
821
+ r.flatten ? i.push.apply(i, E) : i.push({
822
+ scopeParent: a,
823
+ candidates: E
824
+ });
825
+ } else
826
+ l.unshift.apply(l, a.children);
1922
827
  }
1923
- }
1924
- } }));
1925
- }
1926
- function Bn(e = null) {
1927
- var t;
1928
- return (t = Z(Hn)) != null ? t : e;
1929
- }
1930
- function Bt() {
1931
- let e = j(!1);
1932
- return z(() => (e.current = !0, () => {
1933
- e.current = !1;
1934
- }), []), e;
1935
- }
1936
- var Ye = ((e) => (e[e.Forwards = 0] = "Forwards", e[e.Backwards = 1] = "Backwards", e))(Ye || {});
1937
- function ea() {
1938
- let e = j(0);
1939
- return An(!0, "keydown", (t) => {
1940
- t.key === "Tab" && (e.current = t.shiftKey ? 1 : 0);
1941
- }, !0), e;
1942
- }
1943
- function Vn(e) {
1944
- if (!e) return /* @__PURE__ */ new Set();
1945
- if (typeof e == "function") return new Set(e());
1946
- let t = /* @__PURE__ */ new Set();
1947
- for (let n of e.current) n.current instanceof HTMLElement && t.add(n.current);
1948
- return t;
1949
- }
1950
- let ta = "div";
1951
- var Ce = ((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))(Ce || {});
1952
- function na(e, t) {
1953
- let n = j(null), r = ce(n, t), { initialFocus: l, initialFocusFallback: o, containers: u, features: s = 15, ...i } = e;
1954
- Ze() || (s = 0);
1955
- let p = Je(n);
1956
- ia(s, { ownerDocument: p });
1957
- let c = oa(s, { ownerDocument: p, container: n, initialFocus: l, initialFocusFallback: o });
1958
- ua(s, { ownerDocument: p, container: n, containers: u, previousActiveElement: c });
1959
- let w = ea(), b = A((v) => {
1960
- let x = n.current;
1961
- x && ((T) => T())(() => {
1962
- we(w.current, { [Ye.Forwards]: () => {
1963
- ze(x, pe.First, { skipElements: [v.relatedTarget, o] });
1964
- }, [Ye.Backwards]: () => {
1965
- ze(x, pe.Last, { skipElements: [v.relatedTarget, o] });
1966
- } });
1967
- });
1968
- }), y = Ae(!!(s & 2), "focus-trap#tab-lock"), g = Wt(), f = j(!1), d = { ref: r, onKeyDown(v) {
1969
- v.key == "Tab" && (f.current = !0, g.requestAnimationFrame(() => {
1970
- f.current = !1;
1971
- }));
1972
- }, onBlur(v) {
1973
- if (!(s & 4)) return;
1974
- let x = Vn(u);
1975
- n.current instanceof HTMLElement && x.add(n.current);
1976
- let T = v.relatedTarget;
1977
- T instanceof HTMLElement && T.dataset.headlessuiFocusGuard !== "true" && (Yn(x, T) || (f.current ? ze(n.current, we(w.current, { [Ye.Forwards]: () => pe.Next, [Ye.Backwards]: () => pe.Previous }) | pe.WrapAround, { relativeTo: v.target }) : v.target instanceof HTMLElement && me(v.target)));
1978
- } }, m = ie();
1979
- return O.createElement(O.Fragment, null, y && O.createElement(jt, { as: "button", type: "button", "data-headlessui-focus-guard": !0, onFocus: b, features: ot.Focusable }), m({ ourProps: d, theirProps: i, defaultTag: ta, name: "FocusTrap" }), y && O.createElement(jt, { as: "button", type: "button", "data-headlessui-focus-guard": !0, onFocus: b, features: ot.Focusable }));
1980
- }
1981
- let ra = Q(na), la = Object.assign(ra, { features: Ce });
1982
- function aa(e = !0) {
1983
- let t = j(ve.slice());
1984
- return Ht(([n], [r]) => {
1985
- r === !0 && n === !1 && pt(() => {
1986
- t.current.splice(0);
1987
- }), r === !1 && n === !0 && (t.current = ve.slice());
1988
- }, [e, ve, t]), A(() => {
1989
- var n;
1990
- return (n = t.current.find((r) => r != null && r.isConnected)) != null ? n : null;
1991
- });
1992
- }
1993
- function ia(e, { ownerDocument: t }) {
1994
- let n = !!(e & 8), r = aa(n);
1995
- Ht(() => {
1996
- n || (t == null ? void 0 : t.activeElement) === (t == null ? void 0 : t.body) && me(r());
1997
- }, [n]), In(() => {
1998
- n && me(r());
828
+ }
829
+ return i;
830
+ }, Ct = function(e) {
831
+ return !isNaN(parseInt(e.getAttribute("tabindex"), 10));
832
+ }, ne = function(e) {
833
+ if (!e)
834
+ throw new Error("No node provided");
835
+ return e.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || bn(e)) && !Ct(e) ? 0 : e.tabIndex;
836
+ }, gn = function(e, n) {
837
+ var r = ne(e);
838
+ return r < 0 && n && !Ct(e) ? 0 : r;
839
+ }, yn = function(e, n) {
840
+ return e.tabIndex === n.tabIndex ? e.documentOrder - n.documentOrder : e.tabIndex - n.tabIndex;
841
+ }, Pt = function(e) {
842
+ return e.tagName === "INPUT";
843
+ }, wn = function(e) {
844
+ return Pt(e) && e.type === "hidden";
845
+ }, xn = function(e) {
846
+ var n = e.tagName === "DETAILS" && Array.prototype.slice.apply(e.children).some(function(r) {
847
+ return r.tagName === "SUMMARY";
1999
848
  });
2000
- }
2001
- function oa(e, { ownerDocument: t, container: n, initialFocus: r, initialFocusFallback: l }) {
2002
- let o = j(null), u = Ae(!!(e & 1), "focus-trap#initial-focus"), s = Bt();
2003
- return Ht(() => {
2004
- if (e === 0) return;
2005
- if (!u) {
2006
- l != null && l.current && me(l.current);
2007
- return;
849
+ return n;
850
+ }, En = function(e, n) {
851
+ for (var r = 0; r < e.length; r++)
852
+ if (e[r].checked && e[r].form === n)
853
+ return e[r];
854
+ }, Nn = function(e) {
855
+ if (!e.name)
856
+ return !0;
857
+ var n = e.form || Fe(e), r = function(m) {
858
+ return n.querySelectorAll('input[type="radio"][name="' + m + '"]');
859
+ }, i;
860
+ if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
861
+ i = r(window.CSS.escape(e.name));
862
+ else
863
+ try {
864
+ i = r(e.name);
865
+ } catch (a) {
866
+ return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", a.message), !1;
867
+ }
868
+ var l = En(i, e.form);
869
+ return !l || l === e;
870
+ }, Tn = function(e) {
871
+ return Pt(e) && e.type === "radio";
872
+ }, Sn = function(e) {
873
+ return Tn(e) && !Nn(e);
874
+ }, On = function(e) {
875
+ var n, r = e && Fe(e), i = (n = r) === null || n === void 0 ? void 0 : n.host, l = !1;
876
+ if (r && r !== e) {
877
+ var a, m, s;
878
+ for (l = !!((a = i) !== null && a !== void 0 && (m = a.ownerDocument) !== null && m !== void 0 && m.contains(i) || e != null && (s = e.ownerDocument) !== null && s !== void 0 && s.contains(e)); !l && i; ) {
879
+ var v, b, x;
880
+ r = Fe(i), i = (v = r) === null || v === void 0 ? void 0 : v.host, l = !!((b = i) !== null && b !== void 0 && (x = b.ownerDocument) !== null && x !== void 0 && x.contains(i));
2008
881
  }
2009
- let i = n.current;
2010
- i && pt(() => {
2011
- if (!s.current) return;
2012
- let p = t == null ? void 0 : t.activeElement;
2013
- if (r != null && r.current) {
2014
- if ((r == null ? void 0 : r.current) === p) {
2015
- o.current = p;
2016
- return;
2017
- }
2018
- } else if (i.contains(p)) {
2019
- o.current = p;
2020
- return;
882
+ }
883
+ return l;
884
+ }, lt = function(e) {
885
+ var n = e.getBoundingClientRect(), r = n.width, i = n.height;
886
+ return r === 0 && i === 0;
887
+ }, Fn = function(e, n) {
888
+ var r = n.displayCheck, i = n.getShadowRoot;
889
+ if (getComputedStyle(e).visibility === "hidden")
890
+ return !0;
891
+ var l = ie.call(e, "details>summary:first-of-type"), a = l ? e.parentElement : e;
892
+ if (ie.call(a, "details:not([open]) *"))
893
+ return !0;
894
+ if (!r || r === "full" || r === "legacy-full") {
895
+ if (typeof i == "function") {
896
+ for (var m = e; e; ) {
897
+ var s = e.parentElement, v = Fe(e);
898
+ if (s && !s.shadowRoot && i(s) === !0)
899
+ return lt(e);
900
+ e.assignedSlot ? e = e.assignedSlot : !s && v !== e.ownerDocument ? e = v.host : e = s;
2021
901
  }
2022
- if (r != null && r.current) me(r.current);
2023
- else {
2024
- if (e & 16) {
2025
- if (ze(i, pe.First | pe.AutoFocus) !== Mt.Error) return;
2026
- } else if (ze(i, pe.First) !== Mt.Error) return;
2027
- if (l != null && l.current && (me(l.current), (t == null ? void 0 : t.activeElement) === l.current)) return;
2028
- console.warn("There are no focusable elements inside the <FocusTrap />");
902
+ e = m;
903
+ }
904
+ if (On(e))
905
+ return !e.getClientRects().length;
906
+ if (r !== "legacy-full")
907
+ return !0;
908
+ } else if (r === "non-zero-area")
909
+ return lt(e);
910
+ return !1;
911
+ }, kn = function(e) {
912
+ if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))
913
+ for (var n = e.parentElement; n; ) {
914
+ if (n.tagName === "FIELDSET" && n.disabled) {
915
+ for (var r = 0; r < n.children.length; r++) {
916
+ var i = n.children.item(r);
917
+ if (i.tagName === "LEGEND")
918
+ return ie.call(n, "fieldset[disabled] *") ? !0 : !i.contains(e);
919
+ }
920
+ return !0;
2029
921
  }
2030
- o.current = t == null ? void 0 : t.activeElement;
2031
- });
2032
- }, [l, u, e]), o;
2033
- }
2034
- function ua(e, { ownerDocument: t, container: n, containers: r, previousActiveElement: l }) {
2035
- let o = Bt(), u = !!(e & 4);
2036
- Ln(t == null ? void 0 : t.defaultView, "focus", (s) => {
2037
- if (!u || !o.current) return;
2038
- let i = Vn(r);
2039
- n.current instanceof HTMLElement && i.add(n.current);
2040
- let p = l.current;
2041
- if (!p) return;
2042
- let c = s.target;
2043
- c && c instanceof HTMLElement ? Yn(i, c) ? (l.current = c, me(c)) : (s.preventDefault(), s.stopPropagation(), me(p)) : me(l.current);
2044
- }, !0);
2045
- }
2046
- function Yn(e, t) {
2047
- for (let n of e) if (n.contains(t)) return !0;
922
+ n = n.parentElement;
923
+ }
2048
924
  return !1;
925
+ }, Ce = function(e, n) {
926
+ return !(n.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
927
+ // because we're limited in the type of selectors we can use in JSDom (see related
928
+ // note related to `candidateSelectors`)
929
+ ke(n) || wn(n) || Fn(n, e) || // For a details element with a summary, the summary element gets the focus
930
+ xn(n) || kn(n));
931
+ }, Ve = function(e, n) {
932
+ return !(Sn(n) || ne(n) < 0 || !Ce(e, n));
933
+ }, Cn = function(e) {
934
+ var n = parseInt(e.getAttribute("tabindex"), 10);
935
+ return !!(isNaN(n) || n >= 0);
936
+ }, Pn = function t(e) {
937
+ var n = [], r = [];
938
+ return e.forEach(function(i, l) {
939
+ var a = !!i.scopeParent, m = a ? i.scopeParent : i, s = gn(m, a), v = a ? t(i.candidates) : m;
940
+ s === 0 ? a ? n.push.apply(n, v) : n.push(m) : r.push({
941
+ documentOrder: l,
942
+ tabIndex: s,
943
+ item: i,
944
+ isScope: a,
945
+ content: v
946
+ });
947
+ }), r.sort(yn).reduce(function(i, l) {
948
+ return l.isScope ? i.push.apply(i, l.content) : i.push(l.content), i;
949
+ }, []).concat(n);
950
+ }, In = function(e, n) {
951
+ n = n || {};
952
+ var r;
953
+ return n.getShadowRoot ? r = kt([e], n.includeContainer, {
954
+ filter: Ve.bind(null, n),
955
+ flatten: !1,
956
+ getShadowRoot: n.getShadowRoot,
957
+ shadowRootFilter: Cn
958
+ }) : r = Ft(e, n.includeContainer, Ve.bind(null, n)), Pn(r);
959
+ }, Rn = function(e, n) {
960
+ n = n || {};
961
+ var r;
962
+ return n.getShadowRoot ? r = kt([e], n.includeContainer, {
963
+ filter: Ce.bind(null, n),
964
+ flatten: !0,
965
+ getShadowRoot: n.getShadowRoot
966
+ }) : r = Ft(e, n.includeContainer, Ce.bind(null, n)), r;
967
+ }, ue = function(e, n) {
968
+ if (n = n || {}, !e)
969
+ throw new Error("No node provided");
970
+ return ie.call(e, Oe) === !1 ? !1 : Ve(n, e);
971
+ }, An = /* @__PURE__ */ St.concat("iframe").join(","), Ke = function(e, n) {
972
+ if (n = n || {}, !e)
973
+ throw new Error("No node provided");
974
+ return ie.call(e, An) === !1 ? !1 : Ce(n, e);
975
+ };
976
+ let tt = Pe(null);
977
+ tt.displayName = "OpenClosedContext";
978
+ var re = ((t) => (t[t.Open = 1] = "Open", t[t.Closed = 2] = "Closed", t[t.Closing = 4] = "Closing", t[t.Opening = 8] = "Opening", t))(re || {});
979
+ function It() {
980
+ return de(tt);
981
+ }
982
+ function Mn({ value: t, children: e }) {
983
+ return B.createElement(tt.Provider, { value: t }, e);
984
+ }
985
+ function Ln() {
986
+ let t = typeof document > "u";
987
+ return "useSyncExternalStore" in ve ? ((e) => e.useSyncExternalStore)(ve)(() => () => {
988
+ }, () => !1, () => !t) : !1;
989
+ }
990
+ function Rt() {
991
+ let t = Ln(), [e, n] = ve.useState(Ee.isHandoffComplete);
992
+ return e && Ee.isHandoffComplete === !1 && n(!1), ve.useEffect(() => {
993
+ e !== !0 && n(!0);
994
+ }, [e]), ve.useEffect(() => Ee.handoff(), []), t ? !1 : e;
995
+ }
996
+ function jn() {
997
+ let t = j(!1);
998
+ return Q(() => (t.current = !0, () => {
999
+ t.current = !1;
1000
+ }), []), t;
1001
+ }
1002
+ function At(t) {
1003
+ var e;
1004
+ return !!(t.enter || t.enterFrom || t.enterTo || t.leave || t.leaveFrom || t.leaveTo) || ((e = t.as) != null ? e : Lt) !== ae || B.Children.count(t.children) === 1;
2049
1005
  }
2050
- function Xn(e) {
2051
- var t;
2052
- return !!(e.enter || e.enterFrom || e.enterTo || e.leave || e.leaveFrom || e.leaveTo) || ((t = e.as) != null ? t : Kn) !== se || O.Children.count(e.children) === 1;
2053
- }
2054
- let vt = ae(null);
2055
- vt.displayName = "TransitionContext";
2056
- var sa = ((e) => (e.Visible = "visible", e.Hidden = "hidden", e))(sa || {});
2057
- function ca() {
2058
- let e = Z(vt);
2059
- if (e === null) throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
2060
- return e;
2061
- }
2062
- function da() {
2063
- let e = Z(gt);
2064
- if (e === null) throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
2065
- return e;
1006
+ let je = Pe(null);
1007
+ je.displayName = "TransitionContext";
1008
+ var Dn = ((t) => (t.Visible = "visible", t.Hidden = "hidden", t))(Dn || {});
1009
+ function $n() {
1010
+ let t = de(je);
1011
+ if (t === null) throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
1012
+ return t;
2066
1013
  }
2067
- let gt = ae(null);
2068
- gt.displayName = "NestingContext";
2069
- function wt(e) {
2070
- return "children" in e ? wt(e.children) : e.current.filter(({ el: t }) => t.current !== null).filter(({ state: t }) => t === "visible").length > 0;
1014
+ function Un() {
1015
+ let t = de(De);
1016
+ if (t === null) throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
1017
+ return t;
2071
1018
  }
2072
- function qn(e, t) {
2073
- let n = ke(e), r = j([]), l = Bt(), o = Wt(), u = A((y, g = ge.Hidden) => {
2074
- let f = r.current.findIndex(({ el: d }) => d === y);
2075
- f !== -1 && (we(g, { [ge.Unmount]() {
2076
- r.current.splice(f, 1);
2077
- }, [ge.Hidden]() {
2078
- r.current[f].state = "hidden";
2079
- } }), o.microTask(() => {
1019
+ let De = Pe(null);
1020
+ De.displayName = "NestingContext";
1021
+ function $e(t) {
1022
+ return "children" in t ? $e(t.children) : t.current.filter(({ el: e }) => e.current !== null).filter(({ state: e }) => e === "visible").length > 0;
1023
+ }
1024
+ function Mt(t, e) {
1025
+ let n = wt(t), r = j([]), i = jn(), l = yt(), a = G((E, c = J.Hidden) => {
1026
+ let g = r.current.findIndex(({ el: d }) => d === E);
1027
+ g !== -1 && (Le(c, { [J.Unmount]() {
1028
+ r.current.splice(g, 1);
1029
+ }, [J.Hidden]() {
1030
+ r.current[g].state = "hidden";
1031
+ } }), l.microTask(() => {
2080
1032
  var d;
2081
- !wt(r) && l.current && ((d = n.current) == null || d.call(n));
1033
+ !$e(r) && i.current && ((d = n.current) == null || d.call(n));
2082
1034
  }));
2083
- }), s = A((y) => {
2084
- let g = r.current.find(({ el: f }) => f === y);
2085
- return g ? g.state !== "visible" && (g.state = "visible") : r.current.push({ el: y, state: "visible" }), () => u(y, ge.Unmount);
2086
- }), i = j([]), p = j(Promise.resolve()), c = j({ enter: [], leave: [] }), w = A((y, g, f) => {
2087
- i.current.splice(0), t && (t.chains.current[g] = t.chains.current[g].filter(([d]) => d !== y)), t == null || t.chains.current[g].push([y, new Promise((d) => {
2088
- i.current.push(d);
2089
- })]), t == null || t.chains.current[g].push([y, new Promise((d) => {
2090
- Promise.all(c.current[g].map(([m, v]) => v)).then(() => d());
2091
- })]), g === "enter" ? p.current = p.current.then(() => t == null ? void 0 : t.wait.current).then(() => f(g)) : f(g);
2092
- }), b = A((y, g, f) => {
2093
- Promise.all(c.current[g].splice(0).map(([d, m]) => m)).then(() => {
1035
+ }), m = G((E) => {
1036
+ let c = r.current.find(({ el: g }) => g === E);
1037
+ return c ? c.state !== "visible" && (c.state = "visible") : r.current.push({ el: E, state: "visible" }), () => a(E, J.Unmount);
1038
+ }), s = j([]), v = j(Promise.resolve()), b = j({ enter: [], leave: [] }), x = G((E, c, g) => {
1039
+ s.current.splice(0), e && (e.chains.current[c] = e.chains.current[c].filter(([d]) => d !== E)), e == null || e.chains.current[c].push([E, new Promise((d) => {
1040
+ s.current.push(d);
1041
+ })]), e == null || e.chains.current[c].push([E, new Promise((d) => {
1042
+ Promise.all(b.current[c].map(([f, p]) => p)).then(() => d());
1043
+ })]), c === "enter" ? v.current = v.current.then(() => e == null ? void 0 : e.wait.current).then(() => g(c)) : g(c);
1044
+ }), T = G((E, c, g) => {
1045
+ Promise.all(b.current[c].splice(0).map(([d, f]) => f)).then(() => {
2094
1046
  var d;
2095
- (d = i.current.shift()) == null || d();
2096
- }).then(() => f(g));
1047
+ (d = s.current.shift()) == null || d();
1048
+ }).then(() => g(c));
2097
1049
  });
2098
- return B(() => ({ children: r, register: s, unregister: u, onStart: w, onStop: b, wait: p, chains: c }), [s, u, r, w, b, c, p]);
1050
+ return Y(() => ({ children: r, register: m, unregister: a, onStart: x, onStop: T, wait: v, chains: b }), [m, a, r, x, T, b, v]);
2099
1051
  }
2100
- let Kn = se, zn = it.RenderStrategy;
2101
- function fa(e, t) {
1052
+ let Lt = ae, jt = xt.RenderStrategy;
1053
+ function Wn(t, e) {
2102
1054
  var n, r;
2103
- let { transition: l = !0, beforeEnter: o, afterEnter: u, beforeLeave: s, afterLeave: i, enter: p, enterFrom: c, enterTo: w, entered: b, leave: y, leaveFrom: g, leaveTo: f, ...d } = e, [m, v] = V(null), x = j(null), T = Xn(e), F = ce(...T ? [x, t, v] : t === null ? [] : [t]), X = (n = d.unmount) == null || n ? ge.Unmount : ge.Hidden, { show: U, appear: ee, initial: te } = ca(), [H, q] = V(U ? "visible" : "hidden"), G = da(), { register: M, unregister: $ } = G;
2104
- z(() => M(x), [M, x]), z(() => {
2105
- if (X === ge.Hidden && x.current) {
2106
- if (U && H !== "visible") {
2107
- q("visible");
1055
+ let { transition: i = !0, beforeEnter: l, afterEnter: a, beforeLeave: m, afterLeave: s, enter: v, enterFrom: b, enterTo: x, entered: T, leave: E, leaveFrom: c, leaveTo: g, ...d } = t, [f, p] = $(null), y = j(null), N = At(t), h = Tt(...N ? [y, e, p] : e === null ? [] : [e]), k = (n = d.unmount) == null || n ? J.Unmount : J.Hidden, { show: A, appear: H, initial: K } = $n(), [U, W] = $(A ? "visible" : "hidden"), O = Un(), { register: o, unregister: u } = O;
1056
+ Q(() => o(y), [o, y]), Q(() => {
1057
+ if (k === J.Hidden && y.current) {
1058
+ if (A && U !== "visible") {
1059
+ W("visible");
2108
1060
  return;
2109
1061
  }
2110
- return we(H, { hidden: () => $(x), visible: () => M(x) });
2111
- }
2112
- }, [H, x, M, $, U, X]);
2113
- let I = Ze();
2114
- z(() => {
2115
- if (T && I && H === "visible" && x.current === null) throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
2116
- }, [x, H, I, T]);
2117
- let be = te && !ee, xe = ee && U && te, he = j(!1), ne = qn(() => {
2118
- he.current || (q("hidden"), $(x));
2119
- }, G), Ee = A((Pe) => {
2120
- he.current = !0;
2121
- let de = Pe ? "enter" : "leave";
2122
- ne.onStart(x, de, (fe) => {
2123
- fe === "enter" ? o == null || o() : fe === "leave" && (s == null || s());
1062
+ return Le(U, { hidden: () => u(y), visible: () => o(y) });
1063
+ }
1064
+ }, [U, y, o, u, A, k]);
1065
+ let w = Rt();
1066
+ Q(() => {
1067
+ if (N && w && U === "visible" && y.current === null) throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
1068
+ }, [y, U, w, N]);
1069
+ let C = K && !H, P = H && A && K, I = j(!1), S = Mt(() => {
1070
+ I.current || (W("hidden"), u(y));
1071
+ }, O), R = G((ee) => {
1072
+ I.current = !0;
1073
+ let Z = ee ? "enter" : "leave";
1074
+ S.onStart(y, Z, (ce) => {
1075
+ ce === "enter" ? l == null || l() : ce === "leave" && (m == null || m());
2124
1076
  });
2125
- }), N = A((Pe) => {
2126
- let de = Pe ? "enter" : "leave";
2127
- he.current = !1, ne.onStop(x, de, (fe) => {
2128
- fe === "enter" ? u == null || u() : fe === "leave" && (i == null || i());
2129
- }), de === "leave" && !wt(ne) && (q("hidden"), $(x));
1077
+ }), M = G((ee) => {
1078
+ let Z = ee ? "enter" : "leave";
1079
+ I.current = !1, S.onStop(y, Z, (ce) => {
1080
+ ce === "enter" ? a == null || a() : ce === "leave" && (s == null || s());
1081
+ }), Z === "leave" && !$e(S) && (W("hidden"), u(y));
2130
1082
  });
2131
- L(() => {
2132
- T && l || (Ee(U), N(U));
2133
- }, [U, T, l]);
2134
- let Te = !(!l || !T || !I || be), [, Y] = Ml(Te, m, U, { start: Ee, end: N }), bt = Se({ ref: F, className: ((r = kt(d.className, xe && p, xe && c, Y.enter && p, Y.enter && Y.closed && c, Y.enter && !Y.closed && w, Y.leave && y, Y.leave && !Y.closed && g, Y.leave && Y.closed && f, !Y.transition && U && b)) == null ? void 0 : r.trim()) || void 0, ..._l(Y) }), Oe = 0;
2135
- H === "visible" && (Oe |= ue.Open), H === "hidden" && (Oe |= ue.Closed), Y.enter && (Oe |= ue.Opening), Y.leave && (Oe |= ue.Closing);
2136
- let Ie = ie();
2137
- return O.createElement(gt.Provider, { value: ne }, O.createElement(Nl, { value: Oe }, Ie({ ourProps: bt, theirProps: d, defaultTag: Kn, features: zn, visible: H === "visible", name: "Transition.Child" })));
2138
- }
2139
- function pa(e, t) {
2140
- let { show: n, appear: r = !1, unmount: l = !0, ...o } = e, u = j(null), s = Xn(e), i = ce(...s ? [u, t] : t === null ? [] : [t]);
2141
- Ze();
2142
- let p = ht();
2143
- if (n === void 0 && p !== null && (n = (p & ue.Open) === ue.Open), n === void 0) throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");
2144
- let [c, w] = V(n ? "visible" : "hidden"), b = qn(() => {
2145
- n || w("hidden");
2146
- }), [y, g] = V(!0), f = j([n]);
2147
- z(() => {
2148
- y !== !1 && f.current[f.current.length - 1] !== n && (f.current.push(n), g(!1));
2149
- }, [f, n]);
2150
- let d = B(() => ({ show: n, appear: r, initial: y }), [n, r, y]);
2151
- z(() => {
2152
- n ? w("visible") : !wt(b) && u.current !== null && w("hidden");
2153
- }, [n, b]);
2154
- let m = { unmount: l }, v = A(() => {
2155
- var F;
2156
- y && g(!1), (F = e.beforeEnter) == null || F.call(e);
2157
- }), x = A(() => {
2158
- var F;
2159
- y && g(!1), (F = e.beforeLeave) == null || F.call(e);
2160
- }), T = ie();
2161
- return O.createElement(gt.Provider, { value: b }, O.createElement(vt.Provider, { value: d }, T({ ourProps: { ...m, as: se, children: O.createElement(Gn, { ref: i, ...m, ...o, beforeEnter: v, beforeLeave: x }) }, theirProps: {}, defaultTag: se, features: zn, visible: c === "visible", name: "Transition" })));
2162
- }
2163
- function ma(e, t) {
2164
- let n = Z(vt) !== null, r = ht() !== null;
2165
- return O.createElement(O.Fragment, null, !n && r ? O.createElement(Lt, { ref: t, ...e }) : O.createElement(Gn, { ref: t, ...e }));
2166
- }
2167
- let Lt = Q(pa), Gn = Q(fa), Le = Q(ma), Jn = Object.assign(Lt, { Child: Le, Root: Lt });
2168
- var ha = ((e) => (e[e.Open = 0] = "Open", e[e.Closed = 1] = "Closed", e))(ha || {}), va = ((e) => (e[e.SetTitleId = 0] = "SetTitleId", e))(va || {});
2169
- let ga = { 0(e, t) {
2170
- return e.titleId === t.id ? e : { ...e, titleId: t.id };
2171
- } }, Vt = ae(null);
2172
- Vt.displayName = "DialogContext";
2173
- function yt(e) {
2174
- let t = Z(Vt);
2175
- if (t === null) {
2176
- let n = new Error(`<${e} /> is missing a parent <Dialog /> component.`);
2177
- throw Error.captureStackTrace && Error.captureStackTrace(n, yt), n;
2178
- }
2179
- return t;
2180
- }
2181
- function wa(e, t) {
2182
- return we(t.type, ga, e, t);
2183
- }
2184
- let wn = Q(function(e, t) {
2185
- let n = Ge(), { id: r = `headlessui-dialog-${n}`, open: l, onClose: o, initialFocus: u, role: s = "dialog", autoFocus: i = !0, __demoMode: p = !1, unmount: c = !1, ...w } = e, b = j(!1);
2186
- s = function() {
2187
- return s === "dialog" || s === "alertdialog" ? s : (b.current || (b.current = !0, console.warn(`Invalid role [${s}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)), "dialog");
2188
- }();
2189
- let y = ht();
2190
- l === void 0 && y !== null && (l = (y & ue.Open) === ue.Open);
2191
- let g = j(null), f = ce(g, t), d = Je(g), m = l ? 0 : 1, [v, x] = Fr(wa, { titleId: null, descriptionId: null, panelRef: kr() }), T = A(() => o(!1)), F = A((N) => x({ type: 0, id: N })), X = Ze() ? m === 0 : !1, [U, ee] = Kl(), te = { get current() {
2192
- var N;
2193
- return (N = v.panelRef.current) != null ? N : g.current;
2194
- } }, H = Bn(), { resolveContainers: q } = Ql({ mainTreeNode: H, portals: U, defaultContainers: [te] }), G = y !== null ? (y & ue.Closing) === ue.Closing : !1;
2195
- dl(p || G ? !1 : X, { allowed: A(() => {
2196
- var N, Te;
2197
- return [(Te = (N = g.current) == null ? void 0 : N.closest("[data-headlessui-portal]")) != null ? Te : null];
2198
- }), disallowed: A(() => {
2199
- var N;
2200
- return [(N = H == null ? void 0 : H.closest("body > *:not(#headlessui-portal-root)")) != null ? N : null];
2201
- }) }), Ol(X, q, (N) => {
2202
- N.preventDefault(), T();
2203
- }), Jl(X, d == null ? void 0 : d.defaultView, (N) => {
2204
- N.preventDefault(), N.stopPropagation(), document.activeElement && "blur" in document.activeElement && typeof document.activeElement.blur == "function" && document.activeElement.blur(), T();
2205
- }), Fl(p || G ? !1 : X, d, q), fl(X, g, T);
2206
- let [M, $] = nl(), I = B(() => [{ dialogState: m, close: T, setTitleId: F, unmount: c }, v], [m, v, T, F, c]), be = B(() => ({ open: m === 0 }), [m]), xe = { ref: f, id: r, role: s, tabIndex: -1, "aria-modal": p ? void 0 : m === 0 ? !0 : void 0, "aria-labelledby": v.titleId, "aria-describedby": M, unmount: c }, he = !Zl(), ne = Ce.None;
2207
- X && !p && (ne |= Ce.RestoreFocus, ne |= Ce.TabLock, i && (ne |= Ce.AutoFocus), he && (ne |= Ce.InitialFocus));
2208
- let Ee = ie();
2209
- return O.createElement(Dl, null, O.createElement(vn, { force: !0 }, O.createElement(Gl, null, O.createElement(Vt.Provider, { value: I }, O.createElement(Un, { target: g }, O.createElement(vn, { force: !1 }, O.createElement($, { slot: be }, O.createElement(ee, null, O.createElement(la, { initialFocus: u, initialFocusFallback: g, containers: q, features: ne }, O.createElement(ul, { value: T }, Ee({ ourProps: xe, theirProps: w, slot: be, defaultTag: ya, features: ba, visible: m === 0, name: "Dialog" })))))))))));
2210
- }), ya = "div", ba = it.RenderStrategy | it.Static;
2211
- function xa(e, t) {
2212
- let { transition: n = !1, open: r, ...l } = e, o = ht(), u = e.hasOwnProperty("open") || o !== null, s = e.hasOwnProperty("onClose");
2213
- if (!u && !s) throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");
2214
- if (!u) throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");
2215
- if (!s) throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");
2216
- if (!o && typeof e.open != "boolean") throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);
2217
- 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}`);
2218
- return (r !== void 0 || n) && !l.static ? O.createElement(gn, null, O.createElement(Jn, { show: r, transition: n, unmount: l.unmount }, O.createElement(wn, { ref: t, ...l }))) : O.createElement(gn, null, O.createElement(wn, { ref: t, open: r, ...l }));
2219
- }
2220
- let Ea = "div";
2221
- function Ta(e, t) {
2222
- let n = Ge(), { id: r = `headlessui-dialog-panel-${n}`, transition: l = !1, ...o } = e, [{ dialogState: u, unmount: s }, i] = yt("Dialog.Panel"), p = ce(t, i.panelRef), c = B(() => ({ open: u === 0 }), [u]), w = A((d) => {
2223
- d.stopPropagation();
2224
- }), b = { ref: p, id: r, onClick: w }, y = l ? Le : se, g = l ? { unmount: s } : {}, f = ie();
2225
- return O.createElement(y, { ...g }, f({ ourProps: b, theirProps: o, slot: c, defaultTag: Ea, name: "Dialog.Panel" }));
2226
- }
2227
- let Oa = "div";
2228
- function Pa(e, t) {
2229
- let { transition: n = !1, ...r } = e, [{ dialogState: l, unmount: o }] = yt("Dialog.Backdrop"), u = B(() => ({ open: l === 0 }), [l]), s = { ref: t, "aria-hidden": !0 }, i = n ? Le : se, p = n ? { unmount: o } : {}, c = ie();
2230
- return O.createElement(i, { ...p }, c({ ourProps: s, theirProps: r, slot: u, defaultTag: Oa, name: "Dialog.Backdrop" }));
2231
- }
2232
- let Ra = "h2";
2233
- function Sa(e, t) {
2234
- let n = Ge(), { id: r = `headlessui-dialog-title-${n}`, ...l } = e, [{ dialogState: o, setTitleId: u }] = yt("Dialog.Title"), s = ce(t);
2235
- L(() => (u(r), () => u(null)), [r, u]);
2236
- let i = B(() => ({ open: o === 0 }), [o]), p = { ref: s, id: r };
2237
- return ie()({ ourProps: p, theirProps: l, slot: i, defaultTag: Ra, name: "Dialog.Title" });
2238
- }
2239
- let Ca = Q(xa), Yt = Q(Ta);
2240
- Q(Pa);
2241
- let $a = Q(Sa), Fa = Object.assign(Ca, { Panel: Yt, Title: $a, Description: il });
2242
- function Zn({ onClick: e }) {
2243
- return /* @__PURE__ */ R.jsxs(
1083
+ D(() => {
1084
+ N && i || (R(A), M(A));
1085
+ }, [A, N, i]);
1086
+ let z = !(!i || !N || !w || C), [, L] = mn(z, f, A, { start: R, end: M }), _ = te({ ref: h, className: ((r = _e(d.className, P && v, P && b, L.enter && v, L.enter && L.closed && b, L.enter && !L.closed && x, L.leave && E, L.leave && !L.closed && c, L.leave && L.closed && g, !L.transition && A && T)) == null ? void 0 : r.trim()) || void 0, ...fn(L) }), q = 0;
1087
+ U === "visible" && (q |= re.Open), U === "hidden" && (q |= re.Closed), L.enter && (q |= re.Opening), L.leave && (q |= re.Closing);
1088
+ let ye = Et();
1089
+ return B.createElement(De.Provider, { value: S }, B.createElement(Mn, { value: q }, ye({ ourProps: _, theirProps: d, defaultTag: Lt, features: jt, visible: U === "visible", name: "Transition.Child" })));
1090
+ }
1091
+ function Bn(t, e) {
1092
+ let { show: n, appear: r = !1, unmount: i = !0, ...l } = t, a = j(null), m = At(t), s = Tt(...m ? [a, e] : e === null ? [] : [e]);
1093
+ Rt();
1094
+ let v = It();
1095
+ if (n === void 0 && v !== null && (n = (v & re.Open) === re.Open), n === void 0) throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");
1096
+ let [b, x] = $(n ? "visible" : "hidden"), T = Mt(() => {
1097
+ n || x("hidden");
1098
+ }), [E, c] = $(!0), g = j([n]);
1099
+ Q(() => {
1100
+ E !== !1 && g.current[g.current.length - 1] !== n && (g.current.push(n), c(!1));
1101
+ }, [g, n]);
1102
+ let d = Y(() => ({ show: n, appear: r, initial: E }), [n, r, E]);
1103
+ Q(() => {
1104
+ n ? x("visible") : !$e(T) && a.current !== null && x("hidden");
1105
+ }, [n, T]);
1106
+ let f = { unmount: i }, p = G(() => {
1107
+ var h;
1108
+ E && c(!1), (h = t.beforeEnter) == null || h.call(t);
1109
+ }), y = G(() => {
1110
+ var h;
1111
+ E && c(!1), (h = t.beforeLeave) == null || h.call(t);
1112
+ }), N = Et();
1113
+ return B.createElement(De.Provider, { value: T }, B.createElement(je.Provider, { value: d }, N({ ourProps: { ...f, as: ae, children: B.createElement(Dt, { ref: s, ...f, ...l, beforeEnter: p, beforeLeave: y }) }, theirProps: {}, defaultTag: ae, features: jt, visible: b === "visible", name: "Transition" })));
1114
+ }
1115
+ function Hn(t, e) {
1116
+ let n = de(je) !== null, r = It() !== null;
1117
+ return B.createElement(B.Fragment, null, !n && r ? B.createElement(ze, { ref: e, ...t }) : B.createElement(Dt, { ref: e, ...t }));
1118
+ }
1119
+ let ze = et(Bn), Dt = et(Wn), Ue = et(Hn), Kn = Object.assign(ze, { Child: Ue, Root: ze });
1120
+ function $t({ onClick: t }) {
1121
+ return /* @__PURE__ */ le(
2244
1122
  "button",
2245
1123
  {
2246
1124
  type: "button",
2247
1125
  className: "im-close-button text-gray-400 hover:text-gray-500",
2248
- onClick: e,
1126
+ onClick: t,
2249
1127
  children: [
2250
- /* @__PURE__ */ R.jsx("span", { className: "sr-only", children: "Close" }),
2251
- /* @__PURE__ */ R.jsx(
1128
+ /* @__PURE__ */ F("span", { className: "sr-only", children: "Close" }),
1129
+ /* @__PURE__ */ F(
2252
1130
  "svg",
2253
1131
  {
2254
1132
  className: "size-6",
@@ -2258,7 +1136,7 @@ function Zn({ onClick: e }) {
2258
1136
  strokeWidth: "2",
2259
1137
  stroke: "currentColor",
2260
1138
  "aria-hidden": "true",
2261
- children: /* @__PURE__ */ R.jsx(
1139
+ children: /* @__PURE__ */ F(
2262
1140
  "path",
2263
1141
  {
2264
1142
  strokeLinecap: "round",
@@ -2272,114 +1150,626 @@ function Zn({ onClick: e }) {
2272
1150
  }
2273
1151
  );
2274
1152
  }
2275
- const ka = ({ modalContext: e, config: t, children: n }) => /* @__PURE__ */ R.jsx("div", { className: "im-modal-container fixed inset-0 z-40 overflow-y-auto p-4", children: /* @__PURE__ */ R.jsx(
2276
- "div",
2277
- {
2278
- className: at("im-modal-positioner flex min-h-full justify-center", {
2279
- "items-start": t.position === "top",
2280
- "items-center": t.position === "center",
2281
- "items-end": t.position === "bottom"
2282
- }),
2283
- children: /* @__PURE__ */ R.jsx(
2284
- Le,
2285
- {
2286
- enterFrom: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
2287
- enterTo: "opacity-100 translate-y-0 sm:scale-100",
2288
- leaveFrom: "opacity-100 translate-y-0 sm:scale-100",
2289
- leaveTo: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
2290
- afterLeave: e.afterLeave,
2291
- className: at("im-modal-wrapper w-full transition duration-300 ease-in-out", e.onTopOfStack ? "" : "blur-sm", {
2292
- "sm:max-w-sm": t.maxWidth === "sm",
2293
- "sm:max-w-md": t.maxWidth === "md",
2294
- "sm:max-w-md md:max-w-lg": t.maxWidth === "lg",
2295
- "sm:max-w-md md:max-w-xl": t.maxWidth === "xl",
2296
- "sm:max-w-md md:max-w-xl lg:max-w-2xl": t.maxWidth === "2xl",
2297
- "sm:max-w-md md:max-w-xl lg:max-w-3xl": t.maxWidth === "3xl",
2298
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl": t.maxWidth === "4xl",
2299
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl": t.maxWidth === "5xl",
2300
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl": t.maxWidth === "6xl",
2301
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl": t.maxWidth === "7xl"
2302
- }),
2303
- children: /* @__PURE__ */ R.jsxs(Yt, { className: `im-modal-content relative ${t.paddingClasses} ${t.panelClasses}`, children: [
2304
- t.closeButton && /* @__PURE__ */ R.jsx("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ R.jsx(Zn, { onClick: e.close }) }),
2305
- typeof n == "function" ? n({ modalContext: e, config: t }) : n
2306
- ] })
2307
- }
2308
- )
1153
+ /*!
1154
+ * focus-trap 7.6.2
1155
+ * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
1156
+ */
1157
+ function Ge(t, e) {
1158
+ (e == null || e > t.length) && (e = t.length);
1159
+ for (var n = 0, r = Array(e); n < e; n++) r[n] = t[n];
1160
+ return r;
1161
+ }
1162
+ function qn(t) {
1163
+ if (Array.isArray(t)) return Ge(t);
1164
+ }
1165
+ function Xn(t, e, n) {
1166
+ return (e = Zn(e)) in t ? Object.defineProperty(t, e, {
1167
+ value: n,
1168
+ enumerable: !0,
1169
+ configurable: !0,
1170
+ writable: !0
1171
+ }) : t[e] = n, t;
1172
+ }
1173
+ function _n(t) {
1174
+ if (typeof Symbol < "u" && t[Symbol.iterator] != null || t["@@iterator"] != null) return Array.from(t);
1175
+ }
1176
+ function Vn() {
1177
+ throw new TypeError(`Invalid attempt to spread non-iterable instance.
1178
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1179
+ }
1180
+ function st(t, e) {
1181
+ var n = Object.keys(t);
1182
+ if (Object.getOwnPropertySymbols) {
1183
+ var r = Object.getOwnPropertySymbols(t);
1184
+ e && (r = r.filter(function(i) {
1185
+ return Object.getOwnPropertyDescriptor(t, i).enumerable;
1186
+ })), n.push.apply(n, r);
2309
1187
  }
2310
- ) }), ja = ({ modalContext: e, config: t, children: n }) => /* @__PURE__ */ R.jsx("div", { className: "im-slideover-container fixed inset-0 z-40 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ R.jsx(
2311
- "div",
2312
- {
2313
- className: at("im-slideover-positioner flex min-h-full items-center", {
2314
- "justify-start": t.position === "left",
2315
- "justify-end": t.position === "right"
2316
- }),
2317
- children: /* @__PURE__ */ R.jsx(
2318
- Le,
2319
- {
2320
- enterFrom: `opacity-0 ${t.position === "left" ? "-translate-x-full" : "translate-x-full"}`,
2321
- enterTo: "opacity-100 translate-x-0",
2322
- leaveFrom: "opacity-100 translate-x-0",
2323
- leaveTo: `opacity-0 ${t.position === "left" ? "-translate-x-full" : "translate-x-full"}`,
2324
- afterLeave: e.afterLeave,
2325
- className: at("im-slideover-wrapper w-full transition duration-300 ease-in-out", e.onTopOfStack ? "" : "blur-sm", {
2326
- "sm:max-w-sm": t.maxWidth === "sm",
2327
- "sm:max-w-md": t.maxWidth === "md",
2328
- "sm:max-w-md md:max-w-lg": t.maxWidth === "lg",
2329
- "sm:max-w-md md:max-w-xl": t.maxWidth === "xl",
2330
- "sm:max-w-md md:max-w-xl lg:max-w-2xl": t.maxWidth === "2xl",
2331
- "sm:max-w-md md:max-w-xl lg:max-w-3xl": t.maxWidth === "3xl",
2332
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl": t.maxWidth === "4xl",
2333
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl": t.maxWidth === "5xl",
2334
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl": t.maxWidth === "6xl",
2335
- "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl": t.maxWidth === "7xl"
2336
- }),
2337
- children: /* @__PURE__ */ R.jsxs(Yt, { className: `im-slideover-content relative ${t.paddingClasses} ${t.panelClasses}`, children: [
2338
- t.closeButton && /* @__PURE__ */ R.jsx("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ R.jsx(Zn, { onClick: e.close }) }),
2339
- typeof n == "function" ? n({ modalContext: e, config: t }) : n
2340
- ] })
1188
+ return n;
1189
+ }
1190
+ function ot(t) {
1191
+ for (var e = 1; e < arguments.length; e++) {
1192
+ var n = arguments[e] != null ? arguments[e] : {};
1193
+ e % 2 ? st(Object(n), !0).forEach(function(r) {
1194
+ Xn(t, r, n[r]);
1195
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : st(Object(n)).forEach(function(r) {
1196
+ Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(n, r));
1197
+ });
1198
+ }
1199
+ return t;
1200
+ }
1201
+ function zn(t) {
1202
+ return qn(t) || _n(t) || Yn(t) || Vn();
1203
+ }
1204
+ function Gn(t, e) {
1205
+ if (typeof t != "object" || !t) return t;
1206
+ var n = t[Symbol.toPrimitive];
1207
+ if (n !== void 0) {
1208
+ var r = n.call(t, e || "default");
1209
+ if (typeof r != "object") return r;
1210
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1211
+ }
1212
+ return (e === "string" ? String : Number)(t);
1213
+ }
1214
+ function Zn(t) {
1215
+ var e = Gn(t, "string");
1216
+ return typeof e == "symbol" ? e : e + "";
1217
+ }
1218
+ function Yn(t, e) {
1219
+ if (t) {
1220
+ if (typeof t == "string") return Ge(t, e);
1221
+ var n = {}.toString.call(t).slice(8, -1);
1222
+ return n === "Object" && t.constructor && (n = t.constructor.name), n === "Map" || n === "Set" ? Array.from(t) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? Ge(t, e) : void 0;
1223
+ }
1224
+ }
1225
+ var ut = {
1226
+ activateTrap: function(e, n) {
1227
+ if (e.length > 0) {
1228
+ var r = e[e.length - 1];
1229
+ r !== n && r.pause();
1230
+ }
1231
+ var i = e.indexOf(n);
1232
+ i === -1 || e.splice(i, 1), e.push(n);
1233
+ },
1234
+ deactivateTrap: function(e, n) {
1235
+ var r = e.indexOf(n);
1236
+ r !== -1 && e.splice(r, 1), e.length > 0 && e[e.length - 1].unpause();
1237
+ }
1238
+ }, Jn = function(e) {
1239
+ return e.tagName && e.tagName.toLowerCase() === "input" && typeof e.select == "function";
1240
+ }, Qn = function(e) {
1241
+ return (e == null ? void 0 : e.key) === "Escape" || (e == null ? void 0 : e.key) === "Esc" || (e == null ? void 0 : e.keyCode) === 27;
1242
+ }, ge = function(e) {
1243
+ return (e == null ? void 0 : e.key) === "Tab" || (e == null ? void 0 : e.keyCode) === 9;
1244
+ }, er = function(e) {
1245
+ return ge(e) && !e.shiftKey;
1246
+ }, tr = function(e) {
1247
+ return ge(e) && e.shiftKey;
1248
+ }, dt = function(e) {
1249
+ return setTimeout(e, 0);
1250
+ }, pe = function(e) {
1251
+ for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), i = 1; i < n; i++)
1252
+ r[i - 1] = arguments[i];
1253
+ return typeof e == "function" ? e.apply(void 0, r) : e;
1254
+ }, xe = function(e) {
1255
+ return e.target.shadowRoot && typeof e.composedPath == "function" ? e.composedPath()[0] : e.target;
1256
+ }, nr = [], rr = function(e, n) {
1257
+ var r = (n == null ? void 0 : n.document) || document, i = (n == null ? void 0 : n.trapStack) || nr, l = ot({
1258
+ returnFocusOnDeactivate: !0,
1259
+ escapeDeactivates: !0,
1260
+ delayInitialFocus: !0,
1261
+ isKeyForward: er,
1262
+ isKeyBackward: tr
1263
+ }, n), a = {
1264
+ // containers given to createFocusTrap()
1265
+ // @type {Array<HTMLElement>}
1266
+ containers: [],
1267
+ // list of objects identifying tabbable nodes in `containers` in the trap
1268
+ // NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap
1269
+ // is active, but the trap should never get to a state where there isn't at least one group
1270
+ // with at least one tabbable node in it (that would lead to an error condition that would
1271
+ // result in an error being thrown)
1272
+ // @type {Array<{
1273
+ // container: HTMLElement,
1274
+ // tabbableNodes: Array<HTMLElement>, // empty if none
1275
+ // focusableNodes: Array<HTMLElement>, // empty if none
1276
+ // posTabIndexesFound: boolean,
1277
+ // firstTabbableNode: HTMLElement|undefined,
1278
+ // lastTabbableNode: HTMLElement|undefined,
1279
+ // firstDomTabbableNode: HTMLElement|undefined,
1280
+ // lastDomTabbableNode: HTMLElement|undefined,
1281
+ // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
1282
+ // }>}
1283
+ containerGroups: [],
1284
+ // same order/length as `containers` list
1285
+ // references to objects in `containerGroups`, but only those that actually have
1286
+ // tabbable nodes in them
1287
+ // NOTE: same order as `containers` and `containerGroups`, but __not necessarily__
1288
+ // the same length
1289
+ tabbableGroups: [],
1290
+ nodeFocusedBeforeActivation: null,
1291
+ mostRecentlyFocusedNode: null,
1292
+ active: !1,
1293
+ paused: !1,
1294
+ // timer ID for when delayInitialFocus is true and initial focus in this trap
1295
+ // has been delayed during activation
1296
+ delayInitialFocusTimer: void 0,
1297
+ // the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
1298
+ recentNavEvent: void 0
1299
+ }, m, s = function(o, u, w) {
1300
+ return o && o[u] !== void 0 ? o[u] : l[w || u];
1301
+ }, v = function(o, u) {
1302
+ var w = typeof (u == null ? void 0 : u.composedPath) == "function" ? u.composedPath() : void 0;
1303
+ return a.containerGroups.findIndex(function(C) {
1304
+ var P = C.container, I = C.tabbableNodes;
1305
+ return P.contains(o) || // fall back to explicit tabbable search which will take into consideration any
1306
+ // web components if the `tabbableOptions.getShadowRoot` option was used for
1307
+ // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
1308
+ // look inside web components even if open)
1309
+ (w == null ? void 0 : w.includes(P)) || I.find(function(S) {
1310
+ return S === o;
1311
+ });
1312
+ });
1313
+ }, b = function(o) {
1314
+ var u = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, w = u.hasFallback, C = w === void 0 ? !1 : w, P = u.params, I = P === void 0 ? [] : P, S = l[o];
1315
+ if (typeof S == "function" && (S = S.apply(void 0, zn(I))), S === !0 && (S = void 0), !S) {
1316
+ if (S === void 0 || S === !1)
1317
+ return S;
1318
+ throw new Error("`".concat(o, "` was specified but was not a node, or did not return a node"));
1319
+ }
1320
+ var R = S;
1321
+ if (typeof S == "string") {
1322
+ try {
1323
+ R = r.querySelector(S);
1324
+ } catch (M) {
1325
+ throw new Error("`".concat(o, '` appears to be an invalid selector; error="').concat(M.message, '"'));
1326
+ }
1327
+ if (!R && !C)
1328
+ throw new Error("`".concat(o, "` as selector refers to no known node"));
1329
+ }
1330
+ return R;
1331
+ }, x = function() {
1332
+ var o = b("initialFocus", {
1333
+ hasFallback: !0
1334
+ });
1335
+ if (o === !1)
1336
+ return !1;
1337
+ if (o === void 0 || o && !Ke(o, l.tabbableOptions))
1338
+ if (v(r.activeElement) >= 0)
1339
+ o = r.activeElement;
1340
+ else {
1341
+ var u = a.tabbableGroups[0], w = u && u.firstTabbableNode;
1342
+ o = w || b("fallbackFocus");
1343
+ }
1344
+ else o === null && (o = b("fallbackFocus"));
1345
+ if (!o)
1346
+ throw new Error("Your focus-trap needs to have at least one focusable element");
1347
+ return o;
1348
+ }, T = function() {
1349
+ if (a.containerGroups = a.containers.map(function(o) {
1350
+ var u = In(o, l.tabbableOptions), w = Rn(o, l.tabbableOptions), C = u.length > 0 ? u[0] : void 0, P = u.length > 0 ? u[u.length - 1] : void 0, I = w.find(function(M) {
1351
+ return ue(M);
1352
+ }), S = w.slice().reverse().find(function(M) {
1353
+ return ue(M);
1354
+ }), R = !!u.find(function(M) {
1355
+ return ne(M) > 0;
1356
+ });
1357
+ return {
1358
+ container: o,
1359
+ tabbableNodes: u,
1360
+ focusableNodes: w,
1361
+ /** True if at least one node with positive `tabindex` was found in this container. */
1362
+ posTabIndexesFound: R,
1363
+ /** First tabbable node in container, __tabindex__ order; `undefined` if none. */
1364
+ firstTabbableNode: C,
1365
+ /** Last tabbable node in container, __tabindex__ order; `undefined` if none. */
1366
+ lastTabbableNode: P,
1367
+ // NOTE: DOM order is NOT NECESSARILY "document position" order, but figuring that out
1368
+ // would require more than just https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
1369
+ // because that API doesn't work with Shadow DOM as well as it should (@see
1370
+ // https://github.com/whatwg/dom/issues/320) and since this first/last is only needed, so far,
1371
+ // to address an edge case related to positive tabindex support, this seems like a much easier,
1372
+ // "close enough most of the time" alternative for positive tabindexes which should generally
1373
+ // be avoided anyway...
1374
+ /** First tabbable node in container, __DOM__ order; `undefined` if none. */
1375
+ firstDomTabbableNode: I,
1376
+ /** Last tabbable node in container, __DOM__ order; `undefined` if none. */
1377
+ lastDomTabbableNode: S,
1378
+ /**
1379
+ * Finds the __tabbable__ node that follows the given node in the specified direction,
1380
+ * in this container, if any.
1381
+ * @param {HTMLElement} node
1382
+ * @param {boolean} [forward] True if going in forward tab order; false if going
1383
+ * in reverse.
1384
+ * @returns {HTMLElement|undefined} The next tabbable node, if any.
1385
+ */
1386
+ nextTabbableNode: function(z) {
1387
+ var L = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, _ = u.indexOf(z);
1388
+ return _ < 0 ? L ? w.slice(w.indexOf(z) + 1).find(function(q) {
1389
+ return ue(q);
1390
+ }) : w.slice(0, w.indexOf(z)).reverse().find(function(q) {
1391
+ return ue(q);
1392
+ }) : u[_ + (L ? 1 : -1)];
1393
+ }
1394
+ };
1395
+ }), a.tabbableGroups = a.containerGroups.filter(function(o) {
1396
+ return o.tabbableNodes.length > 0;
1397
+ }), a.tabbableGroups.length <= 0 && !b("fallbackFocus"))
1398
+ throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");
1399
+ if (a.containerGroups.find(function(o) {
1400
+ return o.posTabIndexesFound;
1401
+ }) && a.containerGroups.length > 1)
1402
+ throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.");
1403
+ }, E = function(o) {
1404
+ var u = o.activeElement;
1405
+ if (u)
1406
+ return u.shadowRoot && u.shadowRoot.activeElement !== null ? E(u.shadowRoot) : u;
1407
+ }, c = function(o) {
1408
+ if (o !== !1 && o !== E(document)) {
1409
+ if (!o || !o.focus) {
1410
+ c(x());
1411
+ return;
1412
+ }
1413
+ o.focus({
1414
+ preventScroll: !!l.preventScroll
1415
+ }), a.mostRecentlyFocusedNode = o, Jn(o) && o.select();
1416
+ }
1417
+ }, g = function(o) {
1418
+ var u = b("setReturnFocus", {
1419
+ params: [o]
1420
+ });
1421
+ return u || (u === !1 ? !1 : o);
1422
+ }, d = function(o) {
1423
+ var u = o.target, w = o.event, C = o.isBackward, P = C === void 0 ? !1 : C;
1424
+ u = u || xe(w), T();
1425
+ var I = null;
1426
+ if (a.tabbableGroups.length > 0) {
1427
+ var S = v(u, w), R = S >= 0 ? a.containerGroups[S] : void 0;
1428
+ if (S < 0)
1429
+ P ? I = a.tabbableGroups[a.tabbableGroups.length - 1].lastTabbableNode : I = a.tabbableGroups[0].firstTabbableNode;
1430
+ else if (P) {
1431
+ var M = a.tabbableGroups.findIndex(function(ee) {
1432
+ var Z = ee.firstTabbableNode;
1433
+ return u === Z;
1434
+ });
1435
+ if (M < 0 && (R.container === u || Ke(u, l.tabbableOptions) && !ue(u, l.tabbableOptions) && !R.nextTabbableNode(u, !1)) && (M = S), M >= 0) {
1436
+ var z = M === 0 ? a.tabbableGroups.length - 1 : M - 1, L = a.tabbableGroups[z];
1437
+ I = ne(u) >= 0 ? L.lastTabbableNode : L.lastDomTabbableNode;
1438
+ } else ge(w) || (I = R.nextTabbableNode(u, !1));
1439
+ } else {
1440
+ var _ = a.tabbableGroups.findIndex(function(ee) {
1441
+ var Z = ee.lastTabbableNode;
1442
+ return u === Z;
1443
+ });
1444
+ if (_ < 0 && (R.container === u || Ke(u, l.tabbableOptions) && !ue(u, l.tabbableOptions) && !R.nextTabbableNode(u)) && (_ = S), _ >= 0) {
1445
+ var q = _ === a.tabbableGroups.length - 1 ? 0 : _ + 1, ye = a.tabbableGroups[q];
1446
+ I = ne(u) >= 0 ? ye.firstTabbableNode : ye.firstDomTabbableNode;
1447
+ } else ge(w) || (I = R.nextTabbableNode(u));
1448
+ }
1449
+ } else
1450
+ I = b("fallbackFocus");
1451
+ return I;
1452
+ }, f = function(o) {
1453
+ var u = xe(o);
1454
+ if (!(v(u, o) >= 0)) {
1455
+ if (pe(l.clickOutsideDeactivates, o)) {
1456
+ m.deactivate({
1457
+ // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
1458
+ // which will result in the outside click setting focus to the node
1459
+ // that was clicked (and if not focusable, to "nothing"); by setting
1460
+ // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
1461
+ // on activation (or the configured `setReturnFocus` node), whether the
1462
+ // outside click was on a focusable node or not
1463
+ returnFocus: l.returnFocusOnDeactivate
1464
+ });
1465
+ return;
2341
1466
  }
2342
- )
1467
+ pe(l.allowOutsideClick, o) || o.preventDefault();
1468
+ }
1469
+ }, p = function(o) {
1470
+ var u = xe(o), w = v(u, o) >= 0;
1471
+ if (w || u instanceof Document)
1472
+ w && (a.mostRecentlyFocusedNode = u);
1473
+ else {
1474
+ o.stopImmediatePropagation();
1475
+ var C, P = !0;
1476
+ if (a.mostRecentlyFocusedNode)
1477
+ if (ne(a.mostRecentlyFocusedNode) > 0) {
1478
+ var I = v(a.mostRecentlyFocusedNode), S = a.containerGroups[I].tabbableNodes;
1479
+ if (S.length > 0) {
1480
+ var R = S.findIndex(function(M) {
1481
+ return M === a.mostRecentlyFocusedNode;
1482
+ });
1483
+ R >= 0 && (l.isKeyForward(a.recentNavEvent) ? R + 1 < S.length && (C = S[R + 1], P = !1) : R - 1 >= 0 && (C = S[R - 1], P = !1));
1484
+ }
1485
+ } else
1486
+ a.containerGroups.some(function(M) {
1487
+ return M.tabbableNodes.some(function(z) {
1488
+ return ne(z) > 0;
1489
+ });
1490
+ }) || (P = !1);
1491
+ else
1492
+ P = !1;
1493
+ P && (C = d({
1494
+ // move FROM the MRU node, not event-related node (which will be the node that is
1495
+ // outside the trap causing the focus escape we're trying to fix)
1496
+ target: a.mostRecentlyFocusedNode,
1497
+ isBackward: l.isKeyBackward(a.recentNavEvent)
1498
+ })), c(C || a.mostRecentlyFocusedNode || x());
1499
+ }
1500
+ a.recentNavEvent = void 0;
1501
+ }, y = function(o) {
1502
+ var u = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
1503
+ a.recentNavEvent = o;
1504
+ var w = d({
1505
+ event: o,
1506
+ isBackward: u
1507
+ });
1508
+ w && (ge(o) && o.preventDefault(), c(w));
1509
+ }, N = function(o) {
1510
+ (l.isKeyForward(o) || l.isKeyBackward(o)) && y(o, l.isKeyBackward(o));
1511
+ }, h = function(o) {
1512
+ Qn(o) && pe(l.escapeDeactivates, o) !== !1 && (o.preventDefault(), m.deactivate());
1513
+ }, k = function(o) {
1514
+ var u = xe(o);
1515
+ v(u, o) >= 0 || pe(l.clickOutsideDeactivates, o) || pe(l.allowOutsideClick, o) || (o.preventDefault(), o.stopImmediatePropagation());
1516
+ }, A = function() {
1517
+ if (a.active)
1518
+ return ut.activateTrap(i, m), a.delayInitialFocusTimer = l.delayInitialFocus ? dt(function() {
1519
+ c(x());
1520
+ }) : c(x()), r.addEventListener("focusin", p, !0), r.addEventListener("mousedown", f, {
1521
+ capture: !0,
1522
+ passive: !1
1523
+ }), r.addEventListener("touchstart", f, {
1524
+ capture: !0,
1525
+ passive: !1
1526
+ }), r.addEventListener("click", k, {
1527
+ capture: !0,
1528
+ passive: !1
1529
+ }), r.addEventListener("keydown", N, {
1530
+ capture: !0,
1531
+ passive: !1
1532
+ }), r.addEventListener("keydown", h), m;
1533
+ }, H = function() {
1534
+ if (a.active)
1535
+ return r.removeEventListener("focusin", p, !0), r.removeEventListener("mousedown", f, !0), r.removeEventListener("touchstart", f, !0), r.removeEventListener("click", k, !0), r.removeEventListener("keydown", N, !0), r.removeEventListener("keydown", h), m;
1536
+ }, K = function(o) {
1537
+ var u = o.some(function(w) {
1538
+ var C = Array.from(w.removedNodes);
1539
+ return C.some(function(P) {
1540
+ return P === a.mostRecentlyFocusedNode;
1541
+ });
1542
+ });
1543
+ u && c(x());
1544
+ }, U = typeof window < "u" && "MutationObserver" in window ? new MutationObserver(K) : void 0, W = function() {
1545
+ U && (U.disconnect(), a.active && !a.paused && a.containers.map(function(o) {
1546
+ U.observe(o, {
1547
+ subtree: !0,
1548
+ childList: !0
1549
+ });
1550
+ }));
1551
+ };
1552
+ return m = {
1553
+ get active() {
1554
+ return a.active;
1555
+ },
1556
+ get paused() {
1557
+ return a.paused;
1558
+ },
1559
+ activate: function(o) {
1560
+ if (a.active)
1561
+ return this;
1562
+ var u = s(o, "onActivate"), w = s(o, "onPostActivate"), C = s(o, "checkCanFocusTrap");
1563
+ C || T(), a.active = !0, a.paused = !1, a.nodeFocusedBeforeActivation = r.activeElement, u == null || u();
1564
+ var P = function() {
1565
+ C && T(), A(), W(), w == null || w();
1566
+ };
1567
+ return C ? (C(a.containers.concat()).then(P, P), this) : (P(), this);
1568
+ },
1569
+ deactivate: function(o) {
1570
+ if (!a.active)
1571
+ return this;
1572
+ var u = ot({
1573
+ onDeactivate: l.onDeactivate,
1574
+ onPostDeactivate: l.onPostDeactivate,
1575
+ checkCanReturnFocus: l.checkCanReturnFocus
1576
+ }, o);
1577
+ clearTimeout(a.delayInitialFocusTimer), a.delayInitialFocusTimer = void 0, H(), a.active = !1, a.paused = !1, W(), ut.deactivateTrap(i, m);
1578
+ var w = s(u, "onDeactivate"), C = s(u, "onPostDeactivate"), P = s(u, "checkCanReturnFocus"), I = s(u, "returnFocus", "returnFocusOnDeactivate");
1579
+ w == null || w();
1580
+ var S = function() {
1581
+ dt(function() {
1582
+ I && c(g(a.nodeFocusedBeforeActivation)), C == null || C();
1583
+ });
1584
+ };
1585
+ return I && P ? (P(g(a.nodeFocusedBeforeActivation)).then(S, S), this) : (S(), this);
1586
+ },
1587
+ pause: function(o) {
1588
+ if (a.paused || !a.active)
1589
+ return this;
1590
+ var u = s(o, "onPause"), w = s(o, "onPostPause");
1591
+ return a.paused = !0, u == null || u(), H(), W(), w == null || w(), this;
1592
+ },
1593
+ unpause: function(o) {
1594
+ if (!a.paused || !a.active)
1595
+ return this;
1596
+ var u = s(o, "onUnpause"), w = s(o, "onPostUnpause");
1597
+ return a.paused = !1, u == null || u(), T(), A(), W(), w == null || w(), this;
1598
+ },
1599
+ updateContainerElements: function(o) {
1600
+ var u = [].concat(o).filter(Boolean);
1601
+ return a.containers = u.map(function(w) {
1602
+ return typeof w == "string" ? r.querySelector(w) : w;
1603
+ }), a.active && T(), W(), this;
1604
+ }
1605
+ }, m.updateContainerElements(e), m;
1606
+ };
1607
+ function Ut(t, e, n) {
1608
+ let r = null;
1609
+ return t && (r = rr(t, {
1610
+ clickOutsideDeactivates: !e,
1611
+ escapeDeactivates: !e,
1612
+ onDeactivate: () => n == null ? void 0 : n(),
1613
+ fallbackFocus: () => t
1614
+ }), r.activate()), { deactivate: () => {
1615
+ r == null || r.deactivate(), r = null;
1616
+ }, wrapper: t };
1617
+ }
1618
+ const ar = ({ modalContext: t, config: e, children: n }) => {
1619
+ const [r, i] = $(!1), l = j(null), [a, m] = $(null);
1620
+ function s() {
1621
+ m(Ut(l.current, e == null ? void 0 : e.closeExplicitly, () => t.close())), i(!0);
2343
1622
  }
2344
- ) }), _a = It(({ name: e, children: t, ...n }, r) => {
2345
- const l = (u) => typeof t == "function" ? t(u) : t, o = j(null);
2346
- return yn(r, () => o.current, [o]), /* @__PURE__ */ R.jsx(
2347
- Pn,
1623
+ return D(() => () => a == null ? void 0 : a.deactivate(), [a]), /* @__PURE__ */ F("div", { className: "im-modal-container fixed inset-0 z-40 overflow-y-auto p-4", children: /* @__PURE__ */ F(
1624
+ "div",
2348
1625
  {
2349
- ref: o,
2350
- name: e,
2351
- ...n,
1626
+ className: Se("im-modal-positioner flex min-h-full justify-center", {
1627
+ "items-start": e.position === "top",
1628
+ "items-center": e.position === "center",
1629
+ "items-end": e.position === "bottom"
1630
+ }),
1631
+ children: /* @__PURE__ */ F(
1632
+ Ue,
1633
+ {
1634
+ as: "div",
1635
+ ref: l,
1636
+ enterFrom: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
1637
+ enterTo: "opacity-100 translate-y-0 sm:scale-100",
1638
+ leaveFrom: "opacity-100 translate-y-0 sm:scale-100",
1639
+ leaveTo: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
1640
+ afterEnter: s,
1641
+ afterLeave: t.afterLeave,
1642
+ className: Se(
1643
+ "im-modal-wrapper pointer-events-auto w-full transition duration-300 ease-in-out",
1644
+ t.onTopOfStack ? "" : "blur-sm",
1645
+ {
1646
+ "sm:max-w-sm": e.maxWidth === "sm",
1647
+ "sm:max-w-md": e.maxWidth === "md",
1648
+ "sm:max-w-md md:max-w-lg": e.maxWidth === "lg",
1649
+ "sm:max-w-md md:max-w-xl": e.maxWidth === "xl",
1650
+ "sm:max-w-md md:max-w-xl lg:max-w-2xl": e.maxWidth === "2xl",
1651
+ "sm:max-w-md md:max-w-xl lg:max-w-3xl": e.maxWidth === "3xl",
1652
+ "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl": e.maxWidth === "4xl",
1653
+ "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl": e.maxWidth === "5xl",
1654
+ "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl": e.maxWidth === "6xl",
1655
+ "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl": e.maxWidth === "7xl"
1656
+ }
1657
+ ),
1658
+ children: /* @__PURE__ */ le(
1659
+ "div",
1660
+ {
1661
+ className: `im-modal-content relative ${e.paddingClasses} ${e.panelClasses}`,
1662
+ "data-inertiaui-modal-entered": r,
1663
+ children: [
1664
+ e.closeButton && /* @__PURE__ */ F("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ F($t, { onClick: t.close }) }),
1665
+ typeof n == "function" ? n({ modalContext: t, config: e }) : n
1666
+ ]
1667
+ }
1668
+ )
1669
+ }
1670
+ )
1671
+ }
1672
+ ) });
1673
+ }, ir = ({ modalContext: t, config: e, children: n }) => {
1674
+ const [r, i] = $(!1), l = j(null), [a, m] = $(null);
1675
+ function s() {
1676
+ m(Ut(l.current, e == null ? void 0 : e.closeExplicitly, () => t.close())), i(!0);
1677
+ }
1678
+ return D(() => () => a == null ? void 0 : a.deactivate(), [a]), /* @__PURE__ */ F("div", { className: "im-slideover-container fixed inset-0 z-40 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ F(
1679
+ "div",
1680
+ {
1681
+ className: Se("im-slideover-positioner flex min-h-full items-center", {
1682
+ "justify-start rtl:justify-end": (e == null ? void 0 : e.position) === "left",
1683
+ "justify-end rtl:justify-start": (e == null ? void 0 : e.position) === "right"
1684
+ }),
1685
+ children: /* @__PURE__ */ F(
1686
+ Ue,
1687
+ {
1688
+ as: "div",
1689
+ ref: l,
1690
+ enterFrom: `opacity-0 ${e.position === "left" ? "-translate-x-full" : "translate-x-full"}`,
1691
+ enterTo: "opacity-100 translate-x-0",
1692
+ leaveFrom: "opacity-100 translate-x-0",
1693
+ leaveTo: `opacity-0 ${e.position === "left" ? "-translate-x-full" : "translate-x-full"}`,
1694
+ afterEnter: s,
1695
+ afterLeave: t.afterLeave,
1696
+ className: Se(
1697
+ "im-slideover-wrapper pointer-events-auto w-full transition duration-300 ease-in-out",
1698
+ t.onTopOfStack ? "" : "blur-sm",
1699
+ {
1700
+ "sm:max-w-sm": e.maxWidth === "sm",
1701
+ "sm:max-w-md": e.maxWidth === "md",
1702
+ "sm:max-w-md md:max-w-lg": e.maxWidth === "lg",
1703
+ "sm:max-w-md md:max-w-xl": e.maxWidth === "xl",
1704
+ "sm:max-w-md md:max-w-xl lg:max-w-2xl": e.maxWidth === "2xl",
1705
+ "sm:max-w-md md:max-w-xl lg:max-w-3xl": e.maxWidth === "3xl",
1706
+ "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl": e.maxWidth === "4xl",
1707
+ "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl": e.maxWidth === "5xl",
1708
+ "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl": e.maxWidth === "6xl",
1709
+ "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl": e.maxWidth === "7xl"
1710
+ }
1711
+ ),
1712
+ children: /* @__PURE__ */ le(
1713
+ "div",
1714
+ {
1715
+ className: `im-slideover-content relative ${e.paddingClasses} ${e.panelClasses}`,
1716
+ "data-inertiaui-modal-entered": r,
1717
+ children: [
1718
+ e.closeButton && /* @__PURE__ */ F("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ F($t, { onClick: t.close }) }),
1719
+ typeof n == "function" ? n({ modalContext: t, config: e }) : n
1720
+ ]
1721
+ }
1722
+ )
1723
+ }
1724
+ )
1725
+ }
1726
+ ) });
1727
+ }, lr = Ze(({ name: t, children: e, onFocus: n = null, onBlur: r = null, onClose: i = null, onSuccess: l = null, onAfterLeave: a = null, ...m }, s) => {
1728
+ const v = (x) => typeof e == "function" ? e(x) : e, b = j(null);
1729
+ return D(() => {
1730
+ var x;
1731
+ if (((x = b == null ? void 0 : b.current) == null ? void 0 : x.index) === 0)
1732
+ return nt.prepare(), () => nt.cleanup();
1733
+ }, [b]), ct(s, () => b.current, [b]), /* @__PURE__ */ F(
1734
+ bt,
1735
+ {
1736
+ ref: b,
1737
+ name: t,
1738
+ onFocus: n,
1739
+ onBlur: r,
1740
+ onClose: i,
1741
+ onSuccess: l,
1742
+ ...m,
2352
1743
  children: ({
2353
- afterLeave: u,
2354
- close: s,
2355
- config: i,
2356
- emit: p,
2357
- getChildModal: c,
2358
- getParentModal: w,
2359
- id: b,
2360
- index: y,
2361
- isOpen: g,
2362
- modalContext: f,
2363
- onTopOfStack: d,
2364
- reload: m,
2365
- setOpen: v,
2366
- shouldRender: x
2367
- }) => /* @__PURE__ */ R.jsx(
2368
- Jn,
1744
+ afterLeave: x,
1745
+ close: T,
1746
+ config: E,
1747
+ emit: c,
1748
+ getChildModal: g,
1749
+ getParentModal: d,
1750
+ id: f,
1751
+ index: p,
1752
+ isOpen: y,
1753
+ modalContext: N,
1754
+ onTopOfStack: h,
1755
+ reload: k,
1756
+ setOpen: A,
1757
+ shouldRender: H
1758
+ }) => /* @__PURE__ */ F(
1759
+ Kn,
2369
1760
  {
2370
1761
  appear: !0,
2371
- show: g ?? !1,
2372
- children: /* @__PURE__ */ R.jsxs(
2373
- Fa,
1762
+ show: y ?? !1,
1763
+ afterLeave: a,
1764
+ children: /* @__PURE__ */ le(
1765
+ "div",
2374
1766
  {
2375
- as: "div",
2376
1767
  className: "im-dialog relative z-20",
2377
- onClose: () => i.closeExplicitly ? null : s(),
2378
- "data-inertiaui-modal-id": b,
2379
- "data-inertiaui-modal-index": y,
1768
+ "data-inertiaui-modal-id": f,
1769
+ "data-inertiaui-modal-index": p,
2380
1770
  children: [
2381
- y === 0 ? /* @__PURE__ */ R.jsx(
2382
- Le,
1771
+ p === 0 ? /* @__PURE__ */ F(
1772
+ Ue,
2383
1773
  {
2384
1774
  enter: "transition transform ease-in-out duration-300",
2385
1775
  enterFrom: "opacity-0",
@@ -2387,58 +1777,58 @@ const ka = ({ modalContext: e, config: t, children: n }) => /* @__PURE__ */ R.js
2387
1777
  leave: "transition transform ease-in-out duration-300",
2388
1778
  leaveFrom: "opacity-100",
2389
1779
  leaveTo: "opacity-0",
2390
- children: d ? /* @__PURE__ */ R.jsx(
1780
+ children: h ? /* @__PURE__ */ F(
2391
1781
  "div",
2392
1782
  {
2393
1783
  className: "im-backdrop fixed inset-0 z-30 bg-black/75",
2394
1784
  "aria-hidden": "true"
2395
1785
  }
2396
- ) : /* @__PURE__ */ R.jsx("div", {})
1786
+ ) : /* @__PURE__ */ F("div", {})
2397
1787
  }
2398
1788
  ) : null,
2399
- y > 0 && d ? /* @__PURE__ */ R.jsx("div", { className: "im-backdrop fixed inset-0 z-30 bg-black/75" }) : null,
2400
- i.slideover ? /* @__PURE__ */ R.jsx(
2401
- ja,
1789
+ p > 0 && h ? /* @__PURE__ */ F("div", { className: "im-backdrop fixed inset-0 z-30 bg-black/75" }) : null,
1790
+ E.slideover ? /* @__PURE__ */ F(
1791
+ ir,
2402
1792
  {
2403
- modalContext: f,
2404
- config: i,
2405
- children: l({
2406
- afterLeave: u,
2407
- close: s,
2408
- config: i,
2409
- emit: p,
2410
- getChildModal: c,
2411
- getParentModal: w,
2412
- id: b,
2413
- index: y,
2414
- isOpen: g,
2415
- modalContext: f,
2416
- onTopOfStack: d,
2417
- reload: m,
2418
- setOpen: v,
2419
- shouldRender: x
1793
+ modalContext: N,
1794
+ config: E,
1795
+ children: v({
1796
+ afterLeave: x,
1797
+ close: T,
1798
+ config: E,
1799
+ emit: c,
1800
+ getChildModal: g,
1801
+ getParentModal: d,
1802
+ id: f,
1803
+ index: p,
1804
+ isOpen: y,
1805
+ modalContext: N,
1806
+ onTopOfStack: h,
1807
+ reload: k,
1808
+ setOpen: A,
1809
+ shouldRender: H
2420
1810
  })
2421
1811
  }
2422
- ) : /* @__PURE__ */ R.jsx(
2423
- ka,
1812
+ ) : /* @__PURE__ */ F(
1813
+ ar,
2424
1814
  {
2425
- modalContext: f,
2426
- config: i,
2427
- children: l({
2428
- afterLeave: u,
2429
- close: s,
2430
- config: i,
2431
- emit: p,
2432
- getChildModal: c,
2433
- getParentModal: w,
2434
- id: b,
2435
- index: y,
2436
- isOpen: g,
2437
- modalContext: f,
2438
- onTopOfStack: d,
2439
- reload: m,
2440
- setOpen: v,
2441
- shouldRender: x
1815
+ modalContext: N,
1816
+ config: E,
1817
+ children: v({
1818
+ afterLeave: x,
1819
+ close: T,
1820
+ config: E,
1821
+ emit: c,
1822
+ getChildModal: g,
1823
+ getParentModal: d,
1824
+ id: f,
1825
+ index: p,
1826
+ isOpen: y,
1827
+ modalContext: N,
1828
+ onTopOfStack: h,
1829
+ reload: k,
1830
+ setOpen: A,
1831
+ shouldRender: H
2442
1832
  })
2443
1833
  }
2444
1834
  )
@@ -2450,84 +1840,84 @@ const ka = ({ modalContext: e, config: t, children: n }) => /* @__PURE__ */ R.js
2450
1840
  }
2451
1841
  );
2452
1842
  });
2453
- _a.displayName = "Modal";
2454
- const Ya = ({
2455
- href: e,
2456
- method: t = "get",
1843
+ lr.displayName = "Modal";
1844
+ const br = ({
1845
+ href: t,
1846
+ method: e = "get",
2457
1847
  data: n = {},
2458
1848
  as: r = "a",
2459
- headers: l = {},
2460
- queryStringArrayFormat: o = "brackets",
2461
- onAfterLeave: u = null,
2462
- onBlur: s = null,
2463
- onClose: i = null,
2464
- onError: p = null,
2465
- onFocus: c = null,
2466
- onStart: w = null,
2467
- onSuccess: b = null,
2468
- navigate: y = null,
2469
- children: g,
2470
- ...f
1849
+ headers: i = {},
1850
+ queryStringArrayFormat: l = "brackets",
1851
+ onAfterLeave: a = null,
1852
+ onBlur: m = null,
1853
+ onClose: s = null,
1854
+ onError: v = null,
1855
+ onFocus: b = null,
1856
+ onStart: x = null,
1857
+ onSuccess: T = null,
1858
+ navigate: E = null,
1859
+ children: c,
1860
+ ...g
2471
1861
  }) => {
2472
- const [d, m] = V(!1), [v, x] = V(null), { stack: T, visit: F } = dt(), X = B(() => y ?? Nt("navigate"), [y]), U = {}, ee = {};
2473
- Object.keys(f).forEach(($) => {
2474
- cn.includes($) || ($.startsWith("on") && typeof f[$] == "function" ? $.toLowerCase() in window ? U[$] = f[$] : ee[$] = f[$] : U[$] = f[$]);
1862
+ const [d, f] = $(!1), [p, y] = $(null), { stack: N, visit: h } = Ae(), k = Y(() => E ?? Je("navigate"), [E]), A = {}, H = {};
1863
+ Object.keys(g).forEach((u) => {
1864
+ rt.includes(u) || (u.startsWith("on") && typeof g[u] == "function" ? u.toLowerCase() in window ? A[u] = g[u] : H[u] = g[u] : A[u] = g[u]);
2475
1865
  });
2476
- const [te, H] = V(!1);
2477
- L(() => {
2478
- v && (v.onTopOfStack && te ? c == null || c() : !v.onTopOfStack && !te && (s == null || s()), H(!v.onTopOfStack));
2479
- }, [T]);
2480
- const q = oe(() => {
2481
- i == null || i();
2482
- }, [i]), G = oe(() => {
2483
- x(null), u == null || u();
2484
- }, [u]), M = oe(
2485
- ($) => {
2486
- $ == null || $.preventDefault(), !d && (e.startsWith("#") || (m(!0), w == null || w()), F(
2487
- e,
1866
+ const [K, U] = $(!1);
1867
+ D(() => {
1868
+ p && (p.onTopOfStack && K ? b == null || b() : !p.onTopOfStack && !K && (m == null || m()), U(!p.onTopOfStack));
1869
+ }, [N]);
1870
+ const W = V(() => {
1871
+ s == null || s();
1872
+ }, [s]), O = V(() => {
1873
+ y(null), a == null || a();
1874
+ }, [a]), o = V(
1875
+ (u) => {
1876
+ u == null || u.preventDefault(), !d && (t.startsWith("#") || (f(!0), x == null || x()), h(
2488
1877
  t,
1878
+ e,
2489
1879
  n,
1880
+ i,
1881
+ Gt(ft(g, rt)),
1882
+ () => W(N.length),
1883
+ O,
2490
1884
  l,
2491
- Dr(bn(f, cn)),
2492
- () => q(T.length),
2493
- G,
2494
- o,
2495
- X
2496
- ).then((I) => {
2497
- x(I), I.registerEventListenersFromProps(ee), b == null || b();
2498
- }).catch((I) => {
2499
- console.error(I), p == null || p(I);
2500
- }).finally(() => m(!1)));
1885
+ k
1886
+ ).then((w) => {
1887
+ y(w), w.registerEventListenersFromProps(H), T == null || T();
1888
+ }).catch((w) => {
1889
+ console.error(w), v == null || v(w);
1890
+ }).finally(() => f(!1)));
2501
1891
  },
2502
- [e, t, n, l, o, f, q, G]
1892
+ [t, e, n, i, l, g, W, O]
2503
1893
  );
2504
- return /* @__PURE__ */ R.jsx(
1894
+ return /* @__PURE__ */ F(
2505
1895
  r,
2506
1896
  {
2507
- ...U,
2508
- href: e,
2509
- onClick: M,
2510
- children: typeof g == "function" ? g({ loading: d }) : g
1897
+ ...A,
1898
+ href: t,
1899
+ onClick: o,
1900
+ children: typeof c == "function" ? c({ loading: d }) : c
2511
1901
  }
2512
1902
  );
2513
1903
  };
2514
- function Xa() {
2515
- return dt().stack[Tn()] ?? null;
1904
+ function gr() {
1905
+ return Ae().stack[ht()] ?? null;
2516
1906
  }
2517
- const qa = (e) => (t) => (t.default.layout = (n) => rt(e, {}, n), t);
1907
+ const yr = (t) => (e) => (e.default.layout = (n) => Ne(t, {}, n), e);
2518
1908
  export {
2519
- Pn as HeadlessModal,
2520
- _a as Modal,
2521
- Ya as ModalLink,
2522
- Br as ModalRoot,
2523
- Ur as ModalStackProvider,
2524
- Nt as getConfig,
2525
- Hr as initFromPageProps,
2526
- Ua as putConfig,
2527
- Ha as renderApp,
2528
- Wa as resetConfig,
2529
- qa as setPageLayout,
2530
- Xa as useModal,
2531
- Tn as useModalIndex,
2532
- dt as useModalStack
1909
+ bt as HeadlessModal,
1910
+ lr as Modal,
1911
+ br as ModalLink,
1912
+ Qt as ModalRoot,
1913
+ Yt as ModalStackProvider,
1914
+ Je as getConfig,
1915
+ Jt as initFromPageProps,
1916
+ pr as putConfig,
1917
+ hr as renderApp,
1918
+ mr as resetConfig,
1919
+ yr as setPageLayout,
1920
+ gr as useModal,
1921
+ ht as useModalIndex,
1922
+ Ae as useModalStack
2533
1923
  };