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

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