@nice2dev/ui 1.0.12 → 1.0.15

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.
Files changed (76) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +53 -36
  3. package/css/legacy-bg-text-aliases.css +83 -0
  4. package/dist/NiceErrorBoundary-BLTq8mPU.cjs +1 -0
  5. package/dist/NiceErrorBoundary-Bjw5U31n.js +762 -0
  6. package/dist/NiceErrorBoundary-CH8SBcSZ.js +762 -0
  7. package/dist/NiceErrorBoundary-CaVVPLh4.cjs +1 -0
  8. package/dist/NiceForm-CUlhtlHw.js +5357 -0
  9. package/dist/NiceForm-DTgIGX88.cjs +382 -0
  10. package/dist/NiceForm-Dbciuo4w.cjs +382 -0
  11. package/dist/NiceForm-Jf-ufPZz.js +5357 -0
  12. package/dist/NiceForm.css +1 -1
  13. package/dist/NiceModal-Bf1Q1VNL.cjs +1 -0
  14. package/dist/NiceModal-C_t2qqZd.js +95 -0
  15. package/dist/NiceModal-DrywdSv3.js +95 -0
  16. package/dist/NiceModal-FQqBxCij.cjs +1 -0
  17. package/dist/NiceModuleLifecyclePanel-CCFHxKIu.js +6343 -0
  18. package/dist/NiceModuleLifecyclePanel-CDX38sEx.js +6343 -0
  19. package/dist/NiceModuleLifecyclePanel-D8cIOI8I.cjs +1 -0
  20. package/dist/NiceModuleLifecyclePanel-xLrOv8nL.cjs +1 -0
  21. package/dist/NiceModuleLifecyclePanel.css +1 -1
  22. package/dist/NicePagination-Aj63sKV3.js +171 -0
  23. package/dist/NicePagination-BVkkePJU.js +171 -0
  24. package/dist/NicePagination-DGd3Hrh9.cjs +1 -0
  25. package/dist/NicePagination-DNjVutBJ.cjs +1 -0
  26. package/dist/NicePinCodeInput-B_0RCKQN.cjs +419 -0
  27. package/dist/NicePinCodeInput-CDtodnIM.js +11875 -0
  28. package/dist/NicePinCodeInput-Dffu701_.js +11875 -0
  29. package/dist/NicePinCodeInput-DytLfqZL.cjs +419 -0
  30. package/dist/NicePinCodeInput.css +1 -1
  31. package/dist/NiceSavedQueryPanel-4l-V9dGK.js +6446 -0
  32. package/dist/NiceSavedQueryPanel-B5TjD_Sb.cjs +596 -0
  33. package/dist/NiceSavedQueryPanel-CbR3EDQU.cjs +596 -0
  34. package/dist/NiceSavedQueryPanel-DJqCNWYZ.js +6446 -0
  35. package/dist/NiceTabs-B-9_mzpc.js +1624 -0
  36. package/dist/NiceTabs-CHg36waF.cjs +1 -0
  37. package/dist/NiceTabs-CbKhMxbC.cjs +1 -0
  38. package/dist/NiceTabs-HXphGn1B.js +1624 -0
  39. package/dist/NiceWindow-BxGVzUs2.js +1409 -0
  40. package/dist/NiceWindow-Ceb0mZ_0.js +1409 -0
  41. package/dist/NiceWindow-DXpnFZ0E.cjs +1 -0
  42. package/dist/NiceWindow-HhPIzPzs.cjs +1 -0
  43. package/dist/charts-BPJefcE8.js +4645 -0
  44. package/dist/charts-Dr6QyMiv.cjs +761 -0
  45. package/dist/charts-Us8Ep8MJ.cjs +761 -0
  46. package/dist/charts-fO6InNZd.js +4645 -0
  47. package/dist/charts.cjs +1 -1
  48. package/dist/charts.mjs +1 -1
  49. package/dist/core-B-tu8l9M.cjs +96 -0
  50. package/dist/core-BJ_UNMlX.js +22276 -0
  51. package/dist/core-DJ4NPp2B.js +22316 -0
  52. package/dist/core-DPY4m7vb.cjs +96 -0
  53. package/dist/data.cjs +1 -1
  54. package/dist/data.d.ts +7 -0
  55. package/dist/data.mjs +1 -1
  56. package/dist/editors.cjs +1 -1
  57. package/dist/editors.mjs +3 -3
  58. package/dist/feedback.cjs +1 -1
  59. package/dist/feedback.mjs +2 -2
  60. package/dist/index-B-9lbtwJ.cjs +5194 -0
  61. package/dist/index-BNy9Nn0X.js +61422 -0
  62. package/dist/index-DHc_KZkF.js +61311 -0
  63. package/dist/index-drIVMHeC.cjs +5194 -0
  64. package/dist/index.cjs +1 -1
  65. package/dist/index.css +1 -1
  66. package/dist/index.d.ts +1209 -67
  67. package/dist/index.mjs +887 -871
  68. package/dist/lazy.cjs +1 -1
  69. package/dist/lazy.mjs +3 -3
  70. package/dist/navigation.cjs +1 -1
  71. package/dist/navigation.d.ts +309 -70
  72. package/dist/navigation.mjs +92 -91
  73. package/dist/overlays.cjs +1 -1
  74. package/dist/overlays.mjs +36 -36
  75. package/dist/style.css +7 -0
  76. package/package.json +9 -5
