-
Notifications
You must be signed in to change notification settings - Fork 33
/
babylon.gui.min.js
4 lines (4 loc) · 101 KB
/
babylon.gui.min.js
1
2
3
4
!(function(t,e){var i=[],r=t.BABYLON||this.BABYLON;"object"==typeof exports&&"object"==typeof module?(r=r||require("babylonjs"),module.exports=e(r)):"function"==typeof define&&define.amd?(i.push("babylonjs"),define("babylonjs-gui",i,e)):"object"==typeof exports?(r=r||require("babylonjs"),exports["babylonjs-gui"]=e(r)):t.BABYLON.GUI=e(r)})(this,(function(t){t=t||this.BABYLON;var t,e=(this&&this.__decorate,this&&this.__extends||(function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}})());!(function(t){!(function(i){var r=(function(r){function s(e,s,n,o,h,a){void 0===s&&(s=0),void 0===n&&(n=0),void 0===h&&(h=!1),void 0===a&&(a=t.Texture.NEAREST_SAMPLINGMODE);var u=r.call(this,e,{width:s,height:n},o,h,a,t.Engine.TEXTUREFORMAT_RGBA)||this;return u._isDirty=!1,u._rootContainer=new i.Container("root"),u._lastControlOver={},u._lastControlDown={},u._capturingControl={},u._linkedControls=new Array,u._isFullscreen=!1,u._fullscreenViewport=new t.Viewport(0,0,1,1),u._idealWidth=0,u._idealHeight=0,u._useSmallestIdeal=!1,u._renderAtIdealSize=!1,u._blockNextFocusCheck=!1,u._renderScale=1,(o=u.getScene())&&u._texture?(u._renderObserver=o.onBeforeCameraRenderObservable.add((function(t){return u._checkUpdate(t)})),u._preKeyboardObserver=o.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,s&&n||(u._resizeObserver=o.getEngine().onResizeObservable.add((function(){return u._onResize()})),u._onResize()),u._texture.isReady=!0,u):u}return e(s,r),Object.defineProperty(s.prototype,"renderScale",{get:function(){return this._renderScale},set:function(t){t!==this._renderScale&&(this._renderScale=t,this._onResize())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this.markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.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(s.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(s.prototype,"useSmallestIdeal",{get:function(){return this._useSmallestIdeal},set:function(t){this._useSmallestIdeal!==t&&(this._useSmallestIdeal=t,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"renderAtIdealSize",{get:function(){return this._renderAtIdealSize},set:function(t){this._renderAtIdealSize!==t&&(this._renderAtIdealSize=t,this._onResize())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"layer",{get:function(){return this._layerToDispose},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"rootContainer",{get:function(){return this._rootContainer},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"focusedControl",{get:function(){return this._focusedControl},set:function(t){this._focusedControl!=t&&(this._focusedControl&&this._focusedControl.onBlur(),t&&t.onFocus(),this._focusedControl=t)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"isForeground",{get:function(){return!this.layer||!this.layer.isBackground},set:function(t){this.layer&&this.layer.isBackground!==!t&&(this.layer.isBackground=!t)},enumerable:!0,configurable:!0}),s.prototype.executeOnAllControls=function(t,e){e||(e=this._rootContainer);for(var i=0,r=e.children;i<r.length;i++){var s=r[i];s.children?this.executeOnAllControls(t,s):t(s)}},s.prototype.markAsDirty=function(){this._isDirty=!0,this.executeOnAllControls((function(t){t._isFontSizeInPercentage&&t._resetFontCache()}))},s.prototype.addControl=function(t){return this._rootContainer.addControl(t),this},s.prototype.removeControl=function(t){return this._rootContainer.removeControl(t),this},s.prototype.dispose=function(){var t=this.getScene();t&&(t.onBeforeCameraRenderObservable.remove(this._renderObserver),this._resizeObserver&&t.getEngine().onResizeObservable.remove(this._resizeObserver),this._pointerMoveObserver&&t.onPrePointerObservable.remove(this._pointerMoveObserver),this._pointerObserver&&t.onPointerObservable.remove(this._pointerObserver),this._preKeyboardObserver&&t.onPreKeyboardObservable.remove(this._preKeyboardObserver),this._canvasPointerOutObserver&&t.getEngine().onCanvasPointerOutObservable.remove(this._canvasPointerOutObserver),this._layerToDispose&&(this._layerToDispose.texture=null,this._layerToDispose.dispose(),this._layerToDispose=null),this._rootContainer.dispose(),r.prototype.dispose.call(this))},s.prototype._onResize=function(){var t=this.getScene();if(t){var e=t.getEngine(),i=this.getSize(),r=e.getRenderWidth()*this._renderScale,s=e.getRenderHeight()*this._renderScale;this._renderAtIdealSize&&(this._idealWidth?(s=s*this._idealWidth/r,r=this._idealWidth):this._idealHeight&&(r=r*this._idealHeight/s,s=this._idealHeight)),i.width===r&&i.height===s||(this.scaleTo(r,s),this.markAsDirty(),(this._idealWidth||this._idealHeight)&&this._rootContainer._markAllAsDirty())}},s.prototype._getGlobalViewport=function(t){var e=t.getEngine();return this._fullscreenViewport.toGlobal(e.getRenderWidth(),e.getRenderHeight())},s.prototype.getProjectedPosition=function(e,i){var r=this.getScene();if(!r)return t.Vector2.Zero();var s=this._getGlobalViewport(r),n=t.Vector3.Project(e,i,r.getTransformMatrix(),s);return n.scaleInPlace(this.renderScale),new t.Vector2(n.x,n.y)},s.prototype._checkUpdate=function(e){if(!this._layerToDispose||0!=(e.layerMask&this._layerToDispose.layerMask)){if(this._isFullscreen&&this._linkedControls.length){var i=this.getScene();if(!i)return;for(var r=this._getGlobalViewport(i),s=0,n=this._linkedControls;s<n.length;s++){var o=n[s];if(o.isVisible){var h=o._linkedMesh;if(h&&!h.isDisposed()){var a=h.getBoundingInfo().boundingSphere.center,u=t.Vector3.Project(a,h.getWorldMatrix(),i.getTransformMatrix(),r);u.z<0||u.z>1?o.notRenderable=!0:(o.notRenderable=!1,u.scaleInPlace(this.renderScale),o._moveToProjectedPosition(u))}else t.Tools.SetImmediate((function(){o.linkWithMesh(null)}))}}}(this._isDirty||this._rootContainer.isDirty)&&(this._isDirty=!1,this._render(),this.update())}},s.prototype._render=function(){var t=this.getSize(),e=t.width,r=t.height,s=this.getContext();s.clearRect(0,0,e,r),this._background&&(s.save(),s.fillStyle=this._background,s.fillRect(0,0,e,r),s.restore()),s.font="18px Arial",s.strokeStyle="white";var n=new i.Measure(0,0,e,r);this._rootContainer._draw(n,s)},s.prototype._doPicking=function(e,i,r,s,n){var o=this.getScene();if(o){var h=o.getEngine(),a=this.getSize();if(this._isFullscreen&&(e*=a.width/h.getRenderWidth(),i*=a.height/h.getRenderHeight()),this._capturingControl[s])return void this._capturingControl[s]._processObservables(r,e,i,s,n);this._rootContainer._processPicking(e,i,r,s,n)||r===t.PointerEventTypes.POINTERMOVE&&(this._lastControlOver[s]&&this._lastControlOver[s]._onPointerOut(this._lastControlOver[s]),delete this._lastControlOver[s]),this._manageFocus()}},s.prototype._cleanControlAfterRemovalFromList=function(t,e){for(var i in t)if(t.hasOwnProperty(i)){var r=t[i];r===e&&delete t[i]}},s.prototype._cleanControlAfterRemoval=function(t){this._cleanControlAfterRemovalFromList(this._lastControlDown,t),this._cleanControlAfterRemovalFromList(this._lastControlOver,t)},s.prototype.attach=function(){var e=this,i=this.getScene();i&&(this._pointerMoveObserver=i.onPrePointerObservable.add((function(r,s){if((r.type===t.PointerEventTypes.POINTERMOVE||r.type===t.PointerEventTypes.POINTERUP||r.type===t.PointerEventTypes.POINTERDOWN)&&i){var n=i.cameraToUseForPointers||i.activeCamera;if(n){var o=i.getEngine(),h=n.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.event.pointerId||0,r.event.button),r.skipOnPointerObservable=e._shouldBlockPointer}}})),this._attachToOnPointerOut(i))},s.prototype.attachToMesh=function(e,i){var r=this;void 0===i&&(i=!0);var s=this.getScene();s&&(this._pointerObserver=s.onPointerObservable.add((function(i,s){if(i.type===t.PointerEventTypes.POINTERMOVE||i.type===t.PointerEventTypes.POINTERUP||i.type===t.PointerEventTypes.POINTERDOWN){var n=i.event.pointerId||0;if(i.pickInfo&&i.pickInfo.hit&&i.pickInfo.pickedMesh===e){var o=i.pickInfo.getTextureCoordinates();if(o){var h=r.getSize();r._doPicking(o.x*h.width,(1-o.y)*h.height,i.type,n,i.event.button)}}else i.type===t.PointerEventTypes.POINTERUP?(r._lastControlDown[n]&&r._lastControlDown[n].forcePointerUp(n),delete r._lastControlDown[n],r.focusedControl=null):i.type===t.PointerEventTypes.POINTERMOVE&&(r._lastControlOver[n]&&r._lastControlOver[n]._onPointerOut(r._lastControlOver[n]),delete r._lastControlOver[n])}})),e.enablePointerMoveEvents=i,this._attachToOnPointerOut(s))},s.prototype.moveFocusToControl=function(t){this.focusedControl=t,this._lastPickedControl=t,this._blockNextFocusCheck=!0},s.prototype._manageFocus=function(){if(this._blockNextFocusCheck)return this._blockNextFocusCheck=!1,void(this._lastPickedControl=this._focusedControl);if(this._focusedControl&&this._focusedControl!==this._lastPickedControl){if(this._lastPickedControl.isFocusInvisible)return;this.focusedControl=null}},s.prototype._attachToOnPointerOut=function(t){var e=this;this._canvasPointerOutObserver=t.getEngine().onCanvasPointerOutObservable.add((function(t){e._lastControlOver[t.pointerId]&&e._lastControlOver[t.pointerId]._onPointerOut(e._lastControlOver[t.pointerId]),delete e._lastControlOver[t.pointerId],e._lastControlDown[t.pointerId]&&e._lastControlDown[t.pointerId].forcePointerUp(),delete e._lastControlDown[t.pointerId]}))},s.CreateForMesh=function(e,i,r,n){void 0===i&&(i=1024),void 0===r&&(r=1024),void 0===n&&(n=!0);var o=new s(e.name+" AdvancedDynamicTexture",i,r,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,n),o},s.CreateFullscreenUI=function(e,i,r,n){void 0===i&&(i=!0),void 0===r&&(r=null),void 0===n&&(n=t.Texture.BILINEAR_SAMPLINGMODE);var o=new s(e,0,0,r,!1,n),h=new t.Layer(e+"_layer",null,r,!i);return h.texture=o,o._layerToDispose=h,o._isFullscreen=!0,o.attach(),o},s})(t.DynamicTexture);i.AdvancedDynamicTexture=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(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={}))})(t||(t={}));var t;!(function(t){!(function(i){var r=(function(t){function i(e,i){void 0===i&&(i=0);var r=t.call(this,e.x,e.y)||this;return r.buttonIndex=i,r}return e(i,t),i})(t.Vector2);i.Vector2WithInfo=r;var s=(function(){function e(t,e,i,r,s,n){this.m=new Float32Array(6),this.fromValues(t,e,i,r,s,n)}return e.prototype.fromValues=function(t,e,i,r,s,n){return this.m[0]=t,this.m[1]=e,this.m[2]=i,this.m[3]=r,this.m[4]=s,this.m[5]=n,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],s=this.m[2],n=this.m[3],o=this.m[4],h=this.m[5],a=this.determinant();if(a<t.Epsilon*t.Epsilon)return e.m[0]=0,e.m[1]=0,e.m[2]=0,e.m[3]=0,e.m[4]=0,e.m[5]=0,this;var u=1/a,l=s*h-n*o,c=r*o-i*h;return e.m[0]=n*u,e.m[1]=-r*u,e.m[2]=-s*u,e.m[3]=i*u,e.m[4]=l*u,e.m[5]=c*u,this},e.prototype.multiplyToRef=function(t,e){var i=this.m[0],r=this.m[1],s=this.m[2],n=this.m[3],o=this.m[4],h=this.m[5],a=t.m[0],u=t.m[1],l=t.m[2],c=t.m[3],_=t.m[4],f=t.m[5];return e.m[0]=i*a+r*l,e.m[1]=i*u+r*c,e.m[2]=s*a+n*l,e.m[3]=s*u+n*c,e.m[4]=o*a+h*l+_,e.m[5]=o*u+h*c+f,this},e.prototype.transformCoordinates=function(t,e,i){return i.x=t*this.m[0]+e*this.m[2]+this.m[4],i.y=t*this.m[1]+e*this.m[3]+this.m[5],this},e.Identity=function(){return new e(1,0,0,1,0,0)},e.TranslationToRef=function(t,e,i){i.fromValues(1,0,0,1,t,e)},e.ScalingToRef=function(t,e,i){i.fromValues(t,0,0,e,0,0)},e.RotationToRef=function(t,e){var i=Math.sin(t),r=Math.cos(t);e.fromValues(r,i,-i,r,0,0)},e.ComposeToRef=function(t,i,r,s,n,o,h){e.TranslationToRef(t,i,e._TempPreTranslationMatrix),e.ScalingToRef(s,n,e._TempScalingMatrix),e.RotationToRef(r,e._TempRotationMatrix),e.TranslationToRef(-t,-i,e._TempPostTranslationMatrix),e._TempPreTranslationMatrix.multiplyToRef(e._TempScalingMatrix,e._TempCompose0),e._TempCompose0.multiplyToRef(e._TempRotationMatrix,e._TempCompose1),o?(e._TempCompose1.multiplyToRef(e._TempPostTranslationMatrix,e._TempCompose2),e._TempCompose2.multiplyToRef(o,h)):e._TempCompose1.multiplyToRef(e._TempPostTranslationMatrix,h)},e._TempPreTranslationMatrix=e.Identity(),e._TempPostTranslationMatrix=e.Identity(),e._TempRotationMatrix=e.Identity(),e._TempScalingMatrix=e.Identity(),e._TempCompose0=e.Identity(),e._TempCompose1=e.Identity(),e._TempCompose2=e.Identity(),e})();i.Matrix2D=s})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(t){var e=(function(){function t(e,i,r){void 0===i&&(i=t.UNITMODE_PIXEL),void 0===r&&(r=!0),this.unit=i,this.negativeValueAllowed=r,this._value=1,this.ignoreAdaptiveScaling=!1,this._value=e}return Object.defineProperty(t.prototype,"isPercentage",{get:function(){return this.unit===t.UNITMODE_PERCENTAGE},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isPixel",{get:function(){return this.unit===t.UNITMODE_PIXEL},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"internalValue",{get:function(){return this._value},enumerable:!0,configurable:!0}),t.prototype.getValueInPixel=function(t,e){return this.isPixel?this.getValue(t):this.getValue(t)*e},t.prototype.getValue=function(e){if(e&&!this.ignoreAdaptiveScaling&&this.unit!==t.UNITMODE_PERCENTAGE){var i=0,r=0;if(e.idealWidth&&(i=this._value*e.getSize().width/e.idealWidth),e.idealHeight&&(r=this._value*e.getSize().height/e.idealHeight),e.useSmallestIdeal&&e.idealWidth&&e.idealHeight)return window.innerWidth<window.innerHeight?i:r;if(e.idealWidth)return i;if(e.idealHeight)return r}return this._value},t.prototype.toString=function(e){switch(this.unit){case t.UNITMODE_PERCENTAGE:return 100*this.getValue(e)+"%";case t.UNITMODE_PIXEL:return this.getValue(e)+"px"}return this.unit.toString()},t.prototype.fromString=function(e){var i=t._Regex.exec(e.toString());if(!i||0===i.length)return!1;var r=parseFloat(i[1]),s=this.unit;if(this.negativeValueAllowed||r<0&&(r=0),4===i.length)switch(i[3]){case"px":s=t.UNITMODE_PIXEL;break;case"%":s=t.UNITMODE_PERCENTAGE,r/=100}return(r!==this._value||s!==this.unit)&&(this._value=r,this.unit=s,!0)},Object.defineProperty(t,"UNITMODE_PERCENTAGE",{get:function(){return t._UNITMODE_PERCENTAGE},enumerable:!0,configurable:!0}),Object.defineProperty(t,"UNITMODE_PIXEL",{get:function(){return t._UNITMODE_PIXEL},enumerable:!0,configurable:!0}),t._Regex=/(^-?\d*(\.\d+)?)(%|px)?/,t._UNITMODE_PERCENTAGE=0,t._UNITMODE_PIXEL=1,t})();t.ValueAndUnit=e})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var i=(function(){function i(i){this._multiLine=i,this._x=new e.ValueAndUnit(0),this._y=new e.ValueAndUnit(0),this._point=new t.Vector2(0,0)}return Object.defineProperty(i.prototype,"x",{get:function(){return this._x.toString(this._multiLine._host)},set:function(t){this._x.toString(this._multiLine._host)!==t&&this._x.fromString(t)&&this._multiLine._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"y",{get:function(){return this._y.toString(this._multiLine._host)},set:function(t){this._y.toString(this._multiLine._host)!==t&&this._y.fromString(t)&&this._multiLine._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"control",{get:function(){return this._control},set:function(t){this._control!==t&&(this._control&&this._controlObserver&&(this._control.onDirtyObservable.remove(this._controlObserver),this._controlObserver=null),this._control=t,this._control&&(this._controlObserver=this._control.onDirtyObservable.add(this._multiLine.onPointUpdate)),this._multiLine._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"mesh",{get:function(){return this._mesh},set:function(t){this._mesh!==t&&(this._mesh&&this._meshObserver&&this._mesh.getScene().onAfterCameraRenderObservable.remove(this._meshObserver),this._mesh=t,this._mesh&&(this._meshObserver=this._mesh.getScene().onAfterCameraRenderObservable.add(this._multiLine.onPointUpdate)),this._multiLine._markAsDirty())},enumerable:!0,configurable:!0}),i.prototype.translate=function(){return this._point=this._translatePoint(),this._point},i.prototype._translatePoint=function(){if(null!=this._mesh)return this._multiLine._host.getProjectedPosition(this._mesh.getBoundingInfo().boundingSphere.center,this._mesh.getWorldMatrix());if(null!=this._control)return new t.Vector2(this._control.centerX,this._control.centerY);var e=this._multiLine._host,i=this._x.getValueInPixel(e,Number(e._canvas.width)),r=this._y.getValueInPixel(e,Number(e._canvas.height));return new t.Vector2(i,r)},i.prototype.dispose=function(){this.control=null,this.mesh=null},i})();e.MultiLinePoint=i})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var i=(function(){function i(r){this.name=r,this._alpha=1,this._alphaSet=!1,this._zIndex=0,this._currentMeasure=e.Measure.Empty(),this._fontFamily="Arial",this._fontStyle="",this._fontSize=new e.ValueAndUnit(18,e.ValueAndUnit.UNITMODE_PIXEL,!1),this._width=new e.ValueAndUnit(1,e.ValueAndUnit.UNITMODE_PERCENTAGE,!1),this._height=new e.ValueAndUnit(1,e.ValueAndUnit.UNITMODE_PERCENTAGE,!1),this._color="",this._horizontalAlignment=i.HORIZONTAL_ALIGNMENT_CENTER,this._verticalAlignment=i.VERTICAL_ALIGNMENT_CENTER,this._isDirty=!0,this._tempParentMeasure=e.Measure.Empty(),this._cachedParentMeasure=e.Measure.Empty(),this._paddingLeft=new e.ValueAndUnit(0),this._paddingRight=new e.ValueAndUnit(0),this._paddingTop=new e.ValueAndUnit(0),this._paddingBottom=new e.ValueAndUnit(0),this._left=new e.ValueAndUnit(0),this._top=new e.ValueAndUnit(0),this._scaleX=1,this._scaleY=1,this._rotation=0,this._transformCenterX=.5,this._transformCenterY=.5,this._transformMatrix=e.Matrix2D.Identity(),this._invertTransformMatrix=e.Matrix2D.Identity(),this._transformedPosition=t.Vector2.Zero(),this._onlyMeasureMode=!1,this._isMatrixDirty=!0,this._isVisible=!0,this._fontSet=!1,this._dummyVector2=t.Vector2.Zero(),this._downCount=0,this._enterCount=0,this._doNotRender=!1,this._downPointerIds={},this.isHitTestVisible=!0,this.isPointerBlocker=!1,this.isFocusInvisible=!1,this.shadowOffsetX=0,this.shadowOffsetY=0,this.shadowBlur=0,this.shadowColor="#000",this._linkOffsetX=new e.ValueAndUnit(0),this._linkOffsetY=new e.ValueAndUnit(0),this.onPointerMoveObservable=new t.Observable,this.onPointerOutObservable=new t.Observable,this.onPointerDownObservable=new t.Observable,this.onPointerUpObservable=new t.Observable,this.onPointerClickObservable=new t.Observable,this.onPointerEnterObservable=new t.Observable,this.onDirtyObservable=new t.Observable,this.onAfterDrawObservable=new t.Observable}return Object.defineProperty(i.prototype,"typeName",{get:function(){return this._getTypeName()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fontOffset",{get:function(){return this._fontOffset},set:function(t){this._fontOffset=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha!==t&&(this._alphaSet=!0,this._alpha=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scaleX",{get:function(){return this._scaleX},set:function(t){this._scaleX!==t&&(this._scaleX=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scaleY",{get:function(){return this._scaleY},set:function(t){this._scaleY!==t&&(this._scaleY=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"transformCenterY",{get:function(){return this._transformCenterY},set:function(t){this._transformCenterY!==t&&(this._transformCenterY=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"transformCenterX",{get:function(){return this._transformCenterX},set:function(t){this._transformCenterX!==t&&(this._transformCenterX=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"horizontalAlignment",{get:function(){return this._horizontalAlignment},set:function(t){this._horizontalAlignment!==t&&(this._horizontalAlignment=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"verticalAlignment",{get:function(){return this._verticalAlignment},set:function(t){this._verticalAlignment!==t&&(this._verticalAlignment=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(t){this._width.toString(this._host)!==t&&this._width.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"widthInPixels",{get:function(){return this._width.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(t){this._height.toString(this._host)!==t&&this._height.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"heightInPixels",{get:function(){return this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this._fontSet=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this._fontSet=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_isFontSizeInPercentage",{get:function(){return this._fontSize.isPercentage},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fontSizeInPixels",{get:function(){return this._fontSize.isPixel?this._fontSize.getValue(this._host):this._fontSize.getValueInPixel(this._host,this._tempParentMeasure.height||this._cachedParentMeasure.height)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fontSize",{get:function(){return this._fontSize.toString(this._host)},set:function(t){this._fontSize.toString(this._host)!==t&&this._fontSize.fromString(t)&&(this._markAsDirty(),this._fontSet=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"color",{get:function(){return this._color},set:function(t){this._color!==t&&(this._color=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"zIndex",{get:function(){return this._zIndex},set:function(t){this.zIndex!==t&&(this._zIndex=t,this._root&&this._root._reOrderControl(this))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"notRenderable",{get:function(){return this._doNotRender},set:function(t){this._doNotRender!==t&&(this._doNotRender=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isVisible",{get:function(){return this._isVisible},set:function(t){this._isVisible!==t&&(this._isVisible=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isDirty",{get:function(){return this._isDirty},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"paddingLeft",{get:function(){return this._paddingLeft.toString(this._host)},set:function(t){this._paddingLeft.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"paddingLeftInPixels",{get:function(){return this._paddingLeft.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"paddingRight",{get:function(){return this._paddingRight.toString(this._host)},set:function(t){this._paddingRight.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"paddingRightInPixels",{get:function(){return this._paddingRight.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"paddingTop",{get:function(){return this._paddingTop.toString(this._host)},set:function(t){this._paddingTop.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"paddingTopInPixels",{get:function(){return this._paddingTop.getValueInPixel(this._host,this._cachedParentMeasure.height)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"paddingBottom",{get:function(){return this._paddingBottom.toString(this._host)},set:function(t){this._paddingBottom.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"paddingBottomInPixels",{get:function(){return this._paddingBottom.getValueInPixel(this._host,this._cachedParentMeasure.height)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"left",{get:function(){return this._left.toString(this._host)},set:function(t){this._left.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"leftInPixels",{get:function(){return this._left.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"top",{get:function(){return this._top.toString(this._host)},set:function(t){this._top.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"topInPixels",{get:function(){return this._top.getValueInPixel(this._host,this._cachedParentMeasure.height)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"linkOffsetX",{get:function(){return this._linkOffsetX.toString(this._host)},set:function(t){this._linkOffsetX.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"linkOffsetXInPixels",{get:function(){return this._linkOffsetX.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"linkOffsetY",{get:function(){return this._linkOffsetY.toString(this._host)},set:function(t){this._linkOffsetY.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"linkOffsetYInPixels",{get:function(){return this._linkOffsetY.getValueInPixel(this._host,this._cachedParentMeasure.height)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"centerX",{get:function(){return this._currentMeasure.left+this._currentMeasure.width/2},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"centerY",{get:function(){return this._currentMeasure.top+this._currentMeasure.height/2},enumerable:!0,configurable:!0}),i.prototype._getTypeName=function(){return"Control"},i.prototype._resetFontCache=function(){this._fontSet=!0},i.prototype.getLocalCoordinates=function(e){var i=t.Vector2.Zero();return this.getLocalCoordinatesToRef(e,i),i},i.prototype.getLocalCoordinatesToRef=function(t,e){return e.x=t.x-this._currentMeasure.left,e.y=t.y-this._currentMeasure.top,this},i.prototype.getParentLocalCoordinates=function(e){var i=t.Vector2.Zero();return i.x=e.x-this._cachedParentMeasure.left,i.y=e.y-this._cachedParentMeasure.top,i},i.prototype.moveToVector3=function(e,i){if(!this._host||this._root!==this._host._rootContainer)return void t.Tools.Error("Cannot move a control to a vector3 if the control is not at root level");this.horizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT,this.verticalAlignment=t.GUI.Control.VERTICAL_ALIGNMENT_TOP;var r=this._host._getGlobalViewport(i),s=t.Vector3.Project(e,t.Matrix.Identity(),i.getTransformMatrix(),r);if(this._moveToProjectedPosition(s),s.z<0||s.z>1)return void(this.notRenderable=!0);this.notRenderable=!1},i.prototype.linkWithMesh=function(e){if(!this._host||this._root&&this._root!==this._host._rootContainer)return void(e&&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));e&&(this.horizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT,this.verticalAlignment=t.GUI.Control.VERTICAL_ALIGNMENT_TOP,this._linkedMesh=e,this._onlyMeasureMode=!0,this._host._linkedControls.push(this))},i.prototype._moveToProjectedPosition=function(t){var e=this._left.getValue(this._host),i=this._top.getValue(this._host),r=t.x+this._linkOffsetX.getValue(this._host)-this._currentMeasure.width/2,s=t.y+this._linkOffsetY.getValue(this._host)-this._currentMeasure.height/2;this._left.ignoreAdaptiveScaling&&this._top.ignoreAdaptiveScaling&&(Math.abs(r-e)<.5&&(r=e),Math.abs(s-i)<.5&&(s=i)),this.left=r+"px",this.top=s+"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.width<t.left)&&(!(this._currentMeasure.top>t.top+t.height)&&(!(this._currentMeasure.top+this._currentMeasure.height<t.top)&&(this._transform(e),this._onlyMeasureMode?(this._onlyMeasureMode=!1,!1):(this._clip(e),e.clip(),!0)))))},i.prototype._clip=function(t){if(t.beginPath(),this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY){var e=this.shadowOffsetX,i=this.shadowOffsetY,r=this.shadowBlur,s=Math.min(Math.min(e,0)-2*r,0),n=Math.max(Math.max(e,0)+2*r,0),o=Math.min(Math.min(i,0)-2*r,0),h=Math.max(Math.max(i,0)+2*r,0);t.rect(this._currentMeasure.left+s,this._currentMeasure.top+o,this._currentMeasure.width+n-s,this._currentMeasure.height+h-o)}else t.rect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)},i.prototype._measure=function(){this._width.isPixel?this._currentMeasure.width=this._width.getValue(this._host):this._currentMeasure.width*=this._width.getValue(this._host),this._height.isPixel?this._currentMeasure.height=this._height.getValue(this._host):this._currentMeasure.height*=this._height.getValue(this._host)},i.prototype._computeAlignment=function(t,e){var r=this._currentMeasure.width,s=this._currentMeasure.height,n=t.width,o=t.height,h=0,a=0;switch(this.horizontalAlignment){case i.HORIZONTAL_ALIGNMENT_LEFT:h=0;break;case i.HORIZONTAL_ALIGNMENT_RIGHT:h=n-r;break;case i.HORIZONTAL_ALIGNMENT_CENTER:h=(n-r)/2}switch(this.verticalAlignment){case i.VERTICAL_ALIGNMENT_TOP:a=0;break;case i.VERTICAL_ALIGNMENT_BOTTOM:a=o-s;break;case i.VERTICAL_ALIGNMENT_CENTER:a=(o-s)/2}this._paddingLeft.isPixel?(this._currentMeasure.left+=this._paddingLeft.getValue(this._host),this._currentMeasure.width-=this._paddingLeft.getValue(this._host)):(this._currentMeasure.left+=n*this._paddingLeft.getValue(this._host),this._currentMeasure.width-=n*this._paddingLeft.getValue(this._host)),this._paddingRight.isPixel?this._currentMeasure.width-=this._paddingRight.getValue(this._host):this._currentMeasure.width-=n*this._paddingRight.getValue(this._host),this._paddingTop.isPixel?(this._currentMeasure.top+=this._paddingTop.getValue(this._host),this._currentMeasure.height-=this._paddingTop.getValue(this._host)):(this._currentMeasure.top+=o*this._paddingTop.getValue(this._host),this._currentMeasure.height-=o*this._paddingTop.getValue(this._host)),this._paddingBottom.isPixel?this._currentMeasure.height-=this._paddingBottom.getValue(this._host):this._currentMeasure.height-=o*this._paddingBottom.getValue(this._host),this._left.isPixel?this._currentMeasure.left+=this._left.getValue(this._host):this._currentMeasure.left+=n*this._left.getValue(this._host),this._top.isPixel?this._currentMeasure.top+=this._top.getValue(this._host):this._currentMeasure.top+=o*this._top.getValue(this._host),this._currentMeasure.left+=h,this._currentMeasure.top+=a},i.prototype._preMeasure=function(t,e){},i.prototype._additionalProcessing=function(t,e){},i.prototype._draw=function(t,e){},i.prototype.contains=function(t,e){return this._invertTransformMatrix.transformCoordinates(t,e,this._transformedPosition),t=this._transformedPosition.x,e=this._transformedPosition.y,!(t<this._currentMeasure.left)&&(!(t>this._currentMeasure.left+this._currentMeasure.width)&&(!(e<this._currentMeasure.top)&&(!(e>this._currentMeasure.top+this._currentMeasure.height)&&(this.isPointerBlocker&&(this._host._shouldBlockPointer=!0),!0))))},i.prototype._processPicking=function(t,e,i,r,s){return!(!this.isHitTestVisible||!this.isVisible||this._doNotRender)&&(!!this.contains(t,e)&&(this._processObservables(i,t,e,r,s),!0))},i.prototype._onPointerMove=function(t,e){this.onPointerMoveObservable.notifyObservers(e,-1,t,this)&&null!=this.parent&&this.parent._onPointerMove(t,e)},i.prototype._onPointerEnter=function(t){return 0===this._enterCount&&(this._enterCount++,this.onPointerEnterObservable.notifyObservers(this,-1,t,this)&&null!=this.parent&&this.parent._onPointerEnter(t),!0)},i.prototype._onPointerOut=function(t){this._enterCount=0,this.onPointerOutObservable.notifyObservers(this,-1,t,this)&&null!=this.parent&&this.parent._onPointerOut(t)},i.prototype._onPointerDown=function(t,i,r,s){return 0===this._downCount&&(this._downCount++,this._downPointerIds[r]=!0,this.onPointerDownObservable.notifyObservers(new e.Vector2WithInfo(i,s),-1,t,this)&&null!=this.parent&&this.parent._onPointerDown(t,i,r,s),!0)},i.prototype._onPointerUp=function(t,i,r,s,n){this._downCount=0,delete this._downPointerIds[r];var o=n;n&&this._enterCount>0&&(o=this.onPointerClickObservable.notifyObservers(new e.Vector2WithInfo(i,s),-1,t,this)),this.onPointerUpObservable.notifyObservers(new e.Vector2WithInfo(i,s),-1,t,this)&&null!=this.parent&&this.parent._onPointerUp(t,i,r,s,o)},i.prototype.forcePointerUp=function(e){if(void 0===e&&(e=null),null!==e)this._onPointerUp(this,t.Vector2.Zero(),e,0,!0);else for(var i in this._downPointerIds)this._onPointerUp(this,t.Vector2.Zero(),+i,0,!0)},i.prototype._processObservables=function(e,i,r,s,n){if(this._dummyVector2.copyFromFloats(i,r),e===t.PointerEventTypes.POINTERMOVE){this._onPointerMove(this,this._dummyVector2);var o=this._host._lastControlOver[s];return o&&o!==this&&o._onPointerOut(this),o!==this&&this._onPointerEnter(this),this._host._lastControlOver[s]=this,!0}return e===t.PointerEventTypes.POINTERDOWN?(this._onPointerDown(this,this._dummyVector2,s,n),this._host._lastControlDown[s]=this,this._host._lastPickedControl=this,!0):e===t.PointerEventTypes.POINTERUP&&(this._host._lastControlDown[s]&&this._host._lastControlDown[s]._onPointerUp(this,this._dummyVector2,s,n,!0),delete this._host._lastControlDown[s],!0)},i.prototype._prepareFont=function(){(this._font||this._fontSet)&&(this._font=this._fontStyle+" "+this.fontSizeInPixels+"px "+this._fontFamily,this._fontOffset=i._GetFontOffset(this._font))},i.prototype.dispose=function(){this.onDirtyObservable.clear(),this.onAfterDrawObservable.clear(),this.onPointerDownObservable.clear(),this.onPointerEnterObservable.clear(),this.onPointerMoveObservable.clear(),this.onPointerOutObservable.clear(),this.onPointerUpObservable.clear(),this.onPointerClickObservable.clear(),this._root&&(this._root.removeControl(this),this._root=null),this._host._linkedControls.indexOf(this)>-1&&this.linkWithMesh(null)},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 s=document.createElement("div");s.appendChild(e),s.appendChild(r),document.body.appendChild(s);var n=0,o=0;try{o=r.getBoundingClientRect().top-e.getBoundingClientRect().top,r.style.verticalAlign="baseline",n=r.getBoundingClientRect().top-e.getBoundingClientRect().top}finally{document.body.removeChild(s)}var h={ascent:n,height:o,descent:o-n};return i._FontHeightSizes[t]=h,h},i.AddHeader=function(e,r,s,n){var o=new t.GUI.StackPanel("panel"),h=!n||n.isHorizontal,a=!n||n.controlFirst;o.isVertical=!h;var u=new t.GUI.TextBlock("header");return u.text=r,u.textHorizontalAlignment=i.HORIZONTAL_ALIGNMENT_LEFT,h?u.width=s:u.height=s,a?(o.addControl(e),o.addControl(u),u.paddingLeft="5px"):(o.addControl(u),o.addControl(e),u.paddingRight="5px"),u.shadowBlur=e.shadowBlur,u.shadowColor=e.shadowColor,u.shadowOffsetX=e.shadowOffsetX,u.shadowOffsetY=e.shadowOffsetY,o},i.drawEllipse=function(t,e,i,r,s){s.translate(t,e),s.scale(i,r),s.beginPath(),s.arc(0,0,1,0,2*Math.PI),s.closePath(),s.scale(1/i,1/r),s.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={}))})(t||(t={}));var t;!(function(t){!(function(t){var i=(function(i){function r(e){var r=i.call(this,e)||this;return r.name=e,r._children=new Array,r._measureForChildren=t.Measure.Empty(),r._adaptWidthToChildren=!1,r._adaptHeightToChildren=!1,r}return e(r,i),Object.defineProperty(r.prototype,"adaptHeightToChildren",{get:function(){return this._adaptHeightToChildren},set:function(t){this._adaptHeightToChildren!==t&&(this._adaptHeightToChildren=t,t&&(this.height="100%"),this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"adaptWidthToChildren",{get:function(){return this._adaptWidthToChildren},set:function(t){this._adaptWidthToChildren!==t&&(this._adaptWidthToChildren=t,t&&(this.width="100%"),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,"children",{get:function(){return this._children},enumerable:!0,configurable:!0}),r.prototype._getTypeName=function(){return"Container"},r.prototype.getChildByName=function(t){for(var e=0,i=this._children;e<i.length;e++){var r=i[e];if(r.name===t)return r}return null},r.prototype.getChildByType=function(t,e){for(var i=0,r=this._children;i<r.length;i++){var s=r[i];if(s.typeName===e)return s}return null},r.prototype.containsControl=function(t){return-1!==this._children.indexOf(t)},r.prototype.addControl=function(t){return-1!==this._children.indexOf(t)?this:(t._link(this,this._host),t._markAllAsDirty(),this._reOrderControl(t),this._markAsDirty(),this)},r.prototype.removeControl=function(t){var e=this._children.indexOf(t);return-1!==e&&(this._children.splice(e,1),t.parent=null),t.linkWithMesh(null),this._host&&this._host._cleanControlAfterRemoval(t),this._markAsDirty(),this},r.prototype._reOrderControl=function(t){this.removeControl(t);for(var e=0;e<this._children.length;e++)if(this._children[e].zIndex>t.zIndex)return void this._children.splice(e,0,t);this._children.push(t),t.parent=this,this._markAsDirty()},r.prototype._markMatrixAsDirty=function(){i.prototype._markMatrixAsDirty.call(this);for(var t=0;t<this._children.length;t++)this._children[t]._markMatrixAsDirty()},r.prototype._markAllAsDirty=function(){i.prototype._markAllAsDirty.call(this);for(var t=0;t<this._children.length;t++)this._children[t]._markAllAsDirty()},r.prototype._localDraw=function(t){this._background&&((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),t.fillStyle=this._background,t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0))},r.prototype._link=function(t,e){i.prototype._link.call(this,t,e);for(var r=0,s=this._children;r<s.length;r++){s[r]._link(t,e)}},r.prototype._draw=function(t,e){if(this.isVisible&&!this.notRenderable){if(e.save(),this._applyStates(e),this._processMeasures(t,e)){this._localDraw(e),this._clipForChildren(e);for(var i=-1,r=-1,s=0,n=this._children;s<n.length;s++){var o=n[s];o.isVisible&&!o.notRenderable&&(o._tempParentMeasure.copyFrom(this._measureForChildren),o._draw(this._measureForChildren,e),o.onAfterDrawObservable.hasObservers()&&o.onAfterDrawObservable.notifyObservers(o),this.adaptWidthToChildren&&o._width.isPixel&&(i=Math.max(i,o._currentMeasure.width)),this.adaptHeightToChildren&&o._height.isPixel&&(r=Math.max(r,o._currentMeasure.height)))}this.adaptWidthToChildren&&i>=0&&(this.width=i+"px"),this.adaptHeightToChildren&&r>=0&&(this.height=r+"px")}e.restore(),this.onAfterDrawObservable.hasObservers()&&this.onAfterDrawObservable.notifyObservers(this)}},r.prototype._processPicking=function(t,e,r,s,n){if(!this.isVisible||this.notRenderable)return!1;if(!i.prototype.contains.call(this,t,e))return!1;for(var o=this._children.length-1;o>=0;o--){if(this._children[o]._processPicking(t,e,r,s,n))return!0}return!!this.isHitTestVisible&&this._processObservables(r,t,e,s,n)},r.prototype._clipForChildren=function(t){},r.prototype._additionalProcessing=function(t,e){i.prototype._additionalProcessing.call(this,t,e),this._measureForChildren.copyFrom(this._currentMeasure)},r.prototype.dispose=function(){i.prototype.dispose.call(this);for(var t=0,e=this._children;t<e.length;t++){e[t].dispose()}},r})(t.Control);t.Container=i})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(i){var r=(function(r){function s(t){var e=r.call(this,t)||this;return e.name=t,e._isVertical=!0,e._manualWidth=!1,e._manualHeight=!1,e._doNotTrackManualChanges=!1,e._tempMeasureStore=i.Measure.Empty(),e}return e(s,r),Object.defineProperty(s.prototype,"isVertical",{get:function(){return this._isVertical},set:function(t){this._isVertical!==t&&(this._isVertical=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(t){this._doNotTrackManualChanges||(this._manualWidth=!0),this._width.toString(this._host)!==t&&this._width.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(t){this._doNotTrackManualChanges||(this._manualHeight=!0),this._height.toString(this._host)!==t&&this._height.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),s.prototype._getTypeName=function(){return"StackPanel"},s.prototype._preMeasure=function(e,i){for(var s=0,n=0,o=0,h=this._children;o<h.length;o++){var a=h[o];this._tempMeasureStore.copyFrom(a._currentMeasure),a._currentMeasure.copyFrom(e),a._measure(),this._isVertical?(a.top=n+"px",a._top.ignoreAdaptiveScaling||a._markAsDirty(),a._top.ignoreAdaptiveScaling=!0,n+=a._currentMeasure.height,a._currentMeasure.width>s&&(s=a._currentMeasure.width),a.verticalAlignment=t.GUI.Control.VERTICAL_ALIGNMENT_TOP):(a.left=s+"px",a._left.ignoreAdaptiveScaling||a._markAsDirty(),a._left.ignoreAdaptiveScaling=!0,s+=a._currentMeasure.width,a._currentMeasure.height>n&&(n=a._currentMeasure.height),a.horizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT),a._currentMeasure.copyFrom(this._tempMeasureStore)}this._doNotTrackManualChanges=!0;var u=!1,l=!1,c=this.height,_=this.width;this._manualHeight||(this.height=n+"px"),this._manualWidth||(this.width=s+"px"),u=_!==this.width||!this._width.ignoreAdaptiveScaling,l=c!==this.height||!this._height.ignoreAdaptiveScaling,l&&(this._height.ignoreAdaptiveScaling=!0),u&&(this._width.ignoreAdaptiveScaling=!0),this._doNotTrackManualChanges=!1,(u||l)&&this._markAllAsDirty(),r.prototype._preMeasure.call(this,e,i)},s})(i.Container);i.StackPanel=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(t){var i=(function(t){function i(e){var i=t.call(this,e)||this;return i.name=e,i._thickness=1,i._cornerRadius=0,i}return e(i,t),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,"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}),i.prototype._getTypeName=function(){return"Rectangle"},i.prototype._localDraw=function(t){t.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),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.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),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()},i.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},i.prototype._drawRoundedRect=function(t,e){void 0===e&&(e=0);var i=this._currentMeasure.left+e,r=this._currentMeasure.top+e,s=this._currentMeasure.width-2*e,n=this._currentMeasure.height-2*e,o=Math.min(n/2-2,Math.min(s/2-2,this._cornerRadius));t.beginPath(),t.moveTo(i+o,r),t.lineTo(i+s-o,r),t.quadraticCurveTo(i+s,r,i+s,r+o),t.lineTo(i+s,r+n-o),t.quadraticCurveTo(i+s,r+n,i+s-o,r+n),t.lineTo(i+o,r+n),t.quadraticCurveTo(i,r+n,i,r+n-o),t.lineTo(i,r+o),t.quadraticCurveTo(i,r,i+o,r),t.closePath()},i.prototype._clipForChildren=function(t){this._cornerRadius&&(this._drawRoundedRect(t,this._thickness),t.clip())},i})(t.Container);t.Rectangle=i})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(t){var i=(function(i){function r(t){var e=i.call(this,t)||this;return e.name=t,e._thickness=1,e}return e(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}),r.prototype._getTypeName=function(){return"Ellipse"},r.prototype._localDraw=function(e){e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),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.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._thickness&&(this.color&&(e.strokeStyle=this.color),e.lineWidth=this._thickness,e.stroke()),e.restore()},r.prototype._additionalProcessing=function(t,e){i.prototype._additionalProcessing.call(this,t,e),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},r.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()},r})(t.Container);t.Ellipse=i})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(i){var r=(function(r){function s(t){var e=r.call(this,t)||this;return e.name=t,e._lineWidth=1,e._x1=new i.ValueAndUnit(0),e._y1=new i.ValueAndUnit(0),e._x2=new i.ValueAndUnit(0),e._y2=new i.ValueAndUnit(0),e._dash=new Array,e.isHitTestVisible=!1,e._horizontalAlignment=i.Control.HORIZONTAL_ALIGNMENT_LEFT,e._verticalAlignment=i.Control.VERTICAL_ALIGNMENT_TOP,e}return e(s,r),Object.defineProperty(s.prototype,"dash",{get:function(){return this._dash},set:function(t){this._dash!==t&&(this._dash=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.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(s.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(s.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(s.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(s.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(s.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(t){this._lineWidth!==t&&(this._lineWidth=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"horizontalAlignment",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"verticalAlignment",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"_effectiveX2",{get:function(){return(this._connectedControl?this._connectedControl.centerX:0)+this._x2.getValue(this._host)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"_effectiveY2",{get:function(){return(this._connectedControl?this._connectedControl.centerY:0)+this._y2.getValue(this._host)},enumerable:!0,configurable:!0}),s.prototype._getTypeName=function(){return"Line"},s.prototype._draw=function(t,e){e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),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()},s.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},s.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},s.prototype.moveToVector3=function(e,i,r){if(void 0===r&&(r=!1),!this._host||this._root!==this._host._rootContainer)return void t.Tools.Error("Cannot move a control to a vector3 if the control is not at root level");var s=this._host._getGlobalViewport(i),n=t.Vector3.Project(e,t.Matrix.Identity(),i.getTransformMatrix(),s);if(this._moveToProjectedPosition(n,r),n.z<0||n.z>1)return void(this.notRenderable=!0);this.notRenderable=!1},s.prototype._moveToProjectedPosition=function(t,e){void 0===e&&(e=!1);var i=t.x+this._linkOffsetX.getValue(this._host)+"px",r=t.y+this._linkOffsetY.getValue(this._host)+"px";e?(this.x2=i,this.y2=r,this._x2.ignoreAdaptiveScaling=!0,this._y2.ignoreAdaptiveScaling=!0):(this.x1=i,this.y1=r,this._x1.ignoreAdaptiveScaling=!0,this._y1.ignoreAdaptiveScaling=!0)},s})(i.Control);i.Line=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(i){var r=(function(r){function s(e){var s=r.call(this,e)||this;return s.name=e,s._thumbWidth=new i.ValueAndUnit(30,i.ValueAndUnit.UNITMODE_PIXEL,!1),s._minimum=0,s._maximum=100,s._value=50,s._background="black",s._borderColor="white",s._barOffset=new i.ValueAndUnit(5,i.ValueAndUnit.UNITMODE_PIXEL,!1),s._isThumbCircle=!1,s._isThumbClamped=!1,s.onValueChangedObservable=new t.Observable,s._pointerIsDown=!1,s.isPointerBlocker=!0,s}return e(s,r),Object.defineProperty(s.prototype,"borderColor",{get:function(){return this._borderColor},set:function(t){this._borderColor!==t&&(this._borderColor=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.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(s.prototype,"barOffsetInPixels",{get:function(){return this._barOffset.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(s.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(s.prototype,"thumbWidthInPixels",{get:function(){return this._thumbWidth.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(s.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(s.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(s.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}),Object.defineProperty(s.prototype,"isThumbCircle",{get:function(){return this._isThumbCircle},set:function(t){this._isThumbCircle!==t&&(this._isThumbCircle=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"isThumbClamped",{get:function(){return this._isThumbClamped},set:function(t){this._isThumbClamped!==t&&(this._isThumbClamped=t,this._markAsDirty())},enumerable:!0,configurable:!0}),s.prototype._getTypeName=function(){return"Slider"},s.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.width):this._currentMeasure.width*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),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY);var s=this._currentMeasure.left,n=this._currentMeasure.width-i,o=(this._value-this._minimum)/(this._maximum-this._minimum)*n;e.fillStyle=this._background,this.isThumbClamped?e.fillRect(s,this._currentMeasure.top+r,n+i,this._currentMeasure.height-2*r):e.fillRect(s+i/2,this._currentMeasure.top+r,n,this._currentMeasure.height-2*r),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.fillStyle=this.color,this.isThumbClamped?e.fillRect(s,this._currentMeasure.top+r,o,this._currentMeasure.height-2*r):e.fillRect(s+i/2,this._currentMeasure.top+r,o,this._currentMeasure.height-2*r),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._isThumbCircle?(e.beginPath(),e.arc(s+o+i/2,this._currentMeasure.top+this._currentMeasure.height/2,i/2,0,2*Math.PI),e.fill(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.strokeStyle=this._borderColor,e.stroke()):(e.fillRect(s+o,this._currentMeasure.top,i,this._currentMeasure.height),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.strokeStyle=this._borderColor,e.strokeRect(s+o,this._currentMeasure.top,i,this._currentMeasure.height))}e.restore()},s.prototype._updateValueFromPointer=function(t,e){0!=this.rotation&&(this._invertTransformMatrix.transformCoordinates(t,e,this._transformedPosition),t=this._transformedPosition.x),this.value=this._minimum+(t-this._currentMeasure.left)/this._currentMeasure.width*(this._maximum-this._minimum)},s.prototype._onPointerDown=function(t,e,i,s){return!!r.prototype._onPointerDown.call(this,t,e,i,s)&&(this._pointerIsDown=!0,this._updateValueFromPointer(e.x,e.y),this._host._capturingControl[i]=this,!0)},s.prototype._onPointerMove=function(t,e){this._pointerIsDown&&this._updateValueFromPointer(e.x,e.y),r.prototype._onPointerMove.call(this,t,e)},s.prototype._onPointerUp=function(t,e,i,s,n){this._pointerIsDown=!1,delete this._host._capturingControl[i],r.prototype._onPointerUp.call(this,t,e,i,s,n)},s})(i.Control);i.Slider=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(i){var r=(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.onIsCheckedChangedObservable=new t.Observable,r.isPointerBlocker=!0,r}return e(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){this._isChecked!==t&&(this._isChecked=t,this._markAsDirty(),this.onIsCheckedChangedObservable.notifyObservers(t))},enumerable:!0,
configurable:!0}),r.prototype._getTypeName=function(){return"CheckBox"},r.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((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),e.fillStyle=this._background,e.fillRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,i,r),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._isChecked){e.fillStyle=this.color;var s=i*this._checkSizeRatio,n=r*this._checkSizeRatio;e.fillRect(this._currentMeasure.left+this._thickness/2+(i-s)/2,this._currentMeasure.top+this._thickness/2+(r-n)/2,s,n)}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()},r.prototype._onPointerDown=function(t,e,r,s){return!!i.prototype._onPointerDown.call(this,t,e,r,s)&&(this.isChecked=!this.isChecked,!0)},r})(i.Control);i.Checkbox=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(i){var r=(function(r){function s(e){var i=r.call(this,e)||this;return i.name=e,i._isChecked=!1,i._background="black",i._checkSizeRatio=.8,i._thickness=1,i.group="",i.onIsCheckedChangedObservable=new t.Observable,i.isPointerBlocker=!0,i}return e(s,r),Object.defineProperty(s.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.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(s.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.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}),s.prototype._getTypeName=function(){return"RadioButton"},s.prototype._draw=function(t,e){if(e.save(),this._applyStates(e),this._processMeasures(t,e)){var r=this._currentMeasure.width-this._thickness,s=this._currentMeasure.height-this._thickness;if((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),i.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),e.fillStyle=this._background,e.fill(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.strokeStyle=this.color,e.lineWidth=this._thickness,e.stroke(),this._isChecked){e.fillStyle=this.color;var n=r*this._checkSizeRatio,o=s*this._checkSizeRatio;i.Control.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,n/2-this._thickness/2,o/2-this._thickness/2,e),e.fill()}}e.restore()},s.prototype._onPointerDown=function(t,e,i,s){return!!r.prototype._onPointerDown.call(this,t,e,i,s)&&(this.isChecked=!this.isChecked,!0)},s})(i.Control);i.RadioButton=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(i){var r=(function(r){function s(e,s){void 0===s&&(s="");var n=r.call(this,e)||this;return n.name=e,n._text="",n._textWrapping=!1,n._textHorizontalAlignment=i.Control.HORIZONTAL_ALIGNMENT_CENTER,n._textVerticalAlignment=i.Control.VERTICAL_ALIGNMENT_CENTER,n._resizeToFit=!1,n._lineSpacing=new i.ValueAndUnit(0),n._outlineWidth=0,n._outlineColor="white",n.onTextChangedObservable=new t.Observable,n.onLinesReadyObservable=new t.Observable,n.text=s,n}return e(s,r),Object.defineProperty(s.prototype,"lines",{get:function(){return this._lines},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"resizeToFit",{get:function(){return this._resizeToFit},set:function(t){this._resizeToFit=t,this._resizeToFit&&(this._width.ignoreAdaptiveScaling=!0,this._height.ignoreAdaptiveScaling=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"textWrapping",{get:function(){return this._textWrapping},set:function(t){this._textWrapping!==t&&(this._textWrapping=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.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}),Object.defineProperty(s.prototype,"textHorizontalAlignment",{get:function(){return this._textHorizontalAlignment},set:function(t){this._textHorizontalAlignment!==t&&(this._textHorizontalAlignment=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"textVerticalAlignment",{get:function(){return this._textVerticalAlignment},set:function(t){this._textVerticalAlignment!==t&&(this._textVerticalAlignment=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"lineSpacing",{get:function(){return this._lineSpacing.toString(this._host)},set:function(t){this._lineSpacing.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"outlineWidth",{get:function(){return this._outlineWidth},set:function(t){this._outlineWidth!==t&&(this._outlineWidth=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"outlineColor",{get:function(){return this._outlineColor},set:function(t){this._outlineColor!==t&&(this._outlineColor=t,this._markAsDirty())},enumerable:!0,configurable:!0}),s.prototype._getTypeName=function(){return"TextBlock"},s.prototype._drawText=function(t,e,r,s){var n=this._currentMeasure.width,o=0;switch(this._textHorizontalAlignment){case i.Control.HORIZONTAL_ALIGNMENT_LEFT:o=0;break;case i.Control.HORIZONTAL_ALIGNMENT_RIGHT:o=n-e;break;case i.Control.HORIZONTAL_ALIGNMENT_CENTER:o=(n-e)/2}(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(s.shadowColor=this.shadowColor,s.shadowBlur=this.shadowBlur,s.shadowOffsetX=this.shadowOffsetX,s.shadowOffsetY=this.shadowOffsetY),this.outlineWidth&&s.strokeText(t,this._currentMeasure.left+o,r),s.fillText(t,this._currentMeasure.left+o,r)},s.prototype._draw=function(t,e){e.save(),this._applyStates(e),this._processMeasures(t,e)&&this._renderLines(e),e.restore()},s.prototype._applyStates=function(t){r.prototype._applyStates.call(this,t),this.outlineWidth&&(t.lineWidth=this.outlineWidth,t.strokeStyle=this.outlineColor)},s.prototype._additionalProcessing=function(t,e){this._lines=[];var i=this.text.split("\n");if(this._textWrapping&&!this._resizeToFit)for(var r=0,s=i;r<s.length;r++){var n=s[r];this._lines.push(this._parseLineWithTextWrapping(n,e))}else for(var o=0,h=i;o<h.length;o++){var n=h[o];this._lines.push(this._parseLine(n,e))}this.onLinesReadyObservable.notifyObservers(this)},s.prototype._parseLine=function(t,e){return void 0===t&&(t=""),{text:t,width:e.measureText(t).width}},s.prototype._parseLineWithTextWrapping=function(t,e){void 0===t&&(t="");for(var i=t.split(" "),r=this._currentMeasure.width,s=0,n=0;n<i.length;n++){var o=n>0?t+" "+i[n]:i[0],h=e.measureText(o),a=h.width;a>r&&n>0?(this._lines.push({text:t,width:s}),t=i[n],s=e.measureText(t).width):(s=a,t=o)}return{text:t,width:s}},s.prototype._renderLines=function(t){var e=this._currentMeasure.height;this._fontOffset||(this._fontOffset=i.Control._GetFontOffset(t.font));var r=0;switch(this._textVerticalAlignment){case i.Control.VERTICAL_ALIGNMENT_TOP:r=this._fontOffset.ascent;break;case i.Control.VERTICAL_ALIGNMENT_BOTTOM:r=e-this._fontOffset.height*(this._lines.length-1)-this._fontOffset.descent;break;case i.Control.VERTICAL_ALIGNMENT_CENTER:r=this._fontOffset.ascent+(e-this._fontOffset.height*this._lines.length)/2}r+=this._currentMeasure.top;for(var s=0,n=0;n<this._lines.length;n++){var o=this._lines[n];0!==n&&0!==this._lineSpacing.internalValue&&(this._lineSpacing.isPixel?r+=this._lineSpacing.getValue(this._host):r+=this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)),this._drawText(o.text,o.width,r,t),r+=this._fontOffset.height,o.width>s&&(s=o.width)}this._resizeToFit&&(this.width=this.paddingLeftInPixels+this.paddingRightInPixels+s+"px",this.height=this.paddingTopInPixels+this.paddingBottomInPixels+this._fontOffset.height*this._lines.length+"px")},s.prototype.dispose=function(){r.prototype.dispose.call(this),this.onTextChangedObservable.clear()},s})(i.Control);i.TextBlock=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t,i=Image;!(function(t){!(function(r){var s=(function(r){function s(t,e){void 0===e&&(e=null);var i=r.call(this,t)||this;return i.name=t,i._loaded=!1,i._stretch=s.STRETCH_FILL,i._autoScale=!1,i._sourceLeft=0,i._sourceTop=0,i._sourceWidth=0,i._sourceHeight=0,i._cellWidth=0,i._cellHeight=0,i._cellId=-1,i.source=e,i}return e(s,r),Object.defineProperty(s.prototype,"sourceLeft",{get:function(){return this._sourceLeft},set:function(t){this._sourceLeft!==t&&(this._sourceLeft=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"sourceTop",{get:function(){return this._sourceTop},set:function(t){this._sourceTop!==t&&(this._sourceTop=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"sourceWidth",{get:function(){return this._sourceWidth},set:function(t){this._sourceWidth!==t&&(this._sourceWidth=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"sourceHeight",{get:function(){return this._sourceHeight},set:function(t){this._sourceHeight!==t&&(this._sourceHeight=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"autoScale",{get:function(){return this._autoScale},set:function(t){this._autoScale!==t&&(this._autoScale=t,t&&this._loaded&&this.synchronizeSizeWithContent())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"stretch",{get:function(){return this._stretch},set:function(t){this._stretch!==t&&(this._stretch=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"domImage",{get:function(){return this._domImage},set:function(t){var e=this;this._domImage=t,this._loaded=!1,this._domImage.width?this._onImageLoaded():this._domImage.onload=function(){e._onImageLoaded()}},enumerable:!0,configurable:!0}),s.prototype._onImageLoaded=function(){this._imageWidth=this._domImage.width,this._imageHeight=this._domImage.height,this._loaded=!0,this._autoScale&&this.synchronizeSizeWithContent(),this._markAsDirty()},Object.defineProperty(s.prototype,"source",{set:function(e){var r=this;this._source!==e&&(this._loaded=!1,this._source=e,this._domImage=new i,this._domImage.onload=function(){r._onImageLoaded()},e&&(t.Tools.SetCorsBehavior(e,this._domImage),this._domImage.src=e))},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"cellWidth",{get:function(){return this._cellWidth},set:function(t){this._cellWidth!==t&&(this._cellWidth=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"cellHeight",{get:function(){return this._cellHeight},set:function(t){this._cellHeight!==t&&(this._cellHeight=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"cellId",{get:function(){return this._cellId},set:function(t){this._cellId!==t&&(this._cellId=t,this._markAsDirty())},enumerable:!0,configurable:!0}),s.prototype._getTypeName=function(){return"Image"},s.prototype.synchronizeSizeWithContent=function(){this._loaded&&(this.width=this._domImage.width+"px",this.height=this._domImage.height+"px")},s.prototype._draw=function(t,e){e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY);var i,r,n,o;if(-1==this.cellId)i=this._sourceLeft,r=this._sourceTop,n=this._sourceWidth?this._sourceWidth:this._imageWidth,o=this._sourceHeight?this._sourceHeight:this._imageHeight;else{var h=this._domImage.naturalWidth/this.cellWidth,a=this.cellId/h>>0,u=this.cellId%h;i=this.cellWidth*u,r=this.cellHeight*a,n=this.cellWidth,o=this.cellHeight}if(this._applyStates(e),this._processMeasures(t,e)&&this._loaded)switch(this._stretch){case s.STRETCH_NONE:case s.STRETCH_FILL:e.drawImage(this._domImage,i,r,n,o,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case s.STRETCH_UNIFORM:var l=this._currentMeasure.width/n,c=this._currentMeasure.height/o,_=Math.min(l,c),f=(this._currentMeasure.width-n*_)/2,d=(this._currentMeasure.height-o*_)/2;e.drawImage(this._domImage,i,r,n,o,this._currentMeasure.left+f,this._currentMeasure.top+d,n*_,o*_);break;case s.STRETCH_EXTEND:e.drawImage(this._domImage,i,r,n,o,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height),this._autoScale&&this.synchronizeSizeWithContent(),this._root&&this._root.parent&&(this._root.width=this.width,this._root.height=this.height)}e.restore()},Object.defineProperty(s,"STRETCH_NONE",{get:function(){return s._STRETCH_NONE},enumerable:!0,configurable:!0}),Object.defineProperty(s,"STRETCH_FILL",{get:function(){return s._STRETCH_FILL},enumerable:!0,configurable:!0}),Object.defineProperty(s,"STRETCH_UNIFORM",{get:function(){return s._STRETCH_UNIFORM},enumerable:!0,configurable:!0}),Object.defineProperty(s,"STRETCH_EXTEND",{get:function(){return s._STRETCH_EXTEND},enumerable:!0,configurable:!0}),s._STRETCH_NONE=0,s._STRETCH_FILL=1,s._STRETCH_UNIFORM=2,s._STRETCH_EXTEND=3,s})(r.Control);r.Image=s})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(i){var r=(function(i){function r(t){var e=i.call(this,t)||this;return e.name=t,e.thickness=1,e.isPointerBlocker=!0,e.pointerEnterAnimation=function(){e.alpha-=.1},e.pointerOutAnimation=function(){e.alpha+=.1},e.pointerDownAnimation=function(){e.scaleX-=.05,e.scaleY-=.05},e.pointerUpAnimation=function(){e.scaleX+=.05,e.scaleY+=.05},e}return e(r,i),r.prototype._getTypeName=function(){return"Button"},r.prototype._processPicking=function(t,e,r,s,n){return!(!this.isHitTestVisible||!this.isVisible||this.notRenderable)&&(!!i.prototype.contains.call(this,t,e)&&(this._processObservables(r,t,e,s,n),!0))},r.prototype._onPointerEnter=function(t){return!!i.prototype._onPointerEnter.call(this,t)&&(this.pointerEnterAnimation&&this.pointerEnterAnimation(),!0)},r.prototype._onPointerOut=function(t){this.pointerOutAnimation&&this.pointerOutAnimation(),i.prototype._onPointerOut.call(this,t)},r.prototype._onPointerDown=function(t,e,r,s){return!!i.prototype._onPointerDown.call(this,t,e,r,s)&&(this.pointerDownAnimation&&this.pointerDownAnimation(),!0)},r.prototype._onPointerUp=function(t,e,r,s,n){this.pointerUpAnimation&&this.pointerUpAnimation(),i.prototype._onPointerUp.call(this,t,e,r,s,n)},r.CreateImageButton=function(e,i,s){var n=new r(e),o=new t.GUI.TextBlock(e+"_button",i);o.textWrapping=!0,o.textHorizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER,o.paddingLeft="20%",n.addControl(o);var h=new t.GUI.Image(e+"_icon",s);return h.width="20%",h.stretch=t.GUI.Image.STRETCH_UNIFORM,h.horizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT,n.addControl(h),n},r.CreateImageOnlyButton=function(e,i){var s=new r(e),n=new t.GUI.Image(e+"_icon",i);return n.stretch=t.GUI.Image.STRETCH_FILL,n.horizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT,s.addControl(n),s},r.CreateSimpleButton=function(e,i){var s=new r(e),n=new t.GUI.TextBlock(e+"_button",i);return n.textWrapping=!0,n.textHorizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER,s.addControl(n),s},r.CreateImageWithCenterTextButton=function(e,i,s){var n=new r(e),o=new t.GUI.Image(e+"_icon",s);o.stretch=t.GUI.Image.STRETCH_FILL,n.addControl(o);var h=new t.GUI.TextBlock(e+"_button",i);return h.textWrapping=!0,h.textHorizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER,n.addControl(h),n},r})(i.Rectangle);i.Button=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(i){var r=(function(i){function r(e){var r=i.call(this,e)||this;return r.name=e,r._value=t.Color3.Red(),r._tmpColor=new t.Color3,r._pointerStartedOnSquare=!1,r._pointerStartedOnWheel=!1,r._squareLeft=0,r._squareTop=0,r._squareSize=0,r._h=360,r._s=1,r._v=1,r.onValueChangedObservable=new t.Observable,r._pointerIsDown=!1,r.value=new t.Color3(.88,.1,.1),r.size="200px",r.isPointerBlocker=!0,r}return e(r,i),Object.defineProperty(r.prototype,"value",{get:function(){return this._value},set:function(t){this._value.equals(t)||(this._value.copyFrom(t),this._RGBtoHSV(this._value,this._tmpColor),this._h=this._tmpColor.r,this._s=Math.max(this._tmpColor.g,1e-5),this._v=Math.max(this._tmpColor.b,1e-5),this._markAsDirty(),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"width",{set:function(t){this._width.toString(this._host)!==t&&this._width.fromString(t)&&(this._height.fromString(t),this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"height",{set:function(t){this._height.toString(this._host)!==t&&this._height.fromString(t)&&(this._width.fromString(t),this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"size",{get:function(){return this.width},set:function(t){this.width=t},enumerable:!0,configurable:!0}),r.prototype._getTypeName=function(){return"ColorPicker"},r.prototype._updateSquareProps=function(){var t=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),e=.2*t,i=2*(t-e),r=i/Math.sqrt(2),s=t-.5*r;this._squareLeft=this._currentMeasure.left+s,this._squareTop=this._currentMeasure.top+s,this._squareSize=r},r.prototype._drawGradientSquare=function(t,e,i,r,s,n){var o=n.createLinearGradient(e,i,r+e,i);o.addColorStop(0,"#fff"),o.addColorStop(1,"hsl("+t+", 100%, 50%)"),n.fillStyle=o,n.fillRect(e,i,r,s);var h=n.createLinearGradient(e,i,e,s+i);h.addColorStop(0,"rgba(0,0,0,0)"),h.addColorStop(1,"#000"),n.fillStyle=h,n.fillRect(e,i,r,s)},r.prototype._drawCircle=function(t,e,i,r){r.beginPath(),r.arc(t,e,i+1,0,2*Math.PI,!1),r.lineWidth=3,r.strokeStyle="#333333",r.stroke(),r.beginPath(),r.arc(t,e,i,0,2*Math.PI,!1),r.lineWidth=3,r.strokeStyle="#ffffff",r.stroke()},r.prototype._createColorWheelCanvas=function(t,e){var i=document.createElement("canvas");i.width=2*t,i.height=2*t;for(var r=i.getContext("2d"),s=r.getImageData(0,0,2*t,2*t),n=s.data,o=this._tmpColor,h=t*t,a=t-e,u=a*a,l=-t;l<t;l++)for(var c=-t;c<t;c++){var _=l*l+c*c;if(!(_>h||_<u)){var f=Math.sqrt(_),d=Math.atan2(c,l);this._HSVtoRGB(180*d/Math.PI+180,f/t,1,o);var p=4*(l+t+2*(c+t)*t);n[p]=255*o.r,n[p+1]=255*o.g,n[p+2]=255*o.b;var g=(f-a)/(t-a),m=.2;m=t<50?.2:t>150?.04:-.16*(t-50)/100+.2;var g=(f-a)/(t-a);n[p+3]=g<m?g/m*255:g>1-m?255*(1-(g-(1-m))/m):255}}return r.putImageData(s,0,0),i},r.prototype._RGBtoHSV=function(t,e){var i=t.r,r=t.g,s=t.b,n=Math.max(i,r,s),o=Math.min(i,r,s),h=0,a=0,u=n,l=n-o;0!==n&&(a=l/n),n!=o&&(n==i?(h=(r-s)/l,r<s&&(h+=6)):n==r?h=(s-i)/l+2:n==s&&(h=(i-r)/l+4),h*=60),e.r=h,e.g=a,e.b=u},r.prototype._HSVtoRGB=function(t,e,i,r){var s=i*e,n=t/60,o=s*(1-Math.abs(n%2-1)),h=0,a=0,u=0;n>=0&&n<=1?(h=s,a=o):n>=1&&n<=2?(h=o,a=s):n>=2&&n<=3?(a=s,u=o):n>=3&&n<=4?(a=o,u=s):n>=4&&n<=5?(h=o,u=s):n>=5&&n<=6&&(h=s,u=o);var l=i-s;r.set(h+l,a+l,u+l)},r.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,s=this._currentMeasure.left,n=this._currentMeasure.top;this._colorWheelCanvas&&this._colorWheelCanvas.width==2*i||(this._colorWheelCanvas=this._createColorWheelCanvas(i,r)),this._updateSquareProps(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY,e.fillRect(this._squareLeft,this._squareTop,this._squareSize,this._squareSize)),e.drawImage(this._colorWheelCanvas,s,n),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),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=s+i+Math.cos((this._h-180)*Math.PI/180)*a,h=n+i+Math.sin((this._h-180)*Math.PI/180)*a,this._drawCircle(o,h,.35*r,e)}e.restore()},r.prototype._updateValueFromPointer=function(t,e){if(this._pointerStartedOnWheel){var i=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),r=i+this._currentMeasure.left,s=i+this._currentMeasure.top;this._h=180*Math.atan2(e-s,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},r.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},r.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,s=.2*e,n=e-s,o=e*e,h=n*n,a=t.x-i,u=t.y-r,l=a*a+u*u;return l<=o&&l>=h},r.prototype._onPointerDown=function(t,e,r,s){return!!i.prototype._onPointerDown.call(this,t,e,r,s)&&(this._pointerIsDown=!0,this._pointerStartedOnSquare=!1,this._pointerStartedOnWheel=!1,this._isPointOnSquare(e)?this._pointerStartedOnSquare=!0:this._isPointOnWheel(e)&&(this._pointerStartedOnWheel=!0),this._updateValueFromPointer(e.x,e.y),this._host._capturingControl[r]=this,!0)},r.prototype._onPointerMove=function(t,e){this._pointerIsDown&&this._updateValueFromPointer(e.x,e.y),i.prototype._onPointerMove.call(this,t,e)},r.prototype._onPointerUp=function(t,e,r,s,n){this._pointerIsDown=!1,delete this._host._capturingControl[r],i.prototype._onPointerUp.call(this,t,e,r,s,n)},r})(i.Control);i.ColorPicker=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(i){var r=(function(r){function s(e,s){void 0===s&&(s="");var n=r.call(this,e)||this;return n.name=e,n._text="",n._placeholderText="",n._background="#222222",n._focusedBackground="#000000",n._placeholderColor="gray",n._thickness=1,n._margin=new i.ValueAndUnit(10,i.ValueAndUnit.UNITMODE_PIXEL),n._autoStretchWidth=!0,n._maxWidth=new i.ValueAndUnit(1,i.ValueAndUnit.UNITMODE_PERCENTAGE,!1),n._isFocused=!1,n._blinkIsEven=!1,n._cursorOffset=0,n.promptMessage="Please enter text:",n.onTextChangedObservable=new t.Observable,n.onFocusObservable=new t.Observable,n.onBlurObservable=new t.Observable,n.text=s,n}return e(s,r),Object.defineProperty(s.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(s.prototype,"maxWidthInPixels",{get:function(){return this._maxWidth.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(s.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(s.prototype,"marginInPixels",{get:function(){return this._margin.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"autoStretchWidth",{get:function(){return this._autoStretchWidth},set:function(t){this._autoStretchWidth!==t&&(this._autoStretchWidth=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"focusedBackground",{get:function(){return this._focusedBackground},set:function(t){this._focusedBackground!==t&&(this._focusedBackground=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"placeholderColor",{get:function(){return this._placeholderColor},set:function(t){this._placeholderColor!==t&&(this._placeholderColor=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"placeholderText",{get:function(){return this._placeholderText},set:function(t){this._placeholderText!==t&&(this._placeholderText=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.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}),Object.defineProperty(s.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(t){this._width.toString(this._host)!==t&&(this._width.fromString(t)&&this._markAsDirty(),this.autoStretchWidth=!1)},enumerable:!0,configurable:!0}),s.prototype.onBlur=function(){this._isFocused=!1,this._scrollLeft=null,this._cursorOffset=0,clearTimeout(this._blinkTimeout),this._markAsDirty(),this.onBlurObservable.notifyObservers(this)},s.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")){var t=prompt(this.promptMessage);return null!==t&&(this.text=t),void(this._host.focusedControl=null)}},s.prototype._getTypeName=function(){return"InputText"},s.prototype.processKey=function(t,e){switch(t){case 32:e=" ";break;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)}},s.prototype.processKeyboard=function(t){this.processKey(t.keyCode,t.key)},s.prototype._draw=function(t,e){var r=this;if(e.save(),this._applyStates(e),this._processMeasures(t,e)){(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._isFocused?this._focusedBackground&&(e.fillStyle=this._focusedBackground,e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)):this._background&&(e.fillStyle=this._background,e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._fontOffset||(this._fontOffset=i.Control._GetFontOffset(e.font));var s=this._currentMeasure.left+this._margin.getValueInPixel(this._host,t.width);this.color&&(e.fillStyle=this.color);var n=this._text;this._isFocused||this._text||!this._placeholderText||(n=this._placeholderText,this._placeholderColor&&(e.fillStyle=this._placeholderColor)),this._textWidth=e.measureText(n).width;var o=2*this._margin.getValueInPixel(this._host,t.width);this._autoStretchWidth&&(this.width=Math.min(this._maxWidth.getValueInPixel(this._host,t.width),this._textWidth+o)+"px");var h=this._fontOffset.ascent+(this._currentMeasure.height-this._fontOffset.height)/2,a=this._width.getValueInPixel(this._host,t.width)-o;if(e.save(),e.beginPath(),e.rect(s,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,a+2,this._currentMeasure.height),e.clip(),this._isFocused&&this._textWidth>a){var u=s-this._textWidth+a;this._scrollLeft||(this._scrollLeft=u)}else this._scrollLeft=s;if(e.fillText(n,this._scrollLeft,this._currentMeasure.top+h),this._isFocused){if(this._clickedCoordinate){var l=this._scrollLeft+this._textWidth,c=l-this._clickedCoordinate,_=0;this._cursorOffset=0;var f=0;do{this._cursorOffset&&(f=Math.abs(c-_)),this._cursorOffset++,_=e.measureText(n.substr(n.length-this._cursorOffset,this._cursorOffset)).width}while(_<c&&n.length>=this._cursorOffset);Math.abs(c-_)>f&&this._cursorOffset--,this._blinkIsEven=!1,this._clickedCoordinate=null}if(!this._blinkIsEven){var d=this.text.substr(this._text.length-this._cursorOffset),p=e.measureText(d).width,g=this._scrollLeft+this._textWidth-p;g<s?(this._scrollLeft+=s-g,g=s,this._markAsDirty()):g>s+a&&(this._scrollLeft+=s+a-g,g=s+a,this._markAsDirty()),e.fillRect(g,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)}e.restore(),this._thickness&&(this.color&&(e.strokeStyle=this.color),e.lineWidth=this._thickness,e.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness))}e.restore()},s.prototype._onPointerDown=function(t,e,i,s){return!!r.prototype._onPointerDown.call(this,t,e,i,s)&&(this._clickedCoordinate=e.x,this._host.focusedControl===this?(clearTimeout(this._blinkTimeout),this._markAsDirty(),!0):(this._host.focusedControl=this,!0))},s.prototype._onPointerUp=function(t,e,i,s,n){r.prototype._onPointerUp.call(this,t,e,i,s,n)},s.prototype.dispose=function(){r.prototype.dispose.call(this),this.onBlurObservable.clear(),this.onFocusObservable.clear(),this.onTextChangedObservable.clear()},s})(i.Control);i.InputText=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(i){var r=(function(){function t(){}return t})();i.KeyPropertySet=r;var s=(function(r){function s(){
var e=null!==r&&r.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.shiftButtonColor="#7799FF",e.selectedShiftThickness=1,e.shiftState=0,e}return e(s,r),s.prototype._getTypeName=function(){return"VirtualKeyboard"},s.prototype._createKey=function(t,e){var r=this,s=i.Button.CreateSimpleButton(t,t);return s.width=e&&e.width?e.width:this.defaultButtonWidth,s.height=e&&e.height?e.height:this.defaultButtonHeight,s.color=e&&e.color?e.color:this.defaultButtonColor,s.background=e&&e.background?e.background:this.defaultButtonBackground,s.paddingLeft=e&&e.paddingLeft?e.paddingLeft:this.defaultButtonPaddingLeft,s.paddingRight=e&&e.paddingRight?e.paddingRight:this.defaultButtonPaddingRight,s.paddingTop=e&&e.paddingTop?e.paddingTop:this.defaultButtonPaddingTop,s.paddingBottom=e&&e.paddingBottom?e.paddingBottom:this.defaultButtonPaddingBottom,s.thickness=0,s.isFocusInvisible=!0,s.shadowColor=this.shadowColor,s.shadowBlur=this.shadowBlur,s.shadowOffsetX=this.shadowOffsetX,s.shadowOffsetY=this.shadowOffsetY,s.onPointerUpObservable.add((function(){r.onKeyPressObservable.notifyObservers(t)})),s},s.prototype.addKeysRow=function(t,e){var r=new i.StackPanel;r.isVertical=!1,r.isFocusInvisible=!0;for(var s=0;s<t.length;s++){var n=null;e&&e.length===t.length&&(n=e[s]),r.addControl(this._createKey(t[s],n))}this.addControl(r)},s.prototype.applyShiftState=function(t){if(this.children)for(var e=0;e<this.children.length;e++){var i=this.children[e];if(i&&i.children)for(var r=i,s=0;s<r.children.length;s++){var n=r.children[s];if(n&&n.children[0]){var o=n.children[0];"⇧"===o.text&&(n.color=t?this.shiftButtonColor:this.defaultButtonColor,n.thickness=t>1?this.selectedShiftThickness:0),o.text=t>0?o.text.toUpperCase():o.text.toLowerCase()}}}},Object.defineProperty(s.prototype,"connectedInputText",{get:function(){return this._connectedInputText},enumerable:!0,configurable:!0}),s.prototype.connect=function(t){var e=this;this.isVisible=!1,this._connectedInputText=t,this._onFocusObserver=t.onFocusObservable.add((function(){e.isVisible=!0})),this._onBlurObserver=t.onBlurObservable.add((function(){e.isVisible=!1})),this._onKeyPressObserver=this.onKeyPressObservable.add((function(t){if(e._connectedInputText){switch(t){case"⇧":return e.shiftState++,e.shiftState>2&&(e.shiftState=0),void e.applyShiftState(e.shiftState);case"←":return void e._connectedInputText.processKey(8);case"↵":return void e._connectedInputText.processKey(13)}e._connectedInputText.processKey(-1,e.shiftState?t.toUpperCase():t),1===e.shiftState&&(e.shiftState=0,e.applyShiftState(e.shiftState))}}))},s.prototype.disconnect=function(){this._connectedInputText&&(this._connectedInputText.onFocusObservable.remove(this._onFocusObserver),this._connectedInputText.onBlurObservable.remove(this._onBlurObserver),this.onKeyPressObservable.remove(this._onKeyPressObserver),this._connectedInputText=null)},s.CreateDefaultLayout=function(){var t=new s;return t.addKeysRow(["1","2","3","4","5","6","7","8","9","0","←"]),t.addKeysRow(["q","w","e","r","t","y","u","i","o","p"]),t.addKeysRow(["a","s","d","f","g","h","j","k","l",";","'","↵"]),t.addKeysRow(["⇧","z","x","c","v","b","n","m",",",".","/"]),t.addKeysRow([" "],[{width:"200px"}]),t},s})(i.StackPanel);i.VirtualKeyboard=s})(t.GUI||(t.GUI={}))})(t||(t={}));var t;return (function(t){!(function(i){var r=(function(r){function s(t){var e=r.call(this,t)||this;return e.name=t,e._lineWidth=1,e.onPointUpdate=function(){e._markAsDirty()},e.isHitTestVisible=!1,e._horizontalAlignment=i.Control.HORIZONTAL_ALIGNMENT_LEFT,e._verticalAlignment=i.Control.VERTICAL_ALIGNMENT_TOP,e._dash=[],e._points=[],e}return e(s,r),Object.defineProperty(s.prototype,"dash",{get:function(){return this._dash},set:function(t){this._dash!==t&&(this._dash=t,this._markAsDirty())},enumerable:!0,configurable:!0}),s.prototype.getAt=function(t){return this._points[t]||(this._points[t]=new i.MultiLinePoint(this)),this._points[t]},s.prototype.add=function(){for(var t=this,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return e.map((function(e){return t.push(e)}))},s.prototype.push=function(e){var r=this.getAt(this._points.length);return null==e?r:(e instanceof t.AbstractMesh?r.mesh=e:e instanceof i.Control?r.control=e:null!=e.x&&null!=e.y&&(r.x=e.x,r.y=e.y),r)},s.prototype.remove=function(t){var e;if(t instanceof i.MultiLinePoint){if(-1===(e=this._points.indexOf(t)))return}else e=t;var r=this._points[e];r&&(r.dispose(),this._points.splice(e,1))},Object.defineProperty(s.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(t){this._lineWidth!==t&&(this._lineWidth=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"horizontalAlignment",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"verticalAlignment",{set:function(t){},enumerable:!0,configurable:!0}),s.prototype._getTypeName=function(){return"MultiLine"},s.prototype._draw=function(t,e){if(e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._applyStates(e),this._processMeasures(t,e)){e.strokeStyle=this.color,e.lineWidth=this._lineWidth,e.setLineDash(this._dash),e.beginPath();var i=!0;this._points.forEach((function(t){t&&(i?(e.moveTo(t._point.x,t._point.y),i=!1):e.lineTo(t._point.x,t._point.y))})),e.stroke()}e.restore()},s.prototype._additionalProcessing=function(t,e){var i=this;this._minX=null,this._minY=null,this._maxX=null,this._maxY=null,this._points.forEach((function(t,e){t&&(t.translate(),(null==i._minX||t._point.x<i._minX)&&(i._minX=t._point.x),(null==i._minY||t._point.y<i._minY)&&(i._minY=t._point.y),(null==i._maxX||t._point.x>i._maxX)&&(i._maxX=t._point.x),(null==i._maxY||t._point.y>i._maxY)&&(i._maxY=t._point.y))})),null==this._minX&&(this._minX=0),null==this._minY&&(this._minY=0),null==this._maxX&&(this._maxX=0),null==this._maxY&&(this._maxY=0)},s.prototype._measure=function(){null!=this._minX&&null!=this._maxX&&null!=this._minY&&null!=this._maxY&&(this._currentMeasure.width=Math.abs(this._maxX-this._minX)+this._lineWidth,this._currentMeasure.height=Math.abs(this._maxY-this._minY)+this._lineWidth)},s.prototype._computeAlignment=function(t,e){null!=this._minX&&null!=this._minY&&(this._currentMeasure.left=this._minX-this._lineWidth/2,this._currentMeasure.top=this._minY-this._lineWidth/2)},s.prototype.dispose=function(){for(;this._points.length>0;)this.remove(this._points.length-1);r.prototype.dispose.call(this)},s})(i.Control);i.MultiLine=r})(t.GUI||(t.GUI={}))})(t||(t={})),t.GUI}));