@cntrl-site/components 1.0.114 → 1.0.115-alpha.1

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