@cntrl-site/components 1.0.103 → 1.0.105

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.
Files changed (48) hide show
  1. package/dist/Components/helpers/LazyVideo/LazyVideo.d.ts +4 -0
  2. package/dist/Components/utils/index.d.ts +1 -0
  3. package/dist/Components/utils/observeIntersection.d.ts +4 -0
  4. package/dist/Components/utils/useLazyVideos.d.ts +12 -0
  5. package/dist/Grid-BBpdl60K.js +374 -0
  6. package/dist/Grid-DS53S_gA.mjs +1576 -0
  7. package/dist/{Helix-BmkAKT1G.mjs → Helix-BPn9V1sg.mjs} +53 -53
  8. package/dist/{Helix-2Vr-9WBa.js → Helix-DcgsCc4D.js} +2 -2
  9. package/dist/{Hive-BGMWinrW.mjs → Hive-D6-R6TwM.mjs} +114 -111
  10. package/dist/Hive-n8Fz-j3o.js +321 -0
  11. package/dist/LazyVideo-CdAWymKO.mjs +15 -0
  12. package/dist/LazyVideo-imbU18js.js +1 -0
  13. package/dist/Marquee-DOIRRCu4.js +133 -0
  14. package/dist/Marquee-O_PDwlIb.mjs +564 -0
  15. package/dist/MarqueeText-DkaO2lQ5.js +132 -0
  16. package/dist/MarqueeText-Rzt2fJYt.mjs +517 -0
  17. package/dist/{Mercury-DuKJQ1Zo.mjs → Mercury-C9D10TTT.mjs} +55 -54
  18. package/dist/Mercury-DynO-NxY.js +267 -0
  19. package/dist/{PretextComponent-CGycuNNn.js → PretextComponent-BnsS2zJ6.js} +1 -1
  20. package/dist/{PretextComponent-DN8cyZ8x.mjs → PretextComponent-j-OsRZTx.mjs} +7 -7
  21. package/dist/Waterfall-DC2WQ3GT.js +287 -0
  22. package/dist/{Waterfall-A0FjM2my.mjs → Waterfall-Yud2VR62.mjs} +299 -295
  23. package/dist/{components-DTCDEBo0.js → components-B9Vdjf0w.js} +1 -1
  24. package/dist/{components-BFJINCME.mjs → components-D2LyuDm-.mjs} +1 -1
  25. package/dist/elements.js +1 -1
  26. package/dist/elements.mjs +7 -7
  27. package/dist/elements.node.js +1 -1
  28. package/dist/elements.node.mjs +1 -1
  29. package/dist/index.js +1 -1
  30. package/dist/index.mjs +2 -2
  31. package/dist/observeIntersection-B0f3L2iK.mjs +23 -0
  32. package/dist/observeIntersection-DxGj9Ctt.js +1 -0
  33. package/dist/sources.js +147 -59
  34. package/dist/sources.mjs +155 -67
  35. package/dist/useLazyVideos-CdCbc2j0.js +1 -0
  36. package/dist/useLazyVideos-CxXyEjRQ.mjs +52 -0
  37. package/dist/utils.js +1 -1
  38. package/dist/utils.mjs +14 -12
  39. package/package.json +5 -3
  40. package/dist/Grid-CemGhf3F.js +0 -374
  41. package/dist/Grid-cfQsXW3b.mjs +0 -1553
  42. package/dist/Hive-BC6zQBsv.js +0 -321
  43. package/dist/Marquee-BYClHHws.mjs +0 -551
  44. package/dist/Marquee-vmHaTGIP.js +0 -133
  45. package/dist/MarqueeText-4Rip_sQX.mjs +0 -515
  46. package/dist/MarqueeText-E6OubMOG.js +0 -132
  47. package/dist/Mercury-BwF_XW2w.js +0 -267
  48. package/dist/Waterfall-DnPDHbCL.js +0 -287
