@tempots/ui 0.3.1 → 0.5.0

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.
package/index.js DELETED
@@ -1,1440 +0,0 @@
1
- var ge = Object.defineProperty, ye = (t, e, n) => e in t ? ge(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, d = (t, e, n) => ye(t, typeof e != "symbol" ? e + "" : e, n);
2
- const Wt = Symbol("isSignal"), Et = Symbol("isProp"), Lt = Symbol("isComputed");
3
- var $t;
4
- $t = Wt;
5
- const we = class k {
6
- constructor(e, n) {
7
- d(this, $t, !0), d(this, "_value"), d(this, "_derivatives", []), d(this, "_onValueListeners", []), d(this, "_onDisposeListeners", []), d(this, "get", () => this._value), d(this, "hasListeners", () => this._onValueListeners.length > 0), d(this, "on", (i) => (i(this.get()), this._onValueListeners.push(i), () => {
8
- this._onValueListeners.splice(this._onValueListeners.indexOf(i), 1);
9
- })), d(this, "_setAndNotify", (i, o) => {
10
- const s = this.equals(this._value, i);
11
- s || (this._value = i), (o || !s) && this._onValueListeners.forEach((r) => r(i));
12
- }), d(this, "_disposed", !1), d(this, "isDisposed", () => this._disposed), d(this, "onDispose", (i) => {
13
- this._onDisposeListeners.push(i);
14
- }), d(this, "dispose", () => {
15
- this._disposed || (this._disposed = !0, this._onDisposeListeners.forEach((i) => i()), this._onDisposeListeners.length = 0, this._derivatives.length = 0);
16
- }), d(this, "map", (i, o = (s, r) => s === r) => {
17
- const s = new Q(() => {
18
- try {
19
- return i(this.get());
20
- } catch (r) {
21
- throw console.error("Error in Signal.map:", r), r;
22
- }
23
- }, o);
24
- return this.setDerivative(s), s;
25
- }), d(this, "flatMap", (i, o = (s, r) => s === r) => {
26
- const s = new Q(() => {
27
- try {
28
- return i(this.get()).get();
29
- } catch (r) {
30
- throw console.error("Error in Signal.flatMap:", r), r;
31
- }
32
- }, o);
33
- return this.setDerivative(s), s;
34
- }), d(this, "tap", (i) => this.map((o) => (i(o), o))), d(this, "at", (i) => this.map((o) => o[i])), d(this, "filter", (i, o) => {
35
- let s = o ?? this.get();
36
- const r = new Q(() => {
37
- try {
38
- const c = this.get();
39
- return s = i(c) ? c : s;
40
- } catch (c) {
41
- throw console.error("Error in Signal.filter:", c), c;
42
- }
43
- }, this.equals);
44
- return this.setDerivative(r), r;
45
- }), d(this, "filterMap", (i, o, s = (r, c) => r === c) => {
46
- let r = o;
47
- const c = new Q(() => {
48
- try {
49
- const l = this.get();
50
- return r = i(l) ?? r;
51
- } catch (l) {
52
- throw console.error("Error in Signal.filterMap:", l), l;
53
- }
54
- }, s);
55
- return this.setDerivative(c), c;
56
- }), d(this, "mapAsync", (i, o, s, r = (c, l) => c === l) => {
57
- const c = Pt(o, r);
58
- let l = 0;
59
- return c.onDispose(
60
- this.on((a) => {
61
- const f = ++l;
62
- try {
63
- i(a).then((u) => {
64
- f === l && c.set(u);
65
- }).catch((u) => {
66
- f === l && (s != null ? c.set(s(u)) : console.error(
67
- "Unhandled promise rejection in Signal.mapAsync:",
68
- u
69
- ));
70
- });
71
- } catch (u) {
72
- throw console.error("Error in Signal.mapAsync:", u), u;
73
- }
74
- })
75
- ), c;
76
- }), d(this, "mapMaybe", (i, o) => this.map((s) => i(s) ?? o)), d(this, "feedProp", (i, o = !1) => {
77
- const s = this.on(i.set);
78
- return i.onDispose(s), o ? this.onDispose(i.dispose) : this.onDispose(s), i;
79
- }), d(this, "deriveProp", (i = !0) => this.feedProp(Pt(this.get()), i)), d(this, "count", () => {
80
- let i = 0;
81
- return this.map(() => ++i);
82
- }), d(this, "setDerivative", (i) => {
83
- this._derivatives.push(i), i.onDispose(() => {
84
- this._derivatives.splice(
85
- this._derivatives.indexOf(i),
86
- 1
87
- );
88
- }), i.onDispose(this.on(i.setDirty)), this.onDispose(i.dispose);
89
- }), this.equals = n, this._value = e;
90
- }
91
- static ofPromise(e, n, i, o = (s, r) => s === r) {
92
- const s = new k(n, o);
93
- return e.then((r) => s._setAndNotify(r, !1)).catch((r) => {
94
- i != null ? s._setAndNotify(i(r), !1) : console.error(
95
- "Unhandled promise rejection in Signal.ofPromise:",
96
- r
97
- );
98
- }), s;
99
- }
100
- static is(e) {
101
- return e != null && e[Wt] === !0;
102
- }
103
- static wrap(e, n = (i, o) => i === o) {
104
- return k.is(e) ? e : new k(e, n);
105
- }
106
- static maybeWrap(e) {
107
- return e == null ? e : k.wrap(e);
108
- }
109
- static unwrap(e) {
110
- return k.is(e) ? e.get() : e;
111
- }
112
- static map(e, n) {
113
- return k.is(e) ? e.map(n) : n(e);
114
- }
115
- get value() {
116
- return this._value;
117
- }
118
- };
119
- let E = we;
120
- const ve = typeof queueMicrotask == "function" ? queueMicrotask : (t) => Promise.resolve().then(t);
121
- var Rt, Dt;
122
- class Q extends (Dt = E, Rt = Lt, Dt) {
123
- constructor(e, n) {
124
- super(void 0, n), d(this, Rt, !0), d(this, "_isDirty", !1), d(this, "setDirty", () => {
125
- this._isDirty || this._disposed || (this._isDirty = !0, this._derivatives.forEach((i) => i.setDirty()), this.scheduleNotify());
126
- }), d(this, "_scheduleCount", 0), d(this, "scheduleNotify", () => {
127
- const i = ++this._scheduleCount;
128
- ve(() => {
129
- this._scheduleCount !== i || this._disposed !== !1 || this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn(), !1));
130
- });
131
- }), d(this, "get", () => (this._isDirty && (this._isDirty = !1, this._value = this._fn(), this._setAndNotify(this._value, !0)), this._value)), this._fn = e, this.setDirty();
132
- }
133
- static is(e) {
134
- return e != null && e[Lt] === !0;
135
- }
136
- get value() {
137
- return this.get();
138
- }
139
- }
140
- var Ct, Ot;
141
- class yt extends (Ot = E, Ct = Et, Ot) {
142
- constructor() {
143
- super(...arguments), d(this, Ct, !0), d(this, "set", (e) => {
144
- this._setAndNotify(e, !1);
145
- }), d(this, "update", (e) => {
146
- this._setAndNotify(e(this.get()), !1);
147
- }), d(this, "reducer", (e) => (n) => this.update((i) => e(i, n))), d(this, "iso", (e, n, i = (o, s) => o === s) => {
148
- const o = new yt(e(this.get()), i);
149
- return o.onDispose(this.on((s) => o.set(e(s)))), o.on((s) => this._setAndNotify(n(s), !1)), o;
150
- }), d(this, "atProp", (e) => this.iso(
151
- (n) => n[e],
152
- (n) => ({ ...this.value, [e]: n })
153
- ));
154
- }
155
- static is(e) {
156
- return e != null && e[Et] === !0;
157
- }
158
- get value() {
159
- return this.get();
160
- }
161
- set value(e) {
162
- this._setAndNotify(e, !1);
163
- }
164
- }
165
- function Pt(t, e = (n, i) => n === i) {
166
- return new yt(t, e);
167
- }
168
- const Ht = /* @__PURE__ */ new Set(["checked", "disabled", "hidden", "selected"]), It = /* @__PURE__ */ new Set([
169
- "rowSpan",
170
- "colSpan",
171
- "tabIndex",
172
- "valueAsNumber"
173
- ]), zt = /* @__PURE__ */ new Set(["valueAsDate"]), jt = /* @__PURE__ */ new Set([
174
- "value",
175
- "textContent",
176
- "innerText",
177
- "innerHTML",
178
- "outerHTML",
179
- "className",
180
- "classList"
181
- ]), dt = /* @__PURE__ */ new Map();
182
- function Y(t, e) {
183
- if (dt.has(t))
184
- return dt.get(t);
185
- {
186
- const n = e(t);
187
- return dt.set(t, n), n;
188
- }
189
- }
190
- function xe(t) {
191
- return (e, n) => {
192
- n == null ? e[t] = null : e[t] = !!n;
193
- };
194
- }
195
- function be(t) {
196
- return (e, n) => {
197
- n == null ? e[t] = null : e[t] = Number(n);
198
- };
199
- }
200
- function Ae(t) {
201
- return (e, n) => {
202
- n == null ? e[t] = null : e[t] = n;
203
- };
204
- }
205
- function Se(t) {
206
- return (e, n) => {
207
- n == null ? e[t] = null : e[t] = String(n);
208
- };
209
- }
210
- function _e(t) {
211
- return (e, n) => {
212
- n == null ? e.removeAttribute(t) : e.setAttribute(t, n);
213
- };
214
- }
215
- function qt(t) {
216
- return Ht.has(t) ? Y(t, xe) : It.has(t) ? Y(t, be) : zt.has(t) ? Y(t, Ae) : jt.has(t) ? Y(t, Se) : Y(t, _e);
217
- }
218
- function Xt(t) {
219
- return (e) => Ht.has(t) ? !!e[t] : It.has(t) ? Number(e[t]) : zt.has(t) ? e[t] : jt.has(t) ? String(e[t]) : e.getAttribute(t);
220
- }
221
- function J(t) {
222
- const e = t;
223
- e && e.onblur && (e.onblur = null), !(!t || t.ownerDocument === void 0) && t.parentElement && t.parentElement.removeChild(t);
224
- }
225
- const Ee = (t) => (e) => {
226
- Gt(e);
227
- const n = e.createText(t);
228
- return e.appendOrInsert(n), (i) => {
229
- i && J(n);
230
- };
231
- }, Le = (t) => (e) => {
232
- Gt(e);
233
- const n = e.createText(t.value);
234
- e.appendOrInsert(n);
235
- const i = t.on((o) => n.data = o);
236
- return (o) => {
237
- i(), o && J(n);
238
- };
239
- }, Re = (...t) => (e) => {
240
- const n = t.map((i) => D(i)(e));
241
- return (i) => {
242
- n.forEach((o) => o(i));
243
- };
244
- }, De = () => () => {
245
- }, Ce = (t) => (e) => (Kt(e), e.element.classList.add(...t), (n) => {
246
- n && e.element.classList.remove(...t);
247
- }), Oe = (t) => (e) => {
248
- Kt(e);
249
- const n = e.element;
250
- let i = [];
251
- const o = t.on((s) => {
252
- i.forEach((r) => n.classList.remove(r)), i = (s ?? "").split(" ").filter((r) => r.length > 0), n.classList.add(...i);
253
- });
254
- return (s) => {
255
- o(), s && i.forEach((r) => n.classList.remove(r)), i.length = 0;
256
- };
257
- }, rt = (t, e) => {
258
- const n = qt(t), i = Xt(t);
259
- return (o) => {
260
- Jt(o, t);
261
- const s = i(o.element);
262
- return n(o.element, e), (r) => {
263
- r && n(o.element, s);
264
- };
265
- };
266
- }, ct = (t, e) => {
267
- const n = qt(t), i = Xt(t);
268
- return (o) => {
269
- Jt(o, t);
270
- const s = i(o.element);
271
- return e.on((r) => n(o.element, r)), (r) => {
272
- r && n(o.element, s);
273
- };
274
- };
275
- }, Pe = new Proxy(
276
- {},
277
- {
278
- get: (t, e) => e === "class" ? (n) => E.is(n) ? Oe(n) : Ce(
279
- (n ?? "").split(" ").filter((i) => i.length > 0)
280
- ) : (n) => E.is(n) ? ct(
281
- e,
282
- n
283
- ) : rt(
284
- e,
285
- n
286
- )
287
- }
288
- );
289
- new Proxy(
290
- {},
291
- {
292
- get: (t, e) => (n) => E.is(n) ? ct(
293
- `aria-${e}`,
294
- n
295
- ) : rt(
296
- `aria-${e}`,
297
- n
298
- )
299
- }
300
- );
301
- new Proxy(
302
- {},
303
- {
304
- get: (t, e) => (n) => E.is(n) ? ct(
305
- e,
306
- n
307
- ) : rt(
308
- e,
309
- n
310
- )
311
- }
312
- );
313
- new Proxy(
314
- {},
315
- {
316
- get: (t, e) => (n) => E.is(n) ? ct(
317
- e,
318
- n
319
- ) : rt(
320
- e,
321
- n
322
- )
323
- }
324
- );
325
- function D(t) {
326
- return t == null ? De : Array.isArray(t) ? Re(...t.map(D)) : typeof t == "string" ? Ee(t) : E.is(t) ? Le(t) : t;
327
- }
328
- function Yt(t, ...e) {
329
- return (n) => {
330
- const i = n.createElement(t, void 0);
331
- n.isFirstLevel && K.isSSR() && Zt(i), n.appendOrInsert(i), n = n.withElement(i);
332
- const o = e.map((s) => D(s)(n));
333
- return (s) => {
334
- o.forEach((r) => r(!1)), s && J(i);
335
- };
336
- };
337
- }
338
- function Ut(t, e, ...n) {
339
- return (i) => {
340
- const o = i.createElement(t, e);
341
- i.isFirstLevel && K.isSSR() && Zt(o), i.appendOrInsert(o), i = i.withElement(o);
342
- const s = n.map((r) => D(r)(i));
343
- return (r) => {
344
- s.forEach((c) => c(!1)), r && J(o);
345
- };
346
- };
347
- }
348
- const Te = new Proxy(
349
- {},
350
- {
351
- get: (t, e) => (...n) => Yt(e, n.flatMap(D))
352
- }
353
- );
354
- new Proxy(
355
- {},
356
- {
357
- get: (t, e) => (...n) => Yt("input", Pe.type(e), ...n)
358
- }
359
- );
360
- const Ne = "http://www.w3.org/2000/svg";
361
- new Proxy(
362
- {},
363
- {
364
- get: (t, e) => (...n) => Ut(e, Ne, n.flatMap(D))
365
- }
366
- );
367
- const Me = "http://www.w3.org/1998/Math/MathML";
368
- new Proxy(
369
- {},
370
- {
371
- get: (t, e) => (...n) => Ut(e, Me, n.flatMap(D))
372
- }
373
- );
374
- const Tt = "data-tempo-attr", ke = "data-tempo-class", Fe = "data-tempo-node", Ve = "data-tempo-text";
375
- function Be(t, e) {
376
- const n = t.getAttribute(e);
377
- if (n != null) {
378
- const i = t.getAttribute(Tt) ?? "{}", o = { ...JSON.parse(i), name: n };
379
- t.setAttribute(Tt, JSON.stringify(o));
380
- }
381
- }
382
- function Jt(t, e) {
383
- K.isSSR() && t.isFirstLevel && Be(t.element, e);
384
- }
385
- function We(t) {
386
- t.setAttribute(ke, t.className);
387
- }
388
- function Kt(t) {
389
- K.isSSR() && t.isFirstLevel && We(t.element);
390
- }
391
- function Zt(t) {
392
- t.setAttribute(Fe, "");
393
- }
394
- function $e(t) {
395
- t.setAttribute(Ve, t.textContent ?? "");
396
- }
397
- function Gt(t) {
398
- K.isSSR() && t.isFirstLevel && $e(t.element);
399
- }
400
- function Qt() {
401
- const t = globalThis;
402
- return t.__tempoSSR__ == null && (t.__tempoSSR__ = {
403
- isSSR: !1,
404
- counter: 0
405
- }), t.__tempoSSR__;
406
- }
407
- function te(t, e) {
408
- const n = Qt();
409
- n[t] = e;
410
- }
411
- function ee(t) {
412
- return Qt()[t];
413
- }
414
- function He() {
415
- return ee("isSSR");
416
- }
417
- function ne() {
418
- return ee("counter");
419
- }
420
- function Ie() {
421
- te("counter", (ne() ?? 0) + 1);
422
- }
423
- function ze() {
424
- te("counter", (ne() ?? 0) - 1);
425
- }
426
- const K = {
427
- useDone: (t) => (Ie(), D(t(ze))),
428
- isSSR: He
429
- }, je = (t, e) => (n) => (n.element.addEventListener(t, e), (i) => {
430
- i && n.element.removeEventListener(t, e);
431
- });
432
- new Proxy(
433
- {},
434
- {
435
- get: (t, e) => (n) => je(e, n)
436
- }
437
- );
438
- const tt = (t, e) => (n) => {
439
- n = n.makeRef();
440
- let i, o;
441
- const s = t.map((l) => Object.keys(l)[0]);
442
- let r;
443
- const c = s.on((l) => {
444
- if (l !== r) {
445
- o == null || o.dispose(), i == null || i(!0), o = t.map((f) => f[l]);
446
- const a = e[l](o);
447
- i = D(a)(n), r = l;
448
- }
449
- });
450
- return (l) => {
451
- c(), l && n.reference != null && J(n.reference), i == null || i(!0);
452
- };
453
- }, mt = {
454
- bool: (t, e) => tt(
455
- t.map((n) => n ? { true: !0 } : { false: !0 }),
456
- e
457
- ),
458
- field: (t, e, n) => tt(
459
- t.map((i) => ({ [i[e]]: i })),
460
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
461
- n
462
- ),
463
- kind: (t, e) => mt.field(t, "kind", e),
464
- tuple: (t, e) => {
465
- const n = t.map(([i, o]) => ({ [i]: o }));
466
- return tt(n, e);
467
- },
468
- type: (t, e) => mt.field(t, "type", e),
469
- value: (t, e) => tt(
470
- t.map((n) => ({ [n]: !0 })),
471
- e
472
- )
473
- };
474
- function qe(t, e) {
475
- const n = t(e);
476
- return () => n(!0);
477
- }
478
- const Xe = (t, e) => (n) => {
479
- const i = n.document.querySelector(t);
480
- if (i === null)
481
- throw new Error(`Cannot find element by selector for portal: ${t}`);
482
- return qe(
483
- D(e),
484
- n.withElement(i).withFirstLevel()
485
- );
486
- }, Ye = (t) => (e) => t(e.element) ?? (() => {
487
- }), Ue = (t, e) => (n) => {
488
- const i = n.element, o = i.style.getPropertyValue(t);
489
- return i.style.setProperty(t, e), (s) => {
490
- s && i.style.setProperty(t, o);
491
- };
492
- }, Je = (t, e) => (n) => {
493
- const i = n.element, o = i.style.getPropertyValue(t);
494
- return e.on((s) => i.style.setProperty(t, s)), (s) => {
495
- s && i.style.setProperty(t, o);
496
- };
497
- };
498
- new Proxy(
499
- {},
500
- {
501
- get: (t, e) => (n) => E.is(n) ? Je(e, n) : Ue(e, n)
502
- }
503
- );
504
- const nt = Math.min, F = Math.max, it = Math.round, et = Math.floor, T = (t) => ({
505
- x: t,
506
- y: t
507
- }), Ke = {
508
- left: "right",
509
- right: "left",
510
- bottom: "top",
511
- top: "bottom"
512
- }, Ze = {
513
- start: "end",
514
- end: "start"
515
- };
516
- function Nt(t, e, n) {
517
- return F(t, nt(e, n));
518
- }
519
- function lt(t, e) {
520
- return typeof t == "function" ? t(e) : t;
521
- }
522
- function V(t) {
523
- return t.split("-")[0];
524
- }
525
- function at(t) {
526
- return t.split("-")[1];
527
- }
528
- function ie(t) {
529
- return t === "x" ? "y" : "x";
530
- }
531
- function oe(t) {
532
- return t === "y" ? "height" : "width";
533
- }
534
- function I(t) {
535
- return ["top", "bottom"].includes(V(t)) ? "y" : "x";
536
- }
537
- function se(t) {
538
- return ie(I(t));
539
- }
540
- function Ge(t, e, n) {
541
- n === void 0 && (n = !1);
542
- const i = at(t), o = se(t), s = oe(o);
543
- let r = o === "x" ? i === (n ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
544
- return e.reference[s] > e.floating[s] && (r = ot(r)), [r, ot(r)];
545
- }
546
- function Qe(t) {
547
- const e = ot(t);
548
- return [gt(t), e, gt(e)];
549
- }
550
- function gt(t) {
551
- return t.replace(/start|end/g, (e) => Ze[e]);
552
- }
553
- function tn(t, e, n) {
554
- const i = ["left", "right"], o = ["right", "left"], s = ["top", "bottom"], r = ["bottom", "top"];
555
- switch (t) {
556
- case "top":
557
- case "bottom":
558
- return n ? e ? o : i : e ? i : o;
559
- case "left":
560
- case "right":
561
- return e ? s : r;
562
- default:
563
- return [];
564
- }
565
- }
566
- function en(t, e, n, i) {
567
- const o = at(t);
568
- let s = tn(V(t), n === "start", i);
569
- return o && (s = s.map((r) => r + "-" + o), e && (s = s.concat(s.map(gt)))), s;
570
- }
571
- function ot(t) {
572
- return t.replace(/left|right|bottom|top/g, (e) => Ke[e]);
573
- }
574
- function nn(t) {
575
- return {
576
- top: 0,
577
- right: 0,
578
- bottom: 0,
579
- left: 0,
580
- ...t
581
- };
582
- }
583
- function on(t) {
584
- return typeof t != "number" ? nn(t) : {
585
- top: t,
586
- right: t,
587
- bottom: t,
588
- left: t
589
- };
590
- }
591
- function st(t) {
592
- const {
593
- x: e,
594
- y: n,
595
- width: i,
596
- height: o
597
- } = t;
598
- return {
599
- width: i,
600
- height: o,
601
- top: n,
602
- left: e,
603
- right: e + i,
604
- bottom: n + o,
605
- x: e,
606
- y: n
607
- };
608
- }
609
- function Mt(t, e, n) {
610
- let {
611
- reference: i,
612
- floating: o
613
- } = t;
614
- const s = I(e), r = se(e), c = oe(r), l = V(e), a = s === "y", f = i.x + i.width / 2 - o.width / 2, u = i.y + i.height / 2 - o.height / 2, m = i[c] / 2 - o[c] / 2;
615
- let h;
616
- switch (l) {
617
- case "top":
618
- h = {
619
- x: f,
620
- y: i.y - o.height
621
- };
622
- break;
623
- case "bottom":
624
- h = {
625
- x: f,
626
- y: i.y + i.height
627
- };
628
- break;
629
- case "right":
630
- h = {
631
- x: i.x + i.width,
632
- y: u
633
- };
634
- break;
635
- case "left":
636
- h = {
637
- x: i.x - o.width,
638
- y: u
639
- };
640
- break;
641
- default:
642
- h = {
643
- x: i.x,
644
- y: i.y
645
- };
646
- }
647
- switch (at(e)) {
648
- case "start":
649
- h[r] -= m * (n && a ? -1 : 1);
650
- break;
651
- case "end":
652
- h[r] += m * (n && a ? -1 : 1);
653
- break;
654
- }
655
- return h;
656
- }
657
- const sn = async (t, e, n) => {
658
- const {
659
- placement: i = "bottom",
660
- strategy: o = "absolute",
661
- middleware: s = [],
662
- platform: r
663
- } = n, c = s.filter(Boolean), l = await (r.isRTL == null ? void 0 : r.isRTL(e));
664
- let a = await r.getElementRects({
665
- reference: t,
666
- floating: e,
667
- strategy: o
668
- }), {
669
- x: f,
670
- y: u
671
- } = Mt(a, i, l), m = i, h = {}, g = 0;
672
- for (let y = 0; y < c.length; y++) {
673
- const {
674
- name: w,
675
- fn: p
676
- } = c[y], {
677
- x: v,
678
- y: x,
679
- data: A,
680
- reset: b
681
- } = await p({
682
- x: f,
683
- y: u,
684
- initialPlacement: i,
685
- placement: m,
686
- strategy: o,
687
- middlewareData: h,
688
- rects: a,
689
- platform: r,
690
- elements: {
691
- reference: t,
692
- floating: e
693
- }
694
- });
695
- f = v ?? f, u = x ?? u, h = {
696
- ...h,
697
- [w]: {
698
- ...h[w],
699
- ...A
700
- }
701
- }, b && g <= 50 && (g++, typeof b == "object" && (b.placement && (m = b.placement), b.rects && (a = b.rects === !0 ? await r.getElementRects({
702
- reference: t,
703
- floating: e,
704
- strategy: o
705
- }) : b.rects), {
706
- x: f,
707
- y: u
708
- } = Mt(a, m, l)), y = -1);
709
- }
710
- return {
711
- x: f,
712
- y: u,
713
- placement: m,
714
- strategy: o,
715
- middlewareData: h
716
- };
717
- };
718
- async function re(t, e) {
719
- var n;
720
- e === void 0 && (e = {});
721
- const {
722
- x: i,
723
- y: o,
724
- platform: s,
725
- rects: r,
726
- elements: c,
727
- strategy: l
728
- } = t, {
729
- boundary: a = "clippingAncestors",
730
- rootBoundary: f = "viewport",
731
- elementContext: u = "floating",
732
- altBoundary: m = !1,
733
- padding: h = 0
734
- } = lt(e, t), g = on(h), w = c[m ? u === "floating" ? "reference" : "floating" : u], p = st(await s.getClippingRect({
735
- element: (n = await (s.isElement == null ? void 0 : s.isElement(w))) == null || n ? w : w.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(c.floating)),
736
- boundary: a,
737
- rootBoundary: f,
738
- strategy: l
739
- })), v = u === "floating" ? {
740
- x: i,
741
- y: o,
742
- width: r.floating.width,
743
- height: r.floating.height
744
- } : r.reference, x = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(c.floating)), A = await (s.isElement == null ? void 0 : s.isElement(x)) ? await (s.getScale == null ? void 0 : s.getScale(x)) || {
745
- x: 1,
746
- y: 1
747
- } : {
748
- x: 1,
749
- y: 1
750
- }, b = st(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
751
- elements: c,
752
- rect: v,
753
- offsetParent: x,
754
- strategy: l
755
- }) : v);
756
- return {
757
- top: (p.top - b.top + g.top) / A.y,
758
- bottom: (b.bottom - p.bottom + g.bottom) / A.y,
759
- left: (p.left - b.left + g.left) / A.x,
760
- right: (b.right - p.right + g.right) / A.x
761
- };
762
- }
763
- const rn = function(t) {
764
- return t === void 0 && (t = {}), {
765
- name: "flip",
766
- options: t,
767
- async fn(e) {
768
- var n, i;
769
- const {
770
- placement: o,
771
- middlewareData: s,
772
- rects: r,
773
- initialPlacement: c,
774
- platform: l,
775
- elements: a
776
- } = e, {
777
- mainAxis: f = !0,
778
- crossAxis: u = !0,
779
- fallbackPlacements: m,
780
- fallbackStrategy: h = "bestFit",
781
- fallbackAxisSideDirection: g = "none",
782
- flipAlignment: y = !0,
783
- ...w
784
- } = lt(t, e);
785
- if ((n = s.arrow) != null && n.alignmentOffset)
786
- return {};
787
- const p = V(o), v = I(c), x = V(c) === c, A = await (l.isRTL == null ? void 0 : l.isRTL(a.floating)), b = m || (x || !y ? [ot(c)] : Qe(c)), W = g !== "none";
788
- !m && W && b.push(...en(c, y, g, A));
789
- const pe = [c, ...b], ht = await re(e, w), G = [];
790
- let q = ((i = s.flip) == null ? void 0 : i.overflows) || [];
791
- if (f && G.push(ht[p]), u) {
792
- const M = Ge(o, r, A);
793
- G.push(ht[M[0]], ht[M[1]]);
794
- }
795
- if (q = [...q, {
796
- placement: o,
797
- overflows: G
798
- }], !G.every((M) => M <= 0)) {
799
- var bt, At;
800
- const M = (((bt = s.flip) == null ? void 0 : bt.index) || 0) + 1, _t = pe[M];
801
- if (_t)
802
- return {
803
- data: {
804
- index: M,
805
- overflows: q
806
- },
807
- reset: {
808
- placement: _t
809
- }
810
- };
811
- let X = (At = q.filter(($) => $.overflows[0] <= 0).sort(($, O) => $.overflows[1] - O.overflows[1])[0]) == null ? void 0 : At.placement;
812
- if (!X)
813
- switch (h) {
814
- case "bestFit": {
815
- var St;
816
- const $ = (St = q.filter((O) => {
817
- if (W) {
818
- const P = I(O.placement);
819
- return P === v || // Create a bias to the `y` side axis due to horizontal
820
- // reading directions favoring greater width.
821
- P === "y";
822
- }
823
- return !0;
824
- }).map((O) => [O.placement, O.overflows.filter((P) => P > 0).reduce((P, me) => P + me, 0)]).sort((O, P) => O[1] - P[1])[0]) == null ? void 0 : St[0];
825
- $ && (X = $);
826
- break;
827
- }
828
- case "initialPlacement":
829
- X = c;
830
- break;
831
- }
832
- if (o !== X)
833
- return {
834
- reset: {
835
- placement: X
836
- }
837
- };
838
- }
839
- return {};
840
- }
841
- };
842
- };
843
- async function cn(t, e) {
844
- const {
845
- placement: n,
846
- platform: i,
847
- elements: o
848
- } = t, s = await (i.isRTL == null ? void 0 : i.isRTL(o.floating)), r = V(n), c = at(n), l = I(n) === "y", a = ["left", "top"].includes(r) ? -1 : 1, f = s && l ? -1 : 1, u = lt(e, t);
849
- let {
850
- mainAxis: m,
851
- crossAxis: h,
852
- alignmentAxis: g
853
- } = typeof u == "number" ? {
854
- mainAxis: u,
855
- crossAxis: 0,
856
- alignmentAxis: null
857
- } : {
858
- mainAxis: 0,
859
- crossAxis: 0,
860
- alignmentAxis: null,
861
- ...u
862
- };
863
- return c && typeof g == "number" && (h = c === "end" ? g * -1 : g), l ? {
864
- x: h * f,
865
- y: m * a
866
- } : {
867
- x: m * a,
868
- y: h * f
869
- };
870
- }
871
- const ln = function(t) {
872
- return t === void 0 && (t = 0), {
873
- name: "offset",
874
- options: t,
875
- async fn(e) {
876
- var n, i;
877
- const {
878
- x: o,
879
- y: s,
880
- placement: r,
881
- middlewareData: c
882
- } = e, l = await cn(e, t);
883
- return r === ((n = c.offset) == null ? void 0 : n.placement) && (i = c.arrow) != null && i.alignmentOffset ? {} : {
884
- x: o + l.x,
885
- y: s + l.y,
886
- data: {
887
- ...l,
888
- placement: r
889
- }
890
- };
891
- }
892
- };
893
- }, an = function(t) {
894
- return t === void 0 && (t = {}), {
895
- name: "shift",
896
- options: t,
897
- async fn(e) {
898
- const {
899
- x: n,
900
- y: i,
901
- placement: o
902
- } = e, {
903
- mainAxis: s = !0,
904
- crossAxis: r = !1,
905
- limiter: c = {
906
- fn: (w) => {
907
- let {
908
- x: p,
909
- y: v
910
- } = w;
911
- return {
912
- x: p,
913
- y: v
914
- };
915
- }
916
- },
917
- ...l
918
- } = lt(t, e), a = {
919
- x: n,
920
- y: i
921
- }, f = await re(e, l), u = I(V(o)), m = ie(u);
922
- let h = a[m], g = a[u];
923
- if (s) {
924
- const w = m === "y" ? "top" : "left", p = m === "y" ? "bottom" : "right", v = h + f[w], x = h - f[p];
925
- h = Nt(v, h, x);
926
- }
927
- if (r) {
928
- const w = u === "y" ? "top" : "left", p = u === "y" ? "bottom" : "right", v = g + f[w], x = g - f[p];
929
- g = Nt(v, g, x);
930
- }
931
- const y = c.fn({
932
- ...e,
933
- [m]: h,
934
- [u]: g
935
- });
936
- return {
937
- ...y,
938
- data: {
939
- x: y.x - n,
940
- y: y.y - i
941
- }
942
- };
943
- }
944
- };
945
- };
946
- function j(t) {
947
- return ce(t) ? (t.nodeName || "").toLowerCase() : "#document";
948
- }
949
- function S(t) {
950
- var e;
951
- return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
952
- }
953
- function C(t) {
954
- var e;
955
- return (e = (ce(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
956
- }
957
- function ce(t) {
958
- return t instanceof Node || t instanceof S(t).Node;
959
- }
960
- function L(t) {
961
- return t instanceof Element || t instanceof S(t).Element;
962
- }
963
- function R(t) {
964
- return t instanceof HTMLElement || t instanceof S(t).HTMLElement;
965
- }
966
- function kt(t) {
967
- return typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof S(t).ShadowRoot;
968
- }
969
- function Z(t) {
970
- const {
971
- overflow: e,
972
- overflowX: n,
973
- overflowY: i,
974
- display: o
975
- } = _(t);
976
- return /auto|scroll|overlay|hidden|clip/.test(e + i + n) && !["inline", "contents"].includes(o);
977
- }
978
- function un(t) {
979
- return ["table", "td", "th"].includes(j(t));
980
- }
981
- function ut(t) {
982
- return [":popover-open", ":modal"].some((e) => {
983
- try {
984
- return t.matches(e);
985
- } catch {
986
- return !1;
987
- }
988
- });
989
- }
990
- function wt(t) {
991
- const e = vt(), n = _(t);
992
- return n.transform !== "none" || n.perspective !== "none" || (n.containerType ? n.containerType !== "normal" : !1) || !e && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !e && (n.filter ? n.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((i) => (n.willChange || "").includes(i)) || ["paint", "layout", "strict", "content"].some((i) => (n.contain || "").includes(i));
993
- }
994
- function fn(t) {
995
- let e = N(t);
996
- for (; R(e) && !z(e); ) {
997
- if (ut(e))
998
- return null;
999
- if (wt(e))
1000
- return e;
1001
- e = N(e);
1002
- }
1003
- return null;
1004
- }
1005
- function vt() {
1006
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
1007
- }
1008
- function z(t) {
1009
- return ["html", "body", "#document"].includes(j(t));
1010
- }
1011
- function _(t) {
1012
- return S(t).getComputedStyle(t);
1013
- }
1014
- function ft(t) {
1015
- return L(t) ? {
1016
- scrollLeft: t.scrollLeft,
1017
- scrollTop: t.scrollTop
1018
- } : {
1019
- scrollLeft: t.scrollX,
1020
- scrollTop: t.scrollY
1021
- };
1022
- }
1023
- function N(t) {
1024
- if (j(t) === "html")
1025
- return t;
1026
- const e = (
1027
- // Step into the shadow DOM of the parent of a slotted node.
1028
- t.assignedSlot || // DOM Element detected.
1029
- t.parentNode || // ShadowRoot detected.
1030
- kt(t) && t.host || // Fallback.
1031
- C(t)
1032
- );
1033
- return kt(e) ? e.host : e;
1034
- }
1035
- function le(t) {
1036
- const e = N(t);
1037
- return z(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : R(e) && Z(e) ? e : le(e);
1038
- }
1039
- function U(t, e, n) {
1040
- var i;
1041
- e === void 0 && (e = []), n === void 0 && (n = !0);
1042
- const o = le(t), s = o === ((i = t.ownerDocument) == null ? void 0 : i.body), r = S(o);
1043
- return s ? e.concat(r, r.visualViewport || [], Z(o) ? o : [], r.frameElement && n ? U(r.frameElement) : []) : e.concat(o, U(o, [], n));
1044
- }
1045
- function ae(t) {
1046
- const e = _(t);
1047
- let n = parseFloat(e.width) || 0, i = parseFloat(e.height) || 0;
1048
- const o = R(t), s = o ? t.offsetWidth : n, r = o ? t.offsetHeight : i, c = it(n) !== s || it(i) !== r;
1049
- return c && (n = s, i = r), {
1050
- width: n,
1051
- height: i,
1052
- $: c
1053
- };
1054
- }
1055
- function xt(t) {
1056
- return L(t) ? t : t.contextElement;
1057
- }
1058
- function H(t) {
1059
- const e = xt(t);
1060
- if (!R(e))
1061
- return T(1);
1062
- const n = e.getBoundingClientRect(), {
1063
- width: i,
1064
- height: o,
1065
- $: s
1066
- } = ae(e);
1067
- let r = (s ? it(n.width) : n.width) / i, c = (s ? it(n.height) : n.height) / o;
1068
- return (!r || !Number.isFinite(r)) && (r = 1), (!c || !Number.isFinite(c)) && (c = 1), {
1069
- x: r,
1070
- y: c
1071
- };
1072
- }
1073
- const hn = /* @__PURE__ */ T(0);
1074
- function ue(t) {
1075
- const e = S(t);
1076
- return !vt() || !e.visualViewport ? hn : {
1077
- x: e.visualViewport.offsetLeft,
1078
- y: e.visualViewport.offsetTop
1079
- };
1080
- }
1081
- function dn(t, e, n) {
1082
- return e === void 0 && (e = !1), !n || e && n !== S(t) ? !1 : e;
1083
- }
1084
- function B(t, e, n, i) {
1085
- e === void 0 && (e = !1), n === void 0 && (n = !1);
1086
- const o = t.getBoundingClientRect(), s = xt(t);
1087
- let r = T(1);
1088
- e && (i ? L(i) && (r = H(i)) : r = H(t));
1089
- const c = dn(s, n, i) ? ue(s) : T(0);
1090
- let l = (o.left + c.x) / r.x, a = (o.top + c.y) / r.y, f = o.width / r.x, u = o.height / r.y;
1091
- if (s) {
1092
- const m = S(s), h = i && L(i) ? S(i) : i;
1093
- let g = m, y = g.frameElement;
1094
- for (; y && i && h !== g; ) {
1095
- const w = H(y), p = y.getBoundingClientRect(), v = _(y), x = p.left + (y.clientLeft + parseFloat(v.paddingLeft)) * w.x, A = p.top + (y.clientTop + parseFloat(v.paddingTop)) * w.y;
1096
- l *= w.x, a *= w.y, f *= w.x, u *= w.y, l += x, a += A, g = S(y), y = g.frameElement;
1097
- }
1098
- }
1099
- return st({
1100
- width: f,
1101
- height: u,
1102
- x: l,
1103
- y: a
1104
- });
1105
- }
1106
- function pn(t) {
1107
- let {
1108
- elements: e,
1109
- rect: n,
1110
- offsetParent: i,
1111
- strategy: o
1112
- } = t;
1113
- const s = o === "fixed", r = C(i), c = e ? ut(e.floating) : !1;
1114
- if (i === r || c && s)
1115
- return n;
1116
- let l = {
1117
- scrollLeft: 0,
1118
- scrollTop: 0
1119
- }, a = T(1);
1120
- const f = T(0), u = R(i);
1121
- if ((u || !u && !s) && ((j(i) !== "body" || Z(r)) && (l = ft(i)), R(i))) {
1122
- const m = B(i);
1123
- a = H(i), f.x = m.x + i.clientLeft, f.y = m.y + i.clientTop;
1124
- }
1125
- return {
1126
- width: n.width * a.x,
1127
- height: n.height * a.y,
1128
- x: n.x * a.x - l.scrollLeft * a.x + f.x,
1129
- y: n.y * a.y - l.scrollTop * a.y + f.y
1130
- };
1131
- }
1132
- function mn(t) {
1133
- return Array.from(t.getClientRects());
1134
- }
1135
- function fe(t) {
1136
- return B(C(t)).left + ft(t).scrollLeft;
1137
- }
1138
- function gn(t) {
1139
- const e = C(t), n = ft(t), i = t.ownerDocument.body, o = F(e.scrollWidth, e.clientWidth, i.scrollWidth, i.clientWidth), s = F(e.scrollHeight, e.clientHeight, i.scrollHeight, i.clientHeight);
1140
- let r = -n.scrollLeft + fe(t);
1141
- const c = -n.scrollTop;
1142
- return _(i).direction === "rtl" && (r += F(e.clientWidth, i.clientWidth) - o), {
1143
- width: o,
1144
- height: s,
1145
- x: r,
1146
- y: c
1147
- };
1148
- }
1149
- function yn(t, e) {
1150
- const n = S(t), i = C(t), o = n.visualViewport;
1151
- let s = i.clientWidth, r = i.clientHeight, c = 0, l = 0;
1152
- if (o) {
1153
- s = o.width, r = o.height;
1154
- const a = vt();
1155
- (!a || a && e === "fixed") && (c = o.offsetLeft, l = o.offsetTop);
1156
- }
1157
- return {
1158
- width: s,
1159
- height: r,
1160
- x: c,
1161
- y: l
1162
- };
1163
- }
1164
- function wn(t, e) {
1165
- const n = B(t, !0, e === "fixed"), i = n.top + t.clientTop, o = n.left + t.clientLeft, s = R(t) ? H(t) : T(1), r = t.clientWidth * s.x, c = t.clientHeight * s.y, l = o * s.x, a = i * s.y;
1166
- return {
1167
- width: r,
1168
- height: c,
1169
- x: l,
1170
- y: a
1171
- };
1172
- }
1173
- function Ft(t, e, n) {
1174
- let i;
1175
- if (e === "viewport")
1176
- i = yn(t, n);
1177
- else if (e === "document")
1178
- i = gn(C(t));
1179
- else if (L(e))
1180
- i = wn(e, n);
1181
- else {
1182
- const o = ue(t);
1183
- i = {
1184
- ...e,
1185
- x: e.x - o.x,
1186
- y: e.y - o.y
1187
- };
1188
- }
1189
- return st(i);
1190
- }
1191
- function he(t, e) {
1192
- const n = N(t);
1193
- return n === e || !L(n) || z(n) ? !1 : _(n).position === "fixed" || he(n, e);
1194
- }
1195
- function vn(t, e) {
1196
- const n = e.get(t);
1197
- if (n)
1198
- return n;
1199
- let i = U(t, [], !1).filter((c) => L(c) && j(c) !== "body"), o = null;
1200
- const s = _(t).position === "fixed";
1201
- let r = s ? N(t) : t;
1202
- for (; L(r) && !z(r); ) {
1203
- const c = _(r), l = wt(r);
1204
- !l && c.position === "fixed" && (o = null), (s ? !l && !o : !l && c.position === "static" && !!o && ["absolute", "fixed"].includes(o.position) || Z(r) && !l && he(t, r)) ? i = i.filter((f) => f !== r) : o = c, r = N(r);
1205
- }
1206
- return e.set(t, i), i;
1207
- }
1208
- function xn(t) {
1209
- let {
1210
- element: e,
1211
- boundary: n,
1212
- rootBoundary: i,
1213
- strategy: o
1214
- } = t;
1215
- const r = [...n === "clippingAncestors" ? ut(e) ? [] : vn(e, this._c) : [].concat(n), i], c = r[0], l = r.reduce((a, f) => {
1216
- const u = Ft(e, f, o);
1217
- return a.top = F(u.top, a.top), a.right = nt(u.right, a.right), a.bottom = nt(u.bottom, a.bottom), a.left = F(u.left, a.left), a;
1218
- }, Ft(e, c, o));
1219
- return {
1220
- width: l.right - l.left,
1221
- height: l.bottom - l.top,
1222
- x: l.left,
1223
- y: l.top
1224
- };
1225
- }
1226
- function bn(t) {
1227
- const {
1228
- width: e,
1229
- height: n
1230
- } = ae(t);
1231
- return {
1232
- width: e,
1233
- height: n
1234
- };
1235
- }
1236
- function An(t, e, n) {
1237
- const i = R(e), o = C(e), s = n === "fixed", r = B(t, !0, s, e);
1238
- let c = {
1239
- scrollLeft: 0,
1240
- scrollTop: 0
1241
- };
1242
- const l = T(0);
1243
- if (i || !i && !s)
1244
- if ((j(e) !== "body" || Z(o)) && (c = ft(e)), i) {
1245
- const u = B(e, !0, s, e);
1246
- l.x = u.x + e.clientLeft, l.y = u.y + e.clientTop;
1247
- } else o && (l.x = fe(o));
1248
- const a = r.left + c.scrollLeft - l.x, f = r.top + c.scrollTop - l.y;
1249
- return {
1250
- x: a,
1251
- y: f,
1252
- width: r.width,
1253
- height: r.height
1254
- };
1255
- }
1256
- function pt(t) {
1257
- return _(t).position === "static";
1258
- }
1259
- function Vt(t, e) {
1260
- return !R(t) || _(t).position === "fixed" ? null : e ? e(t) : t.offsetParent;
1261
- }
1262
- function de(t, e) {
1263
- const n = S(t);
1264
- if (ut(t))
1265
- return n;
1266
- if (!R(t)) {
1267
- let o = N(t);
1268
- for (; o && !z(o); ) {
1269
- if (L(o) && !pt(o))
1270
- return o;
1271
- o = N(o);
1272
- }
1273
- return n;
1274
- }
1275
- let i = Vt(t, e);
1276
- for (; i && un(i) && pt(i); )
1277
- i = Vt(i, e);
1278
- return i && z(i) && pt(i) && !wt(i) ? n : i || fn(t) || n;
1279
- }
1280
- const Sn = async function(t) {
1281
- const e = this.getOffsetParent || de, n = this.getDimensions, i = await n(t.floating);
1282
- return {
1283
- reference: An(t.reference, await e(t.floating), t.strategy),
1284
- floating: {
1285
- x: 0,
1286
- y: 0,
1287
- width: i.width,
1288
- height: i.height
1289
- }
1290
- };
1291
- };
1292
- function _n(t) {
1293
- return _(t).direction === "rtl";
1294
- }
1295
- const En = {
1296
- convertOffsetParentRelativeRectToViewportRelativeRect: pn,
1297
- getDocumentElement: C,
1298
- getClippingRect: xn,
1299
- getOffsetParent: de,
1300
- getElementRects: Sn,
1301
- getClientRects: mn,
1302
- getDimensions: bn,
1303
- getScale: H,
1304
- isElement: L,
1305
- isRTL: _n
1306
- };
1307
- function Ln(t, e) {
1308
- let n = null, i;
1309
- const o = C(t);
1310
- function s() {
1311
- var c;
1312
- clearTimeout(i), (c = n) == null || c.disconnect(), n = null;
1313
- }
1314
- function r(c, l) {
1315
- c === void 0 && (c = !1), l === void 0 && (l = 1), s();
1316
- const {
1317
- left: a,
1318
- top: f,
1319
- width: u,
1320
- height: m
1321
- } = t.getBoundingClientRect();
1322
- if (c || e(), !u || !m)
1323
- return;
1324
- const h = et(f), g = et(o.clientWidth - (a + u)), y = et(o.clientHeight - (f + m)), w = et(a), v = {
1325
- rootMargin: -h + "px " + -g + "px " + -y + "px " + -w + "px",
1326
- threshold: F(0, nt(1, l)) || 1
1327
- };
1328
- let x = !0;
1329
- function A(b) {
1330
- const W = b[0].intersectionRatio;
1331
- if (W !== l) {
1332
- if (!x)
1333
- return r();
1334
- W ? r(!1, W) : i = setTimeout(() => {
1335
- r(!1, 1e-7);
1336
- }, 1e3);
1337
- }
1338
- x = !1;
1339
- }
1340
- try {
1341
- n = new IntersectionObserver(A, {
1342
- ...v,
1343
- // Handle <iframe>s
1344
- root: o.ownerDocument
1345
- });
1346
- } catch {
1347
- n = new IntersectionObserver(A, v);
1348
- }
1349
- n.observe(t);
1350
- }
1351
- return r(!0), s;
1352
- }
1353
- function Rn(t, e, n, i) {
1354
- i === void 0 && (i = {});
1355
- const {
1356
- ancestorScroll: o = !0,
1357
- ancestorResize: s = !0,
1358
- elementResize: r = typeof ResizeObserver == "function",
1359
- layoutShift: c = typeof IntersectionObserver == "function",
1360
- animationFrame: l = !1
1361
- } = i, a = xt(t), f = o || s ? [...a ? U(a) : [], ...U(e)] : [];
1362
- f.forEach((p) => {
1363
- o && p.addEventListener("scroll", n, {
1364
- passive: !0
1365
- }), s && p.addEventListener("resize", n);
1366
- });
1367
- const u = a && c ? Ln(a, n) : null;
1368
- let m = -1, h = null;
1369
- r && (h = new ResizeObserver((p) => {
1370
- let [v] = p;
1371
- v && v.target === a && h && (h.unobserve(e), cancelAnimationFrame(m), m = requestAnimationFrame(() => {
1372
- var x;
1373
- (x = h) == null || x.observe(e);
1374
- })), n();
1375
- }), a && !l && h.observe(a), h.observe(e));
1376
- let g, y = l ? B(t) : null;
1377
- l && w();
1378
- function w() {
1379
- const p = B(t);
1380
- y && (p.x !== y.x || p.y !== y.y || p.width !== y.width || p.height !== y.height) && n(), y = p, g = requestAnimationFrame(w);
1381
- }
1382
- return n(), () => {
1383
- var p;
1384
- f.forEach((v) => {
1385
- o && v.removeEventListener("scroll", n), s && v.removeEventListener("resize", n);
1386
- }), u == null || u(), (p = h) == null || p.disconnect(), h = null, l && cancelAnimationFrame(g);
1387
- };
1388
- }
1389
- const Dn = ln, Cn = an, Bt = rn, On = (t, e, n) => {
1390
- const i = /* @__PURE__ */ new Map(), o = {
1391
- platform: En,
1392
- ...n
1393
- }, s = {
1394
- ...o.platform,
1395
- _c: i
1396
- };
1397
- return sn(t, e, {
1398
- ...o,
1399
- platform: s
1400
- });
1401
- };
1402
- function Pn({
1403
- content: t,
1404
- open: e,
1405
- placement: n,
1406
- offset: { mainAxis: i, crossAxis: o } = { mainAxis: 0, crossAxis: 0 }
1407
- }) {
1408
- return (s) => {
1409
- const r = s.element, c = E.wrap(e);
1410
- return mt.bool(c, {
1411
- true: () => Xe(
1412
- "body",
1413
- Te.div(
1414
- Ye((l) => {
1415
- const a = l;
1416
- return a.style.position = "absolute", Rn(r, a, () => {
1417
- On(r, a, {
1418
- placement: n,
1419
- strategy: "absolute",
1420
- middleware: [
1421
- Bt(),
1422
- Dn({ mainAxis: i, crossAxis: o }),
1423
- Cn(),
1424
- Bt()
1425
- ]
1426
- }).then(({ x: f, y: u }) => {
1427
- a.style.top = `${u}px`, a.style.left = `${f}px`;
1428
- });
1429
- });
1430
- }),
1431
- t()
1432
- )
1433
- ),
1434
- false: () => null
1435
- })(s);
1436
- };
1437
- }
1438
- export {
1439
- Pn as PopOver
1440
- };