import{t as e}from"./rolldown-runtime.CMAw1HyY.mjs";import{F as t,M as n,N as r,O as i,T as a,j as ee,k as o,l as s,s as c,u as l,v as te,w as u}from"./react.D3LpXLeJ.mjs";import{B as ne,C as re,F as ie,G as ae,R as oe,h as d,r as f,t as p}from"./motion.DmxynPzX.mjs";import{S as m,Y as h,a as g,k as _}from"./framer.B9eBDazG.mjs";import{n as se,t as v}from"./index.es.BBDHDHx3.mjs";function y(e){let{slots:c=[],gap:u,padding:p,paddingPerSide:h,paddingTop:g,paddingRight:_,paddingBottom:v,paddingLeft:y,speed:T,hoverFactor:E,direction:D,alignment:fe,sizingOptions:pe,fadeOptions:me,style:he}=e,{fadeContent:O,overflow:ge,fadeWidth:k,fadeInset:A,fadeAlpha:j}=me,{widthType:M,heightType:N}=pe,_e=h?`${g}px ${_}px ${v}px ${y}px`:`${p}px`,P=m.current(),F=P===m.canvas||P===m.export,I=c.filter(Boolean),L=a.count(I),R=L>0;D===!0&&(D=`left`);let z=D===`left`||D===`right`,ve=oe(0),B=ce[D];ae(ve,B);let V=i(null),H=ee(()=>[{current:null},{current:null}],[]),[U,ye]=t({parent:null,children:null}),W=null,G=[],K=0,q=0;F&&(K=L?Math.floor(10/L):0,q=1),!F&&R&&U.parent&&(K=Math.round(U.parent/U.children*2)+1,K=Math.min(K,b),q=1);let J=n(()=>{if(R&&V.current){let e=z?V.current.offsetWidth:V.current.offsetHeight,t=H[0].current?z?H[0].current.offsetLeft:H[0].current.offsetTop:0,n=(H[1].current?z?H[1].current.offsetLeft+H[1].current.offsetWidth:H[1].current.offsetTop+H[1].current.offsetHeight:0)-t+u;te(()=>ye({parent:e,children:n}))}},[]),Y=F?{contentVisibility:`auto`}:{};if(R){if(!F){let e=i(!0);r(()=>(d.read(J),se(V.current,({contentSize:t})=>{!e.current&&(t.width||t.height)&&d.read(J),e.current=!1})),[])}W=a.map(I,(e,t)=>{let n;t===0&&(n=H[0]),t===I.length-1&&(n=H[1]);let r={width:M?e.props?.width:`100%`,height:N?e.props?.height:`100%`};return s(f,{inherit:`id`,children:s(`li`,{ref:n,style:r,children:o(e,{style:{...e.props?.style,...r,flexShrink:0,...Y},layoutId:e.props.layoutId?e.props.layoutId+`-original-`+t:void 0},e.props?.children)})})})}let X=F?!0:ie(V);if(!F)for(let e=0;es(f,{inherit:`id`,children:s(`li`,{style:{width:M?t.props?.width:`100%`,height:N?t.props?.height:`100%`,willChange:X?`transform`:void 0},"aria-hidden":!0,children:o(t,{key:e+` `+n,style:{...t.props?.style,width:M?t.props?.width:`100%`,height:N?t.props?.height:`100%`,flexShrink:0,...Y},layoutId:t.props.layoutId?t.props.layoutId+`-dupe-`+e:void 0},t.props?.children)},e+`li`+n)},e+`lg`+n)));let Z=U.children+U.children*Math.round(U.parent/U.children);i(null),i(null),i(0);let be=i(!1),xe=ne(),Se=i(null),Q=i(null);if(!F){r(()=>{if(!(xe||!Z||!T))return Q.current=Se.current.animate({transform:[B(0),B(Z)]},{duration:Math.abs(Z)/T*1e3,iterations:1/0,easing:`linear`}),()=>Q.current.cancel()},[E,Z,T]);let e=n(()=>{if(!Q.current)return;let e=document.hidden;X&&!e&&Q.current.playState===`paused`?Q.current.play():(!X||e)&&Q.current.playState===`running`&&Q.current.pause()},[X]);r(()=>{e()},[X]),r(()=>(document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}),[e])}let Ce=z?`to right`:`to bottom`,$=k/2,we=100-k/2,Te=`linear-gradient(${Ce}, rgba(0, 0, 0, ${j}) ${C(A,0,$)}%, rgba(0, 0, 0, 1) ${$}%, rgba(0, 0, 0, 1) ${we}%, rgba(0, 0, 0, ${j}) ${100-A}%)`;return R?s(`section`,{style:{...x,opacity:q,WebkitMaskImage:O?Te:void 0,maskImage:O?Te:void 0,overflow:ge?`visible`:`hidden`,padding:_e},ref:V,children:l(re.ul,{ref:Se,style:{...x,gap:u,top:D===`bottom`&&w(Z)?-Z:void 0,left:D===`right`&&w(Z)?-Z:void 0,placeItems:fe,position:`relative`,flexDirection:z?`row`:`column`,...he,willChange:F||!X?`auto`:`transform`,transform:B(0)},onMouseEnter:()=>{be.current=!0,Q.current&&(Q.current.playbackRate=E)},onMouseLeave:()=>{be.current=!1,Q.current&&(Q.current.playbackRate=1)},children:[W,G]})}):l(`section`,{style:le,children:[s(`div`,{style:ue,children:`✨`}),s(`p`,{style:de,children:`Connect to Content`}),s(`p`,{style:S,children:`Add layers or components to infinitely loop on your page.`})]})}var b,ce,x,le,ue,de,S,C,w,T=e((()=>{c(),u(),h(),p(),v(),b=100,ce={left:e=>`translateX(-${e}px)`,right:e=>`translateX(${e}px)`,top:e=>`translateY(-${e}px)`,bottom:e=>`translateY(${e}px)`},y.defaultProps={gap:10,padding:10,sizingOptions:{widthType:!0,heightType:!0},fadeOptions:{fadeContent:!0,overflow:!1,fadeWidth:25,fadeAlpha:0,fadeInset:0},direction:!0},_(y,{slots:{type:g.Array,title:`Children`,control:{type:g.ComponentInstance}},speed:{type:g.Number,title:`Speed`,min:0,max:1e3,defaultValue:100,unit:`%`,displayStepper:!0,step:5},direction:{type:g.Enum,title:`Direction`,options:[`left`,`right`,`top`,`bottom`],optionIcons:[`direction-left`,`direction-right`,`direction-up`,`direction-down`],optionTitles:[`Left`,`Right`,`Top`,`Bottom`],defaultValue:`left`,displaySegmentedControl:!0},alignment:{type:g.Enum,title:`Align`,options:[`flex-start`,`center`,`flex-end`],optionIcons:{direction:{right:[`align-top`,`align-middle`,`align-bottom`],left:[`align-top`,`align-middle`,`align-bottom`],top:[`align-left`,`align-center`,`align-right`],bottom:[`align-left`,`align-center`,`align-right`]}},defaultValue:`center`,displaySegmentedControl:!0},gap:{type:g.Number,title:`Gap`},padding:{title:`Padding`,type:g.FusedNumber,toggleKey:`paddingPerSide`,toggleTitles:[`Padding`,`Padding per side`],valueKeys:[`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`],valueLabels:[`T`,`R`,`B`,`L`],min:0},sizingOptions:{type:g.Object,title:`Sizing`,controls:{widthType:{type:g.Boolean,title:`Width`,enabledTitle:`Auto`,disabledTitle:`Stretch`,defaultValue:!0},heightType:{type:g.Boolean,title:`Height`,enabledTitle:`Auto`,disabledTitle:`Stretch`,defaultValue:!0}}},fadeOptions:{type:g.Object,title:`Clipping`,controls:{fadeContent:{type:g.Boolean,title:`Fade`,defaultValue:!0},overflow:{type:g.Boolean,title:`Overflow`,enabledTitle:`Show`,disabledTitle:`Hide`,defaultValue:!1,hidden(e){return e.fadeContent===!0}},fadeWidth:{type:g.Number,title:`Width`,defaultValue:25,min:0,max:100,unit:`%`,hidden(e){return e.fadeContent===!1}},fadeInset:{type:g.Number,title:`Inset`,defaultValue:0,min:0,max:100,unit:`%`,hidden(e){return e.fadeContent===!1}},fadeAlpha:{type:g.Number,title:`Opacity`,defaultValue:0,min:0,max:1,step:.05,hidden(e){return e.fadeContent===!1}}}},hoverFactor:{type:g.Number,title:`Hover`,min:0,max:1,unit:`x`,defaultValue:1,step:.1,displayStepper:!0,description:`Slows down the speed while you are hovering.`}}),x={display:`flex`,width:`100%`,height:`100%`,maxWidth:`100%`,maxHeight:`100%`,placeItems:`center`,margin:0,padding:0,listStyleType:`none`,textIndent:`none`},le={display:`flex`,width:`100%`,height:`100%`,placeContent:`center`,placeItems:`center`,flexDirection:`column`,color:`#96F`,background:`rgba(136, 85, 255, 0.1)`,fontSize:11,overflow:`hidden`,padding:`20px 20px 30px 20px`},ue={fontSize:32,marginBottom:10},de={margin:0,marginBottom:10,fontWeight:600,textAlign:`center`},S={margin:0,opacity:.7,maxWidth:150,lineHeight:1.5,textAlign:`center`},C=(e,t,n)=>Math.min(Math.max(e,t),n),w=e=>typeof e==`number`&&!isNaN(e)}));export{T as n,y as t}; //# sourceMappingURL=Ticker.BCyUR0MD.mjs.map