@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,1300 @@
1
+ const H = globalThis, N = H.ShadowRoot && (H.ShadyCSS === void 0 || H.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, B = Symbol(), W = /* @__PURE__ */ new WeakMap();
2
+ let it = class {
3
+ constructor(t, e, r) {
4
+ if (this._$cssResult$ = !0, r !== 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 (N && t === void 0) {
11
+ const r = e !== void 0 && e.length === 1;
12
+ r && (t = W.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), r && W.set(e, t));
13
+ }
14
+ return t;
15
+ }
16
+ toString() {
17
+ return this.cssText;
18
+ }
19
+ };
20
+ const dt = (s) => new it(typeof s == "string" ? s : s + "", void 0, B), pt = (s, ...t) => {
21
+ const e = s.length === 1 ? s[0] : t.reduce(((r, i, o) => r + ((a) => {
22
+ if (a._$cssResult$ === !0) return a.cssText;
23
+ if (typeof a == "number") return a;
24
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + a + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
25
+ })(i) + s[o + 1]), s[0]);
26
+ return new it(e, s, B);
27
+ }, ut = (s, t) => {
28
+ if (N) s.adoptedStyleSheets = t.map(((e) => e instanceof CSSStyleSheet ? e : e.styleSheet));
29
+ else for (const e of t) {
30
+ const r = document.createElement("style"), i = H.litNonce;
31
+ i !== void 0 && r.setAttribute("nonce", i), r.textContent = e.cssText, s.appendChild(r);
32
+ }
33
+ }, F = N ? (s) => s : (s) => s instanceof CSSStyleSheet ? ((t) => {
34
+ let e = "";
35
+ for (const r of t.cssRules) e += r.cssText;
36
+ return dt(e);
37
+ })(s) : s;
38
+ const { is: mt, defineProperty: ft, getOwnPropertyDescriptor: gt, getOwnPropertyNames: yt, getOwnPropertySymbols: bt, getPrototypeOf: vt } = Object, Y = globalThis, G = Y.trustedTypes, $t = G ? G.emptyScript : "", _t = Y.reactiveElementPolyfillSupport, C = (s, t) => s, M = { toAttribute(s, t) {
39
+ switch (t) {
40
+ case Boolean:
41
+ s = s ? $t : null;
42
+ break;
43
+ case Object:
44
+ case Array:
45
+ s = s == null ? s : JSON.stringify(s);
46
+ }
47
+ return s;
48
+ }, fromAttribute(s, t) {
49
+ let e = s;
50
+ switch (t) {
51
+ case Boolean:
52
+ e = s !== null;
53
+ break;
54
+ case Number:
55
+ e = s === null ? null : Number(s);
56
+ break;
57
+ case Object:
58
+ case Array:
59
+ try {
60
+ e = JSON.parse(s);
61
+ } catch {
62
+ e = null;
63
+ }
64
+ }
65
+ return e;
66
+ } }, L = (s, t) => !mt(s, t), J = { attribute: !0, type: String, converter: M, reflect: !1, useDefault: !1, hasChanged: L };
67
+ Symbol.metadata ??= Symbol("metadata"), Y.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
68
+ let x = 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 = J) {
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 r = Symbol(), i = this.getPropertyDescriptor(t, r, e);
78
+ i !== void 0 && ft(this.prototype, t, i);
79
+ }
80
+ }
81
+ static getPropertyDescriptor(t, e, r) {
82
+ const { get: i, set: o } = gt(this.prototype, t) ?? { get() {
83
+ return this[e];
84
+ }, set(a) {
85
+ this[e] = a;
86
+ } };
87
+ return { get: i, set(a) {
88
+ const l = i?.call(this);
89
+ o?.call(this, a), this.requestUpdate(t, l, r);
90
+ }, configurable: !0, enumerable: !0 };
91
+ }
92
+ static getPropertyOptions(t) {
93
+ return this.elementProperties.get(t) ?? J;
94
+ }
95
+ static _$Ei() {
96
+ if (this.hasOwnProperty(C("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(C("finalized"))) return;
102
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(C("properties"))) {
103
+ const e = this.properties, r = [...yt(e), ...bt(e)];
104
+ for (const i of r) 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 [r, i] of e) this.elementProperties.set(r, i);
110
+ }
111
+ this._$Eh = /* @__PURE__ */ new Map();
112
+ for (const [e, r] of this.elementProperties) {
113
+ const i = this._$Eu(e, r);
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 r = new Set(t.flat(1 / 0).reverse());
122
+ for (const i of r) e.unshift(F(i));
123
+ } else t !== void 0 && e.push(F(t));
124
+ return e;
125
+ }
126
+ static _$Eu(t, e) {
127
+ const r = e.attribute;
128
+ return r === !1 ? void 0 : typeof r == "string" ? r : 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 r of e.keys()) this.hasOwnProperty(r) && (t.set(r, this[r]), delete this[r]);
145
+ t.size > 0 && (this._$Ep = t);
146
+ }
147
+ createRenderRoot() {
148
+ const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
149
+ return ut(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, r) {
160
+ this._$AK(t, r);
161
+ }
162
+ _$ET(t, e) {
163
+ const r = this.constructor.elementProperties.get(t), i = this.constructor._$Eu(t, r);
164
+ if (i !== void 0 && r.reflect === !0) {
165
+ const o = (r.converter?.toAttribute !== void 0 ? r.converter : M).toAttribute(e, r.type);
166
+ this._$Em = t, o == null ? this.removeAttribute(i) : this.setAttribute(i, o), this._$Em = null;
167
+ }
168
+ }
169
+ _$AK(t, e) {
170
+ const r = this.constructor, i = r._$Eh.get(t);
171
+ if (i !== void 0 && this._$Em !== i) {
172
+ const o = r.getPropertyOptions(i), a = typeof o.converter == "function" ? { fromAttribute: o.converter } : o.converter?.fromAttribute !== void 0 ? o.converter : M;
173
+ this._$Em = i;
174
+ const l = a.fromAttribute(e, o.type);
175
+ this[i] = l ?? this._$Ej?.get(i) ?? l, this._$Em = null;
176
+ }
177
+ }
178
+ requestUpdate(t, e, r) {
179
+ if (t !== void 0) {
180
+ const i = this.constructor, o = this[t];
181
+ if (r ??= i.getPropertyOptions(t), !((r.hasChanged ?? L)(o, e) || r.useDefault && r.reflect && o === this._$Ej?.get(t) && !this.hasAttribute(i._$Eu(t, r)))) return;
182
+ this.C(t, e, r);
183
+ }
184
+ this.isUpdatePending === !1 && (this._$ES = this._$EP());
185
+ }
186
+ C(t, e, { useDefault: r, reflect: i, wrapped: o }, a) {
187
+ r && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t) && (this._$Ej.set(t, a ?? e ?? this[t]), o !== !0 || a !== void 0) || (this._$AL.has(t) || (this.hasUpdated || r || (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, o] of this._$Ep) this[i] = o;
207
+ this._$Ep = void 0;
208
+ }
209
+ const r = this.constructor.elementProperties;
210
+ if (r.size > 0) for (const [i, o] of r) {
211
+ const { wrapped: a } = o, l = this[i];
212
+ a !== !0 || this._$AL.has(i) || l === void 0 || this.C(i, void 0, o, l);
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(((r) => r.hostUpdate?.())), this.update(e)) : this._$EM();
219
+ } catch (r) {
220
+ throw t = !1, this._$EM(), r;
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
+ x.elementStyles = [], x.shadowRootOptions = { mode: "open" }, x[C("elementProperties")] = /* @__PURE__ */ new Map(), x[C("finalized")] = /* @__PURE__ */ new Map(), _t?.({ ReactiveElement: x }), (Y.reactiveElementVersions ??= []).push("2.1.1");
250
+ const I = globalThis, z = I.trustedTypes, Z = z ? z.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, ot = "$lit$", y = `lit$${Math.random().toFixed(9).slice(2)}$`, at = "?" + y, wt = `<${at}>`, $ = document, k = () => $.createComment(""), T = (s) => s === null || typeof s != "object" && typeof s != "function", V = Array.isArray, xt = (s) => V(s) || typeof s?.[Symbol.iterator] == "function", j = `[
251
+ \f\r]`, S = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Q = /-->/g, X = />/g, b = RegExp(`>|${j}(?:([^\\s"'>=/]+)(${j}*=${j}*(?:[^
252
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), tt = /'/g, et = /"/g, nt = /^(?:script|style|textarea|title)$/i, At = (s) => (t, ...e) => ({ _$litType$: s, strings: t, values: e }), St = At(1), _ = Symbol.for("lit-noChange"), c = Symbol.for("lit-nothing"), rt = /* @__PURE__ */ new WeakMap(), v = $.createTreeWalker($, 129);
253
+ function lt(s, t) {
254
+ if (!V(s) || !s.hasOwnProperty("raw")) throw Error("invalid template strings array");
255
+ return Z !== void 0 ? Z.createHTML(t) : t;
256
+ }
257
+ const Ct = (s, t) => {
258
+ const e = s.length - 1, r = [];
259
+ let i, o = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", a = S;
260
+ for (let l = 0; l < e; l++) {
261
+ const n = s[l];
262
+ let d, p, h = -1, f = 0;
263
+ for (; f < n.length && (a.lastIndex = f, p = a.exec(n), p !== null); ) f = a.lastIndex, a === S ? p[1] === "!--" ? a = Q : p[1] !== void 0 ? a = X : p[2] !== void 0 ? (nt.test(p[2]) && (i = RegExp("</" + p[2], "g")), a = b) : p[3] !== void 0 && (a = b) : a === b ? p[0] === ">" ? (a = i ?? S, h = -1) : p[1] === void 0 ? h = -2 : (h = a.lastIndex - p[2].length, d = p[1], a = p[3] === void 0 ? b : p[3] === '"' ? et : tt) : a === et || a === tt ? a = b : a === Q || a === X ? a = S : (a = b, i = void 0);
264
+ const g = a === b && s[l + 1].startsWith("/>") ? " " : "";
265
+ o += a === S ? n + wt : h >= 0 ? (r.push(d), n.slice(0, h) + ot + n.slice(h) + y + g) : n + y + (h === -2 ? l : g);
266
+ }
267
+ return [lt(s, o + (s[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
268
+ };
269
+ class D {
270
+ constructor({ strings: t, _$litType$: e }, r) {
271
+ let i;
272
+ this.parts = [];
273
+ let o = 0, a = 0;
274
+ const l = t.length - 1, n = this.parts, [d, p] = Ct(t, e);
275
+ if (this.el = D.createElement(d, r), v.currentNode = this.el.content, e === 2 || e === 3) {
276
+ const h = this.el.content.firstChild;
277
+ h.replaceWith(...h.childNodes);
278
+ }
279
+ for (; (i = v.nextNode()) !== null && n.length < l; ) {
280
+ if (i.nodeType === 1) {
281
+ if (i.hasAttributes()) for (const h of i.getAttributeNames()) if (h.endsWith(ot)) {
282
+ const f = p[a++], g = i.getAttribute(h).split(y), U = /([.?@])?(.*)/.exec(f);
283
+ n.push({ type: 1, index: o, name: U[2], strings: g, ctor: U[1] === "." ? kt : U[1] === "?" ? Tt : U[1] === "@" ? Dt : R }), i.removeAttribute(h);
284
+ } else h.startsWith(y) && (n.push({ type: 6, index: o }), i.removeAttribute(h));
285
+ if (nt.test(i.tagName)) {
286
+ const h = i.textContent.split(y), f = h.length - 1;
287
+ if (f > 0) {
288
+ i.textContent = z ? z.emptyScript : "";
289
+ for (let g = 0; g < f; g++) i.append(h[g], k()), v.nextNode(), n.push({ type: 2, index: ++o });
290
+ i.append(h[f], k());
291
+ }
292
+ }
293
+ } else if (i.nodeType === 8) if (i.data === at) n.push({ type: 2, index: o });
294
+ else {
295
+ let h = -1;
296
+ for (; (h = i.data.indexOf(y, h + 1)) !== -1; ) n.push({ type: 7, index: o }), h += y.length - 1;
297
+ }
298
+ o++;
299
+ }
300
+ }
301
+ static createElement(t, e) {
302
+ const r = $.createElement("template");
303
+ return r.innerHTML = t, r;
304
+ }
305
+ }
306
+ function A(s, t, e = s, r) {
307
+ if (t === _) return t;
308
+ let i = r !== void 0 ? e._$Co?.[r] : e._$Cl;
309
+ const o = T(t) ? void 0 : t._$litDirective$;
310
+ return i?.constructor !== o && (i?._$AO?.(!1), o === void 0 ? i = void 0 : (i = new o(s), i._$AT(s, e, r)), r !== void 0 ? (e._$Co ??= [])[r] = i : e._$Cl = i), i !== void 0 && (t = A(s, i._$AS(s, t.values), i, r)), t;
311
+ }
312
+ class Et {
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: r } = this._$AD, i = (t?.creationScope ?? $).importNode(e, !0);
324
+ v.currentNode = i;
325
+ let o = v.nextNode(), a = 0, l = 0, n = r[0];
326
+ for (; n !== void 0; ) {
327
+ if (a === n.index) {
328
+ let d;
329
+ n.type === 2 ? d = new P(o, o.nextSibling, this, t) : n.type === 1 ? d = new n.ctor(o, n.name, n.strings, this, t) : n.type === 6 && (d = new Pt(o, this, t)), this._$AV.push(d), n = r[++l];
330
+ }
331
+ a !== n?.index && (o = v.nextNode(), a++);
332
+ }
333
+ return v.currentNode = $, i;
334
+ }
335
+ p(t) {
336
+ let e = 0;
337
+ for (const r of this._$AV) r !== void 0 && (r.strings !== void 0 ? (r._$AI(t, r, e), e += r.strings.length - 2) : r._$AI(t[e])), e++;
338
+ }
339
+ }
340
+ class P {
341
+ get _$AU() {
342
+ return this._$AM?._$AU ?? this._$Cv;
343
+ }
344
+ constructor(t, e, r, i) {
345
+ this.type = 2, this._$AH = c, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = r, 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 = A(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) : xt(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($.createTextNode(t)), this._$AH = t;
369
+ }
370
+ $(t) {
371
+ const { values: e, _$litType$: r } = t, i = typeof r == "number" ? this._$AC(t) : (r.el === void 0 && (r.el = D.createElement(lt(r.h, r.h[0]), this.options)), r);
372
+ if (this._$AH?._$AD === i) this._$AH.p(e);
373
+ else {
374
+ const o = new Et(i, this), a = o.u(this.options);
375
+ o.p(e), this.T(a), 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 D(t)), e;
381
+ }
382
+ k(t) {
383
+ V(this._$AH) || (this._$AH = [], this._$AR());
384
+ const e = this._$AH;
385
+ let r, i = 0;
386
+ for (const o of t) i === e.length ? e.push(r = new P(this.O(k()), this.O(k()), this, this.options)) : r = e[i], r._$AI(o), i++;
387
+ i < e.length && (this._$AR(r && r._$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 r = t.nextSibling;
392
+ t.remove(), t = r;
393
+ }
394
+ }
395
+ setConnected(t) {
396
+ this._$AM === void 0 && (this._$Cv = t, this._$AP?.(t));
397
+ }
398
+ }
399
+ class R {
400
+ get tagName() {
401
+ return this.element.tagName;
402
+ }
403
+ get _$AU() {
404
+ return this._$AM._$AU;
405
+ }
406
+ constructor(t, e, r, i, o) {
407
+ this.type = 1, this._$AH = c, this._$AN = void 0, this.element = t, this.name = e, this._$AM = i, this.options = o, r.length > 2 || r[0] !== "" || r[1] !== "" ? (this._$AH = Array(r.length - 1).fill(new String()), this.strings = r) : this._$AH = c;
408
+ }
409
+ _$AI(t, e = this, r, i) {
410
+ const o = this.strings;
411
+ let a = !1;
412
+ if (o === void 0) t = A(this, t, e, 0), a = !T(t) || t !== this._$AH && t !== _, a && (this._$AH = t);
413
+ else {
414
+ const l = t;
415
+ let n, d;
416
+ for (t = o[0], n = 0; n < o.length - 1; n++) d = A(this, l[r + n], e, n), d === _ && (d = this._$AH[n]), a ||= !T(d) || d !== this._$AH[n], d === c ? t = c : t !== c && (t += (d ?? "") + o[n + 1]), this._$AH[n] = d;
417
+ }
418
+ a && !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 kt extends R {
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 Tt extends R {
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 Dt extends R {
441
+ constructor(t, e, r, i, o) {
442
+ super(t, e, r, i, o), this.type = 5;
443
+ }
444
+ _$AI(t, e = this) {
445
+ if ((t = A(this, t, e, 0) ?? c) === _) return;
446
+ const r = this._$AH, i = t === c && r !== c || t.capture !== r.capture || t.once !== r.once || t.passive !== r.passive, o = t !== c && (r === c || i);
447
+ i && this.element.removeEventListener(this.name, this, r), 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 Pt {
454
+ constructor(t, e, r) {
455
+ this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = r;
456
+ }
457
+ get _$AU() {
458
+ return this._$AM._$AU;
459
+ }
460
+ _$AI(t) {
461
+ A(this, t);
462
+ }
463
+ }
464
+ const Ot = I.litHtmlPolyfillSupport;
465
+ Ot?.(D, P), (I.litHtmlVersions ??= []).push("3.3.1");
466
+ const Ut = (s, t, e) => {
467
+ const r = e?.renderBefore ?? t;
468
+ let i = r._$litPart$;
469
+ if (i === void 0) {
470
+ const o = e?.renderBefore ?? null;
471
+ r._$litPart$ = i = new P(t.insertBefore(k(), o), o, void 0, e ?? {});
472
+ }
473
+ return i._$AI(s), i;
474
+ };
475
+ const q = globalThis;
476
+ let E = class extends x {
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 = Ut(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
+ E._$litElement$ = !0, E.finalized = !0, q.litElementHydrateSupport?.({ LitElement: E });
499
+ const Ht = q.litElementPolyfillSupport;
500
+ Ht?.({ LitElement: E });
501
+ (q.litElementVersions ??= []).push("4.2.1");
502
+ const Mt = (s) => (t, e) => {
503
+ e !== void 0 ? e.addInitializer((() => {
504
+ customElements.define(s, t);
505
+ })) : customElements.define(s, t);
506
+ };
507
+ const zt = { attribute: !0, type: String, converter: M, reflect: !1, hasChanged: L }, Yt = (s = zt, t, e) => {
508
+ const { kind: r, metadata: i } = e;
509
+ let o = globalThis.litPropertyMetadata.get(i);
510
+ if (o === void 0 && globalThis.litPropertyMetadata.set(i, o = /* @__PURE__ */ new Map()), r === "setter" && ((s = Object.create(s)).wrapped = !0), o.set(e.name, s), r === "accessor") {
511
+ const { name: a } = e;
512
+ return { set(l) {
513
+ const n = t.get.call(this);
514
+ t.set.call(this, l), this.requestUpdate(a, n, s);
515
+ }, init(l) {
516
+ return l !== void 0 && this.C(a, void 0, s, l), l;
517
+ } };
518
+ }
519
+ if (r === "setter") {
520
+ const { name: a } = e;
521
+ return function(l) {
522
+ const n = this[a];
523
+ t.call(this, l), this.requestUpdate(a, n, s);
524
+ };
525
+ }
526
+ throw Error("Unsupported decorator location: " + r);
527
+ };
528
+ function O(s) {
529
+ return (t, e) => typeof e == "object" ? Yt(s, t, e) : ((r, i, o) => {
530
+ const a = i.hasOwnProperty(o);
531
+ return i.constructor.createProperty(o, r), a ? Object.getOwnPropertyDescriptor(i, o) : void 0;
532
+ })(s, t, e);
533
+ }
534
+ function w(s) {
535
+ return O({ ...s, state: !0, attribute: !1 });
536
+ }
537
+ const Rt = (s, t, e) => (e.configurable = !0, e.enumerable = !0, Reflect.decorate && typeof t != "object" && Object.defineProperty(s, t, e), e);
538
+ function ht(s, t) {
539
+ return (e, r, i) => {
540
+ const o = (a) => a.renderRoot?.querySelector(s) ?? null;
541
+ return Rt(e, r, { get() {
542
+ return o(this);
543
+ } });
544
+ };
545
+ }
546
+ const jt = { ATTRIBUTE: 1 }, Nt = (s) => (...t) => ({ _$litDirective$: s, values: t });
547
+ class Bt {
548
+ constructor(t) {
549
+ }
550
+ get _$AU() {
551
+ return this._$AM._$AU;
552
+ }
553
+ _$AT(t, e, r) {
554
+ this._$Ct = t, this._$AM = e, this._$Ci = r;
555
+ }
556
+ _$AS(t, e) {
557
+ return this.update(t, e);
558
+ }
559
+ update(t, e) {
560
+ return this.render(...e);
561
+ }
562
+ }
563
+ const st = Nt(class extends Bt {
564
+ constructor(s) {
565
+ if (super(s), s.type !== jt.ATTRIBUTE || s.name !== "class" || s.strings?.length > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
566
+ }
567
+ render(s) {
568
+ return " " + Object.keys(s).filter(((t) => s[t])).join(" ") + " ";
569
+ }
570
+ update(s, [t]) {
571
+ if (this.st === void 0) {
572
+ this.st = /* @__PURE__ */ new Set(), s.strings !== void 0 && (this.nt = new Set(s.strings.join(" ").split(/\s/).filter(((r) => r !== ""))));
573
+ for (const r in t) t[r] && !this.nt?.has(r) && this.st.add(r);
574
+ return this.render(t);
575
+ }
576
+ const e = s.element.classList;
577
+ for (const r of this.st) r in t || (e.remove(r), this.st.delete(r));
578
+ for (const r in t) {
579
+ const i = !!t[r];
580
+ i === this.st.has(r) || this.nt?.has(r) || (i ? (e.add(r), this.st.add(r)) : (e.remove(r), this.st.delete(r)));
581
+ }
582
+ return _;
583
+ }
584
+ });
585
+ var Lt = Object.defineProperty, ct = (s, t, e, r) => {
586
+ for (var i = void 0, o = s.length - 1, a; o >= 0; o--)
587
+ (a = s[o]) && (i = a(t, e, i) || i);
588
+ return i && Lt(t, e, i), i;
589
+ };
590
+ class K extends E {
591
+ constructor() {
592
+ super(...arguments), this.theme = "light", this.storageKey = "theme-preference", this.boundThemeChangeHandler = this.handleGlobalThemeChange.bind(this);
593
+ }
594
+ connectedCallback() {
595
+ super.connectedCallback();
596
+ const t = document.documentElement.getAttribute("data-theme"), e = localStorage.getItem(this.storageKey), r = window.matchMedia("(prefers-color-scheme: dark)").matches;
597
+ t ? this.theme = t : e ? (this.theme = e, this.applyTheme()) : r ? (this.theme = "dark", this.applyTheme()) : this.applyTheme(), window.addEventListener("theme-changed", this.boundThemeChangeHandler);
598
+ }
599
+ disconnectedCallback() {
600
+ window.removeEventListener("theme-changed", this.boundThemeChangeHandler), super.disconnectedCallback();
601
+ }
602
+ handleGlobalThemeChange(t) {
603
+ const e = t;
604
+ e.target !== this && e.detail.theme !== this.theme && (this.theme = e.detail.theme);
605
+ }
606
+ applyTheme() {
607
+ document.documentElement.setAttribute("data-theme", this.theme), localStorage.setItem(this.storageKey, this.theme), this.dispatchEvent(
608
+ new CustomEvent("theme-changed", {
609
+ detail: { theme: this.theme },
610
+ bubbles: !0,
611
+ composed: !0
612
+ })
613
+ );
614
+ }
615
+ }
616
+ ct([
617
+ O({ type: String, attribute: "data-theme", reflect: !0 })
618
+ ], K.prototype, "theme");
619
+ ct([
620
+ O({ type: String, attribute: "storage-key" })
621
+ ], K.prototype, "storageKey");
622
+ const It = () => pt`
623
+ :host {
624
+ display: inline-block;
625
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
626
+ box-sizing: border-box;
627
+ --color-primary: var(--auth-color-primary, #2563eb);
628
+ --color-bg-primary: var(--auth-color-bg-primary, #ffffff);
629
+ --color-bg-secondary: var(--auth-color-bg-secondary, #f8fafc);
630
+ --color-text-primary: var(--auth-color-text-primary, #0f172a);
631
+ --color-text-secondary: var(--auth-color-text-secondary, #64748b);
632
+ --color-text-muted: var(--auth-color-text-muted, #94a3b8);
633
+ --color-border: var(--auth-color-border, #e2e8f0);
634
+ --color-error: var(--auth-color-error, #dc2626);
635
+ --color-success: var(--auth-color-success, #16a34a);
636
+ --transition-slow: var(--auth-transition-slow, 300ms);
637
+ --radius-md: var(--auth-radius-md, 0.5rem);
638
+ --radius-lg: var(--auth-radius-lg, 0.75rem);
639
+ --radius-xl: var(--auth-radius-xl, 1.25rem);
640
+ --space-2: var(--auth-space-2, 0.5rem);
641
+ --space-3: var(--auth-space-3, 0.75rem);
642
+ --space-4: var(--auth-space-4, 1rem);
643
+ --space-5: var(--auth-space-5, 1.25rem);
644
+ --space-6: var(--auth-space-6, 1.5rem);
645
+ }
646
+
647
+ *,
648
+ *::before,
649
+ *::after {
650
+ box-sizing: border-box;
651
+ }
652
+
653
+ /* Body scroll lock */
654
+ :host(.modal-open) {
655
+ overflow: hidden;
656
+ }
657
+
658
+ .modal-overlay {
659
+ position: fixed;
660
+ top: 0;
661
+ left: 0;
662
+ right: 0;
663
+ bottom: 0;
664
+ background: rgba(0, 0, 0, 0.5);
665
+ display: flex;
666
+ align-items: flex-end;
667
+ justify-content: center;
668
+ z-index: 1000;
669
+ backdrop-filter: none;
670
+ animation: fadeIn 0.2s ease-out;
671
+ }
672
+
673
+ .modal-overlay--closing {
674
+ animation: fadeOut var(--transition-slow) ease-out forwards;
675
+ }
676
+
677
+ .modal-container {
678
+ background: var(--color-bg-primary);
679
+ border-top-left-radius: var(--radius-xl);
680
+ border-top-right-radius: var(--radius-xl);
681
+ box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1), 0 -2px 4px -1px rgba(0, 0, 0, 0.06);
682
+ width: 100vw;
683
+ max-width: 100vw;
684
+ height: 85dvh;
685
+ display: flex;
686
+ flex-direction: column;
687
+ overflow: hidden;
688
+ animation: slideUp var(--transition-slow);
689
+ transform-origin: bottom center;
690
+ transition: height var(--transition-slow) cubic-bezier(0.4, 0, 0.2, 1);
691
+ }
692
+
693
+ .modal-container--closing {
694
+ animation: slideDown var(--transition-slow);
695
+ }
696
+
697
+ .modal-container--dragging {
698
+ user-select: none;
699
+ -webkit-user-select: none;
700
+ cursor: grabbing;
701
+ }
702
+
703
+ .drawer-handle {
704
+ display: flex;
705
+ justify-content: center;
706
+ padding-top: var(--space-3);
707
+ padding-bottom: var(--space-2);
708
+ flex-shrink: 0;
709
+ cursor: pointer;
710
+ user-select: none;
711
+ -webkit-tap-highlight-color: transparent;
712
+ }
713
+
714
+ .drawer-handle:hover .drawer-handle-bar {
715
+ opacity: 0.7;
716
+ }
717
+
718
+ .drawer-handle-bar {
719
+ width: 36px;
720
+ height: 5px;
721
+ background: var(--color-text-muted);
722
+ border-radius: 100px;
723
+ opacity: 0.5;
724
+ transition: opacity var(--transition-slow) ease;
725
+ }
726
+
727
+ .drawer-content {
728
+ width: 100%;
729
+ max-width: 100%;
730
+ margin: 0 auto;
731
+ display: flex;
732
+ flex-direction: column;
733
+ overflow: hidden;
734
+ height: 100%;
735
+ }
736
+
737
+ .drawer-content--sm {
738
+ max-width: 400px;
739
+ }
740
+
741
+ .drawer-content--md {
742
+ max-width: 600px;
743
+ }
744
+
745
+ .drawer-content--lg {
746
+ max-width: 900px;
747
+ }
748
+
749
+ .modal-header {
750
+ display: flex;
751
+ align-items: center;
752
+ justify-content: center;
753
+ padding: var(--space-4) var(--space-6);
754
+ flex-shrink: 0;
755
+ }
756
+
757
+ .auth-logo {
758
+ display: block;
759
+ }
760
+ .auth-logo {
761
+ position: relative;
762
+ transition: all 0.3s ease;
763
+ }
764
+ .auth-logo[src] {
765
+ opacity: 1;
766
+ position: relative;
767
+ z-index: 1;
768
+ }
769
+ :host([data-theme='dark']) .auth-header {
770
+ filter: brightness(0) saturate(100%) invert(98%) sepia(4%) saturate(346%)
771
+ hue-rotate(183deg) brightness(106%) contrast(93%);
772
+ }
773
+
774
+ .modal-body {
775
+ padding: var(--space-4) var(--space-6);
776
+ overflow-y: auto;
777
+ flex: 1;
778
+ min-height: 0;
779
+ }
780
+
781
+ .auth-form {
782
+ display: flex;
783
+ flex-direction: column;
784
+ gap: var(--space-5);
785
+ }
786
+
787
+ .field {
788
+ display: flex;
789
+ flex-direction: column;
790
+ gap: var(--space-1);
791
+ }
792
+
793
+ .field-label {
794
+ font-weight: 500;
795
+ font-size: 0.875rem;
796
+ color: var(--color-text-primary);
797
+ }
798
+
799
+ .field-input {
800
+ width: 100%;
801
+ padding: 0.75rem 1rem;
802
+ border: 1px solid var(--color-border);
803
+ border-radius: var(--radius-md);
804
+ background: var(--color-bg-primary);
805
+ color: var(--color-text-primary);
806
+ font-size: 1rem;
807
+ transition: all 0.15s ease;
808
+ }
809
+
810
+ .field-input:focus {
811
+ outline: none;
812
+ border-color: var(--color-primary);
813
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 25%, transparent);
814
+ }
815
+
816
+ .field-input:-webkit-autofill,
817
+ .field-input:-webkit-autofill:hover,
818
+ .field-input:-webkit-autofill:focus,
819
+ .field-input:-webkit-autofill:active {
820
+ -webkit-box-shadow: 0 0 0 1000px var(--color-bg-primary) inset !important;
821
+ -webkit-text-fill-color: var(--color-text-primary) !important;
822
+ transition: background-color 5000s ease-in-out 0s;
823
+ }
824
+
825
+ .field-input:-moz-autofill {
826
+ box-shadow: 0 0 0 1000px var(--color-bg-primary) inset !important;
827
+ color: var(--color-text-primary) !important;
828
+ }
829
+
830
+ .field-input--error {
831
+ border-color: var(--color-error);
832
+ }
833
+
834
+ .field-error {
835
+ color: var(--color-error);
836
+ font-size: 0.875rem;
837
+ }
838
+
839
+ .forgot-row {
840
+ display: flex;
841
+ justify-content: flex-end;
842
+ margin-top: calc(var(--space-2) * -1);
843
+ }
844
+
845
+ .text-btn {
846
+ background: none;
847
+ border: none;
848
+ color: var(--color-primary);
849
+ cursor: pointer;
850
+ font-weight: 600;
851
+ font-size: 0.875rem;
852
+ padding: 0;
853
+ text-decoration: none;
854
+ }
855
+
856
+ .text-btn:hover {
857
+ text-decoration: underline;
858
+ }
859
+
860
+ .form-actions {
861
+ display: flex;
862
+ flex-direction: column;
863
+ gap: var(--space-3);
864
+ margin-top: var(--space-2);
865
+ }
866
+
867
+ .cta {
868
+ width: 100%;
869
+ padding: 0.875rem 1rem;
870
+ border: none;
871
+ border-radius: var(--radius-md);
872
+ background: var(--color-primary);
873
+ color: white;
874
+ font-weight: 600;
875
+ font-size: 1rem;
876
+ cursor: pointer;
877
+ transition: all 0.15s ease;
878
+ }
879
+
880
+ .cta:hover:not(:disabled) {
881
+ background: color-mix(in srgb, var(--color-primary), black 10%);
882
+ transform: translateY(-1px);
883
+ }
884
+
885
+ .cta:disabled {
886
+ opacity: 0.5;
887
+ cursor: not-allowed;
888
+ }
889
+
890
+ .button-row {
891
+ display: flex;
892
+ gap: var(--space-3);
893
+ width: 100%;
894
+ }
895
+
896
+ .oauth-btn {
897
+ flex: 1;
898
+ padding: 0.875rem 1rem;
899
+ border: 1px solid var(--color-border);
900
+ border-radius: var(--radius-md);
901
+ background: var(--color-bg-primary);
902
+ cursor: pointer;
903
+ transition: all 0.15s ease;
904
+ display: flex;
905
+ align-items: center;
906
+ justify-content: center;
907
+ }
908
+
909
+ .oauth-btn:hover:not(:disabled) {
910
+ background: var(--color-bg-secondary);
911
+ border-color: var(--color-text-muted);
912
+ }
913
+
914
+ .oauth-btn:disabled {
915
+ opacity: 0.5;
916
+ cursor: not-allowed;
917
+ }
918
+
919
+ .apple-icon path {
920
+ fill: #0b0b0a;
921
+ }
922
+
923
+ /* Dark theme */
924
+ :host([data-theme='dark']) {
925
+ --color-primary: #3b82f6;
926
+ --color-bg-primary: #1e293b;
927
+ --color-bg-secondary: #0f172a;
928
+ --color-text-primary: #f8fafc;
929
+ --color-text-secondary: #cbd5e1;
930
+ --color-text-muted: #94a3b8;
931
+ --color-border: #334155;
932
+ --color-error: #ef4444;
933
+ --color-success: #10b981;
934
+ }
935
+
936
+ :host([data-theme='dark']) .apple-icon path {
937
+ fill: #8e8e93;
938
+ }
939
+
940
+ @media (prefers-color-scheme: dark) {
941
+ .apple-icon path {
942
+ fill: #8e8e93;
943
+ }
944
+ }
945
+
946
+ .otp-section {
947
+ display: flex;
948
+ flex-direction: column;
949
+ gap: var(--space-2);
950
+ }
951
+
952
+ .otp-label {
953
+ display: block;
954
+ font-weight: 500;
955
+ font-size: 0.875rem;
956
+ color: var(--color-text-primary);
957
+ }
958
+
959
+ .otp-inputs {
960
+ display: flex;
961
+ gap: var(--space-2);
962
+ justify-content: center;
963
+ }
964
+
965
+ .otp-input {
966
+ width: 44px;
967
+ height: 52px;
968
+ text-align: center;
969
+ font-size: 1.25rem;
970
+ font-weight: 600;
971
+ border: 1px solid var(--color-border);
972
+ border-radius: var(--radius-md);
973
+ background: var(--color-bg-primary);
974
+ color: var(--color-text-primary);
975
+ transition: all 0.15s ease;
976
+ }
977
+
978
+ .otp-input:focus {
979
+ outline: none;
980
+ border-color: var(--color-primary);
981
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 25%, transparent);
982
+ }
983
+
984
+ .otp-input--error {
985
+ border-color: var(--color-error);
986
+ }
987
+
988
+ .otp-error {
989
+ margin: 0;
990
+ color: var(--color-error);
991
+ font-size: 0.875rem;
992
+ text-align: center;
993
+ }
994
+
995
+ .new-password-fields {
996
+ display: flex;
997
+ flex-direction: column;
998
+ gap: var(--space-5);
999
+ animation: fadeSlide 0.2s ease;
1000
+ }
1001
+
1002
+ .alert {
1003
+ padding: var(--space-3) var(--space-4);
1004
+ border-radius: var(--radius-md);
1005
+ font-size: 0.875rem;
1006
+ display: flex;
1007
+ align-items: center;
1008
+ justify-content: space-between;
1009
+ gap: var(--space-2);
1010
+ }
1011
+
1012
+ .alert--success {
1013
+ background: color-mix(in srgb, var(--color-success) 10%, transparent);
1014
+ border: 1px solid color-mix(in srgb, var(--color-success) 30%, transparent);
1015
+ color: var(--color-success);
1016
+ }
1017
+
1018
+ .alert--error {
1019
+ background: color-mix(in srgb, var(--color-error) 10%, transparent);
1020
+ border: 1px solid color-mix(in srgb, var(--color-error) 30%, transparent);
1021
+ color: var(--color-error);
1022
+ }
1023
+
1024
+ .alert-close {
1025
+ background: none;
1026
+ border: none;
1027
+ color: inherit;
1028
+ cursor: pointer;
1029
+ font-size: 1.5rem;
1030
+ line-height: 1;
1031
+ padding: 0;
1032
+ opacity: 0.7;
1033
+ }
1034
+
1035
+ .alert-close:hover {
1036
+ opacity: 1;
1037
+ }
1038
+
1039
+ .auth-footer {
1040
+ display: flex;
1041
+ align-items: center;
1042
+ justify-content: center;
1043
+ gap: var(--space-2);
1044
+ padding-top: var(--space-4);
1045
+ text-align: center;
1046
+ }
1047
+
1048
+ .toggle-text {
1049
+ margin: 0;
1050
+ font-size: 0.875rem;
1051
+ color: var(--color-text-secondary);
1052
+ }
1053
+
1054
+ .toggle-text a {
1055
+ color: var(--color-primary);
1056
+ text-decoration: none;
1057
+ }
1058
+
1059
+ .toggle-text a:hover {
1060
+ text-decoration: underline;
1061
+ }
1062
+
1063
+ @keyframes fadeIn {
1064
+ from {
1065
+ opacity: 0;
1066
+ }
1067
+ to {
1068
+ opacity: 1;
1069
+ }
1070
+ }
1071
+
1072
+ @keyframes fadeOut {
1073
+ from {
1074
+ opacity: 1;
1075
+ }
1076
+ to {
1077
+ opacity: 0;
1078
+ }
1079
+ }
1080
+
1081
+ @keyframes slideUp {
1082
+ from {
1083
+ transform: translateY(100%);
1084
+ }
1085
+ to {
1086
+ transform: translateY(0);
1087
+ }
1088
+ }
1089
+
1090
+ @keyframes slideDown {
1091
+ from {
1092
+ transform: translateY(0);
1093
+ }
1094
+ to {
1095
+ transform: translateY(100%);
1096
+ }
1097
+ }
1098
+
1099
+ @keyframes fadeSlide {
1100
+ from {
1101
+ opacity: 0;
1102
+ transform: translateY(6px);
1103
+ }
1104
+ to {
1105
+ opacity: 1;
1106
+ transform: translateY(0);
1107
+ }
1108
+ }
1109
+
1110
+ @media (max-width: 640px) {
1111
+ .modal-container {
1112
+ height: 80dvh;
1113
+ }
1114
+ }
1115
+
1116
+ @media (prefers-reduced-motion: reduce) {
1117
+ * {
1118
+ animation: none !important;
1119
+ transition: none !important;
1120
+ }
1121
+ }`;
1122
+ var Vt = Object.defineProperty, qt = Object.getOwnPropertyDescriptor, m = (s, t, e, r) => {
1123
+ for (var i = r > 1 ? void 0 : r ? qt(t, e) : t, o = s.length - 1, a; o >= 0; o--)
1124
+ (a = s[o]) && (i = (r ? a(t, e, i) : a(i)) || i);
1125
+ return r && i && Vt(t, e, i), i;
1126
+ };
1127
+ let u = class extends K {
1128
+ constructor() {
1129
+ super(...arguments), this.open = !1, this.size = "sm", this.isClosing = !1, this.isVisible = !1, this.isDragging = !1, this.dragStartY = 0, this.dragCurrentY = 0, this.dragStartTime = 0, this.lastDragEndTime = 0, this.transitionDuration = 300, this.boundKeyHandler = (s) => {
1130
+ s.key === "Escape" && this.isVisible && this.handleClose();
1131
+ }, this.handleClose = () => {
1132
+ this.isClosing || !this.isVisible || (this.cleanupInlineStyles(), this.isDragging = !1, this.dragStartY = 0, this.dragCurrentY = 0, this.dragStartTime = 0, this.isClosing = !0, setTimeout(() => {
1133
+ this.isClosing = !1, this.isVisible = !1, this.open = !1, this.dispatchEvent(
1134
+ new CustomEvent("drawer-close", {
1135
+ bubbles: !0,
1136
+ composed: !0
1137
+ })
1138
+ );
1139
+ }, this.transitionDuration));
1140
+ }, this.handleOverlayClick = () => {
1141
+ this.handleClose();
1142
+ }, this.handleDragStart = (s) => {
1143
+ if (!this.modalContainer || this.modalBody && this.modalBody.scrollTop > 0)
1144
+ return;
1145
+ const t = s.target;
1146
+ !(t.classList.contains("drawer-handle") || t.classList.contains("drawer-handle-bar") || t.closest(".drawer-handle")) && this.modalBody && this.modalBody.scrollTop > 0 || (this.modalContainer.style.transition = "", this.modalContainer.style.transform = "", this.isDragging = !0, this.dragStartTime = Date.now(), s instanceof TouchEvent ? (this.dragStartY = s.touches[0].clientY, this.dragCurrentY = s.touches[0].clientY) : (this.dragStartY = s.clientY, this.dragCurrentY = s.clientY));
1147
+ }, this.handleDragMove = (s) => {
1148
+ if (!this.isDragging || !this.modalContainer) return;
1149
+ s instanceof TouchEvent ? this.dragCurrentY = s.touches[0].clientY : this.dragCurrentY = s.clientY;
1150
+ const t = this.dragCurrentY - this.dragStartY;
1151
+ t > 0 && (s.preventDefault(), this.modalContainer.style.transform = `translateY(${t}px)`, this.modalContainer.style.transition = "none");
1152
+ }, this.handleDragEnd = () => {
1153
+ if (!this.isDragging || !this.modalContainer) return;
1154
+ const s = Math.max(0, this.dragCurrentY - this.dragStartY);
1155
+ s > 5 && (this.lastDragEndTime = Date.now());
1156
+ const t = Date.now() - this.dragStartTime, e = s / t, r = this.modalContainer.offsetHeight, i = Math.max(150, r * 0.3), a = s > i || e > 0.5;
1157
+ this.isDragging = !1;
1158
+ const l = this.modalContainer, n = a ? r + r * 0.1 : 0;
1159
+ l.style.transition = "none", l.style.transform = `translateY(${s}px)`, requestAnimationFrame(() => {
1160
+ l.style.transition = `transform ${this.transitionDuration}ms cubic-bezier(0.4, 0, 0.2, 1)`, l.style.transform = `translateY(${n}px)`;
1161
+ }), setTimeout(() => {
1162
+ this.dragStartY = 0, this.dragCurrentY = 0, this.dragStartTime = 0, a ? (this.isVisible = !1, this.open = !1, this.dispatchEvent(
1163
+ new CustomEvent("drawer-close", {
1164
+ bubbles: !0,
1165
+ composed: !0
1166
+ })
1167
+ )) : this.modalContainer && (this.modalContainer.style.transition = "", this.modalContainer.style.transform = "");
1168
+ }, this.transitionDuration);
1169
+ }, this.handleHandleClick = (s) => {
1170
+ if (Date.now() - this.lastDragEndTime < 200) {
1171
+ s.preventDefault(), s.stopPropagation();
1172
+ return;
1173
+ }
1174
+ this.handleClose();
1175
+ };
1176
+ }
1177
+ connectedCallback() {
1178
+ super.connectedCallback(), window.addEventListener("keyup", this.boundKeyHandler);
1179
+ }
1180
+ disconnectedCallback() {
1181
+ window.removeEventListener("keyup", this.boundKeyHandler), this.unlockBodyScroll(), super.disconnectedCallback();
1182
+ }
1183
+ firstUpdated() {
1184
+ this.open && (this.isVisible = !0);
1185
+ }
1186
+ updated(s) {
1187
+ s.has("open") && (this.open ? (this.isVisible = !0, this.lockBodyScroll()) : this.isVisible && this.handleClose()), s.has("isVisible") && (this.isVisible ? (this.lockBodyScroll(), this.cleanupInlineStyles()) : (this.unlockBodyScroll(), this.resetState()));
1188
+ }
1189
+ lockBodyScroll() {
1190
+ document.body.style.overflow = "hidden";
1191
+ }
1192
+ unlockBodyScroll() {
1193
+ document.body.style.overflow = "";
1194
+ }
1195
+ cleanupInlineStyles() {
1196
+ setTimeout(() => {
1197
+ this.modalContainer && (this.modalContainer.style.transition = "", this.modalContainer.style.transform = "");
1198
+ }, 0);
1199
+ }
1200
+ resetState() {
1201
+ this.isDragging = !1, this.lastDragEndTime = 0, this.dragStartY = 0, this.dragCurrentY = 0, this.dragStartTime = 0;
1202
+ }
1203
+ // Public methods
1204
+ closeDrawer() {
1205
+ this.handleClose();
1206
+ }
1207
+ openDrawer() {
1208
+ this.open = !0, this.isVisible = !0;
1209
+ }
1210
+ render() {
1211
+ if (!this.isVisible)
1212
+ return c;
1213
+ const s = {
1214
+ "modal-overlay": !0,
1215
+ "modal-overlay--closing": this.isClosing
1216
+ }, t = {
1217
+ "modal-container": !0,
1218
+ "modal-container--drawer": !0,
1219
+ "modal-container--closing": this.isClosing,
1220
+ "modal-container--dragging": this.isDragging,
1221
+ [`modal-container--${this.size}`]: !0
1222
+ };
1223
+ return St`
1224
+ <!-- Drawer Overlay -->
1225
+ <div
1226
+ class=${st(s)}
1227
+ @click=${this.handleOverlayClick}
1228
+ @touchstart=${this.handleDragStart}
1229
+ @touchmove=${this.handleDragMove}
1230
+ @touchend=${this.handleDragEnd}
1231
+ @mousedown=${this.handleDragStart}
1232
+ >
1233
+ <div
1234
+ class=${st(t)}
1235
+ @click=${(e) => e.stopPropagation()}
1236
+ role="dialog"
1237
+ aria-modal="true"
1238
+ @mousemove=${this.handleDragMove}
1239
+ @mouseup=${this.handleDragEnd}
1240
+ >
1241
+ <!-- Drawer Handle -->
1242
+ <div
1243
+ class="drawer-handle"
1244
+ @click=${this.handleHandleClick}
1245
+ role="button"
1246
+ tabindex="0"
1247
+ aria-label="Close drawer"
1248
+ >
1249
+ <div class="drawer-handle-bar"></div>
1250
+ </div>
1251
+
1252
+ <!-- Drawer Content Wrapper -->
1253
+ <div class="drawer-content drawer-content--${this.size}">
1254
+ <slot></slot>
1255
+ </div>
1256
+ </div>
1257
+ </div>
1258
+ `;
1259
+ }
1260
+ };
1261
+ u.styles = It();
1262
+ m([
1263
+ O({ type: Boolean, reflect: !0 })
1264
+ ], u.prototype, "open", 2);
1265
+ m([
1266
+ O({ type: String, attribute: "size" })
1267
+ ], u.prototype, "size", 2);
1268
+ m([
1269
+ w()
1270
+ ], u.prototype, "isClosing", 2);
1271
+ m([
1272
+ w()
1273
+ ], u.prototype, "isVisible", 2);
1274
+ m([
1275
+ w()
1276
+ ], u.prototype, "isDragging", 2);
1277
+ m([
1278
+ w()
1279
+ ], u.prototype, "dragStartY", 2);
1280
+ m([
1281
+ w()
1282
+ ], u.prototype, "dragCurrentY", 2);
1283
+ m([
1284
+ w()
1285
+ ], u.prototype, "dragStartTime", 2);
1286
+ m([
1287
+ w()
1288
+ ], u.prototype, "lastDragEndTime", 2);
1289
+ m([
1290
+ ht(".modal-container")
1291
+ ], u.prototype, "modalContainer", 2);
1292
+ m([
1293
+ ht(".modal-body")
1294
+ ], u.prototype, "modalBody", 2);
1295
+ u = m([
1296
+ Mt("base-drawer")
1297
+ ], u);
1298
+ export {
1299
+ u as BaseDrawer
1300
+ };