@cntrl-site/components 1.0.118-alpha.8 → 1.0.118-alpha.9

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,445 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),$=require("./scalingValue-CSHYgTZl.js"),jn=require("./buildColorVars-CE2D5cQV.js"),Cn=require("./useScopedStyles-Bf6yohVQ.js"),sn=require("./useLazyVideos-CdCbc2j0.js"),St=require("./LinkWrapper-CTqM1ucO.js"),oe=require("./EmbedMediaFrame-DsOTKE4i.js"),s=require("react"),kn=require("react-dom"),Ze=require("./textStylesToCss-CNN3zZTV.js"),Mn=require("./SvgImage-DFlmxAoL.js"),on=require("./LazyVideo-imbU18js.js");function Tn(e){return`calc(var(--cntrl-article-width, 100vw) * ${e/1440})`}function Pt(e){return((e==null?void 0:e.trim().length)??0)>0}function Ft(e,n,t,l){return n!==void 0&&n<(e??.01)?`${t} ${l}`:t}function Wt(e,n,t,l){const o=e??.01;return n===void 0||n>=o?{}:{[`--${t}-title-leading-gap`]:$.scalingValue((o-n)/2,l)}}const Et=400,Ot="cubic-bezier(0.25, 0.1, 0.25, 1)",Ln=1.1,ln="--grid-media-radius";function Rn(e){return`
2
+ .${e}-wrapper {
3
+ display: grid;
4
+ align-items: start;
5
+ justify-content: center;
6
+ min-height: ${Tn(48)};
7
+ }
8
+ .${e}-item {
9
+ display: flex;
10
+ flex-direction: column;
11
+ justify-content: center;
12
+ align-items: center;
13
+ }
14
+ .${e}-item-inner {
15
+ display: flex;
16
+ flex-direction: column;
17
+ align-items: center;
18
+ outline: 1px solid #FF5C02;
19
+ }
20
+ .${e}-item-inner-hidden {
21
+ display: flex;
22
+ flex-direction: column;
23
+ align-items: center;
24
+ }
25
+ .${e}-item-image-wrapper {
26
+ display: flex;
27
+ justify-content: center;
28
+ align-items: center;
29
+ align-self: center;
30
+ }
31
+ .${e}-item-image-wrapper-fit-slider {
32
+ display: grid;
33
+ overflow: hidden;
34
+ position: relative;
35
+ }
36
+ .${e}-item-image-wrapper-fit-slider > .${e}-item-image-wrapper-sizer {
37
+ grid-area: 1 / 1;
38
+ width: 100%;
39
+ display: grid;
40
+ visibility: hidden;
41
+ pointer-events: none;
42
+ }
43
+ .${e}-item-image-wrapper-fit-slider > .${e}-item-image-wrapper-sizer img {
44
+ grid-area: 1 / 1;
45
+ width: auto;
46
+ height: auto;
47
+ max-width: 100%;
48
+ object-fit: contain;
49
+ }
50
+ .${e}-item-image-wrapper-fit-slider > .${e}-item-image-wrapper-sizer video {
51
+ grid-area: 1 / 1;
52
+ width: auto;
53
+ height: auto;
54
+ max-width: 100%;
55
+ object-fit: contain;
56
+ }
57
+ .${e}-item-image-wrapper-fit-slider > .${e}-item-image-wrapper-sizer div {
58
+ grid-area: 1 / 1;
59
+ width: 100%;
60
+ }
61
+ .${e}-item-image-wrapper-fit-slider > .${e}-item-slider {
62
+ position: absolute;
63
+ inset: 0;
64
+ width: 100%;
65
+ overflow: hidden;
66
+ }
67
+ .${e}-item-image-link {
68
+ width: 100%;
69
+ display: flex;
70
+ flex-direction: column;
71
+ align-items: center;
72
+ }
73
+ .${e}-custom-layout .${e}-item-image-link {
74
+ flex: 1 1 0%;
75
+ min-height: 0;
76
+ }
77
+ .${e}-custom-layout.${e}-text-outside .${e}-item-image-link,
78
+ .${e}-custom-layout.${e}-auto-height .${e}-item-image-link {
79
+ flex: none;
80
+ }
81
+ .${e}-auto-height .${e}-item-image-wrapper-fit-slider > .${e}-item-image-wrapper-sizer :is(img, video) {
82
+ width: 100%;
83
+ }
84
+ .${e}-item-text-link {
85
+ display: flex;
86
+ flex-direction: column;
87
+ align-items: center;
88
+ width: 100%;
89
+ color: inherit;
90
+ text-decoration: none;
91
+ }
92
+ .${e}-item-image {
93
+ width: 100%;
94
+ height: 100%;
95
+ display: block;
96
+ max-width: 100%;
97
+ }
98
+ .${e}-item-video {
99
+ width: 100%;
100
+ height: 100%;
101
+ display: block;
102
+ max-width: 100%;
103
+ }
104
+ .${e}-item-slider {
105
+ position: relative;
106
+ width: 100%;
107
+ height: 100%;
108
+ overflow: hidden;
109
+ }
110
+ .${e}-item-slider-list {
111
+ position: relative;
112
+ display: flex;
113
+ flex-direction: row;
114
+ width: 100%;
115
+ height: 100%;
116
+ will-change: transform;
117
+ }
118
+ .${e}-item-slider-list-vertical {
119
+ flex-direction: column;
120
+ }
121
+ .${e}-item-slider-list-fade {
122
+ display: block;
123
+ will-change: auto;
124
+ }
125
+ .${e}-item-slide {
126
+ position: relative;
127
+ flex: 0 0 100%;
128
+ width: 100%;
129
+ height: 100%;
130
+ display: flex;
131
+ justify-content: center;
132
+ align-items: center;
133
+ }
134
+ .${e}-item-slider-list-fade .${e}-item-slide {
135
+ position: absolute;
136
+ top: 0;
137
+ left: 0;
138
+ opacity: 0;
139
+ transition: opacity ${_t}ms ${an};
140
+ }
141
+ .${e}-item-slider-list-fade .${e}-item-slide-active {
142
+ opacity: 1;
143
+ z-index: 1;
144
+ }
145
+ .${e}-item-title {
146
+ white-space: normal;
147
+ overflow-wrap: anywhere;
148
+ word-break: break-word;
149
+ text-align: center;
150
+ margin-bottom: 0px;
151
+ margin-top: 0px;
152
+ color: var(--${e}-title-color);
153
+ }
154
+ .${e}-item-subtitle {
155
+ white-space: normal;
156
+ overflow-wrap: anywhere;
157
+ word-break: break-word;
158
+ text-align: center;
159
+ margin-bottom: 0px;
160
+ margin-top: 0px;
161
+ color: var(--${e}-subtitle-color);
162
+ }
163
+ .${e}-text-tight-leading {
164
+ display: block;
165
+ flex-shrink: 0;
166
+ padding-top: var(--${e}-title-leading-gap, 0);
167
+ padding-bottom: var(--${e}-title-leading-gap, 0);
168
+ }
169
+ .${e}-show-text-hover .${e}-item-title,
170
+ .${e}-show-text-hover .${e}-item-subtitle {
171
+ opacity: 0;
172
+ transition: opacity 250ms;
173
+ }
174
+ .${e}-show-text-hover .${e}-item-inner:hover .${e}-item-title,
175
+ .${e}-show-text-hover .${e}-item-inner:hover .${e}-item-subtitle,
176
+ .${e}-show-text-hover .${e}-item-inner-hidden:hover .${e}-item-title,
177
+ .${e}-show-text-hover .${e}-item-inner-hidden:hover .${e}-item-subtitle {
178
+ opacity: 1;
179
+ }
180
+ @property --${e}-hover-zoom {
181
+ syntax: '<number>';
182
+ inherits: false;
183
+ initial-value: 1;
184
+ }
185
+ .${e}-hover-zoom-in .${e}-item-image,
186
+ .${e}-hover-zoom-in .${e}-item-video {
187
+ transform: scale(var(--${e}-hover-zoom));
188
+ clip-path: inset(calc(50% - 50% / var(--${e}-hover-zoom)) round calc(var(${ln}, 0px) / var(--${e}-hover-zoom)));
189
+ transition: --${e}-hover-zoom ${Et}ms ${Ot};
190
+ }
191
+ .${e}-hover-scale-down .${e}-item-image,
192
+ .${e}-hover-scale-down .${e}-item-video {
193
+ transition: transform ${Et}ms ${Ot};
194
+ }
195
+ .${e}-hover-greyscale .${e}-item-image-wrapper {
196
+ transition: filter ${Et}ms ${Ot};
197
+ }
198
+ @media (hover: hover) {
199
+ .${e}-hover-zoom-in .${e}-item-image-wrapper:has(.${e}-item-image:hover, .${e}-item-video:hover) :is(.${e}-item-image, .${e}-item-video) {
200
+ --${e}-hover-zoom: ${Ln};
201
+ }
202
+ .${e}-hover-scale-down .${e}-item-image-wrapper:hover .${e}-item-image,
203
+ .${e}-hover-scale-down .${e}-item-image-wrapper:hover .${e}-item-video {
204
+ transform: scale(0.9);
205
+ }
206
+ .${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)) {
207
+ filter: grayscale(1);
208
+ }
209
+ }
210
+ .${e}-type-a .${e}-item-inner,
211
+ .${e}-type-a .${e}-item-inner-hidden,
212
+ .${e}-type-d .${e}-item-inner,
213
+ .${e}-type-d .${e}-item-inner-hidden {
214
+ align-items: flex-start;
215
+ }
216
+ .${e}-type-b .${e}-item-inner,
217
+ .${e}-type-b .${e}-item-inner-hidden,
218
+ .${e}-type-e .${e}-item-inner,
219
+ .${e}-type-e .${e}-item-inner-hidden {
220
+ align-items: center;
221
+ }
222
+ .${e}-type-c .${e}-item-inner,
223
+ .${e}-type-c .${e}-item-inner-hidden,
224
+ .${e}-type-f .${e}-item-inner,
225
+ .${e}-type-f .${e}-item-inner-hidden {
226
+ align-items: flex-end;
227
+ }
228
+ .${e}-type-a .${e}-item-image-link,
229
+ .${e}-type-b .${e}-item-image-link,
230
+ .${e}-type-c .${e}-item-image-link,
231
+ .${e}-type-d .${e}-item-image-link,
232
+ .${e}-type-e .${e}-item-image-link,
233
+ .${e}-type-f .${e}-item-image-link {
234
+ align-items: center;
235
+ }
236
+ .${e}-type-a .${e}-item-title,
237
+ .${e}-type-a .${e}-item-subtitle,
238
+ .${e}-type-d .${e}-item-title,
239
+ .${e}-type-d .${e}-item-subtitle {
240
+ text-align: left;
241
+ }
242
+ .${e}-type-b .${e}-item-title,
243
+ .${e}-type-b .${e}-item-subtitle,
244
+ .${e}-type-e .${e}-item-title,
245
+ .${e}-type-e .${e}-item-subtitle {
246
+ text-align: center;
247
+ }
248
+ .${e}-type-c .${e}-item-title,
249
+ .${e}-type-c .${e}-item-subtitle,
250
+ .${e}-type-f .${e}-item-title,
251
+ .${e}-type-f .${e}-item-subtitle {
252
+ text-align: right;
253
+ }
254
+ .${e}-item-text-block {
255
+ display: flex;
256
+ flex-direction: column;
257
+ align-items: flex-start;
258
+ width: 100%;
259
+ flex-shrink: 0;
260
+ }
261
+ .${e}-type-d .${e}-item-text-block {
262
+ align-items: flex-start;
263
+ }
264
+ .${e}-type-e .${e}-item-text-block {
265
+ align-items: center;
266
+ }
267
+ .${e}-type-f .${e}-item-text-block {
268
+ align-items: flex-end;
269
+ }
270
+ .${e}-type-a .${e}-item-text-link,
271
+ .${e}-type-d .${e}-item-text-link {
272
+ align-items: flex-start;
273
+ }
274
+ .${e}-type-b .${e}-item-text-link,
275
+ .${e}-type-e .${e}-item-text-link {
276
+ align-items: center;
277
+ }
278
+ .${e}-type-c .${e}-item-text-link,
279
+ .${e}-type-f .${e}-item-text-link {
280
+ align-items: flex-end;
281
+ }
282
+ .${e}-image-align-top .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
283
+ align-items: flex-start;
284
+ }
285
+ .${e}-image-align-center .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
286
+ align-items: center;
287
+ }
288
+ .${e}-image-align-bottom .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
289
+ align-items: flex-end;
290
+ }
291
+ .${e}-image-align-top .${e}-item-slider .${e}-item-slide {
292
+ align-items: flex-start;
293
+ }
294
+ .${e}-image-align-center .${e}-item-slider .${e}-item-slide {
295
+ align-items: center;
296
+ }
297
+ .${e}-image-align-bottom .${e}-item-slider .${e}-item-slide {
298
+ align-items: flex-end;
299
+ }
300
+ .${e}-align-entries .${e}-item {
301
+ display: contents;
302
+ }
303
+ .${e}-align-entries .${e}-item-inner,
304
+ .${e}-align-entries .${e}-item-inner-hidden {
305
+ display: grid;
306
+ grid-template-rows: subgrid;
307
+ grid-row: span 3;
308
+ justify-self: center;
309
+ margin-bottom: var(--${e}-align-entries-row-gap, 0);
310
+ }
311
+ .${e}-align-entries .${e}-item-inner-last-row {
312
+ margin-bottom: 0;
313
+ }
314
+ .${e}-align-entries .${e}-item-text-link {
315
+ display: contents;
316
+ }
317
+ .${e}-align-entries .${e}-item-title-row,
318
+ .${e}-align-entries .${e}-item-subtitle-row {
319
+ display: flex;
320
+ flex-direction: column;
321
+ align-items: flex-start;
322
+ width: 100%;
323
+ min-height: 100%;
324
+ }
325
+ .${e}-type-a.${e}-align-entries .${e}-item-title-row,
326
+ .${e}-type-a.${e}-align-entries .${e}-item-subtitle-row,
327
+ .${e}-type-d.${e}-align-entries .${e}-item-title-row,
328
+ .${e}-type-d.${e}-align-entries .${e}-item-subtitle-row {
329
+ align-items: flex-start;
330
+ }
331
+ .${e}-type-b.${e}-align-entries .${e}-item-title-row,
332
+ .${e}-type-b.${e}-align-entries .${e}-item-subtitle-row,
333
+ .${e}-type-e.${e}-align-entries .${e}-item-title-row,
334
+ .${e}-type-e.${e}-align-entries .${e}-item-subtitle-row {
335
+ align-items: center;
336
+ }
337
+ .${e}-type-c.${e}-align-entries .${e}-item-title-row,
338
+ .${e}-type-c.${e}-align-entries .${e}-item-subtitle-row,
339
+ .${e}-type-f.${e}-align-entries .${e}-item-title-row,
340
+ .${e}-type-f.${e}-align-entries .${e}-item-subtitle-row {
341
+ align-items: flex-end;
342
+ }
343
+ .${e}-align-entries .${e}-item-image-link {
344
+ width: 100%;
345
+ height: 100%;
346
+ min-height: 100%;
347
+ display: flex;
348
+ flex-direction: column;
349
+ align-items: center;
350
+ justify-content: flex-start;
351
+ }
352
+ .${e}-align-entries .${e}-item-image-link > .${e}-item-image-wrapper {
353
+ flex-shrink: 0;
354
+ height: auto;
355
+ align-self: auto;
356
+ }
357
+ .${e}-image-align-top.${e}-align-entries .${e}-item-image-link > .${e}-item-image-wrapper {
358
+ margin-top: 0;
359
+ margin-bottom: auto;
360
+ }
361
+ .${e}-image-align-center.${e}-align-entries .${e}-item-image-link > .${e}-item-image-wrapper {
362
+ margin-top: auto;
363
+ margin-bottom: auto;
364
+ }
365
+ .${e}-image-align-bottom.${e}-align-entries .${e}-item-image-link > .${e}-item-image-wrapper {
366
+ margin-top: auto;
367
+ margin-bottom: 0;
368
+ }
369
+ .${e}-image-align-top.${e}-align-entries .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
370
+ align-items: flex-start;
371
+ }
372
+ .${e}-image-align-center.${e}-align-entries .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
373
+ align-items: center;
374
+ }
375
+ .${e}-image-align-bottom.${e}-align-entries .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
376
+ align-items: flex-end;
377
+ }
378
+ .${e}-image-align-top.${e}-align-entries .${e}-item-slider .${e}-item-slide {
379
+ align-items: flex-start;
380
+ }
381
+ .${e}-image-align-center.${e}-align-entries .${e}-item-slider .${e}-item-slide {
382
+ align-items: center;
383
+ }
384
+ .${e}-image-align-bottom.${e}-align-entries .${e}-item-slider .${e}-item-slide {
385
+ align-items: flex-end;
386
+ }
387
+ .${e}-image-align-top.${e}-align-entries .${e}-item-image-link {
388
+ justify-content: flex-start;
389
+ }
390
+ .${e}-image-align-center.${e}-align-entries .${e}-item-image-link {
391
+ justify-content: center;
392
+ }
393
+ .${e}-image-align-bottom.${e}-align-entries .${e}-item-image-link {
394
+ justify-content: flex-end;
395
+ }
396
+ .${e}-lightbox-counter {
397
+ margin: 0;
398
+ color: var(--${e}-lightbox-counter-color);
399
+ }
400
+ .${e}-lightbox {
401
+ position: fixed;
402
+ inset: 0;
403
+ z-index: 9997;
404
+ overscroll-behavior: none;
405
+ overflow: hidden;
406
+ }
407
+ .${e}-lightbox-editor {
408
+ inset: auto;
409
+ top: var(--cntrl-article-top, 0);
410
+ left: var(--cntrl-article-left, 0);
411
+ width: var(--cntrl-article-width, 100vw) !important;
412
+ height: var(--cntrl-viewport-height, 100vh) !important;
413
+ }
414
+ .${e}-control {
415
+ position: relative;
416
+ z-index: 2;
417
+ width: 100%;
418
+ }
419
+ .${e}-close-icon {
420
+ position: relative;
421
+ flex-shrink: 0;
422
+ pointer-events: auto;
423
+ z-index: 2;
424
+ display: flex;
425
+ align-items: center;
426
+ justify-content: center;
427
+ border: none;
428
+ background-color: transparent;
429
+ padding: 0;
430
+ }
431
+ .${e}-close-icon-inner {
432
+ all: unset;
433
+ position: relative;
434
+ cursor: pointer;
435
+ width: 100%;
436
+ height: 100%;
437
+ pointer-events: auto;
438
+ }
439
+ .${e}-close-icon-img {
440
+ position: absolute;
441
+ top: 50%;
442
+ left: 50%;
443
+ transform: translate(-50%, -50%);
444
+ }
445
+ `}function zn(){return Math.random()<.5?"ltr":"ttb"}function en(e,n){return n<=0?0:(e%n+n)%n}const de=500,_t=750,an="cubic-bezier(0.25, 1, 0.5, 1)",An=5e3,Me="cubic-bezier(0.22, 1, 0.36, 1)",Nn=72,Vn=50;function Fn(e){if(!Array.isArray(e)||e.length===0)return!1;const n=e[0];return n!==null&&typeof n=="object"&&"media"in n&&Array.isArray(n.media)}function Wn(e){const[n,t]=e.media;return t!=null&&t.assetId?t:n!=null&&n.assetId?n:null}function En(e){const[n]=e.media;return n!=null&&n.assetId?n:null}function cn(e){return!Array.isArray(e)||e.length===0?[]:Fn(e)?e.flatMap(n=>{const t=Wn(n);if(!t)return[];const l=En(n);return[{displayMedia:t,lightboxMedia:l!=null&&l.assetId?l:null}]}):e.filter(n=>n==null?void 0:n.assetId).map(n=>({displayMedia:n,lightboxMedia:n}))}function Fe(e){return!oe.isEmbedMedia(e)&&e.type==="video"}function On(e){const n=new Set,t=[];for(const l of e){const o=cn(l.gallery);for(const m of o){const u=m.lightboxMedia;u!=null&&u.assetId&&!n.has(u.assetId)&&(n.add(u.assetId),t.push(u))}}return t}const _n=s.memo(function({mediaList:n}){const[t,l]=s.useState(null);sn.useLazyVideos(t,{preload:"metadata"});const o=n.filter(m=>!oe.isEmbedMedia(m));return o.length===0?null:i.jsx("div",{ref:l,"aria-hidden":!0,style:{position:"absolute",width:0,height:0,overflow:"hidden",opacity:0,pointerEvents:"none"},children:o.map(m=>Fe(m)?i.jsx("video",{src:m.assetId,preload:"none",muted:!0,playsInline:!0},m.assetId):i.jsx("img",{src:m.assetId,alt:""},m.assetId))})});function Gn(e){e.pause(),e.removeAttribute("src"),e.load()}const un="cntrl-grid-slide",mn="cntrl-grid-slide-playing",Dn=`.${un} video`;function Hn(e){return e.closest(`.${mn}`)!==null}function Bn({prefix:e,slides:n,isFade:t,direction:l,intervalMs:o}){const m=n.length,u=!t&&m>1,L=!t&&l==="random",q=Number.isFinite(o)&&o>0?o:An,[r,v]=s.useState(u?1:0),[x,V]=s.useState(!t&&l==="vertical"?"ttb":"ltr"),[T,M]=s.useState(!1),[X,w]=s.useState(!1),[P,D]=s.useState(0),b=s.useRef(!1);s.useEffect(()=>{if(m<2)return;const j=window.setTimeout(()=>{if(b.current){D(S=>S+1);return}b.current=!0,M(!0),w(!1),v(S=>u?S+1:en(S+1,m)),L||D(S=>S+1)},q);return()=>window.clearTimeout(j)},[m,P,q,u,L]),s.useEffect(()=>{if(!T)return;const j=window.setTimeout(()=>{const S=u&&r===m+1,A=L?zn():x;(S||A!==x)&&(w(!0),S&&v(1),V(A)),b.current=!1,M(!1),L&&D(H=>H+1)},_t);return()=>window.clearTimeout(j)},[x,m,u,T,L,r]),s.useEffect(()=>{if(!X)return;let j=0;const S=requestAnimationFrame(()=>{j=requestAnimationFrame(()=>w(!1))});return()=>{cancelAnimationFrame(S),cancelAnimationFrame(j)}},[X]);const Z=u?m+2:m,h=j=>u?en(j-1,m):j,p=j=>u&&(j===0||j===m+1),I=h(r),W=r+1<Z?r+1:-1,F=j=>t||j===r&&!p(j)||j===W||W>=0&&!p(j)&&h(j)===h(W),E=!t&&x==="ttb",ee=t?void 0:{transform:E?`translate3d(0, ${-r*100}%, 0)`:`translate3d(${-r*100}%, 0, 0)`,transition:X?"none":`transform ${_t}ms ${an}`};return i.jsx("div",{className:`${e}-item-slider`,children:i.jsx("div",{className:`${e}-item-slider-list${t?` ${e}-item-slider-list-fade`:""}${E?` ${e}-item-slider-list-vertical`:""}`,style:ee,children:Array.from({length:Z},(j,S)=>{const A=h(S),H=p(S),Q=t?A===I:S===r;return i.jsx("div",{className:`${e}-item-slide ${un}${t&&Q?` ${e}-item-slide-active`:""}${F(S)?` ${mn}`:""}`,"aria-hidden":Q?void 0:!0,children:n[A]},H?`clone-${S===0?"start":"end"}`:`slide-${A}`)})})})}function tn({media:e,className:n,style:t,hasLightbox:l,isSliderSlide:o=!1,onMediaClick:m}){if(oe.isEmbedMedia(e))return i.jsx(oe.EmbedMediaFrame,{media:e,fit:t.objectFit==="contain"?"contain":"cover",silentLoop:l,className:n,style:{...t,cursor:m?"pointer":"default"},onClick:m});if(Fe(e)){const u={src:e.assetId,className:n,style:{...t,cursor:m?"pointer":"default"},muted:!0,loop:!0,playsInline:!0,onClick:m};return o?i.jsx("video",{...u,preload:"none"}):i.jsx(on.LazyVideo,{...u,autoPlay:!0})}return i.jsx("img",{src:e.assetId,alt:e.name,className:n,style:{...t,cursor:m?"pointer":"default"},onClick:m})}function qn({className:e,style:n,children:t}){const[l,o]=s.useState(null);return sn.useLazyVideos(l,{autoPlay:!0,selector:Dn,shouldPlay:Hn}),i.jsx("div",{ref:o,className:e,style:n,children:t})}function nn(e){const n=e.getBoundingClientRect();return{width:n.width,height:n.height,left:n.left,top:n.top}}function Un(e,n){if(!n||!n.width||!n.height||!e.width||!e.height)return e;const t=n.width/n.height,l=e.width/e.height;if(t>l){const m=e.width/t;return{width:e.width,height:m,left:e.left,top:e.top+(e.height-m)/2}}const o=e.height*t;return{width:o,height:e.height,left:e.left+(e.width-o)/2,top:e.top}}function Xn({src:e,mediaRef:n,mediaStyle:t,onLoadedMetadata:l}){return s.useEffect(()=>{const o=n.current;if(o)return()=>{Gn(o)}},[e,n]),i.jsx("video",{ref:n,src:e,muted:!0,autoPlay:!0,loop:!0,playsInline:!0,preload:"auto",onLoadedMetadata:l,style:t})}const Yn="https://cdn.cntrl.site/component-assets/defaultCloseIcon.svg",Kn=.004;function Zn({prefix:e,closeIcon:n=Yn,closeIconMaxWidth:t=.0125,closeIconColor:l="#FFFFFF",closeIconHoverColor:o="#999999",iconMarginRight:m=.01,contentMarginTop:u=.01,isEditor:L,isPreviewMode:q,isEditMode:r,visible:v,onClose:x}){if(!n)return null;const V=$.scalingValue(t,L),T=$.scalingValue(m,L),M=$.scalingValue(u,L),X=$.scalingValue(Math.max(u,Kn),L);return i.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,zIndex:1e4,display:"flex",flexDirection:"column",alignItems:"flex-end",pointerEvents:"none",opacity:v?1:0,transition:"opacity 500ms cubic-bezier(0.22, 1, 0.36, 1)"},children:[i.jsx("div",{style:{position:"relative",width:"100%",height:M,flexShrink:0},children:r&&i.jsx("div",{"data-controls":"contentMarginTop","data-controls-axis":"y","data-controls-min":"0",className:`${e}-control`,style:{position:"absolute",top:0,left:0,width:"100%",height:X,pointerEvents:v?"auto":"none"}})}),i.jsxs("div",{className:`${e}-close-icon`,style:{width:V,height:V,marginRight:T,pointerEvents:v?"auto":"none"},onClick:w=>w.stopPropagation(),children:[i.jsx("button",{type:"button",className:`${e}-close-icon-inner`,"aria-label":"Close",onClick:w=>{w.stopPropagation(),x()},children:i.jsx(Mn.SvgImage,{url:n,fill:l,hoverFill:L&&!q?l:o,className:`${e}-close-icon-img`})}),r&&i.jsx("div",{"data-controls":"iconMarginRight","data-controls-axis":"x","data-controls-reverse":"",className:`${e}-control`,style:{position:"absolute",top:0,left:"100%",width:T,height:"100%",pointerEvents:v?"auto":"none"}})]})]})}function Jn({prefix:e,items:n,index:t,imageDisplay:l,isEditor:o,isPreviewMode:m,isEditMode:u,onClose:L,onPrev:q,onNext:r,counterClassName:v,counterStyle:x,closeIcon:V,closeIconMaxWidth:T,closeIconColor:M,closeIconHoverColor:X,iconMarginRight:w,contentMarginTop:P}){const D=l==="cover",b=s.useRef(null),Z=s.useRef(null),h=s.useRef(null),p=s.useRef(null),I=s.useRef(0),W=s.useRef(0),F=s.useRef("none"),E=s.useRef(!1),ee=s.useRef(!1),j=s.useRef(null),S=s.useRef(0),A=s.useRef(null),H=s.useRef(!1),Q=s.useRef(null),ae=s.useRef(null),We=s.useRef(null),Je=s.useRef(()=>{}),[N,ye]=s.useState(null),[f,Ee]=s.useState(null),[U,Te]=s.useState("opening"),[he,Le]=s.useState(0),[ce,le]=s.useState(0),[be,ve]=s.useState(null),[Oe,Se]=s.useState(!1),[_e,Re]=s.useState(!1),[jt,ct]=s.useState(!1),[Ct,ut]=s.useState(null),mt=s.useRef(t),Qe=s.useRef(void 0),y=n[t],kt=y?Fe(y):!1,Pe=y?oe.isEmbedMedia(y):!1,Ge=be!==null,De=s.useCallback(a=>{const C=a.currentTarget,O=C instanceof HTMLVideoElement?{width:C.videoWidth,height:C.videoHeight}:{width:C.naturalWidth,height:C.naturalHeight};!O.width||!O.height||ut(O)},[]);s.useEffect(()=>{j.current=f},[f]),s.useEffect(()=>{const a=b.current;if(!a)return;const C=()=>Ee(nn(a));C();const O=new ResizeObserver(C);return O.observe(a),()=>O.disconnect()},[]);const Y=s.useCallback(()=>{Q.current!==null&&(window.clearTimeout(Q.current),Q.current=null)},[]),ge=s.useCallback(()=>{const a=ae.current;ae.current=null,Y(),A.current=null,H.current=!1,ve(null),Se(!1),le(0),S.current=0,Re(!1),E.current=!1,W.current=0,F.current="none",a===1?r():a===-1&&q()},[Y,r,q]),Ie=s.useCallback(()=>{Y(),ae.current=null,A.current=null,H.current=!1,ve(null),Se(!1),le(0),S.current=0},[Y]),dt=s.useCallback(()=>{Y(),Q.current=window.setTimeout(()=>{ae.current!==null&&ge()},de+32)},[Y,ge]),je=s.useCallback((a,C)=>{var Ae;const O=((Ae=j.current)==null?void 0:Ae.width)??0;if(Y(),A.current=a,ve(a),H.current=!0,Se(!0),C){ae.current=a;const fe=-a*O;S.current=fe,le(fe),dt();return}S.current=0,le(0),Q.current=window.setTimeout(()=>{Q.current=null,Ie()},de+32)},[Y,Ie,dt]),et=s.useCallback(a=>{if(!(n.length<=1)){if(H.current){if(ae.current===a){We.current=a,ge();return}Ie()}Y(),A.current=a,ve(a),H.current=!1,Se(!1),S.current=0,le(0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{je(a,!0)})})}},[n.length,je,ge,Ie,Y]);Je.current=et;const ht=s.useCallback(a=>{a.propertyName!=="transform"||!H.current||ae.current!==null&&ge()},[ge]),tt=s.useCallback(()=>{const a=Z.current;if(!a)return;const C=nn(a);!C.width||!C.height||ye(C)},[]);s.useEffect(()=>{tt();const a=Z.current;if(!a)return;const C=new ResizeObserver(()=>tt());return C.observe(a),()=>C.disconnect()},[tt]),s.useEffect(()=>{U==="opening"&&N&&Te("open")},[U,N]),s.useEffect(()=>{if(U!=="closing")return;const a=setTimeout(()=>L(),de);return()=>clearTimeout(a)},[U,L]),s.useEffect(()=>()=>{Y()},[Y]),s.useLayoutEffect(()=>{mt.current===t&&Qe.current===(y==null?void 0:y.assetId)||(Y(),ae.current=null,ve(null),Le(0),le(0),Se(!1),ct(!1),Re(!1),ut(null),I.current=0,W.current=0,F.current="none",E.current=!1,H.current=!1,S.current=0,A.current=null,p.current=null,ee.current=!1,mt.current=t,Qe.current=y==null?void 0:y.assetId)},[t,y==null?void 0:y.assetId,Y]),s.useLayoutEffect(()=>{const a=We.current;a!==null&&(We.current=null,requestAnimationFrame(()=>{Je.current(a)}))},[t,y==null?void 0:y.assetId]),s.useEffect(()=>{if(U!=="open")return;let a=null;const C=()=>{a&&(document.removeEventListener("click",a,!0),a=null)},O=()=>{C(),a=_=>{_.stopPropagation(),_.preventDefault(),C()},document.addEventListener("click",a,!0)},Ae=_=>{const ie=_<0?1:-1;if(Math.abs(_)>Vn&&n.length>1){je(ie,!0);return}je(ie,!1)},fe=_=>{if(_.touches.length!==1||H.current)return;const ie=_.touches[0];ee.current=!0,p.current={x:ie.clientX,y:ie.clientY},F.current="none",W.current=0,E.current=!1},qe=_=>{if(!p.current||_.touches.length!==1||H.current)return;const ie=_.touches[0],re=ie.clientX-p.current.x,$e=ie.clientY-p.current.y;if(F.current==="none"){if(Math.abs(re)<10&&Math.abs($e)<10)return;if(Math.abs(re)>Math.abs($e)){if(n.length<=1)return;F.current="horizontal"}else if($e>0)F.current="vertical";else return}if(F.current==="horizontal"){E.current=!0,Re(!0),W.current=re;const lt=re<0?1:-1;A.current!==lt&&(A.current=lt,ve(lt)),S.current=re,le(re),_.preventDefault();return}F.current==="vertical"&&(E.current=!0,Re(!0),I.current=$e,Le($e),_.preventDefault())},Ne=()=>{if(!p.current)return;const _=F.current,ie=E.current;if(ie&&_==="horizontal")Ae(W.current),O();else if(ie&&_==="vertical")if(I.current>Nn){const $e=window.innerHeight;I.current=$e,ct(!0),Le($e),Te("closing")}else I.current=0,Le(0),O();else _==="horizontal"&&Math.abs(W.current)>0&&(Ae(W.current),O());p.current=null,F.current="none",W.current=0,E.current=!1,Re(!1)};return document.addEventListener("touchstart",fe,{passive:!0}),document.addEventListener("touchmove",qe,{passive:!1}),document.addEventListener("touchend",Ne),document.addEventListener("touchcancel",Ne),()=>{document.removeEventListener("touchstart",fe),document.removeEventListener("touchmove",qe),document.removeEventListener("touchend",Ne),document.removeEventListener("touchcancel",Ne),C()}},[U,n.length,je]),s.useEffect(()=>{const a=C=>{C.key==="Escape"&&(C.preventDefault(),C.stopPropagation(),U!=="closing"&&Te("closing"))};return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[U]);const gt=()=>{U!=="closing"&&Te("closing")},c=U==="open",nt=U==="closing",it=he>0?Math.max(0,1-he/500):1,te=he>0?Math.max(.35,1-he/500):1,rt=Pe&&y?{width:oe.getEmbedAspect(y),height:1}:Ct,R=N?D?N:Un(N,rt):null,st={position:"fixed",top:f==null?void 0:f.top,left:f==null?void 0:f.left,width:f==null?void 0:f.width,height:f==null?void 0:f.height,zIndex:9998},ot=D?"cover":"contain",B=ce!==0||he>0?`translate(${ce}px, ${he}px)`:void 0,Mt=_e&&!Oe?"none":Oe?`transform ${de}ms ${Me}`:jt?`transform ${de}ms ${Me}, opacity ${de}ms ${Me}`:U==="opening"||nt?`opacity ${de}ms ${Me}`:"none",ze={...st,transform:B,opacity:he>0?te:U==="opening"||nt?0:1,transition:Mt,pointerEvents:"none"},He={position:"absolute",top:((R==null?void 0:R.top)??0)-((f==null?void 0:f.top)??0),left:((R==null?void 0:R.left)??0)-((f==null?void 0:f.left)??0),width:R==null?void 0:R.width,height:R==null?void 0:R.height,objectFit:ot,pointerEvents:"none"},ue=(f==null?void 0:f.width)??0,pe=Ge?(t+be+n.length)%n.length:null,ne=pe!==null?n[pe]:null,pt={...st,transform:Ge?`translateX(${be*ue+ce}px)`:void 0,opacity:1,transition:Oe?`transform ${de}ms ${Me}`:"none",pointerEvents:"none"},Be={position:"absolute",top:((N==null?void 0:N.top)??0)-((f==null?void 0:f.top)??0),left:((N==null?void 0:N.left)??0)-((f==null?void 0:f.left)??0),width:N==null?void 0:N.width,height:N==null?void 0:N.height,objectFit:ot,pointerEvents:"none"},ft=Pe&&y&&oe.getEmbedPlayback(y).controls&&R?Math.min(52,R.height*.2):0,$t=R?{position:"fixed",top:R.top,height:R.height-ft,width:R.width/2,zIndex:9999}:null;return i.jsxs("div",{ref:b,className:[`${e}-lightbox`,o?`${e}-lightbox-editor`:""].filter(Boolean).join(" "),style:{touchAction:U==="open"?"none":void 0},onClick:gt,children:[i.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(28,31,34,0.9)",opacity:c?it:0,transition:_e?"none":`opacity ${de}ms ${Me}`,pointerEvents:"none"}}),i.jsx("div",{style:{position:"relative",width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:D?i.jsxs(i.Fragment,{children:[i.jsx("div",{ref:Z,style:{position:"absolute",inset:0}}),i.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",height:"10%",opacity:c?1:0,transition:`opacity ${de}ms ${Me}`,pointerEvents:"none",zIndex:9999},children:n.length>1&&i.jsxs("p",{className:v,style:x,children:[t+1," / ",n.length]})})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{height:"10%"}}),i.jsx("div",{style:{width:"70%",height:"80%",display:"flex",justifyContent:"center",alignItems:"center"},children:i.jsx("div",{ref:Z,style:{width:"100%",height:"100%"}})}),i.jsx("div",{style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",height:"10%",opacity:c?1:0,transition:`opacity ${de}ms ${Me}`},children:n.length>1&&i.jsxs("p",{className:v,style:x,children:[t+1," / ",n.length]})})]})}),N&&f&&ne&&i.jsx("div",{style:pt,onTransitionEnd:ht,children:oe.isEmbedMedia(ne)?i.jsx("img",{src:ne.thumbnail,alt:ne.name,style:Be},`neighbor-${pe}-${ne.assetId}`):Fe(ne)?i.jsx("video",{src:ne.assetId,muted:!0,autoPlay:!0,loop:!0,playsInline:!0,preload:"auto",style:Be},`neighbor-${pe}-${ne.assetId}`):i.jsx("img",{src:ne.assetId,alt:ne.name,style:Be},`neighbor-${pe}-${ne.assetId}`)}),N&&f&&y&&i.jsx("div",{style:ze,onTransitionEnd:ht,children:Pe?i.jsx(oe.EmbedMediaFrame,{media:y,fit:D?"cover":"contain",lazy:!1,startsAtOnce:!0,style:He},`${t}-${y.assetId}`):kt?i.jsx(Xn,{src:y.assetId,mediaRef:h,mediaStyle:He,onLoadedMetadata:De},`${t}-${y.assetId}`):i.jsx("img",{ref:h,src:y.assetId,alt:y.name,onLoad:De,style:He},`${t}-${y.assetId}`)}),c&&$t&&n.length>1&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{...$t,left:R.left,cursor:"w-resize",pointerEvents:_e?"none":"auto"},onClick:a=>{if(ee.current){ee.current=!1;return}a.stopPropagation(),et(-1)}}),i.jsx("div",{style:{...$t,left:R.left+R.width/2,cursor:"e-resize",pointerEvents:_e?"none":"auto"},onClick:a=>{if(ee.current){ee.current=!1;return}a.stopPropagation(),et(1)}})]}),i.jsx(Zn,{prefix:e,closeIcon:V,closeIconMaxWidth:T,closeIconColor:M,closeIconHoverColor:X,iconMarginRight:w,contentMarginTop:P,isEditor:o,isPreviewMode:m,isEditMode:u,visible:c,onClose:gt})]})}function Qn(e){return typeof e=="string"?e==="cover"?"cover":"fit":(e==null?void 0:e.display)==="cover"?"cover":"fit"}function Gt(e,n){return e.columnWidth*n+e.gutterWidth*Math.max(0,n-1)}function Pn(e){return e.blocks.reduce((n,t)=>Math.max(n,Math.max(0,t.top)+Math.max(0,t.height)),0)}function dn(e){return typeof e.verticalGap=="number"?Math.max(0,e.verticalGap):Math.max(0,(e.repeatHeight??0)-Pn(e))}function hn(e,n){const t=e.blocks[n%e.blocks.length],l=Math.min(Math.max(1,Math.round(t.span)),e.columnsCount),o=Math.min(Math.max(0,Math.round(t.column)),e.columnsCount-l);return{column:o,span:l,width:Gt(e,l),top:Math.max(0,t.top),height:Math.max(0,t.height),gridColumn:`${o+1} / span ${l}`}}const It=1e-6;function ei(e,n,t){const l=e.beat??0,o=l>0&&!!t,m=r=>Math.ceil(r/l-.001)*l,u=[],L=[],q=dn(e);for(let r=0;r<n;r+=e.blocks.length){r>0&&q>0&&u.push(q);const v=Array.from({length:Math.min(e.blocks.length,n-r)},(h,p)=>hn(e,r+p)),x=v.map(h=>{const p=v.filter(I=>I.column<h.column+h.span&&h.column<I.column+I.span&&I.top>=h.top+h.height-It);return p.length>0?Math.min(...p.map(I=>I.top)):void 0}),V=[0,...v.map(h=>h.top)].sort((h,p)=>h-p).filter((h,p,I)=>p===0||h-I[p-1]>It),T=(h,p)=>Math.abs(h-p)<=It,M=h=>V.findIndex(p=>T(p,h)),X=[];let w=0;const P=h=>{const p=v.flatMap((F,E)=>h(x[E])?[{slot:F,entry:r+E}]:[]);if(p.length===0)return;if(!o){u.push("auto");return}const I=Math.max(...p.map(({slot:F,entry:E})=>X[M(F.top)]+(t[E]??0))),W=Math.max(0,m(I)-w);u.push(W),w+=W},D=V.map((h,p)=>(p>0&&(u.push(h-V[p-1]),w+=h-V[p-1]),P(I=>I!==void 0&&T(I,h)),X.push(w),u.length+1));P(h=>h===void 0);const b=u.length+1,Z=h=>D[M(h)];v.forEach((h,p)=>{const I=x[p];L.push(`${Z(h.top)} / ${I===void 0?b:Z(I)}`)})}return{tracks:u,gridRows:L}}function rn(e){return oe.isEmbedMedia(e)?oe.getEmbedAspect(e):e.width&&e.height&&e.width>0&&e.height>0?e.width/e.height:void 0}function ti(e,n,t){const l=e.blocks.length,o=dn(e),m=e.masonry==="on",u=[],L=[],q=v=>v.reduce((x,V)=>Math.max(x,V.bottom),0);let r=0;for(let v=0;v<n.length;v+=l){const x=v/l,V=Array.from({length:Math.min(l,n.length-v)},(T,M)=>v+M).sort((T,M)=>n[T].top-n[M].top||T-M);for(const T of V){const M=n[T],X=b=>b.column<M.column+M.span&&M.column<b.column+b.span,w=V.filter(b=>b!==T&&u[b]!==void 0&&X(n[b])&&n[b].top+n[b].height<=M.top+It),P=m?L.filter(b=>b.group<x&&X(b)):[],D=w.map(b=>u[b]+t[b]+M.top-(n[b].top+n[b].height));P.length>0&&D.push(q(P)+o),D.length===0&&D.push(r+M.top),u[T]=Math.max(...D),L.push({column:M.column,span:M.span,bottom:u[T]+t[T],group:x})}r=q(L)+o}return{tops:u,bottom:q(L)}}function ni({settings:e,content:n,isEditor:t,isPreviewMode:l,isEditMode:o,metadata:m,activeEvent:u,layoutId:L,portalId:q}){const{prefix:r}=Cn.useScopedStyles(),{type:v="a",gridLayout:x,customGrid:V,textBoxWidth:T=100,verticalGap:M,entriesCount:X,lightbox:w,imageDisplay:P,imageCorners:D,lightboxImageDisplay:b,slider:Z,sliderTiming:h,direction:p,transition:I,titleMarginTop:W,subtitleMarginTop:F,titleColor:E,subtitleColor:ee,lightboxCounterColor:j,titleFontFamily:S,titleFontSettings:A,titleFontSize:H,titleLineHeight:Q,titleLetterSpacing:ae,titleWordSpacing:We,titleTextAppearance:Je,subtitleFontFamily:N,subtitleFontSettings:ye,subtitleFontSize:f,subtitleLineHeight:Ee,subtitleLetterSpacing:U,subtitleWordSpacing:Te,subtitleTextAppearance:he,lightboxCounterFontFamily:Le,lightboxCounterFontSettings:ce,lightboxCounterFontSize:le,lightboxCounterLineHeight:be,lightboxCounterLetterSpacing:ve,lightboxCounterWordSpacing:Oe,lightboxCounterTextAppearance:Se,closeIcon:_e,closeIconMaxWidth:Re,closeIconColor:jt,closeIconHoverColor:ct,iconMarginRight:Ct,contentMarginTop:ut,showText:mt="always",hover:Qe="none",alignEntries:y="off",align:kt="top",textGrowth:Pe="inside"}=e,Ge=s.useMemo(()=>({...Ze.omitTextColors(Ze.textStylesToCss({fontSettings:{fontFamily:S,fontWeight:(A==null?void 0:A.fontWeight)??400,fontStyle:(A==null?void 0:A.fontStyle)??"normal"},fontSize:H??.01,lineHeight:Q,letterSpacing:ae??0,wordSpacing:We??0,textAppearance:Je,color:E},t)),...Wt(H,Q,r,t)}),[S,A,H,Q,ae,We,Je,E,t,r]),De=s.useMemo(()=>({...Ze.omitTextColors(Ze.textStylesToCss({fontSettings:{fontFamily:N,fontWeight:(ye==null?void 0:ye.fontWeight)??400,fontStyle:(ye==null?void 0:ye.fontStyle)??"normal"},fontSize:f??.01,lineHeight:Ee,letterSpacing:U??0,wordSpacing:Te??0,textAppearance:he,color:ee},t)),...Wt(f,Ee,r,t)}),[N,ye,f,Ee,U,Te,he,ee,t,r]),Y=s.useMemo(()=>({...Ze.omitTextColors(Ze.textStylesToCss({fontSettings:{fontFamily:Le,fontWeight:(ce==null?void 0:ce.fontWeight)??400,fontStyle:(ce==null?void 0:ce.fontStyle)??"normal"},fontSize:le??.01,lineHeight:be,letterSpacing:ve??0,wordSpacing:Oe??0,textAppearance:Se,color:j},t)),...Wt(le,be,r,t)}),[Le,ce,le,be,ve,Oe,Se,j,t,r]),ge=Ft(H,Q,`${r}-item-title`,`${r}-text-tight-leading`),Ie=Ft(f,Ee,`${r}-item-subtitle`,`${r}-text-tight-leading`),dt=Ft(le,be,`${r}-lightbox-counter`,`${r}-text-tight-leading`),je=s.useMemo(()=>jn.buildColorVars(r,{titleColor:E,subtitleColor:ee,lightboxCounterColor:j},ii,ri),[r,E,ee,j]),et=u&&u!=="default"?`${r}-state-${u}`:"",ht=mt==="on hover"&&(!t||l),tt=Qe!=="none"&&(!t||l)?` ${r}-hover-${Qe}`:"",gt=`${et}${ht?` ${r}-show-text-hover`:""}${tt}`.trim(),c=V&&Array.isArray(V.blocks)&&V.blocks.length>0?V:void 0,nt=c||X===0?1/0:X,it=!!c&&Pe==="outside",te=(c==null?void 0:c.cellHeight)==="auto",rt=te||(c==null?void 0:c.masonry)==="on",R=s.useRef([]),[st,ot]=s.useState([]),B=s.useMemo(()=>(n??[]).slice(0,nt),[n,nt]),Mt=s.useMemo(()=>w==="on"?On(B):[],[B,w]),ze=s.useMemo(()=>B.map(d=>{const g=cn(d.gallery),k=g.filter(z=>z.lightboxMedia).map(z=>z.lightboxMedia),G=g.map(({lightboxMedia:z})=>z?k.findIndex(xe=>xe.assetId===z.assetId):-1);return{displayItems:g,lightboxItemsForEntry:k,lightboxIndexes:G}}),[B]),He=(x==null?void 0:x.entryWidth)??.2,ue=typeof P=="string"?{display:P}:P,pe=(ue==null?void 0:ue.display)==="cover",ne=(ue==null?void 0:ue.ratioValue)??"1:1",pt=(ue==null?void 0:ue.reversed)??!1,[Be,ft]=ne.split(":").map(Number),C=`${pt?ft:Be} / ${pt?Be:ft}`,O=(x==null?void 0:x.columnsCount)??1,Ae=$.scalingValue(He??0,t),fe=Z!=="off"&&(c?te:!pe),qe=B.length%O||O,Ne=!c&&qe<O&&B.length>0,_=B.length-qe,ie=Ne?Math.floor((O-qe)/2)+1:1,re=D?$.scalingValue(D,t):void 0,$e=(d,g,k)=>({width:d,...g&&te?{height:k!=null&&k.isEmpty?$.scalingValue(g.height,t):"auto",flexShrink:0,overflow:"hidden",...k!=null&&k.aspect&&!fe?{aspectRatio:`${k.aspect}`}:{}}:g?it?{height:$.scalingValue(g.height,t),flexShrink:0,overflow:"hidden"}:{flex:"1 1 0%",minHeight:0,overflow:"hidden"}:pe?{aspectRatio:C,height:"auto",overflow:"hidden"}:{height:"auto"},...re?{borderRadius:re,overflow:"hidden"}:{}}),lt=`${r}-item-image-wrapper${fe?` ${r}-item-image-wrapper-fit-slider`:""}`.trim(),Ce=v==="d"||v==="e"||v==="f",we=!c&&y==="on",Tt=re?{borderRadius:re,[ln]:re}:{},Lt=te?{objectFit:fe&&!pe?"contain":"cover",pointerEvents:"auto",width:"100%",height:"100%",maxWidth:"100%",...Tt}:pe?{objectFit:"cover",pointerEvents:"auto",width:"100%",height:"100%",maxWidth:"100%",...Tt}:{objectFit:"contain",pointerEvents:"auto",width:"auto",height:"auto",maxWidth:"100%",...c?{maxHeight:"100%"}:{},...Tt},Rt=((c==null?void 0:c.beat)??0)>0||rt,zt=c?Gt(c,c.columnsCount):0;s.useLayoutEffect(()=>{if(!Rt){ot(z=>z.length>0?[]:z);return}const d=yt.current,g=R.current.slice(0,B.length),k=()=>{const z=d&&zt>0?d.offsetWidth/zt:0;if(z<=0)return;const xe=g.map(se=>se?se.offsetHeight/z:0);ot(se=>se.length===xe.length&&se.every((J,me)=>Math.abs(J-xe[me])<1e-5)?se:xe)};k();const G=new ResizeObserver(k);return d&&G.observe(d),g.forEach(z=>z&&G.observe(z)),()=>G.disconnect()},[Rt,B.length,zt,r]);const Ue=Rt&&st.length===B.length?st:void 0,Xe=s.useMemo(()=>{if(!c)return;const d=ei(c,B.length,Ue);return{gridRows:d.gridRows,gridTemplateRows:d.tracks.length?d.tracks.map(g=>g==="auto"?"auto":$.scalingValue(g,t)).join(" "):"auto"}},[c,B.length,Ue,t]),Ve=s.useMemo(()=>c?B.map((d,g)=>hn(c,g)):void 0,[c,B.length]),gn=s.useMemo(()=>ze.map(({displayItems:d})=>te&&d.length>0?rn(d[0].displayMedia):void 0),[ze,te]),xt=s.useMemo(()=>{if(!c||!Ve||!rt)return;const d=c.beat??0,g=Ve.map((k,G)=>{const xe=ze[G].displayItems.map(({displayMedia:me})=>rn(me)).filter(me=>me!==void 0),se=te&&xe.length>0?Math.max(...xe.map(me=>k.width/me)):k.height,J=(Ue==null?void 0:Ue[G])??se;return d>0?Math.ceil(J/d-.001)*d:J});return ti(c,Ve,g)},[c,Ve,rt,te,ze,Ue]),pn=c?{gridTemplateColumns:`repeat(${c.columnsCount}, ${$.scalingValue(c.columnWidth,t)})`,gridTemplateRows:(Xe==null?void 0:Xe.gridTemplateRows)??"auto",rowGap:0,columnGap:$.scalingValue(c.gutterWidth,t),width:$.scalingValue(Gt(c,c.columnsCount),t),...xt?{position:"relative",height:$.scalingValue(xt.bottom,t)}:{}}:{gridTemplateColumns:`repeat(${O}, ${Ae})`,rowGap:we?0:$.scalingValue(M??0,t),columnGap:$.scalingValue((x==null?void 0:x.horizontalGap)??0,t),width:$.scalingValue((x==null?void 0:x.wrapperWidth)??0,t),...we?{[`--${r}-align-entries-row-gap`]:$.scalingValue(M??0,t)}:{}},yt=s.useRef(null),fn=()=>{const d={...je},g=yt.current?getComputedStyle(yt.current).getPropertyValue("--cntrl-article-width").trim():"";return g&&(d["--cntrl-article-width"]=g),d},[At,Nt]=s.useState(!1),[vt,$n]=s.useState([]),[xn,Vt]=s.useState(0),Dt=w==="on"&&(!t||l),Ht=(d,g)=>{t&&!l||w!=="off"&&($n(d),Vt(g),Nt(!0))};s.useEffect(()=>{if(!At||w!=="on"||typeof document>"u")return;const d=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=d}},[At,w]),s.useEffect(()=>{!t||l||Nt(!1)},[t,l]);const yn=s.useMemo(()=>Rn(r),[r]);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:yn}}),w==="on"&&i.jsx(_n,{mediaList:Mt}),i.jsx("div",{style:je,children:i.jsx("div",{ref:yt,className:`${r}-wrapper ${r}-type-${v}${we?` ${r}-align-entries`:""}${c?` ${r}-custom-layout`:""}${it?` ${r}-text-outside`:""}${te?` ${r}-auto-height`:""} ${r}-image-align-${c?"top":kt} ${gt}`.trim(),style:pn,children:B.map((d,g)=>{var Jt;const k=Pt(d.title),G=Pt(d.subtitle),z=w==="off"&&((Jt=d.link)!=null&&Jt.value)?d.link:void 0,xe=Math.floor(g/O)===Math.ceil(B.length/O)-1,se=Ne&&g>=_?`${ie+(g-_)}`:void 0,J=Ve==null?void 0:Ve[g],me=(J==null?void 0:J.width)??He,at=$.scalingValue(me,t),Ye=`calc(${at} * (${T} / 100))`,ke=$.scalingValue(me*T/100,t),{displayItems:Ke,lightboxItemsForEntry:Bt,lightboxIndexes:qt}=ze[g],Ut=Z==="off"?gn[g]:void 0,vn=$e(at,J,{aspect:Ut,isEmpty:Ke.length===0}),wn=te&&Z==="off"&&!Ut?{...Lt,height:"auto"}:Lt,bn=J&&c&&xt?{position:"absolute",left:$.scalingValue(J.column*(c.columnWidth+c.gutterWidth),t),top:$.scalingValue(xt.tops[g],t),width:at}:J?{gridColumn:J.gridColumn,gridRow:Xe==null?void 0:Xe.gridRows[g],alignSelf:"start"}:se&&!we?{gridColumn:se}:void 0,Xt=Ce?i.jsxs("div",{className:`${r}-item-text-block`,children:[k&&i.jsx("p",{className:ge,style:{width:Ye,...Ge},children:d.title}),k&&i.jsx("div",{"data-controls":o?"titleMarginTop":void 0,className:o?`${r}-control`:void 0,style:{height:$.scalingValue(W??0,t),width:ke}}),G&&i.jsx("p",{className:Ie,style:{width:Ye,...De},children:d.subtitle}),G&&i.jsx("div",{"data-controls":o?"subtitleMarginTop":void 0,className:o?`${r}-control`:void 0,style:{height:$.scalingValue(F??0,t),width:ke}})]}):null,Sn=we?i.jsxs("div",{className:`${r}-item-title-row`,children:[!Ce&&i.jsx("div",{"data-controls":o&&k?"titleMarginTop":void 0,className:o&&k?`${r}-control`:void 0,style:{height:k?$.scalingValue(W??0,t):0,width:ke}}),k&&i.jsx("p",{className:ge,style:{width:Ye,...Ge},children:d.title}),Ce&&k&&i.jsx("div",{"data-controls":o?"titleMarginTop":void 0,className:o?`${r}-control`:void 0,style:{height:$.scalingValue(W??0,t),width:ke}})]}):null,In=we?i.jsxs("div",{className:`${r}-item-subtitle-row`,children:[!Ce&&i.jsx("div",{"data-controls":o&&G?"subtitleMarginTop":void 0,className:o&&G?`${r}-control`:void 0,style:{height:G?$.scalingValue(F??0,t):0,width:ke}}),G&&i.jsx("p",{className:Ie,style:{width:Ye,...De},children:d.subtitle}),Ce&&G&&i.jsx("div",{"data-controls":o?"subtitleMarginTop":void 0,className:o?`${r}-control`:void 0,style:{height:$.scalingValue(F??0,t),width:ke}})]}):null,Yt=i.jsxs(St.LinkWrapper,{link:z,className:`${r}-item-text-link`,children:[Sn,In]}),wt=i.jsx(qn,{className:lt,style:vn,children:Ke.length===0?null:Z==="off"?(()=>{const{displayMedia:K}=Ke[0],bt=qt[0];return i.jsx(tn,{media:K,className:`${r}-item-${Fe(K)?"video":"image"}`.trim(),style:wn,hasLightbox:w==="on",onMediaClick:Dt&&bt>=0?()=>Ht(Bt,bt):void 0})})():i.jsxs(i.Fragment,{children:[fe&&i.jsx("div",{className:`${r}-item-image-wrapper-sizer`,"aria-hidden":"true",children:Ke.map(({displayMedia:K})=>oe.isEmbedMedia(K)?i.jsx("div",{style:{aspectRatio:`${oe.getEmbedAspect(K)}`}},`sizer-${K.assetId}`):Fe(K)?i.jsx(on.LazyVideo,{src:K.assetId,nearPreload:"metadata",muted:!0,playsInline:!0},`sizer-${K.assetId}`):i.jsx("img",{src:K.assetId,alt:""},`sizer-${K.assetId}`))}),i.jsx(Bn,{prefix:r,isFade:I==="fade",direction:p,intervalMs:h*1e3,slides:Ke.map(({displayMedia:K},bt)=>{const Qt=qt[bt];return i.jsx(tn,{media:K,className:`${r}-item-${Fe(K)?"video":"image"}`.trim(),style:Lt,hasLightbox:w==="on",isSliderSlide:!0,onMediaClick:Dt&&Qt>=0?()=>Ht(Bt,Qt):void 0})})},`${I}-${me}-${p}-${h}-${L}-${Ke.length}`)]})}),Kt=Ce?null:i.jsxs(i.Fragment,{children:[i.jsx("div",{"data-controls":o&&k?"titleMarginTop":void 0,className:o&&k?`${r}-control`:void 0,style:{height:k?$.scalingValue(W??0,t):0,width:ke}}),i.jsx("p",{className:ge,style:{width:Ye,...Ge},children:d.title}),i.jsx("div",{"data-controls":o&&G?"subtitleMarginTop":void 0,className:o&&G?`${r}-control`:void 0,style:{height:G?$.scalingValue(F??0,t):0,width:ke}}),i.jsx("p",{className:Ie,style:{width:Ye,...De},children:d.subtitle})]}),Zt=z?i.jsx(St.LinkWrapper,{link:z,className:`${r}-item-image-link`,children:wt}):i.jsx("a",{className:`${r}-item-image-link`,children:wt});return i.jsx("div",{className:`${r}-item`.trim(),style:bn,children:i.jsx("div",{ref:K=>{R.current[g]=K},className:`${o?`${r}-item-inner`:`${r}-item-inner-hidden`}${we&&xe?` ${r}-item-inner-last-row`:""}`.trim(),style:{width:(T??0)>100?`calc(${at} * (${T} / 100))`:at,...J&&!it&&!te?{height:$.scalingValue(J.height,t)}:{},...se&&we?{gridColumn:se}:{}},children:we?i.jsx(i.Fragment,{children:Ce?i.jsxs(i.Fragment,{children:[Yt,Zt]}):i.jsxs(i.Fragment,{children:[Zt,Yt]})}):z?i.jsxs(i.Fragment,{children:[i.jsxs(St.LinkWrapper,{link:z,className:`${r}-item-image-link`,children:[Xt,wt]}),!Ce&&i.jsx(St.LinkWrapper,{link:z,className:`${r}-item-text-link`,children:Kt})]}):i.jsxs(i.Fragment,{children:[Xt,wt,Kt]})})},g)})})}),(!t||l)&&At&&typeof document<"u"&&w==="on"&&(()=>{const d=(q?document.getElementById(q):null)??document.body;return kn.createPortal(i.jsx("div",{style:fn(),"data-selection":"none",children:i.jsx(Jn,{prefix:r,items:vt,index:xn,imageDisplay:Qn(b),isEditor:t,isPreviewMode:l,isEditMode:o,closeIcon:_e,closeIconMaxWidth:Re,closeIconColor:jt,closeIconHoverColor:ct,iconMarginRight:Ct,contentMarginTop:ut,onClose:()=>Nt(!1),onPrev:()=>Vt(g=>(g-1+vt.length)%vt.length),onNext:()=>Vt(g=>(g+1)%vt.length),counterClassName:dt,counterStyle:Y})}),d)})()]})}const ii={titleColor:"title-color",subtitleColor:"subtitle-color",lightboxCounterColor:"lightbox-counter-color"},ri=["hover","focus","filled","success","error"];exports.Grid=ni;
@@ -1,7 +1,7 @@
1
1
  import { ControlSlider as e } from "./ControlSlider-BBAXRDLP.mjs";
2
2
  import { ImageRevealSlider as t } from "./ImageRevealSlider-DifEXySR.mjs";
3
3
  import { LightboxGallery as i } from "./Lightbox-BY99NS14.mjs";
4
- import { C as o, F as r, O as p, M as n, a as l, T as s, b as a, G as c, c as y, H as g, L as m, d, e as u, f as b, S as h, W as f, g as v, h as C, i as x, j as S, B as k, P as I, k as j } from "./ChroniclesComponent-B-93AhZK.mjs";
4
+ import { C as o, F as r, O as p, M as n, a as l, T as s, b as a, G as c, c as y, H as g, L as m, d, e as u, f as b, S as h, W as f, g as v, h as C, i as x, j as S, B as k, P as I, k as j } from "./ChroniclesComponent-Bf8jxaas.mjs";
5
5
  const E = {
6
6
  element: e,
7
7
  id: "control-slider",