@orangelogic/design-system 2.19.0-pr77248.4 → 2.21.0-ci.4

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 (51) hide show
  1. package/library/chunks/{asset-link-format.CNLtOgSn.js → asset-link-format.C0CS4yT2.js} +1 -1
  2. package/library/chunks/{color-swatch-group.fL5ADbZF.js → color-swatch-group.CLgR1RVY.js} +3 -3
  3. package/library/chunks/{color-swatch.JL7CbNRm.js → color-swatch.k8v423rv.js} +1 -1
  4. package/library/chunks/{confirm-popover.DwSAxWFi.js → confirm-popover.B5zE9qkC.js} +1 -1
  5. package/library/chunks/{dialog.upIZWR3x.js → dialog.BTGwgvZG.js} +1 -1
  6. package/library/chunks/{file-on-demand.Cb4mtesb.js → file-on-demand.Dbju7eFg.js} +5 -5
  7. package/library/chunks/{folder-select.BsbsjikP.js → folder-select.hyld2fgc.js} +2 -2
  8. package/library/chunks/{image.CRcv0x3Z.js → image.9eUBQRQ0.js} +11 -12
  9. package/library/chunks/{list-editor.BPUsGMW-.js → list-editor.CrErjQdh.js} +1 -1
  10. package/library/chunks/{menu-item.HK2A6RqD.js → menu-item.Dep30IBS.js} +1 -1
  11. package/library/chunks/popup.CiIgTjOV.js +3320 -0
  12. package/library/chunks/{select.DMdl1Kdd.js → select.CWOW4pAr.js} +1 -1
  13. package/library/chunks/{tab-group.3F6gRchD.js → tab-group.C0I_UeKY.js} +1 -1
  14. package/library/chunks/{table.BarE1-gL.js → table.Oco9h8cd.js} +1 -1
  15. package/library/components/asset-link-format.js +1 -1
  16. package/library/components/atoms.js +7 -7
  17. package/library/components/color-picker.js +1 -1
  18. package/library/components/color-swatch-group.js +4 -4
  19. package/library/components/color-swatch.js +2 -2
  20. package/library/components/confirm-popover.js +2 -2
  21. package/library/components/corner-position-input-group.js +1 -1
  22. package/library/components/dialog.js +2 -2
  23. package/library/components/dropdown.js +1 -1
  24. package/library/components/dynamic-select.js +2 -2
  25. package/library/components/file-on-demand.js +6 -6
  26. package/library/components/folder-select.js +2 -2
  27. package/library/components/image.js +3 -4
  28. package/library/components/line-clamp.js +1 -1
  29. package/library/components/list-editor.js +2 -2
  30. package/library/components/masonry.js +1 -1
  31. package/library/components/menu-item.js +2 -2
  32. package/library/components/menu.js +1 -1
  33. package/library/components/molecules.js +4 -4
  34. package/library/components/organisms.js +3 -3
  35. package/library/components/pagination.js +1 -1
  36. package/library/components/popup.js +10 -3297
  37. package/library/components/range.js +1 -1
  38. package/library/components/select.js +2 -2
  39. package/library/components/size-input-group.js +1 -1
  40. package/library/components/tab-group.js +2 -2
  41. package/library/components/table.js +1 -1
  42. package/library/components/tooltip.js +1 -1
  43. package/library/components/types.js +2299 -2357
  44. package/library/components/video.js +1 -1
  45. package/library/package.json +1 -1
  46. package/library/packages/atoms/src/components/popup/popup.d.ts +7 -1
  47. package/library/packages/organisms/src/content-builder/content-builder.d.ts +1 -0
  48. package/library/packages/tools/src/fetch-image/fetch-image.d.ts +0 -8
  49. package/library/react-web-component.d.ts +21 -21
  50. package/package.json +1 -1
  51. package/library/chunks/debounce.DZNkg8Q5.js +0 -11
