@glasshome/widget-sdk 0.3.7 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,34 +1,34 @@
1
- import { createSignal as j, createContext as Ot, useContext as Ct, createEffect as q, untrack as yt, createMemo as N, splitProps as Tt, on as wt, Show as et } from "solid-js";
2
- import { z as X } from "zod";
3
- import { GridSizeSchema as vr, PublishBodySchema as yr, PublishConfirmSchema as wr, PublishRequestSchema as $r, WidgetManifestSchema as pr, formatSchemaError as kr, parseGridSize as Sr, serializeGridSize as Cr } from "./schemas.js";
4
- import { memo as _, effect as z, setStyleProperty as M, className as S, template as w, insert as b, style as ot, createComponent as T, addEventListener as nt, use as Vt, delegateEvents as At } from "solid-js/web";
5
- import { clsx as Wt } from "clsx";
6
- import { twMerge as Rt } from "tailwind-merge";
7
- import { createElementSize as It } from "@solid-primitives/resize-observer";
8
- import { createForm as Ht, zodForm as Gt, reset as Pt, setValue as Lt, getValue as Bt } from "@modular-forms/solid";
9
- function Tn(t) {
10
- const [e] = j(t);
11
- return e;
1
+ import { createSignal as H, createContext as Ee, useContext as pe, onMount as Te, createEffect as U, untrack as xe, createMemo as M, splitProps as Oe, on as be, Show as J } from "solid-js";
2
+ import { z as j } from "zod";
3
+ import { GridSizeSchema as mr, PublishBodySchema as fr, PublishConfirmSchema as hr, PublishRequestSchema as xr, WidgetManifestSchema as br, formatSchemaError as vr, parseGridSize as wr, serializeGridSize as yr } from "./schemas.js";
4
+ import { effect as z, className as S, style as Z, template as v, insert as h, setStyleProperty as V, memo as E, createComponent as O, addEventListener as Q, use as Ve, delegateEvents as Ne } from "solid-js/web";
5
+ import { clsx as We } from "clsx";
6
+ import { twMerge as Ae } from "tailwind-merge";
7
+ import { createElementSize as Ie } from "@solid-primitives/resize-observer";
8
+ import { createForm as Pe, zodForm as Le, reset as Re, setValue as He, getValue as Ge } from "@modular-forms/solid";
9
+ function zn(e) {
10
+ const [t] = H(e);
11
+ return t;
12
12
  }
13
- function Mt(t) {
14
- return X.toJSONSchema(t, {
15
- override: (e) => {
16
- const r = X.globalRegistry.get(e.zodSchema);
17
- return r && typeof r == "object" && Object.keys(r).length > 0 ? { ...e.jsonSchema, ...r } : e.jsonSchema;
13
+ function ke(e) {
14
+ return j.toJSONSchema(e, {
15
+ override: (t) => {
16
+ const r = j.globalRegistry.get(t.zodSchema);
17
+ return r && typeof r == "object" && Object.keys(r).length > 0 ? { ...t.jsonSchema, ...r } : t.jsonSchema;
18
18
  }
19
19
  });
20
20
  }
21
- function jt(t) {
21
+ function je(e) {
22
22
  try {
23
- return t.parse({});
23
+ return e.parse({});
24
24
  } catch {
25
25
  return {};
26
26
  }
27
27
  }
28
- function Vn(t) {
29
- return t.configSchema && (t.manifest.schema || (t.manifest.schema = Mt(t.configSchema)), t.manifest.defaultConfig || (t.manifest.defaultConfig = jt(t.configSchema))), t;
28
+ function Mn(e) {
29
+ return e.configSchema && (e.manifest.schema || (e.manifest.schema = ke(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = je(e.configSchema))), e;
30
30
  }
31
- const U = {
31
+ const K = {
32
32
  /** Background layer (gradients, images, glows) */
33
33
  BACKGROUND: 0,
34
34
  /** Main content layer (icon, title, text) */
@@ -38,19 +38,128 @@ const U = {
38
38
  /** Action layer (buttons, edit controls) */
39
39
  ACTIONS: 30
40
40
  };
41
- function An(t) {
41
+ function _n(e) {
42
42
  }
43
- const ht = Ot();
44
- function I() {
45
- const t = Ct(ht);
46
- if (!t)
43
+ const ue = Ee();
44
+ function P() {
45
+ const e = pe(ue);
46
+ if (!e)
47
47
  throw new Error("useWidgetContext must be used within a Widget component");
48
- return t;
48
+ return e;
49
49
  }
50
- function k(...t) {
51
- return Rt(Wt(t));
50
+ const Be = `/* packages/public/widget-sdk/src/framework/theming/tokens.css
51
+ *
52
+ * Phase 25: Channel Core + Tone Tokens
53
+ * Authoritative SDK CSS contract. Injected once on first Widget mount
54
+ * via framework/theming/tokens.ts. Final palette tuned in Phase 29.
55
+ */
56
+
57
+ /* Tone palette (VIS-C01) -- Phase 29 retune (VIS-P05).
58
+ Hand-tuned against apps/dash/src/routes/dev.palette-tune.tsx so each
59
+ tone reads vibrant at the 20% composition stop on both #fafaf9 (light)
60
+ and #0c0a09 (dark) without overpowering the calm-confidence aesthetic. */
61
+ :root {
62
+ --tone-success: oklch(0.70 0.18 145); /* deeper L vs placeholder lifts chroma at 20% on light bg without going neon */
63
+ --tone-warning: oklch(0.80 0.17 75); /* keeps amber readable at 22%/11% gradient stops without yellowing the shell */
64
+ --tone-danger: oklch(0.64 0.22 27); /* anchors red just below midline so 20% alpha stays unambiguous on light bg */
65
+ --tone-info: oklch(0.66 0.20 245); /* +0.01 chroma so info-blue keeps presence in 30%/40% slider fill against light */
66
+ --tone-neutral: oklch(0.65 0.02 250); /* pinned literal -- matches @property --widget-color initial-value (tokens.test) */
67
+ --tone-accent: oklch(0.74 0.18 60); /* +0.02 chroma for warm-amber accent so glow reads at 50% on light icon bg */
68
+
69
+ /* Envelope vars (VIS-C03), light mode -- retained from Phase 25 baseline */
70
+ --widget-grad-strength: 1;
71
+ --widget-glow-default: 0.4;
72
+ --widget-border-highlight: oklch(0.98 0 0 / 0.4);
73
+ }
74
+
75
+ .dark {
76
+ --tone-success: oklch(0.74 0.18 145); /* +0.04 L lifts chroma at 20% alpha against #0c0a09 so green isn't muddy */
77
+ --tone-warning: oklch(0.82 0.17 75); /* +0.02 L only -- amber already bright on dark bg, more would wash the gradient */
78
+ --tone-danger: oklch(0.68 0.22 27); /* +0.04 L preserves red identity without dipping into maroon at low alpha */
79
+ --tone-info: oklch(0.70 0.20 245); /* +0.04 L plus chroma parity with light keeps info-blue vibrant at 30%/40% on dark */
80
+ --tone-neutral: oklch(0.69 0.02 250); /* +0.04 L vs light, chroma parity -- defaults read calm on dark widget surfaces */
81
+ --tone-accent: oklch(0.78 0.18 60); /* +0.04 L matches accent glow envelope so 50% icon glow stays warm on dark */
82
+
83
+ --widget-grad-strength: 1.1;
84
+ --widget-glow-default: 0.5;
85
+ --widget-border-highlight: oklch(1 0 0 / 0.08);
86
+ }
87
+
88
+ /* @property declaration for animatable channel base (VIS-C04, D-11)
89
+ initial-value must be a literal <color>; cannot reference var(). */
90
+ @property --widget-color {
91
+ syntax: "<color>";
92
+ inherits: true;
93
+ initial-value: oklch(0.65 0.02 250);
94
+ }
95
+
96
+ /* Channel defaults on the Widget root (VIS-C02, D-08) */
97
+ .glasshome-widget {
98
+ --widget-color: var(--tone-neutral);
99
+ --widget-glow-strength: var(--widget-glow-default);
100
+ }
101
+
102
+ /* === Phase 26 additions === */
103
+
104
+ /* VIS-P01 shell gradient + VIS-P02 inset highlight (D-02, D-03, D-06) */
105
+ .glasshome-widget {
106
+ background: var(--widget-gradient,
107
+ linear-gradient(135deg,
108
+ color-mix(in oklch, var(--widget-color) calc(22% * var(--widget-grad-strength)), transparent),
109
+ color-mix(in oklch, var(--widget-color-to, var(--widget-color)) calc(11% * var(--widget-grad-strength)), transparent)
110
+ )
111
+ );
112
+ box-shadow: inset 0 1px 0 var(--widget-border-highlight);
113
+ }
114
+
115
+ /* VIS-P03 icon channel rendering (D-16) */
116
+ .glasshome-widget-icon {
117
+ background: var(--widget-icon-color, var(--widget-color));
118
+ box-shadow: 0 0 calc(var(--widget-glow-strength) * 30px)
119
+ color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 50%, transparent);
120
+ /* Glyph keeps icon-bg hue but flips to L extreme via sign() step + damps chroma.
121
+ bg L > 0.5 -> glyph L=0.09 (dark); bg L < 0.5 -> glyph L=0.95 (light).
122
+ Chroma 0.2x of bg keeps subtle hue tint without competing with bg saturation.
123
+ Requires CSS relative color (Chromium 119+, Safari 16.4+, Firefox 128+) and
124
+ sign() (Chromium 111+, Safari 18.2+, Firefox 118+). */
125
+ color: oklch(from var(--widget-icon-color, var(--widget-color)) calc(0.52 + sign(0.5 - l) * 0.43) calc(c * 0.2) h);
126
+ }
127
+
128
+ /* D-13 loading overlay tint */
129
+ .glasshome-widget-loading {
130
+ background: color-mix(in oklch, var(--widget-color) 20%, transparent);
131
+ }
132
+
133
+ /* === Phase 27 additions === */
134
+
135
+ /* VIS-P04 slider fill channel rendering (D-05, D-06, D-08).
136
+ Mirrors .glasshome-widget-icon precedent: --widget-icon-color override
137
+ with --widget-color fallback. Glow rendered via box-shadow on the same
138
+ fill element (D-07). 30% bg opacity preserves prior 0.3 default; 40px
139
+ blur approximates prior blur-2xl on the deleted glow div; glow radius
140
+ modulated by --widget-glow-strength to track the per-mode envelope. */
141
+ .glasshome-widget-slider-fill {
142
+ background: color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 30%, transparent);
143
+ box-shadow: 0 0 calc(var(--widget-glow-strength) * 40px)
144
+ color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 40%, transparent);
145
+ }
146
+ `;
147
+ let oe = !1;
148
+ function Fe(e) {
149
+ if (oe) return;
150
+ const t = e ?? (typeof document > "u" ? void 0 : document);
151
+ if (!t) return;
152
+ if (t.head.querySelector?.("style[data-glasshome-tokens]")) {
153
+ oe = !0;
154
+ return;
155
+ }
156
+ const r = t.createElement("style");
157
+ r.setAttribute("data-glasshome-tokens", ""), r.textContent = Be, t.head.appendChild(r), oe = !0;
158
+ }
159
+ function $(...e) {
160
+ return Ae(We(e));
52
161
  }
53
- const Ft = {
162
+ const Ue = {
54
163
  id: "classic-glass",
55
164
  name: "Classic Glass",
56
165
  description: "Default glassmorphism design with blur background and gradient",
@@ -78,7 +187,7 @@ const Ft = {
78
187
  hoverScale: 1.02,
79
188
  activeScale: 0.98
80
189
  }
81
- }, Ut = {
190
+ }, Ye = {
82
191
  id: "minimal",
83
192
  name: "Minimal",
84
193
  description: "Clean, minimal design with no background effects",
@@ -107,7 +216,7 @@ const Ft = {
107
216
  active: !1,
108
217
  focus: !0
109
218
  }
110
- }, Yt = {
219
+ }, Ke = {
111
220
  id: "compact-horizontal",
112
221
  name: "Compact Horizontal",
113
222
  description: "Horizontal layout for compact widgets",
@@ -135,33 +244,33 @@ const Ft = {
135
244
  hoverScale: 1.02,
136
245
  activeScale: 0.98
137
246
  }
138
- }, bt = {
139
- "classic-glass": Ft,
140
- minimal: Ut,
141
- "compact-horizontal": Yt
247
+ }, ge = {
248
+ "classic-glass": Ue,
249
+ minimal: Ye,
250
+ "compact-horizontal": Ke
142
251
  };
143
- function Kt(t) {
144
- return bt[t];
252
+ function qe(e) {
253
+ return ge[e];
145
254
  }
146
- function Wn(t) {
147
- return t in bt;
255
+ function En(e) {
256
+ return e in ge;
148
257
  }
149
- function Rn() {
150
- return Object.keys(bt);
258
+ function Tn() {
259
+ return Object.keys(ge);
151
260
  }
152
- function zt(t, e) {
153
- if (typeof t != "object" || t === null)
154
- return e;
155
- const r = { ...t };
156
- for (const i in e) {
157
- const n = e[i], a = t[i];
261
+ function $e(e, t) {
262
+ if (typeof e != "object" || e === null)
263
+ return t;
264
+ const r = { ...e };
265
+ for (const i in t) {
266
+ const n = t[i], a = e[i];
158
267
  if (n !== void 0) {
159
268
  if (Array.isArray(n)) {
160
269
  r[i] = n;
161
270
  continue;
162
271
  }
163
272
  if (typeof n == "object" && n !== null && !Array.isArray(n)) {
164
- typeof a == "object" && a !== null ? r[i] = zt(a, n) : r[i] = n;
273
+ typeof a == "object" && a !== null ? r[i] = $e(a, n) : r[i] = n;
165
274
  continue;
166
275
  }
167
276
  r[i] = n;
@@ -169,126 +278,120 @@ function zt(t, e) {
169
278
  }
170
279
  return r;
171
280
  }
172
- function qt(t, e) {
173
- if (!(!t && !e))
174
- return t ? e ? {
175
- container: { ...t.container, ...e.container },
176
- class: e.class ?? t.class,
177
- cssVars: { ...t.cssVars, ...e.cssVars }
178
- } : t : e;
179
- }
180
- function Xt(t, e) {
181
- return e ?? t;
182
- }
183
- function Jt(t, e) {
184
- if (!(!t && !e))
185
- return t ? e ? {
186
- visible: { ...t.visible, ...e.visible },
187
- styles: zt(t.styles ?? {}, e.styles ?? {}),
188
- classNames: { ...t.classNames, ...e.classNames }
189
- } : t : e;
190
- }
191
- function Zt(t, e) {
192
- if (!(!t && !e))
193
- return t ? e ? {
194
- background: e.background ?? t.background,
195
- overlay: e.overlay ?? t.overlay,
196
- decorations: e.decorations ?? t.decorations
197
- } : t : e;
198
- }
199
- function Qt(t, e) {
200
- if (!(!t && !e))
201
- return t ? e ? {
202
- hover: e.hover ?? t.hover,
203
- active: e.active ?? t.active,
204
- focus: e.focus ?? t.focus,
205
- hoverScale: e.hoverScale ?? t.hoverScale,
206
- activeScale: e.activeScale ?? t.activeScale
207
- } : t : e;
208
- }
209
- function xt(t, e) {
281
+ function Xe(e, t) {
282
+ if (!(!e && !t))
283
+ return e ? t ? {
284
+ container: { ...e.container, ...t.container },
285
+ class: t.class ?? e.class,
286
+ cssVars: { ...e.cssVars, ...t.cssVars }
287
+ } : e : t;
288
+ }
289
+ function Je(e, t) {
290
+ return t ?? e;
291
+ }
292
+ function Ze(e, t) {
293
+ if (!(!e && !t))
294
+ return e ? t ? {
295
+ visible: { ...e.visible, ...t.visible },
296
+ styles: $e(e.styles ?? {}, t.styles ?? {}),
297
+ classNames: { ...e.classNames, ...t.classNames }
298
+ } : e : t;
299
+ }
300
+ function Qe(e, t) {
301
+ if (!(!e && !t))
302
+ return e ? t ? {
303
+ background: t.background ?? e.background,
304
+ overlay: t.overlay ?? e.overlay,
305
+ decorations: t.decorations ?? e.decorations
306
+ } : e : t;
307
+ }
308
+ function et(e, t) {
309
+ if (!(!e && !t))
310
+ return e ? t ? {
311
+ hover: t.hover ?? e.hover,
312
+ active: t.active ?? e.active,
313
+ focus: t.focus ?? e.focus,
314
+ hoverScale: t.hoverScale ?? e.hoverScale,
315
+ activeScale: t.activeScale ?? e.activeScale
316
+ } : e : t;
317
+ }
318
+ function me(e, t) {
210
319
  return {
211
- id: e.id ?? t.id,
212
- name: e.name ?? t.name,
213
- description: e.description ?? t.description,
214
- styles: qt(t.styles, e.styles),
215
- layout: Xt(t.layout, e.layout),
216
- elements: Jt(t.elements, e.elements),
217
- plugins: Zt(t.plugins, e.plugins),
218
- interactions: Qt(t.interactions, e.interactions),
219
- extends: e.extends ?? t.extends
320
+ id: t.id ?? e.id,
321
+ name: t.name ?? e.name,
322
+ description: t.description ?? e.description,
323
+ styles: Xe(e.styles, t.styles),
324
+ layout: Je(e.layout, t.layout),
325
+ elements: Ze(e.elements, t.elements),
326
+ plugins: Qe(e.plugins, t.plugins),
327
+ interactions: et(e.interactions, t.interactions),
328
+ extends: t.extends ?? e.extends
220
329
  };
221
330
  }
222
- function In(t, e) {
331
+ function On(e, t) {
223
332
  return {
224
- ...e,
225
- extends: t
333
+ ...t,
334
+ extends: e
226
335
  };
227
336
  }
228
- function Hn(...t) {
229
- if (t.length === 0)
337
+ function Vn(...e) {
338
+ if (e.length === 0)
230
339
  throw new Error("composeVariants requires at least one variant");
231
- return t.length === 1 ? t[0] : t.reduce((e, r) => xt(e, r));
340
+ return e.length === 1 ? e[0] : e.reduce((t, r) => me(t, r));
232
341
  }
233
- function Gn(t, e) {
234
- return xt(t, { layout: e });
342
+ function Nn(e, t) {
343
+ return me(e, { layout: t });
235
344
  }
236
- function Pn(t, e) {
237
- return xt(t, {
238
- styles: { cssVars: e }
345
+ function Wn(e, t) {
346
+ return me(e, {
347
+ styles: { cssVars: t }
239
348
  });
240
349
  }
241
- function Ln(t = "column", e = "start", r = "start", i) {
350
+ function An(e = "column", t = "start", r = "start", i) {
242
351
  return {
243
352
  type: "flex",
244
- direction: t,
245
- align: e,
353
+ direction: e,
354
+ align: t,
246
355
  justify: r,
247
356
  ...i
248
357
  };
249
358
  }
250
- var te = /* @__PURE__ */ w("<div>"), ee = /* @__PURE__ */ w('<div class="pointer-events-none absolute inset-0 opacity-40 blur-2xl">');
251
- function ne(t) {
252
- const e = I(), r = () => e.orientation() === "vertical" ? `inset(${100 - t.value}% 0 0 0)` : `inset(0 ${100 - t.value}% 0 0)`, i = () => t.color ?? "rgb(59, 130, 246)";
253
- return [_(() => _(() => !!((t.glow ?? !1) && t.value > 0))() && (() => {
254
- var n = ee();
359
+ var tt = /* @__PURE__ */ v("<div>");
360
+ function nt(e) {
361
+ const t = P(), r = () => t.orientation() === "vertical" ? `inset(${100 - e.value}% 0 0 0)` : `inset(0 ${100 - e.value}% 0 0)`, i = () => {
362
+ const n = {
363
+ "clip-path": r(),
364
+ "z-index": K.BACKGROUND
365
+ };
366
+ return e.color && (n["--widget-icon-color"] = e.color), n;
367
+ };
368
+ return (() => {
369
+ var n = tt();
255
370
  return z((a) => {
256
- var o = i(), s = U.BACKGROUND;
257
- return o !== a.e && M(n, "background", a.e = o), s !== a.t && M(n, "z-index", a.t = s), a;
371
+ var o = $("glasshome-widget-slider-fill pointer-events-none absolute inset-0", e.isDragging ? "duration-0" : "transition-all duration-300 ease-out", e.class), s = i();
372
+ return o !== a.e && S(n, a.e = o), a.t = Z(n, s, a.t), a;
258
373
  }, {
259
374
  e: void 0,
260
375
  t: void 0
261
376
  }), n;
262
- })()), (() => {
263
- var n = te();
264
- return z((a) => {
265
- var o = k("pointer-events-none absolute inset-0", t.isDragging ? "duration-0" : "transition-all duration-300 ease-out", t.class), s = i(), l = r(), d = t.opacity ?? 0.3, c = U.BACKGROUND;
266
- return o !== a.e && S(n, a.e = o), s !== a.t && M(n, "background", a.t = s), l !== a.a && M(n, "clip-path", a.a = l), d !== a.o && M(n, "opacity", a.o = d), c !== a.i && M(n, "z-index", a.i = c), a;
267
- }, {
268
- e: void 0,
269
- t: void 0,
270
- a: void 0,
271
- o: void 0,
272
- i: void 0
273
- }), n;
274
- })()];
377
+ })();
275
378
  }
276
- const rt = {
379
+ const ee = {
277
380
  S1: { xs: 4, sm: 4, md: 6, lg: 6, xl: 8 },
278
381
  S2: { xs: 6, sm: 8, md: 10, lg: 12, xl: 14 },
279
382
  S3: { xs: 8, sm: 10, md: 12, lg: 14, xl: 16 },
280
383
  S4: { xs: 12, sm: 14, md: 16, lg: 18, xl: 20 }
281
384
  }, W = {
282
385
  /** Extra small spacing (4-8px) */
283
- S1: (t) => `${rt.S1[t]}px`,
386
+ S1: (e) => `${ee.S1[e]}px`,
284
387
  /** Small spacing (6-14px) - default for most layouts */
285
- S2: (t) => `${rt.S2[t]}px`,
388
+ S2: (e) => `${ee.S2[e]}px`,
286
389
  /** Medium spacing (8-16px) */
287
- S3: (t) => `${rt.S3[t]}px`,
390
+ S3: (e) => `${ee.S3[e]}px`,
288
391
  /** Large spacing (12-20px) */
289
- S4: (t) => `${rt.S4[t]}px`,
392
+ S4: (e) => `${ee.S4[e]}px`,
290
393
  /** Icon container size in pixels */
291
- icon: (t) => ({
394
+ icon: (e) => ({
292
395
  xs: 32,
293
396
  // 1x1, 1x2 widgets
294
397
  sm: 40,
@@ -299,9 +402,9 @@ const rt = {
299
402
  // 2x6, 3x6, 4x2 widgets
300
403
  xl: 56
301
404
  // 4x4 widgets
302
- })[t],
405
+ })[e],
303
406
  /** Icon stroke size for lucide icons */
304
- iconSize: (t) => ({
407
+ iconSize: (e) => ({
305
408
  xs: 18,
306
409
  // Smaller stroke for tiny widgets
307
410
  sm: 20,
@@ -312,9 +415,9 @@ const rt = {
312
415
  // Large widgets
313
416
  xl: 28
314
417
  // Extra large widgets
315
- })[t],
418
+ })[e],
316
419
  /** Spacing between icon and title */
317
- iconToTitle: (t) => ({
420
+ iconToTitle: (e) => ({
318
421
  xs: "8px",
319
422
  // Tight spacing for small widgets
320
423
  sm: "10px",
@@ -325,9 +428,9 @@ const rt = {
325
428
  // More breathing room
326
429
  xl: "16px"
327
430
  // Maximum spacing (@[400px]:mt-4 = 16px)
328
- })[t],
431
+ })[e],
329
432
  /** Container padding */
330
- container: (t) => ({
433
+ container: (e) => ({
331
434
  xs: "8px",
332
435
  // Minimal padding for tiny widgets
333
436
  sm: "16px",
@@ -336,8 +439,8 @@ const rt = {
336
439
  lg: "20px",
337
440
  // More padding for larger widgets
338
441
  xl: "20px"
339
- })[t]
340
- }, re = {
442
+ })[e]
443
+ }, rt = {
341
444
  4: "gap-1",
342
445
  6: "gap-1.5",
343
446
  8: "gap-2",
@@ -348,25 +451,25 @@ const rt = {
348
451
  18: "gap-[18px]",
349
452
  20: "gap-5"
350
453
  };
351
- function ie(t, e) {
352
- const r = rt[t][e];
353
- return re[r] || `gap-[${r}px]`;
454
+ function it(e, t) {
455
+ const r = ee[e][t];
456
+ return rt[r] || `gap-[${r}px]`;
354
457
  }
355
- var ae = /* @__PURE__ */ w("<div>");
356
- function oe(t) {
357
- const e = I();
458
+ var at = /* @__PURE__ */ v("<div>");
459
+ function ot(e) {
460
+ const t = P();
358
461
  return (() => {
359
- var r = ae();
360
- return b(r, () => t.children), z((i) => {
361
- var n = k(
462
+ var r = at();
463
+ return h(r, () => e.children), z((i) => {
464
+ var n = $(
362
465
  "relative flex h-full w-full overflow-hidden",
363
466
  // Ensure controls (ml-auto divs) are above other content
364
467
  "[&_div.ml-auto]:relative [&_div.ml-auto]:z-30",
365
- e.contentLayout() === "horizontal" ? "flex-row items-center" : "flex-col justify-between",
366
- ie("S3", e.size()),
367
- t.class
368
- ), a = W.container(e.size()), o = U.CONTENT;
369
- return n !== i.e && S(r, i.e = n), a !== i.t && M(r, "padding", i.t = a), o !== i.a && M(r, "z-index", i.a = o), i;
468
+ t.contentLayout() === "horizontal" ? "flex-row items-center" : "flex-col justify-between",
469
+ it("S3", t.size()),
470
+ e.class
471
+ ), a = W.container(t.size()), o = K.CONTENT;
472
+ return n !== i.e && S(r, i.e = n), a !== i.t && V(r, "padding", i.t = a), o !== i.a && V(r, "z-index", i.a = o), i;
370
473
  }, {
371
474
  e: void 0,
372
475
  t: void 0,
@@ -374,9 +477,9 @@ function oe(t) {
374
477
  }), r;
375
478
  })();
376
479
  }
377
- const F = {
480
+ const G = {
378
481
  /** Container base text sizing */
379
- container: (t) => ({
482
+ container: (e) => ({
380
483
  xs: "text-xs",
381
484
  // Smallest widgets
382
485
  sm: "text-sm",
@@ -387,9 +490,9 @@ const F = {
387
490
  // Large widgets
388
491
  xl: "text-lg"
389
492
  // Extra large widgets
390
- })[t],
493
+ })[e],
391
494
  /** Title text sizing (main heading) */
392
- title: (t) => ({
495
+ title: (e) => ({
393
496
  xs: "text-xs",
394
497
  // 12px - Very compact
395
498
  sm: "text-xs",
@@ -400,9 +503,9 @@ const F = {
400
503
  // 14px - Maintain size
401
504
  xl: "text-sm"
402
505
  // 14px - Don't go too large for secondary text
403
- })[t],
506
+ })[e],
404
507
  /** Subtitle/secondary text sizing */
405
- subtitle: (t) => ({
508
+ subtitle: (e) => ({
406
509
  xs: "text-xs",
407
510
  // 12px - Very compact
408
511
  sm: "text-sm",
@@ -413,9 +516,9 @@ const F = {
413
516
  // 14px - Maintain size
414
517
  xl: "text-base"
415
518
  // 14px - Don't go too large for secondary text
416
- })[t],
519
+ })[e],
417
520
  /** Value display text sizing (large numbers) */
418
- value: (t) => ({
521
+ value: (e) => ({
419
522
  xs: "text-lg",
420
523
  // 18px - Still readable on small widgets
421
524
  sm: "text-xl",
@@ -426,9 +529,9 @@ const F = {
426
529
  // 30px - Very prominent
427
530
  xl: "text-4xl"
428
531
  // 36px - Maximum impact
429
- })[t],
532
+ })[e],
430
533
  /** Badge text sizing (entity count badges) */
431
- badge: (t) => ({
534
+ badge: (e) => ({
432
535
  xs: "text-xs",
433
536
  // 12px - Compact badge
434
537
  sm: "text-xs",
@@ -439,9 +542,9 @@ const F = {
439
542
  // 14px - Slightly larger for readability
440
543
  xl: "text-sm"
441
544
  // 14px - Maximum badge size
442
- })[t],
545
+ })[e],
443
546
  /** Metric label text sizing */
444
- metricLabel: (t) => ({
547
+ metricLabel: (e) => ({
445
548
  xs: "text-xs",
446
549
  // 12px - Compact labels
447
550
  sm: "text-xs",
@@ -452,9 +555,9 @@ const F = {
452
555
  // 14px - More readable on large widgets
453
556
  xl: "text-sm"
454
557
  // 14px
455
- })[t],
558
+ })[e],
456
559
  /** Metric value text sizing */
457
- metricValue: (t) => ({
560
+ metricValue: (e) => ({
458
561
  xs: "text-sm",
459
562
  // 14px - Readable metric values
460
563
  sm: "text-sm",
@@ -465,17 +568,17 @@ const F = {
465
568
  // 16px - Slightly larger
466
569
  xl: "text-base"
467
570
  // 16px
468
- })[t],
571
+ })[e],
469
572
  /** Status text (same as subtitle but semantic) */
470
- status: (t) => ({
573
+ status: (e) => ({
471
574
  xs: "text-md",
472
575
  sm: "text-xl",
473
576
  md: "text-2xl",
474
577
  lg: "text-3xl",
475
578
  xl: "text-3xl"
476
- })[t],
579
+ })[e],
477
580
  /** Empty state message text */
478
- emptyState: (t) => ({
581
+ emptyState: (e) => ({
479
582
  xs: "text-xs",
480
583
  // 12px
481
584
  sm: "text-sm",
@@ -486,59 +589,59 @@ const F = {
486
589
  // 16px
487
590
  xl: "text-base"
488
591
  // 16px
489
- })[t]
592
+ })[e]
490
593
  };
491
- var se = /* @__PURE__ */ w("<div><div>"), le = /* @__PURE__ */ w("<div>"), ce = /* @__PURE__ */ w("<h3>"), ue = /* @__PURE__ */ w("<p>"), de = /* @__PURE__ */ w("<div class=mt-2>");
492
- function ge(t) {
493
- const e = I(), r = () => e.contentLayout() === "horizontal";
594
+ var st = /* @__PURE__ */ v("<div><div>"), lt = /* @__PURE__ */ v("<div>"), ct = /* @__PURE__ */ v("<h3>"), dt = /* @__PURE__ */ v("<p>"), ut = /* @__PURE__ */ v("<div class=mt-2>");
595
+ function gt(e) {
596
+ const t = P(), r = () => t.contentLayout() === "horizontal";
494
597
  return (() => {
495
- var i = se(), n = i.firstChild;
496
- return b(i, (() => {
497
- var a = _(() => !!t.icon);
598
+ var i = st(), n = i.firstChild;
599
+ return h(i, (() => {
600
+ var a = E(() => !!e.icon);
498
601
  return () => a() && (() => {
499
- var o = le();
500
- return b(o, () => t.icon), z((s) => {
501
- var l = k("flex items-center justify-center text-foreground/30", r() ? "shrink-0" : ""), d = `${W.icon(e.size())}px`, c = `${W.icon(e.size())}px`;
502
- return l !== s.e && S(o, s.e = l), d !== s.t && M(o, "width", s.t = d), c !== s.a && M(o, "height", s.a = c), s;
602
+ var o = lt();
603
+ return h(o, () => e.icon), z((s) => {
604
+ var l = $("flex items-center justify-center text-foreground/30", r() ? "shrink-0" : ""), g = `${W.icon(t.size())}px`, m = `${W.icon(t.size())}px`;
605
+ return l !== s.e && S(o, s.e = l), g !== s.t && V(o, "width", s.t = g), m !== s.a && V(o, "height", s.a = m), s;
503
606
  }, {
504
607
  e: void 0,
505
608
  t: void 0,
506
609
  a: void 0
507
610
  }), o;
508
611
  })();
509
- })(), n), b(n, (() => {
510
- var a = _(() => !!(t.title ?? "No data"));
612
+ })(), n), h(n, (() => {
613
+ var a = E(() => !!(e.title ?? "No data"));
511
614
  return () => a() && (() => {
512
- var o = ce();
513
- return b(o, () => t.title ?? "No data"), z((s) => {
514
- var l = k("font-semibold text-foreground/60", F.subtitle(e.size())), d = r() ? "100%" : "80%";
515
- return l !== s.e && S(o, s.e = l), d !== s.t && M(o, "max-width", s.t = d), s;
615
+ var o = ct();
616
+ return h(o, () => e.title ?? "No data"), z((s) => {
617
+ var l = $("font-semibold text-foreground/60", G.subtitle(t.size())), g = r() ? "100%" : "80%";
618
+ return l !== s.e && S(o, s.e = l), g !== s.t && V(o, "max-width", s.t = g), s;
516
619
  }, {
517
620
  e: void 0,
518
621
  t: void 0
519
622
  }), o;
520
623
  })();
521
- })(), null), b(n, (() => {
522
- var a = _(() => !!t.message);
624
+ })(), null), h(n, (() => {
625
+ var a = E(() => !!e.message);
523
626
  return () => a() && (() => {
524
- var o = ue();
525
- return b(o, () => t.message), z((s) => {
526
- var l = k("text-foreground/50", F.emptyState(e.size())), d = r() ? "100%" : "85%";
527
- return l !== s.e && S(o, s.e = l), d !== s.t && M(o, "max-width", s.t = d), s;
627
+ var o = dt();
628
+ return h(o, () => e.message), z((s) => {
629
+ var l = $("text-foreground/50", G.emptyState(t.size())), g = r() ? "100%" : "85%";
630
+ return l !== s.e && S(o, s.e = l), g !== s.t && V(o, "max-width", s.t = g), s;
528
631
  }, {
529
632
  e: void 0,
530
633
  t: void 0
531
634
  }), o;
532
635
  })();
533
- })(), null), b(n, (() => {
534
- var a = _(() => !!t.action);
636
+ })(), null), h(n, (() => {
637
+ var a = E(() => !!e.action);
535
638
  return () => a() && (() => {
536
- var o = de();
537
- return b(o, () => t.action), o;
639
+ var o = ut();
640
+ return h(o, () => e.action), o;
538
641
  })();
539
642
  })(), null), z((a) => {
540
- var o = k("flex h-full w-full", r() ? "flex-row items-center justify-start" : "flex-col items-center justify-center text-center", t.class), s = W.S2(e.size()), l = W.container(e.size()), d = k("flex flex-col", r() ? "items-start text-left" : "items-center text-center"), c = W.S1(e.size());
541
- return o !== a.e && S(i, a.e = o), s !== a.t && M(i, "gap", a.t = s), l !== a.a && M(i, "padding", a.a = l), d !== a.o && S(n, a.o = d), c !== a.i && M(n, "gap", a.i = c), a;
643
+ var o = $("flex h-full w-full", r() ? "flex-row items-center justify-start" : "flex-col items-center justify-center text-center", e.class), s = W.S2(t.size()), l = W.container(t.size()), g = $("flex flex-col", r() ? "items-start text-left" : "items-center text-center"), m = W.S1(t.size());
644
+ return o !== a.e && S(i, a.e = o), s !== a.t && V(i, "gap", a.t = s), l !== a.a && V(i, "padding", a.a = l), g !== a.o && S(n, a.o = g), m !== a.i && V(n, "gap", a.i = m), a;
542
645
  }, {
543
646
  e: void 0,
544
647
  t: void 0,
@@ -548,154 +651,78 @@ function ge(t) {
548
651
  }), i;
549
652
  })();
550
653
  }
551
- function me(t) {
552
- const e = t.match(/hsl\(\s*([\d.]+)\s*,\s*([\d.]+)%?\s*,\s*([\d.]+)%?\s*\)/);
553
- return e ? { h: Number(e[1]), s: Number(e[2]), l: Number(e[3]) } : null;
554
- }
555
- function fe(t) {
556
- const e = t.match(/rgb\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)/);
557
- return e ? Dt(Number(e[1]), Number(e[2]), Number(e[3])) : null;
558
- }
559
- function he(t) {
560
- const e = t.match(/^#([0-9a-f]{3,8})$/i);
561
- if (!e) return null;
562
- let r = e[1];
563
- r.length === 3 && (r = r[0] + r[0] + r[1] + r[1] + r[2] + r[2]);
564
- const i = Number.parseInt(r.slice(0, 2), 16), n = Number.parseInt(r.slice(2, 4), 16), a = Number.parseInt(r.slice(4, 6), 16);
565
- return Dt(i, n, a);
566
- }
567
- function Dt(t, e, r) {
568
- t /= 255, e /= 255, r /= 255;
569
- const i = Math.max(t, e, r), n = Math.min(t, e, r), a = (i + n) / 2;
570
- if (i === n) return { h: 0, s: 0, l: a * 100 };
571
- const o = i - n, s = a > 0.5 ? o / (2 - i - n) : o / (i + n);
572
- let l = 0;
573
- return i === t ? l = ((e - r) / o + (e < r ? 6 : 0)) / 6 : i === e ? l = ((r - t) / o + 2) / 6 : l = ((t - e) / o + 4) / 6, { h: l * 360, s: s * 100, l: a * 100 };
574
- }
575
- function be(t) {
576
- return me(t) ?? fe(t) ?? he(t);
577
- }
578
- function $t(t, e, r, i) {
579
- const n = Math.round(t), a = Math.round(Math.min(100, Math.max(0, e))), o = Math.round(Math.min(100, Math.max(0, r)));
580
- return i !== void 0 && i < 1 ? `hsla(${n}, ${a}%, ${o}%, ${i})` : `hsl(${n}, ${a}%, ${o}%)`;
581
- }
582
- function xe(t) {
583
- const e = be(t);
584
- if (!e) return null;
585
- const { h: r, s: i, l: n } = e;
586
- let a, o = Math.min(i + 10, 100);
587
- n < 25 ? (a = n + 12, o = Math.min(i + 15, 100)) : n < 40 ? a = Math.max(n - 8, 15) : a = Math.max(18, n * 0.3), i < 15 && (o = 10, a = Math.max(a, 20));
588
- const s = $t(r, o, a, 0.85), l = $t(r, Math.min(i, 90), Math.min(n, 55), 0.5);
589
- return { background: s, glow: l };
590
- }
591
- var ve = /* @__PURE__ */ w('<div><div class="flex items-center justify-center text-foreground">'), pt = /* @__PURE__ */ w("<div>");
592
- function ye(t) {
593
- const e = I(), r = () => t.dynamicColor ? xe(t.dynamicColor) : null, i = () => !!r(), n = () => {
594
- const l = r();
595
- if (l)
596
- return {
597
- "background-color": l.background
598
- };
599
- }, a = () => {
600
- const l = r();
601
- if (l)
602
- return {
603
- "box-shadow": `0 0 25px ${l.glow}`
604
- };
605
- }, o = () => {
606
- const l = {
607
- width: `${W.icon(e.size())}px`,
608
- height: `${W.icon(e.size())}px`,
654
+ var mt = /* @__PURE__ */ v('<div><div class="flex items-center justify-center">'), ve = /* @__PURE__ */ v('<div class="glasshome-widget-icon absolute">');
655
+ function ft(e) {
656
+ const t = P(), r = () => {
657
+ const n = {
658
+ width: `${W.icon(t.size())}px`,
659
+ height: `${W.icon(t.size())}px`,
609
660
  "border-radius": "var(--radius-sm, 12px)"
610
- }, d = n(), c = a();
611
- return d && Object.assign(l, d), c && Object.assign(l, c), l;
612
- }, s = (l, d, c) => {
613
- const v = {
614
- width: `${W.icon(e.size()) * 1.02}px`,
615
- height: `${W.icon(e.size()) * 1.02}px`,
616
- "border-radius": "var(--radius-sm, 12px)",
617
- bottom: `${-W.icon(e.size()) * l}px`,
618
- right: `${-W.icon(e.size()) * (l * 0.71)}px`,
619
- "z-index": d,
620
- opacity: c
621
- }, C = n();
622
- return C && Object.assign(v, C), v;
623
- };
661
+ };
662
+ return e.color && (n["--widget-icon-color"] = e.color), n;
663
+ }, i = (n, a, o) => ({
664
+ width: `${W.icon(t.size()) * 1.02}px`,
665
+ height: `${W.icon(t.size()) * 1.02}px`,
666
+ "border-radius": "var(--radius-sm, 12px)",
667
+ bottom: `${-W.icon(t.size()) * n}px`,
668
+ right: `${-W.icon(t.size()) * (n * 0.71)}px`,
669
+ "z-index": a,
670
+ opacity: o
671
+ });
624
672
  return (() => {
625
- var l = ve(), d = l.firstChild;
626
- return b(l, (() => {
627
- var c = _(() => (t.entityCount ?? 1) >= 2);
628
- return () => c() && (() => {
629
- var v = pt();
630
- return z((C) => {
631
- var m = k("absolute", !i() && (t.color ?? "bg-foreground/10")), x = s(0.14, -2, 0.45);
632
- return m !== C.e && S(v, C.e = m), C.t = ot(v, x, C.t), C;
633
- }, {
634
- e: void 0,
635
- t: void 0
636
- }), v;
673
+ var n = mt(), a = n.firstChild;
674
+ return h(n, (() => {
675
+ var o = E(() => (e.entityCount ?? 1) >= 2);
676
+ return () => o() && (() => {
677
+ var s = ve();
678
+ return z((l) => Z(s, i(0.14, -2, 0.45), l)), s;
637
679
  })();
638
- })(), d), b(l, (() => {
639
- var c = _(() => (t.entityCount ?? 1) >= 3);
640
- return () => c() && (() => {
641
- var v = pt();
642
- return z((C) => {
643
- var m = k("absolute", !i() && (t.color ?? "bg-foreground/10")), x = s(0.28, -3, 0.2);
644
- return m !== C.e && S(v, C.e = m), C.t = ot(v, x, C.t), C;
645
- }, {
646
- e: void 0,
647
- t: void 0
648
- }), v;
680
+ })(), a), h(n, (() => {
681
+ var o = E(() => (e.entityCount ?? 1) >= 3);
682
+ return () => o() && (() => {
683
+ var s = ve();
684
+ return z((l) => Z(s, i(0.28, -3, 0.2), l)), s;
649
685
  })();
650
- })(), d), b(d, () => t.icon), z((c) => {
651
- var v = k(
652
- "relative flex shrink-0 items-center justify-center transition-all",
653
- "pointer-events-none",
654
- t.dimmed && "opacity-50",
655
- // Only apply Tailwind classes when not using dynamic colors
656
- !i() && t.glow && "shadow-[0_0_25px_var(--tw-shadow-color,transparent)]",
657
- !i() && (t.color ?? "bg-foreground/10"),
658
- !i() && t.glow,
659
- t.class
660
- ), C = o(), m = `${W.iconSize(e.size())}px`;
661
- return v !== c.e && S(l, c.e = v), c.t = ot(l, C, c.t), m !== c.a && M(d, "font-size", c.a = m), c;
686
+ })(), a), h(a, () => e.icon), z((o) => {
687
+ var s = $("glasshome-widget-icon", "relative flex shrink-0 items-center justify-center transition-all", "pointer-events-none", e.dimmed && "opacity-50", e.class), l = r(), g = `${W.iconSize(t.size())}px`;
688
+ return s !== o.e && S(n, o.e = s), o.t = Z(n, l, o.t), g !== o.a && V(a, "font-size", o.a = g), o;
662
689
  }, {
663
690
  e: void 0,
664
691
  t: void 0,
665
692
  a: void 0
666
- }), l;
693
+ }), n;
667
694
  })();
668
695
  }
669
- var we = /* @__PURE__ */ w("<div>"), $e = /* @__PURE__ */ w("<div><div><span></span></div><div>"), pe = /* @__PURE__ */ w("<span class=shrink-0>"), ke = /* @__PURE__ */ w('<span class="ml-1 text-foreground/70">');
670
- function Se(t) {
671
- const e = I(), r = () => {
672
- const i = t.direction ?? "auto";
673
- return i === "auto" ? e.orientation() === "horizontal" ? "horizontal" : "vertical" : i;
696
+ var ht = /* @__PURE__ */ v("<div>"), xt = /* @__PURE__ */ v("<div><div><span></span></div><div>"), bt = /* @__PURE__ */ v("<span class=shrink-0>"), vt = /* @__PURE__ */ v('<span class="ml-1 text-foreground/70">');
697
+ function wt(e) {
698
+ const t = P(), r = () => {
699
+ const i = e.direction ?? "auto";
700
+ return i === "auto" ? t.orientation() === "horizontal" ? "horizontal" : "vertical" : i;
674
701
  };
675
702
  return (() => {
676
- var i = we();
677
- return b(i, () => t.children), z(() => S(i, k("flex", r() === "horizontal" ? "flex-row gap-4" : "flex-col gap-2", t.class))), i;
703
+ var i = ht();
704
+ return h(i, () => e.children), z(() => S(i, $("flex", r() === "horizontal" ? "flex-row gap-4" : "flex-col gap-2", e.class))), i;
678
705
  })();
679
706
  }
680
- function Ce(t) {
681
- const e = I();
707
+ function yt(e) {
708
+ const t = P();
682
709
  return (() => {
683
- var r = $e(), i = r.firstChild, n = i.firstChild, a = i.nextSibling;
684
- return b(i, (() => {
685
- var o = _(() => !!t.icon);
710
+ var r = xt(), i = r.firstChild, n = i.firstChild, a = i.nextSibling;
711
+ return h(i, (() => {
712
+ var o = E(() => !!e.icon);
686
713
  return () => o() && (() => {
687
- var s = pe();
688
- return b(s, () => t.icon), s;
714
+ var s = bt();
715
+ return h(s, () => e.icon), s;
689
716
  })();
690
- })(), n), b(n, () => t.label), b(a, () => t.value, null), b(a, (() => {
691
- var o = _(() => !!t.unit);
717
+ })(), n), h(n, () => e.label), h(a, () => e.value, null), h(a, (() => {
718
+ var o = E(() => !!e.unit);
692
719
  return () => o() && (() => {
693
- var s = ke();
694
- return b(s, () => t.unit), s;
720
+ var s = vt();
721
+ return h(s, () => e.unit), s;
695
722
  })();
696
723
  })(), null), z((o) => {
697
- var s = k("flex flex-col", t.dimmed && "opacity-50", t.class), l = W.S1(e.size()), d = k("flex items-center gap-1 text-foreground/60", F.metricLabel(e.size())), c = k("font-semibold text-foreground", F.metricValue(e.size()));
698
- return s !== o.e && S(r, o.e = s), l !== o.t && M(r, "gap", o.t = l), d !== o.a && S(i, o.a = d), c !== o.o && S(a, o.o = c), o;
724
+ var s = $("flex flex-col", e.dimmed && "opacity-50", e.class), l = W.S1(t.size()), g = $("flex items-center gap-1 text-foreground/60", G.metricLabel(t.size())), m = $("font-semibold text-foreground", G.metricValue(t.size()));
725
+ return s !== o.e && S(r, o.e = s), l !== o.t && V(r, "gap", o.t = l), g !== o.a && S(i, o.a = g), m !== o.o && S(a, o.o = m), o;
699
726
  }, {
700
727
  e: void 0,
701
728
  t: void 0,
@@ -704,47 +731,47 @@ function Ce(t) {
704
731
  }), r;
705
732
  })();
706
733
  }
707
- const _t = Se;
708
- _t.Item = Ce;
709
- var Me = /* @__PURE__ */ w("<p>");
710
- function ze(t) {
711
- const e = I();
734
+ const Se = wt;
735
+ Se.Item = yt;
736
+ var pt = /* @__PURE__ */ v("<p>");
737
+ function kt(e) {
738
+ const t = P();
712
739
  return (() => {
713
- var r = Me();
714
- return b(r, (() => {
715
- var i = _(() => !!t.isUnavailable);
716
- return () => i() ? "Unavailable" : t.children;
740
+ var r = pt();
741
+ return h(r, (() => {
742
+ var i = E(() => !!e.isUnavailable);
743
+ return () => i() ? "Unavailable" : e.children;
717
744
  })()), z((i) => {
718
- var n = k("relative font-bold text-foreground", t.dimmed && "opacity-40", F.status(e.size()), t.class), a = U.ACTIONS;
719
- return n !== i.e && S(r, i.e = n), a !== i.t && M(r, "z-index", i.t = a), i;
745
+ var n = $("relative font-bold text-foreground", e.dimmed && "opacity-40", G.status(t.size()), e.class), a = K.ACTIONS;
746
+ return n !== i.e && S(r, i.e = n), a !== i.t && V(r, "z-index", i.t = a), i;
720
747
  }, {
721
748
  e: void 0,
722
749
  t: void 0
723
750
  }), r;
724
751
  })();
725
752
  }
726
- var De = /* @__PURE__ */ w("<p>");
727
- function _e(t) {
728
- const e = I();
753
+ var $t = /* @__PURE__ */ v("<p>");
754
+ function St(e) {
755
+ const t = P();
729
756
  return (() => {
730
- var r = De();
731
- return b(r, () => t.children), z(() => S(r, k("truncate font-medium text-foreground/80", t.dimmed && "text-foreground/50", F.subtitle(e.size()), t.class))), r;
757
+ var r = $t();
758
+ return h(r, () => e.children), z(() => S(r, $("truncate font-medium text-foreground/80", e.dimmed && "text-foreground/50", G.subtitle(t.size()), e.class))), r;
732
759
  })();
733
760
  }
734
- var Ee = /* @__PURE__ */ w("<div><h3>"), Ne = /* @__PURE__ */ w("<span>");
735
- function Oe(t) {
736
- const e = I();
761
+ var Ct = /* @__PURE__ */ v("<div><h3>"), Dt = /* @__PURE__ */ v("<span>");
762
+ function zt(e) {
763
+ const t = P();
737
764
  return (() => {
738
- var r = Ee(), i = r.firstChild;
739
- return b(i, () => t.children), b(r, (() => {
740
- var n = _(() => t.badge !== void 0 && t.badge > 0);
765
+ var r = Ct(), i = r.firstChild;
766
+ return h(i, () => e.children), h(r, (() => {
767
+ var n = E(() => e.badge !== void 0 && e.badge > 0);
741
768
  return () => n() && (() => {
742
- var a = Ne();
743
- return b(a, () => t.badge), z(() => S(a, k("shrink-0 rounded-full bg-foreground/20 px-2 py-0.5 font-medium text-foreground", F.badge(e.size())))), a;
769
+ var a = Dt();
770
+ return h(a, () => e.badge), z(() => S(a, $("shrink-0 rounded-full bg-foreground/20 px-2 py-0.5 font-medium text-foreground", G.badge(t.size())))), a;
744
771
  })();
745
772
  })(), null), z((n) => {
746
- var a = k("relative flex items-center", t.class), o = W.S1(e.size()), s = U.ACTIONS, l = k("truncate text-foreground/60", F.title(e.size()));
747
- return a !== n.e && S(r, n.e = a), o !== n.t && M(r, "gap", n.t = o), s !== n.a && M(r, "z-index", n.a = s), l !== n.o && S(i, n.o = l), n;
773
+ var a = $("relative flex items-center", e.class), o = W.S1(t.size()), s = K.ACTIONS, l = $("truncate text-foreground/60", G.title(t.size()));
774
+ return a !== n.e && S(r, n.e = a), o !== n.t && V(r, "gap", n.t = o), s !== n.a && V(r, "z-index", n.a = s), l !== n.o && S(i, n.o = l), n;
748
775
  }, {
749
776
  e: void 0,
750
777
  t: void 0,
@@ -753,15 +780,15 @@ function Oe(t) {
753
780
  }), r;
754
781
  })();
755
782
  }
756
- function Bn(t) {
783
+ function In(e) {
757
784
  return {
758
- icon: t.icon,
759
- title: t.title,
760
- message: t.message || `Configure this widget to add ${t.entityType || "an entity"}`
785
+ icon: e.icon,
786
+ title: e.title,
787
+ message: e.message || `Configure this widget to add ${e.entityType || "an entity"}`
761
788
  };
762
789
  }
763
- function Te(t, e = !1) {
764
- if (t.length === 0)
790
+ function Mt(e, t = !1) {
791
+ if (e.length === 0)
765
792
  return {
766
793
  isGroup: !1,
767
794
  state: "unknown",
@@ -774,28 +801,28 @@ function Te(t, e = !1) {
774
801
  totalCount: 0,
775
802
  description: "No entities"
776
803
  };
777
- const r = t.length > 1;
804
+ const r = e.length > 1;
778
805
  if (!r) {
779
- const $ = t[0], O = $.state === "on", H = $.attributes?.brightness || 0, f = Math.round(H / 255 * 100);
806
+ const y = e[0], d = y.state === "on", _ = y.attributes?.brightness || 0, p = Math.round(_ / 255 * 100);
780
807
  return {
781
808
  isGroup: !1,
782
- state: $.state,
783
- isOn: O,
784
- isUnavailable: $.state === "unavailable",
785
- brightness: H,
786
- brightnessPercent: f,
787
- color: kt($),
788
- onCount: O ? 1 : 0,
809
+ state: y.state,
810
+ isOn: d,
811
+ isUnavailable: y.state === "unavailable",
812
+ brightness: _,
813
+ brightnessPercent: p,
814
+ color: we(y),
815
+ onCount: d ? 1 : 0,
789
816
  totalCount: 1,
790
- description: O ? "On" : "Off"
817
+ description: d ? "On" : "Off"
791
818
  };
792
819
  }
793
820
  let i = 0, n = 0, a = 0, o = 0, s = 0, l = 0;
794
- const d = [];
795
- for (const $ of t)
796
- switch ($.state) {
821
+ const g = [];
822
+ for (const y of e)
823
+ switch (y.state) {
797
824
  case "on":
798
- i++, $.attributes?.brightness !== void 0 && (s += $.attributes.brightness, l++), $.attributes?.rgb_color && d.push($.attributes.rgb_color);
825
+ i++, y.attributes?.brightness !== void 0 && (s += y.attributes.brightness, l++), y.attributes?.rgb_color && g.push(y.attributes.rgb_color);
799
826
  break;
800
827
  case "off":
801
828
  n++;
@@ -807,32 +834,32 @@ function Te(t, e = !1) {
807
834
  o++;
808
835
  break;
809
836
  }
810
- const c = t.length, v = o === c, C = a + o === c, m = i > 0, x = i === c, V = n === c;
811
- let E, R;
812
- e ? v ? (E = "unavailable", R = !1) : a > 0 || o > 0 ? (E = "unknown", R = !1) : n > 0 ? (E = "off", R = !1) : (E = "on", R = !0) : v ? (E = "unavailable", R = !1) : C ? (E = "unknown", R = !1) : m ? (E = "on", R = !0) : (E = "off", R = !1);
813
- const K = l > 0 ? Math.round(s / l) : 0, B = Math.round(K / 255 * 100);
814
- let h;
815
- if (d.length > 0) {
816
- const $ = Math.round(d.reduce((u, A) => u + A[0], 0) / d.length), O = Math.round(d.reduce((u, A) => u + A[1], 0) / d.length), H = Math.round(d.reduce((u, A) => u + A[2], 0) / d.length), f = K / 255;
817
- h = `rgb(${Math.round($ * f)}, ${Math.round(O * f)}, ${Math.round(H * f)})`;
837
+ const m = e.length, k = o === m, R = a + o === m, x = i > 0, w = i === m, N = n === m;
838
+ let D, T;
839
+ t ? k ? (D = "unavailable", T = !1) : a > 0 || o > 0 ? (D = "unknown", T = !1) : n > 0 ? (D = "off", T = !1) : (D = "on", T = !0) : k ? (D = "unavailable", T = !1) : R ? (D = "unknown", T = !1) : x ? (D = "on", T = !0) : (D = "off", T = !1);
840
+ const F = l > 0 ? Math.round(s / l) : 0, q = Math.round(F / 255 * 100);
841
+ let f;
842
+ if (g.length > 0) {
843
+ const y = Math.round(g.reduce((c, A) => c + A[0], 0) / g.length), d = Math.round(g.reduce((c, A) => c + A[1], 0) / g.length), _ = Math.round(g.reduce((c, A) => c + A[2], 0) / g.length), p = F / 255;
844
+ f = `rgb(${Math.round(y * p)}, ${Math.round(d * p)}, ${Math.round(_ * p)})`;
818
845
  } else
819
- h = kt(t[0]);
820
- let y;
821
- return x ? y = "All on" : V ? y = "All off" : i > 0 ? y = `${i} of ${c} on` : y = "Off", {
846
+ f = we(e[0]);
847
+ let b;
848
+ return w ? b = "All on" : N ? b = "All off" : i > 0 ? b = `${i} of ${m} on` : b = "Off", {
822
849
  isGroup: r,
823
- state: E,
824
- isOn: R,
825
- isUnavailable: E === "unavailable",
826
- brightness: K,
827
- brightnessPercent: B,
828
- color: h,
850
+ state: D,
851
+ isOn: T,
852
+ isUnavailable: D === "unavailable",
853
+ brightness: F,
854
+ brightnessPercent: q,
855
+ color: f,
829
856
  onCount: i,
830
- totalCount: c,
831
- description: y
857
+ totalCount: m,
858
+ description: b
832
859
  };
833
860
  }
834
- function Ve(t, e = "mean", r = !0) {
835
- if (t.length === 0)
861
+ function _t(e, t = "mean", r = !0) {
862
+ if (e.length === 0)
836
863
  return {
837
864
  isGroup: !1,
838
865
  state: "unknown",
@@ -840,43 +867,43 @@ function Ve(t, e = "mean", r = !0) {
840
867
  isUnavailable: !0,
841
868
  description: "No entities"
842
869
  };
843
- const i = t.length > 1;
870
+ const i = e.length > 1;
844
871
  if (!i) {
845
- const m = t[0], x = Number.parseFloat(m.state);
846
- let V = m.state;
847
- return Number.isNaN(x) || (V = Number.isInteger(x) ? x.toString() : x.toFixed(1)), {
872
+ const x = e[0], w = Number.parseFloat(x.state);
873
+ let N = x.state;
874
+ return Number.isNaN(w) || (N = Number.isInteger(w) ? w.toString() : w.toFixed(1)), {
848
875
  isGroup: !1,
849
- state: V,
850
- numericValue: Number.isNaN(x) ? null : x,
851
- isUnavailable: m.state === "unavailable",
852
- unit: m.unitOfMeasurement ?? void 0,
853
- description: V
876
+ state: N,
877
+ numericValue: Number.isNaN(w) ? null : w,
878
+ isUnavailable: x.state === "unavailable",
879
+ unit: x.unitOfMeasurement ?? void 0,
880
+ description: N
854
881
  };
855
882
  }
856
883
  const n = [], a = [];
857
884
  let o = 0, s;
858
- for (const m of t) {
859
- if (!s && m.unitOfMeasurement && (s = m.unitOfMeasurement), m.state === "unavailable") {
885
+ for (const x of e) {
886
+ if (!s && x.unitOfMeasurement && (s = x.unitOfMeasurement), x.state === "unavailable") {
860
887
  o++, a.push({
861
- entityId: m.id,
888
+ entityId: x.id,
862
889
  value: "unavailable",
863
- friendly_name: m.friendlyName
890
+ friendly_name: x.friendlyName
864
891
  });
865
892
  continue;
866
893
  }
867
- const x = Number.parseFloat(m.state);
868
- isNaN(x) ? r || a.push({
869
- entityId: m.id,
870
- value: m.state,
871
- friendly_name: m.friendlyName
872
- }) : (n.push(x), a.push({
873
- entityId: m.id,
874
- value: x,
875
- friendly_name: m.friendlyName
894
+ const w = Number.parseFloat(x.state);
895
+ isNaN(w) ? r || a.push({
896
+ entityId: x.id,
897
+ value: x.state,
898
+ friendly_name: x.friendlyName
899
+ }) : (n.push(w), a.push({
900
+ entityId: x.id,
901
+ value: w,
902
+ friendly_name: x.friendlyName
876
903
  }));
877
904
  }
878
- const l = o === t.length, d = n.length === 0;
879
- if (l || d)
905
+ const l = o === e.length, g = n.length === 0;
906
+ if (l || g)
880
907
  return {
881
908
  isGroup: i,
882
909
  state: l ? "unavailable" : "unknown",
@@ -886,134 +913,134 @@ function Ve(t, e = "mean", r = !0) {
886
913
  description: l ? "Unavailable" : "No numeric values",
887
914
  memberValues: a
888
915
  };
889
- let c, v;
890
- switch (e) {
916
+ let m, k;
917
+ switch (t) {
891
918
  case "min":
892
- c = Math.min(...n), v = "Minimum";
919
+ m = Math.min(...n), k = "Minimum";
893
920
  break;
894
921
  case "max":
895
- c = Math.max(...n), v = "Maximum";
922
+ m = Math.max(...n), k = "Maximum";
896
923
  break;
897
924
  case "mean":
898
- c = n.reduce((m, x) => m + x, 0) / n.length, v = "Average";
925
+ m = n.reduce((x, w) => x + w, 0) / n.length, k = "Average";
899
926
  break;
900
927
  case "median": {
901
- const m = [...n].sort((V, E) => V - E), x = Math.floor(m.length / 2);
902
- c = m.length % 2 === 0 ? (m[x - 1] + m[x]) / 2 : m[x], v = "Median";
928
+ const x = [...n].sort((N, D) => N - D), w = Math.floor(x.length / 2);
929
+ m = x.length % 2 === 0 ? (x[w - 1] + x[w]) / 2 : x[w], k = "Median";
903
930
  break;
904
931
  }
905
932
  case "sum":
906
- c = n.reduce((m, x) => m + x, 0), v = "Sum";
933
+ m = n.reduce((x, w) => x + w, 0), k = "Sum";
907
934
  break;
908
935
  case "last":
909
- c = n[n.length - 1], v = "Latest";
936
+ m = n[n.length - 1], k = "Latest";
910
937
  break;
911
938
  case "range":
912
- c = Math.max(...n) - Math.min(...n), v = "Range";
939
+ m = Math.max(...n) - Math.min(...n), k = "Range";
913
940
  break;
914
941
  case "product":
915
- c = n.reduce((m, x) => m * x, 1), v = "Product";
942
+ m = n.reduce((x, w) => x * w, 1), k = "Product";
916
943
  break;
917
944
  case "std_dev": {
918
- const m = n.reduce((V, E) => V + E, 0) / n.length, x = n.reduce((V, E) => V + (E - m) ** 2, 0) / n.length;
919
- c = Math.sqrt(x), v = "Std Dev";
945
+ const x = n.reduce((N, D) => N + D, 0) / n.length, w = n.reduce((N, D) => N + (D - x) ** 2, 0) / n.length;
946
+ m = Math.sqrt(w), k = "Std Dev";
920
947
  break;
921
948
  }
922
949
  default:
923
- c = n.reduce((m, x) => m + x, 0) / n.length, v = "Average";
950
+ m = n.reduce((x, w) => x + w, 0) / n.length, k = "Average";
924
951
  }
925
- const C = Number.isInteger(c) ? c.toString() : c.toFixed(1);
952
+ const R = Number.isInteger(m) ? m.toString() : m.toFixed(1);
926
953
  return {
927
954
  isGroup: i,
928
- state: C,
929
- numericValue: c,
955
+ state: R,
956
+ numericValue: m,
930
957
  isUnavailable: !1,
931
958
  unit: s,
932
- description: `${v} of ${n.length}`,
959
+ description: `${k} of ${n.length}`,
933
960
  memberValues: a
934
961
  };
935
962
  }
936
- function kt(t) {
937
- if (t.state !== "on") return "rgb(100, 100, 100)";
938
- const r = (t.attributes?.brightness ?? 255) / 255;
939
- if (t.attributes?.rgb_color) {
940
- const [i, n, a] = t.attributes.rgb_color;
963
+ function we(e) {
964
+ if (e.state !== "on") return "rgb(100, 100, 100)";
965
+ const r = (e.attributes?.brightness ?? 255) / 255;
966
+ if (e.attributes?.rgb_color) {
967
+ const [i, n, a] = e.attributes.rgb_color;
941
968
  return `rgb(${Math.round(i * r)}, ${Math.round(n * r)}, ${Math.round(a * r)})`;
942
969
  }
943
- if (t.attributes?.color_temp) {
944
- const n = 1e6 / t.attributes.color_temp / 100;
970
+ if (e.attributes?.color_temp) {
971
+ const n = 1e6 / e.attributes.color_temp / 100;
945
972
  let a, o, s;
946
973
  return n <= 66 ? (a = 255, o = n <= 19 ? 0 : 99.4708025861 * Math.log(n - 10) - 161.1195681661, s = n <= 19 ? 0 : n <= 66 ? 138.5177312231 * Math.log(n - 10) - 305.0447927307 : 255) : (a = 329.698727446 * (n - 60) ** -0.1332047592, o = 288.1221695283 * (n - 60) ** -0.0755148492, s = 255), a = Math.max(0, Math.min(255, a)) * r, o = Math.max(0, Math.min(255, o)) * r, s = Math.max(0, Math.min(255, s)) * r, `rgb(${Math.round(a)}, ${Math.round(o)}, ${Math.round(s)})`;
947
974
  }
948
975
  return `rgb(${Math.round(255 * r)}, ${Math.round(220 * r)}, ${Math.round(180 * r)})`;
949
976
  }
950
- function Ae(t) {
951
- return t ? t.state !== "unavailable" && t.state !== "unknown" : !1;
977
+ function Et(e) {
978
+ return e ? e.state !== "unavailable" && e.state !== "unknown" : !1;
952
979
  }
953
- function We(t) {
954
- if (!t) return !1;
955
- if (["on", "open", "locked", "home", "playing", "active"].includes(t.state))
980
+ function Tt(e) {
981
+ if (!e) return !1;
982
+ if (["on", "open", "locked", "home", "playing", "active"].includes(e.state))
956
983
  return !0;
957
- if (t.domain === "sensor") {
958
- const e = Number.parseFloat(t.state);
959
- return !isNaN(e) && e > 0;
984
+ if (e.domain === "sensor") {
985
+ const t = Number.parseFloat(e.state);
986
+ return !isNaN(t) && t > 0;
960
987
  }
961
988
  return !1;
962
989
  }
963
- function jn(t, e = "unknown") {
964
- return t?.state ?? e;
990
+ function Pn(e, t = "unknown") {
991
+ return e?.state ?? t;
965
992
  }
966
- function Fn(t, e, r) {
967
- return t?.attributes ? t.attributes[e] ?? r : r;
993
+ function Ln(e, t, r) {
994
+ return e?.attributes ? e.attributes[t] ?? r : r;
968
995
  }
969
- function Un(t, e) {
970
- return t.filter((r) => r.state === e).length;
996
+ function Rn(e, t) {
997
+ return e.filter((r) => r.state === t).length;
971
998
  }
972
- function Yn(t) {
973
- return t.filter(Ae).length;
999
+ function Hn(e) {
1000
+ return e.filter(Et).length;
974
1001
  }
975
- function Kn(t) {
976
- return t.filter(We).length;
1002
+ function Gn(e) {
1003
+ return e.filter(Tt).length;
977
1004
  }
978
- function qn(t, e) {
979
- return t.length > 0 && t.every((r) => r.state === e);
1005
+ function jn(e, t) {
1006
+ return e.length > 0 && e.every((r) => r.state === t);
980
1007
  }
981
- function Xn(t, e) {
982
- return t.some((r) => r.state === e);
1008
+ function Bn(e, t) {
1009
+ return e.some((r) => r.state === t);
983
1010
  }
984
- function Re(t, e, r) {
1011
+ function Ot(e, t, r) {
985
1012
  const { decimals: i, scale: n = !0 } = r || {};
986
- if (typeof t == "string")
987
- return e ? `${t}${e}` : t;
988
- if (t == null || Number.isNaN(t))
989
- return e ? `--${e}` : "--";
990
- let a = t, o = e || "";
991
- n && e && (e === "W" || e === "kW" || e === "MW") && (t >= 1e6 ? (a = t / 1e6, o = "MW") : t >= 1e3 ? (a = t / 1e3, o = "kW") : o = "W"), n && e && (e === "B" || e === "KB" || e === "MB" || e === "GB") && (t >= 1073741824 ? (a = t / 1073741824, o = "GB") : t >= 1048576 ? (a = t / 1048576, o = "MB") : t >= 1024 ? (a = t / 1024, o = "KB") : o = "B");
1013
+ if (typeof e == "string")
1014
+ return t ? `${e}${t}` : e;
1015
+ if (e == null || Number.isNaN(e))
1016
+ return t ? `--${t}` : "--";
1017
+ let a = e, o = t || "";
1018
+ n && t && (t === "W" || t === "kW" || t === "MW") && (e >= 1e6 ? (a = e / 1e6, o = "MW") : e >= 1e3 ? (a = e / 1e3, o = "kW") : o = "W"), n && t && (t === "B" || t === "KB" || t === "MB" || t === "GB") && (e >= 1073741824 ? (a = e / 1073741824, o = "GB") : e >= 1048576 ? (a = e / 1048576, o = "MB") : e >= 1024 ? (a = e / 1024, o = "KB") : o = "B");
992
1019
  let s;
993
- return i !== void 0 ? s = a.toFixed(i) : a !== t ? s = a.toFixed(1) : Number.isInteger(t) ? s = t.toString() : s = Number.parseFloat(t.toFixed(2)).toString(), o ? `${s}${o}` : s;
1020
+ return i !== void 0 ? s = a.toFixed(i) : a !== e ? s = a.toFixed(1) : Number.isInteger(e) ? s = e.toString() : s = Number.parseFloat(e.toFixed(2)).toString(), o ? `${s}${o}` : s;
994
1021
  }
995
- function Ie(t, e) {
996
- return t == null || isNaN(t) ? null : e === "°C" ? t < 10 ? "Cold" : t < 18 ? "Cool" : t < 24 ? "Comfortable" : t < 28 ? "Warm" : "Hot" : e === "°F" ? t < 50 ? "Cold" : t < 64 ? "Cool" : t < 75 ? "Comfortable" : t < 82 ? "Warm" : "Hot" : e === "%" ? t < 20 ? "Very Low" : t < 40 ? "Low" : t < 60 ? "Medium" : t < 80 ? "High" : "Very High" : e === "ppm" ? t < 400 ? "Excellent" : t < 600 ? "Good" : t < 1e3 ? "Acceptable" : t < 1500 ? "Mediocre" : "Poor" : e === "lx" ? t < 50 ? "Dark" : t < 200 ? "Dim" : t < 500 ? "Moderate" : t < 1e3 ? "Bright" : "Very Bright" : e === "AQI" ? t <= 50 ? "Good" : t <= 100 ? "Moderate" : t <= 150 ? "Unhealthy for Sensitive" : t <= 200 ? "Unhealthy" : t <= 300 ? "Very Unhealthy" : "Hazardous" : e === "dB" ? t < 30 ? "Very Quiet" : t < 50 ? "Quiet" : t < 70 ? "Moderate" : t < 85 ? "Loud" : "Very Loud" : null;
1022
+ function Vt(e, t) {
1023
+ return e == null || isNaN(e) ? null : t === "°C" ? e < 10 ? "Cold" : e < 18 ? "Cool" : e < 24 ? "Comfortable" : e < 28 ? "Warm" : "Hot" : t === "°F" ? e < 50 ? "Cold" : e < 64 ? "Cool" : e < 75 ? "Comfortable" : e < 82 ? "Warm" : "Hot" : t === "%" ? e < 20 ? "Very Low" : e < 40 ? "Low" : e < 60 ? "Medium" : e < 80 ? "High" : "Very High" : t === "ppm" ? e < 400 ? "Excellent" : e < 600 ? "Good" : e < 1e3 ? "Acceptable" : e < 1500 ? "Mediocre" : "Poor" : t === "lx" ? e < 50 ? "Dark" : e < 200 ? "Dim" : e < 500 ? "Moderate" : e < 1e3 ? "Bright" : "Very Bright" : t === "AQI" ? e <= 50 ? "Good" : e <= 100 ? "Moderate" : e <= 150 ? "Unhealthy for Sensitive" : e <= 200 ? "Unhealthy" : e <= 300 ? "Very Unhealthy" : "Hazardous" : t === "dB" ? e < 30 ? "Very Quiet" : e < 50 ? "Quiet" : e < 70 ? "Moderate" : e < 85 ? "Loud" : "Very Loud" : null;
997
1024
  }
998
- var He = /* @__PURE__ */ w("<div><div>"), Ge = /* @__PURE__ */ w("<div>");
999
- function Pe(t) {
1000
- const e = I();
1025
+ var Nt = /* @__PURE__ */ v("<div><div>"), Wt = /* @__PURE__ */ v("<div>");
1026
+ function At(e) {
1027
+ const t = P();
1001
1028
  return (() => {
1002
- var r = He(), i = r.firstChild;
1003
- return b(i, () => Re(t.value, t.unit)), b(r, (() => {
1004
- var n = _(() => !!(t.interpret && typeof t.value == "number"));
1029
+ var r = Nt(), i = r.firstChild;
1030
+ return h(i, () => Ot(e.value, e.unit)), h(r, (() => {
1031
+ var n = E(() => !!(e.interpret && typeof e.value == "number"));
1005
1032
  return () => n() && (() => {
1006
- var a = Ge();
1007
- return b(a, () => Ie(t.value, t.unit)), z((o) => {
1008
- var s = k("text-foreground/60", F.subtitle(e.size())), l = W.S1(e.size());
1009
- return s !== o.e && S(a, o.e = s), l !== o.t && M(a, "margin-top", o.t = l), o;
1033
+ var a = Wt();
1034
+ return h(a, () => Vt(e.value, e.unit)), z((o) => {
1035
+ var s = $("text-foreground/60", G.subtitle(t.size())), l = W.S1(t.size());
1036
+ return s !== o.e && S(a, o.e = s), l !== o.t && V(a, "margin-top", o.t = l), o;
1010
1037
  }, {
1011
1038
  e: void 0,
1012
1039
  t: void 0
1013
1040
  }), a;
1014
1041
  })();
1015
1042
  })(), null), z((n) => {
1016
- var a = k("flex flex-col", t.class), o = k("font-bold text-foreground", F.value(e.size()));
1043
+ var a = $("flex flex-col", e.class), o = $("font-bold text-foreground", G.value(t.size()));
1017
1044
  return a !== n.e && S(r, n.e = a), o !== n.t && S(i, n.t = o), n;
1018
1045
  }, {
1019
1046
  e: void 0,
@@ -1021,245 +1048,241 @@ function Pe(t) {
1021
1048
  }), r;
1022
1049
  })();
1023
1050
  }
1024
- var Le = /* @__PURE__ */ w('<div><div><div class="relative h-full w-full">'), Be = /* @__PURE__ */ w('<div class="pointer-events-none absolute inset-0"><div>'), je = /* @__PURE__ */ w('<div class="pointer-events-none absolute inset-0 animate-pulse bg-blue-500/20">'), Fe = /* @__PURE__ */ w('<div class="flex h-full w-full flex-col items-center justify-center gap-2 text-center">'), Ue = /* @__PURE__ */ w('<div class="flex items-center justify-center text-white/30">'), Ye = /* @__PURE__ */ w('<h3 class="font-semibold text-sm text-white/60">'), Ke = /* @__PURE__ */ w('<p class="text-white/50 text-xs">');
1025
- function qe(t, e) {
1026
- const r = t * e;
1051
+ var It = /* @__PURE__ */ v('<div><div class="relative h-full w-full">'), Pt = /* @__PURE__ */ v('<div class="glasshome-widget-loading pointer-events-none absolute inset-0 animate-pulse">'), Lt = /* @__PURE__ */ v('<div class="flex h-full w-full flex-col items-center justify-center gap-2 text-center">'), Rt = /* @__PURE__ */ v('<div class="flex items-center justify-center text-white/30">'), Ht = /* @__PURE__ */ v('<h3 class="font-semibold text-sm text-white/60">'), Gt = /* @__PURE__ */ v('<p class="text-white/50 text-xs">');
1052
+ function jt(e, t) {
1053
+ const r = e * t;
1027
1054
  return r <= 2 ? "xs" : r <= 4 ? "sm" : r <= 8 ? "md" : r <= 18 ? "lg" : "xl";
1028
1055
  }
1029
- function Xe(t, e) {
1030
- return t > e ? "horizontal" : e > t ? "vertical" : "square";
1056
+ function Bt(e, t) {
1057
+ return e > t ? "horizontal" : t > e ? "vertical" : "square";
1031
1058
  }
1032
- function Je(t, e) {
1033
- return e >= 150 ? "vertical" : t > e ? "horizontal" : e > t ? "vertical" : "square";
1059
+ function Ft(e, t) {
1060
+ return t >= 150 ? "vertical" : e > t ? "horizontal" : t > e ? "vertical" : "square";
1034
1061
  }
1035
- function Ze(t) {
1036
- let e;
1037
- const r = It(() => e), i = 2, [n, a] = j(0), [o, s] = j(0);
1038
- q(() => {
1039
- const f = Math.round(r.width ?? 0), u = Math.round(r.height ?? 0), A = yt(n), p = yt(o);
1040
- (Math.abs(f - A) > i || Math.abs(u - p) > i) && (a(f), s(u));
1062
+ function Ut(e) {
1063
+ Te(() => {
1064
+ Fe();
1065
+ });
1066
+ let t;
1067
+ const r = Ie(() => t), i = 2, [n, a] = H(0), [o, s] = H(0);
1068
+ U(() => {
1069
+ const d = Math.round(r.width ?? 0), _ = Math.round(r.height ?? 0), p = xe(n), c = xe(o);
1070
+ (Math.abs(d - p) > i || Math.abs(_ - c) > i) && (a(d), s(_));
1041
1071
  });
1042
- const l = N(() => {
1043
- if (t.variant)
1044
- return typeof t.variant == "string" ? Kt(t.variant) : t.variant;
1045
- }), d = N(() => ({
1072
+ const l = M(() => {
1073
+ if (e.variant)
1074
+ return typeof e.variant == "string" ? qe(e.variant) : e.variant;
1075
+ }), g = M(() => ({
1046
1076
  width: n(),
1047
1077
  height: o(),
1048
1078
  gridWidth: Math.max(1, Math.round(n() / 150)),
1049
1079
  gridHeight: Math.max(1, Math.round(o() / 75))
1050
1080
  }), void 0, {
1051
- equals: (f, u) => f.width === u.width && f.height === u.height && f.gridWidth === u.gridWidth && f.gridHeight === u.gridHeight
1052
- }), c = N(() => {
1053
- const f = d();
1054
- return qe(f.gridWidth, f.gridHeight);
1055
- }), v = N(() => {
1056
- const f = d();
1057
- return Xe(f.width, f.height);
1058
- }), C = N(() => {
1059
- const f = d();
1060
- return Je(f.width, f.height);
1061
- }), m = Ct(ht), x = m;
1062
- x?._isStub?.() && x._bridge && (q(() => {
1063
- x._bridge.setSize(c());
1064
- }), q(() => {
1065
- x._bridge.setOrientation(v());
1066
- }), q(() => {
1067
- x._bridge.setContentLayout(C());
1068
- }), q(() => {
1069
- x._bridge.setDimensions(d());
1070
- }), q(() => {
1071
- x._bridge.setIsStub(!1);
1081
+ equals: (d, _) => d.width === _.width && d.height === _.height && d.gridWidth === _.gridWidth && d.gridHeight === _.gridHeight
1082
+ }), m = M(() => {
1083
+ const d = g();
1084
+ return jt(d.gridWidth, d.gridHeight);
1085
+ }), k = M(() => {
1086
+ const d = g();
1087
+ return Bt(d.width, d.height);
1088
+ }), R = M(() => {
1089
+ const d = g();
1090
+ return Ft(d.width, d.height);
1091
+ }), x = pe(ue), w = x;
1092
+ w?._isStub?.() && w._bridge && (U(() => {
1093
+ w._bridge.setSize(m());
1094
+ }), U(() => {
1095
+ w._bridge.setOrientation(k());
1096
+ }), U(() => {
1097
+ w._bridge.setContentLayout(R());
1098
+ }), U(() => {
1099
+ w._bridge.setDimensions(g());
1100
+ }), U(() => {
1101
+ w._bridge.setIsStub(!1);
1072
1102
  }));
1073
- const V = {
1074
- size: c,
1075
- orientation: v,
1076
- contentLayout: C,
1077
- dimensions: d,
1078
- isEditMode: () => t.isEditMode ?? !1,
1079
- updateConfig: m?.updateConfig ?? (() => {
1103
+ const N = {
1104
+ size: m,
1105
+ orientation: k,
1106
+ contentLayout: R,
1107
+ dimensions: g,
1108
+ isEditMode: () => e.isEditMode ?? !1,
1109
+ updateConfig: x?.updateConfig ?? (() => {
1080
1110
  })
1081
- }, E = "bg-gradient-to-br from-gray-500/20 to-gray-600/20", R = N(() => t.emptyState && !t.gradient ? E : t.gradient), K = N(() => ({
1111
+ }, D = M(() => ({
1082
1112
  "container-type": "size",
1083
1113
  "container-name": "widget",
1084
- "touch-action": t.gestures && !t.isEditMode ? t.gestures.touchAction() : void 0,
1114
+ "touch-action": e.gestures && !e.isEditMode ? e.gestures.touchAction() : void 0,
1085
1115
  ...l()?.styles?.container,
1086
- ...l()?.styles?.cssVars || {}
1087
- })), B = () => !!t.gestures && !t.isEditMode, h = (f) => {
1088
- B() && t.gestures?.onPointerEnter(f);
1089
- }, y = (f) => {
1090
- B() && t.gestures?.onPointerDown(f);
1091
- }, $ = (f) => {
1092
- B() && t.gestures?.onPointerMove(f);
1093
- }, O = (f) => {
1094
- B() && t.gestures?.onPointerUp(f);
1095
- }, H = (f) => {
1096
- B() && t.gestures?.onPointerCancel(f);
1116
+ ...l()?.styles?.cssVars || {},
1117
+ ...e.tone ? {
1118
+ "--widget-color": `var(--tone-${e.tone})`
1119
+ } : {},
1120
+ ...e.color ? {
1121
+ "--widget-color": e.color
1122
+ } : {},
1123
+ ...e.colorTo ? {
1124
+ "--widget-color-to": e.colorTo
1125
+ } : {},
1126
+ ...e.gradient ? {
1127
+ "--widget-gradient": e.gradient
1128
+ } : {}
1129
+ })), T = () => !!e.gestures && !e.isEditMode, F = (d) => {
1130
+ T() && e.gestures?.onPointerEnter(d);
1131
+ }, q = (d) => {
1132
+ T() && e.gestures?.onPointerDown(d);
1133
+ }, f = (d) => {
1134
+ T() && e.gestures?.onPointerMove(d);
1135
+ }, b = (d) => {
1136
+ T() && e.gestures?.onPointerUp(d);
1137
+ }, y = (d) => {
1138
+ T() && e.gestures?.onPointerCancel(d);
1097
1139
  };
1098
- return T(ht.Provider, {
1099
- value: V,
1140
+ return O(ue.Provider, {
1141
+ value: N,
1100
1142
  get children() {
1101
- var f = Le(), u = f.firstChild, A = u.firstChild;
1102
- return nt(f, "pointercancel", H), nt(f, "pointerup", O), nt(f, "pointermove", $), nt(f, "pointerdown", y), nt(f, "pointerenter", h), Vt((p) => {
1103
- e = p, t.gestures?.bindElement(p);
1104
- }, f), b(u, (() => {
1105
- var p = _(() => !!t.backgroundGlow);
1106
- return () => p() && (() => {
1107
- var G = Be(), Q = G.firstChild;
1108
- return z((P) => {
1109
- var J = U.BACKGROUND, ut = k("absolute inset-0 opacity-20 blur-2xl", t.backgroundGlow);
1110
- return J !== P.e && M(G, "z-index", P.e = J), ut !== P.t && S(Q, P.t = ut), P;
1111
- }, {
1112
- e: void 0,
1113
- t: void 0
1114
- }), G;
1115
- })();
1116
- })(), A), b(A, (() => {
1117
- var p = _(() => !!t.emptyState);
1118
- return () => p() ? T(Qe, {
1143
+ var d = It(), _ = d.firstChild;
1144
+ return Q(d, "pointercancel", y), Q(d, "pointerup", b), Q(d, "pointermove", f), Q(d, "pointerdown", q), Q(d, "pointerenter", F), Ve((p) => {
1145
+ t = p, e.gestures?.bindElement(p);
1146
+ }, d), h(_, (() => {
1147
+ var p = E(() => !!e.emptyState);
1148
+ return () => p() ? O(Yt, {
1119
1149
  get icon() {
1120
- return t.emptyState.icon;
1150
+ return e.emptyState.icon;
1121
1151
  },
1122
1152
  get title() {
1123
- return t.emptyState.title;
1153
+ return e.emptyState.title;
1124
1154
  },
1125
1155
  get message() {
1126
- return t.emptyState.message;
1156
+ return e.emptyState.message;
1127
1157
  }
1128
- }) : t.children;
1129
- })()), b(u, (() => {
1130
- var p = _(() => !!t.loading);
1158
+ }) : e.children;
1159
+ })()), h(d, (() => {
1160
+ var p = E(() => !!e.loading);
1131
1161
  return () => p() && (() => {
1132
- var G = je();
1133
- return z((Q) => M(G, "z-index", U.OVERLAY)), G;
1162
+ var c = Pt();
1163
+ return z((A) => V(c, "z-index", K.OVERLAY)), c;
1134
1164
  })();
1135
1165
  })(), null), z((p) => {
1136
- var G = k(
1137
- "relative h-full w-full select-none rounded-xl border border-border/50",
1166
+ var c = $(
1167
+ "glasshome-widget",
1168
+ "relative h-full w-full select-none overflow-hidden rounded-xl border border-border/50",
1138
1169
  // Variant styles (lowest priority)
1139
1170
  l()?.styles?.class,
1140
1171
  // Custom class (highest priority)
1141
- t.class
1142
- ), Q = K(), P = k(
1143
- "relative h-full w-full overflow-hidden rounded-xl",
1144
- // Gradient prop (overrides variant, auto-applied for empty state)
1145
- R()
1146
- ), J = U.CONTENT;
1147
- return G !== p.e && S(f, p.e = G), p.t = ot(f, Q, p.t), P !== p.a && S(u, p.a = P), J !== p.o && M(A, "z-index", p.o = J), p;
1172
+ e.class
1173
+ ), A = D(), I = K.CONTENT;
1174
+ return c !== p.e && S(d, p.e = c), p.t = Z(d, A, p.t), I !== p.a && V(_, "z-index", p.a = I), p;
1148
1175
  }, {
1149
1176
  e: void 0,
1150
1177
  t: void 0,
1151
- a: void 0,
1152
- o: void 0
1153
- }), f;
1178
+ a: void 0
1179
+ }), d;
1154
1180
  }
1155
1181
  });
1156
1182
  }
1157
- function Qe(t) {
1183
+ function Yt(e) {
1158
1184
  return (() => {
1159
- var e = Fe();
1160
- return b(e, (() => {
1161
- var r = _(() => !!t.icon);
1185
+ var t = Lt();
1186
+ return h(t, (() => {
1187
+ var r = E(() => !!e.icon);
1162
1188
  return () => r() && (() => {
1163
- var i = Ue();
1164
- return b(i, () => t.icon), i;
1189
+ var i = Rt();
1190
+ return h(i, () => e.icon), i;
1165
1191
  })();
1166
- })(), null), b(e, (() => {
1167
- var r = _(() => !!t.title);
1192
+ })(), null), h(t, (() => {
1193
+ var r = E(() => !!e.title);
1168
1194
  return () => r() && (() => {
1169
- var i = Ye();
1170
- return b(i, () => t.title), i;
1195
+ var i = Ht();
1196
+ return h(i, () => e.title), i;
1171
1197
  })();
1172
- })(), null), b(e, (() => {
1173
- var r = _(() => !!t.message);
1198
+ })(), null), h(t, (() => {
1199
+ var r = E(() => !!e.message);
1174
1200
  return () => r() && (() => {
1175
- var i = Ke();
1176
- return b(i, () => t.message), i;
1201
+ var i = Gt();
1202
+ return h(i, () => e.message), i;
1177
1203
  })();
1178
- })(), null), e;
1204
+ })(), null), t;
1179
1205
  })();
1180
1206
  }
1181
- const Y = Ze;
1182
- Y.Content = oe;
1183
- Y.Icon = ye;
1184
- Y.Title = Oe;
1185
- Y.Subtitle = _e;
1186
- Y.Status = ze;
1187
- Y.Value = Pe;
1188
- Y.Metrics = _t;
1189
- Y.EmptyState = ge;
1190
- Y.SliderFill = ne;
1191
- var tn = /* @__PURE__ */ w("<div><div>");
1192
- const en = {
1193
- blue: "bg-blue-500/30",
1194
- green: "bg-green-500/30",
1195
- red: "bg-red-500/30",
1196
- yellow: "bg-yellow-500/30",
1197
- purple: "bg-purple-500/30",
1198
- gray: "bg-gray-500/30"
1199
- };
1200
- function Jn(t) {
1201
- const e = () => en[t.color] ?? t.color;
1207
+ const B = Ut;
1208
+ B.Content = ot;
1209
+ B.Icon = ft;
1210
+ B.Title = zt;
1211
+ B.Subtitle = St;
1212
+ B.Status = kt;
1213
+ B.Value = At;
1214
+ B.Metrics = Se;
1215
+ B.EmptyState = gt;
1216
+ B.SliderFill = nt;
1217
+ var Kt = /* @__PURE__ */ v("<div>");
1218
+ function Fn(e) {
1219
+ const t = () => {
1220
+ const r = {
1221
+ "z-index": K.BACKGROUND,
1222
+ background: "radial-gradient(circle, color-mix(in oklch, var(--widget-color) 30%, transparent), transparent 70%)"
1223
+ };
1224
+ return e.color && (r["--widget-color"] = e.color), r;
1225
+ };
1202
1226
  return (() => {
1203
- var r = tn(), i = r.firstChild;
1204
- return z((n) => {
1205
- var a = k("pointer-events-none absolute inset-0", t.class), o = U.BACKGROUND, s = k("absolute inset-0 opacity-40 blur-3xl", e());
1206
- return a !== n.e && S(r, n.e = a), o !== n.t && M(r, "z-index", n.t = o), s !== n.a && S(i, n.a = s), n;
1227
+ var r = Kt();
1228
+ return z((i) => {
1229
+ var n = $("pointer-events-none absolute inset-0 opacity-40 blur-3xl", e.class), a = t();
1230
+ return n !== i.e && S(r, i.e = n), i.t = Z(r, a, i.t), i;
1207
1231
  }, {
1208
1232
  e: void 0,
1209
- t: void 0,
1210
- a: void 0
1233
+ t: void 0
1211
1234
  }), r;
1212
1235
  })();
1213
1236
  }
1214
- var nn = /* @__PURE__ */ w("<div>");
1215
- function Zn(t) {
1216
- const e = I(), r = () => {
1217
- const i = t.spacing ?? "S2";
1218
- return W[i](e.size());
1237
+ var qt = /* @__PURE__ */ v("<div>");
1238
+ function Un(e) {
1239
+ const t = P(), r = () => {
1240
+ const i = e.spacing ?? "S2";
1241
+ return W[i](t.size());
1219
1242
  };
1220
1243
  return (() => {
1221
- var i = nn();
1222
- return b(i, () => t.children), z((n) => {
1223
- var a = k("flex flex-col", t.class), o = r();
1224
- return a !== n.e && S(i, n.e = a), o !== n.t && M(i, "gap", n.t = o), n;
1244
+ var i = qt();
1245
+ return h(i, () => e.children), z((n) => {
1246
+ var a = $("flex flex-col", e.class), o = r();
1247
+ return a !== n.e && S(i, n.e = a), o !== n.t && V(i, "gap", n.t = o), n;
1225
1248
  }, {
1226
1249
  e: void 0,
1227
1250
  t: void 0
1228
1251
  }), i;
1229
1252
  })();
1230
1253
  }
1231
- var rn = /* @__PURE__ */ w('<span class="inline-flex size-3.5 shrink-0 items-center">'), an = /* @__PURE__ */ w("<button type=button>"), on = /* @__PURE__ */ w('<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox="0 0 24 24"stroke=currentColor stroke-width=2><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z">'), sn = /* @__PURE__ */ w('<div class="rounded-lg bg-muted/30 p-2 text-center md:p-6"><p class="text-muted-foreground text-sm">No edit options available'), ln = /* @__PURE__ */ w('<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox="0 0 24 24"stroke=currentColor stroke-width=2><line x1=4 y1=21 x2=4 y2=14></line><line x1=4 y1=10 x2=4 y2=3></line><line x1=12 y1=21 x2=12 y2=12></line><line x1=12 y1=8 x2=12 y2=3></line><line x1=20 y1=21 x2=20 y2=16></line><line x1=20 y1=12 x2=20 y2=3></line><line x1=1 y1=14 x2=7 y2=14></line><line x1=9 y1=8 x2=15 y2=8></line><line x1=17 y1=16 x2=23 y2=16>'), cn = /* @__PURE__ */ w('<div class="rounded-lg bg-muted/30 p-2 text-center md:p-6"><p class="text-muted-foreground text-sm">No additional controls'), un = /* @__PURE__ */ w('<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox="0 0 24 24"stroke=currentColor stroke-width=2><path d="m8 2 1.88 1.88"></path><path d="M14.12 3.88 16 2"></path><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"></path><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"></path><path d="M12 20v-9"></path><path d="M6.53 9C4.6 8.8 3 7.1 3 5"></path><path d="M6 13H2"></path><path d="M3 21c0-2.1 1.7-3.9 3.8-4"></path><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"></path><path d="M22 13h-4"></path><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4">'), dn = /* @__PURE__ */ w('<div class="rounded-lg bg-muted/30 p-2 text-center md:p-6"><p class="text-muted-foreground text-sm">No debug information available'), gn = /* @__PURE__ */ w('<div class="min-w-0 shrink-0">'), mn = /* @__PURE__ */ w('<div class="flex items-center gap-2"><div class="flex h-8 items-center rounded-lg border border-border/50 bg-muted/30 p-0.5">'), fn = /* @__PURE__ */ w('<div class="min-h-0 flex-1 overflow-y-auto [scrollbar-gutter:stable]">'), hn = /* @__PURE__ */ w('<div class="flex shrink-0 items-center justify-end gap-2 border-border/50 border-t pt-3">');
1232
- function bn(t) {
1254
+ var Xt = /* @__PURE__ */ v('<span class="inline-flex size-3.5 shrink-0 items-center">'), Jt = /* @__PURE__ */ v("<button type=button>"), Zt = /* @__PURE__ */ v('<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox="0 0 24 24"stroke=currentColor stroke-width=2><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z">'), Qt = /* @__PURE__ */ v('<div class="rounded-lg bg-muted/30 p-2 text-center md:p-6"><p class="text-muted-foreground text-sm">No edit options available'), en = /* @__PURE__ */ v('<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox="0 0 24 24"stroke=currentColor stroke-width=2><line x1=4 y1=21 x2=4 y2=14></line><line x1=4 y1=10 x2=4 y2=3></line><line x1=12 y1=21 x2=12 y2=12></line><line x1=12 y1=8 x2=12 y2=3></line><line x1=20 y1=21 x2=20 y2=16></line><line x1=20 y1=12 x2=20 y2=3></line><line x1=1 y1=14 x2=7 y2=14></line><line x1=9 y1=8 x2=15 y2=8></line><line x1=17 y1=16 x2=23 y2=16>'), tn = /* @__PURE__ */ v('<div class="rounded-lg bg-muted/30 p-2 text-center md:p-6"><p class="text-muted-foreground text-sm">No additional controls'), nn = /* @__PURE__ */ v('<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox="0 0 24 24"stroke=currentColor stroke-width=2><path d="m8 2 1.88 1.88"></path><path d="M14.12 3.88 16 2"></path><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"></path><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"></path><path d="M12 20v-9"></path><path d="M6.53 9C4.6 8.8 3 7.1 3 5"></path><path d="M6 13H2"></path><path d="M3 21c0-2.1 1.7-3.9 3.8-4"></path><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"></path><path d="M22 13h-4"></path><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4">'), rn = /* @__PURE__ */ v('<div class="rounded-lg bg-muted/30 p-2 text-center md:p-6"><p class="text-muted-foreground text-sm">No debug information available'), an = /* @__PURE__ */ v('<div class="min-w-0 shrink-0">'), on = /* @__PURE__ */ v('<div class="flex items-center gap-2"><div class="flex h-8 items-center rounded-lg border border-border/50 bg-muted/30 p-0.5">'), sn = /* @__PURE__ */ v('<div class="min-h-0 flex-1 overflow-y-auto [scrollbar-gutter:stable]">'), ln = /* @__PURE__ */ v('<div class="flex shrink-0 items-center justify-end gap-2 border-border/50 border-t pt-3">');
1255
+ function cn(e) {
1233
1256
  return (() => {
1234
- var e = an();
1235
- return e.$$click = () => t.onClick(), b(e, T(et, {
1257
+ var t = Jt();
1258
+ return t.$$click = () => e.onClick(), h(t, O(J, {
1236
1259
  get when() {
1237
- return t.isActive;
1260
+ return e.isActive;
1238
1261
  },
1239
1262
  get children() {
1240
- var r = rn();
1241
- return b(r, () => t.icon), r;
1263
+ var r = Xt();
1264
+ return h(r, () => e.icon), r;
1242
1265
  }
1243
- }), null), b(e, () => t.label, null), z(() => S(e, k("flex cursor-pointer items-center justify-center rounded-md px-3 py-1.5 text-xs transition-all duration-300 ease-in-out", t.isActive ? "gap-1.5 bg-foreground/10 font-semibold text-foreground shadow-sm" : "gap-0 text-muted-foreground hover:bg-foreground/5 hover:text-foreground"))), e;
1266
+ }), null), h(t, () => e.label, null), z(() => S(t, $("flex cursor-pointer items-center justify-center rounded-md px-3 py-1.5 text-xs transition-all duration-300 ease-in-out", e.isActive ? "gap-1.5 bg-foreground/10 font-semibold text-foreground shadow-sm" : "gap-0 text-muted-foreground hover:bg-foreground/5 hover:text-foreground"))), t;
1244
1267
  })();
1245
1268
  }
1246
- function Qn(t) {
1247
- const [e] = Tt(t, ["open", "onOpenChange", "title", "onSave", "hasUnsavedChanges", "onDelete", "editContent", "controlsContent", "debugContent", "debugData", "tabs", "class", "maxWidth", "defaultTab", "headerActions", "configSchema", "config", "onConfigSave", "ResponsiveDialog", "ResponsiveDialogContent", "ResponsiveDialogHeader", "ResponsiveDialogTitle", "ResponsiveDialogDescription", "Button", "SchemaForm"]), r = () => !!e.configSchema && !!e.config && !!e.onConfigSave && !!e.SchemaForm, [i, n] = j({}), [a, o] = j(null);
1248
- q(wt(() => e.config, (u) => {
1249
- u && n({
1250
- ...u
1269
+ function Yn(e) {
1270
+ const [t] = Oe(e, ["open", "onOpenChange", "title", "onSave", "hasUnsavedChanges", "onDelete", "editContent", "controlsContent", "debugContent", "debugData", "tabs", "class", "maxWidth", "defaultTab", "headerActions", "configSchema", "config", "onConfigSave", "ResponsiveDialog", "ResponsiveDialogContent", "ResponsiveDialogHeader", "ResponsiveDialogTitle", "ResponsiveDialogDescription", "Button", "SchemaForm"]), r = () => !!t.configSchema && !!t.config && !!t.onConfigSave && !!t.SchemaForm, [i, n] = H({}), [a, o] = H(null);
1271
+ U(be(() => t.config, (c) => {
1272
+ c && n({
1273
+ ...c
1251
1274
  });
1252
- })), q(wt(() => e.configSchema, (u) => {
1253
- u && o(Mt(u));
1275
+ })), U(be(() => t.configSchema, (c) => {
1276
+ c && o(ke(c));
1254
1277
  }));
1255
- const s = () => r() && JSON.stringify(i()) !== JSON.stringify(e.config), l = (u) => {
1256
- !u && e.config && n({
1257
- ...e.config
1258
- }), e.onOpenChange(u);
1259
- }, d = () => {
1260
- e.onConfigSave?.(i());
1261
- }, [c, v] = j(e.defaultTab ?? "controls"), C = () => {
1262
- const u = e.maxWidth ?? "3xl";
1278
+ const s = () => r() && JSON.stringify(i()) !== JSON.stringify(t.config), l = (c) => {
1279
+ !c && t.config && n({
1280
+ ...t.config
1281
+ }), t.onOpenChange(c);
1282
+ }, g = () => {
1283
+ t.onConfigSave?.(i());
1284
+ }, [m, k] = H(t.defaultTab ?? "controls"), R = () => {
1285
+ const c = t.maxWidth ?? "3xl";
1263
1286
  return {
1264
1287
  sm: "max-w-sm",
1265
1288
  md: "max-w-md",
@@ -1268,15 +1291,15 @@ function Qn(t) {
1268
1291
  "2xl": "max-w-2xl",
1269
1292
  "3xl": "max-w-3xl",
1270
1293
  "4xl": "max-w-4xl"
1271
- }[u];
1272
- }, m = () => {
1273
- if (e.tabs) return e.tabs;
1274
- const u = [];
1275
- return u.push({
1294
+ }[c];
1295
+ }, x = () => {
1296
+ if (t.tabs) return t.tabs;
1297
+ const c = [];
1298
+ return c.push({
1276
1299
  id: "edit",
1277
1300
  label: "Edit",
1278
- icon: on(),
1279
- content: e.editContent ?? (r() && a() ? T($, {
1301
+ icon: Zt(),
1302
+ content: t.editContent ?? (r() && a() ? O(y, {
1280
1303
  get schema() {
1281
1304
  return a();
1282
1305
  },
@@ -1284,125 +1307,125 @@ function Qn(t) {
1284
1307
  return i();
1285
1308
  },
1286
1309
  onChange: n
1287
- }) : sn())
1288
- }), u.push({
1310
+ }) : Qt())
1311
+ }), c.push({
1289
1312
  id: "controls",
1290
1313
  label: "Controls",
1291
- icon: ln(),
1292
- content: e.controlsContent ?? cn()
1293
- }), u.push({
1314
+ icon: en(),
1315
+ content: t.controlsContent ?? tn()
1316
+ }), c.push({
1294
1317
  id: "debug",
1295
1318
  label: "Debug",
1296
- icon: un(),
1297
- content: e.debugContent ?? dn()
1298
- }), u;
1299
- }, x = async () => {
1300
- if (e.debugData !== void 0)
1319
+ icon: nn(),
1320
+ content: t.debugContent ?? rn()
1321
+ }), c;
1322
+ }, w = async () => {
1323
+ if (t.debugData !== void 0)
1301
1324
  try {
1302
- const u = typeof e.debugData == "string" ? e.debugData : JSON.stringify(e.debugData, null, 2);
1303
- await navigator.clipboard.writeText(u);
1325
+ const c = typeof t.debugData == "string" ? t.debugData : JSON.stringify(t.debugData, null, 2);
1326
+ await navigator.clipboard.writeText(c);
1304
1327
  } catch {
1305
1328
  }
1306
- }, V = () => {
1307
- const u = m();
1308
- return u.find((p) => p.id === c())?.content ?? u[0]?.content;
1309
- }, E = e.ResponsiveDialog, R = e.ResponsiveDialogContent, K = e.ResponsiveDialogHeader, B = e.ResponsiveDialogTitle, h = e.ResponsiveDialogDescription, y = e.Button, $ = e.SchemaForm, O = (u) => r() ? l(u) : e.onOpenChange(u), H = () => r() ? s() : e.hasUnsavedChanges, f = () => r() ? d : e.onSave;
1310
- return T(E, {
1329
+ }, N = () => {
1330
+ const c = x();
1331
+ return c.find((I) => I.id === m())?.content ?? c[0]?.content;
1332
+ }, D = t.ResponsiveDialog, T = t.ResponsiveDialogContent, F = t.ResponsiveDialogHeader, q = t.ResponsiveDialogTitle, f = t.ResponsiveDialogDescription, b = t.Button, y = t.SchemaForm, d = (c) => r() ? l(c) : t.onOpenChange(c), _ = () => r() ? s() : t.hasUnsavedChanges, p = () => r() ? g : t.onSave;
1333
+ return O(D, {
1311
1334
  get open() {
1312
- return e.open;
1335
+ return t.open;
1313
1336
  },
1314
- onOpenChange: (u) => O(u),
1337
+ onOpenChange: (c) => d(c),
1315
1338
  get children() {
1316
- return T(R, {
1339
+ return O(T, {
1317
1340
  get class() {
1318
- return k(C(), e.class);
1341
+ return $(R(), t.class);
1319
1342
  },
1320
1343
  get children() {
1321
- return [T(K, {
1344
+ return [O(F, {
1322
1345
  class: "flex flex-row items-center justify-between gap-3",
1323
1346
  get children() {
1324
1347
  return [(() => {
1325
- var u = gn();
1326
- return b(u, T(B, {
1348
+ var c = an();
1349
+ return h(c, O(q, {
1327
1350
  class: "truncate leading-tight",
1328
1351
  get children() {
1329
- return e.title;
1352
+ return t.title;
1330
1353
  }
1331
- }), null), b(u, T(h, {
1354
+ }), null), h(c, O(f, {
1332
1355
  class: "sr-only",
1333
1356
  children: "Widget configuration dialog"
1334
- }), null), u;
1357
+ }), null), c;
1335
1358
  })(), (() => {
1336
- var u = mn(), A = u.firstChild;
1337
- return b(A, () => m().map((p) => T(bn, {
1359
+ var c = on(), A = c.firstChild;
1360
+ return h(A, () => x().map((I) => O(cn, {
1338
1361
  get icon() {
1339
- return p.icon;
1362
+ return I.icon;
1340
1363
  },
1341
1364
  get label() {
1342
- return p.label;
1365
+ return I.label;
1343
1366
  },
1344
1367
  get isActive() {
1345
- return c() === p.id;
1368
+ return m() === I.id;
1346
1369
  },
1347
- onClick: () => v(p.id)
1348
- }))), b(u, T(et, {
1370
+ onClick: () => k(I.id)
1371
+ }))), h(c, O(J, {
1349
1372
  get when() {
1350
- return e.headerActions;
1373
+ return t.headerActions;
1351
1374
  },
1352
1375
  get children() {
1353
- return e.headerActions;
1376
+ return t.headerActions;
1354
1377
  }
1355
- }), null), u;
1378
+ }), null), c;
1356
1379
  })()];
1357
1380
  }
1358
1381
  }), (() => {
1359
- var u = fn();
1360
- return b(u, V), u;
1361
- })(), T(et, {
1382
+ var c = sn();
1383
+ return h(c, N), c;
1384
+ })(), O(J, {
1362
1385
  get when() {
1363
- return _(() => c() === "edit")() && (f() || e.onDelete) || c() === "debug" && e.debugData !== void 0;
1386
+ return E(() => m() === "edit")() && (p() || t.onDelete) || m() === "debug" && t.debugData !== void 0;
1364
1387
  },
1365
1388
  get children() {
1366
- var u = hn();
1367
- return b(u, T(et, {
1389
+ var c = ln();
1390
+ return h(c, O(J, {
1368
1391
  get when() {
1369
- return _(() => c() === "edit")() && e.onDelete;
1392
+ return E(() => m() === "edit")() && t.onDelete;
1370
1393
  },
1371
1394
  get children() {
1372
- return T(y, {
1395
+ return O(b, {
1373
1396
  size: "sm",
1374
1397
  variant: "destructive",
1375
- onClick: () => e.onDelete?.(),
1398
+ onClick: () => t.onDelete?.(),
1376
1399
  children: "Delete"
1377
1400
  });
1378
1401
  }
1379
- }), null), b(u, T(et, {
1402
+ }), null), h(c, O(J, {
1380
1403
  get when() {
1381
- return _(() => c() === "edit")() && f();
1404
+ return E(() => m() === "edit")() && p();
1382
1405
  },
1383
1406
  get children() {
1384
- return T(y, {
1407
+ return O(b, {
1385
1408
  size: "sm",
1386
1409
  get disabled() {
1387
- return !H();
1410
+ return !_();
1388
1411
  },
1389
- onClick: () => f()?.(),
1412
+ onClick: () => p()?.(),
1390
1413
  children: "Save"
1391
1414
  });
1392
1415
  }
1393
- }), null), b(u, T(et, {
1416
+ }), null), h(c, O(J, {
1394
1417
  get when() {
1395
- return _(() => c() === "debug")() && e.debugData !== void 0;
1418
+ return E(() => m() === "debug")() && t.debugData !== void 0;
1396
1419
  },
1397
1420
  get children() {
1398
- return T(y, {
1421
+ return O(b, {
1399
1422
  size: "sm",
1400
1423
  variant: "outline",
1401
- onClick: x,
1424
+ onClick: w,
1402
1425
  children: "Copy"
1403
1426
  });
1404
1427
  }
1405
- }), null), u;
1428
+ }), null), c;
1406
1429
  }
1407
1430
  })];
1408
1431
  }
@@ -1410,124 +1433,264 @@ function Qn(t) {
1410
1433
  }
1411
1434
  });
1412
1435
  }
1413
- At(["click"]);
1414
- const it = 32, g = it / 2, L = "white", st = "rgba(0,0,0,0.4)", vt = 2, lt = 3;
1415
- function xn(t) {
1416
- return `url("data:image/svg+xml,${encodeURIComponent(t)}")`;
1436
+ Ne(["click"]);
1437
+ function Kn(e) {
1438
+ return M(() => {
1439
+ const t = e.entities();
1440
+ if (t.length === 0) return;
1441
+ const r = {
1442
+ widgetConfig: e.widgetConfig,
1443
+ entities: t.map((i) => {
1444
+ const n = {
1445
+ entity_id: i.id,
1446
+ state: i.state,
1447
+ domain: i.domain,
1448
+ friendly_name: i.friendlyName
1449
+ };
1450
+ return e.customEntityFields ? {
1451
+ ...n,
1452
+ ...e.customEntityFields(i)
1453
+ } : n;
1454
+ })
1455
+ };
1456
+ return e.additionalData && Object.assign(r, e.additionalData), r;
1457
+ });
1458
+ }
1459
+ function qn(e = {}) {
1460
+ const [t, r] = H(!1), [i, n] = H(!1);
1461
+ return {
1462
+ save: async (s) => {
1463
+ if (e.onSave) {
1464
+ r(!0);
1465
+ try {
1466
+ await e.onSave(s), e.onSaveSuccess?.();
1467
+ } finally {
1468
+ r(!1);
1469
+ }
1470
+ }
1471
+ },
1472
+ remove: async () => {
1473
+ if (e.onDelete) {
1474
+ n(!0);
1475
+ try {
1476
+ await e.onDelete(), e.onDeleteSuccess?.();
1477
+ } finally {
1478
+ n(!1);
1479
+ }
1480
+ }
1481
+ },
1482
+ isSaving: t,
1483
+ isDeleting: i
1484
+ };
1485
+ }
1486
+ function Xn(e = "edit") {
1487
+ const [t, r] = H(!1), [i, n] = H(e);
1488
+ return {
1489
+ showDialog: t,
1490
+ setShowDialog: r,
1491
+ openDialog: () => r(!0),
1492
+ closeDialog: () => r(!1),
1493
+ activeTab: i,
1494
+ setActiveTab: n
1495
+ };
1496
+ }
1497
+ function Jn(e) {
1498
+ const t = M(() => e.entity() !== null), r = M(() => {
1499
+ const n = e.entity();
1500
+ return n ? e.calculateData(n) : null;
1501
+ }), i = M(() => t() ? void 0 : e.emptyStateConfig);
1502
+ return {
1503
+ entity: e.entity,
1504
+ data: r,
1505
+ emptyState: i,
1506
+ hasEntity: t
1507
+ };
1508
+ }
1509
+ function Zn(e) {
1510
+ const t = e.minEntities ?? 1, r = M(() => e.entities().length), i = M(() => r() >= t), n = M(() => !i() || !e.calculateGroupData ? null : e.calculateGroupData(e.entities())), a = M(() => {
1511
+ if (!i()) return;
1512
+ const s = e.aggregationMode?.();
1513
+ if (!s || s === "none") return;
1514
+ const l = e.entities();
1515
+ if (s === "light" || s === "binary-sensor" || s === "switch")
1516
+ return Mt(l, e.allEntitiesMode);
1517
+ if (s === "sensor") {
1518
+ const g = e.sensorGroupType?.() ?? "mean";
1519
+ return _t(l, g, !0);
1520
+ }
1521
+ }), o = M(() => i() ? void 0 : e.emptyStateConfig);
1522
+ return {
1523
+ entities: e.entities,
1524
+ groupData: n,
1525
+ aggregatedData: a,
1526
+ emptyState: o,
1527
+ hasEntities: i,
1528
+ count: r
1529
+ };
1530
+ }
1531
+ function Qn(e) {
1532
+ const [t] = Pe({
1533
+ validate: Le(e.schema),
1534
+ initialValues: e.initialValues
1535
+ }), r = M(() => t.dirty), i = M(() => t.submitting);
1536
+ return {
1537
+ form: t,
1538
+ isDirty: r,
1539
+ isSubmitting: i,
1540
+ handleSubmit: (a) => {
1541
+ e.onSubmit?.(a);
1542
+ },
1543
+ getValue: Ge,
1544
+ setValue: He,
1545
+ reset: Re
1546
+ };
1547
+ }
1548
+ const se = ["xs", "sm", "md", "lg", "xl"];
1549
+ function er() {
1550
+ const e = P(), t = M(() => se.indexOf(e.size())), r = M(() => {
1551
+ const l = e.size();
1552
+ return l === "xs" || l === "sm";
1553
+ }), i = M(() => {
1554
+ const l = e.size();
1555
+ return l === "lg" || l === "xl";
1556
+ }), n = M(() => t() >= 2);
1557
+ return {
1558
+ isCompact: r,
1559
+ isLarge: i,
1560
+ showDetail: n,
1561
+ showOn: (l) => l.includes(e.size()),
1562
+ hideOn: (l) => !l.includes(e.size()),
1563
+ matches: (l) => {
1564
+ const g = l.trim();
1565
+ if (g.endsWith("+")) {
1566
+ const m = g.slice(0, -1), k = se.indexOf(m);
1567
+ return k >= 0 && t() >= k;
1568
+ }
1569
+ if (g.endsWith("-")) {
1570
+ const m = g.slice(0, -1), k = se.indexOf(m);
1571
+ return k >= 0 && t() <= k;
1572
+ }
1573
+ return e.size() === g;
1574
+ }
1575
+ };
1576
+ }
1577
+ const te = 32, u = te / 2, L = "white", re = "rgba(0,0,0,0.4)", fe = 2, ie = 3;
1578
+ function dn(e) {
1579
+ return `url("data:image/svg+xml,${encodeURIComponent(e)}")`;
1417
1580
  }
1418
- function ct(t) {
1419
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${it}" height="${it}" viewBox="0 0 ${it} ${it}">${t}</svg>`;
1581
+ function ae(e) {
1582
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${te}" height="${te}" viewBox="0 0 ${te} ${te}">${e}</svg>`;
1420
1583
  }
1421
- const vn = ct(`
1584
+ const un = ae(`
1422
1585
  <g transform="translate(6, 2)">
1423
1586
  <!-- shadow -->
1424
- <g stroke="${st}" stroke-width="${lt}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1587
+ <g stroke="${re}" stroke-width="${ie}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1425
1588
  <path d="M10 8V3a2 2 0 0 1 4 0v10l4.5-4.5a2 2 0 0 1 2.83 2.83L14 18.5c-2 2-4 3.5-8 3.5-3 0-5-2-5-5v-6a2 2 0 0 1 4 0v2"/>
1426
1589
  </g>
1427
1590
  <!-- main -->
1428
- <g stroke="${L}" stroke-width="${vt}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1591
+ <g stroke="${L}" stroke-width="${fe}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1429
1592
  <path d="M10 8V3a2 2 0 0 1 4 0v10l4.5-4.5a2 2 0 0 1 2.83 2.83L14 18.5c-2 2-4 3.5-8 3.5-3 0-5-2-5-5v-6a2 2 0 0 1 4 0v2"/>
1430
1593
  </g>
1431
1594
  </g>
1432
- `), yn = ct(`
1595
+ `), gn = ae(`
1433
1596
  <g>
1434
- <circle cx="${g}" cy="${g}" r="8" stroke="${st}" stroke-width="${lt}" fill="none"/>
1435
- <circle cx="${g}" cy="${g}" r="8" stroke="${L}" stroke-width="1.5" fill="none"/>
1436
- <circle cx="${g}" cy="${g}" r="1.5" fill="${L}"/>
1597
+ <circle cx="${u}" cy="${u}" r="8" stroke="${re}" stroke-width="${ie}" fill="none"/>
1598
+ <circle cx="${u}" cy="${u}" r="8" stroke="${L}" stroke-width="1.5" fill="none"/>
1599
+ <circle cx="${u}" cy="${u}" r="1.5" fill="${L}"/>
1437
1600
  </g>
1438
- `), wn = ct(`
1601
+ `), mn = ae(`
1439
1602
  <g>
1440
1603
  <!-- shadow -->
1441
- <g stroke="${st}" stroke-width="${lt}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1442
- <line x1="6" y1="${g}" x2="26" y2="${g}"/>
1443
- <polyline points="10,${g - 4} 6,${g} 10,${g + 4}"/>
1444
- <polyline points="22,${g - 4} 26,${g} 22,${g + 4}"/>
1604
+ <g stroke="${re}" stroke-width="${ie}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1605
+ <line x1="6" y1="${u}" x2="26" y2="${u}"/>
1606
+ <polyline points="10,${u - 4} 6,${u} 10,${u + 4}"/>
1607
+ <polyline points="22,${u - 4} 26,${u} 22,${u + 4}"/>
1445
1608
  </g>
1446
1609
  <!-- main -->
1447
- <g stroke="${L}" stroke-width="${vt}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1448
- <line x1="6" y1="${g}" x2="26" y2="${g}"/>
1449
- <polyline points="10,${g - 4} 6,${g} 10,${g + 4}"/>
1450
- <polyline points="22,${g - 4} 26,${g} 22,${g + 4}"/>
1610
+ <g stroke="${L}" stroke-width="${fe}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1611
+ <line x1="6" y1="${u}" x2="26" y2="${u}"/>
1612
+ <polyline points="10,${u - 4} 6,${u} 10,${u + 4}"/>
1613
+ <polyline points="22,${u - 4} 26,${u} 22,${u + 4}"/>
1451
1614
  </g>
1452
1615
  <!-- center grip dots -->
1453
- <circle cx="${g}" cy="${g}" r="1.5" fill="${L}"/>
1454
- <circle cx="${g - 5}" cy="${g}" r="1" fill="${L}" opacity="0.6"/>
1455
- <circle cx="${g + 5}" cy="${g}" r="1" fill="${L}" opacity="0.6"/>
1616
+ <circle cx="${u}" cy="${u}" r="1.5" fill="${L}"/>
1617
+ <circle cx="${u - 5}" cy="${u}" r="1" fill="${L}" opacity="0.6"/>
1618
+ <circle cx="${u + 5}" cy="${u}" r="1" fill="${L}" opacity="0.6"/>
1456
1619
  </g>
1457
- `), $n = ct(`
1620
+ `), fn = ae(`
1458
1621
  <g>
1459
1622
  <!-- shadow -->
1460
- <g stroke="${st}" stroke-width="${lt}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1461
- <line x1="${g}" y1="6" x2="${g}" y2="26"/>
1462
- <polyline points="${g - 4},10 ${g},6 ${g + 4},10"/>
1463
- <polyline points="${g - 4},22 ${g},26 ${g + 4},22"/>
1623
+ <g stroke="${re}" stroke-width="${ie}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1624
+ <line x1="${u}" y1="6" x2="${u}" y2="26"/>
1625
+ <polyline points="${u - 4},10 ${u},6 ${u + 4},10"/>
1626
+ <polyline points="${u - 4},22 ${u},26 ${u + 4},22"/>
1464
1627
  </g>
1465
1628
  <!-- main -->
1466
- <g stroke="${L}" stroke-width="${vt}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1467
- <line x1="${g}" y1="6" x2="${g}" y2="26"/>
1468
- <polyline points="${g - 4},10 ${g},6 ${g + 4},10"/>
1469
- <polyline points="${g - 4},22 ${g},26 ${g + 4},22"/>
1629
+ <g stroke="${L}" stroke-width="${fe}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1630
+ <line x1="${u}" y1="6" x2="${u}" y2="26"/>
1631
+ <polyline points="${u - 4},10 ${u},6 ${u + 4},10"/>
1632
+ <polyline points="${u - 4},22 ${u},26 ${u + 4},22"/>
1470
1633
  </g>
1471
1634
  <!-- center grip dots -->
1472
- <circle cx="${g}" cy="${g}" r="1.5" fill="${L}"/>
1473
- <circle cx="${g}" cy="${g - 5}" r="1" fill="${L}" opacity="0.6"/>
1474
- <circle cx="${g}" cy="${g + 5}" r="1" fill="${L}" opacity="0.6"/>
1635
+ <circle cx="${u}" cy="${u}" r="1.5" fill="${L}"/>
1636
+ <circle cx="${u}" cy="${u - 5}" r="1" fill="${L}" opacity="0.6"/>
1637
+ <circle cx="${u}" cy="${u + 5}" r="1" fill="${L}" opacity="0.6"/>
1475
1638
  </g>
1476
1639
  `);
1477
- function at(t, e, r) {
1478
- return { css: `${xn(t)} ${e} ${r}, auto`, hotspotX: e, hotspotY: r };
1479
- }
1480
- const Z = {
1481
- tap: at(vn, 12, 4),
1482
- hold: at(yn, 16, 16),
1483
- slideHorizontal: at(wn, g, g),
1484
- slideVertical: at($n, g, g)
1640
+ function ne(e, t, r) {
1641
+ return { css: `${dn(e)} ${t} ${r}, auto`, hotspotX: t, hotspotY: r };
1642
+ }
1643
+ const Y = {
1644
+ tap: ne(un, 12, 4),
1645
+ hold: ne(gn, 16, 16),
1646
+ slideHorizontal: ne(mn, u, u),
1647
+ slideVertical: ne(fn, u, u)
1485
1648
  };
1486
- function dt() {
1649
+ function le() {
1487
1650
  if (typeof window > "u") return null;
1488
- const t = window;
1489
- return t.Capacitor?.isNativePlatform?.() ? t.Capacitor.Plugins?.Haptics ?? null : null;
1651
+ const e = window;
1652
+ return e.Capacitor?.isNativePlatform?.() ? e.Capacitor.Plugins?.Haptics ?? null : null;
1490
1653
  }
1491
- function gt(t) {
1654
+ function ce(e) {
1492
1655
  if (!(typeof navigator > "u" || typeof navigator.vibrate != "function"))
1493
1656
  try {
1494
- navigator.vibrate(t);
1657
+ navigator.vibrate(e);
1495
1658
  } catch {
1496
1659
  }
1497
1660
  }
1498
- const pn = {
1661
+ const hn = {
1499
1662
  /** Light confirmation — fires when slide gesture arms after user holds still. */
1500
1663
  tick() {
1501
- const t = dt();
1502
- if (t) {
1503
- t.impact({ style: "Light" }).catch(() => {
1664
+ const e = le();
1665
+ if (e) {
1666
+ e.impact({ style: "Light" }).catch(() => {
1504
1667
  });
1505
1668
  return;
1506
1669
  }
1507
- gt(8);
1670
+ ce(8);
1508
1671
  },
1509
1672
  /** Medium bump — fires when hold gesture commits (detail opening). */
1510
1673
  bump() {
1511
- const t = dt();
1512
- if (t) {
1513
- t.impact({ style: "Medium" }).catch(() => {
1674
+ const e = le();
1675
+ if (e) {
1676
+ e.impact({ style: "Medium" }).catch(() => {
1514
1677
  });
1515
1678
  return;
1516
1679
  }
1517
- gt(20);
1680
+ ce(20);
1518
1681
  },
1519
1682
  /** Stronger pulse — reserved for edit-mode pickup (future use). */
1520
1683
  pulse() {
1521
- const t = dt();
1522
- if (t) {
1523
- t.impact({ style: "Heavy" }).catch(() => {
1684
+ const e = le();
1685
+ if (e) {
1686
+ e.impact({ style: "Heavy" }).catch(() => {
1524
1687
  });
1525
1688
  return;
1526
1689
  }
1527
- gt([0, 15, 40, 15]);
1690
+ ce([0, 15, 40, 15]);
1528
1691
  }
1529
1692
  };
1530
- function tr(t, e) {
1693
+ function tr(e, t) {
1531
1694
  const n = {
1532
1695
  isDown: !1,
1533
1696
  isTouch: !1,
@@ -1540,231 +1703,91 @@ function tr(t, e) {
1540
1703
  element: null
1541
1704
  };
1542
1705
  let a = null, o = null, s = null;
1543
- function l(h) {
1544
- h !== o && (s && s.disconnect(), s = new ResizeObserver((y) => {
1545
- const $ = y[0];
1546
- if ($) {
1547
- const O = $.borderBoxSize?.[0];
1548
- O ? a = { width: O.inlineSize, height: O.blockSize } : a = { width: $.contentRect.width, height: $.contentRect.height };
1706
+ function l(f) {
1707
+ f !== o && (s && s.disconnect(), s = new ResizeObserver((b) => {
1708
+ const y = b[0];
1709
+ if (y) {
1710
+ const d = y.borderBoxSize?.[0];
1711
+ d ? a = { width: d.inlineSize, height: d.blockSize } : a = { width: y.contentRect.width, height: y.contentRect.height };
1549
1712
  }
1550
- }), o = h, s.observe(h), a = { width: h.clientWidth, height: h.clientHeight });
1713
+ }), o = f, s.observe(f), a = { width: f.clientWidth, height: f.clientHeight });
1551
1714
  }
1552
- const d = () => {
1715
+ const g = () => {
1553
1716
  n.holdTimer && (clearTimeout(n.holdTimer), n.holdTimer = null);
1554
- }, c = () => {
1717
+ }, m = () => {
1555
1718
  n.isDown = !1, n.hasMoved = !1, n.sliding = !1;
1556
- }, v = (h) => {
1557
- const $ = t().slide;
1558
- return $?.orientation === "horizontal" ? "horizontal" : $?.orientation === "vertical" ? "vertical" : h && (a || l(h), a) ? a.height > a.width ? "vertical" : "horizontal" : (e?.() ?? "horizontal") === "horizontal" ? "horizontal" : "vertical";
1559
- }, C = (h) => {
1560
- const y = t();
1561
- if (!(!y.tap && !y.hold && !y.slide)) {
1562
- if (n.isDown = !0, n.isTouch = h.pointerType === "touch", n.element = h.currentTarget, l(n.element), n.startX = h.clientX, n.startY = h.clientY, n.startTime = Date.now(), n.hasMoved = !1, n.sliding = !1, y.hold) {
1563
- const $ = y.hold.delay ?? 500;
1719
+ }, k = (f) => {
1720
+ const y = e().slide;
1721
+ return y?.orientation === "horizontal" ? "horizontal" : y?.orientation === "vertical" ? "vertical" : f && (a || l(f), a) ? a.height > a.width ? "vertical" : "horizontal" : (t?.() ?? "horizontal") === "horizontal" ? "horizontal" : "vertical";
1722
+ }, R = (f) => {
1723
+ const b = e();
1724
+ if (!(!b.tap && !b.hold && !b.slide)) {
1725
+ if (n.isDown = !0, n.isTouch = f.pointerType === "touch", n.element = f.currentTarget, l(n.element), n.startX = f.clientX, n.startY = f.clientY, n.startTime = Date.now(), n.hasMoved = !1, n.sliding = !1, b.hold) {
1726
+ const y = b.hold.delay ?? 500;
1564
1727
  n.holdTimer = setTimeout(() => {
1565
- n.holdTimer = null, !(!n.isDown || n.hasMoved) && (pn.bump(), y.hold?.action(), n.isDown = !1);
1566
- }, $);
1728
+ n.holdTimer = null, !(!n.isDown || n.hasMoved) && (hn.bump(), b.hold?.action(), n.isDown = !1);
1729
+ }, y);
1567
1730
  }
1568
- if (!n.isTouch && y.slide)
1731
+ if (!n.isTouch && b.slide)
1569
1732
  try {
1570
- h.currentTarget.setPointerCapture(h.pointerId);
1733
+ f.currentTarget.setPointerCapture(f.pointerId);
1571
1734
  } catch {
1572
1735
  }
1573
1736
  }
1574
- }, m = (h) => {
1737
+ }, x = (f) => {
1575
1738
  if (!n.isDown) return;
1576
- const y = t(), $ = h.clientX - n.startX, O = h.clientY - n.startY;
1577
- if (Math.sqrt($ * $ + O * O) > 10 && (d(), n.hasMoved = !0), !n.isTouch && y.slide && n.hasMoved) {
1578
- const f = h.currentTarget, u = v(f);
1739
+ const b = e(), y = f.clientX - n.startX, d = f.clientY - n.startY;
1740
+ if (Math.sqrt(y * y + d * d) > 10 && (g(), n.hasMoved = !0), !n.isTouch && b.slide && n.hasMoved) {
1741
+ const p = f.currentTarget, c = k(p);
1579
1742
  n.sliding = !0;
1580
- const A = y.slide.min ?? 0, p = y.slide.max ?? 100, G = p - A, Q = u === "vertical" ? -O : $, P = a ?? { width: f.clientWidth, height: f.clientHeight }, J = u === "vertical" ? P.height : P.width, Et = Q / J * G, Nt = Math.max(A, Math.min(p, y.slide.value + Et));
1581
- y.slide.onChange(Math.round(Nt)), n.startX = h.clientX, n.startY = h.clientY, h.preventDefault();
1743
+ const A = b.slide.min ?? 0, I = b.slide.max ?? 100, Ce = I - A, De = c === "vertical" ? -d : y, he = a ?? { width: p.clientWidth, height: p.clientHeight }, ze = c === "vertical" ? he.height : he.width, Me = De / ze * Ce, _e = Math.max(A, Math.min(I, b.slide.value + Me));
1744
+ b.slide.onChange(Math.round(_e)), n.startX = f.clientX, n.startY = f.clientY, f.preventDefault();
1582
1745
  }
1583
- }, x = (h) => {
1584
- const y = t(), $ = n.isDown, O = Date.now() - n.startTime, H = y.hold?.delay ?? 500;
1585
- d(), $ && y.tap && !n.hasMoved && O < H && y.tap();
1746
+ }, w = (f) => {
1747
+ const b = e(), y = n.isDown, d = Date.now() - n.startTime, _ = b.hold?.delay ?? 500;
1748
+ g(), y && b.tap && !n.hasMoved && d < _ && b.tap();
1586
1749
  try {
1587
- h.currentTarget.releasePointerCapture(h.pointerId);
1750
+ f.currentTarget.releasePointerCapture(f.pointerId);
1588
1751
  } catch {
1589
1752
  }
1590
- c();
1591
- }, V = (h) => {
1592
- d();
1753
+ m();
1754
+ }, N = (f) => {
1755
+ g();
1593
1756
  try {
1594
- h.currentTarget.releasePointerCapture(h.pointerId);
1757
+ f.currentTarget.releasePointerCapture(f.pointerId);
1595
1758
  } catch {
1596
1759
  }
1597
- c();
1598
- }, E = (h) => {
1599
- const y = t();
1600
- if (y.slide) {
1601
- const $ = y.slide.orientation;
1602
- return $ === "horizontal" ? Z.slideHorizontal.css : $ === "vertical" ? Z.slideVertical.css : (a || l(h), a && a.height > a.width ? Z.slideVertical.css : Z.slideHorizontal.css);
1760
+ m();
1761
+ }, D = (f) => {
1762
+ const b = e();
1763
+ if (b.slide) {
1764
+ const y = b.slide.orientation;
1765
+ return y === "horizontal" ? Y.slideHorizontal.css : y === "vertical" ? Y.slideVertical.css : (a || l(f), a && a.height > a.width ? Y.slideVertical.css : Y.slideHorizontal.css);
1603
1766
  }
1604
- return y.tap ? Z.tap.css : y.hold ? Z.hold.css : "";
1767
+ return b.tap ? Y.tap.css : b.hold ? Y.hold.css : "";
1605
1768
  };
1606
1769
  return {
1607
- onPointerDown: C,
1608
- onPointerMove: m,
1609
- onPointerUp: x,
1610
- onPointerCancel: V,
1611
- onPointerEnter: (h) => {
1612
- const y = h.currentTarget;
1613
- n.element = y, y.style.cursor = E(y);
1770
+ onPointerDown: R,
1771
+ onPointerMove: x,
1772
+ onPointerUp: w,
1773
+ onPointerCancel: N,
1774
+ onPointerEnter: (f) => {
1775
+ const b = f.currentTarget;
1776
+ n.element = b, b.style.cursor = D(b);
1614
1777
  },
1615
- bindElement: (h) => {
1616
- h && (n.element = h, l(h));
1778
+ bindElement: (f) => {
1779
+ f && (n.element = f, l(f));
1617
1780
  },
1618
1781
  touchAction: () => {
1619
- const h = t();
1620
- return h.tap || h.hold || h.slide ? "manipulation" : "auto";
1782
+ const f = e();
1783
+ return f.tap || f.hold || f.slide ? "manipulation" : "auto";
1621
1784
  },
1622
1785
  dispose: () => {
1623
- d(), s && (s.disconnect(), s = null), o = null, a = null;
1786
+ g(), s && (s.disconnect(), s = null), o = null, a = null;
1624
1787
  }
1625
1788
  };
1626
1789
  }
1627
- function er(t) {
1628
- return N(() => {
1629
- const e = t.entities();
1630
- if (e.length === 0) return;
1631
- const r = {
1632
- widgetConfig: t.widgetConfig,
1633
- entities: e.map((i) => {
1634
- const n = {
1635
- entity_id: i.id,
1636
- state: i.state,
1637
- domain: i.domain,
1638
- friendly_name: i.friendlyName
1639
- };
1640
- return t.customEntityFields ? {
1641
- ...n,
1642
- ...t.customEntityFields(i)
1643
- } : n;
1644
- })
1645
- };
1646
- return t.additionalData && Object.assign(r, t.additionalData), r;
1647
- });
1648
- }
1649
- function nr(t = {}) {
1650
- const [e, r] = j(!1), [i, n] = j(!1);
1651
- return {
1652
- save: async (s) => {
1653
- if (t.onSave) {
1654
- r(!0);
1655
- try {
1656
- await t.onSave(s), t.onSaveSuccess?.();
1657
- } finally {
1658
- r(!1);
1659
- }
1660
- }
1661
- },
1662
- remove: async () => {
1663
- if (t.onDelete) {
1664
- n(!0);
1665
- try {
1666
- await t.onDelete(), t.onDeleteSuccess?.();
1667
- } finally {
1668
- n(!1);
1669
- }
1670
- }
1671
- },
1672
- isSaving: e,
1673
- isDeleting: i
1674
- };
1675
- }
1676
- function rr(t = "edit") {
1677
- const [e, r] = j(!1), [i, n] = j(t);
1678
- return {
1679
- showDialog: e,
1680
- setShowDialog: r,
1681
- openDialog: () => r(!0),
1682
- closeDialog: () => r(!1),
1683
- activeTab: i,
1684
- setActiveTab: n
1685
- };
1686
- }
1687
- function ir(t) {
1688
- const e = N(() => t.entity() !== null), r = N(() => {
1689
- const n = t.entity();
1690
- return n ? t.calculateData(n) : null;
1691
- }), i = N(() => e() ? void 0 : t.emptyStateConfig);
1692
- return {
1693
- entity: t.entity,
1694
- data: r,
1695
- emptyState: i,
1696
- hasEntity: e
1697
- };
1698
- }
1699
- function ar(t) {
1700
- const e = t.minEntities ?? 1, r = N(() => t.entities().length), i = N(() => r() >= e), n = N(() => !i() || !t.calculateGroupData ? null : t.calculateGroupData(t.entities())), a = N(() => {
1701
- if (!i()) return;
1702
- const s = t.aggregationMode?.();
1703
- if (!s || s === "none") return;
1704
- const l = t.entities();
1705
- if (s === "light" || s === "binary-sensor" || s === "switch")
1706
- return Te(l, t.allEntitiesMode);
1707
- if (s === "sensor") {
1708
- const d = t.sensorGroupType?.() ?? "mean";
1709
- return Ve(l, d, !0);
1710
- }
1711
- }), o = N(() => i() ? void 0 : t.emptyStateConfig);
1712
- return {
1713
- entities: t.entities,
1714
- groupData: n,
1715
- aggregatedData: a,
1716
- emptyState: o,
1717
- hasEntities: i,
1718
- count: r
1719
- };
1720
- }
1721
- function or(t) {
1722
- const [e] = Ht({
1723
- validate: Gt(t.schema),
1724
- initialValues: t.initialValues
1725
- }), r = N(() => e.dirty), i = N(() => e.submitting);
1726
- return {
1727
- form: e,
1728
- isDirty: r,
1729
- isSubmitting: i,
1730
- handleSubmit: (a) => {
1731
- t.onSubmit?.(a);
1732
- },
1733
- getValue: Bt,
1734
- setValue: Lt,
1735
- reset: Pt
1736
- };
1737
- }
1738
- const mt = ["xs", "sm", "md", "lg", "xl"];
1739
- function sr() {
1740
- const t = I(), e = N(() => mt.indexOf(t.size())), r = N(() => {
1741
- const l = t.size();
1742
- return l === "xs" || l === "sm";
1743
- }), i = N(() => {
1744
- const l = t.size();
1745
- return l === "lg" || l === "xl";
1746
- }), n = N(() => e() >= 2);
1747
- return {
1748
- isCompact: r,
1749
- isLarge: i,
1750
- showDetail: n,
1751
- showOn: (l) => l.includes(t.size()),
1752
- hideOn: (l) => !l.includes(t.size()),
1753
- matches: (l) => {
1754
- const d = l.trim();
1755
- if (d.endsWith("+")) {
1756
- const c = d.slice(0, -1), v = mt.indexOf(c);
1757
- return v >= 0 && e() >= v;
1758
- }
1759
- if (d.endsWith("-")) {
1760
- const c = d.slice(0, -1), v = mt.indexOf(c);
1761
- return v >= 0 && e() <= v;
1762
- }
1763
- return t.size() === d;
1764
- }
1765
- };
1766
- }
1767
- const D = {
1790
+ const C = {
1768
1791
  ocean: "bg-gradient-to-br from-cyan-600/20 to-blue-700/20",
1769
1792
  sunset: "bg-gradient-to-br from-orange-500/20 to-purple-700/20",
1770
1793
  forest: "bg-gradient-to-br from-emerald-600/20 to-teal-700/20",
@@ -1782,7 +1805,7 @@ const D = {
1782
1805
  sage: "bg-gradient-to-br from-lime-600/20 to-green-600/20",
1783
1806
  copper: "bg-gradient-to-br from-amber-600/20 to-amber-800/20",
1784
1807
  dusk: "bg-gradient-to-br from-blue-500/20 to-purple-600/20"
1785
- }, lr = {
1808
+ }, nr = {
1786
1809
  ocean: "Ocean Breeze",
1787
1810
  sunset: "Sunset Glow",
1788
1811
  forest: "Forest Dawn",
@@ -1800,30 +1823,30 @@ const D = {
1800
1823
  sage: "Sage",
1801
1824
  copper: "Copper",
1802
1825
  dusk: "Dusk"
1803
- }, cr = Object.keys(D);
1804
- function St(t) {
1805
- const e = Object.keys(D);
1826
+ }, rr = Object.keys(C);
1827
+ function ye(e) {
1828
+ const t = Object.keys(C);
1806
1829
  let r = 0;
1807
- for (const n of t)
1830
+ for (const n of e)
1808
1831
  r = (r << 5) - r + n.charCodeAt(0), r = r & r;
1809
- const i = Math.abs(r) % e.length;
1810
- return e[i];
1832
+ const i = Math.abs(r) % t.length;
1833
+ return t[i];
1811
1834
  }
1812
- function ur(t, e) {
1813
- if (!t) {
1814
- const i = St(e);
1815
- return D[i];
1835
+ function ir(e, t) {
1836
+ if (!e) {
1837
+ const i = ye(t);
1838
+ return C[i];
1816
1839
  }
1817
- if (typeof t == "string" && t in D)
1818
- return D[t];
1819
- if (typeof t == "string")
1820
- return t;
1821
- const r = St(e);
1822
- return D[r];
1840
+ if (typeof e == "string" && e in C)
1841
+ return C[e];
1842
+ if (typeof e == "string")
1843
+ return e;
1844
+ const r = ye(t);
1845
+ return C[r];
1823
1846
  }
1824
- const tt = {
1847
+ const X = {
1825
1848
  ocean: {
1826
- gradient: D.ocean,
1849
+ gradient: C.ocean,
1827
1850
  bg: "bg-cyan-600/20",
1828
1851
  icon: "bg-cyan-500 dark:bg-cyan-400",
1829
1852
  glow: "shadow-cyan-500/50 dark:shadow-cyan-400/50",
@@ -1833,7 +1856,7 @@ const tt = {
1833
1856
  }
1834
1857
  },
1835
1858
  sunset: {
1836
- gradient: D.sunset,
1859
+ gradient: C.sunset,
1837
1860
  bg: "bg-orange-500/20",
1838
1861
  icon: "bg-orange-500 dark:bg-orange-400",
1839
1862
  glow: "shadow-orange-500/50 dark:shadow-orange-400/50",
@@ -1843,7 +1866,7 @@ const tt = {
1843
1866
  }
1844
1867
  },
1845
1868
  forest: {
1846
- gradient: D.forest,
1869
+ gradient: C.forest,
1847
1870
  bg: "bg-emerald-600/20",
1848
1871
  icon: "bg-emerald-500 dark:bg-emerald-400",
1849
1872
  glow: "shadow-emerald-500/50 dark:shadow-emerald-400/50",
@@ -1853,7 +1876,7 @@ const tt = {
1853
1876
  }
1854
1877
  },
1855
1878
  lavender: {
1856
- gradient: D.lavender,
1879
+ gradient: C.lavender,
1857
1880
  bg: "bg-purple-500/20",
1858
1881
  icon: "bg-purple-500 dark:bg-purple-400",
1859
1882
  glow: "shadow-purple-500/50 dark:shadow-purple-400/50",
@@ -1863,7 +1886,7 @@ const tt = {
1863
1886
  }
1864
1887
  },
1865
1888
  golden: {
1866
- gradient: D.golden,
1889
+ gradient: C.golden,
1867
1890
  bg: "bg-yellow-500/20",
1868
1891
  icon: "bg-yellow-500 dark:bg-yellow-400",
1869
1892
  glow: "shadow-yellow-500/50 dark:shadow-yellow-400/50",
@@ -1873,7 +1896,7 @@ const tt = {
1873
1896
  }
1874
1897
  },
1875
1898
  midnight: {
1876
- gradient: D.midnight,
1899
+ gradient: C.midnight,
1877
1900
  bg: "bg-blue-700/20",
1878
1901
  icon: "bg-blue-700 dark:bg-blue-600",
1879
1902
  glow: "shadow-blue-700/50 dark:shadow-blue-600/50",
@@ -1883,7 +1906,7 @@ const tt = {
1883
1906
  }
1884
1907
  },
1885
1908
  rose: {
1886
- gradient: D.rose,
1909
+ gradient: C.rose,
1887
1910
  bg: "bg-pink-400/20",
1888
1911
  icon: "bg-pink-500 dark:bg-pink-400",
1889
1912
  glow: "shadow-pink-500/50 dark:shadow-pink-400/50",
@@ -1893,7 +1916,7 @@ const tt = {
1893
1916
  }
1894
1917
  },
1895
1918
  mint: {
1896
- gradient: D.mint,
1919
+ gradient: C.mint,
1897
1920
  bg: "bg-green-400/20",
1898
1921
  icon: "bg-green-500 dark:bg-green-400",
1899
1922
  glow: "shadow-green-500/50 dark:shadow-green-400/50",
@@ -1903,7 +1926,7 @@ const tt = {
1903
1926
  }
1904
1927
  },
1905
1928
  slate: {
1906
- gradient: D.slate,
1929
+ gradient: C.slate,
1907
1930
  bg: "bg-slate-600/20",
1908
1931
  icon: "bg-slate-600 dark:bg-slate-500",
1909
1932
  glow: "shadow-slate-600/50 dark:shadow-slate-500/50",
@@ -1913,7 +1936,7 @@ const tt = {
1913
1936
  }
1914
1937
  },
1915
1938
  coral: {
1916
- gradient: D.coral,
1939
+ gradient: C.coral,
1917
1940
  bg: "bg-pink-300/20",
1918
1941
  icon: "bg-pink-400 dark:bg-pink-300",
1919
1942
  glow: "shadow-pink-400/50 dark:shadow-pink-300/50",
@@ -1923,7 +1946,7 @@ const tt = {
1923
1946
  }
1924
1947
  },
1925
1948
  aurora: {
1926
- gradient: D.aurora,
1949
+ gradient: C.aurora,
1927
1950
  bg: "bg-blue-500/20",
1928
1951
  icon: "bg-blue-500 dark:bg-blue-400",
1929
1952
  glow: "shadow-blue-500/50 dark:shadow-blue-400/50",
@@ -1933,7 +1956,7 @@ const tt = {
1933
1956
  }
1934
1957
  },
1935
1958
  ember: {
1936
- gradient: D.ember,
1959
+ gradient: C.ember,
1937
1960
  bg: "bg-red-500/20",
1938
1961
  icon: "bg-red-500 dark:bg-red-400",
1939
1962
  glow: "shadow-red-500/50 dark:shadow-red-400/50",
@@ -1943,7 +1966,7 @@ const tt = {
1943
1966
  }
1944
1967
  },
1945
1968
  steel: {
1946
- gradient: D.steel,
1969
+ gradient: C.steel,
1947
1970
  bg: "bg-gray-500/20",
1948
1971
  icon: "bg-gray-500 dark:bg-gray-400",
1949
1972
  glow: void 0,
@@ -1953,7 +1976,7 @@ const tt = {
1953
1976
  }
1954
1977
  },
1955
1978
  twilight: {
1956
- gradient: D.twilight,
1979
+ gradient: C.twilight,
1957
1980
  bg: "bg-violet-600/20",
1958
1981
  icon: "bg-violet-500 dark:bg-violet-400",
1959
1982
  glow: "shadow-violet-500/50 dark:shadow-violet-400/50",
@@ -1963,7 +1986,7 @@ const tt = {
1963
1986
  }
1964
1987
  },
1965
1988
  sage: {
1966
- gradient: D.sage,
1989
+ gradient: C.sage,
1967
1990
  bg: "bg-lime-600/20",
1968
1991
  icon: "bg-lime-500 dark:bg-lime-400",
1969
1992
  glow: "shadow-lime-500/50 dark:shadow-lime-400/50",
@@ -1973,7 +1996,7 @@ const tt = {
1973
1996
  }
1974
1997
  },
1975
1998
  copper: {
1976
- gradient: D.copper,
1999
+ gradient: C.copper,
1977
2000
  bg: "bg-amber-600/20",
1978
2001
  icon: "bg-amber-600 dark:bg-amber-500",
1979
2002
  glow: "shadow-amber-600/50 dark:shadow-amber-500/50",
@@ -1983,7 +2006,7 @@ const tt = {
1983
2006
  }
1984
2007
  },
1985
2008
  dusk: {
1986
- gradient: D.dusk,
2009
+ gradient: C.dusk,
1987
2010
  bg: "bg-blue-500/20",
1988
2011
  icon: "bg-blue-500 dark:bg-blue-400",
1989
2012
  glow: "shadow-blue-500/50 dark:shadow-blue-400/50",
@@ -1992,116 +2015,124 @@ const tt = {
1992
2015
  muted: "text-blue-400/60 dark:text-blue-300/60"
1993
2016
  }
1994
2017
  }
1995
- }, dr = {
1996
- unavailable: tt.steel,
1997
- active: tt.ocean,
1998
- inactive: tt.steel,
1999
- success: tt.forest,
2000
- warning: tt.ember,
2001
- error: tt.rose
2002
- }, gr = {
2018
+ }, ar = {
2019
+ unavailable: X.steel,
2020
+ active: X.ocean,
2021
+ inactive: X.steel,
2022
+ success: X.forest,
2023
+ warning: X.ember,
2024
+ error: X.rose
2025
+ }, or = j.enum([
2026
+ "success",
2027
+ "warning",
2028
+ "danger",
2029
+ "info",
2030
+ "neutral",
2031
+ "accent"
2032
+ ]), sr = {
2003
2033
  /** Optional display name override (renders as text input) */
2004
- title: () => X.string().optional().meta({ title: "Title", description: "Optional display name override" }),
2034
+ title: () => j.string().optional().meta({ title: "Title", description: "Optional display name override" }),
2005
2035
  /** Multi-select entity picker for a HA domain */
2006
- entityIds: (t) => X.array(X.string()).default([]).meta({ domain: t, title: "Entities" }),
2036
+ entityIds: (e) => j.array(j.string()).default([]).meta({ domain: e, title: "Entities" }),
2007
2037
  /** Single-select entity picker for a HA domain */
2008
- singleEntity: (t) => X.array(X.string()).default([]).meta({ domain: t, title: "Entity", singleSelect: !0 }),
2038
+ singleEntity: (e) => j.array(j.string()).default([]).meta({ domain: e, title: "Entity", singleSelect: !0 }),
2009
2039
  /** Area picker dropdown */
2010
- areaId: () => X.string().optional().meta({ formType: "area-picker", title: "Area" })
2040
+ areaId: () => j.string().optional().meta({ formType: "area-picker", title: "Area" })
2011
2041
  };
2012
- let ft = null;
2013
- function kn() {
2014
- return ft || (ft = getComputedStyle(document.documentElement)), ft;
2042
+ let de = null;
2043
+ function xn() {
2044
+ return de || (de = getComputedStyle(document.documentElement)), de;
2015
2045
  }
2016
- function mr(t) {
2017
- const e = t.startsWith("--") ? t : `--${t}`;
2018
- return kn().getPropertyValue(e).trim();
2046
+ function lr(e) {
2047
+ const t = e.startsWith("--") ? e : `--${e}`;
2048
+ return xn().getPropertyValue(t).trim();
2019
2049
  }
2020
- function fr() {
2050
+ function cr() {
2021
2051
  return document.documentElement.classList.contains("dark");
2022
2052
  }
2023
- const Sn = "0.3.7", Cn = {
2024
- version: Sn
2025
- }, hr = Cn.version;
2053
+ const bn = "0.4.0", vn = {
2054
+ version: bn
2055
+ }, dr = vn.version;
2026
2056
  export {
2027
- lr as GRADIENT_NAMES,
2028
- D as GRADIENT_PRESETS,
2029
- cr as GRADIENT_PRESET_KEYS,
2030
- Jn as Glow,
2031
- vr as GridSizeSchema,
2032
- yr as PublishBodySchema,
2033
- wr as PublishConfirmSchema,
2034
- $r as PublishRequestSchema,
2035
- hr as SDK_VERSION,
2036
- U as WIDGET_Z,
2037
- Y as Widget,
2038
- oe as WidgetContent,
2039
- ht as WidgetCtx,
2040
- Qn as WidgetDialog,
2041
- ge as WidgetEmptyState,
2042
- ye as WidgetIcon,
2043
- pr as WidgetManifestSchema,
2044
- _t as WidgetMetrics,
2045
- ne as WidgetSliderFill,
2046
- Zn as WidgetStack,
2047
- ze as WidgetStatus,
2048
- _e as WidgetSubtitle,
2049
- Oe as WidgetTitle,
2050
- Pe as WidgetValue,
2051
- qn as allEntitiesInState,
2052
- Xn as anyEntityInState,
2053
- Pn as applyCssVars,
2054
- Gn as applyLayout,
2055
- bt as builtInVariants,
2056
- Te as calculateLightGroup,
2057
- Ve as calculateSensorGroup,
2058
- Ft as classicGlass,
2059
- k as cn,
2060
- Yt as compactHorizontal,
2061
- Hn as composeVariants,
2062
- Kn as countActiveEntities,
2063
- Yn as countAvailableEntities,
2064
- Un as countEntitiesByState,
2065
- Bn as createEmptyStateConfig,
2066
- Tn as createEntity,
2067
- Ln as createFlexLayout,
2068
- Vn as defineWidget,
2069
- xe as deriveAdaptiveIconColors,
2070
- In as extendVariant,
2071
- jt as extractDefaults,
2072
- kr as formatSchemaError,
2073
- Re as formatValue,
2074
- Kt as getBuiltInVariant,
2075
- Rn as getBuiltInVariantIds,
2076
- Fn as getEntityAttribute,
2077
- jn as getEntityState,
2078
- ur as getGradient,
2079
- St as getGradientFromString,
2080
- ie as getSpacingClass,
2081
- mr as getThemeToken,
2082
- tt as gradientColorPresets,
2083
- Ie as interpretValue,
2084
- Wn as isBuiltInVariant,
2085
- fr as isDark,
2086
- We as isEntityActive,
2087
- Ae as isEntityAvailable,
2088
- xt as mergeVariants,
2089
- Ut as minimal,
2090
- Sr as parseGridSize,
2091
- Cr as serializeGridSize,
2057
+ nr as GRADIENT_NAMES,
2058
+ C as GRADIENT_PRESETS,
2059
+ rr as GRADIENT_PRESET_KEYS,
2060
+ Fn as Glow,
2061
+ mr as GridSizeSchema,
2062
+ fr as PublishBodySchema,
2063
+ hr as PublishConfirmSchema,
2064
+ xr as PublishRequestSchema,
2065
+ dr as SDK_VERSION,
2066
+ or as ToneSchema,
2067
+ K as WIDGET_Z,
2068
+ B as Widget,
2069
+ ot as WidgetContent,
2070
+ ue as WidgetCtx,
2071
+ Yn as WidgetDialog,
2072
+ gt as WidgetEmptyState,
2073
+ ft as WidgetIcon,
2074
+ br as WidgetManifestSchema,
2075
+ Se as WidgetMetrics,
2076
+ nt as WidgetSliderFill,
2077
+ Un as WidgetStack,
2078
+ kt as WidgetStatus,
2079
+ St as WidgetSubtitle,
2080
+ zt as WidgetTitle,
2081
+ At as WidgetValue,
2082
+ jn as allEntitiesInState,
2083
+ Bn as anyEntityInState,
2084
+ Wn as applyCssVars,
2085
+ Nn as applyLayout,
2086
+ ge as builtInVariants,
2087
+ Mt as calculateLightGroup,
2088
+ _t as calculateSensorGroup,
2089
+ Ue as classicGlass,
2090
+ $ as cn,
2091
+ Ke as compactHorizontal,
2092
+ Vn as composeVariants,
2093
+ Gn as countActiveEntities,
2094
+ Hn as countAvailableEntities,
2095
+ Rn as countEntitiesByState,
2096
+ In as createEmptyStateConfig,
2097
+ zn as createEntity,
2098
+ An as createFlexLayout,
2099
+ Mn as defineWidget,
2100
+ On as extendVariant,
2101
+ je as extractDefaults,
2102
+ vr as formatSchemaError,
2103
+ Ot as formatValue,
2104
+ qe as getBuiltInVariant,
2105
+ Tn as getBuiltInVariantIds,
2106
+ Ln as getEntityAttribute,
2107
+ Pn as getEntityState,
2108
+ ir as getGradient,
2109
+ ye as getGradientFromString,
2110
+ it as getSpacingClass,
2111
+ lr as getThemeToken,
2112
+ X as gradientColorPresets,
2113
+ Fe as injectTokens,
2114
+ Vt as interpretValue,
2115
+ En as isBuiltInVariant,
2116
+ cr as isDark,
2117
+ Tt as isEntityActive,
2118
+ Et as isEntityAvailable,
2119
+ me as mergeVariants,
2120
+ Ye as minimal,
2121
+ wr as parseGridSize,
2122
+ yr as serializeGridSize,
2092
2123
  W as spacing,
2093
- dr as stateColors,
2094
- Mt as toFormSchema,
2095
- F as typography,
2096
- er as useDebugData,
2097
- nr as useWidgetConfig,
2098
- I as useWidgetContext,
2099
- rr as useWidgetDialog,
2100
- ir as useWidgetEntity,
2101
- ar as useWidgetEntityGroup,
2102
- or as useWidgetForm,
2124
+ ar as stateColors,
2125
+ ke as toFormSchema,
2126
+ G as typography,
2127
+ Kn as useDebugData,
2128
+ qn as useWidgetConfig,
2129
+ P as useWidgetContext,
2130
+ Xn as useWidgetDialog,
2131
+ Jn as useWidgetEntity,
2132
+ Zn as useWidgetEntityGroup,
2133
+ Qn as useWidgetForm,
2103
2134
  tr as useWidgetGestures,
2104
- sr as useWidgetResponsive,
2105
- An as warnIfStub,
2106
- gr as widgetFields
2135
+ er as useWidgetResponsive,
2136
+ _n as warnIfStub,
2137
+ sr as widgetFields
2107
2138
  };