@cntrl-site/components 1.0.115-alpha.2 → 1.0.116-alpha.0

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