dsh-prism-plugin 0.0.0-stage → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js ADDED
@@ -0,0 +1,4191 @@
1
+ window.__ModuleLoader__.load({
2
+ id: "dsh-prism-plugin",
3
+ factory: (require) => {
4
+ var module = { exports: {} };
5
+ var exports = module.exports;
6
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
+ let react = require("react");
8
+ require("@deepseek-ai/dsh-client-ui-primitives");
9
+ let react_jsx_runtime = require("react/jsx-runtime");
10
+ let _deepseek_ai_dsh_client_store = require("@deepseek-ai/dsh-client-store");
11
+ // src/client/color.ts
12
+ /** Clamp a channel into [min, max] with a fallback. */
13
+ function clampChannel(value, min, max, fallback) {
14
+ const n = value;
15
+ return Math.min(max, Math.max(min, Number.isFinite(n) ? n : fallback));
16
+ }
17
+ /**
18
+ * Convert HSL to a `#rrggbb` hex string.
19
+ * @param color - HSL color.
20
+ * @returns hex string.
21
+ */
22
+ function hslToHex(color) {
23
+ const h = clampChannel(color.h, 0, 360, 0) / 360;
24
+ const s = clampChannel(color.s, 0, 100, 0) / 100;
25
+ const l = clampChannel(color.l, 0, 100, 50) / 100;
26
+ const hue2rgb = (p, q, t) => {
27
+ let tt = t;
28
+ if (tt < 0) tt += 1;
29
+ if (tt > 1) tt -= 1;
30
+ if (tt < 1 / 6) return p + (q - p) * 6 * tt;
31
+ if (tt < 1 / 2) return q;
32
+ if (tt < 2 / 3) return p + (q - p) * (2 / 3 - tt) * 6;
33
+ return p;
34
+ };
35
+ const q = l < .5 ? l * (1 + s) : l + s - l * s;
36
+ const p = 2 * l - q;
37
+ const channel = (t) => {
38
+ return Math.round(hue2rgb(p, q, t) * 255).toString(16).padStart(2, "0");
39
+ };
40
+ return `#${channel(h + 1 / 3)}${channel(h)}${channel(h - 1 / 3)}`;
41
+ }
42
+ /**
43
+ * Convert a `#rrggbb` hex string to HSL.
44
+ * @param hex - hex string (3- or 6-digit form).
45
+ * @returns HSL color.
46
+ */
47
+ function hexToHsl(hex) {
48
+ let value = hex.trim().replace(/^#/, "");
49
+ if (value.length === 3) value = value.split("").map((c) => c + c).join("");
50
+ if (!/^[0-9a-fA-F]{6}$/.test(value)) return {
51
+ h: 0,
52
+ s: 0,
53
+ l: 50
54
+ };
55
+ const r = parseInt(value.slice(0, 2), 16) / 255;
56
+ const g = parseInt(value.slice(2, 4), 16) / 255;
57
+ const b = parseInt(value.slice(4, 6), 16) / 255;
58
+ const max = Math.max(r, g, b);
59
+ const min = Math.min(r, g, b);
60
+ const l = (max + min) / 2;
61
+ if (max === min) return {
62
+ h: 0,
63
+ s: 0,
64
+ l: Math.round(l * 100)
65
+ };
66
+ const d = max - min;
67
+ const s = l > .5 ? d / (2 - max - min) : d / (max + min);
68
+ let h;
69
+ if (max === r) h = (g - b) / d + (g < b ? 6 : 0);
70
+ else if (max === g) h = (b - r) / d + 2;
71
+ else h = (r - g) / d + 4;
72
+ h *= 60;
73
+ return {
74
+ h: Math.round(h),
75
+ s: Math.round(s * 100),
76
+ l: Math.round(l * 100)
77
+ };
78
+ }
79
+ // \0prism-css:src/client/PrismControls.module.css.mjs
80
+ const css$2 = ".orGz7a_sliderRow{grid-template-columns:minmax(96px,.85fr) minmax(100px,1.5fr) 52px;align-items:center;gap:14px;min-height:36px;display:grid}.orGz7a_sliderLabel{color:var(--dsw-alias-label-secondary);font-size:13px;line-height:20px}.orGz7a_sliderTrack{cursor:pointer;touch-action:none;border-radius:999px;outline:none;height:24px;position:relative}.orGz7a_sliderTrack:before{content:\"\";background:var(--dsw-alias-border-l2);height:4px;box-shadow:inset 0 0 0 .5px var(--dsw-alias-border-l1);border-radius:999px;transition:background-color .16s;position:absolute;top:10px;left:0;right:0}.orGz7a_sliderTrack:hover:before{background:var(--dsw-alias-border-l3)}.orGz7a_sliderTrack:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.orGz7a_sliderFill{background:var(--dsw-alias-state-business-primary);pointer-events:none;border-radius:999px;height:4px;position:absolute;top:10px;left:0}.orGz7a_sliderThumb{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);width:14px;height:14px;box-shadow:0 1px 4px #0f1e3233, inset 0 0 0 3px var(--dsw-alias-state-business-primary);pointer-events:none;border-radius:50%;margin-left:-7px;transition:box-shadow .14s,scale .14s;position:absolute;top:5px}.orGz7a_sliderTrack:hover .orGz7a_sliderThumb{scale:1.08}.orGz7a_sliderTrack:active .orGz7a_sliderThumb{box-shadow:0 1px 4px #0f1e3233, inset 0 0 0 4px var(--dsw-alias-state-business-primary);scale:1.16}.orGz7a_sliderReadout{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;text-align:right;white-space:nowrap;font-size:12px;line-height:20px}.orGz7a_sliderReadout span{color:var(--dsw-alias-label-tertiary);margin-left:1px}.orGz7a_segmented{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base);border-radius:10px;gap:3px;padding:3px;display:flex}.orGz7a_seg,.orGz7a_segActive{cursor:pointer;border:0;border-radius:7px;flex:1;min-width:0;min-height:30px;padding:4px 10px;font-size:12px;line-height:20px;transition:background-color .14s,color .14s,box-shadow .14s}.orGz7a_seg{color:var(--dsw-alias-label-secondary);background:0 0}.orGz7a_seg:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.orGz7a_segActive{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1);box-shadow:0 1px 4px #1423371f, inset 0 0 0 1px var(--dsw-alias-border-l1);font-weight:500}.orGz7a_seg:focus-visible,.orGz7a_segActive:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}.orGz7a_button{cursor:pointer;white-space:nowrap;border:1px solid #0000;border-radius:8px;justify-content:center;align-items:center;gap:6px;min-height:32px;padding:5px 12px;font-size:12px;font-weight:500;line-height:20px;transition:background-color .14s,border-color .14s,color .14s,box-shadow .14s,translate .1s;display:inline-flex}.orGz7a_button:active:not(:disabled){translate:0 1px}.orGz7a_button:disabled{cursor:not-allowed;opacity:.45}.orGz7a_button:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.orGz7a_buttonPrimary{color:var(--dsw-alias-label-primary-inverted);background:var(--dsw-alias-button-primary-fill)}.orGz7a_buttonPrimary:hover:not(:disabled){background:var(--dsw-alias-button-primary-hover);filter:brightness(1.04)}.orGz7a_buttonSecondary{color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-1);border-color:var(--dsw-alias-border-l2)}.orGz7a_buttonSecondary:hover:not(:disabled){color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover);border-color:var(--dsw-alias-border-l3)}.orGz7a_buttonQuiet{color:var(--dsw-alias-label-secondary);background:0 0}.orGz7a_buttonQuiet:hover:not(:disabled){color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.orGz7a_buttonDanger{color:var(--dsw-alias-label-secondary);background:0 0}.orGz7a_buttonDanger:hover:not(:disabled){color:#d84646;background:var(--dsw-alias-interactive-bg-hover-danger)}.orGz7a_switch,.orGz7a_switchOn{border:1px solid var(--dsw-alias-border-l2);cursor:pointer;border-radius:999px;flex:none;width:38px;height:22px;padding:0;transition:background-color .18s,border-color .18s,box-shadow .14s;position:relative}.orGz7a_switch{background:var(--dsw-alias-border-l2)}.orGz7a_switchOn{background:var(--dsw-alias-state-business-primary);border-color:#0000}.orGz7a_switch:focus-visible,.orGz7a_switchOn:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.orGz7a_switchThumb{background:#fff;border-radius:50%;width:14px;height:14px;transition:translate .18s cubic-bezier(.2,.8,.2,1);position:absolute;top:3px;left:3px;box-shadow:0 1px 3px #00000038}.orGz7a_switchOn .orGz7a_switchThumb{translate:16px}.orGz7a_group{border-bottom:1px solid var(--dsw-alias-border-l2)}.orGz7a_groupToggle{width:100%;min-height:44px;color:var(--dsw-alias-label-primary);cursor:pointer;text-align:left;background:0 0;border:0;justify-content:space-between;align-items:center;padding:10px 0;display:flex}.orGz7a_groupToggle:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.orGz7a_groupTitle{font-size:14px;font-weight:500;line-height:22px}.orGz7a_groupChevron,.orGz7a_groupChevronOpen{color:var(--dsw-alias-label-tertiary);transition:rotate .18s;display:inline-flex}.orGz7a_groupChevronOpen{rotate:180deg}.orGz7a_groupBody{flex-direction:column;gap:12px;padding:2px 0 18px;display:flex}.orGz7a_colorRow{grid-template-columns:minmax(100px,1fr) 104px 34px;align-items:center;gap:10px;min-height:36px;display:grid}.orGz7a_colorHex{border:1px solid var(--dsw-alias-border-l2);width:100%;min-width:0;height:32px;color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-base);font-family:var(--ds-font-family-code,monospace);text-transform:lowercase;border-radius:7px;padding:4px 8px;font-size:11px;line-height:20px}.orGz7a_colorHex:hover{border-color:var(--dsw-alias-border-l3)}.orGz7a_colorHex:focus{border-color:var(--dsw-alias-state-business-primary);outline:2px solid var(--dsw-alias-interactive-bg-hover-accent)}.orGz7a_colorInput{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);cursor:pointer;border-radius:7px;width:34px;height:32px;padding:3px}.orGz7a_colorInput:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.orGz7a_colorInput::-webkit-color-swatch-wrapper{padding:0}.orGz7a_colorInput::-webkit-color-swatch{border:0;border-radius:4px}@media (width<=480px){.orGz7a_sliderRow{grid-template-columns:minmax(84px,.8fr) minmax(80px,1.2fr) 46px;gap:10px}.orGz7a_colorRow{grid-template-columns:minmax(84px,1fr) 94px 34px;gap:8px}}@media (prefers-reduced-motion:reduce){.orGz7a_seg,.orGz7a_segActive,.orGz7a_button,.orGz7a_switch,.orGz7a_switchOn,.orGz7a_switchThumb,.orGz7a_sliderThumb,.orGz7a_groupChevron,.orGz7a_groupChevronOpen{transition:none}}";
81
+ const tagId$2 = "dsh-prism-plugin/PrismControls.module.css";
82
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$2) + "]") === null) {
83
+ const tag = document.createElement("style");
84
+ tag.dataset.plugin = "dsh-prism-plugin";
85
+ tag.dataset.pluginCss = tagId$2;
86
+ tag.textContent = css$2;
87
+ document.head.appendChild(tag);
88
+ }
89
+ var PrismControls_module_css_default = {
90
+ "button": "orGz7a_button",
91
+ "buttonDanger": "orGz7a_buttonDanger",
92
+ "buttonPrimary": "orGz7a_buttonPrimary",
93
+ "buttonQuiet": "orGz7a_buttonQuiet",
94
+ "buttonSecondary": "orGz7a_buttonSecondary",
95
+ "colorHex": "orGz7a_colorHex",
96
+ "colorInput": "orGz7a_colorInput",
97
+ "colorRow": "orGz7a_colorRow",
98
+ "group": "orGz7a_group",
99
+ "groupBody": "orGz7a_groupBody",
100
+ "groupChevron": "orGz7a_groupChevron",
101
+ "groupChevronOpen": "orGz7a_groupChevronOpen",
102
+ "groupTitle": "orGz7a_groupTitle",
103
+ "groupToggle": "orGz7a_groupToggle",
104
+ "seg": "orGz7a_seg",
105
+ "segActive": "orGz7a_segActive",
106
+ "segmented": "orGz7a_segmented",
107
+ "sliderFill": "orGz7a_sliderFill",
108
+ "sliderLabel": "orGz7a_sliderLabel",
109
+ "sliderReadout": "orGz7a_sliderReadout",
110
+ "sliderRow": "orGz7a_sliderRow",
111
+ "sliderThumb": "orGz7a_sliderThumb",
112
+ "sliderTrack": "orGz7a_sliderTrack",
113
+ "switch": "orGz7a_switch",
114
+ "switchOn": "orGz7a_switchOn",
115
+ "switchThumb": "orGz7a_switchThumb"
116
+ };
117
+ // src/client/controls.tsx
118
+ /**
119
+ * Prism settings controls: the spring-damped slider (pointer + full keyboard
120
+ * operation, WAI-ARIA slider semantics), the hue slider, and a segmented
121
+ * picker. The damping itself lives in the layer — the slider writes targets,
122
+ * the skin glides — so these controls stay dumb and testable.
123
+ */
124
+ /** Compute the value for a pointer x position inside the track bounds. */
125
+ function valueFromPointer(clientX, rect, min, max) {
126
+ return min + Math.min(1, Math.max(0, (clientX - rect.left) / rect.width)) * (max - min);
127
+ }
128
+ /**
129
+ * Render one damped slider row: label, track with accent fill, draggable
130
+ * thumb, and a numeric readout. The element is a real WAI-ARIA slider.
131
+ * @param props - slider props.
132
+ * @returns the slider row.
133
+ */
134
+ function PrismSlider({ label, value, min, max, step, unit, onChange, defaultValue, resetHint }) {
135
+ const trackRef = (0, react.useRef)(null);
136
+ const draggingRef = (0, react.useRef)(false);
137
+ const labelId = (0, react.useId)();
138
+ const ratio = max === min ? 0 : (value - min) / (max - min);
139
+ const displayedValue = Math.round(value * 10) / 10;
140
+ const commit = (0, react.useCallback)((clientX) => {
141
+ const track = trackRef.current;
142
+ if (track === null) return;
143
+ const raw = valueFromPointer(clientX, track.getBoundingClientRect(), min, max);
144
+ const stepped = Math.round(raw / step) * step;
145
+ onChange(Math.min(max, Math.max(min, stepped)));
146
+ }, [
147
+ max,
148
+ min,
149
+ onChange,
150
+ step
151
+ ]);
152
+ const onPointerDown = (0, react.useCallback)((event) => {
153
+ event.currentTarget.setPointerCapture(event.pointerId);
154
+ draggingRef.current = true;
155
+ commit(event.clientX);
156
+ }, [commit]);
157
+ const onPointerMove = (0, react.useCallback)((event) => {
158
+ if (!draggingRef.current) return;
159
+ commit(event.clientX);
160
+ }, [commit]);
161
+ const onPointerUp = (0, react.useCallback)((event) => {
162
+ draggingRef.current = false;
163
+ event.currentTarget.releasePointerCapture(event.pointerId);
164
+ }, []);
165
+ const onKeyDown = (0, react.useCallback)((event) => {
166
+ if ((event.key === "Delete" || event.key === "Backspace") && defaultValue !== void 0) {
167
+ event.preventDefault();
168
+ onChange(defaultValue);
169
+ return;
170
+ }
171
+ let next;
172
+ switch (event.key) {
173
+ case "ArrowLeft":
174
+ case "ArrowDown":
175
+ next = value - step;
176
+ break;
177
+ case "ArrowRight":
178
+ case "ArrowUp":
179
+ next = value + step;
180
+ break;
181
+ case "PageDown":
182
+ next = value - step * 10;
183
+ break;
184
+ case "PageUp":
185
+ next = value + step * 10;
186
+ break;
187
+ case "Home":
188
+ next = min;
189
+ break;
190
+ case "End":
191
+ next = max;
192
+ break;
193
+ default: return;
194
+ }
195
+ event.preventDefault();
196
+ onChange(Math.min(max, Math.max(min, next)));
197
+ }, [
198
+ defaultValue,
199
+ max,
200
+ min,
201
+ onChange,
202
+ step,
203
+ value
204
+ ]);
205
+ const fillStyle = { width: `${String(ratio * 100)}%` };
206
+ const thumbStyle = { left: `${String(ratio * 100)}%` };
207
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
208
+ className: PrismControls_module_css_default.sliderRow,
209
+ children: [
210
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
211
+ className: PrismControls_module_css_default.sliderLabel,
212
+ id: labelId,
213
+ children: label
214
+ }),
215
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
216
+ ref: trackRef,
217
+ role: "slider",
218
+ tabIndex: 0,
219
+ className: PrismControls_module_css_default.sliderTrack,
220
+ "aria-labelledby": labelId,
221
+ "aria-valuemin": min,
222
+ "aria-valuemax": max,
223
+ "aria-valuenow": displayedValue,
224
+ "aria-valuetext": unit === void 0 || unit === "" ? void 0 : `${String(displayedValue)}${unit}`,
225
+ title: defaultValue === void 0 ? void 0 : resetHint,
226
+ onDoubleClick: () => {
227
+ if (defaultValue !== void 0) onChange(defaultValue);
228
+ },
229
+ onPointerDown,
230
+ onPointerMove,
231
+ onPointerUp,
232
+ onKeyDown,
233
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
234
+ className: PrismControls_module_css_default.sliderFill,
235
+ style: fillStyle
236
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
237
+ className: PrismControls_module_css_default.sliderThumb,
238
+ style: thumbStyle
239
+ })]
240
+ }),
241
+ unit !== void 0 && unit !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("output", {
242
+ className: PrismControls_module_css_default.sliderReadout,
243
+ "aria-label": `${label} ${String(displayedValue)}${unit}`,
244
+ children: [String(displayedValue), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: unit })]
245
+ })
246
+ ]
247
+ });
248
+ }
249
+ /** A compact native button with consistent state styling. */
250
+ function PrismButton({ variant = "secondary", className = "", children, ...props }) {
251
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
252
+ type: "button",
253
+ className: `${PrismControls_module_css_default.button} ${PrismControls_module_css_default[`button${variant[0]?.toUpperCase() ?? ""}${variant.slice(1)}`]} ${className}`,
254
+ ...props,
255
+ children
256
+ });
257
+ }
258
+ /** Accessible master/feature switch. */
259
+ function Switch({ label, checked, onChange }) {
260
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
261
+ type: "button",
262
+ className: checked ? PrismControls_module_css_default.switchOn : PrismControls_module_css_default.switch,
263
+ role: "switch",
264
+ "aria-checked": checked,
265
+ "aria-label": label,
266
+ onClick: () => {
267
+ onChange(!checked);
268
+ },
269
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
270
+ className: PrismControls_module_css_default.switchThumb,
271
+ "aria-hidden": "true"
272
+ })
273
+ });
274
+ }
275
+ /**
276
+ * Render a two-or-more-button segmented picker.
277
+ * @param props - segmented props.
278
+ * @returns the button group.
279
+ */
280
+ function Segmented({ label, value, options, onSelect }) {
281
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
282
+ className: PrismControls_module_css_default.segmented,
283
+ role: "group",
284
+ "aria-label": label,
285
+ children: options.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
286
+ type: "button",
287
+ className: option.id === value ? PrismControls_module_css_default.segActive : PrismControls_module_css_default.seg,
288
+ "aria-pressed": option.id === value,
289
+ onClick: () => {
290
+ onSelect(option.id);
291
+ },
292
+ children: option.label
293
+ }, option.id))
294
+ });
295
+ }
296
+ /** Hex-validity check (accepts #rgb / #rrggbb / bare 6-hex). */
297
+ function parseHexInput(raw) {
298
+ let value = raw.trim().replace(/^#/, "");
299
+ if (value.length === 3 && /^[0-9a-fA-F]{3}$/.test(value)) value = value.split("").map((c) => c + c).join("");
300
+ if (!/^[0-9a-fA-F]{6}$/.test(value)) return null;
301
+ return `#${value.toLowerCase()}`;
302
+ }
303
+ /**
304
+ * Render a Codex-style full-range color control: a hex code input (type any
305
+ * color code directly) plus the click-to-pick swatch button on the right.
306
+ * @param props - color control props.
307
+ * @returns the color control row.
308
+ */
309
+ function ColorControl({ label, hexLabel, pickerLabel, placeholder, hue, sat, light, onChange }) {
310
+ const hex = hslToHex({
311
+ h: hue,
312
+ s: sat,
313
+ l: light
314
+ });
315
+ const [text, setText] = (0, react.useState)(hex);
316
+ (0, react.useEffect)(() => {
317
+ setText(hex);
318
+ }, [hex]);
319
+ const commitText = (0, react.useCallback)((raw) => {
320
+ const parsed = parseHexInput(raw);
321
+ if (parsed === null) return;
322
+ const color = hexToHsl(parsed);
323
+ onChange(color.h, color.s, color.l);
324
+ }, [onChange]);
325
+ const onSwatch = (0, react.useCallback)((event) => {
326
+ setText(event.target.value);
327
+ const color = hexToHsl(event.target.value);
328
+ onChange(color.h, color.s, color.l);
329
+ }, [onChange]);
330
+ const onText = (0, react.useCallback)((event) => {
331
+ setText(event.target.value);
332
+ if (parseHexInput(event.target.value) !== null) commitText(event.target.value);
333
+ }, [commitText]);
334
+ const onBlur = (0, react.useCallback)(() => {
335
+ const parsed = parseHexInput(text);
336
+ if (parsed === null) {
337
+ setText(hex);
338
+ return;
339
+ }
340
+ setText(parsed);
341
+ commitText(parsed);
342
+ }, [
343
+ commitText,
344
+ hex,
345
+ text
346
+ ]);
347
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
348
+ className: PrismControls_module_css_default.colorRow,
349
+ children: [
350
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
351
+ className: PrismControls_module_css_default.sliderLabel,
352
+ children: label
353
+ }),
354
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
355
+ type: "text",
356
+ className: PrismControls_module_css_default.colorHex,
357
+ value: text,
358
+ "aria-label": `${label} · ${hexLabel}`,
359
+ spellCheck: false,
360
+ placeholder,
361
+ onChange: onText,
362
+ onBlur
363
+ }),
364
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
365
+ type: "color",
366
+ className: PrismControls_module_css_default.colorInput,
367
+ value: hex,
368
+ "aria-label": `${label} · ${pickerLabel}`,
369
+ onChange: onSwatch
370
+ })
371
+ ]
372
+ });
373
+ }
374
+ /** Stable internal error message used to localize the saved-theme limit. */
375
+ const PRISM_THEME_LIMIT_ERROR = "prism-theme-limit";
376
+ /** Stable error raised when a library edit cannot be durably persisted. */
377
+ const PRISM_THEME_PERSIST_ERROR = "prism-theme-persist-failed";
378
+ /** Material recipes: clear glass, frosted glass, and matte velvet. */
379
+ const MATERIALS = Object.freeze({
380
+ clear: Object.freeze({
381
+ saturate: 112,
382
+ depth: .9
383
+ }),
384
+ frosted: Object.freeze({
385
+ saturate: 130,
386
+ depth: 1
387
+ }),
388
+ velvet: Object.freeze({
389
+ saturate: 75,
390
+ depth: 1.2
391
+ })
392
+ });
393
+ /** UI font stacks by choice id (system = the stock stack). */
394
+ const FONT_CHOICES = Object.freeze({
395
+ system: "",
396
+ rounded: "'PingFang SC', 'HarmonyOS Sans SC', 'MiSans', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif",
397
+ serif: "'Noto Serif SC', 'Songti SC', 'STSong', 'SimSun', 'Times New Roman', serif",
398
+ mono: "'SF Mono', 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, 'Liberation Mono', Menlo, monospace",
399
+ custom: ""
400
+ });
401
+ /** Code font stacks by choice id. */
402
+ const CODE_FONT_CHOICES = Object.freeze({
403
+ system: "",
404
+ rounded: "'SF Mono', 'JetBrains Mono', 'Fira Code', Consolas, 'Liberation Mono', Menlo, Courier, 'PingFang SC', 'Microsoft YaHei'",
405
+ serif: "'JetBrains Mono', 'SF Mono', Consolas, 'PingFang SC', 'Microsoft YaHei', monospace",
406
+ mono: "'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, 'Liberation Mono', Menlo, monospace",
407
+ custom: ""
408
+ });
409
+ /** localStorage key carrying the knob document. */
410
+ const PRISM_SETTINGS_KEY = "dsh.ui-prism.settings.v1";
411
+ /** The neutral zone bundle (100 = follow the global frost). */
412
+ const DEFAULT_ZONES = Object.freeze({
413
+ base: 100,
414
+ sidebar: 100,
415
+ card: 100,
416
+ input: 100,
417
+ overlay: 100,
418
+ bubble: 100
419
+ });
420
+ /** Defaults a first-time install sees (the shipped look). */
421
+ const SETTINGS_DEFAULTS = Object.freeze({
422
+ enabled: true,
423
+ material: "frosted",
424
+ blur: 18,
425
+ frost: 50,
426
+ zones: { ...DEFAULT_ZONES },
427
+ bgBrightness: 50,
428
+ fontScale: 100,
429
+ fontChoice: "system",
430
+ customFont: "",
431
+ inkLightHue: 222,
432
+ inkLightSat: 30,
433
+ inkLightLight: 12,
434
+ inkDarkHue: 222,
435
+ inkDarkSat: 30,
436
+ inkDarkLight: 92,
437
+ accentHue: 205,
438
+ accentSat: 85,
439
+ accentLight: 55,
440
+ accentOpacity: 100,
441
+ bgHue: 215,
442
+ bgSat: 80,
443
+ bgLight: 60,
444
+ motion: 55,
445
+ background: "aurora",
446
+ wallpaperDark: [],
447
+ wallpaperLight: [],
448
+ wallpaperDimDark: [],
449
+ wallpaperDimLight: [],
450
+ wallpaperCycleDark: [],
451
+ wallpaperCycleLight: [],
452
+ wallpaperInterval: 30,
453
+ wallpaperLoop: false,
454
+ wallpaperPinnedDark: 0,
455
+ wallpaperPinnedLight: 0,
456
+ wallpaperBlur: 20,
457
+ wallpaperFrost: 0,
458
+ customThemes: []
459
+ });
460
+ /** Curated whole-skin presets. Every recipe is intentionally complete: one
461
+ * click changes a coherent palette and material rather than only the hue. */
462
+ const PRESETS = Object.freeze({
463
+ crystal: Object.freeze({
464
+ accentHue: 205,
465
+ accentSat: 82,
466
+ accentLight: 54,
467
+ bgHue: 200,
468
+ bgSat: 70,
469
+ bgLight: 72,
470
+ material: "clear",
471
+ blur: 14,
472
+ frost: 32,
473
+ bgBrightness: 58,
474
+ motion: 28
475
+ }),
476
+ night: Object.freeze({
477
+ accentHue: 190,
478
+ accentSat: 82,
479
+ accentLight: 58,
480
+ bgHue: 222,
481
+ bgSat: 72,
482
+ bgLight: 46,
483
+ material: "frosted",
484
+ blur: 20,
485
+ frost: 46,
486
+ bgBrightness: 38,
487
+ motion: 52
488
+ }),
489
+ aurora: Object.freeze({
490
+ accentHue: 318,
491
+ accentSat: 76,
492
+ accentLight: 62,
493
+ bgHue: 165,
494
+ bgSat: 78,
495
+ bgLight: 58,
496
+ material: "velvet",
497
+ blur: 24,
498
+ frost: 38,
499
+ bgBrightness: 48,
500
+ motion: 72
501
+ }),
502
+ dune: Object.freeze({
503
+ accentHue: 28,
504
+ accentSat: 68,
505
+ accentLight: 52,
506
+ bgHue: 38,
507
+ bgSat: 58,
508
+ bgLight: 70,
509
+ material: "frosted",
510
+ blur: 16,
511
+ frost: 40,
512
+ bgBrightness: 60,
513
+ motion: 22
514
+ }),
515
+ rose: Object.freeze({
516
+ accentHue: 350,
517
+ accentSat: 62,
518
+ accentLight: 60,
519
+ bgHue: 320,
520
+ bgSat: 42,
521
+ bgLight: 66,
522
+ material: "velvet",
523
+ blur: 22,
524
+ frost: 42,
525
+ bgBrightness: 48,
526
+ motion: 30
527
+ }),
528
+ forest: Object.freeze({
529
+ accentHue: 158,
530
+ accentSat: 58,
531
+ accentLight: 46,
532
+ bgHue: 176,
533
+ bgSat: 52,
534
+ bgLight: 52,
535
+ material: "frosted",
536
+ blur: 18,
537
+ frost: 44,
538
+ bgBrightness: 44,
539
+ motion: 36
540
+ })
541
+ });
542
+ /** Numeric knob ranges. */
543
+ const RANGES = Object.freeze({
544
+ blur: {
545
+ min: 0,
546
+ max: 40
547
+ },
548
+ frost: {
549
+ min: 0,
550
+ max: 100
551
+ },
552
+ zone: {
553
+ min: 20,
554
+ max: 100
555
+ },
556
+ bgBrightness: {
557
+ min: 0,
558
+ max: 100
559
+ },
560
+ fontScale: {
561
+ min: 85,
562
+ max: 120
563
+ },
564
+ hue: {
565
+ min: 0,
566
+ max: 360
567
+ },
568
+ sat: {
569
+ min: 0,
570
+ max: 100
571
+ },
572
+ light: {
573
+ min: 0,
574
+ max: 100
575
+ },
576
+ accentOpacity: {
577
+ min: 0,
578
+ max: 100
579
+ },
580
+ motion: {
581
+ min: 0,
582
+ max: 100
583
+ },
584
+ wallpaperInterval: {
585
+ min: 0,
586
+ max: 120
587
+ },
588
+ wallpaperBlur: {
589
+ min: 0,
590
+ max: 100
591
+ },
592
+ wallpaperFrost: {
593
+ min: 0,
594
+ max: 100
595
+ }
596
+ });
597
+ /** Normalize one wallpaper slot (legacy documents carry a single URL string;
598
+ * retired `idb:` video markers are dropped). */
599
+ function wallpaperList(value) {
600
+ if (typeof value === "string") return value === "" ? [] : [value];
601
+ if (Array.isArray(value)) return value.filter((item) => typeof item === "string" && !item.startsWith("idb:"));
602
+ return [];
603
+ }
604
+ /** Normalize one luminance slot (mirrors the wallpaper list length). */
605
+ function dimList(value, fallbackCount) {
606
+ if (typeof value === "number") return [value];
607
+ const out = (Array.isArray(value) ? value.filter((item) => typeof item === "number") : []).slice(0, fallbackCount);
608
+ while (out.length < fallbackCount) out.push(.5);
609
+ return out;
610
+ }
611
+ /**
612
+ * Normalize one carousel-membership slot (mirrors the wallpaper list length).
613
+ * Documents written before carousel selection existed carry no slot at all:
614
+ * every stored image then defaults to included, which preserves the retired
615
+ * "rotate the whole group" behaviour until the user excludes something.
616
+ */
617
+ function cycleList(value, count) {
618
+ const list = Array.isArray(value) ? value : [];
619
+ const out = [];
620
+ for (let index = 0; index < count; index += 1) out.push(list[index] !== false);
621
+ return out;
622
+ }
623
+ /**
624
+ * Indices that take part in the carousel, in list order.
625
+ * A flag that is missing (array shorter than the wallpaper list) counts as
626
+ * included, so appending an image never silently drops it from the rotation.
627
+ * @param count - number of wallpapers in the scheme's list.
628
+ * @param flags - stored carousel membership flags.
629
+ * @returns the participating indices (empty when the user excluded every image).
630
+ */
631
+ function carouselIndices(count, flags) {
632
+ const out = [];
633
+ for (let index = 0; index < count; index += 1) if (flags?.[index] !== false) out.push(index);
634
+ return out;
635
+ }
636
+ /** Numeric field reader with a default. */
637
+ function numberField(value, fallback) {
638
+ return typeof value === "number" ? value : fallback;
639
+ }
640
+ /** Read the portable custom-theme library defensively. Values are normalized
641
+ * again at application time, so a damaged localStorage entry cannot leak
642
+ * malformed CSS into the layer. */
643
+ function customThemesField(value) {
644
+ if (!Array.isArray(value)) return [];
645
+ return value.filter((item) => {
646
+ if (typeof item !== "object" || item === null) return false;
647
+ const candidate = item;
648
+ return typeof candidate.id === "string" && /^[a-z0-9-]{1,64}$/.test(candidate.id) && typeof candidate.name === "string" && candidate.name.trim() !== "" && typeof candidate.values === "object" && candidate.values !== null;
649
+ }).slice(0, 24).map((item) => ({
650
+ ...item,
651
+ name: item.name.trim().slice(0, 40)
652
+ }));
653
+ }
654
+ /** Zone reader: merges stored zones over the neutral defaults. */
655
+ function zonesField(value) {
656
+ const stored = typeof value === "object" && value !== null ? value : {};
657
+ return {
658
+ base: numberField(stored.base, DEFAULT_ZONES.base),
659
+ sidebar: numberField(stored.sidebar, DEFAULT_ZONES.sidebar),
660
+ card: numberField(stored.card, DEFAULT_ZONES.card),
661
+ input: numberField(stored.input, DEFAULT_ZONES.input),
662
+ overlay: numberField(stored.overlay, DEFAULT_ZONES.overlay),
663
+ bubble: numberField(stored.bubble, DEFAULT_ZONES.bubble)
664
+ };
665
+ }
666
+ /**
667
+ * Read the persisted document, folding defaults over partial storage and
668
+ * migrating legacy shapes (single-wallpaper strings, retired zone bundles,
669
+ * the retired 'apple' material id, single ink hue/saturation pairs).
670
+ * @returns the merged settings document.
671
+ */
672
+ function readSettings() {
673
+ try {
674
+ const raw = localStorage.getItem(PRISM_SETTINGS_KEY);
675
+ if (raw === null) return {
676
+ ...SETTINGS_DEFAULTS,
677
+ zones: { ...DEFAULT_ZONES }
678
+ };
679
+ const parsed = JSON.parse(raw);
680
+ const material = parsed.material === "clear" || parsed.material === "velvet" || parsed.material === "frosted" ? parsed.material : SETTINGS_DEFAULTS.material;
681
+ const wallpaperDark = wallpaperList(parsed.wallpaperDark);
682
+ const wallpaperLight = wallpaperList(parsed.wallpaperLight);
683
+ return {
684
+ enabled: typeof parsed.enabled === "boolean" ? parsed.enabled : SETTINGS_DEFAULTS.enabled,
685
+ material,
686
+ blur: numberField(parsed.blur, SETTINGS_DEFAULTS.blur),
687
+ frost: numberField(parsed.frost, SETTINGS_DEFAULTS.frost),
688
+ zones: zonesField(parsed.zones),
689
+ bgBrightness: numberField(parsed.bgBrightness, SETTINGS_DEFAULTS.bgBrightness),
690
+ fontScale: numberField(parsed.fontScale, SETTINGS_DEFAULTS.fontScale),
691
+ fontChoice: parsed.fontChoice === "rounded" || parsed.fontChoice === "serif" || parsed.fontChoice === "mono" || parsed.fontChoice === "custom" ? parsed.fontChoice : "system",
692
+ customFont: typeof parsed.customFont === "string" ? parsed.customFont : "",
693
+ inkLightHue: numberField(parsed.inkLightHue ?? parsed.inkHue, SETTINGS_DEFAULTS.inkLightHue),
694
+ inkLightSat: numberField(parsed.inkLightSat ?? parsed.inkSat, SETTINGS_DEFAULTS.inkLightSat),
695
+ inkLightLight: numberField(parsed.inkLightLight, SETTINGS_DEFAULTS.inkLightLight),
696
+ inkDarkHue: numberField(parsed.inkDarkHue ?? parsed.inkHue, SETTINGS_DEFAULTS.inkDarkHue),
697
+ inkDarkSat: numberField(parsed.inkDarkSat ?? parsed.inkSat, SETTINGS_DEFAULTS.inkDarkSat),
698
+ inkDarkLight: numberField(parsed.inkDarkLight, SETTINGS_DEFAULTS.inkDarkLight),
699
+ accentHue: numberField(parsed.accentHue, SETTINGS_DEFAULTS.accentHue),
700
+ accentSat: numberField(parsed.accentSat, SETTINGS_DEFAULTS.accentSat),
701
+ accentLight: numberField(parsed.accentLight, SETTINGS_DEFAULTS.accentLight),
702
+ accentOpacity: numberField(parsed.accentOpacity, SETTINGS_DEFAULTS.accentOpacity),
703
+ bgHue: numberField(parsed.bgHue, SETTINGS_DEFAULTS.bgHue),
704
+ bgSat: numberField(parsed.bgSat, SETTINGS_DEFAULTS.bgSat),
705
+ bgLight: numberField(parsed.bgLight, SETTINGS_DEFAULTS.bgLight),
706
+ motion: numberField(parsed.motion, SETTINGS_DEFAULTS.motion),
707
+ background: parsed.background === "wallpaper" ? "wallpaper" : "aurora",
708
+ wallpaperDark,
709
+ wallpaperLight,
710
+ wallpaperDimDark: dimList(parsed.wallpaperDimDark, wallpaperDark.length),
711
+ wallpaperDimLight: dimList(parsed.wallpaperDimLight, wallpaperLight.length),
712
+ wallpaperCycleDark: cycleList(parsed.wallpaperCycleDark, wallpaperDark.length),
713
+ wallpaperCycleLight: cycleList(parsed.wallpaperCycleLight, wallpaperLight.length),
714
+ wallpaperInterval: numberField(parsed.wallpaperInterval, SETTINGS_DEFAULTS.wallpaperInterval),
715
+ wallpaperLoop: parsed.wallpaperLoop === true,
716
+ wallpaperPinnedDark: numberField(parsed.wallpaperPinnedDark, 0),
717
+ wallpaperPinnedLight: numberField(parsed.wallpaperPinnedLight, 0),
718
+ wallpaperBlur: numberField(parsed.wallpaperBlur, SETTINGS_DEFAULTS.wallpaperBlur),
719
+ wallpaperFrost: numberField(parsed.wallpaperFrost, SETTINGS_DEFAULTS.wallpaperFrost),
720
+ customThemes: customThemesField(parsed.customThemes)
721
+ };
722
+ } catch {
723
+ return {
724
+ ...SETTINGS_DEFAULTS,
725
+ zones: { ...DEFAULT_ZONES }
726
+ };
727
+ }
728
+ }
729
+ /** Persist the document.
730
+ * @returns false when serialization or localStorage (including quota) fails.
731
+ */
732
+ function writeSettings(settings) {
733
+ try {
734
+ localStorage.setItem(PRISM_SETTINGS_KEY, JSON.stringify(settings));
735
+ return true;
736
+ } catch {
737
+ return false;
738
+ }
739
+ }
740
+ // src/client/theme-io.ts
741
+ /**
742
+ * Portable DSH Background theme documents. A theme contains appearance values only:
743
+ * wallpaper bytes, rotation state, the master switch, and the custom-theme
744
+ * library itself never cross the file boundary. Every imported number is
745
+ * finite-checked and clamped before it reaches the token layer.
746
+ */
747
+ /** Current interchange format identifier. */
748
+ const PRISM_THEME_FORMAT = "dsh-prism-theme";
749
+ /** Copy the portable appearance subset out of a complete settings object. */
750
+ function themeSnapshot(settings) {
751
+ return {
752
+ material: settings.material,
753
+ blur: settings.blur,
754
+ frost: settings.frost,
755
+ zones: { ...settings.zones },
756
+ bgBrightness: settings.bgBrightness,
757
+ fontScale: settings.fontScale,
758
+ fontChoice: settings.fontChoice,
759
+ customFont: settings.customFont,
760
+ inkLightHue: settings.inkLightHue,
761
+ inkLightSat: settings.inkLightSat,
762
+ inkLightLight: settings.inkLightLight,
763
+ inkDarkHue: settings.inkDarkHue,
764
+ inkDarkSat: settings.inkDarkSat,
765
+ inkDarkLight: settings.inkDarkLight,
766
+ accentHue: settings.accentHue,
767
+ accentSat: settings.accentSat,
768
+ accentLight: settings.accentLight,
769
+ accentOpacity: settings.accentOpacity,
770
+ bgHue: settings.bgHue,
771
+ bgSat: settings.bgSat,
772
+ bgLight: settings.bgLight,
773
+ motion: settings.motion
774
+ };
775
+ }
776
+ const NUMERIC_RANGES = {
777
+ blur: RANGES.blur,
778
+ frost: RANGES.frost,
779
+ bgBrightness: RANGES.bgBrightness,
780
+ fontScale: RANGES.fontScale,
781
+ inkLightHue: RANGES.hue,
782
+ inkLightSat: RANGES.sat,
783
+ inkLightLight: RANGES.light,
784
+ inkDarkHue: RANGES.hue,
785
+ inkDarkSat: RANGES.sat,
786
+ inkDarkLight: RANGES.light,
787
+ accentHue: RANGES.hue,
788
+ accentSat: RANGES.sat,
789
+ accentLight: RANGES.light,
790
+ accentOpacity: RANGES.accentOpacity,
791
+ bgHue: RANGES.hue,
792
+ bgSat: RANGES.sat,
793
+ bgLight: RANGES.light,
794
+ motion: RANGES.motion
795
+ };
796
+ /** Normalize untrusted portable values over the shipped defaults. */
797
+ function normalizeThemeValues(input) {
798
+ const source = typeof input === "object" && input !== null ? input : {};
799
+ const defaults = themeSnapshot(SETTINGS_DEFAULTS);
800
+ const output = {
801
+ ...defaults,
802
+ zones: { ...defaults.zones }
803
+ };
804
+ for (const [key, range] of Object.entries(NUMERIC_RANGES)) {
805
+ const value = source[key];
806
+ if (typeof value === "number" && Number.isFinite(value)) output[key] = Math.min(range.max, Math.max(range.min, value));
807
+ }
808
+ if (source.material === "clear" || source.material === "frosted" || source.material === "velvet") output.material = source.material;
809
+ if (source.fontChoice === "system" || source.fontChoice === "rounded" || source.fontChoice === "serif" || source.fontChoice === "mono" || source.fontChoice === "custom") output.fontChoice = source.fontChoice;
810
+ if (typeof source.customFont === "string") output.customFont = source.customFont.slice(0, 200);
811
+ const zones = typeof source.zones === "object" && source.zones !== null ? source.zones : {};
812
+ const normalizedZones = { ...defaults.zones };
813
+ for (const zone of [
814
+ "base",
815
+ "sidebar",
816
+ "card",
817
+ "input",
818
+ "overlay",
819
+ "bubble"
820
+ ]) {
821
+ const value = zones[zone];
822
+ if (typeof value === "number" && Number.isFinite(value)) normalizedZones[zone] = Math.min(RANGES.zone.max, Math.max(RANGES.zone.min, value));
823
+ }
824
+ output.zones = normalizedZones;
825
+ return output;
826
+ }
827
+ /** Serialize a named snapshot with stable formatting. */
828
+ function serializeTheme(settings, name = "DSH Background theme") {
829
+ const document = {
830
+ format: PRISM_THEME_FORMAT,
831
+ version: 1,
832
+ name: name.trim().slice(0, 40) || "DSH Background theme",
833
+ values: themeSnapshot(settings)
834
+ };
835
+ return JSON.stringify(document, null, 2);
836
+ }
837
+ /** Parse and normalize an imported JSON document.
838
+ * @throws Error with a stable code for localized UI feedback.
839
+ */
840
+ function parseThemeDocument(raw) {
841
+ if (new TextEncoder().encode(raw).byteLength > 262144) throw new Error("size");
842
+ let parsed;
843
+ try {
844
+ parsed = JSON.parse(raw);
845
+ } catch {
846
+ throw new Error("json");
847
+ }
848
+ if (typeof parsed !== "object" || parsed === null) throw new Error("schema");
849
+ const candidate = parsed;
850
+ if (candidate.format !== "dsh-prism-theme" || candidate.version !== 1) throw new Error("version");
851
+ if (typeof candidate.name !== "string" || candidate.name.trim() === "") throw new Error("schema");
852
+ if (typeof candidate.values !== "object" || candidate.values === null) throw new Error("schema");
853
+ return {
854
+ format: PRISM_THEME_FORMAT,
855
+ version: 1,
856
+ name: candidate.name.trim().slice(0, 40),
857
+ values: normalizeThemeValues(candidate.values)
858
+ };
859
+ }
860
+ /** Create a sanitized library entry; the caller owns persistence. */
861
+ function makeCustomTheme(settings, name, id) {
862
+ return {
863
+ id: id.slice(0, 64),
864
+ name: name.trim().slice(0, 40),
865
+ values: themeSnapshot(settings)
866
+ };
867
+ }
868
+ /** Longest edge a static wallpaper is downscaled to, px. */
869
+ const MAX_STATIC_EDGE = 1920;
870
+ /** JPEG quality for downscaled static wallpapers. */
871
+ const WALLPAPER_JPEG_QUALITY = .85;
872
+ /** Luminance returned when the analysis environment cannot draw pixels. */
873
+ const UNKNOWN_LUMINANCE = .5;
874
+ /**
875
+ * Whether the file is an animated GIF (every GIF is treated as animated:
876
+ * the format cannot be reliably detected without a full decode, and
877
+ * downscaling a GIF through a canvas would flatten its animation).
878
+ * @param file - the picked file.
879
+ * @returns true for image/gif inputs.
880
+ */
881
+ function isAnimatedGif(file) {
882
+ return file.type === "image/gif";
883
+ }
884
+ /**
885
+ * Read a wallpaper file into a compact data URL.
886
+ * Static images are downscaled to {@link MAX_STATIC_EDGE} and re-encoded as
887
+ * JPEG; GIFs return their original data URL byte-for-byte.
888
+ * @param file - the picked file.
889
+ * @returns the data URL, or a typed rejection.
890
+ */
891
+ async function readWallpaper(file) {
892
+ if (file.size > 31457280) return {
893
+ kind: "size",
894
+ bytes: file.size
895
+ };
896
+ const raw = await new Promise((resolve, reject) => {
897
+ const reader = new FileReader();
898
+ reader.onload = () => {
899
+ const result = reader.result;
900
+ resolve(typeof result === "string" ? result : "");
901
+ };
902
+ reader.onerror = () => {
903
+ reject(new Error(reader.error?.message ?? "FileReader failed to read the wallpaper file", { cause: reader.error }));
904
+ };
905
+ reader.readAsDataURL(file);
906
+ }).catch(() => null);
907
+ if (raw === null) return { kind: "read" };
908
+ if (isAnimatedGif(file)) return raw;
909
+ const image = await decodeImage(raw);
910
+ if (image === null) return { kind: "decode" };
911
+ return downscaleToJpeg(image, raw);
912
+ }
913
+ /**
914
+ * Load a data URL into an Image (resolves null when decoding fails).
915
+ * @param url - image data URL.
916
+ * @returns the decoded image or null.
917
+ */
918
+ function decodeImage(url) {
919
+ return new Promise((resolve) => {
920
+ const image = new Image();
921
+ image.onload = () => {
922
+ resolve(image);
923
+ };
924
+ image.onerror = () => {
925
+ resolve(null);
926
+ };
927
+ image.src = url;
928
+ });
929
+ }
930
+ /**
931
+ * Downscale an image to {@link MAX_STATIC_EDGE} and re-encode as JPEG.
932
+ * Falls back to the original when no 2d context exists (test environments).
933
+ * @param image - decoded source image.
934
+ * @param original - original data URL, returned when drawing is unavailable.
935
+ * @returns a compact JPEG data URL (or the original).
936
+ */
937
+ function downscaleToJpeg(image, original) {
938
+ const scale = Math.min(1, MAX_STATIC_EDGE / Math.max(image.width, image.height));
939
+ if (scale >= 1) return original;
940
+ const width = Math.max(1, Math.round(image.width * scale));
941
+ const height = Math.max(1, Math.round(image.height * scale));
942
+ const canvas = document.createElement("canvas");
943
+ canvas.width = width;
944
+ canvas.height = height;
945
+ const context = canvas.getContext("2d");
946
+ if (context === null) return original;
947
+ context.drawImage(image, 0, 0, width, height);
948
+ return canvas.toDataURL("image/jpeg", WALLPAPER_JPEG_QUALITY);
949
+ }
950
+ /**
951
+ * Average pixel luminance (0-1) of an image, sampled on a tiny grid.
952
+ * @param dataUrl - image data URL (a GIF's first frame is decoded).
953
+ * @returns 0-1 average luminance, or {@link UNKNOWN_LUMINANCE} when the
954
+ * environment cannot draw (jsdom, blocked canvases).
955
+ */
956
+ async function analyzeLuminance(dataUrl) {
957
+ const image = await decodeImage(dataUrl);
958
+ if (image === null) return UNKNOWN_LUMINANCE;
959
+ const canvas = document.createElement("canvas");
960
+ canvas.width = 8;
961
+ canvas.height = 8;
962
+ const context = canvas.getContext("2d");
963
+ if (context === null) return UNKNOWN_LUMINANCE;
964
+ try {
965
+ context.drawImage(image, 0, 0, 8, 8);
966
+ const data = context.getImageData(0, 0, 8, 8).data;
967
+ let sum = 0;
968
+ let count = 0;
969
+ for (let i = 0; i < data.length; i += 4) {
970
+ const r = (data[i] ?? 0) / 255;
971
+ const g = (data[i + 1] ?? 0) / 255;
972
+ const b = (data[i + 2] ?? 0) / 255;
973
+ sum += .2126 * r + .7152 * g + .0722 * b;
974
+ count += 1;
975
+ }
976
+ return count === 0 ? UNKNOWN_LUMINANCE : sum / count;
977
+ } catch {
978
+ return UNKNOWN_LUMINANCE;
979
+ }
980
+ }
981
+ /**
982
+ * Auto dim veil for a wallpaper: dark mode darkens bright wallpapers, light
983
+ * mode brightens dark ones, so chat text always keeps contrast.
984
+ * @param luminance - average wallpaper luminance, 0-1.
985
+ * @param dark - resolved scheme is dark.
986
+ * @returns veil alpha, 0-0.75.
987
+ */
988
+ function veilAlpha(luminance, dark) {
989
+ if (dark) return Math.min(.75, Math.max(0, luminance - .32) * .85);
990
+ return Math.min(.75, Math.max(0, .68 - luminance) * .85);
991
+ }
992
+ /** Longest edge the poster frame is captured at, px. */
993
+ const MAX_POSTER_EDGE = 1280;
994
+ /** Prefix that turns a stored clip id into the string kept in settings. */
995
+ const VIDEO_PREFIX = "video:";
996
+ /** Whether the picked file is a video the layer can play. */
997
+ function isVideoFile(file) {
998
+ return file.type.startsWith("video/");
999
+ }
1000
+ /** Whether a settings entry points at a clip instead of an inline image. */
1001
+ function isVideoRef(source) {
1002
+ return source.startsWith("video:") && source.length > 6;
1003
+ }
1004
+ /** The clip id inside a `video:<id>` reference (empty when not a reference). */
1005
+ function videoIdOf(source) {
1006
+ return isVideoRef(source) ? source.slice(6) : "";
1007
+ }
1008
+ /** Build the settings entry for a stored clip. */
1009
+ function videoRef(id) {
1010
+ return `${VIDEO_PREFIX}${id}`;
1011
+ }
1012
+ /**
1013
+ * Load a video file's metadata by pointing an off-DOM element at it.
1014
+ * @param url - object URL for the file.
1015
+ * @returns the element, or null when metadata never arrives.
1016
+ */
1017
+ function loadVideo(url) {
1018
+ return new Promise((resolve) => {
1019
+ const video = document.createElement("video");
1020
+ video.preload = "metadata";
1021
+ video.muted = true;
1022
+ video.playsInline = true;
1023
+ const settle = (value) => {
1024
+ video.onloadedmetadata = null;
1025
+ video.onerror = null;
1026
+ resolve(value);
1027
+ };
1028
+ video.onloadedmetadata = () => {
1029
+ settle(video);
1030
+ };
1031
+ video.onerror = () => {
1032
+ settle(null);
1033
+ };
1034
+ video.src = url;
1035
+ window.setTimeout(() => {
1036
+ settle(null);
1037
+ }, 8e3);
1038
+ });
1039
+ }
1040
+ /**
1041
+ * Draw one frame of a video onto a canvas and read it back.
1042
+ * @param video - element already positioned on the frame.
1043
+ * @returns poster blob (may be null) and the frame's average luminance.
1044
+ */
1045
+ function captureFrame(video) {
1046
+ const width = video.videoWidth || 0;
1047
+ const height = video.videoHeight || 0;
1048
+ if (width === 0 || height === 0) return {
1049
+ poster: null,
1050
+ luminance: UNKNOWN_LUMINANCE
1051
+ };
1052
+ const scale = Math.min(1, MAX_POSTER_EDGE / Math.max(width, height));
1053
+ const canvas = document.createElement("canvas");
1054
+ canvas.width = Math.max(1, Math.round(width * scale));
1055
+ canvas.height = Math.max(1, Math.round(height * scale));
1056
+ const context = canvas.getContext("2d");
1057
+ if (context === null) return {
1058
+ poster: null,
1059
+ luminance: UNKNOWN_LUMINANCE
1060
+ };
1061
+ try {
1062
+ context.drawImage(video, 0, 0, canvas.width, canvas.height);
1063
+ } catch {
1064
+ return {
1065
+ poster: null,
1066
+ luminance: UNKNOWN_LUMINANCE
1067
+ };
1068
+ }
1069
+ let luminance = UNKNOWN_LUMINANCE;
1070
+ try {
1071
+ const sample = document.createElement("canvas");
1072
+ sample.width = 8;
1073
+ sample.height = 8;
1074
+ const sampleContext = sample.getContext("2d");
1075
+ if (sampleContext !== null) {
1076
+ sampleContext.drawImage(canvas, 0, 0, 8, 8);
1077
+ const data = sampleContext.getImageData(0, 0, 8, 8).data;
1078
+ let sum = 0;
1079
+ let count = 0;
1080
+ for (let i = 0; i < data.length; i += 4) {
1081
+ sum += .2126 * ((data[i] ?? 0) / 255) + .7152 * ((data[i + 1] ?? 0) / 255) + .0722 * ((data[i + 2] ?? 0) / 255);
1082
+ count += 1;
1083
+ }
1084
+ if (count > 0) luminance = sum / count;
1085
+ }
1086
+ } catch {
1087
+ luminance = UNKNOWN_LUMINANCE;
1088
+ }
1089
+ let poster = null;
1090
+ try {
1091
+ poster = dataUrlToBlob(canvas.toDataURL("image/jpeg", WALLPAPER_JPEG_QUALITY));
1092
+ } catch {
1093
+ poster = null;
1094
+ }
1095
+ return {
1096
+ poster,
1097
+ luminance
1098
+ };
1099
+ }
1100
+ /** Convert a data URL into a Blob without another async hop. */
1101
+ function dataUrlToBlob(dataUrl) {
1102
+ const comma = dataUrl.indexOf(",");
1103
+ if (comma < 0) return null;
1104
+ const header = dataUrl.slice(0, comma);
1105
+ const body = dataUrl.slice(comma + 1);
1106
+ const mime = /^data:([^;]+)/.exec(header)?.[1] ?? "image/jpeg";
1107
+ if (!header.includes(";base64")) return new Blob([decodeURIComponent(body)], { type: mime });
1108
+ try {
1109
+ const binary = atob(body);
1110
+ const bytes = new Uint8Array(binary.length);
1111
+ for (let i = 0; i < binary.length; i += 1) bytes[i] = binary.charCodeAt(i);
1112
+ return new Blob([bytes], { type: mime });
1113
+ } catch {
1114
+ return null;
1115
+ }
1116
+ }
1117
+ /**
1118
+ * Read, validate, and describe a video wallpaper without storing it.
1119
+ *
1120
+ * The caller persists the blob and poster through the video store; this
1121
+ * function only measures the clip, captures a poster frame, and derives the
1122
+ * luminance the backdrop veil needs.
1123
+ * @param file - picked video file.
1124
+ * @param id - id the caller will store the clip under.
1125
+ * @returns the ingestion result, or a typed rejection.
1126
+ */
1127
+ async function readVideo(file, id) {
1128
+ if (file.size > 41943040) return {
1129
+ kind: "size",
1130
+ bytes: file.size
1131
+ };
1132
+ if (file.size === 0) return { kind: "read" };
1133
+ const url = URL.createObjectURL(file);
1134
+ try {
1135
+ const video = await loadVideo(url);
1136
+ if (video === null) return { kind: "decode" };
1137
+ const duration = Number.isFinite(video.duration) ? video.duration : 0;
1138
+ if (duration > 60) return {
1139
+ kind: "size",
1140
+ bytes: file.size
1141
+ };
1142
+ const target = duration > 0 ? Math.min(.15, duration / 3) : 0;
1143
+ await new Promise((resolve) => {
1144
+ const done = () => {
1145
+ video.onseeked = null;
1146
+ resolve();
1147
+ };
1148
+ video.onseeked = done;
1149
+ try {
1150
+ video.currentTime = target;
1151
+ } catch {
1152
+ done();
1153
+ return;
1154
+ }
1155
+ window.setTimeout(done, 2e3);
1156
+ });
1157
+ const { poster, luminance } = captureFrame(video);
1158
+ return {
1159
+ ref: videoRef(id),
1160
+ luminance,
1161
+ poster,
1162
+ duration,
1163
+ width: video.videoWidth || 0,
1164
+ height: video.videoHeight || 0
1165
+ };
1166
+ } finally {
1167
+ URL.revokeObjectURL(url);
1168
+ }
1169
+ }
1170
+ // src/client/video-store.ts
1171
+ /**
1172
+ * IndexedDB home for video wallpapers.
1173
+ *
1174
+ * The settings document lives in `localStorage` and is rewritten as one JSON
1175
+ * blob on every change, so a multi-megabyte MP4 cannot live there: the quota is
1176
+ * 5-10MB and a failed write rolls the whole document back. Video clips therefore
1177
+ * go to IndexedDB as Blobs, and the settings document only carries the
1178
+ * `video:<id>` reference. Both stores share the renderer origin, so they travel
1179
+ * together when the app's user-data directory moves.
1180
+ */
1181
+ /** Name of the IndexedDB database owned by the plugin. */
1182
+ const MEDIA_DB_NAME = "dsh-prism-media";
1183
+ /** Object store holding one record per video wallpaper. */
1184
+ const MEDIA_STORE = "videos";
1185
+ /** Whether IndexedDB is reachable in this environment. */
1186
+ function available() {
1187
+ return typeof indexedDB !== "undefined" && indexedDB !== null;
1188
+ }
1189
+ /** Open (once per call) the media database. */
1190
+ function openDatabase() {
1191
+ return new Promise((resolve, reject) => {
1192
+ const request = indexedDB.open(MEDIA_DB_NAME, 1);
1193
+ request.onupgradeneeded = () => {
1194
+ const db = request.result;
1195
+ if (!db.objectStoreNames.contains("videos")) db.createObjectStore(MEDIA_STORE, { keyPath: "id" });
1196
+ };
1197
+ request.onsuccess = () => {
1198
+ resolve(request.result);
1199
+ };
1200
+ request.onerror = () => {
1201
+ reject(request.error ?? /* @__PURE__ */ new Error("indexedDB open failed"));
1202
+ };
1203
+ request.onblocked = () => {
1204
+ reject(/* @__PURE__ */ new Error("indexedDB open blocked"));
1205
+ };
1206
+ });
1207
+ }
1208
+ /** Run one transaction against the media store. */
1209
+ async function withStore(mode, run) {
1210
+ if (!available()) throw new Error("indexedDB unavailable");
1211
+ const db = await openDatabase();
1212
+ try {
1213
+ return await new Promise((resolve, reject) => {
1214
+ const tx = db.transaction(MEDIA_STORE, mode);
1215
+ const store = tx.objectStore(MEDIA_STORE);
1216
+ let result;
1217
+ const request = run(store);
1218
+ if (request !== void 0) request.onsuccess = () => {
1219
+ result = request.result;
1220
+ };
1221
+ tx.oncomplete = () => {
1222
+ resolve(result);
1223
+ };
1224
+ tx.onerror = () => {
1225
+ reject(tx.error ?? /* @__PURE__ */ new Error("indexedDB transaction failed"));
1226
+ };
1227
+ tx.onabort = () => {
1228
+ reject(tx.error ?? /* @__PURE__ */ new Error("indexedDB transaction aborted"));
1229
+ };
1230
+ });
1231
+ } finally {
1232
+ db.close();
1233
+ }
1234
+ }
1235
+ /** Persist one clip, replacing any record with the same id. */
1236
+ async function putVideo(record) {
1237
+ await withStore("readwrite", (store) => {
1238
+ store.put(record);
1239
+ });
1240
+ }
1241
+ /** Read one clip by id. */
1242
+ async function getVideo(id) {
1243
+ return await withStore("readonly", (store) => store.get(id)) ?? null;
1244
+ }
1245
+ /** Delete one clip; missing ids are not an error. */
1246
+ async function deleteVideo(id) {
1247
+ await withStore("readwrite", (store) => {
1248
+ store.delete(id);
1249
+ });
1250
+ }
1251
+ // \0prism-css:src/client/PrismAppearancePanel.module.css.mjs
1252
+ const css$1 = ".YXbCuq_panel{box-sizing:border-box;border-bottom:.5px solid var(--dsw-alias-border-l2);flex-direction:column;gap:14px;width:100%;min-width:0;padding:18px 0 22px;display:flex;container:YXbCuq_prism-panel/inline-size}.YXbCuq_hero{border:1px solid var(--dsw-alias-border-l2);background-color:#10151f;background:radial-gradient(circle at 90% -20%, color-mix(in srgb, var(--dsw-alias-state-business-primary) 13%, transparent), transparent 58%), var(--dsw-alias-bg-base,#10151f);border-radius:16px;grid-template-columns:minmax(0,1fr) minmax(190px,.82fr);gap:18px;min-height:168px;padding:20px;display:grid;position:relative;overflow:hidden}.YXbCuq_heroCopy{z-index:1;flex-direction:column;justify-content:space-between;gap:20px;min-width:0;display:flex}.YXbCuq_brandRow{align-items:flex-start;gap:12px;min-width:0;display:flex}.YXbCuq_brandMark{border:1px solid color-mix(in srgb, var(--dsw-alias-state-business-primary) 28%, transparent);background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 8%, var(--dsw-alias-bg-layer-1));border-radius:10px;flex:none;width:34px;height:34px;display:block;position:relative;overflow:hidden}.YXbCuq_brandMark i{background:var(--dsw-alias-state-business-primary);width:1px;position:absolute;top:4px;bottom:4px;transform:rotate(30deg)}.YXbCuq_brandMark i:first-child{opacity:.45;left:10px}.YXbCuq_brandMark i:nth-child(2){opacity:.8;left:17px}.YXbCuq_brandMark i:nth-child(3){opacity:.3;left:24px}.YXbCuq_titleRow{align-items:center;gap:8px;display:flex}.YXbCuq_title{color:var(--dsw-alias-label-primary);letter-spacing:-.02em;margin:0;font-size:18px;font-weight:600;line-height:24px}.YXbCuq_version{border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-tertiary);border-radius:999px;padding:1px 6px;font-size:10px;font-weight:500;line-height:16px}.YXbCuq_subtitle{max-width:330px;color:var(--dsw-alias-label-tertiary);margin:4px 0 0;font-size:12px;line-height:18px}.YXbCuq_heroActions{justify-content:space-between;align-items:center;gap:8px;display:flex}.YXbCuq_preview{border:1px solid color-mix(in srgb, var(--prism-preview-accent) 24%, transparent);background:linear-gradient(140deg, color-mix(in srgb, var(--prism-preview-backdrop) 82%, #101827), var(--prism-preview-backdrop));isolation:isolate;border-radius:13px;align-self:center;min-width:0;min-height:126px;position:relative;overflow:hidden;box-shadow:0 12px 30px #0a142321}.YXbCuq_previewOrb{background:var(--prism-preview-accent);filter:blur(30px);opacity:.55;border-radius:50%;width:120px;height:120px;position:absolute;top:-48px;right:-20px}.YXbCuq_previewWindow{backdrop-filter:blur(12px);background:#f5f9ff99;border:1px solid #ffffff4d;border-radius:9px 9px 0 0;display:flex;position:absolute;inset:14px 12px -12px;overflow:hidden;box-shadow:0 5px 18px #0f19281f}.YXbCuq_preview[data-material=clear] .YXbCuq_previewWindow{backdrop-filter:blur(4px);background:#f5f9ff47}.YXbCuq_preview[data-material=velvet] .YXbCuq_previewWindow{backdrop-filter:blur(20px);background:#f5f9ffd1}.YXbCuq_previewSidebar{background:#ffffff2e;border-right:1px solid #ffffff4d;flex-direction:column;flex:none;gap:7px;width:30px;padding:12px 7px;display:flex}.YXbCuq_previewSidebar i{background:var(--prism-preview-ink);opacity:.24;border-radius:4px;width:16px;height:3px;display:block}.YXbCuq_previewSidebar i:first-child{background:var(--prism-preview-accent);opacity:.75;border-radius:5px;height:16px}.YXbCuq_previewMain{flex-direction:column;flex:1;gap:8px;min-width:0;padding:0 9px 9px;display:flex}.YXbCuq_previewTopbar{border-bottom:1px solid #ffffff42;flex:none;height:19px;margin:0 -9px}.YXbCuq_previewBubble{color:var(--prism-preview-ink);font-size:calc(7px * var(--prism-preview-scale));background:#ffffff59;border:1px solid #ffffff5c;border-radius:7px;flex-direction:column;gap:3px;padding:7px 8px;line-height:1.35;display:flex}.YXbCuq_previewBubble b{font-weight:600}.YXbCuq_previewBubble span{opacity:.68}.YXbCuq_previewComposer{color:var(--prism-preview-ink);background:#ffffff80;border:1px solid #ffffff73;border-radius:7px;justify-content:space-between;align-items:center;margin-top:auto;padding:6px 6px 6px 8px;font-size:6px;display:flex}.YXbCuq_previewComposer span{opacity:.45}.YXbCuq_previewComposer i{background:var(--prism-preview-accent);border-radius:4px;width:12px;height:12px}.YXbCuq_disabledState{border:1px dashed var(--dsw-alias-border-l3);color:var(--dsw-alias-label-tertiary);border-radius:12px;justify-content:space-between;align-items:center;gap:16px;padding:14px 16px;font-size:12px;line-height:18px;display:flex}.YXbCuq_tabs{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base);border-radius:11px;gap:4px;padding:3px;display:flex}.YXbCuq_tab,.YXbCuq_tabActive{cursor:pointer;border:0;border-radius:8px;flex:1;min-width:0;min-height:32px;padding:5px 10px;font-size:12px;font-weight:500;line-height:20px;transition:color .15s,background-color .15s,box-shadow .15s}.YXbCuq_tab{color:var(--dsw-alias-label-tertiary);background:0 0}.YXbCuq_tab:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.YXbCuq_tabActive{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1);box-shadow:0 1px 4px #1423371f, inset 0 0 0 1px var(--dsw-alias-border-l1)}.YXbCuq_tab:focus-visible,.YXbCuq_tabActive:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.YXbCuq_tabPanel{flex-direction:column;gap:14px;min-width:0;display:flex}.YXbCuq_section{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base);border-radius:13px;overflow:hidden}.YXbCuq_sectionHead{justify-content:space-between;align-items:flex-start;gap:12px;padding:15px 16px 0;display:flex}.YXbCuq_sectionTitle{color:var(--dsw-alias-label-primary);margin:0;font-size:13px;font-weight:600;line-height:20px}.YXbCuq_sectionDescription{color:var(--dsw-alias-label-tertiary);margin:3px 0 0;font-size:11px;line-height:17px}.YXbCuq_sectionBody{flex-direction:column;gap:14px;min-width:0;padding:14px 16px 16px;display:flex}.YXbCuq_sectionHead+.YXbCuq_sectionBody{padding-top:12px}.YXbCuq_controlsStack{flex-direction:column;gap:10px;min-width:0;display:flex}.YXbCuq_hint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:11px;line-height:17px}.YXbCuq_error,.YXbCuq_status{margin:0;font-size:11px;line-height:17px}.YXbCuq_error{color:var(--dsw-alias-state-error-primary)}.YXbCuq_status{color:var(--dsw-alias-state-success-primary,#32865a)}.YXbCuq_presetGrid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;display:grid}.YXbCuq_presetCard,.YXbCuq_presetCardActive{border:1px solid var(--dsw-alias-border-l1);min-width:0;min-height:60px;color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-1);cursor:pointer;text-align:left;font:inherit;border-radius:9px;align-items:center;gap:10px;padding:8px;transition:border-color .15s,background-color .15s,box-shadow .15s;display:flex}.YXbCuq_presetCard:hover,.YXbCuq_materialCard:hover{border-color:var(--dsw-alias-border-l3);background:var(--dsw-alias-interactive-bg-hover)}.YXbCuq_presetCard:focus-visible,.YXbCuq_presetCardActive:focus-visible,.YXbCuq_materialCard:focus-visible,.YXbCuq_materialCardActive:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.YXbCuq_presetCard:disabled,.YXbCuq_presetCardActive:disabled,.YXbCuq_materialCard:disabled,.YXbCuq_materialCardActive:disabled{opacity:.45;cursor:not-allowed}.YXbCuq_presetName{min-width:0;color:inherit;flex:1;font-size:12px;line-height:18px}.YXbCuq_presetCardActive .YXbCuq_presetName,.YXbCuq_materialCardActive .YXbCuq_materialLabel{font-weight:600}.YXbCuq_selectionMark{border:1px solid var(--dsw-alias-border-l3);color:#0000;border-radius:50%;flex:none;place-items:center;width:16px;height:16px;font-size:10px;line-height:1;display:grid}.YXbCuq_presetCardActive .YXbCuq_selectionMark,.YXbCuq_materialCardActive .YXbCuq_selectionMark{border-color:var(--dsw-alias-state-business-primary);color:#fff;background:var(--dsw-alias-state-business-primary)}.YXbCuq_surfaceTrace{background:var(--trace-backdrop);isolation:isolate;border-radius:5px;flex:none;width:64px;height:42px;display:block;position:relative;overflow:hidden;box-shadow:inset 0 0 0 1px #ffffff2e}.YXbCuq_surfaceTrace:before{content:\"\";background:repeating-linear-gradient(110deg, transparent 0 13px, var(--trace-accent) 13px 19px, transparent 19px 25px, #fffc 25px 27px, transparent 27px 37px);position:absolute;inset:-12px}.YXbCuq_surfaceTrace:after{content:\"\";pointer-events:none;border-top:1px solid #ffffff61;border-bottom:1px solid #0000001f;position:absolute;inset:0}.YXbCuq_surfaceTrace[data-material=clear]:before{opacity:.86}.YXbCuq_surfaceTrace[data-material=frosted]:before{opacity:.7;filter:blur(3px)}.YXbCuq_surfaceTrace[data-material=velvet]:before{opacity:.62;filter:blur(8px)}.YXbCuq_surfaceTrace[data-material=frosted] i,.YXbCuq_surfaceTrace[data-material=velvet] i{z-index:1;background:#ffffff21;position:absolute;inset:0}.YXbCuq_surfaceTrace[data-material=velvet] i{background:#181c2629}.YXbCuq_materialGrid{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;display:grid}.YXbCuq_materialCard,.YXbCuq_materialCardActive{border:1px solid var(--dsw-alias-border-l1);min-width:0;color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-1);cursor:pointer;text-align:left;font:inherit;border-radius:9px;flex-direction:column;gap:9px;padding:8px;transition:border-color .15s,background-color .15s,box-shadow .15s;display:flex}.YXbCuq_presetCardActive,.YXbCuq_materialCardActive{border-color:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover-accent);box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--dsw-alias-state-business-primary) 22%, transparent)}.YXbCuq_presetCardActive:hover,.YXbCuq_materialCardActive:hover{box-shadow:inset 0 0 0 1px var(--dsw-alias-state-business-primary)}.YXbCuq_materialCard .YXbCuq_surfaceTrace,.YXbCuq_materialCardActive .YXbCuq_surfaceTrace{width:100%;height:48px}.YXbCuq_materialLabel{justify-content:space-between;align-items:center;gap:4px;min-width:0;font-size:12px;line-height:18px;display:flex}.YXbCuq_textInput{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);width:100%;min-width:0;height:34px;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1);font:inherit;border-radius:8px;outline:none;padding:5px 10px;font-size:12px;line-height:20px}.YXbCuq_textInput::placeholder{color:var(--dsw-alias-label-tertiary)}.YXbCuq_textInput:hover{border-color:var(--dsw-alias-border-l3)}.YXbCuq_textInput:focus{border-color:var(--dsw-alias-state-business-primary);box-shadow:0 0 0 2px var(--dsw-alias-interactive-bg-hover-accent)}.YXbCuq_saveThemeForm{grid-template-columns:minmax(0,1fr) auto;gap:8px;display:grid}.YXbCuq_importExportRow{flex-wrap:wrap;gap:8px;display:flex}.YXbCuq_emptyThemes{border:1px dashed var(--dsw-alias-border-l2);color:var(--dsw-alias-label-tertiary);text-align:center;border-radius:9px;margin:0;padding:12px;font-size:11px;line-height:17px}.YXbCuq_customThemeList{flex-direction:column;gap:5px;display:flex}.YXbCuq_customThemeRow{border-radius:9px;align-items:center;gap:10px;min-width:0;padding:6px;display:flex}.YXbCuq_customThemeRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.YXbCuq_customSwatch{border:1px solid #788ca040;border-radius:8px;flex:none;width:34px;height:34px;display:block;position:relative;overflow:hidden}.YXbCuq_customSwatch i{backdrop-filter:blur(3px);background:#ffffff47;border:1px solid #ffffff80;border-radius:3px;position:absolute;inset:7px}.YXbCuq_customThemeName{min-width:0;color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;flex:1;font-size:12px;line-height:18px;overflow:hidden}.YXbCuq_customThemeActions{flex:none;gap:2px;display:flex}.YXbCuq_wallpaperList{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:10px;flex-direction:column;gap:9px;min-width:0;padding:10px;display:flex}.YXbCuq_wallpaperHeader{justify-content:space-between;align-items:center;gap:8px;display:flex}.YXbCuq_wallpaperScheme{min-width:0;color:var(--dsw-alias-label-secondary);font-size:12px;font-weight:500;line-height:18px}.YXbCuq_wallpaperItems{-webkit-user-select:none;user-select:none;grid-template-columns:repeat(auto-fill,minmax(86px,1fr));gap:8px;display:grid}.YXbCuq_wallpaperTile{border-radius:9px;min-width:0;max-width:220px;transition:opacity .14s,transform .14s;position:relative}.YXbCuq_wallpaperTileOn{cursor:grab}.YXbCuq_wallpaperTileOn:active{cursor:grabbing}.YXbCuq_wallpaperTileDragging{opacity:.55;transform:scale(.96)}.YXbCuq_wallpaperTileDragging .YXbCuq_wallpaperThumbButton{outline:2px dashed var(--dsw-alias-state-business-primary);outline-offset:1px}.YXbCuq_wallpaperThumbButton,.YXbCuq_wallpaperThumbActive{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);cursor:pointer;border-radius:9px;width:100%;padding:0;display:block;position:relative;overflow:hidden}.YXbCuq_wallpaperThumbActive{border-color:var(--dsw-alias-state-business-primary);outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}.YXbCuq_wallpaperThumbButton:focus-visible,.YXbCuq_wallpaperThumbActive:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.YXbCuq_wallpaperThumb{aspect-ratio:16/10;object-fit:cover;width:100%;max-height:140px;transition:filter .18s,transform .18s;display:block}.YXbCuq_wallpaperTileOff .YXbCuq_wallpaperThumb{filter:blur(3px)saturate(.55)brightness(.86);transform:scale(1.05)}.YXbCuq_wallpaperFrost{opacity:0;background:color-mix(in srgb, var(--dsw-alias-bg-base) 26%, transparent);backdrop-filter:blur(7px);transition:opacity .18s;display:block;position:absolute;inset:0}.YXbCuq_wallpaperTileOff .YXbCuq_wallpaperFrost{opacity:1}.YXbCuq_wallpaperGrip{z-index:2;color:#fff;cursor:grab;width:20px;height:20px;font:inherit;opacity:0;touch-action:none;background:#0f141e80;border:1px solid #ffffff3d;border-radius:6px;place-items:center;padding:0;font-size:11px;line-height:1;transition:opacity .12s,background-color .12s;display:grid;position:absolute;top:4px;left:4px}.YXbCuq_wallpaperGrip:active{cursor:grabbing}.YXbCuq_wallpaperTile:hover .YXbCuq_wallpaperGrip,.YXbCuq_wallpaperGrip:focus-visible{opacity:1}.YXbCuq_wallpaperGrip:hover{background:#0f141ec7}.YXbCuq_wallpaperGrip:focus-visible{outline-offset:1px;outline:2px solid #fff}.YXbCuq_wallpaperBadge{z-index:2;box-sizing:border-box;color:#fff;width:18px;height:18px;font:inherit;background:#0f141e6b;border:1.5px solid #fffc;border-radius:50%;place-items:center;padding:0;font-size:10px;line-height:1;transition:background-color .12s,border-color .12s;display:grid;position:absolute;bottom:5px;right:5px}.YXbCuq_wallpaperBadgeOn{border-color:var(--dsw-alias-state-business-primary);background:var(--dsw-alias-state-business-primary)}.YXbCuq_wallpaperBadgeOff{cursor:pointer}.YXbCuq_wallpaperBadgeOff:hover{background:#0f141ea8;border-color:#fff}.YXbCuq_wallpaperBadgeOn[type=button]{cursor:pointer}.YXbCuq_wallpaperBadgeOn[type=button]:hover{filter:brightness(1.08)}.YXbCuq_wallpaperBadge:focus-visible{outline-offset:2px;outline:2px solid #fff}.YXbCuq_wallpaperCycleBar{justify-content:space-between;align-items:center;gap:8px;margin:0 0 6px;display:flex}.YXbCuq_wallpaperCycleCount{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}.YXbCuq_wallpaperCycleAll{border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);cursor:pointer;font:inherit;background:0 0;border-radius:999px;padding:2px 8px;font-size:11px;line-height:16px;transition:border-color .12s,color .12s}.YXbCuq_wallpaperCycleAll:hover{border-color:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-state-business-primary)}.YXbCuq_wallpaperCycleAll:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}.YXbCuq_wallpaperRow{flex-direction:column;gap:4px;min-width:0;max-width:220px;display:flex;position:relative}.YXbCuq_wallpaperWarn{color:var(--dsw-alias-label-tertiary);margin:6px 0 0;font-size:11px;line-height:16px}.YXbCuq_wallpaperDelete{z-index:2;color:#fff;cursor:pointer;opacity:0;background:#0f141e9e;border:1px solid #ffffff4d;border-radius:50%;place-items:center;width:20px;height:20px;padding:0;font-size:15px;line-height:1;transition:opacity .12s,background-color .12s;display:grid;position:absolute;top:4px;right:4px}.YXbCuq_wallpaperTile:hover .YXbCuq_wallpaperDelete,.YXbCuq_wallpaperDelete:focus-visible{opacity:1}.YXbCuq_wallpaperDelete:hover{background:#c94545}.YXbCuq_wallpaperDelete:focus-visible{outline-offset:1px;outline:2px solid #fff}.YXbCuq_wallpaperEmpty{border:1px dashed var(--dsw-alias-border-l2);color:var(--dsw-alias-label-tertiary);text-align:center;border-radius:7px;padding:12px;font-size:11px;line-height:17px}.YXbCuq_fontPreview{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:10px;align-items:center;gap:16px;min-height:82px;padding:14px 16px;display:flex}.YXbCuq_fontPreviewAa{color:var(--dsw-alias-state-business-primary);flex:none;font-size:34px;line-height:1}.YXbCuq_fontPreview p{color:var(--dsw-alias-label-secondary);margin:0;line-height:1.65}.YXbCuq_fileInput{display:none}@container YXbCuq_prism-panel (width<=580px){.YXbCuq_hero{grid-template-columns:minmax(0,1fr)}.YXbCuq_preview{display:none}.YXbCuq_heroCopy{gap:16px}}@container YXbCuq_prism-panel (width<=460px){.YXbCuq_hero{padding:16px}.YXbCuq_sectionHead{padding:13px 12px 0}.YXbCuq_sectionBody{padding:12px}.YXbCuq_sectionHead:has(>button){flex-direction:column;align-items:flex-start}.YXbCuq_customThemeRow{flex-wrap:wrap}.YXbCuq_customThemeActions{justify-content:flex-end;width:100%}.YXbCuq_saveThemeForm{grid-template-columns:minmax(0,1fr)}.YXbCuq_disabledState{flex-direction:column;align-items:flex-start}}@media (hover:none){.YXbCuq_wallpaperDelete,.YXbCuq_wallpaperGrip{opacity:1}}@media (prefers-reduced-motion:reduce){.YXbCuq_tab,.YXbCuq_tabActive,.YXbCuq_presetCard,.YXbCuq_presetCardActive,.YXbCuq_materialCard,.YXbCuq_materialCardActive,.YXbCuq_wallpaperCycleAll,.YXbCuq_wallpaperDelete,.YXbCuq_wallpaperGrip,.YXbCuq_wallpaperBadge,.YXbCuq_wallpaperFrost,.YXbCuq_wallpaperThumb,.YXbCuq_wallpaperTile{transition:none}}.YXbCuq_wallpaperClip{width:100%;height:100%;display:block;position:relative}.YXbCuq_wallpaperClipVoid{aspect-ratio:16/10;background:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent);width:100%;display:block}.YXbCuq_wallpaperClipMark{color:#fff;background:#080a108c;border:1px solid #ffffff8c;border-radius:999px;place-items:center;width:18px;height:18px;font-size:9px;line-height:1;display:grid;position:absolute;bottom:8px;left:8px}.YXbCuq_wallpaperClipTime{font-variant-numeric:tabular-nums;color:#fff;background:#080a108c;border-radius:999px;padding:1px 6px;font-size:11px;line-height:16px;position:absolute;bottom:8px;right:8px}";
1253
+ const tagId$1 = "dsh-prism-plugin/PrismAppearancePanel.module.css";
1254
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
1255
+ const tag = document.createElement("style");
1256
+ tag.dataset.plugin = "dsh-prism-plugin";
1257
+ tag.dataset.pluginCss = tagId$1;
1258
+ tag.textContent = css$1;
1259
+ document.head.appendChild(tag);
1260
+ }
1261
+ var PrismAppearancePanel_module_css_default = {
1262
+ "brandMark": "YXbCuq_brandMark",
1263
+ "brandRow": "YXbCuq_brandRow",
1264
+ "controlsStack": "YXbCuq_controlsStack",
1265
+ "customSwatch": "YXbCuq_customSwatch",
1266
+ "customThemeActions": "YXbCuq_customThemeActions",
1267
+ "customThemeList": "YXbCuq_customThemeList",
1268
+ "customThemeName": "YXbCuq_customThemeName",
1269
+ "customThemeRow": "YXbCuq_customThemeRow",
1270
+ "disabledState": "YXbCuq_disabledState",
1271
+ "emptyThemes": "YXbCuq_emptyThemes",
1272
+ "error": "YXbCuq_error",
1273
+ "fileInput": "YXbCuq_fileInput",
1274
+ "fontPreview": "YXbCuq_fontPreview",
1275
+ "fontPreviewAa": "YXbCuq_fontPreviewAa",
1276
+ "hero": "YXbCuq_hero",
1277
+ "heroActions": "YXbCuq_heroActions",
1278
+ "heroCopy": "YXbCuq_heroCopy",
1279
+ "hint": "YXbCuq_hint",
1280
+ "importExportRow": "YXbCuq_importExportRow",
1281
+ "materialCard": "YXbCuq_materialCard",
1282
+ "materialCardActive": "YXbCuq_materialCardActive",
1283
+ "materialGrid": "YXbCuq_materialGrid",
1284
+ "materialLabel": "YXbCuq_materialLabel",
1285
+ "panel": "YXbCuq_panel",
1286
+ "presetCard": "YXbCuq_presetCard",
1287
+ "presetCardActive": "YXbCuq_presetCardActive",
1288
+ "presetGrid": "YXbCuq_presetGrid",
1289
+ "presetName": "YXbCuq_presetName",
1290
+ "preview": "YXbCuq_preview",
1291
+ "previewBubble": "YXbCuq_previewBubble",
1292
+ "previewComposer": "YXbCuq_previewComposer",
1293
+ "previewMain": "YXbCuq_previewMain",
1294
+ "previewOrb": "YXbCuq_previewOrb",
1295
+ "previewSidebar": "YXbCuq_previewSidebar",
1296
+ "previewTopbar": "YXbCuq_previewTopbar",
1297
+ "previewWindow": "YXbCuq_previewWindow",
1298
+ "prism-panel": "YXbCuq_prism-panel",
1299
+ "saveThemeForm": "YXbCuq_saveThemeForm",
1300
+ "section": "YXbCuq_section",
1301
+ "sectionBody": "YXbCuq_sectionBody",
1302
+ "sectionDescription": "YXbCuq_sectionDescription",
1303
+ "sectionHead": "YXbCuq_sectionHead",
1304
+ "sectionTitle": "YXbCuq_sectionTitle",
1305
+ "selectionMark": "YXbCuq_selectionMark",
1306
+ "status": "YXbCuq_status",
1307
+ "subtitle": "YXbCuq_subtitle",
1308
+ "surfaceTrace": "YXbCuq_surfaceTrace",
1309
+ "tab": "YXbCuq_tab",
1310
+ "tabActive": "YXbCuq_tabActive",
1311
+ "tabPanel": "YXbCuq_tabPanel",
1312
+ "tabs": "YXbCuq_tabs",
1313
+ "textInput": "YXbCuq_textInput",
1314
+ "title": "YXbCuq_title",
1315
+ "titleRow": "YXbCuq_titleRow",
1316
+ "version": "YXbCuq_version",
1317
+ "wallpaperBadge": "YXbCuq_wallpaperBadge",
1318
+ "wallpaperBadgeOff": "YXbCuq_wallpaperBadgeOff",
1319
+ "wallpaperBadgeOn": "YXbCuq_wallpaperBadgeOn",
1320
+ "wallpaperClip": "YXbCuq_wallpaperClip",
1321
+ "wallpaperClipMark": "YXbCuq_wallpaperClipMark",
1322
+ "wallpaperClipTime": "YXbCuq_wallpaperClipTime",
1323
+ "wallpaperClipVoid": "YXbCuq_wallpaperClipVoid",
1324
+ "wallpaperCycleAll": "YXbCuq_wallpaperCycleAll",
1325
+ "wallpaperCycleBar": "YXbCuq_wallpaperCycleBar",
1326
+ "wallpaperCycleCount": "YXbCuq_wallpaperCycleCount",
1327
+ "wallpaperDelete": "YXbCuq_wallpaperDelete",
1328
+ "wallpaperEmpty": "YXbCuq_wallpaperEmpty",
1329
+ "wallpaperFrost": "YXbCuq_wallpaperFrost",
1330
+ "wallpaperGrip": "YXbCuq_wallpaperGrip",
1331
+ "wallpaperHeader": "YXbCuq_wallpaperHeader",
1332
+ "wallpaperItems": "YXbCuq_wallpaperItems",
1333
+ "wallpaperList": "YXbCuq_wallpaperList",
1334
+ "wallpaperRow": "YXbCuq_wallpaperRow",
1335
+ "wallpaperScheme": "YXbCuq_wallpaperScheme",
1336
+ "wallpaperThumb": "YXbCuq_wallpaperThumb",
1337
+ "wallpaperThumbActive": "YXbCuq_wallpaperThumbActive",
1338
+ "wallpaperThumbButton": "YXbCuq_wallpaperThumbButton",
1339
+ "wallpaperTile": "YXbCuq_wallpaperTile",
1340
+ "wallpaperTileDragging": "YXbCuq_wallpaperTileDragging",
1341
+ "wallpaperTileOff": "YXbCuq_wallpaperTileOff",
1342
+ "wallpaperTileOn": "YXbCuq_wallpaperTileOn",
1343
+ "wallpaperWarn": "YXbCuq_wallpaperWarn"
1344
+ };
1345
+ // src/client/PrismAppearancePanel.tsx
1346
+ /**
1347
+ * Prism's General → Appearance control surface. The master switch now lives
1348
+ * here because DSH 0.2.2 retired settings.plugin.item. Four task-oriented
1349
+ * tabs keep the full theme controls compact; every write still goes through
1350
+ * the damped PrismLayer, so presets and individual knobs preview live.
1351
+ */
1352
+ /**
1353
+ * One gallery thumbnail. Inline images render as they are; clips render their
1354
+ * poster frame (stored beside the clip in IndexedDB) plus a play mark, so the
1355
+ * grid never has to decode a video just to show a tile.
1356
+ */
1357
+ function WallpaperThumb({ source }) {
1358
+ const video = isVideoRef(source);
1359
+ const id = video ? videoIdOf(source) : "";
1360
+ const [poster, setPoster] = (0, react.useState)(void 0);
1361
+ const [duration, setDuration] = (0, react.useState)(0);
1362
+ (0, react.useEffect)(() => {
1363
+ if (id === "") return;
1364
+ let alive = true;
1365
+ let made;
1366
+ getVideo(id).then((record) => {
1367
+ if (!alive || record === null) return;
1368
+ setDuration(record.duration);
1369
+ if (record.poster === null) return;
1370
+ made = URL.createObjectURL(record.poster);
1371
+ setPoster(made);
1372
+ }).catch(() => void 0);
1373
+ return () => {
1374
+ alive = false;
1375
+ if (made !== void 0) URL.revokeObjectURL(made);
1376
+ };
1377
+ }, [id]);
1378
+ if (!video) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
1379
+ className: PrismAppearancePanel_module_css_default.wallpaperThumb,
1380
+ src: source,
1381
+ alt: "",
1382
+ draggable: false
1383
+ });
1384
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1385
+ className: PrismAppearancePanel_module_css_default.wallpaperClip,
1386
+ children: [
1387
+ poster !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
1388
+ className: PrismAppearancePanel_module_css_default.wallpaperThumb,
1389
+ src: poster,
1390
+ alt: "",
1391
+ draggable: false
1392
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1393
+ className: PrismAppearancePanel_module_css_default.wallpaperClipVoid,
1394
+ "aria-hidden": "true"
1395
+ }),
1396
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1397
+ className: PrismAppearancePanel_module_css_default.wallpaperClipMark,
1398
+ "aria-hidden": "true",
1399
+ children: "▶"
1400
+ }),
1401
+ duration > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1402
+ className: PrismAppearancePanel_module_css_default.wallpaperClipTime,
1403
+ children: formatClip(duration)
1404
+ })
1405
+ ]
1406
+ });
1407
+ }
1408
+ /** Clip length as m:ss. */
1409
+ function formatClip(seconds) {
1410
+ const total = Math.max(0, Math.round(seconds));
1411
+ return `${String(Math.floor(total / 60))}:${String(total % 60).padStart(2, "0")}`;
1412
+ }
1413
+ const TABS = [
1414
+ "theme",
1415
+ "glass",
1416
+ "background",
1417
+ "type"
1418
+ ];
1419
+ const PRESET_ORDER = [
1420
+ "crystal",
1421
+ "night",
1422
+ "aurora",
1423
+ "dune",
1424
+ "rose",
1425
+ "forest"
1426
+ ];
1427
+ const PRESET_LABELS = {
1428
+ crystal: "prism.presetCrystal",
1429
+ night: "prism.presetNight",
1430
+ aurora: "prism.presetAurora",
1431
+ dune: "prism.presetDune",
1432
+ rose: "prism.presetRose",
1433
+ forest: "prism.presetForest"
1434
+ };
1435
+ /** Localized error copy for a wallpaper rejection. */
1436
+ function wallpaperErrorText(t, error) {
1437
+ switch (error.kind) {
1438
+ case "size": return t("prism.errorSize");
1439
+ case "read": return t("prism.errorRead");
1440
+ case "decode": return t("prism.errorDecode");
1441
+ }
1442
+ }
1443
+ function Section({ title, description, action, children }) {
1444
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
1445
+ className: PrismAppearancePanel_module_css_default.section,
1446
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1447
+ className: PrismAppearancePanel_module_css_default.sectionHead,
1448
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
1449
+ className: PrismAppearancePanel_module_css_default.sectionTitle,
1450
+ children: title
1451
+ }), description !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1452
+ className: PrismAppearancePanel_module_css_default.sectionDescription,
1453
+ children: description
1454
+ })] }), action]
1455
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1456
+ className: PrismAppearancePanel_module_css_default.sectionBody,
1457
+ children
1458
+ })]
1459
+ });
1460
+ }
1461
+ function color(values) {
1462
+ return hslToHex({
1463
+ h: values.accentHue,
1464
+ s: values.accentSat,
1465
+ l: values.accentLight
1466
+ });
1467
+ }
1468
+ /** A shared light-through-surface motif: sharp, diffused, or softened. */
1469
+ function SurfaceTrace({ accent, backdrop, material }) {
1470
+ const style = {
1471
+ "--trace-accent": accent,
1472
+ "--trace-backdrop": backdrop
1473
+ };
1474
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1475
+ className: PrismAppearancePanel_module_css_default.surfaceTrace,
1476
+ "data-material": material,
1477
+ style,
1478
+ "aria-hidden": "true",
1479
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", {})
1480
+ });
1481
+ }
1482
+ function PresetCard({ id, active, label, onApply }) {
1483
+ const recipe = PRESETS[id];
1484
+ const accent = color(recipe);
1485
+ const backdrop = hslToHex({
1486
+ h: recipe.bgHue,
1487
+ s: recipe.bgSat,
1488
+ l: recipe.bgLight
1489
+ });
1490
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1491
+ type: "button",
1492
+ className: active ? PrismAppearancePanel_module_css_default.presetCardActive : PrismAppearancePanel_module_css_default.presetCard,
1493
+ "aria-pressed": active,
1494
+ "aria-label": label,
1495
+ onClick: onApply,
1496
+ children: [
1497
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SurfaceTrace, {
1498
+ accent,
1499
+ backdrop,
1500
+ material: recipe.material
1501
+ }),
1502
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1503
+ className: PrismAppearancePanel_module_css_default.presetName,
1504
+ children: label
1505
+ }),
1506
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1507
+ className: PrismAppearancePanel_module_css_default.selectionMark,
1508
+ "aria-hidden": "true",
1509
+ children: active ? "✓" : ""
1510
+ })
1511
+ ]
1512
+ });
1513
+ }
1514
+ function CustomThemeRow({ theme, onApply, onDelete, t }) {
1515
+ const accent = color(theme.values);
1516
+ const backdrop = hslToHex({
1517
+ h: theme.values.bgHue,
1518
+ s: theme.values.bgSat,
1519
+ l: theme.values.bgLight
1520
+ });
1521
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1522
+ className: PrismAppearancePanel_module_css_default.customThemeRow,
1523
+ children: [
1524
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1525
+ className: PrismAppearancePanel_module_css_default.customSwatch,
1526
+ style: { background: `linear-gradient(135deg, ${backdrop}, ${accent})` },
1527
+ "aria-hidden": "true",
1528
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", {})
1529
+ }),
1530
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1531
+ className: PrismAppearancePanel_module_css_default.customThemeName,
1532
+ children: theme.name
1533
+ }),
1534
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1535
+ className: PrismAppearancePanel_module_css_default.customThemeActions,
1536
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrismButton, {
1537
+ variant: "quiet",
1538
+ "aria-label": `${t("prism.applyTheme")} ${theme.name}`,
1539
+ onClick: onApply,
1540
+ children: t("prism.applyTheme")
1541
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrismButton, {
1542
+ variant: "danger",
1543
+ "aria-label": `${t("prism.deleteTheme")} ${theme.name}`,
1544
+ onClick: onDelete,
1545
+ children: t("prism.deleteTheme")
1546
+ })]
1547
+ })
1548
+ ]
1549
+ });
1550
+ }
1551
+ /** Render the Prism appearance panel. */
1552
+ function PrismAppearancePanel(props) {
1553
+ const { t, setEnabled, setMaterial, setBlur, setFrost, setBgBrightness, setFontScale, setFontChoice, setCustomFont, setZone, setInkLightColor, setInkDarkColor, setAccentColor, setBgColor, setAccentOpacity, setMotion, setBackground, setWallpaperInterval, setWallpaperLoop, pinWallpaper, setWallpaperBlur, setWallpaperFrost, pickWallpapers, clearWallpaper, setWallpaperCycle, setWallpaperCycleAll, reorderWallpapers, applyPreset, saveTheme, applyCustomTheme, deleteCustomTheme, exportTheme, importTheme, resetZones, reset, useStore } = props;
1554
+ const enabled = useStore((s) => s.enabled);
1555
+ const material = useStore((s) => s.material);
1556
+ const blur = useStore((s) => s.blur);
1557
+ const frost = useStore((s) => s.frost);
1558
+ const bgBrightness = useStore((s) => s.bgBrightness);
1559
+ const fontScale = useStore((s) => s.fontScale);
1560
+ const fontChoice = useStore((s) => s.fontChoice);
1561
+ const customFont = useStore((s) => s.customFont);
1562
+ const zones = useStore((s) => s.zones);
1563
+ const inkLightHue = useStore((s) => s.inkLightHue);
1564
+ const inkLightSat = useStore((s) => s.inkLightSat);
1565
+ const inkLightLight = useStore((s) => s.inkLightLight);
1566
+ const inkDarkHue = useStore((s) => s.inkDarkHue);
1567
+ const inkDarkSat = useStore((s) => s.inkDarkSat);
1568
+ const inkDarkLight = useStore((s) => s.inkDarkLight);
1569
+ const accentHue = useStore((s) => s.accentHue);
1570
+ const accentSat = useStore((s) => s.accentSat);
1571
+ const accentLight = useStore((s) => s.accentLight);
1572
+ const bgHue = useStore((s) => s.bgHue);
1573
+ const bgSat = useStore((s) => s.bgSat);
1574
+ const bgLight = useStore((s) => s.bgLight);
1575
+ const accentOpacity = useStore((s) => s.accentOpacity);
1576
+ const motion = useStore((s) => s.motion);
1577
+ const background = useStore((s) => s.background);
1578
+ const wallpaperDark = useStore((s) => s.wallpaperDark);
1579
+ const wallpaperLight = useStore((s) => s.wallpaperLight);
1580
+ const wallpaperInterval = useStore((s) => s.wallpaperInterval);
1581
+ const wallpaperLoop = useStore((s) => s.wallpaperLoop);
1582
+ const wallpaperCycleDark = useStore((s) => s.wallpaperCycleDark);
1583
+ const wallpaperCycleLight = useStore((s) => s.wallpaperCycleLight);
1584
+ const wallpaperPinnedDark = useStore((s) => s.wallpaperPinnedDark);
1585
+ const wallpaperPinnedLight = useStore((s) => s.wallpaperPinnedLight);
1586
+ const wallpaperBlur = useStore((s) => s.wallpaperBlur);
1587
+ const wallpaperFrost = useStore((s) => s.wallpaperFrost);
1588
+ const customThemes = useStore((s) => s.customThemes);
1589
+ const dark = useStore((s) => s.dark);
1590
+ const [tab, setTab] = (0, react.useState)("theme");
1591
+ const [themeName, setThemeName] = (0, react.useState)("");
1592
+ const [status, setStatus] = (0, react.useState)(null);
1593
+ const [wallpaperError, setWallpaperError] = (0, react.useState)(null);
1594
+ const [wallpaperNotice, setWallpaperNotice] = (0, react.useState)(null);
1595
+ const [dragIndex, setDragIndex] = (0, react.useState)(null);
1596
+ const suppressClickRef = (0, react.useRef)(false);
1597
+ const wallpaperFileRef = (0, react.useRef)(null);
1598
+ const importFileRef = (0, react.useRef)(null);
1599
+ const schemeRef = (0, react.useRef)("dark");
1600
+ const accent = hslToHex({
1601
+ h: accentHue,
1602
+ s: accentSat,
1603
+ l: accentLight
1604
+ });
1605
+ const backdrop = hslToHex({
1606
+ h: bgHue,
1607
+ s: bgSat,
1608
+ l: bgLight
1609
+ });
1610
+ const previewStyle = {
1611
+ "--prism-preview-accent": accent,
1612
+ "--prism-preview-backdrop": backdrop,
1613
+ "--prism-preview-ink": hslToHex(dark ? {
1614
+ h: inkDarkHue,
1615
+ s: inkDarkSat,
1616
+ l: inkDarkLight
1617
+ } : {
1618
+ h: inkLightHue,
1619
+ s: inkLightSat,
1620
+ l: inkLightLight
1621
+ }),
1622
+ "--prism-preview-scale": String(fontScale / 100)
1623
+ };
1624
+ const resetHint = t("prism.sliderResetHint");
1625
+ const isPresetActive = (id) => {
1626
+ const recipe = PRESETS[id];
1627
+ return material === recipe.material && blur === recipe.blur && frost === recipe.frost && bgBrightness === recipe.bgBrightness && motion === recipe.motion && accentHue === recipe.accentHue && accentSat === recipe.accentSat && accentLight === recipe.accentLight && bgHue === recipe.bgHue && bgSat === recipe.bgSat && bgLight === recipe.bgLight;
1628
+ };
1629
+ const startPick = (scheme) => {
1630
+ schemeRef.current = scheme;
1631
+ wallpaperFileRef.current?.click();
1632
+ };
1633
+ const onWallpaperFile = async (event) => {
1634
+ const files = Array.from(event.target.files ?? []);
1635
+ event.target.value = "";
1636
+ if (files.length === 0) return;
1637
+ const scheme = schemeRef.current;
1638
+ setWallpaperError(null);
1639
+ setWallpaperNotice(null);
1640
+ const { added, errors } = await pickWallpapers(scheme, files);
1641
+ const firstError = errors[0];
1642
+ setWallpaperError(firstError === void 0 ? null : {
1643
+ scheme,
1644
+ message: wallpaperErrorText(t, firstError)
1645
+ });
1646
+ const rejected = errors.length + Math.max(0, files.length - added - errors.length);
1647
+ setWallpaperNotice(added === 0 && rejected === 0 ? null : {
1648
+ scheme,
1649
+ message: t("prism.wallpaperBatch").replace("{n}", String(added)).replace("{m}", String(rejected))
1650
+ });
1651
+ };
1652
+ const onImportFile = async (event) => {
1653
+ const file = event.target.files?.[0];
1654
+ event.target.value = "";
1655
+ if (file === void 0) return;
1656
+ if (file.size > 262144) {
1657
+ setStatus({
1658
+ message: t("prism.themeImportFailed"),
1659
+ error: true
1660
+ });
1661
+ return;
1662
+ }
1663
+ try {
1664
+ const name = importTheme(await file.text());
1665
+ setThemeName(name);
1666
+ setStatus({
1667
+ message: t("prism.themeImported"),
1668
+ error: false
1669
+ });
1670
+ } catch (error) {
1671
+ const code = error instanceof Error ? error.message : "";
1672
+ const message = code === "prism-theme-limit" ? t("prism.themeLimit") : code === "prism-theme-persist-failed" ? t("prism.themePersistFailed") : t("prism.themeImportFailed");
1673
+ setStatus({
1674
+ message,
1675
+ error: true
1676
+ });
1677
+ }
1678
+ };
1679
+ const onExport = () => {
1680
+ const blob = new Blob([exportTheme()], { type: "application/json" });
1681
+ const url = URL.createObjectURL(blob);
1682
+ const anchor = document.createElement("a");
1683
+ anchor.href = url;
1684
+ anchor.download = `prism-theme-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.json`;
1685
+ anchor.click();
1686
+ window.setTimeout(() => {
1687
+ URL.revokeObjectURL(url);
1688
+ }, 1e3);
1689
+ setStatus({
1690
+ message: t("prism.themeExported"),
1691
+ error: false
1692
+ });
1693
+ };
1694
+ const onTabKeys = (event) => {
1695
+ if (![
1696
+ "ArrowLeft",
1697
+ "ArrowRight",
1698
+ "Home",
1699
+ "End"
1700
+ ].includes(event.key)) return;
1701
+ event.preventDefault();
1702
+ const index = TABS.indexOf(tab);
1703
+ const next = event.key === "Home" ? 0 : event.key === "End" ? TABS.length - 1 : event.key === "ArrowRight" ? (index + 1) % TABS.length : (index - 1 + TABS.length) % TABS.length;
1704
+ const nextTab = TABS[next] ?? "theme";
1705
+ setTab(nextTab);
1706
+ event.currentTarget.querySelectorAll("[role=\"tab\"]")[next]?.focus();
1707
+ };
1708
+ /** Move one image to a new slot; the list order is the carousel order. */
1709
+ const moveWallpaper = (scheme, index, target) => {
1710
+ if (target < 0 || target >= (scheme === "dark" ? wallpaperDark : wallpaperLight).length) return;
1711
+ reorderWallpapers(scheme, index, target);
1712
+ };
1713
+ /**
1714
+ * Drag-to-reorder. Dragging starts on the grip, and every pointer move asks
1715
+ * which tile is under the cursor and swaps right away, so the thumbnail
1716
+ * follows the pointer instead of waiting for a drop.
1717
+ */
1718
+ const beginReorder = (scheme, index) => (event) => {
1719
+ if (!wallpaperLoop || event.button !== 0) return;
1720
+ const origin = event.target;
1721
+ if (origin instanceof Element && origin.closest("[data-prism-no-drag]") !== null) return;
1722
+ const startX = event.clientX;
1723
+ const startY = event.clientY;
1724
+ let from = index;
1725
+ let moved = false;
1726
+ const onMove = (move) => {
1727
+ if (!moved) {
1728
+ if (Math.hypot(move.clientX - startX, move.clientY - startY) < 5) return;
1729
+ moved = true;
1730
+ }
1731
+ setDragIndex({
1732
+ scheme,
1733
+ index: from
1734
+ });
1735
+ const under = document.elementFromPoint(move.clientX, move.clientY);
1736
+ const tile = under instanceof Element ? under.closest("[data-prism-wallpaper-tile]") : null;
1737
+ if (tile === null || tile.dataset.prismWallpaperTile !== scheme) return;
1738
+ const target = Number(tile.dataset.prismIndex);
1739
+ if (!Number.isInteger(target) || target === from) return;
1740
+ reorderWallpapers(scheme, from, target);
1741
+ from = target;
1742
+ setDragIndex({
1743
+ scheme,
1744
+ index: from
1745
+ });
1746
+ };
1747
+ const finish = () => {
1748
+ window.removeEventListener("pointermove", onMove);
1749
+ window.removeEventListener("pointerup", finish);
1750
+ window.removeEventListener("pointercancel", finish);
1751
+ setDragIndex(null);
1752
+ if (moved) {
1753
+ suppressClickRef.current = true;
1754
+ window.setTimeout(() => {
1755
+ suppressClickRef.current = false;
1756
+ }, 0);
1757
+ }
1758
+ };
1759
+ window.addEventListener("pointermove", onMove);
1760
+ window.addEventListener("pointerup", finish);
1761
+ window.addEventListener("pointercancel", finish);
1762
+ };
1763
+ const wallpaperRows = (scheme, urls, labelKey) => {
1764
+ const pinned = scheme === "dark" ? wallpaperPinnedDark : wallpaperPinnedLight;
1765
+ const cycles = scheme === "dark" ? wallpaperCycleDark : wallpaperCycleLight;
1766
+ const included = urls.reduce((count, _url, index) => cycles[index] === false ? count : count + 1, 0);
1767
+ const everySelected = urls.length > 0 && included === urls.length;
1768
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1769
+ className: PrismAppearancePanel_module_css_default.wallpaperList,
1770
+ children: [
1771
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1772
+ className: PrismAppearancePanel_module_css_default.wallpaperHeader,
1773
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1774
+ className: PrismAppearancePanel_module_css_default.wallpaperScheme,
1775
+ children: t(labelKey)
1776
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PrismButton, {
1777
+ variant: "quiet",
1778
+ "aria-label": `${t("prism.chooseImage")} · ${t(labelKey)}`,
1779
+ onClick: () => {
1780
+ startPick(scheme);
1781
+ },
1782
+ children: ["+ ", t("prism.chooseImage")]
1783
+ })]
1784
+ }),
1785
+ urls.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1786
+ className: PrismAppearancePanel_module_css_default.wallpaperEmpty,
1787
+ children: t("prism.wallpaperEmpty")
1788
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
1789
+ wallpaperLoop && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1790
+ className: PrismAppearancePanel_module_css_default.wallpaperCycleBar,
1791
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1792
+ className: PrismAppearancePanel_module_css_default.wallpaperCycleCount,
1793
+ children: [
1794
+ t("prism.cycleCount"),
1795
+ " ",
1796
+ String(included),
1797
+ "/",
1798
+ String(urls.length)
1799
+ ]
1800
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1801
+ type: "button",
1802
+ className: PrismAppearancePanel_module_css_default.wallpaperCycleAll,
1803
+ "aria-label": `${everySelected ? t("prism.cycleNone") : t("prism.cycleAll")} · ${t(labelKey)}`,
1804
+ onClick: () => {
1805
+ setWallpaperCycleAll(scheme, !everySelected);
1806
+ },
1807
+ children: everySelected ? t("prism.cycleNone") : t("prism.cycleAll")
1808
+ })]
1809
+ }),
1810
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1811
+ className: PrismAppearancePanel_module_css_default.wallpaperItems,
1812
+ children: urls.map((url, index) => {
1813
+ const inCycle = cycles[index] !== false;
1814
+ const tileClass = [
1815
+ PrismAppearancePanel_module_css_default.wallpaperTile,
1816
+ inCycle ? PrismAppearancePanel_module_css_default.wallpaperTileOn : PrismAppearancePanel_module_css_default.wallpaperTileOff,
1817
+ dragIndex?.scheme === scheme && dragIndex.index === index ? PrismAppearancePanel_module_css_default.wallpaperTileDragging : ""
1818
+ ].filter(Boolean).join(" ");
1819
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1820
+ className: tileClass,
1821
+ "data-prism-wallpaper-tile": scheme,
1822
+ "data-prism-index": String(index),
1823
+ onPointerDown: beginReorder(scheme, index),
1824
+ children: [
1825
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1826
+ type: "button",
1827
+ className: !wallpaperLoop && pinned === index ? PrismAppearancePanel_module_css_default.wallpaperThumbActive : PrismAppearancePanel_module_css_default.wallpaperThumbButton,
1828
+ "aria-label": `${t("prism.wallpaperPin")} · ${t(labelKey)} ${String(index + 1)}`,
1829
+ "aria-pressed": !wallpaperLoop && pinned === index,
1830
+ title: wallpaperLoop ? t("prism.wallpaperPinWhileLooping") : t("prism.wallpaperPinHint"),
1831
+ onClick: () => {
1832
+ if (suppressClickRef.current || wallpaperLoop) return;
1833
+ pinWallpaper(scheme, index);
1834
+ },
1835
+ children: [
1836
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WallpaperThumb, { source: url }),
1837
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1838
+ className: PrismAppearancePanel_module_css_default.wallpaperFrost,
1839
+ "aria-hidden": "true"
1840
+ }),
1841
+ !wallpaperLoop && pinned === index && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1842
+ className: `${PrismAppearancePanel_module_css_default.wallpaperBadge} ${PrismAppearancePanel_module_css_default.wallpaperBadgeOn}`,
1843
+ "aria-hidden": "true",
1844
+ children: "✓"
1845
+ })
1846
+ ]
1847
+ }),
1848
+ wallpaperLoop && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1849
+ type: "button",
1850
+ className: PrismAppearancePanel_module_css_default.wallpaperGrip,
1851
+ "aria-label": `${t("prism.cycleOrder")} · ${t(labelKey)} ${String(index + 1)}`,
1852
+ title: t("prism.cycleOrderHint"),
1853
+ onKeyDown: (event) => {
1854
+ if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
1855
+ event.preventDefault();
1856
+ moveWallpaper(scheme, index, event.key === "ArrowLeft" ? -1 : 1);
1857
+ },
1858
+ children: "⣿"
1859
+ }),
1860
+ wallpaperLoop && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1861
+ type: "button",
1862
+ className: `${PrismAppearancePanel_module_css_default.wallpaperBadge} ${inCycle ? PrismAppearancePanel_module_css_default.wallpaperBadgeOn : PrismAppearancePanel_module_css_default.wallpaperBadgeOff}`,
1863
+ "data-prism-no-drag": "true",
1864
+ "aria-label": `${t("prism.cycleToggle")} · ${t(labelKey)} ${String(index + 1)}`,
1865
+ "aria-pressed": inCycle,
1866
+ title: t("prism.cycleToggleHint"),
1867
+ onClick: () => {
1868
+ setWallpaperCycle(scheme, index, !inCycle);
1869
+ },
1870
+ children: inCycle && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
1871
+ viewBox: "0 0 12 12",
1872
+ width: "10",
1873
+ height: "10",
1874
+ "aria-hidden": "true",
1875
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
1876
+ d: "M2 6.2 4.6 8.8 10 3.2",
1877
+ fill: "none",
1878
+ stroke: "currentColor",
1879
+ strokeWidth: "2",
1880
+ strokeLinecap: "round",
1881
+ strokeLinejoin: "round"
1882
+ })
1883
+ })
1884
+ }),
1885
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1886
+ type: "button",
1887
+ className: PrismAppearancePanel_module_css_default.wallpaperDelete,
1888
+ "data-prism-no-drag": "true",
1889
+ "aria-label": `${t("prism.deleteWallpaper")} · ${t(labelKey)} ${String(index + 1)}`,
1890
+ onClick: () => {
1891
+ clearWallpaper(scheme, index);
1892
+ },
1893
+ children: "×"
1894
+ })
1895
+ ]
1896
+ }, `${scheme}-${String(index)}-${url.slice(-16)}`);
1897
+ })
1898
+ }),
1899
+ wallpaperLoop && included === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1900
+ className: PrismAppearancePanel_module_css_default.wallpaperWarn,
1901
+ role: "status",
1902
+ children: t("prism.cycleEmpty")
1903
+ })
1904
+ ] }),
1905
+ wallpaperError?.scheme === scheme && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1906
+ className: PrismAppearancePanel_module_css_default.error,
1907
+ role: "alert",
1908
+ children: wallpaperError.message
1909
+ }),
1910
+ wallpaperNotice?.scheme === scheme && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1911
+ className: PrismAppearancePanel_module_css_default.hint,
1912
+ role: "status",
1913
+ children: wallpaperNotice.message
1914
+ })
1915
+ ]
1916
+ }, scheme);
1917
+ };
1918
+ const hero = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1919
+ className: PrismAppearancePanel_module_css_default.hero,
1920
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1921
+ className: PrismAppearancePanel_module_css_default.heroCopy,
1922
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1923
+ className: PrismAppearancePanel_module_css_default.brandRow,
1924
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1925
+ className: PrismAppearancePanel_module_css_default.brandMark,
1926
+ "aria-hidden": "true",
1927
+ children: [
1928
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", {}),
1929
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", {}),
1930
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", {})
1931
+ ]
1932
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1933
+ className: PrismAppearancePanel_module_css_default.titleRow,
1934
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
1935
+ className: PrismAppearancePanel_module_css_default.title,
1936
+ children: "DSH Background"
1937
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1938
+ className: PrismAppearancePanel_module_css_default.version,
1939
+ children: "2.0"
1940
+ })]
1941
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1942
+ className: PrismAppearancePanel_module_css_default.subtitle,
1943
+ children: t("prism.subtitle")
1944
+ })] })]
1945
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1946
+ className: PrismAppearancePanel_module_css_default.heroActions,
1947
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrismButton, {
1948
+ variant: "quiet",
1949
+ onClick: reset,
1950
+ children: t("prism.resetAll")
1951
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Switch, {
1952
+ label: t("prism.enabled"),
1953
+ checked: enabled,
1954
+ onChange: setEnabled
1955
+ })]
1956
+ })]
1957
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1958
+ className: PrismAppearancePanel_module_css_default.preview,
1959
+ style: previewStyle,
1960
+ "data-material": material,
1961
+ "aria-hidden": "true",
1962
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: PrismAppearancePanel_module_css_default.previewOrb }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1963
+ className: PrismAppearancePanel_module_css_default.previewWindow,
1964
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1965
+ className: PrismAppearancePanel_module_css_default.previewSidebar,
1966
+ children: [
1967
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", {}),
1968
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", {}),
1969
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", {})
1970
+ ]
1971
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1972
+ className: PrismAppearancePanel_module_css_default.previewMain,
1973
+ children: [
1974
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: PrismAppearancePanel_module_css_default.previewTopbar }),
1975
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1976
+ className: PrismAppearancePanel_module_css_default.previewBubble,
1977
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: t("prism.previewTitle") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("prism.previewText") })]
1978
+ }),
1979
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1980
+ className: PrismAppearancePanel_module_css_default.previewComposer,
1981
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("prism.previewInput") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", {})]
1982
+ })
1983
+ ]
1984
+ })]
1985
+ })]
1986
+ })]
1987
+ });
1988
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1989
+ className: PrismAppearancePanel_module_css_default.panel,
1990
+ children: [
1991
+ hero,
1992
+ !enabled ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1993
+ className: PrismAppearancePanel_module_css_default.disabledState,
1994
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("prism.subtitle") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrismButton, {
1995
+ variant: "primary",
1996
+ onClick: () => {
1997
+ setEnabled(true);
1998
+ },
1999
+ children: t("prism.enable")
2000
+ })]
2001
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2002
+ className: PrismAppearancePanel_module_css_default.tabs,
2003
+ role: "tablist",
2004
+ "aria-label": "DSH Background",
2005
+ onKeyDown: onTabKeys,
2006
+ children: TABS.map((id) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2007
+ type: "button",
2008
+ role: "tab",
2009
+ id: `prism-tab-${id}`,
2010
+ "aria-selected": tab === id,
2011
+ "aria-controls": `prism-panel-${id}`,
2012
+ tabIndex: tab === id ? 0 : -1,
2013
+ className: tab === id ? PrismAppearancePanel_module_css_default.tabActive : PrismAppearancePanel_module_css_default.tab,
2014
+ onClick: () => {
2015
+ setTab(id);
2016
+ },
2017
+ children: t(`prism.tab${id[0]?.toUpperCase() ?? ""}${id.slice(1)}`)
2018
+ }, id))
2019
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2020
+ className: PrismAppearancePanel_module_css_default.tabPanel,
2021
+ role: "tabpanel",
2022
+ id: `prism-panel-${tab}`,
2023
+ "aria-labelledby": `prism-tab-${tab}`,
2024
+ children: [
2025
+ tab === "theme" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
2026
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Section, {
2027
+ title: t("prism.presets"),
2028
+ description: t("prism.presetsDesc"),
2029
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2030
+ className: PrismAppearancePanel_module_css_default.presetGrid,
2031
+ children: PRESET_ORDER.map((id) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PresetCard, {
2032
+ id,
2033
+ label: t(PRESET_LABELS[id]),
2034
+ active: isPresetActive(id),
2035
+ onApply: () => {
2036
+ applyPreset(id);
2037
+ }
2038
+ }, id))
2039
+ })
2040
+ }),
2041
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Section, {
2042
+ title: t("prism.colors"),
2043
+ description: t("prism.colorsDesc"),
2044
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2045
+ className: PrismAppearancePanel_module_css_default.controlsStack,
2046
+ children: [
2047
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorControl, {
2048
+ label: t("prism.accentHue"),
2049
+ hexLabel: t("prism.colorHexLabel"),
2050
+ pickerLabel: t("prism.colorPickerLabel"),
2051
+ placeholder: t("prism.colorPlaceholder"),
2052
+ hue: accentHue,
2053
+ sat: accentSat,
2054
+ light: accentLight,
2055
+ onChange: setAccentColor
2056
+ }),
2057
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrismSlider, {
2058
+ label: t("prism.accentOpacity"),
2059
+ value: accentOpacity,
2060
+ min: 0,
2061
+ max: 100,
2062
+ step: 1,
2063
+ unit: "%",
2064
+ defaultValue: 100,
2065
+ resetHint,
2066
+ onChange: setAccentOpacity
2067
+ }),
2068
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorControl, {
2069
+ label: t("prism.inkHue"),
2070
+ hexLabel: t("prism.colorHexLabel"),
2071
+ pickerLabel: t("prism.colorPickerLabel"),
2072
+ placeholder: t("prism.colorPlaceholder"),
2073
+ hue: inkLightHue,
2074
+ sat: inkLightSat,
2075
+ light: inkLightLight,
2076
+ onChange: setInkLightColor
2077
+ }),
2078
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorControl, {
2079
+ label: t("prism.inkDarkHue"),
2080
+ hexLabel: t("prism.colorHexLabel"),
2081
+ pickerLabel: t("prism.colorPickerLabel"),
2082
+ placeholder: t("prism.colorPlaceholder"),
2083
+ hue: inkDarkHue,
2084
+ sat: inkDarkSat,
2085
+ light: inkDarkLight,
2086
+ onChange: setInkDarkColor
2087
+ })
2088
+ ]
2089
+ })
2090
+ }),
2091
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
2092
+ title: t("prism.customThemes"),
2093
+ description: t("prism.customThemesDesc"),
2094
+ children: [
2095
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
2096
+ className: PrismAppearancePanel_module_css_default.saveThemeForm,
2097
+ onSubmit: (event) => {
2098
+ event.preventDefault();
2099
+ try {
2100
+ if (saveTheme(themeName) !== null) {
2101
+ setThemeName("");
2102
+ setStatus({
2103
+ message: t("prism.themeSaved"),
2104
+ error: false
2105
+ });
2106
+ } else setStatus({
2107
+ message: t("prism.themeLimit"),
2108
+ error: true
2109
+ });
2110
+ } catch {
2111
+ setStatus({
2112
+ message: t("prism.themePersistFailed"),
2113
+ error: true
2114
+ });
2115
+ }
2116
+ },
2117
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2118
+ className: PrismAppearancePanel_module_css_default.textInput,
2119
+ value: themeName,
2120
+ maxLength: 40,
2121
+ placeholder: t("prism.themeNamePlaceholder"),
2122
+ "aria-label": t("prism.themeNamePlaceholder"),
2123
+ onChange: (event) => {
2124
+ setThemeName(event.target.value);
2125
+ }
2126
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrismButton, {
2127
+ variant: "primary",
2128
+ type: "submit",
2129
+ disabled: themeName.trim() === "",
2130
+ children: t("prism.saveTheme")
2131
+ })]
2132
+ }),
2133
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2134
+ className: PrismAppearancePanel_module_css_default.importExportRow,
2135
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrismButton, {
2136
+ onClick: () => {
2137
+ importFileRef.current?.click();
2138
+ },
2139
+ children: t("prism.importTheme")
2140
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrismButton, {
2141
+ onClick: onExport,
2142
+ children: t("prism.exportTheme")
2143
+ })]
2144
+ }),
2145
+ customThemes.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2146
+ className: PrismAppearancePanel_module_css_default.emptyThemes,
2147
+ children: t("prism.noCustomThemes")
2148
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2149
+ className: PrismAppearancePanel_module_css_default.customThemeList,
2150
+ children: customThemes.map((theme) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomThemeRow, {
2151
+ theme,
2152
+ t,
2153
+ onApply: () => {
2154
+ applyCustomTheme(theme.id);
2155
+ },
2156
+ onDelete: () => {
2157
+ try {
2158
+ deleteCustomTheme(theme.id);
2159
+ setStatus({
2160
+ message: t("prism.themeDeleted"),
2161
+ error: false
2162
+ });
2163
+ } catch {
2164
+ setStatus({
2165
+ message: t("prism.themePersistFailed"),
2166
+ error: true
2167
+ });
2168
+ }
2169
+ }
2170
+ }, theme.id))
2171
+ }),
2172
+ status !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2173
+ className: status.error ? PrismAppearancePanel_module_css_default.error : PrismAppearancePanel_module_css_default.status,
2174
+ role: status.error ? "alert" : "status",
2175
+ children: status.message
2176
+ })
2177
+ ]
2178
+ })
2179
+ ] }),
2180
+ tab === "glass" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
2181
+ title: t("prism.material"),
2182
+ description: t("prism.materialDesc"),
2183
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2184
+ className: PrismAppearancePanel_module_css_default.materialGrid,
2185
+ children: [
2186
+ "clear",
2187
+ "frosted",
2188
+ "velvet"
2189
+ ].map((id) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2190
+ type: "button",
2191
+ className: material === id ? PrismAppearancePanel_module_css_default.materialCardActive : PrismAppearancePanel_module_css_default.materialCard,
2192
+ "aria-pressed": material === id,
2193
+ onClick: () => {
2194
+ setMaterial(id);
2195
+ },
2196
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SurfaceTrace, {
2197
+ accent,
2198
+ backdrop,
2199
+ material: id
2200
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2201
+ className: PrismAppearancePanel_module_css_default.materialLabel,
2202
+ children: [t(`prism.material${id[0]?.toUpperCase() ?? ""}${id.slice(1)}`), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2203
+ className: PrismAppearancePanel_module_css_default.selectionMark,
2204
+ "aria-hidden": "true",
2205
+ children: material === id ? "✓" : ""
2206
+ })]
2207
+ })]
2208
+ }, id))
2209
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2210
+ className: PrismAppearancePanel_module_css_default.controlsStack,
2211
+ children: [
2212
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrismSlider, {
2213
+ label: t("prism.blur"),
2214
+ value: blur,
2215
+ min: 0,
2216
+ max: 40,
2217
+ step: 1,
2218
+ unit: "px",
2219
+ defaultValue: 18,
2220
+ resetHint,
2221
+ onChange: setBlur
2222
+ }),
2223
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrismSlider, {
2224
+ label: t("prism.frost"),
2225
+ value: frost,
2226
+ min: 0,
2227
+ max: 100,
2228
+ step: 1,
2229
+ unit: "%",
2230
+ defaultValue: 50,
2231
+ resetHint,
2232
+ onChange: setFrost
2233
+ }),
2234
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrismSlider, {
2235
+ label: t("prism.bgBrightness"),
2236
+ value: bgBrightness,
2237
+ min: 0,
2238
+ max: 100,
2239
+ step: 1,
2240
+ unit: "%",
2241
+ defaultValue: 50,
2242
+ resetHint,
2243
+ onChange: setBgBrightness
2244
+ }),
2245
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2246
+ className: PrismAppearancePanel_module_css_default.hint,
2247
+ children: dark ? t("prism.brightnessHintDark") : t("prism.brightnessHintLight")
2248
+ })
2249
+ ]
2250
+ })]
2251
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Section, {
2252
+ title: t("prism.zones"),
2253
+ description: t("prism.zonesDesc"),
2254
+ action: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrismButton, {
2255
+ variant: "quiet",
2256
+ onClick: resetZones,
2257
+ children: t("prism.resetZones")
2258
+ }),
2259
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2260
+ className: PrismAppearancePanel_module_css_default.controlsStack,
2261
+ children: Object.keys(zones).map((zone) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrismSlider, {
2262
+ label: t(`prism.zone${zone[0]?.toUpperCase() ?? ""}${zone.slice(1)}`),
2263
+ value: zones[zone],
2264
+ min: 20,
2265
+ max: 100,
2266
+ step: 1,
2267
+ unit: "%",
2268
+ defaultValue: 100,
2269
+ resetHint,
2270
+ onChange: (value) => {
2271
+ setZone(zone, value);
2272
+ }
2273
+ }, zone))
2274
+ })
2275
+ })] }),
2276
+ tab === "background" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
2277
+ title: t("prism.background"),
2278
+ description: t("prism.backgroundDesc"),
2279
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Segmented, {
2280
+ label: t("prism.background"),
2281
+ value: background,
2282
+ onSelect: setBackground,
2283
+ options: [{
2284
+ id: "aurora",
2285
+ label: t("prism.backgroundAurora")
2286
+ }, {
2287
+ id: "wallpaper",
2288
+ label: t("prism.backgroundWallpaper")
2289
+ }]
2290
+ }), background === "aurora" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2291
+ className: PrismAppearancePanel_module_css_default.controlsStack,
2292
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorControl, {
2293
+ label: t("prism.bgHue"),
2294
+ hexLabel: t("prism.colorHexLabel"),
2295
+ pickerLabel: t("prism.colorPickerLabel"),
2296
+ placeholder: t("prism.colorPlaceholder"),
2297
+ hue: bgHue,
2298
+ sat: bgSat,
2299
+ light: bgLight,
2300
+ onChange: setBgColor
2301
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrismSlider, {
2302
+ label: t("prism.motion"),
2303
+ value: motion,
2304
+ min: 0,
2305
+ max: 100,
2306
+ step: 1,
2307
+ unit: "%",
2308
+ defaultValue: 55,
2309
+ resetHint,
2310
+ onChange: setMotion
2311
+ })]
2312
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
2313
+ wallpaperRows("dark", wallpaperDark, "prism.wallpaperDark"),
2314
+ wallpaperRows("light", wallpaperLight, "prism.wallpaperLight"),
2315
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2316
+ className: PrismAppearancePanel_module_css_default.controlsStack,
2317
+ children: [
2318
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Segmented, {
2319
+ label: t("prism.wallpaperMode"),
2320
+ value: wallpaperLoop ? "loop" : "fixed",
2321
+ onSelect: (value) => {
2322
+ setWallpaperLoop(value === "loop");
2323
+ },
2324
+ options: [{
2325
+ id: "fixed",
2326
+ label: t("prism.wallpaperFixed")
2327
+ }, {
2328
+ id: "loop",
2329
+ label: t("prism.wallpaperLoop")
2330
+ }]
2331
+ }),
2332
+ wallpaperLoop && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrismSlider, {
2333
+ label: t("prism.wallpaperInterval"),
2334
+ value: wallpaperInterval,
2335
+ min: 5,
2336
+ max: 120,
2337
+ step: 5,
2338
+ unit: "s",
2339
+ defaultValue: 30,
2340
+ resetHint,
2341
+ onChange: setWallpaperInterval
2342
+ }),
2343
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrismSlider, {
2344
+ label: t("prism.wallpaperBlur"),
2345
+ value: wallpaperBlur,
2346
+ min: 0,
2347
+ max: 100,
2348
+ step: 1,
2349
+ unit: "%",
2350
+ defaultValue: 20,
2351
+ resetHint,
2352
+ onChange: setWallpaperBlur
2353
+ }),
2354
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrismSlider, {
2355
+ label: t("prism.wallpaperFrost"),
2356
+ value: wallpaperFrost,
2357
+ min: 0,
2358
+ max: 100,
2359
+ step: 1,
2360
+ unit: "%",
2361
+ defaultValue: 0,
2362
+ resetHint,
2363
+ onChange: setWallpaperFrost
2364
+ }),
2365
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2366
+ className: PrismAppearancePanel_module_css_default.hint,
2367
+ children: t("prism.wallpaperHint")
2368
+ })
2369
+ ]
2370
+ })
2371
+ ] })]
2372
+ }),
2373
+ tab === "type" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
2374
+ title: t("prism.font"),
2375
+ description: t("prism.fontDesc"),
2376
+ children: [
2377
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Segmented, {
2378
+ label: t("prism.font"),
2379
+ value: fontChoice,
2380
+ onSelect: setFontChoice,
2381
+ options: [
2382
+ {
2383
+ id: "system",
2384
+ label: t("prism.fontSystem")
2385
+ },
2386
+ {
2387
+ id: "rounded",
2388
+ label: t("prism.fontRounded")
2389
+ },
2390
+ {
2391
+ id: "serif",
2392
+ label: t("prism.fontSerif")
2393
+ },
2394
+ {
2395
+ id: "mono",
2396
+ label: t("prism.fontMono")
2397
+ },
2398
+ {
2399
+ id: "custom",
2400
+ label: t("prism.fontCustom")
2401
+ }
2402
+ ]
2403
+ }),
2404
+ fontChoice === "custom" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2405
+ className: PrismAppearancePanel_module_css_default.textInput,
2406
+ type: "text",
2407
+ value: customFont,
2408
+ "aria-label": t("prism.customFontLabel"),
2409
+ placeholder: t("prism.customFontPlaceholder"),
2410
+ onChange: (event) => {
2411
+ setCustomFont(event.target.value);
2412
+ }
2413
+ }),
2414
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrismSlider, {
2415
+ label: t("prism.fontSize"),
2416
+ value: fontScale,
2417
+ min: 85,
2418
+ max: 120,
2419
+ step: 1,
2420
+ unit: "%",
2421
+ defaultValue: 100,
2422
+ resetHint,
2423
+ onChange: setFontScale
2424
+ }),
2425
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2426
+ className: PrismAppearancePanel_module_css_default.fontPreview,
2427
+ style: { fontSize: `${String(14 * fontScale / 100)}px` },
2428
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2429
+ className: PrismAppearancePanel_module_css_default.fontPreviewAa,
2430
+ children: "Aa"
2431
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("prism.fontPreview") })]
2432
+ })
2433
+ ]
2434
+ })
2435
+ ]
2436
+ })] }),
2437
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2438
+ ref: wallpaperFileRef,
2439
+ className: PrismAppearancePanel_module_css_default.fileInput,
2440
+ type: "file",
2441
+ multiple: true,
2442
+ accept: "image/png,image/jpeg,image/webp,image/gif,image/avif,video/mp4,video/webm,video/quicktime",
2443
+ onChange: (event) => {
2444
+ onWallpaperFile(event);
2445
+ }
2446
+ }),
2447
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2448
+ ref: importFileRef,
2449
+ className: PrismAppearancePanel_module_css_default.fileInput,
2450
+ type: "file",
2451
+ accept: ".json,application/json",
2452
+ onChange: (event) => {
2453
+ onImportFile(event);
2454
+ }
2455
+ })
2456
+ ]
2457
+ });
2458
+ }
2459
+ // src/client/settings-store.ts
2460
+ /**
2461
+ * Prism row slot stores: mirrors of the layer's settings document. The
2462
+ * plugin's apply-world change listener is the only writer; the row components
2463
+ * read via props.useStore. DSH 0.2.2 uses one General appearance surface;
2464
+ * the master switch is mirrored through this same store.
2465
+ */
2466
+ /** The layer's first-seen state (before the first sync). */
2467
+ function initialState() {
2468
+ return {
2469
+ enabled: true,
2470
+ material: "frosted",
2471
+ blur: 18,
2472
+ frost: 50,
2473
+ zones: {
2474
+ base: 100,
2475
+ sidebar: 100,
2476
+ card: 100,
2477
+ input: 100,
2478
+ overlay: 100,
2479
+ bubble: 100
2480
+ },
2481
+ bgBrightness: 50,
2482
+ fontScale: 100,
2483
+ fontChoice: "system",
2484
+ customFont: "",
2485
+ inkLightHue: 222,
2486
+ inkLightSat: 30,
2487
+ inkLightLight: 12,
2488
+ inkDarkHue: 222,
2489
+ inkDarkSat: 30,
2490
+ inkDarkLight: 92,
2491
+ accentHue: 205,
2492
+ accentSat: 85,
2493
+ accentLight: 55,
2494
+ bgHue: 215,
2495
+ bgSat: 80,
2496
+ bgLight: 60,
2497
+ accentOpacity: 100,
2498
+ motion: 55,
2499
+ background: "aurora",
2500
+ wallpaperDark: [],
2501
+ wallpaperLight: [],
2502
+ wallpaperDimDark: [],
2503
+ wallpaperDimLight: [],
2504
+ wallpaperCycleDark: [],
2505
+ wallpaperCycleLight: [],
2506
+ wallpaperInterval: 30,
2507
+ wallpaperLoop: false,
2508
+ wallpaperPinnedDark: 0,
2509
+ wallpaperPinnedLight: 0,
2510
+ wallpaperBlur: 20,
2511
+ wallpaperFrost: 0,
2512
+ customThemes: [],
2513
+ dark: false,
2514
+ revision: -1
2515
+ };
2516
+ }
2517
+ /**
2518
+ * Declares the Prism row state and write surface.
2519
+ * @returns the store handle.
2520
+ */
2521
+ function createPrismRowStore() {
2522
+ return (0, _deepseek_ai_dsh_client_store.defineStore)({
2523
+ init: initialState,
2524
+ actions: { sync: (draft, next, revision) => {
2525
+ if (revision <= draft.revision) return;
2526
+ draft.enabled = next.enabled;
2527
+ draft.material = next.material;
2528
+ draft.blur = next.blur;
2529
+ draft.frost = next.frost;
2530
+ draft.zones = { ...next.zones };
2531
+ draft.bgBrightness = next.bgBrightness;
2532
+ draft.fontScale = next.fontScale;
2533
+ draft.fontChoice = next.fontChoice;
2534
+ draft.customFont = next.customFont;
2535
+ draft.inkLightHue = next.inkLightHue;
2536
+ draft.inkLightSat = next.inkLightSat;
2537
+ draft.inkLightLight = next.inkLightLight;
2538
+ draft.inkDarkHue = next.inkDarkHue;
2539
+ draft.inkDarkSat = next.inkDarkSat;
2540
+ draft.inkDarkLight = next.inkDarkLight;
2541
+ draft.accentHue = next.accentHue;
2542
+ draft.accentSat = next.accentSat;
2543
+ draft.accentLight = next.accentLight;
2544
+ draft.bgHue = next.bgHue;
2545
+ draft.bgSat = next.bgSat;
2546
+ draft.bgLight = next.bgLight;
2547
+ draft.accentOpacity = next.accentOpacity;
2548
+ draft.motion = next.motion;
2549
+ draft.background = next.background;
2550
+ draft.wallpaperDark = [...next.wallpaperDark];
2551
+ draft.wallpaperLight = [...next.wallpaperLight];
2552
+ draft.wallpaperDimDark = [...next.wallpaperDimDark];
2553
+ draft.wallpaperDimLight = [...next.wallpaperDimLight];
2554
+ draft.wallpaperCycleDark = [...next.wallpaperCycleDark];
2555
+ draft.wallpaperCycleLight = [...next.wallpaperCycleLight];
2556
+ draft.wallpaperInterval = next.wallpaperInterval;
2557
+ draft.wallpaperLoop = next.wallpaperLoop;
2558
+ draft.wallpaperPinnedDark = next.wallpaperPinnedDark;
2559
+ draft.wallpaperPinnedLight = next.wallpaperPinnedLight;
2560
+ draft.wallpaperBlur = next.wallpaperBlur;
2561
+ draft.wallpaperFrost = next.wallpaperFrost;
2562
+ draft.customThemes = next.customThemes.map((theme) => ({
2563
+ ...theme,
2564
+ values: {
2565
+ ...theme.values,
2566
+ zones: { ...theme.values.zones }
2567
+ }
2568
+ }));
2569
+ draft.dark = next.dark;
2570
+ draft.revision = revision;
2571
+ } }
2572
+ });
2573
+ }
2574
+ // src/client/locales.ts
2575
+ /** `settings.prism` namespace dictionaries (the settings-row copy). */
2576
+ /** Dictionary namespace owned by this plugin. */
2577
+ const NS = "settings.prism";
2578
+ /** Simplified Chinese dictionary (the key-set source of truth). */
2579
+ const zh = {
2580
+ "prism.title": "DSH Background",
2581
+ "prism.description": "上传自己的照片或 GIF 作为界面背景,自由调整毛玻璃、透明度、字体、颜色与动效",
2582
+ "prism.enable": "开启",
2583
+ "prism.disable": "关闭",
2584
+ "prism.material": "材质",
2585
+ "prism.materialClear": "清透",
2586
+ "prism.materialFrosted": "磨砂",
2587
+ "prism.materialVelvet": "毛绒",
2588
+ "prism.blur": "玻璃模糊度",
2589
+ "prism.frost": "磨砂感",
2590
+ "prism.zones": "区域透明度",
2591
+ "prism.zoneBase": "主背景",
2592
+ "prism.zoneSidebar": "侧边栏",
2593
+ "prism.zoneCard": "卡片面板",
2594
+ "prism.zoneInput": "输入框",
2595
+ "prism.zoneOverlay": "菜单弹层",
2596
+ "prism.zoneBubble": "聊天气泡",
2597
+ "prism.bgBrightness": "背景亮度",
2598
+ "prism.fontSize": "文字大小",
2599
+ "prism.font": "字体",
2600
+ "prism.fontSystem": "系统默认",
2601
+ "prism.fontRounded": "圆润黑体",
2602
+ "prism.fontSerif": "衬线",
2603
+ "prism.fontMono": "等宽",
2604
+ "prism.fontCustom": "自定义",
2605
+ "prism.customFontLabel": "自定义字体名称",
2606
+ "prism.customFontPlaceholder": "输入字体名,如 LXGW WenKai",
2607
+ "prism.colors": "颜色",
2608
+ "prism.colorPlaceholder": "#rrggbb",
2609
+ "prism.colorHexLabel": "十六进制值",
2610
+ "prism.colorPickerLabel": "取色器",
2611
+ "prism.inkHue": "亮色文字",
2612
+ "prism.inkDarkHue": "暗色文字",
2613
+ "prism.accentHue": "主题色",
2614
+ "prism.accentHint": "主题色同时用于强调元素与对话地标颜色",
2615
+ "prism.bgHue": "背景主色调",
2616
+ "prism.accentOpacity": "强调色透明度",
2617
+ "prism.motion": "动效强度",
2618
+ "prism.background": "背景",
2619
+ "prism.backgroundAurora": "流光动效",
2620
+ "prism.backgroundWallpaper": "自定义壁纸",
2621
+ "prism.wallpaperDark": "暗色壁纸",
2622
+ "prism.wallpaperLight": "亮色壁纸",
2623
+ "prism.chooseImage": "添加图片 / GIF / 视频",
2624
+ "prism.deleteWallpaper": "删除",
2625
+ "prism.manage": "管理",
2626
+ "prism.manageDone": "完成",
2627
+ "prism.wallpaperInterval": "轮播间隔",
2628
+ "prism.wallpaperMode": "播放模式",
2629
+ "prism.wallpaperFixed": "固定",
2630
+ "prism.wallpaperLoop": "循环",
2631
+ "prism.wallpaperPin": "固定",
2632
+ "prism.wallpaperPinHint": "点击某张图片即固定使用它;选择“循环”才自动轮播",
2633
+ "prism.wallpaperIntervalHint": "循环模式下只轮播标记为「轮播」的图片,按间隔自动切换并淡入淡出",
2634
+ "prism.cycleCount": "参与轮播",
2635
+ "prism.cycleAll": "全选",
2636
+ "prism.cycleNone": "全不选",
2637
+ "prism.cycleToggle": "参与轮播",
2638
+ "prism.cycleToggleHint": "勾选后加入轮播;取消后这张图片只在手动选择时使用",
2639
+ "prism.wallpaperPinWhileLooping": "轮播进行中不能固定单张;先关闭「循环」再点选固定背景",
2640
+ "prism.cycleOrder": "调整轮播顺序",
2641
+ "prism.cycleOrderHint": "拖动调整播放顺序;也可以用 ← → 键移动",
2642
+ "prism.cycleEmpty": "没有图片参与轮播;打开「循环」时会保持当前固定背景",
2643
+ "prism.wallpaperBlur": "壁纸模糊",
2644
+ "prism.wallpaperFrost": "壁纸磨砂",
2645
+ "prism.wallpaperHint": "支持照片、GIF 动图与 MP4/WebM 视频(视频静音循环播放);静态图自动压缩,图片上限 30MB、视频上限 40MB 且不超过 60 秒;暗色壁纸配暗色模式、亮色壁纸配亮色模式效果更佳",
2646
+ "prism.brightnessHintDark": "深色模式:0 压暗至纯黑,50 原样",
2647
+ "prism.brightnessHintLight": "浅色模式:50 原样,100 提亮至纯白",
2648
+ "prism.presets": "预设",
2649
+ "prism.presetNight": "夜航",
2650
+ "prism.presetAurora": "极光",
2651
+ "prism.presetCrystal": "清透",
2652
+ "prism.reset": "重置默认",
2653
+ "prism.errorSize": "文件过大(图片 30 MB / 视频 40 MB 或超过 60 秒)",
2654
+ "prism.errorRead": "文件读取失败",
2655
+ "prism.errorDecode": "图片无法解码",
2656
+ "prism.enabled": "启用 DSH Background",
2657
+ "prism.subtitle": "自定义背景图与毛玻璃主题。上传照片或 GIF,实时调整界面效果。",
2658
+ "prism.previewTitle": "你的下一段灵感",
2659
+ "prism.previewText": "清透的表面,恰好合适的层次。",
2660
+ "prism.previewInput": "开始输入…",
2661
+ "prism.tabTheme": "主题",
2662
+ "prism.tabGlass": "玻璃",
2663
+ "prism.tabBackground": "背景",
2664
+ "prism.tabType": "文字",
2665
+ "prism.presetsDesc": "完整搭配好的色彩与材质,点击即可应用。",
2666
+ "prism.presetDune": "暖沙",
2667
+ "prism.presetRose": "雾玫瑰",
2668
+ "prism.presetForest": "深林",
2669
+ "prism.customThemes": "我的主题",
2670
+ "prism.customThemesDesc": "保存当前搭配,或与他人交换轻量主题文件。主题不包含壁纸图片。",
2671
+ "prism.themeNamePlaceholder": "为主题命名",
2672
+ "prism.saveTheme": "保存当前",
2673
+ "prism.importTheme": "导入",
2674
+ "prism.exportTheme": "导出当前",
2675
+ "prism.noCustomThemes": "还没有保存的主题。调好颜色后,给它一个名字。",
2676
+ "prism.applyTheme": "应用",
2677
+ "prism.deleteTheme": "删除",
2678
+ "prism.themeSaved": "主题已保存。",
2679
+ "prism.themeImported": "主题已导入并应用。",
2680
+ "prism.themeDeleted": "主题已删除。",
2681
+ "prism.themeExported": "主题文件已导出。",
2682
+ "prism.themeImportFailed": "无法导入:请选择有效的 DSH Background 主题 JSON 文件。",
2683
+ "prism.themeLimit": "最多保存 24 套主题;请先删除一套再保存。",
2684
+ "prism.themePersistFailed": "保存失败:浏览器存储空间不足或不可用,请重试。",
2685
+ "prism.resetAll": "恢复默认",
2686
+ "prism.resetZones": "重置分区",
2687
+ "prism.sliderResetHint": "双击或按 Delete 恢复此项默认值",
2688
+ "prism.materialDesc": "同一种色彩,也可以有完全不同的触感。",
2689
+ "prism.colorsDesc": "强调色用于按钮、选中和焦点;文字颜色按明暗模式独立调整。",
2690
+ "prism.zonesDesc": "分别控制六个界面的通透程度。双击滑块或按 Delete 可恢复单项默认值。",
2691
+ "prism.fontDesc": "字体与字号会应用到整个工作区。",
2692
+ "prism.backgroundDesc": "选择流动的极光,或自己的静态、动态壁纸。",
2693
+ "prism.fontPreview": "清晰的文字,让复杂的工作保持轻盈。 0123456789",
2694
+ "prism.wallpaperEmpty": "尚未添加壁纸",
2695
+ "prism.wallpaperBatch": "已添加 {n} 个,{m} 个未收录(超出大小/时长上限或格式不支持)",
2696
+ "prism.errorNone": ""
2697
+ };
2698
+ /** English dictionary. */
2699
+ const en = {
2700
+ "prism.title": "DSH Background",
2701
+ "prism.description": "Upload your own photos or GIFs as interface backgrounds, then tune glass, opacity, typography, colors, and motion",
2702
+ "prism.enable": "On",
2703
+ "prism.disable": "Off",
2704
+ "prism.material": "Material",
2705
+ "prism.materialClear": "Clear",
2706
+ "prism.materialFrosted": "Frosted",
2707
+ "prism.materialVelvet": "Velvet",
2708
+ "prism.blur": "Glass blur",
2709
+ "prism.frost": "Frost",
2710
+ "prism.zones": "Zone opacity",
2711
+ "prism.zoneBase": "Base",
2712
+ "prism.zoneSidebar": "Sidebar",
2713
+ "prism.zoneCard": "Cards",
2714
+ "prism.zoneInput": "Input",
2715
+ "prism.zoneOverlay": "Overlays",
2716
+ "prism.zoneBubble": "Bubbles",
2717
+ "prism.bgBrightness": "Background brightness",
2718
+ "prism.fontSize": "Text size",
2719
+ "prism.font": "Font",
2720
+ "prism.fontSystem": "System",
2721
+ "prism.fontRounded": "Rounded CJK",
2722
+ "prism.fontSerif": "Serif",
2723
+ "prism.fontMono": "Monospace",
2724
+ "prism.fontCustom": "Custom",
2725
+ "prism.customFontLabel": "Custom font family",
2726
+ "prism.customFontPlaceholder": "Font family name, e.g. LXGW WenKai",
2727
+ "prism.colors": "Colors",
2728
+ "prism.colorPlaceholder": "#rrggbb",
2729
+ "prism.colorHexLabel": "Hex value",
2730
+ "prism.colorPickerLabel": "Color picker",
2731
+ "prism.inkHue": "Light-mode text",
2732
+ "prism.inkDarkHue": "Dark-mode text",
2733
+ "prism.accentHue": "Theme color",
2734
+ "prism.accentHint": "The theme color drives accents and conversation landmarks",
2735
+ "prism.bgHue": "Backdrop hue",
2736
+ "prism.accentOpacity": "Accent opacity",
2737
+ "prism.motion": "Motion",
2738
+ "prism.background": "Backdrop",
2739
+ "prism.backgroundAurora": "Aurora",
2740
+ "prism.backgroundWallpaper": "Wallpaper",
2741
+ "prism.wallpaperDark": "Dark wallpapers",
2742
+ "prism.wallpaperLight": "Light wallpapers",
2743
+ "prism.chooseImage": "Add image / GIF / video",
2744
+ "prism.deleteWallpaper": "Delete",
2745
+ "prism.manage": "Manage",
2746
+ "prism.manageDone": "Done",
2747
+ "prism.wallpaperInterval": "Rotation interval",
2748
+ "prism.wallpaperMode": "Playback",
2749
+ "prism.wallpaperFixed": "Fixed",
2750
+ "prism.wallpaperLoop": "Loop",
2751
+ "prism.wallpaperPin": "Pin",
2752
+ "prism.wallpaperPinHint": "Click an image to pin it; choose Loop to rotate automatically",
2753
+ "prism.wallpaperIntervalHint": "In loop mode only images marked for rotation play, crossfading at the interval",
2754
+ "prism.cycleCount": "In carousel",
2755
+ "prism.cycleAll": "Select all",
2756
+ "prism.cycleNone": "Select none",
2757
+ "prism.cycleToggle": "In the carousel",
2758
+ "prism.cycleToggleHint": "Checked images rotate in the carousel; unchecked ones stay for manual use",
2759
+ "prism.wallpaperPinWhileLooping": "Pinning needs the carousel turned off; pause Loop first",
2760
+ "prism.cycleOrder": "Reorder carousel",
2761
+ "prism.cycleOrderHint": "Drag to change the playback order, or move it with the arrow keys",
2762
+ "prism.cycleEmpty": "No image is in the carousel; Loop keeps the current pinned background",
2763
+ "prism.wallpaperBlur": "Wallpaper blur",
2764
+ "prism.wallpaperFrost": "Wallpaper frost",
2765
+ "prism.wallpaperHint": "Photos, animated GIFs, and MP4/WebM clips (played muted on a loop) are supported; static images are compressed, images cap at 30MB and clips at 40MB and 60 seconds; pair dark wallpapers with dark mode and light wallpapers with light mode",
2766
+ "prism.brightnessHintDark": "Dark mode: 0 fades to pure black, 50 is unchanged",
2767
+ "prism.brightnessHintLight": "Light mode: 50 is unchanged, 100 brightens to pure white",
2768
+ "prism.presets": "Presets",
2769
+ "prism.presetNight": "Night Drive",
2770
+ "prism.presetAurora": "Aurora",
2771
+ "prism.presetCrystal": "Crystal",
2772
+ "prism.reset": "Reset",
2773
+ "prism.errorSize": "File too large (30 MB for images, 40 MB or 60 s for clips)",
2774
+ "prism.errorRead": "File read failed",
2775
+ "prism.errorDecode": "Image could not be decoded",
2776
+ "prism.enabled": "Enable DSH Background",
2777
+ "prism.subtitle": "Custom background images and glassmorphism. Upload a photo or GIF and tune the interface live.",
2778
+ "prism.previewTitle": "Your next idea",
2779
+ "prism.previewText": "Clear surfaces, just the right amount of depth.",
2780
+ "prism.previewInput": "Start typing…",
2781
+ "prism.tabTheme": "Themes",
2782
+ "prism.tabGlass": "Glass",
2783
+ "prism.tabBackground": "Backdrop",
2784
+ "prism.tabType": "Type",
2785
+ "prism.presetsDesc": "Coordinated palettes and materials, ready to apply.",
2786
+ "prism.presetDune": "Dune",
2787
+ "prism.presetRose": "Mist Rose",
2788
+ "prism.presetForest": "Forest",
2789
+ "prism.customThemes": "My themes",
2790
+ "prism.customThemesDesc": "Save this look or exchange lightweight theme files. Wallpaper images are not included.",
2791
+ "prism.themeNamePlaceholder": "Name this theme",
2792
+ "prism.saveTheme": "Save current",
2793
+ "prism.importTheme": "Import",
2794
+ "prism.exportTheme": "Export current",
2795
+ "prism.noCustomThemes": "No saved themes yet. Find a look you love, then give it a name.",
2796
+ "prism.applyTheme": "Apply",
2797
+ "prism.deleteTheme": "Delete",
2798
+ "prism.themeSaved": "Theme saved.",
2799
+ "prism.themeImported": "Theme imported and applied.",
2800
+ "prism.themeDeleted": "Theme deleted.",
2801
+ "prism.themeExported": "Theme file exported.",
2802
+ "prism.themeImportFailed": "Could not import. Choose a valid DSH Background theme JSON file.",
2803
+ "prism.themeLimit": "You can save up to 24 themes. Delete one before saving another.",
2804
+ "prism.themePersistFailed": "Could not save because browser storage is full or unavailable. Try again.",
2805
+ "prism.resetAll": "Restore defaults",
2806
+ "prism.resetZones": "Reset zones",
2807
+ "prism.sliderResetHint": "Double-click or press Delete to restore this setting",
2808
+ "prism.materialDesc": "The same palette can have an entirely different texture.",
2809
+ "prism.colorsDesc": "Accent colors shape actions and focus. Text ink is independent for light and dark modes.",
2810
+ "prism.zonesDesc": "Tune transparency for six interface zones. Double-click a slider or press Delete to reset it.",
2811
+ "prism.fontDesc": "Font family and size apply across the workspace.",
2812
+ "prism.backgroundDesc": "Choose a living aurora or your own still and animated wallpapers.",
2813
+ "prism.fontPreview": "Clear type keeps complex work feeling light. 0123456789",
2814
+ "prism.wallpaperEmpty": "No wallpapers yet",
2815
+ "prism.wallpaperBatch": "Added {n}; skipped {m} (over the size/duration cap or unsupported format)",
2816
+ "prism.errorNone": ""
2817
+ };
2818
+ // src/client/fonts.ts
2819
+ /** The complete composite-font inventory (source: ui-theme gradient-shadow-text.css). */
2820
+ const FONT_ENTRIES = Object.freeze([
2821
+ ["--dsw-font-markdown-h1", "700 24px/34px var(--dsw-font-family)"],
2822
+ ["--dsw-font-markdown-h2", "700 22px/32px var(--dsw-font-family)"],
2823
+ ["--dsw-font-markdown-h3", "700 20px/30px var(--dsw-font-family)"],
2824
+ ["--dsw-font-markdown-h4", "600 16px/28px var(--dsw-font-family)"],
2825
+ ["--dsw-font-markdown-base", "16px/28px var(--dsw-font-family)"],
2826
+ ["--dsw-font-markdown-base-strong", "600 16px/28px var(--dsw-font-family)"],
2827
+ ["--dsw-font-markdown-base-italic", "italic 16px/28px var(--dsw-font-family)"],
2828
+ ["--dsw-font-markdown-base-strong-italic", "italic 600 16px/28px var(--dsw-font-family)"],
2829
+ ["--dsw-font-markdown-table", "15px/25px var(--dsw-font-family)"],
2830
+ ["--dsw-font-markdown-table-head", "500 15px/25px var(--dsw-font-family)"],
2831
+ ["--dsw-font-markdown-small", "14px/24px var(--dsw-font-family)"],
2832
+ ["--dsw-font-markdown-small-strong", "600 14px/24px var(--dsw-font-family)"],
2833
+ ["--dsw-font-markdown-small-italic", "italic 14px/24px var(--dsw-font-family)"],
2834
+ ["--dsw-font-markdown-small-strong-italic", "italic 600 14px/24px var(--dsw-font-family)"],
2835
+ ["--dsw-font-markdown-code", "14px/22px var(--ds-font-family-code)"],
2836
+ ["--dsw-font-markdown-code-block", "13px/22px var(--ds-font-family-code)"],
2837
+ ["--dsw-font-markdown-code-block-small", "12px/18px var(--ds-font-family-code)"],
2838
+ ["--dsw-font-xl-24", "600 24px/32px var(--dsw-font-family)"],
2839
+ ["--dsw-font-l-20", "500 20px/28px var(--dsw-font-family)"],
2840
+ ["--dsw-font-m-18", "500 16px/28px var(--dsw-font-family)"],
2841
+ ["--dsw-font-base-16", "16px/24px var(--dsw-font-family)"],
2842
+ ["--dsw-font-base-strong-16", "500 16px/24px var(--dsw-font-family)"],
2843
+ ["--dsw-font-s-14", "14px/22px var(--dsw-font-family)"],
2844
+ ["--dsw-font-s-strong-14", "500 14px/22px var(--dsw-font-family)"],
2845
+ ["--dsw-font-xs-13", "13px/20px var(--dsw-font-family)"],
2846
+ ["--dsw-font-xs-strong-13", "500 13px/20px var(--dsw-font-family)"],
2847
+ ["--dsw-font-xxs-12", "12px/18px var(--dsw-font-family)"],
2848
+ ["--dsw-font-xxs-strong-12", "500 12px/18px var(--dsw-font-family)"],
2849
+ ["--dsw-font-xxxs-11", "11px/14px var(--dsw-font-family)"],
2850
+ ["--dsw-font-xxxs-strong-11", "500 11px/14px var(--dsw-font-family)"]
2851
+ ]);
2852
+ /** Matches the size/line-height pair inside a font shorthand. */
2853
+ const PX_PAIR = /(\d+)px\/(\d+)px/;
2854
+ /** Scheme-invariant token pair (font values never differ per scheme). */
2855
+ function both(value) {
2856
+ return {
2857
+ light: value,
2858
+ dark: value
2859
+ };
2860
+ }
2861
+ /**
2862
+ * Rewrite a stock shorthand's size/line-height pair into scale-aware calc()
2863
+ * expressions.
2864
+ * @param shorthand - the stock shorthand string.
2865
+ * @returns the same string with both px values replaced by calc().
2866
+ */
2867
+ function scaleShorthand(shorthand) {
2868
+ return shorthand.replace(PX_PAIR, (_match, size, lineHeight) => `calc(${size}px * var(--prism-font-scale)) / calc(${lineHeight}px * var(--prism-font-scale))`);
2869
+ }
2870
+ /**
2871
+ * Build the complete font-scale override layer: every shorthand plus its
2872
+ * `-font-size` / `-line-height` members, all scheme-invariant.
2873
+ * @returns token-name → { light, dark } override dictionary.
2874
+ */
2875
+ function buildFontOverrides() {
2876
+ const out = {};
2877
+ for (const [name, shorthand] of FONT_ENTRIES) {
2878
+ const match = PX_PAIR.exec(shorthand);
2879
+ if (match === null) continue;
2880
+ const [, size, lineHeight] = match;
2881
+ out[name] = both(scaleShorthand(shorthand));
2882
+ out[`${name}-font-size`] = both(`calc(${size}px * var(--prism-font-scale))`);
2883
+ out[`${name}-line-height`] = both(`calc(${lineHeight}px * var(--prism-font-scale))`);
2884
+ }
2885
+ return out;
2886
+ }
2887
+ // src/client/tokens.ts
2888
+ /** Scheme-paired override value. */
2889
+ function pair(light, dark) {
2890
+ return {
2891
+ light,
2892
+ dark
2893
+ };
2894
+ }
2895
+ /** The full user accent color, applied verbatim (both modes). */
2896
+ const accentColor = () => pair("hsl(var(--prism-accent-h) var(--prism-accent-s) var(--prism-accent-l) / var(--prism-accent-a, 1))", "hsl(var(--prism-accent-h) var(--prism-accent-s) var(--prism-accent-l) / var(--prism-accent-a, 1))");
2897
+ /** Contrast-scaled secondary ink: strong ink toward weak gray as contrast
2898
+ * falls; light mode mixes dark ink, dark mode mixes light ink. */
2899
+ function ink(lightStrong, lightWeak, darkStrong, darkWeak, strongPct, weakPct) {
2900
+ const strongShare = `calc(${strongPct} + (1 - ${strongPct} - ${weakPct}) * 0.5)`;
2901
+ const weakShare = `calc(${weakPct} + (1 - ${strongPct} - ${weakPct}) * (1 - 0.5))`;
2902
+ return pair(`color-mix(in srgb, ${lightStrong} ${strongShare}, ${lightWeak} ${weakShare})`, `color-mix(in srgb, ${darkStrong} ${strongShare}, ${darkWeak} ${weakShare})`);
2903
+ }
2904
+ /**
2905
+ * Build the complete Prism token layer. Values are static strings; the
2906
+ * dynamic knobs arrive through `--prism-*` variables written by the layer.
2907
+ * @returns token-name → { light, dark } override dictionary.
2908
+ */
2909
+ function buildTokenOverrides() {
2910
+ return {
2911
+ "--dsw-font-family": pair("var(--prism-font-family)", "var(--prism-font-family)"),
2912
+ "--ds-font-family-code": pair("var(--prism-code-family)", "var(--prism-code-family)"),
2913
+ "--dsw-alias-bg-base": pair("#F2F6FC", "#0A0F16"),
2914
+ "--dsw-alias-bg-layer-1": pair("rgb(255 255 255 / calc(0.9 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-base, 1)))", "rgb(34 38 47 / calc(0.9 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-base, 1)))"),
2915
+ "--dsw-alias-bg-layer-2": pair("rgb(255 255 255 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))", "rgb(34 38 47 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))"),
2916
+ "--dsw-alias-bg-layer-3": pair("rgb(255 255 255 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))", "rgb(34 38 47 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))"),
2917
+ "--dsw-alias-bg-overlay": pair("rgb(255 255 255 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-overlay, 1)))", "rgb(34 38 47 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-overlay, 1)))"),
2918
+ "--dsw-alias-bg-module-platform": pair("rgb(255 255 255 / calc(0.8 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-base, 1)))", "rgb(34 38 47 / calc(0.8 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-base, 1)))"),
2919
+ "--dsw-alias-bg-multi-select": pair("rgb(255 255 255 / calc(0.8 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))", "rgb(34 38 47 / calc(0.8 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))"),
2920
+ "--dsw-alias-bg-skeleton": pair("rgb(19 45 83 / calc(0.06 * var(--prism-frost)))", "rgb(148 180 220 / calc(0.10 * var(--prism-frost)))"),
2921
+ "--dsw-alias-card-fill": pair("rgb(255 255 255 / calc(0.78 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))", "rgb(34 38 47 / calc(0.78 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))"),
2922
+ "--dsw-alias-card-fill-hover": pair("rgb(255 255 255 / calc(0.88 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))", "rgb(34 38 47 / calc(0.88 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))"),
2923
+ "--dsw-alias-card-tile-fill": pair("rgb(255 255 255 / calc(0.55 * var(--prism-frost)))", "rgb(255 255 255 / calc(0.06 * var(--prism-frost)))"),
2924
+ "--dsw-alias-border-l1": pair("rgb(19 45 83 / calc(0.05 + 0.07 * 0.5))", "rgb(148 180 220 / calc(0.06 + 0.08 * 0.5))"),
2925
+ "--dsw-alias-border-l2": pair("rgb(19 45 83 / calc(0.09 + 0.09 * 0.5))", "rgb(148 180 220 / calc(0.11 + 0.10 * 0.5))"),
2926
+ "--dsw-alias-border-l2-darkmode-thin": pair("rgb(19 45 83 / calc(0.06 + 0.06 * 0.5))", "rgb(148 180 220 / calc(0.07 + 0.07 * 0.5))"),
2927
+ "--dsw-alias-border-l3": pair("rgb(19 45 83 / calc(0.14 + 0.10 * 0.5))", "rgb(148 180 220 / calc(0.17 + 0.11 * 0.5))"),
2928
+ "--dsw-alias-border-l4": pair("rgb(19 45 83 / calc(0.20 + 0.12 * 0.5))", "rgb(148 180 220 / calc(0.23 + 0.12 * 0.5))"),
2929
+ "--dsw-alias-border-inverted": pair("rgb(19 45 83 / 0.06)", "rgb(148 180 220 / calc(0.10 * var(--prism-frost)))"),
2930
+ "--dsw-alias-border-inverted2": pair("rgb(19 45 83 / 0.08)", "rgb(148 180 220 / calc(0.12 * var(--prism-frost)))"),
2931
+ "--dsw-alias-border-selected": accentColor(),
2932
+ "--dsw-alias-brand-primary": accentColor(),
2933
+ "--dsw-alias-brand-primary-new-colorprimary-new-color": accentColor(),
2934
+ "--dsw-alias-brand-text": pair("hsl(var(--prism-ink-light-h) var(--prism-ink-light-s) var(--prism-ink-light-l))", "hsl(var(--prism-ink-dark-h) var(--prism-ink-dark-s) var(--prism-ink-dark-l))"),
2935
+ "--dsw-alias-brand-primary-invert": pair("#FFFFFF", "#0A0F16"),
2936
+ "--dsw-alias-state-business-primary": accentColor(),
2937
+ "--dsw-alias-state-business-tertiary": pair("hsl(var(--prism-accent-h) var(--prism-accent-s) 90%)", "hsl(var(--prism-accent-h) var(--prism-accent-s) 22%)"),
2938
+ "--dsw-alias-trajectory-accent": accentColor(),
2939
+ "--dsw-alias-button-primary-fill": accentColor(),
2940
+ "--dsw-alias-button-primary-hover": accentColor(),
2941
+ "--dsw-alias-button-primary-dimmed": pair("hsl(var(--prism-accent-h) var(--prism-accent-s) 90%)", "hsl(var(--prism-accent-h) var(--prism-accent-s) 22%)"),
2942
+ "--dsw-alias-button-info-fill": accentColor(),
2943
+ "--dsw-alias-button-info-hover": accentColor(),
2944
+ "--dsw-alias-button-elevated-fill": pair("rgb(255 255 255 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))", "rgb(34 38 47 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))"),
2945
+ "--dsw-alias-button-floating-fill": pair("rgb(255 255 255 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))", "rgb(34 38 47 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))"),
2946
+ "--dsw-alias-button-floating-hover": pair("rgb(240 245 251 / calc(0.9 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))", "rgb(40 45 60 / calc(0.9 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))"),
2947
+ "--dsw-alias-button-contrast-fill": pair("#26364D", "#EAF2FC"),
2948
+ "--dsw-alias-button-ghost-active-fill": pair("hsl(var(--prism-accent-h) var(--prism-accent-s) 90% / calc(0.9 * var(--prism-frost)))", "hsl(var(--prism-accent-h) var(--prism-accent-s) 26% / calc(0.9 * var(--prism-frost)))"),
2949
+ "--dsw-alias-button-ghost-active-hover": pair("hsl(var(--prism-accent-h) var(--prism-accent-s) 92% / calc(0.9 * var(--prism-frost)))", "hsl(var(--prism-accent-h) var(--prism-accent-s) 30% / calc(0.9 * var(--prism-frost)))"),
2950
+ "--dsw-alias-button-ghost-active-border": pair("rgb(143 163 188 / 0.8)", "rgb(107 130 159 / 0.8)"),
2951
+ "--dsw-alias-interactive-bg-hover": pair("hsl(var(--prism-accent-h) var(--prism-accent-s) 55% / calc(0.08 * var(--prism-accent-a, 1)))", "hsl(var(--prism-accent-h) var(--prism-accent-s) 65% / calc(0.10 * var(--prism-accent-a, 1)))"),
2952
+ "--dsw-alias-interactive-bg-hover-accent": pair("hsl(var(--prism-accent-h) var(--prism-accent-s) 55% / calc(0.14 * var(--prism-accent-a, 1)))", "hsl(var(--prism-accent-h) var(--prism-accent-s) 65% / calc(0.20 * var(--prism-accent-a, 1)))"),
2953
+ "--dsw-alias-interactive-bg-active": pair("hsl(var(--prism-accent-h) var(--prism-accent-s) 55% / calc(0.20 * var(--prism-accent-a, 1)))", "hsl(var(--prism-accent-h) var(--prism-accent-s) 65% / calc(0.26 * var(--prism-accent-a, 1)))"),
2954
+ "--dsw-alias-interactive-bg-hover-danger": pair("rgb(236 19 19 / 0.05)", "rgb(242 90 90 / 0.14)"),
2955
+ "--dsw-alias-interactive-bg-hover-solid": pair("rgb(240 245 251 / calc(0.9 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))", "rgb(40 45 60 / calc(0.9 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))"),
2956
+ "--dsw-alias-label-primary": pair("hsl(var(--prism-ink-light-h) var(--prism-ink-light-s) var(--prism-ink-light-l))", "hsl(var(--prism-ink-dark-h) var(--prism-ink-dark-s) var(--prism-ink-dark-l))"),
2957
+ "--dsw-alias-label-secondary": ink("hsl(var(--prism-ink-light-h) var(--prism-ink-light-s) var(--prism-ink-light-l))", "rgb(120 128 140)", "hsl(var(--prism-ink-dark-h) var(--prism-ink-dark-s) var(--prism-ink-dark-l))", "rgb(120 128 140)", "0.45", "0.00"),
2958
+ "--dsw-alias-label-tertiary": ink("hsl(var(--prism-ink-light-h) var(--prism-ink-light-s) var(--prism-ink-light-l))", "rgb(120 128 140)", "hsl(var(--prism-ink-dark-h) var(--prism-ink-dark-s) var(--prism-ink-dark-l))", "rgb(120 128 140)", "0.30", "0.00"),
2959
+ "--dsw-alias-label-caption": ink("hsl(var(--prism-ink-light-h) var(--prism-ink-light-s) var(--prism-ink-light-l))", "rgb(120 128 140)", "hsl(var(--prism-ink-dark-h) var(--prism-ink-dark-s) var(--prism-ink-dark-l))", "rgb(120 128 140)", "0.20", "0.00"),
2960
+ "--dsw-alias-label-primary-dimmed": pair("#1E3556", "#D7E3F4"),
2961
+ "--dsw-alias-label-primary-bluish": pair("#2E5EB8", "#BFD6F6"),
2962
+ "--dsw-alias-label-primary-inverted": pair("#FFFFFF", "#162130"),
2963
+ "--dsw-alias-label-primary-foreground": pair("#FFFFFF", "#FFFFFF"),
2964
+ "--dsw-alias-label-dimmed": pair("rgb(201 212 226 / calc(0.5 + 0.4 * 0.5))", "rgb(78 95 118 / calc(0.5 + 0.4 * 0.5))"),
2965
+ "--dsw-alias-markdown-code-block": pair("rgb(240 245 251 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))", "rgb(13 20 31 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))"),
2966
+ "--dsw-alias-markdown-code-block-banner": pair("rgb(245 248 253 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))", "rgb(18 27 41 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))"),
2967
+ "--dsw-alias-markdown-inline-code": pair("rgb(228 237 248 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))", "rgb(23 35 52 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))"),
2968
+ "--dsw-alias-markdown-citation": pair("rgb(255 255 255 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))", "rgb(26 37 52 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))"),
2969
+ "--dsw-alias-markdown-tag": pair("rgb(228 237 248 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))", "rgb(22 33 48 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))"),
2970
+ "--dsw-alias-markdown-placeholder": pair("rgb(255 255 255 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))", "rgb(34 38 47 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))"),
2971
+ "--dsw-alias-markdown-code-segment-selected": pair("#FFFFFF", "#1C2A3D"),
2972
+ "--dsw-alias-markdown-code-segment-unselected": pair("#F0F5FB", "#0F1723"),
2973
+ "--dsw-alias-scrollbar-bg-l1": pair("hsl(var(--prism-accent-h) var(--prism-accent-s) 60% / calc(0.28 * var(--prism-accent-a, 1)))", "hsl(var(--prism-accent-h) var(--prism-accent-s) 60% / calc(0.28 * var(--prism-accent-a, 1)))"),
2974
+ "--dsw-alias-scrollbar-bg-l2": pair("hsl(var(--prism-accent-h) var(--prism-accent-s) 55% / calc(0.4 * var(--prism-accent-a, 1)))", "hsl(var(--prism-accent-h) var(--prism-accent-s) 60% / calc(0.36 * var(--prism-accent-a, 1)))"),
2975
+ "--dsw-alias-scrollbar-hover-l1": pair("hsl(var(--prism-accent-h) var(--prism-accent-s) 50% / calc(0.5 * var(--prism-accent-a, 1)))", "hsl(var(--prism-accent-h) var(--prism-accent-s) 65% / calc(0.44 * var(--prism-accent-a, 1)))"),
2976
+ "--dsw-alias-scrollbar-hover-l2": pair("hsl(var(--prism-accent-h) var(--prism-accent-s) 45% / calc(0.6 * var(--prism-accent-a, 1)))", "hsl(var(--prism-accent-h) var(--prism-accent-s) 68% / calc(0.52 * var(--prism-accent-a, 1)))"),
2977
+ "--dsw-specific-sidebar-fill": pair("transparent", "transparent"),
2978
+ "--dsw-specific-sidebar-tint": pair("rgb(255 255 255 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-sidebar, 1)))", "rgb(34 38 47 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-sidebar, 1)))"),
2979
+ "--dsw-specific-sidebar-wash-top": pair("transparent", "transparent"),
2980
+ "--dsw-specific-sidebar-wash-top-clear": pair("transparent", "transparent"),
2981
+ "--dsw-specific-sidebar-wash-bottom": pair("transparent", "transparent"),
2982
+ "--dsw-specific-sidebar-wash-bottom-clear": pair("transparent", "transparent"),
2983
+ "--dsw-specific-sidebar-nav-item-active": pair("hsl(var(--prism-accent-h) var(--prism-accent-s) 92% / calc(0.9 * var(--prism-frost)))", "hsl(var(--prism-accent-h) var(--prism-accent-s) 26% / calc(0.9 * var(--prism-frost)))"),
2984
+ "--dsw-specific-sidebar-nav-item-hover": pair("hsl(var(--prism-accent-h) var(--prism-accent-s) 94% / calc(0.7 * var(--prism-frost)))", "hsl(var(--prism-accent-h) var(--prism-accent-s) 22% / calc(0.7 * var(--prism-frost)))"),
2985
+ "--dsw-specific-sidebar-nav-item-active-accent": accentColor(),
2986
+ "--dsw-specific-sidebar-glass-fill": pair("hsl(var(--prism-accent-h) var(--prism-accent-s) 96% / calc(0.45 * var(--prism-frost)))", "hsl(var(--prism-accent-h) var(--prism-accent-s) 18% / calc(0.45 * var(--prism-frost)))"),
2987
+ "--dsw-specific-sidebar-glass-hover": pair("hsl(var(--prism-accent-h) var(--prism-accent-s) 94% / calc(0.7 * var(--prism-frost)))", "hsl(var(--prism-accent-h) var(--prism-accent-s) 22% / calc(0.7 * var(--prism-frost)))"),
2988
+ "--dsw-specific-sidebar-glass-collapsed-fill": pair("transparent", "transparent"),
2989
+ "--dsw-specific-sidebar-glass-collapsed-hover": pair("hsl(var(--prism-accent-h) var(--prism-accent-s) 94% / calc(0.7 * var(--prism-frost)))", "hsl(var(--prism-accent-h) var(--prism-accent-s) 22% / calc(0.7 * var(--prism-frost)))"),
2990
+ "--dsw-specific-bubble": pair("rgb(255 255 255 / calc(0.9 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-bubble, 1)))", "rgb(34 38 47 / calc(0.9 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-bubble, 1)))"),
2991
+ "--dsw-specific-bubble-highlight": pair("rgb(255 255 255 / calc(0.9 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-bubble, 1)))", "rgb(34 38 47 / calc(0.9 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-bubble, 1)))"),
2992
+ "--dsw-specific-input-major": pair("rgb(255 255 255 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-input, 1)))", "rgb(34 38 47 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-input, 1)))"),
2993
+ "--dsw-specific-file-upload-track": pair("rgb(19 45 83 / 0.08)", "rgb(148 180 220 / 0.12)"),
2994
+ "--dsw-specific-login-input": pair("rgb(255 255 255 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-input, 1)))", "rgb(34 38 47 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-input, 1)))"),
2995
+ "--dsw-specific-menu": pair("rgb(255 255 255 / calc(0.88 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-overlay, 1)))", "rgb(34 38 47 / calc(0.88 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-overlay, 1)))"),
2996
+ "--dsw-alias-hovercard-bg": pair("rgb(255 255 255 / calc(0.88 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-overlay, 1)))", "rgb(34 38 47 / calc(0.88 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-overlay, 1)))"),
2997
+ "--dsw-specific-selector": pair("rgb(255 255 255 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-overlay, 1)))", "rgb(34 38 47 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-overlay, 1)))"),
2998
+ "--dsw-specific-tip": pair("rgb(255 255 255 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))", "rgb(34 38 47 / calc(0.85 * var(--prism-frost) * var(--prism-depth, 1) * var(--prism-zone-card, 1)))"),
2999
+ "--dsw-alias-toast-bg": pair("#1B3256", "#1C2A3D"),
3000
+ "--dsw-alias-tooltip-bg": pair("#13243E", "#162130"),
3001
+ "--dsw-shadow-lv1": pair("0 2px 4px rgb(19 45 83 / calc(0.05 + 0.05 * var(--prism-frost)))", "0 2px 4px rgb(2 6 14 / calc(0.4 + 0.1 * var(--prism-frost)))"),
3002
+ "--dsw-shadow-lv2": pair("0 4px 12px rgb(19 45 83 / calc(0.05 + 0.05 * var(--prism-frost))), 0 2px 8px rgb(19 45 83 / 0.06)", "0 4px 12px rgb(2 6 14 / calc(0.35 + 0.1 * var(--prism-frost))), 0 2px 8px rgb(2 6 14 / 0.35)"),
3003
+ "--dsw-shadow-lv3": pair("0 0 1px rgb(19 45 83 / 0.08), 0 12px 32px rgb(19 45 83 / calc(0.1 + 0.06 * var(--prism-frost)))", "0 0 1px rgb(2 6 14 / 0.6), 0 12px 32px rgb(2 6 14 / calc(0.45 + 0.1 * var(--prism-frost)))")
3004
+ };
3005
+ }
3006
+ /** Simulation step cap, seconds (substepped for stability). */
3007
+ const SPRING_STEP = 1 / 120;
3008
+ /**
3009
+ * Create a spring resting exactly on a value.
3010
+ * @param target - initial position.
3011
+ * @returns a settled spring state.
3012
+ */
3013
+ function createSpring(target) {
3014
+ return {
3015
+ position: target,
3016
+ velocity: 0
3017
+ };
3018
+ }
3019
+ /**
3020
+ * Advance one spring toward a target by `dt` seconds (semi-implicit Euler
3021
+ * with fixed substeps; the step cap keeps large frame gaps stable).
3022
+ * @param state - current spring state (mutated in place).
3023
+ * @param target - desired position.
3024
+ * @param dt - elapsed seconds since the previous frame.
3025
+ * @returns the same state object, advanced.
3026
+ */
3027
+ function advanceSpring(state, target, dt) {
3028
+ if (dt <= 0) return state;
3029
+ const damping = 2 * Math.sqrt(260) * 1;
3030
+ const steps = Math.max(1, Math.ceil(dt / SPRING_STEP));
3031
+ const h = dt / steps;
3032
+ for (let i = 0; i < steps; i += 1) {
3033
+ const acceleration = 260 * (target - state.position) - damping * state.velocity;
3034
+ state.velocity += acceleration * h;
3035
+ state.position += state.velocity * h;
3036
+ }
3037
+ if (Math.abs(target - state.position) < .05 && Math.abs(state.velocity) < .5) {
3038
+ state.position = target;
3039
+ state.velocity = 0;
3040
+ }
3041
+ return state;
3042
+ }
3043
+ /**
3044
+ * Whether a spring has settled exactly on its target.
3045
+ * @param state - spring state to check.
3046
+ * @param target - the target the spring was chasing.
3047
+ * @returns true when position equals target and velocity is zero.
3048
+ */
3049
+ function springSettled(state, target) {
3050
+ return state.position === target && state.velocity === 0;
3051
+ }
3052
+ /**
3053
+ * Bound a value into [min, max], returning `fallback` for non-finite input.
3054
+ * @param value - value to clamp.
3055
+ * @param min - inclusive lower bound.
3056
+ * @param max - inclusive upper bound.
3057
+ * @param fallback - value returned when input is not a finite number.
3058
+ * @returns the clamped value.
3059
+ */
3060
+ function clampValue(value, min, max, fallback) {
3061
+ const n = value;
3062
+ return Math.min(max, Math.max(min, Number.isFinite(n) ? n : fallback));
3063
+ }
3064
+ // src/client/theme-layer.ts
3065
+ /** html attribute selecting the Prism layer (all CSS hooks are gated on it). */
3066
+ const PRISM_ATTRIBUTE = "data-dsh-prism";
3067
+ /** Stable-enough id for one stored clip (crypto.randomUUID when available). */
3068
+ function makeClipId() {
3069
+ return `v-${typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`}`;
3070
+ }
3071
+ /** The layer's identity in the theme override stack (inspection-visible). */
3072
+ const OVERRIDE_SOURCE = "dsh-prism-plugin";
3073
+ /** Whether the environment prefers reduced motion (checked live, so OS flips apply). */
3074
+ function prefersReducedMotion() {
3075
+ return typeof matchMedia !== "undefined" && matchMedia("(prefers-reduced-motion: reduce)").matches;
3076
+ }
3077
+ /** Keep imports and repeated exports non-destructive by allocating a new name. */
3078
+ function uniqueThemeName(name, themes) {
3079
+ const taken = new Set(themes.map((theme) => theme.name));
3080
+ if (!taken.has(name)) return name;
3081
+ for (let index = 2; index <= themes.length + 1; index += 1) {
3082
+ const suffix = ` (${String(index)})`;
3083
+ const candidate = `${name.slice(0, 40 - suffix.length).trimEnd()}${suffix}`;
3084
+ if (!taken.has(candidate)) return candidate;
3085
+ }
3086
+ return name;
3087
+ }
3088
+ /**
3089
+ * Owns the Prism layer lifecycle: durable settings, the token override layer,
3090
+ * the damped knob loop, the wallpaper rotation timer, and the ambient DOM.
3091
+ * Every subscription is released through ctx.effect on dispose.
3092
+ */
3093
+ var PrismLayer = class {
3094
+ ctx;
3095
+ settings;
3096
+ dark = false;
3097
+ tokenDisposer;
3098
+ rafId;
3099
+ lastFrame;
3100
+ rotateTimer;
3101
+ /** Object URL of the clip currently on screen (revoked on swap/dispose). */
3102
+ clipUrl;
3103
+ /** Object URL of its poster frame. */
3104
+ posterUrl;
3105
+ /** Id of the clip the layer believes is loaded. */
3106
+ clipId;
3107
+ /** Guards async loads so a fast rotation cannot paint a stale clip. */
3108
+ clipToken = 0;
3109
+ knobs = /* @__PURE__ */ new Map();
3110
+ notify;
3111
+ /** Trailing-debounce timer for localStorage writes (the document can carry
3112
+ * megabyte-sized wallpaper data URLs — persisting on every pointermove
3113
+ * would serialize them at drag cadence and stutter the sliders). */
3114
+ persistTimer;
3115
+ /** False until construction completes: mount() emits theme/change, whose
3116
+ * handler notifies — the owner's sync closure must not run mid-construction. */
3117
+ ready = false;
3118
+ /**
3119
+ * @param ctx - client cordis context (theme override stack + events).
3120
+ * @param notify - callback invoked after every applied settings change so
3121
+ * the settings-row stores re-sync.
3122
+ */
3123
+ constructor(ctx, notify) {
3124
+ this.ctx = ctx;
3125
+ this.notify = notify;
3126
+ this.settings = readSettings();
3127
+ this.dark = this.resolveScheme();
3128
+ ctx.effect(() => {
3129
+ const onStorage = (event) => {
3130
+ if (event.key !== "dsh.ui-prism.settings.v1") return;
3131
+ this.settings = readSettings();
3132
+ if (this.settings.enabled) {
3133
+ if (document.documentElement.hasAttribute("data-dsh-prism")) {
3134
+ this.applyDiscrete();
3135
+ this.applyAllKnobs();
3136
+ } else this.mount();
3137
+ } else this.unmount();
3138
+ this.signal();
3139
+ };
3140
+ window.addEventListener("storage", onStorage);
3141
+ const onPresence = () => {
3142
+ this.playClip();
3143
+ };
3144
+ window.addEventListener("blur", onPresence);
3145
+ window.addEventListener("focus", onPresence);
3146
+ document.addEventListener("visibilitychange", onPresence);
3147
+ const onTheme = () => {
3148
+ this.dark = this.resolveScheme();
3149
+ this.applySchemeDependent();
3150
+ this.applyWallpaperSource();
3151
+ this.signal();
3152
+ };
3153
+ const onPageHide = () => {
3154
+ this.flushPersist();
3155
+ };
3156
+ ctx.on("theme/change", onTheme);
3157
+ window.addEventListener("pagehide", onPageHide);
3158
+ return () => {
3159
+ window.removeEventListener("storage", onStorage);
3160
+ window.removeEventListener("blur", onPresence);
3161
+ window.removeEventListener("focus", onPresence);
3162
+ document.removeEventListener("visibilitychange", onPresence);
3163
+ window.removeEventListener("pagehide", onPageHide);
3164
+ this.flushPersist();
3165
+ this.unmount();
3166
+ };
3167
+ }, "ui-prism: layer lifecycle");
3168
+ if (this.settings.enabled) this.mount();
3169
+ this.ready = true;
3170
+ }
3171
+ /** Notify the owner after construction completes (never mid-construction). */
3172
+ signal() {
3173
+ if (this.ready) this.notify();
3174
+ }
3175
+ /** Persist the settings document on a trailing 300ms debounce so rapid
3176
+ * knob gestures never serialize the (possibly multi-megabyte) document
3177
+ * at drag cadence. */
3178
+ persist() {
3179
+ if (this.persistTimer !== void 0) window.clearTimeout(this.persistTimer);
3180
+ this.persistTimer = window.setTimeout(() => {
3181
+ this.persistTimer = void 0;
3182
+ writeSettings(this.settings);
3183
+ }, 300);
3184
+ }
3185
+ /** Flush any pending debounced write immediately.
3186
+ * @returns whether the pending document reached durable storage.
3187
+ */
3188
+ flushPersist() {
3189
+ if (this.persistTimer === void 0) return true;
3190
+ window.clearTimeout(this.persistTimer);
3191
+ this.persistTimer = void 0;
3192
+ return writeSettings(this.settings);
3193
+ }
3194
+ /** Roll back a library edit whose synchronous durable write failed. */
3195
+ rejectFailedLibraryWrite(previous) {
3196
+ this.settings = previous;
3197
+ if (previous.enabled) {
3198
+ this.applyDiscrete();
3199
+ this.applyAllKnobs();
3200
+ } else this.unmount();
3201
+ this.signal();
3202
+ throw new Error(PRISM_THEME_PERSIST_ERROR);
3203
+ }
3204
+ /** Current enable state (the plugin card mirrors this). */
3205
+ getEnabled() {
3206
+ return this.settings.enabled;
3207
+ }
3208
+ /** Current knob document (the settings rows mirror this). */
3209
+ getSettings() {
3210
+ return {
3211
+ ...this.settings,
3212
+ zones: { ...this.settings.zones },
3213
+ wallpaperDark: [...this.settings.wallpaperDark],
3214
+ wallpaperLight: [...this.settings.wallpaperLight],
3215
+ wallpaperDimDark: [...this.settings.wallpaperDimDark],
3216
+ wallpaperDimLight: [...this.settings.wallpaperDimLight],
3217
+ customThemes: this.settings.customThemes.map((theme) => ({
3218
+ ...theme,
3219
+ values: {
3220
+ ...theme.values,
3221
+ zones: { ...theme.values.zones }
3222
+ }
3223
+ }))
3224
+ };
3225
+ }
3226
+ /** Whether the resolved palette is dark (brightness knob darkens). */
3227
+ getDark() {
3228
+ return this.dark;
3229
+ }
3230
+ /** Resolved scheme from the theme service (falls back to the body attribute). */
3231
+ resolveScheme() {
3232
+ try {
3233
+ return this.ctx.theme.getTheme().active.colorScheme === "dark";
3234
+ } catch {
3235
+ return document.body.hasAttribute("data-ds-dark-theme");
3236
+ }
3237
+ }
3238
+ /** Flip the master switch: mount or tear down the whole layer. */
3239
+ setEnabled(enabled) {
3240
+ if (enabled === this.settings.enabled) return;
3241
+ this.settings = {
3242
+ ...this.settings,
3243
+ enabled
3244
+ };
3245
+ this.persist();
3246
+ if (enabled) this.mount();
3247
+ else this.unmount();
3248
+ this.signal();
3249
+ }
3250
+ /**
3251
+ * Merge a settings patch, clamp every numeric field, persist, then push the
3252
+ * touched knobs through the damping loop.
3253
+ * @param patch - fields to change (wallpaper lists replace whole).
3254
+ */
3255
+ update(patch) {
3256
+ this.settings = clampSettings({
3257
+ ...this.settings,
3258
+ ...patch,
3259
+ zones: patch.zones === void 0 ? { ...this.settings.zones } : {
3260
+ ...this.settings.zones,
3261
+ ...patch.zones
3262
+ }
3263
+ });
3264
+ this.persist();
3265
+ if (!this.settings.enabled) return;
3266
+ this.applyDiscrete();
3267
+ this.applyAllKnobs();
3268
+ this.signal();
3269
+ }
3270
+ /** Apply a complete curated preset (palette, material, depth, and motion). */
3271
+ applyPreset(preset) {
3272
+ this.update({ ...PRESETS[preset] });
3273
+ }
3274
+ /** Save the current appearance as a portable custom theme. Duplicate names
3275
+ * receive a numeric suffix instead of silently replacing a saved look. */
3276
+ saveTheme(name) {
3277
+ const trimmed = name.trim().slice(0, 40);
3278
+ if (trimmed === "" || this.settings.customThemes.length >= 24) return null;
3279
+ const id = `theme-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 7)}`;
3280
+ const theme = makeCustomTheme(this.settings, uniqueThemeName(trimmed, this.settings.customThemes), id);
3281
+ const previous = this.settings;
3282
+ this.update({ customThemes: [...previous.customThemes, theme] });
3283
+ if (!this.flushPersist()) this.rejectFailedLibraryWrite(previous);
3284
+ return id;
3285
+ }
3286
+ /** Apply one saved theme; unknown ids are harmless no-ops. */
3287
+ applyCustomTheme(id) {
3288
+ const theme = this.settings.customThemes.find((item) => item.id === id);
3289
+ if (theme !== void 0) this.update(normalizeThemeValues(theme.values));
3290
+ }
3291
+ /** Delete one saved theme without touching the active appearance. */
3292
+ deleteCustomTheme(id) {
3293
+ if (!this.settings.customThemes.some((theme) => theme.id === id)) return;
3294
+ const previous = this.settings;
3295
+ this.update({ customThemes: previous.customThemes.filter((item) => item.id !== id) });
3296
+ if (!this.flushPersist()) this.rejectFailedLibraryWrite(previous);
3297
+ }
3298
+ /** Export the current appearance as a portable, human-readable JSON file. */
3299
+ exportTheme() {
3300
+ return serializeTheme(this.settings, "DSH Background theme");
3301
+ }
3302
+ /** Import, save, and immediately apply a portable theme.
3303
+ * @returns the imported display name.
3304
+ */
3305
+ importTheme(raw) {
3306
+ const document = parseThemeDocument(raw);
3307
+ if (this.settings.customThemes.length >= 24) throw new Error(PRISM_THEME_LIMIT_ERROR);
3308
+ const id = `theme-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 7)}`;
3309
+ const name = uniqueThemeName(document.name, this.settings.customThemes);
3310
+ const theme = makeCustomTheme({
3311
+ ...this.settings,
3312
+ ...document.values
3313
+ }, name, id);
3314
+ const previous = this.settings;
3315
+ this.update({
3316
+ ...document.values,
3317
+ customThemes: [...previous.customThemes, theme]
3318
+ });
3319
+ if (!this.flushPersist()) this.rejectFailedLibraryWrite(previous);
3320
+ return name;
3321
+ }
3322
+ /** Restore only the six glass zones, leaving palette and typography intact. */
3323
+ resetZones() {
3324
+ this.update({ zones: {
3325
+ base: 100,
3326
+ sidebar: 100,
3327
+ card: 100,
3328
+ input: 100,
3329
+ overlay: 100,
3330
+ bubble: 100
3331
+ } });
3332
+ }
3333
+ /** Reset every appearance knob to the shipped defaults; saved themes and
3334
+ * uploaded wallpapers remain available. */
3335
+ reset() {
3336
+ this.update({
3337
+ material: "frosted",
3338
+ blur: 18,
3339
+ frost: 50,
3340
+ bgBrightness: 50,
3341
+ fontScale: 100,
3342
+ fontChoice: "system",
3343
+ customFont: "",
3344
+ zones: {
3345
+ base: 100,
3346
+ sidebar: 100,
3347
+ card: 100,
3348
+ input: 100,
3349
+ overlay: 100,
3350
+ bubble: 100
3351
+ },
3352
+ inkLightHue: 222,
3353
+ inkLightSat: 30,
3354
+ inkLightLight: 12,
3355
+ inkDarkHue: 222,
3356
+ inkDarkSat: 30,
3357
+ inkDarkLight: 92,
3358
+ accentHue: 205,
3359
+ accentSat: 85,
3360
+ accentLight: 55,
3361
+ bgHue: 215,
3362
+ bgSat: 80,
3363
+ bgLight: 60,
3364
+ accentOpacity: 100,
3365
+ motion: 55,
3366
+ background: "aurora",
3367
+ wallpaperInterval: 30,
3368
+ wallpaperLoop: false,
3369
+ wallpaperPinnedDark: 0,
3370
+ wallpaperPinnedLight: 0,
3371
+ wallpaperBlur: 20,
3372
+ wallpaperFrost: 0
3373
+ });
3374
+ }
3375
+ /**
3376
+ * Ingest an uploaded wallpaper file for one scheme: downscale (or GIF
3377
+ * passthrough), auto-analyze luminance, and append to the rotation list.
3378
+ * @param scheme - which palette the wallpaper belongs to.
3379
+ * @param file - the picked file.
3380
+ * @returns null on success, or a typed rejection for the settings row.
3381
+ */
3382
+ async setWallpaperFromFile(scheme, file) {
3383
+ const { errors } = await this.setWallpapersFromFiles(scheme, [file]);
3384
+ return errors[0] ?? null;
3385
+ }
3386
+ /**
3387
+ * Ingest several uploaded wallpapers for one scheme in a single settings
3388
+ * write. Files are decoded one at a time so a large pick does not allocate
3389
+ * every data URL at once, and a rejected file never aborts the batch.
3390
+ * @param scheme - which palette the wallpapers belong to.
3391
+ * @param files - the picked files, in pick order.
3392
+ * @returns how many were appended and the typed rejections.
3393
+ */
3394
+ async setWallpapersFromFiles(scheme, files) {
3395
+ const urls = [];
3396
+ const dims = [];
3397
+ const errors = [];
3398
+ for (const file of files.slice(0, 20)) {
3399
+ if (isVideoFile(file)) {
3400
+ const id = makeClipId();
3401
+ const ingest = await readVideo(file, id);
3402
+ if ("kind" in ingest) {
3403
+ errors.push(ingest);
3404
+ continue;
3405
+ }
3406
+ try {
3407
+ await putVideo({
3408
+ id,
3409
+ blob: file,
3410
+ poster: ingest.poster,
3411
+ duration: ingest.duration,
3412
+ luminance: ingest.luminance,
3413
+ width: ingest.width,
3414
+ height: ingest.height,
3415
+ bytes: file.size,
3416
+ addedAt: Date.now()
3417
+ });
3418
+ } catch {
3419
+ errors.push({ kind: "read" });
3420
+ continue;
3421
+ }
3422
+ urls.push(ingest.ref);
3423
+ dims.push(ingest.luminance);
3424
+ continue;
3425
+ }
3426
+ const result = await readWallpaper(file);
3427
+ if (typeof result !== "string") {
3428
+ errors.push(result);
3429
+ continue;
3430
+ }
3431
+ urls.push(result);
3432
+ dims.push(await analyzeLuminance(result));
3433
+ }
3434
+ if (urls.length > 0) {
3435
+ if (scheme === "dark") this.update({
3436
+ wallpaperDark: [...this.settings.wallpaperDark, ...urls],
3437
+ wallpaperDimDark: [...this.settings.wallpaperDimDark, ...dims],
3438
+ wallpaperCycleDark: [...this.settings.wallpaperCycleDark, ...urls.map(() => true)],
3439
+ background: "wallpaper"
3440
+ });
3441
+ else this.update({
3442
+ wallpaperLight: [...this.settings.wallpaperLight, ...urls],
3443
+ wallpaperDimLight: [...this.settings.wallpaperDimLight, ...dims],
3444
+ wallpaperCycleLight: [...this.settings.wallpaperCycleLight, ...urls.map(() => true)],
3445
+ background: "wallpaper"
3446
+ });
3447
+ }
3448
+ return {
3449
+ added: urls.length,
3450
+ errors
3451
+ };
3452
+ }
3453
+ /** Remove one scheme's wallpaper at a rotation-list index. */
3454
+ clearWallpaper(scheme, index) {
3455
+ const target = (scheme === "dark" ? this.settings.wallpaperDark : this.settings.wallpaperLight)[index];
3456
+ if (target !== void 0 && isVideoRef(target)) deleteVideo(videoIdOf(target)).catch(() => void 0);
3457
+ if (scheme === "dark") {
3458
+ const urls = this.settings.wallpaperDark.filter((_, i) => i !== index);
3459
+ const dims = this.settings.wallpaperDimDark.filter((_, i) => i !== index);
3460
+ const cycles = this.settings.wallpaperCycleDark.filter((_, i) => i !== index);
3461
+ this.update({
3462
+ wallpaperDark: urls,
3463
+ wallpaperDimDark: dims,
3464
+ wallpaperCycleDark: cycles
3465
+ });
3466
+ } else {
3467
+ const urls = this.settings.wallpaperLight.filter((_, i) => i !== index);
3468
+ const dims = this.settings.wallpaperDimLight.filter((_, i) => i !== index);
3469
+ const cycles = this.settings.wallpaperCycleLight.filter((_, i) => i !== index);
3470
+ this.update({
3471
+ wallpaperLight: urls,
3472
+ wallpaperDimLight: dims,
3473
+ wallpaperCycleLight: cycles
3474
+ });
3475
+ }
3476
+ }
3477
+ /** Toggle automatic rotation (on = cycle the selected images; off = pinned image). */
3478
+ setWallpaperLoop(loop) {
3479
+ if (loop) this.update({
3480
+ wallpaperLoop: true,
3481
+ wallpaperInterval: Math.max(10, this.settings.wallpaperInterval)
3482
+ });
3483
+ else this.update({ wallpaperLoop: false });
3484
+ }
3485
+ /**
3486
+ * Include or exclude one image from the automatic carousel.
3487
+ * Membership is independent of the loop switch, so a selection made while
3488
+ * the carousel is off still applies the next time it is turned on.
3489
+ * @param scheme - which palette's list to edit.
3490
+ * @param index - rotation-list index.
3491
+ * @param include - true to rotate through it, false to skip it.
3492
+ */
3493
+ setWallpaperCycle(scheme, index, include) {
3494
+ const urls = scheme === "dark" ? this.settings.wallpaperDark : this.settings.wallpaperLight;
3495
+ if (index < 0 || index >= urls.length) return;
3496
+ const flags = scheme === "dark" ? this.settings.wallpaperCycleDark : this.settings.wallpaperCycleLight;
3497
+ const next = urls.map((_, slot) => flags[slot] !== false);
3498
+ next[index] = include;
3499
+ if (scheme === "dark") this.update({ wallpaperCycleDark: next });
3500
+ else this.update({ wallpaperCycleLight: next });
3501
+ }
3502
+ /**
3503
+ * Include or exclude every image of one scheme at once.
3504
+ * @param scheme - which palette's list to edit.
3505
+ * @param include - true to rotate through all, false to rotate through none.
3506
+ */
3507
+ setWallpaperCycleAll(scheme, include) {
3508
+ const next = (scheme === "dark" ? this.settings.wallpaperDark : this.settings.wallpaperLight).map(() => include);
3509
+ if (scheme === "dark") this.update({ wallpaperCycleDark: next });
3510
+ else this.update({ wallpaperCycleLight: next });
3511
+ }
3512
+ /**
3513
+ * Move one image inside its palette's list.
3514
+ * The list order is the carousel order, so dragging in the panel is what
3515
+ * decides which image follows which. Membership flags and the pinned index
3516
+ * move with their image instead of staying at the old slot.
3517
+ * @param scheme - which palette's list to edit.
3518
+ * @param from - current index of the image.
3519
+ * @param to - index it should land on.
3520
+ */
3521
+ reorderWallpapers(scheme, from, to) {
3522
+ const urls = [...scheme === "dark" ? this.settings.wallpaperDark : this.settings.wallpaperLight];
3523
+ const dims = [...scheme === "dark" ? this.settings.wallpaperDimDark : this.settings.wallpaperDimLight];
3524
+ const flags = scheme === "dark" ? this.settings.wallpaperCycleDark : this.settings.wallpaperCycleLight;
3525
+ const cycles = urls.map((_, slot) => flags[slot] !== false);
3526
+ if (from === to || from < 0 || to < 0 || from >= urls.length || to >= urls.length) return;
3527
+ const pinned = scheme === "dark" ? this.settings.wallpaperPinnedDark : this.settings.wallpaperPinnedLight;
3528
+ urls.splice(to, 0, ...urls.splice(from, 1));
3529
+ if (dims.length === cycles.length) dims.splice(to, 0, ...dims.splice(from, 1));
3530
+ cycles.splice(to, 0, ...cycles.splice(from, 1));
3531
+ let nextPinned = pinned;
3532
+ if (pinned === from) nextPinned = to;
3533
+ else if (from < pinned && pinned <= to) nextPinned = pinned - 1;
3534
+ else if (to <= pinned && pinned < from) nextPinned = pinned + 1;
3535
+ if (scheme === "dark") this.update({
3536
+ wallpaperDark: urls,
3537
+ wallpaperDimDark: dims,
3538
+ wallpaperCycleDark: cycles,
3539
+ wallpaperPinnedDark: nextPinned
3540
+ });
3541
+ else this.update({
3542
+ wallpaperLight: urls,
3543
+ wallpaperDimLight: dims,
3544
+ wallpaperCycleLight: cycles,
3545
+ wallpaperPinnedLight: nextPinned
3546
+ });
3547
+ }
3548
+ /** Pin one rotation-list image as the fixed background (stops the loop). */
3549
+ pinWallpaper(scheme, index) {
3550
+ if (scheme === "dark") this.update({
3551
+ wallpaperPinnedDark: index,
3552
+ wallpaperLoop: false,
3553
+ background: "wallpaper"
3554
+ });
3555
+ else this.update({
3556
+ wallpaperPinnedLight: index,
3557
+ wallpaperLoop: false,
3558
+ background: "wallpaper"
3559
+ });
3560
+ }
3561
+ /** Mount every layer-owned effect. */
3562
+ mount() {
3563
+ document.documentElement.setAttribute(PRISM_ATTRIBUTE, "");
3564
+ ensureAmbientScene();
3565
+ this.tokenDisposer?.();
3566
+ const overrides = {
3567
+ ...buildTokenOverrides(),
3568
+ ...buildFontOverrides()
3569
+ };
3570
+ this.tokenDisposer = this.ctx.theme.overrideTokens(OVERRIDE_SOURCE, overrides);
3571
+ this.applyDiscrete();
3572
+ this.applyAllKnobs();
3573
+ }
3574
+ /** Tear down every layer-owned effect (stock UI exactly). */
3575
+ unmount() {
3576
+ this.flushPersist();
3577
+ this.stopRotation();
3578
+ document.documentElement.removeAttribute(PRISM_ATTRIBUTE);
3579
+ document.documentElement.removeAttribute("data-prism-material");
3580
+ document.documentElement.removeAttribute("data-prism-still");
3581
+ document.documentElement.removeAttribute("data-prism-wallpaper-on");
3582
+ this.stopClip();
3583
+ removeAmbientScene();
3584
+ this.tokenDisposer?.();
3585
+ this.tokenDisposer = void 0;
3586
+ this.stopLoop();
3587
+ }
3588
+ /** Discrete (non-damped) applications: material, fonts, backdrop source, wallpaper. */
3589
+ applyDiscrete() {
3590
+ const s = this.settings;
3591
+ const root = document.documentElement;
3592
+ root.setAttribute("data-prism-material", s.material);
3593
+ root.style.setProperty("--prism-saturate", `${String(MATERIALS[s.material].saturate)}%`);
3594
+ root.style.setProperty("--prism-depth", String(MATERIALS[s.material].depth));
3595
+ const family = s.fontChoice === "custom" && s.customFont.trim() !== "" ? s.customFont.trim() : FONT_CHOICES[s.fontChoice];
3596
+ root.style.setProperty("--prism-font-family", family === "" ? "var(--dsw-font-family)" : family);
3597
+ const codeFamily = s.fontChoice === "custom" && s.customFont.trim() !== "" ? s.customFont.trim() : CODE_FONT_CHOICES[s.fontChoice];
3598
+ root.style.setProperty("--prism-code-family", codeFamily === "" ? "var(--ds-font-family-code)" : codeFamily);
3599
+ this.applyWallpaperSource();
3600
+ }
3601
+ /** The scheme's carousel membership flags (missing slots count as included). */
3602
+ wallpaperCycle() {
3603
+ return this.dark ? this.settings.wallpaperCycleDark : this.settings.wallpaperCycleLight;
3604
+ }
3605
+ /** The active index: wall-clock rotation across the selected images while
3606
+ * looping, the pinned image otherwise (clicking a thumbnail pins it and
3607
+ * stops the loop). Excluding every image falls back to the pinned one
3608
+ * instead of blanking the backdrop. */
3609
+ wallpaperIndex(urls) {
3610
+ const s = this.settings;
3611
+ if (urls.length === 0) return 0;
3612
+ const carousel = carouselIndices(urls.length, this.wallpaperCycle());
3613
+ if (s.wallpaperLoop && s.wallpaperInterval > 0 && carousel.length > 1) return carousel[Math.floor(Date.now() / 1e3 / s.wallpaperInterval) % carousel.length] ?? carousel[0] ?? 0;
3614
+ if (s.wallpaperLoop && s.wallpaperInterval > 0 && carousel.length === 1) return carousel[0] ?? 0;
3615
+ const pinned = this.dark ? s.wallpaperPinnedDark : s.wallpaperPinnedLight;
3616
+ return Math.min(urls.length - 1, Math.max(0, pinned));
3617
+ }
3618
+ /** Pause the clip and drop the URLs it was using. */
3619
+ stopClip() {
3620
+ const clip = document.querySelector("[data-prism-wallpaper-video]");
3621
+ if (clip !== null) {
3622
+ clip.pause();
3623
+ clip.removeAttribute("src");
3624
+ clip.removeAttribute("poster");
3625
+ clip.load();
3626
+ }
3627
+ if (this.clipUrl !== void 0) URL.revokeObjectURL(this.clipUrl);
3628
+ if (this.posterUrl !== void 0) URL.revokeObjectURL(this.posterUrl);
3629
+ this.clipUrl = void 0;
3630
+ this.posterUrl = void 0;
3631
+ this.clipId = void 0;
3632
+ this.clipToken += 1;
3633
+ document.documentElement.removeAttribute("data-prism-wallpaper-video-on");
3634
+ }
3635
+ /** Whether the clip is allowed to move: visible tab, focused window, motion allowed. */
3636
+ clipShouldPlay() {
3637
+ return !prefersReducedMotion() && document.visibilityState !== "hidden" && (typeof document.hasFocus !== "function" || document.hasFocus());
3638
+ }
3639
+ /** Resume the clip when policy allows it. */
3640
+ playClip() {
3641
+ const clip = document.querySelector("[data-prism-wallpaper-video]");
3642
+ if (clip === null || clip.src === "") return;
3643
+ if (!this.clipShouldPlay()) {
3644
+ clip.pause();
3645
+ return;
3646
+ }
3647
+ const playing = clip.play();
3648
+ if (playing !== void 0) playing.catch(() => void 0);
3649
+ }
3650
+ /** Load a clip from IndexedDB and hand it to the video element. */
3651
+ async showClip(id) {
3652
+ if (this.clipId === id && this.clipUrl !== void 0) {
3653
+ this.playClip();
3654
+ return;
3655
+ }
3656
+ const token = ++this.clipToken;
3657
+ let record = null;
3658
+ try {
3659
+ record = await getVideo(id);
3660
+ } catch {
3661
+ record = null;
3662
+ }
3663
+ if (token !== this.clipToken) return;
3664
+ this.stopClip();
3665
+ if (record === null) {
3666
+ document.documentElement.removeAttribute("data-prism-wallpaper-on");
3667
+ return;
3668
+ }
3669
+ this.clipToken = token;
3670
+ this.clipId = id;
3671
+ this.clipUrl = URL.createObjectURL(record.blob);
3672
+ const clip = document.querySelector("[data-prism-wallpaper-video]");
3673
+ if (clip === null) return;
3674
+ if (record.poster !== null) {
3675
+ this.posterUrl = URL.createObjectURL(record.poster);
3676
+ clip.poster = this.posterUrl;
3677
+ }
3678
+ clip.src = this.clipUrl;
3679
+ clip.loop = true;
3680
+ clip.muted = true;
3681
+ document.documentElement.setAttribute("data-prism-wallpaper-video-on", "");
3682
+ this.playClip();
3683
+ }
3684
+ /** Point the wallpaper layer at the active scheme's rotating image. */
3685
+ applyWallpaperSource() {
3686
+ const s = this.settings;
3687
+ const urls = s.background === "wallpaper" ? this.dark ? s.wallpaperDark : s.wallpaperLight : [];
3688
+ const index = this.wallpaperIndex(urls);
3689
+ const url = urls.length === 0 ? "" : urls[index] ?? "";
3690
+ document.documentElement.toggleAttribute("data-prism-wallpaper-on", url !== "");
3691
+ const image = document.querySelector("[data-prism-wallpaper-img]");
3692
+ if (isVideoRef(url)) {
3693
+ image?.removeAttribute("src");
3694
+ this.showClip(videoIdOf(url));
3695
+ } else {
3696
+ this.stopClip();
3697
+ if (image !== null) {
3698
+ if (url === "") image.removeAttribute("src");
3699
+ else if (image.getAttribute("src") !== url) {
3700
+ image.setAttribute("src", url);
3701
+ image.style.animation = "none";
3702
+ image.offsetWidth;
3703
+ image.style.animation = "";
3704
+ }
3705
+ }
3706
+ }
3707
+ this.scheduleRotation(urls);
3708
+ const dims = this.dark ? s.wallpaperDimDark : s.wallpaperDimLight;
3709
+ const dim = dims.length === 0 ? .5 : dims[index] ?? .5;
3710
+ const veil = Math.min(.75, veilAlpha(dim, this.dark) * .85 + s.wallpaperFrost / 100 * .6);
3711
+ document.documentElement.style.setProperty("--prism-wall-veil", String(veil));
3712
+ }
3713
+ /** Re-evaluate the rotation index exactly at the next boundary. */
3714
+ scheduleRotation(urls) {
3715
+ if (this.rotateTimer !== void 0) {
3716
+ window.clearTimeout(this.rotateTimer);
3717
+ this.rotateTimer = void 0;
3718
+ }
3719
+ const interval = this.settings.wallpaperInterval;
3720
+ const carouselCount = carouselIndices(urls.length, this.wallpaperCycle()).length;
3721
+ if (!this.settings.wallpaperLoop || this.settings.background !== "wallpaper" || carouselCount <= 1 || interval <= 0) return;
3722
+ const ms = interval * 1e3;
3723
+ const wait = ms - Date.now() % ms + 50;
3724
+ this.rotateTimer = window.setTimeout(() => {
3725
+ this.rotateTimer = void 0;
3726
+ this.applyWallpaperSource();
3727
+ }, wait);
3728
+ }
3729
+ /** Stop the rotation timer (unmount / wallpaper source change). */
3730
+ stopRotation() {
3731
+ if (this.rotateTimer !== void 0) {
3732
+ window.clearTimeout(this.rotateTimer);
3733
+ this.rotateTimer = void 0;
3734
+ }
3735
+ }
3736
+ /** Re-apply everything that changes with the light/dark scheme. */
3737
+ applySchemeDependent() {
3738
+ this.applyKnob("bgBrightness");
3739
+ }
3740
+ /** Push every knob through the damping loop (targets unchanged, positions glide). */
3741
+ applyAllKnobs() {
3742
+ this.applyKnob("blur");
3743
+ this.applyKnob("frost");
3744
+ this.applyKnob("bgBrightness");
3745
+ this.applyKnob("fontScale");
3746
+ this.applyKnob("zoneBase");
3747
+ this.applyKnob("zoneSidebar");
3748
+ this.applyKnob("zoneCard");
3749
+ this.applyKnob("zoneInput");
3750
+ this.applyKnob("zoneOverlay");
3751
+ this.applyKnob("zoneBubble");
3752
+ this.applyKnob("inkLightHue");
3753
+ this.applyKnob("inkLightSat");
3754
+ this.applyKnob("inkLightLight");
3755
+ this.applyKnob("inkDarkHue");
3756
+ this.applyKnob("inkDarkSat");
3757
+ this.applyKnob("inkDarkLight");
3758
+ this.applyKnob("accentHue");
3759
+ this.applyKnob("accentSat");
3760
+ this.applyKnob("accentLight");
3761
+ this.applyKnob("bgHue");
3762
+ this.applyKnob("bgSat");
3763
+ this.applyKnob("bgLight");
3764
+ this.applyKnob("accentOpacity");
3765
+ this.applyKnob("motion");
3766
+ this.applyKnob("wallpaperBlur");
3767
+ this.applyKnob("wallpaperFrost");
3768
+ }
3769
+ /** Set one knob's target and start (or skip) the damping loop. */
3770
+ applyKnob(key) {
3771
+ const target = this.knobTarget(key);
3772
+ let knob = this.knobs.get(key);
3773
+ if (knob === void 0) {
3774
+ knob = {
3775
+ spring: createSpring(target),
3776
+ target,
3777
+ apply: (value) => {
3778
+ this.writeKnobVar(key, value);
3779
+ }
3780
+ };
3781
+ this.knobs.set(key, knob);
3782
+ }
3783
+ knob.target = target;
3784
+ if (prefersReducedMotion()) {
3785
+ knob.spring = createSpring(target);
3786
+ knob.apply(target);
3787
+ return;
3788
+ }
3789
+ if (knob.spring.position === target && knob.spring.velocity === 0) {
3790
+ knob.apply(target);
3791
+ return;
3792
+ }
3793
+ this.startLoop();
3794
+ }
3795
+ /** Read the current target value for one knob. */
3796
+ knobTarget(key) {
3797
+ const s = this.settings;
3798
+ switch (key) {
3799
+ case "blur": return s.blur;
3800
+ case "frost": return s.frost;
3801
+ case "bgBrightness": return s.bgBrightness;
3802
+ case "fontScale": return s.fontScale;
3803
+ case "zoneBase": return s.zones.base;
3804
+ case "zoneSidebar": return s.zones.sidebar;
3805
+ case "zoneCard": return s.zones.card;
3806
+ case "zoneInput": return s.zones.input;
3807
+ case "zoneOverlay": return s.zones.overlay;
3808
+ case "zoneBubble": return s.zones.bubble;
3809
+ case "inkLightHue": return s.inkLightHue;
3810
+ case "inkLightSat": return s.inkLightSat;
3811
+ case "inkLightLight": return s.inkLightLight;
3812
+ case "inkDarkHue": return s.inkDarkHue;
3813
+ case "inkDarkSat": return s.inkDarkSat;
3814
+ case "inkDarkLight": return s.inkDarkLight;
3815
+ case "accentHue": return s.accentHue;
3816
+ case "accentSat": return s.accentSat;
3817
+ case "accentLight": return s.accentLight;
3818
+ case "bgHue": return s.bgHue;
3819
+ case "bgSat": return s.bgSat;
3820
+ case "bgLight": return s.bgLight;
3821
+ case "accentOpacity": return s.accentOpacity;
3822
+ case "motion": return s.motion;
3823
+ case "wallpaperBlur": return s.wallpaperBlur;
3824
+ case "wallpaperFrost": return s.wallpaperFrost;
3825
+ }
3826
+ }
3827
+ /** Write one smoothed knob value to its `--prism-*` variables. */
3828
+ writeKnobVar(key, value) {
3829
+ const style = document.documentElement.style;
3830
+ switch (key) {
3831
+ case "blur":
3832
+ style.setProperty("--prism-blur", `${String(value)}px`);
3833
+ return;
3834
+ case "frost":
3835
+ style.setProperty("--prism-frost", String(Math.min(value / 50, 1.4)));
3836
+ return;
3837
+ case "bgBrightness": {
3838
+ const dark = this.dark;
3839
+ style.setProperty("--prism-brightness-black", String(dark ? Math.max(0, (50 - value) / 50) : 0));
3840
+ style.setProperty("--prism-brightness-white", String(dark ? 0 : Math.max(0, (value - 50) / 50)));
3841
+ return;
3842
+ }
3843
+ case "fontScale":
3844
+ style.setProperty("--prism-font-scale", String(value / 100));
3845
+ return;
3846
+ case "zoneBase":
3847
+ style.setProperty("--prism-zone-base", String(value / 100));
3848
+ return;
3849
+ case "zoneSidebar":
3850
+ style.setProperty("--prism-zone-sidebar", String(value / 100));
3851
+ return;
3852
+ case "zoneCard":
3853
+ style.setProperty("--prism-zone-card", String(value / 100));
3854
+ return;
3855
+ case "zoneInput":
3856
+ style.setProperty("--prism-zone-input", String(value / 100));
3857
+ return;
3858
+ case "zoneOverlay":
3859
+ style.setProperty("--prism-zone-overlay", String(value / 100));
3860
+ return;
3861
+ case "zoneBubble":
3862
+ style.setProperty("--prism-zone-bubble", String(value / 100));
3863
+ return;
3864
+ case "inkLightHue":
3865
+ style.setProperty("--prism-ink-light-h", String(value));
3866
+ return;
3867
+ case "inkLightSat":
3868
+ style.setProperty("--prism-ink-light-s", `${String(value)}%`);
3869
+ return;
3870
+ case "inkLightLight":
3871
+ style.setProperty("--prism-ink-light-l", `${String(value)}%`);
3872
+ return;
3873
+ case "inkDarkHue":
3874
+ style.setProperty("--prism-ink-dark-h", String(value));
3875
+ return;
3876
+ case "inkDarkSat":
3877
+ style.setProperty("--prism-ink-dark-s", `${String(value)}%`);
3878
+ return;
3879
+ case "inkDarkLight":
3880
+ style.setProperty("--prism-ink-dark-l", `${String(value)}%`);
3881
+ return;
3882
+ case "accentHue":
3883
+ style.setProperty("--prism-accent-h", String(value));
3884
+ return;
3885
+ case "accentSat":
3886
+ style.setProperty("--prism-accent-s", `${String(value)}%`);
3887
+ return;
3888
+ case "accentLight":
3889
+ style.setProperty("--prism-accent-l", `${String(value)}%`);
3890
+ return;
3891
+ case "bgHue":
3892
+ style.setProperty("--prism-bg-h", String(value));
3893
+ return;
3894
+ case "bgSat":
3895
+ style.setProperty("--prism-bg-s", `${String(value)}%`);
3896
+ return;
3897
+ case "bgLight":
3898
+ style.setProperty("--prism-bg-l", `${String(value)}%`);
3899
+ return;
3900
+ case "accentOpacity":
3901
+ style.setProperty("--prism-accent-a", String(value / 100));
3902
+ return;
3903
+ case "motion":
3904
+ style.setProperty("--prism-motion", String(value / 100));
3905
+ style.setProperty("--prism-motion-scale", String(.2 + .8 * (value / 100)));
3906
+ document.documentElement.toggleAttribute("data-prism-still", value < 1);
3907
+ return;
3908
+ case "wallpaperBlur": {
3909
+ const px = Math.pow(value / 100, 2) * 20;
3910
+ style.setProperty("--prism-wallpaper-blur", `${String(px)}px`);
3911
+ return;
3912
+ }
3913
+ case "wallpaperFrost": {
3914
+ style.setProperty("--prism-wallpaper-frost", String(value / 100));
3915
+ const urls = this.dark ? this.settings.wallpaperDark : this.settings.wallpaperLight;
3916
+ const dim = (this.dark ? this.settings.wallpaperDimDark : this.settings.wallpaperDimLight)[this.wallpaperIndex(urls)] ?? .5;
3917
+ const veil = Math.min(.75, veilAlpha(dim, this.dark) * .85 + value / 100 * .6);
3918
+ style.setProperty("--prism-wall-veil", String(veil));
3919
+ return;
3920
+ }
3921
+ }
3922
+ }
3923
+ /** Run the shared rAF loop until every spring settles. */
3924
+ startLoop() {
3925
+ if (this.rafId !== void 0) return;
3926
+ const step = (timestamp) => {
3927
+ const dt = this.lastFrame === void 0 ? 0 : Math.min((timestamp - this.lastFrame) / 1e3, .1);
3928
+ this.lastFrame = timestamp;
3929
+ let running = false;
3930
+ for (const knob of this.knobs.values()) {
3931
+ advanceSpring(knob.spring, knob.target, dt);
3932
+ knob.apply(knob.spring.position);
3933
+ if (!springSettled(knob.spring, knob.target)) running = true;
3934
+ }
3935
+ if (running) this.rafId = requestAnimationFrame(step);
3936
+ else this.stopLoop();
3937
+ };
3938
+ this.rafId = requestAnimationFrame(step);
3939
+ }
3940
+ /** Stop the shared rAF loop (keeps the springs' last positions). */
3941
+ stopLoop() {
3942
+ if (this.rafId !== void 0) {
3943
+ cancelAnimationFrame(this.rafId);
3944
+ this.rafId = void 0;
3945
+ }
3946
+ this.lastFrame = void 0;
3947
+ }
3948
+ };
3949
+ /** Clamp every numeric field into its declared range. */
3950
+ function clampSettings(settings) {
3951
+ const material = settings.material === "clear" || settings.material === "velvet" ? settings.material : "frosted";
3952
+ const fontChoice = settings.fontChoice === "rounded" || settings.fontChoice === "serif" || settings.fontChoice === "mono" || settings.fontChoice === "custom" ? settings.fontChoice : "system";
3953
+ const background = settings.background === "wallpaper" ? "wallpaper" : "aurora";
3954
+ return {
3955
+ ...settings,
3956
+ material,
3957
+ fontChoice,
3958
+ background,
3959
+ blur: clampValue(settings.blur, RANGES.blur.min, RANGES.blur.max, 18),
3960
+ frost: clampValue(settings.frost, RANGES.frost.min, RANGES.frost.max, 50),
3961
+ bgBrightness: clampValue(settings.bgBrightness, RANGES.bgBrightness.min, RANGES.bgBrightness.max, 50),
3962
+ fontScale: clampValue(settings.fontScale, RANGES.fontScale.min, RANGES.fontScale.max, 100),
3963
+ zones: {
3964
+ base: clampValue(settings.zones.base, RANGES.zone.min, RANGES.zone.max, 100),
3965
+ sidebar: clampValue(settings.zones.sidebar, RANGES.zone.min, RANGES.zone.max, 100),
3966
+ card: clampValue(settings.zones.card, RANGES.zone.min, RANGES.zone.max, 100),
3967
+ input: clampValue(settings.zones.input, RANGES.zone.min, RANGES.zone.max, 100),
3968
+ overlay: clampValue(settings.zones.overlay, RANGES.zone.min, RANGES.zone.max, 100),
3969
+ bubble: clampValue(settings.zones.bubble, RANGES.zone.min, RANGES.zone.max, 100)
3970
+ },
3971
+ inkLightHue: clampValue(settings.inkLightHue, RANGES.hue.min, RANGES.hue.max, 222),
3972
+ inkLightSat: clampValue(settings.inkLightSat, RANGES.sat.min, RANGES.sat.max, 30),
3973
+ inkLightLight: clampValue(settings.inkLightLight, RANGES.light.min, RANGES.light.max, 12),
3974
+ inkDarkHue: clampValue(settings.inkDarkHue, RANGES.hue.min, RANGES.hue.max, 222),
3975
+ inkDarkSat: clampValue(settings.inkDarkSat, RANGES.sat.min, RANGES.sat.max, 30),
3976
+ inkDarkLight: clampValue(settings.inkDarkLight, RANGES.light.min, RANGES.light.max, 92),
3977
+ accentHue: clampValue(settings.accentHue, RANGES.hue.min, RANGES.hue.max, 205),
3978
+ accentSat: clampValue(settings.accentSat, RANGES.sat.min, RANGES.sat.max, 85),
3979
+ accentLight: clampValue(settings.accentLight, RANGES.light.min, RANGES.light.max, 55),
3980
+ bgHue: clampValue(settings.bgHue, RANGES.hue.min, RANGES.hue.max, 215),
3981
+ bgSat: clampValue(settings.bgSat, RANGES.sat.min, RANGES.sat.max, 80),
3982
+ bgLight: clampValue(settings.bgLight, RANGES.light.min, RANGES.light.max, 60),
3983
+ accentOpacity: clampValue(settings.accentOpacity, RANGES.accentOpacity.min, RANGES.accentOpacity.max, 100),
3984
+ motion: clampValue(settings.motion, RANGES.motion.min, RANGES.motion.max, 55),
3985
+ wallpaperInterval: clampValue(settings.wallpaperInterval, RANGES.wallpaperInterval.min, RANGES.wallpaperInterval.max, 30),
3986
+ wallpaperPinnedDark: clampValue(settings.wallpaperPinnedDark, 0, 999, 0),
3987
+ wallpaperPinnedLight: clampValue(settings.wallpaperPinnedLight, 0, 999, 0),
3988
+ wallpaperBlur: clampValue(settings.wallpaperBlur, RANGES.wallpaperBlur.min, RANGES.wallpaperBlur.max, 20),
3989
+ wallpaperFrost: clampValue(settings.wallpaperFrost, RANGES.wallpaperFrost.min, RANGES.wallpaperFrost.max, 0)
3990
+ };
3991
+ }
3992
+ /** Create (once) the fixed ambient scene: aurora, wallpaper, brightness veil. */
3993
+ function ensureAmbientScene() {
3994
+ if (document.querySelector("[data-prism-ambient]") !== null) return;
3995
+ const root = document.createElement("div");
3996
+ root.dataset.prismAmbient = "";
3997
+ const aurora = document.createElement("div");
3998
+ aurora.dataset.prismAurora = "";
3999
+ const wallpaper = document.createElement("div");
4000
+ wallpaper.dataset.prismWallpaper = "";
4001
+ const image = document.createElement("img");
4002
+ image.dataset.prismWallpaperImg = "";
4003
+ image.alt = "";
4004
+ const clip = document.createElement("video");
4005
+ clip.dataset.prismWallpaperVideo = "";
4006
+ clip.muted = true;
4007
+ clip.loop = true;
4008
+ clip.playsInline = true;
4009
+ clip.preload = "metadata";
4010
+ wallpaper.append(image, clip);
4011
+ const brightness = document.createElement("div");
4012
+ brightness.dataset.prismBrightness = "";
4013
+ root.append(aurora, wallpaper, brightness);
4014
+ document.body.appendChild(root);
4015
+ const grain = document.createElement("div");
4016
+ grain.dataset.prismGrain = "";
4017
+ document.body.appendChild(grain);
4018
+ }
4019
+ /** Remove the ambient scene (unmount restores the stock DOM). */
4020
+ function removeAmbientScene() {
4021
+ document.querySelector("[data-prism-ambient]")?.remove();
4022
+ document.querySelector("[data-prism-grain]")?.remove();
4023
+ }
4024
+ // \0prism-css:src/client/prism.module.css.mjs
4025
+ const css = "[data-prism-ambient]{z-index:-1;pointer-events:none;position:fixed;inset:0;overflow:hidden}[data-prism-aurora]{background-image:radial-gradient(38% 32% at 22% 18%, hsl(var(--prism-bg-h,215) var(--prism-bg-s,80%) var(--prism-bg-l,60%) / calc(.2 * var(--prism-motion,.5))), transparent 62%), radial-gradient(34% 30% at 78% 26%, hsl(calc(var(--prism-bg-h,215) + 60) var(--prism-bg-s,80%) var(--prism-bg-l,60%) / calc(.16 * var(--prism-motion,.5))), transparent 62%), radial-gradient(42% 36% at 52% 92%, hsl(calc(var(--prism-bg-h,215) + 120) var(--prism-bg-s,80%) var(--prism-bg-l,60%) / calc(.14 * var(--prism-motion,.5))), transparent 64%);animation:kJQ4wq_prism-aurora-drift 46s var(--ds-ease-in-out,ease-in-out) infinite alternate, kJQ4wq_prism-aurora-breathe 9s var(--ds-ease-in-out,ease-in-out) infinite alternate;animation-duration:calc(46s / var(--prism-motion-scale,1)), calc(9s / var(--prism-motion-scale,1));background-size:200% 200%;position:absolute;inset:-22%}@keyframes kJQ4wq_prism-aurora-drift{0%{background-position:0 0,100% 100%,50%}to{background-position:100% 100%,0 0,50% 100%}}@keyframes kJQ4wq_prism-aurora-breathe{0%{opacity:.82}to{opacity:1}}[data-prism-brightness]{background-image:linear-gradient(rgb(255 255 255/var(--prism-brightness-white,0)), rgb(255 255 255/var(--prism-brightness-white,0))), linear-gradient(rgb(0 0 0/var(--prism-brightness-black,0)), rgb(0 0 0/var(--prism-brightness-black,0)));position:absolute;inset:0}[data-prism-wallpaper]{display:none;position:absolute;inset:0}[data-dsh-prism][data-prism-wallpaper-on] [data-prism-wallpaper]{display:block}[data-prism-wallpaper-img],[data-prism-wallpaper-video]{object-fit:cover;width:100%;height:100%;filter:blur(var(--prism-wallpaper-blur,0px));animation:kJQ4wq_prism-wallpaper-in .8s var(--ds-ease-in-out,ease-in-out)}[data-prism-wallpaper-video]{background:#000;display:none;position:absolute;inset:0}[data-dsh-prism][data-prism-wallpaper-video-on] [data-prism-wallpaper-video]{display:block}@keyframes kJQ4wq_prism-wallpaper-in{0%{opacity:0}to{opacity:1}}[data-prism-wallpaper]:after{content:\"\";background:rgb(255 255 255/var(--prism-wall-veil,0));position:absolute;inset:0}[data-dsh-prism] body[data-ds-dark-theme] [data-prism-wallpaper]:after{background:rgb(8 12 20/var(--prism-wall-veil,0))}[data-dsh-prism] [class*=frame],[data-dsh-prism] [data-phase],[data-dsh-prism] [class*=centerCol][class],[data-dsh-prism] [class*=rightbarCol][class]{background:0 0}[data-dsh-prism] [class*=centerCol][class]{border-left-color:#0000}[data-dsh-prism] [class*=sidebarCol],[data-dsh-prism] header,[data-dsh-prism] [data-composer-card],[data-dsh-prism] [class*=bubble],[data-dsh-prism] [role=menu],[data-dsh-prism] [class*=card],[data-dsh-prism] [class*=panel],[data-dsh-prism] [class*=popover],[data-dsh-prism] [class*=dropdown]{-webkit-backdrop-filter:blur(var(--prism-blur,18px)) saturate(var(--prism-saturate,130%))}[data-dsh-prism] body [role=dialog]{background:rgb(255 255 255/calc(.45 * var(--prism-frost,1)));-webkit-backdrop-filter:blur(50px) saturate(var(--prism-saturate,130%))}[data-dsh-prism] body[data-ds-dark-theme] [role=dialog]{background:rgb(17 26 39/calc(.55 * var(--prism-frost,1)))}[data-dsh-prism] [class*=sidebarCol]:has([role=dialog]){-webkit-backdrop-filter:none}[data-dsh-prism] [class*=sidebarCol]{z-index:9;background:rgb(255 255 255/calc(.85 * var(--prism-frost) * var(--prism-depth,1) * var(--prism-zone-sidebar,1)));border:1px solid #132d5342;border-right-color:#96bef5a6;border-radius:20px;margin:10px;padding:10px 8px 14px;position:relative;overflow:hidden;box-shadow:inset 0 1px #ffffff80,0 10px 34px #132d5329}[data-dsh-prism] body[data-ds-dark-theme] [class*=sidebarCol]{background:rgb(34 38 47/calc(.85 * var(--prism-frost) * var(--prism-depth,1) * var(--prism-zone-sidebar,1)));border-color:#94b4dc52 #94b4dc33 #94b4dc52 #94b4dc52;border-right-style:solid;border-right-width:1px;box-shadow:inset 0 1px #ffffff12,0 8px 30px #02060e52}@media (prefers-reduced-transparency:reduce){[data-dsh-prism] [class*=sidebarCol][class]{background:#fafcfff5!important}[data-dsh-prism] body[data-ds-dark-theme] [class*=sidebarCol][class]{background:#1c2028f5!important}}[data-dsh-prism] [class*=handle][data-side=sidebar]{z-index:10;margin-left:-14px}[data-dsh-prism] :has(>[class*=sidebarCol]):not([data-sidebar-collapsed]) [class*=sidebarCol]>[data-slot=sidebar]>[class*=root]{width:100%!important}[data-dsh-prism] [data-sidebar-collapsed] [class*=sidebarCol]{box-shadow:none;border:none;border-radius:0;margin:0;padding:0}[data-dsh-prism] header{background:var(--dsw-alias-bg-layer-2);border:1px solid #132d5342;border-bottom-color:#0000;border-radius:20px;margin:12px 16px 0;padding:10px 16px 8px;box-shadow:inset 0 1px #ffffff80,0 10px 34px #132d5329}[data-dsh-prism] header:after{display:none}[data-dsh-prism] body[data-ds-dark-theme] header{border-color:#94b4dc52 #94b4dc52 #0000;box-shadow:inset 0 1px #ffffff12,0 8px 30px #02060e52}[data-dsh-prism] [data-composer-card],[data-dsh-prism] [data-composer-card]:after{border-radius:24px}[data-dsh-prism] [data-composer-card]{z-index:8;background:var(--dsw-specific-input-major);border:1px solid #132d5342;position:relative;box-shadow:inset 0 1px #ffffff80,0 10px 36px #132d5329}[data-dsh-prism] body[data-ds-dark-theme] [data-composer-card]{border-color:#94b4dc52;box-shadow:inset 0 1px #ffffff12,0 10px 36px #02060e80}[data-dsh-prism] [data-phase] [class*=composerSeat][class*=composerSeat]{background:0 0}[data-dsh-prism] [data-conversation-composer-overlay]{background:rgb(255 255 255/calc(.85 * var(--prism-frost) * var(--prism-depth,1) * var(--prism-zone-card,1)));-webkit-backdrop-filter:blur(var(--prism-blur,18px)) saturate(var(--prism-saturate,130%));border:1px solid #132d5342;border-radius:24px;box-shadow:inset 0 1px #ffffff80,0 10px 36px #132d5329}[data-dsh-prism] body[data-ds-dark-theme] [data-conversation-composer-overlay]{background:rgb(34 38 47/calc(.85 * var(--prism-frost) * var(--prism-depth,1) * var(--prism-zone-card,1)));border-color:#94b4dc52;box-shadow:inset 0 1px #ffffff12,0 10px 36px #02060e80}[data-dsh-prism] [data-conversation-composer-overlay] [role=toolbar]{background:0 0}[data-dsh-prism] [class*=bubble]{background:var(--dsw-specific-bubble);border:1px solid #132d5324;border-radius:14px}[data-dsh-prism] body[data-ds-dark-theme] [class*=bubble]{border-color:#94b4dc24}[data-dsh-prism] [role=menu]{background:var(--dsw-specific-menu);border-radius:14px}[data-dsh-prism] [role=menu],[data-dsh-prism] [class*=card],[data-dsh-prism] [class*=panel]{border-radius:14px}[data-dsh-prism] button[class*=button]{border-radius:10px}[data-dsh-prism] [class*=iconButton],[data-dsh-prism] [class*=searchButton]{border-radius:8px}[data-dsh-prism] svg circle[class*=track]{stroke:var(--dsw-alias-border-l3)}[data-dsh-prism] svg circle[class*=fill]{stroke:hsl(var(--prism-accent-h) var(--prism-accent-s) var(--prism-accent-l) / var(--prism-accent-a,1))}[data-dsh-prism] [class*=marker] [class*=line]{background:hsl(var(--prism-accent-h) var(--prism-accent-s) var(--prism-accent-l) / var(--prism-accent-a,1))}[data-dsh-prism] [class*=marker][data-proximity=selected] [class*=line]{filter:brightness(1.25)}[data-dsh-prism] [class*=rail] [class*=preview]{-webkit-backdrop-filter:blur(var(--prism-blur,18px)) saturate(var(--prism-saturate,130%))}[data-dsh-prism] [data-conversation-scroll]{text-shadow:0 0 1px #00000059}[data-dsh-prism] body:not([data-ds-dark-theme]) [data-conversation-scroll]{text-shadow:0 0 1px #ffffff80,0 1px 2px #132d5314}[data-dsh-prism] :focus-visible{outline:2px solid hsl(var(--prism-accent-h) var(--prism-accent-s) var(--prism-accent-l));outline-offset:1px}[data-dsh-prism] ::selection{background:hsl(var(--prism-accent-h) var(--prism-accent-s) var(--prism-accent-l) / .35)}[data-dsh-prism] button[class*=button]:hover:not(:disabled),[data-dsh-prism] [role=menuitem]:hover:not(:disabled){box-shadow:0 0 12px hsl(var(--prism-accent-h) var(--prism-accent-s) var(--prism-accent-l) / .18), inset 0 0 0 1px #94b4dc38}[data-dsh-prism]:not([data-prism-still]) [data-phase=hero],[data-dsh-prism]:not([data-prism-still]) [data-phase=active]{animation:kJQ4wq_prism-fade-in calc(.32s / var(--prism-motion-scale,1)) var(--ds-ease-in-out,ease-in-out)}[data-dsh-prism]:not([data-prism-still]) [role=dialog]{animation:kJQ4wq_prism-dialog-in calc(.24s / var(--prism-motion-scale,1)) var(--ds-ease-in-out,ease-in-out)}@keyframes kJQ4wq_prism-fade-in{0%{opacity:0}}@keyframes kJQ4wq_prism-dialog-in{0%{opacity:0;transform:translateY(8px)scale(.985)}}[data-dsh-prism][data-prism-still] [data-prism-aurora],[data-dsh-prism][data-prism-still] [data-phase=hero],[data-dsh-prism][data-prism-still] [data-phase=active],[data-dsh-prism][data-prism-still] [role=dialog]{animation:none}@media (prefers-reduced-motion:reduce){[data-dsh-prism] [data-prism-aurora],[data-dsh-prism] [data-phase=hero],[data-dsh-prism] [data-phase=active],[data-dsh-prism] [role=dialog]{animation:none}[data-dsh-prism] [data-prism-wallpaper]{display:none}}[data-prism-grain]{display:none}[data-dsh-prism][data-prism-material=velvet] [data-prism-grain]{z-index:2147482000;pointer-events:none;mix-blend-mode:soft-light;opacity:.4;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\"),linear-gradient(115deg,#ffffff0d,#0000 45%,#0000000a 90%);display:block;position:fixed;inset:0}[data-dsh-prism][data-prism-material=velvet] [class*=sidebarCol],[data-dsh-prism][data-prism-material=velvet] header,[data-dsh-prism][data-prism-material=velvet] [data-composer-card],[data-dsh-prism][data-prism-material=velvet] [class*=bubble],[data-dsh-prism][data-prism-material=velvet] [data-conversation-composer-overlay]{-webkit-backdrop-filter:blur(calc(var(--prism-blur,18px) + 4px)) saturate(var(--prism-saturate,130%));box-shadow:inset 0 1px 3px #0000001a,inset 0 -1px 2px #ffffff0d,0 10px 30px #02060e59}@media (prefers-reduced-motion:reduce){[data-dsh-prism] [data-prism-grain]{display:none}}";
4026
+ const tagId = "dsh-prism-plugin/prism.module.css";
4027
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
4028
+ const tag = document.createElement("style");
4029
+ tag.dataset.plugin = "dsh-prism-plugin";
4030
+ tag.dataset.pluginCss = tagId;
4031
+ tag.textContent = css;
4032
+ document.head.appendChild(tag);
4033
+ }
4034
+ // src/client/index.ts
4035
+ const inject = [
4036
+ "theme",
4037
+ "slots",
4038
+ "locale"
4039
+ ];
4040
+ /** Register Prism's single settings surface and its reactive state bridge. */
4041
+ function apply(ctx) {
4042
+ ctx.effect(() => ctx.locale.register(NS, {
4043
+ zh,
4044
+ en
4045
+ }), "ui-prism: settings dictionaries");
4046
+ const appearanceStore = createPrismRowStore();
4047
+ let appearanceBound;
4048
+ let revision = 0;
4049
+ const layer = new PrismLayer(ctx, () => {
4050
+ sync();
4051
+ });
4052
+ const sync = () => {
4053
+ const payload = {
4054
+ ...layer.getSettings(),
4055
+ dark: layer.getDark()
4056
+ };
4057
+ appearanceBound?.sync(payload, revision);
4058
+ revision += 1;
4059
+ };
4060
+ const appearanceInjected = (actions) => {
4061
+ appearanceBound = actions;
4062
+ sync();
4063
+ return {
4064
+ setEnabled: (enabled) => {
4065
+ layer.setEnabled(enabled);
4066
+ },
4067
+ setMaterial: (material) => {
4068
+ layer.update({ material });
4069
+ },
4070
+ setBlur: (blur) => {
4071
+ layer.update({ blur });
4072
+ },
4073
+ setFrost: (frost) => {
4074
+ layer.update({ frost });
4075
+ },
4076
+ setBgBrightness: (bgBrightness) => {
4077
+ layer.update({ bgBrightness });
4078
+ },
4079
+ setFontScale: (fontScale) => {
4080
+ layer.update({ fontScale });
4081
+ },
4082
+ setFontChoice: (fontChoice) => {
4083
+ layer.update({ fontChoice });
4084
+ },
4085
+ setCustomFont: (customFont) => {
4086
+ layer.update({ customFont });
4087
+ },
4088
+ setZone: (zone, value) => {
4089
+ layer.update({ zones: { [zone]: value } });
4090
+ },
4091
+ setInkLightColor: (inkLightHue, inkLightSat, inkLightLight) => {
4092
+ layer.update({
4093
+ inkLightHue,
4094
+ inkLightSat,
4095
+ inkLightLight
4096
+ });
4097
+ },
4098
+ setInkDarkColor: (inkDarkHue, inkDarkSat, inkDarkLight) => {
4099
+ layer.update({
4100
+ inkDarkHue,
4101
+ inkDarkSat,
4102
+ inkDarkLight
4103
+ });
4104
+ },
4105
+ setAccentColor: (accentHue, accentSat, accentLight) => {
4106
+ layer.update({
4107
+ accentHue,
4108
+ accentSat,
4109
+ accentLight
4110
+ });
4111
+ },
4112
+ setBgColor: (bgHue, bgSat, bgLight) => {
4113
+ layer.update({
4114
+ bgHue,
4115
+ bgSat,
4116
+ bgLight
4117
+ });
4118
+ },
4119
+ setAccentOpacity: (accentOpacity) => {
4120
+ layer.update({ accentOpacity });
4121
+ },
4122
+ setMotion: (motion) => {
4123
+ layer.update({ motion });
4124
+ },
4125
+ setBackground: (background) => {
4126
+ layer.update({ background });
4127
+ },
4128
+ setWallpaperInterval: (wallpaperInterval) => {
4129
+ layer.update({ wallpaperInterval });
4130
+ },
4131
+ setWallpaperLoop: (wallpaperLoop) => {
4132
+ layer.setWallpaperLoop(wallpaperLoop);
4133
+ },
4134
+ pinWallpaper: (scheme, index) => {
4135
+ layer.pinWallpaper(scheme, index);
4136
+ },
4137
+ setWallpaperBlur: (wallpaperBlur) => {
4138
+ layer.update({ wallpaperBlur });
4139
+ },
4140
+ setWallpaperFrost: (wallpaperFrost) => {
4141
+ layer.update({ wallpaperFrost });
4142
+ },
4143
+ pickWallpapers: (scheme, files) => layer.setWallpapersFromFiles(scheme, files),
4144
+ clearWallpaper: (scheme, index) => {
4145
+ layer.clearWallpaper(scheme, index);
4146
+ },
4147
+ setWallpaperCycle: (scheme, index, include) => {
4148
+ layer.setWallpaperCycle(scheme, index, include);
4149
+ },
4150
+ setWallpaperCycleAll: (scheme, include) => {
4151
+ layer.setWallpaperCycleAll(scheme, include);
4152
+ },
4153
+ reorderWallpapers: (scheme, from, to) => {
4154
+ layer.reorderWallpapers(scheme, from, to);
4155
+ },
4156
+ applyPreset: (preset) => {
4157
+ layer.applyPreset(preset);
4158
+ },
4159
+ saveTheme: (name) => layer.saveTheme(name),
4160
+ applyCustomTheme: (id) => {
4161
+ layer.applyCustomTheme(id);
4162
+ },
4163
+ deleteCustomTheme: (id) => {
4164
+ layer.deleteCustomTheme(id);
4165
+ },
4166
+ exportTheme: () => layer.exportTheme(),
4167
+ importTheme: (raw) => layer.importTheme(raw),
4168
+ resetZones: () => {
4169
+ layer.resetZones();
4170
+ },
4171
+ reset: () => {
4172
+ layer.reset();
4173
+ }
4174
+ };
4175
+ };
4176
+ ctx.slots.inject("settings.general.item", () => ctx.slots.register({
4177
+ name: "settings.general.item",
4178
+ id: "prism",
4179
+ order: 12,
4180
+ store: appearanceStore,
4181
+ locale: NS,
4182
+ inject: appearanceInjected
4183
+ }, PrismAppearancePanel));
4184
+ }
4185
+ exports.apply = apply;
4186
+ exports.inject = inject;
4187
+ return module.exports;
4188
+ }
4189
+ });
4190
+
4191
+ //# sourceMappingURL=client.js.map