var BABYLON;!(function(t){!(function(e){var i=(function(i){function r(r,n,s,o,h,a){void 0===n&&(n=0),void 0===s&&(s=0),void 0===h&&(h=!1),void 0===a&&(a=t.Texture.NEAREST_SAMPLINGMODE);var _=i.call(this,r,{width:n,height:s},o,h,a,t.Engine.TEXTUREFORMAT_RGBA)||this;return _._isDirty=!1,_._rootContainer=new e.Container("root"),_._linkedControls=new Array,_._isFullscreen=!1,_._fullscreenViewport=new t.Viewport(0,0,1,1),_._idealWidth=0,_._idealHeight=0,_._renderObserver=_.getScene().onBeforeCameraRenderObservable.add((function(t){return _._checkUpdate(t)})),_._rootContainer._link(null,_),_.hasAlpha=!0,n&&s||(_._resizeObserver=_.getScene().getEngine().onResizeObservable.add((function(){return _._onResize()})),_._onResize()),_._texture.isReady=!0,_}return __extends(r,i),Object.defineProperty(r.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this.markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"idealWidth",{get:function(){return this._idealWidth},set:function(t){this._idealWidth!==t&&(this._idealWidth=t,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"idealHeight",{get:function(){return this._idealHeight},set:function(t){this._idealHeight!==t&&(this._idealHeight=t,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"layer",{get:function(){return this._layerToDispose},enumerable:!0,configurable:!0}),r.prototype.markAsDirty=function(){this._isDirty=!0},r.prototype.addControl=function(t){return this._rootContainer.addControl(t),this},r.prototype.removeControl=function(t){return this._rootContainer.removeControl(t),this},r.prototype.dispose=function(){this.getScene().onBeforeCameraRenderObservable.remove(this._renderObserver),this._resizeObserver&&this.getScene().getEngine().onResizeObservable.remove(this._resizeObserver),this._pointerMoveObserver&&this.getScene().onPrePointerObservable.remove(this._pointerMoveObserver),this._pointerObserver&&this.getScene().onPointerObservable.remove(this._pointerObserver),this._canvasBlurObserver&&this.getScene().getEngine().onCanvasBlurObservable.remove(this._canvasBlurObserver),this._layerToDispose&&(this._layerToDispose.texture=null,this._layerToDispose.dispose(),this._layerToDispose=null),i.prototype.dispose.call(this)},r.prototype._onResize=function(){var t=this.getScene().getEngine(),e=this.getSize(),i=t.getRenderWidth(),r=t.getRenderHeight();e.width===i&&e.height===r||(this.scaleTo(i,r),this.markAsDirty(),(this._idealWidth||this._idealHeight)&&this._rootContainer._markAllAsDirty())},r.prototype._checkUpdate=function(e){if(!this._layerToDispose||0!=(e.layerMask&this._layerToDispose.layerMask)){if(this._isFullscreen&&this._linkedControls.length)for(var i=this.getScene(),r=i.getEngine(),n=this._fullscreenViewport.toGlobal(r.getRenderWidth(),r.getRenderHeight()),s=0,o=this._linkedControls;st.left+t.width)&&(!(this._currentMeasure.left+this._currentMeasure.widtht.top+t.height)&&(!(this._currentMeasure.top+this._currentMeasure.heightthis._currentMeasure.left+this._currentMeasure.width)&&(!(ethis._currentMeasure.top+this._currentMeasure.height)&&(this.isPointerBlocker&&(this._host._shouldBlockPointer=!0),!0))))},i.prototype._processPicking=function(t,e,i){return!!this.isHitTestVisible&&(!!this.contains(t,e)&&(this._processObservables(i,t,e),!0))},i.prototype._onPointerMove=function(t){this.onPointerMoveObservable.hasObservers()&&this.onPointerMoveObservable.notifyObservers(t)},i.prototype._onPointerEnter=function(){this.onPointerEnterObservable.hasObservers()&&this.onPointerEnterObservable.notifyObservers(this)},i.prototype._onPointerOut=function(){this.onPointerOutObservable.hasObservers()&&this.onPointerOutObservable.notifyObservers(this)},i.prototype._onPointerDown=function(t){this.onPointerDownObservable.hasObservers()&&this.onPointerDownObservable.notifyObservers(t)},i.prototype._onPointerUp=function(t){this.onPointerUpObservable.hasObservers()&&this.onPointerUpObservable.notifyObservers(t)},i.prototype.forcePointerUp=function(){this._onPointerUp(t.Vector2.Zero())},i.prototype._processObservables=function(e,i,r){if(this._dummyVector2.copyFromFloats(i,r),e===t.PointerEventTypes.POINTERMOVE){this._onPointerMove(this._dummyVector2);var n=this._host._lastControlOver;return n&&n!==this&&n._onPointerOut(),n!==this&&this._onPointerEnter(),this._host._lastControlOver=this,!0}return e===t.PointerEventTypes.POINTERDOWN?(this._onPointerDown(this._dummyVector2),this._host._lastControlDown=this,!0):e===t.PointerEventTypes.POINTERUP&&(this._host._lastControlDown&&this._host._lastControlDown._onPointerUp(this._dummyVector2),this._host._lastControlDown=null,!0)},i.prototype._prepareFont=function(){this._fontFamily&&(this._font=this._fontSize.getValue(this._host)+"px "+this._fontFamily,this._fontOffset=i._GetFontOffset(this._font))},Object.defineProperty(i,"HORIZONTAL_ALIGNMENT_LEFT",{get:function(){return i._HORIZONTAL_ALIGNMENT_LEFT},enumerable:!0,configurable:!0}),Object.defineProperty(i,"HORIZONTAL_ALIGNMENT_RIGHT",{get:function(){return i._HORIZONTAL_ALIGNMENT_RIGHT},enumerable:!0,configurable:!0}),Object.defineProperty(i,"HORIZONTAL_ALIGNMENT_CENTER",{get:function(){return i._HORIZONTAL_ALIGNMENT_CENTER},enumerable:!0,configurable:!0}),Object.defineProperty(i,"VERTICAL_ALIGNMENT_TOP",{get:function(){return i._VERTICAL_ALIGNMENT_TOP},enumerable:!0,configurable:!0}),Object.defineProperty(i,"VERTICAL_ALIGNMENT_BOTTOM",{get:function(){return i._VERTICAL_ALIGNMENT_BOTTOM},enumerable:!0,configurable:!0}),Object.defineProperty(i,"VERTICAL_ALIGNMENT_CENTER",{get:function(){return i._VERTICAL_ALIGNMENT_CENTER},enumerable:!0,configurable:!0}),i._GetFontOffset=function(t){if(i._FontHeightSizes[t])return i._FontHeightSizes[t];var e=document.createElement("span");e.innerHTML="Hg",e.style.font=t;var r=document.createElement("div");r.style.display="inline-block",r.style.width="1px",r.style.height="0px",r.style.verticalAlign="bottom";var n=document.createElement("div");n.appendChild(e),n.appendChild(r),document.body.appendChild(n);var s=0,o=0;try{o=r.getBoundingClientRect().top-e.getBoundingClientRect().top,r.style.verticalAlign="baseline",s=r.getBoundingClientRect().top-e.getBoundingClientRect().top}finally{n.remove()}var h={ascent:s,height:o,descent:o-s};return i._FontHeightSizes[t]=h,h},i.AddHeader=function(e,r,n,s){var o=new t.GUI.StackPanel("panel"),h=!s||s.isHorizontal,a=!!s&&s.controlFirst;o.isVertical=!h;var _=new t.GUI.TextBlock("header");return _.text=r,_.textHorizontalAlignment=i.HORIZONTAL_ALIGNMENT_LEFT,h?_.width=n:_.height=n,a?(o.addControl(e),o.addControl(_),_.paddingLeft="5px"):(o.addControl(_),o.addControl(e),_.paddingRight="5px"),o},i})();i._HORIZONTAL_ALIGNMENT_LEFT=0,i._HORIZONTAL_ALIGNMENT_RIGHT=1,i._HORIZONTAL_ALIGNMENT_CENTER=2,i._VERTICAL_ALIGNMENT_TOP=0,i._VERTICAL_ALIGNMENT_BOTTOM=1,i._VERTICAL_ALIGNMENT_CENTER=2,i._FontHeightSizes={},e.Control=i})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(t){var e=(function(e){function i(i){var r=e.call(this,i)||this;return r.name=i,r._children=new Array,r._measureForChildren=t.Measure.Empty(),r}return __extends(i,e),Object.defineProperty(i.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"children",{get:function(){return this._children},enumerable:!0,configurable:!0}),i.prototype.getChildByName=function(t){for(var e=0,i=this._children;et.zIndex)return void this._children.splice(e,0,t);this._children.push(t),this._markAsDirty()},i.prototype._markMatrixAsDirty=function(){e.prototype._markMatrixAsDirty.call(this);for(var t=0;t=0;n--){if(this._children[n]._processPicking(t,i,r))return!0}return this._processObservables(r,t,i)},i.prototype._clipForChildren=function(t){},i.prototype._additionalProcessing=function(t,i){e.prototype._additionalProcessing.call(this,t,i),this._measureForChildren.copyFrom(this._currentMeasure)},i})(t.Control);t.Container=e})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(e){var i=(function(i){function r(t){var r=i.call(this,t)||this;return r.name=t,r._isVertical=!0,r._tempMeasureStore=e.Measure.Empty(),r}return __extends(r,i),Object.defineProperty(r.prototype,"isVertical",{get:function(){return this._isVertical},set:function(t){this._isVertical!==t&&(this._isVertical=t,this._markAsDirty())},enumerable:!0,configurable:!0}),r.prototype._preMeasure=function(e,r){for(var n=0,s=0,o=this._children;s0?r+" "+i[o]:i[0],a=e.measureText(h),_=a.width;_>n&&o>0?(this._lines.push({text:r,width:s}),r=i[o],s=e.measureText(r).width):(s=_,r=h)}this._lines.push({text:r,width:s})}else this._lines.push({text:this.text,width:e.measureText(this.text).width})},i.prototype._renderLines=function(e){var i=(this._currentMeasure.width,this._currentMeasure.height);this._fontOffset||(this._fontOffset=t.Control._GetFontOffset(e.font));var r=0;switch(this._textVerticalAlignment){case t.Control.VERTICAL_ALIGNMENT_TOP:r=this._fontOffset.ascent;break;case t.Control.VERTICAL_ALIGNMENT_BOTTOM:r=i-this._fontOffset.height*(this._lines.length-1)-this._fontOffset.descent;break;case t.Control.VERTICAL_ALIGNMENT_CENTER:r=this._fontOffset.ascent+(i-this._fontOffset.height*this._lines.length)/2}r+=this._currentMeasure.top;for(var n=0,s=this._lines;n