import{k as t,u as s,o as i,p as n}from"./p-Ba5qjFjW.js";import{L as e,a}from"./p-C20cwFWy.js";class c extends e{constructor(){super(...arguments),this.debouncedNotify=t((t=>this.notify({target:t})),42),this.callbackWillAnimate=t=>{s(t,this.el,(t=>this.debouncedNotify(t)))},this.callbackDidAnimate=t=>{s(t,this.el,(t=>this.debouncedNotify(t)))}}connect(t){super.connect(t);const s=window;s&&(i(s,"balWillAnimate",this.callbackWillAnimate,{passive:!0}),i(s,"balDidAnimate",this.callbackDidAnimate,{passive:!0}))}disconnect(){super.disconnect();const t=window;t&&(n(t,"balWillAnimate",this.callbackWillAnimate),n(t,"balDidAnimate",this.callbackDidAnimate))}}class h extends a{constructor(){super(((t,s)=>{t.animationListener(s)})),this.listener=new c}attach(t){super.attach(t),this.listener.connect(t.el),this.listener.add((t=>super.notify(t)))}detach(){super.detach(),this.listener.disconnect()}}function o(){return function(t){const{connectedCallback:s,componentDidLoad:i,disconnectedCallback:n}=t;t.connectedCallback=function(){return this._balAnimationSubject||(this._balAnimationSubject=new h),s&&s.call(this)},t.componentDidLoad=function(){return this._balAnimationSubject.attach(this),i&&i.call(this)},t.disconnectedCallback=function(){return this._balAnimationSubject&&(this._balAnimationSubject.detach(),this._balAnimationSubject=void 0),n&&n.call(this)}}}new h;export{o as L}