var __extends=this&&this.__extends||function(){var t=function(n,i){t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i))t[i]=n[i]};return t(n,i)};return function(n,i){if(typeof i!=="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");t(n,i);function e(){this.constructor=n}n.prototype=i===null?Object.create(i):(e.prototype=i.prototype,new e)}}();System.register(["./p-273325c7.system.js","./p-6722281a.system.js"],(function(t){"use strict";var n,i,e;return{setters:[function(t){n=t.L;i=t.a},function(t){e=t.b}],execute:function(){t("L",u);var s=function(t){__extends(n,t);function n(){var i=t.apply(this,arguments)||this;i.state=n.DefaultState;i.onMouseEnter=function(){i.updateState({hovered:true})};i.onMouseLeave=function(){i.updateState({hovered:false})};i.onPointerDown=function(){i.updateState({pressed:true})};i.onPointerUp=function(){i.updateState({pressed:false})};return i}n.prototype.connect=function(i){t.prototype.connect.call(this,i);i.addEventListener("mouseenter",this.onMouseEnter,n.EventListenerOptions);i.addEventListener("mouseleave",this.onMouseLeave,n.EventListenerOptions);i.addEventListener("pointerdown",this.onPointerDown,n.EventListenerOptions);if(e.hasDocument){document.addEventListener("pointerup",this.onPointerUp,n.EventListenerOptions)}};n.prototype.disconnect=function(){t.prototype.disconnect.call(this);if(this.el){this.el.removeEventListener("mouseenter",this.onMouseEnter);this.el.removeEventListener("mouseleave",this.onMouseLeave);this.el.removeEventListener("pointerdown",this.onPointerDown);if(e.hasDocument){document.removeEventListener("pointerup",this.onPointerUp)}}};n.prototype.updateState=function(t){this.state=Object.assign(Object.assign({},this.state),t);this.notify(this.state)};return n}(n);t("B",s);s.EventListenerOptions={passive:true};s.DefaultState={hovered:false,pressed:false};var r=function(t){__extends(n,t);function n(){var n=t.call(this,(function(t,n){if(n){t.elementStateListener(n)}}))||this;n.listener=new s;return n}n.prototype.attach=function(n){var i=this;t.prototype.attach.call(this,n);this.listener.connect(n.el);this.listener.add((function(n){return t.prototype.notify.call(i,n)}))};n.prototype.detach=function(){t.prototype.detach.call(this);this.listener.disconnect()};return n}(i);function u(){return function(t,n,i){var e=t.connectedCallback,s=t.disconnectedCallback;t.connectedCallback=function(){this._balElementStateSubject=new r;this._balElementStateSubject.attach(this);return e&&e.call(this)};t.disconnectedCallback=function(){this._balElementStateSubject.detach();return s&&s.call(this)}}}}}}));