@linkdesk/ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,1629 @@
1
+ import "./index.css";
2
+ import { jsx as d, jsxs as F, Fragment as xe } from "react/jsx-runtime";
3
+ import { useRef as H, useEffect as R, useState as P, useCallback as B, useLayoutEffect as re, useMemo as z, forwardRef as se, useImperativeHandle as Me, useContext as Ne, createContext as Ee, createElement as oe } from "react";
4
+ import Ae, { createPortal as ce } from "react-dom";
5
+ import { useTranslation as j } from "react-i18next";
6
+ function Ce({ children: t, onClick: n, disabled: e, title: o, type: r = "button" }) {
7
+ return /* @__PURE__ */ d("button", { type: r, className: "button", onClick: n, disabled: e, title: o, children: t });
8
+ }
9
+ var q = {}, ae;
10
+ function Ie() {
11
+ if (ae) return q;
12
+ ae = 1;
13
+ var t = Ae;
14
+ if (process.env.NODE_ENV === "production")
15
+ q.createRoot = t.createRoot, q.hydrateRoot = t.hydrateRoot;
16
+ else {
17
+ var n = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
18
+ q.createRoot = function(e, o) {
19
+ n.usingClientEntryPoint = !0;
20
+ try {
21
+ return t.createRoot(e, o);
22
+ } finally {
23
+ n.usingClientEntryPoint = !1;
24
+ }
25
+ }, q.hydrateRoot = function(e, o, r) {
26
+ n.usingClientEntryPoint = !0;
27
+ try {
28
+ return t.hydrateRoot(e, o, r);
29
+ } finally {
30
+ n.usingClientEntryPoint = !1;
31
+ }
32
+ };
33
+ }
34
+ return q;
35
+ }
36
+ Ie();
37
+ const Le = "overlay-root", _e = "ld-scrim-plane";
38
+ function we() {
39
+ return document.getElementById(_e) ?? document.body;
40
+ }
41
+ const le = 'a[href],button:not([disabled]),input:not([disabled]),textarea:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';
42
+ function ie({ children: t, onClose: n, triggerRef: e, trapFocus: o, zIndex: r, rootId: c, open: s = !0 }) {
43
+ const h = H(null);
44
+ R(() => {
45
+ if (!s || !n) return;
46
+ const l = (i) => {
47
+ var a, x;
48
+ const k = i.target, v = (a = h.current) == null ? void 0 : a.contains(k), m = ((x = e == null ? void 0 : e.current) == null ? void 0 : x.contains(k)) ?? !1;
49
+ !v && !m && n();
50
+ };
51
+ return window.addEventListener("mousedown", l, !0), () => window.removeEventListener("mousedown", l, !0);
52
+ }, [s, n, e]), R(() => {
53
+ if (!s || !n) return;
54
+ const l = (i) => {
55
+ i.key === "Escape" && n();
56
+ };
57
+ return window.addEventListener("keydown", l), () => window.removeEventListener("keydown", l);
58
+ }, [s, n]), R(() => {
59
+ if (!s || !o) return;
60
+ const l = h.current;
61
+ if (!l) return;
62
+ const i = l.querySelector(le);
63
+ i ? i.focus() : (l.tabIndex = -1, l.focus());
64
+ const k = (v) => {
65
+ if (v.key !== "Tab") return;
66
+ const m = Array.from(l.querySelectorAll(le));
67
+ if (m.length === 0) {
68
+ v.preventDefault();
69
+ return;
70
+ }
71
+ const a = m[0], x = m[m.length - 1];
72
+ v.shiftKey && document.activeElement === a ? (v.preventDefault(), x.focus()) : !v.shiftKey && document.activeElement === x && (v.preventDefault(), a.focus());
73
+ };
74
+ return window.addEventListener("keydown", k), () => window.removeEventListener("keydown", k);
75
+ }, [s, o]);
76
+ const u = {
77
+ position: "relative",
78
+ ...r ? { zIndex: r } : {}
79
+ };
80
+ return ce(
81
+ // E5.8#109:data-overlay-wrapper 结构标记——浮层权威的「隔离地板」(index.css)用它排除本包装盒。
82
+ // 包装盒是结构容器(ref/zIndex 载体)不是表面:若地板规则的深度 2 选择器给它的 backdrop-filter,
83
+ // 它就成了 backdrop root,把内部真实表面的 backdrop 采样掐断(E5.8#103 地板因此从未对
84
+ // 右键/toast/命令面板生效——#109 实证:关掉包装盒 blur 后表面 blur 立即渲染,60% 像素变化)。
85
+ // 🔥 E5.8#111 更深陷阱:backdrop-filter 同时给包装盒建 stacking context——面板 z600 被困其中、
86
+ // 对外只算包装盒 z-auto(0),被 scrim 遮罩 z500 盖住 → 点在预期位置实中遮罩 onClose =「点一下自己退」。
87
+ // 故包装盒必须保持零 stacking-context 属性(backdrop-filter/filter/transform/z-index 均禁;
88
+ // zIndex 例外见 prop 契约——需 z-index 时必须 > scrim 遮罩 500)。
89
+ /* @__PURE__ */ d("div", { ref: h, "data-overlay-wrapper": !0, style: Object.keys(u).length > 1 ? u : {}, children: t }),
90
+ // E5.8#107 单一门:默认 → #overlay-root(浮层权威 surface 根);显式 rootId 优先;根缺失回退 body
91
+ (c ? document.getElementById(c) : document.getElementById(Le)) ?? document.body
92
+ );
93
+ }
94
+ const ue = 232, de = 224, fe = 263, $e = 8;
95
+ function J(t, n, e, o, r = $e) {
96
+ const c = Math.max(r, o.width - n - r), s = Math.max(r, o.height - e - r), h = Math.min(Math.max(
97
+ t.x + n + r <= o.width ? t.x : t.x - n - r,
98
+ r
99
+ ), c), u = Math.min(Math.max(
100
+ t.y + e + r <= o.height ? t.y : t.y - e - r,
101
+ r
102
+ ), s);
103
+ return { left: h, top: u };
104
+ }
105
+ function De(t) {
106
+ const n = t.replace("#", "");
107
+ return [
108
+ parseInt(n.substring(0, 2), 16),
109
+ parseInt(n.substring(2, 4), 16),
110
+ parseInt(n.substring(4, 6), 16)
111
+ ];
112
+ }
113
+ function Se(t, n, e) {
114
+ return "#" + [t, n, e].map((o) => Math.max(0, Math.min(255, Math.round(o))).toString(16).padStart(2, "0")).join("");
115
+ }
116
+ function Re(t, n, e) {
117
+ const o = e * n, r = o * (1 - Math.abs(t / 60 % 2 - 1)), c = e - o;
118
+ let s = 0, h = 0, u = 0;
119
+ return t < 60 ? (s = o, h = r) : t < 120 ? (s = r, h = o) : t < 180 ? (h = o, u = r) : t < 240 ? (h = r, u = o) : t < 300 ? (s = r, u = o) : (s = o, u = r), [Math.round((s + c) * 255), Math.round((h + c) * 255), Math.round((u + c) * 255)];
120
+ }
121
+ function Te(t, n, e) {
122
+ const o = Math.max(t, n, e) / 255, r = Math.min(t, n, e) / 255, c = o - r;
123
+ let s = 0;
124
+ c > 0 && (o === t / 255 ? s = 60 * ((n / 255 - e / 255) / c % 6) : o === n / 255 ? s = 60 * ((e / 255 - t / 255) / c + 2) : s = 60 * ((t / 255 - n / 255) / c + 4)), s < 0 && (s += 360);
125
+ const h = o === 0 ? 0 : c / o;
126
+ return { h: s, s: h, v: o };
127
+ }
128
+ function X(t) {
129
+ const [n, e, o] = De(t);
130
+ return Te(n, e, o);
131
+ }
132
+ function Q(t, n, e) {
133
+ const [o, r, c] = Re(t, n, e);
134
+ return Se(o, r, c);
135
+ }
136
+ function Pe(t) {
137
+ let n = t.replace(/[^0-9a-fA-F]/g, "").slice(0, 6);
138
+ return n.length > 0 && (n = "#" + n), n;
139
+ }
140
+ function At({ open: t, value: n, onChange: e, onClose: o, presets: r, anchor: c }) {
141
+ const [s, h] = P(() => X(n)), [u, l] = P(n), i = H(null), k = H(null), v = H(null), m = H(null), a = H(s), [x, D] = P(null);
142
+ R(() => {
143
+ if (t) {
144
+ const p = X(n);
145
+ a.current = p, h(p), l(n);
146
+ }
147
+ }, [n, t]);
148
+ const $ = B((p) => {
149
+ const C = Pe(p);
150
+ if (l(C), /^#[0-9a-fA-F]{6}$/.test(C)) {
151
+ const K = X(C);
152
+ return a.current = K, h(K), C;
153
+ }
154
+ return null;
155
+ }, []), A = B((p) => {
156
+ var E;
157
+ const C = (E = i.current) == null ? void 0 : E.getBoundingClientRect();
158
+ if (!C) return;
159
+ const K = Math.max(0, Math.min(1, (p.clientX - C.left) / C.width)), V = Math.max(0, Math.min(1, (p.clientY - C.top) / C.height)), w = { ...a.current, s: K, v: 1 - V };
160
+ a.current = w, h(w), l(Q(w.h, w.s, w.v));
161
+ }, []), _ = B((p) => {
162
+ var w;
163
+ const C = (w = k.current) == null ? void 0 : w.getBoundingClientRect();
164
+ if (!C) return;
165
+ const K = Math.max(0, Math.min(1, (p.clientX - C.left) / C.width)), y = { ...a.current, h: K * 360 };
166
+ a.current = y, h(y), l(Q(y.h, y.s, y.v));
167
+ }, []);
168
+ if (R(() => {
169
+ if (!t) return;
170
+ const p = () => {
171
+ m.current = null;
172
+ }, C = (K) => {
173
+ m.current === "sv" ? A(K) : m.current === "hue" && _(K);
174
+ };
175
+ return window.addEventListener("mouseup", p), window.addEventListener("mousemove", C), () => {
176
+ window.removeEventListener("mouseup", p), window.removeEventListener("mousemove", C);
177
+ };
178
+ }, [t, A, _]), re(() => {
179
+ if (!t || !c) {
180
+ D(null);
181
+ return;
182
+ }
183
+ const p = v.current, C = { width: window.innerWidth, height: window.innerHeight }, K = p ? J(c, p.offsetWidth, p.offsetHeight, C) : J(c, ue, r != null && r.length ? fe : de, C);
184
+ D((V) => V && V.left === K.left && V.top === K.top ? V : K);
185
+ }, [t, c, r]), !t) return null;
186
+ const I = Q(s.h, 1, 1), S = `${Math.round(s.s * 100)}%`, M = `${Math.round((1 - s.v) * 100)}%`, g = `${Math.round(s.h / 360 * 100)}%`, b = c && !x ? J(
187
+ c,
188
+ ue,
189
+ r != null && r.length ? fe : de,
190
+ { width: window.innerWidth, height: window.innerHeight }
191
+ ) : null, f = x ?? b;
192
+ return /* @__PURE__ */ F(ie, { onClose: o, children: [
193
+ ce(/* @__PURE__ */ d("div", { className: "colorpicker-overlay", onClick: () => o() }), we()),
194
+ /* @__PURE__ */ F(
195
+ "div",
196
+ {
197
+ ref: v,
198
+ className: "colorpicker-panel",
199
+ style: c && f ? { left: f.left, top: f.top } : void 0,
200
+ onClick: (p) => p.stopPropagation(),
201
+ children: [
202
+ /* @__PURE__ */ F(
203
+ "div",
204
+ {
205
+ ref: i,
206
+ className: "colorpicker-sv",
207
+ style: { background: I },
208
+ onMouseDown: (p) => {
209
+ m.current = "sv", A(p);
210
+ },
211
+ children: [
212
+ /* @__PURE__ */ d("div", { className: "colorpicker-sv-white" }),
213
+ /* @__PURE__ */ d("div", { className: "colorpicker-sv-black" }),
214
+ /* @__PURE__ */ d("div", { className: "colorpicker-sv-cursor", style: { left: S, top: M } })
215
+ ]
216
+ }
217
+ ),
218
+ /* @__PURE__ */ d(
219
+ "div",
220
+ {
221
+ ref: k,
222
+ className: "colorpicker-hue",
223
+ onMouseDown: (p) => {
224
+ m.current = "hue", _(p);
225
+ },
226
+ children: /* @__PURE__ */ d("div", { className: "colorpicker-hue-cursor", style: { left: g } })
227
+ }
228
+ ),
229
+ /* @__PURE__ */ F("div", { className: "colorpicker-footer", children: [
230
+ /* @__PURE__ */ d("div", { className: "colorpicker-preview", style: { background: u } }),
231
+ /* @__PURE__ */ d(
232
+ "input",
233
+ {
234
+ className: "colorpicker-hex",
235
+ type: "text",
236
+ value: u,
237
+ onChange: (p) => {
238
+ const C = $(p.target.value);
239
+ C && e(C);
240
+ },
241
+ onKeyDown: (p) => {
242
+ if (p.key === "Enter") {
243
+ const C = $(u);
244
+ C && e(C);
245
+ }
246
+ },
247
+ spellCheck: !1
248
+ }
249
+ ),
250
+ /* @__PURE__ */ d("button", { className: "colorpicker-ok", onClick: () => {
251
+ e(u), o();
252
+ }, children: "OK" })
253
+ ] }),
254
+ r && r.length > 0 && /* @__PURE__ */ d("div", { className: "colorpicker-presets", children: r.map((p) => /* @__PURE__ */ d(
255
+ "div",
256
+ {
257
+ className: "colorpicker-preset",
258
+ style: { background: p },
259
+ title: p,
260
+ onClick: () => {
261
+ const C = X(p);
262
+ a.current = C, h(C), l(p), e(p);
263
+ }
264
+ },
265
+ p
266
+ )) })
267
+ ]
268
+ }
269
+ )
270
+ ] });
271
+ }
272
+ const Fe = { left: 0, top: 0, width: 100, maxWidth: 300 };
273
+ function ve({ containerRef: t, onClose: n, onKeyDown: e, listRef: o, search: r, children: c }) {
274
+ const [s, h] = P(Fe), u = B(() => {
275
+ var k;
276
+ const l = (k = t.current) == null ? void 0 : k.getBoundingClientRect();
277
+ if (!l) return;
278
+ const i = {
279
+ left: Math.round(l.left),
280
+ top: Math.round(l.bottom) + 2,
281
+ width: Math.round(l.width),
282
+ maxWidth: Math.round(window.innerWidth - l.left - 24)
283
+ };
284
+ h(
285
+ (v) => v.left === i.left && v.top === i.top && v.width === i.width && v.maxWidth === i.maxWidth ? v : i
286
+ );
287
+ }, [t]);
288
+ return re(() => (u(), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), () => {
289
+ window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0);
290
+ }), [u]), R(() => {
291
+ t.current || u();
292
+ }, [t, u]), /* @__PURE__ */ d(ie, { onClose: n, triggerRef: t, children: /* @__PURE__ */ F(
293
+ "div",
294
+ {
295
+ className: "selectbox-dropdown",
296
+ onKeyDown: e,
297
+ style: {
298
+ position: "fixed",
299
+ left: s.left,
300
+ top: s.top,
301
+ minWidth: s.width,
302
+ // 动态 maxWidth——面板不超过窗口右边缘 - 24px 呼吸,不硬编码固定值
303
+ maxWidth: s.maxWidth
304
+ },
305
+ children: [
306
+ r,
307
+ /* @__PURE__ */ d("ul", { ref: o, className: "selectbox-list", tabIndex: -1, children: c })
308
+ ]
309
+ }
310
+ ) });
311
+ }
312
+ function Ct({ value: t, options: n, onChange: e, disabled: o, placeholder: r, title: c, className: s, onOpen: h, inputMode: u = "text" }) {
313
+ const { t: l } = j(), [i, k] = P(!1), [v, m] = P(t), [a, x] = P(-1), D = H(null), $ = H(null), A = H(!1);
314
+ R(() => {
315
+ A.current || m(t);
316
+ }, [t]);
317
+ const _ = v !== t, I = z(() => {
318
+ if (!_) return n;
319
+ const g = v.trim().toLowerCase();
320
+ return g ? n.filter((b) => b.toLowerCase().includes(g)) : n;
321
+ }, [n, v, _]);
322
+ R(() => {
323
+ a >= I.length && x(Math.max(0, I.length - 1));
324
+ }, [I.length, a]), R(() => {
325
+ if (!i) return;
326
+ h == null || h();
327
+ const g = I.findIndex((b) => b === t);
328
+ x(g >= 0 ? g : 0);
329
+ }, [i]), R(() => {
330
+ if (!i || !$.current) return;
331
+ const g = $.current.children[a];
332
+ g == null || g.scrollIntoView({ block: "nearest" });
333
+ }, [a, i]);
334
+ const S = B(
335
+ (g) => {
336
+ const b = g.trim();
337
+ k(!1), b && (m(b), b !== t && e(b));
338
+ },
339
+ [t, e]
340
+ ), M = B(
341
+ (g) => {
342
+ switch (g.key) {
343
+ case "ArrowDown":
344
+ g.preventDefault(), k(!0), x((b) => Math.min(b + 1, I.length - 1));
345
+ break;
346
+ case "ArrowUp":
347
+ g.preventDefault(), k(!0), x((b) => Math.max(b - 1, 0));
348
+ break;
349
+ case "Enter":
350
+ g.preventDefault(), i && I[a] ? S(I[a]) : S(v);
351
+ break;
352
+ case "Escape":
353
+ g.preventDefault(), m(t), k(!1);
354
+ break;
355
+ }
356
+ },
357
+ [i, I, a, S, v, t]
358
+ );
359
+ return /* @__PURE__ */ F(
360
+ "div",
361
+ {
362
+ className: `combobox ${i ? "selectbox-open" : ""} ${o ? "selectbox-disabled" : ""} ${s ?? ""}`,
363
+ ref: D,
364
+ children: [
365
+ /* @__PURE__ */ F("div", { className: "combobox-field", children: [
366
+ /* @__PURE__ */ d(
367
+ "input",
368
+ {
369
+ type: "text",
370
+ inputMode: u,
371
+ className: "combobox-input",
372
+ value: v,
373
+ title: c,
374
+ "aria-label": c,
375
+ placeholder: r,
376
+ disabled: o,
377
+ onFocus: () => {
378
+ A.current = !0, k(!0);
379
+ },
380
+ onBlur: () => {
381
+ A.current = !1, S(v);
382
+ },
383
+ onChange: (g) => {
384
+ m(g.target.value), k(!0), x(-1);
385
+ },
386
+ onKeyDown: M
387
+ }
388
+ ),
389
+ /* @__PURE__ */ d("span", { className: `codicon codicon-chevron-down selectbox-arrow ${i ? "selectbox-arrow-up" : ""}` })
390
+ ] }),
391
+ i && /* @__PURE__ */ d(
392
+ ve,
393
+ {
394
+ containerRef: D,
395
+ onClose: () => k(!1),
396
+ listRef: $,
397
+ children: I.length === 0 ? /* @__PURE__ */ d("li", { className: "selectbox-empty", children: l("无匹配项") }) : I.map((g, b) => /* @__PURE__ */ d(
398
+ "li",
399
+ {
400
+ className: `selectbox-item ${b === a ? "selectbox-item-focus" : ""} ${g === t ? "selectbox-item-selected" : ""}`,
401
+ onMouseDown: (f) => {
402
+ f.preventDefault(), S(g);
403
+ },
404
+ onMouseEnter: () => x(b),
405
+ children: g
406
+ },
407
+ g
408
+ ))
409
+ }
410
+ )
411
+ ]
412
+ }
413
+ );
414
+ }
415
+ const Y = 3e3;
416
+ function ee() {
417
+ return window.linkdesk;
418
+ }
419
+ function ye(t, n) {
420
+ return t.map((e) => {
421
+ if (typeof e == "string") return { id: e, label: e, group: n };
422
+ const o = e.children && e.children.length > 0 ? ye(e.children, n) : void 0;
423
+ return {
424
+ id: e.command,
425
+ label: e.label ?? e.command,
426
+ group: n,
427
+ checked: e.checked,
428
+ commandArgs: e.commandArgs,
429
+ ...o ? { children: o } : {}
430
+ };
431
+ });
432
+ }
433
+ function It({ menuId: t, anchor: n, context: e, onClose: o, resolveChildren: r, items: c, variant: s }) {
434
+ const h = H(null), u = H(/* @__PURE__ */ new Map()), l = H(null), [i, k] = P([]), v = z(() => JSON.stringify(e ?? {}), [e]);
435
+ R(() => {
436
+ var w, E;
437
+ let y = !1;
438
+ return c ? (k(c), () => {
439
+ y = !0;
440
+ }) : ((E = (w = ee().menu) == null ? void 0 : w.getItems) == null || E.call(w, t, e).then((N) => {
441
+ !y && N && k(N);
442
+ }).catch(() => {
443
+ }), () => {
444
+ y = !0;
445
+ });
446
+ }, [t, v, c]);
447
+ const m = z(() => {
448
+ const y = /* @__PURE__ */ new Map(), w = [];
449
+ for (const N of i) {
450
+ const T = N.children;
451
+ if (!N.command && !T) continue;
452
+ const L = N.group ?? "__default";
453
+ y.has(L) || (y.set(L, []), w.push(L));
454
+ let W;
455
+ if (T && T.length > 0)
456
+ W = ye(T, L);
457
+ else if (T && T.length === 0 && r) {
458
+ const U = r(N.command, e ?? {});
459
+ U && U.length > 0 && (W = U.map((Z) => ({ id: Z.id, label: Z.label, group: L })));
460
+ }
461
+ y.get(L).push({
462
+ id: N.command || N.label || "",
463
+ // E5.8#37.7.1:label 优先于命令 title——菜单项显式 label 是槽位显示文本(如 when 门控的
464
+ // 「移动到右侧/左侧」、面板视图清单的视图名);命令 title 只是无 label 时的兜底
465
+ // (修复 #37.6 侧栏换边菜单项被命令 title「切换侧栏位置」遮蔽的潜在 bug)。
466
+ label: N.label ?? N.title ?? N.command,
467
+ group: L,
468
+ shortcut: N.shortcut,
469
+ checked: N.checked,
470
+ commandArgs: N.commandArgs,
471
+ children: W
472
+ });
473
+ }
474
+ const E = [];
475
+ for (let N = 0; N < w.length; N++)
476
+ N > 0 && E.push({ type: "divider", group: w[N] }), E.push(...y.get(w[N]));
477
+ return E;
478
+ }, [i, e, r]), [a, x] = P([]), D = B(() => {
479
+ l.current && (clearTimeout(l.current), l.current = null);
480
+ }, []), $ = B((y) => {
481
+ l.current && (clearTimeout(l.current), l.current = null), l.current = setTimeout(() => x((w) => w.slice(0, y)), 150);
482
+ }, []), A = B((y, w, E) => {
483
+ D();
484
+ const N = y.getBoundingClientRect(), T = 160, L = N.right + T > window.innerWidth ? N.left - T - 4 : N.right + 4;
485
+ x((W) => [...W.slice(0, E), { x: L, y: N.top, items: w }]);
486
+ }, [D]), [_, I] = P({ left: n.x, top: n.y }), [S, M] = P(!1), g = S;
487
+ R(() => {
488
+ if (!g) return;
489
+ const y = (T) => {
490
+ T.key === "Escape" && (a.length > 0 ? x((L) => L.slice(0, L.length - 1)) : o());
491
+ }, w = () => o(), E = () => o(), N = (T) => {
492
+ var U;
493
+ const L = T.target;
494
+ (((U = h.current) == null ? void 0 : U.contains(L)) ?? !1) || [...u.current.values()].some((Z) => Z.contains(L)) || o();
495
+ };
496
+ return window.addEventListener("keydown", y), window.addEventListener("blur", w), window.addEventListener("wheel", E, !0), s !== "embedded" && window.addEventListener("mousedown", N, !0), () => {
497
+ window.removeEventListener("keydown", y), window.removeEventListener("blur", w), window.removeEventListener("wheel", E, !0), s !== "embedded" && window.removeEventListener("mousedown", N, !0);
498
+ };
499
+ }, [o, a, g, s]);
500
+ const [b, f] = P(-1), p = H(/* @__PURE__ */ new Map()), C = z(() => m.filter((y) => !("type" in y)), [m]);
501
+ R(() => {
502
+ if (!g) return;
503
+ const y = (w) => {
504
+ var E, N, T;
505
+ if (w.key === "ArrowDown")
506
+ w.preventDefault(), f((L) => Math.min(L + 1, C.length - 1));
507
+ else if (w.key === "ArrowUp")
508
+ w.preventDefault(), f((L) => Math.max(L - 1, 0));
509
+ else if (w.key === "ArrowRight" && b >= 0) {
510
+ const L = C[b];
511
+ if ((E = L == null ? void 0 : L.children) != null && E.length) {
512
+ w.preventDefault();
513
+ const W = p.current.get(b);
514
+ W && A(W, L.children, 0);
515
+ }
516
+ } else if (w.key === "ArrowLeft")
517
+ a.length > 0 && (w.preventDefault(), x((L) => L.slice(0, L.length - 1)));
518
+ else if (w.key === "Enter" && b >= 0) {
519
+ w.preventDefault();
520
+ const L = C[b];
521
+ L && ((T = (N = ee().commands) == null ? void 0 : N.executeCommand) == null || T.call(N, L.id, void 0, ...L.commandArgs ?? [], e), o());
522
+ }
523
+ };
524
+ return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
525
+ }, [C, b, e, o, g, a, A]), R(() => {
526
+ var y;
527
+ b >= 0 && ((y = p.current.get(b)) == null || y.scrollIntoView({ block: "nearest" }));
528
+ }, [b]);
529
+ const K = B(async (y) => {
530
+ var w, E;
531
+ o(), await ((E = (w = ee().commands) == null ? void 0 : w.executeCommand) == null ? void 0 : E.call(w, y.id, void 0, ...y.commandArgs ?? [], e));
532
+ }, [e, o]);
533
+ re(() => {
534
+ I({ left: n.x, top: Math.max(30, n.y) }), M(!1);
535
+ }, [n.x, n.y, m.length]), R(() => {
536
+ const y = h.current;
537
+ if (!y) return;
538
+ const w = y.getBoundingClientRect();
539
+ let E = n.x, N = Math.max(30, n.y);
540
+ E + w.width > window.innerWidth && (E = Math.max(0, window.innerWidth - w.width - 4)), N + w.height > window.innerHeight && (N = Math.max(30, window.innerHeight - w.height - 4)), I({ left: E, top: N });
541
+ const T = requestAnimationFrame(() => {
542
+ M(!0), y.classList.add("show");
543
+ });
544
+ return () => cancelAnimationFrame(T);
545
+ }, [n.x, n.y, m.length]), R(() => {
546
+ var y;
547
+ S && ((y = h.current) == null || y.focus());
548
+ }, [S]);
549
+ let V = 0;
550
+ return /* @__PURE__ */ F(ie, { rootId: "context-menu-root", zIndex: String(Y), children: [
551
+ s !== "embedded" && s !== "non-modal" && ce(
552
+ /* @__PURE__ */ d(
553
+ "div",
554
+ {
555
+ style: {
556
+ position: "fixed",
557
+ inset: 0,
558
+ zIndex: Y - 1
559
+ }
560
+ }
561
+ ),
562
+ we()
563
+ ),
564
+ /* @__PURE__ */ d(
565
+ "div",
566
+ {
567
+ ref: h,
568
+ className: "ctx-menu",
569
+ tabIndex: -1,
570
+ style: {
571
+ left: _.left,
572
+ top: _.top,
573
+ zIndex: Y,
574
+ visibility: S ? void 0 : "hidden"
575
+ },
576
+ children: m.map((y, w) => {
577
+ if ("type" in y) return /* @__PURE__ */ d("div", { className: "ctx-divider" }, `div-${w}`);
578
+ const E = V++, N = !!(y.children && y.children.length > 0), T = E === b, L = y.group === "delete";
579
+ return (
580
+ // E5.8#37.7.1:复合 key——共享命令 id 的动态项(面板视图清单全用同一 toggle 命令)会撞 key;
581
+ // 并入数组索引消歧(菜单项在菜单生命周期内静态,索引稳定)。
582
+ /* @__PURE__ */ F(
583
+ "div",
584
+ {
585
+ ref: (W) => {
586
+ W ? p.current.set(E, W) : p.current.delete(E);
587
+ },
588
+ className: `ctx-item${T ? " focused" : ""}${L ? " ctx-item-danger" : ""}`,
589
+ onClick: (W) => {
590
+ W.stopPropagation(), N || K(y);
591
+ },
592
+ onMouseEnter: (W) => {
593
+ f(E), N ? A(W.currentTarget, y.children, 0) : x((U) => U.slice(0, 0));
594
+ },
595
+ onMouseLeave: () => {
596
+ N && $(1);
597
+ },
598
+ children: [
599
+ /* @__PURE__ */ d("span", { className: "ctx-item-check", "aria-hidden": "true", children: y.checked ? "✓" : "" }),
600
+ /* @__PURE__ */ d("span", { className: "ctx-item-label", children: y.label }),
601
+ N && /* @__PURE__ */ d("span", { className: "ctx-item-chevron", children: "›" }),
602
+ y.shortcut && /* @__PURE__ */ d("span", { className: "ctx-item-shortcut", children: y.shortcut })
603
+ ]
604
+ },
605
+ `${y.id}::${w}`
606
+ )
607
+ );
608
+ })
609
+ }
610
+ ),
611
+ a.map((y, w) => /* @__PURE__ */ d(
612
+ "div",
613
+ {
614
+ ref: (E) => {
615
+ E ? u.current.set(w, E) : u.current.delete(w);
616
+ },
617
+ className: "ctx-menu show",
618
+ style: { left: y.x, top: y.y, zIndex: Y },
619
+ onMouseEnter: D,
620
+ onMouseLeave: () => $(w + 1),
621
+ children: y.items.map((E, N) => {
622
+ const T = !!(E.children && E.children.length > 0);
623
+ return /* @__PURE__ */ F(
624
+ "div",
625
+ {
626
+ className: "ctx-item",
627
+ onClick: (L) => {
628
+ L.stopPropagation(), T || K(E);
629
+ },
630
+ onMouseEnter: (L) => {
631
+ T ? A(L.currentTarget, E.children, w + 1) : x((W) => W.slice(0, w + 1));
632
+ },
633
+ onMouseLeave: () => {
634
+ T && $(w + 2);
635
+ },
636
+ children: [
637
+ /* @__PURE__ */ d("span", { className: "ctx-item-check", "aria-hidden": "true", children: E.checked ? "✓" : "" }),
638
+ /* @__PURE__ */ d("span", { className: "ctx-item-label", children: E.label }),
639
+ T && /* @__PURE__ */ d("span", { className: "ctx-item-chevron", children: "›" }),
640
+ E.shortcut && /* @__PURE__ */ d("span", { className: "ctx-item-shortcut", children: E.shortcut })
641
+ ]
642
+ },
643
+ `${E.id}::${N}`
644
+ );
645
+ })
646
+ },
647
+ w
648
+ ))
649
+ ] });
650
+ }
651
+ function He(t) {
652
+ return typeof t == "object" && "value" in t && "label" in t;
653
+ }
654
+ function ge({ value: t, options: n, onChange: e, disabled: o, placeholder: r, title: c, className: s, onOpen: h }) {
655
+ const { t: u } = j(), [l, i] = P(!1), [k, v] = P(""), [m, a] = P(-1), x = H(null), D = H(null), $ = H(null), A = z(
656
+ () => n.map((f) => He(f) ? f : { value: f, label: f }),
657
+ [n]
658
+ ), _ = z(() => {
659
+ if (!k) return A;
660
+ const f = k.toLowerCase();
661
+ return A.filter((p) => p.label.toLowerCase().includes(f));
662
+ }, [A, k]), I = z(() => A.find((f) => f.value === t), [A, t]), S = z(() => I ? I.label : t !== "" ? t : r ?? t, [I, t, r]);
663
+ R(() => {
664
+ m >= _.length && a(Math.max(0, _.length - 1));
665
+ }, [_.length, m]), R(() => {
666
+ var p, C;
667
+ if (!l) {
668
+ v(""), a(-1);
669
+ return;
670
+ }
671
+ h == null || h();
672
+ const f = _.findIndex((K) => K.value === t);
673
+ a(f >= 0 ? f : 0), A.length > 8 ? (p = D.current) == null || p.focus() : (C = $.current) == null || C.focus();
674
+ }, [l]);
675
+ const M = B(
676
+ (f) => {
677
+ e(f), i(!1);
678
+ },
679
+ [e]
680
+ ), g = B(
681
+ (f) => {
682
+ switch (f.key) {
683
+ case "ArrowDown":
684
+ f.preventDefault(), a((p) => Math.min(p + 1, _.length - 1));
685
+ break;
686
+ case "ArrowUp":
687
+ f.preventDefault(), a((p) => Math.max(p - 1, 0));
688
+ break;
689
+ case "Enter":
690
+ f.preventDefault(), _[m] && M(_[m].value);
691
+ break;
692
+ }
693
+ },
694
+ [_, m, M]
695
+ );
696
+ R(() => {
697
+ if (!l || !$.current) return;
698
+ const f = $.current.children[m];
699
+ f == null || f.scrollIntoView({ block: "nearest" });
700
+ }, [m, l]);
701
+ const b = A.length > 8;
702
+ return /* @__PURE__ */ F(
703
+ "div",
704
+ {
705
+ className: `selectbox ${l ? "selectbox-open" : ""} ${o ? "selectbox-disabled" : ""} ${s ?? ""}`,
706
+ ref: x,
707
+ children: [
708
+ /* @__PURE__ */ F(
709
+ "button",
710
+ {
711
+ type: "button",
712
+ className: "selectbox-trigger",
713
+ disabled: o,
714
+ title: c,
715
+ onClick: () => i((f) => !f),
716
+ children: [
717
+ /* @__PURE__ */ F("span", { className: "selectbox-label", children: [
718
+ (I == null ? void 0 : I.preview) && /* @__PURE__ */ d("span", { className: "selectbox-swatch", style: { background: I.preview } }),
719
+ S
720
+ ] }),
721
+ /* @__PURE__ */ d("span", { className: `codicon codicon-chevron-down selectbox-arrow ${l ? "selectbox-arrow-up" : ""}` })
722
+ ]
723
+ }
724
+ ),
725
+ l && /* @__PURE__ */ d(
726
+ ve,
727
+ {
728
+ containerRef: x,
729
+ onClose: () => i(!1),
730
+ onKeyDown: g,
731
+ listRef: $,
732
+ search: b ? /* @__PURE__ */ d("div", { className: "selectbox-search", children: /* @__PURE__ */ d(
733
+ "input",
734
+ {
735
+ ref: D,
736
+ type: "text",
737
+ className: "selectbox-search-input",
738
+ placeholder: u("筛选..."),
739
+ value: k,
740
+ onChange: (f) => {
741
+ v(f.target.value), a(0);
742
+ }
743
+ }
744
+ ) }) : void 0,
745
+ children: _.length === 0 ? /* @__PURE__ */ d("li", { className: "selectbox-empty", children: u("无匹配项") }) : _.map((f, p) => /* @__PURE__ */ F(
746
+ "li",
747
+ {
748
+ className: `selectbox-item ${p === m ? "selectbox-item-focus" : ""} ${f.value === t ? "selectbox-item-selected" : ""}`,
749
+ onClick: () => M(f.value),
750
+ onMouseEnter: () => a(p),
751
+ children: [
752
+ f.preview && /* @__PURE__ */ d("span", { className: "selectbox-swatch", style: { background: f.preview } }),
753
+ f.label
754
+ ]
755
+ },
756
+ f.value
757
+ ))
758
+ }
759
+ )
760
+ ]
761
+ }
762
+ );
763
+ }
764
+ const he = "followTheme", te = [];
765
+ function Lt({ value: t, onChange: n, optionsFrom: e, domain: o, disabled: r, placeholder: c, title: s }) {
766
+ const { t: h } = j(), [u, l] = P(te), i = e === "theme.colorways" && o === "colors", [k, v] = P(void 0);
767
+ R(() => {
768
+ var $, A, _, I, S;
769
+ if (!i) return;
770
+ let x = !1;
771
+ (A = ($ = window.linkdesk) == null ? void 0 : $.configuration) == null || A.get("app.appearanceMode").then((M) => {
772
+ x || v(M);
773
+ });
774
+ const D = (S = (I = (_ = window.linkdesk) == null ? void 0 : _.configuration) == null ? void 0 : I.onChange) == null ? void 0 : S.call(I, "app.appearanceMode", (M) => v(M));
775
+ return () => {
776
+ x = !0, D == null || D();
777
+ };
778
+ }, [i]);
779
+ const m = i && k === "custom", a = B(async () => {
780
+ var D, $, A, _;
781
+ const x = ($ = (D = window.linkdesk) == null ? void 0 : D.theme) == null ? void 0 : $.listRecipes;
782
+ if (x)
783
+ try {
784
+ const I = await x() ?? [];
785
+ if (e === "theme.sources" || m) {
786
+ if (o === "colors") {
787
+ l([
788
+ { value: he, label: h("跟随主题") },
789
+ ...I.flatMap(
790
+ (f) => f.colorways.map((p) => {
791
+ var C;
792
+ return {
793
+ value: p.id,
794
+ label: `${f.name}·${p.name}`,
795
+ preview: ((C = p.preview) == null ? void 0 : C.accent) || void 0
796
+ };
797
+ })
798
+ )
799
+ ]);
800
+ return;
801
+ }
802
+ const b = o ? I.filter((f) => f.domains.includes(o)) : I;
803
+ l([
804
+ { value: he, label: h("跟随主题") },
805
+ ...b.map((f) => ({ value: f.id, label: f.name }))
806
+ ]);
807
+ return;
808
+ }
809
+ const S = (_ = (A = window.linkdesk) == null ? void 0 : A.configuration) == null ? void 0 : _.get, M = S ? await S("app.theme") : "", g = I.find((b) => b.id === M);
810
+ l(
811
+ g ? g.colorways.map((b) => {
812
+ var f;
813
+ return { value: b.id, label: b.name, preview: ((f = b.preview) == null ? void 0 : f.accent) || void 0 };
814
+ }) : te
815
+ );
816
+ } catch {
817
+ l(te);
818
+ }
819
+ }, [e, o, h, m]);
820
+ return R(() => {
821
+ var $, A, _, I, S, M;
822
+ a();
823
+ const x = (_ = (A = ($ = window.linkdesk) == null ? void 0 : $.configuration) == null ? void 0 : A.onPluginLifecycleChange) == null ? void 0 : _.call(A, () => {
824
+ a();
825
+ }), D = e === "theme.colorways" ? (M = (S = (I = window.linkdesk) == null ? void 0 : I.configuration) == null ? void 0 : S.onChange) == null ? void 0 : M.call(S, "app.theme", () => {
826
+ a();
827
+ }) : void 0;
828
+ return () => {
829
+ x == null || x(), D == null || D();
830
+ };
831
+ }, [a, e]), i && !m && u.length === 1 ? null : /* @__PURE__ */ d(
832
+ ge,
833
+ {
834
+ value: t,
835
+ options: u,
836
+ onChange: n,
837
+ disabled: r,
838
+ placeholder: c,
839
+ title: s,
840
+ onOpen: () => {
841
+ a();
842
+ }
843
+ }
844
+ );
845
+ }
846
+ function _t({ value: t, onChange: n, dialogType: e }) {
847
+ const { t: o } = j(), r = async () => {
848
+ var h;
849
+ const c = (h = window.linkdesk) == null ? void 0 : h.dialog;
850
+ if (!c) return;
851
+ const s = e === "directory" ? { directory: !0 } : {
852
+ filters: [{ name: o("所有文件"), extensions: ["*"] }]
853
+ };
854
+ try {
855
+ const u = await c.open(s);
856
+ u && n(u);
857
+ } catch {
858
+ }
859
+ };
860
+ return /* @__PURE__ */ F("div", { style: { display: "flex", gap: 4, alignItems: "center" }, children: [
861
+ /* @__PURE__ */ d(
862
+ "input",
863
+ {
864
+ className: "input",
865
+ type: "text",
866
+ value: t,
867
+ onChange: (c) => n(c.target.value),
868
+ style: { flex: 1 },
869
+ placeholder: o(e === "directory" ? "选择目录…" : "选择文件…")
870
+ }
871
+ ),
872
+ /* @__PURE__ */ d(
873
+ Ce,
874
+ {
875
+ onClick: r,
876
+ title: o(e === "directory" ? "浏览目录…" : "浏览文件…"),
877
+ children: "…"
878
+ }
879
+ )
880
+ ] });
881
+ }
882
+ const be = [
883
+ "Cascadia Code",
884
+ "Cascadia Mono",
885
+ "Consolas",
886
+ "Courier",
887
+ "Courier New",
888
+ "DejaVu Sans Mono",
889
+ "Droid Sans Mono",
890
+ "Fira Code",
891
+ "Fira Mono",
892
+ "Hack",
893
+ "Inconsolata",
894
+ "JetBrains Mono",
895
+ "Liberation Mono",
896
+ "Lucida Console",
897
+ "Menlo",
898
+ "Monaco",
899
+ "Noto Sans Mono",
900
+ "Source Code Pro",
901
+ "Ubuntu Mono"
902
+ ], Ke = [
903
+ ...be,
904
+ "Arial",
905
+ "Arial Narrow",
906
+ "Calibri",
907
+ "Cambria",
908
+ "Candara",
909
+ "Constantia",
910
+ "Franklin Gothic Medium",
911
+ "Georgia",
912
+ "Gill Sans",
913
+ "Impact",
914
+ "Microsoft YaHei",
915
+ "Palatino Linotype",
916
+ "Segoe UI",
917
+ "SimHei",
918
+ "SimSun",
919
+ "Tahoma",
920
+ "Times New Roman",
921
+ "Trebuchet MS",
922
+ "Verdana"
923
+ ];
924
+ function We(t) {
925
+ try {
926
+ const e = document.createElement("canvas").getContext("2d");
927
+ if (!e) return !1;
928
+ e.font = `16px "${t}"`;
929
+ const o = e.measureText("i").width, r = e.measureText("W").width;
930
+ return Math.abs(o - r) < 0.5;
931
+ } catch {
932
+ return !1;
933
+ }
934
+ }
935
+ function Be(t) {
936
+ const [n, e] = P([]);
937
+ return R(() => {
938
+ let o = !1;
939
+ async function r() {
940
+ var h;
941
+ let c = [];
942
+ if ("queryLocalFonts" in window)
943
+ try {
944
+ const u = await ((h = window.queryLocalFonts) == null ? void 0 : h.call(window));
945
+ o || (c = (u ?? []).map((l) => l.family).filter((l, i, k) => k.indexOf(l) === i));
946
+ } catch {
947
+ }
948
+ c.length === 0 && (c = t ? be : Ke);
949
+ const s = t ? c.filter((u) => We(u)) : c;
950
+ o || e(s.sort((u, l) => u.localeCompare(l)));
951
+ }
952
+ return r(), () => {
953
+ o = !0;
954
+ };
955
+ }, [t]), n;
956
+ }
957
+ function $t({ value: t, onChange: n, monoOnly: e = !0 }) {
958
+ const { t: o } = j(), r = Be(e), c = z(() => e ? r.map((s) => ({ value: s, label: s })) : [
959
+ { value: "", label: o("跟随主题") },
960
+ { value: "__none__", label: o("系统字体") },
961
+ ...r.map((s) => ({ value: s, label: s }))
962
+ ], [e, r, o]);
963
+ return /* @__PURE__ */ d(
964
+ ge,
965
+ {
966
+ value: t,
967
+ options: c,
968
+ onChange: n,
969
+ placeholder: o(e ? "选择等宽字体…" : "跟随主题")
970
+ }
971
+ );
972
+ }
973
+ function Dt({ label: t, children: n }) {
974
+ return /* @__PURE__ */ F("div", { className: "form-row", children: [
975
+ /* @__PURE__ */ d("label", { children: t }),
976
+ n
977
+ ] });
978
+ }
979
+ function St({ value: t, onChange: n, min: e, max: o, step: r = 1, unit: c, style: s }) {
980
+ const { t: h } = j(), u = B(
981
+ (m) => {
982
+ let a = m;
983
+ return e !== void 0 && (a = Math.max(e, a)), o !== void 0 && (a = Math.min(o, a)), a;
984
+ },
985
+ [e, o]
986
+ ), l = () => n(u(t - r)), i = () => n(u(t + r)), k = e !== void 0 && t <= e, v = o !== void 0 && t >= o;
987
+ return /* @__PURE__ */ F("div", { className: "number-input", style: s, children: [
988
+ /* @__PURE__ */ d(
989
+ "button",
990
+ {
991
+ className: "number-input-btn",
992
+ onClick: l,
993
+ disabled: k,
994
+ tabIndex: -1,
995
+ "aria-label": h("减少"),
996
+ children: "−"
997
+ }
998
+ ),
999
+ /* @__PURE__ */ d(
1000
+ "input",
1001
+ {
1002
+ className: "input number-input-field",
1003
+ type: "text",
1004
+ value: t,
1005
+ onChange: (m) => {
1006
+ const a = Number(m.target.value);
1007
+ isNaN(a) || n(u(a));
1008
+ },
1009
+ style: { width: 56, textAlign: "center" }
1010
+ }
1011
+ ),
1012
+ c ? /* @__PURE__ */ d("span", { className: "number-input-unit", children: c }) : null,
1013
+ /* @__PURE__ */ d(
1014
+ "button",
1015
+ {
1016
+ className: "number-input-btn",
1017
+ onClick: i,
1018
+ disabled: v,
1019
+ tabIndex: -1,
1020
+ "aria-label": h("增加"),
1021
+ children: "+"
1022
+ }
1023
+ )
1024
+ ] });
1025
+ }
1026
+ function Rt({ options: t, value: n, onChange: e, ariaLabel: o }) {
1027
+ const r = H([]), c = (s, h) => {
1028
+ var i;
1029
+ if (!["ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown"].includes(s.key)) return;
1030
+ s.preventDefault();
1031
+ const u = s.key === "ArrowRight" || s.key === "ArrowDown" ? 1 : -1, l = (h + u + t.length) % t.length;
1032
+ (i = r.current[l]) == null || i.focus(), e(t[l].value);
1033
+ };
1034
+ return /* @__PURE__ */ d("div", { className: "segmented-radio", role: "radiogroup", "aria-label": o, children: t.map((s, h) => {
1035
+ const u = n === s.value;
1036
+ return /* @__PURE__ */ F(
1037
+ "button",
1038
+ {
1039
+ type: "button",
1040
+ ref: (l) => {
1041
+ r.current[h] = l;
1042
+ },
1043
+ role: "radio",
1044
+ "aria-checked": u,
1045
+ tabIndex: u ? 0 : -1,
1046
+ className: `segmented-radio__option${u ? " is-selected" : ""}`,
1047
+ title: s.title ?? s.label,
1048
+ onClick: () => e(s.value),
1049
+ onKeyDown: (l) => c(l, h),
1050
+ children: [
1051
+ s.preview,
1052
+ /* @__PURE__ */ d("span", { className: "segmented-radio__label", children: s.label })
1053
+ ]
1054
+ },
1055
+ s.value
1056
+ );
1057
+ }) });
1058
+ }
1059
+ function Tt({ value: t, onChange: n, min: e = 0, max: o = 100, step: r = 1, ariaLabel: c, disabled: s, style: h }) {
1060
+ const u = (i) => Math.min(o, Math.max(e, i)), l = o > e ? (u(t) - e) / (o - e) * 100 : 0;
1061
+ return /* @__PURE__ */ d(
1062
+ "input",
1063
+ {
1064
+ type: "range",
1065
+ className: "slider",
1066
+ value: u(t),
1067
+ min: e,
1068
+ max: o,
1069
+ step: r,
1070
+ disabled: s,
1071
+ "aria-label": c,
1072
+ onChange: (i) => n(Number(i.target.value)),
1073
+ style: { ...h, "--slider-pct": `${l}%` }
1074
+ }
1075
+ );
1076
+ }
1077
+ const Oe = 6, Ve = "color-mix(in srgb, var(--text-secondary) 45%, transparent)";
1078
+ function Pt({ value: t, onChange: n }) {
1079
+ const { t: e } = j(), [o, r] = P([]), [c, s] = P(0), h = H([]), u = B((i) => {
1080
+ var v, m;
1081
+ const k = (m = (v = window.linkdesk) == null ? void 0 : v.theme) == null ? void 0 : m.listRecipes;
1082
+ k && k().then((a) => {
1083
+ i && !i() || r(a ?? []);
1084
+ }).catch(() => {
1085
+ });
1086
+ }, []);
1087
+ R(() => {
1088
+ var m, a, x;
1089
+ let i = !1;
1090
+ u(() => !i);
1091
+ const v = (x = (a = (m = window.linkdesk) == null ? void 0 : m.configuration) == null ? void 0 : a.onPluginLifecycleChange) == null ? void 0 : x.call(a, () => {
1092
+ u();
1093
+ });
1094
+ return () => {
1095
+ i = !0, v == null || v();
1096
+ };
1097
+ }, [u]);
1098
+ const l = (i) => {
1099
+ var m;
1100
+ const k = o.length;
1101
+ if (k === 0) return;
1102
+ let v = c;
1103
+ switch (i.key) {
1104
+ case "ArrowRight":
1105
+ case "ArrowDown":
1106
+ v = Math.min(c + 1, k - 1);
1107
+ break;
1108
+ case "ArrowLeft":
1109
+ case "ArrowUp":
1110
+ v = Math.max(c - 1, 0);
1111
+ break;
1112
+ case "Home":
1113
+ v = 0;
1114
+ break;
1115
+ case "End":
1116
+ v = k - 1;
1117
+ break;
1118
+ default:
1119
+ return;
1120
+ }
1121
+ i.preventDefault(), s(v), (m = h.current[v]) == null || m.focus();
1122
+ };
1123
+ return o.length === 0 ? /* @__PURE__ */ d("span", { className: "theme-picker-empty", children: e("无可用主题配方") }) : /* @__PURE__ */ d(
1124
+ "div",
1125
+ {
1126
+ className: "theme-picker",
1127
+ role: "group",
1128
+ "aria-label": e("主题配方"),
1129
+ onKeyDown: l,
1130
+ children: o.map((i, k) => {
1131
+ var D, $;
1132
+ const v = i.colorways.length <= 1, m = (D = i.colorways[0]) == null ? void 0 : D.preview, a = (m == null ? void 0 : m.accent) || Ve, x = i.id === t;
1133
+ return /* @__PURE__ */ F(
1134
+ "button",
1135
+ {
1136
+ ref: (A) => {
1137
+ h.current[k] = A;
1138
+ },
1139
+ type: "button",
1140
+ className: `theme-card${x ? " active" : ""}`,
1141
+ tabIndex: c === k ? 0 : -1,
1142
+ "aria-label": i.name,
1143
+ "aria-pressed": x,
1144
+ onClick: () => n(i.id),
1145
+ onFocus: () => s(k),
1146
+ children: [
1147
+ /* @__PURE__ */ d("div", { className: "theme-preview", style: m != null && m.bgWindow ? { background: m.bgWindow } : void 0, children: v ? (
1148
+ // 单配色配方——3 条强调色预览条(mockup .pv-bar)
1149
+ /* @__PURE__ */ F(xe, { children: [
1150
+ /* @__PURE__ */ d("span", { className: "pv-bar", style: { background: a } }),
1151
+ /* @__PURE__ */ d("span", { className: "pv-bar", style: { background: a } }),
1152
+ /* @__PURE__ */ d("span", { className: "pv-bar", style: { background: a } })
1153
+ ] })
1154
+ ) : (
1155
+ // 多配色配方——配色圆点色板(mockup .pv-dot)
1156
+ /* @__PURE__ */ d("span", { className: "pv-dots", children: i.colorways.slice(0, Oe).map((A) => {
1157
+ var _;
1158
+ return /* @__PURE__ */ d(
1159
+ "span",
1160
+ {
1161
+ className: "pv-dot",
1162
+ style: (_ = A.preview) != null && _.accent ? { background: A.preview.accent } : void 0
1163
+ },
1164
+ A.id
1165
+ );
1166
+ }) })
1167
+ ) }),
1168
+ /* @__PURE__ */ F("div", { className: "tname", children: [
1169
+ /* @__PURE__ */ d("span", { className: "tname-name", children: i.name }),
1170
+ /* @__PURE__ */ d("span", { className: "badge", children: v ? (($ = i.colorways[0]) == null ? void 0 : $.name) ?? "" : e("{{count}} 配色", { count: i.colorways.length }) })
1171
+ ] })
1172
+ ]
1173
+ },
1174
+ i.id
1175
+ );
1176
+ })
1177
+ }
1178
+ );
1179
+ }
1180
+ function Ft({ checked: t, onChange: n, disabled: e }) {
1181
+ return /* @__PURE__ */ d(
1182
+ "div",
1183
+ {
1184
+ className: `toggle${t ? " on" : ""}${e ? " disabled" : ""}`,
1185
+ onClick: () => {
1186
+ e || n(!t);
1187
+ },
1188
+ role: "switch",
1189
+ "aria-checked": t
1190
+ }
1191
+ );
1192
+ }
1193
+ function G() {
1194
+ return window.linkdesk;
1195
+ }
1196
+ const Ht = se(function({
1197
+ size: n,
1198
+ value: e,
1199
+ onConfirm: o,
1200
+ onCancel: r,
1201
+ onChange: c,
1202
+ selectMode: s = "all",
1203
+ width: h,
1204
+ autoFocus: u,
1205
+ placeholder: l,
1206
+ type: i = "text",
1207
+ min: k,
1208
+ max: v
1209
+ }, m) {
1210
+ const a = H(null), [x, D] = P(e), [$, A] = P(!0);
1211
+ Me(m, () => ({
1212
+ getValue: () => x
1213
+ }), [x]), R(() => {
1214
+ if (!u || !a.current) return;
1215
+ a.current.focus(), requestAnimationFrame(() => {
1216
+ if (a.current)
1217
+ if (s === "nameOnly") {
1218
+ const g = e.lastIndexOf(".");
1219
+ g > 0 ? a.current.setSelectionRange(0, g) : a.current.select();
1220
+ } else
1221
+ a.current.select();
1222
+ });
1223
+ }, [u]), R(() => {
1224
+ var M, g;
1225
+ if (!$) {
1226
+ (g = (M = G().contextKey) == null ? void 0 : M.set) == null || g.call(M, "inputFocus", !1);
1227
+ const b = requestAnimationFrame(() => {
1228
+ var f, p;
1229
+ (p = (f = G().keybindings) == null ? void 0 : f.setKeybindingCaptureActive) == null || p.call(f, !1);
1230
+ });
1231
+ return () => cancelAnimationFrame(b);
1232
+ }
1233
+ }, [$]), R(() => () => {
1234
+ var M, g, b, f;
1235
+ (g = (M = G().contextKey) == null ? void 0 : M.set) == null || g.call(M, "inputFocus", !1), (f = (b = G().keybindings) == null ? void 0 : b.setKeybindingCaptureActive) == null || f.call(b, !1);
1236
+ }, []);
1237
+ const _ = (M) => {
1238
+ M.key === "Enter" ? (M.preventDefault(), A(!1), o(x)) : M.key === "Escape" && (M.preventDefault(), A(!1), r()), M.stopPropagation();
1239
+ }, I = () => {
1240
+ $ && (A(!1), o(x));
1241
+ }, S = () => {
1242
+ var M, g, b, f;
1243
+ (g = (M = G().contextKey) == null ? void 0 : M.set) == null || g.call(M, "inputFocus", !0), (f = (b = G().keybindings) == null ? void 0 : b.setKeybindingCaptureActive) == null || f.call(b, !0);
1244
+ };
1245
+ return /* @__PURE__ */ d(
1246
+ "input",
1247
+ {
1248
+ ref: a,
1249
+ className: `inline-input inline-input--${n}`,
1250
+ type: i,
1251
+ value: x,
1252
+ onChange: (M) => {
1253
+ const g = i === "number" ? M.target.value.replace(/\D/g, "") : M.target.value;
1254
+ D(g), c == null || c(g);
1255
+ },
1256
+ onKeyDown: _,
1257
+ onBlur: I,
1258
+ onFocus: S,
1259
+ onDragStart: (M) => M.preventDefault(),
1260
+ placeholder: l,
1261
+ min: k,
1262
+ max: v,
1263
+ style: h ? { width: h } : void 0,
1264
+ autoComplete: "off",
1265
+ spellCheck: !1
1266
+ }
1267
+ );
1268
+ });
1269
+ function ze(t, n) {
1270
+ const e = n.icon, o = n.iconSource;
1271
+ if (o === "lucide" && e)
1272
+ return { lucide: e };
1273
+ if (o === "codicon" && e)
1274
+ return { codicon: `codicon-${e}` };
1275
+ if (e && (o === "svg" || o === "url"))
1276
+ return { src: e };
1277
+ if (e) {
1278
+ if (e.includes("/") || e.includes(".")) {
1279
+ const r = e.includes(".") ? e : `${e}.png`;
1280
+ return { src: `linkdesk://${t}/${r}` };
1281
+ }
1282
+ return { codicon: `codicon-${e}` };
1283
+ }
1284
+ return { emoji: "📄" };
1285
+ }
1286
+ /**
1287
+ * @license lucide-react v1.29.0 - ISC
1288
+ *
1289
+ * This source code is licensed under the ISC license.
1290
+ * See the LICENSE file in the root directory of this source tree.
1291
+ */
1292
+ const ke = (...t) => t.filter((n, e, o) => !!n && n.trim() !== "" && o.indexOf(n) === e).join(" ").trim();
1293
+ /**
1294
+ * @license lucide-react v1.29.0 - ISC
1295
+ *
1296
+ * This source code is licensed under the ISC license.
1297
+ * See the LICENSE file in the root directory of this source tree.
1298
+ */
1299
+ const Ue = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
1300
+ /**
1301
+ * @license lucide-react v1.29.0 - ISC
1302
+ *
1303
+ * This source code is licensed under the ISC license.
1304
+ * See the LICENSE file in the root directory of this source tree.
1305
+ */
1306
+ const je = (t) => t.replace(
1307
+ /^([A-Z])|[\s-_]+(\w)/g,
1308
+ (n, e, o) => o ? o.toUpperCase() : e.toLowerCase()
1309
+ );
1310
+ /**
1311
+ * @license lucide-react v1.29.0 - ISC
1312
+ *
1313
+ * This source code is licensed under the ISC license.
1314
+ * See the LICENSE file in the root directory of this source tree.
1315
+ */
1316
+ const me = (t) => {
1317
+ const n = je(t);
1318
+ return n.charAt(0).toUpperCase() + n.slice(1);
1319
+ };
1320
+ /**
1321
+ * @license lucide-react v1.29.0 - ISC
1322
+ *
1323
+ * This source code is licensed under the ISC license.
1324
+ * See the LICENSE file in the root directory of this source tree.
1325
+ */
1326
+ var ne = {
1327
+ xmlns: "http://www.w3.org/2000/svg",
1328
+ width: 24,
1329
+ height: 24,
1330
+ viewBox: "0 0 24 24",
1331
+ fill: "none",
1332
+ stroke: "currentColor",
1333
+ strokeWidth: 2,
1334
+ strokeLinecap: "round",
1335
+ strokeLinejoin: "round"
1336
+ };
1337
+ /**
1338
+ * @license lucide-react v1.29.0 - ISC
1339
+ *
1340
+ * This source code is licensed under the ISC license.
1341
+ * See the LICENSE file in the root directory of this source tree.
1342
+ */
1343
+ const qe = (t) => {
1344
+ for (const n in t)
1345
+ if (n.startsWith("aria-") || n === "role" || n === "title")
1346
+ return !0;
1347
+ return !1;
1348
+ }, Ge = Ee({}), Ze = () => Ne(Ge), Xe = se(
1349
+ ({ color: t, size: n, strokeWidth: e, absoluteStrokeWidth: o, className: r = "", children: c, iconNode: s, ...h }, u) => {
1350
+ const {
1351
+ size: l = 24,
1352
+ strokeWidth: i = 2,
1353
+ absoluteStrokeWidth: k = !1,
1354
+ color: v = "currentColor",
1355
+ className: m = ""
1356
+ } = Ze() ?? {}, a = o ?? k ? Number(e ?? i) * 24 / Number(n ?? l) : e ?? i;
1357
+ return oe(
1358
+ "svg",
1359
+ {
1360
+ ref: u,
1361
+ ...ne,
1362
+ width: n ?? l ?? ne.width,
1363
+ height: n ?? l ?? ne.height,
1364
+ stroke: t ?? v,
1365
+ strokeWidth: a,
1366
+ className: ke("lucide", m, r),
1367
+ ...!c && !qe(h) && { "aria-hidden": "true" },
1368
+ ...h
1369
+ },
1370
+ [
1371
+ ...s.map(([x, D]) => oe(x, D)),
1372
+ ...Array.isArray(c) ? c : [c]
1373
+ ]
1374
+ );
1375
+ }
1376
+ );
1377
+ /**
1378
+ * @license lucide-react v1.29.0 - ISC
1379
+ *
1380
+ * This source code is licensed under the ISC license.
1381
+ * See the LICENSE file in the root directory of this source tree.
1382
+ */
1383
+ const O = (t, n) => {
1384
+ const e = se(
1385
+ ({ className: o, ...r }, c) => oe(Xe, {
1386
+ ref: c,
1387
+ iconNode: n,
1388
+ className: ke(
1389
+ `lucide-${Ue(me(t))}`,
1390
+ `lucide-${t}`,
1391
+ o
1392
+ ),
1393
+ ...r
1394
+ })
1395
+ );
1396
+ return e.displayName = me(t), e;
1397
+ };
1398
+ /**
1399
+ * @license lucide-react v1.29.0 - ISC
1400
+ *
1401
+ * This source code is licensed under the ISC license.
1402
+ * See the LICENSE file in the root directory of this source tree.
1403
+ */
1404
+ const Ye = [
1405
+ ["path", { d: "M12 5v16", key: "1f6ucr" }],
1406
+ [
1407
+ "path",
1408
+ {
1409
+ d: "M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",
1410
+ key: "1fyvmf"
1411
+ }
1412
+ ]
1413
+ ], Je = O("book-open", Ye);
1414
+ /**
1415
+ * @license lucide-react v1.29.0 - ISC
1416
+ *
1417
+ * This source code is licensed under the ISC license.
1418
+ * See the LICENSE file in the root directory of this source tree.
1419
+ */
1420
+ const Qe = [
1421
+ ["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
1422
+ ["path", { d: "M18 17V9", key: "2bz60n" }],
1423
+ ["path", { d: "M13 17V5", key: "1frdt8" }],
1424
+ ["path", { d: "M8 17v-3", key: "17ska0" }]
1425
+ ], et = O("chart-column", Qe);
1426
+ /**
1427
+ * @license lucide-react v1.29.0 - ISC
1428
+ *
1429
+ * This source code is licensed under the ISC license.
1430
+ * See the LICENSE file in the root directory of this source tree.
1431
+ */
1432
+ const tt = [
1433
+ [
1434
+ "path",
1435
+ {
1436
+ d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
1437
+ key: "1oefj6"
1438
+ }
1439
+ ],
1440
+ ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
1441
+ ], nt = O("file", tt);
1442
+ /**
1443
+ * @license lucide-react v1.29.0 - ISC
1444
+ *
1445
+ * This source code is licensed under the ISC license.
1446
+ * See the LICENSE file in the root directory of this source tree.
1447
+ */
1448
+ const ot = [
1449
+ [
1450
+ "path",
1451
+ {
1452
+ d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",
1453
+ key: "usdka0"
1454
+ }
1455
+ ]
1456
+ ], rt = O("folder-open", ot);
1457
+ /**
1458
+ * @license lucide-react v1.29.0 - ISC
1459
+ *
1460
+ * This source code is licensed under the ISC license.
1461
+ * See the LICENSE file in the root directory of this source tree.
1462
+ */
1463
+ const st = [
1464
+ [
1465
+ "path",
1466
+ {
1467
+ d: "M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",
1468
+ key: "hod4my"
1469
+ }
1470
+ ],
1471
+ [
1472
+ "path",
1473
+ {
1474
+ d: "M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",
1475
+ key: "w4yl2u"
1476
+ }
1477
+ ],
1478
+ ["path", { d: "M3 5a2 2 0 0 0 2 2h3", key: "f2jnh7" }],
1479
+ ["path", { d: "M3 3v13a2 2 0 0 0 2 2h3", key: "k8epm1" }]
1480
+ ], ct = O("folder-tree", st);
1481
+ /**
1482
+ * @license lucide-react v1.29.0 - ISC
1483
+ *
1484
+ * This source code is licensed under the ISC license.
1485
+ * See the LICENSE file in the root directory of this source tree.
1486
+ */
1487
+ const it = [
1488
+ [
1489
+ "path",
1490
+ {
1491
+ d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",
1492
+ key: "1kt360"
1493
+ }
1494
+ ]
1495
+ ], at = O("folder", it);
1496
+ /**
1497
+ * @license lucide-react v1.29.0 - ISC
1498
+ *
1499
+ * This source code is licensed under the ISC license.
1500
+ * See the LICENSE file in the root directory of this source tree.
1501
+ */
1502
+ const lt = [
1503
+ [
1504
+ "path",
1505
+ {
1506
+ d: "M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",
1507
+ key: "1gvzjb"
1508
+ }
1509
+ ],
1510
+ ["path", { d: "M9 18h6", key: "x1upvd" }],
1511
+ ["path", { d: "M10 22h4", key: "ceow96" }]
1512
+ ], ut = O("lightbulb", lt);
1513
+ /**
1514
+ * @license lucide-react v1.29.0 - ISC
1515
+ *
1516
+ * This source code is licensed under the ISC license.
1517
+ * See the LICENSE file in the root directory of this source tree.
1518
+ */
1519
+ const dt = [
1520
+ ["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2", key: "1w4ew1" }],
1521
+ ["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
1522
+ ], ft = O("lock", dt);
1523
+ /**
1524
+ * @license lucide-react v1.29.0 - ISC
1525
+ *
1526
+ * This source code is licensed under the ISC license.
1527
+ * See the LICENSE file in the root directory of this source tree.
1528
+ */
1529
+ const ht = [
1530
+ ["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
1531
+ ["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
1532
+ ["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
1533
+ ], mt = O("monitor", ht);
1534
+ /**
1535
+ * @license lucide-react v1.29.0 - ISC
1536
+ *
1537
+ * This source code is licensed under the ISC license.
1538
+ * See the LICENSE file in the root directory of this source tree.
1539
+ */
1540
+ const pt = [
1541
+ [
1542
+ "path",
1543
+ {
1544
+ d: "M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",
1545
+ key: "1a0edw"
1546
+ }
1547
+ ],
1548
+ ["path", { d: "M12 22V12", key: "d0xqtd" }],
1549
+ ["polyline", { points: "3.29 7 12 12 20.71 7", key: "ousv84" }],
1550
+ ["path", { d: "m7.5 4.27 9 5.15", key: "1c824w" }]
1551
+ ], wt = O("package", pt);
1552
+ /**
1553
+ * @license lucide-react v1.29.0 - ISC
1554
+ *
1555
+ * This source code is licensed under the ISC license.
1556
+ * See the LICENSE file in the root directory of this source tree.
1557
+ */
1558
+ const vt = [
1559
+ [
1560
+ "path",
1561
+ {
1562
+ d: "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",
1563
+ key: "1i5ecw"
1564
+ }
1565
+ ],
1566
+ ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
1567
+ ], yt = O("settings", vt);
1568
+ /**
1569
+ * @license lucide-react v1.29.0 - ISC
1570
+ *
1571
+ * This source code is licensed under the ISC license.
1572
+ * See the LICENSE file in the root directory of this source tree.
1573
+ */
1574
+ const gt = [
1575
+ ["path", { d: "M16 10a4 4 0 0 1-8 0", key: "1ltviw" }],
1576
+ ["path", { d: "M3.103 6.034h17.794", key: "awc11p" }],
1577
+ [
1578
+ "path",
1579
+ {
1580
+ d: "M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z",
1581
+ key: "o988cm"
1582
+ }
1583
+ ]
1584
+ ], bt = O("shopping-bag", gt), kt = {
1585
+ File: nt,
1586
+ Folder: at,
1587
+ FolderOpen: rt,
1588
+ FolderTree: ct,
1589
+ Package: wt,
1590
+ ShoppingBag: bt,
1591
+ Monitor: mt,
1592
+ Settings: yt,
1593
+ BookOpen: Je,
1594
+ BarChart3: et,
1595
+ Lightbulb: ut,
1596
+ Lock: ft
1597
+ }, pe = "📄";
1598
+ function Kt({ pluginId: t, manifest: n, className: e, alt: o = "" }) {
1599
+ const r = n ? ze(t, n) : { emoji: pe };
1600
+ if (r.lucide) {
1601
+ const c = kt[r.lucide];
1602
+ if (c)
1603
+ return /* @__PURE__ */ d(c, { className: `plugin-icon plugin-icon--lucide ${e ?? ""}` });
1604
+ }
1605
+ return r.codicon ? /* @__PURE__ */ d("span", { className: `codicon ${r.codicon} plugin-icon plugin-icon--codicon ${e ?? ""}` }) : r.src ? /* @__PURE__ */ d("img", { src: r.src, alt: o, className: `plugin-icon plugin-icon--img ${e ?? ""}`, draggable: !1 }) : /* @__PURE__ */ d("span", { className: `plugin-icon plugin-icon--emoji ${e ?? ""}`, children: r.emoji ?? pe });
1606
+ }
1607
+ function Wt(t, n) {
1608
+ const e = n - t;
1609
+ return !Number.isInteger(t) || !Number.isInteger(n) || e <= 2 ? 0.01 : 1;
1610
+ }
1611
+ export {
1612
+ Ce as Button,
1613
+ At as ColorPicker,
1614
+ Ct as Combobox,
1615
+ It as ContextMenu,
1616
+ Lt as DynamicSelect,
1617
+ _t as FilePathInput,
1618
+ $t as FontFamilySelect,
1619
+ Dt as FormRow,
1620
+ Ht as InlineInput,
1621
+ St as NumberInput,
1622
+ Kt as PluginIcon,
1623
+ Rt as SegmentedRadio,
1624
+ ge as SelectBox,
1625
+ Tt as Slider,
1626
+ Pt as ThemePicker,
1627
+ Ft as Toggle,
1628
+ Wt as inferSliderStep
1629
+ };