import{a as ae}from"./chunk-MXEOG2JA.mjs";import{C as I,E as i,H as oe,a as B,d as ee,f as O,g as te,h as ne,i as ie,l as re}from"./chunk-MKR4LDTT.mjs";import{B as l,C as A,b as w,f as k,m as J,n as z,q as b,u as Q,w as a,x as Z}from"./chunk-6YYYESPH.mjs";var Le=100,$e={left:t=>`translateX(-${t}px)`,right:t=>`translateX(${t}px)`,top:t=>`translateY(-${t}px)`,bottom:t=>`translateY(${t}px)`};function _(t){let{slots:v=[],gap:x,padding:de,paddingPerSide:pe,paddingTop:ue,paddingRight:ce,paddingBottom:fe,paddingLeft:he,speed:M,hoverFactor:E,direction:u,alignment:ge,sizingOptions:me,fadeOptions:ye,style:be}=t,{fadeContent:H,overflow:xe,fadeWidth:N,fadeInset:P,fadeAlpha:j}=ye,{widthType:V,heightType:L}=me,Te=pe?`${ue}px ${ce}px ${fe}px ${he}px`:`${de}px`,D=I.current(),s=D===I.canvas||D===I.export,T=v.filter(Boolean),$=w.count(T),S=$>0;u===!0&&(u="left");let m=u==="left"||u==="right",Se=te(0),C=$e[u],Be=ne(Se,C),f=a(null),o=Q(()=>[{current:null},{current:null}],[]),[c,Ce]=Z({parent:null,children:null}),F=null,R=[],y=0,W=0;s&&(y=$?Math.floor(10/$):0,W=1),!s&&S&&c.parent&&(y=Math.round(c.parent/c.children*2)+1,y=Math.min(y,Le),W=1);let X=z(()=>{if(S&&f.current){let e=m?f.current.offsetWidth:f.current.offsetHeight,n=o[0].current?m?o[0].current.offsetLeft:o[0].current.offsetTop:0,g=(o[1].current?m?o[1].current.offsetLeft+o[1].current.offsetWidth:o[1].current.offsetTop+o[1].current.offsetHeight:0)-n+x;J(()=>Ce({parent:e,children:g}))}},[]),Y=s?{contentVisibility:"auto"}:{};if(S){if(!s){let e=a(!0);b(()=>(B.read(X),ae(f.current,({contentSize:n})=>{!e.current&&(n.width||n.height)&&B.read(X),e.current=!1})),[])}F=w.map(T,(e,n)=>{let p;n===0&&(p=o[0]),n===T.length-1&&(p=o[1]);let g={width:V?e.props?.width:"100%",height:L?e.props?.height:"100%"};return l(O,{inherit:"id",children:l("li",{ref:p,style:g,children:k(e,{style:{...e.props?.style,...g,flexShrink:0,...Y},layoutId:e.props.layoutId?e.props.layoutId+"-original-"+n:void 0},e.props?.children)})})})}let h=s?!0:re(f);if(!s)for(let e=0;e{let g={width:V?n.props?.width:"100%",height:L?n.props?.height:"100%",willChange:h?"transform":void 0};return l(O,{inherit:"id",children:l("li",{style:g,"aria-hidden":!0,children:k(n,{key:e+" "+p,style:{...n.props?.style,width:V?n.props?.width:"100%",height:L?n.props?.height:"100%",flexShrink:0,...Y},layoutId:n.props.layoutId?n.props.layoutId+"-dupe-"+e:void 0},n.props?.children)},e+"li"+p)},e+"lg"+p)}));let d=c.children+c.children*Math.round(c.parent/c.children),Oe=a(null),_e=a(null),Ee=a(0),G=a(!1),we=ie(),K=a(null),r=a(null);if(!s){b(()=>{if(!(we||!d||!M))return r.current=K.current.animate({transform:[C(0),C(d)]},{duration:Math.abs(d)/M*1e3,iterations:1/0,easing:"linear"}),()=>r.current.cancel()},[E,d,M]);let e=z(()=>{if(!r.current)return;let n=document.hidden;h&&!n&&r.current.playState==="paused"?r.current.play():(!h||n)&&r.current.playState==="running"&&r.current.pause()},[h]);b(()=>{e()},[h]),b(()=>(document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}),[e])}let Ie=m?"to right":"to bottom",U=N/2,ve=100-N/2,Me=Ae(P,0,U),Ve=100-P,q=`linear-gradient(${Ie}, rgba(0, 0, 0, ${j}) ${Me}%, rgba(0, 0, 0, 1) ${U}%, rgba(0, 0, 0, 1) ${ve}%, rgba(0, 0, 0, ${j}) ${Ve}%)`;return S?l("section",{style:{...le,opacity:W,WebkitMaskImage:H?q:void 0,maskImage:H?q:void 0,overflow:xe?"visible":"hidden",padding:Te},ref:f,children:A(ee.ul,{ref:K,style:{...le,gap:x,top:u==="bottom"&&se(d)?-d:void 0,left:u==="right"&&se(d)?-d:void 0,placeItems:ge,position:"relative",flexDirection:m?"row":"column",...be,willChange:s||!h?"auto":"transform",transform:C(0)},onMouseEnter:()=>{G.current=!0,r.current&&(r.current.playbackRate=E)},onMouseLeave:()=>{G.current=!1,r.current&&(r.current.playbackRate=1)},children:[F,R]})}):A("section",{style:Re,children:[l("div",{style:We,children:"\u2728"}),l("p",{style:ke,children:"Connect to Content"}),l("p",{style:ze,children:"Add layers or components to infinitely loop on your page."})]})}_.defaultProps={gap:10,padding:10,sizingOptions:{widthType:!0,heightType:!0},fadeOptions:{fadeContent:!0,overflow:!1,fadeWidth:25,fadeAlpha:0,fadeInset:0},direction:!0};oe(_,{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 le={display:"flex",width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",placeItems:"center",margin:0,padding:0,listStyleType:"none",textIndent:"none"},Re={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"},We={fontSize:32,marginBottom:10},ke={margin:0,marginBottom:10,fontWeight:600,textAlign:"center"},ze={margin:0,opacity:.7,maxWidth:150,lineHeight:1.5,textAlign:"center"},Ae=(t,v,x)=>Math.min(Math.max(t,v),x),se=t=>typeof t=="number"&&!isNaN(t);export{_ as a}; //# sourceMappingURL=chunk-R47GFOXL.mjs.map