@cntrl-site/components 1.0.112 → 1.0.113-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/{Burger-C3yVbQcq.js → Burger-B4kXX9aY.js} +1 -1
  2. package/dist/{Burger-BkVgNMGU.mjs → Burger-DyORh_vF.mjs} +1 -1
  3. package/dist/{ChroniclesComponent-FFenN7yL.js → ChroniclesComponent-B6L-8Gn2.js} +1 -1
  4. package/dist/{ChroniclesComponent-cZLqN307.mjs → ChroniclesComponent-adaAqTy8.mjs} +12 -12
  5. package/dist/Components/PopupMenu/PopupMenu.d.ts +70 -0
  6. package/dist/Components/PopupMenu/PopupMenuComponent.d.ts +578 -0
  7. package/dist/Components/PopupMenu/popupMenuLayout.d.ts +176 -0
  8. package/dist/Components/helpers/SvgImage/loadSvgMaskUrl.d.ts +7 -0
  9. package/dist/{ControlSlider-DqKfaKMG.mjs → ControlSlider-3w-bHQEg.mjs} +1 -1
  10. package/dist/{ControlSlider-C8ckUIDm.js → ControlSlider-DB4nbVLT.js} +1 -1
  11. package/dist/{FAQ-BS-vO0l-.mjs → FAQ-BjLLn81l.mjs} +1 -1
  12. package/dist/{FAQ-Ct0YfqX1.js → FAQ-C5evIqbl.js} +1 -1
  13. package/dist/{Grid-CU1dsdoO.js → Grid-BXUT_Hn6.js} +1 -1
  14. package/dist/{Grid-qbqchSLi.mjs → Grid-Dn44dvgx.mjs} +1 -1
  15. package/dist/{Hive-CzabuuCc.js → Hive-34KvKNsa.js} +1 -1
  16. package/dist/{Hive-DyxYd5eg.mjs → Hive-7xHXyMM1.mjs} +1 -1
  17. package/dist/{HiveLightboxTitles-DhEeFKWs.mjs → HiveLightboxTitles-BCoL46-V.mjs} +1 -1
  18. package/dist/{HiveLightboxTitles-DlyptAaK.js → HiveLightboxTitles-DEeyQGcf.js} +1 -1
  19. package/dist/{Lightbox-DZckgBzK.js → Lightbox-Cb7lyaNt.js} +1 -1
  20. package/dist/{Lightbox-BY99NS14.mjs → Lightbox-DzPqgKP4.mjs} +1 -1
  21. package/dist/{LightboxJournal-DAEZOPDi.js → LightboxJournal-BFF5aKRz.js} +1 -1
  22. package/dist/{LightboxJournal-D59ex6wH.mjs → LightboxJournal-C_q7_s-B.mjs} +1 -1
  23. package/dist/{LightboxStrip-YspzBP8N.mjs → LightboxStrip-BrNj7ipX.mjs} +1 -1
  24. package/dist/{LightboxStrip-BDjI1jyH.js → LightboxStrip-CC2e0_9A.js} +1 -1
  25. package/dist/{Mercury-B-s2Kvuq.js → Mercury-BmhtFYOw.js} +1 -1
  26. package/dist/{Mercury-CCW0Es-s.mjs → Mercury-Q788wrYQ.mjs} +1 -1
  27. package/dist/{OnelinerForm-C2Y_XMCY.js → OnelinerForm-CUmY-bXL.js} +1 -1
  28. package/dist/{OnelinerForm-BEu7_sho.mjs → OnelinerForm-D8WIB9Qy.mjs} +1 -1
  29. package/dist/PopupMenu-BYZy1R1y.js +356 -0
  30. package/dist/PopupMenu-DXWVDnPf.mjs +972 -0
  31. package/dist/{SimpleButton-C-o2W9bS.mjs → SimpleButton-DTpzfmb6.mjs} +1 -1
  32. package/dist/{SimpleButton-nGEcO2gB.js → SimpleButton-DtaCYa3y.js} +1 -1
  33. package/dist/{Slider20-DUi6qwnd.mjs → Slider20-CKngROrc.mjs} +1 -1
  34. package/dist/{Slider20-BOmjDRf2.js → Slider20-q0iGgnE3.js} +1 -1
  35. package/dist/SvgImage-CwRq9-ec.mjs +56 -0
  36. package/dist/SvgImage-_QN8ngad.js +1 -0
  37. package/dist/{TestimonialSingle-DrnyReim.mjs → TestimonialSingle-Bax71Hyo.mjs} +1 -1
  38. package/dist/{TestimonialSingle-BORQom3u.js → TestimonialSingle-CpEUendN.js} +1 -1
  39. package/dist/{Waterfall-DII4-WV5.js → Waterfall-B9YWMhrg.js} +1 -1
  40. package/dist/{Waterfall-3kKioKh2.mjs → Waterfall-znaoynn5.mjs} +1 -1
  41. package/dist/components-Ce8GmbzS.js +1 -0
  42. package/dist/{components-DtO0Ti47.mjs → components-QxlSJUUn.mjs} +638 -30
  43. package/dist/elements.js +1 -1
  44. package/dist/elements.mjs +23 -22
  45. package/dist/elements.node.js +1 -1
  46. package/dist/elements.node.mjs +1 -1
  47. package/dist/index.d.ts +2 -0
  48. package/dist/index.js +1 -1
  49. package/dist/index.mjs +50 -28
  50. package/dist/loadSvgMaskUrl-B6kHUyof.js +1 -0
  51. package/dist/loadSvgMaskUrl-DUhCVvpl.mjs +39 -0
  52. package/dist/sources.js +1 -1
  53. package/dist/sources.mjs +1 -1
  54. package/dist/types/SchemaV1.d.ts +3 -0
  55. package/package.json +1 -1
  56. package/dist/SvgImage-B5mR9y6q.mjs +0 -51
  57. package/dist/SvgImage-DFlmxAoL.js +0 -1
  58. package/dist/components-f82884Bk.js +0 -1
  59. package/dist/loadSvgMaskUrl-DfF7ay6h.js +0 -1
  60. package/dist/loadSvgMaskUrl-xHgGYgPe.mjs +0 -20
