@cntrl-site/components 1.0.118-alpha.3 → 1.0.118

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,1622 @@
1
+ import { jsxs as y, Fragment as q, jsx as n } from "react/jsx-runtime";
2
+ import { S as mi, a as ui } from "./react-splide.esm-DQqds4PL.mjs";
3
+ /* empty css */
4
+ import { s as p } from "./scalingValue-C9JH5L6O.mjs";
5
+ import { b as hi } from "./buildColorVars-CLyWQm5K.mjs";
6
+ import { u as gi } from "./useScopedStyles-DhBG3557.mjs";
7
+ import { u as Yt } from "./useLazyVideos-CxXyEjRQ.mjs";
8
+ import { L as ht } from "./LinkWrapper-5kQHiGJQ.mjs";
9
+ import { i as Me, g as Kt, E as Zt, a as pi } from "./EmbedMediaFrame-DwHeOAy5.mjs";
10
+ import { useMemo as Gt, useState as I, useRef as $, useEffect as j, useCallback as oe, useLayoutEffect as Et } from "react";
11
+ import { createPortal as fi } from "react-dom";
12
+ import { o as Tt, t as Lt } from "./textStylesToCss-05Mn6I_2.mjs";
13
+ import { S as $i } from "./SvgImage-B5mR9y6q.mjs";
14
+ import { L as Jt } from "./LazyVideo-CdAWymKO.mjs";
15
+ function yi(e) {
16
+ return `calc(var(--cntrl-article-width, 100vw) * ${e / 1440})`;
17
+ }
18
+ function qt(e) {
19
+ return ((e == null ? void 0 : e.trim().length) ?? 0) > 0;
20
+ }
21
+ function _t(e, t, i, s) {
22
+ return t !== void 0 && t < (e ?? 0.01) ? `${i} ${s}` : i;
23
+ }
24
+ function Nt(e, t, i, s) {
25
+ const o = e ?? 0.01;
26
+ return t === void 0 || t >= o ? {} : {
27
+ [`--${i}-title-leading-gap`]: p((o - t) / 2, s)
28
+ };
29
+ }
30
+ const zt = 400, At = "cubic-bezier(0.25, 0.1, 0.25, 1)", vi = 1.1, Qt = "--grid-media-radius";
31
+ function wi(e) {
32
+ return `
33
+ .${e}-wrapper {
34
+ display: grid;
35
+ align-items: start;
36
+ justify-content: center;
37
+ min-height: ${yi(48)};
38
+ }
39
+ .${e}-item {
40
+ display: flex;
41
+ flex-direction: column;
42
+ justify-content: center;
43
+ align-items: center;
44
+ }
45
+ .${e}-item-inner {
46
+ display: flex;
47
+ flex-direction: column;
48
+ align-items: center;
49
+ outline: 1px solid #FF5C02;
50
+ }
51
+ .${e}-item-inner-hidden {
52
+ display: flex;
53
+ flex-direction: column;
54
+ align-items: center;
55
+ }
56
+ .${e}-item-image-wrapper {
57
+ display: flex;
58
+ justify-content: center;
59
+ align-items: center;
60
+ align-self: center;
61
+ }
62
+ .${e}-item-image-wrapper-fit-slider {
63
+ display: grid;
64
+ overflow: hidden;
65
+ position: relative;
66
+ }
67
+ .${e}-item-image-wrapper-fit-slider > .${e}-item-image-wrapper-sizer {
68
+ grid-area: 1 / 1;
69
+ width: 100%;
70
+ display: grid;
71
+ visibility: hidden;
72
+ pointer-events: none;
73
+ }
74
+ .${e}-item-image-wrapper-fit-slider > .${e}-item-image-wrapper-sizer img {
75
+ grid-area: 1 / 1;
76
+ width: auto;
77
+ height: auto;
78
+ max-width: 100%;
79
+ object-fit: contain;
80
+ }
81
+ .${e}-item-image-wrapper-fit-slider > .${e}-item-image-wrapper-sizer video {
82
+ grid-area: 1 / 1;
83
+ width: auto;
84
+ height: auto;
85
+ max-width: 100%;
86
+ object-fit: contain;
87
+ }
88
+ .${e}-item-image-wrapper-fit-slider > .${e}-item-image-wrapper-sizer div {
89
+ grid-area: 1 / 1;
90
+ width: 100%;
91
+ }
92
+ .${e}-item-image-wrapper-fit-slider > .${e}-item-slider {
93
+ position: absolute;
94
+ inset: 0;
95
+ width: 100%;
96
+ overflow: hidden;
97
+ }
98
+ .${e}-item-slider .splide__track {
99
+ overflow: hidden;
100
+ }
101
+ .${e}-item-image-link {
102
+ width: 100%;
103
+ display: flex;
104
+ flex-direction: column;
105
+ align-items: center;
106
+ }
107
+ .${e}-item-text-link {
108
+ display: flex;
109
+ flex-direction: column;
110
+ align-items: center;
111
+ width: 100%;
112
+ color: inherit;
113
+ text-decoration: none;
114
+ }
115
+ .${e}-item-image {
116
+ width: 100%;
117
+ height: 100%;
118
+ display: block;
119
+ max-width: 100%;
120
+ }
121
+ .${e}-item-video {
122
+ width: 100%;
123
+ height: 100%;
124
+ display: block;
125
+ max-width: 100%;
126
+ }
127
+ .${e}-item-slider,
128
+ .${e}-item-slider .splide__track,
129
+ .${e}-item-slider .splide__list,
130
+ .${e}-item-slider .splide__slide {
131
+ width: 100%;
132
+ height: 100%;
133
+ }
134
+ .${e}-item-slider .splide__slide {
135
+ display: flex;
136
+ justify-content: center;
137
+ align-items: center;
138
+ }
139
+ .${e}-item-title {
140
+ white-space: normal;
141
+ overflow-wrap: anywhere;
142
+ word-break: break-word;
143
+ text-align: center;
144
+ margin-bottom: 0px;
145
+ margin-top: 0px;
146
+ color: var(--${e}-title-color);
147
+ }
148
+ .${e}-item-subtitle {
149
+ white-space: normal;
150
+ overflow-wrap: anywhere;
151
+ word-break: break-word;
152
+ text-align: center;
153
+ margin-bottom: 0px;
154
+ margin-top: 0px;
155
+ color: var(--${e}-subtitle-color);
156
+ }
157
+ .${e}-text-tight-leading {
158
+ display: block;
159
+ flex-shrink: 0;
160
+ padding-top: var(--${e}-title-leading-gap, 0);
161
+ padding-bottom: var(--${e}-title-leading-gap, 0);
162
+ }
163
+ .${e}-show-text-hover .${e}-item-title,
164
+ .${e}-show-text-hover .${e}-item-subtitle {
165
+ opacity: 0;
166
+ transition: opacity 250ms;
167
+ }
168
+ .${e}-show-text-hover .${e}-item-inner:hover .${e}-item-title,
169
+ .${e}-show-text-hover .${e}-item-inner:hover .${e}-item-subtitle,
170
+ .${e}-show-text-hover .${e}-item-inner-hidden:hover .${e}-item-title,
171
+ .${e}-show-text-hover .${e}-item-inner-hidden:hover .${e}-item-subtitle {
172
+ opacity: 1;
173
+ }
174
+ @property --${e}-hover-zoom {
175
+ syntax: '<number>';
176
+ inherits: false;
177
+ initial-value: 1;
178
+ }
179
+ .${e}-hover-zoom-in .${e}-item-image,
180
+ .${e}-hover-zoom-in .${e}-item-video {
181
+ transform: scale(var(--${e}-hover-zoom));
182
+ clip-path: inset(calc(50% - 50% / var(--${e}-hover-zoom)) round calc(var(${Qt}, 0px) / var(--${e}-hover-zoom)));
183
+ transition: --${e}-hover-zoom ${zt}ms ${At};
184
+ }
185
+ .${e}-hover-scale-down .${e}-item-image,
186
+ .${e}-hover-scale-down .${e}-item-video {
187
+ transition: transform ${zt}ms ${At};
188
+ }
189
+ .${e}-hover-greyscale .${e}-item-image-wrapper {
190
+ transition: filter ${zt}ms ${At};
191
+ }
192
+ @media (hover: hover) {
193
+ .${e}-hover-zoom-in .${e}-item-image-wrapper:has(.${e}-item-image:hover, .${e}-item-video:hover) :is(.${e}-item-image, .${e}-item-video) {
194
+ --${e}-hover-zoom: ${vi};
195
+ }
196
+ .${e}-hover-scale-down .${e}-item-image-wrapper:hover .${e}-item-image,
197
+ .${e}-hover-scale-down .${e}-item-image-wrapper:hover .${e}-item-video {
198
+ transform: scale(0.9);
199
+ }
200
+ .${e}-hover-greyscale:has(.${e}-item-image:hover, .${e}-item-video:hover) .${e}-item-image-wrapper:not(:has(.${e}-item-image:hover, .${e}-item-video:hover)) {
201
+ filter: grayscale(1);
202
+ }
203
+ }
204
+ .${e}-type-a .${e}-item-inner,
205
+ .${e}-type-a .${e}-item-inner-hidden,
206
+ .${e}-type-d .${e}-item-inner,
207
+ .${e}-type-d .${e}-item-inner-hidden {
208
+ align-items: flex-start;
209
+ }
210
+ .${e}-type-b .${e}-item-inner,
211
+ .${e}-type-b .${e}-item-inner-hidden,
212
+ .${e}-type-e .${e}-item-inner,
213
+ .${e}-type-e .${e}-item-inner-hidden {
214
+ align-items: center;
215
+ }
216
+ .${e}-type-c .${e}-item-inner,
217
+ .${e}-type-c .${e}-item-inner-hidden,
218
+ .${e}-type-f .${e}-item-inner,
219
+ .${e}-type-f .${e}-item-inner-hidden {
220
+ align-items: flex-end;
221
+ }
222
+ .${e}-type-a .${e}-item-image-link,
223
+ .${e}-type-b .${e}-item-image-link,
224
+ .${e}-type-c .${e}-item-image-link,
225
+ .${e}-type-d .${e}-item-image-link,
226
+ .${e}-type-e .${e}-item-image-link,
227
+ .${e}-type-f .${e}-item-image-link {
228
+ align-items: center;
229
+ }
230
+ .${e}-type-a .${e}-item-title,
231
+ .${e}-type-a .${e}-item-subtitle,
232
+ .${e}-type-d .${e}-item-title,
233
+ .${e}-type-d .${e}-item-subtitle {
234
+ text-align: left;
235
+ }
236
+ .${e}-type-b .${e}-item-title,
237
+ .${e}-type-b .${e}-item-subtitle,
238
+ .${e}-type-e .${e}-item-title,
239
+ .${e}-type-e .${e}-item-subtitle {
240
+ text-align: center;
241
+ }
242
+ .${e}-type-c .${e}-item-title,
243
+ .${e}-type-c .${e}-item-subtitle,
244
+ .${e}-type-f .${e}-item-title,
245
+ .${e}-type-f .${e}-item-subtitle {
246
+ text-align: right;
247
+ }
248
+ .${e}-item-text-block {
249
+ display: flex;
250
+ flex-direction: column;
251
+ align-items: flex-start;
252
+ width: 100%;
253
+ flex-shrink: 0;
254
+ }
255
+ .${e}-type-d .${e}-item-text-block {
256
+ align-items: flex-start;
257
+ }
258
+ .${e}-type-e .${e}-item-text-block {
259
+ align-items: center;
260
+ }
261
+ .${e}-type-f .${e}-item-text-block {
262
+ align-items: flex-end;
263
+ }
264
+ .${e}-type-a .${e}-item-text-link,
265
+ .${e}-type-d .${e}-item-text-link {
266
+ align-items: flex-start;
267
+ }
268
+ .${e}-type-b .${e}-item-text-link,
269
+ .${e}-type-e .${e}-item-text-link {
270
+ align-items: center;
271
+ }
272
+ .${e}-type-c .${e}-item-text-link,
273
+ .${e}-type-f .${e}-item-text-link {
274
+ align-items: flex-end;
275
+ }
276
+ .${e}-image-align-top .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
277
+ align-items: flex-start;
278
+ }
279
+ .${e}-image-align-center .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
280
+ align-items: center;
281
+ }
282
+ .${e}-image-align-bottom .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
283
+ align-items: flex-end;
284
+ }
285
+ .${e}-image-align-top .${e}-item-slider .splide__slide {
286
+ align-items: flex-start;
287
+ }
288
+ .${e}-image-align-center .${e}-item-slider .splide__slide {
289
+ align-items: center;
290
+ }
291
+ .${e}-image-align-bottom .${e}-item-slider .splide__slide {
292
+ align-items: flex-end;
293
+ }
294
+ .${e}-align-entries .${e}-item {
295
+ display: contents;
296
+ }
297
+ .${e}-align-entries .${e}-item-inner,
298
+ .${e}-align-entries .${e}-item-inner-hidden {
299
+ display: grid;
300
+ grid-template-rows: subgrid;
301
+ grid-row: span 3;
302
+ justify-self: center;
303
+ margin-bottom: var(--${e}-align-entries-row-gap, 0);
304
+ }
305
+ .${e}-align-entries .${e}-item-inner-last-row {
306
+ margin-bottom: 0;
307
+ }
308
+ .${e}-align-entries .${e}-item-text-link {
309
+ display: contents;
310
+ }
311
+ .${e}-align-entries .${e}-item-title-row,
312
+ .${e}-align-entries .${e}-item-subtitle-row {
313
+ display: flex;
314
+ flex-direction: column;
315
+ align-items: flex-start;
316
+ width: 100%;
317
+ min-height: 100%;
318
+ }
319
+ .${e}-type-a.${e}-align-entries .${e}-item-title-row,
320
+ .${e}-type-a.${e}-align-entries .${e}-item-subtitle-row,
321
+ .${e}-type-d.${e}-align-entries .${e}-item-title-row,
322
+ .${e}-type-d.${e}-align-entries .${e}-item-subtitle-row {
323
+ align-items: flex-start;
324
+ }
325
+ .${e}-type-b.${e}-align-entries .${e}-item-title-row,
326
+ .${e}-type-b.${e}-align-entries .${e}-item-subtitle-row,
327
+ .${e}-type-e.${e}-align-entries .${e}-item-title-row,
328
+ .${e}-type-e.${e}-align-entries .${e}-item-subtitle-row {
329
+ align-items: center;
330
+ }
331
+ .${e}-type-c.${e}-align-entries .${e}-item-title-row,
332
+ .${e}-type-c.${e}-align-entries .${e}-item-subtitle-row,
333
+ .${e}-type-f.${e}-align-entries .${e}-item-title-row,
334
+ .${e}-type-f.${e}-align-entries .${e}-item-subtitle-row {
335
+ align-items: flex-end;
336
+ }
337
+ .${e}-align-entries .${e}-item-image-link {
338
+ width: 100%;
339
+ height: 100%;
340
+ min-height: 100%;
341
+ display: flex;
342
+ flex-direction: column;
343
+ align-items: center;
344
+ justify-content: flex-start;
345
+ }
346
+ .${e}-align-entries .${e}-item-image-link > .${e}-item-image-wrapper {
347
+ flex-shrink: 0;
348
+ height: auto;
349
+ align-self: auto;
350
+ }
351
+ .${e}-image-align-top.${e}-align-entries .${e}-item-image-link > .${e}-item-image-wrapper {
352
+ margin-top: 0;
353
+ margin-bottom: auto;
354
+ }
355
+ .${e}-image-align-center.${e}-align-entries .${e}-item-image-link > .${e}-item-image-wrapper {
356
+ margin-top: auto;
357
+ margin-bottom: auto;
358
+ }
359
+ .${e}-image-align-bottom.${e}-align-entries .${e}-item-image-link > .${e}-item-image-wrapper {
360
+ margin-top: auto;
361
+ margin-bottom: 0;
362
+ }
363
+ .${e}-image-align-top.${e}-align-entries .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
364
+ align-items: flex-start;
365
+ }
366
+ .${e}-image-align-center.${e}-align-entries .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
367
+ align-items: center;
368
+ }
369
+ .${e}-image-align-bottom.${e}-align-entries .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
370
+ align-items: flex-end;
371
+ }
372
+ .${e}-image-align-top.${e}-align-entries .${e}-item-slider .splide__slide {
373
+ align-items: flex-start;
374
+ }
375
+ .${e}-image-align-center.${e}-align-entries .${e}-item-slider .splide__slide {
376
+ align-items: center;
377
+ }
378
+ .${e}-image-align-bottom.${e}-align-entries .${e}-item-slider .splide__slide {
379
+ align-items: flex-end;
380
+ }
381
+ .${e}-image-align-top.${e}-align-entries .${e}-item-image-link {
382
+ justify-content: flex-start;
383
+ }
384
+ .${e}-image-align-center.${e}-align-entries .${e}-item-image-link {
385
+ justify-content: center;
386
+ }
387
+ .${e}-image-align-bottom.${e}-align-entries .${e}-item-image-link {
388
+ justify-content: flex-end;
389
+ }
390
+ .${e}-lightbox-counter {
391
+ margin: 0;
392
+ color: var(--${e}-lightbox-counter-color);
393
+ }
394
+ .${e}-lightbox {
395
+ position: fixed;
396
+ inset: 0;
397
+ z-index: 9997;
398
+ overscroll-behavior: none;
399
+ overflow: hidden;
400
+ }
401
+ .${e}-lightbox-editor {
402
+ inset: auto;
403
+ top: var(--cntrl-article-top, 0);
404
+ left: var(--cntrl-article-left, 0);
405
+ width: var(--cntrl-article-width, 100vw) !important;
406
+ height: var(--cntrl-viewport-height, 100vh) !important;
407
+ }
408
+ .${e}-control {
409
+ position: relative;
410
+ z-index: 2;
411
+ width: 100%;
412
+ }
413
+ .${e}-close-icon {
414
+ position: relative;
415
+ flex-shrink: 0;
416
+ pointer-events: auto;
417
+ z-index: 2;
418
+ display: flex;
419
+ align-items: center;
420
+ justify-content: center;
421
+ border: none;
422
+ background-color: transparent;
423
+ padding: 0;
424
+ }
425
+ .${e}-close-icon-inner {
426
+ all: unset;
427
+ position: relative;
428
+ cursor: pointer;
429
+ width: 100%;
430
+ height: 100%;
431
+ pointer-events: auto;
432
+ }
433
+ .${e}-close-icon-img {
434
+ position: absolute;
435
+ top: 50%;
436
+ left: 50%;
437
+ transform: translate(-50%, -50%);
438
+ }
439
+ `;
440
+ }
441
+ function xi() {
442
+ return Math.random() < 0.5 ? "ltr" : "ttb";
443
+ }
444
+ function bi(e) {
445
+ const t = e.Components.Autoplay;
446
+ t && (t.pause(!1), t.play());
447
+ }
448
+ function Si(e) {
449
+ const t = xi();
450
+ e.options.direction !== t && (e.options = { ...e.options, direction: t }), requestAnimationFrame(() => {
451
+ requestAnimationFrame(() => {
452
+ bi(e);
453
+ });
454
+ });
455
+ }
456
+ const E = 500, Ii = 750, me = "cubic-bezier(0.22, 1, 0.36, 1)", Ci = 72, ki = 50;
457
+ function Ti(e) {
458
+ if (!Array.isArray(e) || e.length === 0) return !1;
459
+ const t = e[0];
460
+ return t !== null && typeof t == "object" && "media" in t && Array.isArray(t.media);
461
+ }
462
+ function Li(e) {
463
+ const [t, i] = e.media;
464
+ return i != null && i.assetId ? i : t != null && t.assetId ? t : null;
465
+ }
466
+ function _i(e) {
467
+ const [t] = e.media;
468
+ return t != null && t.assetId ? t : null;
469
+ }
470
+ function Pt(e) {
471
+ return !Array.isArray(e) || e.length === 0 ? [] : Ti(e) ? e.flatMap((t) => {
472
+ const i = Li(t);
473
+ if (!i) return [];
474
+ const s = _i(t);
475
+ return [{
476
+ displayMedia: i,
477
+ lightboxMedia: s != null && s.assetId ? s : null
478
+ }];
479
+ }) : e.filter((t) => t == null ? void 0 : t.assetId).map((t) => ({
480
+ displayMedia: t,
481
+ lightboxMedia: t
482
+ }));
483
+ }
484
+ function Se(e) {
485
+ return !Me(e) && e.type === "video";
486
+ }
487
+ function Ni(e) {
488
+ const t = /* @__PURE__ */ new Set(), i = [];
489
+ for (const s of e) {
490
+ const o = Pt(s.gallery);
491
+ for (const w of o) {
492
+ const v = w.lightboxMedia;
493
+ v != null && v.assetId && !t.has(v.assetId) && (t.add(v.assetId), i.push(v));
494
+ }
495
+ }
496
+ return i;
497
+ }
498
+ function zi({ mediaList: e }) {
499
+ const [t, i] = I(null);
500
+ Yt(t, { preload: "metadata" });
501
+ const s = e.filter((o) => !Me(o));
502
+ return s.length === 0 ? null : /* @__PURE__ */ n(
503
+ "div",
504
+ {
505
+ ref: i,
506
+ "aria-hidden": !0,
507
+ style: {
508
+ position: "absolute",
509
+ width: 0,
510
+ height: 0,
511
+ overflow: "hidden",
512
+ opacity: 0,
513
+ pointerEvents: "none"
514
+ },
515
+ children: s.map((o) => Se(o) ? /* @__PURE__ */ n(
516
+ "video",
517
+ {
518
+ src: o.assetId,
519
+ preload: "none",
520
+ muted: !0,
521
+ playsInline: !0
522
+ },
523
+ o.assetId
524
+ ) : /* @__PURE__ */ n(
525
+ "img",
526
+ {
527
+ src: o.assetId,
528
+ alt: ""
529
+ },
530
+ o.assetId
531
+ ))
532
+ }
533
+ );
534
+ }
535
+ function Ai(e) {
536
+ e.pause(), e.removeAttribute("src"), e.load();
537
+ }
538
+ const Oi = ".splide__slide video";
539
+ function Fi(e) {
540
+ var o;
541
+ if (e.closest(".splide--fade, .splide__slide.is-active:not(.splide__slide--clone), .splide__slide.is-next")) return !0;
542
+ const t = e.closest(".splide__slide");
543
+ if (!t || t.classList.contains("splide__slide--clone")) return !1;
544
+ const i = t.dataset.slideIndex, s = (o = t.parentElement) == null ? void 0 : o.querySelector(".splide__slide.is-next");
545
+ return i !== void 0 && (s == null ? void 0 : s.dataset.slideIndex) === i;
546
+ }
547
+ function Xt({
548
+ media: e,
549
+ className: t,
550
+ style: i,
551
+ hasLightbox: s,
552
+ isSplideSlide: o = !1,
553
+ onMediaClick: w
554
+ }) {
555
+ if (Me(e))
556
+ return /* @__PURE__ */ n(
557
+ Zt,
558
+ {
559
+ media: e,
560
+ fit: i.objectFit === "contain" ? "contain" : "cover",
561
+ silentLoop: s,
562
+ className: t,
563
+ style: {
564
+ ...i,
565
+ cursor: w ? "pointer" : "default"
566
+ },
567
+ onClick: w
568
+ }
569
+ );
570
+ if (Se(e)) {
571
+ const v = {
572
+ src: e.assetId,
573
+ className: t,
574
+ style: {
575
+ ...i,
576
+ cursor: w ? "pointer" : "default"
577
+ },
578
+ muted: !0,
579
+ loop: !0,
580
+ playsInline: !0,
581
+ onClick: w
582
+ };
583
+ return o ? /* @__PURE__ */ n("video", { ...v, preload: "none" }) : /* @__PURE__ */ n(Jt, { ...v, autoPlay: !0 });
584
+ }
585
+ return /* @__PURE__ */ n(
586
+ "img",
587
+ {
588
+ src: e.assetId,
589
+ alt: e.name,
590
+ className: t,
591
+ style: {
592
+ ...i,
593
+ cursor: w ? "pointer" : "default"
594
+ },
595
+ onClick: w
596
+ }
597
+ );
598
+ }
599
+ function Wi({
600
+ className: e,
601
+ style: t,
602
+ children: i
603
+ }) {
604
+ const [s, o] = I(null);
605
+ return Yt(s, { autoPlay: !0, selector: Oi, shouldPlay: Fi }), /* @__PURE__ */ n("div", { ref: o, className: e, style: t, children: i });
606
+ }
607
+ function Ut(e) {
608
+ const t = e.getBoundingClientRect();
609
+ return { width: t.width, height: t.height, left: t.left, top: t.top };
610
+ }
611
+ function Mi(e, t) {
612
+ if (!t || !t.width || !t.height || !e.width || !e.height) return e;
613
+ const i = t.width / t.height, s = e.width / e.height;
614
+ if (i > s) {
615
+ const w = e.width / i;
616
+ return { width: e.width, height: w, left: e.left, top: e.top + (e.height - w) / 2 };
617
+ }
618
+ const o = e.height * i;
619
+ return { width: o, height: e.height, left: e.left + (e.width - o) / 2, top: e.top };
620
+ }
621
+ function Ri({
622
+ src: e,
623
+ mediaRef: t,
624
+ mediaStyle: i,
625
+ onLoadedMetadata: s
626
+ }) {
627
+ return j(() => {
628
+ const o = t.current;
629
+ if (o)
630
+ return () => {
631
+ Ai(o);
632
+ };
633
+ }, [e, t]), /* @__PURE__ */ n(
634
+ "video",
635
+ {
636
+ ref: t,
637
+ src: e,
638
+ muted: !0,
639
+ autoPlay: !0,
640
+ loop: !0,
641
+ playsInline: !0,
642
+ preload: "auto",
643
+ onLoadedMetadata: s,
644
+ style: i
645
+ }
646
+ );
647
+ }
648
+ const Di = "https://cdn.cntrl.site/component-assets/defaultCloseIcon.svg", ji = 4e-3;
649
+ function Hi({
650
+ prefix: e,
651
+ closeIcon: t = Di,
652
+ closeIconMaxWidth: i = 0.0125,
653
+ closeIconColor: s = "#FFFFFF",
654
+ closeIconHoverColor: o = "#999999",
655
+ iconMarginRight: w = 0.01,
656
+ contentMarginTop: v = 0.01,
657
+ isEditor: X,
658
+ isPreviewMode: ue,
659
+ isEditMode: r,
660
+ visible: R,
661
+ onClose: P
662
+ }) {
663
+ if (!t) return null;
664
+ const ee = p(i, X), he = p(w, X), Ie = p(v, X), C = p(Math.max(v, ji), X);
665
+ return /* @__PURE__ */ y(
666
+ "div",
667
+ {
668
+ style: {
669
+ position: "absolute",
670
+ top: 0,
671
+ left: 0,
672
+ right: 0,
673
+ zIndex: 1e4,
674
+ display: "flex",
675
+ flexDirection: "column",
676
+ alignItems: "flex-end",
677
+ pointerEvents: "none",
678
+ opacity: R ? 1 : 0,
679
+ transition: "opacity 500ms cubic-bezier(0.22, 1, 0.36, 1)"
680
+ },
681
+ children: [
682
+ /* @__PURE__ */ n(
683
+ "div",
684
+ {
685
+ style: {
686
+ position: "relative",
687
+ width: "100%",
688
+ height: Ie,
689
+ flexShrink: 0
690
+ },
691
+ children: r && /* @__PURE__ */ n(
692
+ "div",
693
+ {
694
+ "data-controls": "contentMarginTop",
695
+ "data-controls-axis": "y",
696
+ "data-controls-min": "0",
697
+ className: `${e}-control`,
698
+ style: {
699
+ position: "absolute",
700
+ top: 0,
701
+ left: 0,
702
+ width: "100%",
703
+ height: C,
704
+ pointerEvents: R ? "auto" : "none"
705
+ }
706
+ }
707
+ )
708
+ }
709
+ ),
710
+ /* @__PURE__ */ y(
711
+ "div",
712
+ {
713
+ className: `${e}-close-icon`,
714
+ style: {
715
+ width: ee,
716
+ height: ee,
717
+ marginRight: he,
718
+ pointerEvents: R ? "auto" : "none"
719
+ },
720
+ onClick: (k) => k.stopPropagation(),
721
+ children: [
722
+ /* @__PURE__ */ n(
723
+ "button",
724
+ {
725
+ type: "button",
726
+ className: `${e}-close-icon-inner`,
727
+ "aria-label": "Close",
728
+ onClick: (k) => {
729
+ k.stopPropagation(), P();
730
+ },
731
+ children: /* @__PURE__ */ n(
732
+ $i,
733
+ {
734
+ url: t,
735
+ fill: s,
736
+ hoverFill: X && !ue ? s : o,
737
+ className: `${e}-close-icon-img`
738
+ }
739
+ )
740
+ }
741
+ ),
742
+ r && /* @__PURE__ */ n(
743
+ "div",
744
+ {
745
+ "data-controls": "iconMarginRight",
746
+ "data-controls-axis": "x",
747
+ "data-controls-reverse": "",
748
+ className: `${e}-control`,
749
+ style: {
750
+ position: "absolute",
751
+ top: 0,
752
+ left: "100%",
753
+ width: he,
754
+ height: "100%",
755
+ pointerEvents: R ? "auto" : "none"
756
+ }
757
+ }
758
+ )
759
+ ]
760
+ }
761
+ )
762
+ ]
763
+ }
764
+ );
765
+ }
766
+ function Vi({
767
+ prefix: e,
768
+ items: t,
769
+ index: i,
770
+ imageDisplay: s,
771
+ isEditor: o,
772
+ isPreviewMode: w,
773
+ isEditMode: v,
774
+ onClose: X,
775
+ onPrev: ue,
776
+ onNext: r,
777
+ counterClassName: R,
778
+ counterStyle: P,
779
+ closeIcon: ee,
780
+ closeIconMaxWidth: he,
781
+ closeIconColor: Ie,
782
+ closeIconHoverColor: C,
783
+ iconMarginRight: k,
784
+ contentMarginTop: Ze
785
+ }) {
786
+ const Ce = s === "cover", Re = $(null), ge = $(null), pe = $(null), z = $(null), U = $(0), A = $(0), O = $("none"), Y = $(!1), te = $(!1), Je = $(null), _ = $(0), H = $(null), F = $(!1), le = $(null), K = $(null), De = $(null), Qe = $(() => {
787
+ }), [m, je] = I(null), [a, gt] = I(null), [b, ke] = I("opening"), [ie, V] = I(0), [fe, B] = I(0), [He, se] = I(null), [Ve, $e] = I(!1), [Te, ye] = I(!1), [pt, Pe] = I(!1), [ft, et] = I(null), Be = $(i), tt = $(void 0), c = t[i], $t = c ? Se(c) : !1, it = c ? Me(c) : !1, Le = He !== null, nt = oe((l) => {
788
+ const d = l.currentTarget, L = d instanceof HTMLVideoElement ? { width: d.videoWidth, height: d.videoHeight } : { width: d.naturalWidth, height: d.naturalHeight };
789
+ !L.width || !L.height || et(L);
790
+ }, []);
791
+ j(() => {
792
+ Je.current = a;
793
+ }, [a]), j(() => {
794
+ const l = Re.current;
795
+ if (!l) return;
796
+ const d = () => gt(Ut(l));
797
+ d();
798
+ const L = new ResizeObserver(d);
799
+ return L.observe(l), () => L.disconnect();
800
+ }, []);
801
+ const T = oe(() => {
802
+ le.current !== null && (window.clearTimeout(le.current), le.current = null);
803
+ }, []), Z = oe(() => {
804
+ const l = K.current;
805
+ K.current = null, T(), H.current = null, F.current = !1, se(null), $e(!1), B(0), _.current = 0, ye(!1), Y.current = !1, A.current = 0, O.current = "none", l === 1 ? r() : l === -1 && ue();
806
+ }, [T, r, ue]), _e = oe(() => {
807
+ T(), K.current = null, H.current = null, F.current = !1, se(null), $e(!1), B(0), _.current = 0;
808
+ }, [T]), yt = oe(() => {
809
+ T(), le.current = window.setTimeout(() => {
810
+ K.current !== null && Z();
811
+ }, E + 32);
812
+ }, [T, Z]), ve = oe((l, d) => {
813
+ var ne;
814
+ const L = ((ne = Je.current) == null ? void 0 : ne.width) ?? 0;
815
+ if (T(), H.current = l, se(l), F.current = !0, $e(!0), d) {
816
+ K.current = l;
817
+ const ce = -l * L;
818
+ _.current = ce, B(ce), yt();
819
+ return;
820
+ }
821
+ _.current = 0, B(0), le.current = window.setTimeout(() => {
822
+ le.current = null, _e();
823
+ }, E + 32);
824
+ }, [T, _e, yt]), we = oe((l) => {
825
+ if (!(t.length <= 1)) {
826
+ if (F.current) {
827
+ if (K.current === l) {
828
+ De.current = l, Z();
829
+ return;
830
+ }
831
+ _e();
832
+ }
833
+ T(), H.current = l, se(l), F.current = !1, $e(!1), _.current = 0, B(0), requestAnimationFrame(() => {
834
+ requestAnimationFrame(() => {
835
+ ve(l, !0);
836
+ });
837
+ });
838
+ }
839
+ }, [t.length, ve, Z, _e, T]);
840
+ Qe.current = we;
841
+ const Ne = oe((l) => {
842
+ l.propertyName !== "transform" || !F.current || K.current !== null && Z();
843
+ }, [Z]), xe = oe(() => {
844
+ const l = ge.current;
845
+ if (!l) return;
846
+ const d = Ut(l);
847
+ !d.width || !d.height || je(d);
848
+ }, []);
849
+ j(() => {
850
+ xe();
851
+ const l = ge.current;
852
+ if (!l) return;
853
+ const d = new ResizeObserver(() => xe());
854
+ return d.observe(l), () => d.disconnect();
855
+ }, [xe]), j(() => {
856
+ b === "opening" && m && ke("open");
857
+ }, [b, m]), j(() => {
858
+ if (b !== "closing") return;
859
+ const l = setTimeout(() => X(), E);
860
+ return () => clearTimeout(l);
861
+ }, [b, X]), j(() => () => {
862
+ T();
863
+ }, [T]), Et(() => {
864
+ Be.current === i && tt.current === (c == null ? void 0 : c.assetId) || (T(), K.current = null, se(null), V(0), B(0), $e(!1), Pe(!1), ye(!1), et(null), U.current = 0, A.current = 0, O.current = "none", Y.current = !1, F.current = !1, _.current = 0, H.current = null, z.current = null, te.current = !1, Be.current = i, tt.current = c == null ? void 0 : c.assetId);
865
+ }, [i, c == null ? void 0 : c.assetId, T]), Et(() => {
866
+ const l = De.current;
867
+ l !== null && (De.current = null, requestAnimationFrame(() => {
868
+ Qe.current(l);
869
+ }));
870
+ }, [i, c == null ? void 0 : c.assetId]), j(() => {
871
+ if (b !== "open") return;
872
+ let l = null;
873
+ const d = () => {
874
+ l && (document.removeEventListener("click", l, !0), l = null);
875
+ }, L = () => {
876
+ d(), l = (h) => {
877
+ h.stopPropagation(), h.preventDefault(), d();
878
+ }, document.addEventListener("click", l, !0);
879
+ }, ne = (h) => {
880
+ const W = h < 0 ? 1 : -1;
881
+ if (Math.abs(h) > ki && t.length > 1) {
882
+ ve(W, !0);
883
+ return;
884
+ }
885
+ ve(W, !1);
886
+ }, ce = (h) => {
887
+ if (h.touches.length !== 1 || F.current) return;
888
+ const W = h.touches[0];
889
+ te.current = !0, z.current = { x: W.clientX, y: W.clientY }, O.current = "none", A.current = 0, Y.current = !1;
890
+ }, Xe = (h) => {
891
+ if (!z.current || h.touches.length !== 1 || F.current) return;
892
+ const W = h.touches[0], re = W.clientX - z.current.x, x = W.clientY - z.current.y;
893
+ if (O.current === "none") {
894
+ if (Math.abs(re) < 10 && Math.abs(x) < 10) return;
895
+ if (Math.abs(re) > Math.abs(x)) {
896
+ if (t.length <= 1) return;
897
+ O.current = "horizontal";
898
+ } else if (x > 0)
899
+ O.current = "vertical";
900
+ else
901
+ return;
902
+ }
903
+ if (O.current === "horizontal") {
904
+ Y.current = !0, ye(!0), A.current = re;
905
+ const M = re < 0 ? 1 : -1;
906
+ H.current !== M && (H.current = M, se(M)), _.current = re, B(re), h.preventDefault();
907
+ return;
908
+ }
909
+ O.current === "vertical" && (Y.current = !0, ye(!0), U.current = x, V(x), h.preventDefault());
910
+ }, Oe = () => {
911
+ if (!z.current) return;
912
+ const h = O.current, W = Y.current;
913
+ if (W && h === "horizontal")
914
+ ne(A.current), L();
915
+ else if (W && h === "vertical")
916
+ if (U.current > Ci) {
917
+ const x = window.innerHeight;
918
+ U.current = x, Pe(!0), V(x), ke("closing");
919
+ } else
920
+ U.current = 0, V(0), L();
921
+ else h === "horizontal" && Math.abs(A.current) > 0 && (ne(A.current), L());
922
+ z.current = null, O.current = "none", A.current = 0, Y.current = !1, ye(!1);
923
+ };
924
+ return document.addEventListener("touchstart", ce, { passive: !0 }), document.addEventListener("touchmove", Xe, { passive: !1 }), document.addEventListener("touchend", Oe), document.addEventListener("touchcancel", Oe), () => {
925
+ document.removeEventListener("touchstart", ce), document.removeEventListener("touchmove", Xe), document.removeEventListener("touchend", Oe), document.removeEventListener("touchcancel", Oe), d();
926
+ };
927
+ }, [b, t.length, ve]), j(() => {
928
+ const l = (d) => {
929
+ d.key === "Escape" && (d.preventDefault(), d.stopPropagation(), b !== "closing" && ke("closing"));
930
+ };
931
+ return window.addEventListener("keydown", l, !0), () => window.removeEventListener("keydown", l, !0);
932
+ }, [b]);
933
+ const ze = () => {
934
+ b !== "closing" && ke("closing");
935
+ }, be = b === "open", Ge = b === "closing", vt = ie > 0 ? Math.max(0, 1 - ie / 500) : 1, wt = ie > 0 ? Math.max(0.35, 1 - ie / 500) : 1, xt = it && c ? { width: Kt(c), height: 1 } : ft, u = m ? Ce ? m : Mi(m, xt) : null, rt = {
936
+ position: "fixed",
937
+ top: a == null ? void 0 : a.top,
938
+ left: a == null ? void 0 : a.left,
939
+ width: a == null ? void 0 : a.width,
940
+ height: a == null ? void 0 : a.height,
941
+ zIndex: 9998
942
+ }, J = Ce ? "cover" : "contain", bt = fe !== 0 || ie > 0 ? `translate(${fe}px, ${ie}px)` : void 0, Ae = Te && !Ve ? "none" : Ve ? `transform ${E}ms ${me}` : pt ? `transform ${E}ms ${me}, opacity ${E}ms ${me}` : b === "opening" || Ge ? `opacity ${E}ms ${me}` : "none", Ee = {
943
+ ...rt,
944
+ transform: bt,
945
+ opacity: ie > 0 ? wt : b === "opening" || Ge ? 0 : 1,
946
+ transition: Ae,
947
+ pointerEvents: "none"
948
+ }, qe = {
949
+ position: "absolute",
950
+ top: ((u == null ? void 0 : u.top) ?? 0) - ((a == null ? void 0 : a.top) ?? 0),
951
+ left: ((u == null ? void 0 : u.left) ?? 0) - ((a == null ? void 0 : a.left) ?? 0),
952
+ width: u == null ? void 0 : u.width,
953
+ height: u == null ? void 0 : u.height,
954
+ objectFit: J,
955
+ pointerEvents: "none"
956
+ }, ot = (a == null ? void 0 : a.width) ?? 0, ae = Le ? (i + He + t.length) % t.length : null, N = ae !== null ? t[ae] : null, Ot = {
957
+ ...rt,
958
+ transform: Le ? `translateX(${He * ot + fe}px)` : void 0,
959
+ opacity: 1,
960
+ transition: Ve ? `transform ${E}ms ${me}` : "none",
961
+ pointerEvents: "none"
962
+ }, lt = {
963
+ position: "absolute",
964
+ top: ((m == null ? void 0 : m.top) ?? 0) - ((a == null ? void 0 : a.top) ?? 0),
965
+ left: ((m == null ? void 0 : m.left) ?? 0) - ((a == null ? void 0 : a.left) ?? 0),
966
+ width: m == null ? void 0 : m.width,
967
+ height: m == null ? void 0 : m.height,
968
+ objectFit: J,
969
+ pointerEvents: "none"
970
+ }, St = it && c && pi(c).controls && u ? Math.min(52, u.height * 0.2) : 0, G = u ? {
971
+ position: "fixed",
972
+ top: u.top,
973
+ height: u.height - St,
974
+ width: u.width / 2,
975
+ zIndex: 9999
976
+ } : null;
977
+ return /* @__PURE__ */ y(
978
+ "div",
979
+ {
980
+ ref: Re,
981
+ className: [
982
+ `${e}-lightbox`,
983
+ o ? `${e}-lightbox-editor` : ""
984
+ ].filter(Boolean).join(" "),
985
+ style: {
986
+ touchAction: b === "open" ? "none" : void 0
987
+ },
988
+ onClick: ze,
989
+ children: [
990
+ /* @__PURE__ */ n(
991
+ "div",
992
+ {
993
+ style: {
994
+ position: "absolute",
995
+ inset: 0,
996
+ background: "rgba(28,31,34,0.9)",
997
+ opacity: be ? vt : 0,
998
+ transition: Te ? "none" : `opacity ${E}ms ${me}`,
999
+ pointerEvents: "none"
1000
+ }
1001
+ }
1002
+ ),
1003
+ /* @__PURE__ */ n(
1004
+ "div",
1005
+ {
1006
+ style: {
1007
+ position: "relative",
1008
+ width: "100%",
1009
+ height: "100%",
1010
+ display: "flex",
1011
+ flexDirection: "column",
1012
+ alignItems: "center",
1013
+ justifyContent: "center"
1014
+ },
1015
+ children: Ce ? /* @__PURE__ */ y(q, { children: [
1016
+ /* @__PURE__ */ n("div", { ref: ge, style: { position: "absolute", inset: 0 } }),
1017
+ /* @__PURE__ */ n(
1018
+ "div",
1019
+ {
1020
+ style: {
1021
+ position: "absolute",
1022
+ bottom: 0,
1023
+ left: 0,
1024
+ right: 0,
1025
+ display: "flex",
1026
+ flexDirection: "row",
1027
+ justifyContent: "center",
1028
+ alignItems: "center",
1029
+ height: "10%",
1030
+ opacity: be ? 1 : 0,
1031
+ transition: `opacity ${E}ms ${me}`,
1032
+ pointerEvents: "none",
1033
+ zIndex: 9999
1034
+ },
1035
+ children: t.length > 1 && /* @__PURE__ */ y("p", { className: R, style: P, children: [
1036
+ i + 1,
1037
+ " / ",
1038
+ t.length
1039
+ ] })
1040
+ }
1041
+ )
1042
+ ] }) : /* @__PURE__ */ y(q, { children: [
1043
+ /* @__PURE__ */ n("div", { style: { height: "10%" } }),
1044
+ /* @__PURE__ */ n(
1045
+ "div",
1046
+ {
1047
+ style: {
1048
+ width: "70%",
1049
+ height: "80%",
1050
+ display: "flex",
1051
+ justifyContent: "center",
1052
+ alignItems: "center"
1053
+ },
1054
+ children: /* @__PURE__ */ n("div", { ref: ge, style: { width: "100%", height: "100%" } })
1055
+ }
1056
+ ),
1057
+ /* @__PURE__ */ n(
1058
+ "div",
1059
+ {
1060
+ style: {
1061
+ display: "flex",
1062
+ flexDirection: "row",
1063
+ justifyContent: "center",
1064
+ alignItems: "center",
1065
+ height: "10%",
1066
+ opacity: be ? 1 : 0,
1067
+ transition: `opacity ${E}ms ${me}`
1068
+ },
1069
+ children: t.length > 1 && /* @__PURE__ */ y("p", { className: R, style: P, children: [
1070
+ i + 1,
1071
+ " / ",
1072
+ t.length
1073
+ ] })
1074
+ }
1075
+ )
1076
+ ] })
1077
+ }
1078
+ ),
1079
+ m && a && N && /* @__PURE__ */ n("div", { style: Ot, onTransitionEnd: Ne, children: Me(N) ? /* @__PURE__ */ n(
1080
+ "img",
1081
+ {
1082
+ src: N.thumbnail,
1083
+ alt: N.name,
1084
+ style: lt
1085
+ },
1086
+ `neighbor-${ae}-${N.assetId}`
1087
+ ) : Se(N) ? /* @__PURE__ */ n(
1088
+ "video",
1089
+ {
1090
+ src: N.assetId,
1091
+ muted: !0,
1092
+ autoPlay: !0,
1093
+ loop: !0,
1094
+ playsInline: !0,
1095
+ preload: "auto",
1096
+ style: lt
1097
+ },
1098
+ `neighbor-${ae}-${N.assetId}`
1099
+ ) : /* @__PURE__ */ n(
1100
+ "img",
1101
+ {
1102
+ src: N.assetId,
1103
+ alt: N.name,
1104
+ style: lt
1105
+ },
1106
+ `neighbor-${ae}-${N.assetId}`
1107
+ ) }),
1108
+ m && a && c && /* @__PURE__ */ n("div", { style: Ee, onTransitionEnd: Ne, children: it ? /* @__PURE__ */ n(
1109
+ Zt,
1110
+ {
1111
+ media: c,
1112
+ fit: Ce ? "cover" : "contain",
1113
+ lazy: !1,
1114
+ startsAtOnce: !0,
1115
+ style: qe
1116
+ },
1117
+ `${i}-${c.assetId}`
1118
+ ) : $t ? /* @__PURE__ */ n(
1119
+ Ri,
1120
+ {
1121
+ src: c.assetId,
1122
+ mediaRef: pe,
1123
+ mediaStyle: qe,
1124
+ onLoadedMetadata: nt
1125
+ },
1126
+ `${i}-${c.assetId}`
1127
+ ) : /* @__PURE__ */ n(
1128
+ "img",
1129
+ {
1130
+ ref: pe,
1131
+ src: c.assetId,
1132
+ alt: c.name,
1133
+ onLoad: nt,
1134
+ style: qe
1135
+ },
1136
+ `${i}-${c.assetId}`
1137
+ ) }),
1138
+ be && G && t.length > 1 && /* @__PURE__ */ y(q, { children: [
1139
+ /* @__PURE__ */ n(
1140
+ "div",
1141
+ {
1142
+ style: {
1143
+ ...G,
1144
+ left: u.left,
1145
+ cursor: "w-resize",
1146
+ pointerEvents: Te ? "none" : "auto"
1147
+ },
1148
+ onClick: (l) => {
1149
+ if (te.current) {
1150
+ te.current = !1;
1151
+ return;
1152
+ }
1153
+ l.stopPropagation(), we(-1);
1154
+ }
1155
+ }
1156
+ ),
1157
+ /* @__PURE__ */ n(
1158
+ "div",
1159
+ {
1160
+ style: {
1161
+ ...G,
1162
+ left: u.left + u.width / 2,
1163
+ cursor: "e-resize",
1164
+ pointerEvents: Te ? "none" : "auto"
1165
+ },
1166
+ onClick: (l) => {
1167
+ if (te.current) {
1168
+ te.current = !1;
1169
+ return;
1170
+ }
1171
+ l.stopPropagation(), we(1);
1172
+ }
1173
+ }
1174
+ )
1175
+ ] }),
1176
+ /* @__PURE__ */ n(
1177
+ Hi,
1178
+ {
1179
+ prefix: e,
1180
+ closeIcon: ee,
1181
+ closeIconMaxWidth: he,
1182
+ closeIconColor: Ie,
1183
+ closeIconHoverColor: C,
1184
+ iconMarginRight: k,
1185
+ contentMarginTop: Ze,
1186
+ isEditor: o,
1187
+ isPreviewMode: w,
1188
+ isEditMode: v,
1189
+ visible: be,
1190
+ onClose: ze
1191
+ }
1192
+ )
1193
+ ]
1194
+ }
1195
+ );
1196
+ }
1197
+ function Bi(e) {
1198
+ return typeof e == "string" ? e === "cover" ? "cover" : "fit" : (e == null ? void 0 : e.display) === "cover" ? "cover" : "fit";
1199
+ }
1200
+ function ln({ settings: e, content: t, isEditor: i, isPreviewMode: s, isEditMode: o, metadata: w, activeEvent: v, layoutId: X, portalId: ue }) {
1201
+ const { prefix: r } = gi(), {
1202
+ type: R = "a",
1203
+ gridLayout: P,
1204
+ textBoxWidth: ee = 100,
1205
+ verticalGap: he,
1206
+ entriesCount: Ie,
1207
+ lightbox: C,
1208
+ imageDisplay: k,
1209
+ imageCorners: Ze,
1210
+ lightboxImageDisplay: Ce,
1211
+ slider: Re,
1212
+ sliderTiming: ge,
1213
+ direction: pe,
1214
+ transition: z,
1215
+ titleMarginTop: U,
1216
+ subtitleMarginTop: A,
1217
+ titleColor: O,
1218
+ subtitleColor: Y,
1219
+ lightboxCounterColor: te,
1220
+ titleFontFamily: Je,
1221
+ titleFontSettings: _,
1222
+ titleFontSize: H,
1223
+ titleLineHeight: F,
1224
+ titleLetterSpacing: le,
1225
+ titleWordSpacing: K,
1226
+ titleTextAppearance: De,
1227
+ subtitleFontFamily: Qe,
1228
+ subtitleFontSettings: m,
1229
+ subtitleFontSize: je,
1230
+ subtitleLineHeight: a,
1231
+ subtitleLetterSpacing: gt,
1232
+ subtitleWordSpacing: b,
1233
+ subtitleTextAppearance: ke,
1234
+ lightboxCounterFontFamily: ie,
1235
+ lightboxCounterFontSettings: V,
1236
+ lightboxCounterFontSize: fe,
1237
+ lightboxCounterLineHeight: B,
1238
+ lightboxCounterLetterSpacing: He,
1239
+ lightboxCounterWordSpacing: se,
1240
+ lightboxCounterTextAppearance: Ve,
1241
+ closeIcon: $e,
1242
+ closeIconMaxWidth: Te,
1243
+ closeIconColor: ye,
1244
+ closeIconHoverColor: pt,
1245
+ iconMarginRight: Pe,
1246
+ contentMarginTop: ft,
1247
+ showText: et = "always",
1248
+ hover: Be = "none",
1249
+ alignEntries: tt = "off",
1250
+ align: c = "top"
1251
+ } = e, $t = {
1252
+ fontSettings: {
1253
+ fontFamily: Je,
1254
+ fontWeight: (_ == null ? void 0 : _.fontWeight) ?? 400,
1255
+ fontStyle: (_ == null ? void 0 : _.fontStyle) ?? "normal"
1256
+ },
1257
+ fontSize: H ?? 0.01,
1258
+ lineHeight: F,
1259
+ letterSpacing: le ?? 0,
1260
+ wordSpacing: K ?? 0,
1261
+ textAppearance: De,
1262
+ color: O
1263
+ }, Le = {
1264
+ ...Tt(Lt($t, i))
1265
+ }, nt = {
1266
+ fontSettings: {
1267
+ fontFamily: Qe,
1268
+ fontWeight: (m == null ? void 0 : m.fontWeight) ?? 400,
1269
+ fontStyle: (m == null ? void 0 : m.fontStyle) ?? "normal"
1270
+ },
1271
+ fontSize: je ?? 0.01,
1272
+ lineHeight: a,
1273
+ letterSpacing: gt ?? 0,
1274
+ wordSpacing: b ?? 0,
1275
+ textAppearance: ke,
1276
+ color: Y
1277
+ }, Z = {
1278
+ ...Tt(Lt(nt, i))
1279
+ }, _e = {
1280
+ fontSettings: {
1281
+ fontFamily: ie,
1282
+ fontWeight: (V == null ? void 0 : V.fontWeight) ?? 400,
1283
+ fontStyle: (V == null ? void 0 : V.fontStyle) ?? "normal"
1284
+ },
1285
+ fontSize: fe ?? 0.01,
1286
+ lineHeight: B,
1287
+ letterSpacing: He ?? 0,
1288
+ wordSpacing: se ?? 0,
1289
+ textAppearance: Ve,
1290
+ color: te
1291
+ }, ve = {
1292
+ ...Tt(Lt(_e, i)),
1293
+ ...Nt(fe, B, r, i)
1294
+ }, we = _t(
1295
+ H,
1296
+ F,
1297
+ `${r}-item-title`,
1298
+ `${r}-text-tight-leading`
1299
+ ), Ne = _t(
1300
+ je,
1301
+ a,
1302
+ `${r}-item-subtitle`,
1303
+ `${r}-text-tight-leading`
1304
+ ), xe = Nt(H, F, r, i), ze = Nt(je, a, r, i), be = _t(
1305
+ fe,
1306
+ B,
1307
+ `${r}-lightbox-counter`,
1308
+ `${r}-text-tight-leading`
1309
+ ), Ge = hi(r, {
1310
+ titleColor: O,
1311
+ subtitleColor: Y,
1312
+ lightboxCounterColor: te
1313
+ }, Gi, Ei), vt = v && v !== "default" ? `${r}-state-${v}` : "", wt = et === "on hover" && (!i || s), xt = Be !== "none" && (!i || s) ? ` ${r}-hover-${Be}` : "", u = `${vt}${wt ? ` ${r}-show-text-hover` : ""}${xt}`.trim(), rt = Ie === 0 ? 1 / 0 : Ie, J = (t ?? []).slice(0, rt), bt = Gt(
1314
+ () => C === "on" ? Ni(J) : [],
1315
+ [J, C]
1316
+ ), Ae = P.entryWidth ?? 0.2, Ee = (k == null ? void 0 : k.display) === "cover", qe = (k == null ? void 0 : k.ratioValue) ?? "1:1", ot = (k == null ? void 0 : k.reversed) ?? !1, [ae, N] = qe.split(":").map(Number), St = `${ot ? N : ae} / ${ot ? ae : N}`, G = P.columnsCount, l = p(Ae ?? 0, i), d = l, L = !Ee && Re !== "off", ne = J.length % G || G, ce = ne < G && J.length > 0, Xe = J.length - ne, Oe = ce ? Math.floor((G - ne) / 2) + 1 : 1, h = Ze ? p(Ze, i) : void 0, W = {
1317
+ width: d,
1318
+ ...Ee ? { aspectRatio: St, height: "auto", overflow: "hidden" } : { height: "auto" },
1319
+ ...h ? { borderRadius: h, overflow: "hidden" } : {}
1320
+ }, re = `${r}-item-image-wrapper${L ? ` ${r}-item-image-wrapper-fit-slider` : ""}`.trim(), x = R === "d" || R === "e" || R === "f", M = tt === "on", Fe = `calc(${p(Ae ?? 0, i)} * (${ee} / 100))`, de = p(Ae * ee / 100, i), Ft = h ? { borderRadius: h, [Qt]: h } : {}, Wt = Ee ? {
1321
+ objectFit: "cover",
1322
+ pointerEvents: "auto",
1323
+ width: "100%",
1324
+ height: "100%",
1325
+ maxWidth: "100%",
1326
+ ...Ft
1327
+ } : {
1328
+ objectFit: "contain",
1329
+ pointerEvents: "auto",
1330
+ width: "auto",
1331
+ height: "auto",
1332
+ maxWidth: "100%",
1333
+ ...Ft
1334
+ }, [ei, ti] = I(0), st = $(null), ii = z === "fade" || pe === "horizontal" ? "ltr" : pe === "vertical" ? "ttb" : "ltr";
1335
+ j(() => {
1336
+ const g = st.current;
1337
+ if (!g) return;
1338
+ const S = new ResizeObserver((D) => {
1339
+ ti(Math.round(D[0].contentRect.width));
1340
+ });
1341
+ return S.observe(g), () => S.disconnect();
1342
+ }, []);
1343
+ const ni = (() => {
1344
+ const g = { ...Ge }, S = st.current ? getComputedStyle(st.current).getPropertyValue("--cntrl-article-width").trim() : "";
1345
+ return S && (g["--cntrl-article-width"] = S), g;
1346
+ })(), [It, Ct] = I(!1), [at, ri] = I([]), [oi, kt] = I(0), Mt = C === "on" && (!i || s), Rt = (g, S) => {
1347
+ i && !s || C !== "off" && (ri(g), kt(S), Ct(!0));
1348
+ };
1349
+ j(() => {
1350
+ if (!It || C !== "on" || typeof document > "u") return;
1351
+ const g = document.body.style.overflow;
1352
+ return document.body.style.overflow = "hidden", () => {
1353
+ document.body.style.overflow = g;
1354
+ };
1355
+ }, [It, C]), j(() => {
1356
+ !i || s || Ct(!1);
1357
+ }, [i, s]);
1358
+ const li = Gt(() => wi(r), [r]);
1359
+ return /* @__PURE__ */ y(q, { children: [
1360
+ /* @__PURE__ */ n("style", { dangerouslySetInnerHTML: { __html: li } }),
1361
+ C === "on" && /* @__PURE__ */ n(zi, { mediaList: bt }),
1362
+ /* @__PURE__ */ n("div", { style: Ge, children: /* @__PURE__ */ n(
1363
+ "div",
1364
+ {
1365
+ ref: st,
1366
+ className: `${r}-wrapper ${r}-type-${R}${M ? ` ${r}-align-entries` : ""} ${r}-image-align-${c} ${u}`.trim(),
1367
+ style: {
1368
+ gridTemplateColumns: `repeat(${G}, ${l})`,
1369
+ rowGap: M ? 0 : p(he ?? 0, i),
1370
+ columnGap: p(P.horizontalGap ?? 0, i),
1371
+ width: p(P.wrapperWidth ?? 0, i),
1372
+ ...M ? { [`--${r}-align-entries-row-gap`]: p(he ?? 0, i) } : {}
1373
+ },
1374
+ children: J.map((g, S) => {
1375
+ var Bt;
1376
+ const D = qt(g.title), Q = qt(g.subtitle), We = C === "off" && ((Bt = g.link) != null && Bt.value) ? g.link : void 0, si = Math.floor(S / G) === Math.ceil(J.length / G) - 1, ct = ce && S >= Xe ? `${Oe + (S - Xe)}` : void 0, Dt = x ? /* @__PURE__ */ y("div", { className: `${r}-item-text-block`, children: [
1377
+ D && /* @__PURE__ */ n("p", { className: we, style: { width: Fe, ...Le, ...xe }, children: g.title }),
1378
+ D && /* @__PURE__ */ n(
1379
+ "div",
1380
+ {
1381
+ "data-controls": o ? "titleMarginTop" : void 0,
1382
+ className: o ? `${r}-control` : void 0,
1383
+ style: {
1384
+ height: p(U ?? 0, i),
1385
+ width: de
1386
+ }
1387
+ }
1388
+ ),
1389
+ Q && /* @__PURE__ */ n("p", { className: Ne, style: { width: Fe, ...Z, ...ze }, children: g.subtitle }),
1390
+ Q && /* @__PURE__ */ n(
1391
+ "div",
1392
+ {
1393
+ "data-controls": o ? "subtitleMarginTop" : void 0,
1394
+ className: o ? `${r}-control` : void 0,
1395
+ style: {
1396
+ height: p(A ?? 0, i),
1397
+ width: de
1398
+ }
1399
+ }
1400
+ )
1401
+ ] }) : null, ai = M ? /* @__PURE__ */ y("div", { className: `${r}-item-title-row`, children: [
1402
+ !x && /* @__PURE__ */ n(
1403
+ "div",
1404
+ {
1405
+ "data-controls": o && D ? "titleMarginTop" : void 0,
1406
+ className: o && D ? `${r}-control` : void 0,
1407
+ style: {
1408
+ height: D ? p(U ?? 0, i) : 0,
1409
+ width: de
1410
+ }
1411
+ }
1412
+ ),
1413
+ D && /* @__PURE__ */ n("p", { className: we, style: { width: Fe, ...Le, ...xe }, children: g.title }),
1414
+ x && D && /* @__PURE__ */ n(
1415
+ "div",
1416
+ {
1417
+ "data-controls": o ? "titleMarginTop" : void 0,
1418
+ className: o ? `${r}-control` : void 0,
1419
+ style: {
1420
+ height: p(U ?? 0, i),
1421
+ width: de
1422
+ }
1423
+ }
1424
+ )
1425
+ ] }) : null, ci = M ? /* @__PURE__ */ y("div", { className: `${r}-item-subtitle-row`, children: [
1426
+ !x && /* @__PURE__ */ n(
1427
+ "div",
1428
+ {
1429
+ "data-controls": o && Q ? "subtitleMarginTop" : void 0,
1430
+ className: o && Q ? `${r}-control` : void 0,
1431
+ style: {
1432
+ height: Q ? p(A ?? 0, i) : 0,
1433
+ width: de
1434
+ }
1435
+ }
1436
+ ),
1437
+ Q && /* @__PURE__ */ n("p", { className: Ne, style: { width: Fe, ...Z, ...ze }, children: g.subtitle }),
1438
+ x && Q && /* @__PURE__ */ n(
1439
+ "div",
1440
+ {
1441
+ "data-controls": o ? "subtitleMarginTop" : void 0,
1442
+ className: o ? `${r}-control` : void 0,
1443
+ style: {
1444
+ height: p(A ?? 0, i),
1445
+ width: de
1446
+ }
1447
+ }
1448
+ )
1449
+ ] }) : null, jt = /* @__PURE__ */ y(ht, { link: We, className: `${r}-item-text-link`, children: [
1450
+ ai,
1451
+ ci
1452
+ ] }), Ue = Pt(g.gallery), dt = Ue.filter((f) => f.lightboxMedia).map((f) => f.lightboxMedia), mt = /* @__PURE__ */ n(Wi, { className: re, style: W, children: Ue.length === 0 ? null : Re === "off" ? (() => {
1453
+ const { displayMedia: f, lightboxMedia: Ye } = Ue[0], Ke = Ye ? dt.findIndex((ut) => ut.assetId === Ye.assetId) : -1;
1454
+ return /* @__PURE__ */ n(
1455
+ Xt,
1456
+ {
1457
+ media: f,
1458
+ className: `${r}-item-${Se(f) ? "video" : "image"}`.trim(),
1459
+ style: Wt,
1460
+ hasLightbox: C === "on",
1461
+ onMediaClick: Mt && Ke >= 0 ? () => Rt(dt, Ke) : void 0
1462
+ }
1463
+ );
1464
+ })() : /* @__PURE__ */ y(q, { children: [
1465
+ L && /* @__PURE__ */ n("div", { className: `${r}-item-image-wrapper-sizer`, "aria-hidden": "true", children: Ue.map(({ displayMedia: f }) => Me(f) ? /* @__PURE__ */ n("div", { style: { aspectRatio: `${Kt(f)}` } }, `sizer-${f.assetId}`) : Se(f) ? /* @__PURE__ */ n(Jt, { src: f.assetId, nearPreload: "metadata", muted: !0, playsInline: !0 }, `sizer-${f.assetId}`) : /* @__PURE__ */ n("img", { src: f.assetId, alt: "" }, `sizer-${f.assetId}`)) }),
1466
+ /* @__PURE__ */ n(
1467
+ mi,
1468
+ {
1469
+ className: `${r}-item-slider`,
1470
+ options: {
1471
+ arrows: !1,
1472
+ pagination: !1,
1473
+ drag: !1,
1474
+ perPage: 1,
1475
+ autoplay: !0,
1476
+ interval: ge * 1e3,
1477
+ width: "100%",
1478
+ height: "100%",
1479
+ speed: Ii,
1480
+ type: z === "fade" ? "fade" : "loop",
1481
+ rewind: z === "fade",
1482
+ pauseOnHover: !1,
1483
+ pauseOnFocus: !1,
1484
+ direction: ii
1485
+ },
1486
+ onMoved: (f) => {
1487
+ pe !== "random" || z === "fade" || Si(f);
1488
+ },
1489
+ children: Ue.map(({ displayMedia: f, lightboxMedia: Ye }, Ke) => {
1490
+ const ut = Ye ? dt.findIndex((di) => di.assetId === Ye.assetId) : -1;
1491
+ return /* @__PURE__ */ n(ui, { "data-slide-index": Ke, children: /* @__PURE__ */ n(
1492
+ Xt,
1493
+ {
1494
+ media: f,
1495
+ className: `${r}-item-${Se(f) ? "video" : "image"}`.trim(),
1496
+ style: Wt,
1497
+ hasLightbox: C === "on",
1498
+ isSplideSlide: !0,
1499
+ onMediaClick: Mt && ut >= 0 ? () => Rt(dt, ut) : void 0
1500
+ }
1501
+ ) }, Ke);
1502
+ })
1503
+ },
1504
+ `${z}-${Ae}-${pe}-${ge}-${ei}-${X}`
1505
+ )
1506
+ ] }) }), Ht = x ? null : /* @__PURE__ */ y(q, { children: [
1507
+ /* @__PURE__ */ n(
1508
+ "div",
1509
+ {
1510
+ "data-controls": o && D ? "titleMarginTop" : void 0,
1511
+ className: o && D ? `${r}-control` : void 0,
1512
+ style: {
1513
+ height: D ? p(U ?? 0, i) : 0,
1514
+ width: de
1515
+ }
1516
+ }
1517
+ ),
1518
+ /* @__PURE__ */ n(
1519
+ "p",
1520
+ {
1521
+ className: we,
1522
+ style: { width: Fe, ...Le, ...xe },
1523
+ children: g.title
1524
+ }
1525
+ ),
1526
+ /* @__PURE__ */ n(
1527
+ "div",
1528
+ {
1529
+ "data-controls": o && Q ? "subtitleMarginTop" : void 0,
1530
+ className: o && Q ? `${r}-control` : void 0,
1531
+ style: {
1532
+ height: Q ? p(A ?? 0, i) : 0,
1533
+ width: de
1534
+ }
1535
+ }
1536
+ ),
1537
+ /* @__PURE__ */ n(
1538
+ "p",
1539
+ {
1540
+ className: Ne,
1541
+ style: { width: Fe, ...Z, ...ze },
1542
+ children: g.subtitle
1543
+ }
1544
+ )
1545
+ ] }), Vt = We ? /* @__PURE__ */ n(ht, { link: We, className: `${r}-item-image-link`, children: mt }) : /* @__PURE__ */ n("a", { className: `${r}-item-image-link`, children: mt });
1546
+ return /* @__PURE__ */ n(
1547
+ "div",
1548
+ {
1549
+ className: `${r}-item`.trim(),
1550
+ style: ct && !M ? { gridColumn: ct } : void 0,
1551
+ children: /* @__PURE__ */ n(
1552
+ "div",
1553
+ {
1554
+ className: `${o ? `${r}-item-inner` : `${r}-item-inner-hidden`}${M && si ? ` ${r}-item-inner-last-row` : ""}`.trim(),
1555
+ style: {
1556
+ width: (ee ?? 0) > 100 ? `calc(${l} * (${ee} / 100))` : l,
1557
+ ...ct && M ? { gridColumn: ct } : {}
1558
+ },
1559
+ children: M ? /* @__PURE__ */ n(q, { children: x ? /* @__PURE__ */ y(q, { children: [
1560
+ jt,
1561
+ Vt
1562
+ ] }) : /* @__PURE__ */ y(q, { children: [
1563
+ Vt,
1564
+ jt
1565
+ ] }) }) : We ? /* @__PURE__ */ y(q, { children: [
1566
+ /* @__PURE__ */ y(ht, { link: We, className: `${r}-item-image-link`, children: [
1567
+ Dt,
1568
+ mt
1569
+ ] }),
1570
+ !x && /* @__PURE__ */ n(ht, { link: We, className: `${r}-item-text-link`, children: Ht })
1571
+ ] }) : /* @__PURE__ */ y(q, { children: [
1572
+ Dt,
1573
+ mt,
1574
+ Ht
1575
+ ] })
1576
+ }
1577
+ )
1578
+ },
1579
+ S
1580
+ );
1581
+ })
1582
+ }
1583
+ ) }),
1584
+ (!i || s) && It && typeof document < "u" && C === "on" && (() => {
1585
+ const g = (ue ? document.getElementById(ue) : null) ?? document.body;
1586
+ return fi(
1587
+ /* @__PURE__ */ n("div", { style: ni, "data-selection": "none", children: /* @__PURE__ */ n(
1588
+ Vi,
1589
+ {
1590
+ prefix: r,
1591
+ items: at,
1592
+ index: oi,
1593
+ imageDisplay: Bi(Ce),
1594
+ isEditor: i,
1595
+ isPreviewMode: s,
1596
+ isEditMode: o,
1597
+ closeIcon: $e,
1598
+ closeIconMaxWidth: Te,
1599
+ closeIconColor: ye,
1600
+ closeIconHoverColor: pt,
1601
+ iconMarginRight: Pe,
1602
+ contentMarginTop: ft,
1603
+ onClose: () => Ct(!1),
1604
+ onPrev: () => kt((S) => (S - 1 + at.length) % at.length),
1605
+ onNext: () => kt((S) => (S + 1) % at.length),
1606
+ counterClassName: be,
1607
+ counterStyle: ve
1608
+ }
1609
+ ) }),
1610
+ g
1611
+ );
1612
+ })()
1613
+ ] });
1614
+ }
1615
+ const Gi = {
1616
+ titleColor: "title-color",
1617
+ subtitleColor: "subtitle-color",
1618
+ lightboxCounterColor: "lightbox-counter-color"
1619
+ }, Ei = ["hover", "focus", "filled", "success", "error"];
1620
+ export {
1621
+ ln as Grid
1622
+ };