@luzmo/lucero 1.0.1-alpha.3 → 1.0.1-alpha.30

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 (232) hide show
  1. package/components/accordion/index.cjs +6 -6
  2. package/components/accordion/index.js +13 -12
  3. package/components/action-bar/index.cjs +4 -4
  4. package/components/action-bar/index.js +11 -9
  5. package/components/action-button/index.cjs +3 -3
  6. package/components/action-button/index.js +6 -5
  7. package/components/action-group/index.cjs +1 -1
  8. package/components/action-group/index.js +1 -1
  9. package/components/{action-group-DBImibFn.js → action-group-Bwt9w8Vh.js} +10 -9
  10. package/components/action-group-D917z7XF.cjs +20 -0
  11. package/components/action-menu/index.cjs +9 -9
  12. package/components/action-menu/index.js +9 -9
  13. package/components/avatar/index.cjs +3 -3
  14. package/components/avatar/index.js +6 -6
  15. package/components/base-5nDSSNeT.cjs +18 -0
  16. package/components/base-CdYjmV_8.js +96 -0
  17. package/components/button/button-base.d.ts +16 -0
  18. package/components/button/button.d.ts +38 -2
  19. package/components/button/index.cjs +2 -2
  20. package/components/button/index.js +34 -29
  21. package/components/{button-base-DbkDzb71.js → button-base-B5uul3tZ.js} +54 -39
  22. package/components/button-base-C7or8-FB.cjs +25 -0
  23. package/components/button-group/index.cjs +1 -1
  24. package/components/button-group/index.js +10 -8
  25. package/components/calendar/index.cjs +96 -1
  26. package/components/calendar/index.js +538 -6
  27. package/components/checkbox/index.cjs +4 -4
  28. package/components/checkbox/index.js +6 -4
  29. package/components/{checkbox-mixin-Do7EgtpQ.js → checkbox-mixin-DUbGDm7f.js} +9 -9
  30. package/components/{checkbox-mixin-BDN0dBtS.cjs → checkbox-mixin-DhN8CIXY.cjs} +3 -3
  31. package/components/{clear-button-DoeRUWQ3.js → clear-button-BFtJVPzm.js} +14 -13
  32. package/components/clear-button-_a8GjtJC.cjs +18 -0
  33. package/components/{close-button-BWXdHSx3.js → close-button-D9qjjy2w.js} +13 -12
  34. package/components/close-button-TZ08VFmi.cjs +18 -0
  35. package/components/color-area/index.cjs +5 -5
  36. package/components/color-area/index.js +11 -10
  37. package/components/color-controller-7sNUf7SP.js +386 -0
  38. package/components/color-controller-ChN-A9Ft.cjs +18 -0
  39. package/components/color-field/color-field.d.ts +8 -0
  40. package/components/color-field/index.cjs +4 -4
  41. package/components/color-field/index.js +37 -24
  42. package/components/color-handle/index.cjs +2 -2
  43. package/components/color-handle/index.js +7 -5
  44. package/components/color-loupe/index.cjs +1 -1
  45. package/components/color-loupe/index.js +1 -1
  46. package/components/color-loupe-CIEFp7ln.cjs +56 -0
  47. package/components/{color-loupe-CmMsXbjT.js → color-loupe-CLPX6xVb.js} +6 -4
  48. package/components/color-menu/index.cjs +8 -8
  49. package/components/color-menu/index.js +45 -45
  50. package/components/color-palette/color-palette.d.ts +38 -3
  51. package/components/color-palette/index.cjs +1 -1
  52. package/components/color-palette/index.js +53 -39
  53. package/components/color-palette-group/color-palette-group.d.ts +79 -0
  54. package/components/color-palette-group/index.cjs +28 -0
  55. package/components/color-palette-group/index.d.ts +7 -0
  56. package/components/color-palette-group/index.js +206 -0
  57. package/components/color-picker/color-picker.d.ts +31 -2
  58. package/components/color-picker/index.cjs +6 -5
  59. package/components/color-picker/index.js +15 -11
  60. package/components/color-slider/index.cjs +40 -1
  61. package/components/color-slider/index.js +452 -6
  62. package/components/date-time-picker/index.cjs +16 -16
  63. package/components/date-time-picker/index.js +104 -105
  64. package/components/{dependency-manger-CEXvGQUV.js → dependency-manger-CO-VPlqq.js} +4 -4
  65. package/components/{dependency-manger-C5HCkMMB.cjs → dependency-manger-uthev62E.cjs} +1 -1
  66. package/components/divider/index.cjs +1 -1
  67. package/components/divider/index.js +10 -8
  68. package/components/field-group/index.cjs +1 -1
  69. package/components/field-group/index.js +1 -1
  70. package/components/field-group-BYHNJmv0.cjs +23 -0
  71. package/components/{field-group-DXfBWrkO.js → field-group-CHmw159R.js} +7 -5
  72. package/components/field-label/index.cjs +1 -1
  73. package/components/field-label/index.js +1 -1
  74. package/components/{field-label-CZ2zzChK.js → field-label-Cy3xMWZ-.js} +9 -8
  75. package/components/field-label-DZoeqJJX.cjs +25 -0
  76. package/components/{focus-visible-DBlJGoEW.js → focus-visible-BvScGDCE.js} +20 -20
  77. package/components/focus-visible-D4BXb5RB.cjs +18 -0
  78. package/components/{focusable-BxtpnzWp.js → focusable-BjvsvVam.js} +3 -2
  79. package/components/focusable-CbVKgGfS.cjs +18 -0
  80. package/components/icon/index.cjs +1 -1
  81. package/components/icon/index.js +22 -20
  82. package/components/index.cjs +1 -1
  83. package/components/index.js +139 -137
  84. package/components/infield-button/index.cjs +2 -2
  85. package/components/infield-button/index.js +4 -3
  86. package/components/label/index.cjs +1 -1
  87. package/components/label/index.js +6 -4
  88. package/components/{language-resolution-8yZa5r_P.js → language-resolution-B-wjV5bb.js} +9 -8
  89. package/components/{directive-C7oCP5Bh.cjs → language-resolution-EUER43cg.cjs} +1 -5
  90. package/components/like-anchor-B2EqJPdw.cjs +32 -0
  91. package/components/{like-anchor-Bvn_vLQ8.js → like-anchor-CgqCU210.js} +23 -22
  92. package/components/{manage-help-text-DhgARkZX.cjs → manage-help-text-Bat9yGvF.cjs} +3 -3
  93. package/components/{manage-help-text-syYnjKGL.js → manage-help-text-C9sCHK3R.js} +8 -8
  94. package/components/menu/index.cjs +38 -13
  95. package/components/menu/index.js +137 -104
  96. package/components/menu/menu-item.d.ts +8 -1
  97. package/components/multi-language-field/index.cjs +2 -2
  98. package/components/multi-language-field/index.js +8 -6
  99. package/components/number-field/index.cjs +6 -6
  100. package/components/number-field/index.js +33 -34
  101. package/components/observe-slot-presence-CNltc0C0.cjs +18 -0
  102. package/components/{observe-slot-presence-CmVi0zTc.js → observe-slot-presence-DFi6GE3H.js} +1 -1
  103. package/components/observe-slot-text-CBMHpuIK.cjs +18 -0
  104. package/components/{observe-slot-text-BPfIQQtz.js → observe-slot-text-DorVpCL4.js} +14 -15
  105. package/components/options/index.cjs +26 -58
  106. package/components/options/index.js +205 -849
  107. package/components/overlay/index.cjs +6 -6
  108. package/components/overlay/index.js +30 -31
  109. package/components/overlay-DpWon1Rp.js +1736 -0
  110. package/components/overlay-nUwFClQq.cjs +47 -0
  111. package/components/{pending-state-CaH1si5b.cjs → pending-state-DQctFHI8.cjs} +2 -2
  112. package/components/{pending-state-DTX7ggyF.js → pending-state-Dx1u3EXA.js} +2 -2
  113. package/components/picker/index.cjs +1 -1
  114. package/components/picker/index.js +2 -2
  115. package/components/{picker-BmoXv1jt.js → picker-Cm6_didQ.js} +44 -44
  116. package/components/picker-DxYgh4LR.cjs +123 -0
  117. package/components/picker-button/index.cjs +4 -4
  118. package/components/picker-button/index.js +7 -6
  119. package/components/{platform-BiXhwqk3.cjs → platform-BJnOJJag.cjs} +1 -1
  120. package/components/{platform-BM-uMWpX.js → platform-CqwNrovd.js} +12 -12
  121. package/components/popover/index.cjs +1 -1
  122. package/components/popover/index.js +1 -1
  123. package/components/popover-lcZnODPK.cjs +30 -0
  124. package/components/{popover-DjX0aAnY.js → popover-ucIgjbQs.js} +8 -7
  125. package/components/progress-circle/index.cjs +1 -1
  126. package/components/progress-circle/index.js +1 -1
  127. package/components/{progress-circle-DXH9z8-6.js → progress-circle-D5J0ZwY0.js} +8 -7
  128. package/components/progress-circle-DgMbqrzG.cjs +33 -0
  129. package/components/radio/index.cjs +2 -2
  130. package/components/radio/index.js +11 -10
  131. package/components/search/index.cjs +6 -6
  132. package/components/search/index.js +5 -5
  133. package/components/select/index.cjs +43 -43
  134. package/components/select/index.js +106 -91
  135. package/components/select/select.d.ts +1 -1
  136. package/components/{base-BjTwmyRF.cjs → sized-mixin-DcvJLFeo.cjs} +1 -5
  137. package/components/{sized-mixin-D4ACoVUr.js → sized-mixin-cJbo3PKR.js} +5 -5
  138. package/components/slider/index.cjs +1 -1
  139. package/components/slider/index.js +48 -1101
  140. package/components/{strategies-9indNIEb.js → strategies-Bk97oVn1.js} +15 -50
  141. package/components/strategies-CNgBb6dM.cjs +18 -0
  142. package/components/{streaming-listener-CP-JE6Fa.js → streaming-listener-BlWm-XZU.js} +5 -6
  143. package/components/streaming-listener-D9Wc7skA.cjs +18 -0
  144. package/components/swatch/index.cjs +7 -7
  145. package/components/swatch/index.js +17 -16
  146. package/components/switch/index.cjs +2 -2
  147. package/components/switch/index.js +5 -4
  148. package/components/tabs/index.cjs +16 -24
  149. package/components/tabs/index.js +93 -161
  150. package/components/tags/index.cjs +4 -4
  151. package/components/tags/index.js +14 -13
  152. package/components/text-field/index.cjs +3 -3
  153. package/components/text-field/index.js +12 -10
  154. package/components/text-field/text-field.d.ts +1 -0
  155. package/components/{text-field-BIADXoLC.js → text-field-BTEpwGFu.js} +73 -99
  156. package/components/text-field-JMrsh-zo.cjs +81 -0
  157. package/components/{text-field.module-ColtFhf_.js → text-field.module-C2KVUJcX.js} +1 -1
  158. package/components/{text-field.module-p_VF2tC_.cjs → text-field.module-DXhFA9G-.cjs} +1 -1
  159. package/components/toast/index.cjs +11 -11
  160. package/components/toast/index.js +10 -8
  161. package/components/tooltip/index.cjs +4 -4
  162. package/components/tooltip/index.js +60 -36
  163. package/components/tooltip/tooltip.d.ts +12 -1
  164. package/components/unit-input/index.cjs +6 -6
  165. package/components/unit-input/index.js +10 -9
  166. package/components/utils.cjs +1 -1
  167. package/components/utils.js +6 -6
  168. package/custom-elements.json +1 -1
  169. package/index.d.ts +1 -0
  170. package/package.json +67 -1
  171. package/components/NumberFormatter-DewVDY5w.cjs +0 -18
  172. package/components/NumberFormatter-DgOUVrge.js +0 -136
  173. package/components/NumberParser-Dik4a0h-.cjs +0 -18
  174. package/components/NumberParser-ci9J5EKv.js +0 -173
  175. package/components/action-group-DJGMcRHb.cjs +0 -20
  176. package/components/async-directive-BX1T1e1_.cjs +0 -22
  177. package/components/async-directive-BfcqVjDp.js +0 -82
  178. package/components/base-CBCg3yyw.cjs +0 -40
  179. package/components/base-D76d76ww.js +0 -26
  180. package/components/base-WsynuqaS.js +0 -677
  181. package/components/button-base-XgPLmwP-.cjs +0 -25
  182. package/components/class-map-Di1D_rCm.cjs +0 -22
  183. package/components/class-map-NbVXqBU0.js +0 -51
  184. package/components/clear-button-Qi1pMA5S.cjs +0 -18
  185. package/components/close-button-BFMBEw3q.cjs +0 -18
  186. package/components/color-controller-DTp1juRz.js +0 -3198
  187. package/components/color-controller-_ZwyhvaU.cjs +0 -18
  188. package/components/color-loupe-CaA_Lfkk.cjs +0 -56
  189. package/components/directive-helpers-Cm6gitnu.js +0 -62
  190. package/components/directive-helpers-DyIRTWwA.cjs +0 -22
  191. package/components/directive-oAbCiebi.js +0 -44
  192. package/components/field-group-DkGst3r5.cjs +0 -23
  193. package/components/field-label-mO1AkUgR.cjs +0 -25
  194. package/components/flow-D-0MTYCm.js +0 -527
  195. package/components/flow-DM3dNAKs.cjs +0 -30
  196. package/components/focus-visible-B0P9aY_G.cjs +0 -18
  197. package/components/focusable-EbipgXRh.cjs +0 -18
  198. package/components/if-defined-C9YGdo33.cjs +0 -22
  199. package/components/if-defined-DOaE2coe.js +0 -27
  200. package/components/index-A-yOTB_d.js +0 -1490
  201. package/components/index-BLWuwZXx.cjs +0 -113
  202. package/components/index-BwxgAdzi.cjs +0 -57
  203. package/components/index-HjQa8tew.js +0 -1174
  204. package/components/language-resolution-DJzmyzZq.cjs +0 -18
  205. package/components/like-anchor-sod1C1fR.cjs +0 -32
  206. package/components/luzmo-icons-DbwDQtuO.js +0 -229
  207. package/components/luzmo-icons-DletXGWU.cjs +0 -29
  208. package/components/mutation-controller-DH7YOCyj.js +0 -52
  209. package/components/mutation-controller-DkOMCW-c.cjs +0 -22
  210. package/components/observe-slot-presence-bc9chhsi.cjs +0 -18
  211. package/components/observe-slot-text-Ceb7SvYT.cjs +0 -18
  212. package/components/overlay-Cig9r6uU.js +0 -2747
  213. package/components/overlay-KSKMzzkh.cjs +0 -47
  214. package/components/picker-DWsBWdPN.cjs +0 -123
  215. package/components/popover-KFfO0IYL.cjs +0 -30
  216. package/components/progress-circle-BvRJNuNo.cjs +0 -33
  217. package/components/query-BL-TJj7K.cjs +0 -22
  218. package/components/query-D_KR_GUc.js +0 -51
  219. package/components/query-assigned-elements-DjfhL1cl.js +0 -36
  220. package/components/query-assigned-elements-DsKsfk7G.cjs +0 -22
  221. package/components/query-assigned-nodes-BcKWmGzy.cjs +0 -22
  222. package/components/query-assigned-nodes-C76XVPWY.js +0 -36
  223. package/components/sized-mixin-CPxE5C96.cjs +0 -18
  224. package/components/state-D8JEtYqe.cjs +0 -22
  225. package/components/state-Deh-vKYE.js +0 -29
  226. package/components/strategies-BACP6MhR.cjs +0 -18
  227. package/components/streaming-listener-B00MvALi.cjs +0 -18
  228. package/components/style-map-CeilmSgs.cjs +0 -22
  229. package/components/style-map-IgqIKvlE.js +0 -53
  230. package/components/text-field-D5d_Gt0t.cjs +0 -85
  231. package/components/when-CDK1Tt5Y.js +0 -28
  232. package/components/when-CDZyJPvd.cjs +0 -22
