@cntrl-site/components 1.0.107-alpha.2 → 1.0.107-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,746 @@
1
+ import { jsx as s, jsxs as x, Fragment as Be } from "react/jsx-runtime";
2
+ import { useRef as A, useState as f, useMemo as Ne, useEffect as $, useCallback as Ct, useLayoutEffect as Te, Fragment as bt } from "react";
3
+ import { createPortal as xt } from "react-dom";
4
+ import C from "classnames";
5
+ import { s as Lt } from "./scalingValue-C9JH5L6O.mjs";
6
+ import { b as At } from "./buildColorVars-CLyWQm5K.mjs";
7
+ import { u as _t } from "./useScopedStyles-DhBG3557.mjs";
8
+ import { R as It } from "./RichTextRenderer-BptwNpbJ.mjs";
9
+ import { o as Oe, t as Fe } from "./textStylesToCss-05Mn6I_2.mjs";
10
+ import { u as Rt } from "./useLightboxScrollLock-VQ07s7EJ.mjs";
11
+ const St = 1, De = 2, Et = 5, Mt = ["title2", "title3", "title4"], B = ["column1Width", "column2Width", "column3Width", "column4Width"], ee = {
12
+ center: { x: "50%", y: "50%" },
13
+ "left-top": { x: "0%", y: "0%" },
14
+ "top-center": { x: "50%", y: "0%" },
15
+ "top-right": { x: "100%", y: "0%" },
16
+ "left-center": { x: "0%", y: "50%" },
17
+ "right-center": { x: "100%", y: "50%" },
18
+ "left-bottom": { x: "0%", y: "100%" },
19
+ "bottom-center": { x: "50%", y: "100%" },
20
+ "right-bottom": { x: "100%", y: "100%" }
21
+ }, no = Object.keys(ee), Nt = ["column1", "column2", "column3", "column4", "column5"], Tt = {
22
+ triggerColor: "trigger-color",
23
+ triggerHoverColor: "trigger-hover-color",
24
+ closeColor: "close-color",
25
+ closeHoverColor: "close-hover-color",
26
+ panelColor: "panel-color",
27
+ textColor: "text-color",
28
+ textHoverColor: "text-hover-color",
29
+ overlayColor: "overlay-color"
30
+ }, Ot = ["hover", "open"], F = 300, Ve = 4e-3, He = 4e-3, Ft = 20, We = 0.0139, ke = 0.3194, Ge = { top: 972e-5, right: 972e-5, bottom: 972e-5, left: 972e-5 }, je = 300, Ht = 1e3, Ut = [
31
+ "--cntrl-article-width",
32
+ "--cntrl-article-top",
33
+ "--cntrl-article-left",
34
+ "--cntrl-viewport-height"
35
+ ];
36
+ function D(e) {
37
+ return Math.min(Math.max(Math.round(e ?? De), St), Et);
38
+ }
39
+ function Ke(e) {
40
+ const { panelWidth: o = ke, panelPadding: n = Ge, columnGap: i = We } = e, a = (D(e.columns) - 1) * i;
41
+ return Math.max(0, o - n.left - n.right - a);
42
+ }
43
+ function zt(e) {
44
+ const o = D(e.columns), n = Ke(e) / o;
45
+ return Object.fromEntries(B.slice(0, o - 1).map((i) => [i, n]));
46
+ }
47
+ function Bt(e) {
48
+ const o = D(e.columns), n = Ke(e), i = B.slice(0, o - 1).map((p) => {
49
+ const d = e[p];
50
+ return typeof d == "number" ? Math.max(0, d) : n / o;
51
+ }), a = i.reduce((p, d) => p + d, 0), c = a > n ? n / a : 1;
52
+ return [...i.map((p) => p * c), Math.max(0, n - a * c)];
53
+ }
54
+ function ro(e, o) {
55
+ return typeof e.columns != "number" || e.columns === o.columns ? e : { ...e, ...zt({ ...o, ...e }) };
56
+ }
57
+ function Dt(e) {
58
+ const o = e.reduce((n, i) => n + i, 0);
59
+ return e.map((n) => `minmax(0, ${o > 0 ? n / o * 100 : 1}fr)`).join(" ");
60
+ }
61
+ function Vt(e) {
62
+ const o = [];
63
+ return e.forEach((n, i) => {
64
+ var u;
65
+ const a = ((u = n.group) == null ? void 0 : u.trim()) ?? "", c = o[o.length - 1];
66
+ if (!c || a !== "" && a !== c.label) {
67
+ o.push({ label: a, rows: [{ item: n, index: i }] });
68
+ return;
69
+ }
70
+ c.rows.push({ item: n, index: i });
71
+ }), o;
72
+ }
73
+ function z(e) {
74
+ const { image: o } = e ?? {};
75
+ return (Array.isArray(o) ? o : o ? [o] : []).filter((n) => !!(n != null && n.assetId));
76
+ }
77
+ function Xe(e) {
78
+ return e.type === "video" ? !0 : e.type === "image" ? !1 : /\.(mp4|webm|ogg|mov)(\?|$)/i.test(e.name ?? "") || /\.(mp4|webm|ogg|mov)(\?|$)/i.test(e.assetId);
79
+ }
80
+ function Wt(e) {
81
+ let o = e;
82
+ for (; o; ) {
83
+ if (getComputedStyle(o).getPropertyValue("--cntrl-article-width").trim())
84
+ return o;
85
+ o = o.parentElement;
86
+ }
87
+ return e;
88
+ }
89
+ function Ue(e) {
90
+ const o = {}, n = Wt(e);
91
+ if (!n) return o;
92
+ const i = getComputedStyle(n);
93
+ for (const a of Ut) {
94
+ const c = i.getPropertyValue(a).trim();
95
+ c && (o[a] = c);
96
+ }
97
+ return o;
98
+ }
99
+ function ze(e, o, n) {
100
+ const i = e, a = (u) => i[`${o}${u}`] ?? (n ? i[`${n}${u}`] : void 0), c = a("FontSettings");
101
+ return {
102
+ fontSettings: {
103
+ fontFamily: a("FontFamily"),
104
+ fontWeight: (c == null ? void 0 : c.fontWeight) ?? 400,
105
+ fontStyle: (c == null ? void 0 : c.fontStyle) ?? "normal"
106
+ },
107
+ fontSize: a("FontSize") ?? 0.01,
108
+ lineHeight: a("LineHeight"),
109
+ letterSpacing: a("LetterSpacing") ?? 0,
110
+ wordSpacing: a("WordSpacing") ?? 0,
111
+ textAlign: a("TextAlign"),
112
+ textAppearance: a("TextAppearance"),
113
+ color: "#000000"
114
+ };
115
+ }
116
+ function kt(e) {
117
+ return `
118
+ .${e}-trigger,
119
+ .${e}-close {
120
+ display: inline-block;
121
+ margin: 0;
122
+ padding: 0;
123
+ border: 0;
124
+ background: none;
125
+ cursor: pointer;
126
+ white-space: nowrap;
127
+ transition: color 150ms ease;
128
+ -webkit-appearance: none;
129
+ appearance: none;
130
+ -webkit-tap-highlight-color: transparent;
131
+ }
132
+ .${e}-trigger {
133
+ color: var(--${e}-trigger-color);
134
+ transition: color 150ms ease, opacity ${F}ms ease;
135
+ }
136
+ .${e}-trigger-hidden {
137
+ opacity: 0;
138
+ }
139
+ .${e}-close {
140
+ color: var(--${e}-close-color);
141
+ }
142
+ .${e}-trigger:focus,
143
+ .${e}-close:focus {
144
+ outline: none;
145
+ }
146
+ .${e}-trigger:focus-visible,
147
+ .${e}-close:focus-visible {
148
+ outline: 1px solid currentColor;
149
+ outline-offset: 2px;
150
+ }
151
+ .${e}-interactive .${e}-trigger:hover,
152
+ .${e}-state-hover .${e}-trigger {
153
+ color: var(--${e}-trigger-hover-color, var(--${e}-trigger-color));
154
+ }
155
+ .${e}-close:hover {
156
+ color: var(--${e}-close-hover-color, var(--${e}-close-color));
157
+ }
158
+ .${e}-editor .${e}-trigger {
159
+ cursor: default;
160
+ }
161
+ .${e}-overlay {
162
+ position: fixed;
163
+ inset: 0;
164
+ z-index: 9997;
165
+ overflow: hidden;
166
+ overscroll-behavior: none;
167
+ opacity: 0;
168
+ pointer-events: none;
169
+ transition: opacity ${F}ms ease;
170
+ }
171
+ .${e}-inline-layer {
172
+ position: fixed;
173
+ inset: 0;
174
+ z-index: 9997;
175
+ overflow: hidden;
176
+ pointer-events: none;
177
+ }
178
+ .${e}-overlay-editor {
179
+ inset: auto;
180
+ top: var(--cntrl-article-top, 0);
181
+ left: var(--cntrl-article-left, 0);
182
+ width: var(--cntrl-article-width, 100vw) !important;
183
+ height: var(--cntrl-viewport-height, 100vh) !important;
184
+ }
185
+ .${e}-overlay-edit-mode {
186
+ z-index: 1;
187
+ }
188
+ .${e}-overlay-active {
189
+ opacity: 1;
190
+ pointer-events: auto;
191
+ }
192
+ .${e}-backdrop {
193
+ position: absolute;
194
+ inset: 0;
195
+ background-color: var(--${e}-overlay-color);
196
+ }
197
+ .${e}-media-layer {
198
+ position: absolute;
199
+ inset: 0;
200
+ pointer-events: none;
201
+ }
202
+ .${e}-media {
203
+ position: absolute;
204
+ inset: 0;
205
+ width: 100%;
206
+ height: 100%;
207
+ object-fit: cover;
208
+ opacity: 0;
209
+ transition: opacity ${je}ms cubic-bezier(0, 0, 0.58, 1);
210
+ }
211
+ .${e}-media-contain {
212
+ object-fit: contain;
213
+ }
214
+ .${e}-media-visible {
215
+ opacity: 1;
216
+ }
217
+ .${e}-close {
218
+ position: absolute;
219
+ z-index: 2;
220
+ }
221
+ .${e}-panel {
222
+ position: absolute;
223
+ top: var(--${e}-panel-y);
224
+ left: var(--${e}-panel-x);
225
+ z-index: 1;
226
+ box-sizing: border-box;
227
+ max-width: 100%;
228
+ max-height: 100%;
229
+ overflow-y: auto;
230
+ transform: translate(calc(-1 * var(--${e}-panel-x)), calc(-1 * var(--${e}-panel-y) + 12px));
231
+ background-color: var(--${e}-panel-color);
232
+ color: var(--${e}-text-color);
233
+ overscroll-behavior: contain;
234
+ transition: transform ${F}ms cubic-bezier(0, 0, 0.58, 1);
235
+ }
236
+ .${e}-overlay-active .${e}-panel {
237
+ transform: translate(calc(-1 * var(--${e}-panel-x)), calc(-1 * var(--${e}-panel-y)));
238
+ }
239
+ .${e}-panel-settled {
240
+ transition: none;
241
+ }
242
+ .${e}-panel-inline {
243
+ position: relative;
244
+ top: auto;
245
+ left: auto;
246
+ max-height: none;
247
+ transform: none;
248
+ transition: none;
249
+ }
250
+ .${e}-media-layer-instant .${e}-media {
251
+ transition: none;
252
+ }
253
+ .${e}-panel-copy {
254
+ position: absolute;
255
+ pointer-events: none;
256
+ }
257
+ .${e}-panel-copy .${e}-row-active .${e}-title {
258
+ color: var(--${e}-text-hover-color, var(--${e}-text-color));
259
+ }
260
+ @media (prefers-reduced-motion: reduce) {
261
+ .${e}-panel {
262
+ transition: none;
263
+ }
264
+ }
265
+ .${e}-group ~ .${e}-group {
266
+ margin-top: var(--${e}-group-gap);
267
+ }
268
+ .${e}-group {
269
+ display: grid;
270
+ grid-template-columns: var(--${e}-grid-columns);
271
+ column-gap: var(--${e}-column-gap);
272
+ }
273
+ .${e}-row {
274
+ grid-column: 2 / -1;
275
+ display: grid;
276
+ grid-template-columns: subgrid;
277
+ align-items: baseline;
278
+ }
279
+ .${e}-group-unlabeled .${e}-row {
280
+ grid-column: 1 / -1;
281
+ }
282
+ .${e}-group-label {
283
+ grid-column: 1;
284
+ align-self: start;
285
+ min-width: 0;
286
+ overflow-wrap: anywhere;
287
+ }
288
+ .${e}-title {
289
+ min-width: 0;
290
+ overflow-wrap: anywhere;
291
+ transition: color 150ms cubic-bezier(0, 0, 0.58, 1);
292
+ }
293
+ .${e}-control-anchor {
294
+ position: absolute;
295
+ pointer-events: none;
296
+ z-index: 2;
297
+ }
298
+ .${e}-title a {
299
+ text-decoration: inherit;
300
+ }
301
+ .${e}-interactive .${e}-row:hover .${e}-title,
302
+ .${e}-row:focus-within .${e}-title,
303
+ .${e}-state-hover .${e}-row:first-of-type .${e}-title {
304
+ color: var(--${e}-text-hover-color, var(--${e}-text-color));
305
+ }
306
+ `;
307
+ }
308
+ function Gt({
309
+ P: e,
310
+ media: o,
311
+ isVisible: n
312
+ }) {
313
+ const i = A(null), [a, c] = f(!1), u = Xe(o), p = C(
314
+ `${e}-media`,
315
+ o.objectFit === "contain" && `${e}-media-contain`,
316
+ n && a && `${e}-media-visible`
317
+ );
318
+ return $(() => {
319
+ var r;
320
+ const d = i.current;
321
+ !u || !d || (n ? (r = d.play()) == null || r.catch(() => {
322
+ }) : d.pause());
323
+ }, [u, n]), u ? /* @__PURE__ */ s(
324
+ "video",
325
+ {
326
+ ref: i,
327
+ className: p,
328
+ src: o.assetId,
329
+ muted: !0,
330
+ loop: !0,
331
+ playsInline: !0,
332
+ preload: "auto",
333
+ onLoadedData: () => c(!0)
334
+ }
335
+ ) : /* @__PURE__ */ s(
336
+ "img",
337
+ {
338
+ className: p,
339
+ src: o.assetId,
340
+ alt: "",
341
+ decoding: "async",
342
+ onLoad: () => c(!0)
343
+ }
344
+ );
345
+ }
346
+ function jt(e, o, n, i, a) {
347
+ const c = o[o.length - 1];
348
+ let u = n;
349
+ return o.slice(0, -1).map((p, d) => {
350
+ const r = u + p + i / 2;
351
+ return u += p + i, /* @__PURE__ */ s(
352
+ "div",
353
+ {
354
+ "data-controls": B[d],
355
+ "data-controls-axis": "x",
356
+ "data-controls-variant": "column-width",
357
+ "data-controls-min": String(Ft),
358
+ "data-controls-max-fraction": String(p + c),
359
+ className: `${e}-control-anchor`,
360
+ style: { top: 0, left: a(r - He / 2), width: a(He), height: "100%" }
361
+ },
362
+ B[d]
363
+ );
364
+ });
365
+ }
366
+ function Kt(e, o, n, i) {
367
+ const a = (c) => i(Math.max(c, Ve));
368
+ return /* @__PURE__ */ x(Be, { children: [
369
+ /* @__PURE__ */ s(
370
+ "div",
371
+ {
372
+ "data-controls": "panelPadding.top",
373
+ "data-controls-axis": "y",
374
+ "data-controls-variant": "row-padding",
375
+ "data-controls-min": "0",
376
+ className: `${e}-control-anchor`,
377
+ style: { top: 0, left: 0, width: "100%", height: a(n.top) }
378
+ }
379
+ ),
380
+ /* @__PURE__ */ s(
381
+ "div",
382
+ {
383
+ "data-controls": "panelPadding.bottom",
384
+ "data-controls-axis": "y",
385
+ "data-controls-variant": "row-padding",
386
+ "data-controls-reverse": "",
387
+ "data-controls-min": "0",
388
+ className: `${e}-control-anchor`,
389
+ style: { bottom: 0, left: 0, width: "100%", height: a(n.bottom) }
390
+ }
391
+ ),
392
+ /* @__PURE__ */ s(
393
+ "div",
394
+ {
395
+ "data-controls": "panelPadding.left",
396
+ "data-controls-axis": "x",
397
+ "data-controls-variant": "column-padding",
398
+ "data-controls-min": "0",
399
+ "data-controls-max-fraction": String(Math.max(0, o - n.right)),
400
+ className: `${e}-control-anchor`,
401
+ style: { top: 0, left: 0, width: a(n.left), height: "100%" }
402
+ }
403
+ ),
404
+ /* @__PURE__ */ s(
405
+ "div",
406
+ {
407
+ "data-controls": "panelPadding.right",
408
+ "data-controls-axis": "x",
409
+ "data-controls-variant": "column-padding",
410
+ "data-controls-reverse": "",
411
+ "data-controls-min": "0",
412
+ "data-controls-max-fraction": String(Math.max(0, o - n.left)),
413
+ className: `${e}-control-anchor`,
414
+ style: { top: 0, right: 0, width: a(n.right), height: "100%" }
415
+ }
416
+ )
417
+ ] });
418
+ }
419
+ function ao({
420
+ settings: e,
421
+ content: o,
422
+ isEditor: n,
423
+ isEditMode: i,
424
+ isPreviewMode: a,
425
+ activeEvent: c,
426
+ portalId: u,
427
+ currentState: p,
428
+ unavailableStates: d
429
+ }) {
430
+ var Ee;
431
+ const { prefix: r } = _t(), {
432
+ type: Ye = "b",
433
+ triggerLabel: te = "Archive",
434
+ closeLabel: qe = "Close",
435
+ columns: Ze = De,
436
+ columnGap: oe = We,
437
+ hoverInterval: ne = Ht,
438
+ panelPosition: Je,
439
+ panelWidth: re = ke,
440
+ panelPadding: _ = Ge,
441
+ panelRadius: Qe = 0,
442
+ groupGap: ae = 0.0139,
443
+ triggerColor: Pe = "#000000",
444
+ triggerHoverColor: et = "#666666",
445
+ closeColor: tt = "#000000",
446
+ closeHoverColor: ot = "#666666",
447
+ panelColor: nt = "#FFFFFF",
448
+ textColor: rt = "#333132",
449
+ textHoverColor: at = "#BBBBBB",
450
+ overlayColor: lt = "#FFFFFFE6"
451
+ } = e, V = o ?? [], W = A(null), k = A(null), G = A(null), le = A(null), ie = A(null), ce = A(null), [it, H] = f(!1), [E, se] = f(!1), [M, ue] = f(!1), [de, pe] = f(!1), [h, I] = f(null), [ct, me] = f(0), [ge, st] = f(() => /* @__PURE__ */ new Set()), [L, ut] = f(null), [fe, he] = f({}), [R, j] = f(null), [dt, ve] = f(!1), N = !!(n && !a), y = !n || !!a, g = Ye === "a", pt = N && p === "open" && !(d != null && d.includes("open")), w = !g && (pt || (y || !!i) && it), v = (t) => Lt(t, n ?? !1), mt = Ne(() => kt(r), [r]), $e = ee[Je] ?? ee.center, K = D(Ze), ye = Bt(e), gt = ["title", ...Mt].slice(0, K - 1), T = K > 1, ft = Ne(() => T ? Vt(o ?? []) : [{ label: "", rows: (o ?? []).map((t, l) => ({ item: t, index: l })) }], [o, T]);
452
+ Rt(w && !N), $(() => {
453
+ N && !i && H(!1);
454
+ }, [N, i]), $(() => {
455
+ if (w) {
456
+ he(Ue(W.current)), se(!0);
457
+ return;
458
+ }
459
+ ue(!1), I(null);
460
+ const t = window.setTimeout(() => se(!1), F);
461
+ return () => window.clearTimeout(t);
462
+ }, [w]), $(() => {
463
+ var l;
464
+ if (!w || !E) return;
465
+ (l = G.current) == null || l.getBoundingClientRect();
466
+ const t = requestAnimationFrame(() => ue(!0));
467
+ return () => cancelAnimationFrame(t);
468
+ }, [w, E]), $(() => {
469
+ if (!M) {
470
+ pe(!1);
471
+ return;
472
+ }
473
+ const t = window.setTimeout(() => pe(!0), F);
474
+ return () => window.clearTimeout(t);
475
+ }, [M]);
476
+ const U = Ct(() => {
477
+ const t = k.current, l = G.current;
478
+ if (!t || !l) return;
479
+ const m = t.getBoundingClientRect(), b = l.getBoundingClientRect();
480
+ ut({ top: m.top - b.top, left: m.left - b.left });
481
+ }, []);
482
+ Te(() => {
483
+ if (E)
484
+ return U(), window.addEventListener("resize", U), () => window.removeEventListener("resize", U);
485
+ }, [E, U]), $(() => {
486
+ var l;
487
+ if (!w || !y) return;
488
+ (l = le.current) == null || l.focus({ preventScroll: !0 });
489
+ const t = (m) => {
490
+ m.key === "Escape" && H(!1);
491
+ };
492
+ return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
493
+ }, [w, y]), Te(() => {
494
+ if (!g || h === null) return;
495
+ const t = ie.current, l = ce.current;
496
+ if (!t || !l) return;
497
+ const m = t.getBoundingClientRect(), b = l.getBoundingClientRect();
498
+ j({ top: m.top - b.top, left: m.left - b.left, width: m.width });
499
+ }, [g, h]), $(() => {
500
+ if (h !== null) return;
501
+ const t = window.setTimeout(() => j(null), je);
502
+ return () => window.clearTimeout(t);
503
+ }, [h]);
504
+ const we = R !== null;
505
+ $(() => {
506
+ if (!g || !we) return;
507
+ const t = () => {
508
+ ve(!0), I(null), j(null);
509
+ };
510
+ return document.addEventListener("scroll", t, { capture: !0, passive: !0 }), window.addEventListener("resize", t), () => {
511
+ document.removeEventListener("scroll", t, { capture: !0 }), window.removeEventListener("resize", t);
512
+ };
513
+ }, [g, we]);
514
+ const Ce = () => {
515
+ var t;
516
+ y && (H(!1), (t = k.current) == null || t.focus({ preventScroll: !0 }));
517
+ }, be = y && (g || w);
518
+ $(() => {
519
+ be && (o ?? []).forEach((t) => z(t).forEach((l) => {
520
+ Xe(l) || (new Image().src = l.assetId);
521
+ }));
522
+ }, [be, o]);
523
+ const X = h === null ? 0 : z(V[h]).length;
524
+ $(() => {
525
+ if (X < 2) return;
526
+ const t = window.setInterval(() => {
527
+ me((l) => (l + 1) % X);
528
+ }, Math.max(100, ne));
529
+ return () => window.clearInterval(t);
530
+ }, [h, X, ne]);
531
+ const xe = (t) => {
532
+ if (!y || z(V[t]).length === 0) {
533
+ I(null);
534
+ return;
535
+ }
536
+ st((l) => l.has(t) ? l : new Set(l).add(t)), g && h === null && he(Ue(W.current)), h !== t && me(0), ve(!1), I(t);
537
+ }, Le = (t) => {
538
+ I((l) => l === t ? null : l);
539
+ }, ht = (t) => {
540
+ !y && t.target.closest("a") && t.preventDefault();
541
+ }, Ae = Oe(Fe(ze(e, "trigger"), n)), O = Nt.slice(0, K).map((t) => Oe(Fe(ze(e, t, "list"), n))), _e = O[0].lineHeight, Ie = (Ee = O[1]) == null ? void 0 : Ee.lineHeight, vt = _e !== void 0 && Ie !== void 0 ? `calc((${Ie} - ${_e}) / 2)` : void 0, Y = At(r, {
542
+ triggerColor: Pe,
543
+ triggerHoverColor: et,
544
+ closeColor: tt,
545
+ closeHoverColor: ot,
546
+ panelColor: nt,
547
+ textColor: rt,
548
+ textHoverColor: at,
549
+ overlayColor: lt
550
+ }, Tt, Ot), q = c && c !== "default" ? `${r}-state-${c}` : "", Z = y ? `${r}-interactive` : "", Re = /* @__PURE__ */ s("div", { className: C(`${r}-media-layer`, dt && `${r}-media-layer-instant`), "aria-hidden": "true", children: [...ge].flatMap((t) => z(V[t]).map((l, m) => /* @__PURE__ */ s(
551
+ Gt,
552
+ {
553
+ P: r,
554
+ media: l,
555
+ isVisible: h === t && ct === m
556
+ },
557
+ `${t}-${m}-${l.assetId}`
558
+ ))) }), J = !!i && (g || de), Q = (t) => /* @__PURE__ */ x(
559
+ "div",
560
+ {
561
+ ref: t ? void 0 : ie,
562
+ className: C(
563
+ `${r}-panel`,
564
+ // Only the open and close slide; once open, a new position or size moves the panel straight there.
565
+ M && de && `${r}-panel-settled`,
566
+ g && `${r}-panel-inline`,
567
+ t && `${r}-panel-copy`
568
+ ),
569
+ style: {
570
+ width: v(re),
571
+ paddingTop: v(_.top),
572
+ paddingRight: v(_.right),
573
+ paddingBottom: v(_.bottom),
574
+ paddingLeft: v(_.left),
575
+ borderRadius: v(Qe),
576
+ [`--${r}-group-gap`]: v(ae),
577
+ [`--${r}-panel-x`]: $e.x,
578
+ [`--${r}-panel-y`]: $e.y,
579
+ [`--${r}-grid-columns`]: Dt(ye),
580
+ [`--${r}-column-gap`]: v(oe),
581
+ ...t && R ? { top: R.top, left: R.left, width: R.width } : {}
582
+ },
583
+ "data-lightbox-scrollable": g ? void 0 : "",
584
+ "aria-hidden": t || void 0,
585
+ onMouseLeave: t ? void 0 : () => I(null),
586
+ onClickCapture: t ? void 0 : ht,
587
+ children: [
588
+ !t && J && Kt(r, re, _, v),
589
+ !t && J && jt(r, ye, _.left, oe, v),
590
+ ft.map((l, m) => /* @__PURE__ */ x(bt, { children: [
591
+ !t && J && m > 0 && // Left at its static top, the anchor sits right where the gap above this group starts.
592
+ /* @__PURE__ */ s(
593
+ "div",
594
+ {
595
+ "data-controls": "groupGap",
596
+ "data-controls-paired": "",
597
+ "data-controls-axis": "y",
598
+ "data-controls-reverse": "",
599
+ "data-controls-min": "0",
600
+ className: `${r}-control-anchor`,
601
+ style: { left: 0, width: "100%", height: v(Math.max(ae, Ve)) }
602
+ }
603
+ ),
604
+ /* @__PURE__ */ x(
605
+ "div",
606
+ {
607
+ className: C(`${r}-group`, !T && `${r}-group-unlabeled`),
608
+ style: { gridTemplateRows: `repeat(${l.rows.length}, auto) 1fr` },
609
+ children: [
610
+ T && /* @__PURE__ */ s(
611
+ "span",
612
+ {
613
+ className: `${r}-group-label`,
614
+ style: { ...O[0], gridRow: `1 / span ${l.rows.length + 1}`, marginTop: vt },
615
+ children: l.label
616
+ }
617
+ ),
618
+ l.rows.map(({ item: b, index: S }) => /* @__PURE__ */ x(
619
+ "div",
620
+ {
621
+ className: C(`${r}-row`, t && S === h && `${r}-row-active`),
622
+ ...t ? {} : {
623
+ onMouseEnter: () => xe(S),
624
+ onMouseLeave: () => Le(S),
625
+ onFocus: () => xe(S),
626
+ onBlur: () => Le(S)
627
+ },
628
+ children: [
629
+ !T && /* @__PURE__ */ s("div", { className: `${r}-title`, style: O[0], children: b.group }),
630
+ gt.map((Me, wt) => {
631
+ const P = b[Me];
632
+ return /* @__PURE__ */ s("div", { className: `${r}-title`, style: O[wt + 1], children: Array.isArray(P) ? /* @__PURE__ */ s(It, { content: P }) : P }, Me);
633
+ })
634
+ ]
635
+ },
636
+ S
637
+ ))
638
+ ]
639
+ }
640
+ )
641
+ ] }, m))
642
+ ]
643
+ }
644
+ ), $t = E ? /* @__PURE__ */ x(
645
+ "div",
646
+ {
647
+ ref: G,
648
+ className: C(
649
+ `${r}-overlay`,
650
+ n && `${r}-overlay-editor`,
651
+ i && `${r}-overlay-edit-mode`,
652
+ M && `${r}-overlay-active`,
653
+ Z,
654
+ q
655
+ ),
656
+ style: { ...Y, ...fe },
657
+ role: "dialog",
658
+ "aria-modal": "true",
659
+ "aria-label": te,
660
+ "data-selection": "none",
661
+ children: [
662
+ /* @__PURE__ */ s("div", { className: `${r}-backdrop`, "aria-hidden": "true", onClick: Ce }),
663
+ Re,
664
+ /* @__PURE__ */ s(
665
+ "button",
666
+ {
667
+ ref: le,
668
+ type: "button",
669
+ className: `${r}-close`,
670
+ style: {
671
+ ...Ae,
672
+ top: (L == null ? void 0 : L.top) ?? 0,
673
+ left: (L == null ? void 0 : L.left) ?? 0,
674
+ visibility: L ? "visible" : "hidden"
675
+ },
676
+ onClick: Ce,
677
+ children: qe
678
+ }
679
+ ),
680
+ Q(!1)
681
+ ]
682
+ }
683
+ ) : null, yt = g && ge.size > 0 ? /* @__PURE__ */ x(
684
+ "div",
685
+ {
686
+ ref: ce,
687
+ className: C(`${r}-inline-layer`, n && `${r}-overlay-editor`, Z, q),
688
+ style: { ...Y, ...fe },
689
+ "aria-hidden": "true",
690
+ "data-selection": "none",
691
+ children: [
692
+ Re,
693
+ R && Q(!0)
694
+ ]
695
+ }
696
+ ) : null, Se = $t ?? yt;
697
+ return /* @__PURE__ */ x(Be, { children: [
698
+ /* @__PURE__ */ s("style", { dangerouslySetInnerHTML: { __html: mt } }),
699
+ /* @__PURE__ */ s(
700
+ "div",
701
+ {
702
+ ref: W,
703
+ className: C(N && `${r}-editor`, Z, q),
704
+ style: Y,
705
+ children: g ? Q(!1) : (
706
+ // The overlay lets the page show through, so the label fades out with it rather than sit under the close.
707
+ // Only faded, it keeps the component's size and can still take focus back on close.
708
+ /* @__PURE__ */ s(
709
+ "button",
710
+ {
711
+ ref: k,
712
+ type: "button",
713
+ className: C(`${r}-trigger`, M && `${r}-trigger-hidden`),
714
+ style: Ae,
715
+ "aria-haspopup": "dialog",
716
+ "aria-expanded": w,
717
+ onClick: () => {
718
+ y && H(!0);
719
+ },
720
+ children: te
721
+ }
722
+ )
723
+ )
724
+ }
725
+ ),
726
+ Se && typeof document < "u" && xt(
727
+ Se,
728
+ (u ? document.getElementById(u) : null) ?? document.body
729
+ )
730
+ ] });
731
+ }
732
+ export {
733
+ Nt as ARCHIVE_POPUP_COLUMN_STYLE_PREFIXES,
734
+ B as ARCHIVE_POPUP_COLUMN_WIDTH_KEYS,
735
+ De as ARCHIVE_POPUP_DEFAULT_COLUMNS,
736
+ Mt as ARCHIVE_POPUP_EXTRA_TITLE_KEYS,
737
+ Et as ARCHIVE_POPUP_MAX_COLUMNS,
738
+ St as ARCHIVE_POPUP_MIN_COLUMNS,
739
+ no as ARCHIVE_POPUP_PANEL_POSITIONS,
740
+ ao as ArchivePopup,
741
+ ro as applyArchivePopupColumnCountChange,
742
+ zt as getArchivePopupEqualColumnWidths,
743
+ z as getArchivePopupRowMedia,
744
+ Vt as groupArchiveRows,
745
+ Bt as resolveArchivePopupColumnWidths
746
+ };