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 u=i.call(this,r,{width:n,height:s},o,h,a,t.Engine.TEXTUREFORMAT_RGBA)||this;return u._isDirty=!1,u._rootContainer=new e.Container("root"),u._linkedControls=new Array,u._isFullscreen=!1,u._fullscreenViewport=new t.Viewport(0,0,1,1),u._idealWidth=0,u._idealHeight=0,u._renderAtIdealSize=!1,u._renderObserver=u.getScene().onBeforeCameraRenderObservable.add((function(t){return u._checkUpdate(t)})),u._preKeyboardObserver=u.getScene().onPreKeyboardObservable.add((function(e){u._focusedControl&&(e.type===t.KeyboardEventTypes.KEYDOWN&&u._focusedControl.processKeyboard(e.event),e.skipOnPointerObservable=!0)})),u._rootContainer._link(null,u),u.hasAlpha=!0,n&&s||(u._resizeObserver=u.getScene().getEngine().onResizeObservable.add((function(){return u._onResize()})),u._onResize()),u._texture.isReady=!0,u}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,"renderAtIdealSize",{get:function(){return this._renderAtIdealSize},set:function(t){this._renderAtIdealSize!==t&&(this._renderAtIdealSize=t,this._onResize())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"layer",{get:function(){return this._layerToDispose},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"rootContainer",{get:function(){return this._rootContainer},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"focusedControl",{get:function(){return this._focusedControl},set:function(t){this._focusedControl!=t&&(this._focusedControl?this._focusedControl.onBlur():t.onFocus(),this._focusedControl=t)},enumerable:!0,configurable:!0}),r.prototype.executeOnAllControls=function(t,e){e||(e=this._rootContainer);for(var i=0,r=e.children;i1?o.notRenderable=!0:(o.notRenderable=!1,o._moveToProjectedPosition(u))}else t.Tools.SetImmediate((function(){o.linkWithMesh(null)}))}}(this._isDirty||this._rootContainer.isDirty)&&(this._isDirty=!1,this._render(),this.update())}},r.prototype._render=function(){var t=(this.getScene().getEngine(),this.getSize()),i=t.width,r=t.height,n=this.getContext();n.clearRect(0,0,i,r),this._background&&(n.save(),n.fillStyle=this._background,n.fillRect(0,0,i,r),n.restore()),n.font="18px Arial",n.strokeStyle="white";var s=new e.Measure(0,0,i,r);this._rootContainer._draw(s,n)},r.prototype._doPicking=function(e,i,r){var n=this.getScene(),s=n.getEngine(),o=this.getSize();if(this._isFullscreen&&(e*=o.width/s.getRenderWidth(),i*=o.height/s.getRenderHeight()),this._capturingControl)return void this._capturingControl._processObservables(r,e,i);this._rootContainer._processPicking(e,i,r)||r===t.PointerEventTypes.POINTERMOVE&&(this._lastControlOver&&this._lastControlOver._onPointerOut(),this._lastControlOver=null),this._manageFocus()},r.prototype.attach=function(){var e=this,i=this.getScene();this._pointerMoveObserver=i.onPrePointerObservable.add((function(r,n){if(r.type===t.PointerEventTypes.POINTERMOVE||r.type===t.PointerEventTypes.POINTERUP||r.type===t.PointerEventTypes.POINTERDOWN){var s=i.cameraToUseForPointers||i.activeCamera,o=i.getEngine(),h=s.viewport,a=(i.pointerX/o.getHardwareScalingLevel()-h.x*o.getRenderWidth())/h.width,u=(i.pointerY/o.getHardwareScalingLevel()-h.y*o.getRenderHeight())/h.height;e._shouldBlockPointer=!1,e._doPicking(a,u,r.type),r.skipOnPointerObservable=e._shouldBlockPointer&&r.type!==t.PointerEventTypes.POINTERUP}})),this._attachToOnPointerOut(i)},r.prototype.attachToMesh=function(e,i){var r=this;void 0===i&&(i=!0);var n=this.getScene();this._pointerObserver=n.onPointerObservable.add((function(i,n){if(i.type===t.PointerEventTypes.POINTERMOVE||i.type===t.PointerEventTypes.POINTERUP||i.type===t.PointerEventTypes.POINTERDOWN)if(i.pickInfo.hit&&i.pickInfo.pickedMesh===e){var s=i.pickInfo.getTextureCoordinates(),o=r.getSize();r._doPicking(s.x*o.width,(1-s.y)*o.height,i.type)}else i.type===t.PointerEventTypes.POINTERUP?(r._lastControlDown&&r._lastControlDown.forcePointerUp(),r._lastControlDown=null,r.focusedControl=null):i.type===t.PointerEventTypes.POINTERMOVE&&(r._lastControlOver&&r._lastControlOver._onPointerOut(),r._lastControlOver=null)})),e.enablePointerMoveEvents=i,this._attachToOnPointerOut(n)},r.prototype._manageFocus=function(){if(this._focusedControl&&this._focusedControl!==this._lastPickedControl){if(this._lastPickedControl.isFocusInvisible)return;this.focusedControl=null}},r.prototype._attachToOnPointerOut=function(t){var e=this;this._canvasPointerOutObserver=t.getEngine().onCanvasPointerOutObservable.add((function(){e._lastControlOver&&e._lastControlOver._onPointerOut(),e._lastControlOver=null,e._lastControlDown&&e._lastControlDown.forcePointerUp(),e._lastControlDown=null}))},r.CreateForMesh=function(e,i,n,s){void 0===i&&(i=1024),void 0===n&&(n=1024),void 0===s&&(s=!0);var o=new r(e.name+" AdvancedDynamicTexture",i,n,e.getScene(),!0,t.Texture.TRILINEAR_SAMPLINGMODE),h=new t.StandardMaterial("AdvancedDynamicTextureMaterial",e.getScene());return h.backFaceCulling=!1,h.diffuseColor=t.Color3.Black(),h.specularColor=t.Color3.Black(),h.emissiveTexture=o,h.opacityTexture=o,e.material=h,o.attachToMesh(e,s),o},r.CreateFullscreenUI=function(e,i,n){void 0===i&&(i=!0),void 0===n&&(n=null);var s=new r(e,0,0,n),o=new t.Layer(e+"_layer",null,n,!i);return o.texture=s,s._layerToDispose=o,s._isFullscreen=!0,s.attach(),s},r})(t.DynamicTexture);e.AdvancedDynamicTexture=i})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(t){var e=(function(){function t(t,e,i,r){this.left=t,this.top=e,this.width=i,this.height=r}return t.prototype.copyFrom=function(t){this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height},t.prototype.isEqualsTo=function(t){return this.left===t.left&&(this.top===t.top&&(this.width===t.width&&this.height===t.height))},t.Empty=function(){return new t(0,0,0,0)},t})();t.Measure=e})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(e){var i=(function(){function e(t,e,i,r,n,s){this.m=new Float32Array(6),this.fromValues(t,e,i,r,n,s)}return e.prototype.fromValues=function(t,e,i,r,n,s){return this.m[0]=t,this.m[1]=e,this.m[2]=i,this.m[3]=r,this.m[4]=n,this.m[5]=s,this},e.prototype.determinant=function(){return this.m[0]*this.m[3]-this.m[1]*this.m[2]},e.prototype.invertToRef=function(e){var i=this.m[0],r=this.m[1],n=this.m[2],s=this.m[3],o=this.m[4],h=this.m[5],a=this.determinant();if(a1)return void(this.notRenderable=!0);this.notRenderable=!1},i.prototype.linkWithMesh=function(e){if(!this._host||this._root!==this._host._rootContainer)return void t.Tools.Error("Cannot link a control to a mesh if the control is not at root level");var i=this._host._linkedControls.indexOf(this);if(-1!==i)return this._linkedMesh=e,void(e||this._host._linkedControls.splice(i,1));this.horizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT,this.verticalAlignment=t.GUI.Control.VERTICAL_ALIGNMENT_TOP,this._linkedMesh=e,this._host._linkedControls.push(this)},i.prototype._moveToProjectedPosition=function(t){this.left=t.x+this._linkOffsetX.getValue(this._host)-this._currentMeasure.width/2+"px",this.top=t.y+this._linkOffsetY.getValue(this._host)-this._currentMeasure.height/2+"px",this._left.ignoreAdaptiveScaling=!0,this._top.ignoreAdaptiveScaling=!0},i.prototype._markMatrixAsDirty=function(){this._isMatrixDirty=!0,this._markAsDirty()},i.prototype._markAsDirty=function(){this._isDirty=!0,this._host&&this._host.markAsDirty()},i.prototype._markAllAsDirty=function(){this._markAsDirty(),this._font&&this._prepareFont()},i.prototype._link=function(t,e){this._root=t,this._host=e},i.prototype._transform=function(t){if(this._isMatrixDirty||1!==this._scaleX||1!==this._scaleY||0!==this._rotation){var i=this._currentMeasure.width*this._transformCenterX+this._currentMeasure.left,r=this._currentMeasure.height*this._transformCenterY+this._currentMeasure.top;t.translate(i,r),t.rotate(this._rotation),t.scale(this._scaleX,this._scaleY),t.translate(-i,-r),(this._isMatrixDirty||this._cachedOffsetX!==i||this._cachedOffsetY!==r)&&(this._cachedOffsetX=i,this._cachedOffsetY=r,this._isMatrixDirty=!1,e.Matrix2D.ComposeToRef(-i,-r,this._rotation,this._scaleX,this._scaleY,this._root?this._root._transformMatrix:null,this._transformMatrix),this._transformMatrix.invertToRef(this._invertTransformMatrix))}},i.prototype._applyStates=function(t){this._fontSet&&(this._prepareFont(),this._fontSet=!1),this._font&&(t.font=this._font),this._color&&(t.fillStyle=this._color),this._alphaSet&&(t.globalAlpha=this._alpha)},i.prototype._processMeasures=function(t,e){return!this._isDirty&&this._cachedParentMeasure.isEqualsTo(t)||(this._isDirty=!1,this._currentMeasure.copyFrom(t),this._preMeasure(t,e),this._measure(),this._computeAlignment(t,e),this._currentMeasure.left=0|this._currentMeasure.left,this._currentMeasure.top=0|this._currentMeasure.top,this._currentMeasure.width=0|this._currentMeasure.width,this._currentMeasure.height=0|this._currentMeasure.height,this._additionalProcessing(t,e),this._cachedParentMeasure.copyFrom(t),this.onDirtyObservable.hasObservers()&&this.onDirtyObservable.notifyObservers(this)),!(this._currentMeasure.left>t.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.isVisible||this._doNotRender)&&(!!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(){return 0===this._enterCount&&(this._enterCount++,this.onPointerEnterObservable.hasObservers()&&this.onPointerEnterObservable.notifyObservers(this),!0)},i.prototype._onPointerOut=function(){this._enterCount=0,this.onPointerOutObservable.hasObservers()&&this.onPointerOutObservable.notifyObservers(this)},i.prototype._onPointerDown=function(t){return 0===this._downCount&&(this._downCount++,this.onPointerDownObservable.hasObservers()&&this.onPointerDownObservable.notifyObservers(t),!0)},i.prototype._onPointerUp=function(t){this._downCount=0,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,this._host._lastPickedControl=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._font||this._fontSet)&&(this._font=this._fontStyle+" "+this._fontSize.getValue(this._host)+"px "+this._fontFamily,this._fontOffset=i._GetFontOffset(this._font))},i.prototype.dispose=function(){this.onDirtyObservable.clear(),this.onPointerDownObservable.clear(),this.onPointerEnterObservable.clear(),this.onPointerMoveObservable.clear(),this.onPointerOutObservable.clear(),this.onPointerUpObservable.clear()},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{document.body.removeChild(n)}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 u=new t.GUI.TextBlock("header");return u.text=r,u.textHorizontalAlignment=i.HORIZONTAL_ALIGNMENT_LEFT,h?u.width=n:u.height=n,a?(o.addControl(e),o.addControl(u),u.paddingLeft="5px"):(o.addControl(u),o.addControl(e),u.paddingRight="5px"),o},i.drawEllipse=function(t,e,i,r,n){n.translate(t,e),n.scale(i,r),n.beginPath(),n.arc(0,0,1,0,2*Math.PI),n.closePath(),n.scale(1/i,1/r),n.translate(-t,-e)},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={},i})();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._getTypeName=function(){return"Container"},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.prototype.dispose=function(){e.prototype.dispose.call(this);for(var t=0,i=this._children;tn&&(n=a._currentMeasure.width),a.verticalAlignment=t.GUI.Control.VERTICAL_ALIGNMENT_TOP):(a.left=n+"px",a._left.ignoreAdaptiveScaling||a._markAsDirty(),a._left.ignoreAdaptiveScaling=!0,n+=a._currentMeasure.width,a._currentMeasure.height>s&&(s=a._currentMeasure.height),a.horizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT),a._currentMeasure.copyFrom(this._tempMeasureStore)}this._doNotTrackManualChanges=!0;var u=!1,_=!1,c=this.height,l=this.width;this._manualHeight||(this.height=s+"px"),this._manualWidth||(this.width=n+"px"),u=l!==this.width||!this._width.ignoreAdaptiveScaling,_=c!==this.height||!this._height.ignoreAdaptiveScaling,_&&(this._height.ignoreAdaptiveScaling=!0),u&&(this._width.ignoreAdaptiveScaling=!0),this._doNotTrackManualChanges=!1,(u||_)&&this._markAllAsDirty(),i.prototype._preMeasure.call(this,e,r)},r})(e.Container);e.StackPanel=i})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(t){var e=(function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thickness=1,i._cornerRadius=0,i}return __extends(e,t),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cornerRadius",{get:function(){return this._cornerRadius},set:function(t){t<0&&(t=0),this._cornerRadius!==t&&(this._cornerRadius=t,this._markAsDirty())},enumerable:!0,configurable:!0}),e.prototype._getTypeName=function(){return"Rectangle"},e.prototype._localDraw=function(t){t.save(),this._background&&(t.fillStyle=this._background,this._cornerRadius?(this._drawRoundedRect(t,this._thickness/2),t.fill()):t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._thickness&&(this.color&&(t.strokeStyle=this.color),t.lineWidth=this._thickness,this._cornerRadius?(this._drawRoundedRect(t,this._thickness/2),t.stroke()):t.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness)),t.restore()},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},e.prototype._drawRoundedRect=function(t,e){void 0===e&&(e=0);var i=this._currentMeasure.left+e,r=this._currentMeasure.top+e,n=this._currentMeasure.width-2*e,s=this._currentMeasure.height-2*e,o=Math.min(s/2-2,Math.min(n/2-2,this._cornerRadius));t.beginPath(),t.moveTo(i+o,r),t.lineTo(i+n-o,r),t.quadraticCurveTo(i+n,r,i+n,r+o),t.lineTo(i+n,r+s-o),t.quadraticCurveTo(i+n,r+s,i+n-o,r+s),t.lineTo(i+o,r+s),t.quadraticCurveTo(i,r+s,i,r+s-o),t.lineTo(i,r+o),t.quadraticCurveTo(i,r,i+o,r),t.closePath()},e.prototype._clipForChildren=function(t){this._cornerRadius&&(this._drawRoundedRect(t,this._thickness),t.clip())},e})(t.Container);t.Rectangle=e})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(t){var e=(function(e){function i(t){var i=e.call(this,t)||this;return i.name=t,i._thickness=1,i}return __extends(i,e),Object.defineProperty(i.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!0,configurable:!0}),i.prototype._getTypeName=function(){return"Ellipse"},i.prototype._localDraw=function(e){e.save(),t.Control.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2-this._thickness/2,this._currentMeasure.height/2-this._thickness/2,e),this._background&&(e.fillStyle=this._background,e.fill()),this._thickness&&(this.color&&(e.strokeStyle=this.color),e.lineWidth=this._thickness,e.stroke()),e.restore()},i.prototype._additionalProcessing=function(t,i){e.prototype._additionalProcessing.call(this,t,i),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},i.prototype._clipForChildren=function(e){t.Control.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2,this._currentMeasure.height/2,e),e.clip()},i})(t.Container);t.Ellipse=e})(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._lineWidth=1,r._x1=new t.ValueAndUnit(0),r._y1=new t.ValueAndUnit(0),r._x2=new t.ValueAndUnit(0),r._y2=new t.ValueAndUnit(0),r._dash=new Array,r.isHitTestVisible=!1,r._horizontalAlignment=t.Control.HORIZONTAL_ALIGNMENT_LEFT,r._verticalAlignment=t.Control.VERTICAL_ALIGNMENT_TOP,r}return __extends(i,e),Object.defineProperty(i.prototype,"dash",{get:function(){return this._dash},set:function(t){this._dash!==t&&(this._dash=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"connectedControl",{get:function(){return this._connectedControl},set:function(t){var e=this;this._connectedControl!==t&&(this._connectedControlDirtyObserver&&this._connectedControl&&(this._connectedControl.onDirtyObservable.remove(this._connectedControlDirtyObserver),this._connectedControlDirtyObserver=null),t&&(this._connectedControlDirtyObserver=t.onDirtyObservable.add((function(){return e._markAsDirty()}))),this._connectedControl=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"x1",{get:function(){return this._x1.toString(this._host)},set:function(t){this._x1.toString(this._host)!==t&&this._x1.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"y1",{get:function(){return this._y1.toString(this._host)},set:function(t){this._y1.toString(this._host)!==t&&this._y1.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"x2",{get:function(){return this._x2.toString(this._host)},set:function(t){this._x2.toString(this._host)!==t&&this._x2.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"y2",{get:function(){return this._y2.toString(this._host)},set:function(t){this._y2.toString(this._host)!==t&&this._y2.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(t){this._lineWidth!==t&&(this._lineWidth=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"horizontalAlignment",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"verticalAlignment",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_effectiveX2",{get:function(){return(this._connectedControl?this._connectedControl.centerX:0)+this._x2.getValue(this._host)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_effectiveY2",{get:function(){return(this._connectedControl?this._connectedControl.centerY:0)+this._y2.getValue(this._host)},enumerable:!0,configurable:!0}),i.prototype._getTypeName=function(){return"Line"},i.prototype._draw=function(t,e){e.save(),this._applyStates(e),this._processMeasures(t,e)&&(e.strokeStyle=this.color,e.lineWidth=this._lineWidth,e.setLineDash(this._dash),e.beginPath(),e.moveTo(this._x1.getValue(this._host),this._y1.getValue(this._host)),e.lineTo(this._effectiveX2,this._effectiveY2),e.stroke()),e.restore()},i.prototype._measure=function(){this._currentMeasure.width=Math.abs(this._x1.getValue(this._host)-this._effectiveX2)+this._lineWidth,this._currentMeasure.height=Math.abs(this._y1.getValue(this._host)-this._effectiveY2)+this._lineWidth},i.prototype._computeAlignment=function(t,e){this._currentMeasure.left=Math.min(this._x1.getValue(this._host),this._effectiveX2)-this._lineWidth/2,this._currentMeasure.top=Math.min(this._y1.getValue(this._host),this._effectiveY2)-this._lineWidth/2},i.prototype._moveToProjectedPosition=function(t){this.x1=t.x+this._linkOffsetX.getValue(this._host)+"px",this.y1=t.y+this._linkOffsetY.getValue(this._host)+"px",this._x1.ignoreAdaptiveScaling=!0,this._y1.ignoreAdaptiveScaling=!0},i})(t.Control);t.Line=e})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(e){var i=(function(i){function r(r){var n=i.call(this,r)||this;return n.name=r,n._thumbWidth=new e.ValueAndUnit(30,e.ValueAndUnit.UNITMODE_PIXEL,!1),n._minimum=0,n._maximum=100,n._value=50,n._background="black",n._borderColor="white",n._barOffset=new e.ValueAndUnit(5,e.ValueAndUnit.UNITMODE_PIXEL,!1),n.onValueChangedObservable=new t.Observable,n._pointerIsDown=!1,n.isPointerBlocker=!0,n}return __extends(r,i),Object.defineProperty(r.prototype,"borderColor",{get:function(){return this._borderColor},set:function(t){this._borderColor!==t&&(this._borderColor=t,this._markAsDirty())},enumerable:!0,configurable:!0}),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,"barOffset",{get:function(){return this._barOffset.toString(this._host)},set:function(t){this._barOffset.toString(this._host)!==t&&this._barOffset.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"thumbWidth",{get:function(){return this._thumbWidth.toString(this._host)},set:function(t){this._thumbWidth.toString(this._host)!==t&&this._thumbWidth.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"minimum",{get:function(){return this._minimum},set:function(t){this._minimum!==t&&(this._minimum=t,this._markAsDirty(),this.value=Math.max(Math.min(this.value,this._maximum),this._minimum))},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"maximum",{get:function(){return this._maximum},set:function(t){this._maximum!==t&&(this._maximum=t,this._markAsDirty(),this.value=Math.max(Math.min(this.value,this._maximum),this._minimum))},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"value",{get:function(){return this._value},set:function(t){t=Math.max(Math.min(t,this._maximum),this._minimum),this._value!==t&&(this._value=t,this._markAsDirty(),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!0,configurable:!0}),r.prototype._getTypeName=function(){return"Slider"},r.prototype._draw=function(t,e){if(e.save(),this._applyStates(e),this._processMeasures(t,e)){var i,r;i=this._thumbWidth.isPixel?Math.min(this._thumbWidth.getValue(this._host),this._currentMeasure.height):this._currentMeasure.height*this._thumbWidth.getValue(this._host),r=this._barOffset.isPixel?Math.min(this._barOffset.getValue(this._host),this._currentMeasure.height):this._currentMeasure.height*this._barOffset.getValue(this._host);var n=this._currentMeasure.left+i/2,s=this._currentMeasure.width-i,o=(this._value-this._minimum)/(this._maximum-this._minimum)*s;e.fillStyle=this._background,e.fillRect(n,this._currentMeasure.top+r,s,this._currentMeasure.height-2*r),e.fillStyle=this.color,e.fillRect(n,this._currentMeasure.top+r,o,this._currentMeasure.height-2*r),e.fillRect(n+o-i/2,this._currentMeasure.top,i,this._currentMeasure.height),e.strokeStyle=this._borderColor,e.strokeRect(n+o-i/2,this._currentMeasure.top,i,this._currentMeasure.height)}e.restore()},r.prototype._updateValueFromPointer=function(t){this.value=this._minimum+(t-this._currentMeasure.left)/this._currentMeasure.width*(this._maximum-this._minimum)},r.prototype._onPointerDown=function(t){return!!i.prototype._onPointerDown.call(this,t)&&(this._pointerIsDown=!0,this._updateValueFromPointer(t.x),this._host._capturingControl=this,!0)},r.prototype._onPointerMove=function(t){this._pointerIsDown&&this._updateValueFromPointer(t.x)},r.prototype._onPointerUp=function(t){this._pointerIsDown=!1,this._host._capturingControl=null,i.prototype._onPointerUp.call(this,t)},r})(e.Control);e.Slider=i})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(e){var i=(function(e){function i(i){var r=e.call(this,i)||this;return r.name=i,r._isChecked=!1,r._background="black",r._checkSizeRatio=.8,r._thickness=1,r.onIsCheckedChangedObservable=new t.Observable,r.isPointerBlocker=!0,r}return __extends(i,e),Object.defineProperty(i.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"checkSizeRatio",{get:function(){return this._checkSizeRatio},set:function(t){t=Math.max(Math.min(1,t),0),this._checkSizeRatio!==t&&(this._checkSizeRatio=t,this._markAsDirty())},enumerable:!0,configurable:!0}),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,"isChecked",{get:function(){return this._isChecked},set:function(t){this._isChecked!==t&&(this._isChecked=t,this._markAsDirty(),this.onIsCheckedChangedObservable.notifyObservers(t))},enumerable:!0,configurable:!0}),i.prototype._getTypeName=function(){return"CheckBox"},i.prototype._draw=function(t,e){if(e.save(),this._applyStates(e),this._processMeasures(t,e)){var i=this._currentMeasure.width-this._thickness,r=this._currentMeasure.height-this._thickness;if(e.fillStyle=this._background,e.fillRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,i,r),this._isChecked){e.fillStyle=this.color;var n=i*this._checkSizeRatio,s=r*this._checkSizeRatio;e.fillRect(this._currentMeasure.left+this._thickness/2+(i-n)/2,this._currentMeasure.top+this._thickness/2+(r-s)/2,n,s)}e.strokeStyle=this.color,e.lineWidth=this._thickness,e.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,i,r)}e.restore()},i.prototype._onPointerDown=function(t){return!!e.prototype._onPointerDown.call(this,t)&&(this.isChecked=!this.isChecked,!0)},i})(e.Control);e.Checkbox=i})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(e){var i=(function(i){function r(e){var r=i.call(this,e)||this;return r.name=e,r._isChecked=!1,r._background="black",r._checkSizeRatio=.8,r._thickness=1,r.group="",r.onIsCheckedChangedObservable=new t.Observable,r.isPointerBlocker=!0,r}return __extends(r,i),Object.defineProperty(r.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"checkSizeRatio",{get:function(){return this._checkSizeRatio},set:function(t){t=Math.max(Math.min(1,t),0),this._checkSizeRatio!==t&&(this._checkSizeRatio=t,this._markAsDirty())},enumerable:!0,configurable:!0}),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,"isChecked",{get:function(){return this._isChecked},set:function(t){var e=this;this._isChecked!==t&&(this._isChecked=t,this._markAsDirty(),this.onIsCheckedChangedObservable.notifyObservers(t),this._isChecked&&this._host.executeOnAllControls((function(t){if(t!==e&&void 0!==t.group){var i=t;i.group===e.group&&(i.isChecked=!1)}})))},enumerable:!0,configurable:!0}),r.prototype._getTypeName=function(){return"RadioButton"},r.prototype._draw=function(t,i){if(i.save(),this._applyStates(i),this._processMeasures(t,i)){var r=this._currentMeasure.width-this._thickness,n=this._currentMeasure.height-this._thickness;if(e.Control.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2-this._thickness/2,this._currentMeasure.height/2-this._thickness/2,i),i.fillStyle=this._background,i.fill(),i.strokeStyle=this.color,i.lineWidth=this._thickness,i.stroke(),this._isChecked){i.fillStyle=this.color;var s=r*this._checkSizeRatio,o=n*this._checkSizeRatio;e.Control.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,s/2-this._thickness/2,o/2-this._thickness/2,i),i.fill()}}i.restore()},r.prototype._onPointerDown=function(t){return!!i.prototype._onPointerDown.call(this,t)&&(this.isChecked=!this.isChecked,!0)},r})(e.Control);e.RadioButton=i})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(t){var e=(function(e){function i(i,r){void 0===r&&(r="");var n=e.call(this,i)||this;return n.name=i,n._text="",n._textWrapping=!1,n._textHorizontalAlignment=t.Control.HORIZONTAL_ALIGNMENT_CENTER,n._textVerticalAlignment=t.Control.VERTICAL_ALIGNMENT_CENTER,n.text=r,n}return __extends(i,e),Object.defineProperty(i.prototype,"textWrapping",{get:function(){return this._textWrapping},set:function(t){this._textWrapping!==t&&(this._textWrapping=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textHorizontalAlignment",{get:function(){return this._textHorizontalAlignment},set:function(t){this._textHorizontalAlignment!==t&&(this._textHorizontalAlignment=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textVerticalAlignment",{get:function(){return this._textVerticalAlignment},set:function(t){this._textVerticalAlignment!==t&&(this._textVerticalAlignment=t,this._markAsDirty())},enumerable:!0,configurable:!0}),i.prototype._getTypeName=function(){return"TextBlock"},i.prototype._drawText=function(e,i,r,n){var s=this._currentMeasure.width,o=0;switch(this._textHorizontalAlignment){case t.Control.HORIZONTAL_ALIGNMENT_LEFT:o=0;break;case t.Control.HORIZONTAL_ALIGNMENT_RIGHT:o=s-i;break;case t.Control.HORIZONTAL_ALIGNMENT_CENTER:o=(s-i)/2}n.fillText(e,this._currentMeasure.left+o,r)},i.prototype._draw=function(t,e){e.save(),this._applyStates(e),this._processMeasures(t,e)&&this._renderLines(e),e.restore()},i.prototype._additionalProcessing=function(t,e){this._lines=[];var i=this.text.split("\n");if(this._textWrapping)for(var r=0,n=i;r0?t+" "+i[s]:i[0],h=e.measureText(o),a=h.width;a>r&&s>0?(this._lines.push({text:t,width:n}),t=i[s],n=e.measureText(t).width):(n=a,t=o)}return{text:t,width:n}},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;nh||l150?.04:-.16*(t-50)/100+.2;var g=(f-a)/(t-a);s[d+3]=g1-m?255*(1-(g-(1-m))/m):255}}return r.putImageData(n,0,0),i},i.prototype._RGBtoHSV=function(t,e){var i=t.r,r=t.g,n=t.b,s=Math.max(i,r,n),o=Math.min(i,r,n),h=0,a=0,u=s,_=s-o;0!==s&&(a=_/s),s!=o&&(s==i?(h=(r-n)/_,r=0&&s<=1?(h=n,a=o):s>=1&&s<=2?(h=o,a=n):s>=2&&s<=3?(a=n,u=o):s>=3&&s<=4?(a=o,u=n):s>=4&&s<=5?(h=o,u=n):s>=5&&s<=6&&(h=n,u=o);var _=i-n;r.set(h+_,a+_,u+_)},i.prototype._draw=function(t,e){if(e.save(),this._applyStates(e),this._processMeasures(t,e)){var i=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),r=.2*i,n=this._currentMeasure.left,s=this._currentMeasure.top;this._colorWheelCanvas&&this._colorWheelCanvas.width==2*i||(this._colorWheelCanvas=this._createColorWheelCanvas(i,r)),e.drawImage(this._colorWheelCanvas,n,s),this._updateSquareProps(),this._drawGradientSquare(this._h,this._squareLeft,this._squareTop,this._squareSize,this._squareSize,e);var o=this._squareLeft+this._squareSize*this._s,h=this._squareTop+this._squareSize*(1-this._v);this._drawCircle(o,h,.04*i,e);var a=i-.5*r;o=n+i+Math.cos((this._h-180)*Math.PI/180)*a,h=s+i+Math.sin((this._h-180)*Math.PI/180)*a,this._drawCircle(o,h,.35*r,e)}e.restore()},i.prototype._updateValueFromPointer=function(t,e){if(this._pointerStartedOnWheel){var i=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),r=i+this._currentMeasure.left,n=i+this._currentMeasure.top;this._h=180*Math.atan2(e-n,t-r)/Math.PI+180}else this._pointerStartedOnSquare&&(this._updateSquareProps(),this._s=(t-this._squareLeft)/this._squareSize,this._v=1-(e-this._squareTop)/this._squareSize,this._s=Math.min(this._s,1),this._s=Math.max(this._s,1e-5),this._v=Math.min(this._v,1),this._v=Math.max(this._v,1e-5));this._HSVtoRGB(this._h,this._s,this._v,this._tmpColor),this.value=this._tmpColor},i.prototype._isPointOnSquare=function(t){this._updateSquareProps();var e=this._squareLeft,i=this._squareTop,r=this._squareSize;return t.x>=e&&t.x<=e+r&&t.y>=i&&t.y<=i+r},i.prototype._isPointOnWheel=function(t){var e=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),i=e+this._currentMeasure.left,r=e+this._currentMeasure.top,n=.2*e,s=e-n,o=e*e,h=s*s,a=t.x-i,u=t.y-r,_=a*a+u*u;return _<=o&&_>=h},i.prototype._onPointerDown=function(t){return!!e.prototype._onPointerDown.call(this,t)&&(this._pointerIsDown=!0,this._pointerStartedOnSquare=!1,this._pointerStartedOnWheel=!1,this._isPointOnSquare(t)?this._pointerStartedOnSquare=!0:this._isPointOnWheel(t)&&(this._pointerStartedOnWheel=!0),this._updateValueFromPointer(t.x,t.y),this._host._capturingControl=this,!0)},i.prototype._onPointerMove=function(t){this._pointerIsDown&&this._updateValueFromPointer(t.x,t.y),e.prototype._onPointerMove.call(this,t)},i.prototype._onPointerUp=function(t){this._pointerIsDown=!1,this._host._capturingControl=null,e.prototype._onPointerUp.call(this,t)},i})(e.Control);e.ColorPicker=i})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(e){var i=(function(i){function r(r,n){void 0===n&&(n="");var s=i.call(this,r)||this;return s.name=r,s._text="",s._background="black",s._focusedBackground="black",s._thickness=1,s._margin=new e.ValueAndUnit(10,e.ValueAndUnit.UNITMODE_PIXEL),s._autoStretchWidth=!0,s._maxWidth=new e.ValueAndUnit(1,e.ValueAndUnit.UNITMODE_PERCENTAGE,!1),s._isFocused=!1,s._blinkIsEven=!1,s._cursorOffset=0,s.promptMessage="Please enter text:",s.onTextChangedObservable=new t.Observable,s.onFocusObservable=new t.Observable,s.onBlurObservable=new t.Observable,s.text=n,s}return __extends(r,i),Object.defineProperty(r.prototype,"maxWidth",{get:function(){return this._maxWidth.toString(this._host)},set:function(t){this._maxWidth.toString(this._host)!==t&&this._maxWidth.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"margin",{get:function(){return this._margin.toString(this._host)},set:function(t){this._margin.toString(this._host)!==t&&this._margin.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"autoStretchWidth",{get:function(){return this._autoStretchWidth},set:function(t){this._autoStretchWidth!==t&&(this._autoStretchWidth=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"focusedBackground",{get:function(){return this._focusedBackground},set:function(t){this._focusedBackground!==t&&(this._focusedBackground=t,this._markAsDirty())},enumerable:!0,configurable:!0}),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,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t,this._markAsDirty(),this.onTextChangedObservable.notifyObservers(this))},enumerable:!0,configurable:!0}),r.prototype.onBlur=function(){this._isFocused=!1,this._scrollLeft=null,this._cursorOffset=0,clearTimeout(this._blinkTimeout),this._markAsDirty(),this.onBlurObservable.notifyObservers(this)},r.prototype.onFocus=function(){if(this._scrollLeft=null,this._isFocused=!0,this._blinkIsEven=!1,this._cursorOffset=0,this._markAsDirty(),this.onFocusObservable.notifyObservers(this),-1!==navigator.userAgent.indexOf("Mobile"))return this.text=prompt(this.promptMessage),void(this._host.focusedControl=null)},r.prototype._getTypeName=function(){return"InputText"},r.prototype.processKey=function(t,e){switch(t){case 8:if(this._text&&this._text.length>0)if(0===this._cursorOffset)this.text=this._text.substr(0,this._text.length-1);else{var i=this._text.length-this._cursorOffset;i>0&&(this.text=this._text.slice(0,i-1)+this._text.slice(i))}return;case 46:if(this._text&&this._text.length>0){var i=this._text.length-this._cursorOffset;this.text=this._text.slice(0,i)+this._text.slice(i+1),this._cursorOffset--}return;case 13:return void(this._host.focusedControl=null);case 35:return this._cursorOffset=0,this._blinkIsEven=!1,void this._markAsDirty();case 36:return this._cursorOffset=this._text.length,this._blinkIsEven=!1,void this._markAsDirty();case 37:return this._cursorOffset++,this._cursorOffset>this._text.length&&(this._cursorOffset=this._text.length),this._blinkIsEven=!1,void this._markAsDirty();case 39:return this._cursorOffset--,this._cursorOffset<0&&(this._cursorOffset=0),this._blinkIsEven=!1,void this._markAsDirty()}if(-1===t||32===t||t>47&&t<58||t>64&&t<91||t>185&&t<193||t>218&&t<223||t>95&&t<112)if(0===this._cursorOffset)this.text+=e;else{var r=this._text.length-this._cursorOffset;this.text=this._text.slice(0,r)+e+this._text.slice(r)}},r.prototype.processKeyboard=function(t){this.processKey(t.keyCode,t.key)},r.prototype._draw=function(t,i){var r=this;if(i.save(),this._applyStates(i),this._processMeasures(t,i)){this._isFocused?this._focusedBackground&&(i.fillStyle=this._focusedBackground,i.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)):this._background&&(i.fillStyle=this._background,i.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._fontOffset||(this._fontOffset=e.Control._GetFontOffset(i.font));var n=this._currentMeasure.left+this._margin.getValueInPixel(this._host,t.width);this.color&&(i.fillStyle=this.color);var s=i.measureText(this._text).width,o=2*this._margin.getValueInPixel(this._host,t.width);this._autoStretchWidth&&(this.width=Math.min(this._maxWidth.getValueInPixel(this._host,t.width),s+o)+"px");var h=this._fontOffset.ascent+(this._currentMeasure.height-this._fontOffset.height)/2,a=this._width.getValueInPixel(this._host,t.width)-o;if(i.save(),i.beginPath(),i.rect(n,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,a+2,this._currentMeasure.height),i.clip(),this._isFocused&&s>a){var u=n-s+a;this._scrollLeft||(this._scrollLeft=u)}else this._scrollLeft=n;if(i.fillText(this._text,this._scrollLeft,this._currentMeasure.top+h),this._isFocused){if(!this._blinkIsEven){var _=this.text.substr(this._text.length-this._cursorOffset),c=i.measureText(_).width,l=this._scrollLeft+s-c;ln+a&&(this._scrollLeft+=n+a-l,l=n+a,this._markAsDirty()),i.fillRect(l,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,2,this._fontOffset.height)}clearTimeout(this._blinkTimeout),this._blinkTimeout=setTimeout((function(){r._blinkIsEven=!r._blinkIsEven,r._markAsDirty()}),500)}i.restore(),this._thickness&&(this.color&&(i.strokeStyle=this.color),i.lineWidth=this._thickness,i.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness))}i.restore()},r.prototype._onPointerDown=function(t){return!!i.prototype._onPointerDown.call(this,t)&&(this._host.focusedControl=this,!0)},r.prototype._onPointerUp=function(t){i.prototype._onPointerUp.call(this,t)},r.prototype.dispose=function(){i.prototype.dispose.call(this),this.onBlurObservable.clear(),this.onFocusObservable.clear(),this.onTextChangedObservable.clear()},r})(e.Control);e.InputText=i})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(e){var i=(function(){function t(){}return t})();e.KeyPropertySet=i;var r=(function(i){function r(){var e=null!==i&&i.apply(this,arguments)||this;return e.onKeyPressObservable=new t.Observable,e.defaultButtonWidth="40px",e.defaultButtonHeight="40px",e.defaultButtonPaddingLeft="2px",e.defaultButtonPaddingRight="2px",e.defaultButtonPaddingTop="2px",e.defaultButtonPaddingBottom="2px",e.defaultButtonColor="#DDD",e.defaultButtonBackground="#070707",e}return __extends(r,i),r.prototype._getTypeName=function(){return"VirtualKeyboard"},r.prototype._createKey=function(t,i){var r=this,n=e.Button.CreateSimpleButton(t,t);return n.width=i&&i.width?i.width:this.defaultButtonWidth,n.height=i&&i.height?i.height:this.defaultButtonHeight,n.color=i&&i.color?i.color:this.defaultButtonColor,n.background=i&&i.background?i.background:this.defaultButtonBackground,n.paddingLeft=i&&i.paddingLeft?i.paddingLeft:this.defaultButtonPaddingLeft,n.paddingRight=i&&i.paddingRight?i.paddingRight:this.defaultButtonPaddingRight,n.paddingTop=i&&i.paddingTop?i.paddingTop:this.defaultButtonPaddingTop,n.paddingBottom=i&&i.paddingBottom?i.paddingBottom:this.defaultButtonPaddingBottom,n.thickness=0,n.isFocusInvisible=!0,n.onPointerUpObservable.add((function(){r.onKeyPressObservable.notifyObservers(t)})),n},r.prototype.addKeysRow=function(t,i){var r=new e.StackPanel;r.isVertical=!1,r.isFocusInvisible=!0;for(var n=0;n