@@ -0,0 +1,1736 @@
1
+ /*! * Lucero - The design system for Luzmo.
2
+ *
3
+ * Copyright © 2025 Luzmo
4
+ * All rights reserved.
5
+ * Lucero (“Luzmo Design System”) must be used according to the Luzmo Terms of Service.
6
+ * This license allows users with a current active Luzmo account to use Lucero.
7
+ * This license terminates automatically if a user no longer has an active Luzmo account.
8
+ * Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
9
+ *
10
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
15
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
16
+ * SOFTWARE.
17
+ * */
18
+ import { unsafeCSS as te, html as x } from "lit";
19
+ import { property as y, query as X, queryAssignedElements as ie, state as se } from "lit/decorators.js";
20
+ import { ifDefined as k } from "lit/directives/if-defined.js";
21
+ import { styleMap as V } from "lit/directives/style-map.js";
22
+ import { r as I } from "./random-id-ByCz1xaq.js";
23
+ import { E as oe, e as ne } from "./element-resolution-FCUT-wql.js";
24
+ import { a as re } from "./base-CdYjmV_8.js";
25
+ import { u as O } from "./focusable-selectors-B4YgbghQ.js";
26
+ import { autoUpdate as j, flip as G, offset as ae, shift as le, size as he, arrow as ce, computePosition as pe } from "@floating-ui/dom";
27
+ import { S as de, r as ue } from "./slottable-request-event-DggLA4Rx.js";
28
+ import { c as _ } from "./condition-attribute-with-id-Dv4lSRbe.js";
29
+ import { f as Y, c as me, j as ge } from "./platform-CqwNrovd.js";
30
+ function fe(a, e, t = []) {
31
+ for (const [i, s] of e.entries()) {
32
+ const n = a[i], r = n.parentElement || n.getRootNode();
33
+ t[i] && t[i](s), r && r !== n && n.replaceWith(s), delete a[i];
34
+ }
35
+ return e;
36
+ }
37
+ const ve = (a, e, {
38
+ position: t,
39
+ prepareCallback: i
40
+ } = { position: "beforeend" }) => {
41
+ let { length: s } = a;
42
+ if (s === 0)
43
+ return () => a;
44
+ let n = 1, r = 0;
45
+ (t === "afterbegin" || t === "afterend") && (n = -1, r = s - 1);
46
+ const o = new Array(s), h = new Array(s), p = typeof document < "u" ? document.createComment("placeholder for reparented element") : null;
47
+ do {
48
+ const l = a[r];
49
+ i && (h[r] = i(l)), o[r] = p.cloneNode();
50
+ const c = l.parentElement || l.getRootNode();
51
+ c && c !== l && c.replaceChild(o[r], l), e.insertAdjacentElement(t, l), r += n;
52
+ } while (--s > 0);
53
+ return function() {
54
+ return fe(o, a, h);
55
+ };
56
+ }, ye = 1e3, be = 1e3;
57
+ class we {
58
+ constructor(e = {}) {
59
+ this.warmUpDelay = ye, this.coolDownDelay = be, this.isWarm = !1, this.timeout = 0, Object.assign(this, e);
60
+ }
61
+ openTimer(e) {
62
+ if (this.cancelCooldownTimer(), !this.component || e !== this.component)
63
+ return this.component && (this.close(this.component), this.cancelCooldownTimer()), this.component = e, this.isWarm ? Promise.resolve(!1) : (this.promise = new Promise((t) => {
64
+ this.resolve = t, this.timeout = typeof window < "u" ? window.setTimeout(() => {
65
+ this.resolve && (this.resolve(!1), this.isWarm = !0);
66
+ }, this.warmUpDelay) : 0;
67
+ }), this.promise);
68
+ if (this.promise)
69
+ return this.promise;
70
+ throw new Error("Inconsistent state");
71
+ }
72
+ close(e) {
73
+ this.component && this.component === e && (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);
74
+ }
75
+ resetCooldownTimer() {
76
+ this.isWarm && (this.cooldownTimeout && typeof window < "u" && window.clearTimeout(this.cooldownTimeout), this.cooldownTimeout = typeof window < "u" ? window.setTimeout(() => {
77
+ this.isWarm = !1, delete this.cooldownTimeout;
78
+ }, this.coolDownDelay) : void 0);
79
+ }
80
+ cancelCooldownTimer() {
81
+ this.cooldownTimeout && typeof window < "u" && window.clearTimeout(this.cooldownTimeout), delete this.cooldownTimeout;
82
+ }
83
+ }
84
+ const A = new we(), E = () => {
85
+ }, $ = (a, e, t) => {
86
+ const i = new AbortController(), s = /* @__PURE__ */ new Map(), n = () => {
87
+ i.abort(), t();
88
+ };
89
+ let r, o;
90
+ const h = requestAnimationFrame(() => {
91
+ r = requestAnimationFrame(() => {
92
+ o = requestAnimationFrame(() => {
93
+ n();
94
+ });
95
+ });
96
+ }), p = (c) => {
97
+ c.target === a && (s.set(
98
+ c.propertyName,
99
+ s.get(c.propertyName) - 1
100
+ ), s.get(c.propertyName) || s.delete(c.propertyName), s.size === 0 && n());
101
+ }, l = (c) => {
102
+ c.target === a && (s.has(c.propertyName) || s.set(c.propertyName, 0), s.set(
103
+ c.propertyName,
104
+ s.get(c.propertyName) + 1
105
+ ), cancelAnimationFrame(h), cancelAnimationFrame(r), cancelAnimationFrame(o));
106
+ };
107
+ a.addEventListener("transitionrun", l, {
108
+ signal: i.signal
109
+ }), a.addEventListener("transitionend", p, {
110
+ signal: i.signal
111
+ }), a.addEventListener("transitioncancel", p, {
112
+ signal: i.signal
113
+ }), e();
114
+ };
115
+ function f() {
116
+ return new Promise((a) => requestAnimationFrame(() => a()));
117
+ }
118
+ class P extends re {
119
+ constructor() {
120
+ super(...arguments), this.dispose = E, this.offset = 0, this.willPreventClose = !1;
121
+ }
122
+ applyFocus(e, t) {
123
+ }
124
+ /* c8 ignore next 6 */
125
+ get delayed() {
126
+ return !1;
127
+ }
128
+ set delayed(e) {
129
+ }
130
+ /* c8 ignore next 6 */
131
+ get disabled() {
132
+ return !1;
133
+ }
134
+ set disabled(e) {
135
+ }
136
+ get elementResolver() {
137
+ return this._elementResolver;
138
+ }
139
+ set elementResolver(e) {
140
+ this._elementResolver = e;
141
+ }
142
+ /* c8 ignore next 3 */
143
+ ensureOnDOM(e) {
144
+ }
145
+ /* c8 ignore next 5 */
146
+ makeTransition(e) {
147
+ return null;
148
+ }
149
+ manageDelay(e) {
150
+ }
151
+ /* c8 ignore next 3 */
152
+ manageDialogOpen() {
153
+ }
154
+ /* c8 ignore next 3 */
155
+ managePopoverOpen() {
156
+ }
157
+ /* c8 ignore next 3 */
158
+ managePosition() {
159
+ }
160
+ /* c8 ignore next 6 */
161
+ get open() {
162
+ return !1;
163
+ }
164
+ set open(e) {
165
+ }
166
+ get placementController() {
167
+ return this._placementController;
168
+ }
169
+ set placementController(e) {
170
+ this._placementController = e;
171
+ }
172
+ requestSlottable() {
173
+ }
174
+ returnFocus() {
175
+ }
176
+ /* c8 ignore next 6 */
177
+ get state() {
178
+ return "closed";
179
+ }
180
+ set state(e) {
181
+ }
182
+ /* c8 ignore next 3 */
183
+ manuallyKeepOpen() {
184
+ }
185
+ static update() {
186
+ const e = new CustomEvent("luzmo-update-overlays", {
187
+ bubbles: !0,
188
+ composed: !0,
189
+ cancelable: !0
190
+ });
191
+ document.dispatchEvent(e);
192
+ }
193
+ static async open(e, t, i, s) {
194
+ await Promise.resolve().then(() => q);
195
+ const n = arguments.length === 2, r = i || e, o = new this();
196
+ let h = !1;
197
+ const p = ve([r], o, {
198
+ position: "beforeend",
199
+ prepareCallback: (g) => {
200
+ const w = g.slot;
201
+ return g.removeAttribute("slot"), () => {
202
+ g.slot = w;
203
+ };
204
+ }
205
+ });
206
+ if (o.dispose = () => {
207
+ o.addEventListener("luzmo-closed", () => {
208
+ h || (p(), h = !0), requestAnimationFrame(() => {
209
+ o.remove();
210
+ });
211
+ }), o.open = !1, o.dispose = E;
212
+ }, !n && r && s) {
213
+ const g = e, w = t, m = s;
214
+ return P.applyOptions(o, {
215
+ ...m,
216
+ delayed: m.delayed || r.hasAttribute("delayed"),
217
+ trigger: m.virtualTrigger || g,
218
+ type: w === "modal" ? "modal" : w === "hover" ? "hint" : "auto"
219
+ }), g.after(o), await o.updateComplete, o.open = !0, o.dispose;
220
+ }
221
+ const c = t;
222
+ return o.append(r), P.applyOptions(o, {
223
+ ...c,
224
+ delayed: c.delayed || r.hasAttribute("delayed")
225
+ }), o.updateComplete.then(() => {
226
+ o.open = !0;
227
+ }), o;
228
+ }
229
+ static applyOptions(e, t) {
230
+ e.delayed = !!t.delayed, e.receivesFocus = t.receivesFocus ?? "auto", e.triggerElement = t.trigger || null, e.type = t.type || "modal", e.offset = t.offset ?? 0, e.placement = t.placement, e.willPreventClose = !!t.notImmediatelyClosable;
231
+ }
232
+ }
233
+ const H = (a) => a.querySelector(
234
+ O
235
+ ), U = (a) => a.assignedElements().find((t) => t.matches(O));
236
+ class M extends Event {
237
+ constructor() {
238
+ super("beforetoggle", {
239
+ bubbles: !1,
240
+ composed: !1
241
+ }), this.currentState = "open", this.newState = "closed";
242
+ }
243
+ }
244
+ class W extends Event {
245
+ constructor() {
246
+ super("beforetoggle", {
247
+ bubbles: !1,
248
+ composed: !1
249
+ }), this.currentState = "closed", this.newState = "open";
250
+ }
251
+ }
252
+ class v extends Event {
253
+ constructor(e, t, {
254
+ publish: i,
255
+ interaction: s,
256
+ reason: n
257
+ }) {
258
+ super(e, {
259
+ bubbles: i,
260
+ composed: i
261
+ }), this.overlay = t, this.detail = {
262
+ interaction: s,
263
+ reason: n
264
+ };
265
+ }
266
+ }
267
+ class S {
268
+ constructor(e, t) {
269
+ this.x = 0, this.y = 0, this.x = e, this.y = t;
270
+ }
271
+ updateBoundingClientRect(e, t) {
272
+ this.x = e, this.y = t, P.update();
273
+ }
274
+ getBoundingClientRect() {
275
+ return {
276
+ width: 0,
277
+ height: 0,
278
+ top: this.y,
279
+ right: this.x,
280
+ y: this.y,
281
+ x: this.x,
282
+ bottom: this.y,
283
+ left: this.x,
284
+ /* c8 ignore next 3 */
285
+ toJSON() {
286
+ }
287
+ };
288
+ }
289
+ }
290
+ function Ee(a) {
291
+ class e extends a {
292
+ async manageDialogOpen() {
293
+ const i = this.open;
294
+ if (await f(), await this.managePosition(), this.open !== i)
295
+ return;
296
+ const s = await this.dialogMakeTransition(i);
297
+ this.open === i && await this.dialogApplyFocus(i, s);
298
+ }
299
+ dialogMakeTransition(i) {
300
+ let s = null;
301
+ const n = (o, h) => () => {
302
+ if (o.open = i, !i) {
303
+ const l = () => {
304
+ o.removeEventListener("close", l);
305
+ };
306
+ o.addEventListener("close", l);
307
+ }
308
+ if (h > 0)
309
+ return;
310
+ const p = i ? W : M;
311
+ this.dispatchEvent(new p()), i && (o.matches(O) && (s = o), s = s || H(o), s || o.querySelectorAll("slot").forEach((c) => {
312
+ s || (s = U(c));
313
+ }), !(!this.isConnected || this.dialogEl.open) && this.dialogEl.showModal());
314
+ }, r = (o, h) => () => {
315
+ if (this.open !== i)
316
+ return;
317
+ const p = i ? "luzmo-opened" : "luzmo-closed";
318
+ if (h > 0) {
319
+ o.dispatchEvent(
320
+ new v(p, this, {
321
+ interaction: this.type,
322
+ publish: !1
323
+ })
324
+ );
325
+ return;
326
+ }
327
+ if (!this.isConnected || i !== this.open)
328
+ return;
329
+ const l = async () => {
330
+ const c = this.triggerElement instanceof S;
331
+ this.dispatchEvent(
332
+ new v(p, this, {
333
+ interaction: this.type,
334
+ publish: c
335
+ })
336
+ ), o.dispatchEvent(
337
+ new v(p, this, {
338
+ interaction: this.type,
339
+ publish: !1
340
+ })
341
+ ), this.triggerElement && !c && this.triggerElement.dispatchEvent(
342
+ new v(p, this, {
343
+ interaction: this.type,
344
+ publish: !0
345
+ })
346
+ ), this.state = i ? "opened" : "closed", this.returnFocus(), await f(), await f(), i === this.open && i === !1 && this.requestSlottable();
347
+ };
348
+ !i && this.dialogEl.open ? (this.dialogEl.addEventListener(
349
+ "close",
350
+ () => {
351
+ l();
352
+ },
353
+ { once: !0 }
354
+ ), this.dialogEl.close()) : l();
355
+ };
356
+ return this.elements.forEach((o, h) => {
357
+ $(o, n(o, h), r(o, h));
358
+ }), s;
359
+ }
360
+ dialogApplyFocus(i, s) {
361
+ this.applyFocus(i, s);
362
+ }
363
+ }
364
+ return e;
365
+ }
366
+ function Pe(a) {
367
+ class e extends a {
368
+ async managePopoverOpen() {
369
+ await this.managePosition();
370
+ }
371
+ async manageDelay(i) {
372
+ if (i === !1 || i !== this.open) {
373
+ A.close(this);
374
+ return;
375
+ }
376
+ this.delayed && await A.openTimer(this) && (this.open = !i);
377
+ }
378
+ ensureOnDOM(i) {
379
+ document.body.offsetHeight;
380
+ }
381
+ makeTransition(i) {
382
+ if (this.open !== i)
383
+ return null;
384
+ let s = null;
385
+ const n = (o, h) => () => {
386
+ if (i !== this.open)
387
+ return;
388
+ if (o.open = i, h === 0) {
389
+ const l = i ? W : M;
390
+ this.dispatchEvent(new l());
391
+ }
392
+ if (i !== !0 || (o.matches(O) && (s = o), s = s || H(o), s))
393
+ return;
394
+ o.querySelectorAll("slot").forEach((l) => {
395
+ s || (s = U(l));
396
+ });
397
+ }, r = (o, h) => async () => {
398
+ if (this.open !== i)
399
+ return;
400
+ const p = i ? "luzmo-opened" : "luzmo-closed";
401
+ if (o.dispatchEvent(
402
+ new v(p, this, {
403
+ interaction: this.type
404
+ })
405
+ ), h > 0)
406
+ return;
407
+ const l = this.triggerElement instanceof S;
408
+ this.dispatchEvent(
409
+ new v(p, this, {
410
+ interaction: this.type,
411
+ publish: l
412
+ })
413
+ ), this.triggerElement && !l && this.triggerElement.dispatchEvent(
414
+ new v(p, this, {
415
+ interaction: this.type,
416
+ publish: !0
417
+ })
418
+ ), this.state = i ? "opened" : "closed", this.returnFocus(), await f(), await f(), i === this.open && i === !1 && this.requestSlottable();
419
+ };
420
+ return this.elements.forEach((o, h) => {
421
+ $(o, n(o, h), r(o, h));
422
+ }), s;
423
+ }
424
+ }
425
+ return e;
426
+ }
427
+ const Ce = CSS.supports("(overlay: auto)");
428
+ function J(a) {
429
+ let e = !1;
430
+ try {
431
+ e = a.matches(":popover-open");
432
+ } catch {
433
+ }
434
+ let t = !1;
435
+ try {
436
+ t = a.matches(":open");
437
+ } catch {
438
+ }
439
+ return e || t;
440
+ }
441
+ function Oe(a) {
442
+ class e extends a {
443
+ async manageDelay(i) {
444
+ if (i === !1 || i !== this.open) {
445
+ A.close(this);
446
+ return;
447
+ }
448
+ this.delayed && await A.openTimer(this) && (this.open = !i);
449
+ }
450
+ /**
451
+ * A popover should be hidden _after_ it is no longer on top-layer because
452
+ * the position metrics will have changed from when it was originally positioned.
453
+ */
454
+ shouldHidePopover(i) {
455
+ if (i && this.open !== i)
456
+ return;
457
+ const s = async ({
458
+ newState: n
459
+ } = {}) => {
460
+ n !== "open" && await this.placementController.resetOverlayPosition();
461
+ };
462
+ if (!J(this.dialogEl)) {
463
+ s();
464
+ return;
465
+ }
466
+ this.dialogEl.addEventListener("toggle", s, {
467
+ once: !0
468
+ });
469
+ }
470
+ shouldShowPopover(i) {
471
+ let s = !1;
472
+ try {
473
+ s = this.dialogEl.matches(":popover-open");
474
+ } catch {
475
+ }
476
+ let n = !1;
477
+ try {
478
+ n = this.dialogEl.matches(":open");
479
+ } catch {
480
+ }
481
+ i && this.open === i && !s && !n && this.isConnected && (this.dialogEl.showPopover(), this.managePosition());
482
+ }
483
+ async ensureOnDOM(i) {
484
+ Ce || await this.shouldHidePopover(i), this.shouldShowPopover(i), await f();
485
+ }
486
+ makeTransition(i) {
487
+ if (this.open !== i)
488
+ return null;
489
+ let s = null;
490
+ const n = (o, h) => () => {
491
+ if (o.open = i, h === 0) {
492
+ const l = i ? W : M;
493
+ this.dispatchEvent(new l());
494
+ }
495
+ if (!i || (o.matches(O) && (s = o), s = s || H(o), s))
496
+ return;
497
+ o.querySelectorAll("slot").forEach((l) => {
498
+ s || (s = U(l));
499
+ });
500
+ }, r = (o, h) => () => {
501
+ if (this.open !== i)
502
+ return;
503
+ const p = i ? "luzmo-opened" : "luzmo-closed";
504
+ if (h > 0) {
505
+ o.dispatchEvent(
506
+ new v(p, this, {
507
+ interaction: this.type,
508
+ publish: !1
509
+ })
510
+ );
511
+ return;
512
+ }
513
+ const l = async () => {
514
+ if (this.open !== i)
515
+ return;
516
+ await f();
517
+ const g = this.triggerElement instanceof S;
518
+ this.dispatchEvent(
519
+ new v(p, this, {
520
+ interaction: this.type,
521
+ publish: g
522
+ })
523
+ ), o.dispatchEvent(
524
+ new v(p, this, {
525
+ interaction: this.type,
526
+ publish: !1
527
+ })
528
+ ), this.triggerElement && !g && this.triggerElement.dispatchEvent(
529
+ new v(p, this, {
530
+ interaction: this.type,
531
+ publish: !0
532
+ })
533
+ ), this.state = i ? "opened" : "closed", this.returnFocus(), await f(), await f(), i === this.open && i === !1 && this.requestSlottable();
534
+ };
535
+ if (this.open !== i)
536
+ return;
537
+ const c = J(this.dialogEl);
538
+ i !== !0 && c && this.isConnected ? (this.dialogEl.addEventListener(
539
+ "beforetoggle",
540
+ () => {
541
+ l();
542
+ },
543
+ { once: !0 }
544
+ ), this.dialogEl.hidePopover()) : l();
545
+ };
546
+ return this.elements.forEach((o, h) => {
547
+ $(o, n(o, h), r(o, h));
548
+ }), s;
549
+ }
550
+ }
551
+ return e;
552
+ }
553
+ const Te = typeof document < "u" && "showPopover" in document.createElement("div");
554
+ class xe {
555
+ constructor() {
556
+ this.root = typeof document > "u" ? null : document.body, this.stack = [], this.handleScroll = (e) => {
557
+ typeof document < "u" && e.target !== document && e.target !== document.documentElement && e.target !== document.body || this.stack.forEach((t) => {
558
+ t.open && (t.type === "auto" && t.triggerElement instanceof HTMLElement && t.triggerElement.closest(
559
+ "luzmo-picker, luzmo-select, luzmo-action-menu"
560
+ ) && e.stopPropagation(), typeof document < "u" && document.dispatchEvent(
561
+ new CustomEvent("luzmo-update-overlays", {
562
+ bubbles: !0,
563
+ composed: !0,
564
+ cancelable: !0
565
+ })
566
+ ));
567
+ });
568
+ }, this.handlePointerdown = (e) => {
569
+ this.pointerdownPath = e.composedPath(), this.lastOverlay = this.stack.at(-1);
570
+ }, this.handlePointerup = () => {
571
+ const e = this.pointerdownPath;
572
+ if (this.pointerdownPath = void 0, this.stack.length === 0 || !(e != null && e.length))
573
+ return;
574
+ const t = this.lastOverlay;
575
+ this.lastOverlay = void 0;
576
+ const i = this.stack.length - 1, s = this.stack.filter((n, r) => !e.find(
577
+ (h) => (
578
+ // The Overlay is in the stack
579
+ h === n || // The Overlay trigger is in the stack and the Overlay is a "hint"
580
+ h === (n == null ? void 0 : n.triggerElement) && (n == null ? void 0 : n.type) === "hint" || // The last Overlay in the stack is not the last Overlay at `pointerdown` time and has a
581
+ // `triggerInteraction` of "longpress", meaning it was opened by this poitner interaction
582
+ r === i && n !== t && n.triggerInteraction === "longpress"
583
+ )
584
+ ) && !n.shouldPreventClose() && n.type !== "manual" && // Don't close if this overlay is modal and not on top of the overlay stack.
585
+ !(n.type === "modal" && t !== n));
586
+ s.reverse(), s.forEach((n) => {
587
+ this.closeOverlay(n);
588
+ let r = n.parentOverlayToForceClose;
589
+ for (; r; )
590
+ this.closeOverlay(r), r = r.parentOverlayToForceClose;
591
+ });
592
+ }, this.handleBeforetoggle = (e) => {
593
+ const { target: t, newState: i } = e;
594
+ i !== "open" && this.closeOverlay(t);
595
+ }, this.handleKeydown = (e) => {
596
+ if (e.code !== "Escape" || this.stack.length === 0)
597
+ return;
598
+ const t = this.stack.at(-1);
599
+ if ((t == null ? void 0 : t.type) === "page") {
600
+ e.preventDefault();
601
+ return;
602
+ }
603
+ if ((t == null ? void 0 : t.type) === "manual") {
604
+ this.closeOverlay(t);
605
+ return;
606
+ }
607
+ Te || t && this.closeOverlay(t);
608
+ }, typeof document < "u" && this.bindEvents();
609
+ }
610
+ get document() {
611
+ return this.root.ownerDocument || document;
612
+ }
613
+ bindEvents() {
614
+ typeof document < "u" && (this.document.addEventListener("pointerdown", this.handlePointerdown), this.document.addEventListener("pointerup", this.handlePointerup), this.document.addEventListener("keydown", this.handleKeydown), this.document.addEventListener("scroll", this.handleScroll, {
615
+ capture: !0
616
+ }));
617
+ }
618
+ closeOverlay(e) {
619
+ const t = this.stack.indexOf(e);
620
+ t !== -1 && this.stack.splice(t, 1), e.open = !1;
621
+ }
622
+ /**
623
+ * Get an array of Overlays that all share the same trigger element.
624
+ *
625
+ * @param triggerElement {HTMLELement}
626
+ * @returns
627
+ */
628
+ overlaysByTriggerElement(e) {
629
+ return this.stack.filter(
630
+ (t) => t.triggerElement === e
631
+ );
632
+ }
633
+ /**
634
+ * When overlays are added manage the open state of exisiting overlays appropriately:
635
+ * - 'modal': should close other non-'modal' and non-'manual' overlays
636
+ * - 'page': should close other non-'modal' and non-'manual' overlays
637
+ * - 'auto': should close other 'auto' overlays and other 'hint' overlays, but not 'manual' overlays
638
+ * - 'manual': shouldn't close other overlays
639
+ * - 'hint': shouldn't close other overlays and give way to all other overlays on a trigger
640
+ */
641
+ add(e) {
642
+ if (this.stack.includes(e)) {
643
+ const t = this.stack.indexOf(e);
644
+ t !== -1 && (this.stack.splice(t, 1), this.stack.push(e));
645
+ return;
646
+ }
647
+ if (e.type === "auto" || e.type === "modal" || e.type === "page") {
648
+ const t = "luzmo-overlay-query-path", i = new Event(t, {
649
+ composed: !0,
650
+ bubbles: !0
651
+ });
652
+ e.addEventListener(
653
+ t,
654
+ (s) => {
655
+ const n = s.composedPath();
656
+ this.stack.forEach((r) => {
657
+ !n.find((h) => h === r) && r.type !== "manual" && r.type !== "modal" && this.closeOverlay(r);
658
+ });
659
+ },
660
+ { once: !0 }
661
+ ), e.dispatchEvent(i);
662
+ } else if (e.type === "hint") {
663
+ if (this.stack.some(
664
+ (i) => i.type !== "manual" && i.triggerElement && i.triggerElement === e.triggerElement
665
+ )) {
666
+ e.open = !1;
667
+ return;
668
+ }
669
+ this.stack.forEach((i) => {
670
+ i.type === "hint" && this.closeOverlay(i);
671
+ });
672
+ }
673
+ requestAnimationFrame(() => {
674
+ this.stack.push(e), e.addEventListener("beforetoggle", this.handleBeforetoggle, {
675
+ once: !0
676
+ });
677
+ });
678
+ }
679
+ remove(e) {
680
+ this.closeOverlay(e);
681
+ }
682
+ }
683
+ const Q = new xe(), De = ':host{display:contents;pointer-events:none;--luzmo-overlay-animation-distance: .5rem}:host(:has(> luzmo-tooltip)){--luzmo-overlay-animation-distance: var( --luzmo-tooltip-animation-distance, 4px )}.dialog{margin:0;border:0;background:none;padding:0;position:fixed;overflow:visible;opacity:1!important;box-sizing:border-box;max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);max-width:calc(100vw - 16px);height:auto;inset:auto;top:0;left:0;display:flex;--luzmo-overlay-open: true}.dialog:not([is-visible]){display:none}.dialog:focus{outline:none}dialog:modal{--luzmo-popover-filter: drop-shadow(0px 2px 6px rgba(0, 0, 0, .15))}:host(:not([open])) .dialog{--luzmo-overlay-open: false}.dialog::backdrop{display:none}.dialog:before{position:absolute;top:-999em;right:-999em;bottom:-999em;left:-999em;content:"";pointer-events:auto!important}.dialog:not(.not-immediately-closable):before{display:none}.dialog>div{width:100%}::slotted(*){pointer-events:auto;visibility:visible!important}::slotted(luzmo-popover){position:static}.dialog:not([actual-placement])[placement*=top]{padding-block:var(--luzmo-overlay-animation-distance);margin-top:var(--luzmo-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=right]{padding-inline:var(--luzmo-overlay-animation-distance);margin-left:calc(-1 * var(--luzmo-overlay-animation-distance))}.dialog:not([actual-placement])[placement*=bottom]{padding-block:var(--luzmo-overlay-animation-distance);margin-top:calc(-1 * var(--luzmo-overlay-animation-distance))}.dialog:not([actual-placement])[placement*=left]{padding-inline:var(--luzmo-overlay-animation-distance);margin-left:var(--luzmo-overlay-animation-distance)}.dialog[actual-placement*=top]{padding-block:var(--luzmo-overlay-animation-distance);margin-top:var(--luzmo-overlay-animation-distance)}.dialog[actual-placement*=right]{padding-inline:var(--luzmo-overlay-animation-distance);margin-left:calc(-1 * var(--luzmo-overlay-animation-distance))}.dialog[actual-placement*=bottom]{padding-block:var(--luzmo-overlay-animation-distance);margin-top:calc(-1 * var(--luzmo-overlay-animation-distance))}.dialog[actual-placement*=left]{padding-inline:var(--luzmo-overlay-animation-distance);margin-left:var(--luzmo-overlay-animation-distance)}slot[name=longpress-describedby-descriptor]{display:none}@supports selector(:open){.dialog{opacity:0}.dialog:open{opacity:1;--luzmo-popover-filter: drop-shadow(0px 2px 6px rgba(0, 0, 0, .15))}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{opacity:1;--luzmo-popover-filter: drop-shadow(0px 2px 6px rgba(0, 0, 0, .15))}}@supports (overlay: auto){.dialog{display:none;transition:all var(--luzmo-overlay-animation-duration, .13s),translate 0s,display var(--luzmo-overlay-animation-duration, .13s);transition-behavior:allow-discrete}.dialog:popover-open,.dialog:modal{display:flex}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:calc(var(--luzmo-overlay-z-index-base, 1000) + var(--luzmo-overlay-open-count))}}';
684
+ function D(a) {
685
+ if (a === void 0)
686
+ return 0;
687
+ const e = window.devicePixelRatio || 1;
688
+ return Math.round(a * e) / e;
689
+ }
690
+ const L = 8, Le = 100, ze = (a) => ({
691
+ left: ["right", "bottom", "top"],
692
+ "left-start": ["right-start", "bottom", "top"],
693
+ "left-end": ["right-end", "bottom", "top"],
694
+ right: ["left", "bottom", "top"],
695
+ "right-start": ["left-start", "bottom", "top"],
696
+ "right-end": ["left-end", "bottom", "top"],
697
+ top: ["bottom", "left", "right"],
698
+ "top-start": ["bottom-start", "left", "right"],
699
+ "top-end": ["bottom-end", "left", "right"],
700
+ bottom: ["top", "left", "right"],
701
+ "bottom-start": ["top-start", "left", "right"],
702
+ "bottom-end": ["top-end", "left", "right"]
703
+ })[a] ?? [a], et = Symbol("placement updated");
704
+ class Ae {
705
+ /**
706
+ * Creates an instance of the PlacementController.
707
+ *
708
+ * @param host - The host element that uses this controller.
709
+ */
710
+ constructor(e) {
711
+ this.originalPlacements = /* @__PURE__ */ new WeakMap(), this.allowPlacementUpdate = !1, this.closeForAncestorUpdate = () => {
712
+ !this.allowPlacementUpdate && this.options.type !== "modal" && this.cleanup && this.target.dispatchEvent(new Event("close", { bubbles: !0 })), this.allowPlacementUpdate = !1;
713
+ }, this.updatePlacement = () => {
714
+ this.computePlacement();
715
+ }, this.resetOverlayPosition = () => {
716
+ !this.target || !this.options || (this.clearOverlayPosition(), this.host.offsetHeight, this.computePlacement());
717
+ }, this.host = e, this.host.addController(this);
718
+ }
719
+ /**
720
+ * Places the overlay relative to the target element.
721
+ *
722
+ * This method sets up the necessary configurations and event listeners to manage the
723
+ * positioning and constraints of the overlay element.
724
+ *
725
+ * @param [target=this.target] - The target element for the overlay.
726
+ * @param [options=this.options] - The options for configuring the overlay placement.
727
+ * @returns A promise that resolves when the overlay has been placed.
728
+ */
729
+ placeOverlay(e = this.target, t = this.options) {
730
+ if (this.target = e, this.options = t, !e || !t)
731
+ return;
732
+ const i = j(
733
+ t.trigger,
734
+ e,
735
+ this.closeForAncestorUpdate,
736
+ {
737
+ ancestorResize: !1,
738
+ elementResize: !1,
739
+ layoutShift: !1
740
+ }
741
+ ), s = j(
742
+ t.trigger,
743
+ e,
744
+ this.updatePlacement,
745
+ {
746
+ ancestorScroll: !1
747
+ }
748
+ );
749
+ this.cleanup = () => {
750
+ var n;
751
+ (n = this.host.elements) == null || n.forEach((r) => {
752
+ r.addEventListener(
753
+ "luzmo-closed",
754
+ () => {
755
+ const o = this.originalPlacements.get(r);
756
+ o && r.setAttribute("placement", o), this.originalPlacements.delete(r);
757
+ },
758
+ { once: !0 }
759
+ );
760
+ }), i(), s();
761
+ };
762
+ }
763
+ /**
764
+ * Computes the placement of the overlay relative to the target element.
765
+ *
766
+ * This method calculates the necessary positioning and constraints for the overlay element
767
+ * using various middleware functions. It updates the overlay's style and attributes based
768
+ * on the computed position.
769
+ *
770
+ * @returns A promise that resolves when the placement has been computed.
771
+ */
772
+ async computePlacement() {
773
+ var g, w;
774
+ const { options: e, target: t } = this;
775
+ await (document.fonts ? document.fonts.ready : Promise.resolve());
776
+ const i = e.trigger instanceof HTMLElement ? G() : G({
777
+ padding: L,
778
+ fallbackPlacements: ze(e.placement)
779
+ }), [s = 0, n = 0] = Array.isArray(e == null ? void 0 : e.offset) ? e.offset : [e.offset, 0], r = (g = this.host.elements.find(
780
+ (m) => m.tipElement
781
+ )) == null ? void 0 : g.tipElement, o = [
782
+ ae({
783
+ mainAxis: s,
784
+ crossAxis: n
785
+ }),
786
+ le({ padding: L }),
787
+ i,
788
+ he({
789
+ padding: L,
790
+ apply: ({ availableWidth: m, availableHeight: R, rects: { floating: Z } }) => {
791
+ const K = Math.max(
792
+ Le,
793
+ Math.floor(R)
794
+ ), T = Z.height;
795
+ this.initialHeight = this.isConstrained && this.initialHeight || T, this.isConstrained = T < this.initialHeight || K <= T;
796
+ const ee = this.isConstrained ? `${K}px` : "";
797
+ Object.assign(t.style, {
798
+ maxWidth: `${Math.floor(m)}px`,
799
+ maxHeight: ee
800
+ });
801
+ }
802
+ }),
803
+ ...r ? [
804
+ ce({
805
+ element: r,
806
+ padding: e.tipPadding || L
807
+ })
808
+ ] : []
809
+ ], { x: h, y: p, placement: l, middlewareData: c } = await pe(
810
+ e.trigger,
811
+ t,
812
+ {
813
+ placement: e.placement,
814
+ middleware: o,
815
+ strategy: "fixed"
816
+ }
817
+ );
818
+ if (Object.assign(t.style, {
819
+ top: "0px",
820
+ left: "0px",
821
+ translate: `${D(h)}px ${D(p)}px`
822
+ }), t.setAttribute("actual-placement", l), (w = this.host.elements) == null || w.forEach((m) => {
823
+ this.originalPlacements.has(m) || this.originalPlacements.set(
824
+ m,
825
+ m.getAttribute("placement")
826
+ ), m.setAttribute("placement", l);
827
+ }), r && c.arrow) {
828
+ const { x: m, y: R } = c.arrow;
829
+ Object.assign(r.style, {
830
+ top: l.startsWith("right") || l.startsWith("left") ? "0px" : "",
831
+ left: l.startsWith("bottom") || l.startsWith("top") ? "0px" : "",
832
+ translate: `${D(m)}px ${D(R)}px`
833
+ });
834
+ }
835
+ }
836
+ /**
837
+ * Clears the overlay's position styles.
838
+ *
839
+ * This method removes the max-height and max-width styles from the target element,
840
+ * and resets the initial height and constrained state of the overlay.
841
+ */
842
+ clearOverlayPosition() {
843
+ this.target && (this.target.style.removeProperty("max-height"), this.target.style.removeProperty("max-width"), this.initialHeight = void 0, this.isConstrained = !1);
844
+ }
845
+ /**
846
+ * Lifecycle method called when the host element is connected to the DOM.
847
+ *
848
+ * This method sets up an event listener to reset the overlay's position when the 'luzmo-update-overlays' event is dispatched.
849
+ */
850
+ hostConnected() {
851
+ document.addEventListener(
852
+ "luzmo-update-overlays",
853
+ this.resetOverlayPosition
854
+ );
855
+ }
856
+ /**
857
+ * Lifecycle method called when the host element is updated.
858
+ *
859
+ * This method cleans up resources if the overlay is not open.
860
+ */
861
+ hostUpdated() {
862
+ var e;
863
+ this.host.open || ((e = this.cleanup) == null || e.call(this), this.cleanup = void 0);
864
+ }
865
+ /**
866
+ * Lifecycle method called when the host element is disconnected from the DOM.
867
+ *
868
+ * This method removes the event listener and cleans up resources.
869
+ */
870
+ hostDisconnected() {
871
+ var e;
872
+ (e = this.cleanup) == null || e.call(this), this.cleanup = void 0, document.removeEventListener(
873
+ "luzmo-update-overlays",
874
+ this.resetOverlayPosition
875
+ );
876
+ }
877
+ }
878
+ var C = /* @__PURE__ */ ((a) => (a.click = "click", a.hover = "hover", a.longpress = "longpress", a))(C || {});
879
+ const N = Symbol("lastInteractionType"), F = "remove-focus-ring-safari-hack";
880
+ class B {
881
+ constructor(e, { overlay: t, isPersistent: i, handleOverlayReady: s }) {
882
+ this.target = e, this.isLazilyOpen = !1, this.isPersistent = !1, this.isPersistent = !!i, this.handleOverlayReady = s, this.isPersistent && this.init(), this.overlay = t;
883
+ }
884
+ get activelyOpening() {
885
+ return !1;
886
+ }
887
+ get open() {
888
+ var e;
889
+ return ((e = this.overlay) == null ? void 0 : e.open) ?? this.isLazilyOpen;
890
+ }
891
+ /**
892
+ * Set `open` against the associated Overlay lazily.
893
+ */
894
+ set open(e) {
895
+ if (e !== this.open) {
896
+ if (this.isLazilyOpen = e, this.overlay) {
897
+ this.overlay.open = e, this.target[N] = this.type;
898
+ return;
899
+ }
900
+ e && (customElements.whenDefined("luzmo-overlay").then(async () => {
901
+ const { LuzmoOverlay: t } = await Promise.resolve().then(() => q);
902
+ this.overlay = new t(), this.overlay.open = !0, this.target[N] = this.type;
903
+ }), Promise.resolve().then(() => q));
904
+ }
905
+ }
906
+ get overlay() {
907
+ return this._overlay;
908
+ }
909
+ set overlay(e) {
910
+ var t;
911
+ e && this.overlay !== e && (this.overlay && this.overlay.removeController(this), this._overlay = e, this.overlay.addController(this), this.initOverlay(), this.prepareDescription(this.target), (t = this.handleOverlayReady) == null || t.call(this, this.overlay));
912
+ }
913
+ prepareDescription(e) {
914
+ }
915
+ releaseDescription() {
916
+ }
917
+ shouldCompleteOpen() {
918
+ }
919
+ /* c8 ignore next 3 */
920
+ init() {
921
+ }
922
+ /* c8 ignore next 3 */
923
+ initOverlay() {
924
+ }
925
+ abort() {
926
+ var e;
927
+ this.releaseDescription(), (e = this.abortController) == null || e.abort();
928
+ }
929
+ hostConnected() {
930
+ this.init();
931
+ }
932
+ hostDisconnected() {
933
+ this.isPersistent || this.abort();
934
+ }
935
+ }
936
+ class Se extends B {
937
+ constructor() {
938
+ super(...arguments), this.type = C.click, this.preventNextToggle = !1;
939
+ }
940
+ handleClick() {
941
+ this.preventNextToggle || (this.open = !this.open), this.preventNextToggle = !1;
942
+ }
943
+ handlePointerdown() {
944
+ this.preventNextToggle = this.open;
945
+ }
946
+ init() {
947
+ var t;
948
+ (t = this.abortController) == null || t.abort(), this.abortController = new AbortController();
949
+ const { signal: e } = this.abortController;
950
+ this.target.addEventListener("click", () => this.handleClick(), {
951
+ signal: e
952
+ }), this.target.addEventListener(
953
+ "pointerdown",
954
+ () => this.handlePointerdown(),
955
+ { signal: e }
956
+ );
957
+ }
958
+ }
959
+ const Re = 300;
960
+ class ke extends B {
961
+ constructor() {
962
+ super(...arguments), this.type = C.hover, this.elementIds = [], this.focusedin = !1, this.pointerentered = !1;
963
+ }
964
+ handleKeyup(e) {
965
+ (e.code === "Tab" || e.code === "Escape") && (this.open = !0, this.removeSafariFocusRingClass());
966
+ }
967
+ handleTargetFocusin() {
968
+ if (this.target.matches(":focus-visible")) {
969
+ if (Y() && this.target[N] === C.click) {
970
+ this.target.classList.add(F);
971
+ return;
972
+ }
973
+ this.open = !0, this.focusedin = !0, this.removeSafariFocusRingClass();
974
+ }
975
+ }
976
+ handleTargetFocusout() {
977
+ this.removeSafariFocusRingClass(), this.focusedin = !1, !this.pointerentered && (this.open = !1);
978
+ }
979
+ handleTargetPointerenter() {
980
+ var e;
981
+ this.hoverTimeout && (clearTimeout(this.hoverTimeout), this.hoverTimeout = void 0), !((e = this.overlay) != null && e.disabled) && (this.open = !0, this.pointerentered = !0);
982
+ }
983
+ handleTargetPointerleave() {
984
+ this.doPointerleave();
985
+ }
986
+ // set a timeout once the pointer enters and the overlay is shown
987
+ // give the user time to enter the overlay
988
+ handleHostPointerenter() {
989
+ this.hoverTimeout && (clearTimeout(this.hoverTimeout), this.hoverTimeout = void 0);
990
+ }
991
+ handleHostPointerleave() {
992
+ this.doPointerleave();
993
+ }
994
+ prepareDescription() {
995
+ if (this.overlay.elements.length === 0)
996
+ return;
997
+ const e = this.target.getRootNode(), t = this.overlay.elements[0].getRootNode(), i = this.overlay.getRootNode();
998
+ e === i ? this.prepareOverlayRelativeDescription() : e === t && this.prepareContentRelativeDescription();
999
+ }
1000
+ prepareOverlayRelativeDescription() {
1001
+ const e = _(
1002
+ this.target,
1003
+ "aria-describedby",
1004
+ [this.overlay.id]
1005
+ );
1006
+ this.releaseDescription = () => {
1007
+ e(), this.releaseDescription = E;
1008
+ };
1009
+ }
1010
+ prepareContentRelativeDescription() {
1011
+ const e = [], t = this.overlay.elements.map((s) => (e.push(s.id), s.id || (s.id = `${this.overlay.tagName.toLowerCase()}-helper-${I()}`), s.id));
1012
+ this.elementIds = e;
1013
+ const i = _(
1014
+ this.target,
1015
+ "aria-describedby",
1016
+ t
1017
+ );
1018
+ this.releaseDescription = () => {
1019
+ i(), this.overlay.elements.map((s, n) => {
1020
+ s.id = this.elementIds[n];
1021
+ }), this.releaseDescription = E;
1022
+ };
1023
+ }
1024
+ doPointerleave() {
1025
+ this.pointerentered = !1;
1026
+ const e = this.target;
1027
+ this.focusedin && e.matches(":focus-visible") || (this.hoverTimeout = setTimeout(() => {
1028
+ this.open = !1;
1029
+ }, Re));
1030
+ }
1031
+ init() {
1032
+ var t;
1033
+ (t = this.abortController) == null || t.abort(), this.abortController = new AbortController();
1034
+ const { signal: e } = this.abortController;
1035
+ this.target.addEventListener("keyup", (i) => this.handleKeyup(i), {
1036
+ signal: e
1037
+ }), this.target.addEventListener("focusin", () => this.handleTargetFocusin(), {
1038
+ signal: e
1039
+ }), this.target.addEventListener(
1040
+ "focusout",
1041
+ () => this.handleTargetFocusout(),
1042
+ { signal: e }
1043
+ ), this.target.addEventListener(
1044
+ "pointerenter",
1045
+ () => this.handleTargetPointerenter(),
1046
+ { signal: e }
1047
+ ), this.target.addEventListener(
1048
+ "pointerleave",
1049
+ () => this.handleTargetPointerleave(),
1050
+ { signal: e }
1051
+ ), this.overlay && this.initOverlay();
1052
+ }
1053
+ initOverlay() {
1054
+ if (!this.abortController)
1055
+ return;
1056
+ const { signal: e } = this.abortController;
1057
+ this.overlay.addEventListener(
1058
+ "pointerenter",
1059
+ () => this.handleHostPointerenter(),
1060
+ { signal: e }
1061
+ ), this.overlay.addEventListener(
1062
+ "pointerleave",
1063
+ () => this.handleHostPointerleave(),
1064
+ { signal: e }
1065
+ );
1066
+ }
1067
+ removeSafariFocusRingClass() {
1068
+ Y() && this.target.classList.contains(F) && this.target.classList.remove(F);
1069
+ }
1070
+ }
1071
+ const Fe = 300, _e = {
1072
+ touch: "Double tap and long press for additional options",
1073
+ keyboard: "Press Space or Alt+Down Arrow for additional options",
1074
+ mouse: "Click and hold for additional options"
1075
+ };
1076
+ class Ne extends B {
1077
+ constructor() {
1078
+ super(...arguments), this.type = C.longpress, this.longpressState = null, this.releaseDescription = E, this.handlePointerup = () => {
1079
+ var e;
1080
+ clearTimeout(this.timeout), this.target && (this.longpressState = ((e = this.overlay) == null ? void 0 : e.state) === "opening" ? "pressed" : null, document.removeEventListener("pointerup", this.handlePointerup), document.removeEventListener("pointercancel", this.handlePointerup));
1081
+ };
1082
+ }
1083
+ get activelyOpening() {
1084
+ return this.longpressState === "opening" || this.longpressState === "pressed";
1085
+ }
1086
+ handleLongpress() {
1087
+ this.open = !0, this.longpressState = this.longpressState === "potential" ? "opening" : "pressed";
1088
+ }
1089
+ handlePointerdown(e) {
1090
+ !this.target || e.button !== 0 || (this.longpressState = "potential", document.addEventListener("pointerup", this.handlePointerup), document.addEventListener("pointercancel", this.handlePointerup), "holdAffordance" in this.target) || (this.timeout = setTimeout(() => {
1091
+ this.target && this.target.dispatchEvent(
1092
+ new CustomEvent("longpress", {
1093
+ bubbles: !0,
1094
+ composed: !0,
1095
+ detail: {
1096
+ source: "pointer"
1097
+ }
1098
+ })
1099
+ );
1100
+ }, Fe));
1101
+ }
1102
+ handleKeydown(e) {
1103
+ const { code: t, altKey: i } = e;
1104
+ i && t === "ArrowDown" && (e.stopPropagation(), e.stopImmediatePropagation());
1105
+ }
1106
+ handleKeyup(e) {
1107
+ const { code: t, altKey: i } = e;
1108
+ if (t === "Space" || i && t === "ArrowDown") {
1109
+ if (!this.target)
1110
+ return;
1111
+ e.stopPropagation(), this.target.dispatchEvent(
1112
+ new CustomEvent("longpress", {
1113
+ bubbles: !0,
1114
+ composed: !0,
1115
+ detail: {
1116
+ source: "keyboard"
1117
+ }
1118
+ })
1119
+ ), setTimeout(() => {
1120
+ this.longpressState = null;
1121
+ });
1122
+ }
1123
+ }
1124
+ prepareDescription(e) {
1125
+ if (
1126
+ // do not reapply until target is recycled
1127
+ this.releaseDescription !== E || // require "longpress content" to apply relationship
1128
+ this.overlay.elements.length === 0
1129
+ )
1130
+ return;
1131
+ const t = document.createElement("div");
1132
+ t.id = `longpress-describedby-descriptor-${I()}`;
1133
+ const i = me() || ge() ? "touch" : "keyboard";
1134
+ t.textContent = _e[i], t.slot = "longpress-describedby-descriptor";
1135
+ const s = e.getRootNode(), n = this.overlay.getRootNode();
1136
+ s === n ? this.overlay.append(t) : (t.hidden = !("host" in s), e.after(t));
1137
+ const r = _(
1138
+ e,
1139
+ "aria-describedby",
1140
+ [t.id]
1141
+ );
1142
+ this.releaseDescription = () => {
1143
+ r(), t.remove(), this.releaseDescription = E;
1144
+ };
1145
+ }
1146
+ shouldCompleteOpen() {
1147
+ this.longpressState = this.longpressState === "pressed" ? null : this.longpressState;
1148
+ }
1149
+ init() {
1150
+ var t;
1151
+ (t = this.abortController) == null || t.abort(), this.abortController = new AbortController();
1152
+ const { signal: e } = this.abortController;
1153
+ this.target.addEventListener("longpress", () => this.handleLongpress(), {
1154
+ signal: e
1155
+ }), this.target.addEventListener(
1156
+ "pointerdown",
1157
+ (i) => this.handlePointerdown(i),
1158
+ { signal: e }
1159
+ ), this.prepareDescription(this.target), !this.target.holdAffordance && (this.target.addEventListener(
1160
+ "keydown",
1161
+ (i) => this.handleKeydown(i),
1162
+ { signal: e }
1163
+ ), this.target.addEventListener(
1164
+ "keyup",
1165
+ (i) => this.handleKeyup(i),
1166
+ { signal: e }
1167
+ ));
1168
+ }
1169
+ }
1170
+ const qe = {
1171
+ click: Se,
1172
+ longpress: Ne,
1173
+ hover: ke
1174
+ };
1175
+ var Ie = Object.defineProperty, $e = Object.getOwnPropertyDescriptor, u = (a, e, t, i) => {
1176
+ for (var s = i > 1 ? void 0 : i ? $e(e, t) : e, n = a.length - 1, r; n >= 0; n--)
1177
+ (r = a[n]) && (s = (i ? r(e, t, s) : r(s)) || s);
1178
+ return i && s && Ie(e, t, s), s;
1179
+ };
1180
+ const He = typeof document < "u" && "showPopover" in document.createElement("div");
1181
+ let z = Ee(P);
1182
+ z = He ? Oe(z) : Pe(z);
1183
+ var b;
1184
+ const d = (b = class extends z {
1185
+ constructor() {
1186
+ super(...arguments), 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 = (e) => {
1187
+ if (!e.relatedTarget)
1188
+ return;
1189
+ const t = new Event("overlay-relation-query", {
1190
+ bubbles: !0,
1191
+ composed: !0
1192
+ });
1193
+ e.relatedTarget.addEventListener(t.type, (i) => {
1194
+ i.composedPath().includes(this) || (this.open = !1);
1195
+ }), e.relatedTarget.dispatchEvent(t);
1196
+ };
1197
+ }
1198
+ get delayed() {
1199
+ var e;
1200
+ return ((e = this.elements.at(-1)) == null ? void 0 : e.hasAttribute("delayed")) || this._delayed;
1201
+ }
1202
+ set delayed(e) {
1203
+ this._delayed = e;
1204
+ }
1205
+ get disabled() {
1206
+ return this._disabled;
1207
+ }
1208
+ set disabled(e) {
1209
+ var t;
1210
+ this._disabled = e, e ? ((t = this.strategy) == null || t.abort(), this.wasOpen = this.open, this.open = !1) : (this.bindEvents(), this.open = this.open || this.wasOpen, this.wasOpen = !1);
1211
+ }
1212
+ /**
1213
+ * Determines if the overlay has a non-virtual trigger element.
1214
+ *
1215
+ * @returns `true` if the trigger element is not a virtual trigger, otherwise `false`.
1216
+ */
1217
+ get hasNonVirtualTrigger() {
1218
+ return !!this.triggerElement && !(this.triggerElement instanceof S);
1219
+ }
1220
+ /**
1221
+ * Provides an instance of the `PlacementController` for managing the positioning
1222
+ * of the overlay relative to its trigger element.
1223
+ *
1224
+ * If the `PlacementController` instance does not already exist, it is created and
1225
+ * assigned to the `_placementController` property.
1226
+ *
1227
+ * @protected
1228
+ * @returns The `PlacementController` instance.
1229
+ */
1230
+ get placementController() {
1231
+ return this._placementController || (this._placementController = new Ae(this)), this._placementController;
1232
+ }
1233
+ get open() {
1234
+ return this._open;
1235
+ }
1236
+ set open(e) {
1237
+ var t;
1238
+ e && this.disabled || e !== this.open && ((t = this.strategy) != null && t.activelyOpening && !e || (this._open = e, this.open && (b.openCount += 1), this.requestUpdate("open", !this.open), this.open && this.requestSlottable()));
1239
+ }
1240
+ get state() {
1241
+ return this._state;
1242
+ }
1243
+ set state(e) {
1244
+ var i;
1245
+ if (e === this.state)
1246
+ return;
1247
+ const t = this.state;
1248
+ this._state = e, (this.state === "opened" || this.state === "closed") && ((i = this.strategy) == null || i.shouldCompleteOpen()), this.requestUpdate("state", t);
1249
+ }
1250
+ /**
1251
+ * Provides an instance of the `ElementResolutionController` for managing the element
1252
+ * that the overlay should be associated with. If the instance does not already exist,
1253
+ * it is created and assigned to the `_elementResolver` property.
1254
+ *
1255
+ * @protected
1256
+ * @returns The `ElementResolutionController` instance.
1257
+ */
1258
+ get elementResolver() {
1259
+ return this._elementResolver || (this._elementResolver = new oe(this)), this._elementResolver;
1260
+ }
1261
+ /**
1262
+ * Determines if the overlay uses a dialog.
1263
+ * Returns `true` if the overlay type is "modal" or "page".
1264
+ *
1265
+ * @private
1266
+ * @returns `true` if the overlay uses a dialog, otherwise `false`.
1267
+ */
1268
+ get usesDialog() {
1269
+ return this.type === "modal" || this.type === "page";
1270
+ }
1271
+ /**
1272
+ * Determines the value for the popover attribute based on the overlay type.
1273
+ *
1274
+ * @private
1275
+ * @returns The popover value or undefined if not applicable.
1276
+ */
1277
+ get popoverValue() {
1278
+ if ("popover" in this)
1279
+ switch (this.type) {
1280
+ case "modal":
1281
+ case "page":
1282
+ return;
1283
+ case "hint":
1284
+ return "manual";
1285
+ default:
1286
+ return this.type;
1287
+ }
1288
+ }
1289
+ /**
1290
+ * Determines if the overlay requires positioning based on its type and state.
1291
+ *
1292
+ * @protected
1293
+ * @returns True if the overlay requires positioning, otherwise false.
1294
+ */
1295
+ get requiresPositioning() {
1296
+ return !(this.type === "page" || !this.open || !this.triggerElement || !this.placement && this.type !== "hint");
1297
+ }
1298
+ /**
1299
+ * Manages the positioning of the overlay relative to its trigger element.
1300
+ *
1301
+ * This method calculates the necessary parameters for positioning the overlay,
1302
+ * such as offset, placement, and tip padding, and then delegates the actual
1303
+ * positioning to the `PlacementController`.
1304
+ *
1305
+ * @protected
1306
+ * @override
1307
+ */
1308
+ managePosition() {
1309
+ if (!this.requiresPositioning || !this.open)
1310
+ return;
1311
+ const e = this.offset || 0, t = this.triggerElement, i = this.placement || "right", s = this.tipPadding;
1312
+ this.placementController.placeOverlay(this.dialogEl, {
1313
+ offset: e,
1314
+ placement: i,
1315
+ tipPadding: s,
1316
+ trigger: t,
1317
+ type: this.type
1318
+ });
1319
+ }
1320
+ /**
1321
+ * Manages the process of opening the popover.
1322
+ *
1323
+ * This method handles the necessary steps to open the popover, including managing delays,
1324
+ * ensuring the popover is in the DOM, making transitions, and applying focus.
1325
+ *
1326
+ * @protected
1327
+ * @override
1328
+ * @returns A promise that resolves when the popover has been fully opened.
1329
+ */
1330
+ async managePopoverOpen() {
1331
+ super.managePopoverOpen();
1332
+ const e = this.open;
1333
+ if (this.open !== e || (await this.manageDelay(e), this.open !== e) || (this.triggerInteraction === "longpress" && await f(), await this.ensureOnDOM(e), this.open !== e))
1334
+ return;
1335
+ const t = await this.makeTransition(e);
1336
+ this.open === e && await this.applyFocus(e, t);
1337
+ }
1338
+ /**
1339
+ * Applies focus to the appropriate element after the popover has been opened.
1340
+ *
1341
+ * This method handles the focus management for the overlay, ensuring that the correct
1342
+ * element receives focus based on the overlay's type and state.
1343
+ *
1344
+ * @protected
1345
+ * @override
1346
+ * @param targetOpenState - The target open state of the overlay.
1347
+ * @param focusEl - The element to focus after opening the popover.
1348
+ * @returns A promise that resolves when the focus has been applied.
1349
+ */
1350
+ async applyFocus(e, t) {
1351
+ if (!(this.receivesFocus === "false" || this.type === "hint")) {
1352
+ if (await f(), await f(), e === this.open && !this.open) {
1353
+ this.hasNonVirtualTrigger && this.contains(this.getRootNode().activeElement) && this.triggerElement.focus();
1354
+ return;
1355
+ }
1356
+ t == null || t.focus();
1357
+ }
1358
+ }
1359
+ /**
1360
+ * Returns focus to the trigger element if the overlay is closed.
1361
+ *
1362
+ * This method ensures that focus is returned to the trigger element when the overlay is closed,
1363
+ * unless the overlay is of type "hint" or the focus is already outside the overlay.
1364
+ *
1365
+ * @protected
1366
+ * @override
1367
+ */
1368
+ returnFocus() {
1369
+ var t;
1370
+ if (this.open || this.type === "hint")
1371
+ return;
1372
+ const e = () => {
1373
+ var n, r;
1374
+ const i = [];
1375
+ let s = typeof document < "u" ? document.activeElement : null;
1376
+ for (; (n = s == null ? void 0 : s.shadowRoot) != null && n.activeElement; )
1377
+ s = s.shadowRoot.activeElement;
1378
+ for (; s; ) {
1379
+ const o = s.assignedSlot || s.parentElement || ((r = s.getRootNode()) == null ? void 0 : r.host);
1380
+ o && i.push(o), s = o;
1381
+ }
1382
+ return i;
1383
+ };
1384
+ this.receivesFocus !== "false" && ((t = this.triggerElement) != null && t.focus) && (this.contains(this.getRootNode().activeElement) || e().includes(this) || typeof document < "u" && document.activeElement === document.body) && this.triggerElement.focus();
1385
+ }
1386
+ /**
1387
+ * Manages the process of opening or closing the overlay.
1388
+ *
1389
+ * This method handles the necessary steps to open or close the overlay, including updating the state,
1390
+ * managing the overlay stack, and handling focus events.
1391
+ *
1392
+ * @protected
1393
+ * @param oldOpen - The previous open state of the overlay.
1394
+ * @returns A promise that resolves when the overlay has been fully managed.
1395
+ */
1396
+ async manageOpen(e) {
1397
+ if (!(!this.isConnected && this.open) && (this.hasUpdated || await this.updateComplete, this.open ? (Q.add(this), this.willPreventClose && (document.addEventListener(
1398
+ "pointerup",
1399
+ () => {
1400
+ this.dialogEl.classList.toggle("not-immediately-closable", !1), this.willPreventClose = !1;
1401
+ },
1402
+ { once: !0 }
1403
+ ), this.dialogEl.classList.toggle("not-immediately-closable", !0))) : (e && this.dispose(), Q.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")) {
1404
+ const t = this.getRootNode();
1405
+ this.open ? t.addEventListener("focusout", this.closeOnFocusOut, {
1406
+ capture: !0
1407
+ }) : t.removeEventListener("focusout", this.closeOnFocusOut, {
1408
+ capture: !0
1409
+ });
1410
+ }
1411
+ }
1412
+ /**
1413
+ * Binds event handling strategies to the overlay based on the specified trigger interaction.
1414
+ *
1415
+ * This method sets up the appropriate event handling strategy for the overlay, ensuring that
1416
+ * it responds correctly to user interactions such as clicks, hovers, or long presses.
1417
+ *
1418
+ * @protected
1419
+ */
1420
+ bindEvents() {
1421
+ var e;
1422
+ (e = this.strategy) == null || e.abort(), this.strategy = void 0, this.hasNonVirtualTrigger && this.triggerInteraction && (this.strategy = new qe[this.triggerInteraction](
1423
+ this.triggerElement,
1424
+ {
1425
+ overlay: this
1426
+ }
1427
+ ));
1428
+ }
1429
+ /**
1430
+ * Handles the `beforetoggle` event to manage the overlay's state.
1431
+ *
1432
+ * This method checks the new state of the event and calls `handleBrowserClose`
1433
+ * if the new state is not 'open'.
1434
+ *
1435
+ * @protected
1436
+ * @param event - The `beforetoggle` event with the new state.
1437
+ */
1438
+ handleBeforetoggle(e) {
1439
+ e.newState !== "open" && this.handleBrowserClose(e);
1440
+ }
1441
+ /**
1442
+ * Handles the browser's close event to manage the overlay's state.
1443
+ *
1444
+ * This method stops the propagation of the event and closes the overlay if it is not
1445
+ * actively opening. If the overlay is actively opening, it calls `manuallyKeepOpen`.
1446
+ *
1447
+ * @protected
1448
+ * @param event - The browser's close event.
1449
+ */
1450
+ handleBrowserClose(e) {
1451
+ var t;
1452
+ if (e.stopPropagation(), !((t = this.strategy) != null && t.activelyOpening)) {
1453
+ this.open = !1;
1454
+ return;
1455
+ }
1456
+ this.manuallyKeepOpen();
1457
+ }
1458
+ /**
1459
+ * Manually keeps the overlay open.
1460
+ *
1461
+ * This method sets the overlay to open, allows placement updates, and manages the open state.
1462
+ *
1463
+ * @public
1464
+ * @override
1465
+ */
1466
+ manuallyKeepOpen() {
1467
+ this.open = !0, this.placementController.allowPlacementUpdate = !0, this.manageOpen(!1);
1468
+ }
1469
+ /**
1470
+ * Handles the `slotchange` event to manage the overlay's state.
1471
+ *
1472
+ * This method checks if there are any elements in the slot. If there are no elements,
1473
+ * it releases the description from the strategy. If there are elements and the trigger
1474
+ * is non-virtual, it prepares the description for the trigger element.
1475
+ *
1476
+ * @protected
1477
+ */
1478
+ handleSlotchange() {
1479
+ var e, t;
1480
+ this.elements.length === 0 ? (e = this.strategy) == null || e.releaseDescription() : this.hasNonVirtualTrigger && ((t = this.strategy) == null || t.prepareDescription(this.triggerElement));
1481
+ }
1482
+ /**
1483
+ * Determines whether the overlay should prevent closing.
1484
+ *
1485
+ * This method checks the `willPreventClose` flag and resets it to `false`.
1486
+ * It returns the value of the `willPreventClose` flag.
1487
+ *
1488
+ * @public
1489
+ * @returns `true` if the overlay should prevent closing, otherwise `false`.
1490
+ */
1491
+ shouldPreventClose() {
1492
+ const e = this.willPreventClose;
1493
+ return this.willPreventClose = !1, e;
1494
+ }
1495
+ /**
1496
+ * Requests slottable content for the overlay.
1497
+ *
1498
+ * This method dispatches a `SlottableRequestEvent` to request or remove slottable content
1499
+ * based on the current open state of the overlay. It ensures that the same state is not
1500
+ * dispatched twice in a row.
1501
+ *
1502
+ * @protected
1503
+ * @override
1504
+ */
1505
+ requestSlottable() {
1506
+ this.lastRequestSlottableState !== this.open && (this.open || document.body.offsetHeight, this.dispatchEvent(
1507
+ new de(
1508
+ "overlay-content",
1509
+ this.open ? {} : ue
1510
+ )
1511
+ ), this.lastRequestSlottableState = this.open);
1512
+ }
1513
+ /**
1514
+ * Lifecycle method called before the component updates.
1515
+ *
1516
+ * This method handles various tasks before the component updates, such as setting an ID,
1517
+ * managing the open state, resolving the trigger element, and binding events.
1518
+ *
1519
+ * @override
1520
+ * @param changes - The properties that have changed.
1521
+ */
1522
+ willUpdate(e) {
1523
+ var i;
1524
+ if (this.hasAttribute("id") || this.setAttribute("id", `${this.tagName.toLowerCase()}-${I()}`), e.has("open") && (this.hasUpdated || this.open) && this.manageOpen(e.get("open")), e.has("trigger")) {
1525
+ const [s, n] = ((i = this.trigger) == null ? void 0 : i.split("@")) || [];
1526
+ this.elementResolver.selector = s ? `#${s}` : "", this.triggerInteraction = n;
1527
+ }
1528
+ let t = !1;
1529
+ e.has(ne) && (t = this.triggerElement, this.triggerElement = this.elementResolver.element), e.has("triggerElement") && (t = e.get("triggerElement")), t !== !1 && this.bindEvents();
1530
+ }
1531
+ /**
1532
+ * Lifecycle method called after the component updates.
1533
+ *
1534
+ * This method handles various tasks after the component updates, such as updating the placement
1535
+ * attribute, resetting the overlay position, and clearing the overlay position based on the state.
1536
+ *
1537
+ * @override
1538
+ * @param changes - The properties that have changed.
1539
+ */
1540
+ updated(e) {
1541
+ super.updated(e), e.has("placement") && (this.placement ? this.dialogEl.setAttribute("actual-placement", this.placement) : this.dialogEl.removeAttribute("actual-placement"), this.open && e.get("placement") !== void 0 && this.placementController.resetOverlayPosition()), e.has("state") && this.state === "closed" && e.get("state") !== void 0 && this.placementController.clearOverlayPosition();
1542
+ }
1543
+ /**
1544
+ * Renders the content of the overlay.
1545
+ *
1546
+ * This method returns a template result containing a slot element. The slot element
1547
+ * listens for the `slotchange` event to manage the overlay's state.
1548
+ *
1549
+ * @protected
1550
+ * @returns The template result containing the slot element.
1551
+ */
1552
+ renderContent() {
1553
+ return x` <slot @slotchange=${this.handleSlotchange}></slot> `;
1554
+ }
1555
+ /**
1556
+ * Generates a style map for the dialog element.
1557
+ *
1558
+ * This method returns an object containing CSS custom properties for the dialog element.
1559
+ * The `--luzmo-overlay-open-count` custom property is set to the current open count of overlays.
1560
+ *
1561
+ * @private
1562
+ * @returns The style map for the dialog element.
1563
+ */
1564
+ get dialogStyleMap() {
1565
+ return {
1566
+ "--luzmo-overlay-open-count": b.openCount.toString()
1567
+ };
1568
+ }
1569
+ /**
1570
+ * Renders the dialog element for the overlay.
1571
+ *
1572
+ * This method returns a template result containing a dialog element. The dialog element
1573
+ * includes various attributes and event listeners to manage the overlay's state and behavior.
1574
+ *
1575
+ * @protected
1576
+ * @returns The template result containing the dialog element.
1577
+ */
1578
+ renderDialog() {
1579
+ return x`
1580
+ <dialog
1581
+ class="dialog"
1582
+ part="dialog"
1583
+ placement=${k(
1584
+ this.requiresPositioning ? this.placement || "right" : void 0
1585
+ )}
1586
+ style=${V(this.dialogStyleMap)}
1587
+ @close=${this.handleBrowserClose}
1588
+ @cancel=${this.handleBrowserClose}
1589
+ @beforetoggle=${this.handleBeforetoggle}
1590
+ ?is-visible=${this.state !== "closed"}
1591
+ >
1592
+ ${this.renderContent()}
1593
+ </dialog>
1594
+ `;
1595
+ }
1596
+ /**
1597
+ * Renders the popover element for the overlay.
1598
+ *
1599
+ * This method returns a template result containing a div element styled as a popover.
1600
+ * The popover element includes various attributes and event listeners to manage the overlay's state and behavior.
1601
+ *
1602
+ * @protected
1603
+ * @returns The template result containing the popover element.
1604
+ */
1605
+ renderPopover() {
1606
+ return x`
1607
+ <div
1608
+ class="dialog"
1609
+ part="dialog"
1610
+ placement=${k(
1611
+ this.requiresPositioning ? this.placement || "right" : void 0
1612
+ )}
1613
+ popover=${k(this.popoverValue)}
1614
+ style=${V(this.dialogStyleMap)}
1615
+ @beforetoggle=${this.handleBeforetoggle}
1616
+ @close=${this.handleBrowserClose}
1617
+ ?is-visible=${this.state !== "closed"}
1618
+ >
1619
+ ${this.renderContent()}
1620
+ </div>
1621
+ `;
1622
+ }
1623
+ /**
1624
+ * Renders the overlay component.
1625
+ *
1626
+ * This method returns a template result containing either a dialog or popover element
1627
+ * based on the overlay type. It also includes a slot for longpress descriptors.
1628
+ *
1629
+ * @override
1630
+ * @returns The template result containing the overlay content.
1631
+ */
1632
+ render() {
1633
+ const e = this.type === "modal" || this.type === "page";
1634
+ return x`
1635
+ ${e ? this.renderDialog() : this.renderPopover()}
1636
+ <slot name="longpress-describedby-descriptor"></slot>
1637
+ `;
1638
+ }
1639
+ /**
1640
+ * Lifecycle method called when the component is added to the DOM.
1641
+ *
1642
+ * This method sets up event listeners and binds events if the component has already updated.
1643
+ *
1644
+ * @override
1645
+ */
1646
+ connectedCallback() {
1647
+ super.connectedCallback(), this.addEventListener("close", () => {
1648
+ this.open = !1;
1649
+ }), this.hasUpdated && this.bindEvents();
1650
+ }
1651
+ /**
1652
+ * Lifecycle method called when the component is removed from the DOM.
1653
+ *
1654
+ * This method releases the description from the strategy and updates the 'open' property.
1655
+ *
1656
+ * @override
1657
+ */
1658
+ disconnectedCallback() {
1659
+ var e;
1660
+ (e = this.strategy) == null || e.releaseDescription(), this.open = !1, super.disconnectedCallback();
1661
+ }
1662
+ }, b.styles = [te(De)], b.openCount = 1, b);
1663
+ u([
1664
+ y({ type: Boolean })
1665
+ ], d.prototype, "delayed", 1);
1666
+ u([
1667
+ X(".dialog")
1668
+ ], d.prototype, "dialogEl", 2);
1669
+ u([
1670
+ y({ type: Boolean })
1671
+ ], d.prototype, "disabled", 1);
1672
+ u([
1673
+ ie({
1674
+ flatten: !0,
1675
+ selector: ':not([slot="longpress-describedby-descriptor"], slot)'
1676
+ })
1677
+ ], d.prototype, "elements", 2);
1678
+ u([
1679
+ y({ type: Number })
1680
+ ], d.prototype, "offset", 2);
1681
+ u([
1682
+ y({ type: Boolean, reflect: !0 })
1683
+ ], d.prototype, "open", 1);
1684
+ u([
1685
+ y()
1686
+ ], d.prototype, "placement", 2);
1687
+ u([
1688
+ y({ attribute: "receives-focus" })
1689
+ ], d.prototype, "receivesFocus", 2);
1690
+ u([
1691
+ X("slot")
1692
+ ], d.prototype, "slotEl", 2);
1693
+ u([
1694
+ se()
1695
+ ], d.prototype, "state", 1);
1696
+ u([
1697
+ y({ type: Number, attribute: "tip-padding" })
1698
+ ], d.prototype, "tipPadding", 2);
1699
+ u([
1700
+ y()
1701
+ ], d.prototype, "trigger", 2);
1702
+ u([
1703
+ y({ attribute: !1 })
1704
+ ], d.prototype, "triggerElement", 2);
1705
+ u([
1706
+ y({ attribute: !1 })
1707
+ ], d.prototype, "triggerInteraction", 2);
1708
+ u([
1709
+ y()
1710
+ ], d.prototype, "type", 2);
1711
+ let Ue = d;
1712
+ const q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1713
+ __proto__: null,
1714
+ LuzmoOverlay: Ue
1715
+ }, Symbol.toStringTag, { value: "Module" }));
1716
+ export {
1717
+ Se as C,
1718
+ ke as H,
1719
+ C as I,
1720
+ P as L,
1721
+ Ae as P,
1722
+ F as S,
1723
+ S as V,
1724
+ f as a,
1725
+ B as b,
1726
+ _e as c,
1727
+ Ne as d,
1728
+ Ue as e,
1729
+ q as f,
1730
+ $ as g,
1731
+ N as l,
1732
+ E as n,
1733
+ A as o,
1734
+ et as p,
1735
+ qe as s
1736
+ };