@sps-woodland/focused-task 8.0.2 → 8.0.4

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.
package/lib/index.es.js CHANGED
@@ -1,59 +1,79 @@
1
- import { Metadata as Se, cl as A, combineEventHandlers as pe, useChildTestIdAttrBuilder as qe, selectChildren as je, modChildren as ze, contentOf as me } from "@sps-woodland/core";
2
- import { Button as Ge } from "@sps-woodland/buttons";
3
- import * as h from "react";
4
- import y, { useState as U, useRef as $, useCallback as P, useContext as I, useEffect as x, useMemo as q } from "react";
5
- import Ye from "react-dom";
6
- import { code as be } from "@spscommerce/utils";
1
+ import { Metadata as Se, cl as R, combineEventHandlers as fe, useChildTestIdAttrBuilder as ze, selectChildren as _e, modChildren as Ge, contentOf as pe } from "@sps-woodland/core";
2
+ import { Button as Ye } from "@sps-woodland/buttons";
3
+ import * as g from "react";
4
+ import $, { useState as V, useRef as w, useEffect as S, useCallback as T, useContext as H, useMemo as I } from "react";
5
+ import Ue from "react-dom";
6
+ import { code as me } from "@spscommerce/utils";
7
7
  function Je(e, t, n) {
8
- let [r, o] = U(e || t), a = $(e !== void 0), i = a.current, l = e !== void 0, c = $(r);
9
- i !== l && console.warn(`WARN: A component changed from ${i ? "controlled" : "uncontrolled"} to ${l ? "controlled" : "uncontrolled"}.`), a.current = l;
10
- let s = P((u, ...p) => {
11
- let d = (m, ...f) => {
12
- n && (Object.is(c.current, m) || n(m, ...f)), l || (c.current = m);
8
+ let [r, o] = V(e || t), a = w(e !== void 0), i = e !== void 0;
9
+ S(() => {
10
+ let s = a.current;
11
+ s !== i && console.warn(`WARN: A component changed from ${s ? "controlled" : "uncontrolled"} to ${i ? "controlled" : "uncontrolled"}.`), a.current = i;
12
+ }, [
13
+ i
14
+ ]);
15
+ let c = i ? e : r, l = T((s, ...u) => {
16
+ let f = (d, ...p) => {
17
+ n && (Object.is(c, d) || n(d, ...p)), i || (c = d);
13
18
  };
14
- typeof u == "function" ? (console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"), o((f, ...X) => {
15
- let R = u(l ? c.current : f, ...X);
16
- return d(R, ...p), l ? f : R;
17
- })) : (l || o(u), d(u, ...p));
19
+ typeof s == "function" ? (console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"), o((p, ...m) => {
20
+ let F = s(i ? c : p, ...m);
21
+ return f(F, ...u), i ? p : F;
22
+ })) : (i || o(s), f(s, ...u));
18
23
  }, [
19
- l,
24
+ i,
25
+ c,
20
26
  n
21
27
  ]);
22
- return l ? c.current = e : e = r, [
23
- e,
24
- s
28
+ return [
29
+ c,
30
+ l
25
31
  ];
26
32
  }
