@cntrl-site/components 1.0.97-0 → 1.0.97-3

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 (35) hide show
  1. package/dist/Components/ClickGallerie/ClickGallerie.d.ts +1 -1
  2. package/dist/Components/ControlSlider/ControlSlider.d.ts +1 -1
  3. package/dist/Components/Helix/Helix.d.ts +5 -2
  4. package/dist/Components/Hive/Hive.d.ts +5 -2
  5. package/dist/Components/Hive/HiveComponent.d.ts +3 -1
  6. package/dist/Components/ImageRevealSlider/ImageRevealSlider.d.ts +1 -1
  7. package/dist/Components/Lightbox/Lightbox.d.ts +2 -2
  8. package/dist/Components/LightboxJournal/LightboxJournal.d.ts +1 -1
  9. package/dist/Components/LightboxJournal/LightboxJournalComponent.d.ts +5 -2
  10. package/dist/Components/LightboxJournal/utils.d.ts +1 -1
  11. package/dist/Components/LightboxStrip/LightboxStrip.d.ts +1 -1
  12. package/dist/Components/LightboxStrip/LightboxStripComponent.d.ts +5 -2
  13. package/dist/Components/List/List.d.ts +5 -2
  14. package/dist/Components/Marquee/Marquee.d.ts +5 -2
  15. package/dist/Components/MarqueeText/MarqueeText.d.ts +1 -1
  16. package/dist/Components/Mercury/Mercury.d.ts +5 -2
  17. package/dist/Components/Scale/Scale.d.ts +1 -1
  18. package/dist/Components/Slider20/Slider20.d.ts +1 -1
  19. package/dist/Components/TestimonialGrid/TestimonialGrid.d.ts +1 -1
  20. package/dist/Components/TestimonialSingle/TestimonialSingle.d.ts +1 -1
  21. package/dist/Components/Waterfall/WaterfallComponent.d.ts +3 -1
  22. package/dist/Components/Waterfall/WaterfallLightbox.d.ts +5 -2
  23. package/dist/Components/helpers/SvgImage/loadSvgMaskUrl.d.ts +2 -0
  24. package/dist/Components/utils/EmbedMediaFrame.d.ts +18 -0
  25. package/dist/Components/utils/embedMedia.d.ts +21 -0
  26. package/dist/Components/utils/index.d.ts +4 -0
  27. package/dist/EmbedMediaFrame-BqqoaiHc.mjs +236 -0
  28. package/dist/EmbedMediaFrame-C5O6lDaq.js +1 -0
  29. package/dist/index.js +591 -322
  30. package/dist/index.mjs +10890 -10385
  31. package/dist/utils.js +1 -1
  32. package/dist/utils.mjs +18 -13
  33. package/package.json +1 -1
  34. package/dist/LinkWrapper-CM1Wd42k.js +0 -1
  35. package/dist/LinkWrapper-D4d13mZT.mjs +0 -137
@@ -2,7 +2,7 @@ import { CommonComponentProps } from '../props';
2
2
  import { ContentLink } from '../utils/index';
