@nice2dev/ui-core 1.3.8 → 1.3.10

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.
@@ -0,0 +1,3915 @@
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([
5
+ "",
6
+ "text",
7
+ "search",
8
+ "email",
9
+ "url",
10
+ "tel",
11
+ "password"
12
+ ]), Te = /* @__PURE__ */ new Set([
13
+ "number",
14
+ "range",
15
+ "date",
16
+ "time",
17
+ "datetime-local",
18
+ "month",
19
+ "week"
20
+ ]), jt = /* @__PURE__ */ new Set([
21
+ "checkbox",
22
+ "radio",
23
+ "button",
24
+ "submit",
25
+ "reset",
26
+ "file",
27
+ "image",
28
+ "color"
29
+ ]), Ut = /* @__PURE__ */ new Set([
30
+ "button",
31
+ "link",
32
+ "checkbox",
33
+ "radio",
34
+ "switch",
35
+ "tab",
36
+ "menuitem",
37
+ "menuitemcheckbox",
38
+ "menuitemradio",
39
+ "option",
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;
45
+ }
46
+ function yt(n) {
47
+ if (n instanceof HTMLButtonElement || n.tagName === "SUMMARY")
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();
59
+ return;
60
+ }
61
+ const e = n.ownerDocument.defaultView;
62
+ n.dispatchEvent(
63
+ new ((e == null ? void 0 : e.MouseEvent) ?? MouseEvent)("click", {
64
+ bubbles: !0,
65
+ cancelable: !0,
66
+ composed: !0
67
+ })
68
+ );
69
+ }
70
+ function wt(n) {
71
+ if (n.defaultPrevented || n.repeat || n.target !== n.currentTarget || n.key !== "Enter" && n.key !== " " && n.key !== "Spacebar")
72
+ return;
73
+ const e = n.currentTarget;
74
+ if (!e || typeof e.dispatchEvent != "function")
75
+ return;
76
+ n.preventDefault();
77
+ const t = e.ownerDocument.defaultView;
78
+ e.dispatchEvent(
79
+ new ((t == null ? void 0 : t.MouseEvent) ?? MouseEvent)("click", {
80
+ bubbles: !0,
81
+ cancelable: !0,
82
+ composed: !0,
83
+ ctrlKey: !!n.ctrlKey,
84
+ shiftKey: !!n.shiftKey,
85
+ altKey: !!n.altKey,
86
+ metaKey: !!n.metaKey
87
+ })
88
+ );
89
+ }
90
+ function ve(n) {
91
+ const e = n.getAttribute("data-nice-engage");
92
+ if (e === "value" || e === "text" || e === "popup" || e === "canvas")
93
+ return e;
94
+ if (e === "none")
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;
98
+ }
99
+ function Et(n, e) {
100
+ return e === "popup" ? n.getAttribute("aria-expanded") === "true" : n.hasAttribute("data-nice-engaged");
101
+ }
102
+ function ie(n) {
103
+ return n instanceof HTMLSelectElement || n instanceof HTMLInputElement && Te.has(n.type);
104
+ }
105
+ function me(n) {
106
+ n.dispatchEvent(new Event("input", { bubbles: !0 })), n.dispatchEvent(new Event("change", { bubbles: !0 }));
107
+ }
108
+ function De(n, e) {
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;
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);
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)
119
+ try {
120
+ n.setSelectionRange(t, t);
121
+ } catch {
122
+ }
123
+ }
124
+ function Yt(n, e) {
125
+ n.value !== e && (De(n, e), me(n));
126
+ }
127
+ function ce(n, e, t = "step") {
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;
133
+ else {
134
+ const i = t === "big" ? 10 : 1;
135
+ n.selectedIndex = Math.max(0, Math.min(o, s + (a ? i : -i)));
136
+ }
137
+ return n.selectedIndex !== s ? (me(n), !0) : !1;
138
+ }
139
+ const r = n.value;
140
+ try {
141
+ if (t === "edge" && (n.min !== "" || n.max !== ""))
142
+ De(n, a ? n.max || n.value : n.min || n.value);
143
+ else {
144
+ const s = t === "big" ? 10 : 1;
145
+ a ? n.stepUp(s) : n.stepDown(s);
146
+ }
147
+ } catch {
148
+ return !1;
149
+ }
150
+ return n.value !== r ? (me(n), !0) : !1;
151
+ }
152
+ function Wt(n, e) {
153
+ if (!(gt(n) || Pe(n)) || n.selectionStart === null || e !== "left" && e !== "right")
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 = {
159
+ // Navigation
160
+ "chevron-down": "M6 9l6 6 6-6",
161
+ "chevron-up": "M18 15l-6-6-6 6",
162
+ "chevron-left": "M15 18l-6-6 6-6",
163
+ "chevron-right": "M9 6l6 6-6 6",
164
+ "arrow-left": "M19 12H5m0 0l7 7m-7-7l7-7",
165
+ "arrow-right": "M5 12h14m0 0l-7-7m7 7l-7 7",
166
+ "arrow-up": "M12 19V5m0 0l-7 7m7-7l7 7",
167
+ "arrow-down": "M12 5v14m0 0l7-7m-7 7l-7-7",
168
+ // Actions
169
+ close: "M18 6L6 18M6 6l12 12",
170
+ plus: "M12 5v14m-7-7h14",
171
+ minus: "M5 12h14",
172
+ check: "M5 13l4 4L19 7",
173
+ edit: "M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7M18.5 2.5a2.121 2.121 0 113 3L12 15l-4 1 1-4 9.5-9.5z",
174
+ trash: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16",
175
+ 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
+ download: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4",
177
+ 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",
179
+ // UI
180
+ search: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z",
181
+ 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",
182
+ "sort-asc": "M3 4h13M3 8h9m-9 4h6m4 0l4-4m0 0l4 4m-4-4v12",
183
+ "sort-desc": "M3 4h13M3 8h9m-9 4h9m5-4v12m0 0l-4-4m4 4l4-4",
184
+ // Neutral "sortable" indicator: a small up-chevron over a down-chevron.
185
+ sort: "M6 10l6-6 6 6M6 14l6 6 6-6",
186
+ menu: "M4 6h16M4 12h16M4 18h16",
187
+ "more-vertical": "M12 5v.01M12 12v.01M12 19v.01",
188
+ "more-horizontal": "M5 12h.01M12 12h.01M19 12h.01",
189
+ settings: "M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z M15 12a3 3 0 11-6 0 3 3 0 016 0z",
190
+ eye: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z M15 12a3 3 0 11-6 0 3 3 0 016 0z",
191
+ "eye-off": "M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24 M1 1l22 22",
192
+ lock: "M19 11H5a2 2 0 00-2 2v7a2 2 0 002 2h14a2 2 0 002-2v-7a2 2 0 00-2-2zm-3-4a4 4 0 10-8 0v4h8V7z",
193
+ // Status
194
+ info: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",
195
+ warning: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z",
196
+ error: "M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z",
197
+ success: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z",
198
+ help: "M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",
199
+ // Content
200
+ calendar: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z",
201
+ clock: "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z",
202
+ file: "M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z",
203
+ folder: "M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z",
204
+ image: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z",
205
+ link: "M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1",
206
+ mail: "M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z",
207
+ phone: "M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z",
208
+ // the device, as `phone` is the handset
209
+ smartphone: "M7 2h10a2 2 0 012 2v16a2 2 0 01-2 2H7a2 2 0 01-2-2V4a2 2 0 012-2z M11 18h2",
210
+ user: "M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z",
211
+ users: "M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z",
212
+ home: "M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6",
213
+ 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
+ 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
+ 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",
217
+ hash: "M4 9h16M4 15h16M10 3L8 21M16 3l-2 18",
218
+ list: "M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01",
219
+ circle: "M12 21a9 9 0 100-18 9 9 0 000 18z",
220
+ // UI component / element types (palettes, builders)
221
+ box: "M21 8a2 2 0 00-1-1.73l-7-4a2 2 0 00-2 0l-7 4A2 2 0 003 8v8a2 2 0 001 1.73l7 4a2 2 0 002 0l7-4A2 2 0 0021 16V8z M3.27 6.96L12 12.01l8.73-5.05 M12 22.08V12",
222
+ tabs: "M3 9h18v10H3z M7 9V5h6v4",
223
+ columns: "M4 4h7v16H4z M13 4h7v16h-7z",
224
+ grid: "M3 3h7v7H3z M14 3h7v7h-7z M14 14h7v7h-7z M3 14h7v7H3z",
225
+ table: "M3 5h18v14H3z M3 10h18M3 15h18M9 5v14M15 5v14",
226
+ heading: "M6 4v16M18 4v16M6 12h12",
227
+ type: "M4 7V4h16v3M9 20h6M12 4v16",
228
+ "align-left": "M3 6h18M3 12h12M3 18h15",
229
+ input: "M4 9h16a1 1 0 011 1v4a1 1 0 01-1 1H4a1 1 0 01-1-1v-4a1 1 0 011-1z M7 12h5",
230
+ button: "M5 9h14a2 2 0 012 2v2a2 2 0 01-2 2H5a2 2 0 01-2-2v-2a2 2 0 012-2z",
231
+ select: "M4 6h16a1 1 0 011 1v10a1 1 0 01-1 1H4a1 1 0 01-1-1V7a1 1 0 011-1z M15 11l-3 3-3-3",
232
+ "check-square": "M9 11l3 3L22 4 M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11",
233
+ video: "M23 7l-7 5 7 5V7z M16 5H3a2 2 0 00-2 2v10a2 2 0 002 2h13a2 2 0 002-2V7a2 2 0 00-2-2z",
234
+ card: "M3 5h18a1 1 0 011 1v12a1 1 0 01-1 1H3a1 1 0 01-1-1V6a1 1 0 011-1z M3 10h18",
235
+ // App / infra / media concepts
236
+ "bar-chart": "M6 20v-6M12 20V4M18 20v-10",
237
+ "line-chart": "M3 3v18h18 M7 15l4-4 3 3 5-6",
238
+ "area-chart": "M3 3v18h18 M7 17v-3l4-4 3 3 5-6v10z",
239
+ "pie-chart": "M21.21 15.89A10 10 0 118 2.83 M22 12A10 10 0 0012 2v10z",
240
+ "donut-chart": "M12 3a9 9 0 100 18 9 9 0 000-18z M12 8a4 4 0 100 8 4 4 0 000-8z",
241
+ "scatter-chart": "M3 3v18h18 M8 16h.01 M11 11h.01 M15 14h.01 M18 8h.01",
242
+ "bars-vertical": "M6 5v14M12 5v14M18 5v14",
243
+ globe: "M12 3a9 9 0 100 18 9 9 0 000-18z M3 12h18 M12 3a14 14 0 010 18 M12 3a14 14 0 000 18",
244
+ monitor: "M3 4h18a1 1 0 011 1v11a1 1 0 01-1 1H3a1 1 0 01-1-1V5a1 1 0 011-1z M8 21h8 M12 17v4",
245
+ camera: "M23 19a2 2 0 01-2 2H3a2 2 0 01-2-2V8a2 2 0 012-2h3l2-3h6l2 3h3a2 2 0 012 2z M12 17a4 4 0 100-8 4 4 0 000 8z",
246
+ plug: "M9 2v5 M15 2v5 M7 7h10v3a5 5 0 01-10 0V7z M12 15v7",
247
+ save: "M19 21H5a2 2 0 01-2-2V5a2 2 0 012-2h11l5 5v11a2 2 0 01-2 2z M17 21v-8H7v8 M7 3v5h8",
248
+ tag: "M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z M7 7h.01",
249
+ palette: "M12 2a10 10 0 000 20 2 2 0 002-2c0-.5-.2-1-.5-1.3a2 2 0 01-.5-1.2 2 2 0 012-2H17a5 5 0 005-5c0-5-4.5-9-10-9z M6.5 11.5h.01 M9.5 7.5h.01 M14.5 7.5h.01",
250
+ book: "M4 19.5A2.5 2.5 0 016.5 17H20 M6.5 2H20v20H6.5A2.5 2.5 0 014 19.5v-15A2.5 2.5 0 016.5 2z",
251
+ cloud: "M18 10h-1.26A8 8 0 109 20h9a5 5 0 000-10z",
252
+ target: "M12 3a9 9 0 100 18 9 9 0 000-18z M12 7a5 5 0 100 10 5 5 0 000-10z M12 11a1 1 0 100 2 1 1 0 000-2z",
253
+ message: "M21 11.5a8.5 8.5 0 01-8.5 8.5 8.4 8.4 0 01-3.8-.9L3 21l1.9-5.7a8.4 8.4 0 01-.9-3.8A8.5 8.5 0 0112.5 3 8.5 8.5 0 0121 11.5z",
254
+ flask: "M9 2h6 M10 2v6.5L4.5 19a1 1 0 00.9 1.5h13.2a1 1 0 00.9-1.5L14 8.5V2 M7 15h10",
255
+ rocket: "M12 15l-3-3a22 22 0 012-3.95A12.88 12.88 0 0122 2c0 2.72-.78 7.5-6 11a22 22 0 01-3.95 2z M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0 M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5 M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 00-2.91-.09z",
256
+ music: "M9 18V5l12-2v13 M9 18a3 3 0 11-6 0 3 3 0 016 0z M21 16a3 3 0 11-6 0 3 3 0 016 0z",
257
+ wifi: "M5 12.55a11 11 0 0114 0 M8.5 16.11a6 6 0 017 0 M12 20h.01 M2 8.82a15 15 0 0120 0",
258
+ database: "M12 8c4.97 0 9-1.34 9-3s-4.03-3-9-3-9 1.34-9 3 4.03 3 9 3z M21 5v6c0 1.66-4.03 3-9 3s-9-1.34-9-3V5 M21 11v6c0 1.66-4.03 3-9 3s-9-1.34-9-3v-6",
259
+ slash: "M12 3a9 9 0 100 18 9 9 0 000-18z M5.6 5.6l12.8 12.8",
260
+ puzzle: "M19.4 13.6a1.6 1.6 0 10.2-3.2H19V7a2 2 0 00-2-2h-3.4v-.4a1.6 1.6 0 10-3.2 0V5H7a2 2 0 00-2 2v3.4h.4a1.6 1.6 0 100 3.2H5V17a2 2 0 002 2h3.4v.4a1.6 1.6 0 103.2 0V19H17a2 2 0 002-2v-3.4z",
261
+ dollar: "M12 1v22 M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6",
262
+ printer: "M6 9V2h12v7 M6 18H4a2 2 0 01-2-2v-5a2 2 0 012-2h16a2 2 0 012 2v5a2 2 0 01-2 2h-2 M6 14h12v8H6z",
263
+ scale: "M12 3v18 M5 21h14 M5 7l7-2 7 2 M2 13a3 3 0 006 0L5 7zm14 0a3 3 0 006 0L19 7z",
264
+ accessibility: "M12 3a9 9 0 100 18 9 9 0 000-18z M12 9a1.5 1.5 0 100-3 1.5 1.5 0 000 3z M7.5 10.5l4.5 1 4.5-1 M12 11.5v3.5l-2 3.5 M12 15l2 3.5",
265
+ window: "M3 4h18a1 1 0 011 1v14a1 1 0 01-1 1H3a1 1 0 01-1-1V5a1 1 0 011-1z M2 9h20 M6 6.5h.01 M9 6.5h.01",
266
+ "map-pin": "M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z M12 13a3 3 0 100-6 3 3 0 000 6z",
267
+ cursor: "M5 3l14 7-6 2-2 6-6-15z",
268
+ shuffle: "M16 3h5v5 M4 20L21 3 M21 16v5h-5 M15 15l6 6 M4 4l5 5",
269
+ lightbulb: "M9 18h6 M10 22h4 M12 2a7 7 0 00-4 12.7c.6.5 1 1.3 1 2.1V18h6v-1.2c0-.8.4-1.6 1-2.1A7 7 0 0012 2z",
270
+ server: "M3 4h18a1 1 0 011 1v4a1 1 0 01-1 1H3a1 1 0 01-1-1V5a1 1 0 011-1z M3 14h18a1 1 0 011 1v4a1 1 0 01-1 1H3a1 1 0 01-1-1v-4a1 1 0 011-1z M7 7h.01 M7 17h.01",
271
+ terminal: "M4 17l6-6-6-6 M12 19h8",
272
+ "git-branch": "M6 3v12 M18 9a3 3 0 100-6 3 3 0 000 6z M6 21a3 3 0 100-6 3 3 0 000 6z M18 9a9 9 0 01-9 9",
273
+ send: "M22 2L11 13 M22 2l-7 20-4-9-9-4 20-7z",
274
+ // Media
275
+ play: "M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z M21 12a9 9 0 11-18 0 9 9 0 0118 0z",
276
+ pause: "M10 9v6m4-6v6m7-3a9 9 0 11-18 0 9 9 0 0118 0z",
277
+ stop: "M21 12a9 9 0 11-18 0 9 9 0 0118 0z M9 10a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z",
278
+ mic: "M12 1a3 3 0 00-3 3v8a3 3 0 006 0V4a3 3 0 00-3-3zM19 10v2a7 7 0 01-14 0v-2M12 19v4M8 23h8",
279
+ volume: "M11 5L6 9H2v6h4l5 4V5z M15.54 8.46a5 5 0 010 7.07 M19.07 4.93a10 10 0 010 14.14",
280
+ "volume-off": "M11 5L6 9H2v6h4l5 4V5z M23 9l-6 6 M17 9l6 6",
281
+ "skip-back": "M19 20L9 12l10-8v16z M5 19V5",
282
+ // Toggle
283
+ expand: "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4",
284
+ collapse: "M9 9V5m0 4H5m4 0L4 4m11 5h4m-4 0V5m0 4l5-5M9 15v4m0-4H5m4 0l-5 5m15-5h-4m4 0v4m0-4l-5 5",
285
+ "external-link": "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14",
286
+ // Extended set (entities, gamification, status)
287
+ briefcase: "M20 7H4a2 2 0 00-2 2v9a2 2 0 002 2h16a2 2 0 002-2V9a2 2 0 00-2-2zM16 7V5a2 2 0 00-2-2h-4a2 2 0 00-2 2v2M2 12h20",
288
+ building: "M4 22V4a2 2 0 012-2h12a2 2 0 012 2v18M4 22h16M9 22v-4h6v4M9 6h.01M15 6h.01M9 10h.01M15 10h.01M9 14h.01M15 14h.01",
289
+ medal: "M15.477 12.89L17 22l-5-3-5 3 1.523-9.11M12 15a6 6 0 100-12 6 6 0 000 12z",
290
+ clipboard: "M9 2h6a1 1 0 011 1v1a1 1 0 01-1 1H9a1 1 0 01-1-1V3a1 1 0 011-1zM16 4h2a2 2 0 012 2v14a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2h2",
291
+ "skip-forward": "M5 4l10 8-10 8V4zM19 5v14",
292
+ "at-sign": "M12 16a4 4 0 100-8 4 4 0 000 8zM16 12v1.5a2.5 2.5 0 005 0V12a9 9 0 10-3.5 7.14",
293
+ gift: "M20 12v10H4V12M2 7h20v5H2zM12 22V7M12 7H7.5a2.5 2.5 0 010-5C11 2 12 7 12 7zM12 7h4.5a2.5 2.5 0 000-5C13 2 12 7 12 7z",
294
+ archive: "M21 8v13H3V8M1 3h22v5H1zM10 12h4",
295
+ reply: "M9 17l-5-5 5-5M4 12h11a4 4 0 014 4v2",
296
+ forward: "M15 17l5-5-5-5M20 12H9a4 4 0 00-4 4v2",
297
+ paperclip: "M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48",
298
+ zap: "M13 2L3 14h9l-1 8 10-12h-9l1-8z",
299
+ // Graphics / drawing tools (vector / pixel / photo / game editors)
300
+ square: "M4 4h16v16H4z",
301
+ triangle: "M12 4L3 20h18z",
302
+ hexagon: "M7.5 3h9l4.5 9-4.5 9h-9L3 12z",
303
+ diamond: "M12 2l10 10-10 10L2 12z",
304
+ line: "M5 19L19 5",
305
+ pen: "M12 19l7-7 3 3-7 7-3-3z M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z M11 11a2 2 0 100-4 2 2 0 000 4z",
306
+ brush: "M9.06 11.9l8.07-8.06a2.85 2.85 0 114.03 4.03l-8.06 8.08 M7.07 14.94c-1.66 0-3 1.35-3 3.02 0 1.33-2.5 1.52-2 2.02 1.08 1.1 2.49 2.02 4 2.02 2.2 0 4-1.8 4-4.04a3.01 3.01 0 00-3-3.02z",
307
+ droplet: "M12 2.69l5.66 5.66a8 8 0 11-11.31 0z",
308
+ bucket: "M5 8h14l-1.5 11a2 2 0 01-2 1.8H8.5a2 2 0 01-2-1.8L5 8z M5 8l2-4h10l2 4",
309
+ scissors: "M6 9a3 3 0 100-6 3 3 0 000 6z M6 21a3 3 0 100-6 3 3 0 000 6z M20 4L8.12 15.88 M14.47 14.48L20 20 M8.12 8.12L12 12",
310
+ layers: "M12 2l9 5-9 5-9-5 9-5z M3 12l9 5 9-5 M3 17l9 5 9-5",
311
+ crop: "M6 2v14a2 2 0 002 2h14 M2 6h14a2 2 0 012 2v14",
312
+ eyedropper: "M2 22l1-1h3l9-9 M3 21v-3l9-9 M15 6l3.5-3.5a2.12 2.12 0 013 3L18 9l-3-3z",
313
+ ruler: "M21.3 8.7l-6-6a1 1 0 00-1.4 0L2.7 13.9a1 1 0 000 1.4l6 6a1 1 0 001.4 0L21.3 10.1a1 1 0 000-1.4z M7.5 10.5l2 2 M11 7l2 2 M14.5 3.5l2 2",
314
+ wand: "M15 4V2 M15 16v-2 M8 9h2 M20 9h2 M3 21l9-9 M12.2 6.2L11 5 M17.8 6.2L19 5 M17.8 11.8L19 13",
315
+ move: "M5 9l-3 3 3 3 M9 5l3-3 3 3 M15 19l-3 3-3-3 M19 9l3 3-3 3 M2 12h20 M12 2v20",
316
+ gamepad: "M6 12h4 M8 10v4 M15 13h.01 M18 11h.01 M2 12a4 4 0 014-4h12a4 4 0 014 4l-1.5 6a2 2 0 01-2 1.5H5.5a2 2 0 01-2-1.5L2 12z",
317
+ eraser: "M7 21l-4.3-4.3a1 1 0 010-1.4l9.6-9.6a2 2 0 012.8 0l4.6 4.6a2 2 0 010 2.8L13 21H7z M22 21H7 M5 12l5 5",
318
+ // Buildings / interior / fixtures (spatial / floor-plan / smart-home / real-estate editors)
319
+ thermometer: "M14 14.76V3.5a2.5 2.5 0 00-5 0v11.26a4.5 4.5 0 105 0z",
320
+ door: "M18 20V5a1 1 0 00-1-1H7a1 1 0 00-1 1v15 M3 20h18 M13 11.5h.01",
321
+ stairs: "M3 20h3v-3h3v-3h3v-3h3v-3h3",
322
+ elevator: "M5 3h14a1 1 0 011 1v16a1 1 0 01-1 1H5a1 1 0 01-1-1V4a1 1 0 011-1z M9.5 9L12 6.5 14.5 9 M9.5 15l2.5 2.5 2.5-2.5",
323
+ bed: "M2 4v16 M2 8h18a2 2 0 012 2v10 M22 17H2 M6 8v4 M2 12h4",
324
+ sofa: "M3 9V7a2 2 0 012-2h14a2 2 0 012 2v2 M21 9a2 2 0 00-2 2v3H5v-3a2 2 0 00-2-2 2 2 0 00-2 2v4a1 1 0 001 1h18a1 1 0 001-1v-4a2 2 0 00-2-2 M5 18v2 M19 18v2",
325
+ chair: "M6 11V5a2 2 0 012-2h8a2 2 0 012 2v6 M5 11h14 M6 11l-1 8h14l-1-8 M6 19v2 M18 19v2",
326
+ utensils: "M3 2v7a2 2 0 002 2 2 2 0 002-2V2 M5 2v20 M21 2v9c0 1-1 1.8-2 1.8h-1V20 M18 2v9",
327
+ mountain: "M8 3l4 8 5-5 5 15H2L8 3z",
328
+ tree: "M12 2L7 11h10L12 2z M9 11l3 5 3-5 M12 16v6",
329
+ sun: "M12 17a5 5 0 100-10 5 5 0 000 10z M12 1v2 M12 21v2 M4.22 4.22l1.42 1.42 M18.36 18.36l1.42 1.42 M1 12h2 M21 12h2 M4.22 19.78l1.42-1.42 M18.36 5.64l1.42-1.42",
330
+ moon: "M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z",
331
+ // Rich-text editing (NiceHtmlEditor toolbar, document editors)
332
+ "list-ordered": "M10 6h11M10 12h11M10 18h11M4 6h1v4M4 10h2M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",
333
+ 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
+ code: "M16 18l6-6-6-6M8 6l-6 6 6 6",
335
+ 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",
338
+ "align-center": "M3 6h18M6 12h12M3 18h18",
339
+ "align-right": "M3 6h18M9 12h12M3 18h18",
340
+ "align-justify": "M3 6h18M3 12h18M3 18h18",
341
+ "align-top": "M4 4h16M9 8v12M15 8v7",
342
+ "align-middle": "M4 12h16M9 5v14M15 8v8",
343
+ "align-bottom": "M4 20h16M9 4v12M15 9v7",
344
+ "distribute-h": "M4 4v16M20 4v16M10 7h4v10h-4z",
345
+ "distribute-v": "M4 4h16M4 20h16M7 10h10v4H7z",
346
+ parallelogram: "M7 5h14l-4 14H3z",
347
+ barcode: "M4 5v14M6.5 5v14M10 5v14M13 5v14M15.5 5v14M19 5v14M20.5 5v14",
348
+ "qr-code": "M4 4h6v6H4z M14 4h6v6h-6z M4 14h6v6H4z M14 14h2v2h-2z M18 14h2v2h-2z M14 18h2v2h-2z M18 18h2v2h-2z",
349
+ smile: "M12 22a10 10 0 1 1 0-20 10 10 0 0 1 0 20zM8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01",
350
+ undo: "M9 14L4 9l5-5M4 9h10.5a5.5 5.5 0 010 11H11",
351
+ redo: "M15 14l5-5-5-5M20 9H9.5a5.5 5.5 0 000 11H13",
352
+ unlock: "M19 11H5a2 2 0 00-2 2v7a2 2 0 002 2h14a2 2 0 002-2v-7a2 2 0 00-2-2z M7 11V7a5 5 0 019.9-1",
353
+ keyboard: "M4 6h16a2 2 0 012 2v8a2 2 0 01-2 2H4a2 2 0 01-2-2V8a2 2 0 012-2z M6 10h.01 M10 10h.01 M14 10h.01 M18 10h.01 M8 14h8",
354
+ "page-break": "M6 3v5h12V3 M6 21v-5h12v5 M2 12h3 M8 12h3 M13 12h3 M19 12h3",
355
+ shield: "M12 2l8 3v6c0 5-3.4 9.4-8 11-4.6-1.6-8-6-8-11V5z",
356
+ repeat: "M17 2l4 4-4 4 M3 11V9a4 4 0 014-4h14 M7 22l-4-4 4-4 M21 13v2a4 4 0 01-4 4H3",
357
+ // 1.2.1: for the controls that drew these as inline <svg>
358
+ pin: "M12 17v5 M5 17h14l-1.5-3V8a2 2 0 00-2-2h-7a2 2 0 00-2 2v6z",
359
+ "mic-off": "M1 1l22 22 M9 9v3a3 3 0 005.12 2.12 M15 9.34V4a3 3 0 00-5.94-.6 M17 16.95A7 7 0 015 12v-2 M19 10v2a7 7 0 01-.11 1.23 M12 19v4 M8 23h8",
360
+ "log-out": "M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4 M16 17l5-5-5-5 M21 12H9",
361
+ "chevrons-left": "M11 17l-5-5 5-5 M18 17l-5-5 5-5",
362
+ "chevrons-right": "M13 17l5-5-5-5 M6 17l5-5-5-5",
363
+ "zoom-in": "M11 4a7 7 0 100 14 7 7 0 000-14z M21 21l-4.35-4.35 M11 8v6 M8 11h6",
364
+ "zoom-out": "M11 4a7 7 0 100 14 7 7 0 000-14z M21 21l-4.35-4.35 M8 11h6",
365
+ navigation: "M12 2l7 19-7-4-7 4z",
366
+ "refresh-ccw": "M1 4v6h6 M23 20v-6h-6 M20.49 9A9 9 0 005.64 5.64L1 10 M3.51 15a9 9 0 0014.85 3.36L23 14",
367
+ minimize: "M4 14h6v6 M20 10h-6V4 M14 10l7-7 M3 21l7-7",
368
+ // 1.2.2: geometry tools and object grouping, drawn as glyphs before (Ntd* of the same names in icons)
369
+ point: "M12 8a4 4 0 1 0 0 8a4 4 0 1 0 0-8z M12 12h.01",
370
+ segment: "M6.5 17.5L17.5 6.5 M3 19a2 2 0 1 0 4 0a2 2 0 1 0-4 0 M17 5a2 2 0 1 0 4 0a2 2 0 1 0-4 0",
371
+ perpendicular: "M3 20h18 M12 20V4 M12 15h5v5",
372
+ parallel: "M4 16L14 6 M10 20L20 10",
373
+ midpoint: "M3 12h6 M15 12h6 M3 9v6 M21 9v6 M12 9a3 3 0 1 0 0 6a3 3 0 1 0 0-6z",
374
+ "angle-bisector": "M4 20h17 M4 20L16 5 M4 20l14.4-6.9 M10 20a6 6 0 0 0-2.25-4.68",
375
+ group: "M3 7V3h4 M17 3h4v4 M21 17v4h-4 M7 21H3v-4 M7 7h5v5H7z M12 12h5v5h-5z",
376
+ ungroup: "M3 3h8v8H3z M13 13h8v8h-8z",
377
+ // 1.3.0: button and key glyphs of the input prompts (ADR-005 § 8, decision 0.8). Outline here;
378
+ // the filled, coloured Ntd* of @nice2dev/icons carry the same names in its resolver.
379
+ "pad-xbox-a": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M9.25 16l2.75-8 2.75 8 M10.2 13.25h3.6",
380
+ "pad-xbox-b": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M9.75 8v8 M9.75 8h2.5a2 2 0 0 1 0 4h-2.5 M9.75 12h3a2 2 0 0 1 0 4h-3",
381
+ "pad-xbox-x": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M9.5 8l5 8 M14.5 8l-5 8",
382
+ "pad-xbox-y": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M9.5 8l2.5 4 2.5-4 M12 12v4",
383
+ "pad-nintendo-a": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M9.25 16l2.75-8 2.75 8 M10.2 13.25h3.6",
384
+ "pad-nintendo-b": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M9.75 8v8 M9.75 8h2.5a2 2 0 0 1 0 4h-2.5 M9.75 12h3a2 2 0 0 1 0 4h-3",
385
+ "pad-nintendo-x": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M9.5 8l5 8 M14.5 8l-5 8",
386
+ "pad-nintendo-y": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M9.5 8l2.5 4 2.5-4 M12 12v4",
387
+ "pad-playstation-cross": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M9 9l6 6 M15 9l-6 6",
388
+ "pad-playstation-circle": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M12 8.25a3.75 3.75 0 1 0 0 7.5a3.75 3.75 0 1 0 0 -7.5z",
389
+ "pad-playstation-square": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M8.5 8.5h7v7h-7z",
390
+ "pad-playstation-triangle": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M12 8l4.5 7.5h-9z",
391
+ "pad-generic-north": "M12 3a3 3 0 1 0 0 6a3 3 0 1 0 0 -6z M12 6h.01 M18 10.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z M6 10.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z M12 16.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z",
392
+ "pad-generic-east": "M12 4.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z M18 9a3 3 0 1 0 0 6a3 3 0 1 0 0 -6z M18 12h.01 M6 10.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z M12 16.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z",
393
+ "pad-generic-west": "M12 4.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z M18 10.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z M6 9a3 3 0 1 0 0 6a3 3 0 1 0 0 -6z M6 12h.01 M12 16.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z",
394
+ "pad-generic-south": "M12 4.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z M18 10.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z M6 10.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z M12 15a3 3 0 1 0 0 6a3 3 0 1 0 0 -6z M12 18h.01",
395
+ "pad-lb": "M6 9h12a3 3 0 0 1 0 6H6a3 3 0 0 1 0-6z M7.5 12h.01",
396
+ "pad-rb": "M6 9h12a3 3 0 0 1 0 6H6a3 3 0 0 1 0-6z M16.5 12h.01",
397
+ "pad-lt": "M9 3h6a3 3 0 0 1 3 3v7a6 6 0 0 1-12 0V6a3 3 0 0 1 3-3z M9.5 7h.01",
398
+ "pad-rt": "M9 3h6a3 3 0 0 1 3 3v7a6 6 0 0 1-12 0V6a3 3 0 0 1 3-3z M14.5 7h.01",
399
+ "pad-start": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M8.5 8.75h7 M8.5 12h7 M8.5 15.25h7",
400
+ "pad-select": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M7.75 7.75h5.5v5.5h-5.5z M10.75 16.25h5.5v-5.5",
401
+ "pad-home": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M7.95 12L12 8.6l4.05 3.4v4H7.95z",
402
+ "pad-dpad": "M9 3h6v6h6v6h-6v6H9v-6H3V9h6z",
403
+ "pad-dpad-up": "M9 3h6v6h6v6h-6v6H9v-6H3V9h6z M12 5.6l1.15 1.5h-2.3z",
404
+ "pad-dpad-down": "M9 3h6v6h6v6h-6v6H9v-6H3V9h6z M12 18.4l1.15-1.5h-2.3z",
405
+ "pad-dpad-left": "M9 3h6v6h6v6h-6v6H9v-6H3V9h6z M5.6 12l1.5-1.15v2.3z",
406
+ "pad-dpad-right": "M9 3h6v6h6v6h-6v6H9v-6H3V9h6z M18.4 12l-1.5-1.15v2.3z",
407
+ "pad-stick-left": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M12 7.5a4.5 4.5 0 1 0 0 9a4.5 4.5 0 1 0 0 -9z M4.5 12h1",
408
+ "pad-stick-right": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M12 7.5a4.5 4.5 0 1 0 0 9a4.5 4.5 0 1 0 0 -9z M18.5 12h1",
409
+ "pad-stick-left-press": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M12 7.5a4.5 4.5 0 1 0 0 9a4.5 4.5 0 1 0 0 -9z M12 12h.01 M4.5 12h1",
410
+ "pad-stick-right-press": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M12 7.5a4.5 4.5 0 1 0 0 9a4.5 4.5 0 1 0 0 -9z M12 12h.01 M18.5 12h1",
411
+ "remote-ok": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M12 8.5a3.5 3.5 0 1 0 0 7a3.5 3.5 0 1 0 0 -7z",
412
+ "remote-back": "M9 14l-4-4 4-4 M5 10h9a5 5 0 0 1 0 10h-2",
413
+ "remote-menu": "M4 6h16v12H4z M8 10h8 M8 14h8",
414
+ "key-command": "M9 9V6.5A2.5 2.5 0 1 0 6.5 9H9z M9 9h6 M9 9v6 M15 9V6.5A2.5 2.5 0 1 1 17.5 9H15z M15 9v6 M15 15H9 M15 15v2.5a2.5 2.5 0 1 0 2.5-2.5H15z M9 15H6.5A2.5 2.5 0 1 0 9 17.5V15z",
415
+ "key-option": "M4 6h5l6 12h5 M14 6h6",
416
+ "key-shift": "M12 4l-8 8h4v8h8v-8h4z",
417
+ "key-control": "M7 14l5-5 5 5",
418
+ "key-enter": "M20 5v7a3 3 0 0 1-3 3H5 M9 11l-4 4 4 4",
419
+ "key-tab": "M4 12h14 M14 8l4 4-4 4 M20 6v12",
420
+ // on-screen keyboard (1.3.0 H1)
421
+ "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
+ "key-space": "M4 10v4h16v-4",
423
+ "key-caps": "M12 4l-7 7h4v5h6v-5h4z M8 20h8"
424
+ }, Xt = {
425
+ xs: 12,
426
+ sm: 16,
427
+ md: 20,
428
+ lg: 24,
429
+ 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
+ }) {
440
+ return /* @__PURE__ */ V(
441
+ "svg",
442
+ {
443
+ xmlns: "http://www.w3.org/2000/svg",
444
+ width: e,
445
+ height: e,
446
+ viewBox: "0 0 24 24",
447
+ fill: "none",
448
+ stroke: r || "currentColor",
449
+ strokeWidth: 2,
450
+ strokeLinecap: "round",
451
+ 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,
460
+ children: [
461
+ s && /* @__PURE__ */ N("title", { children: s }),
462
+ /* @__PURE__ */ N("path", { d: n })
463
+ ]
464
+ }
465
+ );
466
+ }
467
+ const ee = ({
468
+ name: n,
469
+ size: e = "md",
470
+ className: t,
471
+ style: a,
472
+ color: r,
473
+ title: s,
474
+ onClick: o
475
+ }) => {
476
+ const { resolver: i } = ae(Ie), c = typeof e == "number" ? e : Xt[e];
477
+ if (i) {
478
+ const u = i(n, c);
479
+ if (u)
480
+ return /* @__PURE__ */ N(
481
+ "span",
482
+ {
483
+ role: o ? "button" : void 0,
484
+ tabIndex: o ? 0 : void 0,
485
+ onKeyDown: o ? wt : void 0,
486
+ className: `nice-icon-wrap ${t || ""}`,
487
+ style: a,
488
+ onClick: o,
489
+ children: u
490
+ }
491
+ );
492
+ }
493
+ const d = kt[n];
494
+ return d ? /* @__PURE__ */ N(
495
+ Jt,
496
+ {
497
+ path: d,
498
+ size: c,
499
+ className: t,
500
+ style: a,
501
+ color: r,
502
+ title: s,
503
+ onClick: o
504
+ }
505
+ ) : null;
506
+ };
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]
512
+ ) };
513
+ }
514
+ const Ta = /* @__PURE__ */ Object.keys(kt), xt = [
515
+ "a[href]",
516
+ "area[href]",
517
+ "button",
518
+ 'input:not([type="hidden"])',
519
+ "select",
520
+ "textarea",
521
+ "summary",
522
+ "iframe",
523
+ "audio[controls]",
524
+ "video[controls]",
525
+ '[contenteditable]:not([contenteditable="false"])',
526
+ "[tabindex]",
527
+ "[data-nice-focusable]"
528
+ ].join(",");
529
+ function X(n) {
530
+ const e = n.getBoundingClientRect();
531
+ return {
532
+ left: e.left,
533
+ top: e.top,
534
+ right: e.right,
535
+ bottom: e.bottom,
536
+ width: e.width,
537
+ height: e.height
538
+ };
539
+ }
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"))
543
+ 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));
548
+ }
549
+ return !1;
550
+ }
551
+ function Qt(n) {
552
+ var a;
553
+ if (n.closest("[hidden]"))
554
+ return !1;
555
+ const e = n.getBoundingClientRect();
556
+ if (e.width === 0 && e.height === 0) {
557
+ const r = n.ownerDocument.documentElement.getBoundingClientRect();
558
+ if (r.width !== 0 || r.height !== 0)
559
+ return !1;
560
+ }
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";
563
+ }
564
+ function en(n) {
565
+ if (!(n instanceof HTMLInputElement) || n.type !== "radio" || !n.name || n.checked)
566
+ return !0;
567
+ const t = [...(n.form ?? n.ownerDocument).querySelectorAll('input[type="radio"]')].filter(
568
+ (a) => a.name === n.name
569
+ );
570
+ return !t.some((a) => a.checked) && t[0] === n;
571
+ }
572
+ function te(n) {
573
+ if (!(n instanceof HTMLElement) || !n.matches(xt))
574
+ 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)
578
+ return !1;
579
+ }
580
+ return n.closest('[inert],[aria-hidden="true"]') || Zt(n) ? !1 : Qt(n) && en(n);
581
+ }
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;
587
+ }
588
+ const _e = typeof window > "u" ? R : _t;
589
+ function B(n, e, t) {
590
+ 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(
595
+ () => () => {
596
+ const s = a.current;
597
+ typeof s.cleanup == "function" && s.cleanup(), a.current = { el: null, deps: [] };
598
+ },
599
+ []
600
+ );
601
+ }
602
+ 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());
612
+ };
613
+ }
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();
617
+ }
618
+ function tn(n, e) {
619
+ const t = [], a = /* @__PURE__ */ new Set(), r = (s) => {
620
+ const o = [...Q.get(s) ?? []], i = [...o.filter((c) => !c.fallback), ...o.filter((c) => c.fallback)];
621
+ for (const c of i.flatMap((d) => d.hints)) {
622
+ const d = `${c.intent}:${c.direction ?? ""}`;
623
+ a.has(d) || (a.add(d), t.push(c));
624
+ }
625
+ };
626
+ for (let s = n; s; s = s.parentElement)
627
+ r(s);
628
+ return r(e), t;
629
+ }
630
+ function At(n, e, t = {}) {
631
+ const { enabled: a = !0, fallback: r = !1 } = t, s = JSON.stringify(e), o = (i) => {
632
+ const c = JSON.parse(s);
633
+ return c.length > 0 ? zt(i, c, r) : void 0;
634
+ };
635
+ B(n, (i) => a ? o(i) : void 0, [s, a, r]), R(() => {
636
+ if (!(n || !a))
637
+ return o(document);
638
+ }, [n, s, a, r]);
639
+ }
640
+ function nn() {
641
+ const [n, e] = j(null), [, t] = j(0);
642
+ return R(() => {
643
+ const a = document, r = () => e(a.activeElement), s = () => t((o) => o + 1);
644
+ return r(), a.addEventListener("focusin", r), a.addEventListener("focusout", r), be.add(s), () => {
645
+ a.removeEventListener("focusin", r), a.removeEventListener("focusout", r), be.delete(s);
646
+ };
647
+ }, []), n;
648
+ }
649
+ class an {
650
+ constructor(e = "ntd-user-preferences") {
651
+ this.key = e;
652
+ }
653
+ async load() {
654
+ try {
655
+ const e = localStorage.getItem(this.key);
656
+ return e ? JSON.parse(e) : null;
657
+ } catch {
658
+ return null;
659
+ }
660
+ }
661
+ async save(e) {
662
+ localStorage.setItem(this.key, JSON.stringify(e));
663
+ }
664
+ async clear() {
665
+ localStorage.removeItem(this.key);
666
+ }
667
+ }
668
+ class Da {
669
+ constructor(e = "ntd-preferences", t = "preferences") {
670
+ this.db = null, this.dbName = e, this.storeName = t;
671
+ }
672
+ async getDB() {
673
+ return this.db ? this.db : new Promise((e, t) => {
674
+ const a = indexedDB.open(this.dbName, 1);
675
+ a.onerror = () => t(a.error), a.onsuccess = () => {
676
+ this.db = a.result, e(this.db);
677
+ }, a.onupgradeneeded = (r) => {
678
+ const s = r.target.result;
679
+ s.objectStoreNames.contains(this.storeName) || s.createObjectStore(this.storeName, { keyPath: "id" });
680
+ };
681
+ });
682
+ }
683
+ async load() {
684
+ const e = await this.getDB();
685
+ return new Promise((t, a) => {
686
+ const o = e.transaction(this.storeName, "readonly").objectStore(this.storeName).get("user-preferences");
687
+ o.onerror = () => a(o.error), o.onsuccess = () => {
688
+ var i;
689
+ return t(((i = o.result) == null ? void 0 : i.data) || null);
690
+ };
691
+ });
692
+ }
693
+ async save(e) {
694
+ const t = await this.getDB();
695
+ return new Promise((a, r) => {
696
+ const i = t.transaction(this.storeName, "readwrite").objectStore(this.storeName).put({ id: "user-preferences", data: e });
697
+ i.onerror = () => r(i.error), i.onsuccess = () => a();
698
+ });
699
+ }
700
+ async clear() {
701
+ const e = await this.getDB();
702
+ return new Promise((t, a) => {
703
+ const o = e.transaction(this.storeName, "readwrite").objectStore(this.storeName).delete("user-preferences");
704
+ o.onerror = () => a(o.error), o.onsuccess = () => t();
705
+ });
706
+ }
707
+ }
708
+ class Ia {
709
+ constructor(e, t) {
710
+ this.baseUrl = e, this.getAuthHeaders = t;
711
+ }
712
+ getHeaders() {
713
+ var e;
714
+ return {
715
+ "Content-Type": "application/json",
716
+ ...((e = this.getAuthHeaders) == null ? void 0 : e.call(this)) || {}
717
+ };
718
+ }
719
+ async fetch() {
720
+ const e = await fetch(`${this.baseUrl}/preferences`, {
721
+ method: "GET",
722
+ headers: this.getHeaders()
723
+ });
724
+ if (!e.ok) {
725
+ if (e.status === 404)
726
+ return null;
727
+ throw new Error(`Failed to fetch preferences: ${e.statusText}`);
728
+ }
729
+ return e.json();
730
+ }
731
+ async push(e) {
732
+ const t = await fetch(`${this.baseUrl}/preferences`, {
733
+ method: "PUT",
734
+ headers: this.getHeaders(),
735
+ body: JSON.stringify(e)
736
+ });
737
+ if (!t.ok)
738
+ throw new Error(`Failed to save preferences: ${t.statusText}`);
739
+ }
740
+ async getServerTimestamp() {
741
+ const e = await fetch(`${this.baseUrl}/preferences/timestamp`, {
742
+ method: "GET",
743
+ headers: this.getHeaders()
744
+ });
745
+ return e.ok && (await e.json()).timestamp || 0;
746
+ }
747
+ }
748
+ const Oe = /* @__PURE__ */ Ne(
749
+ null
750
+ );
751
+ function St() {
752
+ const n = ae(Oe);
753
+ if (!n)
754
+ throw new Error("useUserPreferences must be used within NiceUserPreferencesProvider");
755
+ return n;
756
+ }
757
+ function rn() {
758
+ return ae(Oe);
759
+ }
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]
767
+ );
768
+ return [s, o, i];
769
+ }
770
+ function Oa(n) {
771
+ return Lt(n, "grid");
772
+ }
773
+ function Ra(n) {
774
+ return Lt(n, "chart");
775
+ }
776
+ const Ke = {
777
+ version: 1,
778
+ global: {},
779
+ controls: {}
780
+ };
781
+ function Va({
782
+ storage: n = new an(),
783
+ syncAdapter: e,
784
+ autoSyncInterval: t = 0,
785
+ saveDebounce: a = 500,
786
+ children: r
787
+ }) {
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);
789
+ R(() => {
790
+ let f = !0;
791
+ return (async () => {
792
+ try {
793
+ const b = await n.load();
794
+ f && b && o(b);
795
+ } catch (b) {
796
+ f && l(b instanceof Error ? b : new Error("Failed to load preferences"));
797
+ } finally {
798
+ f && c(!1);
799
+ }
800
+ })(), () => {
801
+ f = !1;
802
+ };
803
+ }, [n]);
804
+ const k = I(
805
+ (f) => {
806
+ p.current && clearTimeout(p.current), p.current = setTimeout(async () => {
807
+ try {
808
+ await n.save(f);
809
+ } catch (z) {
810
+ l(z instanceof Error ? z : new Error("Failed to save preferences"));
811
+ }
812
+ }, a);
813
+ },
814
+ [n, a]
815
+ );
816
+ R(() => {
817
+ i || k(s);
818
+ }, [s, i, k]);
819
+ const x = O(async () => {
820
+ });
821
+ R(() => {
822
+ if (e && t > 0)
823
+ return w.current = setInterval(() => {
824
+ x.current();
825
+ }, t), () => {
826
+ w.current && clearInterval(w.current);
827
+ };
828
+ }, [e, t]), R(() => () => {
829
+ p.current && clearTimeout(p.current), w.current && clearInterval(w.current);
830
+ }, []);
831
+ const C = I(
832
+ (f, z) => {
833
+ var b;
834
+ return (b = s.controls[f]) == null ? void 0 : b[z];
835
+ },
836
+ [s]
837
+ ), S = I(
838
+ (f, z, b) => {
839
+ o((P) => ({
840
+ ...P,
841
+ controls: {
842
+ ...P.controls,
843
+ [f]: {
844
+ ...P.controls[f],
845
+ [z]: b,
846
+ lastModified: Date.now()
847
+ }
848
+ }
849
+ }));
850
+ },
851
+ []
852
+ ), m = I(
853
+ (f, z, b) => {
854
+ o((P) => {
855
+ var _;
856
+ const H = (_ = P.controls[f]) == null ? void 0 : _[z], D = typeof H == "object" && H !== null ? { ...H, ...b } : b;
857
+ return {
858
+ ...P,
859
+ controls: {
860
+ ...P.controls,
861
+ [f]: {
862
+ ...P.controls[f],
863
+ [z]: D,
864
+ lastModified: Date.now()
865
+ }
866
+ }
867
+ };
868
+ });
869
+ },
870
+ []
871
+ ), A = I(
872
+ (f, z) => {
873
+ o((b) => {
874
+ if (z) {
875
+ const { [z]: D, ..._ } = b.controls[f] || {};
876
+ return {
877
+ ...b,
878
+ controls: {
879
+ ...b.controls,
880
+ [f]: _
881
+ }
882
+ };
883
+ }
884
+ const { [f]: P, ...H } = b.controls;
885
+ return {
886
+ ...b,
887
+ controls: H
888
+ };
889
+ });
890
+ },
891
+ []
892
+ ), y = I(
893
+ (f) => s.global[f],
894
+ [s]
895
+ ), L = I(
896
+ (f, z) => {
897
+ o((b) => ({
898
+ ...b,
899
+ global: {
900
+ ...b.global,
901
+ [f]: z
902
+ }
903
+ }));
904
+ },
905
+ []
906
+ ), T = I(async () => {
907
+ if (e) {
908
+ u(!0), l(null);
909
+ try {
910
+ const f = await e.getServerTimestamp(), z = s.lastSync || 0;
911
+ if (f > z) {
912
+ const b = await e.fetch();
913
+ b && (o({
914
+ ...b,
915
+ lastSync: Date.now()
916
+ }), await n.save(b));
917
+ } else {
918
+ const b = { ...s, lastSync: Date.now() };
919
+ await e.push(b), o(b);
920
+ }
921
+ } catch (f) {
922
+ l(f instanceof Error ? f : new Error("Sync failed"));
923
+ } finally {
924
+ u(!1);
925
+ }
926
+ }
927
+ }, [e, s, n]);
928
+ x.current = T;
929
+ const E = I(() => JSON.stringify(s, null, 2), [s]), g = I((f) => {
930
+ try {
931
+ const z = JSON.parse(f);
932
+ if (typeof z.version != "number" || !z.controls)
933
+ throw new Error("Invalid preferences format");
934
+ o(z);
935
+ } catch (z) {
936
+ l(z instanceof Error ? z : new Error("Import failed"));
937
+ }
938
+ }, []), v = I(() => {
939
+ o(Ke), n.clear();
940
+ }, [n]), M = pe(
941
+ () => ({
942
+ preferences: s,
943
+ isLoading: i,
944
+ isSyncing: d,
945
+ error: h,
946
+ getControlPreferences: C,
947
+ setControlPreferences: S,
948
+ updateControlPreferences: m,
949
+ clearControlPreferences: A,
950
+ getGlobalPreferences: y,
951
+ setGlobalPreferences: L,
952
+ sync: T,
953
+ exportPreferences: E,
954
+ importPreferences: g,
955
+ resetAllPreferences: v
956
+ }),
957
+ [
958
+ s,
959
+ i,
960
+ d,
961
+ h,
962
+ C,
963
+ S,
964
+ m,
965
+ A,
966
+ y,
967
+ L,
968
+ T,
969
+ E,
970
+ g,
971
+ v
972
+ ]
973
+ );
974
+ return /* @__PURE__ */ N(Oe.Provider, { value: M, children: r });
975
+ }
976
+ function Fa({
977
+ showGlobal: n = !0,
978
+ showControls: e = !0,
979
+ showExportImport: t = !0,
980
+ showSync: a = !0,
981
+ className: r,
982
+ style: s
983
+ }) {
984
+ var y, L, T, E;
985
+ const { t: o } = J(), {
986
+ preferences: i,
987
+ isLoading: c,
988
+ isSyncing: d,
989
+ error: u,
990
+ sync: h,
991
+ exportPreferences: l,
992
+ importPreferences: p,
993
+ resetAllPreferences: w,
994
+ setGlobalPreferences: k,
995
+ clearControlPreferences: x
996
+ } = St(), C = O(null), S = () => {
997
+ const g = l(), v = new Blob([g], { type: "application/json" }), M = URL.createObjectURL(v), f = document.createElement("a");
998
+ f.href = M, f.download = "nice2dev-preferences.json", f.click(), URL.revokeObjectURL(M);
999
+ }, m = (g) => {
1000
+ var f;
1001
+ const v = (f = g.target.files) == null ? void 0 : f[0];
1002
+ if (!v)
1003
+ return;
1004
+ const M = new FileReader();
1005
+ M.onload = () => {
1006
+ p(M.result);
1007
+ }, M.readAsText(v);
1008
+ };
1009
+ if (c)
1010
+ return /* @__PURE__ */ N("div", { className: r, style: s, children: o("userPreferences.loadingPreferences", "Loading preferences...") });
1011
+ const A = Object.keys(i.controls);
1012
+ return /* @__PURE__ */ V(
1013
+ "div",
1014
+ {
1015
+ className: `ntd-preferences-panel ${r || ""}`,
1016
+ style: {
1017
+ fontFamily: "system-ui, sans-serif",
1018
+ fontSize: "14px",
1019
+ padding: "16px",
1020
+ ...s
1021
+ },
1022
+ children: [
1023
+ u && /* @__PURE__ */ N(
1024
+ "div",
1025
+ {
1026
+ style: {
1027
+ padding: "12px",
1028
+ marginBottom: "16px",
1029
+ background: "var(--nice-danger-bg, #fef2f2)",
1030
+ border: "1px solid var(--nice-danger-bg, #fecaca)",
1031
+ borderRadius: "6px",
1032
+ color: "var(--nice-color-error, #dc2626)"
1033
+ },
1034
+ children: u.message
1035
+ }
1036
+ ),
1037
+ /* @__PURE__ */ V("div", { style: { display: "flex", gap: "8px", marginBottom: "20px", flexWrap: "wrap" }, children: [
1038
+ a && /* @__PURE__ */ N(
1039
+ "button",
1040
+ {
1041
+ onClick: h,
1042
+ disabled: d,
1043
+ style: {
1044
+ padding: "8px 16px",
1045
+ border: "1px solid var(--nice-border-color, #e5e7eb)",
1046
+ borderRadius: "6px",
1047
+ background: "var(--nice-bg-primary, #fff)",
1048
+ cursor: d ? "wait" : "pointer"
1049
+ },
1050
+ children: d ? o("userPreferences.syncing", "Syncing...") : o("userPreferences.sync", "Sync")
1051
+ }
1052
+ ),
1053
+ t && /* @__PURE__ */ V(Ft, { children: [
1054
+ /* @__PURE__ */ N(
1055
+ "button",
1056
+ {
1057
+ onClick: S,
1058
+ style: {
1059
+ padding: "8px 16px",
1060
+ border: "1px solid var(--nice-border-color, #e5e7eb)",
1061
+ borderRadius: "6px",
1062
+ background: "var(--nice-bg-primary, #fff)",
1063
+ cursor: "pointer"
1064
+ },
1065
+ children: o("userPreferences.export", "Export")
1066
+ }
1067
+ ),
1068
+ /* @__PURE__ */ N(
1069
+ "button",
1070
+ {
1071
+ onClick: () => {
1072
+ var g;
1073
+ return (g = C.current) == null ? void 0 : g.click();
1074
+ },
1075
+ style: {
1076
+ padding: "8px 16px",
1077
+ border: "1px solid var(--nice-border-color, #e5e7eb)",
1078
+ borderRadius: "6px",
1079
+ background: "var(--nice-bg-primary, #fff)",
1080
+ cursor: "pointer"
1081
+ },
1082
+ children: o("userPreferences.import", "Import")
1083
+ }
1084
+ ),
1085
+ /* @__PURE__ */ N(
1086
+ "input",
1087
+ {
1088
+ ref: C,
1089
+ type: "file",
1090
+ accept: ".json",
1091
+ onChange: m,
1092
+ style: { display: "none" }
1093
+ }
1094
+ )
1095
+ ] }),
1096
+ /* @__PURE__ */ N(
1097
+ "button",
1098
+ {
1099
+ onClick: w,
1100
+ style: {
1101
+ padding: "8px 16px",
1102
+ border: "1px solid var(--nice-danger-dark, #dc2626)",
1103
+ borderRadius: "6px",
1104
+ background: "var(--nice-danger-bg, #fef2f2)",
1105
+ color: "var(--nice-color-error, #dc2626)",
1106
+ cursor: "pointer",
1107
+ marginLeft: "auto"
1108
+ },
1109
+ children: o("userPreferences.resetAll", "Reset All")
1110
+ }
1111
+ )
1112
+ ] }),
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") }),
1115
+ /* @__PURE__ */ V("div", { style: { display: "grid", gap: "12px" }, children: [
1116
+ /* @__PURE__ */ V("label", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
1117
+ /* @__PURE__ */ N(
1118
+ "input",
1119
+ {
1120
+ type: "checkbox",
1121
+ checked: ((y = i.global.display) == null ? void 0 : y.reducedMotion) || !1,
1122
+ onChange: (g) => k("display", {
1123
+ ...i.global.display,
1124
+ reducedMotion: g.target.checked
1125
+ })
1126
+ }
1127
+ ),
1128
+ o("userPreferences.reducedMotion", "Reduced motion")
1129
+ ] }),
1130
+ /* @__PURE__ */ V("label", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
1131
+ /* @__PURE__ */ N(
1132
+ "input",
1133
+ {
1134
+ type: "checkbox",
1135
+ checked: ((L = i.global.display) == null ? void 0 : L.highContrast) || !1,
1136
+ onChange: (g) => k("display", {
1137
+ ...i.global.display,
1138
+ highContrast: g.target.checked
1139
+ })
1140
+ }
1141
+ ),
1142
+ o("userPreferences.highContrast", "High contrast")
1143
+ ] }),
1144
+ /* @__PURE__ */ V("label", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
1145
+ o("userPreferences.fontScale", "Font scale:"),
1146
+ /* @__PURE__ */ N(
1147
+ "input",
1148
+ {
1149
+ type: "range",
1150
+ min: "0.8",
1151
+ max: "1.5",
1152
+ step: "0.1",
1153
+ value: ((T = i.global.display) == null ? void 0 : T.fontScale) || 1,
1154
+ onChange: (g) => k("display", {
1155
+ ...i.global.display,
1156
+ fontScale: parseFloat(g.target.value)
1157
+ }),
1158
+ style: { flex: 1 }
1159
+ }
1160
+ ),
1161
+ /* @__PURE__ */ V("span", { children: [
1162
+ ((((E = i.global.display) == null ? void 0 : E.fontScale) || 1) * 100).toFixed(0),
1163
+ "%"
1164
+ ] })
1165
+ ] })
1166
+ ] })
1167
+ ] }),
1168
+ 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(
1170
+ "{controlIds}",
1171
+ String(A.length)
1172
+ ) }),
1173
+ /* @__PURE__ */ N("div", { style: { display: "grid", gap: "8px" }, children: A.map((g) => {
1174
+ const v = i.controls[g], M = Object.keys(v).filter((f) => f !== "lastModified");
1175
+ return /* @__PURE__ */ V(
1176
+ "div",
1177
+ {
1178
+ style: {
1179
+ display: "flex",
1180
+ alignItems: "center",
1181
+ justifyContent: "space-between",
1182
+ padding: "10px 12px",
1183
+ background: "var(--nice-bg-secondary, #f9fafb)",
1184
+ borderRadius: "6px"
1185
+ },
1186
+ children: [
1187
+ /* @__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(", ") })
1190
+ ] }),
1191
+ /* @__PURE__ */ N(
1192
+ "button",
1193
+ {
1194
+ onClick: () => x(g),
1195
+ style: {
1196
+ padding: "4px 8px",
1197
+ border: "none",
1198
+ borderRadius: "4px",
1199
+ background: "var(--nice-border-color, #e5e7eb)",
1200
+ cursor: "pointer",
1201
+ fontSize: "12px"
1202
+ },
1203
+ children: o("userPreferences.clear", "Clear")
1204
+ }
1205
+ )
1206
+ ]
1207
+ },
1208
+ g
1209
+ );
1210
+ }) })
1211
+ ] }),
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.") })
1213
+ ]
1214
+ }
1215
+ );
1216
+ }
1217
+ const je = {
1218
+ "045e": "xbox",
1219
+ "054c": "playstation",
1220
+ "057e": "nintendo",
1221
+ "28de": "steam"
1222
+ };
1223
+ function sn(n) {
1224
+ 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";
1227
+ }
1228
+ function on(n, e) {
1229
+ return e !== "auto" ? e : n === "nintendo" ? "east" : "south";
1230
+ }
1231
+ const cn = {
1232
+ A: "south",
1233
+ B: "east",
1234
+ X: "west",
1235
+ Y: "north",
1236
+ LB: "leftBumper",
1237
+ RB: "rightBumper",
1238
+ LT: "leftTrigger",
1239
+ RT: "rightTrigger",
1240
+ View: "select",
1241
+ Menu: "start",
1242
+ LS: "leftStick",
1243
+ RS: "rightStick"
1244
+ };
1245
+ function ln(n) {
1246
+ return cn[n] ?? n;
1247
+ }
1248
+ const ye = {
1249
+ xbox: { south: ["A"], east: ["B"], west: ["X"], north: ["Y"] },
1250
+ playstation: {
1251
+ south: ["Cross", "input.pad.cross"],
1252
+ east: ["Circle", "input.pad.circle"],
1253
+ west: ["Square", "input.pad.square"],
1254
+ north: ["Triangle", "input.pad.triangle"]
1255
+ },
1256
+ nintendo: { south: ["B"], east: ["A"], west: ["Y"], north: ["X"] },
1257
+ steam: { south: ["A"], east: ["B"], west: ["X"], north: ["Y"] },
1258
+ generic: {
1259
+ south: ["Bottom button", "input.pad.bottomButton"],
1260
+ east: ["Right button", "input.pad.rightButton"],
1261
+ west: ["Left button", "input.pad.leftButton"],
1262
+ north: ["Top button", "input.pad.topButton"]
1263
+ }
1264
+ }, Ue = ["Left stick", "input.pad.leftStick"], Ge = ["Right stick", "input.pad.rightStick"], un = {
1265
+ xbox: [["LB"], ["RB"], ["LT"], ["RT"], ["View"], ["Menu"], ["LS"], ["RS"]],
1266
+ playstation: [["L1"], ["R1"], ["L2"], ["R2"], ["Create"], ["Options"], ["L3"], ["R3"]],
1267
+ nintendo: [
1268
+ ["L"],
1269
+ ["R"],
1270
+ ["ZL"],
1271
+ ["ZR"],
1272
+ ["Minus", "input.pad.minus"],
1273
+ ["Plus", "input.pad.plus"],
1274
+ Ue,
1275
+ Ge
1276
+ ],
1277
+ steam: [["L1"], ["R1"], ["L2"], ["R2"], ["View"], ["Menu"], ["L3"], ["R3"]],
1278
+ generic: [
1279
+ ["Left bumper", "input.pad.leftBumper"],
1280
+ ["Right bumper", "input.pad.rightBumper"],
1281
+ ["Left trigger", "input.pad.leftTrigger"],
1282
+ ["Right trigger", "input.pad.rightTrigger"],
1283
+ ["Select"],
1284
+ ["Start"],
1285
+ Ue,
1286
+ Ge
1287
+ ]
1288
+ }, dn = {
1289
+ leftBumper: 0,
1290
+ rightBumper: 1,
1291
+ leftTrigger: 2,
1292
+ rightTrigger: 3,
1293
+ select: 4,
1294
+ start: 5,
1295
+ leftStick: 6,
1296
+ rightStick: 7
1297
+ }, hn = {
1298
+ dpadUp: ["D-pad up", "input.pad.dpadUp"],
1299
+ dpadDown: ["D-pad down", "input.pad.dpadDown"],
1300
+ dpadLeft: ["D-pad left", "input.pad.dpadLeft"],
1301
+ dpadRight: ["D-pad right", "input.pad.dpadRight"],
1302
+ home: ["Home"]
1303
+ };
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];
1309
+ }
1310
+ function pn(n, e) {
1311
+ const [t, a] = fn(n, e);
1312
+ return a ? { label: t, key: a } : { label: t };
1313
+ }
1314
+ function vn(n, e) {
1315
+ switch (e) {
1316
+ case "south":
1317
+ case "east":
1318
+ case "west":
1319
+ case "north": {
1320
+ if (n === "generic")
1321
+ return `pad-generic-${e}`;
1322
+ const t = n === "steam" ? "xbox" : n;
1323
+ return `pad-${t}-${ye[t][e][0].toLowerCase()}`;
1324
+ }
1325
+ case "leftBumper":
1326
+ return "pad-lb";
1327
+ case "rightBumper":
1328
+ return "pad-rb";
1329
+ case "leftTrigger":
1330
+ return "pad-lt";
1331
+ case "rightTrigger":
1332
+ return "pad-rt";
1333
+ case "leftStick":
1334
+ return "pad-stick-left-press";
1335
+ case "rightStick":
1336
+ return "pad-stick-right-press";
1337
+ case "dpadUp":
1338
+ return "pad-dpad-up";
1339
+ case "dpadDown":
1340
+ return "pad-dpad-down";
1341
+ case "dpadLeft":
1342
+ return "pad-dpad-left";
1343
+ case "dpadRight":
1344
+ return "pad-dpad-right";
1345
+ default:
1346
+ return `pad-${e}`;
1347
+ }
1348
+ }
1349
+ const Ct = ["up", "down", "left", "right"], we = {
1350
+ navigate: ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"],
1351
+ activate: ["Enter", "Space"],
1352
+ back: ["Escape"],
1353
+ secondary: ["ContextMenu", "Shift+F10"],
1354
+ tertiary: [],
1355
+ menu: ["Ctrl+K"],
1356
+ view: ["F6", "Shift+F6"],
1357
+ sectionPrev: ["Ctrl+PageUp"],
1358
+ sectionNext: ["Ctrl+PageDown"],
1359
+ pagePrev: ["PageUp"],
1360
+ pageNext: ["PageDown"],
1361
+ first: ["Home"],
1362
+ last: ["End"],
1363
+ scroll: [],
1364
+ toggleHints: ["Shift+?"]
1365
+ }, qe = {
1366
+ navigate: ["dpadUp", "dpadDown", "dpadLeft", "dpadRight"],
1367
+ activate: ["south"],
1368
+ back: ["east"],
1369
+ secondary: ["west"],
1370
+ tertiary: ["north"],
1371
+ menu: ["start"],
1372
+ view: ["select"],
1373
+ sectionPrev: ["leftBumper"],
1374
+ sectionNext: ["rightBumper"],
1375
+ pagePrev: ["leftTrigger"],
1376
+ pageNext: ["rightTrigger"],
1377
+ first: [],
1378
+ last: [],
1379
+ scroll: [],
1380
+ toggleHints: ["leftStick"]
1381
+ }, mn = {
1382
+ " ": "Space",
1383
+ Spacebar: "Space",
1384
+ Esc: "Escape",
1385
+ Apps: "ContextMenu",
1386
+ Up: "ArrowUp",
1387
+ Down: "ArrowDown",
1388
+ Left: "ArrowLeft",
1389
+ Right: "ArrowRight"
1390
+ };
1391
+ function Re(n) {
1392
+ return mn[n] ?? n;
1393
+ }
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()));
1396
+ return {
1397
+ key: Re(t),
1398
+ primary: a.has("ctrl") || a.has("cmd") || a.has("meta") || a.has("mod"),
1399
+ alt: a.has("alt") || a.has("option"),
1400
+ shift: a.has("shift")
1401
+ };
1402
+ }
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;
1407
+ }
1408
+ function $e(n) {
1409
+ const e = {};
1410
+ for (const t of Object.keys(we)) {
1411
+ const a = n.keyboardBindings[t] ?? we[t];
1412
+ e[t] = a.map(Ht);
1413
+ }
1414
+ return e;
1415
+ }
1416
+ function gn(n, e) {
1417
+ for (const t of Object.keys(e)) {
1418
+ const a = e[t];
1419
+ 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 };
1422
+ }
1423
+ return null;
1424
+ }
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;
1428
+ }
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]];
1434
+ }
1435
+ return r;
1436
+ }
1437
+ function En(n) {
1438
+ 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 });
1442
+ });
1443
+ return e;
1444
+ }
1445
+ const re = "data-nice-focus-scope", ke = `[${re}]`;
1446
+ function kn(n, e) {
1447
+ const t = {
1448
+ [re]: e.nav ?? "spatial",
1449
+ "data-nice-scope-wrap": e.wrap ? "" : null,
1450
+ "data-nice-scope-trap": e.trap ? "" : null,
1451
+ "data-nice-scope-enter": e.enter && e.enter !== "last" ? e.enter : null,
1452
+ "data-nice-arrows": e.arrows ?? null,
1453
+ "data-nice-region": e.region ?? null
1454
+ }, 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);
1457
+ return () => {
1458
+ for (const [r, s] of Object.entries(a))
1459
+ s === null ? n.removeAttribute(r) : n.setAttribute(r, s);
1460
+ };
1461
+ }
1462
+ function Tt(n) {
1463
+ const e = n.getAttribute(re), t = n.getAttribute("data-nice-scope-enter");
1464
+ return {
1465
+ 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"
1469
+ };
1470
+ }
1471
+ function Ye(n, e) {
1472
+ var a;
1473
+ const t = (a = n.parentElement) == null ? void 0 : a.closest(ke);
1474
+ return t && e.contains(t) && t !== e ? t : e;
1475
+ }
1476
+ function xn(n) {
1477
+ var t, a;
1478
+ 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))
1480
+ e.push(r);
1481
+ return e;
1482
+ }
1483
+ function zn(n) {
1484
+ var t;
1485
+ const e = (t = n.closest("[data-nice-arrows]")) == null ? void 0 : t.getAttribute("data-nice-arrows");
1486
+ return e === "spatial" || e === "native" ? e : null;
1487
+ }
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) {
1491
+ case "right":
1492
+ return e.left >= n.right - G;
1493
+ case "left":
1494
+ return e.right <= n.left + G;
1495
+ case "down":
1496
+ return e.top >= n.bottom - G;
1497
+ default:
1498
+ return e.bottom <= n.top + G;
1499
+ }
1500
+ }
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) {
1504
+ case "right":
1505
+ return s > a + G;
1506
+ case "left":
1507
+ return s < a - G;
1508
+ case "down":
1509
+ return o > r + G;
1510
+ default:
1511
+ return o < r - G;
1512
+ }
1513
+ }
1514
+ function Ln(n, e, t) {
1515
+ 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;
1518
+ return Math.max(0, a) + r * o + s * 0.01;
1519
+ }
1520
+ function Pt(n, e, t, a) {
1521
+ const r = e.map(t);
1522
+ for (const s of [An, Sn]) {
1523
+ let o = -1, i = 1 / 0;
1524
+ for (let c = 0; c < r.length; c++) {
1525
+ if (!s(n, r[c], a))
1526
+ continue;
1527
+ const d = Ln(n, r[c], a);
1528
+ d < i && (i = d, o = c);
1529
+ }
1530
+ if (o >= 0)
1531
+ return e[o];
1532
+ }
1533
+ return null;
1534
+ }
1535
+ const ue = (n) => n === "left" || n === "right", Cn = (n) => {
1536
+ var e;
1537
+ return ((e = n.ownerDocument.defaultView) == null ? void 0 : e.getComputedStyle(n).direction) === "rtl";
1538
+ };
1539
+ function Hn(n, e, t, a) {
1540
+ if (n.length === 0)
1541
+ return null;
1542
+ 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) {
1552
+ let a = null;
1553
+ for (let s = n.parentElement; s && !s.contains(e); s = s.parentElement)
1554
+ s.hasAttribute(re) && (a = s);
1555
+ if (!a)
1556
+ return n;
1557
+ const r = Tt(a).enter;
1558
+ if (r === "last") {
1559
+ const s = t.get(a);
1560
+ return s && s.isConnected && a.contains(s) && te(s) ? s : n;
1561
+ }
1562
+ return r === "selected" ? [...a.querySelectorAll(Nn)].find(te) ?? n : U(a)[0] ?? n;
1563
+ }
1564
+ function Pn(n, e, t) {
1565
+ const a = X(n);
1566
+ let r = Ye(n, t.root), s = null;
1567
+ for (; ; ) {
1568
+ const o = Tt(r);
1569
+ if (o.nav === "spatial" || o.nav === "grid" || o.nav === "vertical" && !ue(e) || o.nav === "horizontal" && ue(e)) {
1570
+ const c = U(r, [n, s]);
1571
+ let d;
1572
+ if (o.nav === "vertical" || o.nav === "horizontal") {
1573
+ let u = e === "down" || e === "right";
1574
+ ue(e) && Cn(r) && (u = !u), d = Hn(c, n, u, o.wrap);
1575
+ } else
1576
+ d = Pt(a, c, X, e);
1577
+ if (d)
1578
+ return Tn(d, n, t.memory);
1579
+ }
1580
+ if (r === t.root || o.trap)
1581
+ return null;
1582
+ s = r, r = Ye(r, t.root);
1583
+ }
1584
+ }
1585
+ function Ze(n, e) {
1586
+ const t = e.left + e.width / 2, a = e.top + e.height / 2;
1587
+ 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);
1590
+ c < s && (s = c, r = o);
1591
+ }
1592
+ return r;
1593
+ }
1594
+ const Dt = [
1595
+ "[data-nice-region]",
1596
+ "header",
1597
+ "nav",
1598
+ "main",
1599
+ "aside",
1600
+ "footer",
1601
+ '[role="banner"]',
1602
+ '[role="navigation"]',
1603
+ '[role="main"]',
1604
+ '[role="complementary"]',
1605
+ '[role="contentinfo"]',
1606
+ '[role="search"]',
1607
+ '[role="region"][aria-label]',
1608
+ '[role="region"][aria-labelledby]'
1609
+ ].join(",");
1610
+ function Dn(n, e, t) {
1611
+ const a = [...t.root.querySelectorAll(Dt)], r = a.filter(
1612
+ (u) => !a.some((h) => h !== u && h.contains(u)) && U(u).length > 0
1613
+ );
1614
+ if (r.length === 0)
1615
+ 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];
1617
+ if (c === r[s])
1618
+ return null;
1619
+ const d = t.memory.get(c);
1620
+ return d && d.isConnected && c.contains(d) && te(d) ? d : U(c)[0];
1621
+ }
1622
+ const _a = [
1623
+ "navigate",
1624
+ "activate",
1625
+ "back",
1626
+ "secondary",
1627
+ "tertiary",
1628
+ "menu",
1629
+ "view",
1630
+ "sectionPrev",
1631
+ "sectionNext",
1632
+ "pagePrev",
1633
+ "pageNext",
1634
+ "first",
1635
+ "last",
1636
+ "scroll",
1637
+ "toggleHints"
1638
+ ], de = [
1639
+ "south",
1640
+ "east",
1641
+ "west",
1642
+ "north",
1643
+ "leftBumper",
1644
+ "rightBumper",
1645
+ "leftTrigger",
1646
+ "rightTrigger",
1647
+ "select",
1648
+ "start",
1649
+ "leftStick",
1650
+ "rightStick",
1651
+ "dpadUp",
1652
+ "dpadDown",
1653
+ "dpadLeft",
1654
+ "dpadRight",
1655
+ "home"
1656
+ ], xe = "nice-intent", ne = "nice-engagechange", Y = {
1657
+ confirmButton: "auto",
1658
+ gamepadBindings: {},
1659
+ keyboardBindings: {},
1660
+ stickThreshold: 0.5,
1661
+ stickDeadzone: 0.2,
1662
+ invertScroll: !1,
1663
+ repeatDelay: 400,
1664
+ repeatInterval: 110,
1665
+ repeatIntervalMin: 50,
1666
+ hints: "auto",
1667
+ hintDensity: "bar",
1668
+ glyphFamily: "auto",
1669
+ vibration: !1,
1670
+ arrowNavigation: "auto",
1671
+ 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";
1675
+ }
1676
+ class Vn {
1677
+ constructor(e, t) {
1678
+ 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
+ const r = a.gamepad;
1680
+ r && this.connected.add(r.index), this.schedule();
1681
+ }, this.onDisconnected = (a) => {
1682
+ var s, o;
1683
+ const r = a.gamepad;
1684
+ r && (this.connected.delete(r.index), this.states.delete(r.index) && ((o = (s = this.opts).onPadsChange) == null || o.call(s, this.pads))), this.connected.size === 0 && this.cancel();
1685
+ }, this.onVisibility = () => {
1686
+ this.win.document.hidden ? this.cancel() : this.schedule();
1687
+ }, this.frame = (a) => {
1688
+ this.frameId = 0, this.poll(a), this.schedule();
1689
+ }, this.win = e, this.opts = t;
1690
+ }
1691
+ /** Whether an animation frame is scheduled (false without a pad or on a hidden page). */
1692
+ get running() {
1693
+ return this.frameId !== 0;
1694
+ }
1695
+ get pads() {
1696
+ return [...this.states.values()].map((e) => e.info);
1697
+ }
1698
+ start() {
1699
+ if (!this.started) {
1700
+ this.started = !0, this.win.addEventListener("gamepadconnected", this.onConnected), this.win.addEventListener("gamepaddisconnected", this.onDisconnected), this.win.document.addEventListener("visibilitychange", this.onVisibility);
1701
+ for (const e of this.read())
1702
+ this.connected.add(e.index);
1703
+ this.schedule();
1704
+ }
1705
+ }
1706
+ stop() {
1707
+ this.started && (this.started = !1, this.win.removeEventListener("gamepadconnected", this.onConnected), this.win.removeEventListener("gamepaddisconnected", this.onDisconnected), this.win.document.removeEventListener("visibilitychange", this.onVisibility), this.cancel(), this.connected.clear(), this.states.clear());
1708
+ }
1709
+ /** Read every pad once; public so tests can drive a frame. */
1710
+ poll(e) {
1711
+ var o, i, c, d, u, h;
1712
+ const t = this.opts.timing(), a = /* @__PURE__ */ new Set(), r = this.read();
1713
+ for (const l of r) {
1714
+ a.add(l.index);
1715
+ let p = this.states.get(l.index);
1716
+ (!p || p.info.id !== l.id) && (p = {
1717
+ info: {
1718
+ index: l.index,
1719
+ id: l.id,
1720
+ family: sn(l.id),
1721
+ mapping: l.mapping
1722
+ },
1723
+ pressed: [],
1724
+ stick: null,
1725
+ 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);
1727
+ }
1728
+ let s = !1;
1729
+ for (const l of [...this.states.keys()])
1730
+ a.has(l) || (this.states.delete(l), s = !0);
1731
+ s && ((d = (c = this.opts).onPadsChange) == null || d.call(c, this.pads)), (h = (u = this.opts).onFrame) == null || h.call(u, r, e);
1732
+ }
1733
+ readButtons(e, t, a, r) {
1734
+ 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({
1737
+ pad: e.info,
1738
+ button: de[s],
1739
+ pressed: i,
1740
+ repeat: !1
1741
+ })) : i && this.repeats(e, c, a, r) && this.opts.onButton({
1742
+ pad: e.info,
1743
+ button: de[s],
1744
+ pressed: i,
1745
+ repeat: !0
1746
+ });
1747
+ }
1748
+ }
1749
+ readSticks(e, t, a, r) {
1750
+ const s = t.axes[0] ?? 0, o = t.axes[1] ?? 0, i = Math.hypot(s, o);
1751
+ if (i >= r.stickThreshold) {
1752
+ const h = Rn(s, o);
1753
+ 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
+ } 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);
1756
+ if (u > r.stickDeadzone) {
1757
+ const h = (u - r.stickDeadzone) / (1 - r.stickDeadzone) / u;
1758
+ this.opts.onScroll({ pad: e.info, x: c * h, y: d * h });
1759
+ }
1760
+ }
1761
+ repeats(e, t, a, r) {
1762
+ const s = e.holds.get(t);
1763
+ if (!s || a - s.since < r.repeatDelay)
1764
+ return !1;
1765
+ const o = Math.max(
1766
+ r.repeatIntervalMin,
1767
+ r.repeatInterval * On ** s.count
1768
+ );
1769
+ return a - s.last < o ? !1 : (s.last = a, s.count++, !0);
1770
+ }
1771
+ read() {
1772
+ var a, r;
1773
+ const e = ((r = (a = this.win.navigator).getGamepads) == null ? void 0 : r.call(a)) ?? [], t = [];
1774
+ for (const s of e)
1775
+ s && s.connected !== !1 && t.push(s);
1776
+ return t;
1777
+ }
1778
+ warnMapping(e) {
1779
+ e.mapping === "standard" || this.warned.has(e.id) || (this.warned.add(e.id), process.env.NODE_ENV !== "production" && console.warn(
1780
+ `[nice2dev/input] "${e.id}" has no standard mapping; its buttons are read by standard positions and may be off.`
1781
+ ));
1782
+ }
1783
+ schedule() {
1784
+ this.frameId === 0 && this.started && this.connected.size > 0 && !this.win.document.hidden && typeof this.win.requestAnimationFrame == "function" && (this.frameId = this.win.requestAnimationFrame(this.frame));
1785
+ }
1786
+ cancel() {
1787
+ this.frameId !== 0 && (this.win.cancelAnimationFrame(this.frameId), this.frameId = 0);
1788
+ }
1789
+ }
1790
+ const Fn = {
1791
+ up: "ArrowUp",
1792
+ down: "ArrowDown",
1793
+ left: "ArrowLeft",
1794
+ right: "ArrowRight"
1795
+ }, Qe = {
1796
+ ArrowUp: 38,
1797
+ ArrowDown: 40,
1798
+ ArrowLeft: 37,
1799
+ ArrowRight: 39,
1800
+ Enter: 13,
1801
+ Escape: 27,
1802
+ Home: 36,
1803
+ End: 35,
1804
+ PageUp: 33,
1805
+ 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 {
1808
+ 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)
1811
+ 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();
1815
+ const c = [
1816
+ t.ctrlKey || t.metaKey ? "Ctrl" : "",
1817
+ t.altKey ? "Alt" : "",
1818
+ t.shiftKey ? "Shift" : ""
1819
+ ], d = Re(t.key);
1820
+ this.capture({
1821
+ keys: [...c, d.length === 1 ? d.toUpperCase() : d].filter(Boolean).join("+")
1822
+ });
1823
+ return;
1824
+ }
1825
+ if (t.defaultPrevented || t.isComposing)
1826
+ return;
1827
+ const s = a ?? gn(t, this.keyTable);
1828
+ if (!s)
1829
+ return;
1830
+ const o = this.targetOf(t);
1831
+ if (Gt(o, s))
1832
+ return;
1833
+ const i = {
1834
+ intent: s.intent,
1835
+ direction: s.direction,
1836
+ source: r,
1837
+ repeat: t.repeat,
1838
+ keyEvent: t
1839
+ };
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)
1843
+ return;
1844
+ if (this.capture) {
1845
+ t.repeat || this.capture({ button: t.button });
1846
+ return;
1847
+ }
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({
1852
+ intent: "navigate",
1853
+ direction: t.direction,
1854
+ source: "gamepad",
1855
+ repeat: t.repeat,
1856
+ gamepad: t.pad
1857
+ });
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 = {
1861
+ intent: "scroll",
1862
+ direction: Math.abs(r) > Math.abs(s) ? r > 0 ? "right" : "left" : s > 0 ? "down" : "up",
1863
+ amount: Math.min(1, Math.hypot(r, s)),
1864
+ source: "gamepad",
1865
+ repeat: !0,
1866
+ gamepad: t.pad
1867
+ };
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;
1873
+ if (a instanceof HTMLElement) {
1874
+ for (let r = a.parentElement; r; r = r.parentElement)
1875
+ (r.hasAttribute(re) || r.matches(Dt) || r === this.doc.body) && this.memory.set(r, a);
1876
+ this.lastFocus = { el: a, rect: X(a), scope: xn(a)[0] ?? null };
1877
+ }
1878
+ }, this.onFocusOut = (t) => {
1879
+ const a = t.target;
1880
+ a instanceof HTMLElement && a.hasAttribute("data-nice-engaged") && this.release(a, this.state.method === "gamepad" ? "gamepad" : "keyboard", !1);
1881
+ }, this.recover = () => {
1882
+ const t = this.lastFocus;
1883
+ if (!t || t.el.isConnected)
1884
+ return;
1885
+ this.lastFocus = null;
1886
+ const a = this.doc.activeElement;
1887
+ if (a && a !== this.doc.body)
1888
+ 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);
1890
+ 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 = {
1892
+ method: "pointer",
1893
+ family: null,
1894
+ pads: [],
1895
+ preferences: Y,
1896
+ hintsVisible: Y.hints === "always"
1897
+ }, this.poller = new Vn(e, {
1898
+ timing: () => this.state.preferences,
1899
+ onButton: this.onPadButton,
1900
+ onStick: this.onPadStick,
1901
+ onScroll: this.onPadScroll,
1902
+ onPadsChange: (t) => {
1903
+ t.length === 0 && (this.snapshot = []), this.update({ pads: t });
1904
+ },
1905
+ onFrame: (t, a) => {
1906
+ this.snapshot = t, this.frameListeners.forEach((r) => r(t, a));
1907
+ }
1908
+ });
1909
+ }
1910
+ /* ── Lifecycle ───────────────────────────────────────────────── */
1911
+ get isStarted() {
1912
+ return this.started;
1913
+ }
1914
+ /** Whether the page runs in a TV browser (webOS, Tizen, Android TV, …): remote and 10-foot. */
1915
+ get isTv() {
1916
+ return this.tv;
1917
+ }
1918
+ start() {
1919
+ this.started || (this.started = !0, this.tv && !this.doc.documentElement.hasAttribute("data-nice-tv") && this.doc.documentElement.setAttribute("data-nice-tv", "auto"), this.win.addEventListener("keydown", this.onKeyDown), this.win.addEventListener("pointerdown", this.onPointerDown, { capture: !0, passive: !0 }), this.doc.addEventListener("focusin", this.onFocusIn), this.doc.addEventListener("focusout", this.onFocusOut), this.poller.start());
1920
+ }
1921
+ stop() {
1922
+ this.started && (this.started = !1, this.win.removeEventListener("keydown", this.onKeyDown), this.win.removeEventListener("pointerdown", this.onPointerDown, { capture: !0 }), this.doc.removeEventListener("focusin", this.onFocusIn), this.doc.removeEventListener("focusout", this.onFocusOut), this.poller.stop(), this.watchRecovery(!1));
1923
+ }
1924
+ /** Whether the gamepad loop is scheduled (false without a pad). */
1925
+ get polling() {
1926
+ return this.poller.running;
1927
+ }
1928
+ /* ── State ───────────────────────────────────────────────────── */
1929
+ /** Same object until something changes (fit for `useSyncExternalStore`). */
1930
+ getState() {
1931
+ return this.state;
1932
+ }
1933
+ subscribe(e) {
1934
+ return this.listeners.add(e), () => this.listeners.delete(e);
1935
+ }
1936
+ setPreferences(e) {
1937
+ const t = { ...this.state.preferences, ...e };
1938
+ this.keyTable = $e(t), this.padMaps.clear(), this.update({ preferences: t });
1939
+ }
1940
+ /** Words of announcements and labels; the React provider passes the app's translator. */
1941
+ setTranslator(e) {
1942
+ this.translate = e;
1943
+ }
1944
+ /** Pad family of the prompts: the preference, else the pad used last. */
1945
+ get glyphFamily() {
1946
+ const e = this.state.preferences.glyphFamily;
1947
+ return e !== "auto" ? e : this.state.family ?? "xbox";
1948
+ }
1949
+ /** 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];
1952
+ }
1953
+ /** The keys bound to an intent (for prompts), as written in the preferences. */
1954
+ keyboardBinding(e) {
1955
+ return this.keyTable[e];
1956
+ }
1957
+ toggleHints() {
1958
+ this.hintsToggled = !this.hintsToggled, this.update({});
1959
+ }
1960
+ /**
1961
+ * Hands the next pad button or key press to `onInput` instead of acting on it (a bindings
1962
+ * screen); returns what cancels the capture.
1963
+ */
1964
+ captureNextInput(e) {
1965
+ const t = (a) => {
1966
+ this.capture = null, e(a);
1967
+ };
1968
+ return this.capture = t, () => {
1969
+ this.capture === t && (this.capture = null);
1970
+ };
1971
+ }
1972
+ 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());
1976
+ }
1977
+ setMethod(e, t) {
1978
+ 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 }));
1980
+ }
1981
+ /* ── Gamepad frames (games, device testers) ──────────────────── */
1982
+ /** Raw pads every polled frame while a pad is connected. */
1983
+ subscribeGamepadFrames(e) {
1984
+ return this.frameListeners.add(e), () => this.frameListeners.delete(e);
1985
+ }
1986
+ /**
1987
+ * The pads as read in the last polled frame — empty without a pad. For code that runs its own
1988
+ * animation loop (games, particle effects) instead of a second `getGamepads()` reader.
1989
+ */
1990
+ get gamepadSnapshot() {
1991
+ return this.snapshot;
1992
+ }
1993
+ /** 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);
1996
+ }
1997
+ /** Rumble a given pad regardless of the preference (a game's own effect). */
1998
+ rumble(e, t, a = 0.5, r = 0.5) {
1999
+ var i, c, d;
2000
+ const s = (c = (i = this.win.navigator).getGamepads) == null ? void 0 : c.call(i)[e], o = s == null ? void 0 : s.vibrationActuator;
2001
+ (d = o == null ? void 0 : o.playEffect) == null || d.call(o, "dual-rumble", {
2002
+ startDelay: 0,
2003
+ duration: t,
2004
+ weakMagnitude: a,
2005
+ strongMagnitude: r
2006
+ });
2007
+ }
2008
+ /* ── Overlays ────────────────────────────────────────────────── */
2009
+ /** Puts an overlay on the stack; returns what takes it off. */
2010
+ pushOverlay(e) {
2011
+ return this.overlays.push(e), () => {
2012
+ const t = this.overlays.lastIndexOf(e);
2013
+ t >= 0 && this.overlays.splice(t, 1);
2014
+ };
2015
+ }
2016
+ topOverlay() {
2017
+ return this.overlays[this.overlays.length - 1];
2018
+ }
2019
+ /** Closes the top overlay that can be closed; returns whether one was. */
2020
+ closeTopOverlay(e) {
2021
+ for (let t = this.overlays.length - 1; t >= 0; t--) {
2022
+ const a = this.overlays[t];
2023
+ if (a.onClose)
2024
+ return a.onClose(e), !0;
2025
+ if (a.modal)
2026
+ return !1;
2027
+ }
2028
+ return !1;
2029
+ }
2030
+ /* ── Intents ─────────────────────────────────────────────────── */
2031
+ /** Dispatches `nice-intent` on the target; returns whether a handler consumed it. */
2032
+ dispatchIntent(e, t = this.focused()) {
2033
+ const a = new CustomEvent(xe, {
2034
+ detail: e,
2035
+ bubbles: !0,
2036
+ cancelable: !0,
2037
+ composed: !0
2038
+ });
2039
+ return t.dispatchEvent(a), a.defaultPrevented;
2040
+ }
2041
+ /** Moves focus in a direction through the scope tree; returns whether it moved. */
2042
+ moveFocus(e, t = this.focused()) {
2043
+ const a = this.navigationRoot();
2044
+ if (t === this.doc.body || !a.contains(t))
2045
+ return this.focusInitial(a);
2046
+ const r = Pn(t, e, { root: a, memory: this.memory });
2047
+ return r ? (this.focusElement(r), !0) : !1;
2048
+ }
2049
+ /** The `view` intent: next (`down`) or previous (`up`) region. */
2050
+ focusRegion(e, t = this.focused()) {
2051
+ const a = Dn(t, e, {
2052
+ root: this.navigationRoot(),
2053
+ memory: this.memory
2054
+ });
2055
+ return a ? (this.focusElement(a), !0) : !1;
2056
+ }
2057
+ /** Focuses the element and brings it into view (scroll-padding respected). */
2058
+ focusElement(e) {
2059
+ var t;
2060
+ e.focus({ preventScroll: !0, focusVisible: !0 }), (t = e.scrollIntoView) == null || t.call(e, { block: "nearest", inline: "nearest" });
2061
+ }
2062
+ /** Engages a control (ADR-005 § 6); popup controls open instead. */
2063
+ engage(e, t, a = ve(e)) {
2064
+ if (a) {
2065
+ if (a === "popup") {
2066
+ this.emulateKey(e, "ArrowDown", t);
2067
+ return;
2068
+ }
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"));
2070
+ }
2071
+ }
2072
+ /**
2073
+ * Releases an engaged control; `cancelled` when left with `back`. A native number field gets
2074
+ * its value from before back; custom controls do that in `useEngage`'s `onRelease`.
2075
+ */
2076
+ release(e, t, a) {
2077
+ if (!e.hasAttribute("data-nice-engaged"))
2078
+ return;
2079
+ e.removeAttribute("data-nice-engaged");
2080
+ 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"));
2082
+ }
2083
+ /** Defaults of trusted keys: the browser already clicks, types and scrolls. */
2084
+ keyDefault(e, t) {
2085
+ switch (e.intent) {
2086
+ case "navigate":
2087
+ return this.arrowPolicy(t, e.source) === "spatial" ? this.moveFocus(e.direction ?? "down", t) : !1;
2088
+ case "view":
2089
+ return this.focusRegion(e.direction ?? "down", t);
2090
+ case "back":
2091
+ return this.closeTopOverlay(e.source);
2092
+ case "toggleHints":
2093
+ return this.toggleHints(), !0;
2094
+ default:
2095
+ return !1;
2096
+ }
2097
+ }
2098
+ arrowPolicy(e, t) {
2099
+ if (t !== "keyboard")
2100
+ return "spatial";
2101
+ const a = this.state.preferences.arrowNavigation;
2102
+ return a !== "auto" ? a : zn(e) ?? "native";
2103
+ }
2104
+ /* ── Gamepad ─────────────────────────────────────────────────── */
2105
+ 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;
2108
+ }
2109
+ /** A pad intent: the intent event, then engage rules, key emulation and the default action. */
2110
+ deviceIntent(e) {
2111
+ const t = this.focused();
2112
+ if (this.dispatchIntent(e, t))
2113
+ return;
2114
+ const a = t === this.doc.body ? null : ve(t), r = a !== null && Et(t, a), s = t, o = e.source;
2115
+ switch (e.intent) {
2116
+ case "navigate": {
2117
+ 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);
2119
+ return;
2120
+ }
2121
+ 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));
2123
+ return;
2124
+ 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);
2126
+ return;
2127
+ case "sectionPrev":
2128
+ case "sectionNext":
2129
+ if (r && a === "value") {
2130
+ const i = e.intent === "sectionNext";
2131
+ ie(t) ? ce(t, i ? "up" : "down", "big") : this.emulateKey(t, i ? "PageUp" : "PageDown", o);
2132
+ }
2133
+ return;
2134
+ case "pagePrev":
2135
+ case "pageNext": {
2136
+ const i = e.intent === "pageNext";
2137
+ 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);
2142
+ }
2143
+ return;
2144
+ }
2145
+ case "first":
2146
+ case "last":
2147
+ this.emulateKey(t, e.intent === "first" ? "Home" : "End", o);
2148
+ return;
2149
+ case "secondary":
2150
+ this.contextMenu(t);
2151
+ return;
2152
+ case "menu":
2153
+ r && a === "text" && (this.release(s, o, !1), this.emulateKey(t, "Enter", o));
2154
+ return;
2155
+ case "view":
2156
+ this.focusRegion(e.direction ?? "down", t);
2157
+ return;
2158
+ case "toggleHints":
2159
+ this.toggleHints();
2160
+ return;
2161
+ default:
2162
+ return;
2163
+ }
2164
+ }
2165
+ /** A synthetic key on the element; returns whether a handler consumed it. */
2166
+ emulateKey(e, t, a) {
2167
+ const r = (o) => {
2168
+ const i = new KeyboardEvent(o, {
2169
+ key: t,
2170
+ code: t,
2171
+ bubbles: !0,
2172
+ cancelable: !0,
2173
+ composed: !0
2174
+ });
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;
2176
+ }, s = r("keydown");
2177
+ return e.dispatchEvent(s), e.dispatchEvent(r("keyup")), s.defaultPrevented;
2178
+ }
2179
+ /** `secondary` on a pad: the context menu of the element, as a right click would open it. */
2180
+ contextMenu(e) {
2181
+ const t = e.getBoundingClientRect();
2182
+ e.dispatchEvent(
2183
+ new MouseEvent("contextmenu", {
2184
+ bubbles: !0,
2185
+ cancelable: !0,
2186
+ button: 2,
2187
+ clientX: t.left + t.width / 2,
2188
+ clientY: t.top + t.height / 2
2189
+ })
2190
+ );
2191
+ }
2192
+ watchRecovery(e) {
2193
+ e && !this.observer && typeof MutationObserver < "u" && this.doc.body ? (this.observer = new MutationObserver(this.recover), this.observer.observe(this.doc.body, { childList: !0, subtree: !0 })) : !e && this.observer && (this.observer.disconnect(), this.observer = null);
2194
+ }
2195
+ /* ── Helpers ─────────────────────────────────────────────────── */
2196
+ focused() {
2197
+ const e = this.doc.activeElement;
2198
+ return e && e !== this.doc.documentElement ? e : this.doc.body;
2199
+ }
2200
+ targetOf(e) {
2201
+ 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();
2204
+ }
2205
+ /** Moves stay inside the top modal overlay. */
2206
+ navigationRoot() {
2207
+ for (let e = this.overlays.length - 1; e >= 0; e--)
2208
+ if (this.overlays[e].modal && this.overlays[e].element.isConnected)
2209
+ return this.overlays[e].element;
2210
+ return this.doc.body;
2211
+ }
2212
+ /** Nothing focused yet: the remembered element, else the first one of the main region. */
2213
+ 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];
2215
+ return r ? (this.focusElement(r), !0) : !1;
2216
+ }
2217
+ fireEngage(e, t) {
2218
+ e.dispatchEvent(new CustomEvent(ne, { detail: t, bubbles: !0 }));
2219
+ }
2220
+ /** Polite announcement through the engine's own live region. */
2221
+ announce(e) {
2222
+ 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;
2225
+ }
2226
+ this.live.textContent = e;
2227
+ }
2228
+ }
2229
+ function at(n, e, t) {
2230
+ n && (typeof n.scrollBy == "function" ? n.scrollBy({ left: e, top: t }) : (n.scrollLeft += e, n.scrollTop += t));
2231
+ }
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) {
2235
+ if (!(s instanceof HTMLElement) || !r)
2236
+ continue;
2237
+ 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)
2239
+ return s;
2240
+ }
2241
+ return a.scrollingElement ?? a.documentElement;
2242
+ }
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;
2247
+ }
2248
+ const ot = {
2249
+ method: "pointer",
2250
+ family: null,
2251
+ pads: [],
2252
+ preferences: Y,
2253
+ hintsVisible: !1
2254
+ }, jn = () => {
2255
+ }, It = /* @__PURE__ */ Ne(null);
2256
+ function K() {
2257
+ const [n] = j(
2258
+ () => typeof window > "u" ? null : Kn(window, !1)
2259
+ );
2260
+ return R(() => {
2261
+ n == null || n.start();
2262
+ }, [n]), n;
2263
+ }
2264
+ function Z(n) {
2265
+ const e = K(), t = I(
2266
+ (a) => e ? (e.start(), e.subscribe(a)) : jn,
2267
+ [e]
2268
+ );
2269
+ return mt(
2270
+ t,
2271
+ () => n(e ? e.getState() : ot),
2272
+ () => n(ot)
2273
+ );
2274
+ }
2275
+ function Ot() {
2276
+ return Z((n) => n);
2277
+ }
2278
+ function Ba() {
2279
+ return Z((n) => n.method);
2280
+ }
2281
+ function Ka() {
2282
+ return Z((n) => n.family);
2283
+ }
2284
+ function ja() {
2285
+ return Z((n) => n.pads);
2286
+ }
2287
+ function Un() {
2288
+ return Z((n) => n.hintsVisible);
2289
+ }
2290
+ function Gn() {
2291
+ const n = Z((r) => r.preferences), e = ae(It), t = K(), a = I(
2292
+ (r) => {
2293
+ e ? e.setPreferences(r) : t == null || t.setPreferences(r);
2294
+ },
2295
+ [e, t]
2296
+ );
2297
+ return [n, a];
2298
+ }
2299
+ function Ua({
2300
+ preferences: n,
2301
+ defaultPreferences: e,
2302
+ onPreferencesChange: t,
2303
+ persist: a = !0,
2304
+ children: r
2305
+ }) {
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 }),
2308
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- keyed by content: callers pass inline objects
2309
+ [h]
2310
+ );
2311
+ R(() => {
2312
+ s == null || s.setPreferences(l);
2313
+ }, [s, l]), R(() => () => s == null ? void 0 : s.setPreferences(Y), [s]), R(() => {
2314
+ s == null || s.setTranslator(o);
2315
+ }, [s, o]);
2316
+ const p = I(
2317
+ (k) => {
2318
+ const x = { ...d, ...k };
2319
+ u(x), a && i && i.setGlobalPreferences("input", { ...i.preferences.global.input, ...k }), t == null || t({ ...l, ...k });
2320
+ },
2321
+ [d, a, i, t, l]
2322
+ ), w = pe(() => ({ setPreferences: p }), [p]);
2323
+ return /* @__PURE__ */ N(It.Provider, { value: w, children: r });
2324
+ }
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;
2327
+ }
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);
2331
+ if (!e) {
2332
+ const t = { current: n.activeElement, previous: null };
2333
+ n.addEventListener(
2334
+ "focusin",
2335
+ (a) => {
2336
+ a.target !== t.current && (t.previous = t.current, t.current = a.target);
2337
+ },
2338
+ !0
2339
+ ), ct.set(n, t), e = t;
2340
+ }
2341
+ return e;
2342
+ }
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); )
2347
+ e = e.parentNode;
2348
+ return e;
2349
+ }
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;
2352
+ }
2353
+ function dt(n) {
2354
+ !n.hasAttribute("tabindex") && n.tabIndex < 0 && n.setAttribute("tabindex", "-1"), n.focus({ preventScroll: !0 });
2355
+ }
2356
+ function Yn(n, e) {
2357
+ const { open: t, modal: a = !0, restoreFocus: r = !0, closeHint: s } = e, o = O(e);
2358
+ o.current = e;
2359
+ const i = K(), { t: c } = J();
2360
+ R(() => {
2361
+ typeof document < "u" && lt(document);
2362
+ }, []);
2363
+ 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") }] : [],
2367
+ { fallback: !0 }
2368
+ ), B(
2369
+ n,
2370
+ (u) => {
2371
+ if (!t || !i)
2372
+ return;
2373
+ const h = u.ownerDocument, l = h.activeElement, p = lt(h), w = (E) => E instanceof HTMLElement && E !== h.body && !u.contains(E);
2374
+ let k = null;
2375
+ 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) => {
2377
+ const { onClose: g, closeOnEscape: v } = o.current;
2378
+ g && v !== !1 && g(E);
2379
+ }, C = {
2380
+ element: u,
2381
+ 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));
2384
+ 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);
2387
+ }
2388
+ const y = (E) => {
2389
+ if (E.defaultPrevented)
2390
+ return;
2391
+ if (E.key === "Escape" || E.key === "Esc") {
2392
+ i.topOverlay() === C && C.onClose && (E.preventDefault(), C.onClose(E.niceSource ?? "keyboard"));
2393
+ return;
2394
+ }
2395
+ if (E.key !== "Tab" || !a)
2396
+ return;
2397
+ const g = U(u);
2398
+ if (g.length === 0) {
2399
+ E.preventDefault();
2400
+ return;
2401
+ }
2402
+ const v = g[0], M = g[g.length - 1], f = h.activeElement;
2403
+ E.shiftKey && (f === v || f === u) ? (E.preventDefault(), M.focus()) : !E.shiftKey && f === M && (E.preventDefault(), v.focus());
2404
+ };
2405
+ u.addEventListener("keydown", y);
2406
+ let L = u.contains(h.activeElement);
2407
+ const T = (E) => {
2408
+ 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));
2410
+ };
2411
+ return h.addEventListener("focusin", T), () => {
2412
+ u.removeEventListener("keydown", y), h.removeEventListener("focusin", T), S(), m.forEach((v, M) => {
2413
+ const f = A[M];
2414
+ f === null ? u.removeAttribute(v) : u.setAttribute(v, f);
2415
+ });
2416
+ const E = h.activeElement, g = u.contains(E) || (!E || E === h.body) && L;
2417
+ r && k && k.isConnected && g && k.focus({ preventScroll: !0 });
2418
+ };
2419
+ },
2420
+ [t, a, r, i]
2421
+ );
2422
+ }
2423
+ const Wn = {
2424
+ Enter: ["Enter", "input.key.enter"],
2425
+ Escape: ["Esc", "input.key.escape"],
2426
+ Space: ["Space", "input.key.space"],
2427
+ Tab: ["Tab", "input.key.tab"],
2428
+ PageUp: ["Page Up", "input.key.pageUp"],
2429
+ PageDown: ["Page Down", "input.key.pageDown"],
2430
+ Home: ["Home", "input.key.home"],
2431
+ End: ["End", "input.key.end"],
2432
+ Backspace: ["Backspace", "input.key.backspace"],
2433
+ Delete: ["Delete", "input.key.delete"],
2434
+ ContextMenu: ["Menu key", "input.key.contextMenu"],
2435
+ Ctrl: ["Ctrl", "input.key.ctrl"],
2436
+ Alt: ["Alt", "input.key.alt"],
2437
+ Shift: ["Shift", "input.key.shift"]
2438
+ }, Xn = {
2439
+ ArrowUp: ["arrow-up", "Up arrow", "input.key.arrowUp"],
2440
+ ArrowDown: ["arrow-down", "Down arrow", "input.key.arrowDown"],
2441
+ ArrowLeft: ["arrow-left", "Left arrow", "input.key.arrowLeft"],
2442
+ ArrowRight: ["arrow-right", "Right arrow", "input.key.arrowRight"]
2443
+ }, Jn = {
2444
+ Ctrl: ["key-command", "Command", "input.key.command"],
2445
+ Alt: ["key-option", "Option", "input.key.option"],
2446
+ Shift: ["key-shift", "Shift", "input.key.shift"]
2447
+ }, Rt = {
2448
+ Cmd: "Ctrl",
2449
+ Meta: "Ctrl",
2450
+ Mod: "Ctrl",
2451
+ Control: "Ctrl",
2452
+ Option: "Alt",
2453
+ Esc: "Escape",
2454
+ " ": "Space"
2455
+ };
2456
+ function Zn() {
2457
+ var t;
2458
+ if (typeof navigator > "u")
2459
+ return !1;
2460
+ const n = navigator, e = ((t = n.userAgentData) == null ? void 0 : t.platform) || n.platform || n.userAgent;
2461
+ return /mac|iphone|ipad|ipod/i.test(e);
2462
+ }
2463
+ function ze(n) {
2464
+ return (n.endsWith("++") ? [...n.slice(0, -2).split("+"), "+"] : n.split("+")).filter(Boolean).map((t) => Rt[t] ?? t);
2465
+ }
2466
+ function Ga(n) {
2467
+ return [
2468
+ n.primary ? "Ctrl" : "",
2469
+ n.alt ? "Alt" : "",
2470
+ n.shift ? "Shift" : "",
2471
+ n.key
2472
+ ].filter(Boolean).join("+");
2473
+ }
2474
+ function ht(n, e) {
2475
+ const t = Rt[n] ?? n, a = (e ? Jn[t] : void 0) ?? Xn[t];
2476
+ if (a)
2477
+ return { icon: a[0], spoken: a[1], spokenKey: a[2] };
2478
+ const r = Wn[t];
2479
+ if (r)
2480
+ return { text: r[0], textKey: r[1], spoken: r[0], spokenKey: r[1] };
2481
+ const s = t.length === 1 ? t.toUpperCase() : t;
2482
+ return { text: s, spoken: s };
2483
+ }
2484
+ const Qn = { sm: 12, md: 14, lg: 18 }, ea = /* @__PURE__ */ Object.assign(
2485
+ function({
2486
+ keys: e,
2487
+ size: t = "md",
2488
+ platform: a = "auto",
2489
+ className: r,
2490
+ style: s
2491
+ }) {
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);
2495
+ return l.spokenKey ? o(l.spokenKey, l.spoken) : l.spoken;
2496
+ }).join(" + ")
2497
+ ).join(", ");
2498
+ return /* @__PURE__ */ N(
2499
+ "kbd",
2500
+ {
2501
+ className: `nice-keycap nice-keycap--${t}${r ? ` ${r}` : ""}`,
2502
+ style: s,
2503
+ role: "img",
2504
+ "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 })
2510
+ ] }, p);
2511
+ }) }, h))
2512
+ }
2513
+ );
2514
+ },
2515
+ { displayName: "NiceKeyCap" }
2516
+ ), he = { sm: 16, md: 20, lg: 28 }, ta = {
2517
+ up: "ArrowUp",
2518
+ down: "ArrowDown",
2519
+ left: "ArrowLeft",
2520
+ right: "ArrowRight"
2521
+ }, na = {
2522
+ up: "dpadUp",
2523
+ down: "dpadDown",
2524
+ left: "dpadLeft",
2525
+ right: "dpadRight"
2526
+ }, aa = /* @__PURE__ */ new Set([
2527
+ "south",
2528
+ "east",
2529
+ "west",
2530
+ "north",
2531
+ "dpadUp",
2532
+ "dpadDown",
2533
+ "dpadLeft",
2534
+ "dpadRight",
2535
+ "leftStick",
2536
+ "rightStick"
2537
+ ]), ft = {
2538
+ activate: ["remote-ok", "OK", "input.remote.ok"],
2539
+ back: ["remote-back", "Back", "input.intent.back"],
2540
+ menu: ["remote-menu", "Menu", "input.intent.menu"]
2541
+ }, Vt = /* @__PURE__ */ Object.assign(
2542
+ function({
2543
+ intent: e,
2544
+ direction: t,
2545
+ button: a,
2546
+ keys: r,
2547
+ label: s,
2548
+ device: o = "auto",
2549
+ family: i,
2550
+ size: c = "md",
2551
+ className: d,
2552
+ style: u
2553
+ }) {
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] }) });
2559
+ } 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(
2563
+ "span",
2564
+ {
2565
+ className: "nice-button-prompt__glyph",
2566
+ role: "img",
2567
+ "aria-label": h("input.pad.dpad", "D-pad"),
2568
+ children: /* @__PURE__ */ N(ee, { name: "pad-dpad", size: he[c] })
2569
+ }
2570
+ );
2571
+ 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(
2574
+ "span",
2575
+ {
2576
+ className: `nice-button-prompt__glyph nice-button-prompt__glyph--${k}-${m}`,
2577
+ role: "img",
2578
+ "aria-label": L,
2579
+ children: /* @__PURE__ */ N(ee, { name: vn(k, m), size: he[c] })
2580
+ }
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 }) });
2582
+ }
2583
+ } else {
2584
+ 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 }));
2586
+ }
2587
+ return !S && !C ? null : /* @__PURE__ */ V("span", { className: x, style: u, "data-device": p, children: [
2588
+ S,
2589
+ C
2590
+ ] });
2591
+ },
2592
+ { displayName: "NiceButtonPrompt" }
2593
+ ), Ae = [
2594
+ '[role="tab"]',
2595
+ '[role="option"]',
2596
+ '[role="menuitem"]',
2597
+ '[role="menuitemcheckbox"]',
2598
+ '[role="menuitemradio"]',
2599
+ '[role="radio"]',
2600
+ '[role="treeitem"]',
2601
+ "[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 = {}) {
2604
+ const {
2605
+ orientation: t = "horizontal",
2606
+ itemSelector: a = Ae,
2607
+ wrap: r = !1,
2608
+ homeEnd: s = !0,
2609
+ pageSize: o = 0,
2610
+ typeahead: i = !1,
2611
+ skipDisabled: c = !0,
2612
+ enabled: d = !0
2613
+ } = e, u = O(e.onMove);
2614
+ u.current = e.onMove;
2615
+ const h = O(e.activateOnMove);
2616
+ 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))
2621
+ ) : [];
2622
+ }, [n, a, c]), w = I(() => {
2623
+ const x = p();
2624
+ if (x.length === 0)
2625
+ 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) {
2628
+ const y = A === m ? "0" : "-1";
2629
+ A.getAttribute("tabindex") !== y && A.setAttribute("tabindex", y);
2630
+ }
2631
+ }, [p]), k = I(
2632
+ (x) => {
2633
+ 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);
2639
+ }
2640
+ },
2641
+ [p, l]
2642
+ );
2643
+ return B(
2644
+ n,
2645
+ (x) => {
2646
+ if (!d)
2647
+ return;
2648
+ x.setAttribute("data-nice-roving", t), w();
2649
+ let C = "", S;
2650
+ const m = (L) => {
2651
+ var P;
2652
+ if (L.defaultPrevented || L.altKey || L.ctrlKey || L.metaKey)
2653
+ return;
2654
+ const T = p(), E = x.ownerDocument, g = T.findIndex(
2655
+ (H) => H === E.activeElement || H.contains(E.activeElement)
2656
+ );
2657
+ if (g < 0)
2658
+ return;
2659
+ const v = ((P = E.defaultView) == null ? void 0 : P.getComputedStyle(x).direction) === "rtl";
2660
+ let M = -1;
2661
+ const f = (H) => {
2662
+ const D = g + H;
2663
+ return D >= 0 && D < T.length ? D : r ? (D + T.length) % T.length : -1;
2664
+ }, b = {
2665
+ ArrowUp: "up",
2666
+ ArrowDown: "down",
2667
+ ArrowLeft: "left",
2668
+ ArrowRight: "right"
2669
+ }[L.key];
2670
+ if (b) {
2671
+ const H = b === "left" || b === "right";
2672
+ if (t === "grid") {
2673
+ const D = Pt(
2674
+ X(T[g]),
2675
+ T.filter((_, F) => F !== g),
2676
+ X,
2677
+ b
2678
+ );
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);
2683
+ } else
2684
+ return;
2685
+ if (M < 0)
2686
+ 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;
2691
+ 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);
2696
+ 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;
2700
+ break;
2701
+ }
2702
+ }
2703
+ if (M < 0)
2704
+ return;
2705
+ } else
2706
+ return;
2707
+ L.preventDefault(), M !== g && k(M);
2708
+ }, A = () => w();
2709
+ x.addEventListener("keydown", m), x.addEventListener("focusin", A);
2710
+ const y = typeof MutationObserver > "u" ? null : new MutationObserver(() => w());
2711
+ return y == null || y.observe(x, {
2712
+ childList: !0,
2713
+ subtree: !0,
2714
+ attributes: !0,
2715
+ attributeFilter: [
2716
+ "aria-selected",
2717
+ "aria-checked",
2718
+ "aria-current",
2719
+ "aria-disabled",
2720
+ "disabled"
2721
+ ]
2722
+ }), () => {
2723
+ clearTimeout(S), x.removeEventListener("keydown", m), x.removeEventListener("focusin", A), y == null || y.disconnect(), x.removeAttribute("data-nice-roving");
2724
+ };
2725
+ },
2726
+ [d, t, r, s, o, i, p, w, k]
2727
+ ), { items: p, focusItem: k, refresh: w };
2728
+ }
2729
+ function ia(n, e, t = {}) {
2730
+ const { ref: a, enabled: r = !0 } = t, s = O(e);
2731
+ s.current = e;
2732
+ const o = typeof n == "string" ? n : n.join(",");
2733
+ K();
2734
+ const i = (c) => {
2735
+ const d = new Set(o.split(",")), u = (h) => {
2736
+ const l = h;
2737
+ l.defaultPrevented || !d.has(l.detail.intent) || s.current(l.detail, l) !== !1 && l.preventDefault();
2738
+ };
2739
+ return c.addEventListener(xe, u), () => c.removeEventListener(xe, u);
2740
+ };
2741
+ B(a, (c) => r ? i(c) : void 0, [o, r]), R(() => {
2742
+ if (!(a || !r))
2743
+ return i(document);
2744
+ }, [a, o, r]);
2745
+ }
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,
2750
+ a,
2751
+ r,
2752
+ s,
2753
+ o,
2754
+ i
2755
+ ]);
2756
+ }
2757
+ function qa(n, e = {}) {
2758
+ const { kind: t = "value", disabled: a = !1, restoreOnCancel: r = !1 } = e, [s, o] = j(!1), i = O(e);
2759
+ return i.current = e, K(), B(
2760
+ n,
2761
+ (c) => {
2762
+ const d = c.getAttribute("data-nice-engage");
2763
+ c.setAttribute("data-nice-engage", a ? "none" : t), c.toggleAttribute(Me, r);
2764
+ const u = (h) => {
2765
+ var p, w, k, x;
2766
+ if (h.target !== c)
2767
+ return;
2768
+ 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);
2770
+ };
2771
+ return c.addEventListener(ne, u), () => {
2772
+ c.removeEventListener(ne, u), c.removeAttribute(Me), d === null ? c.removeAttribute("data-nice-engage") : c.setAttribute("data-nice-engage", d);
2773
+ };
2774
+ },
2775
+ [t, a, r]
2776
+ ), { engaged: s };
2777
+ }
2778
+ function $a(n, e, t) {
2779
+ const {
2780
+ open: a,
2781
+ orientation: r = "vertical",
2782
+ itemSelector: s = Ae,
2783
+ typeahead: o = !0,
2784
+ closeOnFocusOut: i = !0,
2785
+ closeOnOutsidePress: c = !0
2786
+ } = t, d = O(t);
2787
+ d.current = t;
2788
+ const u = O("first");
2789
+ oa(e, { orientation: r, wrap: !0, typeahead: o, itemSelector: s }), Yn(e, {
2790
+ open: a,
2791
+ modal: !1,
2792
+ onClose: () => d.current.onOpenChange(!1)
2793
+ }), B(
2794
+ n,
2795
+ (h) => {
2796
+ const l = (p) => {
2797
+ var x, C;
2798
+ const w = p.niceSource;
2799
+ if (p.defaultPrevented || w === "gamepad" || w === "remote" || p.key !== "ArrowDown" && p.key !== "ArrowUp")
2800
+ return;
2801
+ if (p.preventDefault(), u.current = p.key === "ArrowUp" ? "last" : "first", !d.current.open) {
2802
+ d.current.onOpenChange(!0);
2803
+ return;
2804
+ }
2805
+ const k = [
2806
+ ...((x = e.current) == null ? void 0 : x.querySelectorAll(
2807
+ d.current.itemSelector ?? Ae
2808
+ )) ?? []
2809
+ ];
2810
+ (C = u.current === "last" ? k[k.length - 1] : k[0]) == null || C.focus();
2811
+ };
2812
+ return h.addEventListener("keydown", l), () => h.removeEventListener("keydown", l);
2813
+ },
2814
+ []
2815
+ ), B(
2816
+ e,
2817
+ (h) => {
2818
+ var C;
2819
+ if (!a)
2820
+ return;
2821
+ if (u.current === "last") {
2822
+ const S = h.querySelectorAll(s);
2823
+ (C = S[S.length - 1]) == null || C.focus();
2824
+ }
2825
+ 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) => {
2830
+ 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);
2839
+ };
2840
+ },
2841
+ [a, s, i, c]
2842
+ );
2843
+ }
2844
+ const la = 500;
2845
+ function Ya(n, e) {
2846
+ const {
2847
+ itemSelector: t = '[role="treeitem"]',
2848
+ rowSelector: a,
2849
+ typeahead: r = !0,
2850
+ enabled: s = !0
2851
+ } = e, o = O(e);
2852
+ o.current = e;
2853
+ const i = K();
2854
+ B(
2855
+ n,
2856
+ (c) => {
2857
+ if (!s)
2858
+ 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) => {
2860
+ var b;
2861
+ const M = ((b = v.parentElement) == null ? void 0 : b.closest(t)) ?? null;
2862
+ if (M && c.contains(M))
2863
+ return M;
2864
+ const f = l(v);
2865
+ if (f < 2)
2866
+ return null;
2867
+ const z = h();
2868
+ for (let P = z.indexOf(v) - 1; P >= 0; P--) {
2869
+ const H = l(z[P]);
2870
+ if (H === f - 1)
2871
+ return z[P];
2872
+ if (H < f - 1)
2873
+ return null;
2874
+ }
2875
+ return null;
2876
+ }, w = () => {
2877
+ var z;
2878
+ const v = [], M = /* @__PURE__ */ new Map(), f = [];
2879
+ for (const b of h()) {
2880
+ const P = l(b);
2881
+ let H = ((z = b.parentElement) == null ? void 0 : z.closest(t)) ?? null;
2882
+ 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);
2885
+ }
2886
+ return v;
2887
+ }, k = (v) => a ? [...v.querySelectorAll(a)].find(
2888
+ (M) => M.closest(t) === v
2889
+ ) ?? null : null, x = (v) => {
2890
+ const M = v.getAttribute("aria-label");
2891
+ if (M)
2892
+ return M;
2893
+ 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 = () => {
2896
+ const v = w();
2897
+ if (v.length === 0)
2898
+ 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);
2903
+ }
2904
+ }, S = (v) => {
2905
+ for (const M of h())
2906
+ M.setAttribute("tabindex", M === v ? "0" : "-1");
2907
+ i ? i.focusElement(v) : v.focus();
2908
+ };
2909
+ let m = "", A;
2910
+ const y = (v) => {
2911
+ var _;
2912
+ if (v.defaultPrevented || v.altKey || v.ctrlKey || v.metaKey || !u(v.target))
2913
+ return;
2914
+ const M = v.target, f = w(), z = f.indexOf(M);
2915
+ if (z < 0)
2916
+ return;
2917
+ 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;
2919
+ if (P === "ArrowDown")
2920
+ D = f[z + 1];
2921
+ else if (P === "ArrowUp")
2922
+ D = f[z - 1];
2923
+ else if (P === "Home")
2924
+ D = f[0];
2925
+ else if (P === "End")
2926
+ D = f[f.length - 1];
2927
+ else if (P === "ArrowRight") {
2928
+ if (H === "false") {
2929
+ v.preventDefault(), o.current.onToggle(M, !0);
2930
+ return;
2931
+ }
2932
+ const F = f[z + 1];
2933
+ D = H === "true" && F && p(F) === M ? F : void 0;
2934
+ } else if (P === "ArrowLeft") {
2935
+ if (H === "true") {
2936
+ v.preventDefault(), o.current.onToggle(M, !1);
2937
+ return;
2938
+ }
2939
+ D = p(M);
2940
+ } else if (P === "*") {
2941
+ v.preventDefault();
2942
+ const F = p(M);
2943
+ for (const $ of f)
2944
+ p($) === F && $.getAttribute("aria-expanded") === "false" && o.current.onToggle($, !0);
2945
+ return;
2946
+ } else if (P === "Enter" || P === " ") {
2947
+ v.preventDefault(), M.click();
2948
+ return;
2949
+ } else if (r && P.length === 1) {
2950
+ clearTimeout(A), m += P.toLowerCase(), A = setTimeout(() => {
2951
+ m = "";
2952
+ }, la);
2953
+ for (let F = 1; F <= f.length; F++) {
2954
+ const $ = f[(z + F) % f.length];
2955
+ if (x($).trim().toLowerCase().startsWith(m)) {
2956
+ D = $;
2957
+ break;
2958
+ }
2959
+ }
2960
+ }
2961
+ D && D !== M && (v.preventDefault(), S(D));
2962
+ }, L = (v) => {
2963
+ const M = u(v.target) ? k(v.target) : null;
2964
+ M && M.click();
2965
+ }, T = (v) => {
2966
+ const M = u(v.target) ? k(v.target) : null;
2967
+ if (!M)
2968
+ return;
2969
+ const f = M.getBoundingClientRect(), z = new MouseEvent("contextmenu", {
2970
+ bubbles: !0,
2971
+ cancelable: !0,
2972
+ clientX: v.clientX || f.left + f.width / 2,
2973
+ clientY: v.clientY || f.top + f.height / 2
2974
+ });
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());
2979
+ return g == null || g.observe(c, {
2980
+ childList: !0,
2981
+ subtree: !0,
2982
+ attributes: !0,
2983
+ attributeFilter: ["aria-expanded", "aria-selected", "hidden"]
2984
+ }), () => {
2985
+ clearTimeout(A), c.removeEventListener("keydown", y), c.removeEventListener("click", L), c.removeEventListener("contextmenu", T), c.removeEventListener("focusin", E), g == null || g.disconnect();
2986
+ };
2987
+ },
2988
+ [s, t, a, r, i]
2989
+ );
2990
+ }
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);
2994
+ o.current = e;
2995
+ const i = K();
2996
+ B(
2997
+ n,
2998
+ (c) => {
2999
+ if (!s)
3000
+ return;
3001
+ 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;
3007
+ }, 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 = () => {
3011
+ const y = w();
3012
+ if (y.length === 0)
3013
+ return;
3014
+ const L = d.activeElement, T = y.find((E) => E === L || E.contains(L)) ?? y.find((E) => E.getAttribute("tabindex") === "0") ?? y[0];
3015
+ for (const E of y) {
3016
+ const g = E === T ? "0" : "-1";
3017
+ E.getAttribute("tabindex") !== g && E.setAttribute("tabindex", g);
3018
+ }
3019
+ }, C = (y, L, T) => {
3020
+ var g, v;
3021
+ const E = p(y);
3022
+ for (const M of w())
3023
+ 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) => {
3026
+ var P;
3027
+ if (y.defaultPrevented || y.altKey || y.metaKey)
3028
+ return;
3029
+ const L = y.target, T = k(L);
3030
+ if (!T || p(T) !== L || L !== T && L.matches(fa))
3031
+ return;
3032
+ const E = h(), g = E.indexOf(T.parentElement), v = l(E[g]).indexOf(T), M = (H, D) => {
3033
+ const _ = E[H] ? l(E[H]) : [];
3034
+ if (_.length === 0)
3035
+ return null;
3036
+ const F = Math.min(D, _.length - 1);
3037
+ return [_[F], H, F];
3038
+ };
3039
+ 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;
3041
+ if (y.ctrlKey && (b === "Home" || b === "End"))
3042
+ f = b === "Home" ? M(0, 0) : M(E.length - 1, Number.MAX_SAFE_INTEGER);
3043
+ else {
3044
+ if (y.ctrlKey)
3045
+ return;
3046
+ if (b === "ArrowRight")
3047
+ f = v + 1 < l(E[g]).length ? M(g, v + 1) : null;
3048
+ else if (b === "ArrowLeft")
3049
+ f = v > 0 ? M(g, v - 1) : null;
3050
+ else if (b === "ArrowDown")
3051
+ f = g + 1 < E.length ? M(g + 1, v) : null;
3052
+ else if (b === "ArrowUp")
3053
+ f = g > 0 ? M(g - 1, v) : null;
3054
+ else if (b === "Home")
3055
+ f = M(g, 0);
3056
+ else if (b === "End")
3057
+ f = M(g, Number.MAX_SAFE_INTEGER);
3058
+ else if (b === "PageDown" || b === "PageUp") {
3059
+ const H = b === "PageDown" ? Math.min(E.length - 1, g + r) : Math.max(0, g - r);
3060
+ f = H !== g ? M(H, v) : null;
3061
+ } else if ((b === "Enter" || b === " ") && L === T && !T.matches("button,a[href]")) {
3062
+ y.preventDefault(), T.click();
3063
+ return;
3064
+ } else
3065
+ return;
3066
+ }
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());
3071
+ return A == null || A.observe(c, {
3072
+ childList: !0,
3073
+ subtree: !0,
3074
+ attributes: !0,
3075
+ attributeFilter: ["disabled"]
3076
+ }), () => {
3077
+ c.removeEventListener("keydown", S), c.removeEventListener("focusin", m), A == null || A.disconnect();
3078
+ };
3079
+ },
3080
+ [s, t, a, r, i]
3081
+ );
3082
+ }
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) {
3085
+ 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 });
3087
+ }),
3088
+ { 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());
3093
+ }
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("+");
3097
+ }
3098
+ function va(n) {
3099
+ if (process.env.NODE_ENV === "production")
3100
+ 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)
3104
+ 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.`
3108
+ );
3109
+ }
3110
+ }
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]);
3118
+ const d = (u) => {
3119
+ const h = c.split("|").map(Ht), l = (p) => {
3120
+ const w = p;
3121
+ if (w.defaultPrevented || !h.some((x) => Nt(x, w)))
3122
+ return;
3123
+ const k = e.current;
3124
+ k.when && !k.when() || (w.preventDefault(), k.onTrigger("keyboard"));
3125
+ };
3126
+ return u.addEventListener("keydown", l), () => u.removeEventListener("keydown", l);
3127
+ };
3128
+ B(a === "local" ? r : null, (u) => c ? d(u) : void 0, [
3129
+ c
3130
+ ]), R(() => {
3131
+ if (!(a === "local" || !c))
3132
+ return d(document);
3133
+ }, [c, a]), ia(
3134
+ s ?? "menu",
3135
+ (u) => {
3136
+ const h = e.current;
3137
+ return h.when && !h.when() ? !1 : (h.onTrigger(u.source), !0);
3138
+ },
3139
+ { ref: a === "local" ? r : void 0, enabled: !!s }
3140
+ ), At(
3141
+ a === "local" ? r ?? null : null,
3142
+ s && o ? [{ intent: s, label: n.label, keys: c.split("|")[0] }] : []
3143
+ ), B(
3144
+ i,
3145
+ (u) => {
3146
+ if (!c)
3147
+ return;
3148
+ const h = u.getAttribute("aria-keyshortcuts");
3149
+ return u.setAttribute("aria-keyshortcuts", c.split("|").map(pa).join(" ")), () => {
3150
+ h === null ? u.removeAttribute("aria-keyshortcuts") : u.setAttribute("aria-keyshortcuts", h);
3151
+ };
3152
+ },
3153
+ [c]
3154
+ );
3155
+ }
3156
+ function Za() {
3157
+ return mt(
3158
+ (n) => (Se.add(n), () => Se.delete(n)),
3159
+ () => Le,
3160
+ () => Le
3161
+ );
3162
+ }
3163
+ function Qa(n, e = "keyboard") {
3164
+ 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);
3167
+ }
3168
+ const ma = [];
3169
+ function Ma(n, e, t) {
3170
+ switch (e) {
3171
+ case "popup":
3172
+ return [
3173
+ { intent: "activate", label: t("input.intent.activate", "Select") },
3174
+ { intent: "back", label: t("input.hint.close", "Close") }
3175
+ ];
3176
+ case "text":
3177
+ return [
3178
+ { intent: "menu", label: t("input.hint.confirm", "Confirm") },
3179
+ { intent: "back", label: t("input.hint.done", "Done") }
3180
+ ];
3181
+ 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") }
3186
+ ] : [
3187
+ { intent: "navigate", label: t("input.hint.adjust", "Adjust") },
3188
+ { intent: "back", label: t("input.hint.done", "Done") }
3189
+ ];
3190
+ default:
3191
+ return [{ intent: "back", label: t("input.hint.done", "Done") }];
3192
+ }
3193
+ }
3194
+ const er = /* @__PURE__ */ Object.assign(
3195
+ function({
3196
+ position: e = "bottom",
3197
+ visibility: t = "auto",
3198
+ automatic: a = !0,
3199
+ hints: r = ma,
3200
+ max: s = 6,
3201
+ size: o = "sm",
3202
+ className: i,
3203
+ style: c
3204
+ }) {
3205
+ var S;
3206
+ const { t: d } = J(), u = Ot(), h = K(), l = nn(), [, p] = j(0);
3207
+ R(() => {
3208
+ if (!l)
3209
+ return;
3210
+ const m = () => p((y) => y + 1);
3211
+ l.addEventListener(ne, m);
3212
+ const A = typeof MutationObserver > "u" ? null : new MutationObserver(m);
3213
+ return A == null || A.observe(l, { attributes: !0, attributeFilter: ["aria-expanded"] }), () => {
3214
+ l.removeEventListener(ne, m), A == null || A.disconnect();
3215
+ };
3216
+ }, [l]);
3217
+ const w = u.method === "gamepad" || u.method === "remote";
3218
+ if (t === "auto" && !u.hintsVisible || t === "pad" && !(u.hintsVisible && (w || u.preferences.hints === "always")))
3219
+ return null;
3220
+ const k = [...r];
3221
+ if (l && typeof document < "u" && k.push(...tn(l, document)), a && l && l !== document.body) {
3222
+ 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") }));
3224
+ }
3225
+ const x = [], C = /* @__PURE__ */ new Set();
3226
+ for (const m of k) {
3227
+ const A = `${m.intent}:${m.direction ?? ""}`;
3228
+ C.has(A) || (C.add(A), x.push(m));
3229
+ }
3230
+ return x.length === 0 ? null : /* @__PURE__ */ N(
3231
+ "div",
3232
+ {
3233
+ className: `nice-input-hint-bar nice-input-hint-bar--${e}${i ? ` ${i}` : ""}`,
3234
+ style: c,
3235
+ "aria-hidden": "true",
3236
+ children: x.slice(0, s).map((m) => /* @__PURE__ */ N(
3237
+ Vt,
3238
+ {
3239
+ className: "nice-input-hint-bar__item",
3240
+ intent: m.intent,
3241
+ direction: m.direction,
3242
+ button: m.button,
3243
+ keys: m.keys,
3244
+ size: o,
3245
+ label: m.labelKey ? d(m.labelKey, m.label) : m.label
3246
+ },
3247
+ `${m.intent}:${m.direction ?? ""}`
3248
+ ))
3249
+ }
3250
+ );
3251
+ },
3252
+ { displayName: "NiceInputHintBar" }
3253
+ ), tr = /* @__PURE__ */ Object.assign(
3254
+ function({
3255
+ intent: e,
3256
+ direction: t,
3257
+ button: a,
3258
+ keys: r,
3259
+ always: s = !1,
3260
+ size: o = "sm",
3261
+ className: i
3262
+ }) {
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,
3266
+ {
3267
+ intent: e,
3268
+ direction: t,
3269
+ button: a,
3270
+ keys: r,
3271
+ size: o
3272
+ }
3273
+ ) });
3274
+ },
3275
+ { displayName: "NiceControlHint" }
3276
+ ), vt = {
3277
+ en: {
3278
+ code: "en",
3279
+ name: "English",
3280
+ nativeName: "English",
3281
+ rows: [
3282
+ ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"],
3283
+ ["a", "s", "d", "f", "g", "h", "j", "k", "l"],
3284
+ ["z", "x", "c", "v", "b", "n", "m"]
3285
+ ]
3286
+ },
3287
+ pl: {
3288
+ code: "pl",
3289
+ name: "Polish",
3290
+ nativeName: "Polski",
3291
+ rows: [
3292
+ ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"],
3293
+ ["a", "s", "d", "f", "g", "h", "j", "k", "l"],
3294
+ ["z", "x", "c", "v", "b", "n", "m"]
3295
+ ],
3296
+ accents: {
3297
+ a: ["ą"],
3298
+ c: ["ć"],
3299
+ e: ["ę"],
3300
+ l: ["ł"],
3301
+ n: ["ń"],
3302
+ o: ["ó"],
3303
+ s: ["ś"],
3304
+ z: ["ź", "ż"]
3305
+ }
3306
+ },
3307
+ de: {
3308
+ code: "de",
3309
+ name: "German",
3310
+ nativeName: "Deutsch",
3311
+ rows: [
3312
+ ["q", "w", "e", "r", "t", "z", "u", "i", "o", "p", "ü"],
3313
+ ["a", "s", "d", "f", "g", "h", "j", "k", "l", "ö", "ä"],
3314
+ ["y", "x", "c", "v", "b", "n", "m", "ß"]
3315
+ ],
3316
+ accents: { a: ["ä"], o: ["ö"], u: ["ü"], s: ["ß"] }
3317
+ },
3318
+ fr: {
3319
+ code: "fr",
3320
+ name: "French",
3321
+ nativeName: "Français",
3322
+ rows: [
3323
+ ["a", "z", "e", "r", "t", "y", "u", "i", "o", "p"],
3324
+ ["q", "s", "d", "f", "g", "h", "j", "k", "l", "m"],
3325
+ ["w", "x", "c", "v", "b", "n"]
3326
+ ],
3327
+ accents: {
3328
+ a: ["à", "â", "æ"],
3329
+ e: ["é", "è", "ê", "ë"],
3330
+ i: ["î", "ï"],
3331
+ o: ["ô", "œ"],
3332
+ u: ["ù", "û", "ü"],
3333
+ c: ["ç"]
3334
+ }
3335
+ },
3336
+ es: {
3337
+ code: "es",
3338
+ name: "Spanish",
3339
+ nativeName: "Español",
3340
+ rows: [
3341
+ ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"],
3342
+ ["a", "s", "d", "f", "g", "h", "j", "k", "l", "ñ"],
3343
+ ["z", "x", "c", "v", "b", "n", "m"]
3344
+ ],
3345
+ accents: { a: ["á"], e: ["é"], i: ["í"], o: ["ó"], u: ["ú", "ü"], n: ["ñ"] }
3346
+ },
3347
+ it: {
3348
+ code: "it",
3349
+ name: "Italian",
3350
+ nativeName: "Italiano",
3351
+ rows: [
3352
+ ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"],
3353
+ ["a", "s", "d", "f", "g", "h", "j", "k", "l"],
3354
+ ["z", "x", "c", "v", "b", "n", "m"]
3355
+ ],
3356
+ accents: { a: ["à"], e: ["è", "é"], i: ["ì"], o: ["ò"], u: ["ù"] }
3357
+ },
3358
+ pt: {
3359
+ code: "pt",
3360
+ name: "Portuguese",
3361
+ nativeName: "Português",
3362
+ rows: [
3363
+ ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"],
3364
+ ["a", "s", "d", "f", "g", "h", "j", "k", "l", "ç"],
3365
+ ["z", "x", "c", "v", "b", "n", "m"]
3366
+ ],
3367
+ accents: {
3368
+ a: ["á", "ã", "â", "à"],
3369
+ e: ["é", "ê"],
3370
+ i: ["í"],
3371
+ o: ["ó", "õ", "ô"],
3372
+ u: ["ú"],
3373
+ c: ["ç"]
3374
+ }
3375
+ },
3376
+ ru: {
3377
+ code: "ru",
3378
+ name: "Russian",
3379
+ nativeName: "Русский",
3380
+ rows: [
3381
+ ["й", "ц", "у", "к", "е", "н", "г", "ш", "щ", "з", "х", "ъ"],
3382
+ ["ф", "ы", "в", "а", "п", "р", "о", "л", "д", "ж", "э"],
3383
+ ["я", "ч", "с", "м", "и", "т", "ь", "б", "ю"]
3384
+ ]
3385
+ },
3386
+ uk: {
3387
+ code: "uk",
3388
+ name: "Ukrainian",
3389
+ nativeName: "Українська",
3390
+ rows: [
3391
+ ["й", "ц", "у", "к", "е", "н", "г", "ш", "щ", "з", "х", "ї"],
3392
+ ["ф", "і", "в", "а", "п", "р", "о", "л", "д", "ж", "є"],
3393
+ ["я", "ч", "с", "м", "и", "т", "ь", "б", "ю", "ґ"]
3394
+ ]
3395
+ },
3396
+ cs: {
3397
+ code: "cs",
3398
+ name: "Czech",
3399
+ nativeName: "Čeština",
3400
+ rows: [
3401
+ ["q", "w", "e", "r", "t", "z", "u", "i", "o", "p"],
3402
+ ["a", "s", "d", "f", "g", "h", "j", "k", "l"],
3403
+ ["y", "x", "c", "v", "b", "n", "m"]
3404
+ ],
3405
+ accents: {
3406
+ a: ["á"],
3407
+ c: ["č"],
3408
+ d: ["ď"],
3409
+ e: ["é", "ě"],
3410
+ i: ["í"],
3411
+ n: ["ň"],
3412
+ o: ["ó"],
3413
+ r: ["ř"],
3414
+ s: ["š"],
3415
+ t: ["ť"],
3416
+ u: ["ú", "ů"],
3417
+ y: ["ý"],
3418
+ z: ["ž"]
3419
+ }
3420
+ },
3421
+ tr: {
3422
+ code: "tr",
3423
+ name: "Turkish",
3424
+ nativeName: "Türkçe",
3425
+ rows: [
3426
+ ["q", "w", "e", "r", "t", "y", "u", "ı", "o", "p", "ğ", "ü"],
3427
+ ["a", "s", "d", "f", "g", "h", "j", "k", "l", "ş", "i"],
3428
+ ["z", "x", "c", "v", "b", "n", "m", "ö", "ç"]
3429
+ ]
3430
+ },
3431
+ nl: {
3432
+ code: "nl",
3433
+ name: "Dutch",
3434
+ nativeName: "Nederlands",
3435
+ rows: [
3436
+ ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"],
3437
+ ["a", "s", "d", "f", "g", "h", "j", "k", "l"],
3438
+ ["z", "x", "c", "v", "b", "n", "m"]
3439
+ ],
3440
+ accents: { e: ["é", "ë"], i: ["ï"], o: ["ö"], u: ["ü"] }
3441
+ },
3442
+ sv: {
3443
+ code: "sv",
3444
+ name: "Swedish",
3445
+ nativeName: "Svenska",
3446
+ rows: [
3447
+ ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "å"],
3448
+ ["a", "s", "d", "f", "g", "h", "j", "k", "l", "ö", "ä"],
3449
+ ["z", "x", "c", "v", "b", "n", "m"]
3450
+ ]
3451
+ },
3452
+ no: {
3453
+ code: "no",
3454
+ name: "Norwegian",
3455
+ nativeName: "Norsk",
3456
+ rows: [
3457
+ ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "å"],
3458
+ ["a", "s", "d", "f", "g", "h", "j", "k", "l", "ø", "æ"],
3459
+ ["z", "x", "c", "v", "b", "n", "m"]
3460
+ ]
3461
+ },
3462
+ da: {
3463
+ code: "da",
3464
+ name: "Danish",
3465
+ nativeName: "Dansk",
3466
+ rows: [
3467
+ ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "å"],
3468
+ ["a", "s", "d", "f", "g", "h", "j", "k", "l", "æ", "ø"],
3469
+ ["z", "x", "c", "v", "b", "n", "m"]
3470
+ ]
3471
+ },
3472
+ fi: {
3473
+ code: "fi",
3474
+ name: "Finnish",
3475
+ nativeName: "Suomi",
3476
+ rows: [
3477
+ ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "å"],
3478
+ ["a", "s", "d", "f", "g", "h", "j", "k", "l", "ö", "ä"],
3479
+ ["z", "x", "c", "v", "b", "n", "m"]
3480
+ ]
3481
+ },
3482
+ ro: {
3483
+ code: "ro",
3484
+ name: "Romanian",
3485
+ nativeName: "Română",
3486
+ rows: [
3487
+ ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"],
3488
+ ["a", "s", "d", "f", "g", "h", "j", "k", "l"],
3489
+ ["z", "x", "c", "v", "b", "n", "m"]
3490
+ ],
3491
+ accents: { a: ["ă", "â"], i: ["î"], s: ["ș"], t: ["ț"] }
3492
+ },
3493
+ hr: {
3494
+ code: "hr",
3495
+ name: "Croatian",
3496
+ nativeName: "Hrvatski",
3497
+ rows: [
3498
+ ["q", "w", "e", "r", "t", "z", "u", "i", "o", "p", "š", "đ"],
3499
+ ["a", "s", "d", "f", "g", "h", "j", "k", "l", "č", "ć"],
3500
+ ["y", "x", "c", "v", "b", "n", "m", "ž"]
3501
+ ]
3502
+ },
3503
+ el: {
3504
+ code: "el",
3505
+ name: "Greek",
3506
+ nativeName: "Ελληνικά",
3507
+ rows: [
3508
+ ["ς", "ε", "ρ", "τ", "υ", "θ", "ι", "ο", "π"],
3509
+ ["α", "σ", "δ", "φ", "γ", "η", "ξ", "κ", "λ"],
3510
+ ["ζ", "χ", "ψ", "ω", "β", "ν", "μ"]
3511
+ ],
3512
+ accents: { α: ["ά"], ε: ["έ"], η: ["ή"], ι: ["ί", "ϊ"], ο: ["ό"], υ: ["ύ", "ϋ"], ω: ["ώ"] }
3513
+ },
3514
+ hu: {
3515
+ code: "hu",
3516
+ name: "Hungarian",
3517
+ nativeName: "Magyar",
3518
+ rows: [
3519
+ ["q", "w", "e", "r", "t", "z", "u", "i", "o", "p", "ő", "ú"],
3520
+ ["a", "s", "d", "f", "g", "h", "j", "k", "l", "é", "á"],
3521
+ ["y", "x", "c", "v", "b", "n", "m", "ö", "ü", "ó"]
3522
+ ],
3523
+ accents: { a: ["á"], e: ["é"], i: ["í"], o: ["ó", "ö", "ő"], u: ["ú", "ü", "ű"] }
3524
+ },
3525
+ sk: {
3526
+ code: "sk",
3527
+ name: "Slovak",
3528
+ nativeName: "Slovenčina",
3529
+ rows: [
3530
+ ["q", "w", "e", "r", "t", "z", "u", "i", "o", "p"],
3531
+ ["a", "s", "d", "f", "g", "h", "j", "k", "l"],
3532
+ ["y", "x", "c", "v", "b", "n", "m"]
3533
+ ],
3534
+ accents: {
3535
+ a: ["á", "ä"],
3536
+ c: ["č"],
3537
+ d: ["ď"],
3538
+ e: ["é"],
3539
+ i: ["í"],
3540
+ l: ["ĺ", "ľ"],
3541
+ n: ["ň"],
3542
+ o: ["ó", "ô"],
3543
+ r: ["ŕ"],
3544
+ s: ["š"],
3545
+ t: ["ť"],
3546
+ u: ["ú"],
3547
+ y: ["ý"],
3548
+ z: ["ž"]
3549
+ }
3550
+ },
3551
+ bg: {
3552
+ code: "bg",
3553
+ name: "Bulgarian",
3554
+ nativeName: "Български",
3555
+ rows: [
3556
+ ["я", "в", "е", "р", "т", "ъ", "у", "и", "о", "п", "ш", "щ"],
3557
+ ["а", "с", "д", "ф", "г", "х", "й", "к", "л"],
3558
+ ["з", "ь", "ц", "ж", "б", "н", "м", "ч", "ю"]
3559
+ ]
3560
+ },
3561
+ sr: {
3562
+ code: "sr",
3563
+ name: "Serbian",
3564
+ nativeName: "Српски",
3565
+ rows: [
3566
+ ["љ", "њ", "е", "р", "т", "з", "у", "и", "о", "п", "ш", "ђ"],
3567
+ ["а", "с", "д", "ф", "г", "х", "ј", "к", "л", "ч", "ћ"],
3568
+ ["ж", "џ", "ц", "в", "б", "н", "м"]
3569
+ ]
3570
+ },
3571
+ ja: {
3572
+ code: "ja",
3573
+ name: "Japanese (Romaji)",
3574
+ nativeName: "日本語",
3575
+ rows: [
3576
+ ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"],
3577
+ ["a", "s", "d", "f", "g", "h", "j", "k", "l"],
3578
+ ["z", "x", "c", "v", "b", "n", "m"]
3579
+ ]
3580
+ },
3581
+ ko: {
3582
+ code: "ko",
3583
+ name: "Korean (Romaji)",
3584
+ nativeName: "한국어",
3585
+ rows: [
3586
+ ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"],
3587
+ ["a", "s", "d", "f", "g", "h", "j", "k", "l"],
3588
+ ["z", "x", "c", "v", "b", "n", "m"]
3589
+ ]
3590
+ },
3591
+ zh: {
3592
+ code: "zh",
3593
+ name: "Chinese (Pinyin)",
3594
+ nativeName: "中文",
3595
+ rows: [
3596
+ ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"],
3597
+ ["a", "s", "d", "f", "g", "h", "j", "k", "l"],
3598
+ ["z", "x", "c", "v", "b", "n", "m"]
3599
+ ]
3600
+ },
3601
+ ar: {
3602
+ code: "ar",
3603
+ name: "Arabic",
3604
+ nativeName: "العربية",
3605
+ rows: [
3606
+ ["ض", "ص", "ث", "ق", "ف", "غ", "ع", "ه", "خ", "ح", "ج", "د"],
3607
+ ["ش", "س", "ي", "ب", "ل", "ا", "ت", "ن", "م", "ك", "ط"],
3608
+ ["ئ", "ء", "ؤ", "ر", "لا", "ى", "ة", "و", "ز", "ظ"]
3609
+ ]
3610
+ },
3611
+ he: {
3612
+ code: "he",
3613
+ name: "Hebrew",
3614
+ nativeName: "עברית",
3615
+ rows: [
3616
+ ["/", "'", "ק", "ר", "א", "ט", "ו", "ן", "ם", "פ"],
3617
+ ["ש", "ד", "ג", "כ", "ע", "י", "ח", "ל", "ך", "ף"],
3618
+ ["ז", "ס", "ב", "ה", "נ", "מ", "צ", "ת", "ץ"]
3619
+ ]
3620
+ }
3621
+ }, nr = (n) => n === "ar" || n === "he", q = {
3622
+ value: "Backspace",
3623
+ label: "⌫",
3624
+ type: "backspace",
3625
+ width: 1.5
3626
+ }, ga = {
3627
+ value: "Enter",
3628
+ label: "⏎",
3629
+ type: "enter",
3630
+ width: 1.5
3631
+ }, se = {
3632
+ value: " ",
3633
+ label: "Space",
3634
+ type: "space",
3635
+ width: 5
3636
+ }, oe = {
3637
+ value: "Shift",
3638
+ label: "⇧",
3639
+ type: "shift",
3640
+ width: 1.5
3641
+ }, ba = {
3642
+ value: "CapsLock",
3643
+ label: "⇪",
3644
+ type: "caps",
3645
+ width: 1.75
3646
+ }, ya = { value: "Tab", label: "⇥", type: "tab", width: 1.5 }, fe = [
3647
+ { value: "1" },
3648
+ { value: "2" },
3649
+ { value: "3" },
3650
+ { value: "4" },
3651
+ { value: "5" },
3652
+ { value: "6" },
3653
+ { value: "7" },
3654
+ { value: "8" },
3655
+ { value: "9" },
3656
+ { value: "0" },
3657
+ { value: "-" },
3658
+ { value: "=" }
3659
+ ], wa = [
3660
+ { value: "!" },
3661
+ { value: "@" },
3662
+ { value: "#" },
3663
+ { value: "$" },
3664
+ { value: "%" },
3665
+ { value: "^" },
3666
+ { value: "&" },
3667
+ { value: "*" },
3668
+ { value: "(" },
3669
+ { value: ")" }
3670
+ ], Ea = [
3671
+ { value: "-" },
3672
+ { value: "_" },
3673
+ { value: "=" },
3674
+ { value: "+" },
3675
+ { value: "[" },
3676
+ { value: "]" },
3677
+ { value: "{" },
3678
+ { value: "}" },
3679
+ q
3680
+ ], ka = [
3681
+ { value: "Esc", label: "Esc", type: "fn", width: 1 },
3682
+ { value: "F1", label: "F1", type: "fn" },
3683
+ { value: "F2", label: "F2", type: "fn" },
3684
+ { value: "F3", label: "F3", type: "fn" },
3685
+ { value: "F4", label: "F4", type: "fn" },
3686
+ { value: "F5", label: "F5", type: "fn" },
3687
+ { value: "F6", label: "F6", type: "fn" },
3688
+ { value: "F7", label: "F7", type: "fn" },
3689
+ { value: "F8", label: "F8", type: "fn" },
3690
+ { value: "F9", label: "F9", type: "fn" },
3691
+ { value: "F10", label: "F10", type: "fn" },
3692
+ { value: "F11", label: "F11", type: "fn" },
3693
+ { value: "F12", label: "F12", type: "fn" }
3694
+ ], xa = [
3695
+ [{ value: "1" }, { value: "2" }, { value: "3" }],
3696
+ [{ value: "4" }, { value: "5" }, { value: "6" }],
3697
+ [{ value: "7" }, { value: "8" }, { value: "9" }],
3698
+ [{ value: ".", width: 1 }, { value: "0" }, q]
3699
+ ], ar = [
3700
+ [{ value: "7" }, { value: "8" }, { value: "9" }, { value: "/", type: "special" }],
3701
+ [{ value: "4" }, { value: "5" }, { value: "6" }, { value: "*", type: "special" }],
3702
+ [{ value: "1" }, { value: "2" }, { value: "3" }, { value: "-", type: "special" }],
3703
+ [{ value: "0", width: 2 }, { value: "." }, { value: "+", type: "special" }],
3704
+ [
3705
+ { value: "C", label: "C", type: "fn" },
3706
+ q,
3707
+ { value: "=", type: "enter", width: 2 }
3708
+ ]
3709
+ ], rr = [
3710
+ [
3711
+ { value: "1", label: "1" },
3712
+ { value: "2", label: "2 ABC" },
3713
+ { value: "3", label: "3 DEF" }
3714
+ ],
3715
+ [
3716
+ { value: "4", label: "4 GHI" },
3717
+ { value: "5", label: "5 JKL" },
3718
+ { value: "6", label: "6 MNO" }
3719
+ ],
3720
+ [
3721
+ { value: "7", label: "7 PQRS" },
3722
+ { value: "8", label: "8 TUV" },
3723
+ { value: "9", label: "9 WXYZ" }
3724
+ ],
3725
+ [
3726
+ { value: "*", label: "*" },
3727
+ { value: "0", label: "0 +" },
3728
+ { value: "#", label: "#" }
3729
+ ],
3730
+ [{ value: "Call", label: "Call", type: "enter", width: 1.5 }, q]
3731
+ ], sr = [
3732
+ [{ value: "1" }, { value: "2" }, { value: "3" }],
3733
+ [{ value: "4" }, { value: "5" }, { value: "6" }],
3734
+ [{ value: "7" }, { value: "8" }, { value: "9" }],
3735
+ [{ value: "Clear", label: "C", type: "fn" }, { value: "0" }, q]
3736
+ ];
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 } : {} };
3739
+ if (e === "minimal")
3740
+ return xa;
3741
+ if (t) {
3742
+ const l = [fe.slice(0, 10), wa, Ea], p = [{ value: "ABC", label: "ABC", type: "fn", width: 1.5 }];
3743
+ 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
+ }
3745
+ if (e === "compact") {
3746
+ const l = [
3747
+ o.map((w) => ({ value: w })),
3748
+ i.map((w) => ({ value: w })),
3749
+ [oe, ...c.map((w) => ({ value: w })), q]
3750
+ ], p = [{ value: "123", label: "123", type: "fn", width: 1.5 }];
3751
+ 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;
3752
+ }
3753
+ if (e === "standard") {
3754
+ const l = [
3755
+ fe.slice(0, 10),
3756
+ o.map((w) => ({ value: w })),
3757
+ i.map((w) => ({ value: w })),
3758
+ [oe, ...c.map((w) => ({ value: w })), q]
3759
+ ], p = [{ value: "#+=", label: "#+=", type: "fn", width: 1.5 }];
3760
+ 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
+ }
3762
+ const u = [
3763
+ ka,
3764
+ [...fe, q],
3765
+ [ya, ...o.map((l) => ({ value: l }))],
3766
+ [ba, ...i.map((l) => ({ value: l })), { ...d, width: 1.75 }],
3767
+ [
3768
+ { ...oe, width: 2.25 },
3769
+ ...c.map((l) => ({ value: l })),
3770
+ { ...oe, width: 2.25 }
3771
+ ]
3772
+ ], h = [{ value: "#+=", label: "#+=", type: "fn", width: 1.5 }];
3773
+ if (a && h.push({ value: "Lang", label: "Lang", type: "lang", width: 1 }), h.push({ ...se, width: a ? 6 : 7 }), h.push({ value: ",", width: 1 }), h.push({ value: ".", width: 1 }), u.push(h), s.accents) {
3774
+ const l = [];
3775
+ for (const [, p] of Object.entries(s.accents))
3776
+ for (const w of p)
3777
+ l.find((k) => k.value === w) || l.push({ value: w });
3778
+ l.length > 0 && u.push(l);
3779
+ }
3780
+ return u;
3781
+ }
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 };
3786
+ }
3787
+ function cr(n) {
3788
+ const e = Ve(n.text, n.caret);
3789
+ 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 };
3793
+ }
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 };
3797
+ }
3798
+ const za = /* @__PURE__ */ new Set(["Shift", "Control", "Alt", "Meta", "AltGraph"]);
3799
+ function ur() {
3800
+ let n = !1;
3801
+ return (e) => {
3802
+ if (e.key === "Tab") {
3803
+ const t = n;
3804
+ return n = !1, t;
3805
+ }
3806
+ return za.has(e.key) || (n = e.key === "Escape"), !1;
3807
+ };
3808
+ }
3809
+ export {
3810
+ U as $,
3811
+ ya as A,
3812
+ Ae as B,
3813
+ tr as C,
3814
+ Xa as D,
3815
+ Vn as E,
3816
+ Ha as F,
3817
+ Bn as G,
3818
+ er as H,
3819
+ Da as I,
3820
+ Ua as J,
3821
+ Fa as K,
3822
+ an as L,
3823
+ Va as M,
3824
+ 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,
3835
+ ve as Y,
3836
+ Pn as Z,
3837
+ 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,
3847
+ te as a8,
3848
+ Zn as a9,
3849
+ Ka as aA,
3850
+ Wa as aB,
3851
+ Oa as aC,
3852
+ Un as aD,
3853
+ 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,
3862
+ St as aN,
3863
+ rn as aO,
3864
+ nr as aa,
3865
+ gt as ab,
3866
+ ht as ac,
3867
+ lr as ad,
3868
+ Re as ae,
3869
+ Ht as af,
3870
+ Pt as ag,
3871
+ Tt as ah,
3872
+ X as ai,
3873
+ wn as aj,
3874
+ 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,
3898
+ we as j,
3899
+ ne as k,
3900
+ de as l,
3901
+ Y as m,
3902
+ _a as n,
3903
+ xe as o,
3904
+ vt as p,
3905
+ xa as q,
3906
+ ar as r,
3907
+ rr as s,
3908
+ sr as t,
3909
+ Yn as u,
3910
+ q as v,
3911
+ ba as w,
3912
+ ga as x,
3913
+ oe as y,
3914
+ se as z
3915
+ };