27
- const Pe = {
33
+ const _ = {
28
34
  prefix: String(Math.round(Math.random() * 1e10)),
29
- current: 0,
30
- isSSR: !1
31
- }, ie = /* @__PURE__ */ y.createContext(Pe);
32
- let Ue = Boolean(typeof window < "u" && window.document && window.document.createElement), Q = /* @__PURE__ */ new WeakMap();
33
- function Xe(e = !1) {
34
- let t = I(ie), n = $(null);
35
+ current: 0
36
+ }, Fe = /* @__PURE__ */ $.createContext(_), Xe = /* @__PURE__ */ $.createContext(!1);
37
+ let Qe = Boolean(typeof window < "u" && window.document && window.document.createElement), Z = /* @__PURE__ */ new WeakMap();
38
+ function Ze(e = !1) {
39
+ let t = H(Fe), n = w(null);
35
40
  if (n.current === null && !e) {
36
41
  var r, o;
37
- let a = (r = y.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || r === void 0 || (o = r.ReactCurrentOwner) === null || o === void 0 ? void 0 : o.current;
42
+ let a = (o = $.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || o === void 0 || (r = o.ReactCurrentOwner) === null || r === void 0 ? void 0 : r.current;
38
43
  if (a) {
39
- let i = Q.get(a);
40
- i == null ? Q.set(a, {
44
+ let i = Z.get(a);
45
+ i == null ? Z.set(a, {
41
46
  id: t.current,
42
47
  state: a.memoizedState
43
- }) : a.memoizedState !== i.state && (t.current = i.id, Q.delete(a));
48
+ }) : a.memoizedState !== i.state && (t.current = i.id, Z.delete(a));
44
49
  }
45
50
  n.current = ++t.current;
46
51
  }
47
52
  return n.current;
48
53
  }
49
- function _e(e) {
50
- let t = I(ie);
51
- t === Pe && !Ue && console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");
52
- let n = Xe(!!e);
53
- return e || `react-aria${t.prefix}-${n}`;
54
+ function et(e) {
55
+ let t = H(Fe);
56
+ t === _ && !Qe && console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");
57
+ let n = Ze(!!e), r = t === _ && process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${t.prefix}`;
58
+ return e || `${r}-${n}`;
54
59
  }
55
- function Qe() {
56
- return I(ie).isSSR;
60
+ function tt(e) {
61
+ let t = $.useId(), [n] = V(Pe()), r = n || process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${_.prefix}`;
62
+ return e || `${r}-${t}`;
63
+ }
64
+ const nt = typeof $.useId == "function" ? tt : et;
65
+ function rt() {
66
+ return !1;
67
+ }
68
+ function ot() {
69
+ return !0;
70
+ }
71
+ function at(e) {
72
+ return () => {
73
+ };
74
+ }
75
+ function Pe() {
76
+ return typeof $.useSyncExternalStore == "function" ? $.useSyncExternalStore(at, rt, ot) : H(Xe);
57
77
  }
58
78
  function Ce(e) {
59
79
  var t, n, r = "";
@@ -68,66 +88,72 @@ function Ce(e) {
68
88
  e[t] && (r && (r += " "), r += t);
69
89
  return r;
70
90
  }
71
- function Ze() {
91
+ function it() {
72
92
  for (var e, t, n = 0, r = ""; n < arguments.length; )
73
93
  (e = arguments[n++]) && (t = Ce(e)) && (r && (r += " "), r += t);
74
94
  return r;
75
95
  }
76
- const E = typeof window < "u" ? y.useLayoutEffect : () => {
96
+ const h = typeof document < "u" ? $.useLayoutEffect : () => {
77
97
  };
78
- function et(e) {
79
- let [t, n] = U(e), r = $(t), o = $(null);
80
- r.current = t;
81
- let a = $(null);
82
- a.current = () => {
83
- let l = o.current.next();
84
- if (l.done) {
85
- o.current = null;
98
+ function W(e) {
99
+ const t = w(null);
100
+ return h(() => {
101
+ t.current = e;
102
+ }, [
103
+ e
104
+ ]), T((...n) => {
105
+ const r = t.current;
106
+ return r(...n);
107
+ }, []);
108
+ }
109
+ function lt(e) {
110
+ let [t, n] = V(e), r = w(null), o = W(() => {
111
+ let i = r.current.next();
112
+ if (i.done) {
113
+ r.current = null;
86
114
  return;
87
115
  }
88
- t === l.value ? a.current() : n(l.value);
89
- }, E(() => {
90
- o.current && a.current();
116
+ t === i.value ? o() : n(i.value);
117
+ });
118
+ h(() => {
119
+ r.current && o();
120
+ });
121
+ let a = W((i) => {
122
+ r.current = i(t), o();
91
123
  });
92
- let i = P((l) => {
93
- o.current = l(r.current), a.current();
94
- }, [
95
- o,
96
- a
97
- ]);
98
124
  return [
99
125
  t,
100
- i
126
+ a
101
127
  ];
102
128
  }
103
- let j = /* @__PURE__ */ new Map();
129
+ let ct = Boolean(typeof window < "u" && window.document && window.document.createElement), G = /* @__PURE__ */ new Map();
104
130
  function Le(e) {
105
- let [t, n] = U(e), r = $(null), o = _e(t), a = P((i) => {
131
+ let [t, n] = V(e), r = w(null), o = nt(t), a = T((i) => {
106
132
  r.current = i;
107
133
  }, []);
108
- return j.set(o, a), E(() => {
134
+ return ct && G.set(o, a), h(() => {
109
135
  let i = o;
110
136
  return () => {
111
- j.delete(i);
137
+ G.delete(i);
112
138
  };
113
139
  }, [
114
140
  o
115
- ]), x(() => {
141
+ ]), S(() => {
116
142
  let i = r.current;
117
143
  i && (r.current = null, n(i));
118
144
  }), o;
119
145
  }
120
- function tt(e, t) {
146
+ function st(e, t) {
121
147
  if (e === t)
122
148
  return e;
123
- let n = j.get(e);
149
+ let n = G.get(e);
124
150
  if (n)
125
151
  return n(t), t;
126
- let r = j.get(t);
152
+ let r = G.get(t);
127
153
  return r ? (r(e), e) : t;
128
154
  }
129
- function nt(e = []) {
130
- let t = Le(), [n, r] = et(t), o = P(() => {
155
+ function ut(e = []) {
156
+ let t = Le(), [n, r] = lt(t), o = T(() => {
131
157
  r(function* () {
132
158
  yield t, yield document.getElementById(t) ? t : void 0;
133
159
  });
@@ -135,19 +161,23 @@ function nt(e = []) {
135
161
  t,
136
162
  r
137
163
  ]);
138
- return E(o, [
164
+ return h(o, [
139
165
  t,
140
166
  o,
141
167
  ...e
142
168
  ]), n;
143
169
  }
144
- function z(...e) {
170
+ function Y(...e) {
145
171
  return (...t) => {
146
172
  for (let n of e)
147
173
  typeof n == "function" && n(...t);
148
174
  };
149
175
  }
150
- function rt(...e) {
176
+ const dt = (e) => {
177
+ var t;
178
+ return (t = e == null ? void 0 : e.ownerDocument) !== null && t !== void 0 ? t : document;
179
+ };
180
+ function ft(...e) {
151
181
  let t = {
152
182
  ...e[0]
153
183
  };
@@ -155,52 +185,59 @@ function rt(...e) {
155
185
  let r = e[n];
156
186
  for (let o in r) {
157
187
  let a = t[o], i = r[o];
158
- typeof a == "function" && typeof i == "function" && o[0] === "o" && o[1] === "n" && o.charCodeAt(2) >= 65 && o.charCodeAt(2) <= 90 ? t[o] = z(a, i) : (o === "className" || o === "UNSAFE_className") && typeof a == "string" && typeof i == "string" ? t[o] = Ze(a, i) : o === "id" && a && i ? t.id = tt(a, i) : t[o] = i !== void 0 ? i : a;
188
+ typeof a == "function" && typeof i == "function" && o[0] === "o" && o[1] === "n" && o.charCodeAt(2) >= 65 && o.charCodeAt(2) <= 90 ? t[o] = Y(a, i) : (o === "className" || o === "UNSAFE_className") && typeof a == "string" && typeof i == "string" ? t[o] = it(a, i) : o === "id" && a && i ? t.id = st(a, i) : t[o] = i !== void 0 ? i : a;
159
189
  }
160
190
  }
161
191
  return t;
162
192
  }
163
- const ot = /* @__PURE__ */ new Set([
193
+ const pt = /* @__PURE__ */ new Set([
164
194
  "id"
165
- ]), at = /* @__PURE__ */ new Set([
195
+ ]), mt = /* @__PURE__ */ new Set([
166
196
  "aria-label",
167
197
  "aria-labelledby",
168
198
  "aria-describedby",
169
199
  "aria-details"
170
- ]), it = /^(data-.*)$/;
171
- function lt(e, t = {}) {
172
- let { labelable: n, propNames: r } = t, o = {};
173
- for (const a in e)
174
- Object.prototype.hasOwnProperty.call(e, a) && (ot.has(a) || n && at.has(a) || (r == null ? void 0 : r.has(a)) || it.test(a)) && (o[a] = e[a]);
175
- return o;
176
- }
177
- function ve(e) {
178
- if (ct())
200
+ ]), bt = /* @__PURE__ */ new Set([
201
+ "href",
202
+ "target",
203
+ "rel",
204
+ "download",
205
+ "ping",
206
+ "referrerPolicy"
207
+ ]), vt = /^(data-.*)$/;
208
+ function $t(e, t = {}) {
209
+ let { labelable: n, isLink: r, propNames: o } = t, a = {};
210
+ for (const i in e)
211
+ Object.prototype.hasOwnProperty.call(e, i) && (pt.has(i) || n && mt.has(i) || r && bt.has(i) || (o == null ? void 0 : o.has(i)) || vt.test(i)) && (a[i] = e[i]);
212
+ return a;
213
+ }
214
+ function be(e) {
215
+ if (ht())
179
216
  e.focus({
180
217
  preventScroll: !0
181
218
  });
182
219
  else {
183
- let t = st(e);
184
- e.focus(), ut(t);
220
+ let t = gt(e);
221
+ e.focus(), Et(t);
185
222
  }
186
223
  }
187
- let W = null;
188
- function ct() {
189
- if (W == null) {
190
- W = !1;
224
+ let q = null;
225
+ function ht() {
226
+ if (q == null) {
227
+ q = !1;
191
228
  try {
192
229
  var e = document.createElement("div");
193
230
  e.focus({
194
231
  get preventScroll() {
195
- return W = !0, !0;
232
+ return q = !0, !0;
196
233
  }
197
234
  });
198
235
  } catch {
199
236
  }
200
237
  }
201
- return W;
238
+ return q;
202
239
  }
203
- function st(e) {
240
+ function gt(e) {
204
241
  for (var t = e.parentNode, n = [], r = document.scrollingElement || document.documentElement; t instanceof HTMLElement && t !== r; )
205
242
  (t.offsetHeight < t.scrollHeight || t.offsetWidth < t.scrollWidth) && n.push({
206
243
  element: t,
@@ -213,79 +250,83 @@ function st(e) {
213
250
  scrollLeft: r.scrollLeft
214
251
  }), n;
215
252
  }
216
- function ut(e) {
253
+ function Et(e) {
217
254
  for (let { element: t, scrollTop: n, scrollLeft: r } of e)
218
255
  t.scrollTop = n, t.scrollLeft = r;
219
256
  }
220
- let k = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ new Set();
221
- function $e() {
257
+ function wt(e) {
258
+ var t;
259
+ return typeof window > "u" || window.navigator == null ? !1 : ((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.brands.some((n) => e.test(n.brand))) || e.test(window.navigator.userAgent);
260
+ }
261
+ function ie(e) {
262
+ var t;
263
+ return typeof window < "u" && window.navigator != null ? e.test(((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.platform) || window.navigator.platform) : !1;
264
+ }
265
+ function ke() {
266
+ return ie(/^Mac/i);
267
+ }
268
+ function yt() {
269
+ return ie(/^iPhone/i);
270
+ }
271
+ function Tt() {
272
+ return ie(/^iPad/i) || ke() && navigator.maxTouchPoints > 1;
273
+ }
274
+ function xt() {
275
+ return yt() || Tt();
276
+ }
277
+ function Nt() {
278
+ return wt(/Android/i);
279
+ }
280
+ let O = /* @__PURE__ */ new Map(), ne = /* @__PURE__ */ new Set();
281
+ function ve() {
222
282
  if (typeof window > "u")
223
283
  return;
224
284
  let e = (n) => {
225
- let r = k.get(n.target);
226
- r || (r = /* @__PURE__ */ new Set(), k.set(n.target, r), n.target.addEventListener("transitioncancel", t)), r.add(n.propertyName);
285
+ let r = O.get(n.target);
286
+ r || (r = /* @__PURE__ */ new Set(), O.set(n.target, r), n.target.addEventListener("transitioncancel", t)), r.add(n.propertyName);
227
287
  }, t = (n) => {
228
- let r = k.get(n.target);
229
- if (!!r && (r.delete(n.propertyName), r.size === 0 && (n.target.removeEventListener("transitioncancel", t), k.delete(n.target)), k.size === 0)) {
230
- for (let o of te)
288
+ let r = O.get(n.target);
289
+ if (!!r && (r.delete(n.propertyName), r.size === 0 && (n.target.removeEventListener("transitioncancel", t), O.delete(n.target)), O.size === 0)) {
290
+ for (let o of ne)
231
291
  o();
232
- te.clear();
292
+ ne.clear();
233
293
  }
234
294
  };
235
295
  document.body.addEventListener("transitionrun", e), document.body.addEventListener("transitionend", t);
236
296
  }
237
- typeof document < "u" && (document.readyState !== "loading" ? $e() : document.addEventListener("DOMContentLoaded", $e));
238
- function dt(e) {
297
+ typeof document < "u" && (document.readyState !== "loading" ? ve() : document.addEventListener("DOMContentLoaded", ve));
298
+ function St(e) {
239
299
  requestAnimationFrame(() => {
240
- k.size === 0 ? e() : te.add(e);
300
+ O.size === 0 ? e() : ne.add(e);
241
301
  });
242
302
  }
243
- function ke(e) {
244
- for (he(e) && (e = e.parentElement); e && !he(e); )
303
+ function Oe(e) {
304
+ for ($e(e) && (e = e.parentElement); e && !$e(e); )
245
305
  e = e.parentElement;
246
306
  return e || document.scrollingElement || document.documentElement;
247
307
  }
248
- function he(e) {
308
+ function $e(e) {
249
309
  let t = window.getComputedStyle(e);
250
310
  return /(auto|scroll)/.test(t.overflow + t.overflowX + t.overflowY);
251
311
  }
252
- function ft(e) {
253
- var t;
254
- return typeof window > "u" || window.navigator == null ? !1 : ((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.brands.some((n) => e.test(n.brand))) || e.test(window.navigator.userAgent);
255
- }
256
- function le(e) {
257
- var t;
258
- return typeof window < "u" && window.navigator != null ? e.test(((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.platform) || window.navigator.platform) : !1;
259
- }
260
- function Oe() {
261
- return le(/^Mac/i);
262
- }
263
- function pt() {
264
- return le(/^iPhone/i);
265
- }
266
- function mt() {
267
- return le(/^iPad/i) || Oe() && navigator.maxTouchPoints > 1;
268
- }
269
- function bt() {
270
- return pt() || mt();
271
- }
272
- function vt() {
273
- return ft(/Android/i);
312
+ function Ft(e) {
313
+ return e.mozInputSource === 0 && e.isTrusted ? !0 : Nt() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
274
314
  }
275
- function $t(e) {
276
- return e.mozInputSource === 0 && e.isTrusted ? !0 : vt() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
277
- }
278
- function ne(e, t, n) {
279
- return t in e ? Object.defineProperty(e, t, {
280
- value: n,
281
- enumerable: !0,
282
- configurable: !0,
283
- writable: !0
284
- }) : e[t] = n, e;
315
+ const Me = $.createContext({
316
+ register: () => {
317
+ }
318
+ });
319
+ Me.displayName = "PressResponderContext";
320
+ function Pt({ children: e }) {
321
+ let t = I(() => ({
322
+ register: () => {
323
+ }
324
+ }), []);
325
+ return /* @__PURE__ */ $.createElement(Me.Provider, {
326
+ value: t
327
+ }, e);
285
328
  }
286
- const ht = y.createContext(null);
287
- ht.displayName = "PressResponderContext";
288
- class gt {
329
+ class Ct {
289
330
  isDefaultPrevented() {
290
331
  return this.nativeEvent.defaultPrevented;
291
332
  }
@@ -304,139 +345,153 @@ class gt {
304
345
  this.nativeEvent = n, this.target = n.target, this.currentTarget = n.currentTarget, this.relatedTarget = n.relatedTarget, this.bubbles = n.bubbles, this.cancelable = n.cancelable, this.defaultPrevented = n.defaultPrevented, this.eventPhase = n.eventPhase, this.isTrusted = n.isTrusted, this.timeStamp = n.timeStamp, this.type = t;
305
346
  }
306
347
  }
307
- function Et(e) {
308
- let t = $({
348
+ function Lt(e) {
349
+ let t = w({
309
350
  isFocused: !1,
310
- onBlur: e,
311
351
  observer: null
312
352
  });
313
- return t.current.onBlur = e, E(() => {
314
- const n = t.current;
353
+ h(() => {
354
+ const r = t.current;
315
355
  return () => {
316
- n.observer && (n.observer.disconnect(), n.observer = null);
356
+ r.observer && (r.observer.disconnect(), r.observer = null);
317
357
  };
318
- }, []), P((n) => {
319
- if (n.target instanceof HTMLButtonElement || n.target instanceof HTMLInputElement || n.target instanceof HTMLTextAreaElement || n.target instanceof HTMLSelectElement) {
358
+ }, []);
359
+ let n = W((r) => {
360
+ e == null || e(r);
361
+ });
362
+ return T((r) => {
363
+ if (r.target instanceof HTMLButtonElement || r.target instanceof HTMLInputElement || r.target instanceof HTMLTextAreaElement || r.target instanceof HTMLSelectElement) {
320
364
  t.current.isFocused = !0;
321
- let r = n.target, o = (a) => {
322
- var i, l;
323
- t.current.isFocused = !1, r.disabled && ((l = (i = t.current).onBlur) === null || l === void 0 || l.call(i, new gt("blur", a))), t.current.observer && (t.current.observer.disconnect(), t.current.observer = null);
365
+ let o = r.target, a = (i) => {
366
+ t.current.isFocused = !1, o.disabled && n(new Ct("blur", i)), t.current.observer && (t.current.observer.disconnect(), t.current.observer = null);
324
367
  };
325
- r.addEventListener("focusout", o, {
368
+ o.addEventListener("focusout", a, {
326
369
  once: !0
327
370
  }), t.current.observer = new MutationObserver(() => {
328
- t.current.isFocused && r.disabled && (t.current.observer.disconnect(), r.dispatchEvent(new FocusEvent("blur")), r.dispatchEvent(new FocusEvent("focusout", {
329
- bubbles: !0
330
- })));
331
- }), t.current.observer.observe(r, {
371
+ if (t.current.isFocused && o.disabled) {
372
+ var i;
373
+ (i = t.current.observer) === null || i === void 0 || i.disconnect();
374
+ let c = o === document.activeElement ? null : document.activeElement;
375
+ o.dispatchEvent(new FocusEvent("blur", {
376
+ relatedTarget: c
377
+ })), o.dispatchEvent(new FocusEvent("focusout", {
378
+ bubbles: !0,
379
+ relatedTarget: c
380
+ }));
381
+ }
382
+ }), t.current.observer.observe(o, {
332
383
  attributes: !0,
333
384
  attributeFilter: [
334
385
  "disabled"
335
386
  ]
336
387
  });
337
388
  }
338
- }, []);
389
+ }, [
390
+ n
391
+ ]);
339
392
  }
340
- let B = null, wt = /* @__PURE__ */ new Set(), ge = !1, C = !1, re = !1;
341
- function ce(e, t) {
342
- for (let n of wt)
393
+ let K = null, kt = /* @__PURE__ */ new Set(), he = !1, L = !1, re = !1;
394
+ function le(e, t) {
395
+ for (let n of kt)
343
396
  n(e, t);
344
397
  }
345
- function yt(e) {
346
- return !(e.metaKey || !Oe() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
398
+ function Ot(e) {
399
+ return !(e.metaKey || !ke() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
347
400
  }
348
- function Ee(e) {
349
- C = !0, yt(e) && (B = "keyboard", ce("keyboard", e));
401
+ function ge(e) {
402
+ L = !0, Ot(e) && (K = "keyboard", le("keyboard", e));
350
403
  }
351
- function L(e) {
352
- B = "pointer", (e.type === "mousedown" || e.type === "pointerdown") && (C = !0, ce("pointer", e));
404
+ function k(e) {
405
+ K = "pointer", (e.type === "mousedown" || e.type === "pointerdown") && (L = !0, le("pointer", e));
353
406
  }
354
- function Tt(e) {
355
- $t(e) && (C = !0, B = "virtual");
407
+ function Mt(e) {
408
+ Ft(e) && (L = !0, K = "virtual");
356
409
  }
357
- function Nt(e) {
358
- e.target === window || e.target === document || (!C && !re && (B = "virtual", ce("virtual", e)), C = !1, re = !1);
410
+ function Dt(e) {
411
+ e.target === window || e.target === document || (!L && !re && (K = "virtual", le("virtual", e)), L = !1, re = !1);
359
412
  }
360
- function xt() {
361
- C = !1, re = !0;
413
+ function At() {
414
+ L = !1, re = !0;
362
415
  }
363
- function we() {
364
- if (typeof window > "u" || ge)
416
+ function Ee() {
417
+ if (typeof window > "u" || he)
365
418
  return;
366
419
  let e = HTMLElement.prototype.focus;
367
420
  HTMLElement.prototype.focus = function() {
368
- C = !0, e.apply(this, arguments);
369
- }, document.addEventListener("keydown", Ee, !0), document.addEventListener("keyup", Ee, !0), document.addEventListener("click", Tt, !0), window.addEventListener("focus", Nt, !0), window.addEventListener("blur", xt, !1), typeof PointerEvent < "u" ? (document.addEventListener("pointerdown", L, !0), document.addEventListener("pointermove", L, !0), document.addEventListener("pointerup", L, !0)) : (document.addEventListener("mousedown", L, !0), document.addEventListener("mousemove", L, !0), document.addEventListener("mouseup", L, !0)), ge = !0;
421
+ L = !0, e.apply(this, arguments);
422
+ }, document.addEventListener("keydown", ge, !0), document.addEventListener("keyup", ge, !0), document.addEventListener("click", Mt, !0), window.addEventListener("focus", Dt, !0), window.addEventListener("blur", At, !1), typeof PointerEvent < "u" ? (document.addEventListener("pointerdown", k, !0), document.addEventListener("pointermove", k, !0), document.addEventListener("pointerup", k, !0)) : (document.addEventListener("mousedown", k, !0), document.addEventListener("mousemove", k, !0), document.addEventListener("mouseup", k, !0)), he = !0;
370
423
  }
371
- typeof document < "u" && (document.readyState !== "loading" ? we() : document.addEventListener("DOMContentLoaded", we));
372
- function Ft() {
373
- return B;
424
+ typeof document < "u" && (document.readyState !== "loading" ? Ee() : document.addEventListener("DOMContentLoaded", Ee));
425
+ function Rt() {
426
+ return K;
374
427
  }
375
- function St(e) {
376
- let { isDisabled: t, onBlurWithin: n, onFocusWithin: r, onFocusWithinChange: o } = e, a = $({
428
+ function It(e) {
429
+ let { isDisabled: t, onBlurWithin: n, onFocusWithin: r, onFocusWithinChange: o } = e, a = w({
377
430
  isFocusWithin: !1
378
- }), i = P((s) => {
431
+ }), i = T((s) => {
379
432
  a.current.isFocusWithin && !s.currentTarget.contains(s.relatedTarget) && (a.current.isFocusWithin = !1, n && n(s), o && o(!1));
380
433
  }, [
381
434
  n,
382
435
  o,
383
436
  a
384
- ]), l = Et(i), c = P((s) => {
385
- !a.current.isFocusWithin && document.activeElement === s.target && (r && r(s), o && o(!0), a.current.isFocusWithin = !0, l(s));
437
+ ]), c = Lt(i), l = T((s) => {
438
+ !a.current.isFocusWithin && document.activeElement === s.target && (r && r(s), o && o(!0), a.current.isFocusWithin = !0, c(s));
386
439
  }, [
387
440
  r,
388
441
  o,
389
- l
442
+ c
390
443
  ]);
391
444
  return t ? {
392
445
  focusWithinProps: {
393
- onFocus: null,
394
- onBlur: null
446
+ onFocus: void 0,
447
+ onBlur: void 0
395
448
  }
396
449
  } : {
397
450
  focusWithinProps: {
398
- onFocus: c,
451
+ onFocus: l,
399
452
  onBlur: i
400
453
  }
401
454
  };
402
455
  }
403
- function Pt(e) {
404
- let { ref: t, onInteractOutside: n, isDisabled: r, onInteractOutsideStart: o } = e, i = $({
456
+ function Bt(e) {
457
+ let { ref: t, onInteractOutside: n, isDisabled: r, onInteractOutsideStart: o } = e, a = w({
405
458
  isPointerDown: !1,
406
- ignoreEmulatedMouseEvents: !1,
407
- onInteractOutside: n,
408
- onInteractOutsideStart: o
409
- }).current;
410
- i.onInteractOutside = n, i.onInteractOutsideStart = o, x(() => {
459
+ ignoreEmulatedMouseEvents: !1
460
+ }), i = W((l) => {
461
+ n && j(l, t) && (o && o(l), a.current.isPointerDown = !0);
462
+ }), c = W((l) => {
463
+ n && n(l);
464
+ });
465
+ S(() => {
466
+ let l = a.current;
411
467
  if (r)
412
468
  return;
413
- let l = (c) => {
414
- H(c, t) && i.onInteractOutside && (i.onInteractOutsideStart && i.onInteractOutsideStart(c), i.isPointerDown = !0);
415
- };
469
+ const s = t.current, u = dt(s);
416
470
  if (typeof PointerEvent < "u") {
417
- let c = (s) => {
418
- i.isPointerDown && i.onInteractOutside && H(s, t) && i.onInteractOutside(s), i.isPointerDown = !1;
471
+ let f = (d) => {
472
+ l.isPointerDown && j(d, t) && c(d), l.isPointerDown = !1;
419
473
  };
420
- return document.addEventListener("pointerdown", l, !0), document.addEventListener("pointerup", c, !0), () => {
421
- document.removeEventListener("pointerdown", l, !0), document.removeEventListener("pointerup", c, !0);
474
+ return u.addEventListener("pointerdown", i, !0), u.addEventListener("pointerup", f, !0), () => {
475
+ u.removeEventListener("pointerdown", i, !0), u.removeEventListener("pointerup", f, !0);
422
476
  };
423
477
  } else {
424
- let c = (u) => {
425
- i.ignoreEmulatedMouseEvents ? i.ignoreEmulatedMouseEvents = !1 : i.isPointerDown && i.onInteractOutside && H(u, t) && i.onInteractOutside(u), i.isPointerDown = !1;
426
- }, s = (u) => {
427
- i.ignoreEmulatedMouseEvents = !0, i.onInteractOutside && i.isPointerDown && H(u, t) && i.onInteractOutside(u), i.isPointerDown = !1;
478
+ let f = (p) => {
479
+ l.ignoreEmulatedMouseEvents ? l.ignoreEmulatedMouseEvents = !1 : l.isPointerDown && j(p, t) && c(p), l.isPointerDown = !1;
480
+ }, d = (p) => {
481
+ l.ignoreEmulatedMouseEvents = !0, l.isPointerDown && j(p, t) && c(p), l.isPointerDown = !1;
428
482
  };
429
- return document.addEventListener("mousedown", l, !0), document.addEventListener("mouseup", c, !0), document.addEventListener("touchstart", l, !0), document.addEventListener("touchend", s, !0), () => {
430
- document.removeEventListener("mousedown", l, !0), document.removeEventListener("mouseup", c, !0), document.removeEventListener("touchstart", l, !0), document.removeEventListener("touchend", s, !0);
483
+ return u.addEventListener("mousedown", i, !0), u.addEventListener("mouseup", f, !0), u.addEventListener("touchstart", i, !0), u.addEventListener("touchend", d, !0), () => {
484
+ u.removeEventListener("mousedown", i, !0), u.removeEventListener("mouseup", f, !0), u.removeEventListener("touchstart", i, !0), u.removeEventListener("touchend", d, !0);
431
485
  };
432
486
  }
433
487
  }, [
434
488
  t,
489
+ r,
435
490
  i,
436
- r
491
+ c
437
492
  ]);
438
493
  }
439
- function H(e, t) {
494
+ function j(e, t) {
440
495
  if (e.button > 0)
441
496
  return !1;
442
497
  if (e.target) {
@@ -447,15 +502,15 @@ function H(e, t) {
447
502
  return t.current && !t.current.contains(e.target);
448
503
  }
449
504
  function oe(e) {
450
- if (Ft() === "virtual") {
505
+ if (Rt() === "virtual") {
451
506
  let t = document.activeElement;
452
- dt(() => {
453
- document.activeElement === t && document.contains(e) && ve(e);
507
+ St(() => {
508
+ document.activeElement === t && document.contains(e) && be(e);
454
509
  });
455
510
  } else
456
- ve(e);
511
+ be(e);
457
512
  }
458
- function Ct(e) {
513
+ function Wt(e) {
459
514
  if (!(e instanceof HTMLElement) && !(e instanceof SVGElement))
460
515
  return !1;
461
516
  let { display: t, visibility: n } = e.style, r = t !== "none" && n !== "hidden" && n !== "collapse";
@@ -466,118 +521,119 @@ function Ct(e) {
466
521
  }
467
522
  return r;
468
523
  }
469
- function Lt(e, t) {
524
+ function Vt(e, t) {
470
525
  return !e.hasAttribute("hidden") && (e.nodeName === "DETAILS" && t && t.nodeName !== "SUMMARY" ? e.hasAttribute("open") : !0);
471
526
  }
472
- function Me(e, t) {
473
- return e.nodeName !== "#comment" && Ct(e) && Lt(e, t) && (!e.parentElement || Me(e.parentElement, e));
527
+ function De(e, t) {
528
+ return e.nodeName !== "#comment" && Wt(e) && Vt(e, t) && (!e.parentElement || De(e.parentElement, e));
474
529
  }
475
- const ye = /* @__PURE__ */ y.createContext(null);
530
+ const we = /* @__PURE__ */ $.createContext(null);
476
531
  let b = null;
477
- function kt(e) {
478
- let { children: t, contain: n, restoreFocus: r, autoFocus: o } = e, a = $(), i = $(), l = $([]), { parentNode: c } = I(ye) || {}, s = q(() => new ae({
479
- scopeRef: l
532
+ function Ht(e) {
533
+ let { children: t, contain: n, restoreFocus: r, autoFocus: o } = e, a = w(null), i = w(null), c = w([]), { parentNode: l } = H(we) || {}, s = I(() => new ae({
534
+ scopeRef: c
480
535
  }), [
481
- l
536
+ c
482
537
  ]);
483
- E(() => {
484
- let d = c || v.root;
485
- if (v.getTreeNode(d.scopeRef) && b && !Y(b, d.scopeRef)) {
486
- let m = v.getTreeNode(b);
487
- m && (d = m);
538
+ h(() => {
539
+ let d = l || v.root;
540
+ if (v.getTreeNode(d.scopeRef) && b && !J(b, d.scopeRef)) {
541
+ let p = v.getTreeNode(b);
542
+ p && (d = p);
488
543
  }
489
544
  d.addChild(s), v.addNode(s);
490
545
  }, [
491
546
  s,
492
- c
493
- ]), E(() => {
494
- let d = v.getTreeNode(l);
495
- d.contain = n;
547
+ l
548
+ ]), h(() => {
549
+ let d = v.getTreeNode(c);
550
+ d && (d.contain = !!n);
496
551
  }, [
497
552
  n
498
- ]), E(() => {
499
- let d = a.current.nextSibling, m = [];
500
- for (; d && d !== i.current; )
501
- m.push(d), d = d.nextSibling;
502
- l.current = m;
553
+ ]), h(() => {
554
+ var d;
555
+ let p = (d = a.current) === null || d === void 0 ? void 0 : d.nextSibling, m = [];
556
+ for (; p && p !== i.current; )
557
+ m.push(p), p = p.nextSibling;
558
+ c.current = m;
503
559
  }, [
504
560
  t
505
- ]), Rt(l, r, n), Dt(l, n), Ht(l, r, n), Bt(l, o), x(() => {
506
- if (l) {
507
- let d = document.activeElement, m = null;
508
- if (g(d, l.current)) {
509
- for (let f of v.traverse())
510
- g(d, f.scopeRef.current) && (m = f);
511
- m === v.getTreeNode(l) && (b = m.scopeRef);
512
- }
513
- return () => {
514
- let f = v.getTreeNode(l).parent.scopeRef;
515
- (l === b || Y(l, b)) && (!f || v.getTreeNode(f)) && (b = f), v.removeTreeNode(l);
516
- };
561
+ ]), Yt(c, r, n), zt(c, n), Jt(c, r, n), Gt(c, o), S(() => {
562
+ let d = document.activeElement, p = null;
563
+ if (E(d, c.current)) {
564
+ for (let m of v.traverse())
565
+ m.scopeRef && E(d, m.scopeRef.current) && (p = m);
566
+ p === v.getTreeNode(c) && (b = p.scopeRef);
517
567
  }
518
568
  }, [
519
- l
569
+ c
570
+ ]), h(() => () => {
571
+ var d, p, m;
572
+ let F = (m = (p = v.getTreeNode(c)) === null || p === void 0 || (d = p.parent) === null || d === void 0 ? void 0 : d.scopeRef) !== null && m !== void 0 ? m : null;
573
+ (c === b || J(c, b)) && (!F || v.getTreeNode(F)) && (b = F), v.removeTreeNode(c);
574
+ }, [
575
+ c
520
576
  ]);
521
- let u = q(() => Ot(l), []), p = q(() => ({
577
+ let u = I(() => Kt(c), []), f = I(() => ({
522
578
  focusManager: u,
523
579
  parentNode: s
524
580
  }), [
525
581
  s,
526
582
  u
527
583
  ]);
528
- return /* @__PURE__ */ y.createElement(ye.Provider, {
529
- value: p
530
- }, /* @__PURE__ */ y.createElement("span", {
584
+ return /* @__PURE__ */ $.createElement(we.Provider, {
585
+ value: f
586
+ }, /* @__PURE__ */ $.createElement("span", {
531
587
  "data-focus-scope-start": !0,
532
588
  hidden: !0,
533
589
  ref: a
534
- }), t, /* @__PURE__ */ y.createElement("span", {
590
+ }), t, /* @__PURE__ */ $.createElement("span", {
535
591
  "data-focus-scope-end": !0,
536
592
  hidden: !0,
537
593
  ref: i
538
594
  }));
539
595
  }
540
- function Ot(e) {
596
+ function Kt(e) {
541
597
  return {
542
598
  focusNext(t = {}) {
543
- let n = e.current, { from: r, tabbable: o, wrap: a, accept: i } = t, l = r || document.activeElement, c = n[0].previousElementSibling, s = F(S(n), {
599
+ let n = e.current, { from: r, tabbable: o, wrap: a, accept: i } = t, c = r || document.activeElement, l = n[0].previousElementSibling, s = C(n), u = P(s, {
544
600
  tabbable: o,
545
601
  accept: i
546
602
  }, n);
547
- s.currentNode = g(l, n) ? l : c;
548
- let u = s.nextNode();
549
- return !u && a && (s.currentNode = c, u = s.nextNode()), u && N(u, !0), u;
603
+ u.currentNode = E(c, n) ? c : l;
604
+ let f = u.nextNode();
605
+ return !f && a && (u.currentNode = l, f = u.nextNode()), f && N(f, !0), f;
550
606
  },
551
607
  focusPrevious(t = {}) {
552
- let n = e.current, { from: r, tabbable: o, wrap: a, accept: i } = t, l = r || document.activeElement, c = n[n.length - 1].nextElementSibling, s = F(S(n), {
608
+ let n = e.current, { from: r, tabbable: o, wrap: a, accept: i } = t, c = r || document.activeElement, l = n[n.length - 1].nextElementSibling, s = C(n), u = P(s, {
553
609
  tabbable: o,
554
610
  accept: i
555
611
  }, n);
556
- s.currentNode = g(l, n) ? l : c;
557
- let u = s.previousNode();
558
- return !u && a && (s.currentNode = c, u = s.previousNode()), u && N(u, !0), u;
612
+ u.currentNode = E(c, n) ? c : l;
613
+ let f = u.previousNode();
614
+ return !f && a && (u.currentNode = l, f = u.previousNode()), f && N(f, !0), f;
559
615
  },
560
616
  focusFirst(t = {}) {
561
- let n = e.current, { tabbable: r, accept: o } = t, a = F(S(n), {
617
+ let n = e.current, { tabbable: r, accept: o } = t, a = C(n), i = P(a, {
562
618
  tabbable: r,
563
619
  accept: o
564
620
  }, n);
565
- a.currentNode = n[0].previousElementSibling;
566
- let i = a.nextNode();
567
- return i && N(i, !0), i;
621
+ i.currentNode = n[0].previousElementSibling;
622
+ let c = i.nextNode();
623
+ return c && N(c, !0), c;
568
624
  },
569
625
  focusLast(t = {}) {
570
- let n = e.current, { tabbable: r, accept: o } = t, a = F(S(n), {
626
+ let n = e.current, { tabbable: r, accept: o } = t, a = C(n), i = P(a, {
571
627
  tabbable: r,
572
628
  accept: o
573
629
  }, n);
574
- a.currentNode = n[n.length - 1].nextElementSibling;
575
- let i = a.previousNode();
576
- return i && N(i, !0), i;
630
+ i.currentNode = n[n.length - 1].nextElementSibling;
631
+ let c = i.previousNode();
632
+ return c && N(c, !0), c;
577
633
  }
578
634
  };
579
635
  }
580
- const se = [
636
+ const ce = [
581
637
  "input:not([disabled]):not([type=hidden])",
582
638
  "select:not([disabled])",
583
639
  "textarea:not([disabled])",
@@ -591,13 +647,13 @@ const se = [
591
647
  "audio[controls]",
592
648
  "video[controls]",
593
649
  "[contenteditable]"
594
- ], Mt = se.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
595
- se.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
596
- const At = se.join(':not([hidden]):not([tabindex="-1"]),');
597
- function S(e) {
650
+ ], qt = ce.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
651
+ ce.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
652
+ const jt = ce.join(':not([hidden]):not([tabindex="-1"]),');
653
+ function C(e) {
598
654
  return e[0].parentElement;
599
655
  }
600
- function V(e) {
656
+ function A(e) {
601
657
  let t = v.getTreeNode(b);
602
658
  for (; t && t.scopeRef !== e; ) {
603
659
  if (t.contain)
@@ -606,63 +662,70 @@ function V(e) {
606
662
  }
607
663
  return !0;
608
664
  }
609
- function Dt(e, t) {
610
- let n = $(), r = $(null);
611
- E(() => {
665
+ function zt(e, t) {
666
+ let n = w(), r = w();
667
+ h(() => {
612
668
  let o = e.current;
613
669
  if (!t) {
614
- r.current && (cancelAnimationFrame(r.current), r.current = null);
670
+ r.current && (cancelAnimationFrame(r.current), r.current = void 0);
615
671
  return;
616
672
  }
617
- let a = (c) => {
618
- if (c.key !== "Tab" || c.altKey || c.ctrlKey || c.metaKey || !V(e))
673
+ let a = (l) => {
674
+ if (l.key !== "Tab" || l.altKey || l.ctrlKey || l.metaKey || !A(e))
619
675
  return;
620
676
  let s = document.activeElement, u = e.current;
621
- if (!g(s, u))
677
+ if (!u || !E(s, u))
622
678
  return;
623
- let p = F(S(u), {
679
+ let f = C(u), d = P(f, {
624
680
  tabbable: !0
625
681
  }, u);
626
- p.currentNode = s;
627
- let d = c.shiftKey ? p.previousNode() : p.nextNode();
628
- d || (p.currentNode = c.shiftKey ? u[u.length - 1].nextElementSibling : u[0].previousElementSibling, d = c.shiftKey ? p.previousNode() : p.nextNode()), c.preventDefault(), d && N(d, !0);
629
- }, i = (c) => {
630
- (!b || Y(b, e)) && g(c.target, e.current) ? (b = e, n.current = c.target) : V(e) && !G(c.target, e) ? n.current ? n.current.focus() : b && J(b.current) : V(e) && (n.current = c.target);
631
- }, l = (c) => {
682
+ if (!s)
683
+ return;
684
+ d.currentNode = s;
685
+ let p = l.shiftKey ? d.previousNode() : d.nextNode();
686
+ p || (d.currentNode = l.shiftKey ? u[u.length - 1].nextElementSibling : u[0].previousElementSibling, p = l.shiftKey ? d.previousNode() : d.nextNode()), l.preventDefault(), p && N(p, !0);
687
+ }, i = (l) => {
688
+ (!b || J(b, e)) && E(l.target, e.current) ? (b = e, n.current = l.target) : A(e) && !U(l.target, e) ? n.current ? n.current.focus() : b && b.current && X(b.current) : A(e) && (n.current = l.target);
689
+ }, c = (l) => {
632
690
  r.current && cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
633
- V(e) && !G(document.activeElement, e) && (b = e, document.body.contains(c.target) ? (n.current = c.target, n.current.focus()) : b && J(b.current));
691
+ if (document.activeElement && A(e) && !U(document.activeElement, e))
692
+ if (b = e, document.body.contains(l.target)) {
693
+ var s;
694
+ n.current = l.target, (s = n.current) === null || s === void 0 || s.focus();
695
+ } else
696
+ b.current && X(b.current);
634
697
  });
635
698
  };
636
- return document.addEventListener("keydown", a, !1), document.addEventListener("focusin", i, !1), o.forEach((c) => c.addEventListener("focusin", i, !1)), o.forEach((c) => c.addEventListener("focusout", l, !1)), () => {
637
- document.removeEventListener("keydown", a, !1), document.removeEventListener("focusin", i, !1), o.forEach((c) => c.removeEventListener("focusin", i, !1)), o.forEach((c) => c.removeEventListener("focusout", l, !1));
699
+ return document.addEventListener("keydown", a, !1), document.addEventListener("focusin", i, !1), o == null || o.forEach((l) => l.addEventListener("focusin", i, !1)), o == null || o.forEach((l) => l.addEventListener("focusout", c, !1)), () => {
700
+ document.removeEventListener("keydown", a, !1), document.removeEventListener("focusin", i, !1), o == null || o.forEach((l) => l.removeEventListener("focusin", i, !1)), o == null || o.forEach((l) => l.removeEventListener("focusout", c, !1));
638
701
  };
639
702
  }, [
640
703
  e,
641
704
  t
642
- ]), x(() => () => {
705
+ ]), h(() => () => {
643
706
  r.current && cancelAnimationFrame(r.current);
644
707
  }, [
645
708
  r
646
709
  ]);
647
710
  }
648
711
  function Ae(e) {
649
- return G(e);
712
+ return U(e);
650
713
  }
651
- function g(e, t) {
652
- return t.some((n) => n.contains(e));
714
+ function E(e, t) {
715
+ return !e || !t ? !1 : t.some((n) => n.contains(e));
653
716
  }
654
- function G(e, t = null) {
717
+ function U(e, t = null) {
655
718
  if (e instanceof Element && e.closest("[data-react-aria-top-layer]"))
656
719
  return !0;
657
720
  for (let { scopeRef: n } of v.traverse(v.getTreeNode(t)))
658
- if (g(e, n.current))
721
+ if (n && E(e, n.current))
659
722
  return !0;
660
723
  return !1;
661
724
  }
662
- function It(e) {
663
- return G(e, b);
725
+ function _t(e) {
726
+ return U(e, b);
664
727
  }
665
- function Y(e, t) {
728
+ function J(e, t) {
666
729
  var n;
667
730
  let r = (n = v.getTreeNode(t)) === null || n === void 0 ? void 0 : n.parent;
668
731
  for (; r; ) {
@@ -684,34 +747,34 @@ function N(e, t = !1) {
684
747
  } catch {
685
748
  }
686
749
  }
687
- function J(e, t = !0) {
688
- let n = e[0].previousElementSibling, r = F(S(e), {
750
+ function X(e, t = !0) {
751
+ let n = e[0].previousElementSibling, r = C(e), o = P(r, {
689
752
  tabbable: t
690
753
  }, e);
691
- r.currentNode = n;
692
- let o = r.nextNode();
693
- t && !o && (r = F(S(e), {
754
+ o.currentNode = n;
755
+ let a = o.nextNode();
756
+ t && !a && (r = C(e), o = P(r, {
694
757
  tabbable: !1
695
- }, e), r.currentNode = n, o = r.nextNode()), N(o);
758
+ }, e), o.currentNode = n, a = o.nextNode()), N(a);
696
759
  }
697
- function Bt(e, t) {
698
- const n = y.useRef(t);
699
- x(() => {
700
- n.current && (b = e, g(document.activeElement, b.current) || J(e.current)), n.current = !1;
760
+ function Gt(e, t) {
761
+ const n = $.useRef(t);
762
+ S(() => {
763
+ n.current && (b = e, !E(document.activeElement, b.current) && e.current && X(e.current)), n.current = !1;
701
764
  }, [
702
765
  e
703
766
  ]);
704
767
  }
705
- function Rt(e, t, n) {
706
- E(() => {
768
+ function Yt(e, t, n) {
769
+ h(() => {
707
770
  if (t || n)
708
771
  return;
709
772
  let r = e.current, o = (a) => {
710
773
  let i = a.target;
711
- g(i, e.current) ? b = e : Ae(i) || (b = null);
774
+ E(i, e.current) ? b = e : Ae(i) || (b = null);
712
775
  };
713
- return document.addEventListener("focusin", o, !1), r.forEach((a) => a.addEventListener("focusin", o, !1)), () => {
714
- document.removeEventListener("focusin", o, !1), r.forEach((a) => a.removeEventListener("focusin", o, !1));
776
+ return document.addEventListener("focusin", o, !1), r == null || r.forEach((a) => a.addEventListener("focusin", o, !1)), () => {
777
+ document.removeEventListener("focusin", o, !1), r == null || r.forEach((a) => a.removeEventListener("focusin", o, !1));
715
778
  };
716
779
  }, [
717
780
  e,
@@ -719,7 +782,7 @@ function Rt(e, t, n) {
719
782
  n
720
783
  ]);
721
784
  }
722
- function Wt(e) {
785
+ function Ut(e) {
723
786
  let t = v.getTreeNode(b);
724
787
  for (; t && t.scopeRef !== e; ) {
725
788
  if (t.nodeToRestore)
@@ -728,86 +791,103 @@ function Wt(e) {
728
791
  }
729
792
  return (t == null ? void 0 : t.scopeRef) === e;
730
793
  }
731
- function Ht(e, t, n) {
732
- const r = $(typeof document < "u" ? document.activeElement : null);
733
- E(() => {
794
+ function Jt(e, t, n) {
795
+ const r = w(typeof document < "u" ? document.activeElement : null);
796
+ h(() => {
734
797
  let o = e.current;
735
798
  if (!t || n)
736
799
  return;
737
800
  let a = () => {
738
- (!b || Y(b, e)) && (b = e);
801
+ (!b || J(b, e)) && E(document.activeElement, e.current) && (b = e);
739
802
  };
740
- return document.addEventListener("focusin", a, !1), o.forEach((i) => i.addEventListener("focusin", a, !1)), () => {
741
- document.removeEventListener("focusin", a, !1), o.forEach((i) => i.removeEventListener("focusin", a, !1));
803
+ return document.addEventListener("focusin", a, !1), o == null || o.forEach((i) => i.addEventListener("focusin", a, !1)), () => {
804
+ document.removeEventListener("focusin", a, !1), o == null || o.forEach((i) => i.removeEventListener("focusin", a, !1));
742
805
  };
743
806
  }, [
744
807
  e,
745
808
  n
746
- ]), E(() => {
809
+ ]), h(() => {
747
810
  if (!t)
748
811
  return;
749
- v.getTreeNode(e).nodeToRestore = r.current;
750
812
  let o = (a) => {
751
- if (a.key !== "Tab" || a.altKey || a.ctrlKey || a.metaKey)
813
+ if (a.key !== "Tab" || a.altKey || a.ctrlKey || a.metaKey || !A(e))
752
814
  return;
753
815
  let i = document.activeElement;
754
- if (!g(i, e.current))
816
+ if (!E(i, e.current))
817
+ return;
818
+ let c = v.getTreeNode(e);
819
+ if (!c)
755
820
  return;
756
- let l = v.getTreeNode(e).nodeToRestore, c = F(document.body, {
821
+ let l = c.nodeToRestore, s = P(document.body, {
757
822
  tabbable: !0
758
823
  });
759
- c.currentNode = i;
760
- let s = a.shiftKey ? c.previousNode() : c.nextNode();
761
- if ((!document.body.contains(l) || l === document.body) && (l = null, v.getTreeNode(e).nodeToRestore = null), (!s || !g(s, e.current)) && l) {
762
- c.currentNode = l;
824
+ s.currentNode = i;
825
+ let u = a.shiftKey ? s.previousNode() : s.nextNode();
826
+ if ((!l || !document.body.contains(l) || l === document.body) && (l = void 0, c.nodeToRestore = void 0), (!u || !E(u, e.current)) && l) {
827
+ s.currentNode = l;
763
828
  do
764
- s = a.shiftKey ? c.previousNode() : c.nextNode();
765
- while (g(s, e.current));
766
- a.preventDefault(), a.stopPropagation(), s ? N(s, !0) : Ae(l) ? N(l, !0) : i.blur();
829
+ u = a.shiftKey ? s.previousNode() : s.nextNode();
830
+ while (E(u, e.current));
831
+ a.preventDefault(), a.stopPropagation(), u ? N(u, !0) : Ae(l) ? N(l, !0) : i.blur();
767
832
  }
768
833
  };
769
834
  return n || document.addEventListener("keydown", o, !0), () => {
770
835
  n || document.removeEventListener("keydown", o, !0);
771
- let a = v.getTreeNode(e).nodeToRestore;
772
- if (t && a && (g(document.activeElement, e.current) || document.activeElement === document.body && Wt(e))) {
773
- let i = v.clone();
774
- requestAnimationFrame(() => {
775
- if (document.activeElement === document.body) {
776
- let l = i.getTreeNode(e);
777
- for (; l; ) {
778
- if (l.nodeToRestore && document.body.contains(l.nodeToRestore)) {
779
- N(l.nodeToRestore);
780
- return;
781
- }
782
- l = l.parent;
783
- }
784
- for (l = i.getTreeNode(e); l; ) {
785
- if (l.scopeRef && v.getTreeNode(l.scopeRef)) {
786
- J(l.scopeRef.current, !0);
787
- return;
788
- }
789
- l = l.parent;
790
- }
791
- }
792
- });
793
- }
794
836
  };
795
837
  }, [
796
838
  e,
797
839
  t,
798
840
  n
841
+ ]), h(() => {
842
+ if (!t)
843
+ return;
844
+ let o = v.getTreeNode(e);
845
+ if (!!o) {
846
+ var a;
847
+ return o.nodeToRestore = (a = r.current) !== null && a !== void 0 ? a : void 0, () => {
848
+ let i = v.getTreeNode(e);
849
+ if (!i)
850
+ return;
851
+ let c = i.nodeToRestore;
852
+ if (t && c && (E(document.activeElement, e.current) || document.activeElement === document.body && Ut(e))) {
853
+ let l = v.clone();
854
+ requestAnimationFrame(() => {
855
+ if (document.activeElement === document.body) {
856
+ let s = l.getTreeNode(e);
857
+ for (; s; ) {
858
+ if (s.nodeToRestore && document.body.contains(s.nodeToRestore)) {
859
+ N(s.nodeToRestore);
860
+ return;
861
+ }
862
+ s = s.parent;
863
+ }
864
+ for (s = l.getTreeNode(e); s; ) {
865
+ if (s.scopeRef && s.scopeRef.current && v.getTreeNode(s.scopeRef)) {
866
+ X(s.scopeRef.current, !0);
867
+ return;
868
+ }
869
+ s = s.parent;
870
+ }
871
+ }
872
+ });
873
+ }
874
+ };
875
+ }
876
+ }, [
877
+ e,
878
+ t
799
879
  ]);
800
880
  }
801
- function F(e, t, n) {
802
- let r = t != null && t.tabbable ? At : Mt, o = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
881
+ function P(e, t, n) {
882
+ let r = t != null && t.tabbable ? jt : qt, o = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
803
883
  acceptNode(a) {
804
884
  var i;
805
- return !(t == null || (i = t.from) === null || i === void 0) && i.contains(a) ? NodeFilter.FILTER_REJECT : a.matches(r) && Me(a) && (!n || g(a, n)) && (!(t != null && t.accept) || t.accept(a)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
885
+ return !(t == null || (i = t.from) === null || i === void 0) && i.contains(a) ? NodeFilter.FILTER_REJECT : a.matches(r) && De(a) && (!n || E(a, n)) && (!(t != null && t.accept) || t.accept(a)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
806
886
  }
807
887
  });
808
888
  return t != null && t.from && (o.currentNode = t.from), o;
809
889
  }
810
- class ue {
890
+ class se {
811
891
  get size() {
812
892
  return this.fastMap.size;
813
893
  }
@@ -815,7 +895,10 @@ class ue {
815
895
  return this.fastMap.get(t);
816
896
  }
817
897
  addTreeNode(t, n, r) {
818
- let o = this.fastMap.get(n != null ? n : null), a = new ae({
898
+ let o = this.fastMap.get(n != null ? n : null);
899
+ if (!o)
900
+ return;
901
+ let a = new ae({
819
902
  scopeRef: t
820
903
  });
821
904
  o.addChild(a), a.parent = o, this.fastMap.set(t, a), r && (a.nodeToRestore = r);
@@ -826,11 +909,14 @@ class ue {
826
909
  removeTreeNode(t) {
827
910
  if (t === null)
828
911
  return;
829
- let n = this.fastMap.get(t), r = n.parent;
912
+ let n = this.fastMap.get(t);
913
+ if (!n)
914
+ return;
915
+ let r = n.parent;
830
916
  for (let a of this.traverse())
831
- a !== n && n.nodeToRestore && a.nodeToRestore && n.scopeRef.current && g(a.nodeToRestore, n.scopeRef.current) && (a.nodeToRestore = n.nodeToRestore);
917
+ a !== n && n.nodeToRestore && a.nodeToRestore && n.scopeRef && n.scopeRef.current && E(a.nodeToRestore, n.scopeRef.current) && (a.nodeToRestore = n.nodeToRestore);
832
918
  let o = n.children;
833
- r.removeChild(n), o.size > 0 && o.forEach((a) => r.addChild(a)), this.fastMap.delete(n.scopeRef);
919
+ r && (r.removeChild(n), o.size > 0 && o.forEach((a) => r && r.addChild(a))), this.fastMap.delete(n.scopeRef);
834
920
  }
835
921
  *traverse(t = this.root) {
836
922
  if (t.scopeRef != null && (yield t), t.children.size > 0)
@@ -838,13 +924,15 @@ class ue {
838
924
  yield* this.traverse(n);
839
925
  }
840
926
  clone() {
841
- let t = new ue();
842
- for (let n of this.traverse())
843
- t.addTreeNode(n.scopeRef, n.parent.scopeRef, n.nodeToRestore);
844
- return t;
927
+ var t;
928
+ let n = new se();
929
+ var r;
930
+ for (let o of this.traverse())
931
+ n.addTreeNode(o.scopeRef, (r = (t = o.parent) === null || t === void 0 ? void 0 : t.scopeRef) !== null && r !== void 0 ? r : null, o.nodeToRestore);
932
+ return n;
845
933
  }
846
934
  constructor() {
847
- ne(this, "fastMap", /* @__PURE__ */ new Map()), this.root = new ae({
935
+ this.fastMap = /* @__PURE__ */ new Map(), this.root = new ae({
848
936
  scopeRef: null
849
937
  }), this.fastMap.set(null, this.root);
850
938
  }
@@ -857,56 +945,56 @@ class ae {
857
945
  this.children.delete(t), t.parent = void 0;
858
946
  }
859
947
  constructor(t) {
860
- ne(this, "children", /* @__PURE__ */ new Set()), ne(this, "contain", !1), this.scopeRef = t.scopeRef;
948
+ this.children = /* @__PURE__ */ new Set(), this.contain = !1, this.scopeRef = t.scopeRef;
861
949
  }
862
950
  }
863
- let v = new ue();
864
- const Vt = /* @__PURE__ */ new WeakMap(), T = [];
865
- function Kt(e, t) {
866
- let { onClose: n, shouldCloseOnBlur: r, isOpen: o, isDismissable: a = !1, isKeyboardDismissDisabled: i = !1, shouldCloseOnInteractOutside: l } = e;
867
- x(() => (o && T.push(t), () => {
868
- let f = T.indexOf(t);
869
- f >= 0 && T.splice(f, 1);
951
+ let v = new se();
952
+ const Xt = /* @__PURE__ */ new WeakMap(), x = [];
953
+ function Qt(e, t) {
954
+ let { onClose: n, shouldCloseOnBlur: r, isOpen: o, isDismissable: a = !1, isKeyboardDismissDisabled: i = !1, shouldCloseOnInteractOutside: c } = e;
955
+ S(() => (o && x.push(t), () => {
956
+ let m = x.indexOf(t);
957
+ m >= 0 && x.splice(m, 1);
870
958
  }), [
871
959
  o,
872
960
  t
873
961
  ]);
874
- let c = () => {
875
- T[T.length - 1] === t && n && n();
876
- }, s = (f) => {
877
- (!l || l(f.target)) && T[T.length - 1] === t && (f.stopPropagation(), f.preventDefault());
878
- }, u = (f) => {
879
- (!l || l(f.target)) && (T[T.length - 1] === t && (f.stopPropagation(), f.preventDefault()), c());
880
- }, p = (f) => {
881
- f.key === "Escape" && !i && (f.stopPropagation(), f.preventDefault(), c());
962
+ let l = () => {
963
+ x[x.length - 1] === t && n && n();
964
+ }, s = (m) => {
965
+ (!c || c(m.target)) && x[x.length - 1] === t && (m.stopPropagation(), m.preventDefault());
966
+ }, u = (m) => {
967
+ (!c || c(m.target)) && (x[x.length - 1] === t && (m.stopPropagation(), m.preventDefault()), l());
968
+ }, f = (m) => {
969
+ m.key === "Escape" && !i && (m.stopPropagation(), m.preventDefault(), l());
882
970
  };
883
- Pt({
971
+ Bt({
884
972
  ref: t,
885
- onInteractOutside: a ? u : null,
973
+ onInteractOutside: a && o ? u : null,
886
974
  onInteractOutsideStart: s
887
975
  });
888
- let { focusWithinProps: d } = St({
976
+ let { focusWithinProps: d } = It({
889
977
  isDisabled: !r,
890
- onBlurWithin: (f) => {
891
- f.relatedTarget && It(f.relatedTarget) || (!l || l(f.relatedTarget)) && n();
978
+ onBlurWithin: (m) => {
979
+ !m.relatedTarget || _t(m.relatedTarget) || (!c || c(m.relatedTarget)) && n();
892
980
  }
893
- }), m = (f) => {
894
- f.target === f.currentTarget && f.preventDefault();
981
+ }), p = (m) => {
982
+ m.target === m.currentTarget && m.preventDefault();
895
983
  };
896
984
  return {
897
985
  overlayProps: {
898
- onKeyDown: p,
986
+ onKeyDown: f,
899
987
  ...d
900
988
  },
901
989
  underlayProps: {
902
- onPointerDown: m
990
+ onPointerDown: p
903
991
  }
904
992
  };
905
993
  }
906
- function qt(e, t, n) {
994
+ function Zt(e, t, n) {
907
995
  let { type: r } = e, { isOpen: o } = t;
908
- x(() => {
909
- n && n.current && Vt.set(n.current, t.close);
996
+ S(() => {
997
+ n && n.current && Xt.set(n.current, t.close);
910
998
  });
911
999
  let a;
912
1000
  r === "menu" ? a = !0 : r === "listbox" && (a = "listbox");
@@ -923,7 +1011,7 @@ function qt(e, t, n) {
923
1011
  }
924
1012
  };
925
1013
  }
926
- const Z = typeof window < "u" && window.visualViewport, jt = /* @__PURE__ */ new Set([
1014
+ const ee = typeof document < "u" && window.visualViewport, en = /* @__PURE__ */ new Set([
927
1015
  "checkbox",
928
1016
  "radio",
929
1017
  "range",
@@ -934,78 +1022,78 @@ const Z = typeof window < "u" && window.visualViewport, jt = /* @__PURE__ */ new
934
1022
  "submit",
935
1023
  "reset"
936
1024
  ]);
937
- let K = 0, ee;
938
- function zt(e = {}) {
1025
+ let z = 0, te;
1026
+ function tn(e = {}) {
939
1027
  let { isDisabled: t } = e;
940
- E(() => {
1028
+ h(() => {
941
1029
  if (!t)
942
- return K++, K === 1 && (bt() ? ee = Yt() : ee = Gt()), () => {
943
- K--, K === 0 && ee();
1030
+ return z++, z === 1 && (xt() ? te = rn() : te = nn()), () => {
1031
+ z--, z === 0 && te();
944
1032
  };
945
1033
  }, [
946
1034
  t
947
1035
  ]);
948
1036
  }
949
- function Gt() {
950
- return z(D(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), D(document.documentElement, "overflow", "hidden"));
1037
+ function nn() {
1038
+ return Y(B(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), B(document.documentElement, "overflow", "hidden"));
951
1039
  }
952
- function Yt() {
953
- let e, t = 0, n = (p) => {
954
- e = ke(p.target), !(e === document.documentElement && e === document.body) && (t = p.changedTouches[0].pageY);
955
- }, r = (p) => {
956
- if (e === document.documentElement || e === document.body) {
957
- p.preventDefault();
1040
+ function rn() {
1041
+ let e, t = 0, n = (f) => {
1042
+ e = Oe(f.target), !(e === document.documentElement && e === document.body) && (t = f.changedTouches[0].pageY);
1043
+ }, r = (f) => {
1044
+ if (!e || e === document.documentElement || e === document.body) {
1045
+ f.preventDefault();
958
1046
  return;
959
1047
  }
960
- let d = p.changedTouches[0].pageY, m = e.scrollTop, f = e.scrollHeight - e.clientHeight;
961
- (m <= 0 && d > t || m >= f && d < t) && p.preventDefault(), t = d;
962
- }, o = (p) => {
963
- let d = p.target;
964
- Ne(d) && d !== document.activeElement && (p.preventDefault(), d.style.transform = "translateY(-2000px)", d.focus(), requestAnimationFrame(() => {
1048
+ let d = f.changedTouches[0].pageY, p = e.scrollTop, m = e.scrollHeight - e.clientHeight;
1049
+ m !== 0 && ((p <= 0 && d > t || p >= m && d < t) && f.preventDefault(), t = d);
1050
+ }, o = (f) => {
1051
+ let d = f.target;
1052
+ Te(d) && d !== document.activeElement && (f.preventDefault(), d.style.transform = "translateY(-2000px)", d.focus(), requestAnimationFrame(() => {
965
1053
  d.style.transform = "";
966
1054
  }));
967
- }, a = (p) => {
968
- let d = p.target;
969
- Ne(d) && (d.style.transform = "translateY(-2000px)", requestAnimationFrame(() => {
970
- d.style.transform = "", Z && (Z.height < window.innerHeight ? requestAnimationFrame(() => {
971
- Te(d);
972
- }) : Z.addEventListener("resize", () => Te(d), {
1055
+ }, a = (f) => {
1056
+ let d = f.target;
1057
+ Te(d) && (d.style.transform = "translateY(-2000px)", requestAnimationFrame(() => {
1058
+ d.style.transform = "", ee && (ee.height < window.innerHeight ? requestAnimationFrame(() => {
1059
+ ye(d);
1060
+ }) : ee.addEventListener("resize", () => ye(d), {
973
1061
  once: !0
974
1062
  }));
975
1063
  }));
976
1064
  }, i = () => {
977
1065
  window.scrollTo(0, 0);
978
- }, l = window.pageXOffset, c = window.pageYOffset, s = z(D(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), D(document.documentElement, "overflow", "hidden"), D(document.body, "marginTop", `-${c}px`));
1066
+ }, c = window.pageXOffset, l = window.pageYOffset, s = Y(B(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), B(document.documentElement, "overflow", "hidden"), B(document.body, "marginTop", `-${l}px`));
979
1067
  window.scrollTo(0, 0);
980
- let u = z(O(document, "touchstart", n, {
1068
+ let u = Y(M(document, "touchstart", n, {
981
1069
  passive: !1,
982
1070
  capture: !0
983
- }), O(document, "touchmove", r, {
1071
+ }), M(document, "touchmove", r, {
984
1072
  passive: !1,
985
1073
  capture: !0
986
- }), O(document, "touchend", o, {
1074
+ }), M(document, "touchend", o, {
987
1075
  passive: !1,
988
1076
  capture: !0
989
- }), O(document, "focus", a, !0), O(window, "scroll", i));
1077
+ }), M(document, "focus", a, !0), M(window, "scroll", i));
990
1078
  return () => {
991
- s(), u(), window.scrollTo(l, c);
1079
+ s(), u(), window.scrollTo(c, l);
992
1080
  };
993
1081
  }
994
- function D(e, t, n) {
1082
+ function B(e, t, n) {
995
1083
  let r = e.style[t];
996
1084
  return e.style[t] = n, () => {
997
1085
  e.style[t] = r;
998
1086
  };
999
1087
  }
1000
- function O(e, t, n, r) {
1088
+ function M(e, t, n, r) {
1001
1089
  return e.addEventListener(t, n, r), () => {
1002
1090
  e.removeEventListener(t, n, r);
1003
1091
  };
1004
1092
  }
1005
- function Te(e) {
1093
+ function ye(e) {
1006
1094
  let t = document.scrollingElement || document.documentElement;
1007
1095
  for (; e && e !== t; ) {
1008
- let n = ke(e);
1096
+ let n = Oe(e);
1009
1097
  if (n !== document.documentElement && n !== document.body && n !== e) {
1010
1098
  let r = n.getBoundingClientRect().top, o = e.getBoundingClientRect().top;
1011
1099
  o > r + e.clientHeight && (n.scrollTop += o - r);
@@ -1013,37 +1101,37 @@ function Te(e) {
1013
1101
  e = n.parentElement;
1014
1102
  }
1015
1103
  }
1016
- function Ne(e) {
1017
- return e instanceof HTMLInputElement && !jt.has(e.type) || e instanceof HTMLTextAreaElement || e instanceof HTMLElement && e.isContentEditable;
1104
+ function Te(e) {
1105
+ return e instanceof HTMLInputElement && !en.has(e.type) || e instanceof HTMLTextAreaElement || e instanceof HTMLElement && e.isContentEditable;
1018
1106
  }
1019
- let M = /* @__PURE__ */ new WeakMap(), w = [];
1020
- function Jt(e, t = document.body) {
1021
- let n = new Set(e), r = /* @__PURE__ */ new Set(), o = (c) => {
1022
- for (let d of c.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))
1107
+ let D = /* @__PURE__ */ new WeakMap(), y = [];
1108
+ function on(e, t = document.body) {
1109
+ let n = new Set(e), r = /* @__PURE__ */ new Set(), o = (l) => {
1110
+ for (let d of l.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))
1023
1111
  n.add(d);
1024
1112
  let s = (d) => {
1025
1113
  if (n.has(d) || r.has(d.parentElement) && d.parentElement.getAttribute("role") !== "row")
1026
1114
  return NodeFilter.FILTER_REJECT;
1027
- for (let m of n)
1028
- if (d.contains(m))
1115
+ for (let p of n)
1116
+ if (d.contains(p))
1029
1117
  return NodeFilter.FILTER_SKIP;
1030
1118
  return NodeFilter.FILTER_ACCEPT;
1031
- }, u = document.createTreeWalker(c, NodeFilter.SHOW_ELEMENT, {
1119
+ }, u = document.createTreeWalker(l, NodeFilter.SHOW_ELEMENT, {
1032
1120
  acceptNode: s
1033
- }), p = s(c);
1034
- if (p === NodeFilter.FILTER_ACCEPT && a(c), p !== NodeFilter.FILTER_REJECT) {
1121
+ }), f = s(l);
1122
+ if (f === NodeFilter.FILTER_ACCEPT && a(l), f !== NodeFilter.FILTER_REJECT) {
1035
1123
  let d = u.nextNode();
1036
1124
  for (; d != null; )
1037
1125
  a(d), d = u.nextNode();
1038
1126
  }
1039
- }, a = (c) => {
1127
+ }, a = (l) => {
1040
1128
  var s;
1041
- let u = (s = M.get(c)) !== null && s !== void 0 ? s : 0;
1042
- c.getAttribute("aria-hidden") === "true" && u === 0 || (u === 0 && c.setAttribute("aria-hidden", "true"), r.add(c), M.set(c, u + 1));
1129
+ let u = (s = D.get(l)) !== null && s !== void 0 ? s : 0;
1130
+ l.getAttribute("aria-hidden") === "true" && u === 0 || (u === 0 && l.setAttribute("aria-hidden", "true"), r.add(l), D.set(l, u + 1));
1043
1131
  };
1044
- w.length && w[w.length - 1].disconnect(), o(t);
1045
- let i = new MutationObserver((c) => {
1046
- for (let s of c)
1132
+ y.length && y[y.length - 1].disconnect(), o(t);
1133
+ let i = new MutationObserver((l) => {
1134
+ for (let s of l)
1047
1135
  if (!(s.type !== "childList" || s.addedNodes.length === 0) && ![
1048
1136
  ...n,
1049
1137
  ...r
@@ -1058,7 +1146,7 @@ function Jt(e, t = document.body) {
1058
1146
  childList: !0,
1059
1147
  subtree: !0
1060
1148
  });
1061
- let l = {
1149
+ let c = {
1062
1150
  observe() {
1063
1151
  i.observe(t, {
1064
1152
  childList: !0,
@@ -1069,68 +1157,68 @@ function Jt(e, t = document.body) {
1069
1157
  i.disconnect();
1070
1158
  }
1071
1159
  };
1072
- return w.push(l), () => {
1160
+ return y.push(c), () => {
1073
1161
  i.disconnect();
1074
- for (let c of r) {
1075
- let s = M.get(c);
1076
- s === 1 ? (c.removeAttribute("aria-hidden"), M.delete(c)) : M.set(c, s - 1);
1162
+ for (let l of r) {
1163
+ let s = D.get(l);
1164
+ s === 1 ? (l.removeAttribute("aria-hidden"), D.delete(l)) : D.set(l, s - 1);
1077
1165
  }
1078
- l === w[w.length - 1] ? (w.pop(), w.length && w[w.length - 1].observe()) : w.splice(w.indexOf(l), 1);
1166
+ c === y[y.length - 1] ? (y.pop(), y.length && y[y.length - 1].observe()) : y.splice(y.indexOf(c), 1);
1079
1167
  };
1080
1168
  }
1081
- const De = /* @__PURE__ */ y.createContext(null);
1082
- function Ut(e) {
1083
- let t = Qe(), { portalContainer: n = t ? null : document.body } = e, [r, o] = U(!1), a = q(() => ({
1084
- contain: r,
1085
- setContain: o
1169
+ const Re = /* @__PURE__ */ $.createContext(null);
1170
+ function an(e) {
1171
+ let t = Pe(), { portalContainer: n = t ? null : document.body, isExiting: r } = e, [o, a] = V(!1), i = I(() => ({
1172
+ contain: o,
1173
+ setContain: a
1086
1174
  }), [
1087
- r,
1088
- o
1175
+ o,
1176
+ a
1089
1177
  ]);
1090
1178
  if (!n)
1091
1179
  return null;
1092
- let i = /* @__PURE__ */ y.createElement(De.Provider, {
1093
- value: a
1094
- }, /* @__PURE__ */ y.createElement(kt, {
1180
+ let c = e.children;
1181
+ return e.disableFocusManagement || (c = /* @__PURE__ */ $.createElement(Ht, {
1095
1182
  restoreFocus: !0,
1096
- contain: r
1097
- }, e.children));
1098
- return /* @__PURE__ */ Ye.createPortal(i, n);
1183
+ contain: o && !r
1184
+ }, c)), c = /* @__PURE__ */ $.createElement(Re.Provider, {
1185
+ value: i
1186
+ }, /* @__PURE__ */ $.createElement(Pt, null, c)), /* @__PURE__ */ Ue.createPortal(c, n);
1099
1187
  }
1100
1188
  function Ie() {
1101
- let e = I(De), t = e == null ? void 0 : e.setContain;
1102
- E(() => {
1189
+ let e = H(Re), t = e == null ? void 0 : e.setContain;
1190
+ h(() => {
1103
1191
  t == null || t(!0);
1104
1192
  }, [
1105
1193
  t
1106
1194
  ]);
1107
1195
  }
1108
- function Xt(e, t, n) {
1109
- let { overlayProps: r, underlayProps: o } = Kt({
1196
+ function ln(e, t, n) {
1197
+ let { overlayProps: r, underlayProps: o } = Qt({
1110
1198
  ...e,
1111
1199
  isOpen: t.isOpen,
1112
1200
  onClose: t.close
1113
1201
  }, n);
1114
- return zt({
1202
+ return tn({
1115
1203
  isDisabled: !t.isOpen
1116
- }), Ie(), x(() => {
1204
+ }), Ie(), S(() => {
1117
1205
  if (t.isOpen)
1118
- return Jt([
1206
+ return on([
1119
1207
  n.current
1120
1208
  ]);
1121
1209
  }, [
1122
1210
  t.isOpen,
1123
1211
  n
1124
1212
  ]), {
1125
- modalProps: rt(r),
1213
+ modalProps: ft(r),
1126
1214
  underlayProps: o
1127
1215
  };
1128
1216
  }
1129
- function _t(e, t) {
1130
- let { role: n = "dialog" } = e, r = nt();
1217
+ function cn(e, t) {
1218
+ let { role: n = "dialog" } = e, r = ut();
1131
1219
  r = e["aria-label"] ? void 0 : r;
1132
- let o = $(!1);
1133
- return x(() => {
1220
+ let o = w(!1);
1221
+ return S(() => {
1134
1222
  if (t.current && !t.current.contains(document.activeElement)) {
1135
1223
  oe(t.current);
1136
1224
  let a = setTimeout(() => {
@@ -1144,7 +1232,7 @@ function _t(e, t) {
1144
1232
  t
1145
1233
  ]), Ie(), {
1146
1234
  dialogProps: {
1147
- ...lt(e, {
1235
+ ...$t(e, {
1148
1236
  labelable: !0
1149
1237
  }),
1150
1238
  role: n,
@@ -1159,7 +1247,7 @@ function _t(e, t) {
1159
1247
  }
1160
1248
  };
1161
1249
  }
1162
- function Qt(e, t, n) {
1250
+ function sn(e, t, n) {
1163
1251
  return t in e ? Object.defineProperty(e, t, {
1164
1252
  value: n,
1165
1253
  enumerable: !0,
@@ -1177,55 +1265,48 @@ function xe(e, t) {
1177
1265
  }
1178
1266
  return n;
1179
1267
  }
1180
- function Fe(e) {
1268
+ function Ne(e) {
1181
1269
  for (var t = 1; t < arguments.length; t++) {
1182
1270
  var n = arguments[t] != null ? arguments[t] : {};
1183
1271
  t % 2 ? xe(Object(n), !0).forEach(function(r) {
1184
- Qt(e, r, n[r]);
1272
+ sn(e, r, n[r]);
1185
1273
  }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : xe(Object(n)).forEach(function(r) {
1186
1274
  Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(n, r));
1187
1275
  });
1188
1276
  }
1189
1277
  return e;
1190
1278
  }
1191
- var Zt = (e, t, n) => {
1279
+ var un = (e, t, n) => {
1192
1280
  for (var r of Object.keys(e)) {
1193
1281
  var o;
1194
1282
  if (e[r] !== ((o = t[r]) !== null && o !== void 0 ? o : n[r]))
1195
1283
  return !1;
1196
1284
  }
1197
1285
  return !0;
1198
- }, en = (e) => (t) => {
1199
- var n = e.defaultClassName, r = Fe(Fe({}, e.defaultVariants), t);
1286
+ }, dn = (e) => (t) => {
1287
+ var n = e.defaultClassName, r = Ne(Ne({}, e.defaultVariants), t);
1200
1288
  for (var o in r) {
1201
1289
  var a, i = (a = r[o]) !== null && a !== void 0 ? a : e.defaultVariants[o];
1202
1290
  if (i != null) {
1203
- var l = i;
1204
- typeof l == "boolean" && (l = l === !0 ? "true" : "false");
1205
- var c = e.variantClassNames[o][l];
1206
- c && (n += " " + c);
1291
+ var c = i;
1292
+ typeof c == "boolean" && (c = c === !0 ? "true" : "false");
1293
+ var l = e.variantClassNames[o][c];
1294
+ l && (n += " " + l);
1207
1295
  }
1208
1296
  }
1209
1297
  for (var [s, u] of e.compoundVariants)
1210
- Zt(s, r, e.defaultVariants) && (n += " " + u);
1298
+ un(s, r, e.defaultVariants) && (n += " " + u);
1211
1299
  return n;
1212
- }, tn = en({ defaultClassName: "_1io4psq1", variantClassNames: { fullWidth: { true: "_1io4psq2", false: "_1io4psq3" } }, defaultVariants: {}, compoundVariants: [] }), nn = "_1io4psq5", rn = "_1io4psq6", on = "_1io4psq0", an = "_1io4psq9", ln = "_1io4psqa", cn = "_1io4psq8", sn = "_1io4psq4", un = "_1io4psq7";
1300
+ }, fn = dn({ defaultClassName: "_1io4psq1", variantClassNames: { fullWidth: { true: "_1io4psq2", false: "_1io4psq3" } }, defaultVariants: {}, compoundVariants: [] }), pn = "_1io4psq5", mn = "_1io4psq6", bn = "_1io4psq0", vn = "_1io4psq9", $n = "_1io4psqa", hn = "_1io4psq8", gn = "_1io4psq4", En = "_1io4psq7";
1213
1301
  function Be({
1214
1302
  children: e,
1215
1303
  className: t = "",
1216
1304
  ...n
1217
1305
  }) {
1218
- return /* @__PURE__ */ h.createElement("div", {
1219
- className: A(cn, t),
1220
- ...n
1221
- }, /* @__PURE__ */ h.createElement("div", {
1222
- className: A(an)
1223
- }, /* @__PURE__ */ h.createElement("div", {
1224
- className: A(ln)
1225
- }, e)));
1306
+ return /* @__PURE__ */ g.createElement("div", { className: R(hn, t), ...n }, /* @__PURE__ */ g.createElement("div", { className: R(vn) }, /* @__PURE__ */ g.createElement("div", { className: R($n) }, e)));
1226
1307
  }
1227
1308
  Se.set(Be, { name: "FocusedTaskActions" });
1228
- function dn({
1309
+ function wn({
1229
1310
  children: e,
1230
1311
  className: t,
1231
1312
  "data-testid": n,
@@ -1233,53 +1314,51 @@ function dn({
1233
1314
  onFocus: o,
1234
1315
  overlayProps: a,
1235
1316
  state: i,
1236
- onClose: l,
1237
- fullWidth: c = !1,
1317
+ onClose: c,
1318
+ fullWidth: l = !1,
1238
1319
  ...s
1239
1320
  }) {
1240
- const u = h.useRef(null), { modalProps: p, underlayProps: d } = Xt(
1321
+ const u = g.useRef(null), { modalProps: f, underlayProps: d } = ln(
1241
1322
  { ...s },
1242
1323
  i,
1243
1324
  u
1244
- ), { dialogProps: m, titleProps: f } = _t(s, u), X = pe(p.onFocus, m.onFocus, o), R = pe(p.onBlur, m.onBlur, r), We = qe({ "data-testid": n }), [_, He] = je(e, [{ type: Be }]);
1245
- function Ve() {
1246
- l && typeof l == "function" && l(), i.close();
1325
+ ), { dialogProps: p, titleProps: m } = cn(s, u), F = fe(f.onFocus, p.onFocus, o), Ve = fe(f.onBlur, p.onBlur, r), He = ze({ "data-testid": n }), [Q, Ke] = _e(e, [{ type: Be }]);
1326
+ function qe() {
1327
+ c && typeof c == "function" && c(), i.close();
1247
1328
  }
1248
- const de = function() {
1249
- return /* @__PURE__ */ h.createElement(Ge, {
1250
- "aria-label": "Close",
1251
- onClick: Ve,
1252
- kind: "icon",
1253
- icon: "x",
1254
- className: nn
1255
- });
1256
- }, Ke = ze(He, (fe) => fe.type === de ? [{ className: A(fe.props.classname, rn) }] : []);
1257
- return /* @__PURE__ */ h.createElement(Ut, null, /* @__PURE__ */ h.createElement("div", {
1258
- className: un,
1259
- ...d,
1260
- ...s
1261
- }, /* @__PURE__ */ h.createElement("div", {
1262
- ...p,
1263
- ...m,
1264
- ...a,
1265
- onFocus: X,
1266
- onBlur: R,
1267
- ...We("dialog"),
1268
- ref: u,
1269
- className: A(on, t)
1270
- }, /* @__PURE__ */ h.createElement("div", {
1271
- ...f,
1272
- className: sn
1273
- }, /* @__PURE__ */ h.createElement(de, null)), /* @__PURE__ */ h.createElement("div", {
1274
- className: tn({ fullWidth: c })
1275
- }, me(Ke, i.close)), _ && _.length > 0 && /* @__PURE__ */ h.createElement(h.Fragment, null, me(_, i.close)))));
1276
- }
1277
- function Re(e) {
1278
- return e.state.isOpen ? /* @__PURE__ */ h.createElement(dn, {
1279
- ...e
1280
- }, e.children) : /* @__PURE__ */ h.createElement(h.Fragment, null);
1329
+ const ue = function() {
1330
+ return /* @__PURE__ */ g.createElement(
1331
+ Ye,
1332
+ {
1333
+ "aria-label": "Close",
1334
+ onClick: qe,
1335
+ kind: "icon",
1336
+ icon: "x",
1337
+ className: pn
1338
+ }
1339
+ );
1340
+ }, je = Ge(Ke, (de) => de.type === ue ? [{ className: R(de.props.classname, mn) }] : []);
1341
+ return /* @__PURE__ */ g.createElement(an, null, /* @__PURE__ */ g.createElement("div", { className: En, ...d, ...s }, /* @__PURE__ */ g.createElement(
1342
+ "div",
1343
+ {
1344
+ ...f,
1345
+ ...p,
1346
+ ...a,
1347
+ onFocus: F,
1348
+ onBlur: Ve,
1349
+ ...He("dialog"),
1350
+ ref: u,
1351
+ className: R(bn, t)
1352
+ },
1353
+ /* @__PURE__ */ g.createElement("div", { ...m, className: gn }, /* @__PURE__ */ g.createElement(ue, null)),
1354
+ /* @__PURE__ */ g.createElement("div", { className: fn({ fullWidth: l }) }, pe(je, i.close)),
1355
+ Q && Q.length > 0 && /* @__PURE__ */ g.createElement(g.Fragment, null, pe(Q, i.close))
1356
+ )));
1357
+ }
1358
+ function We(e) {
1359
+ return e.state.isOpen ? /* @__PURE__ */ g.createElement(wn, { ...e }, e.children) : /* @__PURE__ */ g.createElement(g.Fragment, null);
1281
1360
  }
1282
- Se.set(Re, {
1361
+ Se.set(We, {
1283
1362
  name: "FocusedTask",
1284
1363
  props: {
1285
1364
  fullWidth: { type: "boolean", default: "false" },
@@ -1288,24 +1367,32 @@ Se.set(Re, {
1288
1367
  onFocus: { type: "() => void" }
1289
1368
  }
1290
1369
  });
1291
- function fn(e) {
1370
+ function yn(e) {
1292
1371
  let [t, n] = Je(e.isOpen, e.defaultOpen || !1, e.onOpenChange);
1372
+ const r = T(() => {
1373
+ n(!0);
1374
+ }, [
1375
+ n
1376
+ ]), o = T(() => {
1377
+ n(!1);
1378
+ }, [
1379
+ n
1380
+ ]), a = T(() => {
1381
+ n(!t);
1382
+ }, [
1383
+ n,
1384
+ t
1385
+ ]);
1293
1386
  return {
1294
1387
  isOpen: t,
1295
1388
  setOpen: n,
1296
- open() {
1297
- n(!0);
1298
- },
1299
- close() {
1300
- n(!1);
1301
- },
1302
- toggle() {
1303
- n(!t);
1304
- }
1389
+ open: r,
1390
+ close: o,
1391
+ toggle: a
1305
1392
  };
1306
1393
  }
1307
- function gn(e = {}) {
1308
- const t = fn(e), n = $(null), { triggerProps: r, overlayProps: o } = qt({ type: "dialog" }, t, n), { onPress: a, ...i } = r;
1394
+ function Cn(e = {}) {
1395
+ const t = yn(e), n = w(null), { triggerProps: r, overlayProps: o } = Zt({ type: "dialog" }, t, n), { onPress: a, ...i } = r;
1309
1396
  return {
1310
1397
  triggerProps: {
1311
1398
  ...i,
@@ -1316,14 +1403,14 @@ function gn(e = {}) {
1316
1403
  focusedTaskProps: { overlayProps: o, state: t }
1317
1404
  };
1318
1405
  }
1319
- const pn = {
1320
- components: [Re],
1406
+ const Tn = {
1407
+ components: [We],
1321
1408
  examples: {
1322
1409
  standard: {
1323
1410
  label: "Standard",
1324
1411
  examples: {
1325
1412
  basic: {
1326
- react: be`
1413
+ react: me`
1327
1414
  import { FocusedTask, FocusedTaskActions } from "@sps-woodland/focused-task";
1328
1415
  import { Button } from "@sps-woodland/buttons";
1329
1416
  import { Card } from "@sps-woodland/cards";
@@ -1369,7 +1456,7 @@ const pn = {
1369
1456
  label: "Fill Width",
1370
1457
  examples: {
1371
1458
  basic: {
1372
- react: be`
1459
+ react: me`
1373
1460
  import { FocusedTask, FocusedTaskActions } from "@sps-woodland/focused-task";
1374
1461
  import { Button } from "@sps-woodland/buttons";
1375
1462
  import { Card } from "@sps-woodland/cards";
@@ -1413,12 +1500,12 @@ const pn = {
1413
1500
  }
1414
1501
  }
1415
1502
  }
1416
- }, En = {
1417
- "Focused Task": pn
1503
+ }, Ln = {
1504
+ "Focused Task": Tn
1418
1505
  };
1419
1506
  export {
1420
- Re as FocusedTask,
1507
+ We as FocusedTask,
1421
1508
  Be as FocusedTaskActions,
1422
- En as MANIFEST,
1423
- gn as useFocusedTask
1509
+ Ln as MANIFEST,
1510
+ Cn as useFocusedTask
1424
1511
  };