@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
@@ -0,0 +1,133 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),a=require("react"),te=require("classnames"),Ee=require("./scalingValue-CSHYgTZl.js"),Ce=require("./useScopedStyles-Bf6yohVQ.js"),J=require("./useLazyVideos-CdCbc2j0.js"),Se=require("./LinkWrapper-Ca84iPtg.js"),ne=require("./EmbedMediaFrame-DsOTKE4i.js"),de=require("./observeIntersection-DxGj9Ctt.js");function ke(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 Ae=30,Ne=20,fe=3,Me=12,_e=32,We=3,Ie=250,je=.5,Ve=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")},Te=(e,n)=>Array.from({length:n},()=>e).flat(),Le=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},we=e=>e.reduce((n,r)=>n+(r.offsetWidth||r.getBoundingClientRect().width),0),be=(e,n)=>{if(n<=0||e.children.length<n)return 0;const r=e.children[0],u=e.children[n-1];if(!r||!u)return 0;const h=getComputedStyle(e),f=Number.parseFloat(h.columnGap||h.gap||"0")||0,w=u.getBoundingClientRect().right-r.getBoundingClientRect().left;if(w>0)return w;const C=Array.from({length:n},(R,_)=>e.children[_]),m=we(C);return m<=0?0:m+f*Math.max(0,n-1)},Oe=e=>{const n=e.getBoundingClientRect().width;if(n>0)return n;const r=e.offsetWidth;if(r>0)return r;const u=we(Array.from(e.children));if(u<=0)return 0;const h=getComputedStyle(e),f=Number.parseFloat(h.columnGap||h.gap||"0")||0,w=Number.parseFloat(h.paddingRight)||0;return u+f*Math.max(0,e.children.length-1)+w},Be=(e,n)=>{const r=n.getBoundingClientRect(),u=e.getBoundingClientRect();return u.right>r.left&&u.left<r.right},He=(e,n)=>{const r=e.querySelectorAll(`[data-marquee-item-index="${n}"]`);return Array.from(r).some(u=>Be(u,e))},ze=e=>{if(ne.isEmbedMedia(e))return!1;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??"")},Fe=e=>e?e instanceof HTMLVideoElement?e.readyState>=1:e.complete:!1,Ue=({item:e,prefix:n,imageFit:r,imageMaxWidth:u,imageMaxHeight:h,cornerRadius:f,imageHoverClass:w,isFirstSet:C,scaled:m,onFirstSetImageDone:R})=>{var O,B,K,H,ee;const _=a.useRef(null),X=!!((O=e.image)!=null&&O.assetId&&ze(e.image)),V=!!((B=e.image)!=null&&B.assetId&&ne.isEmbedMedia(e.image));a.useLayoutEffect(()=>{C&&(V||Fe(_.current))&&(R==null||R())},[C,V,(K=e.image)==null?void 0:K.assetId,R]);const $=r.display==="cover",Z=r.ratioValue??"1:1",D=r.reversed??!1,[S,P]=Z.split(":").map(Number),A=(D?P:S)/(D?S:P),W=u/A,I=W>h?h:W,oe=W>h?h*A:u,k=m(oe),me=m(I),v={borderRadius:m(f)},N=$?{pointerEvents:"auto",display:"block",width:"100%",height:"100%",objectFit:"cover",...v}:{pointerEvents:"auto",display:"block",width:"auto",height:"auto",maxWidth:m(u),maxHeight:m(h),objectFit:"contain",...v},q=V&&e.image?ne.getEmbedAspect(e.image):null,j=q===null?void 0:$?N:{...N,width:m(u/q>h?h*q:u),height:m(u/q>h?h:u/q)},L=((H=e.image)==null?void 0:H.assetId)&&(V?y.jsx(ne.EmbedMediaFrame,{media:e.image,fit:$?"cover":"contain",style:j}):X?y.jsx("video",{ref:z=>{_.current=z},src:e.image.assetId,style:N,muted:!0,loop:!0,playsInline:!0,preload:"none",onLoadedMetadata:C?R:void 0,onError:C?R:void 0}):y.jsx("img",{ref:z=>{_.current=z},src:e.image.assetId,alt:((ee=e.image)==null?void 0:ee.name)??"",style:N,onLoad:C?R:void 0,onError:C?R:void 0}));return y.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"start",...$?{width:k}:{width:"max-content",maxWidth:m(u),minWidth:0}},children:y.jsx("div",{className:w,style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",flexShrink:0,...$?{width:k,height:me,overflow:"hidden",...v}:{width:"max-content",maxWidth:m(u),height:m(h)}},children:L&&y.jsx(Se.LinkWrapper,{link:e.link,className:te(`${n}-marquee-link`,!$&&`${n}-marquee-link-contain`),children:L})})})},Ge=({settings:e,content:n,isEditor:r,isPreviewMode:u,isEditMode:h})=>{const{prefix:f}=Ce.useScopedStyles(),[w,C]=a.useState(0),m=w>0?Math.round(w):0,R=a.useMemo(()=>ke(f,m),[f,m]),{speed:_,direction:X,pauseOnHover:V,gap:$,imageMaxWidth:Z,imageMaxHeight:D,hoverEffect:S,cornerRadius:P=0}=e,T=a.useMemo(()=>Le(e.imageFit),[e.imageFit]),re=T.display!=="cover",A=(n==null?void 0:n.length)??0,W=!!h,I=!r||!!u,oe=I&&S!=="off"&&S!=="randomize"?`${f}-image-hover-${S}`:void 0,k=r?!!u:!0,v=((n==null?void 0:n.length)??0)>0&&(k||!!r),N=Math.max(0,_)*Ae,q=t=>Ee.scalingValue(t,r??!1),j=a.useRef(null),L=a.useRef(null),O=a.useRef(null),[B,K]=a.useState(0),H=k&&V==="on",[ee,z]=a.useState(!1),[F,ae]=a.useState({}),ie=a.useRef(F);ie.current=F;const se=a.useRef(null),ce=a.useRef(0),Q=a.useRef(null),he=a.useMemo(()=>(n??[]).map(t=>{var o;return((o=t.image)==null?void 0:o.assetId)??""}).join("\0"),[n]),[U,pe]=a.useState(fe),le=a.useMemo(()=>{const t=n??[];return t.length===0||!(k||!!r)?t:Te(t,U)},[n,k,U,r]),ge=a.useMemo(()=>(n??[]).filter(t=>{var o;return!!((o=t.image)!=null&&o.assetId)}).length,[n]),ye=v?We:1;a.useLayoutEffect(()=>{ce.current=0,ae({}),se.current=null,pe(fe),C(0)},[he]),a.useEffect(()=>{if(!I||S!=="randomize")return;const t=j.current;if(!t)return;const o=c=>{ae(l=>{const b=Array.from(c).filter(g=>g in l&&!He(t,g));if(b.length===0)return l;const p={...l};return b.forEach(g=>{delete p[g]}),p})},i=new IntersectionObserver(c=>{const l=new Set;for(const b of c){const p=b.target.dataset.marqueeItemIndex,g=p!==void 0?Number(p):NaN;Number.isNaN(g)||l.add(g)}l.size>0&&o(l)},{root:t,threshold:0});Object.keys(F).forEach(c=>{const l=Number(c);t.querySelectorAll(`[data-marquee-item-index="${l}"]`).forEach(b=>i.observe(b))});const d={current:0},s=()=>{const c=Object.keys(ie.current);c.length!==0&&(o(c.map(Number)),d.current=requestAnimationFrame(s))};return Object.keys(ie.current).length>0&&(d.current=requestAnimationFrame(s)),()=>{cancelAnimationFrame(d.current),i.disconnect()}},[S,F,I]),a.useEffect(()=>{const t=j.current;if(!t||typeof IntersectionObserver>"u")return;let o=!1,i=!1,d;const s=()=>{const p=t.querySelectorAll("video");if(!o){p.forEach(J.pauseVideo);return}const g=t.getBoundingClientRect(),M=g.width*je;p.forEach(x=>{const Y=x.getBoundingClientRect(),G=Y.right>g.left&&Y.left<g.right;Y.right>g.left-M&&Y.left<g.right+M?J.raisePreload(x,"auto"):re&&J.raisePreload(x,"metadata"),i&&G?x.paused&&J.playVideo(x):J.pauseVideo(x)})},c=()=>{o&&d===void 0?d=setInterval(s,Ie):!o&&d!==void 0&&(clearInterval(d),d=void 0),s()},l=de.observeIntersection(t,de.NEAR_VIEWPORT_MARGIN,p=>{o=p,c()}),b=de.observeIntersection(t,"0px",p=>{i=p,c()});return()=>{l(),b(),clearInterval(d)}},[v,re]),a.useLayoutEffect(()=>{if(!v)return;const t=j.current,o=O.current;if(!t||!o)return;const i={current:0},d=()=>{const l=t.getBoundingClientRect().width||t.offsetWidth,b=Oe(o),p=se.current,g=typeof p=="number"&&Math.abs(p-b)<=.25;se.current=b;let M=U,x=0;if((k||r)&&A>0&&l>0){const E=be(o,A);if(E>=_e){x=E;const ue=Math.min(Me,Math.max(fe,Math.ceil(l/E)+1));M=ue,ue!==U&&pe(ue)}}const G=M!==U&&x>0?x*M:b>0?b:x>0?x*M:(()=>{const E=be(o,A);return E>0?E*M:0})();G>0?C(E=>E<=0?G:!g||Math.round(E)===Math.round(G)?E:G):!g&&w<=0&&(cancelAnimationFrame(i.current),i.current=requestAnimationFrame(d))},s=()=>{cancelAnimationFrame(i.current),i.current=requestAnimationFrame(d)};Q.current=s,s();const c=new ResizeObserver(s);return c.observe(t),c.observe(o),()=>{Q.current=null,cancelAnimationFrame(i.current),c.disconnect()}},[k,v,w,he,U,A,r]),a.useLayoutEffect(()=>{if(!v||m<=0)return;const t=L.current;t&&Ve(t)},[v,m,X,N]),a.useLayoutEffect(()=>{if(!v||w<=0){K(0);return}const t=L.current,o=O.current;if(!t||!o)return;const i=()=>{const s=t.offsetHeight||t.getBoundingClientRect().height,c=Array.from(o.children).reduce((b,p)=>Math.max(b,p.offsetHeight||p.getBoundingClientRect().height),0),l=s>0?s:c;K(l>0?l:0)};i();const d=new ResizeObserver(i);return d.observe(t),d.observe(o),()=>d.disconnect()},[v,ye,le,r,$,Z,D,w,T,F]),a.useLayoutEffect(()=>{if(!r||!W||!v||typeof window>"u")return;const t=requestAnimationFrame(()=>{window.dispatchEvent(new Event("scroll"))});return()=>cancelAnimationFrame(t)},[r,W,v,X,w,B,$,le]);const $e=()=>{H&&z(!0)},Re=()=>{H&&z(!1)},qe=a.useCallback(()=>{var t;ce.current=Math.min(ge,ce.current+1),(t=Q.current)==null||t.call(Q)},[ge]),xe=a.useCallback((t,o)=>{ae(i=>{const d=i[t]??o,s=(n??[]).filter(l=>l!==d);if(s.length===0)return i;const c=s[Math.floor(Math.random()*s.length)];return{...i,[t]:c}})},[n]),ve=(t,o,i,d)=>{const s=I&&S==="randomize"&&T.display==="cover"?F[i]??t:t,c=`max(${q($)}, ${Ne}px)`,l=`calc(-0.5 * (${c} + ${q($)}))`;return y.jsxs("div",{className:`${f}-marquee-card`,"data-marquee-item-index":i,onMouseEnter:I&&S==="randomize"&&T.display==="cover"?()=>xe(i,t):void 0,children:[y.jsx(Ue,{item:s,prefix:f,imageFit:T,imageMaxWidth:Z,imageMaxHeight:D,cornerRadius:P,imageHoverClass:oe,isEditor:r,isFirstSet:d,scaled:q,onFirstSetImageDone:qe}),W&&y.jsx("div",{"data-controls":"gap","data-controls-axis":"x",className:`${f}-gap-control`,style:{position:"absolute",top:0,right:l,width:c,height:"100%"}})]},`${o}-${i}`)};if(v){const t=k?H&&ee?"paused":"running":"paused",o=m>0&&N>0?m/N*1e3:0,i=`${Math.max(0,o)/1e3}s`;return y.jsxs("div",{ref:j,className:te(`${f}-wrapper`,`${f}-marquee-wrapper`),"aria-label":"Marquee",style:B>0?{height:B}:void 0,children:[y.jsx("style",{dangerouslySetInnerHTML:{__html:R}}),y.jsx("div",{ref:L,className:`${f}-marquee-track`,"data-direction":X,onMouseEnter:$e,onMouseLeave:Re,style:{WebkitAnimationDuration:i,animationDuration:i,WebkitAnimationPlayState:t,animationPlayState:t},children:Array.from({length:ye},(d,s)=>y.jsx("div",{ref:s===0?O:void 0,className:te(`${f}-marquee-row`,`${f}-marquee-set`),style:{gap:q($),paddingRight:q($)},"aria-hidden":s>0,children:le.map((c,l)=>ve(c,s,l,s===0&&l<A))},`set-${s}`))})]})}return y.jsxs("div",{ref:j,className:`${f}-wrapper`,children:[y.jsx("style",{dangerouslySetInnerHTML:{__html:R}}),y.jsx("div",{className:te(`${f}-marquee-row`,`${f}-marquee-static`),style:{gap:q($),transform:"none"},"aria-label":"Marquee",children:n==null?void 0:n.map((t,o)=>ve(t,0,o))},"marquee-static")]})};exports.Marquee=Ge;
@@ -0,0 +1,518 @@
1
+ import { jsx as g, jsxs as Ce, Fragment as Et } from "react/jsx-runtime";
2
+ import { useState as H, useMemo as ue, useRef as L, useLayoutEffect as W } from "react";
3
+ import Rt from "classnames";
4
+ import { s as qt } from "./scalingValue-C9JH5L6O.mjs";
5
+ import { u as Ft } from "./useScopedStyles-DhBG3557.mjs";
6
+ import { L as Lt } from "./LinkWrapper-DZs9hlOn.mjs";
7
+ import { t as Tt } from "./textStylesToCss-05Mn6I_2.mjs";
8
+ import { o as _t } from "./observeIntersection-B0f3L2iK.mjs";
9
+ function Wt(e, r, o) {
10
+ const s = r > 0 ? `${r}px` : "0px", a = o ? `
11
+ .${e}-item-image-wrap {
12
+ display: flex;
13
+ flex: 0 0 auto;
14
+ align-items: center;
15
+ }
16
+ .${e}-glyph {
17
+ display: inline-block;
18
+ }
19
+ .${e}-glyph-inner {
20
+ display: inline-block;
21
+ transform-origin: 50% 50%;
22
+ backface-visibility: hidden;
23
+ -webkit-backface-visibility: hidden;
24
+ }
25
+ .${e}-item-image {
26
+ transform-origin: 50% 50%;
27
+ backface-visibility: hidden;
28
+ -webkit-backface-visibility: hidden;
29
+ }
30
+ ` : "";
31
+ return `
32
+ .${e}-wrapper {
33
+ position: relative;
34
+ width: 100%;
35
+ height: auto;
36
+ }
37
+ .${e}-marquee-wrapper {
38
+ position: relative;
39
+ overflow: hidden;
40
+ overflow-x: clip;
41
+ overflow-y: visible;
42
+ width: 100%;
43
+ height: auto;
44
+ }
45
+ .${e}-curve-bg {
46
+ position: absolute;
47
+ left: 0;
48
+ top: 0;
49
+ width: 100%;
50
+ height: 100%;
51
+ overflow: visible;
52
+ pointer-events: none;
53
+ z-index: 0;
54
+ }
55
+ .${e}-ribbon {
56
+ position: absolute;
57
+ left: 0;
58
+ top: 50%;
59
+ width: 100%;
60
+ transform: translateY(-50%);
61
+ pointer-events: none;
62
+ z-index: 0;
63
+ }
64
+
65
+ @keyframes ${e}-marquee-left {
66
+ from { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }
67
+ to { -webkit-transform: translate3d(-${s}, 0, 0); transform: translate3d(-${s}, 0, 0); }
68
+ }
69
+
70
+ @keyframes ${e}-marquee-right {
71
+ from { -webkit-transform: translate3d(-${s}, 0, 0); transform: translate3d(-${s}, 0, 0); }
72
+ to { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }
73
+ }
74
+
75
+ .${e}-marquee-track {
76
+ display: flex;
77
+ flex-direction: row;
78
+ width: max-content;
79
+ backface-visibility: hidden;
80
+ -webkit-backface-visibility: hidden;
81
+ flex-wrap: nowrap;
82
+ -webkit-animation-timing-function: linear;
83
+ animation-timing-function: linear;
84
+ -webkit-animation-iteration-count: infinite;
85
+ animation-iteration-count: infinite;
86
+ position: relative;
87
+ z-index: 1;
88
+ }
89
+ .${e}-marquee-track[data-direction="left"] {
90
+ -webkit-animation-name: ${e}-marquee-left;
91
+ animation-name: ${e}-marquee-left;
92
+ }
93
+ .${e}-marquee-track[data-direction="right"] {
94
+ -webkit-animation-name: ${e}-marquee-right;
95
+ animation-name: ${e}-marquee-right;
96
+ }
97
+ .${e}-marquee-set {
98
+ display: flex;
99
+ flex-direction: row;
100
+ align-items: center;
101
+ flex: 0 0 auto;
102
+ position: relative;
103
+ z-index: 1;
104
+ }
105
+ .${e}-marquee-static {
106
+ justify-content: center;
107
+ overflow-x: auto;
108
+ }
109
+ .${e}-item {
110
+ position: relative;
111
+ display: flex;
112
+ flex-direction: row;
113
+ align-items: center;
114
+ flex: 0 0 auto;
115
+ white-space: nowrap;
116
+ }
117
+ .${e}-item-link {
118
+ display: flex;
119
+ flex-direction: row;
120
+ align-items: center;
121
+ text-decoration: none;
122
+ color: inherit;
123
+ }
124
+ .${e}-item-image {
125
+ display: block;
126
+ width: auto;
127
+ flex: 0 0 auto;
128
+ object-fit: contain;
129
+ }
130
+ .${e}-text {
131
+ display: inline-block;
132
+ }
133
+ ${a}
134
+ .${e}-cap-ref {
135
+ position: absolute;
136
+ visibility: hidden;
137
+ pointer-events: none;
138
+ white-space: nowrap;
139
+ left: -9999px;
140
+ top: 0;
141
+ }
142
+ `;
143
+ }
144
+ const Nt = 30, Se = 3, Bt = 12, Ht = 96, Ge = 3, de = 0.72, Ot = 100, zt = 10, Pt = (e) => e / Ot, Dt = (e) => Math.max(0, e) / zt, It = (e) => {
145
+ 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");
146
+ }, Ut = (e, r) => Array.from({ length: r * e.length }, (o, s) => e[s % e.length]), j = { ctx: void 0 }, Xt = () => j.ctx !== void 0 ? j.ctx : typeof document > "u" ? (j.ctx = null, j.ctx) : (j.ctx = document.createElement("canvas").getContext("2d"), j.ctx), Vt = (e, r, o, s) => {
147
+ e.style.transform = `translate3d(${r}px, ${o}px, 0) rotate(${s}deg)`;
148
+ }, Je = (e) => {
149
+ e.style.transform = "";
150
+ }, jt = (e) => {
151
+ if (!e || e === "none") return 0;
152
+ try {
153
+ return new DOMMatrixReadOnly(e).m41;
154
+ } catch {
155
+ return 0;
156
+ }
157
+ }, Yt = (e, r) => {
158
+ const o = (s, a) => {
159
+ if (!s || s === r) return a;
160
+ const d = a + s.offsetLeft, c = s.offsetParent;
161
+ return !c || c === s ? d : o(c, d);
162
+ };
163
+ return o(e, e.offsetWidth / 2);
164
+ }, Ze = 96, et = (e, r, o) => {
165
+ if (r <= 0 || Math.abs(e) <= 0 || o < 2) return null;
166
+ const s = 2 * Math.PI / r, a = new Float64Array(o + 1), d = new Float64Array(o + 1), c = e * r, l = (u) => Math.sqrt(1 + (c * Math.cos(r * u)) ** 2), w = s / o;
167
+ return Array.from({ length: o }, (u, M) => {
168
+ const x = M * w, k = x + w;
169
+ a[M + 1] = k, d[M + 1] = d[M] + (l(x) + l(k)) * 0.5 * w;
170
+ }), { wavelength: s, periodArc: d[o], x: a, s: d };
171
+ }, Kt = (e, r) => {
172
+ const o = et(e, r, Ze);
173
+ return !o || o.wavelength <= 0 ? 1 : o.periodArc / o.wavelength;
174
+ }, Qt = (e, r) => {
175
+ if (e.periodArc <= 0) return r;
176
+ const o = r < 0 ? -1 : 1, s = Math.abs(r), a = Math.floor(s / e.periodArc), d = s - a * e.periodArc, { s: c, x: l } = e, w = (R, $) => {
177
+ if ($ - R <= 1) return [R, $];
178
+ const q = R + $ >> 1;
179
+ return c[q] <= d ? w(q, $) : w(R, q);
180
+ }, [u, M] = w(0, c.length - 1), x = c[M] - c[u], k = x > 0 ? (d - c[u]) / x : 0;
181
+ return o * (a * e.wavelength + l[u] + (l[M] - l[u]) * k);
182
+ }, Gt = (e, r, o, s, a = 0) => {
183
+ const d = Math.max(0, o), c = e > 0 ? 2 * Math.PI * d / e : 0, l = ($) => s + r * Math.sin(c * $), w = ($) => r * c * Math.cos(c * $), u = -a, x = e + a - u, k = Math.max(4, Math.ceil(d * 4 * (x / Math.max(e, 1)))), R = Array.from({ length: k }, ($, q) => {
184
+ const N = u + q / k * x, F = u + (q + 1) / k * x, O = F - N, ee = l(N), Y = l(F), te = N + O / 3, ne = ee + w(N) * O / 3, me = F - O / 3, re = Y - w(F) * O / 3;
185
+ return `C${te.toFixed(2)} ${ne.toFixed(2)} ${me.toFixed(2)} ${re.toFixed(2)} ${F.toFixed(2)} ${Y.toFixed(2)}`;
186
+ });
187
+ return [`M${u.toFixed(2)} ${l(u).toFixed(2)}`, ...R].join(" ");
188
+ }, Jt = ({ item: e, prefix: r, textCss: o, capHeightPx: s, opticalOffsetY: a, imageGapPx: d, isCurve: c }) => {
189
+ var R;
190
+ const l = a !== 0 ? { ...o, transform: `translateY(${a}px)` } : o, w = s > 0 ? { height: `${s}px` } : { fontSize: o.fontSize, height: `${de}em` }, u = ((R = e.image) == null ? void 0 : R.assetId) && /* @__PURE__ */ g(
191
+ "img",
192
+ {
193
+ src: e.image.assetId,
194
+ alt: e.image.name ?? "",
195
+ className: `${r}-item-image`,
196
+ style: w
197
+ }
198
+ ), M = u && (c ? /* @__PURE__ */ g("span", { className: `${r}-item-image-wrap`, "data-marquee-wave-node": !0, children: u }) : u), x = c ? /* @__PURE__ */ g("span", { className: `${r}-text`, style: l, children: Array.from(e.text).map(($, q) => /* @__PURE__ */ g("span", { className: `${r}-glyph`, "data-marquee-wave-node": !0, children: /* @__PURE__ */ g("span", { className: `${r}-glyph-inner`, children: $ === " " ? " " : $ }) }, q)) }) : /* @__PURE__ */ g("span", { className: `${r}-text`, style: l, children: e.text }), k = /* @__PURE__ */ Ce(Et, { children: [
199
+ M,
200
+ x
201
+ ] });
202
+ return /* @__PURE__ */ g("div", { className: `${r}-item`, "data-marquee-text-item": !0, style: { gap: d }, children: /* @__PURE__ */ g(Lt, { link: e.link, className: `${r}-item-link`, style: { gap: d }, children: k }) });
203
+ }, cn = ({ settings: e, content: r, isEditor: o, isPreviewMode: s }) => {
204
+ const { prefix: a } = Ft(), [d, c] = H(0), l = d > 0 ? Math.round(d) : 0, {
205
+ speed: w,
206
+ direction: u,
207
+ pauseOnHover: M,
208
+ gap: x,
209
+ layoutType: k,
210
+ curveAmplitude: R,
211
+ curveFrequency: $,
212
+ textFontFamily: q,
213
+ textFontSettings: N,
214
+ textFontSize: F,
215
+ textLetterSpacing: O,
216
+ textWordSpacing: ee,
217
+ textTextAppearance: Y,
218
+ textColor: te,
219
+ backgroundColor: ne,
220
+ ribbonWidth: me
221
+ } = e, re = me ?? F, y = k === "curve", I = Pt(R), K = Dt($), tt = ue(() => Wt(a, l, y), [a, l, y]), z = ue(() => Tt({
222
+ fontSettings: {
223
+ fontFamily: q,
224
+ fontWeight: N.fontWeight,
225
+ fontStyle: N.fontStyle
226
+ },
227
+ letterSpacing: O,
228
+ wordSpacing: ee,
229
+ fontSize: F,
230
+ lineHeight: F,
231
+ textAppearance: Y,
232
+ color: te
233
+ }, o), [q, N, O, ee, F, Y, te, o]), oe = (n) => qt(n, o ?? !1), P = ((r == null ? void 0 : r.length) ?? 0) > 0, Q = o ? !!s : !0, D = P && (Q || !!o), ie = Math.max(0, w) * Nt, fe = Q && M === "on", [nt, Me] = H(!1), he = Q ? fe && nt ? "paused" : "running" : "paused", pe = he === "running" && ie > 0 && l > 0, rt = l > 0 && ie > 0 ? l / ie * 1e3 : 0, ae = L(null), ge = L(null), ve = L(null), se = L(null), ke = L(null), Ee = L(null), Re = L(pe), G = L(null), J = L(null), xe = L(I), ye = L(K);
234
+ Re.current = pe, xe.current = I, ye.current = K;
235
+ const [U, qe] = H(0), [ot, Fe] = H(0), [Le, Te] = H(0), [Z, _e] = H(0), [We, it] = H(0), ce = ue(
236
+ () => (r ?? []).map((n) => {
237
+ var i, t;
238
+ return `${n.text}\0${((i = n.image) == null ? void 0 : i.assetId) ?? ""}\0${((t = n.link) == null ? void 0 : t.value) ?? ""}`;
239
+ }).join("\0"),
240
+ [r]
241
+ ), [X, Ne] = H(Se), at = ue(() => {
242
+ const n = r ?? [];
243
+ return n.length === 0 || !(Q || o) ? n : Ut(n, X);
244
+ }, [r, Q, X, o]), st = D ? Ge : 1;
245
+ W(() => {
246
+ Ne(Se), c(0);
247
+ }, [ce]), W(() => {
248
+ var v;
249
+ const n = Ee.current;
250
+ if (!n) return;
251
+ const i = () => {
252
+ const f = getComputedStyle(n), h = parseFloat(f.fontSize) || 0;
253
+ if (h <= 0) return;
254
+ const m = Xt();
255
+ if (!m) {
256
+ qe(h * de), Fe(0);
257
+ return;
258
+ }
259
+ m.font = `${f.fontStyle} ${f.fontWeight} ${h}px ${f.fontFamily}`;
260
+ const S = m.measureText("H"), T = S.actualBoundingBoxAscent > 0 ? S.actualBoundingBoxAscent : h * de, B = Math.max(0, S.actualBoundingBoxDescent || 0), E = S.fontBoundingBoxAscent || 0, C = S.fontBoundingBoxDescent || 0;
261
+ qe((p) => Math.abs(p - T) > 0.5 ? T : p);
262
+ const A = E > 0 || C > 0 ? (C - B - (E - T)) / 2 : 0;
263
+ Fe((p) => Math.abs(p - A) > 0.25 ? A : p);
264
+ };
265
+ i();
266
+ const t = typeof document < "u" ? document.fonts : void 0;
267
+ (v = t == null ? void 0 : t.ready) == null || v.then(i).catch(() => {
268
+ });
269
+ const b = new ResizeObserver(i);
270
+ return b.observe(n), () => b.disconnect();
271
+ }, [z.fontFamily, z.fontWeight, z.fontStyle, z.fontSize, z.lineHeight]), W(() => {
272
+ if (!D) return;
273
+ const n = ae.current, i = se.current;
274
+ if (!n || !i) return;
275
+ const t = { id: 0 }, b = () => {
276
+ const m = n.offsetWidth || n.getBoundingClientRect().width, S = i.offsetWidth || i.getBoundingClientRect().width;
277
+ if (P && m > 0 && S > 0) {
278
+ const T = S / X;
279
+ if (T > 0) {
280
+ let B = m, E = Bt;
281
+ if (y) {
282
+ const A = m * xe.current, p = ye.current, V = p > 0 ? 2 * Math.PI * p / m : 0, _ = Kt(A, V);
283
+ B = Math.max(m, _ * m / (Ge - 1)), E = Ht;
284
+ }
285
+ const C = Math.min(
286
+ E,
287
+ Math.max(Se, Math.ceil(B / T) + 1)
288
+ );
289
+ if (C !== X) {
290
+ Ne(C);
291
+ return;
292
+ }
293
+ }
294
+ }
295
+ S > 0 && c(S);
296
+ }, v = () => {
297
+ cancelAnimationFrame(t.id), t.id = requestAnimationFrame(b);
298
+ };
299
+ v();
300
+ const f = new ResizeObserver(v);
301
+ f.observe(n), f.observe(i);
302
+ const h = () => {
303
+ document.hidden || v();
304
+ };
305
+ return document.addEventListener("visibilitychange", h), window.addEventListener("pageshow", h), window.addEventListener("focus", h), () => {
306
+ cancelAnimationFrame(t.id), f.disconnect(), document.removeEventListener("visibilitychange", h), window.removeEventListener("pageshow", h), window.removeEventListener("focus", h);
307
+ };
308
+ }, [D, ce, X, P, U, y, I, K]), W(() => {
309
+ const n = ke.current;
310
+ if (!n) return;
311
+ const i = { id: 0 }, t = () => {
312
+ const v = n.offsetHeight;
313
+ v > 0 && it((f) => Math.abs(f - v) > 0.5 ? v : f);
314
+ };
315
+ i.id = requestAnimationFrame(t);
316
+ const b = new ResizeObserver(() => {
317
+ cancelAnimationFrame(i.id), i.id = requestAnimationFrame(t);
318
+ });
319
+ return b.observe(n), () => {
320
+ cancelAnimationFrame(i.id), b.disconnect();
321
+ };
322
+ }, [re, o]), W(() => {
323
+ if (!y) {
324
+ Te(0), _e(0);
325
+ return;
326
+ }
327
+ const n = ae.current, i = se.current;
328
+ if (!n || !i) return;
329
+ const t = { id: 0 }, b = () => {
330
+ const f = n.offsetWidth, h = i.offsetHeight;
331
+ f > 0 && _e((m) => Math.abs(m - f) > 0.5 ? f : m), h > 0 && Te((m) => Math.abs(m - h) > 0.5 ? h : m);
332
+ };
333
+ t.id = requestAnimationFrame(b);
334
+ const v = new ResizeObserver(() => {
335
+ cancelAnimationFrame(t.id), t.id = requestAnimationFrame(b);
336
+ });
337
+ return v.observe(n), v.observe(i), () => {
338
+ cancelAnimationFrame(t.id), v.disconnect();
339
+ };
340
+ }, [y, ce, U, F, D]), W(() => {
341
+ if (!D || l <= 0) return;
342
+ const n = ve.current;
343
+ n && It(n);
344
+ }, [D, l, u, ie]), W(() => {
345
+ if (!y || !P) return;
346
+ const n = ae.current;
347
+ if (!n) return;
348
+ const i = typeof IntersectionObserver < "u", t = {
349
+ raf: 0,
350
+ cancelled: !1,
351
+ isOnScreen: !i,
352
+ lut: null,
353
+ lutKey: "",
354
+ itemsCache: [],
355
+ cacheDirty: !0
356
+ }, b = () => {
357
+ for (const C of t.itemsCache)
358
+ for (const A of C.glyphs) Je(A.inner);
359
+ }, v = () => {
360
+ const C = ge.current ?? n;
361
+ t.itemsCache = Array.from(
362
+ n.querySelectorAll("[data-marquee-text-item]"),
363
+ (A) => {
364
+ const p = [];
365
+ return A.querySelectorAll("[data-marquee-wave-node]").forEach((V) => {
366
+ const _ = V.firstElementChild;
367
+ _ && p.push({
368
+ inner: _,
369
+ layoutLocalX: Yt(V, C)
370
+ });
371
+ }), { item: A, glyphs: p };
372
+ }
373
+ ), t.cacheDirty = !1;
374
+ }, f = () => {
375
+ t.cacheDirty && v();
376
+ const A = (ge.current ?? n).offsetWidth || 1, p = A * xe.current, V = ye.current, _ = 2 * Math.PI * V / A, Ue = `${A}|${p}|${_}`;
377
+ if (Ue !== t.lutKey && (t.lutKey = Ue, t.lut = et(p, _, Ze)), Math.abs(p) <= 0 || _ <= 0) {
378
+ b();
379
+ return;
380
+ }
381
+ const Xe = ve.current, bt = Xe ? jt(getComputedStyle(Xe).transform) : 0, Ve = n.getBoundingClientRect(), wt = Ve.left, $t = Ve.right, At = t.lut && t.lut.wavelength > 0 ? Math.max(0, (t.lut.periodArc / t.lut.wavelength - 1) * A) : 0;
382
+ for (const { item: St, glyphs: je } of t.itemsCache) {
383
+ const Ye = St.getBoundingClientRect();
384
+ if (Ye.right < wt || Ye.left > $t + At) {
385
+ for (const le of je) Je(le.inner);
386
+ continue;
387
+ }
388
+ for (const le of je) {
389
+ const Ae = le.layoutLocalX + bt, Ke = t.lut ? Qt(t.lut, Ae) : Ae, Qe = _ * Ke, Ct = p * Math.sin(Qe), Mt = p * _ * Math.cos(Qe), kt = Math.atan(Mt) * (180 / Math.PI);
390
+ Vt(le.inner, Ke - Ae, Ct, kt);
391
+ }
392
+ }
393
+ }, h = () => {
394
+ t.cancelled || (t.raf = 0, f(), Re.current && t.isOnScreen && !document.hidden && (t.raf = requestAnimationFrame(h)));
395
+ }, m = () => {
396
+ t.cancelled || t.raf || !t.isOnScreen || (t.raf = requestAnimationFrame(h));
397
+ }, S = () => {
398
+ cancelAnimationFrame(t.raf), t.raf = 0;
399
+ }, T = () => {
400
+ t.cacheDirty = !0, t.isOnScreen && (f(), m());
401
+ };
402
+ G.current = m, J.current = T, f(), m();
403
+ const B = i ? _t(n, "0px", (C) => {
404
+ t.isOnScreen = C, C ? T() : S();
405
+ }) : null, E = () => {
406
+ S(), document.hidden || T();
407
+ };
408
+ return document.addEventListener("visibilitychange", E), window.addEventListener("pageshow", E), window.addEventListener("focus", E), () => {
409
+ t.cancelled = !0, G.current = null, J.current = null, B == null || B(), cancelAnimationFrame(t.raf), document.removeEventListener("visibilitychange", E), window.removeEventListener("pageshow", E), window.removeEventListener("focus", E), b();
410
+ };
411
+ }, [y, P]), W(() => {
412
+ var n;
413
+ !y || !P || (n = J.current) == null || n.call(J);
414
+ }, [y, P, d, ce, X, U, I, K, Z]), W(() => {
415
+ var n;
416
+ (n = G.current) == null || n.call(G);
417
+ }, [pe, u]);
418
+ const ct = (n) => {
419
+ fe && n.pointerType === "mouse" && Me(!0);
420
+ }, lt = () => {
421
+ fe && Me(!1);
422
+ }, Be = y ? Math.abs(I) * 100 : 0, be = oe(re), ut = {
423
+ minHeight: be,
424
+ ...y ? { paddingTop: `${Be}%`, paddingBottom: `${Be}%` } : {}
425
+ }, dt = {
426
+ height: be,
427
+ ...y ? { visibility: "hidden" } : { backgroundColor: ne }
428
+ }, He = {
429
+ gap: oe(x),
430
+ minHeight: be
431
+ }, Oe = Z * I, ze = Math.abs(Oe), we = We > 0 ? We : Le, $e = Math.max(Le, we), mt = ze + $e / 2, ft = Math.max(we, 1), Pe = y && Z > 0 && $e > 0 ? Gt(
432
+ Z,
433
+ Oe,
434
+ K,
435
+ mt,
436
+ ft
437
+ ) : "", ht = ze * 2 + $e, pt = Pe ? /* @__PURE__ */ g(
438
+ "svg",
439
+ {
440
+ className: `${a}-curve-bg`,
441
+ viewBox: `0 0 ${Z} ${ht}`,
442
+ preserveAspectRatio: "none",
443
+ "aria-hidden": !0,
444
+ children: /* @__PURE__ */ g(
445
+ "path",
446
+ {
447
+ d: Pe,
448
+ fill: "none",
449
+ stroke: ne,
450
+ strokeWidth: we,
451
+ strokeLinecap: "butt",
452
+ strokeLinejoin: "round"
453
+ }
454
+ )
455
+ }
456
+ ) : null, gt = /* @__PURE__ */ g("div", { ref: ke, className: `${a}-ribbon`, style: dt, "aria-hidden": !0 }), vt = {
457
+ ...z,
458
+ lineHeight: U > 0 ? `${U}px` : `${de}em`
459
+ }, De = (n, i, t) => /* @__PURE__ */ g(
460
+ Jt,
461
+ {
462
+ item: n,
463
+ prefix: a,
464
+ textCss: vt,
465
+ capHeightPx: U,
466
+ opticalOffsetY: ot,
467
+ imageGapPx: oe(x),
468
+ isCurve: y
469
+ },
470
+ `${i}-${t}`
471
+ ), xt = /* @__PURE__ */ g("span", { ref: Ee, "aria-hidden": !0, className: `${a}-cap-ref`, style: z, children: "H" }), Ie = `${Math.max(0, rt) / 1e3}s`, yt = D ? /* @__PURE__ */ g(
472
+ "div",
473
+ {
474
+ ref: ve,
475
+ className: `${a}-marquee-track`,
476
+ "data-direction": u,
477
+ onPointerEnter: ct,
478
+ onPointerLeave: lt,
479
+ style: {
480
+ WebkitAnimationDuration: Ie,
481
+ animationDuration: Ie,
482
+ WebkitAnimationPlayState: he,
483
+ animationPlayState: he
484
+ },
485
+ children: Array.from({ length: st }, (n, i) => /* @__PURE__ */ g(
486
+ "div",
487
+ {
488
+ ref: i === 0 ? se : void 0,
489
+ className: `${a}-marquee-set`,
490
+ style: { ...He, paddingRight: oe(x) },
491
+ "aria-hidden": i > 0,
492
+ children: at.map((t, b) => De(t, i, b))
493
+ },
494
+ `set-${i}`
495
+ ))
496
+ }
497
+ ) : /* @__PURE__ */ g(
498
+ "div",
499
+ {
500
+ ref: se,
501
+ className: Rt(`${a}-marquee-set`, `${a}-marquee-static`),
502
+ style: He,
503
+ children: r == null ? void 0 : r.map((n, i) => De(n, 0, i))
504
+ }
505
+ );
506
+ return /* @__PURE__ */ Ce("div", { ref: ae, className: `${a}-wrapper`, "aria-label": "Marquee text", children: [
507
+ /* @__PURE__ */ g("style", { dangerouslySetInnerHTML: { __html: tt } }),
508
+ xt,
509
+ /* @__PURE__ */ Ce("div", { ref: ge, className: `${a}-marquee-wrapper`, style: ut, children: [
510
+ gt,
511
+ pt,
512
+ yt
513
+ ] })
514
+ ] });
515
+ };
516
+ export {
517
+ cn as MarqueeText
518
+ };