class LiquidMagneticMouseBehavior extends LiquidBehavior{static behaviorName="liquidMagneticMouse";static docEvents={mousemove:"onDocMouseMove"};static domEvents={"mousemove @items":"onItemMouseMove","mouseleave @items":"onItemMouseLeave"};magneticCoords={x:0,y:0};clientX=0;clientY=0;currentElement=null;currentElementRect=null;currentDist=null;currentAngle=null;currentHypotenuse=null;options(){return{movingElement:"> a"}}get ui(){return{items:"li"}}initialize(){const t={x:window.innerWidth/2,y:window.innerHeight/2};gsap.ticker.add(()=>{const i=1-Math.pow(.6,gsap.ticker.deltaRatio());t.x+=(this.clientX-t.x)*i,t.y+=(this.clientY-t.y)*i,this.elementQuickTo()})}elementQuickTo(){const t=this.getOption("movingElement"),i=t.startsWith(">")?`:scope ${t}`:t;let e;this.lastActiveitem&&(e=this.lastActiveitem.querySelector(i),e&&(gsap.killTweensOf(e),gsap.to(e,{x:"",y:"",transition:"",duration:.2,ease:"power3.out"}))),!(!this.currentElement||!this.magneticCoords)&&(e=this.currentElement.querySelector(i),e&&(gsap.killTweensOf(e),gsap.set(e,{transition:"none"}),gsap.quickTo(e,"x")(-(Math.sin(this.currentAngle)*this.currentHypotenuse)/5),gsap.quickTo(e,"y")(-(Math.cos(this.currentAngle)*this.currentHypotenuse)/5)))}onDocMouseMove(t){this.clientX=t.clientX,this.clientY=t.clientY}onItemMouseMove(t){this.currentElement=t.currentTarget,this.currentElementRect||(this.currentElementRect=this.currentElement.getBoundingClientRect()),this.currentDist={x:this.currentElementRect.x+this.currentElementRect.width/2-this.clientX,y:this.currentElementRect.y+this.currentElementRect.height/2-this.clientY},this.currentAngle=Math.atan2(this.currentDist.x,this.currentDist.y),this.currentHypotenuse=Math.sqrt(this.currentDist.x*this.currentDist.x+this.currentDist.y*this.currentDist.y),this.magneticCoords={x:this.currentElementRect.x+this.currentElementRect.width/2-Math.sin(this.currentAngle)*this.currentHypotenuse/3,y:this.currentElementRect.y+this.currentElementRect.height/2-Math.cos(this.currentAngle)*this.currentHypotenuse/3}}onItemMouseLeave(t){this.currentElement&&(this.lastActiveitem=this.currentElement,this.currentElement=null,this.currentElementRect=null,this.currentDist=null,this.currentAngle=null,this.currentHypotenuse=null)}}typeof window<"u"&&(window.liquid?.app?window.liquid?.app?.model?.set("loadedBehaviors",[...window.liquid.app.model.get("loadedBehaviors"),LiquidMagneticMouseBehavior]):window.liquid?.loadedBehaviors?.push(LiquidMagneticMouseBehavior));
