var BABYLON;!(function(e){var t;!(function(e){e[e.AUTO=0]="AUTO",e[e.FORCE_RIGHT_HANDED=1]="FORCE_RIGHT_HANDED"})(t=e.GLTFLoaderCoordinateSystemMode||(e.GLTFLoaderCoordinateSystemMode={}));var r;!(function(e){e[e.NONE=0]="NONE",e[e.FIRST=1]="FIRST",e[e.ALL=2]="ALL"})(r=e.GLTFLoaderAnimationStartMode||(e.GLTFLoaderAnimationStartMode={}));!(function(e){e[e.LOADING=0]="LOADING",e[e.READY=1]="READY",e[e.COMPLETE=2]="COMPLETE"})(e.GLTFLoaderState||(e.GLTFLoaderState={}));var n=(function(){function n(){this.onParsedObservable=new e.Observable,this.coordinateSystemMode=t.AUTO,this.animationStartMode=r.FIRST,this.compileMaterials=!1,this.useClipPlane=!1,this.compileShadowGenerators=!1,this.transparencyAsCoverage=!1,this._normalizeAnimationGroupsToBeginAtZero=!0,this.preprocessUrlAsync=function(e){return Promise.resolve(e)},this.onMeshLoadedObservable=new e.Observable,this.onTextureLoadedObservable=new e.Observable,this.onMaterialLoadedObservable=new e.Observable,this.onCameraLoadedObservable=new e.Observable,this.onCompleteObservable=new e.Observable,this.onDisposeObservable=new e.Observable,this.onExtensionLoadedObservable=new e.Observable,this._loader=null,this.name="gltf",this.extensions={".gltf":{isBinary:!1},".glb":{isBinary:!0}}}return Object.defineProperty(n.prototype,"onParsed",{set:function(e){this._onParsedObserver&&this.onParsedObservable.remove(this._onParsedObserver),this._onParsedObserver=this.onParsedObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"onMeshLoaded",{set:function(e){this._onMeshLoadedObserver&&this.onMeshLoadedObservable.remove(this._onMeshLoadedObserver),this._onMeshLoadedObserver=this.onMeshLoadedObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"onTextureLoaded",{set:function(e){this._onTextureLoadedObserver&&this.onTextureLoadedObservable.remove(this._onTextureLoadedObserver),this._onTextureLoadedObserver=this.onTextureLoadedObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"onMaterialLoaded",{set:function(e){this._onMaterialLoadedObserver&&this.onMaterialLoadedObservable.remove(this._onMaterialLoadedObserver),this._onMaterialLoadedObserver=this.onMaterialLoadedObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"onCameraLoaded",{set:function(e){this._onCameraLoadedObserver&&this.onCameraLoadedObservable.remove(this._onCameraLoadedObserver),this._onCameraLoadedObserver=this.onCameraLoadedObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"onComplete",{set:function(e){this._onCompleteObserver&&this.onCompleteObservable.remove(this._onCompleteObserver),this._onCompleteObserver=this.onCompleteObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"onExtensionLoaded",{set:function(e){this._onExtensionLoadedObserver&&this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver),this._onExtensionLoadedObserver=this.onExtensionLoadedObservable.add(e)},enumerable:!0,configurable:!0}),n.prototype.whenCompleteAsync=function(){var e=this;return new Promise(function(t){e.onCompleteObservable.add((function(){t()}),void 0,void 0,void 0,!0)})},Object.defineProperty(n.prototype,"loaderState",{get:function(){return this._loader?this._loader.state:null},enumerable:!0,configurable:!0}),n.prototype.dispose=function(){this._loader&&(this._loader.dispose(),this._loader=null),this.preprocessUrlAsync=function(e){return Promise.resolve(e)},this.onMeshLoadedObservable.clear(),this.onTextureLoadedObservable.clear(),this.onMaterialLoadedObservable.clear(),this.onCameraLoadedObservable.clear(),this.onCompleteObservable.clear(),this.onExtensionLoadedObservable.clear(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()},n.prototype.importMeshAsync=function(e,t,r,n,o){var a=this;return Promise.resolve().then((function(){var i=a._parse(r);return a._loader=a._getLoader(i),a._loader.importMeshAsync(e,t,i,n,o)}))},n.prototype.loadAsync=function(e,t,r,n){var o=this;return Promise.resolve().then((function(){var a=o._parse(t);return o._loader=o._getLoader(a),o._loader.loadAsync(e,a,r,n)}))},n.prototype.loadAssetContainerAsync=function(t,r,n,o){var a=this;return Promise.resolve().then((function(){var i=a._parse(r);return a._loader=a._getLoader(i),a._loader.importMeshAsync(null,t,i,n,o).then((function(r){var n=new e.AssetContainer(t);return Array.prototype.push.apply(n.meshes,r.meshes),Array.prototype.push.apply(n.particleSystems,r.particleSystems),Array.prototype.push.apply(n.skeletons,r.skeletons),Array.prototype.push.apply(n.animationGroups,r.animationGroups),n.removeAllFromScene(),n}))}))},n.prototype.canDirectLoad=function(e){return-1!==e.indexOf("scene")&&-1!==e.indexOf("node")},n.prototype.createPlugin=function(){return new n},n.prototype._parse=function(e){var t;return t=e instanceof ArrayBuffer?n._parseBinary(e):{json:JSON.parse(e),bin:null},this.onParsedObservable.notifyObservers(t),this.onParsedObservable.clear(),t},n.prototype._getLoader=function(e){var t=this,r={major:2,minor:0},o=e.json.asset||{},a=n._parseVersion(o.version);if(!a)throw new Error("Invalid version: "+o.version);if(void 0!==o.minVersion){var i=n._parseVersion(o.minVersion);if(!i)throw new Error("Invalid minimum version: "+o.minVersion);if(n._compareVersion(i,r)>0)throw new Error("Incompatible minimum version: "+o.minVersion)}var s={1:n.CreateGLTFLoaderV1,2:n.CreateGLTFLoaderV2},l=s[a.major];if(!l)throw new Error("Unsupported version: "+o.version);var u=l();return u.coordinateSystemMode=this.coordinateSystemMode,u.animationStartMode=this.animationStartMode,u.compileMaterials=this.compileMaterials,u.useClipPlane=this.useClipPlane,u.compileShadowGenerators=this.compileShadowGenerators,u.transparencyAsCoverage=this.transparencyAsCoverage,u._normalizeAnimationGroupsToBeginAtZero=this._normalizeAnimationGroupsToBeginAtZero,u.preprocessUrlAsync=this.preprocessUrlAsync,u.onMeshLoadedObservable.add((function(e){return t.onMeshLoadedObservable.notifyObservers(e)})),u.onTextureLoadedObservable.add((function(e){return t.onTextureLoadedObservable.notifyObservers(e)})),u.onMaterialLoadedObservable.add((function(e){return t.onMaterialLoadedObservable.notifyObservers(e)})),u.onCameraLoadedObservable.add((function(e){return t.onCameraLoadedObservable.notifyObservers(e)})),u.onExtensionLoadedObservable.add((function(e){return t.onExtensionLoadedObservable.notifyObservers(e)})),u.onCompleteObservable.add((function(){t.onMeshLoadedObservable.clear(),t.onTextureLoadedObservable.clear(),t.onMaterialLoadedObservable.clear(),t.onCameraLoadedObservable.clear(),t.onExtensionLoadedObservable.clear(),t.onCompleteObservable.notifyObservers(t),t.onCompleteObservable.clear()})),u},n._parseBinary=function(e){var t={Magic:1179937895},r=new o(e),a=r.readUint32();if(a!==t.Magic)throw new Error("Unexpected magic: "+a);var i=r.readUint32();switch(i){case 1:return n._parseV1(r);case 2:return n._parseV2(r)}throw new Error("Unsupported version: "+i)},n._parseV1=function(e){var t={JSON:0},r=e.readUint32();if(r!=e.getLength())throw new Error("Length in header does not match actual data length: "+r+" != "+e.getLength());var o,a=e.readUint32(),i=e.readUint32();switch(i){case t.JSON:o=JSON.parse(n._decodeBufferToText(e.readUint8Array(a)));break;default:throw new Error("Unexpected content format: "+i)}var s=e.getLength()-e.getPosition();return{json:o,bin:e.readUint8Array(s)}},n._parseV2=function(e){var t={JSON:1313821514,BIN:5130562},r=e.readUint32();if(r!==e.getLength())throw new Error("Length in header does not match actual data length: "+r+" != "+e.getLength());var o=e.readUint32();if(e.readUint32()!==t.JSON)throw new Error("First chunk format is not JSON");for(var a=JSON.parse(n._decodeBufferToText(e.readUint8Array(o))),i=null;e.getPosition()t.major?1:e.majort.minor?1:e.minort.bin.byteLength)&&e.Tools.Warn("Binary buffer length ("+n.byteLength+") from JSON does not match chunk length ("+t.bin.byteLength+")"),n._data=Promise.resolve(t.bin)}else e.Tools.Warn("Unexpected BIN chunk")}},r.prototype._setupData=function(){if(t._ArrayItem.Assign(this._gltf.accessors),t._ArrayItem.Assign(this._gltf.animations),t._ArrayItem.Assign(this._gltf.buffers),t._ArrayItem.Assign(this._gltf.bufferViews),t._ArrayItem.Assign(this._gltf.cameras),t._ArrayItem.Assign(this._gltf.images),t._ArrayItem.Assign(this._gltf.materials),t._ArrayItem.Assign(this._gltf.meshes),t._ArrayItem.Assign(this._gltf.nodes),t._ArrayItem.Assign(this._gltf.samplers),t._ArrayItem.Assign(this._gltf.scenes),t._ArrayItem.Assign(this._gltf.skins),t._ArrayItem.Assign(this._gltf.textures),this._gltf.nodes){for(var e={},r=0,n=this._gltf.nodes;r=0;i--)if(a.push(t.GLTFLoader._GetProperty(e+"/ids/"+o[i],n,o[i])),a.length===this.maxLODsToLoad)return a;return a.push(r),a},o})(t.GLTFLoaderExtension);r.MSFT_lod=o,t.GLTFLoader._Register(n,(function(e){return new o(e)}))})(t.Extensions||(t.Extensions={}))})(e.GLTF2||(e.GLTF2={}))})(BABYLON||(BABYLON={}));var __extends=this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}})(),BABYLON;!(function(e){!(function(e){!(function(t){var r="MSFT_minecraftMesh",n=(function(e){function t(t){var n=e.call(this,t)||this;n.name=r,n._onMaterialLoaded=function(e){e.needAlphaBlending()&&(e.forceDepthWrite=!0,e.separateCullingPass=!0),e.backFaceCulling=e.forceDepthWrite,e.twoSidedLighting=!0};var o=t._gltf.meshes;if(o&&o.length)for(var a=0,i=o;a