@glasshome/widget-sdk 1.6.1 → 1.8.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,16 +1,17 @@
1
- import { deprecate as e, deprecations as t, formatDeprecation as n } from "./deprecations.js";
2
- import { WidgetManifestSchema as r, formatSchemaError as i } from "./schemas.js";
3
- import { z as a, z as o } from "zod";
4
- import { getForecasts as s, getStream as c, getWebRtcClientConfig as l, hassMediaUrl as u, sendWebRtcCandidate as d, startWebRtcSession as f, state as p, trackEntityHistory as m, untrackEntityHistory as h } from "@glasshome/sync-layer";
5
- import { byDomain as g, useArea as _, useCamera as v, useConnection as ee, useCurrency as y, useEntities as b, useEntity as te, useEntityHistory as x, useEntityStatistics as ne, useForecast as re, useHassConfig as ie, useLocale as ae, useService as S, useStore as oe, useTemperatureUnit as se, useToggle as ce, useTurnOff as le, useTurnOn as ue, useUnitSystem as de } from "@glasshome/sync-layer/solid";
6
- import { Show as C, createContext as fe, createEffect as w, createMemo as T, createSignal as E, on as D, onCleanup as O, onMount as pe, splitProps as me, untrack as he, useContext as k } from "solid-js";
7
- import { addEventListener as A, className as j, createComponent as M, delegateEvents as ge, effect as N, insert as P, memo as F, setStyleProperty as I, style as _e, template as L, use as ve } from "solid-js/web";
1
+ import { n as e, r as t, t as n } from "./tokens-Bdfb1xYe.js";
2
+ import { deprecate as r, deprecations as i, formatDeprecation as a } from "./deprecations.js";
3
+ import { WidgetManifestSchema as o, formatSchemaError as s } from "./schemas.js";
4
+ import { z as c, z as l } from "zod";
5
+ import { getForecasts as u, getStream as d, getWebRtcClientConfig as f, hassMediaUrl as p, sendWebRtcCandidate as m, startWebRtcSession as h, state as g, trackEntityHistory as _, untrackEntityHistory as v } from "@glasshome/sync-layer";
6
+ import { byDomain as ee, useArea as y, useCamera as b, useConnection as te, useCurrency as x, useEntities as ne, useEntity as S, useEntityHistory as re, useEntityStatistics as ie, useForecast as C, useHassConfig as ae, useLocale as oe, useService as se, useStore as ce, useTemperatureUnit as le, useToggle as ue, useTurnOff as de, useTurnOn as fe, useUnitSystem as pe } from "@glasshome/sync-layer/solid";
7
+ import { Show as w, createEffect as T, createMemo as E, createSignal as D, on as O, onCleanup as k, onMount as me, splitProps as he, untrack as ge, useContext as A } from "solid-js";
8
+ import { addEventListener as j, className as M, createComponent as N, delegateEvents as _e, effect as P, insert as F, memo as I, setStyleProperty as L, style as R, template as z, use as ve } from "solid-js/web";
8
9
  import { clsx as ye } from "clsx";
9
10
  import { twMerge as be } from "tailwind-merge";
10
11
  //#region src/framework/to-form-schema.ts
