@cntrl-site/components 1.0.104 → 1.0.106

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 (99) hide show
  1. package/dist/ClickGallerie-CYQMgrIr.js +36 -0
  2. package/dist/ClickGallerie-o2U6oyOF.mjs +272 -0
  3. package/dist/Components/ClickGallerie/ClickGallerie.d.ts +2 -1
  4. package/dist/Components/Helix/Helix.d.ts +4 -1
  5. package/dist/Components/Hive/Hive.d.ts +4 -1
  6. package/dist/Components/ImageRevealSlider/ImageRevealSlider.d.ts +2 -1
  7. package/dist/Components/List/List.d.ts +6 -2
  8. package/dist/Components/Marquee/Marquee.d.ts +6 -2
  9. package/dist/Components/MarqueeText/MarqueeText.d.ts +2 -1
  10. package/dist/Components/Mercury/Mercury.d.ts +4 -1
  11. package/dist/Components/Waterfall/WaterfallLightbox.d.ts +4 -1
  12. package/dist/Components/utils/EmbedMediaFrame.d.ts +27 -0
  13. package/dist/Components/utils/LinkWrapper.d.ts +16 -0
  14. package/dist/Components/utils/embedMedia.d.ts +40 -0
  15. package/dist/Components/utils/index.d.ts +6 -0
  16. package/dist/Components/utils/observeIntersection.d.ts +4 -0
  17. package/dist/Components/utils/useLazyVideos.d.ts +0 -3
  18. package/dist/{ControlSlider-SiOt22l_.js → ControlSlider-Kkec-i14.js} +1 -1
  19. package/dist/{ControlSlider-pZv7H6BU.mjs → ControlSlider-LcZmviGX.mjs} +1 -1
  20. package/dist/EmbedMediaFrame-DsOTKE4i.js +1 -0
  21. package/dist/EmbedMediaFrame-DwHeOAy5.mjs +164 -0
  22. package/dist/{FAQ-C7823fyi.js → FAQ-BxhMo7T8.js} +1 -1
  23. package/dist/{FAQ-CZ39u4m8.mjs → FAQ-CdwSft5p.mjs} +1 -1
  24. package/dist/Grid-CFHTP3mb.js +378 -0
  25. package/dist/Grid-e-gLfsji.mjs +1590 -0
  26. package/dist/Helix-BpLo9FD3.js +43 -0
  27. package/dist/Helix-CidI3ucE.mjs +324 -0
  28. package/dist/{Hive-BusARSOi.mjs → Hive-BsmFHk2i.mjs} +505 -475
  29. package/dist/Hive-D1j6wZpV.js +321 -0
  30. package/dist/ImageRevealSlider-BuukTGAK.js +1 -0
  31. package/dist/{ImageRevealSlider-BdFGyVEP.mjs → ImageRevealSlider-Df9sygk9.mjs} +63 -70
  32. package/dist/{LazyVideo-D8eVYFyw.mjs → LazyVideo-CdAWymKO.mjs} +1 -1
  33. package/dist/{LazyVideo-Cn_vmMq8.js → LazyVideo-imbU18js.js} +1 -1
  34. package/dist/{Lightbox-eP9qAZzL.mjs → Lightbox-C_fXsfdz.mjs} +1 -1
  35. package/dist/{Lightbox-CIss_nOG.js → Lightbox-DaunVrkp.js} +1 -1
  36. package/dist/LinkWrapper-Ca84iPtg.js +1 -0
  37. package/dist/LinkWrapper-DZs9hlOn.mjs +13 -0
  38. package/dist/{List-DW7fyJbf.mjs → List-Bh_-l9vD.mjs} +532 -520
  39. package/dist/List-DVvpQ24J.js +377 -0
  40. package/dist/Marquee-DByooiWP.mjs +578 -0
  41. package/dist/Marquee-DfIP-tIN.js +133 -0
  42. package/dist/MarqueeText-D6FNCe6P.mjs +518 -0
  43. package/dist/MarqueeText-DsUiV6Zv.js +132 -0
  44. package/dist/Mercury-B-s2Kvuq.js +267 -0
  45. package/dist/Mercury-CCW0Es-s.mjs +1700 -0
  46. package/dist/PretextComponent-Dnbenstn.js +1 -0
  47. package/dist/{PretextComponent-s4DDfmzY.mjs → PretextComponent-OygSO3fr.mjs} +312 -269
  48. package/dist/{RichTextRenderer-B6WtTYlR.mjs → RichTextRenderer-BptwNpbJ.mjs} +10 -9
  49. package/dist/RichTextRenderer-K90Dd7pt.js +1 -0
  50. package/dist/{Slider20-Dm8BeCli.mjs → Slider20-CCzixTiN.mjs} +1 -1
  51. package/dist/{Slider20-C9o2REDl.js → Slider20-fMVeRfgx.js} +1 -1
  52. package/dist/{TestimonialGrid-CPu4qQ6B.mjs → TestimonialGrid-CbsVxSn9.mjs} +1 -1
  53. package/dist/{TestimonialGrid-D4ieiz9e.js → TestimonialGrid-CiCagfBU.js} +1 -1
  54. package/dist/{TestimonialSingle-DLdnAVF7.mjs → TestimonialSingle-BVm3Amrl.mjs} +1 -1
  55. package/dist/{TestimonialSingle-CVu15ZtV.js → TestimonialSingle-BWXynGjv.js} +1 -1
  56. package/dist/Waterfall-3kKioKh2.mjs +1432 -0
  57. package/dist/Waterfall-DII4-WV5.js +288 -0
  58. package/dist/{components-Yf9Zjska.mjs → components-BRmbflgg.mjs} +15 -15
  59. package/dist/components-nvbH4l0S.js +1 -0
  60. package/dist/content/postFieldBindings.d.ts +29 -0
  61. package/dist/elements.js +1 -1
  62. package/dist/elements.mjs +16 -16
  63. package/dist/elements.node.js +1 -1
  64. package/dist/elements.node.mjs +1 -1
  65. package/dist/index.d.ts +3 -1
  66. package/dist/index.js +1 -1
  67. package/dist/index.mjs +52 -15
  68. package/dist/observeIntersection-B0f3L2iK.mjs +23 -0
  69. package/dist/observeIntersection-DxGj9Ctt.js +1 -0
  70. package/dist/sources.js +335 -223
  71. package/dist/sources.mjs +339 -227
  72. package/dist/types/SchemaV1.d.ts +53 -1
  73. package/dist/useLazyVideos-CdCbc2j0.js +1 -0
  74. package/dist/useLazyVideos-CxXyEjRQ.mjs +52 -0
  75. package/dist/utils.js +1 -1
  76. package/dist/utils.mjs +30 -20
  77. package/package.json +1 -1
  78. package/dist/ClickGallerie-D7g093HX.js +0 -36
  79. package/dist/ClickGallerie-QSOQjSdv.mjs +0 -271
  80. package/dist/Grid-B2_o1dvz.mjs +0 -1576
  81. package/dist/Grid-Bq6bk2AQ.js +0 -374
  82. package/dist/Helix-B7rxlvKq.js +0 -43
  83. package/dist/Helix-BrKQzGX5.mjs +0 -315
  84. package/dist/Hive-Dh5nKPGm.js +0 -321
  85. package/dist/ImageRevealSlider-BBWtFjUF.js +0 -1
  86. package/dist/List-C32WImI3.js +0 -377
  87. package/dist/Marquee-CdtAqhQE.mjs +0 -563
  88. package/dist/Marquee-DUN8wUax.js +0 -133
  89. package/dist/MarqueeText-4Rip_sQX.mjs +0 -515
  90. package/dist/MarqueeText-E6OubMOG.js +0 -132
  91. package/dist/Mercury-BRqlbk4i.mjs +0 -1702
  92. package/dist/Mercury-C-O2VGkK.js +0 -267
  93. package/dist/PretextComponent-D5P0AjnL.js +0 -1
  94. package/dist/RichTextRenderer-CIy6yI8U.js +0 -1
  95. package/dist/Waterfall-DKuh4bnv.mjs +0 -1404
  96. package/dist/Waterfall-fdiHR0Rc.js +0 -287
  97. package/dist/components-DzNixU7Q.js +0 -1
  98. package/dist/useLazyVideos-BbgdvELi.js +0 -1
  99. package/dist/useLazyVideos-CZLyNolX.mjs +0 -72
