@glasshome/widget-sdk 0.5.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,11 +1,14 @@
1
1
  import { z as A } from "zod";
2
- import { WidgetManifestSchema as an, formatSchemaError as sn } from "./schemas.js";
3
- import { effect as W, className as R, style as oe, template as x, insert as b, createComponent as k, memo as T, setStyleProperty as X, addEventListener as G, use as xe, delegateEvents as ye } from "solid-js/web";
4
- import { createElementSize as $e } from "@solid-primitives/resize-observer";
5
- import { createContext as ke, useContext as ae, Show as E, onMount as Ce, createSignal as V, createMemo as L, splitProps as Se, createEffect as re, on as de, onCleanup as se } from "solid-js";
6
- import { clsx as Me } from "clsx";
7
- import { twMerge as De } from "tailwind-merge";
8
- function ge(e) {
2
+ import { widgetManifestSchema as xn, formatSchemaError as yn } from "@glasshome/widget-contract";
3
+ import { effect as W, className as I, style as le, template as x, insert as p, createComponent as k, memo as T, setStyleProperty as ee, addEventListener as K, use as Se, delegateEvents as Ce } from "solid-js/web";
4
+ import { createElementSize as Me } from "@solid-primitives/resize-observer";
5
+ import { createContext as De, useContext as B, Show as E, createSignal as V, onMount as Te, createMemo as j, splitProps as _e, createEffect as se, on as ge, onCleanup as ce } from "solid-js";
6
+ import { clsx as Oe } from "clsx";
7
+ import { twMerge as ze } from "tailwind-merge";
8
+ import { useService as Ee, useToggle as Ne, useTurnOff as Ae, useTurnOn as Ve } from "@glasshome/sync-layer/solid";
9
+ import { byDomain as kn, useArea as Sn, useCamera as Cn, useConnection as Mn, useCurrency as Dn, useEntities as Tn, useEntity as _n, useEntityHistory as On, useEntityStatistics as zn, useForecast as En, useHassConfig as Nn, useLocale as An, useStore as Vn, useTemperatureUnit as Wn, useUnitSystem as Rn } from "@glasshome/sync-layer/solid";
10
+ import { getForecasts as Pn, getStream as In, getWebRtcClientConfig as Ln, sendWebRtcCandidate as Un, startWebRtcSession as jn, state as Bn, trackEntityHistory as Fn, untrackEntityHistory as Gn } from "@glasshome/sync-layer";
11
+ function me(e) {
9
12
  return A.toJSONSchema(e, {
10
13
  override: (t) => {
11
14
  const i = A.globalRegistry.get(t.zodSchema);
@@ -13,17 +16,53 @@ function ge(e) {
13
16
  }
14
17
  });
15
18
  }
16
- function Te(e) {
19
+ function We(e) {
17
20
  try {
18
21
  return e.parse({});
19
22
  } catch {
20
23
  return {};
21
24
  }
22
25
  }
23
- function jt(e) {
24
- return e.configSchema && (e.manifest.schema || (e.manifest.schema = ge(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = Te(e.configSchema))), e;
26
+ function Jt(e) {
27
+ return e.configSchema && (e.manifest.schema || (e.manifest.schema = me(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = We(e.configSchema))), e;
25
28
  }
26
- const Y = {
29
+ const P = De();
30
+ function Qt() {
31
+ const e = B(P);
32
+ if (!e)
33
+ throw new Error("useWidgetContext must be used within a Widget component");
34
+ return e;
35
+ }
36
+ function Re(e) {
37
+ const t = Array.isArray(e) ? e[0] : e, i = t?.split(".")[0];
38
+ if (!i) throw new Error(`Invalid entity ID: ${String(t)}`);
39
+ return i;
40
+ }
41
+ function G(e, t) {
42
+ return (i, r = {}) => e(Re(i), t, r, { entity_id: i });
43
+ }
44
+ function Zt() {
45
+ const e = B(P)?.callService;
46
+ return e ? {
47
+ callService: e,
48
+ turnOn: G(e, "turn_on"),
49
+ turnOff: G(e, "turn_off"),
50
+ toggle: G(e, "toggle")
51
+ } : Ee();
52
+ }
53
+ function en() {
54
+ const e = B(P)?.callService;
55
+ return e ? G(e, "turn_on") : Ve();
56
+ }
57
+ function tn() {
58
+ const e = B(P)?.callService;
59
+ return e ? G(e, "turn_off") : Ae();
60
+ }
61
+ function nn() {
62
+ const e = B(P)?.callService;
63
+ return e ? G(e, "toggle") : Ne();
64
+ }
65
+ const J = {
27
66
  /** Background layer (gradients, images, glows) */
28
67
  BACKGROUND: 0,
29
68
  /** Main content layer (icon, title, text) */
@@ -32,14 +71,7 @@ const Y = {
32
71
  OVERLAY: 20,
33
72
  /** Action layer (buttons, edit controls) */
34
73
  ACTIONS: 30
35
- }, J = ke();
36
- function Lt() {
37
- const e = ae(J);
38
- if (!e)
39
- throw new Error("useWidgetContext must be used within a Widget component");
40
- return e;
41
- }
42
- const _e = `/* Authoritative SDK CSS contract. Injected once on first Widget mount
74
+ }, ve = `/* Authoritative SDK CSS contract. Injected once on first Widget mount
43
75
  * via framework/theming/tokens.ts.
44
76
  *
45
77
  * All widget-internal visual scale is driven from CSS custom properties +
@@ -211,22 +243,34 @@ const _e = `/* Authoritative SDK CSS contract. Injected once on first Widget mou
211
243
  }
212
244
  }
213
245
  `;
214
- let te = !1;
215
- function ze(e) {
216
- if (te) return;
246
+ let re = !1, Q;
247
+ const he = /* @__PURE__ */ new WeakSet();
248
+ function He() {
249
+ return Q || (Q = new CSSStyleSheet(), Q.replaceSync(
250
+ ve.replace(/:root\b/g, ":host").replace(/^\.dark\b/gm, ":host(.dark)")
251
+ )), Q;
252
+ }
253
+ function Pe(e) {
254
+ if (typeof ShadowRoot < "u" && e instanceof ShadowRoot) {
255
+ if (he.has(e)) return;
256
+ const r = He();
257
+ e.adoptedStyleSheets.includes(r) || (e.adoptedStyleSheets = [...e.adoptedStyleSheets, r]), he.add(e);
258
+ return;
259
+ }
260
+ if (re) return;
217
261
  const t = e ?? (typeof document > "u" ? void 0 : document);
218
262
  if (!t) return;
219
263
  if (t.head.querySelector?.("style[data-glasshome-tokens]")) {
220
- te = !0;
264
+ re = !0;
221
265
  return;
222
266
  }
223
267
  const i = t.createElement("style");
224
- i.setAttribute("data-glasshome-tokens", ""), i.textContent = _e, t.head.appendChild(i), te = !0;
268
+ i.setAttribute("data-glasshome-tokens", ""), i.textContent = ve, t.head.appendChild(i), re = !0;
225
269
  }
226
- function P(...e) {
227
- return De(Me(e));
270
+ function R(...e) {
271
+ return ze(Oe(e));
228
272
  }
229
- const Oe = {
273
+ const Ie = {
230
274
  id: "classic-glass",
231
275
  name: "Classic Glass",
232
276
  description: "Default glassmorphism design with blur background and gradient",
@@ -254,7 +298,7 @@ const Oe = {
254
298
  hoverScale: 1.02,
255
299
  activeScale: 0.98
256
300
  }
257
- }, Ee = {
301
+ }, Le = {
258
302
  id: "minimal",
259
303
  name: "Minimal",
260
304
  description: "Clean, minimal design with no background effects",
@@ -283,7 +327,7 @@ const Oe = {
283
327
  active: !1,
284
328
  focus: !0
285
329
  }
286
- }, Ne = {
330
+ }, Ue = {
287
331
  id: "compact-horizontal",
288
332
  name: "Compact Horizontal",
289
333
  description: "Horizontal layout for compact widgets",
@@ -311,108 +355,108 @@ const Oe = {
311
355
  hoverScale: 1.02,
312
356
  activeScale: 0.98
313
357
  }
314
- }, Ae = {
315
- "classic-glass": Oe,
316
- minimal: Ee,
317
- "compact-horizontal": Ne
358
+ }, je = {
359
+ "classic-glass": Ie,
360
+ minimal: Le,
361
+ "compact-horizontal": Ue
318
362
  };
319
- function Ve(e) {
320
- return Ae[e];
363
+ function Be(e) {
364
+ return je[e];
321
365
  }
322
- var We = /* @__PURE__ */ x("<div>");
323
- function Pe(e) {
366
+ var Fe = /* @__PURE__ */ x("<div>");
367
+ function Ge(e) {
324
368
  return (() => {
325
- var t = We();
369
+ var t = Fe();
326
370
  return W((i) => {
327
- var r = P("glasshome-widget-slider-fill pointer-events-none absolute inset-0", e.isDragging ? "duration-0" : "transition-all duration-300 ease-out", e.class), n = {
371
+ var r = R("glasshome-widget-slider-fill pointer-events-none absolute inset-0", e.isDragging ? "duration-0" : "transition-all duration-300 ease-out", e.class), n = {
328
372
  "--widget-fill-value": e.value,
329
- "z-index": Y.BACKGROUND,
373
+ "z-index": J.BACKGROUND,
330
374
  ...e.color ? {
331
375
  "--widget-icon-color": e.color
332
376
  } : {}
333
377
  };
334
- return r !== i.e && R(t, i.e = r), i.t = oe(t, n, i.t), i;
378
+ return r !== i.e && I(t, i.e = r), i.t = le(t, n, i.t), i;
335
379
  }, {
336
380
  e: void 0,
337
381
  t: void 0
338
382
  }), t;
339
383
  })();
340
384
  }
341
- var He = /* @__PURE__ */ x("<div>");
342
- function Re(e) {
385
+ var qe = /* @__PURE__ */ x("<div>");
386
+ function Ye(e) {
343
387
  return (() => {
344
- var t = He();
345
- return b(t, () => e.children), W(() => R(t, P("glasshome-widget-content", e.class))), t;
388
+ var t = qe();
389
+ return p(t, () => e.children), W(() => I(t, R("glasshome-widget-content", e.class))), t;
346
390
  })();
347
391
  }
348
- var Ie = /* @__PURE__ */ x('<div class="glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-2">'), je = /* @__PURE__ */ x('<div class="glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-3">'), Le = /* @__PURE__ */ x('<div><div class="glasshome-widget-icon-glyph flex items-center justify-center">');
349
- function Be(e) {
392
+ var Ke = /* @__PURE__ */ x('<div class="glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-2">'), Xe = /* @__PURE__ */ x('<div class="glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-3">'), Je = /* @__PURE__ */ x('<div><div class="glasshome-widget-icon-glyph flex items-center justify-center">');
393
+ function Qe(e) {
350
394
  const t = () => e.entityCount ?? 1;
351
395
  return (() => {
352
- var i = Le(), r = i.firstChild;
353
- return b(i, k(E, {
396
+ var i = Je(), r = i.firstChild;
397
+ return p(i, k(E, {
354
398
  get when() {
355
399
  return t() >= 2;
356
400
  },
357
401
  get children() {
358
- return Ie();
402
+ return Ke();
359
403
  }
360
- }), r), b(i, k(E, {
404
+ }), r), p(i, k(E, {
361
405
  get when() {
362
406
  return t() >= 3;
363
407
  },
364
408
  get children() {
365
- return je();
409
+ return Xe();
366
410
  }
367
- }), r), b(r, () => e.icon), W((n) => {
368
- var o = P("glasshome-widget-icon", "relative flex shrink-0 items-center justify-center pointer-events-none transition-all", e.dimmed && "opacity-50", e.class), u = e.color ? {
411
+ }), r), p(r, () => e.icon), W((n) => {
412
+ var o = R("glasshome-widget-icon", "relative flex shrink-0 items-center justify-center pointer-events-none transition-all", e.dimmed && "opacity-50", e.class), u = e.color ? {
369
413
  "--widget-icon-color": e.color
370
414
  } : void 0;
371
- return o !== n.e && R(i, n.e = o), n.t = oe(i, u, n.t), n;
415
+ return o !== n.e && I(i, n.e = o), n.t = le(i, u, n.t), n;
372
416
  }, {
373
417
  e: void 0,
374
418
  t: void 0
375
419
  }), i;
376
420
  })();
377
421
  }
378
- var Ue = /* @__PURE__ */ x("<p>");
379
- function Fe(e) {
422
+ var Ze = /* @__PURE__ */ x("<p>");
423
+ function et(e) {
380
424
  return (() => {
381
- var t = Ue();
382
- return b(t, (() => {
425
+ var t = Ze();
426
+ return p(t, (() => {
383
427
  var i = T(() => !!e.isUnavailable);
384
428
  return () => i() ? "Unavailable" : e.children;
385
429
  })()), W((i) => {
386
- var r = P("glasshome-widget-status", "relative", e.dimmed && "opacity-40", e.class), n = Y.ACTIONS;
387
- return r !== i.e && R(t, i.e = r), n !== i.t && X(t, "z-index", i.t = n), i;
430
+ var r = R("glasshome-widget-status", "relative", e.dimmed && "opacity-40", e.class), n = J.ACTIONS;
431
+ return r !== i.e && I(t, i.e = r), n !== i.t && ee(t, "z-index", i.t = n), i;
388
432
  }, {
389
433
  e: void 0,
390
434
  t: void 0
391
435
  }), t;
392
436
  })();
393
437
  }
394
- var Ge = /* @__PURE__ */ x('<span class="glasshome-widget-badge shrink-0">'), qe = /* @__PURE__ */ x("<div><h3 class=glasshome-widget-title>");
395
- function Ye(e) {
438
+ var tt = /* @__PURE__ */ x('<span class="glasshome-widget-badge shrink-0">'), nt = /* @__PURE__ */ x("<div><h3 class=glasshome-widget-title>");
439
+ function it(e) {
396
440
  return (() => {
397
- var t = qe(), i = t.firstChild;
398
- return b(i, () => e.children), b(t, k(E, {
441
+ var t = nt(), i = t.firstChild;
442
+ return p(i, () => e.children), p(t, k(E, {
399
443
  get when() {
400
444
  return T(() => e.badge !== void 0)() && e.badge > 0;
401
445
  },
402
446
  get children() {
403
- var r = Ge();
404
- return b(r, () => e.badge), r;
447
+ var r = tt();
448
+ return p(r, () => e.badge), r;
405
449
  }
406
450
  }), null), W((r) => {
407
- var n = P("relative flex items-center gap-2", e.class), o = Y.ACTIONS;
408
- return n !== r.e && R(t, r.e = n), o !== r.t && X(t, "z-index", r.t = o), r;
451
+ var n = R("relative flex items-center gap-2", e.class), o = J.ACTIONS;
452
+ return n !== r.e && I(t, r.e = n), o !== r.t && ee(t, "z-index", r.t = o), r;
409
453
  }, {
410
454
  e: void 0,
411
455
  t: void 0
412
456
  }), t;
413
457
  })();
414
458
  }
415
- function Ke(e, t = !1) {
459
+ function rt(e, t = !1) {
416
460
  if (e.length === 0)
417
461
  return {
418
462
  isGroup: !1,
@@ -428,15 +472,15 @@ function Ke(e, t = !1) {
428
472
  };
429
473
  const i = e.length > 1;
430
474
  if (!i) {
431
- const a = e[0], f = a.state === "on", p = a.attributes?.brightness || 0, C = Math.round(p / 255 * 100);
475
+ const s = e[0], f = s.state === "on", b = s.attributes?.brightness || 0, S = Math.round(b / 255 * 100);
432
476
  return {
433
477
  isGroup: !1,
434
- state: a.state,
478
+ state: s.state,
435
479
  isOn: f,
436
- isUnavailable: a.state === "unavailable",
437
- brightness: p,
438
- brightnessPercent: C,
439
- color: ue(a),
480
+ isUnavailable: s.state === "unavailable",
481
+ brightness: b,
482
+ brightnessPercent: S,
483
+ color: fe(s),
440
484
  onCount: f ? 1 : 0,
441
485
  totalCount: 1,
442
486
  description: f ? "On" : "Off"
@@ -444,10 +488,10 @@ function Ke(e, t = !1) {
444
488
  }
445
489
  let r = 0, n = 0, o = 0, u = 0, d = 0, $ = 0;
446
490
  const m = [];
447
- for (const a of e)
448
- switch (a.state) {
491
+ for (const s of e)
492
+ switch (s.state) {
449
493
  case "on":
450
- r++, a.attributes?.brightness !== void 0 && (d += a.attributes.brightness, $++), a.attributes?.rgb_color && m.push(a.attributes.rgb_color);
494
+ r++, s.attributes?.brightness !== void 0 && (d += s.attributes.brightness, $++), s.attributes?.rgb_color && m.push(s.attributes.rgb_color);
451
495
  break;
452
496
  case "off":
453
497
  n++;
@@ -459,31 +503,31 @@ function Ke(e, t = !1) {
459
503
  u++;
460
504
  break;
461
505
  }
462
- const h = e.length, v = u === h, y = o + u === h, g = r > 0, s = r === h, S = n === h;
506
+ const h = e.length, v = u === h, y = o + u === h, g = r > 0, a = r === h, C = n === h;
463
507
  let w, M;
464
508
  t ? v ? (w = "unavailable", M = !1) : o > 0 || u > 0 ? (w = "unknown", M = !1) : n > 0 ? (w = "off", M = !1) : (w = "on", M = !0) : v ? (w = "unavailable", M = !1) : y ? (w = "unknown", M = !1) : g ? (w = "on", M = !0) : (w = "off", M = !1);
465
- const z = $ > 0 ? Math.round(d / $) : 0, I = Math.round(z / 255 * 100);
466
- let B;
509
+ const O = $ > 0 ? Math.round(d / $) : 0, L = Math.round(O / 255 * 100);
510
+ let F;
467
511
  if (m.length > 0) {
468
- const a = Math.round(m.reduce((O, D) => O + D[0], 0) / m.length), f = Math.round(m.reduce((O, D) => O + D[1], 0) / m.length), p = Math.round(m.reduce((O, D) => O + D[2], 0) / m.length), C = z / 255;
469
- B = `rgb(${Math.round(a * C)}, ${Math.round(f * C)}, ${Math.round(p * C)})`;
512
+ const s = Math.round(m.reduce((z, D) => z + D[0], 0) / m.length), f = Math.round(m.reduce((z, D) => z + D[1], 0) / m.length), b = Math.round(m.reduce((z, D) => z + D[2], 0) / m.length), S = O / 255;
513
+ F = `rgb(${Math.round(s * S)}, ${Math.round(f * S)}, ${Math.round(b * S)})`;
470
514
  } else
471
- B = ue(e[0]);
515
+ F = fe(e[0]);
472
516
  let H;
473
- return s ? H = "All on" : S ? H = "All off" : r > 0 ? H = `${r} of ${h} on` : H = "Off", {
517
+ return a ? H = "All on" : C ? H = "All off" : r > 0 ? H = `${r} of ${h} on` : H = "Off", {
474
518
  isGroup: i,
475
519
  state: w,
476
520
  isOn: M,
477
521
  isUnavailable: w === "unavailable",
478
- brightness: z,
479
- brightnessPercent: I,
480
- color: B,
522
+ brightness: O,
523
+ brightnessPercent: L,
524
+ color: F,
481
525
  onCount: r,
482
526
  totalCount: h,
483
527
  description: H
484
528
  };
485
529
  }
486
- function Xe(e, t = "mean", i = !0) {
530
+ function ot(e, t = "mean", i = !0) {
487
531
  if (e.length === 0)
488
532
  return {
489
533
  isGroup: !1,
@@ -494,15 +538,15 @@ function Xe(e, t = "mean", i = !0) {
494
538
  };
495
539
  const r = e.length > 1;
496
540
  if (!r) {
497
- const g = e[0], s = Number.parseFloat(g.state);
498
- let S = g.state;
499
- return Number.isNaN(s) || (S = Number.isInteger(s) ? s.toString() : s.toFixed(1)), {
541
+ const g = e[0], a = Number.parseFloat(g.state);
542
+ let C = g.state;
543
+ return Number.isNaN(a) || (C = Number.isInteger(a) ? a.toString() : a.toFixed(1)), {
500
544
  isGroup: !1,
501
- state: S,
502
- numericValue: Number.isNaN(s) ? null : s,
545
+ state: C,
546
+ numericValue: Number.isNaN(a) ? null : a,
503
547
  isUnavailable: g.state === "unavailable",
504
548
  unit: g.unitOfMeasurement ?? void 0,
505
- description: S
549
+ description: C
506
550
  };
507
551
  }
508
552
  const n = [], o = [];
@@ -516,14 +560,14 @@ function Xe(e, t = "mean", i = !0) {
516
560
  });
517
561
  continue;
518
562
  }
519
- const s = Number.parseFloat(g.state);
520
- isNaN(s) ? i || o.push({
563
+ const a = Number.parseFloat(g.state);
564
+ isNaN(a) ? i || o.push({
521
565
  entityId: g.id,
522
566
  value: g.state,
523
567
  friendly_name: g.friendlyName
524
- }) : (n.push(s), o.push({
568
+ }) : (n.push(a), o.push({
525
569
  entityId: g.id,
526
- value: s,
570
+ value: a,
527
571
  friendly_name: g.friendlyName
528
572
  }));
529
573
  }
@@ -547,15 +591,15 @@ function Xe(e, t = "mean", i = !0) {
547
591
  h = Math.max(...n), v = "Maximum";
548
592
  break;
549
593
  case "mean":
550
- h = n.reduce((g, s) => g + s, 0) / n.length, v = "Average";
594
+ h = n.reduce((g, a) => g + a, 0) / n.length, v = "Average";
551
595
  break;
552
596
  case "median": {
553
- const g = [...n].sort((S, w) => S - w), s = Math.floor(g.length / 2);
554
- h = g.length % 2 === 0 ? (g[s - 1] + g[s]) / 2 : g[s], v = "Median";
597
+ const g = [...n].sort((C, w) => C - w), a = Math.floor(g.length / 2);
598
+ h = g.length % 2 === 0 ? (g[a - 1] + g[a]) / 2 : g[a], v = "Median";
555
599
  break;
556
600
  }
557
601
  case "sum":
558
- h = n.reduce((g, s) => g + s, 0), v = "Sum";
602
+ h = n.reduce((g, a) => g + a, 0), v = "Sum";
559
603
  break;
560
604
  case "last":
561
605
  h = n[n.length - 1], v = "Latest";
@@ -564,15 +608,15 @@ function Xe(e, t = "mean", i = !0) {
564
608
  h = Math.max(...n) - Math.min(...n), v = "Range";
565
609
  break;
566
610
  case "product":
567
- h = n.reduce((g, s) => g * s, 1), v = "Product";
611
+ h = n.reduce((g, a) => g * a, 1), v = "Product";
568
612
  break;
569
613
  case "std_dev": {
570
- const g = n.reduce((S, w) => S + w, 0) / n.length, s = n.reduce((S, w) => S + (w - g) ** 2, 0) / n.length;
571
- h = Math.sqrt(s), v = "Std Dev";
614
+ const g = n.reduce((C, w) => C + w, 0) / n.length, a = n.reduce((C, w) => C + (w - g) ** 2, 0) / n.length;
615
+ h = Math.sqrt(a), v = "Std Dev";
572
616
  break;
573
617
  }
574
618
  default:
575
- h = n.reduce((g, s) => g + s, 0) / n.length, v = "Average";
619
+ h = n.reduce((g, a) => g + a, 0) / n.length, v = "Average";
576
620
  }
577
621
  const y = Number.isInteger(h) ? h.toString() : h.toFixed(1);
578
622
  return {
@@ -585,7 +629,7 @@ function Xe(e, t = "mean", i = !0) {
585
629
  memberValues: o
586
630
  };
587
631
  }
588
- function ue(e) {
632
+ function fe(e) {
589
633
  if (e.state !== "on") return "rgb(100, 100, 100)";
590
634
  const i = (e.attributes?.brightness ?? 255) / 255;
591
635
  if (e.attributes?.rgb_color) {
@@ -599,7 +643,7 @@ function ue(e) {
599
643
  }
600
644
  return `rgb(${Math.round(255 * i)}, ${Math.round(220 * i)}, ${Math.round(180 * i)})`;
601
645
  }
602
- function Je(e) {
646
+ function at(e) {
603
647
  if (!e) return !1;
604
648
  if (["on", "open", "locked", "home", "playing", "active"].includes(e.state))
605
649
  return !0;
@@ -609,13 +653,13 @@ function Je(e) {
609
653
  }
610
654
  return !1;
611
655
  }
612
- function Bt(e, t, i) {
656
+ function rn(e, t, i) {
613
657
  return e?.attributes ? e.attributes[t] ?? i : i;
614
658
  }
615
- function Ut(e) {
616
- return e.filter(Je).length;
659
+ function on(e) {
660
+ return e.filter(at).length;
617
661
  }
618
- function Qe(e, t, i) {
662
+ function st(e, t, i) {
619
663
  const { decimals: r, scale: n = !0 } = {};
620
664
  if (typeof e == "string")
621
665
  return t ? `${e}${t}` : e;
@@ -626,42 +670,45 @@ function Qe(e, t, i) {
626
670
  let d;
627
671
  return r !== void 0 ? d = o.toFixed(r) : o !== e ? d = o.toFixed(1) : Number.isInteger(e) ? d = e.toString() : d = Number.parseFloat(e.toFixed(2)).toString(), u ? `${d}${u}` : d;
628
672
  }
629
- function Ze(e, t) {
673
+ function lt(e, t) {
630
674
  return e == null || isNaN(e) ? null : t === "°C" ? e < 10 ? "Cold" : e < 18 ? "Cool" : e < 24 ? "Comfortable" : e < 28 ? "Warm" : "Hot" : t === "°F" ? e < 50 ? "Cold" : e < 64 ? "Cool" : e < 75 ? "Comfortable" : e < 82 ? "Warm" : "Hot" : t === "%" ? e < 20 ? "Very Low" : e < 40 ? "Low" : e < 60 ? "Medium" : e < 80 ? "High" : "Very High" : t === "ppm" ? e < 400 ? "Excellent" : e < 600 ? "Good" : e < 1e3 ? "Acceptable" : e < 1500 ? "Mediocre" : "Poor" : t === "lx" ? e < 50 ? "Dark" : e < 200 ? "Dim" : e < 500 ? "Moderate" : e < 1e3 ? "Bright" : "Very Bright" : t === "AQI" ? e <= 50 ? "Good" : e <= 100 ? "Moderate" : e <= 150 ? "Unhealthy for Sensitive" : e <= 200 ? "Unhealthy" : e <= 300 ? "Very Unhealthy" : "Hazardous" : t === "dB" ? e < 30 ? "Very Quiet" : e < 50 ? "Quiet" : e < 70 ? "Moderate" : e < 85 ? "Loud" : "Very Loud" : null;
631
675
  }
632
- var et = /* @__PURE__ */ x("<div class=glasshome-widget-subtitle>"), tt = /* @__PURE__ */ x("<div><div class=glasshome-widget-value>");
633
- function nt(e) {
676
+ var ct = /* @__PURE__ */ x("<div class=glasshome-widget-subtitle>"), dt = /* @__PURE__ */ x("<div><div class=glasshome-widget-value>");
677
+ function ut(e) {
634
678
  return (() => {
635
- var t = tt(), i = t.firstChild;
636
- return b(i, () => Qe(e.value, e.unit)), b(t, k(E, {
679
+ var t = dt(), i = t.firstChild;
680
+ return p(i, () => st(e.value, e.unit)), p(t, k(E, {
637
681
  get when() {
638
682
  return T(() => !!e.interpret)() && typeof e.value == "number";
639
683
  },
640
684
  get children() {
641
- var r = et();
642
- return b(r, () => Ze(e.value, e.unit)), r;
685
+ var r = ct();
686
+ return p(r, () => lt(e.value, e.unit)), r;
643
687
  }
644
- }), null), W(() => R(t, P("flex flex-col", e.class))), t;
688
+ }), null), W(() => I(t, R("flex flex-col", e.class))), t;
645
689
  })();
646
690
  }
647
- var it = /* @__PURE__ */ x('<div><div class="relative h-full w-full">'), rt = /* @__PURE__ */ x('<div class="glasshome-widget-loading pointer-events-none absolute inset-0 animate-pulse">'), ot = /* @__PURE__ */ x('<div class="flex h-full w-full flex-col items-center justify-center gap-2 text-center">'), at = /* @__PURE__ */ x('<div class="flex items-center justify-center text-white/30">'), st = /* @__PURE__ */ x('<h3 class="font-semibold text-sm text-white/60">'), lt = /* @__PURE__ */ x('<p class="text-white/50 text-xs">');
648
- function ct(e) {
649
- Ce(() => {
650
- ze();
691
+ var gt = /* @__PURE__ */ x('<div><div class="relative h-full w-full">'), ht = /* @__PURE__ */ x('<div class="glasshome-widget-loading pointer-events-none absolute inset-0 animate-pulse">'), ft = /* @__PURE__ */ x('<div class="flex h-full w-full flex-col items-center justify-center gap-2 text-center">'), mt = /* @__PURE__ */ x('<div class="flex items-center justify-center text-white/30">'), vt = /* @__PURE__ */ x('<h3 class="font-semibold text-sm text-white/60">'), wt = /* @__PURE__ */ x('<p class="text-white/50 text-xs">');
692
+ function pt(e) {
693
+ const t = B(P), [i, r] = V(), n = Me(i);
694
+ Te(() => {
695
+ const a = i()?.getRootNode();
696
+ Pe(typeof ShadowRoot < "u" && a instanceof ShadowRoot || typeof Document < "u" && a instanceof Document ? a : void 0);
651
697
  });
652
- const t = ae(J), [i, r] = V(), n = $e(i), o = {
698
+ const o = {
653
699
  isEditMode: () => e.isEditMode ?? !1,
654
700
  updateConfig: t?.updateConfig ?? (() => {
655
701
  }),
656
702
  registerDialogOpener: t?.registerDialogOpener,
703
+ callService: t?.callService,
657
704
  dimensions: () => ({
658
705
  width: n.width ?? 0,
659
706
  height: n.height ?? 0
660
707
  })
661
- }, u = L(() => {
708
+ }, u = j(() => {
662
709
  if (e.variant)
663
- return typeof e.variant == "string" ? Ve(e.variant) : e.variant;
664
- }), d = L(() => ({
710
+ return typeof e.variant == "string" ? Be(e.variant) : e.variant;
711
+ }), d = j(() => ({
665
712
  "container-type": "size",
666
713
  "container-name": "widget",
667
714
  "touch-action": e.gestures && !e.isEditMode ? e.gestures.touchAction() : void 0,
@@ -679,26 +726,26 @@ function ct(e) {
679
726
  ...e.gradient ? {
680
727
  "--widget-gradient": e.gradient
681
728
  } : {}
682
- })), $ = () => !!e.gestures && !e.isEditMode, m = (s) => {
683
- $() && e.gestures?.onPointerEnter(s);
684
- }, h = (s) => {
685
- $() && e.gestures?.onPointerDown(s);
686
- }, v = (s) => {
687
- $() && e.gestures?.onPointerMove(s);
688
- }, y = (s) => {
689
- $() && e.gestures?.onPointerUp(s);
690
- }, g = (s) => {
691
- $() && e.gestures?.onPointerCancel(s);
729
+ })), $ = () => !!e.gestures && !e.isEditMode, m = (a) => {
730
+ $() && e.gestures?.onPointerEnter(a);
731
+ }, h = (a) => {
732
+ $() && e.gestures?.onPointerDown(a);
733
+ }, v = (a) => {
734
+ $() && e.gestures?.onPointerMove(a);
735
+ }, y = (a) => {
736
+ $() && e.gestures?.onPointerUp(a);
737
+ }, g = (a) => {
738
+ $() && e.gestures?.onPointerCancel(a);
692
739
  };
693
- return k(J.Provider, {
740
+ return k(P.Provider, {
694
741
  value: o,
695
742
  get children() {
696
- var s = it(), S = s.firstChild;
697
- return G(s, "pointercancel", g), G(s, "pointerup", y), G(s, "pointermove", v), G(s, "pointerdown", h), G(s, "pointerenter", m), xe((w) => {
743
+ var a = gt(), C = a.firstChild;
744
+ return K(a, "pointercancel", g), K(a, "pointerup", y), K(a, "pointermove", v), K(a, "pointerdown", h), K(a, "pointerenter", m), Se((w) => {
698
745
  r(w), e.gestures?.bindElement(w);
699
- }, s), b(S, (() => {
746
+ }, a), p(C, (() => {
700
747
  var w = T(() => !!e.emptyState);
701
- return () => w() ? k(dt, {
748
+ return () => w() ? k(bt, {
702
749
  get icon() {
703
750
  return e.emptyState.icon;
704
751
  },
@@ -709,77 +756,77 @@ function ct(e) {
709
756
  return e.emptyState.message;
710
757
  }
711
758
  }) : e.children;
712
- })()), b(s, (() => {
759
+ })()), p(a, (() => {
713
760
  var w = T(() => !!e.loading);
714
761
  return () => w() && (() => {
715
- var M = rt();
716
- return W((z) => X(M, "z-index", Y.OVERLAY)), M;
762
+ var M = ht();
763
+ return W((O) => ee(M, "z-index", J.OVERLAY)), M;
717
764
  })();
718
765
  })(), null), W((w) => {
719
- var M = P("glasshome-widget", "relative h-full w-full select-none overflow-hidden rounded-xl border border-border/50", u()?.styles?.class, e.class), z = d(), I = Y.CONTENT;
720
- return M !== w.e && R(s, w.e = M), w.t = oe(s, z, w.t), I !== w.a && X(S, "z-index", w.a = I), w;
766
+ var M = R("glasshome-widget", "relative h-full w-full select-none overflow-hidden rounded-xl border border-border/50", u()?.styles?.class, e.class), O = d(), L = J.CONTENT;
767
+ return M !== w.e && I(a, w.e = M), w.t = le(a, O, w.t), L !== w.a && ee(C, "z-index", w.a = L), w;
721
768
  }, {
722
769
  e: void 0,
723
770
  t: void 0,
724
771
  a: void 0
725
- }), s;
772
+ }), a;
726
773
  }
727
774
  });
728
775
  }
729
- function dt(e) {
776
+ function bt(e) {
730
777
  return (() => {
731
- var t = ot();
732
- return b(t, (() => {
778
+ var t = ft();
779
+ return p(t, (() => {
733
780
  var i = T(() => !!e.icon);
734
781
  return () => i() && (() => {
735
- var r = at();
736
- return b(r, () => e.icon), r;
782
+ var r = mt();
783
+ return p(r, () => e.icon), r;
737
784
  })();
738
- })(), null), b(t, (() => {
785
+ })(), null), p(t, (() => {
739
786
  var i = T(() => !!e.title);
740
787
  return () => i() && (() => {
741
- var r = st();
742
- return b(r, () => e.title), r;
788
+ var r = vt();
789
+ return p(r, () => e.title), r;
743
790
  })();
744
- })(), null), b(t, (() => {
791
+ })(), null), p(t, (() => {
745
792
  var i = T(() => !!e.message);
746
793
  return () => i() && (() => {
747
- var r = lt();
748
- return b(r, () => e.message), r;
794
+ var r = wt();
795
+ return p(r, () => e.message), r;
749
796
  })();
750
797
  })(), null), t;
751
798
  })();
752
799
  }
753
- const U = ct;
754
- U.Content = Re;
755
- U.Icon = Be;
756
- U.Title = Ye;
757
- U.Status = Fe;
758
- U.Value = nt;
759
- U.SliderFill = Pe;
760
- var ut = /* @__PURE__ */ x('<span class="inline-flex size-3.5 shrink-0 items-center">'), gt = /* @__PURE__ */ x("<button type=button>"), ht = /* @__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">'), ft = /* @__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'), mt = /* @__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>'), vt = /* @__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'), wt = /* @__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">'), bt = /* @__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'), pt = /* @__PURE__ */ x('<div class="min-w-0 shrink-0">'), xt = /* @__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">'), yt = /* @__PURE__ */ x('<div class="min-h-0 flex-1 overflow-y-auto [scrollbar-gutter:stable]">'), $t = /* @__PURE__ */ x('<div class="flex shrink-0 items-center justify-end gap-2 border-border/50 border-t pt-3">');
761
- function kt(e) {
800
+ const q = pt;
801
+ q.Content = Ye;
802
+ q.Icon = Qe;
803
+ q.Title = it;
804
+ q.Status = et;
805
+ q.Value = ut;
806
+ q.SliderFill = Ge;
807
+ var xt = /* @__PURE__ */ x('<span class="inline-flex size-3.5 shrink-0 items-center">'), yt = /* @__PURE__ */ x("<button type=button>"), $t = /* @__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">'), kt = /* @__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'), St = /* @__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>'), Ct = /* @__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'), Mt = /* @__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">'), Dt = /* @__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'), Tt = /* @__PURE__ */ x('<div class="min-w-0 shrink-0">'), _t = /* @__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">'), Ot = /* @__PURE__ */ x('<div class="min-h-0 flex-1 overflow-y-auto [scrollbar-gutter:stable]">'), zt = /* @__PURE__ */ x('<div class="flex shrink-0 items-center justify-end gap-2 border-border/50 border-t pt-3">');
808
+ function Et(e) {
762
809
  return (() => {
763
- var t = gt();
764
- return t.$$click = () => e.onClick(), b(t, k(E, {
810
+ var t = yt();
811
+ return t.$$click = () => e.onClick(), p(t, k(E, {
765
812
  get when() {
766
813
  return e.isActive;
767
814
  },
768
815
  get children() {
769
- var i = ut();
770
- return b(i, () => e.icon), i;
816
+ var i = xt();
817
+ return p(i, () => e.icon), i;
771
818
  }
772
- }), null), b(t, () => e.label, null), W(() => R(t, P("flex cursor-pointer items-center justify-center rounded-md px-3 py-1.5 text-xs transition-all duration-300 ease-in-out", e.isActive ? "gap-1.5 bg-foreground/10 font-semibold text-foreground shadow-sm" : "gap-0 text-muted-foreground hover:bg-foreground/5 hover:text-foreground"))), t;
819
+ }), null), p(t, () => e.label, null), W(() => I(t, R("flex cursor-pointer items-center justify-center rounded-md px-3 py-1.5 text-xs transition-all duration-300 ease-in-out", e.isActive ? "gap-1.5 bg-foreground/10 font-semibold text-foreground shadow-sm" : "gap-0 text-muted-foreground hover:bg-foreground/5 hover:text-foreground"))), t;
773
820
  })();
774
821
  }
775
- function Ft(e) {
776
- const [t] = Se(e, ["open", "onOpenChange", "title", "onSave", "hasUnsavedChanges", "onDelete", "editContent", "controlsContent", "debugContent", "debugData", "tabs", "class", "maxWidth", "defaultTab", "activeTab", "onActiveTabChange", "headerActions", "configSchema", "config", "onConfigSave", "ResponsiveDialog", "ResponsiveDialogContent", "ResponsiveDialogHeader", "ResponsiveDialogTitle", "ResponsiveDialogDescription", "Button", "SchemaForm"]), i = () => !!t.configSchema && !!t.config && !!t.onConfigSave && !!t.SchemaForm, [r, n] = V({}), [o, u] = V(null);
777
- re(de(() => t.config, (c) => {
822
+ function an(e) {
823
+ const [t] = _e(e, ["open", "onOpenChange", "title", "onSave", "hasUnsavedChanges", "onDelete", "editContent", "controlsContent", "debugContent", "debugData", "tabs", "class", "maxWidth", "defaultTab", "activeTab", "onActiveTabChange", "headerActions", "configSchema", "config", "onConfigSave", "ResponsiveDialog", "ResponsiveDialogContent", "ResponsiveDialogHeader", "ResponsiveDialogTitle", "ResponsiveDialogDescription", "Button", "SchemaForm"]), i = () => !!t.configSchema && !!t.config && !!t.onConfigSave && !!t.SchemaForm, [r, n] = V({}), [o, u] = V(null);
824
+ se(ge(() => t.config, (c) => {
778
825
  c && n({
779
826
  ...c
780
827
  });
781
- })), re(de(() => t.configSchema, (c) => {
782
- c && u(ge(c));
828
+ })), se(ge(() => t.configSchema, (c) => {
829
+ c && u(me(c));
783
830
  }));
784
831
  const d = () => i() && JSON.stringify(r()) !== JSON.stringify(t.config), $ = (c) => {
785
832
  !c && t.config && n({
@@ -789,7 +836,7 @@ function Ft(e) {
789
836
  t.onConfigSave?.(r());
790
837
  }, [h, v] = V(t.defaultTab ?? "controls"), y = () => t.activeTab ?? h(), g = (c) => {
791
838
  t.onActiveTabChange ? t.onActiveTabChange(c) : v(c);
792
- }, s = () => {
839
+ }, a = () => {
793
840
  const c = t.maxWidth ?? "3xl";
794
841
  return {
795
842
  sm: "max-w-sm",
@@ -800,14 +847,14 @@ function Ft(e) {
800
847
  "3xl": "max-w-3xl",
801
848
  "4xl": "max-w-4xl"
802
849
  }[c];
803
- }, S = () => {
850
+ }, C = () => {
804
851
  if (t.tabs) return t.tabs;
805
852
  const c = [];
806
853
  return c.push({
807
854
  id: "edit",
808
855
  label: "Edit",
809
- icon: ht(),
810
- content: t.editContent ?? (i() && o() ? k(p, {
856
+ icon: $t(),
857
+ content: t.editContent ?? (i() && o() ? k(b, {
811
858
  get schema() {
812
859
  return o();
813
860
  },
@@ -815,17 +862,17 @@ function Ft(e) {
815
862
  return r();
816
863
  },
817
864
  onChange: n
818
- }) : ft())
865
+ }) : kt())
819
866
  }), c.push({
820
867
  id: "controls",
821
868
  label: "Controls",
822
- icon: mt(),
823
- content: t.controlsContent ?? vt()
869
+ icon: St(),
870
+ content: t.controlsContent ?? Ct()
824
871
  }), c.push({
825
872
  id: "debug",
826
873
  label: "Debug",
827
- icon: wt(),
828
- content: t.debugContent ?? bt()
874
+ icon: Mt(),
875
+ content: t.debugContent ?? Dt()
829
876
  }), c;
830
877
  }, w = async () => {
831
878
  if (t.debugData !== void 0)
@@ -835,37 +882,37 @@ function Ft(e) {
835
882
  } catch {
836
883
  }
837
884
  }, M = () => {
838
- const c = S();
885
+ const c = C();
839
886
  return c.find((N) => N.id === y())?.content ?? c[0]?.content;
840
- }, z = t.ResponsiveDialog, I = t.ResponsiveDialogContent, B = t.ResponsiveDialogHeader, H = t.ResponsiveDialogTitle, a = t.ResponsiveDialogDescription, f = t.Button, p = t.SchemaForm, C = (c) => i() ? $(c) : t.onOpenChange(c), O = () => i() ? d() : t.hasUnsavedChanges, D = () => i() ? m : t.onSave;
841
- return k(z, {
887
+ }, O = t.ResponsiveDialog, L = t.ResponsiveDialogContent, F = t.ResponsiveDialogHeader, H = t.ResponsiveDialogTitle, s = t.ResponsiveDialogDescription, f = t.Button, b = t.SchemaForm, S = (c) => i() ? $(c) : t.onOpenChange(c), z = () => i() ? d() : t.hasUnsavedChanges, D = () => i() ? m : t.onSave;
888
+ return k(O, {
842
889
  get open() {
843
890
  return t.open;
844
891
  },
845
- onOpenChange: (c) => C(c),
892
+ onOpenChange: (c) => S(c),
846
893
  get children() {
847
- return k(I, {
894
+ return k(L, {
848
895
  get class() {
849
- return P(s(), t.class);
896
+ return R(a(), t.class);
850
897
  },
851
898
  get children() {
852
- return [k(B, {
899
+ return [k(F, {
853
900
  class: "flex flex-row items-center justify-between gap-3",
854
901
  get children() {
855
902
  return [(() => {
856
- var c = pt();
857
- return b(c, k(H, {
903
+ var c = Tt();
904
+ return p(c, k(H, {
858
905
  class: "truncate leading-tight",
859
906
  get children() {
860
907
  return t.title;
861
908
  }
862
- }), null), b(c, k(a, {
909
+ }), null), p(c, k(s, {
863
910
  class: "sr-only",
864
911
  children: "Widget configuration dialog"
865
912
  }), null), c;
866
913
  })(), (() => {
867
- var c = xt(), F = c.firstChild;
868
- return b(F, () => S().map((N) => k(kt, {
914
+ var c = _t(), Y = c.firstChild;
915
+ return p(Y, () => C().map((N) => k(Et, {
869
916
  get icon() {
870
917
  return N.icon;
871
918
  },
@@ -876,7 +923,7 @@ function Ft(e) {
876
923
  return y() === N.id;
877
924
  },
878
925
  onClick: () => g(N.id)
879
- }))), b(c, k(E, {
926
+ }))), p(c, k(E, {
880
927
  get when() {
881
928
  return t.headerActions;
882
929
  },
@@ -887,15 +934,15 @@ function Ft(e) {
887
934
  })()];
888
935
  }
889
936
  }), (() => {
890
- var c = yt();
891
- return b(c, M), c;
937
+ var c = Ot();
938
+ return p(c, M), c;
892
939
  })(), k(E, {
893
940
  get when() {
894
941
  return T(() => y() === "edit")() && (D() || t.onDelete) || y() === "debug" && t.debugData !== void 0;
895
942
  },
896
943
  get children() {
897
- var c = $t();
898
- return b(c, k(E, {
944
+ var c = zt();
945
+ return p(c, k(E, {
899
946
  get when() {
900
947
  return T(() => y() === "edit")() && t.onDelete;
901
948
  },
@@ -907,7 +954,7 @@ function Ft(e) {
907
954
  children: "Delete"
908
955
  });
909
956
  }
910
- }), null), b(c, k(E, {
957
+ }), null), p(c, k(E, {
911
958
  get when() {
912
959
  return T(() => y() === "edit")() && D();
913
960
  },
@@ -915,13 +962,13 @@ function Ft(e) {
915
962
  return k(f, {
916
963
  size: "sm",
917
964
  get disabled() {
918
- return !O();
965
+ return !z();
919
966
  },
920
967
  onClick: () => D()?.(),
921
968
  children: "Save"
922
969
  });
923
970
  }
924
- }), null), b(c, k(E, {
971
+ }), null), p(c, k(E, {
925
972
  get when() {
926
973
  return T(() => y() === "debug")() && t.debugData !== void 0;
927
974
  },
@@ -941,30 +988,30 @@ function Ft(e) {
941
988
  }
942
989
  });
943
990
  }
944
- ye(["click"]);
945
- function Gt(e) {
991
+ Ce(["click"]);
992
+ function sn(e) {
946
993
  if (typeof IntersectionObserver > "u")
947
994
  return () => !1;
948
995
  const [t, i] = V(!1), r = new IntersectionObserver((n) => {
949
996
  const o = n[0];
950
997
  o && i(!o.isIntersecting);
951
998
  });
952
- return re(() => {
999
+ return se(() => {
953
1000
  const n = e();
954
1001
  r.disconnect(), n && r.observe(n);
955
- }), se(() => r.disconnect()), t;
1002
+ }), ce(() => r.disconnect()), t;
956
1003
  }
957
- function qt() {
1004
+ function ln() {
958
1005
  if (typeof window > "u" || typeof window.matchMedia != "function")
959
1006
  return () => !1;
960
1007
  const e = window.matchMedia("(prefers-reduced-motion: reduce)"), [t, i] = V(e.matches), r = (n) => i(n.matches);
961
- return e.addEventListener("change", r), se(() => e.removeEventListener("change", r)), t;
1008
+ return e.addEventListener("change", r), ce(() => e.removeEventListener("change", r)), t;
962
1009
  }
963
- function Yt(e = "controls") {
1010
+ function cn(e = "controls") {
964
1011
  const [t, i] = V(!1), [r, n] = V(e), o = (d) => {
965
1012
  n(d ?? e), i(!0);
966
- }, u = ae(J);
967
- return u?.registerDialogOpener?.(o), se(() => u?.registerDialogOpener?.(null)), {
1013
+ }, u = B(P);
1014
+ return u?.registerDialogOpener?.(o), ce(() => u?.registerDialogOpener?.(null)), {
968
1015
  showDialog: t,
969
1016
  setShowDialog: i,
970
1017
  openDialog: o,
@@ -983,19 +1030,19 @@ function Yt(e = "controls") {
983
1030
  }
984
1031
  };
985
1032
  }
986
- function Kt(e) {
987
- const t = e.minEntities ?? 1, i = L(() => e.entities().length), r = L(() => i() >= t), n = L(() => !r() || !e.calculateGroupData ? null : e.calculateGroupData(e.entities())), o = L(() => {
1033
+ function dn(e) {
1034
+ const t = e.minEntities ?? 1, i = j(() => e.entities().length), r = j(() => i() >= t), n = j(() => !r() || !e.calculateGroupData ? null : e.calculateGroupData(e.entities())), o = j(() => {
988
1035
  if (!r()) return;
989
1036
  const d = e.aggregationMode?.();
990
1037
  if (!d || d === "none") return;
991
1038
  const $ = e.entities();
992
1039
  if (d === "light" || d === "binary-sensor" || d === "switch")
993
- return Ke($, e.allEntitiesMode);
1040
+ return rt($, e.allEntitiesMode);
994
1041
  if (d === "sensor") {
995
1042
  const m = e.sensorGroupType?.() ?? "mean";
996
- return Xe($, m, !0);
1043
+ return ot($, m, !0);
997
1044
  }
998
- }), u = L(() => r() ? void 0 : e.emptyStateConfig);
1045
+ }), u = j(() => r() ? void 0 : e.emptyStateConfig);
999
1046
  return {
1000
1047
  entities: e.entities,
1001
1048
  groupData: n,
@@ -1005,40 +1052,40 @@ function Kt(e) {
1005
1052
  count: i
1006
1053
  };
1007
1054
  }
1008
- const q = 32, l = q / 2, _ = "white", Q = "rgba(0,0,0,0.4)", le = 2, Z = 3;
1009
- function Ct(e) {
1055
+ const X = 32, l = X / 2, _ = "white", te = "rgba(0,0,0,0.4)", de = 2, ne = 3;
1056
+ function Nt(e) {
1010
1057
  return `url("data:image/svg+xml,${encodeURIComponent(e)}")`;
1011
1058
  }
1012
- function ee(e) {
1013
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${q}" height="${q}" viewBox="0 0 ${q} ${q}">${e}</svg>`;
1059
+ function ie(e) {
1060
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${X}" height="${X}" viewBox="0 0 ${X} ${X}">${e}</svg>`;
1014
1061
  }
1015
- const St = ee(`
1062
+ const At = ie(`
1016
1063
  <g transform="translate(6, 2)">
1017
1064
  <!-- shadow -->
1018
- <g stroke="${Q}" stroke-width="${Z}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1065
+ <g stroke="${te}" stroke-width="${ne}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1019
1066
  <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"/>
1020
1067
  </g>
1021
1068
  <!-- main -->
1022
- <g stroke="${_}" stroke-width="${le}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1069
+ <g stroke="${_}" stroke-width="${de}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1023
1070
  <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"/>
1024
1071
  </g>
1025
1072
  </g>
1026
- `), Mt = ee(`
1073
+ `), Vt = ie(`
1027
1074
  <g>
1028
- <circle cx="${l}" cy="${l}" r="8" stroke="${Q}" stroke-width="${Z}" fill="none"/>
1075
+ <circle cx="${l}" cy="${l}" r="8" stroke="${te}" stroke-width="${ne}" fill="none"/>
1029
1076
  <circle cx="${l}" cy="${l}" r="8" stroke="${_}" stroke-width="1.5" fill="none"/>
1030
1077
  <circle cx="${l}" cy="${l}" r="1.5" fill="${_}"/>
1031
1078
  </g>
1032
- `), Dt = ee(`
1079
+ `), Wt = ie(`
1033
1080
  <g>
1034
1081
  <!-- shadow -->
1035
- <g stroke="${Q}" stroke-width="${Z}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1082
+ <g stroke="${te}" stroke-width="${ne}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1036
1083
  <line x1="6" y1="${l}" x2="26" y2="${l}"/>
1037
1084
  <polyline points="10,${l - 4} 6,${l} 10,${l + 4}"/>
1038
1085
  <polyline points="22,${l - 4} 26,${l} 22,${l + 4}"/>
1039
1086
  </g>
1040
1087
  <!-- main -->
1041
- <g stroke="${_}" stroke-width="${le}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1088
+ <g stroke="${_}" stroke-width="${de}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1042
1089
  <line x1="6" y1="${l}" x2="26" y2="${l}"/>
1043
1090
  <polyline points="10,${l - 4} 6,${l} 10,${l + 4}"/>
1044
1091
  <polyline points="22,${l - 4} 26,${l} 22,${l + 4}"/>
@@ -1048,16 +1095,16 @@ const St = ee(`
1048
1095
  <circle cx="${l - 5}" cy="${l}" r="1" fill="${_}" opacity="0.6"/>
1049
1096
  <circle cx="${l + 5}" cy="${l}" r="1" fill="${_}" opacity="0.6"/>
1050
1097
  </g>
1051
- `), Tt = ee(`
1098
+ `), Rt = ie(`
1052
1099
  <g>
1053
1100
  <!-- shadow -->
1054
- <g stroke="${Q}" stroke-width="${Z}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1101
+ <g stroke="${te}" stroke-width="${ne}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1055
1102
  <line x1="${l}" y1="6" x2="${l}" y2="26"/>
1056
1103
  <polyline points="${l - 4},10 ${l},6 ${l + 4},10"/>
1057
1104
  <polyline points="${l - 4},22 ${l},26 ${l + 4},22"/>
1058
1105
  </g>
1059
1106
  <!-- main -->
1060
- <g stroke="${_}" stroke-width="${le}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1107
+ <g stroke="${_}" stroke-width="${de}" fill="none" stroke-linecap="round" stroke-linejoin="round">
1061
1108
  <line x1="${l}" y1="6" x2="${l}" y2="26"/>
1062
1109
  <polyline points="${l - 4},10 ${l},6 ${l + 4},10"/>
1063
1110
  <polyline points="${l - 4},22 ${l},26 ${l + 4},22"/>
@@ -1068,60 +1115,60 @@ const St = ee(`
1068
1115
  <circle cx="${l}" cy="${l + 5}" r="1" fill="${_}" opacity="0.6"/>
1069
1116
  </g>
1070
1117
  `);
1071
- function K(e, t, i) {
1072
- return { css: `${Ct(e)} ${t} ${i}, auto`, hotspotX: t, hotspotY: i };
1073
- }
1074
- const j = {
1075
- tap: K(St, 12, 4),
1076
- hold: K(Mt, 16, 16),
1077
- slideHorizontal: K(Dt, l, l),
1078
- slideVertical: K(Tt, l, l)
1118
+ function Z(e, t, i) {
1119
+ return { css: `${Nt(e)} ${t} ${i}, auto`, hotspotX: t, hotspotY: i };
1120
+ }
1121
+ const U = {
1122
+ tap: Z(At, 12, 4),
1123
+ hold: Z(Vt, 16, 16),
1124
+ slideHorizontal: Z(Wt, l, l),
1125
+ slideVertical: Z(Rt, l, l)
1079
1126
  };
1080
- function ne() {
1127
+ function oe() {
1081
1128
  if (typeof window > "u") return null;
1082
1129
  const e = window;
1083
1130
  return e.Capacitor?.isNativePlatform?.() ? e.Capacitor.Plugins?.Haptics ?? null : null;
1084
1131
  }
1085
- function ie(e) {
1132
+ function ae(e) {
1086
1133
  if (!(typeof navigator > "u" || typeof navigator.vibrate != "function"))
1087
1134
  try {
1088
1135
  navigator.vibrate(e);
1089
1136
  } catch {
1090
1137
  }
1091
1138
  }
1092
- const _t = {
1139
+ const Ht = {
1093
1140
  /** Light confirmation — fires when slide gesture arms after user holds still. */
1094
1141
  tick() {
1095
- const e = ne();
1142
+ const e = oe();
1096
1143
  if (e) {
1097
1144
  e.impact({ style: "Light" }).catch(() => {
1098
1145
  });
1099
1146
  return;
1100
1147
  }
1101
- ie(8);
1148
+ ae(8);
1102
1149
  },
1103
1150
  /** Medium bump — fires when hold gesture commits (detail opening). */
1104
1151
  bump() {
1105
- const e = ne();
1152
+ const e = oe();
1106
1153
  if (e) {
1107
1154
  e.impact({ style: "Medium" }).catch(() => {
1108
1155
  });
1109
1156
  return;
1110
1157
  }
1111
- ie(20);
1158
+ ae(20);
1112
1159
  },
1113
1160
  /** Stronger pulse — reserved for edit-mode pickup (future use). */
1114
1161
  pulse() {
1115
- const e = ne();
1162
+ const e = oe();
1116
1163
  if (e) {
1117
1164
  e.impact({ style: "Heavy" }).catch(() => {
1118
1165
  });
1119
1166
  return;
1120
1167
  }
1121
- ie([0, 15, 40, 15]);
1168
+ ae([0, 15, 40, 15]);
1122
1169
  }
1123
1170
  };
1124
- function Xt(e, t) {
1171
+ function un(e, t) {
1125
1172
  const n = {
1126
1173
  isDown: !1,
1127
1174
  isTouch: !1,
@@ -1135,99 +1182,99 @@ function Xt(e, t) {
1135
1182
  };
1136
1183
  let o = null, u = null, d = null;
1137
1184
  const [$, m] = V(null);
1138
- function h(a) {
1139
- a !== u && (d && d.disconnect(), d = new ResizeObserver((f) => {
1140
- const p = f[0];
1141
- if (p) {
1142
- const C = p.borderBoxSize?.[0];
1143
- C ? o = { width: C.inlineSize, height: C.blockSize } : o = { width: p.contentRect.width, height: p.contentRect.height }, m(o.height > o.width);
1185
+ function h(s) {
1186
+ s !== u && (d && d.disconnect(), d = new ResizeObserver((f) => {
1187
+ const b = f[0];
1188
+ if (b) {
1189
+ const S = b.borderBoxSize?.[0];
1190
+ S ? o = { width: S.inlineSize, height: S.blockSize } : o = { width: b.contentRect.width, height: b.contentRect.height }, m(o.height > o.width);
1144
1191
  }
1145
- }), u = a, d.observe(a), o = { width: a.clientWidth, height: a.clientHeight }, m(o.height > o.width));
1192
+ }), u = s, d.observe(s), o = { width: s.clientWidth, height: s.clientHeight }, m(o.height > o.width));
1146
1193
  }
1147
1194
  const v = () => {
1148
1195
  n.holdTimer && (clearTimeout(n.holdTimer), n.holdTimer = null);
1149
1196
  }, y = () => {
1150
1197
  n.isDown = !1, n.hasMoved = !1, n.sliding = !1;
1151
- }, g = (a) => {
1152
- const p = e().slide;
1153
- return p?.orientation === "horizontal" ? "horizontal" : p?.orientation === "vertical" ? "vertical" : a && (o || h(a), o) ? o.height > o.width ? "vertical" : "horizontal" : (t?.() ?? "horizontal") === "horizontal" ? "horizontal" : "vertical";
1154
- }, s = (a) => {
1198
+ }, g = (s) => {
1199
+ const b = e().slide;
1200
+ return b?.orientation === "horizontal" ? "horizontal" : b?.orientation === "vertical" ? "vertical" : s && (o || h(s), o) ? o.height > o.width ? "vertical" : "horizontal" : (t?.() ?? "horizontal") === "horizontal" ? "horizontal" : "vertical";
1201
+ }, a = (s) => {
1155
1202
  const f = e();
1156
1203
  if (!(!f.tap && !f.hold && !f.slide)) {
1157
- if (n.isDown = !0, n.isTouch = a.pointerType === "touch", n.element = a.currentTarget, h(n.element), n.startX = a.clientX, n.startY = a.clientY, n.startTime = Date.now(), n.hasMoved = !1, n.sliding = !1, f.hold) {
1158
- const p = f.hold.delay ?? 300;
1204
+ if (n.isDown = !0, n.isTouch = s.pointerType === "touch", n.element = s.currentTarget, h(n.element), n.startX = s.clientX, n.startY = s.clientY, n.startTime = Date.now(), n.hasMoved = !1, n.sliding = !1, f.hold) {
1205
+ const b = f.hold.delay ?? 300;
1159
1206
  n.holdTimer = setTimeout(() => {
1160
- n.holdTimer = null, !(!n.isDown || n.hasMoved) && (_t.bump(), f.hold?.action(), n.isDown = !1);
1161
- }, p);
1207
+ n.holdTimer = null, !(!n.isDown || n.hasMoved) && (Ht.bump(), f.hold?.action(), n.isDown = !1);
1208
+ }, b);
1162
1209
  }
1163
1210
  if (!n.isTouch && f.slide)
1164
1211
  try {
1165
- a.currentTarget.setPointerCapture(a.pointerId);
1212
+ s.currentTarget.setPointerCapture(s.pointerId);
1166
1213
  } catch {
1167
1214
  }
1168
1215
  }
1169
- }, S = (a) => {
1216
+ }, C = (s) => {
1170
1217
  if (!n.isDown) return;
1171
- const f = e(), p = a.clientX - n.startX, C = a.clientY - n.startY;
1172
- if (Math.sqrt(p * p + C * C) > 10 && (v(), n.hasMoved = !0), f.slide && n.hasMoved) {
1173
- const D = a.currentTarget, c = g(D);
1218
+ const f = e(), b = s.clientX - n.startX, S = s.clientY - n.startY;
1219
+ if (Math.sqrt(b * b + S * S) > 10 && (v(), n.hasMoved = !0), f.slide && n.hasMoved) {
1220
+ const D = s.currentTarget, c = g(D);
1174
1221
  if (n.isTouch && !n.sliding) {
1175
- const be = Math.abs(c === "vertical" ? C : p), pe = Math.abs(c === "vertical" ? p : C);
1176
- if (be < pe) return;
1222
+ const $e = Math.abs(c === "vertical" ? S : b), ke = Math.abs(c === "vertical" ? b : S);
1223
+ if ($e < ke) return;
1177
1224
  }
1178
1225
  n.sliding = !0;
1179
- const F = f.slide.min ?? 0, N = f.slide.max ?? 100, he = N - F, fe = c === "vertical" ? -C : p, ce = o ?? { width: D.clientWidth, height: D.clientHeight }, me = c === "vertical" ? ce.height : ce.width, ve = fe / me * he, we = Math.max(F, Math.min(N, f.slide.value + ve));
1180
- f.slide.onChange(Math.round(we)), n.startX = a.clientX, n.startY = a.clientY, a.preventDefault();
1226
+ const Y = f.slide.min ?? 0, N = f.slide.max ?? 100, we = N - Y, pe = c === "vertical" ? -S : b, ue = o ?? { width: D.clientWidth, height: D.clientHeight }, be = c === "vertical" ? ue.height : ue.width, xe = pe / be * we, ye = Math.max(Y, Math.min(N, f.slide.value + xe));
1227
+ f.slide.onChange(Math.round(ye)), n.startX = s.clientX, n.startY = s.clientY, s.preventDefault();
1181
1228
  }
1182
- }, w = (a) => {
1183
- const f = e(), p = n.isDown, C = Date.now() - n.startTime, O = f.hold?.delay ?? 300;
1184
- v(), p && f.tap && !n.hasMoved && C < O && f.tap();
1229
+ }, w = (s) => {
1230
+ const f = e(), b = n.isDown, S = Date.now() - n.startTime, z = f.hold?.delay ?? 300;
1231
+ v(), b && f.tap && !n.hasMoved && S < z && f.tap();
1185
1232
  try {
1186
- a.currentTarget.releasePointerCapture(a.pointerId);
1233
+ s.currentTarget.releasePointerCapture(s.pointerId);
1187
1234
  } catch {
1188
1235
  }
1189
1236
  y();
1190
- }, M = (a) => {
1237
+ }, M = (s) => {
1191
1238
  v();
1192
1239
  try {
1193
- a.currentTarget.releasePointerCapture(a.pointerId);
1240
+ s.currentTarget.releasePointerCapture(s.pointerId);
1194
1241
  } catch {
1195
1242
  }
1196
1243
  y();
1197
- }, z = (a) => {
1244
+ }, O = (s) => {
1198
1245
  const f = e();
1199
1246
  if (f.slide) {
1200
- const p = f.slide.orientation;
1201
- return p === "horizontal" ? j.slideHorizontal.css : p === "vertical" ? j.slideVertical.css : (o || h(a), o && o.height > o.width ? j.slideVertical.css : j.slideHorizontal.css);
1247
+ const b = f.slide.orientation;
1248
+ return b === "horizontal" ? U.slideHorizontal.css : b === "vertical" ? U.slideVertical.css : (o || h(s), o && o.height > o.width ? U.slideVertical.css : U.slideHorizontal.css);
1202
1249
  }
1203
- return f.tap ? j.tap.css : f.hold ? j.hold.css : "";
1250
+ return f.tap ? U.tap.css : f.hold ? U.hold.css : "";
1204
1251
  };
1205
1252
  return {
1206
- onPointerDown: s,
1207
- onPointerMove: S,
1253
+ onPointerDown: a,
1254
+ onPointerMove: C,
1208
1255
  onPointerUp: w,
1209
1256
  onPointerCancel: M,
1210
- onPointerEnter: (a) => {
1211
- const f = a.currentTarget;
1212
- n.element = f, f.style.cursor = z(f);
1257
+ onPointerEnter: (s) => {
1258
+ const f = s.currentTarget;
1259
+ n.element = f, f.style.cursor = O(f);
1213
1260
  },
1214
- bindElement: (a) => {
1215
- a && (n.element = a, h(a));
1261
+ bindElement: (s) => {
1262
+ s && (n.element = s, h(s));
1216
1263
  },
1217
1264
  touchAction: () => {
1218
- const a = e();
1219
- if (a.slide) {
1220
- const f = a.slide.orientation;
1265
+ const s = e();
1266
+ if (s.slide) {
1267
+ const f = s.slide.orientation;
1221
1268
  return f === "vertical" || f !== "horizontal" && ($() ?? (t?.() ?? "horizontal") !== "horizontal") ? "pan-x" : "pan-y";
1222
1269
  }
1223
- return a.tap || a.hold ? "manipulation" : "auto";
1270
+ return s.tap || s.hold ? "manipulation" : "auto";
1224
1271
  },
1225
1272
  dispose: () => {
1226
1273
  v(), d && (d.disconnect(), d = null), u = null, o = null;
1227
1274
  }
1228
1275
  };
1229
1276
  }
1230
- const zt = {
1277
+ const Pt = {
1231
1278
  solar: "oklch(0.74 0.18 60)",
1232
1279
  grid: "oklch(0.62 0.12 245)",
1233
1280
  battery: "oklch(0.70 0.18 145)",
@@ -1237,23 +1284,23 @@ const zt = {
1237
1284
  // Fault red-orange; used only for faults, never normal consumption.
1238
1285
  negative: "oklch(0.64 0.22 27)"
1239
1286
  };
1240
- function Ot(e) {
1287
+ function It(e) {
1241
1288
  return {
1242
1289
  fill: `color-mix(in oklch, ${e} 20%, transparent)`,
1243
1290
  stroke: e,
1244
1291
  solid: e
1245
1292
  };
1246
1293
  }
1247
- const Jt = Object.fromEntries(
1248
- Object.entries(zt).map(([e, t]) => [e, Ot(t)])
1249
- ), Qt = A.enum([
1294
+ const gn = Object.fromEntries(
1295
+ Object.entries(Pt).map(([e, t]) => [e, It(t)])
1296
+ ), hn = A.enum([
1250
1297
  "success",
1251
1298
  "warning",
1252
1299
  "danger",
1253
1300
  "info",
1254
1301
  "neutral",
1255
1302
  "accent"
1256
- ]), Zt = {
1303
+ ]), fn = {
1257
1304
  /** Optional display name override (renders as text input) */
1258
1305
  title: () => A.string().optional().meta({ title: "Title", description: "Optional display name override" }),
1259
1306
  /** Multi-select entity picker for a HA domain */
@@ -1263,7 +1310,7 @@ const Jt = Object.fromEntries(
1263
1310
  /** Area picker dropdown */
1264
1311
  areaId: () => A.string().optional().meta({ formType: "area-picker", title: "Area" })
1265
1312
  };
1266
- function en(e) {
1313
+ function mn(e) {
1267
1314
  if (e.length < 2) return "";
1268
1315
  const t = e[0], i = e[1];
1269
1316
  if (!t || !i) return "";
@@ -1285,46 +1332,73 @@ function en(e) {
1285
1332
  for (let m = 0; m < r - 1; m++) {
1286
1333
  const h = e[m], v = e[m + 1];
1287
1334
  if (!h || !v) continue;
1288
- const y = (n[m] ?? 0) / 3, g = d[m] ?? 0, s = d[m + 1] ?? 0;
1289
- $ += ` C ${h.x + y} ${h.y + g * y}, ${v.x - y} ${v.y - s * y}, ${v.x} ${v.y}`;
1335
+ const y = (n[m] ?? 0) / 3, g = d[m] ?? 0, a = d[m + 1] ?? 0;
1336
+ $ += ` C ${h.x + y} ${h.y + g * y}, ${v.x - y} ${v.y - a * y}, ${v.x} ${v.y}`;
1290
1337
  }
1291
1338
  return $;
1292
1339
  }
1293
- function tn() {
1340
+ function vn() {
1294
1341
  return document.documentElement.classList.contains("dark");
1295
1342
  }
1296
- const Et = "0.5.2", Nt = {
1297
- version: Et
1298
- }, nn = Nt.version;
1343
+ const Lt = "1.1.0", Ut = {
1344
+ version: Lt
1345
+ }, wn = Ut.version;
1299
1346
  export {
1300
- nn as SDK_VERSION,
1301
- Qt as ToneSchema,
1302
- U as Widget,
1303
- Re as WidgetContent,
1304
- J as WidgetCtx,
1305
- Ft as WidgetDialog,
1306
- Be as WidgetIcon,
1307
- an as WidgetManifestSchema,
1308
- Pe as WidgetSliderFill,
1309
- Fe as WidgetStatus,
1310
- Ye as WidgetTitle,
1311
- nt as WidgetValue,
1312
- Ke as calculateLightGroup,
1313
- Xe as calculateSensorGroup,
1314
- Ut as countActiveEntities,
1315
- jt as defineWidget,
1316
- sn as formatSchemaError,
1317
- Bt as getEntityAttribute,
1318
- ze as injectTokens,
1319
- tn as isDark,
1320
- Je as isEntityActive,
1321
- en as monotoneCubicPath,
1322
- Jt as svgColors,
1323
- Gt as useIntersectionPause,
1324
- qt as useReducedMotion,
1325
- Lt as useWidgetContext,
1326
- Yt as useWidgetDialog,
1327
- Kt as useWidgetEntityGroup,
1328
- Xt as useWidgetGestures,
1329
- Zt as widgetFields
1347
+ wn as SDK_VERSION,
1348
+ hn as ToneSchema,
1349
+ q as Widget,
1350
+ Ye as WidgetContent,
1351
+ P as WidgetCtx,
1352
+ an as WidgetDialog,
1353
+ Qe as WidgetIcon,
1354
+ xn as WidgetManifestSchema,
1355
+ Ge as WidgetSliderFill,
1356
+ et as WidgetStatus,
1357
+ it as WidgetTitle,
1358
+ ut as WidgetValue,
1359
+ kn as byDomain,
1360
+ rt as calculateLightGroup,
1361
+ ot as calculateSensorGroup,
1362
+ on as countActiveEntities,
1363
+ Jt as defineWidget,
1364
+ yn as formatSchemaError,
1365
+ rn as getEntityAttribute,
1366
+ Pn as getForecasts,
1367
+ In as getStream,
1368
+ Ln as getWebRtcClientConfig,
1369
+ Pe as injectTokens,
1370
+ vn as isDark,
1371
+ at as isEntityActive,
1372
+ mn as monotoneCubicPath,
1373
+ Un as sendWebRtcCandidate,
1374
+ jn as startWebRtcSession,
1375
+ Bn as state,
1376
+ gn as svgColors,
1377
+ Fn as trackEntityHistory,
1378
+ Gn as untrackEntityHistory,
1379
+ Sn as useArea,
1380
+ Cn as useCamera,
1381
+ Mn as useConnection,
1382
+ Dn as useCurrency,
1383
+ Tn as useEntities,
1384
+ _n as useEntity,
1385
+ On as useEntityHistory,
1386
+ zn as useEntityStatistics,
1387
+ En as useForecast,
1388
+ Nn as useHassConfig,
1389
+ sn as useIntersectionPause,
1390
+ An as useLocale,
1391
+ ln as useReducedMotion,
1392
+ Zt as useService,
1393
+ Vn as useStore,
1394
+ Wn as useTemperatureUnit,
1395
+ nn as useToggle,
1396
+ tn as useTurnOff,
1397
+ en as useTurnOn,
1398
+ Rn as useUnitSystem,
1399
+ Qt as useWidgetContext,
1400
+ cn as useWidgetDialog,
1401
+ dn as useWidgetEntityGroup,
1402
+ un as useWidgetGestures,
1403
+ fn as widgetFields
1330
1404
  };