@glasshome/widget-sdk 0.2.5 → 0.3.3

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