@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,879 @@
1
+ const k = globalThis, z = k.ShadowRoot && (k.ShadyCSS === void 0 || k.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, B = Symbol(), G = /* @__PURE__ */ new WeakMap();
2
+ let it = class {
3
+ constructor(t, e, s) {
4
+ if (this._$cssResult$ = !0, s !== B) 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 (z && 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 lt = (r) => new it(typeof r == "string" ? r : r + "", void 0, B), dt = (r, ...t) => {
21
+ const e = r.length === 1 ? r[0] : t.reduce(((s, i, n) => s + ((o) => {
22
+ if (o._$cssResult$ === !0) return o.cssText;
23
+ if (typeof o == "number") return o;
24
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + o + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
25
+ })(i) + r[n + 1]), r[0]);
26
+ return new it(e, r, B);
27
+ }, ct = (r, t) => {
28
+ if (z) r.adoptedStyleSheets = t.map(((e) => e instanceof CSSStyleSheet ? e : e.styleSheet));
29
+ else for (const e of t) {
30
+ const s = document.createElement("style"), i = k.litNonce;
31
+ i !== void 0 && s.setAttribute("nonce", i), s.textContent = e.cssText, r.appendChild(s);
32
+ }
33
+ }, J = z ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
34
+ let e = "";
35
+ for (const s of t.cssRules) e += s.cssText;
36
+ return lt(e);
37
+ })(r) : r;
38
+ const { is: pt, defineProperty: ut, getOwnPropertyDescriptor: $t, getOwnPropertyNames: ft, getOwnPropertySymbols: mt, getPrototypeOf: vt } = Object, R = globalThis, Z = R.trustedTypes, gt = Z ? Z.emptyScript : "", bt = R.reactiveElementPolyfillSupport, S = (r, t) => r, H = { toAttribute(r, t) {
39
+ switch (t) {
40
+ case Boolean:
41
+ r = r ? gt : null;
42
+ break;
43
+ case Object:
44
+ case Array:
45
+ r = r == null ? r : JSON.stringify(r);
46
+ }
47
+ return r;
48
+ }, fromAttribute(r, t) {
49
+ let e = r;
50
+ switch (t) {
51
+ case Boolean:
52
+ e = r !== null;
53
+ break;
54
+ case Number:
55
+ e = r === null ? null : Number(r);
56
+ break;
57
+ case Object:
58
+ case Array:
59
+ try {
60
+ e = JSON.parse(r);
61
+ } catch {
62
+ e = null;
63
+ }
64
+ }
65
+ return e;
66
+ } }, L = (r, t) => !pt(r, t), F = { attribute: !0, type: String, converter: H, reflect: !1, useDefault: !1, hasChanged: L };
67
+ Symbol.metadata ??= Symbol("metadata"), R.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
68
+ let A = 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 = F) {
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(), i = this.getPropertyDescriptor(t, s, e);
78
+ i !== void 0 && ut(this.prototype, t, i);
79
+ }
80
+ }
81
+ static getPropertyDescriptor(t, e, s) {
82
+ const { get: i, set: n } = $t(this.prototype, t) ?? { get() {
83
+ return this[e];
84
+ }, set(o) {
85
+ this[e] = o;
86
+ } };
87
+ return { get: i, set(o) {
88
+ const h = i?.call(this);
89
+ n?.call(this, o), this.requestUpdate(t, h, s);
90
+ }, configurable: !0, enumerable: !0 };
91
+ }
92
+ static getPropertyOptions(t) {
93
+ return this.elementProperties.get(t) ?? F;
94
+ }
95
+ static _$Ei() {
96
+ if (this.hasOwnProperty(S("elementProperties"))) return;
97
+ const t = vt(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(S("finalized"))) return;
102
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(S("properties"))) {
103
+ const e = this.properties, s = [...ft(e), ...mt(e)];
104
+ for (const i of s) this.createProperty(i, e[i]);
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, i] of e) this.elementProperties.set(s, i);
110
+ }
111
+ this._$Eh = /* @__PURE__ */ new Map();
112
+ for (const [e, s] of this.elementProperties) {
113
+ const i = this._$Eu(e, s);
114
+ i !== void 0 && this._$Eh.set(i, 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 i of s) e.unshift(J(i));
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 ct(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), i = this.constructor._$Eu(t, s);
164
+ if (i !== void 0 && s.reflect === !0) {
165
+ const n = (s.converter?.toAttribute !== void 0 ? s.converter : H).toAttribute(e, s.type);
166
+ this._$Em = t, n == null ? this.removeAttribute(i) : this.setAttribute(i, n), this._$Em = null;
167
+ }
168
+ }
169
+ _$AK(t, e) {
170
+ const s = this.constructor, i = s._$Eh.get(t);
171
+ if (i !== void 0 && this._$Em !== i) {
172
+ const n = s.getPropertyOptions(i), o = typeof n.converter == "function" ? { fromAttribute: n.converter } : n.converter?.fromAttribute !== void 0 ? n.converter : H;
173
+ this._$Em = i;
174
+ const h = o.fromAttribute(e, n.type);
175
+ this[i] = h ?? this._$Ej?.get(i) ?? h, this._$Em = null;
176
+ }
177
+ }
178
+ requestUpdate(t, e, s) {
179
+ if (t !== void 0) {
180
+ const i = this.constructor, n = this[t];
181
+ if (s ??= i.getPropertyOptions(t), !((s.hasChanged ?? L)(n, e) || s.useDefault && s.reflect && n === this._$Ej?.get(t) && !this.hasAttribute(i._$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: i, wrapped: n }, o) {
187
+ s && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t) && (this._$Ej.set(t, o ?? e ?? this[t]), n !== !0 || o !== void 0) || (this._$AL.has(t) || (this.hasUpdated || s || (e = void 0), this._$AL.set(t, e)), i === !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 [i, n] of this._$Ep) this[i] = n;
207
+ this._$Ep = void 0;
208
+ }
209
+ const s = this.constructor.elementProperties;
210
+ if (s.size > 0) for (const [i, n] of s) {
211
+ const { wrapped: o } = n, h = this[i];
212
+ o !== !0 || this._$AL.has(i) || h === void 0 || this.C(i, void 0, n, 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
+ A.elementStyles = [], A.shadowRootOptions = { mode: "open" }, A[S("elementProperties")] = /* @__PURE__ */ new Map(), A[S("finalized")] = /* @__PURE__ */ new Map(), bt?.({ ReactiveElement: A }), (R.reactiveElementVersions ??= []).push("2.1.1");
250
+ const V = globalThis, N = V.trustedTypes, Y = N ? N.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, rt = "$lit$", f = `lit$${Math.random().toFixed(9).slice(2)}$`, nt = "?" + f, _t = `<${nt}>`, b = document, P = () => b.createComment(""), T = (r) => r === null || typeof r != "object" && typeof r != "function", q = Array.isArray, yt = (r) => q(r) || typeof r?.[Symbol.iterator] == "function", I = `[
251
+ \f\r]`, w = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Q = /-->/g, X = />/g, v = RegExp(`>|${I}(?:([^\\s"'>=/]+)(${I}*=${I}*(?:[^
252
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), tt = /'/g, et = /"/g, ot = /^(?:script|style|textarea|title)$/i, At = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), D = At(1), _ = Symbol.for("lit-noChange"), c = Symbol.for("lit-nothing"), st = /* @__PURE__ */ new WeakMap(), g = b.createTreeWalker(b, 129);
253
+ function at(r, t) {
254
+ if (!q(r) || !r.hasOwnProperty("raw")) throw Error("invalid template strings array");
255
+ return Y !== void 0 ? Y.createHTML(t) : t;
256
+ }
257
+ const Et = (r, t) => {
258
+ const e = r.length - 1, s = [];
259
+ let i, n = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = w;
260
+ for (let h = 0; h < e; h++) {
261
+ const a = r[h];
262
+ let d, p, l = -1, u = 0;
263
+ for (; u < a.length && (o.lastIndex = u, p = o.exec(a), p !== null); ) u = o.lastIndex, o === w ? p[1] === "!--" ? o = Q : p[1] !== void 0 ? o = X : p[2] !== void 0 ? (ot.test(p[2]) && (i = RegExp("</" + p[2], "g")), o = v) : p[3] !== void 0 && (o = v) : o === v ? p[0] === ">" ? (o = i ?? w, l = -1) : p[1] === void 0 ? l = -2 : (l = o.lastIndex - p[2].length, d = p[1], o = p[3] === void 0 ? v : p[3] === '"' ? et : tt) : o === et || o === tt ? o = v : o === Q || o === X ? o = w : (o = v, i = void 0);
264
+ const $ = o === v && r[h + 1].startsWith("/>") ? " " : "";
265
+ n += o === w ? a + _t : l >= 0 ? (s.push(d), a.slice(0, l) + rt + a.slice(l) + f + $) : a + f + (l === -2 ? h : $);
266
+ }
267
+ return [at(r, n + (r[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
268
+ };
269
+ class O {
270
+ constructor({ strings: t, _$litType$: e }, s) {
271
+ let i;
272
+ this.parts = [];
273
+ let n = 0, o = 0;
274
+ const h = t.length - 1, a = this.parts, [d, p] = Et(t, e);
275
+ if (this.el = O.createElement(d, s), g.currentNode = this.el.content, e === 2 || e === 3) {
276
+ const l = this.el.content.firstChild;
277
+ l.replaceWith(...l.childNodes);
278
+ }
279
+ for (; (i = g.nextNode()) !== null && a.length < h; ) {
280
+ if (i.nodeType === 1) {
281
+ if (i.hasAttributes()) for (const l of i.getAttributeNames()) if (l.endsWith(rt)) {
282
+ const u = p[o++], $ = i.getAttribute(l).split(f), M = /([.?@])?(.*)/.exec(u);
283
+ a.push({ type: 1, index: n, name: M[2], strings: $, ctor: M[1] === "." ? wt : M[1] === "?" ? St : M[1] === "@" ? Ct : j }), i.removeAttribute(l);
284
+ } else l.startsWith(f) && (a.push({ type: 6, index: n }), i.removeAttribute(l));
285
+ if (ot.test(i.tagName)) {
286
+ const l = i.textContent.split(f), u = l.length - 1;
287
+ if (u > 0) {
288
+ i.textContent = N ? N.emptyScript : "";
289
+ for (let $ = 0; $ < u; $++) i.append(l[$], P()), g.nextNode(), a.push({ type: 2, index: ++n });
290
+ i.append(l[u], P());
291
+ }
292
+ }
293
+ } else if (i.nodeType === 8) if (i.data === nt) a.push({ type: 2, index: n });
294
+ else {
295
+ let l = -1;
296
+ for (; (l = i.data.indexOf(f, l + 1)) !== -1; ) a.push({ type: 7, index: n }), l += f.length - 1;
297
+ }
298
+ n++;
299
+ }
300
+ }
301
+ static createElement(t, e) {
302
+ const s = b.createElement("template");
303
+ return s.innerHTML = t, s;
304
+ }
305
+ }
306
+ function E(r, t, e = r, s) {
307
+ if (t === _) return t;
308
+ let i = s !== void 0 ? e._$Co?.[s] : e._$Cl;
309
+ const n = T(t) ? void 0 : t._$litDirective$;
310
+ return i?.constructor !== n && (i?._$AO?.(!1), n === void 0 ? i = void 0 : (i = new n(r), i._$AT(r, e, s)), s !== void 0 ? (e._$Co ??= [])[s] = i : e._$Cl = i), i !== void 0 && (t = E(r, i._$AS(r, t.values), i, s)), t;
311
+ }
312
+ class xt {
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, i = (t?.creationScope ?? b).importNode(e, !0);
324
+ g.currentNode = i;
325
+ let n = g.nextNode(), o = 0, h = 0, a = s[0];
326
+ for (; a !== void 0; ) {
327
+ if (o === a.index) {
328
+ let d;
329
+ a.type === 2 ? d = new U(n, n.nextSibling, this, t) : a.type === 1 ? d = new a.ctor(n, a.name, a.strings, this, t) : a.type === 6 && (d = new Pt(n, this, t)), this._$AV.push(d), a = s[++h];
330
+ }
331
+ o !== a?.index && (n = g.nextNode(), o++);
332
+ }
333
+ return g.currentNode = b, i;
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 U {
341
+ get _$AU() {
342
+ return this._$AM?._$AU ?? this._$Cv;
343
+ }
344
+ constructor(t, e, s, i) {
345
+ this.type = 2, this._$AH = c, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = i, this._$Cv = i?.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 = E(this, t, e), T(t) ? t === c || t == null || t === "" ? (this._$AH !== c && this._$AR(), this._$AH = c) : t !== this._$AH && t !== _ && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : yt(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 && T(this._$AH) ? this._$AA.nextSibling.data = t : this.T(b.createTextNode(t)), this._$AH = t;
369
+ }
370
+ $(t) {
371
+ const { values: e, _$litType$: s } = t, i = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = O.createElement(at(s.h, s.h[0]), this.options)), s);
372
+ if (this._$AH?._$AD === i) this._$AH.p(e);
373
+ else {
374
+ const n = new xt(i, this), o = n.u(this.options);
375
+ n.p(e), this.T(o), this._$AH = n;
376
+ }
377
+ }
378
+ _$AC(t) {
379
+ let e = st.get(t.strings);
380
+ return e === void 0 && st.set(t.strings, e = new O(t)), e;
381
+ }
382
+ k(t) {
383
+ q(this._$AH) || (this._$AH = [], this._$AR());
384
+ const e = this._$AH;
385
+ let s, i = 0;
386
+ for (const n of t) i === e.length ? e.push(s = new U(this.O(P()), this.O(P()), this, this.options)) : s = e[i], s._$AI(n), i++;
387
+ i < e.length && (this._$AR(s && s._$AB.nextSibling, i), e.length = i);
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, i, n) {
407
+ this.type = 1, this._$AH = c, this._$AN = void 0, this.element = t, this.name = e, this._$AM = i, this.options = n, 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, i) {
410
+ const n = this.strings;
411
+ let o = !1;
412
+ if (n === void 0) t = E(this, t, e, 0), o = !T(t) || t !== this._$AH && t !== _, o && (this._$AH = t);
413
+ else {
414
+ const h = t;
415
+ let a, d;
416
+ for (t = n[0], a = 0; a < n.length - 1; a++) d = E(this, h[s + a], e, a), d === _ && (d = this._$AH[a]), o ||= !T(d) || d !== this._$AH[a], d === c ? t = c : t !== c && (t += (d ?? "") + n[a + 1]), this._$AH[a] = d;
417
+ }
418
+ o && !i && 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 wt 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 St 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 Ct extends j {
441
+ constructor(t, e, s, i, n) {
442
+ super(t, e, s, i, n), this.type = 5;
443
+ }
444
+ _$AI(t, e = this) {
445
+ if ((t = E(this, t, e, 0) ?? c) === _) return;
446
+ const s = this._$AH, i = t === c && s !== c || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, n = t !== c && (s === c || i);
447
+ i && this.element.removeEventListener(this.name, this, s), n && 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 Pt {
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
+ E(this, t);
462
+ }
463
+ }
464
+ const Tt = V.litHtmlPolyfillSupport;
465
+ Tt?.(O, U), (V.litHtmlVersions ??= []).push("3.3.1");
466
+ const Ot = (r, t, e) => {
467
+ const s = e?.renderBefore ?? t;
468
+ let i = s._$litPart$;
469
+ if (i === void 0) {
470
+ const n = e?.renderBefore ?? null;
471
+ s._$litPart$ = i = new U(t.insertBefore(P(), n), n, void 0, e ?? {});
472
+ }
473
+ return i._$AI(r), i;
474
+ };
475
+ const W = globalThis;
476
+ let C = class extends A {
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 _;
496
+ }
497
+ };
498
+ C._$litElement$ = !0, C.finalized = !0, W.litElementHydrateSupport?.({ LitElement: C });
499
+ const Ut = W.litElementPolyfillSupport;
500
+ Ut?.({ LitElement: C });
501
+ (W.litElementVersions ??= []).push("4.2.1");
502
+ const Mt = (r) => (t, e) => {
503
+ e !== void 0 ? e.addInitializer((() => {
504
+ customElements.define(r, t);
505
+ })) : customElements.define(r, t);
506
+ };
507
+ const kt = { attribute: !0, type: String, converter: H, reflect: !1, hasChanged: L }, Ht = (r = kt, t, e) => {
508
+ const { kind: s, metadata: i } = e;
509
+ let n = globalThis.litPropertyMetadata.get(i);
510
+ if (n === void 0 && globalThis.litPropertyMetadata.set(i, n = /* @__PURE__ */ new Map()), s === "setter" && ((r = Object.create(r)).wrapped = !0), n.set(e.name, r), s === "accessor") {
511
+ const { name: o } = e;
512
+ return { set(h) {
513
+ const a = t.get.call(this);
514
+ t.set.call(this, h), this.requestUpdate(o, a, r);
515
+ }, init(h) {
516
+ return h !== void 0 && this.C(o, void 0, r, h), h;
517
+ } };
518
+ }
519
+ if (s === "setter") {
520
+ const { name: o } = e;
521
+ return function(h) {
522
+ const a = this[o];
523
+ t.call(this, h), this.requestUpdate(o, a, r);
524
+ };
525
+ }
526
+ throw Error("Unsupported decorator location: " + s);
527
+ };
528
+ function y(r) {
529
+ return (t, e) => typeof e == "object" ? Ht(r, t, e) : ((s, i, n) => {
530
+ const o = i.hasOwnProperty(n);
531
+ return i.constructor.createProperty(n, s), o ? Object.getOwnPropertyDescriptor(i, n) : void 0;
532
+ })(r, t, e);
533
+ }
534
+ function Nt(r) {
535
+ return y({ ...r, state: !0, attribute: !1 });
536
+ }
537
+ const Rt = { ATTRIBUTE: 1 }, jt = (r) => (...t) => ({ _$litDirective$: r, values: t });
538
+ class It {
539
+ constructor(t) {
540
+ }
541
+ get _$AU() {
542
+ return this._$AM._$AU;
543
+ }
544
+ _$AT(t, e, s) {
545
+ this._$Ct = t, this._$AM = e, this._$Ci = s;
546
+ }
547
+ _$AS(t, e) {
548
+ return this.update(t, e);
549
+ }
550
+ update(t, e) {
551
+ return this.render(...e);
552
+ }
553
+ }
554
+ const Dt = jt(class extends It {
555
+ constructor(r) {
556
+ if (super(r), r.type !== Rt.ATTRIBUTE || r.name !== "class" || r.strings?.length > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
557
+ }
558
+ render(r) {
559
+ return " " + Object.keys(r).filter(((t) => r[t])).join(" ") + " ";
560
+ }
561
+ update(r, [t]) {
562
+ if (this.st === void 0) {
563
+ this.st = /* @__PURE__ */ new Set(), r.strings !== void 0 && (this.nt = new Set(r.strings.join(" ").split(/\s/).filter(((s) => s !== ""))));
564
+ for (const s in t) t[s] && !this.nt?.has(s) && this.st.add(s);
565
+ return this.render(t);
566
+ }
567
+ const e = r.element.classList;
568
+ for (const s of this.st) s in t || (e.remove(s), this.st.delete(s));
569
+ for (const s in t) {
570
+ const i = !!t[s];
571
+ i === this.st.has(s) || this.nt?.has(s) || (i ? (e.add(s), this.st.add(s)) : (e.remove(s), this.st.delete(s)));
572
+ }
573
+ return _;
574
+ }
575
+ });
576
+ var zt = Object.defineProperty, ht = (r, t, e, s) => {
577
+ for (var i = void 0, n = r.length - 1, o; n >= 0; n--)
578
+ (o = r[n]) && (i = o(t, e, i) || i);
579
+ return i && zt(t, e, i), i;
580
+ };
581
+ class K extends C {
582
+ constructor() {
583
+ super(...arguments), this.theme = "light", this.storageKey = "theme-preference", this.boundThemeChangeHandler = this.handleGlobalThemeChange.bind(this);
584
+ }
585
+ connectedCallback() {
586
+ super.connectedCallback();
587
+ const t = document.documentElement.getAttribute("data-theme"), e = localStorage.getItem(this.storageKey), s = window.matchMedia("(prefers-color-scheme: dark)").matches;
588
+ t ? this.theme = t : e ? (this.theme = e, this.applyTheme()) : s ? (this.theme = "dark", this.applyTheme()) : this.applyTheme(), window.addEventListener("theme-changed", this.boundThemeChangeHandler);
589
+ }
590
+ disconnectedCallback() {
591
+ window.removeEventListener("theme-changed", this.boundThemeChangeHandler), super.disconnectedCallback();
592
+ }
593
+ handleGlobalThemeChange(t) {
594
+ const e = t;
595
+ e.target !== this && e.detail.theme !== this.theme && (this.theme = e.detail.theme);
596
+ }
597
+ applyTheme() {
598
+ document.documentElement.setAttribute("data-theme", this.theme), localStorage.setItem(this.storageKey, this.theme), this.dispatchEvent(
599
+ new CustomEvent("theme-changed", {
600
+ detail: { theme: this.theme },
601
+ bubbles: !0,
602
+ composed: !0
603
+ })
604
+ );
605
+ }
606
+ }
607
+ ht([
608
+ y({ type: String, attribute: "data-theme", reflect: !0 })
609
+ ], K.prototype, "theme");
610
+ ht([
611
+ y({ type: String, attribute: "storage-key" })
612
+ ], K.prototype, "storageKey");
613
+ var Bt = Object.defineProperty, Lt = Object.getOwnPropertyDescriptor, x = (r, t, e, s) => {
614
+ for (var i = s > 1 ? void 0 : s ? Lt(t, e) : t, n = r.length - 1, o; n >= 0; n--)
615
+ (o = r[n]) && (i = (s ? o(t, e, i) : o(i)) || i);
616
+ return s && i && Bt(t, e, i), i;
617
+ };
618
+ let m = class extends K {
619
+ constructor() {
620
+ super(...arguments), this.variant = "default", this.padding = "none", this.hoverable = !1, this.expandable = !1, this.isExpanded = !1;
621
+ }
622
+ handleExpand(r) {
623
+ r.stopPropagation(), this.isExpanded = !0, document.body.style.overflow = "hidden", this.dispatchEvent(
624
+ new CustomEvent("card-expanded", {
625
+ bubbles: !0,
626
+ composed: !0
627
+ })
628
+ );
629
+ }
630
+ handleCollapse(r) {
631
+ r.stopPropagation(), this.isExpanded = !1, document.body.style.overflow = "", this.dispatchEvent(
632
+ new CustomEvent("card-collapsed", {
633
+ bubbles: !0,
634
+ composed: !0
635
+ })
636
+ );
637
+ }
638
+ handleOverlayClick(r) {
639
+ r.target === r.currentTarget && this.handleCollapse(r);
640
+ }
641
+ disconnectedCallback() {
642
+ super.disconnectedCallback(), document.body.style.overflow = "";
643
+ }
644
+ render() {
645
+ const r = {
646
+ "base-card": !0,
647
+ [`base-card--${this.variant}`]: !0,
648
+ [`base-card--padding-${this.padding}`]: !0,
649
+ "base-card--hoverable": this.hoverable,
650
+ "base-card--expandable": this.expandable
651
+ }, t = D`
652
+ <div class=${Dt(r)}>
653
+ ${this.expandable && !this.isExpanded ? D`
654
+ <button
655
+ class="expand-btn"
656
+ aria-label="Expand card"
657
+ @click=${this.handleExpand}
658
+ >
659
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
660
+ <path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/>
661
+ </svg>
662
+ </button>
663
+ ` : ""}
664
+ <slot></slot>
665
+ </div>
666
+ `;
667
+ return this.isExpanded ? D`
668
+ <div class="expanded-overlay" @click=${this.handleOverlayClick}>
669
+ <div class="expanded-card">
670
+ ${t}
671
+ </div>
672
+ </div>
673
+ ` : t;
674
+ }
675
+ };
676
+ m.styles = dt`
677
+ :host {
678
+ display: block;
679
+ }
680
+
681
+ .base-card {
682
+ background-color: var(--color-bg-primary);
683
+ border-radius: var(--radius-lg);
684
+ transition: all var(--transition-fast);
685
+ position: relative;
686
+ display: flex;
687
+ flex-direction: column;
688
+ box-sizing: border-box;
689
+ max-width: 100%;
690
+ }
691
+
692
+ /* Variants */
693
+ .base-card--default {
694
+ border: none;
695
+ }
696
+
697
+ .base-card--elevated {
698
+ border: 1px solid var(--color-border);
699
+ box-shadow: var(--shadow-sm);
700
+ }
701
+
702
+ /* Padding variants */
703
+ .base-card--padding-auto {
704
+ padding: auto;
705
+ }
706
+ .base-card--padding-none {
707
+ padding: 0;
708
+ }
709
+
710
+ .base-card--padding-sm {
711
+ padding: var(--space-4);
712
+ }
713
+
714
+ .base-card--padding-md {
715
+ padding: var(--space-6);
716
+ }
717
+
718
+ .base-card--padding-lg {
719
+ padding: var(--space-8);
720
+ }
721
+
722
+ /* Hoverable */
723
+ .base-card--hoverable {
724
+ cursor: pointer;
725
+ }
726
+
727
+ .base-card--hoverable:hover {
728
+ box-shadow: var(--shadow-md);
729
+ transform: translateY(0px);
730
+ }
731
+
732
+ /* Expandable card styles */
733
+ .base-card--expandable {
734
+ position: relative;
735
+ }
736
+
737
+ .expand-btn {
738
+ position: absolute;
739
+ top: var(--space-3);
740
+ right: var(--space-3);
741
+ border: 1px solid var(--color-border);
742
+ border-radius: var(--radius-md);
743
+ padding: var(--space-2);
744
+ cursor: pointer;
745
+ color: var(--color-text-secondary);
746
+ transition: all var(--transition-fast);
747
+ z-index: 10;
748
+ display: flex;
749
+ align-items: center;
750
+ justify-content: center;
751
+ opacity: 0;
752
+ transform: scale(0.8);
753
+ pointer-events: none;
754
+ background: none;
755
+ }
756
+
757
+ .base-card--expandable:hover .expand-btn {
758
+ opacity: 1;
759
+ transform: scale(1);
760
+ pointer-events: auto;
761
+ }
762
+
763
+ .expand-btn:hover {
764
+ background: var(--color-bg-muted);
765
+ color: var(--color-text-primary);
766
+ box-shadow: var(--shadow-sm);
767
+ }
768
+
769
+ .expand-btn:focus {
770
+ outline: 2px solid var(--color-primary);
771
+ outline-offset: 2px;
772
+ opacity: 1;
773
+ transform: scale(1);
774
+ pointer-events: auto;
775
+ }
776
+
777
+ /* Mobile: always show expand button */
778
+ @media (max-width: 768px) {
779
+ .expand-btn {
780
+ opacity: 1;
781
+ transform: scale(1);
782
+ pointer-events: auto;
783
+ }
784
+ }
785
+
786
+ /* Expanded overlay */
787
+ .expanded-overlay {
788
+ position: fixed;
789
+ top: 0;
790
+ left: 0;
791
+ right: 0;
792
+ bottom: 0;
793
+ background: rgba(0, 0, 0, 0.8);
794
+ z-index: 1000;
795
+ display: flex;
796
+ align-items: center;
797
+ justify-content: center;
798
+ padding: var(--space-6);
799
+ animation: fadeIn 0.2s ease-out;
800
+ }
801
+
802
+ @keyframes fadeIn {
803
+ from {
804
+ opacity: 0;
805
+ }
806
+ to {
807
+ opacity: 1;
808
+ }
809
+ }
810
+
811
+ .expanded-card {
812
+ max-width: 1200px;
813
+ max-height: 90vh;
814
+ width: 100%;
815
+ overflow: auto;
816
+ animation: scaleIn 0.2s ease-out;
817
+ }
818
+
819
+ @keyframes scaleIn {
820
+ from {
821
+ transform: scale(0.9);
822
+ opacity: 0;
823
+ }
824
+ to {
825
+ transform: scale(1);
826
+ opacity: 1;
827
+ }
828
+ }
829
+
830
+ .close-btn {
831
+ position: absolute;
832
+ top: var(--space-4);
833
+ right: var(--space-4);
834
+ width: 40px;
835
+ height: 40px;
836
+ border: none;
837
+ border-radius: var(--radius-full);
838
+ background: var(--color-bg-primary);
839
+ color: var(--color-text-primary);
840
+ cursor: pointer;
841
+ display: flex;
842
+ align-items: center;
843
+ justify-content: center;
844
+ box-shadow: var(--shadow-lg);
845
+ transition: all var(--transition-fast);
846
+ z-index: 10;
847
+ }
848
+
849
+ .close-btn:hover {
850
+ background: var(--color-bg-muted);
851
+ transform: scale(1.1);
852
+ }
853
+
854
+ .close-btn:focus {
855
+ outline: 2px solid var(--color-primary);
856
+ outline-offset: 2px;
857
+ }
858
+ `;
859
+ x([
860
+ y({ type: String, attribute: "variant" })
861
+ ], m.prototype, "variant", 2);
862
+ x([
863
+ y({ type: String, attribute: "padding" })
864
+ ], m.prototype, "padding", 2);
865
+ x([
866
+ y({ type: Boolean, reflect: !0, attribute: "hoverable" })
867
+ ], m.prototype, "hoverable", 2);
868
+ x([
869
+ y({ type: Boolean, reflect: !0, attribute: "expandable" })
870
+ ], m.prototype, "expandable", 2);
871
+ x([
872
+ Nt()
873
+ ], m.prototype, "isExpanded", 2);
874
+ m = x([
875
+ Mt("base-card")
876
+ ], m);
877
+ export {
878
+ m as BaseCard
879
+ };