import{a as ge}from"./chunk-KPHCTRXD.mjs";import{D as Y,F as i,I as me,a as D,d as de,f as X,g as se,h as pe,i as ue,j as ce,k as fe,l as he}from"./chunk-YXURU7NW.mjs";import{B as s,C as j,b as I,f as N,i as E,o as oe,q as F,u as ae,w as d,x as le}from"./chunk-MJ2EDGOT.mjs";var Oe=100,Pe={left:t=>`translateX(-${t}px)`,right:t=>`translateX(${t}px)`,top:t=>`translateY(-${t}px)`,bottom:t=>`translateY(${t}px)`},G=typeof Animation<"u"&&typeof Animation.prototype.updatePlaybackRate=="function";function K(t){let{slots:g,gap:_,padding:ve,paddingPerSide:xe,paddingTop:Te,paddingRight:_e,paddingBottom:Se,paddingLeft:we,speed:S,hoverFactor:M,direction:p,alignment:Ce,sizingOptions:Ie,fadeOptions:Me,style:Ve}=t,{fadeContent:V,overflow:Ae,fadeWidth:U,fadeInset:q,fadeAlpha:J}=Me,{widthType:A,heightType:R}=Ie,Re=xe?`${Te}px ${_e}px ${Se}px ${we}px`:`${ve}px`,u=Y.current()===Y.canvas,k=I.count(g),w=k>0;p===!0&&(p="left");let x=p==="left"||p==="right",Q=se(0),$=Pe[p],ke=pe(Q,$),y=d(null),o=ae(()=>[E(),E()],[]),[c,$e]=le({parent:null,children:null}),Z=[],W=[],T=0,L=0;u&&(T=k?Math.floor(10/k):0,L=1),!u&&w&&c.parent&&(T=Math.round(c.parent/c.children*2)+1,T=Math.min(T,Oe),L=1);let ee=oe(()=>{if(w&&y.current){let n=x?y.current.offsetWidth:y.current.offsetHeight,e=o[0].current?x?o[0].current.offsetLeft:o[0].current.offsetTop:0,r=(o[1].current?x?o[1].current.offsetLeft+o[1].current.offsetWidth:o[1].current.offsetTop+o[1].current.offsetHeight:0)-e+_;$e({parent:n,children:r})}},[]),te=u?{contentVisibility:"auto"}:{};if(w){if(!u){let n=d(!0);F(()=>(D.read(ee),ge(y.current,({contentSize:e})=>{!n.current&&(e.width||e.height)&&D.read(ee),n.current=!1})),[])}Z=I.map(g,(n,e)=>{var l,r,f,h;let m;e===0&&(m=o[0]),e===g.length-1&&(m=o[1]);let v={width:A?(l=n.props)===null||l===void 0?void 0:l.width:"100%",height:R?(r=n.props)===null||r===void 0?void 0:r.height:"100%"};return s(X,{inherit:"id",children:s("li",{ref:m,style:v,children:N(n,{style:{...(f=n.props)===null||f===void 0?void 0:f.style,...v,flexShrink:0,...te},layoutId:n.props.layoutId?n.props.layoutId+"-original-"+e:void 0},(h=n.props)===null||h===void 0?void 0:h.children)})})})}if(!u)for(let n=0;n{var r,f,h,m,v,P;let He={width:A?(r=e.props)===null||r===void 0?void 0:r.width:"100%",height:R?(f=e.props)===null||f===void 0?void 0:f.height:"100%"};return s(X,{inherit:"id",children:s("li",{style:He,"aria-hidden":!0,children:N(e,{key:n+" "+l,style:{...(h=e.props)===null||h===void 0?void 0:h.style,width:A?(m=e.props)===null||m===void 0?void 0:m.width:"100%",height:R?(v=e.props)===null||v===void 0?void 0:v.height:"100%",flexShrink:0,...te},layoutId:e.props.layoutId?e.props.layoutId+"-dupe-"+n:void 0},(P=e.props)===null||P===void 0?void 0:P.children)},n+"li"+l)},n+"lg"+l)})];let a=c.children+c.children*Math.round(c.parent/c.children),z=d(null),B=d(null),C=d(0),H=d(!1),ne=ce(),ie=d(null),b=d(null);if(!u){let n=he(y);G?F(()=>{if(!(ne||!a||!S))return b.current=ie.current.animate({transform:[$(0),$(a)]},{duration:Math.abs(a)/S*1e3,iterations:1/0,easing:"linear"}),()=>b.current.cancel()},[M,a,S]):ue(e=>{if(!a||ne||G)return;z.current===null&&(z.current=e),e=e-z.current;let r=(B.current===null?0:e-B.current)*(S/1e3);H.current&&(r*=M),C.current+=r,C.current=fe(0,a,C.current),B.current=e,n&&Q.set(C.current)})}let We=x?"to right":"to bottom",re=U/2,Le=100-U/2,ze=De(q,0,re),Be=100-q,O=`linear-gradient(${We}, rgba(0, 0, 0, ${J}) ${ze}%, rgba(0, 0, 0, 1) ${re}%, rgba(0, 0, 0, 1) ${Le}%, rgba(0, 0, 0, ${J}) ${Be}%)`;return w?s("section",{style:{...ye,opacity:L,WebkitMaskImage:V?O:void 0,MozMaskImage:V?O:void 0,maskImage:V?O:void 0,overflow:Ae?"visible":"hidden",padding:Re},ref:y,children:j(de.ul,{ref:ie,style:{...ye,gap:_,top:p==="bottom"&&be(a)?-a:void 0,left:p==="right"&&be(a)?-a:void 0,placeItems:Ce,position:"relative",flexDirection:x?"row":"column",...Ve,transform:G?void 0:ke,willChange:u?"auto":"transform"},onMouseEnter:()=>{H.current=!0,b.current&&b.current.updatePlaybackRate(M)},onMouseLeave:()=>{H.current=!1,b.current&&b.current.updatePlaybackRate(1)},children:[Z,W]})}):j("section",{style:Ne,children:[s("div",{style:Ee,children:"\u2728"}),s("p",{style:Fe,children:"Connect to Content"}),s("p",{style:je,children:"Add layers or components to infinitely loop on your page."})]})}K.defaultProps={gap:10,padding:10,sizingOptions:{widthType:!0,heightType:!0},fadeOptions:{fadeContent:!0,overflow:!1,fadeWidth:25,fadeAlpha:0,fadeInset:0},direction:!0};me(K,{slots:{type:i.Array,title:"Children",control:{type:i.ComponentInstance}},speed:{type:i.Number,title:"Speed",min:0,max:1e3,defaultValue:100,unit:"%",displayStepper:!0,step:5},direction:{type:i.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:i.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:i.Number,title:"Gap"},padding:{title:"Padding",type:i.FusedNumber,toggleKey:"paddingPerSide",toggleTitles:["Padding","Padding per side"],valueKeys:["paddingTop","paddingRight","paddingBottom","paddingLeft"],valueLabels:["T","R","B","L"],min:0},sizingOptions:{type:i.Object,title:"Sizing",controls:{widthType:{type:i.Boolean,title:"Width",enabledTitle:"Auto",disabledTitle:"Stretch",defaultValue:!0},heightType:{type:i.Boolean,title:"Height",enabledTitle:"Auto",disabledTitle:"Stretch",defaultValue:!0}}},fadeOptions:{type:i.Object,title:"Clipping",controls:{fadeContent:{type:i.Boolean,title:"Fade",defaultValue:!0},overflow:{type:i.Boolean,title:"Overflow",enabledTitle:"Show",disabledTitle:"Hide",defaultValue:!1,hidden(t){return t.fadeContent===!0}},fadeWidth:{type:i.Number,title:"Width",defaultValue:25,min:0,max:100,unit:"%",hidden(t){return t.fadeContent===!1}},fadeInset:{type:i.Number,title:"Inset",defaultValue:0,min:0,max:100,unit:"%",hidden(t){return t.fadeContent===!1}},fadeAlpha:{type:i.Number,title:"Opacity",defaultValue:0,min:0,max:1,step:.05,hidden(t){return t.fadeContent===!1}}}},hoverFactor:{type:i.Number,title:"Hover",min:0,max:1,unit:"x",defaultValue:1,step:.1,displayStepper:!0,description:"Slows down the speed while you are hovering."}});var ye={display:"flex",width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",placeItems:"center",margin:0,padding:0,listStyleType:"none",textIndent:"none"},Ne={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"},Ee={fontSize:32,marginBottom:10},Fe={margin:0,marginBottom:10,fontWeight:600,textAlign:"center"},je={margin:0,opacity:.7,maxWidth:150,lineHeight:1.5,textAlign:"center"},De=(t,g,_)=>Math.min(Math.max(t,g),_),be=t=>typeof t=="number"&&!isNaN(t);export{K as a}; //# sourceMappingURL=chunk-7LXR5W7H.mjs.map