{"version":3,"sources":["jsdelivr-header.js","/npm/puix@0.7.13/dist/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA;AACA;AACA","file":"/npm/puix@0.7.13/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/puix@0.7.13/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","class EventDispatcher{constructor(){this.listeners=new Map,this._name=\"\"}dispatchEvent(t){const e=this.listeners.get(t.type);if(void 0!==e)for(const i of e)i(t);return!0}dispatchCustomEvent(t,e=void 0){const i=this.listeners.get(t);if(void 0!==i){const s=new CustomEvent(t,{detail:e});for(const t of i)t(s)}}addEventListener(t,e){let i=this.listeners.get(t);void 0===i&&(i=[],this.listeners.set(t,i)),i.push(e)}removeEventListener(t,e){const i=this.listeners.get(t);if(void 0!==i)for(const t of i)if(t===e){const t=i.indexOf(e);i.splice(t,1);break}}set name(t){this._name!==t&&(this._name=t)}get name(){return this._name}}class AttributeTween extends EventDispatcher{constructor(t,e,i){super(),this.value=0,this.startValue=0,this.currentValue=0,this.difference=0,this.start=0,this.requestId=NaN,this.progress=0,this.name=\"AttributeTween\",this.target=t,this.attribute=e,this.duration=i,this.animationFrame=this.animationFrame.bind(this)}to(t,e){isNaN(this.requestId)||cancelAnimationFrame(this.requestId),isNaN(e)||(this.duration=e);const i=this.target.getAttribute(this.attribute);this.currentValue=this.startValue=i?parseFloat(i):0,this.value=t,this.difference=t-this.currentValue,this.start=performance.now(),this.requestId=requestAnimationFrame(this.animationFrame)}animationFrame(t){this.progress=Math.abs(t-this.start)/this.duration,this.progress<1?(this.currentValue=this.difference*this.progress+this.startValue,this.requestId=requestAnimationFrame(this.animationFrame)):(this.currentValue=this.startValue=this.value,this.requestId=NaN),this.target.setAttribute(this.attribute,this.currentValue.toString())}}class StyleTween extends EventDispatcher{constructor(t,e,i){super(),this.value=0,this.startValue=0,this.currentValue=0,this.difference=0,this.start=0,this.requestId=NaN,this.progress=0,this.name=\"StyleTween\",this.target=t,this.style=e,this.duration=i,this.animationFrame=this.animationFrame.bind(this)}to(t,e){isNaN(this.requestId)||cancelAnimationFrame(this.requestId),isNaN(e)||(this.duration=e);const i=this.target.style.getPropertyValue(this.style);this.currentValue=this.startValue=i?parseFloat(i):0,this.value=t,this.difference=t-this.currentValue,this.start=performance.now(),this.requestId=requestAnimationFrame(this.animationFrame)}animationFrame(t){this.progress=Math.abs(t-this.start)/this.duration,this.progress<1?(this.currentValue=this.difference*this.progress+this.startValue,this.requestId=requestAnimationFrame(this.animationFrame)):(this.currentValue=this.startValue=this.value,this.requestId=NaN),this.target.style.setProperty(this.style,this.currentValue.toString())}}class EventDispatcherElement extends HTMLElement{constructor(){super(),this._name=\"\"}dispatchCustomEvent(t,e=void 0,i=!1){const s=new CustomEvent(t,{bubbles:i,detail:e});this.dispatchEvent(s)}set name(t){this._name!==t&&(this._name=t)}get name(){return this._name}}customElements.define(\"event-dispatcher-element\",EventDispatcherElement);class LifeCycleElement extends EventDispatcherElement{constructor(){super(),this._connected=!1,this.name=\"LifeCycleElement\"}connectedCallback(){this.connected=!0}disconnectedCallback(){this.connected=!1}set connected(t){this._connected=t}get connected(){return this._connected}}customElements.define(\"lifecycle-element\",LifeCycleElement);class PositionElement extends LifeCycleElement{constructor(){super(),this._x=0,this._y=0,this.name=\"PositionElement\",this.style.position=\"absolute\"}setPosition(t,e){this.x=t,this.y=e}set x(t){isNaN(t)&&0!==this._x&&(this._x=0,this.updateTransform()),this._x!==t&&(this._x=t,this.updateTransform())}get x(){return this._x}set y(t){isNaN(t)&&0!==this._y&&(this._y=0,this.updateTransform()),this._y!==t&&(this._y=t,this.updateTransform())}get y(){return this._y}updateTransform(){this.style.transform=\"translate(\"+this.x+\"px, \"+this.y+\"px)\"}}customElements.define(\"position-element\",PositionElement);class SizeElement extends PositionElement{constructor(){super(),this._minWidth=0,this._actualWidth=0,this._width=NaN,this._maxWidth=1/0,this._minHeight=0,this._actualHeight=0,this._height=NaN,this._maxHeight=1/0,this.name=\"SizeElement\"}connectedCallback(){super.connectedCallback(),this.updateDisplay()}invalidateDisplay(){this.connected&&this.updateDisplay()}updateDisplay(){}setSize(t,e){if(!(isNaN(this._width)&&isNaN(t)&&isNaN(this._height)&&isNaN(e)||this._width===t&&this._height===e)){if(isNaN(t)&&isNaN(e))return this._width=NaN,this._height=NaN,this._actualWidth=0,this._actualHeight=0,this.style.width=this._actualWidth+\"px\",this.style.height=this._actualHeight+\"px\",void this.invalidateDisplay();if(!isNaN(t)&&isNaN(e))return this._width=this._actualWidth=this.getValidMinMaxWidth(t),this._height=NaN,this.style.width=this._actualWidth+\"px\",void this.invalidateDisplay();if(isNaN(t)&&!isNaN(e))return this._height=this._actualHeight=this.getValidMinMaxHeight(e),this._width=NaN,this.style.height=this._actualHeight+\"px\",void this.invalidateDisplay();this._width=this._actualWidth=this.getValidMinMaxWidth(t),this._height=this._actualHeight=this.getValidMinMaxHeight(e),this.style.width=this._actualWidth+\"px\",this.style.height=this._actualHeight+\"px\",this.invalidateDisplay()}}getValidMinMaxWidth(t){return t<this.minWidth?this.minWidth:t>this.maxWidth?this.maxWidth:t}getValidMinMaxHeight(t){return t<this.minHeight?this.minHeight:t>this.maxHeight?this.maxHeight:t}setActualSize(t,e){if((isNaN(this.width)||isNaN(this.height))&&(this._actualWidth!==t||this._actualHeight!==e)){if(isNaN(t)&&isNaN(e))return this._actualWidth=this.minWidth,this._actualHeight=this.minHeight,this.style.width=this._actualWidth+\"px\",this.style.height=this._actualHeight+\"px\",void this.invalidateDisplay();if(!isNaN(t)&&isNaN(e))return this._actualWidth=this.getValidMinMaxWidth(t),this._actualHeight=this.minHeight,this.style.width=this._actualWidth+\"px\",this.style.height=this._actualHeight+\"px\",void this.invalidateDisplay();if(isNaN(t)&&!isNaN(e))return this._actualWidth=this.minWidth,this._actualHeight=this.getValidMinMaxHeight(e),this.style.width=this._actualWidth+\"px\",this.style.height=this._actualHeight+\"px\",void this.invalidateDisplay();this._actualWidth=this.getValidMinMaxWidth(t),this._actualHeight=this.getValidMinMaxHeight(e),this.style.width=this._actualWidth+\"px\",this.style.height=this._actualHeight+\"px\",this.invalidateDisplay()}}set minWidth(t){if(isNaN(t))return this._minWidth=0,void this.invalidateDisplay();this._minWidth!==t&&(this._minWidth=t<0?0:t,isNaN(this.width)||this.width<this._minWidth&&(this._width=this._minWidth),this.actualWidth<this._minWidth&&(this._actualWidth=this._minWidth,this.style.width=this._actualWidth+\"px\"),this.invalidateDisplay())}get minWidth(){return this._minWidth}set actualWidth(t){if(!isNaN(this.width))return;if(this._actualWidth===t)return;if(isNaN(t))return this._actualWidth=this.minWidth,this.style.width=this._actualWidth+\"px\",void this.invalidateDisplay();const e=this.getValidMinMaxWidth(t);this._actualWidth!==e&&(this._actualWidth=e,this.style.width=this._actualWidth+\"px\",this.invalidateDisplay())}get actualWidth(){return this._actualWidth}set width(t){if(isNaN(this._width)&&isNaN(t))return;if(this._width===t)return;if(isNaN(t))return this._width=t,void this.invalidateDisplay();const e=this.getValidMinMaxWidth(t);this._width!==e&&(this._width=this._actualWidth=e,this.style.width=this._actualWidth+\"px\",this.invalidateDisplay())}get width(){return this._width}set maxWidth(t){if(isNaN(t))return this._maxWidth=1/0,void this.invalidateDisplay();this._maxWidth!==t&&(this._maxWidth=t<0?0:t,isNaN(this.width)||this.width>this._maxWidth&&(this._width=this._maxWidth),this.actualWidth>this._maxWidth&&(this._actualWidth=this._maxWidth,this.style.width=this._actualWidth+\"px\"),this.invalidateDisplay())}get maxWidth(){return this._maxWidth}set minHeight(t){if(isNaN(t))return this._minHeight=0,void this.invalidateDisplay();this._minHeight!==t&&(this._minHeight=t<0?0:t,isNaN(this.height)||this.height<this._minHeight&&(this._height=this._minHeight),this.actualHeight<this._minHeight&&(this._actualHeight=this._minHeight,this.style.height=this._actualHeight+\"px\"),this.invalidateDisplay())}get minHeight(){return this._minHeight}set actualHeight(t){if(!isNaN(this.height))return;if(this._actualHeight===t)return;if(isNaN(t))return this._actualHeight=this.minHeight,this.style.height=this._actualHeight+\"px\",void this.invalidateDisplay();const e=this.getValidMinMaxHeight(t);this._actualHeight!==e&&(this._actualHeight=e,this.style.height=this._actualHeight+\"px\",this.invalidateDisplay())}get actualHeight(){return this._actualHeight}set height(t){if(isNaN(this._height)&&isNaN(t))return;if(this._height===t)return;if(isNaN(t))return this._height=t,void this.invalidateDisplay();const e=this.getValidMinMaxHeight(t);this._height!==e&&(this._height=this._actualHeight=e,this.style.height=this._actualHeight+\"px\",this.invalidateDisplay())}get height(){return this._height}set maxHeight(t){if(isNaN(t))return this._maxHeight=1/0,void this.invalidateDisplay();this._maxHeight!==t&&(this._maxHeight=t<0?0:t,isNaN(this.height)||this.height>this._maxHeight&&(this._height=this._maxHeight),this.actualHeight>this._maxHeight&&(this._actualHeight=this._maxHeight,this.style.height=this._actualHeight+\"px\"),this.invalidateDisplay())}get maxHeight(){return this._maxHeight}hasExplicitSize(t){return this.hasExplicitWidth(t)&&this.hasExplicitHeight(t)}hasExplicitWidth(t){if(!isNaN(t.width))return!0;if(!isNaN(t.percentWidth))return!0;if(!isNaN(t.left)&&!isNaN(t.right))return!0;return 4===t.parentNode.horizontalAlign}hasExplicitHeight(t){if(!isNaN(t.height))return!0;if(!isNaN(t.percentHeight))return!0;if(!isNaN(t.top)&&!isNaN(t.bottom))return!0;return 4===t.parentNode.verticalAlign}}customElements.define(\"size-element\",SizeElement);class LayoutElement extends SizeElement{constructor(){super(),this._top=NaN,this._right=NaN,this._bottom=NaN,this._left=NaN,this._horizontalCenter=NaN,this._verticalCenter=NaN,this._percentWidth=NaN,this._percentHeight=NaN,this.name=\"LayoutElement\"}set top(t){isNaN(this._top)&&isNaN(t)||this._top!==t&&(this._top=t,this.notifyLayoutDataChanged())}get top(){return this._top}set right(t){isNaN(this._right)&&isNaN(t)||this._right!==t&&(this._right=t,this.notifyLayoutDataChanged())}get right(){return this._right}set bottom(t){isNaN(this._bottom)&&isNaN(t)||this._bottom!==t&&(this._bottom=t,this.notifyLayoutDataChanged())}get bottom(){return this._bottom}set left(t){isNaN(this._left)&&isNaN(t)||this._left!==t&&(this._left=t,this.notifyLayoutDataChanged())}get left(){return this._left}set horizontalCenter(t){isNaN(this._horizontalCenter)&&isNaN(t)||this._horizontalCenter!==t&&(this._horizontalCenter=t,this.notifyLayoutDataChanged())}get horizontalCenter(){return this._horizontalCenter}set verticalCenter(t){isNaN(this._verticalCenter)&&isNaN(t)||this._verticalCenter!==t&&(this._verticalCenter=t,this.notifyLayoutDataChanged())}get verticalCenter(){return this._verticalCenter}notifyLayoutDataChanged(){this.connected&&this.dispatchEvent(new Event(\"c\",{bubbles:!0}))}set percentWidth(t){if(!(isNaN(this._percentWidth)&&isNaN(t)||this._percentWidth===t))return isNaN(t)?(this._percentWidth=t,void this.notifyLayoutDataChanged()):void(t<0?0!==this._percentWidth&&(this._percentWidth=0,this.notifyLayoutDataChanged()):(this._percentWidth=t,this.notifyLayoutDataChanged()))}get percentWidth(){return this._percentWidth}set percentHeight(t){if(!(isNaN(this._percentHeight)&&isNaN(t)||this._percentHeight===t))return isNaN(t)?(this._percentHeight=t,void this.notifyLayoutDataChanged()):void(t<0?0!==this._percentHeight&&(this._percentHeight=0,this.notifyLayoutDataChanged()):(this._percentHeight=t,this.notifyLayoutDataChanged()))}get percentHeight(){return this._percentHeight}}customElements.define(\"layout-element\",LayoutElement);class DisplayElement extends LayoutElement{constructor(){super(),this._opacity=1,this._enabled=!0,this._overflow=\"visible\",this._overflowX=\"visible\",this._overflowY=\"visible\",this._cornerRadius=0,this._cursor=\"\",this._shadow=\"\",this._backgroundColor=\"\",this.name=\"DisplayElement\",this.style.border=\"none\",this.style.outline=\"none\"}set opacity(t){this._opacity!==t&&(isNaN(t)||t>1?this._opacity=1:this._opacity=t<0?0:t,this.style.opacity=this._opacity.toString())}get opacity(){return this._opacity}set enabled(t){this._enabled!==t&&(this._enabled=t,t?(this.style.pointerEvents=\"\",this.style.userSelect=\"auto\"):(this.style.pointerEvents=\"none\",this.style.userSelect=\"none\"))}get enabled(){return this._enabled}set overflow(t){this._overflow!==t&&(this._overflow=t,this.style.overflow=t)}get overflow(){return this._overflow}set overflowX(t){this._overflowX!==t&&(this._overflowX=t,this.style.overflowX=t)}get overflowX(){return this._overflowX}set overflowY(t){this._overflowY!==t&&(this._overflowY=t,this.style.overflowY=t)}get overflowY(){return this._overflowY}set cornerRadius(t){if(this._cornerRadius!==t){if(isNaN(t)||t<0)return this._cornerRadius=0,void(this.style.borderRadius=\"0\");this._cornerRadius=t,this.style.borderRadius=t+\"px\"}}get cornerRadius(){return this._cornerRadius}set cursor(t){this._cursor!==t&&(this._cursor=t,this.style.cursor=t)}get cursor(){return this._cursor}set shadow(t){this._shadow!==t&&(this._shadow=t,this.style.boxShadow=t)}get shadow(){return this._shadow}set backgroundColor(t){this._backgroundColor!==t&&(this._backgroundColor=t,this.style.backgroundColor=t)}get backgroundColor(){return this._backgroundColor}}customElements.define(\"display-element\",DisplayElement);class BaseLayout{updateLayout(t,e){if(this.hasExplicitSize(t))return void this.resizeAndLayoutElements(t,e);const i=this.hasExplicitWidth(t),s=this.hasExplicitHeight(t);return i||s?!i&&s?(this.setInternalWidth(t,e),void this.resizeAndLayoutElements(t,e)):(this.setInternalHeight(t,e),void this.resizeAndLayoutElements(t,e)):(this.setInternalSize(t,e),void this.resizeAndLayoutElements(t,e))}resizeAndLayoutElements(t,e){this.resizeElements(t,e),this.layoutElements(t,e)}hasExplicitSize(t){return this.hasExplicitWidth(t)&&this.hasExplicitHeight(t)}hasExplicitWidth(t){if(!isNaN(t.width))return!0;if(!isNaN(t.percentWidth))return!0;if(!isNaN(t.left)&&!isNaN(t.right))return!0;return 4===t.parentNode.horizontalAlign}hasExplicitHeight(t){if(!isNaN(t.height))return!0;if(!isNaN(t.percentHeight))return!0;if(!isNaN(t.top)&&!isNaN(t.bottom))return!0;return 4===t.parentNode.verticalAlign}setInternalSize(t,e){}setInternalWidth(t,e){}setInternalHeight(t,e){}resizeElements(t,e){}layoutElements(t,e){}}class AnchorLayout extends BaseLayout{setInternalSize(t,e){super.setInternalSize(t,e);let i=0,s=0;for(const t of e)i<t.actualWidth&&(i=t.actualWidth),s<t.actualHeight&&(s=t.actualHeight);i=t.paddingLeft+i+t.paddingRight,s=t.paddingTop+s+t.paddingBottom,t.actualWidth===i&&t.actualHeight===s||(t.setActualSize(i,s),t.dispatchEvent(new Event(\"a\",{bubbles:!0})))}resizeElements(t,e){super.resizeElements(t,e);const i=t.actualWidth-t.paddingLeft-t.paddingRight,s=t.actualHeight-t.paddingTop-t.paddingBottom;for(const t of e)isNaN(t.percentWidth)||isNaN(t.percentHeight)?!isNaN(t.percentWidth)&&isNaN(t.percentHeight)?t.actualWidth=i*t.percentWidth/100:isNaN(t.percentWidth)&&!isNaN(t.percentHeight)&&(t.actualHeight=s*t.percentHeight/100):t.setActualSize(i*t.percentWidth/100,s*t.percentHeight/100),isNaN(t.left)||isNaN(t.right)||isNaN(t.top)||isNaN(t.bottom)?isNaN(t.left)||isNaN(t.right)?isNaN(t.top)||isNaN(t.bottom)||(t.actualHeight=s-t.top-t.bottom):t.actualWidth=i-t.left-t.right:t.setActualSize(i-t.left-t.right,s-t.top-t.bottom)}layoutElements(t,e){super.layoutElements(t,e);const i=t.actualWidth-t.paddingLeft-t.paddingRight,s=t.actualHeight-t.paddingTop-t.paddingBottom;for(const a of e)isNaN(a.left)||isNaN(a.right)?isNaN(a.left)&&!isNaN(a.right)?a.x=t.actualWidth-t.paddingRight-a.right-a.actualWidth:!isNaN(a.left)&&isNaN(a.right)?a.x=t.paddingLeft+a.left:a.x=t.paddingLeft:a.x=t.paddingLeft+.5*i-.5*a.actualWidth-(a.left-a.right),isNaN(a.top)||isNaN(a.bottom)?isNaN(a.top)&&!isNaN(a.bottom)?a.y=t.actualHeight-t.paddingBottom-a.bottom-a.actualHeight:!isNaN(a.top)&&isNaN(a.bottom)?a.y=t.paddingTop+a.top:a.y=t.paddingTop:a.y=t.paddingTop+.5*s-.5*a.actualHeight-(a.top-a.bottom),isNaN(a.horizontalCenter)||(a.x=.5*t.actualWidth-.5*a.actualWidth+a.horizontalCenter),isNaN(a.verticalCenter)||(a.y=.5*t.actualHeight-.5*a.actualHeight+a.verticalCenter)}setInternalWidth(t,e){super.setInternalWidth(t,e);let i=0;for(const t of e)i<t.actualWidth&&(i=t.actualWidth);i=t.paddingLeft+i+t.paddingRight,t.actualWidth!==i&&(t.actualWidth=i,t.dispatchEvent(new Event(\"a\",{bubbles:!0})))}setInternalHeight(t,e){super.setInternalHeight(t,e);let i=0;for(const t of e)i<t.actualHeight&&(i=t.actualHeight);i=t.paddingTop+i+t.paddingBottom,t.actualHeight!==i&&(t.actualHeight=i,t.dispatchEvent(new Event(\"a\",{bubbles:!0})))}}class VerticalLayout extends BaseLayout{setInternalSize(t,e){let i=0,s=0;for(const a of e)i<a.actualWidth&&(i=a.actualWidth),s+=a.actualHeight+t.verticalGap;i=t.paddingLeft+i+t.paddingRight,s=t.paddingTop+s-t.verticalGap+t.paddingBottom,t.actualWidth===i&&t.actualHeight===s||(t.setActualSize(i,s),t.dispatchEvent(new Event(\"a\",{bubbles:!0})))}setInternalWidth(t,e){let i=0;for(const t of e)i<t.actualWidth&&(i=t.actualWidth);i=t.paddingLeft+i+t.paddingRight,t.actualWidth!==i&&(t.actualWidth=i,t.dispatchEvent(new Event(\"a\",{bubbles:!0})))}setInternalHeight(t,e){let i=0;for(const s of e)i+=s.actualHeight+t.verticalGap;i=t.paddingTop+i-t.verticalGap+t.paddingBottom,t.actualHeight!==i&&(t.actualHeight=i,t.dispatchEvent(new Event(\"a\",{bubbles:!0})))}resizeElements(t,e){let i=0,s=0;for(const t of e)isNaN(t.percentHeight)?i+=t.actualHeight:s+=t.percentHeight;const a=t.actualWidth-t.paddingLeft-t.paddingRight,h=t.actualHeight-t.paddingTop-t.paddingBottom-i-t.verticalGap*(e.length-1);let n;n=s>100?h/s:h/100;for(const i of e)isNaN(i.percentWidth)?4===t.horizontalAlign&&(i.actualWidth=a):i.percentWidth>100?i.actualWidth=a:i.actualWidth=a*i.percentWidth/100,isNaN(i.percentHeight)||(i.actualHeight=n*i.percentHeight)}layoutElements(t,e){1!==t.horizontalAlign?3!==t.horizontalAlign?this.layoutElementsCenter(t,e):this.layoutElementsRight(t,e):this.layoutElementsLeft(t,e)}getVerticalYStartValue(t,e){let i=t.paddingTop;if(2===t.verticalAlign||3===t.verticalAlign){const s=t.actualHeight-t.paddingTop-t.paddingBottom;let a=0;for(const t of e)a+=t.actualHeight;const h=t.verticalGap*(e.length-1);2===t.verticalAlign?i+=.5*(s-a-h):i+=s-a-h}return i}layoutElementsLeft(t,e){let i=this.getVerticalYStartValue(t,e);for(const s of e)s.setPosition(t.paddingLeft,i),i+=s.actualHeight+t.verticalGap}layoutElementsCenter(t,e){let i=0,s=this.getVerticalYStartValue(t,e);for(const a of e)i=.5*t.actualWidth-.5*a.actualWidth,a.setPosition(i,s),s+=a.actualHeight+t.verticalGap}layoutElementsRight(t,e){let i=0,s=this.getVerticalYStartValue(t,e);for(const a of e)i=t.actualWidth-t.paddingRight-a.actualWidth,a.setPosition(i,s),s+=a.actualHeight+t.verticalGap}}class HorizontalLayout extends BaseLayout{setInternalSize(t,e){let i=0,s=0;for(const a of e)s<a.actualHeight&&(s=a.actualHeight),i+=a.actualWidth+t.horizontalGap;i=t.paddingLeft+i-t.horizontalGap+t.paddingRight,s=t.paddingTop+s+t.paddingBottom,t.actualWidth===i&&t.actualHeight===s||(t.setActualSize(i,s),t.dispatchEvent(new Event(\"a\",{bubbles:!0})))}setInternalWidth(t,e){let i=0;for(const s of e)i+=s.actualWidth+t.horizontalGap;i=t.paddingLeft+i-t.horizontalGap+t.paddingRight,t.actualWidth!==i&&(t.actualWidth=i,t.dispatchEvent(new Event(\"a\",{bubbles:!0})))}setInternalHeight(t,e){let i=0;for(const t of e)i<t.actualHeight&&(i=t.actualHeight);i=t.paddingTop+i+t.paddingBottom,t.actualHeight!==i&&(t.actualHeight=i,t.dispatchEvent(new Event(\"a\",{bubbles:!0})))}resizeElements(t,e){let i=0,s=0;for(const t of e)isNaN(t.percentWidth)?i+=t.actualWidth:s+=t.percentWidth;const a=t.actualWidth-t.paddingLeft-t.paddingRight,h=t.actualHeight-t.paddingTop-t.paddingBottom,n=a-i-t.horizontalGap*(e.length-1);let r;r=s>100?n/s:n/100;for(const i of e)isNaN(i.percentHeight)?4===t.verticalAlign&&(i.actualHeight=h):i.percentHeight>100?i.actualHeight=h:i.actualHeight=h*i.percentHeight/100,isNaN(i.percentWidth)||(i.actualWidth=r*i.percentWidth)}layoutElements(t,e){1!==t.verticalAlign?3!==t.verticalAlign?this.layoutElementsMiddle(t,e):this.layoutElementsBottom(t,e):this.layoutElementsTop(t,e)}getHorizontalXStartValue(t,e){let i=t.paddingLeft;if(2===t.horizontalAlign||3===t.horizontalAlign){const s=t.actualWidth-t.paddingLeft-t.paddingRight;let a=0;for(const t of e)a+=t.actualWidth;const h=t.horizontalGap*(e.length-1);2===t.horizontalAlign?i+=.5*(s-a-h):i+=s-a-h}return i}layoutElementsTop(t,e){let i=this.getHorizontalXStartValue(t,e);for(const s of e)s.setPosition(i,t.paddingTop),i+=s.actualWidth+t.horizontalGap}layoutElementsMiddle(t,e){let i=this.getHorizontalXStartValue(t,e),s=0;for(const a of e)s=.5*t.actualHeight-.5*a.actualHeight,a.setPosition(i,s),i+=a.actualWidth+t.horizontalGap}layoutElementsBottom(t,e){let i=this.getHorizontalXStartValue(t,e),s=0;for(const a of e)s=t.actualHeight-t.paddingBottom-a.actualHeight,a.setPosition(i,s),i+=a.actualWidth+t.horizontalGap}}class DisplayContainer extends DisplayElement{constructor(){super(),this._layout=1,this.elements=[],this._gap=0,this._horizontalGap=0,this._verticalGap=0,this._horizontalAlign=1,this._verticalAlign=1,this._padding=0,this._paddingLeft=0,this._paddingTop=0,this._paddingRight=0,this._paddingBottom=0,this.name=\"DisplayContainer\",this.addEventListener(\"a\",this.childChanged),this.addEventListener(\"c\",this.childChanged)}addElement(t){this.elements.push(t),this.appendChild(t),this.invalidateDisplay()}addElementAt(t,e){if(this.elements[e]){const i=this.elements[e];return this.elements.splice(e,0,t),this.insertBefore(t,i),void this.invalidateDisplay()}this.elements.push(t),this.appendChild(t),this.invalidateDisplay()}getElementAt(t){return this.elements[t]||null}removeElement(t){const e=this.elements.indexOf(t);this.elements.splice(e,1),this.removeChild(t),this.invalidateDisplay()}removeAllElements(){for(this.elements.length=0;this.lastChild;)this.removeChild(this.lastChild)}addElements(t){const e=document.createDocumentFragment();for(const i of t)this.elements.push(i),e.appendChild(i);this.appendChild(e),this.invalidateDisplay()}set layout(t){this._layout!==t&&(this._layout=t,1!==this._layout?2!==this._layout?this.currentLayout=this.verticalLayout:this.currentLayout=this.horizontalLayout:this.currentLayout=this.anchorLayout)}get layout(){return this._layout}childChanged(t){t.target!==this&&(t.stopImmediatePropagation(),this.invalidateDisplay())}updateDisplay(){super.updateDisplay(),this.currentLayout.updateLayout(this,this.elements)}set currentLayout(t){this._currentLayout=t,this.invalidateDisplay()}get currentLayout(){return this._currentLayout||this.anchorLayout}get anchorLayout(){return this._anchorLayout||(this._anchorLayout=new AnchorLayout),this._anchorLayout}get verticalLayout(){return this._verticalLayout||(this._verticalLayout=new VerticalLayout),this._verticalLayout}get horizontalLayout(){return this._horizontalLayout||(this._horizontalLayout=new HorizontalLayout),this._horizontalLayout}get numElements(){return this.elements.length}set gap(t){this._gap!==t&&(isNaN(t)||t<0?0!==this._gap&&(this._gap=0,this._horizontalGap=0,this._verticalGap=0,this.invalidateDisplay()):(this._gap=t,this._horizontalGap=this._gap,this._verticalGap=this._gap,this.invalidateDisplay()))}get gap(){return this._gap}set horizontalGap(t){this._horizontalGap!==t&&(isNaN(t)||t<0?0!==this._horizontalGap&&(this._horizontalGap=0,this.invalidateDisplay()):(this._horizontalGap=t,this.invalidateDisplay()))}get horizontalGap(){return this._horizontalGap}set verticalGap(t){this._verticalGap!==t&&(isNaN(t)||t<0?0!==this._verticalGap&&(this._verticalGap=0,this.invalidateDisplay()):(this._verticalGap=t,this.invalidateDisplay()))}get verticalGap(){return this._verticalGap}set horizontalAlign(t){this._horizontalAlign!==t&&(this._horizontalAlign=t,this.invalidateDisplay())}get horizontalAlign(){return this._horizontalAlign}set verticalAlign(t){this._verticalAlign!==t&&(this._verticalAlign=t,this.invalidateDisplay())}get verticalAlign(){return this._verticalAlign}set padding(t){this._padding!==t&&(isNaN(t)||t<0?0!==this._padding&&(this._padding=0,this._paddingLeft=0,this._paddingTop=0,this._paddingRight=0,this._paddingBottom=0,this.invalidateDisplay()):(this._padding=t,this._paddingLeft=t,this._paddingTop=t,this._paddingRight=t,this._paddingBottom=t,this.invalidateDisplay()))}get padding(){return this._padding}set paddingLeft(t){this._paddingLeft!==t&&(isNaN(t)||t<0?0!==this._paddingLeft&&(this._paddingLeft=0,this.invalidateDisplay()):(this._paddingLeft=t,this.invalidateDisplay()))}get paddingLeft(){return this._paddingLeft}set paddingTop(t){isNaN(t)||t<0?0!==this._paddingTop&&(this._paddingTop=0,this.invalidateDisplay()):(this._paddingTop=t,this.invalidateDisplay())}get paddingTop(){return this._paddingTop}set paddingRight(t){isNaN(t)||t<0?0!==this._paddingRight&&(this._paddingRight=0,this.invalidateDisplay()):(this._paddingRight=t,this.invalidateDisplay())}get paddingRight(){return this._paddingRight}set paddingBottom(t){isNaN(t)||t<0?0!==this._paddingBottom&&(this._paddingBottom=0,this.invalidateDisplay()):(this._paddingBottom=t,this.invalidateDisplay())}get paddingBottom(){return this._paddingBottom}}customElements.define(\"display-container\",DisplayContainer);class ApplicationElement extends DisplayContainer{constructor(){super(),this.name=\"ApplicationElement\",document.body.style.setProperty(\"position\",\"absolute\"),document.body.style.setProperty(\"-webkit-overflow-scrolling\",\"touch\"),document.body.style.setProperty(\"-webkit-tap-highlight-color\",\"transparent\"),document.body.style.setProperty(\"-moz-tap-highlight-color\",\"transparent\"),document.body.style.setProperty(\"margin\",\"0\"),this.overflow=\"hidden\",window.addEventListener(\"resize\",this.updateSize.bind(this)),this.updateSize()}connectedCallback(){super.connectedCallback(),this.dispatchCustomEvent(\"b\")}updateSize(){this.setSize(window.innerWidth,window.innerHeight)}set backgroundColor(t){document.body.style.setProperty(\"background-color\",t)}get backgroundColor(){return document.body.style.getPropertyValue(\"background-color\")}}customElements.define(\"application-element\",ApplicationElement);class ScrollContainer extends DisplayElement{constructor(){super(),this._scrollEnabled=!1,this._horizontalScrollEnabled=!1,this._verticalScrollEnabled=!1,this.name=\"ScrollContainer\",this.overflow=\"hidden\";this.elementsContainer.style.willChange=\"transform\",this.appendChild(this.outerElement),this.addEventListener(\"a\",this.childChanged),this.addEventListener(\"c\",this.childChanged)}childChanged(t){t.target!==this&&(t.stopImmediatePropagation(),this.invalidateDisplay())}updateDisplay(){super.updateDisplay(),this.hasExplicitWidth(this)||this.hasExplicitHeight(this)?this.hasExplicitWidth(this)&&!this.hasExplicitHeight(this)?(this.actualHeight=this.elementsContainer.actualHeight,this.elementsContainer.setSize(this.actualWidth,NaN),this.dispatchEvent(new Event(\"a\",{bubbles:!0}))):!this.hasExplicitWidth(this)&&this.hasExplicitHeight(this)?(this.actualWidth=this.elementsContainer.actualWidth,this.elementsContainer.setSize(NaN,this.actualHeight),this.dispatchEvent(new Event(\"a\",{bubbles:!0}))):this.horizontalScrollEnabled?this.elementsContainer.setSize(NaN,this.actualHeight):this.verticalScrollEnabled?this.elementsContainer.setSize(this.actualWidth,NaN):this.elementsContainer.setSize(this.actualWidth,this.actualHeight):(this.setActualSize(this.elementsContainer.actualWidth,this.elementsContainer.actualHeight),this.dispatchEvent(new Event(\"a\",{bubbles:!0}))),this.outerContainer.setSize(this.actualWidth+this.scrollBarWidth,this.actualHeight+this.scrollBarHeight)}get scrollBarWidth(){return this.outerElement.offsetWidth-this.outerElement.clientWidth}get scrollBarHeight(){return this.outerElement.offsetHeight-this.outerElement.clientHeight}get outerContainer(){return this._outerContainer||(this._outerContainer=new DisplayElement,this._outerContainer.overflow=\"hidden\"),this._outerContainer}get outerElement(){return this._outerElement||(this._outerElement=this.outerContainer,this._outerElement.appendChild(this.elementsContainer)),this._outerElement}get elementsContainer(){return this._elementsContainer||(this._elementsContainer=new DisplayContainer),this._elementsContainer}set scrollEnabled(t){this._scrollEnabled!==t&&(this._scrollEnabled=t,this._horizontalScrollEnabled=t,this._verticalScrollEnabled=t,this.outerContainer.overflow=this.scrollEnabled?\"scroll\":\"hidden\",this.invalidateDisplay())}get scrollEnabled(){return this._scrollEnabled}set horizontalScrollEnabled(t){this._horizontalScrollEnabled!==t&&(this._horizontalScrollEnabled=t,this._scrollEnabled=t&&this.verticalScrollEnabled,this.outerContainer.overflowX=this.horizontalScrollEnabled?\"scroll\":\"hidden\",this.invalidateDisplay())}get horizontalScrollEnabled(){return this._horizontalScrollEnabled}set verticalScrollEnabled(t){this._verticalScrollEnabled!==t&&(this._verticalScrollEnabled=t,this._scrollEnabled=t&&this._horizontalScrollEnabled,this.outerContainer.overflowY=this.verticalScrollEnabled?\"scroll\":\"hidden\",this.invalidateDisplay())}get verticalScrollEnabled(){return this._verticalScrollEnabled}addElement(t){this.elementsContainer.addElement(t)}addElementAt(t,e){this.elementsContainer.addElementAt(t,e)}getElementAt(t){return this.elementsContainer.getElementAt(t)}removeElement(t){this.elementsContainer.removeElement(t)}removeAllElements(){this.elementsContainer.removeAllElements()}addElements(t){this.elementsContainer.addElements(t)}set layout(t){this.elementsContainer.layout=t}get layout(){return this.elementsContainer.layout}get numElements(){return this.elementsContainer.numElements}set gap(t){this.elementsContainer.gap=t}get gap(){return this.elementsContainer.gap}set horizontalGap(t){this.elementsContainer.horizontalGap=t}get horizontalGap(){return this.elementsContainer.horizontalGap}set verticalGap(t){this.elementsContainer.verticalGap=t}get verticalGap(){return this.elementsContainer.verticalGap}set horizontalAlign(t){this.elementsContainer.horizontalAlign=t}get horizontalAlign(){return this.elementsContainer.horizontalAlign}set verticalAlign(t){this.elementsContainer.verticalAlign=t}get verticalAlign(){return this.elementsContainer.verticalAlign}set padding(t){this.elementsContainer.padding=t}get padding(){return this.elementsContainer.padding}set paddingLeft(t){this.elementsContainer.paddingLeft=t}get paddingLeft(){return this.elementsContainer.paddingLeft}set paddingTop(t){this.elementsContainer.paddingTop=t}get paddingTop(){return this.elementsContainer.paddingTop}set paddingRight(t){this.elementsContainer.paddingRight=t}get paddingRight(){return this.elementsContainer.paddingRight}set paddingBottom(t){this.elementsContainer.paddingBottom=t}get paddingBottom(){return this.elementsContainer.paddingBottom}}customElements.define(\"scroll-container\",ScrollContainer);class ArrayList extends EventDispatcher{constructor(t=null){super(),this.name=\"ArrayList\",this._arrayData=t||[]}addItem(t){this.arrayData.push(t),this.dispatchCustomEvent(\"d\",t)}addItems(t){this._arrayData=this.arrayData.concat(t),this.dispatchCustomEvent(\"f\",t)}getItemIndex(t){const e=this.arrayData.indexOf(t);return-1===e?NaN:e}getItemAt(t){return t<0?null:t<this.arrayData.length?this.arrayData[t]:null}removeItem(t){const e=this.arrayData.indexOf(t);e>-1&&(this.arrayData.splice(e,1),this.dispatchCustomEvent(\"e\",t))}removeItemAt(t){const e=this.getItemAt(t);e&&(this.arrayData.splice(t,1),this.dispatchCustomEvent(\"e\",e))}removeAll(){this.length>0&&(this.arrayData.length=0,this.dispatchEvent(new Event(\"g\")))}get length(){return this.arrayData.length}get arrayData(){return this._arrayData}}class State{constructor(t){this.event=null,this.enter=null,this.on=null,this.exit=null,this.targets=new Map,this.name=t}addTransition(t,e){return this.targets.set(t,e),this}getState(t){return this.targets.get(t)||this}}class FSM extends EventDispatcher{constructor(t){super(),this.initial=new State(\"initial\"),this.host=t,this.current=this.initial,this.send=this.send.bind(this)}send(t){const e=this.current.getState(t.type);this.current!==e&&(this.current.exit&&this.current.exit(t),this.current=e,this.current.enter&&this.current.enter(t),this.dispatchCustomEvent(FSM.STATE_CHANGED,e),this.current.on&&this.current.on(t))}}FSM.STATE_CHANGED=\"stateChanged\";class TouchMouseFSM extends FSM{constructor(t){super(t),this.initial.enter=this.initialEnter.bind(this),this.initial.exit=this.initialExit.bind(this),this.initial.addTransition(\"mouseover\",this.mouseOver),this.initial.addTransition(\"touchstart\",this.touchStart),this.host.addEventListener(\"mouseover\",this.send),this.host.addEventListener(\"touchstart\",this.send)}initialEnter(){this.host.addEventListener(\"mouseover\",this.send),this.host.addEventListener(\"touchstart\",this.send)}initialExit(){this.host.removeEventListener(\"mouseover\",this.send),this.host.removeEventListener(\"touchstart\",this.send)}get mouseOver(){return this._mouseOver||(this._mouseOver=new State(\"mouseOver\"),this._mouseOver.enter=this.overEnter.bind(this),this._mouseOver.exit=this.overExit.bind(this),this._mouseOver.addTransition(\"mouseleave\",this.initial),this._mouseOver.addTransition(\"mousedown\",this.mouseDown)),this._mouseOver}overEnter(){this.host.addEventListener(\"mouseleave\",this.send),this.host.addEventListener(\"mousedown\",this.send)}overExit(){this.host.removeEventListener(\"mouseleave\",this.send),this.host.removeEventListener(\"mousedown\",this.send)}get mouseDown(){return this._mouseDown||(this._mouseDown=new State(\"mouseDown\"),this._mouseDown.enter=this.mouseDownEnter.bind(this),this._mouseDown.exit=this.mouseDownExit.bind(this),this._mouseDown.addTransition(\"mouseup\",this.mouseUp),this._mouseDown.addTransition(\"mouseleave\",this.initial)),this._mouseDown}mouseDownEnter(){this.host.addEventListener(\"mouseleave\",this.send),this.host.addEventListener(\"mouseup\",this.send)}mouseDownExit(){this.host.removeEventListener(\"mouseleave\",this.send),this.host.removeEventListener(\"mouseup\",this.send)}get mouseUp(){return this._mouseUp||(this._mouseUp=new State(\"mouseUp\"),this._mouseUp.on=this.mouseUpOn.bind(this),this._mouseUp.addTransition(\"mouseTriggered\",this.mouseOver)),this._mouseUp}mouseUpOn(){this.send(new Event(\"mouseTriggered\"))}get touchStart(){return this._touchStart||(this._touchStart=new State(\"touchStart\"),this._touchStart.enter=this.touchStartEnter.bind(this),this._touchStart.on=this.touchStartOn.bind(this),this._touchStart.exit=this.touchStartExit.bind(this),this._touchStart.addTransition(\"touchend\",this.touchEnd)),this._touchStart}touchStartEnter(){this.host.addEventListener(\"touchend\",this.send)}touchStartOn(t){t.preventDefault()}touchStartExit(){this.host.removeEventListener(\"touchend\",this.send)}get touchEnd(){return this._touchEnd||(this._touchEnd=new State(\"touchEnd\"),this._touchEnd.on=this.touchEndOn.bind(this),this._touchEnd.addTransition(\"touchEndInside\",this.touchEndInside),this._touchEnd.addTransition(\"touchEndOutside\",this.touchEndOutside)),this._touchEnd}touchEndOn(t){t.preventDefault();const e=t;if(e.changedTouches&&e.changedTouches.length>0){const t=e.changedTouches[0],i=t.pageX,s=t.pageY,a=this.host.getBoundingClientRect();if(i>a.x&&i<a.x+a.width&&s>a.y&&s<a.y+a.height)return void this.send(new Event(\"touchEndInside\"))}this.send(new Event(\"touchEndOutside\"))}get touchEndInside(){return this._touchEndInside||(this._touchEndInside=new State(\"touchEndInside\"),this._touchEndInside.on=this.touchEndInsideOn.bind(this),this._touchEndInside.addTransition(\"touchEndedInside\",this.initial)),this._touchEndInside}touchEndInsideOn(){this.send(new Event(\"touchEndedInside\"))}get touchEndOutside(){return this._touchEndOutside||(this._touchEndOutside=new State(\"touchEndOutside\"),this._touchEndOutside.on=this.touchEndOutsideOn.bind(this),this._touchEndOutside.addTransition(\"touchEndedOutside\",this.initial)),this._touchEndOutside}touchEndOutsideOn(){this.send(new Event(\"touchEndedOutside\"))}}class BaseItemRenderer extends DisplayContainer{constructor(){super(),this._data=null,this._selected=!1,this.name=\"BaseItemRenderer\",this.touchMouseFSM.addEventListener(FSM.STATE_CHANGED,this.stateChanged.bind(this))}get currentState(){return this.touchMouseFSM.current}get touchMouseFSM(){return this._touchMouseFSM||(this._touchMouseFSM=new TouchMouseFSM(this)),this._touchMouseFSM}dataChanged(){}selectedChanged(){}stateChanged(){}set data(t){this._data!==t&&(this._data=t,this.dataChanged())}get data(){return this._data}set selected(t){this._selected!==t&&(this._selected=t,this.selectedChanged())}get selected(){return this._selected}}customElements.define(\"base-item-renderer\",BaseItemRenderer);class SvgElement extends LayoutElement{constructor(){super(),this.svg=document.createElementNS(\"http://www.w3.org/2000/svg\",\"svg\"),this.defs=document.createElementNS(\"http://www.w3.org/2000/svg\",\"defs\"),this.group=document.createElementNS(\"http://www.w3.org/2000/svg\",\"g\"),this.name=\"SvgElement\",this.svg.style.position=\"absolute\",this.svg.style.overflow=\"visible\",this.svg.appendChild(this.defs),this.svg.appendChild(this.group),this.appendChild(this.svg)}updateDisplay(){super.updateDisplay(),this.updateSvgAttributes()}updateSvgAttributes(){this.svg.setAttribute(\"width\",this.actualWidth.toString()),this.svg.setAttribute(\"height\",this.actualHeight.toString())}}customElements.define(\"svg-element\",SvgElement);class PathElement extends SvgElement{constructor(){super(),this._pathData=\"\",this._strokeColor=\"\",this._strokeWidth=0,this._strokeOpacity=1,this._fillColor=\"\",this._fillOpacity=1,this.path=document.createElementNS(\"http://www.w3.org/2000/svg\",\"path\"),this.name=\"PathElement\",this.group.appendChild(this.path)}set pathData(t){this._pathData!==t&&(this._pathData=t,this.path.setAttribute(\"d\",t))}get pathData(){return this._pathData}set strokeColor(t){this._strokeColor!==t&&(this._strokeColor=t,this.path.setAttribute(\"stroke\",t))}get strokeColor(){return this._strokeColor}set strokeWidth(t){this._strokeWidth!==t&&(isNaN(t)||t<0?this._strokeWidth=0:this._strokeWidth=t,this.path.setAttribute(\"stroke-width\",t.toString()))}get strokeWidth(){return this._strokeWidth}set strokeOpacity(t){this._strokeOpacity!==t&&(isNaN(t)||t>1?this._strokeOpacity=1:this._strokeOpacity=t<0?0:t,this.path.setAttribute(\"stroke-opacity\",this._strokeOpacity.toString()))}get strokeOpacity(){return this._strokeOpacity}set fillColor(t){this._fillColor!==t&&(this._fillColor=t,this.path.setAttribute(\"fill\",t))}get fillColor(){return this._fillColor}set fillOpacity(t){this._fillOpacity!==t&&(isNaN(t)||t>0?this._fillOpacity=1:this._fillOpacity=t<0?0:t,this.path.setAttribute(\"fill-opacity\",this._fillOpacity.toString()))}get fillOpacity(){return this._fillOpacity}}customElements.define(\"path-element\",PathElement);class IconElement extends PathElement{constructor(){super(),this._icon=\"\",this._color=\"\",this.name=\"IconElement\",this.setSize(24,24),this.svg.setAttribute(\"viewBox\",\"0 0 24 24\")}set icon(t){this._icon!==t&&(this._icon=t,this.pathData=t)}get icon(){return this._icon}set color(t){this._color!==t&&(this._color=t,this.fillColor=t)}get color(){return this._color}}customElements.define(\"icon-element\",IconElement);class ListElement extends ScrollContainer{constructor(){super(),this.dataRendererLookup=new Map,this._dataProvider=null,this._selectedIndex=NaN,this.name=\"ListElement\",this.itemAdded=this.itemAdded.bind(this),this.itemsAdded=this.itemsAdded.bind(this),this.itemRemoved=this.itemRemoved.bind(this),this.reset=this.reset.bind(this),this.addEventListener(\"i\",this.listItemClicked)}listItemClicked(t){t.stopImmediatePropagation();let e=NaN;this.dataProvider&&(e=this.dataProvider.getItemIndex(t.detail)),isNaN(this.selectedIndex)&&isNaN(e)||this.selectedIndex!==e&&(this.selectedIndex=e,this.dispatchCustomEvent(ListElement.SELECTED_ITEM_CHANGED,this.selectedItem))}updateSelectedItemRenderer(){this.dataRendererLookup.forEach((t=>{t&&(t.selected=!1)})),this.selectedItemRenderer&&(this.selectedItemRenderer.selected=!0)}set ItemRenderer(t){this._ItemRenderer!==t&&(this._ItemRenderer=t,this.reset())}get ItemRenderer(){return this._ItemRenderer||(this._ItemRenderer=BaseItemRenderer),this._ItemRenderer}itemAdded(t){const e=new this.ItemRenderer;e.data=t.detail,this.dataRendererLookup.set(t.detail,e),this.addElement(e),this.updateSelectedItemRenderer()}itemsAdded(t){this.addItemRenderers(t.detail)}addItemRenderers(t){const e=[];for(const i of t){const t=new this.ItemRenderer;t.data=i,this.dataRendererLookup.set(i,t),e.push(t)}this.addElements(e),this.updateSelectedItemRenderer()}itemRemoved(t){const e=this.dataRendererLookup.get(t.detail);e&&this.removeElement(e),this.updateSelectedItemRenderer()}reset(){this.removeAllElements(),this.dataRendererLookup.clear(),this.dataProvider&&this.addItemRenderers(this.dataProvider.arrayData)}set dataProvider(t){this._dataProvider!==t&&(this._dataProvider&&(this._dataProvider.removeEventListener(\"d\",this.itemAdded),this._dataProvider.removeEventListener(\"f\",this.itemsAdded),this._dataProvider.removeEventListener(\"e\",this.itemRemoved),this._dataProvider.removeEventListener(\"g\",this.reset)),this._dataProvider=t,this._dataProvider&&(this._dataProvider.addEventListener(\"d\",this.itemAdded),this._dataProvider.addEventListener(\"f\",this.itemsAdded),this._dataProvider.addEventListener(\"e\",this.itemRemoved),this._dataProvider.addEventListener(\"g\",this.reset)),this.reset())}get dataProvider(){return this._dataProvider}get selectedItemRenderer(){if(this.selectedItem)return this.dataRendererLookup.get(this.selectedItem)}get selectedItem(){return this.dataProvider?this.dataProvider.getItemAt(this.selectedIndex):null}set selectedIndex(t){isNaN(this._selectedIndex)&&isNaN(t)||this._selectedIndex!==t&&(this._selectedIndex=t,this.updateSelectedItemRenderer())}get selectedIndex(){return this._selectedIndex}}ListElement.SELECTED_ITEM_CHANGED=\"selectedItemChanged\",customElements.define(\"list-element\",ListElement);class ShapeElement extends PathElement{constructor(){super(),this._cornerRadius=0,this.name=\"ShapeElement\"}updateDisplay(){super.updateDisplay(),this.updatePathData()}updatePathData(){const t=this.cornerRadius,e=t,i=t,s=t,a=this.actualWidth,h=this.actualHeight;let n=\"\";n+=\"M 0 \"+t+\" \",n+=\"A \"+t+\" \"+t+\" 0 0 1 \"+t+\" 0 \",n+=\"L \"+(a-e)+\" 0 \",n+=\"A \"+e+\" \"+e+\" 1 0 1 \"+a+\" \"+e+\" \",n+=\"L \"+a+\" \"+(h-i)+\" \",n+=\"A \"+i+\" \"+i+\" 1 0 1 \"+(a-i)+\" \"+h+\" \",n+=\"L \"+s+\" \"+h+\" \",n+=\"A \"+s+\" \"+s+\" 0 0 1 0 \"+(h-s)+\" \",n+=\"Z\",this.path.setAttribute(\"d\",n)}set cornerRadius(t){this._cornerRadius!==t&&(isNaN(t)||t<0?this._cornerRadius=0:this._cornerRadius=t,this.invalidateDisplay())}get cornerRadius(){return this._cornerRadius}}customElements.define(\"shape-element\",ShapeElement);class RippleElement extends ShapeElement{constructor(){super(),this.circleRadius=0,this.maskId=Math.random().toString(),this.mask=document.createElementNS(\"http://www.w3.org/2000/svg\",\"mask\"),this.circle=document.createElementNS(\"http://www.w3.org/2000/svg\",\"circle\"),this.radiusTween=new AttributeTween(this.circle,\"r\",500),this.opacityTween=new StyleTween(this.circle,\"opacity\",500),this._rippleColor=\"\",this.name=\"RippleElement\",this.path.style.fill=\"#FFFFFF\",this.mask.setAttribute(\"id\",this.maskId),this.mask.appendChild(this.path),this.circle.setAttribute(\"mask\",\"url(#\"+this.maskId+\")\"),this.circle.setAttribute(\"r\",\"0\"),this.svg.appendChild(this.mask),this.svg.appendChild(this.circle),this.appendChild(this.svg)}show(t){this.circle.setAttribute(\"r\",\"0\"),this.circle.style.opacity=\"0.1\",this.radiusTween.to(this.circleRadius,300),this.opacityTween.to(.4,300),this.circle.setAttribute(\"cx\",t.x.toString()),this.circle.setAttribute(\"cy\",t.y.toString())}hide(){this.opacityTween.to(0,300)}updateDisplay(){super.updateDisplay(),this.updateCircleRadius()}updateCircleRadius(){this.circleRadius=Math.hypot(this.actualWidth,this.actualHeight)}set rippleColor(t){this._rippleColor!==t&&(this._rippleColor=t,this.circle.style.fill=t)}get rippleColor(){return this._rippleColor}}customElements.define(\"ripple-element\",RippleElement);class TextRenderer extends DisplayElement{constructor(){super(),this._text=\"\",this._fontFamily=\"Arial\",this._fontSize=11.2,this._whiteSpace=\"normal\",this._textOverflow=\"clip\",this._textColor=\"\",this._fontWeight=400,this._lineHeight=1.2,this._letterSpacing=0,this._textAlign=\"left\",this.name=\"TextRenderer\",this.style.fontFamily=\"Arial\",this.style.fontSize=\"11.2px\",this.style.lineHeight=\"1.2\"}set text(t){this._text!==t&&(this._text=t,this.innerText=t)}get text(){return this._text}set fontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.style.fontFamily=this._fontFamily)}get fontFamily(){return this._fontFamily}set fontSize(t){this._fontSize!==t&&(isNaN(t)||t<0?this._fontSize=11.2:this._fontSize=t,this.style.fontSize=this._fontSize+\"px\")}get fontSize(){return this._fontSize}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.style.whiteSpace=t)}get whiteSpace(){return this._whiteSpace}set textOverflow(t){this._textOverflow!==t&&(this._textOverflow=t,this.style.textOverflow=t)}get textOverflow(){return this._textOverflow}set textColor(t){this._textColor!==t&&(this._textColor=t,this.style.color=t)}get textColor(){return this._textColor}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.style.fontWeight=this._fontWeight.toString())}get fontWeight(){return this._fontWeight}set lineHeight(t){this._lineHeight!==t&&(isNaN(t)||t<0?this._lineHeight=1.2:this._lineHeight=t,this.style.lineHeight=this._lineHeight.toString())}get lineHeight(){return this._lineHeight}set letterSpacing(t){this._letterSpacing!==t&&(isNaN(t)?this._letterSpacing=0:this._letterSpacing=t,this.style.letterSpacing=this._letterSpacing.toString())}get letterSpacing(){return this._letterSpacing}set textAlign(t){this._textAlign!==t&&(this._textAlign=t,this.style.textAlign=this._textAlign)}get textAlign(){return this._textAlign}}customElements.define(\"text-renderer\",TextRenderer);class TypeFace{constructor(t=\"Arial\",e=400,i=.715,s=.11,a=.027){this._fontFamily=\"Arial\",this._fontWeight=400,this._capHeight=.715,this._xOffset=.11,this._yOffset=.027,this.fontFamily=t,this.fontWeight=e,this.capHeight=i,this.xOffset=s,this.yOffset=a}set fontFamily(t){this._fontFamily!==t&&(this._fontFamily=t)}get fontFamily(){return this._fontFamily}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t)}get fontWeight(){return this._fontWeight}set capHeight(t){this._capHeight!==t&&(isNaN(t)||t<0?this._capHeight=.715:this._capHeight=t)}get capHeight(){return this._capHeight}set xOffset(t){this._xOffset!==t&&(isNaN(t)?this._xOffset=.11:this._xOffset=t)}get xOffset(){return this._xOffset}set yOffset(t){this._yOffset!==t&&(isNaN(t)?this._yOffset=.027:this._yOffset=t)}get yOffset(){return this._yOffset}}class BaseText extends DisplayElement{constructor(){super(),this._fontSize=11.2}get textRenderer(){return this._textRenderer||(this._textRenderer=new TextRenderer),this._textRenderer}set text(t){this.textRenderer.text=t,this.invalidateDisplay()}get text(){return this.textRenderer.text}set fontSize(t){this._fontSize!==t&&(isNaN(t)||t<0?this._fontSize=11.2:this._fontSize=t,this.invalidateDisplay())}get fontSize(){return this._fontSize}set textColor(t){this.textRenderer.textColor=t}get textColor(){return this.textRenderer.textColor}set letterSpacing(t){this.textRenderer.letterSpacing=t,this.invalidateDisplay()}get letterSpacing(){return this.textRenderer.letterSpacing}set textAlign(t){this.textRenderer.textAlign=t}get textAlign(){return this.textRenderer.textAlign}set typeFace(t){this._typeFace!==t&&(this._typeFace=t,this.invalidateDisplay())}get typeFace(){return this._typeFace||(this._typeFace=new TypeFace),this._typeFace}invalidateInternalSize(t,e){if(this.hasExplicitWidth(this)&&this.hasExplicitHeight(this))this.textRenderer.setActualSize(this.actualWidth,this.actualHeight);else{if(this.hasExplicitWidth(this)&&!this.hasExplicitHeight(this))return this.textRenderer.actualWidth=this.actualWidth,this.actualHeight=Math.ceil(this.textRenderer.clientHeight-t),void this.dispatchCustomEvent(\"a\",this,!0);if(!this.hasExplicitWidth(this)&&this.hasExplicitHeight(this))return this.textRenderer.actualHeight=this.actualHeight,this.actualWidth=Math.ceil(this.textRenderer.clientWidth-2*e),void this.dispatchCustomEvent(\"a\",this,!0);this.setActualSize(Math.ceil(this.textRenderer.clientWidth-2*e),Math.ceil(this.textRenderer.clientHeight-t)),this.dispatchCustomEvent(\"a\",this,!0)}}}customElements.define(\"base-text\",BaseText);class LabelElement extends BaseText{constructor(){super(),this.name=\"LabelElement\",this.textRenderer.whiteSpace=\"nowrap\",this.textRenderer.textOverflow=\"ellipsis\",this.textRenderer.overflow=\"hidden\",this.appendChild(this.textRenderer)}updateDisplay(){super.updateDisplay(),this.textRenderer.fontFamily=this.typeFace.fontFamily,this.textRenderer.fontWeight=this.typeFace.fontWeight,this.textRenderer.fontSize=this.fontSize/this.typeFace.capHeight;const t=this.textRenderer.lineHeight*this.fontSize/this.typeFace.capHeight-this.fontSize,e=.5*-t;this.textRenderer.y=e-this.fontSize*-this.typeFace.yOffset;const i=this.fontSize*this.typeFace.xOffset;this.textRenderer.x=-i,this.invalidateInternalSize(t,i)}}customElements.define(\"label-element\",LabelElement);class TextElement extends BaseText{constructor(){super(),this._verticalGap=4,this.name=\"TextElement\",this.appendChild(this.textRenderer)}updateDisplay(){super.updateDisplay(),this.textRenderer.fontFamily=this.typeFace.fontFamily,this.textRenderer.fontSize=this.fontSize/this.typeFace.capHeight;const t=(this.fontSize+this.verticalGap)/this.fontSize*this.typeFace.capHeight;this.textRenderer.lineHeight=t;const e=this.textRenderer.lineHeight*this.fontSize/this.typeFace.capHeight-this.fontSize,i=.5*-e;this.textRenderer.y=i-this.fontSize*-this.typeFace.yOffset;const s=this.fontSize*this.typeFace.xOffset;this.textRenderer.x=-s,this.invalidateInternalSize(e,s)}set verticalGap(t){this._verticalGap!==t&&(isNaN(t)?this._verticalGap=4:this._verticalGap=t,this.invalidateDisplay())}get verticalGap(){return this._verticalGap}}customElements.define(\"text-element\",TextElement);class Point{constructor(t=0,e=0){this.x=0,this.y=0,isNaN(t)?this.x=0:this.x=t,isNaN(e)?this.y=0:this.y=e}}class MenuItem{constructor(t,e){this.icon=t,this.text=e}}class MenuItemRenderer extends BaseItemRenderer{constructor(){super(),this.name=\"MenuItemRenderer\",this.height=40,this.cornerRadius=8,this.layout=2,this.verticalAlign=2,this.padding=8,this.horizontalGap=16,this.cursor=\"pointer\",this.addElement(this.iconElement),this.addElement(this.label)}stateChanged(){this.setStateProperties()}setStateProperties(){const t=this.currentState.name;this.selected?(this.backgroundColor=\"#285E61\",this.label.textColor=\"white\"):\"initial\"===t?(this.backgroundColor=\"transparent\",this.label.textColor=\"#76d6db\"):\"mouseOver\"===this.currentState.name?(this.backgroundColor=\"#319795\",this.label.textColor=\"#76d6db\"):\"mouseDown\"===t||\"touchStart\"===t?(this.backgroundColor=\"#285E61\",this.label.textColor=\"white\"):\"mouseUp\"!==t&&\"touchEndInside\"!==t||this.dispatchCustomEvent(\"i\",this.data,!0)}dataChanged(){this.data&&(this.iconElement.pathData=this.data.icon,this.label.text=this.data.text)}selectedChanged(){this.setStateProperties()}get iconElement(){return this._iconElement||(this._iconElement=new IconElement,this._iconElement.color=\"#76d6db\"),this._iconElement}get label(){return this._label||(this._label=new LabelElement,this._label.textColor=\"#76d6db\",this._label.percentWidth=100,this._label.fontSize=12,this._label.typeFace=new TypeFace(\"Inter\",500,.727,.11,0)),this._label}}customElements.define(\"menu-item-renderer\",MenuItemRenderer);export{AnchorLayout,ApplicationElement,ArrayList,AttributeTween,BaseItemRenderer,BaseLayout,BaseText,DisplayContainer,DisplayElement,EventDispatcher,EventDispatcherElement,FSM,HorizontalLayout,IconElement,LabelElement,LayoutElement,LifeCycleElement,ListElement,MenuItem,MenuItemRenderer,PathElement,Point,PositionElement,RippleElement,ScrollContainer,ShapeElement,SizeElement,State,StyleTween,SvgElement,TextElement,TextRenderer,TouchMouseFSM,TypeFace,VerticalLayout};\n\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sInNvdXJjZXMiOltdLCJtYXBwaW5ncyI6IiIsImlnbm9yZUxpc3QiOltdfQ=="]}