babylonjs-gui 7.12.0 → 7.13.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,2 +1,2 @@
1
- !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,(t=>(()=>{"use strict";var e={597:e=>{e.exports=t}},i={};function o(t){var r=i[t];if(void 0!==r)return r.exports;var n=i[t]={exports:{}};return e[t](n,n.exports,o),n.exports}o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};return(()=>{o.d(r,{default:()=>_e});var t={};o.r(t),o.d(t,{AbstractButton3D:()=>pt,AdvancedDynamicTexture:()=>lt,AdvancedDynamicTextureInstrumentation:()=>_t,BaseGradient:()=>rt,BaseSlider:()=>V,Button:()=>T,Button3D:()=>gt,Checkbox:()=>O,CheckboxGroup:()=>G,ColorPicker:()=>E,Container:()=>x,Container3D:()=>bt,Control:()=>y,Control3D:()=>dt,CornerHandle:()=>Nt,CylinderPanel:()=>vt,DisplayGrid:()=>et,Ellipse:()=>F,FluentBackplateMaterial:()=>Ct,FluentButtonMaterial:()=>Rt,FluentMaterial:()=>xt,FluentMaterialDefines:()=>yt,FocusableButton:()=>D,GUI3DManager:()=>se,GizmoHandle:()=>Lt,Grid:()=>M,HandMenu:()=>It,HandleMaterial:()=>Dt,HandleState:()=>Ft,HolographicBackplate:()=>Tt,HolographicButton:()=>St,HolographicSlate:()=>zt,Image:()=>C,ImageBasedSlider:()=>it,ImageScrollBar:()=>Z,InputPassword:()=>k,InputText:()=>w,InputTextArea:()=>L,KeyPropertySet:()=>$,Line:()=>N,LinearGradient:()=>nt,MRDLBackplateMaterial:()=>Kt,MRDLSliderBarMaterial:()=>Ut,MRDLSliderThumbMaterial:()=>Yt,MathTools:()=>v,Matrix2D:()=>m,Measure:()=>g,MeshButton3D:()=>Qt,MultiLine:()=>z,MultiLinePoint:()=>A,NearMenu:()=>Vt,PlanePanel:()=>Wt,RadialGradient:()=>at,RadioButton:()=>Q,RadioGroup:()=>U,Rectangle:()=>I,ScatterPanel:()=>Ht,ScrollBar:()=>K,ScrollViewer:()=>q,SelectionPanel:()=>Y,SelectorGroup:()=>H,SideHandle:()=>kt,SlateGizmo:()=>At,Slider:()=>W,Slider3D:()=>Zt,SliderGroup:()=>j,SpherePanel:()=>qt,StackPanel:()=>S,StackPanel3D:()=>Jt,Style:()=>st,TextBlock:()=>B,TextWrapper:()=>R,TextWrapping:()=>P,ToggleButton:()=>J,TouchButton3D:()=>wt,TouchHolographicButton:()=>Mt,TouchHolographicButtonV3:()=>ae,TouchHolographicMenu:()=>Pt,TouchMeshButton3D:()=>$t,ValueAndUnit:()=>c,Vector2WithInfo:()=>b,Vector3WithInfo:()=>ut,VirtualKeyboard:()=>tt,VolumeBasedPanel:()=>mt,XmlLoader:()=>ct,name:()=>ot});var e={};o.r(e),o.d(e,{AbstractButton3D:()=>pt,AdvancedDynamicTexture:()=>lt,AdvancedDynamicTextureInstrumentation:()=>_t,BaseGradient:()=>rt,BaseSlider:()=>V,Button:()=>T,Button3D:()=>gt,Checkbox:()=>O,CheckboxGroup:()=>G,ColorPicker:()=>E,Container:()=>x,Container3D:()=>bt,Control:()=>y,Control3D:()=>dt,CornerHandle:()=>Nt,CylinderPanel:()=>vt,DisplayGrid:()=>et,Ellipse:()=>F,FluentBackplateMaterial:()=>Ct,FluentButtonMaterial:()=>Rt,FluentMaterial:()=>xt,FluentMaterialDefines:()=>yt,FocusableButton:()=>D,GUI3DManager:()=>se,GizmoHandle:()=>Lt,Grid:()=>M,HandMenu:()=>It,HandleMaterial:()=>Dt,HandleState:()=>Ft,HolographicBackplate:()=>Tt,HolographicButton:()=>St,HolographicSlate:()=>zt,Image:()=>C,ImageBasedSlider:()=>it,ImageScrollBar:()=>Z,InputPassword:()=>k,InputText:()=>w,InputTextArea:()=>L,KeyPropertySet:()=>$,Line:()=>N,LinearGradient:()=>nt,MRDLBackplateMaterial:()=>Kt,MRDLSliderBarMaterial:()=>Ut,MRDLSliderThumbMaterial:()=>Yt,MathTools:()=>v,Matrix2D:()=>m,Measure:()=>g,MeshButton3D:()=>Qt,MultiLine:()=>z,MultiLinePoint:()=>A,NearMenu:()=>Vt,PlanePanel:()=>Wt,RadialGradient:()=>at,RadioButton:()=>Q,RadioGroup:()=>U,Rectangle:()=>I,ScatterPanel:()=>Ht,ScrollBar:()=>K,ScrollViewer:()=>q,SelectionPanel:()=>Y,SelectorGroup:()=>H,SideHandle:()=>kt,SlateGizmo:()=>At,Slider:()=>W,Slider3D:()=>Zt,SliderGroup:()=>j,SpherePanel:()=>qt,StackPanel:()=>S,StackPanel3D:()=>Jt,Style:()=>st,TextBlock:()=>B,TextWrapper:()=>R,TextWrapping:()=>P,ToggleButton:()=>J,TouchButton3D:()=>wt,TouchHolographicButton:()=>Mt,TouchHolographicButtonV3:()=>ae,TouchHolographicMenu:()=>Pt,TouchMeshButton3D:()=>$t,ValueAndUnit:()=>c,Vector2WithInfo:()=>b,Vector3WithInfo:()=>ut,VirtualKeyboard:()=>tt,VolumeBasedPanel:()=>mt,XmlLoader:()=>ct,name:()=>ot});var i=function(t,e){return i=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])},i(t,e)};function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}var a=function(){return a=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},a.apply(this,arguments)};function s(t,e,i,o){var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a}function l(t,e,i,o){return new(i||(i=Promise))((function(r,n){function a(t){try{l(o.next(t))}catch(t){n(t)}}function s(t){try{l(o.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}l((o=o.apply(t,e||[])).next())}))}function _(t,e){var i,o,r,n,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function s(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;n&&(n=0,s[0]&&(a=0)),a;)try{if(i=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],o=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var h=o(597),c=function(){function t(e,i,o){void 0===i&&(i=t.UNITMODE_PIXEL),void 0===o&&(o=!0),this.negativeValueAllowed=o,this._value=1,this._unit=t.UNITMODE_PIXEL,this.ignoreAdaptiveScaling=!1,this.onChangedObservable=new h.Observable,this._value=e,this._unit=i,this._originalUnit=i}return Object.defineProperty(t.prototype,"isPercentage",{get:function(){return this._unit===t.UNITMODE_PERCENTAGE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isPixel",{get:function(){return this._unit===t.UNITMODE_PIXEL},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"internalValue",{get:function(){return this._value},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this._value},set:function(t){t!==this._value&&(this._value=t,this.onChangedObservable.notifyObservers())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"unit",{get:function(){return this._unit},set:function(t){t!==this._unit&&(this._unit=t,this.onChangedObservable.notifyObservers())},enumerable:!1,configurable:!0}),t.prototype.getValueInPixel=function(t,e){return this.isPixel?this.getValue(t):this.getValue(t)*e},t.prototype.updateInPlace=function(e,i){return void 0===i&&(i=t.UNITMODE_PIXEL),this.value===e&&this.unit===i||(this._value=e,this._unit=i,this.onChangedObservable.notifyObservers()),this},t.prototype.getValue=function(e){if(e&&!this.ignoreAdaptiveScaling&&this.unit!==t.UNITMODE_PERCENTAGE){var i=0,o=0;if(e.idealWidth&&(i=Math.ceil(this._value*e.getSize().width/e.idealWidth)),e.idealHeight&&(o=Math.ceil(this._value*e.getSize().height/e.idealHeight)),e.useSmallestIdeal&&e.idealWidth&&e.idealHeight)return window.innerWidth<window.innerHeight?i:o;if(e.idealWidth)return i;if(e.idealHeight)return o}return this._value},t.prototype.toString=function(e,i){switch(this._unit){case t.UNITMODE_PERCENTAGE:var o=100*this.getValue(e);return(i?o.toFixed(i):o)+"%";case t.UNITMODE_PIXEL:var r=this.getValue(e);return(i?r.toFixed(i):r)+"px"}return this._unit.toString()},t.prototype.fromString=function(e){var i=t._Regex.exec(e.toString());if(!i||0===i.length)return!1;var o=parseFloat(i[1]),r=this._originalUnit;if(this.negativeValueAllowed||o<0&&(o=0),4===i.length)switch(i[3]){case"px":r=t.UNITMODE_PIXEL;break;case"%":r=t.UNITMODE_PERCENTAGE,o/=100}return(o!==this._value||r!==this._unit)&&(this._value=o,this._unit=r,this.onChangedObservable.notifyObservers(),!0)},Object.defineProperty(t,"UNITMODE_PERCENTAGE",{get:function(){return t._UNITMODE_PERCENTAGE},enumerable:!1,configurable:!0}),Object.defineProperty(t,"UNITMODE_PIXEL",{get:function(){return t._UNITMODE_PIXEL},enumerable:!1,configurable:!0}),t._Regex=/(^-?\d*(\.\d+)?)(%|px)?/,t._UNITMODE_PERCENTAGE=0,t._UNITMODE_PIXEL=1,t}(),u=[new h.Vector2(0,0),new h.Vector2(0,0),new h.Vector2(0,0),new h.Vector2(0,0)],d=[new h.Vector2(0,0),new h.Vector2(0,0),new h.Vector2(0,0),new h.Vector2(0,0)],f=new h.Vector2(0,0),p=new h.Vector2(0,0),g=function(){function t(t,e,i,o){this.left=t,this.top=e,this.width=i,this.height=o}return t.prototype.copyFrom=function(t){this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height},t.prototype.copyFromFloats=function(t,e,i,o){this.left=t,this.top=e,this.width=i,this.height=o},t.CombineToRef=function(t,e,i){var o=Math.min(t.left,e.left),r=Math.min(t.top,e.top),n=Math.max(t.left+t.width,e.left+e.width),a=Math.max(t.top+t.height,e.top+e.height);i.left=o,i.top=r,i.width=n-o,i.height=a-r},t.prototype.addAndTransformToRef=function(t,e,i,o,r,n){var a=this.left+e,s=this.top+i,l=this.width+o,_=this.height+r;u[0].copyFromFloats(a,s),u[1].copyFromFloats(a+l,s),u[2].copyFromFloats(a+l,s+_),u[3].copyFromFloats(a,s+_),f.copyFromFloats(Number.MAX_VALUE,Number.MAX_VALUE),p.copyFromFloats(0,0);for(var h=0;h<4;h++)t.transformCoordinates(u[h].x,u[h].y,d[h]),f.x=Math.floor(Math.min(f.x,d[h].x)),f.y=Math.floor(Math.min(f.y,d[h].y)),p.x=Math.ceil(Math.max(p.x,d[h].x)),p.y=Math.ceil(Math.max(p.y,d[h].y));n.left=f.x,n.top=f.y,n.width=p.x-f.x,n.height=p.y-f.y},t.prototype.transformToRef=function(t,e){this.addAndTransformToRef(t,0,0,0,0,e)},t.prototype.isEqualsTo=function(t){return this.left===t.left&&this.top===t.top&&this.width===t.width&&this.height===t.height},t.Empty=function(){return new t(0,0,0,0)},t}(),b=function(t){function e(e,i){void 0===i&&(i=0);var o=t.call(this,e.x,e.y)||this;return o.buttonIndex=i,o}return n(e,t),e}(h.Vector2),m=function(){function t(t,e,i,o,r,n){this.m=new Float32Array(6),this.fromValues(t,e,i,o,r,n)}return t.prototype.fromValues=function(t,e,i,o,r,n){return this.m[0]=t,this.m[1]=e,this.m[2]=i,this.m[3]=o,this.m[4]=r,this.m[5]=n,this},t.prototype.determinant=function(){return this.m[0]*this.m[3]-this.m[1]*this.m[2]},t.prototype.invertToRef=function(t){var e=this.m[0],i=this.m[1],o=this.m[2],r=this.m[3],n=this.m[4],a=this.m[5],s=this.determinant();if(s<h.Epsilon*h.Epsilon)return t.m[0]=0,t.m[1]=0,t.m[2]=0,t.m[3]=0,t.m[4]=0,t.m[5]=0,this;var l=1/s,_=o*a-r*n,c=i*n-e*a;return t.m[0]=r*l,t.m[1]=-i*l,t.m[2]=-o*l,t.m[3]=e*l,t.m[4]=_*l,t.m[5]=c*l,this},t.prototype.multiplyToRef=function(t,e){var i=this.m[0],o=this.m[1],r=this.m[2],n=this.m[3],a=this.m[4],s=this.m[5],l=t.m[0],_=t.m[1],h=t.m[2],c=t.m[3],u=t.m[4],d=t.m[5];return e.m[0]=i*l+o*h,e.m[1]=i*_+o*c,e.m[2]=r*l+n*h,e.m[3]=r*_+n*c,e.m[4]=a*l+s*h+u,e.m[5]=a*_+s*c+d,this},t.prototype.transformCoordinates=function(t,e,i){return i.x=t*this.m[0]+e*this.m[2]+this.m[4],i.y=t*this.m[1]+e*this.m[3]+this.m[5],this},t.Identity=function(){return new t(1,0,0,1,0,0)},t.IdentityToRef=function(t){t.m[0]=1,t.m[1]=0,t.m[2]=0,t.m[3]=1,t.m[4]=0,t.m[5]=0},t.TranslationToRef=function(t,e,i){i.fromValues(1,0,0,1,t,e)},t.ScalingToRef=function(t,e,i){i.fromValues(t,0,0,e,0,0)},t.RotationToRef=function(t,e){var i=Math.sin(t),o=Math.cos(t);e.fromValues(o,i,-i,o,0,0)},t.ComposeToRef=function(e,i,o,r,n,a,s){t.TranslationToRef(e,i,t._TempPreTranslationMatrix),t.ScalingToRef(r,n,t._TempScalingMatrix),t.RotationToRef(o,t._TempRotationMatrix),t.TranslationToRef(-e,-i,t._TempPostTranslationMatrix),t._TempPreTranslationMatrix.multiplyToRef(t._TempScalingMatrix,t._TempCompose0),t._TempCompose0.multiplyToRef(t._TempRotationMatrix,t._TempCompose1),a?(t._TempCompose1.multiplyToRef(t._TempPostTranslationMatrix,t._TempCompose2),t._TempCompose2.multiplyToRef(a,s)):t._TempCompose1.multiplyToRef(t._TempPostTranslationMatrix,s)},t._TempPreTranslationMatrix=t.Identity(),t._TempPostTranslationMatrix=t.Identity(),t._TempRotationMatrix=t.Identity(),t._TempScalingMatrix=t.Identity(),t._TempCompose0=t.Identity(),t._TempCompose1=t.Identity(),t._TempCompose2=t.Identity(),t}(),v=function(){function t(){}return t.Round=function(e,i){return void 0===i&&(i=t.DefaultRoundingPrecision),Math.round(e*i)/i},t.DefaultRoundingPrecision=100,t}(),y=function(){function t(e){this.name=e,this._alpha=1,this._alphaSet=!1,this._zIndex=0,this._currentMeasure=g.Empty(),this._tempPaddingMeasure=g.Empty(),this._fontFamily="",this._fontStyle="",this._fontWeight="",this._fontSize=new c(18,c.UNITMODE_PIXEL,!1),this._width=new c(1,c.UNITMODE_PERCENTAGE,!1),this._height=new c(1,c.UNITMODE_PERCENTAGE,!1),this._color="",this._style=null,this._horizontalAlignment=t.HORIZONTAL_ALIGNMENT_CENTER,this._verticalAlignment=t.VERTICAL_ALIGNMENT_CENTER,this._isDirty=!0,this._wasDirty=!1,this._tempParentMeasure=g.Empty(),this._prevCurrentMeasureTransformedIntoGlobalSpace=g.Empty(),this._cachedParentMeasure=g.Empty(),this._descendantsOnlyPadding=!1,this._paddingLeft=new c(0),this._paddingRight=new c(0),this._paddingTop=new c(0),this._paddingBottom=new c(0),this._left=new c(0),this._top=new c(0),this._scaleX=1,this._scaleY=1,this._rotation=0,this._transformCenterX=.5,this._transformCenterY=.5,this._transformMatrix=m.Identity(),this._invertTransformMatrix=m.Identity(),this._transformedPosition=h.Vector2.Zero(),this._isMatrixDirty=!0,this._isVisible=!0,this._isHighlighted=!1,this._highlightColor="#4affff",this._highlightLineWidth=2,this._fontSet=!1,this._dummyVector2=h.Vector2.Zero(),this._downCount=0,this._enterCount=-1,this._doNotRender=!1,this._downPointerIds={},this._evaluatedMeasure=new g(0,0,0,0),this._evaluatedParentMeasure=new g(0,0,0,0),this._isEnabled=!0,this._disabledColor="#9a9a9a",this._disabledColorItem="#6a6a6a",this._isReadOnly=!1,this._gradient=null,this._rebuildLayout=!1,this.onEnabledStateChangedObservable=new h.Observable,this._customData={},this._isClipped=!1,this._automaticSize=!1,this.metadata=null,this.isHitTestVisible=!0,this.isPointerBlocker=!1,this.isFocusInvisible=!1,this._clipChildren=!0,this._clipContent=!0,this.useBitmapCache=!1,this._shadowOffsetX=0,this._shadowOffsetY=0,this._shadowBlur=0,this._previousShadowBlur=0,this._shadowColor="black",this.hoverCursor="",this._linkOffsetX=new c(0),this._linkOffsetY=new c(0),this._accessibilityTag=null,this.onAccessibilityTagChangedObservable=new h.Observable,this.onWheelObservable=new h.Observable,this.onPointerMoveObservable=new h.Observable,this.onPointerOutObservable=new h.Observable,this.onPointerDownObservable=new h.Observable,this.onPointerUpObservable=new h.Observable,this.onPointerClickObservable=new h.Observable,this.onPointerEnterObservable=new h.Observable,this.onDirtyObservable=new h.Observable,this.onBeforeDrawObservable=new h.Observable,this.onAfterDrawObservable=new h.Observable,this.onDisposeObservable=new h.Observable,this.onIsVisibleChangedObservable=new h.Observable,this.isSerializable=!0,this._fixedRatio=0,this._fixedRatioMasterIsWidth=!0,this.animations=null,this._tmpMeasureA=new g(0,0,0,0)}return Object.defineProperty(t.prototype,"isReadOnly",{get:function(){return this._isReadOnly},set:function(t){this._isReadOnly=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transformedMeasure",{get:function(){return this._evaluatedMeasure},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clipChildren",{get:function(){return this._clipChildren},set:function(t){this._clipChildren=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clipContent",{get:function(){return this._clipContent},set:function(t){this._clipContent=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowOffsetX",{get:function(){return this._shadowOffsetX},set:function(t){this._shadowOffsetX!==t&&(this._shadowOffsetX=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowOffsetY",{get:function(){return this._shadowOffsetY},set:function(t){this._shadowOffsetY!==t&&(this._shadowOffsetY=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowBlur",{get:function(){return this._shadowBlur},set:function(t){this._shadowBlur!==t&&(this._previousShadowBlur=this._shadowBlur,this._shadowBlur=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowColor",{get:function(){return this._shadowColor},set:function(t){this._shadowColor!==t&&(this._shadowColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"typeName",{get:function(){return this._getTypeName()},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return this._getTypeName()},Object.defineProperty(t.prototype,"accessibilityTag",{get:function(){return this._accessibilityTag},set:function(t){this._accessibilityTag=t,this.onAccessibilityTagChangedObservable.notifyObservers(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"host",{get:function(){return this._host},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontOffset",{get:function(){return this._fontOffset},set:function(t){this._fontOffset=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha!==t&&(this._alphaSet=!0,this._alpha=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"highlightLineWidth",{get:function(){return this._highlightLineWidth},set:function(t){this._highlightLineWidth!==t&&(this._highlightLineWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isHighlighted",{get:function(){return this._isHighlighted},set:function(t){this._isHighlighted!==t&&(this._isHighlighted=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"highlightColor",{get:function(){return this._highlightColor},set:function(t){this._highlightColor!==t&&(this._highlightColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleX",{get:function(){return this._scaleX},set:function(t){this._scaleX!==t&&(this._scaleX=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleY",{get:function(){return this._scaleY},set:function(t){this._scaleY!==t&&(this._scaleY=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transformCenterY",{get:function(){return this._transformCenterY},set:function(t){this._transformCenterY!==t&&(this._transformCenterY=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transformCenterX",{get:function(){return this._transformCenterX},set:function(t){this._transformCenterX!==t&&(this._transformCenterX=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"horizontalAlignment",{get:function(){return this._horizontalAlignment},set:function(t){this._horizontalAlignment!==t&&(this._horizontalAlignment=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"verticalAlignment",{get:function(){return this._verticalAlignment},set:function(t){this._verticalAlignment!==t&&(this._verticalAlignment=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fixedRatio",{get:function(){return this._fixedRatio},set:function(t){this._fixedRatio!==t&&(this._fixedRatio=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fixedRatioMasterIsWidth",{get:function(){return this._fixedRatioMasterIsWidth},set:function(t){this._fixedRatioMasterIsWidth!==t&&(this._fixedRatioMasterIsWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(t){this._fixedRatioMasterIsWidth=!0,this._width.toString(this._host)!==t&&this._width.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"widthInPixels",{get:function(){return this._width.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(t){isNaN(t)||(this._fixedRatioMasterIsWidth=!0,this.width=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(t){this._fixedRatioMasterIsWidth=!1,this._height.toString(this._host)!==t&&this._height.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"heightInPixels",{get:function(){return this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this._fixedRatioMasterIsWidth=!1,this.height=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this._resetFontCache())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this._resetFontCache())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this._resetFontCache())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"style",{get:function(){return this._style},set:function(t){var e=this;this._style&&(this._style.onChangedObservable.remove(this._styleObserver),this._styleObserver=null),this._style=t,this._style&&(this._styleObserver=this._style.onChangedObservable.add((function(){e._markAsDirty(),e._resetFontCache()}))),this._markAsDirty(),this._resetFontCache()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_isFontSizeInPercentage",{get:function(){return this._fontSize.isPercentage},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontSizeInPixels",{get:function(){var t=this._style?this._style._fontSize:this._fontSize;return t.isPixel?t.getValue(this._host):t.getValueInPixel(this._host,this._tempParentMeasure.height||this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this.fontSize=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontSize",{get:function(){return this._fontSize.toString(this._host)},set:function(t){this._fontSize.toString(this._host)!==t&&this._fontSize.fromString(t)&&(this._markAsDirty(),this._resetFontCache())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this._color},set:function(t){this._color!==t&&(this._color=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gradient",{get:function(){return this._gradient},set:function(t){this._gradient!==t&&(this._gradient=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zIndex",{get:function(){return this._zIndex},set:function(t){this.zIndex!==t&&(this._zIndex=t,this.parent&&this.parent._reOrderControl(this))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"notRenderable",{get:function(){return this._doNotRender},set:function(t){this._doNotRender!==t&&(this._doNotRender=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isVisible",{get:function(){return this._isVisible},set:function(t){this._isVisible!==t&&(this._isVisible=t,this._markAsDirty(!0),this.onIsVisibleChangedObservable.notifyObservers(t))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDirty",{get:function(){return this._isDirty},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkedMesh",{get:function(){return this._linkedMesh},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"descendantsOnlyPadding",{get:function(){return this._descendantsOnlyPadding},set:function(t){this._descendantsOnlyPadding!==t&&(this._descendantsOnlyPadding=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingLeft",{get:function(){return this._paddingLeft.toString(this._host)},set:function(t){this._paddingLeft.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingLeftInPixels",{get:function(){return this._paddingLeft.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(t){isNaN(t)||(this.paddingLeft=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_paddingLeftInPixels",{get:function(){return this._descendantsOnlyPadding?0:this.paddingLeftInPixels},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingRight",{get:function(){return this._paddingRight.toString(this._host)},set:function(t){this._paddingRight.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingRightInPixels",{get:function(){return this._paddingRight.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(t){isNaN(t)||(this.paddingRight=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_paddingRightInPixels",{get:function(){return this._descendantsOnlyPadding?0:this.paddingRightInPixels},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingTop",{get:function(){return this._paddingTop.toString(this._host)},set:function(t){this._paddingTop.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingTopInPixels",{get:function(){return this._paddingTop.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this.paddingTop=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_paddingTopInPixels",{get:function(){return this._descendantsOnlyPadding?0:this.paddingTopInPixels},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingBottom",{get:function(){return this._paddingBottom.toString(this._host)},set:function(t){this._paddingBottom.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingBottomInPixels",{get:function(){return this._paddingBottom.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this.paddingBottom=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_paddingBottomInPixels",{get:function(){return this._descendantsOnlyPadding?0:this.paddingBottomInPixels},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this._left.toString(this._host)},set:function(t){this._left.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leftInPixels",{get:function(){return this._left.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(t){isNaN(t)||(this.left=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this._top.toString(this._host)},set:function(t){this._top.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"topInPixels",{get:function(){return this._top.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this.top=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkOffsetX",{get:function(){return this._linkOffsetX.toString(this._host)},set:function(t){this._linkOffsetX.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkOffsetXInPixels",{get:function(){return this._linkOffsetX.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(t){isNaN(t)||(this.linkOffsetX=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkOffsetY",{get:function(){return this._linkOffsetY.toString(this._host)},set:function(t){this._linkOffsetY.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkOffsetYInPixels",{get:function(){return this._linkOffsetY.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this.linkOffsetY=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"centerX",{get:function(){return this._currentMeasure.left+this._currentMeasure.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"centerY",{get:function(){return this._currentMeasure.top+this._currentMeasure.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(t){var e=this;if(this._isEnabled!==t){this._isEnabled=t,this._markAsDirty();var i=function(t){if(t.host){for(var o in t.host._lastControlOver)t===e.host._lastControlOver[o]&&(t._onPointerOut(t,null,!0),delete t.host._lastControlOver[o]);void 0!==t.children&&t.children.forEach(i)}};i(this),this.onEnabledStateChangedObservable.notifyObservers(t)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabledColor",{get:function(){return this._disabledColor},set:function(t){this._disabledColor!==t&&(this._disabledColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabledColorItem",{get:function(){return this._disabledColorItem},set:function(t){this._disabledColorItem!==t&&(this._disabledColorItem=t,this._markAsDirty())},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"Control"},t.prototype.getAscendantOfClass=function(t){return this.parent?this.parent.getClassName()===t?this.parent:this.parent.getAscendantOfClass(t):null},t.prototype.markAsDirty=function(t){void 0===t&&(t=!1),this._markAsDirty(t)},t.prototype.markAllAsDirty=function(){this._markAllAsDirty()},t.prototype._resetFontCache=function(){this._fontSet=!0,this._markAsDirty()},t.prototype.isAscendant=function(t){return!!this.parent&&(this.parent===t||this.parent.isAscendant(t))},t.prototype.getLocalCoordinates=function(t){var e=h.Vector2.Zero();return this.getLocalCoordinatesToRef(t,e),e},t.prototype.getLocalCoordinatesToRef=function(t,e){return e.x=t.x-this._currentMeasure.left,e.y=t.y-this._currentMeasure.top,this},t.prototype.getParentLocalCoordinates=function(t){var e=h.Vector2.Zero();return e.x=t.x-this._cachedParentMeasure.left,e.y=t.y-this._cachedParentMeasure.top,e},t.prototype.moveToVector3=function(e,i){if(this._host&&this.parent===this._host._rootContainer){this.horizontalAlignment=t.HORIZONTAL_ALIGNMENT_LEFT,this.verticalAlignment=t.VERTICAL_ALIGNMENT_TOP;var o=this._host._getGlobalViewport(),r=h.Vector3.Project(e,h.Matrix.IdentityReadOnly,i.getTransformMatrix(),o);this._moveToProjectedPosition(r),r.z<0||r.z>1?this.notRenderable=!0:this.notRenderable=!1}else h.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=[];return this.getDescendantsToRef(i,t,e),i},t.prototype.linkWithMesh=function(e){if(!this._host||this.parent&&this.parent!==this._host._rootContainer)e&&h.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,o){var r=t,n=null!=e?e:r,a=null!=i?i:r,s=null!=o?o:n;this.paddingTop=r,this.paddingRight=n,this.paddingBottom=a,this.paddingLeft=s},t.prototype.setPaddingInPixels=function(t,e,i,o){var r=t,n=null!=e?e:r,a=null!=i?i:r,s=null!=o?o:n;this.paddingTopInPixels=r,this.paddingRightInPixels=n,this.paddingBottomInPixels=a,this.paddingLeftInPixels=s},t.prototype._moveToProjectedPosition=function(t){var e,i=this._left.getValue(this._host),o=this._top.getValue(this._host),r=null===(e=this.parent)||void 0===e?void 0:e._currentMeasure;r&&this._processMeasures(r,this._host.getContext());var n=t.x+this._linkOffsetX.getValue(this._host)-this._currentMeasure.width/2,a=t.y+this._linkOffsetY.getValue(this._host)-this._currentMeasure.height/2,s=this._left.ignoreAdaptiveScaling&&this._top.ignoreAdaptiveScaling;s&&(Math.abs(n-i)<.5&&(n=i),Math.abs(a-o)<.5&&(a=o)),(s||i!==n||o!==a)&&(this.left=n+"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._computeAdditionalOffsetX=function(){return 0},t.prototype._computeAdditionalOffsetY=function(){return 0},t.prototype.invalidateRect=function(){if(this._transform(),this.host&&this.host.useInvalidateRectOptimization){this._currentMeasure.transformToRef(this._transformMatrix,this._tmpMeasureA),g.CombineToRef(this._tmpMeasureA,this._prevCurrentMeasureTransformedIntoGlobalSpace,this._tmpMeasureA);var t=this.shadowOffsetX,e=this.shadowOffsetY,i=Math.max(this._previousShadowBlur,this.shadowBlur),o=Math.min(Math.min(t,0)-2*i,0),r=Math.max(Math.max(t,0)+2*i,0),n=Math.min(Math.min(e,0)-2*i,0),a=Math.max(Math.max(e,0)+2*i,0),s=this._computeAdditionalOffsetX(),l=this._computeAdditionalOffsetY();this.host.invalidateRect(Math.floor(this._tmpMeasureA.left+o-s),Math.floor(this._tmpMeasureA.top+n-l),Math.ceil(this._tmpMeasureA.left+this._tmpMeasureA.width+r+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(),m.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._getColor=function(t){return this.gradient?this.gradient.getCanvasGradient(t):this.color},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||this.gradient)&&(e.fillStyle=this._getColor(e)),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&&h.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._postMeasure(this._tempPaddingMeasure,e),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._transform(),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.width<this._evaluatedParentMeasure.left)return void(this._isClipped=!0);if(this._evaluatedMeasure.top>this._evaluatedParentMeasure.top+this._evaluatedParentMeasure.height)return void(this._isClipped=!0);if(this._evaluatedMeasure.top+this._evaluatedMeasure.height<this._evaluatedParentMeasure.top)return void(this._isClipped=!0)}this._isClipped=!1},t.prototype._measure=function(){this._width.isPixel?this._currentMeasure.width=this._width.getValue(this._host):this._currentMeasure.width*=this._width.getValue(this._host),this._height.isPixel?this._currentMeasure.height=this._height.getValue(this._host):this._currentMeasure.height*=this._height.getValue(this._host),0!==this._fixedRatio&&(this._fixedRatioMasterIsWidth?this._currentMeasure.height=this._currentMeasure.width*this._fixedRatio:this._currentMeasure.width=this._currentMeasure.height*this._fixedRatio)},t.prototype._computeAlignment=function(e,i){var o=this._currentMeasure.width,r=this._currentMeasure.height,n=e.width,a=e.height,s=0,l=0;switch(this.horizontalAlignment){case t.HORIZONTAL_ALIGNMENT_LEFT:s=0;break;case t.HORIZONTAL_ALIGNMENT_RIGHT:s=n-o;break;case t.HORIZONTAL_ALIGNMENT_CENTER:s=(n-o)/2}switch(this.verticalAlignment){case t.VERTICAL_ALIGNMENT_TOP:l=0;break;case t.VERTICAL_ALIGNMENT_BOTTOM:l=a-r;break;case t.VERTICAL_ALIGNMENT_CENTER:l=(a-r)/2}this.descendantsOnlyPadding||(this._paddingLeft.isPixel?(this._currentMeasure.left+=this._paddingLeft.getValue(this._host),this._currentMeasure.width-=this._paddingLeft.getValue(this._host)):(this._currentMeasure.left+=n*this._paddingLeft.getValue(this._host),this._currentMeasure.width-=n*this._paddingLeft.getValue(this._host)),this._paddingRight.isPixel?this._currentMeasure.width-=this._paddingRight.getValue(this._host):this._currentMeasure.width-=n*this._paddingRight.getValue(this._host),this._paddingTop.isPixel?(this._currentMeasure.top+=this._paddingTop.getValue(this._host),this._currentMeasure.height-=this._paddingTop.getValue(this._host)):(this._currentMeasure.top+=a*this._paddingTop.getValue(this._host),this._currentMeasure.height-=a*this._paddingTop.getValue(this._host)),this._paddingBottom.isPixel?this._currentMeasure.height-=this._paddingBottom.getValue(this._host):this._currentMeasure.height-=a*this._paddingBottom.getValue(this._host)),this._left.isPixel?this._currentMeasure.left+=this._left.getValue(this._host):this._currentMeasure.left+=n*this._left.getValue(this._host),this._top.isPixel?this._currentMeasure.top+=this._top.getValue(this._host):this._currentMeasure.top+=a*this._top.getValue(this._host),this._currentMeasure.left+=s,this._currentMeasure.top+=l},t.prototype._preMeasure=function(t,e){},t.prototype._postMeasure=function(t,e){},t.prototype._additionalProcessing=function(t,e){},t.prototype._clipForChildren=function(t){},t.prototype._clip=function(e,i){if(e.beginPath(),t._ClipMeasure.copyFrom(this._currentMeasure),i){i.transformToRef(this._invertTransformMatrix,this._tmpMeasureA);var o=new g(0,0,0,0);o.left=Math.max(this._tmpMeasureA.left,this._currentMeasure.left),o.top=Math.max(this._tmpMeasureA.top,this._currentMeasure.top),o.width=Math.min(this._tmpMeasureA.left+this._tmpMeasureA.width,this._currentMeasure.left+this._currentMeasure.width)-o.left,o.height=Math.min(this._tmpMeasureA.top+this._tmpMeasureA.height,this._currentMeasure.top+this._currentMeasure.height)-o.top,t._ClipMeasure.copyFrom(o)}if(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY){var r=this.shadowOffsetX,n=this.shadowOffsetY,a=this.shadowBlur,s=Math.min(Math.min(r,0)-2*a,0),l=Math.max(Math.max(r,0)+2*a,0),_=Math.min(Math.min(n,0)-2*a,0),h=Math.max(Math.max(n,0)+2*a,0);e.rect(t._ClipMeasure.left+s,t._ClipMeasure.top+_,t._ClipMeasure.width+l-s,t._ClipMeasure.height+h-_)}else e.rect(t._ClipMeasure.left,t._ClipMeasure.top,t._ClipMeasure.width,t._ClipMeasure.height);e.clip()},t.prototype._render=function(t,e){return!this.isVisible||this.notRenderable||this._isClipped?(this._isDirty=!1,!1):(this.host._numRenderCalls++,t.save(),this._applyStates(t),this._transform(t),this.clipContent&&this._clip(t,e),this.onBeforeDrawObservable.hasObservers()&&this.onBeforeDrawObservable.notifyObservers(this),this.useBitmapCache&&!this._wasDirty&&this._cacheData?t.putImageData(this._cacheData,this._currentMeasure.left,this._currentMeasure.top):this._draw(t,e),this.useBitmapCache&&this._wasDirty&&(this._cacheData=t.getImageData(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._renderHighlight(t),this.onAfterDrawObservable.hasObservers()&&this.onAfterDrawObservable.notifyObservers(this),t.restore(),!0)},t.prototype._draw=function(t,e){},t.prototype.contains=function(t,e){return this._invertTransformMatrix.transformCoordinates(t,e,this._transformedPosition),t=this._transformedPosition.x,e=this._transformedPosition.y,!(t<this._currentMeasure.left||t>this._currentMeasure.left+this._currentMeasure.width||e<this._currentMeasure.top||e>this._currentMeasure.top+this._currentMeasure.height||(this.isPointerBlocker&&(this._host._shouldBlockPointer=!0),0))},t.prototype._processPicking=function(t,e,i,o,r,n,a,s){return!(!this._isEnabled||!this.isHitTestVisible||!this.isVisible||this._doNotRender||!this.contains(t,e)||(this._processObservables(o,t,e,i,r,n,a,s),0))},t.prototype._onPointerMove=function(t,e,i,o){this.onPointerMoveObservable.notifyObservers(e,-1,t,this,o)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerMove(t,e,i,o)},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.isPointerBlocker&&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 o=!0;t.isAscendant(this)||(o=this.onPointerOutObservable.notifyObservers(this,-1,t,this,e)),o&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerOut(t,e,i)}},t.prototype._onPointerDown=function(t,e,i,o,r){return this._onPointerEnter(this,r),0===this._downCount&&(this._downCount++,this._downPointerIds[i]=!0,this.onPointerDownObservable.notifyObservers(new b(e,o),-1,t,this,r)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerDown(t,e,i,o,r),r&&this.uniqueId!==this._host.rootContainer.uniqueId&&this._host._capturedPointerIds.add(r.event.pointerId),!0)},t.prototype._onPointerUp=function(t,e,i,o,r,n){if(this._isEnabled){this._downCount=0,delete this._downPointerIds[i];var a=r;r&&(this._enterCount>0||-1===this._enterCount)&&(a=this.onPointerClickObservable.notifyObservers(new b(e,o),-1,t,this,n)),this.onPointerUpObservable.notifyObservers(new b(e,o),-1,t,this,n)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerUp(t,e,i,o,a,n),n&&this.uniqueId!==this._host.rootContainer.uniqueId&&this._host._capturedPointerIds.delete(n.event.pointerId)}},t.prototype._forcePointerUp=function(t){if(void 0===t&&(t=null),null!==t)this._onPointerUp(this,h.Vector2.Zero(),t,0,!0);else for(var e in this._downPointerIds)this._onPointerUp(this,h.Vector2.Zero(),+e,0,!0)},t.prototype._onWheelScroll=function(t,e){this._isEnabled&&this.onWheelObservable.notifyObservers(new h.Vector2(t,e))&&null!=this.parent&&this.parent._onWheelScroll(t,e)},t.prototype._onCanvasBlur=function(){},t.prototype._processObservables=function(t,e,i,o,r,n,a,s){if(!this._isEnabled)return!1;if(this._dummyVector2.copyFromFloats(e,i),t===h.PointerEventTypes.POINTERMOVE){this._onPointerMove(this,this._dummyVector2,r,o);var l=this._host._lastControlOver[r];return l&&l!==this&&l._onPointerOut(this,o),l!==this&&this._onPointerEnter(this,o),this._host._lastControlOver[r]=this,!0}return t===h.PointerEventTypes.POINTERDOWN?(this._onPointerDown(this,this._dummyVector2,r,n,o),this._host._registerLastControlDown(this,r),this._host._lastPickedControl=this,!0):t===h.PointerEventTypes.POINTERUP?(this._host._lastControlDown[r]&&this._host._lastControlDown[r]._onPointerUp(this,this._dummyVector2,r,n,!0,o),delete this._host._lastControlDown[r],!0):!(t!==h.PointerEventTypes.POINTERWHEEL||!this._host._lastControlOver[r]||(this._host._lastControlOver[r]._onWheelScroll(a,s),0))},t.prototype._getStyleProperty=function(t,e){var i,o=null!==(i=this._style&&this._style[t])&&void 0!==i?i:this[t];return!o&&this.parent?this.parent._getStyleProperty(t,e):this.parent?o:e},t.prototype._prepareFont=function(){var e,i;(this._font||this._fontSet)&&(this._font=this._getStyleProperty("fontStyle","")+" "+this._getStyleProperty("fontWeight","")+" "+this.fontSizeInPixels+"px "+this._getStyleProperty("fontFamily","Arial"),this._fontOffset=t._GetFontOffset(this._font,null===(i=null===(e=this._host)||void 0===e?void 0:e.getScene())||void 0===i?void 0:i.getEngine()),this.getDescendants().forEach((function(t){return t._markAllAsDirty()})))},t.prototype.isDimensionFullyDefined=function(t){return this.getDimension(t).isPixel},t.prototype.getDimension=function(t){return"width"===t?this._width:this._height},t.prototype.clone=function(t){var e={};this.serialize(e,!0);var i=new(h.Tools.Instantiate("BABYLON.GUI."+e.className));return i.parse(e,t),i},t.prototype.parse=function(t,e,i){var o=this;return this._urlRewriter=i,h.SerializationHelper.Parse((function(){return o}),t,null),this.name=t.name,this._parseFromContent(t,null!=e?e:this._host),this},t.prototype.serialize=function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!0),(this.isSerializable||e)&&(h.SerializationHelper.Serialize(this,t),t.name=this.name,t.className=this.getClassName(),i&&this._prepareFont(),this._fontFamily&&(t.fontFamily=this._fontFamily),this.fontSize&&(t.fontSize=this.fontSize),this.fontWeight&&(t.fontWeight=this.fontWeight),this.fontStyle&&(t.fontStyle=this.fontStyle),this._gradient&&(t.gradient={},this._gradient.serialize(t.gradient)),h.SerializationHelper.AppendSerializedAnimations(this,t))},t.prototype._parseFromContent=function(t,e,i){var o,r;if(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.gradient){var n=h.Tools.Instantiate("BABYLON.GUI."+t.gradient.className);this._gradient=new n,null===(o=this._gradient)||void 0===o||o.parse(t.gradient)}if(t.animations){this.animations=[];for(var a=0;a<t.animations.length;a++){var s=t.animations[a],l=(0,h.GetClass)("BABYLON.Animation");l&&this.animations.push(l.Parse(s))}t.autoAnimate&&this._host&&this._host.getScene()&&this._host.getScene().beginAnimation(this,t.autoAnimateFrom,t.autoAnimateTo,t.autoAnimateLoop,t.autoAnimateSpeed||1)}this.fixedRatioMasterIsWidth=null!==(r=t.fixedRatioMasterIsWidth)&&void 0!==r?r:this.fixedRatioMasterIsWidth},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,i){if(t._FontHeightSizes[e])return t._FontHeightSizes[e];var o=i||h.EngineStore.LastCreatedEngine;if(!o)throw new Error("Invalid engine. Unable to create a canvas.");var r=o.getFontOffset(e);return t._FontHeightSizes[e]=r,r},t.Parse=function(t,e,i){var o=h.Tools.Instantiate("BABYLON.GUI."+t.className),r=h.SerializationHelper.Parse((function(){var t=new o;return t._urlRewriter=i,t}),t,null);return r.name=t.name,r._parseFromContent(t,e,i),r},t.drawEllipse=function(t,e,i,o,r,n){n.translate(t,e),n.scale(i,o),n.beginPath(),n.arc(0,0,1,0,2*Math.PI*r,r<0),r>=1&&n.closePath(),n.scale(1/i,1/o),n.translate(-t,-e)},t.prototype.isReady=function(){return!0},t.AllowAlphaInheritance=!1,t._ClipMeasure=new g(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(){},s([(0,h.serialize)()],t.prototype,"metadata",void 0),s([(0,h.serialize)()],t.prototype,"isHitTestVisible",void 0),s([(0,h.serialize)()],t.prototype,"isPointerBlocker",void 0),s([(0,h.serialize)()],t.prototype,"isFocusInvisible",void 0),s([(0,h.serialize)()],t.prototype,"clipChildren",null),s([(0,h.serialize)()],t.prototype,"clipContent",null),s([(0,h.serialize)()],t.prototype,"useBitmapCache",void 0),s([(0,h.serialize)()],t.prototype,"shadowOffsetX",null),s([(0,h.serialize)()],t.prototype,"shadowOffsetY",null),s([(0,h.serialize)()],t.prototype,"shadowBlur",null),s([(0,h.serialize)()],t.prototype,"shadowColor",null),s([(0,h.serialize)()],t.prototype,"hoverCursor",void 0),s([(0,h.serialize)()],t.prototype,"fontOffset",null),s([(0,h.serialize)()],t.prototype,"alpha",null),s([(0,h.serialize)()],t.prototype,"isSerializable",void 0),s([(0,h.serialize)()],t.prototype,"scaleX",null),s([(0,h.serialize)()],t.prototype,"scaleY",null),s([(0,h.serialize)()],t.prototype,"rotation",null),s([(0,h.serialize)()],t.prototype,"transformCenterY",null),s([(0,h.serialize)()],t.prototype,"transformCenterX",null),s([(0,h.serialize)()],t.prototype,"horizontalAlignment",null),s([(0,h.serialize)()],t.prototype,"verticalAlignment",null),s([(0,h.serialize)()],t.prototype,"fixedRatio",null),s([(0,h.serialize)()],t.prototype,"fixedRatioMasterIsWidth",null),s([(0,h.serialize)()],t.prototype,"width",null),s([(0,h.serialize)()],t.prototype,"height",null),s([(0,h.serialize)()],t.prototype,"style",null),s([(0,h.serialize)()],t.prototype,"color",null),s([(0,h.serialize)()],t.prototype,"gradient",null),s([(0,h.serialize)()],t.prototype,"zIndex",null),s([(0,h.serialize)()],t.prototype,"notRenderable",null),s([(0,h.serialize)()],t.prototype,"isVisible",null),s([(0,h.serialize)()],t.prototype,"descendantsOnlyPadding",null),s([(0,h.serialize)()],t.prototype,"paddingLeft",null),s([(0,h.serialize)()],t.prototype,"paddingRight",null),s([(0,h.serialize)()],t.prototype,"paddingTop",null),s([(0,h.serialize)()],t.prototype,"paddingBottom",null),s([(0,h.serialize)()],t.prototype,"left",null),s([(0,h.serialize)()],t.prototype,"top",null),s([(0,h.serialize)()],t.prototype,"linkOffsetX",null),s([(0,h.serialize)()],t.prototype,"linkOffsetY",null),s([(0,h.serialize)()],t.prototype,"isEnabled",null),s([(0,h.serialize)()],t.prototype,"disabledColor",null),s([(0,h.serialize)()],t.prototype,"disabledColorItem",null),s([(0,h.serialize)()],t.prototype,"overlapGroup",void 0),s([(0,h.serialize)()],t.prototype,"overlapDeltaMultiplier",void 0),t}();(0,h.RegisterClass)("BABYLON.GUI.Control",y);var x=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._children=new Array,i._measureForChildren=g.Empty(),i._background="",i._backgroundGradient=null,i._adaptWidthToChildren=!1,i._adaptHeightToChildren=!1,i._renderToIntermediateTexture=!1,i._intermediateTexture=null,i.delegatePickingToChildren=!1,i.logLayoutCycleErrors=!1,i.maxLayoutCycle=3,i.onControlAddedObservable=new h.Observable,i.onControlRemovedObservable=new h.Observable,i._inverseTransformMatrix=m.Identity(),i._inverseMeasure=new g(0,0,0,0),i}return n(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,"backgroundGradient",{get:function(){return this._backgroundGradient},set:function(t){this._backgroundGradient!==t&&(this._backgroundGradient=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;e<i.length;e++)i[e].isReadOnly=t},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Container"},e.prototype._flagDescendantsAsMatrixDirty=function(){for(var t=0,e=this.children;t<e.length;t++){var i=e[t];i._isClipped=!1,i._markMatrixAsDirty()}},e.prototype.getChildByName=function(t){for(var e=0,i=this.children;e<i.length;e++){var o=i[e];if(o.name===t)return o}return null},e.prototype.getChildByType=function(t,e){for(var i=0,o=this.children;i<o.length;i++){var r=o[i];if(r.typeName===e)return r}return null},e.prototype.containsControl=function(t){return-1!==this.children.indexOf(t)},e.prototype.addControl=function(t){return t?(-1!==this._children.indexOf(t)||(t._link(this._host),t._markAllAsDirty(),this._reOrderControl(t),this._markAsDirty(),this.onControlAddedObservable.notifyObservers(t)),this):this},e.prototype.clearControls=function(){for(var t=0,e=this.children.slice();t<e.length;t++){var i=e[t];this.removeControl(i)}return this},e.prototype.removeControl=function(t){var e=this._children.indexOf(t);return-1!==e&&(this._children.splice(e,1),t.parent=null),t.linkWithMesh(null),this._host&&this._host._cleanControlAfterRemoval(t),this._markAsDirty(),this.onControlRemovedObservable.notifyObservers(t),this},e.prototype._reOrderControl=function(t){var e=t.linkedMesh;this.removeControl(t);for(var i=!1,o=0;o<this._children.length;o++)if(this._children[o].zIndex>t.zIndex){this._children.splice(o,0,t),i=!0;break}i||this._children.push(t),t.parent=this,e&&t.linkWithMesh(e),this._markAsDirty()},e.prototype._offsetLeft=function(e){t.prototype._offsetLeft.call(this,e);for(var i=0,o=this._children;i<o.length;i++)o[i]._offsetLeft(e)},e.prototype._offsetTop=function(e){t.prototype._offsetTop.call(this,e);for(var i=0,o=this._children;i<o.length;i++)o[i]._offsetTop(e)},e.prototype._markAllAsDirty=function(){t.prototype._markAllAsDirty.call(this);for(var e=0;e<this._children.length;e++)this._children[e]._markAllAsDirty()},e.prototype._getBackgroundColor=function(t){return this._backgroundGradient?this._backgroundGradient.getCanvasGradient(t):this._background},e.prototype._localDraw=function(t){(this._background||this._backgroundGradient)&&(t.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),t.fillStyle=this._getBackgroundColor(t),t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height),t.restore())},e.prototype._link=function(e){t.prototype._link.call(this,e);for(var i=0,o=this._children;i<o.length;i++)o[i]._link(e)},e.prototype._beforeLayout=function(){},e.prototype._processMeasures=function(e,i){!this._isDirty&&this._cachedParentMeasure.isEqualsTo(e)||(t.prototype._processMeasures.call(this,e,i),this._evaluateClippingState(e),this._renderToIntermediateTexture&&(this._intermediateTexture&&this._host.getScene()!=this._intermediateTexture.getScene()&&(this._intermediateTexture.dispose(),this._intermediateTexture=null),this._intermediateTexture?this._intermediateTexture.scaleTo(this._currentMeasure.width,this._currentMeasure.height):(this._intermediateTexture=new h.DynamicTexture("",{width:this._currentMeasure.width,height:this._currentMeasure.height},this._host.getScene(),!1,h.Texture.NEAREST_SAMPLINGMODE,h.Constants.TEXTUREFORMAT_RGBA,!1),this._intermediateTexture.hasAlpha=!0)))},e.prototype._layout=function(t,e){var i,o;if(!this.isDirty&&(!this.isVisible||this.notRenderable))return!1;this.host._numLayoutCalls++,this._isDirty&&this._currentMeasure.transformToRef(this._transformMatrix,this._prevCurrentMeasureTransformedIntoGlobalSpace);var r=0;e.save(),this._applyStates(e),this._beforeLayout();do{var n=-1,a=-1;if(this._rebuildLayout=!1,this._processMeasures(t,e),!this._isClipped){for(var s=0,l=this._children;s<l.length;s++){var _=l[s];_._tempParentMeasure.copyFrom(this._measureForChildren),_._layout(this._measureForChildren,e)&&_.isVisible&&!_.notRenderable&&(this.adaptWidthToChildren&&_._width.isPixel&&(n=Math.max(n,_._currentMeasure.width+_._paddingLeftInPixels+_._paddingRightInPixels)),this.adaptHeightToChildren&&_._height.isPixel&&(a=Math.max(a,_._currentMeasure.height+_._paddingTopInPixels+_._paddingBottomInPixels)))}this.adaptWidthToChildren&&n>=0&&(n+=this.paddingLeftInPixels+this.paddingRightInPixels,this.width!==n+"px"&&(null===(i=this.parent)||void 0===i||i._markAsDirty(),this.width=n+"px",this._width.ignoreAdaptiveScaling=!0,this._rebuildLayout=!0)),this.adaptHeightToChildren&&a>=0&&(a+=this.paddingTopInPixels+this.paddingBottomInPixels,this.height!==a+"px"&&(null===(o=this.parent)||void 0===o||o._markAsDirty(),this.height=a+"px",this._height.ignoreAdaptiveScaling=!0,this._rebuildLayout=!0)),this._postMeasure()}r++}while(this._rebuildLayout&&r<this.maxLayoutCycle);return r>=3&&this.logLayoutCycleErrors&&h.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,o=i?this._intermediateTexture.getContext():t;i&&(o.save(),o.translate(-this._currentMeasure.left,-this._currentMeasure.top),e?(this._transformMatrix.invertToRef(this._inverseTransformMatrix),e.transformToRef(this._inverseTransformMatrix,this._inverseMeasure),o.clearRect(this._inverseMeasure.left,this._inverseMeasure.top,this._inverseMeasure.width,this._inverseMeasure.height)):o.clearRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._localDraw(o),t.save(),this.clipChildren&&this._clipForChildren(o);for(var r=0,n=this._children;r<n.length;r++){var a=n[r];e&&!a._intersectsRect(e)||a._render(o,e)}i&&(o.restore(),t.save(),t.globalAlpha=this.alpha,t.drawImage(o.canvas,this._currentMeasure.left,this._currentMeasure.top),t.restore()),t.restore()},e.prototype.getDescendantsToRef=function(t,e,i){if(void 0===e&&(e=!1),this.children)for(var o=0;o<this.children.length;o++){var r=this.children[o];i&&!i(r)||t.push(r),e||r.getDescendantsToRef(t,!1,i)}},e.prototype._processPicking=function(e,i,o,r,n,a,s,l){if(!this._isEnabled||!this.isVisible||this.notRenderable)return!1;var _=t.prototype.contains.call(this,e,i);if(!_&&this.clipChildren)return!1;if(this.delegatePickingToChildren){for(var h=!1,c=this._children.length-1;c>=0;c--)if((u=this._children[c]).isEnabled&&u.isHitTestVisible&&u.isVisible&&!u.notRenderable&&u.contains(e,i)){h=!0;break}if(!h)return!1}for(c=this._children.length-1;c>=0;c--){var u;if((u=this._children[c])._processPicking(e,i,o,r,n,a,s,l))return u.hoverCursor&&this._host._changeCursor(u.hoverCursor),!0}return!!_&&!!this.isHitTestVisible&&this._processObservables(r,e,i,o,n,a,s,l)},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._measureForChildren.copyFrom(this._currentMeasure)},e.prototype._getAdaptDimTo=function(t){return"width"===t?this.adaptWidthToChildren:this.adaptHeightToChildren},e.prototype.isDimensionFullyDefined=function(e){if(this._getAdaptDimTo(e)){for(var i=0,o=this.children;i<o.length;i++)if(!o[i].isDimensionFullyDefined(e))return!1;return!0}return t.prototype.isDimensionFullyDefined.call(this,e)},e.prototype.serialize=function(e,i,o){if(void 0===i&&(i=!1),void 0===o&&(o=!0),t.prototype.serialize.call(this,e,i,o),(this.isSerializable||i)&&(this.backgroundGradient&&(e.backgroundGradient={},this.backgroundGradient.serialize(e.backgroundGradient)),this.children.length)){e.children=[];for(var r=0,n=this.children;r<n.length;r++){var a=n[r];if(a.isSerializable||i){var s={};a.serialize(s,i,o),e.children.push(s)}}}},e.prototype.dispose=function(){var e;t.prototype.dispose.call(this);for(var i=this.children.length-1;i>=0;i--)this.children[i].dispose();null===(e=this._intermediateTexture)||void 0===e||e.dispose()},e.prototype._parseFromContent=function(e,i,o){var r;if(t.prototype._parseFromContent.call(this,e,i,o),this._link(i),e.backgroundGradient){var n=h.Tools.Instantiate("BABYLON.GUI."+e.backgroundGradient.className);this._backgroundGradient=new n,null===(r=this._backgroundGradient)||void 0===r||r.parse(e.backgroundGradient)}if(e.children)for(var a=0,s=e.children;a<s.length;a++){var l=s[a];this.addControl(y.Parse(l,i,o))}},e.prototype.isReady=function(){for(var t=0,e=this.children;t<e.length;t++)if(!e[t].isReady())return!1;return!0},s([(0,h.serialize)()],e.prototype,"delegatePickingToChildren",void 0),s([(0,h.serialize)()],e.prototype,"renderToIntermediateTexture",null),s([(0,h.serialize)()],e.prototype,"maxLayoutCycle",void 0),s([(0,h.serialize)()],e.prototype,"adaptHeightToChildren",null),s([(0,h.serialize)()],e.prototype,"adaptWidthToChildren",null),s([(0,h.serialize)()],e.prototype,"background",null),s([(0,h.serialize)()],e.prototype,"backgroundGradient",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.Container",x);var P,I=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thickness=1,i._cornerRadius=[0,0,0,0],i._cachedRadius=[0,0,0,0],i}return n(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,"cornerRadius",{get:function(){return this._cornerRadius[0]},set:function(t){t<0&&(t=0),this._cornerRadius[0]===t&&this._cornerRadius[1]===t&&this._cornerRadius[2]===t&&this._cornerRadius[3]===t||(this._cornerRadius[0]=this._cornerRadius[1]=this._cornerRadius[2]=this._cornerRadius[3]=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cornerRadiusX",{get:function(){return this._cornerRadius[0]},set:function(t){this._cornerRadius[0]!==t&&(this._cornerRadius[0]=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cornerRadiusY",{get:function(){return this._cornerRadius[1]},set:function(t){this._cornerRadius[1]!==t&&(this._cornerRadius[1]=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cornerRadiusZ",{get:function(){return this._cornerRadius[2]},set:function(t){this._cornerRadius[2]!==t&&(this._cornerRadius[2]=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cornerRadiusW",{get:function(){return this._cornerRadius[3]},set:function(t){this._cornerRadius[3]!==t&&(this._cornerRadius[3]=t)},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Rectangle"},e.prototype._computeAdditionalOffsetX=function(){var t=0;return 0===this._cornerRadius[0]&&0===this._cornerRadius[1]&&0===this._cornerRadius[2]&&0===this._cornerRadius[3]||(t+=1),this.thickness&&(t+=this.thickness/2),t},e.prototype._computeAdditionalOffsetY=function(){var t=0;return 0===this._cornerRadius[0]&&0===this._cornerRadius[1]&&0===this._cornerRadius[2]&&0===this._cornerRadius[3]||(t+=1),this.thickness&&(t+=this.thickness/2),t},e.prototype._getRectangleFill=function(t){return this._getBackgroundColor(t)},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),(this._background||this._backgroundGradient)&&(t.fillStyle=this._getRectangleFill(t),0!==this._cornerRadius[0]||0!==this._cornerRadius[1]||0!==this._cornerRadius[2]||0!==this._cornerRadius[3]?(this._drawRoundedRect(t,this._thickness/2),t.fill()):t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._thickness&&((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),(this.color||this.gradient)&&(t.strokeStyle=this.gradient?this.gradient.getCanvasGradient(t):this.color),t.lineWidth=this._thickness,0!==this._cornerRadius[0]||0!==this._cornerRadius[1]||0!==this._cornerRadius[2]||0!==this._cornerRadius[3]?(this._drawRoundedRect(t,this._thickness/2),t.stroke()):t.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness)),t.restore()},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},e.prototype._drawRoundedRect=function(t,e){void 0===e&&(e=0);for(var i=this._currentMeasure.left+e,o=this._currentMeasure.top+e,r=this._currentMeasure.width-2*e,n=this._currentMeasure.height-2*e,a=0;a<this._cornerRadius.length;a++)this._cachedRadius[a]=Math.abs(Math.min(n/2,Math.min(r/2,this._cornerRadius[a])));t.beginPath(),t.moveTo(i+this._cachedRadius[0],o),t.lineTo(i+r-this._cachedRadius[1],o),t.arc(i+r-this._cachedRadius[1],o+this._cachedRadius[1],this._cachedRadius[1],3*Math.PI/2,2*Math.PI),t.lineTo(i+r,o+n-this._cachedRadius[2]),t.arc(i+r-this._cachedRadius[2],o+n-this._cachedRadius[2],this._cachedRadius[2],0,Math.PI/2),t.lineTo(i+this._cachedRadius[3],o+n),t.arc(i+this._cachedRadius[3],o+n-this._cachedRadius[3],this._cachedRadius[3],Math.PI/2,Math.PI),t.lineTo(i,o+this._cachedRadius[0]),t.arc(i+this._cachedRadius[0],o+this._cachedRadius[0],this._cachedRadius[0],Math.PI,3*Math.PI/2),t.closePath()},e.prototype._clipForChildren=function(t){0===this._cornerRadius[0]&&0===this._cornerRadius[1]&&0===this._cornerRadius[2]&&0===this._cornerRadius[3]||(this._drawRoundedRect(t,this._thickness),t.clip())},s([(0,h.serialize)()],e.prototype,"thickness",null),s([(0,h.serialize)()],e.prototype,"cornerRadius",null),s([(0,h.serialize)()],e.prototype,"cornerRadiusX",null),s([(0,h.serialize)()],e.prototype,"cornerRadiusY",null),s([(0,h.serialize)()],e.prototype,"cornerRadiusZ",null),s([(0,h.serialize)()],e.prototype,"cornerRadiusW",null),e}(x);(0,h.RegisterClass)("BABYLON.GUI.Rectangle",I),function(t){t[t.Clip=0]="Clip",t[t.WordWrap=1]="WordWrap",t[t.Ellipsis=2]="Ellipsis",t[t.WordWrapEllipsis=3]="WordWrapEllipsis"}(P||(P={}));var B=function(t){function e(e,i){void 0===i&&(i="");var o=t.call(this,e)||this;return o.name=e,o._text="",o._textWrapping=P.Clip,o._textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_CENTER,o._textVerticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,o._resizeToFit=!1,o._lineSpacing=new c(0),o._outlineWidth=0,o._outlineColor="white",o._underline=!1,o._lineThrough=!1,o._wordDivider=" ",o._forceResizeWidth=!1,o._applyOutlineToUnderline=!1,o.onTextChangedObservable=new h.Observable,o.onLinesReadyObservable=new h.Observable,o._linesTemp=[],o.text=i,o}return n(e,t),Object.defineProperty(e.prototype,"lines",{get:function(){return this._lines},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resizeToFit",{get:function(){return this._resizeToFit},set:function(t){this._resizeToFit!==t&&(this._resizeToFit=t,this._resizeToFit&&(this._width.ignoreAdaptiveScaling=!0,this._height.ignoreAdaptiveScaling=!0),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textWrapping",{get:function(){return this._textWrapping},set:function(t){this._textWrapping!==t&&(this._textWrapping=+t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t+"",this._markAsDirty(),this.onTextChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textHorizontalAlignment",{get:function(){return this._textHorizontalAlignment},set:function(t){this._textHorizontalAlignment!==t&&(this._textHorizontalAlignment=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textVerticalAlignment",{get:function(){return this._textVerticalAlignment},set:function(t){this._textVerticalAlignment!==t&&(this._textVerticalAlignment=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineSpacing",{get:function(){return this._lineSpacing.toString(this._host)},set:function(t){this._lineSpacing.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outlineWidth",{get:function(){return this._outlineWidth},set:function(t){this._outlineWidth!==t&&(this._outlineWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"underline",{get:function(){return this._underline},set:function(t){this._underline!==t&&(this._underline=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineThrough",{get:function(){return this._lineThrough},set:function(t){this._lineThrough!==t&&(this._lineThrough=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"applyOutlineToUnderline",{get:function(){return this._applyOutlineToUnderline},set:function(t){this._applyOutlineToUnderline!==t&&(this._applyOutlineToUnderline=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outlineColor",{get:function(){return this._outlineColor},set:function(t){this._outlineColor!==t&&(this._outlineColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wordDivider",{get:function(){return this._wordDivider},set:function(t){this._wordDivider!==t&&(this._wordDivider=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"forceResizeWidth",{get:function(){return this._forceResizeWidth},set:function(t){this._forceResizeWidth!==t&&(this._forceResizeWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"TextBlock"},e.prototype._processMeasures=function(e,i){var o;this._fontOffset&&!this.isDirty||(this._fontOffset=y._GetFontOffset(i.font,null===(o=this._host.getScene())||void 0===o?void 0:o.getEngine())),t.prototype._processMeasures.call(this,e,i),this._lines=this._breakLines(this._currentMeasure.width,this._currentMeasure.height,i),this.onLinesReadyObservable.notifyObservers(this);for(var r=0,n=0;n<this._lines.length;n++){var a=this._lines[n];a.width>r&&(r=a.width)}if(this._resizeToFit){if(this._textWrapping===P.Clip||this._forceResizeWidth){var s=Math.ceil(this._paddingLeftInPixels)+Math.ceil(this._paddingRightInPixels)+Math.ceil(r);s!==this._width.getValueInPixel(this._host,this._tempParentMeasure.width)&&(this._width.updateInPlace(s,c.UNITMODE_PIXEL),this._rebuildLayout=!0)}var l=this._paddingTopInPixels+this._paddingBottomInPixels+this._fontOffset.height*this._lines.length|0;if(this._lines.length>0&&0!==this._lineSpacing.internalValue){var _;_=this._lineSpacing.isPixel?this._lineSpacing.getValue(this._host):this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height),l+=(this._lines.length-1)*_}l!==this._height.internalValue&&(this._height.updateInPlace(l,c.UNITMODE_PIXEL),this._rebuildLayout=!0)}},e.prototype._drawText=function(t,e,i,o){var r=this._currentMeasure.width,n=0;switch(this._textHorizontalAlignment){case y.HORIZONTAL_ALIGNMENT_LEFT:n=0;break;case y.HORIZONTAL_ALIGNMENT_RIGHT:n=r-e;break;case y.HORIZONTAL_ALIGNMENT_CENTER:n=(r-e)/2}(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(o.shadowColor=this.shadowColor,o.shadowBlur=this.shadowBlur,o.shadowOffsetX=this.shadowOffsetX,o.shadowOffsetY=this.shadowOffsetY),this.outlineWidth&&o.strokeText(t,this._currentMeasure.left+n,i),o.fillText(t,this._currentMeasure.left+n,i),this._underline&&this._drawLine(this._currentMeasure.left+n,i+3,this._currentMeasure.left+n+e,i+3,o),this._lineThrough&&this._drawLine(this._currentMeasure.left+n,i-this.fontSizeInPixels/3,this._currentMeasure.left+n+e,i-this.fontSizeInPixels/3,o)},e.prototype._drawLine=function(t,e,i,o,r){if(r.beginPath(),r.lineWidth=Math.round(.05*this.fontSizeInPixels),r.moveTo(t,e),r.lineTo(i,o),this.outlineWidth&&this.applyOutlineToUnderline)r.stroke(),r.fill();else{var n=r.strokeStyle;r.strokeStyle=r.fillStyle,r.stroke(),r.strokeStyle=n}r.closePath()},e.prototype._draw=function(t){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 o,r;this._linesTemp.length=0;var n=this.text.split("\n");if(this._textWrapping===P.Ellipsis)for(var a=0,s=n;a<s.length;a++){var l=s[a];this._linesTemp.push(this._parseLineEllipsis(l,t,i))}else if(this._textWrapping===P.WordWrap)for(var _=0,h=n;_<h.length;_++)l=h[_],(o=this._linesTemp).push.apply(o,this._parseLineWordWrap(l,t,i));else if(this._textWrapping===P.WordWrapEllipsis)for(var c=0,u=n;c<u.length;c++)l=u[c],(r=this._linesTemp).push.apply(r,this._parseLineWordWrapEllipsis(l,t,e,i));else for(var d=0,f=n;d<f.length;d++)l=f[d],this._linesTemp.push(this._parseLine(l,i));return this._linesTemp},e.prototype._parseLine=function(t,e){return void 0===t&&(t=""),{text:t,width:this._getTextMetricsWidth(e.measureText(t))}},e.prototype._getCharsToRemove=function(t,e,i){var o=t>e?t-e:0,r=t/i;return Math.max(Math.floor(o/r),1)},e.prototype._parseLineEllipsis=function(t,e,i){void 0===t&&(t="");var o=this._getTextMetricsWidth(i.measureText(t)),r=this._getCharsToRemove(o,e,t.length),n=Array.from&&Array.from(t);if(n)for(;n.length&&o>e;)n.splice(n.length-r,r),t="".concat(n.join(""),"…"),o=this._getTextMetricsWidth(i.measureText(t)),r=this._getCharsToRemove(o,e,t.length);else{for(;t.length>2&&o>e;)t=t.slice(0,-r),o=this._getTextMetricsWidth(i.measureText(t+"…")),r=this._getCharsToRemove(o,e,t.length);t+="…"}return{text:t,width:o}},e.prototype._getTextMetricsWidth=function(t){return void 0!==t.actualBoundingBoxLeft?Math.abs(t.actualBoundingBoxLeft)+Math.abs(t.actualBoundingBoxRight):t.width},e.prototype._parseLineWordWrap=function(t,e,i){void 0===t&&(t="");for(var o=[],r=this.wordSplittingFunction?this.wordSplittingFunction(t):t.split(this._wordDivider),n=this._getTextMetricsWidth(i.measureText(t)),a=0;a<r.length;a++){var s=a>0?t+this._wordDivider+r[a]:r[0],l=this._getTextMetricsWidth(i.measureText(s));l>e&&a>0?(o.push({text:t,width:n}),t=r[a],n=this._getTextMetricsWidth(i.measureText(t))):(n=l,t=s)}return o.push({text:t,width:n}),o},e.prototype._parseLineWordWrapEllipsis=function(t,e,i,o){void 0===t&&(t="");for(var r=this._parseLineWordWrap(t,e,o),n=1;n<=r.length;n++)if(this._computeHeightForLinesOf(n)>i&&n>1){var a=r[n-2],s=r[n-1];r[n-2]=this._parseLineEllipsis(a.text+this._wordDivider+s.text,e,o);for(var l=r.length-n+1,_=0;_<l;_++)r.pop();return r}return r},e.prototype._renderLines=function(t){if(this._fontOffset&&this._lines){var e=this._currentMeasure.height,i=0;switch(this._textVerticalAlignment){case y.VERTICAL_ALIGNMENT_TOP:i=this._fontOffset.ascent;break;case y.VERTICAL_ALIGNMENT_BOTTOM:i=e-this._fontOffset.height*(this._lines.length-1)-this._fontOffset.descent;break;case y.VERTICAL_ALIGNMENT_CENTER:i=this._fontOffset.ascent+(e-this._fontOffset.height*this._lines.length)/2}i+=this._currentMeasure.top;for(var o=0;o<this._lines.length;o++){var r=this._lines[o];0!==o&&0!==this._lineSpacing.internalValue&&(this._lineSpacing.isPixel?i+=this._lineSpacing.getValue(this._host):i+=this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)),this._drawText(r.text,r.width,i,t),i+=this._fontOffset.height}}},e.prototype._computeHeightForLinesOf=function(t){var e=this._paddingTopInPixels+this._paddingBottomInPixels+this._fontOffset.height*t;return t>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))),e},e.prototype.isDimensionFullyDefined=function(e){return!!this.resizeToFit||t.prototype.isDimensionFullyDefined.call(this,e)},e.prototype.computeExpectedHeight=function(){var t,e;if(this.text&&this.widthInPixels){var i=null===(t=h.EngineStore.LastCreatedEngine)||void 0===t?void 0:t.createCanvas(0,0).getContext("2d");if(i){this._applyStates(i),this._fontOffset||(this._fontOffset=y._GetFontOffset(i.font,null===(e=this._host.getScene())||void 0===e?void 0:e.getEngine()));var o=this._lines?this._lines:this._breakLines(this.widthInPixels-this._paddingLeftInPixels-this._paddingRightInPixels,this.heightInPixels-this._paddingTopInPixels-this._paddingBottomInPixels,i);return this._computeHeightForLinesOf(o.length)}}return 0},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onTextChangedObservable.clear()},s([(0,h.serialize)()],e.prototype,"resizeToFit",null),s([(0,h.serialize)()],e.prototype,"textWrapping",null),s([(0,h.serialize)()],e.prototype,"text",null),s([(0,h.serialize)()],e.prototype,"textHorizontalAlignment",null),s([(0,h.serialize)()],e.prototype,"textVerticalAlignment",null),s([(0,h.serialize)()],e.prototype,"lineSpacing",null),s([(0,h.serialize)()],e.prototype,"outlineWidth",null),s([(0,h.serialize)()],e.prototype,"underline",null),s([(0,h.serialize)()],e.prototype,"lineThrough",null),s([(0,h.serialize)()],e.prototype,"applyOutlineToUnderline",null),s([(0,h.serialize)()],e.prototype,"outlineColor",null),s([(0,h.serialize)()],e.prototype,"wordDivider",null),s([(0,h.serialize)()],e.prototype,"forceResizeWidth",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.TextBlock",B);var C=function(t){function e(i,o){void 0===o&&(o=null);var r=t.call(this,i)||this;return r.name=i,r._workingCanvas=null,r._loaded=!1,r._stretch=e.STRETCH_FILL,r._autoScale=!1,r._sourceLeft=0,r._sourceTop=0,r._sourceWidth=0,r._sourceHeight=0,r._svgAttributesComputationCompleted=!1,r._isSVG=!1,r._cellWidth=0,r._cellHeight=0,r._cellId=-1,r._populateNinePatchSlicesFromImage=!1,r._imageDataCache={data:null,key:""},r.onImageLoadedObservable=new h.Observable,r.onSVGAttributesComputedObservable=new h.Observable,r.source=o,r}return n(e,t),Object.defineProperty(e.prototype,"isLoaded",{get:function(){return this._loaded},enumerable:!1,configurable:!0}),e.prototype.isReady=function(){return this.isLoaded},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 o,r;void 0===i&&(i=!1);var n=this._domImage.width,a=this._domImage.height,s=(null===(r=null===(o=this._host)||void 0===o?void 0:o.getScene())||void 0===r?void 0:r.getEngine())||h.EngineStore.LastCreatedEngine;if(!s)throw new Error("Invalid engine. Unable to create a canvas.");var l=s.createCanvas(a,n),_=l.getContext("2d");_.translate(l.width/2,l.height/2),_.rotate(t*Math.PI/2),_.drawImage(this._domImage,0,0,n,a,-n/2,-a/2,n,a);var c=l.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 o=this;t._isSVG&&(t._svgAttributesComputationCompleted?(this._rotate90SourceProperties(t,e,i),this._markAsDirty()):t.onSVGAttributesComputedObservable.addOnce((function(){o._rotate90SourceProperties(t,e,i),o._markAsDirty()})))},e.prototype._rotate90SourceProperties=function(t,e,i){var o,r,n=t.sourceLeft,a=t.sourceTop,s=t.domImage.width,l=t.domImage.height,_=n,h=a,c=t.sourceWidth,u=t.sourceHeight;if(0!=i){var d=i<0?-1:1;i%=4;for(var f=0;f<Math.abs(i);++f)_=-(a-l/2)*d+l/2,h=(n-s/2)*d+s/2,c=(o=[u,c])[0],u=o[1],i<0?h-=u:_-=c,n=_,a=h,s=(r=[l,s])[0],l=r[1]}e.sourceLeft=_,e.sourceTop=h,e.sourceWidth=c,e.sourceHeight=u},e.prototype._extractNinePatchSliceDataFromImage=function(){var t,e,i=this._domImage.width,o=this._domImage.height;if(!this._workingCanvas){var r=(null===(e=null===(t=this._host)||void 0===t?void 0:t.getScene())||void 0===e?void 0:e.getEngine())||h.EngineStore.LastCreatedEngine;if(!r)throw new Error("Invalid engine. Unable to create a canvas.");this._workingCanvas=r.createCanvas(i,o)}var n=this._workingCanvas.getContext("2d");n.drawImage(this._domImage,0,0,i,o);var a=n.getImageData(0,0,i,o);this._sliceLeft=-1,this._sliceRight=-1;for(var s=0;s<i;s++)if((_=a.data[4*s+3])>127&&-1===this._sliceLeft)this._sliceLeft=s;else if(_<127&&this._sliceLeft>-1){this._sliceRight=s;break}this._sliceTop=-1,this._sliceBottom=-1;for(var l=0;l<o;l++){var _;if((_=a.data[l*i*4+3])>127&&-1===this._sliceTop)this._sliceTop=l;else if(_<127&&this._sliceTop>-1){this._sliceBottom=l;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 i,o,r,n,a=this;if(this._urlRewriter&&t&&(t=this._urlRewriter(t)),this._source!==t){this._removeCacheUsage(this._source),this._loaded=!1,this._source=t,this._imageDataCache.data=null,t&&(t=this._svgCheck(t));var s=(null===(o=null===(i=this._host)||void 0===i?void 0:i.getScene())||void 0===o?void 0:o.getEngine())||h.EngineStore.LastCreatedEngine;if(!s)throw new Error("Invalid engine. Unable to create a canvas.");if(t&&e.SourceImgCache.has(t)){var l=e.SourceImgCache.get(t);return this._domImage=l.img,l.timesUsed+=1,void(l.loaded?this._onImageLoaded():l.waitingForLoadCallback.push(this._onImageLoaded.bind(this)))}this._domImage=s.createCanvasImage();var _=this._domImage;_.style&&(_.style.visibility="hidden",_.style.position="absolute",null===(n=null===(r=s.getRenderingCanvas())||void 0===r?void 0:r.parentNode)||void 0===n||n.appendChild(_)),t&&e.SourceImgCache.set(t,{img:this._domImage,timesUsed:1,loaded:!1,waitingForLoadCallback:[this._onImageLoaded.bind(this)]}),this._domImage.onload=function(){if(t){var i=e.SourceImgCache.get(t);if(i){i.loaded=!0;for(var o=0,r=i.waitingForLoadCallback;o<r.length;o++)(0,r[o])();return void(i.waitingForLoadCallback.length=0)}}a._onImageLoaded()},t&&(h.Tools.SetCorsBehavior(t,this._domImage),h.Tools.SetReferrerPolicyBehavior(this.referrerPolicy,this._domImage),this._domImage.src=t)}},enumerable:!1,configurable:!0}),e.ResetImageCache=function(){e.SourceImgCache.clear()},e.prototype._removeCacheUsage=function(t){var i=t&&e.SourceImgCache.get(t);if(i){i.timesUsed-=1;var o=i.img;o.parentNode&&o.parentNode.removeChild(o),0===i.timesUsed&&e.SourceImgCache.delete(t)}},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],o=t.split("#")[1],r=document.body.querySelector('object[data="'+i+'"]');if(r){var n=r.contentDocument;if(n&&n.documentElement){var a=n.documentElement.getAttribute("viewBox"),s=Number(n.documentElement.getAttribute("width")),l=Number(n.documentElement.getAttribute("height"));if(n.getElementById(o)&&a&&s&&l)return this._getSVGAttribs(r,o),t}r.addEventListener("load",(function(){e._getSVGAttribs(r,o)}))}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,o)}}return i}return t},e.prototype._getSVGAttribs=function(t,e){var i=t.contentDocument;if(i&&i.documentElement){var o=i.documentElement.getAttribute("viewBox"),r=Number(i.documentElement.getAttribute("width")),n=Number(i.documentElement.getAttribute("height")),a=i.getElementById(e);if(o&&r&&n&&a){var s=Number(o.split(" ")[2]),l=Number(o.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)*r/s,this.sourceTop=(c*_.y+d)*n/l,this.sourceWidth=_.width*h*(r/s),this.sourceHeight=_.height*c*(n/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 o=0|this._currentMeasure.width,r=0|this._currentMeasure.height,n=o+"_"+r,a=this._imageDataCache.data;if(!a||this._imageDataCache.key!==n){var s=this._workingCanvas.getContext("2d");this._imageDataCache.data=a=s.getImageData(0,0,o,r).data,this._imageDataCache.key=n}return a[4*((e=e-this._currentMeasure.left|0)+(i=i-this._currentMeasure.top|0)*o)+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,o){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,o)},e.prototype._prepareWorkingCanvasForOpaqueDetection=function(){var t,e;if(this._detectPointerOnOpaqueOnly){var i=this._currentMeasure.width,o=this._currentMeasure.height;if(!this._workingCanvas){var r=(null===(e=null===(t=this._host)||void 0===t?void 0:t.getScene())||void 0===e?void 0:e.getEngine())||h.EngineStore.LastCreatedEngine;if(!r)throw new Error("Invalid engine. Unable to create a canvas.");this._workingCanvas=r.createCanvas(i,o)}this._workingCanvas.getContext("2d").clearRect(0,0,i,o)}},e.prototype._drawImage=function(t,e,i,o,r,n,a,s,l){if(t.drawImage(this._domImage,e,i,o,r,n,a,s,l),this._detectPointerOnOpaqueOnly){var _=t.getTransform(),h=this._workingCanvas.getContext("2d");h.save();var c=n-this._currentMeasure.left,u=a-this._currentMeasure.top;h.setTransform(_.a,_.b,_.c,_.d,(c+s)/2,(u+l)/2),h.translate(-(c+s)/2,-(u+l)/2),h.drawImage(this._domImage,e,i,o,r,c,u,s,l),h.restore()}},e.prototype._draw=function(t){var i,o,r,n;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,o=this._sourceTop,r=this._sourceWidth?this._sourceWidth:this._imageWidth,n=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,o=this.cellHeight*s,r=this.cellWidth,n=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,o,r,n,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case e.STRETCH_UNIFORM:var _=this._currentMeasure.width/r,h=this._currentMeasure.height/n,c=Math.min(_,h),u=(this._currentMeasure.width-r*c)/2,d=(this._currentMeasure.height-n*c)/2;this._drawImage(t,i,o,r,n,this._currentMeasure.left+u,this._currentMeasure.top+d,r*c,n*c);break;case e.STRETCH_EXTEND:this._drawImage(t,i,o,r,n,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case e.STRETCH_NINE_PATCH:this._renderNinePatch(t,i,o,r,n)}t.restore()},e.prototype._renderNinePatch=function(t,e,i,o,r){var n=this.host.idealWidth?this._width.getValue(this.host)/this.host.idealWidth:this.host.idealHeight?this._height.getValue(this.host)/this.host.idealHeight:1,a=this._sliceLeft,s=this._sliceTop,l=r-this._sliceBottom,_=o-this._sliceRight,h=this._sliceRight-this._sliceLeft,c=this._sliceBottom-this._sliceTop,u=Math.round(a*n),d=Math.round(s*n),f=Math.round(l*n),p=Math.round(_*n),g=Math.round(this._currentMeasure.width)-p-u+2,b=Math.round(this._currentMeasure.height)-f-d+2,m=Math.round(this._currentMeasure.left)+u-1,v=Math.round(this._currentMeasure.top)+d-1,y=Math.round(this._currentMeasure.left+this._currentMeasure.width)-p,x=Math.round(this._currentMeasure.top+this._currentMeasure.height)-f;this._drawImage(t,e,i,a,s,this._currentMeasure.left,this._currentMeasure.top,u,d),this._drawImage(t,e+this._sliceLeft,i,h,s,m+1,this._currentMeasure.top,g-2,d),this._drawImage(t,e+this._sliceRight,i,_,s,y,this._currentMeasure.top,p,d),this._drawImage(t,e,i+this._sliceTop,a,c,this._currentMeasure.left,v+1,u,b-2),this._drawImage(t,e+this._sliceLeft,i+this._sliceTop,h,c,m+1,v+1,g-2,b-2),this._drawImage(t,e+this._sliceRight,i+this._sliceTop,_,c,y,v+1,p,b-2),this._drawImage(t,e,i+this._sliceBottom,a,l,this._currentMeasure.left,x,u,f),this._drawImage(t,e+this.sliceLeft,i+this._sliceBottom,h,l,m+1,x,g-2,f),this._drawImage(t,e+this._sliceRight,i+this._sliceBottom,_,l,y,x,p,f)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onImageLoadedObservable.clear(),this.onSVGAttributesComputedObservable.clear(),this._removeCacheUsage(this._source)},e.SourceImgCache=new Map,e.STRETCH_NONE=0,e.STRETCH_FILL=1,e.STRETCH_UNIFORM=2,e.STRETCH_EXTEND=3,e.STRETCH_NINE_PATCH=4,s([(0,h.serialize)()],e.prototype,"detectPointerOnOpaqueOnly",null),s([(0,h.serialize)()],e.prototype,"sliceLeft",null),s([(0,h.serialize)()],e.prototype,"sliceRight",null),s([(0,h.serialize)()],e.prototype,"sliceTop",null),s([(0,h.serialize)()],e.prototype,"sliceBottom",null),s([(0,h.serialize)()],e.prototype,"sourceLeft",null),s([(0,h.serialize)()],e.prototype,"sourceTop",null),s([(0,h.serialize)()],e.prototype,"sourceWidth",null),s([(0,h.serialize)()],e.prototype,"sourceHeight",null),s([(0,h.serialize)()],e.prototype,"populateNinePatchSlicesFromImage",null),s([(0,h.serialize)()],e.prototype,"autoScale",null),s([(0,h.serialize)()],e.prototype,"stretch",null),s([(0,h.serialize)()],e.prototype,"source",null),s([(0,h.serialize)()],e.prototype,"cellWidth",null),s([(0,h.serialize)()],e.prototype,"cellHeight",null),s([(0,h.serialize)()],e.prototype,"cellId",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.Image",C);var T=function(t){function e(e){var i=t.call(this,e)||this;i.name=e,i.thickness=1,i.isPointerBlocker=!0;var o=null;return i.pointerEnterAnimation=function(){o=i.alpha,i.alpha-=.1},i.pointerOutAnimation=function(){null!==o&&(i.alpha=o)},i.pointerDownAnimation=function(){i.scaleX-=.05,i.scaleY-=.05},i.pointerUpAnimation=function(){i.scaleX+=.05,i.scaleY+=.05},i}return n(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,o,r,n,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(r,e,i,o,n,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,o){void 0===o&&(o=!1),!this.isReadOnly&&this.pointerOutAnimation&&this.pointerOutAnimation(),t.prototype._onPointerOut.call(this,e,i,o)},e.prototype._onPointerDown=function(e,i,o,r,n){return!!t.prototype._onPointerDown.call(this,e,i,o,r,n)&&(!this.isReadOnly&&this.pointerDownAnimation&&this.pointerDownAnimation(),!0)},e.prototype._getRectangleFill=function(t){return this.isEnabled?this._getBackgroundColor(t):this._disabledColor},e.prototype._onPointerUp=function(e,i,o,r,n,a){!this.isReadOnly&&this.pointerUpAnimation&&this.pointerUpAnimation(),t.prototype._onPointerUp.call(this,e,i,o,r,n,a)},e.prototype.serialize=function(e,i){t.prototype.serialize.call(this,e,i),(this.isSerializable||i)&&(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 o=new this(t),r=new B(t+"_button",e);r.textWrapping=!0,r.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_CENTER,r.paddingLeft="20%",o.addControl(r);var n=new C(t+"_icon",i);return n.width="20%",n.stretch=C.STRETCH_UNIFORM,n.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,o.addControl(n),o._image=n,o._textBlock=r,o},e.CreateImageOnlyButton=function(t,e){var i=new this(t),o=new C(t+"_icon",e);return o.stretch=C.STRETCH_FILL,o.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,i.addControl(o),i._image=o,i},e.CreateSimpleButton=function(t,e){var i=new this(t),o=new B(t+"_button",e);return o.textWrapping=!0,o.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_CENTER,i.addControl(o),i._textBlock=o,i},e.CreateImageWithCenterTextButton=function(t,e,i){var o=new this(t),r=new C(t+"_icon",i);r.stretch=C.STRETCH_FILL,o.addControl(r);var n=new B(t+"_button",e);return n.textWrapping=!0,n.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_CENTER,o.addControl(n),o._image=r,o._textBlock=n,o},e}(I);(0,h.RegisterClass)("BABYLON.GUI.Button",T);var S=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 n(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 o=0,r=this._children;o<r.length;o++){var n=r[o];this._isVertical?n.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP:n.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT}t.prototype._preMeasure.call(this,e,i)},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._measureForChildren.copyFrom(e),this._measureForChildren.left=this._currentMeasure.left,this._measureForChildren.top=this._currentMeasure.top,this.isVertical&&!this._manualWidth||(this._measureForChildren.width=this._currentMeasure.width),(this.isVertical||this._manualHeight)&&(this._measureForChildren.height=this._currentMeasure.height)},e.prototype._postMeasure=function(){for(var e=0,i=0,o=this._children.length,r=0;r<o;r++){var n=this._children[r];n.isVisible&&!n.notRenderable&&(this._isVertical?(n.top!==i+"px"&&(n.top=i+"px",this._rebuildLayout=!0,n._top.ignoreAdaptiveScaling=!0),this.ignoreLayoutWarnings||n.isDimensionFullyDefined("height")?i+=n._currentMeasure.height+n._paddingTopInPixels+n._paddingBottomInPixels+(r<o-1?this._spacing:0):h.Logger.Warn("Control (Name:".concat(n.name,", UniqueId:").concat(n.uniqueId,") is using height in percentage mode inside a vertical StackPanel"),1)):(n.left!==e+"px"&&(n.left=e+"px",this._rebuildLayout=!0,n._left.ignoreAdaptiveScaling=!0),this.ignoreLayoutWarnings||n.isDimensionFullyDefined("width")?e+=n._currentMeasure.width+n._paddingLeftInPixels+n._paddingRightInPixels+(r<o-1?this._spacing:0):h.Logger.Warn("Control (Name:".concat(n.name,", UniqueId:").concat(n.uniqueId,") is using width in percentage mode inside a horizontal StackPanel"),1)))}e+=this._paddingLeftInPixels+this._paddingRightInPixels,i+=this._paddingTopInPixels+this._paddingBottomInPixels,this._doNotTrackManualChanges=!0;var a=!1,s=!1;if((!this._manualHeight||this.adaptHeightToChildren)&&this._isVertical){var l=this.height;this.height=i+"px",s=l!==this.height||!this._height.ignoreAdaptiveScaling}if((!this._manualWidth||this.adaptWidthToChildren)&&!this._isVertical){var _=this.width;this.width=e+"px",a=_!==this.width||!this._width.ignoreAdaptiveScaling}s&&(this._height.ignoreAdaptiveScaling=!0),a&&(this._width.ignoreAdaptiveScaling=!0),this._doNotTrackManualChanges=!1,(a||s)&&(this._rebuildLayout=!0),t.prototype._postMeasure.call(this)},e.prototype._getManualDim=function(t){return"width"===t?this._manualWidth:this._manualHeight},e.prototype.isDimensionFullyDefined=function(t){if("height"===t?this.isVertical:!this.isVertical&&!this._getManualDim(t)){for(var e=0,i=this._children;e<i.length;e++)if(!i[e].isDimensionFullyDefined(t))return!1;return!0}return this.getDimension(t).isPixel||this._getAdaptDimTo(t)},e.prototype.serialize=function(e,i){t.prototype.serialize.call(this,e,i),(this.isSerializable||i)&&(e.manualWidth=this._manualWidth,e.manualHeight=this._manualHeight)},e.prototype._parseFromContent=function(e,i){this._manualWidth=e.manualWidth,this._manualHeight=e.manualHeight,t.prototype._parseFromContent.call(this,e,i)},s([(0,h.serialize)()],e.prototype,"ignoreLayoutWarnings",void 0),s([(0,h.serialize)()],e.prototype,"isVertical",null),s([(0,h.serialize)()],e.prototype,"spacing",null),s([(0,h.serialize)()],e.prototype,"width",null),s([(0,h.serialize)()],e.prototype,"height",null),e}(x);(0,h.RegisterClass)("BABYLON.GUI.StackPanel",S);var O=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.onIsCheckedChangedObservable=new h.Observable,i.isPointerBlocker=!0,i}return n(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){this._isChecked!==t&&(this._isChecked=t,this._markAsDirty(),this.onIsCheckedChangedObservable.notifyObservers(t))},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Checkbox"},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),t.fillStyle=this._isEnabled?this._background:this._disabledColor,t.fillRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,e,i),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),this._isChecked){t.fillStyle=this._isEnabled?this.color?this.color:"#ffffff":this._disabledColorItem;var o=e*this._checkSizeRatio,r=i*this._checkSizeRatio;t.fillRect(this._currentMeasure.left+this._thickness/2+(e-o)/2,this._currentMeasure.top+this._thickness/2+(i-r)/2,o,r)}t.strokeStyle=this.color,t.lineWidth=this._thickness,t.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,e,i),t.restore()},e.prototype._onPointerDown=function(e,i,o,r,n){return!!t.prototype._onPointerDown.call(this,e,i,o,r,n)&&(this.isReadOnly||(this.isChecked=!this.isChecked),!0)},e.AddCheckBoxWithHeader=function(t,i){var o=new S;o.isVertical=!1,o.height="30px";var r=new e;r.width="20px",r.height="20px",r.isChecked=!0,r.color="green",r.onIsCheckedChangedObservable.add(i),o.addControl(r);var n=new B;return n.text=t,n.width="180px",n.paddingLeft="5px",n.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,n.color="white",o.addControl(n),o},s([(0,h.serialize)()],e.prototype,"thickness",null),s([(0,h.serialize)()],e.prototype,"checkSizeRatio",null),s([(0,h.serialize)()],e.prototype,"background",null),s([(0,h.serialize)()],e.prototype,"isChecked",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.Checkbox",O);var R=function(){function t(){}return Object.defineProperty(t.prototype,"text",{get:function(){return this._characters?this._characters.join(""):this._text},set:function(t){this._text=t,this._characters=Array.from&&Array.from(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this._characters?this._characters.length:this._text.length},enumerable:!1,configurable:!0}),t.prototype.removePart=function(t,e,i){var o;if(this._text=this._text.slice(0,t)+(i||"")+this._text.slice(e),this._characters){var r=i?Array.from(i):[];(o=this._characters).splice.apply(o,function(t,e,i){if(i||2===arguments.length)for(var o,r=0,n=e.length;r<n;r++)!o&&r in e||(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}([t,e-t],r,!1))}},t.prototype.charAt=function(t){return this._characters?this._characters[t]:this._text.charAt(t)},t.prototype.substr=function(t,e){if(this._characters){t=isNaN(t)?0:t>=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=[],o=0;t<e;)i[o++]=this._characters[t++];return i.join("")}return this._text.substring(t,e)},t.prototype.isWord=function(t){var e=/\w/g;return this._characters?-1!==this._characters[t].search(e):-1!==this._text.search(e)},t}(),w=function(t){function e(e,i){void 0===i&&(i="");var o=t.call(this,e)||this;return o.name=e,o._placeholderText="",o._background="#222222",o._focusedBackground="#000000",o._focusedColor="white",o._placeholderColor="gray",o._thickness=1,o._margin=new c(10,c.UNITMODE_PIXEL),o._autoStretchWidth=!0,o._maxWidth=new c(1,c.UNITMODE_PERCENTAGE,!1),o._isFocused=!1,o._blinkIsEven=!1,o._cursorOffset=0,o._deadKey=!1,o._addKey=!0,o._currentKey="",o._isTextHighlightOn=!1,o._textHighlightColor="#d5e0ff",o._highligherOpacity=.4,o._highlightedText="",o._startHighlightIndex=0,o._endHighlightIndex=0,o._cursorIndex=-1,o._outlineWidth=0,o._outlineColor="white",o._onFocusSelectAll=!1,o._isPointerDown=!1,o.promptMessage="Please enter text:",o.disableMobilePrompt=!1,o.onTextChangedObservable=new h.Observable,o.onBeforeKeyAddObservable=new h.Observable,o.onFocusObservable=new h.Observable,o.onBlurObservable=new h.Observable,o.onTextHighlightObservable=new h.Observable,o.onTextCopyObservable=new h.Observable,o.onTextCutObservable=new h.Observable,o.onTextPasteObservable=new h.Observable,o.onKeyboardEventProcessedObservable=new h.Observable,o.text=i,o.isPointerBlocker=!0,o}return n(e,t),Object.defineProperty(e.prototype,"outlineWidth",{get:function(){return this._outlineWidth},set:function(t){this._outlineWidth!==t&&(this._outlineWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outlineColor",{get:function(){return this._outlineColor},set:function(t){this._outlineColor!==t&&(this._outlineColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxWidth",{get:function(){return this._maxWidth.toString(this._host)},set:function(t){this._maxWidth.toString(this._host)!==t&&this._maxWidth.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxWidthInPixels",{get:function(){return this._maxWidth.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highligherOpacity",{get:function(){return this._highligherOpacity},set:function(t){this._highligherOpacity!==t&&(this._highligherOpacity=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onFocusSelectAll",{get:function(){return this._onFocusSelectAll},set:function(t){this._onFocusSelectAll!==t&&(this._onFocusSelectAll=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textHighlightColor",{get:function(){return this._textHighlightColor},set:function(t){this._textHighlightColor!==t&&(this._textHighlightColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"margin",{get:function(){return this._margin.toString(this._host)},set:function(t){this._margin.toString(this._host)!==t&&this._margin.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"marginInPixels",{get:function(){return this._margin.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"autoStretchWidth",{get:function(){return this._autoStretchWidth},set:function(t){this._autoStretchWidth!==t&&(this._autoStretchWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),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,"focusedBackground",{get:function(){return this._focusedBackground},set:function(t){this._focusedBackground!==t&&(this._focusedBackground=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"focusedColor",{get:function(){return this._focusedColor},set:function(t){this._focusedColor!==t&&(this._focusedColor=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,"placeholderColor",{get:function(){return this._placeholderColor},set:function(t){this._placeholderColor!==t&&(this._placeholderColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"placeholderText",{get:function(){return this._placeholderText},set:function(t){this._placeholderText!==t&&(this._placeholderText=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deadKey",{get:function(){return this._deadKey},set:function(t){this._deadKey=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highlightedText",{get:function(){return this._highlightedText},set:function(t){this._highlightedText!==t&&(this._highlightedText=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"addKey",{get:function(){return this._addKey},set:function(t){this._addKey=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentKey",{get:function(){return this._currentKey},set:function(t){this._currentKey=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._textWrapper.text},set:function(t){var e=t.toString();this._textWrapper||(this._textWrapper=new R),this._textWrapper.text!==e&&(this._textWrapper.text=e,this._textHasChanged())},enumerable:!1,configurable:!0}),e.prototype._textHasChanged=function(){this._markAsDirty(),this.onTextChangedObservable.notifyObservers(this)},e.prototype._applyStates=function(e){t.prototype._applyStates.call(this,e),this.outlineWidth&&(e.lineWidth=this.outlineWidth,e.strokeStyle=this.outlineColor)},Object.defineProperty(e.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(t){(this._width.toString(this._host)!==t||this._autoStretchWidth)&&(this._width.fromString(t)&&this._markAsDirty(),this.autoStretchWidth=!1)},enumerable:!1,configurable:!0}),e.prototype.onBlur=function(){this._isFocused=!1,this._scrollLeft=null,this._cursorOffset=0,clearTimeout(this._blinkTimeout),this._markAsDirty(),this.onBlurObservable.notifyObservers(this),this._host.unRegisterClipboardEvents(),this._onClipboardObserver&&this._host.onClipboardObservable.remove(this._onClipboardObserver);var t=this._host.getScene();this._onPointerDblTapObserver&&t&&t.onPointerObservable.remove(this._onPointerDblTapObserver)},e.prototype.onFocus=function(){var t=this;if(this._isEnabled){if(this._scrollLeft=null,this._isFocused=!0,this._blinkIsEven=!1,this._cursorOffset=0,this._markAsDirty(),this.onFocusObservable.notifyObservers(this),"touch"===this._focusedBy&&!this.disableMobilePrompt){var e=prompt(this.promptMessage);return null!==e&&(this.text=e),void(this._host.focusedControl=null)}this._host.registerClipboardEvents(),this._onClipboardObserver=this._host.onClipboardObservable.add((function(e){switch(e.type){case h.ClipboardEventTypes.COPY:t._onCopyText(e.event),t.onTextCopyObservable.notifyObservers(t);break;case h.ClipboardEventTypes.CUT:t._onCutText(e.event),t.onTextCutObservable.notifyObservers(t);break;case h.ClipboardEventTypes.PASTE:t._onPasteText(e.event),t.onTextPasteObservable.notifyObservers(t);break;default:return}}));var i=this._host.getScene();i&&(this._onPointerDblTapObserver=i.onPointerObservable.add((function(e){t._isFocused&&e.type===h.PointerEventTypes.POINTERDOUBLETAP&&t._processDblClick(e)}))),this._onFocusSelectAll&&this._selectAllText()}},e.prototype.focus=function(){this._host.moveFocusToControl(this)},e.prototype.blur=function(){this._host.focusedControl=null},e.prototype._getTypeName=function(){return"InputText"},e.prototype.keepsFocusWith=function(){return this._connectedVirtualKeyboard?[this._connectedVirtualKeyboard]:null},e.prototype.processKey=function(t,e,i){var o;if(!this.isReadOnly&&(!i||!i.ctrlKey&&!i.metaKey||67!==t&&86!==t&&88!==t)){if(i&&(i.ctrlKey||i.metaKey)&&65===t)return this._selectAllText(),void i.preventDefault();switch(t){case 32:e=" ";break;case 191:i&&i.preventDefault();break;case 8:if(this._textWrapper.text&&this._textWrapper.length>0){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());0===this._cursorOffset?this.text=this._textWrapper.substr(0,this._textWrapper.length-1):(r=this._textWrapper.length-this._cursorOffset)>0&&(this._textWrapper.removePart(r-1,r),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 r=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(r,r+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._cursorIndex<this._cursorOffset?(this._endHighlightIndex=this._textWrapper.length-this._cursorIndex,this._startHighlightIndex=this._textWrapper.length-this._cursorOffset):this._cursorIndex>this._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._cursorIndex<this._cursorOffset?(this._endHighlightIndex=this._textWrapper.length-this._cursorIndex,this._startHighlightIndex=this._textWrapper.length-this._cursorOffset):this._cursorIndex>this._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()}if(32===t&&(e=null!==(o=null==i?void 0:i.key)&&void 0!==o?o:" "),this._deadKey="Dead"===e,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&&!this._deadKey))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+=this._deadKey&&(null==i?void 0:i.key)?i.key:e;else{var n=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(n,n,e),this._textHasChanged()}}},e.prototype._updateValueFromCursorIndex=function(t){if(this._blinkIsEven=!1,-1===this._cursorIndex)this._cursorIndex=t;else if(this._cursorIndex<this._cursorOffset)this._endHighlightIndex=this._textWrapper.length-this._cursorIndex,this._startHighlightIndex=this._textWrapper.length-this._cursorOffset;else{if(!(this._cursorIndex>this._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._endHighlightIndex<this._textWrapper.length&&this._textWrapper.isWord(this._endHighlightIndex)?++this._endHighlightIndex:0,e=this._startHighlightIndex>0&&this._textWrapper.isWord(this._startHighlightIndex-1)?--this._startHighlightIndex:0}while(e||i);this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,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){var e,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=y._GetFontOffset(t.font,null===(e=this._host.getScene())||void 0===e?void 0:e.getEngine()));var o=this._currentMeasure.left+this._margin.getValueInPixel(this._host,this._tempParentMeasure.width);this.color&&(t.fillStyle=this.color);var r=this._beforeRenderText(this._textWrapper);this._isFocused||this._textWrapper.text||!this._placeholderText||((r=new R).text=this._placeholderText,this._placeholderColor&&(t.fillStyle=this._placeholderColor)),this._textWidth=t.measureText(r.text).width;var n=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+n)+"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)-n;if(t.save(),t.beginPath(),t.rect(o,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,s+2,this._currentMeasure.height),t.clip(),this._isFocused&&this._textWidth>s){var l=o-this._textWidth+s;this._scrollLeft||(this._scrollLeft=l)}else this._scrollLeft=o;if(this.outlineWidth&&t.strokeText(r.text,this._scrollLeft,this._currentMeasure.top+a),t.fillText(r.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(r.substr(r.length-this._cursorOffset,this._cursorOffset)).width}while(h<_&&r.length>=this._cursorOffset);Math.abs(_-h)>c&&this._cursorOffset--,this._blinkIsEven=!1,this._clickedCoordinate=null}if(!this._blinkIsEven){var u=r.substr(r.length-this._cursorOffset),d=t.measureText(u).width,f=this._scrollLeft+this._textWidth-d;f<o?(this._scrollLeft+=o-f,f=o,this._markAsDirty()):f>o+s&&(this._scrollLeft+=o+s-f,f=o+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(r.substring(this._startHighlightIndex)).width,g=this._scrollLeft+this._textWidth-p;this._highlightedText=r.substring(this._startHighlightIndex,this._endHighlightIndex);var b=t.measureText(r.substring(this._startHighlightIndex,this._endHighlightIndex)).width;g<o&&((b-=o-g)||(b=t.measureText(r.charAt(r.length-this._cursorOffset)).width),g=o),t.globalAlpha=this._highligherOpacity,t.fillStyle=this._textHighlightColor,t.fillRect(g,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,b,this._fontOffset.height),t.globalAlpha=1}}t.restore(),this._thickness&&(this._isFocused?this.focusedColor&&(t.strokeStyle=this.focusedColor):this.color&&(t.strokeStyle=this.color),t.lineWidth=this._thickness,t.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness)),t.restore()},e.prototype._onPointerDown=function(e,i,o,r,n){return!(!t.prototype._onPointerDown.call(this,e,i,o,r,n)||!this.isReadOnly&&(this._clickedCoordinate=i.x,this.isTextHighlightOn=!1,this._highlightedText="",this._cursorIndex=-1,this._isPointerDown=!0,this._host._capturingControl[o]=this,this._focusedBy=n.event.pointerType,this._host.focusedControl===this?(clearTimeout(this._blinkTimeout),this._markAsDirty(),0):!this._isEnabled||(this._host.focusedControl=this,0)))},e.prototype._onPointerMove=function(e,i,o,r){this._host.focusedControl===this&&this._isPointerDown&&!this.isReadOnly&&(this._clickedCoordinate=i.x,this._markAsDirty(),this._updateValueFromCursorIndex(this._cursorOffset)),t.prototype._onPointerMove.call(this,e,i,o,r)},e.prototype._onPointerUp=function(e,i,o,r,n){this._isPointerDown=!1,delete this._host._capturingControl[o],t.prototype._onPointerUp.call(this,e,i,o,r,n)},e.prototype._beforeRenderText=function(t){return t},Object.defineProperty(e.prototype,"isTextHighlightOn",{get:function(){return this._isTextHighlightOn},set:function(t){this._isTextHighlightOn!==t&&(t&&this.onTextHighlightObservable.notifyObservers(this),this._isTextHighlightOn=t)},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onBlurObservable.clear(),this.onFocusObservable.clear(),this.onTextChangedObservable.clear(),this.onTextCopyObservable.clear(),this.onTextCutObservable.clear(),this.onTextPasteObservable.clear(),this.onTextHighlightObservable.clear(),this.onKeyboardEventProcessedObservable.clear()},s([(0,h.serialize)()],e.prototype,"promptMessage",void 0),s([(0,h.serialize)()],e.prototype,"disableMobilePrompt",void 0),s([(0,h.serialize)()],e.prototype,"maxWidth",null),s([(0,h.serialize)()],e.prototype,"highligherOpacity",null),s([(0,h.serialize)()],e.prototype,"onFocusSelectAll",null),s([(0,h.serialize)()],e.prototype,"textHighlightColor",null),s([(0,h.serialize)()],e.prototype,"margin",null),s([(0,h.serialize)()],e.prototype,"autoStretchWidth",null),s([(0,h.serialize)()],e.prototype,"thickness",null),s([(0,h.serialize)()],e.prototype,"focusedBackground",null),s([(0,h.serialize)()],e.prototype,"focusedColor",null),s([(0,h.serialize)()],e.prototype,"background",null),s([(0,h.serialize)()],e.prototype,"placeholderColor",null),s([(0,h.serialize)()],e.prototype,"placeholderText",null),s([(0,h.serialize)()],e.prototype,"deadKey",null),s([(0,h.serialize)()],e.prototype,"text",null),s([(0,h.serialize)()],e.prototype,"width",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.InputText",w);var M=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._rowDefinitions=new Array,i._rowDefinitionObservers=[],i._columnDefinitions=new Array,i._columnDefinitionObservers=[],i._cells={},i._childControls=new Array,i}return n(e,t),Object.defineProperty(e.prototype,"clipContent",{get:function(){return this._clipContent},set:function(t){for(var e in this._clipContent=t,this._cells)this._cells[e].clipContent=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clipChildren",{get:function(){return this._clipChildren},set:function(t){for(var e in this._clipChildren=t,this._cells)this._cells[e].clipChildren=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"columnCount",{get:function(){return this._columnDefinitions.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rowCount",{get:function(){return this._rowDefinitions.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){return this._childControls},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cells",{get:function(){return this._cells},enumerable:!1,configurable:!0}),e.prototype.getRowDefinition=function(t){return t<0||t>=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 c(t,e?c.UNITMODE_PIXEL:c.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 c(t,e?c.UNITMODE_PIXEL:c.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 o=this;if(void 0===i&&(i=!1),t<0||t>=this._rowDefinitions.length)return this;var r=this._rowDefinitions[t];return r&&r.isPixel===i&&r.value===e||(this._rowDefinitions[t].onChangedObservable.remove(this._rowDefinitionObservers[t]),this._rowDefinitions[t]=new c(e,i?c.UNITMODE_PIXEL:c.UNITMODE_PERCENTAGE),this._rowDefinitionObservers[t]=this._rowDefinitions[t].onChangedObservable.add((function(){return o._markAsDirty()})),this._markAsDirty()),this},e.prototype.setColumnDefinition=function(t,e,i){var o=this;if(void 0===i&&(i=!1),t<0||t>=this._columnDefinitions.length)return this;var r=this._columnDefinitions[t];return r&&r.isPixel===i&&r.value===e||(this._columnDefinitions[t].onChangedObservable.remove(this._columnDefinitionObservers[t]),this._columnDefinitions[t]=new c(e,i?c.UNITMODE_PIXEL:c.UNITMODE_PERCENTAGE),this._columnDefinitionObservers[t]=this._columnDefinitions[t].onChangedObservable.add((function(){return o._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 o=0,r=e.children;o<r.length;o++){var n=r[o],a=this._childControls.indexOf(n);-1!==a&&this._childControls.splice(a,1)}delete this._cells[i]}},e.prototype._offsetCell=function(t,e){if(this._cells[e]){this._cells[t]=this._cells[e];for(var i=0,o=this._cells[t].children;i<o.length;i++)o[i]._tag=t;delete this._cells[e]}},e.prototype.removeColumnDefinition=function(t){if(t<0||t>=this._columnDefinitions.length)return this;for(var e=0;e<this._rowDefinitions.length;e++){var i="".concat(e,":").concat(t),o=this._cells[i];this._removeCell(o,i)}for(e=0;e<this._rowDefinitions.length;e++)for(var r=t+1;r<this._columnDefinitions.length;r++){var n="".concat(e,":").concat(r-1);i="".concat(e,":").concat(r),this._offsetCell(n,i)}return this._columnDefinitions[t].onChangedObservable.remove(this._columnDefinitionObservers[t]),this._columnDefinitions.splice(t,1),this._columnDefinitionObservers.splice(t,1),this._markAsDirty(),this},e.prototype.removeRowDefinition=function(t){if(t<0||t>=this._rowDefinitions.length)return this;for(var e=0;e<this._columnDefinitions.length;e++){var i="".concat(t,":").concat(e),o=this._cells[i];this._removeCell(o,i)}for(e=0;e<this._columnDefinitions.length;e++)for(var r=t+1;r<this._rowDefinitions.length;r++){var n="".concat(r-1,":").concat(e);i="".concat(r,":").concat(e),this._offsetCell(n,i)}return this._rowDefinitions[t].onChangedObservable.remove(this._rowDefinitionObservers[t]),this._rowDefinitions.splice(t,1),this._rowDefinitionObservers.splice(t,1),this._markAsDirty(),this},e.prototype.addControl=function(e,i,o){if(void 0===i&&(i=0),void 0===o&&(o=0),0===this._rowDefinitions.length&&this.addRowDefinition(1,!1),0===this._columnDefinitions.length&&this.addColumnDefinition(1,!1),-1!==this._childControls.indexOf(e))return h.Tools.Warn("Control (Name:".concat(e.name,", UniqueId:").concat(e.uniqueId,") is already associated with this grid. You must remove it before reattaching it")),this;var r=Math.min(i,this._rowDefinitions.length-1),n=Math.min(o,this._columnDefinitions.length-1),a="".concat(r,":").concat(n),s=this._cells[a];return s||(s=new x(a),this._cells[a]=s,s.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,s.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,s.clipContent=this.clipContent,s.clipChildren=this.clipChildren,t.prototype.addControl.call(this,s)),s.addControl(e),this._childControls.push(e),e._tag=a,e.parent=this,this._markAsDirty(),this},e.prototype.removeControl=function(t){var e=this._childControls.indexOf(t);-1!==e&&this._childControls.splice(e,1);var i=this._cells[t._tag];return i&&(i.removeControl(t),t._tag=null),this._markAsDirty(),this},e.prototype._getTypeName=function(){return"Grid"},e.prototype._getGridDefinitions=function(t){for(var e=[],i=[],o=[],r=[],n=this._currentMeasure.width,a=0,s=this._currentMeasure.height,l=0,_=0,h=0,c=this._rowDefinitions;h<c.length;h++)(g=c[h]).isPixel?(s-=p=g.getValue(this._host),i[_]=p):l+=g.value,_++;var u=0;_=0;for(var d=0,f=this._rowDefinitions;d<f.length;d++){var p,g=f[d];r.push(u),g.isPixel?u+=g.getValue(this._host):(u+=p=Math.round(g.value/l*s),i[_]=p),_++}_=0;for(var b=0,m=this._columnDefinitions;b<m.length;b++)(I=m[b]).isPixel?(n-=P=I.getValue(this._host),e[_]=P):a+=I.value,_++;var v=0;_=0;for(var y=0,x=this._columnDefinitions;y<x.length;y++){var P,I=x[y];o.push(v),I.isPixel?v+=I.getValue(this._host):(v+=P=Math.round(I.value/a*n),e[_]=P),_++}t(o,r,e,i)},e.prototype._additionalProcessing=function(e,i){var o=this;this._getGridDefinitions((function(t,e,i,r){for(var n in o._cells)if(Object.prototype.hasOwnProperty.call(o._cells,n)){var a=n.split(":"),s=parseInt(a[0]),l=parseInt(a[1]),_=o._cells[n];_.leftInPixels=t[l],_.topInPixels=e[s],_.widthInPixels=i[l],_.heightInPixels=r[s],_._left.ignoreAdaptiveScaling=!0,_._top.ignoreAdaptiveScaling=!0,_._width.ignoreAdaptiveScaling=!0,_._height.ignoreAdaptiveScaling=!0}})),t.prototype._additionalProcessing.call(this,e,i)},e.prototype._flagDescendantsAsMatrixDirty=function(){for(var t in this._cells)Object.prototype.hasOwnProperty.call(this._cells,t)&&this._cells[t]._markMatrixAsDirty()},e.prototype._renderHighlightSpecific=function(e){var i=this;t.prototype._renderHighlightSpecific.call(this,e),this._getGridDefinitions((function(t,o,r,n){for(var a=0;a<t.length;a++){var s=i._currentMeasure.left+t[a]+r[a];e.beginPath(),e.moveTo(s,i._currentMeasure.top),e.lineTo(s,i._currentMeasure.top+i._currentMeasure.height),e.stroke()}for(a=0;a<o.length;a++){var l=i._currentMeasure.top+o[a]+n[a];e.beginPath(),e.moveTo(i._currentMeasure.left,l),e.lineTo(i._currentMeasure.left+i._currentMeasure.width,l),e.stroke()}})),e.restore()},e.prototype.dispose=function(){t.prototype.dispose.call(this);for(var e=0,i=this._childControls;e<i.length;e++)i[e].dispose();for(var o=0;o<this._rowDefinitions.length;o++)this._rowDefinitions[o].onChangedObservable.remove(this._rowDefinitionObservers[o]);for(o=0;o<this._columnDefinitions.length;o++)this._columnDefinitions[o].onChangedObservable.remove(this._columnDefinitionObservers[o]);this._rowDefinitionObservers.length=0,this._rowDefinitions.length=0,this._columnDefinitionObservers.length=0,this._columnDefinitions.length=0,this._cells={},this._childControls.length=0},e.prototype.serialize=function(e,i){if(t.prototype.serialize.call(this,e,i),this.isSerializable||i){e.columnCount=this.columnCount,e.rowCount=this.rowCount,e.columns=[],e.rows=[],e.tags=[];for(var o=0;o<this.columnCount;++o){var r=this.getColumnDefinition(o),n={value:null==r?void 0:r.getValue(this.host),unit:null==r?void 0:r.unit};e.columns.push(n)}for(o=0;o<this.rowCount;++o){var a=this.getRowDefinition(o);n={value:null==a?void 0:a.getValue(this.host),unit:null==a?void 0:a.unit},e.rows.push(n)}this.children.forEach((function(t){e.tags.push(t._tag)}))}},e.prototype._parseFromContent=function(e,i){t.prototype._parseFromContent.call(this,e,i);var o=[];this.children.forEach((function(t){o.push(t)})),this.removeRowDefinition(0),this.removeColumnDefinition(0);for(var r=0;r<e.columnCount;++r){var n=e.columns[r].value,a=e.columns[r].unit;this.addColumnDefinition(n,1===a)}for(r=0;r<e.rowCount;++r){var s=e.rows[r].value;a=e.rows[r].unit,this.addRowDefinition(s,1===a)}for(r=0;r<o.length;++r){var l=e.tags[r],_=parseInt(l.substring(0,l.search(":")));isNaN(_)&&(_=0);var h=parseInt(l.substring(l.search(":")+1));isNaN(h)&&(h=0),this.addControl(o[r],_,h)}},s([(0,h.serialize)()],e.prototype,"clipContent",null),e}(x);(0,h.RegisterClass)("BABYLON.GUI.Grid",M);var E=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._value=h.Color3.Red(),i._tmpColor=new h.Color3,i._pointerStartedOnSquare=!1,i._pointerStartedOnWheel=!1,i._squareLeft=0,i._squareTop=0,i._squareSize=0,i._h=360,i._s=1,i._v=1,i._lastPointerDownId=-1,i.onValueChangedObservable=new h.Observable,i._pointerIsDown=!1,i.value=new h.Color3(.88,.1,.1),i.size="200px",i.isPointerBlocker=!0,i}return n(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(t){this._value.equals(t)||(this._value.copyFrom(t),this._value.toHSVToRef(this._tmpColor),this._h=this._tmpColor.r,this._s=Math.max(this._tmpColor.g,1e-5),this._v=Math.max(this._tmpColor.b,1e-5),this._markAsDirty(),this._value.r<=e._Epsilon&&(this._value.r=0),this._value.g<=e._Epsilon&&(this._value.g=0),this._value.b<=e._Epsilon&&(this._value.b=0),this._value.r>=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){t.width<t.height?this._currentMeasure.height=t.width:this._currentMeasure.width=t.height},e.prototype._updateSquareProps=function(){var t=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),e=2*(t-.2*t)/Math.sqrt(2),i=t-.5*e;this._squareLeft=this._currentMeasure.left+i,this._squareTop=this._currentMeasure.top+i,this._squareSize=e},e.prototype._drawGradientSquare=function(t,e,i,o,r,n){var a=n.createLinearGradient(e,i,o+e,i);a.addColorStop(0,"#fff"),a.addColorStop(1,"hsl("+t+", 100%, 50%)"),n.fillStyle=a,n.fillRect(e,i,o,r);var s=n.createLinearGradient(e,i,e,r+i);s.addColorStop(0,"rgba(0,0,0,0)"),s.addColorStop(1,"#000"),n.fillStyle=s,n.fillRect(e,i,o,r)},e.prototype._drawCircle=function(t,e,i,o){o.beginPath(),o.arc(t,e,i+1,0,2*Math.PI,!1),o.lineWidth=3,o.strokeStyle="#333333",o.stroke(),o.beginPath(),o.arc(t,e,i,0,2*Math.PI,!1),o.lineWidth=3,o.strokeStyle="#ffffff",o.stroke()},e.prototype._createColorWheelCanvas=function(t,e){var i=h.EngineStore.LastCreatedEngine;if(!i)throw new Error("Invalid engine. Unable to create a canvas.");for(var o=i.createCanvas(2*t,2*t),r=o.getContext("2d"),n=r.getImageData(0,0,2*t,2*t),a=n.data,s=this._tmpColor,l=t*t,_=t-e,c=_*_,u=-t;u<t;u++)for(var d=-t;d<t;d++){var f=u*u+d*d;if(!(f>l||f<c)){var p=Math.sqrt(f),g=Math.atan2(d,u);h.Color3.HSVtoRGBToRef(180*g/Math.PI+180,p/t,1,s);var b=4*(u+t+2*(d+t)*t);a[b]=255*s.r,a[b+1]=255*s.g,a[b+2]=255*s.b;var m,v;v=t<50?.2:t>150?.04:-.16*(t-50)/100+.2,m=(p-_)/(t-_),a[b+3]=m<v?m/v*255:m>1-v?255*(1-(m-(1-v))/v):255}}return r.putImageData(n,0,0),o},e.prototype._draw=function(t){t.save(),this._applyStates(t);var e=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),i=.2*e,o=this._currentMeasure.left,r=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,o,r),(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 n=this._squareLeft+this._squareSize*this._s,a=this._squareTop+this._squareSize*(1-this._v);this._drawCircle(n,a,.04*e,t);var s=e-.5*i;n=o+e+Math.cos((this._h-180)*Math.PI/180)*s,a=r+e+Math.sin((this._h-180)*Math.PI/180)*s,this._drawCircle(n,a,.35*i,t),t.restore()},e.prototype._updateValueFromPointer=function(t,i){if(this._pointerStartedOnWheel){var o=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),r=o+this._currentMeasure.left,n=o+this._currentMeasure.top;this._h=180*Math.atan2(i-n,t-r)/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));h.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,o=this._squareTop,r=this._squareSize;return t>=i&&t<=i+r&&e>=o&&e<=o+r},e.prototype._isPointOnWheel=function(t,e){var i=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),o=i-.2*i,r=t-(i+this._currentMeasure.left),n=e-(i+this._currentMeasure.top),a=r*r+n*n;return a<=i*i&&a>=o*o},e.prototype._onPointerDown=function(e,i,o,r,n){if(!t.prototype._onPointerDown.call(this,e,i,o,r,n))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[o]=this,this._lastPointerDownId=o,!0},e.prototype._onPointerMove=function(e,i,o,r){if(o==this._lastPointerDownId){if(!this.isReadOnly){this._invertTransformMatrix.transformCoordinates(i.x,i.y,this._transformedPosition);var n=this._transformedPosition.x,a=this._transformedPosition.y;this._pointerIsDown&&this._updateValueFromPointer(n,a)}t.prototype._onPointerMove.call(this,e,i,o,r)}},e.prototype._onPointerUp=function(e,i,o,r,n,a){this._pointerIsDown=!1,delete this._host._capturingControl[o],t.prototype._onPointerUp.call(this,e,i,o,r,n,a)},e.prototype._onCanvasBlur=function(){this._forcePointerUp(),t.prototype._onCanvasBlur.call(this)},e.ShowPickerDialogAsync=function(t,i){return new Promise((function(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,n,a,s,l,_,c,u=i.swatchLimit/i.numSwatchesPerLine,d=parseFloat(i.pickerWidth)/i.numSwatchesPerLine,f=Math.floor(.25*d),p=f*(i.numSwatchesPerLine+1),g=Math.floor((parseFloat(i.pickerWidth)-p)/i.numSwatchesPerLine),b=g*u+f*(u+1),m=(parseInt(i.pickerHeight)+b+Math.floor(.25*g)).toString()+"px",v="#c0c0c0",x="#535353",P="#414141",C="515151",S="#555555",O="#454545",R=h.Color3.FromHexString("#dddddd"),E=R.r+R.g+R.b,F="#aaaaaa",D="#ffffff",L=["R","G","B"],k="#454545",N="#f0f0f0",A=!1,z=new M;if(z.name="Dialog Container",z.width=i.pickerWidth,i.savedColors){z.height=m;var Q=parseInt(i.pickerHeight)/parseInt(m);z.addRowDefinition(Q,!1),z.addRowDefinition(1-Q,!1)}else z.height=i.pickerHeight,z.addRowDefinition(1,!1);if(t.addControl(z),i.savedColors){(s=new M).name="Swatch Drawer",s.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,s.background=x,s.width=i.pickerWidth;var V,W=i.savedColors.length/i.numSwatchesPerLine;V=0==W?0:W+1,s.height=(g*W+V*f).toString()+"px",s.top=Math.floor(.25*g).toString()+"px";for(var H=0;H<2*Math.ceil(i.savedColors.length/i.numSwatchesPerLine)+1;H++)H%2!=0?s.addRowDefinition(g,!0):s.addRowDefinition(f,!0);for(H=0;H<2*i.numSwatchesPerLine+1;H++)H%2!=0?s.addColumnDefinition(g,!0):s.addColumnDefinition(f,!0);z.addControl(s,1,0)}var G=new M;G.name="Picker Panel",G.height=i.pickerHeight;var U=parseInt(i.headerHeight)/parseInt(i.pickerHeight),j=[U,1-U];G.addRowDefinition(j[0],!1),G.addRowDefinition(j[1],!1),z.addControl(G,0,0);var Y=new I;Y.name="Dialogue Header Bar",Y.background="#cccccc",Y.thickness=0,G.addControl(Y,0,0);var X=T.CreateSimpleButton("closeButton","a");X.fontFamily="coreglyphs";var K=h.Color3.FromHexString(Y.background),Z=new h.Color3(1-K.r,1-K.g,1-K.b);X.color=Z.toHexString(),X.fontSize=Math.floor(.6*parseInt(i.headerHeight)),X.textBlock.textVerticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,X.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_RIGHT,X.height=X.width=i.headerHeight,X.background=Y.background,X.thickness=0,X.pointerDownAnimation=function(){},X.pointerUpAnimation=function(){X.background=Y.background},X.pointerEnterAnimation=function(){X.color=Y.background,X.background="red"},X.pointerOutAnimation=function(){X.color=Z.toHexString(),X.background=Y.background},X.onPointerClickObservable.add((function(){Gt(dt.background)})),G.addControl(X,0,0);var q=new M;q.name="Dialogue Body",q.background=x;var J=[.4375,.5625];q.addRowDefinition(1,!1),q.addColumnDefinition(J[0],!1),q.addColumnDefinition(J[1],!1),G.addControl(q,1,0);var $=new M;$.name="Picker Grid",$.addRowDefinition(.85,!1),$.addRowDefinition(.15,!1),q.addControl($,0,0);var tt=new e;tt.name="GUI Color Picker",i.pickerHeight<i.pickerWidth?tt.width=.89:tt.height=.89,tt.value=h.Color3.FromHexString(i.lastColor),tt.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_CENTER,tt.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,tt.onPointerDownObservable.add((function(){c=tt.name,_="",Qt(!1)})),tt.onValueChangedObservable.add((function(t){c==tt.name&&kt(t,tt.name)})),$.addControl(tt,0,0);var et=new M;et.name="Dialogue Right Half",et.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT;var it=[.514,.486];et.addRowDefinition(it[0],!1),et.addRowDefinition(it[1],!1),q.addControl(et,1,1);var ot=new M;ot.name="Swatches and Buttons";var rt=[.417,.583];ot.addRowDefinition(1,!1),ot.addColumnDefinition(rt[0],!1),ot.addColumnDefinition(rt[1],!1),et.addControl(ot,0,0);var nt=new M;nt.name="New and Current Swatches";var at=[.04,.16,.64,.16];nt.addRowDefinition(at[0],!1),nt.addRowDefinition(at[1],!1),nt.addRowDefinition(at[2],!1),nt.addRowDefinition(at[3],!1),ot.addControl(nt,0,0);var st=new M;st.name="Active Swatches",st.width=.67,st.addRowDefinition(.5,!1),st.addRowDefinition(.5,!1),nt.addControl(st,2,0);var lt,_t=Math.floor(parseInt(i.pickerWidth)*J[1]*rt[0]*.11),ht=Math.floor(parseInt(i.pickerHeight)*j[1]*it[0]*at[1]*.5);lt=i.pickerWidth>i.pickerHeight?ht:_t;var ct=new B;ct.text="new",ct.name="New Color Label",ct.color=v,ct.fontSize=lt,nt.addControl(ct,1,0);var ut=new I;ut.name="New Color Swatch",ut.background=i.lastColor,ut.thickness=0,st.addControl(ut,0,0);var dt=T.CreateSimpleButton("currentSwatch","");dt.background=i.lastColor,dt.thickness=0,dt.onPointerClickObservable.add((function(){kt(h.Color3.FromHexString(dt.background),dt.name),Qt(!1)})),dt.pointerDownAnimation=function(){},dt.pointerUpAnimation=function(){},dt.pointerEnterAnimation=function(){},dt.pointerOutAnimation=function(){},st.addControl(dt,1,0);var ft=new I;ft.name="Swatch Outline",ft.width=.67,ft.thickness=2,ft.color="#404040",ft.isHitTestVisible=!1,nt.addControl(ft,2,0);var pt=new B;pt.name="Current Color Label",pt.text="current",pt.color=v,pt.fontSize=lt,nt.addControl(pt,3,0);var gt=new M;gt.name="Button Grid",gt.height=.8;var bt=1/3;gt.addRowDefinition(bt,!1),gt.addRowDefinition(bt,!1),gt.addRowDefinition(bt,!1),ot.addControl(gt,0,1);var mt=Math.floor(parseInt(i.pickerWidth)*J[1]*rt[1]*.67).toString()+"px",vt=Math.floor(parseInt(i.pickerHeight)*j[1]*it[0]*(parseFloat(gt.height.toString())/100)*bt*.7).toString()+"px";r=parseFloat(mt)>parseFloat(vt)?Math.floor(.45*parseFloat(vt)):Math.floor(.11*parseFloat(mt));var yt=T.CreateSimpleButton("butOK","OK");yt.width=mt,yt.height=vt,yt.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,yt.thickness=2,yt.color=v,yt.fontSize=r,yt.background=x,yt.onPointerEnterObservable.add((function(){yt.background=P})),yt.onPointerOutObservable.add((function(){yt.background=x})),yt.pointerDownAnimation=function(){yt.background=C},yt.pointerUpAnimation=function(){yt.background=P},yt.onPointerClickObservable.add((function(){Qt(!1),Gt(ut.background)})),gt.addControl(yt,0,0);var xt=T.CreateSimpleButton("butCancel","Cancel");xt.width=mt,xt.height=vt,xt.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,xt.thickness=2,xt.color=v,xt.fontSize=r,xt.background=x,xt.onPointerEnterObservable.add((function(){xt.background=P})),xt.onPointerOutObservable.add((function(){xt.background=x})),xt.pointerDownAnimation=function(){xt.background=C},xt.pointerUpAnimation=function(){xt.background=P},xt.onPointerClickObservable.add((function(){Qt(!1),Gt(dt.background)})),gt.addControl(xt,1,0),i.savedColors&&((l=T.CreateSimpleButton("butSave","Save")).width=mt,l.height=vt,l.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,l.thickness=2,l.fontSize=r,i.savedColors.length<i.swatchLimit?(l.color=v,l.background=x):Ht(l,!0),l.onPointerEnterObservable.add((function(){i.savedColors&&i.savedColors.length<i.swatchLimit&&(l.background=P)})),l.onPointerOutObservable.add((function(){i.savedColors&&i.savedColors.length<i.swatchLimit&&(l.background=x)})),l.pointerDownAnimation=function(){i.savedColors&&i.savedColors.length<i.swatchLimit&&(l.background=C)},l.pointerUpAnimation=function(){i.savedColors&&i.savedColors.length<i.swatchLimit&&(l.background=P)},l.onPointerClickObservable.add((function(){i.savedColors&&(0==i.savedColors.length&&Wt(!0),i.savedColors.length<i.swatchLimit&&Vt(ut.background,l),Qt(!1))})),i.savedColors.length>0&&Wt(!0),gt.addControl(l,2,0));var Pt=new M;Pt.name="Dialog Lower Right",Pt.addRowDefinition(.02,!1),Pt.addRowDefinition(.63,!1),Pt.addRowDefinition(.21,!1),Pt.addRowDefinition(.14,!1),et.addControl(Pt,1,0);var It=h.Color3.FromHexString(i.lastColor),Bt=new M;for(Bt.name="RGB Values",Bt.width=.82,Bt.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,Bt.addRowDefinition(1/3,!1),Bt.addRowDefinition(1/3,!1),Bt.addRowDefinition(1/3,!1),Bt.addColumnDefinition(.1,!1),Bt.addColumnDefinition(.2,!1),Bt.addColumnDefinition(.7,!1),Pt.addControl(Bt,1,0),H=0;H<L.length;H++){var Ct=new B;Ct.text=L[H],Ct.color=v,Ct.fontSize=r,Bt.addControl(Ct,H,0)}var Tt=new w;Tt.width=.83,Tt.height=.72,Tt.name="rIntField",Tt.fontSize=r,Tt.text=(255*It.r).toString(),Tt.color=N,Tt.background=k,Tt.onFocusObservable.add((function(){c=Tt.name,_=Tt.text,Qt(!1)})),Tt.onBlurObservable.add((function(){""==Tt.text&&(Tt.text="0"),Nt(Tt,"r"),c==Tt.name&&(c="")})),Tt.onTextChangedObservable.add((function(){c==Tt.name&&Nt(Tt,"r")})),Bt.addControl(Tt,0,1);var St=new w;St.width=.83,St.height=.72,St.name="gIntField",St.fontSize=r,St.text=(255*It.g).toString(),St.color=N,St.background=k,St.onFocusObservable.add((function(){c=St.name,_=St.text,Qt(!1)})),St.onBlurObservable.add((function(){""==St.text&&(St.text="0"),Nt(St,"g"),c==St.name&&(c="")})),St.onTextChangedObservable.add((function(){c==St.name&&Nt(St,"g")})),Bt.addControl(St,1,1);var Ot=new w;Ot.width=.83,Ot.height=.72,Ot.name="bIntField",Ot.fontSize=r,Ot.text=(255*It.b).toString(),Ot.color=N,Ot.background=k,Ot.onFocusObservable.add((function(){c=Ot.name,_=Ot.text,Qt(!1)})),Ot.onBlurObservable.add((function(){""==Ot.text&&(Ot.text="0"),Nt(Ot,"b"),c==Ot.name&&(c="")})),Ot.onTextChangedObservable.add((function(){c==Ot.name&&Nt(Ot,"b")})),Bt.addControl(Ot,2,1);var Rt=new w;Rt.width=.95,Rt.height=.72,Rt.name="rDecField",Rt.fontSize=r,Rt.text=It.r.toString(),Rt.color=N,Rt.background=k,Rt.onFocusObservable.add((function(){c=Rt.name,_=Rt.text,Qt(!1)})),Rt.onBlurObservable.add((function(){0!=parseFloat(Rt.text)&&""!=Rt.text||(Rt.text="0",At(Rt,"r")),c==Rt.name&&(c="")})),Rt.onTextChangedObservable.add((function(){c==Rt.name&&At(Rt,"r")})),Bt.addControl(Rt,0,2);var wt=new w;wt.width=.95,wt.height=.72,wt.name="gDecField",wt.fontSize=r,wt.text=It.g.toString(),wt.color=N,wt.background=k,wt.onFocusObservable.add((function(){c=wt.name,_=wt.text,Qt(!1)})),wt.onBlurObservable.add((function(){0!=parseFloat(wt.text)&&""!=wt.text||(wt.text="0",At(wt,"g")),c==wt.name&&(c="")})),wt.onTextChangedObservable.add((function(){c==wt.name&&At(wt,"g")})),Bt.addControl(wt,1,2);var Mt=new w;Mt.width=.95,Mt.height=.72,Mt.name="bDecField",Mt.fontSize=r,Mt.text=It.b.toString(),Mt.color=N,Mt.background=k,Mt.onFocusObservable.add((function(){c=Mt.name,_=Mt.text,Qt(!1)})),Mt.onBlurObservable.add((function(){0!=parseFloat(Mt.text)&&""!=Mt.text||(Mt.text="0",At(Mt,"b")),c==Mt.name&&(c="")})),Mt.onTextChangedObservable.add((function(){c==Mt.name&&At(Mt,"b")})),Bt.addControl(Mt,2,2);var Et=new M;Et.name="Hex Value",Et.width=.82,Et.addRowDefinition(1,!1),Et.addColumnDefinition(.1,!1),Et.addColumnDefinition(.9,!1),Pt.addControl(Et,2,0);var Ft=new B;Ft.text="#",Ft.color=v,Ft.fontSize=r,Et.addControl(Ft,0,0);var Dt=new w;Dt.width=.96,Dt.height=.72,Dt.name="hexField",Dt.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_CENTER,Dt.fontSize=r;var Lt=i.lastColor.split("#");function kt(t,e){c=e;var i=t.toHexString();if(ut.background=i,Tt.name!=c&&(Tt.text=Math.floor(255*t.r).toString()),St.name!=c&&(St.text=Math.floor(255*t.g).toString()),Ot.name!=c&&(Ot.text=Math.floor(255*t.b).toString()),Rt.name!=c&&(Rt.text=t.r.toString()),wt.name!=c&&(wt.text=t.g.toString()),Mt.name!=c&&(Mt.text=t.b.toString()),Dt.name!=c){var o=i.split("#");Dt.text=o[1]}tt.name!=c&&(tt.value=t)}function Nt(t,e){var i=t.text;if(/[^0-9]/g.test(i))t.text=_;else if(""!=i&&(Math.floor(parseInt(i))<0?i="0":Math.floor(parseInt(i))>255?i="255":isNaN(parseInt(i))&&(i="0")),c==t.name&&(_=i),""!=i){i=parseInt(i).toString(),t.text=i;var o=h.Color3.FromHexString(ut.background);c==t.name&&kt("r"==e?new h.Color3(parseInt(i)/255,o.g,o.b):"g"==e?new h.Color3(o.r,parseInt(i)/255,o.b):new h.Color3(o.r,o.g,parseInt(i)/255),t.name)}}function At(t,e){var i=t.text;if(/[^0-9.]/g.test(i))t.text=_;else{""!=i&&"."!=i&&0!=parseFloat(i)&&(parseFloat(i)<0?i="0.0":parseFloat(i)>1?i="1.0":isNaN(parseFloat(i))&&(i="0.0")),c==t.name&&(_=i),""!=i&&"."!=i&&0!=parseFloat(i)?(i=parseFloat(i).toString(),t.text=i):i="0.0";var o=h.Color3.FromHexString(ut.background);c==t.name&&kt("r"==e?new h.Color3(parseFloat(i),o.g,o.b):"g"==e?new h.Color3(o.r,parseFloat(i),o.b):new h.Color3(o.r,o.g,parseFloat(i)),t.name)}}function zt(){if(i.savedColors&&i.savedColors[a]){var t;t=A?"b":"";var e=T.CreateSimpleButton("Swatch_"+a,t);e.fontFamily="coreglyphs";var o=h.Color3.FromHexString(i.savedColors[a]),r=o.r+o.g+o.b;e.color=r>E?F:D,e.fontSize=Math.floor(.7*g),e.textBlock.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,e.height=e.width=g.toString()+"px",e.background=i.savedColors[a],e.thickness=2;var n=a;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;A?(t=n,i.savedColors&&i.savedColors.splice(t,1),i.savedColors&&0==i.savedColors.length&&(Wt(!1),A=!1),Vt("",l)):i.savedColors&&kt(h.Color3.FromHexString(i.savedColors[n]),e.name)})),e}return null}function Qt(t){if(void 0!==t&&(A=t),A){for(var e=0;e<s.children.length;e++)s.children[e].textBlock.text="b";void 0!==n&&(n.textBlock.text="Done")}else{for(e=0;e<s.children.length;e++)s.children[e].textBlock.text="";void 0!==n&&(n.textBlock.text="Edit")}}function Vt(t,e){if(i.savedColors){""!=t&&i.savedColors.push(t),a=0,s.clearControls();var o,r=Math.ceil(i.savedColors.length/i.numSwatchesPerLine);if(o=0==r?0:r+1,s.rowCount!=r+o){for(var n=s.rowCount,l=0;l<n;l++)s.removeRowDefinition(0);for(l=0;l<r+o;l++)l%2?s.addRowDefinition(g,!0):s.addRowDefinition(f,!0)}s.height=(g*r+o*f).toString()+"px";for(var _=1,h=1;_<r+o;_+=2,h++){var c;c=i.savedColors.length>h*i.numSwatchesPerLine?i.numSwatchesPerLine:i.savedColors.length-(h-1)*i.numSwatchesPerLine;for(var u=Math.min(Math.max(c,0),i.numSwatchesPerLine),d=0,p=1;d<u;d++)if(!(d>i.numSwatchesPerLine)){var b=zt();null!=b&&(s.addControl(b,_,p),p+=2,a++)}}i.savedColors.length>=i.swatchLimit?Ht(e,!0):Ht(e,!1)}}function Wt(t){t?((n=T.CreateSimpleButton("butEdit","Edit")).width=mt,n.height=vt,n.left=Math.floor(.1*parseInt(mt)).toString()+"px",n.top=(-1*parseFloat(n.left)).toString()+"px",n.verticalAlignment=y.VERTICAL_ALIGNMENT_BOTTOM,n.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,n.thickness=2,n.color=v,n.fontSize=r,n.background=x,n.onPointerEnterObservable.add((function(){n.background=P})),n.onPointerOutObservable.add((function(){n.background=x})),n.pointerDownAnimation=function(){n.background=C},n.pointerUpAnimation=function(){n.background=P},n.onPointerClickObservable.add((function(){A=!A,Qt()})),$.addControl(n,1,0)):$.removeControl(n)}function Ht(t,e){e?(t.color=S,t.background=O):(t.color=v,t.background=x)}function Gt(e){i.savedColors&&i.savedColors.length>0?o({savedColors:i.savedColors,pickedColor:e}):o({pickedColor:e}),t.removeControl(z)}Dt.text=Lt[1],Dt.color=N,Dt.background=k,Dt.onFocusObservable.add((function(){c=Dt.name,_=Dt.text,Qt(!1)})),Dt.onBlurObservable.add((function(){if(3==Dt.text.length){var t=Dt.text.split("");Dt.text=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]}""==Dt.text&&(Dt.text="000000",kt(h.Color3.FromHexString(Dt.text),"b")),c==Dt.name&&(c="")})),Dt.onTextChangedObservable.add((function(){var t=Dt.text,e=/[^0-9A-F]/i.test(t);if((Dt.text.length>6||e)&&c==Dt.name)Dt.text=_;else{if(Dt.text.length<6)for(var i=6-Dt.text.length,o=0;o<i;o++)t="0"+t;if(3==Dt.text.length){var r=Dt.text.split("");t=r[0]+r[0]+r[1]+r[1]+r[2]+r[2]}t="#"+t,c==Dt.name&&(_=Dt.text,kt(h.Color3.FromHexString(t),Dt.name))}})),Et.addControl(Dt,0,1),i.savedColors&&i.savedColors.length>0&&Vt("",l)}))},e._Epsilon=1e-6,s([(0,h.serialize)()],e.prototype,"value",null),s([(0,h.serialize)()],e.prototype,"width",null),s([(0,h.serialize)()],e.prototype,"height",null),s([(0,h.serialize)()],e.prototype,"size",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.ColorPicker",E);var F=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thickness=1,i._arc=1,i}return n(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,"arc",{get:function(){return this._arc},set:function(t){this._arc!==t&&(this._arc=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),y.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,this._arc,t),(this._backgroundGradient||this._background)&&(t.fillStyle=this._getBackgroundColor(t),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){y.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2,this._currentMeasure.height/2,this._arc,t),t.clip()},e.prototype._renderHighlightSpecific=function(t){y.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,this._arc,t),t.stroke()},s([(0,h.serialize)()],e.prototype,"thickness",null),s([(0,h.serialize)()],e.prototype,"arc",null),e}(x);(0,h.RegisterClass)("BABYLON.GUI.Ellipse",F);var D=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 h.Observable,i.onBlurObservable=new h.Observable,i.onKeyboardEventProcessedObservable=new h.Observable,i._unfocusedColor=i.color,i}return n(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,o,r,n){return this.isReadOnly||this.focus(),t.prototype._onPointerDown.call(this,e,i,o,r,n)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onBlurObservable.clear(),this.onFocusObservable.clear(),this.onKeyboardEventProcessedObservable.clear()},e}(T);(0,h.RegisterClass)("BABYLON.GUI.FocusableButton",D);var L=function(t){function e(e,i){void 0===i&&(i="");var o=t.call(this,e)||this;return o.name=e,o._textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,o._textVerticalAlignment=y.VERTICAL_ALIGNMENT_TOP,o._prevText=o.text,o._lineSpacing=new c(0),o._maxHeight=new c(1,c.UNITMODE_PERCENTAGE,!1),o.onLinesReadyObservable=new h.Observable,o.text=i,o.isPointerBlocker=!0,o.onLinesReadyObservable.add((function(){return o._updateCursorPosition()})),o._highlightCursorInfo={initialStartIndex:-1,initialRelativeStartIndex:-1,initialLineIndex:-1},o._cursorInfo={globalStartIndex:0,globalEndIndex:0,relativeEndIndex:0,relativeStartIndex:0,currentLineIndex:0},o}return n(e,t),Object.defineProperty(e.prototype,"autoStretchHeight",{get:function(){return this._autoStretchHeight},set:function(t){this._autoStretchHeight!==t&&(this._autoStretchHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{set:function(t){this.fixedRatioMasterIsWidth=!1,this._height.toString(this._host)!==t&&(this._height.fromString(t)&&this._markAsDirty(),this._autoStretchHeight=!1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxHeight",{get:function(){return this._maxHeight.toString(this._host)},set:function(t){this._maxHeight.toString(this._host)!==t&&this._maxHeight.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxHeightInPixels",{get:function(){return this._maxHeight.getValueInPixel(this._host,this._cachedParentMeasure.height)},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"InputTextArea"},e.prototype.processKeyboard=function(t){this.isReadOnly||(this.alternativeProcessKey(t.code,t.key,t),this.onKeyboardEventProcessedObservable.notifyObservers(t))},e.prototype.alternativeProcessKey=function(t,e,i){if(!i||!i.ctrlKey&&!i.metaKey||"c"!==e&&"v"!==e&&"x"!==e){switch(t){case"Period":i&&i.shiftKey&&i.preventDefault();break;case"Backspace":!this._isTextHighlightOn&&this._cursorInfo.globalStartIndex>0&&(this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._cursorInfo.globalStartIndex--),this._prevText=this._textWrapper.text,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex),this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,i&&i.preventDefault(),this._blinkIsEven=!1,this._isTextHighlightOn=!1,this._textHasChanged();break;case"Delete":!this._isTextHighlightOn&&this._cursorInfo.globalEndIndex<this.text.length&&(this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex+1),this._prevText=this._textWrapper.text,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex),this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,i&&i.preventDefault(),this._blinkIsEven=!1,this._isTextHighlightOn=!1,this._textHasChanged();break;case"NumpadEnter":case"Enter":return this._prevText=this._textWrapper.text,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex,"\n"),this._cursorInfo.globalStartIndex++,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._textHasChanged();case"End":return this._cursorInfo.globalStartIndex=this.text.length,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._markAsDirty();case"Home":return this._cursorInfo.globalStartIndex=0,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._markAsDirty();case"ArrowLeft":return this._markAsDirty(),i&&i.shiftKey?((i.ctrlKey||i.metaKey)&&(this._cursorInfo.globalStartIndex-=this._cursorInfo.relativeStartIndex,this._cursorInfo.globalEndIndex=this._highlightCursorInfo.initialStartIndex),this._isTextHighlightOn?this._cursorInfo.globalEndIndex>this._highlightCursorInfo.initialStartIndex?this._cursorInfo.globalEndIndex--:this._cursorInfo.globalStartIndex--:(this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this._highlightCursorInfo.initialRelativeStartIndex=this._cursorInfo.relativeStartIndex,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._cursorInfo.globalStartIndex--,this._isTextHighlightOn=!0),this._blinkIsEven=!0,void i.preventDefault()):(this._isTextHighlightOn?this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex:i&&(i.ctrlKey||i.metaKey)?(this._cursorInfo.globalStartIndex-=this._cursorInfo.relativeStartIndex,i.preventDefault()):this._cursorInfo.globalStartIndex>0&&this._cursorInfo.globalStartIndex--,this._blinkIsEven=!1,void(this._isTextHighlightOn=!1));case"ArrowRight":if(this._markAsDirty(),i&&i.shiftKey){if(i.ctrlKey||i.metaKey){var o=this._lines[this._cursorInfo.currentLineIndex].text.length-this._cursorInfo.relativeEndIndex-1;this._cursorInfo.globalEndIndex+=o,this._cursorInfo.globalStartIndex=this._highlightCursorInfo.initialStartIndex}return this._isTextHighlightOn?this._cursorInfo.globalStartIndex<this._highlightCursorInfo.initialStartIndex?this._cursorInfo.globalStartIndex++:this._cursorInfo.globalEndIndex++:(this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this._highlightCursorInfo.initialRelativeStartIndex=this._cursorInfo.relativeStartIndex,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex++,this._isTextHighlightOn=!0),this._blinkIsEven=!0,void i.preventDefault()}return this._isTextHighlightOn?this._cursorInfo.globalStartIndex=this._cursorInfo.globalEndIndex:i&&(i.ctrlKey||i.metaKey)?(o=this._lines[this._cursorInfo.currentLineIndex].text.length-this._cursorInfo.relativeEndIndex,this._cursorInfo.globalStartIndex+=o):this._cursorInfo.globalStartIndex<this.text.length&&this._cursorInfo.globalStartIndex++,this._blinkIsEven=!1,void(this._isTextHighlightOn=!1);case"ArrowUp":if(this._blinkIsEven=!1,i&&(i.shiftKey?(this._isTextHighlightOn||(this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this._highlightCursorInfo.initialRelativeStartIndex=this._cursorInfo.relativeStartIndex),this._isTextHighlightOn=!0,this._blinkIsEven=!0):this._isTextHighlightOn=!1,i.preventDefault()),0===this._cursorInfo.currentLineIndex)this._cursorInfo.globalStartIndex=0;else{var r=this._lines[this._cursorInfo.currentLineIndex],n=this._lines[this._cursorInfo.currentLineIndex-1],a=0,s=0;!this._isTextHighlightOn||this._cursorInfo.currentLineIndex<this._highlightCursorInfo.initialLineIndex?(a=this._cursorInfo.globalStartIndex,s=this._cursorInfo.relativeStartIndex):(a=this._cursorInfo.globalEndIndex,s=this._cursorInfo.relativeEndIndex);var l=r.text.substr(0,s),_=this._contextForBreakLines.measureText(l).width,h=0,c=0;a-=s,a-=n.text.length+n.lineEnding.length;for(var u=0;h<_&&u<n.text.length;)a++,u++,c=Math.abs(_-h),h=this._contextForBreakLines.measureText(n.text.substr(0,u)).width;Math.abs(_-h)>c&&u>0&&a--,this._isTextHighlightOn?this._cursorInfo.currentLineIndex<=this._highlightCursorInfo.initialLineIndex?(this._cursorInfo.globalStartIndex=a,this._cursorInfo.globalEndIndex=this._highlightCursorInfo.initialStartIndex,this._cursorInfo.relativeEndIndex=this._highlightCursorInfo.initialRelativeStartIndex):this._cursorInfo.globalEndIndex=a:this._cursorInfo.globalStartIndex=a}return void this._markAsDirty();case"ArrowDown":if(this._blinkIsEven=!1,i&&(i.shiftKey?(this._isTextHighlightOn||(this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this._highlightCursorInfo.initialRelativeStartIndex=this._cursorInfo.relativeStartIndex),this._isTextHighlightOn=!0,this._blinkIsEven=!0):this._isTextHighlightOn=!1,i.preventDefault()),this._cursorInfo.currentLineIndex===this._lines.length-1)this._cursorInfo.globalStartIndex=this.text.length;else{r=this._lines[this._cursorInfo.currentLineIndex];var d=this._lines[this._cursorInfo.currentLineIndex+1];a=0,s=0,!this._isTextHighlightOn||this._cursorInfo.currentLineIndex<this._highlightCursorInfo.initialLineIndex?(a=this._cursorInfo.globalStartIndex,s=this._cursorInfo.relativeStartIndex):(a=this._cursorInfo.globalEndIndex,s=this._cursorInfo.relativeEndIndex),l=r.text.substr(0,s),_=this._contextForBreakLines.measureText(l).width;var f=0;c=0,a+=r.text.length-s+r.lineEnding.length;for(var p=0;f<_&&p<d.text.length;)a++,p++,c=Math.abs(_-f),f=this._contextForBreakLines.measureText(d.text.substr(0,p)).width;Math.abs(_-f)>c&&p>0&&a--,this._isTextHighlightOn?this._cursorInfo.currentLineIndex<this._highlightCursorInfo.initialLineIndex?(this._cursorInfo.globalStartIndex=a,this._cursorInfo.globalStartIndex>this._cursorInfo.globalEndIndex&&(this._cursorInfo.globalEndIndex+=this._cursorInfo.globalStartIndex,this._cursorInfo.globalStartIndex=this._cursorInfo.globalEndIndex-this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex-=this._cursorInfo.globalStartIndex)):(this._cursorInfo.globalEndIndex=a,this._cursorInfo.globalStartIndex=this._highlightCursorInfo.initialStartIndex):this._cursorInfo.globalStartIndex=a}return void this._markAsDirty()}if("a"===e&&i&&(i.ctrlKey||i.metaKey))return this._selectAllText(),void i.preventDefault();1===(null==e?void 0:e.length)&&(null==i||i.preventDefault(),this._currentKey=e,this.onBeforeKeyAddObservable.notifyObservers(this),e=this._currentKey,this._addKey&&(this._isTextHighlightOn=!1,this._blinkIsEven=!1,this._prevText=this._textWrapper.text,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex,e),this._cursorInfo.globalStartIndex+=e.length,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._textHasChanged()))}},e.prototype._parseLineWordWrap=function(t,e,i){void 0===t&&(t="");for(var o=[],r=t.split(" "),n=0,a=function(a){var s=a>0?t+" "+r[a]:r[0],l=i.measureText(s).width;if(l>e){a>0&&(n=i.measureText(t).width,o.push({text:t,width:n,lineEnding:" "})),t=r[a];var _="";t.split("").map((function(t){i.measureText(_+t).width>e&&(o.push({text:_,width:i.measureText(_).width,lineEnding:""}),_=""),_+=t})),t=_,n=i.measureText(t).width}else n=l,t=s},s=0;s<r.length;s++)a(s);return o.push({text:t,width:n,lineEnding:" "}),o},e.prototype._breakLines=function(t,e){var i=[],o=(this.text||this.placeholderText).split("\n");if(this.clipContent)for(var r=0,n=o;r<n.length;r++){var a=n[r];i.push.apply(i,this._parseLineWordWrap(a,t,e))}else for(var s=0,l=o;s<l.length;s++)a=l[s],i.push(this._parseLine(a,e));return i[i.length-1].lineEnding="\n",i},e.prototype._parseLine=function(t,e){return void 0===t&&(t=""),{text:t,width:e.measureText(t).width,lineEnding:" "}},e.prototype._preMeasure=function(t,e){var i;this._fontOffset&&!this._wasDirty||(this._fontOffset=y._GetFontOffset(e.font,null===(i=this._host.getScene())||void 0===i?void 0:i.getEngine()));var o=this._beforeRenderText(this._textWrapper).text;!this.text&&this._placeholderText&&(o=this._placeholderText),this._textWidth=e.measureText(o).width;var r=2*this._margin.getValueInPixel(this._host,t.width);if(this._autoStretchWidth){var n=o.split("\n").reduce((function(t,i){return e.measureText(i).width>e.measureText(t).width?i:t}),""),a=e.measureText(n).width;this.width=Math.min(this._maxWidth.getValueInPixel(this._host,t.width),a+r)+"px",this.autoStretchWidth=!0}if(this._availableWidth=this._width.getValueInPixel(this._host,t.width)-r,this._lines=this._breakLines(this._availableWidth,e),this._contextForBreakLines=e,this._autoStretchHeight){var s=this._lines.length*this._fontOffset.height+2*this._margin.getValueInPixel(this._host,t.height);this.height=Math.min(this._maxHeight.getValueInPixel(this._host,t.height),s)+"px",this._autoStretchHeight=!0}if(this._availableHeight=this._height.getValueInPixel(this._host,t.height)-r,this._isFocused){this._cursorInfo.currentLineIndex=0;for(var l=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length,_=0;_+l<=this._cursorInfo.globalStartIndex;)_+=l,this._cursorInfo.currentLineIndex<this._lines.length-1&&(this._cursorInfo.currentLineIndex++,l=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length)}},e.prototype._textHasChanged=function(){!this._prevText&&this._textWrapper.text&&this.placeholderText&&(this._cursorInfo.currentLineIndex=0,this._cursorInfo.globalStartIndex=1,this._cursorInfo.globalEndIndex=1,this._cursorInfo.relativeStartIndex=1,this._cursorInfo.relativeEndIndex=1),t.prototype._textHasChanged.call(this)},e.prototype._computeScroll=function(){if(this._clipTextLeft=this._currentMeasure.left+this._margin.getValueInPixel(this._host,this._cachedParentMeasure.width),this._clipTextTop=this._currentMeasure.top+this._margin.getValueInPixel(this._host,this._cachedParentMeasure.height),this._isFocused&&this._lines[this._cursorInfo.currentLineIndex].width>this._availableWidth){var t=this._clipTextLeft-this._lines[this._cursorInfo.currentLineIndex].width+this._availableWidth;this._scrollLeft||(this._scrollLeft=t)}else this._scrollLeft=this._clipTextLeft;if(this._isFocused){var e=(this._cursorInfo.currentLineIndex+1)*this._fontOffset.height,i=this._clipTextTop-e;this._scrollTop||(this._scrollTop=i)}else this._scrollTop=this._clipTextTop},e.prototype._additionalProcessing=function(){this.highlightedText="",this.onLinesReadyObservable.notifyObservers(this)},e.prototype._drawText=function(t,e,i,o){var r=this._currentMeasure.width,n=this._scrollLeft;switch(this._textHorizontalAlignment){case y.HORIZONTAL_ALIGNMENT_LEFT:n+=0;break;case y.HORIZONTAL_ALIGNMENT_RIGHT:n+=r-e;break;case y.HORIZONTAL_ALIGNMENT_CENTER:n+=(r-e)/2}(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(o.shadowColor=this.shadowColor,o.shadowBlur=this.shadowBlur,o.shadowOffsetX=this.shadowOffsetX,o.shadowOffsetY=this.shadowOffsetY),this.outlineWidth&&o.strokeText(t,this._currentMeasure.left+n,i),o.fillText(t,n,i)},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){try{t.clipboardData&&t.clipboardData.setData("text/plain",this._highlightedText)}catch(t){}this._host.clipboardData=this._highlightedText,this._prevText=this._textWrapper.text,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex),this._textHasChanged()}},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,this._isTextHighlightOn=!1,this._prevText=this._textWrapper.text,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex,e);var i=e.length-(this._cursorInfo.globalEndIndex-this._cursorInfo.globalStartIndex);this._cursorInfo.globalStartIndex+=i,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._textHasChanged()},e.prototype._draw=function(t){var e,i;this._computeScroll(),this._scrollLeft=null!==(e=this._scrollLeft)&&void 0!==e?e:0,this._scrollTop=null!==(i=this._scrollTop)&&void 0!==i?i:0,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.color&&(t.fillStyle=this.color);var o=this._currentMeasure.height,r=this._currentMeasure.width,n=0;switch(this._textVerticalAlignment){case y.VERTICAL_ALIGNMENT_TOP:n=this._fontOffset.ascent;break;case y.VERTICAL_ALIGNMENT_BOTTOM:n=o-this._fontOffset.height*(this._lines.length-1)-this._fontOffset.descent;break;case y.VERTICAL_ALIGNMENT_CENTER:n=this._fontOffset.ascent+(o-this._fontOffset.height*this._lines.length)/2}t.save(),t.beginPath(),t.fillStyle=this.fontStyle,!this._textWrapper.text&&this.placeholderText&&(t.fillStyle=this._placeholderColor),t.rect(this._clipTextLeft,this._clipTextTop,this._availableWidth+2,this._availableHeight+2),t.clip(),n+=this._scrollTop;for(var a=0;a<this._lines.length;a++){var s=this._lines[a];0!==a&&0!==this._lineSpacing.internalValue&&(this._lineSpacing.isPixel?n+=this._lineSpacing.getValue(this._host):n+=this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)),this._drawText(s.text,s.width,n,t),n+=this._fontOffset.height}if(t.restore(),this._isFocused){if(!this._blinkIsEven||this._isTextHighlightOn){var l=this._scrollLeft+t.measureText(this._lines[this._cursorInfo.currentLineIndex].text.substr(0,this._cursorInfo.relativeStartIndex)).width;l<this._clipTextLeft?(this._scrollLeft+=this._clipTextLeft-l,l=this._clipTextLeft,this._markAsDirty()):l>this._clipTextLeft+this._availableWidth&&(this._scrollLeft+=this._clipTextLeft+this._availableWidth-l,l=this._clipTextLeft+this._availableWidth,this._markAsDirty());var _=this._scrollTop+this._cursorInfo.currentLineIndex*this._fontOffset.height;_<this._clipTextTop?(this._scrollTop+=this._clipTextTop-_,_=this._clipTextTop,this._markAsDirty()):_+this._fontOffset.height>this._clipTextTop+this._availableHeight&&(this._scrollTop+=this._clipTextTop+this._availableHeight-_-this._fontOffset.height,_=this._clipTextTop+this._availableHeight-this._fontOffset.height,this._markAsDirty()),this._isTextHighlightOn||t.fillRect(l,_,2,this._fontOffset.height)}if(this._resetBlinking(),this._isTextHighlightOn){clearTimeout(this._blinkTimeout),this._highlightedText=this.text.substring(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex),t.globalAlpha=this._highligherOpacity,t.fillStyle=this._textHighlightColor;var h=Math.min(this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialLineIndex),c=Math.max(this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialLineIndex),u=this._scrollTop+h*this._fontOffset.height;for(a=h;a<=c;a++){s=this._lines[a];var d=this._scrollLeft;switch(this._textHorizontalAlignment){case y.HORIZONTAL_ALIGNMENT_LEFT:d+=0;break;case y.HORIZONTAL_ALIGNMENT_RIGHT:d+=r-s.width;break;case y.HORIZONTAL_ALIGNMENT_CENTER:d+=(r-s.width)/2}var f=a===h?this._cursorInfo.relativeStartIndex:0,p=a===c?this._cursorInfo.relativeEndIndex:s.text.length,g=t.measureText(s.text.substr(0,f)).width,b=s.text.substring(f,p),m=t.measureText(b).width;t.fillRect(d+g,u,m,this._fontOffset.height),u+=this._fontOffset.height}this._cursorInfo.globalEndIndex===this._cursorInfo.globalStartIndex&&this._resetBlinking()}}t.restore(),this._thickness&&(this._isFocused?this.focusedColor&&(t.strokeStyle=this.focusedColor):this.color&&(t.strokeStyle=this.color),t.lineWidth=this._thickness,t.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness))},e.prototype._resetBlinking=function(){var t=this;clearTimeout(this._blinkTimeout),this._blinkTimeout=setTimeout((function(){t._blinkIsEven=!t._blinkIsEven,t._markAsDirty()}),500)},e.prototype._onPointerDown=function(e,i,o,r,n){return!(!t.prototype._onPointerDown.call(this,e,i,o,r,n)||!this.isReadOnly&&(this._clickedCoordinateX=i.x,this._clickedCoordinateY=i.y,this._isTextHighlightOn=!1,this._highlightedText="",this._isPointerDown=!0,this._host._capturingControl[o]=this,this._host.focusedControl===this?(clearTimeout(this._blinkTimeout),this._markAsDirty(),0):!this._isEnabled||(this._host.focusedControl=this,0)))},e.prototype._onPointerMove=function(e,i,o,r){0===r.event.movementX&&0===r.event.movementY||(this._host.focusedControl===this&&this._isPointerDown&&!this.isReadOnly&&(this._clickedCoordinateX=i.x,this._clickedCoordinateY=i.y,this._isTextHighlightOn||(this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this._highlightCursorInfo.initialRelativeStartIndex=this._cursorInfo.relativeStartIndex,this._isTextHighlightOn=!0),this._markAsDirty()),t.prototype._onPointerMove.call(this,e,i,o,r))},e.prototype._updateCursorPosition=function(){var t;if(this._isFocused)if(!this._textWrapper.text&&this.placeholderText)this._cursorInfo.currentLineIndex=0,this._cursorInfo.globalStartIndex=0,this._cursorInfo.globalEndIndex=0,this._cursorInfo.relativeStartIndex=0,this._cursorInfo.relativeEndIndex=0;else if(this._clickedCoordinateX&&this._clickedCoordinateY){this._isTextHighlightOn||(this._cursorInfo={globalStartIndex:0,globalEndIndex:0,relativeStartIndex:0,relativeEndIndex:0,currentLineIndex:0});var e=0,i=0,o=this._clickedCoordinateY-this._scrollTop,r=Math.floor(o/this._fontOffset.height);this._cursorInfo.currentLineIndex=Math.min(Math.max(r,0),this._lines.length-1);for(var n=0,a=this._clickedCoordinateX-(null!==(t=this._scrollLeft)&&void 0!==t?t:0),s=0,l=0;l<this._cursorInfo.currentLineIndex;l++){var _=this._lines[l];e+=_.text.length+_.lineEnding.length}for(;n<a&&this._lines[this._cursorInfo.currentLineIndex].text.length>i;)i++,s=Math.abs(a-n),n=this._contextForBreakLines.measureText(this._lines[this._cursorInfo.currentLineIndex].text.substr(0,i)).width;Math.abs(a-n)>s&&i>0&&i--,e+=i,this._isTextHighlightOn?e<this._highlightCursorInfo.initialStartIndex?(this._cursorInfo.globalStartIndex=e,this._cursorInfo.relativeStartIndex=i,this._cursorInfo.globalEndIndex=this._highlightCursorInfo.initialStartIndex,this._cursorInfo.relativeEndIndex=this._highlightCursorInfo.initialRelativeStartIndex):(this._cursorInfo.globalStartIndex=this._highlightCursorInfo.initialStartIndex,this._cursorInfo.relativeStartIndex=this._highlightCursorInfo.initialRelativeStartIndex,this._cursorInfo.globalEndIndex=e,this._cursorInfo.relativeEndIndex=i):(this._cursorInfo.globalStartIndex=e,this._cursorInfo.relativeStartIndex=i,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._cursorInfo.relativeEndIndex=this._cursorInfo.relativeStartIndex),this._blinkIsEven=this._isTextHighlightOn,this._clickedCoordinateX=null,this._clickedCoordinateY=null}else{this._cursorInfo.relativeStartIndex=0,this._cursorInfo.currentLineIndex=0;for(var h=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length,c=0;c+h<=this._cursorInfo.globalStartIndex;)c+=h,this._cursorInfo.currentLineIndex<this._lines.length-1&&(this._cursorInfo.currentLineIndex++,h=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length);if(this._cursorInfo.relativeStartIndex=this._cursorInfo.globalStartIndex-c,-1!==this._highlightCursorInfo.initialStartIndex&&this._cursorInfo.globalStartIndex>=this._highlightCursorInfo.initialStartIndex){for(;c+h<=this._cursorInfo.globalEndIndex;)c+=h,this._cursorInfo.currentLineIndex<this._lines.length-1&&(this._cursorInfo.currentLineIndex++,h=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length);this._cursorInfo.relativeEndIndex=this._cursorInfo.globalEndIndex-c}else this._isTextHighlightOn||(this._cursorInfo.relativeEndIndex=this._cursorInfo.relativeStartIndex,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex)}},e.prototype._updateValueFromCursorIndex=function(t){},e.prototype._processDblClick=function(t){var e,i;do{e=this._cursorInfo.globalStartIndex>0&&this._textWrapper.isWord(this._cursorInfo.globalStartIndex-1)?--this._cursorInfo.globalStartIndex:0,i=this._cursorInfo.globalEndIndex<this._textWrapper.length&&this._textWrapper.isWord(this._cursorInfo.globalEndIndex)?++this._cursorInfo.globalEndIndex:0}while(e||i);this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this.onTextHighlightObservable.notifyObservers(this),this._isTextHighlightOn=!0,this._blinkIsEven=!0,this._markAsDirty()},e.prototype._selectAllText=function(){this._isTextHighlightOn=!0,this._blinkIsEven=!0,this._highlightCursorInfo={initialStartIndex:0,initialRelativeStartIndex:0,initialLineIndex:0},this._cursorInfo={globalStartIndex:0,globalEndIndex:this._textWrapper.length,relativeEndIndex:this._lines[this._lines.length-1].text.length,relativeStartIndex:0,currentLineIndex:this._lines.length-1},this._markAsDirty()},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onLinesReadyObservable.clear()},s([(0,h.serialize)()],e.prototype,"autoStretchHeight",null),s([(0,h.serialize)()],e.prototype,"maxHeight",null),e}(w);(0,h.RegisterClass)("BABYLON.GUI.InputTextArea",L);var k=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype._getTypeName=function(){return"InputPassword"},e.prototype._beforeRenderText=function(t){for(var e=new R,i="",o=0;o<t.length;o++)i+="•";return e.text=i,e},e}(w);(0,h.RegisterClass)("BABYLON.GUI.InputPassword",k);var N=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._lineWidth=1,i._x1=new c(0),i._y1=new c(0),i._x2=new c(0),i._y2=new c(0),i._dash=new Array,i._automaticSize=!0,i.isHitTestVisible=!1,i._horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,i._verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,i}return n(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}),Object.defineProperty(e.prototype,"connectedControl",{get:function(){return this._connectedControl},set:function(t){var e=this;this._connectedControl!==t&&(this._connectedControlDirtyObserver&&this._connectedControl&&(this._connectedControl.onDirtyObservable.remove(this._connectedControlDirtyObserver),this._connectedControlDirtyObserver=null),t&&(this._connectedControlDirtyObserver=t.onDirtyObservable.add((function(){return e._markAsDirty()}))),this._connectedControl=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"x1",{get:function(){return this._x1.toString(this._host)},set:function(t){this._x1.toString(this._host)!==t&&this._x1.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y1",{get:function(){return this._y1.toString(this._host)},set:function(t){this._y1.toString(this._host)!==t&&this._y1.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"x2",{get:function(){return this._x2.toString(this._host)},set:function(t){this._x2.toString(this._host)!==t&&this._x2.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y2",{get:function(){return this._y2.toString(this._host)},set:function(t){this._y2.toString(this._host)!==t&&this._y2.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),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}),Object.defineProperty(e.prototype,"_effectiveX2",{get:function(){return(this._connectedControl?this._connectedControl.centerX:0)+this._x2.getValue(this._host)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_effectiveY2",{get:function(){return(this._connectedControl?this._connectedControl.centerY:0)+this._y2.getValue(this._host)},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Line"},e.prototype._draw=function(t){t.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),this._applyStates(t),t.strokeStyle=this._getColor(t),t.lineWidth=this._lineWidth,t.setLineDash(this._dash),t.beginPath(),t.moveTo(this._cachedParentMeasure.left+this._x1.getValue(this._host),this._cachedParentMeasure.top+this._y1.getValue(this._host)),t.lineTo(this._cachedParentMeasure.left+this._effectiveX2,this._cachedParentMeasure.top+this._effectiveY2),t.stroke(),t.restore()},e.prototype._measure=function(){this._currentMeasure.width=Math.abs(this._x1.getValue(this._host)-this._effectiveX2)+this._lineWidth,this._currentMeasure.height=Math.abs(this._y1.getValue(this._host)-this._effectiveY2)+this._lineWidth},e.prototype._computeAlignment=function(t){this._currentMeasure.left=t.left+Math.min(this._x1.getValue(this._host),this._effectiveX2)-this._lineWidth/2,this._currentMeasure.top=t.top+Math.min(this._y1.getValue(this._host),this._effectiveY2)-this._lineWidth/2},e.prototype.moveToVector3=function(t,e,i){if(void 0===i&&(i=!1),this._host&&this.parent===this._host._rootContainer){var o=this._host._getGlobalViewport(),r=h.Vector3.Project(t,h.Matrix.IdentityReadOnly,e.getTransformMatrix(),o);this._moveToProjectedPosition(r,i),r.z<0||r.z>1?this.notRenderable=!0:this.notRenderable=!1}else h.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",o=t.y+this._linkOffsetY.getValue(this._host)+"px";e?(this.x2=i,this.y2=o,this._x2.ignoreAdaptiveScaling=!0,this._y2.ignoreAdaptiveScaling=!0):(this.x1=i,this.y1=o,this._x1.ignoreAdaptiveScaling=!0,this._y1.ignoreAdaptiveScaling=!0)},s([(0,h.serialize)()],e.prototype,"dash",null),s([(0,h.serialize)()],e.prototype,"x1",null),s([(0,h.serialize)()],e.prototype,"y1",null),s([(0,h.serialize)()],e.prototype,"x2",null),s([(0,h.serialize)()],e.prototype,"y2",null),s([(0,h.serialize)()],e.prototype,"lineWidth",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.Line",N);var A=function(){function t(t){this._multiLine=t,this._x=new c(0),this._y=new c(0),this._point=new h.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 h.Vector3(this._control.centerX,this._control.centerY,1-h.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 h.Vector3(e,i,1-h.Epsilon)},t.prototype.dispose=function(){this.resetLinks()},t}(),z=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=y.HORIZONTAL_ALIGNMENT_LEFT,i._verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,i._dash=[],i._points=[],i}return n(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 A(this)),this._points[t]},e.prototype.add=function(){for(var t=this,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return e.map((function(e){return t.push(e)}))},e.prototype.push=function(t){var e=this.getAt(this._points.length);return null==t||(t instanceof h.AbstractMesh?e.mesh=t:t instanceof y?e.control=t:null!=t.x&&null!=t.y&&(e.x=t.x,e.y=t.y)),e},e.prototype.remove=function(t){var e;if(t instanceof A){if(-1===(e=this._points.indexOf(t)))return}else e=t;var i=this._points[e];i&&(i.dispose(),this._points.splice(e,1))},e.prototype.reset=function(){for(;this._points.length>0;)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){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 e,i=!0;this._points.forEach((function(o){o&&(i?(t.moveTo(o._point.x,o._point.y),i=!1):o._point.z<1&&e.z<1?t.lineTo(o._point.x,o._point.y):t.moveTo(o._point.x,o._point.y),e=o._point)})),t.stroke(),t.restore()},e.prototype._additionalProcessing=function(){var t=this;this._minX=null,this._minY=null,this._maxX=null,this._maxY=null,this._points.forEach((function(e){e&&(e.translate(),(null==t._minX||e._point.x<t._minX)&&(t._minX=e._point.x),(null==t._minY||e._point.y<t._minY)&&(t._minY=e._point.y),(null==t._maxX||e._point.x>t._maxX)&&(t._maxX=e._point.x),(null==t._maxY||e._point.y>t._maxY)&&(t._maxY=e._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(){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)},s([(0,h.serialize)()],e.prototype,"dash",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.MultiLine",z);var Q=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 h.Observable,i.isPointerBlocker=!0,i}return n(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),y.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,1,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 o=e*this._checkSizeRatio,r=i*this._checkSizeRatio;y.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,o/2-this._thickness/2,r/2-this._thickness/2,1,t),t.fill()}t.restore()},e.prototype._onPointerDown=function(e,i,o,r,n){return!!t.prototype._onPointerDown.call(this,e,i,o,r,n)&&(this.isReadOnly||this.isChecked||(this.isChecked=!0),!0)},e.AddRadioButtonWithHeader=function(t,i,o,r){var n=new S;n.isVertical=!1,n.height="30px";var a=new e;a.width="20px",a.height="20px",a.isChecked=o,a.color="green",a.group=i,a.onIsCheckedChangedObservable.add((function(t){return r(a,t)})),n.addControl(a);var s=new B;return s.text=t,s.width="180px",s.paddingLeft="5px",s.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,s.color="white",n.addControl(s),n},s([(0,h.serialize)()],e.prototype,"thickness",null),s([(0,h.serialize)()],e.prototype,"group",void 0),s([(0,h.serialize)()],e.prototype,"checkSizeRatio",null),s([(0,h.serialize)()],e.prototype,"background",null),s([(0,h.serialize)()],e.prototype,"isChecked",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.RadioButton",Q);var V=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thumbWidth=new c(20,c.UNITMODE_PIXEL,!1),i._minimum=0,i._maximum=100,i._value=50,i._isVertical=!1,i._barOffset=new c(5,c.UNITMODE_PIXEL,!1),i._isThumbClamped=!1,i._displayThumb=!0,i._step=0,i._lastPointerDownId=-1,i._effectiveBarOffset=0,i.onValueChangedObservable=new h.Observable,i._pointerIsDown=!1,i.isPointerBlocker=!0,i}return n(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._currentMeasure.width?h.Logger.Error("Height should be greater than width"):(this._barOffset.isPixel?this._effectiveBarOffset=Math.min(this._barOffset.getValue(this._host),this._backgroundBoxThickness):this._effectiveBarOffset=this._backgroundBoxThickness*this._barOffset.getValue(this._host),this._backgroundBoxThickness-=2*this._effectiveBarOffset,this.isVertical?(this._renderLeft+=this._effectiveBarOffset,!this.isThumbClamped&&this.displayThumb&&(this._renderTop+=this._effectiveThumbThickness/2),this._renderHeight=this._backgroundBoxLength,this._renderWidth=this._backgroundBoxThickness):(this._renderTop+=this._effectiveBarOffset,!this.isThumbClamped&&this.displayThumb&&(this._renderLeft+=this._effectiveThumbThickness/2),this._renderHeight=this._backgroundBoxThickness,this._renderWidth=this._backgroundBoxLength))},e.prototype._updateValueFromPointer=function(t,e){var i;0!=this.rotation&&(this._invertTransformMatrix.transformCoordinates(t,e,this._transformedPosition),t=this._transformedPosition.x,e=this._transformedPosition.y),i=this._isVertical?this._minimum+(1-(e-this._currentMeasure.top)/this._currentMeasure.height)*(this._maximum-this._minimum):this._minimum+(t-this._currentMeasure.left)/this._currentMeasure.width*(this._maximum-this._minimum),this.value=this._step?Math.round(i/this._step)*this._step:i},e.prototype._onPointerDown=function(e,i,o,r,n){return!!t.prototype._onPointerDown.call(this,e,i,o,r,n)&&(this.isReadOnly||(this._pointerIsDown=!0,this._updateValueFromPointer(i.x,i.y),this._host._capturingControl[o]=this,this._lastPointerDownId=o),!0)},e.prototype._onPointerMove=function(e,i,o,r){o==this._lastPointerDownId&&(this._pointerIsDown&&!this.isReadOnly&&this._updateValueFromPointer(i.x,i.y),t.prototype._onPointerMove.call(this,e,i,o,r))},e.prototype._onPointerUp=function(e,i,o,r,n){this._pointerIsDown=!1,delete this._host._capturingControl[o],t.prototype._onPointerUp.call(this,e,i,o,r,n)},e.prototype._onCanvasBlur=function(){this._forcePointerUp(),t.prototype._onCanvasBlur.call(this)},s([(0,h.serialize)()],e.prototype,"displayThumb",null),s([(0,h.serialize)()],e.prototype,"step",null),s([(0,h.serialize)()],e.prototype,"barOffset",null),s([(0,h.serialize)()],e.prototype,"thumbWidth",null),s([(0,h.serialize)()],e.prototype,"minimum",null),s([(0,h.serialize)()],e.prototype,"maximum",null),s([(0,h.serialize)()],e.prototype,"value",null),s([(0,h.serialize)()],e.prototype,"isVertical",null),s([(0,h.serialize)()],e.prototype,"isThumbClamped",null),e}(y),W=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._background="black",i._borderColor="white",i._thumbColor="",i._isThumbCircle=!1,i._displayValueBar=!0,i._backgroundGradient=null,i}return n(e,t),Object.defineProperty(e.prototype,"displayValueBar",{get:function(){return this._displayValueBar},set:function(t){this._displayValueBar!==t&&(this._displayValueBar=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"borderColor",{get:function(){return this._borderColor},set:function(t){this._borderColor!==t&&(this._borderColor=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,"backgroundGradient",{get:function(){return this._backgroundGradient},set:function(t){this._backgroundGradient!==t&&(this._backgroundGradient=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbColor",{get:function(){return this._thumbColor},set:function(t){this._thumbColor!==t&&(this._thumbColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isThumbCircle",{get:function(){return this._isThumbCircle},set:function(t){this._isThumbCircle!==t&&(this._isThumbCircle=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Slider"},e.prototype._getBackgroundColor=function(t){return this._backgroundGradient?this._backgroundGradient.getCanvasGradient(t):this._background},e.prototype._draw=function(t){t.save(),this._applyStates(t),this._prepareRenderingData(this.isThumbCircle?"circle":"rectangle");var e=this._renderLeft,i=this._renderTop,o=this._renderWidth,r=this._renderHeight,n=0;this.isThumbClamped&&this.isThumbCircle?(this.isVertical?i+=this._effectiveThumbThickness/2:e+=this._effectiveThumbThickness/2,n=this._backgroundBoxThickness/2):n=(this._effectiveThumbThickness-this._effectiveBarOffset)/2,(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY);var a=this._getThumbPosition();t.fillStyle=this._getBackgroundColor(t),this.isVertical?this.isThumbClamped?this.isThumbCircle?(t.beginPath(),t.arc(e+this._backgroundBoxThickness/2,i,n,Math.PI,2*Math.PI),t.fill(),t.fillRect(e,i,o,r)):t.fillRect(e,i,o,r+this._effectiveThumbThickness):t.fillRect(e,i,o,r):this.isThumbClamped?this.isThumbCircle?(t.beginPath(),t.arc(e+this._backgroundBoxLength,i+this._backgroundBoxThickness/2,n,0,2*Math.PI),t.fill(),t.fillRect(e,i,o,r)):t.fillRect(e,i,o+this._effectiveThumbThickness,r):t.fillRect(e,i,o,r),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.fillStyle=this._getColor(t),this._displayValueBar&&(this.isVertical?this.isThumbClamped?this.isThumbCircle?(t.beginPath(),t.arc(e+this._backgroundBoxThickness/2,i+this._backgroundBoxLength,n,0,2*Math.PI),t.fill(),t.fillRect(e,i+a,o,r-a)):t.fillRect(e,i+a,o,r-a+this._effectiveThumbThickness):t.fillRect(e,i+a,o,r-a):this.isThumbClamped&&this.isThumbCircle?(t.beginPath(),t.arc(e,i+this._backgroundBoxThickness/2,n,0,2*Math.PI),t.fill(),t.fillRect(e,i,a,r)):t.fillRect(e,i,a,r)),t.fillStyle=this._thumbColor||this._getColor(t),this.displayThumb&&((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),this._isThumbCircle?(t.beginPath(),this.isVertical?t.arc(e+this._backgroundBoxThickness/2,i+a,n,0,2*Math.PI):t.arc(e+a,i+this._backgroundBoxThickness/2,n,0,2*Math.PI),t.fill(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.strokeStyle=this._borderColor,t.stroke()):(this.isVertical?t.fillRect(e-this._effectiveBarOffset,this._currentMeasure.top+a,this._currentMeasure.width,this._effectiveThumbThickness):t.fillRect(this._currentMeasure.left+a,this._currentMeasure.top,this._effectiveThumbThickness,this._currentMeasure.height),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.strokeStyle=this._borderColor,this.isVertical?t.strokeRect(e-this._effectiveBarOffset,this._currentMeasure.top+a,this._currentMeasure.width,this._effectiveThumbThickness):t.strokeRect(this._currentMeasure.left+a,this._currentMeasure.top,this._effectiveThumbThickness,this._currentMeasure.height))),t.restore()},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),this.backgroundGradient&&(e.backgroundGradient={},this.backgroundGradient.serialize(e.backgroundGradient))},e.prototype._parseFromContent=function(e,i){if(t.prototype._parseFromContent.call(this,e,i),e.backgroundGradient){var o=h.Tools.Instantiate("BABYLON.GUI."+e.backgroundGradient.className);this.backgroundGradient=new o,this.backgroundGradient.parse(e.backgroundGradient)}},s([(0,h.serialize)()],e.prototype,"displayValueBar",null),s([(0,h.serialize)()],e.prototype,"borderColor",null),s([(0,h.serialize)()],e.prototype,"background",null),s([(0,h.serialize)()],e.prototype,"thumbColor",null),s([(0,h.serialize)()],e.prototype,"isThumbCircle",null),e}(V);(0,h.RegisterClass)("BABYLON.GUI.Slider",W);var H=function(){function t(t){this.name=t,this._groupPanel=new S,this._selectors=new Array,this._groupPanel.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,this._groupPanel.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,this._groupHeader=this._addGroupHeader(t)}return Object.defineProperty(t.prototype,"groupPanel",{get:function(){return this._groupPanel},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectors",{get:function(){return this._selectors},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"header",{get:function(){return this._groupHeader.text},set:function(t){"label"!==this._groupHeader.text&&(this._groupHeader.text=t)},enumerable:!1,configurable:!0}),t.prototype._addGroupHeader=function(t){var e=new B("groupHead",t);return e.width=.9,e.height="30px",e.textWrapping=!0,e.color="black",e.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,e.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,e.left="2px",this._groupPanel.addControl(e),e},t.prototype._getSelector=function(t){if(!(t<0||t>=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}(),G=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.addCheckbox=function(t,e,i){void 0===e&&(e=function(t){}),void 0===i&&(i=!1),i=i||!1;var o=new O;o.width="20px",o.height="20px",o.color="#364249",o.background="#CCCCCC",o.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,o.onIsCheckedChangedObservable.add((function(t){e(t)}));var r=y.AddHeader(o,t,"200px",{isHorizontal:!0,controlFirst:!0});r.height="30px",r.horizontalAlignment=y.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}(H),U=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._selectNb=0,e}return n(e,t),e.prototype.addRadio=function(t,e,i){void 0===e&&(e=function(t){}),void 0===i&&(i=!1);var o=this._selectNb++,r=new Q;r.name=t,r.width="20px",r.height="20px",r.color="#364249",r.background="#CCCCCC",r.group=this.name,r.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,r.onIsCheckedChangedObservable.add((function(t){t&&e(o)}));var n=y.AddHeader(r,t,"200px",{isHorizontal:!0,controlFirst:!0});n.height="30px",n.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,n.left="4px",this.groupPanel.addControl(n),this.selectors.push(n),r.isChecked=i,this.groupPanel.parent&&this.groupPanel.parent.parent&&(r.color=this.groupPanel.parent.parent.buttonColor,r.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}(H),j=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.addSlider=function(t,e,i,o,r,n,a){void 0===e&&(e=function(t){}),void 0===i&&(i="Units"),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=function(t){return 0|t});var s=new W;s.name=i,s.value=n,s.minimum=o,s.maximum=r,s.width=.9,s.height="20px",s.color="#364249",s.background="#CCCCCC",s.borderColor="black",s.horizontalAlignment=y.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=y.AddHeader(s,t+": "+a(n)+" "+i,"30px",{isHorizontal:!1,controlFirst:!1});l.height="60px",l.horizontalAlignment=y.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}(H),Y=function(t){function e(e,i){void 0===i&&(i=[]);var o=t.call(this,e)||this;if(o.name=e,o.groups=i,o._buttonColor="#364249",o._buttonBackground="#CCCCCC",o._headerColor="black",o._barColor="white",o._barHeight="2px",o._spacerHeight="20px",o._bars=new Array,o._groups=i,o.thickness=2,o._panel=new S,o._panel.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,o._panel.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,o._panel.top=5,o._panel.left=5,o._panel.width=.95,i.length>0){for(var r=0;r<i.length-1;r++)o._panel.addControl(i[r].groupPanel),o._addSpacer();o._panel.addControl(i[i.length-1].groupPanel)}return o.addControl(o._panel),o}return n(e,t),e.prototype._getTypeName=function(){return"SelectionPanel"},Object.defineProperty(e.prototype,"panel",{get:function(){return this._panel},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"headerColor",{get:function(){return this._headerColor},set:function(t){this._headerColor!==t&&(this._headerColor=t,this._setHeaderColor())},enumerable:!1,configurable:!0}),e.prototype._setHeaderColor=function(){for(var t=0;t<this._groups.length;t++)this._groups[t].groupPanel.children[0].color=this._headerColor},Object.defineProperty(e.prototype,"buttonColor",{get:function(){return this._buttonColor},set:function(t){this._buttonColor!==t&&(this._buttonColor=t,this._setbuttonColor())},enumerable:!1,configurable:!0}),e.prototype._setbuttonColor=function(){for(var t=0;t<this._groups.length;t++)for(var e=0;e<this._groups[t].selectors.length;e++)this._groups[t]._setSelectorButtonColor(e,this._buttonColor)},Object.defineProperty(e.prototype,"labelColor",{get:function(){return this._labelColor},set:function(t){this._labelColor!==t&&(this._labelColor=t,this._setLabelColor())},enumerable:!1,configurable:!0}),e.prototype._setLabelColor=function(){for(var t=0;t<this._groups.length;t++)for(var e=0;e<this._groups[t].selectors.length;e++)this._groups[t]._setSelectorLabelColor(e,this._labelColor)},Object.defineProperty(e.prototype,"buttonBackground",{get:function(){return this._buttonBackground},set:function(t){this._buttonBackground!==t&&(this._buttonBackground=t,this._setButtonBackground())},enumerable:!1,configurable:!0}),e.prototype._setButtonBackground=function(){for(var t=0;t<this._groups.length;t++)for(var e=0;e<this._groups[t].selectors.length;e++)this._groups[t]._setSelectorButtonBackground(e,this._buttonBackground)},Object.defineProperty(e.prototype,"barColor",{get:function(){return this._barColor},set:function(t){this._barColor!==t&&(this._barColor=t,this._setBarColor())},enumerable:!1,configurable:!0}),e.prototype._setBarColor=function(){for(var t=0;t<this._bars.length;t++)this._bars[t].children[0].background=this._barColor},Object.defineProperty(e.prototype,"barHeight",{get:function(){return this._barHeight},set:function(t){this._barHeight!==t&&(this._barHeight=t,this._setBarHeight())},enumerable:!1,configurable:!0}),e.prototype._setBarHeight=function(){for(var t=0;t<this._bars.length;t++)this._bars[t].children[0].height=this._barHeight},Object.defineProperty(e.prototype,"spacerHeight",{get:function(){return this._spacerHeight},set:function(t){this._spacerHeight!==t&&(this._spacerHeight=t,this._setSpacerHeight())},enumerable:!1,configurable:!0}),e.prototype._setSpacerHeight=function(){for(var t=0;t<this._bars.length;t++)this._bars[t].height=this._spacerHeight},e.prototype._addSpacer=function(){var t=new x;t.width=1,t.height=this._spacerHeight,t.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT;var e=new I;e.width=1,e.height=this._barHeight,e.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,e.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,e.background=this._barColor,e.color="transparent",t.addControl(e),this._panel.addControl(t),this._bars.push(t)},e.prototype.addGroup=function(t){this._groups.length>0&&this._addSpacer(),this._panel.addControl(t.groupPanel),this._groups.push(t),t.groupPanel.children[0].color=this._headerColor;for(var e=0;e<t.selectors.length;e++)t._setSelectorButtonColor(e,this._buttonColor),t._setSelectorButtonBackground(e,this._buttonBackground)},e.prototype.removeGroup=function(t){if(!(t<0||t>=this._groups.length)){var e=this._groups[t];this._panel.removeControl(e.groupPanel),this._groups.splice(t,1),t<this._bars.length&&(this._panel.removeControl(this._bars[t]),this._bars.splice(t,1))}},e.prototype.setHeaderName=function(t,e){e<0||e>=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 o=this._groups[e];i<0||i>=o.selectors.length||o._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,o){void 0===i&&(i=function(){}),void 0===o&&(o=!1),t<0||t>=this._groups.length||this._groups[t].addCheckbox(e,i,o)},e.prototype.addToGroupRadio=function(t,e,i,o){void 0===i&&(i=function(){}),void 0===o&&(o=!1),t<0||t>=this._groups.length||this._groups[t].addRadio(e,i,o)},e.prototype.addToGroupSlider=function(t,e,i,o,r,n,a,s){void 0===i&&(i=function(){}),void 0===o&&(o="Units"),void 0===r&&(r=0),void 0===n&&(n=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,o,r,n,a,s)},e}(I),X=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 n(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,o=e.height,r=this.host.getContext(),n=new g(0,0,i,o);this.host._numLayoutCalls=0,this.host._rootContainer._layout(n,r),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;e<t.length;++e){for(var i=t[e],o=Math.max(0,Math.floor((i._customData._origLeft-this._customData.origLeft)/this._bucketWidth)),r=Math.floor((i._customData._origLeft-this._customData.origLeft+i._currentMeasure.width-1)/this._bucketWidth),n=Math.floor((i._customData._origTop-this._customData.origTop+i._currentMeasure.height-1)/this._bucketHeight),a=Math.max(0,Math.floor((i._customData._origTop-this._customData.origTop)/this._bucketHeight));a<=n;){for(var s=o;s<=r;++s){var l=a*this._bucketLen+s,_=this._buckets[l];_||(_=[],this._buckets[l]=_),_.push(i)}a++}i instanceof x&&i._children.length>0&&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 o=0;o<t.length;++o){var r=t[o];r._currentMeasure.left-=e,r._currentMeasure.top-=i,r._customData._origLeft=r._currentMeasure.left,r._customData._origTop=r._currentMeasure.top,r instanceof x&&r._children.length>0&&this._updateChildrenMeasures(r._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 o=0;o<t.length;++o){var r=t[o];r._currentMeasure.left=r._customData._origLeft+e,r._currentMeasure.top=r._customData._origTop+i,r._isClipped=!1,r instanceof x&&r._children.length>0&&this._scrollChildren(r._children,e,i)}},e.prototype._scrollChildrenWithBuckets=function(t,e,i,o){for(var r=Math.max(0,Math.floor(-t/this._bucketWidth)),n=Math.floor((-t+this._parentMeasure.width-1)/this._bucketWidth),a=Math.floor((-e+this._parentMeasure.height-1)/this._bucketHeight),s=Math.max(0,Math.floor(-e/this._bucketHeight));s<=a;){for(var l=r;l<=n;++l){var _=s*this._bucketLen+l,h=this._buckets[_];if(h)for(var c=0;c<h.length;++c){var u=h[c];u._currentMeasure.left=u._customData._origLeft+i,u._currentMeasure.top=u._customData._origTop+o,u._isClipped=!1}}s++}},e.prototype._draw=function(e,i){if(this._freezeControls){this._localDraw(e),this.clipChildren&&this._clipForChildren(e);var o=0|this.leftInPixels,r=0|this.topInPixels;this._useBuckets()&&null!==this._oldLeft&&null!==this._oldTop?(this._scrollChildrenWithBuckets(this._oldLeft,this._oldTop,o,r),this._scrollChildrenWithBuckets(o,r,o,r)):this._scrollChildren(this._children,o,r),this._oldLeft=o,this._oldTop=r;for(var n=0,a=this._children;n<a.length;n++){var s=a[n];s._intersectsRect(this._parentMeasure)&&s._render(e,this._parentMeasure)}}else t.prototype._draw.call(this,e,i)},e.prototype._postMeasure=function(){if(this._freezeControls)t.prototype._postMeasure.call(this);else{for(var e=this.parentClientWidth,i=this.parentClientHeight,o=0,r=this.children;o<r.length;o++){var n=r[o];n.isVisible&&!n.notRenderable&&(n.horizontalAlignment===y.HORIZONTAL_ALIGNMENT_CENTER&&n._offsetLeft(this._currentMeasure.left-n._currentMeasure.left),n.verticalAlignment===y.VERTICAL_ALIGNMENT_CENTER&&n._offsetTop(this._currentMeasure.top-n._currentMeasure.top),e=Math.max(e,n._currentMeasure.left-this._currentMeasure.left+n._currentMeasure.width+n.paddingRightInPixels),i=Math.max(i,n._currentMeasure.top-this._currentMeasure.top+n._currentMeasure.height+n.paddingBottomInPixels))}this._currentMeasure.width!==e&&(this._width.updateInPlace(e,c.UNITMODE_PIXEL),this._currentMeasure.width=e,this._rebuildLayout=!0,this._isDirty=!0),this._currentMeasure.height!==i&&(this._height.updateInPlace(i,c.UNITMODE_PIXEL),this._currentMeasure.height=i,this._rebuildLayout=!0,this._isDirty=!0),t.prototype._postMeasure.call(this)}},e}(x),K=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._background="black",i._borderColor="white",i._tempMeasure=new g(0,0,0,0),i._invertScrollDirection=!1,i._backgroundGradient=null,i}return n(e,t),Object.defineProperty(e.prototype,"borderColor",{get:function(){return this._borderColor},set:function(t){this._borderColor!==t&&(this._borderColor=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,"backgroundGradient",{get:function(){return this._backgroundGradient},set:function(t){this._backgroundGradient!==t&&(this._backgroundGradient=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"invertScrollDirection",{get:function(){return this._invertScrollDirection},set:function(t){this._invertScrollDirection=t},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Scrollbar"},e.prototype._getThumbThickness=function(){return this._thumbWidth.isPixel?this._thumbWidth.getValue(this._host):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host)},e.prototype._getBackgroundColor=function(t){return this._backgroundGradient?this._backgroundGradient.getCanvasGradient(t):this._background},e.prototype._draw=function(t){t.save(),this._applyStates(t),this._prepareRenderingData("rectangle");var e=this._renderLeft,i=this._getThumbPosition();t.fillStyle=this._getBackgroundColor(t),t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height),t.fillStyle=this._getColor(t),this.isVertical?(this._tempMeasure.left=e-this._effectiveBarOffset,this._tempMeasure.top=this._currentMeasure.top+i,this._tempMeasure.width=this._currentMeasure.width,this._tempMeasure.height=this._effectiveThumbThickness):(this._tempMeasure.left=this._currentMeasure.left+i,this._tempMeasure.top=this._currentMeasure.top,this._tempMeasure.width=this._effectiveThumbThickness,this._tempMeasure.height=this._currentMeasure.height),t.fillRect(this._tempMeasure.left,this._tempMeasure.top,this._tempMeasure.width,this._tempMeasure.height),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);var i=this._invertScrollDirection?-1:1;this._first&&(this._first=!1,this._originX=t,this._originY=e,(t<this._tempMeasure.left||t>this._tempMeasure.left+this._tempMeasure.width||e<this._tempMeasure.top||e>this._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 o;o=this.isVertical?-(e-this._originY)/(this._currentMeasure.height-this._effectiveThumbThickness):(t-this._originX)/(this._currentMeasure.width-this._effectiveThumbThickness),this.value+=i*o*(this.maximum-this.minimum),this._originX=t,this._originY=e},e.prototype._onPointerDown=function(e,i,o,r,n){return this._first=!0,t.prototype._onPointerDown.call(this,e,i,o,r,n)},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),this.backgroundGradient&&(e.backgroundGradient={},this.backgroundGradient.serialize(e.backgroundGradient))},e.prototype._parseFromContent=function(e,i){if(t.prototype._parseFromContent.call(this,e,i),e.backgroundGradient){var o=h.Tools.Instantiate("BABYLON.GUI."+e.backgroundGradient.className);this.backgroundGradient=new o,this.backgroundGradient.parse(e.backgroundGradient)}},s([(0,h.serialize)()],e.prototype,"borderColor",null),s([(0,h.serialize)()],e.prototype,"background",null),s([(0,h.serialize)()],e.prototype,"invertScrollDirection",null),e}(V);(0,h.RegisterClass)("BABYLON.GUI.Scrollbar",K);var Z=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 g(0,0,0,0),i._invertScrollDirection=!1,i.num90RotationInVerticalMode=1,i}return n(e,t),Object.defineProperty(e.prototype,"invertScrollDirection",{get:function(){return this._invertScrollDirection},set:function(t){this._invertScrollDirection=t},enumerable:!1,configurable:!0}),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,o=this._renderTop,r=this._renderWidth,n=this._renderHeight;this._backgroundImage&&(this._tempMeasure.copyFromFloats(i,o,r,n),this.isVertical?(this._tempMeasure.copyFromFloats(i+r*(1-this._barImageHeight)*.5,this._currentMeasure.top,r*this._barImageHeight,n),this._tempMeasure.height+=this._effectiveThumbThickness,this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure)):(this._tempMeasure.copyFromFloats(this._currentMeasure.left,o+n*(1-this._barImageHeight)*.5,r,n*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);var i=this._invertScrollDirection?-1:1;this._first&&(this._first=!1,this._originX=t,this._originY=e,(t<this._tempMeasure.left||t>this._tempMeasure.left+this._tempMeasure.width||e<this._tempMeasure.top||e>this._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 o;o=this.isVertical?-(e-this._originY)/(this._currentMeasure.height-this._effectiveThumbThickness):(t-this._originX)/(this._currentMeasure.width-this._effectiveThumbThickness),this.value+=i*o*(this.maximum-this.minimum),this._originX=t,this._originY=e},e.prototype._onPointerDown=function(e,i,o,r,n){return this._first=!0,t.prototype._onPointerDown.call(this,e,i,o,r,n)},s([(0,h.serialize)()],e.prototype,"num90RotationInVerticalMode",void 0),s([(0,h.serialize)()],e.prototype,"invertScrollDirection",null),e}(V),q=function(t){function e(e,i){var o=t.call(this,e)||this;return o._barSize=20,o._pointerIsOver=!1,o._wheelPrecision=.05,o._thumbLength=.5,o._thumbHeight=1,o._barImageHeight=1,o._horizontalBarImageHeight=1,o._verticalBarImageHeight=1,o._oldWindowContentsWidth=0,o._oldWindowContentsHeight=0,o._forceHorizontalBar=!1,o._forceVerticalBar=!1,o._useImageBar=i||!1,o.onDirtyObservable.add((function(){o._horizontalBarSpace.color=o.color,o._verticalBarSpace.color=o.color,o._dragSpace.color=o.color})),o.onPointerEnterObservable.add((function(){o._pointerIsOver=!0})),o.onPointerOutObservable.add((function(){o._pointerIsOver=!1})),o._grid=new M,o._useImageBar?(o._horizontalBar=new Z,o._verticalBar=new Z):(o._horizontalBar=new K,o._verticalBar=new K),o._window=new X("scrollViewer_window"),o._window.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,o._window.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,o._grid.addColumnDefinition(1),o._grid.addColumnDefinition(0,!0),o._grid.addRowDefinition(1),o._grid.addRowDefinition(0,!0),t.prototype.addControl.call(o,o._grid),o._grid.addControl(o._window,0,0),o._verticalBarSpace=new I,o._verticalBarSpace.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,o._verticalBarSpace.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,o._verticalBarSpace.thickness=1,o._grid.addControl(o._verticalBarSpace,0,1),o._addBar(o._verticalBar,o._verticalBarSpace,!0,Math.PI),o._horizontalBarSpace=new I,o._horizontalBarSpace.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,o._horizontalBarSpace.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,o._horizontalBarSpace.thickness=1,o._grid.addControl(o._horizontalBarSpace,1,0),o._addBar(o._horizontalBar,o._horizontalBarSpace,!1,0),o._dragSpace=new I,o._dragSpace.thickness=1,o._grid.addControl(o._dragSpace,1,1),o._grid.clipChildren=!1,o._useImageBar||(o.barColor="grey",o.barBackground="transparent"),o}return n(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;t<e.length;t++)e[t]._markMatrixAsDirty()},Object.defineProperty(e.prototype,"freezeControls",{get:function(){return this._window.freezeControls},set:function(t){this._window.freezeControls=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bucketWidth",{get:function(){return this._window.bucketWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bucketHeight",{get:function(){return this._window.bucketHeight},enumerable:!1,configurable:!0}),e.prototype.setBucketSizes=function(t,e){this._window.setBucketSizes(t,e)},Object.defineProperty(e.prototype,"forceHorizontalBar",{get:function(){return this._forceHorizontalBar},set:function(t){this._grid.setRowDefinition(1,t?this._barSize:0,!0),this._horizontalBar.isVisible=t,this._forceHorizontalBar=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"forceVerticalBar",{get:function(){return this._forceVerticalBar},set:function(t){this._grid.setColumnDefinition(1,t?this._barSize:0,!0),this._verticalBar.isVisible=t,this._forceVerticalBar=t},enumerable:!1,configurable:!0}),e.prototype.resetWindow=function(){this._window.width="100%",this._window.height="100%"},e.prototype._getTypeName=function(){return"ScrollViewer"},e.prototype._buildClientSizes=function(){var t=this.host.idealRatio;this._window.parentClientWidth=this._currentMeasure.width-(this._verticalBar.isVisible||this.forceVerticalBar?this._barSize*t:0)-2*this.thickness,this._window.parentClientHeight=this._currentMeasure.height-(this._horizontalBar.isVisible||this.forceHorizontalBar?this._barSize*t:0)-2*this.thickness,this._clientWidth=this._window.parentClientWidth,this._clientHeight=this._window.parentClientHeight},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._buildClientSizes()},e.prototype._postMeasure=function(){t.prototype._postMeasure.call(this),this._updateScroller(),this._setWindowPosition(!1)},Object.defineProperty(e.prototype,"wheelPrecision",{get:function(){return this._wheelPrecision},set:function(t){this._wheelPrecision!==t&&(t<0&&(t=0),t>1&&(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=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=t,this._horizontalBar.backgroundImage=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalBarImage",{get:function(){return this._verticalBarBackgroundImage},set:function(t){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,o=this._window._currentMeasure.height;if(t||this._oldWindowContentsWidth!==i||this._oldWindowContentsHeight!==o){this._oldWindowContentsWidth=i,this._oldWindowContentsHeight=o;var r=this._clientWidth-i,n=this._clientHeight-o,a=this._horizontalBar.value/e*r+"px",s=this._verticalBar.value/e*n+"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,o){var r=this;t.paddingLeft=0,t.width="100%",t.height="100%",t.barOffset=0,t.value=0,t.maximum=1,t.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_CENTER,t.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,t.isVertical=i,t.rotation=o,t.isVisible=!1,e.addControl(t),t.onValueChangedObservable.add((function(){r._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.value<t._verticalBar.maximum&&(t._verticalBar.value+=t._wheelPrecision)),1==t._horizontalBar.isVisible&&(e.x<0&&t._horizontalBar.value<t._horizontalBar.maximum?t._horizontalBar.value+=t._wheelPrecision:e.x>0&&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)},s([(0,h.serialize)()],e.prototype,"wheelPrecision",null),s([(0,h.serialize)()],e.prototype,"scrollBackground",null),s([(0,h.serialize)()],e.prototype,"barColor",null),s([(0,h.serialize)()],e.prototype,"barSize",null),s([(0,h.serialize)()],e.prototype,"barBackground",null),e}(I);(0,h.RegisterClass)("BABYLON.GUI.ScrollViewer",q);var J=function(t){function e(e,i){var o=t.call(this,e)||this;o.name=e,o.onIsActiveChangedObservable=new h.Observable,o.delegatePickingToChildren=!1,o._isActive=!1,o.group=null!=i?i:"",o.thickness=0,o.isPointerBlocker=!0;var r=null;return o.toActiveAnimation=function(){o.thickness=1},o.toInactiveAnimation=function(){o.thickness=0},o.pointerEnterActiveAnimation=function(){r=o.alpha,o.alpha-=.1},o.pointerOutActiveAnimation=function(){null!==r&&(o.alpha=r)},o.pointerDownActiveAnimation=function(){o.scaleX-=.05,o.scaleY-=.05},o.pointerUpActiveAnimation=function(){o.scaleX+=.05,o.scaleY+=.05},o.pointerEnterInactiveAnimation=function(){r=o.alpha,o.alpha-=.1},o.pointerOutInactiveAnimation=function(){null!==r&&(o.alpha=r)},o.pointerDownInactiveAnimation=function(){o.scaleX-=.05,o.scaleY-=.05},o.pointerUpInactiveAnimation=function(){o.scaleX+=.05,o.scaleY+=.05},o}return n(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,o=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===o)return;var e=t;e.group===o.group&&(e.isActive=!1)}})))},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"ToggleButton"},e.prototype._processPicking=function(e,i,o,r,n,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(r,e,i,o,n,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,o){void 0===o&&(o=!1),this.isReadOnly||(this._isActive?this.pointerOutActiveAnimation&&this.pointerOutActiveAnimation():this.pointerOutInactiveAnimation&&this.pointerOutInactiveAnimation()),t.prototype._onPointerOut.call(this,e,i,o)},e.prototype._onPointerDown=function(e,i,o,r,n){return!!t.prototype._onPointerDown.call(this,e,i,o,r,n)&&(this.isReadOnly||(this._isActive?this.pointerDownActiveAnimation&&this.pointerDownActiveAnimation():this.pointerDownInactiveAnimation&&this.pointerDownInactiveAnimation()),!0)},e.prototype._onPointerUp=function(e,i,o,r,n,a){this.isReadOnly||(this._isActive?this.pointerUpActiveAnimation&&this.pointerUpActiveAnimation():this.pointerUpInactiveAnimation&&this.pointerUpInactiveAnimation()),t.prototype._onPointerUp.call(this,e,i,o,r,n,a)},e}(I);(0,h.RegisterClass)("BABYLON.GUI.ToggleButton",J);var $=function(){},tt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.onKeyPressObservable=new h.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 n(e,t),e.prototype._getTypeName=function(){return"VirtualKeyboard"},e.prototype._createKey=function(t,e){var i=this,o=T.CreateSimpleButton(t,t);return o.width=e&&e.width?e.width:this.defaultButtonWidth,o.height=e&&e.height?e.height:this.defaultButtonHeight,o.color=e&&e.color?e.color:this.defaultButtonColor,o.background=e&&e.background?e.background:this.defaultButtonBackground,o.paddingLeft=e&&e.paddingLeft?e.paddingLeft:this.defaultButtonPaddingLeft,o.paddingRight=e&&e.paddingRight?e.paddingRight:this.defaultButtonPaddingRight,o.paddingTop=e&&e.paddingTop?e.paddingTop:this.defaultButtonPaddingTop,o.paddingBottom=e&&e.paddingBottom?e.paddingBottom:this.defaultButtonPaddingBottom,o.thickness=0,o.isFocusInvisible=!0,o.shadowColor=this.shadowColor,o.shadowBlur=this.shadowBlur,o.shadowOffsetX=this.shadowOffsetX,o.shadowOffsetY=this.shadowOffsetY,o.onPointerUpObservable.add((function(){i.onKeyPressObservable.notifyObservers(t)})),o},e.prototype.addKeysRow=function(t,e){var i=new S;i.isVertical=!1,i.isFocusInvisible=!0;for(var o=null,r=0;r<t.length;r++){var n=null;e&&e.length===t.length&&(n=e[r]);var a=this._createKey(t[r],n);(!o||a.heightInPixels>o.heightInPixels)&&(o=a),i.addControl(a)}i.height=o?o.height:this.defaultButtonHeight,this.addControl(i)},e.prototype.applyShiftState=function(t){if(this.children)for(var e=0;e<this.children.length;e++){var i=this.children[e];if(i&&i.children)for(var o=i,r=0;r<o.children.length;r++){var n=o.children[r];if(n&&n.children[0]){var a=n.children[0];"⇧"===a.text&&(n.color=t?this.shiftButtonColor:this.defaultButtonColor,n.thickness=t>1?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 instanceof L?e._currentlyConnectedInputText.alternativeProcessKey("Backspace"):e._currentlyConnectedInputText.processKey(8));case"↵":return void(e._currentlyConnectedInputText instanceof L?e._currentlyConnectedInputText.alternativeProcessKey("Enter"):e._currentlyConnectedInputText.processKey(13))}e._currentlyConnectedInputText instanceof L?e._currentlyConnectedInputText.alternativeProcessKey("",e.shiftState?t.toUpperCase():t):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})),o=t.onBlurObservable.add((function(){t._connectedVirtualKeyboard=null,e._currentlyConnectedInputText=null,e.isVisible=!1}));this._connectedInputTexts.push({input:t,onBlurObserver:o,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.length=0;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.prototype._parseFromContent=function(e,i){var o=this;t.prototype._parseFromContent.call(this,e,i);for(var r=0,n=this.children;r<n.length;r++){var a=n[r];if("StackPanel"===a.getClassName())for(var s=function(t){"Button"===t.getClassName()&&t.name&&t.onPointerUpObservable.add((function(){o.onKeyPressObservable.notifyObservers(t.name)}))},l=0,_=a.children;l<_.length;l++)s(_[l])}},e}(S);(0,h.RegisterClass)("BABYLON.GUI.VirtualKeyboard",tt);var et=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 n(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){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 e=this._currentMeasure.width/this._cellWidth,i=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 n=-e/2+1;n<e/2;n++){var a=o+n*this.cellWidth;t.beginPath(),t.moveTo(a,this._currentMeasure.top),t.lineTo(a,this._currentMeasure.top+this._currentMeasure.height),t.stroke()}for(var s=-i/2+1;s<i/2;s++){var l=r+s*this.cellHeight;t.beginPath(),t.moveTo(this._currentMeasure.left,l),t.lineTo(this._currentMeasure.left+this._currentMeasure.width,l),t.stroke()}}if(this._displayMajorLines){for(t.strokeStyle=this._majorLineColor,t.lineWidth=this._majorLineTickness,n=-e/2+this._majorLineFrequency;n<e/2;n+=this._majorLineFrequency)a=o+n*this.cellWidth,t.beginPath(),t.moveTo(a,this._currentMeasure.top),t.lineTo(a,this._currentMeasure.top+this._currentMeasure.height),t.stroke();for(s=-i/2+this._majorLineFrequency;s<i/2;s+=this._majorLineFrequency)l=r+s*this.cellHeight,t.moveTo(this._currentMeasure.left,l),t.lineTo(this._currentMeasure.left+this._currentMeasure.width,l),t.closePath(),t.stroke()}}t.restore()},e.prototype._getTypeName=function(){return"DisplayGrid"},s([(0,h.serialize)()],e.prototype,"displayMinorLines",null),s([(0,h.serialize)()],e.prototype,"displayMajorLines",null),s([(0,h.serialize)()],e.prototype,"background",null),s([(0,h.serialize)()],e.prototype,"cellWidth",null),s([(0,h.serialize)()],e.prototype,"cellHeight",null),s([(0,h.serialize)()],e.prototype,"minorLineTickness",null),s([(0,h.serialize)()],e.prototype,"minorLineColor",null),s([(0,h.serialize)()],e.prototype,"majorLineTickness",null),s([(0,h.serialize)()],e.prototype,"majorLineColor",null),s([(0,h.serialize)()],e.prototype,"majorLineFrequency",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.DisplayGrid",et);var it=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._tempMeasure=new g(0,0,0,0),i}return n(e,t),Object.defineProperty(e.prototype,"displayThumb",{get:function(){return this._displayThumb&&null!=this.thumbImage},set:function(t){this._displayThumb!==t&&(this._displayThumb=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backgroundImage",{get:function(){return this._backgroundImage},set:function(t){var e=this;this._backgroundImage!==t&&(this._backgroundImage=t,t&&!t.isLoaded&&t.onImageLoadedObservable.addOnce((function(){return e._markAsDirty()})),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"valueBarImage",{get:function(){return this._valueBarImage},set:function(t){var e=this;this._valueBarImage!==t&&(this._valueBarImage=t,t&&!t.isLoaded&&t.onImageLoadedObservable.addOnce((function(){return e._markAsDirty()})),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbImage",{get:function(){return this._thumbImage},set:function(t){var e=this;this._thumbImage!==t&&(this._thumbImage=t,t&&!t.isLoaded&&t.onImageLoadedObservable.addOnce((function(){return e._markAsDirty()})),this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"ImageBasedSlider"},e.prototype._draw=function(t){t.save(),this._applyStates(t),this._prepareRenderingData("rectangle");var e=this._getThumbPosition(),i=this._renderLeft,o=this._renderTop,r=this._renderWidth,n=this._renderHeight;this._backgroundImage&&(this._tempMeasure.copyFromFloats(i,o,r,n),this.isThumbClamped&&this.displayThumb&&(this.isVertical?this._tempMeasure.height+=this._effectiveThumbThickness:this._tempMeasure.width+=this._effectiveThumbThickness),this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure),this._backgroundImage._draw(t)),this._valueBarImage&&(this.isVertical?this.isThumbClamped&&this.displayThumb?this._tempMeasure.copyFromFloats(i,o+e,r,n-e+this._effectiveThumbThickness):this._tempMeasure.copyFromFloats(i,o+e,r,n-e):this.isThumbClamped&&this.displayThumb?this._tempMeasure.copyFromFloats(i,o,e+this._effectiveThumbThickness/2,n):this._tempMeasure.copyFromFloats(i,o,e,n),this._valueBarImage._currentMeasure.copyFrom(this._tempMeasure),this._valueBarImage._draw(t)),this.displayThumb&&(this.isVertical?this._tempMeasure.copyFromFloats(i-this._effectiveBarOffset,this._currentMeasure.top+e,this._currentMeasure.width,this._effectiveThumbThickness):this._tempMeasure.copyFromFloats(this._currentMeasure.left+e,this._currentMeasure.top,this._effectiveThumbThickness,this._currentMeasure.height),this._thumbImage._currentMeasure.copyFrom(this._tempMeasure),this._thumbImage._draw(t)),t.restore()},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e);var i={},o={},r={};this.backgroundImage.serialize(i),this.thumbImage.serialize(o),this.valueBarImage.serialize(r),e.backgroundImage=i,e.thumbImage=o,e.valueBarImage=r},e.prototype._parseFromContent=function(e,i){t.prototype._parseFromContent.call(this,e,i),this.backgroundImage=C.Parse(e.backgroundImage,i),this.thumbImage=C.Parse(e.thumbImage,i),this.valueBarImage=C.Parse(e.valueBarImage,i)},s([(0,h.serialize)()],e.prototype,"displayThumb",null),e}(V);(0,h.RegisterClass)("BABYLON.GUI.ImageBasedSlider",it);var ot="Statics";y.AddHeader=function(t,e,i,o){var r=new S("panel"),n=!o||o.isHorizontal,a=!o||o.controlFirst;r.isVertical=!n;var s=new B("header");return s.text=e,s.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,n?s.width=i:s.height=i,a?(r.addControl(t),r.addControl(s),s.paddingLeft="5px"):(r.addControl(s),r.addControl(t),s.paddingRight="5px"),s.shadowBlur=t.shadowBlur,s.shadowColor=t.shadowColor,s.shadowOffsetX=t.shadowOffsetX,s.shadowOffsetY=t.shadowOffsetY,r};var rt=function(){function t(){this._colorStops=[],this._gradientDirty=!0}return t.prototype._addColorStopsToCanvasGradient=function(){for(var t=0,e=this._colorStops;t<e.length;t++){var i=e[t];this._canvasGradient.addColorStop(i.offset,i.color)}},t.prototype.getCanvasGradient=function(t){return(this._gradientDirty||this._context!==t)&&(this._context=t,this._canvasGradient=this._createCanvasGradient(t),this._addColorStopsToCanvasGradient(),this._gradientDirty=!1),this._canvasGradient},t.prototype.addColorStop=function(t,e){this._colorStops.push({offset:t,color:e}),this._gradientDirty=!0},t.prototype.removeColorStop=function(t){this._colorStops=this._colorStops.filter((function(e){return e.offset!==t})),this._gradientDirty=!0},t.prototype.clearColorStops=function(){this._colorStops=[],this._gradientDirty=!0},Object.defineProperty(t.prototype,"colorStops",{get:function(){return this._colorStops},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"BaseGradient"},t.prototype.serialize=function(t){t.colorStops=this._colorStops,t.className=this.getClassName()},t.prototype.parse=function(t){this._colorStops=t.colorStops},t}(),nt=function(t){function e(e,i,o,r){var n=t.call(this)||this;return n._x0=null!=e?e:0,n._y0=null!=i?i:0,n._x1=null!=o?o:0,n._y1=null!=r?r:0,n}return n(e,t),e.prototype._createCanvasGradient=function(t){return t.createLinearGradient(this._x0,this._y0,this._x1,this._y1)},Object.defineProperty(e.prototype,"x0",{get:function(){return this._x0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"x1",{get:function(){return this._x1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y0",{get:function(){return this._y0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y1",{get:function(){return this._y1},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"LinearGradient"},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),e.x0=this._x0,e.y0=this._y0,e.x1=this._x1,e.y1=this._y1},e.prototype.parse=function(e){t.prototype.parse.call(this,e),this._x0=e.x0,this._y0=e.y0,this._x1=e.x1,this._y1=e.y1},e}(rt);(0,h.RegisterClass)("BABYLON.GUI.LinearGradient",nt);var at=function(t){function e(e,i,o,r,n,a){var s=t.call(this)||this;return s._x0=null!=e?e:0,s._y0=null!=i?i:0,s._r0=null!=o?o:0,s._x1=null!=r?r:0,s._y1=null!=n?n:0,s._r1=null!=a?a:0,s}return n(e,t),e.prototype._createCanvasGradient=function(t){return t.createRadialGradient(this._x0,this._y0,this._r0,this._x1,this._y1,this._r1)},Object.defineProperty(e.prototype,"x0",{get:function(){return this._x0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"x1",{get:function(){return this._x1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y0",{get:function(){return this._y0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y1",{get:function(){return this._y1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"r0",{get:function(){return this._r0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"r1",{get:function(){return this._r1},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"RadialGradient"},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),e.x0=this._x0,e.y0=this._y0,e.r0=this._r0,e.x1=this._x1,e.y1=this._y1,e.r1=this._r1},e.prototype.parse=function(e){t.prototype.parse.call(this,e),this._x0=e.x0,this._y0=e.y0,this._r0=e.r0,this._x1=e.x1,this._y1=e.y1,this._r1=e.r1},e}(rt);(0,h.RegisterClass)("BABYLON.GUI.RadialGradient",at);var st=function(){function t(t){this._fontFamily="Arial",this._fontStyle="",this._fontWeight="",this._fontSize=new c(18,c.UNITMODE_PIXEL,!1),this.onChangedObservable=new h.Observable,this._host=t}return Object.defineProperty(t.prototype,"fontSize",{get:function(){return this._fontSize.toString(this._host)},set:function(t){this._fontSize.toString(this._host)!==t&&this._fontSize.fromString(t)&&this.onChangedObservable.notifyObservers(this)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this.onChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this.onChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this.onChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.onChangedObservable.clear()},t}(),lt=function(t){function e(e,i,o,r,n,a,s){void 0===i&&(i=0),void 0===o&&(o=0),void 0===n&&(n=!1),void 0===a&&(a=h.Texture.NEAREST_SAMPLINGMODE),void 0===s&&(s=!0);var l=t.call(this,e,{width:i,height:o},r,n,a,h.Constants.TEXTUREFORMAT_RGBA,s)||this;return l.onGuiReadyObservable=new h.Observable,l._isDirty=!1,l._rootContainer=new x("root"),l._lastControlOver={},l._lastControlDown={},l._capturingControl={},l._linkedControls=new Array,l._isFullscreen=!1,l._fullscreenViewport=new h.Viewport(0,0,1,1),l._idealWidth=0,l._idealHeight=0,l._useSmallestIdeal=!1,l._renderAtIdealSize=!1,l._blockNextFocusCheck=!1,l._renderScale=1,l._cursorChanged=!1,l._defaultMousePointerId=0,l._rootChildrenHaveChanged=!1,l._capturedPointerIds=new Set,l._numLayoutCalls=0,l._numRenderCalls=0,l._clipboardData="",l.onClipboardObservable=new h.Observable,l.onControlPickedObservable=new h.Observable,l.onBeginLayoutObservable=new h.Observable,l.onEndLayoutObservable=new h.Observable,l.onBeginRenderObservable=new h.Observable,l.onEndRenderObservable=new h.Observable,l.premulAlpha=!1,l.applyYInversionOnUpdate=!0,l.skipBlockEvents=0,l.checkPointerEveryFrame=!1,l._useInvalidateRectOptimization=!0,l._invalidatedRectangle=null,l._clearMeasure=new g(0,0,0,0),l._onClipboardCopy=function(t){var e=t,i=new h.ClipboardInfo(h.ClipboardEventTypes.COPY,e);l.onClipboardObservable.notifyObservers(i),e.preventDefault()},l._onClipboardCut=function(t){var e=t,i=new h.ClipboardInfo(h.ClipboardEventTypes.CUT,e);l.onClipboardObservable.notifyObservers(i),e.preventDefault()},l._onClipboardPaste=function(t){var e=t,i=new h.ClipboardInfo(h.ClipboardEventTypes.PASTE,e);l.onClipboardObservable.notifyObservers(i),e.preventDefault()},l.parseContent=l.parseSerializedObject,(r=l.getScene())&&l._texture?(l.applyYInversionOnUpdate=s,l._rootElement=r.getEngine().getInputElement(),l._renderObserver=r.onBeforeCameraRenderObservable.add((function(t){return l._checkUpdate(t)})),l._controlAddedObserver=l._rootContainer.onControlAddedObservable.add((function(t){t&&(l._rootChildrenHaveChanged=!0)})),l._controlRemovedObserver=l._rootContainer.onControlRemovedObservable.add((function(t){t&&(l._rootChildrenHaveChanged=!0)})),l._preKeyboardObserver=r.onPreKeyboardObservable.add((function(t){l._focusedControl&&(t.type===h.KeyboardEventTypes.KEYDOWN&&l._focusedControl.processKeyboard(t.event),t.skipOnPointerObservable=!0)})),l._rootContainer._link(l),l.hasAlpha=!0,i&&o||(l._resizeObserver=r.getEngine().onResizeObservable.add((function(){return l._onResize()})),l._onResize()),l._texture.isReady=!0,l):l}return n(e,t),Object.defineProperty(e.prototype,"numLayoutCalls",{get:function(){return this._numLayoutCalls},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"numRenderCalls",{get:function(){return this._numRenderCalls},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderScale",{get:function(){return this._renderScale},set:function(t){t!==this._renderScale&&(this._renderScale=t,this._onResize())},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,"idealWidth",{get:function(){return this._idealWidth},set:function(t){this._idealWidth!==t&&(this._idealWidth=t,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"idealHeight",{get:function(){return this._idealHeight},set:function(t){this._idealHeight!==t&&(this._idealHeight=t,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useSmallestIdeal",{get:function(){return this._useSmallestIdeal},set:function(t){this._useSmallestIdeal!==t&&(this._useSmallestIdeal=t,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderAtIdealSize",{get:function(){return this._renderAtIdealSize},set:function(t){this._renderAtIdealSize!==t&&(this._renderAtIdealSize=t,this._onResize())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"idealRatio",{get:function(){var t=0,e=0;return this._idealWidth&&(t=this.getSize().width/this._idealWidth),this._idealHeight&&(e=this.getSize().height/this._idealHeight),this._useSmallestIdeal&&this._idealWidth&&this._idealHeight?window.innerWidth<window.innerHeight?t:e:this._idealWidth?t:this._idealHeight?e:1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"layer",{get:function(){return this._layerToDispose},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rootContainer",{get:function(){return this._rootContainer},enumerable:!1,configurable:!0}),e.prototype.getChildren=function(){return[this._rootContainer]},e.prototype.getDescendants=function(t,e){return this._rootContainer.getDescendants(t,e)},e.prototype.getControlsByType=function(t){return this._rootContainer.getDescendants(!1,(function(e){return e.typeName===t}))},e.prototype.getControlByName=function(t){return this._getControlByKey("name",t)},e.prototype._getControlByKey=function(t,e){return this._rootContainer.getDescendants().find((function(i){return i[t]===e}))||null},Object.defineProperty(e.prototype,"focusedControl",{get:function(){return this._focusedControl},set:function(t){this._focusedControl!=t&&(this._focusedControl&&this._focusedControl.onBlur(),t&&t.onFocus(),this._focusedControl=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isForeground",{get:function(){return!this.layer||!this.layer.isBackground},set:function(t){this.layer&&this.layer.isBackground!==!t&&(this.layer.isBackground=!t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clipboardData",{get:function(){return this._clipboardData},set:function(t){this._clipboardData=t},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"AdvancedDynamicTexture"},e.prototype.executeOnAllControls=function(t,e){e||(e=this._rootContainer),t(e);for(var i=0,o=e.children;i<o.length;i++){var r=o[i];r.children?this.executeOnAllControls(t,r):t(r)}},Object.defineProperty(e.prototype,"useInvalidateRectOptimization",{get:function(){return this._useInvalidateRectOptimization},set:function(t){this._useInvalidateRectOptimization=t},enumerable:!1,configurable:!0}),e.prototype.invalidateRect=function(t,e,i,o){if(this._useInvalidateRectOptimization)if(this._invalidatedRectangle){var r=Math.ceil(Math.max(this._invalidatedRectangle.left+this._invalidatedRectangle.width-1,i)),n=Math.ceil(Math.max(this._invalidatedRectangle.top+this._invalidatedRectangle.height-1,o));this._invalidatedRectangle.left=Math.floor(Math.min(this._invalidatedRectangle.left,t)),this._invalidatedRectangle.top=Math.floor(Math.min(this._invalidatedRectangle.top,e)),this._invalidatedRectangle.width=r-this._invalidatedRectangle.left+1,this._invalidatedRectangle.height=n-this._invalidatedRectangle.top+1}else this._invalidatedRectangle=new g(t,e,i-t+1,o-e+1)},e.prototype.markAsDirty=function(){this._isDirty=!0},e.prototype.createStyle=function(){return new st(this)},e.prototype.addControl=function(t){return this._rootContainer.addControl(t),this},e.prototype.removeControl=function(t){return this._rootContainer.removeControl(t),this},e.prototype.moveToNonOverlappedPosition=function(t,i,o){var r;if(void 0===i&&(i=1),void 0===o&&(o=1),Array.isArray(t))r=t;else{var n=this.getDescendants(!0);r=void 0===t?n.filter((function(t){return void 0!==t.overlapGroup})):n.filter((function(e){return e.overlapGroup===t}))}r.forEach((function(t){var n,a=h.Vector2.Zero(),s=new h.Vector2(t.centerX,t.centerY);r.forEach((function(i){if(t!==i&&e._Overlaps(t,i)){var r=s.subtract(new h.Vector2(i.centerX,i.centerY)),n=r.length();n>0&&(a=a.add(r.normalize().scale(o/n)))}})),a.length()>0&&(a=a.normalize().scale(i*(null!==(n=t.overlapDeltaMultiplier)&&void 0!==n?n: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._prePointerObserver&&e.onPrePointerObservable.remove(this._prePointerObserver),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._controlAddedObserver&&this._rootContainer.onControlAddedObservable.remove(this._controlAddedObserver),this._controlRemovedObserver&&this._rootContainer.onControlRemovedObservable.remove(this._controlRemovedObserver),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(),this.onGuiReadyObservable.clear(),t.prototype.dispose.call(this))},e.prototype._onResize=function(){var t=this.getScene();if(t){var e=t.getEngine(),i=this.getSize(),o=e.getRenderWidth()*this._renderScale,r=e.getRenderHeight()*this._renderScale;this._renderAtIdealSize&&(this._idealWidth?(r=r*this._idealWidth/o,o=this._idealWidth):this._idealHeight&&(o=o*this._idealHeight/r,r=this._idealHeight)),i.width===o&&i.height===r||(this.scaleTo(o,r),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)),o=Math.round(e.height*(1/this.rootContainer.scaleY));return e.x+=(e.width-i)/2,e.y+=(e.height-o)/2,e.width=i,e.height=o,e},e.prototype.getProjectedPosition=function(t,e){var i=this.getProjectedPositionWithZ(t,e);return new h.Vector2(i.x,i.y)},e.prototype.getProjectedPositionWithZ=function(t,e){var i=this.getScene();if(!i)return h.Vector3.Zero();var o=this._getGlobalViewport(),r=h.Vector3.Project(t,e,i.getTransformMatrix(),o);return new h.Vector3(r.x,r.y,r.z)},e.prototype._checkUpdate=function(t,i){if(!this._layerToDispose||t.layerMask&this._layerToDispose.layerMask){if(this._isFullscreen&&this._linkedControls.length){var o=this.getScene();if(!o)return;for(var r=this._getGlobalViewport(),n=function(t){if(!t.isVisible)return"continue";var e=t._linkedMesh;if(!e||e.isDisposed())return h.Tools.SetImmediate((function(){t.linkWithMesh(null)})),"continue";var i=e.getBoundingInfo?e.getBoundingInfo().boundingSphere.center:h.Vector3.ZeroReadOnly,n=h.Vector3.Project(i,e.getWorldMatrix(),o.getTransformMatrix(),r);if(n.z<0||n.z>1)return t.notRenderable=!0,"continue";t.notRenderable=!1,a.useInvalidateRectOptimization&&t.invalidateRect(),t._moveToProjectedPosition(n)},a=this,s=0,l=this._linkedControls;s<l.length;s++)n(l[s])}(this._isDirty||this._rootContainer.isDirty)&&(this._isDirty=!1,this._render(i),i||this.update(this.applyYInversionOnUpdate,this.premulAlpha,e.AllowGPUOptimizations))}},e.prototype._render=function(t){var e,i=this.getSize(),o=i.width,r=i.height,n=this.getContext();if(n.font="18px Arial",n.strokeStyle="white",this.onGuiReadyObservable.hasObservers()&&this._checkGuiIsReady(),this._rootChildrenHaveChanged){var a=null===(e=this.getScene())||void 0===e?void 0:e.activeCamera;a&&(this._rootChildrenHaveChanged=!1,this._checkUpdate(a,!0))}this.onBeginLayoutObservable.notifyObservers(this);var s=new g(0,0,o,r);this._numLayoutCalls=0,this._rootContainer._layout(s,n),this.onEndLayoutObservable.notifyObservers(this),this._isDirty=!1,t||(this._invalidatedRectangle?this._clearMeasure.copyFrom(this._invalidatedRectangle):this._clearMeasure.copyFromFloats(0,0,o,r),n.clearRect(this._clearMeasure.left,this._clearMeasure.top,this._clearMeasure.width,this._clearMeasure.height),this._background&&(n.save(),n.fillStyle=this._background,n.fillRect(this._clearMeasure.left,this._clearMeasure.top,this._clearMeasure.width,this._clearMeasure.height),n.restore()),this.onBeginRenderObservable.notifyObservers(this),this._numRenderCalls=0,this._rootContainer._render(n,this._invalidatedRectangle),this.onEndRenderObservable.notifyObservers(this),this._invalidatedRectangle=null)},e.prototype._changeCursor=function(t){this._rootElement&&(this._rootElement.style.cursor=t,this._cursorChanged=!0)},e.prototype._registerLastControlDown=function(t,e){this._lastControlDown[e]=t,this.onControlPickedObservable.notifyObservers(t)},e.prototype._doPicking=function(t,e,i,o,r,n,a,s){var l=this.getScene();if(l){var _=l.getEngine(),c=this.getSize();if(this._isFullscreen){var u=l.cameraToUseForPointers||l.activeCamera;if(!u)return;var d=u.viewport;t*=c.width/(_.getRenderWidth()*d.width),e*=c.height/(_.getRenderHeight()*d.height)}if(this._capturingControl[r])return this._capturingControl[r].isPointerBlocker&&(this._shouldBlockPointer=!0),void this._capturingControl[r]._processObservables(o,t,e,i,r,n);this._cursorChanged=!1,this._rootContainer._processPicking(t,e,i,o,r,n,a,s)||(l.doNotHandleCursors||this._changeCursor(""),o===h.PointerEventTypes.POINTERMOVE&&this._lastControlOver[r]&&(this._lastControlOver[r]._onPointerOut(this._lastControlOver[r],i),delete this._lastControlOver[r])),this._cursorChanged||l.doNotHandleCursors||this._changeCursor(""),this._manageFocus()}},e.prototype._cleanControlAfterRemovalFromList=function(t,e){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&t[i]===e&&delete t[i]},e.prototype._cleanControlAfterRemoval=function(t){this._cleanControlAfterRemovalFromList(this._lastControlDown,t),this._cleanControlAfterRemovalFromList(this._lastControlOver,t)},e.prototype.pick=function(t,e,i){void 0===i&&(i=null),this._isFullscreen&&this._scene&&this._translateToPicking(this._scene,new h.Viewport(0,0,0,0),i,t,e)},e.prototype._translateToPicking=function(t,e,i,o,r){void 0===o&&(o=t.pointerX),void 0===r&&(r=t.pointerY);var n=t.cameraToUseForPointers||t.activeCamera,a=t.getEngine(),s=t.cameraToUseForPointers;if(n)if(n.rigCameras.length){var l=new h.Viewport(0,0,1,1);n.rigCameras.forEach((function(i){i.viewport.toGlobalToRef(a.getRenderWidth(),a.getRenderHeight(),l);var n=o/a.getHardwareScalingLevel()-l.x,s=r/a.getHardwareScalingLevel()-(a.getRenderHeight()-l.y-l.height);n<0||s<0||o>l.width||r>l.height||(t.cameraToUseForPointers=i,e.x=l.x,e.y=l.y,e.width=l.width,e.height=l.height)}))}else n.viewport.toGlobalToRef(a.getRenderWidth(),a.getRenderHeight(),e);else e.x=0,e.y=0,e.width=a.getRenderWidth(),e.height=a.getRenderHeight();var _=o/a.getHardwareScalingLevel()-e.x,c=r/a.getHardwareScalingLevel()-(a.getRenderHeight()-e.y-e.height);if(this._shouldBlockPointer=!1,i){var u=i.event.pointerId||this._defaultMousePointerId;this._doPicking(_,c,i,i.type,u,i.event.button,i.event.deltaX,i.event.deltaY),(this._shouldBlockPointer&&!(i.type&this.skipBlockEvents)||this._capturingControl[u])&&(i.skipOnPointerObservable=!0)}else this._doPicking(_,c,null,h.PointerEventTypes.POINTERMOVE,this._defaultMousePointerId,0);t.cameraToUseForPointers=s},e.prototype.attach=function(){var t=this,e=this.getScene();if(e){var i=new h.Viewport(0,0,0,0);this._prePointerObserver=e.onPrePointerObservable.add((function(o){if((!e.isPointerCaptured(o.event.pointerId)||o.type!==h.PointerEventTypes.POINTERUP||t._capturedPointerIds.has(o.event.pointerId))&&(o.type===h.PointerEventTypes.POINTERMOVE||o.type===h.PointerEventTypes.POINTERUP||o.type===h.PointerEventTypes.POINTERDOWN||o.type===h.PointerEventTypes.POINTERWHEEL)){if(o.type===h.PointerEventTypes.POINTERMOVE){if(e.isPointerCaptured(o.event.pointerId))return;o.event.pointerId&&(t._defaultMousePointerId=o.event.pointerId)}t._translateToPicking(e,i,o)}})),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._transformUvs=function(t){var e,i=this.getTextureMatrix();if(i.isIdentityAs3x2())e=t;else{var o=h.TmpVectors.Matrix[0];i.getRowToRef(0,h.TmpVectors.Vector4[0]),i.getRowToRef(1,h.TmpVectors.Vector4[1]),i.getRowToRef(2,h.TmpVectors.Vector4[2]);var r=h.TmpVectors.Vector4[0],n=h.TmpVectors.Vector4[1],a=h.TmpVectors.Vector4[2];o.setRowFromFloats(0,r.x,r.y,0,0),o.setRowFromFloats(1,n.x,n.y,0,0),o.setRowFromFloats(2,0,0,1,0),o.setRowFromFloats(3,a.x,a.y,0,1),e=h.TmpVectors.Vector2[0],h.Vector2.TransformToRef(t,o,e)}if((this.wrapU===h.Texture.WRAP_ADDRESSMODE||this.wrapU===h.Texture.MIRROR_ADDRESSMODE)&&e.x>1){var s=e.x-Math.trunc(e.x);this.wrapU===h.Texture.MIRROR_ADDRESSMODE&&Math.trunc(e.x)%2==1&&(s=1-s),e.x=s}if((this.wrapV===h.Texture.WRAP_ADDRESSMODE||this.wrapV===h.Texture.MIRROR_ADDRESSMODE)&&e.y>1){var l=e.y-Math.trunc(e.y);this.wrapV===h.Texture.MIRROR_ADDRESSMODE&&Math.trunc(e.x)%2==1&&(l=1-l),e.y=l}return e},e.prototype.attachToMesh=function(t,e){var i=this;void 0===e&&(e=!0);var o=this.getScene();o&&(this._pointerObserver&&o.onPointerObservable.remove(this._pointerObserver),this._pointerObserver=o.onPointerObservable.add((function(e){if(e.type===h.PointerEventTypes.POINTERMOVE||e.type===h.PointerEventTypes.POINTERUP||e.type===h.PointerEventTypes.POINTERDOWN||e.type===h.PointerEventTypes.POINTERWHEEL){e.type===h.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){r=i._transformUvs(r);var n=i.getSize();i._doPicking(r.x*n.width,(i.applyYInversionOnUpdate?1-r.y:r.y)*n.height,e,e.type,o,e.event.button,e.event.deltaX,e.event.deltaY)}}else if(e.type===h.PointerEventTypes.POINTERUP){if(i._lastControlDown[o]&&i._lastControlDown[o]._forcePointerUp(o),delete i._lastControlDown[o],i.focusedControl){var a=i.focusedControl.keepsFocusWith(),s=!0;if(a)for(var l=0,_=a;l<_.length;l++){var c=_[l];if(i!==c._host){var u=c._host;if(u._lastControlOver[o]&&u._lastControlOver[o].isAscendant(c)){s=!1;break}}}s&&(i.focusedControl=null)}}else e.type===h.PointerEventTypes.POINTERMOVE&&(i._lastControlOver[o]&&i._lastControlOver[o]._onPointerOut(i._lastControlOver[o],e,!0),delete i._lastControlOver[o])}})),t.enablePointerMoveEvents=e,this._attachPickingToSceneRender(o,(function(){var e=i._defaultMousePointerId,r=null==o?void 0:o.pick(o.pointerX,o.pointerY);if(r&&r.hit&&r.pickedMesh===t){var n=r.getTextureCoordinates();if(n){n=i._transformUvs(n);var a=i.getSize();i._doPicking(n.x*a.width,(i.applyYInversionOnUpdate?1-n.y:n.y)*a.height,null,h.PointerEventTypes.POINTERMOVE,e,0)}}else i._lastControlOver[e]&&i._lastControlOver[e]._onPointerOut(i._lastControlOver[e],null,!0),delete i._lastControlOver[e]}),!0),this._attachToOnPointerOut(o),this._attachToOnBlur(o))},e.prototype.moveFocusToControl=function(t){this.focusedControl=t,this._lastPickedControl=t,this._blockNextFocusCheck=!0},e.prototype._manageFocus=function(){if(this._blockNextFocusCheck)return this._blockNextFocusCheck=!1,void(this._lastPickedControl=this._focusedControl);if(this._focusedControl&&this._focusedControl!==this._lastPickedControl){if(this._lastPickedControl.isFocusInvisible)return;this.focusedControl=null}},e.prototype._attachPickingToSceneRender=function(t,e,i){var o=this;this._sceneRenderObserver=t.onBeforeRenderObservable.add((function(){o.checkPointerEveryFrame&&(o._linkedControls.length>0||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(t.pointerId),delete e._lastControlDown[t.pointerId])}))},e.prototype._attachToOnBlur=function(t){var e=this;this._canvasBlurObserver=t.getEngine().onCanvasBlurObservable.add((function(){Object.entries(e._lastControlDown).forEach((function(t){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.parseSerializedObject=function(t,e,i){if(this._rootContainer=y.Parse(t.root,this,i),e){var o=t.width,r=t.height;"number"==typeof o&&"number"==typeof r&&o>=0&&r>=0?this.scaleTo(o,r):this.scaleTo(1920,1080)}},e.prototype.clone=function(t,i){var o=this.getScene();if(!o)return this;var r,n=this.getSize(),a=this.serializeContent();return(r=this._isFullscreen?e.CreateFullscreenUI(null!=t?t:"Clone of "+this.name):i?e.CreateForMesh(i,n.width,n.height):new e(null!=t?t:"Clone of "+this.name,n.width,n.height,o,!this.noMipmap,this.samplingMode)).parseSerializedObject(a),r},e.ParseFromSnippetAsync=function(t,i,o,r){return l(this,void 0,void 0,(function(){var n,a;return _(this,(function(s){switch(s.label){case 0:return n=null!=o?o:e.CreateFullscreenUI("ADT from snippet"),"_BLANK"===t?[2,n]:[4,e._LoadURLContentAsync(e.SnippetUrl+"/"+t.replace(/#/g,"/"),!0)];case 1:return a=s.sent(),n.parseSerializedObject(a,i,r),[2,n]}}))}))},e.prototype.parseFromSnippetAsync=function(t,i,o){return e.ParseFromSnippetAsync(t,i,this,o)},e.ParseFromFileAsync=function(t,i,o,r){return l(this,void 0,void 0,(function(){var n,a;return _(this,(function(s){switch(s.label){case 0:return n=null!=o?o:e.CreateFullscreenUI("ADT from URL"),[4,e._LoadURLContentAsync(t)];case 1:return a=s.sent(),n.parseSerializedObject(a,i,r),[2,n]}}))}))},e.prototype.parseFromURLAsync=function(t,i,o){return e.ParseFromFileAsync(t,i,this,o)},e._LoadURLContentAsync=function(t,e){return void 0===e&&(e=!1),""===t?Promise.reject("No URL provided"):new Promise((function(i,o){var r=new h.WebRequest;r.addEventListener("readystatechange",(function(){if(4==r.readyState)if(200==r.status){var t=void 0;if(e){var n=JSON.parse(JSON.parse(r.responseText).jsonPayload);t=n.encodedGui?new TextDecoder("utf-8").decode((0,h.DecodeBase64ToBinary)(n.encodedGui)):n.gui}else t=r.responseText;var a=JSON.parse(t);i(a)}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.widthInPixels<e.centerX||t.centerY+t.heightInPixels<e.centerY||t.centerY>e.centerY+e.heightInPixels)},e.CreateForMesh=function(t,i,o,r,n,a,s,l){void 0===i&&(i=1024),void 0===o&&(o=1024),void 0===r&&(r=!0),void 0===n&&(n=!1),void 0===s&&(s=this._CreateMaterial),void 0===l&&(l=h.Texture.TRILINEAR_SAMPLINGMODE);var _=(0,h.RandomGUID)(),c=new e("AdvancedDynamicTexture for ".concat(t.name," [").concat(_,"]"),i,o,t.getScene(),!0,l,a);return s(t,_,c,n),c.attachToMesh(t,r),c},e._CreateMaterial=function(t,e,i,o){var r=(0,h.GetClass)("BABYLON.StandardMaterial");if(!r)throw"StandardMaterial needs to be imported before as it contains a side-effect required by your code.";var n=new r("AdvancedDynamicTextureMaterial for ".concat(t.name," [").concat(e,"]"),t.getScene());n.backFaceCulling=!1,n.diffuseColor=h.Color3.Black(),n.specularColor=h.Color3.Black(),o?(n.diffuseTexture=i,n.emissiveTexture=i,i.hasAlpha=!0):(n.emissiveTexture=i,n.opacityTexture=i),t.material=n},e.CreateForMeshTexture=function(t,i,o,r,n,a){void 0===i&&(i=1024),void 0===o&&(o=1024),void 0===r&&(r=!0),void 0===a&&(a=h.Texture.TRILINEAR_SAMPLINGMODE);var s=new e(t.name+" AdvancedDynamicTexture",i,o,t.getScene(),!0,a,n);return s.attachToMesh(t,r),s},e.CreateFullscreenUI=function(t,i,o,r,n){void 0===i&&(i=!0),void 0===o&&(o=null),void 0===r&&(r=h.Texture.BILINEAR_SAMPLINGMODE),void 0===n&&(n=!1);var a=new e(t,0,0,o,!1,r),s=a.getScene(),l=new h.Layer(t+"_layer",null,s,!i);if(l.texture=a,a._layerToDispose=l,a._isFullscreen=!0,n&&s){var _=1/s.getEngine().getHardwareScalingLevel();a._rootContainer.scaleX=_,a._rootContainer.scaleY=_}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.prototype._checkGuiIsReady=function(){this.guiIsReady()&&(this.onGuiReadyObservable.notifyObservers(this),this.onGuiReadyObservable.clear())},e.prototype.guiIsReady=function(){return this._rootContainer.isReady()},e.SnippetUrl=h.Constants.SnippetUrl,e.AllowGPUOptimizations=!0,e}(h.DynamicTexture),_t=function(){function t(t){this.texture=t,this._captureRenderTime=!1,this._renderTime=new h.PerfCounter,this._captureLayoutTime=!1,this._layoutTime=new h.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}(),ht="XmlLoader Exception : XML file is malformed or corrupted.",ct=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 o=0;o<i.length;o++)e=e[i[o]];return e},t.prototype._getClassAttribute=function(t){var e=t.split(".");return(0,h.GetClass)("BABYLON.GUI."+e[0])[e[1]]},t.prototype._createGuiElement=function(t,e,i){void 0===i&&(i=!0);try{var o=new((0,h.GetClass)("BABYLON.GUI."+t.nodeName));e&&i&&e.addControl(o);for(var r=0;r<t.attributes.length;r++)if(!t.attributes[r].name.toLowerCase().includes("datasource"))if(t.attributes[r].name.toLowerCase().includes("observable")){var n=this._getChainElement(t.attributes[r].value);o[t.attributes[r].name].add(n)}else"linkWithMesh"==t.attributes[r].name?this._parentClass?o.linkWithMesh(this._parentClass[t.attributes[r].value]):o.linkWithMesh(window[t.attributes[r].value]):t.attributes[r].value.startsWith("{{")&&t.attributes[r].value.endsWith("}}")?(n=this._getChainElement(t.attributes[r].value.substring(2,t.attributes[r].value.length-2)),o[t.attributes[r].name]=n):this._objectAttributes[t.attributes[r].name]?o[t.attributes[r].name]=this._getClassAttribute(t.attributes[r].value):"true"==t.attributes[r].value||"false"==t.attributes[r].value?o[t.attributes[r].name]="true"==t.attributes[r].value:o[t.attributes[r].name]=isNaN(Number(t.attributes[r].value))?t.attributes[r].value:Number(t.attributes[r].value);if(!t.attributes.getNamedItem("id"))return this._nodes[t.nodeName+Object.keys(this._nodes).length+"_gen"]=o,o;var a=t.attributes.getNamedItem("id").value;if(a.startsWith("{{")&&a.endsWith("}}")&&(a=this._getChainElement(a.substring(2,a.length-2))),this._nodes[a])throw"XmlLoader Exception : Duplicate ID, every element should have an unique ID attribute";return this._nodes[a]=o,o}catch(e){throw"XmlLoader Exception : Error parsing Control "+t.nodeName+","+e+"."}},t.prototype._parseGrid=function(t,e,i){for(var o,r,n,a,s,l=t.children,_=!1,h=-1,c=-1,u=0,d=0;d<l.length;d++)if(l[d].nodeType==this._nodeTypes.element){if("Row"!=l[d].nodeName)throw"XmlLoader Exception : Expecting Row node, received "+l[d].nodeName;if(h+=1,n=l[d].children,!l[d].attributes.getNamedItem("height"))throw"XmlLoader Exception : Height must be defined for grid rows";r=Number(l[d].attributes.getNamedItem("height").nodeValue),_=!!l[d].attributes.getNamedItem("isPixel")&&JSON.parse(l[d].attributes.getNamedItem("isPixel").nodeValue),e.addRowDefinition(r,_);for(var f=0;f<n.length;f++)if(n[f].nodeType==this._nodeTypes.element){if("Column"!=n[f].nodeName)throw"XmlLoader Exception : Expecting Column node, received "+n[f].nodeName;if(c+=1,h>0&&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(!n[f].attributes.getNamedItem("width"))throw"XmlLoader Exception : Width must be defined for all the grid columns in the first row";o=Number(n[f].attributes.getNamedItem("width").nodeValue),_=!!n[f].attributes.getNamedItem("isPixel")&&JSON.parse(n[f].attributes.getNamedItem("isPixel").nodeValue),e.addColumnDefinition(o,_)}a=n[f].children;for(var p=0;p<a.length;p++)a[p].nodeType==this._nodeTypes.element&&(s=this._createGuiElement(a[p],e,!1),e.addControl(s,h,c),a[p].firstChild&&this._parseXml(a[p].firstChild,s))}0==h&&(u=c),c=-1}t.nextSibling&&this._parseXml(t.nextSibling,i)},t.prototype._parseElement=function(t,e,i){t.firstChild&&this._parseXml(t.firstChild,e),t.nextSibling&&this._parseXml(t.nextSibling,i)},t.prototype._prepareSourceElement=function(t,e,i,o,r){this._parentClass?this._parentClass[i]=o[r]:window[i]=o[r],t.firstChild&&this._parseXml(t.firstChild,e,!0)},t.prototype._parseElementsFromSource=function(t,e,i){var o=t.attributes.getNamedItem("dataSource").value;if(!o.includes(" in "))throw"XmlLoader Exception : Malformed XML, Data Source must include an in";var r=!0,n=o.split(" in ");if(n.length<2)throw"XmlLoader Exception : Malformed XML, Data Source must have an iterator and a source";var a=n[1];if(a.startsWith("{")&&a.endsWith("}")&&(r=!1),(!r||a.startsWith("[")&&a.endsWith("]"))&&(a=a.substring(1,a.length-1)),a=this._parentClass?this._parentClass[a]:window[a],r)for(var s=0;s<a.length;s++)this._prepareSourceElement(t,e,n[0],a,s);else for(var s in a)this._prepareSourceElement(t,e,n[0],a,s);t.nextSibling&&this._parseXml(t.nextSibling,i)},t.prototype._parseXml=function(t,e,i){if(void 0===i&&(i=!1),t.nodeType==this._nodeTypes.element){i&&t.setAttribute("id",e.id+(e._children.length+1));var o=this._createGuiElement(t,e);this._rootNode||(this._rootNode=o),"Grid"==t.nodeName?this._parseGrid(t,o,e):t.attributes.getNamedItem("dataSource")?this._parseElementsFromSource(t,o,e):this._parseElement(t,o,e)}else t.nextSibling&&this._parseXml(t.nextSibling,e,i)},t.prototype.isLoaded=function(){return this._isLoaded},t.prototype.getNodeById=function(t){return this._nodes[t]},t.prototype.getNodes=function(){return this._nodes},t.prototype.dispose=function(){this._rootNode&&(this._rootNode.dispose(),this._rootNode=null,this._nodes={})},t.prototype.loadLayout=function(t,e,i,o){var r=this;void 0===i&&(i=null),void 0===o&&(o=null);var n=new XMLHttpRequest;n.onload=function(){if(4===n.readyState&&200===n.status){if(!n.responseXML){if(o)return void o(ht);throw ht}var t=n.responseXML.documentElement;r._parseXml(t.firstChild,e),r._isLoaded=!0,i&&i()}},n.onerror=function(){o&&o("an error occurred during loading the layout")},n.open("GET",t,!0),n.send()},t.prototype.loadLayoutAsync=function(t,e){return l(this,void 0,void 0,(function(){var i=this;return _(this,(function(o){return[2,new Promise((function(o,r){i.loadLayout(t,e,o,r)}))]}))}))},t}(),ut=function(t){function e(e,i){void 0===i&&(i=0);var o=t.call(this,e.x,e.y,e.z)||this;return o.buttonIndex=i,o}return n(e,t),e}(h.Vector3),dt=function(){function t(t){this.name=t,this._downCount=0,this._enterCount=-1,this._downPointerIds={},this._isVisible=!0,this._isScaledByManager=!1,this.onPointerMoveObservable=new h.Observable,this.onPointerOutObservable=new h.Observable,this.onPointerDownObservable=new h.Observable,this.onPointerUpObservable=new h.Observable,this.onPointerClickObservable=new h.Observable,this.onPointerEnterObservable=new h.Observable,this._behaviors=new Array}return Object.defineProperty(t.prototype,"position",{get:function(){return this._node?this._node.position:h.Vector3.Zero()},set:function(t){this._node&&(this._node.position=t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaling",{get:function(){return this._node?this._node.scaling:new h.Vector3(1,1,1)},set:function(t){this._node&&(this._isScaledByManager=!1,this._node.scaling=t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"behaviors",{get:function(){return this._behaviors},enumerable:!1,configurable:!0}),t.prototype.addBehavior=function(t){var e=this;if(-1!==this._behaviors.indexOf(t))return this;t.init();var i=this._host.scene;return i.isLoading?i.onDataLoadedObservable.addOnce((function(){t.attach(e)})):t.attach(this),this._behaviors.push(t),this},t.prototype.removeBehavior=function(t){var e=this._behaviors.indexOf(t);return-1===e||(this._behaviors[e].detach(),this._behaviors.splice(e,1)),this},t.prototype.getBehaviorByName=function(t){for(var e=0,i=this._behaviors;e<i.length;e++){var o=i[e];if(o.name===t)return o}return null},Object.defineProperty(t.prototype,"isVisible",{get:function(){return this._isVisible},set:function(t){if(this._isVisible!==t){this._isVisible=t;var e=this.mesh;e&&e.setEnabled(t)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"typeName",{get:function(){return this._getTypeName()},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return this._getTypeName()},t.prototype._getTypeName=function(){return"Control3D"},Object.defineProperty(t.prototype,"node",{get:function(){return this._node},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mesh",{get:function(){return this._node instanceof h.AbstractMesh?this._node:null},enumerable:!1,configurable:!0}),t.prototype.linkToTransformNode=function(t){return this._node&&(this._node.parent=t),this},t.prototype._prepareNode=function(t){if(!this._node){if(this._node=this._createNode(t),!this.node)return;this._injectGUI3DReservedDataStore(this.node).control=this;var e=this.mesh;e&&(e.isPickable=!0,this._affectMaterial(e))}},t.prototype._injectGUI3DReservedDataStore=function(t){var e,i;return t.reservedDataStore=null!==(e=t.reservedDataStore)&&void 0!==e?e:{},t.reservedDataStore.GUI3D=null!==(i=t.reservedDataStore.GUI3D)&&void 0!==i?i:{},t.reservedDataStore.GUI3D},t.prototype._createNode=function(t){return null},t.prototype._affectMaterial=function(t){t.material=null},t.prototype._isTouchButton3D=function(t){return void 0!==t._generatePointerEventType},t.prototype._onPointerMove=function(t,e){this.onPointerMoveObservable.notifyObservers(e,-1,t,this)},t.prototype._onPointerEnter=function(t){return-1===this._enterCount&&(this._enterCount=0),this._enterCount++,!(this._enterCount>1||(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,o){return this._downCount++,this._downPointerIds[i]=this._downPointerIds[i]+1||1,1===this._downCount&&(this.onPointerDownObservable.notifyObservers(new ut(e,o),-1,t,this),this.pointerDownAnimation&&this.pointerDownAnimation(),!0)},t.prototype._onPointerUp=function(t,e,i,o,r){this._downCount--,this._downPointerIds[i]--,this._downPointerIds[i]<=0&&delete this._downPointerIds[i],this._downCount<0?this._downCount=0:0==this._downCount&&(r&&(this._enterCount>0||-1===this._enterCount)&&this.onPointerClickObservable.notifyObservers(new ut(e,o),-1,t,this),this.onPointerUpObservable.notifyObservers(new ut(e,o),-1,t,this),this.pointerUpAnimation&&this.pointerUpAnimation())},t.prototype.forcePointerUp=function(t){if(void 0===t&&(t=null),null!==t)this._onPointerUp(this,h.Vector3.Zero(),t,0,!0);else{for(var e in this._downPointerIds)this._onPointerUp(this,h.Vector3.Zero(),+e,0,!0);this._downCount>0&&(this._downCount=1,this._onPointerUp(this,h.Vector3.Zero(),0,0,!0))}},t.prototype._processObservables=function(t,e,i,o,r){if(this._isTouchButton3D(this)&&i&&(t=this._generatePointerEventType(t,i,this._downCount)),t===h.PointerEventTypes.POINTERMOVE){this._onPointerMove(this,e);var n=this._host._lastControlOver[o];return n&&n!==this&&n._onPointerOut(this),n!==this&&this._onPointerEnter(this),this._host._lastControlOver[o]=this,!0}return t===h.PointerEventTypes.POINTERDOWN?(this._onPointerDown(this,e,o,r),this._host._lastControlDown[o]=this,this._host._lastPickedControl=this,!0):(t===h.PointerEventTypes.POINTERUP||t===h.PointerEventTypes.POINTERDOUBLETAP)&&(this._host._lastControlDown[o]&&this._host._lastControlDown[o]._onPointerUp(this,e,o,r,!0),delete this._host._lastControlDown[o],!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;t<e.length;t++)e[t].detach()},t}(),ft=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._contentResolution=512,e._contentScaleRatio=2,e}return n(e,t),Object.defineProperty(e.prototype,"content",{get:function(){return this._content},set:function(t){this._content=t,t&&this._host&&this._host.utilityLayer&&(this._facadeTexture?this._facadeTexture.rootContainer.clearControls():(this._facadeTexture=new lt("Facade",this._contentResolution,this._contentResolution,this._host.utilityLayer.utilityLayerScene,!0,h.Texture.TRILINEAR_SAMPLINGMODE),this._setFacadeTextureScaling(),this._facadeTexture.premulAlpha=!0),this._facadeTexture.addControl(t),this._applyFacade(this._facadeTexture))},enumerable:!1,configurable:!0}),e.prototype._setFacadeTextureScaling=function(){var t;this._facadeTexture&&(this._facadeTexture.rootContainer.scaleX=this._contentScaleRatio,this._facadeTexture.rootContainer.scaleY=null!==(t=this._contentScaleRatioY)&&void 0!==t?t:this._contentScaleRatio)},Object.defineProperty(e.prototype,"contentResolution",{get:function(){return this._contentResolution},set:function(t){this._contentResolution!==t&&(this._contentResolution=t,this._resetContent())},enumerable:!1,configurable:!0}),e.prototype._disposeFacadeTexture=function(){this._facadeTexture&&(this._facadeTexture.dispose(),this._facadeTexture=null)},e.prototype._resetContent=function(){this._disposeFacadeTexture(),this.content=this._content},e.prototype._applyFacade=function(t){},e}(dt),pt=function(t){function e(e){return t.call(this,e)||this}return n(e,t),e.prototype._getTypeName=function(){return"AbstractButton3D"},e.prototype._createNode=function(t){return new h.TransformNode("button"+this.name,t)},e}(ft),gt=function(t){function e(e,i){var o=t.call(this,e)||this;return o._options=a({width:1,height:1,depth:.08},i),o.pointerEnterAnimation=function(){o.mesh&&(o._currentMaterial.emissiveColor=h.Color3.Red())},o.pointerOutAnimation=function(){o._currentMaterial.emissiveColor=h.Color3.Black()},o.pointerDownAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(.95)},o.pointerUpAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1/.95)},o}return n(e,t),e.prototype._applyFacade=function(t){this._currentMaterial.emissiveTexture=t},e.prototype._getTypeName=function(){return"Button3D"},e.prototype._createNode=function(t){for(var e=new Array(6),i=0;i<6;i++)e[i]=new h.Vector4(0,0,0,0);t.useRightHandedSystem?e[0].copyFromFloats(1,0,0,1):e[1].copyFromFloats(0,0,1,1);var o=(0,h.CreateBox)(this.name+"_rootMesh",{width:this._options.width,height:this._options.height,depth:this._options.depth,faceUV:e,wrap:!0},t);return this._contentScaleRatioY=this._contentScaleRatio*this._options.width/this._options.height,this._setFacadeTextureScaling(),o},e.prototype._affectMaterial=function(t){var e=new h.StandardMaterial(this.name+"Material",t.getScene());e.specularColor=h.Color3.Black(),t.material=e,this._currentMaterial=e,this._resetContent()},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._disposeFacadeTexture(),this._currentMaterial&&this._currentMaterial.dispose()},e}(pt),bt=function(t){function e(e){var i=t.call(this,e)||this;return i._blockLayout=!1,i._children=new Array,i}return n(e,t),Object.defineProperty(e.prototype,"children",{get:function(){return this._children},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blockLayout",{get:function(){return this._blockLayout},set:function(t){this._blockLayout!==t&&(this._blockLayout=t,this._blockLayout||this._arrangeChildren())},enumerable:!1,configurable:!0}),e.prototype.updateLayout=function(){return this._arrangeChildren(),this},e.prototype.containsControl=function(t){return-1!==this._children.indexOf(t)},e.prototype.addControl=function(t){return-1!==this._children.indexOf(t)||(t.parent=this,t._host=this._host,this._children.push(t),this._host.utilityLayer&&(t._prepareNode(this._host.utilityLayer.utilityLayerScene),t.node&&(t.node.parent=this.node),this.blockLayout||this._arrangeChildren())),this},e.prototype._arrangeChildren=function(){},e.prototype._createNode=function(t){return new h.TransformNode("ContainerNode",t)},e.prototype.removeControl=function(t){var e=this._children.indexOf(t);return-1!==e&&(this._children.splice(e,1),t.parent=null,t._disposeNode()),this},e.prototype._getTypeName=function(){return"Container3D"},e.prototype.dispose=function(){for(var e=0,i=this._children;e<i.length;e++)i[e].dispose();this._children.length=0,t.prototype.dispose.call(this)},e.UNSET_ORIENTATION=0,e.FACEORIGIN_ORIENTATION=1,e.FACEORIGINREVERSED_ORIENTATION=2,e.FACEFORWARD_ORIENTATION=3,e.FACEFORWARDREVERSED_ORIENTATION=4,e}(dt),mt=function(t){function e(e){var i=t.call(this,e)||this;return i._columns=10,i._rows=0,i._rowThenColum=!0,i._orientation=bt.FACEORIGIN_ORIENTATION,i.margin=0,i}return n(e,t),Object.defineProperty(e.prototype,"orientation",{get:function(){return this._orientation},set:function(t){var e=this;this._orientation!==t&&(this._orientation=t,h.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"columns",{get:function(){return this._columns},set:function(t){var e=this;this._columns!==t&&(this._columns=t,this._rowThenColum=!0,h.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rows",{get:function(){return this._rows},set:function(t){var e=this;this._rows!==t&&(this._rows=t,this._rowThenColum=!1,h.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._arrangeChildren=function(){this._cellWidth=0,this._cellHeight=0;for(var t=0,e=0,i=0,o=h.Matrix.Invert(this.node.computeWorldMatrix(!0)),r=0,n=this._children;r<n.length;r++)if((m=n[r]).mesh){i++,m.mesh.computeWorldMatrix(!0);var a=m.mesh.getHierarchyBoundingVectors(),s=h.TmpVectors.Vector3[0],l=h.TmpVectors.Vector3[1];a.max.subtractToRef(a.min,l),l.scaleInPlace(.5),h.Vector3.TransformNormalToRef(l,o,s),this._cellWidth=Math.max(this._cellWidth,2*s.x),this._cellHeight=Math.max(this._cellHeight,2*s.y)}this._cellWidth+=2*this.margin,this._cellHeight+=2*this.margin,this._rowThenColum?(e=this._columns,t=Math.ceil(i/this._columns)):(t=this._rows,e=Math.ceil(i/this._rows));var _=.5*e*this._cellWidth,c=.5*t*this._cellHeight,u=[],d=0;if(this._rowThenColum)for(var f=0;f<t;f++)for(var p=0;p<e&&(u.push(new h.Vector3(p*this._cellWidth-_+this._cellWidth/2,f*this._cellHeight-c+this._cellHeight/2,0)),!(++d>i));p++);else for(p=0;p<e;p++)for(f=0;f<t&&(u.push(new h.Vector3(p*this._cellWidth-_+this._cellWidth/2,f*this._cellHeight-c+this._cellHeight/2,0)),!(++d>i));f++);d=0;for(var g=0,b=this._children;g<b.length;g++){var m;(m=b[g]).mesh&&(this._mapGridNode(m,u[d]),d++)}this._finalProcessing()},e.prototype._finalProcessing=function(){},e}(bt),vt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._radius=5,e}return n(e,t),Object.defineProperty(e.prototype,"radius",{get:function(){return this._radius},set:function(t){var e=this;this._radius!==t&&(this._radius=t,h.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._mapGridNode=function(t,e){var i=t.mesh;if(i){var o=this._cylindricalMapping(e);switch(t.position=o,this.orientation){case bt.FACEORIGIN_ORIENTATION:i.lookAt(new h.Vector3(2*o.x,o.y,2*o.z));break;case bt.FACEORIGINREVERSED_ORIENTATION:i.lookAt(new h.Vector3(-o.x,o.y,-o.z));break;case bt.FACEFORWARD_ORIENTATION:break;case bt.FACEFORWARDREVERSED_ORIENTATION:i.rotate(h.Axis.Y,Math.PI,h.Space.LOCAL)}}},e.prototype._cylindricalMapping=function(t){var e=new h.Vector3(0,t.y,this._radius),i=t.x/this._radius;return h.Matrix.RotationYawPitchRollToRef(i,0,0,h.TmpVectors.Matrix[0]),h.Vector3.TransformNormal(e,h.TmpVectors.Matrix[0])},e}(mt);h.ShaderStore.ShadersStore.fluentVertexShader="precision highp float;attribute vec3 position;attribute vec3 normal;attribute vec2 uv;uniform mat4 world;uniform mat4 viewProjection;varying vec2 vUV;\n#ifdef BORDER\nvarying vec2 scaleInfo;uniform float borderWidth;uniform vec3 scaleFactor;\n#endif\n#ifdef HOVERLIGHT\nvarying vec3 worldPosition;\n#endif\nvoid main(void) {vUV=uv;\n#ifdef BORDER\nvec3 scale=scaleFactor;float minScale=min(min(scale.x,scale.y),scale.z);float maxScale=max(max(scale.x,scale.y),scale.z);float minOverMiddleScale=minScale/(scale.x+scale.y+scale.z-minScale-maxScale);float areaYZ=scale.y*scale.z;float areaXZ=scale.x*scale.z;float areaXY=scale.x*scale.y;float scaledBorderWidth=borderWidth; \nif (abs(normal.x)==1.0) \n{scale.x=scale.y;scale.y=scale.z;if (areaYZ>areaXZ && areaYZ>areaXY)\n{scaledBorderWidth*=minOverMiddleScale;}}\nelse if (abs(normal.y)==1.0) \n{scale.x=scale.z;if (areaXZ>areaXY && areaXZ>areaYZ)\n{scaledBorderWidth*=minOverMiddleScale;}}\nelse \n{if (areaXY>areaYZ && areaXY>areaXZ)\n{scaledBorderWidth*=minOverMiddleScale;}}\nfloat scaleRatio=min(scale.x,scale.y)/max(scale.x,scale.y);if (scale.x>scale.y)\n{scaleInfo.x=1.0-(scaledBorderWidth*scaleRatio);scaleInfo.y=1.0-scaledBorderWidth;}\nelse\n{scaleInfo.x=1.0-scaledBorderWidth;scaleInfo.y=1.0-(scaledBorderWidth*scaleRatio);} \n#endif \nvec4 worldPos=world*vec4(position,1.0);\n#ifdef HOVERLIGHT\nworldPosition=worldPos.xyz;\n#endif\ngl_Position=viewProjection*worldPos;}\n";h.ShaderStore.ShadersStore.fluentPixelShader="precision highp float;varying vec2 vUV;uniform vec4 albedoColor;\n#ifdef INNERGLOW\nuniform vec4 innerGlowColor;\n#endif\n#ifdef BORDER\nvarying vec2 scaleInfo;uniform float edgeSmoothingValue;uniform float borderMinValue;\n#endif\n#ifdef HOVERLIGHT\nvarying vec3 worldPosition;uniform vec3 hoverPosition;uniform vec4 hoverColor;uniform float hoverRadius;\n#endif\n#ifdef TEXTURE\nuniform sampler2D albedoSampler;uniform mat4 textureMatrix;vec2 finalUV;\n#endif\nvoid main(void) {vec3 albedo=albedoColor.rgb;float alpha=albedoColor.a;\n#ifdef TEXTURE\nfinalUV=vec2(textureMatrix*vec4(vUV,1.0,0.0));albedo=texture2D(albedoSampler,finalUV).rgb;\n#endif\n#ifdef HOVERLIGHT\nfloat pointToHover=(1.0-clamp(length(hoverPosition-worldPosition)/hoverRadius,0.,1.))*hoverColor.a;albedo=clamp(albedo+hoverColor.rgb*pointToHover,0.,1.);\n#else\nfloat pointToHover=1.0;\n#endif\n#ifdef BORDER \nfloat borderPower=10.0;float inverseBorderPower=1.0/borderPower;vec3 borderColor=albedo*borderPower;vec2 distanceToEdge;distanceToEdge.x=abs(vUV.x-0.5)*2.0;distanceToEdge.y=abs(vUV.y-0.5)*2.0;float borderValue=max(smoothstep(scaleInfo.x-edgeSmoothingValue,scaleInfo.x+edgeSmoothingValue,distanceToEdge.x),\nsmoothstep(scaleInfo.y-edgeSmoothingValue,scaleInfo.y+edgeSmoothingValue,distanceToEdge.y));borderColor=borderColor*borderValue*max(borderMinValue*inverseBorderPower,pointToHover); \nalbedo+=borderColor;alpha=max(alpha,borderValue);\n#endif\n#ifdef INNERGLOW\nvec2 uvGlow=(vUV-vec2(0.5,0.5))*(innerGlowColor.a*2.0);uvGlow=uvGlow*uvGlow;uvGlow=uvGlow*uvGlow;albedo+=mix(vec3(0.0,0.0,0.0),innerGlowColor.rgb,uvGlow.x+uvGlow.y); \n#endif\ngl_FragColor=vec4(albedo,alpha);}";var yt=function(t){function e(){var e=t.call(this)||this;return e.INNERGLOW=!1,e.BORDER=!1,e.HOVERLIGHT=!1,e.TEXTURE=!1,e.rebuild(),e}return n(e,t),e}(h.MaterialDefines),xt=function(t){function e(e,i){var o=t.call(this,e,i)||this;return o.innerGlowColorIntensity=.5,o.innerGlowColor=new h.Color3(1,1,1),o.albedoColor=new h.Color3(.3,.35,.4),o.renderBorders=!1,o.borderWidth=.5,o.edgeSmoothingValue=.02,o.borderMinValue=.1,o.renderHoverLight=!1,o.hoverRadius=.01,o.hoverColor=new h.Color4(.3,.3,.3,1),o.hoverPosition=h.Vector3.Zero(),o}return n(e,t),e.prototype.needAlphaBlending=function(){return 1!==this.alpha},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){var i=e._drawWrapper;if(this.isFrozen&&i.effect&&i._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new yt);var o=this.getScene(),r=e.materialDefines;if(!this.checkReadyOnEveryCall&&e.effect&&r._renderId===o.getRenderId())return!0;if(r._areTexturesDirty)if(r.INNERGLOW=this.innerGlowColorIntensity>0,r.BORDER=this.renderBorders,r.HOVERLIGHT=this.renderHoverLight,this._albedoTexture){if(!this._albedoTexture.isReadyOrNotBlocking())return!1;r.TEXTURE=!0}else r.TEXTURE=!1;var n=o.getEngine();if(r.isDirty){r.markAsProcessed(),o.resetCachedMaterial();var a=[h.VertexBuffer.PositionKind];a.push(h.VertexBuffer.NormalKind),a.push(h.VertexBuffer.UVKind);var s=["world","viewProjection","innerGlowColor","albedoColor","borderWidth","edgeSmoothingValue","scaleFactor","borderMinValue","hoverColor","hoverPosition","hoverRadius","textureMatrix"],l=["albedoSampler"],_=[];(0,h.PrepareUniformsAndSamplersList)({uniformsNames:s,uniformBuffersNames:_,samplers:l,defines:r,maxSimultaneousLights:4});var c=r.toString();e.setEffect(o.getEngine().createEffect("fluent",{attributes:a,uniformsNames:s,uniformBuffersNames:_,samplers:l,defines:c,fallbacks:null,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),r,this._materialContext)}return!(!e.effect||!e.effect.isReady()||(r._renderId=o.getRenderId(),i._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o=this.getScene(),r=i.materialDefines;if(r){var n=i.effect;if(n){if(this._activeEffect=n,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),this._mustRebind(o,n,i)&&(this._activeEffect.setColor4("albedoColor",this.albedoColor,this.alpha),r.INNERGLOW&&this._activeEffect.setColor4("innerGlowColor",this.innerGlowColor,this.innerGlowColorIntensity),r.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,h.TmpVectors.Vector3[0]),this._activeEffect.setVector3("scaleFactor",h.TmpVectors.Vector3[0])),r.HOVERLIGHT&&(this._activeEffect.setDirectColor4("hoverColor",this.hoverColor),this._activeEffect.setFloat("hoverRadius",this.hoverRadius),this._activeEffect.setVector3("hoverPosition",this.hoverPosition)),r.TEXTURE&&this._albedoTexture)){this._activeEffect.setTexture("albedoSampler",this._albedoTexture);var a=this._albedoTexture.getTextureMatrix();this._activeEffect.setMatrix("textureMatrix",a)}this._afterBind(e,this._activeEffect,i)}}},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 h.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,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},s([(0,h.serialize)(),(0,h.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"innerGlowColorIntensity",void 0),s([(0,h.serializeAsColor3)()],e.prototype,"innerGlowColor",void 0),s([(0,h.serializeAsColor3)()],e.prototype,"albedoColor",void 0),s([(0,h.serialize)(),(0,h.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"renderBorders",void 0),s([(0,h.serialize)()],e.prototype,"borderWidth",void 0),s([(0,h.serialize)()],e.prototype,"edgeSmoothingValue",void 0),s([(0,h.serialize)()],e.prototype,"borderMinValue",void 0),s([(0,h.serialize)(),(0,h.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"renderHoverLight",void 0),s([(0,h.serialize)()],e.prototype,"hoverRadius",void 0),s([(0,h.serializeAsColor4)()],e.prototype,"hoverColor",void 0),s([(0,h.serializeAsVector3)()],e.prototype,"hoverPosition",void 0),s([(0,h.serializeAsTexture)("albedoTexture")],e.prototype,"_albedoTexture",void 0),s([(0,h.expandToProperty)("_markAllSubMeshesAsTexturesAndMiscDirty")],e.prototype,"albedoTexture",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.FluentMaterial",xt);var Pt=function(t){function e(e){var i=t.call(this,e)||this;return i._backPlateMargin=1.25,i}return n(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 h.Mesh("menu_".concat(this.name),t);return this._backPlate=(0,h.CreateBox)("backPlate"+this.name,{size:1},t),this._backPlate.parent=e,e},e.prototype._affectMaterial=function(t){var e=this;this._backPlateMaterial=new xt(this.name+"backPlateMaterial",t.getScene()),this._backPlateMaterial.albedoColor=new h.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;e<this._children.length;e++)this._children[e].position.subtractInPlace(this._currentMin).subtractInPlace(t.scale(.5)),this._children[e].position.z-=.01}this._currentMin=null,this._currentMax=null},e.prototype.addButton=function(i){var o=this.blockLayout;return o||(this.blockLayout=!0),t.prototype.addControl.call(this,i),i.isBackplateVisible=!1,i.scaling.scaleInPlace(e.MENU_BUTTON_SCALE),o||(this.blockLayout=!1),this},e.prototype.addControl=function(t){return h.Logger.Warn("TouchHolographicMenu can only contain buttons. Please use the method `addButton` instead."),this},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver)},e.MENU_BUTTON_SCALE=1,e}(mt),It=function(t){function e(e,i){var o=t.call(this,i)||this;return o._handConstraintBehavior=new h.HandConstraintBehavior,o._handConstraintBehavior.linkToXRExperience(e),o.backPlateMargin=.15,o.rows=3,o}return n(e,t),Object.defineProperty(e.prototype,"handConstraintBehavior",{get:function(){return this._handConstraintBehavior},enumerable:!1,configurable:!0}),e.prototype._createNode=function(e){var i=t.prototype._createNode.call(this,e);return this._handConstraintBehavior.attach(i),i},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._handConstraintBehavior.detach()},e}(Pt);h.ShaderStore.ShadersStore.fluentBackplatePixelShader="uniform vec3 cameraPosition;varying vec3 vPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec3 vBinormal;varying vec4 vColor;varying vec4 vExtra1;varying vec4 vExtra2;varying vec4 vExtra3;uniform float _Radius_;uniform float _Line_Width_;uniform bool _Absolute_Sizes_;uniform float _Filter_Width_;uniform vec4 _Base_Color_;uniform vec4 _Line_Color_;uniform float _Radius_Top_Left_;uniform float _Radius_Top_Right_;uniform float _Radius_Bottom_Left_;uniform float _Radius_Bottom_Right_;uniform vec3 _Blob_Position_;uniform float _Blob_Intensity_;uniform float _Blob_Near_Size_;uniform float _Blob_Far_Size_;uniform float _Blob_Near_Distance_;uniform float _Blob_Far_Distance_;uniform float _Blob_Fade_Length_;uniform float _Blob_Pulse_;uniform float _Blob_Fade_;uniform sampler2D _Blob_Texture_;uniform vec3 _Blob_Position_2_;uniform float _Blob_Near_Size_2_;uniform float _Blob_Pulse_2_;uniform float _Blob_Fade_2_;uniform float _Rate_;uniform vec4 _Highlight_Color_;uniform float _Highlight_Width_;uniform vec4 _Highlight_Transform_;uniform float _Highlight_;uniform float _Iridescence_Intensity_;uniform float _Iridescence_Edge_Intensity_;uniform float _Angle_;uniform float _Fade_Out_;uniform bool _Reflected_;uniform float _Frequency_;uniform float _Vertical_Offset_;uniform sampler2D _Iridescent_Map_;uniform bool _Use_Global_Left_Index_;uniform bool _Use_Global_Right_Index_;uniform vec4 Global_Left_Index_Tip_Position;uniform vec4 Global_Right_Index_Tip_Position;void Round_Rect_Fragment_B31(\nfloat Radius,\nfloat Line_Width,\nvec4 Line_Color,\nfloat Filter_Width,\nvec2 UV,\nfloat Line_Visibility,\nvec4 Rect_Parms,\nvec4 Fill_Color,\nout vec4 Color)\n{float d=length(max(abs(UV)-Rect_Parms.xy,0.0));float dx=max(fwidth(d)*Filter_Width,0.00001);float g=min(Rect_Parms.z,Rect_Parms.w);float dgrad=max(fwidth(g)*Filter_Width,0.00001);float Inside_Rect=clamp(g/dgrad,0.0,1.0);float inner=clamp((d+dx*0.5-max(Radius-Line_Width,d-dx*0.5))/dx,0.0,1.0);Color=clamp(mix(Fill_Color,Line_Color,inner),0.0,1.0)*Inside_Rect;}\nvoid Blob_Fragment_B71(\nsampler2D Blob_Texture,\nvec4 Blob_Info1,\nvec4 Blob_Info2,\nout vec4 Blob_Color)\n{float k1=dot(Blob_Info1.xy,Blob_Info1.xy);float k2=dot(Blob_Info2.xy,Blob_Info2.xy);vec3 closer=k1<k2 ? vec3(k1,Blob_Info1.z,Blob_Info1.w) : vec3(k2,Blob_Info2.z,Blob_Info2.w);Blob_Color=closer.z*texture(Blob_Texture,vec2(vec2(sqrt(closer.x),closer.y).x,1.0-vec2(sqrt(closer.x),closer.y).y))*clamp(1.0-closer.x,0.0,1.0);}\nvoid Line_Fragment_B48(\nvec4 Base_Color,\nvec4 Highlight_Color,\nfloat Highlight_Width,\nvec3 Line_Vertex,\nfloat Highlight,\nout vec4 Line_Color)\n{float k2=1.0-clamp(abs(Line_Vertex.y/Highlight_Width),0.0,1.0);Line_Color=mix(Base_Color,Highlight_Color,Highlight*k2);}\nvoid Scale_RGB_B54(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{Result=vec4(Scalar,Scalar,Scalar,1)*Color;}\nvoid Conditional_Float_B38(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{Result=Which ? If_True : If_False;}\nvoid main()\n{float R_Q72;float G_Q72;float B_Q72;float A_Q72;R_Q72=vColor.r; G_Q72=vColor.g; B_Q72=vColor.b; A_Q72=vColor.a;vec4 Blob_Color_Q71;\n#if BLOB_ENABLE\nfloat k1=dot(vExtra2.xy,vExtra2.xy);float k2=dot(vExtra3.xy,vExtra3.xy);vec3 closer=k1<k2 ? vec3(k1,vExtra2.z,vExtra2.w) : vec3(k2,vExtra3.z,vExtra3.w);Blob_Color_Q71=closer.z*texture(_Blob_Texture_,vec2(vec2(sqrt(closer.x),closer.y).x,1.0-vec2(sqrt(closer.x),closer.y).y))*clamp(1.0-closer.x,0.0,1.0);\n#else\nBlob_Color_Q71=vec4(0,0,0,0);\n#endif\nvec4 Line_Color_Q48;Line_Fragment_B48(_Line_Color_,_Highlight_Color_,_Highlight_Width_,vTangent,_Highlight_,Line_Color_Q48);float X_Q67;float Y_Q67;X_Q67=vUV.x;Y_Q67=vUV.y;vec3 Incident_Q66=normalize(vPosition-cameraPosition);vec3 Reflected_Q60=reflect(Incident_Q66,vBinormal);float Product_Q63=Y_Q67*_Vertical_Offset_;float Dot_Q68=dot(Incident_Q66, Reflected_Q60);float Dot_Q57=dot(vNormal, Incident_Q66);float Result_Q38;Conditional_Float_B38(_Reflected_,Dot_Q68,Dot_Q57,Result_Q38);float Product_Q64=Result_Q38*_Frequency_;float Sum_Q69=Product_Q64+1.0;float Product_Q70=Sum_Q69*0.5;float Sum_Q62=Product_Q63+Product_Q70;float FractF_Q59=fract(Sum_Q62);vec2 Vec2_Q65=vec2(FractF_Q59,0.5);vec4 Color_Q58;\n#if IRIDESCENT_MAP_ENABLE\nColor_Q58=texture(_Iridescent_Map_,Vec2_Q65);\n#else\nColor_Q58=vec4(0,0,0,0);\n#endif\nvec4 Result_Q54;Scale_RGB_B54(Color_Q58,_Iridescence_Edge_Intensity_,Result_Q54);vec4 Result_Q55;Scale_RGB_B54(Color_Q58,_Iridescence_Intensity_,Result_Q55);vec4 Base_And_Iridescent_Q53;Base_And_Iridescent_Q53=Line_Color_Q48+vec4(Result_Q54.rgb,0.0);vec4 Base_And_Iridescent_Q56;Base_And_Iridescent_Q56=_Base_Color_+vec4(Result_Q55.rgb,0.0);vec4 Result_Q52=Base_And_Iridescent_Q53; Result_Q52.a=1.0;vec4 Result_Q35=Blob_Color_Q71+(1.0-Blob_Color_Q71.a)*Base_And_Iridescent_Q56;vec4 Color_Q31;Round_Rect_Fragment_B31(R_Q72,G_Q72,Result_Q52,_Filter_Width_,vUV,1.0,vExtra1,Result_Q35,Color_Q31);vec4 Result_Q47=_Fade_Out_*Color_Q31;vec4 Out_Color=Result_Q47;float Clip_Threshold=0.001;bool To_sRGB=false;gl_FragColor=Out_Color;}";h.ShaderStore.ShadersStore.fluentBackplateVertexShader="uniform mat4 world;uniform mat4 viewProjection;uniform vec3 cameraPosition;attribute vec3 position;attribute vec3 normal;\n#ifdef TANGENT\nattribute vec3 tangent;\n#else\nconst vec3 tangent=vec3(0.);\n#endif\nuniform float _Radius_;uniform float _Line_Width_;uniform bool _Absolute_Sizes_;uniform float _Filter_Width_;uniform vec4 _Base_Color_;uniform vec4 _Line_Color_;uniform float _Radius_Top_Left_;uniform float _Radius_Top_Right_;uniform float _Radius_Bottom_Left_;uniform float _Radius_Bottom_Right_;uniform vec3 _Blob_Position_;uniform float _Blob_Intensity_;uniform float _Blob_Near_Size_;uniform float _Blob_Far_Size_;uniform float _Blob_Near_Distance_;uniform float _Blob_Far_Distance_;uniform float _Blob_Fade_Length_;uniform float _Blob_Pulse_;uniform float _Blob_Fade_;uniform sampler2D _Blob_Texture_;uniform vec3 _Blob_Position_2_;uniform float _Blob_Near_Size_2_;uniform float _Blob_Pulse_2_;uniform float _Blob_Fade_2_;uniform float _Rate_;uniform vec4 _Highlight_Color_;uniform float _Highlight_Width_;uniform vec4 _Highlight_Transform_;uniform float _Highlight_;uniform float _Iridescence_Intensity_;uniform float _Iridescence_Edge_Intensity_;uniform float _Angle_;uniform float _Fade_Out_;uniform bool _Reflected_;uniform float _Frequency_;uniform float _Vertical_Offset_;uniform sampler2D _Iridescent_Map_;uniform bool _Use_Global_Left_Index_;uniform bool _Use_Global_Right_Index_;uniform vec4 Global_Left_Index_Tip_Position;uniform vec4 Global_Right_Index_Tip_Position;varying vec3 vPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec3 vBinormal;varying vec4 vColor;varying vec4 vExtra1;varying vec4 vExtra2;varying vec4 vExtra3;void Object_To_World_Pos_B115(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{Pos_World=(world*vec4(Pos_Object,1.0)).xyz;}\nvoid PickDir_B140(\nfloat Degrees,\nvec3 DirX,\nvec3 DirY,\nout vec3 Dir)\n{float a=Degrees*3.14159/180.0;Dir=cos(a)*DirX+sin(a)*DirY;}\nvoid Round_Rect_Vertex_B139(\nvec2 UV,\nfloat Radius,\nfloat Margin,\nfloat Anisotropy,\nfloat Gradient1,\nfloat Gradient2,\nout vec2 Rect_UV,\nout vec4 Rect_Parms,\nout vec2 Scale_XY,\nout vec2 Line_UV)\n{Scale_XY=vec2(Anisotropy,1.0);Line_UV=(UV-vec2(0.5,0.5));Rect_UV=Line_UV*Scale_XY;Rect_Parms.xy=Scale_XY*0.5-vec2(Radius,Radius)-vec2(Margin,Margin);Rect_Parms.z=Gradient1; \nRect_Parms.w=Gradient2;}\nvoid Line_Vertex_B135(\nvec2 Scale_XY,\nvec2 UV,\nfloat Time,\nfloat Rate,\nvec4 Highlight_Transform,\nout vec3 Line_Vertex)\n{float angle2=(Rate*Time)*2.0*3.1416;float sinAngle2=sin(angle2);float cosAngle2=cos(angle2);vec2 xformUV=UV*Highlight_Transform.xy+Highlight_Transform.zw;Line_Vertex.x=0.0;Line_Vertex.y=cosAngle2*xformUV.x-sinAngle2*xformUV.y;Line_Vertex.z=0.0; }\nvoid Blob_Vertex_B180(\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,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{vec3 blob=Blob_Position;vec3 delta=blob-Position;float dist=dot(Normal,delta);float lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);float fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);float size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;vec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);float Fade=fadeValue*Intensity*Blob_Fade;float Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);Blob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);}\nvoid Move_Verts_B129(\nfloat Anisotropy,\nvec3 P,\nfloat Radius,\nout vec3 New_P,\nout vec2 New_UV,\nout float Radial_Gradient,\nout vec3 Radial_Dir)\n{vec2 UV=P.xy*2.0+0.5;vec2 center=clamp(UV,0.0,1.0);vec2 delta=UV-center;vec2 r2=2.0*vec2(Radius/Anisotropy,Radius);New_UV=center+r2*(UV-2.0*center+0.5);New_P=vec3(New_UV-0.5,P.z);Radial_Gradient=1.0-length(delta)*2.0;Radial_Dir=vec3(delta*r2,0.0);}\nvoid Object_To_World_Dir_B132(\nvec3 Dir_Object,\nout vec3 Binormal_World,\nout vec3 Binormal_World_N,\nout float Binormal_Length)\n{Binormal_World=(world*vec4(Dir_Object,0.0)).xyz;Binormal_Length=length(Binormal_World);Binormal_World_N=Binormal_World/Binormal_Length;}\nvoid RelativeOrAbsoluteDetail_B147(\nfloat Nominal_Radius,\nfloat Nominal_LineWidth,\nbool Absolute_Measurements,\nfloat Height,\nout float Radius,\nout float Line_Width)\n{float scale=Absolute_Measurements ? 1.0/Height : 1.0;Radius=Nominal_Radius*scale;Line_Width=Nominal_LineWidth*scale;}\nvoid Edge_AA_Vertex_B130(\nvec3 Position_World,\nvec3 Position_Object,\nvec3 Normal_Object,\nvec3 Eye,\nfloat Radial_Gradient,\nvec3 Radial_Dir,\nvec3 Tangent,\nout float Gradient1,\nout float Gradient2)\n{vec3 I=(Eye-Position_World);vec3 T=(world* vec4(Tangent,0.0)).xyz;float g=(dot(T,I)<0.0) ? 0.0 : 1.0;if (Normal_Object.z==0.0) { \nGradient1=Position_Object.z>0.0 ? g : 1.0;Gradient2=Position_Object.z>0.0 ? 1.0 : g;} else {Gradient1=g+(1.0-g)*(Radial_Gradient);Gradient2=1.0;}}\nvoid Pick_Radius_B144(\nfloat Radius,\nfloat Radius_Top_Left,\nfloat Radius_Top_Right,\nfloat Radius_Bottom_Left,\nfloat Radius_Bottom_Right,\nvec3 Position,\nout float Result)\n{bool whichY=Position.y>0.0;Result=Position.x<0.0 ? (whichY ? Radius_Top_Left : Radius_Bottom_Left) : (whichY ? Radius_Top_Right : Radius_Bottom_Right);Result*=Radius;}\nvoid main()\n{vec3 Nrm_World_Q128;Nrm_World_Q128=normalize((world*vec4(normal,0.0)).xyz);vec3 Tangent_World_Q131;vec3 Tangent_World_N_Q131;float Tangent_Length_Q131;Tangent_World_Q131=(world*vec4(vec3(1,0,0),0.0)).xyz;Tangent_Length_Q131=length(Tangent_World_Q131);Tangent_World_N_Q131=Tangent_World_Q131/Tangent_Length_Q131;vec3 Binormal_World_Q132;vec3 Binormal_World_N_Q132;float Binormal_Length_Q132;Object_To_World_Dir_B132(vec3(0,1,0),Binormal_World_Q132,Binormal_World_N_Q132,Binormal_Length_Q132);float Anisotropy_Q133=Tangent_Length_Q131/Binormal_Length_Q132;vec3 Result_Q177;Result_Q177=mix(_Blob_Position_,Global_Left_Index_Tip_Position.xyz,float(_Use_Global_Left_Index_));vec3 Result_Q178;Result_Q178=mix(_Blob_Position_2_,Global_Right_Index_Tip_Position.xyz,float(_Use_Global_Right_Index_));float Result_Q144;Pick_Radius_B144(_Radius_,_Radius_Top_Left_,_Radius_Top_Right_,_Radius_Bottom_Left_,_Radius_Bottom_Right_,position,Result_Q144);vec3 Dir_Q140;PickDir_B140(_Angle_,Tangent_World_N_Q131,Binormal_World_N_Q132,Dir_Q140);float Radius_Q147;float Line_Width_Q147;RelativeOrAbsoluteDetail_B147(Result_Q144,_Line_Width_,_Absolute_Sizes_,Binormal_Length_Q132,Radius_Q147,Line_Width_Q147);vec4 Out_Color_Q145=vec4(Radius_Q147,Line_Width_Q147,0,1);vec3 New_P_Q129;vec2 New_UV_Q129;float Radial_Gradient_Q129;vec3 Radial_Dir_Q129;Move_Verts_B129(Anisotropy_Q133,position,Radius_Q147,New_P_Q129,New_UV_Q129,Radial_Gradient_Q129,Radial_Dir_Q129);vec3 Pos_World_Q115;Object_To_World_Pos_B115(New_P_Q129,Pos_World_Q115);vec4 Blob_Info_Q180;\n#if BLOB_ENABLE\nBlob_Vertex_B180(Pos_World_Q115,Nrm_World_Q128,Tangent_World_N_Q131,Binormal_World_N_Q132,Result_Q177,_Blob_Intensity_,_Blob_Near_Size_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_,_Blob_Fade_,Blob_Info_Q180);\n#else\nBlob_Info_Q180=vec4(0,0,0,0);\n#endif\nvec4 Blob_Info_Q181;\n#if BLOB_ENABLE_2\nBlob_Vertex_B180(Pos_World_Q115,Nrm_World_Q128,Tangent_World_N_Q131,Binormal_World_N_Q132,Result_Q178,_Blob_Intensity_,_Blob_Near_Size_2_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_2_,_Blob_Fade_2_,Blob_Info_Q181);\n#else\nBlob_Info_Q181=vec4(0,0,0,0);\n#endif\nfloat Gradient1_Q130;float Gradient2_Q130;\n#if SMOOTH_EDGES\nEdge_AA_Vertex_B130(Pos_World_Q115,position,normal,cameraPosition,Radial_Gradient_Q129,Radial_Dir_Q129,tangent,Gradient1_Q130,Gradient2_Q130);\n#else\nGradient1_Q130=1.0;Gradient2_Q130=1.0;\n#endif\nvec2 Rect_UV_Q139;vec4 Rect_Parms_Q139;vec2 Scale_XY_Q139;vec2 Line_UV_Q139;Round_Rect_Vertex_B139(New_UV_Q129,Radius_Q147,0.0,Anisotropy_Q133,Gradient1_Q130,Gradient2_Q130,Rect_UV_Q139,Rect_Parms_Q139,Scale_XY_Q139,Line_UV_Q139);vec3 Line_Vertex_Q135;Line_Vertex_B135(Scale_XY_Q139,Line_UV_Q139,0.0,_Rate_,_Highlight_Transform_,Line_Vertex_Q135);vec3 Position=Pos_World_Q115;vec3 Normal=Dir_Q140;vec2 UV=Rect_UV_Q139;vec3 Tangent=Line_Vertex_Q135;vec3 Binormal=Nrm_World_Q128;vec4 Color=Out_Color_Q145;vec4 Extra1=Rect_Parms_Q139;vec4 Extra2=Blob_Info_Q180;vec4 Extra3=Blob_Info_Q181;gl_Position=viewProjection*vec4(Position,1);vPosition=Position;vNormal=Normal;vUV=UV;vTangent=Tangent;vBinormal=Binormal;vColor=Color;vExtra1=Extra1;vExtra2=Extra2;vExtra3=Extra3;}";var Bt=function(t){function e(){var e=t.call(this)||this;return e.BLOB_ENABLE=!0,e.BLOB_ENABLE_2=!0,e.SMOOTH_EDGES=!0,e.IRIDESCENT_MAP_ENABLE=!0,e._needNormals=!0,e.rebuild(),e}return n(e,t),e}(h.MaterialDefines),Ct=function(t){function e(i,o){var r=t.call(this,i,o)||this;return r.radius=.03,r.lineWidth=.01,r.absoluteSizes=!1,r._filterWidth=1,r.baseColor=new h.Color4(.0392157,.0666667,.207843,1),r.lineColor=new h.Color4(.14902,.133333,.384314,1),r.blobIntensity=.98,r.blobFarSize=.04,r.blobNearDistance=0,r.blobFarDistance=.08,r.blobFadeLength=.08,r.blobNearSize=.22,r.blobPulse=0,r.blobFade=0,r.blobNearSize2=.22,r.blobPulse2=0,r.blobFade2=0,r._rate=.135,r.highlightColor=new h.Color4(.98,.98,.98,1),r.highlightWidth=.25,r._highlightTransform=new h.Vector4(1,1,0,0),r._highlight=1,r.iridescenceIntensity=0,r.iridescenceEdgeIntensity=1,r._angle=-45,r.fadeOut=1,r._reflected=!0,r._frequency=1,r._verticalOffset=0,r.globalLeftIndexTipPosition=h.Vector3.Zero(),r._globalLeftIndexTipPosition4=h.Vector4.Zero(),r.globalRightIndexTipPosition=h.Vector3.Zero(),r._globalRightIndexTipPosition4=h.Vector4.Zero(),r.alphaMode=h.Constants.ALPHA_DISABLE,r.backFaceCulling=!1,r._blobTexture=new h.Texture(e.BLOB_TEXTURE_URL,r.getScene(),!0,!1,h.Texture.NEAREST_SAMPLINGMODE),r._iridescentMap=new h.Texture(e.IM_TEXTURE_URL,r.getScene(),!0,!1,h.Texture.NEAREST_SAMPLINGMODE),r}return n(e,t),e.prototype.needAlphaBlending=function(){return!1},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){var i=e._drawWrapper;if(this.isFrozen&&i.effect&&i._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new Bt);var o=e.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=r.getEngine();if((0,h.PrepareDefinesForAttributes)(t,o,!1,!1),o.isDirty){o.markAsProcessed(),r.resetCachedMaterial();var a=new h.EffectFallbacks;o.FOG&&a.addFallback(1,"FOG"),(0,h.HandleFallbacksForShadows)(o,a),o.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess;var s=[h.VertexBuffer.PositionKind];o.NORMAL&&s.push(h.VertexBuffer.NormalKind),o.UV1&&s.push(h.VertexBuffer.UVKind),o.UV2&&s.push(h.VertexBuffer.UV2Kind),o.VERTEXCOLOR&&s.push(h.VertexBuffer.ColorKind),o.TANGENT&&s.push(h.VertexBuffer.TangentKind),(0,h.PrepareAttributesForInstances)(s,o);var l=o.toString(),_=["world","viewProjection","cameraPosition","_Radius_","_Line_Width_","_Absolute_Sizes_","_Filter_Width_","_Base_Color_","_Line_Color_","_Radius_Top_Left_","_Radius_Top_Right_","_Radius_Bottom_Left_","_Radius_Bottom_Right_","_Blob_Position_","_Blob_Intensity_","_Blob_Near_Size_","_Blob_Far_Size_","_Blob_Near_Distance_","_Blob_Far_Distance_","_Blob_Fade_Length_","_Blob_Pulse_","_Blob_Fade_","_Blob_Texture_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Rate_","_Highlight_Color_","_Highlight_Width_","_Highlight_Transform_","_Highlight_","_Iridescence_Intensity_","_Iridescence_Edge_Intensity_","_Angle_","_Fade_Out_","_Reflected_","_Frequency_","_Vertical_Offset_","_Iridescent_Map_","_Use_Global_Left_Index_","_Use_Global_Right_Index_","Global_Left_Index_Tip_Position","Global_Right_Index_Tip_Position"],c=["_Blob_Texture_","_Iridescent_Map_"],u=[];(0,h.PrepareUniformsAndSamplersList)({uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:o,maxSimultaneousLights:4}),e.setEffect(r.getEngine().createEffect("fluentBackplate",{attributes:s,uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:l,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),o,this._materialContext)}return!(!e.effect||!e.effect.isReady()||(o._renderId=r.getRenderId(),i._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o,r;if(i.materialDefines){var n=i.effect;n&&(this._activeEffect=n,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",null!==(r=null===(o=this.getScene().activeCamera)||void 0===o?void 0:o.position)&&void 0!==r?r:h.Vector3.ZeroReadOnly),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Line_Width_",this.lineWidth),this._activeEffect.setFloat("_Absolute_Sizes_",this.absoluteSizes?1:0),this._activeEffect.setFloat("_Filter_Width_",this._filterWidth),this._activeEffect.setDirectColor4("_Base_Color_",this.baseColor),this._activeEffect.setDirectColor4("_Line_Color_",this.lineColor),this._activeEffect.setFloat("_Radius_Top_Left_",1),this._activeEffect.setFloat("_Radius_Top_Right_",1),this._activeEffect.setFloat("_Radius_Bottom_Left_",1),this._activeEffect.setFloat("_Radius_Bottom_Right_",1),this._activeEffect.setFloat("_Blob_Intensity_",this.blobIntensity),this._activeEffect.setFloat("_Blob_Near_Size_",this.blobNearSize),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_Pulse_",this.blobPulse),this._activeEffect.setFloat("_Blob_Fade_",this.blobFade),this._activeEffect.setTexture("_Blob_Texture_",this._blobTexture),this._activeEffect.setFloat("_Blob_Near_Size_2_",this.blobNearSize2),this._activeEffect.setFloat("_Blob_Pulse_2_",this.blobPulse2),this._activeEffect.setFloat("_Blob_Fade_2_",this.blobFade2),this._activeEffect.setFloat("_Rate_",this._rate),this._activeEffect.setDirectColor4("_Highlight_Color_",this.highlightColor),this._activeEffect.setFloat("_Highlight_Width_",this.highlightWidth),this._activeEffect.setVector4("_Highlight_Transform_",this._highlightTransform),this._activeEffect.setFloat("_Highlight_",this._highlight),this._activeEffect.setFloat("_Iridescence_Intensity_",this.iridescenceIntensity),this._activeEffect.setFloat("_Iridescence_Edge_Intensity_",this.iridescenceEdgeIntensity),this._activeEffect.setFloat("_Angle_",this._angle),this._activeEffect.setFloat("_Fade_Out_",this.fadeOut),this._activeEffect.setFloat("_Reflected_",this._reflected?1:0),this._activeEffect.setFloat("_Frequency_",this._frequency),this._activeEffect.setFloat("_Vertical_Offset_",this._verticalOffset),this._activeEffect.setTexture("_Iridescent_Map_",this._iridescentMap),this._activeEffect.setFloat("_Use_Global_Left_Index_",1),this._activeEffect.setFloat("_Use_Global_Right_Index_",1),this._globalLeftIndexTipPosition4.set(this.globalLeftIndexTipPosition.x,this.globalLeftIndexTipPosition.y,this.globalLeftIndexTipPosition.z,1),this._activeEffect.setVector4("Global_Left_Index_Tip_Position",this._globalLeftIndexTipPosition4),this._globalRightIndexTipPosition4.set(this.globalRightIndexTipPosition.x,this.globalRightIndexTipPosition.y,this.globalRightIndexTipPosition.z,1),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",this._globalRightIndexTipPosition4),this._afterBind(e,this._activeEffect,i))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),this._blobTexture.dispose(),this._iridescentMap.dispose()},e.prototype.clone=function(t){var i=this;return h.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.FluentBackplateMaterial",e},e.prototype.getClassName=function(){return"FluentBackplateMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.BLOB_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-backplate-blob.png",e.IM_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-backplate-iridescence.png",s([(0,h.serialize)()],e.prototype,"radius",void 0),s([(0,h.serialize)()],e.prototype,"lineWidth",void 0),s([(0,h.serialize)()],e.prototype,"absoluteSizes",void 0),s([(0,h.serialize)()],e.prototype,"baseColor",void 0),s([(0,h.serialize)()],e.prototype,"lineColor",void 0),s([(0,h.serialize)()],e.prototype,"blobIntensity",void 0),s([(0,h.serialize)()],e.prototype,"blobFarSize",void 0),s([(0,h.serialize)()],e.prototype,"blobNearDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFarDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFadeLength",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse",void 0),s([(0,h.serialize)()],e.prototype,"blobFade",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize2",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse2",void 0),s([(0,h.serialize)()],e.prototype,"blobFade2",void 0),s([(0,h.serialize)()],e.prototype,"highlightColor",void 0),s([(0,h.serialize)()],e.prototype,"highlightWidth",void 0),s([(0,h.serialize)()],e.prototype,"iridescenceIntensity",void 0),s([(0,h.serialize)()],e.prototype,"iridescenceEdgeIntensity",void 0),s([(0,h.serialize)()],e.prototype,"fadeOut",void 0),s([(0,h.serializeAsVector3)()],e.prototype,"globalLeftIndexTipPosition",void 0),s([(0,h.serializeAsVector3)()],e.prototype,"globalRightIndexTipPosition",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.FluentBackplateMaterial",Ct);var Tt=function(t){function e(e,i){void 0===i&&(i=!0);var o=t.call(this,e)||this;return o._shareMaterials=i,o}return n(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,o=this,r=(0,h.CreateBox)((null!==(i=this.name)&&void 0!==i?i:"HolographicBackplate")+"_CollisionMesh",{width:1,height:1,depth:1},t);return r.isPickable=!0,r.visibility=0,h.SceneLoader.ImportMeshAsync(void 0,e.MODEL_BASE_URL,e.MODEL_FILENAME,t).then((function(t){var e=t.meshes[1];e.name="".concat(o.name,"_frontPlate"),e.isPickable=!1,e.parent=r,o._material&&(e.material=o._material),o._model=e})),r},e.prototype._createMaterial=function(t){this._material=new Ct(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}(dt),St=function(t){function e(e,i){void 0===i&&(i=!0);var o=t.call(this,e)||this;return o._shareMaterials=!0,o._shareMaterials=i,o.pointerEnterAnimation=function(){o.mesh&&o._frontPlate.setEnabled(!0)},o.pointerOutAnimation=function(){o.mesh&&o._frontPlate.setEnabled(!1)},o}return n(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=(0,h.CreatePlane)("",{size:1},this._backPlate._scene);var o=(0,h.CreatePlane)("",{size:1,sideOrientation:h.Mesh.DOUBLESIDE},this._backPlate._scene),r=new h.StandardMaterial("",this._backPlate._scene);r.diffuseColor=h.Color3.FromHexString("#212121"),o.material=r,o.isPickable=!1,this._tooltipMesh.addChild(o),o.position=h.Vector3.Forward(i).scale(.05),this._tooltipMesh.scaling.y=1/3,this._tooltipMesh.position=h.Vector3.Up().scale(.7).add(h.Vector3.Forward(i).scale(-.15)),this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._backPlate,this._tooltipTexture=lt.CreateForMesh(this._tooltipMesh),this._tooltipTextBlock=new B,this._tooltipTextBlock.scaleY=3,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=130,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new h.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 S;if(t.isVertical=!0,(0,h.IsDocumentAvailable)()&&document.createElement&&this._imageUrl){var e=new C;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 B;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=(0,h.CreateBox)(this.name+"BackMesh",{width:1,height:1,depth:.08},e),this._frontPlate=(0,h.CreateBox)(this.name+"FrontMesh",{width:1,height:1,depth:.08},e),this._frontPlate.parent=this._backPlate,this._frontPlate.position=h.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=h.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 xt(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 xt(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 h.StandardMaterial(this.name+"Plate Material",t.getScene()),this._plateMaterial.specularColor=h.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}(gt);h.ShaderStore.ShadersStore.fluentButtonPixelShader="uniform vec3 cameraPosition;varying vec3 vPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec3 vBinormal;varying vec4 vColor;varying vec4 vExtra1;uniform float _Edge_Width_;uniform vec4 _Edge_Color_;uniform bool _Relative_Width_;uniform float _Proximity_Max_Intensity_;uniform float _Proximity_Far_Distance_;uniform float _Proximity_Near_Radius_;uniform float _Proximity_Anisotropy_;uniform float _Selection_Fuzz_;uniform float _Selected_;uniform float _Selection_Fade_;uniform float _Selection_Fade_Size_;uniform float _Selected_Distance_;uniform float _Selected_Fade_Length_;uniform bool _Blob_Enable_;uniform vec3 _Blob_Position_;uniform float _Blob_Intensity_;uniform float _Blob_Near_Size_;uniform float _Blob_Far_Size_;uniform float _Blob_Near_Distance_;uniform float _Blob_Far_Distance_;uniform float _Blob_Fade_Length_;uniform float _Blob_Inner_Fade_;uniform float _Blob_Pulse_;uniform float _Blob_Fade_;uniform sampler2D _Blob_Texture_;uniform bool _Blob_Enable_2_;uniform vec3 _Blob_Position_2_;uniform float _Blob_Near_Size_2_;uniform float _Blob_Inner_Fade_2_;uniform float _Blob_Pulse_2_;uniform float _Blob_Fade_2_;uniform vec3 _Active_Face_Dir_;uniform vec3 _Active_Face_Up_;uniform bool Enable_Fade;uniform float _Fade_Width_;uniform bool _Smooth_Active_Face_;uniform bool _Show_Frame_;uniform bool _Use_Blob_Texture_;uniform bool Use_Global_Left_Index;uniform bool Use_Global_Right_Index;uniform vec4 Global_Left_Index_Tip_Position;uniform vec4 Global_Right_Index_Tip_Position;uniform vec4 Global_Left_Thumb_Tip_Position;uniform vec4 Global_Right_Thumb_Tip_Position;uniform float Global_Left_Index_Tip_Proximity;uniform float Global_Right_Index_Tip_Proximity;void Holo_Edge_Fragment_B35(\nvec4 Edges,\nfloat Edge_Width,\nout float NotEdge)\n{vec2 c=vec2(min(Edges.r,Edges.g),min(Edges.b,Edges.a));vec2 df=fwidth(c)*Edge_Width;vec2 g=clamp(c/df,0.0,1.0);NotEdge=g.x*g.y;}\nvoid Blob_Fragment_B39(\nvec2 UV,\nvec3 Blob_Info,\nsampler2D Blob_Texture,\nout vec4 Blob_Color)\n{float k=dot(UV,UV);Blob_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));}\nvec2 FilterStep(vec2 Edge,vec2 X)\n{vec2 dX=max(fwidth(X),vec2(0.00001,0.00001));return clamp( (X+dX-max(Edge,X-dX))/(dX*2.0),0.0,1.0);}\nvoid Wireframe_Fragment_B59(\nvec3 Widths,\nvec2 UV,\nfloat Proximity,\nvec4 Edge_Color,\nout vec4 Wireframe)\n{vec2 c=min(UV,vec2(1.0,1.0)-UV);vec2 g=FilterStep(Widths.xy*0.5,c); \nWireframe=(1.0-min(g.x,g.y))*Proximity*Edge_Color;}\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{vec2 delta1=Extra1.xy;vec2 delta2=Extra1.zw;float d2=sqrt(min(dot(delta1,delta1),dot(delta2,delta2))+Dist_To_Face*Dist_To_Face);Proximity=Intensity*Proximity_Max_Intensity*(1.0-clamp(d2/Proximity_Near_Radius,0.0,1.0))*(1.0-Show_Selection.x)+Show_Selection.x;}\nvoid To_XYZ_B46(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{X=Vec3.x;Y=Vec3.y;Z=Vec3.z;}\nvoid main()\n{float NotEdge_Q35;\n#if ENABLE_FADE\nHolo_Edge_Fragment_B35(vColor,_Fade_Width_,NotEdge_Q35);\n#else\nNotEdge_Q35=1.0;\n#endif\nvec4 Blob_Color_Q39;float k=dot(vUV,vUV);vec2 blobTextureCoord=vec2(vec2(sqrt(k),vTangent.x).x,1.0-vec2(sqrt(k),vTangent.x).y);vec4 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_));Blob_Color_Q39=vTangent.y*blobColor*(1.0-clamp(k,0.0,1.0));float Is_Quad_Q24;Is_Quad_Q24=vNormal.z;vec3 Blob_Position_Q41= mix(_Blob_Position_,Global_Left_Index_Tip_Position.xyz,float(Use_Global_Left_Index));vec3 Blob_Position_Q42= mix(_Blob_Position_2_,Global_Right_Index_Tip_Position.xyz,float(Use_Global_Right_Index));float X_Q46;float Y_Q46;float Z_Q46;To_XYZ_B46(vBinormal,X_Q46,Y_Q46,Z_Q46);float Proximity_Q53;Proximity_B53(Blob_Position_Q41,Blob_Position_Q42,_Proximity_Max_Intensity_,_Proximity_Near_Radius_,vPosition,vBinormal,vExtra1,Y_Q46,Z_Q46,Proximity_Q53);vec4 Wireframe_Q59;Wireframe_Fragment_B59(vNormal,vUV,Proximity_Q53,_Edge_Color_,Wireframe_Q59);vec4 Wire_Or_Blob_Q23=mix(Wireframe_Q59,Blob_Color_Q39,Is_Quad_Q24);vec4 Result_Q22;Result_Q22=mix(Wire_Or_Blob_Q23,vec4(0.3,0.3,0.3,0.3),float(_Show_Frame_));vec4 Final_Color_Q37=NotEdge_Q35*Result_Q22;vec4 Out_Color=Final_Color_Q37;float Clip_Threshold=0.0;bool To_sRGB=false;gl_FragColor=Out_Color;}";h.ShaderStore.ShadersStore.fluentButtonVertexShader="uniform mat4 world;uniform mat4 viewProjection;uniform vec3 cameraPosition;attribute vec3 position;attribute vec3 normal;attribute vec2 uv;attribute vec3 tangent;attribute vec4 color;uniform float _Edge_Width_;uniform vec4 _Edge_Color_;uniform float _Proximity_Max_Intensity_;uniform float _Proximity_Far_Distance_;uniform float _Proximity_Near_Radius_;uniform float _Proximity_Anisotropy_;uniform float _Selection_Fuzz_;uniform float _Selected_;uniform float _Selection_Fade_;uniform float _Selection_Fade_Size_;uniform float _Selected_Distance_;uniform float _Selected_Fade_Length_;uniform bool _Blob_Enable_;uniform vec3 _Blob_Position_;uniform float _Blob_Intensity_;uniform float _Blob_Near_Size_;uniform float _Blob_Far_Size_;uniform float _Blob_Near_Distance_;uniform float _Blob_Far_Distance_;uniform float _Blob_Fade_Length_;uniform float _Blob_Inner_Fade_;uniform float _Blob_Pulse_;uniform float _Blob_Fade_;uniform sampler2D _Blob_Texture_;uniform bool _Blob_Enable_2_;uniform vec3 _Blob_Position_2_;uniform float _Blob_Near_Size_2_;uniform float _Blob_Inner_Fade_2_;uniform float _Blob_Pulse_2_;uniform float _Blob_Fade_2_;uniform vec3 _Active_Face_Dir_;uniform vec3 _Active_Face_Up_;uniform bool _Enable_Fade_;uniform float _Fade_Width_;uniform bool _Smooth_Active_Face_;uniform bool _Show_Frame_;uniform bool Use_Global_Left_Index;uniform bool Use_Global_Right_Index;uniform vec4 Global_Left_Index_Tip_Position;uniform vec4 Global_Right_Index_Tip_Position;uniform vec4 Global_Left_Thumb_Tip_Position;uniform vec4 Global_Right_Thumb_Tip_Position;uniform float Global_Left_Index_Tip_Proximity;uniform float Global_Right_Index_Tip_Proximity;varying vec3 vPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec3 vBinormal;varying vec4 vColor;varying vec4 vExtra1;void 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{float blobSize,fadeIn;vec3 Hit_Position;Blob_Info=vec3(0.0,0.0,0.0);float Hit_Distance=dot(Blob_Position-Face_Center,Normal);Hit_Position=Blob_Position-Hit_Distance*Normal;float absD=abs(Hit_Distance);float lerpVal=clamp((absD-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);fadeIn=1.0-clamp((absD-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);float innerFade=1.0-clamp(-Hit_Distance/Inner_Fade,0.0,1.0);float farClip=clamp(1.0-step(Blob_Far_Distance+Blob_Fade_Length,absD),0.0,1.0);float size=mix(Blob_Near_Size,Blob_Far_Size,lerpVal)*farClip;blobSize=mix(size,Selection_Fade_Size,Selection_Fade)*innerFade*Blob_Enabled;Blob_Info.x=lerpVal*0.5+0.5;Blob_Info.y=fadeIn*Intensity*(1.0-Selection_Fade)*Blob_Fade;Blob_Info.x*=(1.0-Blob_Pulse);vec3 delta=Hit_Position-Face_Center;vec2 blobCenterXY=vec2(dot(delta,Tangent),dot(delta,Bitangent));vec2 quadUVin=2.0*UV-1.0; \nvec2 blobXY=blobCenterXY+quadUVin*blobSize;vec2 blobClipped=clamp(blobXY,-Face_Size*0.5,Face_Size*0.5);vec2 blobUV=(blobClipped-blobCenterXY)/max(blobSize,0.0001)*2.0;vec3 blobCorner=Face_Center+blobClipped.x*Tangent+blobClipped.y*Bitangent;Out_Position=mix(Position,blobCorner,Vx_Color.rrr);Out_UV=mix(In_UV,blobUV,Vx_Color.rr);}\nvec2 ProjectProximity(\nvec3 blobPosition,\nvec3 position,\nvec3 center,\nvec3 dir,\nvec3 xdir,\nvec3 ydir,\nout float vdistance\n)\n{vec3 delta=blobPosition-position;vec2 xy=vec2(dot(delta,xdir),dot(delta,ydir));vdistance=abs(dot(delta,dir));return xy;}\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{vec3 Active_Face_Dir_X=normalize(cross(Active_Face_Dir,Up));vec3 Active_Face_Dir_Y=cross(Active_Face_Dir,Active_Face_Dir_X);float distz1,distz2;Extra1.xy=ProjectProximity(Blob_Position,Position,Active_Face_Center,Active_Face_Dir,Active_Face_Dir_X*Proximity_Anisotropy,Active_Face_Dir_Y,distz1)/Relative_Scale;Extra1.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;Distance_To_Face=dot(Active_Face_Dir,Position-Active_Face_Center);Intensity=1.0-clamp(min(distz1,distz2)/Proximity_Far_Distance,0.0,1.0);}\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{float NdotI=dot(Incident,Normal);vec2 flip=(UV-vec2(0.5,0.5));float udot=dot(Incident,Tangent)*flip.x*NdotI;float uval=1.0-float(udot>0.0);float vdot=-dot(Incident,Bitangent)*flip.y*NdotI;float vval=1.0-float(vdot>0.0);float Smooth_And_Active=step(1.0,float(Smooth_Active_Face && Active>0.0));uval=mix(uval,max(1.0,uval),Smooth_And_Active); \nvval=mix(vval,max(1.0,vval),Smooth_And_Active);Holo_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));}\nvoid Object_To_World_Pos_B13(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{Pos_World=(world*vec4(Pos_Object,1.0)).xyz;}\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{Position=Position1*(1.0-Vx_Color.g)+Vx_Color.g*Position2;float b1=float(Blob_Enable_1);float b2=float(Blob_Enable_2);Blob_Enable=b1+(b2-b1)*Vx_Color.g;Pulse=Blob_Pulse_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Pulse_2;Fade=Blob_Fade_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Fade_2;Near_Size=Near_Size_1*(1.0-Vx_Color.g)+Vx_Color.g*Near_Size_2;Inner_Fade=Blob_Inner_Fade_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Inner_Fade_2;}\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{Widths.xy=Edge_Width/Face_Size;float x=dot(Position,Tangent);float y=dot(Position,Bitangent);float dx=0.5-abs(x);float newx=(0.5-dx*Widths.x*2.0)*sign(x);float dy=0.5-abs(y);float newy=(0.5-dy*Widths.y*2.0)*sign(y);Wire_Vx_Pos=Normal*0.5+newx*Tangent+newy*Bitangent;UV.x=dot(Wire_Vx_Pos,Tangent)+0.5;UV.y=dot(Wire_Vx_Pos,Bitangent)+0.5;}\nvec2 ramp2(vec2 start,vec2 end,vec2 x)\n{return clamp((x-start)/(end-start),vec2(0.0,0.0),vec2(1.0,1.0));}\nfloat computeSelection(\nvec3 blobPosition,\nvec3 normal,\nvec3 tangent,\nvec3 bitangent,\nvec3 faceCenter,\nvec2 faceSize,\nfloat selectionFuzz,\nfloat farDistance,\nfloat fadeLength\n)\n{vec3 delta=blobPosition-faceCenter;float absD=abs(dot(delta,normal));float fadeIn=1.0-clamp((absD-farDistance)/fadeLength,0.0,1.0);vec2 blobCenterXY=vec2(dot(delta,tangent),dot(delta,bitangent));vec2 innerFace=faceSize*(1.0-selectionFuzz)*0.5;vec2 selectPulse=ramp2(-faceSize*0.5,-innerFace,blobCenterXY)-ramp2(innerFace,faceSize*0.5,blobCenterXY);return selectPulse.x*selectPulse.y*fadeIn;}\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{float select1=computeSelection(Blob_Position,Normal,Tangent,Bitangent,Face_Center,Face_Size,Selection_Fuzz,Far_Distance,Fade_Length);float select2=computeSelection(Blob_Position_2,Normal,Tangent,Bitangent,Face_Center,Face_Size,Selection_Fuzz,Far_Distance,Fade_Length);float Active=max(0.0,dot(Active_Face_Dir,Normal));Show_Selection=mix(max(select1,select2),1.0,Selected)*Active;}\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{vec3 boxEdges=(world*vec4(vec3(0.5,0.5,0.5),0.0)).xyz;float boxMaxSize=length(boxEdges);float d1=dot(Proximity_Center-Active_Face_Center,Active_Face_Dir);vec3 blob1=Proximity_Center-d1*Active_Face_Dir;float d2=dot(Proximity_Center_2-Active_Face_Center,Active_Face_Dir);vec3 blob2=Proximity_Center_2-d2*Active_Face_Dir;vec3 delta1=blob1-Active_Face_Center;vec3 delta2=blob2-Active_Face_Center;float dist1=dot(delta1,delta1);float dist2=dot(delta2,delta2);float nearestProxDist=sqrt(min(dist1,dist2));Width=Input_Width*(1.0-step(boxMaxSize+Proximity_Radius,nearestProxDist))*(1.0-step(Proximity_Far_Distance,min(d1,d2))*(1.0-step(0.0001,Selection)));}\nvoid Object_To_World_Dir_B67(\nvec3 Dir_Object,\nout vec3 Dir_World)\n{Dir_World=(world*vec4(Dir_Object,0.0)).xyz;}\nvoid main()\n{vec3 Active_Face_Center_Q49;Active_Face_Center_Q49=(world*vec4(_Active_Face_Dir_*0.5,1.0)).xyz;vec3 Blob_Position_Q41= mix(_Blob_Position_,Global_Left_Index_Tip_Position.xyz,float(Use_Global_Left_Index));vec3 Blob_Position_Q42= mix(_Blob_Position_2_,Global_Right_Index_Tip_Position.xyz,float(Use_Global_Right_Index));vec3 Active_Face_Dir_Q64=normalize((world*vec4(_Active_Face_Dir_,0.0)).xyz);float 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\nvec3 Tangent_World_Q30;Tangent_World_Q30=(world*vec4(tangent,0.0)).xyz;vec3 Binormal_World_Q31;Binormal_World_Q31=(world*vec4((cross(normal,tangent)),0.0)).xyz;vec3 Normal_World_Q60;Normal_World_Q60=(world*vec4(normal,0.0)).xyz;vec3 Result_Q18=0.5*normal;vec3 Dir_World_Q67;Object_To_World_Dir_B67(_Active_Face_Up_,Dir_World_Q67);float Product_Q56=_Edge_Width_*Relative_Scale_Q57;vec3 Normal_World_N_Q29=normalize(Normal_World_Q60);vec3 Tangent_World_N_Q28=normalize(Tangent_World_Q30);vec3 Binormal_World_N_Q32=normalize(Binormal_World_Q31);vec3 Position_Q38;float Near_Size_Q38;float Inner_Fade_Q38;float Blob_Enable_Q38;float Fade_Q38;float Pulse_Q38;Choose_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);vec3 Face_Center_Q33;Face_Center_Q33=(world*vec4(Result_Q18,1.0)).xyz;vec2 Face_Size_Q50=vec2(length(Tangent_World_Q30),length(Binormal_World_Q31));float Show_Selection_Q48;Selection_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);vec3 Normalized_Q72=normalize(Dir_World_Q67);float Active_Q34=max(0.0,dot(Active_Face_Dir_Q64,Normal_World_N_Q29));float Width_Q54;Proximity_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);vec3 Wire_Vx_Pos_Q51;vec2 UV_Q51;vec2 Widths_Q51;Wireframe_Vertex_B51(position,normal,tangent,(cross(normal,tangent)),Width_Q54,Face_Size_Q50,Wire_Vx_Pos_Q51,UV_Q51,Widths_Q51);vec3 Vec3_Q27=vec3(Widths_Q51.x,Widths_Q51.y,color.r);vec3 Pos_World_Q13;Object_To_World_Pos_B13(Wire_Vx_Pos_Q51,Pos_World_Q13);vec3 Incident_Q36=normalize(Pos_World_Q13-cameraPosition);vec3 Out_Position_Q47;vec2 Out_UV_Q47;vec3 Blob_Info_Q47;Blob_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);vec4 Extra1_Q66;float Distance_To_Face_Q66;float Intensity_Q66;Proximity_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);vec4 Holo_Edges_Q44;Holo_Edge_Vertex_B44(Incident_Q36,Normal_World_N_Q29,uv,Tangent_World_Q30,Binormal_World_Q31,_Smooth_Active_Face_,Active_Q34,Holo_Edges_Q44);vec3 Vec3_Q19=vec3(Show_Selection_Q48,Distance_To_Face_Q66,Intensity_Q66);vec3 Position=Out_Position_Q47;vec2 UV=Out_UV_Q47;vec3 Tangent=Blob_Info_Q47;vec3 Binormal=Vec3_Q19;vec3 Normal=Vec3_Q27;vec4 Extra1=Extra1_Q66;vec4 Color=Holo_Edges_Q44;gl_Position=viewProjection*vec4(Position,1);vPosition=Position;vNormal=Normal;vUV=UV;vTangent=Tangent;vBinormal=Binormal;vColor=Color;vExtra1=Extra1;}";var Ot=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 n(e,t),e}(h.MaterialDefines),Rt=function(t){function e(i,o){var r=t.call(this,i,o)||this;return r.edgeWidth=.04,r.edgeColor=new h.Color4(.592157,.592157,.592157,1),r.proximityMaxIntensity=.45,r.proximityFarDistance=.16,r.proximityNearRadius=1.5,r.proximityAnisotropy=1,r.selectionFuzz=.5,r.selected=0,r.selectionFade=0,r.selectionFadeSize=.3,r.selectedDistance=.08,r.selectedFadeLength=.08,r.blobIntensity=.5,r.blobFarSize=.05,r.blobNearDistance=0,r.blobFarDistance=.08,r.blobFadeLength=.08,r.leftBlobEnable=!0,r.leftBlobNearSize=.025,r.leftBlobPulse=0,r.leftBlobFade=1,r.leftBlobInnerFade=.01,r.rightBlobEnable=!0,r.rightBlobNearSize=.025,r.rightBlobPulse=0,r.rightBlobFade=1,r.rightBlobInnerFade=.01,r.activeFaceDir=new h.Vector3(0,0,-1),r.activeFaceUp=new h.Vector3(0,1,0),r.enableFade=!0,r.fadeWidth=1.5,r.smoothActiveFace=!0,r.showFrame=!1,r.useBlobTexture=!0,r.globalLeftIndexTipPosition=h.Vector3.Zero(),r.globalRightIndexTipPosition=h.Vector3.Zero(),r.alphaMode=h.Constants.ALPHA_ADD,r.disableDepthWrite=!0,r.backFaceCulling=!1,r._blobTexture=new h.Texture(e.BLOB_TEXTURE_URL,r.getScene(),!0,!1,h.Texture.NEAREST_SAMPLINGMODE),r}return n(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){var i=e._drawWrapper;if(this.isFrozen&&i.effect&&i._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new Ot);var o=e.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=r.getEngine();if((0,h.PrepareDefinesForAttributes)(t,o,!0,!1),o.isDirty){o.markAsProcessed(),r.resetCachedMaterial();var a=new h.EffectFallbacks;o.FOG&&a.addFallback(1,"FOG"),(0,h.HandleFallbacksForShadows)(o,a),o.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess;var s=[h.VertexBuffer.PositionKind];o.NORMAL&&s.push(h.VertexBuffer.NormalKind),o.UV1&&s.push(h.VertexBuffer.UVKind),o.UV2&&s.push(h.VertexBuffer.UV2Kind),o.VERTEXCOLOR&&s.push(h.VertexBuffer.ColorKind),o.TANGENT&&s.push(h.VertexBuffer.TangentKind),(0,h.PrepareAttributesForInstances)(s,o);var l=o.toString(),_=["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=[];(0,h.PrepareUniformsAndSamplersList)({uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:o,maxSimultaneousLights:4}),e.setEffect(r.getEngine().createEffect("fluentButton",{attributes:s,uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:l,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),o,this._materialContext)}return!(!e.effect||!e.effect.isReady()||(o._renderId=r.getRenderId(),i._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o=this.getScene();if(i.materialDefines){var r=i.effect;r&&(this._activeEffect=r,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",o.activeCamera.position),this._activeEffect.setTexture("_Blob_Texture_",this._blobTexture),this._activeEffect.setFloat("_Edge_Width_",this.edgeWidth),this._activeEffect.setColor4("_Edge_Color_",new h.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 h.Vector4(this.globalLeftIndexTipPosition.x,this.globalLeftIndexTipPosition.y,this.globalLeftIndexTipPosition.z,1)),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",new h.Vector4(this.globalRightIndexTipPosition.x,this.globalRightIndexTipPosition.y,this.globalRightIndexTipPosition.z,1)),this._afterBind(e,this._activeEffect,i))}},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 h.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,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.BLOB_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-button-blob.png",s([(0,h.serialize)()],e.prototype,"edgeWidth",void 0),s([(0,h.serializeAsColor4)()],e.prototype,"edgeColor",void 0),s([(0,h.serialize)()],e.prototype,"proximityMaxIntensity",void 0),s([(0,h.serialize)()],e.prototype,"proximityFarDistance",void 0),s([(0,h.serialize)()],e.prototype,"proximityNearRadius",void 0),s([(0,h.serialize)()],e.prototype,"proximityAnisotropy",void 0),s([(0,h.serialize)()],e.prototype,"selectionFuzz",void 0),s([(0,h.serialize)()],e.prototype,"selected",void 0),s([(0,h.serialize)()],e.prototype,"selectionFade",void 0),s([(0,h.serialize)()],e.prototype,"selectionFadeSize",void 0),s([(0,h.serialize)()],e.prototype,"selectedDistance",void 0),s([(0,h.serialize)()],e.prototype,"selectedFadeLength",void 0),s([(0,h.serialize)()],e.prototype,"blobIntensity",void 0),s([(0,h.serialize)()],e.prototype,"blobFarSize",void 0),s([(0,h.serialize)()],e.prototype,"blobNearDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFarDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFadeLength",void 0),s([(0,h.serialize)()],e.prototype,"leftBlobEnable",void 0),s([(0,h.serialize)()],e.prototype,"leftBlobNearSize",void 0),s([(0,h.serialize)()],e.prototype,"leftBlobPulse",void 0),s([(0,h.serialize)()],e.prototype,"leftBlobFade",void 0),s([(0,h.serialize)()],e.prototype,"leftBlobInnerFade",void 0),s([(0,h.serialize)()],e.prototype,"rightBlobEnable",void 0),s([(0,h.serialize)()],e.prototype,"rightBlobNearSize",void 0),s([(0,h.serialize)()],e.prototype,"rightBlobPulse",void 0),s([(0,h.serialize)()],e.prototype,"rightBlobFade",void 0),s([(0,h.serialize)()],e.prototype,"rightBlobInnerFade",void 0),s([(0,h.serializeAsVector3)()],e.prototype,"activeFaceDir",void 0),s([(0,h.serializeAsVector3)()],e.prototype,"activeFaceUp",void 0),s([(0,h.serialize)()],e.prototype,"enableFade",void 0),s([(0,h.serialize)()],e.prototype,"fadeWidth",void 0),s([(0,h.serialize)()],e.prototype,"smoothActiveFace",void 0),s([(0,h.serialize)()],e.prototype,"showFrame",void 0),s([(0,h.serialize)()],e.prototype,"useBlobTexture",void 0),s([(0,h.serializeAsVector3)()],e.prototype,"globalLeftIndexTipPosition",void 0),s([(0,h.serializeAsVector3)()],e.prototype,"globalRightIndexTipPosition",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.FluentButtonMaterial",Rt);var wt=function(t){function e(e,i){var o=t.call(this,e)||this;return o._isNearPressed=!1,o._interactionSurfaceHeight=0,o._isToggleButton=!1,o._toggleState=!1,o._toggleButtonCallback=function(){o._onToggle(!o._toggleState)},o.onToggleObservable=new h.Observable,o.collidableFrontDirection=h.Vector3.Zero(),i&&(o.collisionMesh=i),o}return n(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=h.TmpVectors.Vector3[0];return h.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=h.TmpVectors.Matrix[0];e.copyFrom(this._collisionMesh.getWorldMatrix()),e.invert(),h.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 h.Vector3.Distance(t,e);var o=h.Vector3.Dot(e,i);return h.Vector3.Dot(t,i)-o},e.prototype._generatePointerEventType=function(t,e,i){if(t===h.PointerEventTypes.POINTERDOWN||t===h.PointerEventTypes.POINTERMOVE){if(!this._isInteractionInFrontOfButton(e))return h.PointerEventTypes.POINTERMOVE;this._isNearPressed=!0,this._interactionSurfaceHeight=this._getInteractionHeight(e,this._collisionMesh.getAbsolutePosition())}if(t===h.PointerEventTypes.POINTERUP){if(0==i)return h.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}(gt),Mt=function(t){function e(e,i){void 0===i&&(i=!0);var o=t.call(this,e)||this;return o._shareMaterials=!0,o._isBackplateVisible=!0,o._frontPlateDepth=.5,o._backPlateDepth=.04,o._backplateColor=new h.Color3(.08,.15,.55),o._backplateToggledColor=new h.Color3(.25,.4,.95),o._shareMaterials=i,o.pointerEnterAnimation=function(){o._frontMaterial.leftBlobEnable=!0,o._frontMaterial.rightBlobEnable=!0},o.pointerOutAnimation=function(){o._frontMaterial.leftBlobEnable=!1,o._frontMaterial.rightBlobEnable=!1},o.pointerDownAnimation=function(){o._frontPlate&&!o.isActiveNearInteraction&&(o._frontPlate.scaling.z=.2*o._frontPlateDepth,o._frontPlate.position=h.Vector3.Forward(o._frontPlate._scene.useRightHandedSystem).scale((o._frontPlateDepth-.2*o._frontPlateDepth)/2),o._textPlate.position=h.Vector3.Forward(o._textPlate._scene.useRightHandedSystem).scale(-(o._backPlateDepth+.2*o._frontPlateDepth)/2))},o.pointerUpAnimation=function(){o._frontPlate&&(o._frontPlate.scaling.z=o._frontPlateDepth,o._frontPlate.position=h.Vector3.Forward(o._frontPlate._scene.useRightHandedSystem).scale((o._frontPlateDepth-o._frontPlateDepth)/2),o._textPlate.position=h.Vector3.Forward(o._textPlate._scene.useRightHandedSystem).scale(-(o._backPlateDepth+o._frontPlateDepth)/2))},o.onPointerMoveObservable.add((function(t){if(o._frontPlate&&o.isActiveNearInteraction){var e=h.Vector3.Zero();if(o._backPlate.getWorldMatrix().decompose(e,void 0,void 0)){var i=o._getInteractionHeight(t,o._backPlate.getAbsolutePosition())/e.z;i=h.Scalar.Clamp(i-o._backPlateDepth/2,.2*o._frontPlateDepth,o._frontPlateDepth),o._frontPlate.scaling.z=i,o._frontPlate.position=h.Vector3.Forward(o._frontPlate._scene.useRightHandedSystem).scale((o._frontPlateDepth-i)/2),o._textPlate.position=h.Vector3.Forward(o._textPlate._scene.useRightHandedSystem).scale(-(o._backPlateDepth+i)/2)}}})),o._pointerHoverObserver=o.onPointerMoveObservable.add((function(t){o._frontMaterial.globalLeftIndexTipPosition=t})),o}return n(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=(0,h.CreatePlane)("",{size:1},this._backPlate._scene);var o=(0,h.CreatePlane)("",{size:1,sideOrientation:h.Mesh.DOUBLESIDE},this._backPlate._scene),r=new h.StandardMaterial("",this._backPlate._scene);r.diffuseColor=h.Color3.FromHexString("#212121"),o.material=r,o.isPickable=!1,this._tooltipMesh.addChild(o),o.position=h.Vector3.Forward(i).scale(.05),this._tooltipMesh.scaling.y=1/3,this._tooltipMesh.position=h.Vector3.Up().scale(.7).add(h.Vector3.Forward(i).scale(-.15)),this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._backPlate,this._tooltipTexture=lt.CreateForMesh(this._tooltipMesh),this._tooltipTextBlock=new B,this._tooltipTextBlock.scaleY=3,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=130,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new h.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 S;if(t.isVertical=!0,(0,h.IsDocumentAvailable)()&&document.createElement&&this._imageUrl){var e=new C;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 B;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 o,r=this;this.name=null!==(o=this.name)&&void 0!==o?o:"TouchHolographicButton";var n=(0,h.CreateBox)("".concat(this.name,"_collisionMesh"),{width:1,height:1,depth:this._frontPlateDepth},i);n.isPickable=!0,n.isNearPickable=!0,n.visibility=0,n.position=h.Vector3.Forward(i.useRightHandedSystem).scale(-this._frontPlateDepth/2),h.SceneLoader.ImportMeshAsync(void 0,e.MODEL_BASE_URL,e.MODEL_FILENAME,i).then((function(t){var e=(0,h.CreateBox)("${this.name}_alphaMesh",{width:1,height:1,depth:1},i);e.isPickable=!1,e.material=new h.StandardMaterial("${this.name}_alphaMesh_material",i),e.material.alpha=.15;var o=t.meshes[1];o.name="".concat(r.name,"_frontPlate"),o.isPickable=!1,o.scaling.z=r._frontPlateDepth,e.parent=o,o.parent=n,r._frontMaterial&&(o.material=r._frontMaterial),r._frontPlate=o})),this._backPlate=(0,h.CreateBox)("".concat(this.name,"_backPlate"),{width:1,height:1,depth:this._backPlateDepth},i),this._backPlate.position=h.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=h.Vector3.Forward(i.useRightHandedSystem).scale(-this._frontPlateDepth/2),this._backPlate.addChild(n),this._backPlate.addChild(this._textPlate);var a=new h.TransformNode("{this.name}_root",i);return this._backPlate.setParent(a),this.collisionMesh=n,this.collidableFrontDirection=this._backPlate.forward.negate(),a},e.prototype._applyFacade=function(t){this._plateMaterial.emissiveTexture=t,this._plateMaterial.opacityTexture=t,this._plateMaterial.diffuseColor=new h.Color3(.4,.4,.4)},e.prototype._createBackMaterial=function(t){this._backMaterial=new xt(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 Rt(this.name+"Front Material",t.getScene())},e.prototype._createPlateMaterial=function(t){this._plateMaterial=new h.StandardMaterial(this.name+"Plate Material",t.getScene()),this._plateMaterial.specularColor=h.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}(wt),Et=function(){function t(){this.followBehaviorEnabled=!1,this.sixDofDragBehaviorEnabled=!0,this.surfaceMagnetismBehaviorEnabled=!0,this._followBehavior=new h.FollowBehavior,this._sixDofDragBehavior=new h.SixDofDragBehavior,this._surfaceMagnetismBehavior=new h.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}();h.ShaderStore.ShadersStore.handleVertexShader="precision highp float;attribute vec3 position;uniform vec3 positionOffset;uniform mat4 worldViewProjection;uniform float scale;void main(void) {vec4 vPos=vec4((vec3(position)+positionOffset)*scale,1.0);gl_Position=worldViewProjection*vPos;}";h.ShaderStore.ShadersStore.handlePixelShader="uniform vec3 color;void main(void) {gl_FragColor=vec4(color,1.0);}";var Ft,Dt=function(t){function e(e,i){var o=t.call(this,e,i,"handle",{attributes:["position"],uniforms:["worldViewProjection","color","scale","positionOffset"],needAlphaBlending:!1,needAlphaTesting:!1})||this;return o._hover=!1,o._drag=!1,o._color=new h.Color3,o._scale=1,o._lastTick=-1,o.animationLength=100,o.hoverColor=new h.Color3(0,.467,.84),o.baseColor=new h.Color3(1,1,1),o.hoverScale=.75,o.baseScale=.35,o.dragScale=.55,o._positionOffset=h.Vector3.Zero(),o._updateInterpolationTarget(),o._lastTick=Date.now(),o._onBeforeRender=o.getScene().onBeforeRenderObservable.add((function(){var t=Date.now(),e=t-o._lastTick,i=o._targetScale-o._scale,r=h.TmpColors.Color3[0].copyFrom(o._targetColor).subtractToRef(o._color,h.TmpColors.Color3[0]);o._scale=o._scale+i*e/o.animationLength,r.scaleToRef(e/o.animationLength,r),o._color.addToRef(r,o._color),o.setColor3("color",o._color),o.setFloat("scale",o._scale),o.setVector3("positionOffset",o._positionOffset),o._lastTick=t})),o}return n(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}(h.ShaderMaterial);!function(t){t[t.IDLE=0]="IDLE",t[t.HOVER=1]="HOVER",t[t.DRAG=2]="DRAG"}(Ft||(Ft={}));var Lt=function(){function t(t,e){this._state=Ft.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|=Ft.HOVER:this._state&=~Ft.HOVER,this._updateMaterial()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"drag",{set:function(t){t?this._state|=Ft.DRAG:this._state&=~Ft.DRAG,this._updateMaterial()},enumerable:!1,configurable:!0}),t.prototype._createMaterial=function(t){var e=new Dt("handle",this._scene);return t&&(e._positionOffset=t),e},t.prototype._updateMaterial=function(){for(var t=this._state,e=0,i=this._materials;e<i.length;e++)(s=i[e]).hover=!1,s.drag=!1;if(t&Ft.DRAG)for(var o=0,r=this._materials;o<r.length;o++)(s=r[o]).drag=!0;else if(t&Ft.HOVER)for(var n=0,a=this._materials;n<a.length;n++){var s;(s=a[n]).hover=!0}},t.prototype.setDragBehavior=function(t,e,i){var o=new h.BaseSixDofDragBehavior;this._dragBehavior=o,this._dragStartObserver=o.onDragStartObservable.add(t),this._draggingObserver=o.onDragObservable.add(e),this._dragEndObserver=o.onDragEndObservable.add(i),this._dragBehavior.attach(this.node)},t.prototype.dispose=function(){this._dragBehavior.onDragStartObservable.remove(this._dragStartObserver),this._dragBehavior.onDragObservable.remove(this._draggingObserver),this._dragBehavior.onDragEndObservable.remove(this._dragEndObserver),this._dragBehavior.detach();for(var t=0,e=this._materials;t<e.length;t++)e[t].dispose();this.node.dispose()},t}(),kt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.createNode=function(){var t=(0,h.CreateBox)("sideVert",{width:1,height:10,depth:.1},this._scene),e=new h.TransformNode("side",this._scene);t.parent=e;var i=this._createMaterial();return t.material=i,t.isNearGrabbable=!0,this._materials.push(i),e},e}(Lt),Nt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.createNode=function(){var t=(0,h.CreateBox)("angleHor",{width:3,height:1,depth:.1},this._scene),e=(0,h.CreateBox)("angleVert",{width:1,height:3,depth:.1},this._scene),i=new h.TransformNode("angle",this._scene);return t.parent=i,e.parent=i,t.material=this._createMaterial(new h.Vector3(1,0,0)),e.material=this._createMaterial(new h.Vector3(0,1,0)),e.isNearGrabbable=!0,t.isNearGrabbable=!0,this._materials.push(t.material),this._materials.push(e.material),i},e}(Lt),At=function(t){function e(e){var i=t.call(this,e)||this;return i._boundingDimensions=new h.Vector3(0,0,0),i._renderObserver=null,i._tmpQuaternion=new h.Quaternion,i._tmpVector=new h.Vector3(0,0,0),i._corners=[],i._sides=[],i._boundingBoxGizmo={min:new h.Vector3,max:new h.Vector3},i._margin=.35,i._handleSize=.075,i._attachedSlate=null,i._existingSlateScale=new h.Vector3,i.fixedScreenSize=!1,i.fixedScreenSizeDistanceFactor=10,i._createNode(),i.updateScale=!1,i._renderObserver=i.gizmoLayer.originalScene.onBeforeRenderObservable.add((function(){i.attachedMesh&&!i._existingSlateScale.equals(i.attachedMesh.scaling)&&i.updateBoundingBox()})),i}return n(e,t),Object.defineProperty(e.prototype,"attachedSlate",{get:function(){return this._attachedSlate},set:function(t){var e=this;t?(this.attachedMesh=t.mesh,this.updateBoundingBox(),this._pickedPointObserver=t._host.onPickingObservable.add((function(t){if(!e._handleHovered||t&&t.parent===e._handleHovered.node||(e._handleHovered.hover=!1,e._handleHovered=null),t&&t.parent&&t.parent.reservedDataStore&&t.parent.reservedDataStore.handle){var i=t.parent.reservedDataStore.handle;i.gizmo===e&&(e._handleHovered=i,e._handleHovered.hover=!0)}}))):this._attachedSlate&&this._attachedSlate._host.onPickingObservable.remove(this._pickedPointObserver),this._attachedSlate=t},enumerable:!1,configurable:!0}),e.prototype._createNode=function(){var t=this;this._handlesParent=new h.TransformNode("handlesParent",this.gizmoLayer.utilityLayerScene),this._handlesParent.rotationQuaternion=h.Quaternion.Identity();for(var e=[{dimensions:new h.Vector3(-1,-1,0),origin:new h.Vector3(1,0,0)},{dimensions:new h.Vector3(1,-1,0),origin:new h.Vector3(0,0,0)},{dimensions:new h.Vector3(1,1,0),origin:new h.Vector3(0,1,0)},{dimensions:new h.Vector3(-1,1,0),origin:new h.Vector3(1,1,0)}],i=0;i<4;i++){var o=new Nt(this,this.gizmoLayer.utilityLayerScene);this._corners.push(o),o.node.rotation.z=Math.PI/2*i,o.node.parent=this._handlesParent,this._assignDragBehaviorCorners(o,(function(e,i,o,r){return t._moveHandle(e,i,o,r,!0)}),e[i])}for(i=0;i<4;i++){var r=new kt(this,this.gizmoLayer.utilityLayerScene);this._sides.push(r),r.node.rotation.z=Math.PI/2*i,r.node.parent=this._handlesParent,this._assignDragBehaviorSides(r,i%2==0?new h.Vector3(0,1,0):new h.Vector3(1,0,0))}this._handlesParent.parent=this._rootMesh},e.prototype._keepAspectRatio=function(t,e,i){void 0===i&&(i=!1);var o=h.TmpVectors.Vector3[0];o.copyFromFloats(e,1,0).normalize(),i&&(o.y*=-1);var r=h.Vector3.Dot(t,o);t.copyFrom(o).scaleInPlace(r)},e.prototype._clampDimensions=function(t,e,i,o){void 0===o&&(o=!1);var r=h.TmpVectors.Vector3[0];r.copyFrom(t).multiplyInPlace(i);var n=h.TmpVectors.Vector3[1];if(n.copyFromFloats(Math.max(this._attachedSlate.minDimensions.x,r.x+e.x),Math.max(this._attachedSlate.minDimensions.y,r.y+e.y),0),o){var a=e.x/e.y;n.x=Math.max(n.x,n.y*a),n.y=Math.max(n.y,n.x/a)}r.copyFrom(n).subtractInPlace(e),t.x=Math.sign(t.x)*Math.abs(r.x),t.y=Math.sign(t.y)*Math.abs(r.y)},e.prototype._moveHandle=function(t,e,i,o,r){if(this._attachedSlate){if(r){var n=e.x/e.y;this._keepAspectRatio(i,n,o.dimensions.x*o.dimensions.y<0)}this._clampDimensions(i,e,o.dimensions,r);var a=h.TmpVectors.Vector3[0],s=h.TmpVectors.Vector3[1];a.copyFrom(i).multiplyInPlace(o.origin),s.copyFrom(i).multiplyInPlace(o.dimensions),this._attachedSlate.origin.copyFrom(t).addInPlace(a),this._attachedSlate.dimensions.set(e.x+s.x,e.y+s.y)}},e.prototype._assignDragBehaviorCorners=function(t,e,i){var o=this,r=new h.Vector3,n=new h.Vector3,a=new h.Vector3,s=new h.Matrix,l=new h.Vector3;t.setDragBehavior((function(t){o.attachedSlate&&o.attachedMesh&&(r.set(o.attachedSlate.dimensions.x,o.attachedSlate.dimensions.y,h.Epsilon),n.copyFrom(o.attachedSlate.origin),a.copyFrom(t.position),s.copyFrom(o.attachedMesh.computeWorldMatrix(!0)),s.invert(),o.attachedSlate._followButton.isToggled=!1,h.Vector3.TransformNormalToRef(h.Vector3.Forward(),o.attachedMesh.getWorldMatrix(),l),l.normalize(),o._handleHovered&&(o._handleDragged=o._handleHovered,o._handleDragged.drag=!0))}),(function(t){o.attachedSlate&&o.attachedMesh&&(function(t,e,i,o){t.subtractToRef(i,h.TmpVectors.Vector3[0]);var r=h.Vector3.Dot(h.TmpVectors.Vector3[0],e);h.TmpVectors.Vector3[1].copyFrom(e).scaleInPlace(r),h.TmpVectors.Vector3[0].subtractInPlace(h.TmpVectors.Vector3[1]),h.TmpVectors.Vector3[0].addToRef(i,o)}(t.position,l,a,o._tmpVector),o._tmpVector.subtractInPlace(a),h.Vector3.TransformNormalToRef(o._tmpVector,s,o._tmpVector),e(n,r,o._tmpVector,i),o.attachedSlate._positionElements(),o.updateBoundingBox())}),(function(){o.attachedSlate&&o.attachedNode&&(o.attachedSlate._updatePivot(),o._handleDragged&&(o._handleDragged.drag=!1,o._handleDragged=null))}))},e.prototype._assignDragBehaviorSides=function(t,e){var i=this,o=new h.Quaternion,r=new h.Vector3,n=new h.Vector3,a=new h.Vector3,s=new h.Vector3;t.setDragBehavior((function(t){i.attachedSlate&&i.attachedMesh&&(o.copyFrom(i.attachedMesh.rotationQuaternion),r.copyFrom(t.position),a.copyFrom(i.attachedMesh.getAbsolutePivotPoint()),n.copyFrom(r).subtractInPlace(a).normalize(),i.attachedSlate._followButton.isToggled=!1,h.Vector3.TransformNormalToRef(e,i.attachedMesh.getWorldMatrix(),s),s.normalize(),i._handleHovered&&(i._handleDragged=i._handleHovered,i._handleDragged.drag=!0))}),(function(t){if(i.attachedSlate&&i.attachedMesh){i._tmpVector.copyFrom(t.position),i._tmpVector.subtractInPlace(a),i._tmpVector.normalize();var r=-h.Vector3.GetAngleBetweenVectorsOnPlane(i._tmpVector,n,s);h.Quaternion.RotationAxisToRef(e,r,i._tmpQuaternion),o.multiplyToRef(i._tmpQuaternion,i.attachedMesh.rotationQuaternion)}}),(function(){i.attachedSlate&&i.attachedNode&&(i.attachedSlate._updatePivot(),i._handleDragged&&(i._handleDragged.drag=!1,i._handleDragged=null))}))},e.prototype._attachedNodeChanged=function(t){t&&this.updateBoundingBox()},e.prototype.updateBoundingBox=function(){if(this.attachedMesh){h.PivotTools._RemoveAndStorePivotPoint(this.attachedMesh);var t=this.attachedMesh.parent;this.attachedMesh.setParent(null),this._update(),this.attachedMesh.rotationQuaternion||(this.attachedMesh.rotationQuaternion=h.Quaternion.RotationYawPitchRoll(this.attachedMesh.rotation.y,this.attachedMesh.rotation.x,this.attachedMesh.rotation.z)),this._tmpQuaternion.copyFrom(this.attachedMesh.rotationQuaternion),this._tmpVector.copyFrom(this.attachedMesh.position),this.attachedMesh.rotationQuaternion.set(0,0,0,1),this.attachedMesh.position.set(0,0,0);var e=this.attachedMesh.getHierarchyBoundingVectors();e.max.subtractToRef(e.min,this._boundingDimensions),this._boundingBoxGizmo.min=e.min,this._boundingBoxGizmo.max=e.max,this._updateHandlesPosition(),this._updateHandlesScaling(),this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion),this.attachedMesh.position.copyFrom(this._tmpVector),h.PivotTools._RestorePivotPoint(this.attachedMesh),this.attachedMesh.setParent(t),this.attachedMesh.computeWorldMatrix(!0),this._existingSlateScale.copyFrom(this.attachedMesh.scaling)}},e.prototype._updateHandlesPosition=function(){var t=this._boundingBoxGizmo.min.clone(),e=this._boundingBoxGizmo.max.clone(),i=this._corners[0].node.scaling.length();t.x-=this._margin*i,t.y-=this._margin*i,e.x+=this._margin*i,e.y+=this._margin*i;var o=t.add(e).scaleInPlace(.5);this._corners[0].node.position.copyFromFloats(t.x,t.y,0),this._corners[1].node.position.copyFromFloats(e.x,t.y,0),this._corners[2].node.position.copyFromFloats(e.x,e.y,0),this._corners[3].node.position.copyFromFloats(t.x,e.y,0),this._sides[0].node.position.copyFromFloats(t.x,o.y,0),this._sides[1].node.position.copyFromFloats(o.x,t.y,0),this._sides[2].node.position.copyFromFloats(e.x,o.y,0),this._sides[3].node.position.copyFromFloats(o.x,e.y,0)},e.prototype._updateHandlesScaling=function(){if(this._attachedSlate&&this._attachedSlate.mesh){for(var t=this._attachedSlate.mesh.scaling.x*this._attachedSlate.dimensions.x,e=this._attachedSlate.mesh.scaling.y*this._attachedSlate.dimensions.y,i=Math.min(t,e)*this._handleSize,o=0;o<this._corners.length;o++)this._corners[o].node.scaling.setAll(i);for(o=0;o<this._sides.length;o++)this._sides[o].node.scaling.setAll(i)}},e.prototype._update=function(){if(t.prototype._update.call(this),this.gizmoLayer.utilityLayerScene.activeCamera&&this._attachedSlate&&this._attachedSlate.mesh){if(this.fixedScreenSize){this._attachedSlate.mesh.absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position,this._tmpVector);for(var e=this._handleSize*this._tmpVector.length()/this.fixedScreenSizeDistanceFactor,i=0;i<this._corners.length;i++)this._corners[i].node.scaling.set(e,e,e);for(i=0;i<this._sides.length;i++)this._sides[i].node.scaling.set(e,e,e)}this._updateHandlesPosition()}},e.prototype.dispose=function(){this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver),t.prototype.dispose.call(this);for(var e=0,i=this._corners;e<i.length;e++)i[e].dispose();for(var o=0,r=this._sides;o<r.length;o++)r[o].dispose()},e}(h.Gizmo),zt=function(t){function e(e){var i=t.call(this,e)||this;return i.titleBarMargin=.005,i.origin=new h.Vector3(0,0,0),i._dimensions=new h.Vector2(21.875,12.5),i._titleBarHeight=.625,i._titleText="",i._contentScaleRatio=1,i.minDimensions=new h.Vector2(15.625,6.25),i.defaultDimensions=i._dimensions.clone(),i._followButton=new Mt("followButton"+i.name),i._followButton.isToggleButton=!0,i._closeButton=new Mt("closeButton"+i.name),i._contentViewport=new h.Viewport(0,0,1,1),i._contentDragBehavior=new h.PointerDragBehavior({dragPlaneNormal:new h.Vector3(0,0,-1)}),i}return n(e,t),Object.defineProperty(e.prototype,"defaultBehavior",{get:function(){return this._defaultBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dimensions",{get:function(){return this._dimensions},set:function(t){var e=1;if(t.x<this.minDimensions.x||t.y<this.minDimensions.y){var i=t.x/t.y;e=this.minDimensions.x/this.minDimensions.y>i?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,o=this._titleBar,r=this._titleBarTitle,n=this._contentPlate,a=this._backPlate;if(t&&i&&o){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,l=n.getScene().useRightHandedSystem;o.scaling.set(this.dimensions.x,this.titleBarHeight,h.Epsilon),r.scaling.set(this.dimensions.x-2*this.titleBarHeight,this.titleBarHeight,h.Epsilon),n.scaling.copyFromFloats(this.dimensions.x,s,h.Epsilon),a.scaling.copyFromFloats(this.dimensions.x,s,h.Epsilon),o.position.copyFromFloats(this.dimensions.x/2,-this.titleBarHeight/2,0).addInPlace(this.origin),r.position.copyFromFloats(this.dimensions.x/2-this.titleBarHeight,-this.titleBarHeight/2,l?h.Epsilon:-h.Epsilon).addInPlace(this.origin),n.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?-h.Epsilon:h.Epsilon).addInPlace(this.origin),this._titleTextComponent.host.scaleTo(e._DEFAULT_TEXT_RESOLUTION_Y*r.scaling.x/r.scaling.y,e._DEFAULT_TEXT_RESOLUTION_Y);var _=this.dimensions.x/s;this._contentViewport.width=this._contentScaleRatio,this._contentViewport.height=this._contentScaleRatio/_,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 h.Vector3(.5*this.dimensions.x,.5*-this.dimensions.y,h.Epsilon);t.addInPlace(this.origin),t.z=0;var e=new h.Vector3(0,0,0);h.Vector3.TransformCoordinatesToRef(e,this.mesh.computeWorldMatrix(!0),e),this.mesh.setPivotPoint(t);var i=new h.Vector3(0,0,0);h.Vector3.TransformCoordinatesToRef(i,this.mesh.computeWorldMatrix(!0),i),this.mesh.position.addInPlace(e).subtractInPlace(i)}},e.prototype._createNode=function(t){var i=this,o=new h.Mesh("slate_"+this.name,t);this._titleBar=(0,h.CreateBox)("titleBar_"+this.name,{size:1},t),this._titleBarTitle=(0,h.CreatePlane)("titleText_"+this.name,{size:1},t),this._titleBarTitle.parent=o,this._titleBarTitle.isPickable=!1;var r=lt.CreateForMesh(this._titleBarTitle);if(this._titleTextComponent=new B("titleText_"+this.name,this._titleText),this._titleTextComponent.textWrapping=P.Ellipsis,this._titleTextComponent.textHorizontalAlignment=y.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,r.addControl(this._titleTextComponent),t.useRightHandedSystem){var n=new h.Vector4(0,0,1,1);this._contentPlate=(0,h.CreatePlane)("contentPlate_"+this.name,{size:1,sideOrientation:h.VertexData.BACKSIDE,frontUVs:n},t),this._backPlate=(0,h.CreatePlane)("backPlate_"+this.name,{size:1,sideOrientation:h.VertexData.FRONTSIDE},t)}else n=new h.Vector4(0,0,1,1),this._contentPlate=(0,h.CreatePlane)("contentPlate_"+this.name,{size:1,sideOrientation:h.VertexData.FRONTSIDE,frontUVs:n},t),this._backPlate=(0,h.CreatePlane)("backPlate_"+this.name,{size:1,sideOrientation:h.VertexData.BACKSIDE},t);this._titleBar.parent=o,this._titleBar.isNearGrabbable=!0,this._contentPlate.parent=o,this._backPlate.parent=o,this._attachContentPlateBehavior(),this._addControl(this._followButton),this._addControl(this._closeButton);var a=this._followButton,s=this._closeButton;return a.node.parent=o,s.node.parent=o,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()})),o.rotationQuaternion=h.Quaternion.Identity(),o.isVisible=!1,o},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,o=new h.Vector3,r=new h.Vector3,n=new h.Vector3,a=new h.Vector3,s=new h.Vector2;this._contentDragBehavior.onDragStartObservable.add((function(s){t.node&&(e=t._contentViewport.clone(),i=t.node.computeWorldMatrix(!0),o.copyFrom(s.dragPlanePoint),r.set(t.dimensions.x,t.dimensions.y,h.Epsilon),r.y-=t.titleBarHeight+t.titleBarMargin,h.Vector3.TransformNormalToRef(r,i,r),n.copyFromFloats(0,1,0),h.Vector3.TransformNormalToRef(n,i,n),a.copyFromFloats(1,0,0),h.Vector3.TransformNormalToRef(a,i,a),n.normalize(),n.scaleInPlace(1/h.Vector3.Dot(n,r)),a.normalize(),a.scaleInPlace(1/h.Vector3.Dot(a,r)))}));var l=new h.Vector3;this._contentDragBehavior.onDragObservable.add((function(i){l.copyFrom(i.dragPlanePoint),l.subtractInPlace(o),s.copyFromFloats(h.Vector3.Dot(l,a),h.Vector3.Dot(l,n)),t._contentViewport.x=h.Scalar.Clamp(e.x-l.x,0,1-t._contentViewport.width*t._contentScaleRatio),t._contentViewport.y=h.Scalar.Clamp(e.y-l.y,0,1-t._contentViewport.height*t._contentScaleRatio),t._applyContentViewport()}))},e.prototype._affectMaterial=function(t){this._titleBarMaterial=new Ct("".concat(this.name," plateMaterial"),t.getScene()),this._contentMaterial=new xt("".concat(this.name," contentMaterial"),t.getScene()),this._contentMaterial.renderBorders=!0,this._backMaterial=new Ct("".concat(this.name," backPlate"),t.getScene()),this._backMaterial.lineWidth=h.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 At(this._host.utilityLayer),this._gizmo.attachedSlate=this,this._defaultBehavior=new Et,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 o=i.getWorldMatrix(),r=h.Vector3.TransformNormal(h.Vector3.Backward(e.useRightHandedSystem),o);this.origin.setAll(0),this._gizmo.updateBoundingBox();var n=this.node.getAbsolutePivotPoint();this.node.position.copyFrom(i.position).subtractInPlace(r).subtractInPlace(n),this.node.rotationQuaternion=h.Quaternion.FromLookDirectionLH(r,new h.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}(ft),Qt=function(t){function e(e,i){var o=t.call(this,i)||this;return o._currentMesh=e,o.pointerEnterAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1.1)},o.pointerOutAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1/1.1)},o.pointerDownAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(.95)},o.pointerUpAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1/.95)},o}return n(e,t),e.prototype._getTypeName=function(){return"MeshButton3D"},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}(gt),Vt=function(t){function e(e){var i=t.call(this,e)||this;return i._isPinned=!1,i._defaultBehavior=new Et,i._dragObserver=i._defaultBehavior.sixDofDragBehavior.onDragObservable.add((function(){i.isPinned=!0})),i.backPlateMargin=1,i}return n(e,t),Object.defineProperty(e.prototype,"defaultBehavior",{get:function(){return this._defaultBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isPinned",{get:function(){return this._isPinned},set:function(t){this._pinButton.isToggled===t?(this._isPinned=t,this._defaultBehavior.followBehaviorEnabled=!t):this._pinButton.isToggled=t},enumerable:!1,configurable:!0}),e.prototype._createPinButton=function(t){var i=this,o=new Mt("pin"+this.name,!1);return o.imageUrl=e._ASSETS_BASE_URL+e._PIN_ICON_FILENAME,o.parent=this,o._host=this._host,o.isToggleButton=!0,o.onToggleObservable.add((function(t){i.isPinned=t})),this._host.utilityLayer&&(o._prepareNode(this._host.utilityLayer.utilityLayerScene),o.scaling.scaleInPlace(Pt.MENU_BUTTON_SCALE),o.node&&(o.node.parent=t)),o},e.prototype._createNode=function(e){var i=t.prototype._createNode.call(this,e);return this._pinButton=this._createPinButton(i),this.isPinned=!1,this._defaultBehavior.attach(i,[this._backPlate]),this._defaultBehavior.followBehavior.ignoreCameraPitchAndRoll=!0,this._defaultBehavior.followBehavior.pitchOffset=-15,this._defaultBehavior.followBehavior.minimumDistance=.3,this._defaultBehavior.followBehavior.defaultDistance=.4,this._defaultBehavior.followBehavior.maximumDistance=.6,this._backPlate.isNearGrabbable=!0,i.isVisible=!1,i},e.prototype._finalProcessing=function(){t.prototype._finalProcessing.call(this),this._pinButton.position.copyFromFloats((this._backPlate.scaling.x+Pt.MENU_BUTTON_SCALE)/2,this._backPlate.scaling.y/2,0)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._defaultBehavior.sixDofDragBehavior.onDragObservable.remove(this._dragObserver),this._defaultBehavior.detach()},e._ASSETS_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",e._PIN_ICON_FILENAME="IconPin.png",e}(Pt),Wt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype._mapGridNode=function(t,e){var i=t.mesh;if(i){t.position=e.clone();var o=h.TmpVectors.Vector3[0];switch(o.copyFrom(e),this.orientation){case bt.FACEORIGIN_ORIENTATION:case bt.FACEFORWARD_ORIENTATION:o.addInPlace(new h.Vector3(0,0,1)),i.lookAt(o);break;case bt.FACEFORWARDREVERSED_ORIENTATION:case bt.FACEORIGINREVERSED_ORIENTATION:o.addInPlace(new h.Vector3(0,0,-1)),i.lookAt(o)}}},e}(mt),Ht=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._iteration=100,e}return n(e,t),Object.defineProperty(e.prototype,"iteration",{get:function(){return this._iteration},set:function(t){var e=this;this._iteration!==t&&(this._iteration=t,h.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._mapGridNode=function(t,e){var i=t.mesh,o=this._scatterMapping(e);if(i){switch(this.orientation){case bt.FACEORIGIN_ORIENTATION:case bt.FACEFORWARD_ORIENTATION:i.lookAt(new h.Vector3(0,0,1));break;case bt.FACEFORWARDREVERSED_ORIENTATION:case bt.FACEORIGINREVERSED_ORIENTATION:i.lookAt(new h.Vector3(0,0,-1))}t.position=o}},e.prototype._scatterMapping=function(t){return t.x=(1-2*Math.random())*this._cellWidth,t.y=(1-2*Math.random())*this._cellHeight,t},e.prototype._finalProcessing=function(){for(var t=[],e=0,i=this._children;e<i.length;e++){var o=i[e];o.mesh&&t.push(o.mesh)}for(var r=0;r<this._iteration;r++){t.sort((function(t,e){var i=t.position.lengthSquared(),o=e.position.lengthSquared();return i<o?1:i>o?-1:0}));for(var n=Math.pow(this.margin,2),a=Math.max(this._cellWidth,this._cellHeight),s=h.TmpVectors.Vector2[0],l=h.TmpVectors.Vector3[0],_=0;_<t.length-1;_++)for(var c=_+1;c<t.length;c++)if(_!=c){t[c].position.subtractToRef(t[_].position,l),s.x=l.x,s.y=l.y;var u=a,d=s.lengthSquared()-n;(d-=Math.min(d,n))<Math.pow(u,2)&&(s.normalize(),l.scaleInPlace(.5*(u-Math.sqrt(d))),t[c].position.addInPlace(l),t[_].position.subtractInPlace(l))}}},e}(mt);h.ShaderStore.ShadersStore.mrdlSliderBarPixelShader="uniform vec3 cameraPosition;varying vec3 vPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec3 vBinormal;varying vec4 vColor;varying vec4 vExtra1;varying vec4 vExtra2;varying vec4 vExtra3;uniform float _Radius_;uniform float _Bevel_Front_;uniform float _Bevel_Front_Stretch_;uniform float _Bevel_Back_;uniform float _Bevel_Back_Stretch_;uniform float _Radius_Top_Left_;uniform float _Radius_Top_Right_;uniform float _Radius_Bottom_Left_;uniform float _Radius_Bottom_Right_;uniform bool _Bulge_Enabled_;uniform float _Bulge_Height_;uniform float _Bulge_Radius_;uniform float _Sun_Intensity_;uniform float _Sun_Theta_;uniform float _Sun_Phi_;uniform float _Indirect_Diffuse_;uniform vec4 _Albedo_;uniform float _Specular_;uniform float _Shininess_;uniform float _Sharpness_;uniform float _Subsurface_;uniform vec4 _Left_Color_;uniform vec4 _Right_Color_;uniform float _Reflection_;uniform float _Front_Reflect_;uniform float _Edge_Reflect_;uniform float _Power_;uniform vec4 _Sky_Color_;uniform vec4 _Horizon_Color_;uniform vec4 _Ground_Color_;uniform float _Horizon_Power_;uniform sampler2D _Reflection_Map_;uniform sampler2D _Indirect_Environment_;uniform float _Width_;uniform float _Fuzz_;uniform float _Min_Fuzz_;uniform float _Clip_Fade_;uniform float _Hue_Shift_;uniform float _Saturation_Shift_;uniform float _Value_Shift_;uniform vec3 _Blob_Position_;uniform float _Blob_Intensity_;uniform float _Blob_Near_Size_;uniform float _Blob_Far_Size_;uniform float _Blob_Near_Distance_;uniform float _Blob_Far_Distance_;uniform float _Blob_Fade_Length_;uniform float _Blob_Pulse_;uniform float _Blob_Fade_;uniform sampler2D _Blob_Texture_;uniform vec3 _Blob_Position_2_;uniform float _Blob_Near_Size_2_;uniform float _Blob_Pulse_2_;uniform float _Blob_Fade_2_;uniform vec3 _Left_Index_Pos_;uniform vec3 _Right_Index_Pos_;uniform vec3 _Left_Index_Middle_Pos_;uniform vec3 _Right_Index_Middle_Pos_;uniform sampler2D _Decal_;uniform vec2 _Decal_Scale_XY_;uniform bool _Decal_Front_Only_;uniform float _Rim_Intensity_;uniform sampler2D _Rim_Texture_;uniform float _Rim_Hue_Shift_;uniform float _Rim_Saturation_Shift_;uniform float _Rim_Value_Shift_;uniform float _Iridescence_Intensity_;uniform sampler2D _Iridescence_Texture_;uniform bool Use_Global_Left_Index;uniform bool Use_Global_Right_Index;uniform vec4 Global_Left_Index_Tip_Position;uniform vec4 Global_Right_Index_Tip_Position;uniform vec4 Global_Left_Thumb_Tip_Position;uniform vec4 Global_Right_Thumb_Tip_Position;uniform vec4 Global_Left_Index_Middle_Position;uniform vec4 Global_Right_Index_Middle_Position;uniform float Global_Left_Index_Tip_Proximity;uniform float Global_Right_Index_Tip_Proximity;void Blob_Fragment_B30(\nsampler2D Blob_Texture,\nvec4 Blob_Info1,\nvec4 Blob_Info2,\nout vec4 Blob_Color)\n{float k1=dot(Blob_Info1.xy,Blob_Info1.xy);float k2=dot(Blob_Info2.xy,Blob_Info2.xy);vec3 closer=k1<k2 ? vec3(k1,Blob_Info1.z,Blob_Info1.w) : vec3(k2,Blob_Info2.z,Blob_Info2.w);Blob_Color=closer.z*texture(Blob_Texture,vec2(vec2(sqrt(closer.x),closer.y).x,1.0-vec2(sqrt(closer.x),closer.y).y))*clamp(1.0-closer.x,0.0,1.0);}\nvoid FastLinearTosRGB_B42(\nvec4 Linear,\nout vec4 sRGB)\n{sRGB.rgb=sqrt(clamp(Linear.rgb,0.0,1.0));sRGB.a=Linear.a;}\nvoid Scale_RGB_B59(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{Result=vec4(Scalar,Scalar,Scalar,1)*Color;}\nvoid Fragment_Main_B121(\nfloat Sun_Intensity,\nfloat Sun_Theta,\nfloat Sun_Phi,\nvec3 Normal,\nvec4 Albedo,\nfloat Fresnel_Reflect,\nfloat Shininess,\nvec3 Incident,\nvec4 Horizon_Color,\nvec4 Sky_Color,\nvec4 Ground_Color,\nfloat Indirect_Diffuse,\nfloat Specular,\nfloat Horizon_Power,\nfloat Reflection,\nvec4 Reflection_Sample,\nvec4 Indirect_Sample,\nfloat Sharpness,\nfloat SSS,\nfloat Subsurface,\nvec4 Translucence,\nvec4 Rim_Light,\nvec4 Iridescence,\nout vec4 Result)\n{float theta=Sun_Theta*2.0*3.14159;float phi=Sun_Phi*3.14159;vec3 lightDir= vec3(cos(phi)*cos(theta),sin(phi),cos(phi)*sin(theta));float NdotL=max(dot(lightDir,Normal),0.0);vec3 R=reflect(Incident,Normal);float RdotL=max(0.0,dot(R,lightDir));float specular=pow(RdotL,Shininess);specular=mix(specular,smoothstep(0.495*Sharpness,1.0-0.495*Sharpness,specular),Sharpness);vec4 gi=mix(Ground_Color,Sky_Color,Normal.y*0.5+0.5);Result=((Sun_Intensity*NdotL+Indirect_Sample*Indirect_Diffuse+Translucence)*(1.0+SSS*Subsurface))*Albedo*(1.0-Fresnel_Reflect)+(Sun_Intensity*specular*Specular+Fresnel_Reflect*Reflection*Reflection_Sample)+Fresnel_Reflect*Rim_Light+Iridescence;}\nvoid Bulge_B79(\nbool Enabled,\nvec3 Normal,\nvec3 Tangent,\nfloat Bulge_Height,\nvec4 UV,\nfloat Bulge_Radius,\nvec3 ButtonN,\nout vec3 New_Normal)\n{vec2 xy=clamp(UV.xy*2.0,vec2(-1,-1),vec2(1,1));vec3 B=(cross(Normal,Tangent));float k=-clamp(1.0-length(xy)/Bulge_Radius,0.0,1.0)*Bulge_Height;k=sin(k*3.14159*0.5);k*=smoothstep(0.9998,0.9999,abs(dot(ButtonN,Normal)));New_Normal=Normal*sqrt(1.0-k*k)+(xy.x*Tangent+xy.y*B)*k;New_Normal=Enabled ? New_Normal : Normal;}\nvoid SSS_B77(\nvec3 ButtonN,\nvec3 Normal,\nvec3 Incident,\nout float Result)\n{float NdotI=abs(dot(Normal,Incident));float BdotI=abs(dot(ButtonN,Incident));Result=(abs(NdotI-BdotI)); }\nvoid FingerOcclusion_B67(\nfloat Width,\nfloat DistToCenter,\nfloat Fuzz,\nfloat Min_Fuzz,\nvec3 Position,\nvec3 Forward,\nvec3 Nearest,\nfloat Fade_Out,\nout float NotInShadow)\n{float d=dot((Nearest-Position),Forward);float sh=smoothstep(Width*0.5,Width*0.5+Fuzz*max(d,0.0)+Min_Fuzz,DistToCenter);NotInShadow=1.0-(1.0-sh)*smoothstep(-Fade_Out,0.0,d);}\nvoid FingerOcclusion_B68(\nfloat Width,\nfloat DistToCenter,\nfloat Fuzz,\nfloat Min_Fuzz,\nvec3 Position,\nvec3 Forward,\nvec3 Nearest,\nfloat Fade_Out,\nout float NotInShadow)\n{float d=dot((Nearest-Position),Forward);float sh=smoothstep(Width*0.5,Width*0.5+Fuzz*max(d,0.0)+Min_Fuzz,DistToCenter);NotInShadow=1.0-(1.0-sh)*smoothstep(-Fade_Out,0.0,d);}\nvoid Scale_Color_B91(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{Result=Scalar*Color;}\nvoid From_HSV_B73(\nfloat Hue,\nfloat Saturation,\nfloat Value,\nfloat Alpha,\nout vec4 Color)\n{vec4 K=vec4(1.0,2.0/3.0,1.0/3.0,3.0);vec3 p=abs(fract(vec3(Hue,Hue,Hue)+K.xyz)*6.0-K.www);Color.rgb=Value*mix(K.xxx,clamp(p-K.xxx,0.0,1.0),Saturation);Color.a=Alpha;}\nvoid Fast_Fresnel_B122(\nfloat Front_Reflect,\nfloat Edge_Reflect,\nfloat Power,\nvec3 Normal,\nvec3 Incident,\nout float Transmit,\nout float Reflect)\n{float d=max(-dot(Incident,Normal),0.0);Reflect=Front_Reflect+(Edge_Reflect-Front_Reflect)*pow(.01-d,Power);Transmit=1.0-Reflect;}\nvoid Mapped_Environment_B51(\nsampler2D Reflected_Environment,\nsampler2D Indirect_Environment,\nvec3 Dir,\nout vec4 Reflected_Color,\nout vec4 Indirect_Diffuse)\n{Reflected_Color=texture(Reflected_Environment,vec2(atan(Dir.z,Dir.x)/3.14159*0.5,asin(Dir.y)/3.14159+0.5));Indirect_Diffuse=texture(Indirect_Environment,vec2(atan(Dir.z,Dir.x)/3.14159*0.5,asin(Dir.y)/3.14159+0.5));}\nvec4 SampleEnv_Bid50(vec3 D,vec4 S,vec4 H,vec4 G,float exponent)\n{float k=pow(abs(D.y),exponent);vec4 C;if (D.y>0.0) {C=mix(H,S,k);} else {C=mix(H,G,k); }\nreturn C;}\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{Reflected_Color=SampleEnv_Bid50(Reflected,Sky_Color,Horizon_Color,Ground_Color,Horizon_Power);Indirect_Color=mix(Ground_Color,Sky_Color,Normal.y*0.5+0.5);}\nvoid Min_Segment_Distance_B65(\nvec3 P0,\nvec3 P1,\nvec3 Q0,\nvec3 Q1,\nout vec3 NearP,\nout vec3 NearQ,\nout float Distance)\n{vec3 u=P1-P0;vec3 v=Q1-Q0;vec3 w=P0-Q0;float a=dot(u,u);float b=dot(u,v);float c=dot(v,v);float d=dot(u,w);float e=dot(v,w);float D=a*c-b*b;float sD=D;float tD=D;float sc,sN,tc,tN;if (D<0.00001) {sN=0.0;sD=1.0;tN=e;tD=c;} else {sN=(b*e-c*d);tN=(a*e-b*d);if (sN<0.0) {sN=0.0;tN=e;tD=c;} else if (sN>sD) {sN=sD;tN=e+b;tD=c;}}\nif (tN<0.0) {tN=0.0;if (-d<0.0) {sN=0.0;} else if (-d>a) {sN=sD;} else {sN=-d;sD=a;}} else if (tN>tD) {tN=tD;if ((-d+b)<0.0) {sN=0.0;} else if ((-d+b)>a) {sN=sD;} else {sN=(-d+b);sD=a;}}\nsc=abs(sN)<0.000001 ? 0.0 : sN/sD;tc=abs(tN)<0.000001 ? 0.0 : tN/tD;NearP=P0+sc*u;NearQ=Q0+tc*v;Distance=distance(NearP,NearQ);}\nvoid To_XYZ_B74(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{X=Vec3.x;Y=Vec3.y;Z=Vec3.z;}\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{Left_Index= (Use_Global_Left_Index ? Global_Left_Index_Tip_Position.xyz : Left_Index_Pos);Right_Index= (Use_Global_Right_Index ? Global_Right_Index_Tip_Position.xyz : Right_Index_Pos);Left_Index_Middle= (Use_Global_Left_Index ? Global_Left_Index_Middle_Position.xyz : Left_Index_Middle_Pos);Right_Index_Middle= (Use_Global_Right_Index ? Global_Right_Index_Middle_Position.xyz : Right_Index_Middle_Pos);}\nvoid VaryHSV_B108(\nvec3 HSV_In,\nfloat Hue_Shift,\nfloat Saturation_Shift,\nfloat Value_Shift,\nout vec3 HSV_Out)\n{HSV_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));}\nvoid Remap_Range_B114(\nfloat In_Min,\nfloat In_Max,\nfloat Out_Min,\nfloat Out_Max,\nfloat In,\nout float Out)\n{Out=mix(Out_Min,Out_Max,clamp((In-In_Min)/(In_Max-In_Min),0.0,1.0));}\nvoid To_HSV_B75(\nvec4 Color,\nout float Hue,\nout float Saturation,\nout float Value,\nout float Alpha,\nout vec3 HSV)\n{vec4 K=vec4(0.0,-1.0/3.0,2.0/3.0,-1.0);vec4 p=Color.g<Color.b ? vec4(Color.bg,K.wz) : vec4(Color.gb,K.xy);vec4 q=Color.r<p.x ? vec4(p.xyw,Color.r) : vec4(Color.r,p.yzx);float d=q.x-min(q.w,q.y);float e=1.0e-10;Hue=abs(q.z+(q.w-q.y)/(6.0*d+e));Saturation=d/(q.x+e);Value=q.x;Alpha=Color.a;HSV=vec3(Hue,Saturation,Value);}\nvoid Code_B110(\nfloat X,\nout float Result)\n{Result=(acos(X)/3.14159-0.5)*2.0;}\nvoid Rim_Light_B132(\nvec3 Front,\nvec3 Normal,\nvec3 Incident,\nfloat Rim_Intensity,\nsampler2D Texture,\nout vec4 Result)\n{vec3 R=reflect(Incident,Normal);float RdotF=dot(R,Front);float RdotL=sqrt(1.0-RdotF*RdotF);vec2 UV=vec2(R.y*0.5+0.5,0.5);vec4 Color=texture(Texture,UV);Result=Color;}\nvoid main()\n{vec4 Blob_Color_Q30;\n#if BLOB_ENABLE\nBlob_Fragment_B30(_Blob_Texture_,vExtra2,vExtra3,Blob_Color_Q30);\n#else\nBlob_Color_Q30=vec4(0,0,0,0);\n#endif\nvec3 Incident_Q39=normalize(vPosition-cameraPosition);vec3 Normalized_Q38=normalize(vNormal);vec3 Normalized_Q71=normalize(vTangent);vec4 Color_Q83;\n#if DECAL_ENABLE\nColor_Q83=texture(_Decal_,vUV);\n#else\nColor_Q83=vec4(0,0,0,0);\n#endif\nfloat X_Q90;float Y_Q90;float Z_Q90;float W_Q90;X_Q90=vExtra1.x;Y_Q90=vExtra1.y;Z_Q90=vExtra1.z;W_Q90=vExtra1.w;vec4 Linear_Q43;Linear_Q43.rgb=clamp(_Sky_Color_.rgb*_Sky_Color_.rgb,0.0,1.0);Linear_Q43.a=_Sky_Color_.a;vec4 Linear_Q44;Linear_Q44.rgb=clamp(_Horizon_Color_.rgb*_Horizon_Color_.rgb,0.0,1.0);Linear_Q44.a=_Horizon_Color_.a;vec4 Linear_Q45;Linear_Q45.rgb=clamp(_Ground_Color_.rgb*_Ground_Color_.rgb,0.0,1.0);Linear_Q45.a=_Ground_Color_.a;vec3 Left_Index_Q64;vec3 Right_Index_Q64;vec3 Left_Index_Middle_Q64;vec3 Right_Index_Middle_Q64;Finger_Positions_B64(_Left_Index_Pos_,_Right_Index_Pos_,_Left_Index_Middle_Pos_,_Right_Index_Middle_Pos_,Left_Index_Q64,Right_Index_Q64,Left_Index_Middle_Q64,Right_Index_Middle_Q64);vec4 Linear_Q46;Linear_Q46.rgb=clamp(_Albedo_.rgb*_Albedo_.rgb,0.0,1.0);Linear_Q46.a=_Albedo_.a;vec3 Normalized_Q107=normalize(vBinormal);vec3 Incident_Q70=normalize(vPosition-cameraPosition);vec3 New_Normal_Q79;Bulge_B79(_Bulge_Enabled_,Normalized_Q38,Normalized_Q71,_Bulge_Height_,vColor,_Bulge_Radius_,vBinormal,New_Normal_Q79);float Result_Q77;SSS_B77(vBinormal,New_Normal_Q79,Incident_Q39,Result_Q77);vec4 Result_Q91;Scale_Color_B91(Color_Q83,X_Q90,Result_Q91);float Transmit_Q122;float Reflect_Q122;Fast_Fresnel_B122(_Front_Reflect_,_Edge_Reflect_,_Power_,New_Normal_Q79,Incident_Q39,Transmit_Q122,Reflect_Q122);float Product_Q125=Y_Q90*Y_Q90;vec3 NearP_Q65;vec3 NearQ_Q65;float Distance_Q65;Min_Segment_Distance_B65(Left_Index_Q64,Left_Index_Middle_Q64,vPosition,cameraPosition,NearP_Q65,NearQ_Q65,Distance_Q65);vec3 NearP_Q63;vec3 NearQ_Q63;float Distance_Q63;Min_Segment_Distance_B65(Right_Index_Q64,Right_Index_Middle_Q64,vPosition,cameraPosition,NearP_Q63,NearQ_Q63,Distance_Q63);vec3 Reflected_Q47=reflect(Incident_Q39,New_Normal_Q79);vec4 Product_Q103=Linear_Q46*vec4(1,1,1,1);vec4 Result_Q132;Rim_Light_B132(Normalized_Q107,Normalized_Q38,Incident_Q70,_Rim_Intensity_,_Rim_Texture_,Result_Q132);float Dot_Q72=dot(Incident_Q70, Normalized_Q71);float MaxAB_Q123=max(Reflect_Q122,Product_Q125);float NotInShadow_Q67;\n#if OCCLUSION_ENABLED\nFingerOcclusion_B67(_Width_,Distance_Q65,_Fuzz_,_Min_Fuzz_,vPosition,vBinormal,NearP_Q65,_Clip_Fade_,NotInShadow_Q67);\n#else\nNotInShadow_Q67=1.0;\n#endif\nfloat NotInShadow_Q68;\n#if OCCLUSION_ENABLED\nFingerOcclusion_B68(_Width_,Distance_Q63,_Fuzz_,_Min_Fuzz_,vPosition,vBinormal,NearP_Q63,_Clip_Fade_,NotInShadow_Q68);\n#else\nNotInShadow_Q68=1.0;\n#endif\nvec4 Reflected_Color_Q51;vec4 Indirect_Diffuse_Q51;\n#if ENV_ENABLE\nMapped_Environment_B51(_Reflection_Map_,_Indirect_Environment_,Reflected_Q47,Reflected_Color_Q51,Indirect_Diffuse_Q51);\n#else\nReflected_Color_Q51=vec4(0,0,0,1);Indirect_Diffuse_Q51=vec4(0,0,0,1);\n#endif\nvec4 Reflected_Color_Q50;vec4 Indirect_Color_Q50;\n#if SKY_ENABLED\nSky_Environment_B50(New_Normal_Q79,Reflected_Q47,Linear_Q43,Linear_Q44,Linear_Q45,_Horizon_Power_,Reflected_Color_Q50,Indirect_Color_Q50);\n#else\nReflected_Color_Q50=vec4(0,0,0,1);Indirect_Color_Q50=vec4(0,0,0,1);\n#endif\nfloat Hue_Q75;float Saturation_Q75;float Value_Q75;float Alpha_Q75;vec3 HSV_Q75;To_HSV_B75(Product_Q103,Hue_Q75,Saturation_Q75,Value_Q75,Alpha_Q75,HSV_Q75);float Hue_Q127;float Saturation_Q127;float Value_Q127;float Alpha_Q127;vec3 HSV_Q127;To_HSV_B75(Result_Q132,Hue_Q127,Saturation_Q127,Value_Q127,Alpha_Q127,HSV_Q127);float Result_Q110;Code_B110(Dot_Q72,Result_Q110);float AbsA_Q76=abs(Result_Q110);float MinAB_Q58=min(NotInShadow_Q67,NotInShadow_Q68);vec4 Sum_Q48=Reflected_Color_Q51+Reflected_Color_Q50;vec4 Sum_Q49=Indirect_Diffuse_Q51+Indirect_Color_Q50;vec3 HSV_Out_Q126;VaryHSV_B108(HSV_Q127,_Rim_Hue_Shift_,_Rim_Saturation_Shift_,_Rim_Value_Shift_,HSV_Out_Q126);float Out_Q114;Remap_Range_B114(-1.0,1.0,0.0,1.0,Result_Q110,Out_Q114);float Product_Q106;Product_Q106=AbsA_Q76*_Hue_Shift_;float X_Q128;float Y_Q128;float Z_Q128;To_XYZ_B74(HSV_Out_Q126,X_Q128,Y_Q128,Z_Q128);vec2 Vec2_Q112=vec2(Out_Q114,0.5);vec3 HSV_Out_Q108;VaryHSV_B108(HSV_Q75,Product_Q106,_Saturation_Shift_,_Value_Shift_,HSV_Out_Q108);vec4 Color_Q129;From_HSV_B73(X_Q128,Y_Q128,Z_Q128,0.0,Color_Q129);vec4 Color_Q111;\n#if IRIDESCENCE_ENABLED\nColor_Q111=texture(_Iridescence_Texture_,Vec2_Q112);\n#else\nColor_Q111=vec4(0,0,0,0);\n#endif\nfloat X_Q74;float Y_Q74;float Z_Q74;To_XYZ_B74(HSV_Out_Q108,X_Q74,Y_Q74,Z_Q74);vec4 Result_Q131=_Rim_Intensity_*Color_Q129;vec4 Result_Q113=_Iridescence_Intensity_*Color_Q111;vec4 Color_Q73;From_HSV_B73(X_Q74,Y_Q74,Z_Q74,0.0,Color_Q73);vec4 Result_Q84=Result_Q91+(1.0-Result_Q91.a)*Color_Q73;vec4 Result_Q121;Fragment_Main_B121(_Sun_Intensity_,_Sun_Theta_,_Sun_Phi_,New_Normal_Q79,Result_Q84,MaxAB_Q123,_Shininess_,Incident_Q39,_Horizon_Color_,_Sky_Color_,_Ground_Color_,_Indirect_Diffuse_,_Specular_,_Horizon_Power_,_Reflection_,Sum_Q48,Sum_Q49,_Sharpness_,Result_Q77,_Subsurface_,vec4(0,0,0,0),Result_Q131,Result_Q113,Result_Q121);vec4 Result_Q59;Scale_RGB_B59(Result_Q121,MinAB_Q58,Result_Q59);vec4 sRGB_Q42;FastLinearTosRGB_B42(Result_Q59,sRGB_Q42);vec4 Result_Q31=Blob_Color_Q30+(1.0-Blob_Color_Q30.a)*sRGB_Q42;vec4 Result_Q40=Result_Q31; Result_Q40.a=1.0;vec4 Out_Color=Result_Q40;float Clip_Threshold=0.001;bool To_sRGB=false;gl_FragColor=Out_Color;}";h.ShaderStore.ShadersStore.mrdlSliderBarVertexShader="uniform mat4 world;uniform mat4 viewProjection;uniform vec3 cameraPosition;attribute vec3 position;attribute vec3 normal;attribute vec2 uv;\n#ifdef TANGENT\nattribute vec3 tangent;\n#else\nconst vec3 tangent=vec3(0.);\n#endif\nuniform float _Radius_;uniform float _Bevel_Front_;uniform float _Bevel_Front_Stretch_;uniform float _Bevel_Back_;uniform float _Bevel_Back_Stretch_;uniform float _Radius_Top_Left_;uniform float _Radius_Top_Right_;uniform float _Radius_Bottom_Left_;uniform float _Radius_Bottom_Right_;uniform bool _Bulge_Enabled_;uniform float _Bulge_Height_;uniform float _Bulge_Radius_;uniform float _Sun_Intensity_;uniform float _Sun_Theta_;uniform float _Sun_Phi_;uniform float _Indirect_Diffuse_;uniform vec4 _Albedo_;uniform float _Specular_;uniform float _Shininess_;uniform float _Sharpness_;uniform float _Subsurface_;uniform vec4 _Left_Color_;uniform vec4 _Right_Color_;uniform float _Reflection_;uniform float _Front_Reflect_;uniform float _Edge_Reflect_;uniform float _Power_;uniform vec4 _Sky_Color_;uniform vec4 _Horizon_Color_;uniform vec4 _Ground_Color_;uniform float _Horizon_Power_;uniform sampler2D _Reflection_Map_;uniform sampler2D _Indirect_Environment_;uniform float _Width_;uniform float _Fuzz_;uniform float _Min_Fuzz_;uniform float _Clip_Fade_;uniform float _Hue_Shift_;uniform float _Saturation_Shift_;uniform float _Value_Shift_;uniform vec3 _Blob_Position_;uniform float _Blob_Intensity_;uniform float _Blob_Near_Size_;uniform float _Blob_Far_Size_;uniform float _Blob_Near_Distance_;uniform float _Blob_Far_Distance_;uniform float _Blob_Fade_Length_;uniform float _Blob_Pulse_;uniform float _Blob_Fade_;uniform sampler2D _Blob_Texture_;uniform vec3 _Blob_Position_2_;uniform float _Blob_Near_Size_2_;uniform float _Blob_Pulse_2_;uniform float _Blob_Fade_2_;uniform vec3 _Left_Index_Pos_;uniform vec3 _Right_Index_Pos_;uniform vec3 _Left_Index_Middle_Pos_;uniform vec3 _Right_Index_Middle_Pos_;uniform sampler2D _Decal_;uniform vec2 _Decal_Scale_XY_;uniform bool _Decal_Front_Only_;uniform float _Rim_Intensity_;uniform sampler2D _Rim_Texture_;uniform float _Rim_Hue_Shift_;uniform float _Rim_Saturation_Shift_;uniform float _Rim_Value_Shift_;uniform float _Iridescence_Intensity_;uniform sampler2D _Iridescence_Texture_;uniform bool Use_Global_Left_Index;uniform bool Use_Global_Right_Index;uniform vec4 Global_Left_Index_Tip_Position;uniform vec4 Global_Right_Index_Tip_Position;uniform vec4 Global_Left_Thumb_Tip_Position;uniform vec4 Global_Right_Thumb_Tip_Position;uniform float Global_Left_Index_Tip_Proximity;uniform float Global_Right_Index_Tip_Proximity;varying vec3 vPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec3 vBinormal;varying vec4 vColor;varying vec4 vExtra1;varying vec4 vExtra2;varying vec4 vExtra3;void Object_To_World_Pos_B12(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{Pos_World=(world*vec4(Pos_Object,1.0)).xyz;}\nvoid Object_To_World_Normal_B32(\nvec3 Nrm_Object,\nout vec3 Nrm_World)\n{Nrm_World=(vec4(Nrm_Object,0.0)).xyz;}\nvoid Blob_Vertex_B23(\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,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{vec3 blob= (Use_Global_Left_Index ? Global_Left_Index_Tip_Position.xyz : Blob_Position);vec3 delta=blob-Position;float dist=dot(Normal,delta);float lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);float fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);float size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;vec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);float Fade=fadeValue*Intensity*Blob_Fade;float Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);Blob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);}\nvoid Blob_Vertex_B24(\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,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{vec3 blob= (Use_Global_Right_Index ? Global_Right_Index_Tip_Position.xyz : Blob_Position);vec3 delta=blob-Position;float dist=dot(Normal,delta);float lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);float fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);float size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;vec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);float Fade=fadeValue*Intensity*Blob_Fade;float Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);Blob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);}\nvoid Move_Verts_B130(\nfloat Anisotropy,\nvec3 P,\nfloat Radius,\nfloat Bevel,\nvec3 Normal_Object,\nfloat ScaleZ,\nfloat Stretch,\nout vec3 New_P,\nout vec2 New_UV,\nout float Radial_Gradient,\nout vec3 Radial_Dir,\nout vec3 New_Normal)\n{vec2 UV=P.xy*2.0+0.5;vec2 center=clamp(UV,0.0,1.0);vec2 delta=UV-center;float deltad=(length(delta)*2.0);float f=(Bevel+(Radius-Bevel)*Stretch)/Radius;float innerd=clamp(deltad*2.0,0.0,1.0);float outerd=clamp(deltad*2.0-1.0,0.0,1.0);float bevelAngle=outerd*3.14159*0.5;float sinb=sin(bevelAngle);float cosb=cos(bevelAngle);float beveld=(1.0-f)*innerd+f*sinb;float br=outerd;vec2 r2=2.0*vec2(Radius/Anisotropy,Radius);float dir=P.z<0.0001 ? 1.0 : -1.0;New_UV=center+r2*((0.5-center)+normalize(delta+vec2(0.0,0.000001))*beveld*0.5);New_P=vec3(New_UV-0.5,P.z+dir*(1.0-cosb)*Bevel*ScaleZ);Radial_Gradient=clamp((deltad-0.5)*2.0,0.0,1.0);Radial_Dir=vec3(delta*r2,0.0);vec3 beveledNormal=cosb*Normal_Object+sinb*vec3(delta.x,delta.y,0.0);New_Normal=Normal_Object.z==0.0 ? Normal_Object : beveledNormal;}\nvoid Object_To_World_Dir_B60(\nvec3 Dir_Object,\nout vec3 Normal_World,\nout vec3 Normal_World_N,\nout float Normal_Length)\n{Normal_World=(world*vec4(Dir_Object,0.0)).xyz;Normal_Length=length(Normal_World);Normal_World_N=Normal_World/Normal_Length;}\nvoid To_XYZ_B78(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{X=Vec3.x;Y=Vec3.y;Z=Vec3.z;}\nvoid Conditional_Float_B93(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{Result=Which ? If_True : If_False;}\nvoid Object_To_World_Dir_B28(\nvec3 Dir_Object,\nout vec3 Binormal_World,\nout vec3 Binormal_World_N,\nout float Binormal_Length)\n{Binormal_World=(world*vec4(Dir_Object,0.0)).xyz;Binormal_Length=length(Binormal_World);Binormal_World_N=Binormal_World/Binormal_Length;}\nvoid Pick_Radius_B69(\nfloat Radius,\nfloat Radius_Top_Left,\nfloat Radius_Top_Right,\nfloat Radius_Bottom_Left,\nfloat Radius_Bottom_Right,\nvec3 Position,\nout float Result)\n{bool whichY=Position.y>0.0;Result=Position.x<0.0 ? (whichY ? Radius_Top_Left : Radius_Bottom_Left) : (whichY ? Radius_Top_Right : Radius_Bottom_Right);Result*=Radius;}\nvoid Conditional_Float_B36(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{Result=Which ? If_True : If_False;}\nvoid Greater_Than_B37(\nfloat Left,\nfloat Right,\nout bool Not_Greater_Than,\nout bool Greater_Than)\n{Greater_Than=Left>Right;Not_Greater_Than=!Greater_Than;}\nvoid Remap_Range_B105(\nfloat In_Min,\nfloat In_Max,\nfloat Out_Min,\nfloat Out_Max,\nfloat In,\nout float Out)\n{Out=mix(Out_Min,Out_Max,clamp((In-In_Min)/(In_Max-In_Min),0.0,1.0));}\nvoid main()\n{vec2 XY_Q85;XY_Q85=(uv-vec2(0.5,0.5))*_Decal_Scale_XY_+vec2(0.5,0.5);vec3 Tangent_World_Q27;vec3 Tangent_World_N_Q27;float Tangent_Length_Q27;Tangent_World_Q27=(world*vec4(vec3(1,0,0),0.0)).xyz;Tangent_Length_Q27=length(Tangent_World_Q27);Tangent_World_N_Q27=Tangent_World_Q27/Tangent_Length_Q27;vec3 Normal_World_Q60;vec3 Normal_World_N_Q60;float Normal_Length_Q60;Object_To_World_Dir_B60(vec3(0,0,1),Normal_World_Q60,Normal_World_N_Q60,Normal_Length_Q60);float X_Q78;float Y_Q78;float Z_Q78;To_XYZ_B78(position,X_Q78,Y_Q78,Z_Q78);vec3 Nrm_World_Q26;Nrm_World_Q26=normalize((world*vec4(normal,0.0)).xyz);vec3 Binormal_World_Q28;vec3 Binormal_World_N_Q28;float Binormal_Length_Q28;Object_To_World_Dir_B28(vec3(0,1,0),Binormal_World_Q28,Binormal_World_N_Q28,Binormal_Length_Q28);float Anisotropy_Q29=Tangent_Length_Q27/Binormal_Length_Q28;float Result_Q69;Pick_Radius_B69(_Radius_,_Radius_Top_Left_,_Radius_Top_Right_,_Radius_Bottom_Left_,_Radius_Bottom_Right_,position,Result_Q69);float Anisotropy_Q53=Binormal_Length_Q28/Normal_Length_Q60;bool Not_Greater_Than_Q37;bool Greater_Than_Q37;Greater_Than_B37(Z_Q78,0.0,Not_Greater_Than_Q37,Greater_Than_Q37);vec4 Linear_Q101;Linear_Q101.rgb=clamp(_Left_Color_.rgb*_Left_Color_.rgb,0.0,1.0);Linear_Q101.a=_Left_Color_.a;vec4 Linear_Q102;Linear_Q102.rgb=clamp(_Right_Color_.rgb*_Right_Color_.rgb,0.0,1.0);Linear_Q102.a=_Right_Color_.a;vec3 Difference_Q61=vec3(0,0,0)-Normal_World_N_Q60;vec4 Out_Color_Q34=vec4(X_Q78,Y_Q78,Z_Q78,1);float Result_Q36;Conditional_Float_B36(Greater_Than_Q37,_Bevel_Back_,_Bevel_Front_,Result_Q36);float Result_Q94;Conditional_Float_B36(Greater_Than_Q37,_Bevel_Back_Stretch_,_Bevel_Front_Stretch_,Result_Q94);vec3 New_P_Q130;vec2 New_UV_Q130;float Radial_Gradient_Q130;vec3 Radial_Dir_Q130;vec3 New_Normal_Q130;Move_Verts_B130(Anisotropy_Q29,position,Result_Q69,Result_Q36,normal,Anisotropy_Q53,Result_Q94,New_P_Q130,New_UV_Q130,Radial_Gradient_Q130,Radial_Dir_Q130,New_Normal_Q130);float X_Q98;float Y_Q98;X_Q98=New_UV_Q130.x;Y_Q98=New_UV_Q130.y;vec3 Pos_World_Q12;Object_To_World_Pos_B12(New_P_Q130,Pos_World_Q12);vec3 Nrm_World_Q32;Object_To_World_Normal_B32(New_Normal_Q130,Nrm_World_Q32);vec4 Blob_Info_Q23;\n#if BLOB_ENABLE\nBlob_Vertex_B23(Pos_World_Q12,Nrm_World_Q26,Tangent_World_N_Q27,Binormal_World_N_Q28,_Blob_Position_,_Blob_Intensity_,_Blob_Near_Size_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_,_Blob_Fade_,Blob_Info_Q23);\n#else\nBlob_Info_Q23=vec4(0,0,0,0);\n#endif\nvec4 Blob_Info_Q24;\n#if BLOB_ENABLE_2\nBlob_Vertex_B24(Pos_World_Q12,Nrm_World_Q26,Tangent_World_N_Q27,Binormal_World_N_Q28,_Blob_Position_2_,_Blob_Intensity_,_Blob_Near_Size_2_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_2_,_Blob_Fade_2_,Blob_Info_Q24);\n#else\nBlob_Info_Q24=vec4(0,0,0,0);\n#endif\nfloat Out_Q105;Remap_Range_B105(0.0,1.0,0.0,1.0,X_Q98,Out_Q105);float X_Q86;float Y_Q86;float Z_Q86;To_XYZ_B78(Nrm_World_Q32,X_Q86,Y_Q86,Z_Q86);vec4 Color_At_T_Q97=mix(Linear_Q101,Linear_Q102,Out_Q105);float Minus_F_Q87=-Z_Q86;float R_Q99;float G_Q99;float B_Q99;float A_Q99;R_Q99=Color_At_T_Q97.r; G_Q99=Color_At_T_Q97.g; B_Q99=Color_At_T_Q97.b; A_Q99=Color_At_T_Q97.a;float ClampF_Q88=clamp(0.0,Minus_F_Q87,1.0);float Result_Q93;Conditional_Float_B93(_Decal_Front_Only_,ClampF_Q88,1.0,Result_Q93);vec4 Vec4_Q89=vec4(Result_Q93,Radial_Gradient_Q130,G_Q99,B_Q99);vec3 Position=Pos_World_Q12;vec3 Normal=Nrm_World_Q32;vec2 UV=XY_Q85;vec3 Tangent=Tangent_World_N_Q27;vec3 Binormal=Difference_Q61;vec4 Color=Out_Color_Q34;vec4 Extra1=Vec4_Q89;vec4 Extra2=Blob_Info_Q23;vec4 Extra3=Blob_Info_Q24;gl_Position=viewProjection*vec4(Position,1);vPosition=Position;vNormal=Normal;vUV=UV;vTangent=Tangent;vBinormal=Binormal;vColor=Color;vExtra1=Extra1;vExtra2=Extra2;vExtra3=Extra3;}";var Gt=function(t){function e(){var e=t.call(this)||this;return e.SKY_ENABLED=!0,e.BLOB_ENABLE_2=!0,e.IRIDESCENCE_ENABLED=!0,e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return n(e,t),e}(h.MaterialDefines),Ut=function(t){function e(i,o){var r=t.call(this,i,o)||this;return r.radius=.6,r.bevelFront=.6,r.bevelFrontStretch=.077,r.bevelBack=0,r.bevelBackStretch=0,r.radiusTopLeft=1,r.radiusTopRight=1,r.radiusBottomLeft=1,r.radiusBottomRight=1,r.bulgeEnabled=!1,r.bulgeHeight=-.323,r.bulgeRadius=.73,r.sunIntensity=1.102,r.sunTheta=.76,r.sunPhi=.526,r.indirectDiffuse=.658,r.albedo=new h.Color4(.0117647,.505882,.996078,1),r.specular=0,r.shininess=10,r.sharpness=0,r.subsurface=0,r.leftGradientColor=new h.Color4(.0117647,.505882,.996078,1),r.rightGradientColor=new h.Color4(.0117647,.505882,.996078,1),r.reflection=.749,r.frontReflect=0,r.edgeReflect=.09,r.power=8.13,r.skyColor=new h.Color4(.0117647,.964706,.996078,1),r.horizonColor=new h.Color4(.0117647,.333333,.996078,1),r.groundColor=new h.Color4(0,.254902,.996078,1),r.horizonPower=1,r.width=.02,r.fuzz=.5,r.minFuzz=.001,r.clipFade=.01,r.hueShift=0,r.saturationShift=0,r.valueShift=0,r.blobPosition=new h.Vector3(0,0,.1),r.blobIntensity=.5,r.blobNearSize=.01,r.blobFarSize=.03,r.blobNearDistance=0,r.blobFarDistance=.08,r.blobFadeLength=.576,r.blobPulse=0,r.blobFade=1,r.blobPosition2=new h.Vector3(.2,0,.1),r.blobNearSize2=.01,r.blobPulse2=0,r.blobFade2=1,r.blobTexture=new h.Texture("",r.getScene()),r.leftIndexPosition=new h.Vector3(0,0,1),r.rightIndexPosition=new h.Vector3(-1,-1,-1),r.leftIndexMiddlePosition=new h.Vector3(0,0,0),r.rightIndexMiddlePosition=new h.Vector3(0,0,0),r.decalScaleXY=new h.Vector2(1.5,1.5),r.decalFrontOnly=!0,r.rimIntensity=.287,r.rimHueShift=0,r.rimSaturationShift=0,r.rimValueShift=-1,r.iridescenceIntensity=0,r.useGlobalLeftIndex=1,r.useGlobalRightIndex=1,r.globalLeftIndexTipProximity=0,r.globalRightIndexTipProximity=0,r.globalLeftIndexTipPosition=new h.Vector4(.5,0,-.55,1),r.globaRightIndexTipPosition=new h.Vector4(0,0,0,1),r.globalLeftThumbTipPosition=new h.Vector4(.5,0,-.55,1),r.globalRightThumbTipPosition=new h.Vector4(0,0,0,1),r.globalLeftIndexMiddlePosition=new h.Vector4(.5,0,-.55,1),r.globalRightIndexMiddlePosition=new h.Vector4(0,0,0,1),r.alphaMode=h.Constants.ALPHA_DISABLE,r.backFaceCulling=!1,r._blueGradientTexture=new h.Texture(e.BLUE_GRADIENT_TEXTURE_URL,r.getScene(),!0,!1,h.Texture.NEAREST_SAMPLINGMODE),r._decalTexture=new h.Texture("",r.getScene()),r._reflectionMapTexture=new h.Texture("",r.getScene()),r._indirectEnvTexture=new h.Texture("",r.getScene()),r}return n(e,t),e.prototype.needAlphaBlending=function(){return!1},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){var i=e._drawWrapper;if(this.isFrozen&&i.effect&&i._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new Gt);var o=e.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=r.getEngine();if((0,h.PrepareDefinesForAttributes)(t,o,!1,!1),o.isDirty){o.markAsProcessed(),r.resetCachedMaterial();var a=new h.EffectFallbacks;o.FOG&&a.addFallback(1,"FOG"),(0,h.HandleFallbacksForShadows)(o,a),o.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess;var s=[h.VertexBuffer.PositionKind];o.NORMAL&&s.push(h.VertexBuffer.NormalKind),o.UV1&&s.push(h.VertexBuffer.UVKind),o.UV2&&s.push(h.VertexBuffer.UV2Kind),o.VERTEXCOLOR&&s.push(h.VertexBuffer.ColorKind),o.TANGENT&&s.push(h.VertexBuffer.TangentKind),(0,h.PrepareAttributesForInstances)(s,o);var l=o.toString(),_=["world","viewProjection","cameraPosition","_Radius_","_Bevel_Front_","_Bevel_Front_Stretch_","_Bevel_Back_","_Bevel_Back_Stretch_","_Radius_Top_Left_","_Radius_Top_Right_","_Radius_Bottom_Left_","_Radius_Bottom_Right_","_Bulge_Enabled_","_Bulge_Height_","_Bulge_Radius_","_Sun_Intensity_","_Sun_Theta_","_Sun_Phi_","_Indirect_Diffuse_","_Albedo_","_Specular_","_Shininess_","_Sharpness_","_Subsurface_","_Left_Color_","_Right_Color_","_Reflection_","_Front_Reflect_","_Edge_Reflect_","_Power_","_Sky_Color_","_Horizon_Color_","_Ground_Color_","_Horizon_Power_","_Reflection_Map_","_Indirect_Environment_","_Width_","_Fuzz_","_Min_Fuzz_","_Clip_Fade_","_Hue_Shift_","_Saturation_Shift_","_Value_Shift_","_Blob_Position_","_Blob_Intensity_","_Blob_Near_Size_","_Blob_Far_Size_","_Blob_Near_Distance_","_Blob_Far_Distance_","_Blob_Fade_Length_","_Blob_Pulse_","_Blob_Fade_","_Blob_Texture_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Left_Index_Pos_","_Right_Index_Pos_","_Left_Index_Middle_Pos_","_Right_Index_Middle_Pos_","_Decal_","_Decal_Scale_XY_","_Decal_Front_Only_","_Rim_Intensity_","_Rim_Texture_","_Rim_Hue_Shift_","_Rim_Saturation_Shift_","_Rim_Value_Shift_","_Iridescence_Intensity_","_Iridescence_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_Middle_Position;","Global_Right_Index_Middle_Position","Global_Left_Index_Tip_Proximity","Global_Right_Index_Tip_Proximity"],c=["_Rim_Texture_","_Iridescence_Texture_"],u=[];(0,h.PrepareUniformsAndSamplersList)({uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:o,maxSimultaneousLights:4}),e.setEffect(r.getEngine().createEffect("mrdlSliderBar",{attributes:s,uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:l,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),o,this._materialContext)}return!(!e.effect||!e.effect.isReady()||(o._renderId=r.getRenderId(),i._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){if(i.materialDefines){var o=i.effect;o&&(this._activeEffect=o,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",this.getScene().activeCamera.position),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Bevel_Front_",this.bevelFront),this._activeEffect.setFloat("_Bevel_Front_Stretch_",this.bevelFrontStretch),this._activeEffect.setFloat("_Bevel_Back_",this.bevelBack),this._activeEffect.setFloat("_Bevel_Back_Stretch_",this.bevelBackStretch),this._activeEffect.setFloat("_Radius_Top_Left_",this.radiusTopLeft),this._activeEffect.setFloat("_Radius_Top_Right_",this.radiusTopRight),this._activeEffect.setFloat("_Radius_Bottom_Left_",this.radiusBottomLeft),this._activeEffect.setFloat("_Radius_Bottom_Right_",this.radiusBottomRight),this._activeEffect.setFloat("_Bulge_Enabled_",this.bulgeEnabled?1:0),this._activeEffect.setFloat("_Bulge_Height_",this.bulgeHeight),this._activeEffect.setFloat("_Bulge_Radius_",this.bulgeRadius),this._activeEffect.setFloat("_Sun_Intensity_",this.sunIntensity),this._activeEffect.setFloat("_Sun_Theta_",this.sunTheta),this._activeEffect.setFloat("_Sun_Phi_",this.sunPhi),this._activeEffect.setFloat("_Indirect_Diffuse_",this.indirectDiffuse),this._activeEffect.setDirectColor4("_Albedo_",this.albedo),this._activeEffect.setFloat("_Specular_",this.specular),this._activeEffect.setFloat("_Shininess_",this.shininess),this._activeEffect.setFloat("_Sharpness_",this.sharpness),this._activeEffect.setFloat("_Subsurface_",this.subsurface),this._activeEffect.setDirectColor4("_Left_Color_",this.leftGradientColor),this._activeEffect.setDirectColor4("_Right_Color_",this.rightGradientColor),this._activeEffect.setFloat("_Reflection_",this.reflection),this._activeEffect.setFloat("_Front_Reflect_",this.frontReflect),this._activeEffect.setFloat("_Edge_Reflect_",this.edgeReflect),this._activeEffect.setFloat("_Power_",this.power),this._activeEffect.setDirectColor4("_Sky_Color_",this.skyColor),this._activeEffect.setDirectColor4("_Horizon_Color_",this.horizonColor),this._activeEffect.setDirectColor4("_Ground_Color_",this.groundColor),this._activeEffect.setFloat("_Horizon_Power_",this.horizonPower),this._activeEffect.setTexture("_Reflection_Map_",this._reflectionMapTexture),this._activeEffect.setTexture("_Indirect_Environment_",this._indirectEnvTexture),this._activeEffect.setFloat("_Width_",this.width),this._activeEffect.setFloat("_Fuzz_",this.fuzz),this._activeEffect.setFloat("_Min_Fuzz_",this.minFuzz),this._activeEffect.setFloat("_Clip_Fade_",this.clipFade),this._activeEffect.setFloat("_Hue_Shift_",this.hueShift),this._activeEffect.setFloat("_Saturation_Shift_",this.saturationShift),this._activeEffect.setFloat("_Value_Shift_",this.valueShift),this._activeEffect.setVector3("_Blob_Position_",this.blobPosition),this._activeEffect.setFloat("_Blob_Intensity_",this.blobIntensity),this._activeEffect.setFloat("_Blob_Near_Size_",this.blobNearSize),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_Pulse_",this.blobPulse),this._activeEffect.setFloat("_Blob_Fade_",this.blobFade),this._activeEffect.setTexture("_Blob_Texture_",this.blobTexture),this._activeEffect.setVector3("_Blob_Position_2_",this.blobPosition2),this._activeEffect.setFloat("_Blob_Near_Size_2_",this.blobNearSize2),this._activeEffect.setFloat("_Blob_Pulse_2_",this.blobPulse2),this._activeEffect.setFloat("_Blob_Fade_2_",this.blobFade2),this._activeEffect.setVector3("_Left_Index_Pos_",this.leftIndexPosition),this._activeEffect.setVector3("_Right_Index_Pos_",this.rightIndexPosition),this._activeEffect.setVector3("_Left_Index_Middle_Pos_",this.leftIndexMiddlePosition),this._activeEffect.setVector3("_Right_Index_Middle_Pos_",this.rightIndexMiddlePosition),this._activeEffect.setTexture("_Decal_",this._decalTexture),this._activeEffect.setVector2("_Decal_Scale_XY_",this.decalScaleXY),this._activeEffect.setFloat("_Decal_Front_Only_",this.decalFrontOnly?1:0),this._activeEffect.setFloat("_Rim_Intensity_",this.rimIntensity),this._activeEffect.setTexture("_Rim_Texture_",this._blueGradientTexture),this._activeEffect.setFloat("_Rim_Hue_Shift_",this.rimHueShift),this._activeEffect.setFloat("_Rim_Saturation_Shift_",this.rimSaturationShift),this._activeEffect.setFloat("_Rim_Value_Shift_",this.rimValueShift),this._activeEffect.setFloat("_Iridescence_Intensity_",this.iridescenceIntensity),this._activeEffect.setTexture("_Iridescence_Texture_",this._blueGradientTexture),this._activeEffect.setFloat("Use_Global_Left_Index",this.useGlobalLeftIndex),this._activeEffect.setFloat("Use_Global_Right_Index",this.useGlobalRightIndex),this._activeEffect.setVector4("Global_Left_Index_Tip_Position",this.globalLeftIndexTipPosition),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",this.globaRightIndexTipPosition),this._activeEffect.setVector4("Global_Left_Thumb_Tip_Position",this.globalLeftThumbTipPosition),this._activeEffect.setVector4("Global_Right_Thumb_Tip_Position",this.globalRightThumbTipPosition),this._activeEffect.setVector4("Global_Left_Index_Middle_Position",this.globalLeftIndexMiddlePosition),this._activeEffect.setVector4("Global_Right_Index_Middle_Position",this.globalRightIndexMiddlePosition),this._activeEffect.setFloat("Global_Left_Index_Tip_Proximity",this.globalLeftIndexTipProximity),this._activeEffect.setFloat("Global_Right_Index_Tip_Proximity",this.globalRightIndexTipProximity),this._afterBind(e,this._activeEffect,i))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),this._reflectionMapTexture.dispose(),this._indirectEnvTexture.dispose(),this._blueGradientTexture.dispose(),this._decalTexture.dispose()},e.prototype.clone=function(t){var i=this;return h.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.MRDLSliderBarMaterial",e},e.prototype.getClassName=function(){return"MRDLSliderBarMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.BLUE_GRADIENT_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/MRDL/mrtk-mrdl-blue-gradient.png",s([(0,h.serialize)()],e.prototype,"radius",void 0),s([(0,h.serialize)()],e.prototype,"bevelFront",void 0),s([(0,h.serialize)()],e.prototype,"bevelFrontStretch",void 0),s([(0,h.serialize)()],e.prototype,"bevelBack",void 0),s([(0,h.serialize)()],e.prototype,"bevelBackStretch",void 0),s([(0,h.serialize)()],e.prototype,"radiusTopLeft",void 0),s([(0,h.serialize)()],e.prototype,"radiusTopRight",void 0),s([(0,h.serialize)()],e.prototype,"radiusBottomLeft",void 0),s([(0,h.serialize)()],e.prototype,"radiusBottomRight",void 0),s([(0,h.serialize)()],e.prototype,"bulgeEnabled",void 0),s([(0,h.serialize)()],e.prototype,"bulgeHeight",void 0),s([(0,h.serialize)()],e.prototype,"bulgeRadius",void 0),s([(0,h.serialize)()],e.prototype,"sunIntensity",void 0),s([(0,h.serialize)()],e.prototype,"sunTheta",void 0),s([(0,h.serialize)()],e.prototype,"sunPhi",void 0),s([(0,h.serialize)()],e.prototype,"indirectDiffuse",void 0),s([(0,h.serialize)()],e.prototype,"albedo",void 0),s([(0,h.serialize)()],e.prototype,"specular",void 0),s([(0,h.serialize)()],e.prototype,"shininess",void 0),s([(0,h.serialize)()],e.prototype,"sharpness",void 0),s([(0,h.serialize)()],e.prototype,"subsurface",void 0),s([(0,h.serialize)()],e.prototype,"leftGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"rightGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"reflection",void 0),s([(0,h.serialize)()],e.prototype,"frontReflect",void 0),s([(0,h.serialize)()],e.prototype,"edgeReflect",void 0),s([(0,h.serialize)()],e.prototype,"power",void 0),s([(0,h.serialize)()],e.prototype,"skyColor",void 0),s([(0,h.serialize)()],e.prototype,"horizonColor",void 0),s([(0,h.serialize)()],e.prototype,"groundColor",void 0),s([(0,h.serialize)()],e.prototype,"horizonPower",void 0),s([(0,h.serialize)()],e.prototype,"width",void 0),s([(0,h.serialize)()],e.prototype,"fuzz",void 0),s([(0,h.serialize)()],e.prototype,"minFuzz",void 0),s([(0,h.serialize)()],e.prototype,"clipFade",void 0),s([(0,h.serialize)()],e.prototype,"hueShift",void 0),s([(0,h.serialize)()],e.prototype,"saturationShift",void 0),s([(0,h.serialize)()],e.prototype,"valueShift",void 0),s([(0,h.serialize)()],e.prototype,"blobPosition",void 0),s([(0,h.serialize)()],e.prototype,"blobIntensity",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize",void 0),s([(0,h.serialize)()],e.prototype,"blobFarSize",void 0),s([(0,h.serialize)()],e.prototype,"blobNearDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFarDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFadeLength",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse",void 0),s([(0,h.serialize)()],e.prototype,"blobFade",void 0),s([(0,h.serialize)()],e.prototype,"blobPosition2",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize2",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse2",void 0),s([(0,h.serialize)()],e.prototype,"blobFade2",void 0),s([(0,h.serialize)()],e.prototype,"blobTexture",void 0),s([(0,h.serialize)()],e.prototype,"leftIndexPosition",void 0),s([(0,h.serialize)()],e.prototype,"rightIndexPosition",void 0),s([(0,h.serialize)()],e.prototype,"leftIndexMiddlePosition",void 0),s([(0,h.serialize)()],e.prototype,"rightIndexMiddlePosition",void 0),s([(0,h.serialize)()],e.prototype,"decalScaleXY",void 0),s([(0,h.serialize)()],e.prototype,"decalFrontOnly",void 0),s([(0,h.serialize)()],e.prototype,"rimIntensity",void 0),s([(0,h.serialize)()],e.prototype,"rimHueShift",void 0),s([(0,h.serialize)()],e.prototype,"rimSaturationShift",void 0),s([(0,h.serialize)()],e.prototype,"rimValueShift",void 0),s([(0,h.serialize)()],e.prototype,"iridescenceIntensity",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.MRDLSliderBarMaterial",Ut);h.ShaderStore.ShadersStore.mrdlSliderThumbPixelShader="uniform vec3 cameraPosition;varying vec3 vPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec3 vBinormal;varying vec4 vColor;varying vec4 vExtra1;varying vec4 vExtra2;varying vec4 vExtra3;uniform float _Radius_;uniform float _Bevel_Front_;uniform float _Bevel_Front_Stretch_;uniform float _Bevel_Back_;uniform float _Bevel_Back_Stretch_;uniform float _Radius_Top_Left_;uniform float _Radius_Top_Right_;uniform float _Radius_Bottom_Left_;uniform float _Radius_Bottom_Right_;uniform bool _Bulge_Enabled_;uniform float _Bulge_Height_;uniform float _Bulge_Radius_;uniform float _Sun_Intensity_;uniform float _Sun_Theta_;uniform float _Sun_Phi_;uniform float _Indirect_Diffuse_;uniform vec4 _Albedo_;uniform float _Specular_;uniform float _Shininess_;uniform float _Sharpness_;uniform float _Subsurface_;uniform vec4 _Left_Color_;uniform vec4 _Right_Color_;uniform float _Reflection_;uniform float _Front_Reflect_;uniform float _Edge_Reflect_;uniform float _Power_;uniform vec4 _Sky_Color_;uniform vec4 _Horizon_Color_;uniform vec4 _Ground_Color_;uniform float _Horizon_Power_;uniform sampler2D _Reflection_Map_;uniform sampler2D _Indirect_Environment_;uniform float _Width_;uniform float _Fuzz_;uniform float _Min_Fuzz_;uniform float _Clip_Fade_;uniform float _Hue_Shift_;uniform float _Saturation_Shift_;uniform float _Value_Shift_;uniform vec3 _Blob_Position_;uniform float _Blob_Intensity_;uniform float _Blob_Near_Size_;uniform float _Blob_Far_Size_;uniform float _Blob_Near_Distance_;uniform float _Blob_Far_Distance_;uniform float _Blob_Fade_Length_;uniform float _Blob_Pulse_;uniform float _Blob_Fade_;uniform sampler2D _Blob_Texture_;uniform vec3 _Blob_Position_2_;uniform float _Blob_Near_Size_2_;uniform float _Blob_Pulse_2_;uniform float _Blob_Fade_2_;uniform vec3 _Left_Index_Pos_;uniform vec3 _Right_Index_Pos_;uniform vec3 _Left_Index_Middle_Pos_;uniform vec3 _Right_Index_Middle_Pos_;uniform sampler2D _Decal_;uniform vec2 _Decal_Scale_XY_;uniform bool _Decal_Front_Only_;uniform float _Rim_Intensity_;uniform sampler2D _Rim_Texture_;uniform float _Rim_Hue_Shift_;uniform float _Rim_Saturation_Shift_;uniform float _Rim_Value_Shift_;uniform float _Iridescence_Intensity_;uniform sampler2D _Iridescence_Texture_;uniform bool Use_Global_Left_Index;uniform bool Use_Global_Right_Index;uniform vec4 Global_Left_Index_Tip_Position;uniform vec4 Global_Right_Index_Tip_Position;uniform vec4 Global_Left_Thumb_Tip_Position;uniform vec4 Global_Right_Thumb_Tip_Position;uniform vec4 Global_Left_Index_Middle_Position;uniform vec4 Global_Right_Index_Middle_Position;uniform float Global_Left_Index_Tip_Proximity;uniform float Global_Right_Index_Tip_Proximity;void Blob_Fragment_B180(\nsampler2D Blob_Texture,\nvec4 Blob_Info1,\nvec4 Blob_Info2,\nout vec4 Blob_Color)\n{float k1=dot(Blob_Info1.xy,Blob_Info1.xy);float k2=dot(Blob_Info2.xy,Blob_Info2.xy);vec3 closer=k1<k2 ? vec3(k1,Blob_Info1.z,Blob_Info1.w) : vec3(k2,Blob_Info2.z,Blob_Info2.w);Blob_Color=closer.z*texture(Blob_Texture,vec2(vec2(sqrt(closer.x),closer.y).x,1.0-vec2(sqrt(closer.x),closer.y).y))*clamp(1.0-closer.x,0.0,1.0);}\nvoid FastLinearTosRGB_B192(\nvec4 Linear,\nout vec4 sRGB)\n{sRGB.rgb=sqrt(clamp(Linear.rgb,0.0,1.0));sRGB.a=Linear.a;}\nvoid Scale_RGB_B209(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{Result=vec4(Scalar,Scalar,Scalar,1)*Color;}\nvoid Fragment_Main_B271(\nfloat Sun_Intensity,\nfloat Sun_Theta,\nfloat Sun_Phi,\nvec3 Normal,\nvec4 Albedo,\nfloat Fresnel_Reflect,\nfloat Shininess,\nvec3 Incident,\nvec4 Horizon_Color,\nvec4 Sky_Color,\nvec4 Ground_Color,\nfloat Indirect_Diffuse,\nfloat Specular,\nfloat Horizon_Power,\nfloat Reflection,\nvec4 Reflection_Sample,\nvec4 Indirect_Sample,\nfloat Sharpness,\nfloat SSS,\nfloat Subsurface,\nvec4 Translucence,\nvec4 Rim_Light,\nvec4 Iridescence,\nout vec4 Result)\n{float theta=Sun_Theta*2.0*3.14159;float phi=Sun_Phi*3.14159;vec3 lightDir= vec3(cos(phi)*cos(theta),sin(phi),cos(phi)*sin(theta));float NdotL=max(dot(lightDir,Normal),0.0);vec3 R=reflect(Incident,Normal);float RdotL=max(0.0,dot(R,lightDir));float specular=pow(RdotL,Shininess);specular=mix(specular,smoothstep(0.495*Sharpness,1.0-0.495*Sharpness,specular),Sharpness);vec4 gi=mix(Ground_Color,Sky_Color,Normal.y*0.5+0.5);Result=((Sun_Intensity*NdotL+Indirect_Sample*Indirect_Diffuse+Translucence)*(1.0+SSS*Subsurface))*Albedo*(1.0-Fresnel_Reflect)+(Sun_Intensity*specular*Specular+Fresnel_Reflect*Reflection*Reflection_Sample)+Fresnel_Reflect*Rim_Light+Iridescence;}\nvoid Bulge_B229(\nbool Enabled,\nvec3 Normal,\nvec3 Tangent,\nfloat Bulge_Height,\nvec4 UV,\nfloat Bulge_Radius,\nvec3 ButtonN,\nout vec3 New_Normal)\n{vec2 xy=clamp(UV.xy*2.0,vec2(-1,-1),vec2(1,1));vec3 B=(cross(Normal,Tangent));float k=-clamp(1.0-length(xy)/Bulge_Radius,0.0,1.0)*Bulge_Height;k=sin(k*3.14159*0.5);k*=smoothstep(0.9998,0.9999,abs(dot(ButtonN,Normal)));New_Normal=Normal*sqrt(1.0-k*k)+(xy.x*Tangent+xy.y*B)*k;New_Normal=Enabled ? New_Normal : Normal;}\nvoid SSS_B227(\nvec3 ButtonN,\nvec3 Normal,\nvec3 Incident,\nout float Result)\n{float NdotI=abs(dot(Normal,Incident));float BdotI=abs(dot(ButtonN,Incident));Result=(abs(NdotI-BdotI)); }\nvoid FingerOcclusion_B217(\nfloat Width,\nfloat DistToCenter,\nfloat Fuzz,\nfloat Min_Fuzz,\nvec3 Position,\nvec3 Forward,\nvec3 Nearest,\nfloat Fade_Out,\nout float NotInShadow)\n{float d=dot((Nearest-Position),Forward);float sh=smoothstep(Width*0.5,Width*0.5+Fuzz*max(d,0.0)+Min_Fuzz,DistToCenter);NotInShadow=1.0-(1.0-sh)*smoothstep(-Fade_Out,0.0,d);}\nvoid FingerOcclusion_B218(\nfloat Width,\nfloat DistToCenter,\nfloat Fuzz,\nfloat Min_Fuzz,\nvec3 Position,\nvec3 Forward,\nvec3 Nearest,\nfloat Fade_Out,\nout float NotInShadow)\n{float d=dot((Nearest-Position),Forward);float sh=smoothstep(Width*0.5,Width*0.5+Fuzz*max(d,0.0)+Min_Fuzz,DistToCenter);NotInShadow=1.0-(1.0-sh)*smoothstep(-Fade_Out,0.0,d);}\nvoid Scale_Color_B241(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{Result=Scalar*Color;}\nvoid From_HSV_B223(\nfloat Hue,\nfloat Saturation,\nfloat Value,\nfloat Alpha,\nout vec4 Color)\n{vec4 K=vec4(1.0,2.0/3.0,1.0/3.0,3.0);vec3 p=abs(fract(vec3(Hue,Hue,Hue)+K.xyz)*6.0-K.www);Color.rgb=Value*mix(K.xxx,clamp(p-K.xxx,0.0,1.0),Saturation);Color.a=Alpha;}\nvoid Fast_Fresnel_B272(\nfloat Front_Reflect,\nfloat Edge_Reflect,\nfloat Power,\nvec3 Normal,\nvec3 Incident,\nout float Transmit,\nout float Reflect)\n{float d=max(-dot(Incident,Normal),0.0);Reflect=Front_Reflect+(Edge_Reflect-Front_Reflect)*pow(1.0-d,Power);Transmit=1.0-Reflect;}\nvoid Mapped_Environment_B201(\nsampler2D Reflected_Environment,\nsampler2D Indirect_Environment,\nvec3 Dir,\nout vec4 Reflected_Color,\nout vec4 Indirect_Diffuse)\n{Reflected_Color=texture(Reflected_Environment,vec2(atan(Dir.z,Dir.x)/3.14159*0.5,asin(Dir.y)/3.14159+0.5));Indirect_Diffuse=texture(Indirect_Environment,vec2(atan(Dir.z,Dir.x)/3.14159*0.5,asin(Dir.y)/3.14159+0.5));}\nvec4 SampleEnv_Bid200(vec3 D,vec4 S,vec4 H,vec4 G,float exponent)\n{float k=pow(abs(D.y),exponent);vec4 C;if (D.y>0.0) {C=mix(H,S,k);} else {C=mix(H,G,k); }\nreturn C;}\nvoid Sky_Environment_B200(\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{Reflected_Color=SampleEnv_Bid200(Reflected,Sky_Color,Horizon_Color,Ground_Color,Horizon_Power);Indirect_Color=mix(Ground_Color,Sky_Color,Normal.y*0.5+0.5);}\nvoid Min_Segment_Distance_B215(\nvec3 P0,\nvec3 P1,\nvec3 Q0,\nvec3 Q1,\nout vec3 NearP,\nout vec3 NearQ,\nout float Distance)\n{vec3 u=P1-P0;vec3 v=Q1-Q0;vec3 w=P0-Q0;float a=dot(u,u);float b=dot(u,v);float c=dot(v,v);float d=dot(u,w);float e=dot(v,w);float D=a*c-b*b;float sD=D;float tD=D;float sc,sN,tc,tN;if (D<0.00001) {sN=0.0;sD=1.0;tN=e;tD=c;} else {sN=(b*e-c*d);tN=(a*e-b*d);if (sN<0.0) {sN=0.0;tN=e;tD=c;} else if (sN>sD) {sN=sD;tN=e+b;tD=c;}}\nif (tN<0.0) {tN=0.0;if (-d<0.0) {sN=0.0;} else if (-d>a) {sN=sD;} else {sN=-d;sD=a;}} else if (tN>tD) {tN=tD;if ((-d+b)<0.0) {sN=0.0;} else if ((-d+b)>a) {sN=sD;} else {sN=(-d+b);sD=a;}}\nsc=abs(sN)<0.000001 ? 0.0 : sN/sD;tc=abs(tN)<0.000001 ? 0.0 : tN/tD;NearP=P0+sc*u;NearQ=Q0+tc*v;Distance=distance(NearP,NearQ);}\nvoid To_XYZ_B224(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{X=Vec3.x;Y=Vec3.y;Z=Vec3.z;}\nvoid Finger_Positions_B214(\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{Left_Index= (Use_Global_Left_Index ? Global_Left_Index_Tip_Position.xyz : Left_Index_Pos);Right_Index= (Use_Global_Right_Index ? Global_Right_Index_Tip_Position.xyz : Right_Index_Pos);Left_Index_Middle= (Use_Global_Left_Index ? Global_Left_Index_Middle_Position.xyz : Left_Index_Middle_Pos);Right_Index_Middle= (Use_Global_Right_Index ? Global_Right_Index_Middle_Position.xyz : Right_Index_Middle_Pos);}\nvoid VaryHSV_B258(\nvec3 HSV_In,\nfloat Hue_Shift,\nfloat Saturation_Shift,\nfloat Value_Shift,\nout vec3 HSV_Out)\n{HSV_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));}\nvoid Remap_Range_B264(\nfloat In_Min,\nfloat In_Max,\nfloat Out_Min,\nfloat Out_Max,\nfloat In,\nout float Out)\n{Out=mix(Out_Min,Out_Max,clamp((In-In_Min)/(In_Max-In_Min),0.0,1.0));}\nvoid To_HSV_B225(\nvec4 Color,\nout float Hue,\nout float Saturation,\nout float Value,\nout float Alpha,\nout vec3 HSV)\n{vec4 K=vec4(0.0,-1.0/3.0,2.0/3.0,-1.0);vec4 p=Color.g<Color.b ? vec4(Color.bg,K.wz) : vec4(Color.gb,K.xy);vec4 q=Color.r<p.x ? vec4(p.xyw,Color.r) : vec4(Color.r,p.yzx);float d=q.x-min(q.w,q.y);float e=1.0e-10;Hue=abs(q.z+(q.w-q.y)/(6.0*d+e));Saturation=d/(q.x+e);Value=q.x;Alpha=Color.a;HSV=vec3(Hue,Saturation,Value);}\nvoid Code_B260(\nfloat X,\nout float Result)\n{Result=(acos(X)/3.14159-0.5)*2.0;}\nvoid Rim_Light_B282(\nvec3 Front,\nvec3 Normal,\nvec3 Incident,\nfloat Rim_Intensity,\nsampler2D Texture,\nout vec4 Result)\n{vec3 R=reflect(Incident,Normal);float RdotF=dot(R,Front);float RdotL=sqrt(1.0-RdotF*RdotF);vec2 UV=vec2(R.y*0.5+0.5,0.5);vec4 Color=texture(Texture,UV);Result=Color;}\nvoid main()\n{vec4 Blob_Color_Q180;\n#if BLOB_ENABLE\nBlob_Fragment_B180(_Blob_Texture_,vExtra2,vExtra3,Blob_Color_Q180);\n#else\nBlob_Color_Q180=vec4(0,0,0,0);\n#endif\nvec3 Incident_Q189=normalize(vPosition-cameraPosition);vec3 Normalized_Q188=normalize(vNormal);vec3 Normalized_Q221=normalize(vTangent);vec4 Color_Q233;\n#if DECAL_ENABLE\nColor_Q233=texture(_Decal_,vUV);\n#else\nColor_Q233=vec4(0,0,0,0);\n#endif\nfloat X_Q240;float Y_Q240;float Z_Q240;float W_Q240;X_Q240=vExtra1.x;Y_Q240=vExtra1.y;Z_Q240=vExtra1.z;W_Q240=vExtra1.w;vec4 Linear_Q193;Linear_Q193.rgb=clamp(_Sky_Color_.rgb*_Sky_Color_.rgb,0.0,1.0);Linear_Q193.a=_Sky_Color_.a;vec4 Linear_Q194;Linear_Q194.rgb=clamp(_Horizon_Color_.rgb*_Horizon_Color_.rgb,0.0,1.0);Linear_Q194.a=_Horizon_Color_.a;vec4 Linear_Q195;Linear_Q195.rgb=clamp(_Ground_Color_.rgb*_Ground_Color_.rgb,0.0,1.0);Linear_Q195.a=_Ground_Color_.a;vec3 Left_Index_Q214;vec3 Right_Index_Q214;vec3 Left_Index_Middle_Q214;vec3 Right_Index_Middle_Q214;Finger_Positions_B214(_Left_Index_Pos_,_Right_Index_Pos_,_Left_Index_Middle_Pos_,_Right_Index_Middle_Pos_,Left_Index_Q214,Right_Index_Q214,Left_Index_Middle_Q214,Right_Index_Middle_Q214);vec4 Linear_Q196;Linear_Q196.rgb=clamp(_Albedo_.rgb*_Albedo_.rgb,0.0,1.0);Linear_Q196.a=_Albedo_.a;vec3 Normalized_Q257=normalize(vBinormal);vec3 Incident_Q220=normalize(vPosition-cameraPosition);vec3 New_Normal_Q229;Bulge_B229(_Bulge_Enabled_,Normalized_Q188,Normalized_Q221,_Bulge_Height_,vColor,_Bulge_Radius_,vBinormal,New_Normal_Q229);float Result_Q227;SSS_B227(vBinormal,New_Normal_Q229,Incident_Q189,Result_Q227);vec4 Result_Q241;Scale_Color_B241(Color_Q233,X_Q240,Result_Q241);float Transmit_Q272;float Reflect_Q272;Fast_Fresnel_B272(_Front_Reflect_,_Edge_Reflect_,_Power_,New_Normal_Q229,Incident_Q189,Transmit_Q272,Reflect_Q272);float Product_Q275=Y_Q240*Y_Q240;vec3 NearP_Q215;vec3 NearQ_Q215;float Distance_Q215;Min_Segment_Distance_B215(Left_Index_Q214,Left_Index_Middle_Q214,vPosition,cameraPosition,NearP_Q215,NearQ_Q215,Distance_Q215);vec3 NearP_Q213;vec3 NearQ_Q213;float Distance_Q213;Min_Segment_Distance_B215(Right_Index_Q214,Right_Index_Middle_Q214,vPosition,cameraPosition,NearP_Q213,NearQ_Q213,Distance_Q213);vec3 Reflected_Q197=reflect(Incident_Q189,New_Normal_Q229);vec4 Product_Q253=Linear_Q196*vec4(1,1,1,1);vec4 Result_Q282;Rim_Light_B282(Normalized_Q257,Normalized_Q188,Incident_Q220,_Rim_Intensity_,_Rim_Texture_,Result_Q282);float Dot_Q222=dot(Incident_Q220, Normalized_Q221);float MaxAB_Q273=max(Reflect_Q272,Product_Q275);float NotInShadow_Q217;\n#if OCCLUSION_ENABLED\nFingerOcclusion_B217(_Width_,Distance_Q215,_Fuzz_,_Min_Fuzz_,vPosition,vBinormal,NearP_Q215,_Clip_Fade_,NotInShadow_Q217);\n#else\nNotInShadow_Q217=1.0;\n#endif\nfloat NotInShadow_Q218;\n#if OCCLUSION_ENABLED\nFingerOcclusion_B218(_Width_,Distance_Q213,_Fuzz_,_Min_Fuzz_,vPosition,vBinormal,NearP_Q213,_Clip_Fade_,NotInShadow_Q218);\n#else\nNotInShadow_Q218=1.0;\n#endif\nvec4 Reflected_Color_Q201;vec4 Indirect_Diffuse_Q201;\n#if ENV_ENABLE\nMapped_Environment_B201(_Reflection_Map_,_Indirect_Environment_,Reflected_Q197,Reflected_Color_Q201,Indirect_Diffuse_Q201);\n#else\nReflected_Color_Q201=vec4(0,0,0,1);Indirect_Diffuse_Q201=vec4(0,0,0,1);\n#endif\nvec4 Reflected_Color_Q200;vec4 Indirect_Color_Q200;\n#if SKY_ENABLED\nSky_Environment_B200(New_Normal_Q229,Reflected_Q197,Linear_Q193,Linear_Q194,Linear_Q195,_Horizon_Power_,Reflected_Color_Q200,Indirect_Color_Q200);\n#else\nReflected_Color_Q200=vec4(0,0,0,1);Indirect_Color_Q200=vec4(0,0,0,1);\n#endif\nfloat Hue_Q225;float Saturation_Q225;float Value_Q225;float Alpha_Q225;vec3 HSV_Q225;To_HSV_B225(Product_Q253,Hue_Q225,Saturation_Q225,Value_Q225,Alpha_Q225,HSV_Q225);float Hue_Q277;float Saturation_Q277;float Value_Q277;float Alpha_Q277;vec3 HSV_Q277;To_HSV_B225(Result_Q282,Hue_Q277,Saturation_Q277,Value_Q277,Alpha_Q277,HSV_Q277);float Result_Q260;Code_B260(Dot_Q222,Result_Q260);float AbsA_Q226=abs(Result_Q260);float MinAB_Q208=min(NotInShadow_Q217,NotInShadow_Q218);vec4 Sum_Q198=Reflected_Color_Q201+Reflected_Color_Q200;vec4 Sum_Q199=Indirect_Diffuse_Q201+Indirect_Color_Q200;vec3 HSV_Out_Q276;VaryHSV_B258(HSV_Q277,_Rim_Hue_Shift_,_Rim_Saturation_Shift_,_Rim_Value_Shift_,HSV_Out_Q276);float Out_Q264;Remap_Range_B264(-1.0,1.0,0.0,1.0,Result_Q260,Out_Q264);float Product_Q256;Product_Q256=AbsA_Q226*_Hue_Shift_;float X_Q278;float Y_Q278;float Z_Q278;To_XYZ_B224(HSV_Out_Q276,X_Q278,Y_Q278,Z_Q278);vec2 Vec2_Q262=vec2(Out_Q264,0.5);vec3 HSV_Out_Q258;VaryHSV_B258(HSV_Q225,Product_Q256,_Saturation_Shift_,_Value_Shift_,HSV_Out_Q258);vec4 Color_Q279;From_HSV_B223(X_Q278,Y_Q278,Z_Q278,0.0,Color_Q279);vec4 Color_Q261;\n#if IRIDESCENCE_ENABLED\nColor_Q261=texture(_Iridescence_Texture_,Vec2_Q262);\n#else\nColor_Q261=vec4(0,0,0,0);\n#endif\nfloat X_Q224;float Y_Q224;float Z_Q224;To_XYZ_B224(HSV_Out_Q258,X_Q224,Y_Q224,Z_Q224);vec4 Result_Q281=_Rim_Intensity_*Color_Q279;vec4 Result_Q263=_Iridescence_Intensity_*Color_Q261;vec4 Color_Q223;From_HSV_B223(X_Q224,Y_Q224,Z_Q224,0.0,Color_Q223);vec4 Result_Q234=Result_Q241+(1.0-Result_Q241.a)*Color_Q223;vec4 Result_Q271;Fragment_Main_B271(_Sun_Intensity_,_Sun_Theta_,_Sun_Phi_,New_Normal_Q229,Result_Q234,MaxAB_Q273,_Shininess_,Incident_Q189,_Horizon_Color_,_Sky_Color_,_Ground_Color_,_Indirect_Diffuse_,_Specular_,_Horizon_Power_,_Reflection_,Sum_Q198,Sum_Q199,_Sharpness_,Result_Q227,_Subsurface_,vec4(0,0,0,0),Result_Q281,Result_Q263,Result_Q271);vec4 Result_Q209;Scale_RGB_B209(Result_Q271,MinAB_Q208,Result_Q209);vec4 sRGB_Q192;FastLinearTosRGB_B192(Result_Q209,sRGB_Q192);vec4 Result_Q181=Blob_Color_Q180+(1.0-Blob_Color_Q180.a)*sRGB_Q192;vec4 Result_Q190=Result_Q181; Result_Q190.a=1.0;vec4 Out_Color=Result_Q190;float Clip_Threshold=0.001;bool To_sRGB=false;gl_FragColor=Out_Color;}";h.ShaderStore.ShadersStore.mrdlSliderThumbVertexShader="uniform mat4 world;uniform mat4 viewProjection;uniform vec3 cameraPosition;attribute vec3 position;attribute vec3 normal;attribute vec2 uv;\n#ifdef TANGENT\nattribute vec3 tangent;\n#else\nconst vec3 tangent=vec3(0.);\n#endif\nuniform float _Radius_;uniform float _Bevel_Front_;uniform float _Bevel_Front_Stretch_;uniform float _Bevel_Back_;uniform float _Bevel_Back_Stretch_;uniform float _Radius_Top_Left_;uniform float _Radius_Top_Right_;uniform float _Radius_Bottom_Left_;uniform float _Radius_Bottom_Right_;uniform bool _Bulge_Enabled_;uniform float _Bulge_Height_;uniform float _Bulge_Radius_;uniform float _Sun_Intensity_;uniform float _Sun_Theta_;uniform float _Sun_Phi_;uniform float _Indirect_Diffuse_;uniform vec4 _Albedo_;uniform float _Specular_;uniform float _Shininess_;uniform float _Sharpness_;uniform float _Subsurface_;uniform vec4 _Left_Color_;uniform vec4 _Right_Color_;uniform float _Reflection_;uniform float _Front_Reflect_;uniform float _Edge_Reflect_;uniform float _Power_;uniform vec4 _Sky_Color_;uniform vec4 _Horizon_Color_;uniform vec4 _Ground_Color_;uniform float _Horizon_Power_;uniform sampler2D _Reflection_Map_;uniform sampler2D _Indirect_Environment_;uniform float _Width_;uniform float _Fuzz_;uniform float _Min_Fuzz_;uniform float _Clip_Fade_;uniform float _Hue_Shift_;uniform float _Saturation_Shift_;uniform float _Value_Shift_;uniform vec3 _Blob_Position_;uniform float _Blob_Intensity_;uniform float _Blob_Near_Size_;uniform float _Blob_Far_Size_;uniform float _Blob_Near_Distance_;uniform float _Blob_Far_Distance_;uniform float _Blob_Fade_Length_;uniform float _Blob_Pulse_;uniform float _Blob_Fade_;uniform sampler2D _Blob_Texture_;uniform vec3 _Blob_Position_2_;uniform float _Blob_Near_Size_2_;uniform float _Blob_Pulse_2_;uniform float _Blob_Fade_2_;uniform vec3 _Left_Index_Pos_;uniform vec3 _Right_Index_Pos_;uniform vec3 _Left_Index_Middle_Pos_;uniform vec3 _Right_Index_Middle_Pos_;uniform sampler2D _Decal_;uniform vec2 _Decal_Scale_XY_;uniform bool _Decal_Front_Only_;uniform float _Rim_Intensity_;uniform sampler2D _Rim_Texture_;uniform float _Rim_Hue_Shift_;uniform float _Rim_Saturation_Shift_;uniform float _Rim_Value_Shift_;uniform float _Iridescence_Intensity_;uniform sampler2D _Iridescence_Texture_;uniform bool Use_Global_Left_Index;uniform bool Use_Global_Right_Index;uniform vec4 Global_Left_Index_Tip_Position;uniform vec4 Global_Right_Index_Tip_Position;uniform vec4 Global_Left_Thumb_Tip_Position;uniform vec4 Global_Right_Thumb_Tip_Position;uniform float Global_Left_Index_Tip_Proximity;uniform float Global_Right_Index_Tip_Proximity;varying vec3 vPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec3 vBinormal;varying vec4 vColor;varying vec4 vExtra1;varying vec4 vExtra2;varying vec4 vExtra3;void Object_To_World_Pos_B162(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{Pos_World=(world*vec4(Pos_Object,1.0)).xyz;}\nvoid Object_To_World_Normal_B182(\nvec3 Nrm_Object,\nout vec3 Nrm_World)\n{Nrm_World=(vec4(Nrm_Object,0.0)).xyz;}\nvoid Blob_Vertex_B173(\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,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{vec3 blob= (Use_Global_Left_Index ? Global_Left_Index_Tip_Position.xyz : Blob_Position);vec3 delta=blob-Position;float dist=dot(Normal,delta);float lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);float fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);float size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;vec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);float Fade=fadeValue*Intensity*Blob_Fade;float Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);Blob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);}\nvoid Blob_Vertex_B174(\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,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{vec3 blob= (Use_Global_Right_Index ? Global_Right_Index_Tip_Position.xyz : Blob_Position);vec3 delta=blob-Position;float dist=dot(Normal,delta);float lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);float fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);float size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;vec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);float Fade=fadeValue*Intensity*Blob_Fade;float Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);Blob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);}\nvoid Move_Verts_B280(\nfloat Anisotropy,\nvec3 P,\nfloat Radius,\nfloat Bevel,\nvec3 Normal_Object,\nfloat ScaleZ,\nfloat Stretch,\nout vec3 New_P,\nout vec2 New_UV,\nout float Radial_Gradient,\nout vec3 Radial_Dir,\nout vec3 New_Normal)\n{vec2 UV=P.xy*2.0+0.5;vec2 center=clamp(UV,0.0,1.0);vec2 delta=UV-center;float deltad=(length(delta)*2.0);float f=(Bevel+(Radius-Bevel)*Stretch)/Radius;float innerd=clamp(deltad*2.0,0.0,1.0);float outerd=clamp(deltad*2.0-1.0,0.0,1.0);float bevelAngle=outerd*3.14159*0.5;float sinb=sin(bevelAngle);float cosb=cos(bevelAngle);float beveld=(1.0-f)*innerd+f*sinb;float br=outerd;vec2 r2=2.0*vec2(Radius/Anisotropy,Radius);float dir=P.z<0.0001 ? 1.0 : -1.0;New_UV=center+r2*((0.5-center)+normalize(delta+vec2(0.0,0.000001))*beveld*0.5);New_P=vec3(New_UV-0.5,P.z+dir*(1.0-cosb)*Bevel*ScaleZ);Radial_Gradient=clamp((deltad-0.5)*2.0,0.0,1.0);Radial_Dir=vec3(delta*r2,0.0);vec3 beveledNormal=cosb*Normal_Object+sinb*vec3(delta.x,delta.y,0.0);New_Normal=Normal_Object.z==0.0 ? Normal_Object : beveledNormal;}\nvoid Object_To_World_Dir_B210(\nvec3 Dir_Object,\nout vec3 Normal_World,\nout vec3 Normal_World_N,\nout float Normal_Length)\n{Normal_World=(world*vec4(Dir_Object,0.0)).xyz;Normal_Length=length(Normal_World);Normal_World_N=Normal_World/Normal_Length;}\nvoid To_XYZ_B228(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{X=Vec3.x;Y=Vec3.y;Z=Vec3.z;}\nvoid Conditional_Float_B243(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{Result=Which ? If_True : If_False;}\nvoid Object_To_World_Dir_B178(\nvec3 Dir_Object,\nout vec3 Binormal_World,\nout vec3 Binormal_World_N,\nout float Binormal_Length)\n{Binormal_World=(world*vec4(Dir_Object,0.0)).xyz;Binormal_Length=length(Binormal_World);Binormal_World_N=Binormal_World/Binormal_Length;}\nvoid Pick_Radius_B219(\nfloat Radius,\nfloat Radius_Top_Left,\nfloat Radius_Top_Right,\nfloat Radius_Bottom_Left,\nfloat Radius_Bottom_Right,\nvec3 Position,\nout float Result)\n{bool whichY=Position.y>0.0;Result=Position.x<0.0 ? (whichY ? Radius_Top_Left : Radius_Bottom_Left) : (whichY ? Radius_Top_Right : Radius_Bottom_Right);Result*=Radius;}\nvoid Conditional_Float_B186(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{Result=Which ? If_True : If_False;}\nvoid Greater_Than_B187(\nfloat Left,\nfloat Right,\nout bool Not_Greater_Than,\nout bool Greater_Than)\n{Greater_Than=Left>Right;Not_Greater_Than=!Greater_Than;}\nvoid Remap_Range_B255(\nfloat In_Min,\nfloat In_Max,\nfloat Out_Min,\nfloat Out_Max,\nfloat In,\nout float Out)\n{Out=mix(Out_Min,Out_Max,clamp((In-In_Min)/(In_Max-In_Min),0.0,1.0));}\nvoid main()\n{vec2 XY_Q235;XY_Q235=(uv-vec2(0.5,0.5))*_Decal_Scale_XY_+vec2(0.5,0.5);vec3 Tangent_World_Q177;vec3 Tangent_World_N_Q177;float Tangent_Length_Q177;Tangent_World_Q177=(world*vec4(vec3(1,0,0),0.0)).xyz;Tangent_Length_Q177=length(Tangent_World_Q177);Tangent_World_N_Q177=Tangent_World_Q177/Tangent_Length_Q177;vec3 Normal_World_Q210;vec3 Normal_World_N_Q210;float Normal_Length_Q210;Object_To_World_Dir_B210(vec3(0,0,1),Normal_World_Q210,Normal_World_N_Q210,Normal_Length_Q210);float X_Q228;float Y_Q228;float Z_Q228;To_XYZ_B228(position,X_Q228,Y_Q228,Z_Q228);vec3 Nrm_World_Q176;Nrm_World_Q176=normalize((world*vec4(normal,0.0)).xyz);vec3 Binormal_World_Q178;vec3 Binormal_World_N_Q178;float Binormal_Length_Q178;Object_To_World_Dir_B178(vec3(0,1,0),Binormal_World_Q178,Binormal_World_N_Q178,Binormal_Length_Q178);float Anisotropy_Q179=Tangent_Length_Q177/Binormal_Length_Q178;float Result_Q219;Pick_Radius_B219(_Radius_,_Radius_Top_Left_,_Radius_Top_Right_,_Radius_Bottom_Left_,_Radius_Bottom_Right_,position,Result_Q219);float Anisotropy_Q203=Binormal_Length_Q178/Normal_Length_Q210;bool Not_Greater_Than_Q187;bool Greater_Than_Q187;Greater_Than_B187(Z_Q228,0.0,Not_Greater_Than_Q187,Greater_Than_Q187);vec4 Linear_Q251;Linear_Q251.rgb=clamp(_Left_Color_.rgb*_Left_Color_.rgb,0.0,1.0);Linear_Q251.a=_Left_Color_.a;vec4 Linear_Q252;Linear_Q252.rgb=clamp(_Right_Color_.rgb*_Right_Color_.rgb,0.0,1.0);Linear_Q252.a=_Right_Color_.a;vec3 Difference_Q211=vec3(0,0,0)-Normal_World_N_Q210;vec4 Out_Color_Q184=vec4(X_Q228,Y_Q228,Z_Q228,1);float Result_Q186;Conditional_Float_B186(Greater_Than_Q187,_Bevel_Back_,_Bevel_Front_,Result_Q186);float Result_Q244;Conditional_Float_B186(Greater_Than_Q187,_Bevel_Back_Stretch_,_Bevel_Front_Stretch_,Result_Q244);vec3 New_P_Q280;vec2 New_UV_Q280;float Radial_Gradient_Q280;vec3 Radial_Dir_Q280;vec3 New_Normal_Q280;Move_Verts_B280(Anisotropy_Q179,position,Result_Q219,Result_Q186,normal,Anisotropy_Q203,Result_Q244,New_P_Q280,New_UV_Q280,Radial_Gradient_Q280,Radial_Dir_Q280,New_Normal_Q280);float X_Q248;float Y_Q248;X_Q248=New_UV_Q280.x;Y_Q248=New_UV_Q280.y;vec3 Pos_World_Q162;Object_To_World_Pos_B162(New_P_Q280,Pos_World_Q162);vec3 Nrm_World_Q182;Object_To_World_Normal_B182(New_Normal_Q280,Nrm_World_Q182);vec4 Blob_Info_Q173;\n#if BLOB_ENABLE\nBlob_Vertex_B173(Pos_World_Q162,Nrm_World_Q176,Tangent_World_N_Q177,Binormal_World_N_Q178,_Blob_Position_,_Blob_Intensity_,_Blob_Near_Size_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_,_Blob_Fade_,Blob_Info_Q173);\n#else\nBlob_Info_Q173=vec4(0,0,0,0);\n#endif\nvec4 Blob_Info_Q174;\n#if BLOB_ENABLE_2\nBlob_Vertex_B174(Pos_World_Q162,Nrm_World_Q176,Tangent_World_N_Q177,Binormal_World_N_Q178,_Blob_Position_2_,_Blob_Intensity_,_Blob_Near_Size_2_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_2_,_Blob_Fade_2_,Blob_Info_Q174);\n#else\nBlob_Info_Q174=vec4(0,0,0,0);\n#endif\nfloat Out_Q255;Remap_Range_B255(0.0,1.0,0.0,1.0,X_Q248,Out_Q255);float X_Q236;float Y_Q236;float Z_Q236;To_XYZ_B228(Nrm_World_Q182,X_Q236,Y_Q236,Z_Q236);vec4 Color_At_T_Q247=mix(Linear_Q251,Linear_Q252,Out_Q255);float Minus_F_Q237=-Z_Q236;float R_Q249;float G_Q249;float B_Q249;float A_Q249;R_Q249=Color_At_T_Q247.r; G_Q249=Color_At_T_Q247.g; B_Q249=Color_At_T_Q247.b; A_Q249=Color_At_T_Q247.a;float ClampF_Q238=clamp(0.0,Minus_F_Q237,1.0);float Result_Q243;Conditional_Float_B243(_Decal_Front_Only_,ClampF_Q238,1.0,Result_Q243);vec4 Vec4_Q239=vec4(Result_Q243,Radial_Gradient_Q280,G_Q249,B_Q249);vec3 Position=Pos_World_Q162;vec3 Normal=Nrm_World_Q182;vec2 UV=XY_Q235;vec3 Tangent=Tangent_World_N_Q177;vec3 Binormal=Difference_Q211;vec4 Color=Out_Color_Q184;vec4 Extra1=Vec4_Q239;vec4 Extra2=Blob_Info_Q173;vec4 Extra3=Blob_Info_Q174;gl_Position=viewProjection*vec4(Position,1);vPosition=Position;vNormal=Normal;vUV=UV;vTangent=Tangent;vBinormal=Binormal;vColor=Color;vExtra1=Extra1;vExtra2=Extra2;vExtra3=Extra3;}";var jt=function(t){function e(){var e=t.call(this)||this;return e.SKY_ENABLED=!0,e.BLOB_ENABLE_2=!0,e.IRIDESCENCE_ENABLED=!0,e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return n(e,t),e}(h.MaterialDefines),Yt=function(t){function e(i,o){var r=t.call(this,i,o)||this;return r.radius=.157,r.bevelFront=.065,r.bevelFrontStretch=.077,r.bevelBack=.031,r.bevelBackStretch=0,r.radiusTopLeft=1,r.radiusTopRight=1,r.radiusBottomLeft=1,r.radiusBottomRight=1,r.bulgeEnabled=!1,r.bulgeHeight=-.323,r.bulgeRadius=.73,r.sunIntensity=2,r.sunTheta=.937,r.sunPhi=.555,r.indirectDiffuse=1,r.albedo=new h.Color4(.0117647,.505882,.996078,1),r.specular=0,r.shininess=10,r.sharpness=0,r.subsurface=.31,r.leftGradientColor=new h.Color4(.0117647,.505882,.996078,1),r.rightGradientColor=new h.Color4(.0117647,.505882,.996078,1),r.reflection=.749,r.frontReflect=0,r.edgeReflect=.09,r.power=8.1,r.skyColor=new h.Color4(.0117647,.960784,.996078,1),r.horizonColor=new h.Color4(.0117647,.333333,.996078,1),r.groundColor=new h.Color4(0,.254902,.996078,1),r.horizonPower=1,r.width=.02,r.fuzz=.5,r.minFuzz=.001,r.clipFade=.01,r.hueShift=0,r.saturationShift=0,r.valueShift=0,r.blobPosition=new h.Vector3(0,0,.1),r.blobIntensity=.5,r.blobNearSize=.01,r.blobFarSize=.03,r.blobNearDistance=0,r.blobFarDistance=.08,r.blobFadeLength=.576,r.blobPulse=0,r.blobFade=1,r.blobPosition2=new h.Vector3(.2,0,.1),r.blobNearSize2=.01,r.blobPulse2=0,r.blobFade2=1,r.blobTexture=new h.Texture("",r.getScene()),r.leftIndexPosition=new h.Vector3(0,0,1),r.rightIndexPosition=new h.Vector3(-1,-1,-1),r.leftIndexMiddlePosition=new h.Vector3(0,0,0),r.rightIndexMiddlePosition=new h.Vector3(0,0,0),r.decalScaleXY=new h.Vector2(1.5,1.5),r.decalFrontOnly=!0,r.rimIntensity=.287,r.rimHueShift=0,r.rimSaturationShift=0,r.rimValueShift=-1,r.iridescenceIntensity=0,r.useGlobalLeftIndex=1,r.useGlobalRightIndex=1,r.globalLeftIndexTipProximity=0,r.globalRightIndexTipProximity=0,r.globalLeftIndexTipPosition=new h.Vector4(.5,0,-.55,1),r.globaRightIndexTipPosition=new h.Vector4(0,0,0,1),r.globalLeftThumbTipPosition=new h.Vector4(.5,0,-.55,1),r.globalRightThumbTipPosition=new h.Vector4(0,0,0,1),r.globalLeftIndexMiddlePosition=new h.Vector4(.5,0,-.55,1),r.globalRightIndexMiddlePosition=new h.Vector4(0,0,0,1),r.alphaMode=h.Constants.ALPHA_DISABLE,r.backFaceCulling=!1,r._blueGradientTexture=new h.Texture(e.BLUE_GRADIENT_TEXTURE_URL,o,!0,!1,h.Texture.NEAREST_SAMPLINGMODE),r._decalTexture=new h.Texture("",r.getScene()),r._reflectionMapTexture=new h.Texture("",r.getScene()),r._indirectEnvTexture=new h.Texture("",r.getScene()),r}return n(e,t),e.prototype.needAlphaBlending=function(){return!1},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){var i=e._drawWrapper;if(this.isFrozen&&i.effect&&i._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new jt);var o=e.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=r.getEngine();if((0,h.PrepareDefinesForAttributes)(t,o,!1,!1),o.isDirty){o.markAsProcessed(),r.resetCachedMaterial();var a=new h.EffectFallbacks;o.FOG&&a.addFallback(1,"FOG"),(0,h.HandleFallbacksForShadows)(o,a),o.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess;var s=[h.VertexBuffer.PositionKind];o.NORMAL&&s.push(h.VertexBuffer.NormalKind),o.UV1&&s.push(h.VertexBuffer.UVKind),o.UV2&&s.push(h.VertexBuffer.UV2Kind),o.VERTEXCOLOR&&s.push(h.VertexBuffer.ColorKind),o.TANGENT&&s.push(h.VertexBuffer.TangentKind),(0,h.PrepareAttributesForInstances)(s,o);var l=o.toString(),_=["world","viewProjection","cameraPosition","_Radius_","_Bevel_Front_","_Bevel_Front_Stretch_","_Bevel_Back_","_Bevel_Back_Stretch_","_Radius_Top_Left_","_Radius_Top_Right_","_Radius_Bottom_Left_","_Radius_Bottom_Right_","_Bulge_Enabled_","_Bulge_Height_","_Bulge_Radius_","_Sun_Intensity_","_Sun_Theta_","_Sun_Phi_","_Indirect_Diffuse_","_Albedo_","_Specular_","_Shininess_","_Sharpness_","_Subsurface_","_Left_Color_","_Right_Color_","_Reflection_","_Front_Reflect_","_Edge_Reflect_","_Power_","_Sky_Color_","_Horizon_Color_","_Ground_Color_","_Horizon_Power_","_Reflection_Map_","_Indirect_Environment_","_Width_","_Fuzz_","_Min_Fuzz_","_Clip_Fade_","_Hue_Shift_","_Saturation_Shift_","_Value_Shift_","_Blob_Position_","_Blob_Intensity_","_Blob_Near_Size_","_Blob_Far_Size_","_Blob_Near_Distance_","_Blob_Far_Distance_","_Blob_Fade_Length_","_Blob_Pulse_","_Blob_Fade_","_Blob_Texture_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Left_Index_Pos_","_Right_Index_Pos_","_Left_Index_Middle_Pos_","_Right_Index_Middle_Pos_","_Decal_","_Decal_Scale_XY_","_Decal_Front_Only_","_Rim_Intensity_","_Rim_Texture_","_Rim_Hue_Shift_","_Rim_Saturation_Shift_","_Rim_Value_Shift_","_Iridescence_Intensity_","_Iridescence_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_Middle_Position;","Global_Right_Index_Middle_Position","Global_Left_Index_Tip_Proximity","Global_Right_Index_Tip_Proximity"],c=["_Rim_Texture_","_Iridescence_Texture_"],u=[];(0,h.PrepareUniformsAndSamplersList)({uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:o,maxSimultaneousLights:4}),e.setEffect(r.getEngine().createEffect("mrdlSliderThumb",{attributes:s,uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:l,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),o)}return!(!e.effect||!e.effect.isReady()||(o._renderId=r.getRenderId(),i._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){if(i.materialDefines){var o=i.effect;o&&(this._activeEffect=o,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",this.getScene().activeCamera.position),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Bevel_Front_",this.bevelFront),this._activeEffect.setFloat("_Bevel_Front_Stretch_",this.bevelFrontStretch),this._activeEffect.setFloat("_Bevel_Back_",this.bevelBack),this._activeEffect.setFloat("_Bevel_Back_Stretch_",this.bevelBackStretch),this._activeEffect.setFloat("_Radius_Top_Left_",this.radiusTopLeft),this._activeEffect.setFloat("_Radius_Top_Right_",this.radiusTopRight),this._activeEffect.setFloat("_Radius_Bottom_Left_",this.radiusBottomLeft),this._activeEffect.setFloat("_Radius_Bottom_Right_",this.radiusBottomRight),this._activeEffect.setFloat("_Bulge_Enabled_",this.bulgeEnabled?1:0),this._activeEffect.setFloat("_Bulge_Height_",this.bulgeHeight),this._activeEffect.setFloat("_Bulge_Radius_",this.bulgeRadius),this._activeEffect.setFloat("_Sun_Intensity_",this.sunIntensity),this._activeEffect.setFloat("_Sun_Theta_",this.sunTheta),this._activeEffect.setFloat("_Sun_Phi_",this.sunPhi),this._activeEffect.setFloat("_Indirect_Diffuse_",this.indirectDiffuse),this._activeEffect.setDirectColor4("_Albedo_",this.albedo),this._activeEffect.setFloat("_Specular_",this.specular),this._activeEffect.setFloat("_Shininess_",this.shininess),this._activeEffect.setFloat("_Sharpness_",this.sharpness),this._activeEffect.setFloat("_Subsurface_",this.subsurface),this._activeEffect.setDirectColor4("_Left_Color_",this.leftGradientColor),this._activeEffect.setDirectColor4("_Right_Color_",this.rightGradientColor),this._activeEffect.setFloat("_Reflection_",this.reflection),this._activeEffect.setFloat("_Front_Reflect_",this.frontReflect),this._activeEffect.setFloat("_Edge_Reflect_",this.edgeReflect),this._activeEffect.setFloat("_Power_",this.power),this._activeEffect.setDirectColor4("_Sky_Color_",this.skyColor),this._activeEffect.setDirectColor4("_Horizon_Color_",this.horizonColor),this._activeEffect.setDirectColor4("_Ground_Color_",this.groundColor),this._activeEffect.setFloat("_Horizon_Power_",this.horizonPower),this._activeEffect.setTexture("_Reflection_Map_",this._reflectionMapTexture),this._activeEffect.setTexture("_Indirect_Environment_",this._indirectEnvTexture),this._activeEffect.setFloat("_Width_",this.width),this._activeEffect.setFloat("_Fuzz_",this.fuzz),this._activeEffect.setFloat("_Min_Fuzz_",this.minFuzz),this._activeEffect.setFloat("_Clip_Fade_",this.clipFade),this._activeEffect.setFloat("_Hue_Shift_",this.hueShift),this._activeEffect.setFloat("_Saturation_Shift_",this.saturationShift),this._activeEffect.setFloat("_Value_Shift_",this.valueShift),this._activeEffect.setVector3("_Blob_Position_",this.blobPosition),this._activeEffect.setFloat("_Blob_Intensity_",this.blobIntensity),this._activeEffect.setFloat("_Blob_Near_Size_",this.blobNearSize),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_Pulse_",this.blobPulse),this._activeEffect.setFloat("_Blob_Fade_",this.blobFade),this._activeEffect.setTexture("_Blob_Texture_",this.blobTexture),this._activeEffect.setVector3("_Blob_Position_2_",this.blobPosition2),this._activeEffect.setFloat("_Blob_Near_Size_2_",this.blobNearSize2),this._activeEffect.setFloat("_Blob_Pulse_2_",this.blobPulse2),this._activeEffect.setFloat("_Blob_Fade_2_",this.blobFade2),this._activeEffect.setVector3("_Left_Index_Pos_",this.leftIndexPosition),this._activeEffect.setVector3("_Right_Index_Pos_",this.rightIndexPosition),this._activeEffect.setVector3("_Left_Index_Middle_Pos_",this.leftIndexMiddlePosition),this._activeEffect.setVector3("_Right_Index_Middle_Pos_",this.rightIndexMiddlePosition),this._activeEffect.setTexture("_Decal_",this._decalTexture),this._activeEffect.setVector2("_Decal_Scale_XY_",this.decalScaleXY),this._activeEffect.setFloat("_Decal_Front_Only_",this.decalFrontOnly?1:0),this._activeEffect.setFloat("_Rim_Intensity_",this.rimIntensity),this._activeEffect.setTexture("_Rim_Texture_",this._blueGradientTexture),this._activeEffect.setFloat("_Rim_Hue_Shift_",this.rimHueShift),this._activeEffect.setFloat("_Rim_Saturation_Shift_",this.rimSaturationShift),this._activeEffect.setFloat("_Rim_Value_Shift_",this.rimValueShift),this._activeEffect.setFloat("_Iridescence_Intensity_",this.iridescenceIntensity),this._activeEffect.setTexture("_Iridescence_Texture_",this._blueGradientTexture),this._activeEffect.setFloat("Use_Global_Left_Index",this.useGlobalLeftIndex),this._activeEffect.setFloat("Use_Global_Right_Index",this.useGlobalRightIndex),this._activeEffect.setVector4("Global_Left_Index_Tip_Position",this.globalLeftIndexTipPosition),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",this.globaRightIndexTipPosition),this._activeEffect.setVector4("Global_Left_Thumb_Tip_Position",this.globalLeftThumbTipPosition),this._activeEffect.setVector4("Global_Right_Thumb_Tip_Position",this.globalRightThumbTipPosition),this._activeEffect.setVector4("Global_Left_Index_Middle_Position",this.globalLeftIndexMiddlePosition),this._activeEffect.setVector4("Global_Right_Index_Middle_Position",this.globalRightIndexMiddlePosition),this._activeEffect.setFloat("Global_Left_Index_Tip_Proximity",this.globalLeftIndexTipProximity),this._activeEffect.setFloat("Global_Right_Index_Tip_Proximity",this.globalRightIndexTipProximity),this._afterBind(e,this._activeEffect,i))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),this._reflectionMapTexture.dispose(),this._indirectEnvTexture.dispose(),this._blueGradientTexture.dispose(),this._decalTexture.dispose()},e.prototype.clone=function(t){var i=this;return h.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.MRDLSliderThumbMaterial",e},e.prototype.getClassName=function(){return"MRDLSliderThumbMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.BLUE_GRADIENT_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/MRDL/mrtk-mrdl-blue-gradient.png",s([(0,h.serialize)()],e.prototype,"radius",void 0),s([(0,h.serialize)()],e.prototype,"bevelFront",void 0),s([(0,h.serialize)()],e.prototype,"bevelFrontStretch",void 0),s([(0,h.serialize)()],e.prototype,"bevelBack",void 0),s([(0,h.serialize)()],e.prototype,"bevelBackStretch",void 0),s([(0,h.serialize)()],e.prototype,"radiusTopLeft",void 0),s([(0,h.serialize)()],e.prototype,"radiusTopRight",void 0),s([(0,h.serialize)()],e.prototype,"radiusBottomLeft",void 0),s([(0,h.serialize)()],e.prototype,"radiusBottomRight",void 0),s([(0,h.serialize)()],e.prototype,"bulgeEnabled",void 0),s([(0,h.serialize)()],e.prototype,"bulgeHeight",void 0),s([(0,h.serialize)()],e.prototype,"bulgeRadius",void 0),s([(0,h.serialize)()],e.prototype,"sunIntensity",void 0),s([(0,h.serialize)()],e.prototype,"sunTheta",void 0),s([(0,h.serialize)()],e.prototype,"sunPhi",void 0),s([(0,h.serialize)()],e.prototype,"indirectDiffuse",void 0),s([(0,h.serialize)()],e.prototype,"albedo",void 0),s([(0,h.serialize)()],e.prototype,"specular",void 0),s([(0,h.serialize)()],e.prototype,"shininess",void 0),s([(0,h.serialize)()],e.prototype,"sharpness",void 0),s([(0,h.serialize)()],e.prototype,"subsurface",void 0),s([(0,h.serialize)()],e.prototype,"leftGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"rightGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"reflection",void 0),s([(0,h.serialize)()],e.prototype,"frontReflect",void 0),s([(0,h.serialize)()],e.prototype,"edgeReflect",void 0),s([(0,h.serialize)()],e.prototype,"power",void 0),s([(0,h.serialize)()],e.prototype,"skyColor",void 0),s([(0,h.serialize)()],e.prototype,"horizonColor",void 0),s([(0,h.serialize)()],e.prototype,"groundColor",void 0),s([(0,h.serialize)()],e.prototype,"horizonPower",void 0),s([(0,h.serialize)()],e.prototype,"width",void 0),s([(0,h.serialize)()],e.prototype,"fuzz",void 0),s([(0,h.serialize)()],e.prototype,"minFuzz",void 0),s([(0,h.serialize)()],e.prototype,"clipFade",void 0),s([(0,h.serialize)()],e.prototype,"hueShift",void 0),s([(0,h.serialize)()],e.prototype,"saturationShift",void 0),s([(0,h.serialize)()],e.prototype,"valueShift",void 0),s([(0,h.serialize)()],e.prototype,"blobPosition",void 0),s([(0,h.serialize)()],e.prototype,"blobIntensity",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize",void 0),s([(0,h.serialize)()],e.prototype,"blobFarSize",void 0),s([(0,h.serialize)()],e.prototype,"blobNearDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFarDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFadeLength",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse",void 0),s([(0,h.serialize)()],e.prototype,"blobFade",void 0),s([(0,h.serialize)()],e.prototype,"blobPosition2",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize2",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse2",void 0),s([(0,h.serialize)()],e.prototype,"blobFade2",void 0),s([(0,h.serialize)()],e.prototype,"blobTexture",void 0),s([(0,h.serialize)()],e.prototype,"leftIndexPosition",void 0),s([(0,h.serialize)()],e.prototype,"rightIndexPosition",void 0),s([(0,h.serialize)()],e.prototype,"leftIndexMiddlePosition",void 0),s([(0,h.serialize)()],e.prototype,"rightIndexMiddlePosition",void 0),s([(0,h.serialize)()],e.prototype,"decalScaleXY",void 0),s([(0,h.serialize)()],e.prototype,"decalFrontOnly",void 0),s([(0,h.serialize)()],e.prototype,"rimIntensity",void 0),s([(0,h.serialize)()],e.prototype,"rimHueShift",void 0),s([(0,h.serialize)()],e.prototype,"rimSaturationShift",void 0),s([(0,h.serialize)()],e.prototype,"rimValueShift",void 0),s([(0,h.serialize)()],e.prototype,"iridescenceIntensity",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.MRDLSliderThumbMaterial",Yt);h.ShaderStore.ShadersStore.mrdlBackplatePixelShader="uniform vec3 cameraPosition;varying vec3 vPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec3 vBinormal;varying vec4 vExtra1;varying vec4 vExtra2;uniform float _Radius_;uniform float _Line_Width_;uniform bool _Absolute_Sizes_;uniform float _Filter_Width_;uniform vec4 _Base_Color_;uniform vec4 _Line_Color_;uniform float _Radius_Top_Left_;uniform float _Radius_Top_Right_;uniform float _Radius_Bottom_Left_;uniform float _Radius_Bottom_Right_;uniform float _Rate_;uniform vec4 _Highlight_Color_;uniform float _Highlight_Width_;uniform vec4 _Highlight_Transform_;uniform float _Highlight_;uniform float _Iridescence_Intensity_;uniform float _Iridescence_Edge_Intensity_;uniform vec4 _Iridescence_Tint_;uniform sampler2D _Iridescent_Map_;uniform float _Angle_;uniform bool _Reflected_;uniform float _Frequency_;uniform float _Vertical_Offset_;uniform vec4 _Gradient_Color_;uniform vec4 _Top_Left_;uniform vec4 _Top_Right_;uniform vec4 _Bottom_Left_;uniform vec4 _Bottom_Right_;uniform float _Edge_Width_;uniform float _Edge_Power_;uniform float _Line_Gradient_Blend_;uniform float _Fade_Out_;void FastLinearTosRGB_B353(\nvec4 Linear,\nout vec4 sRGB)\n{sRGB.rgb=sqrt(clamp(Linear.rgb,0.0,1.0));sRGB.a=Linear.a;}\nvoid Round_Rect_Fragment_B332(\nfloat Radius,\nfloat Line_Width,\nvec4 Line_Color,\nfloat Filter_Width,\nvec2 UV,\nfloat Line_Visibility,\nvec4 Rect_Parms,\nvec4 Fill_Color,\nout vec4 Color)\n{float d=length(max(abs(UV)-Rect_Parms.xy,0.0));float dx=max(fwidth(d)*Filter_Width,0.00001);float g=min(Rect_Parms.z,Rect_Parms.w);float dgrad=max(fwidth(g)*Filter_Width,0.00001);float Inside_Rect=clamp(g/dgrad,0.0,1.0);float inner=clamp((d+dx*0.5-max(Radius-Line_Width,d-dx*0.5))/dx,0.0,1.0);Color=clamp(mix(Fill_Color,Line_Color,inner),0.0,1.0)*Inside_Rect;}\nvoid Iridescence_B343(\nvec3 Position,\nvec3 Normal,\nvec2 UV,\nvec3 Axis,\nvec3 Eye,\nvec4 Tint,\nsampler2D Texture,\nbool Reflected,\nfloat Frequency,\nfloat Vertical_Offset,\nout vec4 Color)\n{vec3 i=normalize(Position-Eye);vec3 r=reflect(i,Normal);float idota=dot(i,Axis);float idotr=dot(i,r);float x=Reflected ? idotr : idota;vec2 xy;xy.x=fract((x*Frequency+1.0)*0.5+UV.y*Vertical_Offset);xy.y=0.5;Color=texture(Texture,xy);Color.rgb*=Tint.rgb;}\nvoid Scale_RGB_B346(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{Result=vec4(Scalar,Scalar,Scalar,1)*Color;}\nvoid Scale_RGB_B344(\nfloat Scalar,\nvec4 Color,\nout vec4 Result)\n{Result=vec4(Scalar,Scalar,Scalar,1)*Color;}\nvoid Line_Fragment_B362(\nvec4 Base_Color,\nvec4 Highlight_Color,\nfloat Highlight_Width,\nvec3 Line_Vertex,\nfloat Highlight,\nout vec4 Line_Color)\n{float k2=1.0-clamp(abs(Line_Vertex.y/Highlight_Width),0.0,1.0);Line_Color=mix(Base_Color,Highlight_Color,Highlight*k2);}\nvoid Edge_B356(\nvec4 RectParms,\nfloat Radius,\nfloat Line_Width,\nvec2 UV,\nfloat Edge_Width,\nfloat Edge_Power,\nout float Result)\n{float d=length(max(abs(UV)-RectParms.xy,0.0));float edge=1.0-clamp((1.0-d/(Radius-Line_Width))/Edge_Width,0.0,1.0);Result=pow(edge,Edge_Power);}\nvoid Gradient_B355(\nvec4 Gradient_Color,\nvec4 Top_Left,\nvec4 Top_Right,\nvec4 Bottom_Left,\nvec4 Bottom_Right,\nvec2 UV,\nout vec4 Result)\n{vec3 top=Top_Left.rgb+(Top_Right.rgb-Top_Left.rgb)*UV.x;vec3 bottom=Bottom_Left.rgb+(Bottom_Right.rgb-Bottom_Left.rgb)*UV.x;Result.rgb=Gradient_Color.rgb*(bottom+(top-bottom)*UV.y);Result.a=1.0;}\nvoid main()\n{float X_Q338;float Y_Q338;float Z_Q338;float W_Q338;X_Q338=vExtra2.x;Y_Q338=vExtra2.y;Z_Q338=vExtra2.z;W_Q338=vExtra2.w;vec4 Color_Q343;\n#if IRIDESCENCE_ENABLE\nIridescence_B343(vPosition,vNormal,vUV,vBinormal,cameraPosition,_Iridescence_Tint_,_Iridescent_Map_,_Reflected_,_Frequency_,_Vertical_Offset_,Color_Q343);\n#else\nColor_Q343=vec4(0,0,0,0);\n#endif\nvec4 Result_Q344;Scale_RGB_B344(_Iridescence_Intensity_,Color_Q343,Result_Q344);vec4 Line_Color_Q362;Line_Fragment_B362(_Line_Color_,_Highlight_Color_,_Highlight_Width_,vTangent,_Highlight_,Line_Color_Q362);float Result_Q356;\n#if EDGE_ONLY\nEdge_B356(vExtra1,Z_Q338,W_Q338,vUV,_Edge_Width_,_Edge_Power_,Result_Q356);\n#else\nResult_Q356=1.0;\n#endif\nvec2 Vec2_Q339=vec2(X_Q338,Y_Q338);vec4 Result_Q355;Gradient_B355(_Gradient_Color_,_Top_Left_,_Top_Right_,_Bottom_Left_,_Bottom_Right_,Vec2_Q339,Result_Q355);vec4 Linear_Q348;Linear_Q348.rgb=clamp(Result_Q355.rgb*Result_Q355.rgb,0.0,1.0);Linear_Q348.a=Result_Q355.a;vec4 Result_Q346;Scale_RGB_B346(Linear_Q348,Result_Q356,Result_Q346);vec4 Sum_Q345=Result_Q346+Result_Q344;vec4 Color_At_T_Q347=mix(Line_Color_Q362,Result_Q346,_Line_Gradient_Blend_);vec4 Base_And_Iridescent_Q350;Base_And_Iridescent_Q350=_Base_Color_+vec4(Sum_Q345.rgb,0.0);vec4 Sum_Q349=Color_At_T_Q347+_Iridescence_Edge_Intensity_*Color_Q343;vec4 Result_Q351=Sum_Q349; Result_Q351.a=1.0;vec4 Color_Q332;Round_Rect_Fragment_B332(Z_Q338,W_Q338,Result_Q351,_Filter_Width_,vUV,1.0,vExtra1,Base_And_Iridescent_Q350,Color_Q332);vec4 Result_Q354=_Fade_Out_*Color_Q332;vec4 sRGB_Q353;FastLinearTosRGB_B353(Result_Q354,sRGB_Q353);vec4 Out_Color=sRGB_Q353;float Clip_Threshold=0.001;bool To_sRGB=false;gl_FragColor=Out_Color;}";h.ShaderStore.ShadersStore.mrdlBackplateVertexShader="uniform mat4 world;uniform mat4 viewProjection;uniform vec3 cameraPosition;attribute vec3 position;attribute vec3 normal;attribute vec3 tangent;uniform float _Radius_;uniform float _Line_Width_;uniform bool _Absolute_Sizes_;uniform float _Filter_Width_;uniform vec4 _Base_Color_;uniform vec4 _Line_Color_;uniform float _Radius_Top_Left_;uniform float _Radius_Top_Right_;uniform float _Radius_Bottom_Left_;uniform float _Radius_Bottom_Right_;uniform float _Rate_;uniform vec4 _Highlight_Color_;uniform float _Highlight_Width_;uniform vec4 _Highlight_Transform_;uniform float _Highlight_;uniform float _Iridescence_Intensity_;uniform float _Iridescence_Edge_Intensity_;uniform vec4 _Iridescence_Tint_;uniform sampler2D _Iridescent_Map_;uniform float _Angle_;uniform bool _Reflected_;uniform float _Frequency_;uniform float _Vertical_Offset_;uniform vec4 _Gradient_Color_;uniform vec4 _Top_Left_;uniform vec4 _Top_Right_;uniform vec4 _Bottom_Left_;uniform vec4 _Bottom_Right_;uniform float _Edge_Width_;uniform float _Edge_Power_;uniform float _Line_Gradient_Blend_;uniform float _Fade_Out_;varying vec3 vPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec3 vBinormal;varying vec4 vExtra1;varying vec4 vExtra2;void Object_To_World_Pos_B314(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{Pos_World=(world*vec4(Pos_Object,1.0)).xyz;}\nvoid Round_Rect_Vertex_B357(\nvec2 UV,\nfloat Radius,\nfloat Margin,\nfloat Anisotropy,\nfloat Gradient1,\nfloat Gradient2,\nvec3 Normal,\nvec4 Color_Scale_Translate,\nout vec2 Rect_UV,\nout vec4 Rect_Parms,\nout vec2 Scale_XY,\nout vec2 Line_UV,\nout vec2 Color_UV_Info)\n{Scale_XY=vec2(Anisotropy,1.0);Line_UV=(UV-vec2(0.5,0.5));Rect_UV=Line_UV*Scale_XY;Rect_Parms.xy=Scale_XY*0.5-vec2(Radius,Radius)-vec2(Margin,Margin);Rect_Parms.z=Gradient1; \nRect_Parms.w=Gradient2;Color_UV_Info=(Line_UV+vec2(0.5,0.5))*Color_Scale_Translate.xy+Color_Scale_Translate.zw;}\nvoid Line_Vertex_B333(\nvec2 Scale_XY,\nvec2 UV,\nfloat Time,\nfloat Rate,\nvec4 Highlight_Transform,\nout vec3 Line_Vertex)\n{float angle2=(Rate*Time)*2.0*3.1416;float sinAngle2=sin(angle2);float cosAngle2=cos(angle2);vec2 xformUV=UV*Highlight_Transform.xy+Highlight_Transform.zw;Line_Vertex.x=0.0;Line_Vertex.y=cosAngle2*xformUV.x-sinAngle2*xformUV.y;Line_Vertex.z=0.0; }\nvoid PickDir_B334(\nfloat Degrees,\nvec3 DirX,\nvec3 DirY,\nout vec3 Dir)\n{float a=Degrees*3.14159/180.0;Dir=cos(a)*DirX+sin(a)*DirY;}\nvoid Move_Verts_B327(\nfloat Anisotropy,\nvec3 P,\nfloat Radius,\nout vec3 New_P,\nout vec2 New_UV,\nout float Radial_Gradient,\nout vec3 Radial_Dir)\n{vec2 UV=P.xy*2.0+0.5;vec2 center=clamp(UV,0.0,1.0);vec2 delta=UV-center;vec2 r2=2.0*vec2(Radius/Anisotropy,Radius);New_UV=center+r2*(UV-2.0*center+0.5);New_P=vec3(New_UV-0.5,P.z);Radial_Gradient=1.0-length(delta)*2.0;Radial_Dir=vec3(delta*r2,0.0);}\nvoid Pick_Radius_B336(\nfloat Radius,\nfloat Radius_Top_Left,\nfloat Radius_Top_Right,\nfloat Radius_Bottom_Left,\nfloat Radius_Bottom_Right,\nvec3 Position,\nout float Result)\n{bool whichY=Position.y>0.0;Result=Position.x<0.0 ? (whichY ? Radius_Top_Left : Radius_Bottom_Left) : (whichY ? Radius_Top_Right : Radius_Bottom_Right);Result*=Radius;}\nvoid Edge_AA_Vertex_B328(\nvec3 Position_World,\nvec3 Position_Object,\nvec3 Normal_Object,\nvec3 Eye,\nfloat Radial_Gradient,\nvec3 Radial_Dir,\nvec3 Tangent,\nout float Gradient1,\nout float Gradient2)\n{vec3 I=(Eye-Position_World);vec3 T=(vec4(Tangent,0.0)).xyz;float g=(dot(T,I)<0.0) ? 0.0 : 1.0;if (Normal_Object.z==0.0) { \nGradient1=Position_Object.z>0.0 ? g : 1.0;Gradient2=Position_Object.z>0.0 ? 1.0 : g;} else {Gradient1=g+(1.0-g)*(Radial_Gradient);Gradient2=1.0;}}\nvoid Object_To_World_Dir_B330(\nvec3 Dir_Object,\nout vec3 Binormal_World,\nout vec3 Binormal_World_N,\nout float Binormal_Length)\n{Binormal_World=(world*vec4(Dir_Object,0.0)).xyz;Binormal_Length=length(Binormal_World);Binormal_World_N=Binormal_World/Binormal_Length;}\nvoid RelativeOrAbsoluteDetail_B341(\nfloat Nominal_Radius,\nfloat Nominal_LineWidth,\nbool Absolute_Measurements,\nfloat Height,\nout float Radius,\nout float Line_Width)\n{float scale=Absolute_Measurements ? 1.0/Height : 1.0;Radius=Nominal_Radius*scale;Line_Width=Nominal_LineWidth*scale;}\nvoid main()\n{vec3 Nrm_World_Q326;Nrm_World_Q326=normalize((world*vec4(normal,0.0)).xyz);vec3 Tangent_World_Q329;vec3 Tangent_World_N_Q329;float Tangent_Length_Q329;Tangent_World_Q329=(world*vec4(vec3(1,0,0),0.0)).xyz;Tangent_Length_Q329=length(Tangent_World_Q329);Tangent_World_N_Q329=Tangent_World_Q329/Tangent_Length_Q329;vec3 Binormal_World_Q330;vec3 Binormal_World_N_Q330;float Binormal_Length_Q330;Object_To_World_Dir_B330(vec3(0,1,0),Binormal_World_Q330,Binormal_World_N_Q330,Binormal_Length_Q330);float Radius_Q341;float Line_Width_Q341;RelativeOrAbsoluteDetail_B341(_Radius_,_Line_Width_,_Absolute_Sizes_,Binormal_Length_Q330,Radius_Q341,Line_Width_Q341);vec3 Dir_Q334;PickDir_B334(_Angle_,Tangent_World_N_Q329,Binormal_World_N_Q330,Dir_Q334);float Result_Q336;Pick_Radius_B336(Radius_Q341,_Radius_Top_Left_,_Radius_Top_Right_,_Radius_Bottom_Left_,_Radius_Bottom_Right_,position,Result_Q336);float Anisotropy_Q331=Tangent_Length_Q329/Binormal_Length_Q330;vec4 Out_Color_Q337=vec4(Result_Q336,Line_Width_Q341,0,1);vec3 New_P_Q327;vec2 New_UV_Q327;float Radial_Gradient_Q327;vec3 Radial_Dir_Q327;Move_Verts_B327(Anisotropy_Q331,position,Result_Q336,New_P_Q327,New_UV_Q327,Radial_Gradient_Q327,Radial_Dir_Q327);vec3 Pos_World_Q314;Object_To_World_Pos_B314(New_P_Q327,Pos_World_Q314);float Gradient1_Q328;float Gradient2_Q328;\n#if SMOOTH_EDGES\nEdge_AA_Vertex_B328(Pos_World_Q314,position,normal,cameraPosition,Radial_Gradient_Q327,Radial_Dir_Q327,tangent,Gradient1_Q328,Gradient2_Q328);\n#else\nGradient1_Q328=1.0;Gradient2_Q328=1.0;\n#endif\nvec2 Rect_UV_Q357;vec4 Rect_Parms_Q357;vec2 Scale_XY_Q357;vec2 Line_UV_Q357;vec2 Color_UV_Info_Q357;Round_Rect_Vertex_B357(New_UV_Q327,Result_Q336,0.0,Anisotropy_Q331,Gradient1_Q328,Gradient2_Q328,normal,vec4(1,1,0,0),Rect_UV_Q357,Rect_Parms_Q357,Scale_XY_Q357,Line_UV_Q357,Color_UV_Info_Q357);vec3 Line_Vertex_Q333;Line_Vertex_B333(Scale_XY_Q357,Line_UV_Q357,(20.0),_Rate_,_Highlight_Transform_,Line_Vertex_Q333);float X_Q359;float Y_Q359;X_Q359=Color_UV_Info_Q357.x;Y_Q359=Color_UV_Info_Q357.y;vec4 Vec4_Q358=vec4(X_Q359,Y_Q359,Result_Q336,Line_Width_Q341);vec3 Position=Pos_World_Q314;vec3 Normal=Nrm_World_Q326;vec2 UV=Rect_UV_Q357;vec3 Tangent=Line_Vertex_Q333;vec3 Binormal=Dir_Q334;vec4 Color=Out_Color_Q337;vec4 Extra1=Rect_Parms_Q357;vec4 Extra2=Vec4_Q358;vec4 Extra3=vec4(0,0,0,0);gl_Position=viewProjection*vec4(Position,1);vPosition=Position;vNormal=Normal;vUV=UV;vTangent=Tangent;vBinormal=Binormal;vExtra1=Extra1;vExtra2=Extra2;}";var Xt=function(t){function e(){var e=t.call(this)||this;return e.IRIDESCENCE_ENABLE=!0,e.SMOOTH_EDGES=!0,e._needNormals=!0,e.rebuild(),e}return n(e,t),e}(h.MaterialDefines),Kt=function(t){function e(i,o){var r=t.call(this,i,o)||this;return r.radius=.3,r.lineWidth=.003,r.absoluteSizes=!1,r._filterWidth=1,r.baseColor=new h.Color4(0,0,0,1),r.lineColor=new h.Color4(.2,.262745,.4,1),r.radiusTopLeft=1,r.radiusTopRight=1,r.radiusBottomLeft=1,r.radiusBottomRight=1,r._rate=0,r.highlightColor=new h.Color4(.239216,.435294,.827451,1),r.highlightWidth=0,r._highlightTransform=new h.Vector4(1,1,0,0),r._highlight=1,r.iridescenceIntensity=.45,r.iridescenceEdgeIntensity=1,r.iridescenceTint=new h.Color4(1,1,1,1),r._angle=-45,r.fadeOut=1,r._reflected=!0,r._frequency=1,r._verticalOffset=0,r.gradientColor=new h.Color4(.74902,.74902,.74902,1),r.topLeftGradientColor=new h.Color4(.00784314,.294118,.580392,1),r.topRightGradientColor=new h.Color4(.305882,0,1,1),r.bottomLeftGradientColor=new h.Color4(.133333,.258824,.992157,1),r.bottomRightGradientColor=new h.Color4(.176471,.176471,.619608,1),r.edgeWidth=.5,r.edgePower=1,r.edgeLineGradientBlend=.5,r.alphaMode=h.Constants.ALPHA_DISABLE,r.backFaceCulling=!1,r._iridescentMapTexture=new h.Texture(e.IRIDESCENT_MAP_TEXTURE_URL,r.getScene(),!0,!1,h.Texture.NEAREST_SAMPLINGMODE),r}return n(e,t),e.prototype.needAlphaBlending=function(){return!1},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){var i=e._drawWrapper;if(this.isFrozen&&i.effect&&i._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new Xt);var o=e.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=r.getEngine();if((0,h.PrepareDefinesForAttributes)(t,o,!1,!1),o.isDirty){o.markAsProcessed(),r.resetCachedMaterial();var a=new h.EffectFallbacks;o.FOG&&a.addFallback(1,"FOG"),(0,h.HandleFallbacksForShadows)(o,a),o.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess;var s=[h.VertexBuffer.PositionKind];o.NORMAL&&s.push(h.VertexBuffer.NormalKind),o.UV1&&s.push(h.VertexBuffer.UVKind),o.UV2&&s.push(h.VertexBuffer.UV2Kind),o.VERTEXCOLOR&&s.push(h.VertexBuffer.ColorKind),o.TANGENT&&s.push(h.VertexBuffer.TangentKind),(0,h.PrepareAttributesForInstances)(s,o);var l=o.toString(),_=["world","viewProjection","cameraPosition","_Radius_","_Line_Width_","_Absolute_Sizes_","_Filter_Width_","_Base_Color_","_Line_Color_","_Radius_Top_Left_","_Radius_Top_Right_","_Radius_Bottom_Left_","_Radius_Bottom_Right_","_Rate_","_Highlight_Color_","_Highlight_Width_","_Highlight_Transform_","_Highlight_","_Iridescence_Intensity_","_Iridescence_Edge_Intensity_","_Iridescence_Tint_","_Iridescent_Map_","_Angle_","_Reflected_","_Frequency_","_Vertical_Offset_","_Gradient_Color_","_Top_Left_","_Top_Right_","_Bottom_Left_","_Bottom_Right_","_Edge_Width_","_Edge_Power_","_Line_Gradient_Blend_","_Fade_Out_"],c=["_Iridescent_Map_"],u=[];(0,h.PrepareUniformsAndSamplersList)({uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:o,maxSimultaneousLights:4}),e.setEffect(r.getEngine().createEffect("mrdlBackplate",{attributes:s,uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:l,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),o)}return!(!e.effect||!e.effect.isReady()||(o._renderId=r.getRenderId(),i._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){if(i.materialDefines){var o=i.effect;o&&(this._activeEffect=o,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",this.getScene().activeCamera.position),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Line_Width_",this.lineWidth),this._activeEffect.setFloat("_Absolute_Sizes_",this.absoluteSizes?1:0),this._activeEffect.setFloat("_Filter_Width_",this._filterWidth),this._activeEffect.setDirectColor4("_Base_Color_",this.baseColor),this._activeEffect.setDirectColor4("_Line_Color_",this.lineColor),this._activeEffect.setFloat("_Radius_Top_Left_",this.radiusTopLeft),this._activeEffect.setFloat("_Radius_Top_Right_",this.radiusTopRight),this._activeEffect.setFloat("_Radius_Bottom_Left_",this.radiusBottomLeft),this._activeEffect.setFloat("_Radius_Bottom_Right_",this.radiusBottomRight),this._activeEffect.setFloat("_Rate_",this._rate),this._activeEffect.setDirectColor4("_Highlight_Color_",this.highlightColor),this._activeEffect.setFloat("_Highlight_Width_",this.highlightWidth),this._activeEffect.setVector4("_Highlight_Transform_",this._highlightTransform),this._activeEffect.setFloat("_Highlight_",this._highlight),this._activeEffect.setFloat("_Iridescence_Intensity_",this.iridescenceIntensity),this._activeEffect.setFloat("_Iridescence_Edge_Intensity_",this.iridescenceEdgeIntensity),this._activeEffect.setDirectColor4("_Iridescence_Tint_",this.iridescenceTint),this._activeEffect.setTexture("_Iridescent_Map_",this._iridescentMapTexture),this._activeEffect.setFloat("_Angle_",this._angle),this._activeEffect.setFloat("_Reflected_",this._reflected?1:0),this._activeEffect.setFloat("_Frequency_",this._frequency),this._activeEffect.setFloat("_Vertical_Offset_",this._verticalOffset),this._activeEffect.setDirectColor4("_Gradient_Color_",this.gradientColor),this._activeEffect.setDirectColor4("_Top_Left_",this.topLeftGradientColor),this._activeEffect.setDirectColor4("_Top_Right_",this.topRightGradientColor),this._activeEffect.setDirectColor4("_Bottom_Left_",this.bottomLeftGradientColor),this._activeEffect.setDirectColor4("_Bottom_Right_",this.bottomRightGradientColor),this._activeEffect.setFloat("_Edge_Width_",this.edgeWidth),this._activeEffect.setFloat("_Edge_Power_",this.edgePower),this._activeEffect.setFloat("_Line_Gradient_Blend_",this.edgeLineGradientBlend),this._activeEffect.setFloat("_Fade_Out_",this.fadeOut),this._afterBind(e,this._activeEffect,i))}},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 h.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.MRDLBackplateMaterial",e},e.prototype.getClassName=function(){return"MRDLBackplateMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.IRIDESCENT_MAP_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/MRDL/mrtk-mrdl-backplate-iridescence.png",s([(0,h.serialize)()],e.prototype,"radius",void 0),s([(0,h.serialize)()],e.prototype,"lineWidth",void 0),s([(0,h.serialize)()],e.prototype,"absoluteSizes",void 0),s([(0,h.serialize)()],e.prototype,"baseColor",void 0),s([(0,h.serialize)()],e.prototype,"lineColor",void 0),s([(0,h.serialize)()],e.prototype,"radiusTopLeft",void 0),s([(0,h.serialize)()],e.prototype,"radiusTopRight",void 0),s([(0,h.serialize)()],e.prototype,"radiusBottomLeft",void 0),s([(0,h.serialize)()],e.prototype,"radiusBottomRight",void 0),s([(0,h.serialize)()],e.prototype,"highlightColor",void 0),s([(0,h.serialize)()],e.prototype,"highlightWidth",void 0),s([(0,h.serialize)()],e.prototype,"iridescenceIntensity",void 0),s([(0,h.serialize)()],e.prototype,"iridescenceEdgeIntensity",void 0),s([(0,h.serialize)()],e.prototype,"iridescenceTint",void 0),s([(0,h.serialize)()],e.prototype,"fadeOut",void 0),s([(0,h.serialize)()],e.prototype,"gradientColor",void 0),s([(0,h.serialize)()],e.prototype,"topLeftGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"topRightGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"bottomLeftGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"bottomRightGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"edgeWidth",void 0),s([(0,h.serialize)()],e.prototype,"edgePower",void 0),s([(0,h.serialize)()],e.prototype,"edgeLineGradientBlend",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.MRDLBackplateMaterial",Kt);var Zt=function(t){function e(e,i){var o=t.call(this,e)||this;return o.onValueChangedObservable=new h.Observable,o._sliderBackplateVisible=i||!1,o._minimum=0,o._maximum=100,o._step=0,o._value=50,o}return n(e,t),Object.defineProperty(e.prototype,"mesh",{get:function(){return this.node?this._sliderThumb:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minimum",{get:function(){return this._minimum},set:function(t){this._minimum!==t&&(this._minimum=Math.max(t,0),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=Math.max(t,this._minimum),this._value=Math.max(Math.min(this._value,this._maximum),this._minimum))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"step",{get:function(){return this._step},set:function(t){this._step!==t&&(this._step=Math.max(Math.min(t,this._maximum-this._minimum),0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(t){this._value!==t&&(this._value=Math.max(Math.min(t,this._maximum),this._minimum),this._sliderThumb&&(this._sliderThumb.position.x=this._convertToPosition(this.value)),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"start",{get:function(){return this.node?this._sliderBar.position.x-this._sliderBar.scaling.x/2:-.5},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this.node?this._sliderBar.position.x+this._sliderBar.scaling.x/2:.5},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliderBarMaterial",{get:function(){return this._sliderBarMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliderThumbMaterial",{get:function(){return this._sliderThumbMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliderBackplateMaterial",{get:function(){return this._sliderBackplateMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliderBar",{get:function(){return this._sliderBar},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliderThumb",{get:function(){return this._sliderThumb},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliderBackplate",{get:function(){return this._sliderBackplate},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isVisible",{set:function(t){var e;this._isVisible!==t&&(this._isVisible=t,null===(e=this.node)||void 0===e||e.setEnabled(t))},enumerable:!1,configurable:!0}),e.prototype._createNode=function(t){var i=this,o=(0,h.CreateBox)("".concat(this.name,"_sliderbackplate"),{width:1,height:1,depth:1},t);return o.isPickable=!1,o.visibility=0,o.scaling=new h.Vector3(1,.5,.8),h.SceneLoader.ImportMeshAsync(void 0,e.MODEL_BASE_URL,e.MODEL_FILENAME,t).then((function(t){t.meshes.forEach((function(t){t.isPickable=!1}));var e=t.meshes[1],r=t.meshes[1].clone("".concat(i.name,"_sliderbar"),o),n=t.meshes[1].clone("".concat(i.name,"_sliderthumb"),o);e.visibility=0,i._sliderBackplateVisible&&(e.visibility=1,e.name="".concat(i.name,"_sliderbackplate"),e.scaling.x=1,e.scaling.z=.2,e.parent=o,i._sliderBackplateMaterial&&(e.material=i._sliderBackplateMaterial),i._sliderBackplate=e),r&&(r.parent=o,r.position.z=-.1,r.scaling=new h.Vector3(.8,.04,.3),i._sliderBarMaterial&&(r.material=i._sliderBarMaterial),i._sliderBar=r),n&&(n.parent=o,n.isPickable=!0,n.position.z=-.115,n.scaling=new h.Vector3(.025,.3,.6),n.position.x=i._convertToPosition(i.value),n.addBehavior(i._createBehavior()),i._sliderThumbMaterial&&(n.material=i._sliderThumbMaterial),i._sliderThumb=n),i._injectGUI3DReservedDataStore(o).control=i,o.getChildMeshes().forEach((function(t){i._injectGUI3DReservedDataStore(t).control=i}))})),this._affectMaterial(o),o},e.prototype._affectMaterial=function(t){var e,i,o;this._sliderBackplateMaterial=null!==(e=this._sliderBackplateMaterial)&&void 0!==e?e:new Kt("".concat(this.name,"_sliderbackplate_material"),t.getScene()),this._sliderBarMaterial=null!==(i=this._sliderBarMaterial)&&void 0!==i?i:new Ut("".concat(this.name,"_sliderbar_material"),t.getScene()),this._sliderThumbMaterial=null!==(o=this._sliderThumbMaterial)&&void 0!==o?o:new Yt("".concat(this.name,"_sliderthumb_material"),t.getScene())},e.prototype._createBehavior=function(){var t=this,e=new h.PointerDragBehavior({dragAxis:h.Vector3.Right()});return e.moveAttached=!1,e.onDragStartObservable.add((function(){t._draggedPosition=t._sliderThumb.position.x})),e.onDragObservable.add((function(e){t._draggedPosition+=e.dragDistance/t.scaling.x,t.value=t._convertToValue(t._draggedPosition)})),e},e.prototype._convertToPosition=function(t){var e=(t-this.minimum)/(this.maximum-this.minimum)*(this.end-this.start)+this.start;return Math.min(Math.max(e,this.start),this.end)},e.prototype._convertToValue=function(t){var e=(t-this.start)/(this.end-this.start)*(this.maximum-this.minimum);return e=this.step?Math.round(e/this.step)*this.step:e,Math.max(Math.min(this.minimum+e,this._maximum),this._minimum)},e.prototype.dispose=function(){var e,i,o,r,n,a;t.prototype.dispose.call(this),null===(e=this._sliderBar)||void 0===e||e.dispose(),null===(i=this._sliderThumb)||void 0===i||i.dispose(),null===(o=this._sliderBarMaterial)||void 0===o||o.dispose(),null===(r=this._sliderThumbMaterial)||void 0===r||r.dispose(),null===(n=this._sliderBackplate)||void 0===n||n.dispose(),null===(a=this._sliderBackplateMaterial)||void 0===a||a.dispose()},e.MODEL_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",e.MODEL_FILENAME="mrtk-fluent-backplate.glb",e}(dt),qt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._radius=5,e}return n(e,t),Object.defineProperty(e.prototype,"radius",{get:function(){return this._radius},set:function(t){var e=this;this._radius!==t&&(this._radius=t,h.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._mapGridNode=function(t,e){var i=t.mesh;if(i){var o=this._sphericalMapping(e);switch(t.position=o,this.orientation){case bt.FACEORIGIN_ORIENTATION:i.lookAt(new h.Vector3(2*o.x,2*o.y,2*o.z));break;case bt.FACEORIGINREVERSED_ORIENTATION:i.lookAt(new h.Vector3(-o.x,-o.y,-o.z));break;case bt.FACEFORWARD_ORIENTATION:break;case bt.FACEFORWARDREVERSED_ORIENTATION:i.rotate(h.Axis.Y,Math.PI,h.Space.LOCAL)}}},e.prototype._sphericalMapping=function(t){var e=new h.Vector3(0,0,this._radius),i=t.y/this._radius,o=-t.x/this._radius;return h.Matrix.RotationYawPitchRollToRef(o,i,0,h.TmpVectors.Matrix[0]),h.Vector3.TransformNormal(e,h.TmpVectors.Matrix[0])},e}(mt),Jt=function(t){function e(e){void 0===e&&(e=!1);var i=t.call(this)||this;return i._isVertical=!1,i.margin=.1,i._isVertical=e,i}return n(e,t),Object.defineProperty(e.prototype,"isVertical",{get:function(){return this._isVertical},set:function(t){var e=this;this._isVertical!==t&&(this._isVertical=t,h.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._arrangeChildren=function(){for(var t,e=0,i=0,o=0,r=[],n=h.Matrix.Invert(this.node.computeWorldMatrix(!0)),a=0,s=this._children;a<s.length;a++)if((f=s[a]).mesh){o++,f.mesh.computeWorldMatrix(!0),f.mesh.getWorldMatrix().multiplyToRef(n,h.TmpVectors.Matrix[0]);var l=f.mesh.getBoundingInfo().boundingBox,_=h.Vector3.TransformNormal(l.extendSize,h.TmpVectors.Matrix[0]);r.push(_),this._isVertical?i+=_.y:e+=_.x}this._isVertical?i+=(o-1)*this.margin/2:e+=(o-1)*this.margin/2,t=this._isVertical?-i:-e;for(var c=0,u=0,d=this._children;u<d.length;u++){var f;(f=d[u]).mesh&&(o--,_=r[c++],this._isVertical?(f.position.y=t+_.y,f.position.x=0,t+=2*_.y):(f.position.x=t+_.x,f.position.y=0,t+=2*_.x),t+=o>0?this.margin:0)}},e}(bt),$t=function(t){function e(e,i){var o=t.call(this,i,e)||this;return o._currentMesh=e,o.pointerEnterAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1.1)},o.pointerOutAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1/1.1)},o.pointerDownAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(.95)},o.pointerUpAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1/.95)},o}return n(e,t),e.prototype._getTypeName=function(){return"TouchMeshButton3D"},e.prototype._createNode=function(){var t=this;return this._currentMesh.getChildMeshes().forEach((function(e){t._injectGUI3DReservedDataStore(e).control=t})),this._currentMesh},e.prototype._affectMaterial=function(t){},e}(wt);h.ShaderStore.ShadersStore.mrdlBackglowPixelShader="uniform vec3 cameraPosition;varying vec3 vNormal;varying vec2 vUV;uniform float _Bevel_Radius_;uniform float _Line_Width_;uniform bool _Absolute_Sizes_;uniform float _Tuning_Motion_;uniform float _Motion_;uniform float _Max_Intensity_;uniform float _Intensity_Fade_In_Exponent_;uniform float _Outer_Fuzz_Start_;uniform float _Outer_Fuzz_End_;uniform vec4 _Color_;uniform vec4 _Inner_Color_;uniform float _Blend_Exponent_;uniform float _Falloff_;uniform float _Bias_;float BiasFunc(float b,float v) {return pow(v,log(clamp(b,0.001,0.999))/log(0.5));}\nvoid Fuzzy_Round_Rect_B33(\nfloat Size_X,\nfloat Size_Y,\nfloat Radius_X,\nfloat Radius_Y,\nfloat Line_Width,\nvec2 UV,\nfloat Outer_Fuzz,\nfloat Max_Outer_Fuzz,\nout float Rect_Distance,\nout float Inner_Distance)\n{vec2 halfSize=vec2(Size_X,Size_Y)*0.5;vec2 r=max(min(vec2(Radius_X,Radius_Y),halfSize),vec2(0.001,0.001));float radius=min(r.x,r.y)-Max_Outer_Fuzz;vec2 v=abs(UV);vec2 nearestp=min(v,halfSize-r);float d=distance(nearestp,v);Inner_Distance=clamp(1.0-(radius-d)/Line_Width,0.0,1.0);Rect_Distance=clamp(1.0-(d-radius)/Outer_Fuzz,0.0,1.0)*Inner_Distance;}\nvoid main()\n{float X_Q42;float Y_Q42;X_Q42=vNormal.x;Y_Q42=vNormal.y;float MaxAB_Q24=max(_Tuning_Motion_,_Motion_);float Sqrt_F_Q27=sqrt(MaxAB_Q24);float Power_Q43=pow(MaxAB_Q24,_Intensity_Fade_In_Exponent_);float Value_At_T_Q26=mix(_Outer_Fuzz_Start_,_Outer_Fuzz_End_,Sqrt_F_Q27);float Product_Q23=_Max_Intensity_*Power_Q43;float Rect_Distance_Q33;float Inner_Distance_Q33;Fuzzy_Round_Rect_B33(X_Q42,Y_Q42,_Bevel_Radius_,_Bevel_Radius_,_Line_Width_,vUV,Value_At_T_Q26,_Outer_Fuzz_Start_,Rect_Distance_Q33,Inner_Distance_Q33);float Power_Q44=pow(Inner_Distance_Q33,_Blend_Exponent_);float Result_Q45=pow(BiasFunc(_Bias_,Rect_Distance_Q33),_Falloff_);vec4 Color_At_T_Q25=mix(_Inner_Color_,_Color_,Power_Q44);float Product_Q22=Result_Q45*Product_Q23;vec4 Result_Q28=Product_Q22*Color_At_T_Q25;vec4 Out_Color=Result_Q28;float Clip_Threshold=0.0;gl_FragColor=Out_Color;}";h.ShaderStore.ShadersStore.mrdlBackglowVertexShader="uniform mat4 world;uniform mat4 viewProjection;uniform vec3 cameraPosition;attribute vec3 position;attribute vec3 normal;attribute vec2 uv;attribute vec3 tangent;uniform float _Bevel_Radius_;uniform float _Line_Width_;uniform bool _Absolute_Sizes_;uniform float _Tuning_Motion_;uniform float _Motion_;uniform float _Max_Intensity_;uniform float _Intensity_Fade_In_Exponent_;uniform float _Outer_Fuzz_Start_;uniform float _Outer_Fuzz_End_;uniform vec4 _Color_;uniform vec4 _Inner_Color_;uniform float _Blend_Exponent_;uniform float _Falloff_;uniform float _Bias_;varying vec3 vNormal;varying vec2 vUV;void main()\n{vec3 Dir_World_Q41=(world*vec4(tangent,0.0)).xyz;vec3 Dir_World_Q40=(world*vec4((cross(normal,tangent)),0.0)).xyz;float MaxAB_Q24=max(_Tuning_Motion_,_Motion_);float Length_Q16=length(Dir_World_Q41);float Length_Q17=length(Dir_World_Q40);bool Greater_Than_Q37=MaxAB_Q24>0.0;vec3 Sizes_Q35;vec2 XY_Q35;Sizes_Q35=(_Absolute_Sizes_ ? vec3(Length_Q16,Length_Q17,0) : vec3(Length_Q16/Length_Q17,1,0));XY_Q35=(uv-vec2(0.5,0.5))*Sizes_Q35.xy;vec3 Result_Q38=Greater_Than_Q37 ? position : vec3(0,0,0);vec3 Pos_World_Q39=(world*vec4(Result_Q38,1.0)).xyz;vec3 Position=Pos_World_Q39;vec3 Normal=Sizes_Q35;vec2 UV=XY_Q35;vec3 Tangent=vec3(0,0,0);vec3 Binormal=vec3(0,0,0);vec4 Color=vec4(1,1,1,1);gl_Position=viewProjection*vec4(Position,1);vNormal=Normal;vUV=UV;}";var te=function(t){function e(){var e=t.call(this)||this;return e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return n(e,t),e}(h.MaterialDefines),ee=function(t){function e(e,i){var o=t.call(this,e,i)||this;return o.bevelRadius=.16,o.lineWidth=.16,o.absoluteSizes=!1,o.tuningMotion=0,o.motion=1,o.maxIntensity=.7,o.intensityFadeInExponent=2,o.outerFuzzStart=.04,o.outerFuzzEnd=.04,o.color=new h.Color4(.682353,.698039,1,1),o.innerColor=new h.Color4(.356863,.392157,.796078,1),o.blendExponent=1.5,o.falloff=2,o.bias=.5,o.alphaMode=h.Constants.ALPHA_ADD,o.disableDepthWrite=!0,o.backFaceCulling=!1,o}return n(e,t),e.prototype.needAlphaBlending=function(){return!0},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){var i=e._drawWrapper;if(this.isFrozen&&i.effect&&i._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new te);var o=e.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=r.getEngine();if((0,h.PrepareDefinesForAttributes)(t,o,!1,!1),o.isDirty){o.markAsProcessed(),r.resetCachedMaterial();var a=new h.EffectFallbacks;o.FOG&&a.addFallback(1,"FOG"),(0,h.HandleFallbacksForShadows)(o,a),o.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess;var s=[h.VertexBuffer.PositionKind];o.NORMAL&&s.push(h.VertexBuffer.NormalKind),o.UV1&&s.push(h.VertexBuffer.UVKind),o.UV2&&s.push(h.VertexBuffer.UV2Kind),o.VERTEXCOLOR&&s.push(h.VertexBuffer.ColorKind),o.TANGENT&&s.push(h.VertexBuffer.TangentKind),(0,h.PrepareAttributesForInstances)(s,o);var l=o.toString(),_=["world","worldView","worldViewProjection","view","projection","viewProjection","cameraPosition","_Bevel_Radius_","_Line_Width_","_Absolute_Sizes_","_Tuning_Motion_","_Motion_","_Max_Intensity_","_Intensity_Fade_In_Exponent_","_Outer_Fuzz_Start_","_Outer_Fuzz_End_","_Color_","_Inner_Color_","_Blend_Exponent_","_Falloff_","_Bias_"],c=[],u=[];(0,h.PrepareUniformsAndSamplersList)({uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:o,maxSimultaneousLights:4}),e.setEffect(r.getEngine().createEffect("mrdlBackglow",{attributes:s,uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:l,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),o)}return!(!e.effect||!e.effect.isReady()||(o._renderId=r.getRenderId(),i._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o=this.getScene();if(i.materialDefines){var r=i.effect;r&&(this._activeEffect=r,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",o.activeCamera.position),this._activeEffect.setFloat("_Bevel_Radius_",this.bevelRadius),this._activeEffect.setFloat("_Line_Width_",this.lineWidth),this._activeEffect.setFloat("_Absolute_Sizes_",this.absoluteSizes?1:0),this._activeEffect.setFloat("_Tuning_Motion_",this.tuningMotion),this._activeEffect.setFloat("_Motion_",this.motion),this._activeEffect.setFloat("_Max_Intensity_",this.maxIntensity),this._activeEffect.setFloat("_Intensity_Fade_In_Exponent_",this.intensityFadeInExponent),this._activeEffect.setFloat("_Outer_Fuzz_Start_",this.outerFuzzStart),this._activeEffect.setFloat("_Outer_Fuzz_End_",this.outerFuzzEnd),this._activeEffect.setDirectColor4("_Color_",this.color),this._activeEffect.setDirectColor4("_Inner_Color_",this.innerColor),this._activeEffect.setFloat("_Blend_Exponent_",this.blendExponent),this._activeEffect.setFloat("_Falloff_",this.falloff),this._activeEffect.setFloat("_Bias_",this.bias),this._afterBind(e,this._activeEffect,i))}},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 h.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var t=h.SerializationHelper.Serialize(this);return t.customType="BABYLON.MRDLBackglowMaterial",t},e.prototype.getClassName=function(){return"MRDLBackglowMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},s([(0,h.serialize)()],e.prototype,"bevelRadius",void 0),s([(0,h.serialize)()],e.prototype,"lineWidth",void 0),s([(0,h.serialize)()],e.prototype,"absoluteSizes",void 0),s([(0,h.serialize)()],e.prototype,"tuningMotion",void 0),s([(0,h.serialize)()],e.prototype,"motion",void 0),s([(0,h.serialize)()],e.prototype,"maxIntensity",void 0),s([(0,h.serialize)()],e.prototype,"intensityFadeInExponent",void 0),s([(0,h.serialize)()],e.prototype,"outerFuzzStart",void 0),s([(0,h.serialize)()],e.prototype,"outerFuzzEnd",void 0),s([(0,h.serialize)()],e.prototype,"color",void 0),s([(0,h.serialize)()],e.prototype,"innerColor",void 0),s([(0,h.serialize)()],e.prototype,"blendExponent",void 0),s([(0,h.serialize)()],e.prototype,"falloff",void 0),s([(0,h.serialize)()],e.prototype,"bias",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.MRDLBackglowMaterial",ee);h.ShaderStore.ShadersStore.mrdlFrontplatePixelShader="uniform vec3 cameraPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec4 vExtra1;varying vec4 vExtra2;varying vec4 vExtra3;uniform float _Radius_;uniform float _Line_Width_;uniform bool _Relative_To_Height_;uniform float _Filter_Width_;uniform vec4 _Edge_Color_;uniform float _Fade_Out_;uniform bool _Smooth_Edges_;uniform bool _Blob_Enable_;uniform vec3 _Blob_Position_;uniform float _Blob_Intensity_;uniform float _Blob_Near_Size_;uniform float _Blob_Far_Size_;uniform float _Blob_Near_Distance_;uniform float _Blob_Far_Distance_;uniform float _Blob_Fade_Length_;uniform float _Blob_Inner_Fade_;uniform float _Blob_Pulse_;uniform float _Blob_Fade_;uniform float _Blob_Pulse_Max_Size_;uniform bool _Blob_Enable_2_;uniform vec3 _Blob_Position_2_;uniform float _Blob_Near_Size_2_;uniform float _Blob_Inner_Fade_2_;uniform float _Blob_Pulse_2_;uniform float _Blob_Fade_2_;uniform float _Gaze_Intensity_;uniform float _Gaze_Focus_;uniform sampler2D _Blob_Texture_;uniform float _Selection_Fuzz_;uniform float _Selected_;uniform float _Selection_Fade_;uniform float _Selection_Fade_Size_;uniform float _Selected_Distance_;uniform float _Selected_Fade_Length_;uniform float _Proximity_Max_Intensity_;uniform float _Proximity_Far_Distance_;uniform float _Proximity_Near_Radius_;uniform float _Proximity_Anisotropy_;uniform bool _Use_Global_Left_Index_;uniform bool _Use_Global_Right_Index_;uniform vec4 Global_Left_Index_Tip_Position;uniform vec4 Global_Right_Index_Tip_Position;void Scale_Color_B54(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{Result=Scalar*Color;}\nvoid Scale_RGB_B50(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{Result=vec4(Scalar,Scalar,Scalar,1)*Color;}\nvoid Proximity_Fragment_B51(\nfloat Proximity_Max_Intensity,\nfloat Proximity_Near_Radius,\nvec4 Deltas,\nfloat Show_Selection,\nfloat Distance_Fade1,\nfloat Distance_Fade2,\nfloat Strength,\nout float Proximity)\n{float proximity1=(1.0-clamp(length(Deltas.xy)/Proximity_Near_Radius,0.0,1.0))*Distance_Fade1;float proximity2=(1.0-clamp(length(Deltas.zw)/Proximity_Near_Radius,0.0,1.0))*Distance_Fade2;Proximity=Strength*(Proximity_Max_Intensity*max(proximity1,proximity2) *(1.0-Show_Selection)+Show_Selection);}\nvoid Blob_Fragment_B56(\nvec2 UV,\nvec3 Blob_Info,\nsampler2D Blob_Texture,\nout vec4 Blob_Color)\n{float k=dot(UV,UV);Blob_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));}\nvoid Round_Rect_Fragment_B61(\nfloat Radius,\nvec4 Line_Color,\nfloat Filter_Width,\nfloat Line_Visibility,\nvec4 Fill_Color,\nbool Smooth_Edges,\nvec4 Rect_Parms,\nout float Inside_Rect)\n{float d=length(max(abs(Rect_Parms.zw)-Rect_Parms.xy,0.0));float dx=max(fwidth(d)*Filter_Width,0.00001);Inside_Rect=Smooth_Edges ? clamp((Radius-d)/dx,0.0,1.0) : 1.0-step(Radius,d);}\nvoid main()\n{float Is_Quad_Q53;Is_Quad_Q53=vNormal.z;vec4 Blob_Color_Q56;Blob_Fragment_B56(vUV,vTangent,_Blob_Texture_,Blob_Color_Q56);float X_Q52;float Y_Q52;float Z_Q52;float W_Q52;X_Q52=vExtra3.x;Y_Q52=vExtra3.y;Z_Q52=vExtra3.z;W_Q52=vExtra3.w;float Proximity_Q51;Proximity_Fragment_B51(_Proximity_Max_Intensity_,_Proximity_Near_Radius_,vExtra2,X_Q52,Y_Q52,Z_Q52,1.0,Proximity_Q51);float Inside_Rect_Q61;Round_Rect_Fragment_B61(W_Q52,vec4(1,1,1,1),_Filter_Width_,1.0,vec4(0,0,0,0),_Smooth_Edges_,vExtra1,Inside_Rect_Q61);vec4 Result_Q50;Scale_RGB_B50(_Edge_Color_,Proximity_Q51,Result_Q50);vec4 Result_Q47=Inside_Rect_Q61*Blob_Color_Q56;vec4 Color_At_T_Q48=mix(Result_Q50,Result_Q47,Is_Quad_Q53);vec4 Result_Q54;Scale_Color_B54(Color_At_T_Q48,_Fade_Out_,Result_Q54);vec4 Out_Color=Result_Q54;float Clip_Threshold=0.001;bool To_sRGB=false;gl_FragColor=Out_Color;}";h.ShaderStore.ShadersStore.mrdlFrontplateVertexShader="uniform mat4 world;uniform mat4 viewProjection;uniform vec3 cameraPosition;attribute vec3 position;attribute vec3 normal;attribute vec2 uv;attribute vec3 tangent;attribute vec4 color;uniform float _Radius_;uniform float _Line_Width_;uniform bool _Relative_To_Height_;uniform float _Filter_Width_;uniform vec4 _Edge_Color_;uniform float _Fade_Out_;uniform bool _Smooth_Edges_;uniform bool _Blob_Enable_;uniform vec3 _Blob_Position_;uniform float _Blob_Intensity_;uniform float _Blob_Near_Size_;uniform float _Blob_Far_Size_;uniform float _Blob_Near_Distance_;uniform float _Blob_Far_Distance_;uniform float _Blob_Fade_Length_;uniform float _Blob_Inner_Fade_;uniform float _Blob_Pulse_;uniform float _Blob_Fade_;uniform float _Blob_Pulse_Max_Size_;uniform bool _Blob_Enable_2_;uniform vec3 _Blob_Position_2_;uniform float _Blob_Near_Size_2_;uniform float _Blob_Inner_Fade_2_;uniform float _Blob_Pulse_2_;uniform float _Blob_Fade_2_;uniform float _Gaze_Intensity_;uniform float _Gaze_Focus_;uniform sampler2D _Blob_Texture_;uniform float _Selection_Fuzz_;uniform float _Selected_;uniform float _Selection_Fade_;uniform float _Selection_Fade_Size_;uniform float _Selected_Distance_;uniform float _Selected_Fade_Length_;uniform float _Proximity_Max_Intensity_;uniform float _Proximity_Far_Distance_;uniform float _Proximity_Near_Radius_;uniform float _Proximity_Anisotropy_;uniform bool _Use_Global_Left_Index_;uniform bool _Use_Global_Right_Index_;uniform vec4 Global_Left_Index_Tip_Position;uniform vec4 Global_Right_Index_Tip_Position;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec4 vExtra1;varying vec4 vExtra2;varying vec4 vExtra3;void Blob_Vertex_B40(\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,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nfloat Blob_Enabled,\nfloat DistanceOffset,\nout vec3 Out_Position,\nout vec2 Out_UV,\nout vec3 Blob_Info,\nout vec2 Blob_Relative_UV)\n{float blobSize,fadeIn;vec3 Hit_Position;Blob_Info=vec3(0.0,0.0,0.0);float Hit_Distance=dot(Blob_Position-Face_Center,Normal)+DistanceOffset*Blob_Far_Distance;Hit_Position=Blob_Position-Hit_Distance*Normal;float absD=abs(Hit_Distance);float lerpVal=clamp((absD-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);fadeIn=1.0-clamp((absD-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);float innerFade=1.0-clamp(-Hit_Distance/Inner_Fade,0.0,1.0);float farClip=clamp(1.0-step(Blob_Far_Distance+Blob_Fade_Length,absD),0.0,1.0);float size=mix(Blob_Near_Size,Blob_Far_Size,lerpVal)*farClip;blobSize=mix(size,Selection_Fade_Size,Selection_Fade)*innerFade*Blob_Enabled;Blob_Info.x=lerpVal*0.5+0.5;Blob_Info.y=fadeIn*Intensity*(1.0-Selection_Fade)*Blob_Fade;Blob_Info.x*=(1.0-Blob_Pulse);vec3 delta=Hit_Position-Face_Center;vec2 blobCenterXY=vec2(dot(delta,Tangent),dot(delta,Bitangent));vec2 quadUVin=2.0*UV-1.0; \nvec2 blobXY=blobCenterXY+quadUVin*blobSize;vec2 blobClipped=clamp(blobXY,-Face_Size*0.5,Face_Size*0.5);vec2 blobUV=(blobClipped-blobCenterXY)/max(blobSize,0.0001)*2.0;vec3 blobCorner=Face_Center+blobClipped.x*Tangent+blobClipped.y*Bitangent;Out_Position=mix(Position,blobCorner,Vx_Color.rrr);Out_UV=mix(In_UV,blobUV,Vx_Color.rr);Blob_Relative_UV=blobClipped/Face_Size.y;}\nvoid Round_Rect_Vertex_B36(\nvec2 UV,\nvec3 Tangent,\nvec3 Binormal,\nfloat Radius,\nfloat Anisotropy,\nvec2 Blob_Center_UV,\nout vec2 Rect_UV,\nout vec2 Scale_XY,\nout vec4 Rect_Parms)\n{Scale_XY=vec2(Anisotropy,1.0);Rect_UV=(UV-vec2(0.5,0.5))*Scale_XY;Rect_Parms.xy=Scale_XY*0.5-vec2(Radius,Radius);Rect_Parms.zw=Blob_Center_UV;}\nvec2 ProjectProximity(\nvec3 blobPosition,\nvec3 position,\nvec3 center,\nvec3 dir,\nvec3 xdir,\nvec3 ydir,\nout float vdistance\n)\n{vec3 delta=blobPosition-position;vec2 xy=vec2(dot(delta,xdir),dot(delta,ydir));vdistance=abs(dot(delta,dir));return xy;}\nvoid Proximity_Vertex_B33(\nvec3 Blob_Position,\nvec3 Blob_Position_2,\nvec3 Face_Center,\nvec3 Position,\nfloat Proximity_Far_Distance,\nfloat Relative_Scale,\nfloat Proximity_Anisotropy,\nvec3 Normal,\nvec3 Tangent,\nvec3 Binormal,\nout vec4 Extra,\nout float Distance_To_Face,\nout float Distance_Fade1,\nout float Distance_Fade2)\n{float distz1,distz2;Extra.xy=ProjectProximity(Blob_Position,Position,Face_Center,Normal,Tangent*Proximity_Anisotropy,Binormal,distz1)/Relative_Scale;Extra.zw=ProjectProximity(Blob_Position_2,Position,Face_Center,Normal,Tangent*Proximity_Anisotropy,Binormal,distz2)/Relative_Scale;Distance_To_Face=dot(Normal,Position-Face_Center);Distance_Fade1=1.0-clamp(distz1/Proximity_Far_Distance,0.0,1.0);Distance_Fade2=1.0-clamp(distz2/Proximity_Far_Distance,0.0,1.0);}\nvoid Object_To_World_Pos_B12(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{Pos_World=(world*vec4(Pos_Object,1.0)).xyz;}\nvoid Choose_Blob_B27(\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{Position=Position1*(1.0-Vx_Color.g)+Vx_Color.g*Position2;float b1=Blob_Enable_1 ? 1.0 : 0.0;float b2=Blob_Enable_2 ? 1.0 : 0.0;Blob_Enable=b1+(b2-b1)*Vx_Color.g;Pulse=Blob_Pulse_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Pulse_2;Fade=Blob_Fade_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Fade_2;Near_Size=Near_Size_1*(1.0-Vx_Color.g)+Vx_Color.g*Near_Size_2;Inner_Fade=Blob_Inner_Fade_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Inner_Fade_2;}\nvoid Move_Verts_B32(\nvec2 UV,\nfloat Radius,\nfloat Anisotropy,\nfloat Line_Width,\nfloat Visible,\nout vec3 New_P,\nout vec2 New_UV)\n{vec2 xy=2.0*UV-vec2(0.5,0.5);vec2 center=clamp(xy,0.0,1.0);vec2 delta=2.0*(xy-center);float deltaLength=length(delta);vec2 aniso=vec2(1.0/Anisotropy,1.0);center=(center-vec2(0.5,0.5))*(1.0-2.0*Radius*aniso);New_UV=vec2((2.0-2.0*deltaLength)*Visible,0.0);float deltaRadius= (Radius-Line_Width*New_UV.x);New_P.xy=(center+deltaRadius/deltaLength *aniso*delta);New_P.z=0.0;}\nvoid Object_To_World_Dir_B14(\nvec3 Dir_Object,\nout vec3 Binormal_World)\n{Binormal_World=(world*vec4(Dir_Object,0.0)).xyz;}\nvoid Proximity_Visibility_B55(\nfloat Selection,\nvec3 Proximity_Center,\nvec3 Proximity_Center_2,\nfloat Proximity_Far_Distance,\nfloat Proximity_Radius,\nvec3 Face_Center,\nvec3 Normal,\nvec2 Face_Size,\nfloat Gaze,\nout float Width)\n{float boxMaxSize=length(Face_Size)*0.5;float d1=dot(Proximity_Center-Face_Center,Normal);vec3 blob1=Proximity_Center-d1*Normal;float d2=dot(Proximity_Center_2-Face_Center,Normal);vec3 blob2=Proximity_Center_2-d2*Normal;vec3 delta1=blob1-Face_Center;vec3 delta2=blob2-Face_Center;float dist1=dot(delta1,delta1);float dist2=dot(delta2,delta2);float nearestProxDist=sqrt(min(dist1,dist2));Width=(1.0-step(boxMaxSize+Proximity_Radius,nearestProxDist))*(1.0-step(Proximity_Far_Distance,min(d1,d2))*(1.0-step(0.0001,Selection)));Width=max(Gaze,Width);}\nvec2 ramp2(vec2 start,vec2 end,vec2 x)\n{return clamp((x-start)/(end-start),vec2(0.0,0.0),vec2(1.0,1.0));}\nfloat computeSelection(\nvec3 blobPosition,\nvec3 normal,\nvec3 tangent,\nvec3 bitangent,\nvec3 faceCenter,\nvec2 faceSize,\nfloat selectionFuzz,\nfloat farDistance,\nfloat fadeLength\n)\n{vec3 delta=blobPosition-faceCenter;float absD=abs(dot(delta,normal));float fadeIn=1.0-clamp((absD-farDistance)/fadeLength,0.0,1.0);vec2 blobCenterXY=vec2(dot(delta,tangent),dot(delta,bitangent));vec2 innerFace=faceSize*(1.0-selectionFuzz)*0.5;vec2 selectPulse=ramp2(-faceSize*0.5,-innerFace,blobCenterXY)-ramp2(innerFace,faceSize*0.5,blobCenterXY);return selectPulse.x*selectPulse.y*fadeIn;}\nvoid Selection_Vertex_B31(\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{float select1=computeSelection(Blob_Position,Normal,Tangent,Bitangent,Face_Center,Face_Size,Selection_Fuzz,Far_Distance,Fade_Length);float select2=computeSelection(Blob_Position_2,Normal,Tangent,Bitangent,Face_Center,Face_Size,Selection_Fuzz,Far_Distance,Fade_Length);Show_Selection=mix(max(select1,select2),1.0,Selected);}\nvoid main()\n{vec3 Vec3_Q29=vec3(vec2(0,0).x,vec2(0,0).y,color.r);vec3 Nrm_World_Q24;Nrm_World_Q24=normalize((world*vec4(normal,0.0)).xyz);vec3 Face_Center_Q30;Face_Center_Q30=(world*vec4(vec3(0,0,0),1.0)).xyz;vec3 Tangent_World_Q13;Tangent_World_Q13=(world*vec4(tangent,0.0)).xyz;vec3 Result_Q42;Result_Q42=_Use_Global_Left_Index_ ? Global_Left_Index_Tip_Position.xyz : _Blob_Position_;vec3 Result_Q43;Result_Q43=_Use_Global_Right_Index_ ? Global_Right_Index_Tip_Position.xyz : _Blob_Position_2_;float Value_At_T_Q58=mix(_Blob_Near_Size_,_Blob_Pulse_Max_Size_,_Blob_Pulse_);float Value_At_T_Q59=mix(_Blob_Near_Size_2_,_Blob_Pulse_Max_Size_,_Blob_Pulse_2_);vec3 Cross_Q70=cross(normal,tangent);float Product_Q45=_Gaze_Intensity_*_Gaze_Focus_;float Step_Q46=step(0.0001,Product_Q45);vec3 Tangent_World_N_Q15=normalize(Tangent_World_Q13);vec3 Position_Q27;float Near_Size_Q27;float Inner_Fade_Q27;float Blob_Enable_Q27;float Fade_Q27;float Pulse_Q27;Choose_Blob_B27(color,Result_Q42,Result_Q43,_Blob_Enable_,_Blob_Enable_2_,Value_At_T_Q58,Value_At_T_Q59,_Blob_Inner_Fade_,_Blob_Inner_Fade_2_,_Blob_Pulse_,_Blob_Pulse_2_,_Blob_Fade_,_Blob_Fade_2_,Position_Q27,Near_Size_Q27,Inner_Fade_Q27,Blob_Enable_Q27,Fade_Q27,Pulse_Q27);vec3 Binormal_World_Q14;Object_To_World_Dir_B14(Cross_Q70,Binormal_World_Q14);float Anisotropy_Q21=length(Tangent_World_Q13)/length(Binormal_World_Q14);vec3 Binormal_World_N_Q16=normalize(Binormal_World_Q14);vec2 Face_Size_Q35;float ScaleY_Q35;Face_Size_Q35=vec2(length(Tangent_World_Q13),length(Binormal_World_Q14));ScaleY_Q35=Face_Size_Q35.y;float Out_Radius_Q38;float Out_Line_Width_Q38;Out_Radius_Q38=_Relative_To_Height_ ? _Radius_ : _Radius_/ScaleY_Q35;Out_Line_Width_Q38=_Relative_To_Height_ ? _Line_Width_ : _Line_Width_/ScaleY_Q35;float Show_Selection_Q31;Selection_Vertex_B31(Result_Q42,Result_Q43,Face_Center_Q30,Face_Size_Q35,Nrm_World_Q24,Tangent_World_N_Q15,Binormal_World_N_Q16,_Selection_Fuzz_,_Selected_,_Selected_Distance_,_Selected_Fade_Length_,vec3(0,0,-1),Show_Selection_Q31);float MaxAB_Q41=max(Show_Selection_Q31,Product_Q45);float Width_Q55;Proximity_Visibility_B55(Show_Selection_Q31,Result_Q42,Result_Q43,_Proximity_Far_Distance_,_Proximity_Near_Radius_,Face_Center_Q30,Nrm_World_Q24,Face_Size_Q35,Step_Q46,Width_Q55);vec3 New_P_Q32;vec2 New_UV_Q32;Move_Verts_B32(uv,Out_Radius_Q38,Anisotropy_Q21,Out_Line_Width_Q38,Width_Q55,New_P_Q32,New_UV_Q32);vec3 Pos_World_Q12;Object_To_World_Pos_B12(New_P_Q32,Pos_World_Q12);vec3 Out_Position_Q40;vec2 Out_UV_Q40;vec3 Blob_Info_Q40;vec2 Blob_Relative_UV_Q40;Blob_Vertex_B40(Pos_World_Q12,Nrm_World_Q24,Tangent_World_N_Q15,Binormal_World_N_Q16,Position_Q27,_Blob_Intensity_,Near_Size_Q27,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,color,uv,Face_Center_Q30,Face_Size_Q35,New_UV_Q32,_Blob_Fade_Length_,_Selection_Fade_,_Selection_Fade_Size_,Inner_Fade_Q27,Pulse_Q27,Fade_Q27,Blob_Enable_Q27,0.0,Out_Position_Q40,Out_UV_Q40,Blob_Info_Q40,Blob_Relative_UV_Q40);vec2 Rect_UV_Q36;vec2 Scale_XY_Q36;vec4 Rect_Parms_Q36;Round_Rect_Vertex_B36(New_UV_Q32,Tangent_World_Q13,Binormal_World_Q14,Out_Radius_Q38,Anisotropy_Q21,Blob_Relative_UV_Q40,Rect_UV_Q36,Scale_XY_Q36,Rect_Parms_Q36);vec4 Extra_Q33;float Distance_To_Face_Q33;float Distance_Fade1_Q33;float Distance_Fade2_Q33;Proximity_Vertex_B33(Result_Q42,Result_Q43,Face_Center_Q30,Pos_World_Q12,_Proximity_Far_Distance_,1.0,_Proximity_Anisotropy_,Nrm_World_Q24,Tangent_World_N_Q15,Binormal_World_N_Q16,Extra_Q33,Distance_To_Face_Q33,Distance_Fade1_Q33,Distance_Fade2_Q33);vec4 Vec4_Q37=vec4(MaxAB_Q41,Distance_Fade1_Q33,Distance_Fade2_Q33,Out_Radius_Q38);vec3 Position=Out_Position_Q40;vec3 Normal=Vec3_Q29;vec2 UV=Out_UV_Q40;vec3 Tangent=Blob_Info_Q40;vec3 Binormal=vec3(0,0,0);vec4 Color=vec4(1,1,1,1);vec4 Extra1=Rect_Parms_Q36;vec4 Extra2=Extra_Q33;vec4 Extra3=Vec4_Q37;gl_Position=viewProjection*vec4(Position,1);vNormal=Normal;vUV=UV;vTangent=Tangent;vExtra1=Extra1;vExtra2=Extra2;vExtra3=Extra3;}";var ie=function(t){function e(){var e=t.call(this)||this;return e.SMOOTH_EDGES=!0,e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return n(e,t),e}(h.MaterialDefines),oe=function(t){function e(i,o){var r=t.call(this,i,o)||this;return r.radius=.12,r.lineWidth=.01,r.relativeToHeight=!1,r._filterWidth=1,r.edgeColor=new h.Color4(.53,.53,.53,1),r.blobEnable=!0,r.blobPosition=new h.Vector3(100,100,100),r.blobIntensity=.5,r.blobNearSize=.032,r.blobFarSize=.048,r.blobNearDistance=.008,r.blobFarDistance=.064,r.blobFadeLength=.04,r.blobInnerFade=.01,r.blobPulse=0,r.blobFade=1,r.blobPulseMaxSize=.05,r.blobEnable2=!0,r.blobPosition2=new h.Vector3(10,10.1,-.6),r.blobNearSize2=.008,r.blobInnerFade2=.1,r.blobPulse2=0,r.blobFade2=1,r.gazeIntensity=.8,r.gazeFocus=0,r.selectionFuzz=.5,r.selected=1,r.selectionFade=.2,r.selectionFadeSize=0,r.selectedDistance=.08,r.selectedFadeLength=.08,r.proximityMaxIntensity=.45,r.proximityFarDistance=.16,r.proximityNearRadius=.016,r.proximityAnisotropy=1,r.useGlobalLeftIndex=!0,r.useGlobalRightIndex=!0,r.fadeOut=1,r.alphaMode=h.Constants.ALPHA_ADD,r.disableDepthWrite=!0,r.backFaceCulling=!1,r._blobTexture=new h.Texture(e.BLOB_TEXTURE_URL,o,!0,!1,h.Texture.NEAREST_SAMPLINGMODE),r}return n(e,t),e.prototype.needAlphaBlending=function(){return!0},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){var i=e._drawWrapper;if(this.isFrozen&&i.effect&&i._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new ie);var o=e.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=r.getEngine();if((0,h.PrepareDefinesForAttributes)(t,o,!1,!1),o.isDirty){o.markAsProcessed(),r.resetCachedMaterial();var a=new h.EffectFallbacks;o.FOG&&a.addFallback(1,"FOG"),(0,h.HandleFallbacksForShadows)(o,a),o.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess;var s=[h.VertexBuffer.PositionKind];o.NORMAL&&s.push(h.VertexBuffer.NormalKind),o.UV1&&s.push(h.VertexBuffer.UVKind),o.UV2&&s.push(h.VertexBuffer.UV2Kind),o.VERTEXCOLOR&&s.push(h.VertexBuffer.ColorKind),o.TANGENT&&s.push(h.VertexBuffer.TangentKind),(0,h.PrepareAttributesForInstances)(s,o);var l=o.toString(),_=["world","worldView","worldViewProjection","view","projection","viewProjection","cameraPosition","_Radius_","_Line_Width_","_Relative_To_Height_","_Filter_Width_","_Edge_Color_","_Fade_Out_","_Smooth_Edges_","_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_Pulse_Max_Size_","_Blob_Enable_2_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Inner_Fade_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Gaze_Intensity_","_Gaze_Focus_","_Blob_Texture_","_Selection_Fuzz_","_Selected_","_Selection_Fade_","_Selection_Fade_Size_","_Selected_Distance_","_Selected_Fade_Length_","_Proximity_Max_Intensity_","_Proximity_Far_Distance_","_Proximity_Near_Radius_","_Proximity_Anisotropy_","Global_Left_Index_Tip_Position","Global_Right_Index_Tip_Position","_Use_Global_Left_Index_","_Use_Global_Right_Index_"],c=[],u=[];(0,h.PrepareUniformsAndSamplersList)({uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:o,maxSimultaneousLights:4}),e.setEffect(r.getEngine().createEffect("mrdlFrontplate",{attributes:s,uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:l,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),o)}return!(!e.effect||!e.effect.isReady()||(o._renderId=r.getRenderId(),i._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o=this.getScene();if(i.materialDefines){var r=i.effect;r&&(this._activeEffect=r,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",o.activeCamera.position),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Line_Width_",this.lineWidth),this._activeEffect.setFloat("_Relative_To_Height_",this.relativeToHeight?1:0),this._activeEffect.setFloat("_Filter_Width_",this._filterWidth),this._activeEffect.setDirectColor4("_Edge_Color_",this.edgeColor),this._activeEffect.setFloat("_Fade_Out_",this.fadeOut),this._activeEffect.setFloat("_Blob_Enable_",this.blobEnable?1:0),this._activeEffect.setVector3("_Blob_Position_",this.blobPosition),this._activeEffect.setFloat("_Blob_Intensity_",this.blobIntensity),this._activeEffect.setFloat("_Blob_Near_Size_",this.blobNearSize),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.blobInnerFade),this._activeEffect.setFloat("_Blob_Pulse_",this.blobPulse),this._activeEffect.setFloat("_Blob_Fade_",this.blobFade),this._activeEffect.setFloat("_Blob_Pulse_Max_Size_",this.blobPulseMaxSize),this._activeEffect.setFloat("_Blob_Enable_2_",this.blobEnable2?1:0),this._activeEffect.setVector3("_Blob_Position_2_",this.blobPosition2),this._activeEffect.setFloat("_Blob_Near_Size_2_",this.blobNearSize2),this._activeEffect.setFloat("_Blob_Inner_Fade_2_",this.blobInnerFade2),this._activeEffect.setFloat("_Blob_Pulse_2_",this.blobPulse2),this._activeEffect.setFloat("_Blob_Fade_2_",this.blobFade2),this._activeEffect.setFloat("_Gaze_Intensity_",this.gazeIntensity),this._activeEffect.setFloat("_Gaze_Focus_",this.gazeFocus),this._activeEffect.setTexture("_Blob_Texture_",this._blobTexture),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("_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("_Use_Global_Left_Index_",this.useGlobalLeftIndex?1:0),this._activeEffect.setFloat("_Use_Global_Right_Index_",this.useGlobalRightIndex?1:0),this._afterBind(e,this._activeEffect,i))}},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 h.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var t=h.SerializationHelper.Serialize(this);return t.customType="BABYLON.MRDLFrontplateMaterial",t},e.prototype.getClassName=function(){return"MRDLFrontplateMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.BLOB_TEXTURE_URL="",s([(0,h.serialize)()],e.prototype,"radius",void 0),s([(0,h.serialize)()],e.prototype,"lineWidth",void 0),s([(0,h.serialize)()],e.prototype,"relativeToHeight",void 0),s([(0,h.serialize)()],e.prototype,"edgeColor",void 0),s([(0,h.serialize)()],e.prototype,"blobEnable",void 0),s([(0,h.serialize)()],e.prototype,"blobPosition",void 0),s([(0,h.serialize)()],e.prototype,"blobIntensity",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize",void 0),s([(0,h.serialize)()],e.prototype,"blobFarSize",void 0),s([(0,h.serialize)()],e.prototype,"blobNearDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFarDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFadeLength",void 0),s([(0,h.serialize)()],e.prototype,"blobInnerFade",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse",void 0),s([(0,h.serialize)()],e.prototype,"blobFade",void 0),s([(0,h.serialize)()],e.prototype,"blobPulseMaxSize",void 0),s([(0,h.serialize)()],e.prototype,"blobEnable2",void 0),s([(0,h.serialize)()],e.prototype,"blobPosition2",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize2",void 0),s([(0,h.serialize)()],e.prototype,"blobInnerFade2",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse2",void 0),s([(0,h.serialize)()],e.prototype,"blobFade2",void 0),s([(0,h.serialize)()],e.prototype,"gazeIntensity",void 0),s([(0,h.serialize)()],e.prototype,"gazeFocus",void 0),s([(0,h.serialize)()],e.prototype,"selectionFuzz",void 0),s([(0,h.serialize)()],e.prototype,"selected",void 0),s([(0,h.serialize)()],e.prototype,"selectionFade",void 0),s([(0,h.serialize)()],e.prototype,"selectionFadeSize",void 0),s([(0,h.serialize)()],e.prototype,"selectedDistance",void 0),s([(0,h.serialize)()],e.prototype,"selectedFadeLength",void 0),s([(0,h.serialize)()],e.prototype,"proximityMaxIntensity",void 0),s([(0,h.serialize)()],e.prototype,"proximityFarDistance",void 0),s([(0,h.serialize)()],e.prototype,"proximityNearRadius",void 0),s([(0,h.serialize)()],e.prototype,"proximityAnisotropy",void 0),s([(0,h.serialize)()],e.prototype,"useGlobalLeftIndex",void 0),s([(0,h.serialize)()],e.prototype,"useGlobalRightIndex",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.MRDLFrontplateMaterial",oe);h.ShaderStore.ShadersStore.mrdlInnerquadPixelShader="uniform vec3 cameraPosition;varying vec2 vUV;varying vec3 vTangent;uniform vec4 _Color_;uniform float _Radius_;uniform bool _Fixed_Radius_;uniform float _Filter_Width_;uniform float _Glow_Fraction_;uniform float _Glow_Max_;uniform float _Glow_Falloff_;float FilterStep_Bid194(float edge,float x,float filterWidth)\n{float dx=max(1.0E-5,fwidth(x)*filterWidth);return max((x+dx*0.5-max(edge,x-dx*0.5))/dx,0.0);}\nvoid Round_Rect_B194(\nfloat Size_X,\nfloat Size_Y,\nfloat Radius,\nvec4 Rect_Color,\nfloat Filter_Width,\nvec2 UV,\nfloat Glow_Fraction,\nfloat Glow_Max,\nfloat Glow_Falloff,\nout vec4 Color)\n{vec2 halfSize=vec2(Size_X,Size_Y)*0.5;vec2 r=max(min(vec2(Radius,Radius),halfSize),vec2(0.01,0.01));vec2 v=abs(UV);vec2 nearestp=min(v,halfSize-r);vec2 delta=(v-nearestp)/max(vec2(0.01,0.01),r);float Distance=length(delta);float insideRect=1.0-FilterStep_Bid194(1.0-Glow_Fraction,Distance,Filter_Width);float glow=clamp((1.0-Distance)/Glow_Fraction,0.0,1.0);glow=pow(glow,Glow_Falloff);Color=Rect_Color*max(insideRect,glow*Glow_Max);}\nvoid main()\n{float X_Q192;float Y_Q192;float Z_Q192;X_Q192=vTangent.x;Y_Q192=vTangent.y;Z_Q192=vTangent.z;vec4 Color_Q194;Round_Rect_B194(X_Q192,1.0,Y_Q192,_Color_,_Filter_Width_,vUV,_Glow_Fraction_,_Glow_Max_,_Glow_Falloff_,Color_Q194);vec4 Out_Color=Color_Q194;float Clip_Threshold=0.0;gl_FragColor=Out_Color;}\n";h.ShaderStore.ShadersStore.mrdlInnerquadVertexShader="uniform mat4 world;uniform mat4 viewProjection;uniform vec3 cameraPosition;attribute vec3 position;attribute vec3 normal;attribute vec2 uv;attribute vec3 tangent;attribute vec4 color;uniform vec4 _Color_;uniform float _Radius_;uniform bool _Fixed_Radius_;uniform float _Filter_Width_;uniform float _Glow_Fraction_;uniform float _Glow_Max_;uniform float _Glow_Falloff_;varying vec2 vUV;varying vec3 vTangent;void main()\n{vec3 Pos_World_Q189;Pos_World_Q189=(world*vec4(position,1.0)).xyz;vec3 Dir_World_Q190;Dir_World_Q190=(world*vec4(tangent,0.0)).xyz;vec3 Dir_World_Q191;Dir_World_Q191=(world*vec4((cross(normal,tangent)),0.0)).xyz;float Length_Q180=length(Dir_World_Q190);float Length_Q181=length(Dir_World_Q191);float Quotient_Q184=Length_Q180/Length_Q181;float Quotient_Q195=_Radius_/Length_Q181;vec2 Result_Q193;Result_Q193=vec2((uv.x-0.5)*Length_Q180/Length_Q181,(uv.y-0.5));float Result_Q198=_Fixed_Radius_ ? Quotient_Q195 : _Radius_;vec3 Vec3_Q183=vec3(Quotient_Q184,Result_Q198,0);vec3 Position=Pos_World_Q189;vec3 Normal=vec3(0,0,0);vec2 UV=Result_Q193;vec3 Tangent=Vec3_Q183;vec3 Binormal=vec3(0,0,0);vec4 Color=color;gl_Position=viewProjection*vec4(Position,1);vUV=UV;vTangent=Tangent;}\n";var re=function(t){function e(){var e=t.call(this)||this;return e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return n(e,t),e}(h.MaterialDefines),ne=function(t){function e(e,i){var o=t.call(this,e,i)||this;return o.color=new h.Color4(1,1,1,.05),o.radius=.12,o.fixedRadius=!0,o._filterWidth=1,o.glowFraction=0,o.glowMax=.5,o.glowFalloff=2,o.alphaMode=h.Constants.ALPHA_COMBINE,o.backFaceCulling=!1,o}return n(e,t),e.prototype.needAlphaBlending=function(){return!0},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){var i=e._drawWrapper;if(this.isFrozen&&i.effect&&i._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new re);var o=e.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=r.getEngine();if((0,h.PrepareDefinesForAttributes)(t,o,!0,!1),o.isDirty){o.markAsProcessed(),r.resetCachedMaterial();var a=new h.EffectFallbacks;o.FOG&&a.addFallback(1,"FOG"),(0,h.HandleFallbacksForShadows)(o,a),o.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess;var s=[h.VertexBuffer.PositionKind];o.NORMAL&&s.push(h.VertexBuffer.NormalKind),o.UV1&&s.push(h.VertexBuffer.UVKind),o.UV2&&s.push(h.VertexBuffer.UV2Kind),o.VERTEXCOLOR&&s.push(h.VertexBuffer.ColorKind),o.TANGENT&&s.push(h.VertexBuffer.TangentKind),(0,h.PrepareAttributesForInstances)(s,o);var l=o.toString(),_=["world","worldView","worldViewProjection","view","projection","viewProjection","cameraPosition","_Color_","_Radius_","_Fixed_Radius_","_Filter_Width_","_Glow_Fraction_","_Glow_Max_","_Glow_Falloff_"],c=[],u=[];(0,h.PrepareUniformsAndSamplersList)({uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:o,maxSimultaneousLights:4}),e.setEffect(r.getEngine().createEffect("mrdlInnerquad",{attributes:s,uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:l,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),o)}return!(!e.effect||!e.effect.isReady()||(o._renderId=r.getRenderId(),i._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o=this.getScene();if(i.materialDefines){var r=i.effect;r&&(this._activeEffect=r,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",o.activeCamera.position),this._activeEffect.setDirectColor4("_Color_",this.color),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Fixed_Radius_",this.fixedRadius?1:0),this._activeEffect.setFloat("_Filter_Width_",this._filterWidth),this._activeEffect.setFloat("_Glow_Fraction_",this.glowFraction),this._activeEffect.setFloat("_Glow_Max_",this.glowMax),this._activeEffect.setFloat("_Glow_Falloff_",this.glowFalloff),this._afterBind(e,this._activeEffect,i))}},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 h.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var t=h.SerializationHelper.Serialize(this);return t.customType="BABYLON.MRDLInnerquadMaterial",t},e.prototype.getClassName=function(){return"MRDLInnerquadMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},s([(0,h.serialize)()],e.prototype,"color",void 0),s([(0,h.serialize)()],e.prototype,"radius",void 0),s([(0,h.serialize)()],e.prototype,"fixedRadius",void 0),s([(0,h.serialize)()],e.prototype,"glowFraction",void 0),s([(0,h.serialize)()],e.prototype,"glowMax",void 0),s([(0,h.serialize)()],e.prototype,"glowFalloff",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.MRDLInnerquadMaterial",ne);var ae=function(t){function e(e,i){void 0===i&&(i=!0);var o=t.call(this,e)||this;return o.width=1,o.height=1,o.radius=.14,o.textSizeInPixels=18,o.imageSizeInPixels=40,o.plateMaterialColor=new h.Color3(.4,.4,.4),o.frontPlateDepth=.2,o.backPlateDepth=.04,o.backGlowOffset=.1,o.flatPlaneDepth=.001,o.innerQuadRadius=o.radius-.04,o.innerQuadColor=new h.Color4(0,0,0,0),o.innerQuadToggledColor=new h.Color4(.5197843,.6485234,.9607843,.6),o.innerQuadHoverColor=new h.Color4(1,1,1,.05),o.innerQuadToggledHoverColor=new h.Color4(.5197843,.6485234,.9607843,1),o._isBackplateVisible=!0,o._shareMaterials=!0,o._shareMaterials=i,o.pointerEnterAnimation=function(){o._frontPlate&&o._textPlate&&!o.isToggleButton&&o._performEnterExitAnimation(1),o.isToggleButton&&o._innerQuadMaterial&&(o.isToggled?o._innerQuadMaterial.color=o.innerQuadToggledHoverColor:o._innerQuadMaterial.color=o.innerQuadHoverColor)},o.pointerOutAnimation=function(){o._frontPlate&&o._textPlate&&!o.isToggleButton&&o._performEnterExitAnimation(-.8),o.isToggleButton&&o._innerQuadMaterial&&o._onToggle(o.isToggled)},o.pointerDownAnimation=function(){},o.pointerUpAnimation=function(){},o._pointerClickObserver=o.onPointerClickObservable.add((function(){o._frontPlate&&o._backGlow&&!o.isActiveNearInteraction&&o._performClickAnimation(),o.isToggleButton&&o._innerQuadMaterial&&o._onToggle(o.isToggled)})),o._pointerEnterObserver=o.onPointerEnterObservable.add((function(){o.pointerEnterAnimation()})),o._pointerOutObserver=o.onPointerOutObservable.add((function(){o.pointerOutAnimation()})),o._toggleObserver=o.onToggleObservable.add((function(t){o._innerQuadMaterial.color=t?o.innerQuadToggledColor:o.innerQuadColor})),o}return n(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._backGlow.renderingGroupId=t,this._innerQuad.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(){var t;return(null===(t=this._tooltipTextBlock)||void 0===t?void 0:t.text)||null},set:function(t){var e=this;if(t){if(!this._tooltipFade){var i=this._backPlate._scene.useRightHandedSystem;this._tooltipMesh=(0,h.CreatePlane)("",{size:1},this._backPlate._scene),this._tooltipMesh.position=h.Vector3.Down().scale(.7).add(h.Vector3.Forward(i).scale(-.15)),this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._frontPlateCollisionMesh,this._tooltipTexture=lt.CreateForMesh(this._tooltipMesh);var o=new I;o.height=.25,o.width=.8,o.cornerRadius=25,o.color="#ffffff",o.thickness=20,o.background="#060668",this._tooltipTexture.addControl(o),this._tooltipTextBlock=new B,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=100,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new h.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,"subtext",{get:function(){return this._subtext},set:function(t){this._subtext!==t&&(this._subtext=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,"backGlowMaterial",{get:function(){return this._backGlowMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"innerQuadMaterial",{get:function(){return this._innerQuadMaterial},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(){var t;t=this._getAspectRatio()<=1?this._alignContentVertically():this._alignContentHorizontally(),this.content=t},e.prototype._getAspectRatio=function(){return this.width/this.height},e.prototype._alignContentVertically=function(){var t=new S;if(t.isVertical=!0,(0,h.IsDocumentAvailable)()&&document.createElement&&this._imageUrl){var e=new C;e.source=this._imageUrl,e.heightInPixels=180,e.widthInPixels=100,e.paddingTopInPixels=40,e.paddingBottomInPixels=40,t.addControl(e)}if(this._text){var i=new B;i.text=this._text,i.color="white",i.heightInPixels=30,i.fontSize=24,t.addControl(i)}return t},e.prototype._alignContentHorizontally=function(){var t=240,e=15,i=new I;i.widthInPixels=t,i.heightInPixels=t,i.color="transparent",i.setPaddingInPixels(e,e,e,e),t-=30;var o=new S;if(o.isVertical=!1,o.scaleY=this._getAspectRatio(),(0,h.IsDocumentAvailable)()&&document.createElement&&this._imageUrl){var r=new I("".concat(this.name,"_image"));r.widthInPixels=this.imageSizeInPixels,r.heightInPixels=this.imageSizeInPixels,r.color="transparent",t-=this.imageSizeInPixels;var n=new C;n.source=this._imageUrl,r.addControl(n),o.addControl(r)}if(this._text){var a=new B("".concat(this.name,"_text"));if(a.text=this._text,a.color="white",a.fontSize=this.textSizeInPixels,a.widthInPixels=t,this._imageUrl&&(a.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,a.paddingLeftInPixels=e),this._subtext){var s=new M;s.addColumnDefinition(1),s.addRowDefinition(.5),s.addRowDefinition(.5),s.widthInPixels=t,s.heightInPixels=45;var l=new B("".concat(this.name,"_subtext"));l.text=this._subtext,l.color="#EEEEEEAB",l.fontSize=.75*this.textSizeInPixels,l.fontWeight="600",this._imageUrl&&(l.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,l.paddingLeftInPixels=e),s.addControl(a,0),s.addControl(l,1),o.addControl(s)}else o.addControl(a)}return i.addControl(o),i},e.prototype._createNode=function(e){var i;this.name=null!==(i=this.name)&&void 0!==i?i:"TouchHolographicButton";var o=this._createBackPlate(e),r=this._createFrontPlate(e),n=this._createInnerQuad(e),a=this._createBackGlow(e);this._frontPlateCollisionMesh=r,this._textPlate=t.prototype._createNode.call(this,e),this._textPlate.name="".concat(this.name,"_textPlate"),this._textPlate.isPickable=!1,this._textPlate.scaling.x=this.width,this._textPlate.parent=r,this._backPlate=o,this._backPlate.position=h.Vector3.Forward(e.useRightHandedSystem).scale(this.backPlateDepth/2),this._backPlate.isPickable=!1,this._backPlate.addChild(r),this._backPlate.addChild(n),a&&this._backPlate.addChild(a);var s=new h.TransformNode("".concat(this.name,"_root"),e);return this._backPlate.setParent(s),this.collisionMesh=r,this.collidableFrontDirection=this._backPlate.forward.negate(),s},e.prototype._createBackPlate=function(t){var i=this,o=(0,h.CreateBox)("".concat(this.name,"_backPlate"),{},t);return o.isPickable=!1,o.visibility=0,o.scaling.z=.2,h.SceneLoader.ImportMeshAsync(void 0,e.MRTK_ASSET_BASE_URL,e.BACKPLATE_MODEL_FILENAME,t).then((function(t){var e=t.meshes[1];e.visibility=0,i._isBackplateVisible&&(e.visibility=1,e.name="".concat(i.name,"_backPlate"),e.isPickable=!1,e.scaling.x=i.width,e.scaling.y=i.height,e.parent=o),i._backMaterial&&(e.material=i._backMaterial),i._backPlate=e})),o},e.prototype._createFrontPlate=function(t){var i=this,o=(0,h.CreateBox)("".concat(this.name,"_frontPlate"),{width:this.width,height:this.height,depth:this.frontPlateDepth},t);return o.isPickable=!0,o.isNearPickable=!0,o.visibility=0,o.position=h.Vector3.Forward(t.useRightHandedSystem).scale((this.backPlateDepth-this.frontPlateDepth)/2),h.SceneLoader.ImportMeshAsync(void 0,e.MRTK_ASSET_BASE_URL,e.FRONTPLATE_MODEL_FILENAME,t).then((function(e){var r=(0,h.CreateBox)("".concat(i.name,"_collisionPlate"),{width:i.width,height:i.height},t);r.isPickable=!1,r.scaling.z=i.frontPlateDepth,r.visibility=0,r.parent=o,i._collisionPlate=r;var n=e.meshes[1];n.name="".concat(i.name,"_frontPlate"),n.isPickable=!1,n.scaling.x=i.width-i.backGlowOffset,n.scaling.y=i.height-i.backGlowOffset,n.position=h.Vector3.Forward(t.useRightHandedSystem).scale(-.5),n.parent=r,i.isToggleButton&&(n.visibility=0),i._frontMaterial&&(n.material=i._frontMaterial),i._textPlate.scaling.x=1,i._textPlate.parent=n,i._frontPlate=n})),o},e.prototype._createInnerQuad=function(t){var i=this,o=(0,h.CreateBox)("".concat(this.name,"_innerQuad"),{},t);return o.isPickable=!1,o.visibility=0,o.scaling.z=this.flatPlaneDepth,o.position.z+=this.backPlateDepth/2-this.flatPlaneDepth,h.SceneLoader.ImportMeshAsync(void 0,e.MRTK_ASSET_BASE_URL,e.INNERQUAD_MODEL_FILENAME,t).then((function(t){var e=t.meshes[1];e.name="".concat(i.name,"_innerQuad"),e.isPickable=!1,e.scaling.x=i.width-i.backGlowOffset,e.scaling.y=i.height-i.backGlowOffset,e.parent=o,i._innerQuadMaterial&&(e.material=i._innerQuadMaterial),i._innerQuad=e})),o},e.prototype._createBackGlow=function(t){var i=this;if(!this.isToggleButton){var o=(0,h.CreateBox)("".concat(this.name,"_backGlow"),{},t);return o.isPickable=!1,o.visibility=0,o.scaling.z=this.flatPlaneDepth,o.position.z+=this.backPlateDepth/2-2*this.flatPlaneDepth,h.SceneLoader.ImportMeshAsync(void 0,e.MRTK_ASSET_BASE_URL,e.BACKGLOW_MODEL_FILENAME,t).then((function(t){var e=t.meshes[1];e.name="".concat(i.name,"_backGlow"),e.isPickable=!1,e.scaling.x=i.width-i.backGlowOffset,e.scaling.y=i.height-i.backGlowOffset,e.parent=o,i._backGlowMaterial&&(e.material=i._backGlowMaterial),i._backGlow=e})),o}},e.prototype._applyFacade=function(t){this._plateMaterial.emissiveTexture=t,this._plateMaterial.opacityTexture=t,this._plateMaterial.diffuseColor=this.plateMaterialColor},e.prototype._performClickAnimation=function(){for(var t=new h.AnimationGroup("Click Animation Group"),e=0,i=[{name:"backGlowMotion",mesh:this._backGlow,property:"material.motion",keys:[{frame:0,values:[0,0,0]},{frame:20,values:[1,.0144,.0144]},{frame:40,values:[.0027713229489760476,0,0]},{frame:45,values:[.0027713229489760476]}]},{name:"_collisionPlateZSlide",mesh:this._collisionPlate,property:"position.z",keys:[{frame:0,values:[0,0,0]},{frame:20,values:[h.Vector3.Forward(this._collisionPlate._scene.useRightHandedSystem).scale(this.frontPlateDepth/2).z,0,0]},{frame:40,values:[0,.005403332496794331]},{frame:45,values:[0]}]},{name:"_collisionPlateZScale",mesh:this._collisionPlate,property:"scaling.z",keys:[{frame:0,values:[this.frontPlateDepth,0,0]},{frame:20,values:[this.backPlateDepth,0,0]},{frame:40,values:[this.frontPlateDepth,.0054]},{frame:45,values:[this.frontPlateDepth]}]}];e<i.length;e++){for(var o=i[e],r=new h.Animation(o.name,o.property,60,h.Animation.ANIMATIONTYPE_FLOAT,h.Animation.ANIMATIONLOOPMODE_CYCLE),n=[],a=0,s=o.keys;a<s.length;a++){var l=s[a];n.push({frame:l.frame,value:l.values[0],inTangent:l.values[1],outTangent:l.values[2],interpolation:l.values[3]})}r.setKeys(n),o.mesh&&t.addTargetedAnimation(r,o.mesh)}t.normalize(0,45),t.speedRatio=1,t.play()},e.prototype._performEnterExitAnimation=function(t){for(var e=new h.AnimationGroup("Enter Exit Animation Group"),i=0,o=[{name:"frontPlateFadeOut",mesh:this._frontPlate,property:"material.fadeOut",keys:[{frame:0,values:[0,0,.025045314830017686,0]},{frame:40,values:[1.00205599570012,.025045314830017686,0,0]}]},{name:"textPlateZSlide",mesh:this._textPlate,property:"position.z",keys:[{frame:0,values:[0,0,0]},{frame:40,values:[h.Vector3.Forward(this._textPlate._scene.useRightHandedSystem).scale(-.15).z,0,0]}]}];i<o.length;i++){for(var r=o[i],n=new h.Animation(r.name,r.property,60,h.Animation.ANIMATIONTYPE_FLOAT,h.Animation.ANIMATIONLOOPMODE_CYCLE),a=[],s=0,l=r.keys;s<l.length;s++){var _=l[s];a.push({frame:_.frame,value:_.values[0],inTangent:_.values[1],outTangent:_.values[2],interpolation:_.values[3]})}n.setKeys(a),r.mesh&&e.addTargetedAnimation(n,r.mesh)}e.normalize(0,45),e.speedRatio=t,e.play()},e.prototype._createBackMaterial=function(t){var e;this._backMaterial=null!==(e=this._backMaterial)&&void 0!==e?e:new Kt(this.name+"backPlateMaterial",t.getScene()),this._backMaterial.absoluteSizes=!0,this._backMaterial.radius=this.radius,this._backMaterial.lineWidth=.02},e.prototype._createFrontMaterial=function(t){var e;this._frontMaterial=null!==(e=this._frontMaterial)&&void 0!==e?e:new oe(this.name+"Front Material",t.getScene()),this.frontMaterial.radius=this.innerQuadRadius,this.frontMaterial.fadeOut=0},e.prototype._createBackGlowMaterial=function(t){var e,i=this.radius+.04;this._backGlowMaterial=null!==(e=this._backGlowMaterial)&&void 0!==e?e:new ee(this.name+"Back Glow Material",t.getScene()),this._backGlowMaterial.bevelRadius=i,this._backGlowMaterial.lineWidth=i,this._backGlowMaterial.motion=0},e.prototype._createInnerQuadMaterial=function(t){var e;this._innerQuadMaterial=null!==(e=this._innerQuadMaterial)&&void 0!==e?e:new ne("inner_quad",t.getScene()),this._innerQuadMaterial.radius=this.innerQuadRadius,this.isToggleButton&&(this._innerQuadMaterial.color=this.innerQuadColor)},e.prototype._createPlateMaterial=function(t){var e;this._plateMaterial=null!==(e=this._plateMaterial)&&void 0!==e?e:new h.StandardMaterial(this.name+"Plate Material",t.getScene()),this._plateMaterial.specularColor=h.Color3.Black()},e.prototype._onToggle=function(e){t.prototype._onToggle.call(this,e)},e.prototype._affectMaterial=function(t){this._shareMaterials?(this._host._touchSharedMaterials.mrdlBackplateMaterial?this._backMaterial=this._host._touchSharedMaterials.mrdlBackplateMaterial:(this._createBackMaterial(t),this._host._touchSharedMaterials.mrdlBackplateMaterial=this._backMaterial),this._host._touchSharedMaterials.mrdlFrontplateMaterial?this._frontMaterial=this._host._touchSharedMaterials.mrdlFrontplateMaterial:(this._createFrontMaterial(t),this._host._touchSharedMaterials.mrdlFrontplateMaterial=this._frontMaterial),this._host._touchSharedMaterials.mrdlBackglowMaterial?this._backGlowMaterial=this._host._touchSharedMaterials.mrdlBackglowMaterial:(this._createBackGlowMaterial(t),this._host._touchSharedMaterials.mrdlBackglowMaterial=this._backGlowMaterial),this._host._touchSharedMaterials.mrdlInnerQuadMaterial?this._innerQuadMaterial=this._host._touchSharedMaterials.mrdlInnerQuadMaterial:(this._createInnerQuadMaterial(t),this._host._touchSharedMaterials.mrdlInnerQuadMaterial=this._innerQuadMaterial)):(this._createBackMaterial(t),this._createFrontMaterial(t),this._createBackGlowMaterial(t),this._createInnerQuadMaterial(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._backGlow&&(this._backGlow.material=this._backGlowMaterial),this._innerQuad&&(this._innerQuad.material=this._innerQuadMaterial),this._rebuildContent()},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._disposeTooltip(),this.onPointerClickObservable.remove(this._pointerClickObserver),this.onPointerEnterObservable.remove(this._pointerEnterObserver),this.onPointerOutObservable.remove(this._pointerOutObserver),this.onToggleObservable.remove(this._toggleObserver),this.shareMaterials||(this._backMaterial.dispose(),this._frontMaterial.dispose(),this._plateMaterial.dispose(),this._backGlowMaterial.dispose(),this._innerQuadMaterial.dispose(),this._pickedPointObserver&&(this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver),this._pickedPointObserver=null))},e.MRTK_ASSET_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",e.FRONTPLATE_MODEL_FILENAME="mrtk-fluent-frontplate.glb",e.BACKPLATE_MODEL_FILENAME="mrtk-fluent-backplate.glb",e.BACKGLOW_MODEL_FILENAME="mrtk-fluent-button.glb",e.INNERQUAD_MODEL_FILENAME="SlateProximity.glb",e}(wt),se=function(){function t(t){var e=this;this._customControlScaling=1,this._lastControlOver={},this._lastControlDown={},this.onPickedPointChangedObservable=new h.Observable,this.onPickingObservable=new h.Observable,this._sharedMaterials={},this._touchSharedMaterials={},this._scene=t||h.EngineStore.LastCreatedScene,this._sceneDisposeObserver=this._scene.onDisposeObservable.add((function(){e._sceneDisposeObserver=null,e._utilityLayer=null,e.dispose()})),this._utilityLayer=h.UtilityLayerRenderer._CreateDefaultUtilityLayerFromScene(this._scene),this._utilityLayer.onlyCheckPointerDownEvents=!1,this._utilityLayer.pickUtilitySceneFirst=!1,this._utilityLayer.mainSceneTrackerPredicate=function(t){var e,i,o;return t&&(null===(o=null===(i=null===(e=t.reservedDataStore)||void 0===e?void 0:e.GUI3D)||void 0===i?void 0:i.control)||void 0===o?void 0:o._node)},this._rootContainer=new bt("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){e._doPicking(t)})),this._utilityLayer.utilityLayerScene.autoClear=!1,this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil=!1,new h.HemisphericLight("hemi",h.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,o;if(!this._utilityLayer||!this._utilityLayer.shouldRender||!this._utilityLayer.utilityLayerScene.activeCamera)return!1;var r=t.event,n=r.pointerId||0,a=r.button,s=t.pickInfo;if(s&&this.onPickingObservable.notifyObservers(s.pickedMesh),!s||!s.hit)return this._handlePointerOut(n,t.type===h.PointerEventTypes.POINTERUP),!1;s.pickedPoint&&this.onPickedPointChangedObservable.notifyObservers(s.pickedPoint);var l=null===(i=null===(e=s.pickedMesh.reservedDataStore)||void 0===e?void 0:e.GUI3D)||void 0===i?void 0:i.control;return l&&!l._processObservables(t.type,s.pickedPoint,(null===(o=s.originMesh)||void 0===o?void 0:o.position)||null,n,a)&&t.type===h.PointerEventTypes.POINTERMOVE&&(this._lastControlOver[n]&&this._lastControlOver[n]._onPointerOut(this._lastControlOver[n]),delete this._lastControlOver[n]),t.type===h.PointerEventTypes.POINTERUP&&(this._lastControlDown[r.pointerId]&&(this._lastControlDown[r.pointerId].forcePointerUp(),delete this._lastControlDown[r.pointerId]),("touch"===r.pointerType||"xr"===r.pointerType&&this._scene.getEngine().hostInformation.isMobile)&&this._handlePointerOut(n,!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)Object.prototype.hasOwnProperty.call(this._sharedMaterials,t)&&this._sharedMaterials[t].dispose();for(var t in this._sharedMaterials={},this._touchSharedMaterials)Object.prototype.hasOwnProperty.call(this._touchSharedMaterials,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}(),le=void 0!==o.g?o.g:"undefined"!=typeof window?window:void 0;void 0!==le&&(le.BABYLON=le.BABYLON||{},le.BABYLON.GUI||(le.BABYLON.GUI=t));const _e=e})(),r.default})()));
1
+ !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,(t=>(()=>{"use strict";var e={597:e=>{e.exports=t}},i={};function o(t){var r=i[t];if(void 0!==r)return r.exports;var n=i[t]={exports:{}};return e[t](n,n.exports,o),n.exports}o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};return(()=>{o.d(r,{default:()=>_e});var t={};o.r(t),o.d(t,{AbstractButton3D:()=>pt,AdvancedDynamicTexture:()=>lt,AdvancedDynamicTextureInstrumentation:()=>_t,BaseGradient:()=>rt,BaseSlider:()=>V,Button:()=>T,Button3D:()=>gt,Checkbox:()=>O,CheckboxGroup:()=>G,ColorPicker:()=>E,Container:()=>x,Container3D:()=>bt,Control:()=>y,Control3D:()=>dt,CornerHandle:()=>Nt,CylinderPanel:()=>vt,DisplayGrid:()=>et,Ellipse:()=>F,FluentBackplateMaterial:()=>Ct,FluentButtonMaterial:()=>Rt,FluentMaterial:()=>xt,FluentMaterialDefines:()=>yt,FocusableButton:()=>D,GUI3DManager:()=>se,GizmoHandle:()=>Lt,Grid:()=>M,HandMenu:()=>It,HandleMaterial:()=>Dt,HandleState:()=>Ft,HolographicBackplate:()=>Tt,HolographicButton:()=>St,HolographicSlate:()=>zt,Image:()=>C,ImageBasedSlider:()=>it,ImageScrollBar:()=>Z,InputPassword:()=>k,InputText:()=>w,InputTextArea:()=>L,KeyPropertySet:()=>$,Line:()=>N,LinearGradient:()=>nt,MRDLBackplateMaterial:()=>Kt,MRDLSliderBarMaterial:()=>Ut,MRDLSliderThumbMaterial:()=>Yt,MathTools:()=>v,Matrix2D:()=>m,Measure:()=>g,MeshButton3D:()=>Qt,MultiLine:()=>z,MultiLinePoint:()=>A,NearMenu:()=>Vt,PlanePanel:()=>Wt,RadialGradient:()=>at,RadioButton:()=>Q,RadioGroup:()=>U,Rectangle:()=>I,ScatterPanel:()=>Ht,ScrollBar:()=>K,ScrollViewer:()=>q,SelectionPanel:()=>Y,SelectorGroup:()=>H,SideHandle:()=>kt,SlateGizmo:()=>At,Slider:()=>W,Slider3D:()=>Zt,SliderGroup:()=>j,SpherePanel:()=>qt,StackPanel:()=>S,StackPanel3D:()=>Jt,Style:()=>st,TextBlock:()=>B,TextWrapper:()=>R,TextWrapping:()=>P,ToggleButton:()=>J,TouchButton3D:()=>wt,TouchHolographicButton:()=>Mt,TouchHolographicButtonV3:()=>ae,TouchHolographicMenu:()=>Pt,TouchMeshButton3D:()=>$t,ValueAndUnit:()=>c,Vector2WithInfo:()=>b,Vector3WithInfo:()=>ut,VirtualKeyboard:()=>tt,VolumeBasedPanel:()=>mt,XmlLoader:()=>ct,name:()=>ot});var e={};o.r(e),o.d(e,{AbstractButton3D:()=>pt,AdvancedDynamicTexture:()=>lt,AdvancedDynamicTextureInstrumentation:()=>_t,BaseGradient:()=>rt,BaseSlider:()=>V,Button:()=>T,Button3D:()=>gt,Checkbox:()=>O,CheckboxGroup:()=>G,ColorPicker:()=>E,Container:()=>x,Container3D:()=>bt,Control:()=>y,Control3D:()=>dt,CornerHandle:()=>Nt,CylinderPanel:()=>vt,DisplayGrid:()=>et,Ellipse:()=>F,FluentBackplateMaterial:()=>Ct,FluentButtonMaterial:()=>Rt,FluentMaterial:()=>xt,FluentMaterialDefines:()=>yt,FocusableButton:()=>D,GUI3DManager:()=>se,GizmoHandle:()=>Lt,Grid:()=>M,HandMenu:()=>It,HandleMaterial:()=>Dt,HandleState:()=>Ft,HolographicBackplate:()=>Tt,HolographicButton:()=>St,HolographicSlate:()=>zt,Image:()=>C,ImageBasedSlider:()=>it,ImageScrollBar:()=>Z,InputPassword:()=>k,InputText:()=>w,InputTextArea:()=>L,KeyPropertySet:()=>$,Line:()=>N,LinearGradient:()=>nt,MRDLBackplateMaterial:()=>Kt,MRDLSliderBarMaterial:()=>Ut,MRDLSliderThumbMaterial:()=>Yt,MathTools:()=>v,Matrix2D:()=>m,Measure:()=>g,MeshButton3D:()=>Qt,MultiLine:()=>z,MultiLinePoint:()=>A,NearMenu:()=>Vt,PlanePanel:()=>Wt,RadialGradient:()=>at,RadioButton:()=>Q,RadioGroup:()=>U,Rectangle:()=>I,ScatterPanel:()=>Ht,ScrollBar:()=>K,ScrollViewer:()=>q,SelectionPanel:()=>Y,SelectorGroup:()=>H,SideHandle:()=>kt,SlateGizmo:()=>At,Slider:()=>W,Slider3D:()=>Zt,SliderGroup:()=>j,SpherePanel:()=>qt,StackPanel:()=>S,StackPanel3D:()=>Jt,Style:()=>st,TextBlock:()=>B,TextWrapper:()=>R,TextWrapping:()=>P,ToggleButton:()=>J,TouchButton3D:()=>wt,TouchHolographicButton:()=>Mt,TouchHolographicButtonV3:()=>ae,TouchHolographicMenu:()=>Pt,TouchMeshButton3D:()=>$t,ValueAndUnit:()=>c,Vector2WithInfo:()=>b,Vector3WithInfo:()=>ut,VirtualKeyboard:()=>tt,VolumeBasedPanel:()=>mt,XmlLoader:()=>ct,name:()=>ot});var i=function(t,e){return i=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])},i(t,e)};function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}var a=function(){return a=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},a.apply(this,arguments)};function s(t,e,i,o){var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a}function l(t,e,i,o){return new(i||(i=Promise))((function(r,n){function a(t){try{l(o.next(t))}catch(t){n(t)}}function s(t){try{l(o.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}l((o=o.apply(t,e||[])).next())}))}function _(t,e){var i,o,r,n,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function s(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;n&&(n=0,s[0]&&(a=0)),a;)try{if(i=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],o=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var h=o(597),c=function(){function t(e,i,o){void 0===i&&(i=t.UNITMODE_PIXEL),void 0===o&&(o=!0),this.negativeValueAllowed=o,this._value=1,this._unit=t.UNITMODE_PIXEL,this.ignoreAdaptiveScaling=!1,this.onChangedObservable=new h.Observable,this._value=e,this._unit=i,this._originalUnit=i}return Object.defineProperty(t.prototype,"isPercentage",{get:function(){return this._unit===t.UNITMODE_PERCENTAGE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isPixel",{get:function(){return this._unit===t.UNITMODE_PIXEL},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"internalValue",{get:function(){return this._value},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this._value},set:function(t){t!==this._value&&(this._value=t,this.onChangedObservable.notifyObservers())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"unit",{get:function(){return this._unit},set:function(t){t!==this._unit&&(this._unit=t,this.onChangedObservable.notifyObservers())},enumerable:!1,configurable:!0}),t.prototype.getValueInPixel=function(t,e){return this.isPixel?this.getValue(t):this.getValue(t)*e},t.prototype.updateInPlace=function(e,i){return void 0===i&&(i=t.UNITMODE_PIXEL),this.value===e&&this.unit===i||(this._value=e,this._unit=i,this.onChangedObservable.notifyObservers()),this},t.prototype.getValue=function(e){if(e&&!this.ignoreAdaptiveScaling&&this.unit!==t.UNITMODE_PERCENTAGE){var i=0,o=0;if(e.idealWidth&&(i=Math.ceil(this._value*e.getSize().width/e.idealWidth)),e.idealHeight&&(o=Math.ceil(this._value*e.getSize().height/e.idealHeight)),e.useSmallestIdeal&&e.idealWidth&&e.idealHeight)return window.innerWidth<window.innerHeight?i:o;if(e.idealWidth)return i;if(e.idealHeight)return o}return this._value},t.prototype.toString=function(e,i){switch(this._unit){case t.UNITMODE_PERCENTAGE:var o=100*this.getValue(e);return(i?o.toFixed(i):o)+"%";case t.UNITMODE_PIXEL:var r=this.getValue(e);return(i?r.toFixed(i):r)+"px"}return this._unit.toString()},t.prototype.fromString=function(e){var i=t._Regex.exec(e.toString());if(!i||0===i.length)return!1;var o=parseFloat(i[1]),r=this._originalUnit;if(this.negativeValueAllowed||o<0&&(o=0),4===i.length)switch(i[3]){case"px":r=t.UNITMODE_PIXEL;break;case"%":r=t.UNITMODE_PERCENTAGE,o/=100}return(o!==this._value||r!==this._unit)&&(this._value=o,this._unit=r,this.onChangedObservable.notifyObservers(),!0)},Object.defineProperty(t,"UNITMODE_PERCENTAGE",{get:function(){return t._UNITMODE_PERCENTAGE},enumerable:!1,configurable:!0}),Object.defineProperty(t,"UNITMODE_PIXEL",{get:function(){return t._UNITMODE_PIXEL},enumerable:!1,configurable:!0}),t._Regex=/(^-?\d*(\.\d+)?)(%|px)?/,t._UNITMODE_PERCENTAGE=0,t._UNITMODE_PIXEL=1,t}(),u=[new h.Vector2(0,0),new h.Vector2(0,0),new h.Vector2(0,0),new h.Vector2(0,0)],d=[new h.Vector2(0,0),new h.Vector2(0,0),new h.Vector2(0,0),new h.Vector2(0,0)],f=new h.Vector2(0,0),p=new h.Vector2(0,0),g=function(){function t(t,e,i,o){this.left=t,this.top=e,this.width=i,this.height=o}return t.prototype.copyFrom=function(t){this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height},t.prototype.copyFromFloats=function(t,e,i,o){this.left=t,this.top=e,this.width=i,this.height=o},t.CombineToRef=function(t,e,i){var o=Math.min(t.left,e.left),r=Math.min(t.top,e.top),n=Math.max(t.left+t.width,e.left+e.width),a=Math.max(t.top+t.height,e.top+e.height);i.left=o,i.top=r,i.width=n-o,i.height=a-r},t.prototype.addAndTransformToRef=function(t,e,i,o,r,n){var a=this.left+e,s=this.top+i,l=this.width+o,_=this.height+r;u[0].copyFromFloats(a,s),u[1].copyFromFloats(a+l,s),u[2].copyFromFloats(a+l,s+_),u[3].copyFromFloats(a,s+_),f.copyFromFloats(Number.MAX_VALUE,Number.MAX_VALUE),p.copyFromFloats(0,0);for(var h=0;h<4;h++)t.transformCoordinates(u[h].x,u[h].y,d[h]),f.x=Math.floor(Math.min(f.x,d[h].x)),f.y=Math.floor(Math.min(f.y,d[h].y)),p.x=Math.ceil(Math.max(p.x,d[h].x)),p.y=Math.ceil(Math.max(p.y,d[h].y));n.left=f.x,n.top=f.y,n.width=p.x-f.x,n.height=p.y-f.y},t.prototype.transformToRef=function(t,e){this.addAndTransformToRef(t,0,0,0,0,e)},t.prototype.isEqualsTo=function(t){return this.left===t.left&&this.top===t.top&&this.width===t.width&&this.height===t.height},t.Empty=function(){return new t(0,0,0,0)},t}(),b=function(t){function e(e,i){void 0===i&&(i=0);var o=t.call(this,e.x,e.y)||this;return o.buttonIndex=i,o}return n(e,t),e}(h.Vector2),m=function(){function t(t,e,i,o,r,n){this.m=new Float32Array(6),this.fromValues(t,e,i,o,r,n)}return t.prototype.fromValues=function(t,e,i,o,r,n){return this.m[0]=t,this.m[1]=e,this.m[2]=i,this.m[3]=o,this.m[4]=r,this.m[5]=n,this},t.prototype.determinant=function(){return this.m[0]*this.m[3]-this.m[1]*this.m[2]},t.prototype.invertToRef=function(t){var e=this.m[0],i=this.m[1],o=this.m[2],r=this.m[3],n=this.m[4],a=this.m[5],s=this.determinant();if(s<h.Epsilon*h.Epsilon)return t.m[0]=0,t.m[1]=0,t.m[2]=0,t.m[3]=0,t.m[4]=0,t.m[5]=0,this;var l=1/s,_=o*a-r*n,c=i*n-e*a;return t.m[0]=r*l,t.m[1]=-i*l,t.m[2]=-o*l,t.m[3]=e*l,t.m[4]=_*l,t.m[5]=c*l,this},t.prototype.multiplyToRef=function(t,e){var i=this.m[0],o=this.m[1],r=this.m[2],n=this.m[3],a=this.m[4],s=this.m[5],l=t.m[0],_=t.m[1],h=t.m[2],c=t.m[3],u=t.m[4],d=t.m[5];return e.m[0]=i*l+o*h,e.m[1]=i*_+o*c,e.m[2]=r*l+n*h,e.m[3]=r*_+n*c,e.m[4]=a*l+s*h+u,e.m[5]=a*_+s*c+d,this},t.prototype.transformCoordinates=function(t,e,i){return i.x=t*this.m[0]+e*this.m[2]+this.m[4],i.y=t*this.m[1]+e*this.m[3]+this.m[5],this},t.Identity=function(){return new t(1,0,0,1,0,0)},t.IdentityToRef=function(t){t.m[0]=1,t.m[1]=0,t.m[2]=0,t.m[3]=1,t.m[4]=0,t.m[5]=0},t.TranslationToRef=function(t,e,i){i.fromValues(1,0,0,1,t,e)},t.ScalingToRef=function(t,e,i){i.fromValues(t,0,0,e,0,0)},t.RotationToRef=function(t,e){var i=Math.sin(t),o=Math.cos(t);e.fromValues(o,i,-i,o,0,0)},t.ComposeToRef=function(e,i,o,r,n,a,s){t.TranslationToRef(e,i,t._TempPreTranslationMatrix),t.ScalingToRef(r,n,t._TempScalingMatrix),t.RotationToRef(o,t._TempRotationMatrix),t.TranslationToRef(-e,-i,t._TempPostTranslationMatrix),t._TempPreTranslationMatrix.multiplyToRef(t._TempScalingMatrix,t._TempCompose0),t._TempCompose0.multiplyToRef(t._TempRotationMatrix,t._TempCompose1),a?(t._TempCompose1.multiplyToRef(t._TempPostTranslationMatrix,t._TempCompose2),t._TempCompose2.multiplyToRef(a,s)):t._TempCompose1.multiplyToRef(t._TempPostTranslationMatrix,s)},t._TempPreTranslationMatrix=t.Identity(),t._TempPostTranslationMatrix=t.Identity(),t._TempRotationMatrix=t.Identity(),t._TempScalingMatrix=t.Identity(),t._TempCompose0=t.Identity(),t._TempCompose1=t.Identity(),t._TempCompose2=t.Identity(),t}(),v=function(){function t(){}return t.Round=function(e,i){return void 0===i&&(i=t.DefaultRoundingPrecision),Math.round(e*i)/i},t.DefaultRoundingPrecision=100,t}(),y=function(){function t(e){this.name=e,this._alpha=1,this._alphaSet=!1,this._zIndex=0,this._currentMeasure=g.Empty(),this._tempPaddingMeasure=g.Empty(),this._fontFamily="",this._fontStyle="",this._fontWeight="",this._fontSize=new c(18,c.UNITMODE_PIXEL,!1),this._width=new c(1,c.UNITMODE_PERCENTAGE,!1),this._height=new c(1,c.UNITMODE_PERCENTAGE,!1),this._color="",this._style=null,this._horizontalAlignment=t.HORIZONTAL_ALIGNMENT_CENTER,this._verticalAlignment=t.VERTICAL_ALIGNMENT_CENTER,this._isDirty=!0,this._wasDirty=!1,this._tempParentMeasure=g.Empty(),this._prevCurrentMeasureTransformedIntoGlobalSpace=g.Empty(),this._cachedParentMeasure=g.Empty(),this._descendantsOnlyPadding=!1,this._paddingLeft=new c(0),this._paddingRight=new c(0),this._paddingTop=new c(0),this._paddingBottom=new c(0),this._left=new c(0),this._top=new c(0),this._scaleX=1,this._scaleY=1,this._rotation=0,this._transformCenterX=.5,this._transformCenterY=.5,this._transformMatrix=m.Identity(),this._invertTransformMatrix=m.Identity(),this._transformedPosition=h.Vector2.Zero(),this._isMatrixDirty=!0,this._isVisible=!0,this._isHighlighted=!1,this._highlightColor="#4affff",this._highlightLineWidth=2,this._fontSet=!1,this._dummyVector2=h.Vector2.Zero(),this._downCount=0,this._enterCount=-1,this._doNotRender=!1,this._downPointerIds={},this._evaluatedMeasure=new g(0,0,0,0),this._evaluatedParentMeasure=new g(0,0,0,0),this._isEnabled=!0,this._disabledColor="#9a9a9a",this._disabledColorItem="#6a6a6a",this._isReadOnly=!1,this._gradient=null,this._rebuildLayout=!1,this.onEnabledStateChangedObservable=new h.Observable,this._customData={},this._isClipped=!1,this._automaticSize=!1,this.metadata=null,this.isHitTestVisible=!0,this.isPointerBlocker=!1,this.isFocusInvisible=!1,this._clipChildren=!0,this._clipContent=!0,this.useBitmapCache=!1,this._shadowOffsetX=0,this._shadowOffsetY=0,this._shadowBlur=0,this._previousShadowBlur=0,this._shadowColor="black",this.hoverCursor="",this._linkOffsetX=new c(0),this._linkOffsetY=new c(0),this._accessibilityTag=null,this.onAccessibilityTagChangedObservable=new h.Observable,this.onWheelObservable=new h.Observable,this.onPointerMoveObservable=new h.Observable,this.onPointerOutObservable=new h.Observable,this.onPointerDownObservable=new h.Observable,this.onPointerUpObservable=new h.Observable,this.onPointerClickObservable=new h.Observable,this.onEnterPressedObservable=new h.Observable,this.onPointerEnterObservable=new h.Observable,this.onDirtyObservable=new h.Observable,this.onBeforeDrawObservable=new h.Observable,this.onAfterDrawObservable=new h.Observable,this.onDisposeObservable=new h.Observable,this.onIsVisibleChangedObservable=new h.Observable,this.isSerializable=!0,this._fixedRatio=0,this._fixedRatioMasterIsWidth=!0,this.animations=null,this._focusedColor=null,this.tabIndex=-1,this._isFocused=!1,this._unfocusedColor=null,this.onFocusObservable=new h.Observable,this.onBlurObservable=new h.Observable,this.onKeyboardEventProcessedObservable=new h.Observable,this._tmpMeasureA=new g(0,0,0,0)}return Object.defineProperty(t.prototype,"isReadOnly",{get:function(){return this._isReadOnly},set:function(t){this._isReadOnly=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transformedMeasure",{get:function(){return this._evaluatedMeasure},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clipChildren",{get:function(){return this._clipChildren},set:function(t){this._clipChildren=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clipContent",{get:function(){return this._clipContent},set:function(t){this._clipContent=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowOffsetX",{get:function(){return this._shadowOffsetX},set:function(t){this._shadowOffsetX!==t&&(this._shadowOffsetX=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowOffsetY",{get:function(){return this._shadowOffsetY},set:function(t){this._shadowOffsetY!==t&&(this._shadowOffsetY=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowBlur",{get:function(){return this._shadowBlur},set:function(t){this._shadowBlur!==t&&(this._previousShadowBlur=this._shadowBlur,this._shadowBlur=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowColor",{get:function(){return this._shadowColor},set:function(t){this._shadowColor!==t&&(this._shadowColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"typeName",{get:function(){return this._getTypeName()},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return this._getTypeName()},Object.defineProperty(t.prototype,"accessibilityTag",{get:function(){return this._accessibilityTag},set:function(t){this._accessibilityTag=t,this.onAccessibilityTagChangedObservable.notifyObservers(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"host",{get:function(){return this._host},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontOffset",{get:function(){return this._fontOffset},set:function(t){this._fontOffset=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha!==t&&(this._alphaSet=!0,this._alpha=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"highlightLineWidth",{get:function(){return this._highlightLineWidth},set:function(t){this._highlightLineWidth!==t&&(this._highlightLineWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isHighlighted",{get:function(){return this._isHighlighted},set:function(t){this._isHighlighted!==t&&(this._isHighlighted=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"highlightColor",{get:function(){return this._highlightColor},set:function(t){this._highlightColor!==t&&(this._highlightColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleX",{get:function(){return this._scaleX},set:function(t){this._scaleX!==t&&(this._scaleX=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleY",{get:function(){return this._scaleY},set:function(t){this._scaleY!==t&&(this._scaleY=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transformCenterY",{get:function(){return this._transformCenterY},set:function(t){this._transformCenterY!==t&&(this._transformCenterY=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transformCenterX",{get:function(){return this._transformCenterX},set:function(t){this._transformCenterX!==t&&(this._transformCenterX=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"horizontalAlignment",{get:function(){return this._horizontalAlignment},set:function(t){this._horizontalAlignment!==t&&(this._horizontalAlignment=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"verticalAlignment",{get:function(){return this._verticalAlignment},set:function(t){this._verticalAlignment!==t&&(this._verticalAlignment=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fixedRatio",{get:function(){return this._fixedRatio},set:function(t){this._fixedRatio!==t&&(this._fixedRatio=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fixedRatioMasterIsWidth",{get:function(){return this._fixedRatioMasterIsWidth},set:function(t){this._fixedRatioMasterIsWidth!==t&&(this._fixedRatioMasterIsWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(t){this._fixedRatioMasterIsWidth=!0,this._width.toString(this._host)!==t&&this._width.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"widthInPixels",{get:function(){return this._width.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(t){isNaN(t)||(this._fixedRatioMasterIsWidth=!0,this.width=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(t){this._fixedRatioMasterIsWidth=!1,this._height.toString(this._host)!==t&&this._height.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"heightInPixels",{get:function(){return this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this._fixedRatioMasterIsWidth=!1,this.height=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this._resetFontCache())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this._resetFontCache())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this._resetFontCache())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"style",{get:function(){return this._style},set:function(t){var e=this;this._style&&(this._style.onChangedObservable.remove(this._styleObserver),this._styleObserver=null),this._style=t,this._style&&(this._styleObserver=this._style.onChangedObservable.add((function(){e._markAsDirty(),e._resetFontCache()}))),this._markAsDirty(),this._resetFontCache()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_isFontSizeInPercentage",{get:function(){return this._fontSize.isPercentage},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontSizeInPixels",{get:function(){var t=this._style?this._style._fontSize:this._fontSize;return t.isPixel?t.getValue(this._host):t.getValueInPixel(this._host,this._tempParentMeasure.height||this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this.fontSize=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontSize",{get:function(){return this._fontSize.toString(this._host)},set:function(t){this._fontSize.toString(this._host)!==t&&this._fontSize.fromString(t)&&(this._markAsDirty(),this._resetFontCache())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this._color},set:function(t){this._color!==t&&(this._color=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gradient",{get:function(){return this._gradient},set:function(t){this._gradient!==t&&(this._gradient=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zIndex",{get:function(){return this._zIndex},set:function(t){this.zIndex!==t&&(this._zIndex=t,this.parent&&this.parent._reOrderControl(this))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"notRenderable",{get:function(){return this._doNotRender},set:function(t){this._doNotRender!==t&&(this._doNotRender=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isVisible",{get:function(){return this._isVisible},set:function(t){this._isVisible!==t&&(this._isVisible=t,this._markAsDirty(!0),this.onIsVisibleChangedObservable.notifyObservers(t))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDirty",{get:function(){return this._isDirty},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkedMesh",{get:function(){return this._linkedMesh},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"descendantsOnlyPadding",{get:function(){return this._descendantsOnlyPadding},set:function(t){this._descendantsOnlyPadding!==t&&(this._descendantsOnlyPadding=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingLeft",{get:function(){return this._paddingLeft.toString(this._host)},set:function(t){this._paddingLeft.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingLeftInPixels",{get:function(){return this._paddingLeft.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(t){isNaN(t)||(this.paddingLeft=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_paddingLeftInPixels",{get:function(){return this._descendantsOnlyPadding?0:this.paddingLeftInPixels},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingRight",{get:function(){return this._paddingRight.toString(this._host)},set:function(t){this._paddingRight.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingRightInPixels",{get:function(){return this._paddingRight.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(t){isNaN(t)||(this.paddingRight=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_paddingRightInPixels",{get:function(){return this._descendantsOnlyPadding?0:this.paddingRightInPixels},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingTop",{get:function(){return this._paddingTop.toString(this._host)},set:function(t){this._paddingTop.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingTopInPixels",{get:function(){return this._paddingTop.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this.paddingTop=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_paddingTopInPixels",{get:function(){return this._descendantsOnlyPadding?0:this.paddingTopInPixels},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingBottom",{get:function(){return this._paddingBottom.toString(this._host)},set:function(t){this._paddingBottom.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingBottomInPixels",{get:function(){return this._paddingBottom.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this.paddingBottom=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_paddingBottomInPixels",{get:function(){return this._descendantsOnlyPadding?0:this.paddingBottomInPixels},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this._left.toString(this._host)},set:function(t){this._left.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leftInPixels",{get:function(){return this._left.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(t){isNaN(t)||(this.left=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this._top.toString(this._host)},set:function(t){this._top.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"topInPixels",{get:function(){return this._top.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this.top=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkOffsetX",{get:function(){return this._linkOffsetX.toString(this._host)},set:function(t){this._linkOffsetX.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkOffsetXInPixels",{get:function(){return this._linkOffsetX.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(t){isNaN(t)||(this.linkOffsetX=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkOffsetY",{get:function(){return this._linkOffsetY.toString(this._host)},set:function(t){this._linkOffsetY.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkOffsetYInPixels",{get:function(){return this._linkOffsetY.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this.linkOffsetY=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"centerX",{get:function(){return this._currentMeasure.left+this._currentMeasure.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"centerY",{get:function(){return this._currentMeasure.top+this._currentMeasure.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(t){var e=this;if(this._isEnabled!==t){this._isEnabled=t,this._markAsDirty();var i=function(t){if(t.host){for(var o in t.host._lastControlOver)t===e.host._lastControlOver[o]&&(t._onPointerOut(t,null,!0),delete t.host._lastControlOver[o]);void 0!==t.children&&t.children.forEach(i)}};i(this),this.onEnabledStateChangedObservable.notifyObservers(t)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabledColor",{get:function(){return this._disabledColor},set:function(t){this._disabledColor!==t&&(this._disabledColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabledColorItem",{get:function(){return this._disabledColorItem},set:function(t){this._disabledColorItem!==t&&(this._disabledColorItem=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"focusedColor",{get:function(){return this._focusedColor},set:function(t){this._focusedColor=t},enumerable:!1,configurable:!0}),t.prototype.onBlur=function(){this._isFocused&&(this._isFocused=!1,this.focusedColor&&null!=this._unfocusedColor&&(this.color=this._unfocusedColor),this.onBlurObservable.notifyObservers(this))},t.prototype.onFocus=function(){this._isFocused=!0,this.focusedColor&&(this._unfocusedColor=this.color,this.color=this.focusedColor),this.onFocusObservable.notifyObservers(this)},t.prototype.keepsFocusWith=function(){return null},t.prototype.focus=function(){this._host.moveFocusToControl(this)},t.prototype.blur=function(){this._host.focusedControl=null},t.prototype.processKeyboard=function(t){"Enter"===t.key&&this.onEnterPressedObservable.notifyObservers(this),this.onKeyboardEventProcessedObservable.notifyObservers(t,-1,this)},t.prototype._getTypeName=function(){return"Control"},t.prototype.getAscendantOfClass=function(t){return this.parent?this.parent.getClassName()===t?this.parent:this.parent.getAscendantOfClass(t):null},t.prototype.markAsDirty=function(t){void 0===t&&(t=!1),this._markAsDirty(t)},t.prototype.markAllAsDirty=function(){this._markAllAsDirty()},t.prototype._resetFontCache=function(){this._fontSet=!0,this._markAsDirty()},t.prototype.isAscendant=function(t){return!!this.parent&&(this.parent===t||this.parent.isAscendant(t))},t.prototype.getLocalCoordinates=function(t){var e=h.Vector2.Zero();return this.getLocalCoordinatesToRef(t,e),e},t.prototype.getLocalCoordinatesToRef=function(t,e){return e.x=t.x-this._currentMeasure.left,e.y=t.y-this._currentMeasure.top,this},t.prototype.getParentLocalCoordinates=function(t){var e=h.Vector2.Zero();return e.x=t.x-this._cachedParentMeasure.left,e.y=t.y-this._cachedParentMeasure.top,e},t.prototype.moveToVector3=function(e,i){if(this._host&&this.parent===this._host._rootContainer){this.horizontalAlignment=t.HORIZONTAL_ALIGNMENT_LEFT,this.verticalAlignment=t.VERTICAL_ALIGNMENT_TOP;var o=this._host._getGlobalViewport(),r=h.Vector3.Project(e,h.Matrix.IdentityReadOnly,i.getTransformMatrix(),o);this._moveToProjectedPosition(r),r.z<0||r.z>1?this.notRenderable=!0:this.notRenderable=!1}else h.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=[];return this.getDescendantsToRef(i,t,e),i},t.prototype.linkWithMesh=function(e){if(!this._host||this.parent&&this.parent!==this._host._rootContainer)e&&h.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,o){var r=t,n=null!=e?e:r,a=null!=i?i:r,s=null!=o?o:n;this.paddingTop=r,this.paddingRight=n,this.paddingBottom=a,this.paddingLeft=s},t.prototype.setPaddingInPixels=function(t,e,i,o){var r=t,n=null!=e?e:r,a=null!=i?i:r,s=null!=o?o:n;this.paddingTopInPixels=r,this.paddingRightInPixels=n,this.paddingBottomInPixels=a,this.paddingLeftInPixels=s},t.prototype._moveToProjectedPosition=function(t){var e,i=this._left.getValue(this._host),o=this._top.getValue(this._host),r=null===(e=this.parent)||void 0===e?void 0:e._currentMeasure;r&&this._processMeasures(r,this._host.getContext());var n=t.x+this._linkOffsetX.getValue(this._host)-this._currentMeasure.width/2,a=t.y+this._linkOffsetY.getValue(this._host)-this._currentMeasure.height/2,s=this._left.ignoreAdaptiveScaling&&this._top.ignoreAdaptiveScaling;s&&(Math.abs(n-i)<.5&&(n=i),Math.abs(a-o)<.5&&(a=o)),(s||i!==n||o!==a)&&(this.left=n+"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._computeAdditionalOffsetX=function(){return 0},t.prototype._computeAdditionalOffsetY=function(){return 0},t.prototype.invalidateRect=function(){if(this._transform(),this.host&&this.host.useInvalidateRectOptimization){this._currentMeasure.transformToRef(this._transformMatrix,this._tmpMeasureA),g.CombineToRef(this._tmpMeasureA,this._prevCurrentMeasureTransformedIntoGlobalSpace,this._tmpMeasureA);var t=this.shadowOffsetX,e=this.shadowOffsetY,i=Math.max(this._previousShadowBlur,this.shadowBlur),o=Math.min(Math.min(t,0)-2*i,0),r=Math.max(Math.max(t,0)+2*i,0),n=Math.min(Math.min(e,0)-2*i,0),a=Math.max(Math.max(e,0)+2*i,0),s=this._computeAdditionalOffsetX(),l=this._computeAdditionalOffsetY();this.host.invalidateRect(Math.floor(this._tmpMeasureA.left+o-s),Math.floor(this._tmpMeasureA.top+n-l),Math.ceil(this._tmpMeasureA.left+this._tmpMeasureA.width+r+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(),m.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._getColor=function(t){return this.gradient?this.gradient.getCanvasGradient(t):this.color},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||this.gradient)&&(e.fillStyle=this._getColor(e)),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&&h.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._postMeasure(this._tempPaddingMeasure,e),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._transform(),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.width<this._evaluatedParentMeasure.left)return void(this._isClipped=!0);if(this._evaluatedMeasure.top>this._evaluatedParentMeasure.top+this._evaluatedParentMeasure.height)return void(this._isClipped=!0);if(this._evaluatedMeasure.top+this._evaluatedMeasure.height<this._evaluatedParentMeasure.top)return void(this._isClipped=!0)}this._isClipped=!1},t.prototype._measure=function(){this._width.isPixel?this._currentMeasure.width=this._width.getValue(this._host):this._currentMeasure.width*=this._width.getValue(this._host),this._height.isPixel?this._currentMeasure.height=this._height.getValue(this._host):this._currentMeasure.height*=this._height.getValue(this._host),0!==this._fixedRatio&&(this._fixedRatioMasterIsWidth?this._currentMeasure.height=this._currentMeasure.width*this._fixedRatio:this._currentMeasure.width=this._currentMeasure.height*this._fixedRatio)},t.prototype._computeAlignment=function(e,i){var o=this._currentMeasure.width,r=this._currentMeasure.height,n=e.width,a=e.height,s=0,l=0;switch(this.horizontalAlignment){case t.HORIZONTAL_ALIGNMENT_LEFT:s=0;break;case t.HORIZONTAL_ALIGNMENT_RIGHT:s=n-o;break;case t.HORIZONTAL_ALIGNMENT_CENTER:s=(n-o)/2}switch(this.verticalAlignment){case t.VERTICAL_ALIGNMENT_TOP:l=0;break;case t.VERTICAL_ALIGNMENT_BOTTOM:l=a-r;break;case t.VERTICAL_ALIGNMENT_CENTER:l=(a-r)/2}this.descendantsOnlyPadding||(this._paddingLeft.isPixel?(this._currentMeasure.left+=this._paddingLeft.getValue(this._host),this._currentMeasure.width-=this._paddingLeft.getValue(this._host)):(this._currentMeasure.left+=n*this._paddingLeft.getValue(this._host),this._currentMeasure.width-=n*this._paddingLeft.getValue(this._host)),this._paddingRight.isPixel?this._currentMeasure.width-=this._paddingRight.getValue(this._host):this._currentMeasure.width-=n*this._paddingRight.getValue(this._host),this._paddingTop.isPixel?(this._currentMeasure.top+=this._paddingTop.getValue(this._host),this._currentMeasure.height-=this._paddingTop.getValue(this._host)):(this._currentMeasure.top+=a*this._paddingTop.getValue(this._host),this._currentMeasure.height-=a*this._paddingTop.getValue(this._host)),this._paddingBottom.isPixel?this._currentMeasure.height-=this._paddingBottom.getValue(this._host):this._currentMeasure.height-=a*this._paddingBottom.getValue(this._host)),this._left.isPixel?this._currentMeasure.left+=this._left.getValue(this._host):this._currentMeasure.left+=n*this._left.getValue(this._host),this._top.isPixel?this._currentMeasure.top+=this._top.getValue(this._host):this._currentMeasure.top+=a*this._top.getValue(this._host),this._currentMeasure.left+=s,this._currentMeasure.top+=l},t.prototype._preMeasure=function(t,e){},t.prototype._postMeasure=function(t,e){},t.prototype._additionalProcessing=function(t,e){},t.prototype._clipForChildren=function(t){},t.prototype._clip=function(e,i){if(e.beginPath(),t._ClipMeasure.copyFrom(this._currentMeasure),i){i.transformToRef(this._invertTransformMatrix,this._tmpMeasureA);var o=new g(0,0,0,0);o.left=Math.max(this._tmpMeasureA.left,this._currentMeasure.left),o.top=Math.max(this._tmpMeasureA.top,this._currentMeasure.top),o.width=Math.min(this._tmpMeasureA.left+this._tmpMeasureA.width,this._currentMeasure.left+this._currentMeasure.width)-o.left,o.height=Math.min(this._tmpMeasureA.top+this._tmpMeasureA.height,this._currentMeasure.top+this._currentMeasure.height)-o.top,t._ClipMeasure.copyFrom(o)}if(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY){var r=this.shadowOffsetX,n=this.shadowOffsetY,a=this.shadowBlur,s=Math.min(Math.min(r,0)-2*a,0),l=Math.max(Math.max(r,0)+2*a,0),_=Math.min(Math.min(n,0)-2*a,0),h=Math.max(Math.max(n,0)+2*a,0);e.rect(t._ClipMeasure.left+s,t._ClipMeasure.top+_,t._ClipMeasure.width+l-s,t._ClipMeasure.height+h-_)}else e.rect(t._ClipMeasure.left,t._ClipMeasure.top,t._ClipMeasure.width,t._ClipMeasure.height);e.clip()},t.prototype._render=function(t,e){return!this.isVisible||this.notRenderable||this._isClipped?(this._isDirty=!1,!1):(this.host._numRenderCalls++,t.save(),this._applyStates(t),this._transform(t),this.clipContent&&this._clip(t,e),this.onBeforeDrawObservable.hasObservers()&&this.onBeforeDrawObservable.notifyObservers(this),this.useBitmapCache&&!this._wasDirty&&this._cacheData?t.putImageData(this._cacheData,this._currentMeasure.left,this._currentMeasure.top):this._draw(t,e),this.useBitmapCache&&this._wasDirty&&(this._cacheData=t.getImageData(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._renderHighlight(t),this.onAfterDrawObservable.hasObservers()&&this.onAfterDrawObservable.notifyObservers(this),t.restore(),!0)},t.prototype._draw=function(t,e){},t.prototype.contains=function(t,e){return this._invertTransformMatrix.transformCoordinates(t,e,this._transformedPosition),t=this._transformedPosition.x,e=this._transformedPosition.y,!(t<this._currentMeasure.left||t>this._currentMeasure.left+this._currentMeasure.width||e<this._currentMeasure.top||e>this._currentMeasure.top+this._currentMeasure.height||(this.isPointerBlocker&&(this._host._shouldBlockPointer=!0),0))},t.prototype._processPicking=function(t,e,i,o,r,n,a,s){return!(!this._isEnabled||!this.isHitTestVisible||!this.isVisible||this._doNotRender||!this.contains(t,e)||(this._processObservables(o,t,e,i,r,n,a,s),0))},t.prototype._onPointerMove=function(t,e,i,o){this.onPointerMoveObservable.notifyObservers(e,-1,t,this,o)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerMove(t,e,i,o)},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.isPointerBlocker&&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 o=!0;t.isAscendant(this)||(o=this.onPointerOutObservable.notifyObservers(this,-1,t,this,e)),o&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerOut(t,e,i)}},t.prototype._onPointerDown=function(t,e,i,o,r){return this._onPointerEnter(this,r),0===this._downCount&&(this._downCount++,this._downPointerIds[i]=!0,this.onPointerDownObservable.notifyObservers(new b(e,o),-1,t,this,r)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerDown(t,e,i,o,r),r&&this.uniqueId!==this._host.rootContainer.uniqueId&&this._host._capturedPointerIds.add(r.event.pointerId),!0)},t.prototype._onPointerUp=function(t,e,i,o,r,n){if(this._isEnabled){this._downCount=0,delete this._downPointerIds[i];var a=r;r&&(this._enterCount>0||-1===this._enterCount)&&(a=this.onPointerClickObservable.notifyObservers(new b(e,o),-1,t,this,n)),this.onPointerUpObservable.notifyObservers(new b(e,o),-1,t,this,n)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerUp(t,e,i,o,a,n),n&&this.uniqueId!==this._host.rootContainer.uniqueId&&this._host._capturedPointerIds.delete(n.event.pointerId)}},t.prototype._forcePointerUp=function(t){if(void 0===t&&(t=null),null!==t)this._onPointerUp(this,h.Vector2.Zero(),t,0,!0);else for(var e in this._downPointerIds)this._onPointerUp(this,h.Vector2.Zero(),+e,0,!0)},t.prototype._onWheelScroll=function(t,e){this._isEnabled&&this.onWheelObservable.notifyObservers(new h.Vector2(t,e))&&null!=this.parent&&this.parent._onWheelScroll(t,e)},t.prototype._onCanvasBlur=function(){},t.prototype._processObservables=function(t,e,i,o,r,n,a,s){if(!this._isEnabled)return!1;if(this._dummyVector2.copyFromFloats(e,i),t===h.PointerEventTypes.POINTERMOVE){this._onPointerMove(this,this._dummyVector2,r,o);var l=this._host._lastControlOver[r];return l&&l!==this&&l._onPointerOut(this,o),l!==this&&this._onPointerEnter(this,o),this._host._lastControlOver[r]=this,!0}return t===h.PointerEventTypes.POINTERDOWN?(this._onPointerDown(this,this._dummyVector2,r,n,o),this._host._registerLastControlDown(this,r),this._host._lastPickedControl=this,!0):t===h.PointerEventTypes.POINTERUP?(this._host._lastControlDown[r]&&this._host._lastControlDown[r]._onPointerUp(this,this._dummyVector2,r,n,!0,o),delete this._host._lastControlDown[r],!0):!(t!==h.PointerEventTypes.POINTERWHEEL||!this._host._lastControlOver[r]||(this._host._lastControlOver[r]._onWheelScroll(a,s),0))},t.prototype._getStyleProperty=function(t,e){var i,o=null!==(i=this._style&&this._style[t])&&void 0!==i?i:this[t];return!o&&this.parent?this.parent._getStyleProperty(t,e):this.parent?o:e},t.prototype._prepareFont=function(){var e,i;(this._font||this._fontSet)&&(this._font=this._getStyleProperty("fontStyle","")+" "+this._getStyleProperty("fontWeight","")+" "+this.fontSizeInPixels+"px "+this._getStyleProperty("fontFamily","Arial"),this._fontOffset=t._GetFontOffset(this._font,null===(i=null===(e=this._host)||void 0===e?void 0:e.getScene())||void 0===i?void 0:i.getEngine()),this.getDescendants().forEach((function(t){return t._markAllAsDirty()})))},t.prototype.isDimensionFullyDefined=function(t){return this.getDimension(t).isPixel},t.prototype.getDimension=function(t){return"width"===t?this._width:this._height},t.prototype.clone=function(t){var e={};this.serialize(e,!0);var i=new(h.Tools.Instantiate("BABYLON.GUI."+e.className));return i.parse(e,t),i},t.prototype.parse=function(t,e,i){var o=this;return this._urlRewriter=i,h.SerializationHelper.Parse((function(){return o}),t,null),this.name=t.name,this._parseFromContent(t,null!=e?e:this._host),this},t.prototype.serialize=function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!0),(this.isSerializable||e)&&(h.SerializationHelper.Serialize(this,t),t.name=this.name,t.className=this.getClassName(),i&&this._prepareFont(),this._fontFamily&&(t.fontFamily=this._fontFamily),this.fontSize&&(t.fontSize=this.fontSize),this.fontWeight&&(t.fontWeight=this.fontWeight),this.fontStyle&&(t.fontStyle=this.fontStyle),this._gradient&&(t.gradient={},this._gradient.serialize(t.gradient)),h.SerializationHelper.AppendSerializedAnimations(this,t))},t.prototype._parseFromContent=function(t,e,i){var o,r;if(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.gradient){var n=h.Tools.Instantiate("BABYLON.GUI."+t.gradient.className);this._gradient=new n,null===(o=this._gradient)||void 0===o||o.parse(t.gradient)}if(t.animations){this.animations=[];for(var a=0;a<t.animations.length;a++){var s=t.animations[a],l=(0,h.GetClass)("BABYLON.Animation");l&&this.animations.push(l.Parse(s))}t.autoAnimate&&this._host&&this._host.getScene()&&this._host.getScene().beginAnimation(this,t.autoAnimateFrom,t.autoAnimateTo,t.autoAnimateLoop,t.autoAnimateSpeed||1)}this.fixedRatioMasterIsWidth=null!==(r=t.fixedRatioMasterIsWidth)&&void 0!==r?r:this.fixedRatioMasterIsWidth},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.onBlurObservable.clear(),this.onFocusObservable.clear(),this.onKeyboardEventProcessedObservable.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,i){if(t._FontHeightSizes[e])return t._FontHeightSizes[e];var o=i||h.EngineStore.LastCreatedEngine;if(!o)throw new Error("Invalid engine. Unable to create a canvas.");var r=o.getFontOffset(e);return t._FontHeightSizes[e]=r,r},t.Parse=function(t,e,i){var o=h.Tools.Instantiate("BABYLON.GUI."+t.className),r=h.SerializationHelper.Parse((function(){var t=new o;return t._urlRewriter=i,t}),t,null);return r.name=t.name,r._parseFromContent(t,e,i),r},t.drawEllipse=function(t,e,i,o,r,n){n.translate(t,e),n.scale(i,o),n.beginPath(),n.arc(0,0,1,0,2*Math.PI*r,r<0),r>=1&&n.closePath(),n.scale(1/i,1/o),n.translate(-t,-e)},t.prototype.isReady=function(){return!0},t.AllowAlphaInheritance=!1,t._ClipMeasure=new g(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(){},s([(0,h.serialize)()],t.prototype,"metadata",void 0),s([(0,h.serialize)()],t.prototype,"isHitTestVisible",void 0),s([(0,h.serialize)()],t.prototype,"isPointerBlocker",void 0),s([(0,h.serialize)()],t.prototype,"isFocusInvisible",void 0),s([(0,h.serialize)()],t.prototype,"clipChildren",null),s([(0,h.serialize)()],t.prototype,"clipContent",null),s([(0,h.serialize)()],t.prototype,"useBitmapCache",void 0),s([(0,h.serialize)()],t.prototype,"shadowOffsetX",null),s([(0,h.serialize)()],t.prototype,"shadowOffsetY",null),s([(0,h.serialize)()],t.prototype,"shadowBlur",null),s([(0,h.serialize)()],t.prototype,"shadowColor",null),s([(0,h.serialize)()],t.prototype,"hoverCursor",void 0),s([(0,h.serialize)()],t.prototype,"fontOffset",null),s([(0,h.serialize)()],t.prototype,"alpha",null),s([(0,h.serialize)()],t.prototype,"isSerializable",void 0),s([(0,h.serialize)()],t.prototype,"scaleX",null),s([(0,h.serialize)()],t.prototype,"scaleY",null),s([(0,h.serialize)()],t.prototype,"rotation",null),s([(0,h.serialize)()],t.prototype,"transformCenterY",null),s([(0,h.serialize)()],t.prototype,"transformCenterX",null),s([(0,h.serialize)()],t.prototype,"horizontalAlignment",null),s([(0,h.serialize)()],t.prototype,"verticalAlignment",null),s([(0,h.serialize)()],t.prototype,"fixedRatio",null),s([(0,h.serialize)()],t.prototype,"fixedRatioMasterIsWidth",null),s([(0,h.serialize)()],t.prototype,"width",null),s([(0,h.serialize)()],t.prototype,"height",null),s([(0,h.serialize)()],t.prototype,"style",null),s([(0,h.serialize)()],t.prototype,"color",null),s([(0,h.serialize)()],t.prototype,"gradient",null),s([(0,h.serialize)()],t.prototype,"zIndex",null),s([(0,h.serialize)()],t.prototype,"notRenderable",null),s([(0,h.serialize)()],t.prototype,"isVisible",null),s([(0,h.serialize)()],t.prototype,"descendantsOnlyPadding",null),s([(0,h.serialize)()],t.prototype,"paddingLeft",null),s([(0,h.serialize)()],t.prototype,"paddingRight",null),s([(0,h.serialize)()],t.prototype,"paddingTop",null),s([(0,h.serialize)()],t.prototype,"paddingBottom",null),s([(0,h.serialize)()],t.prototype,"left",null),s([(0,h.serialize)()],t.prototype,"top",null),s([(0,h.serialize)()],t.prototype,"linkOffsetX",null),s([(0,h.serialize)()],t.prototype,"linkOffsetY",null),s([(0,h.serialize)()],t.prototype,"isEnabled",null),s([(0,h.serialize)()],t.prototype,"disabledColor",null),s([(0,h.serialize)()],t.prototype,"disabledColorItem",null),s([(0,h.serialize)()],t.prototype,"overlapGroup",void 0),s([(0,h.serialize)()],t.prototype,"overlapDeltaMultiplier",void 0),t}();(0,h.RegisterClass)("BABYLON.GUI.Control",y);var x=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._children=new Array,i._measureForChildren=g.Empty(),i._background="",i._backgroundGradient=null,i._adaptWidthToChildren=!1,i._adaptHeightToChildren=!1,i._renderToIntermediateTexture=!1,i._intermediateTexture=null,i.delegatePickingToChildren=!1,i.logLayoutCycleErrors=!1,i.maxLayoutCycle=3,i.onControlAddedObservable=new h.Observable,i.onControlRemovedObservable=new h.Observable,i._inverseTransformMatrix=m.Identity(),i._inverseMeasure=new g(0,0,0,0),i}return n(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,"backgroundGradient",{get:function(){return this._backgroundGradient},set:function(t){this._backgroundGradient!==t&&(this._backgroundGradient=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;e<i.length;e++)i[e].isReadOnly=t},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Container"},e.prototype._flagDescendantsAsMatrixDirty=function(){for(var t=0,e=this.children;t<e.length;t++){var i=e[t];i._isClipped=!1,i._markMatrixAsDirty()}},e.prototype.getChildByName=function(t){for(var e=0,i=this.children;e<i.length;e++){var o=i[e];if(o.name===t)return o}return null},e.prototype.getChildByType=function(t,e){for(var i=0,o=this.children;i<o.length;i++){var r=o[i];if(r.typeName===e)return r}return null},e.prototype.containsControl=function(t){return-1!==this.children.indexOf(t)},e.prototype.addControl=function(t){return t?(-1!==this._children.indexOf(t)||(t._link(this._host),t._markAllAsDirty(),this._reOrderControl(t),this._markAsDirty(),this.onControlAddedObservable.notifyObservers(t)),this):this},e.prototype.clearControls=function(){for(var t=0,e=this.children.slice();t<e.length;t++){var i=e[t];this.removeControl(i)}return this},e.prototype.removeControl=function(t){var e=this._children.indexOf(t);return-1!==e&&(this._children.splice(e,1),t.parent=null),t.linkWithMesh(null),this._host&&this._host._cleanControlAfterRemoval(t),this._markAsDirty(),this.onControlRemovedObservable.notifyObservers(t),this},e.prototype._reOrderControl=function(t){var e=t.linkedMesh;this.removeControl(t);for(var i=!1,o=0;o<this._children.length;o++)if(this._children[o].zIndex>t.zIndex){this._children.splice(o,0,t),i=!0;break}i||this._children.push(t),t.parent=this,e&&t.linkWithMesh(e),this._markAsDirty()},e.prototype._offsetLeft=function(e){t.prototype._offsetLeft.call(this,e);for(var i=0,o=this._children;i<o.length;i++)o[i]._offsetLeft(e)},e.prototype._offsetTop=function(e){t.prototype._offsetTop.call(this,e);for(var i=0,o=this._children;i<o.length;i++)o[i]._offsetTop(e)},e.prototype._markAllAsDirty=function(){t.prototype._markAllAsDirty.call(this);for(var e=0;e<this._children.length;e++)this._children[e]._markAllAsDirty()},e.prototype._getBackgroundColor=function(t){return this._backgroundGradient?this._backgroundGradient.getCanvasGradient(t):this._background},e.prototype._localDraw=function(t){(this._background||this._backgroundGradient)&&(t.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),t.fillStyle=this._getBackgroundColor(t),t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height),t.restore())},e.prototype._link=function(e){t.prototype._link.call(this,e);for(var i=0,o=this._children;i<o.length;i++)o[i]._link(e)},e.prototype._beforeLayout=function(){},e.prototype._processMeasures=function(e,i){!this._isDirty&&this._cachedParentMeasure.isEqualsTo(e)||(t.prototype._processMeasures.call(this,e,i),this._evaluateClippingState(e),this._renderToIntermediateTexture&&(this._intermediateTexture&&this._host.getScene()!=this._intermediateTexture.getScene()&&(this._intermediateTexture.dispose(),this._intermediateTexture=null),this._intermediateTexture?this._intermediateTexture.scaleTo(this._currentMeasure.width,this._currentMeasure.height):(this._intermediateTexture=new h.DynamicTexture("",{width:this._currentMeasure.width,height:this._currentMeasure.height},this._host.getScene(),!1,h.Texture.NEAREST_SAMPLINGMODE,h.Constants.TEXTUREFORMAT_RGBA,!1),this._intermediateTexture.hasAlpha=!0)))},e.prototype._layout=function(t,e){var i,o;if(!this.isDirty&&(!this.isVisible||this.notRenderable))return!1;this.host._numLayoutCalls++,this._isDirty&&this._currentMeasure.transformToRef(this._transformMatrix,this._prevCurrentMeasureTransformedIntoGlobalSpace);var r=0;e.save(),this._applyStates(e),this._beforeLayout();do{var n=-1,a=-1;if(this._rebuildLayout=!1,this._processMeasures(t,e),!this._isClipped){for(var s=0,l=this._children;s<l.length;s++){var _=l[s];_._tempParentMeasure.copyFrom(this._measureForChildren),_._layout(this._measureForChildren,e)&&_.isVisible&&!_.notRenderable&&(this.adaptWidthToChildren&&_._width.isPixel&&(n=Math.max(n,_._currentMeasure.width+_._paddingLeftInPixels+_._paddingRightInPixels)),this.adaptHeightToChildren&&_._height.isPixel&&(a=Math.max(a,_._currentMeasure.height+_._paddingTopInPixels+_._paddingBottomInPixels)))}this.adaptWidthToChildren&&n>=0&&(n+=this.paddingLeftInPixels+this.paddingRightInPixels,this.width!==n+"px"&&(null===(i=this.parent)||void 0===i||i._markAsDirty(),this.width=n+"px",this._width.ignoreAdaptiveScaling=!0,this._rebuildLayout=!0)),this.adaptHeightToChildren&&a>=0&&(a+=this.paddingTopInPixels+this.paddingBottomInPixels,this.height!==a+"px"&&(null===(o=this.parent)||void 0===o||o._markAsDirty(),this.height=a+"px",this._height.ignoreAdaptiveScaling=!0,this._rebuildLayout=!0)),this._postMeasure()}r++}while(this._rebuildLayout&&r<this.maxLayoutCycle);return r>=3&&this.logLayoutCycleErrors&&h.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,o=i?this._intermediateTexture.getContext():t;i&&(o.save(),o.translate(-this._currentMeasure.left,-this._currentMeasure.top),e?(this._transformMatrix.invertToRef(this._inverseTransformMatrix),e.transformToRef(this._inverseTransformMatrix,this._inverseMeasure),o.clearRect(this._inverseMeasure.left,this._inverseMeasure.top,this._inverseMeasure.width,this._inverseMeasure.height)):o.clearRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._localDraw(o),t.save(),this.clipChildren&&this._clipForChildren(o);for(var r=0,n=this._children;r<n.length;r++){var a=n[r];e&&!a._intersectsRect(e)||a._render(o,e)}i&&(o.restore(),t.save(),t.globalAlpha=this.alpha,t.drawImage(o.canvas,this._currentMeasure.left,this._currentMeasure.top),t.restore()),t.restore()},e.prototype.getDescendantsToRef=function(t,e,i){if(void 0===e&&(e=!1),this.children)for(var o=0;o<this.children.length;o++){var r=this.children[o];i&&!i(r)||t.push(r),e||r.getDescendantsToRef(t,!1,i)}},e.prototype._processPicking=function(e,i,o,r,n,a,s,l){if(!this._isEnabled||!this.isVisible||this.notRenderable)return!1;var _=t.prototype.contains.call(this,e,i);if(!_&&this.clipChildren)return!1;if(this.delegatePickingToChildren){for(var h=!1,c=this._children.length-1;c>=0;c--)if((u=this._children[c]).isEnabled&&u.isHitTestVisible&&u.isVisible&&!u.notRenderable&&u.contains(e,i)){h=!0;break}if(!h)return!1}for(c=this._children.length-1;c>=0;c--){var u;if((u=this._children[c])._processPicking(e,i,o,r,n,a,s,l))return u.hoverCursor&&this._host._changeCursor(u.hoverCursor),!0}return!!_&&!!this.isHitTestVisible&&this._processObservables(r,e,i,o,n,a,s,l)},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._measureForChildren.copyFrom(this._currentMeasure)},e.prototype._getAdaptDimTo=function(t){return"width"===t?this.adaptWidthToChildren:this.adaptHeightToChildren},e.prototype.isDimensionFullyDefined=function(e){if(this._getAdaptDimTo(e)){for(var i=0,o=this.children;i<o.length;i++)if(!o[i].isDimensionFullyDefined(e))return!1;return!0}return t.prototype.isDimensionFullyDefined.call(this,e)},e.prototype.serialize=function(e,i,o){if(void 0===i&&(i=!1),void 0===o&&(o=!0),t.prototype.serialize.call(this,e,i,o),(this.isSerializable||i)&&(this.backgroundGradient&&(e.backgroundGradient={},this.backgroundGradient.serialize(e.backgroundGradient)),this.children.length)){e.children=[];for(var r=0,n=this.children;r<n.length;r++){var a=n[r];if(a.isSerializable||i){var s={};a.serialize(s,i,o),e.children.push(s)}}}},e.prototype.dispose=function(){var e;t.prototype.dispose.call(this);for(var i=this.children.length-1;i>=0;i--)this.children[i].dispose();null===(e=this._intermediateTexture)||void 0===e||e.dispose()},e.prototype._parseFromContent=function(e,i,o){var r;if(t.prototype._parseFromContent.call(this,e,i,o),this._link(i),e.backgroundGradient){var n=h.Tools.Instantiate("BABYLON.GUI."+e.backgroundGradient.className);this._backgroundGradient=new n,null===(r=this._backgroundGradient)||void 0===r||r.parse(e.backgroundGradient)}if(e.children)for(var a=0,s=e.children;a<s.length;a++){var l=s[a];this.addControl(y.Parse(l,i,o))}},e.prototype.isReady=function(){for(var t=0,e=this.children;t<e.length;t++)if(!e[t].isReady())return!1;return!0},s([(0,h.serialize)()],e.prototype,"delegatePickingToChildren",void 0),s([(0,h.serialize)()],e.prototype,"renderToIntermediateTexture",null),s([(0,h.serialize)()],e.prototype,"maxLayoutCycle",void 0),s([(0,h.serialize)()],e.prototype,"adaptHeightToChildren",null),s([(0,h.serialize)()],e.prototype,"adaptWidthToChildren",null),s([(0,h.serialize)()],e.prototype,"background",null),s([(0,h.serialize)()],e.prototype,"backgroundGradient",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.Container",x);var P,I=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thickness=1,i._cornerRadius=[0,0,0,0],i._cachedRadius=[0,0,0,0],i}return n(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,"cornerRadius",{get:function(){return this._cornerRadius[0]},set:function(t){t<0&&(t=0),this._cornerRadius[0]===t&&this._cornerRadius[1]===t&&this._cornerRadius[2]===t&&this._cornerRadius[3]===t||(this._cornerRadius[0]=this._cornerRadius[1]=this._cornerRadius[2]=this._cornerRadius[3]=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cornerRadiusX",{get:function(){return this._cornerRadius[0]},set:function(t){this._cornerRadius[0]!==t&&(this._cornerRadius[0]=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cornerRadiusY",{get:function(){return this._cornerRadius[1]},set:function(t){this._cornerRadius[1]!==t&&(this._cornerRadius[1]=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cornerRadiusZ",{get:function(){return this._cornerRadius[2]},set:function(t){this._cornerRadius[2]!==t&&(this._cornerRadius[2]=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cornerRadiusW",{get:function(){return this._cornerRadius[3]},set:function(t){this._cornerRadius[3]!==t&&(this._cornerRadius[3]=t)},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Rectangle"},e.prototype._computeAdditionalOffsetX=function(){var t=0;return 0===this._cornerRadius[0]&&0===this._cornerRadius[1]&&0===this._cornerRadius[2]&&0===this._cornerRadius[3]||(t+=1),this.thickness&&(t+=this.thickness/2),t},e.prototype._computeAdditionalOffsetY=function(){var t=0;return 0===this._cornerRadius[0]&&0===this._cornerRadius[1]&&0===this._cornerRadius[2]&&0===this._cornerRadius[3]||(t+=1),this.thickness&&(t+=this.thickness/2),t},e.prototype._getRectangleFill=function(t){return this._getBackgroundColor(t)},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),(this._background||this._backgroundGradient)&&(t.fillStyle=this._getRectangleFill(t),0!==this._cornerRadius[0]||0!==this._cornerRadius[1]||0!==this._cornerRadius[2]||0!==this._cornerRadius[3]?(this._drawRoundedRect(t,this._thickness/2),t.fill()):t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._thickness&&((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),(this.color||this.gradient)&&(t.strokeStyle=this.gradient?this.gradient.getCanvasGradient(t):this.color),t.lineWidth=this._thickness,0!==this._cornerRadius[0]||0!==this._cornerRadius[1]||0!==this._cornerRadius[2]||0!==this._cornerRadius[3]?(this._drawRoundedRect(t,this._thickness/2),t.stroke()):t.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness)),t.restore()},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},e.prototype._drawRoundedRect=function(t,e){void 0===e&&(e=0);for(var i=this._currentMeasure.left+e,o=this._currentMeasure.top+e,r=this._currentMeasure.width-2*e,n=this._currentMeasure.height-2*e,a=0;a<this._cornerRadius.length;a++)this._cachedRadius[a]=Math.abs(Math.min(n/2,Math.min(r/2,this._cornerRadius[a])));t.beginPath(),t.moveTo(i+this._cachedRadius[0],o),t.lineTo(i+r-this._cachedRadius[1],o),t.arc(i+r-this._cachedRadius[1],o+this._cachedRadius[1],this._cachedRadius[1],3*Math.PI/2,2*Math.PI),t.lineTo(i+r,o+n-this._cachedRadius[2]),t.arc(i+r-this._cachedRadius[2],o+n-this._cachedRadius[2],this._cachedRadius[2],0,Math.PI/2),t.lineTo(i+this._cachedRadius[3],o+n),t.arc(i+this._cachedRadius[3],o+n-this._cachedRadius[3],this._cachedRadius[3],Math.PI/2,Math.PI),t.lineTo(i,o+this._cachedRadius[0]),t.arc(i+this._cachedRadius[0],o+this._cachedRadius[0],this._cachedRadius[0],Math.PI,3*Math.PI/2),t.closePath()},e.prototype._clipForChildren=function(t){0===this._cornerRadius[0]&&0===this._cornerRadius[1]&&0===this._cornerRadius[2]&&0===this._cornerRadius[3]||(this._drawRoundedRect(t,this._thickness),t.clip())},s([(0,h.serialize)()],e.prototype,"thickness",null),s([(0,h.serialize)()],e.prototype,"cornerRadius",null),s([(0,h.serialize)()],e.prototype,"cornerRadiusX",null),s([(0,h.serialize)()],e.prototype,"cornerRadiusY",null),s([(0,h.serialize)()],e.prototype,"cornerRadiusZ",null),s([(0,h.serialize)()],e.prototype,"cornerRadiusW",null),e}(x);(0,h.RegisterClass)("BABYLON.GUI.Rectangle",I),function(t){t[t.Clip=0]="Clip",t[t.WordWrap=1]="WordWrap",t[t.Ellipsis=2]="Ellipsis",t[t.WordWrapEllipsis=3]="WordWrapEllipsis"}(P||(P={}));var B=function(t){function e(e,i){void 0===i&&(i="");var o=t.call(this,e)||this;return o.name=e,o._text="",o._textWrapping=0,o._textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_CENTER,o._textVerticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,o._resizeToFit=!1,o._lineSpacing=new c(0),o._outlineWidth=0,o._outlineColor="white",o._underline=!1,o._lineThrough=!1,o._wordDivider=" ",o._forceResizeWidth=!1,o._applyOutlineToUnderline=!1,o.onTextChangedObservable=new h.Observable,o.onLinesReadyObservable=new h.Observable,o._linesTemp=[],o.text=i,o}return n(e,t),Object.defineProperty(e.prototype,"lines",{get:function(){return this._lines},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resizeToFit",{get:function(){return this._resizeToFit},set:function(t){this._resizeToFit!==t&&(this._resizeToFit=t,this._resizeToFit&&(this._width.ignoreAdaptiveScaling=!0,this._height.ignoreAdaptiveScaling=!0),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textWrapping",{get:function(){return this._textWrapping},set:function(t){this._textWrapping!==t&&(this._textWrapping=+t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t+"",this._markAsDirty(),this.onTextChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textHorizontalAlignment",{get:function(){return this._textHorizontalAlignment},set:function(t){this._textHorizontalAlignment!==t&&(this._textHorizontalAlignment=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textVerticalAlignment",{get:function(){return this._textVerticalAlignment},set:function(t){this._textVerticalAlignment!==t&&(this._textVerticalAlignment=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineSpacing",{get:function(){return this._lineSpacing.toString(this._host)},set:function(t){this._lineSpacing.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outlineWidth",{get:function(){return this._outlineWidth},set:function(t){this._outlineWidth!==t&&(this._outlineWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"underline",{get:function(){return this._underline},set:function(t){this._underline!==t&&(this._underline=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineThrough",{get:function(){return this._lineThrough},set:function(t){this._lineThrough!==t&&(this._lineThrough=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"applyOutlineToUnderline",{get:function(){return this._applyOutlineToUnderline},set:function(t){this._applyOutlineToUnderline!==t&&(this._applyOutlineToUnderline=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outlineColor",{get:function(){return this._outlineColor},set:function(t){this._outlineColor!==t&&(this._outlineColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wordDivider",{get:function(){return this._wordDivider},set:function(t){this._wordDivider!==t&&(this._wordDivider=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"forceResizeWidth",{get:function(){return this._forceResizeWidth},set:function(t){this._forceResizeWidth!==t&&(this._forceResizeWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"TextBlock"},e.prototype._processMeasures=function(e,i){var o;this._fontOffset&&!this.isDirty||(this._fontOffset=y._GetFontOffset(i.font,null===(o=this._host.getScene())||void 0===o?void 0:o.getEngine())),t.prototype._processMeasures.call(this,e,i),this._lines=this._breakLines(this._currentMeasure.width,this._currentMeasure.height,i),this.onLinesReadyObservable.notifyObservers(this);for(var r=0,n=0;n<this._lines.length;n++){var a=this._lines[n];a.width>r&&(r=a.width)}if(this._resizeToFit){if(0===this._textWrapping||this._forceResizeWidth){var s=Math.ceil(this._paddingLeftInPixels)+Math.ceil(this._paddingRightInPixels)+Math.ceil(r);s!==this._width.getValueInPixel(this._host,this._tempParentMeasure.width)&&(this._width.updateInPlace(s,c.UNITMODE_PIXEL),this._rebuildLayout=!0)}var l=this._paddingTopInPixels+this._paddingBottomInPixels+this._fontOffset.height*this._lines.length|0;if(this._lines.length>0&&0!==this._lineSpacing.internalValue){var _;_=this._lineSpacing.isPixel?this._lineSpacing.getValue(this._host):this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height),l+=(this._lines.length-1)*_}l!==this._height.internalValue&&(this._height.updateInPlace(l,c.UNITMODE_PIXEL),this._rebuildLayout=!0)}},e.prototype._drawText=function(t,e,i,o){var r=this._currentMeasure.width,n=0;switch(this._textHorizontalAlignment){case y.HORIZONTAL_ALIGNMENT_LEFT:n=0;break;case y.HORIZONTAL_ALIGNMENT_RIGHT:n=r-e;break;case y.HORIZONTAL_ALIGNMENT_CENTER:n=(r-e)/2}(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(o.shadowColor=this.shadowColor,o.shadowBlur=this.shadowBlur,o.shadowOffsetX=this.shadowOffsetX,o.shadowOffsetY=this.shadowOffsetY),this.outlineWidth&&o.strokeText(t,this._currentMeasure.left+n,i),o.fillText(t,this._currentMeasure.left+n,i),this._underline&&this._drawLine(this._currentMeasure.left+n,i+3,this._currentMeasure.left+n+e,i+3,o),this._lineThrough&&this._drawLine(this._currentMeasure.left+n,i-this.fontSizeInPixels/3,this._currentMeasure.left+n+e,i-this.fontSizeInPixels/3,o)},e.prototype._drawLine=function(t,e,i,o,r){if(r.beginPath(),r.lineWidth=Math.round(.05*this.fontSizeInPixels),r.moveTo(t,e),r.lineTo(i,o),this.outlineWidth&&this.applyOutlineToUnderline)r.stroke(),r.fill();else{var n=r.strokeStyle;r.strokeStyle=r.fillStyle,r.stroke(),r.strokeStyle=n}r.closePath()},e.prototype._draw=function(t){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 o,r;this._linesTemp.length=0;var n=this.text.split("\n");if(2===this._textWrapping)for(var a=0,s=n;a<s.length;a++){var l=s[a];this._linesTemp.push(this._parseLineEllipsis(l,t,i))}else if(1===this._textWrapping)for(var _=0,h=n;_<h.length;_++)l=h[_],(o=this._linesTemp).push.apply(o,this._parseLineWordWrap(l,t,i));else if(3===this._textWrapping)for(var c=0,u=n;c<u.length;c++)l=u[c],(r=this._linesTemp).push.apply(r,this._parseLineWordWrapEllipsis(l,t,e,i));else for(var d=0,f=n;d<f.length;d++)l=f[d],this._linesTemp.push(this._parseLine(l,i));return this._linesTemp},e.prototype._parseLine=function(t,e){return void 0===t&&(t=""),{text:t,width:this._getTextMetricsWidth(e.measureText(t))}},e.prototype._getCharsToRemove=function(t,e,i){var o=t>e?t-e:0,r=t/i;return Math.max(Math.floor(o/r),1)},e.prototype._parseLineEllipsis=function(t,e,i){void 0===t&&(t="");var o=this._getTextMetricsWidth(i.measureText(t)),r=this._getCharsToRemove(o,e,t.length),n=Array.from&&Array.from(t);if(n)for(;n.length&&o>e;)n.splice(n.length-r,r),t="".concat(n.join(""),"…"),o=this._getTextMetricsWidth(i.measureText(t)),r=this._getCharsToRemove(o,e,t.length);else{for(;t.length>2&&o>e;)t=t.slice(0,-r),o=this._getTextMetricsWidth(i.measureText(t+"…")),r=this._getCharsToRemove(o,e,t.length);t+="…"}return{text:t,width:o}},e.prototype._getTextMetricsWidth=function(t){return void 0!==t.actualBoundingBoxLeft?Math.abs(t.actualBoundingBoxLeft)+Math.abs(t.actualBoundingBoxRight):t.width},e.prototype._parseLineWordWrap=function(t,e,i){void 0===t&&(t="");for(var o=[],r=this.wordSplittingFunction?this.wordSplittingFunction(t):t.split(this._wordDivider),n=this._getTextMetricsWidth(i.measureText(t)),a=0;a<r.length;a++){var s=a>0?t+this._wordDivider+r[a]:r[0],l=this._getTextMetricsWidth(i.measureText(s));l>e&&a>0?(o.push({text:t,width:n}),t=r[a],n=this._getTextMetricsWidth(i.measureText(t))):(n=l,t=s)}return o.push({text:t,width:n}),o},e.prototype._parseLineWordWrapEllipsis=function(t,e,i,o){void 0===t&&(t="");for(var r=this._parseLineWordWrap(t,e,o),n=1;n<=r.length;n++)if(this._computeHeightForLinesOf(n)>i&&n>1){var a=r[n-2],s=r[n-1];r[n-2]=this._parseLineEllipsis(a.text+this._wordDivider+s.text,e,o);for(var l=r.length-n+1,_=0;_<l;_++)r.pop();return r}return r},e.prototype._renderLines=function(t){if(this._fontOffset&&this._lines){var e=this._currentMeasure.height,i=0;switch(this._textVerticalAlignment){case y.VERTICAL_ALIGNMENT_TOP:i=this._fontOffset.ascent;break;case y.VERTICAL_ALIGNMENT_BOTTOM:i=e-this._fontOffset.height*(this._lines.length-1)-this._fontOffset.descent;break;case y.VERTICAL_ALIGNMENT_CENTER:i=this._fontOffset.ascent+(e-this._fontOffset.height*this._lines.length)/2}i+=this._currentMeasure.top;for(var o=0;o<this._lines.length;o++){var r=this._lines[o];0!==o&&0!==this._lineSpacing.internalValue&&(this._lineSpacing.isPixel?i+=this._lineSpacing.getValue(this._host):i+=this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)),this._drawText(r.text,r.width,i,t),i+=this._fontOffset.height}}},e.prototype._computeHeightForLinesOf=function(t){var e=this._paddingTopInPixels+this._paddingBottomInPixels+this._fontOffset.height*t;return t>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))),e},e.prototype.isDimensionFullyDefined=function(e){return!!this.resizeToFit||t.prototype.isDimensionFullyDefined.call(this,e)},e.prototype.computeExpectedHeight=function(){var t,e;if(this.text&&this.widthInPixels){var i=null===(t=h.EngineStore.LastCreatedEngine)||void 0===t?void 0:t.createCanvas(0,0).getContext("2d");if(i){this._applyStates(i),this._fontOffset||(this._fontOffset=y._GetFontOffset(i.font,null===(e=this._host.getScene())||void 0===e?void 0:e.getEngine()));var o=this._lines?this._lines:this._breakLines(this.widthInPixels-this._paddingLeftInPixels-this._paddingRightInPixels,this.heightInPixels-this._paddingTopInPixels-this._paddingBottomInPixels,i);return this._computeHeightForLinesOf(o.length)}}return 0},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onTextChangedObservable.clear()},s([(0,h.serialize)()],e.prototype,"resizeToFit",null),s([(0,h.serialize)()],e.prototype,"textWrapping",null),s([(0,h.serialize)()],e.prototype,"text",null),s([(0,h.serialize)()],e.prototype,"textHorizontalAlignment",null),s([(0,h.serialize)()],e.prototype,"textVerticalAlignment",null),s([(0,h.serialize)()],e.prototype,"lineSpacing",null),s([(0,h.serialize)()],e.prototype,"outlineWidth",null),s([(0,h.serialize)()],e.prototype,"underline",null),s([(0,h.serialize)()],e.prototype,"lineThrough",null),s([(0,h.serialize)()],e.prototype,"applyOutlineToUnderline",null),s([(0,h.serialize)()],e.prototype,"outlineColor",null),s([(0,h.serialize)()],e.prototype,"wordDivider",null),s([(0,h.serialize)()],e.prototype,"forceResizeWidth",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.TextBlock",B);var C=function(t){function e(i,o){void 0===o&&(o=null);var r=t.call(this,i)||this;return r.name=i,r._workingCanvas=null,r._loaded=!1,r._stretch=e.STRETCH_FILL,r._autoScale=!1,r._sourceLeft=0,r._sourceTop=0,r._sourceWidth=0,r._sourceHeight=0,r._svgAttributesComputationCompleted=!1,r._isSVG=!1,r._cellWidth=0,r._cellHeight=0,r._cellId=-1,r._populateNinePatchSlicesFromImage=!1,r._imageDataCache={data:null,key:""},r.onImageLoadedObservable=new h.Observable,r.onSVGAttributesComputedObservable=new h.Observable,r.source=o,r}return n(e,t),Object.defineProperty(e.prototype,"isLoaded",{get:function(){return this._loaded},enumerable:!1,configurable:!0}),e.prototype.isReady=function(){return this.isLoaded},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 o,r;void 0===i&&(i=!1);var n=this._domImage.width,a=this._domImage.height,s=(null===(r=null===(o=this._host)||void 0===o?void 0:o.getScene())||void 0===r?void 0:r.getEngine())||h.EngineStore.LastCreatedEngine;if(!s)throw new Error("Invalid engine. Unable to create a canvas.");var l=s.createCanvas(a,n),_=l.getContext("2d");_.translate(l.width/2,l.height/2),_.rotate(t*Math.PI/2),_.drawImage(this._domImage,0,0,n,a,-n/2,-a/2,n,a);var c=l.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 o=this;t._isSVG&&(t._svgAttributesComputationCompleted?(this._rotate90SourceProperties(t,e,i),this._markAsDirty()):t.onSVGAttributesComputedObservable.addOnce((function(){o._rotate90SourceProperties(t,e,i),o._markAsDirty()})))},e.prototype._rotate90SourceProperties=function(t,e,i){var o,r,n=t.sourceLeft,a=t.sourceTop,s=t.domImage.width,l=t.domImage.height,_=n,h=a,c=t.sourceWidth,u=t.sourceHeight;if(0!=i){var d=i<0?-1:1;i%=4;for(var f=0;f<Math.abs(i);++f)_=-(a-l/2)*d+l/2,h=(n-s/2)*d+s/2,c=(o=[u,c])[0],u=o[1],i<0?h-=u:_-=c,n=_,a=h,s=(r=[l,s])[0],l=r[1]}e.sourceLeft=_,e.sourceTop=h,e.sourceWidth=c,e.sourceHeight=u},e.prototype._extractNinePatchSliceDataFromImage=function(){var t,e,i=this._domImage.width,o=this._domImage.height;if(!this._workingCanvas){var r=(null===(e=null===(t=this._host)||void 0===t?void 0:t.getScene())||void 0===e?void 0:e.getEngine())||h.EngineStore.LastCreatedEngine;if(!r)throw new Error("Invalid engine. Unable to create a canvas.");this._workingCanvas=r.createCanvas(i,o)}var n=this._workingCanvas.getContext("2d");n.drawImage(this._domImage,0,0,i,o);var a=n.getImageData(0,0,i,o);this._sliceLeft=-1,this._sliceRight=-1;for(var s=0;s<i;s++)if((_=a.data[4*s+3])>127&&-1===this._sliceLeft)this._sliceLeft=s;else if(_<127&&this._sliceLeft>-1){this._sliceRight=s;break}this._sliceTop=-1,this._sliceBottom=-1;for(var l=0;l<o;l++){var _;if((_=a.data[l*i*4+3])>127&&-1===this._sliceTop)this._sliceTop=l;else if(_<127&&this._sliceTop>-1){this._sliceBottom=l;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 i,o,r,n,a=this;if(this._urlRewriter&&t&&(t=this._urlRewriter(t)),this._source!==t){this._removeCacheUsage(this._source),this._loaded=!1,this._source=t,this._imageDataCache.data=null,t&&(t=this._svgCheck(t));var s=(null===(o=null===(i=this._host)||void 0===i?void 0:i.getScene())||void 0===o?void 0:o.getEngine())||h.EngineStore.LastCreatedEngine;if(!s)throw new Error("Invalid engine. Unable to create a canvas.");if(t&&e.SourceImgCache.has(t)){var l=e.SourceImgCache.get(t);return this._domImage=l.img,l.timesUsed+=1,void(l.loaded?this._onImageLoaded():l.waitingForLoadCallback.push(this._onImageLoaded.bind(this)))}this._domImage=s.createCanvasImage();var _=this._domImage;_.style&&(_.style.visibility="hidden",_.style.position="absolute",null===(n=null===(r=s.getRenderingCanvas())||void 0===r?void 0:r.parentNode)||void 0===n||n.appendChild(_)),t&&e.SourceImgCache.set(t,{img:this._domImage,timesUsed:1,loaded:!1,waitingForLoadCallback:[this._onImageLoaded.bind(this)]}),this._domImage.onload=function(){if(t){var i=e.SourceImgCache.get(t);if(i){i.loaded=!0;for(var o=0,r=i.waitingForLoadCallback;o<r.length;o++)(0,r[o])();return void(i.waitingForLoadCallback.length=0)}}a._onImageLoaded()},t&&(h.Tools.SetCorsBehavior(t,this._domImage),h.Tools.SetReferrerPolicyBehavior(this.referrerPolicy,this._domImage),this._domImage.src=t)}},enumerable:!1,configurable:!0}),e.ResetImageCache=function(){e.SourceImgCache.clear()},e.prototype._removeCacheUsage=function(t){var i=t&&e.SourceImgCache.get(t);if(i){i.timesUsed-=1;var o=i.img;o.parentNode&&o.parentNode.removeChild(o),0===i.timesUsed&&e.SourceImgCache.delete(t)}},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],o=t.split("#")[1],r=document.body.querySelector('object[data="'+i+'"]');if(r){var n=r.contentDocument;if(n&&n.documentElement){var a=n.documentElement.getAttribute("viewBox"),s=Number(n.documentElement.getAttribute("width")),l=Number(n.documentElement.getAttribute("height"));if(n.getElementById(o)&&a&&s&&l)return this._getSVGAttribs(r,o),t}r.addEventListener("load",(function(){e._getSVGAttribs(r,o)}))}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,o)}}return i}return t},e.prototype._getSVGAttribs=function(t,e){var i=t.contentDocument;if(i&&i.documentElement){var o=i.documentElement.getAttribute("viewBox"),r=Number(i.documentElement.getAttribute("width")),n=Number(i.documentElement.getAttribute("height")),a=i.getElementById(e);if(o&&r&&n&&a){var s=Number(o.split(" ")[2]),l=Number(o.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)*r/s,this.sourceTop=(c*_.y+d)*n/l,this.sourceWidth=_.width*h*(r/s),this.sourceHeight=_.height*c*(n/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 o=0|this._currentMeasure.width,r=0|this._currentMeasure.height,n=o+"_"+r,a=this._imageDataCache.data;if(!a||this._imageDataCache.key!==n){var s=this._workingCanvas.getContext("2d");this._imageDataCache.data=a=s.getImageData(0,0,o,r).data,this._imageDataCache.key=n}return a[4*((e=e-this._currentMeasure.left|0)+(i=i-this._currentMeasure.top|0)*o)+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,o){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,o)},e.prototype._prepareWorkingCanvasForOpaqueDetection=function(){var t,e;if(this._detectPointerOnOpaqueOnly){var i=this._currentMeasure.width,o=this._currentMeasure.height;if(!this._workingCanvas){var r=(null===(e=null===(t=this._host)||void 0===t?void 0:t.getScene())||void 0===e?void 0:e.getEngine())||h.EngineStore.LastCreatedEngine;if(!r)throw new Error("Invalid engine. Unable to create a canvas.");this._workingCanvas=r.createCanvas(i,o)}this._workingCanvas.getContext("2d").clearRect(0,0,i,o)}},e.prototype._drawImage=function(t,e,i,o,r,n,a,s,l){if(t.drawImage(this._domImage,e,i,o,r,n,a,s,l),this._detectPointerOnOpaqueOnly){var _=t.getTransform(),h=this._workingCanvas.getContext("2d");h.save();var c=n-this._currentMeasure.left,u=a-this._currentMeasure.top;h.setTransform(_.a,_.b,_.c,_.d,(c+s)/2,(u+l)/2),h.translate(-(c+s)/2,-(u+l)/2),h.drawImage(this._domImage,e,i,o,r,c,u,s,l),h.restore()}},e.prototype._draw=function(t){var i,o,r,n;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,o=this._sourceTop,r=this._sourceWidth?this._sourceWidth:this._imageWidth,n=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,o=this.cellHeight*s,r=this.cellWidth,n=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,o,r,n,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case e.STRETCH_UNIFORM:var _=this._currentMeasure.width/r,h=this._currentMeasure.height/n,c=Math.min(_,h),u=(this._currentMeasure.width-r*c)/2,d=(this._currentMeasure.height-n*c)/2;this._drawImage(t,i,o,r,n,this._currentMeasure.left+u,this._currentMeasure.top+d,r*c,n*c);break;case e.STRETCH_EXTEND:this._drawImage(t,i,o,r,n,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case e.STRETCH_NINE_PATCH:this._renderNinePatch(t,i,o,r,n)}t.restore()},e.prototype._renderNinePatch=function(t,e,i,o,r){var n=this.host.idealWidth?this._width.getValue(this.host)/this.host.idealWidth:this.host.idealHeight?this._height.getValue(this.host)/this.host.idealHeight:1,a=this._sliceLeft,s=this._sliceTop,l=r-this._sliceBottom,_=o-this._sliceRight,h=this._sliceRight-this._sliceLeft,c=this._sliceBottom-this._sliceTop,u=Math.round(a*n),d=Math.round(s*n),f=Math.round(l*n),p=Math.round(_*n),g=Math.round(this._currentMeasure.width)-p-u+2,b=Math.round(this._currentMeasure.height)-f-d+2,m=Math.round(this._currentMeasure.left)+u-1,v=Math.round(this._currentMeasure.top)+d-1,y=Math.round(this._currentMeasure.left+this._currentMeasure.width)-p,x=Math.round(this._currentMeasure.top+this._currentMeasure.height)-f;this._drawImage(t,e,i,a,s,this._currentMeasure.left,this._currentMeasure.top,u,d),this._drawImage(t,e+this._sliceLeft,i,h,s,m+1,this._currentMeasure.top,g-2,d),this._drawImage(t,e+this._sliceRight,i,_,s,y,this._currentMeasure.top,p,d),this._drawImage(t,e,i+this._sliceTop,a,c,this._currentMeasure.left,v+1,u,b-2),this._drawImage(t,e+this._sliceLeft,i+this._sliceTop,h,c,m+1,v+1,g-2,b-2),this._drawImage(t,e+this._sliceRight,i+this._sliceTop,_,c,y,v+1,p,b-2),this._drawImage(t,e,i+this._sliceBottom,a,l,this._currentMeasure.left,x,u,f),this._drawImage(t,e+this.sliceLeft,i+this._sliceBottom,h,l,m+1,x,g-2,f),this._drawImage(t,e+this._sliceRight,i+this._sliceBottom,_,l,y,x,p,f)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onImageLoadedObservable.clear(),this.onSVGAttributesComputedObservable.clear(),this._removeCacheUsage(this._source)},e.SourceImgCache=new Map,e.STRETCH_NONE=0,e.STRETCH_FILL=1,e.STRETCH_UNIFORM=2,e.STRETCH_EXTEND=3,e.STRETCH_NINE_PATCH=4,s([(0,h.serialize)()],e.prototype,"detectPointerOnOpaqueOnly",null),s([(0,h.serialize)()],e.prototype,"sliceLeft",null),s([(0,h.serialize)()],e.prototype,"sliceRight",null),s([(0,h.serialize)()],e.prototype,"sliceTop",null),s([(0,h.serialize)()],e.prototype,"sliceBottom",null),s([(0,h.serialize)()],e.prototype,"sourceLeft",null),s([(0,h.serialize)()],e.prototype,"sourceTop",null),s([(0,h.serialize)()],e.prototype,"sourceWidth",null),s([(0,h.serialize)()],e.prototype,"sourceHeight",null),s([(0,h.serialize)()],e.prototype,"populateNinePatchSlicesFromImage",null),s([(0,h.serialize)()],e.prototype,"autoScale",null),s([(0,h.serialize)()],e.prototype,"stretch",null),s([(0,h.serialize)()],e.prototype,"source",null),s([(0,h.serialize)()],e.prototype,"cellWidth",null),s([(0,h.serialize)()],e.prototype,"cellHeight",null),s([(0,h.serialize)()],e.prototype,"cellId",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.Image",C);var T=function(t){function e(e){var i=t.call(this,e)||this;i.name=e,i.thickness=1,i.isPointerBlocker=!0;var o=null;return i.pointerEnterAnimation=function(){o=i.alpha,i.alpha-=.1},i.pointerOutAnimation=function(){null!==o&&(i.alpha=o)},i.pointerDownAnimation=function(){i.scaleX-=.05,i.scaleY-=.05},i.pointerUpAnimation=function(){i.scaleX+=.05,i.scaleY+=.05},i}return n(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,o,r,n,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(r,e,i,o,n,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,o){void 0===o&&(o=!1),!this.isReadOnly&&this.pointerOutAnimation&&this.pointerOutAnimation(),t.prototype._onPointerOut.call(this,e,i,o)},e.prototype._onPointerDown=function(e,i,o,r,n){return!!t.prototype._onPointerDown.call(this,e,i,o,r,n)&&(!this.isReadOnly&&this.pointerDownAnimation&&this.pointerDownAnimation(),!0)},e.prototype._getRectangleFill=function(t){return this.isEnabled?this._getBackgroundColor(t):this._disabledColor},e.prototype._onPointerUp=function(e,i,o,r,n,a){!this.isReadOnly&&this.pointerUpAnimation&&this.pointerUpAnimation(),t.prototype._onPointerUp.call(this,e,i,o,r,n,a)},e.prototype.serialize=function(e,i){t.prototype.serialize.call(this,e,i),(this.isSerializable||i)&&(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 o=new this(t),r=new B(t+"_button",e);r.textWrapping=!0,r.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_CENTER,r.paddingLeft="20%",o.addControl(r);var n=new C(t+"_icon",i);return n.width="20%",n.stretch=C.STRETCH_UNIFORM,n.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,o.addControl(n),o._image=n,o._textBlock=r,o},e.CreateImageOnlyButton=function(t,e){var i=new this(t),o=new C(t+"_icon",e);return o.stretch=C.STRETCH_FILL,o.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,i.addControl(o),i._image=o,i},e.CreateSimpleButton=function(t,e){var i=new this(t),o=new B(t+"_button",e);return o.textWrapping=!0,o.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_CENTER,i.addControl(o),i._textBlock=o,i},e.CreateImageWithCenterTextButton=function(t,e,i){var o=new this(t),r=new C(t+"_icon",i);r.stretch=C.STRETCH_FILL,o.addControl(r);var n=new B(t+"_button",e);return n.textWrapping=!0,n.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_CENTER,o.addControl(n),o._image=r,o._textBlock=n,o},e}(I);(0,h.RegisterClass)("BABYLON.GUI.Button",T);var S=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 n(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 o=0,r=this._children;o<r.length;o++){var n=r[o];this._isVertical?n.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP:n.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT}t.prototype._preMeasure.call(this,e,i)},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._measureForChildren.copyFrom(e),this._measureForChildren.left=this._currentMeasure.left,this._measureForChildren.top=this._currentMeasure.top,this.isVertical&&!this._manualWidth||(this._measureForChildren.width=this._currentMeasure.width),(this.isVertical||this._manualHeight)&&(this._measureForChildren.height=this._currentMeasure.height)},e.prototype._postMeasure=function(){for(var e=0,i=0,o=this._children.length,r=0;r<o;r++){var n=this._children[r];n.isVisible&&!n.notRenderable&&(this._isVertical?(n.top!==i+"px"&&(n.top=i+"px",this._rebuildLayout=!0,n._top.ignoreAdaptiveScaling=!0),this.ignoreLayoutWarnings||n.isDimensionFullyDefined("height")?i+=n._currentMeasure.height+n._paddingTopInPixels+n._paddingBottomInPixels+(r<o-1?this._spacing:0):h.Logger.Warn("Control (Name:".concat(n.name,", UniqueId:").concat(n.uniqueId,") is using height in percentage mode inside a vertical StackPanel"),1)):(n.left!==e+"px"&&(n.left=e+"px",this._rebuildLayout=!0,n._left.ignoreAdaptiveScaling=!0),this.ignoreLayoutWarnings||n.isDimensionFullyDefined("width")?e+=n._currentMeasure.width+n._paddingLeftInPixels+n._paddingRightInPixels+(r<o-1?this._spacing:0):h.Logger.Warn("Control (Name:".concat(n.name,", UniqueId:").concat(n.uniqueId,") is using width in percentage mode inside a horizontal StackPanel"),1)))}e+=this._paddingLeftInPixels+this._paddingRightInPixels,i+=this._paddingTopInPixels+this._paddingBottomInPixels,this._doNotTrackManualChanges=!0;var a=!1,s=!1;if((!this._manualHeight||this.adaptHeightToChildren)&&this._isVertical){var l=this.height;this.height=i+"px",s=l!==this.height||!this._height.ignoreAdaptiveScaling}if((!this._manualWidth||this.adaptWidthToChildren)&&!this._isVertical){var _=this.width;this.width=e+"px",a=_!==this.width||!this._width.ignoreAdaptiveScaling}s&&(this._height.ignoreAdaptiveScaling=!0),a&&(this._width.ignoreAdaptiveScaling=!0),this._doNotTrackManualChanges=!1,(a||s)&&(this._rebuildLayout=!0),t.prototype._postMeasure.call(this)},e.prototype._getManualDim=function(t){return"width"===t?this._manualWidth:this._manualHeight},e.prototype.isDimensionFullyDefined=function(t){if("height"===t?this.isVertical:!this.isVertical&&!this._getManualDim(t)){for(var e=0,i=this._children;e<i.length;e++)if(!i[e].isDimensionFullyDefined(t))return!1;return!0}return this.getDimension(t).isPixel||this._getAdaptDimTo(t)},e.prototype.serialize=function(e,i){t.prototype.serialize.call(this,e,i),(this.isSerializable||i)&&(e.manualWidth=this._manualWidth,e.manualHeight=this._manualHeight)},e.prototype._parseFromContent=function(e,i){this._manualWidth=e.manualWidth,this._manualHeight=e.manualHeight,t.prototype._parseFromContent.call(this,e,i)},s([(0,h.serialize)()],e.prototype,"ignoreLayoutWarnings",void 0),s([(0,h.serialize)()],e.prototype,"isVertical",null),s([(0,h.serialize)()],e.prototype,"spacing",null),s([(0,h.serialize)()],e.prototype,"width",null),s([(0,h.serialize)()],e.prototype,"height",null),e}(x);(0,h.RegisterClass)("BABYLON.GUI.StackPanel",S);var O=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.onIsCheckedChangedObservable=new h.Observable,i.isPointerBlocker=!0,i}return n(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){this._isChecked!==t&&(this._isChecked=t,this._markAsDirty(),this.onIsCheckedChangedObservable.notifyObservers(t))},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Checkbox"},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),t.fillStyle=this._isEnabled?this._background:this._disabledColor,t.fillRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,e,i),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),this._isChecked){t.fillStyle=this._isEnabled?this.color?this.color:"#ffffff":this._disabledColorItem;var o=e*this._checkSizeRatio,r=i*this._checkSizeRatio;t.fillRect(this._currentMeasure.left+this._thickness/2+(e-o)/2,this._currentMeasure.top+this._thickness/2+(i-r)/2,o,r)}t.strokeStyle=this.color,t.lineWidth=this._thickness,t.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,e,i),t.restore()},e.prototype._onPointerDown=function(e,i,o,r,n){return!!t.prototype._onPointerDown.call(this,e,i,o,r,n)&&(this.isReadOnly||(this.isChecked=!this.isChecked),!0)},e.AddCheckBoxWithHeader=function(t,i){var o=new S;o.isVertical=!1,o.height="30px";var r=new e;r.width="20px",r.height="20px",r.isChecked=!0,r.color="green",r.onIsCheckedChangedObservable.add(i),o.addControl(r);var n=new B;return n.text=t,n.width="180px",n.paddingLeft="5px",n.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,n.color="white",o.addControl(n),o},s([(0,h.serialize)()],e.prototype,"thickness",null),s([(0,h.serialize)()],e.prototype,"checkSizeRatio",null),s([(0,h.serialize)()],e.prototype,"background",null),s([(0,h.serialize)()],e.prototype,"isChecked",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.Checkbox",O);var R=function(){function t(){}return Object.defineProperty(t.prototype,"text",{get:function(){return this._characters?this._characters.join(""):this._text},set:function(t){this._text=t,this._characters=Array.from&&Array.from(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this._characters?this._characters.length:this._text.length},enumerable:!1,configurable:!0}),t.prototype.removePart=function(t,e,i){var o;if(this._text=this._text.slice(0,t)+(i||"")+this._text.slice(e),this._characters){var r=i?Array.from(i):[];(o=this._characters).splice.apply(o,function(t,e,i){if(i||2===arguments.length)for(var o,r=0,n=e.length;r<n;r++)!o&&r in e||(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}([t,e-t],r,!1))}},t.prototype.charAt=function(t){return this._characters?this._characters[t]:this._text.charAt(t)},t.prototype.substr=function(t,e){if(this._characters){t=isNaN(t)?0:t>=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=[],o=0;t<e;)i[o++]=this._characters[t++];return i.join("")}return this._text.substring(t,e)},t.prototype.isWord=function(t){var e=/\w/g;return this._characters?-1!==this._characters[t].search(e):-1!==this._text.search(e)},t}(),w=function(t){function e(e,i){void 0===i&&(i="");var o=t.call(this,e)||this;return o.name=e,o._placeholderText="",o._background="#222222",o._focusedBackground="#000000",o._placeholderColor="gray",o._thickness=1,o._margin=new c(10,c.UNITMODE_PIXEL),o._autoStretchWidth=!0,o._maxWidth=new c(1,c.UNITMODE_PERCENTAGE,!1),o._blinkIsEven=!1,o._cursorOffset=0,o._deadKey=!1,o._addKey=!0,o._currentKey="",o._isTextHighlightOn=!1,o._textHighlightColor="#d5e0ff",o._highligherOpacity=.4,o._highlightedText="",o._startHighlightIndex=0,o._endHighlightIndex=0,o._cursorIndex=-1,o._outlineWidth=0,o._outlineColor="white",o._onFocusSelectAll=!1,o._isPointerDown=!1,o.promptMessage="Please enter text:",o.disableMobilePrompt=!1,o.onTextChangedObservable=new h.Observable,o.onBeforeKeyAddObservable=new h.Observable,o.onTextHighlightObservable=new h.Observable,o.onTextCopyObservable=new h.Observable,o.onTextCutObservable=new h.Observable,o.onTextPasteObservable=new h.Observable,o.text=i,o.isPointerBlocker=!0,o._focusedColor="white",o}return n(e,t),Object.defineProperty(e.prototype,"outlineWidth",{get:function(){return this._outlineWidth},set:function(t){this._outlineWidth!==t&&(this._outlineWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outlineColor",{get:function(){return this._outlineColor},set:function(t){this._outlineColor!==t&&(this._outlineColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxWidth",{get:function(){return this._maxWidth.toString(this._host)},set:function(t){this._maxWidth.toString(this._host)!==t&&this._maxWidth.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxWidthInPixels",{get:function(){return this._maxWidth.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highligherOpacity",{get:function(){return this._highligherOpacity},set:function(t){this._highligherOpacity!==t&&(this._highligherOpacity=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onFocusSelectAll",{get:function(){return this._onFocusSelectAll},set:function(t){this._onFocusSelectAll!==t&&(this._onFocusSelectAll=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textHighlightColor",{get:function(){return this._textHighlightColor},set:function(t){this._textHighlightColor!==t&&(this._textHighlightColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"margin",{get:function(){return this._margin.toString(this._host)},set:function(t){this._margin.toString(this._host)!==t&&this._margin.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"marginInPixels",{get:function(){return this._margin.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"autoStretchWidth",{get:function(){return this._autoStretchWidth},set:function(t){this._autoStretchWidth!==t&&(this._autoStretchWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),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,"focusedBackground",{get:function(){return this._focusedBackground},set:function(t){this._focusedBackground!==t&&(this._focusedBackground=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"focusedColor",{set:function(t){this._focusedColor!==t&&(this._focusedColor=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,"placeholderColor",{get:function(){return this._placeholderColor},set:function(t){this._placeholderColor!==t&&(this._placeholderColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"placeholderText",{get:function(){return this._placeholderText},set:function(t){this._placeholderText!==t&&(this._placeholderText=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deadKey",{get:function(){return this._deadKey},set:function(t){this._deadKey=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highlightedText",{get:function(){return this._highlightedText},set:function(t){this._highlightedText!==t&&(this._highlightedText=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"addKey",{get:function(){return this._addKey},set:function(t){this._addKey=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentKey",{get:function(){return this._currentKey},set:function(t){this._currentKey=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._textWrapper.text},set:function(t){var e=t.toString();this._textWrapper||(this._textWrapper=new R),this._textWrapper.text!==e&&(this._textWrapper.text=e,this._textHasChanged())},enumerable:!1,configurable:!0}),e.prototype._textHasChanged=function(){this._markAsDirty(),this.onTextChangedObservable.notifyObservers(this)},e.prototype._applyStates=function(e){t.prototype._applyStates.call(this,e),this.outlineWidth&&(e.lineWidth=this.outlineWidth,e.strokeStyle=this.outlineColor)},Object.defineProperty(e.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(t){(this._width.toString(this._host)!==t||this._autoStretchWidth)&&(this._width.fromString(t)&&this._markAsDirty(),this.autoStretchWidth=!1)},enumerable:!1,configurable:!0}),e.prototype.onBlur=function(){this._isFocused=!1,this._scrollLeft=null,this._cursorOffset=0,clearTimeout(this._blinkTimeout),this._markAsDirty(),this.onBlurObservable.notifyObservers(this),this._host.unRegisterClipboardEvents(),this._onClipboardObserver&&this._host.onClipboardObservable.remove(this._onClipboardObserver);var t=this._host.getScene();this._onPointerDblTapObserver&&t&&t.onPointerObservable.remove(this._onPointerDblTapObserver)},e.prototype.onFocus=function(){var t=this;if(this._isEnabled){if(this._scrollLeft=null,this._isFocused=!0,this._blinkIsEven=!1,this._cursorOffset=0,this._markAsDirty(),this.onFocusObservable.notifyObservers(this),"touch"===this._focusedBy&&!this.disableMobilePrompt){var e=prompt(this.promptMessage);return null!==e&&(this.text=e),void(this._host.focusedControl=null)}this._host.registerClipboardEvents(),this._onClipboardObserver=this._host.onClipboardObservable.add((function(e){switch(e.type){case h.ClipboardEventTypes.COPY:t._onCopyText(e.event),t.onTextCopyObservable.notifyObservers(t);break;case h.ClipboardEventTypes.CUT:t._onCutText(e.event),t.onTextCutObservable.notifyObservers(t);break;case h.ClipboardEventTypes.PASTE:t._onPasteText(e.event),t.onTextPasteObservable.notifyObservers(t);break;default:return}}));var i=this._host.getScene();i&&(this._onPointerDblTapObserver=i.onPointerObservable.add((function(e){t._isFocused&&e.type===h.PointerEventTypes.POINTERDOUBLETAP&&t._processDblClick(e)}))),this._onFocusSelectAll&&this._selectAllText()}},e.prototype._getTypeName=function(){return"InputText"},e.prototype.keepsFocusWith=function(){return this._connectedVirtualKeyboard?[this._connectedVirtualKeyboard]:null},e.prototype.processKey=function(t,e,i){var o;if(!this.isReadOnly&&(!i||!i.ctrlKey&&!i.metaKey||67!==t&&86!==t&&88!==t)){if(i&&(i.ctrlKey||i.metaKey)&&65===t)return this._selectAllText(),void i.preventDefault();switch(t){case 32:e=" ";break;case 191:i&&i.preventDefault();break;case 8:if(this._textWrapper.text&&this._textWrapper.length>0){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());0===this._cursorOffset?this.text=this._textWrapper.substr(0,this._textWrapper.length-1):(r=this._textWrapper.length-this._cursorOffset)>0&&(this._textWrapper.removePart(r-1,r),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 r=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(r,r+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._cursorIndex<this._cursorOffset?(this._endHighlightIndex=this._textWrapper.length-this._cursorIndex,this._startHighlightIndex=this._textWrapper.length-this._cursorOffset):this._cursorIndex>this._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._cursorIndex<this._cursorOffset?(this._endHighlightIndex=this._textWrapper.length-this._cursorIndex,this._startHighlightIndex=this._textWrapper.length-this._cursorOffset):this._cursorIndex>this._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()}if(32===t&&(e=null!==(o=null==i?void 0:i.key)&&void 0!==o?o:" "),this._deadKey="Dead"===e,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&&!this._deadKey))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+=this._deadKey&&(null==i?void 0:i.key)?i.key:e;else{var n=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(n,n,e),this._textHasChanged()}}},e.prototype._updateValueFromCursorIndex=function(t){if(this._blinkIsEven=!1,-1===this._cursorIndex)this._cursorIndex=t;else if(this._cursorIndex<this._cursorOffset)this._endHighlightIndex=this._textWrapper.length-this._cursorIndex,this._startHighlightIndex=this._textWrapper.length-this._cursorOffset;else{if(!(this._cursorIndex>this._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._endHighlightIndex<this._textWrapper.length&&this._textWrapper.isWord(this._endHighlightIndex)?++this._endHighlightIndex:0,e=this._startHighlightIndex>0&&this._textWrapper.isWord(this._startHighlightIndex-1)?--this._startHighlightIndex:0}while(e||i);this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,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(e){this.processKey(e.keyCode,e.key,e),t.prototype.processKeyboard.call(this,e)},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){var e,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=y._GetFontOffset(t.font,null===(e=this._host.getScene())||void 0===e?void 0:e.getEngine()));var o=this._currentMeasure.left+this._margin.getValueInPixel(this._host,this._tempParentMeasure.width);this.color&&(t.fillStyle=this.color);var r=this._beforeRenderText(this._textWrapper);this._isFocused||this._textWrapper.text||!this._placeholderText||((r=new R).text=this._placeholderText,this._placeholderColor&&(t.fillStyle=this._placeholderColor)),this._textWidth=t.measureText(r.text).width;var n=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+n)+"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)-n;if(t.save(),t.beginPath(),t.rect(o,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,s+2,this._currentMeasure.height),t.clip(),this._isFocused&&this._textWidth>s){var l=o-this._textWidth+s;this._scrollLeft||(this._scrollLeft=l)}else this._scrollLeft=o;if(this.outlineWidth&&t.strokeText(r.text,this._scrollLeft,this._currentMeasure.top+a),t.fillText(r.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(r.substr(r.length-this._cursorOffset,this._cursorOffset)).width}while(h<_&&r.length>=this._cursorOffset);Math.abs(_-h)>c&&this._cursorOffset--,this._blinkIsEven=!1,this._clickedCoordinate=null}if(!this._blinkIsEven){var u=r.substr(r.length-this._cursorOffset),d=t.measureText(u).width,f=this._scrollLeft+this._textWidth-d;f<o?(this._scrollLeft+=o-f,f=o,this._markAsDirty()):f>o+s&&(this._scrollLeft+=o+s-f,f=o+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(r.substring(this._startHighlightIndex)).width,g=this._scrollLeft+this._textWidth-p;this._highlightedText=r.substring(this._startHighlightIndex,this._endHighlightIndex);var b=t.measureText(r.substring(this._startHighlightIndex,this._endHighlightIndex)).width;g<o&&((b-=o-g)||(b=t.measureText(r.charAt(r.length-this._cursorOffset)).width),g=o),t.globalAlpha=this._highligherOpacity,t.fillStyle=this._textHighlightColor,t.fillRect(g,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,b,this._fontOffset.height),t.globalAlpha=1}}t.restore(),this._thickness&&(this._isFocused?this.focusedColor&&(t.strokeStyle=this.focusedColor):this.color&&(t.strokeStyle=this.color),t.lineWidth=this._thickness,t.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness)),t.restore()},e.prototype._onPointerDown=function(e,i,o,r,n){return!(!t.prototype._onPointerDown.call(this,e,i,o,r,n)||!this.isReadOnly&&(this._clickedCoordinate=i.x,this.isTextHighlightOn=!1,this._highlightedText="",this._cursorIndex=-1,this._isPointerDown=!0,this._host._capturingControl[o]=this,this._focusedBy=n.event.pointerType,this._host.focusedControl===this?(clearTimeout(this._blinkTimeout),this._markAsDirty(),0):!this._isEnabled||(this._host.focusedControl=this,0)))},e.prototype._onPointerMove=function(e,i,o,r){this._host.focusedControl===this&&this._isPointerDown&&!this.isReadOnly&&(this._clickedCoordinate=i.x,this._markAsDirty(),this._updateValueFromCursorIndex(this._cursorOffset)),t.prototype._onPointerMove.call(this,e,i,o,r)},e.prototype._onPointerUp=function(e,i,o,r,n){this._isPointerDown=!1,delete this._host._capturingControl[o],t.prototype._onPointerUp.call(this,e,i,o,r,n)},e.prototype._beforeRenderText=function(t){return t},Object.defineProperty(e.prototype,"isTextHighlightOn",{get:function(){return this._isTextHighlightOn},set:function(t){this._isTextHighlightOn!==t&&(t&&this.onTextHighlightObservable.notifyObservers(this),this._isTextHighlightOn=t)},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onBlurObservable.clear(),this.onFocusObservable.clear(),this.onTextChangedObservable.clear(),this.onTextCopyObservable.clear(),this.onTextCutObservable.clear(),this.onTextPasteObservable.clear(),this.onTextHighlightObservable.clear(),this.onKeyboardEventProcessedObservable.clear()},s([(0,h.serialize)()],e.prototype,"promptMessage",void 0),s([(0,h.serialize)()],e.prototype,"disableMobilePrompt",void 0),s([(0,h.serialize)()],e.prototype,"maxWidth",null),s([(0,h.serialize)()],e.prototype,"highligherOpacity",null),s([(0,h.serialize)()],e.prototype,"onFocusSelectAll",null),s([(0,h.serialize)()],e.prototype,"textHighlightColor",null),s([(0,h.serialize)()],e.prototype,"margin",null),s([(0,h.serialize)()],e.prototype,"autoStretchWidth",null),s([(0,h.serialize)()],e.prototype,"thickness",null),s([(0,h.serialize)()],e.prototype,"focusedBackground",null),s([(0,h.serialize)()],e.prototype,"background",null),s([(0,h.serialize)()],e.prototype,"placeholderColor",null),s([(0,h.serialize)()],e.prototype,"placeholderText",null),s([(0,h.serialize)()],e.prototype,"deadKey",null),s([(0,h.serialize)()],e.prototype,"text",null),s([(0,h.serialize)()],e.prototype,"width",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.InputText",w);var M=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._rowDefinitions=new Array,i._rowDefinitionObservers=[],i._columnDefinitions=new Array,i._columnDefinitionObservers=[],i._cells={},i._childControls=new Array,i}return n(e,t),Object.defineProperty(e.prototype,"clipContent",{get:function(){return this._clipContent},set:function(t){for(var e in this._clipContent=t,this._cells)this._cells[e].clipContent=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clipChildren",{get:function(){return this._clipChildren},set:function(t){for(var e in this._clipChildren=t,this._cells)this._cells[e].clipChildren=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"columnCount",{get:function(){return this._columnDefinitions.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rowCount",{get:function(){return this._rowDefinitions.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){return this._childControls},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cells",{get:function(){return this._cells},enumerable:!1,configurable:!0}),e.prototype.getRowDefinition=function(t){return t<0||t>=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 c(t,e?c.UNITMODE_PIXEL:c.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 c(t,e?c.UNITMODE_PIXEL:c.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 o=this;if(void 0===i&&(i=!1),t<0||t>=this._rowDefinitions.length)return this;var r=this._rowDefinitions[t];return r&&r.isPixel===i&&r.value===e||(this._rowDefinitions[t].onChangedObservable.remove(this._rowDefinitionObservers[t]),this._rowDefinitions[t]=new c(e,i?c.UNITMODE_PIXEL:c.UNITMODE_PERCENTAGE),this._rowDefinitionObservers[t]=this._rowDefinitions[t].onChangedObservable.add((function(){return o._markAsDirty()})),this._markAsDirty()),this},e.prototype.setColumnDefinition=function(t,e,i){var o=this;if(void 0===i&&(i=!1),t<0||t>=this._columnDefinitions.length)return this;var r=this._columnDefinitions[t];return r&&r.isPixel===i&&r.value===e||(this._columnDefinitions[t].onChangedObservable.remove(this._columnDefinitionObservers[t]),this._columnDefinitions[t]=new c(e,i?c.UNITMODE_PIXEL:c.UNITMODE_PERCENTAGE),this._columnDefinitionObservers[t]=this._columnDefinitions[t].onChangedObservable.add((function(){return o._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 o=0,r=e.children;o<r.length;o++){var n=r[o],a=this._childControls.indexOf(n);-1!==a&&this._childControls.splice(a,1)}delete this._cells[i]}},e.prototype._offsetCell=function(t,e){if(this._cells[e]){this._cells[t]=this._cells[e];for(var i=0,o=this._cells[t].children;i<o.length;i++)o[i]._tag=t;delete this._cells[e]}},e.prototype.removeColumnDefinition=function(t){if(t<0||t>=this._columnDefinitions.length)return this;for(var e=0;e<this._rowDefinitions.length;e++){var i="".concat(e,":").concat(t),o=this._cells[i];this._removeCell(o,i)}for(e=0;e<this._rowDefinitions.length;e++)for(var r=t+1;r<this._columnDefinitions.length;r++){var n="".concat(e,":").concat(r-1);i="".concat(e,":").concat(r),this._offsetCell(n,i)}return this._columnDefinitions[t].onChangedObservable.remove(this._columnDefinitionObservers[t]),this._columnDefinitions.splice(t,1),this._columnDefinitionObservers.splice(t,1),this._markAsDirty(),this},e.prototype.removeRowDefinition=function(t){if(t<0||t>=this._rowDefinitions.length)return this;for(var e=0;e<this._columnDefinitions.length;e++){var i="".concat(t,":").concat(e),o=this._cells[i];this._removeCell(o,i)}for(e=0;e<this._columnDefinitions.length;e++)for(var r=t+1;r<this._rowDefinitions.length;r++){var n="".concat(r-1,":").concat(e);i="".concat(r,":").concat(e),this._offsetCell(n,i)}return this._rowDefinitions[t].onChangedObservable.remove(this._rowDefinitionObservers[t]),this._rowDefinitions.splice(t,1),this._rowDefinitionObservers.splice(t,1),this._markAsDirty(),this},e.prototype.addControl=function(e,i,o){if(void 0===i&&(i=0),void 0===o&&(o=0),0===this._rowDefinitions.length&&this.addRowDefinition(1,!1),0===this._columnDefinitions.length&&this.addColumnDefinition(1,!1),-1!==this._childControls.indexOf(e))return h.Tools.Warn("Control (Name:".concat(e.name,", UniqueId:").concat(e.uniqueId,") is already associated with this grid. You must remove it before reattaching it")),this;var r=Math.min(i,this._rowDefinitions.length-1),n=Math.min(o,this._columnDefinitions.length-1),a="".concat(r,":").concat(n),s=this._cells[a];return s||(s=new x(a),this._cells[a]=s,s.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,s.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,s.clipContent=this.clipContent,s.clipChildren=this.clipChildren,t.prototype.addControl.call(this,s)),s.addControl(e),this._childControls.push(e),e._tag=a,e.parent=this,this._markAsDirty(),this},e.prototype.removeControl=function(t){var e=this._childControls.indexOf(t);-1!==e&&this._childControls.splice(e,1);var i=this._cells[t._tag];return i&&(i.removeControl(t),t._tag=null),this._markAsDirty(),this},e.prototype._getTypeName=function(){return"Grid"},e.prototype._getGridDefinitions=function(t){for(var e=[],i=[],o=[],r=[],n=this._currentMeasure.width,a=0,s=this._currentMeasure.height,l=0,_=0,h=0,c=this._rowDefinitions;h<c.length;h++)(g=c[h]).isPixel?(s-=p=g.getValue(this._host),i[_]=p):l+=g.value,_++;var u=0;_=0;for(var d=0,f=this._rowDefinitions;d<f.length;d++){var p,g=f[d];r.push(u),g.isPixel?u+=g.getValue(this._host):(u+=p=Math.round(g.value/l*s),i[_]=p),_++}_=0;for(var b=0,m=this._columnDefinitions;b<m.length;b++)(I=m[b]).isPixel?(n-=P=I.getValue(this._host),e[_]=P):a+=I.value,_++;var v=0;_=0;for(var y=0,x=this._columnDefinitions;y<x.length;y++){var P,I=x[y];o.push(v),I.isPixel?v+=I.getValue(this._host):(v+=P=Math.round(I.value/a*n),e[_]=P),_++}t(o,r,e,i)},e.prototype._additionalProcessing=function(e,i){var o=this;this._getGridDefinitions((function(t,e,i,r){for(var n in o._cells)if(Object.prototype.hasOwnProperty.call(o._cells,n)){var a=n.split(":"),s=parseInt(a[0]),l=parseInt(a[1]),_=o._cells[n];_.leftInPixels=t[l],_.topInPixels=e[s],_.widthInPixels=i[l],_.heightInPixels=r[s],_._left.ignoreAdaptiveScaling=!0,_._top.ignoreAdaptiveScaling=!0,_._width.ignoreAdaptiveScaling=!0,_._height.ignoreAdaptiveScaling=!0}})),t.prototype._additionalProcessing.call(this,e,i)},e.prototype._flagDescendantsAsMatrixDirty=function(){for(var t in this._cells)Object.prototype.hasOwnProperty.call(this._cells,t)&&this._cells[t]._markMatrixAsDirty()},e.prototype._renderHighlightSpecific=function(e){var i=this;t.prototype._renderHighlightSpecific.call(this,e),this._getGridDefinitions((function(t,o,r,n){for(var a=0;a<t.length;a++){var s=i._currentMeasure.left+t[a]+r[a];e.beginPath(),e.moveTo(s,i._currentMeasure.top),e.lineTo(s,i._currentMeasure.top+i._currentMeasure.height),e.stroke()}for(a=0;a<o.length;a++){var l=i._currentMeasure.top+o[a]+n[a];e.beginPath(),e.moveTo(i._currentMeasure.left,l),e.lineTo(i._currentMeasure.left+i._currentMeasure.width,l),e.stroke()}})),e.restore()},e.prototype.dispose=function(){t.prototype.dispose.call(this);for(var e=0,i=this._childControls;e<i.length;e++)i[e].dispose();for(var o=0;o<this._rowDefinitions.length;o++)this._rowDefinitions[o].onChangedObservable.remove(this._rowDefinitionObservers[o]);for(o=0;o<this._columnDefinitions.length;o++)this._columnDefinitions[o].onChangedObservable.remove(this._columnDefinitionObservers[o]);this._rowDefinitionObservers.length=0,this._rowDefinitions.length=0,this._columnDefinitionObservers.length=0,this._columnDefinitions.length=0,this._cells={},this._childControls.length=0},e.prototype.serialize=function(e,i){if(t.prototype.serialize.call(this,e,i),this.isSerializable||i){e.columnCount=this.columnCount,e.rowCount=this.rowCount,e.columns=[],e.rows=[],e.tags=[];for(var o=0;o<this.columnCount;++o){var r=this.getColumnDefinition(o),n={value:null==r?void 0:r.getValue(this.host),unit:null==r?void 0:r.unit};e.columns.push(n)}for(o=0;o<this.rowCount;++o){var a=this.getRowDefinition(o);n={value:null==a?void 0:a.getValue(this.host),unit:null==a?void 0:a.unit},e.rows.push(n)}this.children.forEach((function(t){e.tags.push(t._tag)}))}},e.prototype._parseFromContent=function(e,i){t.prototype._parseFromContent.call(this,e,i);var o=[];this.children.forEach((function(t){o.push(t)})),this.removeRowDefinition(0),this.removeColumnDefinition(0);for(var r=0;r<e.columnCount;++r){var n=e.columns[r].value,a=e.columns[r].unit;this.addColumnDefinition(n,1===a)}for(r=0;r<e.rowCount;++r){var s=e.rows[r].value;a=e.rows[r].unit,this.addRowDefinition(s,1===a)}for(r=0;r<o.length;++r){var l=e.tags[r],_=parseInt(l.substring(0,l.search(":")));isNaN(_)&&(_=0);var h=parseInt(l.substring(l.search(":")+1));isNaN(h)&&(h=0),this.addControl(o[r],_,h)}},s([(0,h.serialize)()],e.prototype,"clipContent",null),e}(x);(0,h.RegisterClass)("BABYLON.GUI.Grid",M);var E=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._value=h.Color3.Red(),i._tmpColor=new h.Color3,i._pointerStartedOnSquare=!1,i._pointerStartedOnWheel=!1,i._squareLeft=0,i._squareTop=0,i._squareSize=0,i._h=360,i._s=1,i._v=1,i._lastPointerDownId=-1,i.onValueChangedObservable=new h.Observable,i._pointerIsDown=!1,i.value=new h.Color3(.88,.1,.1),i.size="200px",i.isPointerBlocker=!0,i}return n(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(t){this._value.equals(t)||(this._value.copyFrom(t),this._value.toHSVToRef(this._tmpColor),this._h=this._tmpColor.r,this._s=Math.max(this._tmpColor.g,1e-5),this._v=Math.max(this._tmpColor.b,1e-5),this._markAsDirty(),this._value.r<=e._Epsilon&&(this._value.r=0),this._value.g<=e._Epsilon&&(this._value.g=0),this._value.b<=e._Epsilon&&(this._value.b=0),this._value.r>=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){t.width<t.height?this._currentMeasure.height=t.width:this._currentMeasure.width=t.height},e.prototype._updateSquareProps=function(){var t=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),e=2*(t-.2*t)/Math.sqrt(2),i=t-.5*e;this._squareLeft=this._currentMeasure.left+i,this._squareTop=this._currentMeasure.top+i,this._squareSize=e},e.prototype._drawGradientSquare=function(t,e,i,o,r,n){var a=n.createLinearGradient(e,i,o+e,i);a.addColorStop(0,"#fff"),a.addColorStop(1,"hsl("+t+", 100%, 50%)"),n.fillStyle=a,n.fillRect(e,i,o,r);var s=n.createLinearGradient(e,i,e,r+i);s.addColorStop(0,"rgba(0,0,0,0)"),s.addColorStop(1,"#000"),n.fillStyle=s,n.fillRect(e,i,o,r)},e.prototype._drawCircle=function(t,e,i,o){o.beginPath(),o.arc(t,e,i+1,0,2*Math.PI,!1),o.lineWidth=3,o.strokeStyle="#333333",o.stroke(),o.beginPath(),o.arc(t,e,i,0,2*Math.PI,!1),o.lineWidth=3,o.strokeStyle="#ffffff",o.stroke()},e.prototype._createColorWheelCanvas=function(t,e){var i=h.EngineStore.LastCreatedEngine;if(!i)throw new Error("Invalid engine. Unable to create a canvas.");for(var o=i.createCanvas(2*t,2*t),r=o.getContext("2d"),n=r.getImageData(0,0,2*t,2*t),a=n.data,s=this._tmpColor,l=t*t,_=t-e,c=_*_,u=-t;u<t;u++)for(var d=-t;d<t;d++){var f=u*u+d*d;if(!(f>l||f<c)){var p=Math.sqrt(f),g=Math.atan2(d,u);h.Color3.HSVtoRGBToRef(180*g/Math.PI+180,p/t,1,s);var b=4*(u+t+2*(d+t)*t);a[b]=255*s.r,a[b+1]=255*s.g,a[b+2]=255*s.b;var m,v;v=t<50?.2:t>150?.04:-.16*(t-50)/100+.2,m=(p-_)/(t-_),a[b+3]=m<v?m/v*255:m>1-v?255*(1-(m-(1-v))/v):255}}return r.putImageData(n,0,0),o},e.prototype._draw=function(t){t.save(),this._applyStates(t);var e=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),i=.2*e,o=this._currentMeasure.left,r=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,o,r),(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 n=this._squareLeft+this._squareSize*this._s,a=this._squareTop+this._squareSize*(1-this._v);this._drawCircle(n,a,.04*e,t);var s=e-.5*i;n=o+e+Math.cos((this._h-180)*Math.PI/180)*s,a=r+e+Math.sin((this._h-180)*Math.PI/180)*s,this._drawCircle(n,a,.35*i,t),t.restore()},e.prototype._updateValueFromPointer=function(t,i){if(this._pointerStartedOnWheel){var o=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),r=o+this._currentMeasure.left,n=o+this._currentMeasure.top;this._h=180*Math.atan2(i-n,t-r)/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));h.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,o=this._squareTop,r=this._squareSize;return t>=i&&t<=i+r&&e>=o&&e<=o+r},e.prototype._isPointOnWheel=function(t,e){var i=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),o=i-.2*i,r=t-(i+this._currentMeasure.left),n=e-(i+this._currentMeasure.top),a=r*r+n*n;return a<=i*i&&a>=o*o},e.prototype._onPointerDown=function(e,i,o,r,n){if(!t.prototype._onPointerDown.call(this,e,i,o,r,n))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[o]=this,this._lastPointerDownId=o,!0},e.prototype._onPointerMove=function(e,i,o,r){if(o==this._lastPointerDownId){if(!this.isReadOnly){this._invertTransformMatrix.transformCoordinates(i.x,i.y,this._transformedPosition);var n=this._transformedPosition.x,a=this._transformedPosition.y;this._pointerIsDown&&this._updateValueFromPointer(n,a)}t.prototype._onPointerMove.call(this,e,i,o,r)}},e.prototype._onPointerUp=function(e,i,o,r,n,a){this._pointerIsDown=!1,delete this._host._capturingControl[o],t.prototype._onPointerUp.call(this,e,i,o,r,n,a)},e.prototype._onCanvasBlur=function(){this._forcePointerUp(),t.prototype._onCanvasBlur.call(this)},e.ShowPickerDialogAsync=function(t,i){return new Promise((function(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,n,a,s,l,_,c,u=i.swatchLimit/i.numSwatchesPerLine,d=parseFloat(i.pickerWidth)/i.numSwatchesPerLine,f=Math.floor(.25*d),p=f*(i.numSwatchesPerLine+1),g=Math.floor((parseFloat(i.pickerWidth)-p)/i.numSwatchesPerLine),b=g*u+f*(u+1),m=(parseInt(i.pickerHeight)+b+Math.floor(.25*g)).toString()+"px",v="#c0c0c0",x="#535353",P="#414141",C="515151",S="#555555",O="#454545",R=h.Color3.FromHexString("#dddddd"),E=R.r+R.g+R.b,F="#aaaaaa",D="#ffffff",L=["R","G","B"],k="#454545",N="#f0f0f0",A=!1,z=new M;if(z.name="Dialog Container",z.width=i.pickerWidth,i.savedColors){z.height=m;var Q=parseInt(i.pickerHeight)/parseInt(m);z.addRowDefinition(Q,!1),z.addRowDefinition(1-Q,!1)}else z.height=i.pickerHeight,z.addRowDefinition(1,!1);if(t.addControl(z),i.savedColors){(s=new M).name="Swatch Drawer",s.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,s.background=x,s.width=i.pickerWidth;var V,W=i.savedColors.length/i.numSwatchesPerLine;V=0==W?0:W+1,s.height=(g*W+V*f).toString()+"px",s.top=Math.floor(.25*g).toString()+"px";for(var H=0;H<2*Math.ceil(i.savedColors.length/i.numSwatchesPerLine)+1;H++)H%2!=0?s.addRowDefinition(g,!0):s.addRowDefinition(f,!0);for(H=0;H<2*i.numSwatchesPerLine+1;H++)H%2!=0?s.addColumnDefinition(g,!0):s.addColumnDefinition(f,!0);z.addControl(s,1,0)}var G=new M;G.name="Picker Panel",G.height=i.pickerHeight;var U=parseInt(i.headerHeight)/parseInt(i.pickerHeight),j=[U,1-U];G.addRowDefinition(j[0],!1),G.addRowDefinition(j[1],!1),z.addControl(G,0,0);var Y=new I;Y.name="Dialogue Header Bar",Y.background="#cccccc",Y.thickness=0,G.addControl(Y,0,0);var X=T.CreateSimpleButton("closeButton","a");X.fontFamily="coreglyphs";var K=h.Color3.FromHexString(Y.background),Z=new h.Color3(1-K.r,1-K.g,1-K.b);X.color=Z.toHexString(),X.fontSize=Math.floor(.6*parseInt(i.headerHeight)),X.textBlock.textVerticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,X.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_RIGHT,X.height=X.width=i.headerHeight,X.background=Y.background,X.thickness=0,X.pointerDownAnimation=function(){},X.pointerUpAnimation=function(){X.background=Y.background},X.pointerEnterAnimation=function(){X.color=Y.background,X.background="red"},X.pointerOutAnimation=function(){X.color=Z.toHexString(),X.background=Y.background},X.onPointerClickObservable.add((function(){Gt(dt.background)})),G.addControl(X,0,0);var q=new M;q.name="Dialogue Body",q.background=x;var J=[.4375,.5625];q.addRowDefinition(1,!1),q.addColumnDefinition(J[0],!1),q.addColumnDefinition(J[1],!1),G.addControl(q,1,0);var $=new M;$.name="Picker Grid",$.addRowDefinition(.85,!1),$.addRowDefinition(.15,!1),q.addControl($,0,0);var tt=new e;tt.name="GUI Color Picker",i.pickerHeight<i.pickerWidth?tt.width=.89:tt.height=.89,tt.value=h.Color3.FromHexString(i.lastColor),tt.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_CENTER,tt.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,tt.onPointerDownObservable.add((function(){c=tt.name,_="",Qt(!1)})),tt.onValueChangedObservable.add((function(t){c==tt.name&&kt(t,tt.name)})),$.addControl(tt,0,0);var et=new M;et.name="Dialogue Right Half",et.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT;var it=[.514,.486];et.addRowDefinition(it[0],!1),et.addRowDefinition(it[1],!1),q.addControl(et,1,1);var ot=new M;ot.name="Swatches and Buttons";var rt=[.417,.583];ot.addRowDefinition(1,!1),ot.addColumnDefinition(rt[0],!1),ot.addColumnDefinition(rt[1],!1),et.addControl(ot,0,0);var nt=new M;nt.name="New and Current Swatches";var at=[.04,.16,.64,.16];nt.addRowDefinition(at[0],!1),nt.addRowDefinition(at[1],!1),nt.addRowDefinition(at[2],!1),nt.addRowDefinition(at[3],!1),ot.addControl(nt,0,0);var st=new M;st.name="Active Swatches",st.width=.67,st.addRowDefinition(.5,!1),st.addRowDefinition(.5,!1),nt.addControl(st,2,0);var lt,_t=Math.floor(parseInt(i.pickerWidth)*J[1]*rt[0]*.11),ht=Math.floor(parseInt(i.pickerHeight)*j[1]*it[0]*at[1]*.5);lt=i.pickerWidth>i.pickerHeight?ht:_t;var ct=new B;ct.text="new",ct.name="New Color Label",ct.color=v,ct.fontSize=lt,nt.addControl(ct,1,0);var ut=new I;ut.name="New Color Swatch",ut.background=i.lastColor,ut.thickness=0,st.addControl(ut,0,0);var dt=T.CreateSimpleButton("currentSwatch","");dt.background=i.lastColor,dt.thickness=0,dt.onPointerClickObservable.add((function(){kt(h.Color3.FromHexString(dt.background),dt.name),Qt(!1)})),dt.pointerDownAnimation=function(){},dt.pointerUpAnimation=function(){},dt.pointerEnterAnimation=function(){},dt.pointerOutAnimation=function(){},st.addControl(dt,1,0);var ft=new I;ft.name="Swatch Outline",ft.width=.67,ft.thickness=2,ft.color="#404040",ft.isHitTestVisible=!1,nt.addControl(ft,2,0);var pt=new B;pt.name="Current Color Label",pt.text="current",pt.color=v,pt.fontSize=lt,nt.addControl(pt,3,0);var gt=new M;gt.name="Button Grid",gt.height=.8;var bt=1/3;gt.addRowDefinition(bt,!1),gt.addRowDefinition(bt,!1),gt.addRowDefinition(bt,!1),ot.addControl(gt,0,1);var mt=Math.floor(parseInt(i.pickerWidth)*J[1]*rt[1]*.67).toString()+"px",vt=Math.floor(parseInt(i.pickerHeight)*j[1]*it[0]*(parseFloat(gt.height.toString())/100)*bt*.7).toString()+"px";r=parseFloat(mt)>parseFloat(vt)?Math.floor(.45*parseFloat(vt)):Math.floor(.11*parseFloat(mt));var yt=T.CreateSimpleButton("butOK","OK");yt.width=mt,yt.height=vt,yt.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,yt.thickness=2,yt.color=v,yt.fontSize=r,yt.background=x,yt.onPointerEnterObservable.add((function(){yt.background=P})),yt.onPointerOutObservable.add((function(){yt.background=x})),yt.pointerDownAnimation=function(){yt.background=C},yt.pointerUpAnimation=function(){yt.background=P},yt.onPointerClickObservable.add((function(){Qt(!1),Gt(ut.background)})),gt.addControl(yt,0,0);var xt=T.CreateSimpleButton("butCancel","Cancel");xt.width=mt,xt.height=vt,xt.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,xt.thickness=2,xt.color=v,xt.fontSize=r,xt.background=x,xt.onPointerEnterObservable.add((function(){xt.background=P})),xt.onPointerOutObservable.add((function(){xt.background=x})),xt.pointerDownAnimation=function(){xt.background=C},xt.pointerUpAnimation=function(){xt.background=P},xt.onPointerClickObservable.add((function(){Qt(!1),Gt(dt.background)})),gt.addControl(xt,1,0),i.savedColors&&((l=T.CreateSimpleButton("butSave","Save")).width=mt,l.height=vt,l.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,l.thickness=2,l.fontSize=r,i.savedColors.length<i.swatchLimit?(l.color=v,l.background=x):Ht(l,!0),l.onPointerEnterObservable.add((function(){i.savedColors&&i.savedColors.length<i.swatchLimit&&(l.background=P)})),l.onPointerOutObservable.add((function(){i.savedColors&&i.savedColors.length<i.swatchLimit&&(l.background=x)})),l.pointerDownAnimation=function(){i.savedColors&&i.savedColors.length<i.swatchLimit&&(l.background=C)},l.pointerUpAnimation=function(){i.savedColors&&i.savedColors.length<i.swatchLimit&&(l.background=P)},l.onPointerClickObservable.add((function(){i.savedColors&&(0==i.savedColors.length&&Wt(!0),i.savedColors.length<i.swatchLimit&&Vt(ut.background,l),Qt(!1))})),i.savedColors.length>0&&Wt(!0),gt.addControl(l,2,0));var Pt=new M;Pt.name="Dialog Lower Right",Pt.addRowDefinition(.02,!1),Pt.addRowDefinition(.63,!1),Pt.addRowDefinition(.21,!1),Pt.addRowDefinition(.14,!1),et.addControl(Pt,1,0);var It=h.Color3.FromHexString(i.lastColor),Bt=new M;for(Bt.name="RGB Values",Bt.width=.82,Bt.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,Bt.addRowDefinition(1/3,!1),Bt.addRowDefinition(1/3,!1),Bt.addRowDefinition(1/3,!1),Bt.addColumnDefinition(.1,!1),Bt.addColumnDefinition(.2,!1),Bt.addColumnDefinition(.7,!1),Pt.addControl(Bt,1,0),H=0;H<L.length;H++){var Ct=new B;Ct.text=L[H],Ct.color=v,Ct.fontSize=r,Bt.addControl(Ct,H,0)}var Tt=new w;Tt.width=.83,Tt.height=.72,Tt.name="rIntField",Tt.fontSize=r,Tt.text=(255*It.r).toString(),Tt.color=N,Tt.background=k,Tt.onFocusObservable.add((function(){c=Tt.name,_=Tt.text,Qt(!1)})),Tt.onBlurObservable.add((function(){""==Tt.text&&(Tt.text="0"),Nt(Tt,"r"),c==Tt.name&&(c="")})),Tt.onTextChangedObservable.add((function(){c==Tt.name&&Nt(Tt,"r")})),Bt.addControl(Tt,0,1);var St=new w;St.width=.83,St.height=.72,St.name="gIntField",St.fontSize=r,St.text=(255*It.g).toString(),St.color=N,St.background=k,St.onFocusObservable.add((function(){c=St.name,_=St.text,Qt(!1)})),St.onBlurObservable.add((function(){""==St.text&&(St.text="0"),Nt(St,"g"),c==St.name&&(c="")})),St.onTextChangedObservable.add((function(){c==St.name&&Nt(St,"g")})),Bt.addControl(St,1,1);var Ot=new w;Ot.width=.83,Ot.height=.72,Ot.name="bIntField",Ot.fontSize=r,Ot.text=(255*It.b).toString(),Ot.color=N,Ot.background=k,Ot.onFocusObservable.add((function(){c=Ot.name,_=Ot.text,Qt(!1)})),Ot.onBlurObservable.add((function(){""==Ot.text&&(Ot.text="0"),Nt(Ot,"b"),c==Ot.name&&(c="")})),Ot.onTextChangedObservable.add((function(){c==Ot.name&&Nt(Ot,"b")})),Bt.addControl(Ot,2,1);var Rt=new w;Rt.width=.95,Rt.height=.72,Rt.name="rDecField",Rt.fontSize=r,Rt.text=It.r.toString(),Rt.color=N,Rt.background=k,Rt.onFocusObservable.add((function(){c=Rt.name,_=Rt.text,Qt(!1)})),Rt.onBlurObservable.add((function(){0!=parseFloat(Rt.text)&&""!=Rt.text||(Rt.text="0",At(Rt,"r")),c==Rt.name&&(c="")})),Rt.onTextChangedObservable.add((function(){c==Rt.name&&At(Rt,"r")})),Bt.addControl(Rt,0,2);var wt=new w;wt.width=.95,wt.height=.72,wt.name="gDecField",wt.fontSize=r,wt.text=It.g.toString(),wt.color=N,wt.background=k,wt.onFocusObservable.add((function(){c=wt.name,_=wt.text,Qt(!1)})),wt.onBlurObservable.add((function(){0!=parseFloat(wt.text)&&""!=wt.text||(wt.text="0",At(wt,"g")),c==wt.name&&(c="")})),wt.onTextChangedObservable.add((function(){c==wt.name&&At(wt,"g")})),Bt.addControl(wt,1,2);var Mt=new w;Mt.width=.95,Mt.height=.72,Mt.name="bDecField",Mt.fontSize=r,Mt.text=It.b.toString(),Mt.color=N,Mt.background=k,Mt.onFocusObservable.add((function(){c=Mt.name,_=Mt.text,Qt(!1)})),Mt.onBlurObservable.add((function(){0!=parseFloat(Mt.text)&&""!=Mt.text||(Mt.text="0",At(Mt,"b")),c==Mt.name&&(c="")})),Mt.onTextChangedObservable.add((function(){c==Mt.name&&At(Mt,"b")})),Bt.addControl(Mt,2,2);var Et=new M;Et.name="Hex Value",Et.width=.82,Et.addRowDefinition(1,!1),Et.addColumnDefinition(.1,!1),Et.addColumnDefinition(.9,!1),Pt.addControl(Et,2,0);var Ft=new B;Ft.text="#",Ft.color=v,Ft.fontSize=r,Et.addControl(Ft,0,0);var Dt=new w;Dt.width=.96,Dt.height=.72,Dt.name="hexField",Dt.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_CENTER,Dt.fontSize=r;var Lt=i.lastColor.split("#");function kt(t,e){c=e;var i=t.toHexString();if(ut.background=i,Tt.name!=c&&(Tt.text=Math.floor(255*t.r).toString()),St.name!=c&&(St.text=Math.floor(255*t.g).toString()),Ot.name!=c&&(Ot.text=Math.floor(255*t.b).toString()),Rt.name!=c&&(Rt.text=t.r.toString()),wt.name!=c&&(wt.text=t.g.toString()),Mt.name!=c&&(Mt.text=t.b.toString()),Dt.name!=c){var o=i.split("#");Dt.text=o[1]}tt.name!=c&&(tt.value=t)}function Nt(t,e){var i=t.text;if(/[^0-9]/g.test(i))t.text=_;else if(""!=i&&(Math.floor(parseInt(i))<0?i="0":Math.floor(parseInt(i))>255?i="255":isNaN(parseInt(i))&&(i="0")),c==t.name&&(_=i),""!=i){i=parseInt(i).toString(),t.text=i;var o=h.Color3.FromHexString(ut.background);c==t.name&&kt("r"==e?new h.Color3(parseInt(i)/255,o.g,o.b):"g"==e?new h.Color3(o.r,parseInt(i)/255,o.b):new h.Color3(o.r,o.g,parseInt(i)/255),t.name)}}function At(t,e){var i=t.text;if(/[^0-9.]/g.test(i))t.text=_;else{""!=i&&"."!=i&&0!=parseFloat(i)&&(parseFloat(i)<0?i="0.0":parseFloat(i)>1?i="1.0":isNaN(parseFloat(i))&&(i="0.0")),c==t.name&&(_=i),""!=i&&"."!=i&&0!=parseFloat(i)?(i=parseFloat(i).toString(),t.text=i):i="0.0";var o=h.Color3.FromHexString(ut.background);c==t.name&&kt("r"==e?new h.Color3(parseFloat(i),o.g,o.b):"g"==e?new h.Color3(o.r,parseFloat(i),o.b):new h.Color3(o.r,o.g,parseFloat(i)),t.name)}}function zt(){if(i.savedColors&&i.savedColors[a]){var t;t=A?"b":"";var e=T.CreateSimpleButton("Swatch_"+a,t);e.fontFamily="coreglyphs";var o=h.Color3.FromHexString(i.savedColors[a]),r=o.r+o.g+o.b;e.color=r>E?F:D,e.fontSize=Math.floor(.7*g),e.textBlock.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,e.height=e.width=g.toString()+"px",e.background=i.savedColors[a],e.thickness=2;var n=a;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;A?(t=n,i.savedColors&&i.savedColors.splice(t,1),i.savedColors&&0==i.savedColors.length&&(Wt(!1),A=!1),Vt("",l)):i.savedColors&&kt(h.Color3.FromHexString(i.savedColors[n]),e.name)})),e}return null}function Qt(t){if(void 0!==t&&(A=t),A){for(var e=0;e<s.children.length;e++)s.children[e].textBlock.text="b";void 0!==n&&(n.textBlock.text="Done")}else{for(e=0;e<s.children.length;e++)s.children[e].textBlock.text="";void 0!==n&&(n.textBlock.text="Edit")}}function Vt(t,e){if(i.savedColors){""!=t&&i.savedColors.push(t),a=0,s.clearControls();var o,r=Math.ceil(i.savedColors.length/i.numSwatchesPerLine);if(o=0==r?0:r+1,s.rowCount!=r+o){for(var n=s.rowCount,l=0;l<n;l++)s.removeRowDefinition(0);for(l=0;l<r+o;l++)l%2?s.addRowDefinition(g,!0):s.addRowDefinition(f,!0)}s.height=(g*r+o*f).toString()+"px";for(var _=1,h=1;_<r+o;_+=2,h++){var c;c=i.savedColors.length>h*i.numSwatchesPerLine?i.numSwatchesPerLine:i.savedColors.length-(h-1)*i.numSwatchesPerLine;for(var u=Math.min(Math.max(c,0),i.numSwatchesPerLine),d=0,p=1;d<u;d++)if(!(d>i.numSwatchesPerLine)){var b=zt();null!=b&&(s.addControl(b,_,p),p+=2,a++)}}i.savedColors.length>=i.swatchLimit?Ht(e,!0):Ht(e,!1)}}function Wt(t){t?((n=T.CreateSimpleButton("butEdit","Edit")).width=mt,n.height=vt,n.left=Math.floor(.1*parseInt(mt)).toString()+"px",n.top=(-1*parseFloat(n.left)).toString()+"px",n.verticalAlignment=y.VERTICAL_ALIGNMENT_BOTTOM,n.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,n.thickness=2,n.color=v,n.fontSize=r,n.background=x,n.onPointerEnterObservable.add((function(){n.background=P})),n.onPointerOutObservable.add((function(){n.background=x})),n.pointerDownAnimation=function(){n.background=C},n.pointerUpAnimation=function(){n.background=P},n.onPointerClickObservable.add((function(){A=!A,Qt()})),$.addControl(n,1,0)):$.removeControl(n)}function Ht(t,e){e?(t.color=S,t.background=O):(t.color=v,t.background=x)}function Gt(e){i.savedColors&&i.savedColors.length>0?o({savedColors:i.savedColors,pickedColor:e}):o({pickedColor:e}),t.removeControl(z)}Dt.text=Lt[1],Dt.color=N,Dt.background=k,Dt.onFocusObservable.add((function(){c=Dt.name,_=Dt.text,Qt(!1)})),Dt.onBlurObservable.add((function(){if(3==Dt.text.length){var t=Dt.text.split("");Dt.text=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]}""==Dt.text&&(Dt.text="000000",kt(h.Color3.FromHexString(Dt.text),"b")),c==Dt.name&&(c="")})),Dt.onTextChangedObservable.add((function(){var t=Dt.text,e=/[^0-9A-F]/i.test(t);if((Dt.text.length>6||e)&&c==Dt.name)Dt.text=_;else{if(Dt.text.length<6)for(var i=6-Dt.text.length,o=0;o<i;o++)t="0"+t;if(3==Dt.text.length){var r=Dt.text.split("");t=r[0]+r[0]+r[1]+r[1]+r[2]+r[2]}t="#"+t,c==Dt.name&&(_=Dt.text,kt(h.Color3.FromHexString(t),Dt.name))}})),Et.addControl(Dt,0,1),i.savedColors&&i.savedColors.length>0&&Vt("",l)}))},e._Epsilon=1e-6,s([(0,h.serialize)()],e.prototype,"value",null),s([(0,h.serialize)()],e.prototype,"width",null),s([(0,h.serialize)()],e.prototype,"height",null),s([(0,h.serialize)()],e.prototype,"size",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.ColorPicker",E);var F=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thickness=1,i._arc=1,i}return n(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,"arc",{get:function(){return this._arc},set:function(t){this._arc!==t&&(this._arc=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),y.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,this._arc,t),(this._backgroundGradient||this._background)&&(t.fillStyle=this._getBackgroundColor(t),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){y.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2,this._currentMeasure.height/2,this._arc,t),t.clip()},e.prototype._renderHighlightSpecific=function(t){y.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,this._arc,t),t.stroke()},s([(0,h.serialize)()],e.prototype,"thickness",null),s([(0,h.serialize)()],e.prototype,"arc",null),e}(x);(0,h.RegisterClass)("BABYLON.GUI.Ellipse",F);var D=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._unfocusedColor=i.color,i}return n(e,t),e.prototype._onPointerDown=function(e,i,o,r,n){return this.isReadOnly||this.focus(),t.prototype._onPointerDown.call(this,e,i,o,r,n)},e}(T);(0,h.RegisterClass)("BABYLON.GUI.FocusableButton",D);var L=function(t){function e(e,i){void 0===i&&(i="");var o=t.call(this,e)||this;return o.name=e,o._textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,o._textVerticalAlignment=y.VERTICAL_ALIGNMENT_TOP,o._prevText=o.text,o._lineSpacing=new c(0),o._maxHeight=new c(1,c.UNITMODE_PERCENTAGE,!1),o.onLinesReadyObservable=new h.Observable,o.text=i,o.isPointerBlocker=!0,o.onLinesReadyObservable.add((function(){return o._updateCursorPosition()})),o._highlightCursorInfo={initialStartIndex:-1,initialRelativeStartIndex:-1,initialLineIndex:-1},o._cursorInfo={globalStartIndex:0,globalEndIndex:0,relativeEndIndex:0,relativeStartIndex:0,currentLineIndex:0},o}return n(e,t),Object.defineProperty(e.prototype,"autoStretchHeight",{get:function(){return this._autoStretchHeight},set:function(t){this._autoStretchHeight!==t&&(this._autoStretchHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{set:function(t){this.fixedRatioMasterIsWidth=!1,this._height.toString(this._host)!==t&&(this._height.fromString(t)&&this._markAsDirty(),this._autoStretchHeight=!1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxHeight",{get:function(){return this._maxHeight.toString(this._host)},set:function(t){this._maxHeight.toString(this._host)!==t&&this._maxHeight.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxHeightInPixels",{get:function(){return this._maxHeight.getValueInPixel(this._host,this._cachedParentMeasure.height)},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"InputTextArea"},e.prototype.processKeyboard=function(t){this.isReadOnly||(this.alternativeProcessKey(t.code,t.key,t),this.onKeyboardEventProcessedObservable.notifyObservers(t))},e.prototype.alternativeProcessKey=function(t,e,i){if(!i||!i.ctrlKey&&!i.metaKey||"c"!==e&&"v"!==e&&"x"!==e){switch(t){case"Period":i&&i.shiftKey&&i.preventDefault();break;case"Backspace":!this._isTextHighlightOn&&this._cursorInfo.globalStartIndex>0&&(this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._cursorInfo.globalStartIndex--),this._prevText=this._textWrapper.text,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex),this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,i&&i.preventDefault(),this._blinkIsEven=!1,this._isTextHighlightOn=!1,this._textHasChanged();break;case"Delete":!this._isTextHighlightOn&&this._cursorInfo.globalEndIndex<this.text.length&&(this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex+1),this._prevText=this._textWrapper.text,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex),this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,i&&i.preventDefault(),this._blinkIsEven=!1,this._isTextHighlightOn=!1,this._textHasChanged();break;case"NumpadEnter":case"Enter":return this._prevText=this._textWrapper.text,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex,"\n"),this._cursorInfo.globalStartIndex++,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._textHasChanged();case"End":return this._cursorInfo.globalStartIndex=this.text.length,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._markAsDirty();case"Home":return this._cursorInfo.globalStartIndex=0,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._markAsDirty();case"ArrowLeft":return this._markAsDirty(),i&&i.shiftKey?((i.ctrlKey||i.metaKey)&&(this._cursorInfo.globalStartIndex-=this._cursorInfo.relativeStartIndex,this._cursorInfo.globalEndIndex=this._highlightCursorInfo.initialStartIndex),this._isTextHighlightOn?this._cursorInfo.globalEndIndex>this._highlightCursorInfo.initialStartIndex?this._cursorInfo.globalEndIndex--:this._cursorInfo.globalStartIndex--:(this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this._highlightCursorInfo.initialRelativeStartIndex=this._cursorInfo.relativeStartIndex,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._cursorInfo.globalStartIndex--,this._isTextHighlightOn=!0),this._blinkIsEven=!0,void i.preventDefault()):(this._isTextHighlightOn?this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex:i&&(i.ctrlKey||i.metaKey)?(this._cursorInfo.globalStartIndex-=this._cursorInfo.relativeStartIndex,i.preventDefault()):this._cursorInfo.globalStartIndex>0&&this._cursorInfo.globalStartIndex--,this._blinkIsEven=!1,void(this._isTextHighlightOn=!1));case"ArrowRight":if(this._markAsDirty(),i&&i.shiftKey){if(i.ctrlKey||i.metaKey){var o=this._lines[this._cursorInfo.currentLineIndex].text.length-this._cursorInfo.relativeEndIndex-1;this._cursorInfo.globalEndIndex+=o,this._cursorInfo.globalStartIndex=this._highlightCursorInfo.initialStartIndex}return this._isTextHighlightOn?this._cursorInfo.globalStartIndex<this._highlightCursorInfo.initialStartIndex?this._cursorInfo.globalStartIndex++:this._cursorInfo.globalEndIndex++:(this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this._highlightCursorInfo.initialRelativeStartIndex=this._cursorInfo.relativeStartIndex,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex++,this._isTextHighlightOn=!0),this._blinkIsEven=!0,void i.preventDefault()}return this._isTextHighlightOn?this._cursorInfo.globalStartIndex=this._cursorInfo.globalEndIndex:i&&(i.ctrlKey||i.metaKey)?(o=this._lines[this._cursorInfo.currentLineIndex].text.length-this._cursorInfo.relativeEndIndex,this._cursorInfo.globalStartIndex+=o):this._cursorInfo.globalStartIndex<this.text.length&&this._cursorInfo.globalStartIndex++,this._blinkIsEven=!1,void(this._isTextHighlightOn=!1);case"ArrowUp":if(this._blinkIsEven=!1,i&&(i.shiftKey?(this._isTextHighlightOn||(this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this._highlightCursorInfo.initialRelativeStartIndex=this._cursorInfo.relativeStartIndex),this._isTextHighlightOn=!0,this._blinkIsEven=!0):this._isTextHighlightOn=!1,i.preventDefault()),0===this._cursorInfo.currentLineIndex)this._cursorInfo.globalStartIndex=0;else{var r=this._lines[this._cursorInfo.currentLineIndex],n=this._lines[this._cursorInfo.currentLineIndex-1],a=0,s=0;!this._isTextHighlightOn||this._cursorInfo.currentLineIndex<this._highlightCursorInfo.initialLineIndex?(a=this._cursorInfo.globalStartIndex,s=this._cursorInfo.relativeStartIndex):(a=this._cursorInfo.globalEndIndex,s=this._cursorInfo.relativeEndIndex);var l=r.text.substr(0,s),_=this._contextForBreakLines.measureText(l).width,h=0,c=0;a-=s,a-=n.text.length+n.lineEnding.length;for(var u=0;h<_&&u<n.text.length;)a++,u++,c=Math.abs(_-h),h=this._contextForBreakLines.measureText(n.text.substr(0,u)).width;Math.abs(_-h)>c&&u>0&&a--,this._isTextHighlightOn?this._cursorInfo.currentLineIndex<=this._highlightCursorInfo.initialLineIndex?(this._cursorInfo.globalStartIndex=a,this._cursorInfo.globalEndIndex=this._highlightCursorInfo.initialStartIndex,this._cursorInfo.relativeEndIndex=this._highlightCursorInfo.initialRelativeStartIndex):this._cursorInfo.globalEndIndex=a:this._cursorInfo.globalStartIndex=a}return void this._markAsDirty();case"ArrowDown":if(this._blinkIsEven=!1,i&&(i.shiftKey?(this._isTextHighlightOn||(this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this._highlightCursorInfo.initialRelativeStartIndex=this._cursorInfo.relativeStartIndex),this._isTextHighlightOn=!0,this._blinkIsEven=!0):this._isTextHighlightOn=!1,i.preventDefault()),this._cursorInfo.currentLineIndex===this._lines.length-1)this._cursorInfo.globalStartIndex=this.text.length;else{r=this._lines[this._cursorInfo.currentLineIndex];var d=this._lines[this._cursorInfo.currentLineIndex+1];a=0,s=0,!this._isTextHighlightOn||this._cursorInfo.currentLineIndex<this._highlightCursorInfo.initialLineIndex?(a=this._cursorInfo.globalStartIndex,s=this._cursorInfo.relativeStartIndex):(a=this._cursorInfo.globalEndIndex,s=this._cursorInfo.relativeEndIndex),l=r.text.substr(0,s),_=this._contextForBreakLines.measureText(l).width;var f=0;c=0,a+=r.text.length-s+r.lineEnding.length;for(var p=0;f<_&&p<d.text.length;)a++,p++,c=Math.abs(_-f),f=this._contextForBreakLines.measureText(d.text.substr(0,p)).width;Math.abs(_-f)>c&&p>0&&a--,this._isTextHighlightOn?this._cursorInfo.currentLineIndex<this._highlightCursorInfo.initialLineIndex?(this._cursorInfo.globalStartIndex=a,this._cursorInfo.globalStartIndex>this._cursorInfo.globalEndIndex&&(this._cursorInfo.globalEndIndex+=this._cursorInfo.globalStartIndex,this._cursorInfo.globalStartIndex=this._cursorInfo.globalEndIndex-this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex-=this._cursorInfo.globalStartIndex)):(this._cursorInfo.globalEndIndex=a,this._cursorInfo.globalStartIndex=this._highlightCursorInfo.initialStartIndex):this._cursorInfo.globalStartIndex=a}return void this._markAsDirty()}if("a"===e&&i&&(i.ctrlKey||i.metaKey))return this._selectAllText(),void i.preventDefault();1===(null==e?void 0:e.length)&&(null==i||i.preventDefault(),this._currentKey=e,this.onBeforeKeyAddObservable.notifyObservers(this),e=this._currentKey,this._addKey&&(this._isTextHighlightOn=!1,this._blinkIsEven=!1,this._prevText=this._textWrapper.text,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex,e),this._cursorInfo.globalStartIndex+=e.length,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._textHasChanged()))}},e.prototype._parseLineWordWrap=function(t,e,i){void 0===t&&(t="");for(var o=[],r=t.split(" "),n=0,a=function(a){var s=a>0?t+" "+r[a]:r[0],l=i.measureText(s).width;if(l>e){a>0&&(n=i.measureText(t).width,o.push({text:t,width:n,lineEnding:" "})),t=r[a];var _="";t.split("").map((function(t){i.measureText(_+t).width>e&&(o.push({text:_,width:i.measureText(_).width,lineEnding:""}),_=""),_+=t})),t=_,n=i.measureText(t).width}else n=l,t=s},s=0;s<r.length;s++)a(s);return o.push({text:t,width:n,lineEnding:" "}),o},e.prototype._breakLines=function(t,e){var i=[],o=(this.text||this.placeholderText).split("\n");if(this.clipContent)for(var r=0,n=o;r<n.length;r++){var a=n[r];i.push.apply(i,this._parseLineWordWrap(a,t,e))}else for(var s=0,l=o;s<l.length;s++)a=l[s],i.push(this._parseLine(a,e));return i[i.length-1].lineEnding="\n",i},e.prototype._parseLine=function(t,e){return void 0===t&&(t=""),{text:t,width:e.measureText(t).width,lineEnding:" "}},e.prototype._preMeasure=function(t,e){var i;this._fontOffset&&!this._wasDirty||(this._fontOffset=y._GetFontOffset(e.font,null===(i=this._host.getScene())||void 0===i?void 0:i.getEngine()));var o=this._beforeRenderText(this._textWrapper).text;!this.text&&this._placeholderText&&(o=this._placeholderText),this._textWidth=e.measureText(o).width;var r=2*this._margin.getValueInPixel(this._host,t.width);if(this._autoStretchWidth){var n=o.split("\n").reduce((function(t,i){return e.measureText(i).width>e.measureText(t).width?i:t}),""),a=e.measureText(n).width;this.width=Math.min(this._maxWidth.getValueInPixel(this._host,t.width),a+r)+"px",this.autoStretchWidth=!0}if(this._availableWidth=this._width.getValueInPixel(this._host,t.width)-r,this._lines=this._breakLines(this._availableWidth,e),this._contextForBreakLines=e,this._autoStretchHeight){var s=this._lines.length*this._fontOffset.height+2*this._margin.getValueInPixel(this._host,t.height);this.height=Math.min(this._maxHeight.getValueInPixel(this._host,t.height),s)+"px",this._autoStretchHeight=!0}if(this._availableHeight=this._height.getValueInPixel(this._host,t.height)-r,this._isFocused){this._cursorInfo.currentLineIndex=0;for(var l=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length,_=0;_+l<=this._cursorInfo.globalStartIndex;)_+=l,this._cursorInfo.currentLineIndex<this._lines.length-1&&(this._cursorInfo.currentLineIndex++,l=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length)}},e.prototype._textHasChanged=function(){!this._prevText&&this._textWrapper.text&&this.placeholderText&&(this._cursorInfo.currentLineIndex=0,this._cursorInfo.globalStartIndex=1,this._cursorInfo.globalEndIndex=1,this._cursorInfo.relativeStartIndex=1,this._cursorInfo.relativeEndIndex=1),t.prototype._textHasChanged.call(this)},e.prototype._computeScroll=function(){if(this._clipTextLeft=this._currentMeasure.left+this._margin.getValueInPixel(this._host,this._cachedParentMeasure.width),this._clipTextTop=this._currentMeasure.top+this._margin.getValueInPixel(this._host,this._cachedParentMeasure.height),this._isFocused&&this._lines[this._cursorInfo.currentLineIndex].width>this._availableWidth){var t=this._clipTextLeft-this._lines[this._cursorInfo.currentLineIndex].width+this._availableWidth;this._scrollLeft||(this._scrollLeft=t)}else this._scrollLeft=this._clipTextLeft;if(this._isFocused){var e=(this._cursorInfo.currentLineIndex+1)*this._fontOffset.height,i=this._clipTextTop-e;this._scrollTop||(this._scrollTop=i)}else this._scrollTop=this._clipTextTop},e.prototype._additionalProcessing=function(){this.highlightedText="",this.onLinesReadyObservable.notifyObservers(this)},e.prototype._drawText=function(t,e,i,o){var r=this._currentMeasure.width,n=this._scrollLeft;switch(this._textHorizontalAlignment){case y.HORIZONTAL_ALIGNMENT_LEFT:n+=0;break;case y.HORIZONTAL_ALIGNMENT_RIGHT:n+=r-e;break;case y.HORIZONTAL_ALIGNMENT_CENTER:n+=(r-e)/2}(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(o.shadowColor=this.shadowColor,o.shadowBlur=this.shadowBlur,o.shadowOffsetX=this.shadowOffsetX,o.shadowOffsetY=this.shadowOffsetY),this.outlineWidth&&o.strokeText(t,this._currentMeasure.left+n,i),o.fillText(t,n,i)},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){try{t.clipboardData&&t.clipboardData.setData("text/plain",this._highlightedText)}catch(t){}this._host.clipboardData=this._highlightedText,this._prevText=this._textWrapper.text,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex),this._textHasChanged()}},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,this._isTextHighlightOn=!1,this._prevText=this._textWrapper.text,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex,e);var i=e.length-(this._cursorInfo.globalEndIndex-this._cursorInfo.globalStartIndex);this._cursorInfo.globalStartIndex+=i,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._textHasChanged()},e.prototype._draw=function(t){var e,i;this._computeScroll(),this._scrollLeft=null!==(e=this._scrollLeft)&&void 0!==e?e:0,this._scrollTop=null!==(i=this._scrollTop)&&void 0!==i?i:0,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.color&&(t.fillStyle=this.color);var o=this._currentMeasure.height,r=this._currentMeasure.width,n=0;switch(this._textVerticalAlignment){case y.VERTICAL_ALIGNMENT_TOP:n=this._fontOffset.ascent;break;case y.VERTICAL_ALIGNMENT_BOTTOM:n=o-this._fontOffset.height*(this._lines.length-1)-this._fontOffset.descent;break;case y.VERTICAL_ALIGNMENT_CENTER:n=this._fontOffset.ascent+(o-this._fontOffset.height*this._lines.length)/2}t.save(),t.beginPath(),t.fillStyle=this.fontStyle,!this._textWrapper.text&&this.placeholderText&&(t.fillStyle=this._placeholderColor),t.rect(this._clipTextLeft,this._clipTextTop,this._availableWidth+2,this._availableHeight+2),t.clip(),n+=this._scrollTop;for(var a=0;a<this._lines.length;a++){var s=this._lines[a];0!==a&&0!==this._lineSpacing.internalValue&&(this._lineSpacing.isPixel?n+=this._lineSpacing.getValue(this._host):n+=this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)),this._drawText(s.text,s.width,n,t),n+=this._fontOffset.height}if(t.restore(),this._isFocused){if(!this._blinkIsEven||this._isTextHighlightOn){var l=this._scrollLeft+t.measureText(this._lines[this._cursorInfo.currentLineIndex].text.substr(0,this._cursorInfo.relativeStartIndex)).width;l<this._clipTextLeft?(this._scrollLeft+=this._clipTextLeft-l,l=this._clipTextLeft,this._markAsDirty()):l>this._clipTextLeft+this._availableWidth&&(this._scrollLeft+=this._clipTextLeft+this._availableWidth-l,l=this._clipTextLeft+this._availableWidth,this._markAsDirty());var _=this._scrollTop+this._cursorInfo.currentLineIndex*this._fontOffset.height;_<this._clipTextTop?(this._scrollTop+=this._clipTextTop-_,_=this._clipTextTop,this._markAsDirty()):_+this._fontOffset.height>this._clipTextTop+this._availableHeight&&(this._scrollTop+=this._clipTextTop+this._availableHeight-_-this._fontOffset.height,_=this._clipTextTop+this._availableHeight-this._fontOffset.height,this._markAsDirty()),this._isTextHighlightOn||t.fillRect(l,_,2,this._fontOffset.height)}if(this._resetBlinking(),this._isTextHighlightOn){clearTimeout(this._blinkTimeout),this._highlightedText=this.text.substring(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex),t.globalAlpha=this._highligherOpacity,t.fillStyle=this._textHighlightColor;var h=Math.min(this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialLineIndex),c=Math.max(this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialLineIndex),u=this._scrollTop+h*this._fontOffset.height;for(a=h;a<=c;a++){s=this._lines[a];var d=this._scrollLeft;switch(this._textHorizontalAlignment){case y.HORIZONTAL_ALIGNMENT_LEFT:d+=0;break;case y.HORIZONTAL_ALIGNMENT_RIGHT:d+=r-s.width;break;case y.HORIZONTAL_ALIGNMENT_CENTER:d+=(r-s.width)/2}var f=a===h?this._cursorInfo.relativeStartIndex:0,p=a===c?this._cursorInfo.relativeEndIndex:s.text.length,g=t.measureText(s.text.substr(0,f)).width,b=s.text.substring(f,p),m=t.measureText(b).width;t.fillRect(d+g,u,m,this._fontOffset.height),u+=this._fontOffset.height}this._cursorInfo.globalEndIndex===this._cursorInfo.globalStartIndex&&this._resetBlinking()}}t.restore(),this._thickness&&(this._isFocused?this.focusedColor&&(t.strokeStyle=this.focusedColor):this.color&&(t.strokeStyle=this.color),t.lineWidth=this._thickness,t.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness))},e.prototype._resetBlinking=function(){var t=this;clearTimeout(this._blinkTimeout),this._blinkTimeout=setTimeout((function(){t._blinkIsEven=!t._blinkIsEven,t._markAsDirty()}),500)},e.prototype._onPointerDown=function(e,i,o,r,n){return!(!t.prototype._onPointerDown.call(this,e,i,o,r,n)||!this.isReadOnly&&(this._clickedCoordinateX=i.x,this._clickedCoordinateY=i.y,this._isTextHighlightOn=!1,this._highlightedText="",this._isPointerDown=!0,this._host._capturingControl[o]=this,this._host.focusedControl===this?(clearTimeout(this._blinkTimeout),this._markAsDirty(),0):!this._isEnabled||(this._host.focusedControl=this,0)))},e.prototype._onPointerMove=function(e,i,o,r){0===r.event.movementX&&0===r.event.movementY||(this._host.focusedControl===this&&this._isPointerDown&&!this.isReadOnly&&(this._clickedCoordinateX=i.x,this._clickedCoordinateY=i.y,this._isTextHighlightOn||(this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this._highlightCursorInfo.initialRelativeStartIndex=this._cursorInfo.relativeStartIndex,this._isTextHighlightOn=!0),this._markAsDirty()),t.prototype._onPointerMove.call(this,e,i,o,r))},e.prototype._updateCursorPosition=function(){var t;if(this._isFocused)if(!this._textWrapper.text&&this.placeholderText)this._cursorInfo.currentLineIndex=0,this._cursorInfo.globalStartIndex=0,this._cursorInfo.globalEndIndex=0,this._cursorInfo.relativeStartIndex=0,this._cursorInfo.relativeEndIndex=0;else if(this._clickedCoordinateX&&this._clickedCoordinateY){this._isTextHighlightOn||(this._cursorInfo={globalStartIndex:0,globalEndIndex:0,relativeStartIndex:0,relativeEndIndex:0,currentLineIndex:0});var e=0,i=0,o=this._clickedCoordinateY-this._scrollTop,r=Math.floor(o/this._fontOffset.height);this._cursorInfo.currentLineIndex=Math.min(Math.max(r,0),this._lines.length-1);for(var n=0,a=this._clickedCoordinateX-(null!==(t=this._scrollLeft)&&void 0!==t?t:0),s=0,l=0;l<this._cursorInfo.currentLineIndex;l++){var _=this._lines[l];e+=_.text.length+_.lineEnding.length}for(;n<a&&this._lines[this._cursorInfo.currentLineIndex].text.length>i;)i++,s=Math.abs(a-n),n=this._contextForBreakLines.measureText(this._lines[this._cursorInfo.currentLineIndex].text.substr(0,i)).width;Math.abs(a-n)>s&&i>0&&i--,e+=i,this._isTextHighlightOn?e<this._highlightCursorInfo.initialStartIndex?(this._cursorInfo.globalStartIndex=e,this._cursorInfo.relativeStartIndex=i,this._cursorInfo.globalEndIndex=this._highlightCursorInfo.initialStartIndex,this._cursorInfo.relativeEndIndex=this._highlightCursorInfo.initialRelativeStartIndex):(this._cursorInfo.globalStartIndex=this._highlightCursorInfo.initialStartIndex,this._cursorInfo.relativeStartIndex=this._highlightCursorInfo.initialRelativeStartIndex,this._cursorInfo.globalEndIndex=e,this._cursorInfo.relativeEndIndex=i):(this._cursorInfo.globalStartIndex=e,this._cursorInfo.relativeStartIndex=i,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._cursorInfo.relativeEndIndex=this._cursorInfo.relativeStartIndex),this._blinkIsEven=this._isTextHighlightOn,this._clickedCoordinateX=null,this._clickedCoordinateY=null}else{this._cursorInfo.relativeStartIndex=0,this._cursorInfo.currentLineIndex=0;for(var h=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length,c=0;c+h<=this._cursorInfo.globalStartIndex;)c+=h,this._cursorInfo.currentLineIndex<this._lines.length-1&&(this._cursorInfo.currentLineIndex++,h=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length);if(this._cursorInfo.relativeStartIndex=this._cursorInfo.globalStartIndex-c,-1!==this._highlightCursorInfo.initialStartIndex&&this._cursorInfo.globalStartIndex>=this._highlightCursorInfo.initialStartIndex){for(;c+h<=this._cursorInfo.globalEndIndex;)c+=h,this._cursorInfo.currentLineIndex<this._lines.length-1&&(this._cursorInfo.currentLineIndex++,h=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length);this._cursorInfo.relativeEndIndex=this._cursorInfo.globalEndIndex-c}else this._isTextHighlightOn||(this._cursorInfo.relativeEndIndex=this._cursorInfo.relativeStartIndex,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex)}},e.prototype._updateValueFromCursorIndex=function(t){},e.prototype._processDblClick=function(t){var e,i;do{e=this._cursorInfo.globalStartIndex>0&&this._textWrapper.isWord(this._cursorInfo.globalStartIndex-1)?--this._cursorInfo.globalStartIndex:0,i=this._cursorInfo.globalEndIndex<this._textWrapper.length&&this._textWrapper.isWord(this._cursorInfo.globalEndIndex)?++this._cursorInfo.globalEndIndex:0}while(e||i);this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this.onTextHighlightObservable.notifyObservers(this),this._isTextHighlightOn=!0,this._blinkIsEven=!0,this._markAsDirty()},e.prototype._selectAllText=function(){this._isTextHighlightOn=!0,this._blinkIsEven=!0,this._highlightCursorInfo={initialStartIndex:0,initialRelativeStartIndex:0,initialLineIndex:0},this._cursorInfo={globalStartIndex:0,globalEndIndex:this._textWrapper.length,relativeEndIndex:this._lines[this._lines.length-1].text.length,relativeStartIndex:0,currentLineIndex:this._lines.length-1},this._markAsDirty()},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onLinesReadyObservable.clear()},s([(0,h.serialize)()],e.prototype,"autoStretchHeight",null),s([(0,h.serialize)()],e.prototype,"maxHeight",null),e}(w);(0,h.RegisterClass)("BABYLON.GUI.InputTextArea",L);var k=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype._getTypeName=function(){return"InputPassword"},e.prototype._beforeRenderText=function(t){for(var e=new R,i="",o=0;o<t.length;o++)i+="•";return e.text=i,e},e}(w);(0,h.RegisterClass)("BABYLON.GUI.InputPassword",k);var N=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._lineWidth=1,i._x1=new c(0),i._y1=new c(0),i._x2=new c(0),i._y2=new c(0),i._dash=new Array,i._automaticSize=!0,i.isHitTestVisible=!1,i._horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,i._verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,i}return n(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}),Object.defineProperty(e.prototype,"connectedControl",{get:function(){return this._connectedControl},set:function(t){var e=this;this._connectedControl!==t&&(this._connectedControlDirtyObserver&&this._connectedControl&&(this._connectedControl.onDirtyObservable.remove(this._connectedControlDirtyObserver),this._connectedControlDirtyObserver=null),t&&(this._connectedControlDirtyObserver=t.onDirtyObservable.add((function(){return e._markAsDirty()}))),this._connectedControl=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"x1",{get:function(){return this._x1.toString(this._host)},set:function(t){this._x1.toString(this._host)!==t&&this._x1.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y1",{get:function(){return this._y1.toString(this._host)},set:function(t){this._y1.toString(this._host)!==t&&this._y1.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"x2",{get:function(){return this._x2.toString(this._host)},set:function(t){this._x2.toString(this._host)!==t&&this._x2.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y2",{get:function(){return this._y2.toString(this._host)},set:function(t){this._y2.toString(this._host)!==t&&this._y2.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),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}),Object.defineProperty(e.prototype,"_effectiveX2",{get:function(){return(this._connectedControl?this._connectedControl.centerX:0)+this._x2.getValue(this._host)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_effectiveY2",{get:function(){return(this._connectedControl?this._connectedControl.centerY:0)+this._y2.getValue(this._host)},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Line"},e.prototype._draw=function(t){t.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),this._applyStates(t),t.strokeStyle=this._getColor(t),t.lineWidth=this._lineWidth,t.setLineDash(this._dash),t.beginPath(),t.moveTo(this._cachedParentMeasure.left+this._x1.getValue(this._host),this._cachedParentMeasure.top+this._y1.getValue(this._host)),t.lineTo(this._cachedParentMeasure.left+this._effectiveX2,this._cachedParentMeasure.top+this._effectiveY2),t.stroke(),t.restore()},e.prototype._measure=function(){this._currentMeasure.width=Math.abs(this._x1.getValue(this._host)-this._effectiveX2)+this._lineWidth,this._currentMeasure.height=Math.abs(this._y1.getValue(this._host)-this._effectiveY2)+this._lineWidth},e.prototype._computeAlignment=function(t){this._currentMeasure.left=t.left+Math.min(this._x1.getValue(this._host),this._effectiveX2)-this._lineWidth/2,this._currentMeasure.top=t.top+Math.min(this._y1.getValue(this._host),this._effectiveY2)-this._lineWidth/2},e.prototype.moveToVector3=function(t,e,i){if(void 0===i&&(i=!1),this._host&&this.parent===this._host._rootContainer){var o=this._host._getGlobalViewport(),r=h.Vector3.Project(t,h.Matrix.IdentityReadOnly,e.getTransformMatrix(),o);this._moveToProjectedPosition(r,i),r.z<0||r.z>1?this.notRenderable=!0:this.notRenderable=!1}else h.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",o=t.y+this._linkOffsetY.getValue(this._host)+"px";e?(this.x2=i,this.y2=o,this._x2.ignoreAdaptiveScaling=!0,this._y2.ignoreAdaptiveScaling=!0):(this.x1=i,this.y1=o,this._x1.ignoreAdaptiveScaling=!0,this._y1.ignoreAdaptiveScaling=!0)},s([(0,h.serialize)()],e.prototype,"dash",null),s([(0,h.serialize)()],e.prototype,"x1",null),s([(0,h.serialize)()],e.prototype,"y1",null),s([(0,h.serialize)()],e.prototype,"x2",null),s([(0,h.serialize)()],e.prototype,"y2",null),s([(0,h.serialize)()],e.prototype,"lineWidth",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.Line",N);var A=function(){function t(t){this._multiLine=t,this._x=new c(0),this._y=new c(0),this._point=new h.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 h.Vector3(this._control.centerX,this._control.centerY,1-h.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 h.Vector3(e,i,1-h.Epsilon)},t.prototype.dispose=function(){this.resetLinks()},t}(),z=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=y.HORIZONTAL_ALIGNMENT_LEFT,i._verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,i._dash=[],i._points=[],i}return n(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 A(this)),this._points[t]},e.prototype.add=function(){for(var t=this,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return e.map((function(e){return t.push(e)}))},e.prototype.push=function(t){var e=this.getAt(this._points.length);return null==t||(t instanceof h.AbstractMesh?e.mesh=t:t instanceof y?e.control=t:null!=t.x&&null!=t.y&&(e.x=t.x,e.y=t.y)),e},e.prototype.remove=function(t){var e;if(t instanceof A){if(-1===(e=this._points.indexOf(t)))return}else e=t;var i=this._points[e];i&&(i.dispose(),this._points.splice(e,1))},e.prototype.reset=function(){for(;this._points.length>0;)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){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 e,i=!0;this._points.forEach((function(o){o&&(i?(t.moveTo(o._point.x,o._point.y),i=!1):o._point.z<1&&e.z<1?t.lineTo(o._point.x,o._point.y):t.moveTo(o._point.x,o._point.y),e=o._point)})),t.stroke(),t.restore()},e.prototype._additionalProcessing=function(){var t=this;this._minX=null,this._minY=null,this._maxX=null,this._maxY=null,this._points.forEach((function(e){e&&(e.translate(),(null==t._minX||e._point.x<t._minX)&&(t._minX=e._point.x),(null==t._minY||e._point.y<t._minY)&&(t._minY=e._point.y),(null==t._maxX||e._point.x>t._maxX)&&(t._maxX=e._point.x),(null==t._maxY||e._point.y>t._maxY)&&(t._maxY=e._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(){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)},s([(0,h.serialize)()],e.prototype,"dash",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.MultiLine",z);var Q=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 h.Observable,i.isPointerBlocker=!0,i}return n(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),y.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,1,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 o=e*this._checkSizeRatio,r=i*this._checkSizeRatio;y.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,o/2-this._thickness/2,r/2-this._thickness/2,1,t),t.fill()}t.restore()},e.prototype._onPointerDown=function(e,i,o,r,n){return!!t.prototype._onPointerDown.call(this,e,i,o,r,n)&&(this.isReadOnly||this.isChecked||(this.isChecked=!0),!0)},e.AddRadioButtonWithHeader=function(t,i,o,r){var n=new S;n.isVertical=!1,n.height="30px";var a=new e;a.width="20px",a.height="20px",a.isChecked=o,a.color="green",a.group=i,a.onIsCheckedChangedObservable.add((function(t){return r(a,t)})),n.addControl(a);var s=new B;return s.text=t,s.width="180px",s.paddingLeft="5px",s.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,s.color="white",n.addControl(s),n},s([(0,h.serialize)()],e.prototype,"thickness",null),s([(0,h.serialize)()],e.prototype,"group",void 0),s([(0,h.serialize)()],e.prototype,"checkSizeRatio",null),s([(0,h.serialize)()],e.prototype,"background",null),s([(0,h.serialize)()],e.prototype,"isChecked",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.RadioButton",Q);var V=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thumbWidth=new c(20,c.UNITMODE_PIXEL,!1),i._minimum=0,i._maximum=100,i._value=50,i._isVertical=!1,i._barOffset=new c(5,c.UNITMODE_PIXEL,!1),i._isThumbClamped=!1,i._displayThumb=!0,i._step=0,i._lastPointerDownId=-1,i._effectiveBarOffset=0,i.onValueChangedObservable=new h.Observable,i._pointerIsDown=!1,i.isPointerBlocker=!0,i}return n(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._currentMeasure.width?h.Logger.Error("Height should be greater than width"):(this._barOffset.isPixel?this._effectiveBarOffset=Math.min(this._barOffset.getValue(this._host),this._backgroundBoxThickness):this._effectiveBarOffset=this._backgroundBoxThickness*this._barOffset.getValue(this._host),this._backgroundBoxThickness-=2*this._effectiveBarOffset,this.isVertical?(this._renderLeft+=this._effectiveBarOffset,!this.isThumbClamped&&this.displayThumb&&(this._renderTop+=this._effectiveThumbThickness/2),this._renderHeight=this._backgroundBoxLength,this._renderWidth=this._backgroundBoxThickness):(this._renderTop+=this._effectiveBarOffset,!this.isThumbClamped&&this.displayThumb&&(this._renderLeft+=this._effectiveThumbThickness/2),this._renderHeight=this._backgroundBoxThickness,this._renderWidth=this._backgroundBoxLength))},e.prototype._updateValueFromPointer=function(t,e){var i;0!=this.rotation&&(this._invertTransformMatrix.transformCoordinates(t,e,this._transformedPosition),t=this._transformedPosition.x,e=this._transformedPosition.y),i=this._isVertical?this._minimum+(1-(e-this._currentMeasure.top)/this._currentMeasure.height)*(this._maximum-this._minimum):this._minimum+(t-this._currentMeasure.left)/this._currentMeasure.width*(this._maximum-this._minimum),this.value=this._step?Math.round(i/this._step)*this._step:i},e.prototype._onPointerDown=function(e,i,o,r,n){return!!t.prototype._onPointerDown.call(this,e,i,o,r,n)&&(this.isReadOnly||(this._pointerIsDown=!0,this._updateValueFromPointer(i.x,i.y),this._host._capturingControl[o]=this,this._lastPointerDownId=o),!0)},e.prototype._onPointerMove=function(e,i,o,r){o==this._lastPointerDownId&&(this._pointerIsDown&&!this.isReadOnly&&this._updateValueFromPointer(i.x,i.y),t.prototype._onPointerMove.call(this,e,i,o,r))},e.prototype._onPointerUp=function(e,i,o,r,n){this._pointerIsDown=!1,delete this._host._capturingControl[o],t.prototype._onPointerUp.call(this,e,i,o,r,n)},e.prototype._onCanvasBlur=function(){this._forcePointerUp(),t.prototype._onCanvasBlur.call(this)},s([(0,h.serialize)()],e.prototype,"displayThumb",null),s([(0,h.serialize)()],e.prototype,"step",null),s([(0,h.serialize)()],e.prototype,"barOffset",null),s([(0,h.serialize)()],e.prototype,"thumbWidth",null),s([(0,h.serialize)()],e.prototype,"minimum",null),s([(0,h.serialize)()],e.prototype,"maximum",null),s([(0,h.serialize)()],e.prototype,"value",null),s([(0,h.serialize)()],e.prototype,"isVertical",null),s([(0,h.serialize)()],e.prototype,"isThumbClamped",null),e}(y),W=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._background="black",i._borderColor="white",i._thumbColor="",i._isThumbCircle=!1,i._displayValueBar=!0,i._backgroundGradient=null,i}return n(e,t),Object.defineProperty(e.prototype,"displayValueBar",{get:function(){return this._displayValueBar},set:function(t){this._displayValueBar!==t&&(this._displayValueBar=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"borderColor",{get:function(){return this._borderColor},set:function(t){this._borderColor!==t&&(this._borderColor=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,"backgroundGradient",{get:function(){return this._backgroundGradient},set:function(t){this._backgroundGradient!==t&&(this._backgroundGradient=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbColor",{get:function(){return this._thumbColor},set:function(t){this._thumbColor!==t&&(this._thumbColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isThumbCircle",{get:function(){return this._isThumbCircle},set:function(t){this._isThumbCircle!==t&&(this._isThumbCircle=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Slider"},e.prototype._getBackgroundColor=function(t){return this._backgroundGradient?this._backgroundGradient.getCanvasGradient(t):this._background},e.prototype._draw=function(t){t.save(),this._applyStates(t),this._prepareRenderingData(this.isThumbCircle?"circle":"rectangle");var e=this._renderLeft,i=this._renderTop,o=this._renderWidth,r=this._renderHeight,n=0;this.isThumbClamped&&this.isThumbCircle?(this.isVertical?i+=this._effectiveThumbThickness/2:e+=this._effectiveThumbThickness/2,n=this._backgroundBoxThickness/2):n=(this._effectiveThumbThickness-this._effectiveBarOffset)/2,(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY);var a=this._getThumbPosition();t.fillStyle=this._getBackgroundColor(t),this.isVertical?this.isThumbClamped?this.isThumbCircle?(t.beginPath(),t.arc(e+this._backgroundBoxThickness/2,i,n,Math.PI,2*Math.PI),t.fill(),t.fillRect(e,i,o,r)):t.fillRect(e,i,o,r+this._effectiveThumbThickness):t.fillRect(e,i,o,r):this.isThumbClamped?this.isThumbCircle?(t.beginPath(),t.arc(e+this._backgroundBoxLength,i+this._backgroundBoxThickness/2,n,0,2*Math.PI),t.fill(),t.fillRect(e,i,o,r)):t.fillRect(e,i,o+this._effectiveThumbThickness,r):t.fillRect(e,i,o,r),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.fillStyle=this._getColor(t),this._displayValueBar&&(this.isVertical?this.isThumbClamped?this.isThumbCircle?(t.beginPath(),t.arc(e+this._backgroundBoxThickness/2,i+this._backgroundBoxLength,n,0,2*Math.PI),t.fill(),t.fillRect(e,i+a,o,r-a)):t.fillRect(e,i+a,o,r-a+this._effectiveThumbThickness):t.fillRect(e,i+a,o,r-a):this.isThumbClamped&&this.isThumbCircle?(t.beginPath(),t.arc(e,i+this._backgroundBoxThickness/2,n,0,2*Math.PI),t.fill(),t.fillRect(e,i,a,r)):t.fillRect(e,i,a,r)),t.fillStyle=this._thumbColor||this._getColor(t),this.displayThumb&&((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),this._isThumbCircle?(t.beginPath(),this.isVertical?t.arc(e+this._backgroundBoxThickness/2,i+a,n,0,2*Math.PI):t.arc(e+a,i+this._backgroundBoxThickness/2,n,0,2*Math.PI),t.fill(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.strokeStyle=this._borderColor,t.stroke()):(this.isVertical?t.fillRect(e-this._effectiveBarOffset,this._currentMeasure.top+a,this._currentMeasure.width,this._effectiveThumbThickness):t.fillRect(this._currentMeasure.left+a,this._currentMeasure.top,this._effectiveThumbThickness,this._currentMeasure.height),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.strokeStyle=this._borderColor,this.isVertical?t.strokeRect(e-this._effectiveBarOffset,this._currentMeasure.top+a,this._currentMeasure.width,this._effectiveThumbThickness):t.strokeRect(this._currentMeasure.left+a,this._currentMeasure.top,this._effectiveThumbThickness,this._currentMeasure.height))),t.restore()},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),this.backgroundGradient&&(e.backgroundGradient={},this.backgroundGradient.serialize(e.backgroundGradient))},e.prototype._parseFromContent=function(e,i){if(t.prototype._parseFromContent.call(this,e,i),e.backgroundGradient){var o=h.Tools.Instantiate("BABYLON.GUI."+e.backgroundGradient.className);this.backgroundGradient=new o,this.backgroundGradient.parse(e.backgroundGradient)}},s([(0,h.serialize)()],e.prototype,"displayValueBar",null),s([(0,h.serialize)()],e.prototype,"borderColor",null),s([(0,h.serialize)()],e.prototype,"background",null),s([(0,h.serialize)()],e.prototype,"thumbColor",null),s([(0,h.serialize)()],e.prototype,"isThumbCircle",null),e}(V);(0,h.RegisterClass)("BABYLON.GUI.Slider",W);var H=function(){function t(t){this.name=t,this._groupPanel=new S,this._selectors=new Array,this._groupPanel.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,this._groupPanel.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,this._groupHeader=this._addGroupHeader(t)}return Object.defineProperty(t.prototype,"groupPanel",{get:function(){return this._groupPanel},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectors",{get:function(){return this._selectors},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"header",{get:function(){return this._groupHeader.text},set:function(t){"label"!==this._groupHeader.text&&(this._groupHeader.text=t)},enumerable:!1,configurable:!0}),t.prototype._addGroupHeader=function(t){var e=new B("groupHead",t);return e.width=.9,e.height="30px",e.textWrapping=!0,e.color="black",e.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,e.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,e.left="2px",this._groupPanel.addControl(e),e},t.prototype._getSelector=function(t){if(!(t<0||t>=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}(),G=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.addCheckbox=function(t,e,i){void 0===e&&(e=function(t){}),void 0===i&&(i=!1),i=i||!1;var o=new O;o.width="20px",o.height="20px",o.color="#364249",o.background="#CCCCCC",o.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,o.onIsCheckedChangedObservable.add((function(t){e(t)}));var r=y.AddHeader(o,t,"200px",{isHorizontal:!0,controlFirst:!0});r.height="30px",r.horizontalAlignment=y.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}(H),U=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._selectNb=0,e}return n(e,t),e.prototype.addRadio=function(t,e,i){void 0===e&&(e=function(t){}),void 0===i&&(i=!1);var o=this._selectNb++,r=new Q;r.name=t,r.width="20px",r.height="20px",r.color="#364249",r.background="#CCCCCC",r.group=this.name,r.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,r.onIsCheckedChangedObservable.add((function(t){t&&e(o)}));var n=y.AddHeader(r,t,"200px",{isHorizontal:!0,controlFirst:!0});n.height="30px",n.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,n.left="4px",this.groupPanel.addControl(n),this.selectors.push(n),r.isChecked=i,this.groupPanel.parent&&this.groupPanel.parent.parent&&(r.color=this.groupPanel.parent.parent.buttonColor,r.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}(H),j=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.addSlider=function(t,e,i,o,r,n,a){void 0===e&&(e=function(t){}),void 0===i&&(i="Units"),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=function(t){return 0|t});var s=new W;s.name=i,s.value=n,s.minimum=o,s.maximum=r,s.width=.9,s.height="20px",s.color="#364249",s.background="#CCCCCC",s.borderColor="black",s.horizontalAlignment=y.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=y.AddHeader(s,t+": "+a(n)+" "+i,"30px",{isHorizontal:!1,controlFirst:!1});l.height="60px",l.horizontalAlignment=y.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}(H),Y=function(t){function e(e,i){void 0===i&&(i=[]);var o=t.call(this,e)||this;if(o.name=e,o.groups=i,o._buttonColor="#364249",o._buttonBackground="#CCCCCC",o._headerColor="black",o._barColor="white",o._barHeight="2px",o._spacerHeight="20px",o._bars=new Array,o._groups=i,o.thickness=2,o._panel=new S,o._panel.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,o._panel.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,o._panel.top=5,o._panel.left=5,o._panel.width=.95,i.length>0){for(var r=0;r<i.length-1;r++)o._panel.addControl(i[r].groupPanel),o._addSpacer();o._panel.addControl(i[i.length-1].groupPanel)}return o.addControl(o._panel),o}return n(e,t),e.prototype._getTypeName=function(){return"SelectionPanel"},Object.defineProperty(e.prototype,"panel",{get:function(){return this._panel},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"headerColor",{get:function(){return this._headerColor},set:function(t){this._headerColor!==t&&(this._headerColor=t,this._setHeaderColor())},enumerable:!1,configurable:!0}),e.prototype._setHeaderColor=function(){for(var t=0;t<this._groups.length;t++)this._groups[t].groupPanel.children[0].color=this._headerColor},Object.defineProperty(e.prototype,"buttonColor",{get:function(){return this._buttonColor},set:function(t){this._buttonColor!==t&&(this._buttonColor=t,this._setbuttonColor())},enumerable:!1,configurable:!0}),e.prototype._setbuttonColor=function(){for(var t=0;t<this._groups.length;t++)for(var e=0;e<this._groups[t].selectors.length;e++)this._groups[t]._setSelectorButtonColor(e,this._buttonColor)},Object.defineProperty(e.prototype,"labelColor",{get:function(){return this._labelColor},set:function(t){this._labelColor!==t&&(this._labelColor=t,this._setLabelColor())},enumerable:!1,configurable:!0}),e.prototype._setLabelColor=function(){for(var t=0;t<this._groups.length;t++)for(var e=0;e<this._groups[t].selectors.length;e++)this._groups[t]._setSelectorLabelColor(e,this._labelColor)},Object.defineProperty(e.prototype,"buttonBackground",{get:function(){return this._buttonBackground},set:function(t){this._buttonBackground!==t&&(this._buttonBackground=t,this._setButtonBackground())},enumerable:!1,configurable:!0}),e.prototype._setButtonBackground=function(){for(var t=0;t<this._groups.length;t++)for(var e=0;e<this._groups[t].selectors.length;e++)this._groups[t]._setSelectorButtonBackground(e,this._buttonBackground)},Object.defineProperty(e.prototype,"barColor",{get:function(){return this._barColor},set:function(t){this._barColor!==t&&(this._barColor=t,this._setBarColor())},enumerable:!1,configurable:!0}),e.prototype._setBarColor=function(){for(var t=0;t<this._bars.length;t++)this._bars[t].children[0].background=this._barColor},Object.defineProperty(e.prototype,"barHeight",{get:function(){return this._barHeight},set:function(t){this._barHeight!==t&&(this._barHeight=t,this._setBarHeight())},enumerable:!1,configurable:!0}),e.prototype._setBarHeight=function(){for(var t=0;t<this._bars.length;t++)this._bars[t].children[0].height=this._barHeight},Object.defineProperty(e.prototype,"spacerHeight",{get:function(){return this._spacerHeight},set:function(t){this._spacerHeight!==t&&(this._spacerHeight=t,this._setSpacerHeight())},enumerable:!1,configurable:!0}),e.prototype._setSpacerHeight=function(){for(var t=0;t<this._bars.length;t++)this._bars[t].height=this._spacerHeight},e.prototype._addSpacer=function(){var t=new x;t.width=1,t.height=this._spacerHeight,t.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT;var e=new I;e.width=1,e.height=this._barHeight,e.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,e.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,e.background=this._barColor,e.color="transparent",t.addControl(e),this._panel.addControl(t),this._bars.push(t)},e.prototype.addGroup=function(t){this._groups.length>0&&this._addSpacer(),this._panel.addControl(t.groupPanel),this._groups.push(t),t.groupPanel.children[0].color=this._headerColor;for(var e=0;e<t.selectors.length;e++)t._setSelectorButtonColor(e,this._buttonColor),t._setSelectorButtonBackground(e,this._buttonBackground)},e.prototype.removeGroup=function(t){if(!(t<0||t>=this._groups.length)){var e=this._groups[t];this._panel.removeControl(e.groupPanel),this._groups.splice(t,1),t<this._bars.length&&(this._panel.removeControl(this._bars[t]),this._bars.splice(t,1))}},e.prototype.setHeaderName=function(t,e){e<0||e>=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 o=this._groups[e];i<0||i>=o.selectors.length||o._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,o){void 0===i&&(i=function(){}),void 0===o&&(o=!1),t<0||t>=this._groups.length||this._groups[t].addCheckbox(e,i,o)},e.prototype.addToGroupRadio=function(t,e,i,o){void 0===i&&(i=function(){}),void 0===o&&(o=!1),t<0||t>=this._groups.length||this._groups[t].addRadio(e,i,o)},e.prototype.addToGroupSlider=function(t,e,i,o,r,n,a,s){void 0===i&&(i=function(){}),void 0===o&&(o="Units"),void 0===r&&(r=0),void 0===n&&(n=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,o,r,n,a,s)},e}(I),X=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 n(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,o=e.height,r=this.host.getContext(),n=new g(0,0,i,o);this.host._numLayoutCalls=0,this.host._rootContainer._layout(n,r),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;e<t.length;++e){for(var i=t[e],o=Math.max(0,Math.floor((i._customData._origLeft-this._customData.origLeft)/this._bucketWidth)),r=Math.floor((i._customData._origLeft-this._customData.origLeft+i._currentMeasure.width-1)/this._bucketWidth),n=Math.floor((i._customData._origTop-this._customData.origTop+i._currentMeasure.height-1)/this._bucketHeight),a=Math.max(0,Math.floor((i._customData._origTop-this._customData.origTop)/this._bucketHeight));a<=n;){for(var s=o;s<=r;++s){var l=a*this._bucketLen+s,_=this._buckets[l];_||(_=[],this._buckets[l]=_),_.push(i)}a++}i instanceof x&&i._children.length>0&&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 o=0;o<t.length;++o){var r=t[o];r._currentMeasure.left-=e,r._currentMeasure.top-=i,r._customData._origLeft=r._currentMeasure.left,r._customData._origTop=r._currentMeasure.top,r instanceof x&&r._children.length>0&&this._updateChildrenMeasures(r._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 o=0;o<t.length;++o){var r=t[o];r._currentMeasure.left=r._customData._origLeft+e,r._currentMeasure.top=r._customData._origTop+i,r._isClipped=!1,r instanceof x&&r._children.length>0&&this._scrollChildren(r._children,e,i)}},e.prototype._scrollChildrenWithBuckets=function(t,e,i,o){for(var r=Math.max(0,Math.floor(-t/this._bucketWidth)),n=Math.floor((-t+this._parentMeasure.width-1)/this._bucketWidth),a=Math.floor((-e+this._parentMeasure.height-1)/this._bucketHeight),s=Math.max(0,Math.floor(-e/this._bucketHeight));s<=a;){for(var l=r;l<=n;++l){var _=s*this._bucketLen+l,h=this._buckets[_];if(h)for(var c=0;c<h.length;++c){var u=h[c];u._currentMeasure.left=u._customData._origLeft+i,u._currentMeasure.top=u._customData._origTop+o,u._isClipped=!1}}s++}},e.prototype._draw=function(e,i){if(this._freezeControls){this._localDraw(e),this.clipChildren&&this._clipForChildren(e);var o=0|this.leftInPixels,r=0|this.topInPixels;this._useBuckets()&&null!==this._oldLeft&&null!==this._oldTop?(this._scrollChildrenWithBuckets(this._oldLeft,this._oldTop,o,r),this._scrollChildrenWithBuckets(o,r,o,r)):this._scrollChildren(this._children,o,r),this._oldLeft=o,this._oldTop=r;for(var n=0,a=this._children;n<a.length;n++){var s=a[n];s._intersectsRect(this._parentMeasure)&&s._render(e,this._parentMeasure)}}else t.prototype._draw.call(this,e,i)},e.prototype._postMeasure=function(){if(this._freezeControls)t.prototype._postMeasure.call(this);else{for(var e=this.parentClientWidth,i=this.parentClientHeight,o=0,r=this.children;o<r.length;o++){var n=r[o];n.isVisible&&!n.notRenderable&&(n.horizontalAlignment===y.HORIZONTAL_ALIGNMENT_CENTER&&n._offsetLeft(this._currentMeasure.left-n._currentMeasure.left),n.verticalAlignment===y.VERTICAL_ALIGNMENT_CENTER&&n._offsetTop(this._currentMeasure.top-n._currentMeasure.top),e=Math.max(e,n._currentMeasure.left-this._currentMeasure.left+n._currentMeasure.width+n.paddingRightInPixels),i=Math.max(i,n._currentMeasure.top-this._currentMeasure.top+n._currentMeasure.height+n.paddingBottomInPixels))}this._currentMeasure.width!==e&&(this._width.updateInPlace(e,c.UNITMODE_PIXEL),this._currentMeasure.width=e,this._rebuildLayout=!0,this._isDirty=!0),this._currentMeasure.height!==i&&(this._height.updateInPlace(i,c.UNITMODE_PIXEL),this._currentMeasure.height=i,this._rebuildLayout=!0,this._isDirty=!0),t.prototype._postMeasure.call(this)}},e}(x),K=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._background="black",i._borderColor="white",i._tempMeasure=new g(0,0,0,0),i._invertScrollDirection=!1,i._backgroundGradient=null,i}return n(e,t),Object.defineProperty(e.prototype,"borderColor",{get:function(){return this._borderColor},set:function(t){this._borderColor!==t&&(this._borderColor=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,"backgroundGradient",{get:function(){return this._backgroundGradient},set:function(t){this._backgroundGradient!==t&&(this._backgroundGradient=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"invertScrollDirection",{get:function(){return this._invertScrollDirection},set:function(t){this._invertScrollDirection=t},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Scrollbar"},e.prototype._getThumbThickness=function(){return this._thumbWidth.isPixel?this._thumbWidth.getValue(this._host):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host)},e.prototype._getBackgroundColor=function(t){return this._backgroundGradient?this._backgroundGradient.getCanvasGradient(t):this._background},e.prototype._draw=function(t){t.save(),this._applyStates(t),this._prepareRenderingData("rectangle");var e=this._renderLeft,i=this._getThumbPosition();t.fillStyle=this._getBackgroundColor(t),t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height),t.fillStyle=this._getColor(t),this.isVertical?(this._tempMeasure.left=e-this._effectiveBarOffset,this._tempMeasure.top=this._currentMeasure.top+i,this._tempMeasure.width=this._currentMeasure.width,this._tempMeasure.height=this._effectiveThumbThickness):(this._tempMeasure.left=this._currentMeasure.left+i,this._tempMeasure.top=this._currentMeasure.top,this._tempMeasure.width=this._effectiveThumbThickness,this._tempMeasure.height=this._currentMeasure.height),t.fillRect(this._tempMeasure.left,this._tempMeasure.top,this._tempMeasure.width,this._tempMeasure.height),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);var i=this._invertScrollDirection?-1:1;this._first&&(this._first=!1,this._originX=t,this._originY=e,(t<this._tempMeasure.left||t>this._tempMeasure.left+this._tempMeasure.width||e<this._tempMeasure.top||e>this._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 o;o=this.isVertical?-(e-this._originY)/(this._currentMeasure.height-this._effectiveThumbThickness):(t-this._originX)/(this._currentMeasure.width-this._effectiveThumbThickness),this.value+=i*o*(this.maximum-this.minimum),this._originX=t,this._originY=e},e.prototype._onPointerDown=function(e,i,o,r,n){return this._first=!0,t.prototype._onPointerDown.call(this,e,i,o,r,n)},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),this.backgroundGradient&&(e.backgroundGradient={},this.backgroundGradient.serialize(e.backgroundGradient))},e.prototype._parseFromContent=function(e,i){if(t.prototype._parseFromContent.call(this,e,i),e.backgroundGradient){var o=h.Tools.Instantiate("BABYLON.GUI."+e.backgroundGradient.className);this.backgroundGradient=new o,this.backgroundGradient.parse(e.backgroundGradient)}},s([(0,h.serialize)()],e.prototype,"borderColor",null),s([(0,h.serialize)()],e.prototype,"background",null),s([(0,h.serialize)()],e.prototype,"invertScrollDirection",null),e}(V);(0,h.RegisterClass)("BABYLON.GUI.Scrollbar",K);var Z=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 g(0,0,0,0),i._invertScrollDirection=!1,i.num90RotationInVerticalMode=1,i}return n(e,t),Object.defineProperty(e.prototype,"invertScrollDirection",{get:function(){return this._invertScrollDirection},set:function(t){this._invertScrollDirection=t},enumerable:!1,configurable:!0}),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,o=this._renderTop,r=this._renderWidth,n=this._renderHeight;this._backgroundImage&&(this._tempMeasure.copyFromFloats(i,o,r,n),this.isVertical?(this._tempMeasure.copyFromFloats(i+r*(1-this._barImageHeight)*.5,this._currentMeasure.top,r*this._barImageHeight,n),this._tempMeasure.height+=this._effectiveThumbThickness,this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure)):(this._tempMeasure.copyFromFloats(this._currentMeasure.left,o+n*(1-this._barImageHeight)*.5,r,n*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);var i=this._invertScrollDirection?-1:1;this._first&&(this._first=!1,this._originX=t,this._originY=e,(t<this._tempMeasure.left||t>this._tempMeasure.left+this._tempMeasure.width||e<this._tempMeasure.top||e>this._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 o;o=this.isVertical?-(e-this._originY)/(this._currentMeasure.height-this._effectiveThumbThickness):(t-this._originX)/(this._currentMeasure.width-this._effectiveThumbThickness),this.value+=i*o*(this.maximum-this.minimum),this._originX=t,this._originY=e},e.prototype._onPointerDown=function(e,i,o,r,n){return this._first=!0,t.prototype._onPointerDown.call(this,e,i,o,r,n)},s([(0,h.serialize)()],e.prototype,"num90RotationInVerticalMode",void 0),s([(0,h.serialize)()],e.prototype,"invertScrollDirection",null),e}(V),q=function(t){function e(e,i){var o=t.call(this,e)||this;return o._barSize=20,o._pointerIsOver=!1,o._wheelPrecision=.05,o._thumbLength=.5,o._thumbHeight=1,o._barImageHeight=1,o._horizontalBarImageHeight=1,o._verticalBarImageHeight=1,o._oldWindowContentsWidth=0,o._oldWindowContentsHeight=0,o._forceHorizontalBar=!1,o._forceVerticalBar=!1,o._useImageBar=i||!1,o.onDirtyObservable.add((function(){o._horizontalBarSpace.color=o.color,o._verticalBarSpace.color=o.color,o._dragSpace.color=o.color})),o.onPointerEnterObservable.add((function(){o._pointerIsOver=!0})),o.onPointerOutObservable.add((function(){o._pointerIsOver=!1})),o._grid=new M,o._useImageBar?(o._horizontalBar=new Z,o._verticalBar=new Z):(o._horizontalBar=new K,o._verticalBar=new K),o._window=new X("scrollViewer_window"),o._window.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,o._window.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,o._grid.addColumnDefinition(1),o._grid.addColumnDefinition(0,!0),o._grid.addRowDefinition(1),o._grid.addRowDefinition(0,!0),t.prototype.addControl.call(o,o._grid),o._grid.addControl(o._window,0,0),o._verticalBarSpace=new I,o._verticalBarSpace.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,o._verticalBarSpace.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,o._verticalBarSpace.thickness=1,o._grid.addControl(o._verticalBarSpace,0,1),o._addBar(o._verticalBar,o._verticalBarSpace,!0,Math.PI),o._horizontalBarSpace=new I,o._horizontalBarSpace.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,o._horizontalBarSpace.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,o._horizontalBarSpace.thickness=1,o._grid.addControl(o._horizontalBarSpace,1,0),o._addBar(o._horizontalBar,o._horizontalBarSpace,!1,0),o._dragSpace=new I,o._dragSpace.thickness=1,o._grid.addControl(o._dragSpace,1,1),o._grid.clipChildren=!1,o._useImageBar||(o.barColor="grey",o.barBackground="transparent"),o}return n(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;t<e.length;t++)e[t]._markMatrixAsDirty()},Object.defineProperty(e.prototype,"freezeControls",{get:function(){return this._window.freezeControls},set:function(t){this._window.freezeControls=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bucketWidth",{get:function(){return this._window.bucketWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bucketHeight",{get:function(){return this._window.bucketHeight},enumerable:!1,configurable:!0}),e.prototype.setBucketSizes=function(t,e){this._window.setBucketSizes(t,e)},Object.defineProperty(e.prototype,"forceHorizontalBar",{get:function(){return this._forceHorizontalBar},set:function(t){this._grid.setRowDefinition(1,t?this._barSize:0,!0),this._horizontalBar.isVisible=t,this._forceHorizontalBar=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"forceVerticalBar",{get:function(){return this._forceVerticalBar},set:function(t){this._grid.setColumnDefinition(1,t?this._barSize:0,!0),this._verticalBar.isVisible=t,this._forceVerticalBar=t},enumerable:!1,configurable:!0}),e.prototype.resetWindow=function(){this._window.width="100%",this._window.height="100%"},e.prototype._getTypeName=function(){return"ScrollViewer"},e.prototype._buildClientSizes=function(){var t=this.host.idealRatio;this._window.parentClientWidth=this._currentMeasure.width-(this._verticalBar.isVisible||this.forceVerticalBar?this._barSize*t:0)-2*this.thickness,this._window.parentClientHeight=this._currentMeasure.height-(this._horizontalBar.isVisible||this.forceHorizontalBar?this._barSize*t:0)-2*this.thickness,this._clientWidth=this._window.parentClientWidth,this._clientHeight=this._window.parentClientHeight},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._buildClientSizes()},e.prototype._postMeasure=function(){t.prototype._postMeasure.call(this),this._updateScroller(),this._setWindowPosition(!1)},Object.defineProperty(e.prototype,"wheelPrecision",{get:function(){return this._wheelPrecision},set:function(t){this._wheelPrecision!==t&&(t<0&&(t=0),t>1&&(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=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=t,this._horizontalBar.backgroundImage=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalBarImage",{get:function(){return this._verticalBarBackgroundImage},set:function(t){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,o=this._window._currentMeasure.height;if(t||this._oldWindowContentsWidth!==i||this._oldWindowContentsHeight!==o){this._oldWindowContentsWidth=i,this._oldWindowContentsHeight=o;var r=this._clientWidth-i,n=this._clientHeight-o,a=this._horizontalBar.value/e*r+"px",s=this._verticalBar.value/e*n+"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,o){var r=this;t.paddingLeft=0,t.width="100%",t.height="100%",t.barOffset=0,t.value=0,t.maximum=1,t.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_CENTER,t.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,t.isVertical=i,t.rotation=o,t.isVisible=!1,e.addControl(t),t.onValueChangedObservable.add((function(){r._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.value<t._verticalBar.maximum&&(t._verticalBar.value+=t._wheelPrecision)),1==t._horizontalBar.isVisible&&(e.x<0&&t._horizontalBar.value<t._horizontalBar.maximum?t._horizontalBar.value+=t._wheelPrecision:e.x>0&&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)},s([(0,h.serialize)()],e.prototype,"wheelPrecision",null),s([(0,h.serialize)()],e.prototype,"scrollBackground",null),s([(0,h.serialize)()],e.prototype,"barColor",null),s([(0,h.serialize)()],e.prototype,"barSize",null),s([(0,h.serialize)()],e.prototype,"barBackground",null),e}(I);(0,h.RegisterClass)("BABYLON.GUI.ScrollViewer",q);var J=function(t){function e(e,i){var o=t.call(this,e)||this;o.name=e,o.onIsActiveChangedObservable=new h.Observable,o.delegatePickingToChildren=!1,o._isActive=!1,o.group=null!=i?i:"",o.thickness=0,o.isPointerBlocker=!0;var r=null;return o.toActiveAnimation=function(){o.thickness=1},o.toInactiveAnimation=function(){o.thickness=0},o.pointerEnterActiveAnimation=function(){r=o.alpha,o.alpha-=.1},o.pointerOutActiveAnimation=function(){null!==r&&(o.alpha=r)},o.pointerDownActiveAnimation=function(){o.scaleX-=.05,o.scaleY-=.05},o.pointerUpActiveAnimation=function(){o.scaleX+=.05,o.scaleY+=.05},o.pointerEnterInactiveAnimation=function(){r=o.alpha,o.alpha-=.1},o.pointerOutInactiveAnimation=function(){null!==r&&(o.alpha=r)},o.pointerDownInactiveAnimation=function(){o.scaleX-=.05,o.scaleY-=.05},o.pointerUpInactiveAnimation=function(){o.scaleX+=.05,o.scaleY+=.05},o}return n(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,o=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===o)return;var e=t;e.group===o.group&&(e.isActive=!1)}})))},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"ToggleButton"},e.prototype._processPicking=function(e,i,o,r,n,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(r,e,i,o,n,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,o){void 0===o&&(o=!1),this.isReadOnly||(this._isActive?this.pointerOutActiveAnimation&&this.pointerOutActiveAnimation():this.pointerOutInactiveAnimation&&this.pointerOutInactiveAnimation()),t.prototype._onPointerOut.call(this,e,i,o)},e.prototype._onPointerDown=function(e,i,o,r,n){return!!t.prototype._onPointerDown.call(this,e,i,o,r,n)&&(this.isReadOnly||(this._isActive?this.pointerDownActiveAnimation&&this.pointerDownActiveAnimation():this.pointerDownInactiveAnimation&&this.pointerDownInactiveAnimation()),!0)},e.prototype._onPointerUp=function(e,i,o,r,n,a){this.isReadOnly||(this._isActive?this.pointerUpActiveAnimation&&this.pointerUpActiveAnimation():this.pointerUpInactiveAnimation&&this.pointerUpInactiveAnimation()),t.prototype._onPointerUp.call(this,e,i,o,r,n,a)},e}(I);(0,h.RegisterClass)("BABYLON.GUI.ToggleButton",J);var $=function(){},tt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.onKeyPressObservable=new h.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 n(e,t),e.prototype._getTypeName=function(){return"VirtualKeyboard"},e.prototype._createKey=function(t,e){var i=this,o=T.CreateSimpleButton(t,t);return o.width=e&&e.width?e.width:this.defaultButtonWidth,o.height=e&&e.height?e.height:this.defaultButtonHeight,o.color=e&&e.color?e.color:this.defaultButtonColor,o.background=e&&e.background?e.background:this.defaultButtonBackground,o.paddingLeft=e&&e.paddingLeft?e.paddingLeft:this.defaultButtonPaddingLeft,o.paddingRight=e&&e.paddingRight?e.paddingRight:this.defaultButtonPaddingRight,o.paddingTop=e&&e.paddingTop?e.paddingTop:this.defaultButtonPaddingTop,o.paddingBottom=e&&e.paddingBottom?e.paddingBottom:this.defaultButtonPaddingBottom,o.thickness=0,o.isFocusInvisible=!0,o.shadowColor=this.shadowColor,o.shadowBlur=this.shadowBlur,o.shadowOffsetX=this.shadowOffsetX,o.shadowOffsetY=this.shadowOffsetY,o.onPointerUpObservable.add((function(){i.onKeyPressObservable.notifyObservers(t)})),o},e.prototype.addKeysRow=function(t,e){var i=new S;i.isVertical=!1,i.isFocusInvisible=!0;for(var o=null,r=0;r<t.length;r++){var n=null;e&&e.length===t.length&&(n=e[r]);var a=this._createKey(t[r],n);(!o||a.heightInPixels>o.heightInPixels)&&(o=a),i.addControl(a)}i.height=o?o.height:this.defaultButtonHeight,this.addControl(i)},e.prototype.applyShiftState=function(t){if(this.children)for(var e=0;e<this.children.length;e++){var i=this.children[e];if(i&&i.children)for(var o=i,r=0;r<o.children.length;r++){var n=o.children[r];if(n&&n.children[0]){var a=n.children[0];"⇧"===a.text&&(n.color=t?this.shiftButtonColor:this.defaultButtonColor,n.thickness=t>1?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 instanceof L?e._currentlyConnectedInputText.alternativeProcessKey("Backspace"):e._currentlyConnectedInputText.processKey(8));case"↵":return void(e._currentlyConnectedInputText instanceof L?e._currentlyConnectedInputText.alternativeProcessKey("Enter"):e._currentlyConnectedInputText.processKey(13))}e._currentlyConnectedInputText instanceof L?e._currentlyConnectedInputText.alternativeProcessKey("",e.shiftState?t.toUpperCase():t):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})),o=t.onBlurObservable.add((function(){t._connectedVirtualKeyboard=null,e._currentlyConnectedInputText=null,e.isVisible=!1}));this._connectedInputTexts.push({input:t,onBlurObserver:o,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.length=0;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.prototype._parseFromContent=function(e,i){var o=this;t.prototype._parseFromContent.call(this,e,i);for(var r=0,n=this.children;r<n.length;r++){var a=n[r];if("StackPanel"===a.getClassName())for(var s=function(t){"Button"===t.getClassName()&&t.name&&t.onPointerUpObservable.add((function(){o.onKeyPressObservable.notifyObservers(t.name)}))},l=0,_=a.children;l<_.length;l++)s(_[l])}},e}(S);(0,h.RegisterClass)("BABYLON.GUI.VirtualKeyboard",tt);var et=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 n(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){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 e=this._currentMeasure.width/this._cellWidth,i=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 n=-e/2+1;n<e/2;n++){var a=o+n*this.cellWidth;t.beginPath(),t.moveTo(a,this._currentMeasure.top),t.lineTo(a,this._currentMeasure.top+this._currentMeasure.height),t.stroke()}for(var s=-i/2+1;s<i/2;s++){var l=r+s*this.cellHeight;t.beginPath(),t.moveTo(this._currentMeasure.left,l),t.lineTo(this._currentMeasure.left+this._currentMeasure.width,l),t.stroke()}}if(this._displayMajorLines){for(t.strokeStyle=this._majorLineColor,t.lineWidth=this._majorLineTickness,n=-e/2+this._majorLineFrequency;n<e/2;n+=this._majorLineFrequency)a=o+n*this.cellWidth,t.beginPath(),t.moveTo(a,this._currentMeasure.top),t.lineTo(a,this._currentMeasure.top+this._currentMeasure.height),t.stroke();for(s=-i/2+this._majorLineFrequency;s<i/2;s+=this._majorLineFrequency)l=r+s*this.cellHeight,t.moveTo(this._currentMeasure.left,l),t.lineTo(this._currentMeasure.left+this._currentMeasure.width,l),t.closePath(),t.stroke()}}t.restore()},e.prototype._getTypeName=function(){return"DisplayGrid"},s([(0,h.serialize)()],e.prototype,"displayMinorLines",null),s([(0,h.serialize)()],e.prototype,"displayMajorLines",null),s([(0,h.serialize)()],e.prototype,"background",null),s([(0,h.serialize)()],e.prototype,"cellWidth",null),s([(0,h.serialize)()],e.prototype,"cellHeight",null),s([(0,h.serialize)()],e.prototype,"minorLineTickness",null),s([(0,h.serialize)()],e.prototype,"minorLineColor",null),s([(0,h.serialize)()],e.prototype,"majorLineTickness",null),s([(0,h.serialize)()],e.prototype,"majorLineColor",null),s([(0,h.serialize)()],e.prototype,"majorLineFrequency",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.DisplayGrid",et);var it=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._tempMeasure=new g(0,0,0,0),i}return n(e,t),Object.defineProperty(e.prototype,"displayThumb",{get:function(){return this._displayThumb&&null!=this.thumbImage},set:function(t){this._displayThumb!==t&&(this._displayThumb=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backgroundImage",{get:function(){return this._backgroundImage},set:function(t){var e=this;this._backgroundImage!==t&&(this._backgroundImage=t,t&&!t.isLoaded&&t.onImageLoadedObservable.addOnce((function(){return e._markAsDirty()})),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"valueBarImage",{get:function(){return this._valueBarImage},set:function(t){var e=this;this._valueBarImage!==t&&(this._valueBarImage=t,t&&!t.isLoaded&&t.onImageLoadedObservable.addOnce((function(){return e._markAsDirty()})),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbImage",{get:function(){return this._thumbImage},set:function(t){var e=this;this._thumbImage!==t&&(this._thumbImage=t,t&&!t.isLoaded&&t.onImageLoadedObservable.addOnce((function(){return e._markAsDirty()})),this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"ImageBasedSlider"},e.prototype._draw=function(t){t.save(),this._applyStates(t),this._prepareRenderingData("rectangle");var e=this._getThumbPosition(),i=this._renderLeft,o=this._renderTop,r=this._renderWidth,n=this._renderHeight;this._backgroundImage&&(this._tempMeasure.copyFromFloats(i,o,r,n),this.isThumbClamped&&this.displayThumb&&(this.isVertical?this._tempMeasure.height+=this._effectiveThumbThickness:this._tempMeasure.width+=this._effectiveThumbThickness),this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure),this._backgroundImage._draw(t)),this._valueBarImage&&(this.isVertical?this.isThumbClamped&&this.displayThumb?this._tempMeasure.copyFromFloats(i,o+e,r,n-e+this._effectiveThumbThickness):this._tempMeasure.copyFromFloats(i,o+e,r,n-e):this.isThumbClamped&&this.displayThumb?this._tempMeasure.copyFromFloats(i,o,e+this._effectiveThumbThickness/2,n):this._tempMeasure.copyFromFloats(i,o,e,n),this._valueBarImage._currentMeasure.copyFrom(this._tempMeasure),this._valueBarImage._draw(t)),this.displayThumb&&(this.isVertical?this._tempMeasure.copyFromFloats(i-this._effectiveBarOffset,this._currentMeasure.top+e,this._currentMeasure.width,this._effectiveThumbThickness):this._tempMeasure.copyFromFloats(this._currentMeasure.left+e,this._currentMeasure.top,this._effectiveThumbThickness,this._currentMeasure.height),this._thumbImage._currentMeasure.copyFrom(this._tempMeasure),this._thumbImage._draw(t)),t.restore()},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e);var i={},o={},r={};this.backgroundImage.serialize(i),this.thumbImage.serialize(o),this.valueBarImage.serialize(r),e.backgroundImage=i,e.thumbImage=o,e.valueBarImage=r},e.prototype._parseFromContent=function(e,i){t.prototype._parseFromContent.call(this,e,i),this.backgroundImage=C.Parse(e.backgroundImage,i),this.thumbImage=C.Parse(e.thumbImage,i),this.valueBarImage=C.Parse(e.valueBarImage,i)},s([(0,h.serialize)()],e.prototype,"displayThumb",null),e}(V);(0,h.RegisterClass)("BABYLON.GUI.ImageBasedSlider",it);var ot="Statics";y.AddHeader=function(t,e,i,o){var r=new S("panel"),n=!o||o.isHorizontal,a=!o||o.controlFirst;r.isVertical=!n;var s=new B("header");return s.text=e,s.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,n?s.width=i:s.height=i,a?(r.addControl(t),r.addControl(s),s.paddingLeft="5px"):(r.addControl(s),r.addControl(t),s.paddingRight="5px"),s.shadowBlur=t.shadowBlur,s.shadowColor=t.shadowColor,s.shadowOffsetX=t.shadowOffsetX,s.shadowOffsetY=t.shadowOffsetY,r};var rt=function(){function t(){this._colorStops=[],this._gradientDirty=!0}return t.prototype._addColorStopsToCanvasGradient=function(){for(var t=0,e=this._colorStops;t<e.length;t++){var i=e[t];this._canvasGradient.addColorStop(i.offset,i.color)}},t.prototype.getCanvasGradient=function(t){return(this._gradientDirty||this._context!==t)&&(this._context=t,this._canvasGradient=this._createCanvasGradient(t),this._addColorStopsToCanvasGradient(),this._gradientDirty=!1),this._canvasGradient},t.prototype.addColorStop=function(t,e){this._colorStops.push({offset:t,color:e}),this._gradientDirty=!0},t.prototype.removeColorStop=function(t){this._colorStops=this._colorStops.filter((function(e){return e.offset!==t})),this._gradientDirty=!0},t.prototype.clearColorStops=function(){this._colorStops=[],this._gradientDirty=!0},Object.defineProperty(t.prototype,"colorStops",{get:function(){return this._colorStops},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"BaseGradient"},t.prototype.serialize=function(t){t.colorStops=this._colorStops,t.className=this.getClassName()},t.prototype.parse=function(t){this._colorStops=t.colorStops},t}(),nt=function(t){function e(e,i,o,r){var n=t.call(this)||this;return n._x0=null!=e?e:0,n._y0=null!=i?i:0,n._x1=null!=o?o:0,n._y1=null!=r?r:0,n}return n(e,t),e.prototype._createCanvasGradient=function(t){return t.createLinearGradient(this._x0,this._y0,this._x1,this._y1)},Object.defineProperty(e.prototype,"x0",{get:function(){return this._x0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"x1",{get:function(){return this._x1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y0",{get:function(){return this._y0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y1",{get:function(){return this._y1},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"LinearGradient"},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),e.x0=this._x0,e.y0=this._y0,e.x1=this._x1,e.y1=this._y1},e.prototype.parse=function(e){t.prototype.parse.call(this,e),this._x0=e.x0,this._y0=e.y0,this._x1=e.x1,this._y1=e.y1},e}(rt);(0,h.RegisterClass)("BABYLON.GUI.LinearGradient",nt);var at=function(t){function e(e,i,o,r,n,a){var s=t.call(this)||this;return s._x0=null!=e?e:0,s._y0=null!=i?i:0,s._r0=null!=o?o:0,s._x1=null!=r?r:0,s._y1=null!=n?n:0,s._r1=null!=a?a:0,s}return n(e,t),e.prototype._createCanvasGradient=function(t){return t.createRadialGradient(this._x0,this._y0,this._r0,this._x1,this._y1,this._r1)},Object.defineProperty(e.prototype,"x0",{get:function(){return this._x0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"x1",{get:function(){return this._x1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y0",{get:function(){return this._y0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y1",{get:function(){return this._y1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"r0",{get:function(){return this._r0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"r1",{get:function(){return this._r1},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"RadialGradient"},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),e.x0=this._x0,e.y0=this._y0,e.r0=this._r0,e.x1=this._x1,e.y1=this._y1,e.r1=this._r1},e.prototype.parse=function(e){t.prototype.parse.call(this,e),this._x0=e.x0,this._y0=e.y0,this._r0=e.r0,this._x1=e.x1,this._y1=e.y1,this._r1=e.r1},e}(rt);(0,h.RegisterClass)("BABYLON.GUI.RadialGradient",at);var st=function(){function t(t){this._fontFamily="Arial",this._fontStyle="",this._fontWeight="",this._fontSize=new c(18,c.UNITMODE_PIXEL,!1),this.onChangedObservable=new h.Observable,this._host=t}return Object.defineProperty(t.prototype,"fontSize",{get:function(){return this._fontSize.toString(this._host)},set:function(t){this._fontSize.toString(this._host)!==t&&this._fontSize.fromString(t)&&this.onChangedObservable.notifyObservers(this)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this.onChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this.onChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this.onChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.onChangedObservable.clear()},t}(),lt=function(t){function e(e,i,o,r,n,a,s){void 0===i&&(i=0),void 0===o&&(o=0),void 0===n&&(n=!1),void 0===a&&(a=h.Texture.NEAREST_SAMPLINGMODE),void 0===s&&(s=!0);var l=t.call(this,e,{width:i,height:o},r,n,a,h.Constants.TEXTUREFORMAT_RGBA,s)||this;return l.onGuiReadyObservable=new h.Observable,l._isDirty=!1,l._rootContainer=new x("root"),l._lastControlOver={},l._lastControlDown={},l._capturingControl={},l._linkedControls=new Array,l._isFullscreen=!1,l._fullscreenViewport=new h.Viewport(0,0,1,1),l._idealWidth=0,l._idealHeight=0,l._useSmallestIdeal=!1,l._renderAtIdealSize=!1,l._blockNextFocusCheck=!1,l._renderScale=1,l._cursorChanged=!1,l._defaultMousePointerId=0,l._rootChildrenHaveChanged=!1,l._capturedPointerIds=new Set,l._numLayoutCalls=0,l._numRenderCalls=0,l._clipboardData="",l.onClipboardObservable=new h.Observable,l.onControlPickedObservable=new h.Observable,l.onBeginLayoutObservable=new h.Observable,l.onEndLayoutObservable=new h.Observable,l.onBeginRenderObservable=new h.Observable,l.onEndRenderObservable=new h.Observable,l.premulAlpha=!1,l.applyYInversionOnUpdate=!0,l.disableTabNavigation=!1,l.skipBlockEvents=0,l.checkPointerEveryFrame=!1,l._useInvalidateRectOptimization=!0,l._invalidatedRectangle=null,l._clearMeasure=new g(0,0,0,0),l._onClipboardCopy=function(t){var e=t,i=new h.ClipboardInfo(h.ClipboardEventTypes.COPY,e);l.onClipboardObservable.notifyObservers(i),e.preventDefault()},l._onClipboardCut=function(t){var e=t,i=new h.ClipboardInfo(h.ClipboardEventTypes.CUT,e);l.onClipboardObservable.notifyObservers(i),e.preventDefault()},l._onClipboardPaste=function(t){var e=t,i=new h.ClipboardInfo(h.ClipboardEventTypes.PASTE,e);l.onClipboardObservable.notifyObservers(i),e.preventDefault()},l.parseContent=l.parseSerializedObject,(r=l.getScene())&&l._texture?(l.applyYInversionOnUpdate=s,l._rootElement=r.getEngine().getInputElement(),l._renderObserver=r.onBeforeCameraRenderObservable.add((function(t){return l._checkUpdate(t)})),l._controlAddedObserver=l._rootContainer.onControlAddedObservable.add((function(t){t&&(l._rootChildrenHaveChanged=!0)})),l._controlRemovedObserver=l._rootContainer.onControlRemovedObservable.add((function(t){t&&(l._rootChildrenHaveChanged=!0)})),l._preKeyboardObserver=r.onPreKeyboardObservable.add((function(t){if(!l.disableTabNavigation&&t.type===h.KeyboardEventTypes.KEYDOWN&&"Tab"===t.event.code)return l._focusNextElement(!t.event.shiftKey),void t.event.preventDefault();l._focusedControl&&(t.type===h.KeyboardEventTypes.KEYDOWN&&l._focusedControl.processKeyboard(t.event),t.skipOnPointerObservable=!0)})),l._rootContainer._link(l),l.hasAlpha=!0,i&&o||(l._resizeObserver=r.getEngine().onResizeObservable.add((function(){return l._onResize()})),l._onResize()),l._texture.isReady=!0,l):l}return n(e,t),Object.defineProperty(e.prototype,"numLayoutCalls",{get:function(){return this._numLayoutCalls},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"numRenderCalls",{get:function(){return this._numRenderCalls},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderScale",{get:function(){return this._renderScale},set:function(t){t!==this._renderScale&&(this._renderScale=t,this._onResize())},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,"idealWidth",{get:function(){return this._idealWidth},set:function(t){this._idealWidth!==t&&(this._idealWidth=t,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"idealHeight",{get:function(){return this._idealHeight},set:function(t){this._idealHeight!==t&&(this._idealHeight=t,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useSmallestIdeal",{get:function(){return this._useSmallestIdeal},set:function(t){this._useSmallestIdeal!==t&&(this._useSmallestIdeal=t,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderAtIdealSize",{get:function(){return this._renderAtIdealSize},set:function(t){this._renderAtIdealSize!==t&&(this._renderAtIdealSize=t,this._onResize())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"idealRatio",{get:function(){var t=0,e=0;return this._idealWidth&&(t=this.getSize().width/this._idealWidth),this._idealHeight&&(e=this.getSize().height/this._idealHeight),this._useSmallestIdeal&&this._idealWidth&&this._idealHeight?window.innerWidth<window.innerHeight?t:e:this._idealWidth?t:this._idealHeight?e:1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"layer",{get:function(){return this._layerToDispose},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rootContainer",{get:function(){return this._rootContainer},enumerable:!1,configurable:!0}),e.prototype.getChildren=function(){return[this._rootContainer]},e.prototype.getDescendants=function(t,e){return this._rootContainer.getDescendants(t,e)},e.prototype.getControlsByType=function(t){return this._rootContainer.getDescendants(!1,(function(e){return e.typeName===t}))},e.prototype.getControlByName=function(t){return this._getControlByKey("name",t)},e.prototype._getControlByKey=function(t,e){return this._rootContainer.getDescendants().find((function(i){return i[t]===e}))||null},Object.defineProperty(e.prototype,"focusedControl",{get:function(){return this._focusedControl},set:function(t){this._focusedControl!=t&&(this._focusedControl&&this._focusedControl.onBlur(),t&&t.onFocus(),this._focusedControl=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isForeground",{get:function(){return!this.layer||!this.layer.isBackground},set:function(t){this.layer&&this.layer.isBackground!==!t&&(this.layer.isBackground=!t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clipboardData",{get:function(){return this._clipboardData},set:function(t){this._clipboardData=t},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"AdvancedDynamicTexture"},e.prototype.executeOnAllControls=function(t,e){e||(e=this._rootContainer),t(e);for(var i=0,o=e.children;i<o.length;i++){var r=o[i];r.children?this.executeOnAllControls(t,r):t(r)}},Object.defineProperty(e.prototype,"useInvalidateRectOptimization",{get:function(){return this._useInvalidateRectOptimization},set:function(t){this._useInvalidateRectOptimization=t},enumerable:!1,configurable:!0}),e.prototype.invalidateRect=function(t,e,i,o){if(this._useInvalidateRectOptimization)if(this._invalidatedRectangle){var r=Math.ceil(Math.max(this._invalidatedRectangle.left+this._invalidatedRectangle.width-1,i)),n=Math.ceil(Math.max(this._invalidatedRectangle.top+this._invalidatedRectangle.height-1,o));this._invalidatedRectangle.left=Math.floor(Math.min(this._invalidatedRectangle.left,t)),this._invalidatedRectangle.top=Math.floor(Math.min(this._invalidatedRectangle.top,e)),this._invalidatedRectangle.width=r-this._invalidatedRectangle.left+1,this._invalidatedRectangle.height=n-this._invalidatedRectangle.top+1}else this._invalidatedRectangle=new g(t,e,i-t+1,o-e+1)},e.prototype.markAsDirty=function(){this._isDirty=!0},e.prototype.createStyle=function(){return new st(this)},e.prototype.addControl=function(t){return this._rootContainer.addControl(t),this},e.prototype.removeControl=function(t){return this._rootContainer.removeControl(t),this},e.prototype.moveToNonOverlappedPosition=function(t,i,o){var r;if(void 0===i&&(i=1),void 0===o&&(o=1),Array.isArray(t))r=t;else{var n=this.getDescendants(!0);r=void 0===t?n.filter((function(t){return void 0!==t.overlapGroup})):n.filter((function(e){return e.overlapGroup===t}))}r.forEach((function(t){var n,a=h.Vector2.Zero(),s=new h.Vector2(t.centerX,t.centerY);r.forEach((function(i){if(t!==i&&e._Overlaps(t,i)){var r=s.subtract(new h.Vector2(i.centerX,i.centerY)),n=r.length();n>0&&(a=a.add(r.normalize().scale(o/n)))}})),a.length()>0&&(a=a.normalize().scale(i*(null!==(n=t.overlapDeltaMultiplier)&&void 0!==n?n: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._prePointerObserver&&e.onPrePointerObservable.remove(this._prePointerObserver),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._controlAddedObserver&&this._rootContainer.onControlAddedObservable.remove(this._controlAddedObserver),this._controlRemovedObserver&&this._rootContainer.onControlRemovedObservable.remove(this._controlRemovedObserver),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(),this.onGuiReadyObservable.clear(),t.prototype.dispose.call(this))},e.prototype._onResize=function(){var t=this.getScene();if(t){var e=t.getEngine(),i=this.getSize(),o=e.getRenderWidth()*this._renderScale,r=e.getRenderHeight()*this._renderScale;this._renderAtIdealSize&&(this._idealWidth?(r=r*this._idealWidth/o,o=this._idealWidth):this._idealHeight&&(o=o*this._idealHeight/r,r=this._idealHeight)),i.width===o&&i.height===r||(this.scaleTo(o,r),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)),o=Math.round(e.height*(1/this.rootContainer.scaleY));return e.x+=(e.width-i)/2,e.y+=(e.height-o)/2,e.width=i,e.height=o,e},e.prototype.getProjectedPosition=function(t,e){var i=this.getProjectedPositionWithZ(t,e);return new h.Vector2(i.x,i.y)},e.prototype.getProjectedPositionWithZ=function(t,e){var i=this.getScene();if(!i)return h.Vector3.Zero();var o=this._getGlobalViewport(),r=h.Vector3.Project(t,e,i.getTransformMatrix(),o);return new h.Vector3(r.x,r.y,r.z)},e.prototype._checkUpdate=function(t,i){if(!this._layerToDispose||t.layerMask&this._layerToDispose.layerMask){if(this._isFullscreen&&this._linkedControls.length){var o=this.getScene();if(!o)return;for(var r=this._getGlobalViewport(),n=function(t){if(!t.isVisible)return"continue";var e=t._linkedMesh;if(!e||e.isDisposed())return h.Tools.SetImmediate((function(){t.linkWithMesh(null)})),"continue";var i=e.getBoundingInfo?e.getBoundingInfo().boundingSphere.center:h.Vector3.ZeroReadOnly,n=h.Vector3.Project(i,e.getWorldMatrix(),o.getTransformMatrix(),r);if(n.z<0||n.z>1)return t.notRenderable=!0,"continue";t.notRenderable=!1,a.useInvalidateRectOptimization&&t.invalidateRect(),t._moveToProjectedPosition(n)},a=this,s=0,l=this._linkedControls;s<l.length;s++)n(l[s])}(this._isDirty||this._rootContainer.isDirty)&&(this._isDirty=!1,this._render(i),i||this.update(this.applyYInversionOnUpdate,this.premulAlpha,e.AllowGPUOptimizations))}},e.prototype._render=function(t){var e,i=this.getSize(),o=i.width,r=i.height,n=this.getContext();if(n.font="18px Arial",n.strokeStyle="white",this.onGuiReadyObservable.hasObservers()&&this._checkGuiIsReady(),this._rootChildrenHaveChanged){var a=null===(e=this.getScene())||void 0===e?void 0:e.activeCamera;a&&(this._rootChildrenHaveChanged=!1,this._checkUpdate(a,!0))}this.onBeginLayoutObservable.notifyObservers(this);var s=new g(0,0,o,r);this._numLayoutCalls=0,this._rootContainer._layout(s,n),this.onEndLayoutObservable.notifyObservers(this),this._isDirty=!1,t||(this._invalidatedRectangle?this._clearMeasure.copyFrom(this._invalidatedRectangle):this._clearMeasure.copyFromFloats(0,0,o,r),n.clearRect(this._clearMeasure.left,this._clearMeasure.top,this._clearMeasure.width,this._clearMeasure.height),this._background&&(n.save(),n.fillStyle=this._background,n.fillRect(this._clearMeasure.left,this._clearMeasure.top,this._clearMeasure.width,this._clearMeasure.height),n.restore()),this.onBeginRenderObservable.notifyObservers(this),this._numRenderCalls=0,this._rootContainer._render(n,this._invalidatedRectangle),this.onEndRenderObservable.notifyObservers(this),this._invalidatedRectangle=null)},e.prototype._changeCursor=function(t){this._rootElement&&(this._rootElement.style.cursor=t,this._cursorChanged=!0)},e.prototype._registerLastControlDown=function(t,e){this._lastControlDown[e]=t,this.onControlPickedObservable.notifyObservers(t)},e.prototype._doPicking=function(t,e,i,o,r,n,a,s){var l=this.getScene();if(l){var _=l.getEngine(),c=this.getSize();if(this._isFullscreen){var u=l.cameraToUseForPointers||l.activeCamera;if(!u)return;var d=u.viewport;t*=c.width/(_.getRenderWidth()*d.width),e*=c.height/(_.getRenderHeight()*d.height)}if(this._capturingControl[r])return this._capturingControl[r].isPointerBlocker&&(this._shouldBlockPointer=!0),void this._capturingControl[r]._processObservables(o,t,e,i,r,n);this._cursorChanged=!1,this._rootContainer._processPicking(t,e,i,o,r,n,a,s)||(l.doNotHandleCursors||this._changeCursor(""),o===h.PointerEventTypes.POINTERMOVE&&this._lastControlOver[r]&&(this._lastControlOver[r]._onPointerOut(this._lastControlOver[r],i),delete this._lastControlOver[r])),this._cursorChanged||l.doNotHandleCursors||this._changeCursor(""),this._manageFocus()}},e.prototype._cleanControlAfterRemovalFromList=function(t,e){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&t[i]===e&&delete t[i]},e.prototype._cleanControlAfterRemoval=function(t){this._cleanControlAfterRemovalFromList(this._lastControlDown,t),this._cleanControlAfterRemovalFromList(this._lastControlOver,t)},e.prototype.pick=function(t,e,i){void 0===i&&(i=null),this._isFullscreen&&this._scene&&this._translateToPicking(this._scene,new h.Viewport(0,0,0,0),i,t,e)},e.prototype._translateToPicking=function(t,e,i,o,r){void 0===o&&(o=t.pointerX),void 0===r&&(r=t.pointerY);var n=t.cameraToUseForPointers||t.activeCamera,a=t.getEngine(),s=t.cameraToUseForPointers;if(n)if(n.rigCameras.length){var l=new h.Viewport(0,0,1,1);n.rigCameras.forEach((function(i){i.viewport.toGlobalToRef(a.getRenderWidth(),a.getRenderHeight(),l);var n=o/a.getHardwareScalingLevel()-l.x,s=r/a.getHardwareScalingLevel()-(a.getRenderHeight()-l.y-l.height);n<0||s<0||o>l.width||r>l.height||(t.cameraToUseForPointers=i,e.x=l.x,e.y=l.y,e.width=l.width,e.height=l.height)}))}else n.viewport.toGlobalToRef(a.getRenderWidth(),a.getRenderHeight(),e);else e.x=0,e.y=0,e.width=a.getRenderWidth(),e.height=a.getRenderHeight();var _=o/a.getHardwareScalingLevel()-e.x,c=r/a.getHardwareScalingLevel()-(a.getRenderHeight()-e.y-e.height);if(this._shouldBlockPointer=!1,i){var u=i.event.pointerId||this._defaultMousePointerId;this._doPicking(_,c,i,i.type,u,i.event.button,i.event.deltaX,i.event.deltaY),(this._shouldBlockPointer&&!(i.type&this.skipBlockEvents)||this._capturingControl[u])&&(i.skipOnPointerObservable=!0)}else this._doPicking(_,c,null,h.PointerEventTypes.POINTERMOVE,this._defaultMousePointerId,0);t.cameraToUseForPointers=s},e.prototype.attach=function(){var t=this,e=this.getScene();if(e){var i=new h.Viewport(0,0,0,0);this._prePointerObserver=e.onPrePointerObservable.add((function(o){if((!e.isPointerCaptured(o.event.pointerId)||o.type!==h.PointerEventTypes.POINTERUP||t._capturedPointerIds.has(o.event.pointerId))&&(o.type===h.PointerEventTypes.POINTERMOVE||o.type===h.PointerEventTypes.POINTERUP||o.type===h.PointerEventTypes.POINTERDOWN||o.type===h.PointerEventTypes.POINTERWHEEL)){if(o.type===h.PointerEventTypes.POINTERMOVE){if(e.isPointerCaptured(o.event.pointerId))return;o.event.pointerId&&(t._defaultMousePointerId=o.event.pointerId)}t._translateToPicking(e,i,o)}})),this._attachPickingToSceneRender(e,(function(){return t._translateToPicking(e,i,null)}),!1),this._attachToOnPointerOut(e),this._attachToOnBlur(e)}},e.prototype._focusNextElement=function(t){void 0===t&&(t=!0);var e=[];if(this.executeOnAllControls((function(t){t.isFocusInvisible||!t.isVisible||t.tabIndex<0||e.push(t)})),0!==e.length)if(e.sort((function(t,e){return 0===t.tabIndex?1:0===e.tabIndex?-1:t.tabIndex-e.tabIndex})),this._focusedControl){var i=e.indexOf(this._focusedControl)+(t?1:-1);i<0?i=e.length-1:i>=e.length&&(i=0),e[i].focus()}else e[0].focus()},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._transformUvs=function(t){var e,i=this.getTextureMatrix();if(i.isIdentityAs3x2())e=t;else{var o=h.TmpVectors.Matrix[0];i.getRowToRef(0,h.TmpVectors.Vector4[0]),i.getRowToRef(1,h.TmpVectors.Vector4[1]),i.getRowToRef(2,h.TmpVectors.Vector4[2]);var r=h.TmpVectors.Vector4[0],n=h.TmpVectors.Vector4[1],a=h.TmpVectors.Vector4[2];o.setRowFromFloats(0,r.x,r.y,0,0),o.setRowFromFloats(1,n.x,n.y,0,0),o.setRowFromFloats(2,0,0,1,0),o.setRowFromFloats(3,a.x,a.y,0,1),e=h.TmpVectors.Vector2[0],h.Vector2.TransformToRef(t,o,e)}if((this.wrapU===h.Texture.WRAP_ADDRESSMODE||this.wrapU===h.Texture.MIRROR_ADDRESSMODE)&&e.x>1){var s=e.x-Math.trunc(e.x);this.wrapU===h.Texture.MIRROR_ADDRESSMODE&&Math.trunc(e.x)%2==1&&(s=1-s),e.x=s}if((this.wrapV===h.Texture.WRAP_ADDRESSMODE||this.wrapV===h.Texture.MIRROR_ADDRESSMODE)&&e.y>1){var l=e.y-Math.trunc(e.y);this.wrapV===h.Texture.MIRROR_ADDRESSMODE&&Math.trunc(e.x)%2==1&&(l=1-l),e.y=l}return e},e.prototype.attachToMesh=function(t,e){var i=this;void 0===e&&(e=!0);var o=this.getScene();o&&(this._pointerObserver&&o.onPointerObservable.remove(this._pointerObserver),this._pointerObserver=o.onPointerObservable.add((function(e){if(e.type===h.PointerEventTypes.POINTERMOVE||e.type===h.PointerEventTypes.POINTERUP||e.type===h.PointerEventTypes.POINTERDOWN||e.type===h.PointerEventTypes.POINTERWHEEL){e.type===h.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){r=i._transformUvs(r);var n=i.getSize();i._doPicking(r.x*n.width,(i.applyYInversionOnUpdate?1-r.y:r.y)*n.height,e,e.type,o,e.event.button,e.event.deltaX,e.event.deltaY)}}else if(e.type===h.PointerEventTypes.POINTERUP){if(i._lastControlDown[o]&&i._lastControlDown[o]._forcePointerUp(o),delete i._lastControlDown[o],i.focusedControl){var a=i.focusedControl.keepsFocusWith(),s=!0;if(a)for(var l=0,_=a;l<_.length;l++){var c=_[l];if(i!==c._host){var u=c._host;if(u._lastControlOver[o]&&u._lastControlOver[o].isAscendant(c)){s=!1;break}}}s&&(i.focusedControl=null)}}else e.type===h.PointerEventTypes.POINTERMOVE&&(i._lastControlOver[o]&&i._lastControlOver[o]._onPointerOut(i._lastControlOver[o],e,!0),delete i._lastControlOver[o])}})),t.enablePointerMoveEvents=e,this._attachPickingToSceneRender(o,(function(){var e=i._defaultMousePointerId,r=null==o?void 0:o.pick(o.pointerX,o.pointerY);if(r&&r.hit&&r.pickedMesh===t){var n=r.getTextureCoordinates();if(n){n=i._transformUvs(n);var a=i.getSize();i._doPicking(n.x*a.width,(i.applyYInversionOnUpdate?1-n.y:n.y)*a.height,null,h.PointerEventTypes.POINTERMOVE,e,0)}}else i._lastControlOver[e]&&i._lastControlOver[e]._onPointerOut(i._lastControlOver[e],null,!0),delete i._lastControlOver[e]}),!0),this._attachToOnPointerOut(o),this._attachToOnBlur(o))},e.prototype.moveFocusToControl=function(t){this.focusedControl=t,this._lastPickedControl=t,this._blockNextFocusCheck=!0},e.prototype._manageFocus=function(){if(this._blockNextFocusCheck)return this._blockNextFocusCheck=!1,void(this._lastPickedControl=this._focusedControl);if(this._focusedControl&&this._focusedControl!==this._lastPickedControl){if(this._lastPickedControl.isFocusInvisible)return;this.focusedControl=null}},e.prototype._attachPickingToSceneRender=function(t,e,i){var o=this;this._sceneRenderObserver=t.onBeforeRenderObservable.add((function(){o.checkPointerEveryFrame&&(o._linkedControls.length>0||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(t.pointerId),delete e._lastControlDown[t.pointerId])}))},e.prototype._attachToOnBlur=function(t){var e=this;this._canvasBlurObserver=t.getEngine().onCanvasBlurObservable.add((function(){Object.entries(e._lastControlDown).forEach((function(t){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.parseSerializedObject=function(t,e,i){if(this._rootContainer=y.Parse(t.root,this,i),e){var o=t.width,r=t.height;"number"==typeof o&&"number"==typeof r&&o>=0&&r>=0?this.scaleTo(o,r):this.scaleTo(1920,1080)}},e.prototype.clone=function(t,i){var o=this.getScene();if(!o)return this;var r,n=this.getSize(),a=this.serializeContent();return(r=this._isFullscreen?e.CreateFullscreenUI(null!=t?t:"Clone of "+this.name):i?e.CreateForMesh(i,n.width,n.height):new e(null!=t?t:"Clone of "+this.name,n.width,n.height,o,!this.noMipmap,this.samplingMode)).parseSerializedObject(a),r},e.ParseFromSnippetAsync=function(t,i,o,r){return l(this,void 0,void 0,(function(){var n,a;return _(this,(function(s){switch(s.label){case 0:return n=null!=o?o:e.CreateFullscreenUI("ADT from snippet"),"_BLANK"===t?[2,n]:[4,e._LoadURLContentAsync(e.SnippetUrl+"/"+t.replace(/#/g,"/"),!0)];case 1:return a=s.sent(),n.parseSerializedObject(a,i,r),[2,n]}}))}))},e.prototype.parseFromSnippetAsync=function(t,i,o){return e.ParseFromSnippetAsync(t,i,this,o)},e.ParseFromFileAsync=function(t,i,o,r){return l(this,void 0,void 0,(function(){var n,a;return _(this,(function(s){switch(s.label){case 0:return n=null!=o?o:e.CreateFullscreenUI("ADT from URL"),[4,e._LoadURLContentAsync(t)];case 1:return a=s.sent(),n.parseSerializedObject(a,i,r),[2,n]}}))}))},e.prototype.parseFromURLAsync=function(t,i,o){return e.ParseFromFileAsync(t,i,this,o)},e._LoadURLContentAsync=function(t,e){return void 0===e&&(e=!1),""===t?Promise.reject("No URL provided"):new Promise((function(i,o){var r=new h.WebRequest;r.addEventListener("readystatechange",(function(){if(4==r.readyState)if(200==r.status){var t=void 0;if(e){var n=JSON.parse(JSON.parse(r.responseText).jsonPayload);t=n.encodedGui?new TextDecoder("utf-8").decode((0,h.DecodeBase64ToBinary)(n.encodedGui)):n.gui}else t=r.responseText;var a=JSON.parse(t);i(a)}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.widthInPixels<e.centerX||t.centerY+t.heightInPixels<e.centerY||t.centerY>e.centerY+e.heightInPixels)},e.CreateForMesh=function(t,i,o,r,n,a,s,l){void 0===i&&(i=1024),void 0===o&&(o=1024),void 0===r&&(r=!0),void 0===n&&(n=!1),void 0===s&&(s=this._CreateMaterial),void 0===l&&(l=h.Texture.TRILINEAR_SAMPLINGMODE);var _=(0,h.RandomGUID)(),c=new e("AdvancedDynamicTexture for ".concat(t.name," [").concat(_,"]"),i,o,t.getScene(),!0,l,a);return s(t,_,c,n),c.attachToMesh(t,r),c},e._CreateMaterial=function(t,e,i,o){var r=(0,h.GetClass)("BABYLON.StandardMaterial");if(!r)throw"StandardMaterial needs to be imported before as it contains a side-effect required by your code.";var n=new r("AdvancedDynamicTextureMaterial for ".concat(t.name," [").concat(e,"]"),t.getScene());n.backFaceCulling=!1,n.diffuseColor=h.Color3.Black(),n.specularColor=h.Color3.Black(),o?(n.diffuseTexture=i,n.emissiveTexture=i,i.hasAlpha=!0):(n.emissiveTexture=i,n.opacityTexture=i),t.material=n},e.CreateForMeshTexture=function(t,i,o,r,n,a){void 0===i&&(i=1024),void 0===o&&(o=1024),void 0===r&&(r=!0),void 0===a&&(a=h.Texture.TRILINEAR_SAMPLINGMODE);var s=new e(t.name+" AdvancedDynamicTexture",i,o,t.getScene(),!0,a,n);return s.attachToMesh(t,r),s},e.CreateFullscreenUI=function(t,i,o,r,n){void 0===i&&(i=!0),void 0===o&&(o=null),void 0===r&&(r=h.Texture.BILINEAR_SAMPLINGMODE),void 0===n&&(n=!1);var a=new e(t,0,0,o,!1,r),s=a.getScene(),l=new h.Layer(t+"_layer",null,s,!i);if(l.texture=a,a._layerToDispose=l,a._isFullscreen=!0,n&&s){var _=1/s.getEngine().getHardwareScalingLevel();a._rootContainer.scaleX=_,a._rootContainer.scaleY=_}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.prototype._checkGuiIsReady=function(){this.guiIsReady()&&(this.onGuiReadyObservable.notifyObservers(this),this.onGuiReadyObservable.clear())},e.prototype.guiIsReady=function(){return this._rootContainer.isReady()},e.SnippetUrl=h.Constants.SnippetUrl,e.AllowGPUOptimizations=!0,e}(h.DynamicTexture),_t=function(){function t(t){this.texture=t,this._captureRenderTime=!1,this._renderTime=new h.PerfCounter,this._captureLayoutTime=!1,this._layoutTime=new h.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}(),ht="XmlLoader Exception : XML file is malformed or corrupted.",ct=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 o=0;o<i.length;o++)e=e[i[o]];return e},t.prototype._getClassAttribute=function(t){var e=t.split(".");return(0,h.GetClass)("BABYLON.GUI."+e[0])[e[1]]},t.prototype._createGuiElement=function(t,e,i){void 0===i&&(i=!0);try{var o=new((0,h.GetClass)("BABYLON.GUI."+t.nodeName));e&&i&&e.addControl(o);for(var r=0;r<t.attributes.length;r++)if(!t.attributes[r].name.toLowerCase().includes("datasource"))if(t.attributes[r].name.toLowerCase().includes("observable")){var n=this._getChainElement(t.attributes[r].value);o[t.attributes[r].name].add(n)}else"linkWithMesh"==t.attributes[r].name?this._parentClass?o.linkWithMesh(this._parentClass[t.attributes[r].value]):o.linkWithMesh(window[t.attributes[r].value]):t.attributes[r].value.startsWith("{{")&&t.attributes[r].value.endsWith("}}")?(n=this._getChainElement(t.attributes[r].value.substring(2,t.attributes[r].value.length-2)),o[t.attributes[r].name]=n):this._objectAttributes[t.attributes[r].name]?o[t.attributes[r].name]=this._getClassAttribute(t.attributes[r].value):"true"==t.attributes[r].value||"false"==t.attributes[r].value?o[t.attributes[r].name]="true"==t.attributes[r].value:o[t.attributes[r].name]=isNaN(Number(t.attributes[r].value))?t.attributes[r].value:Number(t.attributes[r].value);if(!t.attributes.getNamedItem("id"))return this._nodes[t.nodeName+Object.keys(this._nodes).length+"_gen"]=o,o;var a=t.attributes.getNamedItem("id").value;if(a.startsWith("{{")&&a.endsWith("}}")&&(a=this._getChainElement(a.substring(2,a.length-2))),this._nodes[a])throw"XmlLoader Exception : Duplicate ID, every element should have an unique ID attribute";return this._nodes[a]=o,o}catch(e){throw"XmlLoader Exception : Error parsing Control "+t.nodeName+","+e+"."}},t.prototype._parseGrid=function(t,e,i){for(var o,r,n,a,s,l=t.children,_=!1,h=-1,c=-1,u=0,d=0;d<l.length;d++)if(l[d].nodeType==this._nodeTypes.element){if("Row"!=l[d].nodeName)throw"XmlLoader Exception : Expecting Row node, received "+l[d].nodeName;if(h+=1,n=l[d].children,!l[d].attributes.getNamedItem("height"))throw"XmlLoader Exception : Height must be defined for grid rows";r=Number(l[d].attributes.getNamedItem("height").nodeValue),_=!!l[d].attributes.getNamedItem("isPixel")&&JSON.parse(l[d].attributes.getNamedItem("isPixel").nodeValue),e.addRowDefinition(r,_);for(var f=0;f<n.length;f++)if(n[f].nodeType==this._nodeTypes.element){if("Column"!=n[f].nodeName)throw"XmlLoader Exception : Expecting Column node, received "+n[f].nodeName;if(c+=1,h>0&&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(!n[f].attributes.getNamedItem("width"))throw"XmlLoader Exception : Width must be defined for all the grid columns in the first row";o=Number(n[f].attributes.getNamedItem("width").nodeValue),_=!!n[f].attributes.getNamedItem("isPixel")&&JSON.parse(n[f].attributes.getNamedItem("isPixel").nodeValue),e.addColumnDefinition(o,_)}a=n[f].children;for(var p=0;p<a.length;p++)a[p].nodeType==this._nodeTypes.element&&(s=this._createGuiElement(a[p],e,!1),e.addControl(s,h,c),a[p].firstChild&&this._parseXml(a[p].firstChild,s))}0==h&&(u=c),c=-1}t.nextSibling&&this._parseXml(t.nextSibling,i)},t.prototype._parseElement=function(t,e,i){t.firstChild&&this._parseXml(t.firstChild,e),t.nextSibling&&this._parseXml(t.nextSibling,i)},t.prototype._prepareSourceElement=function(t,e,i,o,r){this._parentClass?this._parentClass[i]=o[r]:window[i]=o[r],t.firstChild&&this._parseXml(t.firstChild,e,!0)},t.prototype._parseElementsFromSource=function(t,e,i){var o=t.attributes.getNamedItem("dataSource").value;if(!o.includes(" in "))throw"XmlLoader Exception : Malformed XML, Data Source must include an in";var r=!0,n=o.split(" in ");if(n.length<2)throw"XmlLoader Exception : Malformed XML, Data Source must have an iterator and a source";var a=n[1];if(a.startsWith("{")&&a.endsWith("}")&&(r=!1),(!r||a.startsWith("[")&&a.endsWith("]"))&&(a=a.substring(1,a.length-1)),a=this._parentClass?this._parentClass[a]:window[a],r)for(var s=0;s<a.length;s++)this._prepareSourceElement(t,e,n[0],a,s);else for(var s in a)this._prepareSourceElement(t,e,n[0],a,s);t.nextSibling&&this._parseXml(t.nextSibling,i)},t.prototype._parseXml=function(t,e,i){if(void 0===i&&(i=!1),t.nodeType==this._nodeTypes.element){i&&t.setAttribute("id",e.id+(e._children.length+1));var o=this._createGuiElement(t,e);this._rootNode||(this._rootNode=o),"Grid"==t.nodeName?this._parseGrid(t,o,e):t.attributes.getNamedItem("dataSource")?this._parseElementsFromSource(t,o,e):this._parseElement(t,o,e)}else t.nextSibling&&this._parseXml(t.nextSibling,e,i)},t.prototype.isLoaded=function(){return this._isLoaded},t.prototype.getNodeById=function(t){return this._nodes[t]},t.prototype.getNodes=function(){return this._nodes},t.prototype.dispose=function(){this._rootNode&&(this._rootNode.dispose(),this._rootNode=null,this._nodes={})},t.prototype.loadLayout=function(t,e,i,o){var r=this;void 0===i&&(i=null),void 0===o&&(o=null);var n=new XMLHttpRequest;n.onload=function(){if(4===n.readyState&&200===n.status){if(!n.responseXML){if(o)return void o(ht);throw ht}var t=n.responseXML.documentElement;r._parseXml(t.firstChild,e),r._isLoaded=!0,i&&i()}},n.onerror=function(){o&&o("an error occurred during loading the layout")},n.open("GET",t,!0),n.send()},t.prototype.loadLayoutAsync=function(t,e){return l(this,void 0,void 0,(function(){var i=this;return _(this,(function(o){return[2,new Promise((function(o,r){i.loadLayout(t,e,o,r)}))]}))}))},t}(),ut=function(t){function e(e,i){void 0===i&&(i=0);var o=t.call(this,e.x,e.y,e.z)||this;return o.buttonIndex=i,o}return n(e,t),e}(h.Vector3),dt=function(){function t(t){this.name=t,this._downCount=0,this._enterCount=-1,this._downPointerIds={},this._isVisible=!0,this._isScaledByManager=!1,this.onPointerMoveObservable=new h.Observable,this.onPointerOutObservable=new h.Observable,this.onPointerDownObservable=new h.Observable,this.onPointerUpObservable=new h.Observable,this.onPointerClickObservable=new h.Observable,this.onPointerEnterObservable=new h.Observable,this._behaviors=new Array}return Object.defineProperty(t.prototype,"position",{get:function(){return this._node?this._node.position:h.Vector3.Zero()},set:function(t){this._node&&(this._node.position=t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaling",{get:function(){return this._node?this._node.scaling:new h.Vector3(1,1,1)},set:function(t){this._node&&(this._isScaledByManager=!1,this._node.scaling=t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"behaviors",{get:function(){return this._behaviors},enumerable:!1,configurable:!0}),t.prototype.addBehavior=function(t){var e=this;if(-1!==this._behaviors.indexOf(t))return this;t.init();var i=this._host.scene;return i.isLoading?i.onDataLoadedObservable.addOnce((function(){t.attach(e)})):t.attach(this),this._behaviors.push(t),this},t.prototype.removeBehavior=function(t){var e=this._behaviors.indexOf(t);return-1===e||(this._behaviors[e].detach(),this._behaviors.splice(e,1)),this},t.prototype.getBehaviorByName=function(t){for(var e=0,i=this._behaviors;e<i.length;e++){var o=i[e];if(o.name===t)return o}return null},Object.defineProperty(t.prototype,"isVisible",{get:function(){return this._isVisible},set:function(t){if(this._isVisible!==t){this._isVisible=t;var e=this.mesh;e&&e.setEnabled(t)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"typeName",{get:function(){return this._getTypeName()},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return this._getTypeName()},t.prototype._getTypeName=function(){return"Control3D"},Object.defineProperty(t.prototype,"node",{get:function(){return this._node},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mesh",{get:function(){return this._node instanceof h.AbstractMesh?this._node:null},enumerable:!1,configurable:!0}),t.prototype.linkToTransformNode=function(t){return this._node&&(this._node.parent=t),this},t.prototype._prepareNode=function(t){if(!this._node){if(this._node=this._createNode(t),!this.node)return;this._injectGUI3DReservedDataStore(this.node).control=this;var e=this.mesh;e&&(e.isPickable=!0,this._affectMaterial(e))}},t.prototype._injectGUI3DReservedDataStore=function(t){var e,i;return t.reservedDataStore=null!==(e=t.reservedDataStore)&&void 0!==e?e:{},t.reservedDataStore.GUI3D=null!==(i=t.reservedDataStore.GUI3D)&&void 0!==i?i:{},t.reservedDataStore.GUI3D},t.prototype._createNode=function(t){return null},t.prototype._affectMaterial=function(t){t.material=null},t.prototype._isTouchButton3D=function(t){return void 0!==t._generatePointerEventType},t.prototype._onPointerMove=function(t,e){this.onPointerMoveObservable.notifyObservers(e,-1,t,this)},t.prototype._onPointerEnter=function(t){return-1===this._enterCount&&(this._enterCount=0),this._enterCount++,!(this._enterCount>1||(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,o){return this._downCount++,this._downPointerIds[i]=this._downPointerIds[i]+1||1,1===this._downCount&&(this.onPointerDownObservable.notifyObservers(new ut(e,o),-1,t,this),this.pointerDownAnimation&&this.pointerDownAnimation(),!0)},t.prototype._onPointerUp=function(t,e,i,o,r){this._downCount--,this._downPointerIds[i]--,this._downPointerIds[i]<=0&&delete this._downPointerIds[i],this._downCount<0?this._downCount=0:0==this._downCount&&(r&&(this._enterCount>0||-1===this._enterCount)&&this.onPointerClickObservable.notifyObservers(new ut(e,o),-1,t,this),this.onPointerUpObservable.notifyObservers(new ut(e,o),-1,t,this),this.pointerUpAnimation&&this.pointerUpAnimation())},t.prototype.forcePointerUp=function(t){if(void 0===t&&(t=null),null!==t)this._onPointerUp(this,h.Vector3.Zero(),t,0,!0);else{for(var e in this._downPointerIds)this._onPointerUp(this,h.Vector3.Zero(),+e,0,!0);this._downCount>0&&(this._downCount=1,this._onPointerUp(this,h.Vector3.Zero(),0,0,!0))}},t.prototype._processObservables=function(t,e,i,o,r){if(this._isTouchButton3D(this)&&i&&(t=this._generatePointerEventType(t,i,this._downCount)),t===h.PointerEventTypes.POINTERMOVE){this._onPointerMove(this,e);var n=this._host._lastControlOver[o];return n&&n!==this&&n._onPointerOut(this),n!==this&&this._onPointerEnter(this),this._host._lastControlOver[o]=this,!0}return t===h.PointerEventTypes.POINTERDOWN?(this._onPointerDown(this,e,o,r),this._host._lastControlDown[o]=this,this._host._lastPickedControl=this,!0):(t===h.PointerEventTypes.POINTERUP||t===h.PointerEventTypes.POINTERDOUBLETAP)&&(this._host._lastControlDown[o]&&this._host._lastControlDown[o]._onPointerUp(this,e,o,r,!0),delete this._host._lastControlDown[o],!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;t<e.length;t++)e[t].detach()},t}(),ft=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._contentResolution=512,e._contentScaleRatio=2,e}return n(e,t),Object.defineProperty(e.prototype,"content",{get:function(){return this._content},set:function(t){this._content=t,t&&this._host&&this._host.utilityLayer&&(this._facadeTexture?this._facadeTexture.rootContainer.clearControls():(this._facadeTexture=new lt("Facade",this._contentResolution,this._contentResolution,this._host.utilityLayer.utilityLayerScene,!0,h.Texture.TRILINEAR_SAMPLINGMODE),this._setFacadeTextureScaling(),this._facadeTexture.premulAlpha=!0),this._facadeTexture.addControl(t),this._applyFacade(this._facadeTexture))},enumerable:!1,configurable:!0}),e.prototype._setFacadeTextureScaling=function(){var t;this._facadeTexture&&(this._facadeTexture.rootContainer.scaleX=this._contentScaleRatio,this._facadeTexture.rootContainer.scaleY=null!==(t=this._contentScaleRatioY)&&void 0!==t?t:this._contentScaleRatio)},Object.defineProperty(e.prototype,"contentResolution",{get:function(){return this._contentResolution},set:function(t){this._contentResolution!==t&&(this._contentResolution=t,this._resetContent())},enumerable:!1,configurable:!0}),e.prototype._disposeFacadeTexture=function(){this._facadeTexture&&(this._facadeTexture.dispose(),this._facadeTexture=null)},e.prototype._resetContent=function(){this._disposeFacadeTexture(),this.content=this._content},e.prototype._applyFacade=function(t){},e}(dt),pt=function(t){function e(e){return t.call(this,e)||this}return n(e,t),e.prototype._getTypeName=function(){return"AbstractButton3D"},e.prototype._createNode=function(t){return new h.TransformNode("button"+this.name,t)},e}(ft),gt=function(t){function e(e,i){var o=t.call(this,e)||this;return o._options=a({width:1,height:1,depth:.08},i),o.pointerEnterAnimation=function(){o.mesh&&(o._currentMaterial.emissiveColor=h.Color3.Red())},o.pointerOutAnimation=function(){o._currentMaterial.emissiveColor=h.Color3.Black()},o.pointerDownAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(.95)},o.pointerUpAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1/.95)},o}return n(e,t),e.prototype._applyFacade=function(t){this._currentMaterial.emissiveTexture=t},e.prototype._getTypeName=function(){return"Button3D"},e.prototype._createNode=function(t){for(var e=new Array(6),i=0;i<6;i++)e[i]=new h.Vector4(0,0,0,0);t.useRightHandedSystem?e[0].copyFromFloats(1,0,0,1):e[1].copyFromFloats(0,0,1,1);var o=(0,h.CreateBox)(this.name+"_rootMesh",{width:this._options.width,height:this._options.height,depth:this._options.depth,faceUV:e,wrap:!0},t);return this._contentScaleRatioY=this._contentScaleRatio*this._options.width/this._options.height,this._setFacadeTextureScaling(),o},e.prototype._affectMaterial=function(t){var e=new h.StandardMaterial(this.name+"Material",t.getScene());e.specularColor=h.Color3.Black(),t.material=e,this._currentMaterial=e,this._resetContent()},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._disposeFacadeTexture(),this._currentMaterial&&this._currentMaterial.dispose()},e}(pt),bt=function(t){function e(e){var i=t.call(this,e)||this;return i._blockLayout=!1,i._children=new Array,i}return n(e,t),Object.defineProperty(e.prototype,"children",{get:function(){return this._children},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blockLayout",{get:function(){return this._blockLayout},set:function(t){this._blockLayout!==t&&(this._blockLayout=t,this._blockLayout||this._arrangeChildren())},enumerable:!1,configurable:!0}),e.prototype.updateLayout=function(){return this._arrangeChildren(),this},e.prototype.containsControl=function(t){return-1!==this._children.indexOf(t)},e.prototype.addControl=function(t){return-1!==this._children.indexOf(t)||(t.parent=this,t._host=this._host,this._children.push(t),this._host.utilityLayer&&(t._prepareNode(this._host.utilityLayer.utilityLayerScene),t.node&&(t.node.parent=this.node),this.blockLayout||this._arrangeChildren())),this},e.prototype._arrangeChildren=function(){},e.prototype._createNode=function(t){return new h.TransformNode("ContainerNode",t)},e.prototype.removeControl=function(t){var e=this._children.indexOf(t);return-1!==e&&(this._children.splice(e,1),t.parent=null,t._disposeNode()),this},e.prototype._getTypeName=function(){return"Container3D"},e.prototype.dispose=function(){for(var e=0,i=this._children;e<i.length;e++)i[e].dispose();this._children.length=0,t.prototype.dispose.call(this)},e.UNSET_ORIENTATION=0,e.FACEORIGIN_ORIENTATION=1,e.FACEORIGINREVERSED_ORIENTATION=2,e.FACEFORWARD_ORIENTATION=3,e.FACEFORWARDREVERSED_ORIENTATION=4,e}(dt),mt=function(t){function e(e){var i=t.call(this,e)||this;return i._columns=10,i._rows=0,i._rowThenColum=!0,i._orientation=bt.FACEORIGIN_ORIENTATION,i.margin=0,i}return n(e,t),Object.defineProperty(e.prototype,"orientation",{get:function(){return this._orientation},set:function(t){var e=this;this._orientation!==t&&(this._orientation=t,h.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"columns",{get:function(){return this._columns},set:function(t){var e=this;this._columns!==t&&(this._columns=t,this._rowThenColum=!0,h.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rows",{get:function(){return this._rows},set:function(t){var e=this;this._rows!==t&&(this._rows=t,this._rowThenColum=!1,h.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._arrangeChildren=function(){this._cellWidth=0,this._cellHeight=0;for(var t=0,e=0,i=0,o=h.Matrix.Invert(this.node.computeWorldMatrix(!0)),r=0,n=this._children;r<n.length;r++)if((m=n[r]).mesh){i++,m.mesh.computeWorldMatrix(!0);var a=m.mesh.getHierarchyBoundingVectors(),s=h.TmpVectors.Vector3[0],l=h.TmpVectors.Vector3[1];a.max.subtractToRef(a.min,l),l.scaleInPlace(.5),h.Vector3.TransformNormalToRef(l,o,s),this._cellWidth=Math.max(this._cellWidth,2*s.x),this._cellHeight=Math.max(this._cellHeight,2*s.y)}this._cellWidth+=2*this.margin,this._cellHeight+=2*this.margin,this._rowThenColum?(e=this._columns,t=Math.ceil(i/this._columns)):(t=this._rows,e=Math.ceil(i/this._rows));var _=.5*e*this._cellWidth,c=.5*t*this._cellHeight,u=[],d=0;if(this._rowThenColum)for(var f=0;f<t;f++)for(var p=0;p<e&&(u.push(new h.Vector3(p*this._cellWidth-_+this._cellWidth/2,f*this._cellHeight-c+this._cellHeight/2,0)),!(++d>i));p++);else for(p=0;p<e;p++)for(f=0;f<t&&(u.push(new h.Vector3(p*this._cellWidth-_+this._cellWidth/2,f*this._cellHeight-c+this._cellHeight/2,0)),!(++d>i));f++);d=0;for(var g=0,b=this._children;g<b.length;g++){var m;(m=b[g]).mesh&&(this._mapGridNode(m,u[d]),d++)}this._finalProcessing()},e.prototype._finalProcessing=function(){},e}(bt),vt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._radius=5,e}return n(e,t),Object.defineProperty(e.prototype,"radius",{get:function(){return this._radius},set:function(t){var e=this;this._radius!==t&&(this._radius=t,h.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._mapGridNode=function(t,e){var i=t.mesh;if(i){var o=this._cylindricalMapping(e);switch(t.position=o,this.orientation){case bt.FACEORIGIN_ORIENTATION:i.lookAt(new h.Vector3(2*o.x,o.y,2*o.z));break;case bt.FACEORIGINREVERSED_ORIENTATION:i.lookAt(new h.Vector3(-o.x,o.y,-o.z));break;case bt.FACEFORWARD_ORIENTATION:break;case bt.FACEFORWARDREVERSED_ORIENTATION:i.rotate(h.Axis.Y,Math.PI,0)}}},e.prototype._cylindricalMapping=function(t){var e=new h.Vector3(0,t.y,this._radius),i=t.x/this._radius;return h.Matrix.RotationYawPitchRollToRef(i,0,0,h.TmpVectors.Matrix[0]),h.Vector3.TransformNormal(e,h.TmpVectors.Matrix[0])},e}(mt);h.ShaderStore.ShadersStore.fluentVertexShader="precision highp float;attribute vec3 position;attribute vec3 normal;attribute vec2 uv;uniform mat4 world;uniform mat4 viewProjection;varying vec2 vUV;\n#ifdef BORDER\nvarying vec2 scaleInfo;uniform float borderWidth;uniform vec3 scaleFactor;\n#endif\n#ifdef HOVERLIGHT\nvarying vec3 worldPosition;\n#endif\nvoid main(void) {vUV=uv;\n#ifdef BORDER\nvec3 scale=scaleFactor;float minScale=min(min(scale.x,scale.y),scale.z);float maxScale=max(max(scale.x,scale.y),scale.z);float minOverMiddleScale=minScale/(scale.x+scale.y+scale.z-minScale-maxScale);float areaYZ=scale.y*scale.z;float areaXZ=scale.x*scale.z;float areaXY=scale.x*scale.y;float scaledBorderWidth=borderWidth; \nif (abs(normal.x)==1.0) \n{scale.x=scale.y;scale.y=scale.z;if (areaYZ>areaXZ && areaYZ>areaXY)\n{scaledBorderWidth*=minOverMiddleScale;}}\nelse if (abs(normal.y)==1.0) \n{scale.x=scale.z;if (areaXZ>areaXY && areaXZ>areaYZ)\n{scaledBorderWidth*=minOverMiddleScale;}}\nelse \n{if (areaXY>areaYZ && areaXY>areaXZ)\n{scaledBorderWidth*=minOverMiddleScale;}}\nfloat scaleRatio=min(scale.x,scale.y)/max(scale.x,scale.y);if (scale.x>scale.y)\n{scaleInfo.x=1.0-(scaledBorderWidth*scaleRatio);scaleInfo.y=1.0-scaledBorderWidth;}\nelse\n{scaleInfo.x=1.0-scaledBorderWidth;scaleInfo.y=1.0-(scaledBorderWidth*scaleRatio);} \n#endif \nvec4 worldPos=world*vec4(position,1.0);\n#ifdef HOVERLIGHT\nworldPosition=worldPos.xyz;\n#endif\ngl_Position=viewProjection*worldPos;}\n";h.ShaderStore.ShadersStore.fluentPixelShader="precision highp float;varying vec2 vUV;uniform vec4 albedoColor;\n#ifdef INNERGLOW\nuniform vec4 innerGlowColor;\n#endif\n#ifdef BORDER\nvarying vec2 scaleInfo;uniform float edgeSmoothingValue;uniform float borderMinValue;\n#endif\n#ifdef HOVERLIGHT\nvarying vec3 worldPosition;uniform vec3 hoverPosition;uniform vec4 hoverColor;uniform float hoverRadius;\n#endif\n#ifdef TEXTURE\nuniform sampler2D albedoSampler;uniform mat4 textureMatrix;vec2 finalUV;\n#endif\nvoid main(void) {vec3 albedo=albedoColor.rgb;float alpha=albedoColor.a;\n#ifdef TEXTURE\nfinalUV=vec2(textureMatrix*vec4(vUV,1.0,0.0));albedo=texture2D(albedoSampler,finalUV).rgb;\n#endif\n#ifdef HOVERLIGHT\nfloat pointToHover=(1.0-clamp(length(hoverPosition-worldPosition)/hoverRadius,0.,1.))*hoverColor.a;albedo=clamp(albedo+hoverColor.rgb*pointToHover,0.,1.);\n#else\nfloat pointToHover=1.0;\n#endif\n#ifdef BORDER \nfloat borderPower=10.0;float inverseBorderPower=1.0/borderPower;vec3 borderColor=albedo*borderPower;vec2 distanceToEdge;distanceToEdge.x=abs(vUV.x-0.5)*2.0;distanceToEdge.y=abs(vUV.y-0.5)*2.0;float borderValue=max(smoothstep(scaleInfo.x-edgeSmoothingValue,scaleInfo.x+edgeSmoothingValue,distanceToEdge.x),\nsmoothstep(scaleInfo.y-edgeSmoothingValue,scaleInfo.y+edgeSmoothingValue,distanceToEdge.y));borderColor=borderColor*borderValue*max(borderMinValue*inverseBorderPower,pointToHover); \nalbedo+=borderColor;alpha=max(alpha,borderValue);\n#endif\n#ifdef INNERGLOW\nvec2 uvGlow=(vUV-vec2(0.5,0.5))*(innerGlowColor.a*2.0);uvGlow=uvGlow*uvGlow;uvGlow=uvGlow*uvGlow;albedo+=mix(vec3(0.0,0.0,0.0),innerGlowColor.rgb,uvGlow.x+uvGlow.y); \n#endif\ngl_FragColor=vec4(albedo,alpha);}";var yt=function(t){function e(){var e=t.call(this)||this;return e.INNERGLOW=!1,e.BORDER=!1,e.HOVERLIGHT=!1,e.TEXTURE=!1,e.rebuild(),e}return n(e,t),e}(h.MaterialDefines),xt=function(t){function e(e,i){var o=t.call(this,e,i)||this;return o.innerGlowColorIntensity=.5,o.innerGlowColor=new h.Color3(1,1,1),o.albedoColor=new h.Color3(.3,.35,.4),o.renderBorders=!1,o.borderWidth=.5,o.edgeSmoothingValue=.02,o.borderMinValue=.1,o.renderHoverLight=!1,o.hoverRadius=.01,o.hoverColor=new h.Color4(.3,.3,.3,1),o.hoverPosition=h.Vector3.Zero(),o}return n(e,t),e.prototype.needAlphaBlending=function(){return 1!==this.alpha},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){var i=e._drawWrapper;if(this.isFrozen&&i.effect&&i._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new yt);var o=this.getScene(),r=e.materialDefines;if(!this.checkReadyOnEveryCall&&e.effect&&r._renderId===o.getRenderId())return!0;if(r._areTexturesDirty)if(r.INNERGLOW=this.innerGlowColorIntensity>0,r.BORDER=this.renderBorders,r.HOVERLIGHT=this.renderHoverLight,this._albedoTexture){if(!this._albedoTexture.isReadyOrNotBlocking())return!1;r.TEXTURE=!0}else r.TEXTURE=!1;var n=o.getEngine();if(r.isDirty){r.markAsProcessed(),o.resetCachedMaterial();var a=[h.VertexBuffer.PositionKind];a.push(h.VertexBuffer.NormalKind),a.push(h.VertexBuffer.UVKind);var s=["world","viewProjection","innerGlowColor","albedoColor","borderWidth","edgeSmoothingValue","scaleFactor","borderMinValue","hoverColor","hoverPosition","hoverRadius","textureMatrix"],l=["albedoSampler"],_=[];(0,h.PrepareUniformsAndSamplersList)({uniformsNames:s,uniformBuffersNames:_,samplers:l,defines:r,maxSimultaneousLights:4});var c=r.toString();e.setEffect(o.getEngine().createEffect("fluent",{attributes:a,uniformsNames:s,uniformBuffersNames:_,samplers:l,defines:c,fallbacks:null,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),r,this._materialContext)}return!(!e.effect||!e.effect.isReady()||(r._renderId=o.getRenderId(),i._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o=this.getScene(),r=i.materialDefines;if(r){var n=i.effect;if(n){if(this._activeEffect=n,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),this._mustRebind(o,n,i)&&(this._activeEffect.setColor4("albedoColor",this.albedoColor,this.alpha),r.INNERGLOW&&this._activeEffect.setColor4("innerGlowColor",this.innerGlowColor,this.innerGlowColorIntensity),r.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,h.TmpVectors.Vector3[0]),this._activeEffect.setVector3("scaleFactor",h.TmpVectors.Vector3[0])),r.HOVERLIGHT&&(this._activeEffect.setDirectColor4("hoverColor",this.hoverColor),this._activeEffect.setFloat("hoverRadius",this.hoverRadius),this._activeEffect.setVector3("hoverPosition",this.hoverPosition)),r.TEXTURE&&this._albedoTexture)){this._activeEffect.setTexture("albedoSampler",this._albedoTexture);var a=this._albedoTexture.getTextureMatrix();this._activeEffect.setMatrix("textureMatrix",a)}this._afterBind(e,this._activeEffect,i)}}},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 h.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,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},s([(0,h.serialize)(),(0,h.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"innerGlowColorIntensity",void 0),s([(0,h.serializeAsColor3)()],e.prototype,"innerGlowColor",void 0),s([(0,h.serializeAsColor3)()],e.prototype,"albedoColor",void 0),s([(0,h.serialize)(),(0,h.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"renderBorders",void 0),s([(0,h.serialize)()],e.prototype,"borderWidth",void 0),s([(0,h.serialize)()],e.prototype,"edgeSmoothingValue",void 0),s([(0,h.serialize)()],e.prototype,"borderMinValue",void 0),s([(0,h.serialize)(),(0,h.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"renderHoverLight",void 0),s([(0,h.serialize)()],e.prototype,"hoverRadius",void 0),s([(0,h.serializeAsColor4)()],e.prototype,"hoverColor",void 0),s([(0,h.serializeAsVector3)()],e.prototype,"hoverPosition",void 0),s([(0,h.serializeAsTexture)("albedoTexture")],e.prototype,"_albedoTexture",void 0),s([(0,h.expandToProperty)("_markAllSubMeshesAsTexturesAndMiscDirty")],e.prototype,"albedoTexture",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.FluentMaterial",xt);var Pt=function(t){function e(e){var i=t.call(this,e)||this;return i._backPlateMargin=1.25,i}return n(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 h.Mesh("menu_".concat(this.name),t);return this._backPlate=(0,h.CreateBox)("backPlate"+this.name,{size:1},t),this._backPlate.parent=e,e},e.prototype._affectMaterial=function(t){var e=this;this._backPlateMaterial=new xt(this.name+"backPlateMaterial",t.getScene()),this._backPlateMaterial.albedoColor=new h.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;e<this._children.length;e++)this._children[e].position.subtractInPlace(this._currentMin).subtractInPlace(t.scale(.5)),this._children[e].position.z-=.01}this._currentMin=null,this._currentMax=null},e.prototype.addButton=function(i){var o=this.blockLayout;return o||(this.blockLayout=!0),t.prototype.addControl.call(this,i),i.isBackplateVisible=!1,i.scaling.scaleInPlace(e.MENU_BUTTON_SCALE),o||(this.blockLayout=!1),this},e.prototype.addControl=function(t){return h.Logger.Warn("TouchHolographicMenu can only contain buttons. Please use the method `addButton` instead."),this},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver)},e.MENU_BUTTON_SCALE=1,e}(mt),It=function(t){function e(e,i){var o=t.call(this,i)||this;return o._handConstraintBehavior=new h.HandConstraintBehavior,o._handConstraintBehavior.linkToXRExperience(e),o.backPlateMargin=.15,o.rows=3,o}return n(e,t),Object.defineProperty(e.prototype,"handConstraintBehavior",{get:function(){return this._handConstraintBehavior},enumerable:!1,configurable:!0}),e.prototype._createNode=function(e){var i=t.prototype._createNode.call(this,e);return this._handConstraintBehavior.attach(i),i},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._handConstraintBehavior.detach()},e}(Pt);h.ShaderStore.ShadersStore.fluentBackplatePixelShader="uniform vec3 cameraPosition;varying vec3 vPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec3 vBinormal;varying vec4 vColor;varying vec4 vExtra1;varying vec4 vExtra2;varying vec4 vExtra3;uniform float _Radius_;uniform float _Line_Width_;uniform bool _Absolute_Sizes_;uniform float _Filter_Width_;uniform vec4 _Base_Color_;uniform vec4 _Line_Color_;uniform float _Radius_Top_Left_;uniform float _Radius_Top_Right_;uniform float _Radius_Bottom_Left_;uniform float _Radius_Bottom_Right_;uniform vec3 _Blob_Position_;uniform float _Blob_Intensity_;uniform float _Blob_Near_Size_;uniform float _Blob_Far_Size_;uniform float _Blob_Near_Distance_;uniform float _Blob_Far_Distance_;uniform float _Blob_Fade_Length_;uniform float _Blob_Pulse_;uniform float _Blob_Fade_;uniform sampler2D _Blob_Texture_;uniform vec3 _Blob_Position_2_;uniform float _Blob_Near_Size_2_;uniform float _Blob_Pulse_2_;uniform float _Blob_Fade_2_;uniform float _Rate_;uniform vec4 _Highlight_Color_;uniform float _Highlight_Width_;uniform vec4 _Highlight_Transform_;uniform float _Highlight_;uniform float _Iridescence_Intensity_;uniform float _Iridescence_Edge_Intensity_;uniform float _Angle_;uniform float _Fade_Out_;uniform bool _Reflected_;uniform float _Frequency_;uniform float _Vertical_Offset_;uniform sampler2D _Iridescent_Map_;uniform bool _Use_Global_Left_Index_;uniform bool _Use_Global_Right_Index_;uniform vec4 Global_Left_Index_Tip_Position;uniform vec4 Global_Right_Index_Tip_Position;void Round_Rect_Fragment_B31(\nfloat Radius,\nfloat Line_Width,\nvec4 Line_Color,\nfloat Filter_Width,\nvec2 UV,\nfloat Line_Visibility,\nvec4 Rect_Parms,\nvec4 Fill_Color,\nout vec4 Color)\n{float d=length(max(abs(UV)-Rect_Parms.xy,0.0));float dx=max(fwidth(d)*Filter_Width,0.00001);float g=min(Rect_Parms.z,Rect_Parms.w);float dgrad=max(fwidth(g)*Filter_Width,0.00001);float Inside_Rect=clamp(g/dgrad,0.0,1.0);float inner=clamp((d+dx*0.5-max(Radius-Line_Width,d-dx*0.5))/dx,0.0,1.0);Color=clamp(mix(Fill_Color,Line_Color,inner),0.0,1.0)*Inside_Rect;}\nvoid Blob_Fragment_B71(\nsampler2D Blob_Texture,\nvec4 Blob_Info1,\nvec4 Blob_Info2,\nout vec4 Blob_Color)\n{float k1=dot(Blob_Info1.xy,Blob_Info1.xy);float k2=dot(Blob_Info2.xy,Blob_Info2.xy);vec3 closer=k1<k2 ? vec3(k1,Blob_Info1.z,Blob_Info1.w) : vec3(k2,Blob_Info2.z,Blob_Info2.w);Blob_Color=closer.z*texture(Blob_Texture,vec2(vec2(sqrt(closer.x),closer.y).x,1.0-vec2(sqrt(closer.x),closer.y).y))*clamp(1.0-closer.x,0.0,1.0);}\nvoid Line_Fragment_B48(\nvec4 Base_Color,\nvec4 Highlight_Color,\nfloat Highlight_Width,\nvec3 Line_Vertex,\nfloat Highlight,\nout vec4 Line_Color)\n{float k2=1.0-clamp(abs(Line_Vertex.y/Highlight_Width),0.0,1.0);Line_Color=mix(Base_Color,Highlight_Color,Highlight*k2);}\nvoid Scale_RGB_B54(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{Result=vec4(Scalar,Scalar,Scalar,1)*Color;}\nvoid Conditional_Float_B38(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{Result=Which ? If_True : If_False;}\nvoid main()\n{float R_Q72;float G_Q72;float B_Q72;float A_Q72;R_Q72=vColor.r; G_Q72=vColor.g; B_Q72=vColor.b; A_Q72=vColor.a;vec4 Blob_Color_Q71;\n#if BLOB_ENABLE\nfloat k1=dot(vExtra2.xy,vExtra2.xy);float k2=dot(vExtra3.xy,vExtra3.xy);vec3 closer=k1<k2 ? vec3(k1,vExtra2.z,vExtra2.w) : vec3(k2,vExtra3.z,vExtra3.w);Blob_Color_Q71=closer.z*texture(_Blob_Texture_,vec2(vec2(sqrt(closer.x),closer.y).x,1.0-vec2(sqrt(closer.x),closer.y).y))*clamp(1.0-closer.x,0.0,1.0);\n#else\nBlob_Color_Q71=vec4(0,0,0,0);\n#endif\nvec4 Line_Color_Q48;Line_Fragment_B48(_Line_Color_,_Highlight_Color_,_Highlight_Width_,vTangent,_Highlight_,Line_Color_Q48);float X_Q67;float Y_Q67;X_Q67=vUV.x;Y_Q67=vUV.y;vec3 Incident_Q66=normalize(vPosition-cameraPosition);vec3 Reflected_Q60=reflect(Incident_Q66,vBinormal);float Product_Q63=Y_Q67*_Vertical_Offset_;float Dot_Q68=dot(Incident_Q66, Reflected_Q60);float Dot_Q57=dot(vNormal, Incident_Q66);float Result_Q38;Conditional_Float_B38(_Reflected_,Dot_Q68,Dot_Q57,Result_Q38);float Product_Q64=Result_Q38*_Frequency_;float Sum_Q69=Product_Q64+1.0;float Product_Q70=Sum_Q69*0.5;float Sum_Q62=Product_Q63+Product_Q70;float FractF_Q59=fract(Sum_Q62);vec2 Vec2_Q65=vec2(FractF_Q59,0.5);vec4 Color_Q58;\n#if IRIDESCENT_MAP_ENABLE\nColor_Q58=texture(_Iridescent_Map_,Vec2_Q65);\n#else\nColor_Q58=vec4(0,0,0,0);\n#endif\nvec4 Result_Q54;Scale_RGB_B54(Color_Q58,_Iridescence_Edge_Intensity_,Result_Q54);vec4 Result_Q55;Scale_RGB_B54(Color_Q58,_Iridescence_Intensity_,Result_Q55);vec4 Base_And_Iridescent_Q53;Base_And_Iridescent_Q53=Line_Color_Q48+vec4(Result_Q54.rgb,0.0);vec4 Base_And_Iridescent_Q56;Base_And_Iridescent_Q56=_Base_Color_+vec4(Result_Q55.rgb,0.0);vec4 Result_Q52=Base_And_Iridescent_Q53; Result_Q52.a=1.0;vec4 Result_Q35=Blob_Color_Q71+(1.0-Blob_Color_Q71.a)*Base_And_Iridescent_Q56;vec4 Color_Q31;Round_Rect_Fragment_B31(R_Q72,G_Q72,Result_Q52,_Filter_Width_,vUV,1.0,vExtra1,Result_Q35,Color_Q31);vec4 Result_Q47=_Fade_Out_*Color_Q31;vec4 Out_Color=Result_Q47;float Clip_Threshold=0.001;bool To_sRGB=false;gl_FragColor=Out_Color;}";h.ShaderStore.ShadersStore.fluentBackplateVertexShader="uniform mat4 world;uniform mat4 viewProjection;uniform vec3 cameraPosition;attribute vec3 position;attribute vec3 normal;\n#ifdef TANGENT\nattribute vec3 tangent;\n#else\nconst vec3 tangent=vec3(0.);\n#endif\nuniform float _Radius_;uniform float _Line_Width_;uniform bool _Absolute_Sizes_;uniform float _Filter_Width_;uniform vec4 _Base_Color_;uniform vec4 _Line_Color_;uniform float _Radius_Top_Left_;uniform float _Radius_Top_Right_;uniform float _Radius_Bottom_Left_;uniform float _Radius_Bottom_Right_;uniform vec3 _Blob_Position_;uniform float _Blob_Intensity_;uniform float _Blob_Near_Size_;uniform float _Blob_Far_Size_;uniform float _Blob_Near_Distance_;uniform float _Blob_Far_Distance_;uniform float _Blob_Fade_Length_;uniform float _Blob_Pulse_;uniform float _Blob_Fade_;uniform sampler2D _Blob_Texture_;uniform vec3 _Blob_Position_2_;uniform float _Blob_Near_Size_2_;uniform float _Blob_Pulse_2_;uniform float _Blob_Fade_2_;uniform float _Rate_;uniform vec4 _Highlight_Color_;uniform float _Highlight_Width_;uniform vec4 _Highlight_Transform_;uniform float _Highlight_;uniform float _Iridescence_Intensity_;uniform float _Iridescence_Edge_Intensity_;uniform float _Angle_;uniform float _Fade_Out_;uniform bool _Reflected_;uniform float _Frequency_;uniform float _Vertical_Offset_;uniform sampler2D _Iridescent_Map_;uniform bool _Use_Global_Left_Index_;uniform bool _Use_Global_Right_Index_;uniform vec4 Global_Left_Index_Tip_Position;uniform vec4 Global_Right_Index_Tip_Position;varying vec3 vPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec3 vBinormal;varying vec4 vColor;varying vec4 vExtra1;varying vec4 vExtra2;varying vec4 vExtra3;void Object_To_World_Pos_B115(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{Pos_World=(world*vec4(Pos_Object,1.0)).xyz;}\nvoid PickDir_B140(\nfloat Degrees,\nvec3 DirX,\nvec3 DirY,\nout vec3 Dir)\n{float a=Degrees*3.14159/180.0;Dir=cos(a)*DirX+sin(a)*DirY;}\nvoid Round_Rect_Vertex_B139(\nvec2 UV,\nfloat Radius,\nfloat Margin,\nfloat Anisotropy,\nfloat Gradient1,\nfloat Gradient2,\nout vec2 Rect_UV,\nout vec4 Rect_Parms,\nout vec2 Scale_XY,\nout vec2 Line_UV)\n{Scale_XY=vec2(Anisotropy,1.0);Line_UV=(UV-vec2(0.5,0.5));Rect_UV=Line_UV*Scale_XY;Rect_Parms.xy=Scale_XY*0.5-vec2(Radius,Radius)-vec2(Margin,Margin);Rect_Parms.z=Gradient1; \nRect_Parms.w=Gradient2;}\nvoid Line_Vertex_B135(\nvec2 Scale_XY,\nvec2 UV,\nfloat Time,\nfloat Rate,\nvec4 Highlight_Transform,\nout vec3 Line_Vertex)\n{float angle2=(Rate*Time)*2.0*3.1416;float sinAngle2=sin(angle2);float cosAngle2=cos(angle2);vec2 xformUV=UV*Highlight_Transform.xy+Highlight_Transform.zw;Line_Vertex.x=0.0;Line_Vertex.y=cosAngle2*xformUV.x-sinAngle2*xformUV.y;Line_Vertex.z=0.0; }\nvoid Blob_Vertex_B180(\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,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{vec3 blob=Blob_Position;vec3 delta=blob-Position;float dist=dot(Normal,delta);float lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);float fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);float size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;vec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);float Fade=fadeValue*Intensity*Blob_Fade;float Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);Blob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);}\nvoid Move_Verts_B129(\nfloat Anisotropy,\nvec3 P,\nfloat Radius,\nout vec3 New_P,\nout vec2 New_UV,\nout float Radial_Gradient,\nout vec3 Radial_Dir)\n{vec2 UV=P.xy*2.0+0.5;vec2 center=clamp(UV,0.0,1.0);vec2 delta=UV-center;vec2 r2=2.0*vec2(Radius/Anisotropy,Radius);New_UV=center+r2*(UV-2.0*center+0.5);New_P=vec3(New_UV-0.5,P.z);Radial_Gradient=1.0-length(delta)*2.0;Radial_Dir=vec3(delta*r2,0.0);}\nvoid Object_To_World_Dir_B132(\nvec3 Dir_Object,\nout vec3 Binormal_World,\nout vec3 Binormal_World_N,\nout float Binormal_Length)\n{Binormal_World=(world*vec4(Dir_Object,0.0)).xyz;Binormal_Length=length(Binormal_World);Binormal_World_N=Binormal_World/Binormal_Length;}\nvoid RelativeOrAbsoluteDetail_B147(\nfloat Nominal_Radius,\nfloat Nominal_LineWidth,\nbool Absolute_Measurements,\nfloat Height,\nout float Radius,\nout float Line_Width)\n{float scale=Absolute_Measurements ? 1.0/Height : 1.0;Radius=Nominal_Radius*scale;Line_Width=Nominal_LineWidth*scale;}\nvoid Edge_AA_Vertex_B130(\nvec3 Position_World,\nvec3 Position_Object,\nvec3 Normal_Object,\nvec3 Eye,\nfloat Radial_Gradient,\nvec3 Radial_Dir,\nvec3 Tangent,\nout float Gradient1,\nout float Gradient2)\n{vec3 I=(Eye-Position_World);vec3 T=(world* vec4(Tangent,0.0)).xyz;float g=(dot(T,I)<0.0) ? 0.0 : 1.0;if (Normal_Object.z==0.0) { \nGradient1=Position_Object.z>0.0 ? g : 1.0;Gradient2=Position_Object.z>0.0 ? 1.0 : g;} else {Gradient1=g+(1.0-g)*(Radial_Gradient);Gradient2=1.0;}}\nvoid Pick_Radius_B144(\nfloat Radius,\nfloat Radius_Top_Left,\nfloat Radius_Top_Right,\nfloat Radius_Bottom_Left,\nfloat Radius_Bottom_Right,\nvec3 Position,\nout float Result)\n{bool whichY=Position.y>0.0;Result=Position.x<0.0 ? (whichY ? Radius_Top_Left : Radius_Bottom_Left) : (whichY ? Radius_Top_Right : Radius_Bottom_Right);Result*=Radius;}\nvoid main()\n{vec3 Nrm_World_Q128;Nrm_World_Q128=normalize((world*vec4(normal,0.0)).xyz);vec3 Tangent_World_Q131;vec3 Tangent_World_N_Q131;float Tangent_Length_Q131;Tangent_World_Q131=(world*vec4(vec3(1,0,0),0.0)).xyz;Tangent_Length_Q131=length(Tangent_World_Q131);Tangent_World_N_Q131=Tangent_World_Q131/Tangent_Length_Q131;vec3 Binormal_World_Q132;vec3 Binormal_World_N_Q132;float Binormal_Length_Q132;Object_To_World_Dir_B132(vec3(0,1,0),Binormal_World_Q132,Binormal_World_N_Q132,Binormal_Length_Q132);float Anisotropy_Q133=Tangent_Length_Q131/Binormal_Length_Q132;vec3 Result_Q177;Result_Q177=mix(_Blob_Position_,Global_Left_Index_Tip_Position.xyz,float(_Use_Global_Left_Index_));vec3 Result_Q178;Result_Q178=mix(_Blob_Position_2_,Global_Right_Index_Tip_Position.xyz,float(_Use_Global_Right_Index_));float Result_Q144;Pick_Radius_B144(_Radius_,_Radius_Top_Left_,_Radius_Top_Right_,_Radius_Bottom_Left_,_Radius_Bottom_Right_,position,Result_Q144);vec3 Dir_Q140;PickDir_B140(_Angle_,Tangent_World_N_Q131,Binormal_World_N_Q132,Dir_Q140);float Radius_Q147;float Line_Width_Q147;RelativeOrAbsoluteDetail_B147(Result_Q144,_Line_Width_,_Absolute_Sizes_,Binormal_Length_Q132,Radius_Q147,Line_Width_Q147);vec4 Out_Color_Q145=vec4(Radius_Q147,Line_Width_Q147,0,1);vec3 New_P_Q129;vec2 New_UV_Q129;float Radial_Gradient_Q129;vec3 Radial_Dir_Q129;Move_Verts_B129(Anisotropy_Q133,position,Radius_Q147,New_P_Q129,New_UV_Q129,Radial_Gradient_Q129,Radial_Dir_Q129);vec3 Pos_World_Q115;Object_To_World_Pos_B115(New_P_Q129,Pos_World_Q115);vec4 Blob_Info_Q180;\n#if BLOB_ENABLE\nBlob_Vertex_B180(Pos_World_Q115,Nrm_World_Q128,Tangent_World_N_Q131,Binormal_World_N_Q132,Result_Q177,_Blob_Intensity_,_Blob_Near_Size_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_,_Blob_Fade_,Blob_Info_Q180);\n#else\nBlob_Info_Q180=vec4(0,0,0,0);\n#endif\nvec4 Blob_Info_Q181;\n#if BLOB_ENABLE_2\nBlob_Vertex_B180(Pos_World_Q115,Nrm_World_Q128,Tangent_World_N_Q131,Binormal_World_N_Q132,Result_Q178,_Blob_Intensity_,_Blob_Near_Size_2_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_2_,_Blob_Fade_2_,Blob_Info_Q181);\n#else\nBlob_Info_Q181=vec4(0,0,0,0);\n#endif\nfloat Gradient1_Q130;float Gradient2_Q130;\n#if SMOOTH_EDGES\nEdge_AA_Vertex_B130(Pos_World_Q115,position,normal,cameraPosition,Radial_Gradient_Q129,Radial_Dir_Q129,tangent,Gradient1_Q130,Gradient2_Q130);\n#else\nGradient1_Q130=1.0;Gradient2_Q130=1.0;\n#endif\nvec2 Rect_UV_Q139;vec4 Rect_Parms_Q139;vec2 Scale_XY_Q139;vec2 Line_UV_Q139;Round_Rect_Vertex_B139(New_UV_Q129,Radius_Q147,0.0,Anisotropy_Q133,Gradient1_Q130,Gradient2_Q130,Rect_UV_Q139,Rect_Parms_Q139,Scale_XY_Q139,Line_UV_Q139);vec3 Line_Vertex_Q135;Line_Vertex_B135(Scale_XY_Q139,Line_UV_Q139,0.0,_Rate_,_Highlight_Transform_,Line_Vertex_Q135);vec3 Position=Pos_World_Q115;vec3 Normal=Dir_Q140;vec2 UV=Rect_UV_Q139;vec3 Tangent=Line_Vertex_Q135;vec3 Binormal=Nrm_World_Q128;vec4 Color=Out_Color_Q145;vec4 Extra1=Rect_Parms_Q139;vec4 Extra2=Blob_Info_Q180;vec4 Extra3=Blob_Info_Q181;gl_Position=viewProjection*vec4(Position,1);vPosition=Position;vNormal=Normal;vUV=UV;vTangent=Tangent;vBinormal=Binormal;vColor=Color;vExtra1=Extra1;vExtra2=Extra2;vExtra3=Extra3;}";var Bt=function(t){function e(){var e=t.call(this)||this;return e.BLOB_ENABLE=!0,e.BLOB_ENABLE_2=!0,e.SMOOTH_EDGES=!0,e.IRIDESCENT_MAP_ENABLE=!0,e._needNormals=!0,e.rebuild(),e}return n(e,t),e}(h.MaterialDefines),Ct=function(t){function e(i,o){var r=t.call(this,i,o)||this;return r.radius=.03,r.lineWidth=.01,r.absoluteSizes=!1,r._filterWidth=1,r.baseColor=new h.Color4(.0392157,.0666667,.207843,1),r.lineColor=new h.Color4(.14902,.133333,.384314,1),r.blobIntensity=.98,r.blobFarSize=.04,r.blobNearDistance=0,r.blobFarDistance=.08,r.blobFadeLength=.08,r.blobNearSize=.22,r.blobPulse=0,r.blobFade=0,r.blobNearSize2=.22,r.blobPulse2=0,r.blobFade2=0,r._rate=.135,r.highlightColor=new h.Color4(.98,.98,.98,1),r.highlightWidth=.25,r._highlightTransform=new h.Vector4(1,1,0,0),r._highlight=1,r.iridescenceIntensity=0,r.iridescenceEdgeIntensity=1,r._angle=-45,r.fadeOut=1,r._reflected=!0,r._frequency=1,r._verticalOffset=0,r.globalLeftIndexTipPosition=h.Vector3.Zero(),r._globalLeftIndexTipPosition4=h.Vector4.Zero(),r.globalRightIndexTipPosition=h.Vector3.Zero(),r._globalRightIndexTipPosition4=h.Vector4.Zero(),r.alphaMode=h.Constants.ALPHA_DISABLE,r.backFaceCulling=!1,r._blobTexture=new h.Texture(e.BLOB_TEXTURE_URL,r.getScene(),!0,!1,h.Texture.NEAREST_SAMPLINGMODE),r._iridescentMap=new h.Texture(e.IM_TEXTURE_URL,r.getScene(),!0,!1,h.Texture.NEAREST_SAMPLINGMODE),r}return n(e,t),e.prototype.needAlphaBlending=function(){return!1},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){var i=e._drawWrapper;if(this.isFrozen&&i.effect&&i._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new Bt);var o=e.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=r.getEngine();if((0,h.PrepareDefinesForAttributes)(t,o,!1,!1),o.isDirty){o.markAsProcessed(),r.resetCachedMaterial();var a=new h.EffectFallbacks;o.FOG&&a.addFallback(1,"FOG"),(0,h.HandleFallbacksForShadows)(o,a),o.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess;var s=[h.VertexBuffer.PositionKind];o.NORMAL&&s.push(h.VertexBuffer.NormalKind),o.UV1&&s.push(h.VertexBuffer.UVKind),o.UV2&&s.push(h.VertexBuffer.UV2Kind),o.VERTEXCOLOR&&s.push(h.VertexBuffer.ColorKind),o.TANGENT&&s.push(h.VertexBuffer.TangentKind),(0,h.PrepareAttributesForInstances)(s,o);var l=o.toString(),_=["world","viewProjection","cameraPosition","_Radius_","_Line_Width_","_Absolute_Sizes_","_Filter_Width_","_Base_Color_","_Line_Color_","_Radius_Top_Left_","_Radius_Top_Right_","_Radius_Bottom_Left_","_Radius_Bottom_Right_","_Blob_Position_","_Blob_Intensity_","_Blob_Near_Size_","_Blob_Far_Size_","_Blob_Near_Distance_","_Blob_Far_Distance_","_Blob_Fade_Length_","_Blob_Pulse_","_Blob_Fade_","_Blob_Texture_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Rate_","_Highlight_Color_","_Highlight_Width_","_Highlight_Transform_","_Highlight_","_Iridescence_Intensity_","_Iridescence_Edge_Intensity_","_Angle_","_Fade_Out_","_Reflected_","_Frequency_","_Vertical_Offset_","_Iridescent_Map_","_Use_Global_Left_Index_","_Use_Global_Right_Index_","Global_Left_Index_Tip_Position","Global_Right_Index_Tip_Position"],c=["_Blob_Texture_","_Iridescent_Map_"],u=[];(0,h.PrepareUniformsAndSamplersList)({uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:o,maxSimultaneousLights:4}),e.setEffect(r.getEngine().createEffect("fluentBackplate",{attributes:s,uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:l,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),o,this._materialContext)}return!(!e.effect||!e.effect.isReady()||(o._renderId=r.getRenderId(),i._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o,r;if(i.materialDefines){var n=i.effect;n&&(this._activeEffect=n,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",null!==(r=null===(o=this.getScene().activeCamera)||void 0===o?void 0:o.position)&&void 0!==r?r:h.Vector3.ZeroReadOnly),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Line_Width_",this.lineWidth),this._activeEffect.setFloat("_Absolute_Sizes_",this.absoluteSizes?1:0),this._activeEffect.setFloat("_Filter_Width_",this._filterWidth),this._activeEffect.setDirectColor4("_Base_Color_",this.baseColor),this._activeEffect.setDirectColor4("_Line_Color_",this.lineColor),this._activeEffect.setFloat("_Radius_Top_Left_",1),this._activeEffect.setFloat("_Radius_Top_Right_",1),this._activeEffect.setFloat("_Radius_Bottom_Left_",1),this._activeEffect.setFloat("_Radius_Bottom_Right_",1),this._activeEffect.setFloat("_Blob_Intensity_",this.blobIntensity),this._activeEffect.setFloat("_Blob_Near_Size_",this.blobNearSize),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_Pulse_",this.blobPulse),this._activeEffect.setFloat("_Blob_Fade_",this.blobFade),this._activeEffect.setTexture("_Blob_Texture_",this._blobTexture),this._activeEffect.setFloat("_Blob_Near_Size_2_",this.blobNearSize2),this._activeEffect.setFloat("_Blob_Pulse_2_",this.blobPulse2),this._activeEffect.setFloat("_Blob_Fade_2_",this.blobFade2),this._activeEffect.setFloat("_Rate_",this._rate),this._activeEffect.setDirectColor4("_Highlight_Color_",this.highlightColor),this._activeEffect.setFloat("_Highlight_Width_",this.highlightWidth),this._activeEffect.setVector4("_Highlight_Transform_",this._highlightTransform),this._activeEffect.setFloat("_Highlight_",this._highlight),this._activeEffect.setFloat("_Iridescence_Intensity_",this.iridescenceIntensity),this._activeEffect.setFloat("_Iridescence_Edge_Intensity_",this.iridescenceEdgeIntensity),this._activeEffect.setFloat("_Angle_",this._angle),this._activeEffect.setFloat("_Fade_Out_",this.fadeOut),this._activeEffect.setFloat("_Reflected_",this._reflected?1:0),this._activeEffect.setFloat("_Frequency_",this._frequency),this._activeEffect.setFloat("_Vertical_Offset_",this._verticalOffset),this._activeEffect.setTexture("_Iridescent_Map_",this._iridescentMap),this._activeEffect.setFloat("_Use_Global_Left_Index_",1),this._activeEffect.setFloat("_Use_Global_Right_Index_",1),this._globalLeftIndexTipPosition4.set(this.globalLeftIndexTipPosition.x,this.globalLeftIndexTipPosition.y,this.globalLeftIndexTipPosition.z,1),this._activeEffect.setVector4("Global_Left_Index_Tip_Position",this._globalLeftIndexTipPosition4),this._globalRightIndexTipPosition4.set(this.globalRightIndexTipPosition.x,this.globalRightIndexTipPosition.y,this.globalRightIndexTipPosition.z,1),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",this._globalRightIndexTipPosition4),this._afterBind(e,this._activeEffect,i))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),this._blobTexture.dispose(),this._iridescentMap.dispose()},e.prototype.clone=function(t){var i=this;return h.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.FluentBackplateMaterial",e},e.prototype.getClassName=function(){return"FluentBackplateMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.BLOB_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-backplate-blob.png",e.IM_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-backplate-iridescence.png",s([(0,h.serialize)()],e.prototype,"radius",void 0),s([(0,h.serialize)()],e.prototype,"lineWidth",void 0),s([(0,h.serialize)()],e.prototype,"absoluteSizes",void 0),s([(0,h.serialize)()],e.prototype,"baseColor",void 0),s([(0,h.serialize)()],e.prototype,"lineColor",void 0),s([(0,h.serialize)()],e.prototype,"blobIntensity",void 0),s([(0,h.serialize)()],e.prototype,"blobFarSize",void 0),s([(0,h.serialize)()],e.prototype,"blobNearDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFarDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFadeLength",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse",void 0),s([(0,h.serialize)()],e.prototype,"blobFade",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize2",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse2",void 0),s([(0,h.serialize)()],e.prototype,"blobFade2",void 0),s([(0,h.serialize)()],e.prototype,"highlightColor",void 0),s([(0,h.serialize)()],e.prototype,"highlightWidth",void 0),s([(0,h.serialize)()],e.prototype,"iridescenceIntensity",void 0),s([(0,h.serialize)()],e.prototype,"iridescenceEdgeIntensity",void 0),s([(0,h.serialize)()],e.prototype,"fadeOut",void 0),s([(0,h.serializeAsVector3)()],e.prototype,"globalLeftIndexTipPosition",void 0),s([(0,h.serializeAsVector3)()],e.prototype,"globalRightIndexTipPosition",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.FluentBackplateMaterial",Ct);var Tt=function(t){function e(e,i){void 0===i&&(i=!0);var o=t.call(this,e)||this;return o._shareMaterials=i,o}return n(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,o=this,r=(0,h.CreateBox)((null!==(i=this.name)&&void 0!==i?i:"HolographicBackplate")+"_CollisionMesh",{width:1,height:1,depth:1},t);return r.isPickable=!0,r.visibility=0,h.SceneLoader.ImportMeshAsync(void 0,e.MODEL_BASE_URL,e.MODEL_FILENAME,t).then((function(t){var e=t.meshes[1];e.name="".concat(o.name,"_frontPlate"),e.isPickable=!1,e.parent=r,o._material&&(e.material=o._material),o._model=e})),r},e.prototype._createMaterial=function(t){this._material=new Ct(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}(dt),St=function(t){function e(e,i){void 0===i&&(i=!0);var o=t.call(this,e)||this;return o._shareMaterials=!0,o._shareMaterials=i,o.pointerEnterAnimation=function(){o.mesh&&o._frontPlate.setEnabled(!0)},o.pointerOutAnimation=function(){o.mesh&&o._frontPlate.setEnabled(!1)},o}return n(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=(0,h.CreatePlane)("",{size:1},this._backPlate._scene);var o=(0,h.CreatePlane)("",{size:1,sideOrientation:h.Mesh.DOUBLESIDE},this._backPlate._scene),r=new h.StandardMaterial("",this._backPlate._scene);r.diffuseColor=h.Color3.FromHexString("#212121"),o.material=r,o.isPickable=!1,this._tooltipMesh.addChild(o),o.position=h.Vector3.Forward(i).scale(.05),this._tooltipMesh.scaling.y=1/3,this._tooltipMesh.position=h.Vector3.Up().scale(.7).add(h.Vector3.Forward(i).scale(-.15)),this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._backPlate,this._tooltipTexture=lt.CreateForMesh(this._tooltipMesh),this._tooltipTextBlock=new B,this._tooltipTextBlock.scaleY=3,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=130,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new h.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 S;if(t.isVertical=!0,(0,h.IsDocumentAvailable)()&&document.createElement&&this._imageUrl){var e=new C;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 B;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=(0,h.CreateBox)(this.name+"BackMesh",{width:1,height:1,depth:.08},e),this._frontPlate=(0,h.CreateBox)(this.name+"FrontMesh",{width:1,height:1,depth:.08},e),this._frontPlate.parent=this._backPlate,this._frontPlate.position=h.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=h.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 xt(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 xt(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 h.StandardMaterial(this.name+"Plate Material",t.getScene()),this._plateMaterial.specularColor=h.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}(gt);h.ShaderStore.ShadersStore.fluentButtonPixelShader="uniform vec3 cameraPosition;varying vec3 vPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec3 vBinormal;varying vec4 vColor;varying vec4 vExtra1;uniform float _Edge_Width_;uniform vec4 _Edge_Color_;uniform bool _Relative_Width_;uniform float _Proximity_Max_Intensity_;uniform float _Proximity_Far_Distance_;uniform float _Proximity_Near_Radius_;uniform float _Proximity_Anisotropy_;uniform float _Selection_Fuzz_;uniform float _Selected_;uniform float _Selection_Fade_;uniform float _Selection_Fade_Size_;uniform float _Selected_Distance_;uniform float _Selected_Fade_Length_;uniform bool _Blob_Enable_;uniform vec3 _Blob_Position_;uniform float _Blob_Intensity_;uniform float _Blob_Near_Size_;uniform float _Blob_Far_Size_;uniform float _Blob_Near_Distance_;uniform float _Blob_Far_Distance_;uniform float _Blob_Fade_Length_;uniform float _Blob_Inner_Fade_;uniform float _Blob_Pulse_;uniform float _Blob_Fade_;uniform sampler2D _Blob_Texture_;uniform bool _Blob_Enable_2_;uniform vec3 _Blob_Position_2_;uniform float _Blob_Near_Size_2_;uniform float _Blob_Inner_Fade_2_;uniform float _Blob_Pulse_2_;uniform float _Blob_Fade_2_;uniform vec3 _Active_Face_Dir_;uniform vec3 _Active_Face_Up_;uniform bool Enable_Fade;uniform float _Fade_Width_;uniform bool _Smooth_Active_Face_;uniform bool _Show_Frame_;uniform bool _Use_Blob_Texture_;uniform bool Use_Global_Left_Index;uniform bool Use_Global_Right_Index;uniform vec4 Global_Left_Index_Tip_Position;uniform vec4 Global_Right_Index_Tip_Position;uniform vec4 Global_Left_Thumb_Tip_Position;uniform vec4 Global_Right_Thumb_Tip_Position;uniform float Global_Left_Index_Tip_Proximity;uniform float Global_Right_Index_Tip_Proximity;void Holo_Edge_Fragment_B35(\nvec4 Edges,\nfloat Edge_Width,\nout float NotEdge)\n{vec2 c=vec2(min(Edges.r,Edges.g),min(Edges.b,Edges.a));vec2 df=fwidth(c)*Edge_Width;vec2 g=clamp(c/df,0.0,1.0);NotEdge=g.x*g.y;}\nvoid Blob_Fragment_B39(\nvec2 UV,\nvec3 Blob_Info,\nsampler2D Blob_Texture,\nout vec4 Blob_Color)\n{float k=dot(UV,UV);Blob_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));}\nvec2 FilterStep(vec2 Edge,vec2 X)\n{vec2 dX=max(fwidth(X),vec2(0.00001,0.00001));return clamp( (X+dX-max(Edge,X-dX))/(dX*2.0),0.0,1.0);}\nvoid Wireframe_Fragment_B59(\nvec3 Widths,\nvec2 UV,\nfloat Proximity,\nvec4 Edge_Color,\nout vec4 Wireframe)\n{vec2 c=min(UV,vec2(1.0,1.0)-UV);vec2 g=FilterStep(Widths.xy*0.5,c); \nWireframe=(1.0-min(g.x,g.y))*Proximity*Edge_Color;}\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{vec2 delta1=Extra1.xy;vec2 delta2=Extra1.zw;float d2=sqrt(min(dot(delta1,delta1),dot(delta2,delta2))+Dist_To_Face*Dist_To_Face);Proximity=Intensity*Proximity_Max_Intensity*(1.0-clamp(d2/Proximity_Near_Radius,0.0,1.0))*(1.0-Show_Selection.x)+Show_Selection.x;}\nvoid To_XYZ_B46(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{X=Vec3.x;Y=Vec3.y;Z=Vec3.z;}\nvoid main()\n{float NotEdge_Q35;\n#if ENABLE_FADE\nHolo_Edge_Fragment_B35(vColor,_Fade_Width_,NotEdge_Q35);\n#else\nNotEdge_Q35=1.0;\n#endif\nvec4 Blob_Color_Q39;float k=dot(vUV,vUV);vec2 blobTextureCoord=vec2(vec2(sqrt(k),vTangent.x).x,1.0-vec2(sqrt(k),vTangent.x).y);vec4 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_));Blob_Color_Q39=vTangent.y*blobColor*(1.0-clamp(k,0.0,1.0));float Is_Quad_Q24;Is_Quad_Q24=vNormal.z;vec3 Blob_Position_Q41= mix(_Blob_Position_,Global_Left_Index_Tip_Position.xyz,float(Use_Global_Left_Index));vec3 Blob_Position_Q42= mix(_Blob_Position_2_,Global_Right_Index_Tip_Position.xyz,float(Use_Global_Right_Index));float X_Q46;float Y_Q46;float Z_Q46;To_XYZ_B46(vBinormal,X_Q46,Y_Q46,Z_Q46);float Proximity_Q53;Proximity_B53(Blob_Position_Q41,Blob_Position_Q42,_Proximity_Max_Intensity_,_Proximity_Near_Radius_,vPosition,vBinormal,vExtra1,Y_Q46,Z_Q46,Proximity_Q53);vec4 Wireframe_Q59;Wireframe_Fragment_B59(vNormal,vUV,Proximity_Q53,_Edge_Color_,Wireframe_Q59);vec4 Wire_Or_Blob_Q23=mix(Wireframe_Q59,Blob_Color_Q39,Is_Quad_Q24);vec4 Result_Q22;Result_Q22=mix(Wire_Or_Blob_Q23,vec4(0.3,0.3,0.3,0.3),float(_Show_Frame_));vec4 Final_Color_Q37=NotEdge_Q35*Result_Q22;vec4 Out_Color=Final_Color_Q37;float Clip_Threshold=0.0;bool To_sRGB=false;gl_FragColor=Out_Color;}";h.ShaderStore.ShadersStore.fluentButtonVertexShader="uniform mat4 world;uniform mat4 viewProjection;uniform vec3 cameraPosition;attribute vec3 position;attribute vec3 normal;attribute vec2 uv;attribute vec3 tangent;attribute vec4 color;uniform float _Edge_Width_;uniform vec4 _Edge_Color_;uniform float _Proximity_Max_Intensity_;uniform float _Proximity_Far_Distance_;uniform float _Proximity_Near_Radius_;uniform float _Proximity_Anisotropy_;uniform float _Selection_Fuzz_;uniform float _Selected_;uniform float _Selection_Fade_;uniform float _Selection_Fade_Size_;uniform float _Selected_Distance_;uniform float _Selected_Fade_Length_;uniform bool _Blob_Enable_;uniform vec3 _Blob_Position_;uniform float _Blob_Intensity_;uniform float _Blob_Near_Size_;uniform float _Blob_Far_Size_;uniform float _Blob_Near_Distance_;uniform float _Blob_Far_Distance_;uniform float _Blob_Fade_Length_;uniform float _Blob_Inner_Fade_;uniform float _Blob_Pulse_;uniform float _Blob_Fade_;uniform sampler2D _Blob_Texture_;uniform bool _Blob_Enable_2_;uniform vec3 _Blob_Position_2_;uniform float _Blob_Near_Size_2_;uniform float _Blob_Inner_Fade_2_;uniform float _Blob_Pulse_2_;uniform float _Blob_Fade_2_;uniform vec3 _Active_Face_Dir_;uniform vec3 _Active_Face_Up_;uniform bool _Enable_Fade_;uniform float _Fade_Width_;uniform bool _Smooth_Active_Face_;uniform bool _Show_Frame_;uniform bool Use_Global_Left_Index;uniform bool Use_Global_Right_Index;uniform vec4 Global_Left_Index_Tip_Position;uniform vec4 Global_Right_Index_Tip_Position;uniform vec4 Global_Left_Thumb_Tip_Position;uniform vec4 Global_Right_Thumb_Tip_Position;uniform float Global_Left_Index_Tip_Proximity;uniform float Global_Right_Index_Tip_Proximity;varying vec3 vPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec3 vBinormal;varying vec4 vColor;varying vec4 vExtra1;void 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{float blobSize,fadeIn;vec3 Hit_Position;Blob_Info=vec3(0.0,0.0,0.0);float Hit_Distance=dot(Blob_Position-Face_Center,Normal);Hit_Position=Blob_Position-Hit_Distance*Normal;float absD=abs(Hit_Distance);float lerpVal=clamp((absD-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);fadeIn=1.0-clamp((absD-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);float innerFade=1.0-clamp(-Hit_Distance/Inner_Fade,0.0,1.0);float farClip=clamp(1.0-step(Blob_Far_Distance+Blob_Fade_Length,absD),0.0,1.0);float size=mix(Blob_Near_Size,Blob_Far_Size,lerpVal)*farClip;blobSize=mix(size,Selection_Fade_Size,Selection_Fade)*innerFade*Blob_Enabled;Blob_Info.x=lerpVal*0.5+0.5;Blob_Info.y=fadeIn*Intensity*(1.0-Selection_Fade)*Blob_Fade;Blob_Info.x*=(1.0-Blob_Pulse);vec3 delta=Hit_Position-Face_Center;vec2 blobCenterXY=vec2(dot(delta,Tangent),dot(delta,Bitangent));vec2 quadUVin=2.0*UV-1.0; \nvec2 blobXY=blobCenterXY+quadUVin*blobSize;vec2 blobClipped=clamp(blobXY,-Face_Size*0.5,Face_Size*0.5);vec2 blobUV=(blobClipped-blobCenterXY)/max(blobSize,0.0001)*2.0;vec3 blobCorner=Face_Center+blobClipped.x*Tangent+blobClipped.y*Bitangent;Out_Position=mix(Position,blobCorner,Vx_Color.rrr);Out_UV=mix(In_UV,blobUV,Vx_Color.rr);}\nvec2 ProjectProximity(\nvec3 blobPosition,\nvec3 position,\nvec3 center,\nvec3 dir,\nvec3 xdir,\nvec3 ydir,\nout float vdistance\n)\n{vec3 delta=blobPosition-position;vec2 xy=vec2(dot(delta,xdir),dot(delta,ydir));vdistance=abs(dot(delta,dir));return xy;}\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{vec3 Active_Face_Dir_X=normalize(cross(Active_Face_Dir,Up));vec3 Active_Face_Dir_Y=cross(Active_Face_Dir,Active_Face_Dir_X);float distz1,distz2;Extra1.xy=ProjectProximity(Blob_Position,Position,Active_Face_Center,Active_Face_Dir,Active_Face_Dir_X*Proximity_Anisotropy,Active_Face_Dir_Y,distz1)/Relative_Scale;Extra1.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;Distance_To_Face=dot(Active_Face_Dir,Position-Active_Face_Center);Intensity=1.0-clamp(min(distz1,distz2)/Proximity_Far_Distance,0.0,1.0);}\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{float NdotI=dot(Incident,Normal);vec2 flip=(UV-vec2(0.5,0.5));float udot=dot(Incident,Tangent)*flip.x*NdotI;float uval=1.0-float(udot>0.0);float vdot=-dot(Incident,Bitangent)*flip.y*NdotI;float vval=1.0-float(vdot>0.0);float Smooth_And_Active=step(1.0,float(Smooth_Active_Face && Active>0.0));uval=mix(uval,max(1.0,uval),Smooth_And_Active); \nvval=mix(vval,max(1.0,vval),Smooth_And_Active);Holo_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));}\nvoid Object_To_World_Pos_B13(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{Pos_World=(world*vec4(Pos_Object,1.0)).xyz;}\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{Position=Position1*(1.0-Vx_Color.g)+Vx_Color.g*Position2;float b1=float(Blob_Enable_1);float b2=float(Blob_Enable_2);Blob_Enable=b1+(b2-b1)*Vx_Color.g;Pulse=Blob_Pulse_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Pulse_2;Fade=Blob_Fade_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Fade_2;Near_Size=Near_Size_1*(1.0-Vx_Color.g)+Vx_Color.g*Near_Size_2;Inner_Fade=Blob_Inner_Fade_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Inner_Fade_2;}\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{Widths.xy=Edge_Width/Face_Size;float x=dot(Position,Tangent);float y=dot(Position,Bitangent);float dx=0.5-abs(x);float newx=(0.5-dx*Widths.x*2.0)*sign(x);float dy=0.5-abs(y);float newy=(0.5-dy*Widths.y*2.0)*sign(y);Wire_Vx_Pos=Normal*0.5+newx*Tangent+newy*Bitangent;UV.x=dot(Wire_Vx_Pos,Tangent)+0.5;UV.y=dot(Wire_Vx_Pos,Bitangent)+0.5;}\nvec2 ramp2(vec2 start,vec2 end,vec2 x)\n{return clamp((x-start)/(end-start),vec2(0.0,0.0),vec2(1.0,1.0));}\nfloat computeSelection(\nvec3 blobPosition,\nvec3 normal,\nvec3 tangent,\nvec3 bitangent,\nvec3 faceCenter,\nvec2 faceSize,\nfloat selectionFuzz,\nfloat farDistance,\nfloat fadeLength\n)\n{vec3 delta=blobPosition-faceCenter;float absD=abs(dot(delta,normal));float fadeIn=1.0-clamp((absD-farDistance)/fadeLength,0.0,1.0);vec2 blobCenterXY=vec2(dot(delta,tangent),dot(delta,bitangent));vec2 innerFace=faceSize*(1.0-selectionFuzz)*0.5;vec2 selectPulse=ramp2(-faceSize*0.5,-innerFace,blobCenterXY)-ramp2(innerFace,faceSize*0.5,blobCenterXY);return selectPulse.x*selectPulse.y*fadeIn;}\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{float select1=computeSelection(Blob_Position,Normal,Tangent,Bitangent,Face_Center,Face_Size,Selection_Fuzz,Far_Distance,Fade_Length);float select2=computeSelection(Blob_Position_2,Normal,Tangent,Bitangent,Face_Center,Face_Size,Selection_Fuzz,Far_Distance,Fade_Length);float Active=max(0.0,dot(Active_Face_Dir,Normal));Show_Selection=mix(max(select1,select2),1.0,Selected)*Active;}\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{vec3 boxEdges=(world*vec4(vec3(0.5,0.5,0.5),0.0)).xyz;float boxMaxSize=length(boxEdges);float d1=dot(Proximity_Center-Active_Face_Center,Active_Face_Dir);vec3 blob1=Proximity_Center-d1*Active_Face_Dir;float d2=dot(Proximity_Center_2-Active_Face_Center,Active_Face_Dir);vec3 blob2=Proximity_Center_2-d2*Active_Face_Dir;vec3 delta1=blob1-Active_Face_Center;vec3 delta2=blob2-Active_Face_Center;float dist1=dot(delta1,delta1);float dist2=dot(delta2,delta2);float nearestProxDist=sqrt(min(dist1,dist2));Width=Input_Width*(1.0-step(boxMaxSize+Proximity_Radius,nearestProxDist))*(1.0-step(Proximity_Far_Distance,min(d1,d2))*(1.0-step(0.0001,Selection)));}\nvoid Object_To_World_Dir_B67(\nvec3 Dir_Object,\nout vec3 Dir_World)\n{Dir_World=(world*vec4(Dir_Object,0.0)).xyz;}\nvoid main()\n{vec3 Active_Face_Center_Q49;Active_Face_Center_Q49=(world*vec4(_Active_Face_Dir_*0.5,1.0)).xyz;vec3 Blob_Position_Q41= mix(_Blob_Position_,Global_Left_Index_Tip_Position.xyz,float(Use_Global_Left_Index));vec3 Blob_Position_Q42= mix(_Blob_Position_2_,Global_Right_Index_Tip_Position.xyz,float(Use_Global_Right_Index));vec3 Active_Face_Dir_Q64=normalize((world*vec4(_Active_Face_Dir_,0.0)).xyz);float 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\nvec3 Tangent_World_Q30;Tangent_World_Q30=(world*vec4(tangent,0.0)).xyz;vec3 Binormal_World_Q31;Binormal_World_Q31=(world*vec4((cross(normal,tangent)),0.0)).xyz;vec3 Normal_World_Q60;Normal_World_Q60=(world*vec4(normal,0.0)).xyz;vec3 Result_Q18=0.5*normal;vec3 Dir_World_Q67;Object_To_World_Dir_B67(_Active_Face_Up_,Dir_World_Q67);float Product_Q56=_Edge_Width_*Relative_Scale_Q57;vec3 Normal_World_N_Q29=normalize(Normal_World_Q60);vec3 Tangent_World_N_Q28=normalize(Tangent_World_Q30);vec3 Binormal_World_N_Q32=normalize(Binormal_World_Q31);vec3 Position_Q38;float Near_Size_Q38;float Inner_Fade_Q38;float Blob_Enable_Q38;float Fade_Q38;float Pulse_Q38;Choose_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);vec3 Face_Center_Q33;Face_Center_Q33=(world*vec4(Result_Q18,1.0)).xyz;vec2 Face_Size_Q50=vec2(length(Tangent_World_Q30),length(Binormal_World_Q31));float Show_Selection_Q48;Selection_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);vec3 Normalized_Q72=normalize(Dir_World_Q67);float Active_Q34=max(0.0,dot(Active_Face_Dir_Q64,Normal_World_N_Q29));float Width_Q54;Proximity_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);vec3 Wire_Vx_Pos_Q51;vec2 UV_Q51;vec2 Widths_Q51;Wireframe_Vertex_B51(position,normal,tangent,(cross(normal,tangent)),Width_Q54,Face_Size_Q50,Wire_Vx_Pos_Q51,UV_Q51,Widths_Q51);vec3 Vec3_Q27=vec3(Widths_Q51.x,Widths_Q51.y,color.r);vec3 Pos_World_Q13;Object_To_World_Pos_B13(Wire_Vx_Pos_Q51,Pos_World_Q13);vec3 Incident_Q36=normalize(Pos_World_Q13-cameraPosition);vec3 Out_Position_Q47;vec2 Out_UV_Q47;vec3 Blob_Info_Q47;Blob_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);vec4 Extra1_Q66;float Distance_To_Face_Q66;float Intensity_Q66;Proximity_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);vec4 Holo_Edges_Q44;Holo_Edge_Vertex_B44(Incident_Q36,Normal_World_N_Q29,uv,Tangent_World_Q30,Binormal_World_Q31,_Smooth_Active_Face_,Active_Q34,Holo_Edges_Q44);vec3 Vec3_Q19=vec3(Show_Selection_Q48,Distance_To_Face_Q66,Intensity_Q66);vec3 Position=Out_Position_Q47;vec2 UV=Out_UV_Q47;vec3 Tangent=Blob_Info_Q47;vec3 Binormal=Vec3_Q19;vec3 Normal=Vec3_Q27;vec4 Extra1=Extra1_Q66;vec4 Color=Holo_Edges_Q44;gl_Position=viewProjection*vec4(Position,1);vPosition=Position;vNormal=Normal;vUV=UV;vTangent=Tangent;vBinormal=Binormal;vColor=Color;vExtra1=Extra1;}";var Ot=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 n(e,t),e}(h.MaterialDefines),Rt=function(t){function e(i,o){var r=t.call(this,i,o)||this;return r.edgeWidth=.04,r.edgeColor=new h.Color4(.592157,.592157,.592157,1),r.proximityMaxIntensity=.45,r.proximityFarDistance=.16,r.proximityNearRadius=1.5,r.proximityAnisotropy=1,r.selectionFuzz=.5,r.selected=0,r.selectionFade=0,r.selectionFadeSize=.3,r.selectedDistance=.08,r.selectedFadeLength=.08,r.blobIntensity=.5,r.blobFarSize=.05,r.blobNearDistance=0,r.blobFarDistance=.08,r.blobFadeLength=.08,r.leftBlobEnable=!0,r.leftBlobNearSize=.025,r.leftBlobPulse=0,r.leftBlobFade=1,r.leftBlobInnerFade=.01,r.rightBlobEnable=!0,r.rightBlobNearSize=.025,r.rightBlobPulse=0,r.rightBlobFade=1,r.rightBlobInnerFade=.01,r.activeFaceDir=new h.Vector3(0,0,-1),r.activeFaceUp=new h.Vector3(0,1,0),r.enableFade=!0,r.fadeWidth=1.5,r.smoothActiveFace=!0,r.showFrame=!1,r.useBlobTexture=!0,r.globalLeftIndexTipPosition=h.Vector3.Zero(),r.globalRightIndexTipPosition=h.Vector3.Zero(),r.alphaMode=h.Constants.ALPHA_ADD,r.disableDepthWrite=!0,r.backFaceCulling=!1,r._blobTexture=new h.Texture(e.BLOB_TEXTURE_URL,r.getScene(),!0,!1,h.Texture.NEAREST_SAMPLINGMODE),r}return n(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){var i=e._drawWrapper;if(this.isFrozen&&i.effect&&i._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new Ot);var o=e.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=r.getEngine();if((0,h.PrepareDefinesForAttributes)(t,o,!0,!1),o.isDirty){o.markAsProcessed(),r.resetCachedMaterial();var a=new h.EffectFallbacks;o.FOG&&a.addFallback(1,"FOG"),(0,h.HandleFallbacksForShadows)(o,a),o.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess;var s=[h.VertexBuffer.PositionKind];o.NORMAL&&s.push(h.VertexBuffer.NormalKind),o.UV1&&s.push(h.VertexBuffer.UVKind),o.UV2&&s.push(h.VertexBuffer.UV2Kind),o.VERTEXCOLOR&&s.push(h.VertexBuffer.ColorKind),o.TANGENT&&s.push(h.VertexBuffer.TangentKind),(0,h.PrepareAttributesForInstances)(s,o);var l=o.toString(),_=["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=[];(0,h.PrepareUniformsAndSamplersList)({uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:o,maxSimultaneousLights:4}),e.setEffect(r.getEngine().createEffect("fluentButton",{attributes:s,uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:l,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),o,this._materialContext)}return!(!e.effect||!e.effect.isReady()||(o._renderId=r.getRenderId(),i._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o=this.getScene();if(i.materialDefines){var r=i.effect;r&&(this._activeEffect=r,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",o.activeCamera.position),this._activeEffect.setTexture("_Blob_Texture_",this._blobTexture),this._activeEffect.setFloat("_Edge_Width_",this.edgeWidth),this._activeEffect.setColor4("_Edge_Color_",new h.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 h.Vector4(this.globalLeftIndexTipPosition.x,this.globalLeftIndexTipPosition.y,this.globalLeftIndexTipPosition.z,1)),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",new h.Vector4(this.globalRightIndexTipPosition.x,this.globalRightIndexTipPosition.y,this.globalRightIndexTipPosition.z,1)),this._afterBind(e,this._activeEffect,i))}},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 h.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,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.BLOB_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-button-blob.png",s([(0,h.serialize)()],e.prototype,"edgeWidth",void 0),s([(0,h.serializeAsColor4)()],e.prototype,"edgeColor",void 0),s([(0,h.serialize)()],e.prototype,"proximityMaxIntensity",void 0),s([(0,h.serialize)()],e.prototype,"proximityFarDistance",void 0),s([(0,h.serialize)()],e.prototype,"proximityNearRadius",void 0),s([(0,h.serialize)()],e.prototype,"proximityAnisotropy",void 0),s([(0,h.serialize)()],e.prototype,"selectionFuzz",void 0),s([(0,h.serialize)()],e.prototype,"selected",void 0),s([(0,h.serialize)()],e.prototype,"selectionFade",void 0),s([(0,h.serialize)()],e.prototype,"selectionFadeSize",void 0),s([(0,h.serialize)()],e.prototype,"selectedDistance",void 0),s([(0,h.serialize)()],e.prototype,"selectedFadeLength",void 0),s([(0,h.serialize)()],e.prototype,"blobIntensity",void 0),s([(0,h.serialize)()],e.prototype,"blobFarSize",void 0),s([(0,h.serialize)()],e.prototype,"blobNearDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFarDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFadeLength",void 0),s([(0,h.serialize)()],e.prototype,"leftBlobEnable",void 0),s([(0,h.serialize)()],e.prototype,"leftBlobNearSize",void 0),s([(0,h.serialize)()],e.prototype,"leftBlobPulse",void 0),s([(0,h.serialize)()],e.prototype,"leftBlobFade",void 0),s([(0,h.serialize)()],e.prototype,"leftBlobInnerFade",void 0),s([(0,h.serialize)()],e.prototype,"rightBlobEnable",void 0),s([(0,h.serialize)()],e.prototype,"rightBlobNearSize",void 0),s([(0,h.serialize)()],e.prototype,"rightBlobPulse",void 0),s([(0,h.serialize)()],e.prototype,"rightBlobFade",void 0),s([(0,h.serialize)()],e.prototype,"rightBlobInnerFade",void 0),s([(0,h.serializeAsVector3)()],e.prototype,"activeFaceDir",void 0),s([(0,h.serializeAsVector3)()],e.prototype,"activeFaceUp",void 0),s([(0,h.serialize)()],e.prototype,"enableFade",void 0),s([(0,h.serialize)()],e.prototype,"fadeWidth",void 0),s([(0,h.serialize)()],e.prototype,"smoothActiveFace",void 0),s([(0,h.serialize)()],e.prototype,"showFrame",void 0),s([(0,h.serialize)()],e.prototype,"useBlobTexture",void 0),s([(0,h.serializeAsVector3)()],e.prototype,"globalLeftIndexTipPosition",void 0),s([(0,h.serializeAsVector3)()],e.prototype,"globalRightIndexTipPosition",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.FluentButtonMaterial",Rt);var wt=function(t){function e(e,i){var o=t.call(this,e)||this;return o._isNearPressed=!1,o._interactionSurfaceHeight=0,o._isToggleButton=!1,o._toggleState=!1,o._toggleButtonCallback=function(){o._onToggle(!o._toggleState)},o.onToggleObservable=new h.Observable,o.collidableFrontDirection=h.Vector3.Zero(),i&&(o.collisionMesh=i),o}return n(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=h.TmpVectors.Vector3[0];return h.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=h.TmpVectors.Matrix[0];e.copyFrom(this._collisionMesh.getWorldMatrix()),e.invert(),h.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 h.Vector3.Distance(t,e);var o=h.Vector3.Dot(e,i);return h.Vector3.Dot(t,i)-o},e.prototype._generatePointerEventType=function(t,e,i){if(t===h.PointerEventTypes.POINTERDOWN||t===h.PointerEventTypes.POINTERMOVE){if(!this._isInteractionInFrontOfButton(e))return h.PointerEventTypes.POINTERMOVE;this._isNearPressed=!0,this._interactionSurfaceHeight=this._getInteractionHeight(e,this._collisionMesh.getAbsolutePosition())}if(t===h.PointerEventTypes.POINTERUP){if(0==i)return h.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}(gt),Mt=function(t){function e(e,i){void 0===i&&(i=!0);var o=t.call(this,e)||this;return o._shareMaterials=!0,o._isBackplateVisible=!0,o._frontPlateDepth=.5,o._backPlateDepth=.04,o._backplateColor=new h.Color3(.08,.15,.55),o._backplateToggledColor=new h.Color3(.25,.4,.95),o._shareMaterials=i,o.pointerEnterAnimation=function(){o._frontMaterial.leftBlobEnable=!0,o._frontMaterial.rightBlobEnable=!0},o.pointerOutAnimation=function(){o._frontMaterial.leftBlobEnable=!1,o._frontMaterial.rightBlobEnable=!1},o.pointerDownAnimation=function(){o._frontPlate&&!o.isActiveNearInteraction&&(o._frontPlate.scaling.z=.2*o._frontPlateDepth,o._frontPlate.position=h.Vector3.Forward(o._frontPlate._scene.useRightHandedSystem).scale((o._frontPlateDepth-.2*o._frontPlateDepth)/2),o._textPlate.position=h.Vector3.Forward(o._textPlate._scene.useRightHandedSystem).scale(-(o._backPlateDepth+.2*o._frontPlateDepth)/2))},o.pointerUpAnimation=function(){o._frontPlate&&(o._frontPlate.scaling.z=o._frontPlateDepth,o._frontPlate.position=h.Vector3.Forward(o._frontPlate._scene.useRightHandedSystem).scale((o._frontPlateDepth-o._frontPlateDepth)/2),o._textPlate.position=h.Vector3.Forward(o._textPlate._scene.useRightHandedSystem).scale(-(o._backPlateDepth+o._frontPlateDepth)/2))},o.onPointerMoveObservable.add((function(t){if(o._frontPlate&&o.isActiveNearInteraction){var e=h.Vector3.Zero();if(o._backPlate.getWorldMatrix().decompose(e,void 0,void 0)){var i=o._getInteractionHeight(t,o._backPlate.getAbsolutePosition())/e.z;i=h.Scalar.Clamp(i-o._backPlateDepth/2,.2*o._frontPlateDepth,o._frontPlateDepth),o._frontPlate.scaling.z=i,o._frontPlate.position=h.Vector3.Forward(o._frontPlate._scene.useRightHandedSystem).scale((o._frontPlateDepth-i)/2),o._textPlate.position=h.Vector3.Forward(o._textPlate._scene.useRightHandedSystem).scale(-(o._backPlateDepth+i)/2)}}})),o._pointerHoverObserver=o.onPointerMoveObservable.add((function(t){o._frontMaterial.globalLeftIndexTipPosition=t})),o}return n(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=(0,h.CreatePlane)("",{size:1},this._backPlate._scene);var o=(0,h.CreatePlane)("",{size:1,sideOrientation:h.Mesh.DOUBLESIDE},this._backPlate._scene),r=new h.StandardMaterial("",this._backPlate._scene);r.diffuseColor=h.Color3.FromHexString("#212121"),o.material=r,o.isPickable=!1,this._tooltipMesh.addChild(o),o.position=h.Vector3.Forward(i).scale(.05),this._tooltipMesh.scaling.y=1/3,this._tooltipMesh.position=h.Vector3.Up().scale(.7).add(h.Vector3.Forward(i).scale(-.15)),this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._backPlate,this._tooltipTexture=lt.CreateForMesh(this._tooltipMesh),this._tooltipTextBlock=new B,this._tooltipTextBlock.scaleY=3,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=130,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new h.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 S;if(t.isVertical=!0,(0,h.IsDocumentAvailable)()&&document.createElement&&this._imageUrl){var e=new C;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 B;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 o,r=this;this.name=null!==(o=this.name)&&void 0!==o?o:"TouchHolographicButton";var n=(0,h.CreateBox)("".concat(this.name,"_collisionMesh"),{width:1,height:1,depth:this._frontPlateDepth},i);n.isPickable=!0,n.isNearPickable=!0,n.visibility=0,n.position=h.Vector3.Forward(i.useRightHandedSystem).scale(-this._frontPlateDepth/2),h.SceneLoader.ImportMeshAsync(void 0,e.MODEL_BASE_URL,e.MODEL_FILENAME,i).then((function(t){var e=(0,h.CreateBox)("${this.name}_alphaMesh",{width:1,height:1,depth:1},i);e.isPickable=!1,e.material=new h.StandardMaterial("${this.name}_alphaMesh_material",i),e.material.alpha=.15;var o=t.meshes[1];o.name="".concat(r.name,"_frontPlate"),o.isPickable=!1,o.scaling.z=r._frontPlateDepth,e.parent=o,o.parent=n,r._frontMaterial&&(o.material=r._frontMaterial),r._frontPlate=o})),this._backPlate=(0,h.CreateBox)("".concat(this.name,"_backPlate"),{width:1,height:1,depth:this._backPlateDepth},i),this._backPlate.position=h.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=h.Vector3.Forward(i.useRightHandedSystem).scale(-this._frontPlateDepth/2),this._backPlate.addChild(n),this._backPlate.addChild(this._textPlate);var a=new h.TransformNode("{this.name}_root",i);return this._backPlate.setParent(a),this.collisionMesh=n,this.collidableFrontDirection=this._backPlate.forward.negate(),a},e.prototype._applyFacade=function(t){this._plateMaterial.emissiveTexture=t,this._plateMaterial.opacityTexture=t,this._plateMaterial.diffuseColor=new h.Color3(.4,.4,.4)},e.prototype._createBackMaterial=function(t){this._backMaterial=new xt(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 Rt(this.name+"Front Material",t.getScene())},e.prototype._createPlateMaterial=function(t){this._plateMaterial=new h.StandardMaterial(this.name+"Plate Material",t.getScene()),this._plateMaterial.specularColor=h.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}(wt),Et=function(){function t(){this.followBehaviorEnabled=!1,this.sixDofDragBehaviorEnabled=!0,this.surfaceMagnetismBehaviorEnabled=!0,this._followBehavior=new h.FollowBehavior,this._sixDofDragBehavior=new h.SixDofDragBehavior,this._surfaceMagnetismBehavior=new h.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}();h.ShaderStore.ShadersStore.handleVertexShader="precision highp float;attribute vec3 position;uniform vec3 positionOffset;uniform mat4 worldViewProjection;uniform float scale;void main(void) {vec4 vPos=vec4((vec3(position)+positionOffset)*scale,1.0);gl_Position=worldViewProjection*vPos;}";h.ShaderStore.ShadersStore.handlePixelShader="uniform vec3 color;void main(void) {gl_FragColor=vec4(color,1.0);}";var Ft,Dt=function(t){function e(e,i){var o=t.call(this,e,i,"handle",{attributes:["position"],uniforms:["worldViewProjection","color","scale","positionOffset"],needAlphaBlending:!1,needAlphaTesting:!1})||this;return o._hover=!1,o._drag=!1,o._color=new h.Color3,o._scale=1,o._lastTick=-1,o.animationLength=100,o.hoverColor=new h.Color3(0,.467,.84),o.baseColor=new h.Color3(1,1,1),o.hoverScale=.75,o.baseScale=.35,o.dragScale=.55,o._positionOffset=h.Vector3.Zero(),o._updateInterpolationTarget(),o._lastTick=Date.now(),o._onBeforeRender=o.getScene().onBeforeRenderObservable.add((function(){var t=Date.now(),e=t-o._lastTick,i=o._targetScale-o._scale,r=h.TmpColors.Color3[0].copyFrom(o._targetColor).subtractToRef(o._color,h.TmpColors.Color3[0]);o._scale=o._scale+i*e/o.animationLength,r.scaleToRef(e/o.animationLength,r),o._color.addToRef(r,o._color),o.setColor3("color",o._color),o.setFloat("scale",o._scale),o.setVector3("positionOffset",o._positionOffset),o._lastTick=t})),o}return n(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}(h.ShaderMaterial);!function(t){t[t.IDLE=0]="IDLE",t[t.HOVER=1]="HOVER",t[t.DRAG=2]="DRAG"}(Ft||(Ft={}));var Lt=function(){function t(t,e){this._state=0,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|=1:this._state&=-2,this._updateMaterial()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"drag",{set:function(t){t?this._state|=2:this._state&=-3,this._updateMaterial()},enumerable:!1,configurable:!0}),t.prototype._createMaterial=function(t){var e=new Dt("handle",this._scene);return t&&(e._positionOffset=t),e},t.prototype._updateMaterial=function(){for(var t=this._state,e=0,i=this._materials;e<i.length;e++)(s=i[e]).hover=!1,s.drag=!1;if(2&t)for(var o=0,r=this._materials;o<r.length;o++)(s=r[o]).drag=!0;else if(1&t)for(var n=0,a=this._materials;n<a.length;n++){var s;(s=a[n]).hover=!0}},t.prototype.setDragBehavior=function(t,e,i){var o=new h.BaseSixDofDragBehavior;this._dragBehavior=o,this._dragStartObserver=o.onDragStartObservable.add(t),this._draggingObserver=o.onDragObservable.add(e),this._dragEndObserver=o.onDragEndObservable.add(i),this._dragBehavior.attach(this.node)},t.prototype.dispose=function(){this._dragBehavior.onDragStartObservable.remove(this._dragStartObserver),this._dragBehavior.onDragObservable.remove(this._draggingObserver),this._dragBehavior.onDragEndObservable.remove(this._dragEndObserver),this._dragBehavior.detach();for(var t=0,e=this._materials;t<e.length;t++)e[t].dispose();this.node.dispose()},t}(),kt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.createNode=function(){var t=(0,h.CreateBox)("sideVert",{width:1,height:10,depth:.1},this._scene),e=new h.TransformNode("side",this._scene);t.parent=e;var i=this._createMaterial();return t.material=i,t.isNearGrabbable=!0,this._materials.push(i),e},e}(Lt),Nt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.createNode=function(){var t=(0,h.CreateBox)("angleHor",{width:3,height:1,depth:.1},this._scene),e=(0,h.CreateBox)("angleVert",{width:1,height:3,depth:.1},this._scene),i=new h.TransformNode("angle",this._scene);return t.parent=i,e.parent=i,t.material=this._createMaterial(new h.Vector3(1,0,0)),e.material=this._createMaterial(new h.Vector3(0,1,0)),e.isNearGrabbable=!0,t.isNearGrabbable=!0,this._materials.push(t.material),this._materials.push(e.material),i},e}(Lt),At=function(t){function e(e){var i=t.call(this,e)||this;return i._boundingDimensions=new h.Vector3(0,0,0),i._renderObserver=null,i._tmpQuaternion=new h.Quaternion,i._tmpVector=new h.Vector3(0,0,0),i._corners=[],i._sides=[],i._boundingBoxGizmo={min:new h.Vector3,max:new h.Vector3},i._margin=.35,i._handleSize=.075,i._attachedSlate=null,i._existingSlateScale=new h.Vector3,i.fixedScreenSize=!1,i.fixedScreenSizeDistanceFactor=10,i._createNode(),i.updateScale=!1,i._renderObserver=i.gizmoLayer.originalScene.onBeforeRenderObservable.add((function(){i.attachedMesh&&!i._existingSlateScale.equals(i.attachedMesh.scaling)&&i.updateBoundingBox()})),i}return n(e,t),Object.defineProperty(e.prototype,"attachedSlate",{get:function(){return this._attachedSlate},set:function(t){var e=this;t?(this.attachedMesh=t.mesh,this.updateBoundingBox(),this._pickedPointObserver=t._host.onPickingObservable.add((function(t){if(!e._handleHovered||t&&t.parent===e._handleHovered.node||(e._handleHovered.hover=!1,e._handleHovered=null),t&&t.parent&&t.parent.reservedDataStore&&t.parent.reservedDataStore.handle){var i=t.parent.reservedDataStore.handle;i.gizmo===e&&(e._handleHovered=i,e._handleHovered.hover=!0)}}))):this._attachedSlate&&this._attachedSlate._host.onPickingObservable.remove(this._pickedPointObserver),this._attachedSlate=t},enumerable:!1,configurable:!0}),e.prototype._createNode=function(){var t=this;this._handlesParent=new h.TransformNode("handlesParent",this.gizmoLayer.utilityLayerScene),this._handlesParent.rotationQuaternion=h.Quaternion.Identity();for(var e=[{dimensions:new h.Vector3(-1,-1,0),origin:new h.Vector3(1,0,0)},{dimensions:new h.Vector3(1,-1,0),origin:new h.Vector3(0,0,0)},{dimensions:new h.Vector3(1,1,0),origin:new h.Vector3(0,1,0)},{dimensions:new h.Vector3(-1,1,0),origin:new h.Vector3(1,1,0)}],i=0;i<4;i++){var o=new Nt(this,this.gizmoLayer.utilityLayerScene);this._corners.push(o),o.node.rotation.z=Math.PI/2*i,o.node.parent=this._handlesParent,this._assignDragBehaviorCorners(o,(function(e,i,o,r){return t._moveHandle(e,i,o,r,!0)}),e[i])}for(i=0;i<4;i++){var r=new kt(this,this.gizmoLayer.utilityLayerScene);this._sides.push(r),r.node.rotation.z=Math.PI/2*i,r.node.parent=this._handlesParent,this._assignDragBehaviorSides(r,i%2==0?new h.Vector3(0,1,0):new h.Vector3(1,0,0))}this._handlesParent.parent=this._rootMesh},e.prototype._keepAspectRatio=function(t,e,i){void 0===i&&(i=!1);var o=h.TmpVectors.Vector3[0];o.copyFromFloats(e,1,0).normalize(),i&&(o.y*=-1);var r=h.Vector3.Dot(t,o);t.copyFrom(o).scaleInPlace(r)},e.prototype._clampDimensions=function(t,e,i,o){void 0===o&&(o=!1);var r=h.TmpVectors.Vector3[0];r.copyFrom(t).multiplyInPlace(i);var n=h.TmpVectors.Vector3[1];if(n.copyFromFloats(Math.max(this._attachedSlate.minDimensions.x,r.x+e.x),Math.max(this._attachedSlate.minDimensions.y,r.y+e.y),0),o){var a=e.x/e.y;n.x=Math.max(n.x,n.y*a),n.y=Math.max(n.y,n.x/a)}r.copyFrom(n).subtractInPlace(e),t.x=Math.sign(t.x)*Math.abs(r.x),t.y=Math.sign(t.y)*Math.abs(r.y)},e.prototype._moveHandle=function(t,e,i,o,r){if(this._attachedSlate){if(r){var n=e.x/e.y;this._keepAspectRatio(i,n,o.dimensions.x*o.dimensions.y<0)}this._clampDimensions(i,e,o.dimensions,r);var a=h.TmpVectors.Vector3[0],s=h.TmpVectors.Vector3[1];a.copyFrom(i).multiplyInPlace(o.origin),s.copyFrom(i).multiplyInPlace(o.dimensions),this._attachedSlate.origin.copyFrom(t).addInPlace(a),this._attachedSlate.dimensions.set(e.x+s.x,e.y+s.y)}},e.prototype._assignDragBehaviorCorners=function(t,e,i){var o=this,r=new h.Vector3,n=new h.Vector3,a=new h.Vector3,s=new h.Matrix,l=new h.Vector3;t.setDragBehavior((function(t){o.attachedSlate&&o.attachedMesh&&(r.set(o.attachedSlate.dimensions.x,o.attachedSlate.dimensions.y,h.Epsilon),n.copyFrom(o.attachedSlate.origin),a.copyFrom(t.position),s.copyFrom(o.attachedMesh.computeWorldMatrix(!0)),s.invert(),o.attachedSlate._followButton.isToggled=!1,h.Vector3.TransformNormalToRef(h.Vector3.Forward(),o.attachedMesh.getWorldMatrix(),l),l.normalize(),o._handleHovered&&(o._handleDragged=o._handleHovered,o._handleDragged.drag=!0))}),(function(t){o.attachedSlate&&o.attachedMesh&&(function(t,e,i,o){t.subtractToRef(i,h.TmpVectors.Vector3[0]);var r=h.Vector3.Dot(h.TmpVectors.Vector3[0],e);h.TmpVectors.Vector3[1].copyFrom(e).scaleInPlace(r),h.TmpVectors.Vector3[0].subtractInPlace(h.TmpVectors.Vector3[1]),h.TmpVectors.Vector3[0].addToRef(i,o)}(t.position,l,a,o._tmpVector),o._tmpVector.subtractInPlace(a),h.Vector3.TransformNormalToRef(o._tmpVector,s,o._tmpVector),e(n,r,o._tmpVector,i),o.attachedSlate._positionElements(),o.updateBoundingBox())}),(function(){o.attachedSlate&&o.attachedNode&&(o.attachedSlate._updatePivot(),o._handleDragged&&(o._handleDragged.drag=!1,o._handleDragged=null))}))},e.prototype._assignDragBehaviorSides=function(t,e){var i=this,o=new h.Quaternion,r=new h.Vector3,n=new h.Vector3,a=new h.Vector3,s=new h.Vector3;t.setDragBehavior((function(t){i.attachedSlate&&i.attachedMesh&&(o.copyFrom(i.attachedMesh.rotationQuaternion),r.copyFrom(t.position),a.copyFrom(i.attachedMesh.getAbsolutePivotPoint()),n.copyFrom(r).subtractInPlace(a).normalize(),i.attachedSlate._followButton.isToggled=!1,h.Vector3.TransformNormalToRef(e,i.attachedMesh.getWorldMatrix(),s),s.normalize(),i._handleHovered&&(i._handleDragged=i._handleHovered,i._handleDragged.drag=!0))}),(function(t){if(i.attachedSlate&&i.attachedMesh){i._tmpVector.copyFrom(t.position),i._tmpVector.subtractInPlace(a),i._tmpVector.normalize();var r=-h.Vector3.GetAngleBetweenVectorsOnPlane(i._tmpVector,n,s);h.Quaternion.RotationAxisToRef(e,r,i._tmpQuaternion),o.multiplyToRef(i._tmpQuaternion,i.attachedMesh.rotationQuaternion)}}),(function(){i.attachedSlate&&i.attachedNode&&(i.attachedSlate._updatePivot(),i._handleDragged&&(i._handleDragged.drag=!1,i._handleDragged=null))}))},e.prototype._attachedNodeChanged=function(t){t&&this.updateBoundingBox()},e.prototype.updateBoundingBox=function(){if(this.attachedMesh){h.PivotTools._RemoveAndStorePivotPoint(this.attachedMesh);var t=this.attachedMesh.parent;this.attachedMesh.setParent(null),this._update(),this.attachedMesh.rotationQuaternion||(this.attachedMesh.rotationQuaternion=h.Quaternion.RotationYawPitchRoll(this.attachedMesh.rotation.y,this.attachedMesh.rotation.x,this.attachedMesh.rotation.z)),this._tmpQuaternion.copyFrom(this.attachedMesh.rotationQuaternion),this._tmpVector.copyFrom(this.attachedMesh.position),this.attachedMesh.rotationQuaternion.set(0,0,0,1),this.attachedMesh.position.set(0,0,0);var e=this.attachedMesh.getHierarchyBoundingVectors();e.max.subtractToRef(e.min,this._boundingDimensions),this._boundingBoxGizmo.min=e.min,this._boundingBoxGizmo.max=e.max,this._updateHandlesPosition(),this._updateHandlesScaling(),this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion),this.attachedMesh.position.copyFrom(this._tmpVector),h.PivotTools._RestorePivotPoint(this.attachedMesh),this.attachedMesh.setParent(t),this.attachedMesh.computeWorldMatrix(!0),this._existingSlateScale.copyFrom(this.attachedMesh.scaling)}},e.prototype._updateHandlesPosition=function(){var t=this._boundingBoxGizmo.min.clone(),e=this._boundingBoxGizmo.max.clone(),i=this._corners[0].node.scaling.length();t.x-=this._margin*i,t.y-=this._margin*i,e.x+=this._margin*i,e.y+=this._margin*i;var o=t.add(e).scaleInPlace(.5);this._corners[0].node.position.copyFromFloats(t.x,t.y,0),this._corners[1].node.position.copyFromFloats(e.x,t.y,0),this._corners[2].node.position.copyFromFloats(e.x,e.y,0),this._corners[3].node.position.copyFromFloats(t.x,e.y,0),this._sides[0].node.position.copyFromFloats(t.x,o.y,0),this._sides[1].node.position.copyFromFloats(o.x,t.y,0),this._sides[2].node.position.copyFromFloats(e.x,o.y,0),this._sides[3].node.position.copyFromFloats(o.x,e.y,0)},e.prototype._updateHandlesScaling=function(){if(this._attachedSlate&&this._attachedSlate.mesh){for(var t=this._attachedSlate.mesh.scaling.x*this._attachedSlate.dimensions.x,e=this._attachedSlate.mesh.scaling.y*this._attachedSlate.dimensions.y,i=Math.min(t,e)*this._handleSize,o=0;o<this._corners.length;o++)this._corners[o].node.scaling.setAll(i);for(o=0;o<this._sides.length;o++)this._sides[o].node.scaling.setAll(i)}},e.prototype._update=function(){if(t.prototype._update.call(this),this.gizmoLayer.utilityLayerScene.activeCamera&&this._attachedSlate&&this._attachedSlate.mesh){if(this.fixedScreenSize){this._attachedSlate.mesh.absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position,this._tmpVector);for(var e=this._handleSize*this._tmpVector.length()/this.fixedScreenSizeDistanceFactor,i=0;i<this._corners.length;i++)this._corners[i].node.scaling.set(e,e,e);for(i=0;i<this._sides.length;i++)this._sides[i].node.scaling.set(e,e,e)}this._updateHandlesPosition()}},e.prototype.dispose=function(){this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver),t.prototype.dispose.call(this);for(var e=0,i=this._corners;e<i.length;e++)i[e].dispose();for(var o=0,r=this._sides;o<r.length;o++)r[o].dispose()},e}(h.Gizmo),zt=function(t){function e(e){var i=t.call(this,e)||this;return i.titleBarMargin=.005,i.origin=new h.Vector3(0,0,0),i._dimensions=new h.Vector2(21.875,12.5),i._titleBarHeight=.625,i._titleText="",i._contentScaleRatio=1,i.minDimensions=new h.Vector2(15.625,6.25),i.defaultDimensions=i._dimensions.clone(),i._followButton=new Mt("followButton"+i.name),i._followButton.isToggleButton=!0,i._closeButton=new Mt("closeButton"+i.name),i._contentViewport=new h.Viewport(0,0,1,1),i._contentDragBehavior=new h.PointerDragBehavior({dragPlaneNormal:new h.Vector3(0,0,-1)}),i}return n(e,t),Object.defineProperty(e.prototype,"defaultBehavior",{get:function(){return this._defaultBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dimensions",{get:function(){return this._dimensions},set:function(t){var e=1;if(t.x<this.minDimensions.x||t.y<this.minDimensions.y){var i=t.x/t.y;e=this.minDimensions.x/this.minDimensions.y>i?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,o=this._titleBar,r=this._titleBarTitle,n=this._contentPlate,a=this._backPlate;if(t&&i&&o){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,l=n.getScene().useRightHandedSystem;o.scaling.set(this.dimensions.x,this.titleBarHeight,h.Epsilon),r.scaling.set(this.dimensions.x-2*this.titleBarHeight,this.titleBarHeight,h.Epsilon),n.scaling.copyFromFloats(this.dimensions.x,s,h.Epsilon),a.scaling.copyFromFloats(this.dimensions.x,s,h.Epsilon),o.position.copyFromFloats(this.dimensions.x/2,-this.titleBarHeight/2,0).addInPlace(this.origin),r.position.copyFromFloats(this.dimensions.x/2-this.titleBarHeight,-this.titleBarHeight/2,l?h.Epsilon:-h.Epsilon).addInPlace(this.origin),n.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?-h.Epsilon:h.Epsilon).addInPlace(this.origin),this._titleTextComponent.host.scaleTo(e._DEFAULT_TEXT_RESOLUTION_Y*r.scaling.x/r.scaling.y,e._DEFAULT_TEXT_RESOLUTION_Y);var _=this.dimensions.x/s;this._contentViewport.width=this._contentScaleRatio,this._contentViewport.height=this._contentScaleRatio/_,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 h.Vector3(.5*this.dimensions.x,.5*-this.dimensions.y,h.Epsilon);t.addInPlace(this.origin),t.z=0;var e=new h.Vector3(0,0,0);h.Vector3.TransformCoordinatesToRef(e,this.mesh.computeWorldMatrix(!0),e),this.mesh.setPivotPoint(t);var i=new h.Vector3(0,0,0);h.Vector3.TransformCoordinatesToRef(i,this.mesh.computeWorldMatrix(!0),i),this.mesh.position.addInPlace(e).subtractInPlace(i)}},e.prototype._createNode=function(t){var i=this,o=new h.Mesh("slate_"+this.name,t);this._titleBar=(0,h.CreateBox)("titleBar_"+this.name,{size:1},t),this._titleBarTitle=(0,h.CreatePlane)("titleText_"+this.name,{size:1},t),this._titleBarTitle.parent=o,this._titleBarTitle.isPickable=!1;var r=lt.CreateForMesh(this._titleBarTitle);if(this._titleTextComponent=new B("titleText_"+this.name,this._titleText),this._titleTextComponent.textWrapping=2,this._titleTextComponent.textHorizontalAlignment=y.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,r.addControl(this._titleTextComponent),t.useRightHandedSystem){var n=new h.Vector4(0,0,1,1);this._contentPlate=(0,h.CreatePlane)("contentPlate_"+this.name,{size:1,sideOrientation:h.VertexData.BACKSIDE,frontUVs:n},t),this._backPlate=(0,h.CreatePlane)("backPlate_"+this.name,{size:1,sideOrientation:h.VertexData.FRONTSIDE},t)}else n=new h.Vector4(0,0,1,1),this._contentPlate=(0,h.CreatePlane)("contentPlate_"+this.name,{size:1,sideOrientation:h.VertexData.FRONTSIDE,frontUVs:n},t),this._backPlate=(0,h.CreatePlane)("backPlate_"+this.name,{size:1,sideOrientation:h.VertexData.BACKSIDE},t);this._titleBar.parent=o,this._titleBar.isNearGrabbable=!0,this._contentPlate.parent=o,this._backPlate.parent=o,this._attachContentPlateBehavior(),this._addControl(this._followButton),this._addControl(this._closeButton);var a=this._followButton,s=this._closeButton;return a.node.parent=o,s.node.parent=o,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()})),o.rotationQuaternion=h.Quaternion.Identity(),o.isVisible=!1,o},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,o=new h.Vector3,r=new h.Vector3,n=new h.Vector3,a=new h.Vector3,s=new h.Vector2;this._contentDragBehavior.onDragStartObservable.add((function(s){t.node&&(e=t._contentViewport.clone(),i=t.node.computeWorldMatrix(!0),o.copyFrom(s.dragPlanePoint),r.set(t.dimensions.x,t.dimensions.y,h.Epsilon),r.y-=t.titleBarHeight+t.titleBarMargin,h.Vector3.TransformNormalToRef(r,i,r),n.copyFromFloats(0,1,0),h.Vector3.TransformNormalToRef(n,i,n),a.copyFromFloats(1,0,0),h.Vector3.TransformNormalToRef(a,i,a),n.normalize(),n.scaleInPlace(1/h.Vector3.Dot(n,r)),a.normalize(),a.scaleInPlace(1/h.Vector3.Dot(a,r)))}));var l=new h.Vector3;this._contentDragBehavior.onDragObservable.add((function(i){l.copyFrom(i.dragPlanePoint),l.subtractInPlace(o),s.copyFromFloats(h.Vector3.Dot(l,a),h.Vector3.Dot(l,n)),t._contentViewport.x=h.Scalar.Clamp(e.x-l.x,0,1-t._contentViewport.width*t._contentScaleRatio),t._contentViewport.y=h.Scalar.Clamp(e.y-l.y,0,1-t._contentViewport.height*t._contentScaleRatio),t._applyContentViewport()}))},e.prototype._affectMaterial=function(t){this._titleBarMaterial=new Ct("".concat(this.name," plateMaterial"),t.getScene()),this._contentMaterial=new xt("".concat(this.name," contentMaterial"),t.getScene()),this._contentMaterial.renderBorders=!0,this._backMaterial=new Ct("".concat(this.name," backPlate"),t.getScene()),this._backMaterial.lineWidth=h.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 At(this._host.utilityLayer),this._gizmo.attachedSlate=this,this._defaultBehavior=new Et,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 o=i.getWorldMatrix(),r=h.Vector3.TransformNormal(h.Vector3.Backward(e.useRightHandedSystem),o);this.origin.setAll(0),this._gizmo.updateBoundingBox();var n=this.node.getAbsolutePivotPoint();this.node.position.copyFrom(i.position).subtractInPlace(r).subtractInPlace(n),this.node.rotationQuaternion=h.Quaternion.FromLookDirectionLH(r,new h.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}(ft),Qt=function(t){function e(e,i){var o=t.call(this,i)||this;return o._currentMesh=e,o.pointerEnterAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1.1)},o.pointerOutAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1/1.1)},o.pointerDownAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(.95)},o.pointerUpAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1/.95)},o}return n(e,t),e.prototype._getTypeName=function(){return"MeshButton3D"},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}(gt),Vt=function(t){function e(e){var i=t.call(this,e)||this;return i._isPinned=!1,i._defaultBehavior=new Et,i._dragObserver=i._defaultBehavior.sixDofDragBehavior.onDragObservable.add((function(){i.isPinned=!0})),i.backPlateMargin=1,i}return n(e,t),Object.defineProperty(e.prototype,"defaultBehavior",{get:function(){return this._defaultBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isPinned",{get:function(){return this._isPinned},set:function(t){this._pinButton.isToggled===t?(this._isPinned=t,this._defaultBehavior.followBehaviorEnabled=!t):this._pinButton.isToggled=t},enumerable:!1,configurable:!0}),e.prototype._createPinButton=function(t){var i=this,o=new Mt("pin"+this.name,!1);return o.imageUrl=e._ASSETS_BASE_URL+e._PIN_ICON_FILENAME,o.parent=this,o._host=this._host,o.isToggleButton=!0,o.onToggleObservable.add((function(t){i.isPinned=t})),this._host.utilityLayer&&(o._prepareNode(this._host.utilityLayer.utilityLayerScene),o.scaling.scaleInPlace(Pt.MENU_BUTTON_SCALE),o.node&&(o.node.parent=t)),o},e.prototype._createNode=function(e){var i=t.prototype._createNode.call(this,e);return this._pinButton=this._createPinButton(i),this.isPinned=!1,this._defaultBehavior.attach(i,[this._backPlate]),this._defaultBehavior.followBehavior.ignoreCameraPitchAndRoll=!0,this._defaultBehavior.followBehavior.pitchOffset=-15,this._defaultBehavior.followBehavior.minimumDistance=.3,this._defaultBehavior.followBehavior.defaultDistance=.4,this._defaultBehavior.followBehavior.maximumDistance=.6,this._backPlate.isNearGrabbable=!0,i.isVisible=!1,i},e.prototype._finalProcessing=function(){t.prototype._finalProcessing.call(this),this._pinButton.position.copyFromFloats((this._backPlate.scaling.x+Pt.MENU_BUTTON_SCALE)/2,this._backPlate.scaling.y/2,0)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._defaultBehavior.sixDofDragBehavior.onDragObservable.remove(this._dragObserver),this._defaultBehavior.detach()},e._ASSETS_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",e._PIN_ICON_FILENAME="IconPin.png",e}(Pt),Wt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype._mapGridNode=function(t,e){var i=t.mesh;if(i){t.position=e.clone();var o=h.TmpVectors.Vector3[0];switch(o.copyFrom(e),this.orientation){case bt.FACEORIGIN_ORIENTATION:case bt.FACEFORWARD_ORIENTATION:o.addInPlace(new h.Vector3(0,0,1)),i.lookAt(o);break;case bt.FACEFORWARDREVERSED_ORIENTATION:case bt.FACEORIGINREVERSED_ORIENTATION:o.addInPlace(new h.Vector3(0,0,-1)),i.lookAt(o)}}},e}(mt),Ht=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._iteration=100,e}return n(e,t),Object.defineProperty(e.prototype,"iteration",{get:function(){return this._iteration},set:function(t){var e=this;this._iteration!==t&&(this._iteration=t,h.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._mapGridNode=function(t,e){var i=t.mesh,o=this._scatterMapping(e);if(i){switch(this.orientation){case bt.FACEORIGIN_ORIENTATION:case bt.FACEFORWARD_ORIENTATION:i.lookAt(new h.Vector3(0,0,1));break;case bt.FACEFORWARDREVERSED_ORIENTATION:case bt.FACEORIGINREVERSED_ORIENTATION:i.lookAt(new h.Vector3(0,0,-1))}t.position=o}},e.prototype._scatterMapping=function(t){return t.x=(1-2*Math.random())*this._cellWidth,t.y=(1-2*Math.random())*this._cellHeight,t},e.prototype._finalProcessing=function(){for(var t=[],e=0,i=this._children;e<i.length;e++){var o=i[e];o.mesh&&t.push(o.mesh)}for(var r=0;r<this._iteration;r++){t.sort((function(t,e){var i=t.position.lengthSquared(),o=e.position.lengthSquared();return i<o?1:i>o?-1:0}));for(var n=Math.pow(this.margin,2),a=Math.max(this._cellWidth,this._cellHeight),s=h.TmpVectors.Vector2[0],l=h.TmpVectors.Vector3[0],_=0;_<t.length-1;_++)for(var c=_+1;c<t.length;c++)if(_!=c){t[c].position.subtractToRef(t[_].position,l),s.x=l.x,s.y=l.y;var u=a,d=s.lengthSquared()-n;(d-=Math.min(d,n))<Math.pow(u,2)&&(s.normalize(),l.scaleInPlace(.5*(u-Math.sqrt(d))),t[c].position.addInPlace(l),t[_].position.subtractInPlace(l))}}},e}(mt);h.ShaderStore.ShadersStore.mrdlSliderBarPixelShader="uniform vec3 cameraPosition;varying vec3 vPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec3 vBinormal;varying vec4 vColor;varying vec4 vExtra1;varying vec4 vExtra2;varying vec4 vExtra3;uniform float _Radius_;uniform float _Bevel_Front_;uniform float _Bevel_Front_Stretch_;uniform float _Bevel_Back_;uniform float _Bevel_Back_Stretch_;uniform float _Radius_Top_Left_;uniform float _Radius_Top_Right_;uniform float _Radius_Bottom_Left_;uniform float _Radius_Bottom_Right_;uniform bool _Bulge_Enabled_;uniform float _Bulge_Height_;uniform float _Bulge_Radius_;uniform float _Sun_Intensity_;uniform float _Sun_Theta_;uniform float _Sun_Phi_;uniform float _Indirect_Diffuse_;uniform vec4 _Albedo_;uniform float _Specular_;uniform float _Shininess_;uniform float _Sharpness_;uniform float _Subsurface_;uniform vec4 _Left_Color_;uniform vec4 _Right_Color_;uniform float _Reflection_;uniform float _Front_Reflect_;uniform float _Edge_Reflect_;uniform float _Power_;uniform vec4 _Sky_Color_;uniform vec4 _Horizon_Color_;uniform vec4 _Ground_Color_;uniform float _Horizon_Power_;uniform sampler2D _Reflection_Map_;uniform sampler2D _Indirect_Environment_;uniform float _Width_;uniform float _Fuzz_;uniform float _Min_Fuzz_;uniform float _Clip_Fade_;uniform float _Hue_Shift_;uniform float _Saturation_Shift_;uniform float _Value_Shift_;uniform vec3 _Blob_Position_;uniform float _Blob_Intensity_;uniform float _Blob_Near_Size_;uniform float _Blob_Far_Size_;uniform float _Blob_Near_Distance_;uniform float _Blob_Far_Distance_;uniform float _Blob_Fade_Length_;uniform float _Blob_Pulse_;uniform float _Blob_Fade_;uniform sampler2D _Blob_Texture_;uniform vec3 _Blob_Position_2_;uniform float _Blob_Near_Size_2_;uniform float _Blob_Pulse_2_;uniform float _Blob_Fade_2_;uniform vec3 _Left_Index_Pos_;uniform vec3 _Right_Index_Pos_;uniform vec3 _Left_Index_Middle_Pos_;uniform vec3 _Right_Index_Middle_Pos_;uniform sampler2D _Decal_;uniform vec2 _Decal_Scale_XY_;uniform bool _Decal_Front_Only_;uniform float _Rim_Intensity_;uniform sampler2D _Rim_Texture_;uniform float _Rim_Hue_Shift_;uniform float _Rim_Saturation_Shift_;uniform float _Rim_Value_Shift_;uniform float _Iridescence_Intensity_;uniform sampler2D _Iridescence_Texture_;uniform bool Use_Global_Left_Index;uniform bool Use_Global_Right_Index;uniform vec4 Global_Left_Index_Tip_Position;uniform vec4 Global_Right_Index_Tip_Position;uniform vec4 Global_Left_Thumb_Tip_Position;uniform vec4 Global_Right_Thumb_Tip_Position;uniform vec4 Global_Left_Index_Middle_Position;uniform vec4 Global_Right_Index_Middle_Position;uniform float Global_Left_Index_Tip_Proximity;uniform float Global_Right_Index_Tip_Proximity;void Blob_Fragment_B30(\nsampler2D Blob_Texture,\nvec4 Blob_Info1,\nvec4 Blob_Info2,\nout vec4 Blob_Color)\n{float k1=dot(Blob_Info1.xy,Blob_Info1.xy);float k2=dot(Blob_Info2.xy,Blob_Info2.xy);vec3 closer=k1<k2 ? vec3(k1,Blob_Info1.z,Blob_Info1.w) : vec3(k2,Blob_Info2.z,Blob_Info2.w);Blob_Color=closer.z*texture(Blob_Texture,vec2(vec2(sqrt(closer.x),closer.y).x,1.0-vec2(sqrt(closer.x),closer.y).y))*clamp(1.0-closer.x,0.0,1.0);}\nvoid FastLinearTosRGB_B42(\nvec4 Linear,\nout vec4 sRGB)\n{sRGB.rgb=sqrt(clamp(Linear.rgb,0.0,1.0));sRGB.a=Linear.a;}\nvoid Scale_RGB_B59(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{Result=vec4(Scalar,Scalar,Scalar,1)*Color;}\nvoid Fragment_Main_B121(\nfloat Sun_Intensity,\nfloat Sun_Theta,\nfloat Sun_Phi,\nvec3 Normal,\nvec4 Albedo,\nfloat Fresnel_Reflect,\nfloat Shininess,\nvec3 Incident,\nvec4 Horizon_Color,\nvec4 Sky_Color,\nvec4 Ground_Color,\nfloat Indirect_Diffuse,\nfloat Specular,\nfloat Horizon_Power,\nfloat Reflection,\nvec4 Reflection_Sample,\nvec4 Indirect_Sample,\nfloat Sharpness,\nfloat SSS,\nfloat Subsurface,\nvec4 Translucence,\nvec4 Rim_Light,\nvec4 Iridescence,\nout vec4 Result)\n{float theta=Sun_Theta*2.0*3.14159;float phi=Sun_Phi*3.14159;vec3 lightDir= vec3(cos(phi)*cos(theta),sin(phi),cos(phi)*sin(theta));float NdotL=max(dot(lightDir,Normal),0.0);vec3 R=reflect(Incident,Normal);float RdotL=max(0.0,dot(R,lightDir));float specular=pow(RdotL,Shininess);specular=mix(specular,smoothstep(0.495*Sharpness,1.0-0.495*Sharpness,specular),Sharpness);vec4 gi=mix(Ground_Color,Sky_Color,Normal.y*0.5+0.5);Result=((Sun_Intensity*NdotL+Indirect_Sample*Indirect_Diffuse+Translucence)*(1.0+SSS*Subsurface))*Albedo*(1.0-Fresnel_Reflect)+(Sun_Intensity*specular*Specular+Fresnel_Reflect*Reflection*Reflection_Sample)+Fresnel_Reflect*Rim_Light+Iridescence;}\nvoid Bulge_B79(\nbool Enabled,\nvec3 Normal,\nvec3 Tangent,\nfloat Bulge_Height,\nvec4 UV,\nfloat Bulge_Radius,\nvec3 ButtonN,\nout vec3 New_Normal)\n{vec2 xy=clamp(UV.xy*2.0,vec2(-1,-1),vec2(1,1));vec3 B=(cross(Normal,Tangent));float k=-clamp(1.0-length(xy)/Bulge_Radius,0.0,1.0)*Bulge_Height;k=sin(k*3.14159*0.5);k*=smoothstep(0.9998,0.9999,abs(dot(ButtonN,Normal)));New_Normal=Normal*sqrt(1.0-k*k)+(xy.x*Tangent+xy.y*B)*k;New_Normal=Enabled ? New_Normal : Normal;}\nvoid SSS_B77(\nvec3 ButtonN,\nvec3 Normal,\nvec3 Incident,\nout float Result)\n{float NdotI=abs(dot(Normal,Incident));float BdotI=abs(dot(ButtonN,Incident));Result=(abs(NdotI-BdotI)); }\nvoid FingerOcclusion_B67(\nfloat Width,\nfloat DistToCenter,\nfloat Fuzz,\nfloat Min_Fuzz,\nvec3 Position,\nvec3 Forward,\nvec3 Nearest,\nfloat Fade_Out,\nout float NotInShadow)\n{float d=dot((Nearest-Position),Forward);float sh=smoothstep(Width*0.5,Width*0.5+Fuzz*max(d,0.0)+Min_Fuzz,DistToCenter);NotInShadow=1.0-(1.0-sh)*smoothstep(-Fade_Out,0.0,d);}\nvoid FingerOcclusion_B68(\nfloat Width,\nfloat DistToCenter,\nfloat Fuzz,\nfloat Min_Fuzz,\nvec3 Position,\nvec3 Forward,\nvec3 Nearest,\nfloat Fade_Out,\nout float NotInShadow)\n{float d=dot((Nearest-Position),Forward);float sh=smoothstep(Width*0.5,Width*0.5+Fuzz*max(d,0.0)+Min_Fuzz,DistToCenter);NotInShadow=1.0-(1.0-sh)*smoothstep(-Fade_Out,0.0,d);}\nvoid Scale_Color_B91(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{Result=Scalar*Color;}\nvoid From_HSV_B73(\nfloat Hue,\nfloat Saturation,\nfloat Value,\nfloat Alpha,\nout vec4 Color)\n{vec4 K=vec4(1.0,2.0/3.0,1.0/3.0,3.0);vec3 p=abs(fract(vec3(Hue,Hue,Hue)+K.xyz)*6.0-K.www);Color.rgb=Value*mix(K.xxx,clamp(p-K.xxx,0.0,1.0),Saturation);Color.a=Alpha;}\nvoid Fast_Fresnel_B122(\nfloat Front_Reflect,\nfloat Edge_Reflect,\nfloat Power,\nvec3 Normal,\nvec3 Incident,\nout float Transmit,\nout float Reflect)\n{float d=max(-dot(Incident,Normal),0.0);Reflect=Front_Reflect+(Edge_Reflect-Front_Reflect)*pow(.01-d,Power);Transmit=1.0-Reflect;}\nvoid Mapped_Environment_B51(\nsampler2D Reflected_Environment,\nsampler2D Indirect_Environment,\nvec3 Dir,\nout vec4 Reflected_Color,\nout vec4 Indirect_Diffuse)\n{Reflected_Color=texture(Reflected_Environment,vec2(atan(Dir.z,Dir.x)/3.14159*0.5,asin(Dir.y)/3.14159+0.5));Indirect_Diffuse=texture(Indirect_Environment,vec2(atan(Dir.z,Dir.x)/3.14159*0.5,asin(Dir.y)/3.14159+0.5));}\nvec4 SampleEnv_Bid50(vec3 D,vec4 S,vec4 H,vec4 G,float exponent)\n{float k=pow(abs(D.y),exponent);vec4 C;if (D.y>0.0) {C=mix(H,S,k);} else {C=mix(H,G,k); }\nreturn C;}\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{Reflected_Color=SampleEnv_Bid50(Reflected,Sky_Color,Horizon_Color,Ground_Color,Horizon_Power);Indirect_Color=mix(Ground_Color,Sky_Color,Normal.y*0.5+0.5);}\nvoid Min_Segment_Distance_B65(\nvec3 P0,\nvec3 P1,\nvec3 Q0,\nvec3 Q1,\nout vec3 NearP,\nout vec3 NearQ,\nout float Distance)\n{vec3 u=P1-P0;vec3 v=Q1-Q0;vec3 w=P0-Q0;float a=dot(u,u);float b=dot(u,v);float c=dot(v,v);float d=dot(u,w);float e=dot(v,w);float D=a*c-b*b;float sD=D;float tD=D;float sc,sN,tc,tN;if (D<0.00001) {sN=0.0;sD=1.0;tN=e;tD=c;} else {sN=(b*e-c*d);tN=(a*e-b*d);if (sN<0.0) {sN=0.0;tN=e;tD=c;} else if (sN>sD) {sN=sD;tN=e+b;tD=c;}}\nif (tN<0.0) {tN=0.0;if (-d<0.0) {sN=0.0;} else if (-d>a) {sN=sD;} else {sN=-d;sD=a;}} else if (tN>tD) {tN=tD;if ((-d+b)<0.0) {sN=0.0;} else if ((-d+b)>a) {sN=sD;} else {sN=(-d+b);sD=a;}}\nsc=abs(sN)<0.000001 ? 0.0 : sN/sD;tc=abs(tN)<0.000001 ? 0.0 : tN/tD;NearP=P0+sc*u;NearQ=Q0+tc*v;Distance=distance(NearP,NearQ);}\nvoid To_XYZ_B74(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{X=Vec3.x;Y=Vec3.y;Z=Vec3.z;}\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{Left_Index= (Use_Global_Left_Index ? Global_Left_Index_Tip_Position.xyz : Left_Index_Pos);Right_Index= (Use_Global_Right_Index ? Global_Right_Index_Tip_Position.xyz : Right_Index_Pos);Left_Index_Middle= (Use_Global_Left_Index ? Global_Left_Index_Middle_Position.xyz : Left_Index_Middle_Pos);Right_Index_Middle= (Use_Global_Right_Index ? Global_Right_Index_Middle_Position.xyz : Right_Index_Middle_Pos);}\nvoid VaryHSV_B108(\nvec3 HSV_In,\nfloat Hue_Shift,\nfloat Saturation_Shift,\nfloat Value_Shift,\nout vec3 HSV_Out)\n{HSV_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));}\nvoid Remap_Range_B114(\nfloat In_Min,\nfloat In_Max,\nfloat Out_Min,\nfloat Out_Max,\nfloat In,\nout float Out)\n{Out=mix(Out_Min,Out_Max,clamp((In-In_Min)/(In_Max-In_Min),0.0,1.0));}\nvoid To_HSV_B75(\nvec4 Color,\nout float Hue,\nout float Saturation,\nout float Value,\nout float Alpha,\nout vec3 HSV)\n{vec4 K=vec4(0.0,-1.0/3.0,2.0/3.0,-1.0);vec4 p=Color.g<Color.b ? vec4(Color.bg,K.wz) : vec4(Color.gb,K.xy);vec4 q=Color.r<p.x ? vec4(p.xyw,Color.r) : vec4(Color.r,p.yzx);float d=q.x-min(q.w,q.y);float e=1.0e-10;Hue=abs(q.z+(q.w-q.y)/(6.0*d+e));Saturation=d/(q.x+e);Value=q.x;Alpha=Color.a;HSV=vec3(Hue,Saturation,Value);}\nvoid Code_B110(\nfloat X,\nout float Result)\n{Result=(acos(X)/3.14159-0.5)*2.0;}\nvoid Rim_Light_B132(\nvec3 Front,\nvec3 Normal,\nvec3 Incident,\nfloat Rim_Intensity,\nsampler2D Texture,\nout vec4 Result)\n{vec3 R=reflect(Incident,Normal);float RdotF=dot(R,Front);float RdotL=sqrt(1.0-RdotF*RdotF);vec2 UV=vec2(R.y*0.5+0.5,0.5);vec4 Color=texture(Texture,UV);Result=Color;}\nvoid main()\n{vec4 Blob_Color_Q30;\n#if BLOB_ENABLE\nBlob_Fragment_B30(_Blob_Texture_,vExtra2,vExtra3,Blob_Color_Q30);\n#else\nBlob_Color_Q30=vec4(0,0,0,0);\n#endif\nvec3 Incident_Q39=normalize(vPosition-cameraPosition);vec3 Normalized_Q38=normalize(vNormal);vec3 Normalized_Q71=normalize(vTangent);vec4 Color_Q83;\n#if DECAL_ENABLE\nColor_Q83=texture(_Decal_,vUV);\n#else\nColor_Q83=vec4(0,0,0,0);\n#endif\nfloat X_Q90;float Y_Q90;float Z_Q90;float W_Q90;X_Q90=vExtra1.x;Y_Q90=vExtra1.y;Z_Q90=vExtra1.z;W_Q90=vExtra1.w;vec4 Linear_Q43;Linear_Q43.rgb=clamp(_Sky_Color_.rgb*_Sky_Color_.rgb,0.0,1.0);Linear_Q43.a=_Sky_Color_.a;vec4 Linear_Q44;Linear_Q44.rgb=clamp(_Horizon_Color_.rgb*_Horizon_Color_.rgb,0.0,1.0);Linear_Q44.a=_Horizon_Color_.a;vec4 Linear_Q45;Linear_Q45.rgb=clamp(_Ground_Color_.rgb*_Ground_Color_.rgb,0.0,1.0);Linear_Q45.a=_Ground_Color_.a;vec3 Left_Index_Q64;vec3 Right_Index_Q64;vec3 Left_Index_Middle_Q64;vec3 Right_Index_Middle_Q64;Finger_Positions_B64(_Left_Index_Pos_,_Right_Index_Pos_,_Left_Index_Middle_Pos_,_Right_Index_Middle_Pos_,Left_Index_Q64,Right_Index_Q64,Left_Index_Middle_Q64,Right_Index_Middle_Q64);vec4 Linear_Q46;Linear_Q46.rgb=clamp(_Albedo_.rgb*_Albedo_.rgb,0.0,1.0);Linear_Q46.a=_Albedo_.a;vec3 Normalized_Q107=normalize(vBinormal);vec3 Incident_Q70=normalize(vPosition-cameraPosition);vec3 New_Normal_Q79;Bulge_B79(_Bulge_Enabled_,Normalized_Q38,Normalized_Q71,_Bulge_Height_,vColor,_Bulge_Radius_,vBinormal,New_Normal_Q79);float Result_Q77;SSS_B77(vBinormal,New_Normal_Q79,Incident_Q39,Result_Q77);vec4 Result_Q91;Scale_Color_B91(Color_Q83,X_Q90,Result_Q91);float Transmit_Q122;float Reflect_Q122;Fast_Fresnel_B122(_Front_Reflect_,_Edge_Reflect_,_Power_,New_Normal_Q79,Incident_Q39,Transmit_Q122,Reflect_Q122);float Product_Q125=Y_Q90*Y_Q90;vec3 NearP_Q65;vec3 NearQ_Q65;float Distance_Q65;Min_Segment_Distance_B65(Left_Index_Q64,Left_Index_Middle_Q64,vPosition,cameraPosition,NearP_Q65,NearQ_Q65,Distance_Q65);vec3 NearP_Q63;vec3 NearQ_Q63;float Distance_Q63;Min_Segment_Distance_B65(Right_Index_Q64,Right_Index_Middle_Q64,vPosition,cameraPosition,NearP_Q63,NearQ_Q63,Distance_Q63);vec3 Reflected_Q47=reflect(Incident_Q39,New_Normal_Q79);vec4 Product_Q103=Linear_Q46*vec4(1,1,1,1);vec4 Result_Q132;Rim_Light_B132(Normalized_Q107,Normalized_Q38,Incident_Q70,_Rim_Intensity_,_Rim_Texture_,Result_Q132);float Dot_Q72=dot(Incident_Q70, Normalized_Q71);float MaxAB_Q123=max(Reflect_Q122,Product_Q125);float NotInShadow_Q67;\n#if OCCLUSION_ENABLED\nFingerOcclusion_B67(_Width_,Distance_Q65,_Fuzz_,_Min_Fuzz_,vPosition,vBinormal,NearP_Q65,_Clip_Fade_,NotInShadow_Q67);\n#else\nNotInShadow_Q67=1.0;\n#endif\nfloat NotInShadow_Q68;\n#if OCCLUSION_ENABLED\nFingerOcclusion_B68(_Width_,Distance_Q63,_Fuzz_,_Min_Fuzz_,vPosition,vBinormal,NearP_Q63,_Clip_Fade_,NotInShadow_Q68);\n#else\nNotInShadow_Q68=1.0;\n#endif\nvec4 Reflected_Color_Q51;vec4 Indirect_Diffuse_Q51;\n#if ENV_ENABLE\nMapped_Environment_B51(_Reflection_Map_,_Indirect_Environment_,Reflected_Q47,Reflected_Color_Q51,Indirect_Diffuse_Q51);\n#else\nReflected_Color_Q51=vec4(0,0,0,1);Indirect_Diffuse_Q51=vec4(0,0,0,1);\n#endif\nvec4 Reflected_Color_Q50;vec4 Indirect_Color_Q50;\n#if SKY_ENABLED\nSky_Environment_B50(New_Normal_Q79,Reflected_Q47,Linear_Q43,Linear_Q44,Linear_Q45,_Horizon_Power_,Reflected_Color_Q50,Indirect_Color_Q50);\n#else\nReflected_Color_Q50=vec4(0,0,0,1);Indirect_Color_Q50=vec4(0,0,0,1);\n#endif\nfloat Hue_Q75;float Saturation_Q75;float Value_Q75;float Alpha_Q75;vec3 HSV_Q75;To_HSV_B75(Product_Q103,Hue_Q75,Saturation_Q75,Value_Q75,Alpha_Q75,HSV_Q75);float Hue_Q127;float Saturation_Q127;float Value_Q127;float Alpha_Q127;vec3 HSV_Q127;To_HSV_B75(Result_Q132,Hue_Q127,Saturation_Q127,Value_Q127,Alpha_Q127,HSV_Q127);float Result_Q110;Code_B110(Dot_Q72,Result_Q110);float AbsA_Q76=abs(Result_Q110);float MinAB_Q58=min(NotInShadow_Q67,NotInShadow_Q68);vec4 Sum_Q48=Reflected_Color_Q51+Reflected_Color_Q50;vec4 Sum_Q49=Indirect_Diffuse_Q51+Indirect_Color_Q50;vec3 HSV_Out_Q126;VaryHSV_B108(HSV_Q127,_Rim_Hue_Shift_,_Rim_Saturation_Shift_,_Rim_Value_Shift_,HSV_Out_Q126);float Out_Q114;Remap_Range_B114(-1.0,1.0,0.0,1.0,Result_Q110,Out_Q114);float Product_Q106;Product_Q106=AbsA_Q76*_Hue_Shift_;float X_Q128;float Y_Q128;float Z_Q128;To_XYZ_B74(HSV_Out_Q126,X_Q128,Y_Q128,Z_Q128);vec2 Vec2_Q112=vec2(Out_Q114,0.5);vec3 HSV_Out_Q108;VaryHSV_B108(HSV_Q75,Product_Q106,_Saturation_Shift_,_Value_Shift_,HSV_Out_Q108);vec4 Color_Q129;From_HSV_B73(X_Q128,Y_Q128,Z_Q128,0.0,Color_Q129);vec4 Color_Q111;\n#if IRIDESCENCE_ENABLED\nColor_Q111=texture(_Iridescence_Texture_,Vec2_Q112);\n#else\nColor_Q111=vec4(0,0,0,0);\n#endif\nfloat X_Q74;float Y_Q74;float Z_Q74;To_XYZ_B74(HSV_Out_Q108,X_Q74,Y_Q74,Z_Q74);vec4 Result_Q131=_Rim_Intensity_*Color_Q129;vec4 Result_Q113=_Iridescence_Intensity_*Color_Q111;vec4 Color_Q73;From_HSV_B73(X_Q74,Y_Q74,Z_Q74,0.0,Color_Q73);vec4 Result_Q84=Result_Q91+(1.0-Result_Q91.a)*Color_Q73;vec4 Result_Q121;Fragment_Main_B121(_Sun_Intensity_,_Sun_Theta_,_Sun_Phi_,New_Normal_Q79,Result_Q84,MaxAB_Q123,_Shininess_,Incident_Q39,_Horizon_Color_,_Sky_Color_,_Ground_Color_,_Indirect_Diffuse_,_Specular_,_Horizon_Power_,_Reflection_,Sum_Q48,Sum_Q49,_Sharpness_,Result_Q77,_Subsurface_,vec4(0,0,0,0),Result_Q131,Result_Q113,Result_Q121);vec4 Result_Q59;Scale_RGB_B59(Result_Q121,MinAB_Q58,Result_Q59);vec4 sRGB_Q42;FastLinearTosRGB_B42(Result_Q59,sRGB_Q42);vec4 Result_Q31=Blob_Color_Q30+(1.0-Blob_Color_Q30.a)*sRGB_Q42;vec4 Result_Q40=Result_Q31; Result_Q40.a=1.0;vec4 Out_Color=Result_Q40;float Clip_Threshold=0.001;bool To_sRGB=false;gl_FragColor=Out_Color;}";h.ShaderStore.ShadersStore.mrdlSliderBarVertexShader="uniform mat4 world;uniform mat4 viewProjection;uniform vec3 cameraPosition;attribute vec3 position;attribute vec3 normal;attribute vec2 uv;\n#ifdef TANGENT\nattribute vec3 tangent;\n#else\nconst vec3 tangent=vec3(0.);\n#endif\nuniform float _Radius_;uniform float _Bevel_Front_;uniform float _Bevel_Front_Stretch_;uniform float _Bevel_Back_;uniform float _Bevel_Back_Stretch_;uniform float _Radius_Top_Left_;uniform float _Radius_Top_Right_;uniform float _Radius_Bottom_Left_;uniform float _Radius_Bottom_Right_;uniform bool _Bulge_Enabled_;uniform float _Bulge_Height_;uniform float _Bulge_Radius_;uniform float _Sun_Intensity_;uniform float _Sun_Theta_;uniform float _Sun_Phi_;uniform float _Indirect_Diffuse_;uniform vec4 _Albedo_;uniform float _Specular_;uniform float _Shininess_;uniform float _Sharpness_;uniform float _Subsurface_;uniform vec4 _Left_Color_;uniform vec4 _Right_Color_;uniform float _Reflection_;uniform float _Front_Reflect_;uniform float _Edge_Reflect_;uniform float _Power_;uniform vec4 _Sky_Color_;uniform vec4 _Horizon_Color_;uniform vec4 _Ground_Color_;uniform float _Horizon_Power_;uniform sampler2D _Reflection_Map_;uniform sampler2D _Indirect_Environment_;uniform float _Width_;uniform float _Fuzz_;uniform float _Min_Fuzz_;uniform float _Clip_Fade_;uniform float _Hue_Shift_;uniform float _Saturation_Shift_;uniform float _Value_Shift_;uniform vec3 _Blob_Position_;uniform float _Blob_Intensity_;uniform float _Blob_Near_Size_;uniform float _Blob_Far_Size_;uniform float _Blob_Near_Distance_;uniform float _Blob_Far_Distance_;uniform float _Blob_Fade_Length_;uniform float _Blob_Pulse_;uniform float _Blob_Fade_;uniform sampler2D _Blob_Texture_;uniform vec3 _Blob_Position_2_;uniform float _Blob_Near_Size_2_;uniform float _Blob_Pulse_2_;uniform float _Blob_Fade_2_;uniform vec3 _Left_Index_Pos_;uniform vec3 _Right_Index_Pos_;uniform vec3 _Left_Index_Middle_Pos_;uniform vec3 _Right_Index_Middle_Pos_;uniform sampler2D _Decal_;uniform vec2 _Decal_Scale_XY_;uniform bool _Decal_Front_Only_;uniform float _Rim_Intensity_;uniform sampler2D _Rim_Texture_;uniform float _Rim_Hue_Shift_;uniform float _Rim_Saturation_Shift_;uniform float _Rim_Value_Shift_;uniform float _Iridescence_Intensity_;uniform sampler2D _Iridescence_Texture_;uniform bool Use_Global_Left_Index;uniform bool Use_Global_Right_Index;uniform vec4 Global_Left_Index_Tip_Position;uniform vec4 Global_Right_Index_Tip_Position;uniform vec4 Global_Left_Thumb_Tip_Position;uniform vec4 Global_Right_Thumb_Tip_Position;uniform float Global_Left_Index_Tip_Proximity;uniform float Global_Right_Index_Tip_Proximity;varying vec3 vPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec3 vBinormal;varying vec4 vColor;varying vec4 vExtra1;varying vec4 vExtra2;varying vec4 vExtra3;void Object_To_World_Pos_B12(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{Pos_World=(world*vec4(Pos_Object,1.0)).xyz;}\nvoid Object_To_World_Normal_B32(\nvec3 Nrm_Object,\nout vec3 Nrm_World)\n{Nrm_World=(vec4(Nrm_Object,0.0)).xyz;}\nvoid Blob_Vertex_B23(\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,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{vec3 blob= (Use_Global_Left_Index ? Global_Left_Index_Tip_Position.xyz : Blob_Position);vec3 delta=blob-Position;float dist=dot(Normal,delta);float lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);float fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);float size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;vec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);float Fade=fadeValue*Intensity*Blob_Fade;float Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);Blob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);}\nvoid Blob_Vertex_B24(\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,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{vec3 blob= (Use_Global_Right_Index ? Global_Right_Index_Tip_Position.xyz : Blob_Position);vec3 delta=blob-Position;float dist=dot(Normal,delta);float lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);float fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);float size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;vec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);float Fade=fadeValue*Intensity*Blob_Fade;float Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);Blob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);}\nvoid Move_Verts_B130(\nfloat Anisotropy,\nvec3 P,\nfloat Radius,\nfloat Bevel,\nvec3 Normal_Object,\nfloat ScaleZ,\nfloat Stretch,\nout vec3 New_P,\nout vec2 New_UV,\nout float Radial_Gradient,\nout vec3 Radial_Dir,\nout vec3 New_Normal)\n{vec2 UV=P.xy*2.0+0.5;vec2 center=clamp(UV,0.0,1.0);vec2 delta=UV-center;float deltad=(length(delta)*2.0);float f=(Bevel+(Radius-Bevel)*Stretch)/Radius;float innerd=clamp(deltad*2.0,0.0,1.0);float outerd=clamp(deltad*2.0-1.0,0.0,1.0);float bevelAngle=outerd*3.14159*0.5;float sinb=sin(bevelAngle);float cosb=cos(bevelAngle);float beveld=(1.0-f)*innerd+f*sinb;float br=outerd;vec2 r2=2.0*vec2(Radius/Anisotropy,Radius);float dir=P.z<0.0001 ? 1.0 : -1.0;New_UV=center+r2*((0.5-center)+normalize(delta+vec2(0.0,0.000001))*beveld*0.5);New_P=vec3(New_UV-0.5,P.z+dir*(1.0-cosb)*Bevel*ScaleZ);Radial_Gradient=clamp((deltad-0.5)*2.0,0.0,1.0);Radial_Dir=vec3(delta*r2,0.0);vec3 beveledNormal=cosb*Normal_Object+sinb*vec3(delta.x,delta.y,0.0);New_Normal=Normal_Object.z==0.0 ? Normal_Object : beveledNormal;}\nvoid Object_To_World_Dir_B60(\nvec3 Dir_Object,\nout vec3 Normal_World,\nout vec3 Normal_World_N,\nout float Normal_Length)\n{Normal_World=(world*vec4(Dir_Object,0.0)).xyz;Normal_Length=length(Normal_World);Normal_World_N=Normal_World/Normal_Length;}\nvoid To_XYZ_B78(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{X=Vec3.x;Y=Vec3.y;Z=Vec3.z;}\nvoid Conditional_Float_B93(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{Result=Which ? If_True : If_False;}\nvoid Object_To_World_Dir_B28(\nvec3 Dir_Object,\nout vec3 Binormal_World,\nout vec3 Binormal_World_N,\nout float Binormal_Length)\n{Binormal_World=(world*vec4(Dir_Object,0.0)).xyz;Binormal_Length=length(Binormal_World);Binormal_World_N=Binormal_World/Binormal_Length;}\nvoid Pick_Radius_B69(\nfloat Radius,\nfloat Radius_Top_Left,\nfloat Radius_Top_Right,\nfloat Radius_Bottom_Left,\nfloat Radius_Bottom_Right,\nvec3 Position,\nout float Result)\n{bool whichY=Position.y>0.0;Result=Position.x<0.0 ? (whichY ? Radius_Top_Left : Radius_Bottom_Left) : (whichY ? Radius_Top_Right : Radius_Bottom_Right);Result*=Radius;}\nvoid Conditional_Float_B36(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{Result=Which ? If_True : If_False;}\nvoid Greater_Than_B37(\nfloat Left,\nfloat Right,\nout bool Not_Greater_Than,\nout bool Greater_Than)\n{Greater_Than=Left>Right;Not_Greater_Than=!Greater_Than;}\nvoid Remap_Range_B105(\nfloat In_Min,\nfloat In_Max,\nfloat Out_Min,\nfloat Out_Max,\nfloat In,\nout float Out)\n{Out=mix(Out_Min,Out_Max,clamp((In-In_Min)/(In_Max-In_Min),0.0,1.0));}\nvoid main()\n{vec2 XY_Q85;XY_Q85=(uv-vec2(0.5,0.5))*_Decal_Scale_XY_+vec2(0.5,0.5);vec3 Tangent_World_Q27;vec3 Tangent_World_N_Q27;float Tangent_Length_Q27;Tangent_World_Q27=(world*vec4(vec3(1,0,0),0.0)).xyz;Tangent_Length_Q27=length(Tangent_World_Q27);Tangent_World_N_Q27=Tangent_World_Q27/Tangent_Length_Q27;vec3 Normal_World_Q60;vec3 Normal_World_N_Q60;float Normal_Length_Q60;Object_To_World_Dir_B60(vec3(0,0,1),Normal_World_Q60,Normal_World_N_Q60,Normal_Length_Q60);float X_Q78;float Y_Q78;float Z_Q78;To_XYZ_B78(position,X_Q78,Y_Q78,Z_Q78);vec3 Nrm_World_Q26;Nrm_World_Q26=normalize((world*vec4(normal,0.0)).xyz);vec3 Binormal_World_Q28;vec3 Binormal_World_N_Q28;float Binormal_Length_Q28;Object_To_World_Dir_B28(vec3(0,1,0),Binormal_World_Q28,Binormal_World_N_Q28,Binormal_Length_Q28);float Anisotropy_Q29=Tangent_Length_Q27/Binormal_Length_Q28;float Result_Q69;Pick_Radius_B69(_Radius_,_Radius_Top_Left_,_Radius_Top_Right_,_Radius_Bottom_Left_,_Radius_Bottom_Right_,position,Result_Q69);float Anisotropy_Q53=Binormal_Length_Q28/Normal_Length_Q60;bool Not_Greater_Than_Q37;bool Greater_Than_Q37;Greater_Than_B37(Z_Q78,0.0,Not_Greater_Than_Q37,Greater_Than_Q37);vec4 Linear_Q101;Linear_Q101.rgb=clamp(_Left_Color_.rgb*_Left_Color_.rgb,0.0,1.0);Linear_Q101.a=_Left_Color_.a;vec4 Linear_Q102;Linear_Q102.rgb=clamp(_Right_Color_.rgb*_Right_Color_.rgb,0.0,1.0);Linear_Q102.a=_Right_Color_.a;vec3 Difference_Q61=vec3(0,0,0)-Normal_World_N_Q60;vec4 Out_Color_Q34=vec4(X_Q78,Y_Q78,Z_Q78,1);float Result_Q36;Conditional_Float_B36(Greater_Than_Q37,_Bevel_Back_,_Bevel_Front_,Result_Q36);float Result_Q94;Conditional_Float_B36(Greater_Than_Q37,_Bevel_Back_Stretch_,_Bevel_Front_Stretch_,Result_Q94);vec3 New_P_Q130;vec2 New_UV_Q130;float Radial_Gradient_Q130;vec3 Radial_Dir_Q130;vec3 New_Normal_Q130;Move_Verts_B130(Anisotropy_Q29,position,Result_Q69,Result_Q36,normal,Anisotropy_Q53,Result_Q94,New_P_Q130,New_UV_Q130,Radial_Gradient_Q130,Radial_Dir_Q130,New_Normal_Q130);float X_Q98;float Y_Q98;X_Q98=New_UV_Q130.x;Y_Q98=New_UV_Q130.y;vec3 Pos_World_Q12;Object_To_World_Pos_B12(New_P_Q130,Pos_World_Q12);vec3 Nrm_World_Q32;Object_To_World_Normal_B32(New_Normal_Q130,Nrm_World_Q32);vec4 Blob_Info_Q23;\n#if BLOB_ENABLE\nBlob_Vertex_B23(Pos_World_Q12,Nrm_World_Q26,Tangent_World_N_Q27,Binormal_World_N_Q28,_Blob_Position_,_Blob_Intensity_,_Blob_Near_Size_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_,_Blob_Fade_,Blob_Info_Q23);\n#else\nBlob_Info_Q23=vec4(0,0,0,0);\n#endif\nvec4 Blob_Info_Q24;\n#if BLOB_ENABLE_2\nBlob_Vertex_B24(Pos_World_Q12,Nrm_World_Q26,Tangent_World_N_Q27,Binormal_World_N_Q28,_Blob_Position_2_,_Blob_Intensity_,_Blob_Near_Size_2_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_2_,_Blob_Fade_2_,Blob_Info_Q24);\n#else\nBlob_Info_Q24=vec4(0,0,0,0);\n#endif\nfloat Out_Q105;Remap_Range_B105(0.0,1.0,0.0,1.0,X_Q98,Out_Q105);float X_Q86;float Y_Q86;float Z_Q86;To_XYZ_B78(Nrm_World_Q32,X_Q86,Y_Q86,Z_Q86);vec4 Color_At_T_Q97=mix(Linear_Q101,Linear_Q102,Out_Q105);float Minus_F_Q87=-Z_Q86;float R_Q99;float G_Q99;float B_Q99;float A_Q99;R_Q99=Color_At_T_Q97.r; G_Q99=Color_At_T_Q97.g; B_Q99=Color_At_T_Q97.b; A_Q99=Color_At_T_Q97.a;float ClampF_Q88=clamp(0.0,Minus_F_Q87,1.0);float Result_Q93;Conditional_Float_B93(_Decal_Front_Only_,ClampF_Q88,1.0,Result_Q93);vec4 Vec4_Q89=vec4(Result_Q93,Radial_Gradient_Q130,G_Q99,B_Q99);vec3 Position=Pos_World_Q12;vec3 Normal=Nrm_World_Q32;vec2 UV=XY_Q85;vec3 Tangent=Tangent_World_N_Q27;vec3 Binormal=Difference_Q61;vec4 Color=Out_Color_Q34;vec4 Extra1=Vec4_Q89;vec4 Extra2=Blob_Info_Q23;vec4 Extra3=Blob_Info_Q24;gl_Position=viewProjection*vec4(Position,1);vPosition=Position;vNormal=Normal;vUV=UV;vTangent=Tangent;vBinormal=Binormal;vColor=Color;vExtra1=Extra1;vExtra2=Extra2;vExtra3=Extra3;}";var Gt=function(t){function e(){var e=t.call(this)||this;return e.SKY_ENABLED=!0,e.BLOB_ENABLE_2=!0,e.IRIDESCENCE_ENABLED=!0,e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return n(e,t),e}(h.MaterialDefines),Ut=function(t){function e(i,o){var r=t.call(this,i,o)||this;return r.radius=.6,r.bevelFront=.6,r.bevelFrontStretch=.077,r.bevelBack=0,r.bevelBackStretch=0,r.radiusTopLeft=1,r.radiusTopRight=1,r.radiusBottomLeft=1,r.radiusBottomRight=1,r.bulgeEnabled=!1,r.bulgeHeight=-.323,r.bulgeRadius=.73,r.sunIntensity=1.102,r.sunTheta=.76,r.sunPhi=.526,r.indirectDiffuse=.658,r.albedo=new h.Color4(.0117647,.505882,.996078,1),r.specular=0,r.shininess=10,r.sharpness=0,r.subsurface=0,r.leftGradientColor=new h.Color4(.0117647,.505882,.996078,1),r.rightGradientColor=new h.Color4(.0117647,.505882,.996078,1),r.reflection=.749,r.frontReflect=0,r.edgeReflect=.09,r.power=8.13,r.skyColor=new h.Color4(.0117647,.964706,.996078,1),r.horizonColor=new h.Color4(.0117647,.333333,.996078,1),r.groundColor=new h.Color4(0,.254902,.996078,1),r.horizonPower=1,r.width=.02,r.fuzz=.5,r.minFuzz=.001,r.clipFade=.01,r.hueShift=0,r.saturationShift=0,r.valueShift=0,r.blobPosition=new h.Vector3(0,0,.1),r.blobIntensity=.5,r.blobNearSize=.01,r.blobFarSize=.03,r.blobNearDistance=0,r.blobFarDistance=.08,r.blobFadeLength=.576,r.blobPulse=0,r.blobFade=1,r.blobPosition2=new h.Vector3(.2,0,.1),r.blobNearSize2=.01,r.blobPulse2=0,r.blobFade2=1,r.blobTexture=new h.Texture("",r.getScene()),r.leftIndexPosition=new h.Vector3(0,0,1),r.rightIndexPosition=new h.Vector3(-1,-1,-1),r.leftIndexMiddlePosition=new h.Vector3(0,0,0),r.rightIndexMiddlePosition=new h.Vector3(0,0,0),r.decalScaleXY=new h.Vector2(1.5,1.5),r.decalFrontOnly=!0,r.rimIntensity=.287,r.rimHueShift=0,r.rimSaturationShift=0,r.rimValueShift=-1,r.iridescenceIntensity=0,r.useGlobalLeftIndex=1,r.useGlobalRightIndex=1,r.globalLeftIndexTipProximity=0,r.globalRightIndexTipProximity=0,r.globalLeftIndexTipPosition=new h.Vector4(.5,0,-.55,1),r.globaRightIndexTipPosition=new h.Vector4(0,0,0,1),r.globalLeftThumbTipPosition=new h.Vector4(.5,0,-.55,1),r.globalRightThumbTipPosition=new h.Vector4(0,0,0,1),r.globalLeftIndexMiddlePosition=new h.Vector4(.5,0,-.55,1),r.globalRightIndexMiddlePosition=new h.Vector4(0,0,0,1),r.alphaMode=h.Constants.ALPHA_DISABLE,r.backFaceCulling=!1,r._blueGradientTexture=new h.Texture(e.BLUE_GRADIENT_TEXTURE_URL,r.getScene(),!0,!1,h.Texture.NEAREST_SAMPLINGMODE),r._decalTexture=new h.Texture("",r.getScene()),r._reflectionMapTexture=new h.Texture("",r.getScene()),r._indirectEnvTexture=new h.Texture("",r.getScene()),r}return n(e,t),e.prototype.needAlphaBlending=function(){return!1},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){var i=e._drawWrapper;if(this.isFrozen&&i.effect&&i._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new Gt);var o=e.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=r.getEngine();if((0,h.PrepareDefinesForAttributes)(t,o,!1,!1),o.isDirty){o.markAsProcessed(),r.resetCachedMaterial();var a=new h.EffectFallbacks;o.FOG&&a.addFallback(1,"FOG"),(0,h.HandleFallbacksForShadows)(o,a),o.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess;var s=[h.VertexBuffer.PositionKind];o.NORMAL&&s.push(h.VertexBuffer.NormalKind),o.UV1&&s.push(h.VertexBuffer.UVKind),o.UV2&&s.push(h.VertexBuffer.UV2Kind),o.VERTEXCOLOR&&s.push(h.VertexBuffer.ColorKind),o.TANGENT&&s.push(h.VertexBuffer.TangentKind),(0,h.PrepareAttributesForInstances)(s,o);var l=o.toString(),_=["world","viewProjection","cameraPosition","_Radius_","_Bevel_Front_","_Bevel_Front_Stretch_","_Bevel_Back_","_Bevel_Back_Stretch_","_Radius_Top_Left_","_Radius_Top_Right_","_Radius_Bottom_Left_","_Radius_Bottom_Right_","_Bulge_Enabled_","_Bulge_Height_","_Bulge_Radius_","_Sun_Intensity_","_Sun_Theta_","_Sun_Phi_","_Indirect_Diffuse_","_Albedo_","_Specular_","_Shininess_","_Sharpness_","_Subsurface_","_Left_Color_","_Right_Color_","_Reflection_","_Front_Reflect_","_Edge_Reflect_","_Power_","_Sky_Color_","_Horizon_Color_","_Ground_Color_","_Horizon_Power_","_Reflection_Map_","_Indirect_Environment_","_Width_","_Fuzz_","_Min_Fuzz_","_Clip_Fade_","_Hue_Shift_","_Saturation_Shift_","_Value_Shift_","_Blob_Position_","_Blob_Intensity_","_Blob_Near_Size_","_Blob_Far_Size_","_Blob_Near_Distance_","_Blob_Far_Distance_","_Blob_Fade_Length_","_Blob_Pulse_","_Blob_Fade_","_Blob_Texture_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Left_Index_Pos_","_Right_Index_Pos_","_Left_Index_Middle_Pos_","_Right_Index_Middle_Pos_","_Decal_","_Decal_Scale_XY_","_Decal_Front_Only_","_Rim_Intensity_","_Rim_Texture_","_Rim_Hue_Shift_","_Rim_Saturation_Shift_","_Rim_Value_Shift_","_Iridescence_Intensity_","_Iridescence_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_Middle_Position;","Global_Right_Index_Middle_Position","Global_Left_Index_Tip_Proximity","Global_Right_Index_Tip_Proximity"],c=["_Rim_Texture_","_Iridescence_Texture_"],u=[];(0,h.PrepareUniformsAndSamplersList)({uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:o,maxSimultaneousLights:4}),e.setEffect(r.getEngine().createEffect("mrdlSliderBar",{attributes:s,uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:l,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),o,this._materialContext)}return!(!e.effect||!e.effect.isReady()||(o._renderId=r.getRenderId(),i._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){if(i.materialDefines){var o=i.effect;o&&(this._activeEffect=o,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",this.getScene().activeCamera.position),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Bevel_Front_",this.bevelFront),this._activeEffect.setFloat("_Bevel_Front_Stretch_",this.bevelFrontStretch),this._activeEffect.setFloat("_Bevel_Back_",this.bevelBack),this._activeEffect.setFloat("_Bevel_Back_Stretch_",this.bevelBackStretch),this._activeEffect.setFloat("_Radius_Top_Left_",this.radiusTopLeft),this._activeEffect.setFloat("_Radius_Top_Right_",this.radiusTopRight),this._activeEffect.setFloat("_Radius_Bottom_Left_",this.radiusBottomLeft),this._activeEffect.setFloat("_Radius_Bottom_Right_",this.radiusBottomRight),this._activeEffect.setFloat("_Bulge_Enabled_",this.bulgeEnabled?1:0),this._activeEffect.setFloat("_Bulge_Height_",this.bulgeHeight),this._activeEffect.setFloat("_Bulge_Radius_",this.bulgeRadius),this._activeEffect.setFloat("_Sun_Intensity_",this.sunIntensity),this._activeEffect.setFloat("_Sun_Theta_",this.sunTheta),this._activeEffect.setFloat("_Sun_Phi_",this.sunPhi),this._activeEffect.setFloat("_Indirect_Diffuse_",this.indirectDiffuse),this._activeEffect.setDirectColor4("_Albedo_",this.albedo),this._activeEffect.setFloat("_Specular_",this.specular),this._activeEffect.setFloat("_Shininess_",this.shininess),this._activeEffect.setFloat("_Sharpness_",this.sharpness),this._activeEffect.setFloat("_Subsurface_",this.subsurface),this._activeEffect.setDirectColor4("_Left_Color_",this.leftGradientColor),this._activeEffect.setDirectColor4("_Right_Color_",this.rightGradientColor),this._activeEffect.setFloat("_Reflection_",this.reflection),this._activeEffect.setFloat("_Front_Reflect_",this.frontReflect),this._activeEffect.setFloat("_Edge_Reflect_",this.edgeReflect),this._activeEffect.setFloat("_Power_",this.power),this._activeEffect.setDirectColor4("_Sky_Color_",this.skyColor),this._activeEffect.setDirectColor4("_Horizon_Color_",this.horizonColor),this._activeEffect.setDirectColor4("_Ground_Color_",this.groundColor),this._activeEffect.setFloat("_Horizon_Power_",this.horizonPower),this._activeEffect.setTexture("_Reflection_Map_",this._reflectionMapTexture),this._activeEffect.setTexture("_Indirect_Environment_",this._indirectEnvTexture),this._activeEffect.setFloat("_Width_",this.width),this._activeEffect.setFloat("_Fuzz_",this.fuzz),this._activeEffect.setFloat("_Min_Fuzz_",this.minFuzz),this._activeEffect.setFloat("_Clip_Fade_",this.clipFade),this._activeEffect.setFloat("_Hue_Shift_",this.hueShift),this._activeEffect.setFloat("_Saturation_Shift_",this.saturationShift),this._activeEffect.setFloat("_Value_Shift_",this.valueShift),this._activeEffect.setVector3("_Blob_Position_",this.blobPosition),this._activeEffect.setFloat("_Blob_Intensity_",this.blobIntensity),this._activeEffect.setFloat("_Blob_Near_Size_",this.blobNearSize),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_Pulse_",this.blobPulse),this._activeEffect.setFloat("_Blob_Fade_",this.blobFade),this._activeEffect.setTexture("_Blob_Texture_",this.blobTexture),this._activeEffect.setVector3("_Blob_Position_2_",this.blobPosition2),this._activeEffect.setFloat("_Blob_Near_Size_2_",this.blobNearSize2),this._activeEffect.setFloat("_Blob_Pulse_2_",this.blobPulse2),this._activeEffect.setFloat("_Blob_Fade_2_",this.blobFade2),this._activeEffect.setVector3("_Left_Index_Pos_",this.leftIndexPosition),this._activeEffect.setVector3("_Right_Index_Pos_",this.rightIndexPosition),this._activeEffect.setVector3("_Left_Index_Middle_Pos_",this.leftIndexMiddlePosition),this._activeEffect.setVector3("_Right_Index_Middle_Pos_",this.rightIndexMiddlePosition),this._activeEffect.setTexture("_Decal_",this._decalTexture),this._activeEffect.setVector2("_Decal_Scale_XY_",this.decalScaleXY),this._activeEffect.setFloat("_Decal_Front_Only_",this.decalFrontOnly?1:0),this._activeEffect.setFloat("_Rim_Intensity_",this.rimIntensity),this._activeEffect.setTexture("_Rim_Texture_",this._blueGradientTexture),this._activeEffect.setFloat("_Rim_Hue_Shift_",this.rimHueShift),this._activeEffect.setFloat("_Rim_Saturation_Shift_",this.rimSaturationShift),this._activeEffect.setFloat("_Rim_Value_Shift_",this.rimValueShift),this._activeEffect.setFloat("_Iridescence_Intensity_",this.iridescenceIntensity),this._activeEffect.setTexture("_Iridescence_Texture_",this._blueGradientTexture),this._activeEffect.setFloat("Use_Global_Left_Index",this.useGlobalLeftIndex),this._activeEffect.setFloat("Use_Global_Right_Index",this.useGlobalRightIndex),this._activeEffect.setVector4("Global_Left_Index_Tip_Position",this.globalLeftIndexTipPosition),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",this.globaRightIndexTipPosition),this._activeEffect.setVector4("Global_Left_Thumb_Tip_Position",this.globalLeftThumbTipPosition),this._activeEffect.setVector4("Global_Right_Thumb_Tip_Position",this.globalRightThumbTipPosition),this._activeEffect.setVector4("Global_Left_Index_Middle_Position",this.globalLeftIndexMiddlePosition),this._activeEffect.setVector4("Global_Right_Index_Middle_Position",this.globalRightIndexMiddlePosition),this._activeEffect.setFloat("Global_Left_Index_Tip_Proximity",this.globalLeftIndexTipProximity),this._activeEffect.setFloat("Global_Right_Index_Tip_Proximity",this.globalRightIndexTipProximity),this._afterBind(e,this._activeEffect,i))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),this._reflectionMapTexture.dispose(),this._indirectEnvTexture.dispose(),this._blueGradientTexture.dispose(),this._decalTexture.dispose()},e.prototype.clone=function(t){var i=this;return h.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.MRDLSliderBarMaterial",e},e.prototype.getClassName=function(){return"MRDLSliderBarMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.BLUE_GRADIENT_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/MRDL/mrtk-mrdl-blue-gradient.png",s([(0,h.serialize)()],e.prototype,"radius",void 0),s([(0,h.serialize)()],e.prototype,"bevelFront",void 0),s([(0,h.serialize)()],e.prototype,"bevelFrontStretch",void 0),s([(0,h.serialize)()],e.prototype,"bevelBack",void 0),s([(0,h.serialize)()],e.prototype,"bevelBackStretch",void 0),s([(0,h.serialize)()],e.prototype,"radiusTopLeft",void 0),s([(0,h.serialize)()],e.prototype,"radiusTopRight",void 0),s([(0,h.serialize)()],e.prototype,"radiusBottomLeft",void 0),s([(0,h.serialize)()],e.prototype,"radiusBottomRight",void 0),s([(0,h.serialize)()],e.prototype,"bulgeEnabled",void 0),s([(0,h.serialize)()],e.prototype,"bulgeHeight",void 0),s([(0,h.serialize)()],e.prototype,"bulgeRadius",void 0),s([(0,h.serialize)()],e.prototype,"sunIntensity",void 0),s([(0,h.serialize)()],e.prototype,"sunTheta",void 0),s([(0,h.serialize)()],e.prototype,"sunPhi",void 0),s([(0,h.serialize)()],e.prototype,"indirectDiffuse",void 0),s([(0,h.serialize)()],e.prototype,"albedo",void 0),s([(0,h.serialize)()],e.prototype,"specular",void 0),s([(0,h.serialize)()],e.prototype,"shininess",void 0),s([(0,h.serialize)()],e.prototype,"sharpness",void 0),s([(0,h.serialize)()],e.prototype,"subsurface",void 0),s([(0,h.serialize)()],e.prototype,"leftGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"rightGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"reflection",void 0),s([(0,h.serialize)()],e.prototype,"frontReflect",void 0),s([(0,h.serialize)()],e.prototype,"edgeReflect",void 0),s([(0,h.serialize)()],e.prototype,"power",void 0),s([(0,h.serialize)()],e.prototype,"skyColor",void 0),s([(0,h.serialize)()],e.prototype,"horizonColor",void 0),s([(0,h.serialize)()],e.prototype,"groundColor",void 0),s([(0,h.serialize)()],e.prototype,"horizonPower",void 0),s([(0,h.serialize)()],e.prototype,"width",void 0),s([(0,h.serialize)()],e.prototype,"fuzz",void 0),s([(0,h.serialize)()],e.prototype,"minFuzz",void 0),s([(0,h.serialize)()],e.prototype,"clipFade",void 0),s([(0,h.serialize)()],e.prototype,"hueShift",void 0),s([(0,h.serialize)()],e.prototype,"saturationShift",void 0),s([(0,h.serialize)()],e.prototype,"valueShift",void 0),s([(0,h.serialize)()],e.prototype,"blobPosition",void 0),s([(0,h.serialize)()],e.prototype,"blobIntensity",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize",void 0),s([(0,h.serialize)()],e.prototype,"blobFarSize",void 0),s([(0,h.serialize)()],e.prototype,"blobNearDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFarDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFadeLength",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse",void 0),s([(0,h.serialize)()],e.prototype,"blobFade",void 0),s([(0,h.serialize)()],e.prototype,"blobPosition2",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize2",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse2",void 0),s([(0,h.serialize)()],e.prototype,"blobFade2",void 0),s([(0,h.serialize)()],e.prototype,"blobTexture",void 0),s([(0,h.serialize)()],e.prototype,"leftIndexPosition",void 0),s([(0,h.serialize)()],e.prototype,"rightIndexPosition",void 0),s([(0,h.serialize)()],e.prototype,"leftIndexMiddlePosition",void 0),s([(0,h.serialize)()],e.prototype,"rightIndexMiddlePosition",void 0),s([(0,h.serialize)()],e.prototype,"decalScaleXY",void 0),s([(0,h.serialize)()],e.prototype,"decalFrontOnly",void 0),s([(0,h.serialize)()],e.prototype,"rimIntensity",void 0),s([(0,h.serialize)()],e.prototype,"rimHueShift",void 0),s([(0,h.serialize)()],e.prototype,"rimSaturationShift",void 0),s([(0,h.serialize)()],e.prototype,"rimValueShift",void 0),s([(0,h.serialize)()],e.prototype,"iridescenceIntensity",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.MRDLSliderBarMaterial",Ut);h.ShaderStore.ShadersStore.mrdlSliderThumbPixelShader="uniform vec3 cameraPosition;varying vec3 vPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec3 vBinormal;varying vec4 vColor;varying vec4 vExtra1;varying vec4 vExtra2;varying vec4 vExtra3;uniform float _Radius_;uniform float _Bevel_Front_;uniform float _Bevel_Front_Stretch_;uniform float _Bevel_Back_;uniform float _Bevel_Back_Stretch_;uniform float _Radius_Top_Left_;uniform float _Radius_Top_Right_;uniform float _Radius_Bottom_Left_;uniform float _Radius_Bottom_Right_;uniform bool _Bulge_Enabled_;uniform float _Bulge_Height_;uniform float _Bulge_Radius_;uniform float _Sun_Intensity_;uniform float _Sun_Theta_;uniform float _Sun_Phi_;uniform float _Indirect_Diffuse_;uniform vec4 _Albedo_;uniform float _Specular_;uniform float _Shininess_;uniform float _Sharpness_;uniform float _Subsurface_;uniform vec4 _Left_Color_;uniform vec4 _Right_Color_;uniform float _Reflection_;uniform float _Front_Reflect_;uniform float _Edge_Reflect_;uniform float _Power_;uniform vec4 _Sky_Color_;uniform vec4 _Horizon_Color_;uniform vec4 _Ground_Color_;uniform float _Horizon_Power_;uniform sampler2D _Reflection_Map_;uniform sampler2D _Indirect_Environment_;uniform float _Width_;uniform float _Fuzz_;uniform float _Min_Fuzz_;uniform float _Clip_Fade_;uniform float _Hue_Shift_;uniform float _Saturation_Shift_;uniform float _Value_Shift_;uniform vec3 _Blob_Position_;uniform float _Blob_Intensity_;uniform float _Blob_Near_Size_;uniform float _Blob_Far_Size_;uniform float _Blob_Near_Distance_;uniform float _Blob_Far_Distance_;uniform float _Blob_Fade_Length_;uniform float _Blob_Pulse_;uniform float _Blob_Fade_;uniform sampler2D _Blob_Texture_;uniform vec3 _Blob_Position_2_;uniform float _Blob_Near_Size_2_;uniform float _Blob_Pulse_2_;uniform float _Blob_Fade_2_;uniform vec3 _Left_Index_Pos_;uniform vec3 _Right_Index_Pos_;uniform vec3 _Left_Index_Middle_Pos_;uniform vec3 _Right_Index_Middle_Pos_;uniform sampler2D _Decal_;uniform vec2 _Decal_Scale_XY_;uniform bool _Decal_Front_Only_;uniform float _Rim_Intensity_;uniform sampler2D _Rim_Texture_;uniform float _Rim_Hue_Shift_;uniform float _Rim_Saturation_Shift_;uniform float _Rim_Value_Shift_;uniform float _Iridescence_Intensity_;uniform sampler2D _Iridescence_Texture_;uniform bool Use_Global_Left_Index;uniform bool Use_Global_Right_Index;uniform vec4 Global_Left_Index_Tip_Position;uniform vec4 Global_Right_Index_Tip_Position;uniform vec4 Global_Left_Thumb_Tip_Position;uniform vec4 Global_Right_Thumb_Tip_Position;uniform vec4 Global_Left_Index_Middle_Position;uniform vec4 Global_Right_Index_Middle_Position;uniform float Global_Left_Index_Tip_Proximity;uniform float Global_Right_Index_Tip_Proximity;void Blob_Fragment_B180(\nsampler2D Blob_Texture,\nvec4 Blob_Info1,\nvec4 Blob_Info2,\nout vec4 Blob_Color)\n{float k1=dot(Blob_Info1.xy,Blob_Info1.xy);float k2=dot(Blob_Info2.xy,Blob_Info2.xy);vec3 closer=k1<k2 ? vec3(k1,Blob_Info1.z,Blob_Info1.w) : vec3(k2,Blob_Info2.z,Blob_Info2.w);Blob_Color=closer.z*texture(Blob_Texture,vec2(vec2(sqrt(closer.x),closer.y).x,1.0-vec2(sqrt(closer.x),closer.y).y))*clamp(1.0-closer.x,0.0,1.0);}\nvoid FastLinearTosRGB_B192(\nvec4 Linear,\nout vec4 sRGB)\n{sRGB.rgb=sqrt(clamp(Linear.rgb,0.0,1.0));sRGB.a=Linear.a;}\nvoid Scale_RGB_B209(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{Result=vec4(Scalar,Scalar,Scalar,1)*Color;}\nvoid Fragment_Main_B271(\nfloat Sun_Intensity,\nfloat Sun_Theta,\nfloat Sun_Phi,\nvec3 Normal,\nvec4 Albedo,\nfloat Fresnel_Reflect,\nfloat Shininess,\nvec3 Incident,\nvec4 Horizon_Color,\nvec4 Sky_Color,\nvec4 Ground_Color,\nfloat Indirect_Diffuse,\nfloat Specular,\nfloat Horizon_Power,\nfloat Reflection,\nvec4 Reflection_Sample,\nvec4 Indirect_Sample,\nfloat Sharpness,\nfloat SSS,\nfloat Subsurface,\nvec4 Translucence,\nvec4 Rim_Light,\nvec4 Iridescence,\nout vec4 Result)\n{float theta=Sun_Theta*2.0*3.14159;float phi=Sun_Phi*3.14159;vec3 lightDir= vec3(cos(phi)*cos(theta),sin(phi),cos(phi)*sin(theta));float NdotL=max(dot(lightDir,Normal),0.0);vec3 R=reflect(Incident,Normal);float RdotL=max(0.0,dot(R,lightDir));float specular=pow(RdotL,Shininess);specular=mix(specular,smoothstep(0.495*Sharpness,1.0-0.495*Sharpness,specular),Sharpness);vec4 gi=mix(Ground_Color,Sky_Color,Normal.y*0.5+0.5);Result=((Sun_Intensity*NdotL+Indirect_Sample*Indirect_Diffuse+Translucence)*(1.0+SSS*Subsurface))*Albedo*(1.0-Fresnel_Reflect)+(Sun_Intensity*specular*Specular+Fresnel_Reflect*Reflection*Reflection_Sample)+Fresnel_Reflect*Rim_Light+Iridescence;}\nvoid Bulge_B229(\nbool Enabled,\nvec3 Normal,\nvec3 Tangent,\nfloat Bulge_Height,\nvec4 UV,\nfloat Bulge_Radius,\nvec3 ButtonN,\nout vec3 New_Normal)\n{vec2 xy=clamp(UV.xy*2.0,vec2(-1,-1),vec2(1,1));vec3 B=(cross(Normal,Tangent));float k=-clamp(1.0-length(xy)/Bulge_Radius,0.0,1.0)*Bulge_Height;k=sin(k*3.14159*0.5);k*=smoothstep(0.9998,0.9999,abs(dot(ButtonN,Normal)));New_Normal=Normal*sqrt(1.0-k*k)+(xy.x*Tangent+xy.y*B)*k;New_Normal=Enabled ? New_Normal : Normal;}\nvoid SSS_B227(\nvec3 ButtonN,\nvec3 Normal,\nvec3 Incident,\nout float Result)\n{float NdotI=abs(dot(Normal,Incident));float BdotI=abs(dot(ButtonN,Incident));Result=(abs(NdotI-BdotI)); }\nvoid FingerOcclusion_B217(\nfloat Width,\nfloat DistToCenter,\nfloat Fuzz,\nfloat Min_Fuzz,\nvec3 Position,\nvec3 Forward,\nvec3 Nearest,\nfloat Fade_Out,\nout float NotInShadow)\n{float d=dot((Nearest-Position),Forward);float sh=smoothstep(Width*0.5,Width*0.5+Fuzz*max(d,0.0)+Min_Fuzz,DistToCenter);NotInShadow=1.0-(1.0-sh)*smoothstep(-Fade_Out,0.0,d);}\nvoid FingerOcclusion_B218(\nfloat Width,\nfloat DistToCenter,\nfloat Fuzz,\nfloat Min_Fuzz,\nvec3 Position,\nvec3 Forward,\nvec3 Nearest,\nfloat Fade_Out,\nout float NotInShadow)\n{float d=dot((Nearest-Position),Forward);float sh=smoothstep(Width*0.5,Width*0.5+Fuzz*max(d,0.0)+Min_Fuzz,DistToCenter);NotInShadow=1.0-(1.0-sh)*smoothstep(-Fade_Out,0.0,d);}\nvoid Scale_Color_B241(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{Result=Scalar*Color;}\nvoid From_HSV_B223(\nfloat Hue,\nfloat Saturation,\nfloat Value,\nfloat Alpha,\nout vec4 Color)\n{vec4 K=vec4(1.0,2.0/3.0,1.0/3.0,3.0);vec3 p=abs(fract(vec3(Hue,Hue,Hue)+K.xyz)*6.0-K.www);Color.rgb=Value*mix(K.xxx,clamp(p-K.xxx,0.0,1.0),Saturation);Color.a=Alpha;}\nvoid Fast_Fresnel_B272(\nfloat Front_Reflect,\nfloat Edge_Reflect,\nfloat Power,\nvec3 Normal,\nvec3 Incident,\nout float Transmit,\nout float Reflect)\n{float d=max(-dot(Incident,Normal),0.0);Reflect=Front_Reflect+(Edge_Reflect-Front_Reflect)*pow(1.0-d,Power);Transmit=1.0-Reflect;}\nvoid Mapped_Environment_B201(\nsampler2D Reflected_Environment,\nsampler2D Indirect_Environment,\nvec3 Dir,\nout vec4 Reflected_Color,\nout vec4 Indirect_Diffuse)\n{Reflected_Color=texture(Reflected_Environment,vec2(atan(Dir.z,Dir.x)/3.14159*0.5,asin(Dir.y)/3.14159+0.5));Indirect_Diffuse=texture(Indirect_Environment,vec2(atan(Dir.z,Dir.x)/3.14159*0.5,asin(Dir.y)/3.14159+0.5));}\nvec4 SampleEnv_Bid200(vec3 D,vec4 S,vec4 H,vec4 G,float exponent)\n{float k=pow(abs(D.y),exponent);vec4 C;if (D.y>0.0) {C=mix(H,S,k);} else {C=mix(H,G,k); }\nreturn C;}\nvoid Sky_Environment_B200(\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{Reflected_Color=SampleEnv_Bid200(Reflected,Sky_Color,Horizon_Color,Ground_Color,Horizon_Power);Indirect_Color=mix(Ground_Color,Sky_Color,Normal.y*0.5+0.5);}\nvoid Min_Segment_Distance_B215(\nvec3 P0,\nvec3 P1,\nvec3 Q0,\nvec3 Q1,\nout vec3 NearP,\nout vec3 NearQ,\nout float Distance)\n{vec3 u=P1-P0;vec3 v=Q1-Q0;vec3 w=P0-Q0;float a=dot(u,u);float b=dot(u,v);float c=dot(v,v);float d=dot(u,w);float e=dot(v,w);float D=a*c-b*b;float sD=D;float tD=D;float sc,sN,tc,tN;if (D<0.00001) {sN=0.0;sD=1.0;tN=e;tD=c;} else {sN=(b*e-c*d);tN=(a*e-b*d);if (sN<0.0) {sN=0.0;tN=e;tD=c;} else if (sN>sD) {sN=sD;tN=e+b;tD=c;}}\nif (tN<0.0) {tN=0.0;if (-d<0.0) {sN=0.0;} else if (-d>a) {sN=sD;} else {sN=-d;sD=a;}} else if (tN>tD) {tN=tD;if ((-d+b)<0.0) {sN=0.0;} else if ((-d+b)>a) {sN=sD;} else {sN=(-d+b);sD=a;}}\nsc=abs(sN)<0.000001 ? 0.0 : sN/sD;tc=abs(tN)<0.000001 ? 0.0 : tN/tD;NearP=P0+sc*u;NearQ=Q0+tc*v;Distance=distance(NearP,NearQ);}\nvoid To_XYZ_B224(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{X=Vec3.x;Y=Vec3.y;Z=Vec3.z;}\nvoid Finger_Positions_B214(\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{Left_Index= (Use_Global_Left_Index ? Global_Left_Index_Tip_Position.xyz : Left_Index_Pos);Right_Index= (Use_Global_Right_Index ? Global_Right_Index_Tip_Position.xyz : Right_Index_Pos);Left_Index_Middle= (Use_Global_Left_Index ? Global_Left_Index_Middle_Position.xyz : Left_Index_Middle_Pos);Right_Index_Middle= (Use_Global_Right_Index ? Global_Right_Index_Middle_Position.xyz : Right_Index_Middle_Pos);}\nvoid VaryHSV_B258(\nvec3 HSV_In,\nfloat Hue_Shift,\nfloat Saturation_Shift,\nfloat Value_Shift,\nout vec3 HSV_Out)\n{HSV_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));}\nvoid Remap_Range_B264(\nfloat In_Min,\nfloat In_Max,\nfloat Out_Min,\nfloat Out_Max,\nfloat In,\nout float Out)\n{Out=mix(Out_Min,Out_Max,clamp((In-In_Min)/(In_Max-In_Min),0.0,1.0));}\nvoid To_HSV_B225(\nvec4 Color,\nout float Hue,\nout float Saturation,\nout float Value,\nout float Alpha,\nout vec3 HSV)\n{vec4 K=vec4(0.0,-1.0/3.0,2.0/3.0,-1.0);vec4 p=Color.g<Color.b ? vec4(Color.bg,K.wz) : vec4(Color.gb,K.xy);vec4 q=Color.r<p.x ? vec4(p.xyw,Color.r) : vec4(Color.r,p.yzx);float d=q.x-min(q.w,q.y);float e=1.0e-10;Hue=abs(q.z+(q.w-q.y)/(6.0*d+e));Saturation=d/(q.x+e);Value=q.x;Alpha=Color.a;HSV=vec3(Hue,Saturation,Value);}\nvoid Code_B260(\nfloat X,\nout float Result)\n{Result=(acos(X)/3.14159-0.5)*2.0;}\nvoid Rim_Light_B282(\nvec3 Front,\nvec3 Normal,\nvec3 Incident,\nfloat Rim_Intensity,\nsampler2D Texture,\nout vec4 Result)\n{vec3 R=reflect(Incident,Normal);float RdotF=dot(R,Front);float RdotL=sqrt(1.0-RdotF*RdotF);vec2 UV=vec2(R.y*0.5+0.5,0.5);vec4 Color=texture(Texture,UV);Result=Color;}\nvoid main()\n{vec4 Blob_Color_Q180;\n#if BLOB_ENABLE\nBlob_Fragment_B180(_Blob_Texture_,vExtra2,vExtra3,Blob_Color_Q180);\n#else\nBlob_Color_Q180=vec4(0,0,0,0);\n#endif\nvec3 Incident_Q189=normalize(vPosition-cameraPosition);vec3 Normalized_Q188=normalize(vNormal);vec3 Normalized_Q221=normalize(vTangent);vec4 Color_Q233;\n#if DECAL_ENABLE\nColor_Q233=texture(_Decal_,vUV);\n#else\nColor_Q233=vec4(0,0,0,0);\n#endif\nfloat X_Q240;float Y_Q240;float Z_Q240;float W_Q240;X_Q240=vExtra1.x;Y_Q240=vExtra1.y;Z_Q240=vExtra1.z;W_Q240=vExtra1.w;vec4 Linear_Q193;Linear_Q193.rgb=clamp(_Sky_Color_.rgb*_Sky_Color_.rgb,0.0,1.0);Linear_Q193.a=_Sky_Color_.a;vec4 Linear_Q194;Linear_Q194.rgb=clamp(_Horizon_Color_.rgb*_Horizon_Color_.rgb,0.0,1.0);Linear_Q194.a=_Horizon_Color_.a;vec4 Linear_Q195;Linear_Q195.rgb=clamp(_Ground_Color_.rgb*_Ground_Color_.rgb,0.0,1.0);Linear_Q195.a=_Ground_Color_.a;vec3 Left_Index_Q214;vec3 Right_Index_Q214;vec3 Left_Index_Middle_Q214;vec3 Right_Index_Middle_Q214;Finger_Positions_B214(_Left_Index_Pos_,_Right_Index_Pos_,_Left_Index_Middle_Pos_,_Right_Index_Middle_Pos_,Left_Index_Q214,Right_Index_Q214,Left_Index_Middle_Q214,Right_Index_Middle_Q214);vec4 Linear_Q196;Linear_Q196.rgb=clamp(_Albedo_.rgb*_Albedo_.rgb,0.0,1.0);Linear_Q196.a=_Albedo_.a;vec3 Normalized_Q257=normalize(vBinormal);vec3 Incident_Q220=normalize(vPosition-cameraPosition);vec3 New_Normal_Q229;Bulge_B229(_Bulge_Enabled_,Normalized_Q188,Normalized_Q221,_Bulge_Height_,vColor,_Bulge_Radius_,vBinormal,New_Normal_Q229);float Result_Q227;SSS_B227(vBinormal,New_Normal_Q229,Incident_Q189,Result_Q227);vec4 Result_Q241;Scale_Color_B241(Color_Q233,X_Q240,Result_Q241);float Transmit_Q272;float Reflect_Q272;Fast_Fresnel_B272(_Front_Reflect_,_Edge_Reflect_,_Power_,New_Normal_Q229,Incident_Q189,Transmit_Q272,Reflect_Q272);float Product_Q275=Y_Q240*Y_Q240;vec3 NearP_Q215;vec3 NearQ_Q215;float Distance_Q215;Min_Segment_Distance_B215(Left_Index_Q214,Left_Index_Middle_Q214,vPosition,cameraPosition,NearP_Q215,NearQ_Q215,Distance_Q215);vec3 NearP_Q213;vec3 NearQ_Q213;float Distance_Q213;Min_Segment_Distance_B215(Right_Index_Q214,Right_Index_Middle_Q214,vPosition,cameraPosition,NearP_Q213,NearQ_Q213,Distance_Q213);vec3 Reflected_Q197=reflect(Incident_Q189,New_Normal_Q229);vec4 Product_Q253=Linear_Q196*vec4(1,1,1,1);vec4 Result_Q282;Rim_Light_B282(Normalized_Q257,Normalized_Q188,Incident_Q220,_Rim_Intensity_,_Rim_Texture_,Result_Q282);float Dot_Q222=dot(Incident_Q220, Normalized_Q221);float MaxAB_Q273=max(Reflect_Q272,Product_Q275);float NotInShadow_Q217;\n#if OCCLUSION_ENABLED\nFingerOcclusion_B217(_Width_,Distance_Q215,_Fuzz_,_Min_Fuzz_,vPosition,vBinormal,NearP_Q215,_Clip_Fade_,NotInShadow_Q217);\n#else\nNotInShadow_Q217=1.0;\n#endif\nfloat NotInShadow_Q218;\n#if OCCLUSION_ENABLED\nFingerOcclusion_B218(_Width_,Distance_Q213,_Fuzz_,_Min_Fuzz_,vPosition,vBinormal,NearP_Q213,_Clip_Fade_,NotInShadow_Q218);\n#else\nNotInShadow_Q218=1.0;\n#endif\nvec4 Reflected_Color_Q201;vec4 Indirect_Diffuse_Q201;\n#if ENV_ENABLE\nMapped_Environment_B201(_Reflection_Map_,_Indirect_Environment_,Reflected_Q197,Reflected_Color_Q201,Indirect_Diffuse_Q201);\n#else\nReflected_Color_Q201=vec4(0,0,0,1);Indirect_Diffuse_Q201=vec4(0,0,0,1);\n#endif\nvec4 Reflected_Color_Q200;vec4 Indirect_Color_Q200;\n#if SKY_ENABLED\nSky_Environment_B200(New_Normal_Q229,Reflected_Q197,Linear_Q193,Linear_Q194,Linear_Q195,_Horizon_Power_,Reflected_Color_Q200,Indirect_Color_Q200);\n#else\nReflected_Color_Q200=vec4(0,0,0,1);Indirect_Color_Q200=vec4(0,0,0,1);\n#endif\nfloat Hue_Q225;float Saturation_Q225;float Value_Q225;float Alpha_Q225;vec3 HSV_Q225;To_HSV_B225(Product_Q253,Hue_Q225,Saturation_Q225,Value_Q225,Alpha_Q225,HSV_Q225);float Hue_Q277;float Saturation_Q277;float Value_Q277;float Alpha_Q277;vec3 HSV_Q277;To_HSV_B225(Result_Q282,Hue_Q277,Saturation_Q277,Value_Q277,Alpha_Q277,HSV_Q277);float Result_Q260;Code_B260(Dot_Q222,Result_Q260);float AbsA_Q226=abs(Result_Q260);float MinAB_Q208=min(NotInShadow_Q217,NotInShadow_Q218);vec4 Sum_Q198=Reflected_Color_Q201+Reflected_Color_Q200;vec4 Sum_Q199=Indirect_Diffuse_Q201+Indirect_Color_Q200;vec3 HSV_Out_Q276;VaryHSV_B258(HSV_Q277,_Rim_Hue_Shift_,_Rim_Saturation_Shift_,_Rim_Value_Shift_,HSV_Out_Q276);float Out_Q264;Remap_Range_B264(-1.0,1.0,0.0,1.0,Result_Q260,Out_Q264);float Product_Q256;Product_Q256=AbsA_Q226*_Hue_Shift_;float X_Q278;float Y_Q278;float Z_Q278;To_XYZ_B224(HSV_Out_Q276,X_Q278,Y_Q278,Z_Q278);vec2 Vec2_Q262=vec2(Out_Q264,0.5);vec3 HSV_Out_Q258;VaryHSV_B258(HSV_Q225,Product_Q256,_Saturation_Shift_,_Value_Shift_,HSV_Out_Q258);vec4 Color_Q279;From_HSV_B223(X_Q278,Y_Q278,Z_Q278,0.0,Color_Q279);vec4 Color_Q261;\n#if IRIDESCENCE_ENABLED\nColor_Q261=texture(_Iridescence_Texture_,Vec2_Q262);\n#else\nColor_Q261=vec4(0,0,0,0);\n#endif\nfloat X_Q224;float Y_Q224;float Z_Q224;To_XYZ_B224(HSV_Out_Q258,X_Q224,Y_Q224,Z_Q224);vec4 Result_Q281=_Rim_Intensity_*Color_Q279;vec4 Result_Q263=_Iridescence_Intensity_*Color_Q261;vec4 Color_Q223;From_HSV_B223(X_Q224,Y_Q224,Z_Q224,0.0,Color_Q223);vec4 Result_Q234=Result_Q241+(1.0-Result_Q241.a)*Color_Q223;vec4 Result_Q271;Fragment_Main_B271(_Sun_Intensity_,_Sun_Theta_,_Sun_Phi_,New_Normal_Q229,Result_Q234,MaxAB_Q273,_Shininess_,Incident_Q189,_Horizon_Color_,_Sky_Color_,_Ground_Color_,_Indirect_Diffuse_,_Specular_,_Horizon_Power_,_Reflection_,Sum_Q198,Sum_Q199,_Sharpness_,Result_Q227,_Subsurface_,vec4(0,0,0,0),Result_Q281,Result_Q263,Result_Q271);vec4 Result_Q209;Scale_RGB_B209(Result_Q271,MinAB_Q208,Result_Q209);vec4 sRGB_Q192;FastLinearTosRGB_B192(Result_Q209,sRGB_Q192);vec4 Result_Q181=Blob_Color_Q180+(1.0-Blob_Color_Q180.a)*sRGB_Q192;vec4 Result_Q190=Result_Q181; Result_Q190.a=1.0;vec4 Out_Color=Result_Q190;float Clip_Threshold=0.001;bool To_sRGB=false;gl_FragColor=Out_Color;}";h.ShaderStore.ShadersStore.mrdlSliderThumbVertexShader="uniform mat4 world;uniform mat4 viewProjection;uniform vec3 cameraPosition;attribute vec3 position;attribute vec3 normal;attribute vec2 uv;\n#ifdef TANGENT\nattribute vec3 tangent;\n#else\nconst vec3 tangent=vec3(0.);\n#endif\nuniform float _Radius_;uniform float _Bevel_Front_;uniform float _Bevel_Front_Stretch_;uniform float _Bevel_Back_;uniform float _Bevel_Back_Stretch_;uniform float _Radius_Top_Left_;uniform float _Radius_Top_Right_;uniform float _Radius_Bottom_Left_;uniform float _Radius_Bottom_Right_;uniform bool _Bulge_Enabled_;uniform float _Bulge_Height_;uniform float _Bulge_Radius_;uniform float _Sun_Intensity_;uniform float _Sun_Theta_;uniform float _Sun_Phi_;uniform float _Indirect_Diffuse_;uniform vec4 _Albedo_;uniform float _Specular_;uniform float _Shininess_;uniform float _Sharpness_;uniform float _Subsurface_;uniform vec4 _Left_Color_;uniform vec4 _Right_Color_;uniform float _Reflection_;uniform float _Front_Reflect_;uniform float _Edge_Reflect_;uniform float _Power_;uniform vec4 _Sky_Color_;uniform vec4 _Horizon_Color_;uniform vec4 _Ground_Color_;uniform float _Horizon_Power_;uniform sampler2D _Reflection_Map_;uniform sampler2D _Indirect_Environment_;uniform float _Width_;uniform float _Fuzz_;uniform float _Min_Fuzz_;uniform float _Clip_Fade_;uniform float _Hue_Shift_;uniform float _Saturation_Shift_;uniform float _Value_Shift_;uniform vec3 _Blob_Position_;uniform float _Blob_Intensity_;uniform float _Blob_Near_Size_;uniform float _Blob_Far_Size_;uniform float _Blob_Near_Distance_;uniform float _Blob_Far_Distance_;uniform float _Blob_Fade_Length_;uniform float _Blob_Pulse_;uniform float _Blob_Fade_;uniform sampler2D _Blob_Texture_;uniform vec3 _Blob_Position_2_;uniform float _Blob_Near_Size_2_;uniform float _Blob_Pulse_2_;uniform float _Blob_Fade_2_;uniform vec3 _Left_Index_Pos_;uniform vec3 _Right_Index_Pos_;uniform vec3 _Left_Index_Middle_Pos_;uniform vec3 _Right_Index_Middle_Pos_;uniform sampler2D _Decal_;uniform vec2 _Decal_Scale_XY_;uniform bool _Decal_Front_Only_;uniform float _Rim_Intensity_;uniform sampler2D _Rim_Texture_;uniform float _Rim_Hue_Shift_;uniform float _Rim_Saturation_Shift_;uniform float _Rim_Value_Shift_;uniform float _Iridescence_Intensity_;uniform sampler2D _Iridescence_Texture_;uniform bool Use_Global_Left_Index;uniform bool Use_Global_Right_Index;uniform vec4 Global_Left_Index_Tip_Position;uniform vec4 Global_Right_Index_Tip_Position;uniform vec4 Global_Left_Thumb_Tip_Position;uniform vec4 Global_Right_Thumb_Tip_Position;uniform float Global_Left_Index_Tip_Proximity;uniform float Global_Right_Index_Tip_Proximity;varying vec3 vPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec3 vBinormal;varying vec4 vColor;varying vec4 vExtra1;varying vec4 vExtra2;varying vec4 vExtra3;void Object_To_World_Pos_B162(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{Pos_World=(world*vec4(Pos_Object,1.0)).xyz;}\nvoid Object_To_World_Normal_B182(\nvec3 Nrm_Object,\nout vec3 Nrm_World)\n{Nrm_World=(vec4(Nrm_Object,0.0)).xyz;}\nvoid Blob_Vertex_B173(\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,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{vec3 blob= (Use_Global_Left_Index ? Global_Left_Index_Tip_Position.xyz : Blob_Position);vec3 delta=blob-Position;float dist=dot(Normal,delta);float lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);float fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);float size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;vec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);float Fade=fadeValue*Intensity*Blob_Fade;float Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);Blob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);}\nvoid Blob_Vertex_B174(\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,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{vec3 blob= (Use_Global_Right_Index ? Global_Right_Index_Tip_Position.xyz : Blob_Position);vec3 delta=blob-Position;float dist=dot(Normal,delta);float lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);float fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);float size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;vec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);float Fade=fadeValue*Intensity*Blob_Fade;float Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);Blob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);}\nvoid Move_Verts_B280(\nfloat Anisotropy,\nvec3 P,\nfloat Radius,\nfloat Bevel,\nvec3 Normal_Object,\nfloat ScaleZ,\nfloat Stretch,\nout vec3 New_P,\nout vec2 New_UV,\nout float Radial_Gradient,\nout vec3 Radial_Dir,\nout vec3 New_Normal)\n{vec2 UV=P.xy*2.0+0.5;vec2 center=clamp(UV,0.0,1.0);vec2 delta=UV-center;float deltad=(length(delta)*2.0);float f=(Bevel+(Radius-Bevel)*Stretch)/Radius;float innerd=clamp(deltad*2.0,0.0,1.0);float outerd=clamp(deltad*2.0-1.0,0.0,1.0);float bevelAngle=outerd*3.14159*0.5;float sinb=sin(bevelAngle);float cosb=cos(bevelAngle);float beveld=(1.0-f)*innerd+f*sinb;float br=outerd;vec2 r2=2.0*vec2(Radius/Anisotropy,Radius);float dir=P.z<0.0001 ? 1.0 : -1.0;New_UV=center+r2*((0.5-center)+normalize(delta+vec2(0.0,0.000001))*beveld*0.5);New_P=vec3(New_UV-0.5,P.z+dir*(1.0-cosb)*Bevel*ScaleZ);Radial_Gradient=clamp((deltad-0.5)*2.0,0.0,1.0);Radial_Dir=vec3(delta*r2,0.0);vec3 beveledNormal=cosb*Normal_Object+sinb*vec3(delta.x,delta.y,0.0);New_Normal=Normal_Object.z==0.0 ? Normal_Object : beveledNormal;}\nvoid Object_To_World_Dir_B210(\nvec3 Dir_Object,\nout vec3 Normal_World,\nout vec3 Normal_World_N,\nout float Normal_Length)\n{Normal_World=(world*vec4(Dir_Object,0.0)).xyz;Normal_Length=length(Normal_World);Normal_World_N=Normal_World/Normal_Length;}\nvoid To_XYZ_B228(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{X=Vec3.x;Y=Vec3.y;Z=Vec3.z;}\nvoid Conditional_Float_B243(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{Result=Which ? If_True : If_False;}\nvoid Object_To_World_Dir_B178(\nvec3 Dir_Object,\nout vec3 Binormal_World,\nout vec3 Binormal_World_N,\nout float Binormal_Length)\n{Binormal_World=(world*vec4(Dir_Object,0.0)).xyz;Binormal_Length=length(Binormal_World);Binormal_World_N=Binormal_World/Binormal_Length;}\nvoid Pick_Radius_B219(\nfloat Radius,\nfloat Radius_Top_Left,\nfloat Radius_Top_Right,\nfloat Radius_Bottom_Left,\nfloat Radius_Bottom_Right,\nvec3 Position,\nout float Result)\n{bool whichY=Position.y>0.0;Result=Position.x<0.0 ? (whichY ? Radius_Top_Left : Radius_Bottom_Left) : (whichY ? Radius_Top_Right : Radius_Bottom_Right);Result*=Radius;}\nvoid Conditional_Float_B186(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{Result=Which ? If_True : If_False;}\nvoid Greater_Than_B187(\nfloat Left,\nfloat Right,\nout bool Not_Greater_Than,\nout bool Greater_Than)\n{Greater_Than=Left>Right;Not_Greater_Than=!Greater_Than;}\nvoid Remap_Range_B255(\nfloat In_Min,\nfloat In_Max,\nfloat Out_Min,\nfloat Out_Max,\nfloat In,\nout float Out)\n{Out=mix(Out_Min,Out_Max,clamp((In-In_Min)/(In_Max-In_Min),0.0,1.0));}\nvoid main()\n{vec2 XY_Q235;XY_Q235=(uv-vec2(0.5,0.5))*_Decal_Scale_XY_+vec2(0.5,0.5);vec3 Tangent_World_Q177;vec3 Tangent_World_N_Q177;float Tangent_Length_Q177;Tangent_World_Q177=(world*vec4(vec3(1,0,0),0.0)).xyz;Tangent_Length_Q177=length(Tangent_World_Q177);Tangent_World_N_Q177=Tangent_World_Q177/Tangent_Length_Q177;vec3 Normal_World_Q210;vec3 Normal_World_N_Q210;float Normal_Length_Q210;Object_To_World_Dir_B210(vec3(0,0,1),Normal_World_Q210,Normal_World_N_Q210,Normal_Length_Q210);float X_Q228;float Y_Q228;float Z_Q228;To_XYZ_B228(position,X_Q228,Y_Q228,Z_Q228);vec3 Nrm_World_Q176;Nrm_World_Q176=normalize((world*vec4(normal,0.0)).xyz);vec3 Binormal_World_Q178;vec3 Binormal_World_N_Q178;float Binormal_Length_Q178;Object_To_World_Dir_B178(vec3(0,1,0),Binormal_World_Q178,Binormal_World_N_Q178,Binormal_Length_Q178);float Anisotropy_Q179=Tangent_Length_Q177/Binormal_Length_Q178;float Result_Q219;Pick_Radius_B219(_Radius_,_Radius_Top_Left_,_Radius_Top_Right_,_Radius_Bottom_Left_,_Radius_Bottom_Right_,position,Result_Q219);float Anisotropy_Q203=Binormal_Length_Q178/Normal_Length_Q210;bool Not_Greater_Than_Q187;bool Greater_Than_Q187;Greater_Than_B187(Z_Q228,0.0,Not_Greater_Than_Q187,Greater_Than_Q187);vec4 Linear_Q251;Linear_Q251.rgb=clamp(_Left_Color_.rgb*_Left_Color_.rgb,0.0,1.0);Linear_Q251.a=_Left_Color_.a;vec4 Linear_Q252;Linear_Q252.rgb=clamp(_Right_Color_.rgb*_Right_Color_.rgb,0.0,1.0);Linear_Q252.a=_Right_Color_.a;vec3 Difference_Q211=vec3(0,0,0)-Normal_World_N_Q210;vec4 Out_Color_Q184=vec4(X_Q228,Y_Q228,Z_Q228,1);float Result_Q186;Conditional_Float_B186(Greater_Than_Q187,_Bevel_Back_,_Bevel_Front_,Result_Q186);float Result_Q244;Conditional_Float_B186(Greater_Than_Q187,_Bevel_Back_Stretch_,_Bevel_Front_Stretch_,Result_Q244);vec3 New_P_Q280;vec2 New_UV_Q280;float Radial_Gradient_Q280;vec3 Radial_Dir_Q280;vec3 New_Normal_Q280;Move_Verts_B280(Anisotropy_Q179,position,Result_Q219,Result_Q186,normal,Anisotropy_Q203,Result_Q244,New_P_Q280,New_UV_Q280,Radial_Gradient_Q280,Radial_Dir_Q280,New_Normal_Q280);float X_Q248;float Y_Q248;X_Q248=New_UV_Q280.x;Y_Q248=New_UV_Q280.y;vec3 Pos_World_Q162;Object_To_World_Pos_B162(New_P_Q280,Pos_World_Q162);vec3 Nrm_World_Q182;Object_To_World_Normal_B182(New_Normal_Q280,Nrm_World_Q182);vec4 Blob_Info_Q173;\n#if BLOB_ENABLE\nBlob_Vertex_B173(Pos_World_Q162,Nrm_World_Q176,Tangent_World_N_Q177,Binormal_World_N_Q178,_Blob_Position_,_Blob_Intensity_,_Blob_Near_Size_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_,_Blob_Fade_,Blob_Info_Q173);\n#else\nBlob_Info_Q173=vec4(0,0,0,0);\n#endif\nvec4 Blob_Info_Q174;\n#if BLOB_ENABLE_2\nBlob_Vertex_B174(Pos_World_Q162,Nrm_World_Q176,Tangent_World_N_Q177,Binormal_World_N_Q178,_Blob_Position_2_,_Blob_Intensity_,_Blob_Near_Size_2_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_2_,_Blob_Fade_2_,Blob_Info_Q174);\n#else\nBlob_Info_Q174=vec4(0,0,0,0);\n#endif\nfloat Out_Q255;Remap_Range_B255(0.0,1.0,0.0,1.0,X_Q248,Out_Q255);float X_Q236;float Y_Q236;float Z_Q236;To_XYZ_B228(Nrm_World_Q182,X_Q236,Y_Q236,Z_Q236);vec4 Color_At_T_Q247=mix(Linear_Q251,Linear_Q252,Out_Q255);float Minus_F_Q237=-Z_Q236;float R_Q249;float G_Q249;float B_Q249;float A_Q249;R_Q249=Color_At_T_Q247.r; G_Q249=Color_At_T_Q247.g; B_Q249=Color_At_T_Q247.b; A_Q249=Color_At_T_Q247.a;float ClampF_Q238=clamp(0.0,Minus_F_Q237,1.0);float Result_Q243;Conditional_Float_B243(_Decal_Front_Only_,ClampF_Q238,1.0,Result_Q243);vec4 Vec4_Q239=vec4(Result_Q243,Radial_Gradient_Q280,G_Q249,B_Q249);vec3 Position=Pos_World_Q162;vec3 Normal=Nrm_World_Q182;vec2 UV=XY_Q235;vec3 Tangent=Tangent_World_N_Q177;vec3 Binormal=Difference_Q211;vec4 Color=Out_Color_Q184;vec4 Extra1=Vec4_Q239;vec4 Extra2=Blob_Info_Q173;vec4 Extra3=Blob_Info_Q174;gl_Position=viewProjection*vec4(Position,1);vPosition=Position;vNormal=Normal;vUV=UV;vTangent=Tangent;vBinormal=Binormal;vColor=Color;vExtra1=Extra1;vExtra2=Extra2;vExtra3=Extra3;}";var jt=function(t){function e(){var e=t.call(this)||this;return e.SKY_ENABLED=!0,e.BLOB_ENABLE_2=!0,e.IRIDESCENCE_ENABLED=!0,e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return n(e,t),e}(h.MaterialDefines),Yt=function(t){function e(i,o){var r=t.call(this,i,o)||this;return r.radius=.157,r.bevelFront=.065,r.bevelFrontStretch=.077,r.bevelBack=.031,r.bevelBackStretch=0,r.radiusTopLeft=1,r.radiusTopRight=1,r.radiusBottomLeft=1,r.radiusBottomRight=1,r.bulgeEnabled=!1,r.bulgeHeight=-.323,r.bulgeRadius=.73,r.sunIntensity=2,r.sunTheta=.937,r.sunPhi=.555,r.indirectDiffuse=1,r.albedo=new h.Color4(.0117647,.505882,.996078,1),r.specular=0,r.shininess=10,r.sharpness=0,r.subsurface=.31,r.leftGradientColor=new h.Color4(.0117647,.505882,.996078,1),r.rightGradientColor=new h.Color4(.0117647,.505882,.996078,1),r.reflection=.749,r.frontReflect=0,r.edgeReflect=.09,r.power=8.1,r.skyColor=new h.Color4(.0117647,.960784,.996078,1),r.horizonColor=new h.Color4(.0117647,.333333,.996078,1),r.groundColor=new h.Color4(0,.254902,.996078,1),r.horizonPower=1,r.width=.02,r.fuzz=.5,r.minFuzz=.001,r.clipFade=.01,r.hueShift=0,r.saturationShift=0,r.valueShift=0,r.blobPosition=new h.Vector3(0,0,.1),r.blobIntensity=.5,r.blobNearSize=.01,r.blobFarSize=.03,r.blobNearDistance=0,r.blobFarDistance=.08,r.blobFadeLength=.576,r.blobPulse=0,r.blobFade=1,r.blobPosition2=new h.Vector3(.2,0,.1),r.blobNearSize2=.01,r.blobPulse2=0,r.blobFade2=1,r.blobTexture=new h.Texture("",r.getScene()),r.leftIndexPosition=new h.Vector3(0,0,1),r.rightIndexPosition=new h.Vector3(-1,-1,-1),r.leftIndexMiddlePosition=new h.Vector3(0,0,0),r.rightIndexMiddlePosition=new h.Vector3(0,0,0),r.decalScaleXY=new h.Vector2(1.5,1.5),r.decalFrontOnly=!0,r.rimIntensity=.287,r.rimHueShift=0,r.rimSaturationShift=0,r.rimValueShift=-1,r.iridescenceIntensity=0,r.useGlobalLeftIndex=1,r.useGlobalRightIndex=1,r.globalLeftIndexTipProximity=0,r.globalRightIndexTipProximity=0,r.globalLeftIndexTipPosition=new h.Vector4(.5,0,-.55,1),r.globaRightIndexTipPosition=new h.Vector4(0,0,0,1),r.globalLeftThumbTipPosition=new h.Vector4(.5,0,-.55,1),r.globalRightThumbTipPosition=new h.Vector4(0,0,0,1),r.globalLeftIndexMiddlePosition=new h.Vector4(.5,0,-.55,1),r.globalRightIndexMiddlePosition=new h.Vector4(0,0,0,1),r.alphaMode=h.Constants.ALPHA_DISABLE,r.backFaceCulling=!1,r._blueGradientTexture=new h.Texture(e.BLUE_GRADIENT_TEXTURE_URL,o,!0,!1,h.Texture.NEAREST_SAMPLINGMODE),r._decalTexture=new h.Texture("",r.getScene()),r._reflectionMapTexture=new h.Texture("",r.getScene()),r._indirectEnvTexture=new h.Texture("",r.getScene()),r}return n(e,t),e.prototype.needAlphaBlending=function(){return!1},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){var i=e._drawWrapper;if(this.isFrozen&&i.effect&&i._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new jt);var o=e.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=r.getEngine();if((0,h.PrepareDefinesForAttributes)(t,o,!1,!1),o.isDirty){o.markAsProcessed(),r.resetCachedMaterial();var a=new h.EffectFallbacks;o.FOG&&a.addFallback(1,"FOG"),(0,h.HandleFallbacksForShadows)(o,a),o.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess;var s=[h.VertexBuffer.PositionKind];o.NORMAL&&s.push(h.VertexBuffer.NormalKind),o.UV1&&s.push(h.VertexBuffer.UVKind),o.UV2&&s.push(h.VertexBuffer.UV2Kind),o.VERTEXCOLOR&&s.push(h.VertexBuffer.ColorKind),o.TANGENT&&s.push(h.VertexBuffer.TangentKind),(0,h.PrepareAttributesForInstances)(s,o);var l=o.toString(),_=["world","viewProjection","cameraPosition","_Radius_","_Bevel_Front_","_Bevel_Front_Stretch_","_Bevel_Back_","_Bevel_Back_Stretch_","_Radius_Top_Left_","_Radius_Top_Right_","_Radius_Bottom_Left_","_Radius_Bottom_Right_","_Bulge_Enabled_","_Bulge_Height_","_Bulge_Radius_","_Sun_Intensity_","_Sun_Theta_","_Sun_Phi_","_Indirect_Diffuse_","_Albedo_","_Specular_","_Shininess_","_Sharpness_","_Subsurface_","_Left_Color_","_Right_Color_","_Reflection_","_Front_Reflect_","_Edge_Reflect_","_Power_","_Sky_Color_","_Horizon_Color_","_Ground_Color_","_Horizon_Power_","_Reflection_Map_","_Indirect_Environment_","_Width_","_Fuzz_","_Min_Fuzz_","_Clip_Fade_","_Hue_Shift_","_Saturation_Shift_","_Value_Shift_","_Blob_Position_","_Blob_Intensity_","_Blob_Near_Size_","_Blob_Far_Size_","_Blob_Near_Distance_","_Blob_Far_Distance_","_Blob_Fade_Length_","_Blob_Pulse_","_Blob_Fade_","_Blob_Texture_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Left_Index_Pos_","_Right_Index_Pos_","_Left_Index_Middle_Pos_","_Right_Index_Middle_Pos_","_Decal_","_Decal_Scale_XY_","_Decal_Front_Only_","_Rim_Intensity_","_Rim_Texture_","_Rim_Hue_Shift_","_Rim_Saturation_Shift_","_Rim_Value_Shift_","_Iridescence_Intensity_","_Iridescence_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_Middle_Position;","Global_Right_Index_Middle_Position","Global_Left_Index_Tip_Proximity","Global_Right_Index_Tip_Proximity"],c=["_Rim_Texture_","_Iridescence_Texture_"],u=[];(0,h.PrepareUniformsAndSamplersList)({uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:o,maxSimultaneousLights:4}),e.setEffect(r.getEngine().createEffect("mrdlSliderThumb",{attributes:s,uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:l,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),o)}return!(!e.effect||!e.effect.isReady()||(o._renderId=r.getRenderId(),i._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){if(i.materialDefines){var o=i.effect;o&&(this._activeEffect=o,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",this.getScene().activeCamera.position),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Bevel_Front_",this.bevelFront),this._activeEffect.setFloat("_Bevel_Front_Stretch_",this.bevelFrontStretch),this._activeEffect.setFloat("_Bevel_Back_",this.bevelBack),this._activeEffect.setFloat("_Bevel_Back_Stretch_",this.bevelBackStretch),this._activeEffect.setFloat("_Radius_Top_Left_",this.radiusTopLeft),this._activeEffect.setFloat("_Radius_Top_Right_",this.radiusTopRight),this._activeEffect.setFloat("_Radius_Bottom_Left_",this.radiusBottomLeft),this._activeEffect.setFloat("_Radius_Bottom_Right_",this.radiusBottomRight),this._activeEffect.setFloat("_Bulge_Enabled_",this.bulgeEnabled?1:0),this._activeEffect.setFloat("_Bulge_Height_",this.bulgeHeight),this._activeEffect.setFloat("_Bulge_Radius_",this.bulgeRadius),this._activeEffect.setFloat("_Sun_Intensity_",this.sunIntensity),this._activeEffect.setFloat("_Sun_Theta_",this.sunTheta),this._activeEffect.setFloat("_Sun_Phi_",this.sunPhi),this._activeEffect.setFloat("_Indirect_Diffuse_",this.indirectDiffuse),this._activeEffect.setDirectColor4("_Albedo_",this.albedo),this._activeEffect.setFloat("_Specular_",this.specular),this._activeEffect.setFloat("_Shininess_",this.shininess),this._activeEffect.setFloat("_Sharpness_",this.sharpness),this._activeEffect.setFloat("_Subsurface_",this.subsurface),this._activeEffect.setDirectColor4("_Left_Color_",this.leftGradientColor),this._activeEffect.setDirectColor4("_Right_Color_",this.rightGradientColor),this._activeEffect.setFloat("_Reflection_",this.reflection),this._activeEffect.setFloat("_Front_Reflect_",this.frontReflect),this._activeEffect.setFloat("_Edge_Reflect_",this.edgeReflect),this._activeEffect.setFloat("_Power_",this.power),this._activeEffect.setDirectColor4("_Sky_Color_",this.skyColor),this._activeEffect.setDirectColor4("_Horizon_Color_",this.horizonColor),this._activeEffect.setDirectColor4("_Ground_Color_",this.groundColor),this._activeEffect.setFloat("_Horizon_Power_",this.horizonPower),this._activeEffect.setTexture("_Reflection_Map_",this._reflectionMapTexture),this._activeEffect.setTexture("_Indirect_Environment_",this._indirectEnvTexture),this._activeEffect.setFloat("_Width_",this.width),this._activeEffect.setFloat("_Fuzz_",this.fuzz),this._activeEffect.setFloat("_Min_Fuzz_",this.minFuzz),this._activeEffect.setFloat("_Clip_Fade_",this.clipFade),this._activeEffect.setFloat("_Hue_Shift_",this.hueShift),this._activeEffect.setFloat("_Saturation_Shift_",this.saturationShift),this._activeEffect.setFloat("_Value_Shift_",this.valueShift),this._activeEffect.setVector3("_Blob_Position_",this.blobPosition),this._activeEffect.setFloat("_Blob_Intensity_",this.blobIntensity),this._activeEffect.setFloat("_Blob_Near_Size_",this.blobNearSize),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_Pulse_",this.blobPulse),this._activeEffect.setFloat("_Blob_Fade_",this.blobFade),this._activeEffect.setTexture("_Blob_Texture_",this.blobTexture),this._activeEffect.setVector3("_Blob_Position_2_",this.blobPosition2),this._activeEffect.setFloat("_Blob_Near_Size_2_",this.blobNearSize2),this._activeEffect.setFloat("_Blob_Pulse_2_",this.blobPulse2),this._activeEffect.setFloat("_Blob_Fade_2_",this.blobFade2),this._activeEffect.setVector3("_Left_Index_Pos_",this.leftIndexPosition),this._activeEffect.setVector3("_Right_Index_Pos_",this.rightIndexPosition),this._activeEffect.setVector3("_Left_Index_Middle_Pos_",this.leftIndexMiddlePosition),this._activeEffect.setVector3("_Right_Index_Middle_Pos_",this.rightIndexMiddlePosition),this._activeEffect.setTexture("_Decal_",this._decalTexture),this._activeEffect.setVector2("_Decal_Scale_XY_",this.decalScaleXY),this._activeEffect.setFloat("_Decal_Front_Only_",this.decalFrontOnly?1:0),this._activeEffect.setFloat("_Rim_Intensity_",this.rimIntensity),this._activeEffect.setTexture("_Rim_Texture_",this._blueGradientTexture),this._activeEffect.setFloat("_Rim_Hue_Shift_",this.rimHueShift),this._activeEffect.setFloat("_Rim_Saturation_Shift_",this.rimSaturationShift),this._activeEffect.setFloat("_Rim_Value_Shift_",this.rimValueShift),this._activeEffect.setFloat("_Iridescence_Intensity_",this.iridescenceIntensity),this._activeEffect.setTexture("_Iridescence_Texture_",this._blueGradientTexture),this._activeEffect.setFloat("Use_Global_Left_Index",this.useGlobalLeftIndex),this._activeEffect.setFloat("Use_Global_Right_Index",this.useGlobalRightIndex),this._activeEffect.setVector4("Global_Left_Index_Tip_Position",this.globalLeftIndexTipPosition),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",this.globaRightIndexTipPosition),this._activeEffect.setVector4("Global_Left_Thumb_Tip_Position",this.globalLeftThumbTipPosition),this._activeEffect.setVector4("Global_Right_Thumb_Tip_Position",this.globalRightThumbTipPosition),this._activeEffect.setVector4("Global_Left_Index_Middle_Position",this.globalLeftIndexMiddlePosition),this._activeEffect.setVector4("Global_Right_Index_Middle_Position",this.globalRightIndexMiddlePosition),this._activeEffect.setFloat("Global_Left_Index_Tip_Proximity",this.globalLeftIndexTipProximity),this._activeEffect.setFloat("Global_Right_Index_Tip_Proximity",this.globalRightIndexTipProximity),this._afterBind(e,this._activeEffect,i))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),this._reflectionMapTexture.dispose(),this._indirectEnvTexture.dispose(),this._blueGradientTexture.dispose(),this._decalTexture.dispose()},e.prototype.clone=function(t){var i=this;return h.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.MRDLSliderThumbMaterial",e},e.prototype.getClassName=function(){return"MRDLSliderThumbMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.BLUE_GRADIENT_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/MRDL/mrtk-mrdl-blue-gradient.png",s([(0,h.serialize)()],e.prototype,"radius",void 0),s([(0,h.serialize)()],e.prototype,"bevelFront",void 0),s([(0,h.serialize)()],e.prototype,"bevelFrontStretch",void 0),s([(0,h.serialize)()],e.prototype,"bevelBack",void 0),s([(0,h.serialize)()],e.prototype,"bevelBackStretch",void 0),s([(0,h.serialize)()],e.prototype,"radiusTopLeft",void 0),s([(0,h.serialize)()],e.prototype,"radiusTopRight",void 0),s([(0,h.serialize)()],e.prototype,"radiusBottomLeft",void 0),s([(0,h.serialize)()],e.prototype,"radiusBottomRight",void 0),s([(0,h.serialize)()],e.prototype,"bulgeEnabled",void 0),s([(0,h.serialize)()],e.prototype,"bulgeHeight",void 0),s([(0,h.serialize)()],e.prototype,"bulgeRadius",void 0),s([(0,h.serialize)()],e.prototype,"sunIntensity",void 0),s([(0,h.serialize)()],e.prototype,"sunTheta",void 0),s([(0,h.serialize)()],e.prototype,"sunPhi",void 0),s([(0,h.serialize)()],e.prototype,"indirectDiffuse",void 0),s([(0,h.serialize)()],e.prototype,"albedo",void 0),s([(0,h.serialize)()],e.prototype,"specular",void 0),s([(0,h.serialize)()],e.prototype,"shininess",void 0),s([(0,h.serialize)()],e.prototype,"sharpness",void 0),s([(0,h.serialize)()],e.prototype,"subsurface",void 0),s([(0,h.serialize)()],e.prototype,"leftGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"rightGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"reflection",void 0),s([(0,h.serialize)()],e.prototype,"frontReflect",void 0),s([(0,h.serialize)()],e.prototype,"edgeReflect",void 0),s([(0,h.serialize)()],e.prototype,"power",void 0),s([(0,h.serialize)()],e.prototype,"skyColor",void 0),s([(0,h.serialize)()],e.prototype,"horizonColor",void 0),s([(0,h.serialize)()],e.prototype,"groundColor",void 0),s([(0,h.serialize)()],e.prototype,"horizonPower",void 0),s([(0,h.serialize)()],e.prototype,"width",void 0),s([(0,h.serialize)()],e.prototype,"fuzz",void 0),s([(0,h.serialize)()],e.prototype,"minFuzz",void 0),s([(0,h.serialize)()],e.prototype,"clipFade",void 0),s([(0,h.serialize)()],e.prototype,"hueShift",void 0),s([(0,h.serialize)()],e.prototype,"saturationShift",void 0),s([(0,h.serialize)()],e.prototype,"valueShift",void 0),s([(0,h.serialize)()],e.prototype,"blobPosition",void 0),s([(0,h.serialize)()],e.prototype,"blobIntensity",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize",void 0),s([(0,h.serialize)()],e.prototype,"blobFarSize",void 0),s([(0,h.serialize)()],e.prototype,"blobNearDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFarDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFadeLength",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse",void 0),s([(0,h.serialize)()],e.prototype,"blobFade",void 0),s([(0,h.serialize)()],e.prototype,"blobPosition2",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize2",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse2",void 0),s([(0,h.serialize)()],e.prototype,"blobFade2",void 0),s([(0,h.serialize)()],e.prototype,"blobTexture",void 0),s([(0,h.serialize)()],e.prototype,"leftIndexPosition",void 0),s([(0,h.serialize)()],e.prototype,"rightIndexPosition",void 0),s([(0,h.serialize)()],e.prototype,"leftIndexMiddlePosition",void 0),s([(0,h.serialize)()],e.prototype,"rightIndexMiddlePosition",void 0),s([(0,h.serialize)()],e.prototype,"decalScaleXY",void 0),s([(0,h.serialize)()],e.prototype,"decalFrontOnly",void 0),s([(0,h.serialize)()],e.prototype,"rimIntensity",void 0),s([(0,h.serialize)()],e.prototype,"rimHueShift",void 0),s([(0,h.serialize)()],e.prototype,"rimSaturationShift",void 0),s([(0,h.serialize)()],e.prototype,"rimValueShift",void 0),s([(0,h.serialize)()],e.prototype,"iridescenceIntensity",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.MRDLSliderThumbMaterial",Yt);h.ShaderStore.ShadersStore.mrdlBackplatePixelShader="uniform vec3 cameraPosition;varying vec3 vPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec3 vBinormal;varying vec4 vExtra1;varying vec4 vExtra2;uniform float _Radius_;uniform float _Line_Width_;uniform bool _Absolute_Sizes_;uniform float _Filter_Width_;uniform vec4 _Base_Color_;uniform vec4 _Line_Color_;uniform float _Radius_Top_Left_;uniform float _Radius_Top_Right_;uniform float _Radius_Bottom_Left_;uniform float _Radius_Bottom_Right_;uniform float _Rate_;uniform vec4 _Highlight_Color_;uniform float _Highlight_Width_;uniform vec4 _Highlight_Transform_;uniform float _Highlight_;uniform float _Iridescence_Intensity_;uniform float _Iridescence_Edge_Intensity_;uniform vec4 _Iridescence_Tint_;uniform sampler2D _Iridescent_Map_;uniform float _Angle_;uniform bool _Reflected_;uniform float _Frequency_;uniform float _Vertical_Offset_;uniform vec4 _Gradient_Color_;uniform vec4 _Top_Left_;uniform vec4 _Top_Right_;uniform vec4 _Bottom_Left_;uniform vec4 _Bottom_Right_;uniform float _Edge_Width_;uniform float _Edge_Power_;uniform float _Line_Gradient_Blend_;uniform float _Fade_Out_;void FastLinearTosRGB_B353(\nvec4 Linear,\nout vec4 sRGB)\n{sRGB.rgb=sqrt(clamp(Linear.rgb,0.0,1.0));sRGB.a=Linear.a;}\nvoid Round_Rect_Fragment_B332(\nfloat Radius,\nfloat Line_Width,\nvec4 Line_Color,\nfloat Filter_Width,\nvec2 UV,\nfloat Line_Visibility,\nvec4 Rect_Parms,\nvec4 Fill_Color,\nout vec4 Color)\n{float d=length(max(abs(UV)-Rect_Parms.xy,0.0));float dx=max(fwidth(d)*Filter_Width,0.00001);float g=min(Rect_Parms.z,Rect_Parms.w);float dgrad=max(fwidth(g)*Filter_Width,0.00001);float Inside_Rect=clamp(g/dgrad,0.0,1.0);float inner=clamp((d+dx*0.5-max(Radius-Line_Width,d-dx*0.5))/dx,0.0,1.0);Color=clamp(mix(Fill_Color,Line_Color,inner),0.0,1.0)*Inside_Rect;}\nvoid Iridescence_B343(\nvec3 Position,\nvec3 Normal,\nvec2 UV,\nvec3 Axis,\nvec3 Eye,\nvec4 Tint,\nsampler2D Texture,\nbool Reflected,\nfloat Frequency,\nfloat Vertical_Offset,\nout vec4 Color)\n{vec3 i=normalize(Position-Eye);vec3 r=reflect(i,Normal);float idota=dot(i,Axis);float idotr=dot(i,r);float x=Reflected ? idotr : idota;vec2 xy;xy.x=fract((x*Frequency+1.0)*0.5+UV.y*Vertical_Offset);xy.y=0.5;Color=texture(Texture,xy);Color.rgb*=Tint.rgb;}\nvoid Scale_RGB_B346(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{Result=vec4(Scalar,Scalar,Scalar,1)*Color;}\nvoid Scale_RGB_B344(\nfloat Scalar,\nvec4 Color,\nout vec4 Result)\n{Result=vec4(Scalar,Scalar,Scalar,1)*Color;}\nvoid Line_Fragment_B362(\nvec4 Base_Color,\nvec4 Highlight_Color,\nfloat Highlight_Width,\nvec3 Line_Vertex,\nfloat Highlight,\nout vec4 Line_Color)\n{float k2=1.0-clamp(abs(Line_Vertex.y/Highlight_Width),0.0,1.0);Line_Color=mix(Base_Color,Highlight_Color,Highlight*k2);}\nvoid Edge_B356(\nvec4 RectParms,\nfloat Radius,\nfloat Line_Width,\nvec2 UV,\nfloat Edge_Width,\nfloat Edge_Power,\nout float Result)\n{float d=length(max(abs(UV)-RectParms.xy,0.0));float edge=1.0-clamp((1.0-d/(Radius-Line_Width))/Edge_Width,0.0,1.0);Result=pow(edge,Edge_Power);}\nvoid Gradient_B355(\nvec4 Gradient_Color,\nvec4 Top_Left,\nvec4 Top_Right,\nvec4 Bottom_Left,\nvec4 Bottom_Right,\nvec2 UV,\nout vec4 Result)\n{vec3 top=Top_Left.rgb+(Top_Right.rgb-Top_Left.rgb)*UV.x;vec3 bottom=Bottom_Left.rgb+(Bottom_Right.rgb-Bottom_Left.rgb)*UV.x;Result.rgb=Gradient_Color.rgb*(bottom+(top-bottom)*UV.y);Result.a=1.0;}\nvoid main()\n{float X_Q338;float Y_Q338;float Z_Q338;float W_Q338;X_Q338=vExtra2.x;Y_Q338=vExtra2.y;Z_Q338=vExtra2.z;W_Q338=vExtra2.w;vec4 Color_Q343;\n#if IRIDESCENCE_ENABLE\nIridescence_B343(vPosition,vNormal,vUV,vBinormal,cameraPosition,_Iridescence_Tint_,_Iridescent_Map_,_Reflected_,_Frequency_,_Vertical_Offset_,Color_Q343);\n#else\nColor_Q343=vec4(0,0,0,0);\n#endif\nvec4 Result_Q344;Scale_RGB_B344(_Iridescence_Intensity_,Color_Q343,Result_Q344);vec4 Line_Color_Q362;Line_Fragment_B362(_Line_Color_,_Highlight_Color_,_Highlight_Width_,vTangent,_Highlight_,Line_Color_Q362);float Result_Q356;\n#if EDGE_ONLY\nEdge_B356(vExtra1,Z_Q338,W_Q338,vUV,_Edge_Width_,_Edge_Power_,Result_Q356);\n#else\nResult_Q356=1.0;\n#endif\nvec2 Vec2_Q339=vec2(X_Q338,Y_Q338);vec4 Result_Q355;Gradient_B355(_Gradient_Color_,_Top_Left_,_Top_Right_,_Bottom_Left_,_Bottom_Right_,Vec2_Q339,Result_Q355);vec4 Linear_Q348;Linear_Q348.rgb=clamp(Result_Q355.rgb*Result_Q355.rgb,0.0,1.0);Linear_Q348.a=Result_Q355.a;vec4 Result_Q346;Scale_RGB_B346(Linear_Q348,Result_Q356,Result_Q346);vec4 Sum_Q345=Result_Q346+Result_Q344;vec4 Color_At_T_Q347=mix(Line_Color_Q362,Result_Q346,_Line_Gradient_Blend_);vec4 Base_And_Iridescent_Q350;Base_And_Iridescent_Q350=_Base_Color_+vec4(Sum_Q345.rgb,0.0);vec4 Sum_Q349=Color_At_T_Q347+_Iridescence_Edge_Intensity_*Color_Q343;vec4 Result_Q351=Sum_Q349; Result_Q351.a=1.0;vec4 Color_Q332;Round_Rect_Fragment_B332(Z_Q338,W_Q338,Result_Q351,_Filter_Width_,vUV,1.0,vExtra1,Base_And_Iridescent_Q350,Color_Q332);vec4 Result_Q354=_Fade_Out_*Color_Q332;vec4 sRGB_Q353;FastLinearTosRGB_B353(Result_Q354,sRGB_Q353);vec4 Out_Color=sRGB_Q353;float Clip_Threshold=0.001;bool To_sRGB=false;gl_FragColor=Out_Color;}";h.ShaderStore.ShadersStore.mrdlBackplateVertexShader="uniform mat4 world;uniform mat4 viewProjection;uniform vec3 cameraPosition;attribute vec3 position;attribute vec3 normal;attribute vec3 tangent;uniform float _Radius_;uniform float _Line_Width_;uniform bool _Absolute_Sizes_;uniform float _Filter_Width_;uniform vec4 _Base_Color_;uniform vec4 _Line_Color_;uniform float _Radius_Top_Left_;uniform float _Radius_Top_Right_;uniform float _Radius_Bottom_Left_;uniform float _Radius_Bottom_Right_;uniform float _Rate_;uniform vec4 _Highlight_Color_;uniform float _Highlight_Width_;uniform vec4 _Highlight_Transform_;uniform float _Highlight_;uniform float _Iridescence_Intensity_;uniform float _Iridescence_Edge_Intensity_;uniform vec4 _Iridescence_Tint_;uniform sampler2D _Iridescent_Map_;uniform float _Angle_;uniform bool _Reflected_;uniform float _Frequency_;uniform float _Vertical_Offset_;uniform vec4 _Gradient_Color_;uniform vec4 _Top_Left_;uniform vec4 _Top_Right_;uniform vec4 _Bottom_Left_;uniform vec4 _Bottom_Right_;uniform float _Edge_Width_;uniform float _Edge_Power_;uniform float _Line_Gradient_Blend_;uniform float _Fade_Out_;varying vec3 vPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec3 vBinormal;varying vec4 vExtra1;varying vec4 vExtra2;void Object_To_World_Pos_B314(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{Pos_World=(world*vec4(Pos_Object,1.0)).xyz;}\nvoid Round_Rect_Vertex_B357(\nvec2 UV,\nfloat Radius,\nfloat Margin,\nfloat Anisotropy,\nfloat Gradient1,\nfloat Gradient2,\nvec3 Normal,\nvec4 Color_Scale_Translate,\nout vec2 Rect_UV,\nout vec4 Rect_Parms,\nout vec2 Scale_XY,\nout vec2 Line_UV,\nout vec2 Color_UV_Info)\n{Scale_XY=vec2(Anisotropy,1.0);Line_UV=(UV-vec2(0.5,0.5));Rect_UV=Line_UV*Scale_XY;Rect_Parms.xy=Scale_XY*0.5-vec2(Radius,Radius)-vec2(Margin,Margin);Rect_Parms.z=Gradient1; \nRect_Parms.w=Gradient2;Color_UV_Info=(Line_UV+vec2(0.5,0.5))*Color_Scale_Translate.xy+Color_Scale_Translate.zw;}\nvoid Line_Vertex_B333(\nvec2 Scale_XY,\nvec2 UV,\nfloat Time,\nfloat Rate,\nvec4 Highlight_Transform,\nout vec3 Line_Vertex)\n{float angle2=(Rate*Time)*2.0*3.1416;float sinAngle2=sin(angle2);float cosAngle2=cos(angle2);vec2 xformUV=UV*Highlight_Transform.xy+Highlight_Transform.zw;Line_Vertex.x=0.0;Line_Vertex.y=cosAngle2*xformUV.x-sinAngle2*xformUV.y;Line_Vertex.z=0.0; }\nvoid PickDir_B334(\nfloat Degrees,\nvec3 DirX,\nvec3 DirY,\nout vec3 Dir)\n{float a=Degrees*3.14159/180.0;Dir=cos(a)*DirX+sin(a)*DirY;}\nvoid Move_Verts_B327(\nfloat Anisotropy,\nvec3 P,\nfloat Radius,\nout vec3 New_P,\nout vec2 New_UV,\nout float Radial_Gradient,\nout vec3 Radial_Dir)\n{vec2 UV=P.xy*2.0+0.5;vec2 center=clamp(UV,0.0,1.0);vec2 delta=UV-center;vec2 r2=2.0*vec2(Radius/Anisotropy,Radius);New_UV=center+r2*(UV-2.0*center+0.5);New_P=vec3(New_UV-0.5,P.z);Radial_Gradient=1.0-length(delta)*2.0;Radial_Dir=vec3(delta*r2,0.0);}\nvoid Pick_Radius_B336(\nfloat Radius,\nfloat Radius_Top_Left,\nfloat Radius_Top_Right,\nfloat Radius_Bottom_Left,\nfloat Radius_Bottom_Right,\nvec3 Position,\nout float Result)\n{bool whichY=Position.y>0.0;Result=Position.x<0.0 ? (whichY ? Radius_Top_Left : Radius_Bottom_Left) : (whichY ? Radius_Top_Right : Radius_Bottom_Right);Result*=Radius;}\nvoid Edge_AA_Vertex_B328(\nvec3 Position_World,\nvec3 Position_Object,\nvec3 Normal_Object,\nvec3 Eye,\nfloat Radial_Gradient,\nvec3 Radial_Dir,\nvec3 Tangent,\nout float Gradient1,\nout float Gradient2)\n{vec3 I=(Eye-Position_World);vec3 T=(vec4(Tangent,0.0)).xyz;float g=(dot(T,I)<0.0) ? 0.0 : 1.0;if (Normal_Object.z==0.0) { \nGradient1=Position_Object.z>0.0 ? g : 1.0;Gradient2=Position_Object.z>0.0 ? 1.0 : g;} else {Gradient1=g+(1.0-g)*(Radial_Gradient);Gradient2=1.0;}}\nvoid Object_To_World_Dir_B330(\nvec3 Dir_Object,\nout vec3 Binormal_World,\nout vec3 Binormal_World_N,\nout float Binormal_Length)\n{Binormal_World=(world*vec4(Dir_Object,0.0)).xyz;Binormal_Length=length(Binormal_World);Binormal_World_N=Binormal_World/Binormal_Length;}\nvoid RelativeOrAbsoluteDetail_B341(\nfloat Nominal_Radius,\nfloat Nominal_LineWidth,\nbool Absolute_Measurements,\nfloat Height,\nout float Radius,\nout float Line_Width)\n{float scale=Absolute_Measurements ? 1.0/Height : 1.0;Radius=Nominal_Radius*scale;Line_Width=Nominal_LineWidth*scale;}\nvoid main()\n{vec3 Nrm_World_Q326;Nrm_World_Q326=normalize((world*vec4(normal,0.0)).xyz);vec3 Tangent_World_Q329;vec3 Tangent_World_N_Q329;float Tangent_Length_Q329;Tangent_World_Q329=(world*vec4(vec3(1,0,0),0.0)).xyz;Tangent_Length_Q329=length(Tangent_World_Q329);Tangent_World_N_Q329=Tangent_World_Q329/Tangent_Length_Q329;vec3 Binormal_World_Q330;vec3 Binormal_World_N_Q330;float Binormal_Length_Q330;Object_To_World_Dir_B330(vec3(0,1,0),Binormal_World_Q330,Binormal_World_N_Q330,Binormal_Length_Q330);float Radius_Q341;float Line_Width_Q341;RelativeOrAbsoluteDetail_B341(_Radius_,_Line_Width_,_Absolute_Sizes_,Binormal_Length_Q330,Radius_Q341,Line_Width_Q341);vec3 Dir_Q334;PickDir_B334(_Angle_,Tangent_World_N_Q329,Binormal_World_N_Q330,Dir_Q334);float Result_Q336;Pick_Radius_B336(Radius_Q341,_Radius_Top_Left_,_Radius_Top_Right_,_Radius_Bottom_Left_,_Radius_Bottom_Right_,position,Result_Q336);float Anisotropy_Q331=Tangent_Length_Q329/Binormal_Length_Q330;vec4 Out_Color_Q337=vec4(Result_Q336,Line_Width_Q341,0,1);vec3 New_P_Q327;vec2 New_UV_Q327;float Radial_Gradient_Q327;vec3 Radial_Dir_Q327;Move_Verts_B327(Anisotropy_Q331,position,Result_Q336,New_P_Q327,New_UV_Q327,Radial_Gradient_Q327,Radial_Dir_Q327);vec3 Pos_World_Q314;Object_To_World_Pos_B314(New_P_Q327,Pos_World_Q314);float Gradient1_Q328;float Gradient2_Q328;\n#if SMOOTH_EDGES\nEdge_AA_Vertex_B328(Pos_World_Q314,position,normal,cameraPosition,Radial_Gradient_Q327,Radial_Dir_Q327,tangent,Gradient1_Q328,Gradient2_Q328);\n#else\nGradient1_Q328=1.0;Gradient2_Q328=1.0;\n#endif\nvec2 Rect_UV_Q357;vec4 Rect_Parms_Q357;vec2 Scale_XY_Q357;vec2 Line_UV_Q357;vec2 Color_UV_Info_Q357;Round_Rect_Vertex_B357(New_UV_Q327,Result_Q336,0.0,Anisotropy_Q331,Gradient1_Q328,Gradient2_Q328,normal,vec4(1,1,0,0),Rect_UV_Q357,Rect_Parms_Q357,Scale_XY_Q357,Line_UV_Q357,Color_UV_Info_Q357);vec3 Line_Vertex_Q333;Line_Vertex_B333(Scale_XY_Q357,Line_UV_Q357,(20.0),_Rate_,_Highlight_Transform_,Line_Vertex_Q333);float X_Q359;float Y_Q359;X_Q359=Color_UV_Info_Q357.x;Y_Q359=Color_UV_Info_Q357.y;vec4 Vec4_Q358=vec4(X_Q359,Y_Q359,Result_Q336,Line_Width_Q341);vec3 Position=Pos_World_Q314;vec3 Normal=Nrm_World_Q326;vec2 UV=Rect_UV_Q357;vec3 Tangent=Line_Vertex_Q333;vec3 Binormal=Dir_Q334;vec4 Color=Out_Color_Q337;vec4 Extra1=Rect_Parms_Q357;vec4 Extra2=Vec4_Q358;vec4 Extra3=vec4(0,0,0,0);gl_Position=viewProjection*vec4(Position,1);vPosition=Position;vNormal=Normal;vUV=UV;vTangent=Tangent;vBinormal=Binormal;vExtra1=Extra1;vExtra2=Extra2;}";var Xt=function(t){function e(){var e=t.call(this)||this;return e.IRIDESCENCE_ENABLE=!0,e.SMOOTH_EDGES=!0,e._needNormals=!0,e.rebuild(),e}return n(e,t),e}(h.MaterialDefines),Kt=function(t){function e(i,o){var r=t.call(this,i,o)||this;return r.radius=.3,r.lineWidth=.003,r.absoluteSizes=!1,r._filterWidth=1,r.baseColor=new h.Color4(0,0,0,1),r.lineColor=new h.Color4(.2,.262745,.4,1),r.radiusTopLeft=1,r.radiusTopRight=1,r.radiusBottomLeft=1,r.radiusBottomRight=1,r._rate=0,r.highlightColor=new h.Color4(.239216,.435294,.827451,1),r.highlightWidth=0,r._highlightTransform=new h.Vector4(1,1,0,0),r._highlight=1,r.iridescenceIntensity=.45,r.iridescenceEdgeIntensity=1,r.iridescenceTint=new h.Color4(1,1,1,1),r._angle=-45,r.fadeOut=1,r._reflected=!0,r._frequency=1,r._verticalOffset=0,r.gradientColor=new h.Color4(.74902,.74902,.74902,1),r.topLeftGradientColor=new h.Color4(.00784314,.294118,.580392,1),r.topRightGradientColor=new h.Color4(.305882,0,1,1),r.bottomLeftGradientColor=new h.Color4(.133333,.258824,.992157,1),r.bottomRightGradientColor=new h.Color4(.176471,.176471,.619608,1),r.edgeWidth=.5,r.edgePower=1,r.edgeLineGradientBlend=.5,r.alphaMode=h.Constants.ALPHA_DISABLE,r.backFaceCulling=!1,r._iridescentMapTexture=new h.Texture(e.IRIDESCENT_MAP_TEXTURE_URL,r.getScene(),!0,!1,h.Texture.NEAREST_SAMPLINGMODE),r}return n(e,t),e.prototype.needAlphaBlending=function(){return!1},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){var i=e._drawWrapper;if(this.isFrozen&&i.effect&&i._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new Xt);var o=e.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=r.getEngine();if((0,h.PrepareDefinesForAttributes)(t,o,!1,!1),o.isDirty){o.markAsProcessed(),r.resetCachedMaterial();var a=new h.EffectFallbacks;o.FOG&&a.addFallback(1,"FOG"),(0,h.HandleFallbacksForShadows)(o,a),o.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess;var s=[h.VertexBuffer.PositionKind];o.NORMAL&&s.push(h.VertexBuffer.NormalKind),o.UV1&&s.push(h.VertexBuffer.UVKind),o.UV2&&s.push(h.VertexBuffer.UV2Kind),o.VERTEXCOLOR&&s.push(h.VertexBuffer.ColorKind),o.TANGENT&&s.push(h.VertexBuffer.TangentKind),(0,h.PrepareAttributesForInstances)(s,o);var l=o.toString(),_=["world","viewProjection","cameraPosition","_Radius_","_Line_Width_","_Absolute_Sizes_","_Filter_Width_","_Base_Color_","_Line_Color_","_Radius_Top_Left_","_Radius_Top_Right_","_Radius_Bottom_Left_","_Radius_Bottom_Right_","_Rate_","_Highlight_Color_","_Highlight_Width_","_Highlight_Transform_","_Highlight_","_Iridescence_Intensity_","_Iridescence_Edge_Intensity_","_Iridescence_Tint_","_Iridescent_Map_","_Angle_","_Reflected_","_Frequency_","_Vertical_Offset_","_Gradient_Color_","_Top_Left_","_Top_Right_","_Bottom_Left_","_Bottom_Right_","_Edge_Width_","_Edge_Power_","_Line_Gradient_Blend_","_Fade_Out_"],c=["_Iridescent_Map_"],u=[];(0,h.PrepareUniformsAndSamplersList)({uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:o,maxSimultaneousLights:4}),e.setEffect(r.getEngine().createEffect("mrdlBackplate",{attributes:s,uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:l,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),o)}return!(!e.effect||!e.effect.isReady()||(o._renderId=r.getRenderId(),i._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){if(i.materialDefines){var o=i.effect;o&&(this._activeEffect=o,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",this.getScene().activeCamera.position),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Line_Width_",this.lineWidth),this._activeEffect.setFloat("_Absolute_Sizes_",this.absoluteSizes?1:0),this._activeEffect.setFloat("_Filter_Width_",this._filterWidth),this._activeEffect.setDirectColor4("_Base_Color_",this.baseColor),this._activeEffect.setDirectColor4("_Line_Color_",this.lineColor),this._activeEffect.setFloat("_Radius_Top_Left_",this.radiusTopLeft),this._activeEffect.setFloat("_Radius_Top_Right_",this.radiusTopRight),this._activeEffect.setFloat("_Radius_Bottom_Left_",this.radiusBottomLeft),this._activeEffect.setFloat("_Radius_Bottom_Right_",this.radiusBottomRight),this._activeEffect.setFloat("_Rate_",this._rate),this._activeEffect.setDirectColor4("_Highlight_Color_",this.highlightColor),this._activeEffect.setFloat("_Highlight_Width_",this.highlightWidth),this._activeEffect.setVector4("_Highlight_Transform_",this._highlightTransform),this._activeEffect.setFloat("_Highlight_",this._highlight),this._activeEffect.setFloat("_Iridescence_Intensity_",this.iridescenceIntensity),this._activeEffect.setFloat("_Iridescence_Edge_Intensity_",this.iridescenceEdgeIntensity),this._activeEffect.setDirectColor4("_Iridescence_Tint_",this.iridescenceTint),this._activeEffect.setTexture("_Iridescent_Map_",this._iridescentMapTexture),this._activeEffect.setFloat("_Angle_",this._angle),this._activeEffect.setFloat("_Reflected_",this._reflected?1:0),this._activeEffect.setFloat("_Frequency_",this._frequency),this._activeEffect.setFloat("_Vertical_Offset_",this._verticalOffset),this._activeEffect.setDirectColor4("_Gradient_Color_",this.gradientColor),this._activeEffect.setDirectColor4("_Top_Left_",this.topLeftGradientColor),this._activeEffect.setDirectColor4("_Top_Right_",this.topRightGradientColor),this._activeEffect.setDirectColor4("_Bottom_Left_",this.bottomLeftGradientColor),this._activeEffect.setDirectColor4("_Bottom_Right_",this.bottomRightGradientColor),this._activeEffect.setFloat("_Edge_Width_",this.edgeWidth),this._activeEffect.setFloat("_Edge_Power_",this.edgePower),this._activeEffect.setFloat("_Line_Gradient_Blend_",this.edgeLineGradientBlend),this._activeEffect.setFloat("_Fade_Out_",this.fadeOut),this._afterBind(e,this._activeEffect,i))}},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 h.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.MRDLBackplateMaterial",e},e.prototype.getClassName=function(){return"MRDLBackplateMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.IRIDESCENT_MAP_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/MRDL/mrtk-mrdl-backplate-iridescence.png",s([(0,h.serialize)()],e.prototype,"radius",void 0),s([(0,h.serialize)()],e.prototype,"lineWidth",void 0),s([(0,h.serialize)()],e.prototype,"absoluteSizes",void 0),s([(0,h.serialize)()],e.prototype,"baseColor",void 0),s([(0,h.serialize)()],e.prototype,"lineColor",void 0),s([(0,h.serialize)()],e.prototype,"radiusTopLeft",void 0),s([(0,h.serialize)()],e.prototype,"radiusTopRight",void 0),s([(0,h.serialize)()],e.prototype,"radiusBottomLeft",void 0),s([(0,h.serialize)()],e.prototype,"radiusBottomRight",void 0),s([(0,h.serialize)()],e.prototype,"highlightColor",void 0),s([(0,h.serialize)()],e.prototype,"highlightWidth",void 0),s([(0,h.serialize)()],e.prototype,"iridescenceIntensity",void 0),s([(0,h.serialize)()],e.prototype,"iridescenceEdgeIntensity",void 0),s([(0,h.serialize)()],e.prototype,"iridescenceTint",void 0),s([(0,h.serialize)()],e.prototype,"fadeOut",void 0),s([(0,h.serialize)()],e.prototype,"gradientColor",void 0),s([(0,h.serialize)()],e.prototype,"topLeftGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"topRightGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"bottomLeftGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"bottomRightGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"edgeWidth",void 0),s([(0,h.serialize)()],e.prototype,"edgePower",void 0),s([(0,h.serialize)()],e.prototype,"edgeLineGradientBlend",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.MRDLBackplateMaterial",Kt);var Zt=function(t){function e(e,i){var o=t.call(this,e)||this;return o.onValueChangedObservable=new h.Observable,o._sliderBackplateVisible=i||!1,o._minimum=0,o._maximum=100,o._step=0,o._value=50,o}return n(e,t),Object.defineProperty(e.prototype,"mesh",{get:function(){return this.node?this._sliderThumb:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minimum",{get:function(){return this._minimum},set:function(t){this._minimum!==t&&(this._minimum=Math.max(t,0),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=Math.max(t,this._minimum),this._value=Math.max(Math.min(this._value,this._maximum),this._minimum))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"step",{get:function(){return this._step},set:function(t){this._step!==t&&(this._step=Math.max(Math.min(t,this._maximum-this._minimum),0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(t){this._value!==t&&(this._value=Math.max(Math.min(t,this._maximum),this._minimum),this._sliderThumb&&(this._sliderThumb.position.x=this._convertToPosition(this.value)),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"start",{get:function(){return this.node?this._sliderBar.position.x-this._sliderBar.scaling.x/2:-.5},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this.node?this._sliderBar.position.x+this._sliderBar.scaling.x/2:.5},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliderBarMaterial",{get:function(){return this._sliderBarMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliderThumbMaterial",{get:function(){return this._sliderThumbMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliderBackplateMaterial",{get:function(){return this._sliderBackplateMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliderBar",{get:function(){return this._sliderBar},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliderThumb",{get:function(){return this._sliderThumb},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliderBackplate",{get:function(){return this._sliderBackplate},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isVisible",{set:function(t){var e;this._isVisible!==t&&(this._isVisible=t,null===(e=this.node)||void 0===e||e.setEnabled(t))},enumerable:!1,configurable:!0}),e.prototype._createNode=function(t){var i=this,o=(0,h.CreateBox)("".concat(this.name,"_sliderbackplate"),{width:1,height:1,depth:1},t);return o.isPickable=!1,o.visibility=0,o.scaling=new h.Vector3(1,.5,.8),h.SceneLoader.ImportMeshAsync(void 0,e.MODEL_BASE_URL,e.MODEL_FILENAME,t).then((function(t){t.meshes.forEach((function(t){t.isPickable=!1}));var e=t.meshes[1],r=t.meshes[1].clone("".concat(i.name,"_sliderbar"),o),n=t.meshes[1].clone("".concat(i.name,"_sliderthumb"),o);e.visibility=0,i._sliderBackplateVisible&&(e.visibility=1,e.name="".concat(i.name,"_sliderbackplate"),e.scaling.x=1,e.scaling.z=.2,e.parent=o,i._sliderBackplateMaterial&&(e.material=i._sliderBackplateMaterial),i._sliderBackplate=e),r&&(r.parent=o,r.position.z=-.1,r.scaling=new h.Vector3(.8,.04,.3),i._sliderBarMaterial&&(r.material=i._sliderBarMaterial),i._sliderBar=r),n&&(n.parent=o,n.isPickable=!0,n.position.z=-.115,n.scaling=new h.Vector3(.025,.3,.6),n.position.x=i._convertToPosition(i.value),n.addBehavior(i._createBehavior()),i._sliderThumbMaterial&&(n.material=i._sliderThumbMaterial),i._sliderThumb=n),i._injectGUI3DReservedDataStore(o).control=i,o.getChildMeshes().forEach((function(t){i._injectGUI3DReservedDataStore(t).control=i}))})),this._affectMaterial(o),o},e.prototype._affectMaterial=function(t){var e,i,o;this._sliderBackplateMaterial=null!==(e=this._sliderBackplateMaterial)&&void 0!==e?e:new Kt("".concat(this.name,"_sliderbackplate_material"),t.getScene()),this._sliderBarMaterial=null!==(i=this._sliderBarMaterial)&&void 0!==i?i:new Ut("".concat(this.name,"_sliderbar_material"),t.getScene()),this._sliderThumbMaterial=null!==(o=this._sliderThumbMaterial)&&void 0!==o?o:new Yt("".concat(this.name,"_sliderthumb_material"),t.getScene())},e.prototype._createBehavior=function(){var t=this,e=new h.PointerDragBehavior({dragAxis:h.Vector3.Right()});return e.moveAttached=!1,e.onDragStartObservable.add((function(){t._draggedPosition=t._sliderThumb.position.x})),e.onDragObservable.add((function(e){t._draggedPosition+=e.dragDistance/t.scaling.x,t.value=t._convertToValue(t._draggedPosition)})),e},e.prototype._convertToPosition=function(t){var e=(t-this.minimum)/(this.maximum-this.minimum)*(this.end-this.start)+this.start;return Math.min(Math.max(e,this.start),this.end)},e.prototype._convertToValue=function(t){var e=(t-this.start)/(this.end-this.start)*(this.maximum-this.minimum);return e=this.step?Math.round(e/this.step)*this.step:e,Math.max(Math.min(this.minimum+e,this._maximum),this._minimum)},e.prototype.dispose=function(){var e,i,o,r,n,a;t.prototype.dispose.call(this),null===(e=this._sliderBar)||void 0===e||e.dispose(),null===(i=this._sliderThumb)||void 0===i||i.dispose(),null===(o=this._sliderBarMaterial)||void 0===o||o.dispose(),null===(r=this._sliderThumbMaterial)||void 0===r||r.dispose(),null===(n=this._sliderBackplate)||void 0===n||n.dispose(),null===(a=this._sliderBackplateMaterial)||void 0===a||a.dispose()},e.MODEL_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",e.MODEL_FILENAME="mrtk-fluent-backplate.glb",e}(dt),qt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._radius=5,e}return n(e,t),Object.defineProperty(e.prototype,"radius",{get:function(){return this._radius},set:function(t){var e=this;this._radius!==t&&(this._radius=t,h.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._mapGridNode=function(t,e){var i=t.mesh;if(i){var o=this._sphericalMapping(e);switch(t.position=o,this.orientation){case bt.FACEORIGIN_ORIENTATION:i.lookAt(new h.Vector3(2*o.x,2*o.y,2*o.z));break;case bt.FACEORIGINREVERSED_ORIENTATION:i.lookAt(new h.Vector3(-o.x,-o.y,-o.z));break;case bt.FACEFORWARD_ORIENTATION:break;case bt.FACEFORWARDREVERSED_ORIENTATION:i.rotate(h.Axis.Y,Math.PI,0)}}},e.prototype._sphericalMapping=function(t){var e=new h.Vector3(0,0,this._radius),i=t.y/this._radius,o=-t.x/this._radius;return h.Matrix.RotationYawPitchRollToRef(o,i,0,h.TmpVectors.Matrix[0]),h.Vector3.TransformNormal(e,h.TmpVectors.Matrix[0])},e}(mt),Jt=function(t){function e(e){void 0===e&&(e=!1);var i=t.call(this)||this;return i._isVertical=!1,i.margin=.1,i._isVertical=e,i}return n(e,t),Object.defineProperty(e.prototype,"isVertical",{get:function(){return this._isVertical},set:function(t){var e=this;this._isVertical!==t&&(this._isVertical=t,h.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._arrangeChildren=function(){for(var t,e=0,i=0,o=0,r=[],n=h.Matrix.Invert(this.node.computeWorldMatrix(!0)),a=0,s=this._children;a<s.length;a++)if((f=s[a]).mesh){o++,f.mesh.computeWorldMatrix(!0),f.mesh.getWorldMatrix().multiplyToRef(n,h.TmpVectors.Matrix[0]);var l=f.mesh.getBoundingInfo().boundingBox,_=h.Vector3.TransformNormal(l.extendSize,h.TmpVectors.Matrix[0]);r.push(_),this._isVertical?i+=_.y:e+=_.x}this._isVertical?i+=(o-1)*this.margin/2:e+=(o-1)*this.margin/2,t=this._isVertical?-i:-e;for(var c=0,u=0,d=this._children;u<d.length;u++){var f;(f=d[u]).mesh&&(o--,_=r[c++],this._isVertical?(f.position.y=t+_.y,f.position.x=0,t+=2*_.y):(f.position.x=t+_.x,f.position.y=0,t+=2*_.x),t+=o>0?this.margin:0)}},e}(bt),$t=function(t){function e(e,i){var o=t.call(this,i,e)||this;return o._currentMesh=e,o.pointerEnterAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1.1)},o.pointerOutAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1/1.1)},o.pointerDownAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(.95)},o.pointerUpAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1/.95)},o}return n(e,t),e.prototype._getTypeName=function(){return"TouchMeshButton3D"},e.prototype._createNode=function(){var t=this;return this._currentMesh.getChildMeshes().forEach((function(e){t._injectGUI3DReservedDataStore(e).control=t})),this._currentMesh},e.prototype._affectMaterial=function(t){},e}(wt);h.ShaderStore.ShadersStore.mrdlBackglowPixelShader="uniform vec3 cameraPosition;varying vec3 vNormal;varying vec2 vUV;uniform float _Bevel_Radius_;uniform float _Line_Width_;uniform bool _Absolute_Sizes_;uniform float _Tuning_Motion_;uniform float _Motion_;uniform float _Max_Intensity_;uniform float _Intensity_Fade_In_Exponent_;uniform float _Outer_Fuzz_Start_;uniform float _Outer_Fuzz_End_;uniform vec4 _Color_;uniform vec4 _Inner_Color_;uniform float _Blend_Exponent_;uniform float _Falloff_;uniform float _Bias_;float BiasFunc(float b,float v) {return pow(v,log(clamp(b,0.001,0.999))/log(0.5));}\nvoid Fuzzy_Round_Rect_B33(\nfloat Size_X,\nfloat Size_Y,\nfloat Radius_X,\nfloat Radius_Y,\nfloat Line_Width,\nvec2 UV,\nfloat Outer_Fuzz,\nfloat Max_Outer_Fuzz,\nout float Rect_Distance,\nout float Inner_Distance)\n{vec2 halfSize=vec2(Size_X,Size_Y)*0.5;vec2 r=max(min(vec2(Radius_X,Radius_Y),halfSize),vec2(0.001,0.001));float radius=min(r.x,r.y)-Max_Outer_Fuzz;vec2 v=abs(UV);vec2 nearestp=min(v,halfSize-r);float d=distance(nearestp,v);Inner_Distance=clamp(1.0-(radius-d)/Line_Width,0.0,1.0);Rect_Distance=clamp(1.0-(d-radius)/Outer_Fuzz,0.0,1.0)*Inner_Distance;}\nvoid main()\n{float X_Q42;float Y_Q42;X_Q42=vNormal.x;Y_Q42=vNormal.y;float MaxAB_Q24=max(_Tuning_Motion_,_Motion_);float Sqrt_F_Q27=sqrt(MaxAB_Q24);float Power_Q43=pow(MaxAB_Q24,_Intensity_Fade_In_Exponent_);float Value_At_T_Q26=mix(_Outer_Fuzz_Start_,_Outer_Fuzz_End_,Sqrt_F_Q27);float Product_Q23=_Max_Intensity_*Power_Q43;float Rect_Distance_Q33;float Inner_Distance_Q33;Fuzzy_Round_Rect_B33(X_Q42,Y_Q42,_Bevel_Radius_,_Bevel_Radius_,_Line_Width_,vUV,Value_At_T_Q26,_Outer_Fuzz_Start_,Rect_Distance_Q33,Inner_Distance_Q33);float Power_Q44=pow(Inner_Distance_Q33,_Blend_Exponent_);float Result_Q45=pow(BiasFunc(_Bias_,Rect_Distance_Q33),_Falloff_);vec4 Color_At_T_Q25=mix(_Inner_Color_,_Color_,Power_Q44);float Product_Q22=Result_Q45*Product_Q23;vec4 Result_Q28=Product_Q22*Color_At_T_Q25;vec4 Out_Color=Result_Q28;float Clip_Threshold=0.0;gl_FragColor=Out_Color;}";h.ShaderStore.ShadersStore.mrdlBackglowVertexShader="uniform mat4 world;uniform mat4 viewProjection;uniform vec3 cameraPosition;attribute vec3 position;attribute vec3 normal;attribute vec2 uv;attribute vec3 tangent;uniform float _Bevel_Radius_;uniform float _Line_Width_;uniform bool _Absolute_Sizes_;uniform float _Tuning_Motion_;uniform float _Motion_;uniform float _Max_Intensity_;uniform float _Intensity_Fade_In_Exponent_;uniform float _Outer_Fuzz_Start_;uniform float _Outer_Fuzz_End_;uniform vec4 _Color_;uniform vec4 _Inner_Color_;uniform float _Blend_Exponent_;uniform float _Falloff_;uniform float _Bias_;varying vec3 vNormal;varying vec2 vUV;void main()\n{vec3 Dir_World_Q41=(world*vec4(tangent,0.0)).xyz;vec3 Dir_World_Q40=(world*vec4((cross(normal,tangent)),0.0)).xyz;float MaxAB_Q24=max(_Tuning_Motion_,_Motion_);float Length_Q16=length(Dir_World_Q41);float Length_Q17=length(Dir_World_Q40);bool Greater_Than_Q37=MaxAB_Q24>0.0;vec3 Sizes_Q35;vec2 XY_Q35;Sizes_Q35=(_Absolute_Sizes_ ? vec3(Length_Q16,Length_Q17,0) : vec3(Length_Q16/Length_Q17,1,0));XY_Q35=(uv-vec2(0.5,0.5))*Sizes_Q35.xy;vec3 Result_Q38=Greater_Than_Q37 ? position : vec3(0,0,0);vec3 Pos_World_Q39=(world*vec4(Result_Q38,1.0)).xyz;vec3 Position=Pos_World_Q39;vec3 Normal=Sizes_Q35;vec2 UV=XY_Q35;vec3 Tangent=vec3(0,0,0);vec3 Binormal=vec3(0,0,0);vec4 Color=vec4(1,1,1,1);gl_Position=viewProjection*vec4(Position,1);vNormal=Normal;vUV=UV;}";var te=function(t){function e(){var e=t.call(this)||this;return e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return n(e,t),e}(h.MaterialDefines),ee=function(t){function e(e,i){var o=t.call(this,e,i)||this;return o.bevelRadius=.16,o.lineWidth=.16,o.absoluteSizes=!1,o.tuningMotion=0,o.motion=1,o.maxIntensity=.7,o.intensityFadeInExponent=2,o.outerFuzzStart=.04,o.outerFuzzEnd=.04,o.color=new h.Color4(.682353,.698039,1,1),o.innerColor=new h.Color4(.356863,.392157,.796078,1),o.blendExponent=1.5,o.falloff=2,o.bias=.5,o.alphaMode=h.Constants.ALPHA_ADD,o.disableDepthWrite=!0,o.backFaceCulling=!1,o}return n(e,t),e.prototype.needAlphaBlending=function(){return!0},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){var i=e._drawWrapper;if(this.isFrozen&&i.effect&&i._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new te);var o=e.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=r.getEngine();if((0,h.PrepareDefinesForAttributes)(t,o,!1,!1),o.isDirty){o.markAsProcessed(),r.resetCachedMaterial();var a=new h.EffectFallbacks;o.FOG&&a.addFallback(1,"FOG"),(0,h.HandleFallbacksForShadows)(o,a),o.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess;var s=[h.VertexBuffer.PositionKind];o.NORMAL&&s.push(h.VertexBuffer.NormalKind),o.UV1&&s.push(h.VertexBuffer.UVKind),o.UV2&&s.push(h.VertexBuffer.UV2Kind),o.VERTEXCOLOR&&s.push(h.VertexBuffer.ColorKind),o.TANGENT&&s.push(h.VertexBuffer.TangentKind),(0,h.PrepareAttributesForInstances)(s,o);var l=o.toString(),_=["world","worldView","worldViewProjection","view","projection","viewProjection","cameraPosition","_Bevel_Radius_","_Line_Width_","_Absolute_Sizes_","_Tuning_Motion_","_Motion_","_Max_Intensity_","_Intensity_Fade_In_Exponent_","_Outer_Fuzz_Start_","_Outer_Fuzz_End_","_Color_","_Inner_Color_","_Blend_Exponent_","_Falloff_","_Bias_"],c=[],u=[];(0,h.PrepareUniformsAndSamplersList)({uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:o,maxSimultaneousLights:4}),e.setEffect(r.getEngine().createEffect("mrdlBackglow",{attributes:s,uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:l,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),o)}return!(!e.effect||!e.effect.isReady()||(o._renderId=r.getRenderId(),i._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o=this.getScene();if(i.materialDefines){var r=i.effect;r&&(this._activeEffect=r,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",o.activeCamera.position),this._activeEffect.setFloat("_Bevel_Radius_",this.bevelRadius),this._activeEffect.setFloat("_Line_Width_",this.lineWidth),this._activeEffect.setFloat("_Absolute_Sizes_",this.absoluteSizes?1:0),this._activeEffect.setFloat("_Tuning_Motion_",this.tuningMotion),this._activeEffect.setFloat("_Motion_",this.motion),this._activeEffect.setFloat("_Max_Intensity_",this.maxIntensity),this._activeEffect.setFloat("_Intensity_Fade_In_Exponent_",this.intensityFadeInExponent),this._activeEffect.setFloat("_Outer_Fuzz_Start_",this.outerFuzzStart),this._activeEffect.setFloat("_Outer_Fuzz_End_",this.outerFuzzEnd),this._activeEffect.setDirectColor4("_Color_",this.color),this._activeEffect.setDirectColor4("_Inner_Color_",this.innerColor),this._activeEffect.setFloat("_Blend_Exponent_",this.blendExponent),this._activeEffect.setFloat("_Falloff_",this.falloff),this._activeEffect.setFloat("_Bias_",this.bias),this._afterBind(e,this._activeEffect,i))}},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 h.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var t=h.SerializationHelper.Serialize(this);return t.customType="BABYLON.MRDLBackglowMaterial",t},e.prototype.getClassName=function(){return"MRDLBackglowMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},s([(0,h.serialize)()],e.prototype,"bevelRadius",void 0),s([(0,h.serialize)()],e.prototype,"lineWidth",void 0),s([(0,h.serialize)()],e.prototype,"absoluteSizes",void 0),s([(0,h.serialize)()],e.prototype,"tuningMotion",void 0),s([(0,h.serialize)()],e.prototype,"motion",void 0),s([(0,h.serialize)()],e.prototype,"maxIntensity",void 0),s([(0,h.serialize)()],e.prototype,"intensityFadeInExponent",void 0),s([(0,h.serialize)()],e.prototype,"outerFuzzStart",void 0),s([(0,h.serialize)()],e.prototype,"outerFuzzEnd",void 0),s([(0,h.serialize)()],e.prototype,"color",void 0),s([(0,h.serialize)()],e.prototype,"innerColor",void 0),s([(0,h.serialize)()],e.prototype,"blendExponent",void 0),s([(0,h.serialize)()],e.prototype,"falloff",void 0),s([(0,h.serialize)()],e.prototype,"bias",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.MRDLBackglowMaterial",ee);h.ShaderStore.ShadersStore.mrdlFrontplatePixelShader="uniform vec3 cameraPosition;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec4 vExtra1;varying vec4 vExtra2;varying vec4 vExtra3;uniform float _Radius_;uniform float _Line_Width_;uniform bool _Relative_To_Height_;uniform float _Filter_Width_;uniform vec4 _Edge_Color_;uniform float _Fade_Out_;uniform bool _Smooth_Edges_;uniform bool _Blob_Enable_;uniform vec3 _Blob_Position_;uniform float _Blob_Intensity_;uniform float _Blob_Near_Size_;uniform float _Blob_Far_Size_;uniform float _Blob_Near_Distance_;uniform float _Blob_Far_Distance_;uniform float _Blob_Fade_Length_;uniform float _Blob_Inner_Fade_;uniform float _Blob_Pulse_;uniform float _Blob_Fade_;uniform float _Blob_Pulse_Max_Size_;uniform bool _Blob_Enable_2_;uniform vec3 _Blob_Position_2_;uniform float _Blob_Near_Size_2_;uniform float _Blob_Inner_Fade_2_;uniform float _Blob_Pulse_2_;uniform float _Blob_Fade_2_;uniform float _Gaze_Intensity_;uniform float _Gaze_Focus_;uniform sampler2D _Blob_Texture_;uniform float _Selection_Fuzz_;uniform float _Selected_;uniform float _Selection_Fade_;uniform float _Selection_Fade_Size_;uniform float _Selected_Distance_;uniform float _Selected_Fade_Length_;uniform float _Proximity_Max_Intensity_;uniform float _Proximity_Far_Distance_;uniform float _Proximity_Near_Radius_;uniform float _Proximity_Anisotropy_;uniform bool _Use_Global_Left_Index_;uniform bool _Use_Global_Right_Index_;uniform vec4 Global_Left_Index_Tip_Position;uniform vec4 Global_Right_Index_Tip_Position;void Scale_Color_B54(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{Result=Scalar*Color;}\nvoid Scale_RGB_B50(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{Result=vec4(Scalar,Scalar,Scalar,1)*Color;}\nvoid Proximity_Fragment_B51(\nfloat Proximity_Max_Intensity,\nfloat Proximity_Near_Radius,\nvec4 Deltas,\nfloat Show_Selection,\nfloat Distance_Fade1,\nfloat Distance_Fade2,\nfloat Strength,\nout float Proximity)\n{float proximity1=(1.0-clamp(length(Deltas.xy)/Proximity_Near_Radius,0.0,1.0))*Distance_Fade1;float proximity2=(1.0-clamp(length(Deltas.zw)/Proximity_Near_Radius,0.0,1.0))*Distance_Fade2;Proximity=Strength*(Proximity_Max_Intensity*max(proximity1,proximity2) *(1.0-Show_Selection)+Show_Selection);}\nvoid Blob_Fragment_B56(\nvec2 UV,\nvec3 Blob_Info,\nsampler2D Blob_Texture,\nout vec4 Blob_Color)\n{float k=dot(UV,UV);Blob_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));}\nvoid Round_Rect_Fragment_B61(\nfloat Radius,\nvec4 Line_Color,\nfloat Filter_Width,\nfloat Line_Visibility,\nvec4 Fill_Color,\nbool Smooth_Edges,\nvec4 Rect_Parms,\nout float Inside_Rect)\n{float d=length(max(abs(Rect_Parms.zw)-Rect_Parms.xy,0.0));float dx=max(fwidth(d)*Filter_Width,0.00001);Inside_Rect=Smooth_Edges ? clamp((Radius-d)/dx,0.0,1.0) : 1.0-step(Radius,d);}\nvoid main()\n{float Is_Quad_Q53;Is_Quad_Q53=vNormal.z;vec4 Blob_Color_Q56;Blob_Fragment_B56(vUV,vTangent,_Blob_Texture_,Blob_Color_Q56);float X_Q52;float Y_Q52;float Z_Q52;float W_Q52;X_Q52=vExtra3.x;Y_Q52=vExtra3.y;Z_Q52=vExtra3.z;W_Q52=vExtra3.w;float Proximity_Q51;Proximity_Fragment_B51(_Proximity_Max_Intensity_,_Proximity_Near_Radius_,vExtra2,X_Q52,Y_Q52,Z_Q52,1.0,Proximity_Q51);float Inside_Rect_Q61;Round_Rect_Fragment_B61(W_Q52,vec4(1,1,1,1),_Filter_Width_,1.0,vec4(0,0,0,0),_Smooth_Edges_,vExtra1,Inside_Rect_Q61);vec4 Result_Q50;Scale_RGB_B50(_Edge_Color_,Proximity_Q51,Result_Q50);vec4 Result_Q47=Inside_Rect_Q61*Blob_Color_Q56;vec4 Color_At_T_Q48=mix(Result_Q50,Result_Q47,Is_Quad_Q53);vec4 Result_Q54;Scale_Color_B54(Color_At_T_Q48,_Fade_Out_,Result_Q54);vec4 Out_Color=Result_Q54;float Clip_Threshold=0.001;bool To_sRGB=false;gl_FragColor=Out_Color;}";h.ShaderStore.ShadersStore.mrdlFrontplateVertexShader="uniform mat4 world;uniform mat4 viewProjection;uniform vec3 cameraPosition;attribute vec3 position;attribute vec3 normal;attribute vec2 uv;attribute vec3 tangent;attribute vec4 color;uniform float _Radius_;uniform float _Line_Width_;uniform bool _Relative_To_Height_;uniform float _Filter_Width_;uniform vec4 _Edge_Color_;uniform float _Fade_Out_;uniform bool _Smooth_Edges_;uniform bool _Blob_Enable_;uniform vec3 _Blob_Position_;uniform float _Blob_Intensity_;uniform float _Blob_Near_Size_;uniform float _Blob_Far_Size_;uniform float _Blob_Near_Distance_;uniform float _Blob_Far_Distance_;uniform float _Blob_Fade_Length_;uniform float _Blob_Inner_Fade_;uniform float _Blob_Pulse_;uniform float _Blob_Fade_;uniform float _Blob_Pulse_Max_Size_;uniform bool _Blob_Enable_2_;uniform vec3 _Blob_Position_2_;uniform float _Blob_Near_Size_2_;uniform float _Blob_Inner_Fade_2_;uniform float _Blob_Pulse_2_;uniform float _Blob_Fade_2_;uniform float _Gaze_Intensity_;uniform float _Gaze_Focus_;uniform sampler2D _Blob_Texture_;uniform float _Selection_Fuzz_;uniform float _Selected_;uniform float _Selection_Fade_;uniform float _Selection_Fade_Size_;uniform float _Selected_Distance_;uniform float _Selected_Fade_Length_;uniform float _Proximity_Max_Intensity_;uniform float _Proximity_Far_Distance_;uniform float _Proximity_Near_Radius_;uniform float _Proximity_Anisotropy_;uniform bool _Use_Global_Left_Index_;uniform bool _Use_Global_Right_Index_;uniform vec4 Global_Left_Index_Tip_Position;uniform vec4 Global_Right_Index_Tip_Position;varying vec3 vNormal;varying vec2 vUV;varying vec3 vTangent;varying vec4 vExtra1;varying vec4 vExtra2;varying vec4 vExtra3;void Blob_Vertex_B40(\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,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nfloat Blob_Enabled,\nfloat DistanceOffset,\nout vec3 Out_Position,\nout vec2 Out_UV,\nout vec3 Blob_Info,\nout vec2 Blob_Relative_UV)\n{float blobSize,fadeIn;vec3 Hit_Position;Blob_Info=vec3(0.0,0.0,0.0);float Hit_Distance=dot(Blob_Position-Face_Center,Normal)+DistanceOffset*Blob_Far_Distance;Hit_Position=Blob_Position-Hit_Distance*Normal;float absD=abs(Hit_Distance);float lerpVal=clamp((absD-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);fadeIn=1.0-clamp((absD-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);float innerFade=1.0-clamp(-Hit_Distance/Inner_Fade,0.0,1.0);float farClip=clamp(1.0-step(Blob_Far_Distance+Blob_Fade_Length,absD),0.0,1.0);float size=mix(Blob_Near_Size,Blob_Far_Size,lerpVal)*farClip;blobSize=mix(size,Selection_Fade_Size,Selection_Fade)*innerFade*Blob_Enabled;Blob_Info.x=lerpVal*0.5+0.5;Blob_Info.y=fadeIn*Intensity*(1.0-Selection_Fade)*Blob_Fade;Blob_Info.x*=(1.0-Blob_Pulse);vec3 delta=Hit_Position-Face_Center;vec2 blobCenterXY=vec2(dot(delta,Tangent),dot(delta,Bitangent));vec2 quadUVin=2.0*UV-1.0; \nvec2 blobXY=blobCenterXY+quadUVin*blobSize;vec2 blobClipped=clamp(blobXY,-Face_Size*0.5,Face_Size*0.5);vec2 blobUV=(blobClipped-blobCenterXY)/max(blobSize,0.0001)*2.0;vec3 blobCorner=Face_Center+blobClipped.x*Tangent+blobClipped.y*Bitangent;Out_Position=mix(Position,blobCorner,Vx_Color.rrr);Out_UV=mix(In_UV,blobUV,Vx_Color.rr);Blob_Relative_UV=blobClipped/Face_Size.y;}\nvoid Round_Rect_Vertex_B36(\nvec2 UV,\nvec3 Tangent,\nvec3 Binormal,\nfloat Radius,\nfloat Anisotropy,\nvec2 Blob_Center_UV,\nout vec2 Rect_UV,\nout vec2 Scale_XY,\nout vec4 Rect_Parms)\n{Scale_XY=vec2(Anisotropy,1.0);Rect_UV=(UV-vec2(0.5,0.5))*Scale_XY;Rect_Parms.xy=Scale_XY*0.5-vec2(Radius,Radius);Rect_Parms.zw=Blob_Center_UV;}\nvec2 ProjectProximity(\nvec3 blobPosition,\nvec3 position,\nvec3 center,\nvec3 dir,\nvec3 xdir,\nvec3 ydir,\nout float vdistance\n)\n{vec3 delta=blobPosition-position;vec2 xy=vec2(dot(delta,xdir),dot(delta,ydir));vdistance=abs(dot(delta,dir));return xy;}\nvoid Proximity_Vertex_B33(\nvec3 Blob_Position,\nvec3 Blob_Position_2,\nvec3 Face_Center,\nvec3 Position,\nfloat Proximity_Far_Distance,\nfloat Relative_Scale,\nfloat Proximity_Anisotropy,\nvec3 Normal,\nvec3 Tangent,\nvec3 Binormal,\nout vec4 Extra,\nout float Distance_To_Face,\nout float Distance_Fade1,\nout float Distance_Fade2)\n{float distz1,distz2;Extra.xy=ProjectProximity(Blob_Position,Position,Face_Center,Normal,Tangent*Proximity_Anisotropy,Binormal,distz1)/Relative_Scale;Extra.zw=ProjectProximity(Blob_Position_2,Position,Face_Center,Normal,Tangent*Proximity_Anisotropy,Binormal,distz2)/Relative_Scale;Distance_To_Face=dot(Normal,Position-Face_Center);Distance_Fade1=1.0-clamp(distz1/Proximity_Far_Distance,0.0,1.0);Distance_Fade2=1.0-clamp(distz2/Proximity_Far_Distance,0.0,1.0);}\nvoid Object_To_World_Pos_B12(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{Pos_World=(world*vec4(Pos_Object,1.0)).xyz;}\nvoid Choose_Blob_B27(\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{Position=Position1*(1.0-Vx_Color.g)+Vx_Color.g*Position2;float b1=Blob_Enable_1 ? 1.0 : 0.0;float b2=Blob_Enable_2 ? 1.0 : 0.0;Blob_Enable=b1+(b2-b1)*Vx_Color.g;Pulse=Blob_Pulse_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Pulse_2;Fade=Blob_Fade_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Fade_2;Near_Size=Near_Size_1*(1.0-Vx_Color.g)+Vx_Color.g*Near_Size_2;Inner_Fade=Blob_Inner_Fade_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Inner_Fade_2;}\nvoid Move_Verts_B32(\nvec2 UV,\nfloat Radius,\nfloat Anisotropy,\nfloat Line_Width,\nfloat Visible,\nout vec3 New_P,\nout vec2 New_UV)\n{vec2 xy=2.0*UV-vec2(0.5,0.5);vec2 center=clamp(xy,0.0,1.0);vec2 delta=2.0*(xy-center);float deltaLength=length(delta);vec2 aniso=vec2(1.0/Anisotropy,1.0);center=(center-vec2(0.5,0.5))*(1.0-2.0*Radius*aniso);New_UV=vec2((2.0-2.0*deltaLength)*Visible,0.0);float deltaRadius= (Radius-Line_Width*New_UV.x);New_P.xy=(center+deltaRadius/deltaLength *aniso*delta);New_P.z=0.0;}\nvoid Object_To_World_Dir_B14(\nvec3 Dir_Object,\nout vec3 Binormal_World)\n{Binormal_World=(world*vec4(Dir_Object,0.0)).xyz;}\nvoid Proximity_Visibility_B55(\nfloat Selection,\nvec3 Proximity_Center,\nvec3 Proximity_Center_2,\nfloat Proximity_Far_Distance,\nfloat Proximity_Radius,\nvec3 Face_Center,\nvec3 Normal,\nvec2 Face_Size,\nfloat Gaze,\nout float Width)\n{float boxMaxSize=length(Face_Size)*0.5;float d1=dot(Proximity_Center-Face_Center,Normal);vec3 blob1=Proximity_Center-d1*Normal;float d2=dot(Proximity_Center_2-Face_Center,Normal);vec3 blob2=Proximity_Center_2-d2*Normal;vec3 delta1=blob1-Face_Center;vec3 delta2=blob2-Face_Center;float dist1=dot(delta1,delta1);float dist2=dot(delta2,delta2);float nearestProxDist=sqrt(min(dist1,dist2));Width=(1.0-step(boxMaxSize+Proximity_Radius,nearestProxDist))*(1.0-step(Proximity_Far_Distance,min(d1,d2))*(1.0-step(0.0001,Selection)));Width=max(Gaze,Width);}\nvec2 ramp2(vec2 start,vec2 end,vec2 x)\n{return clamp((x-start)/(end-start),vec2(0.0,0.0),vec2(1.0,1.0));}\nfloat computeSelection(\nvec3 blobPosition,\nvec3 normal,\nvec3 tangent,\nvec3 bitangent,\nvec3 faceCenter,\nvec2 faceSize,\nfloat selectionFuzz,\nfloat farDistance,\nfloat fadeLength\n)\n{vec3 delta=blobPosition-faceCenter;float absD=abs(dot(delta,normal));float fadeIn=1.0-clamp((absD-farDistance)/fadeLength,0.0,1.0);vec2 blobCenterXY=vec2(dot(delta,tangent),dot(delta,bitangent));vec2 innerFace=faceSize*(1.0-selectionFuzz)*0.5;vec2 selectPulse=ramp2(-faceSize*0.5,-innerFace,blobCenterXY)-ramp2(innerFace,faceSize*0.5,blobCenterXY);return selectPulse.x*selectPulse.y*fadeIn;}\nvoid Selection_Vertex_B31(\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{float select1=computeSelection(Blob_Position,Normal,Tangent,Bitangent,Face_Center,Face_Size,Selection_Fuzz,Far_Distance,Fade_Length);float select2=computeSelection(Blob_Position_2,Normal,Tangent,Bitangent,Face_Center,Face_Size,Selection_Fuzz,Far_Distance,Fade_Length);Show_Selection=mix(max(select1,select2),1.0,Selected);}\nvoid main()\n{vec3 Vec3_Q29=vec3(vec2(0,0).x,vec2(0,0).y,color.r);vec3 Nrm_World_Q24;Nrm_World_Q24=normalize((world*vec4(normal,0.0)).xyz);vec3 Face_Center_Q30;Face_Center_Q30=(world*vec4(vec3(0,0,0),1.0)).xyz;vec3 Tangent_World_Q13;Tangent_World_Q13=(world*vec4(tangent,0.0)).xyz;vec3 Result_Q42;Result_Q42=_Use_Global_Left_Index_ ? Global_Left_Index_Tip_Position.xyz : _Blob_Position_;vec3 Result_Q43;Result_Q43=_Use_Global_Right_Index_ ? Global_Right_Index_Tip_Position.xyz : _Blob_Position_2_;float Value_At_T_Q58=mix(_Blob_Near_Size_,_Blob_Pulse_Max_Size_,_Blob_Pulse_);float Value_At_T_Q59=mix(_Blob_Near_Size_2_,_Blob_Pulse_Max_Size_,_Blob_Pulse_2_);vec3 Cross_Q70=cross(normal,tangent);float Product_Q45=_Gaze_Intensity_*_Gaze_Focus_;float Step_Q46=step(0.0001,Product_Q45);vec3 Tangent_World_N_Q15=normalize(Tangent_World_Q13);vec3 Position_Q27;float Near_Size_Q27;float Inner_Fade_Q27;float Blob_Enable_Q27;float Fade_Q27;float Pulse_Q27;Choose_Blob_B27(color,Result_Q42,Result_Q43,_Blob_Enable_,_Blob_Enable_2_,Value_At_T_Q58,Value_At_T_Q59,_Blob_Inner_Fade_,_Blob_Inner_Fade_2_,_Blob_Pulse_,_Blob_Pulse_2_,_Blob_Fade_,_Blob_Fade_2_,Position_Q27,Near_Size_Q27,Inner_Fade_Q27,Blob_Enable_Q27,Fade_Q27,Pulse_Q27);vec3 Binormal_World_Q14;Object_To_World_Dir_B14(Cross_Q70,Binormal_World_Q14);float Anisotropy_Q21=length(Tangent_World_Q13)/length(Binormal_World_Q14);vec3 Binormal_World_N_Q16=normalize(Binormal_World_Q14);vec2 Face_Size_Q35;float ScaleY_Q35;Face_Size_Q35=vec2(length(Tangent_World_Q13),length(Binormal_World_Q14));ScaleY_Q35=Face_Size_Q35.y;float Out_Radius_Q38;float Out_Line_Width_Q38;Out_Radius_Q38=_Relative_To_Height_ ? _Radius_ : _Radius_/ScaleY_Q35;Out_Line_Width_Q38=_Relative_To_Height_ ? _Line_Width_ : _Line_Width_/ScaleY_Q35;float Show_Selection_Q31;Selection_Vertex_B31(Result_Q42,Result_Q43,Face_Center_Q30,Face_Size_Q35,Nrm_World_Q24,Tangent_World_N_Q15,Binormal_World_N_Q16,_Selection_Fuzz_,_Selected_,_Selected_Distance_,_Selected_Fade_Length_,vec3(0,0,-1),Show_Selection_Q31);float MaxAB_Q41=max(Show_Selection_Q31,Product_Q45);float Width_Q55;Proximity_Visibility_B55(Show_Selection_Q31,Result_Q42,Result_Q43,_Proximity_Far_Distance_,_Proximity_Near_Radius_,Face_Center_Q30,Nrm_World_Q24,Face_Size_Q35,Step_Q46,Width_Q55);vec3 New_P_Q32;vec2 New_UV_Q32;Move_Verts_B32(uv,Out_Radius_Q38,Anisotropy_Q21,Out_Line_Width_Q38,Width_Q55,New_P_Q32,New_UV_Q32);vec3 Pos_World_Q12;Object_To_World_Pos_B12(New_P_Q32,Pos_World_Q12);vec3 Out_Position_Q40;vec2 Out_UV_Q40;vec3 Blob_Info_Q40;vec2 Blob_Relative_UV_Q40;Blob_Vertex_B40(Pos_World_Q12,Nrm_World_Q24,Tangent_World_N_Q15,Binormal_World_N_Q16,Position_Q27,_Blob_Intensity_,Near_Size_Q27,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,color,uv,Face_Center_Q30,Face_Size_Q35,New_UV_Q32,_Blob_Fade_Length_,_Selection_Fade_,_Selection_Fade_Size_,Inner_Fade_Q27,Pulse_Q27,Fade_Q27,Blob_Enable_Q27,0.0,Out_Position_Q40,Out_UV_Q40,Blob_Info_Q40,Blob_Relative_UV_Q40);vec2 Rect_UV_Q36;vec2 Scale_XY_Q36;vec4 Rect_Parms_Q36;Round_Rect_Vertex_B36(New_UV_Q32,Tangent_World_Q13,Binormal_World_Q14,Out_Radius_Q38,Anisotropy_Q21,Blob_Relative_UV_Q40,Rect_UV_Q36,Scale_XY_Q36,Rect_Parms_Q36);vec4 Extra_Q33;float Distance_To_Face_Q33;float Distance_Fade1_Q33;float Distance_Fade2_Q33;Proximity_Vertex_B33(Result_Q42,Result_Q43,Face_Center_Q30,Pos_World_Q12,_Proximity_Far_Distance_,1.0,_Proximity_Anisotropy_,Nrm_World_Q24,Tangent_World_N_Q15,Binormal_World_N_Q16,Extra_Q33,Distance_To_Face_Q33,Distance_Fade1_Q33,Distance_Fade2_Q33);vec4 Vec4_Q37=vec4(MaxAB_Q41,Distance_Fade1_Q33,Distance_Fade2_Q33,Out_Radius_Q38);vec3 Position=Out_Position_Q40;vec3 Normal=Vec3_Q29;vec2 UV=Out_UV_Q40;vec3 Tangent=Blob_Info_Q40;vec3 Binormal=vec3(0,0,0);vec4 Color=vec4(1,1,1,1);vec4 Extra1=Rect_Parms_Q36;vec4 Extra2=Extra_Q33;vec4 Extra3=Vec4_Q37;gl_Position=viewProjection*vec4(Position,1);vNormal=Normal;vUV=UV;vTangent=Tangent;vExtra1=Extra1;vExtra2=Extra2;vExtra3=Extra3;}";var ie=function(t){function e(){var e=t.call(this)||this;return e.SMOOTH_EDGES=!0,e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return n(e,t),e}(h.MaterialDefines),oe=function(t){function e(i,o){var r=t.call(this,i,o)||this;return r.radius=.12,r.lineWidth=.01,r.relativeToHeight=!1,r._filterWidth=1,r.edgeColor=new h.Color4(.53,.53,.53,1),r.blobEnable=!0,r.blobPosition=new h.Vector3(100,100,100),r.blobIntensity=.5,r.blobNearSize=.032,r.blobFarSize=.048,r.blobNearDistance=.008,r.blobFarDistance=.064,r.blobFadeLength=.04,r.blobInnerFade=.01,r.blobPulse=0,r.blobFade=1,r.blobPulseMaxSize=.05,r.blobEnable2=!0,r.blobPosition2=new h.Vector3(10,10.1,-.6),r.blobNearSize2=.008,r.blobInnerFade2=.1,r.blobPulse2=0,r.blobFade2=1,r.gazeIntensity=.8,r.gazeFocus=0,r.selectionFuzz=.5,r.selected=1,r.selectionFade=.2,r.selectionFadeSize=0,r.selectedDistance=.08,r.selectedFadeLength=.08,r.proximityMaxIntensity=.45,r.proximityFarDistance=.16,r.proximityNearRadius=.016,r.proximityAnisotropy=1,r.useGlobalLeftIndex=!0,r.useGlobalRightIndex=!0,r.fadeOut=1,r.alphaMode=h.Constants.ALPHA_ADD,r.disableDepthWrite=!0,r.backFaceCulling=!1,r._blobTexture=new h.Texture(e.BLOB_TEXTURE_URL,o,!0,!1,h.Texture.NEAREST_SAMPLINGMODE),r}return n(e,t),e.prototype.needAlphaBlending=function(){return!0},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){var i=e._drawWrapper;if(this.isFrozen&&i.effect&&i._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new ie);var o=e.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=r.getEngine();if((0,h.PrepareDefinesForAttributes)(t,o,!1,!1),o.isDirty){o.markAsProcessed(),r.resetCachedMaterial();var a=new h.EffectFallbacks;o.FOG&&a.addFallback(1,"FOG"),(0,h.HandleFallbacksForShadows)(o,a),o.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess;var s=[h.VertexBuffer.PositionKind];o.NORMAL&&s.push(h.VertexBuffer.NormalKind),o.UV1&&s.push(h.VertexBuffer.UVKind),o.UV2&&s.push(h.VertexBuffer.UV2Kind),o.VERTEXCOLOR&&s.push(h.VertexBuffer.ColorKind),o.TANGENT&&s.push(h.VertexBuffer.TangentKind),(0,h.PrepareAttributesForInstances)(s,o);var l=o.toString(),_=["world","worldView","worldViewProjection","view","projection","viewProjection","cameraPosition","_Radius_","_Line_Width_","_Relative_To_Height_","_Filter_Width_","_Edge_Color_","_Fade_Out_","_Smooth_Edges_","_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_Pulse_Max_Size_","_Blob_Enable_2_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Inner_Fade_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Gaze_Intensity_","_Gaze_Focus_","_Blob_Texture_","_Selection_Fuzz_","_Selected_","_Selection_Fade_","_Selection_Fade_Size_","_Selected_Distance_","_Selected_Fade_Length_","_Proximity_Max_Intensity_","_Proximity_Far_Distance_","_Proximity_Near_Radius_","_Proximity_Anisotropy_","Global_Left_Index_Tip_Position","Global_Right_Index_Tip_Position","_Use_Global_Left_Index_","_Use_Global_Right_Index_"],c=[],u=[];(0,h.PrepareUniformsAndSamplersList)({uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:o,maxSimultaneousLights:4}),e.setEffect(r.getEngine().createEffect("mrdlFrontplate",{attributes:s,uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:l,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),o)}return!(!e.effect||!e.effect.isReady()||(o._renderId=r.getRenderId(),i._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o=this.getScene();if(i.materialDefines){var r=i.effect;r&&(this._activeEffect=r,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",o.activeCamera.position),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Line_Width_",this.lineWidth),this._activeEffect.setFloat("_Relative_To_Height_",this.relativeToHeight?1:0),this._activeEffect.setFloat("_Filter_Width_",this._filterWidth),this._activeEffect.setDirectColor4("_Edge_Color_",this.edgeColor),this._activeEffect.setFloat("_Fade_Out_",this.fadeOut),this._activeEffect.setFloat("_Blob_Enable_",this.blobEnable?1:0),this._activeEffect.setVector3("_Blob_Position_",this.blobPosition),this._activeEffect.setFloat("_Blob_Intensity_",this.blobIntensity),this._activeEffect.setFloat("_Blob_Near_Size_",this.blobNearSize),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.blobInnerFade),this._activeEffect.setFloat("_Blob_Pulse_",this.blobPulse),this._activeEffect.setFloat("_Blob_Fade_",this.blobFade),this._activeEffect.setFloat("_Blob_Pulse_Max_Size_",this.blobPulseMaxSize),this._activeEffect.setFloat("_Blob_Enable_2_",this.blobEnable2?1:0),this._activeEffect.setVector3("_Blob_Position_2_",this.blobPosition2),this._activeEffect.setFloat("_Blob_Near_Size_2_",this.blobNearSize2),this._activeEffect.setFloat("_Blob_Inner_Fade_2_",this.blobInnerFade2),this._activeEffect.setFloat("_Blob_Pulse_2_",this.blobPulse2),this._activeEffect.setFloat("_Blob_Fade_2_",this.blobFade2),this._activeEffect.setFloat("_Gaze_Intensity_",this.gazeIntensity),this._activeEffect.setFloat("_Gaze_Focus_",this.gazeFocus),this._activeEffect.setTexture("_Blob_Texture_",this._blobTexture),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("_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("_Use_Global_Left_Index_",this.useGlobalLeftIndex?1:0),this._activeEffect.setFloat("_Use_Global_Right_Index_",this.useGlobalRightIndex?1:0),this._afterBind(e,this._activeEffect,i))}},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 h.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var t=h.SerializationHelper.Serialize(this);return t.customType="BABYLON.MRDLFrontplateMaterial",t},e.prototype.getClassName=function(){return"MRDLFrontplateMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.BLOB_TEXTURE_URL="",s([(0,h.serialize)()],e.prototype,"radius",void 0),s([(0,h.serialize)()],e.prototype,"lineWidth",void 0),s([(0,h.serialize)()],e.prototype,"relativeToHeight",void 0),s([(0,h.serialize)()],e.prototype,"edgeColor",void 0),s([(0,h.serialize)()],e.prototype,"blobEnable",void 0),s([(0,h.serialize)()],e.prototype,"blobPosition",void 0),s([(0,h.serialize)()],e.prototype,"blobIntensity",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize",void 0),s([(0,h.serialize)()],e.prototype,"blobFarSize",void 0),s([(0,h.serialize)()],e.prototype,"blobNearDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFarDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFadeLength",void 0),s([(0,h.serialize)()],e.prototype,"blobInnerFade",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse",void 0),s([(0,h.serialize)()],e.prototype,"blobFade",void 0),s([(0,h.serialize)()],e.prototype,"blobPulseMaxSize",void 0),s([(0,h.serialize)()],e.prototype,"blobEnable2",void 0),s([(0,h.serialize)()],e.prototype,"blobPosition2",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize2",void 0),s([(0,h.serialize)()],e.prototype,"blobInnerFade2",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse2",void 0),s([(0,h.serialize)()],e.prototype,"blobFade2",void 0),s([(0,h.serialize)()],e.prototype,"gazeIntensity",void 0),s([(0,h.serialize)()],e.prototype,"gazeFocus",void 0),s([(0,h.serialize)()],e.prototype,"selectionFuzz",void 0),s([(0,h.serialize)()],e.prototype,"selected",void 0),s([(0,h.serialize)()],e.prototype,"selectionFade",void 0),s([(0,h.serialize)()],e.prototype,"selectionFadeSize",void 0),s([(0,h.serialize)()],e.prototype,"selectedDistance",void 0),s([(0,h.serialize)()],e.prototype,"selectedFadeLength",void 0),s([(0,h.serialize)()],e.prototype,"proximityMaxIntensity",void 0),s([(0,h.serialize)()],e.prototype,"proximityFarDistance",void 0),s([(0,h.serialize)()],e.prototype,"proximityNearRadius",void 0),s([(0,h.serialize)()],e.prototype,"proximityAnisotropy",void 0),s([(0,h.serialize)()],e.prototype,"useGlobalLeftIndex",void 0),s([(0,h.serialize)()],e.prototype,"useGlobalRightIndex",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.MRDLFrontplateMaterial",oe);h.ShaderStore.ShadersStore.mrdlInnerquadPixelShader="uniform vec3 cameraPosition;varying vec2 vUV;varying vec3 vTangent;uniform vec4 _Color_;uniform float _Radius_;uniform bool _Fixed_Radius_;uniform float _Filter_Width_;uniform float _Glow_Fraction_;uniform float _Glow_Max_;uniform float _Glow_Falloff_;float FilterStep_Bid194(float edge,float x,float filterWidth)\n{float dx=max(1.0E-5,fwidth(x)*filterWidth);return max((x+dx*0.5-max(edge,x-dx*0.5))/dx,0.0);}\nvoid Round_Rect_B194(\nfloat Size_X,\nfloat Size_Y,\nfloat Radius,\nvec4 Rect_Color,\nfloat Filter_Width,\nvec2 UV,\nfloat Glow_Fraction,\nfloat Glow_Max,\nfloat Glow_Falloff,\nout vec4 Color)\n{vec2 halfSize=vec2(Size_X,Size_Y)*0.5;vec2 r=max(min(vec2(Radius,Radius),halfSize),vec2(0.01,0.01));vec2 v=abs(UV);vec2 nearestp=min(v,halfSize-r);vec2 delta=(v-nearestp)/max(vec2(0.01,0.01),r);float Distance=length(delta);float insideRect=1.0-FilterStep_Bid194(1.0-Glow_Fraction,Distance,Filter_Width);float glow=clamp((1.0-Distance)/Glow_Fraction,0.0,1.0);glow=pow(glow,Glow_Falloff);Color=Rect_Color*max(insideRect,glow*Glow_Max);}\nvoid main()\n{float X_Q192;float Y_Q192;float Z_Q192;X_Q192=vTangent.x;Y_Q192=vTangent.y;Z_Q192=vTangent.z;vec4 Color_Q194;Round_Rect_B194(X_Q192,1.0,Y_Q192,_Color_,_Filter_Width_,vUV,_Glow_Fraction_,_Glow_Max_,_Glow_Falloff_,Color_Q194);vec4 Out_Color=Color_Q194;float Clip_Threshold=0.0;gl_FragColor=Out_Color;}\n";h.ShaderStore.ShadersStore.mrdlInnerquadVertexShader="uniform mat4 world;uniform mat4 viewProjection;uniform vec3 cameraPosition;attribute vec3 position;attribute vec3 normal;attribute vec2 uv;attribute vec3 tangent;attribute vec4 color;uniform vec4 _Color_;uniform float _Radius_;uniform bool _Fixed_Radius_;uniform float _Filter_Width_;uniform float _Glow_Fraction_;uniform float _Glow_Max_;uniform float _Glow_Falloff_;varying vec2 vUV;varying vec3 vTangent;void main()\n{vec3 Pos_World_Q189;Pos_World_Q189=(world*vec4(position,1.0)).xyz;vec3 Dir_World_Q190;Dir_World_Q190=(world*vec4(tangent,0.0)).xyz;vec3 Dir_World_Q191;Dir_World_Q191=(world*vec4((cross(normal,tangent)),0.0)).xyz;float Length_Q180=length(Dir_World_Q190);float Length_Q181=length(Dir_World_Q191);float Quotient_Q184=Length_Q180/Length_Q181;float Quotient_Q195=_Radius_/Length_Q181;vec2 Result_Q193;Result_Q193=vec2((uv.x-0.5)*Length_Q180/Length_Q181,(uv.y-0.5));float Result_Q198=_Fixed_Radius_ ? Quotient_Q195 : _Radius_;vec3 Vec3_Q183=vec3(Quotient_Q184,Result_Q198,0);vec3 Position=Pos_World_Q189;vec3 Normal=vec3(0,0,0);vec2 UV=Result_Q193;vec3 Tangent=Vec3_Q183;vec3 Binormal=vec3(0,0,0);vec4 Color=color;gl_Position=viewProjection*vec4(Position,1);vUV=UV;vTangent=Tangent;}\n";var re=function(t){function e(){var e=t.call(this)||this;return e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return n(e,t),e}(h.MaterialDefines),ne=function(t){function e(e,i){var o=t.call(this,e,i)||this;return o.color=new h.Color4(1,1,1,.05),o.radius=.12,o.fixedRadius=!0,o._filterWidth=1,o.glowFraction=0,o.glowMax=.5,o.glowFalloff=2,o.alphaMode=h.Constants.ALPHA_COMBINE,o.backFaceCulling=!1,o}return n(e,t),e.prototype.needAlphaBlending=function(){return!0},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){var i=e._drawWrapper;if(this.isFrozen&&i.effect&&i._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new re);var o=e.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=r.getEngine();if((0,h.PrepareDefinesForAttributes)(t,o,!0,!1),o.isDirty){o.markAsProcessed(),r.resetCachedMaterial();var a=new h.EffectFallbacks;o.FOG&&a.addFallback(1,"FOG"),(0,h.HandleFallbacksForShadows)(o,a),o.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess;var s=[h.VertexBuffer.PositionKind];o.NORMAL&&s.push(h.VertexBuffer.NormalKind),o.UV1&&s.push(h.VertexBuffer.UVKind),o.UV2&&s.push(h.VertexBuffer.UV2Kind),o.VERTEXCOLOR&&s.push(h.VertexBuffer.ColorKind),o.TANGENT&&s.push(h.VertexBuffer.TangentKind),(0,h.PrepareAttributesForInstances)(s,o);var l=o.toString(),_=["world","worldView","worldViewProjection","view","projection","viewProjection","cameraPosition","_Color_","_Radius_","_Fixed_Radius_","_Filter_Width_","_Glow_Fraction_","_Glow_Max_","_Glow_Falloff_"],c=[],u=[];(0,h.PrepareUniformsAndSamplersList)({uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:o,maxSimultaneousLights:4}),e.setEffect(r.getEngine().createEffect("mrdlInnerquad",{attributes:s,uniformsNames:_,uniformBuffersNames:u,samplers:c,defines:l,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),o)}return!(!e.effect||!e.effect.isReady()||(o._renderId=r.getRenderId(),i._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o=this.getScene();if(i.materialDefines){var r=i.effect;r&&(this._activeEffect=r,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",o.activeCamera.position),this._activeEffect.setDirectColor4("_Color_",this.color),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Fixed_Radius_",this.fixedRadius?1:0),this._activeEffect.setFloat("_Filter_Width_",this._filterWidth),this._activeEffect.setFloat("_Glow_Fraction_",this.glowFraction),this._activeEffect.setFloat("_Glow_Max_",this.glowMax),this._activeEffect.setFloat("_Glow_Falloff_",this.glowFalloff),this._afterBind(e,this._activeEffect,i))}},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 h.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var t=h.SerializationHelper.Serialize(this);return t.customType="BABYLON.MRDLInnerquadMaterial",t},e.prototype.getClassName=function(){return"MRDLInnerquadMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},s([(0,h.serialize)()],e.prototype,"color",void 0),s([(0,h.serialize)()],e.prototype,"radius",void 0),s([(0,h.serialize)()],e.prototype,"fixedRadius",void 0),s([(0,h.serialize)()],e.prototype,"glowFraction",void 0),s([(0,h.serialize)()],e.prototype,"glowMax",void 0),s([(0,h.serialize)()],e.prototype,"glowFalloff",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.MRDLInnerquadMaterial",ne);var ae=function(t){function e(e,i){void 0===i&&(i=!0);var o=t.call(this,e)||this;return o.width=1,o.height=1,o.radius=.14,o.textSizeInPixels=18,o.imageSizeInPixels=40,o.plateMaterialColor=new h.Color3(.4,.4,.4),o.frontPlateDepth=.2,o.backPlateDepth=.04,o.backGlowOffset=.1,o.flatPlaneDepth=.001,o.innerQuadRadius=o.radius-.04,o.innerQuadColor=new h.Color4(0,0,0,0),o.innerQuadToggledColor=new h.Color4(.5197843,.6485234,.9607843,.6),o.innerQuadHoverColor=new h.Color4(1,1,1,.05),o.innerQuadToggledHoverColor=new h.Color4(.5197843,.6485234,.9607843,1),o._isBackplateVisible=!0,o._shareMaterials=!0,o._shareMaterials=i,o.pointerEnterAnimation=function(){o._frontPlate&&o._textPlate&&!o.isToggleButton&&o._performEnterExitAnimation(1),o.isToggleButton&&o._innerQuadMaterial&&(o.isToggled?o._innerQuadMaterial.color=o.innerQuadToggledHoverColor:o._innerQuadMaterial.color=o.innerQuadHoverColor)},o.pointerOutAnimation=function(){o._frontPlate&&o._textPlate&&!o.isToggleButton&&o._performEnterExitAnimation(-.8),o.isToggleButton&&o._innerQuadMaterial&&o._onToggle(o.isToggled)},o.pointerDownAnimation=function(){},o.pointerUpAnimation=function(){},o._pointerClickObserver=o.onPointerClickObservable.add((function(){o._frontPlate&&o._backGlow&&!o.isActiveNearInteraction&&o._performClickAnimation(),o.isToggleButton&&o._innerQuadMaterial&&o._onToggle(o.isToggled)})),o._pointerEnterObserver=o.onPointerEnterObservable.add((function(){o.pointerEnterAnimation()})),o._pointerOutObserver=o.onPointerOutObservable.add((function(){o.pointerOutAnimation()})),o._toggleObserver=o.onToggleObservable.add((function(t){o._innerQuadMaterial.color=t?o.innerQuadToggledColor:o.innerQuadColor})),o}return n(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._backGlow.renderingGroupId=t,this._innerQuad.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(){var t;return(null===(t=this._tooltipTextBlock)||void 0===t?void 0:t.text)||null},set:function(t){var e=this;if(t){if(!this._tooltipFade){var i=this._backPlate._scene.useRightHandedSystem;this._tooltipMesh=(0,h.CreatePlane)("",{size:1},this._backPlate._scene),this._tooltipMesh.position=h.Vector3.Down().scale(.7).add(h.Vector3.Forward(i).scale(-.15)),this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._frontPlateCollisionMesh,this._tooltipTexture=lt.CreateForMesh(this._tooltipMesh);var o=new I;o.height=.25,o.width=.8,o.cornerRadius=25,o.color="#ffffff",o.thickness=20,o.background="#060668",this._tooltipTexture.addControl(o),this._tooltipTextBlock=new B,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=100,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new h.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,"subtext",{get:function(){return this._subtext},set:function(t){this._subtext!==t&&(this._subtext=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,"backGlowMaterial",{get:function(){return this._backGlowMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"innerQuadMaterial",{get:function(){return this._innerQuadMaterial},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(){var t;t=this._getAspectRatio()<=1?this._alignContentVertically():this._alignContentHorizontally(),this.content=t},e.prototype._getAspectRatio=function(){return this.width/this.height},e.prototype._alignContentVertically=function(){var t=new S;if(t.isVertical=!0,(0,h.IsDocumentAvailable)()&&document.createElement&&this._imageUrl){var e=new C;e.source=this._imageUrl,e.heightInPixels=180,e.widthInPixels=100,e.paddingTopInPixels=40,e.paddingBottomInPixels=40,t.addControl(e)}if(this._text){var i=new B;i.text=this._text,i.color="white",i.heightInPixels=30,i.fontSize=24,t.addControl(i)}return t},e.prototype._alignContentHorizontally=function(){var t=240,e=15,i=new I;i.widthInPixels=t,i.heightInPixels=t,i.color="transparent",i.setPaddingInPixels(e,e,e,e),t-=30;var o=new S;if(o.isVertical=!1,o.scaleY=this._getAspectRatio(),(0,h.IsDocumentAvailable)()&&document.createElement&&this._imageUrl){var r=new I("".concat(this.name,"_image"));r.widthInPixels=this.imageSizeInPixels,r.heightInPixels=this.imageSizeInPixels,r.color="transparent",t-=this.imageSizeInPixels;var n=new C;n.source=this._imageUrl,r.addControl(n),o.addControl(r)}if(this._text){var a=new B("".concat(this.name,"_text"));if(a.text=this._text,a.color="white",a.fontSize=this.textSizeInPixels,a.widthInPixels=t,this._imageUrl&&(a.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,a.paddingLeftInPixels=e),this._subtext){var s=new M;s.addColumnDefinition(1),s.addRowDefinition(.5),s.addRowDefinition(.5),s.widthInPixels=t,s.heightInPixels=45;var l=new B("".concat(this.name,"_subtext"));l.text=this._subtext,l.color="#EEEEEEAB",l.fontSize=.75*this.textSizeInPixels,l.fontWeight="600",this._imageUrl&&(l.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,l.paddingLeftInPixels=e),s.addControl(a,0),s.addControl(l,1),o.addControl(s)}else o.addControl(a)}return i.addControl(o),i},e.prototype._createNode=function(e){var i;this.name=null!==(i=this.name)&&void 0!==i?i:"TouchHolographicButton";var o=this._createBackPlate(e),r=this._createFrontPlate(e),n=this._createInnerQuad(e),a=this._createBackGlow(e);this._frontPlateCollisionMesh=r,this._textPlate=t.prototype._createNode.call(this,e),this._textPlate.name="".concat(this.name,"_textPlate"),this._textPlate.isPickable=!1,this._textPlate.scaling.x=this.width,this._textPlate.parent=r,this._backPlate=o,this._backPlate.position=h.Vector3.Forward(e.useRightHandedSystem).scale(this.backPlateDepth/2),this._backPlate.isPickable=!1,this._backPlate.addChild(r),this._backPlate.addChild(n),a&&this._backPlate.addChild(a);var s=new h.TransformNode("".concat(this.name,"_root"),e);return this._backPlate.setParent(s),this.collisionMesh=r,this.collidableFrontDirection=this._backPlate.forward.negate(),s},e.prototype._createBackPlate=function(t){var i=this,o=(0,h.CreateBox)("".concat(this.name,"_backPlate"),{},t);return o.isPickable=!1,o.visibility=0,o.scaling.z=.2,h.SceneLoader.ImportMeshAsync(void 0,e.MRTK_ASSET_BASE_URL,e.BACKPLATE_MODEL_FILENAME,t).then((function(t){var e=t.meshes[1];e.visibility=0,i._isBackplateVisible&&(e.visibility=1,e.name="".concat(i.name,"_backPlate"),e.isPickable=!1,e.scaling.x=i.width,e.scaling.y=i.height,e.parent=o),i._backMaterial&&(e.material=i._backMaterial),i._backPlate=e})),o},e.prototype._createFrontPlate=function(t){var i=this,o=(0,h.CreateBox)("".concat(this.name,"_frontPlate"),{width:this.width,height:this.height,depth:this.frontPlateDepth},t);return o.isPickable=!0,o.isNearPickable=!0,o.visibility=0,o.position=h.Vector3.Forward(t.useRightHandedSystem).scale((this.backPlateDepth-this.frontPlateDepth)/2),h.SceneLoader.ImportMeshAsync(void 0,e.MRTK_ASSET_BASE_URL,e.FRONTPLATE_MODEL_FILENAME,t).then((function(e){var r=(0,h.CreateBox)("".concat(i.name,"_collisionPlate"),{width:i.width,height:i.height},t);r.isPickable=!1,r.scaling.z=i.frontPlateDepth,r.visibility=0,r.parent=o,i._collisionPlate=r;var n=e.meshes[1];n.name="".concat(i.name,"_frontPlate"),n.isPickable=!1,n.scaling.x=i.width-i.backGlowOffset,n.scaling.y=i.height-i.backGlowOffset,n.position=h.Vector3.Forward(t.useRightHandedSystem).scale(-.5),n.parent=r,i.isToggleButton&&(n.visibility=0),i._frontMaterial&&(n.material=i._frontMaterial),i._textPlate.scaling.x=1,i._textPlate.parent=n,i._frontPlate=n})),o},e.prototype._createInnerQuad=function(t){var i=this,o=(0,h.CreateBox)("".concat(this.name,"_innerQuad"),{},t);return o.isPickable=!1,o.visibility=0,o.scaling.z=this.flatPlaneDepth,o.position.z+=this.backPlateDepth/2-this.flatPlaneDepth,h.SceneLoader.ImportMeshAsync(void 0,e.MRTK_ASSET_BASE_URL,e.INNERQUAD_MODEL_FILENAME,t).then((function(t){var e=t.meshes[1];e.name="".concat(i.name,"_innerQuad"),e.isPickable=!1,e.scaling.x=i.width-i.backGlowOffset,e.scaling.y=i.height-i.backGlowOffset,e.parent=o,i._innerQuadMaterial&&(e.material=i._innerQuadMaterial),i._innerQuad=e})),o},e.prototype._createBackGlow=function(t){var i=this;if(!this.isToggleButton){var o=(0,h.CreateBox)("".concat(this.name,"_backGlow"),{},t);return o.isPickable=!1,o.visibility=0,o.scaling.z=this.flatPlaneDepth,o.position.z+=this.backPlateDepth/2-2*this.flatPlaneDepth,h.SceneLoader.ImportMeshAsync(void 0,e.MRTK_ASSET_BASE_URL,e.BACKGLOW_MODEL_FILENAME,t).then((function(t){var e=t.meshes[1];e.name="".concat(i.name,"_backGlow"),e.isPickable=!1,e.scaling.x=i.width-i.backGlowOffset,e.scaling.y=i.height-i.backGlowOffset,e.parent=o,i._backGlowMaterial&&(e.material=i._backGlowMaterial),i._backGlow=e})),o}},e.prototype._applyFacade=function(t){this._plateMaterial.emissiveTexture=t,this._plateMaterial.opacityTexture=t,this._plateMaterial.diffuseColor=this.plateMaterialColor},e.prototype._performClickAnimation=function(){for(var t=new h.AnimationGroup("Click Animation Group"),e=0,i=[{name:"backGlowMotion",mesh:this._backGlow,property:"material.motion",keys:[{frame:0,values:[0,0,0]},{frame:20,values:[1,.0144,.0144]},{frame:40,values:[.0027713229489760476,0,0]},{frame:45,values:[.0027713229489760476]}]},{name:"_collisionPlateZSlide",mesh:this._collisionPlate,property:"position.z",keys:[{frame:0,values:[0,0,0]},{frame:20,values:[h.Vector3.Forward(this._collisionPlate._scene.useRightHandedSystem).scale(this.frontPlateDepth/2).z,0,0]},{frame:40,values:[0,.005403332496794331]},{frame:45,values:[0]}]},{name:"_collisionPlateZScale",mesh:this._collisionPlate,property:"scaling.z",keys:[{frame:0,values:[this.frontPlateDepth,0,0]},{frame:20,values:[this.backPlateDepth,0,0]},{frame:40,values:[this.frontPlateDepth,.0054]},{frame:45,values:[this.frontPlateDepth]}]}];e<i.length;e++){for(var o=i[e],r=new h.Animation(o.name,o.property,60,h.Animation.ANIMATIONTYPE_FLOAT,h.Animation.ANIMATIONLOOPMODE_CYCLE),n=[],a=0,s=o.keys;a<s.length;a++){var l=s[a];n.push({frame:l.frame,value:l.values[0],inTangent:l.values[1],outTangent:l.values[2],interpolation:l.values[3]})}r.setKeys(n),o.mesh&&t.addTargetedAnimation(r,o.mesh)}t.normalize(0,45),t.speedRatio=1,t.play()},e.prototype._performEnterExitAnimation=function(t){for(var e=new h.AnimationGroup("Enter Exit Animation Group"),i=0,o=[{name:"frontPlateFadeOut",mesh:this._frontPlate,property:"material.fadeOut",keys:[{frame:0,values:[0,0,.025045314830017686,0]},{frame:40,values:[1.00205599570012,.025045314830017686,0,0]}]},{name:"textPlateZSlide",mesh:this._textPlate,property:"position.z",keys:[{frame:0,values:[0,0,0]},{frame:40,values:[h.Vector3.Forward(this._textPlate._scene.useRightHandedSystem).scale(-.15).z,0,0]}]}];i<o.length;i++){for(var r=o[i],n=new h.Animation(r.name,r.property,60,h.Animation.ANIMATIONTYPE_FLOAT,h.Animation.ANIMATIONLOOPMODE_CYCLE),a=[],s=0,l=r.keys;s<l.length;s++){var _=l[s];a.push({frame:_.frame,value:_.values[0],inTangent:_.values[1],outTangent:_.values[2],interpolation:_.values[3]})}n.setKeys(a),r.mesh&&e.addTargetedAnimation(n,r.mesh)}e.normalize(0,45),e.speedRatio=t,e.play()},e.prototype._createBackMaterial=function(t){var e;this._backMaterial=null!==(e=this._backMaterial)&&void 0!==e?e:new Kt(this.name+"backPlateMaterial",t.getScene()),this._backMaterial.absoluteSizes=!0,this._backMaterial.radius=this.radius,this._backMaterial.lineWidth=.02},e.prototype._createFrontMaterial=function(t){var e;this._frontMaterial=null!==(e=this._frontMaterial)&&void 0!==e?e:new oe(this.name+"Front Material",t.getScene()),this.frontMaterial.radius=this.innerQuadRadius,this.frontMaterial.fadeOut=0},e.prototype._createBackGlowMaterial=function(t){var e,i=this.radius+.04;this._backGlowMaterial=null!==(e=this._backGlowMaterial)&&void 0!==e?e:new ee(this.name+"Back Glow Material",t.getScene()),this._backGlowMaterial.bevelRadius=i,this._backGlowMaterial.lineWidth=i,this._backGlowMaterial.motion=0},e.prototype._createInnerQuadMaterial=function(t){var e;this._innerQuadMaterial=null!==(e=this._innerQuadMaterial)&&void 0!==e?e:new ne("inner_quad",t.getScene()),this._innerQuadMaterial.radius=this.innerQuadRadius,this.isToggleButton&&(this._innerQuadMaterial.color=this.innerQuadColor)},e.prototype._createPlateMaterial=function(t){var e;this._plateMaterial=null!==(e=this._plateMaterial)&&void 0!==e?e:new h.StandardMaterial(this.name+"Plate Material",t.getScene()),this._plateMaterial.specularColor=h.Color3.Black()},e.prototype._onToggle=function(e){t.prototype._onToggle.call(this,e)},e.prototype._affectMaterial=function(t){this._shareMaterials?(this._host._touchSharedMaterials.mrdlBackplateMaterial?this._backMaterial=this._host._touchSharedMaterials.mrdlBackplateMaterial:(this._createBackMaterial(t),this._host._touchSharedMaterials.mrdlBackplateMaterial=this._backMaterial),this._host._touchSharedMaterials.mrdlFrontplateMaterial?this._frontMaterial=this._host._touchSharedMaterials.mrdlFrontplateMaterial:(this._createFrontMaterial(t),this._host._touchSharedMaterials.mrdlFrontplateMaterial=this._frontMaterial),this._host._touchSharedMaterials.mrdlBackglowMaterial?this._backGlowMaterial=this._host._touchSharedMaterials.mrdlBackglowMaterial:(this._createBackGlowMaterial(t),this._host._touchSharedMaterials.mrdlBackglowMaterial=this._backGlowMaterial),this._host._touchSharedMaterials.mrdlInnerQuadMaterial?this._innerQuadMaterial=this._host._touchSharedMaterials.mrdlInnerQuadMaterial:(this._createInnerQuadMaterial(t),this._host._touchSharedMaterials.mrdlInnerQuadMaterial=this._innerQuadMaterial)):(this._createBackMaterial(t),this._createFrontMaterial(t),this._createBackGlowMaterial(t),this._createInnerQuadMaterial(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._backGlow&&(this._backGlow.material=this._backGlowMaterial),this._innerQuad&&(this._innerQuad.material=this._innerQuadMaterial),this._rebuildContent()},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._disposeTooltip(),this.onPointerClickObservable.remove(this._pointerClickObserver),this.onPointerEnterObservable.remove(this._pointerEnterObserver),this.onPointerOutObservable.remove(this._pointerOutObserver),this.onToggleObservable.remove(this._toggleObserver),this.shareMaterials||(this._backMaterial.dispose(),this._frontMaterial.dispose(),this._plateMaterial.dispose(),this._backGlowMaterial.dispose(),this._innerQuadMaterial.dispose(),this._pickedPointObserver&&(this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver),this._pickedPointObserver=null))},e.MRTK_ASSET_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",e.FRONTPLATE_MODEL_FILENAME="mrtk-fluent-frontplate.glb",e.BACKPLATE_MODEL_FILENAME="mrtk-fluent-backplate.glb",e.BACKGLOW_MODEL_FILENAME="mrtk-fluent-button.glb",e.INNERQUAD_MODEL_FILENAME="SlateProximity.glb",e}(wt),se=function(){function t(t){var e=this;this._customControlScaling=1,this._lastControlOver={},this._lastControlDown={},this.onPickedPointChangedObservable=new h.Observable,this.onPickingObservable=new h.Observable,this._sharedMaterials={},this._touchSharedMaterials={},this._scene=t||h.EngineStore.LastCreatedScene,this._sceneDisposeObserver=this._scene.onDisposeObservable.add((function(){e._sceneDisposeObserver=null,e._utilityLayer=null,e.dispose()})),this._utilityLayer=h.UtilityLayerRenderer._CreateDefaultUtilityLayerFromScene(this._scene),this._utilityLayer.onlyCheckPointerDownEvents=!1,this._utilityLayer.pickUtilitySceneFirst=!1,this._utilityLayer.mainSceneTrackerPredicate=function(t){var e,i,o;return t&&(null===(o=null===(i=null===(e=t.reservedDataStore)||void 0===e?void 0:e.GUI3D)||void 0===i?void 0:i.control)||void 0===o?void 0:o._node)},this._rootContainer=new bt("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){e._doPicking(t)})),this._utilityLayer.utilityLayerScene.autoClear=!1,this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil=!1,new h.HemisphericLight("hemi",h.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,o;if(!this._utilityLayer||!this._utilityLayer.shouldRender||!this._utilityLayer.utilityLayerScene.activeCamera)return!1;var r=t.event,n=r.pointerId||0,a=r.button,s=t.pickInfo;if(s&&this.onPickingObservable.notifyObservers(s.pickedMesh),!s||!s.hit)return this._handlePointerOut(n,t.type===h.PointerEventTypes.POINTERUP),!1;s.pickedPoint&&this.onPickedPointChangedObservable.notifyObservers(s.pickedPoint);var l=null===(i=null===(e=s.pickedMesh.reservedDataStore)||void 0===e?void 0:e.GUI3D)||void 0===i?void 0:i.control;return l&&!l._processObservables(t.type,s.pickedPoint,(null===(o=s.originMesh)||void 0===o?void 0:o.position)||null,n,a)&&t.type===h.PointerEventTypes.POINTERMOVE&&(this._lastControlOver[n]&&this._lastControlOver[n]._onPointerOut(this._lastControlOver[n]),delete this._lastControlOver[n]),t.type===h.PointerEventTypes.POINTERUP&&(this._lastControlDown[r.pointerId]&&(this._lastControlDown[r.pointerId].forcePointerUp(),delete this._lastControlDown[r.pointerId]),("touch"===r.pointerType||"xr"===r.pointerType&&this._scene.getEngine().hostInformation.isMobile)&&this._handlePointerOut(n,!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)Object.prototype.hasOwnProperty.call(this._sharedMaterials,t)&&this._sharedMaterials[t].dispose();for(var t in this._sharedMaterials={},this._touchSharedMaterials)Object.prototype.hasOwnProperty.call(this._touchSharedMaterials,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}(),le=void 0!==o.g?o.g:"undefined"!=typeof window?window:void 0;void 0!==le&&(le.BABYLON=le.BABYLON||{},le.BABYLON.GUI||(le.BABYLON.GUI=t));const _e=e})(),r.default})()));
2
2
  //# sourceMappingURL=babylon.gui.min.js.map