!(function(a){var e,r,n,t,o;(r=e=a.GLTFLoaderCoordinateSystemMode||(a.GLTFLoaderCoordinateSystemMode={}))[r.AUTO=0]="AUTO",r[r.FORCE_RIGHT_HANDED=1]="FORCE_RIGHT_HANDED",(t=n=a.GLTFLoaderAnimationStartMode||(a.GLTFLoaderAnimationStartMode={}))[t.NONE=0]="NONE",t[t.FIRST=1]="FIRST",t[t.ALL=2]="ALL",(o=a.GLTFLoaderState||(a.GLTFLoaderState={}))[o.LOADING=0]="LOADING",o[o.READY=1]="READY",o[o.COMPLETE=2]="COMPLETE";var i=(function(){function u(){this.onParsedObservable=new a.Observable,this.coordinateSystemMode=e.AUTO,this.animationStartMode=n.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 a.Observable,this.onTextureLoadedObservable=new a.Observable,this.onMaterialLoadedObservable=new a.Observable,this.onCameraLoadedObservable=new a.Observable,this.onCompleteObservable=new a.Observable,this.onErrorObservable=new a.Observable,this.onDisposeObservable=new a.Observable,this.onExtensionLoadedObservable=new a.Observable,this._loader=null,this.name="gltf",this.extensions={".gltf":{isBinary:!1},".glb":{isBinary:!0}},this._logIndentLevel=0,this._loggingEnabled=!1,this._log=this._logDisabled,this._capturePerformanceCounters=!1,this._startPerformanceCounter=this._startPerformanceCounterDisabled,this._endPerformanceCounter=this._endPerformanceCounterDisabled}return Object.defineProperty(u.prototype,"onParsed",{set:function(e){this._onParsedObserver&&this.onParsedObservable.remove(this._onParsedObserver),this._onParsedObserver=this.onParsedObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"onMeshLoaded",{set:function(e){this._onMeshLoadedObserver&&this.onMeshLoadedObservable.remove(this._onMeshLoadedObserver),this._onMeshLoadedObserver=this.onMeshLoadedObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"onTextureLoaded",{set:function(e){this._onTextureLoadedObserver&&this.onTextureLoadedObservable.remove(this._onTextureLoadedObserver),this._onTextureLoadedObserver=this.onTextureLoadedObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"onMaterialLoaded",{set:function(e){this._onMaterialLoadedObserver&&this.onMaterialLoadedObservable.remove(this._onMaterialLoadedObserver),this._onMaterialLoadedObserver=this.onMaterialLoadedObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"onCameraLoaded",{set:function(e){this._onCameraLoadedObserver&&this.onCameraLoadedObservable.remove(this._onCameraLoadedObserver),this._onCameraLoadedObserver=this.onCameraLoadedObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"onComplete",{set:function(e){this._onCompleteObserver&&this.onCompleteObservable.remove(this._onCompleteObserver),this._onCompleteObserver=this.onCompleteObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"onError",{set:function(e){this._onErrorObserver&&this.onErrorObservable.remove(this._onErrorObserver),this._onErrorObserver=this.onErrorObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"onExtensionLoaded",{set:function(e){this._onExtensionLoadedObserver&&this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver),this._onExtensionLoadedObserver=this.onExtensionLoadedObservable.add(e)},enumerable:!0,configurable:!0}),u.prototype.whenCompleteAsync=function(){var n=this;return new Promise(function(e,r){n.onCompleteObservable.addOnce((function(){e()})),n.onErrorObservable.addOnce((function(e){r(e)}))})},Object.defineProperty(u.prototype,"loaderState",{get:function(){return this._loader?this._loader.state:null},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"loggingEnabled",{get:function(){return this._loggingEnabled},set:function(e){this._loggingEnabled!==e&&(this._loggingEnabled=e,this._loggingEnabled?this._log=this._logEnabled:this._log=this._logDisabled)},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"capturePerformanceCounters",{get:function(){return this._capturePerformanceCounters},set:function(e){this._capturePerformanceCounters!==e&&(this._capturePerformanceCounters=e,this._capturePerformanceCounters?(this._startPerformanceCounter=this._startPerformanceCounterEnabled,this._endPerformanceCounter=this._endPerformanceCounterEnabled):(this._startPerformanceCounter=this._startPerformanceCounterDisabled,this._endPerformanceCounter=this._endPerformanceCounterDisabled))},enumerable:!0,configurable:!0}),u.prototype.dispose=function(){this._loader&&(this._loader.dispose(),this._loader=null),this._clear(),this.onDisposeObservable.notifyObservers(void 0),this.onDisposeObservable.clear()},u.prototype._clear=function(){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()},u.prototype.importMeshAsync=function(r,n,t,o,i){var a=this;return Promise.resolve().then((function(){var e=a._parse(t);return a._loader=a._getLoader(e),a._loader.importMeshAsync(r,n,e,o,i)}))},u.prototype.loadAsync=function(r,n,t,o){var i=this;return Promise.resolve().then((function(){var e=i._parse(n);return i._loader=i._getLoader(e),i._loader.loadAsync(r,e,t,o)}))},u.prototype.loadAssetContainerAsync=function(n,r,t,o){var i=this;return Promise.resolve().then((function(){var e=i._parse(r);return i._loader=i._getLoader(e),i._loader.importMeshAsync(null,n,e,t,o).then((function(e){var r=new a.AssetContainer(n);return Array.prototype.push.apply(r.meshes,e.meshes),Array.prototype.push.apply(r.particleSystems,e.particleSystems),Array.prototype.push.apply(r.skeletons,e.skeletons),Array.prototype.push.apply(r.animationGroups,e.animationGroups),r.removeAllFromScene(),r}))}))},u.prototype.canDirectLoad=function(e){return-1!==e.indexOf("scene")&&-1!==e.indexOf("node")},u.prototype.createPlugin=function(){return new u},u.prototype._parse=function(e){var r;return this._startPerformanceCounter("Parse"),e instanceof ArrayBuffer?(this._log("Parsing binary"),r=this._parseBinary(e)):(this._log("Parsing JSON"),this._log("JSON length: "+e.length),r={json:JSON.parse(e),bin:null}),this.onParsedObservable.notifyObservers(r),this.onParsedObservable.clear(),this._endPerformanceCounter("Parse"),r},u.prototype._getLoader=function(e){var r=e.json.asset||{};this._log("Asset version: "+r.version),r.minVersion&&this._log("Asset minimum version: "+r.minVersion),r.generator&&this._log("Asset generator: "+r.generator);var n=u._parseVersion(r.version);if(!n)throw new Error("Invalid version: "+r.version);if(void 0!==r.minVersion){var t=u._parseVersion(r.minVersion);if(!t)throw new Error("Invalid minimum version: "+r.minVersion);if(0r.major?1:e.majorr.minor?1:e.minor=this._maxPos},e})(),V=["MODEL","VIEW","PROJECTION","MODELVIEW","MODELVIEWPROJECTION","JOINTMATRIX"],D=["world","view","projection","worldView","worldViewProjection","mBones"],S=["translation","rotation","scale"],x=["position","rotationQuaternion","scaling"],o=function(e,r,n){for(var t in e){var o=e[t];n[r][t]=o}},F=function(e){if(e)for(var r=0;ri.byteLength)throw new Error("Buffer access is out of range");var a=i.buffer;switch(n+=i.byteOffset,o){case s.EComponentType.BYTE:return new Int8Array(a,n,t);case s.EComponentType.UNSIGNED_BYTE:return new Uint8Array(a,n,t);case s.EComponentType.SHORT:return new Int16Array(a,n,t);case s.EComponentType.UNSIGNED_SHORT:return new Uint16Array(a,n,t);default:return new Float32Array(a,n,t)}},o.GetBufferFromAccessor=function(e,r){var n=e.bufferViews[r.bufferView],t=r.count*o.GetByteStrideFromType(r);return o.GetBufferFromBufferView(e,n,r.byteOffset,t,r.componentType)},o.DecodeBufferToText=function(e){for(var r="",n=e.byteLength,t=0;t