var INSPECTOR;!(function(e){var t=(function(){function t(n,r,i,o,s){void 0===i&&(i=0),void 0===o&&(o=null);var a=this;if(this._popupMode=!1,BABYLON.GUI?e.loadGUIProperties():BABYLON.Tools.LoadScript("https://preview.babylonjs.com/gui/babylon.gui.js",(function(){e.loadGUIProperties()}),(function(){console.warn("Please add script https://preview.babylonjs.com/gui/babylon.gui.js to the HTML file")})),this._initialTab=i,this._parentElement=o,this._scene=n,t.DOCUMENT=window.document,t.WINDOW=window,r)this.openPopup(!0);else{var p=this._scene.getEngine().getRenderingCanvas(),c=p.parentElement,l=t.WINDOW.getComputedStyle(p);if(this._canvasStyle={width:e.Helpers.Css(p,"width"),height:e.Helpers.Css(p,"height"),position:l.position,top:l.top,bottom:l.bottom,left:l.left,right:l.right,padding:l.padding,paddingBottom:l.paddingBottom,paddingLeft:l.paddingLeft,paddingTop:l.paddingTop,paddingRight:l.paddingRight,margin:l.margin,marginBottom:l.marginBottom,marginLeft:l.marginLeft,marginTop:l.marginTop,marginRight:l.marginRight},this._parentElement){this._c2diwrapper=e.Helpers.CreateDiv("insp-wrapper",this._parentElement),this._c2diwrapper.style.width="100%",this._c2diwrapper.style.height="100%",this._c2diwrapper.style.paddingLeft="5px";var u=e.Helpers.CreateDiv("insp-right-panel",this._c2diwrapper);u.style.width="100%",u.style.height="100%",this._buildInspector(u)}else{this._c2diwrapper=e.Helpers.CreateDiv("insp-wrapper");for(var _ in this._canvasStyle)this._c2diwrapper.style[_]=this._canvasStyle[_];if(!l.width||!l.height||!l.left)return;var h=parseFloat(l.width.substr(0,l.width.length-2))||0,d=parseFloat(l.height.substr(0,l.height.length-2))||0;if("absolute"===l.position||"relative"===l.position){var f=parseFloat(l.left.substr(0,l.left.length-2))||0;h+f>=t.WINDOW.innerWidth&&(this._c2diwrapper.style.maxWidth=h-f+"px")}var v=this._getRelativeParent(p),y=v.clientWidth,b=v.clientHeight,m=h/y*100,g=d/b*100;this._c2diwrapper.style.width=m+"%",this._c2diwrapper.style.height=g+"%",p.style.position="static",p.style.width="100%",p.style.height="100%",p.style.paddingBottom="0",p.style.paddingLeft="0",p.style.paddingTop="0",p.style.paddingRight="0",p.style.margin="0",p.style.marginBottom="0",p.style.marginLeft="0",p.style.marginTop="0",p.style.marginRight="0",c&&c.replaceChild(this._c2diwrapper,p),this._c2diwrapper.appendChild(p);var u=e.Helpers.CreateDiv("insp-right-panel",this._c2diwrapper);this._parentElement||Split([p,u],{direction:"horizontal",sizes:[75,25],onDrag:function(){e.Helpers.SEND_EVENT("resize"),a._tabbar&&a._tabbar.updateWidth()}}),this._buildInspector(u)}e.Helpers.SEND_EVENT("resize"),this._tabbar.updateWidth()}if(e.Helpers.IsBrowserEdge()||this.refresh(),s)for(var C=s.backgroundColor||"#242424",T=s.backgroundColorLighter||"#2c2c2c",O=s.backgroundColorLighter2||"#383838",P=s.backgroundColorLighter3||"#454545",E=s.color||"#ccc",x=s.colorTop||"#f29766",I=s.colorBot||"#5db0d7",S=t.DOCUMENT.querySelectorAll("style"),L=0;L0&&t.push(new e.BoundingBox(this)),t.push(new e.Info(this)),t},n.prototype.setVisible=function(e){this._obj.setEnabled(e),this._obj.isVisible=e},n.prototype.isVisible=function(){return this._obj.isEnabled()&&(void 0===this._obj.isVisible||this._obj.isVisible)},n.prototype.isBoxVisible=function(){return this._obj.showBoundingBox},n.prototype.setBoxVisible=function(e){return this._obj.showBoundingBox=e},n.prototype.debug=function(e){if(this._axesViewer||this._drawAxis(),!e&&this._axesViewer){this._obj.getScene().onBeforeRenderObservable.remove(this.onBeforeRenderObserver),this._axesViewer.dispose(),this._axesViewer=null}},n.prototype.getInfo=function(){return this._obj instanceof BABYLON.AbstractMesh?this._obj.getTotalVertices()+" vertices":"0 vertices"},n.prototype._drawAxis=function(){var e=this;this._obj.computeWorldMatrix();var t=new BABYLON.Vector3(1,0,0),n=new BABYLON.Vector3(0,1,0),r=new BABYLON.Vector3(0,0,1);this._axesViewer=new BABYLON.Debug.AxesViewer(this._obj.getScene());var i=this._obj;this.onBeforeRenderObserver=i.getScene().onBeforeRenderObservable.add((function(){var o=i.getWorldMatrix(),s=new BABYLON.Vector3(1,1,1);i instanceof BABYLON.AbstractMesh&&(s=i.getBoundingInfo().boundingBox.extendSizeWorld),e._axesViewer.scaleLines=2*Math.max(s.x,s.y,s.z),e._axesViewer.update(e._obj.position,BABYLON.Vector3.TransformNormal(t,o),BABYLON.Vector3.TransformNormal(n,o),BABYLON.Vector3.TransformNormal(r,o))}))},n})(e.Adapter);e.MeshAdapter=t})(INSPECTOR||(INSPECTOR={}));var __extends=this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}})(),INSPECTOR;!(function(e){var t=(function(t){function n(e){var n=t.call(this)||this;return n._detailRows=[],n._sortDirection={},n._build(),e&&(n._detailRows=e,n.update()),n}return __extends(n,t),Object.defineProperty(n.prototype,"details",{set:function(t){this.clean(),this._addSearchBarDetails(),this._details=e.Helpers.CreateDiv("details",this._div),this._detailRows=t,this.update()},enumerable:!0,configurable:!0}),n.prototype._build=function(){this._div.className="insp-details",this._div.id="insp-details",this._createHeaderRow(),this._div.appendChild(this._headerRow)},n.prototype.update=function(e){this._sortDetails("name",1),e?(this.cleanRow(),this._addSearchDetails(e)):this._addDetails()},n.prototype._addSearchBarDetails=function(){var t=e.Helpers.CreateDiv("searchbar-details",this._div);this._searchDetails=new e.SearchBarDetails(this),t.appendChild(this._searchDetails.toHtml()),this._div.appendChild(t)},n.prototype.searchByName=function(e){for(var t=[],n=0,r=this._detailRows;n=0&&t.push(i)}this.update(t)},n.prototype._addDetails=function(){for(var e=0,t=this._detailRows;e0))return null;for(var i=0,o=r.children;i0){for(var o=new e.TreeItem(t,new e.GUIAdapter(n)),s=0,a=i;s0){for(var p=0,c=s;p=i._tabs.length)&&(r=0),i._tabs[r].active(!0);for(var o=0,s=i._tabs;o0&&t>e;){var n=this._visibleTabs.pop();if(!n)break;this._invisibleTabs.push(n),this._div.removeChild(n.toHtml()),t=this.getPixelWidth()+75}if(this._invisibleTabs.length>0&&t+750&&!this._div.contains(this._moreTabsIcon)&&this._div.appendChild(this._moreTabsIcon)}},n})(e.BasicElement);e.TabBar=t})(INSPECTOR||(INSPECTOR={}));var INSPECTOR;!(function(e){var t=(function(){function t(t,n,r,i){var o=this;this._inspector=r,this._elem=e.Inspector.DOCUMENT.createElement("i"),this._elem.className="tool fa "+t,n.appendChild(this._elem),this._elem.addEventListener("click",(function(e){o.action()})),new e.Tooltip(this._elem,i)}return t.prototype.toHtml=function(){return this._elem},t.prototype.getPixelWidth=function(){var t=e.Inspector.WINDOW.getComputedStyle(this._elem);if(!t.marginLeft||!t.marginRight)return 0;var n=parseFloat(t.marginLeft.substr(0,t.marginLeft.length-2))||0,r=parseFloat(t.marginRight.substr(0,t.marginRight.length-2))||0;return(this._elem.clientWidth||0)+n+r},t.prototype._updateIcon=function(e){this._elem.className="tool fa "+e},t})();e.AbstractTool=t})(INSPECTOR||(INSPECTOR={}));var __extends=this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}})(),INSPECTOR;!(function(e){var t=(function(t){function n(e,n){var r=t.call(this,"fa-pause",e,n,"Pause the automatic update of properties")||this;return r._isPause=!1,r}return __extends(n,t),n.prototype.action=function(){this._isPause?(e.Scheduler.getInstance().pause=!1,this._updateIcon("fa-pause")):(e.Scheduler.getInstance().pause=!0,this._updateIcon("fa-play")),this._isPause=!this._isPause},n})(e.AbstractTool);e.PauseScheduleTool=t})(INSPECTOR||(INSPECTOR={}));var __extends=this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}})(),INSPECTOR;!(function(e){var t=(function(e){function t(t,n){var r=e.call(this,"fa-mouse-pointer",t,n,"Select a mesh in the scene")||this;return r._isActive=!1,r._pickHandler=r._pickMesh.bind(r),r}return __extends(t,e),t.prototype.action=function(){if(this._isActive)this._deactivate();else{this.toHtml().classList.add("active");this._inspector.scene.getEngine().getRenderingCanvas().addEventListener("click",this._pickHandler),this._isActive=!0}},t.prototype._deactivate=function(){this.toHtml().classList.remove("active"),this._inspector.scene.getEngine().getRenderingCanvas().removeEventListener("click",this._pickHandler),this._isActive=!1},t.prototype._pickMesh=function(e){var t=this._updatePointerPosition(e),n=this._inspector.scene.pick(t.x,t.y,(function(e){return!0}));n&&n.pickedMesh&&this._inspector.displayObjectDetails(n.pickedMesh),this._deactivate()},t.prototype._updatePointerPosition=function(e){var t=this._inspector.scene.getEngine().getRenderingCanvasClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}},t})(e.AbstractTool);e.PickTool=t})(INSPECTOR||(INSPECTOR={}));var __extends=this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}})(),INSPECTOR;!(function(e){var t=(function(e){function t(t,n){return e.call(this,"fa-external-link",t,n,"Open the inspector in a popup")||this}return __extends(t,e),t.prototype.action=function(){this._inspector.openPopup()},t})(e.AbstractTool);e.PopupTool=t})(INSPECTOR||(INSPECTOR={}));var __extends=this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}})(),INSPECTOR;!(function(e){var t=(function(e){function t(t,n){return e.call(this,"fa-refresh",t,n,"Refresh the current tab")||this}return __extends(t,e),t.prototype.action=function(){this._inspector.refresh()},t})(e.AbstractTool);e.RefreshTool=t})(INSPECTOR||(INSPECTOR={}));var __extends=this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}})(),INSPECTOR;!(function(e){var t=(function(t){function n(e,n){var r=t.call(this,"fa-tags",e,n,"Display mesh names on the canvas")||this;return r._isDisplayed=!1,r._advancedTexture=null,r._labelInitialized=!1,r._scene=null,r._guiLoaded=!1,r._scene=n.scene,r}return __extends(n,t),n.prototype.dispose=function(){this._advancedTexture&&this._advancedTexture.dispose()},n.prototype._checkGUILoaded=function(){return!0===this._guiLoaded||(BABYLON.GUI&&(this._guiLoaded=!0),this._guiLoaded)},n.prototype._initializeLabels=function(){var e=this;if(!this._labelInitialized&&this._scene&&this._checkGUILoaded()){this._advancedTexture=BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("UI");for(var t=0,n=this._scene.meshes;t0){for(var e=0,t=this.children;e0){for(var e=0,t=this.children;e0&&(this._div.classList.contains("folded")||this._div.classList.contains("unfolded")||this._div.classList.add("folded")),this.fold()},n.prototype._addEvent=function(){var e=this;this._div.addEventListener("click",(function(t){e._tab.select(e),e._isFolded()?e.unfold():e.fold(),t.stopPropagation()}))},n.prototype._isFolded=function(){return!this._div.classList.contains("unfolded")},n.prototype.active=function(e){this._div.classList.remove("active");for(var t=0,n=this.children;t