@hot-page/fun 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,52 +1,52 @@
1
- const te = globalThis, U = te.trustedTypes, ne = U ? U.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, pe = "$lit$", C = `lit$${Math.random().toFixed(9).slice(2)}$`, fe = "?" + C, Se = `<${fe}>`, E = document, P = () => E.createComment(""), R = (e) => e === null || typeof e != "object" && typeof e != "function", re = Array.isArray, Ee = (e) => re(e) || typeof e?.[Symbol.iterator] == "function", G = `[
2
- \f\r]`, W = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ue = /-->/g, ce = />/g, x = RegExp(`>|${G}(?:([^\\s"'>=/]+)(${G}*=${G}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`, "g"), ae = /'/g, le = /"/g, me = /^(?:script|style|textarea|title)$/i, ve = (e) => (t, ...r) => ({ _$litType$: e, strings: t, values: r }), nt = ve(1), ut = ve(2), H = Symbol.for("lit-noChange"), w = Symbol.for("lit-nothing"), he = /* @__PURE__ */ new WeakMap(), T = E.createTreeWalker(E, 129);
4
- function Ae(e, t) {
5
- if (!re(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
6
- return ne !== void 0 ? ne.createHTML(t) : t;
1
+ const ee = globalThis, q = ee.trustedTypes, ie = q ? q.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, pe = "$lit$", N = `lit$${Math.random().toFixed(9).slice(2)}$`, fe = "?" + N, Se = `<${fe}>`, E = document, W = () => E.createComment(""), H = (e) => e === null || typeof e != "object" && typeof e != "function", te = Array.isArray, be = (e) => te(e) || typeof e?.[Symbol.iterator] == "function", z = `[
2
+ \f\r]`, O = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ne = /-->/g, ue = />/g, x = RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), ce = /'/g, ae = /"/g, me = /^(?:script|style|textarea|title)$/i, ve = (e) => (t, ...r) => ({ _$litType$: e, strings: t, values: r }), nt = ve(1), ut = ve(2), R = Symbol.for("lit-noChange"), $ = Symbol.for("lit-nothing"), le = /* @__PURE__ */ new WeakMap(), T = E.createTreeWalker(E, 129);
4
+ function we(e, t) {
5
+ if (!te(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
6
+ return ie !== void 0 ? ie.createHTML(t) : t;
7
7
  }
8
8
  const Ie = (e, t) => {
9
9
  const r = e.length - 1, s = [];
10
- let o, i = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", a = W;
11
- for (let h = 0; h < r; h++) {
12
- const n = e[h];
13
- let u, d, c = -1, v = 0;
14
- for (; v < n.length && (a.lastIndex = v, d = a.exec(n), d !== null); ) v = a.lastIndex, a === W ? d[1] === "!--" ? a = ue : d[1] !== void 0 ? a = ce : d[2] !== void 0 ? (me.test(d[2]) && (o = RegExp("</" + d[2], "g")), a = x) : d[3] !== void 0 && (a = x) : a === x ? d[0] === ">" ? (a = o ?? W, c = -1) : d[1] === void 0 ? c = -2 : (c = a.lastIndex - d[2].length, u = d[1], a = d[3] === void 0 ? x : d[3] === '"' ? le : ae) : a === le || a === ae ? a = x : a === ue || a === ce ? a = W : (a = x, o = void 0);
15
- const m = a === x && e[h + 1].startsWith("/>") ? " " : "";
16
- i += a === W ? n + Se : c >= 0 ? (s.push(u), n.slice(0, c) + pe + n.slice(c) + C + m) : n + C + (c === -2 ? h : m);
17
- }
18
- return [Ae(e, i + (e[r] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
10
+ let o, n = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", a = O;
11
+ for (let l = 0; l < r; l++) {
12
+ const u = e[l];
13
+ let i, h, c = -1, p = 0;
14
+ for (; p < u.length && (a.lastIndex = p, h = a.exec(u), h !== null); ) p = a.lastIndex, a === O ? h[1] === "!--" ? a = ne : h[1] !== void 0 ? a = ue : h[2] !== void 0 ? (me.test(h[2]) && (o = RegExp("</" + h[2], "g")), a = x) : h[3] !== void 0 && (a = x) : a === x ? h[0] === ">" ? (a = o ?? O, c = -1) : h[1] === void 0 ? c = -2 : (c = a.lastIndex - h[2].length, i = h[1], a = h[3] === void 0 ? x : h[3] === '"' ? ae : ce) : a === ae || a === ce ? a = x : a === ne || a === ue ? a = O : (a = x, o = void 0);
15
+ const f = a === x && e[l + 1].startsWith("/>") ? " " : "";
16
+ n += a === O ? u + Se : c >= 0 ? (s.push(i), u.slice(0, c) + pe + u.slice(c) + N + f) : u + N + (c === -2 ? l : f);
17
+ }
18
+ return [we(e, n + (e[r] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
19
19
  };
20
- class k {
20
+ class P {
21
21
  constructor({ strings: t, _$litType$: r }, s) {
22
22
  let o;
23
23
  this.parts = [];
24
- let i = 0, a = 0;
25
- const h = t.length - 1, n = this.parts, [u, d] = Ie(t, r);
26
- if (this.el = k.createElement(u, s), T.currentNode = this.el.content, r === 2 || r === 3) {
24
+ let n = 0, a = 0;
25
+ const l = t.length - 1, u = this.parts, [i, h] = Ie(t, r);
26
+ if (this.el = P.createElement(i, s), T.currentNode = this.el.content, r === 2 || r === 3) {
27
27
  const c = this.el.content.firstChild;
28
28
  c.replaceWith(...c.childNodes);
29
29
  }
30
- for (; (o = T.nextNode()) !== null && n.length < h; ) {
30
+ for (; (o = T.nextNode()) !== null && u.length < l; ) {
31
31
  if (o.nodeType === 1) {
32
32
  if (o.hasAttributes()) for (const c of o.getAttributeNames()) if (c.endsWith(pe)) {
33
- const v = d[a++], m = o.getAttribute(c).split(C), _ = /([.?@])?(.*)/.exec(v);
34
- n.push({ type: 1, index: i, name: _[2], strings: m, ctor: _[1] === "." ? Oe : _[1] === "?" ? We : _[1] === "@" ? Me : B }), o.removeAttribute(c);
35
- } else c.startsWith(C) && (n.push({ type: 6, index: i }), o.removeAttribute(c));
33
+ const p = h[a++], f = o.getAttribute(c).split(N), y = /([.?@])?(.*)/.exec(p);
34
+ u.push({ type: 1, index: n, name: y[2], strings: f, ctor: y[1] === "." ? Me : y[1] === "?" ? We : y[1] === "@" ? He : j }), o.removeAttribute(c);
35
+ } else c.startsWith(N) && (u.push({ type: 6, index: n }), o.removeAttribute(c));
36
36
  if (me.test(o.tagName)) {
37
- const c = o.textContent.split(C), v = c.length - 1;
38
- if (v > 0) {
39
- o.textContent = U ? U.emptyScript : "";
40
- for (let m = 0; m < v; m++) o.append(c[m], P()), T.nextNode(), n.push({ type: 2, index: ++i });
41
- o.append(c[v], P());
37
+ const c = o.textContent.split(N), p = c.length - 1;
38
+ if (p > 0) {
39
+ o.textContent = q ? q.emptyScript : "";
40
+ for (let f = 0; f < p; f++) o.append(c[f], W()), T.nextNode(), u.push({ type: 2, index: ++n });
41
+ o.append(c[p], W());
42
42
  }
43
43
  }
44
- } else if (o.nodeType === 8) if (o.data === fe) n.push({ type: 2, index: i });
44
+ } else if (o.nodeType === 8) if (o.data === fe) u.push({ type: 2, index: n });
45
45
  else {
46
46
  let c = -1;
47
- for (; (c = o.data.indexOf(C, c + 1)) !== -1; ) n.push({ type: 7, index: i }), c += C.length - 1;
47
+ for (; (c = o.data.indexOf(N, c + 1)) !== -1; ) u.push({ type: 7, index: n }), c += N.length - 1;
48
48
  }
49
- i++;
49
+ n++;
50
50
  }
51
51
  }
52
52
  static createElement(t, r) {
@@ -55,12 +55,12 @@ class k {
55
55
  }
56
56
  }
57
57
  function b(e, t, r = e, s) {
58
- if (t === H) return t;
58
+ if (t === R) return t;
59
59
  let o = s !== void 0 ? r._$Co?.[s] : r._$Cl;
60
- const i = R(t) ? void 0 : t._$litDirective$;
61
- return o?.constructor !== i && (o?._$AO?.(!1), i === void 0 ? o = void 0 : (o = new i(e), o._$AT(e, r, s)), s !== void 0 ? (r._$Co ??= [])[s] = o : r._$Cl = o), o !== void 0 && (t = b(e, o._$AS(e, t.values), o, s)), t;
60
+ const n = H(t) ? void 0 : t._$litDirective$;
61
+ return o?.constructor !== n && (o?._$AO?.(!1), n === void 0 ? o = void 0 : (o = new n(e), o._$AT(e, r, s)), s !== void 0 ? (r._$Co ??= [])[s] = o : r._$Cl = o), o !== void 0 && (t = b(e, o._$AS(e, t.values), o, s)), t;
62
62
  }
63
- class be {
63
+ class Oe {
64
64
  constructor(t, r) {
65
65
  this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = r;
66
66
  }
@@ -73,13 +73,13 @@ class be {
73
73
  u(t) {
74
74
  const { el: { content: r }, parts: s } = this._$AD, o = (t?.creationScope ?? E).importNode(r, !0);
75
75
  T.currentNode = o;
76
- let i = T.nextNode(), a = 0, h = 0, n = s[0];
77
- for (; n !== void 0; ) {
78
- if (a === n.index) {
79
- let u;
80
- n.type === 2 ? u = new L(i, i.nextSibling, this, t) : n.type === 1 ? u = new n.ctor(i, n.name, n.strings, this, t) : n.type === 6 && (u = new Pe(i, this, t)), this._$AV.push(u), n = s[++h];
76
+ let n = T.nextNode(), a = 0, l = 0, u = s[0];
77
+ for (; u !== void 0; ) {
78
+ if (a === u.index) {
79
+ let i;
80
+ u.type === 2 ? i = new k(n, n.nextSibling, this, t) : u.type === 1 ? i = new u.ctor(n, u.name, u.strings, this, t) : u.type === 6 && (i = new Re(n, this, t)), this._$AV.push(i), u = s[++l];
81
81
  }
82
- a !== n?.index && (i = T.nextNode(), a++);
82
+ a !== u?.index && (n = T.nextNode(), a++);
83
83
  }
84
84
  return T.currentNode = E, o;
85
85
  }
@@ -88,12 +88,12 @@ class be {
88
88
  for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, r), r += s.strings.length - 2) : s._$AI(t[r])), r++;
89
89
  }
90
90
  }
91
- class L {
91
+ class k {
92
92
  get _$AU() {
93
93
  return this._$AM?._$AU ?? this._$Cv;
94
94
  }
95
95
  constructor(t, r, s, o) {
96
- this.type = 2, this._$AH = w, this._$AN = void 0, this._$AA = t, this._$AB = r, this._$AM = s, this.options = o, this._$Cv = o?.isConnected ?? !0;
96
+ this.type = 2, this._$AH = $, this._$AN = void 0, this._$AA = t, this._$AB = r, this._$AM = s, this.options = o, this._$Cv = o?.isConnected ?? !0;
97
97
  }
98
98
  get parentNode() {
99
99
  let t = this._$AA.parentNode;
@@ -107,7 +107,7 @@ class L {
107
107
  return this._$AB;
108
108
  }
109
109
  _$AI(t, r = this) {
110
- t = b(this, t, r), R(t) ? t === w || t == null || t === "" ? (this._$AH !== w && this._$AR(), this._$AH = w) : t !== this._$AH && t !== H && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Ee(t) ? this.k(t) : this._(t);
110
+ t = b(this, t, r), H(t) ? t === $ || t == null || t === "" ? (this._$AH !== $ && this._$AR(), this._$AH = $) : t !== this._$AH && t !== R && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : be(t) ? this.k(t) : this._(t);
111
111
  }
112
112
  O(t) {
113
113
  return this._$AA.parentNode.insertBefore(t, this._$AB);
@@ -116,25 +116,25 @@ class L {
116
116
  this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
117
117
  }
118
118
  _(t) {
119
- this._$AH !== w && R(this._$AH) ? this._$AA.nextSibling.data = t : this.T(E.createTextNode(t)), this._$AH = t;
119
+ this._$AH !== $ && H(this._$AH) ? this._$AA.nextSibling.data = t : this.T(E.createTextNode(t)), this._$AH = t;
120
120
  }
121
121
  $(t) {
122
- const { values: r, _$litType$: s } = t, o = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = k.createElement(Ae(s.h, s.h[0]), this.options)), s);
122
+ const { values: r, _$litType$: s } = t, o = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = P.createElement(we(s.h, s.h[0]), this.options)), s);
123
123
  if (this._$AH?._$AD === o) this._$AH.p(r);
124
124
  else {
125
- const i = new be(o, this), a = i.u(this.options);
126
- i.p(r), this.T(a), this._$AH = i;
125
+ const n = new Oe(o, this), a = n.u(this.options);
126
+ n.p(r), this.T(a), this._$AH = n;
127
127
  }
128
128
  }
129
129
  _$AC(t) {
130
- let r = he.get(t.strings);
131
- return r === void 0 && he.set(t.strings, r = new k(t)), r;
130
+ let r = le.get(t.strings);
131
+ return r === void 0 && le.set(t.strings, r = new P(t)), r;
132
132
  }
133
133
  k(t) {
134
- re(this._$AH) || (this._$AH = [], this._$AR());
134
+ te(this._$AH) || (this._$AH = [], this._$AR());
135
135
  const r = this._$AH;
136
136
  let s, o = 0;
137
- for (const i of t) o === r.length ? r.push(s = new L(this.O(P()), this.O(P()), this, this.options)) : s = r[o], s._$AI(i), o++;
137
+ for (const n of t) o === r.length ? r.push(s = new k(this.O(W()), this.O(W()), this, this.options)) : s = r[o], s._$AI(n), o++;
138
138
  o < r.length && (this._$AR(s && s._$AB.nextSibling, o), r.length = o);
139
139
  }
140
140
  _$AR(t = this._$AA.nextSibling, r) {
@@ -147,61 +147,61 @@ class L {
147
147
  this._$AM === void 0 && (this._$Cv = t, this._$AP?.(t));
148
148
  }
149
149
  }
150
- class B {
150
+ class j {
151
151
  get tagName() {
152
152
  return this.element.tagName;
153
153
  }
154
154
  get _$AU() {
155
155
  return this._$AM._$AU;
156
156
  }
157
- constructor(t, r, s, o, i) {
158
- this.type = 1, this._$AH = w, this._$AN = void 0, this.element = t, this.name = r, this._$AM = o, this.options = i, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = w;
157
+ constructor(t, r, s, o, n) {
158
+ this.type = 1, this._$AH = $, this._$AN = void 0, this.element = t, this.name = r, this._$AM = o, this.options = n, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = $;
159
159
  }
160
160
  _$AI(t, r = this, s, o) {
161
- const i = this.strings;
161
+ const n = this.strings;
162
162
  let a = !1;
163
- if (i === void 0) t = b(this, t, r, 0), a = !R(t) || t !== this._$AH && t !== H, a && (this._$AH = t);
163
+ if (n === void 0) t = b(this, t, r, 0), a = !H(t) || t !== this._$AH && t !== R, a && (this._$AH = t);
164
164
  else {
165
- const h = t;
166
- let n, u;
167
- for (t = i[0], n = 0; n < i.length - 1; n++) u = b(this, h[s + n], r, n), u === H && (u = this._$AH[n]), a ||= !R(u) || u !== this._$AH[n], u === w ? t = w : t !== w && (t += (u ?? "") + i[n + 1]), this._$AH[n] = u;
165
+ const l = t;
166
+ let u, i;
167
+ for (t = n[0], u = 0; u < n.length - 1; u++) i = b(this, l[s + u], r, u), i === R && (i = this._$AH[u]), a ||= !H(i) || i !== this._$AH[u], i === $ ? t = $ : t !== $ && (t += (i ?? "") + n[u + 1]), this._$AH[u] = i;
168
168
  }
169
169
  a && !o && this.j(t);
170
170
  }
171
171
  j(t) {
172
- t === w ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
172
+ t === $ ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
173
173
  }
174
174
  }
175
- class Oe extends B {
175
+ class Me extends j {
176
176
  constructor() {
177
177
  super(...arguments), this.type = 3;
178
178
  }
179
179
  j(t) {
180
- this.element[this.name] = t === w ? void 0 : t;
180
+ this.element[this.name] = t === $ ? void 0 : t;
181
181
  }
182
182
  }
183
- class We extends B {
183
+ class We extends j {
184
184
  constructor() {
185
185
  super(...arguments), this.type = 4;
186
186
  }
187
187
  j(t) {
188
- this.element.toggleAttribute(this.name, !!t && t !== w);
188
+ this.element.toggleAttribute(this.name, !!t && t !== $);
189
189
  }
190
190
  }
191
- class Me extends B {
192
- constructor(t, r, s, o, i) {
193
- super(t, r, s, o, i), this.type = 5;
191
+ class He extends j {
192
+ constructor(t, r, s, o, n) {
193
+ super(t, r, s, o, n), this.type = 5;
194
194
  }
195
195
  _$AI(t, r = this) {
196
- if ((t = b(this, t, r, 0) ?? w) === H) return;
197
- const s = this._$AH, o = t === w && s !== w || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, i = t !== w && (s === w || o);
198
- o && this.element.removeEventListener(this.name, this, s), i && this.element.addEventListener(this.name, this, t), this._$AH = t;
196
+ if ((t = b(this, t, r, 0) ?? $) === R) return;
197
+ const s = this._$AH, o = t === $ && s !== $ || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, n = t !== $ && (s === $ || o);
198
+ o && this.element.removeEventListener(this.name, this, s), n && this.element.addEventListener(this.name, this, t), this._$AH = t;
199
199
  }
200
200
  handleEvent(t) {
201
201
  typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, t) : this._$AH.handleEvent(t);
202
202
  }
203
203
  }
204
- class Pe {
204
+ class Re {
205
205
  constructor(t, r, s) {
206
206
  this.element = t, this.type = 6, this._$AN = void 0, this._$AM = r, this.options = s;
207
207
  }
@@ -212,41 +212,41 @@ class Pe {
212
212
  b(this, t);
213
213
  }
214
214
  }
215
- const Re = te.litHtmlPolyfillSupport;
216
- Re?.(k, L), (te.litHtmlVersions ??= []).push("3.3.1");
217
- const He = (e, t, r) => {
215
+ const Pe = ee.litHtmlPolyfillSupport;
216
+ Pe?.(P, k), (ee.litHtmlVersions ??= []).push("3.3.1");
217
+ const he = (e, t, r) => {
218
218
  const s = t;
219
219
  let o = s._$litPart$;
220
- return o === void 0 && (s._$litPart$ = o = new L(t.insertBefore(P(), null), null, void 0, {})), o._$AI(e), o;
220
+ return o === void 0 && (s._$litPart$ = o = new k(t.insertBefore(W(), null), null, void 0, {})), o._$AI(e), o;
221
221
  };
222
- var ke = Object.defineProperty, Le = (e, t, r) => t in e ? ke(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, K = (e, t, r) => (Le(e, typeof t != "symbol" ? t + "" : t, r), r), Ve = (e, t, r) => {
222
+ var ke = Object.defineProperty, Le = (e, t, r) => t in e ? ke(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, F = (e, t, r) => (Le(e, typeof t != "symbol" ? t + "" : t, r), r), Ve = (e, t, r) => {
223
223
  if (!t.has(e))
224
224
  throw TypeError("Cannot " + r);
225
- }, Y = (e, t) => {
225
+ }, K = (e, t) => {
226
226
  if (Object(t) !== t)
227
227
  throw TypeError('Cannot use the "in" operator on this value');
228
228
  return e.has(t);
229
- }, D = (e, t, r) => {
229
+ }, V = (e, t, r) => {
230
230
  if (t.has(e))
231
231
  throw TypeError("Cannot add the same private member more than once");
232
232
  t instanceof WeakSet ? t.add(e) : t.set(e, r);
233
233
  }, de = (e, t, r) => (Ve(e, t, "access private method"), r);
234
- function we(e, t) {
234
+ function $e(e, t) {
235
235
  return Object.is(e, t);
236
236
  }
237
- let A = null, M = !1, q = 1;
238
- const j = /* @__PURE__ */ Symbol("SIGNAL");
239
- function I(e) {
240
- const t = A;
241
- return A = e, t;
237
+ let w = null, M = !1, D = 1;
238
+ const U = /* @__PURE__ */ Symbol("SIGNAL");
239
+ function S(e) {
240
+ const t = w;
241
+ return w = e, t;
242
242
  }
243
243
  function De() {
244
- return A;
244
+ return w;
245
245
  }
246
246
  function qe() {
247
247
  return M;
248
248
  }
249
- const se = {
249
+ const re = {
250
250
  version: 0,
251
251
  lastCleanEpoch: 0,
252
252
  dirty: !1,
@@ -266,31 +266,31 @@ const se = {
266
266
  consumerOnSignalRead: () => {
267
267
  }
268
268
  };
269
- function F(e) {
269
+ function B(e) {
270
270
  if (M)
271
271
  throw new Error(
272
272
  typeof ngDevMode < "u" && ngDevMode ? "Assertion error: signal read during notification phase" : ""
273
273
  );
274
- if (A === null)
274
+ if (w === null)
275
275
  return;
276
- A.consumerOnSignalRead(e);
277
- const t = A.nextProducerIndex++;
278
- if (O(A), t < A.producerNode.length && A.producerNode[t] !== e && X(A)) {
279
- const r = A.producerNode[t];
280
- Z(r, A.producerIndexOfThis[t]);
276
+ w.consumerOnSignalRead(e);
277
+ const t = w.nextProducerIndex++;
278
+ if (I(w), t < w.producerNode.length && w.producerNode[t] !== e && Q(w)) {
279
+ const r = w.producerNode[t];
280
+ G(r, w.producerIndexOfThis[t]);
281
281
  }
282
- A.producerNode[t] !== e && (A.producerNode[t] = e, A.producerIndexOfThis[t] = X(A) ? ge(e, A, t) : 0), A.producerLastReadVersion[t] = e.version;
282
+ w.producerNode[t] !== e && (w.producerNode[t] = e, w.producerIndexOfThis[t] = Q(w) ? ge(e, w, t) : 0), w.producerLastReadVersion[t] = e.version;
283
283
  }
284
284
  function Ue() {
285
- q++;
285
+ D++;
286
286
  }
287
- function $e(e) {
288
- if (!(!e.dirty && e.lastCleanEpoch === q)) {
287
+ function Ae(e) {
288
+ if (!(!e.dirty && e.lastCleanEpoch === D)) {
289
289
  if (!e.producerMustRecompute(e) && !ze(e)) {
290
- e.dirty = !1, e.lastCleanEpoch = q;
290
+ e.dirty = !1, e.lastCleanEpoch = D;
291
291
  return;
292
292
  }
293
- e.producerRecomputeValue(e), e.dirty = !1, e.lastCleanEpoch = q;
293
+ e.producerRecomputeValue(e), e.dirty = !1, e.lastCleanEpoch = D;
294
294
  }
295
295
  }
296
296
  function _e(e) {
@@ -306,100 +306,100 @@ function _e(e) {
306
306
  }
307
307
  }
308
308
  function je() {
309
- return A?.consumerAllowSignalWrites !== !1;
309
+ return w?.consumerAllowSignalWrites !== !1;
310
310
  }
311
311
  function Be(e) {
312
312
  var t;
313
313
  e.dirty = !0, _e(e), (t = e.consumerMarkedDirty) == null || t.call(e.wrapper ?? e);
314
314
  }
315
- function Fe(e) {
316
- return e && (e.nextProducerIndex = 0), I(e);
315
+ function Ge(e) {
316
+ return e && (e.nextProducerIndex = 0), S(e);
317
317
  }
318
318
  function Ze(e, t) {
319
- if (I(t), !(!e || e.producerNode === void 0 || e.producerIndexOfThis === void 0 || e.producerLastReadVersion === void 0)) {
320
- if (X(e))
319
+ if (S(t), !(!e || e.producerNode === void 0 || e.producerIndexOfThis === void 0 || e.producerLastReadVersion === void 0)) {
320
+ if (Q(e))
321
321
  for (let r = e.nextProducerIndex; r < e.producerNode.length; r++)
322
- Z(e.producerNode[r], e.producerIndexOfThis[r]);
322
+ G(e.producerNode[r], e.producerIndexOfThis[r]);
323
323
  for (; e.producerNode.length > e.nextProducerIndex; )
324
324
  e.producerNode.pop(), e.producerLastReadVersion.pop(), e.producerIndexOfThis.pop();
325
325
  }
326
326
  }
327
327
  function ze(e) {
328
- O(e);
328
+ I(e);
329
329
  for (let t = 0; t < e.producerNode.length; t++) {
330
330
  const r = e.producerNode[t], s = e.producerLastReadVersion[t];
331
- if (s !== r.version || ($e(r), s !== r.version))
331
+ if (s !== r.version || (Ae(r), s !== r.version))
332
332
  return !0;
333
333
  }
334
334
  return !1;
335
335
  }
336
336
  function ge(e, t, r) {
337
337
  var s;
338
- if (oe(e), O(e), e.liveConsumerNode.length === 0) {
338
+ if (se(e), I(e), e.liveConsumerNode.length === 0) {
339
339
  (s = e.watched) == null || s.call(e.wrapper);
340
340
  for (let o = 0; o < e.producerNode.length; o++)
341
341
  e.producerIndexOfThis[o] = ge(e.producerNode[o], e, o);
342
342
  }
343
343
  return e.liveConsumerIndexOfThis.push(r), e.liveConsumerNode.push(t) - 1;
344
344
  }
345
- function Z(e, t) {
345
+ function G(e, t) {
346
346
  var r;
347
- if (oe(e), O(e), typeof ngDevMode < "u" && ngDevMode && t >= e.liveConsumerNode.length)
347
+ if (se(e), I(e), typeof ngDevMode < "u" && ngDevMode && t >= e.liveConsumerNode.length)
348
348
  throw new Error(
349
349
  `Assertion error: active consumer index ${t} is out of bounds of ${e.liveConsumerNode.length} consumers)`
350
350
  );
351
351
  if (e.liveConsumerNode.length === 1) {
352
352
  (r = e.unwatched) == null || r.call(e.wrapper);
353
353
  for (let o = 0; o < e.producerNode.length; o++)
354
- Z(e.producerNode[o], e.producerIndexOfThis[o]);
354
+ G(e.producerNode[o], e.producerIndexOfThis[o]);
355
355
  }
356
356
  const s = e.liveConsumerNode.length - 1;
357
357
  if (e.liveConsumerNode[t] = e.liveConsumerNode[s], e.liveConsumerIndexOfThis[t] = e.liveConsumerIndexOfThis[s], e.liveConsumerNode.length--, e.liveConsumerIndexOfThis.length--, t < e.liveConsumerNode.length) {
358
- const o = e.liveConsumerIndexOfThis[t], i = e.liveConsumerNode[t];
359
- O(i), i.producerIndexOfThis[o] = t;
358
+ const o = e.liveConsumerIndexOfThis[t], n = e.liveConsumerNode[t];
359
+ I(n), n.producerIndexOfThis[o] = t;
360
360
  }
361
361
  }
362
- function X(e) {
362
+ function Q(e) {
363
363
  var t;
364
364
  return e.consumerIsAlwaysLive || (((t = e?.liveConsumerNode) == null ? void 0 : t.length) ?? 0) > 0;
365
365
  }
366
- function O(e) {
366
+ function I(e) {
367
367
  e.producerNode ?? (e.producerNode = []), e.producerIndexOfThis ?? (e.producerIndexOfThis = []), e.producerLastReadVersion ?? (e.producerLastReadVersion = []);
368
368
  }
369
- function oe(e) {
369
+ function se(e) {
370
370
  e.liveConsumerNode ?? (e.liveConsumerNode = []), e.liveConsumerIndexOfThis ?? (e.liveConsumerIndexOfThis = []);
371
371
  }
372
372
  function ye(e) {
373
- if ($e(e), F(e), e.value === ee)
373
+ if (Ae(e), B(e), e.value === X)
374
374
  throw e.error;
375
375
  return e.value;
376
376
  }
377
- function Ge(e) {
377
+ function Fe(e) {
378
378
  const t = Object.create(Ke);
379
379
  t.computation = e;
380
380
  const r = () => ye(t);
381
- return r[j] = t, r;
381
+ return r[U] = t, r;
382
382
  }
383
- const J = /* @__PURE__ */ Symbol("UNSET"), Q = /* @__PURE__ */ Symbol("COMPUTING"), ee = /* @__PURE__ */ Symbol("ERRORED"), Ke = {
384
- ...se,
385
- value: J,
383
+ const Y = /* @__PURE__ */ Symbol("UNSET"), J = /* @__PURE__ */ Symbol("COMPUTING"), X = /* @__PURE__ */ Symbol("ERRORED"), Ke = {
384
+ ...re,
385
+ value: Y,
386
386
  dirty: !0,
387
387
  error: null,
388
- equal: we,
388
+ equal: $e,
389
389
  producerMustRecompute(e) {
390
- return e.value === J || e.value === Q;
390
+ return e.value === Y || e.value === J;
391
391
  },
392
392
  producerRecomputeValue(e) {
393
- if (e.value === Q)
393
+ if (e.value === J)
394
394
  throw new Error("Detected cycle in computations.");
395
395
  const t = e.value;
396
- e.value = Q;
397
- const r = Fe(e);
396
+ e.value = J;
397
+ const r = Ge(e);
398
398
  let s, o = !1;
399
399
  try {
400
- s = e.computation.call(e.wrapper), o = t !== J && t !== ee && e.equal.call(e.wrapper, t, s);
401
- } catch (i) {
402
- s = ee, e.error = i;
400
+ s = e.computation.call(e.wrapper), o = t !== Y && t !== X && e.equal.call(e.wrapper, t, s);
401
+ } catch (n) {
402
+ s = X, e.error = n;
403
403
  } finally {
404
404
  Ze(e, r);
405
405
  }
@@ -420,146 +420,146 @@ function Qe() {
420
420
  function Xe(e) {
421
421
  const t = Object.create(rt);
422
422
  t.value = e;
423
- const r = () => (F(t), t.value);
424
- return r[j] = t, r;
423
+ const r = () => (B(t), t.value);
424
+ return r[U] = t, r;
425
425
  }
426
426
  function et() {
427
- return F(this), this.value;
427
+ return B(this), this.value;
428
428
  }
429
429
  function tt(e, t) {
430
430
  je() || Qe(), e.equal.call(e.wrapper, e.value, t) || (e.value = t, st(e));
431
431
  }
432
432
  const rt = {
433
- ...se,
434
- equal: we,
433
+ ...re,
434
+ equal: $e,
435
435
  value: void 0
436
436
  };
437
437
  function st(e) {
438
438
  e.version++, Ue(), _e(e);
439
439
  }
440
- const $ = Symbol("node");
441
- var S;
440
+ const A = Symbol("node");
441
+ var C;
442
442
  ((e) => {
443
443
  var t, r, s, o;
444
- class i {
445
- constructor(n, u = {}) {
446
- D(this, r), K(this, t);
447
- const c = Xe(n)[j];
448
- if (this[$] = c, c.wrapper = this, u) {
449
- const v = u.equals;
450
- v && (c.equal = v), c.watched = u[e.subtle.watched], c.unwatched = u[e.subtle.unwatched];
444
+ class n {
445
+ constructor(u, i = {}) {
446
+ V(this, r), F(this, t);
447
+ const c = Xe(u)[U];
448
+ if (this[A] = c, c.wrapper = this, i) {
449
+ const p = i.equals;
450
+ p && (c.equal = p), c.watched = i[e.subtle.watched], c.unwatched = i[e.subtle.unwatched];
451
451
  }
452
452
  }
453
453
  get() {
454
454
  if (!(0, e.isState)(this))
455
455
  throw new TypeError("Wrong receiver type for Signal.State.prototype.get");
456
- return et.call(this[$]);
456
+ return et.call(this[A]);
457
457
  }
458
- set(n) {
458
+ set(u) {
459
459
  if (!(0, e.isState)(this))
460
460
  throw new TypeError("Wrong receiver type for Signal.State.prototype.set");
461
461
  if (qe())
462
462
  throw new Error("Writes to signals not permitted during Watcher callback");
463
- const u = this[$];
464
- tt(u, n);
463
+ const i = this[A];
464
+ tt(i, u);
465
465
  }
466
466
  }
467
- t = $, r = /* @__PURE__ */ new WeakSet(), e.isState = (h) => typeof h == "object" && Y(r, h), e.State = i;
467
+ t = A, r = /* @__PURE__ */ new WeakSet(), e.isState = (l) => typeof l == "object" && K(r, l), e.State = n;
468
468
  class a {
469
469
  // Create a Signal which evaluates to the value returned by the callback.
470
470
  // Callback is called with this signal as the parameter.
471
- constructor(n, u) {
472
- D(this, o), K(this, s);
473
- const c = Ge(n)[j];
474
- if (c.consumerAllowSignalWrites = !0, this[$] = c, c.wrapper = this, u) {
475
- const v = u.equals;
476
- v && (c.equal = v), c.watched = u[e.subtle.watched], c.unwatched = u[e.subtle.unwatched];
471
+ constructor(u, i) {
472
+ V(this, o), F(this, s);
473
+ const c = Fe(u)[U];
474
+ if (c.consumerAllowSignalWrites = !0, this[A] = c, c.wrapper = this, i) {
475
+ const p = i.equals;
476
+ p && (c.equal = p), c.watched = i[e.subtle.watched], c.unwatched = i[e.subtle.unwatched];
477
477
  }
478
478
  }
479
479
  get() {
480
480
  if (!(0, e.isComputed)(this))
481
481
  throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");
482
- return ye(this[$]);
482
+ return ye(this[A]);
483
483
  }
484
484
  }
485
- s = $, o = /* @__PURE__ */ new WeakSet(), e.isComputed = (h) => typeof h == "object" && Y(o, h), e.Computed = a, ((h) => {
486
- var n, u, d, c;
487
- function v(f) {
488
- let p, l = null;
485
+ s = A, o = /* @__PURE__ */ new WeakSet(), e.isComputed = (l) => typeof l == "object" && K(o, l), e.Computed = a, ((l) => {
486
+ var u, i, h, c;
487
+ function p(v) {
488
+ let m, d = null;
489
489
  try {
490
- l = I(null), p = f();
490
+ d = S(null), m = v();
491
491
  } finally {
492
- I(l);
492
+ S(d);
493
493
  }
494
- return p;
494
+ return m;
495
495
  }
496
- h.untrack = v;
497
- function m(f) {
498
- var p;
499
- if (!(0, e.isComputed)(f) && !(0, e.isWatcher)(f))
496
+ l.untrack = p;
497
+ function f(v) {
498
+ var m;
499
+ if (!(0, e.isComputed)(v) && !(0, e.isWatcher)(v))
500
500
  throw new TypeError("Called introspectSources without a Computed or Watcher argument");
501
- return ((p = f[$].producerNode) == null ? void 0 : p.map((l) => l.wrapper)) ?? [];
501
+ return ((m = v[A].producerNode) == null ? void 0 : m.map((d) => d.wrapper)) ?? [];
502
502
  }
503
- h.introspectSources = m;
504
- function _(f) {
505
- var p;
506
- if (!(0, e.isComputed)(f) && !(0, e.isState)(f))
503
+ l.introspectSources = f;
504
+ function y(v) {
505
+ var m;
506
+ if (!(0, e.isComputed)(v) && !(0, e.isState)(v))
507
507
  throw new TypeError("Called introspectSinks without a Signal argument");
508
- return ((p = f[$].liveConsumerNode) == null ? void 0 : p.map((l) => l.wrapper)) ?? [];
508
+ return ((m = v[A].liveConsumerNode) == null ? void 0 : m.map((d) => d.wrapper)) ?? [];
509
509
  }
510
- h.introspectSinks = _;
511
- function N(f) {
512
- if (!(0, e.isComputed)(f) && !(0, e.isState)(f))
510
+ l.introspectSinks = y;
511
+ function _(v) {
512
+ if (!(0, e.isComputed)(v) && !(0, e.isState)(v))
513
513
  throw new TypeError("Called hasSinks without a Signal argument");
514
- const p = f[$].liveConsumerNode;
515
- return p ? p.length > 0 : !1;
514
+ const m = v[A].liveConsumerNode;
515
+ return m ? m.length > 0 : !1;
516
516
  }
517
- h.hasSinks = N;
518
- function g(f) {
519
- if (!(0, e.isComputed)(f) && !(0, e.isWatcher)(f))
517
+ l.hasSinks = _;
518
+ function Z(v) {
519
+ if (!(0, e.isComputed)(v) && !(0, e.isWatcher)(v))
520
520
  throw new TypeError("Called hasSources without a Computed or Watcher argument");
521
- const p = f[$].producerNode;
522
- return p ? p.length > 0 : !1;
521
+ const m = v[A].producerNode;
522
+ return m ? m.length > 0 : !1;
523
523
  }
524
- h.hasSources = g;
525
- class z {
524
+ l.hasSources = Z;
525
+ class xe {
526
526
  // When a (recursive) source of Watcher is written to, call this callback,
527
527
  // if it hasn't already been called since the last `watch` call.
528
528
  // No signals may be read or written during the notify.
529
- constructor(p) {
530
- D(this, u), D(this, d), K(this, n);
531
- let l = Object.create(se);
532
- l.wrapper = this, l.consumerMarkedDirty = p, l.consumerIsAlwaysLive = !0, l.consumerAllowSignalWrites = !1, l.producerNode = [], this[$] = l;
529
+ constructor(m) {
530
+ V(this, i), V(this, h), F(this, u);
531
+ let d = Object.create(re);
532
+ d.wrapper = this, d.consumerMarkedDirty = m, d.consumerIsAlwaysLive = !0, d.consumerAllowSignalWrites = !1, d.producerNode = [], this[A] = d;
533
533
  }
534
534
  // Add these signals to the Watcher's set, and set the watcher to run its
535
535
  // notify callback next time any signal in the set (or one of its dependencies) changes.
536
536
  // Can be called with no arguments just to reset the "notified" state, so that
537
537
  // the notify callback will be invoked again.
538
- watch(...p) {
538
+ watch(...m) {
539
539
  if (!(0, e.isWatcher)(this))
540
540
  throw new TypeError("Called unwatch without Watcher receiver");
541
- de(this, d, c).call(this, p);
542
- const l = this[$];
543
- l.dirty = !1;
544
- const y = I(l);
545
- for (const V of p)
546
- F(V[$]);
547
- I(y);
541
+ de(this, h, c).call(this, m);
542
+ const d = this[A];
543
+ d.dirty = !1;
544
+ const g = S(d);
545
+ for (const L of m)
546
+ B(L[A]);
547
+ S(g);
548
548
  }
549
549
  // Remove these signals from the watched set (e.g., for an effect which is disposed)
550
- unwatch(...p) {
550
+ unwatch(...m) {
551
551
  if (!(0, e.isWatcher)(this))
552
552
  throw new TypeError("Called unwatch without Watcher receiver");
553
- de(this, d, c).call(this, p);
554
- const l = this[$];
555
- O(l);
556
- for (let y = l.producerNode.length - 1; y >= 0; y--)
557
- if (p.includes(l.producerNode[y].wrapper)) {
558
- Z(l.producerNode[y], l.producerIndexOfThis[y]);
559
- const V = l.producerNode.length - 1;
560
- if (l.producerNode[y] = l.producerNode[V], l.producerIndexOfThis[y] = l.producerIndexOfThis[V], l.producerNode.length--, l.producerIndexOfThis.length--, l.nextProducerIndex--, y < l.producerNode.length) {
561
- const Te = l.producerIndexOfThis[y], ie = l.producerNode[y];
562
- oe(ie), ie.liveConsumerIndexOfThis[Te] = y;
553
+ de(this, h, c).call(this, m);
554
+ const d = this[A];
555
+ I(d);
556
+ for (let g = d.producerNode.length - 1; g >= 0; g--)
557
+ if (m.includes(d.producerNode[g].wrapper)) {
558
+ G(d.producerNode[g], d.producerIndexOfThis[g]);
559
+ const L = d.producerNode.length - 1;
560
+ if (d.producerNode[g] = d.producerNode[L], d.producerIndexOfThis[g] = d.producerIndexOfThis[L], d.producerNode.length--, d.producerIndexOfThis.length--, d.nextProducerIndex--, g < d.producerNode.length) {
561
+ const Ee = d.producerIndexOfThis[g], oe = d.producerNode[g];
562
+ se(oe), oe.liveConsumerIndexOfThis[Ee] = g;
563
563
  }
564
564
  }
565
565
  }
@@ -568,134 +568,179 @@ var S;
568
568
  getPending() {
569
569
  if (!(0, e.isWatcher)(this))
570
570
  throw new TypeError("Called getPending without Watcher receiver");
571
- return this[$].producerNode.filter((l) => l.dirty).map((l) => l.wrapper);
571
+ return this[A].producerNode.filter((d) => d.dirty).map((d) => d.wrapper);
572
572
  }
573
573
  }
574
- n = $, u = /* @__PURE__ */ new WeakSet(), d = /* @__PURE__ */ new WeakSet(), c = function(f) {
575
- for (const p of f)
576
- if (!(0, e.isComputed)(p) && !(0, e.isState)(p))
574
+ u = A, i = /* @__PURE__ */ new WeakSet(), h = /* @__PURE__ */ new WeakSet(), c = function(v) {
575
+ for (const m of v)
576
+ if (!(0, e.isComputed)(m) && !(0, e.isState)(m))
577
577
  throw new TypeError("Called watch/unwatch without a Computed or State argument");
578
- }, e.isWatcher = (f) => Y(u, f), h.Watcher = z;
579
- function xe() {
580
- var f;
581
- return (f = De()) == null ? void 0 : f.wrapper;
578
+ }, e.isWatcher = (v) => K(i, v), l.Watcher = xe;
579
+ function Te() {
580
+ var v;
581
+ return (v = De()) == null ? void 0 : v.wrapper;
582
582
  }
583
- h.currentComputed = xe, h.watched = Symbol("watched"), h.unwatched = Symbol("unwatched");
583
+ l.currentComputed = Te, l.watched = Symbol("watched"), l.unwatched = Symbol("unwatched");
584
584
  })(e.subtle || (e.subtle = {}));
585
- })(S || (S = {}));
585
+ })(C || (C = {}));
586
586
  const ot = /* @__PURE__ */ new Set(["internals", "effect", "styleProps"]);
587
587
  function it(e) {
588
588
  return `--${e.replaceAll(/([a-z0-9])([A-Z])/g, "$1-$2").replaceAll(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").toLowerCase()}`;
589
589
  }
590
590
  function ct(e, t, r) {
591
- const { setup: s, attributes: o, styles: i } = Ce(e, t, r);
592
- Ne({ setup: s, attributes: o, styles: i, useShadow: !1 });
591
+ const { setup: s, attributes: o, styles: n } = Ce(e, t, r);
592
+ Ne({ setup: s, attributes: o, styles: n, useShadow: !1 });
593
593
  }
594
594
  function at(e, t, r) {
595
- const { setup: s, attributes: o, styles: i } = Ce(e, t, r);
596
- Ne({ setup: s, attributes: o, styles: i, useShadow: !0 });
595
+ const { setup: s, attributes: o, styles: n } = Ce(e, t, r);
596
+ Ne({ setup: s, attributes: o, styles: n, useShadow: !0 });
597
597
  }
598
598
  function Ce(e, t, r) {
599
599
  return typeof e == "function" ? { setup: e } : typeof e == "string" ? { styles: e, setup: t } : typeof t == "function" ? { attributes: e, setup: t } : { attributes: e, styles: t, setup: r };
600
600
  }
601
- const lt = (e) => new S.State(e);
601
+ const lt = (e) => new C.State(e), ht = (e) => new C.Computed(e);
602
602
  function Ne(e) {
603
603
  const {
604
604
  setup: t,
605
605
  tagName: r,
606
606
  attributes: s = [],
607
607
  useShadow: o = !0,
608
- formAssociated: i = !1,
608
+ formAssociated: n = !1,
609
609
  styles: a
610
- } = e, h = r ?? t.name.replaceAll(/([a-z0-9])([A-Z])/g, "$1-$2").replaceAll(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").toLowerCase();
611
- if (!h.includes("-"))
610
+ } = e, l = r ?? t.name.replaceAll(/([a-z0-9])([A-Z])/g, "$1-$2").replaceAll(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").toLowerCase();
611
+ if (!l.includes("-"))
612
612
  throw new Error(`Function ${t.name} must include at least one capital letter to be converted to a valid custom element name`);
613
- if (customElements.get(h))
614
- throw new Error(`Custom element with name ${h} already defined`);
615
- for (const u of s)
616
- if (ot.has(u))
617
- throw new Error(`Attribute name "${u}" conflicts with a reserved context property.`);
618
- let n;
619
- a !== void 0 && (n = new CSSStyleSheet(), o ? n.replaceSync(a) : (n.replaceSync(`@scope (${h}) { ${a} }`), document.adoptedStyleSheets = [
613
+ if (customElements.get(l))
614
+ throw new Error(`Custom element with name ${l} already defined`);
615
+ s.forEach((i) => {
616
+ if (ot.has(i))
617
+ throw new Error(`Attribute name "${i}" conflicts with a reserved context property.`);
618
+ });
619
+ let u;
620
+ a !== void 0 && (u = new CSSStyleSheet(), o ? u.replaceSync(a) : (u.replaceSync(`@scope (${l}) { ${a} }`), document.adoptedStyleSheets = [
620
621
  ...document.adoptedStyleSheets,
621
- n
622
- ])), customElements.define(h, class extends HTMLElement {
622
+ u
623
+ ])), customElements.define(l, class extends HTMLElement {
623
624
  #e;
624
625
  #t;
626
+ #r;
625
627
  #s = [];
626
- #r = [];
627
628
  #o = /* @__PURE__ */ new Map();
628
629
  static get observedAttributes() {
629
630
  return s;
630
631
  }
631
632
  static get formAssociated() {
632
- return i;
633
+ return n;
633
634
  }
634
635
  constructor() {
635
- super(), o && this.attachShadow({ mode: "open" }), n && this.shadowRoot && (this.shadowRoot.adoptedStyleSheets = [
636
+ super(), o && this.attachShadow({ mode: "open" }), u && this.shadowRoot && (this.shadowRoot.adoptedStyleSheets = [
636
637
  ...this.shadowRoot.adoptedStyleSheets,
637
- n
638
+ u
638
639
  ]);
639
- const u = {
640
+ const i = {
640
641
  internals: this.attachInternals(),
641
- effect: (m) => {
642
- this.#s.push(m);
643
- },
644
- styleProps: (m) => {
645
- for (const _ in m) {
646
- const N = m[_], g = it(_);
647
- N === null ? this.style.removeProperty(g) : this.style.setProperty(g, String(N));
648
- }
642
+ effect: (p) => this.#s.push({ fn: p }),
643
+ styleProps: (p) => {
644
+ Object.keys(p).forEach((f) => {
645
+ const y = p[f], _ = it(f);
646
+ y === null ? this.style.removeProperty(_) : this.style.setProperty(_, String(y));
647
+ });
649
648
  }
650
649
  };
651
- s.forEach((m) => {
652
- const _ = new S.State(this.getAttribute(m), {
653
- equals: (g, z) => g === z
650
+ s.forEach((p) => {
651
+ const f = new C.State(this.getAttribute(p), {
652
+ equals: (_, Z) => _ === Z
654
653
  });
655
- this.#o.set(m, _), u[m] = _, Object.defineProperty(this, m, {
654
+ this.#o.set(p, f), i[p] = f, Object.defineProperty(this, p, {
656
655
  get() {
657
- return _.get();
656
+ return f.get();
658
657
  },
659
- set(g) {
660
- if (g !== null && typeof g != "string")
661
- throw new TypeError(`Attribute "${m}" only accepts strings or null, got ${typeof g}.`);
662
- _.set(g);
658
+ set(_) {
659
+ if (_ !== null && typeof _ != "string")
660
+ throw new TypeError(`Attribute "${p}" only accepts strings or null, got ${typeof _}.`);
661
+ f.set(_);
663
662
  },
664
663
  enumerable: !0,
665
664
  configurable: !0
666
665
  });
667
- const N = new S.subtle.Watcher(() => {
666
+ const y = new C.subtle.Watcher(() => {
668
667
  queueMicrotask(() => {
669
- const g = _.get();
670
- g === null ? this.removeAttribute(m) : this.setAttribute(m, g), N.watch();
668
+ const _ = f.get();
669
+ _ === null ? this.removeAttribute(p) : this.setAttribute(p, _), y.watch();
671
670
  });
672
671
  });
673
- N.watch(_);
672
+ y.watch(f);
674
673
  });
675
- const d = t.call(this, u);
676
- this.#e = new S.Computed(() => d());
677
- const c = () => He(this.#e.get(), o ? this.shadowRoot : this);
678
- let v = !1;
679
- this.#t = new S.subtle.Watcher(() => {
680
- v || (v = !0, queueMicrotask(() => {
681
- v = !1, c(), this.#t.watch();
682
- }));
683
- }), this.#t.watch(this.#e), c();
674
+ const h = t.call(this, i), c = o ? this.shadowRoot : this;
675
+ if (typeof h == "function") {
676
+ this.#e = new C.Computed(() => h()), this.#r = () => {
677
+ const f = this.#e.get();
678
+ typeof f == "string" ? c.innerHTML = f : he(f, c);
679
+ };
680
+ let p = !1;
681
+ this.#t = new C.subtle.Watcher(() => {
682
+ p || (p = !0, queueMicrotask(() => {
683
+ p = !1;
684
+ try {
685
+ this.#r();
686
+ } catch (f) {
687
+ console.error(
688
+ `Error in render function for <${l}> fun element: `,
689
+ f
690
+ );
691
+ }
692
+ this.#t.watch();
693
+ }));
694
+ });
695
+ } else if (typeof h == "string")
696
+ c.innerHTML = h;
697
+ else if (typeof h == "object" && "_$litType$" in h)
698
+ he(h, c);
699
+ else {
700
+ if (h === void 0)
701
+ return;
702
+ console.error(
703
+ `Setup function for <${l}> returned an unexpected value. Expected a render function, a template (html\`...\`), a string, or nothing. Got: ${typeof h}`
704
+ );
705
+ }
684
706
  }
685
707
  connectedCallback() {
686
- this.#t.watch(this.#e), this.#r = this.#s.map((u) => u()).filter(
687
- (u) => typeof u == "function"
688
- );
708
+ this.#t && this.#e && (this.#t.watch(this.#e), this.#r?.()), this.#s.forEach((i) => {
709
+ try {
710
+ i.computed = new C.Computed(() => i.fn()), i.watcher = new C.subtle.Watcher(() => {
711
+ queueMicrotask(() => {
712
+ typeof i.cleanup == "function" && i.cleanup(), i.computed = new C.Computed(() => i.fn());
713
+ try {
714
+ i.cleanup = i.computed.get();
715
+ } catch (h) {
716
+ console.error(
717
+ `Error in effect for <${l}> fun element: `,
718
+ h
719
+ );
720
+ }
721
+ i.watcher.watch(i.computed);
722
+ });
723
+ }), i.cleanup = i.computed.get(), i.watcher.watch(i.computed);
724
+ } catch (h) {
725
+ console.error(
726
+ `Error in effect for <${l}> fun element: `,
727
+ h
728
+ );
729
+ }
730
+ });
689
731
  }
690
732
  disconnectedCallback() {
691
- this.#t.unwatch(this.#e), this.#r.forEach((u) => u()), this.#r = [];
733
+ this.#t && this.#e && this.#t.unwatch(this.#e), this.#s.forEach((i) => {
734
+ i.watcher.unwatch(i.computed), typeof i.cleanup == "function" && i.cleanup(), i.cleanup = void 0;
735
+ });
692
736
  }
693
- attributeChangedCallback(u, d, c) {
694
- this.#o.get(u)?.set(c);
737
+ attributeChangedCallback(i, h, c) {
738
+ this.#o.get(i)?.set(c);
695
739
  }
696
740
  });
697
741
  }
698
742
  export {
743
+ ht as computed,
699
744
  Ne as define,
700
745
  nt as html,
701
746
  ct as lightElement,