@@ -0,0 +1,1409 @@
1
+ import { jsxs as y, Fragment as Te, jsx as c } from "react/jsx-runtime";
2
+ import { $ as ve, a as pt, S as Ce, u as ft, B as wt } from "./core-BJ_UNMlX.js";
3
+ import _t, { useRef as K, useState as D, useCallback as k, useEffect as W, useReducer as gt, useMemo as ge, useContext as $e, createContext as Pe, forwardRef as Ie } from "react";
4
+ const $t = ({
5
+ visible: e,
6
+ onClose: t,
7
+ title: o,
8
+ items: s,
9
+ showCancelButton: u = !0,
10
+ cancelText: d,
11
+ className: h,
12
+ style: g
13
+ }) => {
14
+ const { t: p } = ve();
15
+ return e ? /* @__PURE__ */ y(Te, { children: [
16
+ /* @__PURE__ */ c("div", { className: "nice-actionsheet__overlay", onClick: t }),
17
+ /* @__PURE__ */ y("div", { className: `nice-actionsheet ${h || ""}`, style: g, children: [
18
+ o && /* @__PURE__ */ c("div", { className: "nice-actionsheet__title", children: o }),
19
+ /* @__PURE__ */ c("div", { className: "nice-actionsheet__items", children: s.map((E, r) => /* @__PURE__ */ y(
20
+ "button",
21
+ {
22
+ className: `nice-actionsheet__item ${E.type === "danger" ? "nice-actionsheet__item--danger" : ""}`,
23
+ disabled: E.disabled,
24
+ onClick: () => {
25
+ E.onClick?.(), t();
26
+ },
27
+ children: [
28
+ E.icon && /* @__PURE__ */ c("span", { className: "nice-actionsheet__icon", children: E.icon }),
29
+ E.text
30
+ ]
31
+ },
32
+ r
33
+ )) }),
34
+ u && /* @__PURE__ */ c("button", { className: "nice-actionsheet__cancel", onClick: t, children: d || p("cancel", "Cancel") })
35
+ ] })
36
+ ] }) : null;
37
+ }, Pt = ({
38
+ visible: e,
39
+ onClose: t,
40
+ targetRef: o,
41
+ position: s = "bottom",
42
+ title: u,
43
+ showArrow: d = !0,
44
+ width: h,
45
+ children: g,
46
+ className: p,
47
+ style: E,
48
+ displayStyle: r
49
+ }) => {
50
+ pt("tooltip", r);
51
+ const b = K(null), [Y, f] = D({ top: 0, left: 0 }), L = k(() => {
52
+ const w = o.current, X = b.current;
53
+ if (!w || !X)
54
+ return;
55
+ const n = w.getBoundingClientRect(), v = X.getBoundingClientRect();
56
+ let a = 0, z = 0;
57
+ const T = 8;
58
+ switch (s) {
59
+ case "top":
60
+ a = n.top - v.height - T, z = n.left + (n.width - v.width) / 2;
61
+ break;
62
+ case "bottom":
63
+ a = n.bottom + T, z = n.left + (n.width - v.width) / 2;
64
+ break;
65
+ case "left":
66
+ a = n.top + (n.height - v.height) / 2, z = n.left - v.width - T;
67
+ break;
68
+ case "right":
69
+ a = n.top + (n.height - v.height) / 2, z = n.right + T;
70
+ break;
71
+ }
72
+ f({ top: a + window.scrollY, left: z + window.scrollX });
73
+ }, [o, s]);
74
+ return W(() => {
75
+ if (e) {
76
+ requestAnimationFrame(L);
77
+ const w = (X) => {
78
+ b.current && !b.current.contains(X.target) && o.current && !o.current.contains(X.target) && t();
79
+ };
80
+ return document.addEventListener("mousedown", w), () => document.removeEventListener("mousedown", w);
81
+ }
82
+ }, [e, L, t, o]), e ? /* @__PURE__ */ y(
83
+ "div",
84
+ {
85
+ ref: b,
86
+ className: `nice-popover nice-popover--${s} ${p || ""}`,
87
+ style: { ...E, position: "absolute", top: Y.top, left: Y.left, width: h },
88
+ children: [
89
+ d && /* @__PURE__ */ c("div", { className: `nice-popover__arrow nice-popover__arrow--${s}` }),
90
+ u && /* @__PURE__ */ c("div", { className: "nice-popover__title", children: u }),
91
+ /* @__PURE__ */ c("div", { className: "nice-popover__content", children: g })
92
+ ]
93
+ }
94
+ ) : null;
95
+ }, Dt = ({
96
+ visible: e,
97
+ message: t,
98
+ container: o,
99
+ showIndicator: s = !0,
100
+ shading: u = !0,
101
+ className: d,
102
+ style: h
103
+ }) => {
104
+ const { t: g } = ve();
105
+ if (!e)
106
+ return null;
107
+ const p = !!o?.current, E = /* @__PURE__ */ y("div", { className: `nice-loadpanel ${d || ""}`, style: h, children: [
108
+ u && /* @__PURE__ */ c("div", { className: "nice-loadpanel__shade" }),
109
+ /* @__PURE__ */ y("div", { className: "nice-loadpanel__box", children: [
110
+ s && /* @__PURE__ */ c("div", { className: "nice-spinner nice-spinner--md" }),
111
+ /* @__PURE__ */ c("span", { className: "nice-loadpanel__text", children: t || g("loading", "Loading...") })
112
+ ] })
113
+ ] });
114
+ if (p && o.current) {
115
+ const r = o.current;
116
+ return r.style.position = r.style.position || "relative", E;
117
+ }
118
+ return E;
119
+ }, Yt = ({
120
+ direction: e = "row",
121
+ align: t,
122
+ justify: o,
123
+ wrap: s,
124
+ gap: u,
125
+ flex: d,
126
+ children: h,
127
+ className: g,
128
+ style: p
129
+ }) => /* @__PURE__ */ c(
130
+ "div",
131
+ {
132
+ className: `nice-box ${g || ""}`,
133
+ style: {
134
+ display: "flex",
135
+ flexDirection: e,
136
+ alignItems: t,
137
+ justifyContent: o,
138
+ flexWrap: s ? "wrap" : void 0,
139
+ gap: u,
140
+ flex: d,
141
+ ...p
142
+ },
143
+ children: h
144
+ }
145
+ ), Xt = ({
146
+ direction: e = "row",
147
+ items: t,
148
+ gap: o,
149
+ className: s,
150
+ style: u
151
+ }) => /* @__PURE__ */ c(
152
+ "div",
153
+ {
154
+ className: `nice-responsivebox ${s || ""}`,
155
+ style: { display: "flex", flexDirection: e, gap: o, ...u },
156
+ children: t.map((d, h) => /* @__PURE__ */ c(
157
+ "div",
158
+ {
159
+ style: { flex: d.ratio ?? 1, flexBasis: d.baseSize, flexShrink: d.shrink ?? 1 },
160
+ children: d.children
161
+ },
162
+ h
163
+ ))
164
+ }
165
+ ), Ot = ({
166
+ width: e = 200,
167
+ height: t = 200,
168
+ minWidth: o = 50,
169
+ minHeight: s = 50,
170
+ maxWidth: u = 1 / 0,
171
+ maxHeight: d = 1 / 0,
172
+ handles: h = ["right", "bottom", "bottomRight"],
173
+ onResize: g,
174
+ children: p,
175
+ className: E,
176
+ style: r
177
+ }) => {
178
+ const [b, Y] = D({ width: e, height: t }), f = K(null), L = (n, v) => {
179
+ v.preventDefault();
180
+ const a = v.clientX, z = v.clientY, T = b.width, B = b.height, _ = (i) => {
181
+ const x = i.clientX - a, S = i.clientY - z;
182
+ let I = T, l = B;
183
+ (n.includes("right") || n === "right") && (I = T + x), (n.includes("bottom") || n === "bottom") && (l = B + S), (n.includes("left") || n === "left") && (I = T - x), (n.includes("top") || n === "top") && (l = B - S), I = Math.max(o, Math.min(u, I)), l = Math.max(s, Math.min(d, l)), Y({ width: I, height: l }), g?.({ width: I, height: l });
184
+ }, P = () => {
185
+ document.removeEventListener("pointermove", _), document.removeEventListener("pointerup", P);
186
+ };
187
+ document.addEventListener("pointermove", _), document.addEventListener("pointerup", P);
188
+ }, w = (n) => {
189
+ switch (n) {
190
+ case "top":
191
+ case "bottom":
192
+ return "ns-resize";
193
+ case "left":
194
+ case "right":
195
+ return "ew-resize";
196
+ case "topLeft":
197
+ case "bottomRight":
198
+ return "nwse-resize";
199
+ case "topRight":
200
+ case "bottomLeft":
201
+ return "nesw-resize";
202
+ default:
203
+ return "default";
204
+ }
205
+ }, X = (n) => {
206
+ const v = { position: "absolute", zIndex: 1 }, a = 8;
207
+ return n === "right" ? {
208
+ ...v,
209
+ top: 0,
210
+ right: -a / 2,
211
+ width: a,
212
+ height: "100%",
213
+ cursor: w(n)
214
+ } : n === "bottom" ? {
215
+ ...v,
216
+ left: 0,
217
+ bottom: -a / 2,
218
+ width: "100%",
219
+ height: a,
220
+ cursor: w(n)
221
+ } : n === "left" ? { ...v, top: 0, left: -a / 2, width: a, height: "100%", cursor: w(n) } : n === "top" ? { ...v, top: -a / 2, left: 0, width: "100%", height: a, cursor: w(n) } : n === "bottomRight" ? {
222
+ ...v,
223
+ bottom: -a / 2,
224
+ right: -a / 2,
225
+ width: a * 2,
226
+ height: a * 2,
227
+ cursor: w(n)
228
+ } : n === "bottomLeft" ? {
229
+ ...v,
230
+ bottom: -a / 2,
231
+ left: -a / 2,
232
+ width: a * 2,
233
+ height: a * 2,
234
+ cursor: w(n)
235
+ } : n === "topRight" ? {
236
+ ...v,
237
+ top: -a / 2,
238
+ right: -a / 2,
239
+ width: a * 2,
240
+ height: a * 2,
241
+ cursor: w(n)
242
+ } : n === "topLeft" ? {
243
+ ...v,
244
+ top: -a / 2,
245
+ left: -a / 2,
246
+ width: a * 2,
247
+ height: a * 2,
248
+ cursor: w(n)
249
+ } : v;
250
+ };
251
+ return /* @__PURE__ */ y(
252
+ "div",
253
+ {
254
+ ref: f,
255
+ className: `nice-resizable ${E || ""}`,
256
+ style: {
257
+ ...r,
258
+ width: b.width,
259
+ height: b.height,
260
+ position: "relative",
261
+ overflow: "hidden"
262
+ },
263
+ children: [
264
+ p,
265
+ h.map((n) => /* @__PURE__ */ c("div", { style: X(n), onPointerDown: (v) => L(n, v) }, n))
266
+ ]
267
+ }
268
+ );
269
+ }, qt = ({
270
+ direction: e = "vertical",
271
+ showScrollbar: t = "onInteraction",
272
+ width: o,
273
+ height: s,
274
+ onScroll: u,
275
+ children: d,
276
+ className: h,
277
+ style: g
278
+ }) => {
279
+ const p = e === "horizontal" || e === "both" ? "auto" : "hidden", E = e === "vertical" || e === "both" ? "auto" : "hidden";
280
+ return /* @__PURE__ */ c(
281
+ "div",
282
+ {
283
+ className: `nice-scrollview ${t === "never" ? "nice-scrollview--hide-sb" : t === "always" ? "nice-scrollview--show-sb" : ""} ${h || ""}`,
284
+ style: { ...g, width: o, height: s, overflowX: p, overflowY: E },
285
+ onScroll: u,
286
+ children: d
287
+ }
288
+ );
289
+ };
290
+ function ze(e, t) {
291
+ if (!e)
292
+ return { score: 1, indices: [] };
293
+ const o = e.toLowerCase(), s = t.toLowerCase();
294
+ let u = 0;
295
+ const d = [];
296
+ let h = 0, g = -1;
297
+ for (let p = 0; p < s.length && u < o.length; p++)
298
+ s[p] === o[u] && (d.push(p), g === p - 1 && (h += 3), (p === 0 || /[\s\-_/.]/.test(t[p - 1])) && (h += 5), t[p] === e[u] && (h += 1), h += 1, g = p, u++);
299
+ return u < o.length ? null : (h -= d[0] * 0.1, { score: h, indices: d });
300
+ }
301
+ function vt(e, t) {
302
+ if (t.length === 0)
303
+ return [e];
304
+ const o = [];
305
+ let s = 0;
306
+ const u = new Set(t);
307
+ for (let d = 0; d < e.length; d++)
308
+ u.has(d) && (s < d && o.push(e.slice(s, d)), o.push(
309
+ _t.createElement(
310
+ "mark",
311
+ { key: `m-${d}`, className: "nice-command-palette__match" },
312
+ e[d]
313
+ )
314
+ ), s = d + 1);
315
+ return s < e.length && o.push(e.slice(s)), o;
316
+ }
317
+ function yt(e, t) {
318
+ switch (t.type) {
319
+ case "REGISTER": {
320
+ const o = new Map(e.commands);
321
+ return o.set(t.command.id, t.command), { ...e, commands: o };
322
+ }
323
+ case "REGISTER_BATCH": {
324
+ const o = new Map(e.commands);
325
+ for (const s of t.commands)
326
+ o.set(s.id, s);
327
+ return { ...e, commands: o };
328
+ }
329
+ case "UNREGISTER": {
330
+ const o = new Map(e.commands);
331
+ return o.delete(t.id), { ...e, commands: o };
332
+ }
333
+ case "OPEN":
334
+ return { ...e, isOpen: !0, query: "", selectedIndex: 0 };
335
+ case "CLOSE":
336
+ return { ...e, isOpen: !1, query: "", selectedIndex: 0 };
337
+ case "SET_QUERY":
338
+ return { ...e, query: t.query, selectedIndex: 0 };
339
+ case "SET_SELECTED":
340
+ return { ...e, selectedIndex: t.index };
341
+ case "ADD_RECENT": {
342
+ const o = e.recentIds.filter((s) => s !== t.id);
343
+ return {
344
+ ...e,
345
+ recentIds: [t.id, ...o].slice(0, t.maxRecent)
346
+ };
347
+ }
348
+ default:
349
+ return e;
350
+ }
351
+ }
352
+ const De = Pe(null);
353
+ function bt() {
354
+ const e = $e(De);
355
+ if (!e)
356
+ throw new Error("useCommandPalette must be used within NiceCommandPaletteProvider");
357
+ return e;
358
+ }
359
+ const xt = ({
360
+ children: e,
361
+ commands: t,
362
+ placeholder: o = "Type a command...",
363
+ maxVisible: s = 10,
364
+ maxRecent: u = 5,
365
+ className: d,
366
+ emptyText: h = "No commands found",
367
+ closeOnAction: g = !0,
368
+ onOpen: p,
369
+ onClose: E
370
+ }) => {
371
+ const [r, b] = gt(yt, {
372
+ commands: new Map(t?.map((l) => [l.id, l]) ?? []),
373
+ isOpen: !1,
374
+ query: "",
375
+ selectedIndex: 0,
376
+ recentIds: []
377
+ }), Y = K(null), f = K(null), [L, w] = D(!1), X = k((l) => {
378
+ b({ type: "REGISTER", command: l });
379
+ }, []), n = k((l) => {
380
+ b({ type: "UNREGISTER", id: l });
381
+ }, []), v = k((l) => {
382
+ b({ type: "REGISTER_BATCH", commands: l });
383
+ }, []), a = k(() => {
384
+ b({ type: "OPEN" }), p?.();
385
+ }, [p]), z = k(() => {
386
+ b({ type: "CLOSE" }), E?.();
387
+ }, [E]), T = k(() => {
388
+ r.isOpen ? z() : a();
389
+ }, [r.isOpen, z, a]), _ = ge(() => {
390
+ const l = Array.from(r.commands.values()).filter((m) => !m.hidden);
391
+ if (!r.query.trim()) {
392
+ const m = r.recentIds.map((R) => r.commands.get(R)).filter((R) => !!R && !R.hidden), O = l.filter((R) => !r.recentIds.includes(R.id));
393
+ return O.sort((R, Q) => R.label.localeCompare(Q.label)), [...m, ...O].map((R) => ({
394
+ command: R,
395
+ match: null,
396
+ isRecent: r.recentIds.includes(R.id)
397
+ }));
398
+ }
399
+ return l.map((m) => {
400
+ const O = ze(r.query, m.label), R = m.description ? ze(r.query, m.description) : null, Q = m.keywords?.map((M) => ze(r.query, M)).filter(Boolean)[0] ?? null, le = [O, R, Q].filter(Boolean).sort((M, q) => (q?.score ?? 0) - (M?.score ?? 0))[0];
401
+ return { command: m, match: le, isRecent: !1 };
402
+ }).filter((m) => m.match !== null).sort((m, O) => (O.match?.score ?? 0) - (m.match?.score ?? 0));
403
+ }, [r.commands, r.query, r.recentIds]).slice(0, s), P = k(
404
+ async (l) => {
405
+ const C = r.commands.get(l);
406
+ if (!(!C || C.disabled)) {
407
+ w(!0);
408
+ try {
409
+ await C.action(), b({ type: "ADD_RECENT", id: l, maxRecent: u });
410
+ } finally {
411
+ w(!1), g && z();
412
+ }
413
+ }
414
+ },
415
+ [r.commands, u, g, z]
416
+ );
417
+ W(() => {
418
+ const l = (C) => {
419
+ (C.metaKey || C.ctrlKey) && C.key === "k" && (C.preventDefault(), T()), C.key === "Escape" && r.isOpen && (C.preventDefault(), z());
420
+ };
421
+ return document.addEventListener("keydown", l), () => document.removeEventListener("keydown", l);
422
+ }, [T, r.isOpen, z]), W(() => {
423
+ r.isOpen && requestAnimationFrame(() => Y.current?.focus());
424
+ }, [r.isOpen]);
425
+ const i = k(
426
+ (l) => {
427
+ const C = _.length;
428
+ if (C) {
429
+ if (l.key === "ArrowDown")
430
+ l.preventDefault(), b({ type: "SET_SELECTED", index: (r.selectedIndex + 1) % C });
431
+ else if (l.key === "ArrowUp")
432
+ l.preventDefault(), b({ type: "SET_SELECTED", index: (r.selectedIndex - 1 + C) % C });
433
+ else if (l.key === "Enter") {
434
+ l.preventDefault();
435
+ const m = _[r.selectedIndex];
436
+ m && P(m.command.id);
437
+ }
438
+ }
439
+ },
440
+ [_, r.selectedIndex, P]
441
+ );
442
+ W(() => {
443
+ if (!f.current)
444
+ return;
445
+ f.current.children[r.selectedIndex]?.scrollIntoView({ block: "nearest" });
446
+ }, [r.selectedIndex]);
447
+ const x = ge(
448
+ () => ({
449
+ registerCommand: X,
450
+ unregisterCommand: n,
451
+ registerCommands: v,
452
+ open: a,
453
+ close: z,
454
+ toggle: T,
455
+ isOpen: r.isOpen,
456
+ executeCommand: P
457
+ }),
458
+ [
459
+ X,
460
+ n,
461
+ v,
462
+ a,
463
+ z,
464
+ T,
465
+ r.isOpen,
466
+ P
467
+ ]
468
+ ), S = ge(() => {
469
+ const l = /* @__PURE__ */ new Map();
470
+ for (const C of _) {
471
+ const m = C.command.category ?? "General";
472
+ l.has(m) || l.set(m, []), l.get(m).push(C);
473
+ }
474
+ return l;
475
+ }, [_]);
476
+ let I = 0;
477
+ return /* @__PURE__ */ y(De.Provider, { value: x, children: [
478
+ e,
479
+ r.isOpen && /* @__PURE__ */ c("div", { className: `nice-command-palette__overlay ${d ?? ""}`, onClick: z, children: /* @__PURE__ */ y(
480
+ "div",
481
+ {
482
+ className: "nice-command-palette",
483
+ role: "dialog",
484
+ "aria-label": "Command Palette",
485
+ "aria-modal": "true",
486
+ onClick: (l) => l.stopPropagation(),
487
+ children: [
488
+ /* @__PURE__ */ c("div", { className: "nice-command-palette__input-wrapper", children: /* @__PURE__ */ c(
489
+ "input",
490
+ {
491
+ ref: Y,
492
+ className: "nice-command-palette__input",
493
+ type: "text",
494
+ placeholder: o,
495
+ value: r.query,
496
+ onChange: (l) => b({ type: "SET_QUERY", query: l.target.value }),
497
+ onKeyDown: i,
498
+ "aria-label": "Search commands",
499
+ "aria-autocomplete": "list",
500
+ "aria-controls": "nice-command-palette-list",
501
+ "aria-activedescendant": _[r.selectedIndex] ? `nice-cmd-${_[r.selectedIndex].command.id}` : void 0
502
+ }
503
+ ) }),
504
+ /* @__PURE__ */ y(
505
+ "div",
506
+ {
507
+ ref: f,
508
+ id: "nice-command-palette-list",
509
+ className: "nice-command-palette__list",
510
+ role: "listbox",
511
+ children: [
512
+ _.length === 0 && /* @__PURE__ */ c("div", { className: "nice-command-palette__empty", children: h }),
513
+ Array.from(S.entries()).map(([l, C]) => /* @__PURE__ */ y("div", { className: "nice-command-palette__group", children: [
514
+ /* @__PURE__ */ c("div", { className: "nice-command-palette__category", children: l }),
515
+ C.map((m) => {
516
+ const O = I++, R = O === r.selectedIndex;
517
+ return /* @__PURE__ */ y(
518
+ "div",
519
+ {
520
+ id: `nice-cmd-${m.command.id}`,
521
+ className: `nice-command-palette__item ${R ? "nice-command-palette__item--selected" : ""} ${m.command.disabled ? "nice-command-palette__item--disabled" : ""}`,
522
+ role: "option",
523
+ "aria-selected": R,
524
+ "aria-disabled": m.command.disabled,
525
+ onClick: () => !m.command.disabled && P(m.command.id),
526
+ onMouseEnter: () => b({ type: "SET_SELECTED", index: O }),
527
+ children: [
528
+ m.command.icon && /* @__PURE__ */ c("span", { className: "nice-command-palette__icon", children: m.command.icon }),
529
+ /* @__PURE__ */ y("div", { className: "nice-command-palette__label-group", children: [
530
+ /* @__PURE__ */ c("span", { className: "nice-command-palette__label", children: m.match && r.query ? vt(m.command.label, m.match.indices) : m.command.label }),
531
+ m.command.description && /* @__PURE__ */ c("span", { className: "nice-command-palette__description", children: m.command.description })
532
+ ] }),
533
+ m.command.shortcut && /* @__PURE__ */ c("kbd", { className: "nice-command-palette__shortcut", children: m.command.shortcut }),
534
+ m.isRecent && /* @__PURE__ */ c("span", { className: "nice-command-palette__recent-badge", children: "Recent" })
535
+ ]
536
+ },
537
+ m.command.id
538
+ );
539
+ })
540
+ ] }, l))
541
+ ]
542
+ }
543
+ ),
544
+ L && /* @__PURE__ */ c("div", { className: "nice-command-palette__executing", children: "Executing..." })
545
+ ]
546
+ }
547
+ ) })
548
+ ] });
549
+ };
550
+ xt.displayName = "NiceCommandPaletteProvider";
551
+ function At(e) {
552
+ const { registerCommands: t, unregisterCommand: o } = bt();
553
+ W(() => (t(e), () => {
554
+ for (const s of e)
555
+ o(s.id);
556
+ }), []);
557
+ }
558
+ const Nt = Ie(
559
+ ({ blocked: e, message: t, children: o, className: s, style: u, id: d }, h) => {
560
+ const g = Ce(d);
561
+ return /* @__PURE__ */ y(
562
+ "div",
563
+ {
564
+ ref: h,
565
+ id: g,
566
+ className: `nice-block-ui ${s || ""}`,
567
+ style: { position: "relative", ...u },
568
+ children: [
569
+ o,
570
+ e && /* @__PURE__ */ c("div", { className: "nice-block-ui__overlay", "aria-busy": "true", role: "alert", children: t && /* @__PURE__ */ c("div", { className: "nice-block-ui__message", children: t }) })
571
+ ]
572
+ }
573
+ );
574
+ }
575
+ );
576
+ Nt.displayName = "NiceBlockUI";
577
+ const kt = Ie(
578
+ ({
579
+ windows: e,
580
+ children: t,
581
+ onChange: o,
582
+ onClose: s,
583
+ onFocus: u,
584
+ showTaskbar: d = !0,
585
+ size: h = "md",
586
+ className: g,
587
+ style: p,
588
+ id: E,
589
+ ...r
590
+ }, b) => {
591
+ const Y = Ce(E), { t: f } = ve(), [L, w] = D(null), X = K(null), n = e ?? [], v = Math.max(1, ...n.map((i) => i.zIndex ?? 1)), a = k(
592
+ (i, x) => {
593
+ const S = n.map((I) => I.key === i ? { ...I, ...x } : I);
594
+ o?.(S);
595
+ },
596
+ [n, o]
597
+ ), z = k(
598
+ (i) => {
599
+ a(i, { zIndex: v + 1 }), u?.(i);
600
+ },
601
+ [a, v, u]
602
+ ), T = k(
603
+ (i) => {
604
+ s?.(i), o?.(n.filter((x) => x.key !== i));
605
+ },
606
+ [n, o, s]
607
+ ), B = k(
608
+ (i) => {
609
+ const x = n.find((S) => S.key === i);
610
+ x && a(i, { minimized: !x.minimized, maximized: !1 });
611
+ },
612
+ [n, a]
613
+ ), _ = k(
614
+ (i) => {
615
+ const x = n.find((S) => S.key === i);
616
+ x && a(i, { maximized: !x.maximized, minimized: !1 });
617
+ },
618
+ [n, a]
619
+ );
620
+ W(() => {
621
+ if (!L)
622
+ return;
623
+ const i = (S) => {
624
+ const I = n.find((l) => l.key === L.key);
625
+ if (I)
626
+ if (L.mode === "move")
627
+ a(L.key, {
628
+ x: S.clientX - L.offsetX,
629
+ y: S.clientY - L.offsetY
630
+ });
631
+ else {
632
+ const C = X.current?.getBoundingClientRect(), m = C?.left ?? 0, O = C?.top ?? 0;
633
+ a(L.key, {
634
+ width: Math.max(200, S.clientX - m - I.x),
635
+ height: Math.max(100, S.clientY - O - I.y)
636
+ });
637
+ }
638
+ }, x = () => w(null);
639
+ return document.addEventListener("mousemove", i), document.addEventListener("mouseup", x), () => {
640
+ document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", x);
641
+ };
642
+ }, [L, n, a]);
643
+ const P = k(
644
+ (i, x, S) => {
645
+ x.preventDefault();
646
+ const I = n.find((l) => l.key === i);
647
+ I && (z(i), w({
648
+ key: i,
649
+ offsetX: S === "move" ? x.clientX - I.x : 0,
650
+ offsetY: S === "move" ? x.clientY - I.y : 0,
651
+ mode: S
652
+ }));
653
+ },
654
+ [n, z]
655
+ );
656
+ return /* @__PURE__ */ y(
657
+ "div",
658
+ {
659
+ ref: (i) => {
660
+ X.current = i, typeof b == "function" ? b(i) : b && (b.current = i);
661
+ },
662
+ id: Y,
663
+ className: `nice-wm nice-wm--${h} ${g ?? ""}`,
664
+ style: { ...p, position: "relative", overflow: "hidden" },
665
+ ...r,
666
+ children: [
667
+ n.map((i) => {
668
+ if (i.minimized)
669
+ return null;
670
+ const x = i.maximized, S = x ? {
671
+ position: "absolute",
672
+ top: 0,
673
+ left: 0,
674
+ width: "100%",
675
+ height: "100%",
676
+ zIndex: i.zIndex ?? 1
677
+ } : {
678
+ position: "absolute",
679
+ top: i.y,
680
+ left: i.x,
681
+ width: i.width,
682
+ height: i.height,
683
+ zIndex: i.zIndex ?? 1
684
+ };
685
+ return /* @__PURE__ */ y(
686
+ "div",
687
+ {
688
+ className: `nice-wm__window ${x ? "nice-wm__window--maximized" : ""}`,
689
+ style: S,
690
+ onMouseDown: () => z(i.key),
691
+ role: "dialog",
692
+ "aria-label": i.title,
693
+ children: [
694
+ /* @__PURE__ */ y(
695
+ "div",
696
+ {
697
+ className: "nice-wm__titlebar",
698
+ onMouseDown: (I) => !x && P(i.key, I, "move"),
699
+ children: [
700
+ i.icon && /* @__PURE__ */ c("span", { className: "nice-wm__icon", children: i.icon }),
701
+ /* @__PURE__ */ c("span", { className: "nice-wm__title", children: i.title }),
702
+ /* @__PURE__ */ y("div", { className: "nice-wm__controls", children: [
703
+ (i.minimizable ?? !0) && /* @__PURE__ */ c(
704
+ "button",
705
+ {
706
+ type: "button",
707
+ className: "nice-wm__ctrl-btn nice-wm__ctrl-btn--min",
708
+ onClick: () => B(i.key),
709
+ title: f("wm.minimize", "Minimize"),
710
+ children: "─"
711
+ }
712
+ ),
713
+ (i.maximizable ?? !0) && /* @__PURE__ */ c(
714
+ "button",
715
+ {
716
+ type: "button",
717
+ className: "nice-wm__ctrl-btn nice-wm__ctrl-btn--max",
718
+ onClick: () => _(i.key),
719
+ title: f("wm.maximize", "Maximize"),
720
+ children: x ? "❐" : "☐"
721
+ }
722
+ ),
723
+ (i.closable ?? !0) && /* @__PURE__ */ c(
724
+ "button",
725
+ {
726
+ type: "button",
727
+ className: "nice-wm__ctrl-btn nice-wm__ctrl-btn--close",
728
+ onClick: () => T(i.key),
729
+ title: f("wm.close", "Close"),
730
+ children: "✕"
731
+ }
732
+ )
733
+ ] })
734
+ ]
735
+ }
736
+ ),
737
+ /* @__PURE__ */ c("div", { className: "nice-wm__body", children: i.content }),
738
+ (i.resizable ?? !0) && !x && /* @__PURE__ */ c(
739
+ "div",
740
+ {
741
+ className: "nice-wm__resize-handle",
742
+ onMouseDown: (I) => P(i.key, I, "resize")
743
+ }
744
+ )
745
+ ]
746
+ },
747
+ i.key
748
+ );
749
+ }),
750
+ e === void 0 && t,
751
+ d && /* @__PURE__ */ c("div", { className: "nice-wm__taskbar", role: "toolbar", "aria-label": f("wm.taskbar", "Taskbar"), children: n.map((i) => /* @__PURE__ */ y(
752
+ "button",
753
+ {
754
+ type: "button",
755
+ className: `nice-wm__taskbar-btn ${i.minimized ? "nice-wm__taskbar-btn--minimized" : ""}`,
756
+ onClick: () => {
757
+ i.minimized && B(i.key), z(i.key);
758
+ },
759
+ children: [
760
+ i.icon && /* @__PURE__ */ c("span", { className: "nice-wm__taskbar-icon", children: i.icon }),
761
+ /* @__PURE__ */ c("span", { className: "nice-wm__taskbar-label", children: i.title })
762
+ ]
763
+ },
764
+ i.key
765
+ )) })
766
+ ]
767
+ }
768
+ );
769
+ }
770
+ );
771
+ kt.displayName = "NiceWindowManager";
772
+ function Et(e, t) {
773
+ const o = document.querySelector(e);
774
+ if (!o)
775
+ return null;
776
+ const s = o.getBoundingClientRect();
777
+ return {
778
+ top: s.top - t + window.scrollY,
779
+ left: s.left - t + window.scrollX,
780
+ width: s.width + t * 2,
781
+ height: s.height + t * 2
782
+ };
783
+ }
784
+ function zt(e, t, o, s) {
785
+ const d = { w: window.innerWidth, h: window.innerHeight + window.scrollY }, h = {
786
+ top: {
787
+ top: e.top - o - 12,
788
+ left: e.left + e.width / 2 - t / 2
789
+ },
790
+ bottom: {
791
+ top: e.top + e.height + 12,
792
+ left: e.left + e.width / 2 - t / 2
793
+ },
794
+ left: {
795
+ top: e.top + e.height / 2 - o / 2,
796
+ left: e.left - t - 12
797
+ },
798
+ right: {
799
+ top: e.top + e.height / 2 - o / 2,
800
+ left: e.left + e.width + 12
801
+ }
802
+ };
803
+ if (s && s !== "auto")
804
+ return { ...h[s], actualPlacement: s };
805
+ for (const g of ["bottom", "top", "right", "left"]) {
806
+ const p = h[g];
807
+ if (p.top >= 0 && p.left >= 0 && p.top + o <= d.h && p.left + t <= d.w)
808
+ return { ...p, actualPlacement: g };
809
+ }
810
+ return { ...h.bottom, actualPlacement: "bottom" };
811
+ }
812
+ const Ye = ({
813
+ steps: e,
814
+ active: t,
815
+ onFinish: o,
816
+ onSkip: s,
817
+ onStepChange: u,
818
+ closeOnEscape: d = !0,
819
+ closeOnOverlayClick: h = !1,
820
+ showProgress: g = !0,
821
+ showSkipButton: p = !0,
822
+ labels: E,
823
+ animationDuration: r = 300,
824
+ overlayOpacity: b = 0.6,
825
+ zIndex: Y = 1e4
826
+ }) => {
827
+ const [f, L] = D(0), [w, X] = D(null), [n, v] = D({ w: 340, h: 200 }), [a, z] = D(!0), T = K(null), B = K(-1), _ = e[f], P = f === e.length - 1, i = f === 0, x = E?.next ?? "Next", S = E?.back ?? "Back", I = E?.finish ?? "Finish", l = E?.skip ?? "Skip", C = E?.stepOf ?? "of";
828
+ W(() => {
829
+ if (T.current) {
830
+ const M = T.current.getBoundingClientRect();
831
+ v({ w: M.width, h: M.height });
832
+ }
833
+ }, [f, t]), W(() => {
834
+ if (!t || !_)
835
+ return;
836
+ const M = () => {
837
+ const q = Et(_.target, _.highlightPadding ?? 8);
838
+ X(q);
839
+ };
840
+ if (M(), _.scrollIntoView !== !1) {
841
+ document.querySelector(_.target)?.scrollIntoView({ behavior: "smooth", block: "center" });
842
+ const ae = setTimeout(M, 350);
843
+ return () => clearTimeout(ae);
844
+ }
845
+ }, [t, _, f]), W(() => {
846
+ !t || !_ || B.current !== f && (B.current >= 0 && B.current < e.length && e[B.current]?.onLeave?.(), _.onEnter?.(), B.current = f);
847
+ }, [t, _, f, e]), W(() => {
848
+ if (!t || !_?.advanceOn)
849
+ return;
850
+ const M = document.querySelector(_.target);
851
+ if (!M)
852
+ return;
853
+ const q = () => m();
854
+ return M.addEventListener(_.advanceOn.event, q), () => M.removeEventListener(_.advanceOn.event, q);
855
+ }, [t, _, f]), W(() => {
856
+ if (!t)
857
+ return;
858
+ const M = (q) => {
859
+ q.key === "Escape" && d ? s?.() : q.key === "ArrowRight" ? m() : q.key === "ArrowLeft" && O();
860
+ };
861
+ return document.addEventListener("keydown", M), () => document.removeEventListener("keydown", M);
862
+ }, [t, f, d]), W(() => {
863
+ z(!0);
864
+ const M = setTimeout(() => z(!1), r);
865
+ return () => clearTimeout(M);
866
+ }, [f, r]);
867
+ const m = k(() => {
868
+ if (P)
869
+ _?.onLeave?.(), o?.();
870
+ else {
871
+ const M = f + 1;
872
+ L(M), u?.(M);
873
+ }
874
+ }, [f, P, o, u, _]), O = k(() => {
875
+ if (!i) {
876
+ const M = f - 1;
877
+ L(M), u?.(M);
878
+ }
879
+ }, [f, i, u]), R = ge(() => w ? zt(w, n.w, n.h, _?.placement) : {
880
+ top: window.innerHeight / 2,
881
+ left: window.innerWidth / 2,
882
+ actualPlacement: "bottom"
883
+ }, [w, n, _?.placement]);
884
+ if (!t || !_)
885
+ return null;
886
+ const Q = Math.max(document.documentElement.scrollWidth, window.innerWidth), le = Math.max(document.documentElement.scrollHeight, window.innerHeight);
887
+ return /* @__PURE__ */ y(
888
+ "div",
889
+ {
890
+ className: "nice-tutorial",
891
+ style: { zIndex: Y },
892
+ "aria-modal": "true",
893
+ role: "dialog",
894
+ "aria-label": "Tutorial",
895
+ children: [
896
+ /* @__PURE__ */ y(
897
+ "svg",
898
+ {
899
+ className: "nice-tutorial__overlay",
900
+ style: {
901
+ position: "absolute",
902
+ top: 0,
903
+ left: 0,
904
+ width: Q,
905
+ height: le,
906
+ pointerEvents: "auto"
907
+ },
908
+ onClick: h ? s : void 0,
909
+ children: [
910
+ /* @__PURE__ */ c("defs", { children: /* @__PURE__ */ y("mask", { id: "nice-tutorial-mask", children: [
911
+ /* @__PURE__ */ c("rect", { x: "0", y: "0", width: "100%", height: "100%", fill: "white" }),
912
+ w && /* @__PURE__ */ c(
913
+ "rect",
914
+ {
915
+ x: w.left,
916
+ y: w.top,
917
+ width: w.width,
918
+ height: w.height,
919
+ rx: "8",
920
+ fill: "black",
921
+ className: a ? "nice-tutorial__spotlight--entering" : ""
922
+ }
923
+ )
924
+ ] }) }),
925
+ /* @__PURE__ */ c(
926
+ "rect",
927
+ {
928
+ x: "0",
929
+ y: "0",
930
+ width: "100%",
931
+ height: "100%",
932
+ fill: `rgba(0,0,0,${b})`,
933
+ mask: "url(#nice-tutorial-mask)"
934
+ }
935
+ )
936
+ ]
937
+ }
938
+ ),
939
+ w && /* @__PURE__ */ c(
940
+ "div",
941
+ {
942
+ className: `nice-tutorial__highlight ${a ? "nice-tutorial__highlight--entering" : ""}`,
943
+ style: {
944
+ position: "absolute",
945
+ top: w.top,
946
+ left: w.left,
947
+ width: w.width,
948
+ height: w.height,
949
+ transition: `all ${r}ms ease`
950
+ }
951
+ }
952
+ ),
953
+ _.disableInteraction && w && /* @__PURE__ */ c(
954
+ "div",
955
+ {
956
+ className: "nice-tutorial__blocker",
957
+ style: {
958
+ position: "absolute",
959
+ top: w.top,
960
+ left: w.left,
961
+ width: w.width,
962
+ height: w.height
963
+ }
964
+ }
965
+ ),
966
+ /* @__PURE__ */ y(
967
+ "div",
968
+ {
969
+ ref: T,
970
+ className: `nice-tutorial__tooltip nice-tutorial__tooltip--${R.actualPlacement} ${a ? "nice-tutorial__tooltip--entering" : ""}`,
971
+ style: {
972
+ position: "absolute",
973
+ top: R.top,
974
+ left: R.left,
975
+ transition: `all ${r}ms ease`,
976
+ maxWidth: 380,
977
+ zIndex: Y + 1
978
+ },
979
+ children: [
980
+ _.showArrow !== !1 && /* @__PURE__ */ c(
981
+ "div",
982
+ {
983
+ className: `nice-tutorial__arrow nice-tutorial__arrow--${R.actualPlacement}`
984
+ }
985
+ ),
986
+ /* @__PURE__ */ y("div", { className: "nice-tutorial__header", children: [
987
+ /* @__PURE__ */ c("h4", { className: "nice-tutorial__title", children: _.title }),
988
+ p && /* @__PURE__ */ c(
989
+ "button",
990
+ {
991
+ type: "button",
992
+ className: "nice-tutorial__close",
993
+ onClick: s,
994
+ "aria-label": l,
995
+ children: "✕"
996
+ }
997
+ )
998
+ ] }),
999
+ /* @__PURE__ */ c(
1000
+ "div",
1001
+ {
1002
+ className: "nice-tutorial__content",
1003
+ dangerouslySetInnerHTML: { __html: ft(_.content) }
1004
+ }
1005
+ ),
1006
+ /* @__PURE__ */ y("div", { className: "nice-tutorial__footer", children: [
1007
+ g && /* @__PURE__ */ y("div", { className: "nice-tutorial__progress", children: [
1008
+ e.map((M, q) => /* @__PURE__ */ c(
1009
+ "span",
1010
+ {
1011
+ className: `nice-tutorial__dot ${q === f ? "nice-tutorial__dot--active" : ""} ${q < f ? "nice-tutorial__dot--done" : ""}`
1012
+ },
1013
+ q
1014
+ )),
1015
+ /* @__PURE__ */ y("span", { className: "nice-tutorial__step-label", children: [
1016
+ f + 1,
1017
+ " ",
1018
+ C,
1019
+ " ",
1020
+ e.length
1021
+ ] })
1022
+ ] }),
1023
+ /* @__PURE__ */ y("div", { className: "nice-tutorial__actions", children: [
1024
+ p && !P && /* @__PURE__ */ c(
1025
+ "button",
1026
+ {
1027
+ type: "button",
1028
+ className: "nice-tutorial__btn nice-tutorial__btn--skip",
1029
+ onClick: s,
1030
+ children: l
1031
+ }
1032
+ ),
1033
+ !i && /* @__PURE__ */ c(
1034
+ "button",
1035
+ {
1036
+ type: "button",
1037
+ className: "nice-tutorial__btn nice-tutorial__btn--back",
1038
+ onClick: O,
1039
+ children: S
1040
+ }
1041
+ ),
1042
+ !_.waitForAction && /* @__PURE__ */ c(
1043
+ "button",
1044
+ {
1045
+ type: "button",
1046
+ className: "nice-tutorial__btn nice-tutorial__btn--next",
1047
+ onClick: m,
1048
+ children: P ? I : x
1049
+ }
1050
+ )
1051
+ ] })
1052
+ ] })
1053
+ ]
1054
+ }
1055
+ )
1056
+ ]
1057
+ }
1058
+ );
1059
+ };
1060
+ Ye.displayName = "NiceTutorial";
1061
+ const Xe = Pe({
1062
+ startTutorial: () => {
1063
+ },
1064
+ stopTutorial: () => {
1065
+ },
1066
+ isActive: !1,
1067
+ currentStep: 0,
1068
+ nextStep: () => {
1069
+ },
1070
+ prevStep: () => {
1071
+ },
1072
+ goToStep: () => {
1073
+ }
1074
+ });
1075
+ function Bt() {
1076
+ return $e(Xe);
1077
+ }
1078
+ const Ct = ({ children: e }) => {
1079
+ const [t, o] = D([]), [s, u] = D(!1), [d, h] = D(0), g = k((f) => {
1080
+ o(f), h(0), u(!0);
1081
+ }, []), p = k(() => {
1082
+ u(!1), h(0), o([]);
1083
+ }, []), E = k(() => {
1084
+ h((f) => Math.min(f + 1, t.length - 1));
1085
+ }, [t.length]), r = k(() => {
1086
+ h((f) => Math.max(f - 1, 0));
1087
+ }, []), b = k(
1088
+ (f) => {
1089
+ h(Math.max(0, Math.min(f, t.length - 1)));
1090
+ },
1091
+ [t.length]
1092
+ ), Y = {
1093
+ startTutorial: g,
1094
+ stopTutorial: p,
1095
+ isActive: s,
1096
+ currentStep: d,
1097
+ nextStep: E,
1098
+ prevStep: r,
1099
+ goToStep: b
1100
+ };
1101
+ return /* @__PURE__ */ y(Xe.Provider, { value: Y, children: [
1102
+ e,
1103
+ s && t.length > 0 && /* @__PURE__ */ c(
1104
+ Ye,
1105
+ {
1106
+ steps: t,
1107
+ active: s,
1108
+ onFinish: p,
1109
+ onSkip: p,
1110
+ onStepChange: h
1111
+ }
1112
+ )
1113
+ ] });
1114
+ };
1115
+ Ct.displayName = "NiceTutorialProvider";
1116
+ function It(e, t, o, s, u) {
1117
+ const d = e <= u, h = e + u >= o, g = t <= u, p = t + u >= s;
1118
+ return g && d ? "top-left" : g && h ? "top-right" : p && d ? "bottom-left" : p && h ? "bottom-right" : d ? "left" : h ? "right" : g ? "top" : p ? "bottom" : "none";
1119
+ }
1120
+ function Mt(e) {
1121
+ switch (e) {
1122
+ case "left":
1123
+ return { left: 0, top: 0, width: "50%", height: "100%" };
1124
+ case "right":
1125
+ return { left: "50%", top: 0, width: "50%", height: "100%" };
1126
+ case "top":
1127
+ return { left: 0, top: 0, width: "100%", height: "50%" };
1128
+ case "bottom":
1129
+ return { left: 0, top: "50%", width: "100%", height: "50%" };
1130
+ case "top-left":
1131
+ return { left: 0, top: 0, width: "50%", height: "50%" };
1132
+ case "top-right":
1133
+ return { left: "50%", top: 0, width: "50%", height: "50%" };
1134
+ case "bottom-left":
1135
+ return { left: 0, top: "50%", width: "50%", height: "50%" };
1136
+ case "bottom-right":
1137
+ return { left: "50%", top: "50%", width: "50%", height: "50%" };
1138
+ default:
1139
+ return null;
1140
+ }
1141
+ }
1142
+ const St = Ie(
1143
+ ({
1144
+ windowKey: e,
1145
+ title: t,
1146
+ icon: o,
1147
+ children: s,
1148
+ footer: u,
1149
+ x: d,
1150
+ y: h,
1151
+ defaultPosition: g,
1152
+ width: p = 480,
1153
+ height: E = 360,
1154
+ minWidth: r = 200,
1155
+ minHeight: b = 120,
1156
+ maxWidth: Y,
1157
+ maxHeight: f,
1158
+ zIndex: L = 1,
1159
+ closable: w = !0,
1160
+ minimizable: X = !0,
1161
+ maximizable: n = !0,
1162
+ fullscreenable: v = !1,
1163
+ pinnable: a = !1,
1164
+ resizable: z = !0,
1165
+ draggable: T = !0,
1166
+ snappable: B = !0,
1167
+ snapThreshold: _ = 20,
1168
+ minimized: P,
1169
+ maximized: i,
1170
+ fullscreen: x,
1171
+ pinned: S,
1172
+ focused: I,
1173
+ onClose: l,
1174
+ onMinimize: C,
1175
+ onMaximize: m,
1176
+ onFullscreen: O,
1177
+ onPin: R,
1178
+ onFocus: Q,
1179
+ onMove: le,
1180
+ onResize: M,
1181
+ onSnap: q,
1182
+ onTitleBarDoubleClick: ae,
1183
+ size: Oe = "md",
1184
+ statusBar: Me,
1185
+ titleBarActions: qe,
1186
+ className: Ae,
1187
+ style: Be,
1188
+ id: Se,
1189
+ accessMode: We,
1190
+ ...Fe
1191
+ }, He) => {
1192
+ const Ue = Ce(Se), Ke = wt(We, Se), { t: de } = ve(), ye = K(null);
1193
+ ye.current == null && (ye.current = `nice-window-${Math.random().toString(36).slice(2, 10)}`);
1194
+ const A = e ?? ye.current, Ge = d ?? g?.x ?? 100, Ve = h ?? g?.y ?? 100;
1195
+ if (Ke === "hidden")
1196
+ return null;
1197
+ const [fe, se] = D({ x: Ge, y: Ve }), [we, _e] = D({ width: p, height: E }), [je, Qe] = D(!1), [Ze, Je] = D(!1), [et, tt] = D(!1), [nt, it] = D(!1), [V, be] = D("none"), ot = P ?? je, G = i ?? Ze, H = x ?? et, ue = S ?? nt, xe = I ?? !0, oe = fe.x, ce = fe.y, Z = we.width, J = we.height, ee = K(
1198
+ null
1199
+ ), U = K(null), $ = K(null), ct = k(() => {
1200
+ l?.(A);
1201
+ }, [A, l]), st = k(() => {
1202
+ Qe(!0), C?.(A);
1203
+ }, [A, C]), Ne = k(() => {
1204
+ const N = !G;
1205
+ Je(N), !N && $.current ? (se({ x: $.current.x, y: $.current.y }), _e({ width: $.current.w, height: $.current.h }), $.current = null) : N && ($.current = { x: oe, y: ce, w: Z, h: J }), be("none"), m?.(A, N);
1206
+ }, [A, G, oe, ce, Z, J, m]), ke = k(() => {
1207
+ const N = !H;
1208
+ tt(N), N ? $.current = { x: oe, y: ce, w: Z, h: J } : $.current && (se({ x: $.current.x, y: $.current.y }), _e({ width: $.current.w, height: $.current.h }), $.current = null), O?.(A, N);
1209
+ }, [A, H, oe, ce, Z, J, O]), rt = k(() => {
1210
+ const N = !ue;
1211
+ it(N), R?.(A, N);
1212
+ }, [A, ue, R]), me = k(() => {
1213
+ Q?.(A);
1214
+ }, [A, Q]), lt = k(() => {
1215
+ ae ? ae(A) : n && Ne();
1216
+ }, [A, n, Ne, ae]);
1217
+ W(() => {
1218
+ const N = (te) => {
1219
+ if (!ee.current)
1220
+ return;
1221
+ const j = te.clientX - ee.current.startX + ee.current.origX, he = te.clientY - ee.current.startY + ee.current.origY;
1222
+ se({ x: j, y: he }), le?.(A, { x: j, y: he });
1223
+ }, F = (te) => {
1224
+ if (ee.current) {
1225
+ if (B) {
1226
+ const j = It(
1227
+ te.clientX,
1228
+ te.clientY,
1229
+ window.innerWidth,
1230
+ window.innerHeight,
1231
+ _
1232
+ );
1233
+ j !== "none" && ($.current = { x: fe.x, y: fe.y, w: Z, h: J }, be(j), q?.(A, j));
1234
+ }
1235
+ ee.current = null;
1236
+ }
1237
+ };
1238
+ return document.addEventListener("mousemove", N), document.addEventListener("mouseup", F), () => {
1239
+ document.removeEventListener("mousemove", N), document.removeEventListener("mouseup", F);
1240
+ };
1241
+ });
1242
+ const at = k(
1243
+ (N) => {
1244
+ !T || G || H || (N.preventDefault(), V !== "none" && ($.current && (se({ x: $.current.x, y: $.current.y }), _e({ width: $.current.w, height: $.current.h })), be("none")), me(), ee.current = { startX: N.clientX, startY: N.clientY, origX: oe, origY: ce });
1245
+ },
1246
+ [T, G, H, V, oe, ce, me]
1247
+ );
1248
+ W(() => {
1249
+ const N = (te) => {
1250
+ if (!U.current)
1251
+ return;
1252
+ const j = te.clientX - U.current.startX, he = te.clientY - U.current.startY, re = U.current.handle;
1253
+ let ne = U.current.origW, ie = U.current.origH;
1254
+ if (re.includes("e") && (ne = U.current.origW + j), re.includes("w") && (ne = U.current.origW - j), re.includes("s") && (ie = U.current.origH + he), re.includes("n") && (ie = U.current.origH - he), ne = Math.max(r, Y ? Math.min(Y, ne) : ne), ie = Math.max(b, f ? Math.min(f, ie) : ie), re.includes("w")) {
1255
+ const Ee = we.width - ne;
1256
+ se((pe) => ({ ...pe, x: pe.x + Ee }));
1257
+ }
1258
+ if (re.includes("n")) {
1259
+ const Ee = we.height - ie;
1260
+ se((pe) => ({ ...pe, y: pe.y + Ee }));
1261
+ }
1262
+ _e({ width: ne, height: ie }), M?.(A, { width: ne, height: ie });
1263
+ }, F = () => {
1264
+ U.current = null;
1265
+ };
1266
+ return document.addEventListener("mousemove", N), document.addEventListener("mouseup", F), () => {
1267
+ document.removeEventListener("mousemove", N), document.removeEventListener("mouseup", F);
1268
+ };
1269
+ });
1270
+ const dt = k(
1271
+ (N, F) => {
1272
+ !z || G || H || V !== "none" || (F.preventDefault(), F.stopPropagation(), me(), U.current = { startX: F.clientX, startY: F.clientY, origW: Z, origH: J, handle: N });
1273
+ },
1274
+ [z, G, H, V, Z, J, me]
1275
+ );
1276
+ if (W(() => {
1277
+ if (!xe)
1278
+ return;
1279
+ const N = (F) => {
1280
+ F.key === "Escape" && H && ke();
1281
+ };
1282
+ return document.addEventListener("keydown", N), () => document.removeEventListener("keydown", N);
1283
+ }, [xe, H, ke]), ot)
1284
+ return null;
1285
+ const Re = V !== "none" ? Mt(V) : null, Le = G || H, ut = H ? { position: "fixed", top: 0, left: 0, width: "100vw", height: "100vh", zIndex: 999999 } : G ? { position: "absolute", top: 0, left: 0, width: "100%", height: "100%", zIndex: L } : Re ? { position: "absolute", ...Re, zIndex: L } : { position: "absolute", top: ce, left: oe, width: Z, height: J, zIndex: L }, mt = ["n", "e", "s", "w", "ne", "se", "sw", "nw"], ht = {
1286
+ n: "ns-resize",
1287
+ s: "ns-resize",
1288
+ e: "ew-resize",
1289
+ w: "ew-resize",
1290
+ ne: "nesw-resize",
1291
+ sw: "nesw-resize",
1292
+ nw: "nwse-resize",
1293
+ se: "nwse-resize"
1294
+ };
1295
+ return /* @__PURE__ */ y(
1296
+ "div",
1297
+ {
1298
+ ref: He,
1299
+ id: Ue,
1300
+ className: `nice-window nice-window--${Oe} ${xe ? "nice-window--focused" : ""} ${ue ? "nice-window--pinned" : ""} ${Le ? "nice-window--maximized" : ""} ${V !== "none" ? `nice-window--snapped-${V}` : ""} ${Ae ?? ""}`,
1301
+ style: { ...ut, ...Be },
1302
+ onMouseDown: me,
1303
+ role: "dialog",
1304
+ "aria-label": t,
1305
+ ...Fe,
1306
+ children: [
1307
+ /* @__PURE__ */ y(
1308
+ "div",
1309
+ {
1310
+ className: "nice-window__titlebar",
1311
+ onMouseDown: at,
1312
+ onDoubleClick: lt,
1313
+ children: [
1314
+ o && /* @__PURE__ */ c("span", { className: "nice-window__icon", children: o }),
1315
+ /* @__PURE__ */ c("span", { className: "nice-window__title", children: t }),
1316
+ /* @__PURE__ */ y("div", { className: "nice-window__actions", children: [
1317
+ qe,
1318
+ a && /* @__PURE__ */ c(
1319
+ "button",
1320
+ {
1321
+ type: "button",
1322
+ className: `nice-window__action nice-window__action--pin ${ue ? "nice-window__action--active" : ""}`,
1323
+ onClick: rt,
1324
+ title: de("window.pin", ue ? "Unpin" : "Pin"),
1325
+ children: "📌"
1326
+ }
1327
+ ),
1328
+ X && /* @__PURE__ */ c(
1329
+ "button",
1330
+ {
1331
+ type: "button",
1332
+ className: "nice-window__action nice-window__action--minimize",
1333
+ onClick: st,
1334
+ title: de("window.minimize", "Minimize"),
1335
+ children: "─"
1336
+ }
1337
+ ),
1338
+ n && /* @__PURE__ */ c(
1339
+ "button",
1340
+ {
1341
+ type: "button",
1342
+ className: "nice-window__action nice-window__action--maximize",
1343
+ onClick: Ne,
1344
+ title: de("window.maximize", G ? "Restore" : "Maximize"),
1345
+ children: G ? "❐" : "☐"
1346
+ }
1347
+ ),
1348
+ v && /* @__PURE__ */ c(
1349
+ "button",
1350
+ {
1351
+ type: "button",
1352
+ className: "nice-window__action nice-window__action--fullscreen",
1353
+ onClick: ke,
1354
+ title: de("window.fullscreen", H ? "Exit Full Screen" : "Full Screen"),
1355
+ children: H ? "⇲" : "⇱"
1356
+ }
1357
+ ),
1358
+ w && /* @__PURE__ */ c(
1359
+ "button",
1360
+ {
1361
+ type: "button",
1362
+ className: "nice-window__action nice-window__action--close",
1363
+ onClick: ct,
1364
+ title: de("window.close", "Close"),
1365
+ children: "✕"
1366
+ }
1367
+ )
1368
+ ] })
1369
+ ]
1370
+ }
1371
+ ),
1372
+ /* @__PURE__ */ c("div", { className: "nice-window__body", children: s }),
1373
+ u && /* @__PURE__ */ c("div", { className: "nice-window__footer", children: u }),
1374
+ Me && /* @__PURE__ */ c("div", { className: "nice-window__statusbar", children: Me }),
1375
+ z && !Le && V === "none" && /* @__PURE__ */ c(Te, { children: mt.map((N) => /* @__PURE__ */ c(
1376
+ "div",
1377
+ {
1378
+ className: `nice-window__resize nice-window__resize--${N}`,
1379
+ style: { cursor: ht[N] },
1380
+ onMouseDown: (F) => dt(N, F)
1381
+ },
1382
+ N
1383
+ )) })
1384
+ ]
1385
+ }
1386
+ );
1387
+ }
1388
+ );
1389
+ St.displayName = "NiceWindow";
1390
+ export {
1391
+ $t as N,
1392
+ Nt as a,
1393
+ Yt as b,
1394
+ xt as c,
1395
+ Dt as d,
1396
+ Pt as e,
1397
+ Ot as f,
1398
+ Xt as g,
1399
+ qt as h,
1400
+ Ye as i,
1401
+ Ct as j,
1402
+ St as k,
1403
+ kt as l,
1404
+ At as m,
1405
+ ze as n,
1406
+ vt as o,
1407
+ Bt as p,
1408
+ bt as u
1409
+ };