@@ -1,315 +0,0 @@
1
- import { jsxs as ce, Fragment as ie, jsx as h } from "react/jsx-runtime";
2
- import { useRef as V, useMemo as y, useEffect as Ee } from "react";
3
- import { s as ae } from "./scalingValue-C9JH5L6O.mjs";
4
- import { u as xe } from "./useScopedStyles-DhBG3557.mjs";
5
- import { L as Re } from "./LazyVideo-D8eVYFyw.mjs";
6
- const Te = 10, _e = 400, Se = 1, Fe = 1120 / 1440, Ae = 140 / 1440, we = 550 / 1440, Ne = 13, De = 4, $e = 38 / 100, Ce = 28 / 100, de = 2.8, Le = 0.9, fe = 0.22, He = 0.5, Pe = 1, Ue = 1.5, ge = 0, ze = 0.85;
7
- function We(e) {
8
- return `
9
- .${e}-wrapper {
10
- position: relative;
11
- box-sizing: border-box;
12
- overflow: hidden;
13
- isolation: isolate;
14
- contain: layout paint;
15
- }
16
- .${e}-item {
17
- position: absolute;
18
- left: 0;
19
- width: var(--helix-base-w);
20
- overflow: hidden;
21
- transform-origin: center center;
22
- }
23
- .${e}-item-cover {
24
- height: var(--helix-base-h);
25
- }
26
- .${e}-media {
27
- display: block;
28
- width: 100%;
29
- max-width: 100%;
30
- height: auto;
31
- vertical-align: top;
32
- user-select: none;
33
- pointer-events: none;
34
- }
35
- .${e}-cover {
36
- display: block;
37
- width: 100%;
38
- height: 100%;
39
- overflow: hidden;
40
- position: relative;
41
- }
42
- .${e}-cover .${e}-media {
43
- position: absolute;
44
- inset: 0;
45
- width: 100%;
46
- height: 100%;
47
- object-fit: cover;
48
- object-position: center;
49
- }
50
- `;
51
- }
52
- function me(e) {
53
- return Number(e.toFixed(4));
54
- }
55
- function le(e, t, o, r) {
56
- const a = (typeof e == "string" ? Number(e) : e) ?? t;
57
- return Number.isFinite(a) ? Math.min(r, Math.max(o, Math.round(a))) : t;
58
- }
59
- function j(e, t, o = 0, r = 9999) {
60
- const a = (typeof e == "string" ? Number(e) : e) ?? t;
61
- return Number.isFinite(a) ? Math.min(r, Math.max(o, a)) : t;
62
- }
63
- function Be(e) {
64
- return typeof e == "string" ? {
65
- display: e.toLowerCase() === "cover" ? "cover" : "fit",
66
- ratioValue: "2:3",
67
- reversed: !1
68
- } : {
69
- display: (typeof (e == null ? void 0 : e.display) == "string" ? e.display.toLowerCase() : "") === "cover" ? "cover" : "fit",
70
- ratioValue: (e == null ? void 0 : e.ratioValue) ?? "2:3",
71
- reversed: (e == null ? void 0 : e.reversed) ?? !1
72
- };
73
- }
74
- function Ge(e) {
75
- const [t, o] = e.ratioValue.split(":").map(Number), r = e.reversed ? o : t;
76
- return (e.reversed ? t : o) / r;
77
- }
78
- function Ve(e) {
79
- return e.type === "video" ? !0 : e.type === "image" ? !1 : /\.(mp4|webm|ogg|mov)(\?|$)/i.test(e.name ?? "") || /\.(mp4|webm|ogg|mov)(\?|$)/i.test(e.assetId ?? "");
80
- }
81
- function he(e, t) {
82
- return (1 - e) / (1 - e * Math.cos(t));
83
- }
84
- function je(e) {
85
- let t = 0;
86
- for (let o = 0; o < 360; o += 1) {
87
- const r = o * Math.PI / 180;
88
- t = Math.max(t, Math.abs(Math.sin(r) * he(e, r)));
89
- }
90
- return t || 1;
91
- }
92
- function ke(e, t) {
93
- return e ? 1 : 1 + fe * (0.35 + t);
94
- }
95
- function Xe(e, t, o, r) {
96
- const n = t * ke(o, r);
97
- return Math.max(0, (e - n) / 2);
98
- }
99
- function Je(e, t, o) {
100
- const r = he(e, o);
101
- return {
102
- offset: Math.sin(o) * r / t,
103
- scale: r
104
- };
105
- }
106
- function Ye(e, t, o) {
107
- return e / 2 + t * o;
108
- }
109
- function Ze(e, t, o) {
110
- return `translate(calc(${e(t)} - var(--helix-base-w) / 2), -50%) scale(${me(o)})`;
111
- }
112
- function qe(e) {
113
- return Math.round(e * 1e3);
114
- }
115
- function pe(e, t, o) {
116
- const r = Math.cos(e), n = Math.cos(ze * Math.PI / 2);
117
- if (r >= n)
118
- return o;
119
- const a = (r + 1) / (n + 1);
120
- return me(t + (o - t) * a);
121
- }
122
- function Ke(e) {
123
- return pe(e, He, Pe);
124
- }
125
- function Qe(e) {
126
- return pe(e, Ue, ge);
127
- }
128
- function et(e, t) {
129
- if (!t) return "none";
130
- const o = Qe(e);
131
- return o <= 0 ? "none" : `blur(${o}px)`;
132
- }
133
- function se(e, t) {
134
- const o = t * Math.PI * 2, { offset: r, scale: n } = Je(e.depthFactor, e.spreadFactor, o), a = Ye(e.width, e.orbitRadius, r);
135
- return {
136
- transform: Ze(e.scaled, a, n),
137
- zIndex: qe(n),
138
- opacity: Ke(o),
139
- filter: et(o, e.blurEnabled)
140
- };
141
- }
142
- function be(e, t) {
143
- return (e % t + t) % t;
144
- }
145
- function tt(e, t) {
146
- return k(e, t) / t;
147
- }
148
- function k(e, t) {
149
- return be(e, t);
150
- }
151
- function ot(e, t) {
152
- return Math.floor(e / t);
153
- }
154
- function rt(e, t, o, r) {
155
- return ot(e, t) * o + k(e, t) * r;
156
- }
157
- function ue(e) {
158
- const t = Math.sin(e * 12.9898) * 43758.5453;
159
- return t - Math.floor(t);
160
- }
161
- function H(e) {
162
- const t = e % 1;
163
- return t < 0 ? t + 1 : t;
164
- }
165
- function nt(e, t, o) {
166
- const r = t / de, n = o === "left" ? -e * r : e * r;
167
- return H(n);
168
- }
169
- function dt({
170
- settings: e,
171
- content: t,
172
- isEditor: o,
173
- isPreviewMode: r
174
- }) {
175
- const { prefix: n } = xe(), a = V(null), M = j(
176
- (e == null ? void 0 : e.width) ?? (e == null ? void 0 : e.spread) ?? (e == null ? void 0 : e.wrapperWidth),
177
- Fe
178
- ), _ = j(e == null ? void 0 : e.imageWidth, Ae), P = j(e == null ? void 0 : e.turnHeight, we), f = le(e == null ? void 0 : e.itemsPerTurn, Ne, 3, 40), U = le(e == null ? void 0 : e.turns, De, 1, 30), S = Math.min(Le, Math.max(0, $e)), E = Math.min(1, Math.max(0, Ce)), F = Math.max(0, (e == null ? void 0 : e.speed) ?? de), g = (e == null ? void 0 : e.direction) === "left" ? "left" : "right", X = (e == null ? void 0 : e.playback) === "scroll" ? "scroll" : "autoplay", J = (e == null ? void 0 : e.cornerRadius) ?? 0, Y = (e == null ? void 0 : e.blur) !== "off", Z = y(() => Be(e == null ? void 0 : e.imageDisplay), [e == null ? void 0 : e.imageDisplay]), p = Z.display === "cover", b = (i) => ae(i, o ?? !1), q = y(() => je(S), [S]), K = y(
179
- () => Xe(M, _, p, E),
180
- [M, _, p, E]
181
- ), Q = y(() => We(n), [n]), z = y(
182
- () => ({
183
- scaled: (i) => ae(i, o ?? !1),
184
- width: M,
185
- orbitRadius: K,
186
- depthFactor: S,
187
- spreadFactor: q,
188
- blurEnabled: Y
189
- }),
190
- [o, M, K, S, q, Y]
191
- ), ee = V([]), x = V(0), A = y(
192
- () => (t ?? []).filter((i) => {
193
- var s;
194
- return !!((s = i.image) != null && s.assetId);
195
- }),
196
- [t]
197
- ), W = P / f, ve = _ * Ge(Z), ye = Math.min(_e, U * f), w = Se * f, te = ye + w * 2, Me = Math.max(0, U - 1) * P + (f - 1) * W, oe = F > 0, N = X === "scroll" && oe, D = X === "autoplay" && oe && (o ? !!r : !0), re = D ? 360 / (F * Te) : 0, ne = A.length === 0 ? 0 : te, B = y(
198
- () => Array.from({ length: ne }, (i, s) => tt(s - w, f)),
199
- [ne, w, f]
200
- );
201
- Ee(() => {
202
- if (!D && !N) return;
203
- const i = a.current;
204
- if (!i) return;
205
- const s = (c) => {
206
- x.current = c, B.forEach((l, O) => {
207
- const d = ee.current[O];
208
- if (!d) return;
209
- const u = se(z, H(l + c));
210
- d.style.transform = u.transform, d.style.zIndex = String(u.zIndex), d.style.opacity = String(u.opacity), d.style.filter = u.filter;
211
- });
212
- };
213
- if (N) {
214
- const c = i.ownerDocument.defaultView ?? window, l = () => {
215
- const d = i.getBoundingClientRect(), u = c.innerHeight || i.ownerDocument.documentElement.clientHeight, T = u + d.height;
216
- if (T <= 0) return;
217
- const L = Math.min(1, Math.max(0, (u - d.top) / T));
218
- s(nt(L, F, g));
219
- };
220
- l(), c.addEventListener("scroll", l, { passive: !0, capture: !0 }), c.addEventListener("resize", l);
221
- const O = new ResizeObserver(l);
222
- return O.observe(i), () => {
223
- c.removeEventListener("scroll", l, { capture: !0 }), c.removeEventListener("resize", l), O.disconnect();
224
- };
225
- }
226
- const I = g === "left" ? -1 : 1;
227
- let v = null, m = null;
228
- const R = (c) => {
229
- if (m !== null) {
230
- const l = (c - m) / 1e3 / re * I;
231
- x.current = H(x.current + l);
232
- }
233
- m = c, s(x.current), v = requestAnimationFrame(R);
234
- }, G = () => {
235
- v === null && (m = null, v = requestAnimationFrame(R));
236
- }, $ = () => {
237
- v !== null && cancelAnimationFrame(v), v = null;
238
- }, C = new IntersectionObserver(([c]) => {
239
- c != null && c.isIntersecting ? G() : $();
240
- });
241
- return C.observe(i), () => {
242
- $(), C.disconnect();
243
- };
244
- }, [D, N, B, z, re, F, g]);
245
- const Ie = D || N ? x.current : 0;
246
- return A.length === 0 ? /* @__PURE__ */ ce(ie, { children: [
247
- /* @__PURE__ */ h("style", { dangerouslySetInnerHTML: { __html: Q } }),
248
- /* @__PURE__ */ h("div", { className: `${n}-wrapper`, style: { width: b(M) } })
249
- ] }) : /* @__PURE__ */ ce(ie, { children: [
250
- /* @__PURE__ */ h("style", { dangerouslySetInnerHTML: { __html: Q } }),
251
- /* @__PURE__ */ h(
252
- "div",
253
- {
254
- ref: a,
255
- className: `${n}-wrapper`,
256
- style: {
257
- width: b(M),
258
- height: b(Me)
259
- },
260
- children: Array.from({ length: te }, (i, s) => {
261
- const I = s - w, m = A[be(I, A.length)].image, R = k(I, f), G = B[s], $ = rt(I, f, P, W), C = E === 0 ? 0 : (ue(R + 7.3) - 0.5) * E * W, c = p ? 1 : 1 + (ue(R + 3.1) - 0.5) * 2 * fe * (0.35 + E), l = _ * c, O = {
262
- "--helix-base-w": b(l),
263
- ...p ? { "--helix-base-h": b(ve) } : {}
264
- }, d = {
265
- top: b($ + C),
266
- ...O,
267
- ...se(z, H(G + Ie))
268
- }, u = J > 0 ? { borderRadius: b(J) } : {}, T = p ? {
269
- ...u,
270
- width: "100%",
271
- height: "100%",
272
- objectFit: "cover",
273
- objectPosition: "center"
274
- } : u, L = Ve(m) ? /* @__PURE__ */ h(
275
- Re,
276
- {
277
- className: `${n}-media`,
278
- style: T,
279
- src: m.assetId,
280
- muted: !0,
281
- loop: !0,
282
- autoPlay: !0,
283
- playsInline: !0
284
- }
285
- ) : /* @__PURE__ */ h(
286
- "img",
287
- {
288
- className: `${n}-media`,
289
- style: T,
290
- src: m.assetId,
291
- alt: m.name ?? "",
292
- loading: "lazy",
293
- decoding: "async"
294
- }
295
- );
296
- return /* @__PURE__ */ h(
297
- "div",
298
- {
299
- ref: (Oe) => {
300
- ee.current[s] = Oe;
301
- },
302
- className: p ? `${n}-item ${n}-item-cover` : `${n}-item`,
303
- style: d,
304
- children: p ? /* @__PURE__ */ h("div", { className: `${n}-cover`, style: u, children: L }) : L
305
- },
306
- `${U}-${f}-${I}`
307
- );
308
- })
309
- }
310
- )
311
- ] });
312
- }
313
- export {
314
- dt as Helix
315
- };
@@ -1,321 +0,0 @@
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-BbgdvELi.js"),on=require("./LazyVideo-Cn_vmMq8.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;