@fest-lib/dom 0.1.8 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/dom.js +535 -596
  2. package/package.json +1 -1
  3. package/dist/index.js +0 -1713
package/dist/index.js DELETED
@@ -1,1713 +0,0 @@
1
- var Je = /* @__PURE__ */ Symbol.for("dom.ts@__registeredCssProperties"), Me = globalThis[Je] ??= /* @__PURE__ */ new Set();
2
- [
3
- {
4
- name: "--screen-width",
5
- syntax: "<length-percentage>",
6
- inherits: !0,
7
- initialValue: "0px"
8
- },
9
- {
10
- name: "--screen-height",
11
- syntax: "<length-percentage>",
12
- inherits: !0,
13
- initialValue: "0px"
14
- },
15
- {
16
- name: "--visual-width",
17
- syntax: "<length-percentage>",
18
- inherits: !0,
19
- initialValue: "0px"
20
- },
21
- {
22
- name: "--visual-height",
23
- syntax: "<length-percentage>",
24
- inherits: !0,
25
- initialValue: "0px"
26
- },
27
- {
28
- name: "--clip-ampl",
29
- syntax: "<number>",
30
- inherits: !0,
31
- initialValue: "0"
32
- },
33
- {
34
- name: "--clip-freq",
35
- syntax: "<number>",
36
- inherits: !0,
37
- initialValue: "0"
38
- },
39
- {
40
- name: "--avail-width",
41
- syntax: "<length-percentage>",
42
- inherits: !0,
43
- initialValue: "0px"
44
- },
45
- {
46
- name: "--avail-height",
47
- syntax: "<length-percentage>",
48
- inherits: !0,
49
- initialValue: "0px"
50
- },
51
- {
52
- name: "--pixel-ratio",
53
- syntax: "<number>",
54
- inherits: !0,
55
- initialValue: "1"
56
- },
57
- {
58
- name: "--percent",
59
- syntax: "<number>",
60
- inherits: !0,
61
- initialValue: "0"
62
- },
63
- {
64
- name: "--percent-x",
65
- syntax: "<number>",
66
- inherits: !0,
67
- initialValue: "0"
68
- },
69
- {
70
- name: "--percent-y",
71
- syntax: "<number>",
72
- inherits: !0,
73
- initialValue: "0"
74
- },
75
- {
76
- name: "--scroll-left",
77
- syntax: "<number>",
78
- inherits: !0,
79
- initialValue: "0"
80
- },
81
- {
82
- name: "--scroll-top",
83
- syntax: "<number>",
84
- inherits: !0,
85
- initialValue: "0"
86
- },
87
- {
88
- name: "--drag-x",
89
- syntax: "<length>",
90
- inherits: !1,
91
- initialValue: "0px"
92
- },
93
- {
94
- name: "--drag-y",
95
- syntax: "<length>",
96
- inherits: !1,
97
- initialValue: "0px"
98
- },
99
- {
100
- name: "--grid-r",
101
- syntax: "<number>",
102
- inherits: !1,
103
- initialValue: "0"
104
- },
105
- {
106
- name: "--grid-c",
107
- syntax: "<number>",
108
- inherits: !1,
109
- initialValue: "0"
110
- },
111
- {
112
- name: "--resize-x",
113
- syntax: "<length>",
114
- inherits: !1,
115
- initialValue: "0px"
116
- },
117
- {
118
- name: "--resize-y",
119
- syntax: "<length>",
120
- inherits: !1,
121
- initialValue: "0px"
122
- },
123
- {
124
- name: "--shift-x",
125
- syntax: "<length>",
126
- inherits: !1,
127
- initialValue: "0px"
128
- },
129
- {
130
- name: "--shift-y",
131
- syntax: "<length>",
132
- inherits: !1,
133
- initialValue: "0px"
134
- },
135
- {
136
- name: "--cs-grid-r",
137
- syntax: "<number>",
138
- inherits: !1,
139
- initialValue: "0"
140
- },
141
- {
142
- name: "--cs-grid-c",
143
- syntax: "<number>",
144
- inherits: !1,
145
- initialValue: "0"
146
- },
147
- {
148
- name: "--cs-p-grid-r",
149
- syntax: "<number>",
150
- inherits: !1,
151
- initialValue: "0"
152
- },
153
- {
154
- name: "--cs-p-grid-c",
155
- syntax: "<number>",
156
- inherits: !1,
157
- initialValue: "0"
158
- },
159
- {
160
- name: "--os-grid-r",
161
- syntax: "<number>",
162
- inherits: !1,
163
- initialValue: "0"
164
- },
165
- {
166
- name: "--os-grid-c",
167
- syntax: "<number>",
168
- inherits: !1,
169
- initialValue: "0"
170
- },
171
- {
172
- name: "--rv-grid-r",
173
- syntax: "<number>",
174
- inherits: !1,
175
- initialValue: "0"
176
- },
177
- {
178
- name: "--rv-grid-c",
179
- syntax: "<number>",
180
- inherits: !1,
181
- initialValue: "0"
182
- },
183
- {
184
- name: "--cell-x",
185
- syntax: "<integer>",
186
- inherits: !1,
187
- initialValue: "0"
188
- },
189
- {
190
- name: "--cell-y",
191
- syntax: "<integer>",
192
- inherits: !1,
193
- initialValue: "0"
194
- }
195
- ].forEach((e) => {
196
- if (typeof CSS > "u" || typeof CSS?.registerProperty != "function") return;
197
- const t = String(e?.name || "").trim();
198
- if (!(!t || Me.has(t)))
199
- try {
200
- CSS.registerProperty(e);
201
- } catch (n) {
202
- String(n?.name || "").toLowerCase() !== "invalidmodificationerror" && console.warn(n);
203
- } finally {
204
- Me.add(t);
205
- }
206
- });
207
- var yn = () => {
208
- }, Ke = () => {
209
- let e = navigator?.userAgentData?.mobile || !1;
210
- return ((t) => {
211
- (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0, 4))) && (e = !0);
212
- })(navigator.userAgent || navigator.vendor || globalThis.opera), e;
213
- }, gn = () => [
214
- /Android/i,
215
- /webOS/i,
216
- /iPhone/i,
217
- /iPad/i,
218
- /iPod/i,
219
- /BlackBerry/i,
220
- /Windows Phone/i
221
- ].some(navigator.userAgent.match.bind(navigator.userAgent)) && (navigator.maxTouchPoints || "ontouchstart" in document.documentElement) && globalThis.matchMedia("(pointer: coarse)").matches, le = (e, t = "value") => (typeof e == "object" || typeof e == "function") && e != null && (t in e || e?.[t] != null), M = (e) => le(e, "value"), te = (e) => e && e?.replace?.(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), Fe = (e) => e && e?.replace?.(/-([a-z])/g, (t, n) => n.toUpperCase()), Qe = (e) => typeof CSSStyleValue < "u" && e instanceof CSSStyleValue, et = (e) => e != null && (typeof e == "boolean" ? e !== !1 : !0) && typeof e != "object" && typeof e != "function", ge = (e) => typeof e == "boolean" ? e ? "" : null : typeof e == "number" ? String(e) : e, Ee = /* @__PURE__ */ Symbol.for("@trigger-lock"), B = (e, t, n = "value") => {
222
- le(e, n) && (e[Ee] = !0);
223
- let r;
224
- try {
225
- r = t?.();
226
- } finally {
227
- le(e, n) && delete e[Ee];
228
- }
229
- return r;
230
- }, Ie = (e) => {
231
- if (typeof e != "string") return null;
232
- const t = [...e?.matchAll?.(/^\d+(\.\d+)?$/g)];
233
- if (t?.length != 1) return null;
234
- const n = parseFloat(t[0][0]);
235
- return !Number.isNaN(n) && Number.isFinite(n) ? n : null;
236
- }, tt = (e) => Array.isArray(e) || e != null && typeof e == "object" && typeof e[Symbol.iterator] == "function", de = (e, t, n = 0) => {
237
- const r = [...t], i = [...e];
238
- return n % 2 && (i.reverse(), r.reverse()), [(n == 0 || n == 3 ? i[0] : r[0] - i[0]) || 0, (n == 0 || n == 1 ? i[1] : r[1] - i[1]) || 0];
239
- }, H = (e, t = [4, 8]) => {
240
- if (Array.isArray(e) && e.length >= 2) return [Math.max(1, Math.floor(Number(e[0]) || t[0])), Math.max(1, Math.floor(Number(e[1]) || t[1]))];
241
- if (e && typeof e == "object") {
242
- const n = e;
243
- return [Math.max(1, Math.floor(Number(n.columns) || t[0])), Math.max(1, Math.floor(Number(n.rows) || t[1]))];
244
- }
245
- return [t[0], t[1]];
246
- }, nt = (e, t) => {
247
- const [n, r] = H(t);
248
- return [Math.max(0, Math.min(n - 1, Math.floor(Number(e[0]) || 0))), Math.max(0, Math.min(r - 1, Math.floor(Number(e[1]) || 0)))];
249
- }, rt = (e, t, n, r, i) => {
250
- const s = H(n), a = Math.max(1, t[0] || 1), o = Math.max(1, t[1] || 1), u = de(e, [a, o], r), p = {
251
- item: i?.redirect?.item ?? { id: "" },
252
- list: i?.redirect?.list ?? [],
253
- items: i?.redirect?.items ?? /* @__PURE__ */ new Map(),
254
- layout: s,
255
- size: [a, o]
256
- }, d = at(u, p, r), h = (i?.mode ?? "floor") === "round" ? [Math.round(d[0]), Math.round(d[1])] : [Math.floor(d[0]), Math.floor(d[1])], c = ot(h, p);
257
- return nt(c, s);
258
- }, it = (e) => e == null ? [] : Array.isArray(e) ? e : e instanceof Map ? Array.from(e.values()) : e instanceof Set || typeof e[Symbol.iterator] == "function" ? Array.from(e) : [], ot = (e, t) => {
259
- const n = H(t?.layout ?? [4, 8]), r = {
260
- ...t,
261
- layout: n
262
- }, i = it(r?.items), s = r?.item || {}, a = (f) => i.filter((y) => !(y == s || y?.id == s?.id)).some((y) => (y?.cell?.[0] || 0) == (f[0] || 0) && (y?.cell?.[1] || 0) == (f[1] || 0)), o = [...e];
263
- if (!a(o)) return [...o];
264
- const u = n[0] || 4, p = n[1] || 8, d = ([
265
- [o[0] + 1, o[1]],
266
- [o[0] - 1, o[1]],
267
- [o[0], o[1] + 1],
268
- [o[0], o[1] - 1]
269
- ].filter((f) => f[0] >= 0 && f[0] < u && f[1] >= 0 && f[1] < p) || []).find((f) => !a(f));
270
- if (d) return [...d];
271
- let h = 0, c = !0, l = [...o];
272
- for (; c && h++ < u * p; ) {
273
- if (!(c = a(l))) return [...l];
274
- l[0]++, l[0] >= u && (l[0] = 0, l[1]++, l[1] >= p && (l[1] = 0));
275
- }
276
- return [...o];
277
- }, at = (e, t, n = 0) => {
278
- const r = [...t.size], i = [...e], s = H(t.layout ?? [4, 8]);
279
- n % 2 && r.reverse();
280
- const a = [s[0] / r[0], s[1] / r[1]];
281
- return [i[0] * a[0], i[1] * a[1]];
282
- }, st = () => ({
283
- didTimeout: !1,
284
- timeRemaining: () => 0
285
- }), Ae = (e, t = 1e3) => typeof globalThis.requestIdleCallback == "function" ? globalThis.requestIdleCallback(e, { timeout: t }) : setTimeout(() => e(st()), 0), ut = (e) => e?.offsetParent ?? e?.host, vn = (e) => {
286
- const t = [];
287
- let n = e;
288
- for (; n; ) {
289
- const r = ut(n);
290
- if (r && r instanceof HTMLHtmlElement) break;
291
- (n = r) && t.push(n);
292
- }
293
- return t;
294
- }, bn = (e, t = 1e-6) => Math.abs(e.a - 1) < t && Math.abs(e.b) < t && Math.abs(e.c) < t && Math.abs(e.d - 1) < t && Math.abs(e.e) < t && Math.abs(e.f) < t, ct = () => {
295
- const e = {
296
- canceled: !1,
297
- rAFs: /* @__PURE__ */ new Set(),
298
- last: null,
299
- cancel() {
300
- return this.canceled = !0, cancelAnimationFrame(this.last), this;
301
- },
302
- shedule(t) {
303
- return this.rAFs.add(t), this;
304
- }
305
- };
306
- return (async () => {
307
- for (; !e?.canceled; )
308
- await Promise.all((e?.rAFs?.values?.() ?? [])?.map?.((t) => Promise.try(t)?.catch?.(console.warn.bind(console)))), e.rAFs?.clear?.(), typeof requestAnimationFrame < "u" ? await new Promise((t) => {
309
- e.last = requestAnimationFrame(t);
310
- }) : await new Promise((t) => {
311
- setTimeout(t, 16);
312
- });
313
- })(), e;
314
- }, Sn = (e = ct()) => (t) => e.shedule(t), wn = typeof document < "u" ? document?.documentElement : null, xn = (e, t = {}) => {
315
- if (!(!t || typeof t != "object" || !e))
316
- return Array.from(Object.entries(t)).map(([n, r]) => {
317
- const i = e.getAttribute(n);
318
- r == null ? e.removeAttribute(n) : r != i && e.setAttribute(n, i == "" ? r ?? i : i ?? r);
319
- });
320
- }, Mn = (e, t = {}) => Array.from(Object.entries(t)).map(([n, r]) => {
321
- r == null ? e.removeAttribute(n) : e.setAttribute(n, r ?? e.getAttribute(n));
322
- }), lt = /* @__PURE__ */ new Map(), En = (e, t = 1e3, ...n) => {
323
- const r = {
324
- running: !0,
325
- cancel: () => {
326
- r.running = !1;
327
- }
328
- };
329
- return Ae(async () => {
330
- if (!(!e || typeof e != "function")) {
331
- for (; r.running; )
332
- await Promise.all([Promise.try(e, ...n), new Promise((i) => setTimeout(i, t))]).catch?.(console.warn.bind(console)), await Promise.any([new Promise((i) => Ae(i, t)), new Promise((i) => setTimeout(i, t))]);
333
- r.cancel = () => {
334
- };
335
- }
336
- }, { timeout: t }), r?.cancel;
337
- };
338
- typeof requestAnimationFrame < "u" && requestAnimationFrame(async () => {
339
- for (; ; )
340
- lt.forEach((e) => e?.()), await new Promise((e) => requestAnimationFrame(e));
341
- });
342
- var X = /* @__PURE__ */ Symbol("@border-box-width"), Y = /* @__PURE__ */ Symbol("@border-box-height"), G = /* @__PURE__ */ Symbol("@content-box-width"), J = /* @__PURE__ */ Symbol("@content-box-height"), Ce = /* @__PURE__ */ new WeakMap(), Re = /* @__PURE__ */ new WeakMap(), An = (e, t = () => {
343
- }) => {
344
- if (e instanceof HTMLElement && !Re.has(e)) {
345
- e[G] = e.clientWidth, e[J] = e.clientHeight;
346
- const n = new ResizeObserver((r) => {
347
- for (const i of r) if (i.contentBoxSize) {
348
- const s = i.contentBoxSize[0];
349
- s && (e[G] = Math.min(s.inlineSize, e.clientWidth), e[J] = Math.min(s.blockSize, e.clientHeight), t?.(e));
350
- }
351
- });
352
- Re.set(e, n), n.observe(e?.element ?? e, { box: "content-box" });
353
- }
354
- }, Cn = (e, t = () => {
355
- }) => {
356
- if (e instanceof HTMLElement && !Ce.has(e)) {
357
- e[X] = e.offsetWidth, e[Y] = e.offsetHeight;
358
- const n = new ResizeObserver((r) => {
359
- for (const i of r) if (i.borderBoxSize) {
360
- const s = i.borderBoxSize[0];
361
- s && (e[X] = Math.min(s.inlineSize, e.offsetWidth), e[Y] = Math.min(s.blockSize, e.offsetHeight), t?.(e));
362
- }
363
- });
364
- Ce.set(e, n), n.observe(e?.element ?? e, { box: "border-box" });
365
- }
366
- }, Rn = (e, ...t) => URL.createObjectURL(new Blob(t, { type: e })), Pn = (e, t = "text/html") => {
367
- const n = new DOMParser().parseFromString(e, t);
368
- return n.querySelector("template") ?? n.querySelector("*");
369
- }, zn = (e, t, n) => {
370
- t != null && e.checked != t && (e?.type == "checkbox" || e?.type == "radio" && !e?.checked ? (e?.click?.(), n?.preventDefault?.()) : (e.checked = !!t, e?.dispatchEvent?.(new Event("change", {
371
- bubbles: !0,
372
- cancelable: !0
373
- }))));
374
- }, Tn = (e) => e != null && e instanceof HTMLElement && !(e instanceof DocumentFragment || e instanceof HTMLBodyElement) ? e : null, Ln = (e, t) => e == null || t == null ? -1 : Array.from(e?.childNodes ?? [])?.indexOf?.(t) ?? -1, kn = "(-?[_a-zA-Z]+[_a-zA-Z0-9-]*)", Vn = `^(?:(-?[_a-zA-Z]+[_a-zA-Z0-9-]*))|^#(-?[_a-zA-Z]+[_a-zA-Z0-9-]*)|^\\.(-?[_a-zA-Z]+[_a-zA-Z0-9-]*)|^\\[(-?[_a-zA-Z]+[_a-zA-Z0-9-]*)(?:([*$|~^]?=)(["'])((?:(?=(\\\\?))\\8.)*?)\\6)?\\]`, jn = (e) => {
375
- if (e == ":fragment:") return document.createDocumentFragment();
376
- const t = document.createElement.bind(document);
377
- for (var n = t("div"), r, i = ""; e && (r = e.match(`^(?:(-?[_a-zA-Z]+[_a-zA-Z0-9-]*))|^#(-?[_a-zA-Z]+[_a-zA-Z0-9-]*)|^\\.(-?[_a-zA-Z]+[_a-zA-Z0-9-]*)|^\\[(-?[_a-zA-Z]+[_a-zA-Z0-9-]*)(?:([*$|~^]?=)(["'])((?:(?=(\\\\?))\\8.)*?)\\6)?\\]`)); )
378
- r[1] && (n = t(r[1])), r[2] && (n.id = r[2]), r[3] && (i += " " + r[3]), r[4] && n.setAttribute(r[4], r[7] || ""), e = e.slice(r[0].length);
379
- return i && (n.className = i.slice(1)), n;
380
- }, On = (e) => e != null && (e instanceof Node || e instanceof Text || e instanceof Element || e instanceof Comment || e instanceof HTMLElement || e instanceof DocumentFragment) ? e : null, Nn = (e, t) => e.querySelector(t) ?? (e.matches(t) ? e : null), re = (e, t) => {
381
- for (; e; ) {
382
- if (!(e?.element ?? e)) return !1;
383
- if ((e?.element ?? e) === (t?.element ?? t)) return !0;
384
- e = e.parentElement ?? (e.parentNode == e?.getRootNode?.({ composed: !0 }) ? e?.getRootNode?.({ composed: !0 })?.host : e?.parentNode);
385
- }
386
- }, $e = {};
387
- function m(e, t, n, r = $e) {
388
- e?.addEventListener?.(t, n, r);
389
- const i = typeof e == "object" || typeof e == "function" && !e?.deref ? new WeakRef(e) : e;
390
- return () => i?.deref?.()?.removeEventListener?.(t, n, r);
391
- }
392
- function Pe(e, t, n, r = $e) {
393
- e?.removeEventListener?.(t, n, r);
394
- }
395
- var K = (e, t) => (e = e instanceof WeakRef ? e.deref() : e, [...Object.entries(t)].map?.(([n, r]) => Array.isArray(r) ? m(e, n, ...r) : m(e, n, r))), Wn = (e, t) => {
396
- if (t) {
397
- let n = t;
398
- return t instanceof Map ? n = [...t.entries()] : n = [...Object.entries(t)], n.map(([r, i]) => ((tt(i) ? [...i] : i) ?? [])?.map?.((s) => m(e, r, s)));
399
- }
400
- }, Fn = (e, t) => (e = e instanceof WeakRef ? e.deref() : e, [...Object.entries(t)].map?.(([n, r]) => Array.isArray(r) ? Pe(e, n, ...r) : Pe(e, n, r))), In = (e) => {
401
- if (!e) return null;
402
- if (e?.composedPath && typeof e.composedPath == "function") {
403
- const n = e.composedPath();
404
- for (const r of n) if (r instanceof HTMLElement || r instanceof Element) return r;
405
- }
406
- const t = e?.target;
407
- return t instanceof HTMLElement || t instanceof Element ? t : null;
408
- }, $n = (e, t, n) => {
409
- if (t == null || !(t instanceof Node) && t?.element == null) return !1;
410
- if (e == t || (e?.element ?? e) == (t?.element ?? t)) return !0;
411
- if (n?.composedPath && typeof n.composedPath == "function") {
412
- const r = n.composedPath(), i = e?.element ?? e, s = t?.element ?? t;
413
- if (r.includes(i) && r.includes(s)) {
414
- const a = r.indexOf(i), o = r.indexOf(s);
415
- if (o >= 0 && a >= 0 && o < a) return !0;
416
- }
417
- }
418
- return !!(e?.contains?.(t?.element ?? t) || e?.getRootNode({ composed: !0 })?.host == (t?.element ?? t));
419
- }, fe = (e, t, n) => {
420
- if (n?.composedPath && typeof n.composedPath == "function") {
421
- const o = n.composedPath();
422
- for (const u of o) if ((u instanceof HTMLElement || u instanceof Element) && u.matches?.(t))
423
- return u;
424
- }
425
- const r = e?.matches?.(t) ? e : null, i = (e?.getRootNode({ composed: !0 }) ?? e?.parentElement?.getRootNode({ composed: !0 }))?.host, s = i?.matches?.(t) ? i : null, a = e?.closest?.(t) ?? r?.closest?.(t) ?? s?.closest?.(t) ?? null;
426
- return r ?? a ?? s;
427
- }, Bn = (e, t) => !!fe(e, t), Hn = (e, t, n = "parent") => {
428
- if (!e || e.checkVisibility && !e.checkVisibility({
429
- checkOpacity: !0,
430
- checkVisibilityCSS: !0
431
- }) || !e.checkVisibility && e.offsetParent === null && e.style.position !== "fixed") return !1;
432
- let r = document.activeElement;
433
- for (; r && r.shadowRoot && r.shadowRoot.activeElement; ) r = r.shadowRoot.activeElement;
434
- const i = r === e || re(r, e), s = e.matches(":hover");
435
- if (!i && !s && !t) return !1;
436
- if (t) {
437
- if (typeof t == "string") {
438
- if (n === "parent") return !!fe(e, t);
439
- {
440
- const a = i ? r : e.querySelector(":hover") || e, o = !!fe(a, t);
441
- return e?.querySelector?.(t) != null || e?.matches?.(t) || o;
442
- }
443
- } else if (t instanceof HTMLElement) return n === "parent" ? re(e, t) || !1 : re(t, e) || !1;
444
- }
445
- return !0;
446
- }, qn = () => "currentCSSZoom" in document.documentElement ? document.documentElement.currentCSSZoom || 1 : parseFloat(document.documentElement.style.getPropertyValue("--scaling") || "1") || 1, dt = /* @__PURE__ */ Symbol.for("dom.ts@zoomValues"), ft = globalThis[dt] ??= /* @__PURE__ */ new WeakMap(), pt = (e = document.documentElement) => ft.getOrInsertComputed(e, () => {
447
- const t = (e?.matches?.(".ui-orientbox") ? e : null) || e?.closest?.(".ui-orientbox") || document.body;
448
- if (t?.zoom) return t?.zoom || 1;
449
- if (e?.currentCSSZoom) return e?.currentCSSZoom || 1;
450
- }), _n = (e = 1) => (document.documentElement.style.setProperty("--scaling", e), document.documentElement.dispatchEvent(new CustomEvent("scaling", {
451
- detail: { zoom: e },
452
- bubbles: !0,
453
- cancelable: !0
454
- })), e), Zn = (e = document.documentElement) => (e?.currentCSSZoom != null ? 1 : pt(e)) || 1, pe = (e = document.documentElement) => (e?.currentCSSZoom == null ? 1 : e?.currentCSSZoom) || 1, z = (e = document.documentElement) => {
455
- const t = (e?.matches?.('[orient], [data-mixin="ui-orientbox"]') ? e : null) || e?.closest?.('[orient], [data-mixin="ui-orientbox"]') || e;
456
- if (t?.hasAttribute?.("orient")) return parseInt(t?.getAttribute?.("orient") || "0") || 0;
457
- if (t?.orient != null && Number.isFinite(Number(t.orient))) return Number(t.orient) || 0;
458
- try {
459
- const n = t?.style?.getPropertyValue?.("--orient") || (typeof getComputedStyle == "function" && t ? getComputedStyle(t).getPropertyValue("--orient") : "") || "", r = parseInt(String(n).trim(), 10);
460
- if (Number.isFinite(r)) return r;
461
- } catch {
462
- }
463
- return 0;
464
- }, Dn = (e, t = null) => {
465
- const n = pe(e) || 1, r = e?.getBoundingClientRect?.(), i = {
466
- left: r?.left / n,
467
- right: r?.right / n,
468
- top: r?.top / n,
469
- bottom: r?.bottom / n,
470
- width: r?.width / n,
471
- height: r?.height / n
472
- }, s = t ?? (z(e) || 0), a = typeof window < "u" ? window.visualViewport : null, o = [((a?.width ?? document.documentElement?.clientWidth ?? window.innerWidth) || 1) / n, ((a?.height ?? document.documentElement?.clientHeight ?? window.innerHeight) || 1) / n], [u, p] = de([i.left, i.top], o, s), [d, h] = de([i.right, i.bottom], o, s), [c, l] = s == 0 || s == 3 ? [u, d] : [d, u], [f, y] = s == 0 || s == 1 ? [p, h] : [h, p], [_, Ge] = s % 2 ? [i.height, i.width] : [i.width, i.height];
473
- return {
474
- left: c,
475
- top: f,
476
- right: l,
477
- bottom: y,
478
- width: _,
479
- height: Ge
480
- };
481
- }, Un = (e, t = null) => (t ?? z(e)) % 2 ? e[Y] ?? e?.clientHeight : e[X] ?? e?.clientWidth, Xn = (e, t = null) => (t ?? z(e)) % 2 ? e[X] ?? e?.clientWidth : e[Y] ?? e?.clientHeight, Yn = (e, t = null) => (t ?? z(e)) % 2 ? e[J] ?? e?.clientHeight : e[G] ?? e?.clientWidth, Gn = (e, t = null) => (t ?? z(e)) % 2 ? e[G] ?? e?.clientWidth : e[J] ?? e?.clientHeight, ht = (e, t = 100) => typeof globalThis.requestIdleCallback == "function" ? globalThis.requestIdleCallback(e, { timeout: t }) : setTimeout(() => e({
482
- didTimeout: !1,
483
- timeRemaining: () => 0
484
- }), 0), Be = () => {
485
- const e = typeof matchMedia < "u" ? matchMedia("(orientation: landscape)")?.matches : !1, t = typeof window < "u" ? window.visualViewport : null, n = t ? {
486
- "--vv-width": `${t.width}px`,
487
- "--vv-height": `${t.height}px`,
488
- "--vv-offset-left": `${t.offsetLeft}px`,
489
- "--vv-offset-top": `${t.offsetTop}px`,
490
- "--vv-scale": String(t.scale ?? 1)
491
- } : {
492
- "--vv-width": typeof window < "u" ? `${window.innerWidth}px` : "0px",
493
- "--vv-height": typeof window < "u" ? `${window.innerHeight}px` : "0px",
494
- "--vv-offset-left": "0px",
495
- "--vv-offset-top": "0px",
496
- "--vv-scale": "1"
497
- };
498
- if (typeof screen < "u") {
499
- const r = screen?.availWidth + "px", i = screen?.availHeight + "px";
500
- return {
501
- "--screen-width": Math.min(screen?.width, screen?.availWidth) + "px",
502
- "--screen-height": Math.min(screen?.height, screen?.availHeight) + "px",
503
- "--avail-width": e ? i : r,
504
- "--avail-height": e ? r : i,
505
- "--view-height": Math.min(screen?.availHeight, window?.innerHeight) + "px",
506
- "--pixel-ratio": String(devicePixelRatio || 1),
507
- ...n
508
- };
509
- }
510
- return {
511
- "--screen-width": "0px",
512
- "--screen-height": "0px",
513
- "--avail-width": "0px",
514
- "--avail-height": "0px",
515
- "--view-height": "0px",
516
- "--pixel-ratio": "1",
517
- ...n
518
- };
519
- }, he = Be(), Jn = [[":root, :host, :scope", he]], mt = {
520
- "portrait-primary": 0,
521
- "landscape-primary": 1,
522
- "portrait-secondary": 2,
523
- "landscape-secondary": 3
524
- }, yt = (e) => {
525
- const t = document.documentElement;
526
- Object.assign(he, Be()), Object.entries(he).forEach(([n, r]) => {
527
- const i = t?.style?.getPropertyValue(n);
528
- (!i || i != r) && t?.style?.setProperty?.(n, r || "", "");
529
- }), document.documentElement.style.setProperty("--orientation-secondary", screen?.orientation?.type?.endsWith?.("secondary") ? "1" : "0");
530
- }, gt = () => {
531
- let e = screen?.orientation?.type || "portrait-primary";
532
- return globalThis.matchMedia("((display-mode: fullscreen) or (display-mode: standalone) or (display-mode: window-controls-overlay))").matches || (matchMedia("(orientation: portrait)").matches ? e = e.replace("landscape", "portrait") : matchMedia("(orientation: landscape)").matches && (e = e.replace("portrait", "landscape"))), e;
533
- }, ie = { passive: !0 }, vt = (e) => {
534
- let t = !1;
535
- const n = () => {
536
- t || (requestAnimationFrame(() => {
537
- yt(), e(), t = !1;
538
- }), t = !0);
539
- }, r = [];
540
- return r.push(m(navigator?.virtualKeyboard, "geometrychange", n, ie)), r.push(m(window?.visualViewport, "scroll", n, ie)), r.push(m(window?.visualViewport, "resize", n, ie)), r.push(m(screen?.orientation, "change", n)), r.push(m(window, "resize", n)), r.push(m(document?.documentElement, "fullscreenchange", n)), r.push(m(document, "DOMContentLoaded", n)), r.push(m(matchMedia("(orientation: portrait)"), "change", n)), r.push(m(matchMedia("(orientation: landscape)"), "change", n)), n(), ht(() => n(), 100), () => r.forEach((i) => i());
541
- }, Kn = (e) => {
542
- if (!e?.classList?.contains?.("native-portrait-optimized"))
543
- return e?.classList?.add?.("native-portrait-optimized"), vt(() => {
544
- const t = mt?.[gt()] ?? 0;
545
- e.orient = t, e.setAttribute?.("orient", String(t)), e.style?.setProperty?.("--orient", String(t));
546
- });
547
- }, R = new OffscreenCanvas(1, 1).getContext("2d"), He = (e, t) => {
548
- const n = getComputedStyle(e, "");
549
- if (t && n) {
550
- const r = n.getPropertyValue("font-weight") || "normal", i = n.getPropertyValue("font-size") || "16px", s = n.getPropertyValue("font-family") || "Times New Roman", a = n.getPropertyValue("font-stretch") || "normal";
551
- try {
552
- t.fontStretch = a.includes("%") ? "normal" : a;
553
- } catch {
554
- }
555
- try {
556
- t.letterSpacing = n.getPropertyValue("letter-spacing") || "normal";
557
- } catch {
558
- }
559
- try {
560
- t.fontKerning = n.getPropertyValue("font-kerning") || "auto";
561
- } catch {
562
- }
563
- try {
564
- t.fontVariantCaps = n.getPropertyValue("font-variant-caps") || "normal";
565
- } catch {
566
- }
567
- try {
568
- t.font = `${r} ${i} ${s}`;
569
- } catch {
570
- }
571
- }
572
- }, bt = (e, t) => {
573
- if (R) {
574
- He(t, R);
575
- try {
576
- return R.measureText(e);
577
- } catch {
578
- }
579
- }
580
- return { width: null };
581
- }, Qn = (e) => {
582
- const t = e.value.slice(0, e.selectionEnd || 0);
583
- return bt(t, e);
584
- }, St = (e, t) => {
585
- const n = e?.value || "";
586
- if (R) {
587
- He(e, R);
588
- let r = 0;
589
- for (let i = 0; i < n.length; i++) {
590
- if (r = R.measureText(n.slice(0, i))?.width, r == null) return n.length;
591
- if (r != null && r >= t[0]) return Math.max(i - 1, 0);
592
- }
593
- }
594
- return n.length;
595
- }, er = (e, t) => {
596
- const n = e.getBoundingClientRect(), r = [t[0] - n.left / pe(), t[1] - n.top / pe()];
597
- return St(e, r);
598
- }, wt = (e, t) => {
599
- const n = parseInt(e.getAttribute("data-grid-columns") || "", 10), r = parseInt(e.getAttribute("data-grid-rows") || "", 10), i = H(t ?? [4, 8]);
600
- return [Number.isFinite(n) && n > 0 ? n : i[0], Number.isFinite(r) && r > 0 ? r : i[1]];
601
- }, tr = (e, t, n, r = "floor") => {
602
- if (!e) return [0, 0];
603
- const i = e.getBoundingClientRect?.();
604
- if (!i) return [0, 0];
605
- const s = wt(e, n?.layout), a = z(e), o = globalThis.getComputedStyle?.(e), u = parseFloat(o?.paddingLeft) || 0, p = parseFloat(o?.paddingTop) || 0, d = parseFloat(o?.paddingRight) || 0, h = parseFloat(o?.paddingBottom) || 0, c = Math.max(1, (i.width || e.clientWidth || 1) - u - d), l = Math.max(1, (i.height || e.clientHeight || 1) - p - h);
606
- return rt([(t?.[0] || 0) - i.left - u, (t?.[1] || 0) - i.top - p], [c, l], s, a, {
607
- mode: r,
608
- redirect: {
609
- item: n?.item,
610
- list: n?.list,
611
- items: n?.items
612
- }
613
- });
614
- }, xt = async (e) => {
615
- const t = () => {
616
- e?.hasAttribute?.("data-hidden") || (e?.removeAttribute?.("data-opacity-animation"), e?.dispatchEvent?.(new CustomEvent("u2-appear", {
617
- detail: {},
618
- bubbles: !0,
619
- cancelable: !0
620
- })));
621
- };
622
- if (!e?.hasAttribute?.("data-hidden") && e?.dispatchEvent?.(new CustomEvent("u2-before-show", {
623
- detail: {},
624
- bubbles: !0,
625
- cancelable: !0
626
- })))
627
- if (!matchMedia("(prefers-reduced-motion: reduce)").matches && !e.hasAttribute("data-opacity-animation") && !e.hasAttribute("data-instant") && e?.getAttribute?.("data-hidden") == null && e.setAttribute("data-opacity-animation", ""), e.hasAttribute("data-opacity-animation") && e?.getAttribute?.("data-hidden") == null) {
628
- const n = e.animate([
629
- {
630
- easing: "linear",
631
- offset: 0,
632
- "--opacity": 0,
633
- "--scale": 0.8,
634
- display: "none",
635
- pointerEvents: "none"
636
- },
637
- {
638
- easing: "linear",
639
- offset: 0.01,
640
- "--opacity": 0,
641
- "--scale": 0.8,
642
- display: "none",
643
- pointerEvents: "none"
644
- },
645
- {
646
- easing: "linear",
647
- offset: 1,
648
- "--opacity": 1,
649
- "--scale": 1,
650
- display: "revert-layer",
651
- pointerEvents: "revert-layer"
652
- }
653
- ], {
654
- duration: Ke() ? 100 : 80,
655
- easing: "linear",
656
- delay: 0
657
- });
658
- let r = !1;
659
- const i = () => {
660
- r || (r = !0, s?.forEach?.((a) => a?.()), n.currentTime = 1, n.finish(), t?.());
661
- }, s = K(e, {
662
- "u2-before-hide": [i, {
663
- once: !0,
664
- passive: !0
665
- }],
666
- "u2-before-show": [i, {
667
- once: !0,
668
- passive: !0
669
- }]
670
- });
671
- await n.finished, i?.();
672
- } else {
673
- const { resolve: n, reject: r, promise: i } = Promise.withResolvers(), s = requestAnimationFrame(n);
674
- let a = !1;
675
- const o = () => {
676
- a || (a = !0, u?.forEach?.((p) => p?.()), cancelAnimationFrame(s), n(performance.now()), t?.());
677
- }, u = K(e, {
678
- "u2-before-hide": [o, {
679
- once: !0,
680
- passive: !0
681
- }],
682
- "u2-before-show": [o, {
683
- once: !0,
684
- passive: !0
685
- }]
686
- });
687
- await i, o?.();
688
- }
689
- }, Mt = async (e) => {
690
- const t = () => {
691
- e?.hasAttribute?.("data-hidden") && (e?.removeAttribute?.("data-opacity-animation"), e?.dispatchEvent?.(new CustomEvent("u2-hidden", {
692
- detail: {},
693
- bubbles: !0,
694
- cancelable: !0
695
- })));
696
- };
697
- if (e?.hasAttribute?.("data-hidden") && e?.dispatchEvent?.(new CustomEvent("u2-before-hide", {
698
- detail: {},
699
- bubbles: !0,
700
- cancelable: !0
701
- })))
702
- if (!matchMedia("(prefers-reduced-motion: reduce)").matches && !e.hasAttribute("data-opacity-animation") && !e.hasAttribute("data-instant") && e.setAttribute("data-opacity-animation", ""), e.hasAttribute("data-opacity-animation")) {
703
- const n = e.animate([
704
- {
705
- easing: "linear",
706
- offset: 0,
707
- pointerEvents: "none"
708
- },
709
- {
710
- easing: "linear",
711
- offset: 0.99,
712
- "--opacity": 0,
713
- "--scale": 0.8,
714
- pointerEvents: "none"
715
- },
716
- {
717
- easing: "linear",
718
- offset: 1,
719
- "--opacity": 0,
720
- "--scale": 0.8,
721
- display: "none",
722
- pointerEvents: "none"
723
- }
724
- ], {
725
- duration: 120,
726
- easing: "linear",
727
- delay: 0
728
- });
729
- let r = !1;
730
- const i = () => {
731
- r || (r = !0, s?.forEach?.((a) => a?.()), n.currentTime = 1, n.finish(), t?.());
732
- }, s = K(e, { "u2-before-show": [i, {
733
- once: !0,
734
- passive: !0
735
- }] });
736
- await n.finished, i?.();
737
- } else {
738
- const { resolve: n, reject: r, promise: i } = Promise.withResolvers(), s = requestAnimationFrame(n);
739
- let a = !1;
740
- const o = () => {
741
- a || (a = !0, u?.forEach?.((p) => p?.()), cancelAnimationFrame(s), n(performance.now()), t?.());
742
- }, u = K(e, {
743
- "u2-before-hide": [o, {
744
- once: !0,
745
- passive: !0
746
- }],
747
- "u2-before-show": [o, {
748
- once: !0,
749
- passive: !0
750
- }]
751
- });
752
- await i, o?.();
753
- }
754
- }, Et = /* @__PURE__ */ Symbol.for("dom.ts@onBorderObserve"), T = globalThis[Et] ??= /* @__PURE__ */ new WeakMap(), At = /* @__PURE__ */ Symbol.for("dom.ts@onContentObserve"), L = globalThis[At] ??= /* @__PURE__ */ new WeakMap(), q = (e) => (typeof e?.current == "object" && (e = e?.element ?? e?.current ?? (typeof e?.self == "object" ? e?.self : null) ?? e), e), nr = (e, t) => {
755
- if (!L.has(e = q(e))) {
756
- const n = [], r = new ResizeObserver((i) => {
757
- for (const s of i) if (s.contentBoxSize) {
758
- const a = s.contentBoxSize[0];
759
- a && n.forEach((o) => o?.(a, r));
760
- }
761
- });
762
- t?.({
763
- inlineSize: e.clientWidth,
764
- blockSize: e.clientHeight
765
- }, r), L.set(e, n), (e?.element ?? e) instanceof Node && r.observe(e?.element ?? e, { box: "content-box" });
766
- }
767
- return L.get(e)?.push?.(t), { disconnect: () => L.get(e)?.splice?.(L.get(e)?.indexOf(t) || -1, 1) };
768
- }, rr = (e, t) => {
769
- if (!T.has(e = q(e))) {
770
- const n = [], r = new ResizeObserver((i) => {
771
- for (const s of i) if (s.borderBoxSize) {
772
- const a = s.borderBoxSize[0];
773
- a && n.forEach((o) => o?.(a, r));
774
- }
775
- });
776
- t?.({
777
- inlineSize: e.offsetWidth,
778
- blockSize: e.offsetHeight
779
- }, r), T.set(e, n), (e?.element ?? e) instanceof Node && r.observe(e?.element ?? e, { box: "border-box" });
780
- }
781
- return T.get(e)?.push?.(t), { disconnect: () => T.get(e)?.splice?.(T.get(e)?.indexOf(t) || -1, 1) };
782
- }, ir = (e, t, n) => {
783
- if (typeof e?.selector == "string") return ve(e, e?.selector, t, n);
784
- const r = new Set((t.split(",") || [t]).map((s) => s.trim())), i = new MutationObserver((s, a) => {
785
- for (const o of s) o.attributeName && r.has(o.attributeName) && n(o, a);
786
- });
787
- return (e?.element ?? e) instanceof Node && i.observe(e = q(e), {
788
- attributes: !0,
789
- attributeOldValue: !0,
790
- attributeFilter: [...r]
791
- }), r.forEach((s) => n({
792
- target: e,
793
- type: "attributes",
794
- attributeName: s,
795
- oldValue: e?.getAttribute?.(s)
796
- }, i)), i;
797
- }, ve = (e, t, n, r) => {
798
- const i = new Set([...n.split(",") || [n]].map((a) => a.trim())), s = new MutationObserver((a, o) => {
799
- for (const u of a) if (u.type == "childList") {
800
- const p = Array.from(u.addedNodes) || [], d = Array.from(u.removedNodes) || [];
801
- p.push(...Array.from(u.addedNodes || []).flatMap((h) => Array.from(h?.querySelectorAll?.(t) || []))), d.push(...Array.from(u.removedNodes || []).flatMap((h) => Array.from(h?.querySelectorAll?.(t) || []))), [...new Set(p)].filter((h) => h?.matches?.(t))?.map?.((h) => {
802
- i.forEach((c) => {
803
- r({
804
- target: h,
805
- type: "attributes",
806
- attributeName: c,
807
- oldValue: h?.getAttribute?.(c)
808
- }, o);
809
- });
810
- });
811
- } else u.target?.matches?.(t) && u.attributeName && i.has(u.attributeName) && r(u, o);
812
- });
813
- return s.observe(e = q(e), {
814
- attributeOldValue: !0,
815
- attributes: !0,
816
- attributeFilter: [...i],
817
- childList: !0,
818
- subtree: !0,
819
- characterData: !0
820
- }), [...e.querySelectorAll(t)].map((a) => i.forEach((o) => r({
821
- target: a,
822
- type: "attributes",
823
- attributeName: o,
824
- oldValue: a?.getAttribute?.(o)
825
- }, s))), s;
826
- }, Ct = (e, t = "*", n = (r, i) => {
827
- }) => {
828
- const r = (c) => {
829
- const l = Array.from(c || []) || [];
830
- return l.push(...Array.from(c || []).flatMap((f) => Array.from(f?.querySelectorAll?.(t) || []))), [...Array.from(new Set(l).values())].filter((f) => f?.matches?.(t));
831
- }, i = (c) => {
832
- const l = d?.deref?.(), f = r(c.addedNodes), y = r(c.removedNodes);
833
- (f.length > 0 || y.length > 0) && n?.({
834
- type: c.type,
835
- target: c.target,
836
- attributeName: c.attributeName,
837
- attributeNamespace: c.attributeNamespace,
838
- nextSibling: c.nextSibling,
839
- oldValue: c.oldValue,
840
- previousSibling: c.previousSibling,
841
- addedNodes: f,
842
- removedNodes: y
843
- }, l);
844
- }, s = (c) => {
845
- i({
846
- addedNodes: [c?.target].filter((l) => !!l),
847
- removedNodes: [c?.relatedTarget].filter((l) => !!l),
848
- type: "childList",
849
- target: c?.currentTarget
850
- });
851
- }, a = (c) => {
852
- i({
853
- addedNodes: [c?.relatedTarget].filter((l) => !!l),
854
- removedNodes: [c?.target].filter((l) => !!l),
855
- type: "childList",
856
- target: c?.currentTarget
857
- });
858
- }, o = (c) => {
859
- i({
860
- addedNodes: [c?.target].filter((l) => !!l),
861
- removedNodes: [c?.relatedTarget || document?.activeElement].filter((l) => !!l),
862
- type: "childList",
863
- target: c?.currentTarget
864
- });
865
- }, u = {
866
- passive: !0,
867
- capture: !1
868
- };
869
- if (t?.includes?.(":hover") && t?.includes?.(":active"))
870
- return e.addEventListener("pointerover", s, u), e.addEventListener("pointerout", a, u), e.addEventListener("pointerdown", s, u), e.addEventListener("pointerup", a, u), e.addEventListener("pointercancel", a, u), { disconnect: () => {
871
- e.removeEventListener("pointerover", s, u), e.removeEventListener("pointerout", a, u), e.removeEventListener("pointerdown", s, u), e.removeEventListener("pointerup", a, u), e.removeEventListener("pointercancel", a, u);
872
- } };
873
- if (t?.includes?.(":hover"))
874
- return e.addEventListener("pointerover", s, u), e.addEventListener("pointerout", a, u), { disconnect: () => {
875
- e.removeEventListener("pointerover", s, u), e.removeEventListener("pointerout", a, u);
876
- } };
877
- if (t?.includes?.(":active"))
878
- return e.addEventListener("pointerdown", s, u), e.addEventListener("pointerup", a, u), e.addEventListener("pointercancel", a, u), { disconnect: () => {
879
- e.removeEventListener("pointerdown", s, u), e.removeEventListener("pointerup", a, u), e.removeEventListener("pointercancel", a, u);
880
- } };
881
- if (t?.includes?.(":focus") && t?.includes?.(":focus-within") && t?.includes?.(":focus-visible"))
882
- return e.addEventListener("focusin", s, u), e.addEventListener("focusout", a, u), e.addEventListener("click", o, u), { disconnect: () => {
883
- e.removeEventListener("focusin", s, u), e.removeEventListener("focusout", a, u), e.removeEventListener("click", o, u);
884
- } };
885
- const p = new MutationObserver((c, l) => {
886
- for (const f of c) f.type == "childList" && i(f);
887
- }), d = new WeakRef(p);
888
- (e?.element ?? e) instanceof Node && p.observe(e = q(e), {
889
- childList: !0,
890
- subtree: !0
891
- });
892
- const h = Array.from(e.querySelectorAll(t));
893
- return h.length > 0 && n?.({
894
- addedNodes: h,
895
- removedNodes: []
896
- }, p), p;
897
- }, or = async (e = document.body) => {
898
- ve(e, "*", "data-hidden", (t, n) => {
899
- if (t.attributeName == "data-hidden") {
900
- const r = t.target;
901
- r.getAttribute("data-hidden") !== t.oldValue && Promise?.try?.(r.getAttribute("data-hidden") != null ? Mt : xt, r, n)?.catch?.(console.warn.bind(console));
902
- }
903
- });
904
- }, ar = (e = 100, t = 0.05, n = 8) => {
905
- const r = [];
906
- for (let o = 0; o < e; o++) r.push(o / e);
907
- const i = (o) => `calc(${o}rad * pi * 2)`, s = (o) => `calc(calc(cos(calc(var(--clip-freq, 8) * ${i(o)})) * 0.5 + 0.5) * var(--clip-amplitude, 0))`, a = (o) => [`calc(calc(0.5 + calc(cos(${i(o)}) * calc(0.5 - ${s(o)}))) * var(--icon-size, 100%))`, `calc(calc(0.5 + calc(sin(${i(o)}) * calc(0.5 - ${s(o)}))) * var(--icon-size, 100%))`];
908
- return {
909
- "--clip-amplitude": t,
910
- "--clip-freq": n,
911
- "--clip-path": `polygon(${r.map((o) => a(o).join(" ")).join(", ")})`
912
- };
913
- }, qe = () => typeof globalThis < "u" && typeof globalThis.CSSStyleSheet == "function", ze = (e) => typeof e == "string" && /@import\b/i.test(e), be = "DOM", W = typeof document < "u" ? document.createElement("style") : null;
914
- W && (typeof document < "u" && document.querySelector("head")?.appendChild?.(W), W.dataset.owner = be);
915
- var Te = (e, t, n = "") => {
916
- e[0][e[1]] = e[1] == "innerHTML" ? `@import url("${t}") ${n && typeof n == "string" ? `layer(${n})` : ""};` : t;
917
- }, sr = (e) => e?.map?.((t) => qt(...t)), Rt = (e, t) => {
918
- t ||= W?.sheet;
919
- let n = Array.from(t?.cssRules || []).findIndex((i) => i instanceof CSSLayerBlockRule && i?.name === e), r;
920
- return n === -1 && t ? r = t?.cssRules?.[n = t.insertRule(`@layer ${e} {}`)] : r = t?.cssRules?.[n], r;
921
- }, Pt = 0, oe = (e) => typeof ShadowRoot < "u" && e instanceof ShadowRoot, Le = (e) => typeof Document < "u" && e instanceof Document, zt = (e) => typeof Element < "u" && e instanceof Element, ke = (e) => typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : Array.from(e).map((t) => `\\${t.codePointAt(0).toString(16)} `).join(""), Tt = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `ux-${Date.now().toString(36)}-${(++Pt).toString(36)}`, Lt = (e, t) => (t = t.trim(), e ? t ? t.startsWith("::") ? `${e}${t}` : `${e} ${t}` : e : t), kt = (e, t, n, r) => {
922
- const i = Array.from(e?.cssRules || []), s = t.trim(), a = r.trim();
923
- return i.findIndex((o) => {
924
- if (!(o instanceof CSSStyleRule)) return !1;
925
- const u = o.selectorText?.trim?.() ?? "";
926
- return u === s ? !0 : a && u.endsWith(a) ? u.slice(0, u.length - a.length).trim() === n : !1;
927
- });
928
- }, Se = (e, t, n = "ux-query", r = null) => {
929
- const i = oe(r) || Le(r) ? r : r?.getRootNode?.() ?? (typeof document < "u" ? document : null), s = zt(r) ? r : null;
930
- let a = "";
931
- if (s?.id) a = `#${ke(s.id)}`;
932
- else if (s) {
933
- let d = s.getAttribute("data-style-id");
934
- d || (d = Tt(), s.setAttribute("data-style-id", d)), a = `[data-style-id="${ke(d)}"]`;
935
- } else oe(i) ? a = ":host" : Le(i) && (a = ":root");
936
- let o = null;
937
- if (oe(i) ? (o = i.querySelector("style[data-ux-query]"), !o && typeof document < "u" && (o = document.createElement("style"), o.setAttribute("data-ux-query", ""), i.appendChild(o))) : o = Vt(), t ||= o?.sheet, !t) return;
938
- if (n) return Se(e, Rt(n, t), null, r);
939
- const u = Lt(a, e);
940
- let p = kt(t, u, a, e);
941
- return p === -1 && (p = t.insertRule(`${u} {}`)), t.cssRules?.[p];
942
- };
943
- function Vt() {
944
- return W ?? null;
945
- }
946
- var ne = typeof CSSStyleValue < "u" && typeof CSSUnitValue < "u", P = (e) => ne && e instanceof CSSStyleValue, A = (e) => ne && e instanceof CSSUnitValue, b = (e, t, n, r = "") => {
947
- if (!(!e || !t)) {
948
- if (n == null) {
949
- e.getPropertyValue(t) !== "" && e.removeProperty(t);
950
- return;
951
- }
952
- e.getPropertyValue(t) !== n && e.setProperty(t, n, r);
953
- }
954
- }, jt = (e, t, n, r = "") => {
955
- if (!e || !t) return e;
956
- const i = te(t), s = e.style, a = e.attributeStyleMap ?? e.styleMap;
957
- if (!ne || !a) return _e(e, t, n, r);
958
- let o = M(n) && !(P(n) || A(n)) ? n?.value : n;
959
- if (o == null)
960
- return a.delete?.(i), s && b(s, i, null, r), e;
961
- if (P(o)) {
962
- const u = a.get(i);
963
- if (A(o) && A(u)) {
964
- if (u.value === o.value && u.unit === o.unit) return e;
965
- } else if (u === o) return e;
966
- return a.set(i, o), e;
967
- }
968
- if (typeof o == "number") if (CSS?.number && !i.startsWith("--")) {
969
- const u = CSS.number(o), p = a.get(i);
970
- return A(p) && p.value === u.value && p.unit === u.unit || a.set(i, u), e;
971
- } else
972
- return b(s, i, String(o), r), e;
973
- if (typeof o == "string" && !P(o)) {
974
- const u = Ie(o);
975
- if (typeof u == "number" && CSS?.number && !i.startsWith("--")) {
976
- const p = CSS.number(u), d = a.get(i);
977
- return A(d) && d.value === p.value && d.unit === p.unit || a.set(i, p), e;
978
- } else
979
- return b(s, i, o, r), e;
980
- }
981
- return b(s, i, String(o), r), e;
982
- }, _e = (e, t, n, r = "") => {
983
- if (!e || !t) return e;
984
- const i = te(t), s = e.style;
985
- if (!s) return e;
986
- let a = M(n) && !(P(n) || A(n)) ? n?.value : n;
987
- return typeof a == "string" && !P(a) && (a = Ie(a) ?? a), a == null ? (b(s, i, null, r), e) : (P(a) || typeof a == "number", b(s, i, String(a), r), e);
988
- }, Ze = (e, t) => typeof e?.then == "function" ? e?.then?.(t) : t(e), Ot = /* @__PURE__ */ Symbol.for("dom.ts@blobURLMap"), k = globalThis[Ot] ??= /* @__PURE__ */ new WeakMap(), Nt = /* @__PURE__ */ Symbol.for("dom.ts@cacheMap"), x = globalThis[Nt] ??= /* @__PURE__ */ new Map(), Wt = (e) => {
989
- if (!e) return null;
990
- if (x.has(e)) return x.get(e);
991
- if (e instanceof Blob || e instanceof File) {
992
- if (k.has(e)) return k.get(e);
993
- const t = URL.createObjectURL(e);
994
- return k.set(e, t), x.set(t, t), t;
995
- }
996
- if (URL.canParse(e) || e?.trim?.()?.startsWith?.("./")) {
997
- const t = fetch(e?.replace?.("?url", "?raw"), {
998
- cache: "force-cache",
999
- mode: "same-origin",
1000
- priority: "high"
1001
- })?.then?.(async (n) => {
1002
- const r = await n.blob(), i = URL.createObjectURL(r);
1003
- return k.set(r, i), x.set(e, i), x.set(i, i), i;
1004
- });
1005
- return x.set(e, t), t;
1006
- }
1007
- if (typeof e == "string") {
1008
- const t = new Blob([e], { type: "text/css" }), n = URL.createObjectURL(t);
1009
- return k.set(t, n), x.set(n, n), n;
1010
- }
1011
- return e;
1012
- }, V = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new WeakMap(), Ft = (e) => {
1013
- if (!e) return "";
1014
- if (V.has(e)) return V.get(e) ?? "";
1015
- if (e instanceof Blob || e instanceof File) {
1016
- if (Z.has(e)) return Z.get(e) ?? "";
1017
- const t = e?.text?.()?.then?.((n) => (Z.set(e, n), n));
1018
- return Z.set(e, t), t;
1019
- }
1020
- if (URL.canParse(e) || e?.trim?.()?.startsWith?.("./")) {
1021
- const t = fetch(e?.replace?.("?url", "?raw"), {
1022
- cache: "force-cache",
1023
- mode: "same-origin",
1024
- priority: "high"
1025
- })?.then?.(async (n) => {
1026
- const r = await n.text();
1027
- return V.set(e, r), r;
1028
- });
1029
- return V.set(e, t), t;
1030
- }
1031
- return typeof e == "string" && V.set(e, e), e;
1032
- }, It = /* @__PURE__ */ Symbol.for("dom.ts@adoptedSelectorMap"), Ve = globalThis[It] ??= /* @__PURE__ */ new Map(), $t = /* @__PURE__ */ Symbol.for("dom.ts@adoptedShadowSelectorMap"), je = globalThis[$t] ??= /* @__PURE__ */ new WeakMap(), Bt = /* @__PURE__ */ Symbol.for("dom.ts@adoptedLayerMap"), Oe = globalThis[Bt] ??= /* @__PURE__ */ new Map(), Ht = /* @__PURE__ */ Symbol.for("dom.ts@adoptedShadowLayerMap"), D = globalThis[Ht] ??= /* @__PURE__ */ new WeakMap(), ur = (e, t = "ux-query", n = null) => {
1033
- if (!e || !qe()) return null;
1034
- const r = n instanceof ShadowRoot ? n : n?.getRootNode ? n.getRootNode({ composed: !0 }) : null, i = r instanceof ShadowRoot, s = i ? r.adoptedStyleSheets : typeof document < "u" ? document.adoptedStyleSheets : null;
1035
- if (!s) return null;
1036
- const a = `${t || ""}:${e}`;
1037
- let o;
1038
- if (i) {
1039
- let d = je.get(r);
1040
- d || (d = /* @__PURE__ */ new Map(), je.set(r, d)), o = d.get(a), o || (o = new CSSStyleSheet(), d.set(a, o), s.includes(o) || s.push(o));
1041
- } else
1042
- o = Ve.get(a), o || (o = new CSSStyleSheet(), Ve.set(a, o), s.includes(o) || s.push(o));
1043
- if (t) {
1044
- let d;
1045
- if (i) {
1046
- let h = D.get(r);
1047
- h || (h = /* @__PURE__ */ new Map(), D.set(r, h)), d = h.get(t);
1048
- } else d = Oe.get(t);
1049
- if (!d) {
1050
- const h = Array.from(o.cssRules || []), c = h.findIndex((l) => l instanceof CSSLayerBlockRule && l.name === t);
1051
- if (c === -1) try {
1052
- o.insertRule(`@layer ${t} {}`, o.cssRules.length);
1053
- const l = o.cssRules[o.cssRules.length - 1];
1054
- l instanceof CSSLayerBlockRule && (d = l);
1055
- } catch {
1056
- d = void 0;
1057
- }
1058
- else d = h[c];
1059
- if (d) if (i) {
1060
- let l = D.get(r);
1061
- l || (l = /* @__PURE__ */ new Map(), D.set(r, l)), l.set(t, d);
1062
- } else Oe.set(t, d);
1063
- }
1064
- if (d) {
1065
- let h = Array.from(d.cssRules || []).findIndex((c) => c instanceof CSSStyleRule && c.selectorText?.trim?.() === e?.trim?.());
1066
- if (h === -1) try {
1067
- h = d.insertRule(`${e} {}`, d.cssRules.length);
1068
- } catch {
1069
- return null;
1070
- }
1071
- return d.cssRules[h];
1072
- }
1073
- }
1074
- let u = Array.from(o.cssRules || []).findIndex((d) => d instanceof CSSStyleRule && d.selectorText?.trim?.() === e?.trim?.());
1075
- if (u === -1) try {
1076
- u = o.insertRule(`${e} {}`, o.cssRules.length);
1077
- } catch {
1078
- return null;
1079
- }
1080
- const p = o.cssRules[u];
1081
- return p instanceof CSSStyleRule ? p : null;
1082
- }, S = (e, t, n, r = "") => ne ? jt(e, t, n, r) : _e(e, t, n, r), cr = (e, t, n) => S(Se(e), t, n), qt = (e, t) => {
1083
- const n = Se(e);
1084
- return Object.entries(t).forEach(([r, i]) => S(n, r, i)), n;
1085
- }, lr = async (e) => {
1086
- const t = await crypto?.subtle?.digest("SHA-256", typeof e == "string" ? new TextEncoder().encode(e) : e instanceof ArrayBuffer ? e : await e?.arrayBuffer?.());
1087
- return "sha256-" + btoa(String.fromCharCode.apply(null, new Uint8Array(t)));
1088
- }, De = (e, t, n = "", r) => {
1089
- const i = Wt(e), s = typeof e == "string" && URL.canParse(e) ? e : i;
1090
- return t?.[0] && (t[0].fetchPriority = "high"), t && s && typeof s == "string" && Te(t, s, n), t?.[0] && (!URL.canParse(e) || r) && t?.[0] instanceof HTMLLinkElement, Ze(i, (a) => {
1091
- t?.[0] && a && (Te(t, a, n), t?.[0].setAttribute("loaded", ""));
1092
- })?.catch?.((a) => {
1093
- console.warn("Failed to load style sheet:", a);
1094
- });
1095
- }, _t = (e) => {
1096
- const t = typeof document < "u" ? document.createElement("link") : null;
1097
- return t && (t.fetchPriority = "high"), t ? (Object.assign(t, {
1098
- rel: "stylesheet",
1099
- type: "text/css",
1100
- crossOrigin: "same-origin"
1101
- }), t.dataset.owner = be, De(e, [t, "href"]), typeof document < "u" && document.head.append(t), t) : null;
1102
- }, j = (e, t = typeof document < "u" ? document?.head : null, n = "") => {
1103
- const r = t?.querySelector?.("head") ?? t;
1104
- if (typeof HTMLHeadElement < "u" && r instanceof HTMLHeadElement) return _t(e);
1105
- const i = typeof document < "u" ? document.createElement("style") : null;
1106
- return i ? (i.dataset.owner = be, De(e, [i, "innerHTML"], n), r?.prepend?.(i), i) : null;
1107
- }, dr = (e, t, n, r = "") => S(e, t, n, r), fr = (e) => Xt(e, ""), Zt = /* @__PURE__ */ Symbol.for("dom.ts@adoptedMap"), v = globalThis[Zt] ??= /* @__PURE__ */ new Map(), Dt = /* @__PURE__ */ Symbol.for("dom.ts@adoptedBlobMap"), O = globalThis[Dt] ??= /* @__PURE__ */ new WeakMap(), Ut = /* @__PURE__ */ Symbol.for("dom.ts@layerCounter"), pr = globalThis[Ut] ??= 0, Ne = (e, t) => {
1108
- if (!e || !t) return !1;
1109
- try {
1110
- return e.replaceSync(t), !0;
1111
- } catch (n) {
1112
- const r = String(n?.message || "").toLowerCase();
1113
- return r.includes("@import rules are not allowed") || r.includes("@import") && r.includes("not allowed") || console.warn("[DOM] Failed to apply adopted stylesheet:", n), !1;
1114
- }
1115
- }, Xt = (e, t = null) => {
1116
- if (!qe())
1117
- return typeof e == "string" && j(e, void 0, t || ""), null;
1118
- if (typeof e == "string" && ze(e))
1119
- return j(e, void 0, t || ""), null;
1120
- if (typeof e == "string" && v?.has?.(e)) {
1121
- const r = v.get(e);
1122
- return typeof document < "u" && document.adoptedStyleSheets && !document.adoptedStyleSheets.includes(r) && document.adoptedStyleSheets.push(r), r;
1123
- }
1124
- if ((e instanceof Blob || e instanceof File) && O?.has?.(e)) {
1125
- const r = O.get(e);
1126
- return typeof document < "u" && document.adoptedStyleSheets && !document.adoptedStyleSheets.includes(r) && document.adoptedStyleSheets.push(r), r;
1127
- }
1128
- if (!e) return null;
1129
- const n = typeof e == "string" ? v.getOrInsertComputed(e, (r) => new CSSStyleSheet()) : O.getOrInsertComputed(e, (r) => new CSSStyleSheet());
1130
- if (typeof document < "u" && document.adoptedStyleSheets && !document.adoptedStyleSheets.includes(n) && document.adoptedStyleSheets.push(n), typeof e == "string" && !URL.canParse(e)) {
1131
- const r = t ? `@layer ${t} { ${e} }` : e;
1132
- return v.set(e, n), Ne(n, r) || (ae(n), v.delete(e), j(e)), n;
1133
- } else Ze(Ft(e), (r) => {
1134
- if (v.set(r, n), r) {
1135
- if (ze(r))
1136
- return ae(n), v.delete(r), O.delete(e), j(r, void 0, t || ""), n;
1137
- const i = t ? `@layer ${t} { ${r} }` : r;
1138
- return Ne(n, i) || (ae(n), v.delete(r), O.delete(e), j(r, void 0, t || "")), n;
1139
- }
1140
- });
1141
- return n;
1142
- }, ae = (e) => {
1143
- if (!e) return !1;
1144
- const t = typeof e == "string" ? v.get(e) : e;
1145
- if (!t || typeof document > "u") return !1;
1146
- const n = document.adoptedStyleSheets, r = n.indexOf(t);
1147
- return r !== -1 ? (n.splice(r, 1), !0) : !1;
1148
- }, Yt = (e, t) => {
1149
- const n = e.split(" ");
1150
- return new DOMPoint(We(n[0], () => t.clientWidth), We(n[1], () => t.clientHeight));
1151
- }, We = (e, t) => e.endsWith("%") ? parseFloat(e) / 100 * t() : parseFloat(e), hr = (e) => {
1152
- if (e?.computedStyleMap) {
1153
- const t = e.computedStyleMap().get("transform")?.toMatrix?.();
1154
- if (t) return t;
1155
- } else if (e) {
1156
- const t = getComputedStyle(e);
1157
- return new DOMMatrix(t?.getPropertyValue?.("transform"));
1158
- }
1159
- return new DOMMatrix();
1160
- }, mr = (e) => {
1161
- const t = getComputedStyle(e)?.getPropertyValue?.("transform-origin") || "50% 50%";
1162
- return Yt(t, e);
1163
- }, N = (e, t) => {
1164
- if ("computedStyleMap" in e) {
1165
- const n = e?.computedStyleMap?.()?.get(t);
1166
- return n instanceof CSSUnitValue ? n?.value || 0 : n?.toString?.();
1167
- }
1168
- if (e instanceof HTMLElement) {
1169
- const n = getComputedStyle?.(e, "");
1170
- return parseFloat(n?.getPropertyValue?.(t)?.replace?.("px", "")) || 0;
1171
- }
1172
- return parseFloat((e?.style ?? e).getPropertyValue?.(t)?.replace?.("px", "")) || 0;
1173
- }, yr = (e) => {
1174
- let t = 1, n = e;
1175
- for (; n; ) {
1176
- if ("currentCSSZoom" in n) {
1177
- const i = n.currentCSSZoom;
1178
- if (typeof i == "number") return t *= i;
1179
- }
1180
- const r = getComputedStyle(n);
1181
- if (r.zoom && r.zoom !== "normal") return t *= parseFloat(r.zoom);
1182
- if (r.zoom && r.zoom !== "normal" || "currentCSSZoom" in n) return t;
1183
- n = n?.offsetParent ?? n?.parentElement;
1184
- }
1185
- return t;
1186
- }, gr = (e, t) => N?.(e, t), vr = (e, t) => t == "inline" ? N(e, "padding-inline-start") + N(e, "padding-inline-end") : N(e, "padding-block-start") + N(e, "padding-block-end"), Ue = /* @__PURE__ */ new WeakMap(), Gt = (e, t, n) => (new WeakRef(e), t.has(n) || t.add(n), e), br = (e, t) => {
1187
- if (e) {
1188
- if (t) {
1189
- const n = Ue.getOrInsert(e, /* @__PURE__ */ new Set());
1190
- [...t?.values?.() || []].map((r) => Gt(e, n, r));
1191
- }
1192
- return e;
1193
- }
1194
- }, Jt = /* @__PURE__ */ Symbol.for("dom.ts@namedStoreMaps"), I = globalThis[Jt] ??= /* @__PURE__ */ new Map(), Kt = (e, t) => {
1195
- const n = [...e.entries() || []];
1196
- return new Map(n?.map?.(([r, i]) => [r, i?.get?.(t)])?.filter?.(([r, i]) => !!i) || []);
1197
- }, Qt = (e, t, n) => {
1198
- let r = I.get(t);
1199
- return r || (r = /* @__PURE__ */ new WeakMap(), I.set(t, r)), r.has(e) || r.set(e, n), e;
1200
- }, Sr = (e, t) => {
1201
- if (!(!e || !t)) {
1202
- for (const [n, r] of t.entries()) Qt(e, n, r);
1203
- return e;
1204
- }
1205
- }, wr = (e, t) => {
1206
- if (e) {
1207
- if (t) {
1208
- const n = w?.get?.(e) ?? /* @__PURE__ */ new WeakSet();
1209
- w?.has?.(e) || w?.set?.(e, n), [...t?.values?.() || []].map((r) => en(e, r, n));
1210
- }
1211
- return e;
1212
- }
1213
- }, F = (e) => ({
1214
- storeSet: Kt(I, e),
1215
- mixinSet: w?.get?.(e),
1216
- behaviorSet: Ue?.get?.(e)
1217
- }), en = (e, t, n) => {
1218
- const r = new WeakRef(e);
1219
- return n ||= w?.get?.(e), n?.has?.(t) || (n?.add?.(t), C?.get?.(t)?.add?.(e), t.name && e?.setAttribute?.("data-mixin", [...e?.getAttribute?.("data-mixin")?.split?.(" ") || [], t.name].filter((i) => !!i).join(" ")), t?.connect?.(r, t, F(e))), e;
1220
- }, tn = /* @__PURE__ */ Symbol.for("dom.ts@boundMixinSet"), w = globalThis[tn] ??= /* @__PURE__ */ new WeakMap(), nn = /* @__PURE__ */ Symbol.for("dom.ts@mixinElements"), C = globalThis[nn] ??= /* @__PURE__ */ new WeakMap(), rn = /* @__PURE__ */ Symbol.for("dom.ts@mixinRegistry"), $ = globalThis[rn] ??= /* @__PURE__ */ new Map(), on = /* @__PURE__ */ Symbol.for("dom.ts@mixinNamespace"), Q = globalThis[on] ??= /* @__PURE__ */ new WeakMap(), Xe = (e, t) => {
1221
- typeof t == "string" && (t = $?.get?.(t));
1222
- const n = /* @__PURE__ */ new Set([...e?.getAttribute?.("data-mixin")?.split?.(" ") || []]), r = new Set([...n].map((a) => $?.get?.(a)).filter((a) => !!a)), i = w?.get?.(e) ?? /* @__PURE__ */ new WeakSet();
1223
- C?.has?.(t) || C?.set?.(t, /* @__PURE__ */ new WeakSet()), w?.has?.(e) || w?.set?.(e, i);
1224
- const s = new WeakRef(e);
1225
- i?.has?.(t) || (r.has(t) || t?.disconnect?.(s, t, F(e)), (r.has(t) || !C?.get?.(t)?.has?.(e)) && (t?.connect?.(s, t, F(e)), n.add(Q?.get?.(t)), i?.add?.(t), e?.setAttribute?.("data-mixin", [...n].filter((a) => !!a).join(" "))), C?.get?.(t)?.add?.(e)), i?.has?.(t) && (r.has(t) || (i?.delete?.(t), t?.disconnect?.(s, t, F(e))));
1226
- }, me = /* @__PURE__ */ new Set(), an = (e = typeof document < "u" ? document : null) => {
1227
- if (e)
1228
- return me?.has?.(e) || (me?.add?.(e), ve(e, "*", "data-mixin", (t) => ye(t.target)), Ct(e, "[data-mixin]", (t) => {
1229
- for (const n of t.addedNodes) n instanceof HTMLElement && ye(n);
1230
- })), e;
1231
- }, ye = (e) => {
1232
- const t = /* @__PURE__ */ new Set([...e?.getAttribute?.("data-mixin")?.split?.(" ") || []]);
1233
- [...new Set([...t].map((n) => $?.get?.(n)).filter((n) => !!n))].map?.((n) => Xe(e, n));
1234
- }, sn = (e, t) => {
1235
- e.forEach((n) => t ? Xe(n, t) : ye(n));
1236
- }, un = (e) => {
1237
- for (const t of me) sn(t?.querySelectorAll?.("[data-mixin]"), e);
1238
- }, cn = new FinalizationRegistry((e) => {
1239
- $?.delete?.(e);
1240
- }), ln = (e, t) => {
1241
- if (!Q?.has?.(t)) {
1242
- const n = e?.trim?.();
1243
- n && (Q?.set?.(t, n), $?.set?.(n, t), cn?.register?.(t, n), un(t));
1244
- }
1245
- };
1246
- an(typeof document < "u" ? document : null);
1247
- var we = class {
1248
- constructor(e = null) {
1249
- e && ln(e, this);
1250
- }
1251
- connect(e, t, n) {
1252
- return this;
1253
- }
1254
- disconnect(e, t, n) {
1255
- return this;
1256
- }
1257
- storeForElement(e) {
1258
- return I.get(this.name || "")?.get?.(e);
1259
- }
1260
- relatedForElement(e) {
1261
- return F(e);
1262
- }
1263
- get elements() {
1264
- return C?.get?.(this);
1265
- }
1266
- get storage() {
1267
- return I?.get?.(this.name || "");
1268
- }
1269
- get name() {
1270
- return Q?.get?.(this);
1271
- }
1272
- }, xr = (e, t, n) => {
1273
- const r = n;
1274
- M(n) && (n = n.value);
1275
- const i = (n = ge(n)) != null && n !== !1;
1276
- return B(r, () => {
1277
- e instanceof HTMLInputElement ? e.hidden = !i : i ? e?.removeAttribute?.("data-hidden") : e?.setAttribute?.("data-hidden", "");
1278
- }), e;
1279
- }, Mr = (e, t, n) => {
1280
- if (!(t = typeof t == "string" ? Fe(t) : t) || !e || [
1281
- "style",
1282
- "dataset",
1283
- "attributeStyleMap",
1284
- "styleMap",
1285
- "computedStyleMap"
1286
- ].indexOf(t || "") != -1) return e;
1287
- const r = n;
1288
- return M(n) && (n = n.value), e?.[t] === n || e?.[t] !== n && B(r, () => {
1289
- n != null ? e[t] = n : delete e[t];
1290
- }), e;
1291
- }, Er = (e, t, n) => {
1292
- const r = e?.dataset;
1293
- if (!t || !e || !r) return e;
1294
- const i = n;
1295
- return M(n) && (n = n?.value), t = Fe(t), r?.[t] === (n = ge(n)) || (n == null || n === !1 ? delete r[t] : B(i, () => {
1296
- typeof n != "object" && typeof n != "function" ? r[t] = String(n) : delete r[t];
1297
- })), e;
1298
- }, dn = (e, t) => e.style.removeProperty(te(t)), Ar = (e, t, n) => {
1299
- const r = e?.style;
1300
- return !t || typeof t != "string" || !e || !r || B(n, () => {
1301
- et(n) || M(n) || Qe(n) ? S(e, t, n) : n == null && dn(e, t);
1302
- }), e;
1303
- }, Cr = (e, t, n) => {
1304
- if (!t || !e) return e;
1305
- const r = n;
1306
- return M(n) && (n = n.value), t = te(t), e?.getAttribute?.(t) === (n = ge(n)) || B(r, () => {
1307
- typeof n != "object" && typeof n != "function" && n != null && (typeof n != "boolean" || n == !0) ? e?.setAttribute?.(t, String(n)) : e?.removeAttribute?.(t);
1308
- }), e;
1309
- };
1310
- function se(e, t) {
1311
- const n = Math.min(e.x, t.x), r = Math.min(e.y, t.y), i = Math.max(e.x, t.x), s = Math.max(e.y, t.y);
1312
- return {
1313
- left: n,
1314
- top: r,
1315
- right: i,
1316
- bottom: s,
1317
- width: i - n,
1318
- height: s - r
1319
- };
1320
- }
1321
- var U = {
1322
- start: "junction-select:start",
1323
- move: "junction-select:move",
1324
- end: "junction-select:end",
1325
- cancel: "junction-select:cancel"
1326
- }, ue = {
1327
- start: "junction-drag:start",
1328
- move: "junction-drag:move",
1329
- end: "junction-drag:end"
1330
- }, ce = {
1331
- start: "junction-resize:start",
1332
- move: "junction-resize:move",
1333
- end: "junction-resize:end"
1334
- }, fn = /* @__PURE__ */ Symbol.for("dom.ts@mixinDisposers"), ee = globalThis[fn] ??= /* @__PURE__ */ new WeakMap(), g = (e, t, n) => {
1335
- const r = ee.get(e) ?? /* @__PURE__ */ new Map(), i = r.get(t) ?? [];
1336
- i.push(n), r.set(t, i), ee.set(e, r);
1337
- }, xe = (e, t) => {
1338
- const n = ee.get(e), r = n?.get(t);
1339
- if (r) {
1340
- for (const i of r) try {
1341
- i();
1342
- } catch {
1343
- }
1344
- n.delete(t), n.size === 0 && ee.delete(e);
1345
- }
1346
- }, E = (e, t) => {
1347
- const n = globalThis.getComputedStyle?.(e)?.getPropertyValue?.(t)?.trim?.() ?? "", r = parseFloat(n);
1348
- return Number.isFinite(r) ? r : 0;
1349
- }, Ye = (e, t, n) => {
1350
- const r = e.getAttribute(t)?.trim();
1351
- if (!r) return n;
1352
- const i = e.querySelector(r);
1353
- return i instanceof HTMLElement ? i : n;
1354
- }, pn = class extends we {
1355
- constructor() {
1356
- super("ui-junction-select");
1357
- }
1358
- connect(e) {
1359
- const t = e?.deref?.();
1360
- if (!t) return this;
1361
- const n = document.createElement("div");
1362
- n.className = "ui-junction-select-overlay", n.setAttribute("data-junction-overlay", ""), n.style.cssText = "position:absolute;pointer-events:none;z-index:9999;box-sizing:border-box;border:1px dashed color-mix(in oklab, #3794ff 70%, transparent);background:color-mix(in oklab, #3794ff 14%, transparent);display:none;inset:auto;min-width:0;min-height:0;", globalThis.getComputedStyle?.(t)?.position === "static" && (t.style.position = "relative"), t.appendChild(n);
1363
- let i = !1, s = {
1364
- x: 0,
1365
- y: 0
1366
- }, a = {
1367
- x: 0,
1368
- y: 0
1369
- };
1370
- const o = (f) => {
1371
- const y = t.getBoundingClientRect();
1372
- return {
1373
- x: f.clientX - y.left,
1374
- y: f.clientY - y.top
1375
- };
1376
- }, u = () => {
1377
- const f = se(s, a);
1378
- if (f.width < 1 && f.height < 1) {
1379
- n.style.display = "none";
1380
- return;
1381
- }
1382
- n.style.display = "block", n.style.left = `${f.left}px`, n.style.top = `${f.top}px`, n.style.width = `${f.width}px`, n.style.height = `${f.height}px`;
1383
- }, p = (f) => {
1384
- f.button === 0 && (f.target?.closest?.("[data-junction-ignore-select], [data-junction-drag-handle], [data-junction-resize-handle], button, a, input, textarea, select") || (f.target === t || t.contains(f.target)) && (i = !0, s = o(f), a = { ...s }, t.setPointerCapture(f.pointerId), t.dispatchEvent(new CustomEvent(U.start, {
1385
- bubbles: !0,
1386
- detail: {
1387
- a: { ...s },
1388
- b: { ...a },
1389
- host: t
1390
- }
1391
- })), u()));
1392
- }, d = (f) => {
1393
- if (!i) return;
1394
- a = o(f), u();
1395
- const y = se(s, a);
1396
- t.dispatchEvent(new CustomEvent(U.move, {
1397
- bubbles: !0,
1398
- detail: {
1399
- a: { ...s },
1400
- b: { ...a },
1401
- box: y,
1402
- host: t
1403
- }
1404
- }));
1405
- }, h = (f) => {
1406
- if (!i) return;
1407
- i = !1;
1408
- try {
1409
- t.releasePointerCapture(f.pointerId);
1410
- } catch {
1411
- }
1412
- const y = se(s, a);
1413
- t.dispatchEvent(new CustomEvent(U.end, {
1414
- bubbles: !0,
1415
- detail: {
1416
- a: { ...s },
1417
- b: { ...a },
1418
- box: y,
1419
- host: t
1420
- }
1421
- }));
1422
- }, c = (f) => {
1423
- i && h(f);
1424
- }, l = (f) => {
1425
- if (i) {
1426
- i = !1, n.style.display = "none";
1427
- try {
1428
- t.releasePointerCapture(f.pointerId);
1429
- } catch {
1430
- }
1431
- t.dispatchEvent(new CustomEvent(U.cancel, {
1432
- bubbles: !0,
1433
- detail: { host: t }
1434
- }));
1435
- }
1436
- };
1437
- return g(t, "ui-junction-select", () => {
1438
- n.remove();
1439
- }), g(t, "ui-junction-select", m(t, "pointerdown", p)), g(t, "ui-junction-select", m(t, "pointermove", d)), g(t, "ui-junction-select", m(t, "pointerup", c)), g(t, "ui-junction-select", m(t, "pointercancel", l)), this;
1440
- }
1441
- disconnect(e) {
1442
- const t = e?.deref?.();
1443
- return t && xe(t, "ui-junction-select"), this;
1444
- }
1445
- }, hn = class extends we {
1446
- constructor() {
1447
- super("ui-junction-drag");
1448
- }
1449
- connect(e) {
1450
- const t = e?.deref?.();
1451
- if (!t) return this;
1452
- S(t, "--jx-drag-x", E(t, "--jx-drag-x")), S(t, "--jx-drag-y", E(t, "--jx-drag-y"));
1453
- const n = t.style.transform;
1454
- (!t.style.transform || t.style.transform === "none") && (t.style.transform = "translate3d(calc(var(--jx-drag-x, 0) * 1px), calc(var(--jx-drag-y, 0) * 1px), 0)");
1455
- const r = Ye(t, "data-junction-drag-handle", t);
1456
- let i = !1, s = 0, a = 0, o = 0, u = 0;
1457
- const p = (c) => {
1458
- c.button === 0 && (c.target !== r && !r.contains(c.target) || (i = !0, s = c.clientX, a = c.clientY, o = E(t, "--jx-drag-x"), u = E(t, "--jx-drag-y"), r.setPointerCapture(c.pointerId), t.dispatchEvent(new CustomEvent(ue.start, {
1459
- bubbles: !0,
1460
- detail: {
1461
- host: t,
1462
- clientX: c.clientX,
1463
- clientY: c.clientY,
1464
- baseX: o,
1465
- baseY: u
1466
- }
1467
- }))));
1468
- }, d = (c) => {
1469
- if (!i) return;
1470
- const l = c.clientX - s, f = c.clientY - a, y = o + l, _ = u + f;
1471
- S(t, "--jx-drag-x", y), S(t, "--jx-drag-y", _), t.dispatchEvent(new CustomEvent(ue.move, {
1472
- bubbles: !0,
1473
- detail: {
1474
- host: t,
1475
- dx: l,
1476
- dy: f,
1477
- x: y,
1478
- y: _
1479
- }
1480
- }));
1481
- }, h = (c) => {
1482
- if (i) {
1483
- i = !1;
1484
- try {
1485
- r.releasePointerCapture(c.pointerId);
1486
- } catch {
1487
- }
1488
- t.dispatchEvent(new CustomEvent(ue.end, {
1489
- bubbles: !0,
1490
- detail: {
1491
- host: t,
1492
- x: E(t, "--jx-drag-x"),
1493
- y: E(t, "--jx-drag-y")
1494
- }
1495
- }));
1496
- }
1497
- };
1498
- return g(t, "ui-junction-drag", () => {
1499
- t.style.transform = n;
1500
- }), g(t, "ui-junction-drag", m(r, "pointerdown", p)), g(t, "ui-junction-drag", m(r, "pointermove", d)), g(t, "ui-junction-drag", m(r, "pointerup", h)), g(t, "ui-junction-drag", m(r, "pointercancel", h)), this;
1501
- }
1502
- disconnect(e) {
1503
- const t = e?.deref?.();
1504
- return t && xe(t, "ui-junction-drag"), this;
1505
- }
1506
- }, mn = class extends we {
1507
- constructor() {
1508
- super("ui-junction-resize");
1509
- }
1510
- connect(e) {
1511
- const t = e?.deref?.();
1512
- if (!t) return this;
1513
- const n = Ye(t, "data-junction-resize-handle", t);
1514
- let r = !1, i = 0, s = 0, a = 0, o = 0;
1515
- const u = Math.max(120, parseFloat(t.getAttribute("data-junction-resize-min-w") || "") || 120), p = Math.max(80, parseFloat(t.getAttribute("data-junction-resize-min-h") || "") || 80), d = (l) => {
1516
- l.button === 0 && (l.target !== n && !n.contains(l.target) || (r = !0, i = l.clientX, s = l.clientY, a = t.offsetWidth, o = t.offsetHeight, n.setPointerCapture(l.pointerId), t.dispatchEvent(new CustomEvent(ce.start, {
1517
- bubbles: !0,
1518
- detail: {
1519
- host: t,
1520
- width: a,
1521
- height: o
1522
- }
1523
- }))));
1524
- }, h = (l) => {
1525
- if (!r) return;
1526
- const f = Math.max(u, a + (l.clientX - i)), y = Math.max(p, o + (l.clientY - s));
1527
- t.style.width = `${f}px`, t.style.height = `${y}px`, t.dispatchEvent(new CustomEvent(ce.move, {
1528
- bubbles: !0,
1529
- detail: {
1530
- host: t,
1531
- width: f,
1532
- height: y
1533
- }
1534
- }));
1535
- }, c = (l) => {
1536
- if (r) {
1537
- r = !1;
1538
- try {
1539
- n.releasePointerCapture(l.pointerId);
1540
- } catch {
1541
- }
1542
- t.dispatchEvent(new CustomEvent(ce.end, {
1543
- bubbles: !0,
1544
- detail: {
1545
- host: t,
1546
- width: t.offsetWidth,
1547
- height: t.offsetHeight
1548
- }
1549
- }));
1550
- }
1551
- };
1552
- return g(t, "ui-junction-resize", m(n, "pointerdown", d)), g(t, "ui-junction-resize", m(n, "pointermove", h)), g(t, "ui-junction-resize", m(n, "pointerup", c)), g(t, "ui-junction-resize", m(n, "pointercancel", c)), this;
1553
- }
1554
- disconnect(e) {
1555
- const t = e?.deref?.();
1556
- return t && xe(t, "ui-junction-resize"), this;
1557
- }
1558
- };
1559
- new pn();
1560
- new hn();
1561
- new mn();
1562
- export {
1563
- we as DOMMixin,
1564
- hn as JunctionDragMixin,
1565
- mn as JunctionResizeMixin,
1566
- pn as JunctionSelectMixin,
1567
- kn as MATCH,
1568
- Bn as MOC,
1569
- fe as MOCElement,
1570
- Sn as RAFBehavior,
1571
- Vn as REGEX,
1572
- wn as ROOT,
1573
- ar as WavyShapedCircle,
1574
- yn as __exportProperties,
1575
- Me as __registeredCssProperties,
1576
- m as addEvent,
1577
- K as addEvents,
1578
- Wn as addEventsList,
1579
- an as addRoot,
1580
- O as adoptedBlobMap,
1581
- Oe as adoptedLayerMap,
1582
- v as adoptedMap,
1583
- Ve as adoptedSelectorMap,
1584
- D as adoptedShadowLayerMap,
1585
- je as adoptedShadowSelectorMap,
1586
- Mt as animateHide,
1587
- xt as animateShow,
1588
- he as availSize,
1589
- Xn as bbh,
1590
- Un as bbw,
1591
- Gt as bindBehavior,
1592
- en as bindMixins,
1593
- Qt as bindStore,
1594
- k as blobURLMap,
1595
- Y as borderBoxHeight,
1596
- X as borderBoxWidth,
1597
- Ue as boundBehaviors,
1598
- w as boundMixinSet,
1599
- x as cacheMap,
1600
- Gn as cbh,
1601
- Yn as cbw,
1602
- _n as changeZoom,
1603
- Jn as classes,
1604
- St as computeCaretPosition,
1605
- er as computeCaretPositionFromClient,
1606
- $n as containsOrSelf,
1607
- J as contentBoxHeight,
1608
- G as contentBoxWidth,
1609
- jn as createElementVanilla,
1610
- dn as deleteStyleProperty,
1611
- gn as detectMobile,
1612
- Cn as doBorderObserve,
1613
- An as doContentObserve,
1614
- Wt as fetchAndCache,
1615
- Ft as fetchAsInline,
1616
- Kn as fixOrientToScreen,
1617
- Zn as fixedClientZoom,
1618
- ur as getAdoptedStyleRule,
1619
- Be as getAvailSize,
1620
- Dn as getBoundingOrientRect,
1621
- gt as getCorrectOrientation,
1622
- F as getElementRelated,
1623
- yr as getElementZoom,
1624
- In as getEventTarget,
1625
- ut as getOffsetParent,
1626
- vn as getOffsetParentChain,
1627
- vr as getPadding,
1628
- N as getPropertyValue,
1629
- gr as getPxValue,
1630
- Kt as getStoresOfElement,
1631
- Rt as getStyleLayer,
1632
- Se as getStyleRule,
1633
- hr as getTransform,
1634
- mr as getTransformOrigin,
1635
- qn as getZoom,
1636
- Cr as handleAttribute,
1637
- Er as handleDataset,
1638
- xr as handleHidden,
1639
- Mr as handleProperty,
1640
- Ar as handleStyleChange,
1641
- re as hasParent,
1642
- lr as hash,
1643
- Pn as html,
1644
- Nn as includeSelf,
1645
- Ln as indexOf,
1646
- He as initTextStyle,
1647
- or as initVisibility,
1648
- On as isElement,
1649
- Hn as isInFocus,
1650
- Ke as isMobile,
1651
- bn as isNearlyIdentity,
1652
- Tn as isValidParent,
1653
- pr as layerCounter,
1654
- Xt as loadAsAdopted,
1655
- _t as loadBlobStyle,
1656
- j as loadInlineStyle,
1657
- De as loadStyleSheet,
1658
- ct as makeRAFCycle,
1659
- Qn as measureInputInFocus,
1660
- bt as measureText,
1661
- ee as mixinDisposers,
1662
- C as mixinElements,
1663
- Q as mixinNamespace,
1664
- $ as mixinRegistry,
1665
- cn as nameRegistryF,
1666
- I as namedStoreMaps,
1667
- ir as observeAttribute,
1668
- ve as observeAttributeBySelector,
1669
- rr as observeBorderBox,
1670
- Ct as observeBySelector,
1671
- nr as observeContentBox,
1672
- Ce as onBorderObserve,
1673
- Re as onContentObserve,
1674
- z as orientOf,
1675
- mt as orientationNumberMap,
1676
- We as parseLength,
1677
- Yt as parseOrigin,
1678
- $e as passiveOpts,
1679
- fr as preloadStyle,
1680
- wt as readLauncherLayoutFromElement,
1681
- br as reflectBehaviors,
1682
- wr as reflectMixins,
1683
- Sr as reflectStores,
1684
- ln as registerMixin,
1685
- ae as removeAdopted,
1686
- Pe as removeEvent,
1687
- Fn as removeEvents,
1688
- tr as resolveGridCellFromClientPoint,
1689
- me as roots,
1690
- Mn as setAttributes,
1691
- xn as setAttributesIfNull,
1692
- zn as setChecked,
1693
- En as setIdleInterval,
1694
- dr as setProperty,
1695
- cr as setStyleInRule,
1696
- S as setStyleProperty,
1697
- _e as setStylePropertyFallback,
1698
- jt as setStylePropertyTyped,
1699
- qt as setStyleRule,
1700
- sr as setStyleRules,
1701
- Te as setStyleURL,
1702
- lt as throttleMap,
1703
- pe as unfixedClientZoom,
1704
- ye as updateAllMixins,
1705
- Xe as updateMixinAttributes,
1706
- sn as updateMixinAttributesAll,
1707
- un as updateMixinAttributesAllInRoots,
1708
- yt as updateVP,
1709
- Rn as url,
1710
- vt as whenAnyScreenChanges,
1711
- pt as zoomOf,
1712
- ft as zoomValues
1713
- };