@@ -0,0 +1,972 @@
1
+ import { jsxs as V, jsx as C } from "react/jsx-runtime";
2
+ import { useMemo as X, useState as Z, useEffect as H, useRef as q, useLayoutEffect as ue } from "react";
3
+ import { createPortal as he } from "react-dom";
4
+ import { s as Ht } from "./scalingValue-C9JH5L6O.mjs";
5
+ import { u as pe } from "./useScopedStyles-DhBG3557.mjs";
6
+ import { u as de } from "./useLightboxScrollLock-VQ07s7EJ.mjs";
7
+ import { n as me } from "./textStylesToCss-05Mn6I_2.mjs";
8
+ import { R as ge } from "./RichTextRenderer-D52Xto59.mjs";
9
+ import { S as fe } from "./SvgImage-CwRq9-ec.mjs";
10
+ const $e = 60, be = 900 / 1440, ve = ["left", "center", "right"], Ut = {
11
+ columns: 12,
12
+ columnWidth: 99 / 1440,
13
+ gutter: 20 / 1440
14
+ };
15
+ function xe(t, e = Ut) {
16
+ const o = (c) => typeof c == "number" && Number.isFinite(c), n = (c, ...s) => s.find(o) ?? c, r = t.gridLayout ?? {}, u = Math.max(0, n(e.gutter, r.horizontalGap, t.gridGutter));
17
+ return {
18
+ columns: Math.max(1, Math.round(n(e.columns, r.columnsCount, t.gridColumns))),
19
+ columnWidth: Math.max(0, n(e.columnWidth, r.entryWidth, t.gridColumnWidth)),
20
+ gutter: u,
21
+ rowGap: Math.max(0, n(u, t.verticalGap))
22
+ };
23
+ }
24
+ function tt(t) {
25
+ return t.rowGap ?? t.gutter;
26
+ }
27
+ function Yt(t) {
28
+ const e = t.popupHeight;
29
+ return Math.min(100, Math.max(0, typeof e == "number" && Number.isFinite(e) ? e : $e));
30
+ }
31
+ function ye(t, e = be) {
32
+ return Yt(t) / 100 * e;
33
+ }
34
+ function Me(t) {
35
+ return ve.includes(t.popupAlign) ? t.popupAlign : "center";
36
+ }
37
+ function we(t, e) {
38
+ var r;
39
+ const o = (r = t.gridLayout) == null ? void 0 : r.wrapperWidth, n = e.columns * e.columnWidth + (e.columns - 1) * e.gutter;
40
+ return typeof o == "number" && Number.isFinite(o) && o > 0 ? Math.max(o, n) : n > 0 ? n : 1;
41
+ }
42
+ function ke(t) {
43
+ if (typeof t == "number") return { top: t, right: t, bottom: t, left: t };
44
+ const e = (o) => typeof o == "number" && Number.isFinite(o) ? Math.max(0, o) : 0;
45
+ return { top: e(t == null ? void 0 : t.top), right: e(t == null ? void 0 : t.right), bottom: e(t == null ? void 0 : t.bottom), left: e(t == null ? void 0 : t.left) };
46
+ }
47
+ const Ce = {
48
+ span: {
49
+ text: { min: 1 / 4, max: 5 / 12 },
50
+ image: { min: 1 / 6, max: 1 / 3 },
51
+ listA: { min: 1 / 6, max: 1 / 4 },
52
+ listB: { min: 1 / 6, max: 1 / 4 }
53
+ },
54
+ breakChance: 0.25
55
+ };
56
+ function Ie(t, e, o, n, r = Ce) {
57
+ const u = Re(o), c = Math.max(1, Math.floor(e.columns)), s = [];
58
+ let d = 0, g = new Array(c).fill(!1);
59
+ const $ = {};
60
+ for (const z of t) {
61
+ const m = $[z] ?? ($[z] = ze(r.span[z] ?? r.span.text, c, u));
62
+ let h = Et(g, m);
63
+ const b = g.some(Boolean);
64
+ (h.length === 0 || b && u() < r.breakChance) && (d += 1, g = new Array(c).fill(!1), h = Et(g, m));
65
+ const N = h[Math.floor(u() * h.length)];
66
+ for (let R = Math.max(0, N - 1); R < Math.min(c, N + m + 1); R++) g[R] = !0;
67
+ s.push({ column: N, span: m, row: d });
68
+ }
69
+ const a = d + 1;
70
+ return {
71
+ seed: o,
72
+ grid: { ...e, columns: c },
73
+ placements: s.map(({ column: z, span: m, row: h }) => ({ column: z, span: m, top: K(e, h * n / a, n) }))
74
+ };
75
+ }
76
+ function ro() {
77
+ return Math.floor(Math.random() * 2147483647);
78
+ }
79
+ function K(t, e, o = 1 / 0) {
80
+ const n = t.beat ?? 0, r = Math.max(0, o), u = n > 0 ? Math.round(e / n) * n : e, c = u <= r ? u : n > 0 ? Math.floor(r / n + 1e-9) * n : r;
81
+ return Math.round(Math.max(0, c) * 1e6) / 1e6;
82
+ }
83
+ function xt(t) {
84
+ return t.beat && t.beat > 0 ? t.beat : 8 / 1440;
85
+ }
86
+ function lt(t, e, o = 1 / 0) {
87
+ const n = t.beat ?? 0, r = xt(t), u = n > 0 ? Math.round(e / n) * n : e, c = u <= o ? u : n > 0 ? Math.floor(o / n + 1e-9) * n : o;
88
+ return jt(Math.max(r, c));
89
+ }
90
+ function _e(t, e) {
91
+ const o = (n, r) => Math.abs(n - r) < 1e-9;
92
+ return Math.floor(t.columns) === Math.floor(e.columns) && o(t.columnWidth, e.columnWidth) && o(t.gutter, e.gutter) && o(tt(t), tt(e)) && o(t.beat ?? 0, e.beat ?? 0);
93
+ }
94
+ function Ae(t, e) {
95
+ const o = { ...e, columns: Math.max(1, Math.floor(e.columns)) };
96
+ if (_e(t.grid, o)) return t;
97
+ const n = Math.max(1, Math.floor(t.grid.columns)), r = o.columns, u = (s) => n === r ? s : Math.round(s * r / n), c = t.placements.map((s) => {
98
+ const d = Math.min(r, Math.max(1, u(s.span))), g = Math.min(Math.max(0, u(s.column)), r - d), $ = K(o, s.top);
99
+ return s.height === void 0 ? { column: g, span: d, top: $ } : { column: g, span: d, top: $, height: lt(o, s.height) };
100
+ });
101
+ return { ...t, grid: o, placements: c };
102
+ }
103
+ function jt(t) {
104
+ return Math.round(t * 1e6) / 1e6;
105
+ }
106
+ function Vt(t, e, o, n, r) {
107
+ return t.column < o.column + o.span && o.column < t.column + t.span && t.top < o.top + n + r - 1e-9 && o.top < t.top + e + r - 1e-9;
108
+ }
109
+ function Se(t, e, o, n, r) {
110
+ const u = t.placements[e];
111
+ return u ? Xt(t, e, { ...u, column: o, top: n }, r) : null;
112
+ }
113
+ function Ne(t, e, o, n) {
114
+ if (!t.placements[e]) return null;
115
+ const { columns: r } = t.grid, u = Math.min(Math.max(0, o.column), r - 1), c = Math.min(Math.max(1, o.span), r - u), s = K(t.grid, o.top, n ? n.height - xt(t.grid) : 1 / 0), d = o.height === void 0 ? void 0 : lt(t.grid, o.height, n ? n.height - s : 1 / 0);
116
+ return Xt(t, e, d === void 0 ? { column: u, span: c, top: s } : { column: u, span: c, top: s, height: d }, n);
117
+ }
118
+ function Xt(t, e, o, n) {
119
+ const { columns: r } = t.grid, u = tt(t.grid), c = Math.min(o.span, r);
120
+ if (c < 1 || o.column < 0 || o.column + c > r) return null;
121
+ const s = o.height ?? (n == null ? void 0 : n.heights[e]) ?? 0, d = {
122
+ column: o.column,
123
+ span: c,
124
+ top: K(t.grid, o.top, n ? n.height - s : 1 / 0),
125
+ ...o.height === void 0 ? {} : { height: o.height }
126
+ };
127
+ return n && t.placements.some((g, $) => $ !== e && Vt(d, s, g, n.heights[$] ?? 0, u)) ? null : {
128
+ ...t,
129
+ edited: !0,
130
+ placements: t.placements.map((g, $) => $ === e ? d : g)
131
+ };
132
+ }
133
+ function Te(t, e) {
134
+ const { columns: o } = t.grid, n = tt(t.grid), r = t.grid.beat ?? 0, u = e.height, c = t.placements.map((m, h) => e.heights[h] ?? 0), s = [...t.placements], d = s.map((m, h) => h).sort((m, h) => s[m].top - s[h].top || m - h), g = [], $ = (m, h) => {
135
+ let { top: b } = m;
136
+ for (let N = !0, R = 0; N && R <= g.length; R++) {
137
+ N = !1;
138
+ for (const T of g) {
139
+ const y = s[T];
140
+ if (!Vt({ ...m, top: b }, h, y, c[T], n)) continue;
141
+ const S = y.top + c[T] + n, I = r > 0 ? jt(Math.ceil(S / r - 1e-9) * r) : Math.ceil(S * 1e6 - 1e-6) / 1e6;
142
+ I <= b || (b = I, N = !0);
143
+ }
144
+ }
145
+ return b;
146
+ }, a = (m, h) => m + h > u + 1e-9;
147
+ let z = !1;
148
+ for (const m of d) {
149
+ const h = s[m];
150
+ let b = { column: h.column, top: $(h, c[m]) };
151
+ if (b.top !== h.top && a(b.top, c[m])) {
152
+ const N = Math.min(h.span, o), R = Array.from({ length: Math.max(0, o - N + 1) }, (y, S) => S).sort((y, S) => Math.abs(y - h.column) - Math.abs(S - h.column) || y - S);
153
+ let T = null;
154
+ for (const y of R) {
155
+ const S = $({ ...h, column: y }, c[m]);
156
+ !a(S, c[m]) && (!T || S < T.top - 1e-9) && (T = { column: y, top: S });
157
+ }
158
+ T && (b = T);
159
+ }
160
+ (b.column !== h.column || b.top !== h.top) && (s[m] = { ...s[m], ...b }, z = !0), g.push(m);
161
+ }
162
+ return z ? { ...t, placements: s } : t;
163
+ }
164
+ function ze(t, e, o) {
165
+ const n = Math.max(1, Math.round(t.min * e)), r = Math.max(n, Math.round(t.max * e));
166
+ return Math.min(e, n + Math.floor(o() * (r - n + 1)));
167
+ }
168
+ function Et(t, e) {
169
+ const o = [];
170
+ for (let n = 0; n + e <= t.length; n++) {
171
+ let r = !0;
172
+ for (let u = n; u < n + e; u++)
173
+ if (t[u]) {
174
+ r = !1;
175
+ break;
176
+ }
177
+ r && o.push(n);
178
+ }
179
+ return o;
180
+ }
181
+ function Re(t) {
182
+ let e = t >>> 0;
183
+ return () => {
184
+ e = e + 1831565813 >>> 0;
185
+ let o = e;
186
+ return o = Math.imul(o ^ o >>> 15, o | 1), o ^= o + Math.imul(o ^ o >>> 7, o | 61), ((o ^ o >>> 14) >>> 0) / 4294967296;
187
+ };
188
+ }
189
+ const U = 300, Le = 3e3, qt = ["slide down", "slide up", "fade", "scale", "none"], Be = "slide down";
190
+ function Ge(t) {
191
+ const e = t.popupTransition;
192
+ return qt.includes(e) ? e : Be;
193
+ }
194
+ const Fe = ["burger", "plus", "image", "text"], We = 24 / 1440, Ee = ["--cntrl-article-top", "--cntrl-article-left", "--cntrl-article-width", "--cntrl-viewport-height"], De = ["top", "right", "bottom", "left", "top-left", "top-right", "bottom-right", "bottom-left"], Oe = ["right", "left"];
195
+ function Dt(t, e) {
196
+ return { ...e, heights: e.heights.map((o, n) => {
197
+ var r;
198
+ return ((r = t.placements[n]) == null ? void 0 : r.height) ?? o;
199
+ }) };
200
+ }
201
+ function He(t, e) {
202
+ return t.column === e.column && t.span === e.span && t.top === e.top && t.height === e.height;
203
+ }
204
+ function Ot(t, e) {
205
+ return e.handle ? Ne(t, e.index, e.placement, e.measure) : Se(t, e.index, e.placement.column, e.placement.top, e.measure);
206
+ }
207
+ function Ue(t) {
208
+ return `
209
+ /* the element is the trigger alone, placed and sized on the page as any other element; the popup opens over the page */
210
+ .${t}-root {
211
+ position: relative;
212
+ width: 100%;
213
+ height: 100%;
214
+ box-sizing: border-box;
215
+ }
216
+ /* fills the element's box, its icon or text centred in it inside its padding */
217
+ .${t}-button {
218
+ all: unset;
219
+ box-sizing: border-box;
220
+ display: flex;
221
+ align-items: center;
222
+ justify-content: center;
223
+ width: 100%;
224
+ height: 100%;
225
+ cursor: pointer;
226
+ white-space: nowrap;
227
+ color: var(--${t}-trigger-color);
228
+ background-color: var(--${t}-trigger-bg);
229
+ }
230
+ /* an icon trigger's lines, as thick as a twelfth of it and a pixel at least, drawn in the trigger's colour */
231
+ .${t}-icon {
232
+ position: relative;
233
+ display: block;
234
+ flex: none;
235
+ width: var(--${t}-icon-size);
236
+ height: var(--${t}-icon-size);
237
+ --${t}-icon-stroke: max(1px, calc(var(--${t}-icon-size) / 12));
238
+ transition: transform ${U}ms ease;
239
+ }
240
+ .${t}-icon-line {
241
+ position: absolute;
242
+ left: 0;
243
+ width: 100%;
244
+ height: var(--${t}-icon-stroke);
245
+ top: calc(50% - var(--${t}-icon-stroke) / 2);
246
+ background-color: currentColor;
247
+ transition: transform ${U}ms ease, opacity ${U}ms ease;
248
+ }
249
+ /* three lines, the outer two meeting in the middle and crossing as the popup opens, the middle one fading */
250
+ .${t}-icon-burger .${t}-icon-line:nth-child(1) { transform: translateY(calc(var(--${t}-icon-size) * -0.3)) rotate(0deg) scaleX(1); }
251
+ .${t}-icon-burger .${t}-icon-line:nth-child(3) { transform: translateY(calc(var(--${t}-icon-size) * 0.3)) rotate(0deg) scaleX(1); }
252
+ .${t}-button-open .${t}-icon-burger .${t}-icon-line:nth-child(1) { transform: translateY(0) rotate(45deg) scaleX(1); }
253
+ .${t}-button-open .${t}-icon-burger .${t}-icon-line:nth-child(2) { opacity: 0; transform: scaleX(0); }
254
+ .${t}-button-open .${t}-icon-burger .${t}-icon-line:nth-child(3) { transform: translateY(0) rotate(-45deg) scaleX(1); }
255
+ /* a plus, turned an eighth as the popup opens, into a cross */
256
+ .${t}-icon-plus .${t}-icon-line:nth-child(2) { transform: rotate(90deg); }
257
+ .${t}-button-open .${t}-icon-plus { transform: rotate(45deg); }
258
+ /* the user's image, fitted to the icon's size: an SVG tinted with the trigger's colour, anything else as it is */
259
+ .${t}-icon-picture {
260
+ display: block;
261
+ width: 100%;
262
+ height: 100%;
263
+ }
264
+ @media (prefers-reduced-motion: reduce) {
265
+ .${t}-icon,
266
+ .${t}-icon-line {
267
+ transition: none;
268
+ }
269
+ }
270
+ .${t}-button:focus-visible {
271
+ outline: 1px solid currentColor;
272
+ outline-offset: 2px;
273
+ }
274
+ /* the popup opens over the whole screen, out of the element's box (it is portalled out of it); in the editor, over
275
+ the whole article as it is drawn on the canvas */
276
+ .${t}-overlay {
277
+ position: fixed;
278
+ inset: 0;
279
+ z-index: 9997;
280
+ pointer-events: none;
281
+ overflow: hidden;
282
+ }
283
+ .${t}-overlay-editor {
284
+ inset: auto;
285
+ top: var(--cntrl-article-top, 0);
286
+ left: var(--cntrl-article-left, 0);
287
+ width: var(--cntrl-article-width, 100vw);
288
+ height: var(--cntrl-viewport-height, 100vh);
289
+ }
290
+ .${t}-overlay-active {
291
+ pointer-events: auto;
292
+ }
293
+ .${t}-backdrop {
294
+ all: unset;
295
+ position: absolute;
296
+ inset: 0;
297
+ background-color: var(--${t}-overlay-color);
298
+ /* the page behind blurred, the blur fading in and out with the overlay's colour */
299
+ -webkit-backdrop-filter: var(--${t}-overlay-blur, none);
300
+ backdrop-filter: var(--${t}-overlay-blur, none);
301
+ opacity: 0;
302
+ transition: opacity ${U}ms ease;
303
+ }
304
+ .${t}-card {
305
+ position: absolute;
306
+ box-sizing: border-box;
307
+ /* content reaching below the popup's bottom scrolls, within the popup alone */
308
+ overflow-x: hidden;
309
+ overflow-y: auto;
310
+ overscroll-behavior: contain;
311
+ background-color: var(--${t}-popup-bg);
312
+ opacity: 0;
313
+ transition: opacity ${U}ms ease, transform ${U}ms ease;
314
+ }
315
+ /* where the popup comes in from and goes back to, by its transition; it fades in and out with each, and 'none'
316
+ shows and hides the popup and its overlay at once */
317
+ .${t}-transition-slide-down .${t}-card {
318
+ transform: translateY(24px);
319
+ }
320
+ .${t}-transition-slide-up .${t}-card {
321
+ transform: translateY(-24px);
322
+ }
323
+ .${t}-transition-scale .${t}-card {
324
+ transform: scale(0.95);
325
+ }
326
+ .${t}-transition-none .${t}-backdrop,
327
+ .${t}-transition-none .${t}-card {
328
+ transition: none;
329
+ }
330
+ @media (prefers-reduced-motion: reduce) {
331
+ .${t}-overlay .${t}-card {
332
+ transform: none;
333
+ }
334
+ }
335
+ .${t}-overlay-active .${t}-backdrop,
336
+ .${t}-overlay-active .${t}-card {
337
+ opacity: 1;
338
+ transform: none;
339
+ }
340
+ /* one row, which every block shares: its column from the grid, its height from a spacer above it. The row is
341
+ as tall as the popup at least, and as tall as the lowest block reaches where that is further, the popup
342
+ scrolling down to it */
343
+ .${t}-grid {
344
+ position: relative;
345
+ display: grid;
346
+ grid-template-rows: auto;
347
+ min-height: 100%;
348
+ }
349
+ /* the grid the blocks snap to, drawn as the article's is while a block is moved or resized: a hairline at both
350
+ edges of every column, and one across every beat from the popup's top, or, with no beat, every vertical gap */
351
+ .${t}-guides {
352
+ position: absolute;
353
+ inset: 0;
354
+ z-index: 2;
355
+ display: grid;
356
+ grid-template-rows: minmax(0, 1fr);
357
+ pointer-events: none;
358
+ opacity: 0;
359
+ transition: opacity 200ms ease;
360
+ --${t}-guide-color: var(--cntrl-grid-color, rgba(255, 92, 2, 0.45));
361
+ }
362
+ .${t}-guides-shown {
363
+ opacity: 1;
364
+ }
365
+ .${t}-guides-beats {
366
+ background-image: repeating-linear-gradient(
367
+ to bottom,
368
+ var(--${t}-guide-color) 0 1px,
369
+ transparent 1px var(--${t}-beat)
370
+ );
371
+ }
372
+ .${t}-guide {
373
+ grid-row: 1;
374
+ box-shadow: inset 1px 0 var(--${t}-guide-color), inset -1px 0 var(--${t}-guide-color);
375
+ }
376
+ /* the block and, on the canvas, the handles it is resized by, which sit on its edges outside any scroller */
377
+ .${t}-frame {
378
+ position: relative;
379
+ display: flex;
380
+ flex-direction: column;
381
+ flex: none;
382
+ min-width: 0;
383
+ min-height: 0;
384
+ }
385
+ .${t}-slot {
386
+ display: flex;
387
+ flex-direction: column;
388
+ grid-row: 1;
389
+ min-width: 0;
390
+ min-height: 0;
391
+ pointer-events: none;
392
+ }
393
+ .${t}-spacer {
394
+ flex: none;
395
+ }
396
+ .${t}-block {
397
+ flex: none;
398
+ min-width: 0;
399
+ pointer-events: auto;
400
+ }
401
+ /* the text's box runs from the first line's cap height to the last line's baseline, where the browser can
402
+ trim it: a title lines up with the top of an image beside it, and the block is no taller than its text */
403
+ .${t}-block.${t}-block-text,
404
+ .${t}-block.${t}-block-listA,
405
+ .${t}-block.${t}-block-listB {
406
+ text-box: trim-both cap alphabetic;
407
+ }
408
+ .${t}-block-title {
409
+ color: var(--${t}-title-color);
410
+ }
411
+ .${t}-block-text {
412
+ color: var(--${t}-text-color);
413
+ }
414
+ .${t}-block-text a {
415
+ color: inherit;
416
+ }
417
+ .${t}-block-listA .${t}-block-text {
418
+ color: var(--${t}-list-a-color, var(--${t}-text-color));
419
+ }
420
+ .${t}-block-listB .${t}-block-text {
421
+ color: var(--${t}-list-b-color, var(--${t}-text-color));
422
+ }
423
+ .${t}-block-listA .${t}-block-text a,
424
+ .${t}-block-listB .${t}-block-text a {
425
+ text-decoration: none;
426
+ }
427
+ .${t}-block-listA .${t}-block-text a:hover,
428
+ .${t}-block-listB .${t}-block-text a:hover {
429
+ text-decoration: underline;
430
+ }
431
+ .${t}-images {
432
+ display: grid;
433
+ }
434
+ /* every image takes the same cell, so the block is as tall as its tallest image and keeps still as they change */
435
+ .${t}-image {
436
+ display: block;
437
+ grid-area: 1 / 1;
438
+ width: 100%;
439
+ height: auto;
440
+ object-fit: cover;
441
+ }
442
+ /* a block resized to a height: its images fill it, cut to it */
443
+ .${t}-block-sized .${t}-images {
444
+ height: 100%;
445
+ grid-template-rows: minmax(0, 100%);
446
+ }
447
+ .${t}-block-sized .${t}-image {
448
+ height: 100%;
449
+ }
450
+ .${t}-image {
451
+ transition: opacity 800ms ease-in-out;
452
+ }
453
+ .${t}-image-hidden {
454
+ opacity: 0;
455
+ }
456
+ @media (prefers-reduced-motion: reduce) {
457
+ .${t}-image {
458
+ transition: none;
459
+ }
460
+ }
461
+ .${t}-grid-editable .${t}-block {
462
+ cursor: grab;
463
+ touch-action: none;
464
+ user-select: none;
465
+ }
466
+ .${t}-grid-editable .${t}-block * {
467
+ pointer-events: none;
468
+ }
469
+ .${t}-slot-dragged {
470
+ z-index: 1;
471
+ }
472
+ .${t}-grid-editable .${t}-block-dragged {
473
+ cursor: grabbing;
474
+ outline: 1px solid #FF5C02;
475
+ outline-offset: 2px;
476
+ }
477
+ .${t}-grid-editable .${t}-frame:hover > .${t}-block:not(.${t}-block-dragged) {
478
+ outline: 1px solid rgba(255, 92, 2, 0.4);
479
+ outline-offset: 2px;
480
+ }
481
+ .${t}-grid-editable .${t}-block-invalid {
482
+ opacity: 0.5;
483
+ outline-style: dashed;
484
+ }
485
+ /* edges are a bar that grows from the block's edge as the pointer comes to it, as a structured block's do;
486
+ corners a small square */
487
+ .${t}-handle {
488
+ position: absolute;
489
+ z-index: 3;
490
+ pointer-events: auto;
491
+ touch-action: none;
492
+ }
493
+ .${t}-handle::after {
494
+ content: '';
495
+ position: absolute;
496
+ box-sizing: border-box;
497
+ opacity: 0;
498
+ transition: opacity 150ms ease, transform 150ms ease;
499
+ }
500
+ .${t}-handle-left,
501
+ .${t}-handle-right {
502
+ top: 0;
503
+ bottom: 0;
504
+ width: 10px;
505
+ cursor: ew-resize;
506
+ }
507
+ .${t}-handle-left { left: -5px; }
508
+ .${t}-handle-right { right: -5px; }
509
+ .${t}-handle-top,
510
+ .${t}-handle-bottom {
511
+ left: 0;
512
+ right: 0;
513
+ height: 10px;
514
+ cursor: ns-resize;
515
+ }
516
+ .${t}-handle-top { top: -5px; }
517
+ .${t}-handle-bottom { bottom: -5px; }
518
+ .${t}-handle-left::after,
519
+ .${t}-handle-right::after {
520
+ top: 0;
521
+ bottom: 0;
522
+ left: 3px;
523
+ width: 4px;
524
+ background-color: #FF5C02;
525
+ transform: scaleX(0.25);
526
+ }
527
+ .${t}-handle-top::after,
528
+ .${t}-handle-bottom::after {
529
+ left: 0;
530
+ right: 0;
531
+ top: 3px;
532
+ height: 4px;
533
+ background-color: #FF5C02;
534
+ transform: scaleY(0.25);
535
+ }
536
+ .${t}-handle-top-left,
537
+ .${t}-handle-top-right,
538
+ .${t}-handle-bottom-right,
539
+ .${t}-handle-bottom-left {
540
+ width: 12px;
541
+ height: 12px;
542
+ }
543
+ .${t}-handle-top-left { top: -6px; left: -6px; cursor: nwse-resize; }
544
+ .${t}-handle-bottom-right { bottom: -6px; right: -6px; cursor: nwse-resize; }
545
+ .${t}-handle-top-right { top: -6px; right: -6px; cursor: nesw-resize; }
546
+ .${t}-handle-bottom-left { bottom: -6px; left: -6px; cursor: nesw-resize; }
547
+ .${t}-handle-top-left::after,
548
+ .${t}-handle-top-right::after,
549
+ .${t}-handle-bottom-right::after,
550
+ .${t}-handle-bottom-left::after {
551
+ inset: 3px;
552
+ background-color: #ffffff;
553
+ border: 1px solid #FF5C02;
554
+ }
555
+ .${t}-frame:hover > .${t}-handle::after {
556
+ opacity: 0.6;
557
+ }
558
+ .${t}-handle:hover::after,
559
+ .${t}-handle-active::after {
560
+ opacity: 1;
561
+ transform: none;
562
+ }
563
+ `;
564
+ }
565
+ function P(t, e, o, n) {
566
+ const r = (d) => t[`${e}${d}`] ?? (n ? t[`${n}${d}`] : void 0), u = (d) => {
567
+ const g = r(d);
568
+ return g === void 0 ? void 0 : Ht(g, o);
569
+ }, c = r("FontSettings"), s = r("TextAppearance");
570
+ return {
571
+ fontFamily: me(r("FontFamily")),
572
+ fontWeight: c == null ? void 0 : c.fontWeight,
573
+ fontStyle: c == null ? void 0 : c.fontStyle,
574
+ fontSize: u("FontSize"),
575
+ lineHeight: u("LineHeight"),
576
+ letterSpacing: u("LetterSpacing"),
577
+ wordSpacing: u("WordSpacing"),
578
+ textTransform: s == null ? void 0 : s.textTransform,
579
+ textDecoration: s == null ? void 0 : s.textDecoration,
580
+ fontVariant: s == null ? void 0 : s.fontVariant
581
+ };
582
+ }
583
+ function yt(t) {
584
+ const e = t.type ?? "text";
585
+ return e === "list" ? "listA" : e;
586
+ }
587
+ function Ye(t, e, o, n) {
588
+ return t != null && t.grid && Array.isArray(t.placements) && t.placements.every((r) => typeof (r == null ? void 0 : r.top) == "number") ? je(Ae(t, n), e) : Ie(e.map(yt), n, 1, o);
589
+ }
590
+ function je(t, e) {
591
+ const o = (n, r) => n.height !== void 0 && e[r] && yt(e[r]) !== "image";
592
+ return t.placements.some(o) ? {
593
+ ...t,
594
+ placements: t.placements.map((n, r) => {
595
+ if (!o(n, r)) return n;
596
+ const { height: u, ...c } = n;
597
+ return c;
598
+ })
599
+ } : t;
600
+ }
601
+ function Ve(t, e) {
602
+ const o = (n, r) => Math.abs(n - r) < 1e-4;
603
+ return o(t.height, e.height) && t.heights.length === e.heights.length && t.heights.every((n, r) => o(n, e.heights[r]));
604
+ }
605
+ function vt(t, e) {
606
+ const { columns: o } = t.grid, n = t.placements[e];
607
+ if (!n) return { column: 0, span: Math.min(o, Math.max(1, Math.round(o / 4))), top: 0 };
608
+ const r = Math.min(n.span, o), u = { column: Math.min(n.column, o - r), span: r, top: n.top };
609
+ return typeof n.height == "number" ? { ...u, height: n.height } : u;
610
+ }
611
+ function Xe({
612
+ settings: t,
613
+ content: e = [],
614
+ isEditor: o,
615
+ isEditMode: n,
616
+ isPreviewMode: r,
617
+ layoutId: u,
618
+ portalId: c,
619
+ currentState: s,
620
+ unavailableStates: d = [],
621
+ onOpenChange: g,
622
+ onUpdateSettings: $
623
+ }) {
624
+ var Gt, Ft;
625
+ const { prefix: a } = pe(), z = X(() => Ue(a), [a]), [m, h] = Z(!1), [b, N] = Z(!1), [R, T] = Z(!1), y = !!(o && !r), S = y && s === "open" && !d.includes("open"), I = S || !y && m, ct = Ge(t);
626
+ de(I && !y), H(() => {
627
+ g == null || g(I);
628
+ }, [I, g]), H(() => {
629
+ h(!1);
630
+ }, [u]), H(() => {
631
+ if (I) {
632
+ N(!0);
633
+ return;
634
+ }
635
+ T(!1);
636
+ const i = window.setTimeout(() => N(!1), ct === "none" ? 0 : U);
637
+ return () => window.clearTimeout(i);
638
+ }, [I, ct]), H(() => {
639
+ if (!I || !b) return;
640
+ const i = nt.current;
641
+ i && getComputedStyle(i.querySelector("[role=dialog]") ?? i).opacity;
642
+ const l = requestAnimationFrame(() => T(!0));
643
+ return () => cancelAnimationFrame(l);
644
+ }, [I, b]), H(() => {
645
+ if (!I || y) return;
646
+ const i = (l) => {
647
+ l.key === "Escape" && h(!1);
648
+ };
649
+ return window.addEventListener("keydown", i), () => window.removeEventListener("keydown", i);
650
+ }, [I, y]);
651
+ const _ = (i) => Ht(i ?? 0, o), Mt = ye(t), et = (Gt = t.menuLayout) == null ? void 0 : Gt.grid, wt = xe(t, et != null && et.columnWidth ? et : Ut), st = `min(100%, ${_(we(t, wt))})`, ut = _(t.popupOffset), Zt = {
652
+ left: `calc(0px + ${ut})`,
653
+ center: `calc((100% - ${st}) / 2 + ${ut})`,
654
+ right: `calc(100% - ${st} + ${ut})`
655
+ }[Me(t)], { columns: kt, columnWidth: Ct, gutter: It, rowGap: _t } = wt, At = X(
656
+ () => ({ columns: kt, columnWidth: Ct, gutter: It, rowGap: _t }),
657
+ [kt, Ct, It, _t]
658
+ ), J = X(
659
+ () => Ye(t.menuLayout, e, Mt, At),
660
+ [t.menuLayout, e, Mt, At]
661
+ ), [ht, Kt] = Z(null), pt = X(() => ht ? Dt(J, ht) : null, [J, ht]), M = X(() => pt ? Te(J, pt) : J, [J, pt]), { columns: F, gutter: dt, columnWidth: mt } = M.grid, Jt = F * mt + (F - 1) * dt, gt = mt > 0 ? {
662
+ gridTemplateColumns: `repeat(${F}, minmax(0, ${_(mt)}))`,
663
+ columnGap: _(dt),
664
+ width: `min(100%, ${_(Jt)})`,
665
+ marginInline: "auto"
666
+ } : { gridTemplateColumns: `repeat(${F}, minmax(0, 1fr))`, columnGap: _(dt) }, St = t.triggerLabel || "Menu", ot = ke(t.triggerPadding), Y = t.triggerType === "image" && !t.triggerIcon ? "burger" : t.triggerType ?? "text", Qt = P(t, "trigger", o), Pt = P(t, "title", o), te = {
667
+ text: P(t, "text", o),
668
+ listA: P(t, "listA", o, "text"),
669
+ listB: P(t, "listB", o, "text")
670
+ }, E = ((Ft = t.stateOverrides) == null ? void 0 : Ft.open) ?? {}, Nt = {
671
+ [`--${a}-trigger-bg`]: t.barBackgroundColor,
672
+ [`--${a}-trigger-color`]: (I ? E.triggerColor : void 0) ?? t.triggerColor,
673
+ [`--${a}-overlay-color`]: E.overlayColor ?? t.overlayColor,
674
+ [`--${a}-overlay-blur`]: t.overlayBlur ? `blur(${_(t.overlayBlur)})` : void 0,
675
+ [`--${a}-popup-bg`]: E.popupBackgroundColor ?? t.popupBackgroundColor,
676
+ [`--${a}-title-color`]: E.titleColor ?? t.titleColor,
677
+ [`--${a}-text-color`]: E.textColor ?? t.textColor,
678
+ [`--${a}-list-a-color`]: E.listAColor ?? t.listAColor,
679
+ [`--${a}-list-b-color`]: E.listBColor ?? t.listBColor
680
+ }, Tt = q(null), ee = X(() => {
681
+ const i = Tt.current;
682
+ if (!b || !o || !i) return;
683
+ const l = getComputedStyle(i);
684
+ return Object.fromEntries(
685
+ Ee.map((p) => [p, l.getPropertyValue(p).trim()]).filter(([, p]) => p)
686
+ );
687
+ }, [b, o]), nt = q(null), zt = q(null), ft = q(null), Q = q([]), [B, oe] = Z(null), $t = q(null), j = (i) => {
688
+ $t.current = i, oe(i);
689
+ }, W = !!(S && n && $), ne = B ? Ot(M, B) : null;
690
+ H(() => {
691
+ W || j(null);
692
+ }, [W]), ue(() => {
693
+ const i = zt.current, l = ft.current;
694
+ if (!b || !i || !l) return;
695
+ const p = () => {
696
+ var A;
697
+ const v = (A = nt.current) == null ? void 0 : A.getBoundingClientRect().width;
698
+ if (!v) return;
699
+ const x = {
700
+ height: i.getBoundingClientRect().height / v,
701
+ heights: e.map((k, L) => {
702
+ var f;
703
+ return (((f = Q.current[L]) == null ? void 0 : f.getBoundingClientRect().height) ?? 0) / v;
704
+ })
705
+ };
706
+ Kt((k) => k && Ve(k, x) ? k : x);
707
+ };
708
+ p();
709
+ const w = new ResizeObserver(p);
710
+ return w.observe(i), w.observe(l), Q.current.slice(0, e.length).forEach((v) => v && w.observe(v)), () => w.disconnect();
711
+ }, [b, e]);
712
+ const Rt = () => {
713
+ const i = ft.current, l = i.getBoundingClientRect(), p = i.offsetWidth ? l.width / i.offsetWidth : 1, w = (parseFloat(getComputedStyle(i).columnGap) || 0) * p;
714
+ return { area: l, gap: w, pitch: (l.width + w) / F };
715
+ }, re = (i, l, p) => {
716
+ var L, f;
717
+ if (!W || !M.placements[l] || i.button !== 0) return;
718
+ i.preventDefault(), i.stopPropagation(), i.currentTarget.setPointerCapture(i.pointerId);
719
+ const { area: w, pitch: v } = Rt(), x = ((L = Q.current[l]) == null ? void 0 : L.getBoundingClientRect()) ?? i.currentTarget.getBoundingClientRect(), A = ((f = nt.current) == null ? void 0 : f.getBoundingClientRect().width) || 1, k = vt(M, l);
720
+ j({
721
+ index: l,
722
+ pointerId: i.pointerId,
723
+ handle: p,
724
+ grabColumn: Math.min(Math.max(Math.floor((i.clientX - w.left) / v) - k.column, 0), k.span - 1),
725
+ grabY: i.clientY - x.top,
726
+ unit: A,
727
+ start: k,
728
+ placement: k,
729
+ measure: Dt(M, {
730
+ height: w.height / A,
731
+ heights: e.map((D, rt) => {
732
+ var G;
733
+ return (((G = Q.current[rt]) == null ? void 0 : G.getBoundingClientRect().height) ?? 0) / A;
734
+ })
735
+ })
736
+ });
737
+ }, ie = (i) => {
738
+ const l = $t.current;
739
+ if (!l || i.pointerId !== l.pointerId) return;
740
+ i.stopPropagation();
741
+ const { area: p, gap: w, pitch: v } = Rt(), { start: x, measure: A, handle: k } = l, L = A.height;
742
+ if (!k) {
743
+ j({
744
+ ...l,
745
+ placement: {
746
+ ...x,
747
+ column: Math.min(Math.max(Math.floor((i.clientX - p.left) / v) - l.grabColumn, 0), F - x.span),
748
+ top: K(M.grid, (i.clientY - l.grabY - p.top) / l.unit, L - A.heights[l.index])
749
+ }
750
+ });
751
+ return;
752
+ }
753
+ const f = i.clientX - p.left, D = (i.clientY - p.top) / l.unit, rt = x.column + x.span;
754
+ let { column: G, span: it, top: O } = x, at = x.height;
755
+ if (k.includes("left") && (G = Math.min(Math.max(Math.round(f / v), 0), rt - 1), it = rt - G), k.includes("right") && (it = Math.min(Math.max(Math.round((f + w) / v), G + 1), F) - G), k.includes("top")) {
756
+ const Wt = x.top + (x.height ?? A.heights[l.index] ?? 0);
757
+ O = K(M.grid, D, Wt - xt(M.grid)), at = lt(M.grid, Wt - O, L - O);
758
+ }
759
+ k.includes("bottom") && (at = lt(M.grid, D - O, L - O)), j({ ...l, placement: at === void 0 ? { column: G, span: it, top: O } : { column: G, span: it, top: O, height: at } });
760
+ }, ae = (i) => {
761
+ const l = $t.current;
762
+ if (!l || i.pointerId !== l.pointerId) return;
763
+ i.stopPropagation();
764
+ const p = Ot(M, l), w = p == null ? void 0 : p.placements[l.index];
765
+ p && w && !He(w, vt(M, l.index)) && ($ == null || $({ ...t, menuLayout: p })), j(null);
766
+ }, le = (i, l) => {
767
+ i.stopPropagation();
768
+ const p = M.placements[l];
769
+ if (!W || !p || p.height === void 0) return;
770
+ const { height: w, ...v } = p;
771
+ $ == null || $({
772
+ ...t,
773
+ menuLayout: { ...M, edited: !0, placements: M.placements.map((x, A) => A === l ? v : x) }
774
+ });
775
+ }, Lt = () => h(!1), ce = (i) => {
776
+ !y && i.target.closest("a") && Lt();
777
+ }, se = (i, l) => {
778
+ const p = yt(i), w = (i.images ?? []).filter((f) => f == null ? void 0 : f.assetId), v = (B == null ? void 0 : B.index) === l, x = v ? B.placement : vt(M, l), A = x.height !== void 0, k = W && (!B || v), L = (f) => ({
779
+ onPointerDown: (D) => re(D, l, f),
780
+ onPointerMove: ie,
781
+ onPointerUp: ae,
782
+ onPointerCancel: () => j(null)
783
+ });
784
+ return /* @__PURE__ */ V(
785
+ "div",
786
+ {
787
+ className: `${a}-slot${v ? ` ${a}-slot-dragged` : ""}`,
788
+ style: { gridColumn: `${x.column + 1} / span ${x.span}` },
789
+ children: [
790
+ /* @__PURE__ */ C("div", { className: `${a}-spacer`, style: { height: _(x.top) } }),
791
+ /* @__PURE__ */ V("div", { className: `${a}-frame`, children: [
792
+ /* @__PURE__ */ V(
793
+ "div",
794
+ {
795
+ ref: (f) => {
796
+ Q.current[l] = f;
797
+ },
798
+ className: [
799
+ `${a}-block ${a}-block-${p}`,
800
+ A ? `${a}-block-sized` : "",
801
+ v ? `${a}-block-dragged` : "",
802
+ v && !ne ? `${a}-block-invalid` : ""
803
+ ].filter(Boolean).join(" "),
804
+ style: A ? { height: _(x.height) } : void 0,
805
+ ...W ? L(null) : {},
806
+ children: [
807
+ i.title && p !== "image" ? /* @__PURE__ */ C("div", { className: `${a}-block-title`, style: { ...Pt, marginBottom: _(t.titleGap) }, children: i.title }) : null,
808
+ p === "image" ? /* @__PURE__ */ C(qe, { prefix: a, images: w, isRunning: I, radius: _(t.imageRadius) }) : /* @__PURE__ */ C("div", { className: `${a}-block-text`, style: te[p], children: /* @__PURE__ */ C(ge, { content: Array.isArray(i.text) ? i.text : [] }) })
809
+ ]
810
+ }
811
+ ),
812
+ k ? (p === "image" ? De : Oe).map((f) => /* @__PURE__ */ C(
813
+ "div",
814
+ {
815
+ className: `${a}-handle ${a}-handle-${f}${v && B.handle === f ? ` ${a}-handle-active` : ""}`,
816
+ "aria-hidden": !0,
817
+ ...L(f),
818
+ onDoubleClick: f.includes("top") || f.includes("bottom") ? (D) => le(D, l) : void 0
819
+ },
820
+ f
821
+ )) : null
822
+ ] })
823
+ ]
824
+ },
825
+ l
826
+ );
827
+ }, bt = M.grid.beat || tt(M.grid), Bt = b ? /* @__PURE__ */ V(
828
+ "div",
829
+ {
830
+ ref: nt,
831
+ "data-selection": "none",
832
+ className: [`${a}-overlay`, `${a}-transition-${ct.replace(" ", "-")}`, o ? `${a}-overlay-editor` : "", R ? `${a}-overlay-active` : ""].filter(Boolean).join(" "),
833
+ style: { ...ee, ...Nt },
834
+ "aria-hidden": !R,
835
+ children: [
836
+ /* @__PURE__ */ C(
837
+ "button",
838
+ {
839
+ type: "button",
840
+ className: `${a}-backdrop`,
841
+ "aria-label": "Close menu",
842
+ tabIndex: -1,
843
+ onClick: y ? void 0 : Lt
844
+ }
845
+ ),
846
+ /* @__PURE__ */ C(
847
+ "div",
848
+ {
849
+ ref: zt,
850
+ className: `${a}-card`,
851
+ role: "dialog",
852
+ "aria-modal": "true",
853
+ "aria-label": t.triggerLabel || "Menu",
854
+ onClick: ce,
855
+ style: {
856
+ top: _(t.popupOffsetTop),
857
+ height: `${Yt(t)}%`,
858
+ left: Zt,
859
+ width: st,
860
+ borderRadius: _(t.popupRadius)
861
+ },
862
+ children: /* @__PURE__ */ V(
863
+ "div",
864
+ {
865
+ ref: ft,
866
+ className: `${a}-grid${W ? ` ${a}-grid-editable` : ""}`,
867
+ style: gt,
868
+ children: [
869
+ e.map(se),
870
+ W ? /* @__PURE__ */ C(
871
+ "div",
872
+ {
873
+ className: `${a}-guides${bt > 0 ? ` ${a}-guides-beats` : ""}${B ? ` ${a}-guides-shown` : ""}`,
874
+ style: {
875
+ gridTemplateColumns: gt.gridTemplateColumns,
876
+ columnGap: gt.columnGap,
877
+ [`--${a}-beat`]: bt > 0 ? _(bt) : void 0
878
+ },
879
+ "aria-hidden": !0,
880
+ children: Array.from({ length: F }, (i, l) => /* @__PURE__ */ C("div", { className: `${a}-guide` }, l))
881
+ }
882
+ ) : null
883
+ ]
884
+ }
885
+ )
886
+ }
887
+ )
888
+ ]
889
+ }
890
+ ) : null;
891
+ return /* @__PURE__ */ V("div", { ref: Tt, className: `${a}-root`, style: Nt, "data-edit-mode": n ? "" : void 0, children: [
892
+ /* @__PURE__ */ C("style", { dangerouslySetInnerHTML: { __html: z } }),
893
+ /* @__PURE__ */ C(
894
+ "button",
895
+ {
896
+ type: "button",
897
+ className: `${a}-button${I ? ` ${a}-button-open` : ""}`,
898
+ style: {
899
+ ...Y === "text" ? Qt : void 0,
900
+ padding: [ot.top, ot.right, ot.bottom, ot.left].map((i) => _(i)).join(" "),
901
+ [`--${a}-icon-size`]: _(t.triggerIconSize ?? We)
902
+ },
903
+ "aria-expanded": I,
904
+ "aria-label": Y === "text" ? void 0 : St,
905
+ onClick: y ? void 0 : () => h((i) => !i),
906
+ children: Y === "text" ? St : /* @__PURE__ */ C("span", { className: `${a}-icon ${a}-icon-${Y}`, "aria-hidden": !0, children: Y === "image" ? /* @__PURE__ */ C(
907
+ fe,
908
+ {
909
+ url: t.triggerIcon,
910
+ fill: `var(--${a}-trigger-color)`,
911
+ hoverFill: `var(--${a}-trigger-color)`,
912
+ className: `${a}-icon-picture`
913
+ }
914
+ ) : Array.from({ length: Y === "burger" ? 3 : 2 }, (i, l) => /* @__PURE__ */ C("span", { className: `${a}-icon-line` }, l)) })
915
+ }
916
+ ),
917
+ Bt && typeof document < "u" ? he(Bt, (c ? document.getElementById(c) : null) ?? document.body) : null
918
+ ] });
919
+ }
920
+ function qe({ prefix: t, images: e, isRunning: o, radius: n }) {
921
+ const [r, u] = Z(0), c = e.length;
922
+ return H(() => {
923
+ if (!o || c < 2) {
924
+ u(0);
925
+ return;
926
+ }
927
+ const s = window.setInterval(() => u((d) => (d + 1) % c), Le);
928
+ return () => window.clearInterval(s);
929
+ }, [o, c]), /* @__PURE__ */ C("div", { className: `${t}-images`, children: e.map((s, d) => /* @__PURE__ */ C(
930
+ "img",
931
+ {
932
+ className: `${t}-image${d === r % c ? "" : ` ${t}-image-hidden`}`,
933
+ src: s.assetId,
934
+ alt: s.name ?? "",
935
+ "aria-hidden": d !== r % c,
936
+ style: { borderRadius: n }
937
+ },
938
+ d
939
+ )) });
940
+ }
941
+ const io = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
942
+ __proto__: null,
943
+ POPUP_MENU_TRANSITIONS: qt,
944
+ POPUP_MENU_TRIGGER_TYPES: Fe,
945
+ PopupMenu: Xe
946
+ }, Symbol.toStringTag, { value: "Module" }));
947
+ export {
948
+ be as D,
949
+ ve as P,
950
+ K as a,
951
+ lt as b,
952
+ ye as c,
953
+ Yt as d,
954
+ Me as e,
955
+ Ae as f,
956
+ Ie as g,
957
+ we as h,
958
+ _e as i,
959
+ ke as j,
960
+ xe as k,
961
+ Ut as l,
962
+ Se as m,
963
+ ro as n,
964
+ Ce as o,
965
+ $e as p,
966
+ qt as q,
967
+ Ne as r,
968
+ Te as s,
969
+ Fe as t,
970
+ Xe as u,
971
+ io as v
972
+ };