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('Error : loading "babylon.gui.js". 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(),l=p.parentElement,c=t.WINDOW.getComputedStyle(p);if(this._canvasStyle={width:e.Helpers.Css(p,"width"),height:e.Helpers.Css(p,"height"),position:c.position,top:c.top,bottom:c.bottom,left:c.left,right:c.right,padding:c.padding,paddingBottom:c.paddingBottom,paddingLeft:c.paddingLeft,paddingTop:c.paddingTop,paddingRight:c.paddingRight,margin:c.margin,marginBottom:c.marginBottom,marginLeft:c.marginLeft,marginTop:c.marginTop,marginRight:c.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(!c.width||!c.height||!c.left)return;var h=parseFloat(c.width.substr(0,c.width.length-2))||0,d=parseFloat(c.height.substr(0,c.height.length-2))||0;if("absolute"===c.position||"relative"===c.position){var f=parseFloat(c.left.substr(0,c.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",l&&l.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(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",L=s.colorBot||"#5db0d7",I=t.DOCUMENT.querySelectorAll("style"),S=0;S0&&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,l=s;p1)this._refreshRateCounter--;else{for(var e=0,t=this._updatableProperties;e0,o=n.name.toLowerCase().indexOf(".env")>0;if(!r&&!o)return a.style.display="block",void(a.textContent="Please, select a dds or env file.");BABYLON.Tools.ReadFile(n,(function(e){var t=new Blob([e],{type:"octet/stream"}),n=URL.createObjectURL(t);r?(i._scene.environmentTexture=BABYLON.CubeTexture.CreateFromPrefilteredData(n,i._scene,".dds"),a.style.display="none"):i._scene.environmentTexture=new BABYLON.CubeTexture(n,i._scene,void 0,void 0,void 0,function(){a.style.display="none"},function(e){e&&(a.style.display="block",a.textContent=e)},void 0,void 0,".env")}),void 0,!0)},p.appendChild(l),i._scene.getEngine().premultipliedAlpha||(p=e.Helpers.CreateDiv(null,i._panel),l=e.Inspector.DOCUMENT.createElement("input"),l.value="Compress current texture to .env",l.className="tool-input",l.type="button",l.onclick=function(){if(!i._scene.environmentTexture)return a.style.display="block",void(a.textContent="You must load an environment texture first.");i._scene.activeCamera?BABYLON.EnvironmentTextureTools.CreateEnvTextureAsync(i._scene.environmentTexture).then((function(e){var t=new Blob([e],{type:"octet/stream"});BABYLON.Tools.Download(t,"environment.env"),a.style.display="none"})).catch((function(e){a.style.display="block",a.textContent=e})):(a.style.display="block",a.textContent="An active camera is required.")},p.appendChild(l)),i._panel.appendChild(a),o=e.Helpers.CreateDiv("tool-title2",i._panel),o.textContent="Capture";var p=e.Helpers.CreateDiv(null,i._panel),l=e.Inspector.DOCUMENT.createElement("input");return l.value="Take Screenshot",l.type="button",l.className="tool-input",l.onclick=function(){i._scene.activeCamera&&BABYLON.Tools.CreateScreenshot(i._scene.getEngine(),i._scene.activeCamera,{precision:.5})},p.appendChild(l),i}return __extends(n,t),n.prototype.dispose=function(){},n})(e.Tab);e.ToolsTab=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(n,r){var i=t.call(this)||this;i._tabs=[],i._invisibleTabs=[],i._visibleTabs=[],i._inspector=n,i._tabs.push(new e.SceneTab(i,i._inspector)),i._tabs.push(new e.ConsoleTab(i,i._inspector)),i._tabs.push(new e.StatsTab(i,i._inspector)),i._meshTab=new e.MeshTab(i,i._inspector),i._tabs.push(new e.TextureTab(i,i._inspector)),i._tabs.push(i._meshTab),i._tabs.push(new e.LightTab(i,i._inspector)),i._tabs.push(new e.MaterialTab(i,i._inspector)),e.GLTFTab.IsSupported&&i._tabs.push(new e.GLTFTab(i,i._inspector)),BABYLON.GUI&&i._tabs.push(new e.GUITab(i,i._inspector)),i._tabs.push(new e.PhysicsTab(i,i._inspector)),i._tabs.push(new e.CameraTab(i,i._inspector)),i._tabs.push(new e.SoundTab(i,i._inspector)),i._tabs.push(new e.ToolsTab(i,i._inspector)),i._toolBar=new e.Toolbar(i._inspector),i._build(),(!r||r<0||r>=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,o){var s=this;this._inspector=i,this._elem=e.Inspector.DOCUMENT.createElement("i"),this._elem.className="tool "+t+" "+n,r.appendChild(this._elem),this._elem.addEventListener("click",(function(e){s.action()})),new e.Tooltip(this._elem,o)}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","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","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,"fas","fa-external-link-alt",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","fa-sync",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","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