@@ -0,0 +1,3320 @@
1
+ import { a as Ie, i as Ut, r as Me, x as j, n as v, C as He, c as We } from "./custom-element.fmLrnDZr.js";
2
+ import { r as be } from "./state.Dt9F_SuS.js";
3
+ import { e as ut } from "./query.BBf1UFkC.js";
4
+ import { e as qe } from "./base.D76d76ww.js";
5
+ import { o as Tt } from "./if-defined.CKupVaWs.js";
6
+ import { o as ne } from "./style-map.lEJHEwk3.js";
7
+ import { i as Lt, p as re, f as Ve, a as Ue } from "./browser.Va59Ix3P.js";
8
+ import { c as we } from "./component.styles.DtouHn2g.js";
9
+ import { L as je } from "./i18n.C6c6_pqI.js";
10
+ import { e as Dt } from "./class-map.DqNfBvJI.js";
11
+ import { n as Ye } from "./when.Dr1es41R.js";
12
+ /**
13
+ * @license
14
+ * Copyright 2021 Google LLC
15
+ * SPDX-License-Identifier: BSD-3-Clause
16
+ */
17
+ function Ke(e) {
18
+ return (t, o) => {
19
+ const { slot: i, selector: s } = e ?? {}, r = "slot" + (i ? `[name=${i}]` : ":not([name])");
20
+ return qe(t, o, { get() {
21
+ const n = this.renderRoot?.querySelector(r), a = n?.assignedElements(e) ?? [];
22
+ return s === void 0 ? a : a.filter((l) => l.matches(s));
23
+ } });
24
+ };
25
+ }
26
+ const ae = Symbol(), kt = Symbol(), Xe = (e, t = !1) => (o, i, s) => {
27
+ const r = s.value;
28
+ s.value = function(...n) {
29
+ clearTimeout(this[ae]), t && !this[kt] && (r.apply(this, n), this[kt] = !0), this[ae] = window.setTimeout(() => {
30
+ t || r.apply(this, n), this[kt] = !1;
31
+ }, e);
32
+ }, s.configurable === !1 && (s.configurable = !0);
33
+ }, le = /* @__PURE__ */ new Set(), Ge = (e) => typeof e.startManagingContentDirection < "u" || e.tagName === "SP-THEME";
34
+ function Qe(e) {
35
+ class t extends e {
36
+ /**
37
+ * @private
38
+ */
39
+ get isLTR() {
40
+ return this.dir === "ltr";
41
+ }
42
+ hasVisibleFocusInTree() {
43
+ const s = ((r = document) => {
44
+ let n = r.activeElement;
45
+ for (; n?.shadowRoot && n.shadowRoot.activeElement; )
46
+ n = n.shadowRoot.activeElement;
47
+ const a = n ? [n] : [];
48
+ for (; n; ) {
49
+ const l = n.assignedSlot || n.parentElement || n.getRootNode()?.host;
50
+ l && a.push(l), n = l;
51
+ }
52
+ return a;
53
+ })(this.getRootNode())[0];
54
+ if (!s)
55
+ return !1;
56
+ try {
57
+ return s.matches(":focus-visible") || s.matches(".focus-visible");
58
+ } catch {
59
+ return s.matches(".focus-visible");
60
+ }
61
+ }
62
+ connectedCallback() {
63
+ if (!this.hasAttribute("dir")) {
64
+ let i = this.assignedSlot || this.parentNode;
65
+ for (; i !== document.documentElement && !Ge(i); )
66
+ i = i.assignedSlot || // step into the shadow DOM of the parent of a slotted node
67
+ i.parentNode || // DOM Element detected
68
+ i.host;
69
+ if (this.dir = i.dir === "rtl" ? i.dir : this.dir || "ltr", i === document.documentElement)
70
+ le.add(this);
71
+ else {
72
+ const { localName: s } = i;
73
+ s.search("-") > -1 && !customElements.get(s) ? customElements.whenDefined(s).then(() => {
74
+ i.startManagingContentDirection(this);
75
+ }) : i.startManagingContentDirection(this);
76
+ }
77
+ this._dirParent = i;
78
+ }
79
+ super.connectedCallback();
80
+ }
81
+ disconnectedCallback() {
82
+ super.disconnectedCallback(), this._dirParent && (this._dirParent === document.documentElement ? le.delete(this) : this._dirParent.stopManagingContentDirection(this), this.removeAttribute("dir"));
83
+ }
84
+ }
85
+ return t;
86
+ }
87
+ class Je extends Qe(Ie) {
88
+ }
89
+ function Ze(e, t, o) {
90
+ const i = e.getAttribute(t);
91
+ let s = i ? i.split(/\s+/) : [];
92
+ s = s.filter(
93
+ (r) => !o.find((n) => r === n)
94
+ ), s.length ? e.setAttribute(t, s.join(" ")) : e.removeAttribute(t);
95
+ }
96
+ function $t(e, t, o) {
97
+ const i = Array.isArray(o) ? o : [o], s = e.getAttribute(t), r = s ? s.split(/\s+/) : [];
98
+ return i.every((a) => r.indexOf(a) > -1) ? () => {
99
+ } : (r.push(...i), e.setAttribute(t, r.join(" ")), () => Ze(e, t, i));
100
+ }
101
+ function ti(e, t) {
102
+ customElements.get(e) || customElements.define(e, t);
103
+ }
104
+ function ei(e, t, o = []) {
105
+ for (let i = 0; i < t.length; ++i) {
106
+ const s = t[i], r = e[i], n = r.parentElement || r.getRootNode();
107
+ o[i] && o[i](s), n && n !== r && n.replaceChild(s, r), delete e[i];
108
+ }
109
+ return t;
110
+ }
111
+ const ii = (e, t, {
112
+ position: o,
113
+ prepareCallback: i
114
+ } = { position: "beforeend" }) => {
115
+ let { length: s } = e;
116
+ if (s === 0)
117
+ return () => e;
118
+ let r = 1, n = 0;
119
+ (o === "afterbegin" || o === "afterend") && (r = -1, n = s - 1);
120
+ const a = new Array(s), l = new Array(s), c = document.createComment(
121
+ "placeholder for reparented element"
122
+ );
123
+ do {
124
+ const h = e[n];
125
+ i && (l[n] = i(h)), a[n] = c.cloneNode();
126
+ const d = h.parentElement || h.getRootNode();
127
+ d && d !== h && d.replaceChild(a[n], h), t.insertAdjacentElement(o, h), n += r;
128
+ } while (--s > 0);
129
+ return function() {
130
+ return ei(a, e, l);
131
+ };
132
+ };
133
+ function jt() {
134
+ return Array.from(
135
+ crypto.getRandomValues(new Uint8Array(4)),
136
+ (e) => `0${(e & 255).toString(16)}`.slice(-2)
137
+ ).join("");
138
+ }
139
+ const oi = [
140
+ "button",
141
+ "[focusable]",
142
+ "[href]",
143
+ "input",
144
+ "label",
145
+ "select",
146
+ "textarea",
147
+ "[tabindex]"
148
+ ], ce = ':not([tabindex="-1"])', ft = oi.join(`${ce}, `) + ce, Yt = (e) => e.querySelector(
149
+ ft
150
+ ), Kt = (e) => e.assignedElements().find(
151
+ (o) => o.matches(ft)
152
+ );
153
+ function si(e) {
154
+ return typeof window < "u" && window.navigator != null ? e.test(window.navigator.userAgent) : !1;
155
+ }
156
+ function Xt(e) {
157
+ return typeof window < "u" && window.navigator != null ? e.test(window.navigator.platform) : !1;
158
+ }
159
+ function ni() {
160
+ return Xt(/^Mac/);
161
+ }
162
+ function ri() {
163
+ return Xt(/^iPhone/);
164
+ }
165
+ function ai() {
166
+ return Xt(/^iPad/) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
167
+ ni() && navigator.maxTouchPoints > 1;
168
+ }
169
+ function li() {
170
+ return ri() || ai();
171
+ }
172
+ function ci() {
173
+ return si(/Android/);
174
+ }
175
+ const hi = 1e3, di = 1e3;
176
+ class pi {
177
+ constructor(t = {}) {
178
+ this.warmUpDelay = hi, this.coolDownDelay = di, this.isWarm = !1, this.timeout = 0, Object.assign(this, t);
179
+ }
180
+ async openTimer(t) {
181
+ if (this.cancelCooldownTimer(), !this.component || t !== this.component)
182
+ return this.component && (this.close(this.component), this.cancelCooldownTimer()), this.component = t, this.isWarm ? !1 : (this.promise = new Promise((o) => {
183
+ this.resolve = o, this.timeout = window.setTimeout(() => {
184
+ this.resolve && (this.resolve(!1), this.isWarm = !0);
185
+ }, this.warmUpDelay);
186
+ }), this.promise);
187
+ if (this.promise)
188
+ return this.promise;
189
+ throw new Error("Inconsistent state");
190
+ }
191
+ close(t) {
192
+ this.component && this.component === t && (this.resetCooldownTimer(), this.timeout > 0 && (clearTimeout(this.timeout), this.timeout = 0), this.resolve && (this.resolve(!0), delete this.resolve), delete this.promise, delete this.component);
193
+ }
194
+ resetCooldownTimer() {
195
+ this.isWarm && (this.cooldownTimeout && window.clearTimeout(this.cooldownTimeout), this.cooldownTimeout = window.setTimeout(() => {
196
+ this.isWarm = !1, delete this.cooldownTimeout;
197
+ }, this.coolDownDelay));
198
+ }
199
+ cancelCooldownTimer() {
200
+ this.cooldownTimeout && window.clearTimeout(this.cooldownTimeout), delete this.cooldownTimeout;
201
+ }
202
+ }
203
+ const bt = new pi(), it = () => {
204
+ }, Gt = (e, t, o) => {
205
+ const i = new AbortController(), s = /* @__PURE__ */ new Map(), r = () => {
206
+ i.abort(), o();
207
+ };
208
+ let n, a;
209
+ const l = requestAnimationFrame(() => {
210
+ n = requestAnimationFrame(() => {
211
+ a = requestAnimationFrame(() => {
212
+ r();
213
+ });
214
+ });
215
+ }), c = (d) => {
216
+ d.target === e && (s.set(
217
+ d.propertyName,
218
+ s.get(d.propertyName) - 1
219
+ ), s.get(d.propertyName) || s.delete(d.propertyName), s.size === 0 && r());
220
+ }, h = (d) => {
221
+ d.target === e && (s.has(d.propertyName) || s.set(d.propertyName, 0), s.set(
222
+ d.propertyName,
223
+ s.get(d.propertyName) + 1
224
+ ), cancelAnimationFrame(l), cancelAnimationFrame(n), cancelAnimationFrame(a));
225
+ };
226
+ e.addEventListener("transitionrun", h, {
227
+ signal: i.signal
228
+ }), e.addEventListener("transitionend", c, {
229
+ signal: i.signal
230
+ }), e.addEventListener("transitioncancel", c, {
231
+ signal: i.signal
232
+ }), t();
233
+ };
234
+ function k() {
235
+ return new Promise((e) => requestAnimationFrame(() => e()));
236
+ }
237
+ class ht extends Je {
238
+ constructor() {
239
+ super(...arguments), this.dispose = it, this.offset = 0, this.willPreventClose = !1;
240
+ }
241
+ async applyFocus(t, o) {
242
+ }
243
+ /* c8 ignore next 6 */
244
+ get delayed() {
245
+ return !1;
246
+ }
247
+ set delayed(t) {
248
+ }
249
+ /* c8 ignore next 6 */
250
+ get disabled() {
251
+ return !1;
252
+ }
253
+ set disabled(t) {
254
+ }
255
+ get elementResolver() {
256
+ return this._elementResolver;
257
+ }
258
+ set elementResolver(t) {
259
+ this._elementResolver = t;
260
+ }
261
+ /* c8 ignore next 3 */
262
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
263
+ async ensureOnDOM(t) {
264
+ }
265
+ /* c8 ignore next 5 */
266
+ async makeTransition(t) {
267
+ return null;
268
+ }
269
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
270
+ async manageDelay(t) {
271
+ }
272
+ /* c8 ignore next 3 */
273
+ async manageDialogOpen() {
274
+ }
275
+ /* c8 ignore next 3 */
276
+ async managePopoverOpen() {
277
+ }
278
+ /* c8 ignore next 3 */
279
+ managePosition() {
280
+ }
281
+ /* c8 ignore next 6 */
282
+ get open() {
283
+ return !1;
284
+ }
285
+ set open(t) {
286
+ }
287
+ get placementController() {
288
+ return this._placementController;
289
+ }
290
+ set placementController(t) {
291
+ this._placementController = t;
292
+ }
293
+ requestSlottable() {
294
+ }
295
+ returnFocus() {
296
+ }
297
+ /* c8 ignore next 6 */
298
+ get state() {
299
+ return "closed";
300
+ }
301
+ set state(t) {
302
+ }
303
+ /* c8 ignore next 3 */
304
+ manuallyKeepOpen() {
305
+ }
306
+ static update() {
307
+ const t = new CustomEvent("cx-update-overlays", {
308
+ bubbles: !0,
309
+ cancelable: !0,
310
+ composed: !0
311
+ });
312
+ document.dispatchEvent(t);
313
+ }
314
+ static async open(t, o, i, s) {
315
+ await Promise.resolve().then(() => ze);
316
+ const r = arguments.length === 2, n = i || t, a = new this();
317
+ let l = !1;
318
+ a.dispose = () => {
319
+ a.addEventListener("cx-closed", () => {
320
+ l || (c(), l = !0), requestAnimationFrame(() => {
321
+ a.remove();
322
+ });
323
+ }), a.open = !1, a.dispose = it;
324
+ };
325
+ const c = ii([n], a, {
326
+ position: "beforeend",
327
+ prepareCallback: (u) => {
328
+ const p = u.slot;
329
+ return u.removeAttribute("slot"), () => {
330
+ u.slot = p;
331
+ };
332
+ }
333
+ });
334
+ if (!r && n && s) {
335
+ const u = t, p = o, f = s;
336
+ return ht.applyOptions(a, {
337
+ ...f,
338
+ delayed: f.delayed || n.hasAttribute("delayed"),
339
+ trigger: f.virtualTrigger || u,
340
+ type: p === "modal" ? "modal" : p === "hover" ? "hint" : "auto"
341
+ }), u.insertAdjacentElement("afterend", a), await a.updateComplete, a.open = !0, a.dispose;
342
+ }
343
+ const d = o;
344
+ return a.append(n), ht.applyOptions(a, {
345
+ ...d,
346
+ delayed: d.delayed || n.hasAttribute("delayed")
347
+ }), a.updateComplete.then(() => {
348
+ a.open = !0;
349
+ }), a;
350
+ }
351
+ static applyOptions(t, o) {
352
+ t.delayed = !!o.delayed, t.receivesFocus = o.receivesFocus ?? "auto", t.triggerElement = o.trigger || null, t.type = o.type || "modal", t.offset = o.offset ?? 0, t.placement = o.placement, t.willPreventClose = !!o.notImmediatelyClosable;
353
+ }
354
+ }
355
+ const xe = Symbol("element resolver updated");
356
+ class ui {
357
+ constructor(t, { selector: o } = { selector: "" }) {
358
+ this._element = null, this._selector = "", this.mutationCallback = (i) => {
359
+ let s = !1;
360
+ i.forEach((r) => {
361
+ if (!s) {
362
+ if (r.type === "childList") {
363
+ const n = this.element && [...r.removedNodes].includes(this.element), a = !!this.selector && [...r.addedNodes].some(
364
+ this.elementIsSelected
365
+ );
366
+ s = s || n || a;
367
+ }
368
+ if (r.type === "attributes") {
369
+ const n = r.target === this.element, a = !!this.selector && this.elementIsSelected(r.target);
370
+ s = s || n || a;
371
+ }
372
+ }
373
+ }), s && this.resolveElement();
374
+ }, this.elementIsSelected = (i) => this.selectorIsId ? i?.id === this.selectorAsId : i?.matches?.(this.selector), this.host = t, this.selector = o, this.observer = new MutationObserver(this.mutationCallback), this.host.addController(this);
375
+ }
376
+ get element() {
377
+ return this._element;
378
+ }
379
+ set element(t) {
380
+ if (t === this.element)
381
+ return;
382
+ const o = this.element;
383
+ this._element = t, this.host.requestUpdate(xe, o);
384
+ }
385
+ get selector() {
386
+ return this._selector;
387
+ }
388
+ set selector(t) {
389
+ t !== this.selector && (this.releaseElement(), this._selector = t, this.resolveElement());
390
+ }
391
+ get selectorAsId() {
392
+ return this.selector.slice(1);
393
+ }
394
+ get selectorIsId() {
395
+ return !!this.selector && this.selector.startsWith("#");
396
+ }
397
+ hostConnected() {
398
+ this.resolveElement(), this.observer.observe(this.host.getRootNode(), {
399
+ attributes: !0,
400
+ childList: !0,
401
+ subtree: !0
402
+ });
403
+ }
404
+ hostDisconnected() {
405
+ this.releaseElement(), this.observer.disconnect();
406
+ }
407
+ resolveElement() {
408
+ if (!this.selector) {
409
+ this.releaseElement();
410
+ return;
411
+ }
412
+ const t = this.host.getRootNode();
413
+ this.element = this.selectorIsId ? t.getElementById(this.selectorAsId) : t.querySelector(this.selector);
414
+ }
415
+ releaseElement() {
416
+ this.element = null;
417
+ }
418
+ }
419
+ class Qt extends Event {
420
+ constructor() {
421
+ super("beforetoggle", {
422
+ bubbles: !1,
423
+ composed: !1
424
+ }), this.currentState = "open", this.newState = "closed";
425
+ }
426
+ }
427
+ class Jt extends Event {
428
+ constructor() {
429
+ super("beforetoggle", {
430
+ bubbles: !1,
431
+ composed: !1
432
+ }), this.currentState = "closed", this.newState = "open";
433
+ }
434
+ }
435
+ class $ extends Event {
436
+ constructor(t, o, {
437
+ interaction: i,
438
+ publish: s,
439
+ reason: r
440
+ }) {
441
+ super(t, {
442
+ bubbles: s,
443
+ composed: s
444
+ }), this.overlay = o, this.detail = {
445
+ interaction: i,
446
+ reason: r
447
+ };
448
+ }
449
+ }
450
+ class Pt {
451
+ constructor(t, o) {
452
+ this.x = 0, this.y = 0, this.x = t, this.y = o;
453
+ }
454
+ updateBoundingClientRect(t, o) {
455
+ this.x = t, this.y = o, ht.update();
456
+ }
457
+ getBoundingClientRect() {
458
+ return {
459
+ bottom: this.y,
460
+ height: 0,
461
+ left: this.x,
462
+ right: this.x,
463
+ /* c8 ignore next 3 */
464
+ toJSON() {
465
+ },
466
+ top: this.y,
467
+ width: 0,
468
+ x: this.x,
469
+ y: this.y
470
+ };
471
+ }
472
+ }
473
+ function fi(e) {
474
+ class t extends e {
475
+ async manageDialogOpen() {
476
+ const i = this.open;
477
+ if (await this.managePosition(), this.open !== i)
478
+ return;
479
+ const s = await this.dialogMakeTransition(i);
480
+ this.open === i && await this.dialogApplyFocus(i, s);
481
+ }
482
+ async dialogMakeTransition(i) {
483
+ let s = null;
484
+ const r = (a, l) => async () => {
485
+ if (a.open = i, !i) {
486
+ const h = () => {
487
+ a.removeEventListener("close", h);
488
+ };
489
+ a.addEventListener("close", h);
490
+ }
491
+ if (l > 0)
492
+ return;
493
+ const c = i ? Jt : Qt;
494
+ this.dispatchEvent(new c()), i && (a.matches(ft) && (s = a), s = s || Yt(a), s || a.querySelectorAll("slot").forEach((d) => {
495
+ s || (s = Kt(d));
496
+ }), !(!this.isConnected || this.dialogEl.open) && this.dialogEl.showModal());
497
+ }, n = (a, l) => () => {
498
+ if (this.open !== i)
499
+ return;
500
+ const c = i ? "cx-opened" : "cx-closed";
501
+ if (l > 0) {
502
+ a.dispatchEvent(
503
+ new $(c, this, {
504
+ interaction: this.type,
505
+ publish: !1
506
+ })
507
+ );
508
+ return;
509
+ }
510
+ if (!this.isConnected || i !== this.open)
511
+ return;
512
+ const h = async () => {
513
+ const d = this.triggerElement instanceof Pt;
514
+ this.dispatchEvent(
515
+ new $(c, this, {
516
+ interaction: this.type,
517
+ publish: d
518
+ })
519
+ ), a.dispatchEvent(
520
+ new $(c, this, {
521
+ interaction: this.type,
522
+ publish: !1
523
+ })
524
+ ), this.triggerElement && !d && this.triggerElement.dispatchEvent(
525
+ new $(c, this, {
526
+ interaction: this.type,
527
+ publish: !0
528
+ })
529
+ ), this.state = i ? "opened" : "closed", this.returnFocus(), await k(), await k(), i === this.open && i === !1 && this.requestSlottable();
530
+ };
531
+ !i && this.dialogEl.open ? (this.dialogEl.addEventListener(
532
+ "close",
533
+ () => {
534
+ h();
535
+ },
536
+ { once: !0 }
537
+ ), this.dialogEl.close()) : h();
538
+ };
539
+ return this.elements.forEach((a, l) => {
540
+ Gt(a, r(a, l), n(a, l));
541
+ }), s;
542
+ }
543
+ async dialogApplyFocus(i, s) {
544
+ this.applyFocus(i, s);
545
+ }
546
+ }
547
+ return t;
548
+ }
549
+ function gi(e) {
550
+ class t extends e {
551
+ async managePopoverOpen() {
552
+ await this.managePosition();
553
+ }
554
+ async manageDelay(i) {
555
+ if (i === !1 || i !== this.open) {
556
+ bt.close(this);
557
+ return;
558
+ }
559
+ this.delayed && await bt.openTimer(this) && (this.open = !i);
560
+ }
561
+ async ensureOnDOM(i) {
562
+ document.body.offsetHeight;
563
+ }
564
+ async makeTransition(i) {
565
+ if (this.open !== i)
566
+ return null;
567
+ let s = null;
568
+ const r = (a, l) => () => {
569
+ if (i !== this.open)
570
+ return;
571
+ if (a.open = i, l === 0) {
572
+ const h = i ? Jt : Qt;
573
+ this.dispatchEvent(new h());
574
+ }
575
+ if (i !== !0 || (a.matches(ft) && (s = a), s = s || Yt(a), s))
576
+ return;
577
+ a.querySelectorAll("slot").forEach((h) => {
578
+ s || (s = Kt(h));
579
+ });
580
+ }, n = (a, l) => async () => {
581
+ if (this.open !== i)
582
+ return;
583
+ const c = i ? "cx-opened" : "cx-closed";
584
+ if (a.dispatchEvent(
585
+ new $(c, this, {
586
+ interaction: this.type
587
+ })
588
+ ), l > 0)
589
+ return;
590
+ const h = this.triggerElement instanceof Pt;
591
+ this.dispatchEvent(
592
+ new $(c, this, {
593
+ interaction: this.type,
594
+ publish: h
595
+ })
596
+ ), this.triggerElement && !h && this.triggerElement.dispatchEvent(
597
+ new $(c, this, {
598
+ interaction: this.type,
599
+ publish: !0
600
+ })
601
+ ), this.state = i ? "opened" : "closed", this.returnFocus(), await k(), await k(), i === this.open && i === !1 && this.requestSlottable();
602
+ };
603
+ return this.elements.forEach((a, l) => {
604
+ Gt(a, r(a, l), n(a, l));
605
+ }), s;
606
+ }
607
+ }
608
+ return t;
609
+ }
610
+ const mi = CSS.supports("(overlay: auto)");
611
+ function _t(e) {
612
+ let t = !1;
613
+ try {
614
+ t = e.matches(":popover-open");
615
+ } catch {
616
+ }
617
+ let o = !1;
618
+ try {
619
+ o = e.matches(":open");
620
+ } catch {
621
+ }
622
+ return t || o;
623
+ }
624
+ function yi(e) {
625
+ class t extends e {
626
+ constructor(...i) {
627
+ super(...i), this.handleFullscreenChange = this.handleFullscreenChange.bind(this);
628
+ }
629
+ async manageDelay(i) {
630
+ if (i === !1 || i !== this.open) {
631
+ bt.close(this);
632
+ return;
633
+ }
634
+ this.delayed && await bt.openTimer(this) && (this.open = !i);
635
+ }
636
+ /**
637
+ * A popover should be hidden _after_ it is no longer on top-layer because
638
+ * the position metrics will have changed from when it was originally positioned.
639
+ */
640
+ async shouldHidePopover(i) {
641
+ if (i && this.open !== i)
642
+ return;
643
+ const s = async ({
644
+ newState: r
645
+ } = {}) => {
646
+ r !== "open" && await this.placementController.resetOverlayPosition();
647
+ };
648
+ if (!_t(this.dialogEl)) {
649
+ s();
650
+ return;
651
+ }
652
+ this.dialogEl.addEventListener("toggle", s, {
653
+ once: !0
654
+ });
655
+ }
656
+ async shouldShowPopover(i) {
657
+ let s = !1;
658
+ try {
659
+ s = this.dialogEl.matches(":popover-open");
660
+ } catch {
661
+ }
662
+ let r = !1;
663
+ try {
664
+ r = this.dialogEl.matches(":open");
665
+ } catch {
666
+ }
667
+ i && this.open === i && !s && !r && this.isConnected && (this.dialogEl.showPopover(), await this.managePosition());
668
+ }
669
+ handleFullscreenChange() {
670
+ _t(this.dialogEl) && (this.dialogEl.hidePopover(), this.dialogEl.showPopover());
671
+ }
672
+ firstUpdated(i) {
673
+ super.firstUpdated(i), Lt() && (k().then(() => {
674
+ this.dialogEl.showPopover();
675
+ }), document.addEventListener(
676
+ "fullscreenchange",
677
+ this.handleFullscreenChange
678
+ ));
679
+ }
680
+ disconnectedCallback() {
681
+ super.disconnectedCallback(), Lt() && document.removeEventListener(
682
+ "fullscreenchange",
683
+ this.handleFullscreenChange
684
+ );
685
+ }
686
+ async ensureOnDOM(i) {
687
+ await k(), mi || await this.shouldHidePopover(i), await this.shouldShowPopover(i), await k();
688
+ }
689
+ async makeTransition(i) {
690
+ if (this.open !== i)
691
+ return null;
692
+ let s = null;
693
+ const r = (a, l) => () => {
694
+ if (a.open = i, l === 0) {
695
+ const h = i ? Jt : Qt;
696
+ this.dispatchEvent(new h());
697
+ }
698
+ if (!i || (a.matches(ft) && (s = a), s = s || Yt(a), s))
699
+ return;
700
+ a.querySelectorAll("slot").forEach((h) => {
701
+ s || (s = Kt(h));
702
+ });
703
+ }, n = (a, l) => async () => {
704
+ if (this.open !== i)
705
+ return;
706
+ const c = i ? "cx-opened" : "cx-closed";
707
+ if (l > 0) {
708
+ a.dispatchEvent(
709
+ new $(c, this, {
710
+ interaction: this.type,
711
+ publish: !1
712
+ })
713
+ );
714
+ return;
715
+ }
716
+ const h = async () => {
717
+ if (this.open !== i)
718
+ return;
719
+ await k();
720
+ const u = this.triggerElement instanceof Pt;
721
+ this.dispatchEvent(
722
+ new $(c, this, {
723
+ interaction: this.type,
724
+ publish: u
725
+ })
726
+ ), a.dispatchEvent(
727
+ new $(c, this, {
728
+ interaction: this.type,
729
+ publish: !1
730
+ })
731
+ ), this.triggerElement && !u && this.triggerElement.dispatchEvent(
732
+ new $(c, this, {
733
+ interaction: this.type,
734
+ publish: !0
735
+ })
736
+ ), this.state = i ? "opened" : "closed", this.returnFocus(), await k(), await k(), i === this.open && i === !1 && this.requestSlottable();
737
+ };
738
+ if (this.open !== i)
739
+ return;
740
+ const d = _t(this.dialogEl);
741
+ i !== !0 && d && this.isConnected ? (this.dialogEl.addEventListener(
742
+ "beforetoggle",
743
+ () => {
744
+ h();
745
+ },
746
+ { once: !0 }
747
+ ), Lt() || this.dialogEl.hidePopover()) : h();
748
+ };
749
+ return this.elements.forEach((a, l) => {
750
+ Gt(a, r(a, l), n(a, l));
751
+ }), s;
752
+ }
753
+ }
754
+ return t;
755
+ }
756
+ const vi = "showPopover" in document.createElement("div");
757
+ class bi {
758
+ constructor() {
759
+ this.root = document.body, this.stack = [], this.handlePointerdown = (t) => {
760
+ this.pointerdownPath = t.composedPath(), this.lastOverlay = this.stack[this.stack.length - 1];
761
+ }, this.handlePointerup = () => {
762
+ const t = this.pointerdownPath;
763
+ if (this.pointerdownPath = void 0, !this.stack.length || !t?.length)
764
+ return;
765
+ const o = this.stack.length - 1, i = this.stack.filter((s, r) => !t.find(
766
+ (a) => (
767
+ // The Overlay is in the stack
768
+ a === s || // The Overlay trigger is in the stack and the Overlay is a "hint"
769
+ a === s?.triggerElement && s?.type === "hint" || // The last Overlay in the stack is not the last Overlay at `pointerdown` time and has a
770
+ // `triggerInteraction` of "longpress", meaning it was opened by this poitner interaction
771
+ r === o && s !== this.lastOverlay && s.triggerInteraction === "longpress"
772
+ )
773
+ ) && !s.shouldPreventClose() && s.type !== "manual");
774
+ i.reverse(), i.forEach((s) => {
775
+ this.closeOverlay(s);
776
+ let r = s.parentOverlayToForceClose;
777
+ for (; r; )
778
+ this.closeOverlay(r), r = r.parentOverlayToForceClose;
779
+ });
780
+ }, this.handleBeforetoggle = (t) => {
781
+ const { newState: o, target: i } = t;
782
+ o !== "open" && this.closeOverlay(i);
783
+ }, this.handleKeydown = (t) => {
784
+ if (t.code !== "Escape" || !this.stack.length)
785
+ return;
786
+ const o = this.stack[this.stack.length - 1];
787
+ if (o?.type === "page") {
788
+ t.preventDefault();
789
+ return;
790
+ }
791
+ vi || o?.type !== "manual" && o && this.closeOverlay(o);
792
+ }, this.bindEvents();
793
+ }
794
+ get document() {
795
+ return this.root?.ownerDocument || document;
796
+ }
797
+ bindEvents() {
798
+ this.document.addEventListener("pointerdown", this.handlePointerdown), this.document.addEventListener("pointerup", this.handlePointerup), this.document.addEventListener("keydown", this.handleKeydown);
799
+ }
800
+ closeOverlay(t) {
801
+ const o = this.stack.indexOf(t);
802
+ o > -1 && this.stack.splice(o, 1), t.open = !1;
803
+ }
804
+ /**
805
+ * Get an array of Overlays that all share the same trigger element.
806
+ *
807
+ * @param triggerElement {HTMLELement}
808
+ * @returns {Overlay[]}
809
+ */
810
+ overlaysByTriggerElement(t) {
811
+ return this.stack.filter(
812
+ (o) => o.triggerElement === t
813
+ );
814
+ }
815
+ /**
816
+ * When overlays are added manage the open state of exisiting overlays appropriately:
817
+ * - 'modal': should close other overlays
818
+ * - 'page': should close other overlays
819
+ * - 'auto': should close other 'auto' overlays and other 'hint' overlays, but not 'manual' overlays
820
+ * - 'manual': shouldn't close other overlays
821
+ * - 'hint': shouldn't close other overlays and give way to all other overlays on a trigger
822
+ */
823
+ add(t) {
824
+ if (this.stack.includes(t)) {
825
+ const o = this.stack.indexOf(t);
826
+ o > -1 && (this.stack.splice(o, 1), this.stack.push(t));
827
+ return;
828
+ }
829
+ if (t.type === "auto" || t.type === "modal" || t.type === "page") {
830
+ const o = "cx-overlay-query-path", i = new Event(o, {
831
+ bubbles: !0,
832
+ composed: !0
833
+ });
834
+ t.addEventListener(
835
+ o,
836
+ (s) => {
837
+ const r = s.composedPath();
838
+ this.stack.forEach((n) => {
839
+ !r.find((l) => l === n) && n.type !== "manual" && this.closeOverlay(n);
840
+ });
841
+ },
842
+ { once: !0 }
843
+ ), t.dispatchEvent(i);
844
+ } else if (t.type === "hint") {
845
+ if (this.stack.some((i) => i.type !== "manual" && i.triggerElement && i.triggerElement === t.triggerElement)) {
846
+ t.open = !1;
847
+ return;
848
+ }
849
+ this.stack.forEach((i) => {
850
+ i.type === "hint" && this.closeOverlay(i);
851
+ });
852
+ }
853
+ requestAnimationFrame(() => {
854
+ this.stack.push(t), t.addEventListener("beforetoggle", this.handleBeforetoggle, {
855
+ once: !0
856
+ });
857
+ });
858
+ }
859
+ remove(t) {
860
+ this.closeOverlay(t);
861
+ }
862
+ }
863
+ const he = new bi(), wi = ["top", "right", "bottom", "left"], J = Math.min, T = Math.max, wt = Math.round, mt = Math.floor, H = (e) => ({
864
+ x: e,
865
+ y: e
866
+ }), xi = {
867
+ left: "right",
868
+ right: "left",
869
+ bottom: "top",
870
+ top: "bottom"
871
+ }, Ei = {
872
+ start: "end",
873
+ end: "start"
874
+ };
875
+ function zt(e, t, o) {
876
+ return T(e, J(t, o));
877
+ }
878
+ function st(e, t) {
879
+ return typeof e == "function" ? e(t) : e;
880
+ }
881
+ function Z(e) {
882
+ return e.split("-")[0];
883
+ }
884
+ function at(e) {
885
+ return e.split("-")[1];
886
+ }
887
+ function Ee(e) {
888
+ return e === "x" ? "y" : "x";
889
+ }
890
+ function Zt(e) {
891
+ return e === "y" ? "height" : "width";
892
+ }
893
+ const Pi = /* @__PURE__ */ new Set(["top", "bottom"]);
894
+ function Y(e) {
895
+ return Pi.has(Z(e)) ? "y" : "x";
896
+ }
897
+ function te(e) {
898
+ return Ee(Y(e));
899
+ }
900
+ function Ci(e, t, o) {
901
+ o === void 0 && (o = !1);
902
+ const i = at(e), s = te(e), r = Zt(s);
903
+ let n = s === "x" ? i === (o ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
904
+ return t.reference[r] > t.floating[r] && (n = xt(n)), [n, xt(n)];
905
+ }
906
+ function Oi(e) {
907
+ const t = xt(e);
908
+ return [Bt(e), t, Bt(t)];
909
+ }
910
+ function Bt(e) {
911
+ return e.replace(/start|end/g, (t) => Ei[t]);
912
+ }
913
+ const de = ["left", "right"], pe = ["right", "left"], Ai = ["top", "bottom"], Si = ["bottom", "top"];
914
+ function Ri(e, t, o) {
915
+ switch (e) {
916
+ case "top":
917
+ case "bottom":
918
+ return o ? t ? pe : de : t ? de : pe;
919
+ case "left":
920
+ case "right":
921
+ return t ? Ai : Si;
922
+ default:
923
+ return [];
924
+ }
925
+ }
926
+ function Ti(e, t, o, i) {
927
+ const s = at(e);
928
+ let r = Ri(Z(e), o === "start", i);
929
+ return s && (r = r.map((n) => n + "-" + s), t && (r = r.concat(r.map(Bt)))), r;
930
+ }
931
+ function xt(e) {
932
+ return e.replace(/left|right|bottom|top/g, (t) => xi[t]);
933
+ }
934
+ function Li(e) {
935
+ return {
936
+ top: 0,
937
+ right: 0,
938
+ bottom: 0,
939
+ left: 0,
940
+ ...e
941
+ };
942
+ }
943
+ function Pe(e) {
944
+ return typeof e != "number" ? Li(e) : {
945
+ top: e,
946
+ right: e,
947
+ bottom: e,
948
+ left: e
949
+ };
950
+ }
951
+ function Et(e) {
952
+ const {
953
+ x: t,
954
+ y: o,
955
+ width: i,
956
+ height: s
957
+ } = e;
958
+ return {
959
+ width: i,
960
+ height: s,
961
+ top: o,
962
+ left: t,
963
+ right: t + i,
964
+ bottom: o + s,
965
+ x: t,
966
+ y: o
967
+ };
968
+ }
969
+ function ue(e, t, o) {
970
+ let {
971
+ reference: i,
972
+ floating: s
973
+ } = e;
974
+ const r = Y(t), n = te(t), a = Zt(n), l = Z(t), c = r === "y", h = i.x + i.width / 2 - s.width / 2, d = i.y + i.height / 2 - s.height / 2, u = i[a] / 2 - s[a] / 2;
975
+ let p;
976
+ switch (l) {
977
+ case "top":
978
+ p = {
979
+ x: h,
980
+ y: i.y - s.height
981
+ };
982
+ break;
983
+ case "bottom":
984
+ p = {
985
+ x: h,
986
+ y: i.y + i.height
987
+ };
988
+ break;
989
+ case "right":
990
+ p = {
991
+ x: i.x + i.width,
992
+ y: d
993
+ };
994
+ break;
995
+ case "left":
996
+ p = {
997
+ x: i.x - s.width,
998
+ y: d
999
+ };
1000
+ break;
1001
+ default:
1002
+ p = {
1003
+ x: i.x,
1004
+ y: i.y
1005
+ };
1006
+ }
1007
+ switch (at(t)) {
1008
+ case "start":
1009
+ p[n] -= u * (o && c ? -1 : 1);
1010
+ break;
1011
+ case "end":
1012
+ p[n] += u * (o && c ? -1 : 1);
1013
+ break;
1014
+ }
1015
+ return p;
1016
+ }
1017
+ const Di = async (e, t, o) => {
1018
+ const {
1019
+ placement: i = "bottom",
1020
+ strategy: s = "absolute",
1021
+ middleware: r = [],
1022
+ platform: n
1023
+ } = o, a = r.filter(Boolean), l = await (n.isRTL == null ? void 0 : n.isRTL(t));
1024
+ let c = await n.getElementRects({
1025
+ reference: e,
1026
+ floating: t,
1027
+ strategy: s
1028
+ }), {
1029
+ x: h,
1030
+ y: d
1031
+ } = ue(c, i, l), u = i, p = {}, f = 0;
1032
+ for (let g = 0; g < a.length; g++) {
1033
+ const {
1034
+ name: m,
1035
+ fn: y
1036
+ } = a[g], {
1037
+ x,
1038
+ y: E,
1039
+ data: C,
1040
+ reset: P
1041
+ } = await y({
1042
+ x: h,
1043
+ y: d,
1044
+ initialPlacement: i,
1045
+ placement: u,
1046
+ strategy: s,
1047
+ middlewareData: p,
1048
+ rects: c,
1049
+ platform: n,
1050
+ elements: {
1051
+ reference: e,
1052
+ floating: t
1053
+ }
1054
+ });
1055
+ h = x ?? h, d = E ?? d, p = {
1056
+ ...p,
1057
+ [m]: {
1058
+ ...p[m],
1059
+ ...C
1060
+ }
1061
+ }, P && f <= 50 && (f++, typeof P == "object" && (P.placement && (u = P.placement), P.rects && (c = P.rects === !0 ? await n.getElementRects({
1062
+ reference: e,
1063
+ floating: t,
1064
+ strategy: s
1065
+ }) : P.rects), {
1066
+ x: h,
1067
+ y: d
1068
+ } = ue(c, u, l)), g = -1);
1069
+ }
1070
+ return {
1071
+ x: h,
1072
+ y: d,
1073
+ placement: u,
1074
+ strategy: s,
1075
+ middlewareData: p
1076
+ };
1077
+ };
1078
+ async function dt(e, t) {
1079
+ var o;
1080
+ t === void 0 && (t = {});
1081
+ const {
1082
+ x: i,
1083
+ y: s,
1084
+ platform: r,
1085
+ rects: n,
1086
+ elements: a,
1087
+ strategy: l
1088
+ } = e, {
1089
+ boundary: c = "clippingAncestors",
1090
+ rootBoundary: h = "viewport",
1091
+ elementContext: d = "floating",
1092
+ altBoundary: u = !1,
1093
+ padding: p = 0
1094
+ } = st(t, e), f = Pe(p), m = a[u ? d === "floating" ? "reference" : "floating" : d], y = Et(await r.getClippingRect({
1095
+ element: (o = await (r.isElement == null ? void 0 : r.isElement(m))) == null || o ? m : m.contextElement || await (r.getDocumentElement == null ? void 0 : r.getDocumentElement(a.floating)),
1096
+ boundary: c,
1097
+ rootBoundary: h,
1098
+ strategy: l
1099
+ })), x = d === "floating" ? {
1100
+ x: i,
1101
+ y: s,
1102
+ width: n.floating.width,
1103
+ height: n.floating.height
1104
+ } : n.reference, E = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(a.floating)), C = await (r.isElement == null ? void 0 : r.isElement(E)) ? await (r.getScale == null ? void 0 : r.getScale(E)) || {
1105
+ x: 1,
1106
+ y: 1
1107
+ } : {
1108
+ x: 1,
1109
+ y: 1
1110
+ }, P = Et(r.convertOffsetParentRelativeRectToViewportRelativeRect ? await r.convertOffsetParentRelativeRectToViewportRelativeRect({
1111
+ elements: a,
1112
+ rect: x,
1113
+ offsetParent: E,
1114
+ strategy: l
1115
+ }) : x);
1116
+ return {
1117
+ top: (y.top - P.top + f.top) / C.y,
1118
+ bottom: (P.bottom - y.bottom + f.bottom) / C.y,
1119
+ left: (y.left - P.left + f.left) / C.x,
1120
+ right: (P.right - y.right + f.right) / C.x
1121
+ };
1122
+ }
1123
+ const ki = (e) => ({
1124
+ name: "arrow",
1125
+ options: e,
1126
+ async fn(t) {
1127
+ const {
1128
+ x: o,
1129
+ y: i,
1130
+ placement: s,
1131
+ rects: r,
1132
+ platform: n,
1133
+ elements: a,
1134
+ middlewareData: l
1135
+ } = t, {
1136
+ element: c,
1137
+ padding: h = 0
1138
+ } = st(e, t) || {};
1139
+ if (c == null)
1140
+ return {};
1141
+ const d = Pe(h), u = {
1142
+ x: o,
1143
+ y: i
1144
+ }, p = te(s), f = Zt(p), g = await n.getDimensions(c), m = p === "y", y = m ? "top" : "left", x = m ? "bottom" : "right", E = m ? "clientHeight" : "clientWidth", C = r.reference[f] + r.reference[p] - u[p] - r.floating[f], P = u[p] - r.reference[p], _ = await (n.getOffsetParent == null ? void 0 : n.getOffsetParent(c));
1145
+ let O = _ ? _[E] : 0;
1146
+ (!O || !await (n.isElement == null ? void 0 : n.isElement(_))) && (O = a.floating[E] || r.floating[f]);
1147
+ const V = C / 2 - P / 2, I = O / 2 - g[f] / 2 - 1, D = J(d[y], I), X = J(d[x], I), M = D, G = O - g[f] - X, S = O / 2 - g[f] / 2 + V, et = zt(M, S, G), U = !l.arrow && at(s) != null && S !== et && r.reference[f] / 2 - (S < M ? D : X) - g[f] / 2 < 0, F = U ? S < M ? S - M : S - G : 0;
1148
+ return {
1149
+ [p]: u[p] + F,
1150
+ data: {
1151
+ [p]: et,
1152
+ centerOffset: S - et - F,
1153
+ ...U && {
1154
+ alignmentOffset: F
1155
+ }
1156
+ },
1157
+ reset: U
1158
+ };
1159
+ }
1160
+ }), _i = function(e) {
1161
+ return e === void 0 && (e = {}), {
1162
+ name: "flip",
1163
+ options: e,
1164
+ async fn(t) {
1165
+ var o, i;
1166
+ const {
1167
+ placement: s,
1168
+ middlewareData: r,
1169
+ rects: n,
1170
+ initialPlacement: a,
1171
+ platform: l,
1172
+ elements: c
1173
+ } = t, {
1174
+ mainAxis: h = !0,
1175
+ crossAxis: d = !0,
1176
+ fallbackPlacements: u,
1177
+ fallbackStrategy: p = "bestFit",
1178
+ fallbackAxisSideDirection: f = "none",
1179
+ flipAlignment: g = !0,
1180
+ ...m
1181
+ } = st(e, t);
1182
+ if ((o = r.arrow) != null && o.alignmentOffset)
1183
+ return {};
1184
+ const y = Z(s), x = Y(a), E = Z(a) === a, C = await (l.isRTL == null ? void 0 : l.isRTL(c.floating)), P = u || (E || !g ? [xt(a)] : Oi(a)), _ = f !== "none";
1185
+ !u && _ && P.push(...Ti(a, g, f, C));
1186
+ const O = [a, ...P], V = await dt(t, m), I = [];
1187
+ let D = ((i = r.flip) == null ? void 0 : i.overflows) || [];
1188
+ if (h && I.push(V[y]), d) {
1189
+ const S = Ci(s, n, C);
1190
+ I.push(V[S[0]], V[S[1]]);
1191
+ }
1192
+ if (D = [...D, {
1193
+ placement: s,
1194
+ overflows: I
1195
+ }], !I.every((S) => S <= 0)) {
1196
+ var X, M;
1197
+ const S = (((X = r.flip) == null ? void 0 : X.index) || 0) + 1, et = O[S];
1198
+ if (et && (!(d === "alignment" ? x !== Y(et) : !1) || // We leave the current main axis only if every placement on that axis
1199
+ // overflows the main axis.
1200
+ D.every((N) => Y(N.placement) === x ? N.overflows[0] > 0 : !0)))
1201
+ return {
1202
+ data: {
1203
+ index: S,
1204
+ overflows: D
1205
+ },
1206
+ reset: {
1207
+ placement: et
1208
+ }
1209
+ };
1210
+ let U = (M = D.filter((F) => F.overflows[0] <= 0).sort((F, N) => F.overflows[1] - N.overflows[1])[0]) == null ? void 0 : M.placement;
1211
+ if (!U)
1212
+ switch (p) {
1213
+ case "bestFit": {
1214
+ var G;
1215
+ const F = (G = D.filter((N) => {
1216
+ if (_) {
1217
+ const Q = Y(N.placement);
1218
+ return Q === x || // Create a bias to the `y` side axis due to horizontal
1219
+ // reading directions favoring greater width.
1220
+ Q === "y";
1221
+ }
1222
+ return !0;
1223
+ }).map((N) => [N.placement, N.overflows.filter((Q) => Q > 0).reduce((Q, Be) => Q + Be, 0)]).sort((N, Q) => N[1] - Q[1])[0]) == null ? void 0 : G[0];
1224
+ F && (U = F);
1225
+ break;
1226
+ }
1227
+ case "initialPlacement":
1228
+ U = a;
1229
+ break;
1230
+ }
1231
+ if (s !== U)
1232
+ return {
1233
+ reset: {
1234
+ placement: U
1235
+ }
1236
+ };
1237
+ }
1238
+ return {};
1239
+ }
1240
+ };
1241
+ };
1242
+ function fe(e, t) {
1243
+ return {
1244
+ top: e.top - t.height,
1245
+ right: e.right - t.width,
1246
+ bottom: e.bottom - t.height,
1247
+ left: e.left - t.width
1248
+ };
1249
+ }
1250
+ function ge(e) {
1251
+ return wi.some((t) => e[t] >= 0);
1252
+ }
1253
+ const Fi = function(e) {
1254
+ return e === void 0 && (e = {}), {
1255
+ name: "hide",
1256
+ options: e,
1257
+ async fn(t) {
1258
+ const {
1259
+ rects: o
1260
+ } = t, {
1261
+ strategy: i = "referenceHidden",
1262
+ ...s
1263
+ } = st(e, t);
1264
+ switch (i) {
1265
+ case "referenceHidden": {
1266
+ const r = await dt(t, {
1267
+ ...s,
1268
+ elementContext: "reference"
1269
+ }), n = fe(r, o.reference);
1270
+ return {
1271
+ data: {
1272
+ referenceHiddenOffsets: n,
1273
+ referenceHidden: ge(n)
1274
+ }
1275
+ };
1276
+ }
1277
+ case "escaped": {
1278
+ const r = await dt(t, {
1279
+ ...s,
1280
+ altBoundary: !0
1281
+ }), n = fe(r, o.floating);
1282
+ return {
1283
+ data: {
1284
+ escapedOffsets: n,
1285
+ escaped: ge(n)
1286
+ }
1287
+ };
1288
+ }
1289
+ default:
1290
+ return {};
1291
+ }
1292
+ }
1293
+ };
1294
+ }, Ni = /* @__PURE__ */ new Set(["left", "top"]);
1295
+ async function $i(e, t) {
1296
+ const {
1297
+ placement: o,
1298
+ platform: i,
1299
+ elements: s
1300
+ } = e, r = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), n = Z(o), a = at(o), l = Y(o) === "y", c = Ni.has(n) ? -1 : 1, h = r && l ? -1 : 1, d = st(t, e);
1301
+ let {
1302
+ mainAxis: u,
1303
+ crossAxis: p,
1304
+ alignmentAxis: f
1305
+ } = typeof d == "number" ? {
1306
+ mainAxis: d,
1307
+ crossAxis: 0,
1308
+ alignmentAxis: null
1309
+ } : {
1310
+ mainAxis: d.mainAxis || 0,
1311
+ crossAxis: d.crossAxis || 0,
1312
+ alignmentAxis: d.alignmentAxis
1313
+ };
1314
+ return a && typeof f == "number" && (p = a === "end" ? f * -1 : f), l ? {
1315
+ x: p * h,
1316
+ y: u * c
1317
+ } : {
1318
+ x: u * c,
1319
+ y: p * h
1320
+ };
1321
+ }
1322
+ const zi = function(e) {
1323
+ return e === void 0 && (e = 0), {
1324
+ name: "offset",
1325
+ options: e,
1326
+ async fn(t) {
1327
+ var o, i;
1328
+ const {
1329
+ x: s,
1330
+ y: r,
1331
+ placement: n,
1332
+ middlewareData: a
1333
+ } = t, l = await $i(t, e);
1334
+ return n === ((o = a.offset) == null ? void 0 : o.placement) && (i = a.arrow) != null && i.alignmentOffset ? {} : {
1335
+ x: s + l.x,
1336
+ y: r + l.y,
1337
+ data: {
1338
+ ...l,
1339
+ placement: n
1340
+ }
1341
+ };
1342
+ }
1343
+ };
1344
+ }, Bi = function(e) {
1345
+ return e === void 0 && (e = {}), {
1346
+ name: "shift",
1347
+ options: e,
1348
+ async fn(t) {
1349
+ const {
1350
+ x: o,
1351
+ y: i,
1352
+ placement: s
1353
+ } = t, {
1354
+ mainAxis: r = !0,
1355
+ crossAxis: n = !1,
1356
+ limiter: a = {
1357
+ fn: (m) => {
1358
+ let {
1359
+ x: y,
1360
+ y: x
1361
+ } = m;
1362
+ return {
1363
+ x: y,
1364
+ y: x
1365
+ };
1366
+ }
1367
+ },
1368
+ ...l
1369
+ } = st(e, t), c = {
1370
+ x: o,
1371
+ y: i
1372
+ }, h = await dt(t, l), d = Y(Z(s)), u = Ee(d);
1373
+ let p = c[u], f = c[d];
1374
+ if (r) {
1375
+ const m = u === "y" ? "top" : "left", y = u === "y" ? "bottom" : "right", x = p + h[m], E = p - h[y];
1376
+ p = zt(x, p, E);
1377
+ }
1378
+ if (n) {
1379
+ const m = d === "y" ? "top" : "left", y = d === "y" ? "bottom" : "right", x = f + h[m], E = f - h[y];
1380
+ f = zt(x, f, E);
1381
+ }
1382
+ const g = a.fn({
1383
+ ...t,
1384
+ [u]: p,
1385
+ [d]: f
1386
+ });
1387
+ return {
1388
+ ...g,
1389
+ data: {
1390
+ x: g.x - o,
1391
+ y: g.y - i,
1392
+ enabled: {
1393
+ [u]: r,
1394
+ [d]: n
1395
+ }
1396
+ }
1397
+ };
1398
+ }
1399
+ };
1400
+ }, Ii = function(e) {
1401
+ return e === void 0 && (e = {}), {
1402
+ name: "size",
1403
+ options: e,
1404
+ async fn(t) {
1405
+ var o, i;
1406
+ const {
1407
+ placement: s,
1408
+ rects: r,
1409
+ platform: n,
1410
+ elements: a
1411
+ } = t, {
1412
+ apply: l = () => {
1413
+ },
1414
+ ...c
1415
+ } = st(e, t), h = await dt(t, c), d = Z(s), u = at(s), p = Y(s) === "y", {
1416
+ width: f,
1417
+ height: g
1418
+ } = r.floating;
1419
+ let m, y;
1420
+ d === "top" || d === "bottom" ? (m = d, y = u === (await (n.isRTL == null ? void 0 : n.isRTL(a.floating)) ? "start" : "end") ? "left" : "right") : (y = d, m = u === "end" ? "top" : "bottom");
1421
+ const x = g - h.top - h.bottom, E = f - h.left - h.right, C = J(g - h[m], x), P = J(f - h[y], E), _ = !t.middlewareData.shift;
1422
+ let O = C, V = P;
1423
+ if ((o = t.middlewareData.shift) != null && o.enabled.x && (V = E), (i = t.middlewareData.shift) != null && i.enabled.y && (O = x), _ && !u) {
1424
+ const D = T(h.left, 0), X = T(h.right, 0), M = T(h.top, 0), G = T(h.bottom, 0);
1425
+ p ? V = f - 2 * (D !== 0 || X !== 0 ? D + X : T(h.left, h.right)) : O = g - 2 * (M !== 0 || G !== 0 ? M + G : T(h.top, h.bottom));
1426
+ }
1427
+ await l({
1428
+ ...t,
1429
+ availableWidth: V,
1430
+ availableHeight: O
1431
+ });
1432
+ const I = await n.getDimensions(a.floating);
1433
+ return f !== I.width || g !== I.height ? {
1434
+ reset: {
1435
+ rects: !0
1436
+ }
1437
+ } : {};
1438
+ }
1439
+ };
1440
+ };
1441
+ function Ct() {
1442
+ return typeof window < "u";
1443
+ }
1444
+ function lt(e) {
1445
+ return Ce(e) ? (e.nodeName || "").toLowerCase() : "#document";
1446
+ }
1447
+ function L(e) {
1448
+ var t;
1449
+ return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
1450
+ }
1451
+ function q(e) {
1452
+ var t;
1453
+ return (t = (Ce(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
1454
+ }
1455
+ function Ce(e) {
1456
+ return Ct() ? e instanceof Node || e instanceof L(e).Node : !1;
1457
+ }
1458
+ function z(e) {
1459
+ return Ct() ? e instanceof Element || e instanceof L(e).Element : !1;
1460
+ }
1461
+ function W(e) {
1462
+ return Ct() ? e instanceof HTMLElement || e instanceof L(e).HTMLElement : !1;
1463
+ }
1464
+ function me(e) {
1465
+ return !Ct() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof L(e).ShadowRoot;
1466
+ }
1467
+ const Mi = /* @__PURE__ */ new Set(["inline", "contents"]);
1468
+ function gt(e) {
1469
+ const {
1470
+ overflow: t,
1471
+ overflowX: o,
1472
+ overflowY: i,
1473
+ display: s
1474
+ } = B(e);
1475
+ return /auto|scroll|overlay|hidden|clip/.test(t + i + o) && !Mi.has(s);
1476
+ }
1477
+ const Hi = /* @__PURE__ */ new Set(["table", "td", "th"]);
1478
+ function Wi(e) {
1479
+ return Hi.has(lt(e));
1480
+ }
1481
+ const qi = [":popover-open", ":modal"];
1482
+ function Ot(e) {
1483
+ return qi.some((t) => {
1484
+ try {
1485
+ return e.matches(t);
1486
+ } catch {
1487
+ return !1;
1488
+ }
1489
+ });
1490
+ }
1491
+ const Vi = ["transform", "translate", "scale", "rotate", "perspective"], Ui = ["transform", "translate", "scale", "rotate", "perspective", "filter"], ji = ["paint", "layout", "strict", "content"];
1492
+ function At(e) {
1493
+ const t = ee(), o = z(e) ? B(e) : e;
1494
+ return Vi.some((i) => o[i] ? o[i] !== "none" : !1) || (o.containerType ? o.containerType !== "normal" : !1) || !t && (o.backdropFilter ? o.backdropFilter !== "none" : !1) || !t && (o.filter ? o.filter !== "none" : !1) || Ui.some((i) => (o.willChange || "").includes(i)) || ji.some((i) => (o.contain || "").includes(i));
1495
+ }
1496
+ function Yi(e) {
1497
+ let t = tt(e);
1498
+ for (; W(t) && !rt(t); ) {
1499
+ if (At(t))
1500
+ return t;
1501
+ if (Ot(t))
1502
+ return null;
1503
+ t = tt(t);
1504
+ }
1505
+ return null;
1506
+ }
1507
+ function ee() {
1508
+ return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
1509
+ }
1510
+ const Ki = /* @__PURE__ */ new Set(["html", "body", "#document"]);
1511
+ function rt(e) {
1512
+ return Ki.has(lt(e));
1513
+ }
1514
+ function B(e) {
1515
+ return L(e).getComputedStyle(e);
1516
+ }
1517
+ function St(e) {
1518
+ return z(e) ? {
1519
+ scrollLeft: e.scrollLeft,
1520
+ scrollTop: e.scrollTop
1521
+ } : {
1522
+ scrollLeft: e.scrollX,
1523
+ scrollTop: e.scrollY
1524
+ };
1525
+ }
1526
+ function tt(e) {
1527
+ if (lt(e) === "html")
1528
+ return e;
1529
+ const t = (
1530
+ // Step into the shadow DOM of the parent of a slotted node.
1531
+ e.assignedSlot || // DOM Element detected.
1532
+ e.parentNode || // ShadowRoot detected.
1533
+ me(e) && e.host || // Fallback.
1534
+ q(e)
1535
+ );
1536
+ return me(t) ? t.host : t;
1537
+ }
1538
+ function Oe(e) {
1539
+ const t = tt(e);
1540
+ return rt(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : W(t) && gt(t) ? t : Oe(t);
1541
+ }
1542
+ function pt(e, t, o) {
1543
+ var i;
1544
+ t === void 0 && (t = []), o === void 0 && (o = !0);
1545
+ const s = Oe(e), r = s === ((i = e.ownerDocument) == null ? void 0 : i.body), n = L(s);
1546
+ if (r) {
1547
+ const a = It(n);
1548
+ return t.concat(n, n.visualViewport || [], gt(s) ? s : [], a && o ? pt(a) : []);
1549
+ }
1550
+ return t.concat(s, pt(s, [], o));
1551
+ }
1552
+ function It(e) {
1553
+ return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
1554
+ }
1555
+ function Ae(e) {
1556
+ const t = B(e);
1557
+ let o = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
1558
+ const s = W(e), r = s ? e.offsetWidth : o, n = s ? e.offsetHeight : i, a = wt(o) !== r || wt(i) !== n;
1559
+ return a && (o = r, i = n), {
1560
+ width: o,
1561
+ height: i,
1562
+ $: a
1563
+ };
1564
+ }
1565
+ function ie(e) {
1566
+ return z(e) ? e : e.contextElement;
1567
+ }
1568
+ function nt(e) {
1569
+ const t = ie(e);
1570
+ if (!W(t))
1571
+ return H(1);
1572
+ const o = t.getBoundingClientRect(), {
1573
+ width: i,
1574
+ height: s,
1575
+ $: r
1576
+ } = Ae(t);
1577
+ let n = (r ? wt(o.width) : o.width) / i, a = (r ? wt(o.height) : o.height) / s;
1578
+ return (!n || !Number.isFinite(n)) && (n = 1), (!a || !Number.isFinite(a)) && (a = 1), {
1579
+ x: n,
1580
+ y: a
1581
+ };
1582
+ }
1583
+ const Xi = /* @__PURE__ */ H(0);
1584
+ function Se(e) {
1585
+ const t = L(e);
1586
+ return !ee() || !t.visualViewport ? Xi : {
1587
+ x: t.visualViewport.offsetLeft,
1588
+ y: t.visualViewport.offsetTop
1589
+ };
1590
+ }
1591
+ function Gi(e, t, o) {
1592
+ return t === void 0 && (t = !1), !o || t && o !== L(e) ? !1 : t;
1593
+ }
1594
+ function ot(e, t, o, i) {
1595
+ t === void 0 && (t = !1), o === void 0 && (o = !1);
1596
+ const s = e.getBoundingClientRect(), r = ie(e);
1597
+ let n = H(1);
1598
+ t && (i ? z(i) && (n = nt(i)) : n = nt(e));
1599
+ const a = Gi(r, o, i) ? Se(r) : H(0);
1600
+ let l = (s.left + a.x) / n.x, c = (s.top + a.y) / n.y, h = s.width / n.x, d = s.height / n.y;
1601
+ if (r) {
1602
+ const u = L(r), p = i && z(i) ? L(i) : i;
1603
+ let f = u, g = It(f);
1604
+ for (; g && i && p !== f; ) {
1605
+ const m = nt(g), y = g.getBoundingClientRect(), x = B(g), E = y.left + (g.clientLeft + parseFloat(x.paddingLeft)) * m.x, C = y.top + (g.clientTop + parseFloat(x.paddingTop)) * m.y;
1606
+ l *= m.x, c *= m.y, h *= m.x, d *= m.y, l += E, c += C, f = L(g), g = It(f);
1607
+ }
1608
+ }
1609
+ return Et({
1610
+ width: h,
1611
+ height: d,
1612
+ x: l,
1613
+ y: c
1614
+ });
1615
+ }
1616
+ function oe(e, t) {
1617
+ const o = St(e).scrollLeft;
1618
+ return t ? t.left + o : ot(q(e)).left + o;
1619
+ }
1620
+ function Re(e, t, o) {
1621
+ o === void 0 && (o = !1);
1622
+ const i = e.getBoundingClientRect(), s = i.left + t.scrollLeft - (o ? 0 : (
1623
+ // RTL <body> scrollbar.
1624
+ oe(e, i)
1625
+ )), r = i.top + t.scrollTop;
1626
+ return {
1627
+ x: s,
1628
+ y: r
1629
+ };
1630
+ }
1631
+ function Qi(e) {
1632
+ let {
1633
+ elements: t,
1634
+ rect: o,
1635
+ offsetParent: i,
1636
+ strategy: s
1637
+ } = e;
1638
+ const r = s === "fixed", n = q(i), a = t ? Ot(t.floating) : !1;
1639
+ if (i === n || a && r)
1640
+ return o;
1641
+ let l = {
1642
+ scrollLeft: 0,
1643
+ scrollTop: 0
1644
+ }, c = H(1);
1645
+ const h = H(0), d = W(i);
1646
+ if ((d || !d && !r) && ((lt(i) !== "body" || gt(n)) && (l = St(i)), W(i))) {
1647
+ const p = ot(i);
1648
+ c = nt(i), h.x = p.x + i.clientLeft, h.y = p.y + i.clientTop;
1649
+ }
1650
+ const u = n && !d && !r ? Re(n, l, !0) : H(0);
1651
+ return {
1652
+ width: o.width * c.x,
1653
+ height: o.height * c.y,
1654
+ x: o.x * c.x - l.scrollLeft * c.x + h.x + u.x,
1655
+ y: o.y * c.y - l.scrollTop * c.y + h.y + u.y
1656
+ };
1657
+ }
1658
+ function Ji(e) {
1659
+ return Array.from(e.getClientRects());
1660
+ }
1661
+ function Zi(e) {
1662
+ const t = q(e), o = St(e), i = e.ownerDocument.body, s = T(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), r = T(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
1663
+ let n = -o.scrollLeft + oe(e);
1664
+ const a = -o.scrollTop;
1665
+ return B(i).direction === "rtl" && (n += T(t.clientWidth, i.clientWidth) - s), {
1666
+ width: s,
1667
+ height: r,
1668
+ x: n,
1669
+ y: a
1670
+ };
1671
+ }
1672
+ function to(e, t) {
1673
+ const o = L(e), i = q(e), s = o.visualViewport;
1674
+ let r = i.clientWidth, n = i.clientHeight, a = 0, l = 0;
1675
+ if (s) {
1676
+ r = s.width, n = s.height;
1677
+ const c = ee();
1678
+ (!c || c && t === "fixed") && (a = s.offsetLeft, l = s.offsetTop);
1679
+ }
1680
+ return {
1681
+ width: r,
1682
+ height: n,
1683
+ x: a,
1684
+ y: l
1685
+ };
1686
+ }
1687
+ const eo = /* @__PURE__ */ new Set(["absolute", "fixed"]);
1688
+ function io(e, t) {
1689
+ const o = ot(e, !0, t === "fixed"), i = o.top + e.clientTop, s = o.left + e.clientLeft, r = W(e) ? nt(e) : H(1), n = e.clientWidth * r.x, a = e.clientHeight * r.y, l = s * r.x, c = i * r.y;
1690
+ return {
1691
+ width: n,
1692
+ height: a,
1693
+ x: l,
1694
+ y: c
1695
+ };
1696
+ }
1697
+ function ye(e, t, o) {
1698
+ let i;
1699
+ if (t === "viewport")
1700
+ i = to(e, o);
1701
+ else if (t === "document")
1702
+ i = Zi(q(e));
1703
+ else if (z(t))
1704
+ i = io(t, o);
1705
+ else {
1706
+ const s = Se(e);
1707
+ i = {
1708
+ x: t.x - s.x,
1709
+ y: t.y - s.y,
1710
+ width: t.width,
1711
+ height: t.height
1712
+ };
1713
+ }
1714
+ return Et(i);
1715
+ }
1716
+ function Te(e, t) {
1717
+ const o = tt(e);
1718
+ return o === t || !z(o) || rt(o) ? !1 : B(o).position === "fixed" || Te(o, t);
1719
+ }
1720
+ function oo(e, t) {
1721
+ const o = t.get(e);
1722
+ if (o)
1723
+ return o;
1724
+ let i = pt(e, [], !1).filter((a) => z(a) && lt(a) !== "body"), s = null;
1725
+ const r = B(e).position === "fixed";
1726
+ let n = r ? tt(e) : e;
1727
+ for (; z(n) && !rt(n); ) {
1728
+ const a = B(n), l = At(n);
1729
+ !l && a.position === "fixed" && (s = null), (r ? !l && !s : !l && a.position === "static" && !!s && eo.has(s.position) || gt(n) && !l && Te(e, n)) ? i = i.filter((h) => h !== n) : s = a, n = tt(n);
1730
+ }
1731
+ return t.set(e, i), i;
1732
+ }
1733
+ function so(e) {
1734
+ let {
1735
+ element: t,
1736
+ boundary: o,
1737
+ rootBoundary: i,
1738
+ strategy: s
1739
+ } = e;
1740
+ const n = [...o === "clippingAncestors" ? Ot(t) ? [] : oo(t, this._c) : [].concat(o), i], a = n[0], l = n.reduce((c, h) => {
1741
+ const d = ye(t, h, s);
1742
+ return c.top = T(d.top, c.top), c.right = J(d.right, c.right), c.bottom = J(d.bottom, c.bottom), c.left = T(d.left, c.left), c;
1743
+ }, ye(t, a, s));
1744
+ return {
1745
+ width: l.right - l.left,
1746
+ height: l.bottom - l.top,
1747
+ x: l.left,
1748
+ y: l.top
1749
+ };
1750
+ }
1751
+ function no(e) {
1752
+ const {
1753
+ width: t,
1754
+ height: o
1755
+ } = Ae(e);
1756
+ return {
1757
+ width: t,
1758
+ height: o
1759
+ };
1760
+ }
1761
+ function ro(e, t, o) {
1762
+ const i = W(t), s = q(t), r = o === "fixed", n = ot(e, !0, r, t);
1763
+ let a = {
1764
+ scrollLeft: 0,
1765
+ scrollTop: 0
1766
+ };
1767
+ const l = H(0);
1768
+ function c() {
1769
+ l.x = oe(s);
1770
+ }
1771
+ if (i || !i && !r)
1772
+ if ((lt(t) !== "body" || gt(s)) && (a = St(t)), i) {
1773
+ const p = ot(t, !0, r, t);
1774
+ l.x = p.x + t.clientLeft, l.y = p.y + t.clientTop;
1775
+ } else s && c();
1776
+ r && !i && s && c();
1777
+ const h = s && !i && !r ? Re(s, a) : H(0), d = n.left + a.scrollLeft - l.x - h.x, u = n.top + a.scrollTop - l.y - h.y;
1778
+ return {
1779
+ x: d,
1780
+ y: u,
1781
+ width: n.width,
1782
+ height: n.height
1783
+ };
1784
+ }
1785
+ function Ft(e) {
1786
+ return B(e).position === "static";
1787
+ }
1788
+ function ve(e, t) {
1789
+ if (!W(e) || B(e).position === "fixed")
1790
+ return null;
1791
+ if (t)
1792
+ return t(e);
1793
+ let o = e.offsetParent;
1794
+ return q(e) === o && (o = o.ownerDocument.body), o;
1795
+ }
1796
+ function Le(e, t) {
1797
+ const o = L(e);
1798
+ if (Ot(e))
1799
+ return o;
1800
+ if (!W(e)) {
1801
+ let s = tt(e);
1802
+ for (; s && !rt(s); ) {
1803
+ if (z(s) && !Ft(s))
1804
+ return s;
1805
+ s = tt(s);
1806
+ }
1807
+ return o;
1808
+ }
1809
+ let i = ve(e, t);
1810
+ for (; i && Wi(i) && Ft(i); )
1811
+ i = ve(i, t);
1812
+ return i && rt(i) && Ft(i) && !At(i) ? o : i || Yi(e) || o;
1813
+ }
1814
+ const ao = async function(e) {
1815
+ const t = this.getOffsetParent || Le, o = this.getDimensions, i = await o(e.floating);
1816
+ return {
1817
+ reference: ro(e.reference, await t(e.floating), e.strategy),
1818
+ floating: {
1819
+ x: 0,
1820
+ y: 0,
1821
+ width: i.width,
1822
+ height: i.height
1823
+ }
1824
+ };
1825
+ };
1826
+ function lo(e) {
1827
+ return B(e).direction === "rtl";
1828
+ }
1829
+ const Mt = {
1830
+ convertOffsetParentRelativeRectToViewportRelativeRect: Qi,
1831
+ getDocumentElement: q,
1832
+ getClippingRect: so,
1833
+ getOffsetParent: Le,
1834
+ getElementRects: ao,
1835
+ getClientRects: Ji,
1836
+ getDimensions: no,
1837
+ getScale: nt,
1838
+ isElement: z,
1839
+ isRTL: lo
1840
+ };
1841
+ function De(e, t) {
1842
+ return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
1843
+ }
1844
+ function co(e, t) {
1845
+ let o = null, i;
1846
+ const s = q(e);
1847
+ function r() {
1848
+ var a;
1849
+ clearTimeout(i), (a = o) == null || a.disconnect(), o = null;
1850
+ }
1851
+ function n(a, l) {
1852
+ a === void 0 && (a = !1), l === void 0 && (l = 1), r();
1853
+ const c = e.getBoundingClientRect(), {
1854
+ left: h,
1855
+ top: d,
1856
+ width: u,
1857
+ height: p
1858
+ } = c;
1859
+ if (a || t(), !u || !p)
1860
+ return;
1861
+ const f = mt(d), g = mt(s.clientWidth - (h + u)), m = mt(s.clientHeight - (d + p)), y = mt(h), E = {
1862
+ rootMargin: -f + "px " + -g + "px " + -m + "px " + -y + "px",
1863
+ threshold: T(0, J(1, l)) || 1
1864
+ };
1865
+ let C = !0;
1866
+ function P(_) {
1867
+ const O = _[0].intersectionRatio;
1868
+ if (O !== l) {
1869
+ if (!C)
1870
+ return n();
1871
+ O ? n(!1, O) : i = setTimeout(() => {
1872
+ n(!1, 1e-7);
1873
+ }, 1e3);
1874
+ }
1875
+ O === 1 && !De(c, e.getBoundingClientRect()) && n(), C = !1;
1876
+ }
1877
+ try {
1878
+ o = new IntersectionObserver(P, {
1879
+ ...E,
1880
+ // Handle <iframe>s
1881
+ root: s.ownerDocument
1882
+ });
1883
+ } catch {
1884
+ o = new IntersectionObserver(P, E);
1885
+ }
1886
+ o.observe(e);
1887
+ }
1888
+ return n(!0), r;
1889
+ }
1890
+ function Ht(e, t, o, i) {
1891
+ i === void 0 && (i = {});
1892
+ const {
1893
+ ancestorScroll: s = !0,
1894
+ ancestorResize: r = !0,
1895
+ elementResize: n = typeof ResizeObserver == "function",
1896
+ layoutShift: a = typeof IntersectionObserver == "function",
1897
+ animationFrame: l = !1
1898
+ } = i, c = ie(e), h = s || r ? [...c ? pt(c) : [], ...pt(t)] : [];
1899
+ h.forEach((y) => {
1900
+ s && y.addEventListener("scroll", o, {
1901
+ passive: !0
1902
+ }), r && y.addEventListener("resize", o);
1903
+ });
1904
+ const d = c && a ? co(c, o) : null;
1905
+ let u = -1, p = null;
1906
+ n && (p = new ResizeObserver((y) => {
1907
+ let [x] = y;
1908
+ x && x.target === c && p && (p.unobserve(t), cancelAnimationFrame(u), u = requestAnimationFrame(() => {
1909
+ var E;
1910
+ (E = p) == null || E.observe(t);
1911
+ })), o();
1912
+ }), c && !l && p.observe(c), p.observe(t));
1913
+ let f, g = l ? ot(e) : null;
1914
+ l && m();
1915
+ function m() {
1916
+ const y = ot(e);
1917
+ g && !De(g, y) && o(), g = y, f = requestAnimationFrame(m);
1918
+ }
1919
+ return o(), () => {
1920
+ var y;
1921
+ h.forEach((x) => {
1922
+ s && x.removeEventListener("scroll", o), r && x.removeEventListener("resize", o);
1923
+ }), d?.(), (y = p) == null || y.disconnect(), p = null, l && cancelAnimationFrame(f);
1924
+ };
1925
+ }
1926
+ const Wt = zi, ke = Bi, qt = _i, Vt = Ii, ho = Fi, _e = ki, Fe = (e, t, o) => {
1927
+ const i = /* @__PURE__ */ new Map(), s = {
1928
+ platform: Mt,
1929
+ ...o
1930
+ }, r = {
1931
+ ...s.platform,
1932
+ _c: i
1933
+ };
1934
+ return Di(e, t, {
1935
+ ...s,
1936
+ platform: r
1937
+ });
1938
+ };
1939
+ function yt(e) {
1940
+ if (typeof e > "u")
1941
+ return 0;
1942
+ const t = window.devicePixelRatio || 1;
1943
+ return Math.round(e * t) / t || -1e4;
1944
+ }
1945
+ const vt = 8, po = 100, uo = (e) => ({
1946
+ bottom: ["top", "left", "right"],
1947
+ "bottom-end": ["top-end", "left", "right"],
1948
+ "bottom-start": ["top-start", "left", "right"],
1949
+ left: ["right", "bottom", "top"],
1950
+ "left-end": ["right-end", "bottom", "top"],
1951
+ "left-start": ["right-start", "bottom", "top"],
1952
+ right: ["left", "bottom", "top"],
1953
+ "right-end": ["left-end", "bottom", "top"],
1954
+ "right-start": ["left-start", "bottom", "top"],
1955
+ top: ["bottom", "left", "right"],
1956
+ "top-end": ["bottom-end", "left", "right"],
1957
+ "top-start": ["bottom-start", "left", "right"]
1958
+ })[e] ?? [e];
1959
+ class fo {
1960
+ constructor(t) {
1961
+ this.originalPlacements = /* @__PURE__ */ new WeakMap(), this.allowPlacementUpdate = !1, this.closeForAncestorUpdate = () => {
1962
+ !this.allowPlacementUpdate && this.options.type !== "modal" && this.cleanup && this.target.dispatchEvent(new Event("close", { bubbles: !0 })), this.allowPlacementUpdate = !1;
1963
+ }, this.updatePlacement = () => {
1964
+ this.computePlacement();
1965
+ }, this.resetOverlayPosition = () => {
1966
+ !this.target || !this.options || (this.clearOverlayPosition(), this.host.offsetHeight, this.computePlacement());
1967
+ }, this.host = t, this.host.addController(this);
1968
+ }
1969
+ async placeOverlay(t = this.target, o = this.options) {
1970
+ if (this.target = t, this.options = o, !t || !o)
1971
+ return;
1972
+ const i = Ht(
1973
+ o.trigger,
1974
+ t,
1975
+ this.closeForAncestorUpdate,
1976
+ {
1977
+ ancestorResize: !1,
1978
+ elementResize: !1,
1979
+ layoutShift: !1
1980
+ }
1981
+ ), s = Ht(
1982
+ o.trigger,
1983
+ t,
1984
+ this.updatePlacement,
1985
+ {
1986
+ ancestorScroll: !1
1987
+ }
1988
+ );
1989
+ this.cleanup = () => {
1990
+ this.host.elements?.forEach((r) => {
1991
+ r.addEventListener(
1992
+ "cx-closed",
1993
+ () => {
1994
+ const n = this.originalPlacements.get(r);
1995
+ n && r.setAttribute("placement", n), this.originalPlacements.delete(r);
1996
+ },
1997
+ { once: !0 }
1998
+ );
1999
+ }), i(), s();
2000
+ };
2001
+ }
2002
+ async computePlacement() {
2003
+ const { options: t, target: o } = this;
2004
+ await (document.fonts ? document.fonts.ready : Promise.resolve());
2005
+ const i = t.trigger instanceof HTMLElement ? qt() : qt({
2006
+ fallbackPlacements: uo(t.placement),
2007
+ padding: vt
2008
+ }), [s = 0, r = 0] = Array.isArray(t?.offset) ? t.offset : [t.offset, 0], n = this.host.elements.find(
2009
+ (u) => u.tipElement
2010
+ )?.tipElement, a = [
2011
+ Wt({
2012
+ crossAxis: r,
2013
+ mainAxis: s
2014
+ }),
2015
+ ke({ padding: vt }),
2016
+ i,
2017
+ Vt({
2018
+ apply: ({ availableHeight: u, availableWidth: p, rects: { floating: f } }) => {
2019
+ const g = Math.max(
2020
+ po,
2021
+ Math.floor(u)
2022
+ ), m = f.height;
2023
+ this.initialHeight = this.isConstrained && this.initialHeight || m, this.isConstrained = m < this.initialHeight || g <= m;
2024
+ const y = this.isConstrained ? `${g}px` : "";
2025
+ Object.assign(o.style, {
2026
+ maxHeight: y,
2027
+ maxWidth: `${Math.floor(p)}px`
2028
+ });
2029
+ },
2030
+ padding: vt
2031
+ }),
2032
+ ...n ? [
2033
+ _e({
2034
+ element: n,
2035
+ padding: t.tipPadding || vt
2036
+ })
2037
+ ] : []
2038
+ ], { middlewareData: l, placement: c, x: h, y: d } = await Fe(
2039
+ t.trigger,
2040
+ o,
2041
+ {
2042
+ middleware: a,
2043
+ placement: t.placement,
2044
+ strategy: "fixed"
2045
+ }
2046
+ );
2047
+ if (Object.assign(o.style, {
2048
+ left: "0px",
2049
+ top: "0px",
2050
+ translate: `${yt(h)}px ${yt(d)}px`
2051
+ }), o.setAttribute("actual-placement", c), this.host.elements?.forEach((u) => {
2052
+ this.originalPlacements.has(u) || this.originalPlacements.set(
2053
+ u,
2054
+ u.getAttribute("placement")
2055
+ ), u.setAttribute("placement", c);
2056
+ }), n && l.arrow) {
2057
+ const { x: u, y: p } = l.arrow;
2058
+ Object.assign(n.style, {
2059
+ left: c.startsWith("bottom") || c.startsWith("top") ? "0px" : "",
2060
+ top: c.startsWith("right") || c.startsWith("left") ? "0px" : "",
2061
+ translate: `${yt(u)}px ${yt(p)}px`
2062
+ });
2063
+ }
2064
+ }
2065
+ clearOverlayPosition() {
2066
+ this.target && (this.target.style.removeProperty("max-height"), this.target.style.removeProperty("max-width"), this.initialHeight = void 0, this.isConstrained = !1);
2067
+ }
2068
+ hostConnected() {
2069
+ document.addEventListener("cx-update-overlays", this.resetOverlayPosition);
2070
+ }
2071
+ hostUpdated() {
2072
+ this.host.open || (this.cleanup?.(), this.cleanup = void 0);
2073
+ }
2074
+ hostDisconnected() {
2075
+ this.cleanup?.(), this.cleanup = void 0, document.removeEventListener(
2076
+ "cx-update-overlays",
2077
+ this.resetOverlayPosition
2078
+ );
2079
+ }
2080
+ }
2081
+ var Rt = /* @__PURE__ */ ((e) => (e.Click = "click", e.Hover = "hover", e.LongPress = "longpress", e))(Rt || {});
2082
+ class se {
2083
+ constructor(t, { handleOverlayReady: o, isPersistent: i, overlay: s }) {
2084
+ this.target = t, this.isLazilyOpen = !1, this.isPersistent = !1, this.isPersistent = !!i, this.handleOverlayReady = o, this.isPersistent && this.init(), this.overlay = s;
2085
+ }
2086
+ get activelyOpening() {
2087
+ return !1;
2088
+ }
2089
+ get open() {
2090
+ return this.overlay?.open ?? this.isLazilyOpen;
2091
+ }
2092
+ /**
2093
+ * Set `open` against the associated Overlay lazily.
2094
+ */
2095
+ set open(t) {
2096
+ if (t !== this.open) {
2097
+ if (this.isLazilyOpen = t, this.overlay) {
2098
+ this.overlay.open = t;
2099
+ return;
2100
+ }
2101
+ t && (customElements.whenDefined("cx-overlay").then(async () => {
2102
+ const { Overlay: o } = await Promise.resolve().then(() => So);
2103
+ this.overlay = new o(), this.overlay.open = !0;
2104
+ }), Promise.resolve().then(() => ze));
2105
+ }
2106
+ }
2107
+ get overlay() {
2108
+ return this._overlay;
2109
+ }
2110
+ set overlay(t) {
2111
+ t && this.overlay !== t && (this.overlay && this.overlay.removeController(this), this._overlay = t, this.overlay.addController(this), this.initOverlay(), this.prepareDescription(this.target), this.handleOverlayReady?.(this.overlay));
2112
+ }
2113
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2114
+ prepareDescription(t) {
2115
+ }
2116
+ releaseDescription() {
2117
+ }
2118
+ shouldCompleteOpen() {
2119
+ }
2120
+ /* c8 ignore next 3 */
2121
+ init() {
2122
+ }
2123
+ /* c8 ignore next 3 */
2124
+ initOverlay() {
2125
+ }
2126
+ abort() {
2127
+ this.releaseDescription(), this.abortController?.abort();
2128
+ }
2129
+ hostConnected() {
2130
+ this.init();
2131
+ }
2132
+ hostDisconnected() {
2133
+ this.isPersistent || this.abort();
2134
+ }
2135
+ }
2136
+ const go = 300, Ne = {
2137
+ keyboard: "Press Space or Alt+Down Arrow for additional options",
2138
+ mouse: "Click and hold for additional options",
2139
+ touch: "Double tap and long press for additional options"
2140
+ };
2141
+ class mo extends se {
2142
+ constructor() {
2143
+ super(...arguments), this.type = Rt.LongPress, this.longpressState = null, this.releaseDescription = it, this.handlePointerup = () => {
2144
+ clearTimeout(this.timeout), this.target && (this.longpressState = this.overlay?.state === "opening" ? "pressed" : null, document.removeEventListener("pointerup", this.handlePointerup), document.removeEventListener("pointercancel", this.handlePointerup));
2145
+ };
2146
+ }
2147
+ get activelyOpening() {
2148
+ return this.longpressState === "opening" || this.longpressState === "pressed";
2149
+ }
2150
+ handleLongpress() {
2151
+ this.open = !0, this.longpressState = this.longpressState === "potential" ? "opening" : "pressed";
2152
+ }
2153
+ handlePointerdown(t) {
2154
+ !this.target || t.button !== 0 || (this.longpressState = "potential", document.addEventListener("pointerup", this.handlePointerup), document.addEventListener("pointercancel", this.handlePointerup), "holdAffordance" in this.target) || (this.timeout = setTimeout(() => {
2155
+ this.target && this.target.dispatchEvent(
2156
+ new CustomEvent("longpress", {
2157
+ bubbles: !0,
2158
+ composed: !0,
2159
+ detail: {
2160
+ source: "pointer"
2161
+ }
2162
+ })
2163
+ );
2164
+ }, go));
2165
+ }
2166
+ handleKeydown(t) {
2167
+ const { altKey: o, code: i } = t;
2168
+ o && i === "ArrowDown" && (t.stopPropagation(), t.stopImmediatePropagation());
2169
+ }
2170
+ handleKeyup(t) {
2171
+ const { altKey: o, code: i } = t;
2172
+ if (i === "Space" || o && i === "ArrowDown") {
2173
+ if (!this.target)
2174
+ return;
2175
+ t.stopPropagation(), this.target.dispatchEvent(
2176
+ new CustomEvent("longpress", {
2177
+ bubbles: !0,
2178
+ composed: !0,
2179
+ detail: {
2180
+ source: "keyboard"
2181
+ }
2182
+ })
2183
+ ), setTimeout(() => {
2184
+ this.longpressState = null;
2185
+ });
2186
+ }
2187
+ }
2188
+ prepareDescription(t) {
2189
+ if (
2190
+ // do not reapply until target is recycled
2191
+ this.releaseDescription !== it || // require "longpress content" to apply relationship
2192
+ !this.overlay.elements.length
2193
+ )
2194
+ return;
2195
+ const o = document.createElement("div");
2196
+ o.id = `longpress-describedby-descriptor-${jt()}`;
2197
+ const i = li() || ci() ? "touch" : "keyboard";
2198
+ o.textContent = Ne[i], o.slot = "longpress-describedby-descriptor";
2199
+ const s = t.getRootNode(), r = this.overlay.getRootNode();
2200
+ s === r ? this.overlay.append(o) : (o.hidden = !("host" in s), t.insertAdjacentElement("afterend", o));
2201
+ const n = $t(
2202
+ t,
2203
+ "aria-describedby",
2204
+ [o.id]
2205
+ );
2206
+ this.releaseDescription = () => {
2207
+ n(), o.remove(), this.releaseDescription = it;
2208
+ };
2209
+ }
2210
+ shouldCompleteOpen() {
2211
+ this.longpressState = this.longpressState === "pressed" ? null : this.longpressState;
2212
+ }
2213
+ init() {
2214
+ this.abortController?.abort(), this.abortController = new AbortController();
2215
+ const { signal: t } = this.abortController;
2216
+ this.target.addEventListener("longpress", () => this.handleLongpress(), {
2217
+ signal: t
2218
+ }), this.target.addEventListener(
2219
+ "pointerdown",
2220
+ (o) => this.handlePointerdown(o),
2221
+ { signal: t }
2222
+ ), this.prepareDescription(this.target), !this.target.holdAffordance && (this.target.addEventListener(
2223
+ "keydown",
2224
+ (o) => this.handleKeydown(o),
2225
+ { signal: t }
2226
+ ), this.target.addEventListener(
2227
+ "keyup",
2228
+ (o) => this.handleKeyup(o),
2229
+ { signal: t }
2230
+ ));
2231
+ }
2232
+ }
2233
+ const yo = Ut`
2234
+ /*
2235
+ Copyright 2022 Adobe. All rights reserved.
2236
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
2237
+ you may not use this file except in compliance with the License. You may obtain a copy
2238
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
2239
+
2240
+ Unless required by applicable law or agreed to in writing, software distributed under
2241
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
2242
+ OF ANY KIND, either express or implied. See the License for the specific language
2243
+ governing permissions and limitations under the License.
2244
+ */
2245
+
2246
+ :host {
2247
+ display: contents;
2248
+ pointer-events: none;
2249
+
2250
+ /**
2251
+ * Duplicate --spectrum-overlay-animation-distance, which is out of scope.
2252
+ * Currently is is statically '--cx-spacing-medium' across a number of places
2253
+ * so that is leveraged here as the default.
2254
+ **/
2255
+
2256
+ --swc-overlay-animation-distance: var(--cx-spacing-medium);
2257
+ }
2258
+
2259
+ .dialog {
2260
+ margin: 0;
2261
+ border: 0;
2262
+ background: none;
2263
+ padding: 0;
2264
+ display: flex;
2265
+ position: fixed;
2266
+ overflow: visible;
2267
+ opacity: 1 !important;
2268
+ box-sizing: border-box;
2269
+ max-height: calc(100vh - 16px);
2270
+ max-height: calc(100dvh - 16px);
2271
+ max-width: calc(100vw - 16px);
2272
+ height: auto;
2273
+ inset: auto;
2274
+ top: 0;
2275
+ left: 0;
2276
+
2277
+ --cx-overlay-open: true;
2278
+ }
2279
+
2280
+ .dialog:not([is-visible]) {
2281
+ display: none;
2282
+ }
2283
+
2284
+ .dialog:focus {
2285
+ outline: none;
2286
+ }
2287
+
2288
+ :host(:not([open])) .dialog {
2289
+ --cx-overlay-open: false;
2290
+ }
2291
+
2292
+ .dialog::backdrop {
2293
+ display: none;
2294
+ }
2295
+
2296
+ .dialog::before {
2297
+ position: absolute;
2298
+ inset: -999em;
2299
+ content: '';
2300
+ pointer-events: auto !important;
2301
+ }
2302
+
2303
+ .dialog:not(.not-immediately-closable)::before {
2304
+ display: none;
2305
+ }
2306
+
2307
+ .dialog > div {
2308
+ width: 100%;
2309
+ }
2310
+
2311
+ ::slotted(*) {
2312
+ pointer-events: auto;
2313
+ visibility: visible !important;
2314
+ }
2315
+
2316
+ /**
2317
+ * Offset the transition displacement from the trigger edge by
2318
+ * padding the equivelent distance off of the opposite edge.
2319
+ *
2320
+ * <HACK>
2321
+ * Prepare for Context Menus with [popover] by adding margin/border
2322
+ * that _should_ still be under the pointer when 'pointerup' is dispatched.
2323
+ * </HACK>
2324
+ **/
2325
+ .dialog:not([actual-placement])[placement*='top'] {
2326
+ padding-block: var(--swc-overlay-animation-distance);
2327
+ margin-top: var(--swc-overlay-animation-distance);
2328
+ }
2329
+
2330
+ .dialog:not([actual-placement])[placement*='right'] {
2331
+ padding-inline: var(--swc-overlay-animation-distance);
2332
+ margin-left: calc(-1 * var(--swc-overlay-animation-distance));
2333
+ }
2334
+
2335
+ .dialog:not([actual-placement])[placement*='bottom'] {
2336
+ padding-block: var(--swc-overlay-animation-distance);
2337
+ margin-top: calc(-1 * var(--swc-overlay-animation-distance));
2338
+ }
2339
+
2340
+ .dialog:not([actual-placement])[placement*='left'] {
2341
+ padding-inline: var(--swc-overlay-animation-distance);
2342
+ margin-left: var(--swc-overlay-animation-distance);
2343
+ }
2344
+
2345
+ .dialog[actual-placement*='top'] {
2346
+ padding-block: var(--swc-overlay-animation-distance);
2347
+ margin-top: var(--swc-overlay-animation-distance);
2348
+ }
2349
+
2350
+ .dialog[actual-placement*='right'] {
2351
+ padding-inline: var(--swc-overlay-animation-distance);
2352
+ margin-left: calc(-1 * var(--swc-overlay-animation-distance));
2353
+ }
2354
+
2355
+ .dialog[actual-placement*='bottom'] {
2356
+ padding-block: var(--swc-overlay-animation-distance);
2357
+ margin-top: calc(-1 * var(--swc-overlay-animation-distance));
2358
+ }
2359
+
2360
+ .dialog[actual-placement*='left'] {
2361
+ padding-inline: var(--swc-overlay-animation-distance);
2362
+ margin-left: var(--swc-overlay-animation-distance);
2363
+ }
2364
+
2365
+ slot[name='longpress-describedby-descriptor'] {
2366
+ display: none;
2367
+ }
2368
+
2369
+ /* stylelint-disable */
2370
+ @supports selector(:open) {
2371
+ .dialog {
2372
+ opacity: 0;
2373
+ }
2374
+
2375
+ .dialog:open {
2376
+ opacity: 1;
2377
+ }
2378
+ }
2379
+
2380
+ @supports selector(:popover-open) {
2381
+ .dialog {
2382
+ opacity: 0;
2383
+ }
2384
+
2385
+ .dialog:popover-open {
2386
+ opacity: 1;
2387
+ }
2388
+ }
2389
+
2390
+ @supports (overlay: auto) {
2391
+ .dialog {
2392
+ display: none;
2393
+ transition:
2394
+ all var(--cx-transition-fast, 0.13s),
2395
+ translate 0s,
2396
+ display var(--cx-transition-fast, 0.13s);
2397
+ transition-behavior: allow-discrete;
2398
+ }
2399
+
2400
+ .dialog:popover-open,
2401
+ .dialog:modal {
2402
+ display: flex;
2403
+ }
2404
+ }
2405
+ .dialog[actual-placement] {
2406
+ z-index: calc(
2407
+ var(--swc-overlay-z-index-base, 1000) + var(--swc-overlay-open-count)
2408
+ );
2409
+ }
2410
+ @supports (not selector(:open)) and (not selector(:popover-open)) {
2411
+ :host:not([open]) .dialog {
2412
+ pointer-events: none;
2413
+ }
2414
+ }
2415
+ `;
2416
+ class vo extends Event {
2417
+ constructor(t, o, i) {
2418
+ super("slottable-request", {
2419
+ bubbles: !1,
2420
+ cancelable: !0,
2421
+ composed: !1
2422
+ }), this.name = t, this.data = o, this.slotName = i !== void 0 ? `${t}.${i}` : t;
2423
+ }
2424
+ }
2425
+ const bo = Symbol("remove-slottable-request");
2426
+ class wo extends se {
2427
+ constructor() {
2428
+ super(...arguments), this.type = Rt.Click, this.preventNextToggle = !1;
2429
+ }
2430
+ handleClick() {
2431
+ this.preventNextToggle || (this.open = !this.open), this.preventNextToggle = !1;
2432
+ }
2433
+ handlePointerdown() {
2434
+ this.preventNextToggle = this.open;
2435
+ }
2436
+ init() {
2437
+ this.abortController?.abort(), this.abortController = new AbortController();
2438
+ const { signal: t } = this.abortController;
2439
+ this.target.addEventListener("click", () => this.handleClick(), {
2440
+ signal: t
2441
+ }), this.target.addEventListener(
2442
+ "pointerdown",
2443
+ () => this.handlePointerdown(),
2444
+ { signal: t }
2445
+ );
2446
+ }
2447
+ }
2448
+ const xo = 300;
2449
+ class Eo extends se {
2450
+ constructor() {
2451
+ super(...arguments), this.type = Rt.Hover, this.elementIds = [], this.focusedin = !1, this.pointerentered = !1;
2452
+ }
2453
+ handleTargetFocusin() {
2454
+ this.target.matches(":focus-visible") && (this.open = !0, this.focusedin = !0);
2455
+ }
2456
+ handleTargetFocusout() {
2457
+ this.focusedin = !1, !this.pointerentered && (this.open = !1);
2458
+ }
2459
+ handleTargetPointerenter() {
2460
+ this.hoverTimeout && (clearTimeout(this.hoverTimeout), this.hoverTimeout = void 0), !this.overlay?.disabled && (this.open = !0, this.pointerentered = !0);
2461
+ }
2462
+ handleTargetPointerleave() {
2463
+ this.doPointerleave();
2464
+ }
2465
+ // set a timeout once the pointer enters and the overlay is shown
2466
+ // give the user time to enter the overlay
2467
+ handleHostPointerenter() {
2468
+ this.hoverTimeout && (clearTimeout(this.hoverTimeout), this.hoverTimeout = void 0);
2469
+ }
2470
+ handleHostPointerleave() {
2471
+ this.doPointerleave();
2472
+ }
2473
+ prepareDescription() {
2474
+ if (!this.overlay.elements.length)
2475
+ return;
2476
+ const t = this.target.getRootNode(), o = this.overlay.elements[0].getRootNode(), i = this.overlay.getRootNode();
2477
+ t === i ? this.prepareOverlayRelativeDescription() : t === o && this.prepareContentRelativeDescription();
2478
+ }
2479
+ prepareOverlayRelativeDescription() {
2480
+ const t = $t(
2481
+ this.target,
2482
+ "aria-describedby",
2483
+ [this.overlay.id]
2484
+ );
2485
+ this.releaseDescription = () => {
2486
+ t(), this.releaseDescription = it;
2487
+ };
2488
+ }
2489
+ prepareContentRelativeDescription() {
2490
+ const t = [], o = this.overlay.elements.map((s) => (t.push(s.id), s.id || (s.id = `${this.overlay.tagName.toLowerCase()}-helper-${jt()}`), s.id));
2491
+ this.elementIds = t;
2492
+ const i = $t(
2493
+ this.target,
2494
+ "aria-describedby",
2495
+ o
2496
+ );
2497
+ this.releaseDescription = () => {
2498
+ i(), this.overlay.elements.map((s, r) => {
2499
+ s.id = this.elementIds[r];
2500
+ }), this.releaseDescription = it;
2501
+ };
2502
+ }
2503
+ doPointerleave() {
2504
+ this.pointerentered = !1;
2505
+ const t = this.target;
2506
+ this.focusedin && t.matches(":focus-visible") || (this.hoverTimeout = setTimeout(() => {
2507
+ this.open = !1;
2508
+ }, xo));
2509
+ }
2510
+ init() {
2511
+ this.abortController?.abort(), this.abortController = new AbortController();
2512
+ const { signal: t } = this.abortController;
2513
+ this.target.addEventListener("focusin", () => this.handleTargetFocusin(), {
2514
+ signal: t
2515
+ }), this.target.addEventListener(
2516
+ "focusout",
2517
+ () => this.handleTargetFocusout(),
2518
+ { signal: t }
2519
+ ), this.target.addEventListener(
2520
+ "pointerenter",
2521
+ () => this.handleTargetPointerenter(),
2522
+ { signal: t }
2523
+ ), this.target.addEventListener(
2524
+ "pointerleave",
2525
+ () => this.handleTargetPointerleave(),
2526
+ { signal: t }
2527
+ ), this.overlay && this.initOverlay();
2528
+ }
2529
+ initOverlay() {
2530
+ if (!this.abortController)
2531
+ return;
2532
+ const { signal: t } = this.abortController;
2533
+ this.overlay.addEventListener(
2534
+ "pointerenter",
2535
+ () => this.handleHostPointerenter(),
2536
+ { signal: t }
2537
+ ), this.overlay.addEventListener(
2538
+ "pointerleave",
2539
+ () => this.handleHostPointerleave(),
2540
+ { signal: t }
2541
+ );
2542
+ }
2543
+ }
2544
+ const Po = {
2545
+ click: wo,
2546
+ hover: Eo,
2547
+ longpress: mo
2548
+ };
2549
+ var Co = Object.defineProperty, Oo = Object.getOwnPropertyDescriptor, R = (e, t, o, i) => {
2550
+ for (var s = i > 1 ? void 0 : i ? Oo(t, o) : t, r = e.length - 1, n; r >= 0; r--)
2551
+ (n = e[r]) && (s = (i ? n(t, o, s) : n(s)) || s);
2552
+ return i && s && Co(t, o, s), s;
2553
+ };
2554
+ const Ao = "showPopover" in document.createElement("div");
2555
+ let ct = fi(ht);
2556
+ Ao ? ct = yi(ct) : ct = gi(ct);
2557
+ var K;
2558
+ const A = (K = class extends ct {
2559
+ constructor() {
2560
+ super(), this._delayed = !1, this._disabled = !1, this.offset = 0, this._open = !1, this.lastRequestSlottableState = !1, this.receivesFocus = "auto", this._state = "closed", this.triggerElement = null, this.type = "auto", this.wasOpen = !1, this.closeOnFocusOut = (t) => {
2561
+ if (!t.relatedTarget)
2562
+ return;
2563
+ const o = new Event("overlay-relation-query", {
2564
+ bubbles: !0,
2565
+ composed: !0
2566
+ });
2567
+ t.relatedTarget.addEventListener(o.type, (i) => {
2568
+ i.composedPath().includes(this) || (this.open = !1);
2569
+ }), t.relatedTarget.dispatchEvent(o);
2570
+ }, this.handleClose = this.handleClose.bind(this);
2571
+ }
2572
+ get delayed() {
2573
+ return this.elements.length ? this.elements[this.elements.length - 1].hasAttribute("delayed") || this._delayed : this._delayed;
2574
+ }
2575
+ set delayed(t) {
2576
+ this._delayed = t;
2577
+ }
2578
+ get disabled() {
2579
+ return this._disabled;
2580
+ }
2581
+ set disabled(t) {
2582
+ this._disabled = t, t ? (this.strategy?.abort(), this.wasOpen = this.open, this.open = !1) : (this.bindEvents(), this.open = this.open || this.wasOpen, this.wasOpen = !1);
2583
+ }
2584
+ get hasNonVirtualTrigger() {
2585
+ return !!this.triggerElement && !(this.triggerElement instanceof Pt);
2586
+ }
2587
+ get placementController() {
2588
+ return this._placementController || (this._placementController = new fo(this)), this._placementController;
2589
+ }
2590
+ get open() {
2591
+ return this._open;
2592
+ }
2593
+ set open(t) {
2594
+ t && this.disabled || t !== this.open && (this.strategy?.activelyOpening && !t || (this._open = t, this.open && (K.openCount += 1), this.requestUpdate("open", !this.open), this.open && this.requestSlottable()));
2595
+ }
2596
+ get state() {
2597
+ return this._state;
2598
+ }
2599
+ set state(t) {
2600
+ if (t === this.state)
2601
+ return;
2602
+ const o = this.state;
2603
+ this._state = t, (this.state === "opened" || this.state === "closed") && this.strategy?.shouldCompleteOpen(), this.requestUpdate("state", o);
2604
+ }
2605
+ get elementResolver() {
2606
+ return this._elementResolver || (this._elementResolver = new ui(this)), this._elementResolver;
2607
+ }
2608
+ get usesDialog() {
2609
+ return this.type === "modal" || this.type === "page";
2610
+ }
2611
+ get popoverValue() {
2612
+ if ("popover" in this)
2613
+ switch (this.type) {
2614
+ case "modal":
2615
+ case "page":
2616
+ return;
2617
+ case "hint":
2618
+ return "manual";
2619
+ default:
2620
+ return this.type;
2621
+ }
2622
+ }
2623
+ get requiresPosition() {
2624
+ return !(this.type === "page" || !this.open || !this.triggerElement || !this.placement && this.type !== "hint");
2625
+ }
2626
+ managePosition() {
2627
+ if (!this.requiresPosition || !this.open)
2628
+ return;
2629
+ const t = this.offset || 0, o = this.triggerElement, i = this.placement || "right", s = this.tipPadding;
2630
+ this.placementController.placeOverlay(this.dialogEl, {
2631
+ offset: t,
2632
+ placement: i,
2633
+ tipPadding: s,
2634
+ trigger: o,
2635
+ type: this.type
2636
+ });
2637
+ }
2638
+ async managePopoverOpen() {
2639
+ super.managePopoverOpen();
2640
+ const t = this.open;
2641
+ if (this.open !== t || (await this.manageDelay(t), this.open !== t) || (await this.ensureOnDOM(t), this.open !== t))
2642
+ return;
2643
+ const o = await this.makeTransition(t);
2644
+ this.open === t && await this.applyFocus(t, o);
2645
+ }
2646
+ async applyFocus(t, o) {
2647
+ if (!(this.receivesFocus === "false" || this.type === "hint")) {
2648
+ if (await k(), await k(), t === this.open && !this.open) {
2649
+ this.hasNonVirtualTrigger && this.contains(this.getRootNode().activeElement) && this.triggerElement.focus();
2650
+ return;
2651
+ }
2652
+ o?.focus();
2653
+ }
2654
+ }
2655
+ returnFocus() {
2656
+ if (this.open || this.type === "hint")
2657
+ return;
2658
+ const t = () => {
2659
+ const o = [];
2660
+ let i = document.activeElement;
2661
+ for (; i?.shadowRoot?.activeElement; )
2662
+ i = i.shadowRoot.activeElement;
2663
+ for (; i; ) {
2664
+ const s = i.assignedSlot || i.parentElement || i.getRootNode()?.host;
2665
+ s && o.push(s), i = s;
2666
+ }
2667
+ return o;
2668
+ };
2669
+ this.receivesFocus !== "false" && this.triggerElement?.focus && (this.contains(this.getRootNode().activeElement) || t().includes(this) || document.activeElement === document.body) && this.triggerElement.focus();
2670
+ }
2671
+ async manageOpen(t) {
2672
+ if (!(!this.isConnected && this.open) && (this.hasUpdated || await this.updateComplete, this.open ? (he.add(this), this.willPreventClose && (document.addEventListener(
2673
+ "pointerup",
2674
+ () => {
2675
+ this.dialogEl.classList.toggle("not-immediately-closable", !1), this.willPreventClose = !1;
2676
+ },
2677
+ { once: !0 }
2678
+ ), this.dialogEl.classList.toggle("not-immediately-closable", !0))) : (t && this.dispose(), he.remove(this)), this.open && this.state !== "opened" ? this.state = "opening" : !this.open && this.state !== "closed" && (this.state = "closing"), this.usesDialog ? this.manageDialogOpen() : this.managePopoverOpen(), this.type === "auto")) {
2679
+ const o = this.getRootNode();
2680
+ this.open ? o.addEventListener("focusout", this.closeOnFocusOut, {
2681
+ capture: !0
2682
+ }) : o.removeEventListener("focusout", this.closeOnFocusOut, {
2683
+ capture: !0
2684
+ });
2685
+ }
2686
+ }
2687
+ bindEvents() {
2688
+ this.strategy?.abort(), this.strategy = void 0, this.hasNonVirtualTrigger && this.triggerInteraction && (this.strategy = new Po[this.triggerInteraction](
2689
+ this.triggerElement,
2690
+ {
2691
+ overlay: this
2692
+ }
2693
+ ));
2694
+ }
2695
+ handleBeforetoggle(t) {
2696
+ t.newState !== "open" && this.handleBrowserClose();
2697
+ }
2698
+ handleBrowserClose() {
2699
+ if (!this.strategy?.activelyOpening) {
2700
+ this.open = !1;
2701
+ return;
2702
+ }
2703
+ this.manuallyKeepOpen();
2704
+ }
2705
+ manuallyKeepOpen() {
2706
+ this.open = !0, this.placementController.allowPlacementUpdate = !0, this.manageOpen(!1);
2707
+ }
2708
+ handleSlotchange() {
2709
+ this.elements.length ? this.hasNonVirtualTrigger && this.strategy?.prepareDescription(this.triggerElement) : this.strategy?.releaseDescription();
2710
+ }
2711
+ shouldPreventClose() {
2712
+ const t = this.willPreventClose;
2713
+ return this.willPreventClose = !1, t;
2714
+ }
2715
+ requestSlottable() {
2716
+ this.lastRequestSlottableState !== this.open && (this.open || document.body.offsetHeight, this.dispatchEvent(
2717
+ new vo(
2718
+ "overlay-content",
2719
+ this.open ? {} : bo
2720
+ )
2721
+ ), this.lastRequestSlottableState = this.open);
2722
+ }
2723
+ willUpdate(t) {
2724
+ if (this.hasAttribute("id") || this.setAttribute("id", `${this.tagName.toLowerCase()}-${jt()}`), t.has("open") && (this.hasUpdated || this.open) && this.manageOpen(t.get("open")), t.has("trigger")) {
2725
+ const [i, s] = this.trigger?.split("@") || [];
2726
+ this.elementResolver.selector = i ? `#${i}` : "", this.triggerInteraction = s;
2727
+ }
2728
+ let o = !1;
2729
+ t.has(xe) && (o = this.triggerElement, this.triggerElement = this.elementResolver.element), t.has("triggerElement") && (o = t.get("triggerElement")), o !== !1 && this.bindEvents();
2730
+ }
2731
+ updated(t) {
2732
+ super.updated(t), t.has("placement") && (this.placement ? this.dialogEl.setAttribute("actual-placement", this.placement) : this.dialogEl.removeAttribute("actual-placement"), this.open && typeof t.get("placement") < "u" && this.placementController.resetOverlayPosition()), t.has("state") && this.state === "closed" && typeof t.get("state") < "u" && this.placementController.clearOverlayPosition();
2733
+ }
2734
+ renderContent() {
2735
+ return j` <slot @slotchange=${this.handleSlotchange}></slot> `;
2736
+ }
2737
+ get dialogStyleMap() {
2738
+ return {
2739
+ "--swc-overlay-open-count": K.openCount.toString()
2740
+ };
2741
+ }
2742
+ handleClose() {
2743
+ this.open = !1;
2744
+ }
2745
+ renderDialog() {
2746
+ return j`
2747
+ <dialog
2748
+ class="dialog"
2749
+ part="dialog"
2750
+ placement=${Tt(
2751
+ this.requiresPosition ? this.placement || "right" : void 0
2752
+ )}
2753
+ style=${ne(this.dialogStyleMap)}
2754
+ @close=${this.handleBrowserClose}
2755
+ @cancel=${this.handleBrowserClose}
2756
+ @beforetoggle=${this.handleBeforetoggle}
2757
+ ?is-visible=${this.state !== "closed"}
2758
+ >
2759
+ ${this.renderContent()}
2760
+ </dialog>
2761
+ `;
2762
+ }
2763
+ renderPopover() {
2764
+ return j`
2765
+ <div
2766
+ class="dialog"
2767
+ part="dialog"
2768
+ placement=${Tt(
2769
+ this.requiresPosition ? this.placement || "right" : void 0
2770
+ )}
2771
+ popover=${Tt(this.popoverValue)}
2772
+ style=${ne(this.dialogStyleMap)}
2773
+ @beforetoggle=${this.handleBeforetoggle}
2774
+ @close=${this.handleBrowserClose}
2775
+ ?is-visible=${this.state !== "closed"}
2776
+ >
2777
+ ${this.renderContent()}
2778
+ </div>
2779
+ `;
2780
+ }
2781
+ render() {
2782
+ const t = this.type === "modal" || this.type === "page";
2783
+ return j`
2784
+ ${t ? this.renderDialog() : this.renderPopover()}
2785
+ <slot name="longpress-describedby-descriptor"></slot>
2786
+ `;
2787
+ }
2788
+ connectedCallback() {
2789
+ super.connectedCallback(), this.addEventListener("close", this.handleClose), this.hasUpdated && this.bindEvents();
2790
+ }
2791
+ disconnectedCallback() {
2792
+ super.disconnectedCallback(), this.removeEventListener("close", this.handleClose), this.strategy?.releaseDescription(), this.open = !1;
2793
+ }
2794
+ }, K.styles = [
2795
+ we,
2796
+ Ut`
2797
+ ${Me(yo)}
2798
+ `
2799
+ ], K.openCount = 1, K);
2800
+ R([
2801
+ v({ type: Boolean })
2802
+ ], A.prototype, "delayed", 1);
2803
+ R([
2804
+ ut(".dialog")
2805
+ ], A.prototype, "dialogEl", 2);
2806
+ R([
2807
+ v({ type: Boolean })
2808
+ ], A.prototype, "disabled", 1);
2809
+ R([
2810
+ Ke({
2811
+ flatten: !0,
2812
+ selector: ':not([slot="longpress-describedby-descriptor"], slot)'
2813
+ // gather only elements slotted into the default slot
2814
+ })
2815
+ ], A.prototype, "elements", 2);
2816
+ R([
2817
+ v({ type: Number })
2818
+ ], A.prototype, "offset", 2);
2819
+ R([
2820
+ v({ reflect: !0, type: Boolean })
2821
+ ], A.prototype, "open", 1);
2822
+ R([
2823
+ v()
2824
+ ], A.prototype, "placement", 2);
2825
+ R([
2826
+ v({ attribute: "receives-focus" })
2827
+ ], A.prototype, "receivesFocus", 2);
2828
+ R([
2829
+ ut("slot")
2830
+ ], A.prototype, "slotEl", 2);
2831
+ R([
2832
+ be()
2833
+ ], A.prototype, "state", 1);
2834
+ R([
2835
+ v({ attribute: "tip-padding", type: Number })
2836
+ ], A.prototype, "tipPadding", 2);
2837
+ R([
2838
+ v()
2839
+ ], A.prototype, "trigger", 2);
2840
+ R([
2841
+ v({ attribute: "trigger-element" })
2842
+ ], A.prototype, "triggerElement", 2);
2843
+ R([
2844
+ v({ attribute: "trigger-interaction" })
2845
+ ], A.prototype, "triggerInteraction", 2);
2846
+ R([
2847
+ v()
2848
+ ], A.prototype, "type", 2);
2849
+ let $e = A;
2850
+ const So = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2851
+ __proto__: null,
2852
+ LONGPRESS_INSTRUCTIONS: Ne,
2853
+ Overlay: $e
2854
+ }, Symbol.toStringTag, { value: "Module" }));
2855
+ ti("cx-overlay", $e);
2856
+ const ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2857
+ __proto__: null
2858
+ }, Symbol.toStringTag, { value: "Module" }));
2859
+ function Ro(e) {
2860
+ return To(e);
2861
+ }
2862
+ function Nt(e) {
2863
+ return e.assignedSlot ? e.assignedSlot : e.parentNode instanceof ShadowRoot ? e.parentNode.host : e.parentNode;
2864
+ }
2865
+ function To(e) {
2866
+ for (let t = e; t; t = Nt(t)) if (t instanceof Element && getComputedStyle(t).display === "none") return null;
2867
+ for (let t = Nt(e); t; t = Nt(t)) {
2868
+ if (!(t instanceof Element)) continue;
2869
+ const o = getComputedStyle(t);
2870
+ if (o.display !== "contents" && (o.position !== "static" || At(o) || t.tagName === "BODY"))
2871
+ return t;
2872
+ }
2873
+ return null;
2874
+ }
2875
+ const Lo = Ut`
2876
+ :host {
2877
+ --arrow-color: var(--cx-color-neutral-1000);
2878
+ --arrow-size: 6px;
2879
+
2880
+ /*
2881
+ * These properties are computed to account for the arrow's dimensions after being rotated 45º. The constant
2882
+ * 0.7071 is derived from sin(45), which is the diagonal size of the arrow's container after rotating.
2883
+ */
2884
+ --arrow-size-diagonal: calc(var(--arrow-size) * 0.7071);
2885
+ --arrow-padding-offset: calc(
2886
+ var(--arrow-size-diagonal) - var(--arrow-size)
2887
+ );
2888
+
2889
+ display: contents;
2890
+ /**
2891
+ * Reset -webkit-overflow-scrolling style to fix issue with popup being hidden on mobile devices.
2892
+ * See https://link.orangelogic.com/Tasks/293FXQ
2893
+ */
2894
+ -webkit-overflow-scrolling: auto;
2895
+ }
2896
+
2897
+ .popup {
2898
+ position: absolute;
2899
+ isolation: isolate;
2900
+ max-width: var(--auto-size-available-width, none);
2901
+ max-height: var(--auto-size-available-height, none);
2902
+ }
2903
+
2904
+ .popup--use-size-middleware {
2905
+ /*
2906
+ * Prevent update loops when using the size middleware.
2907
+ * https://github.com/floating-ui/floating-ui/issues/1740#issuecomment-1563544849
2908
+ */
2909
+ width: max-content;
2910
+ }
2911
+
2912
+ .popup--fixed, .popup--overlay {
2913
+ position: fixed;
2914
+ z-index: var(--cx-z-index-dialog);
2915
+ }
2916
+
2917
+ .popup:not(.popup--active) {
2918
+ display: none;
2919
+ }
2920
+
2921
+ .popup--overlay.popup:not(.popup--active) {
2922
+ display: unset;
2923
+ visibility: hidden;
2924
+ opacity: 0;
2925
+ }
2926
+
2927
+ .popup__arrow {
2928
+ position: absolute;
2929
+ width: calc(var(--arrow-size-diagonal) * 2);
2930
+ height: calc(var(--arrow-size-diagonal) * 2);
2931
+ rotate: 45deg;
2932
+ background: var(--arrow-color);
2933
+ z-index: -1;
2934
+ }
2935
+
2936
+ /* Hover bridge */
2937
+ .popup-hover-bridge:not(.popup-hover-bridge--visible) {
2938
+ display: none;
2939
+ }
2940
+
2941
+ .popup-hover-bridge {
2942
+ position: fixed;
2943
+ z-index: calc(var(--cx-z-index-dropdown) - 1);
2944
+ top: 0;
2945
+ right: 0;
2946
+ bottom: 0;
2947
+ left: 0;
2948
+ clip-path: polygon(
2949
+ var(--hover-bridge-top-left-x, 0) var(--hover-bridge-top-left-y, 0),
2950
+ var(--hover-bridge-top-right-x, 0) var(--hover-bridge-top-right-y, 0),
2951
+ var(--hover-bridge-bottom-right-x, 0)
2952
+ var(--hover-bridge-bottom-right-y, 0),
2953
+ var(--hover-bridge-bottom-left-x, 0) var(--hover-bridge-bottom-left-y, 0)
2954
+ );
2955
+ }
2956
+ `;
2957
+ var Do = Object.defineProperty, ko = Object.getOwnPropertyDescriptor, w = (e, t, o, i) => {
2958
+ for (var s = i > 1 ? void 0 : i ? ko(t, o) : t, r = e.length - 1, n; r >= 0; r--)
2959
+ (n = e[r]) && (s = (i ? n(t, o, s) : n(s)) || s);
2960
+ return i && s && Do(t, o, s), s;
2961
+ };
2962
+ function _o(e) {
2963
+ if (e == null || typeof e != "object")
2964
+ return !1;
2965
+ const t = "contextElement" in e ? e.contextElement.ownerDocument.defaultView : null;
2966
+ return "getBoundingClientRect" in e && ("contextElement" in e ? e.contextElement instanceof (t?.Element ?? Element) : !0);
2967
+ }
2968
+ let b = class extends He {
2969
+ constructor() {
2970
+ super(...arguments), this.localize = new je(this), this.active = !1, this.placement = "top", this.strategy = "absolute", this.distance = 0, this.skidding = 0, this.arrow = !1, this.arrowPlacement = "anchor", this.arrowPadding = 10, this.flip = !1, this.hide = !1, this.hideBoundaryStrategy = "escaped", this.flipFallbackPlacements = "", this.flipFallbackStrategy = "best-fit", this.flipPadding = 0, this.shift = !1, this.shiftPadding = 0, this.autoSizePadding = 0, this.hoverBridge = !1, this.autoWidthFactor = 1, this.overlayOpened = !1, this.updateHoverBridge = () => {
2971
+ if (this.hoverBridge && this.anchorEl) {
2972
+ const e = this.anchorEl.getBoundingClientRect(), t = this.popup.getBoundingClientRect(), o = this.placement.includes("top") || this.placement.includes("bottom") || this.placement === "center";
2973
+ let i = 0, s = 0, r = 0, n = 0, a = 0, l = 0, c = 0, h = 0;
2974
+ o ? e.top < t.top ? (i = e.left, s = e.bottom, r = e.right, n = e.bottom, a = t.left, l = t.top, c = t.right, h = t.top) : (i = t.left, s = t.bottom, r = t.right, n = t.bottom, a = e.left, l = e.top, c = e.right, h = e.top) : e.left < t.left ? (i = e.right, s = e.top, r = t.left, n = t.top, a = e.right, l = e.bottom, c = t.left, h = t.bottom) : (i = t.right, s = t.top, r = e.left, n = e.top, a = t.right, l = t.bottom, c = e.left, h = e.bottom), this.style.setProperty("--hover-bridge-top-left-x", `${i}px`), this.style.setProperty("--hover-bridge-top-left-y", `${s}px`), this.style.setProperty("--hover-bridge-top-right-x", `${r}px`), this.style.setProperty("--hover-bridge-top-right-y", `${n}px`), this.style.setProperty(
2975
+ "--hover-bridge-bottom-left-x",
2976
+ `${a}px`
2977
+ ), this.style.setProperty(
2978
+ "--hover-bridge-bottom-left-y",
2979
+ `${l}px`
2980
+ ), this.style.setProperty(
2981
+ "--hover-bridge-bottom-right-x",
2982
+ `${c}px`
2983
+ ), this.style.setProperty(
2984
+ "--hover-bridge-bottom-right-y",
2985
+ `${h}px`
2986
+ );
2987
+ }
2988
+ };
2989
+ }
2990
+ /*
2991
+ * Use to prevent update loops when using the size middleware.
2992
+ * https://github.com/floating-ui/floating-ui/issues/1740#issuecomment-1563544849
2993
+ */
2994
+ get isSizeMiddleWareUsed() {
2995
+ return this.sync || this.autoSize;
2996
+ }
2997
+ disconnectedCallback() {
2998
+ super.disconnectedCallback(), this.stop();
2999
+ }
3000
+ runFirstUpdated() {
3001
+ if (this.strategy === "overlay" && (this.start(), !re)) {
3002
+ const e = Ve(this);
3003
+ e && (this.autoSizeBoundary = e, this.flipBoundary = e, this.shiftBoundary = e);
3004
+ }
3005
+ }
3006
+ async updated(e) {
3007
+ super.updated(e), e.has("active") && (this.active ? this.strategy !== "overlay" && (this.start(), this.emit("cx-opened"), this.overlayOpened = !0) : this.stop()), e.has("anchor") && this.handleAnchorChange(), this.active && this.overlayOpened && (await this.updateComplete, this.reposition());
3008
+ }
3009
+ async handleAnchorChange() {
3010
+ if (await this.stop(), this.anchor && typeof this.anchor == "string") {
3011
+ const e = this.getRootNode();
3012
+ this.anchorEl = e.getElementById(this.anchor);
3013
+ } else this.anchor instanceof Element || _o(this.anchor) ? this.anchorEl = this.anchor : this.anchorEl = this.querySelector('[slot="anchor"]');
3014
+ this.anchorEl instanceof HTMLSlotElement && (this.anchorEl = this.anchorEl.assignedElements({
3015
+ flatten: !0
3016
+ })[0]), this.anchorEl instanceof Element && this.anchorEl.tagName.toLowerCase() === "cx-dialog" && (this.anchorEl = this.anchorEl?.shadowRoot?.querySelector(
3017
+ '[part="panel"]'
3018
+ )), this.anchorEl && this.start();
3019
+ }
3020
+ async handleOverlayOpened(e) {
3021
+ e.target === this.overlay && (this.cleanup?.(), this.start(), await this.updateComplete, this.active && (this.emit("cx-opened"), this.overlayOpened = !0));
3022
+ }
3023
+ start() {
3024
+ this.anchorEl && (this.cleanup = Ht(this.anchorEl, this.popup, () => {
3025
+ this.reposition();
3026
+ }));
3027
+ }
3028
+ async stop() {
3029
+ return this.active || (this.overlayOpened = !1), new Promise((e) => {
3030
+ this.cleanup ? (this.cleanup(), this.cleanup = void 0, this.removeAttribute("data-current-placement"), this.style.removeProperty("--auto-size-available-width"), this.style.removeProperty("--auto-size-available-height"), requestAnimationFrame(() => e())) : e();
3031
+ });
3032
+ }
3033
+ /** Forces the popup to recalculate and reposition itself. */
3034
+ reposition() {
3035
+ if (!this.active || !this.anchorEl)
3036
+ return;
3037
+ const e = [
3038
+ // The offset middleware goes first
3039
+ this.placement === "center" ? Wt(
3040
+ ({ rects: t }) => -t.reference.height / 2 - t.floating.height / 2
3041
+ ) : Wt({ crossAxis: this.skidding, mainAxis: this.distance })
3042
+ ];
3043
+ if (this.sync ? e.push(
3044
+ Vt({
3045
+ apply: ({ rects: t }) => {
3046
+ const o = this.sync === "width" || this.sync === "both", i = this.sync === "height" || this.sync === "both", s = this.syncElement ? this.syncElement.getBoundingClientRect() : t.reference;
3047
+ this.popup.style.width = o ? `${s.width}px` : "", this.popup.style.height = i ? `${s.height}px` : "";
3048
+ }
3049
+ })
3050
+ ) : (this.popup.style.width = "", this.popup.style.height = ""), this.flip) {
3051
+ let t = this.flipBoundary;
3052
+ !t && ["fixed", "overlay"].includes(this.strategy) && (t = document.body), e.push(
3053
+ qt({
3054
+ boundary: t,
3055
+ // @ts-expect-error - We're converting a string attribute to an array here
3056
+ fallbackPlacements: this.flipFallbackPlacements,
3057
+ fallbackStrategy: this.flipFallbackStrategy === "best-fit" ? "bestFit" : "initialPlacement",
3058
+ padding: this.flipPadding
3059
+ })
3060
+ );
3061
+ }
3062
+ if (this.shift) {
3063
+ let t = this.shiftBoundary;
3064
+ !t && ["fixed", "overlay"].includes(this.strategy) && (t = document.body), e.push(
3065
+ ke({
3066
+ boundary: t,
3067
+ padding: this.shiftPadding
3068
+ })
3069
+ );
3070
+ }
3071
+ if (this.autoSize) {
3072
+ let t = this.autoSizeBoundary;
3073
+ !t && ["fixed", "overlay"].includes(this.strategy) && (t = document.body), e.push(
3074
+ Vt({
3075
+ apply: ({ availableHeight: o, availableWidth: i }) => {
3076
+ this.autoSize === "vertical" || this.autoSize === "both" ? this.style.setProperty(
3077
+ "--auto-size-available-height",
3078
+ `${o}px`
3079
+ ) : this.style.removeProperty("--auto-size-available-height"), this.autoSize === "horizontal" || this.autoSize === "both" ? this.style.setProperty(
3080
+ "--auto-size-available-width",
3081
+ `${i * this.autoWidthFactor}px`
3082
+ ) : this.style.removeProperty("--auto-size-available-width");
3083
+ },
3084
+ boundary: t,
3085
+ padding: this.autoSizePadding
3086
+ })
3087
+ );
3088
+ } else
3089
+ this.style.removeProperty("--auto-size-available-width"), this.style.removeProperty("--auto-size-available-height");
3090
+ this.arrow && e.push(
3091
+ _e({
3092
+ element: this.arrowEl,
3093
+ padding: this.arrowPadding
3094
+ })
3095
+ ), this.hide && e.push(
3096
+ ho({
3097
+ boundary: this.hideBoundary,
3098
+ strategy: this.hideBoundaryStrategy
3099
+ })
3100
+ ), Fe(this.anchorEl, this.popup, {
3101
+ middleware: e,
3102
+ placement: this.placement === "center" ? "bottom" : this.placement,
3103
+ platform: {
3104
+ ...Mt,
3105
+ getOffsetParent: (t) => this.strategy === "absolute" ? Mt.getOffsetParent(t, Ro) : this.strategy === "overlay" && re ? window : Ue(t) || window
3106
+ },
3107
+ strategy: ["overlay", "fixed"].includes(this.strategy) ? "fixed" : "absolute"
3108
+ }).then(({ middlewareData: t, placement: o, x: i, y: s }) => {
3109
+ const r = this.localize.dir() === "rtl", n = {
3110
+ bottom: "top",
3111
+ left: "right",
3112
+ right: "left",
3113
+ top: "bottom"
3114
+ }[o.split("-")[0]];
3115
+ if (this.setAttribute("data-current-placement", o), this.anchorEl === document.body && this.placement === "center") {
3116
+ const a = window.innerWidth, l = window.innerHeight, c = this.popup.offsetWidth, h = this.popup.offsetHeight, d = (a - c) / 2, u = (l - h) / 2;
3117
+ Object.assign(this.popup.style, { left: `${d}px`, top: `${u}px` });
3118
+ } else
3119
+ Object.assign(this.popup.style, {
3120
+ left: `${i}px`,
3121
+ top: `${s}px`
3122
+ });
3123
+ if (this.arrow) {
3124
+ const a = t.arrow.x, l = t.arrow.y;
3125
+ let c = "", h = "", d = "", u = "";
3126
+ if (this.arrowPlacement === "start") {
3127
+ const p = typeof a == "number" ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : "";
3128
+ c = typeof l == "number" ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : "", h = r ? p : "", u = r ? "" : p;
3129
+ } else if (this.arrowPlacement === "end") {
3130
+ const p = typeof a == "number" ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : "";
3131
+ h = r ? "" : p, u = r ? p : "", d = typeof l == "number" ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : "";
3132
+ } else this.arrowPlacement === "center" ? (u = typeof a == "number" ? "calc(50% - var(--arrow-size-diagonal))" : "", c = typeof l == "number" ? "calc(50% - var(--arrow-size-diagonal))" : "") : (u = typeof a == "number" ? `${a}px` : "", c = typeof l == "number" ? `${l}px` : "");
3133
+ Object.assign(this.arrowEl.style, {
3134
+ bottom: d,
3135
+ left: u,
3136
+ right: h,
3137
+ top: c
3138
+ }), this.arrowEl.style.setProperty(
3139
+ n,
3140
+ "calc(var(--arrow-size-diagonal) * -1)"
3141
+ );
3142
+ }
3143
+ t.hide && Object.assign(this.popup.style, {
3144
+ visibility: t.hide.escaped ? "hidden" : "visible"
3145
+ });
3146
+ }).catch(() => {
3147
+ }), requestAnimationFrame(() => {
3148
+ this.updateHoverBridge(), this.emit("cx-reposition");
3149
+ });
3150
+ }
3151
+ render() {
3152
+ const e = j`<cx-overlay
3153
+ ?open=${this.active}
3154
+ placement="bottom"
3155
+ type="manual"
3156
+ @cx-opened=${this.handleOverlayOpened}
3157
+ >
3158
+ <div
3159
+ part="popup"
3160
+ class=${Dt({
3161
+ popup: !0,
3162
+ "popup--active": this.overlayOpened,
3163
+ "popup--has-arrow": this.arrow,
3164
+ "popup--overlay": !0,
3165
+ "popup--use-size-middleware": this.isSizeMiddleWareUsed
3166
+ })}
3167
+ >
3168
+ <slot></slot>
3169
+ ${this.arrow ? j`<div
3170
+ part="arrow"
3171
+ class="popup__arrow"
3172
+ role="presentation"
3173
+ ></div>` : ""}
3174
+ </div>
3175
+ </cx-overlay>`;
3176
+ return j`
3177
+ <slot name="anchor" @slotchange=${this.handleAnchorChange}></slot>
3178
+
3179
+ <span
3180
+ part="hover-bridge"
3181
+ class=${Dt({
3182
+ "popup-hover-bridge": !0,
3183
+ "popup-hover-bridge--visible": this.hoverBridge && this.active
3184
+ })}
3185
+ ></span>
3186
+
3187
+ ${Ye(
3188
+ this.strategy === "overlay",
3189
+ () => e,
3190
+ () => j`<div
3191
+ part="popup"
3192
+ class=${Dt({
3193
+ popup: !0,
3194
+ "popup--active": this.active,
3195
+ "popup--fixed": this.strategy === "fixed",
3196
+ "popup--has-arrow": this.arrow,
3197
+ "popup--use-size-middleware": this.isSizeMiddleWareUsed
3198
+ })}
3199
+ >
3200
+ <slot></slot>
3201
+ ${this.arrow ? j`<div
3202
+ part="arrow"
3203
+ class="popup__arrow"
3204
+ role="presentation"
3205
+ ></div>` : ""}
3206
+ </div>`
3207
+ )}
3208
+ `;
3209
+ }
3210
+ };
3211
+ b.styles = [we, Lo];
3212
+ w([
3213
+ ut(".popup")
3214
+ ], b.prototype, "popup", 2);
3215
+ w([
3216
+ ut(".popup__arrow")
3217
+ ], b.prototype, "arrowEl", 2);
3218
+ w([
3219
+ ut("cx-overlay")
3220
+ ], b.prototype, "overlay", 2);
3221
+ w([
3222
+ v()
3223
+ ], b.prototype, "anchor", 2);
3224
+ w([
3225
+ v({ reflect: !0, type: Boolean })
3226
+ ], b.prototype, "active", 2);
3227
+ w([
3228
+ v({ reflect: !0 })
3229
+ ], b.prototype, "placement", 2);
3230
+ w([
3231
+ v({ reflect: !0 })
3232
+ ], b.prototype, "strategy", 2);
3233
+ w([
3234
+ v({ type: Number })
3235
+ ], b.prototype, "distance", 2);
3236
+ w([
3237
+ v({ type: Number })
3238
+ ], b.prototype, "skidding", 2);
3239
+ w([
3240
+ v({ type: Boolean })
3241
+ ], b.prototype, "arrow", 2);
3242
+ w([
3243
+ v({ attribute: "arrow-placement" })
3244
+ ], b.prototype, "arrowPlacement", 2);
3245
+ w([
3246
+ v({ attribute: "arrow-padding", type: Number })
3247
+ ], b.prototype, "arrowPadding", 2);
3248
+ w([
3249
+ v({ type: Boolean })
3250
+ ], b.prototype, "flip", 2);
3251
+ w([
3252
+ v({ type: Boolean })
3253
+ ], b.prototype, "hide", 2);
3254
+ w([
3255
+ v({ attribute: "hide-boundary", type: Object })
3256
+ ], b.prototype, "hideBoundary", 2);
3257
+ w([
3258
+ v({ attribute: "hide-boundary-strategy" })
3259
+ ], b.prototype, "hideBoundaryStrategy", 2);
3260
+ w([
3261
+ v({
3262
+ attribute: "flip-fallback-placements",
3263
+ converter: {
3264
+ fromAttribute: (e) => e.split(" ").map((t) => t.trim()).filter((t) => t !== ""),
3265
+ toAttribute: (e) => e.join(" ")
3266
+ }
3267
+ })
3268
+ ], b.prototype, "flipFallbackPlacements", 2);
3269
+ w([
3270
+ v({ attribute: "flip-fallback-strategy" })
3271
+ ], b.prototype, "flipFallbackStrategy", 2);
3272
+ w([
3273
+ v({ attribute: "flip-boundary", type: Object })
3274
+ ], b.prototype, "flipBoundary", 2);
3275
+ w([
3276
+ v({ attribute: "flip-padding", type: Number })
3277
+ ], b.prototype, "flipPadding", 2);
3278
+ w([
3279
+ v({ type: Boolean })
3280
+ ], b.prototype, "shift", 2);
3281
+ w([
3282
+ v({ attribute: "shift-boundary", type: Object })
3283
+ ], b.prototype, "shiftBoundary", 2);
3284
+ w([
3285
+ v({ attribute: "shift-padding", type: Number })
3286
+ ], b.prototype, "shiftPadding", 2);
3287
+ w([
3288
+ v({ attribute: "auto-size" })
3289
+ ], b.prototype, "autoSize", 2);
3290
+ w([
3291
+ v()
3292
+ ], b.prototype, "sync", 2);
3293
+ w([
3294
+ v({ attribute: "sync-element" })
3295
+ ], b.prototype, "syncElement", 2);
3296
+ w([
3297
+ v({ attribute: "auto-size-boundary", type: Object })
3298
+ ], b.prototype, "autoSizeBoundary", 2);
3299
+ w([
3300
+ v({ attribute: "auto-size-padding", type: Number })
3301
+ ], b.prototype, "autoSizePadding", 2);
3302
+ w([
3303
+ v({ attribute: "hover-bridge", type: Boolean })
3304
+ ], b.prototype, "hoverBridge", 2);
3305
+ w([
3306
+ v({ attribute: "auto-width-factor" })
3307
+ ], b.prototype, "autoWidthFactor", 2);
3308
+ w([
3309
+ be()
3310
+ ], b.prototype, "overlayOpened", 2);
3311
+ w([
3312
+ Xe(200)
3313
+ ], b.prototype, "start", 1);
3314
+ b = w([
3315
+ We("cx-popup")
3316
+ ], b);
3317
+ export {
3318
+ b as C,
3319
+ Xe as d
3320
+ };