11
12
  function xe(e) {
12
- return o.toJSONSchema(e, { override: (e) => {
13
- let t = o.globalRegistry.get(e.zodSchema);
13
+ return l.toJSONSchema(e, { override: (e) => {
14
+ let t = l.globalRegistry.get(e.zodSchema);
14
15
  return t && typeof t == "object" && Object.keys(t).length > 0 ? {
15
16
  ...e.jsonSchema,
16
17
  ...t
@@ -30,78 +31,50 @@ function Ce(e) {
30
31
  return e.configSchema && (e.manifest.schema || (e.manifest.schema = xe(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = Se(e.configSchema))), e;
31
32
  }
32
33
  //#endregion
33
- //#region src/framework/hooks/use-widget-context.ts
34
- var R = fe();
35
- function we() {
36
- let e = k(R);
37
- if (!e) throw Error("useWidgetContext must be used within a Widget component");
38
- return e;
39
- }
40
- //#endregion
41
34
  //#region src/framework/hooks/use-service.ts
42
- function Te(e) {
35
+ function we(e) {
43
36
  let t = Array.isArray(e) ? e[0] : e, n = t?.split(".")[0];
44
37
  if (!n) throw Error(`Invalid entity ID: ${String(t)}`);
45
38
  return n;
46
39
  }
47
- function z(e, t) {
48
- return (n, r = {}) => e(Te(n), t, r, { entity_id: n });
40
+ function B(e, t) {
41
+ return (n, r = {}) => e(we(n), t, r, { entity_id: n });
42
+ }
43
+ function Te() {
44
+ let t = A(e)?.callService;
45
+ return t ? {
46
+ callService: t,
47
+ turnOn: B(t, "turn_on"),
48
+ turnOff: B(t, "turn_off"),
49
+ toggle: B(t, "toggle")
50
+ } : se();
49
51
  }
50
52
  function Ee() {
51
- let e = k(R)?.callService;
52
- return e ? {
53
- callService: e,
54
- turnOn: z(e, "turn_on"),
55
- turnOff: z(e, "turn_off"),
56
- toggle: z(e, "toggle")
57
- } : S();
53
+ let t = A(e)?.callService;
54
+ return t ? B(t, "turn_on") : fe();
58
55
  }
59
56
  function De() {
60
- let e = k(R)?.callService;
61
- return e ? z(e, "turn_on") : ue();
57
+ let t = A(e)?.callService;
58
+ return t ? B(t, "turn_off") : de();
62
59
  }
63
60
  function Oe() {
64
- let e = k(R)?.callService;
65
- return e ? z(e, "turn_off") : le();
66
- }
67
- function ke() {
68
- let e = k(R)?.callService;
69
- return e ? z(e, "toggle") : ce();
61
+ let t = A(e)?.callService;
62
+ return t ? B(t, "toggle") : ue();
70
63
  }
71
64
  //#endregion
72
65
  //#region src/framework/design-system/z-index.ts
73
- var B = {
66
+ var V = {
74
67
  BACKGROUND: 0,
75
68
  CONTENT: 10,
76
69
  OVERLAY: 20,
77
70
  ACTIONS: 30
78
- }, Ae = "/* Authoritative SDK CSS contract. Injected once on first Widget mount\n * via framework/theming/tokens.ts.\n *\n * All widget-internal visual scale is driven from CSS custom properties +\n * container queries on the `.glasshome-widget` shell (`container-type: size`).\n * No JS classifier, no size tier enum.\n */\n\n:root {\n --tone-success: oklch(0.70 0.18 145);\n --tone-warning: oklch(0.80 0.17 75);\n --tone-danger: oklch(0.64 0.22 27);\n --tone-info: oklch(0.66 0.20 245);\n --tone-neutral: oklch(0.65 0.02 250);\n --tone-accent: oklch(0.74 0.18 60);\n\n --widget-grad-strength: 1;\n --widget-glow-default: 0.4;\n --widget-border-highlight: oklch(0.98 0 0 / 0.4);\n}\n\n.dark {\n --tone-success: oklch(0.74 0.18 145);\n --tone-warning: oklch(0.82 0.17 75);\n --tone-danger: oklch(0.68 0.22 27);\n --tone-info: oklch(0.70 0.20 245);\n --tone-neutral: oklch(0.69 0.02 250);\n --tone-accent: oklch(0.78 0.18 60);\n\n --widget-grad-strength: 1.1;\n --widget-glow-default: 0.5;\n --widget-border-highlight: oklch(1 0 0 / 0.08);\n}\n\n@property --widget-color {\n syntax: \"<color>\";\n inherits: true;\n initial-value: oklch(0.65 0.02 250);\n}\n\n/* === Widget shell ===\n * Fluid scale tokens — tied to the shell's own container box (cqb=height, cqi=width).\n * Icon/pad/gap track HEIGHT (cqb) not the shortest side: two widgets of equal\n * height match regardless of width (a 2×2 and a 4×2 get the same icon). cqmin\n * starved portrait tiles by pinning the icon to the narrow width. Tune\n * multipliers / clamps to adjust density. */\n.glasshome-widget {\n --widget-color: var(--tone-neutral);\n --widget-glow-strength: var(--widget-glow-default);\n\n --widget-icon-box: clamp(44px, 25cqb, 58px);\n --widget-icon-glyph: clamp(24px, 14cqb, 33px);\n --widget-pad: clamp(8px, 3.5cqb, 22px);\n --widget-gap: clamp(6px, 2cqb, 14px);\n --widget-title-size: clamp(12px, 2cqi, 18px);\n --widget-subtitle: clamp(12px, 2.5cqi, 20px);\n --widget-status-size: clamp(14px, 5cqi, 36px);\n --widget-value-size: clamp(18px, 7cqi, 48px);\n --widget-badge-size: clamp(11px, 1.6cqi, 14px);\n}\n\n.glasshome-widget {\n background: var(--widget-gradient,\n linear-gradient(135deg,\n color-mix(in oklch, var(--widget-color) calc(22% * var(--widget-grad-strength)), transparent),\n color-mix(in oklch, var(--widget-color-to, var(--widget-color)) calc(11% * var(--widget-grad-strength)), transparent)\n )\n );\n box-shadow: inset 0 1px 0 var(--widget-border-highlight);\n}\n\n/* === Slot: content layout === */\n/* Default: column. Flip to row only on wide-and-short widgets (matches the\n * old contentLayout heuristic: aspect > 1 AND height < 150px). */\n.glasshome-widget-content {\n position: relative;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n width: 100%;\n height: 100%;\n padding: var(--widget-pad);\n gap: var(--widget-gap);\n overflow: hidden;\n}\n@container widget (min-aspect-ratio: 1) and (max-height: 149px) {\n .glasshome-widget-content {\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n }\n}\n\n/* === Compact 1×1 ===\n * Small in BOTH axes → stack the tile: icon on top, label + status centered\n * under it. Icon stays moderate (not a hero) so the text keeps room. Wide\n * tiles (2×1) fail the width test and keep the row layout above. Placed after\n * the row-flip so it wins. */\n@container widget (max-width: 189px) and (max-height: 189px) {\n .glasshome-widget-content {\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: clamp(4px, 2.5cqmin, 8px);\n }\n .glasshome-widget-content > * { align-items: center; text-align: center; }\n .glasshome-widget-icon {\n --widget-icon-box: clamp(36px, 30cqmin, 56px);\n --widget-icon-glyph: clamp(20px, 17cqmin, 32px);\n }\n .glasshome-widget-title { font-size: clamp(11px, 6cqmin, 14px); max-width: 100%; }\n .glasshome-widget-status,\n .glasshome-widget-value { font-size: clamp(13px, 7cqmin, 17px); }\n .glasshome-widget-content [class*=\"ml-auto\"] { margin-left: 0 !important; }\n}\n.glasshome-widget-content [class*=\"ml-auto\"] {\n position: relative;\n z-index: 30;\n}\n\n/* === Slot: icon === */\n.glasshome-widget-icon {\n width: var(--widget-icon-box);\n height: var(--widget-icon-box);\n border-radius: var(--radius-sm, 12px);\n background: var(--widget-icon-color, var(--widget-color));\n box-shadow: 0 0 calc(var(--widget-glow-strength) * 30px)\n color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 50%, transparent);\n color: oklch(from var(--widget-icon-color, var(--widget-color)) calc(0.52 + sign(0.5 - l) * 0.43) calc(c * 0.2) h);\n}\n.glasshome-widget-icon-glyph {\n font-size: var(--widget-icon-glyph);\n line-height: 1;\n}\n.glasshome-widget-icon-stack {\n position: absolute;\n width: 102%;\n height: 102%;\n border-radius: var(--radius-sm, 12px);\n}\n.glasshome-widget-icon-stack-2 { bottom: -14%; right: -10%; opacity: 0.45; z-index: -2; }\n.glasshome-widget-icon-stack-3 { bottom: -28%; right: -20%; opacity: 0.20; z-index: -3; }\n\n/* === Slot: text === */\n.glasshome-widget-title {\n font-size: var(--widget-title-size);\n line-height: 1.2;\n color: color-mix(in oklch, var(--color-foreground, currentColor) 60%, transparent);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.glasshome-widget-subtitle {\n font-size: var(--widget-subtitle);\n color: color-mix(in oklch, var(--color-foreground, currentColor) 60%, transparent);\n}\n.glasshome-widget-status {\n font-size: var(--widget-status-size);\n font-weight: 700;\n color: var(--color-foreground, currentColor);\n line-height: 1.1;\n}\n.glasshome-widget-value {\n font-size: var(--widget-value-size);\n font-weight: 700;\n color: var(--color-foreground, currentColor);\n line-height: 1.05;\n}\n.glasshome-widget-badge {\n font-size: var(--widget-badge-size);\n font-weight: 500;\n padding: 0.125rem 0.5rem;\n border-radius: 9999px;\n background: color-mix(in oklch, var(--color-foreground, currentColor) 20%, transparent);\n color: var(--color-foreground, currentColor);\n}\n\n.glasshome-widget-loading {\n background: color-mix(in oklch, var(--widget-color) 20%, transparent);\n}\n\n/* === Slider fill ===\n * Value flows in via --widget-fill-value (0-100). Vertical orientation auto-\n * detected via container query. */\n.glasshome-widget-slider-fill {\n --widget-fill-value: 0;\n background: color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 30%, transparent);\n box-shadow: 0 0 calc(var(--widget-glow-strength) * 40px)\n color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 40%, transparent);\n clip-path: inset(0 calc((100 - var(--widget-fill-value)) * 1%) 0 0);\n}\n@container widget (max-aspect-ratio: 1) {\n .glasshome-widget-slider-fill {\n clip-path: inset(calc((100 - var(--widget-fill-value)) * 1%) 0 0 0);\n }\n}\n", je = !1, V, Me = /* @__PURE__ */ new WeakSet();
79
- function Ne() {
80
- return V || (V = new CSSStyleSheet(), V.replaceSync(Ae.replace(/:root\b/g, ":host").replace(/^\.dark\b/gm, ":host(.dark)"))), V;
81
- }
82
- function Pe(e) {
83
- if (typeof ShadowRoot < "u" && e instanceof ShadowRoot) {
84
- if (Me.has(e)) return;
85
- let t = Ne();
86
- e.adoptedStyleSheets.includes(t) || (e.adoptedStyleSheets = [...e.adoptedStyleSheets, t]), Me.add(e);
87
- return;
88
- }
89
- if (je) return;
90
- let t = e ?? (typeof document > "u" ? void 0 : document);
91
- if (!t) return;
92
- if (t.head.querySelector?.("style[data-glasshome-tokens]")) {
93
- je = !0;
94
- return;
95
- }
96
- let n = t.createElement("style");
97
- n.setAttribute("data-glasshome-tokens", ""), n.textContent = Ae, t.head.appendChild(n), je = !0;
98
- }
71
+ };
99
72
  //#endregion
100
73
  //#region src/framework/utils/cn.ts
101
74
  function H(...e) {
102
75
  return be(ye(e));
103
76
  }
104
- var Fe = {
77
+ var ke = {
105
78
  "classic-glass": {
106
79
  id: "classic-glass",
107
80
  name: "Classic Glass",
@@ -187,22 +160,22 @@ var Fe = {
187
160
  }
188
161
  }
189
162
  };
190
- function Ie(e) {
191
- return Fe[e];
163
+ function Ae(e) {
164
+ return ke[e];
192
165
  }
193
166
  //#endregion
194
167
  //#region src/framework/backgrounds/WidgetSliderFill.tsx
195
- var Le = /*#__PURE__*/ L("<div>");
196
- function Re(e) {
168
+ var je = /*#__PURE__*/ z("<div>");
169
+ function Me(e) {
197
170
  return (() => {
198
- var t = Le();
199
- return N((n) => {
171
+ var t = je();
172
+ return P((n) => {
200
173
  var r = H("glasshome-widget-slider-fill pointer-events-none absolute inset-0", e.isDragging ? "duration-0" : "transition-all duration-300 ease-out", e.class), i = {
201
174
  "--widget-fill-value": e.value,
202
- "z-index": B.BACKGROUND,
175
+ "z-index": V.BACKGROUND,
203
176
  ...e.color ? { "--widget-icon-color": e.color } : {}
204
177
  };
205
- return r !== n.e && j(t, n.e = r), n.t = _e(t, i, n.t), n;
178
+ return r !== n.e && M(t, n.e = r), n.t = R(t, i, n.t), n;
206
179
  }, {
207
180
  e: void 0,
208
181
  t: void 0
@@ -211,37 +184,37 @@ function Re(e) {
211
184
  }
212
185
  //#endregion
213
186
  //#region src/framework/components/WidgetContent.tsx
214
- var ze = /*#__PURE__*/ L("<div>");
215
- function Be(e) {
187
+ var Ne = /*#__PURE__*/ z("<div>");
188
+ function Pe(e) {
216
189
  return (() => {
217
- var t = ze();
218
- return P(t, () => e.children), N(() => j(t, H("glasshome-widget-content", e.class))), t;
190
+ var t = Ne();
191
+ return F(t, () => e.children), P(() => M(t, H("glasshome-widget-content", e.class))), t;
219
192
  })();
220
193
  }
221
194
  //#endregion
222
195
  //#region src/framework/components/WidgetIcon.tsx
223
- var Ve = /*#__PURE__*/ L("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-2\">"), He = /*#__PURE__*/ L("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-3\">"), Ue = /*#__PURE__*/ L("<div><div class=\"glasshome-widget-icon-glyph flex items-center justify-center\">");
224
- function We(e) {
196
+ var Fe = /*#__PURE__*/ z("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-2\">"), Ie = /*#__PURE__*/ z("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-3\">"), Le = /*#__PURE__*/ z("<div><div class=\"glasshome-widget-icon-glyph flex items-center justify-center\">");
197
+ function Re(e) {
225
198
  let t = () => e.entityCount ?? 1;
226
199
  return (() => {
227
- var n = Ue(), r = n.firstChild;
228
- return P(n, M(C, {
200
+ var n = Le(), r = n.firstChild;
201
+ return F(n, N(w, {
229
202
  get when() {
230
203
  return t() >= 2;
231
204
  },
232
205
  get children() {
233
- return Ve();
206
+ return Fe();
234
207
  }
235
- }), r), P(n, M(C, {
208
+ }), r), F(n, N(w, {
236
209
  get when() {
237
210
  return t() >= 3;
238
211
  },
239
212
  get children() {
240
- return He();
213
+ return Ie();
241
214
  }
242
- }), r), P(r, () => e.icon), N((t) => {
215
+ }), r), F(r, () => e.icon), P((t) => {
243
216
  var r = H("glasshome-widget-icon", "relative flex shrink-0 items-center justify-center pointer-events-none transition-all", e.dimmed && "opacity-50", e.class), i = e.color ? { "--widget-icon-color": e.color } : void 0;
244
- return r !== t.e && j(n, t.e = r), t.t = _e(n, i, t.t), t;
217
+ return r !== t.e && M(n, t.e = r), t.t = R(n, i, t.t), t;
245
218
  }, {
246
219
  e: void 0,
247
220
  t: void 0
@@ -250,16 +223,16 @@ function We(e) {
250
223
  }
251
224
  //#endregion
252
225
  //#region src/framework/components/WidgetStatus.tsx
253
- var Ge = /*#__PURE__*/ L("<p>");
254
- function Ke(e) {
226
+ var ze = /*#__PURE__*/ z("<p>");
227
+ function Be(e) {
255
228
  return (() => {
256
- var t = Ge();
257
- return P(t, (() => {
258
- var t = F(() => !!e.isUnavailable);
229
+ var t = ze();
230
+ return F(t, (() => {
231
+ var t = I(() => !!e.isUnavailable);
259
232
  return () => t() ? "Unavailable" : e.children;
260
- })()), N((n) => {
261
- var r = H("glasshome-widget-status", "relative", e.dimmed && "opacity-40", e.class), i = B.ACTIONS;
262
- return r !== n.e && j(t, n.e = r), i !== n.t && I(t, "z-index", n.t = i), n;
233
+ })()), P((n) => {
234
+ var r = H("glasshome-widget-status", "relative", e.dimmed && "opacity-40", e.class), i = V.ACTIONS;
235
+ return r !== n.e && M(t, n.e = r), i !== n.t && L(t, "z-index", n.t = i), n;
263
236
  }, {
264
237
  e: void 0,
265
238
  t: void 0
@@ -268,21 +241,21 @@ function Ke(e) {
268
241
  }
269
242
  //#endregion
270
243
  //#region src/framework/components/WidgetTitle.tsx
271
- var qe = /*#__PURE__*/ L("<span class=\"glasshome-widget-badge shrink-0\">"), Je = /*#__PURE__*/ L("<div><h3 class=glasshome-widget-title>");
272
- function Ye(e) {
244
+ var Ve = /*#__PURE__*/ z("<span class=\"glasshome-widget-badge shrink-0\">"), He = /*#__PURE__*/ z("<div><h3 class=glasshome-widget-title>");
245
+ function Ue(e) {
273
246
  return (() => {
274
- var t = Je(), n = t.firstChild;
275
- return P(n, () => e.children), P(t, M(C, {
247
+ var t = He(), n = t.firstChild;
248
+ return F(n, () => e.children), F(t, N(w, {
276
249
  get when() {
277
- return F(() => e.badge !== void 0)() && e.badge > 0;
250
+ return I(() => e.badge !== void 0)() && e.badge > 0;
278
251
  },
279
252
  get children() {
280
- var t = qe();
281
- return P(t, () => e.badge), t;
253
+ var t = Ve();
254
+ return F(t, () => e.badge), t;
282
255
  }
283
- }), null), N((n) => {
284
- var r = H("relative flex items-center gap-2", e.class), i = B.ACTIONS;
285
- return r !== n.e && j(t, n.e = r), i !== n.t && I(t, "z-index", n.t = i), n;
256
+ }), null), P((n) => {
257
+ var r = H("relative flex items-center gap-2", e.class), i = V.ACTIONS;
258
+ return r !== n.e && M(t, n.e = r), i !== n.t && L(t, "z-index", n.t = i), n;
286
259
  }, {
287
260
  e: void 0,
288
261
  t: void 0
@@ -291,7 +264,7 @@ function Ye(e) {
291
264
  }
292
265
  //#endregion
293
266
  //#region src/framework/utils/entity-aggregation.ts
294
- function Xe(e, t = !1) {
267
+ function We(e, t = !1) {
295
268
  if (e.length === 0) return {
296
269
  isGroup: !1,
297
270
  state: "unknown",
@@ -314,7 +287,7 @@ function Xe(e, t = !1) {
314
287
  isUnavailable: t.state === "unavailable",
315
288
  brightness: r,
316
289
  brightnessPercent: i,
317
- color: $e(t),
290
+ color: qe(t),
318
291
  onCount: +!!n,
319
292
  totalCount: 1,
320
293
  description: n ? "On" : "Off"
@@ -326,7 +299,7 @@ function Xe(e, t = !1) {
326
299
  if (r++, t.attributes?.brightness !== void 0 && (s += t.attributes.brightness, c++), t.attributes?.rgb_color) l.push(t.attributes.rgb_color);
327
300
  else if (t.attributes?.hs_color) {
328
301
  let [e, n] = t.attributes.hs_color;
329
- l.push(Qe(e, n));
302
+ l.push(Ke(e, n));
330
303
  }
331
304
  break;
332
305
  case "off":
@@ -345,7 +318,7 @@ function Xe(e, t = !1) {
345
318
  if (l.length > 0) {
346
319
  let e = Math.round(l.reduce((e, t) => e + t[0], 0) / l.length), t = Math.round(l.reduce((e, t) => e + t[1], 0) / l.length), n = Math.round(l.reduce((e, t) => e + t[2], 0) / l.length), r = v / 255;
347
320
  y = `rgb(${Math.round(e * r)}, ${Math.round(t * r)}, ${Math.round(n * r)})`;
348
- } else y = $e(e[0]);
321
+ } else y = qe(e[0]);
349
322
  let b;
350
323
  return b = m ? "All on" : h ? "All off" : r > 0 ? `${r} of ${u} on` : "Off", {
351
324
  isGroup: n,
@@ -360,7 +333,7 @@ function Xe(e, t = !1) {
360
333
  description: b
361
334
  };
362
335
  }
363
- function Ze(e, t = "mean", n = !0) {
336
+ function Ge(e, t = "mean", n = !0) {
364
337
  if (e.length === 0) return {
365
338
  isGroup: !1,
366
339
  state: "unknown",
@@ -456,7 +429,7 @@ function Ze(e, t = "mean", n = !0) {
456
429
  memberValues: a
457
430
  };
458
431
  }
459
- function Qe(e, t) {
432
+ function Ke(e, t) {
460
433
  let n = t / 100, r = n * (1 - Math.abs(e / 60 % 2 - 1)), i = 1 - n, a = 0, o = 0, s = 0;
461
434
  return e < 60 ? [a, o] = [n, r] : e < 120 ? [a, o] = [r, n] : e < 180 ? [o, s] = [n, r] : e < 240 ? [o, s] = [r, n] : e < 300 ? [a, s] = [r, n] : [a, s] = [n, r], [
462
435
  (a + i) * 255,
@@ -464,7 +437,7 @@ function Qe(e, t) {
464
437
  (s + i) * 255
465
438
  ];
466
439
  }
467
- function $e(e) {
440
+ function qe(e) {
468
441
  if (e.state !== "on") return "rgb(100, 100, 100)";
469
442
  let t = (e.attributes?.brightness ?? 255) / 255;
470
443
  if (e.attributes?.rgb_color) {
@@ -472,7 +445,7 @@ function $e(e) {
472
445
  return `rgb(${Math.round(n * t)}, ${Math.round(r * t)}, ${Math.round(i * t)})`;
473
446
  }
474
447
  if (e.attributes?.hs_color) {
475
- let [n, r] = e.attributes.hs_color, [i, a, o] = Qe(n, r);
448
+ let [n, r] = e.attributes.hs_color, [i, a, o] = Ke(n, r);
476
449
  return `rgb(${Math.round(i * t)}, ${Math.round(a * t)}, ${Math.round(o * t)})`;
477
450
  }
478
451
  if (e.attributes?.color_temp) {
@@ -483,7 +456,7 @@ function $e(e) {
483
456
  }
484
457
  //#endregion
485
458
  //#region src/framework/utils/entity-state.ts
486
- function et(e) {
459
+ function Je(e) {
487
460
  if (!e) return !1;
488
461
  if ([
489
462
  "on",
@@ -499,15 +472,15 @@ function et(e) {
499
472
  }
500
473
  return !1;
501
474
  }
502
- function tt(e, t, n) {
475
+ function Ye(e, t, n) {
503
476
  return e?.attributes ? e.attributes[t] ?? n : n;
504
477
  }
505
- function nt(e) {
506
- return e.filter(et).length;
478
+ function Xe(e) {
479
+ return e.filter(Je).length;
507
480
  }
508
481
  //#endregion
509
482
  //#region src/framework/utils/format-value.ts
510
- function rt(e, t, n) {
483
+ function Ze(e, t, n) {
511
484
  let { decimals: r, scale: i = !0 } = n || {};
512
485
  if (typeof e == "string") return t ? `${e}${t}` : e;
513
486
  if (e == null || Number.isNaN(e)) return t ? `--${t}` : "--";
@@ -518,41 +491,41 @@ function rt(e, t, n) {
518
491
  }
519
492
  //#endregion
520
493
  //#region src/framework/utils/interpret-value.ts
521
- function it(e, t) {
494
+ function Qe(e, t) {
522
495
  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;
523
496
  }
524
497
  //#endregion
525
498
  //#region src/framework/components/WidgetValue.tsx
526
- var at = /*#__PURE__*/ L("<div class=glasshome-widget-subtitle>"), ot = /*#__PURE__*/ L("<div><div class=glasshome-widget-value>");
527
- function st(e) {
499
+ var $e = /*#__PURE__*/ z("<div class=glasshome-widget-subtitle>"), et = /*#__PURE__*/ z("<div><div class=glasshome-widget-value>");
500
+ function tt(e) {
528
501
  return (() => {
529
- var t = ot(), n = t.firstChild;
530
- return P(n, () => rt(e.value, e.unit)), P(t, M(C, {
502
+ var t = et(), n = t.firstChild;
503
+ return F(n, () => Ze(e.value, e.unit)), F(t, N(w, {
531
504
  get when() {
532
- return F(() => !!e.interpret)() && typeof e.value == "number";
505
+ return I(() => !!e.interpret)() && typeof e.value == "number";
533
506
  },
534
507
  get children() {
535
- var t = at();
536
- return P(t, () => it(e.value, e.unit)), t;
508
+ var t = $e();
509
+ return F(t, () => Qe(e.value, e.unit)), t;
537
510
  }
538
- }), null), N(() => j(t, H("flex flex-col", e.class))), t;
511
+ }), null), P(() => M(t, H("flex flex-col", e.class))), t;
539
512
  })();
540
513
  }
541
514
  //#endregion
542
515
  //#region src/framework/core/Widget.tsx
543
- var ct = /*#__PURE__*/ L("<div><div class=\"relative h-full w-full\">"), lt = /*#__PURE__*/ L("<div class=\"glasshome-widget-loading pointer-events-none absolute inset-0 animate-pulse\">"), ut = /*#__PURE__*/ L("<div class=\"flex h-full w-full flex-col items-center justify-center gap-2 text-center\">"), dt = /*#__PURE__*/ L("<div class=\"flex items-center justify-center text-white/30\">"), ft = /*#__PURE__*/ L("<h3 class=\"font-semibold text-sm text-white/60\">"), pt = /*#__PURE__*/ L("<p class=\"text-white/50 text-xs\">");
544
- function mt(e) {
545
- let t = k(R), [n, r] = E(), [i, a] = E({
516
+ var nt = /*#__PURE__*/ z("<div><div class=\"relative h-full w-full\">"), rt = /*#__PURE__*/ z("<div class=\"glasshome-widget-loading pointer-events-none absolute inset-0 animate-pulse\">"), it = /*#__PURE__*/ z("<div class=\"flex h-full w-full flex-col items-center justify-center gap-2 text-center\">"), at = /*#__PURE__*/ z("<div class=\"flex items-center justify-center text-white/30\">"), ot = /*#__PURE__*/ z("<h3 class=\"font-semibold text-sm text-white/60\">"), st = /*#__PURE__*/ z("<p class=\"text-white/50 text-xs\">");
517
+ function ct(t) {
518
+ let r = A(e), [i, a] = D(), [o, s] = D({
546
519
  width: 0,
547
520
  height: 0
548
521
  });
549
- w(() => {
550
- let e = n();
522
+ T(() => {
523
+ let e = i();
551
524
  if (!e) return;
552
525
  let t = new ResizeObserver(([e]) => {
553
526
  if (!e) return;
554
527
  let t = e.borderBoxSize?.[0];
555
- a(t ? {
528
+ s(t ? {
556
529
  width: t.inlineSize,
557
530
  height: t.blockSize
558
531
  } : {
@@ -560,131 +533,131 @@ function mt(e) {
560
533
  height: e.contentRect.height
561
534
  });
562
535
  });
563
- t.observe(e), O(() => t.disconnect());
564
- }), pe(() => {
565
- let e = n()?.getRootNode();
566
- Pe(typeof ShadowRoot < "u" && e instanceof ShadowRoot || typeof Document < "u" && e instanceof Document ? e : void 0);
536
+ t.observe(e), k(() => t.disconnect());
537
+ }), me(() => {
538
+ let e = i()?.getRootNode();
539
+ n(typeof ShadowRoot < "u" && e instanceof ShadowRoot || typeof Document < "u" && e instanceof Document ? e : void 0);
567
540
  });
568
- let o = {
569
- isEditMode: () => e.isEditMode ?? !1,
570
- updateConfig: t?.updateConfig ?? (() => {}),
571
- registerDialogOpener: t?.registerDialogOpener,
572
- callService: t?.callService,
573
- dimensions: () => i()
574
- }, s = T(() => {
575
- if (e.variant) return typeof e.variant == "string" ? Ie(e.variant) : e.variant;
576
- }), c = T(() => ({
541
+ let c = {
542
+ isEditMode: () => t.isEditMode ?? !1,
543
+ updateConfig: r?.updateConfig ?? (() => {}),
544
+ registerDialogOpener: r?.registerDialogOpener,
545
+ callService: r?.callService,
546
+ dimensions: () => o()
547
+ }, l = E(() => {
548
+ if (t.variant) return typeof t.variant == "string" ? Ae(t.variant) : t.variant;
549
+ }), u = E(() => ({
577
550
  "container-type": "size",
578
551
  "container-name": "widget",
579
- "touch-action": e.gestures && !e.isEditMode ? e.gestures.touchAction() : void 0,
580
- ...s()?.styles?.container,
581
- ...s()?.styles?.cssVars || {},
582
- ...e.tone ? { "--widget-color": `var(--tone-${e.tone})` } : {},
583
- ...e.color ? { "--widget-color": e.color } : {},
584
- ...e.colorTo ? { "--widget-color-to": e.colorTo } : {},
585
- ...e.gradient ? { "--widget-gradient": e.gradient } : {}
586
- })), l = () => !!e.gestures && !e.isEditMode, u = (t) => {
587
- l() && e.gestures?.onPointerEnter(t);
588
- }, d = (t) => {
589
- l() && e.gestures?.onPointerDown(t);
590
- }, f = (t) => {
591
- l() && e.gestures?.onPointerMove(t);
592
- }, p = (t) => {
593
- l() && e.gestures?.onPointerUp(t);
594
- }, m = (t) => {
595
- l() && e.gestures?.onPointerCancel(t);
552
+ "touch-action": t.gestures && !t.isEditMode ? t.gestures.touchAction() : void 0,
553
+ ...l()?.styles?.container,
554
+ ...l()?.styles?.cssVars || {},
555
+ ...t.tone ? { "--widget-color": `var(--tone-${t.tone})` } : {},
556
+ ...t.color ? { "--widget-color": t.color } : {},
557
+ ...t.colorTo ? { "--widget-color-to": t.colorTo } : {},
558
+ ...t.gradient ? { "--widget-gradient": t.gradient } : {}
559
+ })), d = () => !!t.gestures && !t.isEditMode, f = (e) => {
560
+ d() && t.gestures?.onPointerEnter(e);
561
+ }, p = (e) => {
562
+ d() && t.gestures?.onPointerDown(e);
563
+ }, m = (e) => {
564
+ d() && t.gestures?.onPointerMove(e);
565
+ }, h = (e) => {
566
+ d() && t.gestures?.onPointerUp(e);
567
+ }, g = (e) => {
568
+ d() && t.gestures?.onPointerCancel(e);
596
569
  };
597
- return M(R.Provider, {
598
- value: o,
570
+ return N(e.Provider, {
571
+ value: c,
599
572
  get children() {
600
- var t = ct(), n = t.firstChild;
601
- return A(t, "pointercancel", m), A(t, "pointerup", p), A(t, "pointermove", f), A(t, "pointerdown", d), A(t, "pointerenter", u), ve((t) => {
602
- r(t), e.gestures?.bindElement(t);
603
- }, t), P(n, (() => {
604
- var t = F(() => !!e.emptyState);
605
- return () => t() ? M(ht, {
573
+ var e = nt(), n = e.firstChild;
574
+ return j(e, "pointercancel", g), j(e, "pointerup", h), j(e, "pointermove", m), j(e, "pointerdown", p), j(e, "pointerenter", f), ve((e) => {
575
+ a(e), t.gestures?.bindElement(e);
576
+ }, e), F(n, (() => {
577
+ var e = I(() => !!t.emptyState);
578
+ return () => e() ? N(lt, {
606
579
  get icon() {
607
- return e.emptyState.icon;
580
+ return t.emptyState.icon;
608
581
  },
609
582
  get title() {
610
- return e.emptyState.title;
583
+ return t.emptyState.title;
611
584
  },
612
585
  get message() {
613
- return e.emptyState.message;
586
+ return t.emptyState.message;
614
587
  }
615
- }) : e.children;
616
- })()), P(t, (() => {
617
- var t = F(() => !!e.loading);
618
- return () => t() && (() => {
619
- var e = lt();
620
- return N((t) => I(e, "z-index", B.OVERLAY)), e;
588
+ }) : t.children;
589
+ })()), F(e, (() => {
590
+ var e = I(() => !!t.loading);
591
+ return () => e() && (() => {
592
+ var e = rt();
593
+ return P((t) => L(e, "z-index", V.OVERLAY)), e;
621
594
  })();
622
- })(), null), N((r) => {
623
- var i = H("glasshome-widget", "relative h-full w-full select-none overflow-hidden rounded-xl border border-border/50", s()?.styles?.class, e.class), a = c(), o = B.CONTENT;
624
- return i !== r.e && j(t, r.e = i), r.t = _e(t, a, r.t), o !== r.a && I(n, "z-index", r.a = o), r;
595
+ })(), null), P((r) => {
596
+ var i = H("glasshome-widget", "relative h-full w-full select-none overflow-hidden rounded-xl border border-border/50", l()?.styles?.class, t.class), a = u(), o = V.CONTENT;
597
+ return i !== r.e && M(e, r.e = i), r.t = R(e, a, r.t), o !== r.a && L(n, "z-index", r.a = o), r;
625
598
  }, {
626
599
  e: void 0,
627
600
  t: void 0,
628
601
  a: void 0
629
- }), t;
602
+ }), e;
630
603
  }
631
604
  });
632
605
  }
633
- function ht(e) {
606
+ function lt(e) {
634
607
  return (() => {
635
- var t = ut();
636
- return P(t, (() => {
637
- var t = F(() => !!e.icon);
608
+ var t = it();
609
+ return F(t, (() => {
610
+ var t = I(() => !!e.icon);
638
611
  return () => t() && (() => {
639
- var t = dt();
640
- return P(t, () => e.icon), t;
612
+ var t = at();
613
+ return F(t, () => e.icon), t;
641
614
  })();
642
- })(), null), P(t, (() => {
643
- var t = F(() => !!e.title);
615
+ })(), null), F(t, (() => {
616
+ var t = I(() => !!e.title);
644
617
  return () => t() && (() => {
645
- var t = ft();
646
- return P(t, () => e.title), t;
618
+ var t = ot();
619
+ return F(t, () => e.title), t;
647
620
  })();
648
- })(), null), P(t, (() => {
649
- var t = F(() => !!e.message);
621
+ })(), null), F(t, (() => {
622
+ var t = I(() => !!e.message);
650
623
  return () => t() && (() => {
651
- var t = pt();
652
- return P(t, () => e.message), t;
624
+ var t = st();
625
+ return F(t, () => e.message), t;
653
626
  })();
654
627
  })(), null), t;
655
628
  })();
656
629
  }
657
- var U = mt;
658
- U.Content = Be, U.Icon = We, U.Title = Ye, U.Status = Ke, U.Value = st, U.SliderFill = Re;
630
+ var U = ct;
631
+ U.Content = Pe, U.Icon = Re, U.Title = Ue, U.Status = Be, U.Value = tt, U.SliderFill = Me;
659
632
  //#endregion
660
633
  //#region src/framework/dialogs/WidgetDialog.tsx
661
- var gt = /*#__PURE__*/ L("<span class=\"inline-flex size-3.5 shrink-0 items-center\">"), _t = /*#__PURE__*/ L("<button type=button>"), vt = /*#__PURE__*/ L("<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\">"), yt = /*#__PURE__*/ L("<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"), bt = /*#__PURE__*/ L("<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>"), xt = /*#__PURE__*/ L("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No additional controls"), St = /*#__PURE__*/ L("<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\">"), Ct = /*#__PURE__*/ L("<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"), wt = /*#__PURE__*/ L("<div class=\"min-w-0 shrink-0\">"), Tt = /*#__PURE__*/ L("<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\">"), Et = /*#__PURE__*/ L("<div class=\"gh-scroll min-h-0 flex-1 overflow-y-auto px-6\">"), Dt = /*#__PURE__*/ L("<div class=\"flex shrink-0 items-center justify-end gap-2 border-border/50 border-t px-6 pt-3\">");
662
- function Ot(e) {
634
+ var ut = /*#__PURE__*/ z("<span class=\"inline-flex size-3.5 shrink-0 items-center\">"), dt = /*#__PURE__*/ z("<button type=button>"), ft = /*#__PURE__*/ z("<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\">"), pt = /*#__PURE__*/ z("<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__*/ z("<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>"), ht = /*#__PURE__*/ z("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No additional controls"), gt = /*#__PURE__*/ z("<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\">"), _t = /*#__PURE__*/ z("<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"), vt = /*#__PURE__*/ z("<div class=\"min-w-0 shrink-0\">"), yt = /*#__PURE__*/ z("<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\">"), bt = /*#__PURE__*/ z("<div class=\"gh-scroll min-h-0 flex-1 overflow-y-auto px-6\">"), xt = /*#__PURE__*/ z("<div class=\"flex shrink-0 items-center justify-end gap-2 border-border/50 border-t px-6 pt-3\">");
635
+ function St(e) {
663
636
  return (() => {
664
- var t = _t();
665
- return t.$$click = () => e.onClick(), P(t, M(C, {
637
+ var t = dt();
638
+ return t.$$click = () => e.onClick(), F(t, N(w, {
666
639
  get when() {
667
640
  return e.isActive;
668
641
  },
669
642
  get children() {
670
- var t = gt();
671
- return P(t, () => e.icon), t;
643
+ var t = ut();
644
+ return F(t, () => e.icon), t;
672
645
  }
673
- }), null), P(t, () => e.label, null), N(() => j(t, H("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;
646
+ }), null), F(t, () => e.label, null), P(() => M(t, H("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;
674
647
  })();
675
648
  }
676
- function kt(e) {
677
- let [t] = me(e, /* @__PURE__ */ "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".split(".")), n = () => !!t.configSchema && !!t.config && !!t.onConfigSave && !!t.SchemaForm, [r, i] = E({}), [a, o] = E(null);
678
- w(D(() => t.config, (e) => {
649
+ function Ct(e) {
650
+ let [t] = he(e, /* @__PURE__ */ "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".split(".")), n = () => !!t.configSchema && !!t.config && !!t.onConfigSave && !!t.SchemaForm, [r, i] = D({}), [a, o] = D(null);
651
+ T(O(() => t.config, (e) => {
679
652
  e && i({ ...e });
680
- })), w(D(() => t.configSchema, (e) => {
653
+ })), T(O(() => t.configSchema, (e) => {
681
654
  e && o(xe(e));
682
655
  }));
683
656
  let s = () => n() && JSON.stringify(r()) !== JSON.stringify(t.config), c = (e) => {
684
657
  !e && t.config && i({ ...t.config }), t.onOpenChange(e);
685
658
  }, l = () => {
686
659
  t.onConfigSave?.(r());
687
- }, [u, d] = E(t.defaultTab ?? "controls"), f = () => t.activeTab ?? u(), p = (e) => {
660
+ }, [u, d] = D(t.defaultTab ?? "controls"), f = () => t.activeTab ?? u(), p = (e) => {
688
661
  t.onActiveTabChange ? t.onActiveTabChange(e) : d(e);
689
662
  }, m = () => ({
690
663
  sm: "max-w-sm",
@@ -700,26 +673,26 @@ function kt(e) {
700
673
  return e.push({
701
674
  id: "edit",
702
675
  label: "Edit",
703
- icon: vt(),
704
- content: t.editContent ?? (n() && a() ? M(ne, {
676
+ icon: ft(),
677
+ content: t.editContent ?? (n() && a() ? N(ne, {
705
678
  get schema() {
706
679
  return a();
707
680
  },
708
681
  get data() {
709
- return he(r);
682
+ return ge(r);
710
683
  },
711
684
  onChange: i
712
- }) : yt())
685
+ }) : pt())
713
686
  }), e.push({
714
687
  id: "controls",
715
688
  label: "Controls",
716
- icon: bt(),
717
- content: t.controlsContent ?? xt()
689
+ icon: mt(),
690
+ content: t.controlsContent ?? ht()
718
691
  }), e.push({
719
692
  id: "debug",
720
693
  label: "Debug",
721
- icon: St(),
722
- content: t.debugContent ?? Ct()
694
+ icon: gt(),
695
+ content: t.debugContent ?? _t()
723
696
  }), e;
724
697
  }, g = async () => {
725
698
  if (t.debugData !== void 0) try {
@@ -727,43 +700,43 @@ function kt(e) {
727
700
  await navigator.clipboard.writeText(e);
728
701
  } catch {}
729
702
  }, _ = () => {
730
- let e = re();
703
+ let e = S();
731
704
  return e.find((e) => e.id === f())?.content ?? e[0]?.content;
732
- }, v = t.ResponsiveDialog, ee = t.ResponsiveDialogContent, y = t.ResponsiveDialogHeader, b = t.ResponsiveDialogTitle, te = t.ResponsiveDialogDescription, x = t.Button, ne = t.SchemaForm, re = T(D([
705
+ }, v = t.ResponsiveDialog, ee = t.ResponsiveDialogContent, y = t.ResponsiveDialogHeader, b = t.ResponsiveDialogTitle, te = t.ResponsiveDialogDescription, x = t.Button, ne = t.SchemaForm, S = E(O([
733
706
  () => t.open,
734
707
  a,
735
708
  () => t.config,
736
709
  () => t.tabs
737
- ], () => h())), ie = (e) => n() ? c(e) : t.onOpenChange(e), ae = () => n() ? s() : t.hasUnsavedChanges, S = () => n() ? l : t.onSave;
738
- return M(v, {
710
+ ], () => h())), re = (e) => n() ? c(e) : t.onOpenChange(e), ie = () => n() ? s() : t.hasUnsavedChanges, C = () => n() ? l : t.onSave;
711
+ return N(v, {
739
712
  get open() {
740
713
  return t.open;
741
714
  },
742
- onOpenChange: (e) => ie(e),
715
+ onOpenChange: (e) => re(e),
743
716
  get children() {
744
- return M(ee, {
717
+ return N(ee, {
745
718
  get class() {
746
719
  return H(m(), "px-0", t.class);
747
720
  },
748
721
  get children() {
749
722
  return [
750
- M(y, {
723
+ N(y, {
751
724
  class: "flex flex-row items-center justify-between gap-3 px-6",
752
725
  get children() {
753
726
  return [(() => {
754
- var e = wt();
755
- return P(e, M(b, {
727
+ var e = vt();
728
+ return F(e, N(b, {
756
729
  class: "truncate leading-tight",
757
730
  get children() {
758
731
  return t.title;
759
732
  }
760
- }), null), P(e, M(te, {
733
+ }), null), F(e, N(te, {
761
734
  class: "sr-only",
762
735
  children: "Widget configuration dialog"
763
736
  }), null), e;
764
737
  })(), (() => {
765
- var e = Tt(), n = e.firstChild;
766
- return P(n, () => re().map((e) => M(Ot, {
738
+ var e = yt(), n = e.firstChild;
739
+ return F(n, () => S().map((e) => N(St, {
767
740
  get icon() {
768
741
  return e.icon;
769
742
  },
@@ -774,7 +747,7 @@ function kt(e) {
774
747
  return f() === e.id;
775
748
  },
776
749
  onClick: () => p(e.id)
777
- }))), P(e, M(C, {
750
+ }))), F(e, N(w, {
778
751
  get when() {
779
752
  return t.headerActions;
780
753
  },
@@ -786,47 +759,47 @@ function kt(e) {
786
759
  }
787
760
  }),
788
761
  (() => {
789
- var e = Et();
790
- return P(e, _), e;
762
+ var e = bt();
763
+ return F(e, _), e;
791
764
  })(),
792
- M(C, {
765
+ N(w, {
793
766
  get when() {
794
- return F(() => f() === "edit")() && (S() || t.onDelete) || f() === "debug" && t.debugData !== void 0;
767
+ return I(() => f() === "edit")() && (C() || t.onDelete) || f() === "debug" && t.debugData !== void 0;
795
768
  },
796
769
  get children() {
797
- var e = Dt();
798
- return P(e, M(C, {
770
+ var e = xt();
771
+ return F(e, N(w, {
799
772
  get when() {
800
- return F(() => f() === "edit")() && t.onDelete;
773
+ return I(() => f() === "edit")() && t.onDelete;
801
774
  },
802
775
  get children() {
803
- return M(x, {
776
+ return N(x, {
804
777
  size: "sm",
805
778
  variant: "destructive",
806
779
  onClick: () => t.onDelete?.(),
807
780
  children: "Delete"
808
781
  });
809
782
  }
810
- }), null), P(e, M(C, {
783
+ }), null), F(e, N(w, {
811
784
  get when() {
812
- return F(() => f() === "edit")() && S();
785
+ return I(() => f() === "edit")() && C();
813
786
  },
814
787
  get children() {
815
- return M(x, {
788
+ return N(x, {
816
789
  size: "sm",
817
790
  get disabled() {
818
- return !ae();
791
+ return !ie();
819
792
  },
820
- onClick: () => S()?.(),
793
+ onClick: () => C()?.(),
821
794
  children: "Save"
822
795
  });
823
796
  }
824
- }), null), P(e, M(C, {
797
+ }), null), F(e, N(w, {
825
798
  get when() {
826
- return F(() => f() === "debug")() && t.debugData !== void 0;
799
+ return I(() => f() === "debug")() && t.debugData !== void 0;
827
800
  },
828
801
  get children() {
829
- return M(x, {
802
+ return N(x, {
830
803
  size: "sm",
831
804
  variant: "outline",
832
805
  onClick: g,
@@ -842,63 +815,63 @@ function kt(e) {
842
815
  }
843
816
  });
844
817
  }
845
- ge(["click"]);
818
+ _e(["click"]);
846
819
  //#endregion
847
820
  //#region src/framework/hooks/use-intersection-pause.ts
848
- function At(e) {
821
+ function wt(e) {
849
822
  if (typeof IntersectionObserver > "u") return () => !1;
850
- let [t, n] = E(!1), r = new IntersectionObserver((e) => {
823
+ let [t, n] = D(!1), r = new IntersectionObserver((e) => {
851
824
  let t = e[0];
852
825
  t && n(!t.isIntersecting);
853
826
  });
854
- return w(() => {
827
+ return T(() => {
855
828
  let t = e();
856
829
  r.disconnect(), t && r.observe(t);
857
- }), O(() => r.disconnect()), t;
830
+ }), k(() => r.disconnect()), t;
858
831
  }
859
832
  //#endregion
860
833
  //#region src/framework/hooks/use-reduced-motion.ts
861
- function jt() {
834
+ function Tt() {
862
835
  if (typeof window > "u" || typeof window.matchMedia != "function") return () => !1;
863
- let e = window.matchMedia("(prefers-reduced-motion: reduce)"), [t, n] = E(e.matches), r = (e) => n(e.matches);
864
- return e.addEventListener("change", r), O(() => e.removeEventListener("change", r)), t;
836
+ let e = window.matchMedia("(prefers-reduced-motion: reduce)"), [t, n] = D(e.matches), r = (e) => n(e.matches);
837
+ return e.addEventListener("change", r), k(() => e.removeEventListener("change", r)), t;
865
838
  }
866
839
  //#endregion
867
840
  //#region src/framework/hooks/use-widget-dialog.ts
868
- function Mt(e = "controls") {
869
- let [t, n] = E(!1), [r, i] = E(e), a = (t) => {
870
- i(t ?? e), n(!0);
871
- }, o = k(R);
872
- return o?.registerDialogOpener?.(a), O(() => o?.registerDialogOpener?.(null)), {
873
- showDialog: t,
874
- setShowDialog: n,
875
- openDialog: a,
876
- closeDialog: () => n(!1),
877
- activeTab: r,
878
- setActiveTab: i,
841
+ function Et(t = "controls") {
842
+ let [n, r] = D(!1), [i, a] = D(t), o = (e) => {
843
+ a(e ?? t), r(!0);
844
+ }, s = A(e);
845
+ return s?.registerDialogOpener?.(o), k(() => s?.registerDialogOpener?.(null)), {
846
+ showDialog: n,
847
+ setShowDialog: r,
848
+ openDialog: o,
849
+ closeDialog: () => r(!1),
850
+ activeTab: i,
851
+ setActiveTab: a,
879
852
  dialogProps: {
880
853
  get open() {
881
- return t();
854
+ return n();
882
855
  },
883
- onOpenChange: n,
856
+ onOpenChange: r,
884
857
  get activeTab() {
885
- return r();
858
+ return i();
886
859
  },
887
- onActiveTabChange: i
860
+ onActiveTabChange: a
888
861
  }
889
862
  };
890
863
  }
891
864
  //#endregion
892
865
  //#region src/framework/hooks/use-widget-entity-group.ts
893
- function Nt(e) {
894
- let t = e.minEntities ?? 1, n = T(() => e.entities().length), r = T(() => n() >= t), i = T(() => !r() || !e.calculateGroupData ? null : e.calculateGroupData(e.entities())), a = T(() => {
866
+ function Dt(e) {
867
+ let t = e.minEntities ?? 1, n = E(() => e.entities().length), r = E(() => n() >= t), i = E(() => !r() || !e.calculateGroupData ? null : e.calculateGroupData(e.entities())), a = E(() => {
895
868
  if (!r()) return;
896
869
  let t = e.aggregationMode?.();
897
870
  if (!t || t === "none") return;
898
871
  let n = e.entities();
899
- if (t === "light" || t === "binary-sensor" || t === "switch") return Xe(n, e.allEntitiesMode);
900
- if (t === "sensor") return Ze(n, e.sensorGroupType?.() ?? "mean", !0);
901
- }), o = T(() => r() ? void 0 : e.emptyStateConfig);
872
+ if (t === "light" || t === "binary-sensor" || t === "switch") return We(n, e.allEntitiesMode);
873
+ if (t === "sensor") return Ge(n, e.sensorGroupType?.() ?? "mean", !0);
874
+ }), o = E(() => r() ? void 0 : e.emptyStateConfig);
902
875
  return {
903
876
  entities: e.entities,
904
877
  groupData: i,
@@ -911,13 +884,13 @@ function Nt(e) {
911
884
  //#endregion
912
885
  //#region src/framework/gestures/cursors.ts
913
886
  var W = 32, G = W / 2, K = "white", q = "rgba(0,0,0,0.4)", J = 2, Y = 3;
914
- function Pt(e) {
887
+ function Ot(e) {
915
888
  return `url("data:image/svg+xml,${encodeURIComponent(e)}")`;
916
889
  }
917
890
  function X(e) {
918
891
  return `<svg xmlns="http://www.w3.org/2000/svg" width="${W}" height="${W}" viewBox="0 0 ${W} ${W}">${e}</svg>`;
919
892
  }
920
- var Ft = X(`
893
+ var kt = X(`
921
894
  <g transform="translate(6, 2)">
922
895
  <!-- shadow -->
923
896
  <g stroke="${q}" stroke-width="${Y}" fill="none" stroke-linecap="round" stroke-linejoin="round">
@@ -928,13 +901,13 @@ var Ft = X(`
928
901
  <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"/>
929
902
  </g>
930
903
  </g>
931
- `), It = X(`
904
+ `), At = X(`
932
905
  <g>
933
906
  <circle cx="${G}" cy="${G}" r="8" stroke="${q}" stroke-width="${Y}" fill="none"/>
934
907
  <circle cx="${G}" cy="${G}" r="8" stroke="${K}" stroke-width="1.5" fill="none"/>
935
908
  <circle cx="${G}" cy="${G}" r="1.5" fill="${K}"/>
936
909
  </g>
937
- `), Lt = X(`
910
+ `), jt = X(`
938
911
  <g>
939
912
  <!-- shadow -->
940
913
  <g stroke="${q}" stroke-width="${Y}" fill="none" stroke-linecap="round" stroke-linejoin="round">
@@ -953,7 +926,7 @@ var Ft = X(`
953
926
  <circle cx="${G - 5}" cy="${G}" r="1" fill="${K}" opacity="0.6"/>
954
927
  <circle cx="21" cy="${G}" r="1" fill="${K}" opacity="0.6"/>
955
928
  </g>
956
- `), Rt = X(`
929
+ `), Mt = X(`
957
930
  <g>
958
931
  <!-- shadow -->
959
932
  <g stroke="${q}" stroke-width="${Y}" fill="none" stroke-linecap="round" stroke-linejoin="round">
@@ -972,7 +945,7 @@ var Ft = X(`
972
945
  <circle cx="${G}" cy="${G - 5}" r="1" fill="${K}" opacity="0.6"/>
973
946
  <circle cx="${G}" cy="21" r="1" fill="${K}" opacity="0.6"/>
974
947
  </g>
975
- `), zt = X(`
948
+ `), Nt = X(`
976
949
  <g>
977
950
  <!-- shadow -->
978
951
  <g stroke="${q}" stroke-width="${Y}" fill="none" stroke-linecap="round" stroke-linejoin="round">
@@ -998,54 +971,54 @@ var Ft = X(`
998
971
  `);
999
972
  function Z(e, t, n) {
1000
973
  return {
1001
- css: `${Pt(e)} ${t} ${n}, auto`,
974
+ css: `${Ot(e)} ${t} ${n}, auto`,
1002
975
  hotspotX: t,
1003
976
  hotspotY: n
1004
977
  };
1005
978
  }
1006
979
  var Q = {
1007
- tap: Z(Ft, 12, 4),
1008
- hold: Z(It, 16, 16),
1009
- slideHorizontal: Z(Lt, G, G),
1010
- slideVertical: Z(Rt, G, G),
1011
- slideAuto: Z(zt, G, G)
980
+ tap: Z(kt, 12, 4),
981
+ hold: Z(At, 16, 16),
982
+ slideHorizontal: Z(jt, G, G),
983
+ slideVertical: Z(Mt, G, G),
984
+ slideAuto: Z(Nt, G, G)
1012
985
  };
1013
986
  //#endregion
1014
987
  //#region src/framework/gestures/haptics.ts
1015
- function Bt() {
988
+ function Pt() {
1016
989
  if (typeof window > "u") return null;
1017
990
  let e = window;
1018
991
  return e.Capacitor?.isNativePlatform?.() ? e.Capacitor.Plugins?.Haptics ?? null : null;
1019
992
  }
1020
- function Vt(e) {
993
+ function Ft(e) {
1021
994
  if (!(typeof navigator > "u" || typeof navigator.vibrate != "function")) try {
1022
995
  navigator.vibrate(e);
1023
996
  } catch {}
1024
997
  }
1025
- var Ht = {
998
+ var It = {
1026
999
  tick() {
1027
- let e = Bt();
1000
+ let e = Pt();
1028
1001
  if (e) {
1029
1002
  e.impact({ style: "Light" }).catch(() => {});
1030
1003
  return;
1031
1004
  }
1032
- Vt(8);
1005
+ Ft(8);
1033
1006
  },
1034
1007
  bump() {
1035
- let e = Bt();
1008
+ let e = Pt();
1036
1009
  if (e) {
1037
1010
  e.impact({ style: "Medium" }).catch(() => {});
1038
1011
  return;
1039
1012
  }
1040
- Vt(20);
1013
+ Ft(20);
1041
1014
  },
1042
1015
  pulse() {
1043
- let e = Bt();
1016
+ let e = Pt();
1044
1017
  if (e) {
1045
1018
  e.impact({ style: "Heavy" }).catch(() => {});
1046
1019
  return;
1047
1020
  }
1048
- Vt([
1021
+ Ft([
1049
1022
  0,
1050
1023
  15,
1051
1024
  40,
@@ -1055,7 +1028,7 @@ var Ht = {
1055
1028
  };
1056
1029
  //#endregion
1057
1030
  //#region src/framework/gestures/use-widget-gestures.ts
1058
- function Ut(e, t) {
1031
+ function Lt(e, t) {
1059
1032
  let n = {
1060
1033
  isDown: !1,
1061
1034
  isTouch: !1,
@@ -1066,7 +1039,7 @@ function Ut(e, t) {
1066
1039
  sliding: !1,
1067
1040
  holdTimer: null,
1068
1041
  element: null
1069
- }, r = null, i = null, a = null, [o, s] = E(null);
1042
+ }, r = null, i = null, a = null, [o, s] = D(null);
1070
1043
  function c(e) {
1071
1044
  e !== i && (a && a.disconnect(), a = new ResizeObserver((e) => {
1072
1045
  let t = e[0];
@@ -1098,7 +1071,7 @@ function Ut(e, t) {
1098
1071
  if (n.isDown = !0, n.isTouch = t.pointerType === "touch", n.element = t.currentTarget, c(n.element), n.startX = t.clientX, n.startY = t.clientY, n.startTime = Date.now(), n.hasMoved = !1, n.sliding = !1, r.hold) {
1099
1072
  let e = r.hold.delay ?? 300;
1100
1073
  n.holdTimer = setTimeout(() => {
1101
- n.holdTimer = null, !(!n.isDown || n.hasMoved) && (Ht.bump(), r.hold?.action(), n.isDown = !1);
1074
+ n.holdTimer = null, !(!n.isDown || n.hasMoved) && (It.bump(), r.hold?.action(), n.isDown = !1);
1102
1075
  }, e);
1103
1076
  }
1104
1077
  if (!n.isTouch && r.slide) try {
@@ -1166,7 +1139,7 @@ function Ut(e, t) {
1166
1139
  }
1167
1140
  //#endregion
1168
1141
  //#region src/framework/theming/svg-colors.ts
1169
- var Wt = {
1142
+ var Rt = {
1170
1143
  solar: "oklch(0.74 0.18 60)",
1171
1144
  grid: "oklch(0.62 0.12 245)",
1172
1145
  battery: "oklch(0.70 0.18 145)",
@@ -1175,37 +1148,37 @@ var Wt = {
1175
1148
  positive: "oklch(0.70 0.14 160)",
1176
1149
  negative: "oklch(0.64 0.22 27)"
1177
1150
  };
1178
- function Gt(e) {
1151
+ function zt(e) {
1179
1152
  return {
1180
1153
  fill: `color-mix(in oklch, ${e} 20%, transparent)`,
1181
1154
  stroke: e,
1182
1155
  solid: e
1183
1156
  };
1184
1157
  }
1185
- var Kt = Object.fromEntries(Object.entries(Wt).map(([e, t]) => [e, Gt(t)])), qt = o.enum([
1158
+ var Bt = Object.fromEntries(Object.entries(Rt).map(([e, t]) => [e, zt(t)])), Vt = l.enum([
1186
1159
  "success",
1187
1160
  "warning",
1188
1161
  "danger",
1189
1162
  "info",
1190
1163
  "neutral",
1191
1164
  "accent"
1192
- ]), Jt = {
1193
- title: e(() => o.string().optional().meta({
1165
+ ]), Ht = {
1166
+ title: r(() => l.string().optional().meta({
1194
1167
  title: "Title",
1195
1168
  description: "Optional display name override"
1196
1169
  }), "widgetFields.title"),
1197
- entityIds: e((e, t) => o.array(o.string()).default([]).meta({
1170
+ entityIds: r((e, t) => l.array(l.string()).default([]).meta({
1198
1171
  domain: e,
1199
1172
  title: "Entities",
1200
1173
  ...t?.deviceClass ? { deviceClass: t.deviceClass } : {}
1201
1174
  }), "widgetFields.entityIds"),
1202
- singleEntity: e((e, t) => o.array(o.string()).default([]).meta({
1175
+ singleEntity: r((e, t) => l.array(l.string()).default([]).meta({
1203
1176
  domain: e,
1204
1177
  title: "Entity",
1205
1178
  singleSelect: !0,
1206
1179
  ...t?.deviceClass ? { deviceClass: t.deviceClass } : {}
1207
1180
  }), "widgetFields.singleEntity"),
1208
- areaId: e(() => o.string().optional().meta({
1181
+ areaId: r(() => l.string().optional().meta({
1209
1182
  formType: "area-picker",
1210
1183
  title: "Area"
1211
1184
  }), "widgetFields.areaId")
@@ -1217,48 +1190,48 @@ function $(e) {
1217
1190
  for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = r);
1218
1191
  return t;
1219
1192
  }
1220
- function Yt() {
1221
- return o.string().optional().meta({
1193
+ function Ut() {
1194
+ return l.string().optional().meta({
1222
1195
  title: "Title",
1223
1196
  description: "Optional display name override"
1224
1197
  });
1225
1198
  }
1226
- function Xt(e) {
1227
- return (e.default === void 0 ? o.string().optional() : o.string().default(e.default)).meta($({
1199
+ function Wt(e) {
1200
+ return (e.default === void 0 ? l.string().optional() : l.string().default(e.default)).meta($({
1228
1201
  title: e.title,
1229
1202
  description: e.description
1230
1203
  }));
1231
1204
  }
1232
- function Zt(e) {
1233
- let t = o.number();
1205
+ function Gt(e) {
1206
+ let t = l.number();
1234
1207
  return e.min !== void 0 && (t = t.min(e.min)), e.max !== void 0 && (t = t.max(e.max)), (e.default === void 0 ? t.optional() : t.default(e.default)).meta($({
1235
1208
  title: e.title,
1236
1209
  description: e.description
1237
1210
  }));
1238
1211
  }
1239
- function Qt(e) {
1240
- return o.boolean().default(e.default ?? !1).meta($({
1212
+ function Kt(e) {
1213
+ return l.boolean().default(e.default ?? !1).meta($({
1241
1214
  title: e.title,
1242
1215
  description: e.description
1243
1216
  }));
1244
1217
  }
1245
- function $t(e, t) {
1246
- let n = o.enum(e);
1218
+ function qt(e, t) {
1219
+ let n = l.enum(e);
1247
1220
  return (t.default === void 0 ? n.optional() : n.default(t.default)).meta($({
1248
1221
  title: t.title,
1249
1222
  description: t.description
1250
1223
  }));
1251
1224
  }
1252
- function en(e, t) {
1253
- return o.array(o.string()).default([]).meta($({
1225
+ function Jt(e, t) {
1226
+ return l.array(l.string()).default([]).meta($({
1254
1227
  domain: e,
1255
1228
  title: t?.title ?? "Entities",
1256
1229
  description: t?.description,
1257
1230
  deviceClass: t?.deviceClass
1258
1231
  }));
1259
1232
  }
1260
- function tn(e, t) {
1261
- return o.array(o.string()).default([]).meta($({
1233
+ function Yt(e, t) {
1234
+ return l.array(l.string()).default([]).meta($({
1262
1235
  domain: e,
1263
1236
  title: t?.title ?? "Entity",
1264
1237
  description: t?.description,
@@ -1266,40 +1239,48 @@ function tn(e, t) {
1266
1239
  singleSelect: !0
1267
1240
  }));
1268
1241
  }
1269
- function nn(e) {
1270
- return o.string().optional().meta({
1242
+ function Xt(e) {
1243
+ return l.string().optional().meta({
1271
1244
  formType: "area-picker",
1272
1245
  title: e?.title ?? "Area"
1273
1246
  });
1274
1247
  }
1275
- function rn(e) {
1276
- return o.array(o.string()).default([]).meta($({
1248
+ function Zt(e) {
1249
+ let t = l.string().meta({
1250
+ formType: "icon-picker",
1251
+ title: e?.title ?? "Icon"
1252
+ });
1253
+ return e?.default === void 0 ? t.optional() : t.default(e.default);
1254
+ }
1255
+ function Qt(e) {
1256
+ return l.array(l.string()).default([]).meta($({
1277
1257
  title: e.title,
1278
1258
  description: e.description
1279
1259
  }));
1280
1260
  }
1281
- function an(e, t) {
1282
- let n = o.object(e);
1261
+ function $t(e, t) {
1262
+ let n = l.object(e);
1283
1263
  return n.default(Se(n)).meta({ title: t.title });
1284
1264
  }
1285
- var on = {
1286
- title: Yt,
1287
- text: Xt,
1288
- number: Zt,
1289
- toggle: Qt,
1290
- choice: $t,
1291
- entities: en,
1292
- entity: tn,
1293
- area: nn,
1294
- stringList: rn,
1295
- group: an
1265
+ var en = {
1266
+ title: Ut,
1267
+ text: Wt,
1268
+ number: Gt,
1269
+ toggle: Kt,
1270
+ choice: qt,
1271
+ entities: Jt,
1272
+ entity: Yt,
1273
+ area: Xt,
1274
+ icon: Zt,
1275
+ stringList: Qt,
1276
+ group: $t
1296
1277
  };
1297
- function sn(e) {
1298
- return o.object(e);
1278
+ function tn(e) {
1279
+ return l.object(e);
1299
1280
  }
1300
1281
  //#endregion
1301
1282
  //#region src/shared/spline.ts
1302
- function cn(e) {
1283
+ function nn(e) {
1303
1284
  if (e.length < 2) return "";
1304
1285
  let t = e[0], n = e[1];
1305
1286
  if (!t || !n) return "";
@@ -1326,14 +1307,14 @@ function cn(e) {
1326
1307
  }
1327
1308
  //#endregion
1328
1309
  //#region src/theme.ts
1329
- function ln() {
1310
+ function rn() {
1330
1311
  return document.documentElement.classList.contains("dark");
1331
1312
  }
1332
1313
  //#endregion
1333
1314
  //#region src/version.ts
1334
- var un = {
1315
+ var an = {
1335
1316
  name: "@glasshome/widget-sdk",
1336
- version: "1.6.1",
1317
+ version: "1.8.0",
1337
1318
  description: "SDK for building GlassHome dashboard widgets with SolidJS",
1338
1319
  keywords: [
1339
1320
  "glasshome",
@@ -1365,6 +1346,11 @@ var un = {
1365
1346
  types: "./dist/deprecations.d.ts",
1366
1347
  import: "./dist/deprecations.js"
1367
1348
  },
1349
+ "./host": {
1350
+ "@glasshome/source": "./src/host/index.ts",
1351
+ types: "./dist/host/index.d.ts",
1352
+ import: "./dist/host/index.js"
1353
+ },
1368
1354
  "./vite": {
1369
1355
  "@glasshome/source": "./src/vite/index.ts",
1370
1356
  types: "./dist/vite/index.d.ts",
@@ -1416,4 +1402,4 @@ var un = {
1416
1402
  engines: { node: ">=18" }
1417
1403
  }.version;
1418
1404
  //#endregion
1419
- export { un as SDK_VERSION, qt as ToneSchema, U as Widget, Be as WidgetContent, R as WidgetCtx, kt as WidgetDialog, We as WidgetIcon, r as WidgetManifestSchema, Re as WidgetSliderFill, Ke as WidgetStatus, Ye as WidgetTitle, st as WidgetValue, g as byDomain, Xe as calculateLightGroup, Ze as calculateSensorGroup, nt as countActiveEntities, sn as defineConfig, Ce as defineWidget, t as deprecations, on as field, n as formatDeprecation, i as formatSchemaError, tt as getEntityAttribute, s as getForecasts, c as getStream, l as getWebRtcClientConfig, u as hassMediaUrl, Pe as injectTokens, ln as isDark, et as isEntityActive, cn as monotoneCubicPath, d as sendWebRtcCandidate, f as startWebRtcSession, p as state, Kt as svgColors, m as trackEntityHistory, h as untrackEntityHistory, _ as useArea, v as useCamera, ee as useConnection, y as useCurrency, b as useEntities, te as useEntity, x as useEntityHistory, ne as useEntityStatistics, re as useForecast, ie as useHassConfig, At as useIntersectionPause, ae as useLocale, jt as useReducedMotion, Ee as useService, oe as useStore, se as useTemperatureUnit, ke as useToggle, Oe as useTurnOff, De as useTurnOn, de as useUnitSystem, we as useWidgetContext, Mt as useWidgetDialog, Nt as useWidgetEntityGroup, Ut as useWidgetGestures, Jt as widgetFields, a as z };
1405
+ export { an as SDK_VERSION, Vt as ToneSchema, U as Widget, Pe as WidgetContent, e as WidgetCtx, Ct as WidgetDialog, Re as WidgetIcon, o as WidgetManifestSchema, Me as WidgetSliderFill, Be as WidgetStatus, Ue as WidgetTitle, tt as WidgetValue, ee as byDomain, We as calculateLightGroup, Ge as calculateSensorGroup, Xe as countActiveEntities, tn as defineConfig, Ce as defineWidget, i as deprecations, en as field, a as formatDeprecation, s as formatSchemaError, Ye as getEntityAttribute, u as getForecasts, d as getStream, f as getWebRtcClientConfig, p as hassMediaUrl, n as injectTokens, rn as isDark, Je as isEntityActive, nn as monotoneCubicPath, m as sendWebRtcCandidate, h as startWebRtcSession, g as state, Bt as svgColors, _ as trackEntityHistory, v as untrackEntityHistory, y as useArea, b as useCamera, te as useConnection, x as useCurrency, ne as useEntities, S as useEntity, re as useEntityHistory, ie as useEntityStatistics, C as useForecast, ae as useHassConfig, wt as useIntersectionPause, oe as useLocale, Tt as useReducedMotion, Te as useService, ce as useStore, le as useTemperatureUnit, Oe as useToggle, De as useTurnOff, Ee as useTurnOn, pe as useUnitSystem, t as useWidgetContext, Et as useWidgetDialog, Dt as useWidgetEntityGroup, Lt as useWidgetGestures, Ht as widgetFields, c as z };