@cal.macconnachie/web-components 0.0.20 → 1.0.1

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.
@@ -0,0 +1,883 @@
1
+ const H = globalThis, D = H.ShadowRoot && (H.ShadyCSS === void 0 || H.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, L = Symbol(), G = /* @__PURE__ */ new WeakMap();
2
+ let it = class {
3
+ constructor(t, e, s) {
4
+ if (this._$cssResult$ = !0, s !== L) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
5
+ this.cssText = t, this.t = e;
6
+ }
7
+ get styleSheet() {
8
+ let t = this.o;
9
+ const e = this.t;
10
+ if (D && t === void 0) {
11
+ const s = e !== void 0 && e.length === 1;
12
+ s && (t = G.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && G.set(e, t));
13
+ }
14
+ return t;
15
+ }
16
+ toString() {
17
+ return this.cssText;
18
+ }
19
+ };
20
+ const ct = (i) => new it(typeof i == "string" ? i : i + "", void 0, L), dt = (i, ...t) => {
21
+ const e = i.length === 1 ? i[0] : t.reduce(((s, r, o) => s + ((n) => {
22
+ if (n._$cssResult$ === !0) return n.cssText;
23
+ if (typeof n == "number") return n;
24
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + n + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
25
+ })(r) + i[o + 1]), i[0]);
26
+ return new it(e, i, L);
27
+ }, pt = (i, t) => {
28
+ if (D) i.adoptedStyleSheets = t.map(((e) => e instanceof CSSStyleSheet ? e : e.styleSheet));
29
+ else for (const e of t) {
30
+ const s = document.createElement("style"), r = H.litNonce;
31
+ r !== void 0 && s.setAttribute("nonce", r), s.textContent = e.cssText, i.appendChild(s);
32
+ }
33
+ }, J = D ? (i) => i : (i) => i instanceof CSSStyleSheet ? ((t) => {
34
+ let e = "";
35
+ for (const s of t.cssRules) e += s.cssText;
36
+ return ct(e);
37
+ })(i) : i;
38
+ const { is: ut, defineProperty: $t, getOwnPropertyDescriptor: ft, getOwnPropertyNames: mt, getOwnPropertySymbols: vt, getPrototypeOf: bt } = Object, N = globalThis, Z = N.trustedTypes, gt = Z ? Z.emptyScript : "", yt = N.reactiveElementPolyfillSupport, C = (i, t) => i, R = { toAttribute(i, t) {
39
+ switch (t) {
40
+ case Boolean:
41
+ i = i ? gt : null;
42
+ break;
43
+ case Object:
44
+ case Array:
45
+ i = i == null ? i : JSON.stringify(i);
46
+ }
47
+ return i;
48
+ }, fromAttribute(i, t) {
49
+ let e = i;
50
+ switch (t) {
51
+ case Boolean:
52
+ e = i !== null;
53
+ break;
54
+ case Number:
55
+ e = i === null ? null : Number(i);
56
+ break;
57
+ case Object:
58
+ case Array:
59
+ try {
60
+ e = JSON.parse(i);
61
+ } catch {
62
+ e = null;
63
+ }
64
+ }
65
+ return e;
66
+ } }, q = (i, t) => !ut(i, t), Q = { attribute: !0, type: String, converter: R, reflect: !1, useDefault: !1, hasChanged: q };
67
+ Symbol.metadata ??= Symbol("metadata"), N.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
68
+ let E = class extends HTMLElement {
69
+ static addInitializer(t) {
70
+ this._$Ei(), (this.l ??= []).push(t);
71
+ }
72
+ static get observedAttributes() {
73
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
74
+ }
75
+ static createProperty(t, e = Q) {
76
+ if (e.state && (e.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((e = Object.create(e)).wrapped = !0), this.elementProperties.set(t, e), !e.noAccessor) {
77
+ const s = Symbol(), r = this.getPropertyDescriptor(t, s, e);
78
+ r !== void 0 && $t(this.prototype, t, r);
79
+ }
80
+ }
81
+ static getPropertyDescriptor(t, e, s) {
82
+ const { get: r, set: o } = ft(this.prototype, t) ?? { get() {
83
+ return this[e];
84
+ }, set(n) {
85
+ this[e] = n;
86
+ } };
87
+ return { get: r, set(n) {
88
+ const h = r?.call(this);
89
+ o?.call(this, n), this.requestUpdate(t, h, s);
90
+ }, configurable: !0, enumerable: !0 };
91
+ }
92
+ static getPropertyOptions(t) {
93
+ return this.elementProperties.get(t) ?? Q;
94
+ }
95
+ static _$Ei() {
96
+ if (this.hasOwnProperty(C("elementProperties"))) return;
97
+ const t = bt(this);
98
+ t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
99
+ }
100
+ static finalize() {
101
+ if (this.hasOwnProperty(C("finalized"))) return;
102
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(C("properties"))) {
103
+ const e = this.properties, s = [...mt(e), ...vt(e)];
104
+ for (const r of s) this.createProperty(r, e[r]);
105
+ }
106
+ const t = this[Symbol.metadata];
107
+ if (t !== null) {
108
+ const e = litPropertyMetadata.get(t);
109
+ if (e !== void 0) for (const [s, r] of e) this.elementProperties.set(s, r);
110
+ }
111
+ this._$Eh = /* @__PURE__ */ new Map();
112
+ for (const [e, s] of this.elementProperties) {
113
+ const r = this._$Eu(e, s);
114
+ r !== void 0 && this._$Eh.set(r, e);
115
+ }
116
+ this.elementStyles = this.finalizeStyles(this.styles);
117
+ }
118
+ static finalizeStyles(t) {
119
+ const e = [];
120
+ if (Array.isArray(t)) {
121
+ const s = new Set(t.flat(1 / 0).reverse());
122
+ for (const r of s) e.unshift(J(r));
123
+ } else t !== void 0 && e.push(J(t));
124
+ return e;
125
+ }
126
+ static _$Eu(t, e) {
127
+ const s = e.attribute;
128
+ return s === !1 ? void 0 : typeof s == "string" ? s : typeof t == "string" ? t.toLowerCase() : void 0;
129
+ }
130
+ constructor() {
131
+ super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
132
+ }
133
+ _$Ev() {
134
+ this._$ES = new Promise(((t) => this.enableUpdating = t)), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((t) => t(this)));
135
+ }
136
+ addController(t) {
137
+ (this._$EO ??= /* @__PURE__ */ new Set()).add(t), this.renderRoot !== void 0 && this.isConnected && t.hostConnected?.();
138
+ }
139
+ removeController(t) {
140
+ this._$EO?.delete(t);
141
+ }
142
+ _$E_() {
143
+ const t = /* @__PURE__ */ new Map(), e = this.constructor.elementProperties;
144
+ for (const s of e.keys()) this.hasOwnProperty(s) && (t.set(s, this[s]), delete this[s]);
145
+ t.size > 0 && (this._$Ep = t);
146
+ }
147
+ createRenderRoot() {
148
+ const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
149
+ return pt(t, this.constructor.elementStyles), t;
150
+ }
151
+ connectedCallback() {
152
+ this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((t) => t.hostConnected?.()));
153
+ }
154
+ enableUpdating(t) {
155
+ }
156
+ disconnectedCallback() {
157
+ this._$EO?.forEach(((t) => t.hostDisconnected?.()));
158
+ }
159
+ attributeChangedCallback(t, e, s) {
160
+ this._$AK(t, s);
161
+ }
162
+ _$ET(t, e) {
163
+ const s = this.constructor.elementProperties.get(t), r = this.constructor._$Eu(t, s);
164
+ if (r !== void 0 && s.reflect === !0) {
165
+ const o = (s.converter?.toAttribute !== void 0 ? s.converter : R).toAttribute(e, s.type);
166
+ this._$Em = t, o == null ? this.removeAttribute(r) : this.setAttribute(r, o), this._$Em = null;
167
+ }
168
+ }
169
+ _$AK(t, e) {
170
+ const s = this.constructor, r = s._$Eh.get(t);
171
+ if (r !== void 0 && this._$Em !== r) {
172
+ const o = s.getPropertyOptions(r), n = typeof o.converter == "function" ? { fromAttribute: o.converter } : o.converter?.fromAttribute !== void 0 ? o.converter : R;
173
+ this._$Em = r;
174
+ const h = n.fromAttribute(e, o.type);
175
+ this[r] = h ?? this._$Ej?.get(r) ?? h, this._$Em = null;
176
+ }
177
+ }
178
+ requestUpdate(t, e, s) {
179
+ if (t !== void 0) {
180
+ const r = this.constructor, o = this[t];
181
+ if (s ??= r.getPropertyOptions(t), !((s.hasChanged ?? q)(o, e) || s.useDefault && s.reflect && o === this._$Ej?.get(t) && !this.hasAttribute(r._$Eu(t, s)))) return;
182
+ this.C(t, e, s);
183
+ }
184
+ this.isUpdatePending === !1 && (this._$ES = this._$EP());
185
+ }
186
+ C(t, e, { useDefault: s, reflect: r, wrapped: o }, n) {
187
+ s && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t) && (this._$Ej.set(t, n ?? e ?? this[t]), o !== !0 || n !== void 0) || (this._$AL.has(t) || (this.hasUpdated || s || (e = void 0), this._$AL.set(t, e)), r === !0 && this._$Em !== t && (this._$Eq ??= /* @__PURE__ */ new Set()).add(t));
188
+ }
189
+ async _$EP() {
190
+ this.isUpdatePending = !0;
191
+ try {
192
+ await this._$ES;
193
+ } catch (e) {
194
+ Promise.reject(e);
195
+ }
196
+ const t = this.scheduleUpdate();
197
+ return t != null && await t, !this.isUpdatePending;
198
+ }
199
+ scheduleUpdate() {
200
+ return this.performUpdate();
201
+ }
202
+ performUpdate() {
203
+ if (!this.isUpdatePending) return;
204
+ if (!this.hasUpdated) {
205
+ if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
206
+ for (const [r, o] of this._$Ep) this[r] = o;
207
+ this._$Ep = void 0;
208
+ }
209
+ const s = this.constructor.elementProperties;
210
+ if (s.size > 0) for (const [r, o] of s) {
211
+ const { wrapped: n } = o, h = this[r];
212
+ n !== !0 || this._$AL.has(r) || h === void 0 || this.C(r, void 0, o, h);
213
+ }
214
+ }
215
+ let t = !1;
216
+ const e = this._$AL;
217
+ try {
218
+ t = this.shouldUpdate(e), t ? (this.willUpdate(e), this._$EO?.forEach(((s) => s.hostUpdate?.())), this.update(e)) : this._$EM();
219
+ } catch (s) {
220
+ throw t = !1, this._$EM(), s;
221
+ }
222
+ t && this._$AE(e);
223
+ }
224
+ willUpdate(t) {
225
+ }
226
+ _$AE(t) {
227
+ this._$EO?.forEach(((e) => e.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
228
+ }
229
+ _$EM() {
230
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
231
+ }
232
+ get updateComplete() {
233
+ return this.getUpdateComplete();
234
+ }
235
+ getUpdateComplete() {
236
+ return this._$ES;
237
+ }
238
+ shouldUpdate(t) {
239
+ return !0;
240
+ }
241
+ update(t) {
242
+ this._$Eq &&= this._$Eq.forEach(((e) => this._$ET(e, this[e]))), this._$EM();
243
+ }
244
+ updated(t) {
245
+ }
246
+ firstUpdated(t) {
247
+ }
248
+ };
249
+ E.elementStyles = [], E.shadowRootOptions = { mode: "open" }, E[C("elementProperties")] = /* @__PURE__ */ new Map(), E[C("finalized")] = /* @__PURE__ */ new Map(), yt?.({ ReactiveElement: E }), (N.reactiveElementVersions ??= []).push("2.1.1");
250
+ const V = globalThis, z = V.trustedTypes, X = z ? z.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, ot = "$lit$", b = `lit$${Math.random().toFixed(9).slice(2)}$`, nt = "?" + b, _t = `<${nt}>`, _ = document, T = () => _.createComment(""), U = (i) => i === null || typeof i != "object" && typeof i != "function", W = Array.isArray, At = (i) => W(i) || typeof i?.[Symbol.iterator] == "function", I = `[
251
+ \f\r]`, S = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Y = /-->/g, tt = />/g, g = RegExp(`>|${I}(?:([^\\s"'>=/]+)(${I}*=${I}*(?:[^
252
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), et = /'/g, st = /"/g, at = /^(?:script|style|textarea|title)$/i, Et = (i) => (t, ...e) => ({ _$litType$: i, strings: t, values: e }), x = Et(1), A = Symbol.for("lit-noChange"), c = Symbol.for("lit-nothing"), rt = /* @__PURE__ */ new WeakMap(), y = _.createTreeWalker(_, 129);
253
+ function ht(i, t) {
254
+ if (!W(i) || !i.hasOwnProperty("raw")) throw Error("invalid template strings array");
255
+ return X !== void 0 ? X.createHTML(t) : t;
256
+ }
257
+ const wt = (i, t) => {
258
+ const e = i.length - 1, s = [];
259
+ let r, o = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", n = S;
260
+ for (let h = 0; h < e; h++) {
261
+ const a = i[h];
262
+ let d, p, l = -1, m = 0;
263
+ for (; m < a.length && (n.lastIndex = m, p = n.exec(a), p !== null); ) m = n.lastIndex, n === S ? p[1] === "!--" ? n = Y : p[1] !== void 0 ? n = tt : p[2] !== void 0 ? (at.test(p[2]) && (r = RegExp("</" + p[2], "g")), n = g) : p[3] !== void 0 && (n = g) : n === g ? p[0] === ">" ? (n = r ?? S, l = -1) : p[1] === void 0 ? l = -2 : (l = n.lastIndex - p[2].length, d = p[1], n = p[3] === void 0 ? g : p[3] === '"' ? st : et) : n === st || n === et ? n = g : n === Y || n === tt ? n = S : (n = g, r = void 0);
264
+ const v = n === g && i[h + 1].startsWith("/>") ? " " : "";
265
+ o += n === S ? a + _t : l >= 0 ? (s.push(d), a.slice(0, l) + ot + a.slice(l) + b + v) : a + b + (l === -2 ? h : v);
266
+ }
267
+ return [ht(i, o + (i[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
268
+ };
269
+ class O {
270
+ constructor({ strings: t, _$litType$: e }, s) {
271
+ let r;
272
+ this.parts = [];
273
+ let o = 0, n = 0;
274
+ const h = t.length - 1, a = this.parts, [d, p] = wt(t, e);
275
+ if (this.el = O.createElement(d, s), y.currentNode = this.el.content, e === 2 || e === 3) {
276
+ const l = this.el.content.firstChild;
277
+ l.replaceWith(...l.childNodes);
278
+ }
279
+ for (; (r = y.nextNode()) !== null && a.length < h; ) {
280
+ if (r.nodeType === 1) {
281
+ if (r.hasAttributes()) for (const l of r.getAttributeNames()) if (l.endsWith(ot)) {
282
+ const m = p[n++], v = r.getAttribute(l).split(b), k = /([.?@])?(.*)/.exec(m);
283
+ a.push({ type: 1, index: o, name: k[2], strings: v, ctor: k[1] === "." ? xt : k[1] === "?" ? Ct : k[1] === "@" ? Pt : j }), r.removeAttribute(l);
284
+ } else l.startsWith(b) && (a.push({ type: 6, index: o }), r.removeAttribute(l));
285
+ if (at.test(r.tagName)) {
286
+ const l = r.textContent.split(b), m = l.length - 1;
287
+ if (m > 0) {
288
+ r.textContent = z ? z.emptyScript : "";
289
+ for (let v = 0; v < m; v++) r.append(l[v], T()), y.nextNode(), a.push({ type: 2, index: ++o });
290
+ r.append(l[m], T());
291
+ }
292
+ }
293
+ } else if (r.nodeType === 8) if (r.data === nt) a.push({ type: 2, index: o });
294
+ else {
295
+ let l = -1;
296
+ for (; (l = r.data.indexOf(b, l + 1)) !== -1; ) a.push({ type: 7, index: o }), l += b.length - 1;
297
+ }
298
+ o++;
299
+ }
300
+ }
301
+ static createElement(t, e) {
302
+ const s = _.createElement("template");
303
+ return s.innerHTML = t, s;
304
+ }
305
+ }
306
+ function w(i, t, e = i, s) {
307
+ if (t === A) return t;
308
+ let r = s !== void 0 ? e._$Co?.[s] : e._$Cl;
309
+ const o = U(t) ? void 0 : t._$litDirective$;
310
+ return r?.constructor !== o && (r?._$AO?.(!1), o === void 0 ? r = void 0 : (r = new o(i), r._$AT(i, e, s)), s !== void 0 ? (e._$Co ??= [])[s] = r : e._$Cl = r), r !== void 0 && (t = w(i, r._$AS(i, t.values), r, s)), t;
311
+ }
312
+ class St {
313
+ constructor(t, e) {
314
+ this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
315
+ }
316
+ get parentNode() {
317
+ return this._$AM.parentNode;
318
+ }
319
+ get _$AU() {
320
+ return this._$AM._$AU;
321
+ }
322
+ u(t) {
323
+ const { el: { content: e }, parts: s } = this._$AD, r = (t?.creationScope ?? _).importNode(e, !0);
324
+ y.currentNode = r;
325
+ let o = y.nextNode(), n = 0, h = 0, a = s[0];
326
+ for (; a !== void 0; ) {
327
+ if (n === a.index) {
328
+ let d;
329
+ a.type === 2 ? d = new M(o, o.nextSibling, this, t) : a.type === 1 ? d = new a.ctor(o, a.name, a.strings, this, t) : a.type === 6 && (d = new Tt(o, this, t)), this._$AV.push(d), a = s[++h];
330
+ }
331
+ n !== a?.index && (o = y.nextNode(), n++);
332
+ }
333
+ return y.currentNode = _, r;
334
+ }
335
+ p(t) {
336
+ let e = 0;
337
+ for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, e), e += s.strings.length - 2) : s._$AI(t[e])), e++;
338
+ }
339
+ }
340
+ class M {
341
+ get _$AU() {
342
+ return this._$AM?._$AU ?? this._$Cv;
343
+ }
344
+ constructor(t, e, s, r) {
345
+ this.type = 2, this._$AH = c, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = r, this._$Cv = r?.isConnected ?? !0;
346
+ }
347
+ get parentNode() {
348
+ let t = this._$AA.parentNode;
349
+ const e = this._$AM;
350
+ return e !== void 0 && t?.nodeType === 11 && (t = e.parentNode), t;
351
+ }
352
+ get startNode() {
353
+ return this._$AA;
354
+ }
355
+ get endNode() {
356
+ return this._$AB;
357
+ }
358
+ _$AI(t, e = this) {
359
+ t = w(this, t, e), U(t) ? t === c || t == null || t === "" ? (this._$AH !== c && this._$AR(), this._$AH = c) : t !== this._$AH && t !== A && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : At(t) ? this.k(t) : this._(t);
360
+ }
361
+ O(t) {
362
+ return this._$AA.parentNode.insertBefore(t, this._$AB);
363
+ }
364
+ T(t) {
365
+ this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
366
+ }
367
+ _(t) {
368
+ this._$AH !== c && U(this._$AH) ? this._$AA.nextSibling.data = t : this.T(_.createTextNode(t)), this._$AH = t;
369
+ }
370
+ $(t) {
371
+ const { values: e, _$litType$: s } = t, r = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = O.createElement(ht(s.h, s.h[0]), this.options)), s);
372
+ if (this._$AH?._$AD === r) this._$AH.p(e);
373
+ else {
374
+ const o = new St(r, this), n = o.u(this.options);
375
+ o.p(e), this.T(n), this._$AH = o;
376
+ }
377
+ }
378
+ _$AC(t) {
379
+ let e = rt.get(t.strings);
380
+ return e === void 0 && rt.set(t.strings, e = new O(t)), e;
381
+ }
382
+ k(t) {
383
+ W(this._$AH) || (this._$AH = [], this._$AR());
384
+ const e = this._$AH;
385
+ let s, r = 0;
386
+ for (const o of t) r === e.length ? e.push(s = new M(this.O(T()), this.O(T()), this, this.options)) : s = e[r], s._$AI(o), r++;
387
+ r < e.length && (this._$AR(s && s._$AB.nextSibling, r), e.length = r);
388
+ }
389
+ _$AR(t = this._$AA.nextSibling, e) {
390
+ for (this._$AP?.(!1, !0, e); t !== this._$AB; ) {
391
+ const s = t.nextSibling;
392
+ t.remove(), t = s;
393
+ }
394
+ }
395
+ setConnected(t) {
396
+ this._$AM === void 0 && (this._$Cv = t, this._$AP?.(t));
397
+ }
398
+ }
399
+ class j {
400
+ get tagName() {
401
+ return this.element.tagName;
402
+ }
403
+ get _$AU() {
404
+ return this._$AM._$AU;
405
+ }
406
+ constructor(t, e, s, r, o) {
407
+ this.type = 1, this._$AH = c, this._$AN = void 0, this.element = t, this.name = e, this._$AM = r, this.options = o, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = c;
408
+ }
409
+ _$AI(t, e = this, s, r) {
410
+ const o = this.strings;
411
+ let n = !1;
412
+ if (o === void 0) t = w(this, t, e, 0), n = !U(t) || t !== this._$AH && t !== A, n && (this._$AH = t);
413
+ else {
414
+ const h = t;
415
+ let a, d;
416
+ for (t = o[0], a = 0; a < o.length - 1; a++) d = w(this, h[s + a], e, a), d === A && (d = this._$AH[a]), n ||= !U(d) || d !== this._$AH[a], d === c ? t = c : t !== c && (t += (d ?? "") + o[a + 1]), this._$AH[a] = d;
417
+ }
418
+ n && !r && this.j(t);
419
+ }
420
+ j(t) {
421
+ t === c ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
422
+ }
423
+ }
424
+ class xt extends j {
425
+ constructor() {
426
+ super(...arguments), this.type = 3;
427
+ }
428
+ j(t) {
429
+ this.element[this.name] = t === c ? void 0 : t;
430
+ }
431
+ }
432
+ class Ct extends j {
433
+ constructor() {
434
+ super(...arguments), this.type = 4;
435
+ }
436
+ j(t) {
437
+ this.element.toggleAttribute(this.name, !!t && t !== c);
438
+ }
439
+ }
440
+ class Pt extends j {
441
+ constructor(t, e, s, r, o) {
442
+ super(t, e, s, r, o), this.type = 5;
443
+ }
444
+ _$AI(t, e = this) {
445
+ if ((t = w(this, t, e, 0) ?? c) === A) return;
446
+ const s = this._$AH, r = t === c && s !== c || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, o = t !== c && (s === c || r);
447
+ r && this.element.removeEventListener(this.name, this, s), o && this.element.addEventListener(this.name, this, t), this._$AH = t;
448
+ }
449
+ handleEvent(t) {
450
+ typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, t) : this._$AH.handleEvent(t);
451
+ }
452
+ }
453
+ class Tt {
454
+ constructor(t, e, s) {
455
+ this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s;
456
+ }
457
+ get _$AU() {
458
+ return this._$AM._$AU;
459
+ }
460
+ _$AI(t) {
461
+ w(this, t);
462
+ }
463
+ }
464
+ const Ut = V.litHtmlPolyfillSupport;
465
+ Ut?.(O, M), (V.litHtmlVersions ??= []).push("3.3.1");
466
+ const Ot = (i, t, e) => {
467
+ const s = e?.renderBefore ?? t;
468
+ let r = s._$litPart$;
469
+ if (r === void 0) {
470
+ const o = e?.renderBefore ?? null;
471
+ s._$litPart$ = r = new M(t.insertBefore(T(), o), o, void 0, e ?? {});
472
+ }
473
+ return r._$AI(i), r;
474
+ };
475
+ const K = globalThis;
476
+ let P = class extends E {
477
+ constructor() {
478
+ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
479
+ }
480
+ createRenderRoot() {
481
+ const t = super.createRenderRoot();
482
+ return this.renderOptions.renderBefore ??= t.firstChild, t;
483
+ }
484
+ update(t) {
485
+ const e = this.render();
486
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Ot(e, this.renderRoot, this.renderOptions);
487
+ }
488
+ connectedCallback() {
489
+ super.connectedCallback(), this._$Do?.setConnected(!0);
490
+ }
491
+ disconnectedCallback() {
492
+ super.disconnectedCallback(), this._$Do?.setConnected(!1);
493
+ }
494
+ render() {
495
+ return A;
496
+ }
497
+ };
498
+ P._$litElement$ = !0, P.finalized = !0, K.litElementHydrateSupport?.({ LitElement: P });
499
+ const Mt = K.litElementPolyfillSupport;
500
+ Mt?.({ LitElement: P });
501
+ (K.litElementVersions ??= []).push("4.2.1");
502
+ const kt = (i) => (t, e) => {
503
+ e !== void 0 ? e.addInitializer((() => {
504
+ customElements.define(i, t);
505
+ })) : customElements.define(i, t);
506
+ };
507
+ const Ht = { attribute: !0, type: String, converter: R, reflect: !1, hasChanged: q }, Rt = (i = Ht, t, e) => {
508
+ const { kind: s, metadata: r } = e;
509
+ let o = globalThis.litPropertyMetadata.get(r);
510
+ if (o === void 0 && globalThis.litPropertyMetadata.set(r, o = /* @__PURE__ */ new Map()), s === "setter" && ((i = Object.create(i)).wrapped = !0), o.set(e.name, i), s === "accessor") {
511
+ const { name: n } = e;
512
+ return { set(h) {
513
+ const a = t.get.call(this);
514
+ t.set.call(this, h), this.requestUpdate(n, a, i);
515
+ }, init(h) {
516
+ return h !== void 0 && this.C(n, void 0, i, h), h;
517
+ } };
518
+ }
519
+ if (s === "setter") {
520
+ const { name: n } = e;
521
+ return function(h) {
522
+ const a = this[n];
523
+ t.call(this, h), this.requestUpdate(n, a, i);
524
+ };
525
+ }
526
+ throw Error("Unsupported decorator location: " + s);
527
+ };
528
+ function $(i) {
529
+ return (t, e) => typeof e == "object" ? Rt(i, t, e) : ((s, r, o) => {
530
+ const n = r.hasOwnProperty(o);
531
+ return r.constructor.createProperty(o, s), n ? Object.getOwnPropertyDescriptor(r, o) : void 0;
532
+ })(i, t, e);
533
+ }
534
+ const zt = (i, t, e) => (e.configurable = !0, e.enumerable = !0, Reflect.decorate && typeof t != "object" && Object.defineProperty(i, t, e), e);
535
+ function Nt(i, t) {
536
+ return (e, s, r) => {
537
+ const o = (n) => n.renderRoot?.querySelector(i) ?? null;
538
+ return zt(e, s, { get() {
539
+ return o(this);
540
+ } });
541
+ };
542
+ }
543
+ const jt = { ATTRIBUTE: 1 }, It = (i) => (...t) => ({ _$litDirective$: i, values: t });
544
+ class Bt {
545
+ constructor(t) {
546
+ }
547
+ get _$AU() {
548
+ return this._$AM._$AU;
549
+ }
550
+ _$AT(t, e, s) {
551
+ this._$Ct = t, this._$AM = e, this._$Ci = s;
552
+ }
553
+ _$AS(t, e) {
554
+ return this.update(t, e);
555
+ }
556
+ update(t, e) {
557
+ return this.render(...e);
558
+ }
559
+ }
560
+ const Dt = It(class extends Bt {
561
+ constructor(i) {
562
+ if (super(i), i.type !== jt.ATTRIBUTE || i.name !== "class" || i.strings?.length > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
563
+ }
564
+ render(i) {
565
+ return " " + Object.keys(i).filter(((t) => i[t])).join(" ") + " ";
566
+ }
567
+ update(i, [t]) {
568
+ if (this.st === void 0) {
569
+ this.st = /* @__PURE__ */ new Set(), i.strings !== void 0 && (this.nt = new Set(i.strings.join(" ").split(/\s/).filter(((s) => s !== ""))));
570
+ for (const s in t) t[s] && !this.nt?.has(s) && this.st.add(s);
571
+ return this.render(t);
572
+ }
573
+ const e = i.element.classList;
574
+ for (const s of this.st) s in t || (e.remove(s), this.st.delete(s));
575
+ for (const s in t) {
576
+ const r = !!t[s];
577
+ r === this.st.has(s) || this.nt?.has(s) || (r ? (e.add(s), this.st.add(s)) : (e.remove(s), this.st.delete(s)));
578
+ }
579
+ return A;
580
+ }
581
+ });
582
+ const B = (i) => i ?? c;
583
+ var Lt = Object.defineProperty, lt = (i, t, e, s) => {
584
+ for (var r = void 0, o = i.length - 1, n; o >= 0; o--)
585
+ (n = i[o]) && (r = n(t, e, r) || r);
586
+ return r && Lt(t, e, r), r;
587
+ };
588
+ class F extends P {
589
+ constructor() {
590
+ super(...arguments), this.theme = "light", this.storageKey = "theme-preference", this.boundThemeChangeHandler = this.handleGlobalThemeChange.bind(this);
591
+ }
592
+ connectedCallback() {
593
+ super.connectedCallback();
594
+ const t = document.documentElement.getAttribute("data-theme"), e = localStorage.getItem(this.storageKey), s = window.matchMedia("(prefers-color-scheme: dark)").matches;
595
+ t ? this.theme = t : e ? (this.theme = e, this.applyTheme()) : s ? (this.theme = "dark", this.applyTheme()) : this.applyTheme(), window.addEventListener("theme-changed", this.boundThemeChangeHandler);
596
+ }
597
+ disconnectedCallback() {
598
+ window.removeEventListener("theme-changed", this.boundThemeChangeHandler), super.disconnectedCallback();
599
+ }
600
+ handleGlobalThemeChange(t) {
601
+ const e = t;
602
+ e.target !== this && e.detail.theme !== this.theme && (this.theme = e.detail.theme);
603
+ }
604
+ applyTheme() {
605
+ document.documentElement.setAttribute("data-theme", this.theme), localStorage.setItem(this.storageKey, this.theme), this.dispatchEvent(
606
+ new CustomEvent("theme-changed", {
607
+ detail: { theme: this.theme },
608
+ bubbles: !0,
609
+ composed: !0
610
+ })
611
+ );
612
+ }
613
+ }
614
+ lt([
615
+ $({ type: String, attribute: "data-theme", reflect: !0 })
616
+ ], F.prototype, "theme");
617
+ lt([
618
+ $({ type: String, attribute: "storage-key" })
619
+ ], F.prototype, "storageKey");
620
+ var qt = Object.defineProperty, Vt = Object.getOwnPropertyDescriptor, f = (i, t, e, s) => {
621
+ for (var r = s > 1 ? void 0 : s ? Vt(t, e) : t, o = i.length - 1, n; o >= 0; o--)
622
+ (n = i[o]) && (r = (s ? n(t, e, r) : n(r)) || r);
623
+ return s && r && qt(t, e, r), r;
624
+ };
625
+ let u = class extends F {
626
+ constructor() {
627
+ super(...arguments), this.value = "", this.type = "text", this.required = !1, this.disabled = !1, this.size = "md", this.inputId = `input-${Math.random().toString(36).substr(2, 9)}`;
628
+ }
629
+ handleInput(i) {
630
+ const t = i.target;
631
+ this.value = t.value, this.dispatchEvent(
632
+ new CustomEvent("input", {
633
+ detail: { value: t.value },
634
+ bubbles: !0,
635
+ composed: !0
636
+ })
637
+ );
638
+ }
639
+ handleFocus() {
640
+ this.dispatchEvent(
641
+ new CustomEvent("focus", {
642
+ bubbles: !0,
643
+ composed: !0
644
+ })
645
+ );
646
+ }
647
+ handleBlur() {
648
+ this.dispatchEvent(
649
+ new CustomEvent("blur", {
650
+ bubbles: !0,
651
+ composed: !0
652
+ })
653
+ );
654
+ }
655
+ focus() {
656
+ this.inputElement?.focus();
657
+ }
658
+ render() {
659
+ const i = !!this.error, t = {
660
+ "base-input": !0,
661
+ [`base-input--${this.size}`]: !0,
662
+ "base-input--error": i,
663
+ "base-input--disabled": this.disabled
664
+ };
665
+ return x`
666
+ <div class="input-group">
667
+ ${this.label ? x`
668
+ <label for=${this.inputId} class="input-label">
669
+ ${this.label}
670
+ ${this.required ? x`<span class="required-indicator" aria-label="required">*</span>` : ""}
671
+ </label>
672
+ ` : ""}
673
+
674
+ <div class="input-wrapper">
675
+ <input
676
+ id=${this.inputId}
677
+ class=${Dt(t)}
678
+ type=${this.type}
679
+ placeholder=${B(this.placeholder)}
680
+ ?disabled=${this.disabled}
681
+ ?required=${this.required}
682
+ autocomplete=${B(this.autocomplete)}
683
+ aria-describedby=${B(i ? `${this.inputId}-error` : void 0)}
684
+ aria-invalid=${i}
685
+ .value=${this.value}
686
+ @input=${this.handleInput}
687
+ @blur=${this.handleBlur}
688
+ @focus=${this.handleFocus}
689
+ />
690
+
691
+ <div class="input-suffix">
692
+ <slot name="suffix"></slot>
693
+ </div>
694
+ </div>
695
+
696
+ ${i ? x`
697
+ <div id="${this.inputId}-error" class="input-error" role="alert">
698
+ ${this.error}
699
+ </div>
700
+ ` : this.hint ? x` <div class="input-hint">${this.hint}</div> ` : ""}
701
+ </div>
702
+ `;
703
+ }
704
+ };
705
+ u.styles = dt`
706
+ :host {
707
+ display: block;
708
+ }
709
+
710
+ .input-group {
711
+ display: flex;
712
+ flex-direction: column;
713
+ gap: var(--space-2);
714
+ }
715
+
716
+ .input-label {
717
+ display: flex;
718
+ align-items: center;
719
+ gap: var(--space-1);
720
+ font-size: var(--font-size-sm);
721
+ font-weight: var(--font-weight-medium);
722
+ color: var(--color-text-primary);
723
+ line-height: var(--line-height-tight);
724
+ }
725
+
726
+ .required-indicator {
727
+ color: var(--color-error);
728
+ font-weight: var(--font-weight-bold);
729
+ }
730
+
731
+ .input-wrapper {
732
+ position: relative;
733
+ display: flex;
734
+ align-items: center;
735
+ }
736
+
737
+ .base-input {
738
+ width: 100%;
739
+ font-family: var(--font-family-sans);
740
+ background-color: var(--color-bg-primary);
741
+ border: 1px solid var(--color-border);
742
+ border-radius: var(--radius-md);
743
+ transition: all var(--transition-fast);
744
+ color: var(--color-text-primary);
745
+ }
746
+
747
+ .base-input:hover:not(:disabled) {
748
+ border-color: var(--color-border-hover);
749
+ }
750
+
751
+ .base-input:focus {
752
+ outline: none;
753
+ border-color: var(--color-border-focus);
754
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
755
+ }
756
+
757
+ .base-input::placeholder {
758
+ color: var(--color-text-muted);
759
+ }
760
+
761
+ /* Autofill animation to prevent flash */
762
+ @keyframes autofillBackground {
763
+ to {
764
+ background-color: var(--color-bg-primary);
765
+ color: var(--color-text-primary);
766
+ }
767
+ }
768
+
769
+ /* Autofill styles - completely override browser defaults */
770
+ .base-input:-webkit-autofill {
771
+ -webkit-box-shadow: 0 0 0 1000px var(--color-bg-primary) inset !important;
772
+ box-shadow: 0 0 0 1000px var(--color-bg-primary) inset !important;
773
+ -webkit-text-fill-color: var(--color-text-primary) !important;
774
+ background-color: var(--color-bg-primary) !important;
775
+ border-color: var(--color-border) !important;
776
+ transition: border-color var(--transition-fast) !important;
777
+ animation: autofillBackground 0s forwards;
778
+ }
779
+
780
+ .base-input:-webkit-autofill:hover:not(:disabled) {
781
+ -webkit-box-shadow: 0 0 0 1000px var(--color-bg-primary) inset !important;
782
+ box-shadow: 0 0 0 1000px var(--color-bg-primary) inset !important;
783
+ border-color: var(--color-border-hover) !important;
784
+ }
785
+
786
+ .base-input:-webkit-autofill:focus {
787
+ -webkit-box-shadow: 0 0 0 1000px var(--color-bg-primary) inset !important;
788
+ box-shadow: 0 0 0 1000px var(--color-bg-primary) inset !important;
789
+ border-color: var(--color-border-focus) !important;
790
+ box-shadow: 0 0 0 1000px var(--color-bg-primary) inset, 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
791
+ }
792
+
793
+ /* Sizes */
794
+ .base-input--sm {
795
+ padding: var(--space-2) var(--space-3);
796
+ font-size: var(--font-size-sm);
797
+ }
798
+
799
+ .base-input--md {
800
+ padding: var(--space-3) var(--space-4);
801
+ font-size: var(--font-size-base);
802
+ }
803
+
804
+ .base-input--lg {
805
+ padding: var(--space-4) var(--space-5);
806
+ font-size: var(--font-size-lg);
807
+ }
808
+
809
+ /* States */
810
+ .base-input--error {
811
+ border-color: var(--color-error);
812
+ }
813
+
814
+ .base-input--error:focus {
815
+ border-color: var(--color-error);
816
+ box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
817
+ }
818
+
819
+ .base-input--disabled {
820
+ opacity: 0.5;
821
+ cursor: not-allowed;
822
+ background-color: var(--color-bg-muted);
823
+ }
824
+
825
+ .input-suffix {
826
+ position: absolute;
827
+ right: var(--space-3);
828
+ display: flex;
829
+ align-items: center;
830
+ color: var(--color-text-muted);
831
+ }
832
+
833
+ .input-error {
834
+ font-size: var(--font-size-sm);
835
+ color: var(--color-error);
836
+ line-height: var(--line-height-tight);
837
+ }
838
+
839
+ .input-hint {
840
+ font-size: var(--font-size-sm);
841
+ color: var(--color-text-muted);
842
+ line-height: var(--line-height-tight);
843
+ }
844
+ `;
845
+ f([
846
+ $({ type: String })
847
+ ], u.prototype, "value", 2);
848
+ f([
849
+ $({ type: String })
850
+ ], u.prototype, "label", 2);
851
+ f([
852
+ $({ type: String })
853
+ ], u.prototype, "placeholder", 2);
854
+ f([
855
+ $({ type: String })
856
+ ], u.prototype, "type", 2);
857
+ f([
858
+ $({ type: Boolean, reflect: !0 })
859
+ ], u.prototype, "required", 2);
860
+ f([
861
+ $({ type: Boolean, reflect: !0 })
862
+ ], u.prototype, "disabled", 2);
863
+ f([
864
+ $({ type: String })
865
+ ], u.prototype, "error", 2);
866
+ f([
867
+ $({ type: String })
868
+ ], u.prototype, "hint", 2);
869
+ f([
870
+ $({ type: String })
871
+ ], u.prototype, "autocomplete", 2);
872
+ f([
873
+ $({ type: String })
874
+ ], u.prototype, "size", 2);
875
+ f([
876
+ Nt("input")
877
+ ], u.prototype, "inputElement", 2);
878
+ u = f([
879
+ kt("base-input")
880
+ ], u);
881
+ export {
882
+ u as BaseInput
883
+ };