wrec 0.24.3 → 0.24.4

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.
Files changed (2) hide show
  1. package/dist/wrec.es.js +683 -781
  2. package/package.json +1 -1
package/dist/wrec.es.js CHANGED
@@ -1,67 +1,67 @@
1
- var D = (r) => {
2
- throw TypeError(r);
1
+ var Tt = (c) => {
2
+ throw TypeError(c);
3
3
  };
4
- var N = (r, t, e) => t.has(r) || D("Cannot " + e);
5
- var p = (r, t, e) => (N(r, t, "read from private field"), e ? e.call(r) : t.get(r)), b = (r, t, e) => t.has(r) ? D("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e), E = (r, t, e, s) => (N(r, t, "write to private field"), s ? s.call(r, e) : t.set(r, e), e), V = (r, t, e) => (N(r, t, "access private method"), e);
6
- import W from "xss";
7
- function Y(r, t, e = "") {
8
- const s = /* @__PURE__ */ new WeakMap(), i = {
4
+ var et = (c, a, t) => a.has(c) || Tt("Cannot " + t);
5
+ var h = (c, a, t) => (et(c, a, "read from private field"), t ? t.call(c) : a.get(c)), y = (c, a, t) => a.has(c) ? Tt("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(c) : a.set(c, t), M = (c, a, t, e) => (et(c, a, "write to private field"), e ? e.call(c, t) : a.set(c, t), t), f = (c, a, t) => (et(c, a, "access private method"), t);
6
+ import Mt from "xss";
7
+ function Rt(c, a, t = "") {
8
+ const e = /* @__PURE__ */ new WeakMap(), s = {
9
9
  // Intercept property reads.
10
10
  // This creates nested proxies lazily.
11
11
  get(o, n) {
12
- const c = Reflect.get(o, n);
13
- if (c === null || typeof c != "object") return c;
14
- const a = s.get(c);
15
- if (a) return a;
16
- const f = e ? `${e}.${n}` : n, h = Y(c, t, f);
17
- return s.set(c, h), h;
12
+ const r = Reflect.get(o, n);
13
+ if (r === null || typeof r != "object") return r;
14
+ const l = e.get(r);
15
+ if (l) return l;
16
+ const u = t ? `${t}.${n}` : n, p = Rt(r, a, u);
17
+ return e.set(r, p), p;
18
18
  },
19
19
  // Intercept property writes.
20
- set(o, n, c) {
21
- const a = Reflect.get(o, n);
22
- if (a !== c) {
23
- Reflect.set(o, n, c);
24
- const f = e ? `${e}.${n}` : n;
25
- t(f, a, c);
20
+ set(o, n, r) {
21
+ const l = Reflect.get(o, n);
22
+ if (l !== r) {
23
+ Reflect.set(o, n, r);
24
+ const u = t ? `${t}.${n}` : n;
25
+ a(u, l, r);
26
26
  }
27
27
  return !0;
28
28
  }
29
29
  };
30
- return new Proxy(r, i);
30
+ return new Proxy(c, s);
31
31
  }
32
- function G(r) {
33
- const t = {};
34
- for (const [e, s] of Object.entries(r)) {
35
- const i = typeof s == "object" && s !== null;
36
- t[e] = i ? G(s) : s;
32
+ function Ot(c) {
33
+ const a = {};
34
+ for (const [t, e] of Object.entries(c)) {
35
+ const s = typeof e == "object" && e !== null;
36
+ a[t] = s ? Ot(e) : e;
37
37
  }
38
- return t;
38
+ return a;
39
39
  }
40
- const P = typeof window < "u" && typeof window.document < "u";
41
- let z = class extends Error {
40
+ const Z = typeof window < "u" && typeof window.document < "u";
41
+ let At = class extends Error {
42
42
  };
43
- var w, R, m, x, C, g, O, Q;
44
- const T = class T {
45
- constructor(t, e, s) {
46
- b(this, O);
47
- b(this, R, /* @__PURE__ */ Symbol("objectId"));
43
+ var P, Q, A, K, U, x, tt, Nt;
44
+ const O = class O {
45
+ constructor(a, t, e) {
46
+ y(this, tt);
47
+ y(this, Q, /* @__PURE__ */ Symbol("objectId"));
48
48
  // This cannot be replaced by a WeakMap<ChangeListener, Set<string>>
49
49
  // because there is no way to iterate over the keys of a WeakMap.
50
- b(this, m, []);
51
- b(this, x);
52
- b(this, C);
53
- b(this, g);
54
- if (!t) throw new z("name cannot be empty");
55
- if (p(T, w).has(t))
56
- throw new z(`WrecState with name "${t}" already exists`);
57
- if (E(this, x, t), E(this, C, e), E(this, g, Y({}, V(this, O, Q).bind(this))), e && P) {
58
- const i = sessionStorage.getItem("wrec-state-" + t), o = i ? JSON.parse(i) : void 0;
59
- o && (s = o);
60
- }
61
- if (s)
62
- for (const [i, o] of Object.entries(s))
63
- this.addProperty(i, o);
64
- p(T, w).set(t, this);
50
+ y(this, A, []);
51
+ y(this, K);
52
+ y(this, U);
53
+ y(this, x);
54
+ if (!a) throw new At("name cannot be empty");
55
+ if (h(O, P).has(a))
56
+ throw new At(`WrecState with name "${a}" already exists`);
57
+ if (M(this, K, a), M(this, U, t), M(this, x, Rt({}, f(this, tt, Nt).bind(this))), t && Z) {
58
+ const s = sessionStorage.getItem("wrec-state-" + a), o = s ? JSON.parse(s) : void 0;
59
+ o && (e = o);
60
+ }
61
+ if (e)
62
+ for (const [s, o] of Object.entries(e))
63
+ this.addProperty(s, o);
64
+ h(O, P).set(a, this);
65
65
  }
66
66
  // This static method is useful for accessing a specific WrecState object
67
67
  // from the DevTools console. For example:
@@ -73,142 +73,142 @@ const T = class T {
73
73
  // Properties can be directly modified as follows:
74
74
  // state.color = 'blue';
75
75
  // state.team.leader.name = 'Mark';
76
- static get(t) {
77
- return p(this, w).get(t);
76
+ static get(a) {
77
+ return h(this, P).get(a);
78
78
  }
79
79
  /**
80
80
  * @param listener - object that has a "changed" method
81
81
  * @param map - map from state property paths to component properties
82
82
  */
83
- addListener(t, e = {}) {
84
- const s = p(this, m).find(
85
- (i) => i.listenerRef.deref() === t
83
+ addListener(a, t = {}) {
84
+ const e = h(this, A).find(
85
+ (s) => s.listenerRef.deref() === a
86
86
  );
87
- if (s) {
88
- const { propertyMap: i } = s;
89
- for (const [o, n] of Object.entries(e))
90
- i[o] = n;
87
+ if (e) {
88
+ const { propertyMap: s } = e;
89
+ for (const [o, n] of Object.entries(t))
90
+ s[o] = n;
91
91
  } else
92
- p(this, m).push({
93
- listenerRef: new WeakRef(t),
94
- propertyMap: e
92
+ h(this, A).push({
93
+ listenerRef: new WeakRef(a),
94
+ propertyMap: t
95
95
  });
96
96
  }
97
- addProperty(t, e) {
98
- Object.defineProperty(this, t, {
97
+ addProperty(a, t) {
98
+ Object.defineProperty(this, a, {
99
99
  enumerable: !0,
100
100
  get() {
101
- return p(this, g)[t];
101
+ return h(this, x)[a];
102
102
  },
103
- set(s) {
104
- p(this, g)[t] = s;
103
+ set(e) {
104
+ h(this, x)[a] = e;
105
105
  }
106
- }), p(this, g)[t] = e;
106
+ }), h(this, x)[a] = t;
107
107
  }
108
108
  get id() {
109
- return p(this, R);
109
+ return h(this, Q);
110
110
  }
111
111
  // This is useful for debugging from the DevTools console.
112
112
  // For example: state.log()
113
113
  log() {
114
- console.log("WrecState:", p(this, x));
115
- for (const [t, e] of Object.entries(p(this, g)))
116
- console.log(` ${t} = ${JSON.stringify(e)}`);
114
+ console.log("WrecState:", h(this, K));
115
+ for (const [a, t] of Object.entries(h(this, x)))
116
+ console.log(` ${a} = ${JSON.stringify(t)}`);
117
117
  }
118
- removeListener(t) {
119
- E(this, m, p(this, m).filter((e) => e.listenerRef.deref() !== t));
118
+ removeListener(a) {
119
+ M(this, A, h(this, A).filter((t) => t.listenerRef.deref() !== a));
120
120
  }
121
121
  };
122
- w = new WeakMap(), R = new WeakMap(), m = new WeakMap(), x = new WeakMap(), C = new WeakMap(), g = new WeakMap(), O = new WeakSet(), Q = function(t, e, s) {
123
- const i = /* @__PURE__ */ new Set();
124
- for (const o of p(this, m)) {
122
+ P = new WeakMap(), Q = new WeakMap(), A = new WeakMap(), K = new WeakMap(), U = new WeakMap(), x = new WeakMap(), tt = new WeakSet(), Nt = function(a, t, e) {
123
+ const s = /* @__PURE__ */ new Set();
124
+ for (const o of h(this, A)) {
125
125
  const n = o.listenerRef.deref();
126
126
  if (!n)
127
- i.add(o);
128
- else if (P && n instanceof HTMLElement && !n.isConnected)
129
- i.add(o);
127
+ s.add(o);
128
+ else if (Z && n instanceof HTMLElement && !n.isConnected)
129
+ s.add(o);
130
130
  else {
131
- const { propertyMap: c } = o, a = Object.keys(c);
132
- (a.length === 0 || a.includes(t)) && n.changed(
133
- t,
134
- c[t],
135
- s,
131
+ const { propertyMap: r } = o, l = Object.keys(r);
132
+ (l.length === 0 || l.includes(a)) && n.changed(
133
+ a,
134
+ r[a],
136
135
  e,
136
+ t,
137
137
  this
138
138
  );
139
139
  }
140
140
  }
141
- E(this, m, p(this, m).filter(
142
- (o) => !i.has(o)
141
+ M(this, A, h(this, A).filter(
142
+ (o) => !s.has(o)
143
143
  ));
144
- }, b(T, w, /* @__PURE__ */ new Map()), P && window.addEventListener("beforeunload", () => {
145
- for (const [t, e] of p(T, w).entries())
146
- if (p(e, C)) {
147
- const s = G(e);
148
- sessionStorage.setItem("wrec-state-" + t, JSON.stringify(s));
144
+ }, y(O, P, /* @__PURE__ */ new Map()), Z && window.addEventListener("beforeunload", () => {
145
+ for (const [a, t] of h(O, P).entries())
146
+ if (h(t, U)) {
147
+ const e = Ot(t);
148
+ sessionStorage.setItem("wrec-state-" + a, JSON.stringify(e));
149
149
  }
150
150
  });
151
- let _ = T;
152
- P && process.env.NODE_ENV === "development" && (window.WrecState = _);
153
- function q(r, t) {
154
- let e = r;
155
- for (const s of t.split("."))
156
- e = e[s];
157
- return e;
151
+ let rt = O;
152
+ Z && process.env.NODE_ENV === "development" && (window.WrecState = rt);
153
+ function St(c, a) {
154
+ let t = c;
155
+ for (const e of a.split("."))
156
+ t = t[e];
157
+ return t;
158
158
  }
159
- function nt(r, t, e) {
160
- const s = t.split("."), i = s.length - 1;
161
- let o = r;
162
- s.forEach((n, c) => {
163
- c === i ? o[n] = e : o = o[n];
159
+ function Gt(c, a, t) {
160
+ const e = a.split("."), s = e.length - 1;
161
+ let o = c;
162
+ e.forEach((n, r) => {
163
+ r === s ? o[n] = t : o = o[n];
164
164
  });
165
165
  }
166
- const rt = /* @__PURE__ */ new Set(["button", "input", "label", "option", "th"]), J = "__WREC", X = "__";
167
- function ct(r) {
168
- const t = {
166
+ const Qt = /* @__PURE__ */ new Set(["button", "input", "label", "option", "th"]), vt = "__WREC", xt = "__";
167
+ function te(c) {
168
+ const a = {
169
169
  allowCommentTag: !0,
170
- onTag: (i, o) => {
171
- if (rt.has(i)) return o;
170
+ onTag: (s, o) => {
171
+ if (Qt.has(s)) return o;
172
172
  },
173
- onTagAttr(i, o, n) {
173
+ onTagAttr(s, o, n) {
174
174
  if (o.startsWith("on")) return "";
175
175
  },
176
- safeAttrValue(i, o, n) {
177
- return o === "class" || i === "a" && o === "href" && !n.startsWith("javascript") || i === "img" && o === "src" ? n : "";
176
+ safeAttrValue(s, o, n) {
177
+ return o === "class" || s === "a" && o === "href" && !n.startsWith("javascript") || s === "img" && o === "src" ? n : "";
178
178
  },
179
179
  stripIgnoreTagBody: ["script", "style", "iframe"],
180
180
  whiteList: {
181
- ...W.getDefaultWhiteList(),
181
+ ...Mt.getDefaultWhiteList(),
182
182
  label: ["class", "for"],
183
183
  span: ["class"]
184
184
  }
185
- }, e = [];
186
- r = r.replace(/<!--[\s\S]*?-->/g, (i) => {
185
+ }, t = [];
186
+ c = c.replace(/<!--[\s\S]*?-->/g, (s) => {
187
187
  let o = "";
188
188
  do
189
- o = J + e.length + X;
190
- while (r.includes(o));
191
- return e.push(i), o;
189
+ o = vt + t.length + xt;
190
+ while (c.includes(o));
191
+ return t.push(s), o;
192
192
  });
193
- let s = W(r, t);
194
- return e.forEach((i, o) => {
193
+ let e = Mt(c, a);
194
+ return t.forEach((s, o) => {
195
195
  const n = new RegExp(
196
- `${J}${o}${X}`,
196
+ `${vt}${o}${xt}`,
197
197
  "g"
198
198
  );
199
- s = s.replace(n, i);
200
- }), s;
199
+ e = e.replace(n, s);
200
+ }), e;
201
201
  }
202
- const at = /* @__PURE__ */ new Set([
202
+ const ee = /* @__PURE__ */ new Set([
203
203
  "class",
204
204
  "disabled",
205
205
  "hidden",
206
206
  "id",
207
207
  "tabindex",
208
208
  "title"
209
- ]), ft = globalThis.HTMLElement ?? class {
210
- }, F = globalThis.customElements ?? {
211
- get: (r) => {
209
+ ]), se = globalThis.HTMLElement ?? class {
210
+ }, ct = globalThis.customElements ?? {
211
+ get: (c) => {
212
212
  },
213
213
  getName: () => "",
214
214
  define: () => {
@@ -219,230 +219,186 @@ const at = /* @__PURE__ */ new Set([
219
219
  new Error("customElements is not available in this environment")
220
220
  )
221
221
  };
222
- class y extends Error {
222
+ class v extends Error {
223
223
  }
224
- const ht = /([a-zA-Z-]+)\s*:\s*([^;}]+)/g, tt = "a-zA-Z_$", lt = tt + "0-9", M = `[${tt}][${lt}]*`, K = new RegExp(`this\\.(${M})\\s*\\(`, "g"), pt = /<!--\s*(.*?)\s*-->/, ut = /<(\w+)(?:\s[^>]*)?>((?:[^<]|<(?!\w))*?)<\/\1>/g, L = new RegExp(`^this\\.${M}$`), j = new RegExp(`this\\.${M}(\\.${M})*`, "g"), et = new RegExp(`this\\.${M}(\\.${M})*`), dt = 5;
225
- function mt(r) {
226
- return r instanceof HTMLButtonElement || r instanceof HTMLFieldSetElement || r instanceof HTMLInputElement || r instanceof HTMLSelectElement || r instanceof HTMLTextAreaElement || r instanceof d;
224
+ const oe = /([a-zA-Z-]+)\s*:\s*([^;}]+)/g, Lt = "a-zA-Z_$", ie = Lt + "0-9", I = `[${Lt}][${ie}]*`, Ct = new RegExp(`this\\.(${I})\\s*\\(`, "g"), ne = /<!--\s*(.*?)\s*-->/, re = /<(\w+)(?:\s[^>]*)?>((?:[^<]|<(?!\w))*?)<\/\1>/g, st = new RegExp(`^this\\.${I}$`), ot = new RegExp(`this\\.${I}(\\.${I})*`, "g"), jt = new RegExp(`this\\.${I}(\\.${I})*`), ce = 5;
225
+ function ae(c) {
226
+ return c instanceof HTMLButtonElement || c instanceof HTMLFieldSetElement || c instanceof HTMLInputElement || c instanceof HTMLSelectElement || c instanceof HTMLTextAreaElement || c instanceof X;
227
227
  }
228
- function Mt(r, t, e) {
229
- const s = document.createElement(r);
230
- if (t)
231
- for (const [i, o] of Object.entries(t))
232
- s.setAttribute(i, o);
233
- return e && (s.innerHTML = e), s;
228
+ function me(c, a, t) {
229
+ const e = document.createElement(c);
230
+ if (a)
231
+ for (const [s, o] of Object.entries(a))
232
+ e.setAttribute(s, o);
233
+ return t && (e.innerHTML = t), e;
234
234
  }
235
- const U = (r) => Array.isArray(r.values) && r.values.length > 0 ? r.values[0] : bt(r.type), bt = (r) => r === String ? "" : r === Number ? 0 : r === Boolean ? !1 : r === Array ? [] : r === Object ? {} : void 0;
236
- function $(r) {
237
- const t = [];
238
- let e = r.firstElementChild;
239
- for (; e; )
240
- t.push(e), e.shadowRoot && t.push(...$(e.shadowRoot)), e.firstElementChild && t.push(...$(e)), e = e.nextElementSibling;
241
- return t;
235
+ const Pt = (c) => Array.isArray(c.values) && c.values.length > 0 ? c.values[0] : fe(c.type), fe = (c) => c === String ? "" : c === Number ? 0 : c === Boolean ? !1 : c === Array ? [] : c === Object ? {} : void 0;
236
+ function G(c) {
237
+ const a = [];
238
+ let t = c.firstElementChild;
239
+ for (; t; )
240
+ a.push(t), t.shadowRoot && a.push(...G(t.shadowRoot)), t.firstElementChild && a.push(...G(t)), t = t.nextElementSibling;
241
+ return a;
242
242
  }
243
- const A = (r) => r.substring(dt).split(".")[0];
244
- function st(r, t) {
245
- let e = r[0];
246
- return t.forEach((s, i) => {
247
- e += s + r[i + 1];
248
- }), e;
243
+ const D = (c) => c.substring(ce).split(".")[0];
244
+ function Ht(c, a) {
245
+ let t = c[0];
246
+ return a.forEach((e, s) => {
247
+ t += e + c[s + 1];
248
+ }), t;
249
249
  }
250
- function I(r) {
251
- const t = typeof r;
252
- return t === "string" || t === "number" || t === "boolean";
250
+ function at(c) {
251
+ const a = typeof c;
252
+ return a === "string" || a === "number" || a === "boolean";
253
253
  }
254
- function S(r) {
255
- return r.localName === "textarea";
254
+ function _(c) {
255
+ return c.localName === "textarea";
256
256
  }
257
- function B(r) {
258
- const { localName: t } = r;
259
- return t === "input" || t === "select";
257
+ function Et(c) {
258
+ const { localName: a } = c;
259
+ return a === "input" || a === "select";
260
260
  }
261
- const yt = (r) => r.replace(/<!--[\s\S]*?-->/g, "");
262
- function ot(r, t, e, s) {
263
- return r.slice(0, t) + s + r.slice(t + e);
261
+ const he = (c) => c.replace(/<!--[\s\S]*?-->/g, "");
262
+ function kt(c, a, t, e) {
263
+ return c.slice(0, a) + e + c.slice(a + t);
264
264
  }
265
- function H(r) {
266
- const t = Number(r);
267
- if (isNaN(t)) throw new y(`can't convert "${r}" to a number`);
268
- return t;
265
+ function it(c) {
266
+ const a = Number(c);
267
+ if (isNaN(a)) throw new v(`can't convert "${c}" to a number`);
268
+ return a;
269
269
  }
270
- function it(r, t, e) {
271
- const [s, i] = t.split(":");
272
- if (I(e))
273
- if (typeof e == "boolean") {
274
- e ? r.setAttribute(s, s) : r.removeAttribute(s);
275
- const o = d.getPropName(s);
276
- r[o] = e;
270
+ function Ft(c, a, t) {
271
+ const [e, s] = a.split(":");
272
+ if (at(t))
273
+ if (typeof t == "boolean") {
274
+ t ? c.setAttribute(e, e) : c.removeAttribute(e);
275
+ const o = X.getPropName(e);
276
+ c[o] = t;
277
277
  } else {
278
- const o = r.getAttribute(t), n = String(e);
279
- o !== n && (r.setAttribute(s, n), s === "value" && B(r) && (r.value = n));
278
+ const o = c.getAttribute(a), n = String(t);
279
+ o !== n && (c.setAttribute(e, n), e === "value" && Et(c) && (c.value = n));
280
280
  }
281
281
  else {
282
- const o = d.getPropName(t);
283
- r[o] = e;
282
+ const o = X.getPropName(a);
283
+ c[o] = t;
284
284
  }
285
285
  }
286
- function k(r, t, e) {
287
- const [s, i] = t.split(":");
288
- r instanceof CSSStyleRule ? r.style.setProperty(s, e) : (it(r, s, e), s === "value" && B(r) && (r.value = e));
286
+ function nt(c, a, t) {
287
+ const [e, s] = a.split(":");
288
+ c instanceof CSSStyleRule ? c.style.setProperty(e, t) : (Ft(c, e, t), e === "value" && Et(c) && (c.value = t));
289
289
  }
290
- const Z = (r) => typeof r == "string" ? [r] : r;
291
- async function gt(r) {
292
- const t = /* @__PURE__ */ new Set();
293
- for (const s of $(r.content)) {
294
- const { localName: i } = s;
295
- i.includes("-") && t.add(i);
296
- }
297
- function e(s) {
298
- return new Promise((i, o) => {
290
+ const $t = (c) => typeof c == "string" ? [c] : c;
291
+ async function le(c) {
292
+ const a = /* @__PURE__ */ new Set();
293
+ for (const e of G(c.content)) {
294
+ const { localName: s } = e;
295
+ s.includes("-") && a.add(s);
296
+ }
297
+ function t(e) {
298
+ return new Promise((s, o) => {
299
299
  setTimeout(() => {
300
- const n = `custom element <${s}> not defined`;
300
+ const n = `custom element <${e}> not defined`;
301
301
  o(new Error(n));
302
302
  }, 1e3);
303
303
  });
304
304
  }
305
305
  return Promise.all(
306
- [...t].map(
307
- async (s) => Promise.race([
308
- F.whenDefined(s),
309
- e(s)
306
+ [...a].map(
307
+ async (e) => Promise.race([
308
+ ct.whenDefined(e),
309
+ t(e)
310
310
  ])
311
311
  )
312
312
  );
313
313
  }
314
- class d extends ft {
315
- // There is one instance of `attrToPropMap`, `properties`, `propToAttrMap`,
316
- // `propToComputedMap`, and `propToExprsMap` per Wrec subclass,
317
- // not one for only the Wrec class.
318
- // The instances created here are not used.
319
- // Subclass-specific instances are created in the constructor.
320
- // This is used to lookup the camelCase property name
321
- // that corresponds to a kebab-case attribute name.
322
- static attrToPropMap = /* @__PURE__ */ new Map();
323
- // This is used to lookup the kebab-case attribute name
324
- // that corresponds to a camelCase property name.
325
- static propToAttrMap = /* @__PURE__ */ new Map();
326
- // This can be overridden in each Wrec subclass.
327
- // It lists all the module-level functions
328
- // that be used in JavaScript expressions.
329
- static context = {};
330
- // This can be set in each Wrec subclass.
331
- // It describes CSS rules that a web component uses.
332
- static css = "";
333
- static elementName = "";
334
- // Set this to true in Wrec subclasses that need
335
- // the ability to contribute data to form submissions.
336
- static formAssociated = !1;
337
- // This must be set in each Wrec subclass.
338
- // It describes HTML that a web component renders.
339
- static html = "";
340
- // This must be set in each Wrec subclass.
341
- // It describes all the properties that a web component supports.
342
- static properties;
343
- // This is a map from properties to arrays of
344
- // computed property expressions that use the property.
345
- // It is used to update computed properties
346
- // when the properties on which they depend are modified.
347
- // See the method #updateComputedProperties.
348
- static propToComputedMap;
349
- // This is a map from method names to expressions
350
- // that include calls to them.
351
- // It is the same for all instances of a component.
352
- static methodToExprsMap;
353
- // This is a map from properties to expressions that refer to them.
354
- // It is the same for all instances of a component.
355
- static propToExprsMap;
356
- static template = null;
357
- // This is true while the batchSet method is running.
358
- #p = !1;
359
- // This holds the names of computed properties
360
- // that are currently being updated.
361
- #u = /* @__PURE__ */ new Set();
362
- #t = this.constructor;
363
- // This is a map from expressions to references to them
364
- // which can be found in element text content,
365
- // attribute values, and CSS property values.
366
- // Each component instance needs its own map.
367
- #s = /* @__PURE__ */ new Map();
368
- #d = {};
369
- #i;
370
- // For components that set `formAssociated` to true,
371
- // this stores in the initial value of each property
372
- // in the formAssociatedCallback method
373
- // so they can be restored in the formResetCallback method.
374
- #m = {};
375
- #b = null;
376
- // This is a map from properties in this web component
377
- // to corresponding properties in a parent web component.
378
- // This must be an instance property because
379
- // each component instance can have its properties mapped
380
- // to the properties of different parent components.
381
- // This is used to update a parent property
382
- // when the corresponding child property value changes.
383
- #y = /* @__PURE__ */ new Map();
384
- // This is a map from component properties to state bindings.
385
- // It must be instance-specific because each component instance
386
- // can bind the same property to a different WrecState/path.
387
- #r = /* @__PURE__ */ new Map();
388
- static define(t) {
389
- if (this.elementName = t, F.get(t))
390
- throw new y(`custom element ${t} is already defined`);
391
- F.define(t, this);
392
- }
314
+ var N, L, m, T, j, C, H, k, F, $, i, It, Bt, Dt, ft, ht, _t, lt, S, Vt, Wt, R, V, W, pt, ut, dt, mt, zt, z, q, w, J, bt, yt, qt, Jt, gt, Xt, Kt, Ut, Y, Zt, Yt, wt;
315
+ const g = class g extends se {
393
316
  constructor() {
394
- super(), this.attachShadow({ mode: "open" });
395
- const t = this.#t;
396
- this.#n("attrToPropMap") || (t.attrToPropMap = /* @__PURE__ */ new Map()), this.#n("properties") || (t.properties = {}), this.#n("propToAttrMap") || (t.propToAttrMap = /* @__PURE__ */ new Map()), this.#n("propToComputedMap") || (t.propToComputedMap = /* @__PURE__ */ new Map()), this.#n("propToExprsMap") || (t.propToExprsMap = /* @__PURE__ */ new Map());
317
+ super();
318
+ y(this, i);
319
+ // This is true while the batchSet method is running.
320
+ y(this, N, !1);
321
+ // This holds the names of computed properties
322
+ // that are currently being updated.
323
+ y(this, L, /* @__PURE__ */ new Set());
324
+ y(this, m, this.constructor);
325
+ // This is a map from expressions to references to them
326
+ // which can be found in element text content,
327
+ // attribute values, and CSS property values.
328
+ // Each component instance needs its own map.
329
+ y(this, T, /* @__PURE__ */ new Map());
330
+ y(this, j, {});
331
+ y(this, C);
332
+ // For components that set `formAssociated` to true,
333
+ // this stores in the initial value of each property
334
+ // in the formAssociatedCallback method
335
+ // so they can be restored in the formResetCallback method.
336
+ y(this, H, {});
337
+ y(this, k, null);
338
+ // This is a map from properties in this web component
339
+ // to corresponding properties in a parent web component.
340
+ // This must be an instance property because
341
+ // each component instance can have its properties mapped
342
+ // to the properties of different parent components.
343
+ // This is used to update a parent property
344
+ // when the corresponding child property value changes.
345
+ y(this, F, /* @__PURE__ */ new Map());
346
+ // This is a map from component properties to state bindings.
347
+ // It must be instance-specific because each component instance
348
+ // can bind the same property to a different WrecState/path.
349
+ y(this, $, /* @__PURE__ */ new Map());
350
+ this.attachShadow({ mode: "open" });
351
+ const t = h(this, m);
352
+ f(this, i, R).call(this, "attrToPropMap") || (t.attrToPropMap = /* @__PURE__ */ new Map()), f(this, i, R).call(this, "properties") || (t.properties = {}), f(this, i, R).call(this, "propToAttrMap") || (t.propToAttrMap = /* @__PURE__ */ new Map()), f(this, i, R).call(this, "propToComputedMap") || (t.propToComputedMap = /* @__PURE__ */ new Map()), f(this, i, R).call(this, "propToExprsMap") || (t.propToExprsMap = /* @__PURE__ */ new Map());
353
+ }
354
+ static define(t) {
355
+ if (this.elementName = t, ct.get(t))
356
+ throw new v(`custom element ${t} is already defined`);
357
+ ct.define(t, this);
397
358
  }
398
359
  attributeChangedCallback(t, e, s) {
399
- t === "disabled" && this.#E();
400
- const i = d.getPropName(t);
401
- if (!this.#a(i) && this.#c(i)) {
402
- const o = this.#v(i, s);
403
- this[i] = o;
404
- const n = this.#d[i];
405
- n && this.setFormValue(n, String(o)), this.propertyChangedCallback(i, e, s);
360
+ t === "disabled" && f(this, i, ht).call(this);
361
+ const o = g.getPropName(t);
362
+ if (!f(this, i, W).call(this, o) && f(this, i, V).call(this, o)) {
363
+ const n = f(this, i, yt).call(this, o, s);
364
+ this[o] = n;
365
+ const r = h(this, j)[o];
366
+ r && this.setFormValue(r, String(n));
406
367
  }
407
368
  }
408
369
  // This applies multiple property changes and only updates
409
370
  // the affected parts of the DOM after all of them are made.
410
371
  batchSet(t) {
411
- this.#p = !0;
412
- const e = this.#t.propToExprsMap, s = /* @__PURE__ */ new Set();
413
- for (const [c, a] of Object.entries(t)) {
414
- this[c] = a;
415
- const f = e.get(c) ?? [];
416
- for (const h of f)
417
- s.add(h);
418
- }
419
- const i = this.#t.propToComputedMap, o = /* @__PURE__ */ new Set(), n = {};
420
- for (const c of Object.keys(t)) {
421
- const a = i.get(c) || [];
422
- for (const [f, h] of a)
423
- o.add(f), n[f] = h;
424
- }
425
- for (const c of o) {
426
- const a = n[c];
427
- this.#f(c, this.#o(a));
428
- const f = e.get(c) ?? [];
429
- for (const h of f)
430
- s.add(h);
372
+ M(this, N, !0);
373
+ const e = h(this, m).propToExprsMap, s = /* @__PURE__ */ new Set();
374
+ for (const [l, u] of Object.entries(t)) {
375
+ this[l] = u;
376
+ const p = e.get(l) ?? [];
377
+ for (const d of p)
378
+ s.add(d);
379
+ }
380
+ const o = h(this, m).propToComputedMap, n = /* @__PURE__ */ new Set(), r = {};
381
+ for (const l of Object.keys(t)) {
382
+ const u = o.get(l) || [];
383
+ for (const [p, d] of u)
384
+ n.add(p), r[p] = d;
385
+ }
386
+ for (const l of n) {
387
+ const u = r[l];
388
+ f(this, i, z).call(this, l, f(this, i, S).call(this, u));
389
+ const p = e.get(l) ?? [];
390
+ for (const d of p)
391
+ s.add(d);
431
392
  }
432
393
  for (; ; ) {
433
- let c = !1;
434
- for (const a of o) {
435
- const f = n[a], h = this.#o(f), l = this[a];
436
- JSON.stringify(h) !== JSON.stringify(l) && (this.#f(a, h), c = !0);
394
+ let l = !1;
395
+ for (const u of n) {
396
+ const p = r[u], d = f(this, i, S).call(this, p), b = this[u];
397
+ JSON.stringify(d) !== JSON.stringify(b) && (f(this, i, z).call(this, u, d), l = !0);
437
398
  }
438
- if (!c) break;
399
+ if (!l) break;
439
400
  }
440
- this.#T([...s]), this.#p = !1;
441
- }
442
- async #R() {
443
- const t = this.#t;
444
- let { template: e } = t;
445
- e || (e = t.template = document.createElement("template"), e.innerHTML = t.buildHTML()), await gt(e), this.shadowRoot.replaceChildren(e.content.cloneNode(!0));
401
+ f(this, i, lt).call(this, [...s]), M(this, N, !1);
446
402
  }
447
403
  static buildHTML() {
448
404
  let t = `<style>
@@ -450,70 +406,19 @@ class d extends ft {
450
406
  this.css && (t += this.css), t += `</style>
451
407
  `;
452
408
  let e = this.html.trim();
453
- if (!e) throw new y("static property html must be set");
409
+ if (!e) throw new v("static property html must be set");
454
410
  return e.startsWith("<") || (e = `<span><!--${e}--></span>`), t + e;
455
411
  }
456
412
  changed(t, e, s) {
457
413
  this[e] = s;
458
414
  }
459
415
  async connectedCallback() {
460
- this.#D(), this.#N(), await this.#R(), this.hasAttribute("disabled") && this.#E(), this.#$(this.shadowRoot), this.#M(this.shadowRoot), this.#B(), this.#O();
461
- }
462
- #O() {
463
- const t = this.#t, { properties: e } = t;
464
- for (const [s, { computed: i }] of Object.entries(e))
465
- i && this.#f(s, this.#o(i));
466
- }
467
- #N() {
468
- const t = this.#t, { observedAttributes: e, properties: s } = t;
469
- for (const [i, o] of Object.entries(s))
470
- o.computed || this.#w(i, o, e);
471
- for (const [i, o] of Object.entries(s))
472
- o.computed && this.#w(i, o, e);
473
- }
474
- #w(t, e, s) {
475
- if (t === "class" || t === "style")
476
- throw new y(`"${t}" is a reserved property`);
477
- const i = d.getAttrName(t), o = this.hasAttribute(i);
478
- e.required && !o && this.#e(this, i, "is a required attribute");
479
- let n = e.value;
480
- this.hasOwnProperty(t) && (n = this[t], delete this[t]);
481
- const { type: c } = e, a = c === Boolean ? n || o : s.includes(i) && o ? this.#C(t, i) : n ?? U(e), f = "#" + t;
482
- this[f] = a, e.computed && this.#k(t, e), Object.defineProperty(this, t, {
483
- enumerable: !0,
484
- get() {
485
- return this[f];
486
- },
487
- set(h) {
488
- e.computed && !this.#u.has(t) && this.#e(
489
- null,
490
- t,
491
- "is a computed property and cannot be set directly"
492
- ), c === Number && typeof h == "string" && (h = H(h));
493
- const l = this[f];
494
- if (h === l) return;
495
- this.#W(t, c, h), this[f] = h;
496
- const u = this.#r.get(t);
497
- u && nt(u.state, u.stateProp, h), this.#_(t, c, h, i), this.#p || (this.#F(t), this.#x(t)), this.#I(t, h);
498
- const v = this.#d[t];
499
- v && this.setFormValue(v, String(h)), this.propertyChangedCallback(t, l, h), e.dispatch && this.dispatch("change", {
500
- tagName: this.localName,
501
- property: t,
502
- oldValue: l,
503
- value: h
504
- });
505
- }
506
- });
507
- }
508
- #E() {
509
- const t = this.hasAttribute("disabled"), e = $(this.shadowRoot);
510
- for (const s of e)
511
- mt(s) && (s.disabled = t);
416
+ f(this, i, Ut).call(this), f(this, i, Dt).call(this), await f(this, i, It).call(this), this.hasAttribute("disabled") && f(this, i, ht).call(this), f(this, i, wt).call(this, this.shadowRoot), f(this, i, pt).call(this, this.shadowRoot), f(this, i, Kt).call(this), f(this, i, Bt).call(this);
512
417
  }
513
418
  disconnectedCallback() {
514
- for (const { state: t } of this.#r.values())
419
+ for (const { state: t } of h(this, $).values())
515
420
  t.removeListener(this);
516
- this.#s.clear(), this.#m.clear(), this.#y.clear(), this.#r.clear();
421
+ h(this, T).clear(), h(this, H).clear(), h(this, F).clear(), h(this, $).clear();
517
422
  }
518
423
  dispatch(t, e) {
519
424
  this.dispatchEvent(
@@ -529,83 +434,6 @@ class d extends ft {
529
434
  displayIfSet(t, e = "block") {
530
435
  return `display: ${t ? e : "none"}`;
531
436
  }
532
- #L(t) {
533
- const e = t instanceof d;
534
- for (const s of t.getAttributeNames()) {
535
- const i = t.getAttribute(s), o = this.#S(t, i);
536
- if (o) {
537
- const n = this[o];
538
- n === void 0 && this.#l(t, s, o);
539
- let [c, a] = s.split(":");
540
- const f = d.getPropName(c), h = this.#a(o);
541
- e && t.#a(f) || (t[f] = n), c === "value" && (a ? (t["on" + a] === void 0 && this.#e(t, s, "refers to an unsupported event name"), t.setAttribute(c, this[o])) : a = "change"), e && !h && t.#y.set(
542
- d.getPropName(c),
543
- o
544
- );
545
- }
546
- this.#h(i, t, s);
547
- }
548
- }
549
- #T(t) {
550
- for (const e of t) {
551
- const s = this.#o(e), i = this.#s.get(e) ?? [], o = /* @__PURE__ */ new Set();
552
- for (const n of i) {
553
- const c = n instanceof HTMLElement || n instanceof CSSStyleRule ? n : n.element;
554
- if (c instanceof HTMLElement && !c.isConnected) {
555
- o.add(n);
556
- continue;
557
- }
558
- if (n instanceof HTMLElement)
559
- this.#P(n, s);
560
- else if (!(n instanceof CSSStyleRule)) {
561
- const { element: a, attrName: f } = n;
562
- a instanceof CSSStyleRule ? a.style.setProperty(f, s) : k(a, f, s);
563
- }
564
- }
565
- if (o.size > 0) {
566
- const n = i.filter((c) => !o.has(c));
567
- n.length === 0 ? this.#s.delete(e) : this.#s.set(e, n);
568
- }
569
- }
570
- }
571
- #o(t) {
572
- const { context: e } = this.#t;
573
- return new Function(
574
- "context",
575
- `const {${Object.keys(e).join(",")}} = context; return ${t};`
576
- ).call(this, e);
577
- }
578
- #j(t) {
579
- const { localName: e } = t;
580
- if (e === "style") {
581
- const { sheet: s } = t, i = s?.cssRules ?? [], o = Array.from(i);
582
- for (const n of o)
583
- if (n.constructor === CSSStyleRule) {
584
- const c = Array.from(n.style);
585
- for (const a of c)
586
- if (a.startsWith("--")) {
587
- const f = n.style.getPropertyValue(a);
588
- this.#h(f, n, a);
589
- }
590
- }
591
- } else {
592
- let s = "";
593
- if (S(t)) {
594
- this.#h(t.textContent, t);
595
- const i = t.textContent?.match(pt);
596
- i && (s = i[1]);
597
- } else {
598
- const i = Array.from(t.childNodes).find(
599
- (o) => o.nodeType === Node.COMMENT_NODE
600
- );
601
- i && (s = i.textContent?.trim() ?? "");
602
- }
603
- if (s) {
604
- const i = this.#S(t, s);
605
- i && S(t) ? t.textContent = this[i] : this.#h(s, t);
606
- }
607
- }
608
- }
609
437
  // This method is called automatically if
610
438
  // the component is nested in form element AND
611
439
  // the static property formAssociated is true.
@@ -613,30 +441,30 @@ class d extends ft {
613
441
  formAssociatedCallback() {
614
442
  let t = this.getAttribute("form-assoc");
615
443
  if (!t) {
616
- const n = this.getAttribute("name");
617
- if (n)
618
- if (this.#c("value"))
619
- t = `value:${n}`;
444
+ const r = this.getAttribute("name");
445
+ if (r)
446
+ if (f(this, i, V).call(this, "value"))
447
+ t = `value:${r}`;
620
448
  else
621
449
  return;
622
450
  else
623
451
  return;
624
452
  }
625
453
  const e = {}, s = t.split(",");
626
- for (const n of s) {
627
- const [c, a] = n.split(":");
628
- e[c.trim()] = a.trim();
454
+ for (const r of s) {
455
+ const [l, u] = r.split(":");
456
+ e[l.trim()] = u.trim();
629
457
  }
630
- this.#d = e, this.#i = new FormData(), this.#b = this.attachInternals(), this.#b.setFormValue(this.#i);
631
- const i = Object.keys(this.#t.properties), o = this.#m;
632
- for (const n of i)
633
- o[n] = this[n];
458
+ M(this, j, e), M(this, C, new FormData()), M(this, k, this.attachInternals()), h(this, k).setFormValue(h(this, C));
459
+ const o = Object.keys(h(this, m).properties), n = h(this, H);
460
+ for (const r of o)
461
+ n[r] = this[r];
634
462
  }
635
463
  formResetCallback() {
636
- const t = this.#m;
464
+ const t = h(this, H);
637
465
  for (const e of Object.keys(t)) {
638
466
  let s = t[e];
639
- L.test(s) && (s = this.#o(s)), this[e] = s;
467
+ st.test(s) && (s = f(this, i, S).call(this, s)), this[e] = s;
640
468
  }
641
469
  }
642
470
  static getAttrName(t) {
@@ -645,249 +473,25 @@ class d extends ft {
645
473
  }
646
474
  static getPropName(t) {
647
475
  let e = this.attrToPropMap.get(t);
648
- return e || (e = t.replace(/-([a-z])/g, (s, i) => i.toUpperCase()), this.attrToPropMap.set(t, e)), e;
649
- }
650
- #H(t, e, s) {
651
- if (s.length !== 1) return;
652
- const [i] = s;
653
- if (!L.test(i)) return;
654
- const o = B(t) || S(t);
655
- let [n, c] = (e ?? "").split(":");
656
- if (!(o && n === "value" || S(t))) return;
657
- c ? t["on" + c] === void 0 && this.#e(t, e, "refers to an unsupported event name") : c = "change";
658
- const f = A(i);
659
- t.addEventListener(c, (h) => {
660
- const { target: l } = h;
661
- if (!l) return;
662
- const u = l.value, { type: v } = this.#t.properties[f];
663
- this[f] = v === Number ? H(u) : u, this.#x(f);
664
- });
665
- }
666
- #n(t) {
667
- return Object.hasOwn(this.#t, t);
668
- }
669
- #c(t) {
670
- return !!this.#t.properties[t];
671
- }
672
- #a(t) {
673
- return !!this.#t.properties[t]?.computed;
674
- }
675
- #M(t) {
676
- const e = Array.from(t.querySelectorAll("*"));
677
- for (const s of e)
678
- this.#L(s), s.firstElementChild || this.#j(s);
679
- }
680
- // formAssociated is only needed when the component is inside a form.
681
- #A() {
682
- if (this.#t.formAssociated || this.closest("form") === null) return;
683
- const t = this.#t.name;
684
- this.#e(
685
- this,
686
- void 0,
687
- `inside form, class ${t} requires "static formAssociated = true;"`
688
- );
476
+ return e || (e = t.replace(/-([a-z])/g, (s, o) => o.toUpperCase()), this.attrToPropMap.set(t, e)), e;
689
477
  }
690
478
  static get observedAttributes() {
691
- const t = Object.entries(this.properties || {}).filter(([e, s]) => !s.computed).map(([e]) => d.getAttrName(e));
479
+ const t = Object.entries(this.properties || {}).filter(([e, s]) => !s.computed).map(([e]) => g.getAttrName(e));
692
480
  return t.includes("disabled") || t.push("disabled"), t;
693
481
  }
694
482
  // Subclasses can override this to add functionality.
695
483
  propertyChangedCallback(t, e, s) {
696
484
  }
697
- #S(t, e) {
698
- if (!e || !L.test(e)) return;
699
- const s = A(e);
700
- return this[s] === void 0 && this.#l(t, "", s), s;
701
- }
702
- #x(t) {
703
- const e = this.#t.propToExprsMap.get(t) || [];
704
- this.#T(e);
705
- }
706
- #k(t, e) {
707
- const s = this.#t, i = s.propToComputedMap;
708
- function o(a, f) {
709
- let h = i.get(a);
710
- h || (h = [], i.set(a, h)), h.push([t, f]);
711
- }
712
- const { computed: n } = e, c = n.match(j) || [];
713
- for (const a of c) {
714
- const f = A(a);
715
- this[f] === void 0 && this.#l(null, t, f), typeof this[f] != "function" && o(f, n);
716
- }
717
- for (const a of n.matchAll(K)) {
718
- const f = a[1];
719
- if (typeof this[f] != "function")
720
- throw new y(
721
- `property ${t} computed calls non-method ${f}`
722
- );
723
- for (const [h, l] of Object.entries(s.properties))
724
- Z(l.usedBy)?.includes(f) && o(h, n);
725
- }
726
- }
727
- #f(t, e) {
728
- this.#u.add(t);
729
- try {
730
- this[t] = e;
731
- } finally {
732
- this.#u.delete(t);
733
- }
734
- }
735
- // WARNING: Do not place untrusted JavaScript expressions
736
- // in attribute values or the text content of elements!
737
- #h(t, e, s = void 0) {
738
- if (!t) return;
739
- const i = this.#g(e, s, t);
740
- if (!i) {
741
- const a = t.replaceAll("this..", "this.");
742
- s ? k(e, s, a) : "textContent" in e && (e.textContent = a);
743
- return;
744
- }
745
- const o = this.#t;
746
- i.forEach((a) => {
747
- const f = A(a);
748
- if (typeof this[f] == "function") return;
749
- const h = o.propToExprsMap;
750
- let l = h.get(f);
751
- l || (l = [], h.set(f, l)), l.includes(t) || l.push(t);
752
- });
753
- for (const [a, f] of this.#s.entries())
754
- for (const h of f) {
755
- const l = h instanceof HTMLElement || h instanceof CSSStyleRule ? h : h.element;
756
- l instanceof CSSStyleRule || l.isConnected || this.#s.set(
757
- a,
758
- f.filter((u) => u !== h)
759
- );
760
- }
761
- let n = this.#s.get(t);
762
- n || (n = [], this.#s.set(t, n)), n.push(s ? { element: e, attrName: s } : e), e instanceof HTMLElement && this.#H(e, s, i);
763
- const c = this.#o(t);
764
- s ? k(e, s, c) : this.#P(e, c);
765
- }
766
485
  // This follows the best practice
767
486
  // "Do not override author-set, global attributes."
768
487
  setAttributeSafe(t, e) {
769
488
  this.hasAttribute(t) || this.setAttribute(t, e);
770
489
  }
771
490
  setFormValue(t, e) {
772
- !this.#i || !I(e) || (this.#i.set(t, e), this.#b?.setFormValue(this.#i));
491
+ !h(this, C) || !at(e) || (h(this, C).set(t, e), h(this, k)?.setFormValue(h(this, C)));
773
492
  }
774
493
  static ssr(t = {}) {
775
- throw new y('Import Wrec from "wrec/ssr" to use the ssr method.');
776
- }
777
- #e(t, e, s) {
778
- const i = t instanceof HTMLElement ? t.localName : "CSS rule";
779
- throw new y(
780
- `component ${this.#t.elementName}` + (t ? `, element "${i}"` : "") + (e ? `, attribute "${e}"` : "") + ` ${s}`
781
- );
782
- }
783
- #l(t, e, s) {
784
- this.#e(t, e, `refers to missing property "${s}"`);
785
- }
786
- #C(t, e) {
787
- return this.#v(t, this.getAttribute(e));
788
- }
789
- #v(t, e) {
790
- if (e?.match(j)) return e;
791
- const i = this.#t.properties[t], { type: o, values: n } = i;
792
- if (o || this.#e(null, t, "does not specify its type"), e === null)
793
- return o === Boolean ? !1 : U(i);
794
- if (o === String) {
795
- if (n && !n.includes(e)) {
796
- const c = n.map((a) => `"${a}"`).join(", ");
797
- this.#e(null, t, `must be one of ${c}`);
798
- }
799
- return e;
800
- }
801
- if (o === Number) return H(e);
802
- if (o === Boolean) {
803
- if (e === "true") return !0;
804
- if (e === "false" || e === "null") return !1;
805
- const c = d.getAttrName(t);
806
- return e && e !== c && this.#e(
807
- null,
808
- t,
809
- "is a Boolean attribute, so its value must match attribute name or be missing"
810
- ), e === "" || e === c;
811
- }
812
- }
813
- // Updates the matching attribute for a property.
814
- // VS Code thinks this is never called, but it is called by #defineProp.
815
- #_(t, e, s, i) {
816
- if (I(s) && !this.#a(t)) {
817
- const o = e === Boolean ? this.hasAttribute(i) : this.#C(t, i);
818
- s !== o && it(this, i || t, s);
819
- }
820
- }
821
- // Updates all computed properties that reference this property.
822
- // VS Code thinks this is never called, but it is called by #defineProp.
823
- #F(t) {
824
- const s = this.#t.propToComputedMap.get(t) || [];
825
- for (const [i, o] of s)
826
- this.#f(i, this.#o(o));
827
- }
828
- #P(t, e) {
829
- if (e === void 0) return;
830
- const s = t instanceof HTMLElement;
831
- Array.isArray(e) && (e = e.join(""));
832
- const i = typeof e;
833
- i !== "string" && i !== "number" && this.#e(
834
- t,
835
- void 0,
836
- " computed content is not a string or number"
837
- );
838
- const o = String(e);
839
- if (t instanceof HTMLElement && S(t))
840
- t.value = o;
841
- else if (s && i === "string" && o.trim().startsWith("<")) {
842
- const n = ct(o);
843
- t.innerHTML = n, this.#$(t), this.#M(t);
844
- } else s && (t.textContent = o);
845
- }
846
- // Update corresponding parent web component property if bound to one.
847
- // VS Code thinks this is never called, but it is called by #defineProp.
848
- #I(t, e) {
849
- const s = this.#y.get(t);
850
- if (!s) return;
851
- const i = this.getRootNode();
852
- if (!(i instanceof ShadowRoot)) return;
853
- const { host: o } = i;
854
- if (!o) return;
855
- const n = o;
856
- n[s] = e;
857
- }
858
- // This adds expressions to the expressions arrays in propToExprsMap
859
- // that contain calls to methods listed the usedBy array or each property.
860
- #B() {
861
- const t = this.#t;
862
- function e() {
863
- const o = /* @__PURE__ */ new Map();
864
- t.methodToExprsMap = o;
865
- const n = Array.from(this.#s.keys());
866
- for (const c of n)
867
- for (const a of c.matchAll(K)) {
868
- const f = a[1];
869
- let h = o.get(f);
870
- h || (h = [], o.set(f, h)), h.includes(c) || h.push(c);
871
- }
872
- }
873
- const { properties: s, propToExprsMap: i } = t;
874
- for (const [o, n] of Object.entries(s)) {
875
- const c = Z(n.usedBy);
876
- if (!c) continue;
877
- t.methodToExprsMap || e.call(this);
878
- const { methodToExprsMap: a } = t;
879
- let f = i.get(o);
880
- f || (f = [], i.set(o, f));
881
- for (const h of c) {
882
- if (typeof this[h] != "function")
883
- throw new y(
884
- `property ${o} usedBy contains non-method ${h}`
885
- );
886
- const l = a.get(h) || [];
887
- for (const u of l)
888
- f.includes(u) || f.push(u);
889
- }
890
- }
494
+ throw new v('Import Wrec from "wrec/ssr" to use the ssr method.');
891
495
  }
892
496
  /**
893
497
  * @param state - WrecState object
@@ -900,127 +504,425 @@ class d extends ft {
900
504
  for (const s of Object.keys(t))
901
505
  e[s] = s;
902
506
  }
903
- this.#V(t, e);
904
- for (const [s, i] of Object.entries(e))
905
- if (this.#c(i)) {
906
- const o = q(t, s);
907
- o !== void 0 && (this[i] = o), this.#r.set(i, { state: t, stateProp: s });
507
+ f(this, i, Zt).call(this, t, e);
508
+ for (const [s, o] of Object.entries(e))
509
+ if (f(this, i, V).call(this, o)) {
510
+ const n = St(t, s);
511
+ n !== void 0 && (this[o] = n), h(this, $).set(o, { state: t, stateProp: s });
908
512
  }
909
513
  t.addListener(this, e);
910
514
  }
911
- #D() {
912
- const t = new Set(Object.keys(this.#t.properties));
913
- for (const e of this.getAttributeNames())
914
- if (!at.has(e) && !e.startsWith("on")) {
915
- if (e === "form-assoc") {
916
- this.#A();
917
- continue;
918
- }
919
- if (!t.has(d.getPropName(e))) {
920
- if (e === "name") {
921
- this.#A();
922
- continue;
923
- }
924
- this.#e(null, e, "is not a supported attribute");
925
- }
926
- }
927
- }
928
- #g(t, e, s) {
929
- const i = s.match(j);
930
- if (i)
931
- return i.forEach((o) => {
932
- const n = A(o);
933
- this[n] === void 0 && this.#l(t, e, n);
934
- }), i;
935
- }
936
- #V(t, e) {
937
- for (const [s, i] of Object.entries(e)) {
938
- let o = q(t, s);
939
- o === void 0 && this.#e(this, void 0, `invalid state path "${s}"`), o = this[i], this.#c(i) || this.#e(
940
- null,
941
- i,
942
- "refers to missing property in useState map"
515
+ };
516
+ N = new WeakMap(), L = new WeakMap(), m = new WeakMap(), T = new WeakMap(), j = new WeakMap(), C = new WeakMap(), H = new WeakMap(), k = new WeakMap(), F = new WeakMap(), $ = new WeakMap(), i = new WeakSet(), It = async function() {
517
+ const t = h(this, m);
518
+ let { template: e } = t;
519
+ e || (e = t.template = document.createElement("template"), e.innerHTML = t.buildHTML()), await le(e), this.shadowRoot.replaceChildren(e.content.cloneNode(!0));
520
+ }, Bt = function() {
521
+ const t = h(this, m), { properties: e } = t;
522
+ for (const [s, { computed: o }] of Object.entries(e))
523
+ o && f(this, i, z).call(this, s, f(this, i, S).call(this, o));
524
+ }, Dt = function() {
525
+ const t = h(this, m), { observedAttributes: e, properties: s } = t;
526
+ for (const [o, n] of Object.entries(s))
527
+ n.computed || f(this, i, ft).call(this, o, n, e);
528
+ for (const [o, n] of Object.entries(s))
529
+ n.computed && f(this, i, ft).call(this, o, n, e);
530
+ }, ft = function(t, e, s) {
531
+ if (t === "class" || t === "style")
532
+ throw new v(`"${t}" is a reserved property`);
533
+ const o = g.getAttrName(t), n = this.hasAttribute(o);
534
+ e.required && !n && f(this, i, w).call(this, this, o, "is a required attribute");
535
+ let r = e.value;
536
+ this.hasOwnProperty(t) && (r = this[t], delete this[t]);
537
+ const { type: l } = e, u = l === Boolean ? r || n : s.includes(o) && n ? f(this, i, bt).call(this, t, o) : r ?? Pt(e), p = "#" + t;
538
+ this[p] = u, e.computed && f(this, i, zt).call(this, t, e), Object.defineProperty(this, t, {
539
+ enumerable: !0,
540
+ get() {
541
+ return this[p];
542
+ },
543
+ set(d) {
544
+ e.computed && !h(this, L).has(t) && f(this, i, w).call(this, null, t, "is a computed property and cannot be set directly"), l === Number && typeof d == "string" && (d = it(d));
545
+ const b = this[p];
546
+ if (d === b) return;
547
+ f(this, i, Yt).call(this, t, l, d), this[p] = d;
548
+ const E = h(this, $).get(t);
549
+ E && Gt(E.state, E.stateProp, d), f(this, i, qt).call(this, t, l, d, o), h(this, N) || (f(this, i, Jt).call(this, t), f(this, i, mt).call(this, t)), f(this, i, Xt).call(this, t, d);
550
+ const B = h(this, j)[t];
551
+ B && this.setFormValue(B, String(d)), this.propertyChangedCallback(t, b, d), e.dispatch && this.dispatch("change", {
552
+ tagName: this.localName,
553
+ property: t,
554
+ oldValue: b,
555
+ value: d
556
+ });
557
+ }
558
+ });
559
+ }, ht = function() {
560
+ const t = this.hasAttribute("disabled"), e = G(this.shadowRoot);
561
+ for (const s of e)
562
+ ae(s) && (s.disabled = t);
563
+ }, _t = function(t) {
564
+ var s;
565
+ const e = t instanceof g;
566
+ for (const o of t.getAttributeNames()) {
567
+ const n = t.getAttribute(o), r = f(this, i, dt).call(this, t, n);
568
+ if (r) {
569
+ const l = this[r];
570
+ l === void 0 && f(this, i, J).call(this, t, o, r);
571
+ let [u, p] = o.split(":");
572
+ const d = g.getPropName(u), b = f(this, i, W).call(this, r);
573
+ e && f(s = t, i, W).call(s, d) || (t[d] = l), u === "value" && (p ? (t["on" + p] === void 0 && f(this, i, w).call(this, t, o, "refers to an unsupported event name"), t.setAttribute(u, this[r])) : p = "change"), e && !b && h(t, F).set(
574
+ g.getPropName(u),
575
+ r
943
576
  );
944
577
  }
578
+ f(this, i, q).call(this, n, t, o);
945
579
  }
946
- // When type is an array, this can't validate the type of the array elements.
947
- // This is called by #defineProp.
948
- #W(t, e, s) {
949
- const { values: i } = this.#t.properties[t];
950
- if (i) {
951
- let n;
952
- e !== String ? n = "declares allowed values, but its type is not String" : typeof s != "string" ? n = `value is a ${typeof s}, but type is String` : i.includes(s) || (n = `must be one of ${i.map((a) => `"${a}"`).join(", ")}`), n && this.#e(null, t, n);
580
+ }, lt = function(t) {
581
+ for (const e of t) {
582
+ const s = f(this, i, S).call(this, e), o = h(this, T).get(e) ?? [], n = /* @__PURE__ */ new Set();
583
+ for (const r of o) {
584
+ const l = r instanceof HTMLElement || r instanceof CSSStyleRule ? r : r.element;
585
+ if (l instanceof HTMLElement && !l.isConnected) {
586
+ n.add(r);
587
+ continue;
588
+ }
589
+ if (r instanceof HTMLElement)
590
+ f(this, i, gt).call(this, r, s);
591
+ else if (!(r instanceof CSSStyleRule)) {
592
+ const { element: u, attrName: p } = r;
593
+ u instanceof CSSStyleRule ? u.style.setProperty(p, s) : nt(u, p, s);
594
+ }
953
595
  }
954
- if (s instanceof e) return;
955
- let o = typeof s;
956
- if (o === "object") {
957
- const { constructor: n } = s;
958
- o = n.name, n !== e && this.#e(
959
- null,
960
- t,
961
- `was set to a ${o}, but must be a ${e.name}`
596
+ if (n.size > 0) {
597
+ const r = o.filter((l) => !n.has(l));
598
+ r.length === 0 ? h(this, T).delete(e) : h(this, T).set(e, r);
599
+ }
600
+ }
601
+ }, S = function(t) {
602
+ const { context: e } = h(this, m);
603
+ return new Function(
604
+ "context",
605
+ `const {${Object.keys(e).join(",")}} = context; return ${t};`
606
+ ).call(this, e);
607
+ }, Vt = function(t) {
608
+ const { localName: e } = t;
609
+ if (e === "style") {
610
+ const { sheet: s } = t, o = s?.cssRules ?? [], n = Array.from(o);
611
+ for (const r of n)
612
+ if (r.constructor === CSSStyleRule) {
613
+ const l = Array.from(r.style);
614
+ for (const u of l)
615
+ if (u.startsWith("--")) {
616
+ const p = r.style.getPropertyValue(u);
617
+ f(this, i, q).call(this, p, r, u);
618
+ }
619
+ }
620
+ } else {
621
+ let s = "";
622
+ if (_(t)) {
623
+ f(this, i, q).call(this, t.textContent, t);
624
+ const o = t.textContent?.match(ne);
625
+ o && (s = o[1]);
626
+ } else {
627
+ const o = Array.from(t.childNodes).find(
628
+ (n) => n.nodeType === Node.COMMENT_NODE
962
629
  );
630
+ o && (s = o.textContent?.trim() ?? "");
963
631
  }
964
- o !== e.name.toLowerCase() && this.#e(
965
- null,
966
- t,
967
- `was set to a ${o}, but must be a ${e.name}`
968
- );
632
+ if (s) {
633
+ const o = f(this, i, dt).call(this, t, s);
634
+ o && _(t) ? t.textContent = this[o] : f(this, i, q).call(this, s, t);
635
+ }
636
+ }
637
+ }, Wt = function(t, e, s) {
638
+ if (s.length !== 1) return;
639
+ const [o] = s;
640
+ if (!st.test(o)) return;
641
+ const n = Et(t) || _(t);
642
+ let [r, l] = (e ?? "").split(":");
643
+ if (!(n && r === "value" || _(t))) return;
644
+ l ? t["on" + l] === void 0 && f(this, i, w).call(this, t, e, "refers to an unsupported event name") : l = "change";
645
+ const p = D(o);
646
+ t.addEventListener(l, (d) => {
647
+ const { target: b } = d;
648
+ if (!b) return;
649
+ const E = b.value, { type: B } = h(this, m).properties[p];
650
+ this[p] = B === Number ? it(E) : E, f(this, i, mt).call(this, p);
651
+ });
652
+ }, R = function(t) {
653
+ return Object.hasOwn(h(this, m), t);
654
+ }, V = function(t) {
655
+ return !!h(this, m).properties[t];
656
+ }, W = function(t) {
657
+ return !!h(this, m).properties[t]?.computed;
658
+ }, pt = function(t) {
659
+ const e = Array.from(t.querySelectorAll("*"));
660
+ for (const s of e)
661
+ f(this, i, _t).call(this, s), s.firstElementChild || f(this, i, Vt).call(this, s);
662
+ }, // formAssociated is only needed when the component is inside a form.
663
+ ut = function() {
664
+ if (h(this, m).formAssociated || this.closest("form") === null) return;
665
+ const t = h(this, m).name;
666
+ f(this, i, w).call(this, this, void 0, `inside form, class ${t} requires "static formAssociated = true;"`);
667
+ }, dt = function(t, e) {
668
+ if (!e || !st.test(e)) return;
669
+ const s = D(e);
670
+ return this[s] === void 0 && f(this, i, J).call(this, t, "", s), s;
671
+ }, mt = function(t) {
672
+ const e = h(this, m).propToExprsMap.get(t) || [];
673
+ f(this, i, lt).call(this, e);
674
+ }, zt = function(t, e) {
675
+ const s = h(this, m), o = s.propToComputedMap;
676
+ function n(u, p) {
677
+ let d = o.get(u);
678
+ d || (d = [], o.set(u, d)), d.push([t, p]);
679
+ }
680
+ const { computed: r } = e, l = r.match(ot) || [];
681
+ for (const u of l) {
682
+ const p = D(u);
683
+ this[p] === void 0 && f(this, i, J).call(this, null, t, p), typeof this[p] != "function" && n(p, r);
684
+ }
685
+ for (const u of r.matchAll(Ct)) {
686
+ const p = u[1];
687
+ if (typeof this[p] != "function")
688
+ throw new v(
689
+ `property ${t} computed calls non-method ${p}`
690
+ );
691
+ for (const [d, b] of Object.entries(s.properties))
692
+ $t(b.usedBy)?.includes(p) && n(d, r);
693
+ }
694
+ }, z = function(t, e) {
695
+ h(this, L).add(t);
696
+ try {
697
+ this[t] = e;
698
+ } finally {
699
+ h(this, L).delete(t);
700
+ }
701
+ }, // WARNING: Do not place untrusted JavaScript expressions
702
+ // in attribute values or the text content of elements!
703
+ q = function(t, e, s = void 0) {
704
+ if (!t) return;
705
+ const o = f(this, i, Y).call(this, e, s, t);
706
+ if (!o) {
707
+ const u = t.replaceAll("this..", "this.");
708
+ s ? nt(e, s, u) : "textContent" in e && (e.textContent = u);
709
+ return;
710
+ }
711
+ const n = h(this, m);
712
+ o.forEach((u) => {
713
+ const p = D(u);
714
+ if (typeof this[p] == "function") return;
715
+ const d = n.propToExprsMap;
716
+ let b = d.get(p);
717
+ b || (b = [], d.set(p, b)), b.includes(t) || b.push(t);
718
+ });
719
+ for (const [u, p] of h(this, T).entries())
720
+ for (const d of p) {
721
+ const b = d instanceof HTMLElement || d instanceof CSSStyleRule ? d : d.element;
722
+ b instanceof CSSStyleRule || b.isConnected || h(this, T).set(
723
+ u,
724
+ p.filter((E) => E !== d)
725
+ );
726
+ }
727
+ let r = h(this, T).get(t);
728
+ r || (r = [], h(this, T).set(t, r)), r.push(s ? { element: e, attrName: s } : e), e instanceof HTMLElement && f(this, i, Wt).call(this, e, s, o);
729
+ const l = f(this, i, S).call(this, t);
730
+ s ? nt(e, s, l) : f(this, i, gt).call(this, e, l);
731
+ }, w = function(t, e, s) {
732
+ const o = t instanceof HTMLElement ? t.localName : "CSS rule";
733
+ throw new v(
734
+ `component ${h(this, m).elementName}` + (t ? `, element "${o}"` : "") + (e ? `, attribute "${e}"` : "") + ` ${s}`
735
+ );
736
+ }, J = function(t, e, s) {
737
+ f(this, i, w).call(this, t, e, `refers to missing property "${s}"`);
738
+ }, bt = function(t, e) {
739
+ return f(this, i, yt).call(this, t, this.getAttribute(e));
740
+ }, yt = function(t, e) {
741
+ if (e?.match(ot)) return e;
742
+ const o = h(this, m).properties[t], { type: n, values: r } = o;
743
+ if (n || f(this, i, w).call(this, null, t, "does not specify its type"), e === null)
744
+ return n === Boolean ? !1 : Pt(o);
745
+ if (n === String) {
746
+ if (r && !r.includes(e)) {
747
+ const l = r.map((u) => `"${u}"`).join(", ");
748
+ f(this, i, w).call(this, null, t, `must be one of ${l}`);
749
+ }
750
+ return e;
751
+ }
752
+ if (n === Number) return it(e);
753
+ if (n === Boolean) {
754
+ if (e === "true") return !0;
755
+ if (e === "false" || e === "null") return !1;
756
+ const l = g.getAttrName(t);
757
+ return e && e !== l && f(this, i, w).call(this, null, t, "is a Boolean attribute, so its value must match attribute name or be missing"), e === "" || e === l;
758
+ }
759
+ }, // Updates the matching attribute for a property.
760
+ // VS Code thinks this is never called, but it is called by #defineProp.
761
+ qt = function(t, e, s, o) {
762
+ if (at(s) && !f(this, i, W).call(this, t)) {
763
+ const n = e === Boolean ? this.hasAttribute(o) : f(this, i, bt).call(this, t, o);
764
+ s !== n && Ft(this, o || t, s);
765
+ }
766
+ }, // Updates all computed properties that reference this property.
767
+ // VS Code thinks this is never called, but it is called by #defineProp.
768
+ Jt = function(t) {
769
+ const s = h(this, m).propToComputedMap.get(t) || [];
770
+ for (const [o, n] of s)
771
+ f(this, i, z).call(this, o, f(this, i, S).call(this, n));
772
+ }, gt = function(t, e) {
773
+ if (e === void 0) return;
774
+ const s = t instanceof HTMLElement;
775
+ Array.isArray(e) && (e = e.join(""));
776
+ const o = typeof e;
777
+ o !== "string" && o !== "number" && f(this, i, w).call(this, t, void 0, " computed content is not a string or number");
778
+ const n = String(e);
779
+ if (t instanceof HTMLElement && _(t))
780
+ t.value = n;
781
+ else if (s && o === "string" && n.trim().startsWith("<")) {
782
+ const r = te(n);
783
+ t.innerHTML = r, f(this, i, wt).call(this, t), f(this, i, pt).call(this, t);
784
+ } else s && (t.textContent = n);
785
+ }, // Update corresponding parent web component property if bound to one.
786
+ // VS Code thinks this is never called, but it is called by #defineProp.
787
+ Xt = function(t, e) {
788
+ const s = h(this, F).get(t);
789
+ if (!s) return;
790
+ const o = this.getRootNode();
791
+ if (!(o instanceof ShadowRoot)) return;
792
+ const { host: n } = o;
793
+ if (!n) return;
794
+ const r = n;
795
+ r[s] = e;
796
+ }, // This adds expressions to the expressions arrays in propToExprsMap
797
+ // that contain calls to methods listed the usedBy array or each property.
798
+ Kt = function() {
799
+ const t = h(this, m);
800
+ function e() {
801
+ const n = /* @__PURE__ */ new Map();
802
+ t.methodToExprsMap = n;
803
+ const r = Array.from(h(this, T).keys());
804
+ for (const l of r)
805
+ for (const u of l.matchAll(Ct)) {
806
+ const p = u[1];
807
+ let d = n.get(p);
808
+ d || (d = [], n.set(p, d)), d.includes(l) || d.push(l);
809
+ }
969
810
  }
970
- #$(t) {
971
- const e = Array.from(t.querySelectorAll("*"));
972
- for (const s of e) {
973
- const i = [];
974
- for (const o of Array.from(s.attributes)) {
975
- const n = o.name;
976
- if (n.startsWith("on")) {
977
- let c = n.slice(2);
978
- c = c[0].toLowerCase() + c.slice(1).toLowerCase();
979
- const a = o.value;
980
- this.#g(s, n, a);
981
- let f;
982
- typeof this[a] == "function" ? f = (h) => this[a](h) : (this.#g(s, n, a), f = () => this.#o(a)), s.addEventListener(c, f), i.push(n);
811
+ const { properties: s, propToExprsMap: o } = t;
812
+ for (const [n, r] of Object.entries(s)) {
813
+ const l = $t(r.usedBy);
814
+ if (!l) continue;
815
+ t.methodToExprsMap || e.call(this);
816
+ const { methodToExprsMap: u } = t;
817
+ let p = o.get(n);
818
+ p || (p = [], o.set(n, p));
819
+ for (const d of l) {
820
+ if (typeof this[d] != "function")
821
+ throw new v(
822
+ `property ${n} usedBy contains non-method ${d}`
823
+ );
824
+ const b = u.get(d) || [];
825
+ for (const E of b)
826
+ p.includes(E) || p.push(E);
827
+ }
828
+ }
829
+ }, Ut = function() {
830
+ const t = new Set(Object.keys(h(this, m).properties));
831
+ for (const e of this.getAttributeNames())
832
+ if (!ee.has(e) && !e.startsWith("on")) {
833
+ if (e === "form-assoc") {
834
+ f(this, i, ut).call(this);
835
+ continue;
836
+ }
837
+ if (!t.has(g.getPropName(e))) {
838
+ if (e === "name") {
839
+ f(this, i, ut).call(this);
840
+ continue;
983
841
  }
842
+ f(this, i, w).call(this, null, e, "is not a supported attribute");
843
+ }
844
+ }
845
+ }, Y = function(t, e, s) {
846
+ const o = s.match(ot);
847
+ if (o)
848
+ return o.forEach((n) => {
849
+ const r = D(n);
850
+ this[r] === void 0 && f(this, i, J).call(this, t, e, r);
851
+ }), o;
852
+ }, Zt = function(t, e) {
853
+ for (const [s, o] of Object.entries(e)) {
854
+ let n = St(t, s);
855
+ n === void 0 && f(this, i, w).call(this, this, void 0, `invalid state path "${s}"`), n = this[o], f(this, i, V).call(this, o) || f(this, i, w).call(this, null, o, "refers to missing property in useState map");
856
+ }
857
+ }, // When type is an array, this can't validate the type of the array elements.
858
+ // This is called by #defineProp.
859
+ Yt = function(t, e, s) {
860
+ const { values: o } = h(this, m).properties[t];
861
+ if (o) {
862
+ let r;
863
+ e !== String ? r = "declares allowed values, but its type is not String" : typeof s != "string" ? r = `value is a ${typeof s}, but type is String` : o.includes(s) || (r = `must be one of ${o.map((u) => `"${u}"`).join(", ")}`), r && f(this, i, w).call(this, null, t, r);
864
+ }
865
+ if (s instanceof e) return;
866
+ let n = typeof s;
867
+ if (n === "object") {
868
+ const { constructor: r } = s;
869
+ n = r.name, r !== e && f(this, i, w).call(this, null, t, `was set to a ${n}, but must be a ${e.name}`);
870
+ }
871
+ n !== e.name.toLowerCase() && f(this, i, w).call(this, null, t, `was set to a ${n}, but must be a ${e.name}`);
872
+ }, wt = function(t) {
873
+ const e = Array.from(t.querySelectorAll("*"));
874
+ for (const s of e) {
875
+ const o = [];
876
+ for (const n of Array.from(s.attributes)) {
877
+ const r = n.name;
878
+ if (r.startsWith("on")) {
879
+ let l = r.slice(2);
880
+ l = l[0].toLowerCase() + l.slice(1).toLowerCase();
881
+ const u = n.value;
882
+ f(this, i, Y).call(this, s, r, u);
883
+ let p;
884
+ typeof this[u] == "function" ? p = (d) => this[u](d) : (f(this, i, Y).call(this, s, r, u), p = () => f(this, i, S).call(this, u)), s.addEventListener(l, p), o.push(r);
984
885
  }
985
- for (const o of i)
986
- s.removeAttribute(o);
987
886
  }
887
+ for (const n of o)
888
+ s.removeAttribute(n);
988
889
  }
989
- }
990
- function At(r, ...t) {
991
- let e = st(r, t);
890
+ }, g.attrToPropMap = /* @__PURE__ */ new Map(), g.propToAttrMap = /* @__PURE__ */ new Map(), g.context = {}, g.css = "", g.elementName = "", g.formAssociated = !1, g.html = "", g.template = null;
891
+ let X = g;
892
+ function be(c, ...a) {
893
+ let t = Ht(c, a);
992
894
  for (; ; ) {
993
- const s = ht.exec(e);
994
- if (!s) break;
995
- const i = s[2];
996
- if (et.test(i)) {
997
- const o = s[1];
895
+ const e = oe.exec(t);
896
+ if (!e) break;
897
+ const s = e[2];
898
+ if (jt.test(s)) {
899
+ const o = e[1];
998
900
  if (!o.startsWith("--")) {
999
- const n = `--${o}: ${i};
901
+ const n = `--${o}: ${s};
1000
902
  ${o}: var(--${o})`;
1001
- e = ot(e, s.index, s[0].length, n);
903
+ t = kt(t, e.index, e[0].length, n);
1002
904
  }
1003
905
  }
1004
906
  }
1005
- return e;
907
+ return t;
1006
908
  }
1007
- function St(r, ...t) {
1008
- let e = st(r, t);
909
+ function ye(c, ...a) {
910
+ let t = Ht(c, a);
1009
911
  for (; ; ) {
1010
- const s = ut.exec(e);
1011
- if (!s || s[1] === "style") break;
1012
- const i = yt(s[2]);
1013
- if (et.test(i)) {
1014
- const o = `<!-- ${i.trim()} -->`, n = s.index + s[0].indexOf(">") + 1;
1015
- e = ot(e, n, i.length, o);
912
+ const e = re.exec(t);
913
+ if (!e || e[1] === "style") break;
914
+ const s = he(e[2]);
915
+ if (jt.test(s)) {
916
+ const o = `<!-- ${s.trim()} -->`, n = e.index + e[0].indexOf(">") + 1;
917
+ t = kt(t, n, s.length, o);
1016
918
  }
1017
919
  }
1018
- return e;
920
+ return t;
1019
921
  }
1020
922
  export {
1021
- d as Wrec,
1022
- _ as WrecState,
1023
- Mt as createElement,
1024
- At as css,
1025
- St as html
923
+ X as Wrec,
924
+ rt as WrecState,
925
+ me as createElement,
926
+ be as css,
927
+ ye as html
1026
928
  };