diff --git "a/libs/babylon.gui.min.js" "b/libs/babylon.gui.min.js" new file mode 100644--- /dev/null +++ "b/libs/babylon.gui.min.js" @@ -0,0 +1,16 @@ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-gui",["babylonjs"],e):"object"==typeof exports?exports["babylonjs-gui"]=e(require("babylonjs")):(t.BABYLON=t.BABYLON||{},t.BABYLON.GUI=e(t.BABYLON))}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(function(t){return function(t){var e={};function i(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)i.d(n,o,function(e){return t[e]}.bind(null,o));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=2)}([function(e,i){e.exports=t},function(t,e,i){"use strict";i.r(e),i.d(e,"Button",(function(){return O})),i.d(e,"Checkbox",(function(){return C})),i.d(e,"ColorPicker",(function(){return R})),i.d(e,"Container",(function(){return m})),i.d(e,"Control",(function(){return g})),i.d(e,"Ellipse",(function(){return w})),i.d(e,"FocusableButton",(function(){return M})),i.d(e,"Grid",(function(){return S})),i.d(e,"Image",(function(){return P})),i.d(e,"InputText",(function(){return I})),i.d(e,"InputPassword",(function(){return E})),i.d(e,"Line",(function(){return D})),i.d(e,"MultiLine",(function(){return F})),i.d(e,"RadioButton",(function(){return N})),i.d(e,"StackPanel",(function(){return B})),i.d(e,"SelectorGroup",(function(){return z})),i.d(e,"CheckboxGroup",(function(){return Q})),i.d(e,"RadioGroup",(function(){return V})),i.d(e,"SliderGroup",(function(){return j})),i.d(e,"SelectionPanel",(function(){return H})),i.d(e,"ScrollViewer",(function(){return X})),i.d(e,"TextWrapping",(function(){return v})),i.d(e,"TextBlock",(function(){return x})),i.d(e,"TextWrapper",(function(){return T})),i.d(e,"ToggleButton",(function(){return Y})),i.d(e,"KeyPropertySet",(function(){return K})),i.d(e,"VirtualKeyboard",(function(){return Z})),i.d(e,"Rectangle",(function(){return y})),i.d(e,"DisplayGrid",(function(){return q})),i.d(e,"BaseSlider",(function(){return k})),i.d(e,"Slider",(function(){return A})),i.d(e,"ImageBasedSlider",(function(){return J})),i.d(e,"ScrollBar",(function(){return G})),i.d(e,"ImageScrollBar",(function(){return U})),i.d(e,"name",(function(){return $})),i.d(e,"AdvancedDynamicTexture",(function(){return et})),i.d(e,"AdvancedDynamicTextureInstrumentation",(function(){return it})),i.d(e,"Vector2WithInfo",(function(){return p})),i.d(e,"Matrix2D",(function(){return b})),i.d(e,"Measure",(function(){return f})),i.d(e,"MultiLinePoint",(function(){return L})),i.d(e,"Style",(function(){return tt})),i.d(e,"ValueAndUnit",(function(){return _})),i.d(e,"XmlLoader",(function(){return ot})),i.d(e,"AbstractButton3D",(function(){return lt})),i.d(e,"Button3D",(function(){return _t})),i.d(e,"Container3D",(function(){return ht})),i.d(e,"Control3D",(function(){return at})),i.d(e,"CylinderPanel",(function(){return ut})),i.d(e,"HolographicButton",(function(){return gt})),i.d(e,"HolographicSlate",(function(){return kt})),i.d(e,"HandMenu",(function(){return zt})),i.d(e,"MeshButton3D",(function(){return Qt})),i.d(e,"NearMenu",(function(){return Vt})),i.d(e,"PlanePanel",(function(){return jt})),i.d(e,"ScatterPanel",(function(){return Ht})),i.d(e,"Slider3D",(function(){return ie})),i.d(e,"SpherePanel",(function(){return ne})),i.d(e,"StackPanel3D",(function(){return oe})),i.d(e,"TouchButton3D",(function(){return Pt})),i.d(e,"TouchMeshButton3D",(function(){return re})),i.d(e,"TouchHolographicButton",(function(){return Ot})),i.d(e,"TouchHolographicMenu",(function(){return At})),i.d(e,"VolumeBasedPanel",(function(){return ct})),i.d(e,"HolographicBackplate",(function(){return ae})),i.d(e,"FluentMaterialDefines",(function(){return pt})),i.d(e,"FluentMaterial",(function(){return bt})),i.d(e,"FluentButtonMaterial",(function(){return xt})),i.d(e,"FluentBackplateMaterial",(function(){return Nt})),i.d(e,"HandleMaterial",(function(){return St})),i.d(e,"MRDLSliderBarMaterial",(function(){return Xt})),i.d(e,"MRDLSliderThumbMaterial",(function(){return qt})),i.d(e,"MRDLBackplateMaterial",(function(){return ee})),i.d(e,"SlateGizmo",(function(){return Et})),i.d(e,"HandleState",(function(){return It})),i.d(e,"GizmoHandle",(function(){return Rt})),i.d(e,"SideHandle",(function(){return wt})),i.d(e,"CornerHandle",(function(){return Mt})),i.d(e,"GUI3DManager",(function(){return se})),i.d(e,"Vector3WithInfo",(function(){return rt})); +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,e)};function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function r(t,e,i,n){var o,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(r<3?o(a):r>3?o(e,i,a):o(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a}function a(t,e,i,n){return new(i||(i=Promise))((function(o,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function s(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}l((n=n.apply(t,e||[])).next())}))}function s(t,e){var i,n,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,n&&(o=2&r[0]?n.return:r[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,r[1])).done)return o;switch(n=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,n=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]1?this.notRenderable=!0:this.notRenderable=!1}else l.Tools.Error("Cannot move a control to a vector3 if the control is not at root level")},t.prototype.getDescendantsToRef=function(t,e,i){void 0===e&&(e=!1)},t.prototype.getDescendants=function(t,e){var i=new Array;return this.getDescendantsToRef(i,t,e),i},t.prototype.linkWithMesh=function(e){if(!this._host||this.parent&&this.parent!==this._host._rootContainer)e&&l.Tools.Error("Cannot link a control to a mesh if the control is not at root level");else{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.HORIZONTAL_ALIGNMENT_LEFT,this.verticalAlignment=t.VERTICAL_ALIGNMENT_TOP,this._linkedMesh=e,this._host._linkedControls.push(this))}},t.prototype.setPadding=function(t,e,i,n){var o=t,r=null!=e?e:o,a=null!=i?i:o,s=null!=n?n:r;this.paddingTop=o,this.paddingRight=r,this.paddingBottom=a,this.paddingLeft=s},t.prototype.setPaddingInPixels=function(t,e,i,n){var o=t,r=null!=e?e:o,a=null!=i?i:o,s=null!=n?n:r;this.paddingTopInPixels=o,this.paddingRightInPixels=r,this.paddingBottomInPixels=a,this.paddingLeftInPixels=s},t.prototype._moveToProjectedPosition=function(t){var e,i=this._left.getValue(this._host),n=this._top.getValue(this._host),o=null===(e=this.parent)||void 0===e?void 0:e._currentMeasure;o&&this._processMeasures(o,this._host.getContext());var r=t.x+this._linkOffsetX.getValue(this._host)-this._currentMeasure.width/2,a=t.y+this._linkOffsetY.getValue(this._host)-this._currentMeasure.height/2;this._left.ignoreAdaptiveScaling&&this._top.ignoreAdaptiveScaling&&(Math.abs(r-i)<.5&&(r=i),Math.abs(a-n)<.5&&(a=n)),this.left=r+"px",this.top=a+"px",this._left.ignoreAdaptiveScaling=!0,this._top.ignoreAdaptiveScaling=!0,this._markAsDirty()},t.prototype._offsetLeft=function(t){this._isDirty=!0,this._currentMeasure.left+=t},t.prototype._offsetTop=function(t){this._isDirty=!0,this._currentMeasure.top+=t},t.prototype._markMatrixAsDirty=function(){this._isMatrixDirty=!0,this._flagDescendantsAsMatrixDirty()},t.prototype._flagDescendantsAsMatrixDirty=function(){},t.prototype._intersectsRect=function(t,e){return this._transform(e),!(this._evaluatedMeasure.left>=t.left+t.width)&&(!(this._evaluatedMeasure.top>=t.top+t.height)&&(!(this._evaluatedMeasure.left+this._evaluatedMeasure.width<=t.left)&&!(this._evaluatedMeasure.top+this._evaluatedMeasure.height<=t.top)))},t.prototype._computeAdditionnalOffsetX=function(){return 0},t.prototype._computeAdditionnalOffsetY=function(){return 0},t.prototype.invalidateRect=function(){if(this._transform(),this.host&&this.host.useInvalidateRectOptimization){this._currentMeasure.transformToRef(this._transformMatrix,this._tmpMeasureA),f.CombineToRef(this._tmpMeasureA,this._prevCurrentMeasureTransformedIntoGlobalSpace,this._tmpMeasureA);var t=this.shadowOffsetX,e=this.shadowOffsetY,i=Math.max(this._previousShadowBlur,this.shadowBlur),n=Math.min(Math.min(t,0)-2*i,0),o=Math.max(Math.max(t,0)+2*i,0),r=Math.min(Math.min(e,0)-2*i,0),a=Math.max(Math.max(e,0)+2*i,0),s=this._computeAdditionnalOffsetX(),l=this._computeAdditionnalOffsetY();this.host.invalidateRect(Math.floor(this._tmpMeasureA.left+n-s),Math.floor(this._tmpMeasureA.top+r-l),Math.ceil(this._tmpMeasureA.left+this._tmpMeasureA.width+o+s),Math.ceil(this._tmpMeasureA.top+this._tmpMeasureA.height+a+l))}},t.prototype._markAsDirty=function(t){void 0===t&&(t=!1),(this._isVisible||t)&&(this._isDirty=!0,this._markMatrixAsDirty(),this._host&&this._host.markAsDirty())},t.prototype._markAllAsDirty=function(){this._markAsDirty(),this._font&&this._prepareFont()},t.prototype._link=function(t){this._host=t,this._host&&(this.uniqueId=this._host.getScene().getUniqueId())},t.prototype._transform=function(t){if(this._isMatrixDirty||1!==this._scaleX||1!==this._scaleY||0!==this._rotation){var e=this._currentMeasure.width*this._transformCenterX+this._currentMeasure.left,i=this._currentMeasure.height*this._transformCenterY+this._currentMeasure.top;t&&(t.translate(e,i),t.rotate(this._rotation),t.scale(this._scaleX,this._scaleY),t.translate(-e,-i)),(this._isMatrixDirty||this._cachedOffsetX!==e||this._cachedOffsetY!==i)&&(this._cachedOffsetX=e,this._cachedOffsetY=i,this._isMatrixDirty=!1,this._flagDescendantsAsMatrixDirty(),b.ComposeToRef(-e,-i,this._rotation,this._scaleX,this._scaleY,this.parent?this.parent._transformMatrix:null,this._transformMatrix),this._transformMatrix.invertToRef(this._invertTransformMatrix),this._currentMeasure.transformToRef(this._transformMatrix,this._evaluatedMeasure))}},t.prototype._renderHighlight=function(t){this.isHighlighted&&(t.save(),t.strokeStyle=this._highlightColor,t.lineWidth=this._highlightLineWidth,this._renderHighlightSpecific(t),t.restore())},t.prototype._renderHighlightSpecific=function(t){t.strokeRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)},t.prototype._applyStates=function(e){this._isFontSizeInPercentage&&(this._fontSet=!0),this._host&&this._host.useSmallestIdeal&&!this._font&&(this._fontSet=!0),this._fontSet&&(this._prepareFont(),this._fontSet=!1),this._font&&(e.font=this._font),this._color&&(e.fillStyle=this._color),t.AllowAlphaInheritance?e.globalAlpha*=this._alpha:this._alphaSet&&(e.globalAlpha=this.parent&&!this.parent.renderToIntermediateTexture?this.parent.alpha*this._alpha:this._alpha)},t.prototype._layout=function(t,e){if(!this.isDirty&&(!this.isVisible||this.notRenderable))return!1;if(this._isDirty||!this._cachedParentMeasure.isEqualsTo(t)){this.host._numLayoutCalls++,this._currentMeasure.addAndTransformToRef(this._transformMatrix,0|-this._paddingLeftInPixels,0|-this._paddingTopInPixels,0|this._paddingRightInPixels,0|this._paddingBottomInPixels,this._prevCurrentMeasureTransformedIntoGlobalSpace),e.save(),this._applyStates(e);var i=0;do{this._rebuildLayout=!1,this._processMeasures(t,e),i++}while(this._rebuildLayout&&i<3);i>=3&&l.Logger.Error("Layout cycle detected in GUI (Control name=".concat(this.name,", uniqueId=").concat(this.uniqueId,")")),e.restore(),this.invalidateRect(),this._evaluateClippingState(t)}return this._wasDirty=this._isDirty,this._isDirty=!1,!0},t.prototype._processMeasures=function(t,e){this._tempPaddingMeasure.copyFrom(t),this.parent&&this.parent.descendantsOnlyPadding&&(this._tempPaddingMeasure.left+=this.parent.paddingLeftInPixels,this._tempPaddingMeasure.top+=this.parent.paddingTopInPixels,this._tempPaddingMeasure.width-=this.parent.paddingLeftInPixels+this.parent.paddingRightInPixels,this._tempPaddingMeasure.height-=this.parent.paddingTopInPixels+this.parent.paddingBottomInPixels),this._currentMeasure.copyFrom(this._tempPaddingMeasure),this._preMeasure(this._tempPaddingMeasure,e),this._measure(),this._computeAlignment(this._tempPaddingMeasure,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(this._tempPaddingMeasure,e),this._cachedParentMeasure.copyFrom(this._tempPaddingMeasure),this._currentMeasure.transformToRef(this._transformMatrix,this._evaluatedMeasure),this.onDirtyObservable.hasObservers()&&this.onDirtyObservable.notifyObservers(this)},t.prototype._evaluateClippingState=function(t){if(this._currentMeasure.transformToRef(this._transformMatrix,this._evaluatedMeasure),this.parent&&this.parent.clipChildren){if(t.transformToRef(this.parent._transformMatrix,this._evaluatedParentMeasure),this._evaluatedMeasure.left>this._evaluatedParentMeasure.left+this._evaluatedParentMeasure.width)return void(this._isClipped=!0);if(this._evaluatedMeasure.left+this._evaluatedMeasure.widththis._evaluatedParentMeasure.top+this._evaluatedParentMeasure.height)return void(this._isClipped=!0);if(this._evaluatedMeasure.top+this._evaluatedMeasure.heightthis._currentMeasure.left+this._currentMeasure.width)&&(!(ethis._currentMeasure.top+this._currentMeasure.height)&&(this.isPointerBlocker&&(this._host._shouldBlockPointer=!0),!0))))},t.prototype._processPicking=function(t,e,i,n,o,r,a,s){return!!this._isEnabled&&(!(!this.isHitTestVisible||!this.isVisible||this._doNotRender)&&(!!this.contains(t,e)&&(this._processObservables(n,t,e,i,o,r,a,s),!0)))},t.prototype._onPointerMove=function(t,e,i,n){this.onPointerMoveObservable.notifyObservers(e,-1,t,this,n)&&null!=this.parent&&this.parent._onPointerMove(t,e,i,n)},t.prototype._onPointerEnter=function(t,e){return!!this._isEnabled&&(!(this._enterCount>0)&&(-1===this._enterCount&&(this._enterCount=0),this._enterCount++,this.onPointerEnterObservable.notifyObservers(this,-1,t,this,e)&&null!=this.parent&&this.parent._onPointerEnter(t,e),!0))},t.prototype._onPointerOut=function(t,e,i){if(void 0===i&&(i=!1),i||this._isEnabled&&t!==this){this._enterCount=0;var n=!0;t.isAscendant(this)||(n=this.onPointerOutObservable.notifyObservers(this,-1,t,this,e)),n&&null!=this.parent&&this.parent._onPointerOut(t,e,i)}},t.prototype._onPointerDown=function(t,e,i,n,o){return this._onPointerEnter(this,o),0===this._downCount&&(this._downCount++,this._downPointerIds[i]=!0,this.onPointerDownObservable.notifyObservers(new p(e,n),-1,t,this,o)&&null!=this.parent&&this.parent._onPointerDown(t,e,i,n,o),!0)},t.prototype._onPointerUp=function(t,e,i,n,o,r){if(this._isEnabled){this._downCount=0,delete this._downPointerIds[i];var a=o;o&&(this._enterCount>0||-1===this._enterCount)&&(a=this.onPointerClickObservable.notifyObservers(new p(e,n),-1,t,this,r)),this.onPointerUpObservable.notifyObservers(new p(e,n),-1,t,this,r)&&null!=this.parent&&this.parent._onPointerUp(t,e,i,n,a,r)}},t.prototype._forcePointerUp=function(t){if(void 0===t&&(t=null),null!==t)this._onPointerUp(this,l.Vector2.Zero(),t,0,!0);else for(var e in this._downPointerIds)this._onPointerUp(this,l.Vector2.Zero(),+e,0,!0)},t.prototype._onWheelScroll=function(t,e){this._isEnabled&&(this.onWheelObservable.notifyObservers(new l.Vector2(t,e))&&null!=this.parent&&this.parent._onWheelScroll(t,e))},t.prototype._onCanvasBlur=function(){},t.prototype._processObservables=function(t,e,i,n,o,r,a,s){if(!this._isEnabled)return!1;if(this._dummyVector2.copyFromFloats(e,i),t===l.PointerEventTypes.POINTERMOVE){this._onPointerMove(this,this._dummyVector2,o,n);var _=this._host._lastControlOver[o];return _&&_!==this&&_._onPointerOut(this,n),_!==this&&this._onPointerEnter(this,n),this._host._lastControlOver[o]=this,!0}return t===l.PointerEventTypes.POINTERDOWN?(this._onPointerDown(this,this._dummyVector2,o,r,n),this._host._registerLastControlDown(this,o),this._host._lastPickedControl=this,!0):t===l.PointerEventTypes.POINTERUP?(this._host._lastControlDown[o]&&this._host._lastControlDown[o]._onPointerUp(this,this._dummyVector2,o,r,!0,n),delete this._host._lastControlDown[o],!0):!(t!==l.PointerEventTypes.POINTERWHEEL||!this._host._lastControlOver[o])&&(this._host._lastControlOver[o]._onWheelScroll(a,s),!0)},t.prototype._prepareFont=function(){(this._font||this._fontSet)&&(this._style?this._font=this._style.fontStyle+" "+this._style.fontWeight+" "+this.fontSizeInPixels+"px "+this._style.fontFamily:this._font=this._fontStyle+" "+this._fontWeight+" "+this.fontSizeInPixels+"px "+this._fontFamily,this._fontOffset=t._GetFontOffset(this._font),this.getDescendants().forEach((function(t){return t._markAllAsDirty()})))},t.prototype.serialize=function(t){l.SerializationHelper.Serialize(this,t),t.name=this.name,t.className=this.getClassName(),this._font&&(t.fontFamily=this._fontFamily,t.fontSize=this.fontSize,t.fontWeight=this.fontWeight,t.fontStyle=this.fontStyle)},t.prototype._parseFromContent=function(t,e){t.fontFamily&&(this.fontFamily=t.fontFamily),t.fontSize&&(this.fontSize=t.fontSize),t.fontWeight&&(this.fontWeight=t.fontWeight),t.fontStyle&&(this.fontStyle=t.fontStyle)},t.prototype.dispose=function(){(this.onDirtyObservable.clear(),this.onBeforeDrawObservable.clear(),this.onAfterDrawObservable.clear(),this.onPointerDownObservable.clear(),this.onPointerEnterObservable.clear(),this.onPointerMoveObservable.clear(),this.onPointerOutObservable.clear(),this.onPointerUpObservable.clear(),this.onPointerClickObservable.clear(),this.onWheelObservable.clear(),this._styleObserver&&this._style&&(this._style.onChangedObservable.remove(this._styleObserver),this._styleObserver=null),this.parent&&(this.parent.removeControl(this),this.parent=null),this._host)&&(this._host._linkedControls.indexOf(this)>-1&&this.linkWithMesh(null));this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()},Object.defineProperty(t,"HORIZONTAL_ALIGNMENT_LEFT",{get:function(){return t._HORIZONTAL_ALIGNMENT_LEFT},enumerable:!1,configurable:!0}),Object.defineProperty(t,"HORIZONTAL_ALIGNMENT_RIGHT",{get:function(){return t._HORIZONTAL_ALIGNMENT_RIGHT},enumerable:!1,configurable:!0}),Object.defineProperty(t,"HORIZONTAL_ALIGNMENT_CENTER",{get:function(){return t._HORIZONTAL_ALIGNMENT_CENTER},enumerable:!1,configurable:!0}),Object.defineProperty(t,"VERTICAL_ALIGNMENT_TOP",{get:function(){return t._VERTICAL_ALIGNMENT_TOP},enumerable:!1,configurable:!0}),Object.defineProperty(t,"VERTICAL_ALIGNMENT_BOTTOM",{get:function(){return t._VERTICAL_ALIGNMENT_BOTTOM},enumerable:!1,configurable:!0}),Object.defineProperty(t,"VERTICAL_ALIGNMENT_CENTER",{get:function(){return t._VERTICAL_ALIGNMENT_CENTER},enumerable:!1,configurable:!0}),t._GetFontOffset=function(e){if(t._FontHeightSizes[e])return t._FontHeightSizes[e];var i=l.EngineStore.LastCreatedEngine;if(!i)throw new Error("Invalid engine. Unable to create a canvas.");var n=i.getFontOffset(e);return t._FontHeightSizes[e]=n,n},t.Parse=function(t,e){var i=l.Tools.Instantiate("BABYLON.GUI."+t.className),n=l.SerializationHelper.Parse((function(){return new i}),t,null);return n.name=t.name,n._parseFromContent(t,e),n},t.drawEllipse=function(t,e,i,n,o){o.translate(t,e),o.scale(i,n),o.beginPath(),o.arc(0,0,1,0,2*Math.PI),o.closePath(),o.scale(1/i,1/n),o.translate(-t,-e)},t.AllowAlphaInheritance=!1,t._ClipMeasure=new f(0,0,0,0),t._HORIZONTAL_ALIGNMENT_LEFT=0,t._HORIZONTAL_ALIGNMENT_RIGHT=1,t._HORIZONTAL_ALIGNMENT_CENTER=2,t._VERTICAL_ALIGNMENT_TOP=0,t._VERTICAL_ALIGNMENT_BOTTOM=1,t._VERTICAL_ALIGNMENT_CENTER=2,t._FontHeightSizes={},t.AddHeader=function(){},r([Object(l.serialize)()],t.prototype,"metadata",void 0),r([Object(l.serialize)()],t.prototype,"isHitTestVisible",void 0),r([Object(l.serialize)()],t.prototype,"isPointerBlocker",void 0),r([Object(l.serialize)()],t.prototype,"isFocusInvisible",void 0),r([Object(l.serialize)()],t.prototype,"clipChildren",void 0),r([Object(l.serialize)()],t.prototype,"clipContent",void 0),r([Object(l.serialize)()],t.prototype,"useBitmapCache",void 0),r([Object(l.serialize)()],t.prototype,"shadowOffsetX",null),r([Object(l.serialize)()],t.prototype,"shadowOffsetY",null),r([Object(l.serialize)()],t.prototype,"shadowBlur",null),r([Object(l.serialize)()],t.prototype,"shadowColor",null),r([Object(l.serialize)()],t.prototype,"hoverCursor",void 0),r([Object(l.serialize)()],t.prototype,"fontOffset",null),r([Object(l.serialize)()],t.prototype,"alpha",null),r([Object(l.serialize)()],t.prototype,"scaleX",null),r([Object(l.serialize)()],t.prototype,"scaleY",null),r([Object(l.serialize)()],t.prototype,"rotation",null),r([Object(l.serialize)()],t.prototype,"transformCenterY",null),r([Object(l.serialize)()],t.prototype,"transformCenterX",null),r([Object(l.serialize)()],t.prototype,"horizontalAlignment",null),r([Object(l.serialize)()],t.prototype,"verticalAlignment",null),r([Object(l.serialize)()],t.prototype,"fixedRatio",void 0),r([Object(l.serialize)()],t.prototype,"width",null),r([Object(l.serialize)()],t.prototype,"height",null),r([Object(l.serialize)()],t.prototype,"style",null),r([Object(l.serialize)()],t.prototype,"color",null),r([Object(l.serialize)()],t.prototype,"zIndex",null),r([Object(l.serialize)()],t.prototype,"notRenderable",null),r([Object(l.serialize)()],t.prototype,"isVisible",null),r([Object(l.serialize)()],t.prototype,"descendantsOnlyPadding",null),r([Object(l.serialize)()],t.prototype,"paddingLeft",null),r([Object(l.serialize)()],t.prototype,"paddingRight",null),r([Object(l.serialize)()],t.prototype,"paddingTop",null),r([Object(l.serialize)()],t.prototype,"paddingBottom",null),r([Object(l.serialize)()],t.prototype,"left",null),r([Object(l.serialize)()],t.prototype,"top",null),r([Object(l.serialize)()],t.prototype,"linkOffsetX",null),r([Object(l.serialize)()],t.prototype,"linkOffsetY",null),r([Object(l.serialize)()],t.prototype,"isEnabled",null),r([Object(l.serialize)()],t.prototype,"disabledColor",null),r([Object(l.serialize)()],t.prototype,"disabledColorItem",null),r([Object(l.serialize)()],t.prototype,"overlapGroup",void 0),r([Object(l.serialize)()],t.prototype,"overlapDeltaMultiplier",void 0),t}();Object(l.RegisterClass)("BABYLON.GUI.Control",g);var m=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._children=new Array,i._measureForChildren=f.Empty(),i._background="",i._adaptWidthToChildren=!1,i._adaptHeightToChildren=!1,i._renderToIntermediateTexture=!1,i._intermediateTexture=null,i.logLayoutCycleErrors=!1,i.maxLayoutCycle=3,i}return o(e,t),Object.defineProperty(e.prototype,"renderToIntermediateTexture",{get:function(){return this._renderToIntermediateTexture},set:function(t){this._renderToIntermediateTexture!==t&&(this._renderToIntermediateTexture=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"adaptHeightToChildren",{get:function(){return this._adaptHeightToChildren},set:function(t){this._adaptHeightToChildren!==t&&(this._adaptHeightToChildren=t,t&&(this.height="100%"),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"adaptWidthToChildren",{get:function(){return this._adaptWidthToChildren},set:function(t){this._adaptWidthToChildren!==t&&(this._adaptWidthToChildren=t,t&&(this.width="100%"),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){return this._children},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isReadOnly",{get:function(){return this._isReadOnly},set:function(t){this._isReadOnly=t;for(var e=0,i=this._children;et.zIndex){this._children.splice(i,0,t),e=!0;break}e||this._children.push(t),t.parent=this,this._markAsDirty()},e.prototype._offsetLeft=function(e){t.prototype._offsetLeft.call(this,e);for(var i=0,n=this._children;i=0&&(r+=this.paddingLeftInPixels+this.paddingRightInPixels,this.width!==r+"px"&&(null===(i=this.parent)||void 0===i||i._markAsDirty(),this.width=r+"px",this._rebuildLayout=!0)),this.adaptHeightToChildren&&a>=0&&(a+=this.paddingTopInPixels+this.paddingBottomInPixels,this.height!==a+"px"&&(null===(n=this.parent)||void 0===n||n._markAsDirty(),this.height=a+"px",this._rebuildLayout=!0)),this._postMeasure()}o++}while(this._rebuildLayout&&o=3&&this.logLayoutCycleErrors&&l.Logger.Error("Layout cycle detected in GUI (Container name=".concat(this.name,", uniqueId=").concat(this.uniqueId,")")),e.restore(),this._isDirty&&(this.invalidateRect(),this._isDirty=!1),!0},e.prototype._postMeasure=function(){},e.prototype._draw=function(t,e){var i=this._renderToIntermediateTexture&&this._intermediateTexture,n=i?this._intermediateTexture.getContext():t;i&&(n.save(),n.translate(-this._currentMeasure.left,-this._currentMeasure.top),e?n.clearRect(e.left,e.top,e.width,e.height):n.clearRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._localDraw(n),t.save(),this.clipChildren&&this._clipForChildren(n);for(var o=0,r=this._children;o=0;h--){var c=this._children[h];if(c._processPicking(e,i,n,o,r,a,s,l))return c.hoverCursor&&this._host._changeCursor(c.hoverCursor),!0}return!!_&&(!!this.isHitTestVisible&&this._processObservables(o,e,i,n,r,a,s,l))},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._measureForChildren.copyFrom(this._currentMeasure)},e.prototype.serialize=function(e){if(t.prototype.serialize.call(this,e),this.children.length){e.children=[];for(var i=0,n=this.children;i=0;i--)this.children[i].dispose();null===(e=this._intermediateTexture)||void 0===e||e.dispose()},e.prototype._parseFromContent=function(e,i){if(t.prototype._parseFromContent.call(this,e,i),this._link(i),e.children)for(var n=0,o=e.children;nn&&(n=r.width)}if(this._resizeToFit){if(this._textWrapping===v.Clip){var a=this._paddingLeftInPixels+this._paddingRightInPixels+n|0;a!==this._width.internalValue&&(this._width.updateInPlace(a,_.UNITMODE_PIXEL),this._rebuildLayout=!0)}var s=this._paddingTopInPixels+this._paddingBottomInPixels+this._fontOffset.height*this._lines.length|0;if(this._lines.length>0&&0!==this._lineSpacing.internalValue){var l=0;l=this._lineSpacing.isPixel?this._lineSpacing.getValue(this._host):this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height),s+=(this._lines.length-1)*l}s!==this._height.internalValue&&(this._height.updateInPlace(s,_.UNITMODE_PIXEL),this._rebuildLayout=!0)}},e.prototype._drawText=function(t,e,i,n){var o=this._currentMeasure.width,r=0;switch(this._textHorizontalAlignment){case g.HORIZONTAL_ALIGNMENT_LEFT:r=0;break;case g.HORIZONTAL_ALIGNMENT_RIGHT:r=o-e;break;case g.HORIZONTAL_ALIGNMENT_CENTER:r=(o-e)/2}(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(n.shadowColor=this.shadowColor,n.shadowBlur=this.shadowBlur,n.shadowOffsetX=this.shadowOffsetX,n.shadowOffsetY=this.shadowOffsetY),this.outlineWidth&&n.strokeText(t,this._currentMeasure.left+r,i),n.fillText(t,this._currentMeasure.left+r,i),this._underline&&(n.beginPath(),n.lineWidth=Math.round(.05*this.fontSizeInPixels),n.moveTo(this._currentMeasure.left+r,i+3),n.lineTo(this._currentMeasure.left+r+e,i+3),n.stroke(),n.closePath()),this._lineThrough&&(n.beginPath(),n.lineWidth=Math.round(.05*this.fontSizeInPixels),n.moveTo(this._currentMeasure.left+r,i-this.fontSizeInPixels/3),n.lineTo(this._currentMeasure.left+r+e,i-this.fontSizeInPixels/3),n.stroke(),n.closePath())},e.prototype._draw=function(t,e){t.save(),this._applyStates(t),this._renderLines(t),t.restore()},e.prototype._applyStates=function(e){t.prototype._applyStates.call(this,e),this.outlineWidth&&(e.lineWidth=this.outlineWidth,e.strokeStyle=this.outlineColor,e.lineJoin="miter",e.miterLimit=2)},e.prototype._breakLines=function(t,e,i){var n=[],o=this.text.split("\n");if(this._textWrapping===v.Ellipsis)for(var r=0,a=o;re?t-e:0,o=t/i;return Math.max(Math.floor(n/o),1)},e.prototype._parseLineEllipsis=function(t,e,i){void 0===t&&(t="");var n=i.measureText(t),o=Math.abs(n.actualBoundingBoxLeft)+Math.abs(n.actualBoundingBoxRight),r=this._getCharsToRemove(o,e,t.length),a=Array.from&&Array.from(t);if(a)for(;a.length&&o>e;)a.splice(a.length-r,r),t="".concat(a.join(""),"…"),n=i.measureText(t),o=Math.abs(n.actualBoundingBoxLeft)+Math.abs(n.actualBoundingBoxRight),r=this._getCharsToRemove(o,e,t.length);else{for(;t.length>2&&o>e;)t=t.slice(0,-r),n=i.measureText(t+"…"),o=Math.abs(n.actualBoundingBoxLeft)+Math.abs(n.actualBoundingBoxRight),r=this._getCharsToRemove(o,e,t.length);t+="…"}return{text:t,width:o}},e.prototype._parseLineWordWrap=function(t,e,i){void 0===t&&(t="");for(var n=[],o=this.wordSplittingFunction?this.wordSplittingFunction(t):t.split(" "),r=i.measureText(t),a=Math.abs(r.actualBoundingBoxLeft)+Math.abs(r.actualBoundingBoxRight),s=0;s0?t+" "+o[s]:o[0],_=i.measureText(l),h=Math.abs(_.actualBoundingBoxLeft)+Math.abs(_.actualBoundingBoxRight);h>e&&s>0?(n.push({text:t,width:a}),t=o[s],r=i.measureText(t),a=Math.abs(r.actualBoundingBoxLeft)+Math.abs(r.actualBoundingBoxRight)):(a=h,t=l)}return n.push({text:t,width:a}),n},e.prototype._parseLineWordWrapEllipsis=function(t,e,i,n){void 0===t&&(t="");for(var o=this._parseLineWordWrap(t,e,n),r=1;r<=o.length;r++){if(this._computeHeightForLinesOf(r)>i&&r>1){var a=o[r-2],s=o[r-1];o[r-2]=this._parseLineEllipsis("".concat(a.text+s.text),e,n);for(var l=o.length-r+1,_=0;_0&&0!==this._lineSpacing.internalValue){e+=(t-1)*(this._lineSpacing.isPixel?this._lineSpacing.getValue(this._host):this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height))}return e},e.prototype.computeExpectedHeight=function(){var t;if(this.text&&this.widthInPixels){var e=null===(t=l.EngineStore.LastCreatedEngine)||void 0===t?void 0:t.createCanvas(0,0).getContext("2d");if(e){this._applyStates(e),this._fontOffset||(this._fontOffset=g._GetFontOffset(e.font));var i=this._lines?this._lines:this._breakLines(this.widthInPixels-this._paddingLeftInPixels-this._paddingRightInPixels,this.heightInPixels-this._paddingTopInPixels-this._paddingBottomInPixels,e);return this._computeHeightForLinesOf(i.length)}}return 0},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onTextChangedObservable.clear()},r([Object(l.serialize)()],e.prototype,"resizeToFit",null),r([Object(l.serialize)()],e.prototype,"textWrapping",null),r([Object(l.serialize)()],e.prototype,"text",null),r([Object(l.serialize)()],e.prototype,"textHorizontalAlignment",null),r([Object(l.serialize)()],e.prototype,"textVerticalAlignment",null),r([Object(l.serialize)()],e.prototype,"lineSpacing",null),r([Object(l.serialize)()],e.prototype,"outlineWidth",null),r([Object(l.serialize)()],e.prototype,"underline",null),r([Object(l.serialize)()],e.prototype,"lineThrough",null),r([Object(l.serialize)()],e.prototype,"outlineColor",null),e}(g);Object(l.RegisterClass)("BABYLON.GUI.TextBlock",x);var P=function(t){function e(i,n){void 0===n&&(n=null);var o=t.call(this,i)||this;return o.name=i,o._workingCanvas=null,o._loaded=!1,o._stretch=e.STRETCH_FILL,o._autoScale=!1,o._sourceLeft=0,o._sourceTop=0,o._sourceWidth=0,o._sourceHeight=0,o._svgAttributesComputationCompleted=!1,o._isSVG=!1,o._cellWidth=0,o._cellHeight=0,o._cellId=-1,o._populateNinePatchSlicesFromImage=!1,o._imageDataCache={data:null,key:""},o.onImageLoadedObservable=new l.Observable,o.onSVGAttributesComputedObservable=new l.Observable,o.source=n,o}return o(e,t),Object.defineProperty(e.prototype,"isLoaded",{get:function(){return this._loaded},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"detectPointerOnOpaqueOnly",{get:function(){return this._detectPointerOnOpaqueOnly},set:function(t){this._detectPointerOnOpaqueOnly!==t&&(this._detectPointerOnOpaqueOnly=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliceLeft",{get:function(){return this._sliceLeft},set:function(t){this._sliceLeft!==t&&(this._sliceLeft=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliceRight",{get:function(){return this._sliceRight},set:function(t){this._sliceRight!==t&&(this._sliceRight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliceTop",{get:function(){return this._sliceTop},set:function(t){this._sliceTop!==t&&(this._sliceTop=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliceBottom",{get:function(){return this._sliceBottom},set:function(t){this._sliceBottom!==t&&(this._sliceBottom=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sourceLeft",{get:function(){return this._sourceLeft},set:function(t){this._sourceLeft!==t&&(this._sourceLeft=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sourceTop",{get:function(){return this._sourceTop},set:function(t){this._sourceTop!==t&&(this._sourceTop=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sourceWidth",{get:function(){return this._sourceWidth},set:function(t){this._sourceWidth!==t&&(this._sourceWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sourceHeight",{get:function(){return this._sourceHeight},set:function(t){this._sourceHeight!==t&&(this._sourceHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"imageWidth",{get:function(){return this._imageWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"imageHeight",{get:function(){return this._imageHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"populateNinePatchSlicesFromImage",{get:function(){return this._populateNinePatchSlicesFromImage},set:function(t){this._populateNinePatchSlicesFromImage!==t&&(this._populateNinePatchSlicesFromImage=t,this._populateNinePatchSlicesFromImage&&this._loaded&&this._extractNinePatchSliceDataFromImage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSVG",{get:function(){return this._isSVG},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"svgAttributesComputationCompleted",{get:function(){return this._svgAttributesComputationCompleted},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"autoScale",{get:function(){return this._autoScale},set:function(t){this._autoScale!==t&&(this._autoScale=t,t&&this._loaded&&this.synchronizeSizeWithContent())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stretch",{get:function(){return this._stretch},set:function(t){this._stretch!==t&&(this._stretch=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._rotate90=function(t,i){var n,o;void 0===i&&(i=!1);var r=this._domImage.width,a=this._domImage.height,s=(null===(o=null===(n=this._host)||void 0===n?void 0:n.getScene())||void 0===o?void 0:o.getEngine())||l.EngineStore.LastCreatedEngine;if(!s)throw new Error("Invalid engine. Unable to create a canvas.");var _=s.createCanvas(a,r),h=_.getContext("2d");h.translate(_.width/2,_.height/2),h.rotate(t*Math.PI/2),h.drawImage(this._domImage,0,0,r,a,-r/2,-a/2,r,a);var c=_.toDataURL("image/jpg"),u=new e(this.name+"rotated",c);return i&&(u._stretch=this._stretch,u._autoScale=this._autoScale,u._cellId=this._cellId,u._cellWidth=t%1?this._cellHeight:this._cellWidth,u._cellHeight=t%1?this._cellWidth:this._cellHeight),this._handleRotationForSVGImage(this,u,t),this._imageDataCache.data=null,u},e.prototype._handleRotationForSVGImage=function(t,e,i){var n=this;t._isSVG&&(t._svgAttributesComputationCompleted?(this._rotate90SourceProperties(t,e,i),this._markAsDirty()):t.onSVGAttributesComputedObservable.addOnce((function(){n._rotate90SourceProperties(t,e,i),n._markAsDirty()})))},e.prototype._rotate90SourceProperties=function(t,e,i){var n,o,r=t.sourceLeft,a=t.sourceTop,s=t.domImage.width,l=t.domImage.height,_=r,h=a,c=t.sourceWidth,u=t.sourceHeight;if(0!=i){var d=i<0?-1:1;i%=4;for(var f=0;f127&&-1===this._sliceLeft)this._sliceLeft=s;else if(h<127&&this._sliceLeft>-1){this._sliceRight=s;break}}this._sliceTop=-1,this._sliceBottom=-1;for(var _=0;_127&&-1===this._sliceTop)this._sliceTop=_;else if(h<127&&this._sliceTop>-1){this._sliceBottom=_;break}}},Object.defineProperty(e.prototype,"domImage",{get:function(){return this._domImage},set:function(t){var e=this;this._domImage=t,this._loaded=!1,this._imageDataCache.data=null,this._domImage.width?this._onImageLoaded():this._domImage.onload=function(){e._onImageLoaded()}},enumerable:!1,configurable:!0}),e.prototype._onImageLoaded=function(){this._imageDataCache.data=null,this._imageWidth=this._domImage.width,this._imageHeight=this._domImage.height,this._loaded=!0,this._populateNinePatchSlicesFromImage&&this._extractNinePatchSliceDataFromImage(),this._autoScale&&this.synchronizeSizeWithContent(),this.onImageLoadedObservable.notifyObservers(this),this._markAsDirty()},Object.defineProperty(e.prototype,"source",{get:function(){return this._source},set:function(t){var e,i,n=this;if(this._source!==t){this._loaded=!1,this._source=t,this._imageDataCache.data=null,t&&(t=this._svgCheck(t));var o=(null===(i=null===(e=this._host)||void 0===e?void 0:e.getScene())||void 0===i?void 0:i.getEngine())||l.EngineStore.LastCreatedEngine;if(!o)throw new Error("Invalid engine. Unable to create a canvas.");this._domImage=o.createCanvasImage(),this._domImage.onload=function(){n._onImageLoaded()},t&&(l.Tools.SetCorsBehavior(t,this._domImage),this._domImage.src=t)}},enumerable:!1,configurable:!0}),e.prototype._svgCheck=function(t){var e=this;if(window.SVGSVGElement&&-1!==t.search(/.svg#/gi)&&t.indexOf("#")===t.lastIndexOf("#")){this._isSVG=!0;var i=t.split("#")[0],n=t.split("#")[1],o=document.body.querySelector('object[data="'+i+'"]');if(o){var r=o.contentDocument;if(r&&r.documentElement){var a=r.documentElement.getAttribute("viewBox"),s=Number(r.documentElement.getAttribute("width")),l=Number(r.documentElement.getAttribute("height"));if(r.getElementById(n)&&a&&s&&l)return this._getSVGAttribs(o,n),t}o.addEventListener("load",(function(){e._getSVGAttribs(o,n)}))}else{var _=document.createElement("object");_.data=i,_.type="image/svg+xml",_.width="0%",_.height="0%",document.body.appendChild(_),_.onload=function(){var t=document.body.querySelector('object[data="'+i+'"]');t&&e._getSVGAttribs(t,n)}}return i}return t},e.prototype._getSVGAttribs=function(t,e){var i=t.contentDocument;if(i&&i.documentElement){var n=i.documentElement.getAttribute("viewBox"),o=Number(i.documentElement.getAttribute("width")),r=Number(i.documentElement.getAttribute("height")),a=i.getElementById(e);if(n&&o&&r&&a){var s=Number(n.split(" ")[2]),l=Number(n.split(" ")[3]),_=a.getBBox(),h=1,c=1,u=0,d=0,f=a.transform.baseVal.consolidate().matrix;a.transform&&a.transform.baseVal.consolidate()&&(h=f.a,c=f.d,u=f.e,d=f.f),this.sourceLeft=(h*_.x+u)*o/s,this.sourceTop=(c*_.y+d)*r/l,this.sourceWidth=_.width*h*(o/s),this.sourceHeight=_.height*c*(r/l),this._svgAttributesComputationCompleted=!0,this.onSVGAttributesComputedObservable.notifyObservers(this)}}},Object.defineProperty(e.prototype,"cellWidth",{get:function(){return this._cellWidth},set:function(t){this._cellWidth!==t&&(this._cellWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cellHeight",{get:function(){return this._cellHeight},set:function(t){this._cellHeight!==t&&(this._cellHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cellId",{get:function(){return this._cellId},set:function(t){this._cellId!==t&&(this._cellId=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype.contains=function(e,i){if(!t.prototype.contains.call(this,e,i))return!1;if(!this._detectPointerOnOpaqueOnly||!this._workingCanvas)return!0;var n=0|this._currentMeasure.width,o=0|this._currentMeasure.height,r=n+"_"+o,a=this._imageDataCache.data;if(!a||this._imageDataCache.key!==r){var s=this._workingCanvas.getContext("2d");this._imageDataCache.data=a=s.getImageData(0,0,n,o).data,this._imageDataCache.key=r}return a[4*((e=e-this._currentMeasure.left|0)+(i=i-this._currentMeasure.top|0)*n)+3]>0},e.prototype._getTypeName=function(){return"Image"},e.prototype.synchronizeSizeWithContent=function(){this._loaded&&(this.width=this._domImage.width+"px",this.height=this._domImage.height+"px")},e.prototype._processMeasures=function(i,n){if(this._loaded)switch(this._stretch){case e.STRETCH_NONE:case e.STRETCH_FILL:case e.STRETCH_UNIFORM:case e.STRETCH_NINE_PATCH:break;case e.STRETCH_EXTEND:this._autoScale&&this.synchronizeSizeWithContent(),this.parent&&this.parent.parent&&(this.parent.adaptWidthToChildren=!0,this.parent.adaptHeightToChildren=!0)}t.prototype._processMeasures.call(this,i,n)},e.prototype._prepareWorkingCanvasForOpaqueDetection=function(){var t,e;if(this._detectPointerOnOpaqueOnly){var i=this._currentMeasure.width,n=this._currentMeasure.height;if(!this._workingCanvas){var o=(null===(e=null===(t=this._host)||void 0===t?void 0:t.getScene())||void 0===e?void 0:e.getEngine())||l.EngineStore.LastCreatedEngine;if(!o)throw new Error("Invalid engine. Unable to create a canvas.");this._workingCanvas=o.createCanvas(i,n)}this._workingCanvas.getContext("2d").clearRect(0,0,i,n)}},e.prototype._drawImage=function(t,e,i,n,o,r,a,s,l){(t.drawImage(this._domImage,e,i,n,o,r,a,s,l),this._detectPointerOnOpaqueOnly)&&(t=this._workingCanvas.getContext("2d")).drawImage(this._domImage,e,i,n,o,r-this._currentMeasure.left,a-this._currentMeasure.top,s,l)},e.prototype._draw=function(t){var i,n,o,r;if(t.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),-1==this.cellId)i=this._sourceLeft,n=this._sourceTop,o=this._sourceWidth?this._sourceWidth:this._imageWidth,r=this._sourceHeight?this._sourceHeight:this._imageHeight;else{var a=this._domImage.naturalWidth/this.cellWidth,s=this.cellId/a>>0,l=this.cellId%a;i=this.cellWidth*l,n=this.cellHeight*s,o=this.cellWidth,r=this.cellHeight}if(this._prepareWorkingCanvasForOpaqueDetection(),this._applyStates(t),this._loaded)switch(this._stretch){case e.STRETCH_NONE:case e.STRETCH_FILL:this._drawImage(t,i,n,o,r,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case e.STRETCH_UNIFORM:var _=this._currentMeasure.width/o,h=this._currentMeasure.height/r,c=Math.min(_,h),u=(this._currentMeasure.width-o*c)/2,d=(this._currentMeasure.height-r*c)/2;this._drawImage(t,i,n,o,r,this._currentMeasure.left+u,this._currentMeasure.top+d,o*c,r*c);break;case e.STRETCH_EXTEND:this._drawImage(t,i,n,o,r,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case e.STRETCH_NINE_PATCH:this._renderNinePatch(t)}t.restore()},e.prototype._renderNinePatch=function(t){var e=this._sliceLeft,i=this._sliceTop,n=this._imageHeight-this._sliceBottom,o=this._imageWidth-this._sliceRight,r=this._sliceRight-this._sliceLeft,a=this._sliceBottom-this._sliceTop,s=this._currentMeasure.width-o-e+2,l=this._currentMeasure.height-n-i+2,_=this._currentMeasure.left+e-1,h=this._currentMeasure.top+i-1,c=this._currentMeasure.left+this._currentMeasure.width-o,u=this._currentMeasure.top+this._currentMeasure.height-n;this._drawImage(t,0,0,e,i,this._currentMeasure.left,this._currentMeasure.top,e,i),this._drawImage(t,this._sliceLeft,0,r,i,_,this._currentMeasure.top,s,i),this._drawImage(t,this.sliceRight,0,o,i,c,this._currentMeasure.top,o,i),this._drawImage(t,0,this._sliceTop,e,a,this._currentMeasure.left,h,e,l),this._drawImage(t,this._sliceLeft,this._sliceTop,r,a,_,h,s,l),this._drawImage(t,this._sliceRight,this._sliceTop,o,a,c,h,o,l),this._drawImage(t,0,this._sliceBottom,e,n,this._currentMeasure.left,u,e,n),this._drawImage(t,this.sliceLeft,this._sliceBottom,r,n,_,u,s,n),this._drawImage(t,this._sliceRight,this._sliceBottom,o,n,c,u,o,n)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onImageLoadedObservable.clear(),this.onSVGAttributesComputedObservable.clear()},e.STRETCH_NONE=0,e.STRETCH_FILL=1,e.STRETCH_UNIFORM=2,e.STRETCH_EXTEND=3,e.STRETCH_NINE_PATCH=4,r([Object(l.serialize)()],e.prototype,"detectPointerOnOpaqueOnly",null),r([Object(l.serialize)()],e.prototype,"sliceLeft",null),r([Object(l.serialize)()],e.prototype,"sliceRight",null),r([Object(l.serialize)()],e.prototype,"sliceTop",null),r([Object(l.serialize)()],e.prototype,"sliceBottom",null),r([Object(l.serialize)()],e.prototype,"sourceLeft",null),r([Object(l.serialize)()],e.prototype,"sourceTop",null),r([Object(l.serialize)()],e.prototype,"sourceWidth",null),r([Object(l.serialize)()],e.prototype,"sourceHeight",null),r([Object(l.serialize)()],e.prototype,"populateNinePatchSlicesFromImage",null),r([Object(l.serialize)()],e.prototype,"autoScale",null),r([Object(l.serialize)()],e.prototype,"stretch",null),r([Object(l.serialize)()],e.prototype,"source",null),r([Object(l.serialize)()],e.prototype,"cellWidth",null),r([Object(l.serialize)()],e.prototype,"cellHeight",null),r([Object(l.serialize)()],e.prototype,"cellId",null),e}(g);Object(l.RegisterClass)("BABYLON.GUI.Image",P);var O=function(t){function e(e){var i=t.call(this,e)||this;i.name=e,i.delegatePickingToChildren=!1,i.thickness=1,i.isPointerBlocker=!0;var n=null;return i.pointerEnterAnimation=function(){n=i.alpha,i.alpha-=.1},i.pointerOutAnimation=function(){null!==n&&(i.alpha=n)},i.pointerDownAnimation=function(){i.scaleX-=.05,i.scaleY-=.05},i.pointerUpAnimation=function(){i.scaleX+=.05,i.scaleY+=.05},i}return o(e,t),Object.defineProperty(e.prototype,"image",{get:function(){return this._image},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textBlock",{get:function(){return this._textBlock},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Button"},e.prototype._processPicking=function(e,i,n,o,r,a,s,l){if(!this._isEnabled||!this.isHitTestVisible||!this.isVisible||this.notRenderable)return!1;if(!t.prototype.contains.call(this,e,i))return!1;if(this.delegatePickingToChildren){for(var _=!1,h=this._children.length-1;h>=0;h--){var c=this._children[h];if(c.isEnabled&&c.isHitTestVisible&&c.isVisible&&!c.notRenderable&&c.contains(e,i)){_=!0;break}}if(!_)return!1}return this._processObservables(o,e,i,n,r,a,s,l),!0},e.prototype._onPointerEnter=function(e,i){return!!t.prototype._onPointerEnter.call(this,e,i)&&(!this.isReadOnly&&this.pointerEnterAnimation&&this.pointerEnterAnimation(),!0)},e.prototype._onPointerOut=function(e,i,n){void 0===n&&(n=!1),!this.isReadOnly&&this.pointerOutAnimation&&this.pointerOutAnimation(),t.prototype._onPointerOut.call(this,e,i,n)},e.prototype._onPointerDown=function(e,i,n,o,r){return!!t.prototype._onPointerDown.call(this,e,i,n,o,r)&&(!this.isReadOnly&&this.pointerDownAnimation&&this.pointerDownAnimation(),!0)},e.prototype._onPointerUp=function(e,i,n,o,r,a){!this.isReadOnly&&this.pointerUpAnimation&&this.pointerUpAnimation(),t.prototype._onPointerUp.call(this,e,i,n,o,r,a)},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),this._textBlock&&(e.textBlockName=this._textBlock.name),this._image&&(e.imageName=this._image.name)},e.prototype._parseFromContent=function(e,i){t.prototype._parseFromContent.call(this,e,i),e.textBlockName&&(this._textBlock=this.getChildByName(e.textBlockName)),e.imageName&&(this._image=this.getChildByName(e.imageName))},e.CreateImageButton=function(t,e,i){var n=new this(t),o=new x(t+"_button",e);o.textWrapping=!0,o.textHorizontalAlignment=g.HORIZONTAL_ALIGNMENT_CENTER,o.paddingLeft="20%",n.addControl(o);var r=new P(t+"_icon",i);return r.width="20%",r.stretch=P.STRETCH_UNIFORM,r.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,n.addControl(r),n._image=r,n._textBlock=o,n},e.CreateImageOnlyButton=function(t,e){var i=new this(t),n=new P(t+"_icon",e);return n.stretch=P.STRETCH_FILL,n.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,i.addControl(n),i._image=n,i},e.CreateSimpleButton=function(t,e){var i=new this(t),n=new x(t+"_button",e);return n.textWrapping=!0,n.textHorizontalAlignment=g.HORIZONTAL_ALIGNMENT_CENTER,i.addControl(n),i._textBlock=n,i},e.CreateImageWithCenterTextButton=function(t,e,i){var n=new this(t),o=new P(t+"_icon",i);o.stretch=P.STRETCH_FILL,n.addControl(o);var r=new x(t+"_button",e);return r.textWrapping=!0,r.textHorizontalAlignment=g.HORIZONTAL_ALIGNMENT_CENTER,n.addControl(r),n._image=o,n._textBlock=r,n},e}(y);Object(l.RegisterClass)("BABYLON.GUI.Button",O);var B=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._isVertical=!0,i._manualWidth=!1,i._manualHeight=!1,i._doNotTrackManualChanges=!1,i._spacing=0,i.ignoreLayoutWarnings=!1,i}return o(e,t),Object.defineProperty(e.prototype,"isVertical",{get:function(){return this._isVertical},set:function(t){this._isVertical!==t&&(this._isVertical=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){return this._spacing},set:function(t){this._spacing!==t&&(this._spacing=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.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:!1,configurable:!0}),Object.defineProperty(e.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:!1,configurable:!0}),e.prototype._getTypeName=function(){return"StackPanel"},e.prototype._preMeasure=function(e,i){for(var n=0,o=this._children;n=0?Math.min(t,this._characters.length):this._characters.length+Math.max(t,-this._characters.length),void 0===e?e=this._characters.length-t:(isNaN(e)||e<0)&&(e=0);for(var i=[];--e>=0;)i[e]=this._characters[t+e];return i.join("")}return this._text.substr(t,e)},t.prototype.substring=function(t,e){if(this._characters){isNaN(t)?t=0:t>this._characters.length?t=this._characters.length:t<0&&(t=0),void 0===e?e=this._characters.length:isNaN(e)?e=0:e>this._characters.length?e=this._characters.length:e<0&&(e=0);for(var i=[],n=0;t0){if(this._isTextHighlightOn)return this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex),this._textHasChanged(),this._isTextHighlightOn=!1,this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,this._blinkIsEven=!1,void(i&&i.preventDefault());if(0===this._cursorOffset)this.text=this._textWrapper.substr(0,this._textWrapper.length-1);else(n=this._textWrapper.length-this._cursorOffset)>0&&(this._textWrapper.removePart(n-1,n),this._textHasChanged())}return void(i&&i.preventDefault());case 46:if(this._isTextHighlightOn)return this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex),this._textHasChanged(),this._isTextHighlightOn=!1,this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,void(i&&i.preventDefault());if(this._textWrapper.text&&this._textWrapper.length>0&&this._cursorOffset>0){var n=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(n,n+1),this._textHasChanged(),this._cursorOffset--}return void(i&&i.preventDefault());case 13:return this._host.focusedControl=null,void(this._isTextHighlightOn=!1);case 35:return this._cursorOffset=0,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._markAsDirty();case 36:return this._cursorOffset=this._textWrapper.length,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._markAsDirty();case 37:if(this._cursorOffset++,this._cursorOffset>this._textWrapper.length&&(this._cursorOffset=this._textWrapper.length),i&&i.shiftKey){if(this._blinkIsEven=!1,i.ctrlKey||i.metaKey){if(!this._isTextHighlightOn){if(this._textWrapper.length===this._cursorOffset)return;this._endHighlightIndex=this._textWrapper.length-this._cursorOffset+1}return this._startHighlightIndex=0,this._cursorIndex=this._textWrapper.length-this._endHighlightIndex,this._cursorOffset=this._textWrapper.length,this._isTextHighlightOn=!0,void this._markAsDirty()}return this._isTextHighlightOn?-1===this._cursorIndex&&(this._cursorIndex=this._textWrapper.length-this._endHighlightIndex,this._cursorOffset=0===this._startHighlightIndex?this._textWrapper.length:this._textWrapper.length-this._startHighlightIndex+1):(this._isTextHighlightOn=!0,this._cursorIndex=this._cursorOffset>=this._textWrapper.length?this._textWrapper.length:this._cursorOffset-1),this._cursorIndexthis._cursorOffset?(this._endHighlightIndex=this._textWrapper.length-this._cursorOffset,this._startHighlightIndex=this._textWrapper.length-this._cursorIndex):this._isTextHighlightOn=!1,void this._markAsDirty()}return this._isTextHighlightOn&&(this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,this._isTextHighlightOn=!1),i&&(i.ctrlKey||i.metaKey)&&(this._cursorOffset=this._textWrapper.length,i.preventDefault()),this._blinkIsEven=!1,this._isTextHighlightOn=!1,this._cursorIndex=-1,void this._markAsDirty();case 39:if(this._cursorOffset--,this._cursorOffset<0&&(this._cursorOffset=0),i&&i.shiftKey){if(this._blinkIsEven=!1,i.ctrlKey||i.metaKey){if(!this._isTextHighlightOn){if(0===this._cursorOffset)return;this._startHighlightIndex=this._textWrapper.length-this._cursorOffset-1}return this._endHighlightIndex=this._textWrapper.length,this._isTextHighlightOn=!0,this._cursorIndex=this._textWrapper.length-this._startHighlightIndex,this._cursorOffset=0,void this._markAsDirty()}return this._isTextHighlightOn?-1===this._cursorIndex&&(this._cursorIndex=this._textWrapper.length-this._startHighlightIndex,this._cursorOffset=this._textWrapper.length===this._endHighlightIndex?0:this._textWrapper.length-this._endHighlightIndex-1):(this._isTextHighlightOn=!0,this._cursorIndex=this._cursorOffset<=0?0:this._cursorOffset+1),this._cursorIndexthis._cursorOffset?(this._endHighlightIndex=this._textWrapper.length-this._cursorOffset,this._startHighlightIndex=this._textWrapper.length-this._cursorIndex):this._isTextHighlightOn=!1,void this._markAsDirty()}return this._isTextHighlightOn&&(this._cursorOffset=this._textWrapper.length-this._endHighlightIndex,this._isTextHighlightOn=!1),i&&(i.ctrlKey||i.metaKey)&&(this._cursorOffset=0,i.preventDefault()),this._blinkIsEven=!1,this._isTextHighlightOn=!1,this._cursorIndex=-1,void this._markAsDirty();case 222:i?"Quote"==i.code?i.shiftKey?(t=34,e='"'):(t=39,e="'"):(i.preventDefault(),this._cursorIndex=-1,this.deadKey=!0):(this._cursorIndex=-1,this.deadKey=!0)}if(e&&(-1===t||32===t||34===t||39===t||t>47&&t<64||t>64&&t<91||t>159&&t<193||t>218&&t<223||t>95&&t<112)&&(this._currentKey=e,this.onBeforeKeyAddObservable.notifyObservers(this),e=this._currentKey,this._addKey))if(this._isTextHighlightOn)this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex,e),this._textHasChanged(),this._cursorOffset=this._textWrapper.length-(this._startHighlightIndex+1),this._isTextHighlightOn=!1,this._blinkIsEven=!1,this._markAsDirty();else if(0===this._cursorOffset)this.text+=e;else{var o=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(o,o,e),this._textHasChanged()}}},e.prototype._updateValueFromCursorIndex=function(t){if(this._blinkIsEven=!1,-1===this._cursorIndex)this._cursorIndex=t;else if(this._cursorIndexthis._cursorOffset))return this._isTextHighlightOn=!1,void this._markAsDirty();this._endHighlightIndex=this._textWrapper.length-this._cursorOffset,this._startHighlightIndex=this._textWrapper.length-this._cursorIndex}this._isTextHighlightOn=!0,this._markAsDirty()},e.prototype._processDblClick=function(t){var e,i;this._startHighlightIndex=this._textWrapper.length-this._cursorOffset,this._endHighlightIndex=this._startHighlightIndex;do{i=this._endHighlightIndex0&&this._textWrapper.isWord(this._startHighlightIndex-1)?--this._startHighlightIndex:0}while(e||i);this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,this.onTextHighlightObservable.notifyObservers(this),this._isTextHighlightOn=!0,this._clickedCoordinate=null,this._blinkIsEven=!0,this._cursorIndex=-1,this._markAsDirty()},e.prototype._selectAllText=function(){this._blinkIsEven=!0,this._isTextHighlightOn=!0,this._startHighlightIndex=0,this._endHighlightIndex=this._textWrapper.length,this._cursorOffset=this._textWrapper.length,this._cursorIndex=-1,this._markAsDirty()},e.prototype.processKeyboard=function(t){this.processKey(t.keyCode,t.key,t),this.onKeyboardEventProcessedObservable.notifyObservers(t)},e.prototype._onCopyText=function(t){this._isTextHighlightOn=!1;try{t.clipboardData&&t.clipboardData.setData("text/plain",this._highlightedText)}catch(t){}this._host.clipboardData=this._highlightedText},e.prototype._onCutText=function(t){if(this._highlightedText){this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex),this._textHasChanged(),this._isTextHighlightOn=!1,this._cursorOffset=this._textWrapper.length-this._startHighlightIndex;try{t.clipboardData&&t.clipboardData.setData("text/plain",this._highlightedText)}catch(t){}this._host.clipboardData=this._highlightedText,this._highlightedText=""}},e.prototype._onPasteText=function(t){var e="";e=t.clipboardData&&-1!==t.clipboardData.types.indexOf("text/plain")?t.clipboardData.getData("text/plain"):this._host.clipboardData;var i=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(i,i,e),this._textHasChanged()},e.prototype._draw=function(t,e){var i=this;t.save(),this._applyStates(t),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),this._isFocused?this._focusedBackground&&(t.fillStyle=this._isEnabled?this._focusedBackground:this._disabledColor,t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)):this._background&&(t.fillStyle=this._isEnabled?this._background:this._disabledColor,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),this._fontOffset&&!this._wasDirty||(this._fontOffset=g._GetFontOffset(t.font));var n=this._currentMeasure.left+this._margin.getValueInPixel(this._host,this._tempParentMeasure.width);this.color&&(t.fillStyle=this.color);var o=this._beforeRenderText(this._textWrapper);this._isFocused||this._textWrapper.text||!this._placeholderText||((o=new T).text=this._placeholderText,this._placeholderColor&&(t.fillStyle=this._placeholderColor)),this._textWidth=t.measureText(o.text).width;var r=2*this._margin.getValueInPixel(this._host,this._tempParentMeasure.width);this._autoStretchWidth&&(this.width=Math.min(this._maxWidth.getValueInPixel(this._host,this._tempParentMeasure.width),this._textWidth+r)+"px",this._autoStretchWidth=!0);var a=this._fontOffset.ascent+(this._currentMeasure.height-this._fontOffset.height)/2,s=this._width.getValueInPixel(this._host,this._tempParentMeasure.width)-r;if(t.save(),t.beginPath(),t.rect(n,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,s+2,this._currentMeasure.height),t.clip(),this._isFocused&&this._textWidth>s){var l=n-this._textWidth+s;this._scrollLeft||(this._scrollLeft=l)}else this._scrollLeft=n;if(t.fillText(o.text,this._scrollLeft,this._currentMeasure.top+a),this._isFocused){if(this._clickedCoordinate){var _=this._scrollLeft+this._textWidth-this._clickedCoordinate,h=0;this._cursorOffset=0;var c=0;do{this._cursorOffset&&(c=Math.abs(_-h)),this._cursorOffset++,h=t.measureText(o.substr(o.length-this._cursorOffset,this._cursorOffset)).width}while(h<_&&o.length>=this._cursorOffset);Math.abs(_-h)>c&&this._cursorOffset--,this._blinkIsEven=!1,this._clickedCoordinate=null}if(!this._blinkIsEven){var u=o.substr(o.length-this._cursorOffset),d=t.measureText(u).width,f=this._scrollLeft+this._textWidth-d;fn+s&&(this._scrollLeft+=n+s-f,f=n+s,this._markAsDirty()),this._isTextHighlightOn||t.fillRect(f,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,2,this._fontOffset.height)}if(clearTimeout(this._blinkTimeout),this._blinkTimeout=setTimeout((function(){i._blinkIsEven=!i._blinkIsEven,i._markAsDirty()}),500),this._isTextHighlightOn){clearTimeout(this._blinkTimeout);var p=t.measureText(o.substring(this._startHighlightIndex)).width,b=this._scrollLeft+this._textWidth-p;this._highlightedText=o.substring(this._startHighlightIndex,this._endHighlightIndex);var m=t.measureText(o.substring(this._startHighlightIndex,this._endHighlightIndex)).width;b=this._rowDefinitions.length?null:this._rowDefinitions[t]},e.prototype.getColumnDefinition=function(t){return t<0||t>=this._columnDefinitions.length?null:this._columnDefinitions[t]},e.prototype.addRowDefinition=function(t,e){var i=this;return void 0===e&&(e=!1),this._rowDefinitions.push(new _(t,e?_.UNITMODE_PIXEL:_.UNITMODE_PERCENTAGE)),this._rowDefinitionObservers.push(this._rowDefinitions[this.rowCount-1].onChangedObservable.add((function(){return i._markAsDirty()}))),this._markAsDirty(),this},e.prototype.addColumnDefinition=function(t,e){var i=this;return void 0===e&&(e=!1),this._columnDefinitions.push(new _(t,e?_.UNITMODE_PIXEL:_.UNITMODE_PERCENTAGE)),this._columnDefinitionObservers.push(this._columnDefinitions[this.columnCount-1].onChangedObservable.add((function(){return i._markAsDirty()}))),this._markAsDirty(),this},e.prototype.setRowDefinition=function(t,e,i){var n=this;if(void 0===i&&(i=!1),t<0||t>=this._rowDefinitions.length)return this;var o=this._rowDefinitions[t];return o&&o.isPixel===i&&o.value===e||(this._rowDefinitions[t].onChangedObservable.remove(this._rowDefinitionObservers[t]),this._rowDefinitions[t]=new _(e,i?_.UNITMODE_PIXEL:_.UNITMODE_PERCENTAGE),this._rowDefinitionObservers[t]=this._rowDefinitions[t].onChangedObservable.add((function(){return n._markAsDirty()})),this._markAsDirty()),this},e.prototype.setColumnDefinition=function(t,e,i){var n=this;if(void 0===i&&(i=!1),t<0||t>=this._columnDefinitions.length)return this;var o=this._columnDefinitions[t];return o&&o.isPixel===i&&o.value===e||(this._columnDefinitions[t].onChangedObservable.remove(this._columnDefinitionObservers[t]),this._columnDefinitions[t]=new _(e,i?_.UNITMODE_PIXEL:_.UNITMODE_PERCENTAGE),this._columnDefinitionObservers[t]=this._columnDefinitions[t].onChangedObservable.add((function(){return n._markAsDirty()})),this._markAsDirty()),this},e.prototype.getChildrenAt=function(t,e){var i=this._cells["".concat(t,":").concat(e)];return i?i.children:null},e.prototype.getChildCellInfo=function(t){return t._tag},e.prototype._removeCell=function(e,i){if(e){t.prototype.removeControl.call(this,e);for(var n=0,o=e.children;n=this._columnDefinitions.length)return this;for(var e=0;e=this._rowDefinitions.length)return this;for(var e=0;e=1-e._Epsilon&&(this._value.r=1),this._value.g>=1-e._Epsilon&&(this._value.g=1),this._value.b>=1-e._Epsilon&&(this._value.b=1),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(t){this._width.toString(this._host)!==t&&this._width.fromString(t)&&(0===this._width.getValue(this._host)&&(t="1px",this._width.fromString(t)),this._height.fromString(t),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(t){this._height.toString(this._host)!==t&&this._height.fromString(t)&&(0===this._height.getValue(this._host)&&(t="1px",this._height.fromString(t)),this._width.fromString(t),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this.width},set:function(t){this.width=t},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"ColorPicker"},e.prototype._preMeasure=function(t,e){t.width_||f150?.04:-.16*(t-50)/100+.2;var v=(p-h)/(t-h);a[g+3]=v1-m?255*(1-(v-(1-m))/m):255}}return o.putImageData(r,0,0),n},e.prototype._draw=function(t){t.save(),this._applyStates(t);var e=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),i=.2*e,n=this._currentMeasure.left,o=this._currentMeasure.top;this._colorWheelCanvas&&this._colorWheelCanvas.width==2*e||(this._colorWheelCanvas=this._createColorWheelCanvas(e,i)),this._updateSquareProps(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.fillRect(this._squareLeft,this._squareTop,this._squareSize,this._squareSize)),t.drawImage(this._colorWheelCanvas,n,o),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),this._drawGradientSquare(this._h,this._squareLeft,this._squareTop,this._squareSize,this._squareSize,t);var r=this._squareLeft+this._squareSize*this._s,a=this._squareTop+this._squareSize*(1-this._v);this._drawCircle(r,a,.04*e,t);var s=e-.5*i;r=n+e+Math.cos((this._h-180)*Math.PI/180)*s,a=o+e+Math.sin((this._h-180)*Math.PI/180)*s,this._drawCircle(r,a,.35*i,t),t.restore()},e.prototype._updateValueFromPointer=function(t,i){if(this._pointerStartedOnWheel){var n=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),o=n+this._currentMeasure.left,r=n+this._currentMeasure.top;this._h=180*Math.atan2(i-r,t-o)/Math.PI+180}else this._pointerStartedOnSquare&&(this._updateSquareProps(),this._s=(t-this._squareLeft)/this._squareSize,this._v=1-(i-this._squareTop)/this._squareSize,this._s=Math.min(this._s,1),this._s=Math.max(this._s,e._Epsilon),this._v=Math.min(this._v,1),this._v=Math.max(this._v,e._Epsilon));l.Color3.HSVtoRGBToRef(this._h,this._s,this._v,this._tmpColor),this.value=this._tmpColor},e.prototype._isPointOnSquare=function(t,e){this._updateSquareProps();var i=this._squareLeft,n=this._squareTop,o=this._squareSize;return t>=i&&t<=i+o&&e>=n&&e<=n+o},e.prototype._isPointOnWheel=function(t,e){var i=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),n=i-.2*i,o=t-(i+this._currentMeasure.left),r=e-(i+this._currentMeasure.top),a=o*o+r*r;return a<=i*i&&a>=n*n},e.prototype._onPointerDown=function(e,i,n,o,r){if(!t.prototype._onPointerDown.call(this,e,i,n,o,r))return!1;if(this.isReadOnly)return!0;this._pointerIsDown=!0,this._pointerStartedOnSquare=!1,this._pointerStartedOnWheel=!1,this._invertTransformMatrix.transformCoordinates(i.x,i.y,this._transformedPosition);var a=this._transformedPosition.x,s=this._transformedPosition.y;return this._isPointOnSquare(a,s)?this._pointerStartedOnSquare=!0:this._isPointOnWheel(a,s)&&(this._pointerStartedOnWheel=!0),this._updateValueFromPointer(a,s),this._host._capturingControl[n]=this,this._lastPointerDownId=n,!0},e.prototype._onPointerMove=function(e,i,n,o){if(n==this._lastPointerDownId){if(!this.isReadOnly){this._invertTransformMatrix.transformCoordinates(i.x,i.y,this._transformedPosition);var r=this._transformedPosition.x,a=this._transformedPosition.y;this._pointerIsDown&&this._updateValueFromPointer(r,a)}t.prototype._onPointerMove.call(this,e,i,n,o)}},e.prototype._onPointerUp=function(e,i,n,o,r,a){this._pointerIsDown=!1,delete this._host._capturingControl[n],t.prototype._onPointerUp.call(this,e,i,n,o,r,a)},e.prototype._onCanvasBlur=function(){this._forcePointerUp(),t.prototype._onCanvasBlur.call(this)},e.ShowPickerDialogAsync=function(t,i){return new Promise((function(n,o){i.pickerWidth=i.pickerWidth||"640px",i.pickerHeight=i.pickerHeight||"400px",i.headerHeight=i.headerHeight||"35px",i.lastColor=i.lastColor||"#000000",i.swatchLimit=i.swatchLimit||20,i.numSwatchesPerLine=i.numSwatchesPerLine||10;var r,a,s,_,h,c,u,d,f,p,b,m,v,P,B,C,T,R,w,M=i.swatchLimit/i.numSwatchesPerLine,E=parseFloat(i.pickerWidth)/i.numSwatchesPerLine,D=Math.floor(.25*E),L=D*(i.numSwatchesPerLine+1),F=Math.floor((parseFloat(i.pickerWidth)-L)/i.numSwatchesPerLine),N=F*M+D*(M+1),k=(parseInt(i.pickerHeight)+N+Math.floor(.25*F)).toString()+"px",A=l.Color3.FromHexString("#dddddd"),z=A.r+A.g+A.b,Q=["R","G","B"],V=!1;function j(t,e){w=e;var i=t.toHexString();if(T.background=i,p.name!=w&&(p.text=Math.floor(255*t.r).toString()),b.name!=w&&(b.text=Math.floor(255*t.g).toString()),m.name!=w&&(m.text=Math.floor(255*t.b).toString()),v.name!=w&&(v.text=t.r.toString()),P.name!=w&&(P.text=t.g.toString()),B.name!=w&&(B.text=t.b.toString()),C.name!=w){var n=i.split("#");C.text=n[1]}f.name!=w&&(f.value=t)}function H(t,e){var i=t.text;if(/[^0-9]/g.test(i))t.text=R;else if(""!=i&&(Math.floor(parseInt(i))<0?i="0":Math.floor(parseInt(i))>255?i="255":isNaN(parseInt(i))&&(i="0")),w==t.name&&(R=i),""!=i){i=parseInt(i).toString(),t.text=i;var n=l.Color3.FromHexString(T.background);w==t.name&&j("r"==e?new l.Color3(parseInt(i)/255,n.g,n.b):"g"==e?new l.Color3(n.r,parseInt(i)/255,n.b):new l.Color3(n.r,n.g,parseInt(i)/255),t.name)}}function W(t,e){var i=t.text;if(/[^0-9\.]/g.test(i))t.text=R;else{""!=i&&"."!=i&&0!=parseFloat(i)&&(parseFloat(i)<0?i="0.0":parseFloat(i)>1?i="1.0":isNaN(parseFloat(i))&&(i="0.0")),w==t.name&&(R=i),""!=i&&"."!=i&&0!=parseFloat(i)?(i=parseFloat(i).toString(),t.text=i):i="0.0";var n=l.Color3.FromHexString(T.background);w==t.name&&j("r"==e?new l.Color3(parseFloat(i),n.g,n.b):"g"==e?new l.Color3(n.r,parseFloat(i),n.b):new l.Color3(n.r,n.g,parseFloat(i)),t.name)}}function G(){if(i.savedColors&&i.savedColors[u]){if(V)var t="b";else t="";var e=O.CreateSimpleButton("Swatch_"+u,t);e.fontFamily="BabylonJSglyphs";var n=l.Color3.FromHexString(i.savedColors[u]),o=n.r+n.g+n.b;e.color=o>z?"#aaaaaa":"#ffffff",e.fontSize=Math.floor(.7*F),e.textBlock.verticalAlignment=g.VERTICAL_ALIGNMENT_CENTER,e.height=e.width=F.toString()+"px",e.background=i.savedColors[u],e.thickness=2;var r=u;return e.pointerDownAnimation=function(){e.thickness=4},e.pointerUpAnimation=function(){e.thickness=3},e.pointerEnterAnimation=function(){e.thickness=3},e.pointerOutAnimation=function(){e.thickness=2},e.onPointerClickObservable.add((function(){var t;V?(t=r,i.savedColors&&i.savedColors.splice(t,1),i.savedColors&&0==i.savedColors.length&&(Y(!1),V=!1),X("",St)):i.savedColors&&j(l.Color3.FromHexString(i.savedColors[r]),e.name)})),e}return null}function U(t){if(void 0!==t&&(V=t),V){for(var e=0;el*i.numSwatchesPerLine)var _=i.numSwatchesPerLine;else _=i.savedColors.length-(l-1)*i.numSwatchesPerLine;for(var h=Math.min(Math.max(_,0),i.numSwatchesPerLine),c=0,f=1;ci.numSwatchesPerLine)){var p=G();null!=p&&(d.addControl(p,s,f),f+=2,u++)}}i.savedColors.length>=i.swatchLimit?K(e,!0):K(e,!1)}}function Y(t){t?((s=O.CreateSimpleButton("butEdit","Edit")).width=_,s.height=h,s.left=Math.floor(.1*parseInt(_)).toString()+"px",s.top=(-1*parseFloat(s.left)).toString()+"px",s.verticalAlignment=g.VERTICAL_ALIGNMENT_BOTTOM,s.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,s.thickness=2,s.color="#c0c0c0",s.fontSize=a,s.background="#535353",s.onPointerEnterObservable.add((function(){s.background="#414141"})),s.onPointerOutObservable.add((function(){s.background="#535353"})),s.pointerDownAnimation=function(){s.background="515151"},s.pointerUpAnimation=function(){s.background="#414141"},s.onPointerClickObservable.add((function(){V=!V,U()})),ht.addControl(s,1,0)):ht.removeControl(s)}function K(t,e){e?(t.color="#555555",t.background="#454545"):(t.color="#c0c0c0",t.background="#535353")}function Z(e){i.savedColors&&i.savedColors.length>0?n({savedColors:i.savedColors,pickedColor:e}):n({pickedColor:e}),t.removeControl(q)}var q=new S;if(q.name="Dialog Container",q.width=i.pickerWidth,i.savedColors){q.height=k;var J=parseInt(i.pickerHeight)/parseInt(k);q.addRowDefinition(J,!1),q.addRowDefinition(1-J,!1)}else q.height=i.pickerHeight,q.addRowDefinition(1,!1);if(t.addControl(q),i.savedColors){(d=new S).name="Swatch Drawer",d.verticalAlignment=g.VERTICAL_ALIGNMENT_TOP,d.background="#535353",d.width=i.pickerWidth;var $=i.savedColors.length/i.numSwatchesPerLine;if(0==$)var tt=0;else tt=$+1;d.height=(F*$+tt*D).toString()+"px",d.top=Math.floor(.25*F).toString()+"px";for(var et=0;et<2*Math.ceil(i.savedColors.length/i.numSwatchesPerLine)+1;et++)et%2!=0?d.addRowDefinition(F,!0):d.addRowDefinition(D,!0);for(et=0;et<2*i.numSwatchesPerLine+1;et++)et%2!=0?d.addColumnDefinition(F,!0):d.addColumnDefinition(D,!0);q.addControl(d,1,0)}var it=new S;it.name="Picker Panel",it.height=i.pickerHeight;var nt=parseInt(i.headerHeight)/parseInt(i.pickerHeight),ot=[nt,1-nt];it.addRowDefinition(ot[0],!1),it.addRowDefinition(ot[1],!1),q.addControl(it,0,0);var rt=new y;rt.name="Dialogue Header Bar",rt.background="#cccccc",rt.thickness=0,it.addControl(rt,0,0);var at=O.CreateSimpleButton("closeButton","a");at.fontFamily="BabylonJSglyphs";var st=l.Color3.FromHexString(rt.background);r=new l.Color3(1-st.r,1-st.g,1-st.b),at.color=r.toHexString(),at.fontSize=Math.floor(.6*parseInt(i.headerHeight)),at.textBlock.textVerticalAlignment=g.VERTICAL_ALIGNMENT_CENTER,at.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_RIGHT,at.height=at.width=i.headerHeight,at.background=rt.background,at.thickness=0,at.pointerDownAnimation=function(){},at.pointerUpAnimation=function(){at.background=rt.background},at.pointerEnterAnimation=function(){at.color=rt.background,at.background="red"},at.pointerOutAnimation=function(){at.color=r.toHexString(),at.background=rt.background},at.onPointerClickObservable.add((function(){Z(Pt.background)})),it.addControl(at,0,0);var lt=new S;lt.name="Dialogue Body",lt.background="#535353";var _t=[.4375,.5625];lt.addRowDefinition(1,!1),lt.addColumnDefinition(_t[0],!1),lt.addColumnDefinition(_t[1],!1),it.addControl(lt,1,0);var ht=new S;ht.name="Picker Grid",ht.addRowDefinition(.85,!1),ht.addRowDefinition(.15,!1),lt.addControl(ht,0,0),(f=new e).name="GUI Color Picker",i.pickerHeighti.pickerHeight)var yt=vt;else yt=mt;var xt=new x;xt.text="new",xt.name="New Color Label",xt.color="#c0c0c0",xt.fontSize=yt,pt.addControl(xt,1,0),(T=new y).name="New Color Swatch",T.background=i.lastColor,T.thickness=0,gt.addControl(T,0,0);var Pt=O.CreateSimpleButton("currentSwatch","");Pt.background=i.lastColor,Pt.thickness=0,Pt.onPointerClickObservable.add((function(){j(l.Color3.FromHexString(Pt.background),Pt.name),U(!1)})),Pt.pointerDownAnimation=function(){},Pt.pointerUpAnimation=function(){},Pt.pointerEnterAnimation=function(){},Pt.pointerOutAnimation=function(){},gt.addControl(Pt,1,0);var Ot=new y;Ot.name="Swatch Outline",Ot.width=.67,Ot.thickness=2,Ot.color="#404040",Ot.isHitTestVisible=!1,pt.addControl(Ot,2,0);var Bt=new x;Bt.name="Current Color Label",Bt.text="current",Bt.color="#c0c0c0",Bt.fontSize=yt,pt.addControl(Bt,3,0);var Ct=new S;Ct.name="Button Grid",Ct.height=.8;Ct.addRowDefinition(1/3,!1),Ct.addRowDefinition(1/3,!1),Ct.addRowDefinition(1/3,!1),dt.addControl(Ct,0,1),_=Math.floor(parseInt(i.pickerWidth)*_t[1]*ft[1]*.67).toString()+"px",h=Math.floor(parseInt(i.pickerHeight)*ot[1]*ut[0]*(parseFloat(Ct.height.toString())/100)*(1/3)*.7).toString()+"px",a=parseFloat(_)>parseFloat(h)?Math.floor(.45*parseFloat(h)):Math.floor(.11*parseFloat(_));var Tt=O.CreateSimpleButton("butOK","OK");Tt.width=_,Tt.height=h,Tt.verticalAlignment=g.VERTICAL_ALIGNMENT_CENTER,Tt.thickness=2,Tt.color="#c0c0c0",Tt.fontSize=a,Tt.background="#535353",Tt.onPointerEnterObservable.add((function(){Tt.background="#414141"})),Tt.onPointerOutObservable.add((function(){Tt.background="#535353"})),Tt.pointerDownAnimation=function(){Tt.background="515151"},Tt.pointerUpAnimation=function(){Tt.background="#414141"},Tt.onPointerClickObservable.add((function(){U(!1),Z(T.background)})),Ct.addControl(Tt,0,0);var It=O.CreateSimpleButton("butCancel","Cancel");if(It.width=_,It.height=h,It.verticalAlignment=g.VERTICAL_ALIGNMENT_CENTER,It.thickness=2,It.color="#c0c0c0",It.fontSize=a,It.background="#535353",It.onPointerEnterObservable.add((function(){It.background="#414141"})),It.onPointerOutObservable.add((function(){It.background="#535353"})),It.pointerDownAnimation=function(){It.background="515151"},It.pointerUpAnimation=function(){It.background="#414141"},It.onPointerClickObservable.add((function(){U(!1),Z(Pt.background)})),Ct.addControl(It,1,0),i.savedColors){var St=O.CreateSimpleButton("butSave","Save");St.width=_,St.height=h,St.verticalAlignment=g.VERTICAL_ALIGNMENT_CENTER,St.thickness=2,St.fontSize=a,i.savedColors.length0&&Y(!0),Ct.addControl(St,2,0)}var Rt=new S;Rt.name="Dialog Lower Right",Rt.addRowDefinition(.02,!1),Rt.addRowDefinition(.63,!1),Rt.addRowDefinition(.21,!1),Rt.addRowDefinition(.14,!1),ct.addControl(Rt,1,0),c=l.Color3.FromHexString(i.lastColor);var wt=new S;wt.name="RGB Values",wt.width=.82,wt.verticalAlignment=g.VERTICAL_ALIGNMENT_CENTER,wt.addRowDefinition(1/3,!1),wt.addRowDefinition(1/3,!1),wt.addRowDefinition(1/3,!1),wt.addColumnDefinition(.1,!1),wt.addColumnDefinition(.2,!1),wt.addColumnDefinition(.7,!1),Rt.addControl(wt,1,0);for(et=0;et6||e)&&w==C.name)C.text=R;else{if(C.text.length<6)for(var i=6-C.text.length,n=0;n0&&X("",St)}))},e._Epsilon=1e-6,r([Object(l.serialize)()],e.prototype,"value",null),r([Object(l.serialize)()],e.prototype,"width",null),r([Object(l.serialize)()],e.prototype,"height",null),r([Object(l.serialize)()],e.prototype,"size",null),e}(g);Object(l.RegisterClass)("BABYLON.GUI.ColorPicker",R);var w=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thickness=1,i}return o(e,t),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Ellipse"},e.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),g.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,t),this._background&&(t.fillStyle=this._background,t.fill()),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),this._thickness&&(this.color&&(t.strokeStyle=this.color),t.lineWidth=this._thickness,t.stroke()),t.restore()},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},e.prototype._clipForChildren=function(t){g.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2,this._currentMeasure.height/2,t),t.clip()},e.prototype._renderHighlightSpecific=function(t){g.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2-this._highlightLineWidth/2,this._currentMeasure.height/2-this._highlightLineWidth/2,t),t.stroke()},r([Object(l.serialize)()],e.prototype,"thickness",null),e}(m);Object(l.RegisterClass)("BABYLON.GUI.Ellipse",w);var M=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i.focusedColor=null,i._isFocused=!1,i._unfocusedColor=null,i.onFocusObservable=new l.Observable,i.onBlurObservable=new l.Observable,i.onKeyboardEventProcessedObservable=new l.Observable,i._unfocusedColor=i.color,i}return o(e,t),e.prototype.onBlur=function(){this._isFocused&&(this._isFocused=!1,this.focusedColor&&null!=this._unfocusedColor&&(this.color=this._unfocusedColor),this.onBlurObservable.notifyObservers(this))},e.prototype.onFocus=function(){this._isFocused=!0,this.focusedColor&&(this._unfocusedColor=this.color,this.color=this.focusedColor),this.onFocusObservable.notifyObservers(this)},e.prototype.keepsFocusWith=function(){return null},e.prototype.focus=function(){this._host.moveFocusToControl(this)},e.prototype.blur=function(){this._host.focusedControl=null},e.prototype.processKeyboard=function(t){this.onKeyboardEventProcessedObservable.notifyObservers(t,-1,this)},e.prototype._onPointerDown=function(e,i,n,o,r){return this.isReadOnly||this.focus(),t.prototype._onPointerDown.call(this,e,i,n,o,r)},e.prototype.displose=function(){t.prototype.dispose.call(this),this.onBlurObservable.clear(),this.onFocusObservable.clear(),this.onKeyboardEventProcessedObservable.clear()},e}(O);Object(l.RegisterClass)("BABYLON.GUI.FocusableButton",M);var E=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype._beforeRenderText=function(t){for(var e=new T,i="",n=0;n1?this.notRenderable=!0:this.notRenderable=!1}else l.Tools.Error("Cannot move a control to a vector3 if the control is not at root level")},e.prototype._moveToProjectedPosition=function(t,e){void 0===e&&(e=!1);var i=t.x+this._linkOffsetX.getValue(this._host)+"px",n=t.y+this._linkOffsetY.getValue(this._host)+"px";e?(this.x2=i,this.y2=n,this._x2.ignoreAdaptiveScaling=!0,this._y2.ignoreAdaptiveScaling=!0):(this.x1=i,this.y1=n,this._x1.ignoreAdaptiveScaling=!0,this._y1.ignoreAdaptiveScaling=!0)},r([Object(l.serialize)()],e.prototype,"dash",null),r([Object(l.serialize)()],e.prototype,"x1",null),r([Object(l.serialize)()],e.prototype,"y1",null),r([Object(l.serialize)()],e.prototype,"x2",null),r([Object(l.serialize)()],e.prototype,"y2",null),r([Object(l.serialize)()],e.prototype,"lineWidth",null),e}(g);Object(l.RegisterClass)("BABYLON.GUI.Line",D);var L=function(){function t(t){this._multiLine=t,this._x=new _(0),this._y=new _(0),this._point=new l.Vector3(0,0,0)}return Object.defineProperty(t.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:!1,configurable:!0}),Object.defineProperty(t.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:!1,configurable:!0}),Object.defineProperty(t.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:!1,configurable:!0}),Object.defineProperty(t.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:!1,configurable:!0}),t.prototype.resetLinks=function(){this.control=null,this.mesh=null},t.prototype.translate=function(){return this._point=this._translatePoint(),this._point},t.prototype._translatePoint=function(){if(null!=this._mesh)return this._multiLine._host.getProjectedPositionWithZ(this._mesh.getBoundingInfo().boundingSphere.center,this._mesh.getWorldMatrix());if(null!=this._control)return new l.Vector3(this._control.centerX,this._control.centerY,1-l.Epsilon);var t=this._multiLine._host,e=this._x.getValueInPixel(t,Number(t._canvas.width)),i=this._y.getValueInPixel(t,Number(t._canvas.height));return new l.Vector3(e,i,1-l.Epsilon)},t.prototype.dispose=function(){this.resetLinks()},t}(),F=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._lineWidth=1,i.onPointUpdate=function(){i._markAsDirty()},i._automaticSize=!0,i.isHitTestVisible=!1,i._horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,i._verticalAlignment=g.VERTICAL_ALIGNMENT_TOP,i._dash=[],i._points=[],i}return o(e,t),Object.defineProperty(e.prototype,"dash",{get:function(){return this._dash},set:function(t){this._dash!==t&&(this._dash=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype.getAt=function(t){return this._points[t]||(this._points[t]=new L(this)),this._points[t]},e.prototype.add=function(){for(var t=this,e=[],i=0;i0;)this.remove(this._points.length-1)},e.prototype.resetLinks=function(){this._points.forEach((function(t){null!=t&&t.resetLinks()}))},Object.defineProperty(e.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(t){this._lineWidth!==t&&(this._lineWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"horizontalAlignment",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalAlignment",{set:function(t){},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"MultiLine"},e.prototype._draw=function(t,e){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._applyStates(t),t.strokeStyle=this.color,t.lineWidth=this._lineWidth,t.setLineDash(this._dash),t.beginPath();var i,n=!0;this._points.forEach((function(e){e&&(n?(t.moveTo(e._point.x,e._point.y),n=!1):e._point.z<1&&i.z<1?t.lineTo(e._point.x,e._point.y):t.moveTo(e._point.x,e._point.y),i=e._point)})),t.stroke(),t.restore()},e.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.xi._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)},e.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)},e.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)},e.prototype.dispose=function(){this.reset(),t.prototype.dispose.call(this)},r([Object(l.serialize)()],e.prototype,"dash",null),e}(g);Object(l.RegisterClass)("BABYLON.GUI.MultiLine",F);var N=function(t){function e(e){var i=t.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 l.Observable,i.isPointerBlocker=!0,i}return o(e,t),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.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:!1,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.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&&this._host.executeOnAllControls((function(t){if(t!==e&&void 0!==t.group){var i=t;i.group===e.group&&(i.isChecked=!1)}})))},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"RadioButton"},e.prototype._draw=function(t){t.save(),this._applyStates(t);var e=this._currentMeasure.width-this._thickness,i=this._currentMeasure.height-this._thickness;if((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),g.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,t),t.fillStyle=this._isEnabled?this._background:this._disabledColor,t.fill(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.strokeStyle=this.color,t.lineWidth=this._thickness,t.stroke(),this._isChecked){t.fillStyle=this._isEnabled?this.color:this._disabledColor;var n=e*this._checkSizeRatio,o=i*this._checkSizeRatio;g.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,t),t.fill()}t.restore()},e.prototype._onPointerDown=function(e,i,n,o,r){return!!t.prototype._onPointerDown.call(this,e,i,n,o,r)&&(this.isReadOnly||this.isChecked||(this.isChecked=!0),!0)},e.AddRadioButtonWithHeader=function(t,i,n,o){var r=new B;r.isVertical=!1,r.height="30px";var a=new e;a.width="20px",a.height="20px",a.isChecked=n,a.color="green",a.group=i,a.onIsCheckedChangedObservable.add((function(t){return o(a,t)})),r.addControl(a);var s=new x;return s.text=t,s.width="180px",s.paddingLeft="5px",s.textHorizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,s.color="white",r.addControl(s),r},r([Object(l.serialize)()],e.prototype,"thickness",null),r([Object(l.serialize)()],e.prototype,"group",void 0),r([Object(l.serialize)()],e.prototype,"checkSizeRatio",null),r([Object(l.serialize)()],e.prototype,"background",null),r([Object(l.serialize)()],e.prototype,"isChecked",null),e}(g);Object(l.RegisterClass)("BABYLON.GUI.RadioButton",N);var k=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thumbWidth=new _(20,_.UNITMODE_PIXEL,!1),i._minimum=0,i._maximum=100,i._value=50,i._isVertical=!1,i._barOffset=new _(5,_.UNITMODE_PIXEL,!1),i._isThumbClamped=!1,i._displayThumb=!0,i._step=0,i._lastPointerDownId=-1,i._effectiveBarOffset=0,i.onValueChangedObservable=new l.Observable,i._pointerIsDown=!1,i.isPointerBlocker=!0,i}return o(e,t),Object.defineProperty(e.prototype,"displayThumb",{get:function(){return this._displayThumb},set:function(t){this._displayThumb!==t&&(this._displayThumb=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"step",{get:function(){return this._step},set:function(t){this._step!==t&&(this._step=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.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:!1,configurable:!0}),Object.defineProperty(e.prototype,"barOffsetInPixels",{get:function(){return this._barOffset.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(e.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:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbWidthInPixels",{get:function(){return this._thumbWidth.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(e.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:!1,configurable:!0}),Object.defineProperty(e.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:!1,configurable:!0}),Object.defineProperty(e.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:!1,configurable:!0}),Object.defineProperty(e.prototype,"isVertical",{get:function(){return this._isVertical},set:function(t){this._isVertical!==t&&(this._isVertical=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isThumbClamped",{get:function(){return this._isThumbClamped},set:function(t){this._isThumbClamped!==t&&(this._isThumbClamped=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"BaseSlider"},e.prototype._getThumbPosition=function(){return this.isVertical?(this.maximum-this.value)/(this.maximum-this.minimum)*this._backgroundBoxLength:(this.value-this.minimum)/(this.maximum-this.minimum)*this._backgroundBoxLength},e.prototype._getThumbThickness=function(t){var e=0;switch(t){case"circle":e=this._thumbWidth.isPixel?Math.max(this._thumbWidth.getValue(this._host),this._backgroundBoxThickness):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host);break;case"rectangle":e=this._thumbWidth.isPixel?Math.min(this._thumbWidth.getValue(this._host),this._backgroundBoxThickness):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host)}return e},e.prototype._prepareRenderingData=function(t){this._effectiveBarOffset=0,this._renderLeft=this._currentMeasure.left,this._renderTop=this._currentMeasure.top,this._renderWidth=this._currentMeasure.width,this._renderHeight=this._currentMeasure.height,this._backgroundBoxLength=Math.max(this._currentMeasure.width,this._currentMeasure.height),this._backgroundBoxThickness=Math.min(this._currentMeasure.width,this._currentMeasure.height),this._effectiveThumbThickness=this._getThumbThickness(t),this.displayThumb&&(this._backgroundBoxLength-=this._effectiveThumbThickness),this.isVertical&&this._currentMeasure.height=this._selectors.length))return this._selectors[t]},t.prototype.removeSelector=function(t){t<0||t>=this._selectors.length||(this._groupPanel.removeControl(this._selectors[t]),this._selectors.splice(t,1))},t}(),Q=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.addCheckbox=function(t,e,i){void 0===e&&(e=function(t){}),void 0===i&&(i=!1);i=i||!1;var n=new C;n.width="20px",n.height="20px",n.color="#364249",n.background="#CCCCCC",n.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,n.onIsCheckedChangedObservable.add((function(t){e(t)}));var o=g.AddHeader(n,t,"200px",{isHorizontal:!0,controlFirst:!0});o.height="30px",o.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,o.left="4px",this.groupPanel.addControl(o),this.selectors.push(o),n.isChecked=i,this.groupPanel.parent&&this.groupPanel.parent.parent&&(n.color=this.groupPanel.parent.parent.buttonColor,n.background=this.groupPanel.parent.parent.buttonBackground)},e.prototype._setSelectorLabel=function(t,e){this.selectors[t].children[1].text=e},e.prototype._setSelectorLabelColor=function(t,e){this.selectors[t].children[1].color=e},e.prototype._setSelectorButtonColor=function(t,e){this.selectors[t].children[0].color=e},e.prototype._setSelectorButtonBackground=function(t,e){this.selectors[t].children[0].background=e},e}(z),V=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._selectNb=0,e}return o(e,t),e.prototype.addRadio=function(t,e,i){void 0===e&&(e=function(t){}),void 0===i&&(i=!1);var n=this._selectNb++,o=new N;o.name=t,o.width="20px",o.height="20px",o.color="#364249",o.background="#CCCCCC",o.group=this.name,o.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,o.onIsCheckedChangedObservable.add((function(t){t&&e(n)}));var r=g.AddHeader(o,t,"200px",{isHorizontal:!0,controlFirst:!0});r.height="30px",r.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,r.left="4px",this.groupPanel.addControl(r),this.selectors.push(r),o.isChecked=i,this.groupPanel.parent&&this.groupPanel.parent.parent&&(o.color=this.groupPanel.parent.parent.buttonColor,o.background=this.groupPanel.parent.parent.buttonBackground)},e.prototype._setSelectorLabel=function(t,e){this.selectors[t].children[1].text=e},e.prototype._setSelectorLabelColor=function(t,e){this.selectors[t].children[1].color=e},e.prototype._setSelectorButtonColor=function(t,e){this.selectors[t].children[0].color=e},e.prototype._setSelectorButtonBackground=function(t,e){this.selectors[t].children[0].background=e},e}(z),j=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.addSlider=function(t,e,i,n,o,r,a){void 0===e&&(e=function(t){}),void 0===i&&(i="Units"),void 0===n&&(n=0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===a&&(a=function(t){return 0|t});var s=new A;s.name=i,s.value=r,s.minimum=n,s.maximum=o,s.width=.9,s.height="20px",s.color="#364249",s.background="#CCCCCC",s.borderColor="black",s.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,s.left="4px",s.paddingBottom="4px",s.onValueChangedObservable.add((function(t){s.parent.children[0].text=s.parent.children[0].name+": "+a(t)+" "+s.name,e(t)}));var l=g.AddHeader(s,t+": "+a(r)+" "+i,"30px",{isHorizontal:!1,controlFirst:!1});l.height="60px",l.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,l.left="4px",l.children[0].name=t,this.groupPanel.addControl(l),this.selectors.push(l),this.groupPanel.parent&&this.groupPanel.parent.parent&&(s.color=this.groupPanel.parent.parent.buttonColor,s.background=this.groupPanel.parent.parent.buttonBackground)},e.prototype._setSelectorLabel=function(t,e){this.selectors[t].children[0].name=e,this.selectors[t].children[0].text=e+": "+this.selectors[t].children[1].value+" "+this.selectors[t].children[1].name},e.prototype._setSelectorLabelColor=function(t,e){this.selectors[t].children[0].color=e},e.prototype._setSelectorButtonColor=function(t,e){this.selectors[t].children[1].color=e},e.prototype._setSelectorButtonBackground=function(t,e){this.selectors[t].children[1].background=e},e}(z),H=function(t){function e(e,i){void 0===i&&(i=[]);var n=t.call(this,e)||this;if(n.name=e,n.groups=i,n._buttonColor="#364249",n._buttonBackground="#CCCCCC",n._headerColor="black",n._barColor="white",n._barHeight="2px",n._spacerHeight="20px",n._bars=new Array,n._groups=i,n.thickness=2,n._panel=new B,n._panel.verticalAlignment=g.VERTICAL_ALIGNMENT_TOP,n._panel.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,n._panel.top=5,n._panel.left=5,n._panel.width=.95,i.length>0){for(var o=0;o0&&this._addSpacer(),this._panel.addControl(t.groupPanel),this._groups.push(t),t.groupPanel.children[0].color=this._headerColor;for(var e=0;e=this._groups.length)){var e=this._groups[t];this._panel.removeControl(e.groupPanel),this._groups.splice(t,1),t=this._groups.length||(this._groups[e].groupPanel.children[0].text=t)},e.prototype.relabel=function(t,e,i){if(!(e<0||e>=this._groups.length)){var n=this._groups[e];i<0||i>=n.selectors.length||n._setSelectorLabel(i,t)}},e.prototype.removeFromGroupSelector=function(t,e){if(!(t<0||t>=this._groups.length)){var i=this._groups[t];e<0||e>=i.selectors.length||i.removeSelector(e)}},e.prototype.addToGroupCheckbox=function(t,e,i,n){(void 0===i&&(i=function(){}),void 0===n&&(n=!1),t<0||t>=this._groups.length)||this._groups[t].addCheckbox(e,i,n)},e.prototype.addToGroupRadio=function(t,e,i,n){(void 0===i&&(i=function(){}),void 0===n&&(n=!1),t<0||t>=this._groups.length)||this._groups[t].addRadio(e,i,n)},e.prototype.addToGroupSlider=function(t,e,i,n,o,r,a,s){(void 0===i&&(i=function(){}),void 0===n&&(n="Units"),void 0===o&&(o=0),void 0===r&&(r=0),void 0===a&&(a=0),void 0===s&&(s=function(t){return 0|t}),t<0||t>=this._groups.length)||this._groups[t].addSlider(e,i,n,o,r,a,s)},e}(y),W=function(t){function e(e){var i=t.call(this,e)||this;return i._freezeControls=!1,i._bucketWidth=0,i._bucketHeight=0,i._buckets={},i}return o(e,t),Object.defineProperty(e.prototype,"freezeControls",{get:function(){return this._freezeControls},set:function(t){if(this._freezeControls!==t){t||this._restoreMeasures(),this._freezeControls=!1;var e=this.host.getSize(),i=e.width,n=e.height,o=this.host.getContext(),r=new f(0,0,i,n);this.host._numLayoutCalls=0,this.host._rootContainer._layout(r,o),t&&(this._updateMeasures(),this._useBuckets()&&this._makeBuckets()),this._freezeControls=t,this.host.markAsDirty()}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bucketWidth",{get:function(){return this._bucketWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bucketHeight",{get:function(){return this._bucketHeight},enumerable:!1,configurable:!0}),e.prototype.setBucketSizes=function(t,e){this._bucketWidth=t,this._bucketHeight=e,this._useBuckets()?this._freezeControls&&this._makeBuckets():this._buckets={}},e.prototype._useBuckets=function(){return this._bucketWidth>0&&this._bucketHeight>0},e.prototype._makeBuckets=function(){this._buckets={},this._bucketLen=Math.ceil(this.widthInPixels/this._bucketWidth),this._dispatchInBuckets(this._children),this._oldLeft=null,this._oldTop=null},e.prototype._dispatchInBuckets=function(t){for(var e=0;e0&&this._dispatchInBuckets(i._children)}},e.prototype._updateMeasures=function(){var t=0|this.leftInPixels,e=0|this.topInPixels;this._measureForChildren.left-=t,this._measureForChildren.top-=e,this._currentMeasure.left-=t,this._currentMeasure.top-=e,this._customData.origLeftForChildren=this._measureForChildren.left,this._customData.origTopForChildren=this._measureForChildren.top,this._customData.origLeft=this._currentMeasure.left,this._customData.origTop=this._currentMeasure.top,this._updateChildrenMeasures(this._children,t,e)},e.prototype._updateChildrenMeasures=function(t,e,i){for(var n=0;n0&&this._updateChildrenMeasures(o._children,e,i)}},e.prototype._restoreMeasures=function(){var t=0|this.leftInPixels,e=0|this.topInPixels;this._measureForChildren.left=this._customData.origLeftForChildren+t,this._measureForChildren.top=this._customData.origTopForChildren+e,this._currentMeasure.left=this._customData.origLeft+t,this._currentMeasure.top=this._customData.origTop+e},e.prototype._getTypeName=function(){return"ScrollViewerWindow"},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._parentMeasure=e,this._measureForChildren.left=this._currentMeasure.left,this._measureForChildren.top=this._currentMeasure.top,this._measureForChildren.width=e.width,this._measureForChildren.height=e.height},e.prototype._layout=function(e,i){return this._freezeControls?(this.invalidateRect(),!1):t.prototype._layout.call(this,e,i)},e.prototype._scrollChildren=function(t,e,i){for(var n=0;n0&&this._scrollChildren(o._children,e,i)}},e.prototype._scrollChildrenWithBuckets=function(t,e,i,n){for(var o=Math.max(0,Math.floor(-t/this._bucketWidth)),r=Math.floor((-t+this._parentMeasure.width-1)/this._bucketWidth),a=Math.max(0,Math.floor(-e/this._bucketHeight)),s=Math.floor((-e+this._parentMeasure.height-1)/this._bucketHeight);a<=s;){for(var l=o;l<=r;++l){var _=a*this._bucketLen+l,h=this._buckets[_];if(h)for(var c=0;cthis._tempMeasure.left+this._tempMeasure.width||ethis._tempMeasure.top+this._tempMeasure.height)&&(this.isVertical?this.value=this.minimum+(1-(e-this._currentMeasure.top)/this._currentMeasure.height)*(this.maximum-this.minimum):this.value=this.minimum+(t-this._currentMeasure.left)/this._currentMeasure.width*(this.maximum-this.minimum)));var i=0;i=this.isVertical?-(e-this._originY)/(this._currentMeasure.height-this._effectiveThumbThickness):(t-this._originX)/(this._currentMeasure.width-this._effectiveThumbThickness),this.value+=i*(this.maximum-this.minimum),this._originX=t,this._originY=e},e.prototype._onPointerDown=function(e,i,n,o,r){return this._first=!0,t.prototype._onPointerDown.call(this,e,i,n,o,r)},r([Object(l.serialize)()],e.prototype,"borderColor",null),r([Object(l.serialize)()],e.prototype,"background",null),e}(k),U=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thumbLength=.5,i._thumbHeight=1,i._barImageHeight=1,i._tempMeasure=new f(0,0,0,0),i.num90RotationInVerticalMode=1,i}return o(e,t),Object.defineProperty(e.prototype,"backgroundImage",{get:function(){return this._backgroundBaseImage},set:function(t){var e=this;this._backgroundBaseImage!==t&&(this._backgroundBaseImage=t,this.isVertical&&0!==this.num90RotationInVerticalMode?t.isLoaded?(this._backgroundImage=t._rotate90(this.num90RotationInVerticalMode,!0),this._markAsDirty()):t.onImageLoadedObservable.addOnce((function(){var i=t._rotate90(e.num90RotationInVerticalMode,!0);e._backgroundImage=i,i.isLoaded||i.onImageLoadedObservable.addOnce((function(){e._markAsDirty()})),e._markAsDirty()})):(this._backgroundImage=t,t&&!t.isLoaded&&t.onImageLoadedObservable.addOnce((function(){e._markAsDirty()})),this._markAsDirty()))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbImage",{get:function(){return this._thumbBaseImage},set:function(t){var e=this;this._thumbBaseImage!==t&&(this._thumbBaseImage=t,this.isVertical&&0!==this.num90RotationInVerticalMode?t.isLoaded?(this._thumbImage=t._rotate90(-this.num90RotationInVerticalMode,!0),this._markAsDirty()):t.onImageLoadedObservable.addOnce((function(){var i=t._rotate90(-e.num90RotationInVerticalMode,!0);e._thumbImage=i,i.isLoaded||i.onImageLoadedObservable.addOnce((function(){e._markAsDirty()})),e._markAsDirty()})):(this._thumbImage=t,t&&!t.isLoaded&&t.onImageLoadedObservable.addOnce((function(){e._markAsDirty()})),this._markAsDirty()))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbLength",{get:function(){return this._thumbLength},set:function(t){this._thumbLength!==t&&(this._thumbLength=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbHeight",{get:function(){return this._thumbHeight},set:function(t){this._thumbLength!==t&&(this._thumbHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barImageHeight",{get:function(){return this._barImageHeight},set:function(t){this._barImageHeight!==t&&(this._barImageHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"ImageScrollBar"},e.prototype._getThumbThickness=function(){return this._thumbWidth.isPixel?this._thumbWidth.getValue(this._host):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host)},e.prototype._draw=function(t){t.save(),this._applyStates(t),this._prepareRenderingData("rectangle");var e=this._getThumbPosition(),i=this._renderLeft,n=this._renderTop,o=this._renderWidth,r=this._renderHeight;this._backgroundImage&&(this._tempMeasure.copyFromFloats(i,n,o,r),this.isVertical?(this._tempMeasure.copyFromFloats(i+o*(1-this._barImageHeight)*.5,this._currentMeasure.top,o*this._barImageHeight,r),this._tempMeasure.height+=this._effectiveThumbThickness,this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure)):(this._tempMeasure.copyFromFloats(this._currentMeasure.left,n+r*(1-this._barImageHeight)*.5,o,r*this._barImageHeight),this._tempMeasure.width+=this._effectiveThumbThickness,this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure)),this._backgroundImage._draw(t)),this.isVertical?this._tempMeasure.copyFromFloats(i-this._effectiveBarOffset+this._currentMeasure.width*(1-this._thumbHeight)*.5,this._currentMeasure.top+e,this._currentMeasure.width*this._thumbHeight,this._effectiveThumbThickness):this._tempMeasure.copyFromFloats(this._currentMeasure.left+e,this._currentMeasure.top+this._currentMeasure.height*(1-this._thumbHeight)*.5,this._effectiveThumbThickness,this._currentMeasure.height*this._thumbHeight),this._thumbImage&&(this._thumbImage._currentMeasure.copyFrom(this._tempMeasure),this._thumbImage._draw(t)),t.restore()},e.prototype._updateValueFromPointer=function(t,e){0!=this.rotation&&(this._invertTransformMatrix.transformCoordinates(t,e,this._transformedPosition),t=this._transformedPosition.x,e=this._transformedPosition.y),this._first&&(this._first=!1,this._originX=t,this._originY=e,(tthis._tempMeasure.left+this._tempMeasure.width||ethis._tempMeasure.top+this._tempMeasure.height)&&(this.isVertical?this.value=this.minimum+(1-(e-this._currentMeasure.top)/this._currentMeasure.height)*(this.maximum-this.minimum):this.value=this.minimum+(t-this._currentMeasure.left)/this._currentMeasure.width*(this.maximum-this.minimum)));var i=0;i=this.isVertical?-(e-this._originY)/(this._currentMeasure.height-this._effectiveThumbThickness):(t-this._originX)/(this._currentMeasure.width-this._effectiveThumbThickness),this.value+=i*(this.maximum-this.minimum),this._originX=t,this._originY=e},e.prototype._onPointerDown=function(e,i,n,o,r){return this._first=!0,t.prototype._onPointerDown.call(this,e,i,n,o,r)},r([Object(l.serialize)()],e.prototype,"num90RotationInVerticalMode",void 0),e}(k),X=function(t){function e(e,i){var n=t.call(this,e)||this;return n._barSize=20,n._pointerIsOver=!1,n._wheelPrecision=.05,n._thumbLength=.5,n._thumbHeight=1,n._barImageHeight=1,n._horizontalBarImageHeight=1,n._verticalBarImageHeight=1,n._oldWindowContentsWidth=0,n._oldWindowContentsHeight=0,n._forceHorizontalBar=!1,n._forceVerticalBar=!1,n._useImageBar=i||!1,n.onDirtyObservable.add((function(){n._horizontalBarSpace.color=n.color,n._verticalBarSpace.color=n.color,n._dragSpace.color=n.color})),n.onPointerEnterObservable.add((function(){n._pointerIsOver=!0})),n.onPointerOutObservable.add((function(){n._pointerIsOver=!1})),n._grid=new S,n._useImageBar?(n._horizontalBar=new U,n._verticalBar=new U):(n._horizontalBar=new G,n._verticalBar=new G),n._window=new W("scrollViewer_window"),n._window.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,n._window.verticalAlignment=g.VERTICAL_ALIGNMENT_TOP,n._grid.addColumnDefinition(1),n._grid.addColumnDefinition(0,!0),n._grid.addRowDefinition(1),n._grid.addRowDefinition(0,!0),t.prototype.addControl.call(n,n._grid),n._grid.addControl(n._window,0,0),n._verticalBarSpace=new y,n._verticalBarSpace.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,n._verticalBarSpace.verticalAlignment=g.VERTICAL_ALIGNMENT_TOP,n._verticalBarSpace.thickness=1,n._grid.addControl(n._verticalBarSpace,0,1),n._addBar(n._verticalBar,n._verticalBarSpace,!0,Math.PI),n._horizontalBarSpace=new y,n._horizontalBarSpace.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,n._horizontalBarSpace.verticalAlignment=g.VERTICAL_ALIGNMENT_TOP,n._horizontalBarSpace.thickness=1,n._grid.addControl(n._horizontalBarSpace,1,0),n._addBar(n._horizontalBar,n._horizontalBarSpace,!1,0),n._dragSpace=new y,n._dragSpace.thickness=1,n._grid.addControl(n._dragSpace,1,1),n._useImageBar||(n.barColor="grey",n.barBackground="transparent"),n}return o(e,t),Object.defineProperty(e.prototype,"horizontalBar",{get:function(){return this._horizontalBar},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalBar",{get:function(){return this._verticalBar},enumerable:!1,configurable:!0}),e.prototype.addControl=function(t){return t?(this._window.addControl(t),this):this},e.prototype.removeControl=function(t){return this._window.removeControl(t),this},Object.defineProperty(e.prototype,"children",{get:function(){return this._window.children},enumerable:!1,configurable:!0}),e.prototype._flagDescendantsAsMatrixDirty=function(){for(var t=0,e=this._children;t1&&(t=1),this._wheelPrecision=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scrollBackground",{get:function(){return this._horizontalBarSpace.background},set:function(t){this._horizontalBarSpace.background!==t&&(this._horizontalBarSpace.background=t,this._verticalBarSpace.background=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barColor",{get:function(){return this._barColor},set:function(t){this._barColor!==t&&(this._barColor=t,this._horizontalBar.color=t,this._verticalBar.color=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbImage",{get:function(){return this._barImage},set:function(t){if(this._barImage!==t){this._barImage=t;var e=this._horizontalBar,i=this._verticalBar;e.thumbImage=t,i.thumbImage=t}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"horizontalThumbImage",{get:function(){return this._horizontalBarImage},set:function(t){this._horizontalBarImage!==t&&(this._horizontalBarImage=t,this._horizontalBar.thumbImage=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalThumbImage",{get:function(){return this._verticalBarImage},set:function(t){this._verticalBarImage!==t&&(this._verticalBarImage=t,this._verticalBar.thumbImage=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barSize",{get:function(){return this._barSize},set:function(t){this._barSize!==t&&(this._barSize=t,this._markAsDirty(),this._horizontalBar.isVisible&&this._grid.setRowDefinition(1,this._barSize,!0),this._verticalBar.isVisible&&this._grid.setColumnDefinition(1,this._barSize,!0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbLength",{get:function(){return this._thumbLength},set:function(t){if(this._thumbLength!==t){t<=0&&(t=.1),t>1&&(t=1),this._thumbLength=t;var e=this._horizontalBar,i=this._verticalBar;e.thumbLength=t,i.thumbLength=t,this._markAsDirty()}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbHeight",{get:function(){return this._thumbHeight},set:function(t){if(this._thumbHeight!==t){t<=0&&(t=.1),t>1&&(t=1),this._thumbHeight=t;var e=this._horizontalBar,i=this._verticalBar;e.thumbHeight=t,i.thumbHeight=t,this._markAsDirty()}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barImageHeight",{get:function(){return this._barImageHeight},set:function(t){if(this._barImageHeight!==t){t<=0&&(t=.1),t>1&&(t=1),this._barImageHeight=t;var e=this._horizontalBar,i=this._verticalBar;e.barImageHeight=t,i.barImageHeight=t,this._markAsDirty()}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"horizontalBarImageHeight",{get:function(){return this._horizontalBarImageHeight},set:function(t){this._horizontalBarImageHeight!==t&&(t<=0&&(t=.1),t>1&&(t=1),this._horizontalBarImageHeight=t,this._horizontalBar.barImageHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalBarImageHeight",{get:function(){return this._verticalBarImageHeight},set:function(t){this._verticalBarImageHeight!==t&&(t<=0&&(t=.1),t>1&&(t=1),this._verticalBarImageHeight=t,this._verticalBar.barImageHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barBackground",{get:function(){return this._barBackground},set:function(t){if(this._barBackground!==t){this._barBackground=t;var e=this._horizontalBar,i=this._verticalBar;e.background=t,i.background=t,this._dragSpace.background=t}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barImage",{get:function(){return this._barBackgroundImage},set:function(t){this._barBackgroundImage,this._barBackgroundImage=t;var e=this._horizontalBar,i=this._verticalBar;e.backgroundImage=t,i.backgroundImage=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"horizontalBarImage",{get:function(){return this._horizontalBarBackgroundImage},set:function(t){this._horizontalBarBackgroundImage,this._horizontalBarBackgroundImage=t,this._horizontalBar.backgroundImage=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalBarImage",{get:function(){return this._verticalBarBackgroundImage},set:function(t){this._verticalBarBackgroundImage,this._verticalBarBackgroundImage=t,this._verticalBar.backgroundImage=t},enumerable:!1,configurable:!0}),e.prototype._setWindowPosition=function(t){void 0===t&&(t=!0);var e=this.host.idealRatio,i=this._window._currentMeasure.width,n=this._window._currentMeasure.height;if(t||this._oldWindowContentsWidth!==i||this._oldWindowContentsHeight!==n){this._oldWindowContentsWidth=i,this._oldWindowContentsHeight=n;var o=this._clientWidth-i,r=this._clientHeight-n,a=this._horizontalBar.value/e*o+"px",s=this._verticalBar.value/e*r+"px";a!==this._window.left&&(this._window.left=a,this.freezeControls||(this._rebuildLayout=!0)),s!==this._window.top&&(this._window.top=s,this.freezeControls||(this._rebuildLayout=!0))}},e.prototype._updateScroller=function(){var t=this._window._currentMeasure.width,e=this._window._currentMeasure.height;this._horizontalBar.isVisible&&t<=this._clientWidth&&!this.forceHorizontalBar?(this._grid.setRowDefinition(1,0,!0),this._horizontalBar.isVisible=!1,this._horizontalBar.value=0,this._rebuildLayout=!0):!this._horizontalBar.isVisible&&(t>this._clientWidth||this.forceHorizontalBar)&&(this._grid.setRowDefinition(1,this._barSize,!0),this._horizontalBar.isVisible=!0,this._rebuildLayout=!0),this._verticalBar.isVisible&&e<=this._clientHeight&&!this.forceVerticalBar?(this._grid.setColumnDefinition(1,0,!0),this._verticalBar.isVisible=!1,this._verticalBar.value=0,this._rebuildLayout=!0):!this._verticalBar.isVisible&&(e>this._clientHeight||this.forceVerticalBar)&&(this._grid.setColumnDefinition(1,this._barSize,!0),this._verticalBar.isVisible=!0,this._rebuildLayout=!0),this._buildClientSizes();var i=this.host.idealRatio;this._horizontalBar.thumbWidth=.9*this._thumbLength*(this._clientWidth/i)+"px",this._verticalBar.thumbWidth=.9*this._thumbLength*(this._clientHeight/i)+"px"},e.prototype._link=function(e){t.prototype._link.call(this,e),this._attachWheel()},e.prototype._addBar=function(t,e,i,n){var o=this;t.paddingLeft=0,t.width="100%",t.height="100%",t.barOffset=0,t.value=0,t.maximum=1,t.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_CENTER,t.verticalAlignment=g.VERTICAL_ALIGNMENT_CENTER,t.isVertical=i,t.rotation=n,t.isVisible=!1,e.addControl(t),t.onValueChangedObservable.add((function(t){o._setWindowPosition()}))},e.prototype._attachWheel=function(){var t=this;this._host&&!this._onWheelObserver&&(this._onWheelObserver=this.onWheelObservable.add((function(e){t._pointerIsOver&&!t.isReadOnly&&(1==t._verticalBar.isVisible&&(e.y<0&&t._verticalBar.value>0?t._verticalBar.value-=t._wheelPrecision:e.y>0&&t._verticalBar.value0&&t._horizontalBar.value>0&&(t._horizontalBar.value-=t._wheelPrecision)))})))},e.prototype._renderHighlightSpecific=function(e){this.isHighlighted&&(t.prototype._renderHighlightSpecific.call(this,e),this._grid._renderHighlightSpecific(e),e.restore())},e.prototype.dispose=function(){this.onWheelObservable.remove(this._onWheelObserver),this._onWheelObserver=null,t.prototype.dispose.call(this)},e}(y);Object(l.RegisterClass)("BABYLON.GUI.ScrollViewer",X);var Y=function(t){function e(e,i){var n=t.call(this,e)||this;n.name=e,n.onIsActiveChangedObservable=new l.Observable,n.delegatePickingToChildren=!1,n._isActive=!1,n.group=null!=i?i:"",n.thickness=0,n.isPointerBlocker=!0;var o=null;return n.toActiveAnimation=function(){n.thickness=1},n.toInactiveAnimation=function(){n.thickness=0},n.pointerEnterActiveAnimation=function(){o=n.alpha,n.alpha-=.1},n.pointerOutActiveAnimation=function(){null!==o&&(n.alpha=o)},n.pointerDownActiveAnimation=function(){n.scaleX-=.05,n.scaleY-=.05},n.pointerUpActiveAnimation=function(){n.scaleX+=.05,n.scaleY+=.05},n.pointerEnterInactiveAnimation=function(){o=n.alpha,n.alpha-=.1},n.pointerOutInactiveAnimation=function(){null!==o&&(n.alpha=o)},n.pointerDownInactiveAnimation=function(){n.scaleX-=.05,n.scaleY-=.05},n.pointerUpInactiveAnimation=function(){n.scaleX+=.05,n.scaleY+=.05},n}return o(e,t),Object.defineProperty(e.prototype,"group",{get:function(){return this._group},set:function(t){this._group!==t&&(this._group=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isActive",{get:function(){return this._isActive},set:function(t){var e,i,n=this;this._isActive!==t&&(this._isActive=t,this._isActive?null===(e=this.toActiveAnimation)||void 0===e||e.call(this):null===(i=this.toInactiveAnimation)||void 0===i||i.call(this),this._markAsDirty(),this.onIsActiveChangedObservable.notifyObservers(t),this._isActive&&this._host&&this._group&&this._host.executeOnAllControls((function(t){if("ToggleButton"===t.typeName){if(t===n)return;var e=t;e.group===n.group&&(e.isActive=!1)}})))},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"ToggleButton"},e.prototype._processPicking=function(e,i,n,o,r,a,s,l){if(!this._isEnabled||!this.isHitTestVisible||!this.isVisible||this.notRenderable)return!1;if(!t.prototype.contains.call(this,e,i))return!1;if(this.delegatePickingToChildren){for(var _=!1,h=this._children.length-1;h>=0;h--){var c=this._children[h];if(c.isEnabled&&c.isHitTestVisible&&c.isVisible&&!c.notRenderable&&c.contains(e,i)){_=!0;break}}if(!_)return!1}return this._processObservables(o,e,i,n,r,a,s,l),!0},e.prototype._onPointerEnter=function(e,i){return!!t.prototype._onPointerEnter.call(this,e,i)&&(this.isReadOnly||(this._isActive?this.pointerEnterActiveAnimation&&this.pointerEnterActiveAnimation():this.pointerEnterInactiveAnimation&&this.pointerEnterInactiveAnimation()),!0)},e.prototype._onPointerOut=function(e,i,n){void 0===n&&(n=!1),this.isReadOnly||(this._isActive?this.pointerOutActiveAnimation&&this.pointerOutActiveAnimation():this.pointerOutInactiveAnimation&&this.pointerOutInactiveAnimation()),t.prototype._onPointerOut.call(this,e,i,n)},e.prototype._onPointerDown=function(e,i,n,o,r){return!!t.prototype._onPointerDown.call(this,e,i,n,o,r)&&(this.isReadOnly||(this._isActive?this.pointerDownActiveAnimation&&this.pointerDownActiveAnimation():this.pointerDownInactiveAnimation&&this.pointerDownInactiveAnimation()),!0)},e.prototype._onPointerUp=function(e,i,n,o,r,a){this.isReadOnly||(this._isActive?this.pointerUpActiveAnimation&&this.pointerUpActiveAnimation():this.pointerUpInactiveAnimation&&this.pointerUpInactiveAnimation()),t.prototype._onPointerUp.call(this,e,i,n,o,r,a)},e}(y);Object(l.RegisterClass)("BABYLON.GUI.ToggleButton",Y);var K=function(){},Z=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.onKeyPressObservable=new l.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._currentlyConnectedInputText=null,e._connectedInputTexts=[],e._onKeyPressObserver=null,e}return o(e,t),e.prototype._getTypeName=function(){return"VirtualKeyboard"},e.prototype._createKey=function(t,e){var i=this,n=O.CreateSimpleButton(t,t);return n.width=e&&e.width?e.width:this.defaultButtonWidth,n.height=e&&e.height?e.height:this.defaultButtonHeight,n.color=e&&e.color?e.color:this.defaultButtonColor,n.background=e&&e.background?e.background:this.defaultButtonBackground,n.paddingLeft=e&&e.paddingLeft?e.paddingLeft:this.defaultButtonPaddingLeft,n.paddingRight=e&&e.paddingRight?e.paddingRight:this.defaultButtonPaddingRight,n.paddingTop=e&&e.paddingTop?e.paddingTop:this.defaultButtonPaddingTop,n.paddingBottom=e&&e.paddingBottom?e.paddingBottom:this.defaultButtonPaddingBottom,n.thickness=0,n.isFocusInvisible=!0,n.shadowColor=this.shadowColor,n.shadowBlur=this.shadowBlur,n.shadowOffsetX=this.shadowOffsetX,n.shadowOffsetY=this.shadowOffsetY,n.onPointerUpObservable.add((function(){i.onKeyPressObservable.notifyObservers(t)})),n},e.prototype.addKeysRow=function(t,e){var i=new B;i.isVertical=!1,i.isFocusInvisible=!0;for(var n=null,o=0;on.heightInPixels)&&(n=a),i.addControl(a)}i.height=n?n.height:this.defaultButtonHeight,this.addControl(i)},e.prototype.applyShiftState=function(t){if(this.children)for(var e=0;e1?this.selectedShiftThickness:0),a.text=t>0?a.text.toUpperCase():a.text.toLowerCase()}}}},Object.defineProperty(e.prototype,"connectedInputText",{get:function(){return this._currentlyConnectedInputText},enumerable:!1,configurable:!0}),e.prototype.connect=function(t){var e=this;if(!this._connectedInputTexts.some((function(e){return e.input===t}))){null===this._onKeyPressObserver&&(this._onKeyPressObserver=this.onKeyPressObservable.add((function(t){if(e._currentlyConnectedInputText){switch(e._currentlyConnectedInputText._host.focusedControl=e._currentlyConnectedInputText,t){case"⇧":return e.shiftState++,e.shiftState>2&&(e.shiftState=0),void e.applyShiftState(e.shiftState);case"←":return void e._currentlyConnectedInputText.processKey(8);case"↵":return void e._currentlyConnectedInputText.processKey(13)}e._currentlyConnectedInputText.processKey(-1,e.shiftState?t.toUpperCase():t),1===e.shiftState&&(e.shiftState=0,e.applyShiftState(e.shiftState))}}))),this.isVisible=!1,this._currentlyConnectedInputText=t,t._connectedVirtualKeyboard=this;var i=t.onFocusObservable.add((function(){e._currentlyConnectedInputText=t,t._connectedVirtualKeyboard=e,e.isVisible=!0})),n=t.onBlurObservable.add((function(){t._connectedVirtualKeyboard=null,e._currentlyConnectedInputText=null,e.isVisible=!1}));this._connectedInputTexts.push({input:t,onBlurObserver:n,onFocusObserver:i})}},e.prototype.disconnect=function(t){var e=this;if(t){var i=this._connectedInputTexts.filter((function(e){return e.input===t}));1===i.length&&(this._removeConnectedInputObservables(i[0]),this._connectedInputTexts=this._connectedInputTexts.filter((function(e){return e.input!==t})),this._currentlyConnectedInputText===t&&(this._currentlyConnectedInputText=null))}else this._connectedInputTexts.forEach((function(t){e._removeConnectedInputObservables(t)})),this._connectedInputTexts=[];0===this._connectedInputTexts.length&&(this._currentlyConnectedInputText=null,this.onKeyPressObservable.remove(this._onKeyPressObserver),this._onKeyPressObserver=null)},e.prototype._removeConnectedInputObservables=function(t){t.input._connectedVirtualKeyboard=null,t.input.onFocusObservable.remove(t.onFocusObserver),t.input.onBlurObservable.remove(t.onBlurObserver)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.disconnect()},e.CreateDefaultLayout=function(t){var i=new e(t);return i.addKeysRow(["1","2","3","4","5","6","7","8","9","0","←"]),i.addKeysRow(["q","w","e","r","t","y","u","i","o","p"]),i.addKeysRow(["a","s","d","f","g","h","j","k","l",";","'","↵"]),i.addKeysRow(["⇧","z","x","c","v","b","n","m",",",".","/"]),i.addKeysRow([" "],[{width:"200px"}]),i},e}(B);Object(l.RegisterClass)("BABYLON.GUI.VirtualKeyboard",Z);var q=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._cellWidth=20,i._cellHeight=20,i._minorLineTickness=1,i._minorLineColor="DarkGray",i._majorLineTickness=2,i._majorLineColor="White",i._majorLineFrequency=5,i._background="Black",i._displayMajorLines=!0,i._displayMinorLines=!0,i}return o(e,t),Object.defineProperty(e.prototype,"displayMinorLines",{get:function(){return this._displayMinorLines},set:function(t){this._displayMinorLines!==t&&(this._displayMinorLines=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"displayMajorLines",{get:function(){return this._displayMajorLines},set:function(t){this._displayMajorLines!==t&&(this._displayMajorLines=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cellWidth",{get:function(){return this._cellWidth},set:function(t){this._cellWidth=t,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cellHeight",{get:function(){return this._cellHeight},set:function(t){this._cellHeight=t,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minorLineTickness",{get:function(){return this._minorLineTickness},set:function(t){this._minorLineTickness=t,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minorLineColor",{get:function(){return this._minorLineColor},set:function(t){this._minorLineColor=t,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"majorLineTickness",{get:function(){return this._majorLineTickness},set:function(t){this._majorLineTickness=t,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"majorLineColor",{get:function(){return this._majorLineColor},set:function(t){this._majorLineColor=t,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"majorLineFrequency",{get:function(){return this._majorLineFrequency},set:function(t){this._majorLineFrequency=t,this._markAsDirty()},enumerable:!1,configurable:!0}),e.prototype._draw=function(t,e){if(t.save(),this._applyStates(t),this._isEnabled){this._background&&(t.fillStyle=this._background,t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height));var i=this._currentMeasure.width/this._cellWidth,n=this._currentMeasure.height/this._cellHeight,o=this._currentMeasure.left+this._currentMeasure.width/2,r=this._currentMeasure.top+this._currentMeasure.height/2;if(this._displayMinorLines){t.strokeStyle=this._minorLineColor,t.lineWidth=this._minorLineTickness;for(var a=-i/2+1;a0&&(a=a.add(o.normalize().scale(n/r)))}})),a.length()>0&&(a=a.normalize().scale(i*(null!==(r=t.overlapDeltaMultiplier)&&void 0!==r?r:1)),t.linkOffsetXInPixels+=a.x,t.linkOffsetYInPixels+=a.y)}))},e.prototype.dispose=function(){var e=this.getScene();e&&(this._rootElement=null,e.onBeforeCameraRenderObservable.remove(this._renderObserver),this._resizeObserver&&e.getEngine().onResizeObservable.remove(this._resizeObserver),this._pointerMoveObserver&&e.onPrePointerObservable.remove(this._pointerMoveObserver),this._sceneRenderObserver&&e.onBeforeRenderObservable.remove(this._sceneRenderObserver),this._pointerObserver&&e.onPointerObservable.remove(this._pointerObserver),this._preKeyboardObserver&&e.onPreKeyboardObservable.remove(this._preKeyboardObserver),this._canvasPointerOutObserver&&e.getEngine().onCanvasPointerOutObservable.remove(this._canvasPointerOutObserver),this._canvasBlurObserver&&e.getEngine().onCanvasBlurObservable.remove(this._canvasBlurObserver),this._layerToDispose&&(this._layerToDispose.texture=null,this._layerToDispose.dispose(),this._layerToDispose=null),this._rootContainer.dispose(),this.onClipboardObservable.clear(),this.onControlPickedObservable.clear(),this.onBeginRenderObservable.clear(),this.onEndRenderObservable.clear(),this.onBeginLayoutObservable.clear(),this.onEndLayoutObservable.clear(),t.prototype.dispose.call(this))},e.prototype._onResize=function(){var t=this.getScene();if(t){var e=t.getEngine(),i=this.getSize(),n=e.getRenderWidth()*this._renderScale,o=e.getRenderHeight()*this._renderScale;this._renderAtIdealSize&&(this._idealWidth?(o=o*this._idealWidth/n,n=this._idealWidth):this._idealHeight&&(n=n*this._idealHeight/o,o=this._idealHeight)),i.width===n&&i.height===o||(this.scaleTo(n,o),this.markAsDirty(),(this._idealWidth||this._idealHeight)&&this._rootContainer._markAllAsDirty()),this.invalidateRect(0,0,i.width-1,i.height-1)}},e.prototype._getGlobalViewport=function(){var t=this.getSize(),e=this._fullscreenViewport.toGlobal(t.width,t.height),i=Math.round(e.width*(1/this.rootContainer.scaleX)),n=Math.round(e.height*(1/this.rootContainer.scaleY));return e.x+=(e.width-i)/2,e.y+=(e.height-n)/2,e.width=i,e.height=n,e},e.prototype.getProjectedPosition=function(t,e){var i=this.getProjectedPositionWithZ(t,e);return new l.Vector2(i.x,i.y)},e.prototype.getProjectedPositionWithZ=function(t,e){var i=this.getScene();if(!i)return l.Vector3.Zero();var n=this._getGlobalViewport(),o=l.Vector3.Project(t,e,i.getTransformMatrix(),n);return new l.Vector3(o.x,o.y,o.z)},e.prototype._checkUpdate=function(t){if(!this._layerToDispose||0!=(t.layerMask&this._layerToDispose.layerMask)){if(this._isFullscreen&&this._linkedControls.length){var i=this.getScene();if(!i)return;for(var n=this._getGlobalViewport(),o=function(t){if(!t.isVisible)return"continue";var e=t._linkedMesh;if(!e||e.isDisposed())return l.Tools.SetImmediate((function(){t.linkWithMesh(null)})),"continue";var o=e.getBoundingInfo?e.getBoundingInfo().boundingSphere.center:l.Vector3.ZeroReadOnly,r=l.Vector3.Project(o,e.getWorldMatrix(),i.getTransformMatrix(),n);if(r.z<0||r.z>1)return t.notRenderable=!0,"continue";t.notRenderable=!1,t._moveToProjectedPosition(r)},r=0,a=this._linkedControls;ra.width||r>a.height||(t.cameraToUseForPointers=i,e.x=a.x,e.y=a.y,e.width=a.width,e.height=a.height)}))}else n.viewport.toGlobalToRef(o.getRenderWidth(),o.getRenderHeight(),e);else e.x=0,e.y=0,e.width=o.getRenderWidth(),e.height=o.getRenderHeight();var s=t.pointerX/o.getHardwareScalingLevel()-e.x,_=t.pointerY/o.getHardwareScalingLevel()-(o.getRenderHeight()-e.y-e.height);if(this._shouldBlockPointer=!1,i){var h=i.event.pointerId||this._defaultMousePointerId;this._doPicking(s,_,i,i.type,h,i.event.button,i.event.deltaX,i.event.deltaY),this._shouldBlockPointer&&(i.skipOnPointerObservable=this._shouldBlockPointer)}else this._doPicking(s,_,null,l.PointerEventTypes.POINTERMOVE,this._defaultMousePointerId,0);t.cameraToUseForPointers=r},e.prototype.attach=function(){var t=this,e=this.getScene();if(e){var i=new l.Viewport(0,0,0,0);this._pointerMoveObserver=e.onPrePointerObservable.add((function(n,o){e.isPointerCaptured(n.event.pointerId)||n.type!==l.PointerEventTypes.POINTERMOVE&&n.type!==l.PointerEventTypes.POINTERUP&&n.type!==l.PointerEventTypes.POINTERDOWN&&n.type!==l.PointerEventTypes.POINTERWHEEL||(n.type===l.PointerEventTypes.POINTERMOVE&&n.event.pointerId&&(t._defaultMousePointerId=n.event.pointerId),t._translateToPicking(e,i,n))})),this._attachPickingToSceneRender(e,(function(){return t._translateToPicking(e,i,null)}),!1),this._attachToOnPointerOut(e),this._attachToOnBlur(e)}},e.prototype.registerClipboardEvents=function(){self.addEventListener("copy",this.onClipboardCopy,!1),self.addEventListener("cut",this.onClipboardCut,!1),self.addEventListener("paste",this.onClipboardPaste,!1)},e.prototype.unRegisterClipboardEvents=function(){self.removeEventListener("copy",this.onClipboardCopy),self.removeEventListener("cut",this.onClipboardCut),self.removeEventListener("paste",this.onClipboardPaste)},e.prototype.attachToMesh=function(t,e){var i=this;void 0===e&&(e=!0);var n=this.getScene();n&&(this._pointerObserver=n.onPointerObservable.add((function(e,n){if(e.type===l.PointerEventTypes.POINTERMOVE||e.type===l.PointerEventTypes.POINTERUP||e.type===l.PointerEventTypes.POINTERDOWN||e.type===l.PointerEventTypes.POINTERWHEEL){e.type===l.PointerEventTypes.POINTERMOVE&&e.event.pointerId&&(i._defaultMousePointerId=e.event.pointerId);var o=e.event.pointerId||i._defaultMousePointerId;if(e.pickInfo&&e.pickInfo.hit&&e.pickInfo.pickedMesh===t){var r=e.pickInfo.getTextureCoordinates();if(r){var a=i.getSize();i._doPicking(r.x*a.width,(i.applyYInversionOnUpdate?1-r.y:r.y)*a.height,e,e.type,o,e.event.button,e.event.deltaX,e.event.deltaY)}}else if(e.type===l.PointerEventTypes.POINTERUP){if(i._lastControlDown[o]&&i._lastControlDown[o]._forcePointerUp(o),delete i._lastControlDown[o],i.focusedControl){var s=i.focusedControl.keepsFocusWith(),_=!0;if(s)for(var h=0,c=s;h0||i)&&e()}))},e.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],null),delete e._lastControlOver[t.pointerId],e._lastControlDown[t.pointerId]&&e._lastControlDown[t.pointerId]!==e._capturingControl[t.pointerId]&&(e._lastControlDown[t.pointerId]._forcePointerUp(),delete e._lastControlDown[t.pointerId])}))},e.prototype._attachToOnBlur=function(t){var e=this;this._canvasBlurObserver=t.getEngine().onCanvasBlurObservable.add((function(t){Object.entries(e._lastControlDown).forEach((function(t){t[0];t[1]._onCanvasBlur()})),e.focusedControl=null,e._lastControlDown={}}))},e.prototype.serializeContent=function(){var t=this.getSize(),e={root:{},width:t.width,height:t.height};return this._rootContainer.serialize(e.root),e},e.prototype.parseContent=function(t,e){if(this._rootContainer=g.Parse(t.root,this),e){var i=t.width,n=t.height;"number"==typeof i&&"number"==typeof n&&i>=0&&n>=0?this.scaleTo(i,n):this.scaleTo(1920,1080)}},e.prototype.parseFromSnippetAsync=function(t,i){var n=this;return"_BLANK"===t?Promise.resolve():new Promise((function(o,r){var a=new l.WebRequest;a.addEventListener("readystatechange",(function(){if(4==a.readyState)if(200==a.status){var e=JSON.parse(JSON.parse(a.responseText).jsonPayload),s=JSON.parse(e.gui);n.parseContent(s,i),n.snippetId=t,o()}else r("Unable to load the snippet "+t)})),a.open("GET",e.SnippetUrl+"/"+t.replace(/#/g,"/")),a.send()}))},e.prototype.parseFromURLAsync=function(t,e){var i=this;return""===t?Promise.resolve():new Promise((function(n,o){var r=new l.WebRequest;r.addEventListener("readystatechange",(function(){if(4==r.readyState)if(200==r.status){var t=r.responseText,a=JSON.parse(t);i.parseContent(a,e),n()}else o("Unable to load")})),r.open("GET",t),r.send()}))},e._Overlaps=function(t,e){return!(t.centerX>e.centerX+e.widthInPixels||t.centerX+t.widthInPixelse.centerY+e.heightInPixels)},e.CreateForMesh=function(t,i,n,o,r,a,s){void 0===i&&(i=1024),void 0===n&&(n=1024),void 0===o&&(o=!0),void 0===r&&(r=!1),void 0===s&&(s=this._CreateMaterial);var _=Object(l.RandomGUID)(),h=new e("AdvancedDynamicTexture for ".concat(t.name," [").concat(_,"]"),i,n,t.getScene(),!0,l.Texture.TRILINEAR_SAMPLINGMODE,a);return s(t,_,h,r),h.attachToMesh(t,o),h},e._CreateMaterial=function(t,e,i,n){var o=Object(l.GetClass)("BABYLON.StandardMaterial");if(!o)throw"StandardMaterial needs to be imported before as it contains a side-effect required by your code.";var r=new o("AdvancedDynamicTextureMaterial for ".concat(t.name," [").concat(e,"]"),t.getScene());r.backFaceCulling=!1,r.diffuseColor=l.Color3.Black(),r.specularColor=l.Color3.Black(),n?(r.diffuseTexture=i,r.emissiveTexture=i,i.hasAlpha=!0):(r.emissiveTexture=i,r.opacityTexture=i),t.material=r},e.CreateForMeshTexture=function(t,i,n,o,r){void 0===i&&(i=1024),void 0===n&&(n=1024),void 0===o&&(o=!0);var a=new e(t.name+" AdvancedDynamicTexture",i,n,t.getScene(),!0,l.Texture.TRILINEAR_SAMPLINGMODE,r);return a.attachToMesh(t,o),a},e.CreateFullscreenUI=function(t,i,n,o,r){void 0===i&&(i=!0),void 0===n&&(n=null),void 0===o&&(o=l.Texture.BILINEAR_SAMPLINGMODE),void 0===r&&(r=!1);var a=new e(t,0,0,n,!1,o),s=a.getScene(),_=new l.Layer(t+"_layer",null,s,!i);if(_.texture=a,a._layerToDispose=_,a._isFullscreen=!0,r&&s){var h=1/s.getEngine().getHardwareScalingLevel();a._rootContainer.scaleX=h,a._rootContainer.scaleY=h}return a.attach(),a},e.prototype.scale=function(e){t.prototype.scale.call(this,e),this.markAsDirty()},e.prototype.scaleTo=function(e,i){t.prototype.scaleTo.call(this,e,i),this.markAsDirty()},e.SnippetUrl="https://snippet.babylonjs.com",e.AllowGPUOptimizations=!0,e}(l.DynamicTexture),it=function(){function t(t){this.texture=t,this._captureRenderTime=!1,this._renderTime=new l.PerfCounter,this._captureLayoutTime=!1,this._layoutTime=new l.PerfCounter,this._onBeginRenderObserver=null,this._onEndRenderObserver=null,this._onBeginLayoutObserver=null,this._onEndLayoutObserver=null}return Object.defineProperty(t.prototype,"renderTimeCounter",{get:function(){return this._renderTime},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layoutTimeCounter",{get:function(){return this._layoutTime},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"captureRenderTime",{get:function(){return this._captureRenderTime},set:function(t){var e=this;t!==this._captureRenderTime&&(this._captureRenderTime=t,t?(this._onBeginRenderObserver=this.texture.onBeginRenderObservable.add((function(){e._renderTime.beginMonitoring()})),this._onEndRenderObserver=this.texture.onEndRenderObservable.add((function(){e._renderTime.endMonitoring(!0)}))):(this.texture.onBeginRenderObservable.remove(this._onBeginRenderObserver),this._onBeginRenderObserver=null,this.texture.onEndRenderObservable.remove(this._onEndRenderObserver),this._onEndRenderObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"captureLayoutTime",{get:function(){return this._captureLayoutTime},set:function(t){var e=this;t!==this._captureLayoutTime&&(this._captureLayoutTime=t,t?(this._onBeginLayoutObserver=this.texture.onBeginLayoutObservable.add((function(){e._layoutTime.beginMonitoring()})),this._onEndLayoutObserver=this.texture.onEndLayoutObservable.add((function(){e._layoutTime.endMonitoring(!0)}))):(this.texture.onBeginLayoutObservable.remove(this._onBeginLayoutObserver),this._onBeginLayoutObserver=null,this.texture.onEndLayoutObservable.remove(this._onEndLayoutObserver),this._onEndLayoutObserver=null))},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.texture.onBeginRenderObservable.remove(this._onBeginRenderObserver),this._onBeginRenderObserver=null,this.texture.onEndRenderObservable.remove(this._onEndRenderObserver),this._onEndRenderObserver=null,this.texture.onBeginLayoutObservable.remove(this._onBeginLayoutObserver),this._onBeginLayoutObserver=null,this.texture.onEndLayoutObservable.remove(this._onEndLayoutObserver),this._onEndLayoutObserver=null,this.texture=null},t}(),nt="XmlLoader Exception : XML file is malformed or corrupted.",ot=function(){function t(t){void 0===t&&(t=null),this._nodes={},this._nodeTypes={element:1,attribute:2,text:3},this._isLoaded=!1,this._objectAttributes={textHorizontalAlignment:1,textVerticalAlignment:2,horizontalAlignment:3,verticalAlignment:4,stretch:5},t&&(this._parentClass=t)}return t.prototype._getChainElement=function(t){var e=window;this._parentClass&&(e=this._parentClass);var i=t;i=i.split(".");for(var n=0;n0&&c>u)throw"XmlLoader Exception : In the Grid element, the number of columns is defined in the first row, do not add more columns in the subsequent rows.";if(0==h){if(!r[f].attributes.getNamedItem("width"))throw"XmlLoader Exception : Width must be defined for all the grid columns in the first row";n=Number(r[f].attributes.getNamedItem("width").nodeValue),_=!!r[f].attributes.getNamedItem("isPixel")&&JSON.parse(r[f].attributes.getNamedItem("isPixel").nodeValue),e.addColumnDefinition(n,_)}a=r[f].children;for(var p=0;p1)&&(this.onPointerEnterObservable.notifyObservers(this,-1,t,this),this.pointerEnterAnimation&&this.pointerEnterAnimation(),!0)},t.prototype._onPointerOut=function(t){this._enterCount--,this._enterCount>0||(this._enterCount=0,this.onPointerOutObservable.notifyObservers(this,-1,t,this),this.pointerOutAnimation&&this.pointerOutAnimation())},t.prototype._onPointerDown=function(t,e,i,n){return this._downCount++,this._downPointerIds[i]=this._downPointerIds[i]+1||1,1===this._downCount&&(this.onPointerDownObservable.notifyObservers(new rt(e,n),-1,t,this),this.pointerDownAnimation&&this.pointerDownAnimation(),!0)},t.prototype._onPointerUp=function(t,e,i,n,o){this._downCount--,this._downPointerIds[i]--,this._downPointerIds[i]<=0&&delete this._downPointerIds[i],this._downCount<0?this._downCount=0:0==this._downCount&&(o&&(this._enterCount>0||-1===this._enterCount)&&this.onPointerClickObservable.notifyObservers(new rt(e,n),-1,t,this),this.onPointerUpObservable.notifyObservers(new rt(e,n),-1,t,this),this.pointerUpAnimation&&this.pointerUpAnimation())},t.prototype.forcePointerUp=function(t){if(void 0===t&&(t=null),null!==t)this._onPointerUp(this,l.Vector3.Zero(),t,0,!0);else{for(var e in this._downPointerIds)this._onPointerUp(this,l.Vector3.Zero(),+e,0,!0);this._downCount>0&&(this._downCount=1,this._onPointerUp(this,l.Vector3.Zero(),0,0,!0))}},t.prototype._processObservables=function(t,e,i,n,o){if(this._IsTouchButton3D(this)&&i&&(t=this._generatePointerEventType(t,i,this._downCount)),t===l.PointerEventTypes.POINTERMOVE){this._onPointerMove(this,e);var r=this._host._lastControlOver[n];return r&&r!==this&&r._onPointerOut(this),r!==this&&this._onPointerEnter(this),this._host._lastControlOver[n]=this,!0}return t===l.PointerEventTypes.POINTERDOWN?(this._onPointerDown(this,e,n,o),this._host._lastControlDown[n]=this,this._host._lastPickedControl=this,!0):(t===l.PointerEventTypes.POINTERUP||t===l.PointerEventTypes.POINTERDOUBLETAP)&&(this._host._lastControlDown[n]&&this._host._lastControlDown[n]._onPointerUp(this,e,n,o,!0),delete this._host._lastControlDown[n],!0)},t.prototype._disposeNode=function(){this._node&&(this._node.dispose(),this._node=null)},t.prototype.dispose=function(){this.onPointerDownObservable.clear(),this.onPointerEnterObservable.clear(),this.onPointerMoveObservable.clear(),this.onPointerOutObservable.clear(),this.onPointerUpObservable.clear(),this.onPointerClickObservable.clear(),this._disposeNode();for(var t=0,e=this._behaviors;ti));p++);else for(p=0;pi));f++);d=0;for(var b=0,g=this._children;b0,o.BORDER=this.renderBorders,o.HOVERLIGHT=this.renderHoverLight,this._albedoTexture){if(!this._albedoTexture.isReadyOrNotBlocking())return!1;o.TEXTURE=!0}else o.TEXTURE=!1;var r=n.getEngine();if(o.isDirty){o.markAsProcessed(),n.resetCachedMaterial();var a=[l.VertexBuffer.PositionKind];a.push(l.VertexBuffer.NormalKind),a.push(l.VertexBuffer.UVKind);var s=["world","viewProjection","innerGlowColor","albedoColor","borderWidth","edgeSmoothingValue","scaleFactor","borderMinValue","hoverColor","hoverPosition","hoverRadius","textureMatrix"],_=["albedoSampler"],h=new Array;l.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:s,uniformBuffersNames:h,samplers:_,defines:o,maxSimultaneousLights:4});var c=o.toString();e.setEffect(n.getEngine().createEffect("fluent",{attributes:a,uniformsNames:s,uniformBuffersNames:h,samplers:_,defines:c,fallbacks:null,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},r),o,this._materialContext)}return!(!e.effect||!e.effect.isReady())&&(o._renderId=n.getRenderId(),e.effect._wasPreviouslyReady=!0,!0)},e.prototype.bindForSubMesh=function(t,e,i){var n=this.getScene(),o=i.materialDefines;if(o){var r=i.effect;if(r){if(this._activeEffect=r,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),this._mustRebind(n,r)&&(this._activeEffect.setColor4("albedoColor",this.albedoColor,this.alpha),o.INNERGLOW&&this._activeEffect.setColor4("innerGlowColor",this.innerGlowColor,this.innerGlowColorIntensity),o.BORDER&&(this._activeEffect.setFloat("borderWidth",this.borderWidth),this._activeEffect.setFloat("edgeSmoothingValue",this.edgeSmoothingValue),this._activeEffect.setFloat("borderMinValue",this.borderMinValue),e.getBoundingInfo().boundingBox.extendSize.multiplyToRef(e.scaling,l.TmpVectors.Vector3[0]),this._activeEffect.setVector3("scaleFactor",l.TmpVectors.Vector3[0])),o.HOVERLIGHT&&(this._activeEffect.setDirectColor4("hoverColor",this.hoverColor),this._activeEffect.setFloat("hoverRadius",this.hoverRadius),this._activeEffect.setVector3("hoverPosition",this.hoverPosition)),o.TEXTURE&&this._albedoTexture)){this._activeEffect.setTexture("albedoSampler",this._albedoTexture);var a=this._albedoTexture.getTextureMatrix();this._activeEffect.setMatrix("textureMatrix",a)}this._afterBind(e,this._activeEffect)}}},e.prototype.getActiveTextures=function(){return t.prototype.getActiveTextures.call(this)},e.prototype.hasTexture=function(e){return!!t.prototype.hasTexture.call(this,e)},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e)},e.prototype.clone=function(t){var i=this;return l.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return e.customType="BABYLON.GUI.FluentMaterial",e},e.prototype.getClassName=function(){return"FluentMaterial"},e.Parse=function(t,i,n){return l.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,n)},r([Object(l.serialize)(),Object(l.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"innerGlowColorIntensity",void 0),r([Object(l.serializeAsColor3)()],e.prototype,"innerGlowColor",void 0),r([Object(l.serializeAsColor3)()],e.prototype,"albedoColor",void 0),r([Object(l.serialize)(),Object(l.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"renderBorders",void 0),r([Object(l.serialize)()],e.prototype,"borderWidth",void 0),r([Object(l.serialize)()],e.prototype,"edgeSmoothingValue",void 0),r([Object(l.serialize)()],e.prototype,"borderMinValue",void 0),r([Object(l.serialize)(),Object(l.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"renderHoverLight",void 0),r([Object(l.serialize)()],e.prototype,"hoverRadius",void 0),r([Object(l.serializeAsColor4)()],e.prototype,"hoverColor",void 0),r([Object(l.serializeAsVector3)()],e.prototype,"hoverPosition",void 0),r([Object(l.serializeAsTexture)("albedoTexture")],e.prototype,"_albedoTexture",void 0),r([Object(l.expandToProperty)("_markAllSubMeshesAsTexturesAndMiscDirty")],e.prototype,"albedoTexture",void 0),e}(l.PushMaterial);Object(l.RegisterClass)("BABYLON.GUI.FluentMaterial",bt);var gt=function(t){function e(e,i){void 0===i&&(i=!0);var n=t.call(this,e)||this;return n._shareMaterials=!0,n._shareMaterials=i,n.pointerEnterAnimation=function(){n.mesh&&n._frontPlate.setEnabled(!0)},n.pointerOutAnimation=function(){n.mesh&&n._frontPlate.setEnabled(!1)},n}return o(e,t),e.prototype._disposeTooltip=function(){this._tooltipFade=null,this._tooltipTextBlock&&this._tooltipTextBlock.dispose(),this._tooltipTexture&&this._tooltipTexture.dispose(),this._tooltipMesh&&this._tooltipMesh.dispose(),this.onPointerEnterObservable.remove(this._tooltipHoverObserver),this.onPointerOutObservable.remove(this._tooltipOutObserver)},Object.defineProperty(e.prototype,"renderingGroupId",{get:function(){return this._backPlate.renderingGroupId},set:function(t){this._backPlate.renderingGroupId=t,this._textPlate.renderingGroupId=t,this._frontPlate.renderingGroupId=t,this._tooltipMesh&&(this._tooltipMesh.renderingGroupId=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tooltipText",{get:function(){return this._tooltipTextBlock?this._tooltipTextBlock.text:null},set:function(t){var e=this;if(t){if(!this._tooltipFade){var i=this._backPlate._scene.useRightHandedSystem;this._tooltipMesh=Object(l.CreatePlane)("",{size:1},this._backPlate._scene);var n=Object(l.CreatePlane)("",{size:1,sideOrientation:l.Mesh.DOUBLESIDE},this._backPlate._scene),o=new l.StandardMaterial("",this._backPlate._scene);o.diffuseColor=l.Color3.FromHexString("#212121"),n.material=o,n.isPickable=!1,this._tooltipMesh.addChild(n),n.position=l.Vector3.Forward(i).scale(.05),this._tooltipMesh.scaling.y=1/3,this._tooltipMesh.position=l.Vector3.Up().scale(.7).add(l.Vector3.Forward(i).scale(-.15)),this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._backPlate,this._tooltipTexture=et.CreateForMesh(this._tooltipMesh),this._tooltipTextBlock=new x,this._tooltipTextBlock.scaleY=3,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=130,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new l.FadeInOutBehavior,this._tooltipFade.delay=500,this._tooltipMesh.addBehavior(this._tooltipFade),this._tooltipHoverObserver=this.onPointerEnterObservable.add((function(){e._tooltipFade&&e._tooltipFade.fadeIn(!0)})),this._tooltipOutObserver=this.onPointerOutObservable.add((function(){e._tooltipFade&&e._tooltipFade.fadeIn(!1)}))}this._tooltipTextBlock&&(this._tooltipTextBlock.text=t)}else this._disposeTooltip()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"imageUrl",{get:function(){return this._imageUrl},set:function(t){this._imageUrl!==t&&(this._imageUrl=t,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backMaterial",{get:function(){return this._backMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frontMaterial",{get:function(){return this._frontMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"plateMaterial",{get:function(){return this._plateMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shareMaterials",{get:function(){return this._shareMaterials},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"HolographicButton"},e.prototype._rebuildContent=function(){this._disposeFacadeTexture();var t=new B;if(t.isVertical=!0,l.DomManagement.IsDocumentAvailable()&&document.createElement&&this._imageUrl){var e=new P;e.source=this._imageUrl,e.paddingTop="40px",e.height="180px",e.width="100px",e.paddingBottom="40px",t.addControl(e)}if(this._text){var i=new x;i.text=this._text,i.color="white",i.height="30px",i.fontSize=24,t.addControl(i)}this._frontPlate&&(this.content=t)},e.prototype._createNode=function(e){return this._backPlate=Object(l.CreateBox)(this.name+"BackMesh",{width:1,height:1,depth:.08},e),this._frontPlate=Object(l.CreateBox)(this.name+"FrontMesh",{width:1,height:1,depth:.08},e),this._frontPlate.parent=this._backPlate,this._frontPlate.position=l.Vector3.Forward(e.useRightHandedSystem).scale(-.08),this._frontPlate.isPickable=!1,this._frontPlate.setEnabled(!1),this._textPlate=t.prototype._createNode.call(this,e),this._textPlate.parent=this._backPlate,this._textPlate.position=l.Vector3.Forward(e.useRightHandedSystem).scale(-.08),this._textPlate.isPickable=!1,this._backPlate},e.prototype._applyFacade=function(t){this._plateMaterial.emissiveTexture=t,this._plateMaterial.opacityTexture=t},e.prototype._createBackMaterial=function(t){var e=this;this._backMaterial=new bt(this.name+"Back Material",t.getScene()),this._backMaterial.renderHoverLight=!0,this._pickedPointObserver=this._host.onPickedPointChangedObservable.add((function(t){t?(e._backMaterial.hoverPosition=t,e._backMaterial.hoverColor.a=1):e._backMaterial.hoverColor.a=0}))},e.prototype._createFrontMaterial=function(t){this._frontMaterial=new bt(this.name+"Front Material",t.getScene()),this._frontMaterial.innerGlowColorIntensity=0,this._frontMaterial.alpha=.5,this._frontMaterial.renderBorders=!0},e.prototype._createPlateMaterial=function(t){this._plateMaterial=new l.StandardMaterial(this.name+"Plate Material",t.getScene()),this._plateMaterial.specularColor=l.Color3.Black()},e.prototype._affectMaterial=function(t){this._shareMaterials?(this._host._sharedMaterials.backFluentMaterial?this._backMaterial=this._host._sharedMaterials.backFluentMaterial:(this._createBackMaterial(t),this._host._sharedMaterials.backFluentMaterial=this._backMaterial),this._host._sharedMaterials.frontFluentMaterial?this._frontMaterial=this._host._sharedMaterials.frontFluentMaterial:(this._createFrontMaterial(t),this._host._sharedMaterials.frontFluentMaterial=this._frontMaterial)):(this._createBackMaterial(t),this._createFrontMaterial(t)),this._createPlateMaterial(t),this._backPlate.material=this._backMaterial,this._frontPlate.material=this._frontMaterial,this._textPlate.material=this._plateMaterial,this._rebuildContent()},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._disposeTooltip(),this.shareMaterials||(this._backMaterial.dispose(),this._frontMaterial.dispose(),this._plateMaterial.dispose(),this._pickedPointObserver&&(this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver),this._pickedPointObserver=null))},e}(_t),mt="uniform vec3 cameraPosition;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec4 vColor;\nvarying vec4 vExtra1;\nuniform float _Edge_Width_;\nuniform vec4 _Edge_Color_;\nuniform bool _Relative_Width_;\nuniform float _Proximity_Max_Intensity_;\nuniform float _Proximity_Far_Distance_;\nuniform float _Proximity_Near_Radius_;\nuniform float _Proximity_Anisotropy_;\nuniform float _Selection_Fuzz_;\nuniform float _Selected_;\nuniform float _Selection_Fade_;\nuniform float _Selection_Fade_Size_;\nuniform float _Selected_Distance_;\nuniform float _Selected_Fade_Length_;\nuniform bool _Blob_Enable_;\nuniform vec3 _Blob_Position_;\nuniform float _Blob_Intensity_;\nuniform float _Blob_Near_Size_;\nuniform float _Blob_Far_Size_;\nuniform float _Blob_Near_Distance_;\nuniform float _Blob_Far_Distance_;\nuniform float _Blob_Fade_Length_;\nuniform float _Blob_Inner_Fade_;\nuniform float _Blob_Pulse_;\nuniform float _Blob_Fade_;\nuniform sampler2D _Blob_Texture_;\nuniform bool _Blob_Enable_2_;\nuniform vec3 _Blob_Position_2_;\nuniform float _Blob_Near_Size_2_;\nuniform float _Blob_Inner_Fade_2_;\nuniform float _Blob_Pulse_2_;\nuniform float _Blob_Fade_2_;\nuniform vec3 _Active_Face_Dir_;\nuniform vec3 _Active_Face_Up_;\nuniform bool Enable_Fade;\nuniform float _Fade_Width_;\nuniform bool _Smooth_Active_Face_;\nuniform bool _Show_Frame_;\nuniform bool _Use_Blob_Texture_;\nuniform bool Use_Global_Left_Index;\nuniform bool Use_Global_Right_Index;\nuniform vec4 Global_Left_Index_Tip_Position;\nuniform vec4 Global_Right_Index_Tip_Position;\nuniform vec4 Global_Left_Thumb_Tip_Position;\nuniform vec4 Global_Right_Thumb_Tip_Position;\nuniform float Global_Left_Index_Tip_Proximity;\nuniform float Global_Right_Index_Tip_Proximity;\n\nvoid Holo_Edge_Fragment_B35(\nvec4 Edges,\nfloat Edge_Width,\nout float NotEdge)\n{\nvec2 c=vec2(min(Edges.r,Edges.g),min(Edges.b,Edges.a));\nvec2 df=fwidth(c)*Edge_Width;\nvec2 g=clamp(c/df,0.0,1.0);\nNotEdge=g.x*g.y;\n}\n\n\nvoid Blob_Fragment_B39(\nvec2 UV,\nvec3 Blob_Info,\nsampler2D Blob_Texture,\nout vec4 Blob_Color)\n{\nfloat k=dot(UV,UV);\nBlob_Color=Blob_Info.y*texture(Blob_Texture,vec2(vec2(sqrt(k),Blob_Info.x).x,1.0-vec2(sqrt(k),Blob_Info.x).y))*(1.0-clamp(k,0.0,1.0));\n}\n\n\nvec2 FilterStep(vec2 Edge,vec2 X)\n{\n\nvec2 dX=max(fwidth(X),vec2(0.00001,0.00001));\nreturn clamp( (X+dX-max(Edge,X-dX))/(dX*2.0),0.0,1.0);\n}\nvoid Wireframe_Fragment_B59(\nvec3 Widths,\nvec2 UV,\nfloat Proximity,\nvec4 Edge_Color,\nout vec4 Wireframe)\n{\nvec2 c=min(UV,vec2(1.0,1.0)-UV);\nvec2 g=FilterStep(Widths.xy*0.5,c);\nWireframe=(1.0-min(g.x,g.y))*Proximity*Edge_Color;\n}\n\n\nvoid Proximity_B53(\nvec3 Proximity_Center,\nvec3 Proximity_Center_2,\nfloat Proximity_Max_Intensity,\nfloat Proximity_Near_Radius,\nvec3 Position,\nvec3 Show_Selection,\nvec4 Extra1,\nfloat Dist_To_Face,\nfloat Intensity,\nout float Proximity)\n{\nvec2 delta1=Extra1.xy;\nvec2 delta2=Extra1.zw;\nfloat d2=sqrt(min(dot(delta1,delta1),dot(delta2,delta2))+Dist_To_Face*Dist_To_Face);\n\nProximity=Intensity*Proximity_Max_Intensity*(1.0-clamp(d2/Proximity_Near_Radius,0.0,1.0))*(1.0-Show_Selection.x)+Show_Selection.x;\n}\n\n\nvoid To_XYZ_B46(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{\nX=Vec3.x;\nY=Vec3.y;\nZ=Vec3.z;\n}\n\nvoid main()\n{\nfloat NotEdge_Q35;\n#if ENABLE_FADE\nHolo_Edge_Fragment_B35(vColor,_Fade_Width_,NotEdge_Q35);\n#else\nNotEdge_Q35=1.0;\n#endif\n\n\nvec4 Blob_Color_Q39;\nfloat k=dot(vUV,vUV);\nvec2 blobTextureCoord=vec2(vec2(sqrt(k),vTangent.x).x,1.0-vec2(sqrt(k),vTangent.x).y);\nvec4 blobColor=mix(vec4(1.0,1.0,1.0,1.0)*step(1.0-vTangent.x,clamp(sqrt(k)+0.1,0.0,1.0)),texture(_Blob_Texture_,blobTextureCoord),float(_Use_Blob_Texture_));\nBlob_Color_Q39=vTangent.y*blobColor*(1.0-clamp(k,0.0,1.0));\n\nfloat Is_Quad_Q24;\nIs_Quad_Q24=vNormal.z;\n\nvec3 Blob_Position_Q41=mix(_Blob_Position_,Global_Left_Index_Tip_Position.xyz,float(Use_Global_Left_Index));\n\nvec3 Blob_Position_Q42=mix(_Blob_Position_2_,Global_Right_Index_Tip_Position.xyz,float(Use_Global_Right_Index));\nfloat X_Q46;\nfloat Y_Q46;\nfloat Z_Q46;\nTo_XYZ_B46(vBinormal,X_Q46,Y_Q46,Z_Q46);\nfloat Proximity_Q53;\nProximity_B53(Blob_Position_Q41,Blob_Position_Q42,_Proximity_Max_Intensity_,_Proximity_Near_Radius_,vPosition,vBinormal,vExtra1,Y_Q46,Z_Q46,Proximity_Q53);\nvec4 Wireframe_Q59;\nWireframe_Fragment_B59(vNormal,vUV,Proximity_Q53,_Edge_Color_,Wireframe_Q59);\n\nvec4 Wire_Or_Blob_Q23=mix(Wireframe_Q59,Blob_Color_Q39,Is_Quad_Q24);\n\nvec4 Result_Q22;\nResult_Q22=mix(Wire_Or_Blob_Q23,vec4(0.3,0.3,0.3,0.3),float(_Show_Frame_));\n\nvec4 Final_Color_Q37=NotEdge_Q35*Result_Q22;\nvec4 Out_Color=Final_Color_Q37;\nfloat Clip_Threshold=0.0;\nbool To_sRGB=false;\ngl_FragColor=Out_Color;\n}";l.ShaderStore.ShadersStore.fluentButtonPixelShader=mt;var vt="uniform mat4 world;\nuniform mat4 viewProjection;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec3 tangent;\nattribute vec4 color;\nuniform float _Edge_Width_;\nuniform vec4 _Edge_Color_;\nuniform float _Proximity_Max_Intensity_;\nuniform float _Proximity_Far_Distance_;\nuniform float _Proximity_Near_Radius_;\nuniform float _Proximity_Anisotropy_;\nuniform float _Selection_Fuzz_;\nuniform float _Selected_;\nuniform float _Selection_Fade_;\nuniform float _Selection_Fade_Size_;\nuniform float _Selected_Distance_;\nuniform float _Selected_Fade_Length_;\nuniform bool _Blob_Enable_;\nuniform vec3 _Blob_Position_;\nuniform float _Blob_Intensity_;\nuniform float _Blob_Near_Size_;\nuniform float _Blob_Far_Size_;\nuniform float _Blob_Near_Distance_;\nuniform float _Blob_Far_Distance_;\nuniform float _Blob_Fade_Length_;\nuniform float _Blob_Inner_Fade_;\nuniform float _Blob_Pulse_;\nuniform float _Blob_Fade_;\nuniform sampler2D _Blob_Texture_;\nuniform bool _Blob_Enable_2_;\nuniform vec3 _Blob_Position_2_;\nuniform float _Blob_Near_Size_2_;\nuniform float _Blob_Inner_Fade_2_;\nuniform float _Blob_Pulse_2_;\nuniform float _Blob_Fade_2_;\nuniform vec3 _Active_Face_Dir_;\nuniform vec3 _Active_Face_Up_;\nuniform bool _Enable_Fade_;\nuniform float _Fade_Width_;\nuniform bool _Smooth_Active_Face_;\nuniform bool _Show_Frame_;\nuniform bool Use_Global_Left_Index;\nuniform bool Use_Global_Right_Index;\nuniform vec4 Global_Left_Index_Tip_Position;\nuniform vec4 Global_Right_Index_Tip_Position;\nuniform vec4 Global_Left_Thumb_Tip_Position;\nuniform vec4 Global_Right_Thumb_Tip_Position;\nuniform float Global_Left_Index_Tip_Proximity;\nuniform float Global_Right_Index_Tip_Proximity;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec4 vColor;\nvarying vec4 vExtra1;\n\nvoid Blob_Vertex_B47(\nvec3 Position,\nvec3 Normal,\nvec3 Tangent,\nvec3 Bitangent,\nvec3 Blob_Position,\nfloat Intensity,\nfloat Blob_Near_Size,\nfloat Blob_Far_Size,\nfloat Blob_Near_Distance,\nfloat Blob_Far_Distance,\nvec4 Vx_Color,\nvec2 UV,\nvec3 Face_Center,\nvec2 Face_Size,\nvec2 In_UV,\nfloat Blob_Fade_Length,\nfloat Selection_Fade,\nfloat Selection_Fade_Size,\nfloat Inner_Fade,\nvec3 Active_Face_Center,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nfloat Blob_Enabled,\nout vec3 Out_Position,\nout vec2 Out_UV,\nout vec3 Blob_Info)\n{\nfloat blobSize,fadeIn;\nvec3 Hit_Position;\nBlob_Info=vec3(0.0,0.0,0.0);\nfloat Hit_Distance=dot(Blob_Position-Face_Center,Normal);\nHit_Position=Blob_Position-Hit_Distance*Normal;\nfloat absD=abs(Hit_Distance);\nfloat lerpVal=clamp((absD-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);\nfadeIn=1.0-clamp((absD-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);\nfloat innerFade=1.0-clamp(-Hit_Distance/Inner_Fade,0.0,1.0);\n\nfloat farClip=clamp(1.0-step(Blob_Far_Distance+Blob_Fade_Length,absD),0.0,1.0);\nfloat size=mix(Blob_Near_Size,Blob_Far_Size,lerpVal)*farClip;\nblobSize=mix(size,Selection_Fade_Size,Selection_Fade)*innerFade*Blob_Enabled;\nBlob_Info.x=lerpVal*0.5+0.5;\nBlob_Info.y=fadeIn*Intensity*(1.0-Selection_Fade)*Blob_Fade;\nBlob_Info.x*=(1.0-Blob_Pulse);\n\nvec3 delta=Hit_Position-Face_Center;\nvec2 blobCenterXY=vec2(dot(delta,Tangent),dot(delta,Bitangent));\nvec2 quadUVin=2.0*UV-1.0;\nvec2 blobXY=blobCenterXY+quadUVin*blobSize;\n\nvec2 blobClipped=clamp(blobXY,-Face_Size*0.5,Face_Size*0.5);\nvec2 blobUV=(blobClipped-blobCenterXY)/max(blobSize,0.0001)*2.0;\nvec3 blobCorner=Face_Center+blobClipped.x*Tangent+blobClipped.y*Bitangent;\n\nOut_Position=mix(Position,blobCorner,Vx_Color.rrr);\nOut_UV=mix(In_UV,blobUV,Vx_Color.rr);\n}\n\n\nvec2 ProjectProximity(\nvec3 blobPosition,\nvec3 position,\nvec3 center,\nvec3 dir,\nvec3 xdir,\nvec3 ydir,\nout float vdistance\n)\n{\nvec3 delta=blobPosition-position;\nvec2 xy=vec2(dot(delta,xdir),dot(delta,ydir));\nvdistance=abs(dot(delta,dir));\nreturn xy;\n}\nvoid Proximity_Vertex_B66(\nvec3 Blob_Position,\nvec3 Blob_Position_2,\nvec3 Active_Face_Center,\nvec3 Active_Face_Dir,\nvec3 Position,\nfloat Proximity_Far_Distance,\nfloat Relative_Scale,\nfloat Proximity_Anisotropy,\nvec3 Up,\nout vec4 Extra1,\nout float Distance_To_Face,\nout float Intensity)\n{\nvec3 Active_Face_Dir_X=normalize(cross(Active_Face_Dir,Up));\n\nvec3 Active_Face_Dir_Y=cross(Active_Face_Dir,Active_Face_Dir_X);\nfloat distz1,distz2;\nExtra1.xy=ProjectProximity(Blob_Position,Position,Active_Face_Center,Active_Face_Dir,Active_Face_Dir_X*Proximity_Anisotropy,Active_Face_Dir_Y,distz1)/Relative_Scale;\nExtra1.zw=ProjectProximity(Blob_Position_2,Position,Active_Face_Center,Active_Face_Dir,Active_Face_Dir_X*Proximity_Anisotropy,Active_Face_Dir_Y,distz2)/Relative_Scale;\nDistance_To_Face=dot(Active_Face_Dir,Position-Active_Face_Center);\nIntensity=1.0-clamp(min(distz1,distz2)/Proximity_Far_Distance,0.0,1.0);\n}\n\n\nvoid Holo_Edge_Vertex_B44(\nvec3 Incident,\nvec3 Normal,\nvec2 UV,\nvec3 Tangent,\nvec3 Bitangent,\nbool Smooth_Active_Face,\nfloat Active,\nout vec4 Holo_Edges)\n{\nfloat NdotI=dot(Incident,Normal);\nvec2 flip=(UV-vec2(0.5,0.5));\nfloat udot=dot(Incident,Tangent)*flip.x*NdotI;\nfloat uval=1.0-float(udot>0.0);\nfloat vdot=-dot(Incident,Bitangent)*flip.y*NdotI;\nfloat vval=1.0-float(vdot>0.0);\nfloat Smooth_And_Active=step(1.0,float(Smooth_Active_Face && Active>0.0));\nuval=mix(uval,max(1.0,uval),Smooth_And_Active);\nvval=mix(vval,max(1.0,vval),Smooth_And_Active);\nHolo_Edges=vec4(1.0,1.0,1.0,1.0)-vec4(uval*UV.x,uval*(1.0-UV.x),vval*UV.y,vval*(1.0-UV.y));\n}\n\n\nvoid Object_To_World_Pos_B13(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{\nPos_World=(world*vec4(Pos_Object,1.0)).xyz;\n}\n\n\nvoid Choose_Blob_B38(\nvec4 Vx_Color,\nvec3 Position1,\nvec3 Position2,\nbool Blob_Enable_1,\nbool Blob_Enable_2,\nfloat Near_Size_1,\nfloat Near_Size_2,\nfloat Blob_Inner_Fade_1,\nfloat Blob_Inner_Fade_2,\nfloat Blob_Pulse_1,\nfloat Blob_Pulse_2,\nfloat Blob_Fade_1,\nfloat Blob_Fade_2,\nout vec3 Position,\nout float Near_Size,\nout float Inner_Fade,\nout float Blob_Enable,\nout float Fade,\nout float Pulse)\n{\nPosition=Position1*(1.0-Vx_Color.g)+Vx_Color.g*Position2;\nfloat b1=float(Blob_Enable_1);\nfloat b2=float(Blob_Enable_2);\nBlob_Enable=b1+(b2-b1)*Vx_Color.g;\nPulse=Blob_Pulse_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Pulse_2;\nFade=Blob_Fade_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Fade_2;\nNear_Size=Near_Size_1*(1.0-Vx_Color.g)+Vx_Color.g*Near_Size_2;\nInner_Fade=Blob_Inner_Fade_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Inner_Fade_2;\n}\n\n\nvoid Wireframe_Vertex_B51(\nvec3 Position,\nvec3 Normal,\nvec3 Tangent,\nvec3 Bitangent,\nfloat Edge_Width,\nvec2 Face_Size,\nout vec3 Wire_Vx_Pos,\nout vec2 UV,\nout vec2 Widths)\n{\nWidths.xy=Edge_Width/Face_Size;\nfloat x=dot(Position,Tangent);\nfloat y=dot(Position,Bitangent);\nfloat dx=0.5-abs(x);\nfloat newx=(0.5-dx*Widths.x*2.0)*sign(x);\nfloat dy=0.5-abs(y);\nfloat newy=(0.5-dy*Widths.y*2.0)*sign(y);\nWire_Vx_Pos=Normal*0.5+newx*Tangent+newy*Bitangent;\nUV.x=dot(Wire_Vx_Pos,Tangent)+0.5;\nUV.y=dot(Wire_Vx_Pos,Bitangent)+0.5;\n}\n\n\nvec2 ramp2(vec2 start,vec2 end,vec2 x)\n{\nreturn clamp((x-start)/(end-start),vec2(0.0,0.0),vec2(1.0,1.0));\n}\nfloat computeSelection(\nvec3 blobPosition,\nvec3 normal,\nvec3 tangent,\nvec3 bitangent,\nvec3 faceCenter,\nvec2 faceSize,\nfloat selectionFuzz,\nfloat farDistance,\nfloat fadeLength\n)\n{\nvec3 delta=blobPosition-faceCenter;\nfloat absD=abs(dot(delta,normal));\nfloat fadeIn=1.0-clamp((absD-farDistance)/fadeLength,0.0,1.0);\nvec2 blobCenterXY=vec2(dot(delta,tangent),dot(delta,bitangent));\nvec2 innerFace=faceSize*(1.0-selectionFuzz)*0.5;\nvec2 selectPulse=ramp2(-faceSize*0.5,-innerFace,blobCenterXY)-ramp2(innerFace,faceSize*0.5,blobCenterXY);\nreturn selectPulse.x*selectPulse.y*fadeIn;\n}\nvoid Selection_Vertex_B48(\nvec3 Blob_Position,\nvec3 Blob_Position_2,\nvec3 Face_Center,\nvec2 Face_Size,\nvec3 Normal,\nvec3 Tangent,\nvec3 Bitangent,\nfloat Selection_Fuzz,\nfloat Selected,\nfloat Far_Distance,\nfloat Fade_Length,\nvec3 Active_Face_Dir,\nout float Show_Selection)\n{\nfloat select1=computeSelection(Blob_Position,Normal,Tangent,Bitangent,Face_Center,Face_Size,Selection_Fuzz,Far_Distance,Fade_Length);\nfloat select2=computeSelection(Blob_Position_2,Normal,Tangent,Bitangent,Face_Center,Face_Size,Selection_Fuzz,Far_Distance,Fade_Length);\nfloat Active=max(0.0,dot(Active_Face_Dir,Normal));\nShow_Selection=mix(max(select1,select2),1.0,Selected)*Active;\n}\n\n\nvoid Proximity_Visibility_B54(\nfloat Selection,\nvec3 Proximity_Center,\nvec3 Proximity_Center_2,\nfloat Input_Width,\nfloat Proximity_Far_Distance,\nfloat Proximity_Radius,\nvec3 Active_Face_Center,\nvec3 Active_Face_Dir,\nout float Width)\n{\n\nvec3 boxEdges=(world*vec4(vec3(0.5,0.5,0.5),0.0)).xyz;\nfloat boxMaxSize=length(boxEdges);\nfloat d1=dot(Proximity_Center-Active_Face_Center,Active_Face_Dir);\nvec3 blob1=Proximity_Center-d1*Active_Face_Dir;\nfloat d2=dot(Proximity_Center_2-Active_Face_Center,Active_Face_Dir);\nvec3 blob2=Proximity_Center_2-d2*Active_Face_Dir;\n\nvec3 delta1=blob1-Active_Face_Center;\nvec3 delta2=blob2-Active_Face_Center;\nfloat dist1=dot(delta1,delta1);\nfloat dist2=dot(delta2,delta2);\nfloat nearestProxDist=sqrt(min(dist1,dist2));\n\nWidth=Input_Width*(1.0-step(boxMaxSize+Proximity_Radius,nearestProxDist))*(1.0-step(Proximity_Far_Distance,min(d1,d2))*(1.0-step(0.0001,Selection)));\n}\n\n\nvoid Object_To_World_Dir_B67(\nvec3 Dir_Object,\nout vec3 Dir_World)\n{\nDir_World=(world*vec4(Dir_Object,0.0)).xyz;\n}\n\nvoid main()\n{\n\nvec3 Active_Face_Center_Q49;\nActive_Face_Center_Q49=(world*vec4(_Active_Face_Dir_*0.5,1.0)).xyz;\n\nvec3 Blob_Position_Q41=mix(_Blob_Position_,Global_Left_Index_Tip_Position.xyz,float(Use_Global_Left_Index));\n\nvec3 Blob_Position_Q42=mix(_Blob_Position_2_,Global_Right_Index_Tip_Position.xyz,float(Use_Global_Right_Index));\n\nvec3 Active_Face_Dir_Q64=normalize((world*vec4(_Active_Face_Dir_,0.0)).xyz);\n\nfloat Relative_Scale_Q57;\n#if RELATIVE_WIDTH\nRelative_Scale_Q57=length((world*vec4(vec3(0,1,0),0.0)).xyz);\n#else\nRelative_Scale_Q57=1.0;\n#endif\n\nvec3 Tangent_World_Q30;\nTangent_World_Q30=(world*vec4(tangent,0.0)).xyz;\n\nvec3 Binormal_World_Q31;\nBinormal_World_Q31=(world*vec4((cross(normal,tangent)),0.0)).xyz;\n\nvec3 Normal_World_Q60;\nNormal_World_Q60=(world*vec4(normal,0.0)).xyz;\n\nvec3 Result_Q18=0.5*normal;\nvec3 Dir_World_Q67;\nObject_To_World_Dir_B67(_Active_Face_Up_,Dir_World_Q67);\n\nfloat Product_Q56=_Edge_Width_*Relative_Scale_Q57;\n\nvec3 Normal_World_N_Q29=normalize(Normal_World_Q60);\n\nvec3 Tangent_World_N_Q28=normalize(Tangent_World_Q30);\n\nvec3 Binormal_World_N_Q32=normalize(Binormal_World_Q31);\nvec3 Position_Q38;\nfloat Near_Size_Q38;\nfloat Inner_Fade_Q38;\nfloat Blob_Enable_Q38;\nfloat Fade_Q38;\nfloat Pulse_Q38;\nChoose_Blob_B38(color,Blob_Position_Q41,Blob_Position_Q42,_Blob_Enable_,_Blob_Enable_2_,_Blob_Near_Size_,_Blob_Near_Size_2_,_Blob_Inner_Fade_,_Blob_Inner_Fade_2_,_Blob_Pulse_,_Blob_Pulse_2_,_Blob_Fade_,_Blob_Fade_2_,Position_Q38,Near_Size_Q38,Inner_Fade_Q38,Blob_Enable_Q38,Fade_Q38,Pulse_Q38);\n\nvec3 Face_Center_Q33;\nFace_Center_Q33=(world*vec4(Result_Q18,1.0)).xyz;\n\nvec2 Face_Size_Q50=vec2(length(Tangent_World_Q30),length(Binormal_World_Q31));\nfloat Show_Selection_Q48;\nSelection_Vertex_B48(Blob_Position_Q41,Blob_Position_Q42,Face_Center_Q33,Face_Size_Q50,Normal_World_N_Q29,Tangent_World_N_Q28,Binormal_World_N_Q32,_Selection_Fuzz_,_Selected_,_Selected_Distance_,_Selected_Fade_Length_,Active_Face_Dir_Q64,Show_Selection_Q48);\n\nvec3 Normalized_Q72=normalize(Dir_World_Q67);\n\nfloat Active_Q34=max(0.0,dot(Active_Face_Dir_Q64,Normal_World_N_Q29));\nfloat Width_Q54;\nProximity_Visibility_B54(Show_Selection_Q48,Blob_Position_Q41,Blob_Position_Q42,Product_Q56,_Proximity_Far_Distance_,_Proximity_Near_Radius_,Active_Face_Center_Q49,Active_Face_Dir_Q64,Width_Q54);\nvec3 Wire_Vx_Pos_Q51;\nvec2 UV_Q51;\nvec2 Widths_Q51;\nWireframe_Vertex_B51(position,normal,tangent,(cross(normal,tangent)),Width_Q54,Face_Size_Q50,Wire_Vx_Pos_Q51,UV_Q51,Widths_Q51);\n\nvec3 Vec3_Q27=vec3(Widths_Q51.x,Widths_Q51.y,color.r);\nvec3 Pos_World_Q13;\nObject_To_World_Pos_B13(Wire_Vx_Pos_Q51,Pos_World_Q13);\n\nvec3 Incident_Q36=normalize(Pos_World_Q13-cameraPosition);\nvec3 Out_Position_Q47;\nvec2 Out_UV_Q47;\nvec3 Blob_Info_Q47;\nBlob_Vertex_B47(Pos_World_Q13,Normal_World_N_Q29,Tangent_World_N_Q28,Binormal_World_N_Q32,Position_Q38,_Blob_Intensity_,Near_Size_Q38,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,color,uv,Face_Center_Q33,Face_Size_Q50,UV_Q51,_Blob_Fade_Length_,_Selection_Fade_,_Selection_Fade_Size_,Inner_Fade_Q38,Active_Face_Center_Q49,Pulse_Q38,Fade_Q38,Blob_Enable_Q38,Out_Position_Q47,Out_UV_Q47,Blob_Info_Q47);\nvec4 Extra1_Q66;\nfloat Distance_To_Face_Q66;\nfloat Intensity_Q66;\nProximity_Vertex_B66(Blob_Position_Q41,Blob_Position_Q42,Active_Face_Center_Q49,Active_Face_Dir_Q64,Pos_World_Q13,_Proximity_Far_Distance_,Relative_Scale_Q57,_Proximity_Anisotropy_,Normalized_Q72,Extra1_Q66,Distance_To_Face_Q66,Intensity_Q66);\nvec4 Holo_Edges_Q44;\nHolo_Edge_Vertex_B44(Incident_Q36,Normal_World_N_Q29,uv,Tangent_World_Q30,Binormal_World_Q31,_Smooth_Active_Face_,Active_Q34,Holo_Edges_Q44);\n\nvec3 Vec3_Q19=vec3(Show_Selection_Q48,Distance_To_Face_Q66,Intensity_Q66);\nvec3 Position=Out_Position_Q47;\nvec2 UV=Out_UV_Q47;\nvec3 Tangent=Blob_Info_Q47;\nvec3 Binormal=Vec3_Q19;\nvec3 Normal=Vec3_Q27;\nvec4 Extra1=Extra1_Q66;\nvec4 Color=Holo_Edges_Q44;\ngl_Position=viewProjection*vec4(Position,1);\nvPosition=Position;\nvNormal=Normal;\nvUV=UV;\nvTangent=Tangent;\nvBinormal=Binormal;\nvColor=Color;\nvExtra1=Extra1;\n}";l.ShaderStore.ShadersStore.fluentButtonVertexShader=vt;var yt=function(t){function e(){var e=t.call(this)||this;return e.RELATIVE_WIDTH=!0,e.ENABLE_FADE=!0,e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return o(e,t),e}(l.MaterialDefines),xt=function(t){function e(i,n){var o=t.call(this,i,n)||this;return o.edgeWidth=.04,o.edgeColor=new l.Color4(.592157,.592157,.592157,1),o.proximityMaxIntensity=.45,o.proximityFarDistance=.16,o.proximityNearRadius=1.5,o.proximityAnisotropy=1,o.selectionFuzz=.5,o.selected=0,o.selectionFade=0,o.selectionFadeSize=.3,o.selectedDistance=.08,o.selectedFadeLength=.08,o.blobIntensity=.5,o.blobFarSize=.05,o.blobNearDistance=0,o.blobFarDistance=.08,o.blobFadeLength=.08,o.leftBlobEnable=!0,o.leftBlobNearSize=.025,o.leftBlobPulse=0,o.leftBlobFade=1,o.leftBlobInnerFade=.01,o.rightBlobEnable=!0,o.rightBlobNearSize=.025,o.rightBlobPulse=0,o.rightBlobFade=1,o.rightBlobInnerFade=.01,o.activeFaceDir=new l.Vector3(0,0,-1),o.activeFaceUp=new l.Vector3(0,1,0),o.enableFade=!0,o.fadeWidth=1.5,o.smoothActiveFace=!0,o.showFrame=!1,o.useBlobTexture=!0,o.globalLeftIndexTipPosition=l.Vector3.Zero(),o.globalRightIndexTipPosition=l.Vector3.Zero(),o.alphaMode=l.Constants.ALPHA_ADD,o.disableDepthWrite=!0,o.backFaceCulling=!1,o._blobTexture=new l.Texture(e.BLOB_TEXTURE_URL,o.getScene(),!0,!1,l.Texture.NEAREST_SAMPLINGMODE),o}return o(e,t),e.prototype.needAlphaBlending=function(){return!0},e.prototype.needAlphaTesting=function(){return!0},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e,i){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new yt);var n=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var r=o.getEngine();if(l.MaterialHelper.PrepareDefinesForAttributes(t,n,!0,!1),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var a=new l.EffectFallbacks;n.FOG&&a.addFallback(1,"FOG"),l.MaterialHelper.HandleFallbacksForShadows(n,a),n.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var s=[l.VertexBuffer.PositionKind];n.NORMAL&&s.push(l.VertexBuffer.NormalKind),n.UV1&&s.push(l.VertexBuffer.UVKind),n.UV2&&s.push(l.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&s.push(l.VertexBuffer.ColorKind),n.TANGENT&&s.push(l.VertexBuffer.TangentKind),l.MaterialHelper.PrepareAttributesForInstances(s,n);var _=n.toString(),h=["world","viewProjection","cameraPosition","_Edge_Width_","_Edge_Color_","_Relative_Width_","_Proximity_Max_Intensity_","_Proximity_Far_Distance_","_Proximity_Near_Radius_","_Proximity_Anisotropy_","_Selection_Fuzz_","_Selected_","_Selection_Fade_","_Selection_Fade_Size_","_Selected_Distance_","_Selected_Fade_Length_","_Blob_Enable_","_Blob_Position_","_Blob_Intensity_","_Blob_Near_Size_","_Blob_Far_Size_","_Blob_Near_Distance_","_Blob_Far_Distance_","_Blob_Fade_Length_","_Blob_Inner_Fade_","_Blob_Pulse_","_Blob_Fade_","_Blob_Texture_","_Blob_Enable_2_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Inner_Fade_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Active_Face_Dir_","_Active_Face_Up_","_Enable_Fade_","_Fade_Width_","_Smooth_Active_Face_","_Show_Frame_","_Use_Blob_Texture_","Use_Global_Left_Index","Use_Global_Right_Index","Global_Left_Index_Tip_Position","Global_Right_Index_Tip_Position","Global_Left_Thumb_Tip_Position","Global_Right_Thumb_Tip_Position","Global_Left_Index_Tip_Proximity","Global_Right_Index_Tip_Proximity"],c=["_Blob_Texture_"],u=new Array;l.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:h,uniformBuffersNames:u,samplers:c,defines:n,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("fluentButton",{attributes:s,uniformsNames:h,uniformBuffersNames:u,samplers:c,defines:_,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},r),n,this._materialContext)}return!(!e.effect||!e.effect.isReady())&&(n._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,!0)},e.prototype.bindForSubMesh=function(t,e,i){var n=this.getScene();if(i.materialDefines){var o=i.effect;o&&(this._activeEffect=o,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",n.activeCamera.position),this._activeEffect.setTexture("_Blob_Texture_",this._blobTexture),this._activeEffect.setFloat("_Edge_Width_",this.edgeWidth),this._activeEffect.setColor4("_Edge_Color_",new l.Color3(this.edgeColor.r,this.edgeColor.g,this.edgeColor.b),this.edgeColor.a),this._activeEffect.setFloat("_Proximity_Max_Intensity_",this.proximityMaxIntensity),this._activeEffect.setFloat("_Proximity_Far_Distance_",this.proximityFarDistance),this._activeEffect.setFloat("_Proximity_Near_Radius_",this.proximityNearRadius),this._activeEffect.setFloat("_Proximity_Anisotropy_",this.proximityAnisotropy),this._activeEffect.setFloat("_Selection_Fuzz_",this.selectionFuzz),this._activeEffect.setFloat("_Selected_",this.selected),this._activeEffect.setFloat("_Selection_Fade_",this.selectionFade),this._activeEffect.setFloat("_Selection_Fade_Size_",this.selectionFadeSize),this._activeEffect.setFloat("_Selected_Distance_",this.selectedDistance),this._activeEffect.setFloat("_Selected_Fade_Length_",this.selectedFadeLength),this._activeEffect.setFloat("_Blob_Enable_",this.leftBlobEnable?1:0),this._activeEffect.setFloat("_Blob_Intensity_",this.blobIntensity),this._activeEffect.setFloat("_Blob_Near_Size_",this.leftBlobNearSize),this._activeEffect.setFloat("_Blob_Far_Size_",this.blobFarSize),this._activeEffect.setFloat("_Blob_Near_Distance_",this.blobNearDistance),this._activeEffect.setFloat("_Blob_Far_Distance_",this.blobFarDistance),this._activeEffect.setFloat("_Blob_Fade_Length_",this.blobFadeLength),this._activeEffect.setFloat("_Blob_Inner_Fade_",this.leftBlobInnerFade),this._activeEffect.setFloat("_Blob_Pulse_",this.leftBlobPulse),this._activeEffect.setFloat("_Blob_Fade_",this.leftBlobFade),this._activeEffect.setFloat("_Blob_Enable_2_",this.rightBlobEnable?1:0),this._activeEffect.setFloat("_Blob_Near_Size_2_",this.rightBlobNearSize),this._activeEffect.setFloat("_Blob_Inner_Fade_2_",this.rightBlobInnerFade),this._activeEffect.setFloat("_Blob_Pulse_2_",this.rightBlobPulse),this._activeEffect.setFloat("_Blob_Fade_2_",this.rightBlobFade),this._activeEffect.setVector3("_Active_Face_Dir_",this.activeFaceDir),this._activeEffect.setVector3("_Active_Face_Up_",this.activeFaceUp),this._activeEffect.setFloat("_Fade_Width_",this.fadeWidth),this._activeEffect.setFloat("_Smooth_Active_Face_",this.smoothActiveFace?1:0),this._activeEffect.setFloat("_Show_Frame_",this.showFrame?1:0),this._activeEffect.setFloat("_Use_Blob_Texture_",this.useBlobTexture?1:0),this._activeEffect.setFloat("Use_Global_Left_Index",1),this._activeEffect.setFloat("Use_Global_Right_Index",1),this._activeEffect.setVector4("Global_Left_Index_Tip_Position",new l.Vector4(this.globalLeftIndexTipPosition.x,this.globalLeftIndexTipPosition.y,this.globalLeftIndexTipPosition.z,1)),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",new l.Vector4(this.globalRightIndexTipPosition.x,this.globalRightIndexTipPosition.y,this.globalRightIndexTipPosition.z,1)),this._afterBind(e,this._activeEffect))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e)},e.prototype.clone=function(t){var i=this;return l.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return e.customType="BABYLON.FluentButtonMaterial",e},e.prototype.getClassName=function(){return"FluentButtonMaterial"},e.Parse=function(t,i,n){return l.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,n)},e.BLOB_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-button-blob.png",r([Object(l.serialize)()],e.prototype,"edgeWidth",void 0),r([Object(l.serializeAsColor4)()],e.prototype,"edgeColor",void 0),r([Object(l.serialize)()],e.prototype,"proximityMaxIntensity",void 0),r([Object(l.serialize)()],e.prototype,"proximityFarDistance",void 0),r([Object(l.serialize)()],e.prototype,"proximityNearRadius",void 0),r([Object(l.serialize)()],e.prototype,"proximityAnisotropy",void 0),r([Object(l.serialize)()],e.prototype,"selectionFuzz",void 0),r([Object(l.serialize)()],e.prototype,"selected",void 0),r([Object(l.serialize)()],e.prototype,"selectionFade",void 0),r([Object(l.serialize)()],e.prototype,"selectionFadeSize",void 0),r([Object(l.serialize)()],e.prototype,"selectedDistance",void 0),r([Object(l.serialize)()],e.prototype,"selectedFadeLength",void 0),r([Object(l.serialize)()],e.prototype,"blobIntensity",void 0),r([Object(l.serialize)()],e.prototype,"blobFarSize",void 0),r([Object(l.serialize)()],e.prototype,"blobNearDistance",void 0),r([Object(l.serialize)()],e.prototype,"blobFarDistance",void 0),r([Object(l.serialize)()],e.prototype,"blobFadeLength",void 0),r([Object(l.serialize)()],e.prototype,"leftBlobEnable",void 0),r([Object(l.serialize)()],e.prototype,"leftBlobNearSize",void 0),r([Object(l.serialize)()],e.prototype,"leftBlobPulse",void 0),r([Object(l.serialize)()],e.prototype,"leftBlobFade",void 0),r([Object(l.serialize)()],e.prototype,"leftBlobInnerFade",void 0),r([Object(l.serialize)()],e.prototype,"rightBlobEnable",void 0),r([Object(l.serialize)()],e.prototype,"rightBlobNearSize",void 0),r([Object(l.serialize)()],e.prototype,"rightBlobPulse",void 0),r([Object(l.serialize)()],e.prototype,"rightBlobFade",void 0),r([Object(l.serialize)()],e.prototype,"rightBlobInnerFade",void 0),r([Object(l.serializeAsVector3)()],e.prototype,"activeFaceDir",void 0),r([Object(l.serializeAsVector3)()],e.prototype,"activeFaceUp",void 0),r([Object(l.serialize)()],e.prototype,"enableFade",void 0),r([Object(l.serialize)()],e.prototype,"fadeWidth",void 0),r([Object(l.serialize)()],e.prototype,"smoothActiveFace",void 0),r([Object(l.serialize)()],e.prototype,"showFrame",void 0),r([Object(l.serialize)()],e.prototype,"useBlobTexture",void 0),r([Object(l.serializeAsVector3)()],e.prototype,"globalLeftIndexTipPosition",void 0),r([Object(l.serializeAsVector3)()],e.prototype,"globalRightIndexTipPosition",void 0),e}(l.PushMaterial);Object(l.RegisterClass)("BABYLON.GUI.FluentButtonMaterial",xt);var Pt=function(t){function e(e,i){var n=t.call(this,e)||this;return n._isNearPressed=!1,n._interactionSurfaceHeight=0,n._isToggleButton=!1,n._toggleState=!1,n._toggleButtonCallback=function(){n._onToggle(!n._toggleState)},n.onToggleObservable=new l.Observable,n.collidableFrontDirection=l.Vector3.Zero(),i&&(n.collisionMesh=i),n}return o(e,t),Object.defineProperty(e.prototype,"isActiveNearInteraction",{get:function(){return this._isNearPressed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"collidableFrontDirection",{get:function(){if(this._collisionMesh){var t=l.TmpVectors.Vector3[0];return l.Vector3.TransformNormalToRef(this._collidableFrontDirection,this._collisionMesh.getWorldMatrix(),t),t.normalize()}return this._collidableFrontDirection},set:function(t){if(this._collidableFrontDirection=t.normalize(),this._collisionMesh){var e=l.TmpVectors.Matrix[0];e.copyFrom(this._collisionMesh.getWorldMatrix()),e.invert(),l.Vector3.TransformNormalToRef(this._collidableFrontDirection,e,this._collidableFrontDirection),this._collidableFrontDirection.normalize()}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"collisionMesh",{set:function(t){var e,i=this;this._collisionMesh&&(this._collisionMesh.isNearPickable=!1,(null===(e=this._collisionMesh.reservedDataStore)||void 0===e?void 0:e.GUI3D)&&(this._collisionMesh.reservedDataStore.GUI3D={}),this._collisionMesh.getChildMeshes().forEach((function(t){var e;t.isNearPickable=!1,(null===(e=t.reservedDataStore)||void 0===e?void 0:e.GUI3D)&&(t.reservedDataStore.GUI3D={})}))),this._collisionMesh=t,this._injectGUI3DReservedDataStore(this._collisionMesh).control=this,this._collisionMesh.isNearPickable=!0,this._collisionMesh.getChildMeshes().forEach((function(t){i._injectGUI3DReservedDataStore(t).control=i,t.isNearPickable=!0})),this.collidableFrontDirection=t.forward},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isToggleButton",{get:function(){return this._isToggleButton},set:function(t){t!==this._isToggleButton&&(this._isToggleButton=t,t?this.onPointerUpObservable.add(this._toggleButtonCallback):(this.onPointerUpObservable.removeCallback(this._toggleButtonCallback),this._toggleState&&this._onToggle(!1)))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isToggled",{get:function(){return this._toggleState},set:function(t){this._isToggleButton&&this._toggleState!==t&&this._onToggle(t)},enumerable:!1,configurable:!0}),e.prototype._onToggle=function(t){this._toggleState=t,this.onToggleObservable.notifyObservers(t)},e.prototype._isInteractionInFrontOfButton=function(t){return this._getInteractionHeight(t,this._collisionMesh.getAbsolutePosition())>0},e.prototype.getPressDepth=function(t){if(!this._isNearPressed)return 0;var e=this._getInteractionHeight(t,this._collisionMesh.getAbsolutePosition());return this._interactionSurfaceHeight-e},e.prototype._getInteractionHeight=function(t,e){var i=this.collidableFrontDirection;if(0===i.length())return l.Vector3.Distance(t,e);var n=l.Vector3.Dot(e,i);return l.Vector3.Dot(t,i)-n},e.prototype._generatePointerEventType=function(t,e,i){if(t===l.PointerEventTypes.POINTERDOWN){if(!this._isInteractionInFrontOfButton(e))return l.PointerEventTypes.POINTERMOVE;this._isNearPressed=!0,this._interactionSurfaceHeight=this._getInteractionHeight(e,this._collisionMesh.getAbsolutePosition())}if(t===l.PointerEventTypes.POINTERUP){if(0==i)return l.PointerEventTypes.POINTERMOVE;this._isNearPressed=!1}return t},e.prototype._getTypeName=function(){return"TouchButton3D"},e.prototype._createNode=function(e){return t.prototype._createNode.call(this,e)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onPointerUpObservable.removeCallback(this._toggleButtonCallback),this.onToggleObservable.clear(),this._collisionMesh&&this._collisionMesh.dispose()},e}(_t),Ot=function(t){function e(e,i){void 0===i&&(i=!0);var n=t.call(this,e)||this;return n._shareMaterials=!0,n._isBackplateVisible=!0,n._frontPlateDepth=.5,n._backPlateDepth=.04,n._backplateColor=new l.Color3(.08,.15,.55),n._backplateToggledColor=new l.Color3(.25,.4,.95),n._shareMaterials=i,n.pointerEnterAnimation=function(){n._frontMaterial.leftBlobEnable=!0,n._frontMaterial.rightBlobEnable=!0},n.pointerOutAnimation=function(){n._frontMaterial.leftBlobEnable=!1,n._frontMaterial.rightBlobEnable=!1},n.pointerDownAnimation=function(){n._frontPlate&&!n.isActiveNearInteraction&&(n._frontPlate.scaling.z=.2*n._frontPlateDepth,n._frontPlate.position=l.Vector3.Forward(n._frontPlate._scene.useRightHandedSystem).scale((n._frontPlateDepth-.2*n._frontPlateDepth)/2),n._textPlate.position=l.Vector3.Forward(n._textPlate._scene.useRightHandedSystem).scale(-(n._backPlateDepth+.2*n._frontPlateDepth)/2))},n.pointerUpAnimation=function(){n._frontPlate&&(n._frontPlate.scaling.z=n._frontPlateDepth,n._frontPlate.position=l.Vector3.Forward(n._frontPlate._scene.useRightHandedSystem).scale((n._frontPlateDepth-n._frontPlateDepth)/2),n._textPlate.position=l.Vector3.Forward(n._textPlate._scene.useRightHandedSystem).scale(-(n._backPlateDepth+n._frontPlateDepth)/2))},n.onPointerMoveObservable.add((function(t){if(n._frontPlate&&n.isActiveNearInteraction){var e=l.Vector3.Zero();if(n._backPlate.getWorldMatrix().decompose(e,void 0,void 0)){var i=n._getInteractionHeight(t,n._backPlate.getAbsolutePosition())/e.z;i=l.Scalar.Clamp(i-n._backPlateDepth/2,.2*n._frontPlateDepth,n._frontPlateDepth),n._frontPlate.scaling.z=i,n._frontPlate.position=l.Vector3.Forward(n._frontPlate._scene.useRightHandedSystem).scale((n._frontPlateDepth-i)/2),n._textPlate.position=l.Vector3.Forward(n._textPlate._scene.useRightHandedSystem).scale(-(n._backPlateDepth+i)/2)}}})),n._pointerHoverObserver=n.onPointerMoveObservable.add((function(t){n._frontMaterial.globalLeftIndexTipPosition=t})),n}return o(e,t),e.prototype._disposeTooltip=function(){this._tooltipFade=null,this._tooltipTextBlock&&this._tooltipTextBlock.dispose(),this._tooltipTexture&&this._tooltipTexture.dispose(),this._tooltipMesh&&this._tooltipMesh.dispose(),this.onPointerEnterObservable.remove(this._tooltipHoverObserver),this.onPointerOutObservable.remove(this._tooltipOutObserver)},Object.defineProperty(e.prototype,"renderingGroupId",{get:function(){return this._backPlate.renderingGroupId},set:function(t){this._backPlate.renderingGroupId=t,this._textPlate.renderingGroupId=t,this._frontPlate.renderingGroupId=t,this._tooltipMesh&&(this._tooltipMesh.renderingGroupId=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mesh",{get:function(){return this._backPlate},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tooltipText",{get:function(){return this._tooltipTextBlock?this._tooltipTextBlock.text:null},set:function(t){var e=this;if(t){if(!this._tooltipFade){var i=this._backPlate._scene.useRightHandedSystem;this._tooltipMesh=Object(l.CreatePlane)("",{size:1},this._backPlate._scene);var n=Object(l.CreatePlane)("",{size:1,sideOrientation:l.Mesh.DOUBLESIDE},this._backPlate._scene),o=new l.StandardMaterial("",this._backPlate._scene);o.diffuseColor=l.Color3.FromHexString("#212121"),n.material=o,n.isPickable=!1,this._tooltipMesh.addChild(n),n.position=l.Vector3.Forward(i).scale(.05),this._tooltipMesh.scaling.y=1/3,this._tooltipMesh.position=l.Vector3.Up().scale(.7).add(l.Vector3.Forward(i).scale(-.15)),this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._backPlate,this._tooltipTexture=et.CreateForMesh(this._tooltipMesh),this._tooltipTextBlock=new x,this._tooltipTextBlock.scaleY=3,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=130,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new l.FadeInOutBehavior,this._tooltipFade.delay=500,this._tooltipMesh.addBehavior(this._tooltipFade),this._tooltipHoverObserver=this.onPointerEnterObservable.add((function(){e._tooltipFade&&e._tooltipFade.fadeIn(!0)})),this._tooltipOutObserver=this.onPointerOutObservable.add((function(){e._tooltipFade&&e._tooltipFade.fadeIn(!1)}))}this._tooltipTextBlock&&(this._tooltipTextBlock.text=t)}else this._disposeTooltip()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"imageUrl",{get:function(){return this._imageUrl},set:function(t){this._imageUrl!==t&&(this._imageUrl=t,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backMaterial",{get:function(){return this._backMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frontMaterial",{get:function(){return this._frontMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"plateMaterial",{get:function(){return this._plateMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shareMaterials",{get:function(){return this._shareMaterials},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isBackplateVisible",{set:function(t){this.mesh&&this._backMaterial&&(t&&!this._isBackplateVisible?this._backPlate.visibility=1:!t&&this._isBackplateVisible&&(this._backPlate.visibility=0)),this._isBackplateVisible=t},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"TouchHolographicButton"},e.prototype._rebuildContent=function(){this._disposeFacadeTexture();var t=new B;if(t.isVertical=!0,l.DomManagement.IsDocumentAvailable()&&document.createElement&&this._imageUrl){var e=new P;e.source=this._imageUrl,e.paddingTop="40px",e.height="180px",e.width="100px",e.paddingBottom="40px",t.addControl(e)}if(this._text){var i=new x;i.text=this._text,i.color="white",i.height="30px",i.fontSize=24,t.addControl(i)}this.content=t},e.prototype._createNode=function(i){var n,o=this;this.name=null!==(n=this.name)&&void 0!==n?n:"TouchHolographicButton";var r=Object(l.CreateBox)("".concat(this.name,"_collisionMesh"),{width:1,height:1,depth:this._frontPlateDepth},i);r.isPickable=!0,r.isNearPickable=!0,r.visibility=0,r.position=l.Vector3.Forward(i.useRightHandedSystem).scale(-this._frontPlateDepth/2),l.SceneLoader.ImportMeshAsync(void 0,e.MODEL_BASE_URL,e.MODEL_FILENAME,i).then((function(t){var e=Object(l.CreateBox)("${this.name}_alphaMesh",{width:1,height:1,depth:1},i);e.isPickable=!1,e.material=new l.StandardMaterial("${this.name}_alphaMesh_material",i),e.material.alpha=.15;var n=t.meshes[1];n.name="".concat(o.name,"_frontPlate"),n.isPickable=!1,n.scaling.z=o._frontPlateDepth,e.parent=n,n.parent=r,o._frontMaterial&&(n.material=o._frontMaterial),o._frontPlate=n})),this._backPlate=Object(l.CreateBox)("".concat(this.name,"_backPlate"),{width:1,height:1,depth:this._backPlateDepth},i),this._backPlate.position=l.Vector3.Forward(i.useRightHandedSystem).scale(this._backPlateDepth/2),this._backPlate.isPickable=!1,this._textPlate=t.prototype._createNode.call(this,i),this._textPlate.name="".concat(this.name,"_textPlate"),this._textPlate.isPickable=!1,this._textPlate.position=l.Vector3.Forward(i.useRightHandedSystem).scale(-this._frontPlateDepth/2),this._backPlate.addChild(r),this._backPlate.addChild(this._textPlate);var a=new l.TransformNode("{this.name}_root",i);return this._backPlate.setParent(a),this.collisionMesh=r,this.collidableFrontDirection=this._backPlate.forward.negate(),a},e.prototype._applyFacade=function(t){this._plateMaterial.emissiveTexture=t,this._plateMaterial.opacityTexture=t,this._plateMaterial.diffuseColor=new l.Color3(.4,.4,.4)},e.prototype._createBackMaterial=function(t){this._backMaterial=new bt(this.name+"backPlateMaterial",t.getScene()),this._backMaterial.albedoColor=this._backplateColor,this._backMaterial.renderBorders=!0,this._backMaterial.renderHoverLight=!1},e.prototype._createFrontMaterial=function(t){this._frontMaterial=new xt(this.name+"Front Material",t.getScene())},e.prototype._createPlateMaterial=function(t){this._plateMaterial=new l.StandardMaterial(this.name+"Plate Material",t.getScene()),this._plateMaterial.specularColor=l.Color3.Black()},e.prototype._onToggle=function(e){this._backMaterial&&(this._backMaterial.albedoColor=e?this._backplateToggledColor:this._backplateColor),t.prototype._onToggle.call(this,e)},e.prototype._affectMaterial=function(t){this._shareMaterials?(this._host._touchSharedMaterials.backFluentMaterial?this._backMaterial=this._host._touchSharedMaterials.backFluentMaterial:(this._createBackMaterial(t),this._host._touchSharedMaterials.backFluentMaterial=this._backMaterial),this._host._touchSharedMaterials.frontFluentMaterial?this._frontMaterial=this._host._touchSharedMaterials.frontFluentMaterial:(this._createFrontMaterial(t),this._host._touchSharedMaterials.frontFluentMaterial=this._frontMaterial)):(this._createBackMaterial(t),this._createFrontMaterial(t)),this._createPlateMaterial(t),this._backPlate.material=this._backMaterial,this._textPlate.material=this._plateMaterial,this._isBackplateVisible||(this._backPlate.visibility=0),this._frontPlate&&(this._frontPlate.material=this._frontMaterial),this._rebuildContent()},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._disposeTooltip(),this.onPointerMoveObservable.remove(this._pointerHoverObserver),this.shareMaterials||(this._backMaterial.dispose(),this._frontMaterial.dispose(),this._plateMaterial.dispose(),this._pickedPointObserver&&(this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver),this._pickedPointObserver=null))},e.MODEL_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",e.MODEL_FILENAME="mrtk-fluent-button.glb",e}(Pt),Bt=function(){function t(){this.followBehaviorEnabled=!1,this.sixDofDragBehaviorEnabled=!0,this.surfaceMagnetismBehaviorEnabled=!0,this._followBehavior=new l.FollowBehavior,this._sixDofDragBehavior=new l.SixDofDragBehavior,this._surfaceMagnetismBehavior=new l.SurfaceMagnetismBehavior}return Object.defineProperty(t.prototype,"name",{get:function(){return"Default"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"followBehavior",{get:function(){return this._followBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sixDofDragBehavior",{get:function(){return this._sixDofDragBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"surfaceMagnetismBehavior",{get:function(){return this._surfaceMagnetismBehavior},enumerable:!1,configurable:!0}),t.prototype.init=function(){},t.prototype.attach=function(t,e,i){this._scene=t.getScene(),this.attachedNode=t,this._addObservables(),this._followBehavior.attach(t),this._sixDofDragBehavior.attach(t),this._sixDofDragBehavior.draggableMeshes=e||null,this._sixDofDragBehavior.faceCameraOnDragStart=!0,this._surfaceMagnetismBehavior.attach(t,this._scene),i&&(this._surfaceMagnetismBehavior.meshes=i),this._surfaceMagnetismBehavior.enabled=!1},t.prototype.detach=function(){this.attachedNode=null,this._removeObservables(),this._followBehavior.detach(),this._sixDofDragBehavior.detach(),this._surfaceMagnetismBehavior.detach()},t.prototype._addObservables=function(){var t=this;this._onBeforeRenderObserver=this._scene.onBeforeRenderObservable.add((function(){t._followBehavior._enabled=!t._sixDofDragBehavior.isMoving&&t.followBehaviorEnabled})),this._onDragObserver=this._sixDofDragBehavior.onDragObservable.add((function(e){t._sixDofDragBehavior.disableMovement=t._surfaceMagnetismBehavior.findAndUpdateTarget(e.pickInfo)}))},t.prototype._removeObservables=function(){this._scene.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._sixDofDragBehavior.onDragObservable.remove(this._onDragObserver)},t}(),Ct="precision highp float;\n\nattribute vec3 position;\n\nuniform vec3 positionOffset;\nuniform mat4 worldViewProjection;\nuniform float scale;\nvoid main(void) {\nvec4 vPos=vec4((vec3(position)+positionOffset)*scale,1.0);\ngl_Position=worldViewProjection*vPos;\n}";l.ShaderStore.ShadersStore.handleVertexShader=Ct;var Tt="uniform vec3 color;\nvoid main(void) {\ngl_FragColor=vec4(color,1.0);\n}";l.ShaderStore.ShadersStore.handlePixelShader=Tt;var It,St=function(t){function e(e,i){var n=t.call(this,e,i,"handle",{attributes:["position"],uniforms:["worldViewProjection","color","scale","positionOffset"],needAlphaBlending:!1,needAlphaTesting:!1})||this;return n._hover=!1,n._drag=!1,n._color=new l.Color3,n._scale=1,n._lastTick=-1,n.animationLength=100,n.hoverColor=new l.Color3(0,.467,.84),n.baseColor=new l.Color3(1,1,1),n.hoverScale=.75,n.baseScale=.35,n.dragScale=.55,n._positionOffset=l.Vector3.Zero(),n._updateInterpolationTarget(),n._lastTick=Date.now(),n._onBeforeRender=n.getScene().onBeforeRenderObservable.add((function(){var t=Date.now(),e=t-n._lastTick,i=n._targetScale-n._scale,o=l.TmpColors.Color3[0].copyFrom(n._targetColor).subtractToRef(n._color,l.TmpColors.Color3[0]);n._scale=n._scale+i*e/n.animationLength,o.scaleToRef(e/n.animationLength,o),n._color.addToRef(o,n._color),n.setColor3("color",n._color),n.setFloat("scale",n._scale),n.setVector3("positionOffset",n._positionOffset),n._lastTick=t})),n}return o(e,t),Object.defineProperty(e.prototype,"hover",{get:function(){return this._hover},set:function(t){this._hover=t,this._updateInterpolationTarget()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"drag",{get:function(){return this._drag},set:function(t){this._drag=t,this._updateInterpolationTarget()},enumerable:!1,configurable:!0}),e.prototype._updateInterpolationTarget=function(){this.drag?(this._targetColor=this.hoverColor,this._targetScale=this.dragScale):this.hover?(this._targetColor=this.hoverColor,this._targetScale=this.hoverScale):(this._targetColor=this.baseColor,this._targetScale=this.baseScale)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.getScene().onBeforeRenderObservable.remove(this._onBeforeRender)},e}(l.ShaderMaterial);!function(t){t[t.IDLE=0]="IDLE",t[t.HOVER=1]="HOVER",t[t.DRAG=2]="DRAG"}(It||(It={}));var Rt=function(){function t(t,e){this._state=It.IDLE,this._materials=[],this._scene=e,this._gizmo=t,this.node=this.createNode(),this.node.reservedDataStore={handle:this}}return Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gizmo",{get:function(){return this._gizmo},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hover",{set:function(t){t?this._state|=It.HOVER:this._state&=~It.HOVER,this._updateMaterial()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"drag",{set:function(t){t?this._state|=It.DRAG:this._state&=~It.DRAG,this._updateMaterial()},enumerable:!1,configurable:!0}),t.prototype._createMaterial=function(t){var e=new St("handle",this._scene);return t&&(e._positionOffset=t),e},t.prototype._updateMaterial=function(){for(var t=this._state,e=0,i=this._materials;ei?this.minDimensions.x/t.x:this.minDimensions.y/t.y}this._dimensions.copyFrom(t).scaleInPlace(e),this._updatePivot(),this._positionElements()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"titleBarHeight",{get:function(){return this._titleBarHeight},set:function(t){this._titleBarHeight=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderingGroupId",{get:function(){return this._titleBar.renderingGroupId},set:function(t){this._titleBar.renderingGroupId=t,this._titleBarTitle.renderingGroupId=t,this._contentPlate.renderingGroupId=t,this._backPlate.renderingGroupId=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"title",{get:function(){return this._titleText},set:function(t){this._titleText=t,this._titleTextComponent&&(this._titleTextComponent.text=t)},enumerable:!1,configurable:!0}),e.prototype._applyFacade=function(t){this._contentMaterial.albedoTexture=t,this._resetContentPositionAndZoom(),this._applyContentViewport(),t.attachToMesh(this._contentPlate,!0)},e.prototype._addControl=function(t){t._host=this._host,this._host.utilityLayer&&t._prepareNode(this._host.utilityLayer.utilityLayerScene)},e.prototype._getTypeName=function(){return"HolographicSlate"},e.prototype._positionElements=function(){var t=this._followButton,i=this._closeButton,n=this._titleBar,o=this._titleBarTitle,r=this._contentPlate,a=this._backPlate;if(t&&i&&n){i.scaling.setAll(this.titleBarHeight),t.scaling.setAll(this.titleBarHeight),i.position.copyFromFloats(this.dimensions.x-this.titleBarHeight/2,-this.titleBarHeight/2,0).addInPlace(this.origin),t.position.copyFromFloats(this.dimensions.x-3*this.titleBarHeight/2,-this.titleBarHeight/2,0).addInPlace(this.origin);var s=this.dimensions.y-this.titleBarHeight-this.titleBarMargin,_=r.getScene().useRightHandedSystem;n.scaling.set(this.dimensions.x,this.titleBarHeight,l.Epsilon),o.scaling.set(this.dimensions.x-2*this.titleBarHeight,this.titleBarHeight,l.Epsilon),r.scaling.copyFromFloats(this.dimensions.x,s,l.Epsilon),a.scaling.copyFromFloats(this.dimensions.x,s,l.Epsilon),n.position.copyFromFloats(this.dimensions.x/2,-this.titleBarHeight/2,0).addInPlace(this.origin),o.position.copyFromFloats(this.dimensions.x/2-this.titleBarHeight,-this.titleBarHeight/2,_?l.Epsilon:-l.Epsilon).addInPlace(this.origin),r.position.copyFromFloats(this.dimensions.x/2,-(this.titleBarHeight+this.titleBarMargin+s/2),0).addInPlace(this.origin),a.position.copyFromFloats(this.dimensions.x/2,-(this.titleBarHeight+this.titleBarMargin+s/2),_?-l.Epsilon:l.Epsilon).addInPlace(this.origin),this._titleTextComponent.host.scaleTo(e.DEFAULT_TEXT_RESOLUTION_Y*o.scaling.x/o.scaling.y,e.DEFAULT_TEXT_RESOLUTION_Y);var h=this.dimensions.x/s;this._contentViewport.width=this._contentScaleRatio,this._contentViewport.height=this._contentScaleRatio/h,this._applyContentViewport(),this._gizmo&&this._gizmo.updateBoundingBox()}},e.prototype._applyContentViewport=function(){var t;if((null===(t=this._contentPlate)||void 0===t?void 0:t.material)&&this._contentPlate.material.albedoTexture){var e=this._contentPlate.material.albedoTexture;e.uScale=this._contentScaleRatio,e.vScale=this._contentScaleRatio/this._contentViewport.width*this._contentViewport.height,e.uOffset=this._contentViewport.x,e.vOffset=this._contentViewport.y}},e.prototype._resetContentPositionAndZoom=function(){this._contentViewport.x=0,this._contentViewport.y=1-this._contentViewport.height/this._contentViewport.width,this._contentScaleRatio=1},e.prototype._updatePivot=function(){if(this.mesh){var t=new l.Vector3(.5*this.dimensions.x,.5*-this.dimensions.y,l.Epsilon);t.addInPlace(this.origin),t.z=0;var e=new l.Vector3(0,0,0);l.Vector3.TransformCoordinatesToRef(e,this.mesh.computeWorldMatrix(!0),e),this.mesh.setPivotPoint(t);var i=new l.Vector3(0,0,0);l.Vector3.TransformCoordinatesToRef(i,this.mesh.computeWorldMatrix(!0),i),this.mesh.position.addInPlace(e).subtractInPlace(i)}},e.prototype._createNode=function(t){var i=this,n=new l.Mesh("slate_"+this.name,t);this._titleBar=Object(l.CreateBox)("titleBar_"+this.name,{size:1},t),this._titleBarTitle=Object(l.CreatePlane)("titleText_"+this.name,{size:1},t),this._titleBarTitle.parent=n,this._titleBarTitle.isPickable=!1;var o=et.CreateForMesh(this._titleBarTitle);if(this._titleTextComponent=new x("titleText_"+this.name,this._titleText),this._titleTextComponent.textWrapping=v.Ellipsis,this._titleTextComponent.textHorizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,this._titleTextComponent.color="white",this._titleTextComponent.fontSize=e.DEFAULT_TEXT_RESOLUTION_Y/2,this._titleTextComponent.paddingLeft=e.DEFAULT_TEXT_RESOLUTION_Y/4,o.addControl(this._titleTextComponent),t.useRightHandedSystem){var r=new l.Vector4(0,0,1,1);this._contentPlate=Object(l.CreatePlane)("contentPlate_"+this.name,{size:1,sideOrientation:l.VertexData.BACKSIDE,frontUVs:r},t),this._backPlate=Object(l.CreatePlane)("backPlate_"+this.name,{size:1,sideOrientation:l.VertexData.FRONTSIDE},t)}else{r=new l.Vector4(0,0,1,1);this._contentPlate=Object(l.CreatePlane)("contentPlate_"+this.name,{size:1,sideOrientation:l.VertexData.FRONTSIDE,frontUVs:r},t),this._backPlate=Object(l.CreatePlane)("backPlate_"+this.name,{size:1,sideOrientation:l.VertexData.BACKSIDE},t)}this._titleBar.parent=n,this._titleBar.isNearGrabbable=!0,this._contentPlate.parent=n,this._backPlate.parent=n,this._attachContentPlateBehavior(),this._addControl(this._followButton),this._addControl(this._closeButton);var a=this._followButton,s=this._closeButton;return a.node.parent=n,s.node.parent=n,this._positionElements(),this._followButton.imageUrl=e.ASSETS_BASE_URL+e.FOLLOW_ICON_FILENAME,this._closeButton.imageUrl=e.ASSETS_BASE_URL+e.CLOSE_ICON_FILENAME,this._followButton.isBackplateVisible=!1,this._closeButton.isBackplateVisible=!1,this._followButton.onToggleObservable.add((function(t){i._defaultBehavior.followBehaviorEnabled=t,i._defaultBehavior.followBehaviorEnabled&&i._defaultBehavior.followBehavior.recenter()})),this._closeButton.onPointerClickObservable.add((function(){i.dispose()})),n.rotationQuaternion=l.Quaternion.Identity(),n.isVisible=!1,n},e.prototype._attachContentPlateBehavior=function(){var t=this;this._contentDragBehavior.attach(this._contentPlate),this._contentDragBehavior.moveAttached=!1,this._contentDragBehavior.useObjectOrientationForDragging=!0,this._contentDragBehavior.updateDragPlane=!1;var e,i,n=new l.Vector3,o=new l.Vector3,r=new l.Vector3,a=new l.Vector3,s=new l.Vector2;this._contentDragBehavior.onDragStartObservable.add((function(s){t.node&&(e=t._contentViewport.clone(),i=t.node.computeWorldMatrix(!0),n.copyFrom(s.dragPlanePoint),o.set(t.dimensions.x,t.dimensions.y,l.Epsilon),o.y-=t.titleBarHeight+t.titleBarMargin,l.Vector3.TransformNormalToRef(o,i,o),r.copyFromFloats(0,1,0),l.Vector3.TransformNormalToRef(r,i,r),a.copyFromFloats(1,0,0),l.Vector3.TransformNormalToRef(a,i,a),r.normalize(),r.scaleInPlace(1/l.Vector3.Dot(r,o)),a.normalize(),a.scaleInPlace(1/l.Vector3.Dot(a,o)))}));var _=new l.Vector3;this._contentDragBehavior.onDragObservable.add((function(i){_.copyFrom(i.dragPlanePoint),_.subtractInPlace(n),s.copyFromFloats(l.Vector3.Dot(_,a),l.Vector3.Dot(_,r)),t._contentViewport.x=l.Scalar.Clamp(e.x-_.x,0,1-t._contentViewport.width*t._contentScaleRatio),t._contentViewport.y=l.Scalar.Clamp(e.y-_.y,0,1-t._contentViewport.height*t._contentScaleRatio),t._applyContentViewport()}))},e.prototype._affectMaterial=function(t){this._titleBarMaterial=new Nt("".concat(this.name," plateMaterial"),t.getScene()),this._contentMaterial=new bt("".concat(this.name," contentMaterial"),t.getScene()),this._contentMaterial.renderBorders=!0,this._backMaterial=new Nt("".concat(this.name," backPlate"),t.getScene()),this._backMaterial.lineWidth=l.Epsilon,this._backMaterial.radius=.005,this._backMaterial.backFaceCulling=!0,this._titleBar.material=this._titleBarMaterial,this._contentPlate.material=this._contentMaterial,this._backPlate.material=this._backMaterial,this._resetContent(),this._applyContentViewport()},e.prototype._prepareNode=function(e){var i=this;t.prototype._prepareNode.call(this,e),this._gizmo=new Et(this._host.utilityLayer),this._gizmo.attachedSlate=this,this._defaultBehavior=new Bt,this._defaultBehavior.attach(this.node,[this._titleBar]),this._defaultBehavior.sixDofDragBehavior.onDragStartObservable.add((function(){i._followButton.isToggled=!1})),this._positionChangedObserver=this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.add((function(){i._gizmo.updateBoundingBox()})),this._updatePivot(),this.resetDefaultAspectAndPose(!1)},e.prototype.resetDefaultAspectAndPose=function(t){if(void 0===t&&(t=!0),this._host&&this._host.utilityLayer&&this.node){var e=this._host.utilityLayer.utilityLayerScene,i=e.activeCamera;if(i){var n=i.getWorldMatrix(),o=l.Vector3.TransformNormal(l.Vector3.Backward(e.useRightHandedSystem),n);this.origin.setAll(0),this._gizmo.updateBoundingBox();var r=this.node.getAbsolutePivotPoint();this.node.position.copyFrom(i.position).subtractInPlace(o).subtractInPlace(r),this.node.rotationQuaternion=l.Quaternion.FromLookDirectionLH(o,new l.Vector3(0,1,0)),t&&(this.dimensions=this.defaultDimensions)}}},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._titleBarMaterial.dispose(),this._contentMaterial.dispose(),this._titleBar.dispose(),this._titleBarTitle.dispose(),this._contentPlate.dispose(),this._backPlate.dispose(),this._followButton.dispose(),this._closeButton.dispose(),this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver),this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.remove(this._positionChangedObserver),this._defaultBehavior.detach(),this._gizmo.dispose(),this._contentDragBehavior.detach()},e.ASSETS_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",e.CLOSE_ICON_FILENAME="IconClose.png",e.FOLLOW_ICON_FILENAME="IconFollowMe.png",e.DEFAULT_TEXT_RESOLUTION_Y=102.4,e}(st),At=function(t){function e(e){var i=t.call(this,e)||this;return i._backPlateMargin=1.25,i}return o(e,t),Object.defineProperty(e.prototype,"backPlateMargin",{get:function(){return this._backPlateMargin},set:function(t){var e=this;this._backPlateMargin=t,this._children.length>=1&&(this.children.forEach((function(t){e._updateCurrentMinMax(t.position)})),this._updateMargins())},enumerable:!1,configurable:!0}),e.prototype._createNode=function(t){var e=new l.Mesh("menu_".concat(this.name),t);return this._backPlate=Object(l.CreateBox)("backPlate"+this.name,{size:1},t),this._backPlate.parent=e,e},e.prototype._affectMaterial=function(t){var e=this;this._backPlateMaterial=new bt(this.name+"backPlateMaterial",t.getScene()),this._backPlateMaterial.albedoColor=new l.Color3(.08,.15,.55),this._backPlateMaterial.renderBorders=!0,this._backPlateMaterial.renderHoverLight=!0,this._pickedPointObserver=this._host.onPickedPointChangedObservable.add((function(t){t?(e._backPlateMaterial.hoverPosition=t,e._backPlateMaterial.hoverColor.a=1):e._backPlateMaterial.hoverColor.a=0})),this._backPlate.material=this._backPlateMaterial},e.prototype._mapGridNode=function(t,e){t.mesh&&(t.position=e.clone(),this._updateCurrentMinMax(e))},e.prototype._finalProcessing=function(){this._updateMargins()},e.prototype._updateCurrentMinMax=function(t){this._currentMin||(this._currentMin=t.clone(),this._currentMax=t.clone()),this._currentMin.minimizeInPlace(t),this._currentMax.maximizeInPlace(t)},e.prototype._updateMargins=function(){if(this._children.length>0){this._currentMin.addInPlaceFromFloats(-this._cellWidth/2,-this._cellHeight/2,0),this._currentMax.addInPlaceFromFloats(this._cellWidth/2,this._cellHeight/2,0);var t=this._currentMax.subtract(this._currentMin);this._backPlate.scaling.x=t.x+this._cellWidth*this.backPlateMargin,this._backPlate.scaling.y=t.y+this._cellHeight*this.backPlateMargin,this._backPlate.scaling.z=.001;for(var e=0;en?-1:0}));for(var r=Math.pow(this.margin,2),a=Math.max(this._cellWidth,this._cellHeight),s=l.TmpVectors.Vector2[0],_=l.TmpVectors.Vector3[0],h=0;h0.0) {\nC=mix(H,S,k);\n} else {\nC=mix(H,G,k);\n}\nreturn C;\n}\nvoid Sky_Environment_B50(\nvec3 Normal,\nvec3 Reflected,\nvec4 Sky_Color,\nvec4 Horizon_Color,\nvec4 Ground_Color,\nfloat Horizon_Power,\nout vec4 Reflected_Color,\nout vec4 Indirect_Color)\n{\n\nReflected_Color=SampleEnv_Bid50(Reflected,Sky_Color,Horizon_Color,Ground_Color,Horizon_Power);\nIndirect_Color=mix(Ground_Color,Sky_Color,Normal.y*0.5+0.5);\n}\n\n\nvoid Min_Segment_Distance_B65(\nvec3 P0,\nvec3 P1,\nvec3 Q0,\nvec3 Q1,\nout vec3 NearP,\nout vec3 NearQ,\nout float Distance)\n{\nvec3 u=P1-P0;\nvec3 v=Q1-Q0;\nvec3 w=P0-Q0;\nfloat a=dot(u,u);\nfloat b=dot(u,v);\nfloat c=dot(v,v);\nfloat d=dot(u,w);\nfloat e=dot(v,w);\nfloat D=a*c-b*b;\nfloat sD=D;\nfloat tD=D;\nfloat sc,sN,tc,tN;\nif (D<0.00001) {\nsN=0.0;\nsD=1.0;\ntN=e;\ntD=c;\n} else {\nsN=(b*e-c*d);\ntN=(a*e-b*d);\nif (sN<0.0) {\nsN=0.0;\ntN=e;\ntD=c;\n} else if (sN>sD) {\nsN=sD;\ntN=e+b;\ntD=c;\n}\n}\nif (tN<0.0) {\ntN=0.0;\nif (-d<0.0) {\nsN=0.0;\n} else if (-d>a) {\nsN=sD;\n} else {\nsN=-d;\nsD=a;\n}\n} else if (tN>tD) {\ntN=tD;\nif ((-d+b)<0.0) {\nsN=0.0;\n} else if ((-d+b)>a) {\nsN=sD;\n} else {\nsN=(-d+b);\nsD=a;\n}\n}\nsc=abs(sN)<0.000001 ? 0.0 : sN/sD;\ntc=abs(tN)<0.000001 ? 0.0 : tN/tD;\nNearP=P0+sc*u;\nNearQ=Q0+tc*v;\nDistance=distance(NearP,NearQ);\n}\n\n\nvoid To_XYZ_B74(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{\nX=Vec3.x;\nY=Vec3.y;\nZ=Vec3.z;\n}\n\n\nvoid Finger_Positions_B64(\nvec3 Left_Index_Pos,\nvec3 Right_Index_Pos,\nvec3 Left_Index_Middle_Pos,\nvec3 Right_Index_Middle_Pos,\nout vec3 Left_Index,\nout vec3 Right_Index,\nout vec3 Left_Index_Middle,\nout vec3 Right_Index_Middle)\n{\nLeft_Index=(Use_Global_Left_Index ? Global_Left_Index_Tip_Position.xyz : Left_Index_Pos);\nRight_Index=(Use_Global_Right_Index ? Global_Right_Index_Tip_Position.xyz : Right_Index_Pos);\nLeft_Index_Middle=(Use_Global_Left_Index ? Global_Left_Index_Middle_Position.xyz : Left_Index_Middle_Pos);\nRight_Index_Middle=(Use_Global_Right_Index ? Global_Right_Index_Middle_Position.xyz : Right_Index_Middle_Pos);\n}\n\n\nvoid VaryHSV_B108(\nvec3 HSV_In,\nfloat Hue_Shift,\nfloat Saturation_Shift,\nfloat Value_Shift,\nout vec3 HSV_Out)\n{\nHSV_Out=vec3(fract(HSV_In.x+Hue_Shift),clamp(HSV_In.y+Saturation_Shift,0.0,1.0),clamp(HSV_In.z+Value_Shift,0.0,1.0));\n}\n\n\nvoid Remap_Range_B114(\nfloat In_Min,\nfloat In_Max,\nfloat Out_Min,\nfloat Out_Max,\nfloat In,\nout float Out)\n{\nOut=mix(Out_Min,Out_Max,clamp((In-In_Min)/(In_Max-In_Min),0.0,1.0));\n}\n\n\nvoid To_HSV_B75(\nvec4 Color,\nout float Hue,\nout float Saturation,\nout float Value,\nout float Alpha,\nout vec3 HSV)\n{\n\nvec4 K=vec4(0.0,-1.0/3.0,2.0/3.0,-1.0);\nvec4 p=Color.g0?this.margin:0}}},e}(ht),re=function(t){function e(e,i){var n=t.call(this,i,e)||this;return n._currentMesh=e,n.pointerEnterAnimation=function(){n.mesh&&n.mesh.scaling.scaleInPlace(1.1)},n.pointerOutAnimation=function(){n.mesh&&n.mesh.scaling.scaleInPlace(1/1.1)},n.pointerDownAnimation=function(){n.mesh&&n.mesh.scaling.scaleInPlace(.95)},n.pointerUpAnimation=function(){n.mesh&&n.mesh.scaling.scaleInPlace(1/.95)},n}return o(e,t),e.prototype._getTypeName=function(){return"TouchMeshButton3D"},e.prototype._createNode=function(t){var e=this;return this._currentMesh.getChildMeshes().forEach((function(t){e._injectGUI3DReservedDataStore(t).control=e})),this._currentMesh},e.prototype._affectMaterial=function(t){},e}(Pt),ae=function(t){function e(e,i){void 0===i&&(i=!0);var n=t.call(this,e)||this;return n._shareMaterials=i,n}return o(e,t),Object.defineProperty(e.prototype,"renderingGroupId",{get:function(){return this._model.renderingGroupId},set:function(t){this._model.renderingGroupId=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"material",{get:function(){return this._material},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shareMaterials",{get:function(){return this._shareMaterials},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"HolographicBackplate"},e.prototype._createNode=function(t){var i,n=this,o=Object(l.CreateBox)((null!==(i=this.name)&&void 0!==i?i:"HolographicBackplate")+"_CollisionMesh",{width:1,height:1,depth:1},t);return o.isPickable=!0,o.visibility=0,l.SceneLoader.ImportMeshAsync(void 0,e.MODEL_BASE_URL,e.MODEL_FILENAME,t).then((function(t){var e=t.meshes[1];e.name="".concat(n.name,"_frontPlate"),e.isPickable=!1,e.parent=o,n._material&&(e.material=n._material),n._model=e})),o},e.prototype._createMaterial=function(t){this._material=new Nt(this.name+" Material",t.getScene())},e.prototype._affectMaterial=function(t){this._shareMaterials?this._host._touchSharedMaterials.fluentBackplateMaterial?this._material=this._host._touchSharedMaterials.fluentBackplateMaterial:(this._createMaterial(t),this._host._touchSharedMaterials.fluentBackplateMaterial=this._material):this._createMaterial(t)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.shareMaterials||this._material.dispose(),this._model.dispose()},e.MODEL_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",e.MODEL_FILENAME="mrtk-fluent-backplate.glb",e}(at),se=function(){function t(t){var e=this;this._customControlScaling=1,this._lastControlOver={},this._lastControlDown={},this.onPickedPointChangedObservable=new l.Observable,this.onPickingObservable=new l.Observable,this._sharedMaterials={},this._touchSharedMaterials={},this._scene=t||l.EngineStore.LastCreatedScene,this._sceneDisposeObserver=this._scene.onDisposeObservable.add((function(){e._sceneDisposeObserver=null,e._utilityLayer=null,e.dispose()})),this._utilityLayer=l.UtilityLayerRenderer._CreateDefaultUtilityLayerFromScene(this._scene),this._utilityLayer.onlyCheckPointerDownEvents=!1,this._utilityLayer.pickUtilitySceneFirst=!1,this._utilityLayer.mainSceneTrackerPredicate=function(t){var e,i,n;return t&&(null===(n=null===(i=null===(e=t.reservedDataStore)||void 0===e?void 0:e.GUI3D)||void 0===i?void 0:i.control)||void 0===n?void 0:n._node)},this._rootContainer=new ht("RootContainer"),this._rootContainer._host=this;var i=this._utilityLayer.utilityLayerScene;this._pointerOutObserver=this._utilityLayer.onPointerOutObservable.add((function(t){e._handlePointerOut(t,!0)})),this._pointerObserver=i.onPointerObservable.add((function(t,i){e._doPicking(t)})),this._utilityLayer.utilityLayerScene.autoClear=!1,this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil=!1,new l.HemisphericLight("hemi",l.Vector3.Up(),this._utilityLayer.utilityLayerScene)}return Object.defineProperty(t.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"utilityLayer",{get:function(){return this._utilityLayer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"controlScaling",{get:function(){return this._customControlScaling},set:function(t){if(this._customControlScaling!==t&&t>0){var e=t/this._customControlScaling;this._customControlScaling=t,this._rootContainer.children.forEach((function(i){i.scaling.scaleInPlace(e),1!==t&&(i._isScaledByManager=!0)}))}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useRealisticScaling",{get:function(){return this.controlScaling===t.MRTK_REALISTIC_SCALING},set:function(e){this.controlScaling=e?t.MRTK_REALISTIC_SCALING:1},enumerable:!1,configurable:!0}),t.prototype._handlePointerOut=function(t,e){var i=this._lastControlOver[t];i&&(i._onPointerOut(i),delete this._lastControlOver[t]),e&&this._lastControlDown[t]&&(this._lastControlDown[t].forcePointerUp(),delete this._lastControlDown[t]),this.onPickedPointChangedObservable.notifyObservers(null)},t.prototype._doPicking=function(t){var e,i,n;if(!this._utilityLayer||!this._utilityLayer.shouldRender||!this._utilityLayer.utilityLayerScene.activeCamera)return!1;var o=t.event,r=o.pointerId||0,a=o.button,s=t.pickInfo;if(s&&this.onPickingObservable.notifyObservers(s.pickedMesh),!s||!s.hit)return this._handlePointerOut(r,t.type===l.PointerEventTypes.POINTERUP),!1;s.pickedPoint&&this.onPickedPointChangedObservable.notifyObservers(s.pickedPoint);var _=null===(i=null===(e=s.pickedMesh.reservedDataStore)||void 0===e?void 0:e.GUI3D)||void 0===i?void 0:i.control;return _&&!_._processObservables(t.type,s.pickedPoint,(null===(n=s.originMesh)||void 0===n?void 0:n.position)||null,r,a)&&t.type===l.PointerEventTypes.POINTERMOVE&&(this._lastControlOver[r]&&this._lastControlOver[r]._onPointerOut(this._lastControlOver[r]),delete this._lastControlOver[r]),t.type===l.PointerEventTypes.POINTERUP&&(this._lastControlDown[o.pointerId]&&(this._lastControlDown[o.pointerId].forcePointerUp(),delete this._lastControlDown[o.pointerId]),"touch"===o.pointerType&&this._handlePointerOut(r,!1)),!0},Object.defineProperty(t.prototype,"rootContainer",{get:function(){return this._rootContainer},enumerable:!1,configurable:!0}),t.prototype.containsControl=function(t){return this._rootContainer.containsControl(t)},t.prototype.addControl=function(t){return this._rootContainer.addControl(t),1!==this._customControlScaling&&(t.scaling.scaleInPlace(this._customControlScaling),t._isScaledByManager=!0),this},t.prototype.removeControl=function(t){return this._rootContainer.removeControl(t),t._isScaledByManager&&(t.scaling.scaleInPlace(1/this._customControlScaling),t._isScaledByManager=!1),this},t.prototype.dispose=function(){for(var t in this._rootContainer.dispose(),this._sharedMaterials)this._sharedMaterials.hasOwnProperty(t)&&this._sharedMaterials[t].dispose();for(var t in this._sharedMaterials={},this._touchSharedMaterials)this._touchSharedMaterials.hasOwnProperty(t)&&this._touchSharedMaterials[t].dispose();this._touchSharedMaterials={},this._pointerOutObserver&&this._utilityLayer&&(this._utilityLayer.onPointerOutObservable.remove(this._pointerOutObserver),this._pointerOutObserver=null),this.onPickedPointChangedObservable.clear(),this.onPickingObservable.clear();var e=this._utilityLayer?this._utilityLayer.utilityLayerScene:null;e&&this._pointerObserver&&(e.onPointerObservable.remove(this._pointerObserver),this._pointerObserver=null),this._scene&&this._sceneDisposeObserver&&(this._scene.onDisposeObservable.remove(this._sceneDisposeObserver),this._sceneDisposeObserver=null),this._utilityLayer&&this._utilityLayer.dispose()},t.MRTK_REALISTIC_SCALING=.032,t}()},function(t,e,i){"use strict";i.r(e),function(t){var n=i(1);i.d(e,"Button",(function(){return n.Button})),i.d(e,"Checkbox",(function(){return n.Checkbox})),i.d(e,"ColorPicker",(function(){return n.ColorPicker})),i.d(e,"Container",(function(){return n.Container})),i.d(e,"Control",(function(){return n.Control})),i.d(e,"Ellipse",(function(){return n.Ellipse})),i.d(e,"FocusableButton",(function(){return n.FocusableButton})),i.d(e,"Grid",(function(){return n.Grid})),i.d(e,"Image",(function(){return n.Image})),i.d(e,"InputText",(function(){return n.InputText})),i.d(e,"InputPassword",(function(){return n.InputPassword})),i.d(e,"Line",(function(){return n.Line})),i.d(e,"MultiLine",(function(){return n.MultiLine})),i.d(e,"RadioButton",(function(){return n.RadioButton})),i.d(e,"StackPanel",(function(){return n.StackPanel})),i.d(e,"SelectorGroup",(function(){return n.SelectorGroup})),i.d(e,"CheckboxGroup",(function(){return n.CheckboxGroup})),i.d(e,"RadioGroup",(function(){return n.RadioGroup})),i.d(e,"SliderGroup",(function(){return n.SliderGroup})),i.d(e,"SelectionPanel",(function(){return n.SelectionPanel})),i.d(e,"ScrollViewer",(function(){return n.ScrollViewer})),i.d(e,"TextWrapping",(function(){return n.TextWrapping})),i.d(e,"TextBlock",(function(){return n.TextBlock})),i.d(e,"TextWrapper",(function(){return n.TextWrapper})),i.d(e,"ToggleButton",(function(){return n.ToggleButton})),i.d(e,"KeyPropertySet",(function(){return n.KeyPropertySet})),i.d(e,"VirtualKeyboard",(function(){return n.VirtualKeyboard})),i.d(e,"Rectangle",(function(){return n.Rectangle})),i.d(e,"DisplayGrid",(function(){return n.DisplayGrid})),i.d(e,"BaseSlider",(function(){return n.BaseSlider})),i.d(e,"Slider",(function(){return n.Slider})),i.d(e,"ImageBasedSlider",(function(){return n.ImageBasedSlider})),i.d(e,"ScrollBar",(function(){return n.ScrollBar})),i.d(e,"ImageScrollBar",(function(){return n.ImageScrollBar})),i.d(e,"name",(function(){return n.name})),i.d(e,"AdvancedDynamicTexture",(function(){return n.AdvancedDynamicTexture})),i.d(e,"AdvancedDynamicTextureInstrumentation",(function(){return n.AdvancedDynamicTextureInstrumentation})),i.d(e,"Vector2WithInfo",(function(){return n.Vector2WithInfo})),i.d(e,"Matrix2D",(function(){return n.Matrix2D})),i.d(e,"Measure",(function(){return n.Measure})),i.d(e,"MultiLinePoint",(function(){return n.MultiLinePoint})),i.d(e,"Style",(function(){return n.Style})),i.d(e,"ValueAndUnit",(function(){return n.ValueAndUnit})),i.d(e,"XmlLoader",(function(){return n.XmlLoader})),i.d(e,"AbstractButton3D",(function(){return n.AbstractButton3D})),i.d(e,"Button3D",(function(){return n.Button3D})),i.d(e,"Container3D",(function(){return n.Container3D})),i.d(e,"Control3D",(function(){return n.Control3D})),i.d(e,"CylinderPanel",(function(){return n.CylinderPanel})),i.d(e,"HolographicButton",(function(){return n.HolographicButton})),i.d(e,"HolographicSlate",(function(){return n.HolographicSlate})),i.d(e,"HandMenu",(function(){return n.HandMenu})),i.d(e,"MeshButton3D",(function(){return n.MeshButton3D})),i.d(e,"NearMenu",(function(){return n.NearMenu})),i.d(e,"PlanePanel",(function(){return n.PlanePanel})),i.d(e,"ScatterPanel",(function(){return n.ScatterPanel})),i.d(e,"Slider3D",(function(){return n.Slider3D})),i.d(e,"SpherePanel",(function(){return n.SpherePanel})),i.d(e,"StackPanel3D",(function(){return n.StackPanel3D})),i.d(e,"TouchButton3D",(function(){return n.TouchButton3D})),i.d(e,"TouchMeshButton3D",(function(){return n.TouchMeshButton3D})),i.d(e,"TouchHolographicButton",(function(){return n.TouchHolographicButton})),i.d(e,"TouchHolographicMenu",(function(){return n.TouchHolographicMenu})),i.d(e,"VolumeBasedPanel",(function(){return n.VolumeBasedPanel})),i.d(e,"HolographicBackplate",(function(){return n.HolographicBackplate})),i.d(e,"FluentMaterialDefines",(function(){return n.FluentMaterialDefines})),i.d(e,"FluentMaterial",(function(){return n.FluentMaterial})),i.d(e,"FluentButtonMaterial",(function(){return n.FluentButtonMaterial})),i.d(e,"FluentBackplateMaterial",(function(){return n.FluentBackplateMaterial})),i.d(e,"HandleMaterial",(function(){return n.HandleMaterial})),i.d(e,"MRDLSliderBarMaterial",(function(){return n.MRDLSliderBarMaterial})),i.d(e,"MRDLSliderThumbMaterial",(function(){return n.MRDLSliderThumbMaterial})),i.d(e,"MRDLBackplateMaterial",(function(){return n.MRDLBackplateMaterial})),i.d(e,"SlateGizmo",(function(){return n.SlateGizmo})),i.d(e,"HandleState",(function(){return n.HandleState})),i.d(e,"GizmoHandle",(function(){return n.GizmoHandle})),i.d(e,"SideHandle",(function(){return n.SideHandle})),i.d(e,"CornerHandle",(function(){return n.CornerHandle})),i.d(e,"GUI3DManager",(function(){return n.GUI3DManager})),i.d(e,"Vector3WithInfo",(function(){return n.Vector3WithInfo}));var o=void 0!==t?t:"undefined"!=typeof window?window:void 0;void 0!==o&&(o.BABYLON=o.BABYLON||{},o.BABYLON.GUI=n)}.call(this,i(3))},function(t,e){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i}])})); \ No newline at end of file