3
3
  type ClickGallerieItem = {
4
4
  image: {
5
- url: string;
5
+ assetId: string;
6
6
  name: string;
7
7
  };
8
8
  link?: ContentLink;
@@ -9,7 +9,7 @@ type SliderProps = {
9
9
  export declare function ControlSlider({ settings, content, styles: sliderStyles, isEditor }: SliderProps): import("react/jsx-runtime").JSX.Element;
10
10
  type SliderItem = {
11
11
  image: {
12
- url: string;
12
+ assetId: string;
13
13
  name?: string;
14
14
  objectFit?: 'cover' | 'contain';
15
15
  };
@@ -1,8 +1,11 @@
1
1
  import { CommonComponentProps } from '../props';
2
2
  type HelixMedia = {
3
- url?: string;
3
+ assetId?: string;
4
4
  name?: string;
5
- type?: 'image' | 'video';
5
+ type?: 'image' | 'video' | 'vimeo' | 'youtube';
6
+ thumbnail?: string;
7
+ width?: number;
8
+ height?: number;
6
9
  };
7
10
  export type HelixContentItem = {
8
11
  image?: HelixMedia;
@@ -18,10 +18,13 @@ type HiveSettings = {
18
18
  };
19
19
  } & HiveLightboxTitleSettings;
20
20
  type HiveMedia = {
21
- url: string;
21
+ assetId: string;
22
22
  name?: string;
23
23
  objectFit?: 'cover' | 'contain';
24
- type?: 'image' | 'video';
24
+ type?: 'image' | 'video' | 'vimeo' | 'youtube';
25
+ thumbnail?: string;
26
+ width?: number;
27
+ height?: number;
25
28
  };
26
29
  type HiveMediaPair = {
27
30
  media: HiveMedia[];
@@ -22,7 +22,9 @@ export declare const HiveComponent: {
22
22
  path: string;
23
23
  placeholderEnabled: boolean;
24
24
  }[];
25
- parameters: never[];
25
+ parameters: {
26
+ path: string;
27
+ }[];
26
28
  };
27
29
  fontSettingsPaths: {
28
30
  content: never[];
@@ -32,7 +32,7 @@ type ImageRevealSliderSettings = {
32
32
  };
33
33
  type ImageRevealSliderItem = {
34
34
  image: {
35
- url: string;
35
+ assetId: string;
36
36
  name: string;
37
37
  };
38
38
  link?: ContentLink;
@@ -12,7 +12,7 @@ type LightboxGalleryProps = {
12
12
  export declare const LightboxGallery: ({ settings, content, styles, portalId, activeEvent, isEditor, isPreviewMode }: LightboxGalleryProps) => import("react/jsx-runtime").JSX.Element;
13
13
  type LightboxImage = {
14
14
  image: {
15
- url: string;
15
+ assetId: string;
16
16
  name?: string;
17
17
  objectFit?: 'cover' | 'contain';
18
18
  };
@@ -47,7 +47,7 @@ type Triggers = {
47
47
  type LightboxSettings = {
48
48
  thumbnailBlock: {
49
49
  cover: {
50
- url: string;
50
+ assetId: string;
51
51
  };
52
52
  };
53
53
  lightboxBlock: {
@@ -2,7 +2,7 @@ import { CommonComponentProps } from '../props';
2
2
  import { TextStyles } from '../utils/textStylesToCss';
3
3
  import { ImageRatioFit } from '../utils/imageFitStyles';
4
4
  export type LightboxJournalImage = {
5
- url: string;
5
+ assetId: string;
6
6
  name?: string;
7
7
  objectFit?: 'cover' | 'contain';
8
8
  };
@@ -34,10 +34,13 @@ export declare const LightboxJournalComponent: {
34
34
  path: string;
35
35
  placeholderEnabled: boolean;
36
36
  }[];
37
- parameters: {
37
+ parameters: ({
38
38
  path: string;
39
39
  placeholderEnabled: boolean;
40
- }[];
40
+ } | {
41
+ path: string;
42
+ placeholderEnabled?: undefined;
43
+ })[];
41
44
  };
42
45
  fontSettingsPaths: {
43
46
  content: never[];
@@ -2,7 +2,7 @@ import { CSSProperties } from 'react';
2
2
  import { TextStyles } from '../utils/textStylesToCss';
3
3
  import { LayoutItem, LayoutTab } from '../../types/SchemaV1';
4
4
  type JournalImage = {
5
- url: string;
5
+ assetId: string;
6
6
  name?: string;
7
7
  objectFit?: 'cover' | 'contain';
8
8
  };
@@ -5,7 +5,7 @@ export { createStripTextStylePanelTab, createStripTextStyleTabContentItems, extr
5
5
  export type { StripGlobalTextStyleKey, StripTextStylePrefix, StripTitleWidthKey, } from './utils';
6
6
  export type LightboxStripItem = {
7
7
  image: {
8
- url: string;
8
+ assetId: string;
9
9
  name?: string;
10
10
  objectFit?: 'cover' | 'contain';
11
11
  };
@@ -34,10 +34,13 @@ export declare const LightboxStripComponent: {
34
34
  path: string;
35
35
  placeholderEnabled: boolean;
36
36
  }[];
37
- parameters: {
37
+ parameters: ({
38
38
  path: string;
39
39
  placeholderEnabled: boolean;
40
- }[];
40
+ } | {
41
+ path: string;
42
+ placeholderEnabled?: undefined;
43
+ })[];
41
44
  };
42
45
  fontSettingsPaths: {
43
46
  content: never[];
@@ -119,9 +119,12 @@ export type ListSettings = {
119
119
  } & ListColumnTextStyleOverrides;
120
120
  type ListMedia = {
121
121
  objectFit?: 'cover' | 'contain';
122
- url: string;
122
+ assetId: string;
123
123
  name: string;
124
- type?: 'image' | 'video';
124
+ type?: 'image' | 'video' | 'vimeo' | 'youtube';
125
+ thumbnail?: string;
126
+ width?: number;
127
+ height?: number;
125
128
  };
126
129
  type ListContentItem = {
127
130
  AColumn?: string;
@@ -3,9 +3,12 @@ import { ContentLink } from '../utils/index';
3
3
  export declare const Marquee: ({ settings, content, isEditor, isPreviewMode, isEditMode }: MarqueeProps) => import("react/jsx-runtime").JSX.Element;
4
4
  export type MarqueeItem = {
5
5
  image?: {
6
- url?: string;
6
+ assetId?: string;
7
7
  name?: string;
8
- type?: 'image' | 'video';
8
+ type?: 'image' | 'video' | 'vimeo' | 'youtube';
9
+ thumbnail?: string;
10
+ width?: number;
11
+ height?: number;
9
12
  };
10
13
  link?: ContentLink;
11
14
  };
@@ -4,7 +4,7 @@ export declare const MarqueeText: ({ settings, content, isEditor, isPreviewMode
4
4
  export type MarqueeTextItem = {
5
5
  text: string;
6
6
  image?: {
7
- url?: string;
7
+ assetId?: string;
8
8
  name?: string;
9
9
  };
10
10
  link?: ContentLink;
@@ -1,10 +1,13 @@
1
1
  import { CommonComponentProps } from '../props';
2
2
  import { TextStyles } from '../utils/textStylesToCss';
3
3
  type MercuryMedia = {
4
- url: string;
4
+ assetId: string;
5
5
  name?: string;
6
- type?: 'image' | 'video';
6
+ type?: 'image' | 'video' | 'vimeo' | 'youtube';
7
7
  objectFit?: 'cover' | 'contain';
8
+ thumbnail?: string;
9
+ width?: number;
10
+ height?: number;
8
11
  };
9
12
  type MercuryMediaPair = {
10
13
  media: MercuryMedia[];
@@ -1,7 +1,7 @@
1
1
  import { CommonComponentProps } from '../props';
2
2
  type ScaleContentItem = {
3
3
  image?: {
4
- url?: string;
4
+ assetId?: string;
5
5
  name?: string;
6
6
  };
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import { CommonComponentProps } from '../props';
2
2
  type Slider20Item = {
3
3
  image: {
4
- url: string;
4
+ assetId: string;
5
5
  name?: string;
6
6
  objectFit?: 'cover' | 'contain';
7
7
  };
@@ -9,7 +9,7 @@ type TestimonialsProps = {
9
9
  export declare const TestimonialGrid: ({ settings, content, isEditor, isPreviewMode, isEditMode }: TestimonialsProps) => import("react/jsx-runtime").JSX.Element;
10
10
  export type TestimonialsItem = {
11
11
  logo?: {
12
- url?: string;
12
+ assetId?: string;
13
13
  name?: string;
14
14
  objectFit?: 'cover' | 'contain';
15
15
  };
@@ -9,7 +9,7 @@ type TestimonialsProps = {
9
9
  export declare const TestimonialSingle: ({ settings, content, isEditor, isPreviewMode, isEditMode }: TestimonialsProps) => import("react/jsx-runtime").JSX.Element;
10
10
  export type TestimonialsItem = {
11
11
  image?: {
12
- url?: string;
12
+ assetId?: string;
13
13
  name?: string;
14
14
  objectFit?: 'cover' | 'contain';
15
15
  };
@@ -22,7 +22,9 @@ export declare const WaterfallComponent: {
22
22
  path: string;
23
23
  placeholderEnabled: boolean;
24
24
  }[];
25
- parameters: never[];
25
+ parameters: {
26
+ path: string;
27
+ }[];
26
28
  };
27
29
  fontSettingsPaths: {
28
30
  content: never[];
@@ -1,9 +1,12 @@
1
1
  import { HiveLightboxTextEntry, HiveLightboxTitleSettings } from '../Hive/HiveLightboxTitles';
2
2
  export type WaterfallMedia = {
3
- url: string;
3
+ assetId: string;
4
4
  name?: string;
5
5
  objectFit?: 'cover' | 'contain';
6
- type?: 'image' | 'video';
6
+ type?: 'image' | 'video' | 'vimeo' | 'youtube';
7
+ thumbnail?: string;
8
+ width?: number;
9
+ height?: number;
7
10
  };
8
11
  export type WaterfallLightboxContentItem = {
9
12
  title?: string;
@@ -0,0 +1,2 @@
1
+ export declare function isInlineMaskUrl(url: string): boolean;
2
+ export declare function loadSvgMaskUrl(url: string): Promise<string>;
@@ -0,0 +1,18 @@
1
+ import { FC, HTMLAttributes } from 'react';
2
+ import { EmbedMediaLike, EmbedPlayerMode } from './embedMedia';
3
+ export interface EmbedMediaFrameProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
4
+ media: EmbedMediaLike;
5
+ mode: EmbedPlayerMode;
6
+ /** How the video fills the box, the way an image's object-fit would. */
7
+ fit: 'cover' | 'contain';
8
+ /** Whether the player takes the pointer; a background one leaves it to the box around it. */
9
+ interactive?: boolean;
10
+ /** Framed only while near the viewport, so a track of copies holds one player per visible card. */
11
+ lazy?: boolean;
12
+ }
13
+ /**
14
+ * A Vimeo or YouTube video in the room of an image or a video: a box the caller sizes and places,
15
+ * showing the stored thumbnail until the player is framed over it. A box with no height of its own
16
+ * takes the video's aspect.
17
+ */
18
+ export declare const EmbedMediaFrame: FC<EmbedMediaFrameProps>;
@@ -0,0 +1,21 @@
1
+ export type EmbedProvider = 'vimeo' | 'youtube';
2
+ /** What a media value holds of a Vimeo or YouTube video: its player url, and the picture and size the player has none of. */
3
+ export type EmbedMediaLike = {
4
+ assetId?: string;
5
+ type?: string;
6
+ name?: string;
7
+ thumbnail?: string;
8
+ width?: number;
9
+ height?: number;
10
+ };
11
+ export type EmbedPlayerMode = 'background' | 'player';
12
+ /** The provider whose player a media is framed from, none for a file or a value that only claims to be one. */
13
+ export declare function getEmbedProvider(media: EmbedMediaLike | null | undefined): EmbedProvider | null;
14
+ export declare function isEmbedMedia(media: EmbedMediaLike | null | undefined): boolean;
15
+ /** Width over height of the video, 16:9 when the media does not say. */
16
+ export declare function getEmbedAspect(media: EmbedMediaLike): number;
17
+ /**
18
+ * The player url with the way it plays: `background` runs it the way a muted looping video does,
19
+ * `player` starts it with the provider's own controls.
20
+ */
21
+ export declare function getEmbedPlayerSrc(media: EmbedMediaLike, mode: EmbedPlayerMode): string;
@@ -11,3 +11,7 @@ export { getAvailableStatePanels, getUnavailableStates, isPanelAvailable, } from
11
11
  export type { PanelAvailabilityContext } from './panelAvailability';
12
12
  export { LinkWrapper } from './LinkWrapper';
13
13
  export type { ContentLink } from '../../types/SchemaV1';
14
+ export { getEmbedAspect, getEmbedPlayerSrc, getEmbedProvider, isEmbedMedia } from './embedMedia';
15
+ export type { EmbedMediaLike, EmbedPlayerMode, EmbedProvider } from './embedMedia';
16
+ export { EmbedMediaFrame } from './EmbedMediaFrame';
17
+ export type { EmbedMediaFrameProps } from './EmbedMediaFrame';
@@ -0,0 +1,236 @@
1
+ import { useId as P, useRef as R, useState as x, useEffect as E } from "react";
2
+ import { jsx as g, Fragment as j, jsxs as L } from "react/jsx-runtime";
3
+ function Y(t, e = !1) {
4
+ return e ? `calc(var(--cntrl-article-width) * ${t})` : `${t * 100}vw`;
5
+ }
6
+ const z = (t, e, r, s, n) => {
7
+ const o = {};
8
+ for (const [a, l] of Object.entries(r))
9
+ o[`--${t}-${l}`] = e[a];
10
+ const i = new Set(s);
11
+ if (n)
12
+ for (const a of Object.keys(n))
13
+ i.add(a);
14
+ for (const a of i) {
15
+ const l = n == null ? void 0 : n[a];
16
+ if (l)
17
+ for (const [b, m] of Object.entries(r)) {
18
+ const c = l[b];
19
+ c !== void 0 && (o[`--${t}-${a}-${m}`] = c);
20
+ }
21
+ }
22
+ return o;
23
+ };
24
+ function M(t) {
25
+ const e = t.trim();
26
+ if (!e || e === "none") return 1;
27
+ if (e.endsWith("%")) {
28
+ const s = parseFloat(e);
29
+ return Number.isFinite(s) ? s / 100 : 1;
30
+ }
31
+ const r = parseFloat(e);
32
+ return Number.isFinite(r) ? r : 1;
33
+ }
34
+ function k(t) {
35
+ const e = t.lastIndexOf("/");
36
+ if (e !== -1)
37
+ return M(t.slice(e + 1));
38
+ }
39
+ function G(t) {
40
+ const e = t.trim().toLowerCase();
41
+ if (!e || e === "transparent") return 0;
42
+ const r = e.match(/^(?:oklch|oklab|rgba?|hsla?|hwb|lab|lch|color)\((.+)\)$/);
43
+ if (r) {
44
+ const n = r[1], o = k(n);
45
+ if (o !== void 0) return o;
46
+ if (/^(?:rgba|hsla)$/.test(e.slice(0, 4))) {
47
+ const i = n.split(",").map((a) => parseFloat(a.trim()));
48
+ if (i.length === 4 && Number.isFinite(i[3]))
49
+ return i[3];
50
+ }
51
+ return 1;
52
+ }
53
+ const s = e.match(/^#([0-9a-f]{4}|[0-9a-f]{8})$/);
54
+ if (s) {
55
+ const n = s[1], o = n.length === 4 ? n[3] + n[3] : n.slice(6, 8);
56
+ return parseInt(o, 16) / 255;
57
+ }
58
+ return 1;
59
+ }
60
+ const C = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, W = (t) => C.test(t.trim()), _ = (t) => {
61
+ const e = t.replace(/\D/g, "");
62
+ return e.length >= 7 && e.length <= 15;
63
+ }, J = (t, e) => {
64
+ var r;
65
+ for (const s of t) {
66
+ const n = ((r = e[s.name]) == null ? void 0 : r.trim()) ?? "";
67
+ if (n) {
68
+ if (s.type === "email" && !W(n))
69
+ return "Please enter a valid email address.";
70
+ if (s.type === "phone" && !_(n))
71
+ return "Please enter a valid phone number.";
72
+ }
73
+ }
74
+ return null;
75
+ };
76
+ function K() {
77
+ const e = `cf-${P().replace(/:/g, "")}`;
78
+ return {
79
+ prefix: e,
80
+ cls: (r) => `${e}-${r}`
81
+ };
82
+ }
83
+ const Q = (t, e) => {
84
+ const r = Array.from(t.querySelectorAll('[data-testimonial-measure="text"]')).reduce(
85
+ (n, o) => Math.max(n, o.getBoundingClientRect().height),
86
+ 0
87
+ ), s = Array.from(t.querySelectorAll('[data-testimonial-measure="caption"]')).reduce(
88
+ (n, o) => Math.max(n, o.getBoundingClientRect().height),
89
+ 0
90
+ );
91
+ e({ maxTextPx: r, maxCaptionPx: s });
92
+ };
93
+ function B(t, e) {
94
+ const r = t == null ? void 0 : t.availableWhen;
95
+ return r ? Object.entries(r).every(([s, n]) => {
96
+ if (!(n != null && n.length)) return !0;
97
+ const o = e[s];
98
+ return o === void 0 ? !0 : n.includes(o);
99
+ }) : !0;
100
+ }
101
+ function N(t, e) {
102
+ const r = t == null ? void 0 : t.statePanels;
103
+ return r != null && r.length ? r.filter((s) => {
104
+ var o;
105
+ const n = (o = t == null ? void 0 : t.panels) == null ? void 0 : o.find((i) => i.id === s);
106
+ return B(n, e);
107
+ }) : null;
108
+ }
109
+ function Z(t, e) {
110
+ const r = t == null ? void 0 : t.statePanels;
111
+ if (!(r != null && r.length)) return [];
112
+ const s = new Set(N(t, e) ?? []);
113
+ return r.filter((n) => !s.has(n));
114
+ }
115
+ const T = ["http://", "https://", "/", "mailto:", "tel:", "file:", "ftp:", "javascript", "#"];
116
+ function U(t) {
117
+ return T.some((e) => t.startsWith(e)) ? t : `//${t}`;
118
+ }
119
+ const tt = ({ link: t, className: e, style: r, children: s }) => {
120
+ if (!(t != null && t.value)) return /* @__PURE__ */ g(j, { children: s });
121
+ const n = t.target === "blank" || t.target === "_blank" ? { target: "_blank", rel: "noreferrer" } : {};
122
+ return /* @__PURE__ */ g("a", { href: U(t.value), className: e, style: r, ...n, children: s });
123
+ }, V = {
124
+ vimeo: /^player\.vimeo\.com$/i,
125
+ youtube: /^(?:www\.)?youtube(?:-nocookie)?\.com$/i
126
+ };
127
+ function $(t) {
128
+ if (!(t != null && t.assetId) || t.type !== "vimeo" && t.type !== "youtube") return null;
129
+ try {
130
+ const e = new URL(t.assetId);
131
+ return !V[t.type].test(e.hostname) || t.type === "youtube" && !e.pathname.startsWith("/embed/") ? null : t.type;
132
+ } catch {
133
+ return null;
134
+ }
135
+ }
136
+ function et(t) {
137
+ return $(t) !== null;
138
+ }
139
+ function O(t) {
140
+ const { width: e, height: r } = t;
141
+ return e && r && e > 0 && r > 0 ? e / r : 16 / 9;
142
+ }
143
+ function q(t, e) {
144
+ const r = $(t);
145
+ if (!r || !t.assetId) return t.assetId ?? "";
146
+ const s = new URL(t.assetId), n = s.searchParams;
147
+ return r === "vimeo" ? (n.set("autoplay", "1"), e === "background" && (n.set("background", "1"), n.set("muted", "1"), n.set("loop", "1"))) : (n.set("autoplay", "1"), n.set("playsinline", "1"), n.set("rel", "0"), e === "background" && (n.set("mute", "1"), n.set("loop", "1"), n.set("playlist", s.pathname.slice(7)), n.set("controls", "0"), n.set("modestbranding", "1"))), s.toString();
148
+ }
149
+ function H(t, e, r) {
150
+ const s = t.width / t.height, n = r === "cover" ? e <= s : e >= s, o = n ? t.width : t.height * e, i = n ? t.width / e : t.height;
151
+ return { width: o, height: i, left: (t.width - o) / 2, top: (t.height - i) / 2 };
152
+ }
153
+ const nt = ({
154
+ media: t,
155
+ mode: e,
156
+ fit: r,
157
+ interactive: s = e === "player",
158
+ lazy: n = !0,
159
+ style: o,
160
+ ...i
161
+ }) => {
162
+ const a = R(null), [l, b] = x(null), [m, c] = x(!n), y = O(t);
163
+ E(() => {
164
+ const u = a.current;
165
+ if (!u || typeof ResizeObserver > "u") return;
166
+ const h = () => {
167
+ const { width: w, height: S } = u.getBoundingClientRect();
168
+ b((p) => p && p.width === w && p.height === S ? p : { width: w, height: S });
169
+ };
170
+ h();
171
+ const d = new ResizeObserver(h);
172
+ return d.observe(u), () => d.disconnect();
173
+ }, []), E(() => {
174
+ const u = a.current;
175
+ if (!n || !u || typeof IntersectionObserver > "u") {
176
+ c(!0);
177
+ return;
178
+ }
179
+ const h = new IntersectionObserver(([d]) => c(d.isIntersecting), { rootMargin: "200px" });
180
+ return h.observe(u), () => h.disconnect();
181
+ }, [n]);
182
+ const f = l && l.width > 0 && l.height > 0 ? H(l, y, r) : null, { width: v, ...I } = o ?? {}, F = {
183
+ position: "relative",
184
+ overflow: "hidden",
185
+ aspectRatio: `${y}`,
186
+ width: v === void 0 || v === "auto" ? "100%" : v,
187
+ ...I
188
+ }, A = {
189
+ position: "absolute",
190
+ inset: 0,
191
+ width: "100%",
192
+ height: "100%",
193
+ objectFit: r,
194
+ pointerEvents: "none"
195
+ };
196
+ return /* @__PURE__ */ L("div", { ref: a, "data-embed-frame": "", style: F, ...i, children: [
197
+ t.thumbnail && /* @__PURE__ */ g("img", { src: t.thumbnail, alt: t.name ?? "", draggable: !1, style: A }),
198
+ m && f && /* @__PURE__ */ g(
199
+ "iframe",
200
+ {
201
+ src: q(t, e),
202
+ title: t.name || "Embedded video",
203
+ allow: "autoplay; fullscreen; picture-in-picture",
204
+ allowFullScreen: !0,
205
+ style: {
206
+ position: "absolute",
207
+ left: f.left,
208
+ top: f.top,
209
+ width: f.width,
210
+ height: f.height,
211
+ border: 0,
212
+ pointerEvents: s ? "auto" : "none"
213
+ }
214
+ }
215
+ )
216
+ ] });
217
+ };
218
+ export {
219
+ nt as E,
220
+ tt as L,
221
+ J as a,
222
+ z as b,
223
+ _ as c,
224
+ N as d,
225
+ Z as e,
226
+ B as f,
227
+ G as g,
228
+ O as h,
229
+ W as i,
230
+ q as j,
231
+ $ as k,
232
+ et as l,
233
+ Q as r,
234
+ Y as s,
235
+ K as u
236
+ };
@@ -0,0 +1 @@
1
+ "use strict";const c=require("react"),f=require("react/jsx-runtime");function C(t,e=!1){return e?`calc(var(--cntrl-article-width) * ${t})`:`${t*100}vw`}const L=(t,e,r,s,n)=>{const i={};for(const[a,l]of Object.entries(r))i[`--${t}-${l}`]=e[a];const o=new Set(s);if(n)for(const a of Object.keys(n))o.add(a);for(const a of o){const l=n==null?void 0:n[a];if(l)for(const[m,v]of Object.entries(r)){const h=l[m];h!==void 0&&(i[`--${t}-${a}-${v}`]=h)}}return i};function k(t){const e=t.trim();if(!e||e==="none")return 1;if(e.endsWith("%")){const s=parseFloat(e);return Number.isFinite(s)?s/100:1}const r=parseFloat(e);return Number.isFinite(r)?r:1}function T(t){const e=t.lastIndexOf("/");if(e!==-1)return k(t.slice(e+1))}function W(t){const e=t.trim().toLowerCase();if(!e||e==="transparent")return 0;const r=e.match(/^(?:oklch|oklab|rgba?|hsla?|hwb|lab|lch|color)\((.+)\)$/);if(r){const n=r[1],i=T(n);if(i!==void 0)return i;if(/^(?:rgba|hsla)$/.test(e.slice(0,4))){const o=n.split(",").map(a=>parseFloat(a.trim()));if(o.length===4&&Number.isFinite(o[3]))return o[3]}return 1}const s=e.match(/^#([0-9a-f]{4}|[0-9a-f]{8})$/);if(s){const n=s[1],i=n.length===4?n[3]+n[3]:n.slice(6,8);return parseInt(i,16)/255}return 1}const U=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,F=t=>U.test(t.trim()),P=t=>{const e=t.replace(/\D/g,"");return e.length>=7&&e.length<=15},_=(t,e)=>{var r;for(const s of t){const n=((r=e[s.name])==null?void 0:r.trim())??"";if(n){if(s.type==="email"&&!F(n))return"Please enter a valid email address.";if(s.type==="phone"&&!P(n))return"Please enter a valid phone number."}}return null};function B(){const e=`cf-${c.useId().replace(/:/g,"")}`;return{prefix:e,cls:r=>`${e}-${r}`}}const N=(t,e)=>{const r=Array.from(t.querySelectorAll('[data-testimonial-measure="text"]')).reduce((n,i)=>Math.max(n,i.getBoundingClientRect().height),0),s=Array.from(t.querySelectorAll('[data-testimonial-measure="caption"]')).reduce((n,i)=>Math.max(n,i.getBoundingClientRect().height),0);e({maxTextPx:r,maxCaptionPx:s})};function A(t,e){const r=t==null?void 0:t.availableWhen;return r?Object.entries(r).every(([s,n])=>{if(!(n!=null&&n.length))return!0;const i=e[s];return i===void 0?!0:n.includes(i)}):!0}function $(t,e){const r=t==null?void 0:t.statePanels;return r!=null&&r.length?r.filter(s=>{var i;const n=(i=t==null?void 0:t.panels)==null?void 0:i.find(o=>o.id===s);return A(n,e)}):null}function q(t,e){const r=t==null?void 0:t.statePanels;if(!(r!=null&&r.length))return[];const s=new Set($(t,e)??[]);return r.filter(n=>!s.has(n))}const O=["http://","https://","/","mailto:","tel:","file:","ftp:","javascript","#"];function H(t){return O.some(e=>t.startsWith(e))?t:`//${t}`}const D=({link:t,className:e,style:r,children:s})=>{if(!(t!=null&&t.value))return f.jsx(f.Fragment,{children:s});const n=t.target==="blank"||t.target==="_blank"?{target:"_blank",rel:"noreferrer"}:{};return f.jsx("a",{href:H(t.value),className:e,style:r,...n,children:s})},X={vimeo:/^player\.vimeo\.com$/i,youtube:/^(?:www\.)?youtube(?:-nocookie)?\.com$/i};function w(t){if(!(t!=null&&t.assetId)||t.type!=="vimeo"&&t.type!=="youtube")return null;try{const e=new URL(t.assetId);return!X[t.type].test(e.hostname)||t.type==="youtube"&&!e.pathname.startsWith("/embed/")?null:t.type}catch{return null}}function Y(t){return w(t)!==null}function I(t){const{width:e,height:r}=t;return e&&r&&e>0&&r>0?e/r:16/9}function R(t,e){const r=w(t);if(!r||!t.assetId)return t.assetId??"";const s=new URL(t.assetId),n=s.searchParams;return r==="vimeo"?(n.set("autoplay","1"),e==="background"&&(n.set("background","1"),n.set("muted","1"),n.set("loop","1"))):(n.set("autoplay","1"),n.set("playsinline","1"),n.set("rel","0"),e==="background"&&(n.set("mute","1"),n.set("loop","1"),n.set("playlist",s.pathname.slice(7)),n.set("controls","0"),n.set("modestbranding","1"))),s.toString()}function z(t,e,r){const s=t.width/t.height,n=r==="cover"?e<=s:e>=s,i=n?t.width:t.height*e,o=n?t.width/e:t.height;return{width:i,height:o,left:(t.width-i)/2,top:(t.height-o)/2}}const G=({media:t,mode:e,fit:r,interactive:s=e==="player",lazy:n=!0,style:i,...o})=>{const a=c.useRef(null),[l,m]=c.useState(null),[v,h]=c.useState(!n),S=I(t);c.useEffect(()=>{const u=a.current;if(!u||typeof ResizeObserver>"u")return;const g=()=>{const{width:E,height:x}=u.getBoundingClientRect();m(b=>b&&b.width===E&&b.height===x?b:{width:E,height:x})};g();const p=new ResizeObserver(g);return p.observe(u),()=>p.disconnect()},[]),c.useEffect(()=>{const u=a.current;if(!n||!u||typeof IntersectionObserver>"u"){h(!0);return}const g=new IntersectionObserver(([p])=>h(p.isIntersecting),{rootMargin:"200px"});return g.observe(u),()=>g.disconnect()},[n]);const d=l&&l.width>0&&l.height>0?z(l,S,r):null,{width:y,...j}=i??{},M={position:"relative",overflow:"hidden",aspectRatio:`${S}`,width:y===void 0||y==="auto"?"100%":y,...j},V={position:"absolute",inset:0,width:"100%",height:"100%",objectFit:r,pointerEvents:"none"};return f.jsxs("div",{ref:a,"data-embed-frame":"",style:M,...o,children:[t.thumbnail&&f.jsx("img",{src:t.thumbnail,alt:t.name??"",draggable:!1,style:V}),v&&d&&f.jsx("iframe",{src:R(t,e),title:t.name||"Embedded video",allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,style:{position:"absolute",left:d.left,top:d.top,width:d.width,height:d.height,border:0,pointerEvents:s?"auto":"none"}})]})};exports.EmbedMediaFrame=G;exports.LinkWrapper=D;exports.buildColorVars=L;exports.getAvailableStatePanels=$;exports.getColorAlpha=W;exports.getEmbedAspect=I;exports.getEmbedPlayerSrc=R;exports.getEmbedProvider=w;exports.getFormFieldValidationError=_;exports.getUnavailableStates=q;exports.isEmbedMedia=Y;exports.isPanelAvailable=A;exports.isValidEmailFormat=F;exports.isValidPhoneFormat=P;exports.readTestimonialTextMeasure=N;exports.scalingValue=C;exports.useScopedStyles=B;