@nice2dev/ui-core 1.4.20 → 1.4.22

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,7 +1,7 @@
1
1
  import { useNiceTranslation as J } from "@nice2dev/i18n";
2
- import { jsx as N, jsxs as V, Fragment as Ft } from "react/jsx-runtime";
3
- import He, { useContext as ae, useCallback as I, createContext as Ne, useRef as O, useEffect as R, useLayoutEffect as _t, useState as j, useMemo as pe, useSyncExternalStore as mt, forwardRef as Bt, useImperativeHandle as Kt } from "react";
4
- const Mt = /* @__PURE__ */ new Set([
2
+ import { jsx as C, jsxs as V, Fragment as _t } from "react/jsx-runtime";
3
+ import Ne, { useContext as ae, useCallback as D, createContext as He, useRef as O, useEffect as R, useLayoutEffect as Bt, useState as j, useMemo as pe, useSyncExternalStore as Mt, forwardRef as Kt, useImperativeHandle as jt } from "react";
4
+ const gt = /* @__PURE__ */ new Set([
5
5
  "",
6
6
  "text",
7
7
  "search",
@@ -17,7 +17,7 @@ const Mt = /* @__PURE__ */ new Set([
17
17
  "datetime-local",
18
18
  "month",
19
19
  "week"
20
- ]), jt = /* @__PURE__ */ new Set([
20
+ ]), Ut = /* @__PURE__ */ new Set([
21
21
  "checkbox",
22
22
  "radio",
23
23
  "button",
@@ -26,7 +26,7 @@ const Mt = /* @__PURE__ */ new Set([
26
26
  "file",
27
27
  "image",
28
28
  "color"
29
- ]), Ut = /* @__PURE__ */ new Set([
29
+ ]), Gt = /* @__PURE__ */ new Set([
30
30
  "button",
31
31
  "link",
32
32
  "checkbox",
@@ -38,28 +38,28 @@ const Mt = /* @__PURE__ */ new Set([
38
38
  "menuitemradio",
39
39
  "option",
40
40
  "treeitem"
41
- ]), gt = (n) => n instanceof HTMLInputElement && Mt.has(n.type), Pe = (n) => n instanceof HTMLTextAreaElement, bt = (n) => n instanceof HTMLElement && n.isContentEditable;
42
- function Gt(n, e) {
43
- const { intent: t, direction: a } = e;
44
- return gt(n) ? t === "navigate" ? a === "left" || a === "right" : t === "first" || t === "last" || t === "activate" || t === "toggleHints" : Pe(n) || bt(n) ? t !== "back" && t !== "view" && t !== "menu" && t !== "secondary" : n instanceof HTMLSelectElement ? t !== "back" && t !== "view" && t !== "menu" : n instanceof HTMLInputElement ? Te.has(n.type) ? t === "navigate" || t === "first" || t === "last" || t === "pagePrev" || t === "pageNext" : n.type === "radio" && t === "navigate" : !1;
41
+ ]), bt = (t) => t instanceof HTMLInputElement && gt.has(t.type), Pe = (t) => t instanceof HTMLTextAreaElement, yt = (t) => t instanceof HTMLElement && t.isContentEditable;
42
+ function qt(t, e) {
43
+ const { intent: n, direction: a } = e;
44
+ return bt(t) ? n === "navigate" ? a === "left" || a === "right" : n === "first" || n === "last" || n === "activate" || n === "toggleHints" : Pe(t) || yt(t) ? n !== "back" && n !== "view" && n !== "menu" && n !== "secondary" : t instanceof HTMLSelectElement ? n !== "back" && n !== "view" && n !== "menu" : t instanceof HTMLInputElement ? Te.has(t.type) ? n === "navigate" || n === "first" || n === "last" || n === "pagePrev" || n === "pageNext" : t.type === "radio" && n === "navigate" : !1;
45
45
  }
46
- function yt(n) {
47
- if (n instanceof HTMLButtonElement || n.tagName === "SUMMARY")
46
+ function wt(t) {
47
+ if (t instanceof HTMLButtonElement || t.tagName === "SUMMARY")
48
48
  return !0;
49
- if (n instanceof HTMLAnchorElement)
50
- return n.hasAttribute("href");
51
- if (n instanceof HTMLInputElement)
52
- return jt.has(n.type);
53
- const e = n.getAttribute("role");
54
- return e !== null && Ut.has(e);
55
- }
56
- function qt(n) {
57
- if (typeof n.click == "function") {
58
- n.click();
49
+ if (t instanceof HTMLAnchorElement)
50
+ return t.hasAttribute("href");
51
+ if (t instanceof HTMLInputElement)
52
+ return Ut.has(t.type);
53
+ const e = t.getAttribute("role");
54
+ return e !== null && Gt.has(e);
55
+ }
56
+ function $t(t) {
57
+ if (typeof t.click == "function") {
58
+ t.click();
59
59
  return;
60
60
  }
61
- const e = n.ownerDocument.defaultView;
62
- n.dispatchEvent(
61
+ const e = t.ownerDocument.defaultView;
62
+ t.dispatchEvent(
63
63
  new ((e == null ? void 0 : e.MouseEvent) ?? MouseEvent)("click", {
64
64
  bubbles: !0,
65
65
  cancelable: !0,
@@ -67,95 +67,102 @@ function qt(n) {
67
67
  })
68
68
  );
69
69
  }
70
- function wt(n) {
71
- if (n.defaultPrevented || n.repeat || n.target !== n.currentTarget || n.key !== "Enter" && n.key !== " " && n.key !== "Spacebar")
70
+ function Et(t) {
71
+ if (t.defaultPrevented || t.repeat || t.target !== t.currentTarget || t.key !== "Enter" && t.key !== " " && t.key !== "Spacebar")
72
72
  return;
73
- const e = n.currentTarget;
73
+ const e = t.currentTarget;
74
74
  if (!e || typeof e.dispatchEvent != "function")
75
75
  return;
76
- n.preventDefault();
77
- const t = e.ownerDocument.defaultView;
76
+ t.preventDefault();
77
+ const n = e.ownerDocument.defaultView;
78
78
  e.dispatchEvent(
79
- new ((t == null ? void 0 : t.MouseEvent) ?? MouseEvent)("click", {
79
+ new ((n == null ? void 0 : n.MouseEvent) ?? MouseEvent)("click", {
80
80
  bubbles: !0,
81
81
  cancelable: !0,
82
82
  composed: !0,
83
- ctrlKey: !!n.ctrlKey,
84
- shiftKey: !!n.shiftKey,
85
- altKey: !!n.altKey,
86
- metaKey: !!n.metaKey
83
+ ctrlKey: !!t.ctrlKey,
84
+ shiftKey: !!t.shiftKey,
85
+ altKey: !!t.altKey,
86
+ metaKey: !!t.metaKey
87
87
  })
88
88
  );
89
89
  }
90
- function ve(n) {
91
- const e = n.getAttribute("data-nice-engage");
90
+ function ve(t) {
91
+ const e = t.getAttribute("data-nice-engage");
92
92
  if (e === "value" || e === "text" || e === "popup" || e === "canvas")
93
93
  return e;
94
94
  if (e === "none")
95
95
  return null;
96
- const t = n.getAttribute("role");
97
- return t === "combobox" ? "popup" : t === "slider" || t === "spinbutton" || n instanceof HTMLSelectElement ? "value" : n instanceof HTMLInputElement ? Mt.has(n.type) ? n.readOnly ? null : "text" : Te.has(n.type) && !n.readOnly ? "value" : null : Pe(n) ? n.readOnly ? null : "text" : bt(n) ? "text" : null;
96
+ const n = t.getAttribute("role");
97
+ return n === "combobox" ? "popup" : n === "slider" || n === "spinbutton" || t instanceof HTMLSelectElement ? "value" : t instanceof HTMLInputElement ? gt.has(t.type) ? t.readOnly ? null : "text" : Te.has(t.type) && !t.readOnly ? "value" : null : Pe(t) ? t.readOnly ? null : "text" : yt(t) ? "text" : null;
98
98
  }
99
- function Et(n, e) {
100
- return e === "popup" ? n.getAttribute("aria-expanded") === "true" : n.hasAttribute("data-nice-engaged");
99
+ function kt(t, e) {
100
+ return e === "popup" ? t.getAttribute("aria-expanded") === "true" : t.hasAttribute("data-nice-engaged");
101
101
  }
102
- function ie(n) {
103
- return n instanceof HTMLSelectElement || n instanceof HTMLInputElement && Te.has(n.type);
102
+ function ie(t) {
103
+ return t instanceof HTMLSelectElement || t instanceof HTMLInputElement && Te.has(t.type);
104
104
  }
105
- function me(n) {
106
- n.dispatchEvent(new Event("input", { bubbles: !0 })), n.dispatchEvent(new Event("change", { bubbles: !0 }));
105
+ function me(t) {
106
+ t.dispatchEvent(new Event("input", { bubbles: !0 })), t.dispatchEvent(new Event("change", { bubbles: !0 }));
107
107
  }
108
- function De(n, e) {
108
+ function Ie(t, e) {
109
109
  var r;
110
- const t = Object.getPrototypeOf(n), a = (r = Object.getOwnPropertyDescriptor(t, "value")) == null ? void 0 : r.set;
111
- a ? a.call(n, e) : n.value = e;
110
+ const n = Object.getPrototypeOf(t), a = (r = Object.getOwnPropertyDescriptor(n, "value")) == null ? void 0 : r.set;
111
+ a ? a.call(t, e) : t.value = e;
112
112
  }
113
- const Me = "data-nice-engage-restore", ge = (n) => n instanceof HTMLInputElement && n.type === "number";
114
- function $t(n) {
115
- return ge(n) || n.hasAttribute(Me);
113
+ const Me = "data-nice-engage-restore", ge = (t) => t instanceof HTMLInputElement && t.type === "number";
114
+ function Yt(t) {
115
+ return ge(t) || t.hasAttribute(Me);
116
116
  }
117
- function Ca(n, e, t) {
118
- if (n.value !== e && (De(n, e), n.dispatchEvent(new Event("input", { bubbles: !0 }))), t !== void 0)
117
+ function Na(t, e, n) {
118
+ if (t.value !== e && (Ie(t, e), t.dispatchEvent(new Event("input", { bubbles: !0 }))), n !== void 0)
119
119
  try {
120
- n.setSelectionRange(t, t);
120
+ t.setSelectionRange(n, n);
121
121
  } catch {
122
122
  }
123
123
  }
124
- function Yt(n, e) {
125
- n.value !== e && (De(n, e), me(n));
124
+ function Wt(t, e) {
125
+ t.value !== e && (Ie(t, e), me(t));
126
126
  }
127
- function ce(n, e, t = "step") {
127
+ function ce(t, e, n = "step") {
128
128
  const a = e === "up" || e === "right";
129
- if (n instanceof HTMLSelectElement) {
130
- const s = n.selectedIndex, o = n.options.length - 1;
131
- if (t === "edge")
132
- n.selectedIndex = a ? o : 0;
129
+ if (t instanceof HTMLSelectElement) {
130
+ const s = t.selectedIndex, o = t.options.length - 1;
131
+ if (n === "edge")
132
+ t.selectedIndex = a ? o : 0;
133
133
  else {
134
- const i = t === "big" ? 10 : 1;
135
- n.selectedIndex = Math.max(0, Math.min(o, s + (a ? i : -i)));
134
+ const i = n === "big" ? 10 : 1;
135
+ t.selectedIndex = Math.max(0, Math.min(o, s + (a ? i : -i)));
136
136
  }
137
- return n.selectedIndex !== s ? (me(n), !0) : !1;
137
+ return t.selectedIndex !== s ? (me(t), !0) : !1;
138
138
  }
139
- const r = n.value;
139
+ const r = t.value;
140
140
  try {
141
- if (t === "edge" && (n.min !== "" || n.max !== ""))
142
- De(n, a ? n.max || n.value : n.min || n.value);
141
+ if (n === "edge" && (t.min !== "" || t.max !== ""))
142
+ Ie(t, a ? t.max || t.value : t.min || t.value);
143
143
  else {
144
- const s = t === "big" ? 10 : 1;
145
- a ? n.stepUp(s) : n.stepDown(s);
144
+ const s = n === "big" ? 10 : 1;
145
+ a ? t.stepUp(s) : t.stepDown(s);
146
146
  }
147
147
  } catch {
148
148
  return !1;
149
149
  }
150
- return n.value !== r ? (me(n), !0) : !1;
150
+ return t.value !== r ? (me(t), !0) : !1;
151
151
  }
152
- function Wt(n, e) {
153
- if (!(gt(n) || Pe(n)) || n.selectionStart === null || e !== "left" && e !== "right")
152
+ function Xt(t, e) {
153
+ if (!(bt(t) || Pe(t)) || t.selectionStart === null || e !== "left" && e !== "right")
154
154
  return !1;
155
- const t = n.selectionStart + (e === "right" ? 1 : -1), a = Math.max(0, Math.min(n.value.length, t));
156
- return n.setSelectionRange(a, a), !0;
157
- }
158
- const kt = {
155
+ const n = t.selectionStart + (e === "right" ? 1 : -1), a = Math.max(0, Math.min(t.value.length, n));
156
+ return t.setSelectionRange(a, a), !0;
157
+ }
158
+ const Fe = {
159
+ refresh: "M15.3 10.91L19.05 15.18L22.49 10.66zM8.7 13.09L4.95 8.82L1.51 13.34z",
160
+ // 1.4.22 (NiceDocumentEditor: "uchwyty … nie mają nawet ikon", "wcięcie i odwrotność - są
161
+ // straszne"): a drag grip of six dots, and indent / outdent as text lines with a solid arrow head.
162
+ grip: "M9 4.4a1.6 1.6 0 1 0 0 3.2a1.6 1.6 0 1 0 0-3.2zM15 4.4a1.6 1.6 0 1 0 0 3.2a1.6 1.6 0 1 0 0-3.2zM9 10.4a1.6 1.6 0 1 0 0 3.2a1.6 1.6 0 1 0 0-3.2zM15 10.4a1.6 1.6 0 1 0 0 3.2a1.6 1.6 0 1 0 0-3.2zM9 16.4a1.6 1.6 0 1 0 0 3.2a1.6 1.6 0 1 0 0-3.2zM15 16.4a1.6 1.6 0 1 0 0 3.2a1.6 1.6 0 1 0 0-3.2z",
163
+ indent: "M3 8.5L7.5 12L3 15.5z",
164
+ outdent: "M7.5 8.5L3 12L7.5 15.5z"
165
+ }, zt = {
159
166
  // Navigation
160
167
  "chevron-down": "M6 9l6 6 6-6",
161
168
  "chevron-up": "M18 15l-6-6-6 6",
@@ -175,7 +182,9 @@ const kt = {
175
182
  copy: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z",
176
183
  download: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4",
177
184
  upload: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12",
178
- refresh: "M4 4v5h5M20 20v-5h-5M20.49 9A9 9 0 005.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 013.51 15",
185
+ // 1.4.22 ("refresh wygląda jak stara kiepska wersja tej ikony"): NtdRefresh's shape — two arcs round
186
+ // the centre, each running into a filled head (BUILTIN_FILLS) — instead of the old corner-bracket glyph.
187
+ refresh: "M6.8 7.32A7 7 0 0 1 18.95 11.15M17.2 16.68A7 7 0 0 1 5.05 12.85",
179
188
  // UI
180
189
  search: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z",
181
190
  filter: "M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z",
@@ -213,7 +222,7 @@ const kt = {
213
222
  star: "M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z",
214
223
  heart: "M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z",
215
224
  bell: "M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9",
216
- grip: "M4 6h2m4 0h2m4 0h2M4 12h2m4 0h2m4 0h2M4 18h2m4 0h2m4 0h2",
225
+ grip: "",
217
226
  hash: "M4 9h16M4 15h16M10 3L8 21M16 3l-2 18",
218
227
  list: "M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01",
219
228
  circle: "M12 21a9 9 0 100-18 9 9 0 000 18z",
@@ -333,8 +342,8 @@ const kt = {
333
342
  unlink: "M18.84 12.25l1.72-1.71a5 5 0 0 0-7.07-7.07L11 5.78M3 3l18 18M9 15l3-3M14 11l3 3M14 21l-1.72-1.72a5 5 0 0 1-7.07-7.07L7 10.49",
334
343
  code: "M16 18l6-6-6-6M8 6l-6 6 6 6",
335
344
  quote: "M3 21c3-3 3-9 0-12M21 21c-3-3-3-9 0-12M9 7h6v6H9zM15 7h6v6h-6z",
336
- indent: "M3 8l4 4-4 4M7 6h14M7 12h14M3 18h18",
337
- outdent: "M7 8l-4 4 4 4M21 6H3M21 12H7M21 18H3",
345
+ indent: "M3 5h18M11 10h10M11 14h10M3 19h18",
346
+ outdent: "M3 5h18M11 10h10M11 14h10M3 19h18",
338
347
  "align-center": "M3 6h18M6 12h12M3 18h18",
339
348
  "align-right": "M3 6h18M9 12h12M3 18h18",
340
349
  "align-justify": "M3 6h18M3 12h18M3 18h18",
@@ -421,82 +430,85 @@ const kt = {
421
430
  "key-backspace": "M21 5H9l-6 7 6 7h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1z M17 9l-6 6 M11 9l6 6",
422
431
  "key-space": "M4 10v4h16v-4",
423
432
  "key-caps": "M12 4l-7 7h4v5h6v-5h4z M8 20h8"
424
- }, Xt = {
433
+ }, Jt = {
425
434
  xs: 12,
426
435
  sm: 16,
427
436
  md: 20,
428
437
  lg: 24,
429
438
  xl: 32
430
- }, Ie = /* @__PURE__ */ Ne({}), Ha = ({ resolver: n, children: e }) => He.createElement(Ie.Provider, { value: { resolver: n } }, e);
431
- function Jt({
432
- path: n,
433
- size: e,
434
- className: t,
435
- style: a,
436
- color: r,
437
- title: s,
438
- onClick: o
439
+ }, De = /* @__PURE__ */ He({}), Ha = ({ resolver: t, children: e }) => Ne.createElement(De.Provider, { value: { resolver: t } }, e);
440
+ function Zt({
441
+ path: t,
442
+ fill: e,
443
+ size: n,
444
+ className: a,
445
+ style: r,
446
+ color: s,
447
+ title: o,
448
+ onClick: i
439
449
  }) {
440
450
  return /* @__PURE__ */ V(
441
451
  "svg",
442
452
  {
443
453
  xmlns: "http://www.w3.org/2000/svg",
444
- width: e,
445
- height: e,
454
+ width: n,
455
+ height: n,
446
456
  viewBox: "0 0 24 24",
447
457
  fill: "none",
448
- stroke: r || "currentColor",
458
+ stroke: s || "currentColor",
449
459
  strokeWidth: 2,
450
460
  strokeLinecap: "round",
451
461
  strokeLinejoin: "round",
452
- className: `nice-icon ${t || ""}`,
453
- style: a,
454
- role: o ? "button" : s ? "img" : "presentation",
455
- tabIndex: o ? 0 : void 0,
456
- onKeyDown: o ? wt : void 0,
457
- "aria-label": s,
458
- "aria-hidden": o ? void 0 : !s,
459
- onClick: o,
462
+ className: `nice-icon ${a || ""}`,
463
+ style: r,
464
+ role: i ? "button" : o ? "img" : "presentation",
465
+ tabIndex: i ? 0 : void 0,
466
+ onKeyDown: i ? Et : void 0,
467
+ "aria-label": o,
468
+ "aria-hidden": i ? void 0 : !o,
469
+ onClick: i,
460
470
  children: [
461
- s && /* @__PURE__ */ N("title", { children: s }),
462
- /* @__PURE__ */ N("path", { d: n })
471
+ o && /* @__PURE__ */ C("title", { children: o }),
472
+ t && /* @__PURE__ */ C("path", { d: t }),
473
+ e && /* @__PURE__ */ C("path", { d: e, fill: s || "currentColor", stroke: "none" })
463
474
  ]
464
475
  }
465
476
  );
466
477
  }
467
478
  const ee = ({
468
- name: n,
479
+ name: t,
469
480
  size: e = "md",
470
- className: t,
481
+ className: n,
471
482
  style: a,
472
483
  color: r,
473
484
  title: s,
474
485
  onClick: o
475
486
  }) => {
476
- const { resolver: i } = ae(Ie), c = typeof e == "number" ? e : Xt[e];
487
+ const { resolver: i } = ae(De), c = typeof e == "number" ? e : Jt[e];
477
488
  if (i) {
478
- const u = i(n, c);
489
+ const u = i(t, c);
479
490
  if (u)
480
- return /* @__PURE__ */ N(
491
+ return /* @__PURE__ */ C(
481
492
  "span",
482
493
  {
483
494
  role: o ? "button" : void 0,
484
495
  tabIndex: o ? 0 : void 0,
485
- onKeyDown: o ? wt : void 0,
486
- className: `nice-icon-wrap ${t || ""}`,
496
+ onKeyDown: o ? Et : void 0,
497
+ className: `nice-icon-wrap ${n || ""}`,
487
498
  style: a,
488
499
  onClick: o,
489
500
  children: u
490
501
  }
491
502
  );
492
503
  }
493
- const d = kt[n];
494
- return d ? /* @__PURE__ */ N(
495
- Jt,
504
+ const d = zt[t];
505
+ return d || Fe[t] ? /* @__PURE__ */ C(
506
+ Zt,
496
507
  {
497
508
  path: d,
509
+ fill: Fe[t],
498
510
  size: c,
499
- className: t,
511
+ className: n,
500
512
  style: a,
501
513
  color: r,
502
514
  title: s,
@@ -504,14 +516,14 @@ const ee = ({
504
516
  }
505
517
  ) : null;
506
518
  };
507
- function Na() {
508
- const { resolver: n } = ae(Ie);
509
- return { renderIcon: I(
510
- (t, a = "md") => t == null ? null : typeof t != "string" ? t : He.createElement(ee, { name: t, size: a }),
511
- [n]
519
+ function Ta() {
520
+ const { resolver: t } = ae(De);
521
+ return { renderIcon: D(
522
+ (n, a = "md") => n == null ? null : typeof n != "string" ? n : Ne.createElement(ee, { name: n, size: a }),
523
+ [t]
512
524
  ) };
513
525
  }
514
- const Ta = /* @__PURE__ */ Object.keys(kt), xt = [
526
+ const Pa = /* @__PURE__ */ Object.keys(zt), xt = [
515
527
  "a[href]",
516
528
  "area[href]",
517
529
  "button",
@@ -526,8 +538,8 @@ const Ta = /* @__PURE__ */ Object.keys(kt), xt = [
526
538
  "[tabindex]",
527
539
  "[data-nice-focusable]"
528
540
  ].join(",");
529
- function X(n) {
530
- const e = n.getBoundingClientRect();
541
+ function X(t) {
542
+ const e = t.getBoundingClientRect();
531
543
  return {
532
544
  left: e.left,
533
545
  top: e.top,
@@ -537,61 +549,61 @@ function X(n) {
537
549
  height: e.height
538
550
  };
539
551
  }
540
- const Fe = (n) => n instanceof HTMLButtonElement || n instanceof HTMLInputElement || n instanceof HTMLSelectElement || n instanceof HTMLTextAreaElement;
541
- function Zt(n) {
542
- if (Fe(n) && n.disabled || n.getAttribute("aria-disabled") === "true" && !n.hasAttribute("data-nice-focusable"))
552
+ const _e = (t) => t instanceof HTMLButtonElement || t instanceof HTMLInputElement || t instanceof HTMLSelectElement || t instanceof HTMLTextAreaElement;
553
+ function Qt(t) {
554
+ if (_e(t) && t.disabled || t.getAttribute("aria-disabled") === "true" && !t.hasAttribute("data-nice-focusable"))
543
555
  return !0;
544
- const e = n.closest("fieldset[disabled]");
545
- if (e && Fe(n)) {
546
- const t = e.querySelector(":scope > legend");
547
- return !(t && t.contains(n));
556
+ const e = t.closest("fieldset[disabled]");
557
+ if (e && _e(t)) {
558
+ const n = e.querySelector(":scope > legend");
559
+ return !(n && n.contains(t));
548
560
  }
549
561
  return !1;
550
562
  }
551
- function Qt(n) {
563
+ function en(t) {
552
564
  var a;
553
- if (n.closest("[hidden]"))
565
+ if (t.closest("[hidden]"))
554
566
  return !1;
555
- const e = n.getBoundingClientRect();
567
+ const e = t.getBoundingClientRect();
556
568
  if (e.width === 0 && e.height === 0) {
557
- const r = n.ownerDocument.documentElement.getBoundingClientRect();
569
+ const r = t.ownerDocument.documentElement.getBoundingClientRect();
558
570
  if (r.width !== 0 || r.height !== 0)
559
571
  return !1;
560
572
  }
561
- const t = (a = n.ownerDocument.defaultView) == null ? void 0 : a.getComputedStyle(n);
562
- return !t || t.display !== "none" && t.visibility !== "hidden" && t.visibility !== "collapse";
573
+ const n = (a = t.ownerDocument.defaultView) == null ? void 0 : a.getComputedStyle(t);
574
+ return !n || n.display !== "none" && n.visibility !== "hidden" && n.visibility !== "collapse";
563
575
  }
564
- function en(n) {
565
- if (!(n instanceof HTMLInputElement) || n.type !== "radio" || !n.name || n.checked)
576
+ function tn(t) {
577
+ if (!(t instanceof HTMLInputElement) || t.type !== "radio" || !t.name || t.checked)
566
578
  return !0;
567
- const t = [...(n.form ?? n.ownerDocument).querySelectorAll('input[type="radio"]')].filter(
568
- (a) => a.name === n.name
579
+ const n = [...(t.form ?? t.ownerDocument).querySelectorAll('input[type="radio"]')].filter(
580
+ (a) => a.name === t.name
569
581
  );
570
- return !t.some((a) => a.checked) && t[0] === n;
582
+ return !n.some((a) => a.checked) && n[0] === t;
571
583
  }
572
- function te(n) {
573
- if (!(n instanceof HTMLElement) || !n.matches(xt))
584
+ function te(t) {
585
+ if (!(t instanceof HTMLElement) || !t.matches(xt))
574
586
  return !1;
575
- if (!n.hasAttribute("data-nice-focusable")) {
576
- const e = n.getAttribute("tabindex");
577
- if (e !== null && Number(e) < 0 || n instanceof HTMLAnchorElement && !n.hasAttribute("href") && e === null)
587
+ if (!t.hasAttribute("data-nice-focusable")) {
588
+ const e = t.getAttribute("tabindex");
589
+ if (e !== null && Number(e) < 0 || t instanceof HTMLAnchorElement && !t.hasAttribute("href") && e === null)
578
590
  return !1;
579
591
  }
580
- return n.closest('[inert],[aria-hidden="true"]') || Zt(n) ? !1 : Qt(n) && en(n);
592
+ return t.closest('[inert],[aria-hidden="true"]') || Qt(t) ? !1 : en(t) && tn(t);
581
593
  }
582
- function U(n, e = []) {
583
- const t = [];
584
- for (const a of n.querySelectorAll(xt))
585
- e.some((r) => r && r.contains(a)) || te(a) && t.push(a);
586
- return t;
594
+ function U(t, e = []) {
595
+ const n = [];
596
+ for (const a of t.querySelectorAll(xt))
597
+ e.some((r) => r && r.contains(a)) || te(a) && n.push(a);
598
+ return n;
587
599
  }
588
- const _e = typeof window > "u" ? R : _t;
589
- function B(n, e, t) {
600
+ const Be = typeof window > "u" ? R : Bt;
601
+ function B(t, e, n) {
590
602
  const a = O({ el: null, deps: [] }), r = O(e);
591
- r.current = e, _e(() => {
592
- const s = (n == null ? void 0 : n.current) ?? null, o = a.current;
593
- s === o.el && t.length === o.deps.length && t.every((c, d) => Object.is(c, o.deps[d])) || (typeof o.cleanup == "function" && o.cleanup(), o.el = s, o.deps = [...t], o.cleanup = s ? r.current(s) : void 0);
594
- }), _e(
603
+ r.current = e, Be(() => {
604
+ const s = (t == null ? void 0 : t.current) ?? null, o = a.current;
605
+ s === o.el && n.length === o.deps.length && n.every((c, d) => Object.is(c, o.deps[d])) || (typeof o.cleanup == "function" && o.cleanup(), o.el = s, o.deps = [...n], o.cleanup = s ? r.current(s) : void 0);
606
+ }), Be(
595
607
  () => () => {
596
608
  const s = a.current;
597
609
  typeof s.cleanup == "function" && s.cleanup(), a.current = { el: null, deps: [] };
@@ -600,53 +612,53 @@ function B(n, e, t) {
600
612
  );
601
613
  }
602
614
  const Q = /* @__PURE__ */ new Map(), le = /* @__PURE__ */ new WeakMap(), be = /* @__PURE__ */ new Set();
603
- function Be() {
604
- be.forEach((n) => n());
605
- }
606
- function zt(n, e, t = !1) {
607
- const a = { hints: e, fallback: t };
608
- let r = Q.get(n);
609
- return r || (r = /* @__PURE__ */ new Set(), Q.set(n, r)), r.add(a), Be(), () => {
610
- const s = Q.get(n);
611
- s != null && s.delete(a) && (s.size === 0 && Q.delete(n), Be());
615
+ function Ke() {
616
+ be.forEach((t) => t());
617
+ }
618
+ function At(t, e, n = !1) {
619
+ const a = { hints: e, fallback: n };
620
+ let r = Q.get(t);
621
+ return r || (r = /* @__PURE__ */ new Set(), Q.set(t, r)), r.add(a), Ke(), () => {
622
+ const s = Q.get(t);
623
+ s != null && s.delete(a) && (s.size === 0 && Q.delete(t), Ke());
612
624
  };
613
625
  }
614
- function Pa(n, e) {
615
- const t = le.get(n);
616
- le.delete(n), e && e.length > 0 && le.set(n, zt(n, e)), t == null || t();
626
+ function Ia(t, e) {
627
+ const n = le.get(t);
628
+ le.delete(t), e && e.length > 0 && le.set(t, At(t, e)), n == null || n();
617
629
  }
618
- function tn(n, e) {
619
- const t = [], a = /* @__PURE__ */ new Set(), r = (s) => {
630
+ function nn(t, e) {
631
+ const n = [], a = /* @__PURE__ */ new Set(), r = (s) => {
620
632
  const o = [...Q.get(s) ?? []], i = [...o.filter((c) => !c.fallback), ...o.filter((c) => c.fallback)];
621
633
  for (const c of i.flatMap((d) => d.hints)) {
622
634
  const d = `${c.intent}:${c.direction ?? ""}`;
623
- a.has(d) || (a.add(d), t.push(c));
635
+ a.has(d) || (a.add(d), n.push(c));
624
636
  }
625
637
  };
626
- for (let s = n; s; s = s.parentElement)
638
+ for (let s = t; s; s = s.parentElement)
627
639
  r(s);
628
- return r(e), t;
640
+ return r(e), n;
629
641
  }
630
- function At(n, e, t = {}) {
631
- const { enabled: a = !0, fallback: r = !1 } = t, s = JSON.stringify(e), o = (i) => {
642
+ function Lt(t, e, n = {}) {
643
+ const { enabled: a = !0, fallback: r = !1 } = n, s = JSON.stringify(e), o = (i) => {
632
644
  const c = JSON.parse(s);
633
- return c.length > 0 ? zt(i, c, r) : void 0;
645
+ return c.length > 0 ? At(i, c, r) : void 0;
634
646
  };
635
- B(n, (i) => a ? o(i) : void 0, [s, a, r]), R(() => {
636
- if (!(n || !a))
647
+ B(t, (i) => a ? o(i) : void 0, [s, a, r]), R(() => {
648
+ if (!(t || !a))
637
649
  return o(document);
638
- }, [n, s, a, r]);
650
+ }, [t, s, a, r]);
639
651
  }
640
- function nn() {
641
- const [n, e] = j(null), [, t] = j(0);
652
+ function an() {
653
+ const [t, e] = j(null), [, n] = j(0);
642
654
  return R(() => {
643
- const a = document, r = () => e(a.activeElement), s = () => t((o) => o + 1);
655
+ const a = document, r = () => e(a.activeElement), s = () => n((o) => o + 1);
644
656
  return r(), a.addEventListener("focusin", r), a.addEventListener("focusout", r), be.add(s), () => {
645
657
  a.removeEventListener("focusin", r), a.removeEventListener("focusout", r), be.delete(s);
646
658
  };
647
- }, []), n;
659
+ }, []), t;
648
660
  }
649
- class an {
661
+ class rn {
650
662
  constructor(e = "ntd-user-preferences") {
651
663
  this.key = e;
652
664
  }
@@ -666,13 +678,13 @@ class an {
666
678
  }
667
679
  }
668
680
  class Da {
669
- constructor(e = "ntd-preferences", t = "preferences") {
670
- this.db = null, this.dbName = e, this.storeName = t;
681
+ constructor(e = "ntd-preferences", n = "preferences") {
682
+ this.db = null, this.dbName = e, this.storeName = n;
671
683
  }
672
684
  async getDB() {
673
- return this.db ? this.db : new Promise((e, t) => {
685
+ return this.db ? this.db : new Promise((e, n) => {
674
686
  const a = indexedDB.open(this.dbName, 1);
675
- a.onerror = () => t(a.error), a.onsuccess = () => {
687
+ a.onerror = () => n(a.error), a.onsuccess = () => {
676
688
  this.db = a.result, e(this.db);
677
689
  }, a.onupgradeneeded = (r) => {
678
690
  const s = r.target.result;
@@ -682,32 +694,32 @@ class Da {
682
694
  }
683
695
  async load() {
684
696
  const e = await this.getDB();
685
- return new Promise((t, a) => {
697
+ return new Promise((n, a) => {
686
698
  const o = e.transaction(this.storeName, "readonly").objectStore(this.storeName).get("user-preferences");
687
699
  o.onerror = () => a(o.error), o.onsuccess = () => {
688
700
  var i;
689
- return t(((i = o.result) == null ? void 0 : i.data) || null);
701
+ return n(((i = o.result) == null ? void 0 : i.data) || null);
690
702
  };
691
703
  });
692
704
  }
693
705
  async save(e) {
694
- const t = await this.getDB();
706
+ const n = await this.getDB();
695
707
  return new Promise((a, r) => {
696
- const i = t.transaction(this.storeName, "readwrite").objectStore(this.storeName).put({ id: "user-preferences", data: e });
708
+ const i = n.transaction(this.storeName, "readwrite").objectStore(this.storeName).put({ id: "user-preferences", data: e });
697
709
  i.onerror = () => r(i.error), i.onsuccess = () => a();
698
710
  });
699
711
  }
700
712
  async clear() {
701
713
  const e = await this.getDB();
702
- return new Promise((t, a) => {
714
+ return new Promise((n, a) => {
703
715
  const o = e.transaction(this.storeName, "readwrite").objectStore(this.storeName).delete("user-preferences");
704
- o.onerror = () => a(o.error), o.onsuccess = () => t();
716
+ o.onerror = () => a(o.error), o.onsuccess = () => n();
705
717
  });
706
718
  }
707
719
  }
708
- class Ia {
709
- constructor(e, t) {
710
- this.baseUrl = e, this.getAuthHeaders = t;
720
+ class Oa {
721
+ constructor(e, n) {
722
+ this.baseUrl = e, this.getAuthHeaders = n;
711
723
  }
712
724
  getHeaders() {
713
725
  var e;
@@ -729,13 +741,13 @@ class Ia {
729
741
  return e.json();
730
742
  }
731
743
  async push(e) {
732
- const t = await fetch(`${this.baseUrl}/preferences`, {
744
+ const n = await fetch(`${this.baseUrl}/preferences`, {
733
745
  method: "PUT",
734
746
  headers: this.getHeaders(),
735
747
  body: JSON.stringify(e)
736
748
  });
737
- if (!t.ok)
738
- throw new Error(`Failed to save preferences: ${t.statusText}`);
749
+ if (!n.ok)
750
+ throw new Error(`Failed to save preferences: ${n.statusText}`);
739
751
  }
740
752
  async getServerTimestamp() {
741
753
  const e = await fetch(`${this.baseUrl}/preferences/timestamp`, {
@@ -745,52 +757,52 @@ class Ia {
745
757
  return e.ok && (await e.json()).timestamp || 0;
746
758
  }
747
759
  }
748
- const Oe = /* @__PURE__ */ Ne(
760
+ const Oe = /* @__PURE__ */ He(
749
761
  null
750
762
  );
751
763
  function St() {
752
- const n = ae(Oe);
753
- if (!n)
764
+ const t = ae(Oe);
765
+ if (!t)
754
766
  throw new Error("useUserPreferences must be used within NiceUserPreferencesProvider");
755
- return n;
767
+ return t;
756
768
  }
757
- function rn() {
769
+ function sn() {
758
770
  return ae(Oe);
759
771
  }
760
- function Lt(n, e) {
761
- const { getControlPreferences: t, setControlPreferences: a, updateControlPreferences: r } = St(), s = t(n, e), o = I(
762
- (c) => a(n, e, c),
763
- [n, e, a]
764
- ), i = I(
765
- (c) => r(n, e, c),
766
- [n, e, r]
772
+ function Ct(t, e) {
773
+ const { getControlPreferences: n, setControlPreferences: a, updateControlPreferences: r } = St(), s = n(t, e), o = D(
774
+ (c) => a(t, e, c),
775
+ [t, e, a]
776
+ ), i = D(
777
+ (c) => r(t, e, c),
778
+ [t, e, r]
767
779
  );
768
780
  return [s, o, i];
769
781
  }
770
- function Oa(n) {
771
- return Lt(n, "grid");
782
+ function Ra(t) {
783
+ return Ct(t, "grid");
772
784
  }
773
- function Ra(n) {
774
- return Lt(n, "chart");
785
+ function Va(t) {
786
+ return Ct(t, "chart");
775
787
  }
776
- const Ke = {
788
+ const je = {
777
789
  version: 1,
778
790
  global: {},
779
791
  controls: {}
780
792
  };
781
- function Va({
782
- storage: n = new an(),
793
+ function Fa({
794
+ storage: t = new rn(),
783
795
  syncAdapter: e,
784
- autoSyncInterval: t = 0,
796
+ autoSyncInterval: n = 0,
785
797
  saveDebounce: a = 500,
786
798
  children: r
787
799
  }) {
788
- const [s, o] = j(Ke), [i, c] = j(!0), [d, u] = j(!1), [h, l] = j(null), p = O(void 0), w = O(void 0);
800
+ const [s, o] = j(je), [i, c] = j(!0), [d, u] = j(!1), [h, l] = j(null), p = O(void 0), w = O(void 0);
789
801
  R(() => {
790
802
  let f = !0;
791
803
  return (async () => {
792
804
  try {
793
- const b = await n.load();
805
+ const b = await t.load();
794
806
  f && b && o(b);
795
807
  } catch (b) {
796
808
  f && l(b instanceof Error ? b : new Error("Failed to load preferences"));
@@ -800,67 +812,67 @@ function Va({
800
812
  })(), () => {
801
813
  f = !1;
802
814
  };
803
- }, [n]);
804
- const k = I(
815
+ }, [t]);
816
+ const k = D(
805
817
  (f) => {
806
818
  p.current && clearTimeout(p.current), p.current = setTimeout(async () => {
807
819
  try {
808
- await n.save(f);
809
- } catch (z) {
810
- l(z instanceof Error ? z : new Error("Failed to save preferences"));
820
+ await t.save(f);
821
+ } catch (x) {
822
+ l(x instanceof Error ? x : new Error("Failed to save preferences"));
811
823
  }
812
824
  }, a);
813
825
  },
814
- [n, a]
826
+ [t, a]
815
827
  );
816
828
  R(() => {
817
829
  i || k(s);
818
830
  }, [s, i, k]);
819
- const x = O(async () => {
831
+ const z = O(async () => {
820
832
  });
821
833
  R(() => {
822
- if (e && t > 0)
834
+ if (e && n > 0)
823
835
  return w.current = setInterval(() => {
824
- x.current();
825
- }, t), () => {
836
+ z.current();
837
+ }, n), () => {
826
838
  w.current && clearInterval(w.current);
827
839
  };
828
- }, [e, t]), R(() => () => {
840
+ }, [e, n]), R(() => () => {
829
841
  p.current && clearTimeout(p.current), w.current && clearInterval(w.current);
830
842
  }, []);
831
- const C = I(
832
- (f, z) => {
843
+ const N = D(
844
+ (f, x) => {
833
845
  var b;
834
- return (b = s.controls[f]) == null ? void 0 : b[z];
846
+ return (b = s.controls[f]) == null ? void 0 : b[x];
835
847
  },
836
848
  [s]
837
- ), S = I(
838
- (f, z, b) => {
849
+ ), L = D(
850
+ (f, x, b) => {
839
851
  o((P) => ({
840
852
  ...P,
841
853
  controls: {
842
854
  ...P.controls,
843
855
  [f]: {
844
856
  ...P.controls[f],
845
- [z]: b,
857
+ [x]: b,
846
858
  lastModified: Date.now()
847
859
  }
848
860
  }
849
861
  }));
850
862
  },
851
863
  []
852
- ), m = I(
853
- (f, z, b) => {
864
+ ), m = D(
865
+ (f, x, b) => {
854
866
  o((P) => {
855
867
  var _;
856
- const H = (_ = P.controls[f]) == null ? void 0 : _[z], D = typeof H == "object" && H !== null ? { ...H, ...b } : b;
868
+ const H = (_ = P.controls[f]) == null ? void 0 : _[x], I = typeof H == "object" && H !== null ? { ...H, ...b } : b;
857
869
  return {
858
870
  ...P,
859
871
  controls: {
860
872
  ...P.controls,
861
873
  [f]: {
862
874
  ...P.controls[f],
863
- [z]: D,
875
+ [x]: I,
864
876
  lastModified: Date.now()
865
877
  }
866
878
  }
@@ -868,11 +880,11 @@ function Va({
868
880
  });
869
881
  },
870
882
  []
871
- ), A = I(
872
- (f, z) => {
883
+ ), A = D(
884
+ (f, x) => {
873
885
  o((b) => {
874
- if (z) {
875
- const { [z]: D, ..._ } = b.controls[f] || {};
886
+ if (x) {
887
+ const { [x]: I, ..._ } = b.controls[f] || {};
876
888
  return {
877
889
  ...b,
878
890
  controls: {
@@ -889,31 +901,31 @@ function Va({
889
901
  });
890
902
  },
891
903
  []
892
- ), y = I(
904
+ ), y = D(
893
905
  (f) => s.global[f],
894
906
  [s]
895
- ), L = I(
896
- (f, z) => {
907
+ ), S = D(
908
+ (f, x) => {
897
909
  o((b) => ({
898
910
  ...b,
899
911
  global: {
900
912
  ...b.global,
901
- [f]: z
913
+ [f]: x
902
914
  }
903
915
  }));
904
916
  },
905
917
  []
906
- ), T = I(async () => {
918
+ ), T = D(async () => {
907
919
  if (e) {
908
920
  u(!0), l(null);
909
921
  try {
910
- const f = await e.getServerTimestamp(), z = s.lastSync || 0;
911
- if (f > z) {
922
+ const f = await e.getServerTimestamp(), x = s.lastSync || 0;
923
+ if (f > x) {
912
924
  const b = await e.fetch();
913
925
  b && (o({
914
926
  ...b,
915
927
  lastSync: Date.now()
916
- }), await n.save(b));
928
+ }), await t.save(b));
917
929
  } else {
918
930
  const b = { ...s, lastSync: Date.now() };
919
931
  await e.push(b), o(b);
@@ -924,31 +936,31 @@ function Va({
924
936
  u(!1);
925
937
  }
926
938
  }
927
- }, [e, s, n]);
928
- x.current = T;
929
- const E = I(() => JSON.stringify(s, null, 2), [s]), g = I((f) => {
939
+ }, [e, s, t]);
940
+ z.current = T;
941
+ const E = D(() => JSON.stringify(s, null, 2), [s]), g = D((f) => {
930
942
  try {
931
- const z = JSON.parse(f);
932
- if (typeof z.version != "number" || !z.controls)
943
+ const x = JSON.parse(f);
944
+ if (typeof x.version != "number" || !x.controls)
933
945
  throw new Error("Invalid preferences format");
934
- o(z);
935
- } catch (z) {
936
- l(z instanceof Error ? z : new Error("Import failed"));
946
+ o(x);
947
+ } catch (x) {
948
+ l(x instanceof Error ? x : new Error("Import failed"));
937
949
  }
938
- }, []), v = I(() => {
939
- o(Ke), n.clear();
940
- }, [n]), M = pe(
950
+ }, []), v = D(() => {
951
+ o(je), t.clear();
952
+ }, [t]), M = pe(
941
953
  () => ({
942
954
  preferences: s,
943
955
  isLoading: i,
944
956
  isSyncing: d,
945
957
  error: h,
946
- getControlPreferences: C,
947
- setControlPreferences: S,
958
+ getControlPreferences: N,
959
+ setControlPreferences: L,
948
960
  updateControlPreferences: m,
949
961
  clearControlPreferences: A,
950
962
  getGlobalPreferences: y,
951
- setGlobalPreferences: L,
963
+ setGlobalPreferences: S,
952
964
  sync: T,
953
965
  exportPreferences: E,
954
966
  importPreferences: g,
@@ -959,29 +971,29 @@ function Va({
959
971
  i,
960
972
  d,
961
973
  h,
962
- C,
963
- S,
974
+ N,
975
+ L,
964
976
  m,
965
977
  A,
966
978
  y,
967
- L,
979
+ S,
968
980
  T,
969
981
  E,
970
982
  g,
971
983
  v
972
984
  ]
973
985
  );
974
- return /* @__PURE__ */ N(Oe.Provider, { value: M, children: r });
986
+ return /* @__PURE__ */ C(Oe.Provider, { value: M, children: r });
975
987
  }
976
- function Fa({
977
- showGlobal: n = !0,
988
+ function _a({
989
+ showGlobal: t = !0,
978
990
  showControls: e = !0,
979
- showExportImport: t = !0,
991
+ showExportImport: n = !0,
980
992
  showSync: a = !0,
981
993
  className: r,
982
994
  style: s
983
995
  }) {
984
- var y, L, T, E;
996
+ var y, S, T, E;
985
997
  const { t: o } = J(), {
986
998
  preferences: i,
987
999
  isLoading: c,
@@ -992,8 +1004,8 @@ function Fa({
992
1004
  importPreferences: p,
993
1005
  resetAllPreferences: w,
994
1006
  setGlobalPreferences: k,
995
- clearControlPreferences: x
996
- } = St(), C = O(null), S = () => {
1007
+ clearControlPreferences: z
1008
+ } = St(), N = O(null), L = () => {
997
1009
  const g = l(), v = new Blob([g], { type: "application/json" }), M = URL.createObjectURL(v), f = document.createElement("a");
998
1010
  f.href = M, f.download = "nice2dev-preferences.json", f.click(), URL.revokeObjectURL(M);
999
1011
  }, m = (g) => {
@@ -1007,7 +1019,7 @@ function Fa({
1007
1019
  }, M.readAsText(v);
1008
1020
  };
1009
1021
  if (c)
1010
- return /* @__PURE__ */ N("div", { className: r, style: s, children: o("userPreferences.loadingPreferences", "Loading preferences...") });
1022
+ return /* @__PURE__ */ C("div", { className: r, style: s, children: o("userPreferences.loadingPreferences", "Loading preferences...") });
1011
1023
  const A = Object.keys(i.controls);
1012
1024
  return /* @__PURE__ */ V(
1013
1025
  "div",
@@ -1020,7 +1032,7 @@ function Fa({
1020
1032
  ...s
1021
1033
  },
1022
1034
  children: [
1023
- u && /* @__PURE__ */ N(
1035
+ u && /* @__PURE__ */ C(
1024
1036
  "div",
1025
1037
  {
1026
1038
  style: {
@@ -1035,7 +1047,7 @@ function Fa({
1035
1047
  }
1036
1048
  ),
1037
1049
  /* @__PURE__ */ V("div", { style: { display: "flex", gap: "8px", marginBottom: "20px", flexWrap: "wrap" }, children: [
1038
- a && /* @__PURE__ */ N(
1050
+ a && /* @__PURE__ */ C(
1039
1051
  "button",
1040
1052
  {
1041
1053
  onClick: h,
@@ -1050,11 +1062,11 @@ function Fa({
1050
1062
  children: d ? o("userPreferences.syncing", "Syncing...") : o("userPreferences.sync", "Sync")
1051
1063
  }
1052
1064
  ),
1053
- t && /* @__PURE__ */ V(Ft, { children: [
1054
- /* @__PURE__ */ N(
1065
+ n && /* @__PURE__ */ V(_t, { children: [
1066
+ /* @__PURE__ */ C(
1055
1067
  "button",
1056
1068
  {
1057
- onClick: S,
1069
+ onClick: L,
1058
1070
  style: {
1059
1071
  padding: "8px 16px",
1060
1072
  border: "1px solid var(--nice-border-color, #e5e7eb)",
@@ -1065,12 +1077,12 @@ function Fa({
1065
1077
  children: o("userPreferences.export", "Export")
1066
1078
  }
1067
1079
  ),
1068
- /* @__PURE__ */ N(
1080
+ /* @__PURE__ */ C(
1069
1081
  "button",
1070
1082
  {
1071
1083
  onClick: () => {
1072
1084
  var g;
1073
- return (g = C.current) == null ? void 0 : g.click();
1085
+ return (g = N.current) == null ? void 0 : g.click();
1074
1086
  },
1075
1087
  style: {
1076
1088
  padding: "8px 16px",
@@ -1082,10 +1094,10 @@ function Fa({
1082
1094
  children: o("userPreferences.import", "Import")
1083
1095
  }
1084
1096
  ),
1085
- /* @__PURE__ */ N(
1097
+ /* @__PURE__ */ C(
1086
1098
  "input",
1087
1099
  {
1088
- ref: C,
1100
+ ref: N,
1089
1101
  type: "file",
1090
1102
  accept: ".json",
1091
1103
  onChange: m,
@@ -1093,7 +1105,7 @@ function Fa({
1093
1105
  }
1094
1106
  )
1095
1107
  ] }),
1096
- /* @__PURE__ */ N(
1108
+ /* @__PURE__ */ C(
1097
1109
  "button",
1098
1110
  {
1099
1111
  onClick: w,
@@ -1110,11 +1122,11 @@ function Fa({
1110
1122
  }
1111
1123
  )
1112
1124
  ] }),
1113
- n && /* @__PURE__ */ V("div", { style: { marginBottom: "24px" }, children: [
1114
- /* @__PURE__ */ N("h3", { style: { margin: "0 0 12px", fontSize: "16px", fontWeight: 600 }, children: o("userPreferences.globalPreferences", "Global Preferences") }),
1125
+ t && /* @__PURE__ */ V("div", { style: { marginBottom: "24px" }, children: [
1126
+ /* @__PURE__ */ C("h3", { style: { margin: "0 0 12px", fontSize: "16px", fontWeight: 600 }, children: o("userPreferences.globalPreferences", "Global Preferences") }),
1115
1127
  /* @__PURE__ */ V("div", { style: { display: "grid", gap: "12px" }, children: [
1116
1128
  /* @__PURE__ */ V("label", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
1117
- /* @__PURE__ */ N(
1129
+ /* @__PURE__ */ C(
1118
1130
  "input",
1119
1131
  {
1120
1132
  type: "checkbox",
@@ -1128,11 +1140,11 @@ function Fa({
1128
1140
  o("userPreferences.reducedMotion", "Reduced motion")
1129
1141
  ] }),
1130
1142
  /* @__PURE__ */ V("label", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
1131
- /* @__PURE__ */ N(
1143
+ /* @__PURE__ */ C(
1132
1144
  "input",
1133
1145
  {
1134
1146
  type: "checkbox",
1135
- checked: ((L = i.global.display) == null ? void 0 : L.highContrast) || !1,
1147
+ checked: ((S = i.global.display) == null ? void 0 : S.highContrast) || !1,
1136
1148
  onChange: (g) => k("display", {
1137
1149
  ...i.global.display,
1138
1150
  highContrast: g.target.checked
@@ -1143,7 +1155,7 @@ function Fa({
1143
1155
  ] }),
1144
1156
  /* @__PURE__ */ V("label", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
1145
1157
  o("userPreferences.fontScale", "Font scale:"),
1146
- /* @__PURE__ */ N(
1158
+ /* @__PURE__ */ C(
1147
1159
  "input",
1148
1160
  {
1149
1161
  type: "range",
@@ -1166,11 +1178,11 @@ function Fa({
1166
1178
  ] })
1167
1179
  ] }),
1168
1180
  e && A.length > 0 && /* @__PURE__ */ V("div", { children: [
1169
- /* @__PURE__ */ N("h3", { style: { margin: "0 0 12px", fontSize: "16px", fontWeight: 600 }, children: o("userPreferences.controlPreferences", "Control Preferences ({controlIds})").replace(
1181
+ /* @__PURE__ */ C("h3", { style: { margin: "0 0 12px", fontSize: "16px", fontWeight: 600 }, children: o("userPreferences.controlPreferences", "Control Preferences ({controlIds})").replace(
1170
1182
  "{controlIds}",
1171
1183
  String(A.length)
1172
1184
  ) }),
1173
- /* @__PURE__ */ N("div", { style: { display: "grid", gap: "8px" }, children: A.map((g) => {
1185
+ /* @__PURE__ */ C("div", { style: { display: "grid", gap: "8px" }, children: A.map((g) => {
1174
1186
  const v = i.controls[g], M = Object.keys(v).filter((f) => f !== "lastModified");
1175
1187
  return /* @__PURE__ */ V(
1176
1188
  "div",
@@ -1185,13 +1197,13 @@ function Fa({
1185
1197
  },
1186
1198
  children: [
1187
1199
  /* @__PURE__ */ V("div", { children: [
1188
- /* @__PURE__ */ N("div", { style: { fontWeight: 500 }, children: g }),
1189
- /* @__PURE__ */ N("div", { style: { fontSize: "12px", color: "var(--nice-text-muted, #6b7280)" }, children: M.join(", ") })
1200
+ /* @__PURE__ */ C("div", { style: { fontWeight: 500 }, children: g }),
1201
+ /* @__PURE__ */ C("div", { style: { fontSize: "12px", color: "var(--nice-text-muted, #6b7280)" }, children: M.join(", ") })
1190
1202
  ] }),
1191
- /* @__PURE__ */ N(
1203
+ /* @__PURE__ */ C(
1192
1204
  "button",
1193
1205
  {
1194
- onClick: () => x(g),
1206
+ onClick: () => z(g),
1195
1207
  style: {
1196
1208
  padding: "4px 8px",
1197
1209
  border: "none",
@@ -1209,26 +1221,26 @@ function Fa({
1209
1221
  );
1210
1222
  }) })
1211
1223
  ] }),
1212
- e && A.length === 0 && /* @__PURE__ */ N("div", { style: { color: "var(--nice-text-muted, #6b7280)", fontStyle: "italic" }, children: o("userPreferences.noControlPreferencesSavedYet", "No control preferences saved yet.") })
1224
+ e && A.length === 0 && /* @__PURE__ */ C("div", { style: { color: "var(--nice-text-muted, #6b7280)", fontStyle: "italic" }, children: o("userPreferences.noControlPreferencesSavedYet", "No control preferences saved yet.") })
1213
1225
  ]
1214
1226
  }
1215
1227
  );
1216
1228
  }
1217
- const je = {
1229
+ const Ue = {
1218
1230
  "045e": "xbox",
1219
1231
  "054c": "playstation",
1220
1232
  "057e": "nintendo",
1221
1233
  "28de": "steam"
1222
1234
  };
1223
- function sn(n) {
1235
+ function on(t) {
1224
1236
  var a, r, s;
1225
- const e = n.toLowerCase(), t = ((a = /vendor:\s*([0-9a-f]{4})/.exec(e)) == null ? void 0 : a[1]) ?? ((s = (r = /^([0-9a-f]{1,4})-[0-9a-f]{1,4}-/.exec(e)) == null ? void 0 : r[1]) == null ? void 0 : s.padStart(4, "0"));
1226
- return t && je[t] ? je[t] : /xbox|xinput|x-box/.test(e) ? "xbox" : /dualsense|dualshock|playstation/.test(e) ? "playstation" : /nintendo|pro controller|joy-con|switch/.test(e) ? "nintendo" : /steam|valve/.test(e) ? "steam" : "generic";
1237
+ const e = t.toLowerCase(), n = ((a = /vendor:\s*([0-9a-f]{4})/.exec(e)) == null ? void 0 : a[1]) ?? ((s = (r = /^([0-9a-f]{1,4})-[0-9a-f]{1,4}-/.exec(e)) == null ? void 0 : r[1]) == null ? void 0 : s.padStart(4, "0"));
1238
+ return n && Ue[n] ? Ue[n] : /xbox|xinput|x-box/.test(e) ? "xbox" : /dualsense|dualshock|playstation/.test(e) ? "playstation" : /nintendo|pro controller|joy-con|switch/.test(e) ? "nintendo" : /steam|valve/.test(e) ? "steam" : "generic";
1227
1239
  }
1228
- function on(n, e) {
1229
- return e !== "auto" ? e : n === "nintendo" ? "east" : "south";
1240
+ function cn(t, e) {
1241
+ return e !== "auto" ? e : t === "nintendo" ? "east" : "south";
1230
1242
  }
1231
- const cn = {
1243
+ const ln = {
1232
1244
  A: "south",
1233
1245
  B: "east",
1234
1246
  X: "west",
@@ -1242,8 +1254,8 @@ const cn = {
1242
1254
  LS: "leftStick",
1243
1255
  RS: "rightStick"
1244
1256
  };
1245
- function ln(n) {
1246
- return cn[n] ?? n;
1257
+ function un(t) {
1258
+ return ln[t] ?? t;
1247
1259
  }
1248
1260
  const ye = {
1249
1261
  xbox: { south: ["A"], east: ["B"], west: ["X"], north: ["Y"] },
@@ -1261,7 +1273,7 @@ const ye = {
1261
1273
  west: ["Left button", "input.pad.leftButton"],
1262
1274
  north: ["Top button", "input.pad.topButton"]
1263
1275
  }
1264
- }, Ue = ["Left stick", "input.pad.leftStick"], Ge = ["Right stick", "input.pad.rightStick"], un = {
1276
+ }, Ge = ["Left stick", "input.pad.leftStick"], qe = ["Right stick", "input.pad.rightStick"], dn = {
1265
1277
  xbox: [["LB"], ["RB"], ["LT"], ["RT"], ["View"], ["Menu"], ["LS"], ["RS"]],
1266
1278
  playstation: [["L1"], ["R1"], ["L2"], ["R2"], ["Create"], ["Options"], ["L3"], ["R3"]],
1267
1279
  nintendo: [
@@ -1271,8 +1283,8 @@ const ye = {
1271
1283
  ["ZR"],
1272
1284
  ["Minus", "input.pad.minus"],
1273
1285
  ["Plus", "input.pad.plus"],
1274
- Ue,
1275
- Ge
1286
+ Ge,
1287
+ qe
1276
1288
  ],
1277
1289
  steam: [["L1"], ["R1"], ["L2"], ["R2"], ["View"], ["Menu"], ["L3"], ["R3"]],
1278
1290
  generic: [
@@ -1282,10 +1294,10 @@ const ye = {
1282
1294
  ["Right trigger", "input.pad.rightTrigger"],
1283
1295
  ["Select"],
1284
1296
  ["Start"],
1285
- Ue,
1286
- Ge
1297
+ Ge,
1298
+ qe
1287
1299
  ]
1288
- }, dn = {
1300
+ }, hn = {
1289
1301
  leftBumper: 0,
1290
1302
  rightBumper: 1,
1291
1303
  leftTrigger: 2,
@@ -1294,33 +1306,33 @@ const ye = {
1294
1306
  start: 5,
1295
1307
  leftStick: 6,
1296
1308
  rightStick: 7
1297
- }, hn = {
1309
+ }, fn = {
1298
1310
  dpadUp: ["D-pad up", "input.pad.dpadUp"],
1299
1311
  dpadDown: ["D-pad down", "input.pad.dpadDown"],
1300
1312
  dpadLeft: ["D-pad left", "input.pad.dpadLeft"],
1301
1313
  dpadRight: ["D-pad right", "input.pad.dpadRight"],
1302
1314
  home: ["Home"]
1303
1315
  };
1304
- function fn(n, e) {
1305
- if (e in ye[n])
1306
- return ye[n][e];
1307
- const t = dn[e];
1308
- return t === void 0 ? hn[e] ?? [e] : un[n][t];
1316
+ function pn(t, e) {
1317
+ if (e in ye[t])
1318
+ return ye[t][e];
1319
+ const n = hn[e];
1320
+ return n === void 0 ? fn[e] ?? [e] : dn[t][n];
1309
1321
  }
1310
- function pn(n, e) {
1311
- const [t, a] = fn(n, e);
1312
- return a ? { label: t, key: a } : { label: t };
1322
+ function vn(t, e) {
1323
+ const [n, a] = pn(t, e);
1324
+ return a ? { label: n, key: a } : { label: n };
1313
1325
  }
1314
- function vn(n, e) {
1326
+ function mn(t, e) {
1315
1327
  switch (e) {
1316
1328
  case "south":
1317
1329
  case "east":
1318
1330
  case "west":
1319
1331
  case "north": {
1320
- if (n === "generic")
1332
+ if (t === "generic")
1321
1333
  return `pad-generic-${e}`;
1322
- const t = n === "steam" ? "xbox" : n;
1323
- return `pad-${t}-${ye[t][e][0].toLowerCase()}`;
1334
+ const n = t === "steam" ? "xbox" : t;
1335
+ return `pad-${n}-${ye[n][e][0].toLowerCase()}`;
1324
1336
  }
1325
1337
  case "leftBumper":
1326
1338
  return "pad-lb";
@@ -1346,7 +1358,7 @@ function vn(n, e) {
1346
1358
  return `pad-${e}`;
1347
1359
  }
1348
1360
  }
1349
- const Ct = ["up", "down", "left", "right"], we = {
1361
+ const Nt = ["up", "down", "left", "right"], we = {
1350
1362
  navigate: ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"],
1351
1363
  activate: ["Enter", "Space"],
1352
1364
  back: ["Escape"],
@@ -1362,7 +1374,7 @@ const Ct = ["up", "down", "left", "right"], we = {
1362
1374
  last: ["End"],
1363
1375
  scroll: [],
1364
1376
  toggleHints: ["Shift+?"]
1365
- }, qe = {
1377
+ }, $e = {
1366
1378
  navigate: ["dpadUp", "dpadDown", "dpadLeft", "dpadRight"],
1367
1379
  activate: ["south"],
1368
1380
  back: ["east"],
@@ -1378,7 +1390,7 @@ const Ct = ["up", "down", "left", "right"], we = {
1378
1390
  last: [],
1379
1391
  scroll: [],
1380
1392
  toggleHints: ["leftStick"]
1381
- }, mn = {
1393
+ }, Mn = {
1382
1394
  " ": "Space",
1383
1395
  Spacebar: "Space",
1384
1396
  Esc: "Escape",
@@ -1388,63 +1400,63 @@ const Ct = ["up", "down", "left", "right"], we = {
1388
1400
  Left: "ArrowLeft",
1389
1401
  Right: "ArrowRight"
1390
1402
  };
1391
- function Re(n) {
1392
- return mn[n] ?? n;
1403
+ function Re(t) {
1404
+ return Mn[t] ?? t;
1393
1405
  }
1394
- function Ht(n) {
1395
- const e = n.endsWith("++") ? [...n.slice(0, -2).split("+"), "+"] : n.split("+"), t = e.pop() ?? "", a = new Set(e.map((r) => r.toLowerCase()));
1406
+ function Ht(t) {
1407
+ const e = t.endsWith("++") ? [...t.slice(0, -2).split("+"), "+"] : t.split("+"), n = e.pop() ?? "", a = new Set(e.map((r) => r.toLowerCase()));
1396
1408
  return {
1397
- key: Re(t),
1409
+ key: Re(n),
1398
1410
  primary: a.has("ctrl") || a.has("cmd") || a.has("meta") || a.has("mod"),
1399
1411
  alt: a.has("alt") || a.has("option"),
1400
1412
  shift: a.has("shift")
1401
1413
  };
1402
1414
  }
1403
- const Mn = (n) => n.length === 1 && n.toLowerCase() === n.toUpperCase();
1404
- function Nt(n, e) {
1405
- const t = Re(e.key);
1406
- return !(t.length === 1 ? t.toLowerCase() === n.key.toLowerCase() : t === n.key) || n.primary !== (e.ctrlKey || e.metaKey) || n.alt !== e.altKey ? !1 : Mn(n.key) || n.shift === e.shiftKey;
1415
+ const gn = (t) => t.length === 1 && t.toLowerCase() === t.toUpperCase();
1416
+ function Tt(t, e) {
1417
+ const n = Re(e.key);
1418
+ return !(n.length === 1 ? n.toLowerCase() === t.key.toLowerCase() : n === t.key) || t.primary !== (e.ctrlKey || e.metaKey) || t.alt !== e.altKey ? !1 : gn(t.key) || t.shift === e.shiftKey;
1407
1419
  }
1408
- function $e(n) {
1420
+ function Ye(t) {
1409
1421
  const e = {};
1410
- for (const t of Object.keys(we)) {
1411
- const a = n.keyboardBindings[t] ?? we[t];
1412
- e[t] = a.map(Ht);
1422
+ for (const n of Object.keys(we)) {
1423
+ const a = t.keyboardBindings[n] ?? we[n];
1424
+ e[n] = a.map(Ht);
1413
1425
  }
1414
1426
  return e;
1415
1427
  }
1416
- function gn(n, e) {
1417
- for (const t of Object.keys(e)) {
1418
- const a = e[t];
1428
+ function bn(t, e) {
1429
+ for (const n of Object.keys(e)) {
1430
+ const a = e[n];
1419
1431
  for (let r = 0; r < a.length; r++)
1420
- if (Nt(a[r], n))
1421
- return t === "navigate" ? { intent: t, direction: Ct[r] } : t === "view" ? { intent: t, direction: a[r].shift ? "up" : "down" } : { intent: t };
1432
+ if (Tt(a[r], t))
1433
+ return n === "navigate" ? { intent: n, direction: Nt[r] } : n === "view" ? { intent: n, direction: a[r].shift ? "up" : "down" } : { intent: n };
1422
1434
  }
1423
1435
  return null;
1424
1436
  }
1425
- const bn = /* @__PURE__ */ new Set(["GoBack", "BrowserBack", "XF86Back"]), yn = /* @__PURE__ */ new Set([461, 10009]);
1426
- function wn(n) {
1427
- return bn.has(n.key) || yn.has(n.keyCode) ? { intent: "back" } : n.key === "ChannelUp" ? { intent: "sectionNext" } : n.key === "ChannelDown" ? { intent: "sectionPrev" } : null;
1437
+ const yn = /* @__PURE__ */ new Set(["GoBack", "BrowserBack", "XF86Back"]), wn = /* @__PURE__ */ new Set([461, 10009]);
1438
+ function En(t) {
1439
+ return yn.has(t.key) || wn.has(t.keyCode) ? { intent: "back" } : t.key === "ChannelUp" ? { intent: "sectionNext" } : t.key === "ChannelDown" ? { intent: "sectionPrev" } : null;
1428
1440
  }
1429
- function Ee(n, e) {
1430
- const t = on(e, n.confirmButton), a = t === "south" ? "east" : "south", r = {};
1431
- for (const s of Object.keys(qe)) {
1432
- const o = n.gamepadBindings[s];
1433
- o ? r[s] = [...o] : s === "activate" ? r[s] = [t] : s === "back" ? r[s] = [a] : r[s] = [...qe[s]];
1441
+ function Ee(t, e) {
1442
+ const n = cn(e, t.confirmButton), a = n === "south" ? "east" : "south", r = {};
1443
+ for (const s of Object.keys($e)) {
1444
+ const o = t.gamepadBindings[s];
1445
+ o ? r[s] = [...o] : s === "activate" ? r[s] = [n] : s === "back" ? r[s] = [a] : r[s] = [...$e[s]];
1434
1446
  }
1435
1447
  return r;
1436
1448
  }
1437
- function En(n) {
1449
+ function kn(t) {
1438
1450
  const e = /* @__PURE__ */ new Map();
1439
- for (const t of Object.keys(n))
1440
- n[t].forEach((a, r) => {
1441
- e.has(a) || e.set(a, t === "navigate" ? { intent: t, direction: Ct[r] } : { intent: t });
1451
+ for (const n of Object.keys(t))
1452
+ t[n].forEach((a, r) => {
1453
+ e.has(a) || e.set(a, n === "navigate" ? { intent: n, direction: Nt[r] } : { intent: n });
1442
1454
  });
1443
1455
  return e;
1444
1456
  }
1445
1457
  const re = "data-nice-focus-scope", ke = `[${re}]`;
1446
- function kn(n, e) {
1447
- const t = {
1458
+ function zn(t, e) {
1459
+ const n = {
1448
1460
  [re]: e.nav ?? "spatial",
1449
1461
  "data-nice-scope-wrap": e.wrap ? "" : null,
1450
1462
  "data-nice-scope-trap": e.trap ? "" : null,
@@ -1452,55 +1464,55 @@ function kn(n, e) {
1452
1464
  "data-nice-arrows": e.arrows ?? null,
1453
1465
  "data-nice-region": e.region ?? null
1454
1466
  }, a = {};
1455
- for (const [r, s] of Object.entries(t))
1456
- a[r] = n.getAttribute(r), s === null ? n.removeAttribute(r) : n.setAttribute(r, s);
1467
+ for (const [r, s] of Object.entries(n))
1468
+ a[r] = t.getAttribute(r), s === null ? t.removeAttribute(r) : t.setAttribute(r, s);
1457
1469
  return () => {
1458
1470
  for (const [r, s] of Object.entries(a))
1459
- s === null ? n.removeAttribute(r) : n.setAttribute(r, s);
1471
+ s === null ? t.removeAttribute(r) : t.setAttribute(r, s);
1460
1472
  };
1461
1473
  }
1462
- function Tt(n) {
1463
- const e = n.getAttribute(re), t = n.getAttribute("data-nice-scope-enter");
1474
+ function Pt(t) {
1475
+ const e = t.getAttribute(re), n = t.getAttribute("data-nice-scope-enter");
1464
1476
  return {
1465
1477
  nav: e === "vertical" || e === "horizontal" || e === "grid" || e === "none" ? e : "spatial",
1466
- wrap: n.hasAttribute("data-nice-scope-wrap"),
1467
- trap: n.hasAttribute("data-nice-scope-trap"),
1468
- enter: t === "selected" || t === "first" ? t : "last"
1478
+ wrap: t.hasAttribute("data-nice-scope-wrap"),
1479
+ trap: t.hasAttribute("data-nice-scope-trap"),
1480
+ enter: n === "selected" || n === "first" ? n : "last"
1469
1481
  };
1470
1482
  }
1471
- function Ye(n, e) {
1483
+ function We(t, e) {
1472
1484
  var a;
1473
- const t = (a = n.parentElement) == null ? void 0 : a.closest(ke);
1474
- return t && e.contains(t) && t !== e ? t : e;
1485
+ const n = (a = t.parentElement) == null ? void 0 : a.closest(ke);
1486
+ return n && e.contains(n) && n !== e ? n : e;
1475
1487
  }
1476
- function xn(n) {
1477
- var t, a;
1488
+ function xn(t) {
1489
+ var n, a;
1478
1490
  const e = [];
1479
- for (let r = (t = n.parentElement) == null ? void 0 : t.closest(ke); r; r = (a = r.parentElement) == null ? void 0 : a.closest(ke))
1491
+ for (let r = (n = t.parentElement) == null ? void 0 : n.closest(ke); r; r = (a = r.parentElement) == null ? void 0 : a.closest(ke))
1480
1492
  e.push(r);
1481
1493
  return e;
1482
1494
  }
1483
- function zn(n) {
1484
- var t;
1485
- const e = (t = n.closest("[data-nice-arrows]")) == null ? void 0 : t.getAttribute("data-nice-arrows");
1495
+ function An(t) {
1496
+ var n;
1497
+ const e = (n = t.closest("[data-nice-arrows]")) == null ? void 0 : n.getAttribute("data-nice-arrows");
1486
1498
  return e === "spatial" || e === "native" ? e : null;
1487
1499
  }
1488
- const We = { horizontal: 30, vertical: 2 }, G = 1, Xe = (n) => n === "left" || n === "right", Je = (n, e, t, a) => Math.max(0, Math.max(n, t) - Math.min(e, a));
1489
- function An(n, e, t) {
1490
- switch (t) {
1500
+ const Xe = { horizontal: 30, vertical: 2 }, G = 1, Je = (t) => t === "left" || t === "right", Ze = (t, e, n, a) => Math.max(0, Math.max(t, n) - Math.min(e, a));
1501
+ function Ln(t, e, n) {
1502
+ switch (n) {
1491
1503
  case "right":
1492
- return e.left >= n.right - G;
1504
+ return e.left >= t.right - G;
1493
1505
  case "left":
1494
- return e.right <= n.left + G;
1506
+ return e.right <= t.left + G;
1495
1507
  case "down":
1496
- return e.top >= n.bottom - G;
1508
+ return e.top >= t.bottom - G;
1497
1509
  default:
1498
- return e.bottom <= n.top + G;
1510
+ return e.bottom <= t.top + G;
1499
1511
  }
1500
1512
  }
1501
- function Sn(n, e, t) {
1502
- const a = n.left + n.width / 2, r = n.top + n.height / 2, s = e.left + e.width / 2, o = e.top + e.height / 2;
1503
- switch (t) {
1513
+ function Sn(t, e, n) {
1514
+ const a = t.left + t.width / 2, r = t.top + t.height / 2, s = e.left + e.width / 2, o = e.top + e.height / 2;
1515
+ switch (n) {
1504
1516
  case "right":
1505
1517
  return s > a + G;
1506
1518
  case "left":
@@ -1511,20 +1523,20 @@ function Sn(n, e, t) {
1511
1523
  return o < r - G;
1512
1524
  }
1513
1525
  }
1514
- function Ln(n, e, t) {
1526
+ function Cn(t, e, n) {
1515
1527
  let a, r, s;
1516
- Xe(t) ? (a = t === "right" ? e.left - n.right : n.left - e.right, r = Je(n.top, n.bottom, e.top, e.bottom), s = Math.abs(e.top + e.height / 2 - (n.top + n.height / 2))) : (a = t === "down" ? e.top - n.bottom : n.top - e.bottom, r = Je(n.left, n.right, e.left, e.right), s = Math.abs(e.left + e.width / 2 - (n.left + n.width / 2)));
1517
- const o = Xe(t) ? We.horizontal : We.vertical;
1528
+ Je(n) ? (a = n === "right" ? e.left - t.right : t.left - e.right, r = Ze(t.top, t.bottom, e.top, e.bottom), s = Math.abs(e.top + e.height / 2 - (t.top + t.height / 2))) : (a = n === "down" ? e.top - t.bottom : t.top - e.bottom, r = Ze(t.left, t.right, e.left, e.right), s = Math.abs(e.left + e.width / 2 - (t.left + t.width / 2)));
1529
+ const o = Je(n) ? Xe.horizontal : Xe.vertical;
1518
1530
  return Math.max(0, a) + r * o + s * 0.01;
1519
1531
  }
1520
- function Pt(n, e, t, a) {
1521
- const r = e.map(t);
1522
- for (const s of [An, Sn]) {
1532
+ function It(t, e, n, a) {
1533
+ const r = e.map(n);
1534
+ for (const s of [Ln, Sn]) {
1523
1535
  let o = -1, i = 1 / 0;
1524
1536
  for (let c = 0; c < r.length; c++) {
1525
- if (!s(n, r[c], a))
1537
+ if (!s(t, r[c], a))
1526
1538
  continue;
1527
- const d = Ln(n, r[c], a);
1539
+ const d = Cn(t, r[c], a);
1528
1540
  d < i && (i = d, o = c);
1529
1541
  }
1530
1542
  if (o >= 0)
@@ -1532,61 +1544,61 @@ function Pt(n, e, t, a) {
1532
1544
  }
1533
1545
  return null;
1534
1546
  }
1535
- const ue = (n) => n === "left" || n === "right", Cn = (n) => {
1547
+ const ue = (t) => t === "left" || t === "right", Nn = (t) => {
1536
1548
  var e;
1537
- return ((e = n.ownerDocument.defaultView) == null ? void 0 : e.getComputedStyle(n).direction) === "rtl";
1549
+ return ((e = t.ownerDocument.defaultView) == null ? void 0 : e.getComputedStyle(t).direction) === "rtl";
1538
1550
  };
1539
- function Hn(n, e, t, a) {
1540
- if (n.length === 0)
1551
+ function Hn(t, e, n, a) {
1552
+ if (t.length === 0)
1541
1553
  return null;
1542
1554
  const r = (s) => !!(e.compareDocumentPosition(s) & Node.DOCUMENT_POSITION_FOLLOWING);
1543
- if (t)
1544
- return n.find(r) ?? (a ? n[0] : null);
1545
- for (let s = n.length - 1; s >= 0; s--)
1546
- if (!r(n[s]))
1547
- return n[s];
1548
- return a ? n[n.length - 1] : null;
1549
- }
1550
- const Nn = '[aria-selected="true"],[aria-checked="true"],[aria-current]:not([aria-current="false"]),:checked';
1551
- function Tn(n, e, t) {
1555
+ if (n)
1556
+ return t.find(r) ?? (a ? t[0] : null);
1557
+ for (let s = t.length - 1; s >= 0; s--)
1558
+ if (!r(t[s]))
1559
+ return t[s];
1560
+ return a ? t[t.length - 1] : null;
1561
+ }
1562
+ const Tn = '[aria-selected="true"],[aria-checked="true"],[aria-current]:not([aria-current="false"]),:checked';
1563
+ function Pn(t, e, n) {
1552
1564
  let a = null;
1553
- for (let s = n.parentElement; s && !s.contains(e); s = s.parentElement)
1565
+ for (let s = t.parentElement; s && !s.contains(e); s = s.parentElement)
1554
1566
  s.hasAttribute(re) && (a = s);
1555
1567
  if (!a)
1556
- return n;
1557
- const r = Tt(a).enter;
1568
+ return t;
1569
+ const r = Pt(a).enter;
1558
1570
  if (r === "last") {
1559
- const s = t.get(a);
1560
- return s && s.isConnected && a.contains(s) && te(s) ? s : n;
1571
+ const s = n.get(a);
1572
+ return s && s.isConnected && a.contains(s) && te(s) ? s : t;
1561
1573
  }
1562
- return r === "selected" ? [...a.querySelectorAll(Nn)].find(te) ?? n : U(a)[0] ?? n;
1574
+ return r === "selected" ? [...a.querySelectorAll(Tn)].find(te) ?? t : U(a)[0] ?? t;
1563
1575
  }
1564
- function Pn(n, e, t) {
1565
- const a = X(n);
1566
- let r = Ye(n, t.root), s = null;
1576
+ function In(t, e, n) {
1577
+ const a = X(t);
1578
+ let r = We(t, n.root), s = null;
1567
1579
  for (; ; ) {
1568
- const o = Tt(r);
1580
+ const o = Pt(r);
1569
1581
  if (o.nav === "spatial" || o.nav === "grid" || o.nav === "vertical" && !ue(e) || o.nav === "horizontal" && ue(e)) {
1570
- const c = U(r, [n, s]);
1582
+ const c = U(r, [t, s]);
1571
1583
  let d;
1572
1584
  if (o.nav === "vertical" || o.nav === "horizontal") {
1573
1585
  let u = e === "down" || e === "right";
1574
- ue(e) && Cn(r) && (u = !u), d = Hn(c, n, u, o.wrap);
1586
+ ue(e) && Nn(r) && (u = !u), d = Hn(c, t, u, o.wrap);
1575
1587
  } else
1576
- d = Pt(a, c, X, e);
1588
+ d = It(a, c, X, e);
1577
1589
  if (d)
1578
- return Tn(d, n, t.memory);
1590
+ return Pn(d, t, n.memory);
1579
1591
  }
1580
- if (r === t.root || o.trap)
1592
+ if (r === n.root || o.trap)
1581
1593
  return null;
1582
- s = r, r = Ye(r, t.root);
1594
+ s = r, r = We(r, n.root);
1583
1595
  }
1584
1596
  }
1585
- function Ze(n, e) {
1586
- const t = e.left + e.width / 2, a = e.top + e.height / 2;
1597
+ function Qe(t, e) {
1598
+ const n = e.left + e.width / 2, a = e.top + e.height / 2;
1587
1599
  let r = null, s = 1 / 0;
1588
- for (const o of U(n)) {
1589
- const i = X(o), c = Math.hypot(i.left + i.width / 2 - t, i.top + i.height / 2 - a);
1600
+ for (const o of U(t)) {
1601
+ const i = X(o), c = Math.hypot(i.left + i.width / 2 - n, i.top + i.height / 2 - a);
1590
1602
  c < s && (s = c, r = o);
1591
1603
  }
1592
1604
  return r;
@@ -1607,19 +1619,19 @@ const Dt = [
1607
1619
  '[role="region"][aria-label]',
1608
1620
  '[role="region"][aria-labelledby]'
1609
1621
  ].join(",");
1610
- function Dn(n, e, t) {
1611
- const a = [...t.root.querySelectorAll(Dt)], r = a.filter(
1622
+ function Dn(t, e, n) {
1623
+ const a = [...n.root.querySelectorAll(Dt)], r = a.filter(
1612
1624
  (u) => !a.some((h) => h !== u && h.contains(u)) && U(u).length > 0
1613
1625
  );
1614
1626
  if (r.length === 0)
1615
1627
  return null;
1616
- const s = r.findIndex((u) => u.contains(n)), o = e === "up" || e === "left" ? -1 : 1, i = s < 0 ? o > 0 ? -1 : 0 : s, c = r[(i + o + r.length) % r.length];
1628
+ const s = r.findIndex((u) => u.contains(t)), o = e === "up" || e === "left" ? -1 : 1, i = s < 0 ? o > 0 ? -1 : 0 : s, c = r[(i + o + r.length) % r.length];
1617
1629
  if (c === r[s])
1618
1630
  return null;
1619
- const d = t.memory.get(c);
1631
+ const d = n.memory.get(c);
1620
1632
  return d && d.isConnected && c.contains(d) && te(d) ? d : U(c)[0];
1621
1633
  }
1622
- const _a = [
1634
+ const Ba = [
1623
1635
  "navigate",
1624
1636
  "activate",
1625
1637
  "back",
@@ -1653,7 +1665,7 @@ const _a = [
1653
1665
  "dpadLeft",
1654
1666
  "dpadRight",
1655
1667
  "home"
1656
- ], xe = "nice-intent", ne = "nice-engagechange", Y = {
1668
+ ], ze = "nice-intent", ne = "nice-engagechange", Y = {
1657
1669
  confirmButton: "auto",
1658
1670
  gamepadBindings: {},
1659
1671
  keyboardBindings: {},
@@ -1669,12 +1681,12 @@ const _a = [
1669
1681
  vibration: !1,
1670
1682
  arrowNavigation: "auto",
1671
1683
  onScreenKeyboard: "auto"
1672
- }, In = /* @__PURE__ */ new Set([4, 5, 6, 7, 12, 13, 14, 15]), On = 0.85;
1673
- function Rn(n, e) {
1674
- return Math.abs(n) > Math.abs(e) ? n > 0 ? "right" : "left" : e > 0 ? "down" : "up";
1684
+ }, On = /* @__PURE__ */ new Set([4, 5, 6, 7, 12, 13, 14, 15]), Rn = 0.85;
1685
+ function Vn(t, e) {
1686
+ return Math.abs(t) > Math.abs(e) ? t > 0 ? "right" : "left" : e > 0 ? "down" : "up";
1675
1687
  }
1676
- class Vn {
1677
- constructor(e, t) {
1688
+ class Fn {
1689
+ constructor(e, n) {
1678
1690
  this.states = /* @__PURE__ */ new Map(), this.connected = /* @__PURE__ */ new Set(), this.warned = /* @__PURE__ */ new Set(), this.started = !1, this.frameId = 0, this.onConnected = (a) => {
1679
1691
  const r = a.gamepad;
1680
1692
  r && this.connected.add(r.index), this.schedule();
@@ -1686,7 +1698,7 @@ class Vn {
1686
1698
  this.win.document.hidden ? this.cancel() : this.schedule();
1687
1699
  }, this.frame = (a) => {
1688
1700
  this.frameId = 0, this.poll(a), this.schedule();
1689
- }, this.win = e, this.opts = t;
1701
+ }, this.win = e, this.opts = n;
1690
1702
  }
1691
1703
  /** Whether an animation frame is scheduled (false without a pad or on a hidden page). */
1692
1704
  get running() {
@@ -1709,7 +1721,7 @@ class Vn {
1709
1721
  /** Read every pad once; public so tests can drive a frame. */
1710
1722
  poll(e) {
1711
1723
  var o, i, c, d, u, h;
1712
- const t = this.opts.timing(), a = /* @__PURE__ */ new Set(), r = this.read();
1724
+ const n = this.opts.timing(), a = /* @__PURE__ */ new Set(), r = this.read();
1713
1725
  for (const l of r) {
1714
1726
  a.add(l.index);
1715
1727
  let p = this.states.get(l.index);
@@ -1717,23 +1729,23 @@ class Vn {
1717
1729
  info: {
1718
1730
  index: l.index,
1719
1731
  id: l.id,
1720
- family: sn(l.id),
1732
+ family: on(l.id),
1721
1733
  mapping: l.mapping
1722
1734
  },
1723
1735
  pressed: [],
1724
1736
  stick: null,
1725
1737
  holds: /* @__PURE__ */ new Map()
1726
- }, this.states.set(l.index, p), this.warnMapping(l), (i = (o = this.opts).onPadsChange) == null || i.call(o, this.pads)), this.readButtons(p, l, e, t), this.readSticks(p, l, e, t);
1738
+ }, this.states.set(l.index, p), this.warnMapping(l), (i = (o = this.opts).onPadsChange) == null || i.call(o, this.pads)), this.readButtons(p, l, e, n), this.readSticks(p, l, e, n);
1727
1739
  }
1728
1740
  let s = !1;
1729
1741
  for (const l of [...this.states.keys()])
1730
1742
  a.has(l) || (this.states.delete(l), s = !0);
1731
1743
  s && ((d = (c = this.opts).onPadsChange) == null || d.call(c, this.pads)), (h = (u = this.opts).onFrame) == null || h.call(u, r, e);
1732
1744
  }
1733
- readButtons(e, t, a, r) {
1745
+ readButtons(e, n, a, r) {
1734
1746
  for (let s = 0; s < de.length; s++) {
1735
- const o = t.buttons[s], i = !!(o && (o.pressed || o.value > 0.5)), c = `b${s}`;
1736
- i !== !!e.pressed[s] ? (e.pressed[s] = i, i && In.has(s) ? e.holds.set(c, { since: a, last: a, count: 0 }) : e.holds.delete(c), this.opts.onButton({
1747
+ const o = n.buttons[s], i = !!(o && (o.pressed || o.value > 0.5)), c = `b${s}`;
1748
+ i !== !!e.pressed[s] ? (e.pressed[s] = i, i && On.has(s) ? e.holds.set(c, { since: a, last: a, count: 0 }) : e.holds.delete(c), this.opts.onButton({
1737
1749
  pad: e.info,
1738
1750
  button: de[s],
1739
1751
  pressed: i,
@@ -1746,34 +1758,34 @@ class Vn {
1746
1758
  });
1747
1759
  }
1748
1760
  }
1749
- readSticks(e, t, a, r) {
1750
- const s = t.axes[0] ?? 0, o = t.axes[1] ?? 0, i = Math.hypot(s, o);
1761
+ readSticks(e, n, a, r) {
1762
+ const s = n.axes[0] ?? 0, o = n.axes[1] ?? 0, i = Math.hypot(s, o);
1751
1763
  if (i >= r.stickThreshold) {
1752
- const h = Rn(s, o);
1764
+ const h = Vn(s, o);
1753
1765
  h !== e.stick ? (e.stick = h, e.holds.set("stick", { since: a, last: a, count: 0 }), this.opts.onStick({ pad: e.info, direction: h, repeat: !1 })) : this.repeats(e, "stick", a, r) && this.opts.onStick({ pad: e.info, direction: h, repeat: !0 });
1754
1766
  } else e.stick && i < r.stickThreshold * 0.7 && (e.stick = null, e.holds.delete("stick"));
1755
- const c = t.axes[2] ?? 0, d = t.axes[3] ?? 0, u = Math.hypot(c, d);
1767
+ const c = n.axes[2] ?? 0, d = n.axes[3] ?? 0, u = Math.hypot(c, d);
1756
1768
  if (u > r.stickDeadzone) {
1757
1769
  const h = (u - r.stickDeadzone) / (1 - r.stickDeadzone) / u;
1758
1770
  this.opts.onScroll({ pad: e.info, x: c * h, y: d * h });
1759
1771
  }
1760
1772
  }
1761
- repeats(e, t, a, r) {
1762
- const s = e.holds.get(t);
1773
+ repeats(e, n, a, r) {
1774
+ const s = e.holds.get(n);
1763
1775
  if (!s || a - s.since < r.repeatDelay)
1764
1776
  return !1;
1765
1777
  const o = Math.max(
1766
1778
  r.repeatIntervalMin,
1767
- r.repeatInterval * On ** s.count
1779
+ r.repeatInterval * Rn ** s.count
1768
1780
  );
1769
1781
  return a - s.last < o ? !1 : (s.last = a, s.count++, !0);
1770
1782
  }
1771
1783
  read() {
1772
1784
  var a, r;
1773
- const e = ((r = (a = this.win.navigator).getGamepads) == null ? void 0 : r.call(a)) ?? [], t = [];
1785
+ const e = ((r = (a = this.win.navigator).getGamepads) == null ? void 0 : r.call(a)) ?? [], n = [];
1774
1786
  for (const s of e)
1775
- s && s.connected !== !1 && t.push(s);
1776
- return t;
1787
+ s && s.connected !== !1 && n.push(s);
1788
+ return n;
1777
1789
  }
1778
1790
  warnMapping(e) {
1779
1791
  e.mapping === "standard" || this.warned.has(e.id) || (this.warned.add(e.id), process.env.NODE_ENV !== "production" && console.warn(
@@ -1787,12 +1799,12 @@ class Vn {
1787
1799
  this.frameId !== 0 && (this.win.cancelAnimationFrame(this.frameId), this.frameId = 0);
1788
1800
  }
1789
1801
  }
1790
- const Fn = {
1802
+ const _n = {
1791
1803
  up: "ArrowUp",
1792
1804
  down: "ArrowDown",
1793
1805
  left: "ArrowLeft",
1794
1806
  right: "ArrowRight"
1795
- }, Qe = {
1807
+ }, et = {
1796
1808
  ArrowUp: 38,
1797
1809
  ArrowDown: 40,
1798
1810
  ArrowLeft: 37,
@@ -1803,107 +1815,107 @@ const Fn = {
1803
1815
  End: 35,
1804
1816
  PageUp: 33,
1805
1817
  PageDown: 34
1806
- }, et = /* @__PURE__ */ new Set(["Shift", "Control", "Alt", "Meta", "AltGraph", "OS"]), _n = /Web0S|webOS|Tizen|SMART-TV|SmartTV|HbbTV|NetCast|Android TV|AFT|BRAVIA|CrKey/i, tt = 18, nt = (n) => n === "keyboard" || n === "gamepad" || n === "remote";
1807
- class Bn {
1818
+ }, tt = /* @__PURE__ */ new Set(["Shift", "Control", "Alt", "Meta", "AltGraph", "OS"]), Bn = /Web0S|webOS|Tizen|SMART-TV|SmartTV|HbbTV|NetCast|Android TV|AFT|BRAVIA|CrKey/i, nt = 18, at = (t) => t === "keyboard" || t === "gamepad" || t === "remote";
1819
+ class Kn {
1808
1820
  constructor(e) {
1809
- this.started = !1, this.listeners = /* @__PURE__ */ new Set(), this.frameListeners = /* @__PURE__ */ new Set(), this.padMaps = /* @__PURE__ */ new Map(), this.memory = /* @__PURE__ */ new WeakMap(), this.engagedValues = /* @__PURE__ */ new WeakMap(), this.overlays = [], this.hintsToggled = !1, this.activePad = null, this.lastFocus = null, this.observer = null, this.live = null, this.snapshot = [], this.capture = null, this.translate = (t, a) => a, this.onKeyDown = (t) => {
1810
- if (t.niceSource)
1821
+ this.started = !1, this.listeners = /* @__PURE__ */ new Set(), this.frameListeners = /* @__PURE__ */ new Set(), this.padMaps = /* @__PURE__ */ new Map(), this.memory = /* @__PURE__ */ new WeakMap(), this.engagedValues = /* @__PURE__ */ new WeakMap(), this.overlays = [], this.hintsToggled = !1, this.activePad = null, this.lastFocus = null, this.observer = null, this.live = null, this.snapshot = [], this.capture = null, this.translate = (n, a) => a, this.onKeyDown = (n) => {
1822
+ if (n.niceSource)
1811
1823
  return;
1812
- const a = wn(t), r = this.tv || a ? "remote" : "keyboard";
1813
- if (et.has(t.key) || this.setMethod(r), this.capture && !et.has(t.key)) {
1814
- t.preventDefault();
1824
+ const a = En(n), r = this.tv || a ? "remote" : "keyboard";
1825
+ if (tt.has(n.key) || this.setMethod(r), this.capture && !tt.has(n.key)) {
1826
+ n.preventDefault();
1815
1827
  const c = [
1816
- t.ctrlKey || t.metaKey ? "Ctrl" : "",
1817
- t.altKey ? "Alt" : "",
1818
- t.shiftKey ? "Shift" : ""
1819
- ], d = Re(t.key);
1828
+ n.ctrlKey || n.metaKey ? "Ctrl" : "",
1829
+ n.altKey ? "Alt" : "",
1830
+ n.shiftKey ? "Shift" : ""
1831
+ ], d = Re(n.key);
1820
1832
  this.capture({
1821
1833
  keys: [...c, d.length === 1 ? d.toUpperCase() : d].filter(Boolean).join("+")
1822
1834
  });
1823
1835
  return;
1824
1836
  }
1825
- if (t.defaultPrevented || t.isComposing)
1837
+ if (n.defaultPrevented || n.isComposing)
1826
1838
  return;
1827
- const s = a ?? gn(t, this.keyTable);
1839
+ const s = a ?? bn(n, this.keyTable);
1828
1840
  if (!s)
1829
1841
  return;
1830
- const o = this.targetOf(t);
1831
- if (Gt(o, s))
1842
+ const o = this.targetOf(n);
1843
+ if (qt(o, s))
1832
1844
  return;
1833
1845
  const i = {
1834
1846
  intent: s.intent,
1835
1847
  direction: s.direction,
1836
1848
  source: r,
1837
- repeat: t.repeat,
1838
- keyEvent: t
1849
+ repeat: n.repeat,
1850
+ keyEvent: n
1839
1851
  };
1840
- (this.dispatchIntent(i, o) || this.keyDefault(i, o)) && t.preventDefault();
1841
- }, this.onPadButton = (t) => {
1842
- if (this.activePad = t.pad, this.setMethod("gamepad", t.pad.family), !t.pressed)
1852
+ (this.dispatchIntent(i, o) || this.keyDefault(i, o)) && n.preventDefault();
1853
+ }, this.onPadButton = (n) => {
1854
+ if (this.activePad = n.pad, this.setMethod("gamepad", n.pad.family), !n.pressed)
1843
1855
  return;
1844
1856
  if (this.capture) {
1845
- t.repeat || this.capture({ button: t.button });
1857
+ n.repeat || this.capture({ button: n.button });
1846
1858
  return;
1847
1859
  }
1848
- const a = this.padMap(t.pad.family).get(t.button);
1849
- a && this.deviceIntent({ ...a, source: "gamepad", repeat: t.repeat, gamepad: t.pad });
1850
- }, this.onPadStick = (t) => {
1851
- this.activePad = t.pad, this.setMethod("gamepad", t.pad.family), !this.capture && this.deviceIntent({
1860
+ const a = this.padMap(n.pad.family).get(n.button);
1861
+ a && this.deviceIntent({ ...a, source: "gamepad", repeat: n.repeat, gamepad: n.pad });
1862
+ }, this.onPadStick = (n) => {
1863
+ this.activePad = n.pad, this.setMethod("gamepad", n.pad.family), !this.capture && this.deviceIntent({
1852
1864
  intent: "navigate",
1853
- direction: t.direction,
1865
+ direction: n.direction,
1854
1866
  source: "gamepad",
1855
- repeat: t.repeat,
1856
- gamepad: t.pad
1867
+ repeat: n.repeat,
1868
+ gamepad: n.pad
1857
1869
  });
1858
- }, this.onPadScroll = (t) => {
1859
- this.activePad = t.pad, this.setMethod("gamepad", t.pad.family);
1860
- const a = this.state.preferences.invertScroll ? -1 : 1, r = t.x * a, s = t.y * a, o = this.focused(), i = {
1870
+ }, this.onPadScroll = (n) => {
1871
+ this.activePad = n.pad, this.setMethod("gamepad", n.pad.family);
1872
+ const a = this.state.preferences.invertScroll ? -1 : 1, r = n.x * a, s = n.y * a, o = this.focused(), i = {
1861
1873
  intent: "scroll",
1862
1874
  direction: Math.abs(r) > Math.abs(s) ? r > 0 ? "right" : "left" : s > 0 ? "down" : "up",
1863
1875
  amount: Math.min(1, Math.hypot(r, s)),
1864
1876
  source: "gamepad",
1865
1877
  repeat: !0,
1866
- gamepad: t.pad
1878
+ gamepad: n.pad
1867
1879
  };
1868
- this.dispatchIntent(i, o) || at(rt(o, r, s), r * tt, s * tt);
1869
- }, this.onPointerDown = (t) => {
1870
- this.setMethod(t.pointerType === "touch" ? "touch" : "pointer");
1871
- }, this.onFocusIn = (t) => {
1872
- const a = t.target;
1880
+ this.dispatchIntent(i, o) || rt(st(o, r, s), r * nt, s * nt);
1881
+ }, this.onPointerDown = (n) => {
1882
+ this.setMethod(n.pointerType === "touch" ? "touch" : "pointer");
1883
+ }, this.onFocusIn = (n) => {
1884
+ const a = n.target;
1873
1885
  if (a instanceof HTMLElement) {
1874
1886
  for (let r = a.parentElement; r; r = r.parentElement)
1875
1887
  (r.hasAttribute(re) || r.matches(Dt) || r === this.doc.body) && this.memory.set(r, a);
1876
1888
  this.lastFocus = { el: a, rect: X(a), scope: xn(a)[0] ?? null };
1877
1889
  }
1878
- }, this.onFocusOut = (t) => {
1879
- const a = t.target;
1890
+ }, this.onFocusOut = (n) => {
1891
+ const a = n.target;
1880
1892
  a instanceof HTMLElement && a.hasAttribute("data-nice-engaged") && this.release(a, this.state.method === "gamepad" ? "gamepad" : "keyboard", !1);
1881
1893
  }, this.recover = () => {
1882
- const t = this.lastFocus;
1883
- if (!t || t.el.isConnected)
1894
+ const n = this.lastFocus;
1895
+ if (!n || n.el.isConnected)
1884
1896
  return;
1885
1897
  this.lastFocus = null;
1886
1898
  const a = this.doc.activeElement;
1887
1899
  if (a && a !== this.doc.body)
1888
1900
  return;
1889
- const r = this.navigationRoot(), s = t.scope && t.scope.isConnected && r.contains(t.scope) ? t.scope : r, o = Ze(s, t.rect) ?? (s !== r ? Ze(r, t.rect) : null);
1901
+ const r = this.navigationRoot(), s = n.scope && n.scope.isConnected && r.contains(n.scope) ? n.scope : r, o = Qe(s, n.rect) ?? (s !== r ? Qe(r, n.rect) : null);
1890
1902
  o && this.focusElement(o);
1891
- }, this.win = e, this.doc = e.document, this.tv = _n.test(e.navigator.userAgent), this.keyTable = $e(Y), this.state = {
1903
+ }, this.win = e, this.doc = e.document, this.tv = Bn.test(e.navigator.userAgent), this.keyTable = Ye(Y), this.state = {
1892
1904
  method: "pointer",
1893
1905
  family: null,
1894
1906
  pads: [],
1895
1907
  preferences: Y,
1896
1908
  hintsVisible: Y.hints === "always"
1897
- }, this.poller = new Vn(e, {
1909
+ }, this.poller = new Fn(e, {
1898
1910
  timing: () => this.state.preferences,
1899
1911
  onButton: this.onPadButton,
1900
1912
  onStick: this.onPadStick,
1901
1913
  onScroll: this.onPadScroll,
1902
- onPadsChange: (t) => {
1903
- t.length === 0 && (this.snapshot = []), this.update({ pads: t });
1914
+ onPadsChange: (n) => {
1915
+ n.length === 0 && (this.snapshot = []), this.update({ pads: n });
1904
1916
  },
1905
- onFrame: (t, a) => {
1906
- this.snapshot = t, this.frameListeners.forEach((r) => r(t, a));
1917
+ onFrame: (n, a) => {
1918
+ this.snapshot = n, this.frameListeners.forEach((r) => r(n, a));
1907
1919
  }
1908
1920
  });
1909
1921
  }
@@ -1934,8 +1946,8 @@ class Bn {
1934
1946
  return this.listeners.add(e), () => this.listeners.delete(e);
1935
1947
  }
1936
1948
  setPreferences(e) {
1937
- const t = { ...this.state.preferences, ...e };
1938
- this.keyTable = $e(t), this.padMaps.clear(), this.update({ preferences: t });
1949
+ const n = { ...this.state.preferences, ...e };
1950
+ this.keyTable = Ye(n), this.padMaps.clear(), this.update({ preferences: n });
1939
1951
  }
1940
1952
  /** Words of announcements and labels; the React provider passes the app's translator. */
1941
1953
  setTranslator(e) {
@@ -1947,8 +1959,8 @@ class Bn {
1947
1959
  return e !== "auto" ? e : this.state.family ?? "xbox";
1948
1960
  }
1949
1961
  /** The buttons bound to an intent on a pad of the family (for prompts). */
1950
- gamepadBinding(e, t = this.glyphFamily) {
1951
- return Ee(this.state.preferences, t)[e];
1962
+ gamepadBinding(e, n = this.glyphFamily) {
1963
+ return Ee(this.state.preferences, n)[e];
1952
1964
  }
1953
1965
  /** The keys bound to an intent (for prompts), as written in the preferences. */
1954
1966
  keyboardBinding(e) {
@@ -1962,21 +1974,21 @@ class Bn {
1962
1974
  * screen); returns what cancels the capture.
1963
1975
  */
1964
1976
  captureNextInput(e) {
1965
- const t = (a) => {
1977
+ const n = (a) => {
1966
1978
  this.capture = null, e(a);
1967
1979
  };
1968
- return this.capture = t, () => {
1969
- this.capture === t && (this.capture = null);
1980
+ return this.capture = n, () => {
1981
+ this.capture === n && (this.capture = null);
1970
1982
  };
1971
1983
  }
1972
1984
  update(e) {
1973
- const t = { ...this.state, ...e }, { hints: a } = t.preferences;
1974
- let r = a === "always" ? !0 : a === "never" ? !1 : nt(t.method);
1975
- this.hintsToggled && (r = !r), t.hintsVisible = r, this.state = t, this.listeners.forEach((s) => s());
1985
+ const n = { ...this.state, ...e }, { hints: a } = n.preferences;
1986
+ let r = a === "always" ? !0 : a === "never" ? !1 : at(n.method);
1987
+ this.hintsToggled && (r = !r), n.hintsVisible = r, this.state = n, this.listeners.forEach((s) => s());
1976
1988
  }
1977
- setMethod(e, t) {
1989
+ setMethod(e, n) {
1978
1990
  const a = this.doc.documentElement;
1979
- t && a.getAttribute("data-nice-gamepad") !== t && a.setAttribute("data-nice-gamepad", t), !(e === this.state.method && (t === void 0 || t === this.state.family)) && (a.setAttribute("data-nice-input", e), this.watchRecovery(nt(e)), this.update(t ? { method: e, family: t } : { method: e }));
1991
+ n && a.getAttribute("data-nice-gamepad") !== n && a.setAttribute("data-nice-gamepad", n), !(e === this.state.method && (n === void 0 || n === this.state.family)) && (a.setAttribute("data-nice-input", e), this.watchRecovery(at(e)), this.update(n ? { method: e, family: n } : { method: e }));
1980
1992
  }
1981
1993
  /* ── Gamepad frames (games, device testers) ──────────────────── */
1982
1994
  /** Raw pads every polled frame while a pad is connected. */
@@ -1991,16 +2003,16 @@ class Bn {
1991
2003
  return this.snapshot;
1992
2004
  }
1993
2005
  /** Feedback rumble on the pad used last, when the user allows vibration. */
1994
- vibrate(e, t = 0.5) {
1995
- this.state.preferences.vibration && this.activePad && this.rumble(this.activePad.index, e, t, t);
2006
+ vibrate(e, n = 0.5) {
2007
+ this.state.preferences.vibration && this.activePad && this.rumble(this.activePad.index, e, n, n);
1996
2008
  }
1997
2009
  /** Rumble a given pad regardless of the preference (a game's own effect). */
1998
- rumble(e, t, a = 0.5, r = 0.5) {
2010
+ rumble(e, n, a = 0.5, r = 0.5) {
1999
2011
  var i, c, d;
2000
2012
  const s = (c = (i = this.win.navigator).getGamepads) == null ? void 0 : c.call(i)[e], o = s == null ? void 0 : s.vibrationActuator;
2001
2013
  (d = o == null ? void 0 : o.playEffect) == null || d.call(o, "dual-rumble", {
2002
2014
  startDelay: 0,
2003
- duration: t,
2015
+ duration: n,
2004
2016
  weakMagnitude: a,
2005
2017
  strongMagnitude: r
2006
2018
  });
@@ -2009,8 +2021,8 @@ class Bn {
2009
2021
  /** Puts an overlay on the stack; returns what takes it off. */
2010
2022
  pushOverlay(e) {
2011
2023
  return this.overlays.push(e), () => {
2012
- const t = this.overlays.lastIndexOf(e);
2013
- t >= 0 && this.overlays.splice(t, 1);
2024
+ const n = this.overlays.lastIndexOf(e);
2025
+ n >= 0 && this.overlays.splice(n, 1);
2014
2026
  };
2015
2027
  }
2016
2028
  topOverlay() {
@@ -2018,8 +2030,8 @@ class Bn {
2018
2030
  }
2019
2031
  /** Closes the top overlay that can be closed; returns whether one was. */
2020
2032
  closeTopOverlay(e) {
2021
- for (let t = this.overlays.length - 1; t >= 0; t--) {
2022
- const a = this.overlays[t];
2033
+ for (let n = this.overlays.length - 1; n >= 0; n--) {
2034
+ const a = this.overlays[n];
2023
2035
  if (a.onClose)
2024
2036
  return a.onClose(e), !0;
2025
2037
  if (a.modal)
@@ -2029,26 +2041,26 @@ class Bn {
2029
2041
  }
2030
2042
  /* ── Intents ─────────────────────────────────────────────────── */
2031
2043
  /** Dispatches `nice-intent` on the target; returns whether a handler consumed it. */
2032
- dispatchIntent(e, t = this.focused()) {
2033
- const a = new CustomEvent(xe, {
2044
+ dispatchIntent(e, n = this.focused()) {
2045
+ const a = new CustomEvent(ze, {
2034
2046
  detail: e,
2035
2047
  bubbles: !0,
2036
2048
  cancelable: !0,
2037
2049
  composed: !0
2038
2050
  });
2039
- return t.dispatchEvent(a), a.defaultPrevented;
2051
+ return n.dispatchEvent(a), a.defaultPrevented;
2040
2052
  }
2041
2053
  /** Moves focus in a direction through the scope tree; returns whether it moved. */
2042
- moveFocus(e, t = this.focused()) {
2054
+ moveFocus(e, n = this.focused()) {
2043
2055
  const a = this.navigationRoot();
2044
- if (t === this.doc.body || !a.contains(t))
2056
+ if (n === this.doc.body || !a.contains(n))
2045
2057
  return this.focusInitial(a);
2046
- const r = Pn(t, e, { root: a, memory: this.memory });
2058
+ const r = In(n, e, { root: a, memory: this.memory });
2047
2059
  return r ? (this.focusElement(r), !0) : !1;
2048
2060
  }
2049
2061
  /** The `view` intent: next (`down`) or previous (`up`) region. */
2050
- focusRegion(e, t = this.focused()) {
2051
- const a = Dn(t, e, {
2062
+ focusRegion(e, n = this.focused()) {
2063
+ const a = Dn(n, e, {
2052
2064
  root: this.navigationRoot(),
2053
2065
  memory: this.memory
2054
2066
  });
@@ -2056,37 +2068,37 @@ class Bn {
2056
2068
  }
2057
2069
  /** Focuses the element and brings it into view (scroll-padding respected). */
2058
2070
  focusElement(e) {
2059
- var t;
2060
- e.focus({ preventScroll: !0, focusVisible: !0 }), (t = e.scrollIntoView) == null || t.call(e, { block: "nearest", inline: "nearest" });
2071
+ var n;
2072
+ e.focus({ preventScroll: !0, focusVisible: !0 }), (n = e.scrollIntoView) == null || n.call(e, { block: "nearest", inline: "nearest" });
2061
2073
  }
2062
2074
  /** Engages a control (ADR-005 § 6); popup controls open instead. */
2063
- engage(e, t, a = ve(e)) {
2075
+ engage(e, n, a = ve(e)) {
2064
2076
  if (a) {
2065
2077
  if (a === "popup") {
2066
- this.emulateKey(e, "ArrowDown", t);
2078
+ this.emulateKey(e, "ArrowDown", n);
2067
2079
  return;
2068
2080
  }
2069
- e.setAttribute("data-nice-engaged", ""), ge(e) && this.engagedValues.set(e, e.value), this.fireEngage(e, { engaged: !0, cancelled: !1, source: t }), this.announce(this.translate("input.engaged", "Editing"));
2081
+ e.setAttribute("data-nice-engaged", ""), ge(e) && this.engagedValues.set(e, e.value), this.fireEngage(e, { engaged: !0, cancelled: !1, source: n }), this.announce(this.translate("input.engaged", "Editing"));
2070
2082
  }
2071
2083
  }
2072
2084
  /**
2073
2085
  * Releases an engaged control; `cancelled` when left with `back`. A native number field gets
2074
2086
  * its value from before back; custom controls do that in `useEngage`'s `onRelease`.
2075
2087
  */
2076
- release(e, t, a) {
2088
+ release(e, n, a) {
2077
2089
  if (!e.hasAttribute("data-nice-engaged"))
2078
2090
  return;
2079
2091
  e.removeAttribute("data-nice-engaged");
2080
2092
  const r = this.engagedValues.get(e);
2081
- this.engagedValues.delete(e), a && r !== void 0 && ge(e) && Yt(e, r), this.fireEngage(e, { engaged: !1, cancelled: a, source: t }), this.announce(this.translate("input.released", "Done editing"));
2093
+ this.engagedValues.delete(e), a && r !== void 0 && ge(e) && Wt(e, r), this.fireEngage(e, { engaged: !1, cancelled: a, source: n }), this.announce(this.translate("input.released", "Done editing"));
2082
2094
  }
2083
2095
  /** Defaults of trusted keys: the browser already clicks, types and scrolls. */
2084
- keyDefault(e, t) {
2096
+ keyDefault(e, n) {
2085
2097
  switch (e.intent) {
2086
2098
  case "navigate":
2087
- return this.arrowPolicy(t, e.source) === "spatial" ? this.moveFocus(e.direction ?? "down", t) : !1;
2099
+ return this.arrowPolicy(n, e.source) === "spatial" ? this.moveFocus(e.direction ?? "down", n) : !1;
2088
2100
  case "view":
2089
- return this.focusRegion(e.direction ?? "down", t);
2101
+ return this.focusRegion(e.direction ?? "down", n);
2090
2102
  case "back":
2091
2103
  return this.closeTopOverlay(e.source);
2092
2104
  case "toggleHints":
@@ -2095,65 +2107,65 @@ class Bn {
2095
2107
  return !1;
2096
2108
  }
2097
2109
  }
2098
- arrowPolicy(e, t) {
2099
- if (t !== "keyboard")
2110
+ arrowPolicy(e, n) {
2111
+ if (n !== "keyboard")
2100
2112
  return "spatial";
2101
2113
  const a = this.state.preferences.arrowNavigation;
2102
- return a !== "auto" ? a : zn(e) ?? "native";
2114
+ return a !== "auto" ? a : An(e) ?? "native";
2103
2115
  }
2104
2116
  /* ── Gamepad ─────────────────────────────────────────────────── */
2105
2117
  padMap(e) {
2106
- let t = this.padMaps.get(e);
2107
- return t || (t = En(Ee(this.state.preferences, e)), this.padMaps.set(e, t)), t;
2118
+ let n = this.padMaps.get(e);
2119
+ return n || (n = kn(Ee(this.state.preferences, e)), this.padMaps.set(e, n)), n;
2108
2120
  }
2109
2121
  /** A pad intent: the intent event, then engage rules, key emulation and the default action. */
2110
2122
  deviceIntent(e) {
2111
- const t = this.focused();
2112
- if (this.dispatchIntent(e, t))
2123
+ const n = this.focused();
2124
+ if (this.dispatchIntent(e, n))
2113
2125
  return;
2114
- const a = t === this.doc.body ? null : ve(t), r = a !== null && Et(t, a), s = t, o = e.source;
2126
+ const a = n === this.doc.body ? null : ve(n), r = a !== null && kt(n, a), s = n, o = e.source;
2115
2127
  switch (e.intent) {
2116
2128
  case "navigate": {
2117
2129
  const i = e.direction ?? "down";
2118
- a && !r ? this.moveFocus(i, t) : r && ie(t) ? ce(t, i) : r && a === "text" ? Wt(t, i) : this.emulateKey(t, Fn[i], o) || this.moveFocus(i, t);
2130
+ a && !r ? this.moveFocus(i, n) : r && ie(n) ? ce(n, i) : r && a === "text" ? Xt(n, i) : this.emulateKey(n, _n[i], o) || this.moveFocus(i, n);
2119
2131
  return;
2120
2132
  }
2121
2133
  case "activate":
2122
- a && !r ? this.engage(s, o, a) : r && a === "popup" ? this.emulateKey(t, "Enter", o) : r && (a === "value" || a === "canvas") ? this.release(s, o, !1) : r || (yt(t) ? qt(t) : this.emulateKey(t, "Enter", o));
2134
+ a && !r ? this.engage(s, o, a) : r && a === "popup" ? this.emulateKey(n, "Enter", o) : r && (a === "value" || a === "canvas") ? this.release(s, o, !1) : r || (wt(n) ? $t(n) : this.emulateKey(n, "Enter", o));
2123
2135
  return;
2124
2136
  case "back":
2125
- r && a === "popup" ? this.emulateKey(t, "Escape", o) : r ? this.release(s, o, !0) : this.emulateKey(t, "Escape", o) || this.closeTopOverlay(o);
2137
+ r && a === "popup" ? this.emulateKey(n, "Escape", o) : r ? this.release(s, o, !0) : this.emulateKey(n, "Escape", o) || this.closeTopOverlay(o);
2126
2138
  return;
2127
2139
  case "sectionPrev":
2128
2140
  case "sectionNext":
2129
2141
  if (r && a === "value") {
2130
2142
  const i = e.intent === "sectionNext";
2131
- ie(t) ? ce(t, i ? "up" : "down", "big") : this.emulateKey(t, i ? "PageUp" : "PageDown", o);
2143
+ ie(n) ? ce(n, i ? "up" : "down", "big") : this.emulateKey(n, i ? "PageUp" : "PageDown", o);
2132
2144
  }
2133
2145
  return;
2134
2146
  case "pagePrev":
2135
2147
  case "pageNext": {
2136
2148
  const i = e.intent === "pageNext";
2137
2149
  if (r && a === "value")
2138
- ie(t) ? ce(t, i ? "up" : "down", "edge") : this.emulateKey(t, i ? "End" : "Home", o);
2139
- else if (!this.emulateKey(t, i ? "PageDown" : "PageUp", o)) {
2140
- const c = rt(t, 0, i ? 1 : -1);
2141
- at(c, 0, (i ? 1 : -1) * ((c == null ? void 0 : c.clientHeight) ?? 0) * 0.9);
2150
+ ie(n) ? ce(n, i ? "up" : "down", "edge") : this.emulateKey(n, i ? "End" : "Home", o);
2151
+ else if (!this.emulateKey(n, i ? "PageDown" : "PageUp", o)) {
2152
+ const c = st(n, 0, i ? 1 : -1);
2153
+ rt(c, 0, (i ? 1 : -1) * ((c == null ? void 0 : c.clientHeight) ?? 0) * 0.9);
2142
2154
  }
2143
2155
  return;
2144
2156
  }
2145
2157
  case "first":
2146
2158
  case "last":
2147
- this.emulateKey(t, e.intent === "first" ? "Home" : "End", o);
2159
+ this.emulateKey(n, e.intent === "first" ? "Home" : "End", o);
2148
2160
  return;
2149
2161
  case "secondary":
2150
- this.contextMenu(t);
2162
+ this.contextMenu(n);
2151
2163
  return;
2152
2164
  case "menu":
2153
- r && a === "text" && (this.release(s, o, !1), this.emulateKey(t, "Enter", o));
2165
+ r && a === "text" && (this.release(s, o, !1), this.emulateKey(n, "Enter", o));
2154
2166
  return;
2155
2167
  case "view":
2156
- this.focusRegion(e.direction ?? "down", t);
2168
+ this.focusRegion(e.direction ?? "down", n);
2157
2169
  return;
2158
2170
  case "toggleHints":
2159
2171
  this.toggleHints();
@@ -2163,29 +2175,29 @@ class Bn {
2163
2175
  }
2164
2176
  }
2165
2177
  /** A synthetic key on the element; returns whether a handler consumed it. */
2166
- emulateKey(e, t, a) {
2178
+ emulateKey(e, n, a) {
2167
2179
  const r = (o) => {
2168
2180
  const i = new KeyboardEvent(o, {
2169
- key: t,
2170
- code: t,
2181
+ key: n,
2182
+ code: n,
2171
2183
  bubbles: !0,
2172
2184
  cancelable: !0,
2173
2185
  composed: !0
2174
2186
  });
2175
- return Object.defineProperty(i, "niceSource", { value: a }), Object.defineProperty(i, "keyCode", { value: Qe[t] ?? 0 }), Object.defineProperty(i, "which", { value: Qe[t] ?? 0 }), i;
2187
+ return Object.defineProperty(i, "niceSource", { value: a }), Object.defineProperty(i, "keyCode", { value: et[n] ?? 0 }), Object.defineProperty(i, "which", { value: et[n] ?? 0 }), i;
2176
2188
  }, s = r("keydown");
2177
2189
  return e.dispatchEvent(s), e.dispatchEvent(r("keyup")), s.defaultPrevented;
2178
2190
  }
2179
2191
  /** `secondary` on a pad: the context menu of the element, as a right click would open it. */
2180
2192
  contextMenu(e) {
2181
- const t = e.getBoundingClientRect();
2193
+ const n = e.getBoundingClientRect();
2182
2194
  e.dispatchEvent(
2183
2195
  new MouseEvent("contextmenu", {
2184
2196
  bubbles: !0,
2185
2197
  cancelable: !0,
2186
2198
  button: 2,
2187
- clientX: t.left + t.width / 2,
2188
- clientY: t.top + t.height / 2
2199
+ clientX: n.left + n.width / 2,
2200
+ clientY: n.top + n.height / 2
2189
2201
  })
2190
2202
  );
2191
2203
  }
@@ -2199,8 +2211,8 @@ class Bn {
2199
2211
  }
2200
2212
  targetOf(e) {
2201
2213
  var a;
2202
- const t = (a = e.composedPath) == null ? void 0 : a.call(e)[0];
2203
- return t instanceof Element ? t : e.target instanceof Element ? e.target : this.focused();
2214
+ const n = (a = e.composedPath) == null ? void 0 : a.call(e)[0];
2215
+ return n instanceof Element ? n : e.target instanceof Element ? e.target : this.focused();
2204
2216
  }
2205
2217
  /** Moves stay inside the top modal overlay. */
2206
2218
  navigationRoot() {
@@ -2211,100 +2223,100 @@ class Bn {
2211
2223
  }
2212
2224
  /** Nothing focused yet: the remembered element, else the first one of the main region. */
2213
2225
  focusInitial(e) {
2214
- const t = this.memory.get(e), a = e.querySelector('main,[role="main"]'), r = (t && t.isConnected && e.contains(t) && te(t) ? t : null) ?? (a ? U(a)[0] : void 0) ?? U(e)[0];
2226
+ const n = this.memory.get(e), a = e.querySelector('main,[role="main"]'), r = (n && n.isConnected && e.contains(n) && te(n) ? n : null) ?? (a ? U(a)[0] : void 0) ?? U(e)[0];
2215
2227
  return r ? (this.focusElement(r), !0) : !1;
2216
2228
  }
2217
- fireEngage(e, t) {
2218
- e.dispatchEvent(new CustomEvent(ne, { detail: t, bubbles: !0 }));
2229
+ fireEngage(e, n) {
2230
+ e.dispatchEvent(new CustomEvent(ne, { detail: n, bubbles: !0 }));
2219
2231
  }
2220
2232
  /** Polite announcement through the engine's own live region. */
2221
2233
  announce(e) {
2222
2234
  if (!this.live || !this.live.isConnected) {
2223
- const t = this.doc.createElement("div");
2224
- t.setAttribute("role", "status"), t.setAttribute("aria-live", "polite"), t.setAttribute("data-nice-input-live", ""), t.style.cssText = "position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0", this.doc.body.appendChild(t), this.live = t;
2235
+ const n = this.doc.createElement("div");
2236
+ n.setAttribute("role", "status"), n.setAttribute("aria-live", "polite"), n.setAttribute("data-nice-input-live", ""), n.style.cssText = "position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0", this.doc.body.appendChild(n), this.live = n;
2225
2237
  }
2226
2238
  this.live.textContent = e;
2227
2239
  }
2228
2240
  }
2229
- function at(n, e, t) {
2230
- n && (typeof n.scrollBy == "function" ? n.scrollBy({ left: e, top: t }) : (n.scrollLeft += e, n.scrollTop += t));
2241
+ function rt(t, e, n) {
2242
+ t && (typeof t.scrollBy == "function" ? t.scrollBy({ left: e, top: n }) : (t.scrollLeft += e, t.scrollTop += n));
2231
2243
  }
2232
- function rt(n, e, t) {
2233
- const a = n.ownerDocument, r = a.defaultView;
2234
- for (let s = n; s && s !== a.body; s = s.parentElement) {
2244
+ function st(t, e, n) {
2245
+ const a = t.ownerDocument, r = a.defaultView;
2246
+ for (let s = t; s && s !== a.body; s = s.parentElement) {
2235
2247
  if (!(s instanceof HTMLElement) || !r)
2236
2248
  continue;
2237
2249
  const o = r.getComputedStyle(s), i = /(auto|scroll)/.test(o.overflowY) && s.scrollHeight > s.clientHeight, c = /(auto|scroll)/.test(o.overflowX) && s.scrollWidth > s.clientWidth;
2238
- if (t !== 0 && i || e !== 0 && c)
2250
+ if (n !== 0 && i || e !== 0 && c)
2239
2251
  return s;
2240
2252
  }
2241
2253
  return a.scrollingElement ?? a.documentElement;
2242
2254
  }
2243
- const st = /* @__PURE__ */ new WeakMap();
2244
- function Kn(n = window, e = !0) {
2245
- let t = st.get(n);
2246
- return t || (t = new Bn(n), st.set(n, t)), e && t.start(), t;
2255
+ const ot = /* @__PURE__ */ new WeakMap();
2256
+ function jn(t = window, e = !0) {
2257
+ let n = ot.get(t);
2258
+ return n || (n = new Kn(t), ot.set(t, n)), e && n.start(), n;
2247
2259
  }
2248
- const ot = {
2260
+ const it = {
2249
2261
  method: "pointer",
2250
2262
  family: null,
2251
2263
  pads: [],
2252
2264
  preferences: Y,
2253
2265
  hintsVisible: !1
2254
- }, jn = () => {
2255
- }, It = /* @__PURE__ */ Ne(null);
2266
+ }, Un = () => {
2267
+ }, Ot = /* @__PURE__ */ He(null);
2256
2268
  function K() {
2257
- const [n] = j(
2258
- () => typeof window > "u" ? null : Kn(window, !1)
2269
+ const [t] = j(
2270
+ () => typeof window > "u" ? null : jn(window, !1)
2259
2271
  );
2260
2272
  return R(() => {
2261
- n == null || n.start();
2262
- }, [n]), n;
2273
+ t == null || t.start();
2274
+ }, [t]), t;
2263
2275
  }
2264
- function Z(n) {
2265
- const e = K(), t = I(
2266
- (a) => e ? (e.start(), e.subscribe(a)) : jn,
2276
+ function Z(t) {
2277
+ const e = K(), n = D(
2278
+ (a) => e ? (e.start(), e.subscribe(a)) : Un,
2267
2279
  [e]
2268
2280
  );
2269
- return mt(
2270
- t,
2271
- () => n(e ? e.getState() : ot),
2272
- () => n(ot)
2281
+ return Mt(
2282
+ n,
2283
+ () => t(e ? e.getState() : it),
2284
+ () => t(it)
2273
2285
  );
2274
2286
  }
2275
- function Ot() {
2276
- return Z((n) => n);
2277
- }
2278
- function Ba() {
2279
- return Z((n) => n.method);
2287
+ function Rt() {
2288
+ return Z((t) => t);
2280
2289
  }
2281
2290
  function Ka() {
2282
- return Z((n) => n.family);
2291
+ return Z((t) => t.method);
2283
2292
  }
2284
2293
  function ja() {
2285
- return Z((n) => n.pads);
2294
+ return Z((t) => t.family);
2286
2295
  }
2287
- function Un() {
2288
- return Z((n) => n.hintsVisible);
2296
+ function Ua() {
2297
+ return Z((t) => t.pads);
2289
2298
  }
2290
2299
  function Gn() {
2291
- const n = Z((r) => r.preferences), e = ae(It), t = K(), a = I(
2300
+ return Z((t) => t.hintsVisible);
2301
+ }
2302
+ function qn() {
2303
+ const t = Z((r) => r.preferences), e = ae(Ot), n = K(), a = D(
2292
2304
  (r) => {
2293
- e ? e.setPreferences(r) : t == null || t.setPreferences(r);
2305
+ e ? e.setPreferences(r) : n == null || n.setPreferences(r);
2294
2306
  },
2295
- [e, t]
2307
+ [e, n]
2296
2308
  );
2297
- return [n, a];
2309
+ return [t, a];
2298
2310
  }
2299
- function Ua({
2300
- preferences: n,
2311
+ function Ga({
2312
+ preferences: t,
2301
2313
  defaultPreferences: e,
2302
- onPreferencesChange: t,
2314
+ onPreferencesChange: n,
2303
2315
  persist: a = !0,
2304
2316
  children: r
2305
2317
  }) {
2306
- const s = K(), { t: o } = J(), i = rn(), c = a ? i == null ? void 0 : i.preferences.global.input : void 0, [d, u] = j({}), h = JSON.stringify([e, c, d, n]), l = pe(
2307
- () => ({ ...Y, ...e, ...c, ...d, ...n }),
2318
+ const s = K(), { t: o } = J(), i = sn(), c = a ? i == null ? void 0 : i.preferences.global.input : void 0, [d, u] = j({}), h = JSON.stringify([e, c, d, t]), l = pe(
2319
+ () => ({ ...Y, ...e, ...c, ...d, ...t }),
2308
2320
  // eslint-disable-next-line react-hooks/exhaustive-deps -- keyed by content: callers pass inline objects
2309
2321
  [h]
2310
2322
  );
@@ -2313,83 +2325,83 @@ function Ua({
2313
2325
  }, [s, l]), R(() => () => s == null ? void 0 : s.setPreferences(Y), [s]), R(() => {
2314
2326
  s == null || s.setTranslator(o);
2315
2327
  }, [s, o]);
2316
- const p = I(
2328
+ const p = D(
2317
2329
  (k) => {
2318
- const x = { ...d, ...k };
2319
- u(x), a && i && i.setGlobalPreferences("input", { ...i.preferences.global.input, ...k }), t == null || t({ ...l, ...k });
2330
+ const z = { ...d, ...k };
2331
+ u(z), a && i && i.setGlobalPreferences("input", { ...i.preferences.global.input, ...k }), n == null || n({ ...l, ...k });
2320
2332
  },
2321
- [d, a, i, t, l]
2333
+ [d, a, i, n, l]
2322
2334
  ), w = pe(() => ({ setPreferences: p }), [p]);
2323
- return /* @__PURE__ */ N(It.Provider, { value: w, children: r });
2335
+ return /* @__PURE__ */ C(Ot.Provider, { value: w, children: r });
2324
2336
  }
2325
- function it(n, e) {
2326
- return e === "none" ? null : e && typeof e == "object" ? e.current ?? n : typeof e == "string" && e !== "first" && e !== "container" ? n.querySelector(e) ?? n : e === "container" ? n : n.querySelector("[autofocus],[data-autofocus]") ?? U(n)[0] ?? n;
2337
+ function ct(t, e) {
2338
+ return e === "none" ? null : e && typeof e == "object" ? e.current ?? t : typeof e == "string" && e !== "first" && e !== "container" ? t.querySelector(e) ?? t : e === "container" ? t : t.querySelector("[autofocus],[data-autofocus]") ?? U(t)[0] ?? t;
2327
2339
  }
2328
- const qn = '[role="listbox"],[role="menu"],[role="dialog"],[role="alertdialog"],[role="grid"],[role="tree"],[data-nice-popup]', ct = /* @__PURE__ */ new WeakMap();
2329
- function lt(n) {
2330
- let e = ct.get(n);
2340
+ const $n = '[role="listbox"],[role="menu"],[role="dialog"],[role="alertdialog"],[role="grid"],[role="tree"],[data-nice-popup]', lt = /* @__PURE__ */ new WeakMap();
2341
+ function ut(t) {
2342
+ let e = lt.get(t);
2331
2343
  if (!e) {
2332
- const t = { current: n.activeElement, previous: null };
2333
- n.addEventListener(
2344
+ const n = { current: t.activeElement, previous: null };
2345
+ t.addEventListener(
2334
2346
  "focusin",
2335
2347
  (a) => {
2336
- a.target !== t.current && (t.previous = t.current, t.current = a.target);
2348
+ a.target !== n.current && (n.previous = n.current, n.current = a.target);
2337
2349
  },
2338
2350
  !0
2339
- ), ct.set(n, t), e = t;
2351
+ ), lt.set(t, n), e = n;
2340
2352
  }
2341
2353
  return e;
2342
2354
  }
2343
- function ut(n) {
2344
- var t;
2345
- let e = n;
2346
- for (; e.parentNode && e.parentNode !== ((t = e.ownerDocument) == null ? void 0 : t.body); )
2355
+ function dt(t) {
2356
+ var n;
2357
+ let e = t;
2358
+ for (; e.parentNode && e.parentNode !== ((n = e.ownerDocument) == null ? void 0 : n.body); )
2347
2359
  e = e.parentNode;
2348
2360
  return e;
2349
2361
  }
2350
- function $n(n, e) {
2351
- return n.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_FOLLOWING ? ut(e) !== ut(n) || e instanceof Element && e.closest(qn) !== null : !1;
2362
+ function Yn(t, e) {
2363
+ return t.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_FOLLOWING ? dt(e) !== dt(t) || e instanceof Element && e.closest($n) !== null : !1;
2352
2364
  }
2353
- function dt(n) {
2354
- !n.hasAttribute("tabindex") && n.tabIndex < 0 && n.setAttribute("tabindex", "-1"), n.focus({ preventScroll: !0 });
2365
+ function ht(t) {
2366
+ !t.hasAttribute("tabindex") && t.tabIndex < 0 && t.setAttribute("tabindex", "-1"), t.focus({ preventScroll: !0 });
2355
2367
  }
2356
- function Yn(n, e) {
2357
- const { open: t, modal: a = !0, restoreFocus: r = !0, closeHint: s } = e, o = O(e);
2368
+ function Wn(t, e) {
2369
+ const { open: n, modal: a = !0, restoreFocus: r = !0, closeHint: s } = e, o = O(e);
2358
2370
  o.current = e;
2359
2371
  const i = K(), { t: c } = J();
2360
2372
  R(() => {
2361
- typeof document < "u" && lt(document);
2373
+ typeof document < "u" && ut(document);
2362
2374
  }, []);
2363
2375
  const d = !!e.onClose && e.closeOnEscape !== !1;
2364
- At(
2365
- n,
2366
- t && d && s !== !1 ? [{ intent: "back", label: s ?? c("input.hint.close", "Close") }] : [],
2376
+ Lt(
2377
+ t,
2378
+ n && d && s !== !1 ? [{ intent: "back", label: s ?? c("input.hint.close", "Close") }] : [],
2367
2379
  { fallback: !0 }
2368
2380
  ), B(
2369
- n,
2381
+ t,
2370
2382
  (u) => {
2371
- if (!t || !i)
2383
+ if (!n || !i)
2372
2384
  return;
2373
- const h = u.ownerDocument, l = h.activeElement, p = lt(h), w = (E) => E instanceof HTMLElement && E !== h.body && !u.contains(E);
2385
+ const h = u.ownerDocument, l = h.activeElement, p = ut(h), w = (E) => E instanceof HTMLElement && E !== h.body && !u.contains(E);
2374
2386
  let k = null;
2375
2387
  w(l) ? k = l : l && u.contains(l) ? k = w(p.previous) ? p.previous : null : w(p.current) && (k = p.current);
2376
- const x = (E) => {
2388
+ const z = (E) => {
2377
2389
  const { onClose: g, closeOnEscape: v } = o.current;
2378
2390
  g && v !== !1 && g(E);
2379
- }, C = {
2391
+ }, N = {
2380
2392
  element: u,
2381
2393
  modal: a,
2382
- onClose: o.current.onClose && o.current.closeOnEscape !== !1 ? x : void 0
2383
- }, S = i.pushOverlay(C), m = ["data-nice-focus-scope", "data-nice-scope-trap"], A = m.map((E) => u.getAttribute(E));
2394
+ onClose: o.current.onClose && o.current.closeOnEscape !== !1 ? z : void 0
2395
+ }, L = i.pushOverlay(N), m = ["data-nice-focus-scope", "data-nice-scope-trap"], A = m.map((E) => u.getAttribute(E));
2384
2396
  if (u.setAttribute("data-nice-focus-scope", "spatial"), a && u.setAttribute("data-nice-scope-trap", ""), !u.contains(h.activeElement)) {
2385
- const E = it(u, o.current.initialFocus);
2386
- E && dt(E);
2397
+ const E = ct(u, o.current.initialFocus);
2398
+ E && ht(E);
2387
2399
  }
2388
2400
  const y = (E) => {
2389
2401
  if (E.defaultPrevented)
2390
2402
  return;
2391
2403
  if (E.key === "Escape" || E.key === "Esc") {
2392
- i.topOverlay() === C && C.onClose && (E.preventDefault(), C.onClose(E.niceSource ?? "keyboard"));
2404
+ i.topOverlay() === N && N.onClose && (E.preventDefault(), N.onClose(E.niceSource ?? "keyboard"));
2393
2405
  return;
2394
2406
  }
2395
2407
  if (E.key !== "Tab" || !a)
@@ -2403,24 +2415,24 @@ function Yn(n, e) {
2403
2415
  E.shiftKey && (f === v || f === u) ? (E.preventDefault(), M.focus()) : !E.shiftKey && f === M && (E.preventDefault(), v.focus());
2404
2416
  };
2405
2417
  u.addEventListener("keydown", y);
2406
- let L = u.contains(h.activeElement);
2418
+ let S = u.contains(h.activeElement);
2407
2419
  const T = (E) => {
2408
2420
  const g = E.target;
2409
- L = !!g && u.contains(g), !(!a || !g || u.contains(g) || i.topOverlay() !== C) && ($n(u, g) || dt(it(u, o.current.initialFocus) ?? u));
2421
+ S = !!g && u.contains(g), !(!a || !g || u.contains(g) || i.topOverlay() !== N) && (Yn(u, g) || ht(ct(u, o.current.initialFocus) ?? u));
2410
2422
  };
2411
2423
  return h.addEventListener("focusin", T), () => {
2412
- u.removeEventListener("keydown", y), h.removeEventListener("focusin", T), S(), m.forEach((v, M) => {
2424
+ u.removeEventListener("keydown", y), h.removeEventListener("focusin", T), L(), m.forEach((v, M) => {
2413
2425
  const f = A[M];
2414
2426
  f === null ? u.removeAttribute(v) : u.setAttribute(v, f);
2415
2427
  });
2416
- const E = h.activeElement, g = u.contains(E) || (!E || E === h.body) && L;
2428
+ const E = h.activeElement, g = u.contains(E) || (!E || E === h.body) && S;
2417
2429
  r && k && k.isConnected && g && k.focus({ preventScroll: !0 });
2418
2430
  };
2419
2431
  },
2420
- [t, a, r, i]
2432
+ [n, a, r, i]
2421
2433
  );
2422
2434
  }
2423
- const Wn = {
2435
+ const Xn = {
2424
2436
  Enter: ["Enter", "input.key.enter"],
2425
2437
  Escape: ["Esc", "input.key.escape"],
2426
2438
  Space: ["Space", "input.key.space"],
@@ -2435,16 +2447,16 @@ const Wn = {
2435
2447
  Ctrl: ["Ctrl", "input.key.ctrl"],
2436
2448
  Alt: ["Alt", "input.key.alt"],
2437
2449
  Shift: ["Shift", "input.key.shift"]
2438
- }, Xn = {
2450
+ }, Jn = {
2439
2451
  ArrowUp: ["arrow-up", "Up arrow", "input.key.arrowUp"],
2440
2452
  ArrowDown: ["arrow-down", "Down arrow", "input.key.arrowDown"],
2441
2453
  ArrowLeft: ["arrow-left", "Left arrow", "input.key.arrowLeft"],
2442
2454
  ArrowRight: ["arrow-right", "Right arrow", "input.key.arrowRight"]
2443
- }, Jn = {
2455
+ }, Zn = {
2444
2456
  Ctrl: ["key-command", "Command", "input.key.command"],
2445
2457
  Alt: ["key-option", "Option", "input.key.option"],
2446
2458
  Shift: ["key-shift", "Shift", "input.key.shift"]
2447
- }, Rt = {
2459
+ }, Vt = {
2448
2460
  Cmd: "Ctrl",
2449
2461
  Meta: "Ctrl",
2450
2462
  Mod: "Ctrl",
@@ -2453,77 +2465,77 @@ const Wn = {
2453
2465
  Esc: "Escape",
2454
2466
  " ": "Space"
2455
2467
  };
2456
- function Zn() {
2457
- var t;
2468
+ function Qn() {
2469
+ var n;
2458
2470
  if (typeof navigator > "u")
2459
2471
  return !1;
2460
- const n = navigator, e = ((t = n.userAgentData) == null ? void 0 : t.platform) || n.platform || n.userAgent;
2472
+ const t = navigator, e = ((n = t.userAgentData) == null ? void 0 : n.platform) || t.platform || t.userAgent;
2461
2473
  return /mac|iphone|ipad|ipod/i.test(e);
2462
2474
  }
2463
- function ze(n) {
2464
- return (n.endsWith("++") ? [...n.slice(0, -2).split("+"), "+"] : n.split("+")).filter(Boolean).map((t) => Rt[t] ?? t);
2475
+ function xe(t) {
2476
+ return (t.endsWith("++") ? [...t.slice(0, -2).split("+"), "+"] : t.split("+")).filter(Boolean).map((n) => Vt[n] ?? n);
2465
2477
  }
2466
- function Ga(n) {
2478
+ function qa(t) {
2467
2479
  return [
2468
- n.primary ? "Ctrl" : "",
2469
- n.alt ? "Alt" : "",
2470
- n.shift ? "Shift" : "",
2471
- n.key
2480
+ t.primary ? "Ctrl" : "",
2481
+ t.alt ? "Alt" : "",
2482
+ t.shift ? "Shift" : "",
2483
+ t.key
2472
2484
  ].filter(Boolean).join("+");
2473
2485
  }
2474
- function ht(n, e) {
2475
- const t = Rt[n] ?? n, a = (e ? Jn[t] : void 0) ?? Xn[t];
2486
+ function ft(t, e) {
2487
+ const n = Vt[t] ?? t, a = (e ? Zn[n] : void 0) ?? Jn[n];
2476
2488
  if (a)
2477
2489
  return { icon: a[0], spoken: a[1], spokenKey: a[2] };
2478
- const r = Wn[t];
2490
+ const r = Xn[n];
2479
2491
  if (r)
2480
2492
  return { text: r[0], textKey: r[1], spoken: r[0], spokenKey: r[1] };
2481
- const s = t.length === 1 ? t.toUpperCase() : t;
2493
+ const s = n.length === 1 ? n.toUpperCase() : n;
2482
2494
  return { text: s, spoken: s };
2483
2495
  }
2484
- const Qn = { sm: 12, md: 14, lg: 18 }, ea = /* @__PURE__ */ Object.assign(
2496
+ const ea = { sm: 12, md: 14, lg: 18 }, ta = /* @__PURE__ */ Object.assign(
2485
2497
  function({
2486
2498
  keys: e,
2487
- size: t = "md",
2499
+ size: n = "md",
2488
2500
  platform: a = "auto",
2489
2501
  className: r,
2490
2502
  style: s
2491
2503
  }) {
2492
- const { t: o } = J(), i = a === "mac" || a === "auto" && Zn(), c = e.split(" ").filter(Boolean), d = c.map(
2493
- (u) => ze(u).map((h) => {
2494
- const l = ht(h, i);
2504
+ const { t: o } = J(), i = a === "mac" || a === "auto" && Qn(), c = e.split(" ").filter(Boolean), d = c.map(
2505
+ (u) => xe(u).map((h) => {
2506
+ const l = ft(h, i);
2495
2507
  return l.spokenKey ? o(l.spokenKey, l.spoken) : l.spoken;
2496
2508
  }).join(" + ")
2497
2509
  ).join(", ");
2498
- return /* @__PURE__ */ N(
2510
+ return /* @__PURE__ */ C(
2499
2511
  "kbd",
2500
2512
  {
2501
- className: `nice-keycap nice-keycap--${t}${r ? ` ${r}` : ""}`,
2513
+ className: `nice-keycap nice-keycap--${n}${r ? ` ${r}` : ""}`,
2502
2514
  style: s,
2503
2515
  role: "img",
2504
2516
  "aria-label": d,
2505
- children: c.map((u, h) => /* @__PURE__ */ N("span", { className: "nice-keycap__chord", "aria-hidden": "true", children: ze(u).map((l, p) => {
2506
- const w = ht(l, i);
2507
- return /* @__PURE__ */ V(He.Fragment, { children: [
2508
- p > 0 && !i && /* @__PURE__ */ N("span", { className: "nice-keycap__plus", children: "+" }),
2509
- /* @__PURE__ */ N("span", { className: "nice-keycap__key", children: w.icon ? /* @__PURE__ */ N(ee, { name: w.icon, size: Qn[t] }) : w.textKey ? o(w.textKey, w.text ?? "") : w.text })
2517
+ children: c.map((u, h) => /* @__PURE__ */ C("span", { className: "nice-keycap__chord", "aria-hidden": "true", children: xe(u).map((l, p) => {
2518
+ const w = ft(l, i);
2519
+ return /* @__PURE__ */ V(Ne.Fragment, { children: [
2520
+ p > 0 && !i && /* @__PURE__ */ C("span", { className: "nice-keycap__plus", children: "+" }),
2521
+ /* @__PURE__ */ C("span", { className: "nice-keycap__key", children: w.icon ? /* @__PURE__ */ C(ee, { name: w.icon, size: ea[n] }) : w.textKey ? o(w.textKey, w.text ?? "") : w.text })
2510
2522
  ] }, p);
2511
2523
  }) }, h))
2512
2524
  }
2513
2525
  );
2514
2526
  },
2515
2527
  { displayName: "NiceKeyCap" }
2516
- ), he = { sm: 16, md: 20, lg: 28 }, ta = {
2528
+ ), he = { sm: 16, md: 20, lg: 28 }, na = {
2517
2529
  up: "ArrowUp",
2518
2530
  down: "ArrowDown",
2519
2531
  left: "ArrowLeft",
2520
2532
  right: "ArrowRight"
2521
- }, na = {
2533
+ }, aa = {
2522
2534
  up: "dpadUp",
2523
2535
  down: "dpadDown",
2524
2536
  left: "dpadLeft",
2525
2537
  right: "dpadRight"
2526
- }, aa = /* @__PURE__ */ new Set([
2538
+ }, ra = /* @__PURE__ */ new Set([
2527
2539
  "south",
2528
2540
  "east",
2529
2541
  "west",
@@ -2534,14 +2546,14 @@ const Qn = { sm: 12, md: 14, lg: 18 }, ea = /* @__PURE__ */ Object.assign(
2534
2546
  "dpadRight",
2535
2547
  "leftStick",
2536
2548
  "rightStick"
2537
- ]), ft = {
2549
+ ]), pt = {
2538
2550
  activate: ["remote-ok", "OK", "input.remote.ok"],
2539
2551
  back: ["remote-back", "Back", "input.intent.back"],
2540
2552
  menu: ["remote-menu", "Menu", "input.intent.menu"]
2541
- }, Vt = /* @__PURE__ */ Object.assign(
2553
+ }, Ft = /* @__PURE__ */ Object.assign(
2542
2554
  function({
2543
2555
  intent: e,
2544
- direction: t,
2556
+ direction: n,
2545
2557
  button: a,
2546
2558
  keys: r,
2547
2559
  label: s,
@@ -2551,42 +2563,42 @@ const Qn = { sm: 12, md: 14, lg: 18 }, ea = /* @__PURE__ */ Object.assign(
2551
2563
  className: d,
2552
2564
  style: u
2553
2565
  }) {
2554
- const { t: h } = J(), l = Ot(), p = o !== "auto" ? o : l.method === "gamepad" || l.method === "remote" ? l.method : "keyboard", w = l.preferences.glyphFamily, k = i ?? (w !== "auto" ? w : l.family ?? "xbox"), x = `nice-button-prompt nice-button-prompt--${c}${d ? ` ${d}` : ""}`, C = s !== void 0 && /* @__PURE__ */ N("span", { className: "nice-button-prompt__label", children: s });
2555
- let S = null;
2556
- if (p === "remote" && e && ft[e]) {
2557
- const [m, A, y] = ft[e];
2558
- S = /* @__PURE__ */ N("span", { className: "nice-button-prompt__glyph", role: "img", "aria-label": h(y, A), children: /* @__PURE__ */ N(ee, { name: m, size: he[c] }) });
2566
+ const { t: h } = J(), l = Rt(), p = o !== "auto" ? o : l.method === "gamepad" || l.method === "remote" ? l.method : "keyboard", w = l.preferences.glyphFamily, k = i ?? (w !== "auto" ? w : l.family ?? "xbox"), z = `nice-button-prompt nice-button-prompt--${c}${d ? ` ${d}` : ""}`, N = s !== void 0 && /* @__PURE__ */ C("span", { className: "nice-button-prompt__label", children: s });
2567
+ let L = null;
2568
+ if (p === "remote" && e && pt[e]) {
2569
+ const [m, A, y] = pt[e];
2570
+ L = /* @__PURE__ */ C("span", { className: "nice-button-prompt__glyph", role: "img", "aria-label": h(y, A), children: /* @__PURE__ */ C(ee, { name: m, size: he[c] }) });
2559
2571
  } else if (p === "gamepad" || p === "remote") {
2560
- let m = a ? ln(a) : null;
2561
- if (!m && e === "navigate" ? m = t ? na[t] : null : !m && e && (m = Ee(l.preferences, k)[e][0] ?? null), !m && e === "navigate")
2562
- S = /* @__PURE__ */ N(
2572
+ let m = a ? un(a) : null;
2573
+ if (!m && e === "navigate" ? m = n ? aa[n] : null : !m && e && (m = Ee(l.preferences, k)[e][0] ?? null), !m && e === "navigate")
2574
+ L = /* @__PURE__ */ C(
2563
2575
  "span",
2564
2576
  {
2565
2577
  className: "nice-button-prompt__glyph",
2566
2578
  role: "img",
2567
2579
  "aria-label": h("input.pad.dpad", "D-pad"),
2568
- children: /* @__PURE__ */ N(ee, { name: "pad-dpad", size: he[c] })
2580
+ children: /* @__PURE__ */ C(ee, { name: "pad-dpad", size: he[c] })
2569
2581
  }
2570
2582
  );
2571
2583
  else if (m) {
2572
- const { label: A, key: y } = pn(k, m), L = y ? h(y, A) : h("input.prompt.button", "Button {name}").replace("{name}", A);
2573
- S = aa.has(m) ? /* @__PURE__ */ N(
2584
+ const { label: A, key: y } = vn(k, m), S = y ? h(y, A) : h("input.prompt.button", "Button {name}").replace("{name}", A);
2585
+ L = ra.has(m) ? /* @__PURE__ */ C(
2574
2586
  "span",
2575
2587
  {
2576
2588
  className: `nice-button-prompt__glyph nice-button-prompt__glyph--${k}-${m}`,
2577
2589
  role: "img",
2578
- "aria-label": L,
2579
- children: /* @__PURE__ */ N(ee, { name: vn(k, m), size: he[c] })
2590
+ "aria-label": S,
2591
+ children: /* @__PURE__ */ C(ee, { name: mn(k, m), size: he[c] })
2580
2592
  }
2581
- ) : /* @__PURE__ */ N("span", { className: "nice-button-prompt__chip", role: "img", "aria-label": L, children: /* @__PURE__ */ N("span", { "aria-hidden": "true", children: y ? h(y, A) : A }) });
2593
+ ) : /* @__PURE__ */ C("span", { className: "nice-button-prompt__chip", role: "img", "aria-label": S, children: /* @__PURE__ */ C("span", { "aria-hidden": "true", children: y ? h(y, A) : A }) });
2582
2594
  }
2583
2595
  } else {
2584
2596
  let m = r;
2585
- !m && e === "navigate" ? m = t ? ta[t] : "ArrowUp ArrowDown ArrowLeft ArrowRight" : !m && e && (m = (l.preferences.keyboardBindings[e] ?? we[e])[0]), m && (S = /* @__PURE__ */ N(ea, { keys: m, size: c }));
2597
+ !m && e === "navigate" ? m = n ? na[n] : "ArrowUp ArrowDown ArrowLeft ArrowRight" : !m && e && (m = (l.preferences.keyboardBindings[e] ?? we[e])[0]), m && (L = /* @__PURE__ */ C(ta, { keys: m, size: c }));
2586
2598
  }
2587
- return !S && !C ? null : /* @__PURE__ */ V("span", { className: x, style: u, "data-device": p, children: [
2588
- S,
2589
- C
2599
+ return !L && !N ? null : /* @__PURE__ */ V("span", { className: z, style: u, "data-device": p, children: [
2600
+ L,
2601
+ N
2590
2602
  ] });
2591
2603
  },
2592
2604
  { displayName: "NiceButtonPrompt" }
@@ -2599,10 +2611,10 @@ const Qn = { sm: 12, md: 14, lg: 18 }, ea = /* @__PURE__ */ Object.assign(
2599
2611
  '[role="radio"]',
2600
2612
  '[role="treeitem"]',
2601
2613
  "[data-nice-roving-item]"
2602
- ].join(","), ra = '[aria-selected="true"],[aria-checked="true"],[aria-pressed="true"],[aria-current]:not([aria-current="false"])', sa = 500;
2603
- function oa(n, e = {}) {
2614
+ ].join(","), sa = '[aria-selected="true"],[aria-checked="true"],[aria-pressed="true"],[aria-current]:not([aria-current="false"])', oa = 500;
2615
+ function ia(t, e = {}) {
2604
2616
  const {
2605
- orientation: t = "horizontal",
2617
+ orientation: n = "horizontal",
2606
2618
  itemSelector: a = Ae,
2607
2619
  wrap: r = !1,
2608
2620
  homeEnd: s = !0,
@@ -2614,89 +2626,89 @@ function oa(n, e = {}) {
2614
2626
  u.current = e.onMove;
2615
2627
  const h = O(e.activateOnMove);
2616
2628
  h.current = e.activateOnMove;
2617
- const l = K(), p = I(() => {
2618
- const x = n.current;
2619
- return x ? [...x.querySelectorAll(a)].filter(
2620
- (C) => C.closest("[data-nice-roving]") === x && !(c && (C.getAttribute("aria-disabled") === "true" || C.disabled))
2629
+ const l = K(), p = D(() => {
2630
+ const z = t.current;
2631
+ return z ? [...z.querySelectorAll(a)].filter(
2632
+ (N) => N.closest("[data-nice-roving]") === z && !(c && (N.getAttribute("aria-disabled") === "true" || N.disabled))
2621
2633
  ) : [];
2622
- }, [n, a, c]), w = I(() => {
2623
- const x = p();
2624
- if (x.length === 0)
2634
+ }, [t, a, c]), w = D(() => {
2635
+ const z = p();
2636
+ if (z.length === 0)
2625
2637
  return;
2626
- const C = x[0].ownerDocument, m = x.find((A) => A === C.activeElement || A.contains(C.activeElement)) ?? x.find((A) => A.matches(ra)) ?? x.find((A) => A.getAttribute("tabindex") === "0") ?? x[0];
2627
- for (const A of x) {
2638
+ const N = z[0].ownerDocument, m = z.find((A) => A === N.activeElement || A.contains(N.activeElement)) ?? z.find((A) => A.matches(sa)) ?? z.find((A) => A.getAttribute("tabindex") === "0") ?? z[0];
2639
+ for (const A of z) {
2628
2640
  const y = A === m ? "0" : "-1";
2629
2641
  A.getAttribute("tabindex") !== y && A.setAttribute("tabindex", y);
2630
2642
  }
2631
- }, [p]), k = I(
2632
- (x) => {
2643
+ }, [p]), k = D(
2644
+ (z) => {
2633
2645
  var m;
2634
- const C = p(), S = C[x];
2635
- if (S) {
2636
- for (const A of C)
2637
- A.setAttribute("tabindex", A === S ? "0" : "-1");
2638
- l ? l.focusElement(S) : S.focus(), h.current && ((S.matches('button, a[href], [role="button"]') ? S : S.querySelector("button, a[href]")) ?? S).click(), (m = u.current) == null || m.call(u, S, x);
2646
+ const N = p(), L = N[z];
2647
+ if (L) {
2648
+ for (const A of N)
2649
+ A.setAttribute("tabindex", A === L ? "0" : "-1");
2650
+ l ? l.focusElement(L) : L.focus(), h.current && ((L.matches('button, a[href], [role="button"]') ? L : L.querySelector("button, a[href]")) ?? L).click(), (m = u.current) == null || m.call(u, L, z);
2639
2651
  }
2640
2652
  },
2641
2653
  [p, l]
2642
2654
  );
2643
2655
  return B(
2644
- n,
2645
- (x) => {
2656
+ t,
2657
+ (z) => {
2646
2658
  if (!d)
2647
2659
  return;
2648
- x.setAttribute("data-nice-roving", t), w();
2649
- let C = "", S;
2650
- const m = (L) => {
2660
+ z.setAttribute("data-nice-roving", n), w();
2661
+ let N = "", L;
2662
+ const m = (S) => {
2651
2663
  var P;
2652
- if (L.defaultPrevented || L.altKey || L.ctrlKey || L.metaKey)
2664
+ if (S.defaultPrevented || S.altKey || S.ctrlKey || S.metaKey)
2653
2665
  return;
2654
- const T = p(), E = x.ownerDocument, g = T.findIndex(
2666
+ const T = p(), E = z.ownerDocument, g = T.findIndex(
2655
2667
  (H) => H === E.activeElement || H.contains(E.activeElement)
2656
2668
  );
2657
2669
  if (g < 0)
2658
2670
  return;
2659
- const v = ((P = E.defaultView) == null ? void 0 : P.getComputedStyle(x).direction) === "rtl";
2671
+ const v = ((P = E.defaultView) == null ? void 0 : P.getComputedStyle(z).direction) === "rtl";
2660
2672
  let M = -1;
2661
2673
  const f = (H) => {
2662
- const D = g + H;
2663
- return D >= 0 && D < T.length ? D : r ? (D + T.length) % T.length : -1;
2674
+ const I = g + H;
2675
+ return I >= 0 && I < T.length ? I : r ? (I + T.length) % T.length : -1;
2664
2676
  }, b = {
2665
2677
  ArrowUp: "up",
2666
2678
  ArrowDown: "down",
2667
2679
  ArrowLeft: "left",
2668
2680
  ArrowRight: "right"
2669
- }[L.key];
2681
+ }[S.key];
2670
2682
  if (b) {
2671
2683
  const H = b === "left" || b === "right";
2672
- if (t === "grid") {
2673
- const D = Pt(
2684
+ if (n === "grid") {
2685
+ const I = It(
2674
2686
  X(T[g]),
2675
2687
  T.filter((_, F) => F !== g),
2676
2688
  X,
2677
2689
  b
2678
2690
  );
2679
- M = D ? T.indexOf(D) : -1;
2680
- } else if (t === "both" || t === "horizontal" && H || t === "vertical" && !H) {
2681
- let D = b === "down" || b === "right";
2682
- H && v && (D = !D), M = f(D ? 1 : -1);
2691
+ M = I ? T.indexOf(I) : -1;
2692
+ } else if (n === "both" || n === "horizontal" && H || n === "vertical" && !H) {
2693
+ let I = b === "down" || b === "right";
2694
+ H && v && (I = !I), M = f(I ? 1 : -1);
2683
2695
  } else
2684
2696
  return;
2685
2697
  if (M < 0)
2686
2698
  return;
2687
- } else if (s && (L.key === "Home" || L.key === "End"))
2688
- M = L.key === "Home" ? 0 : T.length - 1;
2689
- else if (o > 0 && (L.key === "PageUp" || L.key === "PageDown")) {
2690
- const H = L.key === "PageUp" ? -o : o;
2699
+ } else if (s && (S.key === "Home" || S.key === "End"))
2700
+ M = S.key === "Home" ? 0 : T.length - 1;
2701
+ else if (o > 0 && (S.key === "PageUp" || S.key === "PageDown")) {
2702
+ const H = S.key === "PageUp" ? -o : o;
2691
2703
  M = Math.max(0, Math.min(T.length - 1, g + H));
2692
- } else if (i && L.key.length === 1 && L.key !== " ") {
2693
- clearTimeout(S), C += L.key.toLowerCase(), S = setTimeout(() => {
2694
- C = "";
2695
- }, sa);
2704
+ } else if (i && S.key.length === 1 && S.key !== " ") {
2705
+ clearTimeout(L), N += S.key.toLowerCase(), L = setTimeout(() => {
2706
+ N = "";
2707
+ }, oa);
2696
2708
  for (let H = 1; H <= T.length; H++) {
2697
- const D = (g + H) % T.length;
2698
- if ((T[D].getAttribute("aria-label") ?? T[D].textContent ?? "").trim().toLowerCase().startsWith(C)) {
2699
- M = D;
2709
+ const I = (g + H) % T.length;
2710
+ if ((T[I].getAttribute("aria-label") ?? T[I].textContent ?? "").trim().toLowerCase().startsWith(N)) {
2711
+ M = I;
2700
2712
  break;
2701
2713
  }
2702
2714
  }
@@ -2704,11 +2716,11 @@ function oa(n, e = {}) {
2704
2716
  return;
2705
2717
  } else
2706
2718
  return;
2707
- L.preventDefault(), M !== g && k(M);
2719
+ S.preventDefault(), M !== g && k(M);
2708
2720
  }, A = () => w();
2709
- x.addEventListener("keydown", m), x.addEventListener("focusin", A);
2721
+ z.addEventListener("keydown", m), z.addEventListener("focusin", A);
2710
2722
  const y = typeof MutationObserver > "u" ? null : new MutationObserver(() => w());
2711
- return y == null || y.observe(x, {
2723
+ return y == null || y.observe(z, {
2712
2724
  childList: !0,
2713
2725
  subtree: !0,
2714
2726
  attributes: !0,
@@ -2720,33 +2732,33 @@ function oa(n, e = {}) {
2720
2732
  "disabled"
2721
2733
  ]
2722
2734
  }), () => {
2723
- clearTimeout(S), x.removeEventListener("keydown", m), x.removeEventListener("focusin", A), y == null || y.disconnect(), x.removeAttribute("data-nice-roving");
2735
+ clearTimeout(L), z.removeEventListener("keydown", m), z.removeEventListener("focusin", A), y == null || y.disconnect(), z.removeAttribute("data-nice-roving");
2724
2736
  };
2725
2737
  },
2726
- [d, t, r, s, o, i, p, w, k]
2738
+ [d, n, r, s, o, i, p, w, k]
2727
2739
  ), { items: p, focusItem: k, refresh: w };
2728
2740
  }
2729
- function ia(n, e, t = {}) {
2730
- const { ref: a, enabled: r = !0 } = t, s = O(e);
2741
+ function ca(t, e, n = {}) {
2742
+ const { ref: a, enabled: r = !0 } = n, s = O(e);
2731
2743
  s.current = e;
2732
- const o = typeof n == "string" ? n : n.join(",");
2744
+ const o = typeof t == "string" ? t : t.join(",");
2733
2745
  K();
2734
2746
  const i = (c) => {
2735
2747
  const d = new Set(o.split(",")), u = (h) => {
2736
2748
  const l = h;
2737
2749
  l.defaultPrevented || !d.has(l.detail.intent) || s.current(l.detail, l) !== !1 && l.preventDefault();
2738
2750
  };
2739
- return c.addEventListener(xe, u), () => c.removeEventListener(xe, u);
2751
+ return c.addEventListener(ze, u), () => c.removeEventListener(ze, u);
2740
2752
  };
2741
2753
  B(a, (c) => r ? i(c) : void 0, [o, r]), R(() => {
2742
2754
  if (!(a || !r))
2743
2755
  return i(document);
2744
2756
  }, [a, o, r]);
2745
2757
  }
2746
- function ca(n, e = {}) {
2747
- const { nav: t, wrap: a, trap: r, enter: s, arrows: o, region: i } = e;
2748
- K(), B(n, (c) => kn(c, { nav: t, wrap: a, trap: r, enter: s, arrows: o, region: i }), [
2749
- t,
2758
+ function la(t, e = {}) {
2759
+ const { nav: n, wrap: a, trap: r, enter: s, arrows: o, region: i } = e;
2760
+ K(), B(t, (c) => zn(c, { nav: n, wrap: a, trap: r, enter: s, arrows: o, region: i }), [
2761
+ n,
2750
2762
  a,
2751
2763
  r,
2752
2764
  s,
@@ -2754,28 +2766,28 @@ function ca(n, e = {}) {
2754
2766
  i
2755
2767
  ]);
2756
2768
  }
2757
- function qa(n, e = {}) {
2758
- const { kind: t = "value", disabled: a = !1, restoreOnCancel: r = !1 } = e, [s, o] = j(!1), i = O(e);
2769
+ function $a(t, e = {}) {
2770
+ const { kind: n = "value", disabled: a = !1, restoreOnCancel: r = !1 } = e, [s, o] = j(!1), i = O(e);
2759
2771
  return i.current = e, K(), B(
2760
- n,
2772
+ t,
2761
2773
  (c) => {
2762
2774
  const d = c.getAttribute("data-nice-engage");
2763
- c.setAttribute("data-nice-engage", a ? "none" : t), c.toggleAttribute(Me, r);
2775
+ c.setAttribute("data-nice-engage", a ? "none" : n), c.toggleAttribute(Me, r);
2764
2776
  const u = (h) => {
2765
- var p, w, k, x;
2777
+ var p, w, k, z;
2766
2778
  if (h.target !== c)
2767
2779
  return;
2768
2780
  const l = h.detail;
2769
- o(l.engaged), l.engaged ? (w = (p = i.current).onEngage) == null || w.call(p) : (x = (k = i.current).onRelease) == null || x.call(k, l.cancelled);
2781
+ o(l.engaged), l.engaged ? (w = (p = i.current).onEngage) == null || w.call(p) : (z = (k = i.current).onRelease) == null || z.call(k, l.cancelled);
2770
2782
  };
2771
2783
  return c.addEventListener(ne, u), () => {
2772
2784
  c.removeEventListener(ne, u), c.removeAttribute(Me), d === null ? c.removeAttribute("data-nice-engage") : c.setAttribute("data-nice-engage", d);
2773
2785
  };
2774
2786
  },
2775
- [t, a, r]
2787
+ [n, a, r]
2776
2788
  ), { engaged: s };
2777
2789
  }
2778
- function $a(n, e, t) {
2790
+ function Ya(t, e, n) {
2779
2791
  const {
2780
2792
  open: a,
2781
2793
  orientation: r = "vertical",
@@ -2783,18 +2795,18 @@ function $a(n, e, t) {
2783
2795
  typeahead: o = !0,
2784
2796
  closeOnFocusOut: i = !0,
2785
2797
  closeOnOutsidePress: c = !0
2786
- } = t, d = O(t);
2787
- d.current = t;
2798
+ } = n, d = O(n);
2799
+ d.current = n;
2788
2800
  const u = O("first");
2789
- oa(e, { orientation: r, wrap: !0, typeahead: o, itemSelector: s }), Yn(e, {
2801
+ ia(e, { orientation: r, wrap: !0, typeahead: o, itemSelector: s }), Wn(e, {
2790
2802
  open: a,
2791
2803
  modal: !1,
2792
2804
  onClose: () => d.current.onOpenChange(!1)
2793
2805
  }), B(
2794
- n,
2806
+ t,
2795
2807
  (h) => {
2796
2808
  const l = (p) => {
2797
- var x, C;
2809
+ var z, N;
2798
2810
  const w = p.niceSource;
2799
2811
  if (p.defaultPrevented || w === "gamepad" || w === "remote" || p.key !== "ArrowDown" && p.key !== "ArrowUp")
2800
2812
  return;
@@ -2803,11 +2815,11 @@ function $a(n, e, t) {
2803
2815
  return;
2804
2816
  }
2805
2817
  const k = [
2806
- ...((x = e.current) == null ? void 0 : x.querySelectorAll(
2818
+ ...((z = e.current) == null ? void 0 : z.querySelectorAll(
2807
2819
  d.current.itemSelector ?? Ae
2808
2820
  )) ?? []
2809
2821
  ];
2810
- (C = u.current === "last" ? k[k.length - 1] : k[0]) == null || C.focus();
2822
+ (N = u.current === "last" ? k[k.length - 1] : k[0]) == null || N.focus();
2811
2823
  };
2812
2824
  return h.addEventListener("keydown", l), () => h.removeEventListener("keydown", l);
2813
2825
  },
@@ -2815,36 +2827,36 @@ function $a(n, e, t) {
2815
2827
  ), B(
2816
2828
  e,
2817
2829
  (h) => {
2818
- var C;
2830
+ var N;
2819
2831
  if (!a)
2820
2832
  return;
2821
2833
  if (u.current === "last") {
2822
- const S = h.querySelectorAll(s);
2823
- (C = S[S.length - 1]) == null || C.focus();
2834
+ const L = h.querySelectorAll(s);
2835
+ (N = L[L.length - 1]) == null || N.focus();
2824
2836
  }
2825
2837
  u.current = "first";
2826
- const l = (S) => {
2827
- const m = S.target;
2828
- S.defaultPrevented || S.key !== "Enter" && S.key !== " " || !m.matches(s) || m.matches("button, a[href], input, select, textarea") || (S.preventDefault(), m.click());
2829
- }, p = (S) => {
2838
+ const l = (L) => {
2839
+ const m = L.target;
2840
+ L.defaultPrevented || L.key !== "Enter" && L.key !== " " || !m.matches(s) || m.matches("button, a[href], input, select, textarea") || (L.preventDefault(), m.click());
2841
+ }, p = (L) => {
2830
2842
  var m;
2831
- return !!S && !h.contains(S) && !((m = n.current) != null && m.contains(S));
2832
- }, w = (S) => {
2833
- p(S.relatedTarget) && d.current.onOpenChange(!1);
2834
- }, k = (S) => {
2835
- p(S.target) && d.current.onOpenChange(!1);
2836
- }, x = h.ownerDocument;
2837
- return h.addEventListener("keydown", l), i && h.addEventListener("focusout", w), c && (x.addEventListener("mousedown", k), x.addEventListener("touchstart", k)), () => {
2838
- h.removeEventListener("keydown", l), h.removeEventListener("focusout", w), x.removeEventListener("mousedown", k), x.removeEventListener("touchstart", k);
2843
+ return !!L && !h.contains(L) && !((m = t.current) != null && m.contains(L));
2844
+ }, w = (L) => {
2845
+ p(L.relatedTarget) && d.current.onOpenChange(!1);
2846
+ }, k = (L) => {
2847
+ p(L.target) && d.current.onOpenChange(!1);
2848
+ }, z = h.ownerDocument;
2849
+ return h.addEventListener("keydown", l), i && h.addEventListener("focusout", w), c && (z.addEventListener("mousedown", k), z.addEventListener("touchstart", k)), () => {
2850
+ h.removeEventListener("keydown", l), h.removeEventListener("focusout", w), z.removeEventListener("mousedown", k), z.removeEventListener("touchstart", k);
2839
2851
  };
2840
2852
  },
2841
2853
  [a, s, i, c]
2842
2854
  );
2843
2855
  }
2844
- const la = 500;
2845
- function Ya(n, e) {
2856
+ const ua = 500;
2857
+ function Wa(t, e) {
2846
2858
  const {
2847
- itemSelector: t = '[role="treeitem"]',
2859
+ itemSelector: n = '[role="treeitem"]',
2848
2860
  rowSelector: a,
2849
2861
  typeahead: r = !0,
2850
2862
  enabled: s = !0
@@ -2852,56 +2864,56 @@ function Ya(n, e) {
2852
2864
  o.current = e;
2853
2865
  const i = K();
2854
2866
  B(
2855
- n,
2867
+ t,
2856
2868
  (c) => {
2857
2869
  if (!s)
2858
2870
  return;
2859
- const d = c.ownerDocument, u = (v) => v instanceof HTMLElement && v.matches(t) && c.contains(v), h = () => [...c.querySelectorAll(t)], l = (v) => Number(v.getAttribute("aria-level")) || 0, p = (v) => {
2871
+ const d = c.ownerDocument, u = (v) => v instanceof HTMLElement && v.matches(n) && c.contains(v), h = () => [...c.querySelectorAll(n)], l = (v) => Number(v.getAttribute("aria-level")) || 0, p = (v) => {
2860
2872
  var b;
2861
- const M = ((b = v.parentElement) == null ? void 0 : b.closest(t)) ?? null;
2873
+ const M = ((b = v.parentElement) == null ? void 0 : b.closest(n)) ?? null;
2862
2874
  if (M && c.contains(M))
2863
2875
  return M;
2864
2876
  const f = l(v);
2865
2877
  if (f < 2)
2866
2878
  return null;
2867
- const z = h();
2868
- for (let P = z.indexOf(v) - 1; P >= 0; P--) {
2869
- const H = l(z[P]);
2879
+ const x = h();
2880
+ for (let P = x.indexOf(v) - 1; P >= 0; P--) {
2881
+ const H = l(x[P]);
2870
2882
  if (H === f - 1)
2871
- return z[P];
2883
+ return x[P];
2872
2884
  if (H < f - 1)
2873
2885
  return null;
2874
2886
  }
2875
2887
  return null;
2876
2888
  }, w = () => {
2877
- var z;
2889
+ var x;
2878
2890
  const v = [], M = /* @__PURE__ */ new Map(), f = [];
2879
2891
  for (const b of h()) {
2880
2892
  const P = l(b);
2881
- let H = ((z = b.parentElement) == null ? void 0 : z.closest(t)) ?? null;
2893
+ let H = ((x = b.parentElement) == null ? void 0 : x.closest(n)) ?? null;
2882
2894
  H && !c.contains(H) && (H = null), !H && P >= 2 && (H = f[P - 1] ?? null), P > 0 && (f.length = P + 1, f[P] = b);
2883
- const D = H ? (M.get(H) ?? !0) && H.getAttribute("aria-expanded") !== "false" : !0;
2884
- M.set(b, D), D && !b.closest("[hidden],[inert]") && v.push(b);
2895
+ const I = H ? (M.get(H) ?? !0) && H.getAttribute("aria-expanded") !== "false" : !0;
2896
+ M.set(b, I), I && !b.closest("[hidden],[inert]") && v.push(b);
2885
2897
  }
2886
2898
  return v;
2887
2899
  }, k = (v) => a ? [...v.querySelectorAll(a)].find(
2888
- (M) => M.closest(t) === v
2889
- ) ?? null : null, x = (v) => {
2900
+ (M) => M.closest(n) === v
2901
+ ) ?? null : null, z = (v) => {
2890
2902
  const M = v.getAttribute("aria-label");
2891
2903
  if (M)
2892
2904
  return M;
2893
2905
  const f = k(v);
2894
- return f ? f.textContent ?? "" : [...v.childNodes].filter((z) => !(z instanceof Element && z.matches('[role="group"]'))).map((z) => z.textContent ?? "").join("");
2895
- }, C = () => {
2906
+ return f ? f.textContent ?? "" : [...v.childNodes].filter((x) => !(x instanceof Element && x.matches('[role="group"]'))).map((x) => x.textContent ?? "").join("");
2907
+ }, N = () => {
2896
2908
  const v = w();
2897
2909
  if (v.length === 0)
2898
2910
  return;
2899
- const M = d.activeElement, f = v.find((z) => z === M) ?? v.find((z) => z.getAttribute("aria-selected") === "true") ?? v.find((z) => z.getAttribute("tabindex") === "0") ?? v[0];
2900
- for (const z of h()) {
2901
- const b = z === f ? "0" : "-1";
2902
- z.getAttribute("tabindex") !== b && z.setAttribute("tabindex", b);
2911
+ const M = d.activeElement, f = v.find((x) => x === M) ?? v.find((x) => x.getAttribute("aria-selected") === "true") ?? v.find((x) => x.getAttribute("tabindex") === "0") ?? v[0];
2912
+ for (const x of h()) {
2913
+ const b = x === f ? "0" : "-1";
2914
+ x.getAttribute("tabindex") !== b && x.setAttribute("tabindex", b);
2903
2915
  }
2904
- }, S = (v) => {
2916
+ }, L = (v) => {
2905
2917
  for (const M of h())
2906
2918
  M.setAttribute("tabindex", M === v ? "0" : "-1");
2907
2919
  i ? i.focusElement(v) : v.focus();
@@ -2911,32 +2923,32 @@ function Ya(n, e) {
2911
2923
  var _;
2912
2924
  if (v.defaultPrevented || v.altKey || v.ctrlKey || v.metaKey || !u(v.target))
2913
2925
  return;
2914
- const M = v.target, f = w(), z = f.indexOf(M);
2915
- if (z < 0)
2926
+ const M = v.target, f = w(), x = f.indexOf(M);
2927
+ if (x < 0)
2916
2928
  return;
2917
2929
  const b = ((_ = d.defaultView) == null ? void 0 : _.getComputedStyle(c).direction) === "rtl", P = b && v.key === "ArrowLeft" ? "ArrowRight" : b && v.key === "ArrowRight" ? "ArrowLeft" : v.key, H = M.getAttribute("aria-expanded");
2918
- let D;
2930
+ let I;
2919
2931
  if (P === "ArrowDown")
2920
- D = f[z + 1];
2932
+ I = f[x + 1];
2921
2933
  else if (P === "ArrowUp")
2922
- D = f[z - 1];
2934
+ I = f[x - 1];
2923
2935
  else if (P === "Home")
2924
- D = f[0];
2936
+ I = f[0];
2925
2937
  else if (P === "End")
2926
- D = f[f.length - 1];
2938
+ I = f[f.length - 1];
2927
2939
  else if (P === "ArrowRight") {
2928
2940
  if (H === "false") {
2929
2941
  v.preventDefault(), o.current.onToggle(M, !0);
2930
2942
  return;
2931
2943
  }
2932
- const F = f[z + 1];
2933
- D = H === "true" && F && p(F) === M ? F : void 0;
2944
+ const F = f[x + 1];
2945
+ I = H === "true" && F && p(F) === M ? F : void 0;
2934
2946
  } else if (P === "ArrowLeft") {
2935
2947
  if (H === "true") {
2936
2948
  v.preventDefault(), o.current.onToggle(M, !1);
2937
2949
  return;
2938
2950
  }
2939
- D = p(M);
2951
+ I = p(M);
2940
2952
  } else if (P === "*") {
2941
2953
  v.preventDefault();
2942
2954
  const F = p(M);
@@ -2949,95 +2961,95 @@ function Ya(n, e) {
2949
2961
  } else if (r && P.length === 1) {
2950
2962
  clearTimeout(A), m += P.toLowerCase(), A = setTimeout(() => {
2951
2963
  m = "";
2952
- }, la);
2964
+ }, ua);
2953
2965
  for (let F = 1; F <= f.length; F++) {
2954
- const $ = f[(z + F) % f.length];
2955
- if (x($).trim().toLowerCase().startsWith(m)) {
2956
- D = $;
2966
+ const $ = f[(x + F) % f.length];
2967
+ if (z($).trim().toLowerCase().startsWith(m)) {
2968
+ I = $;
2957
2969
  break;
2958
2970
  }
2959
2971
  }
2960
2972
  }
2961
- D && D !== M && (v.preventDefault(), S(D));
2962
- }, L = (v) => {
2973
+ I && I !== M && (v.preventDefault(), L(I));
2974
+ }, S = (v) => {
2963
2975
  const M = u(v.target) ? k(v.target) : null;
2964
2976
  M && M.click();
2965
2977
  }, T = (v) => {
2966
2978
  const M = u(v.target) ? k(v.target) : null;
2967
2979
  if (!M)
2968
2980
  return;
2969
- const f = M.getBoundingClientRect(), z = new MouseEvent("contextmenu", {
2981
+ const f = M.getBoundingClientRect(), x = new MouseEvent("contextmenu", {
2970
2982
  bubbles: !0,
2971
2983
  cancelable: !0,
2972
2984
  clientX: v.clientX || f.left + f.width / 2,
2973
2985
  clientY: v.clientY || f.top + f.height / 2
2974
2986
  });
2975
- v.stopPropagation(), M.dispatchEvent(z) || v.preventDefault();
2976
- }, E = () => C();
2977
- C(), c.addEventListener("keydown", y), c.addEventListener("click", L), c.addEventListener("contextmenu", T), c.addEventListener("focusin", E);
2978
- const g = typeof MutationObserver > "u" ? null : new MutationObserver(() => C());
2987
+ v.stopPropagation(), M.dispatchEvent(x) || v.preventDefault();
2988
+ }, E = () => N();
2989
+ N(), c.addEventListener("keydown", y), c.addEventListener("click", S), c.addEventListener("contextmenu", T), c.addEventListener("focusin", E);
2990
+ const g = typeof MutationObserver > "u" ? null : new MutationObserver(() => N());
2979
2991
  return g == null || g.observe(c, {
2980
2992
  childList: !0,
2981
2993
  subtree: !0,
2982
2994
  attributes: !0,
2983
2995
  attributeFilter: ["aria-expanded", "aria-selected", "hidden"]
2984
2996
  }), () => {
2985
- clearTimeout(A), c.removeEventListener("keydown", y), c.removeEventListener("click", L), c.removeEventListener("contextmenu", T), c.removeEventListener("focusin", E), g == null || g.disconnect();
2997
+ clearTimeout(A), c.removeEventListener("keydown", y), c.removeEventListener("click", S), c.removeEventListener("contextmenu", T), c.removeEventListener("focusin", E), g == null || g.disconnect();
2986
2998
  };
2987
2999
  },
2988
- [s, t, a, r, i]
3000
+ [s, n, a, r, i]
2989
3001
  );
2990
3002
  }
2991
- const ua = '[role="row"],tr', da = '[role="gridcell"],[role="columnheader"],[role="rowheader"],td,th', ha = 'button:not([disabled]),a[href],input:not([disabled]):not([type="hidden"]),select:not([disabled]),textarea:not([disabled])', fa = 'textarea,select,input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"])';
2992
- function Wa(n, e = {}) {
2993
- const { rowSelector: t = ua, cellSelector: a = da, pageSize: r = 10, enabled: s = !0 } = e, o = O(e);
3003
+ const da = '[role="row"],tr', ha = '[role="gridcell"],[role="columnheader"],[role="rowheader"],td,th', fa = 'button:not([disabled]),a[href],input:not([disabled]):not([type="hidden"]),select:not([disabled]),textarea:not([disabled])', pa = 'textarea,select,input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"])';
3004
+ function Xa(t, e = {}) {
3005
+ const { rowSelector: n = da, cellSelector: a = ha, pageSize: r = 10, enabled: s = !0 } = e, o = O(e);
2994
3006
  o.current = e;
2995
3007
  const i = K();
2996
3008
  B(
2997
- n,
3009
+ t,
2998
3010
  (c) => {
2999
3011
  if (!s)
3000
3012
  return;
3001
3013
  const d = c.ownerDocument, u = (y) => {
3002
- var L;
3003
- return !!y && y.matches(t) && ((L = y.parentElement) == null ? void 0 : L.closest('[role="grid"],[role="treegrid"]')) === c;
3004
- }, h = () => [...c.querySelectorAll(t)].filter(u), l = (y) => [...y.children].filter((L) => L.matches(a)), p = (y) => {
3005
- const L = y.querySelectorAll(ha);
3006
- return L.length === 1 ? L[0] : y;
3014
+ var S;
3015
+ return !!y && y.matches(n) && ((S = y.parentElement) == null ? void 0 : S.closest('[role="grid"],[role="treegrid"]')) === c;
3016
+ }, h = () => [...c.querySelectorAll(n)].filter(u), l = (y) => [...y.children].filter((S) => S.matches(a)), p = (y) => {
3017
+ const S = y.querySelectorAll(fa);
3018
+ return S.length === 1 ? S[0] : y;
3007
3019
  }, w = () => h().flatMap((y) => l(y).map(p)), k = (y) => {
3008
- const L = (y == null ? void 0 : y.closest(a)) ?? null;
3009
- return L && u(L.parentElement) ? L : null;
3010
- }, x = () => {
3020
+ const S = (y == null ? void 0 : y.closest(a)) ?? null;
3021
+ return S && u(S.parentElement) ? S : null;
3022
+ }, z = () => {
3011
3023
  const y = w();
3012
3024
  if (y.length === 0)
3013
3025
  return;
3014
- const L = d.activeElement, T = y.find((E) => E === L || E.contains(L)) ?? y.find((E) => E.getAttribute("tabindex") === "0") ?? y[0];
3026
+ const S = d.activeElement, T = y.find((E) => E === S || E.contains(S)) ?? y.find((E) => E.getAttribute("tabindex") === "0") ?? y[0];
3015
3027
  for (const E of y) {
3016
3028
  const g = E === T ? "0" : "-1";
3017
3029
  E.getAttribute("tabindex") !== g && E.setAttribute("tabindex", g);
3018
3030
  }
3019
- }, C = (y, L, T) => {
3031
+ }, N = (y, S, T) => {
3020
3032
  var g, v;
3021
3033
  const E = p(y);
3022
3034
  for (const M of w())
3023
3035
  M.setAttribute("tabindex", M === E ? "0" : "-1");
3024
- i ? i.focusElement(E) : E.focus(), (v = (g = o.current).onMove) == null || v.call(g, y, L, T);
3025
- }, S = (y) => {
3036
+ i ? i.focusElement(E) : E.focus(), (v = (g = o.current).onMove) == null || v.call(g, y, S, T);
3037
+ }, L = (y) => {
3026
3038
  var P;
3027
3039
  if (y.defaultPrevented || y.altKey || y.metaKey)
3028
3040
  return;
3029
- const L = y.target, T = k(L);
3030
- if (!T || p(T) !== L || L !== T && L.matches(fa))
3041
+ const S = y.target, T = k(S);
3042
+ if (!T || p(T) !== S || S !== T && S.matches(pa))
3031
3043
  return;
3032
- const E = h(), g = E.indexOf(T.parentElement), v = l(E[g]).indexOf(T), M = (H, D) => {
3044
+ const E = h(), g = E.indexOf(T.parentElement), v = l(E[g]).indexOf(T), M = (H, I) => {
3033
3045
  const _ = E[H] ? l(E[H]) : [];
3034
3046
  if (_.length === 0)
3035
3047
  return null;
3036
- const F = Math.min(D, _.length - 1);
3048
+ const F = Math.min(I, _.length - 1);
3037
3049
  return [_[F], H, F];
3038
3050
  };
3039
3051
  let f = null;
3040
- const z = ((P = d.defaultView) == null ? void 0 : P.getComputedStyle(c).direction) === "rtl", b = z && y.key === "ArrowLeft" ? "ArrowRight" : z && y.key === "ArrowRight" ? "ArrowLeft" : y.key;
3052
+ const x = ((P = d.defaultView) == null ? void 0 : P.getComputedStyle(c).direction) === "rtl", b = x && y.key === "ArrowLeft" ? "ArrowRight" : x && y.key === "ArrowRight" ? "ArrowLeft" : y.key;
3041
3053
  if (y.ctrlKey && (b === "Home" || b === "End"))
3042
3054
  f = b === "Home" ? M(0, 0) : M(E.length - 1, Number.MAX_SAFE_INTEGER);
3043
3055
  else {
@@ -3058,67 +3070,67 @@ function Wa(n, e = {}) {
3058
3070
  else if (b === "PageDown" || b === "PageUp") {
3059
3071
  const H = b === "PageDown" ? Math.min(E.length - 1, g + r) : Math.max(0, g - r);
3060
3072
  f = H !== g ? M(H, v) : null;
3061
- } else if ((b === "Enter" || b === " ") && L === T && !T.matches("button,a[href]")) {
3073
+ } else if ((b === "Enter" || b === " ") && S === T && !T.matches("button,a[href]")) {
3062
3074
  y.preventDefault(), T.click();
3063
3075
  return;
3064
3076
  } else
3065
3077
  return;
3066
3078
  }
3067
- f && f[0] !== T && (y.preventDefault(), C(...f));
3068
- }, m = () => x();
3069
- x(), c.addEventListener("keydown", S), c.addEventListener("focusin", m);
3070
- const A = typeof MutationObserver > "u" ? null : new MutationObserver(() => x());
3079
+ f && f[0] !== T && (y.preventDefault(), N(...f));
3080
+ }, m = () => z();
3081
+ z(), c.addEventListener("keydown", L), c.addEventListener("focusin", m);
3082
+ const A = typeof MutationObserver > "u" ? null : new MutationObserver(() => z());
3071
3083
  return A == null || A.observe(c, {
3072
3084
  childList: !0,
3073
3085
  subtree: !0,
3074
3086
  attributes: !0,
3075
3087
  attributeFilter: ["disabled"]
3076
3088
  }), () => {
3077
- c.removeEventListener("keydown", S), c.removeEventListener("focusin", m), A == null || A.disconnect();
3089
+ c.removeEventListener("keydown", L), c.removeEventListener("focusin", m), A == null || A.disconnect();
3078
3090
  };
3079
3091
  },
3080
- [s, t, a, r, i]
3092
+ [s, n, a, r, i]
3081
3093
  );
3082
3094
  }
3083
- const Xa = /* @__PURE__ */ Object.assign(
3084
- /* @__PURE__ */ Bt(function({ as: e = "div", nav: t, wrap: a, trap: r, enter: s, arrows: o, region: i, children: c, ...d }, u) {
3095
+ const Ja = /* @__PURE__ */ Object.assign(
3096
+ /* @__PURE__ */ Kt(function({ as: e = "div", nav: n, wrap: a, trap: r, enter: s, arrows: o, region: i, children: c, ...d }, u) {
3085
3097
  const h = O(null);
3086
- return Kt(u, () => h.current), ca(h, { nav: t, wrap: a, trap: r, enter: s, arrows: o, region: i }), /* @__PURE__ */ N(e, { ref: h, ...d, children: c });
3098
+ return jt(u, () => h.current), la(h, { nav: n, wrap: a, trap: r, enter: s, arrows: o, region: i }), /* @__PURE__ */ C(e, { ref: h, ...d, children: c });
3087
3099
  }),
3088
3100
  { displayName: "NiceFocusScope" }
3089
- ), W = /* @__PURE__ */ new Map(), Se = /* @__PURE__ */ new Set();
3090
- let Le = [];
3091
- function pt() {
3092
- Le = [...W.values()].map((n) => n.current), Se.forEach((n) => n());
3101
+ ), W = /* @__PURE__ */ new Map(), Le = /* @__PURE__ */ new Set();
3102
+ let Se = [];
3103
+ function vt() {
3104
+ Se = [...W.values()].map((t) => t.current), Le.forEach((t) => t());
3093
3105
  }
3094
- const Ce = (n) => n === void 0 ? [] : typeof n == "string" ? [n] : [...n];
3095
- function pa(n) {
3096
- return ze(n).map((e) => e === "Ctrl" ? "Control" : e === "Esc" ? "Escape" : e).join("+");
3106
+ const Ce = (t) => t === void 0 ? [] : typeof t == "string" ? [t] : [...t];
3107
+ function va(t) {
3108
+ return xe(t).map((e) => e === "Ctrl" ? "Control" : e === "Esc" ? "Escape" : e).join("+");
3097
3109
  }
3098
- function va(n) {
3110
+ function ma(t) {
3099
3111
  if (process.env.NODE_ENV === "production")
3100
3112
  return;
3101
- const e = Ce(n.keyboard);
3102
- for (const { current: t } of W.values()) {
3103
- if (t.id === n.id || (t.scope ?? "global") !== (n.scope ?? "global") || n.scope === "local" && t.ref !== n.ref)
3113
+ const e = Ce(t.keyboard);
3114
+ for (const { current: n } of W.values()) {
3115
+ if (n.id === t.id || (n.scope ?? "global") !== (t.scope ?? "global") || t.scope === "local" && n.ref !== t.ref)
3104
3116
  continue;
3105
- const a = Ce(t.keyboard).filter((r) => e.includes(r));
3106
- (a.length > 0 || n.gamepad && n.gamepad === t.gamepad) && console.warn(
3107
- `[nice2dev/input] actions "${t.id}" and "${n.id}" share ${a.length > 0 ? a.join(", ") : `the ${n.gamepad} intent`} in the same scope; the inner or later one wins.`
3117
+ const a = Ce(n.keyboard).filter((r) => e.includes(r));
3118
+ (a.length > 0 || t.gamepad && t.gamepad === n.gamepad) && console.warn(
3119
+ `[nice2dev/input] actions "${n.id}" and "${t.id}" share ${a.length > 0 ? a.join(", ") : `the ${t.gamepad} intent`} in the same scope; the inner or later one wins.`
3108
3120
  );
3109
3121
  }
3110
3122
  }
3111
- function Ja(n) {
3112
- const e = O(n);
3113
- e.current = n;
3114
- const { id: t, scope: a = "global", ref: r, gamepad: s, hint: o = !0, shortcutTarget: i } = n, c = Ce(n.keyboard).join("|");
3115
- R(() => (va(e.current), W.set(t, e), pt(), () => {
3116
- W.get(t) === e && (W.delete(t), pt());
3117
- }), [t]);
3123
+ function Za(t) {
3124
+ const e = O(t);
3125
+ e.current = t;
3126
+ const { id: n, scope: a = "global", ref: r, gamepad: s, hint: o = !0, shortcutTarget: i } = t, c = Ce(t.keyboard).join("|");
3127
+ R(() => (ma(e.current), W.set(n, e), vt(), () => {
3128
+ W.get(n) === e && (W.delete(n), vt());
3129
+ }), [n]);
3118
3130
  const d = (u) => {
3119
3131
  const h = c.split("|").map(Ht), l = (p) => {
3120
3132
  const w = p;
3121
- if (w.defaultPrevented || !h.some((x) => Nt(x, w)))
3133
+ if (w.defaultPrevented || !h.some((z) => Tt(z, w)))
3122
3134
  return;
3123
3135
  const k = e.current;
3124
3136
  k.when && !k.when() || (w.preventDefault(), k.onTrigger("keyboard"));
@@ -3130,80 +3142,80 @@ function Ja(n) {
3130
3142
  ]), R(() => {
3131
3143
  if (!(a === "local" || !c))
3132
3144
  return d(document);
3133
- }, [c, a]), ia(
3145
+ }, [c, a]), ca(
3134
3146
  s ?? "menu",
3135
3147
  (u) => {
3136
3148
  const h = e.current;
3137
3149
  return h.when && !h.when() ? !1 : (h.onTrigger(u.source), !0);
3138
3150
  },
3139
3151
  { ref: a === "local" ? r : void 0, enabled: !!s }
3140
- ), At(
3152
+ ), Lt(
3141
3153
  a === "local" ? r ?? null : null,
3142
- s && o ? [{ intent: s, label: n.label, keys: c.split("|")[0] }] : []
3154
+ s && o ? [{ intent: s, label: t.label, keys: c.split("|")[0] }] : []
3143
3155
  ), B(
3144
3156
  i,
3145
3157
  (u) => {
3146
3158
  if (!c)
3147
3159
  return;
3148
3160
  const h = u.getAttribute("aria-keyshortcuts");
3149
- return u.setAttribute("aria-keyshortcuts", c.split("|").map(pa).join(" ")), () => {
3161
+ return u.setAttribute("aria-keyshortcuts", c.split("|").map(va).join(" ")), () => {
3150
3162
  h === null ? u.removeAttribute("aria-keyshortcuts") : u.setAttribute("aria-keyshortcuts", h);
3151
3163
  };
3152
3164
  },
3153
3165
  [c]
3154
3166
  );
3155
3167
  }
3156
- function Za() {
3157
- return mt(
3158
- (n) => (Se.add(n), () => Se.delete(n)),
3159
- () => Le,
3160
- () => Le
3168
+ function Qa() {
3169
+ return Mt(
3170
+ (t) => (Le.add(t), () => Le.delete(t)),
3171
+ () => Se,
3172
+ () => Se
3161
3173
  );
3162
3174
  }
3163
- function Qa(n, e = "keyboard") {
3175
+ function er(t, e = "keyboard") {
3164
3176
  var a;
3165
- const t = (a = W.get(n)) == null ? void 0 : a.current;
3166
- return !t || t.when && !t.when() ? !1 : (t.onTrigger(e), !0);
3177
+ const n = (a = W.get(t)) == null ? void 0 : a.current;
3178
+ return !n || n.when && !n.when() ? !1 : (n.onTrigger(e), !0);
3167
3179
  }
3168
- const ma = [];
3169
- function Ma(n, e, t) {
3180
+ const Ma = [];
3181
+ function ga(t, e, n) {
3170
3182
  switch (e) {
3171
3183
  case "popup":
3172
3184
  return [
3173
- { intent: "activate", label: t("input.intent.activate", "Select") },
3174
- { intent: "back", label: t("input.hint.close", "Close") }
3185
+ { intent: "activate", label: n("input.intent.activate", "Select") },
3186
+ { intent: "back", label: n("input.hint.close", "Close") }
3175
3187
  ];
3176
3188
  case "text":
3177
3189
  return [
3178
- { intent: "menu", label: t("input.hint.confirm", "Confirm") },
3179
- { intent: "back", label: t("input.hint.done", "Done") }
3190
+ { intent: "menu", label: n("input.hint.confirm", "Confirm") },
3191
+ { intent: "back", label: n("input.hint.done", "Done") }
3180
3192
  ];
3181
3193
  case "value":
3182
- return $t(n) ? [
3183
- { intent: "navigate", label: t("input.hint.adjust", "Adjust") },
3184
- { intent: "activate", label: t("input.hint.done", "Done") },
3185
- { intent: "back", label: t("input.hint.cancel", "Cancel") }
3194
+ return Yt(t) ? [
3195
+ { intent: "navigate", label: n("input.hint.adjust", "Adjust") },
3196
+ { intent: "activate", label: n("input.hint.done", "Done") },
3197
+ { intent: "back", label: n("input.hint.cancel", "Cancel") }
3186
3198
  ] : [
3187
- { intent: "navigate", label: t("input.hint.adjust", "Adjust") },
3188
- { intent: "back", label: t("input.hint.done", "Done") }
3199
+ { intent: "navigate", label: n("input.hint.adjust", "Adjust") },
3200
+ { intent: "back", label: n("input.hint.done", "Done") }
3189
3201
  ];
3190
3202
  default:
3191
- return [{ intent: "back", label: t("input.hint.done", "Done") }];
3203
+ return [{ intent: "back", label: n("input.hint.done", "Done") }];
3192
3204
  }
3193
3205
  }
3194
- const er = /* @__PURE__ */ Object.assign(
3206
+ const tr = /* @__PURE__ */ Object.assign(
3195
3207
  function({
3196
3208
  position: e = "bottom",
3197
- visibility: t = "auto",
3209
+ visibility: n = "auto",
3198
3210
  automatic: a = !0,
3199
- hints: r = ma,
3211
+ hints: r = Ma,
3200
3212
  max: s = 6,
3201
3213
  size: o = "sm",
3202
3214
  className: i,
3203
3215
  style: c
3204
3216
  }) {
3205
- var S;
3206
- const { t: d } = J(), u = Ot(), h = K(), l = nn(), [, p] = j(0);
3217
+ var L;
3218
+ const { t: d } = J(), u = Rt(), h = K(), l = an(), [, p] = j(0);
3207
3219
  R(() => {
3208
3220
  if (!l)
3209
3221
  return;
@@ -3215,26 +3227,26 @@ const er = /* @__PURE__ */ Object.assign(
3215
3227
  };
3216
3228
  }, [l]);
3217
3229
  const w = u.method === "gamepad" || u.method === "remote";
3218
- if (t === "auto" && !u.hintsVisible || t === "pad" && !(u.hintsVisible && (w || u.preferences.hints === "always")))
3230
+ if (n === "auto" && !u.hintsVisible || n === "pad" && !(u.hintsVisible && (w || u.preferences.hints === "always")))
3219
3231
  return null;
3220
3232
  const k = [...r];
3221
- if (l && typeof document < "u" && k.push(...tn(l, document)), a && l && l !== document.body) {
3233
+ if (l && typeof document < "u" && k.push(...nn(l, document)), a && l && l !== document.body) {
3222
3234
  const m = ve(l);
3223
- m && Et(l, m) ? k.push(...Ma(l, m, d)) : (k.push({ intent: "navigate", label: d("input.intent.navigate", "Move") }), m ? k.push({ intent: "activate", label: d("input.hint.edit", "Edit") }) : yt(l) && k.push({ intent: "activate", label: d("input.intent.activate", "Select") }), (S = h == null ? void 0 : h.topOverlay()) != null && S.onClose && k.push({ intent: "back", label: d("input.hint.close", "Close") }));
3235
+ m && kt(l, m) ? k.push(...ga(l, m, d)) : (k.push({ intent: "navigate", label: d("input.intent.navigate", "Move") }), m ? k.push({ intent: "activate", label: d("input.hint.edit", "Edit") }) : wt(l) && k.push({ intent: "activate", label: d("input.intent.activate", "Select") }), (L = h == null ? void 0 : h.topOverlay()) != null && L.onClose && k.push({ intent: "back", label: d("input.hint.close", "Close") }));
3224
3236
  }
3225
- const x = [], C = /* @__PURE__ */ new Set();
3237
+ const z = [], N = /* @__PURE__ */ new Set();
3226
3238
  for (const m of k) {
3227
3239
  const A = `${m.intent}:${m.direction ?? ""}`;
3228
- C.has(A) || (C.add(A), x.push(m));
3240
+ N.has(A) || (N.add(A), z.push(m));
3229
3241
  }
3230
- return x.length === 0 ? null : /* @__PURE__ */ N(
3242
+ return z.length === 0 ? null : /* @__PURE__ */ C(
3231
3243
  "div",
3232
3244
  {
3233
3245
  className: `nice-input-hint-bar nice-input-hint-bar--${e}${i ? ` ${i}` : ""}`,
3234
3246
  style: c,
3235
3247
  "aria-hidden": "true",
3236
- children: x.slice(0, s).map((m) => /* @__PURE__ */ N(
3237
- Vt,
3248
+ children: z.slice(0, s).map((m) => /* @__PURE__ */ C(
3249
+ Ft,
3238
3250
  {
3239
3251
  className: "nice-input-hint-bar__item",
3240
3252
  intent: m.intent,
@@ -3250,22 +3262,22 @@ const er = /* @__PURE__ */ Object.assign(
3250
3262
  );
3251
3263
  },
3252
3264
  { displayName: "NiceInputHintBar" }
3253
- ), tr = /* @__PURE__ */ Object.assign(
3265
+ ), nr = /* @__PURE__ */ Object.assign(
3254
3266
  function({
3255
3267
  intent: e,
3256
- direction: t,
3268
+ direction: n,
3257
3269
  button: a,
3258
3270
  keys: r,
3259
3271
  always: s = !1,
3260
3272
  size: o = "sm",
3261
3273
  className: i
3262
3274
  }) {
3263
- const c = Un(), [d] = Gn();
3264
- return !c || !(s || d.hintDensity === "bar-and-controls") ? null : /* @__PURE__ */ N("span", { className: `nice-control-hint${i ? ` ${i}` : ""}`, "aria-hidden": "true", children: /* @__PURE__ */ N(
3265
- Vt,
3275
+ const c = Gn(), [d] = qn();
3276
+ return !c || !(s || d.hintDensity === "bar-and-controls") ? null : /* @__PURE__ */ C("span", { className: `nice-control-hint${i ? ` ${i}` : ""}`, "aria-hidden": "true", children: /* @__PURE__ */ C(
3277
+ Ft,
3266
3278
  {
3267
3279
  intent: e,
3268
- direction: t,
3280
+ direction: n,
3269
3281
  button: a,
3270
3282
  keys: r,
3271
3283
  size: o
@@ -3273,7 +3285,7 @@ const er = /* @__PURE__ */ Object.assign(
3273
3285
  ) });
3274
3286
  },
3275
3287
  { displayName: "NiceControlHint" }
3276
- ), vt = {
3288
+ ), mt = {
3277
3289
  en: {
3278
3290
  code: "en",
3279
3291
  name: "English",
@@ -3618,12 +3630,12 @@ const er = /* @__PURE__ */ Object.assign(
3618
3630
  ["ז", "ס", "ב", "ה", "נ", "מ", "צ", "ת", "ץ"]
3619
3631
  ]
3620
3632
  }
3621
- }, nr = (n) => n === "ar" || n === "he", q = {
3633
+ }, ar = (t) => t === "ar" || t === "he", q = {
3622
3634
  value: "Backspace",
3623
3635
  label: "⌫",
3624
3636
  type: "backspace",
3625
3637
  width: 1.5
3626
- }, ga = {
3638
+ }, ba = {
3627
3639
  value: "Enter",
3628
3640
  label: "⏎",
3629
3641
  type: "enter",
@@ -3638,12 +3650,12 @@ const er = /* @__PURE__ */ Object.assign(
3638
3650
  label: "⇧",
3639
3651
  type: "shift",
3640
3652
  width: 1.5
3641
- }, ba = {
3653
+ }, ya = {
3642
3654
  value: "CapsLock",
3643
3655
  label: "⇪",
3644
3656
  type: "caps",
3645
3657
  width: 1.75
3646
- }, ya = { value: "Tab", label: "⇥", type: "tab", width: 1.5 }, fe = [
3658
+ }, wa = { value: "Tab", label: "⇥", type: "tab", width: 1.5 }, fe = [
3647
3659
  { value: "1" },
3648
3660
  { value: "2" },
3649
3661
  { value: "3" },
@@ -3656,7 +3668,7 @@ const er = /* @__PURE__ */ Object.assign(
3656
3668
  { value: "0" },
3657
3669
  { value: "-" },
3658
3670
  { value: "=" }
3659
- ], wa = [
3671
+ ], Ea = [
3660
3672
  { value: "!" },
3661
3673
  { value: "@" },
3662
3674
  { value: "#" },
@@ -3667,7 +3679,7 @@ const er = /* @__PURE__ */ Object.assign(
3667
3679
  { value: "*" },
3668
3680
  { value: "(" },
3669
3681
  { value: ")" }
3670
- ], Ea = [
3682
+ ], ka = [
3671
3683
  { value: "-" },
3672
3684
  { value: "_" },
3673
3685
  { value: "=" },
@@ -3677,7 +3689,7 @@ const er = /* @__PURE__ */ Object.assign(
3677
3689
  { value: "{" },
3678
3690
  { value: "}" },
3679
3691
  q
3680
- ], ka = [
3692
+ ], za = [
3681
3693
  { value: "Esc", label: "Esc", type: "fn", width: 1 },
3682
3694
  { value: "F1", label: "F1", type: "fn" },
3683
3695
  { value: "F2", label: "F2", type: "fn" },
@@ -3696,7 +3708,7 @@ const er = /* @__PURE__ */ Object.assign(
3696
3708
  [{ value: "4" }, { value: "5" }, { value: "6" }],
3697
3709
  [{ value: "7" }, { value: "8" }, { value: "9" }],
3698
3710
  [{ value: ".", width: 1 }, { value: "0" }, q]
3699
- ], ar = [
3711
+ ], rr = [
3700
3712
  [{ value: "7" }, { value: "8" }, { value: "9" }, { value: "/", type: "special" }],
3701
3713
  [{ value: "4" }, { value: "5" }, { value: "6" }, { value: "*", type: "special" }],
3702
3714
  [{ value: "1" }, { value: "2" }, { value: "3" }, { value: "-", type: "special" }],
@@ -3706,7 +3718,7 @@ const er = /* @__PURE__ */ Object.assign(
3706
3718
  q,
3707
3719
  { value: "=", type: "enter", width: 2 }
3708
3720
  ]
3709
- ], rr = [
3721
+ ], sr = [
3710
3722
  [
3711
3723
  { value: "1", label: "1" },
3712
3724
  { value: "2", label: "2 ABC" },
@@ -3728,18 +3740,18 @@ const er = /* @__PURE__ */ Object.assign(
3728
3740
  { value: "#", label: "#" }
3729
3741
  ],
3730
3742
  [{ value: "Call", label: "Call", type: "enter", width: 1.5 }, q]
3731
- ], sr = [
3743
+ ], or = [
3732
3744
  [{ value: "1" }, { value: "2" }, { value: "3" }],
3733
3745
  [{ value: "4" }, { value: "5" }, { value: "6" }],
3734
3746
  [{ value: "7" }, { value: "8" }, { value: "9" }],
3735
3747
  [{ value: "Clear", label: "C", type: "fn" }, { value: "0" }, q]
3736
3748
  ];
3737
- function or(n, e, t, a, r) {
3738
- const s = vt[n] || vt.en, [o, i, c] = s.rows, d = { ...ga, ...r ? { label: r } : {} };
3749
+ function ir(t, e, n, a, r) {
3750
+ const s = mt[t] || mt.en, [o, i, c] = s.rows, d = { ...ba, ...r ? { label: r } : {} };
3739
3751
  if (e === "minimal")
3740
3752
  return xa;
3741
- if (t) {
3742
- const l = [fe.slice(0, 10), wa, Ea], p = [{ value: "ABC", label: "ABC", type: "fn", width: 1.5 }];
3753
+ if (n) {
3754
+ const l = [fe.slice(0, 10), Ea, ka], p = [{ value: "ABC", label: "ABC", type: "fn", width: 1.5 }];
3743
3755
  return a && p.push({ value: "Lang", label: "Lang", type: "lang", width: 1 }), p.push({ value: ",", width: 1 }), p.push({ ...se, width: a ? 3.5 : 4 }), p.push({ value: ".", width: 1 }), p.push(d), l.push(p), l;
3744
3756
  }
3745
3757
  if (e === "compact") {
@@ -3760,10 +3772,10 @@ function or(n, e, t, a, r) {
3760
3772
  return a && p.push({ value: "Lang", label: "Lang", type: "lang", width: 1 }), p.push({ value: ",", width: 1 }), p.push({ ...se, width: a ? 3 : 4 }), p.push({ value: ".", width: 1 }), p.push(d), l.push(p), l;
3761
3773
  }
3762
3774
  const u = [
3763
- ka,
3775
+ za,
3764
3776
  [...fe, q],
3765
- [ya, ...o.map((l) => ({ value: l }))],
3766
- [ba, ...i.map((l) => ({ value: l })), { ...d, width: 1.75 }],
3777
+ [wa, ...o.map((l) => ({ value: l }))],
3778
+ [ya, ...i.map((l) => ({ value: l })), { ...d, width: 1.75 }],
3767
3779
  [
3768
3780
  { ...oe, width: 2.25 },
3769
3781
  ...c.map((l) => ({ value: l })),
@@ -3779,137 +3791,137 @@ function or(n, e, t, a, r) {
3779
3791
  }
3780
3792
  return u;
3781
3793
  }
3782
- const Ve = (n, e) => Math.max(0, Math.min(n.length, e));
3783
- function ir(n, e, t) {
3784
- const a = Ve(n.text, n.caret), r = n.text.slice(0, a) + e + n.text.slice(a);
3785
- return t !== void 0 && r.length > t ? n : { text: r, caret: a + e.length };
3794
+ const Ve = (t, e) => Math.max(0, Math.min(t.length, e));
3795
+ function cr(t, e, n) {
3796
+ const a = Ve(t.text, t.caret), r = t.text.slice(0, a) + e + t.text.slice(a);
3797
+ return n !== void 0 && r.length > n ? t : { text: r, caret: a + e.length };
3786
3798
  }
3787
- function cr(n) {
3788
- const e = Ve(n.text, n.caret);
3799
+ function lr(t) {
3800
+ const e = Ve(t.text, t.caret);
3789
3801
  if (e === 0)
3790
- return { text: n.text, caret: e };
3791
- const t = e >= 2 && /[\uDC00-\uDFFF]/.test(n.text[e - 1]) ? 2 : 1;
3792
- return { text: n.text.slice(0, e - t) + n.text.slice(e), caret: e - t };
3802
+ return { text: t.text, caret: e };
3803
+ const n = e >= 2 && /[\uDC00-\uDFFF]/.test(t.text[e - 1]) ? 2 : 1;
3804
+ return { text: t.text.slice(0, e - n) + t.text.slice(e), caret: e - n };
3793
3805
  }
3794
- function lr(n, e) {
3795
- const t = e === "start" ? 0 : e === "end" ? n.text.length : Ve(n.text, n.caret + e);
3796
- return { text: n.text, caret: t };
3806
+ function ur(t, e) {
3807
+ const n = e === "start" ? 0 : e === "end" ? t.text.length : Ve(t.text, t.caret + e);
3808
+ return { text: t.text, caret: n };
3797
3809
  }
3798
- const za = /* @__PURE__ */ new Set(["Shift", "Control", "Alt", "Meta", "AltGraph"]);
3799
- function ur() {
3800
- let n = !1;
3810
+ const Aa = /* @__PURE__ */ new Set(["Shift", "Control", "Alt", "Meta", "AltGraph"]);
3811
+ function dr() {
3812
+ let t = !1;
3801
3813
  return (e) => {
3802
3814
  if (e.key === "Tab") {
3803
- const t = n;
3804
- return n = !1, t;
3815
+ const n = t;
3816
+ return t = !1, n;
3805
3817
  }
3806
- return za.has(e.key) || (n = e.key === "Escape"), !1;
3818
+ return Aa.has(e.key) || (t = e.key === "Escape"), !1;
3807
3819
  };
3808
3820
  }
3809
3821
  export {
3810
3822
  U as $,
3811
- ya as A,
3823
+ wa as A,
3812
3824
  Ae as B,
3813
- tr as C,
3814
- Xa as D,
3815
- Vn as E,
3825
+ nr as C,
3826
+ Ja as D,
3827
+ Fn as E,
3816
3828
  Ha as F,
3817
- Bn as G,
3818
- er as H,
3829
+ Kn as G,
3830
+ tr as H,
3819
3831
  Da as I,
3820
- Ua as J,
3821
- Fa as K,
3822
- an as L,
3823
- Va as M,
3832
+ Ga as J,
3833
+ _a as K,
3834
+ rn as L,
3835
+ Fa as M,
3824
3836
  ee as N,
3825
- kn as O,
3826
- or as P,
3827
- Nt as Q,
3828
- Ia as R,
3829
- Ga as S,
3830
- qt as T,
3831
- on as U,
3832
- ur as V,
3833
- cr as W,
3834
- sn as X,
3837
+ zn as O,
3838
+ ir as P,
3839
+ Tt as Q,
3840
+ Oa as R,
3841
+ qa as S,
3842
+ $t as T,
3843
+ cn as U,
3844
+ dr as V,
3845
+ lr as W,
3846
+ on as X,
3835
3847
  ve as Y,
3836
- Pn as Z,
3848
+ In as Z,
3837
3849
  Dn as _,
3838
- Ba as a,
3839
- pn as a0,
3840
- vn as a1,
3841
- En as a2,
3842
- tn as a3,
3843
- ir as a4,
3844
- gn as a5,
3845
- yt as a6,
3846
- Et as a7,
3850
+ Ka as a,
3851
+ vn as a0,
3852
+ mn as a1,
3853
+ kn as a2,
3854
+ nn as a3,
3855
+ cr as a4,
3856
+ bn as a5,
3857
+ wt as a6,
3858
+ kt as a7,
3847
3859
  te as a8,
3848
- Zn as a9,
3849
- Ka as aA,
3850
- Wa as aB,
3851
- Oa as aC,
3852
- Un as aD,
3860
+ Qn as a9,
3861
+ ja as aA,
3862
+ Xa as aB,
3863
+ Ra as aC,
3864
+ Gn as aD,
3853
3865
  K as aE,
3854
- At as aF,
3855
- Gn as aG,
3856
- Ot as aH,
3857
- $a as aI,
3858
- Ja as aJ,
3859
- Za as aK,
3860
- Na as aL,
3861
- Ya as aM,
3866
+ Lt as aF,
3867
+ qn as aG,
3868
+ Rt as aH,
3869
+ Ya as aI,
3870
+ Za as aJ,
3871
+ Qa as aK,
3872
+ Ta as aL,
3873
+ Wa as aM,
3862
3874
  St as aN,
3863
- rn as aO,
3864
- nr as aa,
3865
- gt as ab,
3866
- ht as ac,
3867
- lr as ad,
3875
+ sn as aO,
3876
+ ar as aa,
3877
+ bt as ab,
3878
+ ft as ac,
3879
+ ur as ad,
3868
3880
  Re as ae,
3869
3881
  Ht as af,
3870
- Pt as ag,
3871
- Tt as ah,
3882
+ It as ag,
3883
+ Pt as ah,
3872
3884
  X as ai,
3873
- wn as aj,
3885
+ En as aj,
3874
3886
  Ee as ak,
3875
- $e as al,
3876
- $t as am,
3877
- Ca as an,
3878
- Pa as ao,
3879
- Ln as ap,
3880
- ze as aq,
3881
- pa as ar,
3882
- ln as as,
3883
- Qa as at,
3884
- Ra as au,
3885
- ja as av,
3886
- Lt as aw,
3887
- qa as ax,
3888
- ca as ay,
3889
- nn as az,
3890
- Vt as b,
3891
- wt as c,
3892
- ea as d,
3893
- oa as e,
3894
- ia as f,
3895
- Kn as g,
3896
- Ta as h,
3897
- qe as i,
3887
+ Ye as al,
3888
+ Yt as am,
3889
+ Na as an,
3890
+ Ia as ao,
3891
+ Cn as ap,
3892
+ xe as aq,
3893
+ va as ar,
3894
+ un as as,
3895
+ er as at,
3896
+ Va as au,
3897
+ Ua as av,
3898
+ Ct as aw,
3899
+ $a as ax,
3900
+ la as ay,
3901
+ an as az,
3902
+ Ft as b,
3903
+ Et as c,
3904
+ ta as d,
3905
+ ia as e,
3906
+ ca as f,
3907
+ jn as g,
3908
+ Pa as h,
3909
+ $e as i,
3898
3910
  we as j,
3899
3911
  ne as k,
3900
3912
  de as l,
3901
3913
  Y as m,
3902
- _a as n,
3903
- xe as o,
3904
- vt as p,
3914
+ Ba as n,
3915
+ ze as o,
3916
+ mt as p,
3905
3917
  xa as q,
3906
- ar as r,
3907
- rr as s,
3908
- sr as t,
3909
- Yn as u,
3918
+ rr as r,
3919
+ sr as s,
3920
+ or as t,
3921
+ Wn as u,
3910
3922
  q as v,
3911
- ba as w,
3912
- ga as x,
3923
+ ya as w,
3924
+ ba as x,
3913
3925
  oe as y,
3914
3926
  se as z
3915
3927
  };