@cntrl-site/components 1.0.118-alpha.2 → 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.
@@ -1,415 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),Zt=require("./react-splide.esm-CabaEmHi.js");;/* empty css */const m=require("./scalingValue-CSHYgTZl.js"),Si=require("./buildColorVars-CE2D5cQV.js"),Ci=require("./useScopedStyles-Bf6yohVQ.js"),ti=require("./useLazyVideos-CdCbc2j0.js"),xt=require("./LinkWrapper-CTqM1ucO.js"),K=require("./EmbedMediaFrame-DsOTKE4i.js"),r=require("react"),ji=require("react-dom"),We=require("./textStylesToCss-CNN3zZTV.js"),ki=require("./SvgImage-DFlmxAoL.js"),ii=require("./LazyVideo-imbU18js.js");function Ii(e){return`calc(var(--cntrl-article-width, 100vw) * ${e/1440})`}function Jt(e){return((e==null?void 0:e.trim().length)??0)>0}function Rt(e,t,i,l){return t!==void 0&&t<(e??.01)?`${i} ${l}`:i}function Vt(e,t,i,l){const o=e??.01;return t===void 0||t>=o?{}:{[`--${i}-title-leading-gap`]:m.scalingValue((o-t)/2,l)}}const Nt=400,Ft="cubic-bezier(0.25, 0.1, 0.25, 1)",Ti=1.1,ni="--grid-media-radius";function Li(e){return`
2
- .${e}-wrapper {
3
- display: grid;
4
- align-items: start;
5
- justify-content: center;
6
- min-height: ${Ii(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-slider .splide__track {
68
- overflow: hidden;
69
- }
70
- .${e}-item-image-link {
71
- width: 100%;
72
- display: flex;
73
- flex-direction: column;
74
- align-items: center;
75
- }
76
- .${e}-custom-layout .${e}-item-image-link {
77
- flex: 1 1 0%;
78
- min-height: 0;
79
- }
80
- .${e}-custom-layout.${e}-text-outside .${e}-item-image-link {
81
- flex: none;
82
- }
83
- .${e}-item-text-link {
84
- display: flex;
85
- flex-direction: column;
86
- align-items: center;
87
- width: 100%;
88
- color: inherit;
89
- text-decoration: none;
90
- }
91
- .${e}-item-image {
92
- width: 100%;
93
- height: 100%;
94
- display: block;
95
- max-width: 100%;
96
- }
97
- .${e}-item-video {
98
- width: 100%;
99
- height: 100%;
100
- display: block;
101
- max-width: 100%;
102
- }
103
- .${e}-item-slider,
104
- .${e}-item-slider .splide__track,
105
- .${e}-item-slider .splide__list,
106
- .${e}-item-slider .splide__slide {
107
- width: 100%;
108
- height: 100%;
109
- }
110
- .${e}-item-slider .splide__slide {
111
- display: flex;
112
- justify-content: center;
113
- align-items: center;
114
- }
115
- .${e}-item-title {
116
- white-space: normal;
117
- overflow-wrap: anywhere;
118
- word-break: break-word;
119
- text-align: center;
120
- margin-bottom: 0px;
121
- margin-top: 0px;
122
- color: var(--${e}-title-color);
123
- }
124
- .${e}-item-subtitle {
125
- white-space: normal;
126
- overflow-wrap: anywhere;
127
- word-break: break-word;
128
- text-align: center;
129
- margin-bottom: 0px;
130
- margin-top: 0px;
131
- color: var(--${e}-subtitle-color);
132
- }
133
- .${e}-text-tight-leading {
134
- display: block;
135
- flex-shrink: 0;
136
- padding-top: var(--${e}-title-leading-gap, 0);
137
- padding-bottom: var(--${e}-title-leading-gap, 0);
138
- }
139
- .${e}-show-text-hover .${e}-item-title,
140
- .${e}-show-text-hover .${e}-item-subtitle {
141
- opacity: 0;
142
- transition: opacity 250ms;
143
- }
144
- .${e}-show-text-hover .${e}-item-inner:hover .${e}-item-title,
145
- .${e}-show-text-hover .${e}-item-inner:hover .${e}-item-subtitle,
146
- .${e}-show-text-hover .${e}-item-inner-hidden:hover .${e}-item-title,
147
- .${e}-show-text-hover .${e}-item-inner-hidden:hover .${e}-item-subtitle {
148
- opacity: 1;
149
- }
150
- @property --${e}-hover-zoom {
151
- syntax: '<number>';
152
- inherits: false;
153
- initial-value: 1;
154
- }
155
- .${e}-hover-zoom-in .${e}-item-image,
156
- .${e}-hover-zoom-in .${e}-item-video {
157
- transform: scale(var(--${e}-hover-zoom));
158
- clip-path: inset(calc(50% - 50% / var(--${e}-hover-zoom)) round calc(var(${ni}, 0px) / var(--${e}-hover-zoom)));
159
- transition: --${e}-hover-zoom ${Nt}ms ${Ft};
160
- }
161
- .${e}-hover-scale-down .${e}-item-image,
162
- .${e}-hover-scale-down .${e}-item-video {
163
- transition: transform ${Nt}ms ${Ft};
164
- }
165
- .${e}-hover-greyscale .${e}-item-image-wrapper {
166
- transition: filter ${Nt}ms ${Ft};
167
- }
168
- @media (hover: hover) {
169
- .${e}-hover-zoom-in .${e}-item-image-wrapper:has(.${e}-item-image:hover, .${e}-item-video:hover) :is(.${e}-item-image, .${e}-item-video) {
170
- --${e}-hover-zoom: ${Ti};
171
- }
172
- .${e}-hover-scale-down .${e}-item-image-wrapper:hover .${e}-item-image,
173
- .${e}-hover-scale-down .${e}-item-image-wrapper:hover .${e}-item-video {
174
- transform: scale(0.9);
175
- }
176
- .${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)) {
177
- filter: grayscale(1);
178
- }
179
- }
180
- .${e}-type-a .${e}-item-inner,
181
- .${e}-type-a .${e}-item-inner-hidden,
182
- .${e}-type-d .${e}-item-inner,
183
- .${e}-type-d .${e}-item-inner-hidden {
184
- align-items: flex-start;
185
- }
186
- .${e}-type-b .${e}-item-inner,
187
- .${e}-type-b .${e}-item-inner-hidden,
188
- .${e}-type-e .${e}-item-inner,
189
- .${e}-type-e .${e}-item-inner-hidden {
190
- align-items: center;
191
- }
192
- .${e}-type-c .${e}-item-inner,
193
- .${e}-type-c .${e}-item-inner-hidden,
194
- .${e}-type-f .${e}-item-inner,
195
- .${e}-type-f .${e}-item-inner-hidden {
196
- align-items: flex-end;
197
- }
198
- .${e}-type-a .${e}-item-image-link,
199
- .${e}-type-b .${e}-item-image-link,
200
- .${e}-type-c .${e}-item-image-link,
201
- .${e}-type-d .${e}-item-image-link,
202
- .${e}-type-e .${e}-item-image-link,
203
- .${e}-type-f .${e}-item-image-link {
204
- align-items: center;
205
- }
206
- .${e}-type-a .${e}-item-title,
207
- .${e}-type-a .${e}-item-subtitle,
208
- .${e}-type-d .${e}-item-title,
209
- .${e}-type-d .${e}-item-subtitle {
210
- text-align: left;
211
- }
212
- .${e}-type-b .${e}-item-title,
213
- .${e}-type-b .${e}-item-subtitle,
214
- .${e}-type-e .${e}-item-title,
215
- .${e}-type-e .${e}-item-subtitle {
216
- text-align: center;
217
- }
218
- .${e}-type-c .${e}-item-title,
219
- .${e}-type-c .${e}-item-subtitle,
220
- .${e}-type-f .${e}-item-title,
221
- .${e}-type-f .${e}-item-subtitle {
222
- text-align: right;
223
- }
224
- .${e}-item-text-block {
225
- display: flex;
226
- flex-direction: column;
227
- align-items: flex-start;
228
- width: 100%;
229
- flex-shrink: 0;
230
- }
231
- .${e}-type-d .${e}-item-text-block {
232
- align-items: flex-start;
233
- }
234
- .${e}-type-e .${e}-item-text-block {
235
- align-items: center;
236
- }
237
- .${e}-type-f .${e}-item-text-block {
238
- align-items: flex-end;
239
- }
240
- .${e}-type-a .${e}-item-text-link,
241
- .${e}-type-d .${e}-item-text-link {
242
- align-items: flex-start;
243
- }
244
- .${e}-type-b .${e}-item-text-link,
245
- .${e}-type-e .${e}-item-text-link {
246
- align-items: center;
247
- }
248
- .${e}-type-c .${e}-item-text-link,
249
- .${e}-type-f .${e}-item-text-link {
250
- align-items: flex-end;
251
- }
252
- .${e}-image-align-top .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
253
- align-items: flex-start;
254
- }
255
- .${e}-image-align-center .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
256
- align-items: center;
257
- }
258
- .${e}-image-align-bottom .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
259
- align-items: flex-end;
260
- }
261
- .${e}-image-align-top .${e}-item-slider .splide__slide {
262
- align-items: flex-start;
263
- }
264
- .${e}-image-align-center .${e}-item-slider .splide__slide {
265
- align-items: center;
266
- }
267
- .${e}-image-align-bottom .${e}-item-slider .splide__slide {
268
- align-items: flex-end;
269
- }
270
- .${e}-align-entries .${e}-item {
271
- display: contents;
272
- }
273
- .${e}-align-entries .${e}-item-inner,
274
- .${e}-align-entries .${e}-item-inner-hidden {
275
- display: grid;
276
- grid-template-rows: subgrid;
277
- grid-row: span 3;
278
- justify-self: center;
279
- margin-bottom: var(--${e}-align-entries-row-gap, 0);
280
- }
281
- .${e}-align-entries .${e}-item-inner-last-row {
282
- margin-bottom: 0;
283
- }
284
- .${e}-align-entries .${e}-item-text-link {
285
- display: contents;
286
- }
287
- .${e}-align-entries .${e}-item-title-row,
288
- .${e}-align-entries .${e}-item-subtitle-row {
289
- display: flex;
290
- flex-direction: column;
291
- align-items: flex-start;
292
- width: 100%;
293
- min-height: 100%;
294
- }
295
- .${e}-type-a.${e}-align-entries .${e}-item-title-row,
296
- .${e}-type-a.${e}-align-entries .${e}-item-subtitle-row,
297
- .${e}-type-d.${e}-align-entries .${e}-item-title-row,
298
- .${e}-type-d.${e}-align-entries .${e}-item-subtitle-row {
299
- align-items: flex-start;
300
- }
301
- .${e}-type-b.${e}-align-entries .${e}-item-title-row,
302
- .${e}-type-b.${e}-align-entries .${e}-item-subtitle-row,
303
- .${e}-type-e.${e}-align-entries .${e}-item-title-row,
304
- .${e}-type-e.${e}-align-entries .${e}-item-subtitle-row {
305
- align-items: center;
306
- }
307
- .${e}-type-c.${e}-align-entries .${e}-item-title-row,
308
- .${e}-type-c.${e}-align-entries .${e}-item-subtitle-row,
309
- .${e}-type-f.${e}-align-entries .${e}-item-title-row,
310
- .${e}-type-f.${e}-align-entries .${e}-item-subtitle-row {
311
- align-items: flex-end;
312
- }
313
- .${e}-align-entries .${e}-item-image-link {
314
- width: 100%;
315
- height: 100%;
316
- min-height: 100%;
317
- display: flex;
318
- flex-direction: column;
319
- align-items: center;
320
- justify-content: flex-start;
321
- }
322
- .${e}-align-entries .${e}-item-image-link > .${e}-item-image-wrapper {
323
- flex-shrink: 0;
324
- height: auto;
325
- align-self: auto;
326
- }
327
- .${e}-image-align-top.${e}-align-entries .${e}-item-image-link > .${e}-item-image-wrapper {
328
- margin-top: 0;
329
- margin-bottom: auto;
330
- }
331
- .${e}-image-align-center.${e}-align-entries .${e}-item-image-link > .${e}-item-image-wrapper {
332
- margin-top: auto;
333
- margin-bottom: auto;
334
- }
335
- .${e}-image-align-bottom.${e}-align-entries .${e}-item-image-link > .${e}-item-image-wrapper {
336
- margin-top: auto;
337
- margin-bottom: 0;
338
- }
339
- .${e}-image-align-top.${e}-align-entries .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
340
- align-items: flex-start;
341
- }
342
- .${e}-image-align-center.${e}-align-entries .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
343
- align-items: center;
344
- }
345
- .${e}-image-align-bottom.${e}-align-entries .${e}-item-image-wrapper:not(.${e}-item-image-wrapper-fit-slider) {
346
- align-items: flex-end;
347
- }
348
- .${e}-image-align-top.${e}-align-entries .${e}-item-slider .splide__slide {
349
- align-items: flex-start;
350
- }
351
- .${e}-image-align-center.${e}-align-entries .${e}-item-slider .splide__slide {
352
- align-items: center;
353
- }
354
- .${e}-image-align-bottom.${e}-align-entries .${e}-item-slider .splide__slide {
355
- align-items: flex-end;
356
- }
357
- .${e}-image-align-top.${e}-align-entries .${e}-item-image-link {
358
- justify-content: flex-start;
359
- }
360
- .${e}-image-align-center.${e}-align-entries .${e}-item-image-link {
361
- justify-content: center;
362
- }
363
- .${e}-image-align-bottom.${e}-align-entries .${e}-item-image-link {
364
- justify-content: flex-end;
365
- }
366
- .${e}-lightbox-counter {
367
- margin: 0;
368
- color: var(--${e}-lightbox-counter-color);
369
- }
370
- .${e}-lightbox {
371
- position: fixed;
372
- inset: 0;
373
- z-index: 9997;
374
- overscroll-behavior: none;
375
- overflow: hidden;
376
- }
377
- .${e}-lightbox-editor {
378
- inset: auto;
379
- top: var(--cntrl-article-top, 0);
380
- left: var(--cntrl-article-left, 0);
381
- width: var(--cntrl-article-width, 100vw) !important;
382
- height: var(--cntrl-viewport-height, 100vh) !important;
383
- }
384
- .${e}-control {
385
- position: relative;
386
- z-index: 2;
387
- width: 100%;
388
- }
389
- .${e}-close-icon {
390
- position: relative;
391
- flex-shrink: 0;
392
- pointer-events: auto;
393
- z-index: 2;
394
- display: flex;
395
- align-items: center;
396
- justify-content: center;
397
- border: none;
398
- background-color: transparent;
399
- padding: 0;
400
- }
401
- .${e}-close-icon-inner {
402
- all: unset;
403
- position: relative;
404
- cursor: pointer;
405
- width: 100%;
406
- height: 100%;
407
- pointer-events: auto;
408
- }
409
- .${e}-close-icon-img {
410
- position: absolute;
411
- top: 50%;
412
- left: 50%;
413
- transform: translate(-50%, -50%);
414
- }
415
- `}function _i(){return Math.random()<.5?"ltr":"ttb"}function Mi(e){const t=e.Components.Autoplay;t&&(t.pause(!1),t.play())}function zi(e){const t=_i();e.options.direction!==t&&(e.options={...e.options,direction:t}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Mi(e)})})}const Y=500,Ri=750,fe="cubic-bezier(0.22, 1, 0.36, 1)",Vi=72,Ni=50;function Fi(e){if(!Array.isArray(e)||e.length===0)return!1;const t=e[0];return t!==null&&typeof t=="object"&&"media"in t&&Array.isArray(t.media)}function Ai(e){const[t,i]=e.media;return i!=null&&i.assetId?i:t!=null&&t.assetId?t:null}function Wi(e){const[t]=e.media;return t!=null&&t.assetId?t:null}function si(e){return!Array.isArray(e)||e.length===0?[]:Fi(e)?e.flatMap(t=>{const i=Ai(t);if(!i)return[];const l=Wi(t);return[{displayMedia:i,lightboxMedia:l!=null&&l.assetId?l:null}]}):e.filter(t=>t==null?void 0:t.assetId).map(t=>({displayMedia:t,lightboxMedia:t}))}function je(e){return!K.isEmbedMedia(e)&&e.type==="video"}function Oi(e){const t=new Set,i=[];for(const l of e){const o=si(l.gallery);for(const f of o){const y=f.lightboxMedia;y!=null&&y.assetId&&!t.has(y.assetId)&&(t.add(y.assetId),i.push(y))}}return i}function Di({mediaList:e}){const[t,i]=r.useState(null);ti.useLazyVideos(t,{preload:"metadata"});const l=e.filter(o=>!K.isEmbedMedia(o));return l.length===0?null:n.jsx("div",{ref:i,"aria-hidden":!0,style:{position:"absolute",width:0,height:0,overflow:"hidden",opacity:0,pointerEvents:"none"},children:l.map(o=>je(o)?n.jsx("video",{src:o.assetId,preload:"none",muted:!0,playsInline:!0},o.assetId):n.jsx("img",{src:o.assetId,alt:""},o.assetId))})}function Hi(e){e.pause(),e.removeAttribute("src"),e.load()}const Gi=".splide__slide video";function Ei(e){var o;if(e.closest(".splide--fade, .splide__slide.is-active:not(.splide__slide--clone), .splide__slide.is-next"))return!0;const t=e.closest(".splide__slide");if(!t||t.classList.contains("splide__slide--clone"))return!1;const i=t.dataset.slideIndex,l=(o=t.parentElement)==null?void 0:o.querySelector(".splide__slide.is-next");return i!==void 0&&(l==null?void 0:l.dataset.slideIndex)===i}function Qt({media:e,className:t,style:i,hasLightbox:l,isSplideSlide:o=!1,onMediaClick:f}){if(K.isEmbedMedia(e))return n.jsx(K.EmbedMediaFrame,{media:e,fit:i.objectFit==="contain"?"contain":"cover",silentLoop:l,className:t,style:{...i,cursor:f?"pointer":"default"},onClick:f});if(je(e)){const y={src:e.assetId,className:t,style:{...i,cursor:f?"pointer":"default"},muted:!0,loop:!0,playsInline:!0,onClick:f};return o?n.jsx("video",{...y,preload:"none"}):n.jsx(ii.LazyVideo,{...y,autoPlay:!0})}return n.jsx("img",{src:e.assetId,alt:e.name,className:t,style:{...i,cursor:f?"pointer":"default"},onClick:f})}function qi({className:e,style:t,children:i}){const[l,o]=r.useState(null);return ti.useLazyVideos(l,{autoPlay:!0,selector:Gi,shouldPlay:Ei}),n.jsx("div",{ref:o,className:e,style:t,children:i})}function Pt(e){const t=e.getBoundingClientRect();return{width:t.width,height:t.height,left:t.left,top:t.top}}function Bi(e,t){if(!t||!t.width||!t.height||!e.width||!e.height)return e;const i=t.width/t.height,l=e.width/e.height;if(i>l){const f=e.width/i;return{width:e.width,height:f,left:e.left,top:e.top+(e.height-f)/2}}const o=e.height*i;return{width:o,height:e.height,left:e.left+(e.width-o)/2,top:e.top}}function Xi({src:e,mediaRef:t,mediaStyle:i,onLoadedMetadata:l}){return r.useEffect(()=>{const o=t.current;if(o)return()=>{Hi(o)}},[e,t]),n.jsx("video",{ref:t,src:e,muted:!0,autoPlay:!0,loop:!0,playsInline:!0,preload:"auto",onLoadedMetadata:l,style:i})}const Ui="https://cdn.cntrl.site/component-assets/defaultCloseIcon.svg",Yi=.004;function Ki({prefix:e,closeIcon:t=Ui,closeIconMaxWidth:i=.0125,closeIconColor:l="#FFFFFF",closeIconHoverColor:o="#999999",iconMarginRight:f=.01,contentMarginTop:y=.01,isEditor:V,isPreviewMode:j,isEditMode:s,visible:I,onClose:$}){if(!t)return null;const N=m.scalingValue(i,V),q=m.scalingValue(f,V),le=m.scalingValue(y,V),te=m.scalingValue(Math.max(y,Yi),V);return n.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,zIndex:1e4,display:"flex",flexDirection:"column",alignItems:"flex-end",pointerEvents:"none",opacity:I?1:0,transition:"opacity 500ms cubic-bezier(0.22, 1, 0.36, 1)"},children:[n.jsx("div",{style:{position:"relative",width:"100%",height:le,flexShrink:0},children:s&&n.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:te,pointerEvents:I?"auto":"none"}})}),n.jsxs("div",{className:`${e}-close-icon`,style:{width:N,height:N,marginRight:q,pointerEvents:I?"auto":"none"},onClick:C=>C.stopPropagation(),children:[n.jsx("button",{type:"button",className:`${e}-close-icon-inner`,"aria-label":"Close",onClick:C=>{C.stopPropagation(),$()},children:n.jsx(ki.SvgImage,{url:t,fill:l,hoverFill:V&&!j?l:o,className:`${e}-close-icon-img`})}),s&&n.jsx("div",{"data-controls":"iconMarginRight","data-controls-axis":"x","data-controls-reverse":"",className:`${e}-control`,style:{position:"absolute",top:0,left:"100%",width:q,height:"100%",pointerEvents:I?"auto":"none"}})]})]})}function Zi({prefix:e,items:t,index:i,imageDisplay:l,isEditor:o,isPreviewMode:f,isEditMode:y,onClose:V,onPrev:j,onNext:s,counterClassName:I,counterStyle:$,closeIcon:N,closeIconMaxWidth:q,closeIconColor:le,closeIconHoverColor:te,iconMarginRight:C,contentMarginTop:Oe}){const $e=l==="cover",it=r.useRef(null),xe=r.useRef(null),De=r.useRef(null),G=r.useRef(null),B=r.useRef(0),O=r.useRef(0),L=r.useRef("none"),Z=r.useRef(!1),ie=r.useRef(!1),He=r.useRef(null),ne=r.useRef(0),F=r.useRef(null),D=r.useRef(!1),J=r.useRef(null),Q=r.useRef(null),Ge=r.useRef(null),nt=r.useRef(()=>{}),[S,ae]=r.useState(null),[c,Ee]=r.useState(null),[T,ke]=r.useState("opening"),[se,Ie]=r.useState(0),[P,X]=r.useState(0),[ye,ce]=r.useState(null),[qe,ve]=r.useState(!1),[Te,we]=r.useState(!1),[yt,st]=r.useState(!1),[vt,rt]=r.useState(null),ot=r.useRef(i),Be=r.useRef(void 0),d=t[i],wt=d?je(d):!1,Xe=d?K.isEmbedMedia(d):!1,lt=ye!==null,bt=r.useCallback(a=>{const h=a.currentTarget,_=h instanceof HTMLVideoElement?{width:h.videoWidth,height:h.videoHeight}:{width:h.naturalWidth,height:h.naturalHeight};!_.width||!_.height||rt(_)},[]);r.useEffect(()=>{He.current=c},[c]),r.useEffect(()=>{const a=it.current;if(!a)return;const h=()=>Ee(Pt(a));h();const _=new ResizeObserver(h);return _.observe(a),()=>_.disconnect()},[]);const k=r.useCallback(()=>{J.current!==null&&(window.clearTimeout(J.current),J.current=null)},[]),ue=r.useCallback(()=>{const a=Q.current;Q.current=null,k(),F.current=null,D.current=!1,ce(null),ve(!1),X(0),ne.current=0,we(!1),Z.current=!1,O.current=0,L.current="none",a===1?s():a===-1&&j()},[k,s,j]),Ue=r.useCallback(()=>{k(),Q.current=null,F.current=null,D.current=!1,ce(null),ve(!1),X(0),ne.current=0},[k]),Le=r.useCallback(()=>{k(),J.current=window.setTimeout(()=>{Q.current!==null&&ue()},Y+32)},[k,ue]),be=r.useCallback((a,h)=>{var he;const _=((he=He.current)==null?void 0:he.width)??0;if(k(),F.current=a,ce(a),D.current=!0,ve(!0),h){Q.current=a;const Ve=-a*_;ne.current=Ve,X(Ve),Le();return}ne.current=0,X(0),J.current=window.setTimeout(()=>{J.current=null,Ue()},Y+32)},[k,Ue,Le]),at=r.useCallback(a=>{if(!(t.length<=1)){if(D.current){if(Q.current===a){Ge.current=a,ue();return}Ue()}k(),F.current=a,ce(a),D.current=!1,ve(!1),ne.current=0,X(0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{be(a,!0)})})}},[t.length,be,ue,Ue,k]);nt.current=at;const ct=r.useCallback(a=>{a.propertyName!=="transform"||!D.current||Q.current!==null&&ue()},[ue]),Se=r.useCallback(()=>{const a=xe.current;if(!a)return;const h=Pt(a);!h.width||!h.height||ae(h)},[]);r.useEffect(()=>{Se();const a=xe.current;if(!a)return;const h=new ResizeObserver(()=>Se());return h.observe(a),()=>h.disconnect()},[Se]),r.useEffect(()=>{T==="opening"&&S&&ke("open")},[T,S]),r.useEffect(()=>{if(T!=="closing")return;const a=setTimeout(()=>V(),Y);return()=>clearTimeout(a)},[T,V]),r.useEffect(()=>()=>{k()},[k]),r.useLayoutEffect(()=>{ot.current===i&&Be.current===(d==null?void 0:d.assetId)||(k(),Q.current=null,ce(null),Ie(0),X(0),ve(!1),st(!1),we(!1),rt(null),B.current=0,O.current=0,L.current="none",Z.current=!1,D.current=!1,ne.current=0,F.current=null,G.current=null,ie.current=!1,ot.current=i,Be.current=d==null?void 0:d.assetId)},[i,d==null?void 0:d.assetId,k]),r.useLayoutEffect(()=>{const a=Ge.current;a!==null&&(Ge.current=null,requestAnimationFrame(()=>{nt.current(a)}))},[i,d==null?void 0:d.assetId]),r.useEffect(()=>{if(T!=="open")return;let a=null;const h=()=>{a&&(document.removeEventListener("click",a,!0),a=null)},_=()=>{h(),a=x=>{x.stopPropagation(),x.preventDefault(),h()},document.addEventListener("click",a,!0)},he=x=>{const H=x<0?1:-1;if(Math.abs(x)>Ni&&t.length>1){be(H,!0);return}be(H,!1)},Ve=x=>{if(x.touches.length!==1||D.current)return;const H=x.touches[0];ie.current=!0,G.current={x:H.clientX,y:H.clientY},L.current="none",O.current=0,Z.current=!1},Tt=x=>{if(!G.current||x.touches.length!==1||D.current)return;const H=x.touches[0],ee=H.clientX-G.current.x,E=H.clientY-G.current.y;if(L.current==="none"){if(Math.abs(ee)<10&&Math.abs(E)<10)return;if(Math.abs(ee)>Math.abs(E)){if(t.length<=1)return;L.current="horizontal"}else if(E>0)L.current="vertical";else return}if(L.current==="horizontal"){Z.current=!0,we(!0),O.current=ee;const Fe=ee<0?1:-1;F.current!==Fe&&(F.current=Fe,ce(Fe)),ne.current=ee,X(ee),x.preventDefault();return}L.current==="vertical"&&(Z.current=!0,we(!0),B.current=E,Ie(E),x.preventDefault())},Ne=()=>{if(!G.current)return;const x=L.current,H=Z.current;if(H&&x==="horizontal")he(O.current),_();else if(H&&x==="vertical")if(B.current>Vi){const E=window.innerHeight;B.current=E,st(!0),Ie(E),ke("closing")}else B.current=0,Ie(0),_();else x==="horizontal"&&Math.abs(O.current)>0&&(he(O.current),_());G.current=null,L.current="none",O.current=0,Z.current=!1,we(!1)};return document.addEventListener("touchstart",Ve,{passive:!0}),document.addEventListener("touchmove",Tt,{passive:!1}),document.addEventListener("touchend",Ne),document.addEventListener("touchcancel",Ne),()=>{document.removeEventListener("touchstart",Ve),document.removeEventListener("touchmove",Tt),document.removeEventListener("touchend",Ne),document.removeEventListener("touchcancel",Ne),h()}},[T,t.length,be]),r.useEffect(()=>{const a=h=>{h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),T!=="closing"&&ke("closing"))};return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[T]);const _e=()=>{T!=="closing"&&ke("closing")},re=T==="open",Me=T==="closing",St=se>0?Math.max(0,1-se/500):1,ut=se>0?Math.max(.35,1-se/500):1,Ct=Xe&&d?{width:K.getEmbedAspect(d),height:1}:vt,v=S?$e?S:Bi(S,Ct):null,dt={position:"fixed",top:c==null?void 0:c.top,left:c==null?void 0:c.left,width:c==null?void 0:c.width,height:c==null?void 0:c.height,zIndex:9998},mt=$e?"cover":"contain",g=P!==0||se>0?`translate(${P}px, ${se}px)`:void 0,jt=Te&&!qe?"none":qe?`transform ${Y}ms ${fe}`:yt?`transform ${Y}ms ${fe}, opacity ${Y}ms ${fe}`:T==="opening"||Me?`opacity ${Y}ms ${fe}`:"none",de={...dt,transform:g,opacity:se>0?ut:T==="opening"||Me?0:1,transition:jt,pointerEvents:"none"},ze={position:"absolute",top:((v==null?void 0:v.top)??0)-((c==null?void 0:c.top)??0),left:((v==null?void 0:v.left)??0)-((c==null?void 0:c.left)??0),width:v==null?void 0:v.width,height:v==null?void 0:v.height,objectFit:mt,pointerEvents:"none"},kt=(c==null?void 0:c.width)??0,me=lt?(i+ye+t.length)%t.length:null,w=me!==null?t[me]:null,It={...dt,transform:lt?`translateX(${ye*kt+P}px)`:void 0,opacity:1,transition:qe?`transform ${Y}ms ${fe}`:"none",pointerEvents:"none"},Re={position:"absolute",top:((S==null?void 0:S.top)??0)-((c==null?void 0:c.top)??0),left:((S==null?void 0:S.left)??0)-((c==null?void 0:c.left)??0),width:S==null?void 0:S.width,height:S==null?void 0:S.height,objectFit:mt,pointerEvents:"none"},U=Xe&&d&&K.getEmbedPlayback(d).controls&&v?Math.min(52,v.height*.2):0,Ce=v?{position:"fixed",top:v.top,height:v.height-U,width:v.width/2,zIndex:9999}:null;return n.jsxs("div",{ref:it,className:[`${e}-lightbox`,o?`${e}-lightbox-editor`:""].filter(Boolean).join(" "),style:{touchAction:T==="open"?"none":void 0},onClick:_e,children:[n.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(28,31,34,0.9)",opacity:re?St:0,transition:Te?"none":`opacity ${Y}ms ${fe}`,pointerEvents:"none"}}),n.jsx("div",{style:{position:"relative",width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:$e?n.jsxs(n.Fragment,{children:[n.jsx("div",{ref:xe,style:{position:"absolute",inset:0}}),n.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",height:"10%",opacity:re?1:0,transition:`opacity ${Y}ms ${fe}`,pointerEvents:"none",zIndex:9999},children:t.length>1&&n.jsxs("p",{className:I,style:$,children:[i+1," / ",t.length]})})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{height:"10%"}}),n.jsx("div",{style:{width:"70%",height:"80%",display:"flex",justifyContent:"center",alignItems:"center"},children:n.jsx("div",{ref:xe,style:{width:"100%",height:"100%"}})}),n.jsx("div",{style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",height:"10%",opacity:re?1:0,transition:`opacity ${Y}ms ${fe}`},children:t.length>1&&n.jsxs("p",{className:I,style:$,children:[i+1," / ",t.length]})})]})}),S&&c&&w&&n.jsx("div",{style:It,onTransitionEnd:ct,children:K.isEmbedMedia(w)?n.jsx("img",{src:w.thumbnail,alt:w.name,style:Re},`neighbor-${me}-${w.assetId}`):je(w)?n.jsx("video",{src:w.assetId,muted:!0,autoPlay:!0,loop:!0,playsInline:!0,preload:"auto",style:Re},`neighbor-${me}-${w.assetId}`):n.jsx("img",{src:w.assetId,alt:w.name,style:Re},`neighbor-${me}-${w.assetId}`)}),S&&c&&d&&n.jsx("div",{style:de,onTransitionEnd:ct,children:Xe?n.jsx(K.EmbedMediaFrame,{media:d,fit:$e?"cover":"contain",lazy:!1,startsAtOnce:!0,style:ze},`${i}-${d.assetId}`):wt?n.jsx(Xi,{src:d.assetId,mediaRef:De,mediaStyle:ze,onLoadedMetadata:bt},`${i}-${d.assetId}`):n.jsx("img",{ref:De,src:d.assetId,alt:d.name,onLoad:bt,style:ze},`${i}-${d.assetId}`)}),re&&Ce&&t.length>1&&n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{...Ce,left:v.left,cursor:"w-resize",pointerEvents:Te?"none":"auto"},onClick:a=>{if(ie.current){ie.current=!1;return}a.stopPropagation(),at(-1)}}),n.jsx("div",{style:{...Ce,left:v.left+v.width/2,cursor:"e-resize",pointerEvents:Te?"none":"auto"},onClick:a=>{if(ie.current){ie.current=!1;return}a.stopPropagation(),at(1)}})]}),n.jsx(Ki,{prefix:e,closeIcon:N,closeIconMaxWidth:q,closeIconColor:le,closeIconHoverColor:te,iconMarginRight:C,contentMarginTop:Oe,isEditor:o,isPreviewMode:f,isEditMode:y,visible:re,onClose:_e})]})}function Ji(e){return typeof e=="string"?e==="cover"?"cover":"fit":(e==null?void 0:e.display)==="cover"?"cover":"fit"}function At(e,t){return e.columnWidth*t+e.gutterWidth*Math.max(0,t-1)}function Wt(e){return e.blocks.reduce((t,i)=>Math.max(t,Math.max(0,i.top)+Math.max(0,i.height)),0)}function Qi(e){return typeof e.verticalGap=="number"?Math.max(0,e.verticalGap):Math.max(0,(e.repeatHeight??0)-Wt(e))}function ri(e,t){const i=e.blocks[t%e.blocks.length],l=Math.min(Math.max(1,Math.round(i.span)),e.columnsCount),o=Math.min(Math.max(0,Math.round(i.column)),e.columnsCount-l);return{column:o,span:l,width:At(e,l),top:Math.max(0,i.top),height:Math.max(0,i.height),gridColumn:`${o+1} / span ${l}`,gridRow:`${Math.floor(t/e.blocks.length)+1}`}}function ei(e,t){const i=e.beat??0;return i>0?Math.ceil(t/i-1e-6)*i:t}function Pi(e,t){const i=t.map((f,y)=>ri(e,y)),l=i.map(f=>f.top),o=[];for(let f=0;f<i.length;f+=e.blocks.length){const y=i.map((j,s)=>({slot:j,index:s})).slice(f,f+e.blocks.length).sort((j,s)=>j.slot.top-s.slot.top);let V=Wt(e);for(const{slot:j,index:s}of y){let I=j.top;for(const{slot:$,index:N}of y){const q=$.top+$.height<=j.top+1e-6&&N!==s,le=$.column<j.column+j.span&&j.column<$.column+$.span;if(q&&le){const te=l[N]+$.height+t[N],C=j.top+l[N]-$.top;I=Math.max(I,C>=te-1e-6?C:ei(e,te))}}l[s]=I,V=Math.max(V,l[s]+j.height+t[s])}o.push(ei(e,V))}return{tops:l,groupHeights:o}}function en({settings:e,content:t,isEditor:i,isPreviewMode:l,isEditMode:o,metadata:f,activeEvent:y,layoutId:V,portalId:j}){const{prefix:s}=Ci.useScopedStyles(),{type:I="a",gridLayout:$,customGrid:N,textBoxWidth:q=100,verticalGap:le,entriesCount:te,lightbox:C,imageDisplay:Oe,imageCorners:$e,lightboxImageDisplay:it,slider:xe,sliderTiming:De,direction:G,transition:B,titleMarginTop:O,subtitleMarginTop:L,titleColor:Z,subtitleColor:ie,lightboxCounterColor:He,titleFontFamily:ne,titleFontSettings:F,titleFontSize:D,titleLineHeight:J,titleLetterSpacing:Q,titleWordSpacing:Ge,titleTextAppearance:nt,subtitleFontFamily:S,subtitleFontSettings:ae,subtitleFontSize:c,subtitleLineHeight:Ee,subtitleLetterSpacing:T,subtitleWordSpacing:ke,subtitleTextAppearance:se,lightboxCounterFontFamily:Ie,lightboxCounterFontSettings:P,lightboxCounterFontSize:X,lightboxCounterLineHeight:ye,lightboxCounterLetterSpacing:ce,lightboxCounterWordSpacing:qe,lightboxCounterTextAppearance:ve,closeIcon:Te,closeIconMaxWidth:we,closeIconColor:yt,closeIconHoverColor:st,iconMarginRight:vt,contentMarginTop:rt,showText:ot="always",hover:Be="none",alignEntries:d="off",align:wt="top",textGrowth:Xe="inside"}=e,lt={fontSettings:{fontFamily:ne,fontWeight:(F==null?void 0:F.fontWeight)??400,fontStyle:(F==null?void 0:F.fontStyle)??"normal"},fontSize:D??.01,lineHeight:J,letterSpacing:Q??0,wordSpacing:Ge??0,textAppearance:nt,color:Z},k={...We.omitTextColors(We.textStylesToCss(lt,i))},ue={fontSettings:{fontFamily:S,fontWeight:(ae==null?void 0:ae.fontWeight)??400,fontStyle:(ae==null?void 0:ae.fontStyle)??"normal"},fontSize:c??.01,lineHeight:Ee,letterSpacing:T??0,wordSpacing:ke??0,textAppearance:se,color:ie},Le={...We.omitTextColors(We.textStylesToCss(ue,i))},be={fontSettings:{fontFamily:Ie,fontWeight:(P==null?void 0:P.fontWeight)??400,fontStyle:(P==null?void 0:P.fontStyle)??"normal"},fontSize:X??.01,lineHeight:ye,letterSpacing:ce??0,wordSpacing:qe??0,textAppearance:ve,color:He},ct={...We.omitTextColors(We.textStylesToCss(be,i)),...Vt(X,ye,s,i)},Se=Rt(D,J,`${s}-item-title`,`${s}-text-tight-leading`),_e=Rt(c,Ee,`${s}-item-subtitle`,`${s}-text-tight-leading`),re=Vt(D,J,s,i),Me=Vt(c,Ee,s,i),St=Rt(X,ye,`${s}-lightbox-counter`,`${s}-text-tight-leading`),ut=Si.buildColorVars(s,{titleColor:Z,subtitleColor:ie,lightboxCounterColor:He},tn,nn),Ct=y&&y!=="default"?`${s}-state-${y}`:"",v=ot==="on hover"&&(!i||l),dt=Be!=="none"&&(!i||l)?` ${s}-hover-${Be}`:"",mt=`${Ct}${v?` ${s}-show-text-hover`:""}${dt}`.trim(),g=N&&Array.isArray(N.blocks)&&N.blocks.length>0?N:void 0,jt=g||te===0?1/0:te,de=!!g&&Xe==="outside",ze=r.useRef([]),[kt,me]=r.useState([]),w=(t??[]).slice(0,jt),It=r.useMemo(()=>C==="on"?Oi(w):[],[w,C]),Re=($==null?void 0:$.entryWidth)??.2,U=typeof Oe=="string"?{display:Oe}:Oe,Ce=(U==null?void 0:U.display)==="cover",a=(U==null?void 0:U.ratioValue)??"1:1",h=(U==null?void 0:U.reversed)??!1,[_,he]=a.split(":").map(Number),Ne=`${h?he:_} / ${h?_:he}`,x=($==null?void 0:$.columnsCount)??1,H=m.scalingValue(Re??0,i),ee=!g&&!Ce&&xe!=="off",E=w.length%x||x,Fe=!g&&E<x&&w.length>0,Ot=w.length-E,oi=Fe?Math.floor((x-E)/2)+1:1,Ye=$e?m.scalingValue($e,i):void 0,li=(u,p)=>({width:u,...p?de?{height:m.scalingValue(p.height,i),flexShrink:0,overflow:"hidden"}:{flex:"1 1 0%",minHeight:0,overflow:"hidden"}:Ce?{aspectRatio:Ne,height:"auto",overflow:"hidden"}:{height:"auto"},...Ye?{borderRadius:Ye,overflow:"hidden"}:{}}),ai=`${s}-item-image-wrapper${ee?` ${s}-item-image-wrapper-fit-slider`:""}`.trim(),ge=I==="d"||I==="e"||I==="f",oe=!g&&d==="on",Dt=Ye?{borderRadius:Ye,[ni]:Ye}:{},Ht=Ce?{objectFit:"cover",pointerEvents:"auto",width:"100%",height:"100%",maxWidth:"100%",...Dt}:{objectFit:"contain",pointerEvents:"auto",width:"auto",height:"auto",maxWidth:"100%",...g?{maxHeight:"100%"}:{},...Dt},Lt=g?At(g,g.columnsCount):0;r.useLayoutEffect(()=>{if(!de){me(z=>z.length>0?[]:z);return}const u=Ze.current,p=ze.current.slice(0,w.length),M=()=>{const z=u&&Lt>0?u.offsetWidth/Lt:0,Je=p.map(W=>{const R=W==null?void 0:W.querySelector(`.${s}-item-image-wrapper`);return W&&R&&z>0?Math.max(0,W.offsetHeight-R.offsetHeight)/z:0});me(W=>W.length===Je.length&&W.every((R,Qe)=>Math.abs(R-Je[Qe])<1e-5)?W:Je)};M();const A=new ResizeObserver(M);return u&&A.observe(u),p.forEach(z=>z&&A.observe(z)),()=>A.disconnect()},[de,w.length,Lt,s]);const Ke=g&&de?Pi(g,w.map((u,p)=>kt[p]??0)):void 0,Gt=g?Math.ceil(w.length/g.blocks.length):0,ci=g?m.scalingValue(Wt(g),i):"",ui=g?{gridTemplateColumns:`repeat(${g.columnsCount}, ${m.scalingValue(g.columnWidth,i)})`,gridTemplateRows:Gt>1?Ke?`${Ke.groupHeights.slice(0,-1).map(u=>`minmax(${m.scalingValue(u,i)}, auto)`).join(" ")} auto`:`repeat(${Gt-1}, minmax(${ci}, auto)) auto`:"auto",rowGap:m.scalingValue(Qi(g),i),columnGap:m.scalingValue(g.gutterWidth,i),width:m.scalingValue(At(g,g.columnsCount),i)}:{gridTemplateColumns:`repeat(${x}, ${H})`,rowGap:oe?0:m.scalingValue(le??0,i),columnGap:m.scalingValue(($==null?void 0:$.horizontalGap)??0,i),width:m.scalingValue(($==null?void 0:$.wrapperWidth)??0,i),...oe?{[`--${s}-align-entries-row-gap`]:m.scalingValue(le??0,i)}:{}},[di,mi]=r.useState(0),Ze=r.useRef(null),hi=B==="fade"||G==="horizontal"?"ltr":G==="vertical"?"ttb":"ltr";r.useEffect(()=>{const u=Ze.current;if(!u)return;const p=new ResizeObserver(M=>{mi(Math.round(M[0].contentRect.width))});return p.observe(u),()=>p.disconnect()},[]);const gi=(()=>{const u={...ut},p=Ze.current?getComputedStyle(Ze.current).getPropertyValue("--cntrl-article-width").trim():"";return p&&(u["--cntrl-article-width"]=p),u})(),[_t,Mt]=r.useState(!1),[ht,pi]=r.useState([]),[fi,zt]=r.useState(0),Et=C==="on"&&(!i||l),qt=(u,p)=>{i&&!l||C!=="off"&&(pi(u),zt(p),Mt(!0))};r.useEffect(()=>{if(!_t||C!=="on"||typeof document>"u")return;const u=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=u}},[_t,C]),r.useEffect(()=>{!i||l||Mt(!1)},[i,l]);const $i=r.useMemo(()=>Li(s),[s]);return n.jsxs(n.Fragment,{children:[n.jsx("style",{dangerouslySetInnerHTML:{__html:$i}}),C==="on"&&n.jsx(Di,{mediaList:It}),n.jsx("div",{style:ut,children:n.jsx("div",{ref:Ze,className:`${s}-wrapper ${s}-type-${I}${oe?` ${s}-align-entries`:""}${g?` ${s}-custom-layout`:""}${de?` ${s}-text-outside`:""} ${s}-image-align-${wt} ${mt}`.trim(),style:ui,children:w.map((u,p)=>{var Kt;const M=Jt(u.title),A=Jt(u.subtitle),z=C==="off"&&((Kt=u.link)!=null&&Kt.value)?u.link:void 0,Je=Math.floor(p/x)===Math.ceil(w.length/x)-1,W=Fe&&p>=Ot?`${oi+(p-Ot)}`:void 0,R=g?ri(g,p):void 0,Qe=(R==null?void 0:R.width)??Re,gt=m.scalingValue(Qe,i),Ae=`calc(${gt} * (${q} / 100))`,pe=m.scalingValue(Qe*q/100,i),xi=li(gt,R),yi=R?{gridColumn:R.gridColumn,gridRow:R.gridRow,alignSelf:"start",marginTop:m.scalingValue((Ke==null?void 0:Ke.tops[p])??R.top,i)}:W&&!oe?{gridColumn:W}:void 0,Bt=ge?n.jsxs("div",{className:`${s}-item-text-block`,children:[M&&n.jsx("p",{className:Se,style:{width:Ae,...k,...re},children:u.title}),M&&n.jsx("div",{"data-controls":o?"titleMarginTop":void 0,className:o?`${s}-control`:void 0,style:{height:m.scalingValue(O??0,i),width:pe}}),A&&n.jsx("p",{className:_e,style:{width:Ae,...Le,...Me},children:u.subtitle}),A&&n.jsx("div",{"data-controls":o?"subtitleMarginTop":void 0,className:o?`${s}-control`:void 0,style:{height:m.scalingValue(L??0,i),width:pe}})]}):null,vi=oe?n.jsxs("div",{className:`${s}-item-title-row`,children:[!ge&&n.jsx("div",{"data-controls":o&&M?"titleMarginTop":void 0,className:o&&M?`${s}-control`:void 0,style:{height:M?m.scalingValue(O??0,i):0,width:pe}}),M&&n.jsx("p",{className:Se,style:{width:Ae,...k,...re},children:u.title}),ge&&M&&n.jsx("div",{"data-controls":o?"titleMarginTop":void 0,className:o?`${s}-control`:void 0,style:{height:m.scalingValue(O??0,i),width:pe}})]}):null,wi=oe?n.jsxs("div",{className:`${s}-item-subtitle-row`,children:[!ge&&n.jsx("div",{"data-controls":o&&A?"subtitleMarginTop":void 0,className:o&&A?`${s}-control`:void 0,style:{height:A?m.scalingValue(L??0,i):0,width:pe}}),A&&n.jsx("p",{className:_e,style:{width:Ae,...Le,...Me},children:u.subtitle}),ge&&A&&n.jsx("div",{"data-controls":o?"subtitleMarginTop":void 0,className:o?`${s}-control`:void 0,style:{height:m.scalingValue(L??0,i),width:pe}})]}):null,Xt=n.jsxs(xt.LinkWrapper,{link:z,className:`${s}-item-text-link`,children:[vi,wi]}),Pe=si(u.gallery),pt=Pe.filter(b=>b.lightboxMedia).map(b=>b.lightboxMedia),ft=n.jsx(qi,{className:ai,style:xi,children:Pe.length===0?null:xe==="off"?(()=>{const{displayMedia:b,lightboxMedia:et}=Pe[0],tt=et?pt.findIndex($t=>$t.assetId===et.assetId):-1;return n.jsx(Qt,{media:b,className:`${s}-item-${je(b)?"video":"image"}`.trim(),style:Ht,hasLightbox:C==="on",onMediaClick:Et&&tt>=0?()=>qt(pt,tt):void 0})})():n.jsxs(n.Fragment,{children:[ee&&n.jsx("div",{className:`${s}-item-image-wrapper-sizer`,"aria-hidden":"true",children:Pe.map(({displayMedia:b})=>K.isEmbedMedia(b)?n.jsx("div",{style:{aspectRatio:`${K.getEmbedAspect(b)}`}},`sizer-${b.assetId}`):je(b)?n.jsx(ii.LazyVideo,{src:b.assetId,nearPreload:"metadata",muted:!0,playsInline:!0},`sizer-${b.assetId}`):n.jsx("img",{src:b.assetId,alt:""},`sizer-${b.assetId}`))}),n.jsx(Zt.Splide2,{className:`${s}-item-slider`,options:{arrows:!1,pagination:!1,drag:!1,perPage:1,autoplay:!0,interval:De*1e3,width:"100%",height:"100%",speed:Ri,type:B==="fade"?"fade":"loop",rewind:B==="fade",pauseOnHover:!1,pauseOnFocus:!1,direction:hi},onMoved:b=>{G!=="random"||B==="fade"||zi(b)},children:Pe.map(({displayMedia:b,lightboxMedia:et},tt)=>{const $t=et?pt.findIndex(bi=>bi.assetId===et.assetId):-1;return n.jsx(Zt.SplideSlide,{"data-slide-index":tt,children:n.jsx(Qt,{media:b,className:`${s}-item-${je(b)?"video":"image"}`.trim(),style:Ht,hasLightbox:C==="on",isSplideSlide:!0,onMediaClick:Et&&$t>=0?()=>qt(pt,$t):void 0})},tt)})},`${B}-${Qe}-${G}-${De}-${di}-${V}`)]})}),Ut=ge?null:n.jsxs(n.Fragment,{children:[n.jsx("div",{"data-controls":o&&M?"titleMarginTop":void 0,className:o&&M?`${s}-control`:void 0,style:{height:M?m.scalingValue(O??0,i):0,width:pe}}),n.jsx("p",{className:Se,style:{width:Ae,...k,...re},children:u.title}),n.jsx("div",{"data-controls":o&&A?"subtitleMarginTop":void 0,className:o&&A?`${s}-control`:void 0,style:{height:A?m.scalingValue(L??0,i):0,width:pe}}),n.jsx("p",{className:_e,style:{width:Ae,...Le,...Me},children:u.subtitle})]}),Yt=z?n.jsx(xt.LinkWrapper,{link:z,className:`${s}-item-image-link`,children:ft}):n.jsx("a",{className:`${s}-item-image-link`,children:ft});return n.jsx("div",{className:`${s}-item`.trim(),style:yi,children:n.jsx("div",{ref:b=>{ze.current[p]=b},className:`${o?`${s}-item-inner`:`${s}-item-inner-hidden`}${oe&&Je?` ${s}-item-inner-last-row`:""}`.trim(),style:{width:(q??0)>100?`calc(${gt} * (${q} / 100))`:gt,...R&&!de?{height:m.scalingValue(R.height,i)}:{},...W&&oe?{gridColumn:W}:{}},children:oe?n.jsx(n.Fragment,{children:ge?n.jsxs(n.Fragment,{children:[Xt,Yt]}):n.jsxs(n.Fragment,{children:[Yt,Xt]})}):z?n.jsxs(n.Fragment,{children:[n.jsxs(xt.LinkWrapper,{link:z,className:`${s}-item-image-link`,children:[Bt,ft]}),!ge&&n.jsx(xt.LinkWrapper,{link:z,className:`${s}-item-text-link`,children:Ut})]}):n.jsxs(n.Fragment,{children:[Bt,ft,Ut]})})},p)})})}),(!i||l)&&_t&&typeof document<"u"&&C==="on"&&(()=>{const u=(j?document.getElementById(j):null)??document.body;return ji.createPortal(n.jsx("div",{style:gi,"data-selection":"none",children:n.jsx(Zi,{prefix:s,items:ht,index:fi,imageDisplay:Ji(it),isEditor:i,isPreviewMode:l,isEditMode:o,closeIcon:Te,closeIconMaxWidth:we,closeIconColor:yt,closeIconHoverColor:st,iconMarginRight:vt,contentMarginTop:rt,onClose:()=>Mt(!1),onPrev:()=>zt(p=>(p-1+ht.length)%ht.length),onNext:()=>zt(p=>(p+1)%ht.length),counterClassName:St,counterStyle:ct})}),u)})()]})}const tn={titleColor:"title-color",subtitleColor:"subtitle-color",lightboxCounterColor:"lightbox-counter-color"},nn=["hover","focus","filled","success","error"];exports.Grid=en;