import{__extends}from"tslib";import{B as BalWindowResizeListener}from"./breakpoints.subject-C32mP6rF.js";import{a as SingleSubject}from"./listener-CClDIhvK.js";import{b as balBrowser}from"./browser-B1u-Mq75.js";var BalWindowResizeSubject=function(i){__extends(t,i);function t(){var t=i.call(this,(function(i,t){i.windowResizeListener()}))||this;t.listener=new BalWindowResizeListener;return t}t.prototype.attach=function(t){var e=this;i.prototype.attach.call(this,t);if(balBrowser.hasWindow){this.listener.connect(window);this.listener.add((function(){return i.prototype.notify.call(e)}))}};t.prototype.detach=function(){i.prototype.detach.call(this);this.listener.disconnect()};return t}(SingleSubject);new BalWindowResizeSubject;function ListenToWindowResize(){return function(i,t,e){var n=i.connectedCallback,s=i.disconnectedCallback;i.connectedCallback=function(){if(!this._balWindowResizeSubject){this._balWindowResizeSubject=new BalWindowResizeSubject;this._balWindowResizeSubject.attach(this)}return n&&n.call(this)};i.disconnectedCallback=function(){if(this._balWindowResizeSubject){this._balWindowResizeSubject.detach();this._balWindowResizeSubject=undefined}return s&&s.call(this)}}}export{ListenToWindowResize as L};