@@ -0,0 +1,321 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),ne=require("./scalingValue-CSHYgTZl.js"),nn=require("./useScopedStyles-Bf6yohVQ.js"),rn=require("./useLazyVideos-CdCbc2j0.js"),on=require("./LazyVideo-imbU18js.js"),r=require("react"),sn=require("react-dom"),an=require("./HiveLightboxTitles-DlyptAaK.js"),ln=require("./getImageRect-BQhQXvT8.js");function cn(t){return`calc(var(--cntrl-article-width, 100vw) * ${t/1440})`}function un(t){return`
2
+ .${t}-wrapper {
3
+ display: grid;
4
+ align-items: start;
5
+ justify-content: center;
6
+ min-height: ${cn(48)};
7
+ }
8
+ .${t}-item {
9
+ display: flex;
10
+ flex-direction: column;
11
+ justify-content: center;
12
+ align-items: center;
13
+ }
14
+ .${t}-item-inner {
15
+ display: flex;
16
+ flex-direction: column;
17
+ align-items: center;
18
+ outline: 1px solid #FF5C02;
19
+ }
20
+ .${t}-item-inner-hidden {
21
+ display: flex;
22
+ flex-direction: column;
23
+ align-items: center;
24
+ }
25
+ .${t}-item-image-wrapper {
26
+ display: flex;
27
+ justify-content: center;
28
+ align-items: center;
29
+ align-self: center;
30
+ }
31
+ .${t}-item-image-link {
32
+ width: 100%;
33
+ display: flex;
34
+ flex-direction: column;
35
+ align-items: center;
36
+ }
37
+ .${t}-item-image {
38
+ width: 100%;
39
+ height: 100%;
40
+ display: block;
41
+ max-width: 100%;
42
+ }
43
+ .${t}-item-video {
44
+ width: 100%;
45
+ height: 100%;
46
+ display: block;
47
+ max-width: 100%;
48
+ }
49
+ .${t}-image-align-top .${t}-item-image-wrapper {
50
+ align-items: flex-start;
51
+ }
52
+ .${t}-image-align-center .${t}-item-image-wrapper {
53
+ align-items: center;
54
+ }
55
+ .${t}-image-align-bottom .${t}-item-image-wrapper {
56
+ align-items: flex-end;
57
+ }
58
+ .${t}-align-entries .${t}-item {
59
+ display: contents;
60
+ }
61
+ .${t}-align-entries .${t}-item-inner,
62
+ .${t}-align-entries .${t}-item-inner-hidden {
63
+ display: grid;
64
+ grid-template-rows: subgrid;
65
+ grid-row: span 3;
66
+ justify-self: center;
67
+ margin-bottom: var(--${t}-align-entries-row-gap, 0);
68
+ }
69
+ .${t}-align-entries .${t}-item-inner-last-row {
70
+ margin-bottom: 0;
71
+ }
72
+ .${t}-align-entries .${t}-item-title-row,
73
+ .${t}-align-entries .${t}-item-subtitle-row {
74
+ display: flex;
75
+ flex-direction: column;
76
+ align-items: center;
77
+ width: 100%;
78
+ min-height: 100%;
79
+ }
80
+ .${t}-align-entries .${t}-item-image-link {
81
+ width: 100%;
82
+ height: 100%;
83
+ min-height: 100%;
84
+ display: flex;
85
+ flex-direction: column;
86
+ align-items: center;
87
+ justify-content: flex-start;
88
+ }
89
+ .${t}-align-entries .${t}-item-image-link > .${t}-item-image-wrapper {
90
+ flex-shrink: 0;
91
+ height: auto;
92
+ align-self: auto;
93
+ }
94
+ .${t}-image-align-top.${t}-align-entries .${t}-item-image-link > .${t}-item-image-wrapper {
95
+ margin-top: 0;
96
+ margin-bottom: auto;
97
+ }
98
+ .${t}-image-align-center.${t}-align-entries .${t}-item-image-link > .${t}-item-image-wrapper {
99
+ margin-top: auto;
100
+ margin-bottom: auto;
101
+ }
102
+ .${t}-image-align-bottom.${t}-align-entries .${t}-item-image-link > .${t}-item-image-wrapper {
103
+ margin-top: auto;
104
+ margin-bottom: 0;
105
+ }
106
+ .${t}-image-align-top.${t}-align-entries .${t}-item-image-wrapper {
107
+ align-items: flex-start;
108
+ }
109
+ .${t}-image-align-center.${t}-align-entries .${t}-item-image-wrapper {
110
+ align-items: center;
111
+ }
112
+ .${t}-image-align-bottom.${t}-align-entries .${t}-item-image-wrapper {
113
+ align-items: flex-end;
114
+ }
115
+ .${t}-image-align-top.${t}-align-entries .${t}-item-image-link {
116
+ justify-content: flex-start;
117
+ }
118
+ .${t}-image-align-center.${t}-align-entries .${t}-item-image-link {
119
+ justify-content: center;
120
+ }
121
+ .${t}-image-align-bottom.${t}-align-entries .${t}-item-image-link {
122
+ justify-content: flex-end;
123
+ }
124
+ .${t}-titles-row {
125
+ position: relative;
126
+ flex: 0 1 auto;
127
+ z-index: 2;
128
+ box-sizing: border-box;
129
+ pointer-events: none;
130
+ word-break: break-word;
131
+ min-width: 0;
132
+ display: flex;
133
+ flex-direction: row;
134
+ align-items: baseline;
135
+ }
136
+ .${t}-titles-row-header {
137
+ flex: 1;
138
+ align-items: baseline;
139
+ }
140
+ .${t}-titles-row-header-controls {
141
+ display: flex;
142
+ flex-direction: row;
143
+ align-items: baseline;
144
+ flex-shrink: 0;
145
+ }
146
+ .${t}-close-icon {
147
+ position: relative;
148
+ flex-shrink: 0;
149
+ align-self: center;
150
+ pointer-events: auto;
151
+ z-index: 2;
152
+ display: flex;
153
+ align-items: center;
154
+ justify-content: center;
155
+ border: none;
156
+ background-color: transparent;
157
+ padding: 0;
158
+ }
159
+ .${t}-close-icon-inner {
160
+ all: unset;
161
+ position: relative;
162
+ cursor: pointer;
163
+ width: 100%;
164
+ height: 100%;
165
+ pointer-events: auto;
166
+ }
167
+ .${t}-close-icon-img {
168
+ position: absolute;
169
+ top: 50%;
170
+ left: 50%;
171
+ transform: translate(-50%, -50%);
172
+ }
173
+ .${t}-titles-baseline-strut {
174
+ width: 0;
175
+ overflow: hidden;
176
+ flex-shrink: 0;
177
+ pointer-events: none;
178
+ white-space: nowrap;
179
+ }
180
+ .${t}-titles-row-titles {
181
+ position: relative;
182
+ flex: 1;
183
+ min-width: 0;
184
+ align-self: flex-start;
185
+ }
186
+ .${t}-titles-stack {
187
+ position: relative;
188
+ display: flex;
189
+ flex-direction: row;
190
+ align-items: baseline;
191
+ align-self: flex-start;
192
+ min-width: 0;
193
+ }
194
+ .${t}-titles-row-two-row {
195
+ display: flex;
196
+ flex: 1;
197
+ height: 100%;
198
+ min-height: 0;
199
+ align-self: stretch;
200
+ flex-direction: column;
201
+ width: 100%;
202
+ }
203
+ .${t}-titles-row-top {
204
+ display: flex;
205
+ flex-direction: row;
206
+ align-items: baseline;
207
+ width: 100%;
208
+ flex-shrink: 0;
209
+ margin-bottom: 0;
210
+ }
211
+ .${t}-titles-row-top .${t}-title-cell[data-title="title1"] {
212
+ flex: 0 0 auto;
213
+ min-width: 0;
214
+ }
215
+ .${t}-titles-row-bottom-wrap {
216
+ display: flex;
217
+ flex-direction: column;
218
+ width: 100%;
219
+ margin-top: auto;
220
+ flex-shrink: 0;
221
+ }
222
+ .${t}-titles-row-bottom-area {
223
+ position: relative;
224
+ flex: 1;
225
+ min-height: 0;
226
+ display: flex;
227
+ flex-direction: column;
228
+ width: 100%;
229
+ }
230
+ .${t}-titles-row-bottom {
231
+ position: relative;
232
+ display: flex;
233
+ flex-direction: row;
234
+ align-items: flex-end;
235
+ width: 100%;
236
+ }
237
+ .${t}-titles-row-bottom .${t}-title-cell {
238
+ flex: 0 0 auto;
239
+ }
240
+ .${t}-title-cell {
241
+ position: relative;
242
+ flex: 0 0 auto;
243
+ min-width: 0;
244
+ box-sizing: border-box;
245
+ }
246
+ .${t}-text-bar-cell {
247
+ position: relative;
248
+ flex: 0 1 auto;
249
+ min-width: 0;
250
+ display: flex;
251
+ align-items: baseline;
252
+ }
253
+ .${t}-title1,
254
+ .${t}-title2,
255
+ .${t}-title3 {
256
+ margin: 0;
257
+ min-width: 0;
258
+ }
259
+ .${t}-title-resize-handle {
260
+ background: transparent;
261
+ }
262
+ .${t}-lightbox {
263
+ position: fixed;
264
+ inset: 0;
265
+ z-index: 9997;
266
+ overscroll-behavior: none;
267
+ overflow: hidden;
268
+ }
269
+ .${t}-lightbox-editor {
270
+ inset: auto;
271
+ top: var(--cntrl-article-top, 0);
272
+ left: var(--cntrl-article-left, 0);
273
+ width: var(--cntrl-article-width, 100vw) !important;
274
+ height: var(--cntrl-viewport-height, 100vh) !important;
275
+ }
276
+ .${t}-lightbox-edit-mode {
277
+ z-index: 1;
278
+ }
279
+ .${t}-lightbox-dismiss-area {
280
+ position: relative;
281
+ width: 100%;
282
+ height: 100%;
283
+ }
284
+ .${t}-lightbox-overlay-content {
285
+ position: absolute;
286
+ inset: 0;
287
+ z-index: 3;
288
+ pointer-events: none;
289
+ display: flex;
290
+ flex-direction: column;
291
+ isolation: isolate;
292
+ }
293
+ .${t}-lightbox-content-area {
294
+ position: relative;
295
+ display: flex;
296
+ flex-direction: row;
297
+ align-items: flex-start;
298
+ flex: 1;
299
+ min-width: 0;
300
+ min-height: 0;
301
+ }
302
+ .${t}-lightbox-content-area-stacked {
303
+ align-items: stretch;
304
+ align-self: stretch;
305
+ }
306
+ .${t}-text-bar-cell-stacked {
307
+ align-self: stretch;
308
+ flex: 1;
309
+ min-width: 0;
310
+ min-height: 0;
311
+ height: 100%;
312
+ flex-direction: column;
313
+ align-items: stretch;
314
+ }
315
+ .${t}-control {
316
+ position: relative;
317
+ z-index: 2;
318
+ pointer-events: auto;
319
+ flex-shrink: 0;
320
+ }
321
+ `}const We={assetId:"",name:"",objectFit:"cover"},et=500,qt=650,_="cubic-bezier(0.22, 1, 0.36, 1)",fn=72,dn=50,hn=1e4,gn=650,pn=500;function mn(t,e){const i=t.width/e.width,o=t.height/e.height,s=t.left-e.left,c=t.top-e.top;return`translate(${s}px, ${c}px) scale(${i}, ${o})`}function Me(t,e){if(e==="contain"&&t instanceof HTMLImageElement){const o=ln.getDisplayedImageRect(t);return{left:o.x,top:o.y,width:o.width,height:o.height}}const i=t.getBoundingClientRect();return{left:i.left,top:i.top,width:i.width,height:i.height}}function wn(t,e,i){const o=t.querySelector(`[data-hive-grid-index="${e}"]`);return o instanceof HTMLElement?Me(o,i):null}function vn(t){return t.reduce((e,i,o)=>{const s=we(i.gallery),p=ve(s).filter(u=>u.lightboxMedia).map(u=>u.lightboxMedia);return p.length===0||e.push({gridIndex:o,items:p,entry:{title1:i.title1??"",title2:i.title2??"",title3:i.title3??""}}),e},[])}function Gt(t,e,i){var s;if(t.length<=1)return null;const o=(e+i+t.length)%t.length;return((s=t[o])==null?void 0:s.items[0])??null}function Oe(t,e,i){if(t.length<=2)return null;const o=(e+i+t.length)%t.length;return Gt(t,o,i)}const xn=.03;function De(t){return t.width*xn}const pe={left:0,top:0,width:typeof window<"u"?window.innerWidth:1440,height:typeof window<"u"?window.innerHeight:900};function ie(t,e){return{left:t.left-e.left,top:t.top-e.top,width:t.width,height:t.height}}function ze(t){const e=t.getBoundingClientRect();return{width:e.width,height:e.height,left:e.left,top:e.top}}function yn(t){return t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:{width:t.naturalWidth,height:t.naturalHeight}}function me(t,e,i){const o=t.getBoundingClientRect(),s=o.width,c=o.height,p=e/i,u=s/c;if(p>u){const I=s/p;return{width:s,height:I,left:o.left,top:o.top+(c-I)/2}}const y=c*p;return{width:y,height:c,left:o.left+(s-y)/2,top:o.top}}function $n(t,e){return!t||!(e!=null&&e.width)||!(e!=null&&e.height)?null:me(t,e.width,e.height)}function bn(t,e){if(Ft(t)){const o=document.createElement("video"),s=()=>{o.videoWidth>0&&o.videoHeight>0&&e(t.assetId,o.videoWidth,o.videoHeight),o.removeEventListener("loadedmetadata",s)};o.addEventListener("loadedmetadata",s),o.preload="auto",o.src=t.assetId,o.load();return}const i=new Image;i.onload=()=>{i.naturalWidth>0&&i.naturalHeight>0&&e(t.assetId,i.naturalWidth,i.naturalHeight)},i.src=t.assetId}function In(t){const e=new Set,i=[];for(const o of t){const s=we(o.gallery),c=ve(s);for(const p of c)for(const u of[p.displayMedia,p.lightboxMedia])u!=null&&u.assetId&&!e.has(u.assetId)&&(e.add(u.assetId),i.push(u))}return i}function Sn({mediaList:t}){const[e,i]=r.useState(null);return rn.useLazyVideos(e,{preload:"metadata"}),t.length===0?null:l.jsx("div",{ref:i,"aria-hidden":!0,style:{position:"absolute",width:0,height:0,overflow:"hidden",opacity:0,pointerEvents:"none"},children:t.map(o=>Ft(o)?l.jsx("video",{src:o.assetId,preload:"none",muted:!0,playsInline:!0},o.assetId):l.jsx("img",{src:o.assetId,alt:""},o.assetId))})}function Ht(t,e,i){const{width:o,height:s,top:c}=t,{left:p,width:u}=i,y=De(i);return e==="left"?{left:p+y-o,top:c,width:o,height:s}:{left:p+u-y,top:c,width:o,height:s}}function oe(t,e,i){const o=Ht(t,e,i);return{...o,left:2*o.left-t.left}}function kn(t,e,i){const{left:o,width:s}=i,c=De(i);return e==="left"?{left:o,top:t.top,width:c,height:t.height}:{left:o+s-c,top:t.top,width:c,height:t.height}}function _e(t,e,i,o){const s=Ht(t,"left",o),c=Ht(t,"right",o),p=oe(t,"left",o),u=oe(t,"right",o);if(i===1)switch(e){case"center":return{start:t,end:s};case"right-adjacent":return{start:c,end:t};case"left-adjacent":return{start:s,end:p};case"far-right":return{start:u,end:c};default:return{start:t,end:t}}switch(e){case"center":return{start:t,end:c};case"left-adjacent":return{start:s,end:t};case"right-adjacent":return{start:c,end:u};case"far-left":return{start:p,end:s};default:return{start:t,end:t}}}function Ln(t,e,i,o){const{start:s,end:c}=_e(t,e,i,o);return{x:c.left-s.left,y:c.top-s.top}}function Rn(t,e,i){const o=Ht(t,e,i),s=oe(t,e,i);return{x:s.left-o.left,y:s.top-o.top}}function Ve(t){if(!Array.isArray(t)||t.length===0)return!1;const e=t[0];return e!==null&&typeof e=="object"&&"media"in e&&Array.isArray(e.media)}function we(t){if(!t)return;if(Ve(t))return t;if(!Array.isArray(t))return;const[e,i]=t,o=e!=null&&e.assetId?e:void 0,s=i!=null&&i.assetId?i:void 0;if(!(!o&&!s))return[{media:[s??o??We,o??s??We]}]}function jn(t){const[e,i]=t.media;return i!=null&&i.assetId?i:e!=null&&e.assetId?e:null}function Cn(t){const[e]=t.media;return e!=null&&e.assetId?e:null}function ve(t){if(!Array.isArray(t)||t.length===0)return[];if(Ve(t)){const e=[];for(const i of t){const o=jn(i);if(!o)continue;const s=Cn(i);e.push({displayMedia:o,lightboxMedia:s!=null&&s.assetId?s:null})}return e}return t.filter(e=>e==null?void 0:e.assetId).map(e=>({displayMedia:e,lightboxMedia:e}))}function Ft(t){return t.type==="video"?!0:/\.(mp4|webm|ogg|mov)(\?|#|$)/i.test(t.assetId)}function An({media:t,className:e,style:i,gridIndex:o,onMediaClick:s}){return Ft(t)?l.jsx(on.LazyVideo,{src:t.assetId,className:e,"data-hive-grid-index":o,style:{...i,cursor:s?"pointer":"default"},muted:!0,autoPlay:!0,loop:!0,playsInline:!0,onClick:s}):l.jsx("img",{src:t.assetId,alt:t.name,className:e,"data-hive-grid-index":o,style:{...i,cursor:s?"pointer":"default"},onClick:s})}function Tn({src:t,phase:e,onMediaElement:i,wrapperStyle:o,videoStyle:s,onLoadedMetadata:c,onTransitionEnd:p}){const u=r.useRef(null);return r.useEffect(()=>{const y=u.current;return i==null||i(y??null),()=>{y==null||y.pause(),i==null||i(null)}},[t,i]),l.jsx("div",{style:o,onTransitionEnd:p,children:l.jsx("video",{ref:u,src:t,controls:e==="open",playsInline:!0,preload:"auto",onLoadedMetadata:c,onClick:y=>y.stopPropagation(),style:s},t)})}function re({media:t,style:e,onTransitionEnd:i,onMeasure:o}){return Ft(t)?l.jsx("video",{src:t.assetId,muted:!0,playsInline:!0,preload:"auto",style:e,onLoadedMetadata:s=>{const c=s.currentTarget;c.videoWidth>0&&c.videoHeight>0&&(o==null||o(t.assetId,c.videoWidth,c.videoHeight))},onTransitionEnd:i}):l.jsx("img",{src:t.assetId,alt:t.name,style:e,onLoad:s=>{const c=s.currentTarget;c.naturalWidth>0&&c.naturalHeight>0&&(o==null||o(t.assetId,c.naturalWidth,c.naturalHeight))},onTransitionEnd:i})}function En({prefix:t,items:e,index:i,entry:o,settings:s,isEditor:c,isEditMode:p,isPreviewMode:u,canNavigate:y,lightboxEntries:I,entryIdx:nt,layoutId:V,sourceRect:N,resolveCloseSourceRect:It,onClose:Nt,onPrev:Wt,onNext:Ot}){const Xt=r.useRef(null),St=r.useRef(null),kt=r.useRef(null),Lt=r.useRef(new Map),[q,Rt]=r.useState(0),it=r.useRef(null),vt=r.useRef(0),W=r.useRef(0),H=r.useRef("none"),G=r.useRef(!1),X=r.useRef(!1),rt=r.useRef(!1),ot=r.useRef(null),S=r.useRef(null),jt=r.useRef(null),ct=r.useRef(()=>{}),Y=r.useRef(null),O=r.useRef(null),ut=r.useRef(null),st=r.useRef(!1),[L,xt]=r.useState(null),[R,Yt]=r.useState(pe),[se,ae]=r.useState(0),[h,ft]=r.useState("opening"),[U,yt]=r.useState(0),[zt,k]=r.useState(0),[B,le]=r.useState(!1),[Z,dt]=r.useState(null),[$t,ht]=r.useState(null),[x,w]=r.useState(null),[gt,j]=r.useState(!1),[pt,Mt]=r.useState(null),[Dt,K]=r.useState(!1),bt=r.useRef(!1),[z,E]=r.useState(!1),[Be,xe]=r.useState(!1),ye=r.useRef(i),$e=r.useRef(void 0),g=e[i],Ut=g?Ft(g):!1,J=zt!==0||B,ce=!p&&(!c||!!u),at=y&&!p,mt=I.length>1,Ct=r.useCallback((n,a)=>e.length<=1?null:e[(n+a+e.length)%e.length]??null,[e]),C=mt?Gt(I,nt,-1):Ct(i,-1),A=mt?Gt(I,nt,1):Ct(i,1),ue=Z===-1&&J?mt&&$t!==null?Gt(I,$t,-1):x!==null?Ct(x,-1):null:null,fe=Z===1&&J?mt&&$t!==null?Gt(I,$t,1):x!==null?Ct(x,1):null:null,qe=ue&&ue.assetId!==(C==null?void 0:C.assetId)?ue:null,Ge=fe&&fe.assetId!==(A==null?void 0:A.assetId)?fe:null,Xe=C&&at?(()=>{const n=mt?Oe(I,nt,-1):e.length>2?Ct((i-1+e.length)%e.length,-1):null;return n&&n.assetId!==C.assetId?n:null})():null,Ye=A&&at?(()=>{const n=mt?Oe(I,nt,1):e.length>2?Ct((i+1)%e.length,1):null;return n&&n.assetId!==A.assetId?n:null})():null,Zt=qe??Xe,Kt=Ge??Ye,wt=r.useCallback((n,a,d)=>{if(!n||!a||!d)return;const f=Lt.current,v=f.get(n);(v==null?void 0:v.width)===a&&(v==null?void 0:v.height)===d||(f.set(n,{width:a,height:d}),Rt(D=>D+1))},[]),At=r.useCallback(n=>{if(!(n!=null&&n.assetId))return null;const a=Lt.current.get(n.assetId);return $n(St.current,a)},[q,se]),Jt=r.useCallback(()=>{if(!g)return;const n=At(g);if(n){xt(n);return}const a=St.current;a&&xt(ze(a))},[g,At]),Qt=r.useCallback(n=>{if(mt){const a=I.length;ht((nt+n+a)%a),w(null);return}e.length>1&&(w((i+n+e.length)%e.length),ht(null))},[mt,I.length,nt,e.length,i]),T=r.useCallback(n=>{rt.current=n,le(n)},[]),$=r.useCallback(()=>{ot.current!==null&&(window.clearTimeout(ot.current),ot.current=null)},[]),be=r.useCallback(()=>{$(),ot.current=window.setTimeout(()=>{$(),T(!1)},qt+32)},[$,T]),Ie=r.useCallback(()=>{const n=Xt.current;if(!n){Yt({left:0,top:0,width:typeof window<"u"?window.innerWidth:pe.width,height:typeof window<"u"?window.innerHeight:pe.height});return}const a=n.getBoundingClientRect();Yt({left:a.left,top:a.top,width:a.width,height:a.height})},[]),Se=r.useCallback((n,a)=>{if(J){if(z&&!B)return`translate(${zt}px, 0px)`;if(B&&Z!==null){const d=At(n);if(!d)return;const{x:f,y:v}=Ln(d,a,Z,R);return`translate(${f}px, ${v}px)`}if(B)return"translate(0px, 0px)"}},[J,z,B,zt,Z,R,At]),Tt=r.useCallback(()=>{const n=S.current;S.current=null,$(),T(!1),dt(null),ht(null),w(null),k(0),E(!1),G.current=!1,W.current=0,H.current="none",n===-1?Wt():n===1&&Ot()},[$,T,Wt,Ot]),Pt=r.useCallback(()=>{$(),ot.current=window.setTimeout(()=>{S.current!==null&&Tt()},qt+32)},[$,Tt]),ke=r.useCallback(()=>{$(),S.current=null,T(!1),dt(null),ht(null),w(null),k(0),E(!1),G.current=!1,W.current=0,H.current="none"},[$,T]),Le=r.useCallback(n=>{if(!(!at||!L)){if(rt.current){if(S.current===n){jt.current=n,Tt();return}ke()}$(),Qt(n),S.current=n,dt(n),T(!0),Pt()}},[at,L,Tt,ke,$,Qt,T,Pt]);ct.current=Le;const lt=r.useCallback(()=>{Y.current=null,st.current=!1,O.current!==null&&(window.clearInterval(O.current),O.current=null),ut.current!==null&&(window.clearTimeout(ut.current),ut.current=null)},[]),de=r.useCallback(n=>{O.current!==null&&window.clearInterval(O.current);const a=st.current?pn:gn;O.current=window.setInterval(()=>{ct.current(n)},a)},[]),Re=r.useCallback(n=>{Y.current!==n&&(lt(),Y.current=n,st.current=!1,ct.current(n),de(n),ut.current=window.setTimeout(()=>{ut.current=null,Y.current===n&&(st.current=!0,de(n))},hn))},[lt,de]),Q=r.useCallback(()=>{const n=St.current;if(!n)return;const a=g==null?void 0:g.assetId,d=a?Lt.current.get(a):void 0;if(d!=null&&d.width&&(d!=null&&d.height)){xt(me(n,d.width,d.height));return}const f=kt.current;if(f&&a&&(f.src===a||f.currentSrc===a)){const{width:D,height:m}=yn(f);if(D&&m){wt(a,D,m),xt(me(n,D,m));return}}const v=ze(n);!v.width||!v.height||xt(v)},[g==null?void 0:g.assetId,wt]),je=r.useCallback(n=>{if(kt.current=n,!!n){if(n instanceof HTMLVideoElement){n.readyState>=1&&n.videoWidth>0&&Q();return}n.complete&&n.naturalWidth>0&&Q()}},[Q]),_t=r.useCallback(()=>{Ie(),Q(),ae(n=>n+1)},[Ie,Q]);r.useEffect(()=>{_t();const n=St.current,a=Xt.current,d=new ResizeObserver(()=>_t());return n&&d.observe(n),a&&d.observe(a),window.addEventListener("resize",_t),()=>{d.disconnect(),window.removeEventListener("resize",_t)}},[_t,i,V]),r.useLayoutEffect(()=>{if(!g)return;const n=kt.current;if(n){if(n instanceof HTMLImageElement&&n.complete&&n.naturalWidth>0){Q();return}n instanceof HTMLVideoElement&&n.readyState>=1&&n.videoWidth>0&&Q()}},[g==null?void 0:g.assetId,i,Q]),r.useEffect(()=>{Jt()},[Jt,q]),r.useEffect(()=>{const n=new Set,a=[],d=f=>{!(f!=null&&f.assetId)||n.has(f.assetId)||(n.add(f.assetId),a.push(f))};e.forEach(d),I.forEach(f=>f.items.forEach(d)),a.forEach(f=>{Lt.current.has(f.assetId)||bn(f,wt)})},[e,I,wt]),r.useEffect(()=>{if(h!=="opening"||!L)return;if(!N){ft("open");return}j(!1);const n=requestAnimationFrame(()=>{requestAnimationFrame(()=>{j(!0),ft("open")})});return()=>cancelAnimationFrame(n)},[h,L,N]),r.useEffect(()=>{if(h!=="closing")return;const n=setTimeout(()=>Nt(),et);return()=>clearTimeout(n)},[h,Nt]),r.useEffect(()=>()=>{$()},[$]),r.useLayoutEffect(()=>{ye.current===i&&$e.current===(g==null?void 0:g.assetId)||($(),S.current=null,dt(null),ht(null),w(null),yt(0),k(0),T(!1),xe(!1),E(!1),vt.current=0,W.current=0,H.current="none",G.current=!1,it.current=null,X.current=!1,kt.current=null,Jt(),ye.current=i,$e.current=g==null?void 0:g.assetId)},[i,g==null?void 0:g.assetId,T,$,Jt]),r.useLayoutEffect(()=>{const n=jt.current;n!==null&&(jt.current=null,requestAnimationFrame(()=>{ct.current(n)}))},[i,nt,g==null?void 0:g.assetId]),r.useLayoutEffect(()=>{if(h==="opening"){bt.current=!1,K(!1);return}if(h!=="open"||bt.current)return;if(!C&&!A){bt.current=!0;return}K(!1);const n=requestAnimationFrame(()=>{requestAnimationFrame(()=>{K(!0),bt.current=!0})});return()=>cancelAnimationFrame(n)},[h,C==null?void 0:C.assetId,A==null?void 0:A.assetId]),r.useEffect(()=>{if(h!=="open")return;const n=()=>{const m=b=>{b.stopPropagation(),b.preventDefault(),document.removeEventListener("click",m,!0)};document.addEventListener("click",m,!0)},a=m=>{const b=m<0?1:-1;$(),Qt(b),S.current=b,dt(b),T(!0),Pt()},d=m=>{if(Math.abs(m)>dn&&at){a(m);return}S.current=null,dt(null),ht(null),w(null),T(!0),k(0),be()},f=m=>{if(m.touches.length!==1||rt.current)return;const b=m.touches[0];X.current=!0,it.current={x:b.clientX,y:b.clientY},H.current="none",W.current=0,G.current=!1},v=m=>{if(!it.current||m.touches.length!==1||rt.current)return;const b=m.touches[0],P=b.clientX-it.current.x,tt=b.clientY-it.current.y;if(H.current==="none"){if(Math.abs(P)<10&&Math.abs(tt)<10)return;if(Math.abs(P)>Math.abs(tt)){if(!at)return;H.current="horizontal"}else if(tt>0){if(!ce)return;H.current="vertical"}else return}if(H.current==="horizontal"){G.current=!0,E(!0),W.current=P,k(P),m.preventDefault();return}H.current==="vertical"&&(G.current=!0,E(!0),vt.current=tt,yt(tt),m.preventDefault())},D=()=>{if(!it.current)return;const m=H.current,b=G.current;if(b&&m==="horizontal")d(W.current),n();else if(b&&m==="vertical"){const P=vt.current;if(ce&&P>fn){const tt=window.innerHeight;vt.current=tt,xe(!0),yt(tt),ft("closing")}else vt.current=0,yt(0);n()}else m==="horizontal"&&Math.abs(W.current)>0&&(d(W.current),n());it.current=null,H.current="none",W.current=0,G.current=!1,E(!1)};return document.addEventListener("touchstart",f,{passive:!0}),document.addEventListener("touchmove",v,{passive:!1}),document.addEventListener("touchend",D),document.addEventListener("touchcancel",D),()=>{document.removeEventListener("touchstart",f),document.removeEventListener("touchmove",v),document.removeEventListener("touchend",D),document.removeEventListener("touchcancel",D)}},[h,at,T,be,$,ce,Pt,Qt]);const he=r.useCallback(()=>{const n=(It==null?void 0:It())??N??null;n&&L&&(Mt(n),j(!0)),ft("closing")},[It,N,L]);r.useEffect(()=>{const n=f=>{if(f.key==="Escape"){if(c&&u||h==="closing")return;lt(),he();return}if(f.key!=="ArrowLeft"&&f.key!=="ArrowRight"||h!=="open"||!at)return;f.preventDefault();const v=f.key==="ArrowLeft"?-1:1;f.repeat&&Y.current===v||Re(v)},a=f=>{if(f.key!=="ArrowLeft"&&f.key!=="ArrowRight")return;const v=f.key==="ArrowLeft"?-1:1;Y.current===v&&lt()},d=()=>{lt()};return window.addEventListener("keydown",n),window.addEventListener("keyup",a),window.addEventListener("blur",d),()=>{window.removeEventListener("keydown",n),window.removeEventListener("keyup",a),window.removeEventListener("blur",d),lt()}},[h,c,u,he,at,Re,lt]),r.useEffect(()=>{h!=="open"&&lt()},[h,lt]);const Ce=()=>{h==="closing"||p||he()},F=h==="open",te=h==="closing",Ue=U>0?Math.max(0,1-U/500):1,Ze=U>0?Math.max(.35,1-U/500):1,Et=r.useCallback(n=>{if(!(n.propertyName!=="transform"||!rt.current)){if(S.current!==null){Tt();return}$(),T(!1)}},[$,T,Tt]),ge=h==="closing"?pt??N:N,Ke=ge&&L&&(h==="opening"||te)?mn(ge,L):void 0,Je=J&&g?Se(g,"center"):U>0?`translateY(${U}px)`:Ke,M=L?ie(L,R):null,Ae=!!(ge&&L),Qe=Ae&&(h==="closing"||h==="open"&&gt),Te={position:"absolute",top:M==null?void 0:M.top,left:M==null?void 0:M.left,width:M==null?void 0:M.width,height:M==null?void 0:M.height,objectFit:"contain",transformOrigin:"top left",transform:Je,opacity:U>0?Ze:Ae?1:h==="opening"||te?0:1,transition:z&&!B?"none":B?`transform ${qt}ms ${_}`:Be?`transform ${et}ms ${_}, opacity ${et}ms ${_}`:Qe?`transform ${et}ms ${_}`:h==="opening"||te?`opacity ${et}ms ${_}`:"none",pointerEvents:Ut&&F&&!J?"auto":"none",touchAction:Ut&&F?"none":void 0,zIndex:1,overflow:Ut?"hidden":void 0},Pe={width:"100%",height:"100%",display:"block",objectFit:"contain",pointerEvents:F&&!J?"auto":"none"},ee=(n,a,d="adjacent")=>{const f=At(n);if(!f)return{display:"none"};const v=d==="far"?a==="left"?"far-left":"far-right":a==="left"?"left-adjacent":"right-adjacent",{start:D}=Z!==null?_e(f,v,Z,R):{start:d==="far"?oe(f,a,R):Ht(f,a,R)},m=ie(D,R),b=Se(n,v),P=!J&&d==="adjacent"&&F&&!Dt?Rn(f,a,R):null,tt=d==="far"&&J&&Z===(a==="left"?-1:1),tn=z&&!B?!1:B,en=d==="adjacent"&&F&&Dt&&!J;return{position:"absolute",top:m.top,left:m.left,width:m.width,height:m.height,objectFit:"contain",transform:b??(P?`translate(${P.x}px, ${P.y}px)`:void 0),opacity:d==="far"?F&&tt?1:0:F?1:0,transition:tn?d==="far"?`transform ${qt}ms ${_}`:`transform ${qt}ms ${_}, opacity ${et}ms ${_}`:en?`transform ${et}ms ${_}`:h==="opening"||te?`opacity ${et}ms ${_}`:"none",pointerEvents:"none",zIndex:1}},Ee=(n,a)=>{const d=At(n);return d?kn(Ht(d,a,R),a,R):null},He=n=>a=>{if(!p){if(X.current){X.current=!1;return}a.stopPropagation(),Le(n)}},Fe=C?Ee(C,"left"):null,Ne=A?Ee(A,"right"):null,Vt=Fe?ie(Fe,R):null,Bt=Ne?ie(Ne,R):null;return l.jsxs("div",{ref:Xt,className:[`${t}-lightbox`,c?`${t}-lightbox-editor`:"",p?`${t}-lightbox-edit-mode`:""].filter(Boolean).join(" "),style:{touchAction:h==="open"?"none":void 0},onClick:Ce,children:[l.jsx("div",{style:{position:"absolute",inset:0,background:s.backgroundColor??"#FFFFFF",opacity:F?Ue:0,transition:z?"none":`opacity ${et}ms ${_}`,pointerEvents:"none"}}),l.jsxs("div",{className:`${t}-lightbox-dismiss-area`,children:[l.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:[l.jsx("div",{style:{height:"10%"}}),l.jsx("div",{style:{width:"70%",height:"80%",display:"flex",justifyContent:"center",alignItems:"center"},children:l.jsx("div",{ref:St,style:{width:"100%",height:"100%"}})}),l.jsx("div",{style:{height:"10%"}})]}),l.jsx("div",{style:{position:"absolute",inset:0,opacity:F?1:0,transition:z?"none":`opacity ${et}ms ${_}`,pointerEvents:"none"},children:l.jsx(an.HiveLightboxTitles,{prefix:t,entry:o,settings:s,isEditor:c,isEditMode:p,isPreviewMode:u,onClose:Ce})})]}),F&&Zt&&l.jsx(re,{media:Zt,style:ee(Zt,"left","far"),onMeasure:wt,onTransitionEnd:Et},`far-prev-${Zt.assetId}`),F&&C&&l.jsxs(l.Fragment,{children:[l.jsx(re,{media:C,style:ee(C,"left"),onMeasure:wt,onTransitionEnd:Et},`prev-${C.assetId}`),Vt&&l.jsx("div",{style:{position:"absolute",top:Vt.top,left:Vt.left,width:Vt.width,height:Vt.height,cursor:p||z?"default":"pointer",pointerEvents:p||z?"none":"auto",zIndex:3},onClick:He(-1)})]}),F&&A&&l.jsxs(l.Fragment,{children:[l.jsx(re,{media:A,style:ee(A,"right"),onMeasure:wt,onTransitionEnd:Et},`next-${A.assetId}`),Bt&&l.jsx("div",{style:{position:"absolute",top:Bt.top,left:Bt.left,width:Bt.width,height:Bt.height,cursor:p||z?"default":"pointer",pointerEvents:p||z?"none":"auto",zIndex:3},onClick:He(1)})]}),F&&Kt&&l.jsx(re,{media:Kt,style:ee(Kt,"right","far"),onMeasure:wt,onTransitionEnd:Et},`far-next-${Kt.assetId}`),L&&g&&(Ut?l.jsx(Tn,{src:g.assetId,phase:h,onMediaElement:je,wrapperStyle:Te,videoStyle:Pe,onLoadedMetadata:Q,onTransitionEnd:Et},`${i}-${g.assetId}`):l.jsx("img",{ref:je,src:g.assetId,alt:g.name,onLoad:Q,onTransitionEnd:Et,style:Te},`${i}-${g.assetId}`))]})}function Hn({settings:t,content:e,isEditor:i,isPreviewMode:o,isEditMode:s,layoutId:c,portalId:p}){const{prefix:u}=nn.useScopedStyles(),{gridLayout:y,verticalGap:I,align:nt="top",imageDisplay:V}=t,N=(V==null?void 0:V.display)==="cover",It=(V==null?void 0:V.ratioValue)??"1:1",Nt=(V==null?void 0:V.reversed)??!1,[Wt,Ot]=It.split(":").map(Number),kt=`${Nt?Ot:Wt} / ${Nt?Wt:Ot}`,Lt=y.entryWidth??.2,q=y.columnsCount,Rt=ne.scalingValue(Lt,i),it=ne.scalingValue(y.horizontalGap??0,i),vt=Rt,W=Rt,H={width:vt,...N?{aspectRatio:kt,height:"auto",overflow:"hidden"}:{height:"auto"}},G=N?{objectFit:"cover",pointerEvents:"auto",width:"100%",height:"100%",maxWidth:"100%"}:{objectFit:"contain",pointerEvents:"auto",width:"auto",height:"auto",maxWidth:"100%"},X=r.useRef(null),[rt,ot]=r.useState(!1),[S,jt]=r.useState([]),[ct,Y]=r.useState(0),[O,ut]=r.useState(0),[st,L]=r.useState(null),[xt,R]=r.useState({title1:"",title2:"",title3:""}),Yt=(()=>{const x={},w=X.current?getComputedStyle(X.current).getPropertyValue("--cntrl-article-width").trim():"";return w&&(x["--cntrl-article-width"]=w),x})(),se=!i||o||s,ae=r.useMemo(()=>un(u),[u]),h=e??[],ft=h.length%q||q,U=ft<q&&h.length>0,yt=h.length-ft,zt=U?Math.floor((q-ft)/2)+1:1,k=r.useMemo(()=>vn(h),[h]),B=r.useMemo(()=>In(h),[h]),le=(x,w,gt)=>{if(i&&!s&&!o)return;const j=k.findIndex(Mt=>Mt.gridIndex===x);if(j<0)return;const pt=k[j];ut(j),jt(pt.items),Y(w),R(pt.entry),L(gt??null),ot(!0)},Z=r.useCallback(()=>{ot(!1),L(null)},[]),dt=r.useCallback(()=>{const x=k[O];return!x||!X.current?st:wn(X.current,x.gridIndex,N?"cover":"contain")??st},[k,O,st,N]),$t=r.useCallback(x=>{if(k.length>1){const w=k.length,gt=(O+x+w)%w,j=k[gt],pt=Math.min(ct,j.items.length-1);ut(gt),jt(j.items),Y(pt),R(j.entry);return}Y(w=>(w+x+S.length)%S.length)},[k,O,ct,S.length]),ht=k.length>1||S.length>1;return r.useEffect(()=>{if(!rt||typeof document>"u")return;const x=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=x}},[rt]),r.useEffect(()=>{!i||s||o||ot(!1)},[i,s,o]),l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:ae}}),l.jsx(Sn,{mediaList:B}),l.jsx("div",{ref:X,className:`${u}-wrapper ${u}-align-entries ${u}-image-align-${nt}`.trim(),style:{gridTemplateColumns:`repeat(${q}, ${Rt})`,rowGap:0,columnGap:it,width:ne.scalingValue(y.wrapperWidth??0,i),[`--${u}-align-entries-row-gap`]:ne.scalingValue(I??0,i)},children:h.map((x,w)=>{const gt=we(x.gallery),j=ve(gt),pt=j.filter(E=>E.lightboxMedia).map(E=>E.lightboxMedia),Mt=Math.floor(w/q)===Math.ceil(h.length/q)-1,Dt=U&&w>=yt?`${zt+(w-yt)}`:void 0,K=j[0],bt=K!=null&&K.lightboxMedia?pt.findIndex(E=>E.assetId===K.lightboxMedia.assetId):-1,z=l.jsx("div",{className:`${u}-item-image-wrapper`,style:H,children:j.length>0&&l.jsx(An,{media:K.displayMedia,gridIndex:w,className:`${u}-item-${Ft(K.displayMedia)?"video":"image"}`.trim(),style:G,onMediaClick:se&&bt>=0?E=>le(w,bt,Me(E.currentTarget,N?"cover":"contain")):void 0})});return l.jsx("div",{className:`${u}-item`,children:l.jsxs("div",{className:[s?`${u}-item-inner`:`${u}-item-inner-hidden`,Mt?`${u}-item-inner-last-row`:""].filter(Boolean).join(" "),style:{width:Rt,...Dt?{gridColumn:Dt}:{}},children:[l.jsx("div",{className:`${u}-item-title-row`,children:l.jsx("div",{style:{height:0,width:W}})}),l.jsx("a",{className:`${u}-item-image-link`,children:z}),l.jsx("div",{className:`${u}-item-subtitle-row`,children:l.jsx("div",{style:{height:0,width:W}})})]})},w)})}),rt&&typeof document<"u"&&(()=>{const x=(p?document.getElementById(p):null)??document.body;return sn.createPortal(l.jsx("div",{style:Yt,"data-selection":"none",children:l.jsx(En,{prefix:u,items:S,index:ct,entry:xt,settings:t,isEditor:i,isEditMode:s,isPreviewMode:o,canNavigate:ht,lightboxEntries:k,entryIdx:O,layoutId:c,sourceRect:st,resolveCloseSourceRect:dt,onClose:Z,onPrev:()=>$t(-1),onNext:()=>$t(1)})}),x)})()]})}exports.Hive=Hn;
@@ -0,0 +1,15 @@
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { forwardRef as f, useState as n, useCallback as p } from "react";
3
+ import { u as l } from "./useLazyVideos-CxXyEjRQ.mjs";
4
+ const c = f(({ autoPlay: s = !1, nearPreload: a = "auto", ...t }, o) => {
5
+ const [i, r] = n(null);
6
+ l(i, { autoPlay: s, preload: a });
7
+ const d = p((e) => {
8
+ r(e), typeof o == "function" ? o(e) : o && (o.current = e);
9
+ }, [o]);
10
+ return /* @__PURE__ */ u("video", { ...t, ref: d, preload: "none" });
11
+ });
12
+ c.displayName = "LazyVideo";
13
+ export {
14
+ c as L
15
+ };
@@ -0,0 +1 @@
1
+ "use strict";const c=require("react/jsx-runtime"),o=require("react"),l=require("./useLazyVideos-CdCbc2j0.js"),i=o.forwardRef(({autoPlay:t=!1,nearPreload:a="auto",...u},e)=>{const[d,n]=o.useState(null);l.useLazyVideos(d,{autoPlay:t,preload:a});const r=o.useCallback(s=>{n(s),typeof e=="function"?e(s):e&&(e.current=s)},[e]);return c.jsx("video",{...u,ref:r,preload:"none"})});i.displayName="LazyVideo";exports.LazyVideo=i;
@@ -0,0 +1,133 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react/jsx-runtime"),o=require("react"),P=require("classnames"),qe=require("./scalingValue-CSHYgTZl.js"),Ce=require("./useScopedStyles-Bf6yohVQ.js"),se=require("./observeIntersection-DxGj9Ctt.js"),Y=require("./useLazyVideos-CdCbc2j0.js");function Se(e,n){const r=n>0?`${n}px`:"0px";return`
2
+ .${e}-marquee-wrapper {
3
+ overflow: hidden;
4
+ width: 100%;
5
+ height: auto;
6
+ }
7
+
8
+ @keyframes ${e}-marquee-left {
9
+ from { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }
10
+ to { -webkit-transform: translate3d(-${r}, 0, 0); transform: translate3d(-${r}, 0, 0); }
11
+ }
12
+
13
+ @keyframes ${e}-marquee-right {
14
+ from { -webkit-transform: translate3d(-${r}, 0, 0); transform: translate3d(-${r}, 0, 0); }
15
+ to { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }
16
+ }
17
+
18
+ .${e}-marquee-track {
19
+ display: flex;
20
+ flex-direction: row;
21
+ width: max-content;
22
+ will-change: transform;
23
+ backface-visibility: hidden;
24
+ -webkit-backface-visibility: hidden;
25
+ flex-wrap: nowrap;
26
+ -webkit-animation-timing-function: linear;
27
+ animation-timing-function: linear;
28
+ -webkit-animation-iteration-count: infinite;
29
+ animation-iteration-count: infinite;
30
+ }
31
+
32
+ .${e}-marquee-track[data-direction="left"] {
33
+ -webkit-animation-name: ${e}-marquee-left;
34
+ animation-name: ${e}-marquee-left;
35
+ }
36
+
37
+ .${e}-marquee-track[data-direction="right"] {
38
+ -webkit-animation-name: ${e}-marquee-right;
39
+ animation-name: ${e}-marquee-right;
40
+ }
41
+ .${e}-marquee-row {
42
+ display: flex;
43
+ flex-direction: row;
44
+ align-items: flex-start;
45
+ }
46
+ .${e}-marquee-set {
47
+ flex: 0 0 auto;
48
+ }
49
+ .${e}-marquee-static {
50
+ justify-content: center;
51
+ overflow-x: auto;
52
+ }
53
+ .${e}-marquee-card {
54
+ position: relative;
55
+ flex: 0 0 auto;
56
+ align-self: flex-start;
57
+ }
58
+ .${e}-wrapper {
59
+ position: relative;
60
+ width: 100%;
61
+ height: 100%;
62
+ order: 1;
63
+ }
64
+ .${e}-cover {
65
+ position: absolute;
66
+ width: 100%;
67
+ height: 100%;
68
+ top: 0;
69
+ left: 0;
70
+ }
71
+ .${e}-elements-overlay {
72
+ position: relative;
73
+ inset: 0;
74
+ display: flex;
75
+ flex-direction: column;
76
+ pointer-events: none;
77
+ }
78
+ .${e}-control {
79
+ position: relative;
80
+ z-index: 2;
81
+ width: 100%;
82
+ }
83
+
84
+ .${e}-marquee-link {
85
+ display: flex;
86
+ flex-direction: column;
87
+ justify-content: center;
88
+ align-items: center;
89
+ width: 100%;
90
+ height: 100%;
91
+ text-decoration: none;
92
+ color: inherit;
93
+ }
94
+ .${e}-marquee-link-contain {
95
+ width: auto;
96
+ height: auto;
97
+ }
98
+
99
+ .${e}-control::before {
100
+ content: "";
101
+ position: absolute;
102
+ top: 0;
103
+ left: 0;
104
+ width: 100%;
105
+ height: 100%;
106
+ min-height: 20px;
107
+ pointer-events: auto;
108
+ z-index: 10;
109
+ }
110
+
111
+ .${e}-gap-control {
112
+ position: relative;
113
+ z-index: 2;
114
+ pointer-events: auto;
115
+ height: 100%;
116
+ }
117
+ .${e}-image-hover-brightness img,
118
+ .${e}-image-hover-brightness video {
119
+ transition: filter 0.3s ease;
120
+ }
121
+ .${e}-image-hover-brightness:hover img,
122
+ .${e}-image-hover-brightness:hover video {
123
+ filter: brightness(1.25);
124
+ }
125
+ .${e}-image-hover-grayscale img,
126
+ .${e}-image-hover-grayscale video {
127
+ transition: filter 0.3s ease;
128
+ }
129
+ .${e}-image-hover-grayscale:hover img,
130
+ .${e}-image-hover-grayscale:hover video {
131
+ filter: grayscale(100%);
132
+ }
133
+ `}const Ee=30,ke=20,ce=3,Ne=12,Me=32,Ae=3,_e=250,We=.5,Ie=e=>{e.style.setProperty("animation-name","none"),e.style.setProperty("-webkit-animation-name","none"),e.offsetHeight,e.style.removeProperty("animation-name"),e.style.removeProperty("-webkit-animation-name")},Ve=(e,n)=>Array.from({length:n},()=>e).flat(),je=e=>typeof e=="string"?{display:e.toLowerCase()==="cover"?"cover":"fit",ratioValue:"16:9",reversed:!1}:{display:(typeof(e==null?void 0:e.display)=="string"?e.display.toLowerCase():"")==="cover"?"cover":"fit",ratioValue:(e==null?void 0:e.ratioValue)??"16:9",reversed:(e==null?void 0:e.reversed)??!1},ve=e=>e.reduce((n,r)=>n+(r.offsetWidth||r.getBoundingClientRect().width),0),ye=(e,n)=>{if(n<=0||e.children.length<n)return 0;const r=e.children[0],f=e.children[n-1];if(!r||!f)return 0;const p=getComputedStyle(e),d=Number.parseFloat(p.columnGap||p.gap||"0")||0,b=f.getBoundingClientRect().right-r.getBoundingClientRect().left;if(b>0)return b;const q=Array.from({length:n},(w,_)=>e.children[_]),m=ve(q);return m<=0?0:m+d*Math.max(0,n-1)},Te=e=>{const n=e.getBoundingClientRect().width;if(n>0)return n;const r=e.offsetWidth;if(r>0)return r;const f=ve(Array.from(e.children));if(f<=0)return 0;const p=getComputedStyle(e),d=Number.parseFloat(p.columnGap||p.gap||"0")||0,b=Number.parseFloat(p.paddingRight)||0;return f+d*Math.max(0,e.children.length-1)+b},Le=(e,n)=>{const r=n.getBoundingClientRect(),f=e.getBoundingClientRect();return f.right>r.left&&f.left<r.right},Oe=(e,n)=>{const r=e.querySelectorAll(`[data-marquee-item-index="${n}"]`);return Array.from(r).some(f=>Le(f,e))},He=e=>{if(e.type==="video")return!0;if(e.type==="image")return!1;const n=e.name??"";return/\.(mp4|webm|ogg|mov)(\?|$)/i.test(n)?!0:/\.(mp4|webm|ogg|mov)(\?|$)/i.test(e.assetId??"")},Be=e=>e?e instanceof HTMLVideoElement?e.readyState>=1:e.complete:!1,ze=({item:e,prefix:n,imageFit:r,imageMaxWidth:f,imageMaxHeight:p,cornerRadius:d,imageHoverClass:b,isFirstSet:q,scaled:m,onFirstSetImageDone:w})=>{var N,M,L,O;const _=o.useRef(null),U=!!((N=e.image)!=null&&N.assetId&&He(e.image));o.useLayoutEffect(()=>{q&&Be(_.current)&&(w==null||w())},[q,(M=e.image)==null?void 0:M.assetId,w]);const j=r.display==="cover",S=r.ratioValue??"1:1",F=r.reversed??!1,[G,C]=S.split(":").map(Number),X=(F?C:G)/(F?G:C),E=f/X,D=E>p?p:E,W=E>p?p*X:f,J=m(W),k=m(D),Z={borderRadius:m(d)},x=j?{pointerEvents:"auto",display:"block",width:"100%",height:"100%",objectFit:"cover",...Z}:{pointerEvents:"auto",display:"block",width:"auto",height:"auto",maxWidth:m(f),maxHeight:m(p),objectFit:"contain",...Z},I=((L=e.image)==null?void 0:L.assetId)&&(U?v.jsx("video",{ref:V=>{_.current=V},src:e.image.assetId,style:x,muted:!0,loop:!0,playsInline:!0,preload:"none",onLoadedMetadata:q?w:void 0,onError:q?w:void 0}):v.jsx("img",{ref:V=>{_.current=V},src:e.image.assetId,alt:((O=e.image)==null?void 0:O.name)??"",style:x,onLoad:q?w:void 0,onError:q?w:void 0}));return v.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"start",...j?{width:J}:{width:"max-content",maxWidth:m(f),minWidth:0}},children:v.jsx("div",{className:b,style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",flexShrink:0,...j?{width:J,height:k,overflow:"hidden",...Z}:{width:"max-content",maxWidth:m(f),height:m(p)}},children:I&&e.link?v.jsx("a",{href:e.link,target:"_self",rel:"noopener noreferrer",className:P(`${n}-marquee-link`,!j&&`${n}-marquee-link-contain`),children:I}):I})})},Ue=({settings:e,content:n,isEditor:r,isPreviewMode:f,isEditMode:p})=>{const{prefix:d}=Ce.useScopedStyles(),[b,q]=o.useState(0),m=b>0?Math.round(b):0,w=o.useMemo(()=>Se(d,m),[d,m]),{speed:_,direction:U,pauseOnHover:j,gap:S,imageMaxWidth:F,imageMaxHeight:G,hoverEffect:C,cornerRadius:le=0}=e,T=o.useMemo(()=>je(e.imageFit),[e.imageFit]),X=T.display!=="cover",E=(n==null?void 0:n.length)??0,D=!!p,W=!r||!!f,J=W&&C!=="off"&&C!=="randomize"?`${d}-image-hover-${C}`:void 0,k=r?!!f:!0,x=((n==null?void 0:n.length)??0)>0&&(k||!!r),I=Math.max(0,_)*Ee,N=t=>qe.scalingValue(t,r??!1),M=o.useRef(null),L=o.useRef(null),O=o.useRef(null),[V,ue]=o.useState(0),ee=k&&j==="on",[be,de]=o.useState(!1),[H,te]=o.useState({}),ne=o.useRef(H);ne.current=H;const re=o.useRef(null),ae=o.useRef(0),K=o.useRef(null),fe=o.useMemo(()=>(n??[]).map(t=>{var a;return((a=t.image)==null?void 0:a.assetId)??""}).join("\0"),[n]),[B,me]=o.useState(ce),oe=o.useMemo(()=>{const t=n??[];return t.length===0||!(k||!!r)?t:Ve(t,B)},[n,k,B,r]),he=o.useMemo(()=>(n??[]).filter(t=>{var a;return!!((a=t.image)!=null&&a.assetId)}).length,[n]),ge=x?Ae:1;o.useLayoutEffect(()=>{ae.current=0,te({}),re.current=null,me(ce),q(0)},[fe]),o.useEffect(()=>{if(!W||C!=="randomize")return;const t=M.current;if(!t)return;const a=c=>{te(l=>{const y=Array.from(c).filter(g=>g in l&&!Oe(t,g));if(y.length===0)return l;const h={...l};return y.forEach(g=>{delete h[g]}),h})},i=new IntersectionObserver(c=>{const l=new Set;for(const y of c){const h=y.target.dataset.marqueeItemIndex,g=h!==void 0?Number(h):NaN;Number.isNaN(g)||l.add(g)}l.size>0&&a(l)},{root:t,threshold:0});Object.keys(H).forEach(c=>{const l=Number(c);t.querySelectorAll(`[data-marquee-item-index="${l}"]`).forEach(y=>i.observe(y))});const u={current:0},s=()=>{const c=Object.keys(ne.current);c.length!==0&&(a(c.map(Number)),u.current=requestAnimationFrame(s))};return Object.keys(ne.current).length>0&&(u.current=requestAnimationFrame(s)),()=>{cancelAnimationFrame(u.current),i.disconnect()}},[C,H,W]),o.useEffect(()=>{const t=M.current;if(!t||typeof IntersectionObserver>"u")return;let a=!1,i=!1,u;const s=()=>{const h=t.querySelectorAll("video");if(!a){h.forEach(Y.pauseVideo);return}const g=t.getBoundingClientRect(),A=g.width*We;h.forEach($=>{const Q=$.getBoundingClientRect(),z=Q.right>g.left&&Q.left<g.right;Q.right>g.left-A&&Q.left<g.right+A?Y.raisePreload($,"auto"):X&&Y.raisePreload($,"metadata"),i&&z?$.paused&&Y.playVideo($):Y.pauseVideo($)})},c=()=>{a&&u===void 0?u=setInterval(s,_e):!a&&u!==void 0&&(clearInterval(u),u=void 0),s()},l=se.observeIntersection(t,se.NEAR_VIEWPORT_MARGIN,h=>{a=h,c()}),y=se.observeIntersection(t,"0px",h=>{i=h,c()});return()=>{l(),y(),clearInterval(u)}},[x,X]),o.useLayoutEffect(()=>{if(!x)return;const t=M.current,a=O.current;if(!t||!a)return;const i={current:0},u=()=>{const l=t.getBoundingClientRect().width||t.offsetWidth,y=Te(a),h=re.current,g=typeof h=="number"&&Math.abs(h-y)<=.25;re.current=y;let A=B,$=0;if((k||r)&&E>0&&l>0){const R=ye(a,E);if(R>=Me){$=R;const ie=Math.min(Ne,Math.max(ce,Math.ceil(l/R)+1));A=ie,ie!==B&&me(ie)}}const z=A!==B&&$>0?$*A:y>0?y:$>0?$*A:(()=>{const R=ye(a,E);return R>0?R*A:0})();z>0?q(R=>R<=0?z:!g||Math.round(R)===Math.round(z)?R:z):!g&&b<=0&&(cancelAnimationFrame(i.current),i.current=requestAnimationFrame(u))},s=()=>{cancelAnimationFrame(i.current),i.current=requestAnimationFrame(u)};K.current=s,s();const c=new ResizeObserver(s);return c.observe(t),c.observe(a),()=>{K.current=null,cancelAnimationFrame(i.current),c.disconnect()}},[k,x,b,fe,B,E,r]),o.useLayoutEffect(()=>{if(!x||m<=0)return;const t=L.current;t&&Ie(t)},[x,m,U,I]),o.useLayoutEffect(()=>{if(!x||b<=0){ue(0);return}const t=L.current,a=O.current;if(!t||!a)return;const i=()=>{const s=t.offsetHeight||t.getBoundingClientRect().height,c=Array.from(a.children).reduce((y,h)=>Math.max(y,h.offsetHeight||h.getBoundingClientRect().height),0),l=s>0?s:c;ue(l>0?l:0)};i();const u=new ResizeObserver(i);return u.observe(t),u.observe(a),()=>u.disconnect()},[x,ge,oe,r,S,F,G,b,T,H]),o.useLayoutEffect(()=>{if(!r||!D||!x||typeof window>"u")return;const t=requestAnimationFrame(()=>{window.dispatchEvent(new Event("scroll"))});return()=>cancelAnimationFrame(t)},[r,D,x,U,b,V,S,oe]);const xe=()=>{ee&&de(!0)},we=()=>{ee&&de(!1)},$e=o.useCallback(()=>{var t;ae.current=Math.min(he,ae.current+1),(t=K.current)==null||t.call(K)},[he]),Re=o.useCallback((t,a)=>{te(i=>{const u=i[t]??a,s=(n??[]).filter(l=>l!==u);if(s.length===0)return i;const c=s[Math.floor(Math.random()*s.length)];return{...i,[t]:c}})},[n]),pe=(t,a,i,u)=>{const s=W&&C==="randomize"&&T.display==="cover"?H[i]??t:t,c=`max(${N(S)}, ${ke}px)`,l=`calc(-0.5 * (${c} + ${N(S)}))`;return v.jsxs("div",{className:`${d}-marquee-card`,"data-marquee-item-index":i,onMouseEnter:W&&C==="randomize"&&T.display==="cover"?()=>Re(i,t):void 0,children:[v.jsx(ze,{item:s,prefix:d,imageFit:T,imageMaxWidth:F,imageMaxHeight:G,cornerRadius:le,imageHoverClass:J,isEditor:r,isFirstSet:u,scaled:N,onFirstSetImageDone:$e}),D&&v.jsx("div",{"data-controls":"gap","data-controls-axis":"x",className:`${d}-gap-control`,style:{position:"absolute",top:0,right:l,width:c,height:"100%"}})]},`${a}-${i}`)};if(x){const t=k?ee&&be?"paused":"running":"paused",a=m>0&&I>0?m/I*1e3:0,i=`${Math.max(0,a)/1e3}s`;return v.jsxs("div",{ref:M,className:P(`${d}-wrapper`,`${d}-marquee-wrapper`),"aria-label":"Marquee",style:V>0?{height:V}:void 0,children:[v.jsx("style",{dangerouslySetInnerHTML:{__html:w}}),v.jsx("div",{ref:L,className:`${d}-marquee-track`,"data-direction":U,onMouseEnter:xe,onMouseLeave:we,style:{WebkitAnimationDuration:i,animationDuration:i,WebkitAnimationPlayState:t,animationPlayState:t},children:Array.from({length:ge},(u,s)=>v.jsx("div",{ref:s===0?O:void 0,className:P(`${d}-marquee-row`,`${d}-marquee-set`),style:{gap:N(S),paddingRight:N(S)},"aria-hidden":s>0,children:oe.map((c,l)=>pe(c,s,l,s===0&&l<E))},`set-${s}`))})]})}return v.jsxs("div",{ref:M,className:`${d}-wrapper`,children:[v.jsx("style",{dangerouslySetInnerHTML:{__html:w}}),v.jsx("div",{className:P(`${d}-marquee-row`,`${d}-marquee-static`),style:{gap:N(S),transform:"none"},"aria-label":"Marquee",children:n==null?void 0:n.map((t,a)=>pe(t,0,a))},"marquee-static")]})};exports.Marquee=Ue;